(function(t, e, i) {
function n(i) {
var r = e[i];
if (!r) {
var s = t[i];
if (!s) return;
var o = {};
r = e[i] = {
exports: o
};
s[0]((function(t) {
return n(s[1][t] || t);
}), r, o);
}
return r.exports;
}
for (var r = 0; r < i.length; r++) n(i[r]);
})({
1: [ (function(t) {
"use strict";
t("../core/platform/CCClass");
var e = t("../core/utils/misc");
cc.Action = cc.Class({
name: "cc.Action",
ctor: function() {
this.originalTarget = null;
this.target = null;
this.tag = cc.Action.TAG_INVALID;
},
clone: function() {
var t = new cc.Action();
t.originalTarget = null;
t.target = null;
t.tag = this.tag;
return t;
},
isDone: function() {
return !0;
},
startWithTarget: function(t) {
this.originalTarget = t;
this.target = t;
},
stop: function() {
this.target = null;
},
step: function() {
cc.logID(1006);
},
update: function() {
cc.logID(1007);
},
getTarget: function() {
return this.target;
},
setTarget: function(t) {
this.target = t;
},
getOriginalTarget: function() {
return this.originalTarget;
},
setOriginalTarget: function(t) {
this.originalTarget = t;
},
getTag: function() {
return this.tag;
},
setTag: function(t) {
this.tag = t;
},
retain: function() {},
release: function() {}
});
cc.Action.TAG_INVALID = -1;
cc.FiniteTimeAction = cc.Class({
name: "cc.FiniteTimeAction",
extends: cc.Action,
ctor: function() {
this._duration = 0;
},
getDuration: function() {
return this._duration * (this._timesForRepeat || 1);
},
setDuration: function(t) {
this._duration = t;
},
reverse: function() {
cc.logID(1008);
return null;
},
clone: function() {
return new cc.FiniteTimeAction();
}
});
cc.Speed = cc.Class({
name: "cc.Speed",
extends: cc.Action,
ctor: function(t, e) {
this._speed = 0;
this._innerAction = null;
t && this.initWithAction(t, e);
},
getSpeed: function() {
return this._speed;
},
setSpeed: function(t) {
this._speed = t;
},
initWithAction: function(t, e) {
if (!t) {
cc.errorID(1021);
return !1;
}
this._innerAction = t;
this._speed = e;
return !0;
},
clone: function() {
var t = new cc.Speed();
t.initWithAction(this._innerAction.clone(), this._speed);
return t;
},
startWithTarget: function(t) {
cc.Action.prototype.startWithTarget.call(this, t);
this._innerAction.startWithTarget(t);
},
stop: function() {
this._innerAction.stop();
cc.Action.prototype.stop.call(this);
},
step: function(t) {
this._innerAction.step(t * this._speed);
},
isDone: function() {
return this._innerAction.isDone();
},
reverse: function() {
return new cc.Speed(this._innerAction.reverse(), this._speed);
},
setInnerAction: function(t) {
this._innerAction !== t && (this._innerAction = t);
},
getInnerAction: function() {
return this._innerAction;
}
});
cc.speed = function(t, e) {
return new cc.Speed(t, e);
};
cc.Follow = cc.Class({
name: "cc.Follow",
extends: cc.Action,
ctor: function(t, e) {
this._followedNode = null;
this._boundarySet = !1;
this._boundaryFullyCovered = !1;
this._halfScreenSize = null;
this._fullScreenSize = null;
this.leftBoundary = 0;
this.rightBoundary = 0;
this.topBoundary = 0;
this.bottomBoundary = 0;
this._worldRect = cc.rect(0, 0, 0, 0);
t && (e ? this.initWithTarget(t, e) : this.initWithTarget(t));
},
clone: function() {
var t = new cc.Follow(), e = this._worldRect, i = new cc.Rect(e.x, e.y, e.width, e.height);
t.initWithTarget(this._followedNode, i);
return t;
},
isBoundarySet: function() {
return this._boundarySet;
},
setBoundarySet: function(t) {
this._boundarySet = t;
},
setBoudarySet: function(t) {
this.setBoundarySet(t);
},
initWithTarget: function(t, e) {
if (!t) {
cc.errorID(1022);
return !1;
}
e = e || cc.rect(0, 0, 0, 0);
this._followedNode = t;
this._worldRect = e;
this._boundarySet = !(0 === e.width && 0 === e.height);
this._boundaryFullyCovered = !1;
var i = cc.winSize;
this._fullScreenSize = cc.v2(i.width, i.height);
this._halfScreenSize = this._fullScreenSize.mul(.5);
if (this._boundarySet) {
this.leftBoundary = -(e.x + e.width - this._fullScreenSize.x);
this.rightBoundary = -e.x;
this.topBoundary = -e.y;
this.bottomBoundary = -(e.y + e.height - this._fullScreenSize.y);
this.rightBoundary < this.leftBoundary && (this.rightBoundary = this.leftBoundary = (this.leftBoundary + this.rightBoundary) / 2);
this.topBoundary < this.bottomBoundary && (this.topBoundary = this.bottomBoundary = (this.topBoundary + this.bottomBoundary) / 2);
this.topBoundary === this.bottomBoundary && this.leftBoundary === this.rightBoundary && (this._boundaryFullyCovered = !0);
}
return !0;
},
step: function() {
var t = this.target.convertToWorldSpaceAR(cc.Vec2.ZERO), i = this._followedNode.convertToWorldSpaceAR(cc.Vec2.ZERO), n = t.sub(i), r = this.target.parent.convertToNodeSpaceAR(n.add(this._halfScreenSize));
if (this._boundarySet) {
if (this._boundaryFullyCovered) return;
this.target.setPosition(e.clampf(r.x, this.leftBoundary, this.rightBoundary), e.clampf(r.y, this.bottomBoundary, this.topBoundary));
} else this.target.setPosition(r.x, r.y);
},
isDone: function() {
return !this._followedNode.activeInHierarchy;
},
stop: function() {
this.target = null;
cc.Action.prototype.stop.call(this);
}
});
cc.follow = function(t, e) {
return new cc.Follow(t, e);
};
}), {
"../core/platform/CCClass": 239,
"../core/utils/misc": 322
} ],
2: [ (function() {
"use strict";
function t(t, e, i, n, r, s) {
var o = s * s, a = o * s, c = (1 - r) / 2, l = c * (2 * o - a - s), u = c * (-a + o) + (2 * a - 3 * o) + 1, h = c * (a - 2 * o + s) + -2 * a + 3 * o, _ = c * (a - o), f = t.x * l + e.x * u + i.x * h + n.x * _, d = t.y * l + e.y * u + i.y * h + n.y * _;
return cc.v2(f, d);
}
function e(t, e) {
return t[Math.min(t.length - 1, Math.max(e, 0))];
}
function i(t) {
for (var e = [], i = t.length - 1; i >= 0; i--) e.push(cc.v2(t[i].x, t[i].y));
return e;
}
function n(t) {
for (var e = [], i = 0; i < t.length; i++) e.push(cc.v2(t[i].x, t[i].y));
return e;
}
cc.CardinalSplineTo = cc.Class({
name: "cc.CardinalSplineTo",
extends: cc.ActionInterval,
ctor: function(t, e, i) {
this._points = [];
this._deltaT = 0;
this._tension = 0;
this._previousPosition = null;
this._accumulatedDiff = null;
void 0 !== i && cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, i);
},
initWithDuration: function(t, e, i) {
if (!e || 0 === e.length) {
cc.errorID(1024);
return !1;
}
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this.setPoints(e);
this._tension = i;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.CardinalSplineTo();
t.initWithDuration(this._duration, n(this._points), this._tension);
return t;
},
startWithTarget: function(t) {
cc.ActionInterval.prototype.startWithTarget.call(this, t);
this._deltaT = 1 / (this._points.length - 1);
this._previousPosition = cc.v2(this.target.x, this.target.y);
this._accumulatedDiff = cc.v2(0, 0);
},
update: function(i) {
i = this._computeEaseTime(i);
var n, r, s = this._points;
if (1 === i) {
n = s.length - 1;
r = 1;
} else {
var o = this._deltaT;
r = (i - o * (n = 0 | i / o)) / o;
}
var a = t(e(s, n - 1), e(s, n - 0), e(s, n + 1), e(s, n + 2), this._tension, r);
if (cc.macro.ENABLE_STACKABLE_ACTIONS) {
var c, l;
c = this.target.x - this._previousPosition.x;
l = this.target.y - this._previousPosition.y;
if (0 !== c || 0 !== l) {
var u = this._accumulatedDiff;
c = u.x + c;
l = u.y + l;
u.x = c;
u.y = l;
a.x += c;
a.y += l;
}
}
this.updatePosition(a);
},
reverse: function() {
var t = i(this._points);
return cc.cardinalSplineTo(this._duration, t, this._tension);
},
updatePosition: function(t) {
this.target.setPosition(t);
this._previousPosition = t;
},
getPoints: function() {
return this._points;
},
setPoints: function(t) {
this._points = t;
}
});
cc.cardinalSplineTo = function(t, e, i) {
return new cc.CardinalSplineTo(t, e, i);
};
cc.CardinalSplineBy = cc.Class({
name: "cc.CardinalSplineBy",
extends: cc.CardinalSplineTo,
ctor: function(t, e, i) {
this._startPosition = cc.v2(0, 0);
void 0 !== i && this.initWithDuration(t, e, i);
},
startWithTarget: function(t) {
cc.CardinalSplineTo.prototype.startWithTarget.call(this, t);
this._startPosition.x = t.x;
this._startPosition.y = t.y;
},
reverse: function() {
for (var t, e = this._points.slice(), n = e[0], r = 1; r < e.length; ++r) {
t = e[r];
e[r] = t.sub(n);
n = t;
}
var s = i(e);
n = s[s.length - 1];
s.pop();
n.x = -n.x;
n.y = -n.y;
s.unshift(n);
for (r = 1; r < s.length; ++r) {
(t = s[r]).x = -t.x;
t.y = -t.y;
t.x += n.x;
t.y += n.y;
s[r] = t;
n = t;
}
return cc.cardinalSplineBy(this._duration, s, this._tension);
},
updatePosition: function(t) {
var e = this._startPosition, i = t.x + e.x, n = t.y + e.y;
this._previousPosition.x = i;
this._previousPosition.y = n;
this.target.setPosition(i, n);
},
clone: function() {
var t = new cc.CardinalSplineBy();
t.initWithDuration(this._duration, n(this._points), this._tension);
return t;
}
});
cc.cardinalSplineBy = function(t, e, i) {
return new cc.CardinalSplineBy(t, e, i);
};
cc.CatmullRomTo = cc.Class({
name: "cc.CatmullRomTo",
extends: cc.CardinalSplineTo,
ctor: function(t, e) {
e && this.initWithDuration(t, e);
},
initWithDuration: function(t, e) {
return cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, .5);
},
clone: function() {
var t = new cc.CatmullRomTo();
t.initWithDuration(this._duration, n(this._points));
return t;
}
});
cc.catmullRomTo = function(t, e) {
return new cc.CatmullRomTo(t, e);
};
cc.CatmullRomBy = cc.Class({
name: "cc.CatmullRomBy",
extends: cc.CardinalSplineBy,
ctor: function(t, e) {
e && this.initWithDuration(t, e);
},
initWithDuration: function(t, e) {
return cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, .5);
},
clone: function() {
var t = new cc.CatmullRomBy();
t.initWithDuration(this._duration, n(this._points));
return t;
}
});
cc.catmullRomBy = function(t, e) {
return new cc.CatmullRomBy(t, e);
};
}), {} ],
3: [ (function() {
"use strict";
cc.easeIn = function(t) {
return {
_rate: t,
easing: function(t) {
return Math.pow(t, this._rate);
},
reverse: function() {
return cc.easeIn(1 / this._rate);
}
};
};
cc.easeOut = function(t) {
return {
_rate: t,
easing: function(t) {
return Math.pow(t, 1 / this._rate);
},
reverse: function() {
return cc.easeOut(1 / this._rate);
}
};
};
cc.easeInOut = function(t) {
return {
_rate: t,
easing: function(t) {
return (t *= 2) < 1 ? .5 * Math.pow(t, this._rate) : 1 - .5 * Math.pow(2 - t, this._rate);
},
reverse: function() {
return cc.easeInOut(this._rate);
}
};
};
var t = {
easing: function(t) {
return 0 === t ? 0 : Math.pow(2, 10 * (t - 1));
},
reverse: function() {
return e;
}
};
cc.easeExponentialIn = function() {
return t;
};
var e = {
easing: function(t) {
return 1 === t ? 1 : 1 - Math.pow(2, -10 * t);
},
reverse: function() {
return t;
}
};
cc.easeExponentialOut = function() {
return e;
};
var i = {
easing: function(t) {
return 1 !== t && 0 !== t ? (t *= 2) < 1 ? .5 * Math.pow(2, 10 * (t - 1)) : .5 * (2 - Math.pow(2, -10 * (t - 1))) : t;
},
reverse: function() {
return i;
}
};
cc.easeExponentialInOut = function() {
return i;
};
var n = {
easing: function(t) {
return 0 === t || 1 === t ? t : -1 * Math.cos(t * Math.PI / 2) + 1;
},
reverse: function() {
return r;
}
};
cc.easeSineIn = function() {
return n;
};
var r = {
easing: function(t) {
return 0 === t || 1 === t ? t : Math.sin(t * Math.PI / 2);
},
reverse: function() {
return n;
}
};
cc.easeSineOut = function() {
return r;
};
var s = {
easing: function(t) {
return 0 === t || 1 === t ? t : -.5 * (Math.cos(Math.PI * t) - 1);
},
reverse: function() {
return s;
}
};
cc.easeSineInOut = function() {
return s;
};
var o = {
easing: function(t) {
if (0 === t || 1 === t) return t;
t -= 1;
return -Math.pow(2, 10 * t) * Math.sin((t - .075) * Math.PI * 2 / .3);
},
reverse: function() {
return a;
}
};
cc.easeElasticIn = function(t) {
return t && .3 !== t ? {
_period: t,
easing: function(t) {
if (0 === t || 1 === t) return t;
t -= 1;
return -Math.pow(2, 10 * t) * Math.sin((t - this._period / 4) * Math.PI * 2 / this._period);
},
reverse: function() {
return cc.easeElasticOut(this._period);
}
} : o;
};
var a = {
easing: function(t) {
return 0 === t || 1 === t ? t : Math.pow(2, -10 * t) * Math.sin((t - .075) * Math.PI * 2 / .3) + 1;
},
reverse: function() {
return o;
}
};
cc.easeElasticOut = function(t) {
return t && .3 !== t ? {
_period: t,
easing: function(t) {
return 0 === t || 1 === t ? t : Math.pow(2, -10 * t) * Math.sin((t - this._period / 4) * Math.PI * 2 / this._period) + 1;
},
reverse: function() {
return cc.easeElasticIn(this._period);
}
} : a;
};
cc.easeElasticInOut = function(t) {
return {
_period: t = t || .3,
easing: function(t) {
var e = 0, i = this._period;
if (0 === t || 1 === t) e = t; else {
t *= 2;
i || (i = this._period = .3 * 1.5);
var n = i / 4;
e = (t -= 1) < 0 ? -.5 * Math.pow(2, 10 * t) * Math.sin((t - n) * Math.PI * 2 / i) : Math.pow(2, -10 * t) * Math.sin((t - n) * Math.PI * 2 / i) * .5 + 1;
}
return e;
},
reverse: function() {
return cc.easeElasticInOut(this._period);
}
};
};
function c(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;
}
var l = {
easing: function(t) {
return 1 - c(1 - t);
},
reverse: function() {
return u;
}
};
cc.easeBounceIn = function() {
return l;
};
var u = {
easing: function(t) {
return c(t);
},
reverse: function() {
return l;
}
};
cc.easeBounceOut = function() {
return u;
};
var h = {
easing: function(t) {
return t < .5 ? .5 * (1 - c(1 - (t *= 2))) : .5 * c(2 * t - 1) + .5;
},
reverse: function() {
return h;
}
};
cc.easeBounceInOut = function() {
return h;
};
var _ = {
easing: function(t) {
return 0 === t || 1 === t ? t : t * t * (2.70158 * t - 1.70158);
},
reverse: function() {
return f;
}
};
cc.easeBackIn = function() {
return _;
};
var f = {
easing: function(t) {
return 0 === t ? 0 : (t -= 1) * t * (2.70158 * t + 1.70158) + 1;
},
reverse: function() {
return _;
}
};
cc.easeBackOut = function() {
return f;
};
var d = {
easing: function(t) {
return (t *= 2) < 1 ? t * t * (3.5949095 * t - 2.5949095) / 2 : (t -= 2) * t * (3.5949095 * t + 2.5949095) / 2 + 1;
},
reverse: function() {
return d;
}
};
cc.easeBackInOut = function() {
return d;
};
cc.easeBezierAction = function(t, e, i, n) {
return {
easing: function(r) {
return Math.pow(1 - r, 3) * t + 3 * r * Math.pow(1 - r, 2) * e + 3 * Math.pow(r, 2) * (1 - r) * i + Math.pow(r, 3) * n;
},
reverse: function() {
return cc.easeBezierAction(n, i, e, t);
}
};
};
var p = {
easing: function(t) {
return Math.pow(t, 2);
},
reverse: function() {
return p;
}
};
cc.easeQuadraticActionIn = function() {
return p;
};
var m = {
easing: function(t) {
return -t * (t - 2);
},
reverse: function() {
return m;
}
};
cc.easeQuadraticActionOut = function() {
return m;
};
var y = {
easing: function(t) {
return (t *= 2) < 1 ? t * t * .5 : -.5 * (--t * (t - 2) - 1);
},
reverse: function() {
return y;
}
};
cc.easeQuadraticActionInOut = function() {
return y;
};
var v = {
easing: function(t) {
return t * t * t * t;
},
reverse: function() {
return v;
}
};
cc.easeQuarticActionIn = function() {
return v;
};
var g = {
easing: function(t) {
return -((t -= 1) * t * t * t - 1);
},
reverse: function() {
return g;
}
};
cc.easeQuarticActionOut = function() {
return g;
};
var b = {
easing: function(t) {
return (t *= 2) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t * t * t - 2);
},
reverse: function() {
return b;
}
};
cc.easeQuarticActionInOut = function() {
return b;
};
var C = {
easing: function(t) {
return t * t * t * t * t;
},
reverse: function() {
return C;
}
};
cc.easeQuinticActionIn = function() {
return C;
};
var x = {
easing: function(t) {
return (t -= 1) * t * t * t * t + 1;
},
reverse: function() {
return x;
}
};
cc.easeQuinticActionOut = function() {
return x;
};
var A = {
easing: function(t) {
return (t *= 2) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2);
},
reverse: function() {
return A;
}
};
cc.easeQuinticActionInOut = function() {
return A;
};
var S = {
easing: function(t) {
return -1 * (Math.sqrt(1 - t * t) - 1);
},
reverse: function() {
return S;
}
};
cc.easeCircleActionIn = function() {
return S;
};
var T = {
easing: function(t) {
t -= 1;
return Math.sqrt(1 - t * t);
},
reverse: function() {
return T;
}
};
cc.easeCircleActionOut = function() {
return T;
};
var w = {
easing: function(t) {
if ((t *= 2) < 1) return -.5 * (Math.sqrt(1 - t * t) - 1);
t -= 2;
return .5 * (Math.sqrt(1 - t * t) + 1);
},
reverse: function() {
return w;
}
};
cc.easeCircleActionInOut = function() {
return w;
};
var E = {
easing: function(t) {
return t * t * t;
},
reverse: function() {
return E;
}
};
cc.easeCubicActionIn = function() {
return E;
};
var M = {
easing: function(t) {
return (t -= 1) * t * t + 1;
},
reverse: function() {
return M;
}
};
cc.easeCubicActionOut = function() {
return M;
};
var B = {
easing: function(t) {
return (t *= 2) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + 2);
},
reverse: function() {
return B;
}
};
cc.easeCubicActionInOut = function() {
return B;
};
}), {} ],
4: [ (function() {
"use strict";
cc.ActionInstant = cc.Class({
name: "cc.ActionInstant",
extends: cc.FiniteTimeAction,
isDone: function() {
return !0;
},
step: function() {
this.update(1);
},
update: function() {},
reverse: function() {
return this.clone();
},
clone: function() {
return new cc.ActionInstant();
}
});
cc.Show = cc.Class({
name: "cc.Show",
extends: cc.ActionInstant,
update: function() {
for (var t = this.target.getComponentsInChildren(cc.RenderComponent), e = 0; e < t.length; ++e) t[e].enabled = !0;
},
reverse: function() {
return new cc.Hide();
},
clone: function() {
return new cc.Show();
}
});
cc.show = function() {
return new cc.Show();
};
cc.Hide = cc.Class({
name: "cc.Hide",
extends: cc.ActionInstant,
update: function() {
for (var t = this.target.getComponentsInChildren(cc.RenderComponent), e = 0; e < t.length; ++e) t[e].enabled = !1;
},
reverse: function() {
return new cc.Show();
},
clone: function() {
return new cc.Hide();
}
});
cc.hide = function() {
return new cc.Hide();
};
cc.ToggleVisibility = cc.Class({
name: "cc.ToggleVisibility",
extends: cc.ActionInstant,
update: function() {
for (var t = this.target.getComponentsInChildren(cc.RenderComponent), e = 0; e < t.length; ++e) {
var i = t[e];
i.enabled = !i.enabled;
}
},
reverse: function() {
return new cc.ToggleVisibility();
},
clone: function() {
return new cc.ToggleVisibility();
}
});
cc.toggleVisibility = function() {
return new cc.ToggleVisibility();
};
cc.RemoveSelf = cc.Class({
name: "cc.RemoveSelf",
extends: cc.ActionInstant,
ctor: function(t) {
this._isNeedCleanUp = !0;
void 0 !== t && this.init(t);
},
update: function() {
this.target.removeFromParent(this._isNeedCleanUp);
},
init: function(t) {
this._isNeedCleanUp = t;
return !0;
},
reverse: function() {
return new cc.RemoveSelf(this._isNeedCleanUp);
},
clone: function() {
return new cc.RemoveSelf(this._isNeedCleanUp);
}
});
cc.removeSelf = function(t) {
return new cc.RemoveSelf(t);
};
cc.DestroySelf = cc.Class({
name: "cc.DestroySelf",
extends: cc.ActionInstant,
update: function() {
this.target.destroy();
},
reverse: function() {
return new cc.DestroySelf();
},
clone: function() {
return new cc.DestroySelf();
}
});
cc.destroySelf = function() {
return new cc.DestroySelf();
};
cc.FlipX = cc.Class({
name: "cc.FlipX",
extends: cc.ActionInstant,
ctor: function(t) {
this._flippedX = !1;
void 0 !== t && this.initWithFlipX(t);
},
initWithFlipX: function(t) {
this._flippedX = t;
return !0;
},
update: function() {
this.target.scaleX = Math.abs(this.target.scaleX) * (this._flippedX ? -1 : 1);
},
reverse: function() {
return new cc.FlipX(!this._flippedX);
},
clone: function() {
var t = new cc.FlipX();
t.initWithFlipX(this._flippedX);
return t;
}
});
cc.flipX = function(t) {
return new cc.FlipX(t);
};
cc.FlipY = cc.Class({
name: "cc.FlipY",
extends: cc.ActionInstant,
ctor: function(t) {
this._flippedY = !1;
void 0 !== t && this.initWithFlipY(t);
},
initWithFlipY: function(t) {
this._flippedY = t;
return !0;
},
update: function() {
this.target.scaleY = Math.abs(this.target.scaleY) * (this._flippedY ? -1 : 1);
},
reverse: function() {
return new cc.FlipY(!this._flippedY);
},
clone: function() {
var t = new cc.FlipY();
t.initWithFlipY(this._flippedY);
return t;
}
});
cc.flipY = function(t) {
return new cc.FlipY(t);
};
cc.Place = cc.Class({
name: "cc.Place",
extends: cc.ActionInstant,
ctor: function(t, e) {
this._x = 0;
this._y = 0;
if (void 0 !== t) {
if (void 0 !== t.x) {
e = t.y;
t = t.x;
}
this.initWithPosition(t, e);
}
},
initWithPosition: function(t, e) {
this._x = t;
this._y = e;
return !0;
},
update: function() {
this.target.setPosition(this._x, this._y);
},
clone: function() {
var t = new cc.Place();
t.initWithPosition(this._x, this._y);
return t;
}
});
cc.place = function(t, e) {
return new cc.Place(t, e);
};
cc.CallFunc = cc.Class({
name: "cc.CallFunc",
extends: cc.ActionInstant,
ctor: function(t, e, i) {
this._selectorTarget = null;
this._function = null;
this._data = null;
this.initWithFunction(t, e, i);
},
initWithFunction: function(t, e, i) {
t && (this._function = t);
e && (this._selectorTarget = e);
void 0 !== i && (this._data = i);
return !0;
},
execute: function() {
this._function && this._function.call(this._selectorTarget, this.target, this._data);
},
update: function() {
this.execute();
},
getTargetCallback: function() {
return this._selectorTarget;
},
setTargetCallback: function(t) {
if (t !== this._selectorTarget) {
this._selectorTarget && (this._selectorTarget = null);
this._selectorTarget = t;
}
},
clone: function() {
var t = new cc.CallFunc();
t.initWithFunction(this._function, this._selectorTarget, this._data);
return t;
}
});
cc.callFunc = function(t, e, i) {
return new cc.CallFunc(t, e, i);
};
}), {} ],
5: [ (function() {
"use strict";
cc.ActionInterval = cc.Class({
name: "cc.ActionInterval",
extends: cc.FiniteTimeAction,
ctor: function(t) {
this.MAX_VALUE = 2;
this._elapsed = 0;
this._firstTick = !1;
this._easeList = null;
this._speed = 1;
this._timesForRepeat = 1;
this._repeatForever = !1;
this._repeatMethod = !1;
this._speedMethod = !1;
void 0 !== t && cc.ActionInterval.prototype.initWithDuration.call(this, t);
},
getElapsed: function() {
return this._elapsed;
},
initWithDuration: function(t) {
this._duration = 0 === t ? cc.macro.FLT_EPSILON : t;
this._elapsed = 0;
this._firstTick = !0;
return !0;
},
isDone: function() {
return this._elapsed >= 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; e < this._easeList.length; e++) t._easeList.push(this._easeList[e].reverse());
}
},
clone: function() {
var t = new cc.ActionInterval(this._duration);
this._cloneDecoration(t);
return t;
},
easing: function() {
this._easeList ? this._easeList.length = 0 : this._easeList = [];
for (var t = 0; t < arguments.length; t++) this._easeList.push(arguments[t]);
return this;
},
_computeEaseTime: function(t) {
var e = this._easeList;
if (!e || 0 === e.length) return t;
for (var i = 0, n = e.length; i < n; i++) t = e[i].easing(t);
return t;
},
step: function(t) {
if (this._firstTick) {
this._firstTick = !1;
this._elapsed = 0;
} else this._elapsed += t;
var e = this._elapsed / (this._duration > 1.192092896e-7 ? this._duration : 1.192092896e-7);
e = 1 > e ? e : 1;
this.update(e > 0 ? e : 0);
if (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() {
cc.logID(1010);
return null;
},
setAmplitudeRate: function() {
cc.logID(1011);
},
getAmplitudeRate: function() {
cc.logID(1012);
return 0;
},
speed: function(t) {
if (t <= 0) {
cc.logID(1013);
return this;
}
this._speedMethod = !0;
this._speed *= t;
return this;
},
getSpeed: function() {
return this._speed;
},
setSpeed: function(t) {
this._speed = t;
return this;
},
repeat: function(t) {
t = Math.round(t);
if (isNaN(t) || t < 1) {
cc.logID(1014);
return this;
}
this._repeatMethod = !0;
this._timesForRepeat *= t;
return this;
},
repeatForever: function() {
this._repeatMethod = !0;
this._timesForRepeat = this.MAX_VALUE;
this._repeatForever = !0;
return 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;
i >= 0 && null == e[i] && cc.logID(1015);
if (i >= 0) {
for (var n, r = e[0], s = 1; s < i; s++) if (e[s]) {
n = r;
r = cc.Sequence._actionOneTwo(n, e[s]);
}
this.initWithTwoActions(r, e[i]);
}
} else cc.errorID(1019);
},
initWithTwoActions: function(t, e) {
if (!t || !e) {
cc.errorID(1025);
return !1;
}
var i = t._duration, n = e._duration, r = (i *= t._repeatMethod ? t._timesForRepeat : 1) + (n *= e._repeatMethod ? e._timesForRepeat : 1);
this.initWithDuration(r);
this._actions[0] = t;
this._actions[1] = e;
return !0;
},
clone: function() {
var t = new cc.Sequence();
this._cloneDecoration(t);
t.initWithTwoActions(this._actions[0].clone(), this._actions[1].clone());
return t;
},
startWithTarget: function(t) {
cc.ActionInterval.prototype.startWithTarget.call(this, t);
this._split = this._actions[0]._duration / this._duration;
this._split *= this._actions[0]._repeatMethod ? this._actions[0]._timesForRepeat : 1;
this._last = -1;
},
stop: function() {
-1 !== this._last && this._actions[this._last].stop();
cc.Action.prototype.stop.call(this);
},
update: function(t) {
var e, i, n = 0, r = this._split, s = this._actions, o = this._last;
if ((t = this._computeEaseTime(t)) < r) {
e = 0 !== r ? t / r : 1;
if (0 === n && 1 === o && this._reversed) {
s[1].update(0);
s[1].stop();
}
} else {
n = 1;
e = 1 === r ? 1 : (t - r) / (1 - r);
if (-1 === o) {
s[0].startWithTarget(this.target);
s[0].update(1);
s[0].stop();
}
if (0 === o) {
s[0].update(1);
s[0].stop();
}
}
i = s[n];
if (o !== n || !i.isDone()) {
o !== n && i.startWithTarget(this.target);
e *= i._timesForRepeat;
i.update(e > 1 ? e % 1 : e);
this._last = n;
}
},
reverse: function() {
var t = cc.Sequence._actionOneTwo(this._actions[1].reverse(), this._actions[0].reverse());
this._cloneDecoration(t);
this._reverseEaseList(t);
t._reversed = !0;
return t;
}
});
cc.sequence = function(t) {
var e = t instanceof Array ? t : arguments;
if (1 === e.length) {
cc.errorID(1019);
return 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();
i.initWithTwoActions(t, e);
return 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;
if (this.initWithDuration(i)) {
this._times = e;
this._innerAction = t;
if (t instanceof cc.ActionInstant) {
this._actionInstant = !0;
this._times -= 1;
}
this._total = 0;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.Repeat();
this._cloneDecoration(t);
t.initWithAction(this._innerAction.clone(), this._times);
return 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._total < n; ) {
e.update(1);
this._total++;
e.stop();
e.startWithTarget(this.target);
r += e._duration / i;
this._nextDt = r > 1 ? 1 : r;
}
if (t >= 1 && this._total < n) {
e.update(1);
this._total++;
}
this._actionInstant || (this._total === n ? e.stop() : e.update(t - (r - e._duration / i)));
} else e.update(t * n % 1);
},
isDone: function() {
return this._total === this._times;
},
reverse: function() {
var t = new cc.Repeat(this._innerAction.reverse(), this._times);
this._cloneDecoration(t);
this._reverseEaseList(t);
return t;
},
setInnerAction: function(t) {
this._innerAction !== t && (this._innerAction = t);
},
getInnerAction: function() {
return this._innerAction;
}
});
cc.repeat = function(t, e) {
return new cc.Repeat(t, e);
};
cc.repeatForever = function(t) {
return new cc.RepeatForever(t);
};
cc.RepeatForever = cc.Class({
name: "cc.RepeatForever",
extends: cc.ActionInterval,
ctor: function(t) {
this._innerAction = null;
t && this.initWithAction(t);
},
initWithAction: function(t) {
if (!t) {
cc.errorID(1026);
return !1;
}
this._innerAction = t;
return !0;
},
clone: function() {
var t = new cc.RepeatForever();
this._cloneDecoration(t);
t.initWithAction(this._innerAction.clone());
return t;
},
startWithTarget: function(t) {
cc.ActionInterval.prototype.startWithTarget.call(this, t);
this._innerAction.startWithTarget(t);
},
step: function(t) {
var e = this._innerAction;
e.step(t);
if (e.isDone()) {
e.startWithTarget(this.target);
e.step(e.getElapsed() - e._duration);
}
},
isDone: function() {
return !1;
},
reverse: function() {
var t = new cc.RepeatForever(this._innerAction.reverse());
this._cloneDecoration(t);
this._reverseEaseList(t);
return t;
},
setInnerAction: function(t) {
this._innerAction !== t && (this._innerAction = t);
},
getInnerAction: function() {
return this._innerAction;
}
});
cc.repeatForever = function(t) {
return new cc.RepeatForever(t);
};
cc.Spawn = cc.Class({
name: "cc.Spawn",
extends: cc.ActionInterval,
ctor: function(t) {
this._one = null;
this._two = null;
var e = t instanceof Array ? t : arguments;
if (1 !== e.length) {
var i = e.length - 1;
i >= 0 && null == e[i] && cc.logID(1015);
if (i >= 0) {
for (var n, r = e[0], s = 1; s < i; s++) if (e[s]) {
n = r;
r = cc.Spawn._actionOneTwo(n, e[s]);
}
this.initWithTwoActions(r, e[i]);
}
} else cc.errorID(1020);
},
initWithTwoActions: function(t, e) {
if (!t || !e) {
cc.errorID(1027);
return !1;
}
var i = !1, n = t._duration, r = e._duration;
if (this.initWithDuration(Math.max(n, r))) {
this._one = t;
this._two = e;
n > r ? this._two = cc.Sequence._actionOneTwo(e, cc.delayTime(n - r)) : n < r && (this._one = cc.Sequence._actionOneTwo(t, cc.delayTime(r - n)));
i = !0;
}
return i;
},
clone: function() {
var t = new cc.Spawn();
this._cloneDecoration(t);
t.initWithTwoActions(this._one.clone(), this._two.clone());
return t;
},
startWithTarget: function(t) {
cc.ActionInterval.prototype.startWithTarget.call(this, t);
this._one.startWithTarget(t);
this._two.startWithTarget(t);
},
stop: function() {
this._one.stop();
this._two.stop();
cc.Action.prototype.stop.call(this);
},
update: function(t) {
t = this._computeEaseTime(t);
this._one && this._one.update(t);
this._two && this._two.update(t);
},
reverse: function() {
var t = cc.Spawn._actionOneTwo(this._one.reverse(), this._two.reverse());
this._cloneDecoration(t);
this._reverseEaseList(t);
return t;
}
});
cc.spawn = function(t) {
var e = t instanceof Array ? t : arguments;
if (1 === e.length) {
cc.errorID(1020);
return null;
}
e.length > 0 && null == e[e.length - 1] && cc.logID(1015);
for (var i = e[0], n = 1; n < e.length; n++) null != e[n] && (i = cc.Spawn._actionOneTwo(i, e[n]));
return i;
};
cc.Spawn._actionOneTwo = function(t, e) {
var i = new cc.Spawn();
i.initWithTwoActions(t, e);
return i;
};
cc.RotateTo = cc.Class({
name: "cc.RotateTo",
extends: cc.ActionInterval,
statics: {
_reverse: !1
},
ctor: function(t, e) {
this._startAngle = 0;
this._dstAngle = 0;
this._angle = 0;
void 0 !== e && this.initWithDuration(t, e);
},
initWithDuration: function(t, e) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._dstAngle = e;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.RotateTo();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._dstAngle);
return t;
},
startWithTarget: function(t) {
cc.ActionInterval.prototype.startWithTarget.call(this, t);
var e = t.angle % 360, i = cc.RotateTo._reverse ? this._dstAngle - e : this._dstAngle + e;
i > 180 && (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) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._deltaAngle = e;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.RotateBy();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._deltaAngle);
return 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();
t.initWithDuration(this._duration, -this._deltaAngle);
this._cloneDecoration(t);
this._reverseEaseList(t);
return 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) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
if (void 0 !== e.x) {
i = e.y;
e = e.x;
}
this._positionDelta.x = e;
this._positionDelta.y = i;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.MoveBy();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._positionDelta);
return 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) {
t = this._computeEaseTime(t);
if (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, o = this._previousPosition;
n.x = n.x + r - o.x;
n.y = n.y + s - o.y;
e += n.x;
i += n.y;
o.x = e;
o.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));
this._cloneDecoration(t);
this._reverseEaseList(t);
return 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) {
if (cc.MoveBy.prototype.initWithDuration.call(this, t, e, i)) {
if (void 0 !== e.x) {
i = e.y;
e = e.x;
}
this._endPosition.x = e;
this._endPosition.y = i;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.MoveTo();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._endPosition);
return 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;
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._endSkewX = e;
this._endSkewY = i;
n = !0;
}
return n;
},
clone: function() {
var t = new cc.SkewTo();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._endSkewX, this._endSkewY);
return 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;
if (cc.SkewTo.prototype.initWithDuration.call(this, t, e, i)) {
this._skewX = e;
this._skewY = i;
n = !0;
}
return n;
},
clone: function() {
var t = new cc.SkewBy();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._skewX, this._skewY);
return 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);
this._cloneDecoration(t);
this._reverseEaseList(t);
return 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) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
if (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;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.JumpBy();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._delta, this._height, this._jumps);
return 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) {
t = this._computeEaseTime(t);
if (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, o = this.target.y, a = this._previousPosition;
r.x = r.x + s - a.x;
r.y = r.y + o - a.y;
n += r.x;
i += r.y;
a.x = n;
a.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);
this._cloneDecoration(t);
this._reverseEaseList(t);
return 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) {
if (cc.JumpBy.prototype.initWithDuration.call(this, t, e, i, n, r)) {
if (void 0 === r) {
i = e.y;
e = e.x;
}
this._endPosition.x = e;
this._endPosition.y = i;
return !0;
}
return !1;
},
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();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._endPosition, this._height, this._jumps);
return t;
}
});
cc.jumpTo = function(t, e, i, n, r) {
return new cc.JumpTo(t, e, i, n, r);
};
function t(t, e, i, n, r) {
return Math.pow(1 - r, 3) * t + 3 * r * Math.pow(1 - r, 2) * e + 3 * Math.pow(r, 2) * (1 - r) * i + Math.pow(r, 3) * n;
}
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) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._config = e;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.BezierBy();
this._cloneDecoration(t);
for (var e = [], i = 0; i < this._config.length; i++) {
var n = this._config[i];
e.push(cc.v2(n.x, n.y));
}
t.initWithDuration(this._duration, e);
return 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(e) {
e = this._computeEaseTime(e);
if (this.target) {
var i = this._config, n = i[0].x, r = i[1].x, s = i[2].x, o = i[0].y, a = i[1].y, c = i[2].y, l = t(0, n, r, s, e), u = t(0, o, a, c, e), h = this._startPosition;
if (cc.macro.ENABLE_STACKABLE_ACTIONS) {
var _ = this.target.x, f = this.target.y, d = this._previousPosition;
h.x = h.x + _ - d.x;
h.y = h.y + f - d.y;
l += h.x;
u += h.y;
d.x = l;
d.y = u;
this.target.setPosition(l, u);
} else this.target.setPosition(h.x + l, h.y + u);
}
},
reverse: function() {
var t = this._config, e = t[0].x, i = t[0].y, n = t[1].x, r = t[1].y, s = t[2].x, o = t[2].y, a = [ cc.v2(n - s, r - o), cc.v2(e - s, i - o), cc.v2(-s, -o) ], c = new cc.BezierBy(this._duration, a);
this._cloneDecoration(c);
this._reverseEaseList(c);
return c;
}
});
cc.bezierBy = function(t, e) {
return new cc.BezierBy(t, e);
};
cc.BezierTo = cc.Class({
name: "cc.BezierTo",
extends: cc.BezierBy,
ctor: function(t, e) {
this._toConfig = [];
e && this.initWithDuration(t, e);
},
initWithDuration: function(t, e) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._toConfig = e;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.BezierTo();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._toConfig);
return t;
},
startWithTarget: function(t) {
cc.BezierBy.prototype.startWithTarget.call(this, t);
var e = this._startPosition, i = this._toConfig, n = this._config;
n[0] = i[0].sub(e);
n[1] = i[1].sub(e);
n[2] = i[2].sub(e);
}
});
cc.bezierTo = function(t, e) {
return new cc.BezierTo(t, e);
};
cc.ScaleTo = cc.Class({
name: "cc.ScaleTo",
extends: cc.ActionInterval,
ctor: function(t, e, i) {
this._scaleX = 1;
this._scaleY = 1;
this._startScaleX = 1;
this._startScaleY = 1;
this._endScaleX = 0;
this._endScaleY = 0;
this._deltaX = 0;
this._deltaY = 0;
void 0 !== e && cc.ScaleTo.prototype.initWithDuration.call(this, t, e, i);
},
initWithDuration: function(t, e, i) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._endScaleX = e;
this._endScaleY = null != i ? i : e;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.ScaleTo();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._endScaleX, this._endScaleY);
return t;
},
startWithTarget: function(t) {
cc.ActionInterval.prototype.startWithTarget.call(this, t);
this._startScaleX = t.scaleX;
this._startScaleY = t.scaleY;
this._deltaX = this._endScaleX - this._startScaleX;
this._deltaY = this._endScaleY - this._startScaleY;
},
update: function(t) {
t = this._computeEaseTime(t);
if (this.target) {
this.target.scaleX = this._startScaleX + this._deltaX * t;
this.target.scaleY = this._startScaleY + this._deltaY * t;
}
}
});
cc.scaleTo = function(t, e, i) {
return new cc.ScaleTo(t, e, i);
};
cc.ScaleBy = cc.Class({
name: "cc.ScaleBy",
extends: cc.ScaleTo,
startWithTarget: function(t) {
cc.ScaleTo.prototype.startWithTarget.call(this, t);
this._deltaX = this._startScaleX * this._endScaleX - this._startScaleX;
this._deltaY = this._startScaleY * this._endScaleY - this._startScaleY;
},
reverse: function() {
var t = new cc.ScaleBy(this._duration, 1 / this._endScaleX, 1 / this._endScaleY);
this._cloneDecoration(t);
this._reverseEaseList(t);
return t;
},
clone: function() {
var t = new cc.ScaleBy();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._endScaleX, this._endScaleY);
return t;
}
});
cc.scaleBy = function(t, e, i) {
return new cc.ScaleBy(t, e, i);
};
cc.Blink = cc.Class({
name: "cc.Blink",
extends: cc.ActionInterval,
ctor: function(t, e) {
this._times = 0;
this._originalState = !1;
void 0 !== e && this.initWithDuration(t, e);
},
initWithDuration: function(t, e) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._times = e;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.Blink();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._times);
return t;
},
update: function(t) {
t = this._computeEaseTime(t);
if (this.target && !this.isDone()) {
var e = 1 / this._times, i = t % e;
this.target.opacity = i > e / 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);
this._cloneDecoration(t);
this._reverseEaseList(t);
return 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) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._toOpacity = e;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.FadeTo();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._toOpacity);
return 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();
t.initWithDuration(this._duration, 0);
this._cloneDecoration(t);
this._reverseEaseList(t);
return t;
},
clone: function() {
var t = new cc.FadeIn();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._toOpacity);
return 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();
t._reverseAction = this;
t.initWithDuration(this._duration, 255);
this._cloneDecoration(t);
this._reverseEaseList(t);
return t;
},
clone: function() {
var t = new cc.FadeOut();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._toOpacity);
return 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);
if (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) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._to = cc.color(e, i, n);
return !0;
}
return !1;
},
clone: function() {
var t = new cc.TintTo();
this._cloneDecoration(t);
var e = this._to;
t.initWithDuration(this._duration, e.r, e.g, e.b);
return 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) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
this._deltaR = e;
this._deltaG = i;
this._deltaB = n;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.TintBy();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._deltaR, this._deltaG, this._deltaB);
return 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);
this._cloneDecoration(t);
this._reverseEaseList(t);
return 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() {},
reverse: function() {
var t = new cc.DelayTime(this._duration);
this._cloneDecoration(t);
this._reverseEaseList(t);
return t;
},
clone: function() {
var t = new cc.DelayTime();
this._cloneDecoration(t);
t.initWithDuration(this._duration);
return 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) {
if (!t) {
cc.errorID(1028);
return !1;
}
if (t === this._other) {
cc.errorID(1029);
return !1;
}
if (cc.ActionInterval.prototype.initWithDuration.call(this, t._duration)) {
this._other = t;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.ReverseTime();
this._cloneDecoration(t);
t.initWithAction(this._other.clone());
return 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) {
if (this.initWithDuration(e._duration)) {
this._forcedTarget = t;
this._action = e;
return !0;
}
return !1;
},
clone: function() {
var t = new cc.TargetedAction();
this._cloneDecoration(t);
t.initWithTarget(this._forcedTarget, this._action.clone());
return 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) {
"use strict";
t("../core/platform/CCClass");
var e = t("../core/platform/js"), i = function() {
this.actions = [];
this.target = null;
this.actionIndex = 0;
this.currentAction = null;
this.paused = !1;
this.lock = !1;
};
cc.ActionManager = function() {
this._hashTargets = e.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 < t.length; i++) if (e === t[i].target) return t[i];
return null;
},
_getElement: function(t, e) {
var n = this._elementPool.pop();
n || (n = new i());
n.target = t;
n.paused = !!e;
return n;
},
_putElement: function(t) {
t.actions.length = 0;
t.actionIndex = 0;
t.currentAction = null;
t.paused = !1;
t.target = null;
t.lock = !1;
this._elementPool.push(t);
},
addAction: function(t, e, i) {
if (t && e) {
var n = this._hashTargets[e._id];
if (n) n.actions || (n.actions = []); else {
n = this._getElement(e, i);
this._hashTargets[e._id] = n;
this._arrayTargets.push(n);
}
n.actions.push(t);
t.startWithTarget(e);
} else cc.errorID(1e3);
},
removeAllActions: function() {
for (var t = this._arrayTargets, i = 0; i < t.length; i++) {
var n = t[i];
n && this._putElement(n);
}
this._arrayTargets.length = 0;
this._hashTargets = e.createMap(!0);
},
removeAllActionsFromTarget: function(t) {
if (null != t) {
var e = this._hashTargets[t._id];
if (e) {
e.actions.length = 0;
this._deleteHashElement(e);
}
}
},
removeAction: function(t) {
if (t) {
var e = t.getOriginalTarget(), i = this._hashTargets[e._id];
if (i) for (var n = 0; n < i.actions.length; n++) if (i.actions[n] === t) {
i.actions.splice(n, 1);
i.actionIndex >= n && i.actionIndex--;
break;
}
}
},
_removeActionByTag: function(t, e, i) {
for (var n = 0, r = e.actions.length; n < r; ++n) {
var s = e.actions[n];
if (s && s.getTag() === t) {
if (i && s.getOriginalTarget() !== i) continue;
this._removeActionAtIndex(n, e);
break;
}
}
},
removeActionByTag: function(t, e) {
t === cc.Action.TAG_INVALID && cc.logID(1002);
var i = this._hashTargets;
if (e) {
var n = i[e._id];
n && this._removeActionByTag(t, n, e);
} else for (var r in i) {
var s = i[r];
this._removeActionByTag(t, s);
}
},
getActionByTag: function(t, e) {
t === cc.Action.TAG_INVALID && cc.logID(1004);
var i = this._hashTargets[e._id];
if (i) {
if (null != i.actions) for (var n = 0; n < i.actions.length; ++n) {
var r = i.actions[n];
if (r && r.getTag() === t) return r;
}
cc.logID(1005, t);
}
return null;
},
getNumberOfRunningActionsInTarget: function(t) {
var e = this._hashTargets[t._id];
return e && e.actions ? e.actions.length : 0;
},
pauseTarget: function(t) {
var e = this._hashTargets[t._id];
e && (e.paused = !0);
},
resumeTarget: function(t) {
var e = this._hashTargets[t._id];
e && (e.paused = !1);
},
pauseAllRunningActions: function() {
for (var t = [], e = this._arrayTargets, i = 0; i < e.length; i++) {
var n = e[i];
if (n && !n.paused) {
n.paused = !0;
t.push(n.target);
}
}
return t;
},
resumeTargets: function(t) {
if (t) for (var e = 0; e < t.length; e++) t[e] && this.resumeTarget(t[e]);
},
pauseTargets: function(t) {
if (t) for (var e = 0; e < t.length; e++) t[e] && this.pauseTarget(t[e]);
},
purgeSharedManager: function() {
cc.director.getScheduler().unscheduleUpdate(this);
},
_removeActionAtIndex: function(t, e) {
e.actions[t];
e.actions.splice(t, 1);
e.actionIndex >= 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 < r; n++) if (i[n] === t) {
i.splice(n, 1);
break;
}
this._putElement(t);
e = !0;
}
return e;
},
update: function(t) {
for (var e, i = this._arrayTargets, n = 0; n < i.length; n++) {
this._currentTarget = i[n];
if (!(e = this._currentTarget).paused && e.actions) {
e.lock = !0;
for (e.actionIndex = 0; e.actionIndex < e.actions.length; e.actionIndex++) {
e.currentAction = e.actions[e.actionIndex];
if (e.currentAction) {
e.currentAction.step(t * (e.currentAction._speedMethod ? e.currentAction._speed : 1));
if (e.currentAction && e.currentAction.isDone()) {
e.currentAction.stop();
var r = e.currentAction;
e.currentAction = null;
this.removeAction(r);
}
e.currentAction = null;
}
}
e.lock = !1;
}
0 === e.actions.length && this._deleteHashElement(e) && n--;
}
}
};
}), {
"../core/platform/CCClass": 239,
"../core/platform/js": 260
} ],
7: [ (function(t) {
"use strict";
t("./CCActionManager");
t("./CCAction");
t("./CCActionInterval");
t("./CCActionInstant");
t("./CCActionEase");
t("./CCActionCatmullRom");
t("./tween");
}), {
"./CCAction": 1,
"./CCActionCatmullRom": 2,
"./CCActionEase": 3,
"./CCActionInstant": 4,
"./CCActionInterval": 5,
"./CCActionManager": 6,
"./tween": 8
} ],
8: [ (function(t) {
"use strict";
var e = t("../animation/bezier"), i = 0, n = cc.Class({
name: "cc.TweenAction",
extends: cc.ActionInterval,
ctor: function(t, e, i) {
this._opts = i = i || Object.create(null);
this._props = Object.create(null);
i.progress = i.progress || this.progress;
if (i.easing && "string" == typeof i.easing) {
var n = i.easing;
i.easing = cc.easing[n];
!i.easing && cc.warnID(1031, n);
}
var r = this._opts.relative;
for (var s in e) {
var o = e[s], a = void 0, c = void 0;
if (void 0 !== o.value && (o.easing || o.progress)) {
"string" == typeof o.easing ? !(a = cc.easing[o.easing]) && cc.warnID(1031, o.easing) : a = o.easing;
c = o.progress;
o = o.value;
}
if ("number" == typeof o || o.lerp && (!r || o.add || o.mul) && o.clone) {
var l = Object.create(null);
l.value = o;
l.easing = a;
l.progress = c;
this._props[s] = l;
} else cc.warn("Can not animate " + s + " property, because it do not have [lerp, (add|mul), clone] function.");
}
this._originProps = e;
this.initWithDuration(t);
},
clone: function() {
var t = new n(this._duration, this._originProps, this._opts);
this._cloneDecoration(t);
return t;
},
startWithTarget: function(t) {
cc.ActionInterval.prototype.startWithTarget.call(this, t);
var e = !!this._opts.relative, i = this._props;
for (var n in i) {
var r = t[n], s = i[n];
if ("number" == typeof r) {
s.start = r;
s.current = r;
s.end = e ? r + s.value : s.value;
} else {
s.start = r.clone();
s.current = r.clone();
s.end = e ? (r.add || r.mul).call(r, s.value) : s.value;
}
}
},
update: function(t) {
var e = this._opts, i = t;
e.easing && (i = e.easing(t));
var n = this.target;
if (n) {
var r = this._props, s = e.progress;
for (var o in r) {
var a = r[o], c = a.easing ? a.easing(t) : i, l = a.current = (a.progress || s)(a.start, a.end, a.current, c);
n[o] = l;
}
var u = e.onUpdate;
u && u(n, t);
}
},
progress: function(t, e, i, n) {
"number" == typeof t ? i = t + (e - t) * n : t.lerp(e, n, i);
return i;
}
}), r = cc.Class({
name: "cc.SetAction",
extends: cc.ActionInstant,
ctor: function(t) {
this._props = {};
void 0 !== t && this.init(t);
},
init: function(t) {
for (var e in t) this._props[e] = t[e];
return !0;
},
update: function() {
var t = this._props, e = this.target;
for (var i in t) e[i] = t[i];
},
clone: function() {
var t = new r();
t.init(this._props);
return t;
}
});
function s(t) {
this._actions = [];
this._finalAction = null;
this._target = t;
this._tag = cc.Action.TAG_INVALID;
}
s.stopAll = function() {
cc.director.getActionManager().removeAllActions();
};
s.stopAllByTag = function(t) {
cc.director.getActionManager().removeActionByTag(t);
};
s.stopAllByTarget = function(t) {
cc.director.getActionManager().removeAllActionsFromTarget(t);
};
s.prototype.then = function(t) {
t instanceof cc.Action ? this._actions.push(t.clone()) : this._actions.push(t._union());
return this;
};
s.prototype.target = function(t) {
this._target = t;
return this;
};
s.prototype.start = function() {
var t = this._target;
if (!t) {
cc.warn("Please set target to tween first");
return this;
}
if (!(t instanceof cc.Object) || t.isValid) {
this._finalAction && cc.director.getActionManager().removeAction(this._finalAction);
this._finalAction = this._union();
void 0 === t._id && (t._id = ++i);
this._finalAction.setTag(this._tag);
cc.director.getActionManager().addAction(this._finalAction, t, !1);
return this;
}
};
s.prototype.stop = function() {
this._finalAction && cc.director.getActionManager().removeAction(this._finalAction);
return this;
};
s.prototype.tag = function(t) {
this._tag = t;
return this;
};
s.prototype.clone = function(t) {
var e = this._union();
return cc.tween(t).then(e.clone());
};
s.prototype.union = function() {
var t = this._union();
this._actions.length = 0;
this._actions.push(t);
return this;
};
s.prototype._union = function() {
var t = this._actions;
return 1 === t.length ? t[0] : cc.sequence(t);
};
Object.assign(s.prototype, {
bezierTo: function(t, i, n, r, s) {
var o = i.x, a = i.y, c = n.x, l = n.y;
(s = s || Object.create(null)).progress = function(t, i, n, r) {
n.x = (0, e.bezier)(t.x, o, c, i.x, r);
n.y = (0, e.bezier)(t.y, a, l, i.y, r);
return n;
};
return this.to(t, {
position: r
}, s);
},
bezierBy: function(t, i, n, r, s) {
var o = i.x, a = i.y, c = n.x, l = n.y;
(s = s || Object.create(null)).progress = function(t, i, n, r) {
var s = t.x, u = t.y;
n.x = (0, e.bezier)(s, o + s, c + s, i.x, r);
n.y = (0, e.bezier)(u, a + u, l + u, i.y, r);
return n;
};
return this.by(t, {
position: r
}, s);
},
flipX: function() {
var t = this;
return this.call((function() {
t._target.scaleX *= -1;
}), this);
},
flipY: function() {
var t = this;
return this.call((function() {
t._target.scaleY *= -1;
}), this);
},
blink: function(t, e, i) {
var n = 1 / e;
(i = i || Object.create(null)).progress = function(t, e, i, r) {
return r >= 1 ? t : r % n > n / 2 ? 255 : 0;
};
return this.to(t, {
opacity: 1
}, i);
}
});
var o = [];
function a(t) {
return function() {
o.length = 0;
for (var e = arguments.length, i = 0; i < e; i++) {
var n = o[i] = arguments[i];
n instanceof s && (o[i] = n._union());
}
return t.apply(this, o);
};
}
for (var c = {
to: function(t, e, i) {
(i = i || Object.create(null)).relative = !1;
return new n(t, e, i);
},
by: function(t, e, i) {
(i = i || Object.create(null)).relative = !0;
return new n(t, e, i);
},
set: function(t) {
return new r(t);
},
delay: cc.delayTime,
call: cc.callFunc,
hide: cc.hide,
show: cc.show,
removeSelf: cc.removeSelf,
sequence: a(cc.sequence),
parallel: a(cc.spawn)
}, l = {
repeat: cc.repeat,
repeatForever: cc.repeatForever,
reverseTime: cc.reverseTime
}, u = Object.keys(c), h = function(t) {
var e = u[t];
s.prototype[e] = function() {
var t = c[e].apply(this, arguments);
this._actions.push(t);
return this;
};
}, _ = 0; _ < u.length; _++) h(_);
u = Object.keys(l);
for (var f = function(t) {
var e = u[t];
s.prototype[e] = function() {
var t = this._actions, i = arguments[arguments.length - 1], n = arguments.length - 1;
if (i instanceof cc.Tween) i = i._union(); else if (!(i instanceof cc.Action)) {
i = t[t.length - 1];
t.length -= 1;
n += 1;
}
for (var r = [ i ], s = 0; s < n; s++) r.push(arguments[s]);
i = l[e].apply(this, r);
t.push(i);
return this;
};
}, d = 0; d < u.length; d++) f(d);
cc.tween = function(t) {
return new s(t);
};
cc.Tween = s;
}), {
"../animation/bezier": 14
} ],
9: [ (function(t, e) {
"use strict";
var i = cc.js, n = t("./playable"), r = t("./animation-curves"), s = r.EventAnimCurve, o = r.EventInfo, a = t("./types").WrapModeMask, c = t("../core/utils/binary-search").binarySearchEpsilon;
function l(t, e) {
n.call(this);
this.target = t;
this.animation = e;
this._anims = new i.array.MutableForwardIterator([]);
}
i.extend(l, n);
var u = l.prototype;
u.playState = function(t, e) {
if (t.clip) {
t.curveLoaded || h(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 < i.length; ++e.i) {
var n = i[e.i];
n !== t && this.stopState(n);
}
};
u.addAnimation = function(t) {
-1 === this._anims.array.indexOf(t) && this._anims.push(t);
t._setEventTarget(this.animation);
};
u.removeAnimation = function(t) {
var e = this._anims.array.indexOf(t);
if (e >= 0) {
this._anims.fastRemoveAt(e);
0 === this._anims.array.length && this.stop();
} else cc.errorID(3907);
t.animator = null;
};
u.sample = function() {
var t = this._anims, e = t.array;
for (t.i = 0; t.i < e.length; ++t.i) e[t.i].sample();
};
u.stopState = function(t) {
t && t.stop();
};
u.pauseState = function(t) {
t && t.pause();
};
u.resumeState = function(t) {
t && t.resume();
this.isPaused && this.resume();
};
u.setStateTime = function(t, e) {
if (void 0 !== e) {
if (t) {
t.setTime(e);
t.sample();
}
} else {
e = t;
for (var i = this._anims.array, n = 0; n < i.length; ++n) {
var r = i[n];
r.setTime(e);
r.sample();
}
}
};
u.onStop = function() {
var t = this._anims, e = t.array;
for (t.i = 0; t.i < e.length; ++t.i) e[t.i].stop();
};
u.onPause = function() {
for (var t = this._anims.array, e = 0; e < t.length; ++e) {
var i = t[e];
i.pause();
i.animator = null;
}
};
u.onResume = function() {
for (var t = this._anims.array, e = 0; e < t.length; ++e) {
var i = t[e];
i.animator = this;
i.resume();
}
};
u._reloadClip = function(t) {
h(this.target, t);
};
function h(t, e) {
var i = e.clip;
e.duration = i.duration;
e.speed = i.speed;
e.wrapMode = i.wrapMode;
e.frameRate = i.sample;
(e.wrapMode & a.Loop) === a.Loop ? e.repeatCount = Infinity : e.repeatCount = 1;
var n = e.curves = i.createCurves(e, t), r = i.events;
if (r) for (var l, u = 0, h = r.length; u < h; u++) {
if (!l) {
(l = new s()).target = t;
n.push(l);
}
var _ = r[u], f = _.frame / e.duration, d = void 0, p = c(l.ratios, f);
if (p >= 0) d = l.events[p]; else {
d = new o();
l.ratios.push(f);
l.events.push(d);
}
d.add(_.func, _.params);
}
}
e.exports = l;
}), {
"../core/utils/binary-search": 315,
"./animation-curves": 11,
"./playable": 18,
"./types": 19
} ],
10: [ (function(t, e) {
"use strict";
var i = t("./types").WrapMode, n = t("./animation-curves"), r = n.DynamicAnimCurve, s = n.quickFindIndex, o = t("./motion-path-helper").sampleMotionPaths, a = t("../core/utils/binary-search").binarySearchEpsilon, c = cc.Class({
name: "cc.AnimationClip",
extends: cc.Asset,
properties: {
_duration: {
default: 0,
type: cc.Float
},
duration: {
get: function() {
return this._duration;
}
},
sample: {
default: 60
},
speed: {
default: 1
},
wrapMode: {
default: i.Normal
},
curveData: {
default: {},
visible: !1
},
events: {
default: [],
visible: !1
}
},
statics: {
createWithSpriteFrames: function(t, e) {
if (!Array.isArray(t)) {
cc.errorID(3905);
return null;
}
var i = new c();
i.sample = e || i.sample;
i._duration = t.length / i.sample;
for (var n = [], r = 1 / i.sample, s = 0, o = t.length; s < o; s++) n[s] = {
frame: s * r,
value: t[s]
};
i.curveData = {
comps: {
"cc.Sprite": {
spriteFrame: n
}
}
};
return i;
}
},
onLoad: function() {
this._duration = Number.parseFloat(this.duration);
this.speed = Number.parseFloat(this.speed);
this.wrapMode = Number.parseInt(this.wrapMode);
this.frameRate = Number.parseFloat(this.sample);
},
createPropCurve: function(t, e, i) {
var n = [], c = t instanceof cc.Node && "position" === e, l = new r();
l.target = t;
l.prop = e;
for (var u = 0, h = i.length; u < h; u++) {
var _ = i[u], f = _.frame / this.duration;
l.ratios.push(f);
c && n.push(_.motionPath);
var d = _.value;
l.values.push(d);
var p = _.curve;
if (p) {
if ("string" == typeof p) {
l.types.push(p);
continue;
}
if (Array.isArray(p)) {
p[0] === p[1] && p[2] === p[3] ? l.types.push(r.Linear) : l.types.push(r.Bezier(p));
continue;
}
}
l.types.push(r.Linear);
}
c && o(n, l, this.duration, this.sample, t);
for (var m, y, v = l.ratios, g = !0, b = 1, C = v.length; b < C; b++) {
m = v[b] - v[b - 1];
if (1 === b) y = m; else if (Math.abs(m - y) > 1e-6) {
g = !1;
break;
}
}
l._findFrameIndex = g ? s : a;
var x = l.values[0];
null == x || l._lerp || ("number" == typeof x ? l._lerp = r.prototype._lerpNumber : x instanceof cc.Quat ? l._lerp = r.prototype._lerpQuat : x instanceof cc.Vec2 ? l._lerp = r.prototype._lerpVector2 : x instanceof cc.Vec3 ? l._lerp = r.prototype._lerpVector3 : x.lerp && (l._lerp = r.prototype._lerpObject));
return l;
},
createTargetCurves: function(t, e, i) {
var n = e.props, r = e.comps;
if (n) for (var s in n) {
var o = n[s], a = this.createPropCurve(t, s, o);
i.push(a);
}
if (r) for (var c in r) {
var l = t.getComponent(c);
if (l) {
var u = r[c];
for (var h in u) {
var _ = u[h], f = this.createPropCurve(l, h, _);
i.push(f);
}
}
}
},
createCurves: function(t, e) {
var i = this.curveData, n = i.paths, r = [];
this.createTargetCurves(e, i, r);
for (var s in n) {
var o = cc.find(s, e);
if (o) {
var a = n[s];
this.createTargetCurves(o, a, r);
}
}
return r;
}
});
cc.AnimationClip = e.exports = c;
}), {
"../core/utils/binary-search": 315,
"./animation-curves": 11,
"./motion-path-helper": 17,
"./types": 19
} ],
11: [ (function(t, e) {
"use strict";
var i = t("./bezier").bezierByTime, n = t("../core/utils/binary-search").binarySearchEpsilon, r = t("./types").WrapModeMask, s = t("./types").WrappedInfo;
function o(t, e) {
if ("string" == typeof e) {
var n = cc.easing[e];
n ? t = n(t) : cc.errorID(3906, e);
} else Array.isArray(e) && (t = i(e, t));
return t;
}
var a = cc.Class({
name: "cc.AnimCurve",
sample: function() {},
onTimeChangedManually: void 0
});
var c, l = cc.Class({
name: "cc.DynamicAnimCurve",
extends: a,
ctor: function() {
this._cachedIndex = 0;
},
properties: {
target: null,
prop: "",
values: [],
ratios: [],
types: []
},
_findFrameIndex: n,
_lerp: void 0,
_lerpNumber: function(t, e, i) {
return t + (e - t) * i;
},
_lerpObject: function(t, e, i) {
return t.lerp(e, i);
},
_lerpQuat: (c = cc.quat(), function(t, e, i) {
return t.lerp(e, i, c);
}),
_lerpVector2: (function() {
var t = cc.v2();
return function(e, i, n) {
return e.lerp(i, n, t);
};
})(),
_lerpVector3: (function() {
var t = cc.v3();
return function(e, i, n) {
return e.lerp(i, n, t);
};
})(),
sample: function(t, e) {
var i = this.values, n = this.ratios, r = n.length;
if (0 !== r) {
var s, a = !0, c = this._cachedIndex;
if (c < 0 && (c = ~c) > 0 && c < n.length) {
var l = n[c - 1], u = n[c];
e > l && e < u && (a = !1);
}
a && (this._cachedIndex = this._findFrameIndex(n, e));
var h = this._cachedIndex;
if (h < 0) if ((h = ~h) <= 0) s = i[0]; else if (h >= r) s = i[r - 1]; else {
var _ = i[h - 1];
if (this._lerp) {
var f = n[h - 1], d = n[h], p = this.types[h - 1], m = (e - f) / (d - f);
p && (m = o(m, p));
var y = i[h];
s = this._lerp(_, y, m);
} else s = _;
} else s = i[h];
this.target[this.prop] = s;
}
}
});
l.Linear = null;
l.Bezier = function(t) {
return t;
};
var u = function() {
this.events = [];
};
u.prototype.add = function(t, e) {
this.events.push({
func: t || "",
params: e || []
});
};
var h = cc.Class({
name: "cc.EventAnimCurve",
extends: a,
properties: {
target: null,
ratios: [],
events: [],
_wrappedInfo: {
default: function() {
return new s();
}
},
_lastWrappedInfo: null,
_ignoreIndex: NaN
},
_wrapIterations: function(t) {
t - (0 | t) == 0 && (t -= 1);
return 0 | t;
},
sample: function(t, e, i) {
var o = this.ratios.length, a = i.getWrappedInfo(i.time, this._wrappedInfo), c = a.direction, l = n(this.ratios, a.ratio);
if (l < 0) {
l = ~l - 1;
c < 0 && (l += 1);
}
this._ignoreIndex !== l && (this._ignoreIndex = NaN);
a.frameIndex = l;
if (this._lastWrappedInfo) {
var u = i.wrapMode, h = this._wrapIterations(a.iterations), _ = this._lastWrappedInfo, f = this._wrapIterations(_.iterations), d = _.frameIndex, p = _.direction, m = -1 !== f && h !== f;
if (d === l && m && 1 === o) this._fireEvent(0); else if (d !== l || m) {
c = p;
do {
if (d !== l) {
if (-1 === c && 0 === d && l > 0) {
(u & r.PingPong) === r.PingPong ? c *= -1 : d = o;
f++;
} else if (1 === c && d === o - 1 && l < o - 1) {
(u & r.PingPong) === r.PingPong ? c *= -1 : d = -1;
f++;
}
if (d === l) break;
if (f > h) break;
}
d += c;
cc.director.getAnimationManager().pushDelayEvent(this, "_fireEvent", [ d ]);
} while (d !== l && d > -1 && d < o);
}
this._lastWrappedInfo.set(a);
} else {
this._fireEvent(l);
this._lastWrappedInfo = new s(a);
}
},
_fireEvent: function(t) {
if (!(t < 0 || t >= 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 < e.length; n++) for (var r = e[n], s = r.func, o = 0; o < i.length; o++) {
var a = i[o], c = a[s];
c && c.apply(a, r.params);
}
}
},
onTimeChangedManually: function(t, e) {
this._lastWrappedInfo = null;
this._ignoreIndex = NaN;
var i = e.getWrappedInfo(t, this._wrappedInfo), r = i.direction, s = n(this.ratios, i.ratio);
if (s < 0) {
s = ~s - 1;
r < 0 && (s += 1);
this._ignoreIndex = s;
}
}
});
e.exports = {
AnimCurve: a,
DynamicAnimCurve: l,
EventAnimCurve: h,
EventInfo: u,
computeRatioByType: o,
quickFindIndex: function(t, e) {
var i = t.length - 1;
if (0 === i) return 0;
var n = t[0];
if (e < n) return 0;
var r = t[i];
if (e > r) return ~t.length;
var s = (e = (e - n) / (r - n)) / (1 / i), o = 0 | s;
return s - o < 1e-6 ? o : o + 1 - s < 1e-6 ? o + 1 : ~(o + 1);
}
};
}), {
"../core/utils/binary-search": 315,
"./bezier": 14,
"./types": 19
} ],
12: [ (function(t, e) {
"use strict";
var i = cc.js, n = cc.Class({
ctor: function() {
this._anims = new i.array.MutableForwardIterator([]);
this._delayEvents = [];
cc.director._scheduler && cc.director._scheduler.enableForTarget(this);
},
update: function(t) {
var e = this._anims, i = e.array;
for (e.i = 0; e.i < i.length; ++e.i) {
var n = i[e.i];
n._isPlaying && !n._isPaused && n.update(t);
}
for (var r = this._delayEvents, s = 0; s < r.length; s++) {
var o = r[s];
o.target[o.func].apply(o.target, o.args);
}
r.length = 0;
},
destruct: function() {},
addAnimation: function(t) {
-1 === this._anims.array.indexOf(t) && this._anims.push(t);
},
removeAnimation: function(t) {
var e = this._anims.array.indexOf(t);
e >= 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 = n;
}), {} ],
13: [ (function(t, e) {
"use strict";
var i = cc.js, n = t("./playable"), r = t("./types"), s = r.WrappedInfo, o = r.WrapMode, a = r.WrapModeMask;
function c(t, e) {
n.call(this);
this._currentFramePlayed = !1;
this._delay = 0;
this._delayTime = 0;
this._wrappedInfo = new s();
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; e < i; e++) t[e] = arguments[e];
cc.director.getAnimationManager().pushDelayEvent(this, "_emit", t);
};
}
i.extend(c, n);
var l = c.prototype;
l._emit = function(t, e) {
this._target && this._target.isValid && this._target.emit(t, t, e);
};
l.on = function(t, e, i) {
if (this._target && this._target.isValid) {
"lastframe" === t && (this._lastframeEventOn = !0);
return this._target.on(t, e, i);
}
return null;
};
l.once = function(t, e, i) {
if (this._target && this._target.isValid) {
"lastframe" === t && (this._lastframeEventOn = !0);
var n = this;
return this._target.once(t, (function(t) {
e.call(i, t);
n._lastframeEventOn = !1;
}));
}
return null;
};
l.off = function(t, e, i) {
if (this._target && this._target.isValid) {
"lastframe" === t && (this._target.hasEventListener(t) || (this._lastframeEventOn = !1));
this._target.off(t, e, i);
}
};
l._setEventTarget = function(t) {
this._target = t;
};
l.onPlay = function() {
this.setTime(0);
this._delayTime = this._delay;
cc.director.getAnimationManager().addAnimation(this);
this.animator && this.animator.addAnimation(this);
this.emit("play", this);
};
l.onStop = function() {
this.isPaused || cc.director.getAnimationManager().removeAnimation(this);
this.animator && this.animator.removeAnimation(this);
this.emit("stop", this);
};
l.onResume = function() {
cc.director.getAnimationManager().addAnimation(this);
this.emit("resume", this);
};
l.onPause = function() {
cc.director.getAnimationManager().removeAnimation(this);
this.emit("pause", this);
};
l.setTime = function(t) {
this._currentFramePlayed = !1;
this.time = t || 0;
for (var e = this.curves, i = 0, n = e.length; i < n; i++) {
var r = e[i];
r.onTimeChangedManually && r.onTimeChangedManually(t, this);
}
};
function u() {
var t = this.sample();
if (this._lastframeEventOn) {
var e;
e = this._lastWrappedInfo ? this._lastWrappedInfo : this._lastWrappedInfo = new s(t);
this.repeatCount > 1 && (0 | t.iterations) > (0 | e.iterations) && this.emit("lastframe", this);
e.set(t);
}
if (t.stopped) {
this.stop();
this.emit("finished", this);
}
}
function h() {
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; r < s; r++) n[r].sample(t, i, this);
if (this._lastframeEventOn) {
void 0 === this._lastIterations && (this._lastIterations = i);
(this.time > 0 && this._lastIterations > i || this.time < 0 && this._lastIterations < i) && this.emit("lastframe", this);
this._lastIterations = i;
}
}
l.update = function(t) {
if (this._delayTime > 0) {
this._delayTime -= t;
if (this._delayTime > 0) return;
}
this._currentFramePlayed ? this.time += t * this.speed : this._currentFramePlayed = !0;
this._process();
};
l._needRevers = function(t) {
var e = this.wrapMode, i = !1;
if ((e & a.PingPong) === a.PingPong) {
t - (0 | t) == 0 && t > 0 && (t -= 1);
1 & t && (i = !i);
}
(e & a.Reverse) === a.Reverse && (i = !i);
return i;
};
l.getWrappedInfo = function(t, e) {
e = e || new s();
var i = !1, n = this.duration, r = this.repeatCount, o = t > 0 ? t / n : -t / n;
if (o >= r) {
o = r;
i = !0;
var c = r - (0 | r);
0 === c && (c = 1);
t = c * n * (t > 0 ? 1 : -1);
}
if (t > n) {
var l = t % n;
t = 0 === l ? n : l;
} else t < 0 && 0 != (t %= n) && (t += n);
var u = !1, h = this._wrapMode & a.ShouldWrap;
h && (u = this._needRevers(o));
var _ = u ? -1 : 1;
this.speed < 0 && (_ *= -1);
h && u && (t = n - t);
e.ratio = t / n;
e.time = t;
e.direction = _;
e.stopped = i;
e.iterations = o;
return e;
};
l.sample = function() {
for (var t = this.getWrappedInfo(this.time, this._wrappedInfo), e = this.curves, i = 0, n = e.length; i < n; i++) e[i].sample(t.time, t.ratio, this);
return t;
};
i.get(l, "clip", (function() {
return this._clip;
}));
i.get(l, "name", (function() {
return this._name;
}));
i.obsolete(l, "AnimationState.length", "duration");
i.getset(l, "curveLoaded", (function() {
return this.curves.length > 0;
}), (function() {
this.curves.length = 0;
}));
i.getset(l, "wrapMode", (function() {
return this._wrapMode;
}), (function(t) {
this._wrapMode = t;
this.time = 0;
t & a.Loop ? this.repeatCount = Infinity : this.repeatCount = 1;
}));
i.getset(l, "repeatCount", (function() {
return this._repeatCount;
}), (function(t) {
this._repeatCount = t;
var e = this._wrapMode & a.ShouldWrap, i = (this.wrapMode & a.Reverse) === a.Reverse;
this._process = Infinity !== t || e || i ? u : h;
}));
i.getset(l, "delay", (function() {
return this._delay;
}), (function(t) {
this._delayTime = this._delay = t;
}));
cc.AnimationState = e.exports = c;
}), {
"./playable": 18,
"./types": 19
} ],
14: [ (function(t, e) {
"use strict";
var i = Math.cos, n = Math.acos, r = Math.max, s = 2 * Math.PI, o = Math.sqrt;
function a(t) {
return t < 0 ? -Math.pow(-t, 1 / 3) : Math.pow(t, 1 / 3);
}
function c(t, e) {
var c, l, u, h, _ = 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), b = (-d + p) * y, C = 1 / 3 * (3 * b - v * v), x = C * (1 / 3), A = (2 * v * v * v - 9 * v * b + _ * y * 27) / 27, S = A / 2, T = S * S + x * x * x;
if (T < 0) {
var w = 1 / 3 * -C, E = o(w * w * w), M = -A / (2 * E), B = n(M < -1 ? -1 : M > 1 ? 1 : M), I = 2 * a(E);
l = I * i(B * (1 / 3)) - g;
u = I * i((B + s) * (1 / 3)) - g;
h = I * i((B + 2 * s) * (1 / 3)) - g;
return 0 <= l && l <= 1 ? 0 <= u && u <= 1 ? 0 <= h && h <= 1 ? r(l, u, h) : r(l, u) : 0 <= h && h <= 1 ? r(l, h) : l : 0 <= u && u <= 1 ? 0 <= h && h <= 1 ? r(u, h) : u : h;
}
if (0 === T) {
u = -(c = S < 0 ? a(-S) : -a(S)) - g;
return 0 <= (l = 2 * c - g) && l <= 1 ? 0 <= u && u <= 1 ? r(l, u) : l : u;
}
var D = o(T);
return (c = a(-S + D)) - a(S + D) - g;
}
e.exports = {
bezier: function(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;
},
bezierByTime: function(t, e) {
var i = c(t, e), n = t[1];
return ((1 - i) * (n + (t[3] - n) * i) * 3 + i * i) * i;
}
};
}), {} ],
15: [ (function(t, e) {
"use strict";
var i = {
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;
if (0 === t) return 0;
if (1 === t) return 1;
if (!i || i < 1) {
i = 1;
e = .1;
} else e = .4 * Math.asin(1 / i) / (2 * Math.PI);
return -i * Math.pow(2, 10 * (t -= 1)) * Math.sin(2 * (t - e) * Math.PI / .4);
},
elasticOut: function(t) {
var e, i = .1;
if (0 === t) return 0;
if (1 === t) return 1;
if (!i || i < 1) {
i = 1;
e = .1;
} else e = .4 * Math.asin(1 / i) / (2 * Math.PI);
return i * Math.pow(2, -10 * t) * Math.sin(2 * (t - e) * Math.PI / .4) + 1;
},
elasticInOut: function(t) {
var e, i = .1;
if (0 === t) return 0;
if (1 === t) return 1;
if (!i || i < 1) {
i = 1;
e = .1;
} else e = .4 * Math.asin(1 / i) / (2 * Math.PI);
return (t *= 2) < 1 ? i * Math.pow(2, 10 * (t -= 1)) * Math.sin(2 * (t - e) * Math.PI / .4) * -.5 : i * Math.pow(2, -10 * (t -= 1)) * Math.sin(2 * (t - e) * 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 - i.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 * i.bounceIn(2 * t) : .5 * i.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 n(t, e) {
return function(i) {
return i < .5 ? e(2 * i) / 2 : t(2 * i - 1) / 2 + .5;
};
}
i.quadOutIn = n(i.quadIn, i.quadOut);
i.cubicOutIn = n(i.cubicIn, i.cubicOut);
i.quartOutIn = n(i.quartIn, i.quartOut);
i.quintOutIn = n(i.quintIn, i.quintOut);
i.sineOutIn = n(i.sineIn, i.sineOut);
i.expoOutIn = n(i.expoIn, i.expoOut);
i.circOutIn = n(i.circIn, i.circOut);
i.backOutIn = n(i.backIn, i.backOut);
i.bounceIn = function(t) {
return 1 - i.bounceOut(1 - t);
};
i.bounceInOut = function(t) {
return t < .5 ? .5 * i.bounceIn(2 * t) : .5 * i.bounceOut(2 * t - 1) + .5;
};
i.bounceOutIn = n(i.bounceIn, i.bounceOut);
cc.easing = e.exports = i;
}), {} ],
16: [ (function(t) {
"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) {
"use strict";
var i = t("./animation-curves").DynamicAnimCurve, n = t("./animation-curves").computeRatioByType, r = t("./bezier").bezier, s = t("../core/utils/binary-search").binarySearchEpsilon, o = cc.v2;
function a(t) {
this.points = t || [];
this.beziers = [];
this.ratios = [];
this.progresses = [];
this.length = 0;
this.computeBeziers();
}
a.prototype.computeBeziers = function() {
this.beziers.length = 0;
this.ratios.length = 0;
this.progresses.length = 0;
this.length = 0;
for (var t, e = 1; e < this.points.length; e++) {
var i = this.points[e - 1], n = this.points[e];
(t = new c()).start = i.pos;
t.startCtrlPoint = i.out;
t.end = n.pos;
t.endCtrlPoint = n.in;
this.beziers.push(t);
this.length += t.getLength();
}
var r = 0;
for (e = 0; e < this.beziers.length; e++) {
t = this.beziers[e];
this.ratios[e] = t.getLength() / this.length;
this.progresses[e] = r += this.ratios[e];
}
return this.beziers;
};
function c() {
this.start = o();
this.end = o();
this.startCtrlPoint = o();
this.endCtrlPoint = o();
}
c.prototype.getPointAt = function(t) {
var e = this.getUtoTmapping(t);
return this.getPoint(e);
};
c.prototype.getPoint = function(t) {
var e = r(this.start.x, this.startCtrlPoint.x, this.endCtrlPoint.x, this.end.x, t), i = r(this.start.y, this.startCtrlPoint.y, this.endCtrlPoint.y, this.end.y, t);
return new o(e, i);
};
c.prototype.getLength = function() {
var t = this.getLengths();
return t[t.length - 1];
};
c.prototype.getLengths = function(t) {
t || (t = this.__arcLengthDivisions ? this.__arcLengthDivisions : 200);
if (this.cacheArcLengths && this.cacheArcLengths.length === t + 1) return this.cacheArcLengths;
var e, i, n = [], r = this.getPoint(0), s = o(), a = 0;
n.push(0);
for (i = 1; i <= t; i++) {
e = this.getPoint(i / t);
s.x = r.x - e.x;
s.y = r.y - e.y;
a += s.mag();
n.push(a);
r = e;
}
this.cacheArcLengths = n;
return n;
};
c.prototype.getUtoTmapping = function(t, e) {
var i, n = this.getLengths(), r = 0, s = n.length;
i = e || t * n[s - 1];
for (var o, a = 0, c = s - 1; a <= c; ) if ((o = n[r = Math.floor(a + (c - a) / 2)] - i) < 0) a = r + 1; else {
if (!(o > 0)) {
c = r;
break;
}
c = r - 1;
}
if (n[r = c] === i) return r / (s - 1);
var l = n[r];
return (r + (i - l) / (n[r + 1] - l)) / (s - 1);
};
function l(t) {
if (!Array.isArray(t)) return !1;
for (var e = 0, i = t.length; e < i; e++) {
var n = t[e];
if (!Array.isArray(n) || 6 !== n.length) return !1;
}
return !0;
}
e.exports = {
sampleMotionPaths: function(t, e, r, c, u) {
function h(t) {
return t instanceof cc.Vec2 ? {
in: t,
pos: t,
out: t
} : Array.isArray(t) && 6 === t.length ? {
in: o(t[2], t[3]),
pos: o(t[0], t[1]),
out: o(t[4], t[5])
} : {
in: cc.Vec2.ZERO,
pos: cc.Vec2.ZERO,
out: cc.Vec2.ZERO
};
}
var _ = e.values = e.values.map((function(t) {
Array.isArray(t) && (t = 2 === t.length ? cc.v2(t[0], t[1]) : cc.v3(t[0], t[1], t[2]));
return t;
}));
if (0 !== t.length && 0 !== _.length) {
for (var f = !1, d = 0; d < t.length; d++) {
var p = t[d];
if (p && !l(p)) {
cc.errorID(3904, u ? u.name : "", "position", d);
p = null;
}
if (p && p.length > 0) {
f = !0;
break;
}
}
if (f && 1 !== _.length) {
for (var m = e.types, y = e.ratios, v = e.values = [], g = e.types = [], b = e.ratios = [], C = 0, x = i.Linear, A = 0, S = t.length; A < S - 1; A++) {
var T, w = t[A], E = y[A], M = y[A + 1] - E, B = _[A], I = _[A + 1], D = m[A], P = [], R = C / M, L = 1 / (M * r * c);
if (w && w.length > 0) {
var O = [];
O.push(h(B));
for (var V = 0, N = w.length; V < N; V++) {
var F = h(w[V]);
O.push(F);
}
O.push(h(I));
var z = new a(O);
z.computeBeziers();
for (var k = z.progresses; 1 - R > 1e-6; ) {
var G, U, H, j;
if ((T = n(T = R, D)) < 0) {
j = (0 - T) * (U = z.beziers[0]).getLength();
H = U.start.sub(U.endCtrlPoint).normalize();
G = U.start.add(H.mul(j));
} else if (T > 1) {
j = (T - 1) * (U = z.beziers[z.beziers.length - 1]).getLength();
H = U.end.sub(U.startCtrlPoint).normalize();
G = U.end.add(H.mul(j));
} else {
var W = s(k, T);
W < 0 && (W = ~W);
T -= W > 0 ? k[W - 1] : 0;
T /= z.ratios[W];
G = z.beziers[W].getPointAt(T);
}
P.push(G);
R += L;
}
} else for (;1 - R > 1e-6; ) {
T = n(T = R, D);
P.push(B.lerp(I, T));
R += L;
}
x = "constant" === D ? D : i.Linear;
for (V = 0, N = P.length; V < N; V++) {
var q = E + C + L * V * M;
X(P[V], x, q);
}
C = Math.abs(R - 1) > 1e-6 ? (R - 1) * M : 0;
}
y[y.length - 1] !== b[b.length - 1] && X(_[_.length - 1], x, y[y.length - 1]);
}
}
function X(t, e, i) {
v.push(t);
g.push(e);
b.push(i);
}
},
Curve: a,
Bezier: c
};
}), {
"../core/utils/binary-search": 315,
"./animation-curves": 11,
"./bezier": 14
} ],
18: [ (function(t, e) {
"use strict";
var i = cc.js, n = t("../core/CCDebug");
function r() {
this._isPlaying = !1;
this._isPaused = !1;
this._stepOnce = !1;
}
var s = r.prototype;
i.get(s, "isPlaying", (function() {
return this._isPlaying;
}), !0);
i.get(s, "isPaused", (function() {
return this._isPaused;
}), !0);
var o = function() {};
s.onPlay = o;
s.onPause = o;
s.onResume = o;
s.onStop = o;
s.onError = o;
s.play = function() {
if (this._isPlaying) if (this._isPaused) {
this._isPaused = !1;
this.onResume();
} else this.onError(n.getError(3912)); else {
this._isPlaying = !0;
this.onPlay();
}
};
s.stop = function() {
if (this._isPlaying) {
this._isPlaying = !1;
this.onStop();
this._isPaused = !1;
}
};
s.pause = function() {
if (this._isPlaying && !this._isPaused) {
this._isPaused = !0;
this.onPause();
}
};
s.resume = function() {
if (this._isPlaying && this._isPaused) {
this._isPaused = !1;
this.onResume();
}
};
s.step = function() {
this.pause();
this._stepOnce = !0;
this._isPlaying || this.play();
};
e.exports = r;
}), {
"../core/CCDebug": 69
} ],
19: [ (function(t, e) {
"use strict";
var i = {
Loop: 2,
ShouldWrap: 4,
PingPong: 22,
Reverse: 36
}, n = cc.Enum({
Default: 0,
Normal: 1,
Reverse: i.Reverse,
Loop: i.Loop,
LoopReverse: i.Loop | i.Reverse,
PingPong: i.PingPong,
PingPongReverse: i.PingPong | i.Reverse
});
cc.WrapMode = n;
function r(t) {
if (t) this.set(t); else {
this.ratio = 0;
this.time = 0;
this.direction = 1;
this.stopped = !0;
this.iterations = 0;
this.frameIndex = void 0;
}
}
r.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: i,
WrapMode: n,
WrappedInfo: r
};
}), {} ],
20: [ (function(t, e) {
"use strict";
var i, n = t("../core/event/event-target"), r = t("../core/platform/CCSys"), s = t("../core/assets/CCAudioClip").LoadMode, o = !1, a = [], c = function t(e) {
n.call(this);
this._shouldRecycleOnEnded = !1;
this._src = e;
this._element = null;
this.id = 0;
this._state = t.State.INITIALZING;
var i = this;
this._onended = function() {
i._state = t.State.STOPPED;
i.emit("ended");
};
this._onendedSecond = function() {
i._unbindEnded(i._onendedSecond);
i._bindEnded();
};
};
cc.js.extend(c, n);
c.State = {
ERROR: -1,
INITIALZING: 0,
PLAYING: 1,
PAUSED: 2,
STOPPED: 3
};
(function(t) {
t._bindEnded = function(t) {
if (!(t = t || this._onended)._binded) {
t._binded = !0;
var e = this._element;
this._src && e instanceof HTMLAudioElement ? e.addEventListener("ended", t) : e.onended = t;
}
};
t._unbindEnded = function(t) {
if ((t = t || this._onended)._binded) {
t._binded = !1;
var e = this._element;
e instanceof HTMLAudioElement ? e.removeEventListener("ended", t) : e && (e.onended = null);
}
};
t._onLoaded = function() {
this._createElement();
this._state = c.State.INITIALZING;
this.setVolume(1);
this.setLoop(!1);
};
t._createElement = function() {
var t = this._src._nativeAsset;
if (t instanceof HTMLAudioElement) {
this._element || (this._element = document.createElement("audio"));
this._element.src = t.src;
} else this._element = new l(t, this);
};
t.play = function() {
var t = this;
this._src && this._src._ensureLoaded((function() {
t._state = c.State.PLAYING;
t._bindEnded();
var e = t._element.play();
window.Promise && e instanceof Promise && e.catch((function() {}));
t._touchToPlay();
}));
};
t._touchToPlay = function() {
this._src && this._src.loadMode === s.DOM_AUDIO && this._element.paused && a.push({
instance: this,
offset: 0,
audio: this._element
});
if (!o) {
o = !0;
var t = "ontouchend" in window ? "touchend" : "mousedown";
cc.game.canvas.addEventListener(t, (function() {
for (var t; t = a.pop(); ) t.audio.play(t.offset);
}));
}
};
t.destroy = function() {
this._element = null;
};
t.pause = function() {
if (this.getState() === c.State.PLAYING) {
var t = this;
this._src && this._src._ensureLoaded((function() {
t._unbindEnded();
t._element.pause();
t._state = c.State.PAUSED;
}));
}
};
t.resume = function() {
if (this.getState() === c.State.PAUSED) {
var t = this;
this._src && this._src._ensureLoaded((function() {
t._bindEnded();
t._element.play();
t._state = c.State.PLAYING;
}));
}
};
t.stop = function() {
var t = this;
this._src && this._src._ensureLoaded((function() {
t._element.pause();
t._element.currentTime = 0;
for (var e = 0; e < a.length; e++) if (a[e].instance === t) {
a.splice(e, 1);
break;
}
t._unbindEnded();
t.emit("stop");
t._state = c.State.STOPPED;
}));
};
t.setLoop = function(t) {
var e = this;
this._src && this._src._ensureLoaded((function() {
e._element.loop = t;
}));
};
t.getLoop = function() {
return !!this._element && this._element.loop;
};
t.setVolume = function(t) {
var e = this;
this._src && this._src._ensureLoaded((function() {
e._element.volume = t;
}));
};
t.getVolume = function() {
return this._element ? this._element.volume : 1;
};
t.setCurrentTime = function(t) {
var e = this;
this._src && this._src._ensureLoaded((function() {
e._unbindEnded();
e._bindEnded(e._onendedSecond);
e._element.currentTime = t;
}));
};
t.getCurrentTime = function() {
return this._element ? this._element.currentTime : 0;
};
t.getDuration = function() {
return this._src ? this._src.duration : 0;
};
t.getState = function(t) {
void 0 === t && (t = !0);
t && this._forceUpdatingState();
return this._state;
};
t._forceUpdatingState = function() {
var t = this._element;
t && (c.State.PLAYING === this._state && t.paused ? this._state = c.State.STOPPED : c.State.STOPPED !== this._state || t.paused || (this._state = c.State.PLAYING));
};
Object.defineProperty(t, "src", {
get: function() {
return this._src;
},
set: function(t) {
this._unbindEnded();
if (t) {
if (t !== this._src) {
this._src = t;
if (t.loaded) this._onLoaded(); else {
var e = this;
t.once("load", (function() {
t === e._src && e._onLoaded();
}));
}
}
} else {
this._src = null;
this._element instanceof l ? this._element = null : this._element && (this._element.src = "");
this._state = c.State.INITIALZING;
}
return t;
},
enumerable: !0,
configurable: !0
});
Object.defineProperty(t, "paused", {
get: function() {
return !this._element || this._element.paused;
},
enumerable: !0,
configurable: !0
});
})(c.prototype);
i = cc.sys.browserType === cc.sys.BROWSER_TYPE_EDGE || cc.sys.browserType === cc.sys.BROWSER_TYPE_BAIDU || cc.sys.browserType === cc.sys.BROWSER_TYPE_UC ? .01 : 0;
var l = function(t, e) {
this._audio = e;
this._context = r.__audioSupport.context;
this._buffer = t;
this._gainObj = this._context.createGain();
this.volume = 1;
this._gainObj.connect(this._context.destination);
this._loop = !1;
this._startTime = -1;
this._currentSource = null;
this.playedLength = 0;
this._currentTimer = null;
this._endCallback = function() {
this.onended && this.onended(this);
}.bind(this);
};
(function(t) {
t.play = function(t) {
if (this._currentSource && !this.paused) {
this._currentSource.onended = null;
this._currentSource.stop(0);
this.playedLength = 0;
}
var e = this._context.createBufferSource();
e.buffer = this._buffer;
e.connect(this._gainObj);
e.loop = this._loop;
this._startTime = this._context.currentTime;
(t = t || this.playedLength) && (this._startTime -= t);
var i, n = this._buffer.duration, r = t;
if (this._loop) e.start ? e.start(0, r) : e.notoGrainOn ? e.noteGrainOn(0, r) : e.noteOn(0, r); else {
i = n - t;
e.start ? e.start(0, r, i) : e.noteGrainOn ? e.noteGrainOn(0, r, i) : e.noteOn(0, r, i);
}
this._currentSource = e;
e.onended = this._endCallback;
if ((!e.context.state || "suspended" === e.context.state) && 0 === this._context.currentTime) {
var s = this;
clearTimeout(this._currentTimer);
this._currentTimer = setTimeout((function() {
0 === s._context.currentTime && a.push({
instance: s._audio,
offset: t,
audio: s
});
}), 10);
}
var o = cc.sys;
o.os === o.OS_IOS && o.isBrowser && o.isMobile && ("suspended" === e.context.state && 0 !== this._context.currentTime || "interrupted" === e.context.state) && e.context.resume();
};
t.pause = function() {
clearTimeout(this._currentTimer);
if (!this.paused) {
this.playedLength = this._context.currentTime - this._startTime;
this.playedLength %= this._buffer.duration;
var t = this._currentSource;
if (t) {
if (t.onended) {
t.onended._binded = !1;
t.onended = null;
}
t.stop(0);
}
this._currentSource = null;
this._startTime = -1;
}
};
Object.defineProperty(t, "paused", {
get: function() {
return (!this._currentSource || !this._currentSource.loop) && (-1 === this._startTime || this._context.currentTime - this._startTime > this._buffer.duration);
},
enumerable: !0,
configurable: !0
});
Object.defineProperty(t, "loop", {
get: function() {
return this._loop;
},
set: function(t) {
this._currentSource && (this._currentSource.loop = t);
return this._loop = t;
},
enumerable: !0,
configurable: !0
});
Object.defineProperty(t, "volume", {
get: function() {
return this._volume;
},
set: function(t) {
this._volume = t;
if (this._gainObj.gain.setTargetAtTime) try {
this._gainObj.gain.setTargetAtTime(t, this._context.currentTime, i);
} catch (e) {
this._gainObj.gain.setTargetAtTime(t, this._context.currentTime, .01);
} else this._gainObj.gain.value = t;
if (r.os === r.OS_IOS && !this.paused && this._currentSource) {
this._currentSource.onended = null;
this.pause();
this.play();
}
},
enumerable: !0,
configurable: !0
});
Object.defineProperty(t, "currentTime", {
get: function() {
if (this.paused) return this.playedLength;
this.playedLength = this._context.currentTime - this._startTime;
this.playedLength %= this._buffer.duration;
return this.playedLength;
},
set: function(t) {
if (this.paused) this.playedLength = t; else {
this.pause();
this.playedLength = t;
this.play();
}
return t;
},
enumerable: !0,
configurable: !0
});
Object.defineProperty(t, "duration", {
get: function() {
return this._buffer.duration;
},
enumerable: !0,
configurable: !0
});
})(l.prototype);
e.exports = cc._Audio = c;
}), {
"../core/assets/CCAudioClip": 106,
"../core/event/event-target": 186,
"../core/platform/CCSys": 248
} ],
21: [ (function(t, e) {
"use strict";
var i = t("./CCAudio"), n = t("../core/assets/CCAudioClip"), r = cc.js, s = 0, o = r.createMap(!0), a = {}, c = [], l = function(t) {
if (t._shouldRecycleOnEnded) {
t._finishCallback = null;
t.off("ended");
t.off("stop");
t.src = null;
c.includes(t) || (c.length < 32 ? c.push(t) : t.destroy());
t._shouldRecycleOnEnded = !1;
}
}, u = function(t) {
var e = s++, n = a[t];
n || (n = a[t] = []);
if (f._maxAudioInstance <= n.length) {
var r = n.shift();
h(r).stop();
}
var u = c.pop() || new i(), _ = function() {
if (h(this.id)) {
delete o[this.id];
var t = n.indexOf(this.id);
cc.js.array.fastRemoveAt(n, t);
}
l(this);
};
u.on("ended", (function() {
this._finishCallback && this._finishCallback();
this.getLoop() || _.call(this);
}), u);
u.on("stop", _, u);
u.id = e;
o[e] = u;
n.push(e);
return u;
}, h = function(t) {
return o[t];
}, _ = function(t) {
void 0 === t ? t = 1 : "string" == typeof t && (t = Number.parseFloat(t));
return t;
}, f = {
AudioState: i.State,
_maxAudioInstance: 24,
_id2audio: o,
play: function(t, e, i) {
if (!(t instanceof n)) return cc.error("Wrong type of AudioClip.");
var r = t.nativeUrl, s = u(r);
s.src = t;
t._ensureLoaded();
s._shouldRecycleOnEnded = !0;
s.setLoop(e || !1);
i = _(i);
s.setVolume(i);
s.play();
return s.id;
},
setLoop: function(t, e) {
var i = h(t);
i && i.setLoop && i.setLoop(e);
},
isLoop: function(t) {
var e = h(t);
return !(!e || !e.getLoop) && e.getLoop();
},
setVolume: function(t, e) {
var i = h(t);
i && i.setVolume(e);
},
getVolume: function(t) {
var e = h(t);
return e ? e.getVolume() : 1;
},
setCurrentTime: function(t, e) {
var i = h(t);
if (i) {
i.setCurrentTime(e);
return !0;
}
return !1;
},
getCurrentTime: function(t) {
var e = h(t);
return e ? e.getCurrentTime() : 0;
},
getDuration: function(t) {
var e = h(t);
return e ? e.getDuration() : 0;
},
getState: function(t) {
var e = h(t);
return e ? e.getState() : this.AudioState.ERROR;
},
setFinishCallback: function(t, e) {
var i = h(t);
i && (i._finishCallback = e);
},
pause: function(t) {
var e = h(t);
if (e) {
e.pause();
return !0;
}
return !1;
},
_pauseIDCache: [],
pauseAll: function() {
for (var t in o) {
var e = o[t];
if (e.getState() === i.State.PLAYING) {
this._pauseIDCache.push(t);
e.pause();
}
}
},
resume: function(t) {
var e = h(t);
e && e.resume();
},
resumeAll: function() {
for (var t = 0; t < this._pauseIDCache.length; ++t) {
var e = this._pauseIDCache[t], i = h(e);
i && i.resume();
}
this._pauseIDCache.length = 0;
},
stop: function(t) {
var e = h(t);
if (e) {
e.stop();
return !0;
}
return !1;
},
stopAll: function() {
for (var t in o) {
var e = o[t];
e && e.stop();
}
},
setMaxAudioInstance: function() {},
getMaxAudioInstance: function() {
return this._maxAudioInstance;
},
uncache: function(t) {
var e = t;
if ("string" == typeof t) {
cc.warnID(8401, "cc.audioEngine", "cc.AudioClip", "AudioClip", "cc.AudioClip", "audio");
e = t;
} else {
if (!t) return;
e = t.nativeUrl;
}
var i = a[e];
if (i) for (;i.length > 0; ) {
var n = i.pop(), r = o[n];
if (r) {
r.stop();
delete o[n];
}
}
},
uncacheAll: function() {
this.stopAll();
var t;
for (var e in o) (t = o[e]) && t.destroy();
for (;t = c.pop(); ) t.destroy();
o = r.createMap(!0);
a = {};
},
_breakCache: null,
_break: function() {
this._breakCache = [];
for (var t in o) {
var e = o[t];
if (e.getState() === i.State.PLAYING) {
this._breakCache.push(t);
e.pause();
}
}
},
_restore: function() {
if (this._breakCache) {
for (;this._breakCache.length > 0; ) {
var t = this._breakCache.pop(), e = h(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;
this.stop(i.id);
i.id = this.play(t, e, i.volume);
i.loop = e;
return i.id;
},
stopMusic: function() {
this.stop(this._music.id);
},
pauseMusic: function() {
this.pause(this._music.id);
return this._music.id;
},
resumeMusic: function() {
this.resume(this._music.id);
return this._music.id;
},
getMusicVolume: function() {
return this._music.volume;
},
setMusicVolume: function(t) {
t = _(t);
var e = this._music;
e.volume = t;
this.setVolume(e.id, e.volume);
return 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 = _(t);
var e = this._music.id;
this._effect.volume = t;
for (var i in o) {
var n = o[i];
n && n.id !== e && f.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;
e.pauseCache.length = 0;
for (var i in 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 < t.length; ++e) {
var i = t[e], n = o[i];
n && n.resume();
}
},
stopEffect: function(t) {
return this.stop(t);
},
stopAllEffects: function() {
var t = this._music.id;
for (var e in o) {
var i = o[e];
i && i.id !== t && i.getState() === f.AudioState.PLAYING && i.stop();
}
}
};
e.exports = cc.audioEngine = f;
}), {
"../core/assets/CCAudioClip": 106,
"./CCAudio": 20
} ],
22: [ (function(t, e) {
"use strict";
var i = {
name: "Jacob__Codec"
};
i.Base64 = t("./base64");
i.GZip = t("./gzip");
i.unzip = function() {
return i.GZip.gunzip.apply(i.GZip, arguments);
};
i.unzipBase64 = function() {
var t = i.Base64.decode.apply(i.Base64, arguments);
try {
return i.GZip.gunzip.call(i.GZip, t);
} catch (e) {
return t.slice(7);
}
};
i.unzipBase64AsArray = function(t, e) {
e = e || 1;
var i, n, r, s = this.unzipBase64(t), o = [];
for (i = 0, r = s.length / e; i < r; i++) {
o[i] = 0;
for (n = e - 1; n >= 0; --n) o[i] += s.charCodeAt(i * e + n) << 8 * n;
}
return o;
};
i.unzipAsArray = function(t, e) {
e = e || 1;
var i, n, r, s = this.unzip(t), o = [];
for (i = 0, r = s.length / e; i < r; i++) {
o[i] = 0;
for (n = e - 1; n >= 0; --n) o[i] += s.charCodeAt(i * e + n) << 8 * n;
}
return o;
};
cc.codec = e.exports = i;
}), {
"./base64": 23,
"./gzip": 24
} ],
23: [ (function(t, e) {
"use strict";
var i = t("../core/utils/misc").BASE64_VALUES, n = {
name: "Jacob__Codec__Base64",
decode: function(t) {
var e, n, r, s, o, a, c = [], l = 0;
t = t.replace(/[^A-Za-z0-9\+\/\=]/g, "");
for (;l < t.length; ) {
e = i[t.charCodeAt(l++)] << 2 | (s = i[t.charCodeAt(l++)]) >> 4;
n = (15 & s) << 4 | (o = i[t.charCodeAt(l++)]) >> 2;
r = (3 & o) << 6 | (a = i[t.charCodeAt(l++)]);
c.push(String.fromCharCode(e));
64 !== o && c.push(String.fromCharCode(n));
64 !== a && c.push(String.fromCharCode(r));
}
return c.join("");
},
decodeAsArray: function(t, e) {
var i, n, r, s = this.decode(t), o = [];
for (i = 0, r = s.length / e; i < r; i++) {
o[i] = 0;
for (n = e - 1; n >= 0; --n) o[i] += s.charCodeAt(i * e + n) << 8 * n;
}
return o;
}
};
e.exports = n;
}), {
"../core/utils/misc": 322
} ],
24: [ (function(t, e) {
"use strict";
var i = 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(i.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;
};
i.gunzip = function(t) {
t.constructor === Array || (t.constructor, String);
return new i(t).gunzip()[0][0];
};
i.HufNode = function() {
this.b0 = 0;
this.b1 = 0;
this.jump = null;
this.jumppos = -1;
};
i.LITERALS = 288;
i.NAMEMAX = 256;
i.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 ];
i.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 ];
i.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 ];
i.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 ];
i.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 ];
i.border = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
i.prototype.gunzip = function() {
this.outputArr = [];
this.nextFile();
return this.unzipped;
};
i.prototype.readByte = function() {
this.bits += 8;
return this.bytepos < this.data.length ? this.data.charCodeAt(this.bytepos++) : -1;
};
i.prototype.byteAlign = function() {
this.bb = 1;
};
i.prototype.readBit = function() {
var t;
this.bits++;
t = 1 & this.bb;
this.bb >>= 1;
if (0 === this.bb) {
this.bb = this.readByte();
t = 1 & this.bb;
this.bb = this.bb >> 1 | 128;
}
return t;
};
i.prototype.readBits = function(t) {
for (var e = 0, n = t; n--; ) e = e << 1 | this.readBit();
t && (e = i.bitReverse[e] >> 8 - t);
return e;
};
i.prototype.flushBuffer = function() {
this.bIdx = 0;
};
i.prototype.addBuffer = function(t) {
this.buf32k[this.bIdx++] = t;
this.outputArr.push(String.fromCharCode(t));
32768 === this.bIdx && (this.bIdx = 0);
};
i.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]++;
}
};
i.prototype.Rec = function() {
var t, e = this.Places[this.treepos];
if (17 === this.len) return -1;
this.treepos++;
this.len++;
if ((t = this.IsPat()) >= 0) e.b0 = t; else {
e.b0 = 32768;
if (this.Rec()) return -1;
}
if ((t = this.IsPat()) >= 0) {
e.b1 = t;
e.jump = null;
} else {
e.b1 = 32768;
e.jump = this.Places[this.treepos];
e.jumppos = this.treepos;
if (this.Rec()) return -1;
}
this.len--;
return 0;
};
i.prototype.CreateTree = function(t, e, i) {
var n;
this.Places = t;
this.treepos = 0;
this.flens = i;
this.fmax = e;
for (n = 0; n < 17; n++) this.fpos[n] = 0;
this.len = 0;
return this.Rec() ? -1 : 0;
};
i.prototype.DecodeValue = function(t) {
for (var e, i, n = 0, r = t[n]; ;) if (this.readBit()) {
if (!(32768 & r.b1)) return r.b1;
r = r.jump;
e = t.length;
for (i = 0; i < e; i++) if (t[i] === r) {
n = i;
break;
}
} else {
if (!(32768 & r.b0)) return r.b0;
r = t[++n];
}
return -1;
};
i.prototype.DeflateLoop = function() {
var t, e, n;
do {
t = this.readBit();
if (0 === (e = this.readBits(2))) {
var r, s;
this.byteAlign();
r = this.readByte();
r |= this.readByte() << 8;
s = this.readByte();
65535 & (r ^ ~(s |= this.readByte() << 8)) && document.write("BlockLen checksum mismatch\n");
for (;r--; ) {
o = this.readByte();
this.addBuffer(o);
}
} else if (1 === e) for (;;) {
(a = i.bitReverse[this.readBits(7)] >> 1) > 23 ? (a = a << 1 | this.readBit()) > 199 ? a = (a -= 128) << 1 | this.readBit() : (a -= 48) > 143 && (a += 136) : a += 256;
if (a < 256) this.addBuffer(a); else {
if (256 === a) break;
a -= 257;
p = this.readBits(i.cplext[a]) + i.cplens[a];
a = i.bitReverse[this.readBits(5)] >> 3;
if (i.cpdext[a] > 8) {
m = this.readBits(8);
m |= this.readBits(i.cpdext[a] - 8) << 8;
} else m = this.readBits(i.cpdext[a]);
m += i.cpdist[a];
for (a = 0; a < p; a++) {
var o = this.buf32k[this.bIdx - m & 32767];
this.addBuffer(o);
}
}
} else if (2 === e) {
var a, c, l, u, h, _ = new Array(320);
l = 257 + this.readBits(5);
u = 1 + this.readBits(5);
h = 4 + this.readBits(4);
for (a = 0; a < 19; a++) _[a] = 0;
for (a = 0; a < h; a++) _[i.border[a]] = this.readBits(3);
p = this.distanceTree.length;
for (n = 0; n < p; n++) this.distanceTree[n] = new i.HufNode();
if (this.CreateTree(this.distanceTree, 19, _, 0)) {
this.flushBuffer();
return 1;
}
c = l + u;
n = 0;
for (;n < c; ) if ((a = this.DecodeValue(this.distanceTree)) < 16) _[n++] = a; else if (16 === a) {
var f;
if (n + (a = 3 + this.readBits(2)) > c) {
this.flushBuffer();
return 1;
}
f = n ? _[n - 1] : 0;
for (;a--; ) _[n++] = f;
} else {
if (n + (a = 17 === a ? 3 + this.readBits(3) : 11 + this.readBits(7)) > c) {
this.flushBuffer();
return 1;
}
for (;a--; ) _[n++] = 0;
}
p = this.literalTree.length;
for (n = 0; n < p; n++) this.literalTree[n] = new i.HufNode();
if (this.CreateTree(this.literalTree, l, _, 0)) {
this.flushBuffer();
return 1;
}
p = this.literalTree.length;
for (n = 0; n < p; n++) this.distanceTree[n] = new i.HufNode();
var d = new Array();
for (n = l; n < _.length; n++) d[n - l] = _[n];
if (this.CreateTree(this.distanceTree, u, d, 0)) {
this.flushBuffer();
return 1;
}
for (;;) if ((a = this.DecodeValue(this.literalTree)) >= 256) {
var p, m;
if (0 == (a -= 256)) break;
a--;
p = this.readBits(i.cplext[a]) + i.cplens[a];
a = this.DecodeValue(this.distanceTree);
if (i.cpdext[a] > 8) {
m = this.readBits(8);
m |= this.readBits(i.cpdext[a] - 8) << 8;
} else m = this.readBits(i.cpdext[a]);
m += i.cpdist[a];
for (;p--; ) {
o = this.buf32k[this.bIdx - m & 32767];
this.addBuffer(o);
}
} else this.addBuffer(a);
}
} while (!t);
this.flushBuffer();
this.byteAlign();
return 0;
};
i.prototype.unzipFile = function(t) {
var e;
this.gunzip();
for (e = 0; e < this.unzipped.length; e++) if (this.unzipped[e][1] === t) return this.unzipped[e][0];
};
i.prototype.nextFile = function() {
this.outputArr = [];
this.modeZIP = !1;
var t = [];
t[0] = this.readByte();
t[1] = this.readByte();
if (120 === t[0] && 218 === t[1]) {
this.DeflateLoop();
this.unzipped[this.files] = [ this.outputArr.join(""), "geonext.gxt" ];
this.files++;
}
if (31 === t[0] && 139 === t[1]) {
this.skipdir();
this.unzipped[this.files] = [ this.outputArr.join(""), "file" ];
this.files++;
}
if (80 === t[0] && 75 === t[1]) {
this.modeZIP = !0;
t[2] = this.readByte();
t[3] = this.readByte();
if (3 === t[2] && 4 === t[3]) {
t[0] = this.readByte();
t[1] = this.readByte();
this.gpflags = this.readByte();
this.gpflags |= this.readByte() << 8;
var e = this.readByte();
e |= this.readByte() << 8;
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
var n = this.readByte();
n |= this.readByte() << 8;
var r = this.readByte();
r |= this.readByte() << 8;
o = 0;
this.nameBuf = [];
for (;n--; ) {
var s = this.readByte();
"/" === s | ":" === s ? o = 0 : o < i.NAMEMAX - 1 && (this.nameBuf[o++] = String.fromCharCode(s));
}
this.fileout || (this.fileout = this.nameBuf);
for (var o = 0; o < r; ) {
s = this.readByte();
o++;
}
if (8 === e) {
this.DeflateLoop();
this.unzipped[this.files] = [ this.outputArr.join(""), this.nameBuf.join("") ];
this.files++;
}
this.skipdir();
}
}
};
i.prototype.skipdir = function() {
var t, e, n = [];
if (8 & this.gpflags) {
n[0] = this.readByte();
n[1] = this.readByte();
n[2] = this.readByte();
n[3] = this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
}
this.modeZIP && this.nextFile();
n[0] = this.readByte();
if (8 !== n[0]) return 0;
this.gpflags = this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
if (4 & this.gpflags) {
n[0] = this.readByte();
n[2] = this.readByte();
this.len = n[0] + 256 * n[1];
for (t = 0; t < this.len; t++) this.readByte();
}
if (8 & this.gpflags) {
t = 0;
this.nameBuf = [];
for (;e = this.readByte(); ) {
"7" !== e && ":" !== e || (t = 0);
t < i.NAMEMAX - 1 && (this.nameBuf[t++] = e);
}
}
if (16 & this.gpflags) for (;e = this.readByte(); ) ;
if (2 & this.gpflags) {
this.readByte();
this.readByte();
}
this.DeflateLoop();
this.readByte();
this.readByte();
this.readByte();
this.readByte();
this.modeZIP && this.nextFile();
};
e.exports = i;
}), {} ],
25: [ (function(t, e) {
"use strict";
(function() {
function t(t) {
throw t;
}
var e = void 0, i = !0, n = this;
function r(t, i) {
var r, s = t.split("."), o = n;
!(s[0] in o) && o.execScript && o.execScript("var " + s[0]);
for (;s.length && (r = s.shift()); ) s.length || i === e ? o = o[r] ? o[r] : o[r] = {} : o[r] = i;
}
var s = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array;
function o(t) {
if ("string" == typeof t) {
var e, i, n = t.split("");
e = 0;
for (i = n.length; e < i; e++) n[e] = (255 & n[e].charCodeAt(0)) >>> 0;
t = n;
}
for (var r, s = 1, o = 0, a = t.length, c = 0; 0 < a; ) {
a -= r = 1024 < a ? 1024 : a;
do {
o += s += t[c++];
} while (--r);
s %= 65521;
o %= 65521;
}
return (o << 16 | s) >>> 0;
}
function a(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();
}
a.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 < i; ++t) n[t] = e[t];
return this.buffer = n;
};
a.prototype.d = function(t, e, i) {
var n, r = this.buffer, s = this.index, o = this.i, a = r[s];
i && 1 < e && (t = 8 < e ? (f[255 & t] << 24 | f[t >>> 8 & 255] << 16 | f[t >>> 16 & 255] << 8 | f[t >>> 24 & 255]) >> 32 - e : f[t] >> 8 - e);
if (8 > e + o) a = a << e | t, o += e; else for (n = 0; n < e; ++n) a = a << 1 | t >> e - n - 1 & 1, 
8 == ++o && (o = 0, r[s++] = f[a], a = 0, s === r.length && (r = this.f()));
r[s] = a;
this.buffer = r;
this.i = o;
this.index = s;
};
a.prototype.finish = function() {
var t, e = this.buffer, i = this.index;
0 < this.i && (e[i] <<= 8 - this.i, e[i] = f[e[i]], i++);
s ? t = e.subarray(0, i) : (e.length = i, t = e);
return t;
};
var c, l = new (s ? Uint8Array : Array)(256);
for (c = 0; 256 > c; ++c) {
for (var u = _ = c, h = 7, _ = _ >>> 1; _; _ >>>= 1) u <<= 1, u |= 1 & _, --h;
l[c] = (u << h & 255) >>> 0;
}
var f = l;
s && new Uint32Array([ 0, 1996959894, 3993919788, 2567524794, 124634137, 1886057615, 3915621685, 2657392035, 249268274, 2044508324, 3772115230, 2547177864, 162941995, 2125561021, 3887607047, 2428444049, 498536548, 1789927666, 4089016648, 2227061214, 450548861, 1843258603, 4107580753, 2211677639, 325883990, 1684777152, 4251122042, 2321926636, 335633487, 1661365465, 4195302755, 2366115317, 997073096, 1281953886, 3579855332, 2724688242, 1006888145, 1258607687, 3524101629, 2768942443, 901097722, 1119000684, 3686517206, 2898065728, 853044451, 1172266101, 3705015759, 2882616665, 651767980, 1373503546, 3369554304, 3218104598, 565507253, 1454621731, 3485111705, 3099436303, 671266974, 1594198024, 3322730930, 2970347812, 795835527, 1483230225, 3244367275, 3060149565, 1994146192, 31158534, 2563907772, 4023717930, 1907459465, 112637215, 2680153253, 3904427059, 2013776290, 251722036, 2517215374, 3775830040, 2137656763, 141376813, 2439277719, 3865271297, 1802195444, 476864866, 2238001368, 4066508878, 1812370925, 453092731, 2181625025, 4111451223, 1706088902, 314042704, 2344532202, 4240017532, 1658658271, 366619977, 2362670323, 4224994405, 1303535960, 984961486, 2747007092, 3569037538, 1256170817, 1037604311, 2765210733, 3554079995, 1131014506, 879679996, 2909243462, 3663771856, 1141124467, 855842277, 2852801631, 3708648649, 1342533948, 654459306, 3188396048, 3373015174, 1466479909, 544179635, 3110523913, 3462522015, 1591671054, 702138776, 2966460450, 3352799412, 1504918807, 783551873, 3082640443, 3233442989, 3988292384, 2596254646, 62317068, 1957810842, 3939845945, 2647816111, 81470997, 1943803523, 3814918930, 2489596804, 225274430, 2053790376, 3826175755, 2466906013, 167816743, 2097651377, 4027552580, 2265490386, 503444072, 1762050814, 4150417245, 2154129355, 426522225, 1852507879, 4275313526, 2312317920, 282753626, 1742555852, 4189708143, 2394877945, 397917763, 1622183637, 3604390888, 2714866558, 953729732, 1340076626, 3518719985, 2797360999, 1068828381, 1219638859, 3624741850, 2936675148, 906185462, 1090812512, 3747672003, 2825379669, 829329135, 1181335161, 3412177804, 3160834842, 628085408, 1382605366, 3423369109, 3138078467, 570562233, 1426400815, 3317316542, 2998733608, 733239954, 1555261956, 3268935591, 3050360625, 752459403, 1541320221, 2607071920, 3965973030, 1969922972, 40735498, 2617837225, 3943577151, 1913087877, 83908371, 2512341634, 3803740692, 2075208622, 213261112, 2463272603, 3855990285, 2094854071, 198958881, 2262029012, 4057260610, 1759359992, 534414190, 2176718541, 4139329115, 1873836001, 414664567, 2282248934, 4279200368, 1711684554, 285281116, 2405801727, 4167216745, 1634467795, 376229701, 2685067896, 3608007406, 1308918612, 956543938, 2808555105, 3495958263, 1231636301, 1047427035, 2932959818, 3654703836, 1088359270, 936918e3, 2847714899, 3736837829, 1202900863, 817233897, 3183342108, 3401237130, 1404277552, 615818150, 3134207493, 3453421203, 1423857449, 601450431, 3009837614, 3294710456, 1567103746, 711928724, 3020668471, 3272380065, 1510334235, 755167117 ]);
function d(t) {
this.buffer = new (s ? Uint16Array : Array)(2 * t);
this.length = 0;
}
d.prototype.getParent = function(t) {
return 2 * ((t - 2) / 4 | 0);
};
d.prototype.push = function(t, e) {
var i, n, r, s = this.buffer;
i = this.length;
s[this.length++] = e;
for (s[this.length++] = t; 0 < i && (n = this.getParent(i), s[i] > s[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;
e = s[0];
t = s[1];
this.length -= 2;
s[0] = s[this.length];
s[1] = s[this.length + 1];
for (r = 0; !((n = 2 * r + 2) >= this.length); ) {
n + 2 < this.length && s[n + 2] > s[n] && (n += 2);
if (!(s[n] > s[r])) break;
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
};
};
function p(t) {
var e, i, n, r, o, a, c, l, u, h = t.length, _ = 0, f = Number.POSITIVE_INFINITY;
for (l = 0; l < h; ++l) t[l] > _ && (_ = t[l]), t[l] < f && (f = t[l]);
e = 1 << _;
i = new (s ? Uint32Array : Array)(e);
n = 1;
r = 0;
for (o = 2; n <= _; ) {
for (l = 0; l < h; ++l) if (t[l] === n) {
a = 0;
c = r;
for (u = 0; u < n; ++u) a = a << 1 | 1 & c, c >>= 1;
for (u = a; u < e; u += o) i[u] = n << 16 | l;
++r;
}
++n;
r <<= 1;
o <<= 1;
}
return [ i, _, f ];
}
function m(t, e) {
this.h = v;
this.w = 0;
this.input = t;
this.b = 0;
e && (e.lazy && (this.w = e.lazy), "number" == typeof e.compressionType && (this.h = e.compressionType), 
e.outputBuffer && (this.a = s && e.outputBuffer instanceof Array ? new Uint8Array(e.outputBuffer) : e.outputBuffer), 
"number" == typeof e.outputIndex && (this.b = e.outputIndex));
this.a || (this.a = new (s ? Uint8Array : Array)(32768));
}
var y, v = 2, g = {
NONE: 0,
r: 1,
j: v,
N: 3
}, b = [];
for (y = 0; 288 > y; y++) switch (i) {
case 143 >= y:
b.push([ y + 48, 8 ]);
break;

case 255 >= y:
b.push([ y - 144 + 400, 9 ]);
break;

case 279 >= y:
b.push([ y - 256 + 0, 7 ]);
break;

case 287 >= y:
b.push([ y - 280 + 192, 8 ]);
break;

default:
t("invalid literal: " + y);
}
m.prototype.n = function() {
var n, r, o, c, l = this.input;
switch (this.h) {
case 0:
o = 0;
for (c = l.length; o < c; ) {
var u, h, _, f = r = s ? l.subarray(o, o + 65535) : l.slice(o, o + 65535), d = (o += r.length) === c, p = e, m = e, y = this.a, g = this.b;
if (s) {
for (y = new Uint8Array(this.a.buffer); y.length <= g + f.length + 5; ) y = new Uint8Array(y.length << 1);
y.set(this.a);
}
u = d ? 1 : 0;
y[g++] = 0 | u;
_ = 65536 + ~(h = f.length) & 65535;
y[g++] = 255 & h;
y[g++] = h >>> 8 & 255;
y[g++] = 255 & _;
y[g++] = _ >>> 8 & 255;
if (s) y.set(f, g), g += f.length, y = y.subarray(0, g); else {
p = 0;
for (m = f.length; p < m; ++p) y[g++] = f[p];
y.length = g;
}
this.b = g;
this.a = y;
}
break;

case 1:
var C = new a(new Uint8Array(this.a.buffer), this.b);
C.d(1, 1, i);
C.d(1, 2, i);
var x, A, S, T = E(this, l);
x = 0;
for (A = T.length; x < A; x++) if (S = T[x], a.prototype.d.apply(C, b[S]), 256 < S) C.d(T[++x], T[++x], i), 
C.d(T[++x], 5), C.d(T[++x], T[++x], i); else if (256 === S) break;
this.a = C.finish();
this.b = this.a.length;
break;

case v:
var w, I, D, P, R, L, O, V, N, F, z, k, G, U, H, j = new a(new Uint8Array(this.a), this.b), W = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], q = Array(19);
w = v;
j.d(1, 1, i);
j.d(w, 2, i);
I = E(this, l);
O = B(L = M(this.L, 15));
N = B(V = M(this.K, 7));
for (D = 286; 257 < D && 0 === L[D - 1]; D--) ;
for (P = 30; 1 < P && 0 === V[P - 1]; P--) ;
var X, Y, J, Z, K, Q, $ = D, tt = P, et = new (s ? Uint32Array : Array)($ + tt), it = new (s ? Uint32Array : Array)(316), nt = new (s ? Uint8Array : Array)(19);
for (X = Y = 0; X < $; X++) et[Y++] = L[X];
for (X = 0; X < tt; X++) et[Y++] = V[X];
if (!s) {
X = 0;
for (Z = nt.length; X < Z; ++X) nt[X] = 0;
}
X = K = 0;
for (Z = et.length; X < Z; X += Y) {
for (Y = 1; X + Y < Z && et[X + Y] === et[X]; ++Y) ;
J = Y;
if (0 === et[X]) if (3 > J) for (;0 < J--; ) it[K++] = 0, nt[0]++; else for (;0 < J; ) (Q = 138 > J ? J : 138) > J - 3 && Q < J && (Q = J - 3), 
10 >= 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[X], nt[et[X]]++, 3 > --J) for (;0 < J--; ) it[K++] = et[X], 
nt[et[X]]++; else for (;0 < J; ) (Q = 6 > J ? J : 6) > J - 3 && Q < J && (Q = J - 3), 
it[K++] = 16, it[K++] = Q - 3, nt[16]++, J -= Q;
}
n = s ? it.subarray(0, K) : it.slice(0, K);
F = M(nt, 7);
for (U = 0; 19 > U; U++) q[U] = F[W[U]];
for (R = 19; 4 < R && 0 === q[R - 1]; R--) ;
z = B(F);
j.d(D - 257, 5, i);
j.d(P - 1, 5, i);
j.d(R - 4, 4, i);
for (U = 0; U < R; U++) j.d(q[U], 3, i);
U = 0;
for (H = n.length; U < H; U++) if (k = n[U], j.d(z[k], F[k], i), 16 <= k) {
U++;
switch (k) {
case 16:
G = 2;
break;

case 17:
G = 3;
break;

case 18:
G = 7;
break;

default:
t("invalid code: " + k);
}
j.d(n[U], G, i);
}
var rt, st, ot, at, ct, lt, ut, ht, _t = [ O, L ], ft = [ N, V ];
ct = _t[0];
lt = _t[1];
ut = ft[0];
ht = ft[1];
rt = 0;
for (st = I.length; rt < st; ++rt) if (ot = I[rt], j.d(ct[ot], lt[ot], i), 256 < ot) j.d(I[++rt], I[++rt], i), 
at = I[++rt], j.d(ut[at], ht[at], i), j.d(I[++rt], I[++rt], i); else if (256 === ot) break;
this.a = j.finish();
this.b = this.a.length;
break;

default:
t("invalid compression type");
}
return this.a;
};
function C(t, e) {
this.length = t;
this.G = e;
}
function x() {
var e = A;
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);
}
}
var A, S, T = [];
for (A = 3; 258 >= A; A++) S = x(), T[A] = S[2] << 24 | S[1] << 16 | S[0];
var w = s ? new Uint32Array(T) : T;
function E(n, r) {
function o(e, n) {
var r, s, o, a, c = e.G, l = [], u = 0;
r = w[e.length];
l[u++] = 65535 & r;
l[u++] = r >> 16 & 255;
l[u++] = r >> 24;
switch (i) {
case 1 === c:
s = [ 0, c - 1, 0 ];
break;

case 2 === c:
s = [ 1, c - 2, 0 ];
break;

case 3 === c:
s = [ 2, c - 3, 0 ];
break;

case 4 === c:
s = [ 3, c - 4, 0 ];
break;

case 6 >= c:
s = [ 4, c - 5, 1 ];
break;

case 8 >= c:
s = [ 5, c - 7, 1 ];
break;

case 12 >= c:
s = [ 6, c - 9, 2 ];
break;

case 16 >= c:
s = [ 7, c - 13, 2 ];
break;

case 24 >= c:
s = [ 8, c - 17, 3 ];
break;

case 32 >= c:
s = [ 9, c - 25, 3 ];
break;

case 48 >= c:
s = [ 10, c - 33, 4 ];
break;

case 64 >= c:
s = [ 11, c - 49, 4 ];
break;

case 96 >= c:
s = [ 12, c - 65, 5 ];
break;

case 128 >= c:
s = [ 13, c - 97, 5 ];
break;

case 192 >= c:
s = [ 14, c - 129, 6 ];
break;

case 256 >= c:
s = [ 15, c - 193, 6 ];
break;

case 384 >= c:
s = [ 16, c - 257, 7 ];
break;

case 512 >= c:
s = [ 17, c - 385, 7 ];
break;

case 768 >= c:
s = [ 18, c - 513, 8 ];
break;

case 1024 >= c:
s = [ 19, c - 769, 8 ];
break;

case 1536 >= c:
s = [ 20, c - 1025, 9 ];
break;

case 2048 >= c:
s = [ 21, c - 1537, 9 ];
break;

case 3072 >= c:
s = [ 22, c - 2049, 10 ];
break;

case 4096 >= c:
s = [ 23, c - 3073, 10 ];
break;

case 6144 >= c:
s = [ 24, c - 4097, 11 ];
break;

case 8192 >= c:
s = [ 25, c - 6145, 11 ];
break;

case 12288 >= c:
s = [ 26, c - 8193, 12 ];
break;

case 16384 >= c:
s = [ 27, c - 12289, 12 ];
break;

case 24576 >= c:
s = [ 28, c - 16385, 13 ];
break;

case 32768 >= c:
s = [ 29, c - 24577, 13 ];
break;

default:
t("invalid distance");
}
r = s;
l[u++] = r[0];
l[u++] = r[1];
l[u++] = r[2];
o = 0;
for (a = l.length; o < a; ++o) y[v++] = l[o];
b[l[0]]++;
x[l[3]]++;
g = e.length + n - 1;
d = null;
}
var a, c, l, u, h, _, f, d, p, m = {}, y = s ? new Uint16Array(2 * r.length) : [], v = 0, g = 0, b = new (s ? Uint32Array : Array)(286), x = new (s ? Uint32Array : Array)(30), A = n.w;
if (!s) {
for (l = 0; 285 >= l; ) b[l++] = 0;
for (l = 0; 29 >= l; ) x[l++] = 0;
}
b[256] = 1;
a = 0;
for (c = r.length; a < c; ++a) {
l = h = 0;
for (u = 3; l < u && a + l !== c; ++l) h = h << 8 | r[a + l];
m[h] === e && (m[h] = []);
_ = m[h];
if (!(0 < g--)) {
for (;0 < _.length && 32768 < a - _[0]; ) _.shift();
if (a + 3 >= c) {
d && o(d, -1);
l = 0;
for (u = c - a; l < u; ++l) p = r[a + l], y[v++] = p, ++b[p];
break;
}
if (0 < _.length) {
var S = e, T = e, E = 0, M = e, B = e, I = e, D = r.length, P = (B = 0, _.length);
t: for (;B < P; B++) {
S = _[P - B - 1];
M = 3;
if (3 < E) {
for (I = E; 3 < I; I--) if (r[S + I - 1] !== r[a + I - 1]) continue t;
M = E;
}
for (;258 > M && a + M < D && r[S + M] === r[a + M]; ) ++M;
M > E && (T = S, E = M);
if (258 === M) break;
}
f = new C(E, a - T);
d ? d.length < f.length ? (p = r[a - 1], y[v++] = p, ++b[p], o(f, 0)) : o(d, -1) : f.length < A ? d = f : o(f, 0);
} else d ? o(d, -1) : (p = r[a], y[v++] = p, ++b[p]);
}
_.push(a);
}
y[v++] = 256;
b[256]++;
n.L = b;
n.K = x;
return s ? y.subarray(0, v) : y;
}
function M(t, e) {
function i(t) {
var e = A[t][S[t]];
e === v ? (i(t + 1), i(t + 1)) : --C[e];
++S[t];
}
var n, r, o, a, c, l = t.length, u = new d(572), h = new (s ? Uint8Array : Array)(l);
if (!s) for (a = 0; a < l; a++) h[a] = 0;
for (a = 0; a < l; ++a) 0 < t[a] && u.push(a, t[a]);
n = Array(u.length / 2);
r = new (s ? Uint32Array : Array)(u.length / 2);
if (1 === n.length) return h[u.pop().index] = 1, h;
a = 0;
for (c = u.length / 2; a < c; ++a) n[a] = u.pop(), r[a] = n[a].value;
var _, f, p, m, y, v = r.length, g = new (s ? Uint16Array : Array)(e), b = new (s ? Uint8Array : Array)(e), C = new (s ? Uint8Array : Array)(v), x = Array(e), A = Array(e), S = Array(e), T = (1 << e) - v, w = 1 << e - 1;
g[e - 1] = v;
for (f = 0; f < e; ++f) T < w ? b[f] = 0 : (b[f] = 1, T -= w), T <<= 1, g[e - 2 - f] = (g[e - 1 - f] / 2 | 0) + v;
g[0] = b[0];
x[0] = Array(g[0]);
A[0] = Array(g[0]);
for (f = 1; f < e; ++f) g[f] > 2 * g[f - 1] + b[f] && (g[f] = 2 * g[f - 1] + b[f]), 
x[f] = Array(g[f]), A[f] = Array(g[f]);
for (_ = 0; _ < v; ++_) C[_] = e;
for (p = 0; p < g[e - 1]; ++p) x[e - 1][p] = r[p], A[e - 1][p] = p;
for (_ = 0; _ < e; ++_) S[_] = 0;
1 === b[e - 1] && (--C[0], ++S[e - 1]);
for (f = e - 2; 0 <= f; --f) {
m = _ = 0;
y = S[f + 1];
for (p = 0; p < g[f]; p++) (m = x[f + 1][y] + x[f + 1][y + 1]) > r[_] ? (x[f][p] = m, 
A[f][p] = v, y += 2) : (x[f][p] = r[_], A[f][p] = _, ++_);
S[f] = 0;
1 === b[f] && i(f);
}
o = C;
a = 0;
for (c = n.length; a < c; ++a) h[n[a].index] = o[a];
return h;
}
function B(e) {
var i, n, r, o, a = new (s ? Uint16Array : Array)(e.length), c = [], l = [], u = 0;
i = 0;
for (n = e.length; i < n; i++) c[e[i]] = 1 + (0 | c[e[i]]);
i = 1;
for (n = 16; i <= n; i++) l[i] = u, (u += 0 | c[i]) > 1 << i && t("overcommitted"), 
u <<= 1;
65536 > u && t("undercommitted");
i = 0;
for (n = e.length; i < n; i++) {
u = l[e[i]];
l[e[i]] += 1;
r = a[i] = 0;
for (o = e[i]; r < o; r++) a[i] = a[i] << 1 | 1 & u, u >>>= 1;
}
return a;
}
function I(t, e) {
this.input = t;
this.a = new (s ? Uint8Array : Array)(32768);
this.h = D.j;
var i, n = {};
!e && (e = {}) || "number" != typeof e.compressionType || (this.h = e.compressionType);
for (i in e) n[i] = e[i];
n.outputBuffer = this.a;
this.z = new m(this.input, n);
}
var D = g;
I.prototype.n = function() {
var e, i, n, r, a, c, l, u = 0;
l = this.a;
switch (e = ut) {
case ut:
i = Math.LOG2E * Math.log(32768) - 8;
break;

default:
t(Error("invalid compression method"));
}
n = i << 4 | e;
l[u++] = n;
switch (e) {
case ut:
switch (this.h) {
case D.NONE:
a = 0;
break;

case D.r:
a = 1;
break;

case D.j:
a = 2;
break;

default:
t(Error("unsupported compression type"));
}
break;

default:
t(Error("invalid compression method"));
}
r = a << 6 | 0;
l[u++] = r | 31 - (256 * n + r) % 31;
c = o(this.input);
this.z.b = u;
u = (l = this.z.n()).length;
s && ((l = new Uint8Array(l.buffer)).length <= u + 4 && (this.a = new Uint8Array(l.length + 4), 
this.a.set(l), l = this.a), l = l.subarray(0, u + 4));
l[u++] = c >> 24 & 255;
l[u++] = c >> 16 & 255;
l[u++] = c >> 8 & 255;
l[u++] = 255 & c;
return l;
};
r("Zlib.Deflate", I);
r("Zlib.Deflate.compress", (function(t, e) {
return new I(t, e).n();
}));
r("Zlib.Deflate.CompressionType", D);
r("Zlib.Deflate.CompressionType.NONE", D.NONE);
r("Zlib.Deflate.CompressionType.FIXED", D.r);
r("Zlib.Deflate.CompressionType.DYNAMIC", D.j);
function P(e, i) {
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 = L;
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));
switch (this.m) {
case R:
this.b = 32768;
this.a = new (s ? Uint8Array : Array)(32768 + this.l + 258);
break;

case L:
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"));
}
}
var R = 0, L = 1, O = {
D: R,
C: L
};
P.prototype.p = function() {
for (;!this.s; ) {
var n = tt(this, 3);
1 & n && (this.s = i);
switch (n >>>= 1) {
case 0:
var r = this.input, o = this.c, a = this.a, c = this.b, l = e, u = e, h = e, _ = a.length, f = e;
this.e = this.g = 0;
(l = r[o++]) === e && t(Error("invalid uncompressed block header: LEN (first byte)"));
u = l;
(l = r[o++]) === e && t(Error("invalid uncompressed block header: LEN (second byte)"));
u |= l << 8;
(l = r[o++]) === e && t(Error("invalid uncompressed block header: NLEN (first byte)"));
h = l;
(l = r[o++]) === e && t(Error("invalid uncompressed block header: NLEN (second byte)"));
u === ~(h |= l << 8) && t(Error("invalid uncompressed block header: length verify"));
o + u > r.length && t(Error("input buffer is broken"));
switch (this.m) {
case R:
for (;c + u > a.length; ) {
u -= f = _ - c;
if (s) a.set(r.subarray(o, o + f), c), c += f, o += f; else for (;f--; ) a[c++] = r[o++];
this.b = c;
a = this.f();
c = this.b;
}
break;

case L:
for (;c + u > a.length; ) a = this.f({
v: 2
});
break;

default:
t(Error("invalid inflate mode"));
}
if (s) a.set(r.subarray(o, o + u), c), c += u, o += u; else for (;u--; ) a[c++] = r[o++];
this.c = o;
this.b = c;
this.a = a;
break;

case 1:
this.o(K, $);
break;

case 2:
it(this);
break;

default:
t(Error("unknown BTYPE: " + n));
}
}
return this.t();
};
var V, N, F = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], z = s ? new Uint16Array(F) : F, k = [ 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 ], G = s ? new Uint16Array(k) : k, 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, j = [ 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 ], W = s ? new Uint16Array(j) : j, q = [ 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 ], X = s ? new Uint8Array(q) : q, Y = new (s ? Uint8Array : Array)(288);
V = 0;
for (N = Y.length; V < N; ++V) Y[V] = 143 >= V ? 8 : 255 >= V ? 9 : 279 >= V ? 7 : 8;
var J, Z, K = p(Y), Q = new (s ? Uint8Array : Array)(30);
J = 0;
for (Z = Q.length; J < Z; ++J) Q[J] = 5;
var $ = p(Q);
function tt(i, n) {
for (var r, s = i.g, o = i.e, a = i.input, c = i.c; o < n; ) (r = a[c++]) === e && t(Error("input buffer is broken")), 
s |= r << o, o += 8;
r = s & (1 << n) - 1;
i.g = s >>> n;
i.e = o - n;
i.c = c;
return r;
}
function et(i, n) {
for (var r, s, o, a = i.g, c = i.e, l = i.input, u = i.c, h = n[0], _ = n[1]; c < _; ) (r = l[u++]) === e && t(Error("input buffer is broken")), 
a |= r << c, c += 8;
o = (s = h[a & (1 << _) - 1]) >>> 16;
i.g = a >> o;
i.e = c - o;
i.c = u;
return 65535 & s;
}
function it(t) {
function e(t, e, i) {
var n, r, s, o;
for (o = 0; o < t; ) switch (n = et(this, e)) {
case 16:
for (s = 3 + tt(this, 2); s--; ) i[o++] = r;
break;

case 17:
for (s = 3 + tt(this, 3); s--; ) i[o++] = 0;
r = 0;
break;

case 18:
for (s = 11 + tt(this, 7); s--; ) i[o++] = 0;
r = 0;
break;

default:
r = i[o++] = n;
}
return i;
}
var i, n, r, o, a = tt(t, 5) + 257, c = tt(t, 5) + 1, l = tt(t, 4) + 4, u = new (s ? Uint8Array : Array)(z.length);
for (o = 0; o < l; ++o) u[z[o]] = tt(t, 3);
i = p(u);
n = new (s ? Uint8Array : Array)(a);
r = new (s ? Uint8Array : Array)(c);
t.o(p(e.call(t, a, i, n)), p(e.call(t, c, i, r)));
}
P.prototype.o = function(t, e) {
var i = this.a, n = this.b;
this.u = t;
for (var r, s, o, a, c = i.length - 258; 256 !== (r = et(this, t)); ) if (256 > r) n >= c && (this.b = n, 
i = this.f(), n = this.b), i[n++] = r; else {
a = G[s = r - 257];
0 < H[s] && (a += tt(this, H[s]));
r = et(this, e);
o = W[r];
0 < X[r] && (o += tt(this, X[r]));
n >= c && (this.b = n, i = this.f(), n = this.b);
for (;a--; ) i[n] = i[n++ - o];
}
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, o, a, c = i.length; 256 !== (r = et(this, t)); ) if (256 > r) n >= c && (c = (i = this.f()).length), 
i[n++] = r; else {
a = G[s = r - 257];
0 < H[s] && (a += tt(this, H[s]));
r = et(this, e);
o = W[r];
0 < X[r] && (o += tt(this, X[r]));
n + a > c && (c = (i = this.f()).length);
for (;a--; ) i[n] = i[n++ - o];
}
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 {
t = 0;
for (e = i.length; t < e; ++t) i[t] = r[t + 32768];
}
this.k.push(i);
this.q += i.length;
if (s) r.set(r.subarray(n, n + 32768)); else for (t = 0; 32768 > t; ++t) r[t] = r[n + t];
this.b = 32768;
return r;
};
P.prototype.J = function(t) {
var e, i, n, r = this.input.length / this.c + 1 | 0, o = this.input, a = this.a;
t && ("number" == typeof t.v && (r = t.v), "number" == typeof t.F && (r += t.F));
i = 2 > r ? (n = (o.length - this.c) / this.u[2] / 2 * 258 | 0) < a.length ? a.length + n : a.length << 1 : a.length * r;
s ? (e = new Uint8Array(i)).set(a) : e = a;
return this.a = e;
};
P.prototype.t = function() {
var t, e, i, n, r, o = 0, a = this.a, c = this.k, l = new (s ? Uint8Array : Array)(this.q + (this.b - 32768));
if (0 === c.length) return s ? this.a.subarray(32768, this.b) : this.a.slice(32768, this.b);
e = 0;
for (i = c.length; e < i; ++e) {
n = 0;
for (r = (t = c[e]).length; n < r; ++n) l[o++] = t[n];
}
e = 32768;
for (i = this.b; e < i; ++e) l[o++] = a[e];
this.k = [];
return this.buffer = l;
};
P.prototype.H = function() {
var t, e = this.b;
s ? this.B ? (t = new Uint8Array(e)).set(this.a.subarray(0, e)) : t = this.a.subarray(0, e) : (this.a.length > e && (this.a.length = e), 
t = this.a);
return this.buffer = t;
};
function nt(e, i) {
var n, r;
this.input = e;
this.c = 0;
!i && (i = {}) || (i.index && (this.c = i.index), i.verify && (this.M = i.verify));
n = e[this.c++];
r = e[this.c++];
switch (15 & n) {
case ut:
this.method = ut;
break;

default:
t(Error("unsupported compression method"));
}
0 != ((n << 8) + r) % 31 && t(Error("invalid fcheck flag:" + ((n << 8) + r) % 31));
32 & r && t(Error("fdict flag is not supported"));
this.A = new P(e, {
index: this.c,
bufferSize: i.bufferSize,
bufferType: i.bufferType,
resize: i.resize
});
}
nt.prototype.p = function() {
var e, i = this.input;
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 !== o(e) && t(Error("invalid adler-32 checksum"));
return e;
};
r("Zlib.Inflate", nt);
r("Zlib.Inflate.BufferType", O);
O.ADAPTIVE = O.C;
O.BLOCK = O.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, ot = new (s ? Uint8Array : Array)(288);
rt = 0;
for (st = ot.length; rt < st; ++rt) ot[rt] = 143 >= rt ? 8 : 255 >= rt ? 9 : 279 >= rt ? 7 : 8;
p(ot);
var at, ct, lt = new (s ? Uint8Array : Array)(30);
at = 0;
for (ct = lt.length; at < ct; ++at) lt[at] = 5;
p(lt);
var ut = 8;
}).call(window);
var i = window.Zlib;
i.Deflate = i.Deflate;
i.Deflate.compress = i.Deflate.compress;
i.Inflate = i.Inflate;
i.Inflate.BufferType = i.Inflate.BufferType;
i.Inflate.prototype.decompress = i.Inflate.prototype.decompress;
e.exports = i;
}), {} ],
26: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b, C, x, A, S, T = P(t("../../renderer/enums")), w = P(t("../value-types/color")), E = t("../value-types"), M = P(t("../renderer/index")), B = P(t("../platform/CCEnum")), I = P(t("../components/CCComponent")), D = t("../platform/CCClassDecorator");
function P(t) {
return t && t.__esModule ? t : {
default: t
};
}
function R(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function L(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function O(t, e, i) {
e && L(t.prototype, e);
i && L(t, i);
return t;
}
function V(t) {
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t;
}
function N(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
F(t, e);
}
function F(t, e) {
return (F = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
function z(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var k = null;
k = window.renderer.Light;
var G = (0, B.default)({
DIRECTIONAL: 0,
POINT: 1,
SPOT: 2,
AMBIENT: 3
}), U = (0, B.default)({
NONE: 0,
HARD: 2,
SOFT_PCF3X3: 3,
SOFT_PCF5X5: 4
}), H = (n = (0, D.ccclass)("cc.Light"), r = (0, D.menu)("i18n:MAIN_MENU.component.renderers/Light"), 
s = (0, D.inspector)("packages://inspector/inspectors/comps/light.js"), o = (0, 
D.property)({
type: G
}), a = (0, D.property)({
type: U
}), n(c = r(c = (0, D.executeInEditMode)(c = s(c = (l = (S = A = (function(t) {
N(e, t);
function e() {
var e;
R(e = t.call(this) || this, "_type", u, V(e));
R(e, "_color", h, V(e));
R(e, "_intensity", _, V(e));
R(e, "_range", f, V(e));
R(e, "_spotAngle", d, V(e));
R(e, "_spotExp", p, V(e));
R(e, "_shadowType", m, V(e));
R(e, "_shadowResolution", y, V(e));
R(e, "_shadowDarkness", v, V(e));
R(e, "_shadowMinDepth", g, V(e));
R(e, "_shadowMaxDepth", b, V(e));
R(e, "_shadowFrustumSize", C, V(e));
R(e, "_shadowBias", x, V(e));
e._light = new k();
return e;
}
var i = e.prototype;
i.onLoad = function() {
this._light.setNode(this.node);
this.type = this._type;
this.color = this._color;
this.intensity = this._intensity;
this.range = this._range;
this.spotAngle = this._spotAngle;
this.spotExp = this._spotExp;
this.shadowType = this._shadowType;
this.shadowResolution = this._shadowResolution;
this.shadowDarkness = this._shadowDarkness;
this.shadowMaxDepth = this._shadowMaxDepth;
this.shadowFrustumSize = this._shadowFrustumSize;
this.shadowBias = this._shadowBias;
};
i.onEnable = function() {
M.default.scene.addLight(this._light);
};
i.onDisable = function() {
M.default.scene.removeLight(this._light);
};
O(e, [ {
key: "type",
get: function() {
return this._type;
},
set: function(t) {
this._type = t;
var e = T.default.LIGHT_DIRECTIONAL;
t === G.POINT ? e = T.default.LIGHT_POINT : t === G.SPOT ? e = T.default.LIGHT_SPOT : t === G.AMBIENT && (e = T.default.LIGHT_AMBIENT);
this._light.setType(e);
}
}, {
key: "color",
get: function() {
return this._color;
},
set: function(t) {
this._color.equals(t) || this._color.set(t);
this._light.setColor(t.r / 255, t.g / 255, t.b / 255);
}
}, {
key: "intensity",
get: function() {
return this._intensity;
},
set: function(t) {
this._intensity = t;
this._light.setIntensity(t);
}
}, {
key: "range",
get: function() {
return this._range;
},
set: function(t) {
this._range = t;
this._light.setRange(t);
}
}, {
key: "spotAngle",
get: function() {
return this._spotAngle;
},
set: function(t) {
this._spotAngle = t;
this._light.setSpotAngle((0, E.toRadian)(t));
}
}, {
key: "spotExp",
get: function() {
return this._spotExp;
},
set: function(t) {
this._spotExp = t;
this._light.setSpotExp(t);
}
}, {
key: "shadowType",
get: function() {
return this._shadowType;
},
set: function(t) {
this._shadowType = t;
this._light.setShadowType(t);
}
}, {
key: "shadowResolution",
get: function() {
return this._shadowResolution;
},
set: function(t) {
this._shadowResolution = t;
this._light.setShadowResolution(t);
}
}, {
key: "shadowDarkness",
get: function() {
return this._shadowDarkness;
},
set: function(t) {
this._shadowDarkness = t;
this._light.setShadowDarkness(t);
}
}, {
key: "shadowMinDepth",
get: function() {
return this._shadowMinDepth;
},
set: function(t) {
this._shadowMinDepth = t;
this._light.setShadowMinDepth(t);
}
}, {
key: "shadowMaxDepth",
get: function() {
return this._shadowMaxDepth;
},
set: function(t) {
this._shadowMaxDepth = t;
this._light.setShadowMaxDepth(t);
}
}, {
key: "shadowFrustumSize",
get: function() {
return this._shadowFrustumSize;
},
set: function(t) {
this._shadowFrustumSize = t;
this._light.setShadowFrustumSize(t);
}
} ]);
return e;
})(I.default), A.Type = G, A.ShadowType = U, S), u = z(l.prototype, "_type", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return G.DIRECTIONAL;
}
}), h = z(l.prototype, "_color", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return w.default.WHITE;
}
}), _ = z(l.prototype, "_intensity", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), f = z(l.prototype, "_range", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1e3;
}
}), d = z(l.prototype, "_spotAngle", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 60;
}
}), p = z(l.prototype, "_spotExp", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), m = z(l.prototype, "_shadowType", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return U.NONE;
}
}), y = z(l.prototype, "_shadowResolution", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1024;
}
}), v = z(l.prototype, "_shadowDarkness", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return .5;
}
}), g = z(l.prototype, "_shadowMinDepth", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), b = z(l.prototype, "_shadowMaxDepth", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 4096;
}
}), C = z(l.prototype, "_shadowFrustumSize", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1024;
}
}), x = z(l.prototype, "_shadowBias", [ D.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 5e-4;
}
}), z(l.prototype, "type", [ o ], Object.getOwnPropertyDescriptor(l.prototype, "type"), l.prototype), 
z(l.prototype, "color", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "color"), l.prototype), 
z(l.prototype, "intensity", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "intensity"), l.prototype), 
z(l.prototype, "range", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "range"), l.prototype), 
z(l.prototype, "spotAngle", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "spotAngle"), l.prototype), 
z(l.prototype, "spotExp", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "spotExp"), l.prototype), 
z(l.prototype, "shadowType", [ a ], Object.getOwnPropertyDescriptor(l.prototype, "shadowType"), l.prototype), 
z(l.prototype, "shadowResolution", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "shadowResolution"), l.prototype), 
z(l.prototype, "shadowDarkness", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "shadowDarkness"), l.prototype), 
z(l.prototype, "shadowMinDepth", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "shadowMinDepth"), l.prototype), 
z(l.prototype, "shadowMaxDepth", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "shadowMaxDepth"), l.prototype), 
z(l.prototype, "shadowFrustumSize", [ D.property ], Object.getOwnPropertyDescriptor(l.prototype, "shadowFrustumSize"), l.prototype), 
l)) || c) || c) || c) || c);
i.default = H;
cc.Light = H;
e.exports = i.default;
}), {
"../../renderer/enums": 362,
"../../renderer/scene/light": void 0,
"../components/CCComponent": 149,
"../platform/CCClassDecorator": 240,
"../platform/CCEnum": 241,
"../renderer/index": 271,
"../value-types": 337,
"../value-types/color": 336
} ],
27: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.Model",
extends: cc.Asset,
ctor: function() {
this._rootNode = null;
this.loaded = !1;
},
properties: {
_nodes: {
default: []
},
_precomputeJointMatrix: !1,
nodes: {
get: function() {
return this._nodes;
}
},
rootNode: {
get: function() {
return this._rootNode;
}
},
precomputeJointMatrix: {
get: function() {
return this._precomputeJointMatrix;
}
}
},
onLoad: function() {
var t = this._nodes;
this._rootNode = t[0];
for (var e = 0; e < t.length; e++) {
var i = t[e];
i.position = cc.v3.apply(this, i.position);
i.scale = cc.v3.apply(this, i.scale);
i.quat = cc.quat.apply(this, i.quat);
i.uniqueBindPose && (i.uniqueBindPose = cc.mat4.apply(this, i.uniqueBindPose));
var n = i.bindpose;
if (n) for (var r in n) n[r] = cc.mat4.apply(this, n[r]);
var s = i.children;
if (s) for (var o = 0; o < s.length; o++) s[o] = t[s[o]];
}
}
});
cc.Model = e.exports = i;
}), {} ],
28: [ (function(t) {
"use strict";
var e = n(t("../value-types/quat")), i = n(t("../value-types/vec3"));
function n(t) {
return t && t.__esModule ? t : {
default: t
};
}
var r = cc.quat(), s = cc.v3();
cc.Rotate3DTo = cc.Class({
name: "cc.Rotate3DTo",
extends: cc.ActionInterval,
ctor: function(t, e, i, n) {
this._startQuat = cc.quat();
this._dstQuat = cc.quat();
void 0 !== e && this.initWithDuration(t, e, i, n);
},
initWithDuration: function(t, i, n, r) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
var s = this._dstQuat;
if (i instanceof cc.Quat) s.set(i); else {
if (i instanceof cc.Vec3) {
n = i.y;
r = i.z;
i = i.x;
} else {
n = n || 0;
r = r || 0;
}
e.default.fromEuler(s, i, n, r);
}
return !0;
}
return !1;
},
clone: function() {
var t = new cc.Rotate3DTo();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._dstQuat);
return t;
},
startWithTarget: function(t) {
cc.ActionInterval.prototype.startWithTarget.call(this, t);
this._startQuat.set(t.quat);
},
reverse: function() {
cc.logID(1016);
},
update: function(t) {
t = this._computeEaseTime(t);
if (this.target) {
e.default.slerp(r, this._startQuat, this._dstQuat, t);
this.target.setRotation(r);
}
}
});
cc.rotate3DTo = function(t, e, i, n) {
return new cc.Rotate3DTo(t, e, i, n);
};
cc.Rotate3DBy = cc.Class({
name: "cc.Rotate3DBy",
extends: cc.ActionInterval,
ctor: function(t, e, i, n) {
this._startQuat = cc.quat();
this._dstQuat = cc.quat();
this._deltaAngle = cc.v3();
void 0 !== e && this.initWithDuration(t, e, i, n);
},
initWithDuration: function(t, e, n, r) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
if (e instanceof cc.Vec3) {
n = e.y;
r = e.z;
e = e.x;
} else {
n = n || 0;
r = r || 0;
}
i.default.set(this._deltaAngle, e, n, r);
return !0;
}
return !1;
},
clone: function() {
var t = new cc.Rotate3DBy();
this._cloneDecoration(t);
t.initWithDuration(this._duration, this._angle);
return t;
},
startWithTarget: function(t) {
cc.ActionInterval.prototype.startWithTarget.call(this, t);
var i = t.eulerAngles, n = this._deltaAngle;
e.default.fromEuler(this._dstQuat, i.x + n.x, i.y + n.y, i.z + n.z);
this._startQuat.set(t.quat);
},
update: (function() {
Math.PI;
return function(t) {
t = this._computeEaseTime(t);
if (this.target) {
e.default.slerp(r, this._startQuat, this._dstQuat, t);
this.target.setRotation(r);
}
};
})(),
reverse: function() {
var t = this._angle;
s.x = -t.x;
s.y = -t.y;
s.z = -t.z;
var e = new cc.Rotate3DBy(this._duration, s);
this._cloneDecoration(e);
this._reverseEaseList(e);
return e;
}
});
cc.rotate3DBy = function(t, e, i, n) {
return new cc.Rotate3DBy(t, e, i, n);
};
}), {
"../value-types/quat": 340,
"../value-types/vec3": 347
} ],
29: [ (function(t) {
"use strict";
t("./primitive");
t("./physics/exports/physics-builtin");
t("./physics/exports/physics-cannon");
t("./physics/exports/physics-framework");
t("./CCModel");
t("./skeleton/CCSkeleton");
t("./skeleton/CCSkeletonAnimationClip");
t("./actions");
t("./physics/framework/assets/physics-material");
t("./skeleton/CCSkeletonAnimation");
t("./skeleton/CCSkinnedMeshRenderer");
t("./skeleton/skinned-mesh-renderer");
t("./CCLightComponent");
t("./particle/particle-system-3d");
t("./particle/renderer/particle-system-3d-renderer");
}), {
"./CCLightComponent": 26,
"./CCModel": 27,
"./actions": 28,
"./particle/particle-system-3d": 45,
"./particle/renderer/particle-system-3d-renderer": 48,
"./physics/exports/physics-builtin": void 0,
"./physics/exports/physics-cannon": void 0,
"./physics/exports/physics-framework": void 0,
"./physics/framework/assets/physics-material": void 0,
"./primitive": 55,
"./skeleton/CCSkeleton": 64,
"./skeleton/CCSkeletonAnimation": 65,
"./skeleton/CCSkeletonAnimationClip": 66,
"./skeleton/CCSkinnedMeshRenderer": 67,
"./skeleton/skinned-mesh-renderer": 68
} ],
30: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u = t("../../../platform/CCClassDecorator"), h = t("../../../value-types"), _ = (n = t("./gradient-range")) && n.__esModule ? n : {
default: n
};
function f(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function d(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var p = (r = (0, u.ccclass)("cc.ColorOvertimeModule"), s = (0, u.property)({
type: _.default
}), r(o = (c = d((a = (function() {
function t() {
f(this, "enable", c, this);
f(this, "color", l, this);
}
t.prototype.animate = function(t) {
if (this.enable) {
t.color.set(t.startColor);
t.color.multiply(this.color.evaluate(1 - t.remainingLifetime / t.startLifetime, (0, 
h.pseudoRandom)(t.randomSeed + 91041)));
}
};
return t;
})()).prototype, "enable", [ u.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), l = d(a.prototype, "color", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new _.default();
}
}), a)) || o);
i.default = p;
e.exports = i.default;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../value-types": 337,
"./gradient-range": 33
} ],
31: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = i.Mode = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b, C = t("../../../platform/CCClassDecorator"), x = (n = t("../../../platform/CCEnum")) && n.__esModule ? n : {
default: n
}, A = t("../../../value-types"), S = t("../curve");
function T(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function w(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var E = (0, x.default)({
Constant: 0,
Curve: 1,
TwoCurves: 2,
TwoConstants: 3
});
i.Mode = E;
var M = (r = (0, C.ccclass)("cc.CurveRange"), s = (0, C.property)({
type: E
}), o = (0, C.property)({
type: S.AnimationCurve
}), a = (0, C.property)({
type: S.AnimationCurve
}), c = (0, C.property)({
type: S.AnimationCurve
}), r(l = (u = (b = g = (function() {
function t() {
T(this, "mode", h, this);
T(this, "curve", _, this);
T(this, "curveMin", f, this);
T(this, "curveMax", d, this);
T(this, "constant", p, this);
T(this, "constantMin", m, this);
T(this, "constantMax", y, this);
T(this, "multiplier", v, this);
}
var e = t.prototype;
e.evaluate = function(t, e) {
switch (this.mode) {
case E.Constant:
return this.constant;

case E.Curve:
return this.curve.evaluate(t) * this.multiplier;

case E.TwoCurves:
return (0, A.lerp)(this.curveMin.evaluate(t), this.curveMax.evaluate(t), e) * this.multiplier;

case E.TwoConstants:
return (0, A.lerp)(this.constantMin, this.constantMax, e);
}
};
e.getMax = function() {
switch (this.mode) {
case E.Constant:
return this.constant;

case E.Curve:
return this.multiplier;

case E.TwoConstants:
return this.constantMax;

case E.TwoCurves:
return this.multiplier;
}
return 0;
};
return t;
})(), g.Mode = E, b), h = w(u.prototype, "mode", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return E.Constant;
}
}), _ = w(u.prototype, "curve", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new S.AnimationCurve();
}
}), f = w(u.prototype, "curveMin", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new S.AnimationCurve();
}
}), d = w(u.prototype, "curveMax", [ c ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new S.AnimationCurve();
}
}), p = w(u.prototype, "constant", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), m = w(u.prototype, "constantMin", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), y = w(u.prototype, "constantMax", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), v = w(u.prototype, "multiplier", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), u)) || l);
i.default = M;
cc.CurveRange = M;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../platform/CCEnum": 241,
"../../../value-types": 337,
"../curve": 41
} ],
32: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m = t("../../../platform/CCClassDecorator"), y = t("../../../value-types"), v = t("../enum"), g = t("../particle-general-function"), b = (n = t("./curve-range")) && n.__esModule ? n : {
default: n
};
function C(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function x(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var A = cc.v3(), S = (r = (0, m.ccclass)("cc.ForceOvertimeModule"), s = (0, m.property)({
type: v.Space
}), o = (0, m.property)({
type: b.default,
range: [ -1, 1 ]
}), a = (0, m.property)({
type: b.default,
range: [ -1, 1 ]
}), c = (0, m.property)({
type: b.default,
range: [ -1, 1 ],
displayOrder: 4
}), r(l = (h = x((u = (function() {
function t() {
C(this, "enable", h, this);
C(this, "space", _, this);
C(this, "x", f, this);
C(this, "y", d, this);
C(this, "z", p, this);
this.randomized = !1;
this.rotation = null;
this.needTransform = !1;
this.rotation = new y.Quat();
this.needTransform = !1;
}
var e = t.prototype;
e.update = function(t, e) {
this.needTransform = (0, g.calculateTransform)(t, this.space, e, this.rotation);
};
e.animate = function(t, e) {
var i = 1 - t.remainingLifetime / t.startLifetime, n = y.Vec3.set(A, this.x.evaluate(i, (0, 
y.pseudoRandom)(t.randomSeed + 212165)), this.y.evaluate(i, (0, y.pseudoRandom)(t.randomSeed + 212165)), this.z.evaluate(i, (0, 
y.pseudoRandom)(t.randomSeed + 212165)));
this.needTransform && y.Vec3.transformQuat(n, n, this.rotation);
y.Vec3.scaleAndAdd(t.velocity, t.velocity, n, e);
};
return t;
})()).prototype, "enable", [ m.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), _ = x(u.prototype, "space", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return v.Space.Local;
}
}), f = x(u.prototype, "x", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new b.default();
}
}), d = x(u.prototype, "y", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new b.default();
}
}), p = x(u.prototype, "z", [ c ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new b.default();
}
}), u)) || l);
i.default = S;
e.exports = i.default;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../value-types": 337,
"../enum": 43,
"../particle-general-function": 44,
"./curve-range": 31
} ],
33: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b, C = t("../../../platform/CCClassDecorator"), x = (n = t("../../../platform/CCEnum")) && n.__esModule ? n : {
default: n
}, A = t("./gradient");
function S(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function T(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function w(t, e, i) {
e && T(t.prototype, e);
i && T(t, i);
return t;
}
function E(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var M = (0, x.default)({
Color: 0,
Gradient: 1,
TwoColors: 2,
TwoGradients: 3,
RandomColor: 4
}), B = (r = (0, C.ccclass)("cc.GradientRange"), s = (0, C.property)({
type: M
}), o = (0, C.property)({
type: A.Gradient
}), a = (0, C.property)({
type: A.Gradient
}), c = (0, C.property)({
type: A.Gradient
}), r(l = (u = (b = g = (function() {
function t() {
S(this, "_mode", h, this);
S(this, "_color", _, this);
S(this, "color", f, this);
S(this, "colorMin", d, this);
S(this, "colorMax", p, this);
S(this, "gradient", m, this);
S(this, "gradientMin", y, this);
S(this, "gradientMax", v, this);
}
t.prototype.evaluate = function(t, e) {
switch (this._mode) {
case M.Color:
return this.color;

case M.TwoColors:
this.colorMin.lerp(this.colorMax, e, this._color);
return this._color;

case M.RandomColor:
return this.gradient.randomColor();

case M.Gradient:
return this.gradient.evaluate(t);

case M.TwoGradients:
this.gradientMin.evaluate(t).lerp(this.gradientMax.evaluate(t), e, this._color);
return this._color;

default:
return this.color;
}
};
w(t, [ {
key: "mode",
get: function() {
return this._mode;
},
set: function(t) {
this._mode = t;
}
} ]);
return t;
})(), g.Mode = M, b), h = E(u.prototype, "_mode", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return M.Color;
}
}), E(u.prototype, "mode", [ s ], Object.getOwnPropertyDescriptor(u.prototype, "mode"), u.prototype), 
_ = E(u.prototype, "_color", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return cc.Color.WHITE.clone();
}
}), f = E(u.prototype, "color", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return cc.Color.WHITE.clone();
}
}), d = E(u.prototype, "colorMin", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return cc.Color.WHITE.clone();
}
}), p = E(u.prototype, "colorMax", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return cc.Color.WHITE.clone();
}
}), m = E(u.prototype, "gradient", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new A.Gradient();
}
}), y = E(u.prototype, "gradientMin", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new A.Gradient();
}
}), v = E(u.prototype, "gradientMax", [ c ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new A.Gradient();
}
}), u)) || l);
i.default = B;
cc.GradientRange = B;
e.exports = i.default;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../platform/CCEnum": 241,
"./gradient": 34
} ],
34: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.Gradient = i.AlphaKey = i.ColorKey = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b, C, x, A = t("../../../platform/CCClassDecorator"), S = (n = t("../../../platform/CCEnum")) && n.__esModule ? n : {
default: n
}, T = t("../../../value-types");
function w(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function E(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var M = (0, S.default)({
Blend: 0,
Fixed: 1
}), B = (0, A.ccclass)("cc.ColorKey")(r = (o = E((s = function() {
w(this, "color", o, this);
w(this, "time", a, this);
}).prototype, "color", [ A.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return cc.Color.WHITE.clone();
}
}), a = E(s.prototype, "time", [ A.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), s)) || r;
i.ColorKey = B;
var I = (0, A.ccclass)("cc.AlphaKey")(c = (u = E((l = function() {
w(this, "alpha", u, this);
w(this, "time", h, this);
}).prototype, "alpha", [ A.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), h = E(l.prototype, "time", [ A.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), l)) || c;
i.AlphaKey = I;
var D = (_ = (0, A.ccclass)("cc.Gradient"), f = (0, A.property)({
type: [ B ]
}), d = (0, A.property)({
type: [ I ]
}), p = (0, A.property)({
type: M
}), _(m = (y = (x = C = (function() {
function t() {
w(this, "colorKeys", v, this);
w(this, "alphaKeys", g, this);
w(this, "mode", b, this);
this._color = null;
this._color = cc.Color.WHITE.clone();
}
var e = t.prototype;
e.setKeys = function(t, e) {
this.colorKeys = t;
this.alphaKeys = e;
};
e.sortKeys = function() {
this.colorKeys.length > 1 && this.colorKeys.sort((function(t, e) {
return t.time - e.time;
}));
this.alphaKeys.length > 1 && this.alphaKeys.sort((function(t, e) {
return t.time - e.time;
}));
};
e.evaluate = function(t) {
this.getRGB(t);
this._color._fastSetA(this.getAlpha(t));
return this._color;
};
e.randomColor = function() {
var t = this.colorKeys[Math.trunc(Math.random() * this.colorKeys.length)], e = this.alphaKeys[Math.trunc(Math.random() * this.alphaKeys.length)];
this._color.set(t.color);
this._color._fastSetA(e.alpha);
return this._color;
};
e.getRGB = function(t) {
if (!(this.colorKeys.length > 1)) {
if (1 === this.colorKeys.length) {
this._color.set(this.colorKeys[0].color);
return this._color;
}
this._color.set(cc.Color.WHITE);
return this._color;
}
t = (0, T.repeat)(t, 1);
for (var e = 1; e < this.colorKeys.length; ++e) {
var i = this.colorKeys[e - 1].time, n = this.colorKeys[e].time;
if (t >= i && t < n) {
if (this.mode === M.Fixed) return this.colorKeys[e].color;
var r = (t - i) / (n - i);
this.colorKeys[e - 1].color.lerp(this.colorKeys[e].color, r, this._color);
return this._color;
}
}
var s = this.colorKeys.length - 1;
t < this.colorKeys[0].time ? cc.Color.BLACK.lerp(this.colorKeys[0].color, t / this.colorKeys[0].time, this._color) : t > this.colorKeys[s].time && this.colorKeys[s].color.lerp(cc.Color.BLACK, (t - this.colorKeys[s].time) / (1 - this.colorKeys[s].time), this._color);
};
e.getAlpha = function(t) {
if (!(this.alphaKeys.length > 1)) return 1 === this.alphaKeys.length ? this.alphaKeys[0].alpha : 255;
t = (0, T.repeat)(t, 1);
for (var e = 1; e < this.alphaKeys.length; ++e) {
var i = this.alphaKeys[e - 1].time, n = this.alphaKeys[e].time;
if (t >= i && t < n) {
if (this.mode === M.Fixed) return this.alphaKeys[e].alpha;
var r = (t - i) / (n - i);
return (0, T.lerp)(this.alphaKeys[e - 1].alpha, this.alphaKeys[e].alpha, r);
}
}
var s = this.alphaKeys.length - 1;
return t < this.alphaKeys[0].time ? (0, T.lerp)(255, this.alphaKeys[0].alpha, t / this.alphaKeys[0].time) : t > this.alphaKeys[s].time ? (0, 
T.lerp)(this.alphaKeys[s].alpha, 255, (t - this.alphaKeys[s].time) / (1 - this.alphaKeys[s].time)) : void 0;
};
return t;
})(), C.Mode = M, x), v = E(y.prototype, "colorKeys", [ f ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new Array();
}
}), g = E(y.prototype, "alphaKeys", [ d ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new Array();
}
}), b = E(y.prototype, "mode", [ p ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return M.Blend;
}
}), y)) || m);
i.Gradient = D;
cc.ColorKey = B;
cc.AlphaKey = I;
cc.Gradient = D;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../platform/CCEnum": 241,
"../../../value-types": 337
} ],
35: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b = t("../../../platform/CCClassDecorator"), C = t("../../../value-types"), x = t("../enum"), A = (n = t("./curve-range")) && n.__esModule ? n : {
default: n
};
function S(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function T(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var w = cc.v3(), E = cc.v3();
function M(t, e, i) {
var n = Math.sign(t), r = Math.abs(t);
r > e && (r = (0, C.lerp)(r, e, i));
return r * n;
}
var B = (r = (0, b.ccclass)("cc.LimitVelocityOvertimeModule"), s = (0, b.property)({
type: x.Space
}), o = (0, b.property)({
type: A.default,
range: [ -1, 1 ],
visible: function() {
return !this.separateAxes;
}
}), a = (0, b.property)({
type: A.default,
range: [ -1, 1 ],
visible: function() {
return this.separateAxes;
}
}), c = (0, b.property)({
type: A.default,
range: [ -1, 1 ],
visible: function() {
return this.separateAxes;
}
}), l = (0, b.property)({
type: A.default,
range: [ -1, 1 ],
visible: function() {
return this.separateAxes;
}
}), r(u = (_ = T((h = (function() {
function t() {
S(this, "enable", _, this);
S(this, "space", f, this);
S(this, "separateAxes", d, this);
S(this, "limit", p, this);
S(this, "limitX", m, this);
S(this, "limitY", y, this);
S(this, "limitZ", v, this);
S(this, "dampen", g, this);
this.drag = null;
this.multiplyDragByParticleSize = !1;
this.multiplyDragByParticleVelocity = !1;
this.rotation = null;
this.needTransform = !1;
this.rotation = new C.Quat();
this.needTransform = !1;
}
var e = t.prototype;
e.update = function(t, e) {
this.needTransform = calculateTransform(t, this.space, e, this.rotation);
};
e.animate = function(t) {
var e = 1 - t.remainingLifetime / t.startLifetime, i = w;
if (this.separateAxes) {
C.Vec3.set(E, this.limitX.evaluate(e, (0, C.pseudoRandom)(t.randomSeed + 23541)), this.limitY.evaluate(e, (0, 
C.pseudoRandom)(t.randomSeed + 23541)), this.limitZ.evaluate(e, (0, C.pseudoRandom)(t.randomSeed + 23541)));
this.needTransform && C.Vec3.transformQuat(E, E, this.rotation);
C.Vec3.set(i, M(t.ultimateVelocity.x, E.x, this.dampen), M(t.ultimateVelocity.y, E.y, this.dampen), M(t.ultimateVelocity.z, E.z, this.dampen));
} else {
C.Vec3.normalize(i, t.ultimateVelocity);
C.Vec3.scale(i, i, M(t.ultimateVelocity.len(), this.limit.evaluate(e, (0, C.pseudoRandom)(t.randomSeed + 23541)), this.dampen));
}
C.Vec3.copy(t.ultimateVelocity, i);
};
return t;
})()).prototype, "enable", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), f = T(h.prototype, "space", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return x.Space.Local;
}
}), d = T(h.prototype, "separateAxes", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), p = T(h.prototype, "limit", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new A.default();
}
}), m = T(h.prototype, "limitX", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new A.default();
}
}), y = T(h.prototype, "limitY", [ c ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new A.default();
}
}), v = T(h.prototype, "limitZ", [ l ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new A.default();
}
}), g = T(h.prototype, "dampen", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 3;
}
}), h)) || u);
i.default = B;
e.exports = i.default;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../value-types": 337,
"../enum": 43,
"./curve-range": 31
} ],
36: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p = t("../../../platform/CCClassDecorator"), m = t("../../../value-types"), y = (n = t("./curve-range")) && n.__esModule ? n : {
default: n
};
function v(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function g(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function b(t, e, i) {
e && g(t.prototype, e);
i && g(t, i);
return t;
}
function C(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var x = (r = (0, p.ccclass)("cc.RotationOvertimeModule"), s = (0, p.property)({
type: y.default,
range: [ -1, 1 ],
radian: !0,
visible: function() {
return this._separateAxes;
}
}), o = (0, p.property)({
type: y.default,
range: [ -1, 1 ],
radian: !0,
visible: function() {
return this._separateAxes;
}
}), a = (0, p.property)({
type: y.default,
range: [ -1, 1 ],
radian: !0
}), r(c = (u = C((l = (function() {
function t() {
v(this, "enable", u, this);
v(this, "_separateAxes", h, this);
v(this, "x", _, this);
v(this, "y", f, this);
v(this, "z", d, this);
}
t.prototype.animate = function(t, e) {
var i = 1 - t.remainingLifetime / t.startLifetime;
if (this._separateAxes) {
var n = (0, m.pseudoRandom)(t.randomSeed + 125292);
t.rotation.x += this.x.evaluate(i, n) * e;
t.rotation.y += this.y.evaluate(i, n) * e;
t.rotation.z += this.z.evaluate(i, n) * e;
} else t.rotation.x += this.z.evaluate(i, (0, m.pseudoRandom)(t.randomSeed + 125292)) * e;
};
b(t, [ {
key: "separateAxes",
get: function() {
return this._separateAxes;
},
set: function(t) {
this._separateAxes = t;
}
} ]);
return t;
})()).prototype, "enable", [ p.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), h = C(l.prototype, "_separateAxes", [ p.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), C(l.prototype, "separateAxes", [ p.property ], Object.getOwnPropertyDescriptor(l.prototype, "separateAxes"), l.prototype), 
_ = C(l.prototype, "x", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new y.default();
}
}), f = C(l.prototype, "y", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new y.default();
}
}), d = C(l.prototype, "z", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new y.default();
}
}), l)) || c);
i.default = x;
e.exports = i.default;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../value-types": 337,
"./curve-range": 31
} ],
37: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y = t("../../../platform/CCClassDecorator"), v = t("../../../value-types"), g = (n = t("./curve-range")) && n.__esModule ? n : {
default: n
};
function b(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function C(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var x = (r = (0, y.ccclass)("cc.SizeOvertimeModule"), s = (0, y.property)({
type: g.default,
visible: function() {
return !this.separateAxes;
}
}), o = (0, y.property)({
type: g.default,
visible: function() {
return this.separateAxes;
}
}), a = (0, y.property)({
type: g.default,
visible: function() {
return this.separateAxes;
}
}), c = (0, y.property)({
type: g.default,
visible: function() {
return this.separateAxes;
}
}), r(l = (h = C((u = (function() {
function t() {
b(this, "enable", h, this);
b(this, "separateAxes", _, this);
b(this, "size", f, this);
b(this, "x", d, this);
b(this, "y", p, this);
b(this, "z", m, this);
}
t.prototype.animate = function(t) {
if (this.separateAxes) {
var e = 1 - t.remainingLifetime / t.startLifetime, i = (0, v.pseudoRandom)(t.randomSeed + 39825);
t.size.x = t.startSize.x * this.x.evaluate(e, i);
t.size.y = t.startSize.y * this.y.evaluate(e, i);
t.size.z = t.startSize.z * this.z.evaluate(e, i);
} else v.Vec3.scale(t.size, t.startSize, this.size.evaluate(1 - t.remainingLifetime / t.startLifetime, (0, 
v.pseudoRandom)(t.randomSeed + 39825)));
};
return t;
})()).prototype, "enable", [ y.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), _ = C(u.prototype, "separateAxes", [ y.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), f = C(u.prototype, "size", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new g.default();
}
}), d = C(u.prototype, "x", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new g.default();
}
}), p = C(u.prototype, "y", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new g.default();
}
}), m = C(u.prototype, "z", [ c ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new g.default();
}
}), u)) || l);
i.default = x;
e.exports = i.default;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../value-types": 337,
"./curve-range": 31
} ],
38: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b = t("../../../platform/CCClassDecorator"), C = S(t("../../../platform/CCEnum")), x = t("../../../value-types"), A = S(t("./curve-range"));
function S(t) {
return t && t.__esModule ? t : {
default: t
};
}
function T(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function w(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function E(t, e, i) {
e && w(t.prototype, e);
i && w(t, i);
return t;
}
function M(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var B = (0, C.default)({
Grid: 0
}), I = (0, C.default)({
WholeSheet: 0,
SingleRow: 1
}), D = (n = (0, b.ccclass)("cc.TextureAnimationModule"), r = (0, b.property)({
type: B
}), s = (0, b.property)({
type: I
}), o = (0, b.property)({
type: A.default
}), a = (0, b.property)({
type: A.default
}), n(c = (u = M((l = (function() {
function t() {
T(this, "_enable", u, this);
T(this, "_mode", h, this);
T(this, "_numTilesX", _, this);
T(this, "_numTilesY", f, this);
T(this, "animation", d, this);
T(this, "randomRow", p, this);
T(this, "rowIndex", m, this);
T(this, "frameOverTime", y, this);
T(this, "startFrame", v, this);
T(this, "cycleCount", g, this);
this._flipU = 0;
this._flipV = 0;
this._uvChannelMask = -1;
this.ps = null;
}
var e = t.prototype;
e.onInit = function(t) {
this.ps = t;
};
e.init = function(t) {
t.startRow = Math.floor(Math.random() * this.numTilesY);
};
e.animate = function(t) {
var e = 1 - t.remainingLifetime / t.startLifetime, i = this.startFrame.evaluate(e, (0, 
x.pseudoRandom)(t.randomSeed + 90794)) / (this.numTilesX * this.numTilesY);
if (this.animation === I.WholeSheet) t.frameIndex = (0, x.repeat)(this.cycleCount * (this.frameOverTime.evaluate(e, (0, 
x.pseudoRandom)(t.randomSeed + 90794)) + i), 1); else if (this.animation === I.SingleRow) {
var n = 1 / this.numTilesY;
if (this.randomRow) {
var r = (0, x.repeat)(this.cycleCount * (this.frameOverTime.evaluate(e, (0, x.pseudoRandom)(t.randomSeed + 90794)) + i), 1), s = t.startRow * n, o = s + n;
t.frameIndex = (0, x.lerp)(s, o, r);
} else {
var a = this.rowIndex * n, c = a + n;
t.frameIndex = (0, x.lerp)(a, c, (0, x.repeat)(this.cycleCount * (this.frameOverTime.evaluate(e, (0, 
x.pseudoRandom)(t.randomSeed + 90794)) + i), 1));
}
}
};
E(t, [ {
key: "enable",
get: function() {
return this._enable;
},
set: function(t) {
this._enable = t;
this.ps._assembler._updateMaterialParams();
}
}, {
key: "mode",
get: function() {
return this._mode;
},
set: function(t) {
t === B.Grid || console.error("particle texture animation's sprites is not supported!");
}
}, {
key: "numTilesX",
get: function() {
return this._numTilesX;
},
set: function(t) {
if (this._numTilesX !== t) {
this._numTilesX = t;
this.ps && this.ps._assembler && this.ps._assembler._updateMaterialParams();
}
}
}, {
key: "numTilesY",
get: function() {
return this._numTilesY;
},
set: function(t) {
if (this._numTilesY !== t) {
this._numTilesY = t;
this.ps && this.ps._assembler && this.ps._assembler._updateMaterialParams();
}
}
}, {
key: "flipU",
get: function() {
return this._flipU;
},
set: function() {
console.error("particle texture animation's flipU is not supported!");
}
}, {
key: "flipV",
get: function() {
return this._flipV;
},
set: function() {
console.error("particle texture animation's flipV is not supported!");
}
}, {
key: "uvChannelMask",
get: function() {
return this._uvChannelMask;
},
set: function() {
console.error("particle texture animation's uvChannelMask is not supported!");
}
} ]);
return t;
})()).prototype, "_enable", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), M(l.prototype, "enable", [ b.property ], Object.getOwnPropertyDescriptor(l.prototype, "enable"), l.prototype), 
h = M(l.prototype, "_mode", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return B.Grid;
}
}), M(l.prototype, "mode", [ r ], Object.getOwnPropertyDescriptor(l.prototype, "mode"), l.prototype), 
_ = M(l.prototype, "_numTilesX", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), M(l.prototype, "numTilesX", [ b.property ], Object.getOwnPropertyDescriptor(l.prototype, "numTilesX"), l.prototype), 
f = M(l.prototype, "_numTilesY", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), M(l.prototype, "numTilesY", [ b.property ], Object.getOwnPropertyDescriptor(l.prototype, "numTilesY"), l.prototype), 
d = M(l.prototype, "animation", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return I.WholeSheet;
}
}), p = M(l.prototype, "randomRow", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), m = M(l.prototype, "rowIndex", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), y = M(l.prototype, "frameOverTime", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new A.default();
}
}), v = M(l.prototype, "startFrame", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new A.default();
}
}), g = M(l.prototype, "cycleCount", [ b.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), M(l.prototype, "flipU", [ b.property ], Object.getOwnPropertyDescriptor(l.prototype, "flipU"), l.prototype), 
M(l.prototype, "flipV", [ b.property ], Object.getOwnPropertyDescriptor(l.prototype, "flipV"), l.prototype), 
M(l.prototype, "uvChannelMask", [ b.property ], Object.getOwnPropertyDescriptor(l.prototype, "uvChannelMask"), l.prototype), 
l)) || c);
i.default = D;
e.exports = i.default;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../platform/CCEnum": 241,
"../../../value-types": 337,
"./curve-range": 31
} ],
39: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v = t("../../../platform/CCClassDecorator"), g = t("../../../value-types"), b = t("../enum"), C = t("../particle-general-function"), x = (n = t("./curve-range")) && n.__esModule ? n : {
default: n
};
function A(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function S(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var T = cc.v3(), w = (r = (0, v.ccclass)("cc.VelocityOvertimeModule"), s = (0, v.property)({
type: b.Space
}), o = (0, v.property)({
type: x.default,
range: [ -1, 1 ]
}), a = (0, v.property)({
type: x.default,
range: [ -1, 1 ]
}), c = (0, v.property)({
type: x.default,
range: [ -1, 1 ]
}), l = (0, v.property)({
type: x.default,
range: [ -1, 1 ]
}), r(u = (_ = S((h = (function() {
function t() {
A(this, "enable", _, this);
A(this, "space", f, this);
A(this, "x", d, this);
A(this, "y", p, this);
A(this, "z", m, this);
A(this, "speedModifier", y, this);
this.rotation = null;
this.needTransform = !1;
this.rotation = new g.Quat();
this.speedModifier.constant = 1;
this.needTransform = !1;
}
var e = t.prototype;
e.update = function(t, e) {
this.needTransform = (0, C.calculateTransform)(t, this.space, e, this.rotation);
};
e.animate = function(t) {
var e = 1 - t.remainingLifetime / t.startLifetime, i = g.Vec3.set(T, this.x.evaluate(e, (0, 
g.pseudoRandom)(t.randomSeed + 197866)), this.y.evaluate(e, (0, g.pseudoRandom)(t.randomSeed + 197866)), this.z.evaluate(e, (0, 
g.pseudoRandom)(t.randomSeed + 197866)));
this.needTransform && g.Vec3.transformQuat(i, i, this.rotation);
g.Vec3.add(t.animatedVelocity, t.animatedVelocity, i);
g.Vec3.add(t.ultimateVelocity, t.velocity, t.animatedVelocity);
g.Vec3.scale(t.ultimateVelocity, t.ultimateVelocity, this.speedModifier.evaluate(1 - t.remainingLifetime / t.startLifetime, (0, 
g.pseudoRandom)(t.randomSeed + 197866)));
};
return t;
})()).prototype, "enable", [ v.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), f = S(h.prototype, "space", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return b.Space.Local;
}
}), d = S(h.prototype, "x", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new x.default();
}
}), p = S(h.prototype, "y", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new x.default();
}
}), m = S(h.prototype, "z", [ c ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new x.default();
}
}), y = S(h.prototype, "speedModifier", [ l ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new x.default();
}
}), h)) || u);
i.default = w;
e.exports = i.default;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../value-types": 337,
"../enum": 43,
"../particle-general-function": 44,
"./curve-range": 31
} ],
40: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d = t("../../platform/CCClassDecorator"), p = t("../../value-types"), m = (n = t("./animator/curve-range")) && n.__esModule ? n : {
default: n
};
function y(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function v(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function g(t, e, i) {
e && v(t.prototype, e);
i && v(t, i);
return t;
}
function b(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var C = (r = (0, d.ccclass)("cc.Burst"), s = (0, d.property)({
type: m.default
}), r(o = (c = b((a = (function() {
function t() {
y(this, "_time", c, this);
y(this, "minCount", l, this);
y(this, "maxCount", u, this);
y(this, "_repeatCount", h, this);
y(this, "repeatInterval", _, this);
y(this, "count", f, this);
this._remainingCount = 0;
this._curTime = 0;
this._remainingCount = 0;
this._curTime = 0;
}
var e = t.prototype;
e.update = function(t, e) {
if (0 === this._remainingCount) {
this._remainingCount = this._repeatCount;
this._curTime = this._time;
}
if (this._remainingCount > 0) {
var i = (0, p.repeat)(t._time - t.startDelay.evaluate(0, 1), t.duration) - e;
i = i > 0 ? i : 0;
var n = (0, p.repeat)(t.time - t.startDelay.evaluate(0, 1), t.duration);
if (this._curTime >= i && this._curTime < n) {
t.emit(this.count.evaluate(this._curTime / t.duration, 1), e - (n - this._curTime));
this._curTime += this.repeatInterval;
--this._remainingCount;
}
}
};
e.getMaxCount = function(t) {
return this.count.getMax() * Math.min(Math.ceil(t.duration / this.repeatInterval), this.repeatCount);
};
g(t, [ {
key: "time",
get: function() {
return this._time;
},
set: function(t) {
this._time = t;
this._curTime = t;
}
}, {
key: "repeatCount",
get: function() {
return this._repeatCount;
},
set: function(t) {
this._repeatCount = t;
this._remainingCount = t;
}
} ]);
return t;
})()).prototype, "_time", [ d.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), b(a.prototype, "time", [ d.property ], Object.getOwnPropertyDescriptor(a.prototype, "time"), a.prototype), 
l = b(a.prototype, "minCount", [ d.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 30;
}
}), u = b(a.prototype, "maxCount", [ d.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 30;
}
}), h = b(a.prototype, "_repeatCount", [ d.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), b(a.prototype, "repeatCount", [ d.property ], Object.getOwnPropertyDescriptor(a.prototype, "repeatCount"), a.prototype), 
_ = b(a.prototype, "repeatInterval", [ d.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), f = b(a.prototype, "count", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new m.default();
}
}), a)) || o);
i.default = C;
e.exports = i.default;
}), {
"../../platform/CCClassDecorator": 240,
"../../value-types": 337,
"./animator/curve-range": 31
} ],
41: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.evalOptCurve = E;
i.AnimationCurve = i.OptimizedKey = i.Keyframe = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g = (n = t("../../platform/CCEnum")) && n.__esModule ? n : {
default: n
}, b = t("../../value-types"), C = t("../../platform/CCClassDecorator");
function x(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function A(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var S = (0, g.default)({
Default: 0,
Once: 1,
Loop: 2,
PingPong: 3,
ClampForever: 4
}), T = (0, C.ccclass)("cc.Keyframe")(r = (o = A((s = function(t, e, i, n) {
x(this, "time", o, this);
x(this, "value", a, this);
x(this, "inTangent", c, this);
x(this, "outTangent", l, this);
this.time = t || 0;
this.value = e || 0;
this.inTangent = i || 0;
this.outTangent = n || 0;
}).prototype, "time", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), a = A(s.prototype, "value", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), c = A(s.prototype, "inTangent", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), l = A(s.prototype, "outTangent", [ C.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), s)) || r;
i.Keyframe = T;
var w = (function() {
function t() {
this.index = 0;
this.time = 0;
this.endTime = 0;
this.coefficient = null;
this.index = -1;
this.time = 0;
this.endTime = 0;
this.coefficient = new Float32Array(4);
}
t.prototype.evaluate = function(t) {
return E(t - this.time, this.coefficient);
};
return t;
})();
i.OptimizedKey = w;
function E(t, e) {
return t * (t * (t * e[0] + e[1]) + e[2]) + e[3];
}
var M = new T(0, 1, 0, 0), B = new T(1, 1, 0, 0), I = (u = (0, C.ccclass)("cc.AnimationCurve"), 
h = (0, C.property)({
type: [ T ]
}), _ = (0, C.property)({
type: cc.Enum(S),
visible: !1
}), f = (0, C.property)({
type: cc.Enum(S),
visible: !1
}), u(d = (m = A((p = (function() {
function t(t) {
void 0 === t && (t = null);
x(this, "keyFrames", m, this);
x(this, "preWrapMode", y, this);
x(this, "postWrapMode", v, this);
this.cachedKey = null;
if (t) this.keyFrames = t; else {
this.keyFrames.push(M);
this.keyFrames.push(B);
}
this.cachedKey = new w();
}
var e = t.prototype;
e.addKey = function(t) {
null == this.keyFrames && (this.keyFrames = []);
this.keyFrames.push(t);
};
e.evaluate_slow = function(t) {
var e = t, i = t < 0 ? this.preWrapMode : this.postWrapMode, n = this.keyFrames[0].time, r = this.keyFrames[this.keyFrames.length - 1].time;
switch (i) {
case S.Loop:
e = (0, b.repeat)(t - n, r - n) + n;
break;

case S.PingPong:
e = (0, b.pingPong)(t - n, r - n) + n;
break;

case S.ClampForever:
e = (0, b.clamp)(t, n, r);
}
var s = 0;
if (e > this.keyFrames[0].time) if (e >= this.keyFrames[this.keyFrames.length - 1].time) s = this.keyFrames.length - 2; else for (var o = 0; o < this.keyFrames.length - 1; o++) if (e >= this.keyFrames[0].time && e <= this.keyFrames[o + 1].time) {
s = o;
break;
}
var a = this.keyFrames[s], c = this.keyFrames[s + 1], l = (0, b.inverseLerp)(a.time, c.time, e), u = c.time - a.time, h = a.outTangent * u, _ = c.inTangent * u, f = l * l, d = f * l, p = d - 2 * f + l, m = d - f, y = -2 * d + 3 * f;
return (2 * d - 3 * f + 1) * a.value + p * h + m * _ + y * c.value;
};
e.evaluate = function(t) {
var e = t, i = t < 0 ? this.preWrapMode : this.postWrapMode, n = this.keyFrames[0].time, r = this.keyFrames[this.keyFrames.length - 1].time;
switch (i) {
case S.Loop:
e = (0, b.repeat)(t - n, r - n) + n;
break;

case S.PingPong:
e = (0, b.pingPong)(t - n, r - n) + n;
break;

case S.ClampForever:
e = (0, b.clamp)(t, n, r);
}
if (e >= this.cachedKey.time && e < this.cachedKey.endTime) return this.cachedKey.evaluate(e);
var s = this.findIndex(this.cachedKey, e), o = Math.min(s + 1, this.keyFrames.length - 1);
this.calcOptimizedKey(this.cachedKey, s, o);
return this.cachedKey.evaluate(e);
};
e.calcOptimizedKey = function(t, e, i) {
var n = this.keyFrames[e], r = this.keyFrames[i];
t.index = e;
t.time = n.time;
t.endTime = r.time;
var s = r.time - n.time, o = r.value - n.value, a = 1 / (s * s), c = n.outTangent * s, l = r.inTangent * s;
t.coefficient[0] = (c + l - o - o) * a / s;
t.coefficient[1] = (o + o + o - c - c - l) * a;
t.coefficient[2] = n.outTangent;
t.coefficient[3] = n.value;
};
e.findIndex = function(t, e) {
var i = t.index;
if (-1 !== i) if (e > this.keyFrames[i].time) for (var n = 0; n < 3; n++) {
var r = i + n;
if (r + 1 < this.keyFrames.length && this.keyFrames[r + 1].time > e) return r;
} else for (var s = 0; s < 3; s++) {
var o = i - s;
if (o - 1 >= 0 && this.keyFrames[o - 1].time <= e) return o - 1;
}
for (var a, c = 0, l = this.keyFrames.length; l - c > 1; ) {
a = Math.floor((c + l) / 2);
this.keyFrames[a].time >= e ? l = a : c = a;
}
return c;
};
return t;
})()).prototype, "keyFrames", [ h ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new Array();
}
}), y = A(p.prototype, "preWrapMode", [ _ ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return S.ClampForever;
}
}), v = A(p.prototype, "postWrapMode", [ f ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return S.ClampForever;
}
}), p)) || d);
i.AnimationCurve = I;
cc.Keyframe = T;
cc.AnimationCurve = I;
}), {
"../../platform/CCClassDecorator": 240,
"../../platform/CCEnum": 241,
"../../value-types": 337
} ],
42: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b, C, x, A, S, T, w, E, M, B, I = t("../../../platform/CCClassDecorator"), D = t("../../../value-types"), P = (n = t("../animator/curve-range")) && n.__esModule ? n : {
default: n
}, R = t("../particle-general-function"), L = t("../enum");
function O(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function V(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function N(t, e, i) {
e && V(t.prototype, e);
i && V(t, i);
return t;
}
function F(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var z = new D.Vec3(0, 0, 0), k = new Array(), G = new D.Vec3(.5, .5, .5), U = (r = (0, 
I.ccclass)("cc.ShapeModule"), s = (0, I.property)({
type: L.ShapeType
}), o = (0, I.property)({
type: L.EmitLocation
}), a = (0, I.property)({
type: L.ArcMode
}), c = (0, I.property)({
type: P.default
}), r(l = (h = F((u = (function() {
function t() {
O(this, "enable", h, this);
O(this, "_shapeType", _, this);
O(this, "emitFrom", f, this);
O(this, "radius", d, this);
O(this, "radiusThickness", p, this);
O(this, "_angle", m, this);
O(this, "_arc", y, this);
O(this, "arcMode", v, this);
O(this, "arcSpread", g, this);
O(this, "arcSpeed", b, this);
O(this, "length", C, this);
O(this, "boxThickness", x, this);
O(this, "_position", A, this);
O(this, "_rotation", S, this);
O(this, "_scale", T, this);
O(this, "alignToDirection", w, this);
O(this, "randomDirectionAmount", E, this);
O(this, "sphericalDirectionAmount", M, this);
O(this, "randomPositionAmount", B, this);
this.mat = null;
this.Quat = null;
this.particleSystem = null;
this.lastTime = null;
this.totalAngle = null;
this.mat = new D.Mat4();
this.quat = new D.Quat();
this.particleSystem = null;
this.lastTime = 0;
this.totalAngle = 0;
}
var e = t.prototype;
e.onInit = function(t) {
this.particleSystem = t;
this.constructMat();
this.lastTime = this.particleSystem._time;
};
e.constructMat = function() {
D.Quat.fromEuler(this.quat, this._rotation.x, this._rotation.y, this._rotation.z);
D.Mat4.fromRTS(this.mat, this.quat, this._position, this._scale);
};
e.emit = function(t) {
switch (this.shapeType) {
case L.ShapeType.Box:
q(this.emitFrom, this.boxThickness, t.position, t.velocity);
break;

case L.ShapeType.Circle:
X(this.radius, this.radiusThickness, this.generateArcAngle(), t.position, t.velocity);
break;

case L.ShapeType.Cone:
W(this.emitFrom, this.radius, this.radiusThickness, this.generateArcAngle(), this._angle, this.length, t.position, t.velocity);
break;

case L.ShapeType.Sphere:
H(this.emitFrom, this.radius, this.radiusThickness, t.position, t.velocity);
break;

case L.ShapeType.Hemisphere:
j(this.emitFrom, this.radius, this.radiusThickness, t.position, t.velocity);
break;

default:
console.warn(this.shapeType + " shapeType is not supported by ShapeModule.");
}
if (this.randomPositionAmount > 0) {
t.position.x += (0, D.randomRange)(-this.randomPositionAmount, this.randomPositionAmount);
t.position.y += (0, D.randomRange)(-this.randomPositionAmount, this.randomPositionAmount);
t.position.z += (0, D.randomRange)(-this.randomPositionAmount, this.randomPositionAmount);
}
D.Vec3.transformQuat(t.velocity, t.velocity, this.quat);
D.Vec3.transformMat4(t.position, t.position, this.mat);
if (this.sphericalDirectionAmount > 0) {
var e = D.Vec3.normalize(z, t.position);
D.Vec3.lerp(t.velocity, t.velocity, e, this.sphericalDirectionAmount);
}
this.lastTime = this.particleSystem._time;
};
e.generateArcAngle = function() {
if (this.arcMode === L.ArcMode.Random) return (0, D.randomRange)(0, this._arc);
var t = this.totalAngle + 2 * Math.PI * this.arcSpeed.evaluate(this.particleSystem._time, 1) * (this.particleSystem._time - this.lastTime);
this.totalAngle = t;
0 !== this.arcSpread && (t = Math.floor(t / (this._arc * this.arcSpread)) * this._arc * this.arcSpread);
switch (this.arcMode) {
case L.ArcMode.Loop:
return (0, D.repeat)(t, this._arc);

case L.ArcMode.PingPong:
return (0, D.pingPong)(t, this._arc);
}
};
N(t, [ {
key: "shapeType",
get: function() {
return this._shapeType;
},
set: function(t) {
this._shapeType = t;
switch (this._shapeType) {
case L.ShapeType.Box:
this.emitFrom === L.EmitLocation.Base && (this.emitFrom = L.EmitLocation.Volume);
break;

case L.ShapeType.Cone:
this.emitFrom === L.EmitLocation.Edge && (this.emitFrom = L.EmitLocation.Base);
break;

case L.ShapeType.Sphere:
case L.ShapeType.Hemisphere:
this.emitFrom !== L.EmitLocation.Base && this.emitFrom !== L.EmitLocation.Edge || (this.emitFrom = L.EmitLocation.Volume);
}
}
}, {
key: "angle",
get: function() {
return Math.round(100 * (0, D.toDegree)(this._angle)) / 100;
},
set: function(t) {
this._angle = (0, D.toRadian)(t);
}
}, {
key: "arc",
get: function() {
return (0, D.toDegree)(this._arc);
},
set: function(t) {
this._arc = (0, D.toRadian)(t);
}
}, {
key: "position",
get: function() {
return this._position;
},
set: function(t) {
this._position = t;
this.constructMat();
}
}, {
key: "rotation",
get: function() {
return this._rotation;
},
set: function(t) {
this._rotation = t;
this.constructMat();
}
}, {
key: "scale",
get: function() {
return this._scale;
},
set: function(t) {
this._scale = t;
this.constructMat();
}
} ]);
return t;
})()).prototype, "enable", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), _ = F(u.prototype, "_shapeType", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return L.ShapeType.Cone;
}
}), F(u.prototype, "shapeType", [ s ], Object.getOwnPropertyDescriptor(u.prototype, "shapeType"), u.prototype), 
f = F(u.prototype, "emitFrom", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return L.EmitLocation.Volume;
}
}), d = F(u.prototype, "radius", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), p = F(u.prototype, "radiusThickness", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), m = F(u.prototype, "_angle", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return (0, D.toRadian)(25);
}
}), F(u.prototype, "angle", [ I.property ], Object.getOwnPropertyDescriptor(u.prototype, "angle"), u.prototype), 
y = F(u.prototype, "_arc", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return (0, D.toRadian)(360);
}
}), F(u.prototype, "arc", [ I.property ], Object.getOwnPropertyDescriptor(u.prototype, "arc"), u.prototype), 
v = F(u.prototype, "arcMode", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return L.ArcMode.Random;
}
}), g = F(u.prototype, "arcSpread", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), b = F(u.prototype, "arcSpeed", [ c ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new P.default();
}
}), C = F(u.prototype, "length", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 5;
}
}), x = F(u.prototype, "boxThickness", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new D.Vec3(0, 0, 0);
}
}), A = F(u.prototype, "_position", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new D.Vec3(0, 0, 0);
}
}), F(u.prototype, "position", [ I.property ], Object.getOwnPropertyDescriptor(u.prototype, "position"), u.prototype), 
S = F(u.prototype, "_rotation", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new D.Vec3(0, 0, 0);
}
}), F(u.prototype, "rotation", [ I.property ], Object.getOwnPropertyDescriptor(u.prototype, "rotation"), u.prototype), 
T = F(u.prototype, "_scale", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new D.Vec3(1, 1, 1);
}
}), F(u.prototype, "scale", [ I.property ], Object.getOwnPropertyDescriptor(u.prototype, "scale"), u.prototype), 
w = F(u.prototype, "alignToDirection", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), E = F(u.prototype, "randomDirectionAmount", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), M = F(u.prototype, "sphericalDirectionAmount", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), B = F(u.prototype, "randomPositionAmount", [ I.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 0;
}
}), u)) || l);
i.default = U;
function H(t, e, i, n, r) {
switch (t) {
case L.EmitLocation.Volume:
(0, R.randomPointBetweenSphere)(n, e * (1 - i), e);
D.Vec3.copy(r, n);
D.Vec3.normalize(r, r);
break;

case L.EmitLocation.Shell:
(0, R.randomUnitVector)(n);
D.Vec3.scale(n, n, e);
D.Vec3.copy(r, n);
break;

default:
console.warn(t + " is not supported for sphere emitter.");
}
}
function j(t, e, i, n, r) {
switch (t) {
case L.EmitLocation.Volume:
(0, R.randomPointBetweenSphere)(n, e * (1 - i), e);
n.z > 0 && (n.z *= -1);
D.Vec3.copy(r, n);
D.Vec3.normalize(r, r);
break;

case L.EmitLocation.Shell:
(0, R.randomUnitVector)(n);
D.Vec3.scale(n, n, e);
n.z < 0 && (n.z *= -1);
D.Vec3.copy(r, n);
break;

default:
console.warn(t + " is not supported for hemisphere emitter.");
}
}
function W(t, e, i, n, r, s, o, a) {
switch (t) {
case L.EmitLocation.Base:
(0, R.randomPointBetweenCircleAtFixedAngle)(o, e * (1 - i), e, n);
D.Vec2.scale(a, o, Math.sin(r));
a.z = -Math.cos(r) * e;
D.Vec3.normalize(a, a);
o.z = 0;
break;

case L.EmitLocation.Shell:
(0, R.fixedAngleUnitVector2)(o, n);
D.Vec2.scale(a, o, Math.sin(r));
a.z = -Math.cos(r);
D.Vec3.normalize(a, a);
D.Vec2.scale(o, o, e);
o.z = 0;
break;

case L.EmitLocation.Volume:
(0, R.randomPointBetweenCircleAtFixedAngle)(o, e * (1 - i), e, n);
D.Vec2.scale(a, o, Math.sin(r));
a.z = -Math.cos(r) * e;
D.Vec3.normalize(a, a);
o.z = 0;
D.Vec3.add(o, o, D.Vec3.scale(z, a, s * (0, D.random)() / -a.z));
break;

default:
console.warn(t + " is not supported for cone emitter.");
}
}
function q(t, e, i, n) {
switch (t) {
case L.EmitLocation.Volume:
(0, R.randomPointInCube)(i, G);
break;

case L.EmitLocation.Shell:
k.splice(0, k.length);
k.push((0, D.randomRange)(-.5, .5));
k.push((0, D.randomRange)(-.5, .5));
k.push(.5 * (0, R.randomSign)());
(0, R.randomSortArray)(k);
Y(k, e);
D.Vec3.set(i, k[0], k[1], k[2]);
break;

case L.EmitLocation.Edge:
k.splice(0, k.length);
k.push((0, D.randomRange)(-.5, .5));
k.push(.5 * (0, R.randomSign)());
k.push(.5 * (0, R.randomSign)());
(0, R.randomSortArray)(k);
Y(k, e);
D.Vec3.set(i, k[0], k[1], k[2]);
break;

default:
console.warn(t + " is not supported for box emitter.");
}
D.Vec3.copy(n, R.particleEmitZAxis);
}
function X(t, e, i, n, r) {
(0, R.randomPointBetweenCircleAtFixedAngle)(n, t * (1 - e), t, i);
D.Vec3.normalize(r, n);
}
function Y(t, e) {
if (e.x > 0) {
t[0] += .5 * (0, D.randomRange)(-e.x, e.x);
t[0] = (0, D.clamp)(t[0], -.5, .5);
}
if (e.y > 0) {
t[1] += .5 * (0, D.randomRange)(-e.y, e.y);
t[1] = (0, D.clamp)(t[1], -.5, .5);
}
if (e.z > 0) {
t[2] += .5 * (0, D.randomRange)(-e.z, e.z);
t[2] = (0, D.clamp)(t[2], -.5, .5);
}
}
e.exports = i.default;
}), {
"../../../platform/CCClassDecorator": 240,
"../../../value-types": 337,
"../animator/curve-range": 31,
"../enum": 43,
"../particle-general-function": 44
} ],
43: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.TextureMode = i.TrailMode = i.ArcMode = i.EmitLocation = i.ShapeType = i.RenderMode = i.Space = void 0;
var n, r = (n = t("../../platform/CCEnum")) && n.__esModule ? n : {
default: n
}, s = (0, r.default)({
World: 0,
Local: 1,
Custom: 2
});
i.Space = s;
var o = (0, r.default)({
Billboard: 0,
StrecthedBillboard: 1,
HorizontalBillboard: 2,
VerticalBillboard: 3,
Mesh: 4
});
i.RenderMode = o;
var a = (0, r.default)({
Box: 0,
Circle: 1,
Cone: 2,
Sphere: 3,
Hemisphere: 4
});
i.ShapeType = a;
var c = (0, r.default)({
Base: 0,
Edge: 1,
Shell: 2,
Volume: 3
});
i.EmitLocation = c;
var l = (0, r.default)({
Random: 0,
Loop: 1,
PingPong: 2
});
i.ArcMode = l;
var u = (0, r.default)({
Particles: 0,
Ribbon: 1
});
i.TrailMode = u;
var h = (0, r.default)({
Stretch: 0,
Repeat: 1
});
i.TextureMode = h;
}), {
"../../platform/CCEnum": 241
} ],
44: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.calculateTransform = function(t, e, i, r) {
if (e !== t) {
if (t === s.Space.World) n.Mat4.getRotation(r, i); else {
n.Mat4.invert(i, i);
n.Mat4.getRotation(r, i);
}
return !0;
}
n.Quat.set(r, 0, 0, 0, 1);
return !1;
};
i.fixedAngleUnitVector2 = a;
i.randomUnitVector2 = c;
i.randomUnitVector = l;
i.randomPointInUnitSphere = function(t) {
l(t);
n.Vec3.scale(t, t, (0, n.random)());
};
i.randomPointBetweenSphere = function(t, e, i) {
l(t);
n.Vec3.scale(t, t, e + (i - e) * (0, n.random)());
};
i.randomPointInUnitCircle = function(t) {
c(t);
t.z = 0;
n.Vec3.scale(t, t, (0, n.random)());
};
i.randomPointBetweenCircle = function(t, e, i) {
c(t);
t.z = 0;
n.Vec3.scale(t, t, e + (i - e) * (0, n.random)());
};
i.randomPointBetweenCircleAtFixedAngle = function(t, e, i, r) {
a(t, r);
t.z = 0;
n.Vec3.scale(t, t, e + (i - e) * (0, n.random)());
};
i.randomPointInCube = function(t, e) {
n.Vec3.set(t, (0, n.randomRange)(-e.x, e.x), (0, n.randomRange)(-e.y, e.y), (0, 
n.randomRange)(-e.z, e.z));
};
i.randomPointBetweenCube = function(t, e, i) {
for (var r = [ "x", "y", "z" ], s = (0, n.randomRangeInt)(0, 3), o = 0; o < 3; o++) if (o !== s) {
var a = 2 * (0, n.random)() - 1;
t[r[o]] = a < 0 ? -e[r[o]] + a * (i[r[o]] - e[r[o]]) : e[r[o]] + a * (i[r[o]] - e[r[o]]);
} else t[r[o]] = (0, n.randomRange)(-i[r[o]], i[r[o]]);
};
i.randomSortArray = function(t) {
for (var e = 0; e < t.length; e++) {
var i = e + (0, n.randomRangeInt)(0, t.length - e), r = t[i];
t[i] = t[e];
t[e] = r;
}
};
i.randomSign = function() {
var t = (0, n.randomRange)(-1, 1);
0 === t && t++;
return (0, r.sign)(t);
};
i.particleEmitZAxis = void 0;
var n = t("../../value-types"), r = t("../../value-types/utils"), s = t("./enum"), o = new n.Vec3(0, 0, -1);
i.particleEmitZAxis = o;
function a(t, e) {
n.Vec2.set(t, Math.cos(e), Math.sin(e));
}
function c(t) {
var e = (0, n.randomRange)(0, 2 * Math.PI), i = Math.cos(e), r = Math.sin(e);
n.Vec2.set(t, i, r);
}
function l(t) {
var e = (0, n.randomRange)(-1, 1), i = (0, n.randomRange)(0, 2 * Math.PI), r = Math.sqrt(1 - e * e), s = r * Math.cos(i), o = r * Math.sin(i);
n.Vec3.set(t, s, o, e);
}
}), {
"../../value-types": 337,
"../../value-types/utils": 344,
"./enum": 43
} ],
45: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b, C, x, A, S, T, w, E, M, B, I, D, P, R, L, O, V, N, F, z, k, G, U, H, j, W, q, X, Y, J, Z, K, Q, $, tt, et, it, nt, rt, st, ot, at, ct, lt, ut, ht, _t, ft, dt, pt = t("../../value-types"), mt = t("../../value-types/utils"), yt = Lt(t("../../assets/material/CCMaterial")), vt = Lt(t("./animator/color-overtime")), gt = (function(t) {
if (t && t.__esModule) return t;
if (null === t || "object" != typeof t && "function" != typeof t) return {
default: t
};
var e = Rt(void 0);
if (e && e.has(t)) return e.get(t);
var i = {}, n = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var r in t) if ("default" !== r && Object.prototype.hasOwnProperty.call(t, r)) {
var s = n ? Object.getOwnPropertyDescriptor(t, r) : null;
s && (s.get || s.set) ? Object.defineProperty(i, r, s) : i[r] = t[r];
}
i.default = t;
e && e.set(t, i);
return i;
})(t("./animator/curve-range")), bt = Lt(t("./animator/force-overtime")), Ct = Lt(t("./animator/gradient-range")), xt = Lt(t("./animator/limit-velocity-overtime")), At = Lt(t("./animator/rotation-overtime")), St = Lt(t("./animator/size-overtime")), Tt = Lt(t("./animator/texture-animation")), wt = Lt(t("./animator/velocity-overtime")), Et = Lt(t("./burst")), Mt = Lt(t("./emitter/shape-module")), Bt = t("./enum"), It = t("./particle-general-function"), Dt = Lt(t("./renderer/trail")), Pt = Lt(t("../../mesh/CCMesh"));
function Rt(t) {
if ("function" != typeof WeakMap) return null;
var e = new WeakMap(), i = new WeakMap();
return (Rt = function(t) {
return t ? i : e;
})(t);
}
function Lt(t) {
return t && t.__esModule ? t : {
default: t
};
}
function Ot(t, e) {
var i = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
if (i) return (i = i.call(t)).next.bind(i);
if (Array.isArray(t) || (i = Vt(t)) || e && t && "number" == typeof t.length) {
i && (t = i);
var n = 0;
return function() {
return n >= t.length ? {
done: !0
} : {
done: !1,
value: t[n++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function Vt(t, e) {
if (t) {
if ("string" == typeof t) return Nt(t, e);
var i = Object.prototype.toString.call(t).slice(8, -1);
"Object" === i && t.constructor && (i = t.constructor.name);
return "Map" === i || "Set" === i ? Array.from(t) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? Nt(t, e) : void 0;
}
}
function Nt(t, e) {
(null == e || e > t.length) && (e = t.length);
for (var i = 0, n = new Array(e); i < e; i++) n[i] = t[i];
return n;
}
function Ft(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function zt(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function kt(t, e, i) {
e && zt(t.prototype, e);
i && zt(t, i);
return t;
}
function Gt(t) {
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t;
}
function Ut(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
Ht(t, e);
}
function Ht(t, e) {
return (Ht = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
function jt(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var Wt = t("../../platform/CCClassDecorator"), qt = Wt.ccclass, Xt = Wt.menu, Yt = Wt.property, Jt = Wt.executeInEditMode, Zt = Wt.executionOrder, Kt = t("../../components/CCRenderComponent"), Qt = new pt.Mat4(), $t = (n = qt("cc.ParticleSystem3D"), 
r = Xt("i18n:MAIN_MENU.component.renderers/ParticleSystem3D"), s = Zt(99), o = Yt({
animatable: !1
}), a = Yt({
animatable: !1
}), c = Yt({
type: Bt.Space,
animatable: !1
}), l = Yt({
type: gt.default
}), u = Yt({
type: gt.default
}), h = Yt({
type: Ct.default
}), _ = Yt({
type: Bt.Space
}), f = Yt({
type: gt.default
}), d = Yt({
type: gt.default,
range: [ -1, 1 ]
}), p = Yt({
type: gt.default,
range: [ -1, 1 ],
radian: !0
}), m = Yt({
type: gt.default,
range: [ -1, 1 ]
}), y = Yt({
type: gt.default
}), v = Yt({
type: gt.default
}), g = Yt({
type: [ Et.default ],
animatable: !1
}), b = Yt({
type: [ yt.default ],
displayName: "Materials",
visible: !1,
override: !0
}), C = Yt({
type: Mt.default,
animatable: !1
}), x = Yt({
type: vt.default,
animatable: !1
}), A = Yt({
type: St.default,
animatable: !1
}), S = Yt({
type: wt.default,
animatable: !1
}), T = Yt({
type: bt.default,
animatable: !1
}), w = Yt({
type: xt.default,
animatable: !1
}), E = Yt({
type: At.default,
animatable: !1
}), M = Yt({
type: Tt.default,
animatable: !1
}), B = Yt({
type: Dt.default,
animatable: !1
}), I = Yt({
type: Bt.RenderMode,
animatable: !1
}), D = Yt({
animatable: !1
}), P = Yt({
animatable: !1
}), R = Yt({
type: Pt.default,
animatable: !1
}), L = Yt({
type: yt.default,
animatable: !1
}), O = Yt({
type: yt.default,
animatable: !1
}), n(V = r(V = s(V = Jt(V = (F = jt((N = (function(t) {
Ut(e, t);
function e() {
var e;
Ft(e = t.call(this) || this, "duration", F, Gt(e));
Ft(e, "_capacity", z, Gt(e));
Ft(e, "loop", k, Gt(e));
Ft(e, "playOnAwake", G, Gt(e));
Ft(e, "_prewarm", U, Gt(e));
Ft(e, "_simulationSpace", H, Gt(e));
Ft(e, "simulationSpeed", j, Gt(e));
Ft(e, "startDelay", W, Gt(e));
Ft(e, "startLifetime", q, Gt(e));
Ft(e, "startColor", X, Gt(e));
Ft(e, "scaleSpace", Y, Gt(e));
Ft(e, "startSize", J, Gt(e));
Ft(e, "startSpeed", Z, Gt(e));
Ft(e, "startRotation", K, Gt(e));
Ft(e, "gravityModifier", Q, Gt(e));
Ft(e, "rateOverTime", $, Gt(e));
Ft(e, "rateOverDistance", tt, Gt(e));
Ft(e, "bursts", et, Gt(e));
Ft(e, "_shapeModule", it, Gt(e));
Ft(e, "_colorOverLifetimeModule", nt, Gt(e));
Ft(e, "_sizeOvertimeModule", rt, Gt(e));
Ft(e, "_velocityOvertimeModule", st, Gt(e));
Ft(e, "_forceOvertimeModule", ot, Gt(e));
Ft(e, "_limitVelocityOvertimeModule", at, Gt(e));
Ft(e, "_rotationOvertimeModule", ct, Gt(e));
Ft(e, "_textureAnimationModule", lt, Gt(e));
Ft(e, "_trailModule", ut, Gt(e));
Ft(e, "_renderMode", ht, Gt(e));
Ft(e, "_velocityScale", _t, Gt(e));
Ft(e, "_lengthScale", ft, Gt(e));
Ft(e, "_mesh", dt, Gt(e));
e._isPlaying = void 0;
e._isPaused = void 0;
e._isStopped = void 0;
e._isEmitting = void 0;
e._time = void 0;
e._emitRateTimeCounter = void 0;
e._emitRateDistanceCounter = void 0;
e._oldWPos = void 0;
e._curWPos = void 0;
e._customData1 = void 0;
e._customData2 = void 0;
e._subEmitters = void 0;
e.rateOverTime.constant = 10;
e.startLifetime.constant = 5;
e.startSize.constant = 1;
e.startSpeed.constant = 5;
e._isPlaying = !1;
e._isPaused = !1;
e._isStopped = !0;
e._isEmitting = !1;
e._time = 0;
e._emitRateTimeCounter = 0;
e._emitRateDistanceCounter = 0;
e._oldWPos = new pt.Vec3(0, 0, 0);
e._curWPos = new pt.Vec3(0, 0, 0);
e._customData1 = new pt.Vec2(0, 0);
e._customData2 = new pt.Vec2(0, 0);
e._subEmitters = [];
return e;
}
var i = e.prototype;
i.onLoad = function() {
this._assembler.onInit(this);
this.shapeModule.onInit(this);
this.trailModule.onInit(this);
this.textureAnimationModule.onInit(this);
this._resetPosition();
};
i._onMaterialModified = function(t, e) {
this._assembler._onMaterialModified(t, e);
};
i._onRebuildPSO = function(t, e) {
this._assembler._onRebuildPSO(t, e);
};
i.play = function() {
this._isPaused && (this._isPaused = !1);
this._isStopped && (this._isStopped = !1);
this._isPlaying = !0;
this._isEmitting = !0;
this._resetPosition();
this._prewarm && this._prewarmSystem();
};
i.pause = function() {
if (this._isStopped) console.warn("pause(): particle system is already stopped."); else {
this._isPlaying && (this._isPlaying = !1);
this._isPaused = !0;
}
};
i.stop = function() {
(this._isPlaying || this._isPaused) && this.clear();
this._isPlaying && (this._isPlaying = !1);
this._isPaused && (this._isPaused = !1);
this._time = 0;
this._emitRateTimeCounter = 0;
this._emitRateDistanceCounter = 0;
this._isStopped = !0;
};
i.clear = function() {
if (this.enabledInHierarchy) {
this._assembler.clear();
this.trailModule.clear();
}
};
i.getParticleCount = function() {
return this._assembler.getParticleCount();
};
i.setCustomData1 = function(t, e) {
pt.Vec2.set(this._customData1, t, e);
};
i.setCustomData2 = function(t, e) {
pt.Vec2.set(this._customData2, t, e);
};
i.onDestroy = function() {
this._assembler.onDestroy();
this.trailModule.destroy();
};
i.onEnable = function() {
t.prototype.onEnable.call(this);
this.playOnAwake && this.play();
this._assembler.onEnable();
this.trailModule.onEnable();
};
i.onDisable = function() {
t.prototype.onDisable.call(this);
this._assembler.onDisable();
this.trailModule.onDisable();
};
i.update = function(t) {
var e = t * this.simulationSpeed;
if (this._isPlaying) {
this._time += e;
this._emit(e);
0 !== this._assembler._updateParticles(e) || this._isEmitting || this.stop();
this._assembler.updateParticleBuffer();
this.trailModule.enable && this.trailModule.updateTrailBuffer();
}
};
i.emit = function(t, e) {
this._simulationSpace === Bt.Space.World && this.node.getWorldMatrix(Qt);
for (var i = 0; i < t; ++i) {
var n = this._assembler._getFreeParticle();
if (null === n) return;
var r = (0, pt.pseudoRandom)((0, pt.randomRangeInt)(0, mt.INT_MAX));
if (this.shapeModule.enable) this.shapeModule.emit(n); else {
pt.Vec3.set(n.position, 0, 0, 0);
pt.Vec3.copy(n.velocity, It.particleEmitZAxis);
}
this.textureAnimationModule.enable && this.textureAnimationModule.init(n);
pt.Vec3.scale(n.velocity, n.velocity, this.startSpeed.evaluate(this._time / this.duration, r));
switch (this._simulationSpace) {
case Bt.Space.Local:
break;

case Bt.Space.World:
pt.Vec3.transformMat4(n.position, n.position, Qt);
var s = new pt.Quat();
this.node.getWorldRotation(s);
pt.Vec3.transformQuat(n.velocity, n.velocity, s);
break;

case Bt.Space.Custom:
}
pt.Vec3.copy(n.ultimateVelocity, n.velocity);
pt.Vec3.set(n.rotation, 0, 0, this.startRotation.evaluate(this._time / this.duration, r));
pt.Vec3.set(n.startSize, this.startSize.evaluate(this._time / this.duration, r), 1, 1);
n.startSize.y = n.startSize.x;
pt.Vec3.copy(n.size, n.startSize);
n.startColor.set(this.startColor.evaluate(this._time / this.duration, r));
n.color.set(n.startColor);
n.startLifetime = this.startLifetime.evaluate(this._time / this.duration, r) + e;
n.remainingLifetime = n.startLifetime;
n.randomSeed = (0, pt.randomRangeInt)(0, 233280);
this._assembler._setNewParticle(n);
}
};
i._prewarmSystem = function() {
this.startDelay.mode = gt.Mode.Constant;
this.startDelay.constant = 0;
for (var t = this.duration / 1, e = 0; e < t; ++e) {
this._time += 1;
this._emit(1);
this._assembler._updateParticles(1);
}
};
i._emit = function(t) {
var e = this.startDelay.evaluate(0, 1);
if (this._time > e) {
if (this._time > this.duration + e && !this.loop) {
this._isEmitting = !1;
return;
}
this._emitRateTimeCounter += this.rateOverTime.evaluate(this._time / this.duration, 1) * t;
if (this._emitRateTimeCounter > 1 && this._isEmitting) {
var i = Math.floor(this._emitRateTimeCounter);
this._emitRateTimeCounter -= i;
this.emit(i, t);
}
this.node.getWorldPosition(this._curWPos);
var n = pt.Vec3.distance(this._curWPos, this._oldWPos);
pt.Vec3.copy(this._oldWPos, this._curWPos);
this._emitRateDistanceCounter += n * this.rateOverDistance.evaluate(this._time / this.duration, 1);
if (this._emitRateDistanceCounter > 1 && this._isEmitting) {
var r = Math.floor(this._emitRateDistanceCounter);
this._emitRateDistanceCounter -= r;
this.emit(r, t);
}
for (var s, o = Ot(this.bursts); !(s = o()).done; ) s.value.update(this, t);
}
};
i._activateMaterial = function() {};
i._resetPosition = function() {
this.node.getWorldPosition(this._oldWPos);
pt.Vec3.copy(this._curWPos, this._oldWPos);
};
i.addSubEmitter = function(t) {
this._subEmitters.push(t);
};
i.removeSubEmitter = function(t) {
this._subEmitters.splice(this._subEmitters.indexOf(t), 1);
};
i.addBurst = function(t) {
this.bursts.push(t);
};
i.removeBurst = function(t) {
this.bursts.splice(this.bursts.indexOf(t), 1);
};
i._checkBacth = function() {};
kt(e, [ {
key: "capacity",
get: function() {
return this._capacity;
},
set: function(t) {
this._capacity = t;
this._assembler && this._assembler.setCapacity(this._capacity);
}
}, {
key: "prewarm",
get: function() {
return this._prewarm;
},
set: function(t) {
!0 === t && this.loop;
this._prewarm = t;
}
}, {
key: "simulationSpace",
get: function() {
return this._simulationSpace;
},
set: function(t) {
if (t !== this._simulationSpace) {
this._simulationSpace = t;
this._assembler._updateMaterialParams();
this._assembler._updateTrailMaterial();
}
}
}, {
key: "materials",
get: function() {
return this._materials;
},
set: function(t) {
this._materials = t;
this._activateMaterial();
}
}, {
key: "shapeModule",
get: function() {
return this._shapeModule;
},
set: function(t) {
this._shapeModule = t;
this._shapeModule.onInit(this);
}
}, {
key: "colorOverLifetimeModule",
get: function() {
return this._colorOverLifetimeModule;
},
set: function(t) {
this._colorOverLifetimeModule = t;
}
}, {
key: "sizeOvertimeModule",
get: function() {
return this._sizeOvertimeModule;
},
set: function(t) {
this._sizeOvertimeModule = t;
}
}, {
key: "velocityOvertimeModule",
get: function() {
return this._velocityOvertimeModule;
},
set: function(t) {
this._velocityOvertimeModule = t;
}
}, {
key: "forceOvertimeModule",
get: function() {
return this._forceOvertimeModule;
},
set: function(t) {
this._forceOvertimeModule = t;
}
}, {
key: "limitVelocityOvertimeModule",
get: function() {
return this._limitVelocityOvertimeModule;
},
set: function(t) {
this._limitVelocityOvertimeModule = t;
}
}, {
key: "rotationOvertimeModule",
get: function() {
return this._rotationOvertimeModule;
},
set: function(t) {
this._rotationOvertimeModule = t;
}
}, {
key: "textureAnimationModule",
get: function() {
return this._textureAnimationModule;
},
set: function(t) {
this._textureAnimationModule = t;
this._textureAnimationModule.onInit(this);
}
}, {
key: "trailModule",
get: function() {
return this._trailModule;
},
set: function(t) {
this._trailModule = t;
this._trailModule.onInit(this);
}
}, {
key: "renderMode",
get: function() {
return this._renderMode;
},
set: function(t) {
if (this._renderMode !== t) {
this._renderMode = t;
this._assembler._setVertexAttrib();
this._assembler._updateModel();
this._assembler._updateMaterialParams();
}
}
}, {
key: "velocityScale",
get: function() {
return this._velocityScale;
},
set: function(t) {
this._velocityScale = t;
this._assembler._updateMaterialParams();
}
}, {
key: "lengthScale",
get: function() {
return this._lengthScale;
},
set: function(t) {
this._lengthScale = t;
this._assembler._updateMaterialParams();
}
}, {
key: "mesh",
get: function() {
return this._mesh;
},
set: function(t) {
this._mesh = t;
this._assembler._updateModel();
}
}, {
key: "particleMaterial",
get: function() {
return this.getMaterial(0);
},
set: function(t) {
this.setMaterial(0, t);
this._onMaterialModified(0, t);
}
}, {
key: "trailMaterial",
get: function() {
return this.getMaterial(1);
},
set: function(t) {
this.setMaterial(1, t);
this._onMaterialModified(1, t);
}
}, {
key: "isPlaying",
get: function() {
return this._isPlaying;
}
}, {
key: "isPaused",
get: function() {
return this._isPaused;
}
}, {
key: "isStopped",
get: function() {
return this._isStopped;
}
}, {
key: "isEmitting",
get: function() {
return this._isEmitting;
}
}, {
key: "time",
get: function() {
return this._time;
}
} ]);
return e;
})(Kt)).prototype, "duration", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 5;
}
}), z = jt(N.prototype, "_capacity", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 100;
}
}), jt(N.prototype, "capacity", [ Yt ], Object.getOwnPropertyDescriptor(N.prototype, "capacity"), N.prototype), 
k = jt(N.prototype, "loop", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !0;
}
}), G = jt(N.prototype, "playOnAwake", [ o ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !0;
}
}), U = jt(N.prototype, "_prewarm", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), jt(N.prototype, "prewarm", [ a ], Object.getOwnPropertyDescriptor(N.prototype, "prewarm"), N.prototype), 
H = jt(N.prototype, "_simulationSpace", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return Bt.Space.Local;
}
}), jt(N.prototype, "simulationSpace", [ c ], Object.getOwnPropertyDescriptor(N.prototype, "simulationSpace"), N.prototype), 
j = jt(N.prototype, "simulationSpeed", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), W = jt(N.prototype, "startDelay", [ l ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new gt.default();
}
}), q = jt(N.prototype, "startLifetime", [ u ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new gt.default();
}
}), X = jt(N.prototype, "startColor", [ h ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new Ct.default();
}
}), Y = jt(N.prototype, "scaleSpace", [ _ ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return Bt.Space.Local;
}
}), J = jt(N.prototype, "startSize", [ f ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new gt.default();
}
}), Z = jt(N.prototype, "startSpeed", [ d ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new gt.default();
}
}), K = jt(N.prototype, "startRotation", [ p ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new gt.default();
}
}), Q = jt(N.prototype, "gravityModifier", [ m ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new gt.default();
}
}), $ = jt(N.prototype, "rateOverTime", [ y ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new gt.default();
}
}), tt = jt(N.prototype, "rateOverDistance", [ v ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new gt.default();
}
}), et = jt(N.prototype, "bursts", [ g ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new Array();
}
}), jt(N.prototype, "materials", [ b ], Object.getOwnPropertyDescriptor(N.prototype, "materials"), N.prototype), 
it = jt(N.prototype, "_shapeModule", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new Mt.default();
}
}), jt(N.prototype, "shapeModule", [ C ], Object.getOwnPropertyDescriptor(N.prototype, "shapeModule"), N.prototype), 
nt = jt(N.prototype, "_colorOverLifetimeModule", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new vt.default();
}
}), jt(N.prototype, "colorOverLifetimeModule", [ x ], Object.getOwnPropertyDescriptor(N.prototype, "colorOverLifetimeModule"), N.prototype), 
rt = jt(N.prototype, "_sizeOvertimeModule", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new St.default();
}
}), jt(N.prototype, "sizeOvertimeModule", [ A ], Object.getOwnPropertyDescriptor(N.prototype, "sizeOvertimeModule"), N.prototype), 
st = jt(N.prototype, "_velocityOvertimeModule", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new wt.default();
}
}), jt(N.prototype, "velocityOvertimeModule", [ S ], Object.getOwnPropertyDescriptor(N.prototype, "velocityOvertimeModule"), N.prototype), 
ot = jt(N.prototype, "_forceOvertimeModule", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new bt.default();
}
}), jt(N.prototype, "forceOvertimeModule", [ T ], Object.getOwnPropertyDescriptor(N.prototype, "forceOvertimeModule"), N.prototype), 
at = jt(N.prototype, "_limitVelocityOvertimeModule", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new xt.default();
}
}), jt(N.prototype, "limitVelocityOvertimeModule", [ w ], Object.getOwnPropertyDescriptor(N.prototype, "limitVelocityOvertimeModule"), N.prototype), 
ct = jt(N.prototype, "_rotationOvertimeModule", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new At.default();
}
}), jt(N.prototype, "rotationOvertimeModule", [ E ], Object.getOwnPropertyDescriptor(N.prototype, "rotationOvertimeModule"), N.prototype), 
lt = jt(N.prototype, "_textureAnimationModule", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new Tt.default();
}
}), jt(N.prototype, "textureAnimationModule", [ M ], Object.getOwnPropertyDescriptor(N.prototype, "textureAnimationModule"), N.prototype), 
ut = jt(N.prototype, "_trailModule", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new Dt.default();
}
}), jt(N.prototype, "trailModule", [ B ], Object.getOwnPropertyDescriptor(N.prototype, "trailModule"), N.prototype), 
ht = jt(N.prototype, "_renderMode", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return Bt.RenderMode.Billboard;
}
}), jt(N.prototype, "renderMode", [ I ], Object.getOwnPropertyDescriptor(N.prototype, "renderMode"), N.prototype), 
_t = jt(N.prototype, "_velocityScale", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), jt(N.prototype, "velocityScale", [ D ], Object.getOwnPropertyDescriptor(N.prototype, "velocityScale"), N.prototype), 
ft = jt(N.prototype, "_lengthScale", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return 1;
}
}), jt(N.prototype, "lengthScale", [ P ], Object.getOwnPropertyDescriptor(N.prototype, "lengthScale"), N.prototype), 
dt = jt(N.prototype, "_mesh", [ Yt ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return null;
}
}), jt(N.prototype, "mesh", [ R ], Object.getOwnPropertyDescriptor(N.prototype, "mesh"), N.prototype), 
jt(N.prototype, "particleMaterial", [ L ], Object.getOwnPropertyDescriptor(N.prototype, "particleMaterial"), N.prototype), 
jt(N.prototype, "trailMaterial", [ O ], Object.getOwnPropertyDescriptor(N.prototype, "trailMaterial"), N.prototype), 
N)) || V) || V) || V) || V);
i.default = $t;
cc.ParticleSystem3D = $t;
e.exports = i.default;
}), {
"../../assets/material/CCMaterial": 124,
"../../components/CCRenderComponent": 160,
"../../mesh/CCMesh": 207,
"../../platform/CCClassDecorator": 240,
"../../value-types": 337,
"../../value-types/utils": 344,
"./animator/color-overtime": 30,
"./animator/curve-range": 31,
"./animator/force-overtime": 32,
"./animator/gradient-range": 33,
"./animator/limit-velocity-overtime": 35,
"./animator/rotation-overtime": 36,
"./animator/size-overtime": 37,
"./animator/texture-animation": 38,
"./animator/velocity-overtime": 39,
"./burst": 40,
"./emitter/shape-module": 42,
"./enum": 43,
"./particle-general-function": 44,
"./renderer/trail": 49
} ],
46: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = t("../../value-types");
i.default = function(t) {
this.particleSystem = null;
this.position = null;
this.velocity = null;
this.animatedVelocity = null;
this.ultimateVelocity = null;
this.angularVelocity = null;
this.axisOfRotation = null;
this.rotation = null;
this.startSize = null;
this.size = null;
this.startColor = null;
this.color = cc.Color.WHITE;
this.randomSeed = null;
this.remainingLifetime = null;
this.startLifetime = null;
this.emitAccumulator0 = null;
this.emitAccumulator1 = null;
this.frameIndex = null;
this.particleSystem = t;
this.position = new n.Vec3(0, 0, 0);
this.velocity = new n.Vec3(0, 0, 0);
this.animatedVelocity = new n.Vec3(0, 0, 0);
this.ultimateVelocity = new n.Vec3(0, 0, 0);
this.angularVelocity = new n.Vec3(0, 0, 0);
this.axisOfRotation = new n.Vec3(0, 0, 0);
this.rotation = new n.Vec3(0, 0, 0);
this.startSize = new n.Vec3(0, 0, 0);
this.size = new n.Vec3(0, 0, 0);
this.startColor = cc.Color.WHITE.clone();
this.color = cc.Color.WHITE.clone();
this.randomSeed = 0;
this.remainingLifetime = 0;
this.startLifetime = 0;
this.emitAccumulator0 = 0;
this.emitAccumulator1 = 0;
this.frameIndex = 0;
};
e.exports = i.default;
}), {
"../../value-types": 337
} ],
47: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = s(t("../../../../renderer/gfx")), r = (s(t("../../../../renderer/core/input-assembler")), 
t("../../../mesh/mesh-data"));
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
t("../../../renderer");
var o = (function() {
function t() {
this._capacity = 0;
this._vertFormat = null;
this._vertAttrsFloatCount = 0;
this._mesh = null;
this._vertCount = 0;
this._indexCount = 0;
this._material = null;
this._capacity = 0;
this._vertFormat = null;
this._vertAttrsFloatCount = 0;
this._mesh = null;
this._subDatas = [];
this._subMeshes = [];
}
var e = t.prototype;
e.setCapacity = function(t) {
var e = this._capacity !== t;
this._capacity = t;
this._inited && e && this._recreateBuffer();
};
e.setVertexAttributes = function(t, e) {
if (this._mesh !== t || this._vertFormat !== e) {
this._mesh = t;
this._vertFormat = e;
this._vertAttrsFloatCount = this._vertFormat._bytes / 4;
this._createParticleData();
this._inited = !0;
}
};
e._recreateBuffer = function() {
this._createParticleData();
};
e._createParticleData = function() {
this.destroyIAData();
this._vertCount = 4;
this._indexCount = 6;
var t = null, e = null, i = this._vertFormat._bytes;
if (this._mesh) {
var s = this._mesh._subDatas[0];
this._vertCount = s.vData.byteLength / s.vfm._bytes;
this._indexCount = s.iData.byteLength / 2;
t = new Float32Array(i * this._capacity * this._vertCount / 4);
e = new Uint16Array(this._capacity * this._indexCount);
var o = this._vertFormat.element(n.default.ATTR_TEX_COORD3), a = this._vertFormat.element(n.default.ATTR_NORMAL), c = this._vertFormat.element(n.default.ATTR_TEX_COORD), l = this._vertFormat.element(n.default.ATTR_COLOR1);
this._mesh.copyAttribute(0, n.default.ATTR_POSITION, t.buffer, i, o.offset);
this._mesh.copyAttribute(0, n.default.ATTR_NORMAL, t.buffer, i, a.offset);
this._mesh.copyAttribute(0, n.default.ATTR_UV0, t.buffer, i, c.offset);
if (!this._mesh.copyAttribute(0, n.default.ATTR_COLOR, t.buffer, i, l.offset)) for (var u = new Uint32Array(t.buffer), h = 0; h < this._vertCount; ++h) u[h * this._vertAttrsFloatCount + l.offset / 4] = cc.Color.WHITE._val;
var _ = new Float32Array(t.buffer);
for (h = 1; h < this._capacity; h++) _.copyWithin(h * i * this._vertCount / 4, 0, i * this._vertCount / 4);
this._mesh.copyIndices(0, e);
for (h = 1; h < this._capacity; h++) for (var f = 0; f < this._indexCount; f++) e[h * this._indexCount + f] = e[f] + h * this._vertCount;
} else {
t = new Float32Array(i * this._capacity * this._vertCount / 4);
e = new Uint16Array(this._capacity * this._indexCount);
var d = 0;
for (h = 0; h < this._capacity; ++h) {
var p = 4 * h;
e[d++] = p;
e[d++] = p + 1;
e[d++] = p + 2;
e[d++] = p + 3;
e[d++] = p + 2;
e[d++] = p + 1;
}
}
var m = new r.MeshData();
m.vData = t;
m.iData = e;
m.vfm = this._vertFormat;
m.vDirty = !0;
m.iDirty = !0;
m.enable = !0;
this._subDatas[0] = m;
m.vDirty = !0;
};
e.createTrailData = function(t, e) {
if (!this._subDatas[1]) {
var i = t._bytes, n = new ArrayBuffer(i * (e + 1) * 2), s = new Uint16Array(6 * e), o = new r.MeshData();
o.vData = new Float32Array(n);
o.iData = s;
o.vfm = t;
o.vDirty = !0;
o.iDirty = !0;
o.enable = !0;
this._subDatas[1] = o;
o.vDirty = !0;
}
};
e.setModelMaterial = function(t) {
this._material = t;
};
e.addParticleVertexData = function(t, e) {
var i = this._subDatas[0], n = i.getVData(), r = i.getVData(Uint32Array);
if (this._mesh) for (var s = 0; s < this._vertCount; s++) {
var o = (t * this._vertCount + s) * this._vertAttrsFloatCount;
n[o++] = e[0].x;
n[o++] = e[0].y;
n[o++] = e[0].z;
o += 2;
n[o++] = e[1].z;
n[o++] = e[2].x;
n[o++] = e[2].y;
n[o++] = e[2].z;
n[o++] = e[3].x;
n[o++] = e[3].y;
n[o++] = e[3].z;
r[o++] = e[4];
} else {
var a = t * this._vertAttrsFloatCount;
n[a++] = e[0].x;
n[a++] = e[0].y;
n[a++] = e[0].z;
n[a++] = e[1].x;
n[a++] = e[1].y;
n[a++] = e[1].z;
n[a++] = e[2].x;
n[a++] = e[2].y;
n[a++] = e[2].z;
n[a++] = e[3].x;
n[a++] = e[3].y;
n[a++] = e[3].z;
r[a++] = e[4];
if (e[5]) {
n[a++] = e[5].x;
n[a++] = e[5].y;
n[a++] = e[5].z;
}
}
};
e._uploadData = function() {
for (var t = this._subDatas, e = this._subMeshes, i = 0, n = t.length; i < n; i++) {
var r = t[i], s = e[i];
if (r.vDirty) {
var o = s._vertexBuffer, a = r.vData;
o.update(0, a);
r.vDirty = !1;
}
if (r.iDirty) {
var c = s._indexBuffer, l = r.iData;
c.update(0, l);
r.iDirty = !1;
}
}
};
e.updateIA = function() {};
e.clear = function() {
var t = this._subMeshes[0];
t && (t.indexCount = 0);
};
e.destroy = function() {
this._subDatas.length = 0;
for (var t = this._subMeshes, e = 0, i = t.length; e < i; e++) {
var n = t[e]._vertexBuffer;
n && n.destroy();
var r = t[e]._indexBuffer;
r && r.destroy();
}
t.length = 0;
};
e.destroyIAData = function() {
if (this._subMeshes[0]) {
this._subMeshes[0]._vertexBuffer.destroy();
this._subMeshes[0]._indexBuffer.destroy();
this._subMeshes[0] = null;
}
this._subDatas[0] = null;
};
return t;
})();
i.default = o;
e.exports = i.default;
}), {
"../../../../renderer/core/input-assembler": 359,
"../../../../renderer/gfx": 363,
"../../../mesh/mesh-data": 210,
"../../../renderer": 271
} ],
48: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = t("../../../value-types"), s = f(t("../../../../renderer/gfx")), o = f(t("./particle-batch-model")), a = f(t("../../../assets/material/material-variant")), c = f(t("../../../../renderer/memop/recycle-pool")), l = t("../enum"), u = f(t("../particle")), h = f(t("../../../renderer/assembler")), _ = f(t("../particle-system-3d"));
function f(t) {
return t && t.__esModule ? t : {
default: t
};
}
function d(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
p(t, e);
}
function p(t, e) {
return (p = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var m = t("../../../platform/CCClassDecorator"), y = m.ccclass, v = (m.property, 
new r.Vec3()), g = (new r.Vec2(), new r.Vec4(), new r.Mat4()), b = [ 0, 0, 1, 0, 0, 1, 1, 1 ], C = new s.default.VertexFormat([ {
name: s.default.ATTR_POSITION,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_TEX_COORD,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_TEX_COORD1,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_TEX_COORD2,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_COLOR,
type: s.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
} ]);
C.name = "vfmtNormal";
var x = new s.default.VertexFormat([ {
name: s.default.ATTR_POSITION,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_TEX_COORD,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_TEX_COORD1,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_TEX_COORD2,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_COLOR,
type: s.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
}, {
name: s.default.ATTR_COLOR1,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
} ]);
x.name = "vfmtStretch";
var A = new s.default.VertexFormat([ {
name: s.default.ATTR_POSITION,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_TEX_COORD,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_TEX_COORD1,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_TEX_COORD2,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_COLOR,
type: s.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
}, {
name: s.default.ATTR_TEX_COORD3,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_NORMAL,
type: s.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: s.default.ATTR_COLOR1,
type: s.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
} ]);
A.name = "vfmtMesh";
var S = y("cc.ParticleSystem3DAssembler")(n = (function(t) {
d(e, t);
function e() {
var e;
(e = t.call(this) || this)._defines = null;
e._trailDefines = null;
e._model = null;
e.frameTile_velLenScale = null;
e.attrs = [];
e._vertFormat = [];
e._particleSystem = null;
e._particles = null;
e._defaultMat = null;
e._isAssetReady = !1;
e._defaultTrailMat = null;
e._customProperties = null;
e._node_scale = null;
e._model = null;
e.frameTile_velLenScale = cc.v4(1, 1, 0, 0);
e._node_scale = cc.v4();
e.attrs = new Array(5);
e._trailDefines = {
CC_USE_WORLD_SPACE: !0
};
return e;
}
var i = e.prototype;
i.onInit = function(t) {
var e = this;
this._particleSystem = t;
this._particles = new c.default(function() {
return new u.default(e);
}, 16);
this._setVertexAttrib();
this.onEnable();
this._updateModel();
this._updateMaterialParams();
this._updateTrailMaterial();
};
i.onEnable = function() {
if (this._particleSystem) {
null == this._model && (this._model = new o.default());
this._model.inited || this._model.setCapacity(this._particleSystem.capacity);
this._model.enabled = this._particleSystem.enabledInHierarchy;
}
};
i.onDisable = function() {
this._model && (this._model.enabled = this._particleSystem.enabledInHierarchy);
};
i.onDestroy = function() {
this._model = null;
};
i.clear = function() {
this._particles.reset();
this.updateParticleBuffer();
};
i._getFreeParticle = function() {
return this._particles.length >= this._particleSystem.capacity ? null : this._particles.add();
};
i._setNewParticle = function() {};
i._updateParticles = function(t) {
this._particleSystem.node.getWorldMatrix(g);
switch (this._particleSystem.scaleSpace) {
case l.Space.Local:
this._particleSystem.node.getScale(this._node_scale);
break;

case l.Space.World:
this._particleSystem.node.getWorldScale(this._node_scale);
}
(this._particleSystem.materials[0] ? this._particleSystem.particleMaterial : this._defaultMat).setProperty("scale", this._node_scale);
this._particleSystem.velocityOvertimeModule.enable && this._particleSystem.velocityOvertimeModule.update(this._particleSystem._simulationSpace, g);
this._particleSystem.forceOvertimeModule.enable && this._particleSystem.forceOvertimeModule.update(this._particleSystem._simulationSpace, g);
this._particleSystem.trailModule.enable && this._particleSystem.trailModule.update();
for (var e = 0; e < this._particles.length; ++e) {
var i = this._particles.data[e];
i.remainingLifetime -= t;
r.Vec3.set(i.animatedVelocity, 0, 0, 0);
if (i.remainingLifetime < 0) {
this._particleSystem.trailModule.enable && this._particleSystem.trailModule.removeParticle(i);
this._particles.remove(e);
--e;
} else {
i.velocity.y -= 9.8 * this._particleSystem.gravityModifier.evaluate(1 - i.remainingLifetime / i.startLifetime, i.randomSeed) * t;
this._particleSystem.sizeOvertimeModule.enable && this._particleSystem.sizeOvertimeModule.animate(i);
this._particleSystem.colorOverLifetimeModule.enable && this._particleSystem.colorOverLifetimeModule.animate(i);
this._particleSystem.forceOvertimeModule.enable && this._particleSystem.forceOvertimeModule.animate(i, t);
this._particleSystem.velocityOvertimeModule.enable ? this._particleSystem.velocityOvertimeModule.animate(i) : r.Vec3.copy(i.ultimateVelocity, i.velocity);
this._particleSystem.limitVelocityOvertimeModule.enable && this._particleSystem.limitVelocityOvertimeModule.animate(i);
this._particleSystem.rotationOvertimeModule.enable && this._particleSystem.rotationOvertimeModule.animate(i, t);
this._particleSystem.textureAnimationModule.enable && this._particleSystem.textureAnimationModule.animate(i);
r.Vec3.scaleAndAdd(i.position, i.position, i.ultimateVelocity, t);
this._particleSystem.trailModule.enable && this._particleSystem.trailModule.animate(i, t);
}
}
return this._particles.length;
};
i.updateParticleBuffer = function() {
for (var t = 0, e = this._particleSystem.renderMode === l.RenderMode.StrecthedBillboard, i = 0; i < this._particles.length; ++i) {
var n = this._particles.data[i], r = 0;
this._particleSystem.textureAnimationModule.enable && (r = n.frameIndex);
t = 4 * i;
var s = 0;
if (this._particleSystem.renderMode !== l.RenderMode.Mesh) for (var o = 0; o < 4; ++o) {
s = 0;
this.attrs[s++] = n.position;
v.x = b[2 * o];
v.y = b[2 * o + 1];
v.z = r;
this.attrs[s++] = v;
this.attrs[s++] = n.size;
this.attrs[s++] = n.rotation;
this.attrs[s++] = n.color._val;
this.attrs[s++] = e ? n.ultimateVelocity : null;
this._model.addParticleVertexData(t++, this.attrs);
} else {
s = 0;
this.attrs[s++] = n.position;
v.z = r;
this.attrs[s++] = v;
this.attrs[s++] = n.size;
this.attrs[s++] = n.rotation;
this.attrs[s++] = n.color._val;
this._model.addParticleVertexData(i, this.attrs);
}
}
this.updateIA(0, this._particles.length * this._model._indexCount, !0);
};
i.updateShaderUniform = function() {};
i.updateIA = function(t, e, i, n) {
this._model && this._model.updateIA(t, e, i, n);
};
i.getParticleCount = function() {
return this._particles.data.length;
};
i._onMaterialModified = function(t) {
if (0 === t) {
this._updateModel();
this._updateMaterialParams();
} else this._updateTrailMaterial();
};
i._onRebuildPSO = function(t, e) {
this._model && 0 === t && this._model.setModelMaterial(e);
this._particleSystem.trailModule._trailModel && 1 === t && this._particleSystem.trailModule._trailModel.setModelMaterial(e);
};
i._ensureLoadMesh = function() {
this._particleSystem.mesh && !this._particleSystem.mesh.loaded && cc.assetManager.postLoadNative(this._particleSystem.mesh);
};
i.setCapacity = function(t) {
this._model && this._model.setCapacity(t);
};
i._setVertexAttrib = function() {
switch (this._particleSystem.renderMode) {
case l.RenderMode.StrecthedBillboard:
this._vertFormat = x;
break;

case l.RenderMode.Mesh:
this._vertFormat = A;
break;

default:
this._vertFormat = C;
}
};
i._updateMaterialParams = function() {
if (this._particleSystem) {
var t = this._particleSystem.materials[0];
t = (t = null == t && null == this._defaultMat ? this._defaultMat = a.default.createWithBuiltin("3d-particle", this) : a.default.create(t, this._particleSystem)) || this._defaultMat;
this._particleSystem._simulationSpace === l.Space.World ? t.define("CC_USE_WORLD_SPACE", !0) : t.define("CC_USE_WORLD_SPACE", !1);
if (this._particleSystem.renderMode === l.RenderMode.Billboard) {
t.define("CC_USE_BILLBOARD", !0);
t.define("CC_USE_STRETCHED_BILLBOARD", !1);
t.define("CC_USE_HORIZONTAL_BILLBOARD", !1);
t.define("CC_USE_VERTICAL_BILLBOARD", !1);
t.define("CC_USE_MESH", !1);
} else if (this._particleSystem.renderMode === l.RenderMode.StrecthedBillboard) {
t.define("CC_USE_BILLBOARD", !1);
t.define("CC_USE_STRETCHED_BILLBOARD", !0);
t.define("CC_USE_HORIZONTAL_BILLBOARD", !1);
t.define("CC_USE_VERTICAL_BILLBOARD", !1);
t.define("CC_USE_MESH", !1);
this.frameTile_velLenScale.z = this._particleSystem.velocityScale;
this.frameTile_velLenScale.w = this._particleSystem.lengthScale;
} else if (this._particleSystem.renderMode === l.RenderMode.HorizontalBillboard) {
t.define("CC_USE_BILLBOARD", !1);
t.define("CC_USE_STRETCHED_BILLBOARD", !1);
t.define("CC_USE_HORIZONTAL_BILLBOARD", !0);
t.define("CC_USE_VERTICAL_BILLBOARD", !1);
t.define("CC_USE_MESH", !1);
} else if (this._particleSystem.renderMode === l.RenderMode.VerticalBillboard) {
t.define("CC_USE_BILLBOARD", !1);
t.define("CC_USE_STRETCHED_BILLBOARD", !1);
t.define("CC_USE_HORIZONTAL_BILLBOARD", !1);
t.define("CC_USE_VERTICAL_BILLBOARD", !0);
t.define("CC_USE_MESH", !1);
} else if (this._particleSystem.renderMode === l.RenderMode.Mesh) {
t.define("CC_USE_BILLBOARD", !1);
t.define("CC_USE_STRETCHED_BILLBOARD", !1);
t.define("CC_USE_HORIZONTAL_BILLBOARD", !1);
t.define("CC_USE_VERTICAL_BILLBOARD", !1);
t.define("CC_USE_MESH", !0);
} else console.warn("particle system renderMode " + this._particleSystem.renderMode + " not support.");
this._particleSystem.textureAnimationModule.enable && r.Vec2.set(this.frameTile_velLenScale, this._particleSystem.textureAnimationModule.numTilesX, this._particleSystem.textureAnimationModule.numTilesY);
t.setProperty("frameTile_velLenScale", this.frameTile_velLenScale);
this._particleSystem.setMaterial(0, t);
}
};
i._updateTrailMaterial = function() {
var t = this._particleSystem.trailMaterial;
if (this._particleSystem.trailModule.enable) {
null === t && null === this._defaultTrailMat && (this._defaultTrailMat = a.default.createWithBuiltin("3d-trail", this));
if (null === t) {
t = this._defaultTrailMat;
this._particleSystem.trailMaterial = t;
}
this._particleSystem._simulationSpace === l.Space.World || this._particleSystem.trailModule.space === l.Space.World ? t.define("CC_USE_WORLD_SPACE", !0) : t.define("CC_USE_WORLD_SPACE", !1);
this._particleSystem.trailModule._updateMaterial();
}
};
i._updateTrailEnable = function(t) {
if (this._model) {
var e = this._model._subDatas[1];
e && (e.enable = t);
}
};
i._updateModel = function() {
this._model && this._model.setVertexAttributes(this._particleSystem.renderMode === l.RenderMode.Mesh ? this._particleSystem.mesh : null, this._vertFormat);
};
i.setVertexAttributes = function(t, e) {
this._model && this._model.setVertexAttributes(t, e);
};
i.fillBuffers = function(t, e) {
if (this._model) {
this._model._uploadData();
var i = this._model._subMeshes, n = this._model._subDatas, r = t.materials;
e._flush();
for (var s = 0, o = i.length; s < o; s++) {
var a = i[s], c = n[s], l = r[s];
if (c.enable) {
e.material = l;
e.cullingMask = t.node._cullingMask;
e.node = t.node;
e._flushIA(a);
}
}
}
};
return e;
})(h.default)) || n;
i.default = S;
Object.assign(S, {
uv: b
});
h.default.register(_.default, S);
e.exports = i.default;
}), {
"../../../../renderer/gfx": 363,
"../../../../renderer/memop/recycle-pool": 365,
"../../../assets/material/material-variant": 131,
"../../../platform/CCClassDecorator": 240,
"../../../renderer/assembler": 268,
"../../../value-types": 337,
"../enum": 43,
"../particle": 46,
"../particle-system-3d": 45,
"./particle-batch-model": 47
} ],
49: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b, C, x, A, S, T = t("../../../platform/CCClassDecorator"), w = t("../../../value-types"), E = R(t("../../../../renderer/gfx")), M = R(t("../../../../renderer/memop/pool")), B = R(t("../animator/curve-range")), I = R(t("../animator/gradient-range")), D = t("../enum"), P = R(t("../utils"));
function R(t) {
return t && t.__esModule ? t : {
default: t
};
}
function L(t, e) {
var i = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
if (i) return (i = i.call(t)).next.bind(i);
if (Array.isArray(t) || (i = O(t)) || e && t && "number" == typeof t.length) {
i && (t = i);
var n = 0;
return function() {
return n >= t.length ? {
done: !0
} : {
done: !1,
value: t[n++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function O(t, e) {
if (t) {
if ("string" == typeof t) return V(t, e);
var i = Object.prototype.toString.call(t).slice(8, -1);
"Object" === i && t.constructor && (i = t.constructor.name);
return "Map" === i || "Set" === i ? Array.from(t) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? V(t, e) : void 0;
}
}
function V(t, e) {
(null == e || e > t.length) && (e = t.length);
for (var i = 0, n = new Array(e); i < e; i++) n[i] = t[i];
return n;
}
function N(t, e, i, n) {
i && Object.defineProperty(t, e, {
enumerable: i.enumerable,
configurable: i.configurable,
writable: i.writable,
value: i.initializer ? i.initializer.call(n) : void 0
});
}
function F(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function z(t, e, i) {
e && F(t.prototype, e);
i && F(t, i);
return t;
}
function k(t, e, i, n, r) {
var s = {};
Object.keys(n).forEach((function(t) {
s[t] = n[t];
}));
s.enumerable = !!s.enumerable;
s.configurable = !!s.configurable;
("value" in s || s.initializer) && (s.writable = !0);
s = i.slice().reverse().reduce((function(i, n) {
return n(t, e, i) || i;
}), s);
if (r && void 0 !== s.initializer) {
s.value = s.initializer ? s.initializer.call(r) : void 0;
s.initializer = void 0;
}
if (void 0 === s.initializer) {
Object.defineProperty(t, e, s);
s = null;
}
return s;
}
var G = Math.cos((0, w.toRadian)(100)), U = {
position: cc.v3(),
velocity: cc.v3()
}, H = cc.quat(), j = cc.mat4(), W = cc.v3(), q = cc.v3(), X = cc.color(), Y = (function() {
function t(t) {
this.start = void 0;
this.end = void 0;
this.trailElements = [];
this.start = -1;
this.end = -1;
this.trailElements = [];
for (;t--; ) this.trailElements.push({
position: cc.v3(),
lifetime: 0,
width: 0,
velocity: cc.v3(),
direction: 0,
color: cc.color()
});
}
var e = t.prototype;
e.getElement = function(t) {
if (-1 === this.start) return null;
t < 0 && (t = (t + this.trailElements.length) % this.trailElements.length);
t >= this.trailElements.length && (t %= this.trailElements.length);
return this.trailElements[t];
};
e.addElement = function() {
if (0 === this.trailElements.length) return null;
if (-1 === this.start) {
this.start = 0;
this.end = 1;
return this.trailElements[0];
}
if (this.start === this.end) {
this.trailElements.splice(this.end, 0, {
position: cc.v3(),
lifetime: 0,
width: 0,
velocity: cc.v3(),
direction: 0,
color: cc.color()
});
this.start++;
this.start %= this.trailElements.length;
}
var t = this.end++;
this.end %= this.trailElements.length;
return this.trailElements[t];
};
e.iterateElement = function(t, e, i, n) {
for (var r = this.start >= this.end ? this.end + this.trailElements.length : this.end, s = this.start; s < r; s++) if (e(t, this.trailElements[s % this.trailElements.length], i, n)) {
this.start++;
this.start %= this.trailElements.length;
}
if (this.start === r) {
this.start = -1;
this.end = -1;
}
};
e.count = function() {
return this.start < this.end ? this.end - this.start : this.trailElements.length + this.end - this.start;
};
e.clear = function() {
this.start = -1;
this.end = -1;
};
return t;
})(), J = (n = (0, T.ccclass)("cc.TrailModule"), r = (0, T.property)({
type: D.TrailMode
}), s = (0, T.property)({
type: B.default
}), o = (0, T.property)({
type: D.Space
}), a = (0, T.property)({
type: D.TextureMode
}), c = (0, T.property)({
type: B.default
}), l = (0, T.property)({
type: I.default
}), u = (0, T.property)({
type: I.default
}), n(h = (f = k((_ = (function() {
function t() {
N(this, "_enable", f, this);
N(this, "mode", d, this);
N(this, "lifeTime", p, this);
N(this, "_minParticleDistance", m, this);
N(this, "_space", y, this);
N(this, "existWithParticles", v, this);
N(this, "textureMode", g, this);
N(this, "widthFromParticle", b, this);
N(this, "widthRatio", C, this);
N(this, "colorFromParticle", x, this);
N(this, "colorOverTrail", A, this);
N(this, "colorOvertime", S, this);
this._particleSystem = null;
this._minSquaredDistance = 0;
this._vertSize = 0;
this._trailNum = 0;
this._trailLifetime = 0;
this.vbOffset = 0;
this.ibOffset = 0;
this._trailSegments = null;
this._particleTrail = null;
this._ia = null;
this._gfxVFmt = null;
this._vbF32 = null;
this._vbUint32 = null;
this._iBuffer = null;
this._needTransform = null;
this._defaultMat = null;
this._material = null;
this._gfxVFmt = new E.default.VertexFormat([ {
name: E.default.ATTR_POSITION,
type: E.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: E.default.ATTR_TEX_COORD,
type: E.default.ATTR_TYPE_FLOAT32,
num: 4
}, {
name: E.default.ATTR_TEX_COORD1,
type: E.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: E.default.ATTR_COLOR,
type: E.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
} ]);
this._vertSize = this._gfxVFmt._bytes;
this._particleTrail = new P.default();
}
var e = t.prototype;
e.onInit = function(t) {
this._particleSystem = t;
this.minParticleDistance = this._minParticleDistance;
for (var e, i = 0, n = L(t.bursts); !(e = n()).done; ) i += e.value.getMaxCount(t);
this.lifeTime.constant = 1;
this._trailNum = Math.ceil(t.startLifetime.getMax() * this.lifeTime.getMax() * 60 * (t.rateOverTime.getMax() * t.duration + i));
this._trailSegments = new M.default(function() {
return new Y(10);
}, Math.ceil(t.rateOverTime.getMax() * t.duration));
if (this._enable) {
this.enable = this._enable;
this._updateMaterial();
}
};
e.onEnable = function() {};
e.onDisable = function() {};
e.destroy = function() {
if (this._trailSegments) {
this._trailSegments.clear((function(t) {
t.trailElements.length = 0;
}));
this._trailSegments = null;
}
};
e.clear = function() {
if (this.enable) {
for (var t = this._particleTrail.values(), e = t.next(); !e.done; ) {
e.value.clear();
e = t.next();
}
this._particleTrail.clear();
this.updateTrailBuffer();
}
};
e._createTrailData = function() {
var t = this._particleSystem._assembler._model;
if (t) {
t.createTrailData(this._gfxVFmt, this._trailNum);
var e = t._subDatas[1];
this._vbF32 = e.getVData();
this._vbUint32 = e.getVData(Uint32Array);
this._iBuffer = e.iData;
}
};
e._updateMaterial = function() {
if (this._particleSystem) {
var t = this._particleSystem.trailMaterial;
this._material = t || this._particleSystem._assembler._defaultTrailMat;
}
};
e.update = function() {
this._trailLifetime = this.lifeTime.evaluate(this._particleSystem._time, 1);
if (this.space === D.Space.World && this._particleSystem._simulationSpace === D.Space.Local) {
this._needTransform = !0;
this._particleSystem.node.getWorldMatrix(j);
this._particleSystem.node.getWorldRotation(H);
} else this._needTransform = !1;
};
e.animate = function(t, e) {
if (this._trailSegments) {
var i = this._particleTrail.get(t);
if (i) {
var n = i.getElement(i.end - 1);
this._needTransform ? w.Vec3.transformMat4(W, t.position, j) : w.Vec3.copy(W, t.position);
if (n) {
i.iterateElement(this, this._updateTrailElement, t, e);
if (w.Vec3.squaredDistance(n.position, W) < this._minSquaredDistance) return;
}
if (n = i.addElement()) {
w.Vec3.copy(n.position, W);
n.lifetime = 0;
this.widthFromParticle ? n.width = t.size.x * this.widthRatio.evaluate(0, 1) : n.width = this.widthRatio.evaluate(0, 1);
var r = i.count();
if (2 === r) {
var s = i.getElement(i.end - 2);
w.Vec3.subtract(s.velocity, n.position, s.position);
} else if (r > 2) {
var o = i.getElement(i.end - 2), a = i.getElement(i.end - 3);
w.Vec3.subtract(W, a.position, o.position);
w.Vec3.subtract(q, n.position, o.position);
w.Vec3.subtract(o.velocity, q, W);
w.Vec3.equals(cc.Vec3.ZERO, o.velocity) && w.Vec3.copy(o.velocity, W);
}
this.colorFromParticle ? n.color.set(t.color) : n.color.set(this.colorOvertime.evaluate(0, 1));
}
} else {
i = this._trailSegments.alloc();
this._particleTrail.set(t, i);
}
}
};
e._updateTrailElement = function(t, e, i, n) {
e.lifetime += n;
if (t.colorFromParticle) {
e.color.set(i.color);
e.color.multiply(t.colorOvertime.evaluate(1 - i.remainingLifetime / i.startLifetime, 1));
} else e.color.set(t.colorOvertime.evaluate(1 - i.remainingLifetime / i.startLifetime, 1));
t.widthFromParticle ? e.width = i.size.x * t.widthRatio.evaluate(e.lifetime / t._trailLifetime, 1) : e.width = t.widthRatio.evaluate(e.lifetime / t._trailLifetime, 1);
return e.lifetime > t._trailLifetime;
};
e.removeParticle = function(t) {
var e = this._particleTrail.get(t);
if (e && this._trailSegments) {
e.clear();
this._trailSegments.free(e);
this._particleTrail.delete(t);
}
};
e.updateTrailBuffer = function() {
this.vbOffset = 0;
this.ibOffset = 0;
for (var t, e = L(this._particleTrail.keys()); !(t = e()).done; ) {
var i = t.value, n = this._particleTrail.get(i);
if (-1 !== n.start) {
var r = 4 * this.vbOffset / this._vertSize, s = n.start >= n.end ? n.end + n.trailElements.length : n.end, o = s - n.start, a = 1 / o, c = n.trailElements[n.start];
this._fillVertexBuffer(c, this.colorOverTrail.evaluate(1, 1), r, 1, 0, 4);
for (var l = n.start + 1; l < s; l++) {
var u = n.trailElements[l % n.trailElements.length], h = l - n.start;
this._fillVertexBuffer(u, this.colorOverTrail.evaluate(1 - h / o, 1), r, 1 - h * a, h, 5);
}
this._needTransform ? w.Vec3.transformMat4(U.position, i.position, j) : w.Vec3.copy(U.position, i.position);
if (1 === o || 2 === o) {
var _ = n.getElement(n.end - 1);
w.Vec3.subtract(_.velocity, U.position, _.position);
this._vbF32[this.vbOffset - this._vertSize / 4 - 4] = _.velocity.x;
this._vbF32[this.vbOffset - this._vertSize / 4 - 3] = _.velocity.y;
this._vbF32[this.vbOffset - this._vertSize / 4 - 2] = _.velocity.z;
this._vbF32[this.vbOffset - 4] = _.velocity.x;
this._vbF32[this.vbOffset - 3] = _.velocity.y;
this._vbF32[this.vbOffset - 2] = _.velocity.z;
w.Vec3.subtract(U.velocity, U.position, _.position);
this._checkDirectionReverse(U, _);
} else if (o > 2) {
var f = n.getElement(n.end - 1), d = n.getElement(n.end - 2);
w.Vec3.subtract(W, d.position, f.position);
w.Vec3.subtract(q, U.position, f.position);
w.Vec3.normalize(W, W);
w.Vec3.normalize(q, q);
w.Vec3.subtract(f.velocity, q, W);
w.Vec3.normalize(f.velocity, f.velocity);
this._checkDirectionReverse(f, d);
this.vbOffset -= this._vertSize / 4 * 2;
this.ibOffset -= 6;
this._fillVertexBuffer(f, this.colorOverTrail.evaluate(a, 1), r, a, o - 1, 5);
w.Vec3.subtract(U.velocity, U.position, f.position);
w.Vec3.normalize(U.velocity, U.velocity);
this._checkDirectionReverse(U, f);
}
this.widthFromParticle ? U.width = i.size.x * this.widthRatio.evaluate(0, 1) : U.width = this.widthRatio.evaluate(0, 1);
U.color = i.color;
w.Vec3.equals(U.velocity, cc.Vec3.ZERO) ? this.ibOffset -= 3 : this._fillVertexBuffer(U, this.colorOverTrail.evaluate(0, 1), r, 0, o, 1);
}
}
this._updateIA(this.ibOffset);
};
e._fillVertexBuffer = function(t, e, i, n, r, s) {
this._vbF32[this.vbOffset++] = t.position.x;
this._vbF32[this.vbOffset++] = t.position.y;
this._vbF32[this.vbOffset++] = t.position.z;
this._vbF32[this.vbOffset++] = 0;
this._vbF32[this.vbOffset++] = t.width;
this._vbF32[this.vbOffset++] = n;
this._vbF32[this.vbOffset++] = 0;
this._vbF32[this.vbOffset++] = t.velocity.x;
this._vbF32[this.vbOffset++] = t.velocity.y;
this._vbF32[this.vbOffset++] = t.velocity.z;
X.set(t.color);
X.multiply(e);
this._vbUint32[this.vbOffset++] = X._val;
this._vbF32[this.vbOffset++] = t.position.x;
this._vbF32[this.vbOffset++] = t.position.y;
this._vbF32[this.vbOffset++] = t.position.z;
this._vbF32[this.vbOffset++] = 1;
this._vbF32[this.vbOffset++] = t.width;
this._vbF32[this.vbOffset++] = n;
this._vbF32[this.vbOffset++] = 1;
this._vbF32[this.vbOffset++] = t.velocity.x;
this._vbF32[this.vbOffset++] = t.velocity.y;
this._vbF32[this.vbOffset++] = t.velocity.z;
this._vbUint32[this.vbOffset++] = X._val;
if (1 & s) {
this._iBuffer[this.ibOffset++] = i + 2 * r;
this._iBuffer[this.ibOffset++] = i + 2 * r - 1;
this._iBuffer[this.ibOffset++] = i + 2 * r + 1;
}
if (4 & s) {
this._iBuffer[this.ibOffset++] = i + 2 * r;
this._iBuffer[this.ibOffset++] = i + 2 * r + 1;
this._iBuffer[this.ibOffset++] = i + 2 * r + 2;
}
};
e._updateIA = function(t) {
this._particleSystem && this._particleSystem._assembler && this._particleSystem._assembler.updateIA(1, t, !0, !0);
};
e._checkDirectionReverse = function(t, e) {
w.Vec3.dot(t.velocity, e.velocity) < G ? t.direction = 1 - e.direction : t.direction = e.direction;
};
z(t, [ {
key: "enable",
get: function() {
return this._enable;
},
set: function(t) {
t && this._createTrailData();
if (t && !this._enable) {
this._enable = t;
this._particleSystem._assembler._updateTrailMaterial();
}
this._enable = t;
this._particleSystem._assembler._updateTrailEnable(this._enable);
}
}, {
key: "minParticleDistance",
get: function() {
return this._minParticleDistance;
},
set: function(t) {
this._minParticleDistance = t;
this._minSquaredDistance = t * t;
}
}, {
key: "space",
get: function() {
return this._space;
},
set: function(t) {
this._space = t;
this._particleSystem && this._particleSystem._assembler._updateTrailMaterial();
}
} ]);
return t;
})()).prototype, "_enable", [ T.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), k(_.prototype, "enable", [ T.property ], Object.getOwnPropertyDescriptor(_.prototype, "enable"), _.prototype), 
d = k(_.prototype, "mode", [ r ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return D.TrailMode.Particles;
}
}), p = k(_.prototype, "lifeTime", [ s ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new B.default();
}
}), m = k(_.prototype, "_minParticleDistance", [ T.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return .1;
}
}), k(_.prototype, "minParticleDistance", [ T.property ], Object.getOwnPropertyDescriptor(_.prototype, "minParticleDistance"), _.prototype), 
y = k(_.prototype, "_space", [ T.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return D.Space.World;
}
}), k(_.prototype, "space", [ o ], Object.getOwnPropertyDescriptor(_.prototype, "space"), _.prototype), 
v = k(_.prototype, "existWithParticles", [ T.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !0;
}
}), g = k(_.prototype, "textureMode", [ a ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return D.TextureMode.Stretch;
}
}), b = k(_.prototype, "widthFromParticle", [ T.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !0;
}
}), C = k(_.prototype, "widthRatio", [ c ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new B.default();
}
}), x = k(_.prototype, "colorFromParticle", [ T.property ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return !1;
}
}), A = k(_.prototype, "colorOverTrail", [ l ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new I.default();
}
}), S = k(_.prototype, "colorOvertime", [ u ], {
configurable: !0,
enumerable: !0,
writable: !0,
initializer: function() {
return new I.default();
}
}), _)) || h);
i.default = J;
e.exports = i.default;
}), {
"../../../../renderer/gfx": 363,
"../../../../renderer/memop/pool": 364,
"../../../platform/CCClassDecorator": 240,
"../../../value-types": 337,
"../animator/curve-range": 31,
"../animator/gradient-range": 33,
"../enum": 43,
"../utils": 50
} ],
50: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
Object.is || (Object.is = function(t, e) {
return t === e ? 0 !== t || 1 / t == 1 / e : t != t && e != e;
});
var n = (function() {
function t(t) {
this.datas = [];
!t && (t = []);
this.datas = [];
var e = this;
t.forEach((function(t) {
e.has(t[0]) || e.datas.push({
key: t[0],
value: t[1]
});
}));
}
var e = t.prototype;
e.size = function() {
return this.datas.length;
};
e.set = function(t, e) {
this.delete(t);
this.datas.push({
key: t,
value: e
});
};
e.get = function(t) {
for (var e = void 0, i = this.datas, n = 0, r = i.length; n < r; n++) if (Object.is(t, i[n].key)) {
e = i[n].value;
break;
}
return e;
};
e.has = function(t) {
for (var e = !1, i = this.datas, n = 0, r = i.length; n < r; n++) if (Object.is(t, i[n].key)) {
e = !0;
break;
}
return e;
};
e.clear = function() {
this.datas.length = 0;
};
e.delete = function(t) {
for (var e = !1, i = this.datas, n = 0, r = i.length; n < r; n++) if (Object.is(t, i[n].key)) {
i.splice(n, 1);
e = !0;
break;
}
return e;
};
e.keys = function() {
for (var t = this.datas, e = [], i = 0, n = t.length; i < n; i++) e.push(t[i].key);
return e;
};
e.values = function() {
var t = 0, e = this.datas;
return {
next: function() {
return 0 === e.length || void 0 === e[t] ? {
value: void 0,
done: !0
} : {
value: e[t++].value,
done: !1
};
}
};
};
return t;
})();
i.default = n;
e.exports = i.default;
}), {} ],
51: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = function(t, e, i, s) {
void 0 === t && (t = 1);
void 0 === e && (e = 1);
void 0 === i && (i = 1);
void 0 === s && (s = {
widthSegments: 1,
heightSegments: 1,
lengthSegments: 1,
invWinding: !1
});
var v = s.widthSegments, g = s.heightSegments, b = s.lengthSegments, C = s.invWinding, x = .5 * t, A = .5 * e, S = .5 * i, T = [ n.default.set(u, -x, -A, S), n.default.set(h, x, -A, S), n.default.set(_, x, A, S), n.default.set(f, -x, A, S), n.default.set(d, x, -A, -S), n.default.set(p, -x, -A, -S), n.default.set(m, -x, A, -S), n.default.set(y, x, A, -S) ], w = [ [ 2, 3, 1 ], [ 4, 5, 7 ], [ 7, 6, 2 ], [ 1, 0, 4 ], [ 1, 4, 2 ], [ 5, 0, 6 ] ], E = [ [ 0, 0, 1 ], [ 0, 0, -1 ], [ 0, 1, 0 ], [ 0, -1, 0 ], [ 1, 0, 0 ], [ -1, 0, 0 ] ], M = [], B = [], I = [], D = [], P = new n.default(-x, -A, -S), R = new n.default(x, A, S), L = Math.sqrt(x * x + A * A + S * S);
function O(t, e, i) {
var r, s, u, h, _ = M.length / 3, f = w[t], d = E[t];
for (h = 0; h <= i; h++) for (u = 0; u <= e; u++) {
r = u / e;
s = h / i;
n.default.lerp(o, T[f[0]], T[f[1]], r);
n.default.lerp(a, T[f[0]], T[f[2]], s);
n.default.subtract(c, a, T[f[0]]);
n.default.add(l, o, c);
M.push(l.x, l.y, l.z);
B.push(d[0], d[1], d[2]);
I.push(r, s);
if (u < e && h < i) {
var p = e + 1, m = u + h * p, y = u + (h + 1) * p, v = u + 1 + (h + 1) * p, g = u + 1 + h * p;
if (C) {
D.push(_ + m, _ + y, _ + g);
D.push(_ + g, _ + y, _ + v);
} else {
D.push(_ + m, _ + g, _ + y);
D.push(_ + y, _ + g, _ + v);
}
}
}
}
O(0, v, g);
O(4, b, g);
O(1, v, g);
O(5, b, g);
O(3, v, b);
O(2, v, b);
return new r.default(M, B, I, D, P, R, L);
};
var n = s(t("../../value-types/vec3")), r = s(t("./vertex-data"));
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
var o = new n.default(), a = new n.default(), c = new n.default(), l = new n.default(), u = new n.default(), h = new n.default(), _ = new n.default(), f = new n.default(), d = new n.default(), p = new n.default(), m = new n.default(), y = new n.default();
e.exports = i.default;
}), {
"../../value-types/vec3": 347,
"./vertex-data": 62
} ],
52: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = function(t, e, i, s) {
void 0 === t && (t = .5);
void 0 === e && (e = .5);
void 0 === i && (i = 2);
void 0 === s && (s = {
sides: 32,
heightSegments: 32,
arc: 2 * Math.PI
});
var c = i - t - e, l = s.sides, u = s.heightSegments, h = e / i, _ = c / i, f = t / i, d = Math.floor(u * h), p = Math.floor(u * f), m = Math.floor(u * _), y = c + e - i / 2, v = e - i / 2, g = e - i / 2, b = s.arc, C = [], x = [], A = [], S = [], T = Math.max(t, e), w = cc.v3(-T, -i / 2, -T), E = cc.v3(T, i / 2, T), M = i / 2, B = 0, I = [];
(function() {
for (var t = 0; t <= d; ++t) for (var i = t * Math.PI / d / 2, n = Math.sin(i), r = -Math.cos(i), s = 0; s <= l; ++s) {
var o = 2 * s * Math.PI / l - Math.PI / 2, a = Math.sin(o) * n, c = r, h = Math.cos(o) * n, _ = s / l, f = t / u;
C.push(a * e, c * e + g, h * e);
x.push(a, c, h);
A.push(_, f);
if (t < d && s < l) {
var p = l + 1, m = p * t + s, y = p * (t + 1) + s, v = p * (t + 1) + s + 1, b = p * t + s + 1;
S.push(m, b, y);
S.push(b, v, y);
}
++B;
}
})();
(function() {
for (var i = (t - e) / c, r = 0; r <= m; r++) {
for (var s = [], u = r / m, f = u * (t - e) + e, d = 0; d <= l; ++d) {
var p = d / l, y = u * _ + h, g = p * b - b / 4, T = Math.sin(g), w = Math.cos(g);
C.push(f * T);
C.push(u * c + v);
C.push(f * w);
n.default.normalize(o, n.default.set(a, T, -i, w));
x.push(o.x);
x.push(o.y);
x.push(o.z);
A.push(p, y);
s.push(B);
++B;
}
I.push(s);
}
for (var E = 0; E < m; ++E) for (var M = 0; M < l; ++M) {
var D = I[E][M], P = I[E + 1][M], R = I[E + 1][M + 1], L = I[E][M + 1];
S.push(D);
S.push(L);
S.push(P);
S.push(L);
S.push(R);
S.push(P);
}
})();
(function() {
for (var e = 0; e <= p; ++e) for (var i = e * Math.PI / p / 2 + Math.PI / 2, n = Math.sin(i), r = -Math.cos(i), s = 0; s <= l; ++s) {
var o = 2 * s * Math.PI / l - Math.PI / 2, a = Math.sin(o) * n, c = r, h = Math.cos(o) * n, _ = s / l, d = e / u + (1 - f);
C.push(a * t, c * t + y, h * t);
x.push(a, c, h);
A.push(_, d);
if (e < p && s < l) {
var v = l + 1, g = v * e + s + I[m][l] + 1, b = v * (e + 1) + s + I[m][l] + 1, T = v * (e + 1) + s + 1 + I[m][l] + 1, w = v * e + s + 1 + I[m][l] + 1;
S.push(g, w, b);
S.push(w, T, b);
}
}
})();
return new r.default(C, x, A, S, w, E, M);
};
var n = s(t("../../value-types/vec3")), r = s(t("./vertex-data"));
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
var o = cc.v3(0, 0, 0), a = cc.v3(0, 0, 0);
e.exports = i.default;
}), {
"../../value-types/vec3": 347,
"./vertex-data": 62
} ],
53: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = function(t, e, i) {
void 0 === t && (t = .5);
void 0 === e && (e = 1);
void 0 === i && (i = {
radialSegments: 32,
heightSegments: 1,
capped: !0,
arc: 2 * Math.PI
});
return (0, r.default)(0, t, e, i);
};
var n, r = (n = t("./cylinder")) && n.__esModule ? n : {
default: n
};
e.exports = i.default;
}), {
"./cylinder": 54
} ],
54: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = function(t, e, i, s) {
void 0 === t && (t = .5);
void 0 === e && (e = .5);
void 0 === i && (i = 2);
void 0 === s && (s = {
radialSegments: 32,
heightSegments: 1,
capped: !0,
arc: 2 * Math.PI
});
var c = .5 * i, l = s.radialSegments, u = s.heightSegments, h = s.capped, _ = s.arc, f = 0;
if (!h) {
t > 0 && f++;
e > 0 && f++;
}
var d = (l + 1) * (u + 1);
h && (d += (l + 1) * f + l * f);
var p = l * u * 6;
h && (p += l * f * 3);
var m = new Array(p), y = new Array(3 * d), v = new Array(3 * d), g = new Array(2 * d), b = Math.max(t, e), C = new n.default(-b, -c, -b), x = new n.default(b, c, b), A = Math.sqrt(b * b + c * c), S = 0, T = 0;
(function() {
for (var r = [], s = t - e, h = s * s / i * Math.sign(s), f = 0; f <= u; f++) {
for (var d = [], p = f / u, b = p * s + e, C = 0; C <= l; ++C) {
var x = C / l, A = x * _, w = Math.sin(A), E = Math.cos(A);
y[3 * S] = b * w;
y[3 * S + 1] = p * i - c;
y[3 * S + 2] = b * E;
n.default.normalize(o, n.default.set(a, w, -h, E));
v[3 * S] = o.x;
v[3 * S + 1] = o.y;
v[3 * S + 2] = o.z;
g[2 * S] = 2 * (1 - x) % 1;
g[2 * S + 1] = p;
d.push(S);
++S;
}
r.push(d);
}
for (var M = 0; M < u; ++M) for (var B = 0; B < l; ++B) {
var I = r[M][B], D = r[M + 1][B], P = r[M + 1][B + 1], R = r[M][B + 1];
m[T] = I;
m[++T] = R;
m[++T] = D;
m[++T] = R;
m[++T] = P;
m[++T] = D;
++T;
}
})();
if (h) {
e > 0 && w(!1);
t > 0 && w(!0);
}
return new r.default(y, v, g, m, C, x, A);
function w(i) {
var n, r, s = i ? t : e, o = i ? 1 : -1;
n = S;
for (var a = 1; a <= l; ++a) {
y[3 * S] = 0;
y[3 * S + 1] = c * o;
y[3 * S + 2] = 0;
v[3 * S] = 0;
v[3 * S + 1] = o;
v[3 * S + 2] = 0;
g[2 * S] = .5;
g[2 * S + 1] = .5;
++S;
}
r = S;
for (var u = 0; u <= l; ++u) {
var h = u / l * _, f = Math.cos(h), d = Math.sin(h);
y[3 * S] = s * d;
y[3 * S + 1] = c * o;
y[3 * S + 2] = s * f;
v[3 * S] = 0;
v[3 * S + 1] = o;
v[3 * S + 2] = 0;
g[2 * S] = .5 - .5 * d * o;
g[2 * S + 1] = .5 + .5 * f;
++S;
}
for (var p = 0; p < l; ++p) {
var b = n + p, C = r + p;
if (i) {
m[T] = C + 1;
m[++T] = b;
m[++T] = C;
++T;
} else {
m[T] = b;
m[++T] = C + 1;
m[++T] = C;
++T;
}
}
}
};
var n = s(t("../../value-types/vec3")), r = s(t("./vertex-data"));
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
var o = new n.default(), a = new n.default();
e.exports = i.default;
}), {
"../../value-types/vec3": 347,
"./vertex-data": 62
} ],
55: [ (function(t) {
"use strict";
var e = (function(t) {
if (t && t.__esModule) return t;
if (null === t || "object" != typeof t && "function" != typeof t) return {
default: t
};
var e = f(void 0);
if (e && e.has(t)) return e.get(t);
var i = {}, n = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var r in t) if ("default" !== r && Object.prototype.hasOwnProperty.call(t, r)) {
var s = n ? Object.getOwnPropertyDescriptor(t, r) : null;
s && (s.get || s.set) ? Object.defineProperty(i, r, s) : i[r] = t[r];
}
i.default = t;
e && e.set(t, i);
return i;
})(t("./utils")), i = _(t("./box")), n = _(t("./cone")), r = _(t("./cylinder")), s = _(t("./plane")), o = _(t("./quad")), a = _(t("./sphere")), c = _(t("./torus")), l = _(t("./capsule")), u = t("./polyhedron"), h = _(t("./vertex-data"));
function _(t) {
return t && t.__esModule ? t : {
default: t
};
}
function f(t) {
if ("function" != typeof WeakMap) return null;
var e = new WeakMap(), i = new WeakMap();
return (f = function(t) {
return t ? i : e;
})(t);
}
cc.primitive = Object.assign({
box: i.default,
cone: n.default,
cylinder: r.default,
plane: s.default,
quad: o.default,
sphere: a.default,
torus: c.default,
capsule: l.default,
polyhedron: u.polyhedron,
PolyhedronType: u.PolyhedronType,
VertexData: h.default
}, e);
}), {
"./box": 51,
"./capsule": 52,
"./cone": 53,
"./cylinder": 54,
"./plane": 56,
"./polyhedron": 57,
"./quad": 58,
"./sphere": 59,
"./torus": 60,
"./utils": 61,
"./vertex-data": 62
} ],
56: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = function(t, e, i) {
void 0 === t && (t = 10);
void 0 === e && (e = 10);
void 0 === i && (i = {
widthSegments: 10,
lengthSegments: 10
});
var s = i.widthSegments, f = i.lengthSegments, d = .5 * t, p = .5 * e, m = [], y = [], v = [], g = [], b = new n.default(-d, 0, -p), C = new n.default(d, 0, p), x = Math.sqrt(t * t + e * e);
n.default.set(u, -d, 0, p);
n.default.set(h, d, 0, p);
n.default.set(_, -d, 0, -p);
for (var A = 0; A <= f; A++) for (var S = 0; S <= s; S++) {
var T = S / s, w = A / f;
n.default.lerp(o, u, h, T);
n.default.lerp(a, u, _, w);
n.default.sub(c, a, u);
n.default.add(l, o, c);
m.push(l.x, l.y, l.z);
y.push(0, 1, 0);
v.push(T, w);
if (S < s && A < f) {
var E = s + 1, M = S + A * E, B = S + (A + 1) * E, I = S + 1 + (A + 1) * E, D = S + 1 + A * E;
g.push(M, D, B);
g.push(D, I, B);
}
}
return new r.default(m, y, v, g, b, C, x);
};
var n = s(t("../../value-types/vec3")), r = s(t("./vertex-data"));
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
var o = new n.default(), a = new n.default(), c = new n.default(), l = new n.default(), u = new n.default(), h = new n.default(), _ = new n.default();
e.exports = i.default;
}), {
"../../value-types/vec3": 347,
"./vertex-data": 62
} ],
57: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.polyhedron = i.PolyhedronType = void 0;
var n, r = t("./utils"), s = (n = t("./vertex-data")) && n.__esModule ? n : {
default: n
}, o = t("../../value-types"), a = cc.Enum({
Tetrahedron: 0,
Octahedron: 1,
Dodecahedron: 2,
Icosahedron: 3,
Rhombicuboctahedron: 4,
TriangularPrism: 5,
PentagonalPrism: 6,
HexagonalPrism: 7,
SquarePyramid: 8,
PentagonalPyramid: 9,
TriangularDipyramid: 10,
PentagonalDipyramid: 11,
ElongatedSquareDipyramid: 12,
ElongatedPentagonalDipyramid: 13,
ElongatedPentagonalCupola: 14
});
i.PolyhedronType = a;
var c = [];
c[0] = {
vertex: [ [ 0, 0, 1.732051 ], [ 1.632993, 0, -.5773503 ], [ -.8164966, 1.414214, -.5773503 ], [ -.8164966, -1.414214, -.5773503 ] ],
face: [ [ 0, 1, 2 ], [ 0, 2, 3 ], [ 0, 3, 1 ], [ 1, 3, 2 ] ]
};
c[1] = {
vertex: [ [ 0, 0, 1.414214 ], [ 1.414214, 0, 0 ], [ 0, 1.414214, 0 ], [ -1.414214, 0, 0 ], [ 0, -1.414214, 0 ], [ 0, 0, -1.414214 ] ],
face: [ [ 0, 1, 2 ], [ 0, 2, 3 ], [ 0, 3, 4 ], [ 0, 4, 1 ], [ 1, 4, 5 ], [ 1, 5, 2 ], [ 2, 5, 3 ], [ 3, 5, 4 ] ]
};
c[2] = {
vertex: [ [ 0, 0, 1.070466 ], [ .7136442, 0, .7978784 ], [ -.3568221, .618034, .7978784 ], [ -.3568221, -.618034, .7978784 ], [ .7978784, .618034, .3568221 ], [ .7978784, -.618034, .3568221 ], [ -.9341724, .381966, .3568221 ], [ .1362939, 1, .3568221 ], [ .1362939, -1, .3568221 ], [ -.9341724, -.381966, .3568221 ], [ .9341724, .381966, -.3568221 ], [ .9341724, -.381966, -.3568221 ], [ -.7978784, .618034, -.3568221 ], [ -.1362939, 1, -.3568221 ], [ -.1362939, -1, -.3568221 ], [ -.7978784, -.618034, -.3568221 ], [ .3568221, .618034, -.7978784 ], [ .3568221, -.618034, -.7978784 ], [ -.7136442, 0, -.7978784 ], [ 0, 0, -1.070466 ] ],
face: [ [ 0, 1, 4, 7, 2 ], [ 0, 2, 6, 9, 3 ], [ 0, 3, 8, 5, 1 ], [ 1, 5, 11, 10, 4 ], [ 2, 7, 13, 12, 6 ], [ 3, 9, 15, 14, 8 ], [ 4, 10, 16, 13, 7 ], [ 5, 8, 14, 17, 11 ], [ 6, 12, 18, 15, 9 ], [ 10, 11, 17, 19, 16 ], [ 12, 13, 16, 19, 18 ], [ 14, 15, 18, 19, 17 ] ]
};
c[3] = {
vertex: [ [ 0, 0, 1.175571 ], [ 1.051462, 0, .5257311 ], [ .3249197, 1, .5257311 ], [ -.8506508, .618034, .5257311 ], [ -.8506508, -.618034, .5257311 ], [ .3249197, -1, .5257311 ], [ .8506508, .618034, -.5257311 ], [ .8506508, -.618034, -.5257311 ], [ -.3249197, 1, -.5257311 ], [ -1.051462, 0, -.5257311 ], [ -.3249197, -1, -.5257311 ], [ 0, 0, -1.175571 ] ],
face: [ [ 0, 1, 2 ], [ 0, 2, 3 ], [ 0, 3, 4 ], [ 0, 4, 5 ], [ 0, 5, 1 ], [ 1, 5, 7 ], [ 1, 7, 6 ], [ 1, 6, 2 ], [ 2, 6, 8 ], [ 2, 8, 3 ], [ 3, 8, 9 ], [ 3, 9, 4 ], [ 4, 9, 10 ], [ 4, 10, 5 ], [ 5, 10, 7 ], [ 6, 7, 11 ], [ 6, 11, 8 ], [ 7, 10, 11 ], [ 8, 11, 9 ], [ 9, 11, 10 ] ]
};
c[4] = {
vertex: [ [ 0, 0, 1.070722 ], [ .7148135, 0, .7971752 ], [ -.104682, .7071068, .7971752 ], [ -.6841528, .2071068, .7971752 ], [ -.104682, -.7071068, .7971752 ], [ .6101315, .7071068, .5236279 ], [ 1.04156, .2071068, .1367736 ], [ .6101315, -.7071068, .5236279 ], [ -.3574067, 1, .1367736 ], [ -.7888348, -.5, .5236279 ], [ -.9368776, .5, .1367736 ], [ -.3574067, -1, .1367736 ], [ .3574067, 1, -.1367736 ], [ .9368776, -.5, -.1367736 ], [ .7888348, .5, -.5236279 ], [ .3574067, -1, -.1367736 ], [ -.6101315, .7071068, -.5236279 ], [ -1.04156, -.2071068, -.1367736 ], [ -.6101315, -.7071068, -.5236279 ], [ .104682, .7071068, -.7971752 ], [ .6841528, -.2071068, -.7971752 ], [ .104682, -.7071068, -.7971752 ], [ -.7148135, 0, -.7971752 ], [ 0, 0, -1.070722 ] ],
face: [ [ 0, 2, 3 ], [ 1, 6, 5 ], [ 4, 9, 11 ], [ 7, 15, 13 ], [ 8, 16, 10 ], [ 12, 14, 19 ], [ 17, 22, 18 ], [ 20, 21, 23 ], [ 0, 1, 5, 2 ], [ 0, 3, 9, 4 ], [ 0, 4, 7, 1 ], [ 1, 7, 13, 6 ], [ 2, 5, 12, 8 ], [ 2, 8, 10, 3 ], [ 3, 10, 17, 9 ], [ 4, 11, 15, 7 ], [ 5, 6, 14, 12 ], [ 6, 13, 20, 14 ], [ 8, 12, 19, 16 ], [ 9, 17, 18, 11 ], [ 10, 16, 22, 17 ], [ 11, 18, 21, 15 ], [ 13, 15, 21, 20 ], [ 14, 20, 23, 19 ], [ 16, 19, 23, 22 ], [ 18, 22, 23, 21 ] ]
};
c[5] = {
vertex: [ [ 0, 0, 1.322876 ], [ 1.309307, 0, .1889822 ], [ -.9819805, .8660254, .1889822 ], [ .1636634, -1.299038, .1889822 ], [ .3273268, .8660254, -.9449112 ], [ -.8183171, -.4330127, -.9449112 ] ],
face: [ [ 0, 3, 1 ], [ 2, 4, 5 ], [ 0, 1, 4, 2 ], [ 0, 2, 5, 3 ], [ 1, 3, 5, 4 ] ]
};
c[6] = {
vertex: [ [ 0, 0, 1.159953 ], [ 1.013464, 0, .5642542 ], [ -.3501431, .9510565, .5642542 ], [ -.7715208, -.6571639, .5642542 ], [ .6633206, .9510565, -.03144481 ], [ .8682979, -.6571639, -.3996071 ], [ -1.121664, .2938926, -.03144481 ], [ -.2348831, -1.063314, -.3996071 ], [ .5181548, .2938926, -.9953061 ], [ -.5850262, -.112257, -.9953061 ] ],
face: [ [ 0, 1, 4, 2 ], [ 0, 2, 6, 3 ], [ 1, 5, 8, 4 ], [ 3, 6, 9, 7 ], [ 5, 7, 9, 8 ], [ 0, 3, 7, 5, 1 ], [ 2, 4, 8, 9, 6 ] ]
};
c[7] = {
vertex: [ [ 0, 0, 1.118034 ], [ .8944272, 0, .6708204 ], [ -.2236068, .8660254, .6708204 ], [ -.7826238, -.4330127, .6708204 ], [ .6708204, .8660254, .2236068 ], [ 1.006231, -.4330127, -.2236068 ], [ -1.006231, .4330127, .2236068 ], [ -.6708204, -.8660254, -.2236068 ], [ .7826238, .4330127, -.6708204 ], [ .2236068, -.8660254, -.6708204 ], [ -.8944272, 0, -.6708204 ], [ 0, 0, -1.118034 ] ],
face: [ [ 0, 1, 4, 2 ], [ 0, 2, 6, 3 ], [ 1, 5, 8, 4 ], [ 3, 6, 10, 7 ], [ 5, 9, 11, 8 ], [ 7, 10, 11, 9 ], [ 0, 3, 7, 9, 5, 1 ], [ 2, 4, 8, 11, 10, 6 ] ]
};
c[8] = {
vertex: [ [ -.729665, .670121, .319155 ], [ -.655235, -.29213, -.754096 ], [ -.093922, -.607123, .537818 ], [ .702196, .595691, .485187 ], [ .776626, -.36656, -.588064 ] ],
face: [ [ 1, 4, 2 ], [ 0, 1, 2 ], [ 3, 0, 2 ], [ 4, 3, 2 ], [ 4, 1, 0, 3 ] ]
};
c[9] = {
vertex: [ [ -.868849, -.100041, .61257 ], [ -.329458, .976099, .28078 ], [ -.26629, -.013796, -.477654 ], [ -.13392, -1.034115, .229829 ], [ .738834, .707117, -.307018 ], [ .859683, -.535264, -.338508 ] ],
face: [ [ 3, 0, 2 ], [ 5, 3, 2 ], [ 4, 5, 2 ], [ 1, 4, 2 ], [ 0, 1, 2 ], [ 0, 3, 5, 4, 1 ] ]
};
c[10] = {
vertex: [ [ -.610389, .243975, .531213 ], [ -.187812, -.48795, -.664016 ], [ -.187812, .9759, -.664016 ], [ .187812, -.9759, .664016 ], [ .798201, .243975, .132803 ] ],
face: [ [ 1, 3, 0 ], [ 3, 4, 0 ], [ 3, 1, 4 ], [ 0, 2, 1 ], [ 0, 4, 2 ], [ 2, 4, 1 ] ]
};
c[11] = {
vertex: [ [ -1.028778, .392027, -.048786 ], [ -.640503, -.646161, .621837 ], [ -.125162, -.395663, -.540059 ], [ .004683, .888447, -.651988 ], [ .125161, .395663, .540059 ], [ .632925, -.791376, .433102 ], [ 1.031672, .157063, -.354165 ] ],
face: [ [ 3, 2, 0 ], [ 2, 1, 0 ], [ 2, 5, 1 ], [ 0, 4, 3 ], [ 0, 1, 4 ], [ 4, 1, 5 ], [ 2, 3, 6 ], [ 3, 4, 6 ], [ 5, 2, 6 ], [ 4, 5, 6 ] ]
};
c[12] = {
vertex: [ [ -.669867, .334933, -.529576 ], [ -.669867, .334933, .529577 ], [ -.4043, 1.212901, 0 ], [ -.334933, -.669867, -.529576 ], [ -.334933, -.669867, .529577 ], [ .334933, .669867, -.529576 ], [ .334933, .669867, .529577 ], [ .4043, -1.212901, 0 ], [ .669867, -.334933, -.529576 ], [ .669867, -.334933, .529577 ] ],
face: [ [ 8, 9, 7 ], [ 6, 5, 2 ], [ 3, 8, 7 ], [ 5, 0, 2 ], [ 4, 3, 7 ], [ 0, 1, 2 ], [ 9, 4, 7 ], [ 1, 6, 2 ], [ 9, 8, 5, 6 ], [ 8, 3, 0, 5 ], [ 3, 4, 1, 0 ], [ 4, 9, 6, 1 ] ]
};
c[13] = {
vertex: [ [ -.931836, .219976, -.264632 ], [ -.636706, .318353, .692816 ], [ -.613483, -.735083, -.264632 ], [ -.326545, .979634, 0 ], [ -.318353, -.636706, .692816 ], [ -.159176, .477529, -.856368 ], [ .159176, -.477529, -.856368 ], [ .318353, .636706, .692816 ], [ .326545, -.979634, 0 ], [ .613482, .735082, -.264632 ], [ .636706, -.318353, .692816 ], [ .931835, -.219977, -.264632 ] ],
face: [ [ 11, 10, 8 ], [ 7, 9, 3 ], [ 6, 11, 8 ], [ 9, 5, 3 ], [ 2, 6, 8 ], [ 5, 0, 3 ], [ 4, 2, 8 ], [ 0, 1, 3 ], [ 10, 4, 8 ], [ 1, 7, 3 ], [ 10, 11, 9, 7 ], [ 11, 6, 5, 9 ], [ 6, 2, 0, 5 ], [ 2, 4, 1, 0 ], [ 4, 10, 7, 1 ] ]
};
c[14] = {
vertex: [ [ -.93465, .300459, -.271185 ], [ -.838689, -.260219, -.516017 ], [ -.711319, .717591, .128359 ], [ -.710334, -.156922, .080946 ], [ -.599799, .556003, -.725148 ], [ -.503838, -.004675, -.969981 ], [ -.487004, .26021, .48049 ], [ -.460089, -.750282, -.512622 ], [ -.376468, .973135, -.325605 ], [ -.331735, -.646985, .084342 ], [ -.254001, .831847, .530001 ], [ -.125239, -.494738, -.966586 ], [ .029622, .027949, .730817 ], [ .056536, -.982543, -.262295 ], [ .08085, 1.087391, .076037 ], [ .125583, -.532729, .485984 ], [ .262625, .599586, .780328 ], [ .391387, -.726999, -.716259 ], [ .513854, -.868287, .139347 ], [ .597475, .85513, .326364 ], [ .641224, .109523, .783723 ], [ .737185, -.451155, .538891 ], [ .848705, -.612742, -.314616 ], [ .976075, .365067, .32976 ], [ 1.072036, -.19561, .084927 ] ],
face: [ [ 15, 18, 21 ], [ 12, 20, 16 ], [ 6, 10, 2 ], [ 3, 0, 1 ], [ 9, 7, 13 ], [ 2, 8, 4, 0 ], [ 0, 4, 5, 1 ], [ 1, 5, 11, 7 ], [ 7, 11, 17, 13 ], [ 13, 17, 22, 18 ], [ 18, 22, 24, 21 ], [ 21, 24, 23, 20 ], [ 20, 23, 19, 16 ], [ 16, 19, 14, 10 ], [ 10, 14, 8, 2 ], [ 15, 9, 13, 18 ], [ 12, 15, 21, 20 ], [ 6, 12, 16, 10 ], [ 3, 6, 2, 0 ], [ 9, 3, 1, 7 ], [ 9, 15, 12, 6, 3 ], [ 22, 17, 11, 5, 4, 8, 14, 19, 23, 24 ] ]
};
i.polyhedron = function(t, e, i) {
void 0 === e && (e = 1);
void 0 === i && (i = {
sizeX: 0,
sizeY: 0,
sizeZ: 0
});
t = t && (t < 0 || t >= c.length) ? 0 : t || 0;
for (var n = i.sizeX || e, a = i.sizeY || e, l = i.sizeZ || e, u = c[t], h = u.face.length, _ = [], f = [], d = [], p = [], m = new o.Vec3(Infinity, Infinity, Infinity), y = new o.Vec3(-Infinity, -Infinity, -Infinity), v = 0; v < u.vertex.length; v++) {
var g = u.vertex[v][0] * n, b = u.vertex[v][1] * a, C = u.vertex[v][2] * l;
m.x = Math.min(m.x, g);
m.y = Math.min(m.y, b);
m.z = Math.min(m.z, C);
y.x = Math.max(y.x, g);
y.y = Math.max(y.y, b);
y.z = Math.max(y.z, C);
_.push(g, b, C);
p.push(0, 0);
}
for (var x = 0; x < h; x++) for (var A = 0; A < u.face[x].length - 2; A++) f.push(u.face[x][0], u.face[x][A + 2], u.face[x][A + 1]);
(0, r.calcNormals)(_, f, d);
var S = Math.sqrt(Math.pow(y.x - m.x, 2), Math.pow(y.y - m.y, 2), Math.pow(y.z - m.z, 2));
return new s.default(_, d, p, f, m, y, S);
};
}), {
"../../value-types": 337,
"./utils": 61,
"./vertex-data": 62
} ],
58: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = function() {
return new r.default(o, a, c, l, u, h, _);
};
var n, r = (n = t("./vertex-data")) && n.__esModule ? n : {
default: n
}, s = t("../../value-types"), o = [ -.5, -.5, 0, -.5, .5, 0, .5, .5, 0, .5, -.5, 0 ], a = [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 ], c = [ 0, 0, 0, 1, 1, 1, 1, 0 ], l = [ 0, 3, 1, 3, 2, 1 ], u = new s.Vec3(-.5, -.5, 0), h = new s.Vec3(.5, .5, 0), _ = Math.sqrt(.5);
e.exports = i.default;
}), {
"../../value-types": 337,
"./vertex-data": 62
} ],
59: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = function(t, e) {
void 0 === t && (t = .5);
void 0 === e && (e = {
segments: 32
});
for (var i = e.segments, n = [], o = [], a = [], c = [], l = new s.Vec3(-t, -t, -t), u = new s.Vec3(t, t, t), h = t, _ = 0; _ <= i; ++_) for (var f = _ * Math.PI / i, d = Math.sin(f), p = -Math.cos(f), m = 0; m <= i; ++m) {
var y = 2 * m * Math.PI / i - Math.PI / 2, v = Math.sin(y) * d, g = p, b = Math.cos(y) * d, C = m / i, x = _ / i;
n.push(v * t, g * t, b * t);
o.push(v, g, b);
a.push(C, x);
if (_ < i && m < i) {
var A = i + 1, S = A * _ + m, T = A * (_ + 1) + m, w = A * (_ + 1) + m + 1, E = A * _ + m + 1;
c.push(S, E, T);
c.push(E, w, T);
}
}
return new r.default(n, o, a, c, l, u, h);
};
var n, r = (n = t("./vertex-data")) && n.__esModule ? n : {
default: n
}, s = t("../../value-types");
e.exports = i.default;
}), {
"../../value-types": 337,
"./vertex-data": 62
} ],
60: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = function(t, e, i) {
void 0 === t && (t = .4);
void 0 === e && (e = .1);
void 0 === i && (i = {
radialSegments: 32,
tubularSegments: 32,
arc: 2 * Math.PI
});
for (var n = i.radialSegments, o = i.tubularSegments, a = i.arc, c = [], l = [], u = [], h = [], _ = new s.Vec3(-t - e, -e, -t - e), f = new s.Vec3(t + e, e, t + e), d = t + e, p = 0; p <= n; p++) for (var m = 0; m <= o; m++) {
var y = m / o, v = p / n, g = y * a, b = v * Math.PI * 2, C = (t + e * Math.cos(b)) * Math.sin(g), x = e * Math.sin(b), A = (t + e * Math.cos(b)) * Math.cos(g), S = Math.sin(g) * Math.cos(b), T = Math.sin(b), w = Math.cos(g) * Math.cos(b);
c.push(C, x, A);
l.push(S, T, w);
u.push(y, v);
if (m < o && p < n) {
var E = o + 1, M = E * p + m, B = E * (p + 1) + m, I = E * (p + 1) + m + 1, D = E * p + m + 1;
h.push(M, D, B);
h.push(D, I, B);
}
}
return new r.default(c, l, u, h, _, f, d);
};
var n, r = (n = t("./vertex-data")) && n.__esModule ? n : {
default: n
}, s = t("../../value-types");
e.exports = i.default;
}), {
"../../value-types": 337,
"./vertex-data": 62
} ],
61: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.wireframe = function(t) {
for (var e = [ [ 0, 1 ], [ 1, 2 ], [ 2, 0 ] ], i = [], n = {}, r = 0; r < t.length; r += 3) for (var s = 0; s < 3; ++s) {
var o = t[r + e[s][0]], a = t[r + e[s][1]], c = o > a ? a << 16 | o : o << 16 | a;
if (void 0 === n[c]) {
n[c] = 0;
i.push(o, a);
}
}
return i;
};
i.invWinding = function(t) {
for (var e = [], i = 0; i < t.length; i += 3) e.push(t[i], t[i + 2], t[i + 1]);
return e;
};
i.toWavefrontOBJ = function(t, e) {
void 0 === e && (e = 1);
for (var i = t.positions, n = t.uvs, r = t.normals, s = t.indices, o = function(t) {
return s[t] + 1 + "/" + (s[t] + 1) + "/" + (s[t] + 1);
}, a = "", c = 0; c < i.length; c += 3) a += "v " + i[c] * e + " " + i[c + 1] * e + " " + i[c + 2] * e + "\n";
for (var l = 0; l < n.length; l += 2) a += "vt " + n[l] + " " + n[l + 1] + "\n";
for (var u = 0; u < r.length; u += 3) a += "vn " + r[u] + " " + r[u + 1] + " " + r[u + 2] + "\n";
for (var h = 0; h < s.length; h += 3) a += "f " + o(h) + " " + o(h + 1) + " " + o(h + 2) + "\n";
return a;
};
i.normals = function(t, e, i) {
void 0 === i && (i = 1);
for (var n = new Array(2 * t.length), r = 0; r < t.length / 3; ++r) {
var s = 3 * r, o = 6 * r;
n[o + 0] = t[s + 0];
n[o + 1] = t[s + 1];
n[o + 2] = t[s + 2];
n[o + 3] = t[s + 0] + e[s + 0] * i;
n[o + 4] = t[s + 1] + e[s + 1] * i;
n[o + 5] = t[s + 2] + e[s + 2] * i;
}
return n;
};
i.calcNormals = function(t, e, i) {
for (var n = 0, o = (i = i || new Array(t.length)).length; n < o; n++) i[n] = 0;
for (var a, c, l, u = cc.v3(), h = cc.v3(), _ = cc.v3(), f = cc.v3(), d = cc.v3(), p = 0, m = e.length; p < m; p += 3) {
a = 3 * e[p + 0];
c = 3 * e[p + 1];
l = 3 * e[p + 2];
s(u, t, a);
s(h, t, c);
s(_, t, l);
r.default.subtract(f, _, h);
r.default.subtract(d, u, h);
r.default.cross(f, f, d);
i[a] += f.x;
i[a + 1] += f.y;
i[a + 2] += f.z;
i[c] += f.x;
i[c + 1] += f.y;
i[c + 2] += f.z;
i[l] += f.x;
i[l + 1] += f.y;
i[l + 2] += f.z;
}
for (var y = cc.v3(), v = 0, g = i.length; v < g; v += 3) {
y.x = i[v];
y.y = i[v + 1];
y.z = i[v + 2];
y.normalizeSelf();
i[v] = y.x;
i[v + 1] = y.y;
i[v + 2] = y.z;
}
return i;
};
var n, r = (n = t("../../value-types/vec3")) && n.__esModule ? n : {
default: n
};
function s(t, e, i) {
t.x = e[i];
t.y = e[i + 1];
t.z = e[i + 2];
}
}), {
"../../value-types/vec3": 347
} ],
62: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
i.default = function(t, e, i, n, r, s, o) {
this.positions = void 0;
this.normals = void 0;
this.uvs = void 0;
this.indices = void 0;
this.minPos = void 0;
this.maxPos = void 0;
this.boundingRadius = void 0;
this.positions = t;
this.normals = e;
this.uvs = i;
this.indices = n;
this.minPos = r;
this.maxPos = s;
this.boundingRadius = o;
};
e.exports = i.default;
}), {} ],
63: [ (function(t, e) {
"use strict";
var i = t("../../../animation/animation-curves"), n = i.DynamicAnimCurve, r = i.quickFindIndex, s = cc.Class({
name: "cc.JointMatrixCurve",
extends: n,
_findFrameIndex: r,
sample: function(t, e) {
var i = this.ratios, n = this._findFrameIndex(i, e);
n < -1 && (n = ~n - 1);
for (var r = this.pairs, s = 0; s < r.length; s++) {
var o = r[s];
o.target._jointMatrix = o.values[n];
}
}
});
e.exports = s;
}), {
"../../../animation/animation-curves": 11
} ],
64: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.Skeleton",
extends: cc.Asset,
ctor: function() {
this.loaded = !1;
this._bindposes = [];
this._uniqueBindPoses = [];
this._jointPaths = [];
},
properties: {
_model: cc.Model,
_jointIndices: [],
_skinIndex: -1,
jointPaths: {
get: function() {
return this._jointPaths;
}
},
bindposes: {
get: function() {
return this._bindposes;
}
},
uniqueBindPoses: {
get: function() {
return this._uniqueBindPoses;
}
},
model: {
get: function() {
return this._model;
}
}
},
onLoad: function() {
for (var t = this._model.nodes, e = this._jointIndices, i = this._jointPaths, n = this._bindposes, r = this._uniqueBindPoses, s = 0; s < e.length; s++) {
var o = t[e[s]];
i[s] = o.path;
o.uniqueBindPose ? n[s] = r[s] = o.uniqueBindPose : n[s] = o.bindpose[this._skinIndex];
}
}
});
cc.Skeleton = e.exports = i;
}), {} ],
65: [ (function(t, e) {
"use strict";
var i = t("../../components/CCAnimation"), n = t("../CCModel"), r = t("./CCSkeletonAnimationClip"), s = cc.Class({
name: "cc.SkeletonAnimation",
extends: i,
editor: !1,
properties: {
_model: {
default: null,
type: n
},
_defaultClip: {
override: !0,
default: null,
type: r
},
_clips: {
override: !0,
default: [],
type: [ r ],
visible: !0
},
defaultClip: {
override: !0,
get: function() {
return this._defaultClip;
},
set: function(t) {
this._defaultClip = t;
},
type: r
},
model: {
get: function() {
return this._model;
},
set: function(t) {
this._model = t;
this._updateClipModel();
},
type: n
}
},
__preload: function() {
this._updateClipModel();
},
_updateClipModel: function() {
this._defaultClip && (this._defaultClip._model = this._model);
for (var t = this._clips, e = 0; e < t.length; e++) t[e]._model = this._model;
},
addClip: function(t, e) {
t._model = this._model;
return i.prototype.addClip.call(this, t, e);
},
searchClips: !1
});
cc.SkeletonAnimation = e.exports = s;
}), {
"../../components/CCAnimation": 144,
"../CCModel": 27,
"./CCSkeletonAnimationClip": 66,
"fire-path": void 0
} ],
66: [ (function(t, e) {
"use strict";
var i, n = (i = t("../../value-types/mat4")) && i.__esModule ? i : {
default: i
}, r = t("../../../animation/animation-clip"), s = t("./CCJointMatrixCurve");
function o(t) {
var e = new Float32Array(16);
e.set(t.m);
return e;
}
var a = cc.Class({
name: "cc.SkeletonAnimationClip",
extends: r,
properties: {
_nativeAsset: {
override: !0,
get: function() {
return this._buffer;
},
set: function(t) {
var e = ArrayBuffer.isView(t) ? t.buffer : t;
this._buffer = new Float32Array(e || t, 0, e.byteLength / 4);
}
},
description: {
default: null,
type: Object
},
curveData: {
visible: !1,
override: !0,
get: function() {
return this._curveData || {};
},
set: function() {}
}
},
statics: {
preventDeferredLoadDependents: !0
},
_init: function() {
if (this._curveData) return this._curveData;
this._curveData = {};
this._generateCommonCurve();
this._model.precomputeJointMatrix && this._generateJointMatrixCurve();
return this._curveData;
},
_generateCommonCurve: function() {
var t = this._buffer, e = this.description, i = 0;
function n() {
return t[i++];
}
this._curveData.paths || (this._curveData.paths = {});
var r = this._curveData.paths;
for (var s in e) {
var o = e[s], a = {};
r[s] = {
props: a
};
for (var c in o) {
var l = [], u = o[c].frameCount;
i = o[c].offset;
for (var h = 0; h < u; h++) {
var _ = n(), f = void 0;
"position" === c || "scale" === c ? f = cc.v3(n(), n(), n()) : "quat" === c && (f = cc.quat(n(), n(), n(), n()));
l.push({
frame: _,
value: f
});
}
a[c] = l;
}
}
},
_generateJointMatrixCurve: function() {
var t = this._model.rootNode, e = this._curveData.paths, i = {
ratios: [],
jointMatrixMap: {}
}, r = i.jointMatrixMap;
function s(i, a, c) {
var l, u = e[i.path];
if (i !== t && u) {
var h, _ = u.props;
for (var f in _) for (var d = _[f], p = 0; p < d.length; p++) {
var m = d[p];
if (Math.abs(m.frame - a) < 1e-4) {
i[f].set(m.value);
break;
}
if (m.frame > a) {
var y = d[p - 1], v = (a - y.frame) / (m.frame - y.frame);
y.value.lerp(m.value, v, i[f]);
break;
}
}
l = cc.mat4();
n.default.fromRTS(l, i.quat, i.position, i.scale);
c && n.default.mul(l, c, l);
_._jointMatrix || (_._jointMatrix = []);
if (i.uniqueBindPose) {
h = cc.mat4();
n.default.mul(h, l, i.uniqueBindPose);
}
r[i.path] || (r[i.path] = []);
h ? r[i.path].push(o(h)) : r[i.path].push(l);
}
var g = i.children;
for (var b in g) s(g[b], a, l);
}
for (var a = 0, c = this.duration, l = 1 / this.sample; a < c; ) {
i.ratios.push(a / c);
s(t, a);
a += l;
}
this._curveData = i;
},
_createJointMatrixCurve: function(t, e) {
var i = new s();
i.ratios = this.curveData.ratios;
i.pairs = [];
var n = this.curveData.jointMatrixMap;
for (var r in n) {
var o = cc.find(r, e);
o && i.pairs.push({
target: o,
values: n[r]
});
}
return [ i ];
},
createCurves: function(t, e) {
if (!this._model) {
cc.warn("Skeleton Animation Clip [" + this.name + "] Can not find model");
return [];
}
this._init();
return this._model.precomputeJointMatrix ? this._createJointMatrixCurve(t, e) : r.prototype.createCurves.call(this, t, e);
}
});
cc.SkeletonAnimationClip = e.exports = a;
}), {
"../../../animation/animation-clip": 10,
"../../value-types/mat4": 339,
"./CCJointMatrixCurve": 63
} ],
67: [ (function(t, e) {
"use strict";
var i, n = (i = t("../../value-types/mat4")) && i.__esModule ? i : {
default: i
}, r = t("./CCSkeleton"), s = t("../../mesh/CCMeshRenderer"), o = t("../../renderer/render-flow"), a = (t("../../../renderer/enums"), 
cc.mat4()), c = cc.mat4(), l = cc.Class({
name: "cc.SkinnedMeshRenderer",
extends: s,
editor: !1,
ctor: function() {
this._jointsData = this._jointsFloat32Data = null;
this._jointsTexture = null;
this._joints = [];
this._dummyNode = new cc.Node();
this._jointsTextureOptions = null;
this._usingRGBA8Texture = !1;
},
properties: {
_skeleton: r,
_rootBone: cc.Node,
skeleton: {
get: function() {
return this._skeleton;
},
set: function(t) {
this._skeleton = t;
this._init();
},
type: r
},
rootBone: {
get: function() {
return this._rootBone;
},
set: function(t) {
this._rootBone = t;
this._init();
},
type: cc.Node
},
enableAutoBatch: {
get: function() {
return !1;
},
visible: !1,
override: !0
}
},
__preload: function() {
this._super();
this._init();
},
_init: function() {
this._model = this._skeleton && this._skeleton.model;
this._calFunc = null;
this._initJoints();
this._initJointsTexture();
this._initCalcFunc();
this._updateRenderNode();
},
_calcWorldMatrixToRoot: function(t) {
var e = t._worldMatrixToRoot;
if (!e) {
t._worldMatrixToRoot = e = cc.mat4();
t.getLocalMatrix(e);
var i = t.parent;
if (i !== this.rootBone) {
i._worldMatrixToRoot || this._calcWorldMatrixToRoot(i);
n.default.mul(e, i._worldMatrixToRoot, e);
}
}
},
_validateRender: function() {
this._jointsData ? this._super() : this.disableRender();
},
_initJoints: function() {
var t = this._joints;
t.length = 0;
if (this.skeleton && this.rootBone) {
for (var e = this._useJointMatrix(), i = this.skeleton.jointPaths, r = this.rootBone, s = 0; s < i.length; s++) {
var c = cc.find(i[s], r);
c || cc.warn("Can not find joint in root bone [%s] with path [%s]", r.name, i[s]);
if (e) {
c._renderFlag &= ~o.FLAG_CHILDREN;
this._calcWorldMatrixToRoot(c);
}
t.push(c);
}
if (e) for (var l = this.skeleton.uniqueBindPoses, u = 0; u < i.length; u++) {
var h = t[u];
if (l[u]) {
n.default.mul(a, h._worldMatrixToRoot, l[u]);
h._jointMatrix = n.default.toArray([], a);
} else h._jointMatrix = h._worldMatrixToRoot;
}
}
},
_initJointsTexture: function() {
if (this._skeleton) {
var t = this._joints.length, e = !1;
if (t <= cc.sys.getMaxJointMatrixSize()) {
e = !0;
this._jointsData = this._jointsFloat32Data = new Float32Array(16 * t);
}
if (!e) {
var i, n = !!cc.sys.glExtension("OES_texture_float");
i = t > 256 ? 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, o = i;
if (!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 a = this._jointsTexture || new cc.Texture2D(), c = cc.Texture2D.Filter.NEAREST;
a.setFilters(c, c);
a.initWithData(this._jointsData, r, s, o);
this._jointsTexture = a;
this._jointsTextureOptions = {
format: r,
width: a.width,
height: a.height,
images: []
};
}
this._updateMaterial();
}
},
_updateMaterial: function() {
s.prototype._updateMaterial.call(this);
for (var t = this.getMaterials(), e = 0; e < t.length; e++) {
var i = t[e];
if (this._jointsTexture) {
i.setProperty("jointsTexture", this._jointsTexture);
i.setProperty("jointsTextureSize", new Float32Array([ this._jointsTexture.width, this._jointsTexture.height ]));
i.define("CC_JOINTS_TEXTURE_FLOAT32", !!cc.sys.glExtension("OES_texture_float"));
i.define("CC_USE_JOINTS_TEXTRUE", !0);
} else {
this._jointsFloat32Data && i.setProperty("jointMatrices", this._jointsFloat32Data, void 0, !0);
i.define("CC_USE_JOINTS_TEXTRUE", !1);
}
i.define("CC_USE_SKINNING", !0);
}
},
_setJointsDataWithArray: function(t, e) {
this._jointsFloat32Data.set(e, 16 * t);
},
_setJointsDataWithMatrix: function(t, e) {
this._jointsFloat32Data.set(e.m, 16 * t);
},
_commitJointsData: function() {
if (this._jointsTexture) {
this._jointsTextureOptions.images[0] = this._jointsData;
this._jointsTexture.update(this._jointsTextureOptions);
}
},
_useJointMatrix: function() {
return this._model && this._model.precomputeJointMatrix;
},
_updateRenderNode: function() {
this._useJointMatrix() || this._usingRGBA8Texture ? this._assembler.setRenderNode(this.rootBone) : this._assembler.setRenderNode(this._dummyNode);
},
_initCalcFunc: function() {
this._useJointMatrix() ? this._calFunc = this._calJointMatrix : this._usingRGBA8Texture ? this._calFunc = this._calRGBA8WorldMatrix : this._calFunc = this._calWorldMatrix;
},
_calJointMatrix: function() {
for (var t = this._joints, e = this.skeleton.bindposes, i = this.skeleton.uniqueBindPoses, r = 0; r < t.length; ++r) {
var s = t[r]._jointMatrix;
if (i[r]) this._setJointsDataWithArray(r, s); else {
n.default.multiply(a, s, e[r]);
this._setJointsDataWithMatrix(r, a);
}
}
},
_calRGBA8WorldMatrix: function() {
var t = this._joints, e = this.skeleton.bindposes;
this.rootBone._updateWorldMatrix();
for (var i = this.rootBone._worldMatrix, r = n.default.invert(c, i), s = 0; s < t.length; ++s) {
var o = t[s];
o._updateWorldMatrix();
n.default.multiply(a, r, o._worldMatrix);
n.default.multiply(a, a, e[s]);
this._setJointsDataWithMatrix(s, a);
}
},
_calWorldMatrix: function() {
for (var t = this._joints, e = this.skeleton.bindposes, i = 0; i < t.length; ++i) {
var r = t[i];
r._updateWorldMatrix();
n.default.multiply(a, r._worldMatrix, e[i]);
this._setJointsDataWithMatrix(i, a);
}
},
calcJointMatrix: function() {
if (this.skeleton && this.rootBone) {
this._calFunc.call(this);
this._commitJointsData();
}
}
});
cc.SkinnedMeshRenderer = e.exports = l;
}), {
"../../../renderer/enums": 362,
"../../mesh/CCMeshRenderer": 208,
"../../renderer/render-flow": 272,
"../../value-types/mat4": 339,
"./CCSkeleton": 64
} ],
68: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
function n(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
r(t, e);
}
function r(t, e) {
return (r = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var s = t("./CCSkinnedMeshRenderer"), o = t("../../mesh/mesh-renderer"), a = (t("../../renderer/render-flow"), 
(function(t) {
n(e, t);
function e() {
return t.apply(this, arguments) || this;
}
e.prototype.fillBuffers = function(e, i) {
e.calcJointMatrix();
t.prototype.fillBuffers.call(this, e, i);
};
return e;
})(o));
i.default = a;
cc.Assembler.register(s, a);
e.exports = i.default;
}), {
"../../mesh/mesh-renderer": 211,
"../../renderer/render-flow": 272,
"./CCSkinnedMeshRenderer": 67
} ],
69: [ (function(t, e) {
"use strict";
var i, n = t("./platform/utils"), r = (t("../../DebugInfos"), "https://github.com/cocos-creator/engine/blob/master/EngineErrorMap.md");
cc.log = cc.warn = cc.error = cc.assert = console.log.bind ? console.log.bind(console) : console.log;
cc._throw = function(t) {
n.callInNextTick((function() {
throw t;
}));
};
function s(t) {
return function() {
var e = arguments[0], i = t + " " + e + ", please go to " + r + "#" + e + " to see details.";
if (1 === arguments.length) return i;
if (2 === arguments.length) return i + " Arguments: " + arguments[1];
var n = cc.js.shiftArguments.apply(null, arguments);
return i + " Arguments: " + n.join(", ");
};
}
var o = s("Log");
cc.logID = function() {
cc.log(o.apply(null, arguments));
};
var a = s("Warning");
cc.warnID = function() {
cc.warn(a.apply(null, arguments));
};
var c = s("Error");
cc.errorID = function() {
cc.error(c.apply(null, arguments));
};
var l = s("Assert");
cc.assertID = function(t) {
t || cc.assert(!1, l.apply(null, cc.js.shiftArguments.apply(null, arguments)));
};
var u = cc.Enum({
NONE: 0,
INFO: 1,
WARN: 2,
ERROR: 3,
INFO_FOR_WEB_PAGE: 4,
WARN_FOR_WEB_PAGE: 5,
ERROR_FOR_WEB_PAGE: 6
});
e.exports = cc.debug = {
DebugMode: u,
_resetDebugSetting: function(t) {
cc.log = cc.warn = cc.error = cc.assert = function() {};
if (t !== u.NONE) {
if (t > u.ERROR) {
var e = function(t) {
if (cc.game.canvas) {
if (!i) {
var e = document.createElement("Div");
e.setAttribute("id", "logInfoDiv");
e.setAttribute("width", "200");
e.setAttribute("height", cc.game.canvas.height);
var n = e.style;
n.zIndex = "99999";
n.position = "absolute";
n.top = n.left = "0";
(i = document.createElement("textarea")).setAttribute("rows", "20");
i.setAttribute("cols", "30");
i.setAttribute("disabled", "true");
var r = i.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(i);
cc.game.canvas.parentNode.appendChild(e);
}
i.value = i.value + t + "\r\n";
i.scrollTop = i.scrollHeight;
}
};
cc.error = function() {
e("ERROR :  " + cc.js.formatStr.apply(null, arguments));
};
cc.assert = function(t, i) {
if (!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 if (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 = console.error;
cc.assert = function(t, e) {
if (!t) {
e && (e = cc.js.formatStr.apply(null, cc.js.shiftArguments.apply(null, arguments)));
throw new Error(e);
}
};
}
t !== u.ERROR && (console.warn.bind ? cc.warn = console.warn.bind(console) : cc.warn = console.warn);
t === u.INFO && ("JavaScriptCore" === scriptEngineType ? cc.log = function() {
return console.log.apply(console, arguments);
} : cc.log = console.log);
}
},
getError: s("ERROR"),
isDisplayStats: function() {
return !!cc.profiler && cc.profiler.isShowingStats();
},
setDisplayStats: function(t) {
if (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": 263
} ],
70: [ (function(t, e) {
"use strict";
var i = t("./event/event-target"), n = t("./component-scheduler"), r = t("./node-activator"), s = t("./platform/CCObject"), o = t("./CCGame"), a = t("./renderer"), c = t("./event-manager"), l = t("./CCScheduler");
cc.Director = function() {
i.call(this);
this._paused = !1;
this._purgeDirectorInNextLoop = !1;
this._winSizeInPoints = null;
this._scene = null;
this._loadingScene = "";
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;
o.on(o.EVENT_SHOW, (function() {
t._lastUpdate = performance.now();
}));
o.once(o.EVENT_ENGINE_INITED, this.init, this);
};
cc.Director.prototype = {
constructor: cc.Director,
init: function() {
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 l();
if (cc.ActionManager) {
this._actionManager = new cc.ActionManager();
this._scheduler.scheduleUpdate(this._actionManager, l.PRIORITY_SYSTEM, !1);
} else this._actionManager = null;
this.sharedInit();
return !0;
},
sharedInit: function() {
this._compScheduler = new n();
this._nodeActivator = new r();
c && c.setEnabled(!0);
if (cc.AnimationManager) {
this._animationManager = new cc.AnimationManager();
this._scheduler.scheduleUpdate(this._animationManager, l.PRIORITY_SYSTEM, !1);
} else this._animationManager = null;
if (cc.CollisionManager) {
this._collisionManager = new cc.CollisionManager();
this._scheduler.scheduleUpdate(this._collisionManager, l.PRIORITY_SYSTEM, !1);
} else this._collisionManager = null;
if (cc.PhysicsManager) {
this._physicsManager = new cc.PhysicsManager();
this._scheduler.scheduleUpdate(this._physicsManager, l.PRIORITY_SYSTEM, !1);
} else this._physicsManager = null;
if (cc.Physics3DManager) {
this._physics3DManager = new cc.Physics3DManager();
this._scheduler.scheduleUpdate(this._physics3DManager, l.PRIORITY_SYSTEM, !1);
} else this._physics3DManager = null;
cc._widgetManager && cc._widgetManager.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 = o.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), c = i._devicePixelRatio * (s + n.height - t.y);
return i._isRotated ? cc.v2(i._viewportRect.width - c, a) : cc.v2(a, c);
},
convertToUI: function(t) {
var e = o.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);
if (i._isRotated) {
a.x = r + t.y / i._devicePixelRatio;
a.y = s + n.height - (i._viewportRect.width - t.x) / i._devicePixelRatio;
} else {
a.x = r + t.x * i._devicePixelRatio;
a.y = s + n.height - t.y * i._devicePixelRatio;
}
return 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.assetManager.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.assetManager.builtins.clear();
cc.game.pause();
cc.assetManager.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 || t instanceof cc.SceneAsset, 1216);
t instanceof cc.SceneAsset && (t = t.scene);
t._load();
for (var n = Object.keys(o._persistRootNodes).map((function(t) {
return o._persistRootNodes[t];
})), r = 0; r < n.length; r++) {
var a = n[r], c = t.getChildByUuid(a.uuid);
if (c) {
var l = c.getSiblingIndex();
c._destroyImmediate();
t.insertChild(a, l);
} else a.parent = t;
}
var u = this._scene;
cc.assetManager._releaseManager._autoRelease(u, t, o._persistRootNodes);
cc.isValid(u) && u.destroy();
this._scene = null;
s._deferredDestroy();
e && e();
this.emit(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, t);
this._scene = t;
t._activate();
cc.game.resume();
i && i(null, t);
this.emit(cc.Director.EVENT_AFTER_SCENE_LAUNCH, t);
},
runScene: function(t, e, i) {
cc.assertID(t, 1205);
cc.assertID(t instanceof cc.Scene || t instanceof cc.SceneAsset, 1216);
t instanceof cc.SceneAsset && (t = t.scene);
t._load();
this.once(cc.Director.EVENT_AFTER_DRAW, (function() {
this.runSceneImmediate(t, e, i);
}), this);
},
loadScene: function(t, e, i) {
if (this._loadingScene) {
cc.warnID(1208, t, this._loadingScene);
return !1;
}
var n = cc.assetManager.bundles.find((function(e) {
return e.getSceneInfo(t);
}));
if (n) {
this.emit(cc.Director.EVENT_BEFORE_SCENE_LOADING, t);
this._loadingScene = t;
var r = this;
console.time("LoadScene " + t);
n.loadScene(t, (function(n, s) {
console.timeEnd("LoadScene " + t);
r._loadingScene = "";
if (n) {
n = "Failed to load scene: " + n;
cc.error(n);
e && e(n);
} else r.runSceneImmediate(s, i, e);
}));
return !0;
}
cc.errorID(1209, t);
return !1;
},
preloadScene: function(t, e, i) {
var n = cc.assetManager.bundles.find((function(e) {
return e.getSceneInfo(t);
}));
if (!n) {
cc.errorID(1209, t);
return null;
}
n.preloadScene(t, null, e, i);
},
resume: function() {
if (this._paused) {
this._lastUpdate = performance.now();
this._lastUpdate || cc.logID(1200);
this._paused = !1;
this._deltaTime = 0;
}
},
setDepthTest: function(t) {
cc.Camera.main && (cc.Camera.main.depth = !!t);
},
setClearColor: function(t) {
cc.Camera.main && (cc.Camera.main.backgroundColor = t);
},
getRunningScene: function() {
return this._scene;
},
getScene: function() {
return this._scene;
},
getAnimationInterval: function() {
return 1e3 / o.getFrameRate();
},
setAnimationInterval: function(t) {
o.setFrameRate(Math.round(1e3 / t));
},
getDeltaTime: function() {
return this._deltaTime;
},
getTotalTime: function() {
return performance.now() - this._startTime;
},
getTotalFrames: function() {
return this._totalFrames;
},
isPaused: function() {
return this._paused;
},
getScheduler: function() {
return this._scheduler;
},
setScheduler: function(t) {
this._scheduler !== t && (this._scheduler = t);
},
getActionManager: function() {
return this._actionManager;
},
setActionManager: function(t) {
if (this._actionManager !== t) {
this._actionManager && this._scheduler.unscheduleUpdate(this._actionManager);
this._actionManager = t;
this._scheduler.scheduleUpdate(this._actionManager, cc.Scheduler.PRIORITY_SYSTEM, !1);
}
},
getAnimationManager: function() {
return this._animationManager;
},
getCollisionManager: function() {
return this._collisionManager;
},
getPhysicsManager: function() {
return this._physicsManager;
},
getPhysics3DManager: function() {
return this._physics3DManager;
},
startAnimation: function() {
cc.game.resume();
},
stopAnimation: function() {
cc.game.pause();
},
_resetDeltaTime: function() {
this._lastUpdate = performance.now();
this._deltaTime = 0;
},
mainLoop: function(t) {
if (this._purgeDirectorInNextLoop) {
this._purgeDirectorInNextLoop = !1;
this.purgeDirector();
} else {
this.calculateDeltaTime(t);
if (!this._paused) {
this.emit(cc.Director.EVENT_BEFORE_UPDATE);
this._compScheduler.startPhase();
this._compScheduler.updatePhase(this._deltaTime);
this._scheduler.update(this._deltaTime);
this._compScheduler.lateUpdatePhase(this._deltaTime);
this.emit(cc.Director.EVENT_AFTER_UPDATE);
s._deferredDestroy();
}
this.emit(cc.Director.EVENT_BEFORE_DRAW);
a.render(this._scene, this._deltaTime);
this.emit(cc.Director.EVENT_AFTER_DRAW);
c.frameUpdateListeners();
this._totalFrames++;
}
},
__fastOn: function(t, e, i) {
this.on(t, e, i);
},
__fastOff: function(t, e, i) {
this.off(t, e, i);
}
};
cc.js.addon(cc.Director.prototype, i.prototype);
cc.Director.EVENT_PROJECTION_CHANGED = "director_projection_changed";
cc.Director.EVENT_BEFORE_SCENE_LOADING = "director_before_scene_loading";
cc.Director.EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch";
cc.Director.EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch";
cc.Director.EVENT_BEFORE_UPDATE = "director_before_update";
cc.Director.EVENT_AFTER_UPDATE = "director_after_update";
cc.Director.EVENT_BEFORE_VISIT = "director_before_draw";
cc.Director.EVENT_AFTER_VISIT = "director_before_draw";
cc.Director.EVENT_BEFORE_DRAW = "director_before_draw";
cc.Director.EVENT_AFTER_DRAW = "director_after_draw";
cc.Director.PROJECTION_2D = 0;
cc.Director.PROJECTION_3D = 1;
cc.Director.PROJECTION_CUSTOM = 3;
cc.Director.PROJECTION_DEFAULT = cc.Director.PROJECTION_2D;
cc.Director.EVENT_BEFORE_PHYSICS = "director_before_physics";
cc.Director.EVENT_AFTER_PHYSICS = "director_after_physics";
cc.director = new cc.Director();
e.exports = cc.director;
}), {
"./CCGame": 71,
"./CCScheduler": 75,
"./component-scheduler": 143,
"./event-manager": 184,
"./event/event-target": 186,
"./node-activator": 212,
"./platform/CCObject": 245,
"./renderer": 271
} ],
71: [ (function(t, e) {
"use strict";
var i = t("./event/event-target");
t("../audio/CCAudioEngine");
var n = t("./CCDebug"), r = t("./renderer/index.js"), s = t("../core/renderer/utils/dynamic-atlas/manager"), o = {
EVENT_HIDE: "game_on_hide",
EVENT_SHOW: "game_on_show",
EVENT_RESTART: "game_on_restart",
EVENT_GAME_INITED: "game_inited",
EVENT_ENGINE_INITED: "engine_inited",
EVENT_RENDERER_INITED: "engine_inited",
RENDER_TYPE_CANVAS: 0,
RENDER_TYPE_WEBGL: 1,
RENDER_TYPE_OPENGL: 2,
_persistRootNodes: {},
_paused: !0,
_configLoaded: !1,
_isCloning: !1,
_prepared: !1,
_rendererInitialized: !1,
_renderContext: null,
_intervalId: null,
_lastTime: null,
_frameTime: null,
frame: null,
container: null,
canvas: null,
renderType: -1,
config: null,
onStart: null,
setFrameRate: function(t) {
this.config.frameRate = t;
this._intervalId && window.cancelAnimFrame(this._intervalId);
this._intervalId = 0;
this._paused = !0;
this._setAnimFrame();
this._runMainLoop();
},
getFrameRate: function() {
return this.config.frameRate;
},
step: function() {
cc.director.mainLoop();
},
pause: function() {
if (!this._paused) {
this._paused = !0;
cc.audioEngine && cc.audioEngine._break();
this._intervalId && window.cancelAnimFrame(this._intervalId);
this._intervalId = 0;
}
},
resume: function() {
if (this._paused) {
this._paused = !1;
cc.audioEngine && cc.audioEngine._restore();
cc.director._resetDeltaTime();
this._runMainLoop();
}
},
isPaused: function() {
return this._paused;
},
restart: function() {
cc.director.once(cc.Director.EVENT_AFTER_DRAW, (function() {
for (var t in o._persistRootNodes) o.removePersistRootNode(o._persistRootNodes[t]);
cc.director.getScene().destroy();
cc.Object._deferredDestroy();
cc.audioEngine && cc.audioEngine.uncacheAll();
cc.director.reset();
o.pause();
cc.assetManager.builtins.init((function() {
o.onStart();
o.emit(o.EVENT_RESTART);
}));
}));
},
end: function() {
close();
},
_initEngine: function() {
if (!this._rendererInitialized) {
this._initRenderer();
this._initEvents();
this.emit(this.EVENT_ENGINE_INITED);
}
},
_loadPreviewScript: function(t) {
t();
},
_prepareFinished: function(t) {
var e = this;
this._initEngine();
this._setAnimFrame();
cc.assetManager.builtins.init((function() {
console.log("Cocos Creator v" + cc.ENGINE_VERSION);
e._prepared = !0;
e._runMainLoop();
e.emit(e.EVENT_GAME_INITED);
t && t();
}));
},
eventTargetOn: i.prototype.on,
eventTargetOnce: i.prototype.once,
on: function(t, e, i, n) {
this._prepared && t === this.EVENT_ENGINE_INITED || !this._paused && t === this.EVENT_GAME_INITED ? e.call(i) : this.eventTargetOn(t, e, i, n);
},
once: function(t, e, i) {
this._prepared && t === this.EVENT_ENGINE_INITED || !this._paused && t === this.EVENT_GAME_INITED ? e.call(i) : this.eventTargetOnce(t, e, i);
},
prepare: function(t) {
var e = this;
this._prepared ? t && 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)) {
cc.warnID(3801);
return;
}
if (t.parent !== i) {
cc.warnID(3802);
return;
}
} else t.parent = i;
this._persistRootNodes[e] = t;
t._persistNode = !0;
cc.assetManager._releaseManager._addPersistNodeRef(t);
}
} else cc.warnID(3800);
},
removePersistRootNode: function(t) {
var e = t.uuid || "";
if (t === this._persistRootNodes[e]) {
delete this._persistRootNodes[e];
t._persistNode = !1;
cc.assetManager._releaseManager._removePersistNodeRef(t);
}
},
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;
jsb.setPreferredFramesPerSecond(t);
window.requestAnimFrame = window.requestAnimationFrame;
window.cancelAnimFrame = window.cancelAnimationFrame;
},
_stTimeWithRAF: function(t) {
var e = performance.now(), i = Math.max(0, o._frameTime - (e - o._lastTime)), n = window.setTimeout((function() {
window.requestAnimationFrame(t);
}), i);
o._lastTime = e + i;
return n;
},
_stTime: function(t) {
var e = performance.now(), i = Math.max(0, o._frameTime - (e - o._lastTime)), n = window.setTimeout((function() {
t();
}), i);
o._lastTime = e + i;
return n;
},
_ctTime: function(t) {
window.clearTimeout(t);
},
_runMainLoop: function() {
if (this._prepared) {
var t, e = this, i = e.config, r = cc.director;
i.frameRate;
n.setDisplayStats(i.showFPS);
t = function(i) {
if (!e._paused) {
e._intervalId = window.requestAnimFrame(t);
r.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.collisionMatrix = t.collisionMatrix || [];
this.groupList = t.groupList || [];
n._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) {
if (cc.sys.capabilities.opengl) {
this.renderType = this.RENDER_TYPE_WEBGL;
i = !0;
} else if (cc.sys.capabilities.canvas) {
this.renderType = this.RENDER_TYPE_CANVAS;
i = !0;
}
} else if (1 === e && cc.sys.capabilities.canvas) {
this.renderType = this.RENDER_TYPE_CANVAS;
i = !0;
} else if (2 === e && cc.sys.capabilities.opengl) {
this.renderType = this.RENDER_TYPE_WEBGL;
i = !0;
}
if (!i) throw new Error(n.getError(3820, e));
},
_initRenderer: function() {
if (!this._rendererInitialized) {
var t, e;
this.config.id;
this.container = e = document.createElement("DIV");
this.frame = e.parentNode === document.body ? document.documentElement : e.parentNode;
t = window.__canvas;
this.canvas = t;
this._determineRenderType();
if (this.renderType === this.RENDER_TYPE_WEBGL) {
var i = {
stencil: !0,
antialias: cc.macro.ENABLE_WEBGL_ANTIALIAS,
alpha: cc.macro.ENABLE_TRANSPARENT_CANVAS
};
r.initWebGL(t, i);
this._renderContext = r.device._gl;
!cc.macro.CLEANUP_IMAGE_CACHE && s && (s.enabled = !0);
}
if (!this._renderContext) {
this.renderType = this.RENDER_TYPE_CANVAS;
r.initCanvas(t);
this._renderContext = r.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);
"undefined" != typeof document.hidden ? t = "hidden" : "undefined" != typeof document.mozHidden ? t = "mozHidden" : "undefined" != typeof document.msHidden ? t = "msHidden" : "undefined" != typeof document.webkitHidden && (t = "webkitHidden");
var i = !1;
function n() {
if (!i) {
i = !0;
o.emit(o.EVENT_HIDE);
}
}
function r(t, e, n, r, s) {
if (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 < s.length; a++) document.addEventListener(s[a], (function(e) {
var i = document[t];
(i = i || e.hidden) ? n() : r();
})); else {
e.addEventListener("blur", n);
e.addEventListener("focus", r);
}
navigator.userAgent.indexOf("MicroMessenger") > -1 && (e.onfocus = r);
if ("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();
}));
}
};
i.call(o);
cc.js.addon(o, i.prototype);
cc.game = e.exports = o;
}), {
"../audio/CCAudioEngine": 21,
"../core/renderer/utils/dynamic-atlas/manager": 274,
"./CCDebug": 69,
"./event/event-target": 186,
"./renderer/index.js": 271
} ],
72: [ (function(t, e) {
"use strict";
var i = t("./value-types"), n = t("./utils/base-node"), r = t("./utils/prefab-helper"), s = t("./utils/trans-pool").NodeMemPool, o = t("./utils/affine-transform"), a = t("./event-manager"), c = t("./platform/CCMacro"), l = t("./platform/js"), u = (t("./event/event"), 
t("./event/event-target")), h = t("./renderer/render-flow"), _ = cc.Object.Flags.Destroying, f = Math.PI / 180, d = !!cc.ActionManager, p = function() {}, m = new i.Vec3(), y = new i.Quat(), v = new i.Vec3(), g = new i.Vec3(), b = new i.Quat(), C = new i.Quat(), x = new i.Vec3(), A = new i.Vec3(), S = new i.Vec3(), T = new i.Vec3(), w = new i.Vec3(), E = new i.Quat(), M = new i.Quat(), B = new i.Vec3(), I = new i.Quat(), D = new i.Vec3(), P = new i.Quat(), R = new i.Vec3(), L = new i.Vec3(), O = new i.Quat(), V = new i.Quat(), N = (new i.Quat(), 
cc.mat4()), F = new i.Vec3(), z = new l.Pool();
z.get = function() {
return this._get() || [];
};
var k = cc.Enum({
DEBUG: 31
}), G = 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
}), U = 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"
}), H = [ U.TOUCH_START, U.TOUCH_MOVE, U.TOUCH_END, U.TOUCH_CANCEL ], j = [ U.MOUSE_DOWN, U.MOUSE_ENTER, U.MOUSE_MOVE, U.MOUSE_LEAVE, U.MOUSE_UP, U.MOUSE_WHEEL ], W = !0, q = function(t) {
if (0 !== t) {
W && cc.warn("`cc.Node.skewX/Y` is deprecated since v2.2.1, please use 3D node instead.", "");
W = !1;
}
}, X = null, Y = function(t, e) {
var i = t.getLocation(), n = this.owner;
if (n._hitTest(i, this)) {
e.type = U.TOUCH_START;
e.touch = t;
e.bubbles = !0;
n.dispatchEvent(e);
return !0;
}
return !1;
}, J = function(t, e) {
var i = this.owner;
e.type = U.TOUCH_MOVE;
e.touch = t;
e.bubbles = !0;
i.dispatchEvent(e);
}, Z = function(t, e) {
var i = t.getLocation(), n = this.owner;
n._hitTest(i, this) ? e.type = U.TOUCH_END : e.type = U.TOUCH_CANCEL;
e.touch = t;
e.bubbles = !0;
n.dispatchEvent(e);
}, K = function(t, e) {
t.getLocation();
var i = this.owner;
e.type = U.TOUCH_CANCEL;
e.touch = t;
e.bubbles = !0;
i.dispatchEvent(e);
}, Q = function(t) {
var e = t.getLocation(), i = this.owner;
if (i._hitTest(e, this)) {
t.type = U.MOUSE_DOWN;
t.bubbles = !0;
i.dispatchEvent(t);
}
}, $ = function(t) {
var e = t.getLocation(), i = this.owner;
if (i._hitTest(e, this)) {
if (!this._previousIn) {
if (X && X._mouseListener) {
t.type = U.MOUSE_LEAVE;
X.dispatchEvent(t);
X._mouseListener._previousIn = !1;
}
X = this.owner;
t.type = U.MOUSE_ENTER;
i.dispatchEvent(t);
this._previousIn = !0;
}
t.type = U.MOUSE_MOVE;
t.bubbles = !0;
i.dispatchEvent(t);
} else {
if (!this._previousIn) return;
t.type = U.MOUSE_LEAVE;
i.dispatchEvent(t);
this._previousIn = !1;
X = null;
}
t.stopPropagation();
}, tt = function(t) {
var e = t.getLocation(), i = this.owner;
if (i._hitTest(e, this)) {
t.type = U.MOUSE_UP;
t.bubbles = !0;
i.dispatchEvent(t);
t.stopPropagation();
}
}, et = function(t) {
var e = t.getLocation(), i = this.owner;
if (i._hitTest(e, this)) {
t.type = U.MOUSE_WHEEL;
t.bubbles = !0;
i.dispatchEvent(t);
t.stopPropagation();
}
};
function it(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 nt(t, e) {
if (!(t._objFlags & _)) {
if (t._bubblingListeners) for (var i = 0, n = e.length; i < n; ++i) if (t._bubblingListeners.hasEventListener(e[i])) return !0;
if (t._capturingListeners) for (var r = 0, s = e.length; r < s; ++r) if (t._capturingListeners.hasEventListener(e[r])) return !0;
return !1;
}
return !0;
}
function rt(t, e, i) {
var n, r;
e.target = t;
i.length = 0;
t._getCapturingTargets(e.type, i);
e.eventPhase = 1;
for (r = i.length - 1; r >= 0; --r) if ((n = i[r])._capturingListeners) {
e.currentTarget = n;
n._capturingListeners.emit(e.type, e, i);
if (e._propagationStopped) {
i.length = 0;
return;
}
}
i.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);
if (!e._propagationStopped && e.bubbles) {
t._getBubblingTargets(e.type, i);
e.eventPhase = 3;
for (r = 0; r < i.length; ++r) if ((n = i[r])._bubblingListeners) {
e.currentTarget = n;
n._bubblingListeners.emit(e.type, e);
if (e._propagationStopped) {
i.length = 0;
return;
}
}
}
i.length = 0;
}
function st(t) {
var e = t.groupIndex;
0 === e && t.parent && (e = st(t.parent));
return e;
}
function ot(t) {
var e = st(t);
t._cullingMask = 1 << e;
t._proxy && t._proxy.updateCullingMask();
for (var i = 0; i < t._children.length; i++) ot(t._children[i]);
}
function at() {
if (this._localMatDirty & G.TRSS) {
var t = this._matrix, e = t.m;
i.Trs.toMat4(t, this._trs);
if (this._skewX || this._skewY) {
var n = e[0], r = e[1], s = e[4], o = e[5], a = Math.tan(this._skewX * f), c = Math.tan(this._skewY * f);
Infinity === a && (a = 99999999);
Infinity === c && (c = 99999999);
e[0] = n + s * c;
e[1] = r + o * c;
e[4] = s + n * a;
e[5] = o + r * a;
}
this._localMatDirty &= ~G.TRSS;
this._worldMatDirty = !0;
}
}
function ct() {
var t = this._localMatDirty;
if (t & G.TRSS) {
var e = this._matrix.m, i = this._trs;
if (t & (G.RS | G.SKEW)) {
var n = -this._eulerAngles.z, r = this._skewX || this._skewY, s = i[7], o = i[8];
if (n || r) {
var a = 1, c = 0, l = 0, u = 1;
if (n) {
var h = n * f;
l = Math.sin(h);
a = u = Math.cos(h);
c = -l;
}
e[0] = a *= s;
e[1] = c *= s;
e[4] = l *= o;
e[5] = u *= o;
if (r) {
var _ = e[0], d = e[1], p = e[4], m = e[5], y = Math.tan(this._skewX * f), v = Math.tan(this._skewY * f);
Infinity === y && (y = 99999999);
Infinity === v && (v = 99999999);
e[0] = _ + p * v;
e[1] = d + m * v;
e[4] = p + _ * y;
e[5] = m + d * y;
}
} else {
e[0] = s;
e[1] = 0;
e[4] = 0;
e[5] = o;
}
}
e[12] = i[0];
e[13] = i[1];
this._localMatDirty &= ~G.TRSS;
this._worldMatDirty = !0;
}
}
function lt() {
this._localMatDirty & G.TRSS && this._updateLocalMatrix();
if (this._parent) {
var t = this._parent._worldMatrix;
i.Mat4.mul(this._worldMatrix, t, this._matrix);
} else i.Mat4.copy(this._worldMatrix, this._matrix);
this._worldMatDirty = !1;
}
function ut() {
this._localMatDirty & G.TRSS && this._updateLocalMatrix();
var t = this._parent;
t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : i.Mat4.copy(this._worldMatrix, this._matrix);
this._worldMatDirty = !1;
}
function ht(t, e, i) {
var n = e.m, r = i.m, s = t.m, o = n[0], a = n[1], c = n[4], l = n[5], u = n[12], h = n[13], _ = r[0], f = r[1], d = r[4], p = r[5], m = r[12], y = r[13];
if (0 !== a || 0 !== c) {
s[0] = _ * o + f * c;
s[1] = _ * a + f * l;
s[4] = d * o + p * c;
s[5] = d * a + p * l;
s[12] = o * m + c * y + u;
s[13] = a * m + l * y + h;
} else {
s[0] = _ * o;
s[1] = f * l;
s[4] = d * o;
s[5] = p * l;
s[12] = o * m + u;
s[13] = l * y + h;
}
}
var _t = i.Mat4.mul, ft = {
name: "cc.Node",
extends: n,
properties: {
_opacity: 255,
_color: cc.Color.WHITE,
_contentSize: cc.Size,
_anchorPoint: cc.v2(.5, .5),
_position: void 0,
_scale: void 0,
_trs: null,
_eulerAngles: cc.Vec3,
_skewX: 0,
_skewY: 0,
_zIndex: {
default: void 0,
type: cc.Integer
},
_localZOrder: {
default: 0,
serializable: !1
},
_is3DNode: !1,
_groupIndex: {
default: 0,
formerlySerializedAs: "groupIndex"
},
groupIndex: {
get: function() {
return this._groupIndex;
},
set: function(t) {
this._groupIndex = t;
ot(this);
this.emit(U.GROUP_CHANGED, this);
}
},
group: {
get: function() {
return cc.game.groupList[this.groupIndex] || "";
},
set: function(t) {
this.groupIndex = cc.game.groupList.indexOf(t);
}
},
x: {
get: function() {
return this._trs[0];
},
set: function(t) {
var e = this._trs;
if (t !== e[0]) {
e[0] = t;
this.setLocalDirty(G.ALL_POSITION);
1 & this._eventMask && this.emit(U.POSITION_CHANGED);
}
}
},
y: {
get: function() {
return this._trs[1];
},
set: function(t) {
var e = this._trs;
if (t !== e[1]) {
e[1] = t;
this.setLocalDirty(G.ALL_POSITION);
1 & this._eventMask && this.emit(U.POSITION_CHANGED);
}
}
},
z: {
get: function() {
return this._trs[2];
},
set: function(t) {
var e = this._trs;
if (t !== e[2]) {
e[2] = t;
this.setLocalDirty(G.ALL_POSITION);
1 & this._eventMask && this.emit(U.POSITION_CHANGED);
}
}
},
rotation: {
get: function() {
return -this.angle;
},
set: function(t) {
this.angle = -t;
}
},
angle: {
get: function() {
return this._eulerAngles.z;
},
set: function(t) {
i.Vec3.set(this._eulerAngles, 0, 0, t);
i.Trs.fromAngleZ(this._trs, t);
this.setLocalDirty(G.ALL_ROTATION);
4 & this._eventMask && this.emit(U.ROTATION_CHANGED);
}
},
rotationX: {
get: function() {
return this._eulerAngles.x;
},
set: function(t) {
if (this._eulerAngles.x !== t) {
this._eulerAngles.x = t;
this._eulerAngles.x === this._eulerAngles.y ? i.Trs.fromAngleZ(this._trs, -t) : i.Trs.fromEulerNumber(this._trs, t, this._eulerAngles.y, 0);
this.setLocalDirty(G.ALL_ROTATION);
4 & this._eventMask && this.emit(U.ROTATION_CHANGED);
}
}
},
rotationY: {
get: function() {
return this._eulerAngles.y;
},
set: function(t) {
if (this._eulerAngles.y !== t) {
this._eulerAngles.y = t;
this._eulerAngles.x === this._eulerAngles.y ? i.Trs.fromAngleZ(this._trs, -t) : i.Trs.fromEulerNumber(this._trs, this._eulerAngles.x, t, 0);
this.setLocalDirty(G.ALL_ROTATION);
4 & this._eventMask && this.emit(U.ROTATION_CHANGED);
}
}
},
eulerAngles: {
get: function() {
return i.Trs.toEuler(this._eulerAngles, this._trs);
},
set: function(t) {
i.Trs.fromEuler(this._trs, t);
this.setLocalDirty(G.ALL_ROTATION);
4 & this._eventMask && this.emit(U.ROTATION_CHANGED);
}
},
quat: {
get: function() {
var t = this._trs;
return new i.Quat(t[3], t[4], t[5], t[6]);
},
set: function(t) {
this.setRotation(t);
}
},
scale: {
get: function() {
return this._trs[7];
},
set: function(t) {
this.setScale(t);
}
},
scaleX: {
get: function() {
return this._trs[7];
},
set: function(t) {
if (this._trs[7] !== t) {
this._trs[7] = t;
this.setLocalDirty(G.ALL_SCALE);
2 & this._eventMask && this.emit(U.SCALE_CHANGED);
}
}
},
scaleY: {
get: function() {
return this._trs[8];
},
set: function(t) {
if (this._trs[8] !== t) {
this._trs[8] = t;
this.setLocalDirty(G.ALL_SCALE);
2 & this._eventMask && this.emit(U.SCALE_CHANGED);
}
}
},
scaleZ: {
get: function() {
return this._trs[9];
},
set: function(t) {
if (this._trs[9] !== t) {
this._trs[9] = t;
this.setLocalDirty(G.ALL_SCALE);
2 & this._eventMask && this.emit(U.SCALE_CHANGED);
}
}
},
skewX: {
get: function() {
return this._skewX;
},
set: function(t) {
q(t);
this._skewX = t;
this.setLocalDirty(G.SKEW);
this._proxy.updateSkew();
}
},
skewY: {
get: function() {
return this._skewY;
},
set: function(t) {
q(t);
this._skewY = t;
this.setLocalDirty(G.SKEW);
this._proxy.updateSkew();
}
},
opacity: {
get: function() {
return this._opacity;
},
set: function(t) {
t = cc.misc.clampf(t, 0, 255);
if (this._opacity !== t) {
this._opacity = t;
this._proxy.updateOpacity();
this._renderFlag |= h.FLAG_OPACITY_COLOR;
}
},
range: [ 0, 255 ]
},
color: {
get: function() {
return this._color.clone();
},
set: function(t) {
if (!this._color.equals(t)) {
this._color.set(t);
this._renderFlag |= h.FLAG_COLOR;
32 & this._eventMask && this.emit(U.COLOR_CHANGED, t);
}
}
},
anchorX: {
get: function() {
return this._anchorPoint.x;
},
set: function(t) {
var e = this._anchorPoint;
if (e.x !== t) {
e.x = t;
16 & this._eventMask && this.emit(U.ANCHOR_CHANGED);
}
}
},
anchorY: {
get: function() {
return this._anchorPoint.y;
},
set: function(t) {
var e = this._anchorPoint;
if (e.y !== t) {
e.y = t;
16 & this._eventMask && this.emit(U.ANCHOR_CHANGED);
}
}
},
width: {
get: function() {
return this._contentSize.width;
},
set: function(t) {
if (t !== this._contentSize.width) {
this._contentSize.width = t;
8 & this._eventMask && this.emit(U.SIZE_CHANGED);
}
}
},
height: {
get: function() {
return this._contentSize.height;
},
set: function(t) {
if (t !== this._contentSize.height) {
this._contentSize.height = t;
8 & this._eventMask && this.emit(U.SIZE_CHANGED);
}
}
},
zIndex: {
get: function() {
return this._localZOrder >> 16;
},
set: function(t) {
if (t > c.MAX_ZINDEX) {
cc.warnID(1636);
t = c.MAX_ZINDEX;
} else if (t < c.MIN_ZINDEX) {
cc.warnID(1637);
t = c.MIN_ZINDEX;
}
if (this.zIndex !== t) {
this._localZOrder = 65535 & this._localZOrder | t << 16;
this.emit(U.SIBLING_ORDER_CHANGED);
this._onSiblingIndexChanged();
}
}
},
is3DNode: {
get: function() {
return this._is3DNode;
},
set: function(t) {
this._is3DNode = t;
this._update3DFunction();
}
},
up: {
get: function() {
return i.Vec3.transformQuat(D, i.Vec3.UP, this.getWorldRotation(P)).clone();
}
},
right: {
get: function() {
return i.Vec3.transformQuat(D, i.Vec3.RIGHT, this.getWorldRotation(P)).clone();
}
},
forward: {
get: function() {
return i.Vec3.transformQuat(D, i.Vec3.FORWARD, this.getWorldRotation(P)).clone();
}
}
},
ctor: function() {
this._reorderChildDirty = !1;
this._widget = null;
this._renderComponent = null;
this._capturingListeners = null;
this._bubblingListeners = null;
this._touchListener = null;
this._mouseListener = null;
this._initDataFromPool();
this._eventMask = 0;
this._cullingMask = 1;
this._childArrivalOrder = 1;
this._proxy = new renderer.NodeProxy(this._spaceInfo.unitID, this._spaceInfo.index, this._id, this._name);
this._proxy.init(this);
this._renderFlag = h.FLAG_TRANSFORM | h.FLAG_OPACITY_COLOR;
},
statics: {
EventType: U,
_LocalDirtyFlag: G,
isNode: function(t) {
return t instanceof dt && (t.constructor === dt || !(t instanceof cc.Scene));
},
BuiltinGroupIndex: k
},
_onSiblingIndexChanged: function() {
this._parent && this._parent._delaySort();
},
_onPreDestroy: function() {
this._onPreDestroyBase();
d && cc.director.getActionManager().removeAllActionsFromTarget(this);
X === this && (X = null);
this._bubblingListeners && this._bubblingListeners.clear();
this._capturingListeners && this._capturingListeners.clear();
if (this._touchListener || this._mouseListener) {
a.removeListeners(this);
if (this._touchListener) {
this._touchListener.owner = null;
this._touchListener.mask = null;
this._touchListener = null;
}
if (this._mouseListener) {
this._mouseListener.owner = null;
this._mouseListener.mask = null;
this._mouseListener = null;
}
}
this._proxy.destroy();
this._proxy = null;
this._backDataIntoPool();
this._reorderChildDirty && cc.director.__fastOff(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this);
},
_onPostActivated: function(t) {
var e = d ? cc.director.getActionManager() : null;
if (t) {
this._renderFlag |= h.FLAG_WORLD_TRANSFORM;
e && e.resumeTarget(this);
a.resumeTarget(this);
this._checkListenerMask();
} else {
e && e.pauseTarget(this);
a.pauseTarget(this);
}
},
_onHierarchyChanged: function(t) {
this._updateOrderOfArrival();
ot(this);
this._parent && this._parent._delaySort();
this._renderFlag |= h.FLAG_WORLD_TRANSFORM;
this._onHierarchyChangedBase(t);
cc._widgetManager && (cc._widgetManager._nodesOrderDirty = !0);
t && this._activeInHierarchy && this._checkListenerMask();
this._proxy.updateParent();
},
_update3DFunction: function() {
if (this._is3DNode) {
this._updateLocalMatrix = at;
this._calculWorldMatrix = lt;
this._mulMat = _t;
} else {
this._updateLocalMatrix = ct;
this._calculWorldMatrix = ut;
this._mulMat = ht;
}
this._renderComponent && this._renderComponent._on3DNodeChanged && this._renderComponent._on3DNodeChanged();
this._renderFlag |= h.FLAG_TRANSFORM;
this._localMatDirty = G.ALL;
this._proxy.update3DNode();
},
_initDataFromPool: function() {
this._spaceInfo || (this._spaceInfo = s.pop());
var t = this._spaceInfo;
this._matrix = cc.mat4(t.localMat);
i.Mat4.identity(this._matrix);
this._worldMatrix = cc.mat4(t.worldMat);
i.Mat4.identity(this._worldMatrix);
this._localMatDirty = G.ALL;
this._worldMatDirty = !0;
var e = this._trs = t.trs;
e[0] = 0;
e[1] = 0;
e[2] = 0;
e[3] = 0;
e[4] = 0;
e[5] = 0;
e[6] = 1;
e[7] = 1;
e[8] = 1;
e[9] = 1;
},
_backDataIntoPool: function() {
s.push(this._spaceInfo);
this._matrix = null;
this._worldMatrix = null;
this._trs = null;
this._spaceInfo = null;
},
_toEuler: function() {
if (this.is3DNode) i.Trs.toEuler(this._eulerAngles, this._trs); else {
var t = Math.asin(this._trs[5]) / f * 2;
i.Vec3.set(this._eulerAngles, 0, 0, t);
}
},
_fromEuler: function() {
this.is3DNode ? i.Trs.fromEuler(this._trs, this._eulerAngles) : i.Trs.fromAngleZ(this._trs, this._eulerAngles.z);
},
_initProperties: function() {
this._is3DNode && this._update3DFunction();
var t = this._trs;
if (t) {
var e = t;
t = this._trs = this._spaceInfo.trs;
11 === e.length ? t.set(e.subarray(1)) : t.set(e);
} else t = this._trs = this._spaceInfo.trs;
this._fromEuler();
this._renderFlag |= h.FLAG_TRANSFORM | h.FLAG_OPACITY_COLOR;
},
_onBatchCreated: function(t) {
this._initProperties();
this._cullingMask = 1 << st(this);
this._proxy && this._proxy.updateCullingMask();
if (!this._activeInHierarchy) {
d && cc.director.getActionManager().pauseTarget(this);
a.pauseTarget(this);
}
for (var e = this._children, i = 0, n = e.length; i < n; i++) {
var s = e[i];
if (!t) {
var o = s._prefab;
o && o.sync && o.root === s && r.syncWithPrefab(s);
s._updateOrderOfArrival();
}
s._onBatchCreated(t);
}
e.length > 0 && (this._renderFlag |= h.FLAG_CHILDREN);
this._proxy.initNative();
},
_checkListenerMask: function() {
if (this._touchListener) {
var t = this._touchListener.mask = it(this, cc.Mask);
this._mouseListener && (this._mouseListener.mask = t);
} else this._mouseListener && (this._mouseListener.mask = it(this, cc.Mask));
},
_checknSetupSysEvent: function(t) {
var e = !1, i = !1;
if (-1 !== H.indexOf(t)) {
if (!this._touchListener) {
this._touchListener = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: !0,
owner: this,
mask: it(this, cc.Mask),
onTouchBegan: Y,
onTouchMoved: J,
onTouchEnded: Z,
onTouchCancelled: K
});
a.addListener(this._touchListener, this);
e = !0;
}
i = !0;
} else if (-1 !== j.indexOf(t)) {
if (!this._mouseListener) {
this._mouseListener = cc.EventListener.create({
event: cc.EventListener.MOUSE,
_previousIn: !1,
owner: this,
mask: it(this, cc.Mask),
onMouseDown: Q,
onMouseMove: $,
onMouseUp: tt,
onMouseScroll: et
});
a.addListener(this._mouseListener, this);
e = !0;
}
i = !0;
}
e && !this._activeInHierarchy && cc.director.getScheduler().schedule((function() {
this._activeInHierarchy || a.pauseTarget(this);
}), this, 0, 0, 0, !1);
return i;
},
on: function(t, e, i, n) {
if (this._checknSetupSysEvent(t)) return this._onDispatch(t, e, i, n);
switch (t) {
case U.POSITION_CHANGED:
this._eventMask |= 1;
break;

case U.SCALE_CHANGED:
this._eventMask |= 2;
break;

case U.ROTATION_CHANGED:
this._eventMask |= 4;
break;

case U.SIZE_CHANGED:
this._eventMask |= 8;
break;

case U.ANCHOR_CHANGED:
this._eventMask |= 16;
break;

case U.COLOR_CHANGED:
this._eventMask |= 32;
}
this._bubblingListeners || (this._bubblingListeners = new u());
return this._bubblingListeners.on(t, e, i);
},
once: function(t, e, i, n) {
var r = this, s = null;
(s = this._checknSetupSysEvent(t) && n ? this._capturingListeners = this._capturingListeners || new u() : this._bubblingListeners = this._bubblingListeners || new u()).once(t, e, i);
s.once(t, (function() {
r.off(t, e, i);
}), void 0);
},
_onDispatch: function(t, e, i, n) {
if ("boolean" == typeof i) {
n = i;
i = void 0;
} else n = !!n;
if (e) {
var r = null;
if (!(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);
}
return e;
}
cc.errorID(6800);
},
off: function(t, e, i, n) {
var r = -1 !== H.indexOf(t), s = !r && -1 !== j.indexOf(t);
if (r || s) {
this._offDispatch(t, e, i, n);
if (r) {
if (this._touchListener && !nt(this, H)) {
a.removeListener(this._touchListener);
this._touchListener = null;
}
} else if (s && this._mouseListener && !nt(this, j)) {
a.removeListener(this._mouseListener);
this._mouseListener = null;
}
} else if (this._bubblingListeners) {
this._bubblingListeners.off(t, e, i);
if (!this._bubblingListeners.hasEventListener(t)) switch (t) {
case U.POSITION_CHANGED:
this._eventMask &= -2;
break;

case U.SCALE_CHANGED:
this._eventMask &= -3;
break;

case U.ROTATION_CHANGED:
this._eventMask &= -5;
break;

case U.SIZE_CHANGED:
this._eventMask &= -9;
break;

case U.ANCHOR_CHANGED:
this._eventMask &= -17;
break;

case U.COLOR_CHANGED:
this._eventMask &= -33;
}
}
},
_offDispatch: function(t, e, i, n) {
if ("boolean" == typeof i) {
n = i;
i = void 0;
} else n = !!n;
if (e) {
var r = n ? this._capturingListeners : this._bubblingListeners;
if (r) {
r.off(t, e, i);
i && i.__eventTargets && l.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;
if (e) {
e.targetOff(t);
1 & this._eventMask && !e.hasEventListener(U.POSITION_CHANGED) && (this._eventMask &= -2);
2 & this._eventMask && !e.hasEventListener(U.SCALE_CHANGED) && (this._eventMask &= -3);
4 & this._eventMask && !e.hasEventListener(U.ROTATION_CHANGED) && (this._eventMask &= -5);
8 & this._eventMask && !e.hasEventListener(U.SIZE_CHANGED) && (this._eventMask &= -9);
16 & this._eventMask && !e.hasEventListener(U.ANCHOR_CHANGED) && (this._eventMask &= -17);
32 & this._eventMask && !e.hasEventListener(U.COLOR_CHANGED) && (this._eventMask &= -33);
}
this._capturingListeners && this._capturingListeners.targetOff(t);
t && t.__eventTargets && l.array.fastRemove(t.__eventTargets, this);
if (this._touchListener && !nt(this, H)) {
a.removeListener(this._touchListener);
this._touchListener = null;
}
if (this._mouseListener && !nt(this, j)) {
a.removeListener(this._mouseListener);
this._mouseListener = null;
}
},
hasEventListener: function(t) {
var e = !1;
this._bubblingListeners && (e = this._bubblingListeners.hasEventListener(t));
!e && this._capturingListeners && (e = this._capturingListeners.hasEventListener(t));
return e;
},
emit: function(t, e, i, n, r, s) {
this._bubblingListeners && this._bubblingListeners.emit(t, e, i, n, r, s);
},
dispatchEvent: function(t) {
var e = z.get();
rt(this, t, e);
z.put(e);
},
pauseSystemEvents: function(t) {
a.pauseTarget(this, t);
},
resumeSystemEvents: function(t) {
a.resumeTarget(this, t);
},
_hitTest: function(t, e) {
var n = this._contentSize.width, r = this._contentSize.height, s = R, o = L, a = cc.Camera.findCamera(this);
a ? a.getScreenToWorldPoint(t, s) : s.set(t);
this._updateWorldMatrix();
if (!i.Mat4.invert(N, this._worldMatrix)) return !1;
i.Vec2.transformMat4(o, s, N);
o.x += this._anchorPoint.x * n;
o.y += this._anchorPoint.y * r;
var c = !1;
if (o.x >= 0 && o.y >= 0 && o.x <= n && o.y <= r) {
c = !0;
if (e && e.mask) for (var l = e.mask, u = this, h = l ? l.length : 0, _ = 0, f = 0; u && f < h; ++_, 
u = u.parent) {
var d = l[f];
if (_ === d.index) {
if (u !== d.node) {
l.length = f;
break;
}
var p = u.getComponent(cc.Mask);
if (p && p._enabled && !p._hitTest(s)) {
c = !1;
break;
}
f++;
} else if (_ > d.index) {
l.length = f;
break;
}
}
}
return c;
},
_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: d ? function(t) {
if (this.active) {
cc.assertID(t, 1618);
var e = cc.director.getActionManager();
if (!e._suppressDeprecation) {
e._suppressDeprecation = !0;
cc.warnID(1639);
}
e.addAction(t, this, !1);
return t;
}
} : p,
pauseAllActions: d ? function() {
cc.director.getActionManager().pauseTarget(this);
} : p,
resumeAllActions: d ? function() {
cc.director.getActionManager().resumeTarget(this);
} : p,
stopAllActions: d ? function() {
cc.director.getActionManager().removeAllActionsFromTarget(this);
} : p,
stopAction: d ? function(t) {
cc.director.getActionManager().removeAction(t);
} : p,
stopActionByTag: d ? function(t) {
t !== cc.Action.TAG_INVALID ? cc.director.getActionManager().removeActionByTag(t, this) : cc.logID(1612);
} : p,
getActionByTag: d ? function(t) {
if (t === cc.Action.TAG_INVALID) {
cc.logID(1613);
return null;
}
return cc.director.getActionManager().getActionByTag(t, this);
} : function() {
return null;
},
getNumberOfRunningActions: d ? function() {
return cc.director.getActionManager().getNumberOfRunningActionsInTarget(this);
} : function() {
return 0;
},
getPosition: function(t) {
t = t || new i.Vec3();
return i.Trs.toPosition(t, this._trs);
},
setPosition: function(t, e, i) {
var n;
if (void 0 === e) {
n = t.x;
e = t.y;
i = t.z;
} else n = t;
var r = this._trs;
void 0 === i && (i = r[2]);
if (r[0] !== n || r[1] !== e || r[2] !== i) {
r[0] = n;
r[1] = e;
r[2] = i;
this.setLocalDirty(G.ALL_POSITION);
1 & this._eventMask && this.emit(U.POSITION_CHANGED);
}
},
getScale: function(t) {
if (void 0 !== t) return i.Trs.toScale(t, this._trs);
cc.errorID(1400, "cc.Node.getScale", "cc.Node.scale or cc.Node.getScale(cc.Vec3)");
return this._trs[7];
},
setScale: function(t, e, i) {
var n;
if (t && "number" != typeof t) {
n = t.x;
e = t.y;
i = t.z;
} else if (void 0 !== t && void 0 === e) {
n = t;
e = t;
i = t;
} else n = t;
var r = this._trs;
void 0 === i && (i = r[9]);
if (r[7] !== n || r[8] !== e || r[9] !== i) {
r[7] = n;
r[8] = e;
r[9] = i;
this.setLocalDirty(G.ALL_SCALE);
2 & this._eventMask && this.emit(U.SCALE_CHANGED);
}
},
getRotation: function(t) {
return t instanceof i.Quat ? i.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;
if (void 0 === e) {
r = t.x;
e = t.y;
i = t.z;
n = t.w;
}
var s = this._trs;
if (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(G.ALL_ROTATION);
4 & this._eventMask && this.emit(U.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;
i.width = t.width;
i.height = t.height;
} else {
if (t === i.width && e === i.height) return;
i.width = t;
i.height = e;
}
8 & this._eventMask && this.emit(U.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(G.ALL_POSITION);
16 & this._eventMask && this.emit(U.ANCHOR_CHANGED);
},
_invTransformPoint: function(t, e) {
this._parent ? this._parent._invTransformPoint(t, e) : i.Vec3.copy(t, e);
var n = this._trs;
i.Trs.toPosition(v, n);
i.Vec3.sub(t, t, v);
i.Trs.toRotation(b, n);
i.Quat.conjugate(C, b);
i.Vec3.transformQuat(t, t, C);
i.Trs.toScale(v, n);
i.Vec3.inverseSafe(g, v);
i.Vec3.mul(t, t, g);
return t;
},
getWorldPosition: function(t) {
i.Trs.toPosition(t, this._trs);
for (var e, n = this._parent; n; ) {
e = n._trs;
i.Trs.toScale(m, e);
i.Vec3.mul(t, t, m);
i.Trs.toRotation(y, e);
i.Vec3.transformQuat(t, t, y);
i.Trs.toPosition(m, e);
i.Vec3.add(t, t, m);
n = n._parent;
}
return t;
},
setWorldPosition: function(t) {
var e = this._trs;
this._parent ? this._parent._invTransformPoint(x, t) : i.Vec3.copy(x, t);
i.Trs.fromPosition(e, x);
this.setLocalDirty(G.ALL_POSITION);
1 & this._eventMask && this.emit(U.POSITION_CHANGED);
},
getWorldRotation: function(t) {
i.Trs.toRotation(O, this._trs);
i.Quat.copy(t, O);
for (var e = this._parent; e; ) {
i.Trs.toRotation(O, e._trs);
i.Quat.mul(t, O, t);
e = e._parent;
}
return t;
},
setWorldRotation: function(t) {
if (this._parent) {
this._parent.getWorldRotation(V);
i.Quat.conjugate(V, V);
i.Quat.mul(V, V, t);
} else i.Quat.copy(V, t);
i.Trs.fromRotation(this._trs, V);
this.setLocalDirty(G.ALL_ROTATION);
},
getWorldScale: function(t) {
i.Trs.toScale(A, this._trs);
i.Vec3.copy(t, A);
for (var e = this._parent; e; ) {
i.Trs.toScale(A, e._trs);
i.Vec3.mul(t, t, A);
e = e._parent;
}
return t;
},
setWorldScale: function(t) {
if (this._parent) {
this._parent.getWorldScale(S);
i.Vec3.div(S, t, S);
} else i.Vec3.copy(S, t);
i.Trs.fromScale(this._trs, S);
this.setLocalDirty(G.ALL_SCALE);
},
getWorldRT: function(t) {
var e = T, n = E, r = this._trs;
i.Trs.toPosition(e, r);
i.Trs.toRotation(n, r);
for (var s = this._parent; s; ) {
r = s._trs;
i.Trs.toScale(w, r);
i.Vec3.mul(e, e, w);
i.Trs.toRotation(M, r);
i.Vec3.transformQuat(e, e, M);
i.Trs.toPosition(w, r);
i.Vec3.add(e, e, w);
i.Quat.mul(n, M, n);
s = s._parent;
}
i.Mat4.fromRT(t, n, e);
return t;
},
lookAt: function(t, e) {
this.getWorldPosition(B);
i.Vec3.sub(B, B, t);
i.Vec3.normalize(B, B);
i.Quat.fromViewUp(I, B, e);
this.setWorldRotation(I);
},
_updateLocalMatrix: ct,
_calculWorldMatrix: function() {
this._localMatDirty & G.TRSS && this._updateLocalMatrix();
var t = this._parent;
t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : i.Mat4.copy(this._worldMatrix, this._matrix);
this._worldMatDirty = !1;
},
_mulMat: ht,
_updateWorldMatrix: function() {
this._parent && this._parent._updateWorldMatrix();
if (this._worldMatDirty) {
this._calculWorldMatrix();
for (var t = this._children, e = 0, i = t.length; e < i; e++) t[e]._worldMatDirty = !0;
}
},
setLocalDirty: function(t) {
this._localMatDirty |= t;
this._worldMatDirty = !0;
t === G.ALL_POSITION || t === G.POSITION ? this._renderFlag |= h.FLAG_WORLD_TRANSFORM : this._renderFlag |= h.FLAG_TRANSFORM;
},
setWorldDirty: function() {
this._worldMatDirty = !0;
},
getLocalMatrix: function(t) {
this._updateLocalMatrix();
return i.Mat4.copy(t, this._matrix);
},
getWorldMatrix: function(t) {
this._updateWorldMatrix();
return i.Mat4.copy(t, this._worldMatrix);
},
convertToNodeSpaceAR: function(t, e) {
this._updateWorldMatrix();
i.Mat4.invert(N, this._worldMatrix);
if (t instanceof cc.Vec2) {
e = e || new cc.Vec2();
return i.Vec2.transformMat4(e, t, N);
}
e = e || new cc.Vec3();
return i.Vec3.transformMat4(e, t, N);
},
convertToWorldSpaceAR: function(t, e) {
this._updateWorldMatrix();
if (t instanceof cc.Vec2) {
e = e || new cc.Vec2();
return i.Vec2.transformMat4(e, t, this._worldMatrix);
}
e = e || new cc.Vec3();
return i.Vec3.transformMat4(e, t, this._worldMatrix);
},
convertToNodeSpace: function(t) {
this._updateWorldMatrix();
i.Mat4.invert(N, this._worldMatrix);
var e = new cc.Vec2();
i.Vec2.transformMat4(e, t, N);
e.x += this._anchorPoint.x * this._contentSize.width;
e.y += this._anchorPoint.y * this._contentSize.height;
return e;
},
convertToWorldSpace: function(t) {
this._updateWorldMatrix();
var e = new cc.Vec2(t.x - this._anchorPoint.x * this._contentSize.width, t.y - this._anchorPoint.y * this._contentSize.height);
return i.Vec2.transformMat4(e, e, this._worldMatrix);
},
getNodeToParentTransform: function(t) {
t || (t = o.identity());
this._updateLocalMatrix();
var e = this._contentSize;
F.x = -this._anchorPoint.x * e.width;
F.y = -this._anchorPoint.y * e.height;
i.Mat4.copy(N, this._matrix);
i.Mat4.transform(N, N, F);
return o.fromMat4(t, N);
},
getNodeToParentTransformAR: function(t) {
t || (t = o.identity());
this._updateLocalMatrix();
return o.fromMat4(t, this._matrix);
},
getNodeToWorldTransform: function(t) {
t || (t = o.identity());
this._updateWorldMatrix();
var e = this._contentSize;
F.x = -this._anchorPoint.x * e.width;
F.y = -this._anchorPoint.y * e.height;
i.Mat4.copy(N, this._worldMatrix);
i.Mat4.transform(N, N, F);
return o.fromMat4(t, N);
},
getNodeToWorldTransformAR: function(t) {
t || (t = o.identity());
this._updateWorldMatrix();
return o.fromMat4(t, this._worldMatrix);
},
getParentToNodeTransform: function(t) {
t || (t = o.identity());
this._updateLocalMatrix();
i.Mat4.invert(N, this._matrix);
return o.fromMat4(t, N);
},
getWorldToNodeTransform: function(t) {
t || (t = o.identity());
this._updateWorldMatrix();
i.Mat4.invert(N, this._worldMatrix);
return o.fromMat4(t, N);
},
convertTouchToNodeSpace: function(t) {
return this.convertToNodeSpace(t.getLocation());
},
convertTouchToNodeSpaceAR: function(t) {
return this.convertToNodeSpaceAR(t.getLocation());
},
getBoundingBox: function() {
this._updateLocalMatrix();
var t = this._contentSize.width, e = this._contentSize.height, i = cc.rect(-this._anchorPoint.x * t, -this._anchorPoint.y * e, t, e);
return i.transformMat4(i, this._matrix);
},
getBoundingBoxToWorld: function() {
if (this._parent) {
this._parent._updateWorldMatrix();
return this._getBoundingBoxTo();
}
return this.getBoundingBox();
},
_getBoundingBoxTo: function() {
var t = this._contentSize.width, e = this._contentSize.height, i = cc.rect(-this._anchorPoint.x * t, -this._anchorPoint.y * e, t, e);
this._calculWorldMatrix();
i.transformMat4(i, this._worldMatrix);
if (!this._children) return i;
for (var n = this._children, r = 0; r < n.length; r++) {
var s = n[r];
if (s && s.active) {
var o = s._getBoundingBoxTo();
o && i.union(i, o);
}
}
return i;
},
_updateOrderOfArrival: function() {
var t = this._parent ? ++this._parent._childArrivalOrder : 0;
this._localZOrder = 4294901760 & this._localZOrder | t;
this.emit(U.SIBLING_ORDER_CHANGED);
},
setSelfGroupIndex: function(t) {
this._groupIndex = t || 0;
this._cullingMask = 1 << t;
this._proxy && this._proxy.updateCullingMask();
},
addChild: function(t, e, i) {
cc.assertID(t, 1606);
cc.assertID(null === t._parent, 1605);
t.parent = this;
void 0 !== e && (t.zIndex = e);
void 0 !== i && (t.name = i);
},
cleanup: function() {
d && cc.director.getActionManager().removeAllActionsFromTarget(this);
a.removeListeners(this);
var t, e, i = this._children.length;
for (t = 0; t < i; ++t) (e = this._children[t]) && e.cleanup();
},
sortAllChildren: function() {
if (this._reorderChildDirty) {
this._reorderChildDirty = !1;
var t = this._children;
this._childArrivalOrder = 1;
for (var e = 0, i = t.length; e < i; e++) t[e]._updateOrderOfArrival();
a._setDirtyForNode(this);
if (t.length > 1) {
for (var n, r, s = 1, o = t.length; s < o; s++) {
n = t[s];
for (var c = s; c > 0 && (r = t[c - 1])._localZOrder > n._localZOrder; c--) t[c] = r;
t[c] = n;
}
this.emit(U.CHILD_REORDER, this);
}
cc.director.__fastOff(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this);
}
},
_delaySort: function() {
if (!this._reorderChildDirty) {
this._reorderChildDirty = !0;
cc.director.__fastOn(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this);
}
},
_restoreProperties: !1,
onRestore: !1
}, dt = cc.Class(ft), pt = dt.prototype;
l.getset(pt, "position", pt.getPosition, pt.setPosition, !1, !0);
cc.Node = e.exports = dt;
}), {
"./event-manager": 184,
"./event/event": 187,
"./event/event-target": 186,
"./platform/CCMacro": 244,
"./platform/js": 260,
"./renderer/render-flow": 272,
"./utils/affine-transform": 313,
"./utils/base-node": 314,
"./utils/prefab-helper": 325,
"./utils/trans-pool": 331,
"./value-types": 337
} ],
73: [ (function(t, e) {
"use strict";
var i = t("./CCNode"), n = (t("./renderer/render-flow"), cc.Object.Flags.HideInHierarchy, 
i._LocalDirtyFlag), r = cc.Class({
name: "cc.PrivateNode",
extends: i,
properties: {
x: {
get: function() {
return this._originPos.x;
},
set: function(t) {
var e = this._originPos;
if (t !== e.x) {
e.x = t;
this._posDirty(!0);
}
},
override: !0
},
y: {
get: function() {
return this._originPos.y;
},
set: function(t) {
var e = this._originPos;
if (t !== e.y) {
e.y = t;
this._posDirty(!0);
}
},
override: !0
},
zIndex: {
get: function() {
return cc.macro.MIN_ZINDEX;
},
set: function() {},
override: !0
},
showInEditor: {
default: !1,
editorOnly: !0,
override: !0
}
},
ctor: function() {
this._localZOrder = cc.macro.MIN_ZINDEX << 16;
this._originPos = cc.v2();
},
_posDirty: function(t) {
this.setLocalDirty(n.POSITION);
!0 === t && 1 & this._eventMask && this.emit(i.EventType.POSITION_CHANGED);
},
_updateLocalMatrix: function() {
if (this._localMatDirty) {
var t = this.parent;
if (t) {
this._trs[0] = this._originPos.x - (t._anchorPoint.x - .5) * t._contentSize.width;
this._trs[1] = this._originPos.y - (t._anchorPoint.y - .5) * t._contentSize.height;
}
this._super();
}
},
getPosition: function() {
return new cc.Vec2(this._originPos);
},
setPosition: function(t, e) {
void 0 === e && (e = (t = t.x).y);
var i = this._originPos;
if (i.x !== t || i.y !== e) {
i.x = t;
i.y = e;
this._posDirty(!0);
}
},
setParent: function(t) {
var e = this._parent;
this._super(t);
if (e !== t) {
e && e.off(i.EventType.ANCHOR_CHANGED, this._posDirty, this);
t && t.on(i.EventType.ANCHOR_CHANGED, this._posDirty, this);
}
},
_updateOrderOfArrival: function() {}
}), s = r.prototype;
cc.js.getset(s, "parent", s.getParent, s.setParent);
cc.js.getset(s, "position", s.getPosition, s.setPosition);
cc.PrivateNode = e.exports = r;
}), {
"./CCNode": 72,
"./renderer/render-flow": 272
} ],
74: [ (function(t, e) {
"use strict";
cc.Scene = cc.Class({
name: "cc.Scene",
extends: t("./CCNode"),
properties: {
_is3DNode: {
default: !0,
override: !0
},
autoReleaseAssets: !1
},
ctor: function() {
this._anchorPoint.x = 0;
this._anchorPoint.y = 0;
this._activeInHierarchy = !1;
this._inited = !cc.game._isCloning;
this.dependAssets = null;
},
destroy: function() {
if (cc.Object.prototype.destroy.call(this)) for (var t = this._children, e = 0; e < t.length; ++e) t[e].active = !1;
this._active = !1;
this._activeInHierarchy = !1;
},
_onHierarchyChanged: function() {},
_instantiate: null,
_load: function() {
if (!this._inited) {
this._onBatchCreated(!1);
this._inited = !0;
}
},
_activate: function(t) {
t = !1 !== t;
cc.director._nodeActivator.activateNode(this, t);
}
});
e.exports = cc.Scene;
}), {
"./CCNode": 72
} ],
75: [ (function(t, e) {
"use strict";
var i = t("./platform/js"), n = new (t("./platform/id-generater"))("Scheduler"), r = function(t, e, i, n) {
this.target = t;
this.priority = e;
this.paused = i;
this.markedForDeletion = n;
}, s = [];
r.get = function(t, e, i, n) {
var o = s.pop();
if (o) {
o.target = t;
o.priority = e;
o.paused = i;
o.markedForDeletion = n;
} else o = new r(t, e, i, n);
return o;
};
r.put = function(t) {
if (s.length < 20) {
t.target = null;
s.push(t);
}
};
var o = function(t, e, i, n) {
this.list = t;
this.entry = e;
this.target = i;
this.callback = n;
}, a = [];
o.get = function(t, e, i, n) {
var r = a.pop();
if (r) {
r.list = t;
r.entry = e;
r.target = i;
r.callback = n;
} else r = new o(t, e, i, n);
return r;
};
o.put = function(t) {
if (a.length < 20) {
t.list = t.entry = t.target = t.callback = null;
a.push(t);
}
};
var c = function(t, e, i, n, r, s) {
var o = this;
o.timers = t;
o.target = e;
o.timerIndex = i;
o.currentTimer = n;
o.currentTimerSalvaged = r;
o.paused = s;
}, l = [];
c.get = function(t, e, i, n, r, s) {
var o = l.pop();
if (o) {
o.timers = t;
o.target = e;
o.timerIndex = i;
o.currentTimer = n;
o.currentTimerSalvaged = r;
o.paused = s;
} else o = new c(t, e, i, n, r, s);
return o;
};
c.put = function(t) {
if (l.length < 20) {
t.timers = t.target = t.currentTimer = null;
l.push(t);
}
};
function u() {
this._lock = !1;
this._scheduler = null;
this._elapsed = -1;
this._runForever = !1;
this._useDelay = !1;
this._timesExecuted = 0;
this._repeat = 0;
this._delay = 0;
this._interval = 0;
this._target = null;
this._callback = null;
}
var h = u.prototype;
h.initWithCallback = function(t, e, i, n, r, s) {
this._lock = !1;
this._scheduler = t;
this._target = i;
this._callback = e;
this._elapsed = -1;
this._interval = n;
this._delay = s;
this._useDelay = this._delay > 0;
this._repeat = r;
this._runForever = this._repeat === cc.macro.REPEAT_FOREVER;
return !0;
};
h.getInterval = function() {
return this._interval;
};
h.setInterval = function(t) {
this._interval = t;
};
h.update = function(t) {
if (-1 === this._elapsed) {
this._elapsed = 0;
this._timesExecuted = 0;
} else {
this._elapsed += t;
if (this._runForever && !this._useDelay) {
if (this._elapsed >= this._interval) {
this.trigger();
this._elapsed = 0;
}
} else {
if (this._useDelay) {
if (this._elapsed >= this._delay) {
this.trigger();
this._elapsed -= this._delay;
this._timesExecuted += 1;
this._useDelay = !1;
}
} else if (this._elapsed >= this._interval) {
this.trigger();
this._elapsed = 0;
this._timesExecuted += 1;
}
this._callback && !this._runForever && this._timesExecuted > this._repeat && this.cancel();
}
}
};
h.getCallback = function() {
return this._callback;
};
h.trigger = function() {
if (this._target && this._callback) {
this._lock = !0;
this._callback.call(this._target, this._elapsed);
this._lock = !1;
}
};
h.cancel = function() {
this._scheduler.unschedule(this._callback, this._target);
};
var _ = [];
u.get = function() {
return _.pop() || new u();
};
u.put = function(t) {
if (_.length < 20 && !t._lock) {
t._scheduler = t._target = t._callback = null;
_.push(t);
}
};
cc.Scheduler = function() {
this._timeScale = 1;
this._updatesNegList = [];
this._updates0List = [];
this._updatesPosList = [];
this._hashForUpdates = i.createMap(!0);
this._hashForTimers = i.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 < n; i++) if (e[i] === t) {
e.splice(i, 1);
break;
}
c.put(t);
},
_removeUpdateFromHash: function(t) {
var e = t.target._id, i = this._hashForUpdates[e];
if (i) {
for (var n = i.list, s = i.entry, a = 0, c = n.length; a < c; a++) if (n[a] === s) {
n.splice(a, 1);
break;
}
delete this._hashForUpdates[e];
r.put(s);
o.put(i);
}
},
_priorityIn: function(t, e, i) {
for (var n = 0; n < t.length; n++) if (i < t[n].priority) {
t.splice(n, 0, e);
return;
}
t.push(e);
},
_appendIn: function(t, e) {
t.push(e);
},
enableForTarget: function(t) {
t._id || (t.__instanceId ? cc.warnID(1513) : t._id = n.getNewId());
},
setTimeScale: function(t) {
this._timeScale = t;
},
getTimeScale: function() {
return this._timeScale;
},
update: function(t) {
this._updateHashLocked = !0;
1 !== this._timeScale && (t *= this._timeScale);
var e, i, n, r;
for (e = 0, n = (i = this._updatesNegList).length; e < n; e++) (r = i[e]).paused || r.markedForDeletion || r.target.update(t);
for (e = 0, n = (i = this._updates0List).length; e < n; e++) (r = i[e]).paused || r.markedForDeletion || r.target.update(t);
for (e = 0, n = (i = this._updatesPosList).length; e < n; e++) (r = i[e]).paused || r.markedForDeletion || r.target.update(t);
var s, o = this._arrayForTimers;
for (e = 0; e < o.length; e++) {
s = o[e];
this._currentTarget = s;
this._currentTargetSalvaged = !1;
if (!s.paused) for (s.timerIndex = 0; s.timerIndex < s.timers.length; ++s.timerIndex) {
s.currentTimer = s.timers[s.timerIndex];
s.currentTimerSalvaged = !1;
s.currentTimer.update(t);
s.currentTimer = null;
}
if (this._currentTargetSalvaged && 0 === this._currentTarget.timers.length) {
this._removeHashElement(this._currentTarget);
--e;
}
}
for (e = 0, i = this._updatesNegList; e < i.length; ) (r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++;
for (e = 0, i = this._updates0List; e < i.length; ) (r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++;
for (e = 0, i = this._updatesPosList; e < i.length; ) (r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++;
this._updateHashLocked = !1;
this._currentTarget = null;
},
schedule: function(t, e, i, n, r, s) {
if ("function" != typeof t) {
var o = t;
t = e;
e = o;
}
if (4 === arguments.length || 5 === arguments.length) {
s = !!n;
n = cc.macro.REPEAT_FOREVER;
r = 0;
}
cc.assertID(e, 1502);
var a = e._id;
if (!a) if (e.__instanceId) {
cc.warnID(1513);
a = e._id = e.__instanceId;
} else cc.errorID(1510);
var l, h, _ = this._hashForTimers[a];
if (_) _.paused !== s && cc.warnID(1511); else {
_ = c.get(null, e, 0, null, null, s);
this._arrayForTimers.push(_);
this._hashForTimers[a] = _;
}
if (null == _.timers) _.timers = []; else for (h = 0; h < _.timers.length; ++h) if ((l = _.timers[h]) && t === l._callback) {
cc.logID(1507, l.getInterval(), i);
l._interval = i;
return;
}
(l = u.get()).initWithCallback(this, t, e, i, n, r);
_.timers.push(l);
this._currentTarget === _ && this._currentTargetSalvaged && (this._currentTargetSalvaged = !1);
},
scheduleUpdate: function(t, e, i) {
var n = t._id;
if (!n) if (t.__instanceId) {
cc.warnID(1513);
n = t._id = t.__instanceId;
} else cc.errorID(1510);
var s = this._hashForUpdates[n];
if (s && s.entry) {
if (s.entry.priority === e) {
s.entry.markedForDeletion = !1;
s.entry.paused = i;
return;
}
if (this._updateHashLocked) {
cc.logID(1506);
s.entry.markedForDeletion = !1;
s.entry.paused = i;
return;
}
this.unscheduleUpdate(t);
}
var a, c = r.get(t, e, i, !1);
if (0 === e) {
a = this._updates0List;
this._appendIn(a, c);
} else {
a = e < 0 ? this._updatesNegList : this._updatesPosList;
this._priorityIn(a, c, e);
}
this._hashForUpdates[n] = o.get(a, c, t, null);
},
unschedule: function(t, e) {
if (e && t) {
var i = e._id;
if (!i) if (e.__instanceId) {
cc.warnID(1513);
i = e._id = e.__instanceId;
} else cc.errorID(1510);
var n = this._hashForTimers[i];
if (n) for (var r = n.timers, s = 0, o = r.length; s < o; s++) {
var a = r[s];
if (t === a._callback) {
a !== n.currentTimer || n.currentTimerSalvaged || (n.currentTimerSalvaged = !0);
r.splice(s, 1);
u.put(a);
n.timerIndex >= s && n.timerIndex--;
0 === r.length && (this._currentTarget === n ? this._currentTargetSalvaged = !0 : this._removeHashElement(n));
return;
}
}
}
},
unscheduleUpdate: function(t) {
if (t) {
var e = t._id;
if (!e) if (t.__instanceId) {
cc.warnID(1513);
e = t._id = t.__instanceId;
} else 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;
if (!e) if (t.__instanceId) {
cc.warnID(1513);
e = t._id = t.__instanceId;
} else 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 < s; r++) u.put(n[r]);
n.length = 0;
this._currentTarget === i ? this._currentTargetSalvaged = !0 : this._removeHashElement(i);
}
this.unscheduleUpdate(t);
}
},
unscheduleAll: function() {
this.unscheduleAllWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM);
},
unscheduleAllWithMinPriority: function(t) {
var e, i, n, r = this._arrayForTimers;
for (e = r.length - 1; e >= 0; e--) {
i = r[e];
this.unscheduleAllForTarget(i.target);
}
var s = 0;
if (t < 0) for (e = 0; e < this._updatesNegList.length; ) {
s = this._updatesNegList.length;
(n = this._updatesNegList[e]) && n.priority >= t && this.unscheduleUpdate(n.target);
s == this._updatesNegList.length && e++;
}
if (t <= 0) for (e = 0; e < this._updates0List.length; ) {
s = this._updates0List.length;
(n = this._updates0List[e]) && this.unscheduleUpdate(n.target);
s == this._updates0List.length && e++;
}
for (e = 0; e < this._updatesPosList.length; ) {
s = this._updatesPosList.length;
(n = this._updatesPosList[e]) && n.priority >= 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;
if (!i) if (e.__instanceId) {
cc.warnID(1513);
i = e._id = e.__instanceId;
} else 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 < r.length; ++s) if (t === r[s]._callback) return !0;
return !1;
},
pauseAllTargets: function() {
return this.pauseAllTargetsWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM);
},
pauseAllTargetsWithMinPriority: function(t) {
var e, i, n, r, s = [], o = this._arrayForTimers;
for (i = 0, n = o.length; i < n; i++) if (e = o[i]) {
e.paused = !0;
s.push(e.target);
}
if (t < 0) for (i = 0; i < this._updatesNegList.length; i++) if ((r = this._updatesNegList[i]) && r.priority >= t) {
r.paused = !0;
s.push(r.target);
}
if (t <= 0) for (i = 0; i < this._updates0List.length; i++) if (r = this._updates0List[i]) {
r.paused = !0;
s.push(r.target);
}
for (i = 0; i < this._updatesPosList.length; i++) if ((r = this._updatesPosList[i]) && r.priority >= t) {
r.paused = !0;
s.push(r.target);
}
return s;
},
resumeTargets: function(t) {
if (t) for (var e = 0; e < t.length; e++) this.resumeTarget(t[e]);
},
pauseTarget: function(t) {
cc.assertID(t, 1503);
var e = t._id;
if (!e) if (t.__instanceId) {
cc.warnID(1513);
e = t._id = t.__instanceId;
} else cc.errorID(1510);
var i = this._hashForTimers[e];
i && (i.paused = !0);
var n = this._hashForUpdates[e];
n && (n.entry.paused = !0);
},
resumeTarget: function(t) {
cc.assertID(t, 1504);
var e = t._id;
if (!e) if (t.__instanceId) {
cc.warnID(1513);
e = t._id = t.__instanceId;
} else cc.errorID(1510);
var i = this._hashForTimers[e];
i && (i.paused = !1);
var n = this._hashForUpdates[e];
n && (n.entry.paused = !1);
},
isTargetPaused: function(t) {
cc.assertID(t, 1505);
var e = t._id;
if (!e) if (t.__instanceId) {
cc.warnID(1513);
e = t._id = t.__instanceId;
} else cc.errorID(1510);
var i = this._hashForTimers[e];
if (i) return i.paused;
var n = this._hashForUpdates[e];
return !!n && n.entry.paused;
}
};
cc.Scheduler.PRIORITY_SYSTEM = 1 << 31;
cc.Scheduler.PRIORITY_NON_SYSTEM = cc.Scheduler.PRIORITY_SYSTEM + 1;
e.exports = cc.Scheduler;
}), {
"./platform/id-generater": 256,
"./platform/js": 260
} ],
76: [ (function(t, e) {
"use strict";
var i = t("./preprocess"), n = t("./fetch"), r = t("./cache"), s = t("./helper"), o = t("./releaseManager"), a = t("./depend-util"), c = t("./load"), l = t("./pipeline"), u = t("./task"), h = t("./request-item"), _ = t("./downloader"), f = t("./parser"), d = t("./pack-manager"), p = t("./bundle"), m = t("./builtins"), y = t("./factory"), v = t("./urlTransformer"), g = v.parse, b = v.combine, C = t("./utilities"), x = C.parseParameters, A = C.asyncify, S = t("./shared"), T = S.assets, w = S.files, E = S.parsed, M = S.pipeline, B = S.transformPipeline, I = S.fetchPipeline, D = S.RequestType, P = S.bundles, R = S.BuiltinBundleName;
function L() {
this._preprocessPipe = i;
this._fetchPipe = n;
this._loadPipe = c;
this.pipeline = M.append(i).append(c);
this.fetchPipeline = I.append(i).append(n);
this.transformPipeline = B.append(g).append(b);
this.bundles = P;
this.assets = T;
this._files = w;
this._parsed = E;
this.generalImportBase = "";
this.generalNativeBase = "";
this.dependUtil = a;
this._releaseManager = o;
this.cacheAsset = !0;
this.force = !1;
this.utils = s;
this.downloader = _;
this.parser = f;
this.builtins = m;
this.packManager = d;
this.factory = y;
this.cacheManager = null;
this.presets = {
default: {
priority: 0
},
preload: {
maxConcurrency: 2,
maxRequestsPerFrame: 2,
priority: -1
},
scene: {
maxConcurrency: 8,
maxRequestsPerFrame: 8,
priority: 1
},
bundle: {
maxConcurrency: 8,
maxRequestsPerFrame: 8,
priority: 2
},
remote: {
maxRetryCount: 4
},
script: {
maxConcurrency: 1024,
maxRequestsPerFrame: 1024,
priority: 2
}
};
}
L.Pipeline = l;
L.Task = u;
L.Cache = r;
L.RequestItem = h;
L.Bundle = p;
L.BuiltinBundleName = R;
L.prototype = {
constructor: L,
get main() {
return P.get(R.MAIN);
},
get resources() {
return P.get(R.RESOURCES);
},
get internal() {
return P.get(R.INTERNAL);
},
init: function(t) {
t = t || Object.create(null);
this._files.clear();
this._parsed.clear();
this._releaseManager.init();
this.assets.clear();
this.bundles.clear();
this.packManager.init();
this.downloader.init(t.bundleVers, t.server);
this.parser.init();
this.dependUtil.init();
this.generalImportBase = t.importBase;
this.generalNativeBase = t.nativeBase;
},
getBundle: function(t) {
return P.get(t);
},
removeBundle: function(t) {
t._destroy();
P.remove(t.name);
},
loadAny: function(t, e, i, n) {
var r = x(e, i, n);
e = r.options, i = r.onProgress, n = r.onComplete;
e.preset = e.preset || "default";
t = Array.isArray(t) ? t.concat() : t;
var s = new u({
input: t,
onProgress: i,
onComplete: A(n),
options: e
});
M.async(s);
},
preloadAny: function(t, e, i, n) {
var r = x(e, i, n);
e = r.options, i = r.onProgress, n = r.onComplete;
e.preset = e.preset || "preload";
t = Array.isArray(t) ? t.concat() : t;
var s = new u({
input: t,
onProgress: i,
onComplete: A(n),
options: e
});
I.async(s);
},
postLoadNative: function(t, e, i) {
if (!(t instanceof cc.Asset)) throw new Error("input is not asset");
var n = x(e, void 0, i);
e = n.options, i = n.onComplete;
if (!t._native || t._nativeAsset) return A(i)(null);
var r = a.getNativeDep(t._uuid);
if (r) {
if (!P.has(r.bundle)) {
var s = P.find((function(e) {
return e.getAssetInfo(t._uuid);
}));
s && (r.bundle = s.name);
}
this.loadAny(r, e, (function(e, n) {
e ? cc.error(e.message, e.stack) : t.isValid && !t._nativeAsset && (t._nativeAsset = n);
i && i(e);
}));
}
},
loadRemote: function(t, e, i) {
var n = x(e, void 0, i);
e = n.options, i = n.onComplete;
if (this.assets.has(t)) return A(i)(null, this.assets.get(t));
e.__isNative__ = !0;
e.preset = e.preset || "remote";
this.loadAny({
url: t
}, e, null, (function(n, r) {
if (n) {
cc.error(n.message, n.stack);
i && i(n, null);
} else y.create(t, r, e.ext || cc.path.extname(t), e, (function(t, e) {
i && i(t, e);
}));
}));
},
loadScript: function(t, e, i) {
var n = x(e, void 0, i);
e = n.options, i = n.onComplete;
e.__requestType__ = D.URL;
e.preset = e.preset || "script";
this.loadAny(t, e, i);
},
loadBundle: function(t, e, i) {
var n = x(e, void 0, i), r = (e = n.options, i = n.onComplete, cc.path.basename(t));
if (this.bundles.has(r)) return A(i)(null, this.getBundle(r));
e.preset = e.preset || "bundle";
e.ext = "bundle";
this.loadRemote(t, e, i);
},
releaseAsset: function(t) {
o.tryRelease(t, !0);
},
releaseUnusedAssets: function() {
T.forEach((function(t) {
o.tryRelease(t);
}));
},
releaseAll: function() {
T.forEach((function(t) {
o.tryRelease(t, !0);
}));
},
_transform: function(t, e) {
var i = u.create({
input: t,
options: e
}), n = [];
try {
for (var r = B.sync(i), s = 0, o = r.length; s < o; s++) {
var a = r[s], c = a.url;
a.recycle();
n.push(c);
}
} catch (t) {
for (s = 0, o = i.output.length; s < o; s++) i.output[s].recycle();
cc.error(t.message, t.stack);
}
i.recycle();
return n.length > 1 ? n : n[0];
}
};
cc.AssetManager = L;
cc.assetManager = new L();
Object.defineProperty(cc, "resources", {
get: function() {
return P.get(R.RESOURCES);
}
});
e.exports = cc.assetManager;
}), {
"./builtins": 77,
"./bundle": 78,
"./cache": 79,
"./depend-util": 81,
"./downloader": 88,
"./factory": 89,
"./fetch": 90,
"./helper": 92,
"./load": 94,
"./pack-manager": 95,
"./parser": 96,
"./pipeline": 97,
"./preprocess": 98,
"./releaseManager": 99,
"./request-item": 100,
"./shared": 101,
"./task": 102,
"./urlTransformer": 103,
"./utilities": 104
} ],
77: [ (function(t, e) {
"use strict";
var i = t("./cache"), n = t("./releaseManager"), r = t("./shared").BuiltinBundleName, s = {
_assets: new i({
material: new i(),
effect: new i()
}),
_loadBuiltins: function(t, e) {
var i = t + "s", n = this._assets.get(t);
return cc.assetManager.internal.loadDir(i, null, null, (function(t, i) {
if (t) cc.error(t.message, t.stack); else for (var r = 0; r < i.length; r++) {
var s = i[r];
n.add(s.name, s.addRef());
}
e();
}));
},
init: function(t) {
var e = this;
this.clear();
if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS || !cc.assetManager.bundles.has(r.INTERNAL)) return t && t();
this._loadBuiltins("effect", (function() {
e._loadBuiltins("material", t);
}));
},
getBuiltin: function(t, e) {
return 0 === arguments.length ? this._assets : 1 === arguments.length ? this._assets.get(t) : this._assets.get(t).get(e);
},
clear: function() {
this._assets.forEach((function(t) {
t.forEach((function(t) {
n.tryRelease(t, !0);
}));
t.clear();
}));
}
};
e.exports = s;
}), {
"./cache": 79,
"./releaseManager": 99,
"./shared": 101
} ],
78: [ (function(t, e) {
"use strict";
var i = t("./config"), n = t("./releaseManager"), r = t("./utilities"), s = r.parseParameters, o = r.parseLoadResArgs, a = t("./shared"), c = a.RequestType, l = a.assets, u = a.bundles;
function h() {
this._config = new i();
}
h.prototype = {
constructor: h,
get name() {
return this._config.name;
},
get deps() {
return this._config.deps;
},
get base() {
return this._config.base;
},
getInfoWithPath: function(t, e) {
return this._config.getInfoWithPath(t, e);
},
getDirWithPath: function(t, e, i) {
return this._config.getDirWithPath(t, e, i);
},
getAssetInfo: function(t) {
return this._config.getAssetInfo(t);
},
getSceneInfo: function(t) {
return this._config.getSceneInfo(t);
},
init: function(t) {
this._config.init(t);
u.add(t.name, this);
},
load: function(t, e, i, n) {
var r = o(e, i, n);
e = r.type, i = r.onProgress, n = r.onComplete;
cc.assetManager.loadAny(t, {
__requestType__: c.PATH,
type: e,
bundle: this.name,
__outputAsArray__: Array.isArray(t)
}, i, n);
},
preload: function(t, e, i, n) {
var r = o(e, i, n);
e = r.type, i = r.onProgress, n = r.onComplete;
cc.assetManager.preloadAny(t, {
__requestType__: c.PATH,
type: e,
bundle: this.name
}, i, n);
},
loadDir: function(t, e, i, n) {
var r = o(e, i, n);
e = r.type, i = r.onProgress, n = r.onComplete;
cc.assetManager.loadAny(t, {
__requestType__: c.DIR,
type: e,
bundle: this.name,
__outputAsArray__: !0
}, i, n);
},
preloadDir: function(t, e, i, n) {
var r = o(e, i, n);
e = r.type, i = r.onProgress, n = r.onComplete;
cc.assetManager.preloadAny(t, {
__requestType__: c.DIR,
type: e,
bundle: this.name
}, i, n);
},
loadScene: function(t, e, i, n) {
var r = s(e, i, n);
e = r.options, i = r.onProgress, n = r.onComplete;
e.preset = e.preset || "scene";
e.bundle = this.name;
cc.assetManager.loadAny({
scene: t
}, e, i, (function(t, e) {
if (t) {
cc.error(t.message, t.stack);
n && n(t);
} else if (e instanceof cc.SceneAsset) {
var i = e.scene;
i._id = e._uuid;
i._name = e._name;
n && n(null, e);
} else n && n(new Error("The asset " + e._uuid + " is not a scene"));
}));
},
preloadScene: function(t, e, i, n) {
var r = s(e, i, n);
e = r.options, i = r.onProgress, n = r.onComplete;
e.bundle = this.name;
cc.assetManager.preloadAny({
scene: t
}, e, i, (function(e) {
e && cc.errorID(1210, t, e.message);
n && n(e);
}));
},
get: function(t, e) {
var i = this.getInfoWithPath(t, e);
return l.get(i && i.uuid);
},
release: function(t, e) {
n.tryRelease(this.get(t, e), !0);
},
releaseUnusedAssets: function() {
var t = this;
l.forEach((function(e) {
var i = t.getAssetInfo(e._uuid);
i && !i.redirect && n.tryRelease(e);
}));
},
releaseAll: function() {
var t = this;
l.forEach((function(e) {
var i = t.getAssetInfo(e._uuid);
i && !i.redirect && n.tryRelease(e, !0);
}));
},
_destroy: function() {
this._config.destroy();
}
};
e.exports = h;
}), {
"./config": 80,
"./releaseManager": 99,
"./shared": 101,
"./utilities": 104
} ],
79: [ (function(t, e) {
"use strict";
var i = t("../platform/js");
function n(t) {
if (t) {
this._map = t;
this._count = Object.keys(t).length;
} else {
this._map = i.createMap(!0);
this._count = 0;
}
}
n.prototype = {
constructor: n,
add: function(t, e) {
t in this._map || this._count++;
return this._map[t] = e;
},
get: function(t) {
return this._map[t];
},
has: function(t) {
return t in this._map;
},
remove: function(t) {
var e = this._map[t];
if (t in this._map) {
delete this._map[t];
this._count--;
}
return e;
},
clear: function() {
if (0 !== this._count) {
this._map = i.createMap(!0);
this._count = 0;
}
},
forEach: function(t) {
for (var e in this._map) t(this._map[e], e);
},
find: function(t) {
for (var e in this._map) if (t(this._map[e], e)) return this._map[e];
return null;
},
get count() {
return this._count;
},
destroy: function() {
this._map = null;
}
};
e.exports = n;
}), {
"../platform/js": 260
} ],
80: [ (function(t, e) {
"use strict";
var i = t("../platform/js"), n = t("./cache"), r = t("./helper").normalize, s = t("./utilities").processOptions;
function o() {
this.name = "";
this.base = "";
this.importBase = "";
this.nativeBase = "";
this.deps = null;
this.assetInfos = new n();
this.scenes = new n();
this.paths = new n();
}
o.prototype = {
constructor: o,
init: function(t) {
s(t);
this.importBase = t.importBase || "";
this.nativeBase = t.nativeBase || "";
this.base = t.base || "";
this.name = t.name || "";
this.deps = t.deps || [];
this._initUuid(t.uuids);
this._initPath(t.paths);
this._initScene(t.scenes);
this._initPackage(t.packs);
this._initVersion(t.versions);
this._initRedirect(t.redirect);
},
_initUuid: function(t) {
if (t) {
this.assetInfos.clear();
for (var e = 0, i = t.length; e < i; e++) {
var n = t[e];
this.assetInfos.add(n, {
uuid: n
});
}
}
},
_initPath: function(t) {
if (t) {
var e = this.paths;
e.clear();
for (var n in t) {
var r = t[n], s = r[0], o = r[1], a = 3 === r.length, c = this.assetInfos.get(n);
c.path = s;
c.ctor = i._getClassById(o);
e.has(s) ? a ? e.get(s).push(c) : e.get(s).splice(0, 0, c) : e.add(s, [ c ]);
}
}
},
_initScene: function(t) {
if (t) {
var e = this.scenes;
e.clear();
var i = this.assetInfos;
for (var n in t) {
var r = t[n], s = i.get(r);
s.url = n;
e.add(n, s);
}
}
},
_initPackage: function(t) {
if (t) {
var e = this.assetInfos;
for (var i in t) {
var n = t[i], r = {
uuid: i,
packs: n,
ext: ".json"
};
e.add(i, r);
for (var s = 0, o = n.length; s < o; s++) {
var a = n[s], c = e.get(a), l = c.packs;
l ? 1 === o ? l.splice(0, 0, r) : l.push(r) : c.packs = [ r ];
}
}
}
},
_initVersion: function(t) {
if (t) {
var e = this.assetInfos, i = t.import;
if (i) for (var n = 0, r = i.length; n < r; n += 2) {
var s = i[n];
e.get(s).ver = i[n + 1];
}
if (i = t.native) for (n = 0, r = i.length; n < r; n += 2) {
s = i[n];
e.get(s).nativeVer = i[n + 1];
}
}
},
_initRedirect: function(t) {
if (t) for (var e = this.assetInfos, i = 0, n = t.length; i < n; i += 2) {
var r = t[i];
e.get(r).redirect = t[i + 1];
}
},
getInfoWithPath: function(t, e) {
if (!t) return null;
t = r(t);
var n = this.paths.get(t);
if (n) {
if (!e) return n[0];
for (var s = 0, o = n.length; s < o; s++) {
var a = n[s];
if (i.isChildClassOf(a.ctor, e)) return a;
}
}
return null;
},
getDirWithPath: function(t, e, n) {
"/" === (t = r(t))[t.length - 1] && (t = t.slice(0, -1));
var s = n || [];
function o(t, e) {
return !(t.length > e.length) || 47 === t.charCodeAt(e.length);
}
this.paths.forEach((function(n, r) {
if (r.startsWith(t) && o(r, t) || !t) for (var a = 0, c = n.length; a < c; a++) {
var l = n[a];
e && !i.isChildClassOf(l.ctor, e) || s.push(l);
}
}));
return s;
},
getAssetInfo: function(t) {
return this.assetInfos.get(t);
},
getSceneInfo: function(t) {
t.endsWith(".fire") || (t += ".fire");
"/" === t[0] || t.startsWith("db://") || (t = "/" + t);
return this.scenes.find((function(e, i) {
return i.endsWith(t);
}));
},
destroy: function() {
this.paths.destroy();
this.scenes.destroy();
this.assetInfos.destroy();
}
};
e.exports = o;
}), {
"../platform/js": 260,
"./cache": 79,
"./helper": 92,
"./utilities": 104
} ],
81: [ (function(t, e) {
"use strict";
var i = (function(t) {
if (t && t.__esModule) return t;
if (null === t || "object" != typeof t && "function" != typeof t) return {
default: t
};
var e = n(void 0);
if (e && e.has(t)) return e.get(t);
var i = {}, r = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) {
var o = r ? Object.getOwnPropertyDescriptor(t, s) : null;
o && (o.get || o.set) ? Object.defineProperty(i, s, o) : i[s] = t[s];
}
i.default = t;
e && e.set(t, i);
return i;
})(t("../platform/deserialize-compiled"));
function n(t) {
if ("function" != typeof WeakMap) return null;
var e = new WeakMap(), i = new WeakMap();
return (n = function(t) {
return t ? i : e;
})(t);
}
var r = t("./cache"), s = t("./deserialize"), o = t("./shared"), a = o.files, c = o.parsed, l = {
_depends: new r(),
init: function() {
this._depends.clear();
},
getNativeDep: function(t) {
var e = this._depends.get(t);
return e ? e.nativeDep && Object.assign({}, e.nativeDep) : null;
},
getDeps: function(t) {
return this._depends.has(t) ? this._depends.get(t).deps : [];
},
getDepsRecursively: function(t) {
var e = Object.create(null), i = [];
this._descend(t, e, i);
return i;
},
_descend: function(t, e, i) {
for (var n = this.getDeps(t), r = 0; r < n.length; r++) {
var s = n[r];
if (!e[s]) {
e[s] = !0;
i.push(s);
this._descend(s, e, i);
}
}
},
remove: function(t) {
this._depends.remove(t);
},
parse: function(t, e) {
var n = null;
if (Array.isArray(e) || e.__type__) {
if (n = this._depends.get(t)) return n;
if (Array.isArray(e) && !(0, i.hasNativeDep)(e)) n = {
deps: this._parseDepsFromJson(e)
}; else try {
var r = s(e);
(n = this._parseDepsFromAsset(r)).nativeDep && (n.nativeDep.uuid = t);
c.add(t + "@import", r);
} catch (e) {
a.remove(t + "@import");
n = {
deps: []
};
}
} else {
if ((n = this._depends.get(t)) && n.parsedFromExistAsset) return n;
n = this._parseDepsFromAsset(e);
}
this._depends.add(t, n);
return n;
},
_parseDepsFromAsset: function(t) {
for (var e = {
deps: [],
parsedFromExistAsset: !0,
preventPreloadNativeObject: t.constructor.preventPreloadNativeObject,
preventDeferredLoadDependents: t.constructor.preventDeferredLoadDependents
}, i = t.__depends__, n = 0, r = i.length; n < r; n++) {
var s = i[n].uuid;
e.deps.push(s);
}
t.__nativeDepend__ && (e.nativeDep = t._nativeDep);
return e;
},
_parseDepsFromJson: function(t) {
var e = (0, i.getDependUuidList)(t);
e.forEach((function(t, i) {
return e[i] = cc.assetManager.utils.decodeUuid(t);
}));
return e;
}
};
e.exports = l;
}), {
"../platform/deserialize-compiled": 254,
"./cache": 79,
"./deserialize": 83,
"./shared": 101
} ],
82: [ (function(t) {
"use strict";
var e = t("../platform/js");
t("../CCDirector");
var i = t("./utilities"), n = t("./depend-util"), r = t("./releaseManager"), s = t("./downloader"), o = t("./factory"), a = t("./helper"), c = [ ".png", ".jpg", ".bmp", ".jpeg", ".gif", ".ico", ".tiff", ".webp", ".image", ".pvr", ".pkm" ], l = [ ".mp3", ".ogg", ".wav", ".m4a" ];
function u() {
return !0;
}
var h = {
transformURL: function(t) {
var e = a.getUuidFromURL(t);
if (!e) return t;
var i = cc.assetManager.bundles.find((function(t) {
return !!t.getAssetInfo(e);
}));
if (!i) return t;
var n, r = i.getAssetInfo(e);
if (!(n = t.startsWith(i.base + i._config.nativeBase) ? r.nativeVer || "" : r.ver || "") || -1 !== t.indexOf(n)) return t;
var s = !1;
".ttf" === cc.path.extname(t) && (s = !0);
if (s) {
var o = cc.path.dirname(t), c = cc.path.basename(t);
t = o + "." + n + "/" + c;
} else t = t.replace(/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/, (function(t) {
return t + "." + n;
}));
return t;
}
}, _ = {
onProgress: null,
_autoReleaseSetting: Object.create(null),
get _cache() {
return cc.assetManager.assets._map;
},
load: function(t, e, i) {
if (void 0 === i && void 0 !== e) {
i = e;
e = null;
}
t = Array.isArray(t) ? t : [ t ];
for (var n = 0; n < t.length; n++) {
var r = t[n];
if ("string" == typeof r) t[n] = {
url: r,
__isNative__: !0
}; else {
if (r.type) {
r.ext = "." + r.type;
r.type = void 0;
}
r.url && (r.__isNative__ = !0);
}
}
var s = [], a = [];
cc.assetManager.loadAny(t, null, (function(t, i, n) {
n.content && (c.includes(n.ext) ? s.push(n.content) : l.includes(n.ext) && a.push(n.content));
e && e(t, i, n);
}), (function(e, n) {
var r = null;
if (!e) {
n = Array.isArray(n) ? n : [ n ];
for (var c = 0; c < n.length; c++) {
var l = n[c];
if (!(l instanceof cc.Asset)) {
var h = l, _ = t[c].url;
s.includes(h) ? o.create(_, l, ".png", null, (function(t, e) {
h = n[c] = e;
})) : a.includes(h) && o.create(_, l, ".mp3", null, (function(t, e) {
h = n[c] = e;
}));
cc.assetManager.assets.add(_, h);
}
}
if (n.length > 1) {
var f = Object.create(null);
n.forEach((function(t) {
f[t._uuid] = t;
}));
r = {
isCompleted: u,
_map: f
};
} else r = n[0];
}
i && i(e, r);
}));
},
getXMLHttpRequest: function() {
return new XMLHttpRequest();
},
_parseLoadResArgs: i.parseLoadResArgs,
getItem: function(t) {
return cc.assetManager.assets.has(t) ? {
content: cc.assetManager.assets.get(t)
} : null;
},
loadRes: function(t, e, i, n) {
var r = this._parseLoadResArgs(e, i, n), s = (e = r.type, r.onProgress), o = r.onComplete, a = cc.path.extname(t);
a && (t = t.slice(0, -a.length));
cc.resources.load(t, e, s, o);
},
loadResArray: function(t, e, i, n) {
var r = this._parseLoadResArgs(e, i, n), s = (e = r.type, r.onProgress), o = r.onComplete;
t.forEach((function(e, i) {
var n = cc.path.extname(e);
n && (t[i] = e.slice(0, -n.length));
}));
cc.resources.load(t, e, s, o);
},
loadResDir: function(t, e, i, n) {
var r = this._parseLoadResArgs(e, i, n), s = (e = r.type, r.onProgress), o = r.onComplete;
cc.resources.loadDir(t, e, s, (function(i, n) {
var r = [];
i || (r = cc.resources.getDirWithPath(t, e).map((function(t) {
return t.path;
})));
o && o(i, n, r);
}));
},
getRes: function(t, e) {
return cc.assetManager.assets.has(t) ? cc.assetManager.assets.get(t) : cc.resources.get(t, e);
},
getResCount: function() {
return cc.assetManager.assets.count;
},
getDependsRecursively: function(t) {
return t ? n.getDepsRecursively("string" == typeof t ? t : t._uuid).concat([ t._uuid ]) : [];
},
get assetLoader() {},
get md5Pipe() {
return h;
},
get downloader() {
return cc.assetManager.downloader;
},
get loader() {
return cc.assetManager.parser;
},
addDownloadHandlers: function(t) {
var e = Object.create(null);
for (var i in t) {
var n = t[i];
e["." + i] = function(t, e, i) {
n({
url: t
}, i);
};
}
cc.assetManager.downloader.register(e);
},
addLoadHandlers: function(t) {
var e = Object.create(null);
for (var i in t) {
var n = t[i];
e["." + i] = function(t, e, i) {
n({
content: t
}, i);
};
}
cc.assetManager.parser.register(e);
},
flowInDeps: function() {},
release: function(t) {
if (Array.isArray(t)) for (var e = 0; e < t.length; e++) {
var i = t[e];
"string" == typeof i && (i = cc.assetManager.assets.get(i));
cc.assetManager.builtins._assets.find((function(t) {
return t.find((function(t) {
return t === i;
}));
})) || cc.assetManager.releaseAsset(i);
} else if (t) {
"string" == typeof t && (t = cc.assetManager.assets.get(t));
if (cc.assetManager.builtins._assets.find((function(e) {
return e.find((function(e) {
return e === t;
}));
}))) return;
cc.assetManager.releaseAsset(t);
}
},
releaseAsset: function(t) {
cc.assetManager.releaseAsset(t);
},
releaseRes: function(t, e) {
cc.resources.release(t, e);
},
releaseResDir: function() {},
releaseAll: function() {
cc.assetManager.releaseAll();
cc.assetManager.assets.clear();
},
removeItem: function(t) {
cc.assetManager.assets.remove(t);
},
setAutoRelease: function(t, e) {
"object" == typeof t && (t = t._uuid);
this._autoReleaseSetting[t] = !!e;
},
setAutoReleaseRecursively: function(t, e) {
"object" == typeof t && (t = t._uuid);
e = !!e;
this._autoReleaseSetting[t] = e;
for (var i = n.getDepsRecursively(t), r = 0; r < i.length; r++) {
var s = i[r];
this._autoReleaseSetting[s] = e;
}
},
isAutoRelease: function(t) {
"object" == typeof t && (t = t._uuid);
return !!this._autoReleaseSetting[t];
}
};
s.loadSubpackage = function(t, e) {
cc.assetManager.loadBundle(t, null, e);
};
var f = {
init: function(t) {
t.importBase = t.libraryPath;
t.nativeBase = t.rawAssetsBase;
cc.assetManager.init(t);
t.rawAssets && new cc.AssetManager.Bundle().init({
name: cc.AssetManager.BuiltinBundleName.RESOURCES,
importBase: t.importBase,
nativeBase: t.nativeBase,
paths: t.rawAssets.assets,
uuids: Object.keys(t.rawAssets.assets)
});
},
loadAsset: function(t, e) {
cc.assetManager.loadAny(t, e);
},
getLibUrlNoExt: function() {},
queryAssetInfo: function() {}
};
cc.url = {
normalize: function(t) {
cc.warnID(1400, "cc.url.normalize", "cc.assetManager.utils.normalize");
return cc.assetManager.utils.normalize(t);
},
raw: function(t) {
cc.warnID(1400, "cc.url.raw", "cc.resources.load");
return t.startsWith("resources/") ? cc.assetManager._transform({
path: cc.path.changeExtname(t.substr(10)),
bundle: cc.AssetManager.BuiltinBundleName.RESOURCES,
__isNative__: !0,
ext: cc.path.extname(t)
}) : "";
}
};
Object.defineProperties(cc, {
loader: {
get: function() {
return _;
}
},
AssetLibrary: {
get: function() {
return f;
}
},
LoadingItems: {
get: function() {
cc.warnID(1400, "cc.LoadingItems", "cc.AssetManager.Task");
return cc.AssetManager.Task;
}
},
Pipeline: {
get: function() {
cc.warnID(1400, "cc.Pipeline", "cc.AssetManager.Pipeline");
return cc.AssetManager.Pipeline;
}
}
});
e.obsolete(cc, "cc.RawAsset", "cc.Asset");
e.obsolete(cc.Asset.prototype, "cc.Asset.url", "nativeUrl");
Object.defineProperties(cc.macro, {
DOWNLOAD_MAX_CONCURRENT: {
get: function() {
return cc.assetManager.downloader.maxConcurrency;
},
set: function(t) {
cc.assetManager.downloader.maxConcurrency = t;
}
}
});
Object.assign(cc.director, {
_getSceneUuid: function(t) {
cc.assetManager.main.getSceneInfo(t);
}
});
Object.defineProperties(cc.game, {
_sceneInfos: {
get: function() {
var t = [];
cc.assetManager.main._config.scenes.forEach((function(e) {
t.push(e);
}));
return t;
}
}
});
var d = i.parseParameters;
i.parseParameters = function(t, e, i) {
var n = d(t, e, i);
n.onProgress = n.onProgress || _.onProgress;
return n;
};
var p = r._autoRelease;
r._autoRelease = function() {
p.apply(this, arguments);
for (var t = _._autoReleaseSetting, e = Object.keys(t), i = 0; i < e.length; i++) {
var n = e[i];
if (!0 === t[n]) {
var s = cc.assetManager.assets.get(n);
s && r.tryRelease(s);
}
}
};
}), {
"../CCDirector": 70,
"../platform/js": 260,
"./depend-util": 81,
"./downloader": 88,
"./factory": 89,
"./helper": 92,
"./releaseManager": 99,
"./utilities": 104
} ],
83: [ (function(t, e) {
"use strict";
var i = t("./helper");
t("../platform/deserialize");
e.exports = function(t, e) {
var n;
n = cc._MissingScript.safeFindClass;
var r, s = null, o = (s = cc.deserialize.Details.pool).get();
try {
r = cc.deserialize(t, o, {
classFinder: n,
customEnv: e
});
} catch (t) {
s.put(o);
throw t;
}
for (var a = o.uuidList, c = o.uuidObjList, l = o.uuidPropList, u = [], h = 0; h < a.length; h++) {
var _ = a[h];
u[h] = {
uuid: i.decodeUuid(_),
owner: c[h],
prop: l[h]
};
}
r.__depends__ = u;
r._native && (r.__nativeDepend__ = !0);
s.put(o);
return r;
};
}), {
"../platform/deserialize": 255,
"../platform/deserialize-compiled": 254,
"../platform/deserialize-editor": void 0,
"./helper": 92
} ],
84: [ (function(t, e) {
"use strict";
var i = cc.sys.__audioSupport, n = t("./utilities").parseParameters;
e.exports = function(t, e, r) {
var s = n(e, void 0, r), o = (e = s.options, r = s.onComplete, document.createElement("audio"));
o.src = t;
var a = function() {
clearTimeout(c);
o.removeEventListener("canplaythrough", l, !1);
o.removeEventListener("error", u, !1);
i.USE_LOADER_EVENT && o.removeEventListener(i.USE_LOADER_EVENT, l, !1);
}, c = setTimeout((function() {
0 === o.readyState ? u() : l();
}), 8e3), l = function() {
a();
r && r(null, o);
}, u = function() {
a();
var e = "load audio failure - " + t;
cc.log(e);
r && r(new Error(e));
};
o.addEventListener("canplaythrough", l, !1);
o.addEventListener("error", u, !1);
i.USE_LOADER_EVENT && o.addEventListener(i.USE_LOADER_EVENT, l, !1);
return o;
};
}), {
"./utilities": 104
} ],
85: [ (function(t, e) {
"use strict";
var i = t("./utilities").parseParameters;
e.exports = function(t, e, n) {
var r = i(e, void 0, n), s = (e = r.options, n = r.onComplete, new Image());
"file:" !== window.location.protocol && (s.crossOrigin = "anonymous");
function o() {
s.removeEventListener("load", o);
s.removeEventListener("error", a);
n && n(null, s);
}
function a() {
s.removeEventListener("load", o);
s.removeEventListener("error", a);
n && n(new Error(cc.debug.getError(4930, t)));
}
s.addEventListener("load", o);
s.addEventListener("error", a);
s.src = t;
return s;
};
}), {
"./utilities": 104
} ],
86: [ (function(t, e) {
"use strict";
var i = t("./utilities").parseParameters;
e.exports = function(t, e, n, r) {
var s = i(e, n, r), o = (e = s.options, n = s.onProgress, r = s.onComplete, new XMLHttpRequest()), a = "download failed: " + t + ", status: ";
o.open("GET", t, !0);
void 0 !== e.responseType && (o.responseType = e.responseType);
void 0 !== e.withCredentials && (o.withCredentials = e.withCredentials);
void 0 !== e.mimeType && o.overrideMimeType && o.overrideMimeType(e.mimeType);
void 0 !== e.timeout && (o.timeout = e.timeout);
if (e.header) for (var c in e.header) o.setRequestHeader(c, e.header[c]);
o.onload = function() {
200 === o.status || 0 === o.status ? r && r(null, o.response) : r && r(new Error(a + o.status + "(no response)"));
};
n && (o.onprogress = function(t) {
t.lengthComputable && n(t.loaded, t.total);
});
o.onerror = function() {
r && r(new Error(a + o.status + "(error)"));
};
o.ontimeout = function() {
r && r(new Error(a + o.status + "(time out)"));
};
o.onabort = function() {
r && r(new Error(a + o.status + "(abort)"));
};
o.send(null);
return o;
};
}), {
"./utilities": 104
} ],
87: [ (function(t, e) {
"use strict";
var i = t("./utilities").parseParameters, n = {};
e.exports = function(t, e, r) {
var s = i(e, void 0, r);
e = s.options, r = s.onComplete;
if (n[t]) return r && r(null);
var o = document, a = document.createElement("script");
"file:" !== window.location.protocol && (a.crossOrigin = "anonymous");
a.async = e.async;
a.src = t;
function c() {
a.parentNode.removeChild(a);
a.removeEventListener("load", c, !1);
a.removeEventListener("error", l, !1);
n[t] = !0;
r && r(null);
}
function l() {
a.parentNode.removeChild(a);
a.removeEventListener("load", c, !1);
a.removeEventListener("error", l, !1);
r && r(new Error(cc.debug.getError(4928, t)));
}
a.addEventListener("load", c, !1);
a.addEventListener("error", l, !1);
o.body.appendChild(a);
};
}), {
"./utilities": 104
} ],
88: [ (function(t, e) {
"use strict";
var i = t("../platform/js"), n = t("../CCDebug"), r = t("./font-loader").loadFont, s = t("../platform/utils").callInNextTick, o = t("./download-dom-image"), a = t("./download-dom-audio"), c = t("./download-file"), l = t("./download-script.js"), u = t("./cache"), h = t("./shared").files, _ = t("../platform/CCSys"), f = _.__audioSupport, d = _.capabilities, p = t("./utilities"), m = p.urlAppendTimestamp, y = p.retry, v = /^(?:\w+:\/\/|\.+\/).+/, g = function(t, e, i) {
e.audioLoadMode !== cc.AudioClip.LoadMode.DOM_AUDIO ? A(t, e, i) : a(t, e, i);
}, b = (g = 0 === (f.format || []).length ? function(t, e, i) {
i(new Error(n.getError(4927)));
} : f.WEB_AUDIO ? g : a, function() {
var t = d.imageBitmap && cc.macro.ALLOW_IMAGE_BITMAP ? C : o;
t.apply(this, arguments);
}), C = function(t, e, i) {
e.responseType = "blob";
c(t, e, e.onFileProgress, i);
}, x = function(t, e, i) {
e.responseType = "json";
c(t, e, e.onFileProgress, (function(t, e) {
if (!t && "string" == typeof e) try {
e = JSON.parse(e);
} catch (e) {
t = e;
}
i && i(t, e);
}));
}, A = function(t, e, i) {
e.responseType = "arraybuffer";
c(t, e, e.onFileProgress, i);
}, S = function(t, e, i) {
e.responseType = "text";
c(t, e, e.onFileProgress, i);
}, T = function(t, e, i) {
i(null, t);
}, w = new u(), E = [], M = !1, B = 0, I = 0, D = -1, P = !1, R = function() {
var t = Date.now(), e = cc.director._deltaTime > O._maxInterval ? O._maxInterval : cc.director._deltaTime;
if (t - D > 1e3 * e) {
I = 0;
D = t;
}
}, L = function t(e, i) {
P = !1;
R();
for (;E.length > 0 && B < e && I < i; ) {
if (M) {
E.sort((function(t, e) {
return t.priority - e.priority;
}));
M = !1;
}
var n = E.pop();
if (!n) break;
B++;
I++;
n.invoke();
}
if (E.length > 0 && B < e) {
s(t, e, i);
P = !0;
}
}, O = {
_remoteServerAddress: "",
_maxInterval: 1 / 30,
get remoteServerAddress() {
return this._remoteServerAddress;
},
maxConcurrency: 6,
maxRequestsPerFrame: 6,
maxRetryCount: 3,
appendTimeStamp: !1,
limited: !0,
retryInterval: 2e3,
bundleVers: null,
downloadDomImage: o,
downloadDomAudio: a,
downloadFile: c,
downloadScript: l,
init: function(t, e) {
w.clear();
E.length = 0;
this._remoteServerAddress = e || "";
this.bundleVers = t || Object.create(null);
},
register: function(t, e) {
"object" == typeof t ? i.mixin(V, t) : V[t] = e;
},
download: function(t, e, i, n, r) {
var o, a, c = V[i] || V.default, l = this;
if (o = h.get(t)) r(null, o); else if (a = w.get(t)) {
a.push(r);
for (var u = 0, _ = E.length; u < _; u++) {
var f = E[u];
if (f.id === t) {
var d = n.priority || 0;
if (f.priority < d) {
f.priority = d;
M = !0;
}
return;
}
}
} else {
var p = "undefined" != typeof n.maxRetryCount ? n.maxRetryCount : this.maxRetryCount, v = "undefined" != typeof n.maxConcurrency ? n.maxConcurrency : this.maxConcurrency, g = "undefined" != typeof n.maxRequestsPerFrame ? n.maxRequestsPerFrame : this.maxRequestsPerFrame;
y((function(i, o) {
0 === i && w.add(t, [ r ]);
if (!l.limited) return c(m(e), n, o);
R();
function a() {
c(m(e), n, (function() {
B--;
if (!P && E.length > 0) {
s(L, v, g);
P = !0;
}
o.apply(this, arguments);
}));
}
if (B < v && I < g) {
a();
B++;
I++;
} else {
E.push({
id: t,
priority: n.priority || 0,
invoke: a
});
M = !0;
if (!P && B < v) {
s(L, v, g);
P = !0;
}
}
}), p, this.retryInterval, (function(e, i) {
e || h.add(t, i);
for (var n = w.remove(t), r = 0, s = n.length; r < s; r++) n[r](e, i);
}));
}
}
}, V = {
".png": b,
".jpg": b,
".bmp": b,
".jpeg": b,
".gif": b,
".ico": b,
".tiff": b,
".webp": b,
".image": b,
".pvr": A,
".pkm": A,
".mp3": g,
".ogg": g,
".wav": g,
".m4a": g,
".txt": S,
".xml": S,
".vsh": S,
".fsh": S,
".atlas": S,
".tmx": S,
".tsx": S,
".json": x,
".ExportJson": x,
".plist": S,
".fnt": S,
".font": r,
".eot": r,
".ttf": r,
".woff": r,
".svg": r,
".ttc": r,
".mp4": T,
".avi": T,
".mov": T,
".mpg": T,
".mpeg": T,
".rm": T,
".rmvb": T,
".binary": A,
".bin": A,
".dbbin": A,
".skel": A,
".js": l,
bundle: function(t, e, i) {
var n = cc.path.basename(t), r = t;
v.test(r) || (r = "assets/" + n);
var s = e.version || O.bundleVers[n], o = 0, a = null, c = null;
x(r + "/config." + (s ? s + "." : "") + "json", e, (function(t, e) {
t && (c = t);
(a = e) && (a.base = r + "/");
2 == ++o && i(c, a);
}));
l(r + "/index." + (s ? s + "." : "") + "js", e, (function(t) {
t && (c = t);
2 == ++o && i(c, a);
}));
},
default: S
};
O._downloaders = V;
e.exports = O;
}), {
"../CCDebug": 69,
"../platform/CCSys": 248,
"../platform/js": 260,
"../platform/utils": 263,
"./cache": 79,
"./download-dom-audio": 84,
"./download-dom-image": 85,
"./download-file": 86,
"./download-script.js": 87,
"./font-loader": 91,
"./shared": 101,
"./utilities": 104
} ],
89: [ (function(t, e) {
"use strict";
var i = t("./bundle"), n = t("./cache"), r = t("./shared"), s = r.assets, o = r.bundles, a = new n();
function c(t, e, i, n) {
var r = null, s = null;
try {
(r = new cc.Texture2D())._nativeUrl = t;
r._nativeAsset = e;
} catch (t) {
s = t;
}
n && n(s, r);
}
function l(t, e, i, n) {
var r = new cc.AudioClip();
r._nativeUrl = t;
r._nativeAsset = e;
r.duration = e.duration;
n && n(null, r);
}
function u(t, e, i, n) {
var r = new cc.VideoClip();
r._nativeUrl = t;
r._nativeAsset = e;
n && n(null, r);
}
function h(t, e, i, n) {
var r = new cc.JsonAsset();
r.json = e;
n && n(null, r);
}
function _(t, e, i, n) {
var r = new cc.TextAsset();
r.text = e;
n && n(null, r);
}
function f(t, e, i, n) {
var r = new cc.TTFFont();
r._nativeUrl = t;
r._nativeAsset = e;
n && n(null, r);
}
function d(t, e, i, n) {
var r = new cc.BufferAsset();
r._nativeUrl = t;
r._nativeAsset = e;
n && n(null, r);
}
var p = {
register: function(t, e) {
"object" == typeof t ? cc.js.mixin(m, t) : m[t] = e;
},
create: function(t, e, i, n, r) {
var o, c, l = m[i] || m.default;
if (o = s.get(t)) r(null, o); else if (c = a.get(t)) c.push(r); else {
a.add(t, [ r ]);
l(t, e, n, (function(e, i) {
if (!e && i instanceof cc.Asset) {
i._uuid = t;
s.add(t, i);
}
for (var n = a.remove(t), r = 0, o = n.length; r < o; r++) n[r](e, i);
}));
}
}
}, m = {
".png": c,
".jpg": c,
".bmp": c,
".jpeg": c,
".gif": c,
".ico": c,
".tiff": c,
".webp": c,
".image": c,
".pvr": c,
".pkm": c,
".mp3": l,
".ogg": l,
".wav": l,
".m4a": l,
".mp4": u,
".avi": u,
".mov": u,
".mpg": u,
".mpeg": u,
".rm": u,
".rmvb": u,
".txt": _,
".xml": _,
".vsh": _,
".fsh": _,
".atlas": _,
".tmx": _,
".tsx": _,
".fnt": _,
".json": h,
".ExportJson": h,
".font": f,
".eot": f,
".ttf": f,
".woff": f,
".svg": f,
".ttc": f,
".binary": d,
".bin": d,
".dbbin": d,
".skel": d,
bundle: function(t, e, n, r) {
var s = o.get(e.name);
if (!s) {
s = new i();
e.base = e.base || t + "/";
s.init(e);
}
r && r(null, s);
},
default: function(t, e, i, n) {
var r = new cc.Asset();
r._nativeUrl = t;
r._nativeAsset = e;
n && n(null, r);
}
};
e.exports = p;
}), {
"./bundle": 78,
"./cache": 79,
"./shared": 101
} ],
90: [ (function(t, e) {
"use strict";
var i = t("./pack-manager"), n = t("./task"), r = t("./utilities"), s = r.getDepends, o = r.clear, a = r.forEach, c = t("./shared"), l = c.assets, u = c.fetchPipeline;
function h(t) {
for (var e = t.output, i = 0, n = e.length; i < n; i++) e[i].content && e[i].content.decRef(!1);
}
function _(t, e, i, n, r, o, a) {
var c = e.options.__exclude__, l = e.progress;
t.content = i;
t.file = n;
e.output.push(t);
if (r) {
c[t.uuid] = !0;
s(t.uuid, n || i, c, o, !0, !1, t.config);
l.total = a + o.length;
}
l.canInvoke && e.dispatch("progress", ++l.finish, l.total, t);
}
e.exports = function(t, e) {
var r = !1;
if (!t.progress) {
t.progress = {
finish: 0,
total: t.input.length,
canInvoke: !0
};
r = !0;
}
var s = t.options, c = [], f = t.progress, d = f.total;
s.__exclude__ = s.__exclude__ || Object.create(null);
t.output = [];
a(t.input, (function(n, s) {
if (!n.isNative && l.has(n.uuid)) {
var o = l.get(n.uuid);
o.addRef();
_(n, t, o, null, o.__asyncLoadAssets__, c, d);
return s();
}
i.load(n, t.options, (function(i, o) {
if (i) {
if (!t.isFinish) if (!cc.assetManager.force || r) {
cc.error(i.message, i.stack);
f.canInvoke = !1;
e(i);
} else _(n, t, null, null, !1, c, d);
} else t.isFinish || _(n, t, null, o, !n.isNative, c, d);
s();
}));
}), (function() {
if (t.isFinish) {
o(t, !0);
return t.dispatch("error");
}
if (c.length > 0) {
var i = n.create({
name: t.name + " dependencies",
input: c,
progress: f,
options: s,
onProgress: t.onProgress,
onError: n.prototype.recycle,
onComplete: function(n) {
if (!n) {
t.output.push.apply(t.output, this.output);
i.recycle();
}
r && h(t);
e(n);
}
});
u.async(i);
} else {
r && h(t);
e();
}
}));
};
}), {
"./pack-manager": 95,
"./shared": 101,
"./task": 102,
"./utilities": 104
} ],
91: [ (function(t, e) {
"use strict";
var i, n = t("../utils/text-utils"), r = null, s = "BES bswy:->@123丁ぁᄁ", o = Object.create(null), a = -1, c = [], l = 3e3, u = (i = void 0, 
function() {
if (void 0 === i) if (window.FontFace) {
var t = /Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent), e = /OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent) && /Apple/.exec(window.navigator.vendor);
i = t ? parseInt(t[1], 10) > 42 : !e;
} else i = !1;
return i;
});
function h() {
for (var t = !0, e = Date.now(), i = c.length - 1; i >= 0; i--) {
var o = c[i], u = o.fontFamilyName;
if (e - o.startTime > l) {
cc.warnID(4933, u);
o.onComplete(null, u);
c.splice(i, 1);
} else {
var h = o.refWidth, _ = "40px " + u;
r.font = _;
if (h !== n.safeMeasureText(r, s, _)) {
c.splice(i, 1);
o.onComplete(null, u);
} else t = !1;
}
}
if (t) {
clearInterval(a);
a = -1;
}
}
var _ = {
loadFont: function(t, e, i) {
var f = _._getFontFamily(t);
if (o[f]) return i(null, f);
if (!r) {
var d = document.createElement("canvas");
d.width = 100;
d.height = 100;
r = d.getContext("2d");
}
var p = "40px " + f;
r.font = p;
var m = n.safeMeasureText(r, s, p), y = document.createElement("style");
y.type = "text/css";
var v = "";
isNaN(f - 0) ? v += "@font-face { font-family:" + f + "; src:" : v += "@font-face { font-family:'" + f + "'; src:";
v += "url('" + t + "');";
y.textContent = v + "}";
document.body.appendChild(y);
var g, b, C, x, A, S, T = document.createElement("div"), w = T.style;
w.fontFamily = f;
T.innerHTML = ".";
w.position = "absolute";
w.left = "-100px";
w.top = "-100px";
document.body.appendChild(T);
if (u()) g = Date.now(), b = f, C = i, x = new Promise(function(t, e) {
(function i() {
Date.now() - g >= l ? e() : document.fonts.load("40px " + b).then((function(e) {
e.length >= 1 ? t() : setTimeout(i, 100);
}), (function() {
e();
}));
})();
}), A = null, S = new Promise(function(t, e) {
A = setTimeout(e, l);
}), Promise.race([ S, x ]).then((function() {
if (A) {
clearTimeout(A);
A = null;
}
C(null, b);
}), (function() {
cc.warnID(4933, b);
C(null, b);
})); else {
var E = {
fontFamilyName: f,
refWidth: m,
onComplete: i,
startTime: Date.now()
};
c.push(E);
-1 === a && (a = setInterval(h, 100));
}
o[f] = y;
},
_getFontFamily: function(t) {
var e = t.lastIndexOf(".ttf");
if (-1 === e) return t;
var i, n = t.lastIndexOf("/");
-1 !== (i = -1 === n ? t.substring(0, e) + "_LABEL" : t.substring(n + 1, e) + "_LABEL").indexOf(" ") && (i = '"' + i + '"');
return i;
}
};
e.exports = _;
}), {
"../utils/text-utils": 329
} ],
92: [ (function(t, e) {
"use strict";
var i, n = t("./shared").bundles, r = {
decodeUuid: t("../utils/decode-uuid"),
getUuidFromURL: (i = /.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/, function(t) {
var e = t.match(i);
return e ? e[1] : "";
}),
getUrlWithUuid: function(t, e) {
(e = e || Object.create(null)).__isNative__ = e.isNative;
e.ext = e.nativeExt;
var i = n.find((function(e) {
return e.getAssetInfo(t);
}));
i && (e.bundle = i.name);
return cc.assetManager._transform(t, e);
},
isScene: function(t) {
return t && (t.constructor === cc.SceneAsset || t instanceof cc.Scene);
},
normalize: function(t) {
t && (46 === t.charCodeAt(0) && 47 === t.charCodeAt(1) ? t = t.slice(2) : 47 === t.charCodeAt(0) && (t = t.slice(1)));
return t;
}
};
e.exports = r;
}), {
"../utils/decode-uuid": 317,
"./shared": 101
} ],
93: [ (function(t) {
"use strict";
t("./deprecated");
t("./CCAssetManager");
}), {
"./CCAssetManager": 76,
"./deprecated": 82
} ],
94: [ (function(t, e) {
"use strict";
var i = t("./pack-manager"), n = t("./pipeline"), r = t("./parser"), s = t("./utilities"), o = s.getDepends, a = s.cache, c = s.gatherAsset, l = s.setProperties, u = s.forEach, h = s.clear, _ = s.checkCircleReference, f = t("./shared"), d = f.assets, p = f.files, m = f.parsed, y = f.pipeline, v = t("./task"), g = new n("loadOneAsset", [ function(t, e) {
var n = t.output = t.input, r = n.options, s = n.isNative, o = n.uuid, a = n.file, c = r.reload;
if (a || !c && !s && d.has(o)) return e();
i.load(n, t.options, (function(t, i) {
n.file = i;
e(t);
}));
}, function(t, e) {
var i = t.output = t.input, n = t.progress, s = t.options.__exclude__, o = i.id, a = i.file, c = i.options;
if (i.isNative) r.parse(o, a, i.ext, c, (function(r, s) {
if (r) return e(r);
i.content = s;
n.canInvoke && t.dispatch("progress", ++n.finish, n.total, i);
p.remove(o);
m.remove(o);
e();
})); else {
var l = i.uuid;
if (l in s) {
var u = s[l], h = u.finish, f = u.content, y = u.err, v = u.callbacks;
n.canInvoke && t.dispatch("progress", ++n.finish, n.total, i);
if (h || _(l, l, s)) {
f && f.addRef && f.addRef();
i.content = f;
e(y);
} else v.push({
done: e,
item: i
});
} else if (!c.reload && d.has(l)) {
var g = d.get(l);
if (c.__asyncLoadAssets__ || !g.__asyncLoadAssets__) {
i.content = g.addRef();
n.canInvoke && t.dispatch("progress", ++n.finish, n.total, i);
e();
} else b(t, g, e, !1);
} else r.parse(o, a, "import", c, (function(i, n) {
if (i) return e(i);
n._uuid = l;
b(t, n, e, !0);
}));
}
} ]);
function b(t, e, i, n) {
var r = t.input, s = t.progress, c = r.uuid, u = r.id, h = r.options, _ = r.config, f = h.__asyncLoadAssets__, d = h.cacheAsset, g = [];
e.addRef && e.addRef();
o(c, e, Object.create(null), g, !1, f, _);
s.canInvoke && t.dispatch("progress", ++s.finish, s.total += g.length, r);
var b = t.options.__exclude__[c] = {
content: e,
finish: !1,
callbacks: [ {
done: i,
item: r
} ]
}, C = v.create({
input: g,
options: t.options,
onProgress: t.onProgress,
onError: v.prototype.recycle,
progress: s,
onComplete: function(t) {
e.decRef && e.decRef(!1);
e.__asyncLoadAssets__ = f;
b.finish = !0;
b.err = t;
if (!t) {
for (var i = Array.isArray(C.output) ? C.output : [ C.output ], r = Object.create(null), s = 0, o = i.length; s < o; s++) {
var h = i[s];
h && (r[h instanceof cc.Asset ? h._uuid + "@import" : c + "@native"] = h);
}
if (n) {
if (!l(c, e, r) && !e.__onLoadInvoked__) try {
e.onLoad && e.onLoad();
e.__onLoadInvoked__ = !0;
} catch (t) {
cc.error(t.message, t.stack);
}
p.remove(u);
m.remove(u);
a(c, e, void 0 !== d ? d : cc.assetManager.cacheAsset);
} else if (e.__nativeDepend__ && !e._nativeAsset && !l(c, e, r) && !e.__onLoadInvoked__) try {
e.onLoad && e.onLoad();
e.__onLoadInvoked__ = !0;
} catch (t) {
cc.error(t.message, t.stack);
}
C.recycle();
}
for (var _ = b.callbacks, y = 0, v = _.length; y < v; y++) {
var g = _[y];
e.addRef && e.addRef();
g.item.content = e;
g.done(t);
}
_.length = 0;
}
});
y.async(C);
}
e.exports = function(t, e) {
var i = !1;
if (!t.progress) {
t.progress = {
finish: 0,
total: t.input.length,
canInvoke: !0
};
i = !0;
}
var n = t.options, r = t.progress;
n.__exclude__ = n.__exclude__ || Object.create(null);
t.output = [];
u(t.input, (function(s, o) {
var a = v.create({
input: s,
onProgress: t.onProgress,
options: n,
progress: r,
onComplete: function(n, s) {
if (n && !t.isFinish) if (!cc.assetManager.force || i) {
cc.error(n.message, n.stack);
r.canInvoke = !1;
e(n);
} else r.canInvoke && t.dispatch("progress", ++r.finish, r.total, s);
t.output.push(s);
a.recycle();
o();
}
});
g.async(a);
}), (function() {
n.__exclude__ = null;
if (t.isFinish) {
h(t, !0);
return t.dispatch("error");
}
c(t);
h(t, !0);
e();
}));
};
}), {
"./pack-manager": 95,
"./parser": 96,
"./pipeline": 97,
"./shared": 101,
"./task": 102,
"./utilities": 104
} ],
95: [ (function(t, e) {
"use strict";
var i = t("../platform/deserialize-compiled"), n = t("./downloader"), r = t("./cache"), s = t("../platform/js"), o = t("./shared").files, a = new r();
function c(t) {
return a.has(t.uuid);
}
var l = {
unpackJson: function(t, e, n, r) {
var o = s.createMap(!0), a = null;
if (Array.isArray(e)) {
(e = (0, i.unpackJSONs)(e)).length !== t.length && cc.errorID(4915);
for (var c = 0; c < t.length; c++) o[t[c] + "@import"] = e[c];
} else {
var l = s._getClassId(cc.Texture2D);
if (e.type === l) {
if (e.data) {
var u = e.data.split("|");
u.length !== t.length && cc.errorID(4915);
for (var h = 0; h < t.length; h++) o[t[h] + "@import"] = (0, i.packCustomObjData)(l, u[h], !0);
}
} else {
a = new Error("unmatched type pack!");
o = null;
}
}
r && r(a, o);
},
init: function() {
a.clear();
},
register: function(t, e) {
"object" == typeof t ? s.mixin(u, t) : u[t] = e;
},
unpack: function(t, e, i, n, r) {
e ? (0, u[i])(t, e, n, r) : r && r(new Error("package data is wrong!"));
},
load: function(t, e, i) {
if (t.isNative || !t.info || !t.info.packs) return n.download(t.id, t.url, t.ext, t.options, i);
if (o.has(t.id)) return i(null, o.get(t.id));
var r = t.info.packs, s = r.find(c);
if (s) return a.get(s.uuid).push({
onComplete: i,
id: t.id
});
s = r[0];
a.add(s.uuid, [ {
onComplete: i,
id: t.id
} ]);
var u = cc.assetManager._transform(s.uuid, {
ext: s.ext,
bundle: t.config.name
});
n.download(s.uuid, u, s.ext, t.options, (function(e, i) {
o.remove(s.uuid);
e && cc.error(e.message, e.stack);
l.unpack(s.packs, i, s.ext, t.options, (function(t, e) {
if (t) t.message = "unpack " + u + " failed! details: " + t.message; else for (var i in e) o.add(i, e[i]);
for (var n = a.remove(s.uuid), r = 0, c = n.length; r < c; r++) {
var l = n[r];
if (t) l.onComplete(t); else {
var h = e[l.id];
h ? l.onComplete(null, h) : l.onComplete(new Error("can not retrieve data from package"));
}
}
}));
}));
}
}, u = {
".json": l.unpackJson
};
e.exports = l;
}), {
"../platform/deserialize-compiled": 254,
"../platform/js": 260,
"./cache": 79,
"./downloader": 88,
"./shared": 101
} ],
96: [ (function(t, e) {
"use strict";
var i = t("../platform/CCSAXParser").plistParser, n = t("../platform/js"), r = t("./deserialize"), s = t("./cache"), o = t("./helper").isScene, a = t("./shared"), c = a.parsed, l = a.files, u = t("../platform/CCSys"), h = u.__audioSupport, _ = u.capabilities, f = new s(), d = {
parseImage: function(t, e, i) {
if (_.imageBitmap && t instanceof Blob) {
var n = {};
n.imageOrientation = e.__flipY__ ? "flipY" : "none";
n.premultiplyAlpha = e.__premultiplyAlpha__ ? "premultiply" : "none";
createImageBitmap(t, n).then((function(t) {
t.flipY = !!e.__flipY__;
t.premultiplyAlpha = !!e.__premultiplyAlpha__;
i && i(null, t);
}), (function(t) {
i && i(t, null);
}));
} else i && i(null, t);
},
parseAudio: function(t, e, i) {
t instanceof ArrayBuffer ? h.context.decodeAudioData(t, (function(t) {
i && i(null, t);
}), (function(t) {
i && i(t, null);
})) : i && i(null, t);
},
parsePVRTex: function(t, e, i) {
var n = null, r = null;
try {
var s = t instanceof ArrayBuffer ? t : t.buffer, o = new Int32Array(s, 0, 13);
if (55727696 != o[0]) throw new Error("Invalid magic number in PVR header");
var a = o[7], c = o[6], l = o[12] + 52;
r = {
_data: new Uint8Array(s, l),
_compressed: !0,
width: a,
height: c
};
} catch (t) {
n = t;
}
i && i(n, r);
},
parsePKMTex: (function() {
function t(t, e) {
return t[e] << 8 | t[e + 1];
}
return function(e, i, n) {
var r = null, s = null;
try {
var o = e instanceof ArrayBuffer ? e : e.buffer, a = new Uint8Array(o), c = t(a, 6);
if (0 !== c && 1 !== c && 3 !== c) return new Error("Invalid magic number in ETC header");
var l = t(a, 12), u = t(a, 14);
t(a, 8), t(a, 10);
s = {
_data: new Uint8Array(o, 16),
_compressed: !0,
width: l,
height: u
};
} catch (t) {
r = t;
}
n && n(r, s);
};
})(),
parsePlist: function(t, e, n) {
var r = null, s = i.parse(t);
s || (r = new Error("parse failed"));
n && n(r, s);
},
parseImport: function(t, e, i) {
if (!t) return i && i(new Error("Json is empty"));
var n, s = null;
try {
n = r(t, e);
} catch (t) {
s = t;
}
i && i(s, n);
},
init: function() {
f.clear();
},
register: function(t, e) {
"object" == typeof t ? n.mixin(p, t) : p[t] = e;
},
parse: function(t, e, i, n, r) {
var s, a, u;
if (s = c.get(t)) r(null, s); else if (a = f.get(t)) a.push(r); else if (u = p[i]) {
f.add(t, [ r ]);
u(e, n, (function(e, i) {
e ? l.remove(t) : o(i) || c.add(t, i);
for (var n = f.remove(t), r = 0, s = n.length; r < s; r++) n[r](e, i);
}));
} else r(null, e);
}
}, p = {
".png": d.parseImage,
".jpg": d.parseImage,
".bmp": d.parseImage,
".jpeg": d.parseImage,
".gif": d.parseImage,
".ico": d.parseImage,
".tiff": d.parseImage,
".webp": d.parseImage,
".image": d.parseImage,
".pvr": d.parsePVRTex,
".pkm": d.parsePKMTex,
".mp3": d.parseAudio,
".ogg": d.parseAudio,
".wav": d.parseAudio,
".m4a": d.parseAudio,
".plist": d.parsePlist,
import: d.parseImport
};
e.exports = d;
}), {
"../platform/CCSAXParser": 246,
"../platform/CCSys": 248,
"../platform/js": 260,
"./cache": 79,
"./deserialize": 83,
"./helper": 92,
"./shared": 101
} ],
97: [ (function(t, e) {
"use strict";
var i = t("./task"), n = 0;
function r(t, e) {
if (Array.isArray(e)) {
this.id = n++;
this.name = t;
this.pipes = [];
for (var i = 0, r = e.length; i < r; i++) "function" == typeof e[i] && this.pipes.push(e[i]);
} else cc.warn("funcs must be an array");
}
r.prototype = {
constructor: r,
insert: function(t, e) {
if (!("function" != typeof t || e > this.pipes.length)) {
this.pipes.splice(e, 0, t);
return this;
}
cc.warnID(4921);
},
append: function(t) {
if ("function" == typeof t) {
this.pipes.push(t);
return this;
}
},
remove: function(t) {
if ("number" == typeof t) {
this.pipes.splice(t, 1);
return this;
}
},
sync: function(t) {
var e = this.pipes;
if (t instanceof i && 0 !== e.length) {
if (null != t.output) {
t.input = t.output;
t.output = null;
}
t._isFinish = !1;
for (var n = 0, r = e.length; n < r; ) {
var s = (0, e[n])(t);
if (s) {
t._isFinish = !0;
return s;
}
if (++n !== r) {
t.input = t.output;
t.output = null;
}
}
t._isFinish = !0;
return t.output;
}
},
async: function(t) {
var e = this.pipes;
if (t instanceof i && 0 !== e.length) {
if (null != t.output) {
t.input = t.output;
t.output = null;
}
t._isFinish = !1;
this._flow(0, t);
}
},
_flow: function(t, e) {
var i = this;
(0, this.pipes[t])(e, (function(n) {
if (n) {
e._isFinish = !0;
e.onComplete && e.onComplete(n);
} else if (++t < i.pipes.length) {
e.input = e.output;
e.output = null;
i._flow(t, e);
} else {
e._isFinish = !0;
e.onComplete && e.onComplete(n, e.output);
}
}));
}
};
e.exports = r;
}), {
"./task": 102
} ],
98: [ (function(t, e) {
"use strict";
var i = t("./task"), n = t("./shared"), r = n.transformPipeline, s = n.RequestType;
e.exports = function(t, e) {
var n = t.options, o = Object.create(null), a = Object.create(null);
for (var c in n) switch (c) {
case s.PATH:
case s.UUID:
case s.DIR:
case s.SCENE:
case s.URL:
break;

case "__requestType__":
case "__isNative__":
case "ext":
case "type":
case "__nativeName__":
case "audioLoadMode":
case "bundle":
o[c] = n[c];
break;

case "__exclude__":
case "__outputAsArray__":
a[c] = n[c];
break;

default:
o[c] = n[c];
a[c] = n[c];
}
t.options = a;
var l = i.create({
input: t.input,
options: o
}), u = null;
try {
t.output = t.source = r.sync(l);
} catch (t) {
u = t;
for (var h = 0, _ = l.output.length; h < _; h++) l.output[h].recycle();
}
l.recycle();
e(u);
};
}), {
"./shared": 101,
"./task": 102
} ],
99: [ (function(t, e) {
"use strict";
var i = t("./depend-util"), n = t("./cache");
t("../assets/CCAsset");
var r = t("./shared").assets, s = t("../platform/utils").callInNextTick;
function o(t, e) {
t._uuid && e.push(t._uuid);
}
function a(t, e) {
for (var i = Object.getOwnPropertyNames(t), n = 0; n < i.length; n++) {
var r = i[n];
if ("node" !== r && "__eventTargets" !== r) {
var s = t[r];
if ("object" == typeof s && s) if (Array.isArray(s)) for (var a = 0; a < s.length; a++) {
var c = s[a];
c instanceof cc.Asset && o(c, e);
} else if (s.constructor && s.constructor !== Object) s instanceof cc.Asset && o(s, e); else for (var l = Object.getOwnPropertyNames(s), u = 0; u < l.length; u++) {
var h = s[l[u]];
h instanceof cc.Asset && o(h, e);
}
}
}
}
var c = [];
function l(t, e) {
for (var i = 0; i < t._components.length; i++) a(t._components[i], e);
for (var n = 0; n < t._children.length; n++) l(t._children[n], e);
}
function u(t, e, n, s) {
n.push(t._uuid);
for (var o = i.getDeps(t._uuid), a = 0, c = o.length; a < c; a++) {
var l = r.get(o[a]);
if (l) {
var h = l._uuid;
h in e ? e[h] += s : e[h] = l.refCount + s;
if (n.includes(h)) continue;
u(l, e, n, s);
}
}
}
function h(t) {
var e = Object.create(null);
e[t._uuid] = t.refCount;
u(t, e, c, -1);
c.length = 0;
if (0 !== e[t._uuid]) return e[t._uuid];
for (var i in e) 0 !== e[i] && u(r.get(i), e, c, 1);
c.length = 0;
return e[t._uuid];
}
var _ = new n(), f = new n(), d = !1;
function p() {
d = !1;
f.forEach((function(t) {
m._free(t);
}));
f.clear();
}
var m = {
init: function() {
_.clear();
f.clear();
},
_addPersistNodeRef: function(t) {
var e = [];
l(t, e);
for (var i = 0, n = e.length; i < n; i++) {
var s = r.get(e[i]);
s && s.addRef();
}
_.add(t.uuid, e);
},
_removePersistNodeRef: function(t) {
if (_.has(t.uuid)) {
for (var e = _.get(t.uuid), i = 0, n = e.length; i < n; i++) {
var s = r.get(e[i]);
s && s.decRef();
}
_.remove(t.uuid);
}
},
_autoRelease: function(t, e, n) {
if (t) {
for (var s = i.getDeps(t._id), o = 0, a = s.length; o < a; o++) {
var c = r.get(s[o]);
c && c.decRef(t.autoReleaseAssets);
}
var l = i._depends.get(t._id);
if (l && l.persistDeps) for (var u = l.persistDeps, h = 0, f = u.length; h < f; h++) {
var d = r.get(u[h]);
d && d.decRef(t.autoReleaseAssets);
}
t._id !== e._id && i.remove(t._id);
}
var p = i._depends.get(e._id);
p && (p.persistDeps = []);
for (var m in n) {
for (var y = n[m], v = _.get(y.uuid), g = 0, b = v.length; g < b; g++) {
var C = r.get(v[g]);
C && C.addRef();
}
p && p.persistDeps.push.apply(p.persistDeps, v);
}
},
_free: function(t, e) {
f.remove(t._uuid);
if (cc.isValid(t, !0) && !(!e && t.refCount > 0 && h(t) > 0)) {
r.remove(t._uuid);
for (var n = i.getDeps(t._uuid), s = 0, o = n.length; s < o; s++) {
var a = r.get(n[s]);
if (a) {
a.decRef(!1);
m._free(a, !1);
}
}
t.destroy();
i.remove(t._uuid);
}
},
tryRelease: function(t, e) {
if (t instanceof cc.Asset) if (e) m._free(t, e); else {
f.add(t._uuid, t);
if (!d) {
d = !0;
s(p);
}
}
}
};
e.exports = m;
}), {
"../assets/CCAsset": 105,
"../platform/utils": 263,
"./cache": 79,
"./depend-util": 81,
"./shared": 101
} ],
100: [ (function(t, e) {
"use strict";
var i = [];
function n() {
this._id = "";
this.uuid = "";
this.url = "";
this.ext = ".json";
this.content = null;
this.file = null;
this.info = null;
this.config = null;
this.isNative = !1;
this.options = Object.create(null);
}
n.prototype = {
constructor: n,
get id() {
this._id || (this._id = this.uuid + "@" + (this.isNative ? "native" : "import"));
return this._id;
},
recycle: function() {
if (500 !== i.length) {
this._id = "";
this.uuid = "";
this.url = "";
this.ext = ".json";
this.content = null;
this.file = null;
this.info = null;
this.config = null;
this.isNative = !1;
this.options = Object.create(null);
i.push(this);
}
}
};
n.create = function() {
return 0 !== i.length ? i.pop() : new n();
};
e.exports = n;
}), {} ],
101: [ (function(t, e) {
"use strict";
var i = t("./cache"), n = t("./pipeline"), r = new i(), s = new i(), o = new i(), a = new i(), c = new n("normal load", []), l = new n("fetch", []), u = new n("transform url", []);
e.exports = {
assets: r,
files: s,
parsed: o,
pipeline: c,
fetchPipeline: l,
transformPipeline: u,
RequestType: {
UUID: "uuid",
PATH: "path",
DIR: "dir",
URL: "url",
SCENE: "scene"
},
bundles: a,
BuiltinBundleName: {
RESOURCES: "resources",
INTERNAL: "internal",
MAIN: "main",
START_SCENE: "start-scene"
}
};
}), {
"./cache": 79,
"./pipeline": 97
} ],
102: [ (function(t, e) {
"use strict";
var i = 0, n = [];
function r(t) {
this.id = i++;
this._isFinish = !0;
this.onComplete = null;
this.onProgress = null;
this.onError = null;
this.source = null;
this.output = null;
this.input = null;
this.progress = null;
this.options = null;
this.set(t);
}
r.prototype = {
constructor: r,
set: function(t) {
t = t || Object.create(null);
this.onComplete = t.onComplete;
this.onProgress = t.onProgress;
this.onError = t.onError;
this.source = this.input = t.input;
this.output = null;
this.progress = t.progress;
this.options = t.options || Object.create(null);
},
dispatch: function(t, e, i, n, r) {
switch (t) {
case "complete":
this.onComplete && this.onComplete(e, i, n, r);
break;

case "progress":
this.onProgress && this.onProgress(e, i, n, r);
break;

case "error":
this.onError && this.onError(e, i, n, r);
break;

default:
var s = "on" + t[0].toUpperCase() + t.substr(1);
"function" == typeof this[s] && this[s](e, i, n, r);
}
},
recycle: function() {
if (500 !== n.length) {
this.onComplete = null;
this.onProgress = null;
this.onError = null;
this.source = this.output = this.input = null;
this.progress = null;
this.options = null;
n.push(this);
}
},
get isFinish() {
return this._isFinish;
}
};
r.create = function(t) {
var e = null;
0 !== n.length ? (e = n.pop()).set(t) : e = new r(t);
return e;
};
e.exports = r;
}), {} ],
103: [ (function(t, e) {
"use strict";
var i = t("./helper").decodeUuid, n = t("./request-item"), r = t("./shared"), s = r.RequestType, o = r.bundles;
e.exports = {
parse: function(t) {
var e = t.input, r = t.options;
e = Array.isArray(e) ? e : [ e ];
t.output = [];
for (var a = 0; a < e.length; a++) {
var c = e[a], l = n.create();
"string" == typeof c && ((c = Object.create(null))[r.__requestType__ || s.UUID] = e[a]);
if ("object" == typeof c) {
cc.js.addon(c, r);
c.preset && cc.js.addon(c, cc.assetManager.presets[c.preset]);
for (var u in c) {
switch (u) {
case s.UUID:
var h = l.uuid = i(c.uuid);
if (o.has(c.bundle)) {
if ((p = (m = o.get(c.bundle)._config).getAssetInfo(h)) && p.redirect) {
if (!o.has(p.redirect)) throw new Error("Please load bundle " + p.redirect + " first");
p = (m = o.get(p.redirect)._config).getAssetInfo(h);
}
l.config = m;
l.info = p;
}
l.ext = c.ext || ".json";
break;

case "__requestType__":
case "ext":
case "bundle":
case "preset":
case "type":
break;

case s.DIR:
if (o.has(c.bundle)) {
var _ = [];
o.get(c.bundle)._config.getDirWithPath(c.dir, c.type, _);
for (var f = 0, d = _.length; f < d; f++) {
var p = _[f];
e.push({
uuid: p.uuid,
__isNative__: !1,
ext: ".json",
bundle: c.bundle
});
}
}
l.recycle();
l = null;
break;

case s.PATH:
if (o.has(c.bundle)) {
if ((p = (m = o.get(c.bundle)._config).getInfoWithPath(c.path, c.type)) && p.redirect) {
if (!o.has(p.redirect)) throw new Error("you need to load bundle " + p.redirect + " first");
p = (m = o.get(p.redirect)._config).getAssetInfo(p.uuid);
}
if (!p) {
l.recycle();
throw new Error("Bundle " + c.bundle + " doesn't contain " + c.path);
}
l.config = m;
l.uuid = p.uuid;
l.info = p;
}
l.ext = c.ext || ".json";
break;

case s.SCENE:
if (o.has(c.bundle)) {
var m;
if ((p = (m = o.get(c.bundle)._config).getSceneInfo(c.scene)) && p.redirect) {
if (!o.has(p.redirect)) throw new Error("you need to load bundle " + p.redirect + " first");
p = (m = o.get(p.redirect)._config).getAssetInfo(p.uuid);
}
if (!p) {
l.recycle();
throw new Error("Bundle " + m.name + " doesn't contain scene " + c.scene);
}
l.config = m;
l.uuid = p.uuid;
l.info = p;
}
break;

case "__isNative__":
l.isNative = c.__isNative__;
break;

case s.URL:
l.url = c.url;
l.uuid = c.uuid || c.url;
l.ext = c.ext || cc.path.extname(c.url);
l.isNative = void 0 === c.__isNative__ || c.__isNative__;
break;

default:
l.options[u] = c[u];
}
if (!l) break;
}
}
if (l) {
t.output.push(l);
if (!l.uuid && !l.url) throw new Error("Can not parse this input:" + JSON.stringify(c));
}
}
return null;
},
combine: function(t) {
for (var e = t.output = t.input, i = 0; i < e.length; i++) {
var n = e[i];
if (!n.url) {
var r, s, o = n.config;
s = n.isNative ? o && o.nativeBase ? o.base + o.nativeBase : cc.assetManager.generalNativeBase : o && o.importBase ? o.base + o.importBase : cc.assetManager.generalImportBase;
var a = n.uuid, c = "";
n.info && (c = n.isNative ? n.info.nativeVer ? "." + n.info.nativeVer : "" : n.info.ver ? "." + n.info.ver : "");
r = ".ttf" === n.ext ? s + "/" + a.slice(0, 2) + "/" + a + c + "/" + n.options.__nativeName__ : s + "/" + a.slice(0, 2) + "/" + a + c + n.ext;
n.url = r;
}
}
return null;
}
};
}), {
"./helper": 92,
"./request-item": 100,
"./shared": 101
} ],
104: [ (function(t, e) {
"use strict";
var i = t("./depend-util"), n = t("./helper"), r = n.isScene, s = n.decodeUuid, o = t("./shared").assets, a = t("../platform/utils").callInNextTick;
t("../assets/CCAsset");
var c = {
processOptions: function(t) {
var e = t.uuids, i = t.paths, n = t.types, r = t.deps, o = t.paths = Object.create(null);
if (!1 === t.debug) {
for (var a = 0, c = e.length; a < c; a++) e[a] = s(e[a]);
for (var l in i) {
var u = i[l], h = u[1];
u[1] = n[h];
}
} else {
for (var _ = Object.create(null), f = 0, d = e.length; f < d; f++) {
var p = e[f];
e[f] = _[p] = s(p);
}
e = _;
}
for (var m in i) {
var y = i[m];
o[e[m]] = y;
}
var v = t.scenes;
for (var g in v) {
var b = v[g];
v[g] = e[b];
}
var C = t.packs;
for (var x in C) for (var A = C[x], S = 0; S < A.length; ++S) A[S] = e[A[S]];
var T = t.versions;
if (T) for (var w in T) for (var E = T[w], M = 0; M < E.length; M += 2) {
var B = E[M];
E[M] = e[B] || B;
}
var I = t.redirect;
if (I) for (var D = 0; D < I.length; D += 2) {
I[D] = e[I[D]];
I[D + 1] = r[I[D + 1]];
}
},
clear: function(t, e) {
for (var i = 0, n = t.input.length; i < n; i++) {
var r = t.input[i];
e && !r.isNative && r.content && r.content.decRef && r.content.decRef(!1);
r.recycle();
}
t.input = null;
},
urlAppendTimestamp: function(t) {
return cc.assetManager.downloader.appendTimeStamp && "string" == typeof t ? /\?/.test(t) ? t + "&_t=" + (new Date() - 0) : t + "?_t=" + (new Date() - 0) : t;
},
retry: function(t, e, i, n, r) {
t(r = r || 0, (function(s, o) {
r++;
!s || r > e ? n && n(s, o) : setTimeout((function() {
c.retry(t, e, i, n, r);
}), i);
}));
},
getDepends: function(t, e, n, r, s, o, a) {
try {
var c = i.parse(t, e), l = !0;
e instanceof cc.Asset && (!e.__nativeDepend__ || e._nativeAsset) && (l = !1);
if (s) {
for (var u = 0, h = c.deps.length; u < h; u++) {
var _ = c.deps[u];
if (!(_ in n)) {
n[_] = !0;
r.push({
uuid: _,
bundle: a && a.name
});
}
}
if (l && c.nativeDep) {
a && (c.nativeDep.bundle = a.name);
r.push(Object.assign({}, c.nativeDep));
}
} else {
o = !0 === o || !1 === o ? o && !c.preventDeferredLoadDependents : !!e.asyncLoadAssets;
for (var f = 0, d = c.deps.length; f < d; f++) {
var p = c.deps[f];
if (!(p in n)) {
n[p] = !0;
r.push({
uuid: p,
__asyncLoadAssets__: o,
bundle: a && a.name
});
}
}
if (l && !o && !c.preventPreloadNativeObject && c.nativeDep) {
a && (c.nativeDep.bundle = a.name);
r.push(Object.assign({}, c.nativeDep));
}
}
} catch (t) {
cc.error(t.message, t.stack);
}
},
cache: function(t, e, i) {
if (e) {
!r(e) && i && o.add(t, e);
}
},
setProperties: function(t, e, i) {
var n = !1, r = e.__depends__;
if (r) {
for (var s = 0, o = r.length; s < o; s++) {
var a = r[s], c = i[a.uuid + "@import"];
if (c) a.owner[a.prop] = c.addRef(); else {
cc.error("The asset " + a.uuid + " is missing!");
n = !0;
}
}
e.__depends__ = void 0;
}
if (e.__nativeDepend__) {
e._nativeAsset || (i[t + "@native"] ? e._nativeAsset = i[t + "@native"] : n = !0);
e.__nativeDepend__ = void 0;
}
return n;
},
gatherAsset: function(t) {
var e = t.source;
if (t.options.__outputAsArray__ || 1 !== e.length) for (var i = t.output = [], n = 0, r = e.length; n < r; n++) i.push(e[n].content); else t.output = e[0].content;
},
forEach: function(t, e, i) {
var n = 0, r = [];
0 === t.length && i && i(r);
for (var s = 0, o = t.length; s < o; s++) e(t[s], (function(t) {
t && r.push(t);
++n === o && i && i(r);
}));
},
parseParameters: function(t, e, i) {
if (void 0 === i) {
var n = "function" == typeof t;
if (e) {
i = e;
n || (e = null);
} else if (void 0 === e && n) {
i = t;
t = null;
e = null;
}
if (void 0 !== e && n) {
e = t;
t = null;
}
}
return {
options: t = t || Object.create(null),
onProgress: e,
onComplete: i
};
},
parseLoadResArgs: function(t, e, i) {
if (void 0 === i) {
var n = cc.js.isChildClassOf(t, cc.Asset);
if (e) {
i = e;
n && (e = null);
} else if (void 0 === e && !n) {
i = t;
e = null;
t = null;
}
if (void 0 !== e && !n) {
e = t;
t = null;
}
}
return {
type: t,
onProgress: e,
onComplete: i
};
},
checkCircleReference: function(t, e, n, r) {
r || (r = Object.create(null));
if (!n[e] || r[e]) return !1;
r[e] = !0;
var s = !1, o = i.getDeps(e);
if (o) for (var a = 0, l = o.length; a < l; a++) {
var u = o[a];
if (u === t || c.checkCircleReference(t, u, n, r)) {
s = !0;
break;
}
}
return s;
},
asyncify: function(t) {
return function(e, i) {
if (t) {
var n = [];
Array.isArray(i) ? i.forEach((function(t) {
return t instanceof cc.Asset && n.push(t.addRef());
})) : i instanceof cc.Asset && n.push(i.addRef());
a((function() {
n.forEach((function(t) {
return t.decRef(!1);
}));
t(e, i);
}));
}
};
}
};
e.exports = c;
}), {
"../assets/CCAsset": 105,
"../platform/utils": 263,
"./depend-util": 81,
"./helper": 92,
"./shared": 101
} ],
105: [ (function(t, e) {
"use strict";
var i = t("../platform/CCObject");
cc.Asset = cc.Class({
name: "cc.Asset",
extends: i,
ctor: function() {
Object.defineProperty(this, "_uuid", {
value: "",
writable: !0
});
this.loaded = !0;
this._nativeUrl = "";
this._ref = 0;
},
properties: {
nativeUrl: {
get: function() {
if (!this._nativeUrl && this._native) {
var t = this._native;
if (47 === t.charCodeAt(0)) return t.slice(1);
46 === t.charCodeAt(0) ? this._nativeUrl = cc.assetManager.utils.getUrlWithUuid(this._uuid, {
nativeExt: t,
isNative: !0
}) : this._nativeUrl = cc.assetManager.utils.getUrlWithUuid(this._uuid, {
__nativeName__: t,
nativeExt: cc.path.extname(t),
isNative: !0
});
}
return this._nativeUrl;
},
visible: !1
},
refCount: {
get: function() {
return this._ref;
}
},
_native: "",
_nativeAsset: {
get: function() {
return this._$nativeAsset;
},
set: function(t) {
this._$nativeAsset = t;
}
},
_nativeDep: {
get: function() {
if (this._native) return {
__isNative__: !0,
uuid: this._uuid,
ext: this._native
};
}
}
},
statics: {
deserialize: !1,
preventDeferredLoadDependents: !1,
preventPreloadNativeObject: !1
},
toString: function() {
return this.nativeUrl;
},
serialize: !1,
createNode: null,
_setRawAsset: function(t, e) {
this._native = !1 !== e ? t || void 0 : "/" + t;
},
addRef: function() {
this._ref++;
return this;
},
decRef: function(t) {
this._ref > 0 && this._ref--;
!1 !== t && cc.assetManager._releaseManager.tryRelease(this);
return this;
},
destroy: function() {
this.loaded = !1;
return this._super();
}
});
e.exports = cc.Asset;
}), {
"../platform/CCObject": 245
} ],
106: [ (function(t, e) {
"use strict";
var i = t("./CCAsset"), n = t("../event/event-target"), r = cc.Enum({
WEB_AUDIO: 0,
DOM_AUDIO: 1
}), s = cc.Class({
name: "cc.AudioClip",
extends: i,
mixins: [ n ],
ctor: function() {
this._loading = !1;
this.loaded = !1;
this._audio = null;
},
properties: {
duration: 0,
loadMode: {
default: r.WEB_AUDIO,
type: r
},
_nativeAsset: {
get: function() {
return this._audio;
},
set: function(t) {
t instanceof cc.AudioClip ? this._audio = t._nativeAsset : this._audio = t;
if (this._audio) {
this.loaded = !0;
this.emit("load");
}
},
override: !0
},
_nativeDep: {
get: function() {
return {
uuid: this._uuid,
audioLoadMode: this.loadMode,
ext: cc.path.extname(this._native),
__isNative__: !0
};
},
override: !0
}
},
statics: {
LoadMode: r,
_loadByUrl: function(t, e) {
var i = cc.assetManager.assets.get(t);
i ? e(null, i) : cc.assetManager.loadRemote(t, (function(t, i) {
if (t) return e(t);
e(null, i);
}));
}
},
_ensureLoaded: function(t) {
if (this.isValid) {
if (this.loaded) return t && t();
t && this.once("load", t);
if (!this._loading) {
this._loading = !0;
var e = this;
cc.assetManager.postLoadNative(this, (function() {
e._loading = !1;
}));
}
}
},
destroy: function() {
cc.audioEngine.uncache(this);
this._super();
}
});
cc.AudioClip = s;
e.exports = s;
}), {
"../event/event-target": 186,
"./CCAsset": 105
} ],
107: [ (function(t, e) {
"use strict";
var i = function() {
this.u = 0;
this.v = 0;
this.w = 0;
this.h = 0;
this.offsetX = 0;
this.offsetY = 0;
this.textureID = 0;
this.valid = !1;
this.xAdvance = 0;
}, n = function(t) {
this._letterDefinitions = {};
this._texture = t;
};
n.prototype = {
constructor: n,
addLetterDefinitions: function(t, e) {
this._letterDefinitions[t] = e;
},
cloneLetterDefinition: function() {
var t = {};
for (var e in this._letterDefinitions) {
var n = new i();
cc.js.mixin(n, this._letterDefinitions[e]);
t[e] = n;
}
return t;
},
getTexture: function() {
return this._texture;
},
getLetter: function(t) {
return this._letterDefinitions[t];
},
getLetterDefinitionForChar: function(t) {
var e = t.charCodeAt(0);
return this._letterDefinitions.hasOwnProperty(e) ? this._letterDefinitions[e] : null;
},
clear: function() {
this._letterDefinitions = {};
}
};
var r = cc.Class({
name: "cc.BitmapFont",
extends: cc.Font,
properties: {
fntDataStr: {
default: ""
},
spriteFrame: {
default: null,
type: cc.SpriteFrame
},
fontSize: {
default: -1
},
_fntConfig: null,
_fontDefDictionary: null
},
onLoad: function() {
var t = this.spriteFrame;
if (!this._fontDefDictionary) {
this._fontDefDictionary = new n();
t && (this._fontDefDictionary._texture = t._texture);
}
var e = this._fntConfig;
if (e) {
var r = e.fontDefDictionary;
for (var s in r) {
var o = new i(), a = r[s].rect;
o.offsetX = r[s].xOffset;
o.offsetY = r[s].yOffset;
o.w = a.width;
o.h = a.height;
o.u = a.x;
o.v = a.y;
o.textureID = 0;
o.valid = !0;
o.xAdvance = r[s].xAdvance;
this._fontDefDictionary.addLetterDefinitions(s, o);
}
}
}
});
cc.BitmapFont = r;
cc.BitmapFont.FontLetterDefinition = i;
cc.BitmapFont.FontAtlas = n;
e.exports = r;
}), {} ],
108: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.BufferAsset",
extends: cc.Asset,
ctor: function() {
this._buffer = null;
},
properties: {
_nativeAsset: {
get: function() {
return this._buffer;
},
set: function(t) {
this._buffer = t.buffer || t;
},
override: !0
},
buffer: function() {
return this._buffer;
}
}
});
cc.BufferAsset = e.exports = i;
}), {} ],
109: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.Font",
extends: cc.Asset
});
cc.Font = e.exports = i;
}), {} ],
110: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.JsonAsset",
extends: cc.Asset,
properties: {
json: null
}
});
e.exports = cc.JsonAsset = i;
}), {} ],
111: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.LabelAtlas",
extends: cc.BitmapFont,
onLoad: function() {
this.spriteFrame ? this._fntConfig ? this._super() : cc.warnID(9101, this.name) : cc.warnID(9100, this.name);
}
});
cc.LabelAtlas = i;
e.exports = i;
}), {} ],
112: [ (function(t, e) {
"use strict";
var i = cc.Enum({
AUTO: 0,
SINGLE_INSTANCE: 1,
MULTI_INSTANCE: 2
}), n = cc.Class({
name: "cc.Prefab",
extends: cc.Asset,
ctor: function() {
this._createFunction = null;
this._instantiatedTimes = 0;
},
properties: {
data: null,
optimizationPolicy: i.AUTO,
asyncLoadAssets: !1,
readonly: {
default: !1,
editorOnly: !0
}
},
statics: {
OptimizationPolicy: i,
OptimizationPolicyThreshold: 3
},
createNode: !1,
compileCreateFunction: function() {
var e = t("../platform/instantiate-jit");
this._createFunction = e.compile(this.data);
},
_doInstantiate: function(t) {
this.data._prefab || cc.warnID(3700);
this._createFunction || this.compileCreateFunction();
return this._createFunction(t);
},
_instantiate: function() {
var t;
if (this.optimizationPolicy !== i.SINGLE_INSTANCE && (this.optimizationPolicy === i.MULTI_INSTANCE || this._instantiatedTimes + 1 >= n.OptimizationPolicyThreshold)) {
t = this._doInstantiate();
this.data._instantiate(t);
} else t = this.data._instantiate();
++this._instantiatedTimes;
return t;
},
destroy: function() {
this.data && this.data.destroy();
this._super();
}
});
cc.Prefab = e.exports = n;
cc.js.obsolete(cc, "cc._Prefab", "Prefab");
}), {
"../platform/instantiate-jit": 258
} ],
113: [ (function(t, e) {
"use strict";
var i, n = (i = t("../../renderer/gfx")) && i.__esModule ? i : {
default: i
}, r = t("../renderer"), s = t("./CCTexture2D"), o = 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
}), a = cc.Class({
name: "cc.RenderTexture",
extends: s,
statics: {
DepthStencilFormat: o
},
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, o = {
colors: [ this._texture ]
};
this._depthStencilBuffer && this._depthStencilBuffer.destroy();
if (i) {
s = new n.default.RenderBuffer(r.device, i, t, e);
i === n.default.RB_FMT_D24S8 ? o.depthStencil = s : i === n.default.RB_FMT_S8 ? o.stencil = s : i === n.default.RB_FMT_D16 && (o.depth = s);
}
this._depthStencilBuffer = s;
this._framebuffer && this._framebuffer.destroy();
this._framebuffer = new n.default.FrameBuffer(r.device, t, e, o);
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, o = r || this.height;
t = t || new Uint8Array(s * o * 4);
var a = cc.game._renderContext, c = a.getParameter(a.FRAMEBUFFER_BINDING);
a.bindFramebuffer(a.FRAMEBUFFER, this._framebuffer.getHandle());
a.readPixels(e, i, s, o, a.RGBA, a.UNSIGNED_BYTE, t);
a.bindFramebuffer(a.FRAMEBUFFER, c);
return t;
},
destroy: function() {
this._super();
if (this._framebuffer) {
this._framebuffer.destroy();
this._framebuffer = null;
}
}
});
cc.RenderTexture = e.exports = a;
}), {
"../../renderer/gfx": 363,
"../renderer": 271,
"./CCTexture2D": 120
} ],
114: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.SceneAsset",
extends: cc.Asset,
properties: {
scene: null,
asyncLoadAssets: void 0
}
});
cc.SceneAsset = i;
e.exports = i;
}), {} ],
115: [ (function() {
"use strict";
var t = cc.Class({
name: "cc.Script",
extends: cc.Asset
});
cc._Script = t;
var e = cc.Class({
name: "cc.JavaScript",
extends: t
});
cc._JavaScript = e;
var i = cc.Class({
name: "cc.TypeScript",
extends: t
});
cc._TypeScript = i;
}), {} ],
116: [ (function(t, e) {
"use strict";
var i = 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];
if (!e) return null;
e.name || (e.name = t);
return e;
},
getSpriteFrames: function() {
var t = [], e = this._spriteFrames;
for (var i in e) t.push(this.getSpriteFrame(i));
return t;
}
});
cc.SpriteAtlas = i;
e.exports = i;
}), {} ],
117: [ (function(t, e) {
"use strict";
var i = t("../event/event-target"), n = [ {
u: 0,
v: 0
}, {
u: 0,
v: 0
}, {
u: 0,
v: 0
}, {
u: 0,
v: 0
} ], r = cc.Class({
name: "cc.SpriteFrame",
extends: t("../assets/CCAsset"),
mixins: [ i ],
properties: {
_textureSetter: {
set: function(t) {
t && this._texture !== t && this._refreshTexture(t);
}
},
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() {
i.call(this);
var t = arguments[0], e = arguments[1], n = 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 = [];
void 0 !== t && this.setTexture(t, e, n, r, s);
},
textureLoaded: function() {
return this._texture && this._texture.loaded;
},
onTextureLoaded: function(t, e) {
if (!this.textureLoaded()) {
this.once("load", t, e);
this.ensureLoadTexture();
return !1;
}
t.call(e);
return !0;
},
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) {
if (this._originalSize) {
this._originalSize.width = t.width;
this._originalSize.height = t.height;
} else 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 r(this._texture, this.getRect(), this._rotated, this.getOffset(), this.getOriginalSize());
},
setTexture: function(t, e, i, n, r) {
if (1 !== arguments.length || t !== this._texture) {
this._rect = e || null;
n ? this.setOffset(n) : this._offset = null;
r ? this.setOriginalSize(r) : this._originalSize = null;
this._rotated = i || !1;
if ("string" != typeof t) {
t instanceof cc.Texture2D && this._refreshTexture(t);
return !0;
}
cc.errorID(3401);
}
},
ensureLoadTexture: function() {
if (this._texture && !this._texture.loaded) {
this._refreshTexture(this._texture);
cc.assetManager.postLoadNative(this._texture);
}
},
_checkRect: function(t) {
var e = this._rect, i = e.x, n = e.y;
if (this._rotated) {
i += e.height;
n += e.width;
} else {
i += e.width;
n += e.height;
}
i > t.width && cc.errorID(3300, t.nativeUrl + "/" + this.name, i, t.width);
n > t.height && cc.errorID(3400, t.nativeUrl + "/" + 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, r = this._capInsets[0], s = this._capInsets[2], o = t.width - r - s, a = this._capInsets[1], c = this._capInsets[3], l = t.height - a - c, u = this.uvSliced;
u.length = 0;
if (this._rotated) {
n[0].u = t.x / e;
n[1].u = (t.x + c) / e;
n[2].u = (t.x + c + l) / e;
n[3].u = (t.x + t.height) / e;
n[3].v = t.y / i;
n[2].v = (t.y + r) / i;
n[1].v = (t.y + r + o) / i;
n[0].v = (t.y + t.width) / i;
this._flipXY(n);
for (var h = 0; h < 4; ++h) for (var _ = n[h], f = 0; f < 4; ++f) {
var d = n[3 - f];
u.push({
u: _.u,
v: d.v
});
}
} else {
n[0].u = t.x / e;
n[1].u = (t.x + r) / e;
n[2].u = (t.x + r + o) / e;
n[3].u = (t.x + t.width) / e;
n[3].v = t.y / i;
n[2].v = (t.y + a) / i;
n[1].v = (t.y + a + l) / i;
n[0].v = (t.y + t.height) / i;
this._flipXY(n);
for (var p = 0; p < 4; ++p) for (var m = n[p], y = 0; y < 4; ++y) {
var v = n[y];
u.push({
u: v.u,
v: m.v
});
}
}
},
_setDynamicAtlasFrame: function(t) {
if (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() {
if (this._original) {
this._rect.x = this._original._x;
this._rect.y = this._original._y;
this._texture = this._original._texture;
this._original = null;
this._texture.loaded ? this._calculateUV() : this.ensureLoadTexture();
}
},
_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, o = 0 === n ? 0 : (t.x + t.height) / n, a = 0 === r ? 0 : (t.y + t.width) / r, c = 0 === r ? 0 : t.y / r;
i[0] = s;
i[1] = c;
i[2] = s;
i[3] = a;
i[4] = o;
i[5] = c;
i[6] = o;
i[7] = a;
} else {
var l = 0 === n ? 0 : t.x / n, u = 0 === n ? 0 : (t.x + t.width) / n, h = 0 === r ? 0 : (t.y + t.height) / r, _ = 0 === r ? 0 : t.y / r;
i[0] = l;
i[1] = h;
i[2] = u;
i[3] = h;
i[4] = l;
i[5] = _;
i[6] = u;
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; m < p.u.length; m++) {
p.nu[m] = p.u[m] / n;
p.nv[m] = p.v[m] / r;
}
}
this._calculateSlicedUV();
},
_serialize: !1,
_deserialize: function(t) {
var e = t.rect;
e && (this._rect = new cc.Rect(e[0], e[1], e[2], e[3]));
t.offset && this.setOffset(new cc.Vec2(t.offset[0], t.offset[1]));
t.originalSize && this.setOriginalSize(new cc.Size(t.originalSize[0], t.originalSize[1]));
this._rotated = 1 === t.rotated;
this._name = t.name;
var i = t.capInsets;
if (i) {
this._capInsets[0] = i[0];
this._capInsets[1] = i[1];
this._capInsets[2] = i[2];
this._capInsets[3] = i[3];
}
this.vertices = t.vertices;
if (this.vertices) {
this.vertices.nu = [];
this.vertices.nv = [];
}
}
}), s = r.prototype;
s.copyWithZone = s.clone;
s.copy = s.clone;
s.initWithTexture = s.setTexture;
cc.SpriteFrame = r;
e.exports = r;
}), {
"../assets/CCAsset": 105,
"../event/event-target": 186
} ],
118: [ (function(t, e) {
"use strict";
var i = t("./CCFont"), n = cc.Class({
name: "cc.TTFFont",
extends: i,
properties: {
_fontFamily: null,
_nativeAsset: {
type: cc.String,
get: function() {
return this._fontFamily;
},
set: function(t) {
this._fontFamily = t || "Arial";
},
override: !0
},
_nativeDep: {
get: function() {
return {
uuid: this._uuid,
__nativeName__: this._native,
ext: cc.path.extname(this._native),
__isNative__: !0
};
},
override: !0
}
}
});
cc.TTFFont = e.exports = n;
}), {
"./CCFont": 109
} ],
119: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.TextAsset",
extends: cc.Asset,
properties: {
text: ""
},
toString: function() {
return this.text;
}
});
e.exports = cc.TextAsset = i;
}), {} ],
120: [ (function(t, e) {
"use strict";
var i, n = (i = t("../../renderer/gfx")) && i.__esModule ? i : {
default: i
}, r = t("../event/event-target"), s = t("../renderer");
t("../platform/CCClass");
var o = new (t("../platform/id-generater"))("Tex"), a = 1024, c = cc.Enum({
RGB565: n.default.TEXTURE_FMT_R5_G6_B5,
RGB5A1: n.default.TEXTURE_FMT_R5_G5_B5_A1,
RGBA4444: n.default.TEXTURE_FMT_R4_G4_B4_A4,
RGB888: n.default.TEXTURE_FMT_RGB8,
RGBA8888: n.default.TEXTURE_FMT_RGBA8,
RGBA32F: n.default.TEXTURE_FMT_RGBA32F,
A8: n.default.TEXTURE_FMT_A8,
I8: n.default.TEXTURE_FMT_L8,
AI8: n.default.TEXTURE_FMT_L8_A8,
RGB_PVRTC_2BPPV1: n.default.TEXTURE_FMT_RGB_PVRTC_2BPPV1,
RGBA_PVRTC_2BPPV1: n.default.TEXTURE_FMT_RGBA_PVRTC_2BPPV1,
RGB_A_PVRTC_2BPPV1: a++,
RGB_PVRTC_4BPPV1: n.default.TEXTURE_FMT_RGB_PVRTC_4BPPV1,
RGBA_PVRTC_4BPPV1: n.default.TEXTURE_FMT_RGBA_PVRTC_4BPPV1,
RGB_A_PVRTC_4BPPV1: a++,
RGB_ETC1: n.default.TEXTURE_FMT_RGB_ETC1,
RGBA_ETC1: a++,
RGB_ETC2: n.default.TEXTURE_FMT_RGB_ETC2,
RGBA_ETC2: n.default.TEXTURE_FMT_RGBA_ETC2
}), l = cc.Enum({
REPEAT: 10497,
CLAMP_TO_EDGE: 33071,
MIRRORED_REPEAT: 33648
}), u = cc.Enum({
LINEAR: 9729,
NEAREST: 9728
}), h = {
9728: 0,
9729: 1
}, _ = [], f = {
width: void 0,
height: void 0,
minFilter: void 0,
magFilter: void 0,
wrapS: void 0,
wrapT: void 0,
format: void 0,
genMipmaps: void 0,
images: void 0,
image: void 0,
flipY: void 0,
premultiplyAlpha: void 0
};
function d() {
for (var t in f) f[t] = void 0;
_.length = 0;
f.images = _;
return f;
}
var p = cc.Class({
name: "cc.Texture2D",
extends: t("../assets/CCAsset"),
mixins: [ r ],
properties: {
_nativeAsset: {
get: function() {
return this._image;
},
set: function(t) {
t._compressed && t._data ? this.initWithData(t._data, this._format, t.width, t.height) : this.initWithElement(t);
},
override: !0
},
_format: c.RGBA8888,
_premultiplyAlpha: !1,
_flipY: !1,
_minFilter: u.LINEAR,
_magFilter: u.LINEAR,
_mipFilter: u.LINEAR,
_wrapS: l.CLAMP_TO_EDGE,
_wrapT: l.CLAMP_TO_EDGE,
_isAlphaAtlas: !1,
_genMipmaps: !1,
genMipmaps: {
get: function() {
return this._genMipmaps;
},
set: function(t) {
if (this._genMipmaps !== t) {
var e = d();
e.genMipmaps = t;
this.update(e);
}
}
},
_packable: !0,
packable: {
get: function() {
return this._packable;
},
set: function(t) {
this._packable = t;
}
},
_nativeDep: {
get: function() {
return {
__isNative__: !0,
uuid: this._uuid,
ext: this._native,
__flipY__: this._flipY,
__premultiplyAlpha__: this._premultiplyAlpha
};
},
override: !0
}
},
statics: {
PixelFormat: c,
WrapMode: l,
Filter: u,
_FilterIndex: h,
extnames: [ ".png", ".jpg", ".jpeg", ".bmp", ".webp", ".pvr", ".pkm" ],
_parseExt: function(t, e) {
for (var i = cc.renderer.device, n = t.split("_"), r = "", s = "", o = 999, a = e, l = cc.macro.SUPPORT_TEXTURE_FORMATS, u = 0; u < n.length; u++) {
var h = n[u].split("@"), _ = h[0];
_ = p.extnames[_.charCodeAt(0) - 48] || _;
var f = l.indexOf(_);
if (-1 !== f && f < o) {
var d = h[1] ? parseInt(h[1]) : e;
if (".pvr" === _ && !i.ext("WEBGL_compressed_texture_pvrtc")) continue;
if (!(d !== c.RGB_ETC1 && d !== c.RGBA_ETC1 || i.ext("WEBGL_compressed_texture_etc1"))) continue;
if (!(d !== c.RGB_ETC2 && d !== c.RGBA_ETC2 || i.ext("WEBGL_compressed_texture_etc"))) continue;
if (".webp" === _ && !cc.sys.capabilities.webp) continue;
o = f;
s = _;
a = d;
} else r || (r = _);
}
return {
bestExt: s,
bestFormat: a,
defaultExt: r
};
}
},
ctor: function() {
this._id = o.getNewId();
this.loaded = !1;
this.width = 0;
this.height = 0;
this._hashDirty = !0;
this._hash = 0;
this._texture = null;
},
getImpl: function() {
this._texture || (this._texture = new s.Texture2D(s.device, {}));
return this._texture;
},
getId: function() {
return this._id;
},
toString: function() {
return this.nativeUrl || "";
},
update: function(t) {
if (t) {
var e = !1;
void 0 !== t.width && (this.width = t.width);
void 0 !== t.height && (this.height = t.height);
if (void 0 !== t.minFilter) {
this._minFilter = t.minFilter;
t.minFilter = h[t.minFilter];
}
if (void 0 !== t.magFilter) {
this._magFilter = t.magFilter;
t.magFilter = h[t.magFilter];
}
if (void 0 !== t.mipFilter) {
this._mipFilter = t.mipFilter;
t.mipFilter = h[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);
if (void 0 !== t.flipY) {
this._flipY = t.flipY;
e = !0;
}
if (void 0 !== t.premultiplyAlpha) {
this._premultiplyAlpha = t.premultiplyAlpha;
e = !0;
}
void 0 !== t.genMipmaps && (this._genMipmaps = t.genMipmaps);
cc.sys.capabilities.imageBitmap && this._image instanceof ImageBitmap ? this._checkImageBitmap(this._upload.bind(this, t, e)) : this._upload(t, e);
}
},
_upload: function(t, e) {
e && this._image && (t.image = this._image);
if (t.images && t.images.length > 0) this._image = t.images[0]; else if (void 0 !== t.image) {
this._image = t.image;
if (!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) {
this._image = t;
if (t.complete || t instanceof HTMLCanvasElement) this.handleLoadedTexture(); else if (cc.sys.capabilities.imageBitmap && t instanceof ImageBitmap) this._checkImageBitmap(this.handleLoadedTexture.bind(this)); 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();
r.image = t;
r.images = [ r.image ];
r.genMipmaps = this._genMipmaps;
r.premultiplyAlpha = this._premultiplyAlpha;
r.flipY = this._flipY;
r.minFilter = h[this._minFilter];
r.magFilter = h[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._updateFormat();
this._checkPackable();
this.loaded = !0;
this.emit("load");
return !0;
},
getHtmlElementObj: function() {
return this._image;
},
destroy: function() {
cc.sys.capabilities.imageBitmap && this._image instanceof ImageBitmap && this._image.close && this._image.close();
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;
},
isAlphaAtlas: function() {
return this._isAlphaAtlas;
},
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 = h[this._minFilter];
t.magFilter = h[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._updateFormat();
this._checkPackable();
this.loaded = !0;
this.emit("load");
cc.macro.CLEANUP_IMAGE_CACHE && this._cleanupImageCache();
}
},
_cleanupImageCache: function() {
this._image instanceof HTMLImageElement ? this._clearImage() : cc.sys.capabilities.imageBitmap && this._image instanceof ImageBitmap && this._image.close && this._image.close();
},
description: function() {
return "<cc.Texture2D | Name = " + this.nativeUrl + " | Dimensions = " + this.width + " x " + this.height + ">";
},
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;
e.premultiplyAlpha = this._premultiplyAlpha;
this.update(e);
}
},
setPremultiplyAlpha: function(t) {
if (this._premultiplyAlpha !== t) {
var e = d();
e.flipY = this._flipY;
e.premultiplyAlpha = t;
this.update(e);
}
},
_updateFormat: function() {
this._isAlphaAtlas = this._format === c.RGBA_ETC1 || this._format === c.RGB_A_PVRTC_4BPPV1 || this._format === c.RGB_A_PVRTC_2BPPV1;
this._texture.setAlphaAtlas(this._isAlphaAtlas);
},
_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();
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 = h[this._minFilter];
t.magFilter = h[this._magFilter];
t.mipFilter = h[this._mipFilter];
t.wrapS = this._wrapS;
t.wrapT = this._wrapT;
return t;
},
_getGFXPixelFormat: function(t) {
t === c.RGBA_ETC1 ? t = c.RGB_ETC1 : t === c.RGB_A_PVRTC_4BPPV1 ? t = c.RGB_PVRTC_4BPPV1 : t === c.RGB_A_PVRTC_2BPPV1 && (t = c.RGB_PVRTC_2BPPV1);
return 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) {
var e = t.split(","), i = e[0];
if (i) {
var n = p._parseExt(i, this._format);
if (n.bestExt) {
this._setRawAsset(n.bestExt);
this._format = n.bestFormat;
} else {
if (!n.defaultExt) throw new Error(cc.debug.getError(3121));
this._setRawAsset(n.defaultExt);
cc.warnID(3120, n.defaultExt, n.defaultExt);
}
}
if (8 === e.length) {
this._minFilter = parseInt(e[1]);
this._magFilter = parseInt(e[2]);
this._wrapS = parseInt(e[3]);
this._wrapT = parseInt(e[4]);
this._premultiplyAlpha = 49 === e[5].charCodeAt(0);
this._genMipmaps = 49 === e[6].charCodeAt(0);
this._packable = 49 === e[7].charCodeAt(0);
}
},
_getHash: function() {
if (!this._hashDirty) return this._hash;
var t = this._genMipmaps ? 1 : 0, e = this._premultiplyAlpha ? 1 : 0, i = this._flipY ? 1 : 0, n = this._minFilter === u.LINEAR ? 1 : 2, r = this._magFilter === u.LINEAR ? 1 : 2, s = this._wrapS === l.REPEAT ? 1 : this._wrapS === l.CLAMP_TO_EDGE ? 2 : 3, o = this._wrapT === l.REPEAT ? 1 : this._wrapT === l.CLAMP_TO_EDGE ? 2 : 3, a = this._format, c = this._image;
if (c) {
c._glFormat && 6408 !== c._glFormat && (a = 0);
e = c._premultiplyAlpha ? 1 : 0;
}
this._hash = Number("" + n + r + a + s + o + t + e + i);
this._hashDirty = !1;
return this._hash;
},
_isCompressed: function() {
return this._format < c.A8 || this._format > c.RGBA32F;
},
_clearImage: function() {
this._image.src = "";
},
_checkImageBitmap: function(t) {
var e = this, i = this._image, n = this._flipY, r = this._premultiplyAlpha;
this._flipY !== i.flipY || this._premultiplyAlpha !== i.premultiplyAlpha ? createImageBitmap(i, {
imageOrientation: n !== i.flipY ? "flipY" : "none",
premultiplyAlpha: r ? "premultiply" : "none"
}).then((function(s) {
i.close && i.close();
s.flipY = n;
s.premultiplyAlpha = r;
e._image = s;
t();
}), (function(t) {
cc.error(t.message);
})) : t();
}
});
cc.Texture2D = e.exports = p;
}), {
"../../renderer/gfx": 363,
"../assets/CCAsset": 105,
"../event/event-target": 186,
"../platform/CCClass": 239,
"../platform/id-generater": 256,
"../renderer": 271
} ],
121: [ (function(t, e) {
"use strict";
var i = t("./CCAsset"), n = t("../event/event-target"), r = cc.Class({
name: "cc.VideoClip",
extends: i,
mixins: [ n ]
});
cc.VideoClip = r;
e.exports = r;
}), {
"../event/event-target": 186,
"./CCAsset": 105
} ],
122: [ (function(t) {
"use strict";
t("./CCAsset");
t("./CCFont");
t("./CCPrefab");
t("./CCAudioClip");
t("./CCVideoClip");
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": 105,
"./CCAudioClip": 106,
"./CCBitmapFont": 107,
"./CCBufferAsset": 108,
"./CCFont": 109,
"./CCJsonAsset": 110,
"./CCLabelAtlas": 111,
"./CCPrefab": 112,
"./CCRenderTexture": 113,
"./CCSceneAsset": 114,
"./CCScripts": 115,
"./CCSpriteAtlas": 116,
"./CCSpriteFrame": 117,
"./CCTTFFont": 118,
"./CCTextAsset": 119,
"./CCTexture2D": 120,
"./CCVideoClip": 121,
"./material": 129
} ],
123: [ (function(t, e) {
"use strict";
var i, n = (i = t("../CCAsset")) && i.__esModule ? i : {
default: i
}, r = t("./effect-parser"), 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 < this.shaders.length; e++) t.define(this.shaders[e]);
this._initEffect();
}
},
_initEffect: function() {
if (!this._effect) {
this._effect = (0, r.parseEffect)(this);
Object.freeze(this._effect);
}
},
getInstantiatedEffect: function() {
this._initEffect();
return this._effect.clone();
},
getEffect: function() {
this._initEffect();
return this._effect;
}
});
e.exports = cc.EffectAsset = s;
}), {
"../CCAsset": 105,
"./effect-parser": 126
} ],
124: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = t("../CCAsset"), r = t("../CCTexture2D"), s = (r.PixelFormat, t("./CCEffectAsset")), o = (t("../../utils/texture-util"), 
cc.gfx), a = cc.Enum({
SPRITE: "2d-sprite",
GRAY_SPRITE: "2d-gray-sprite",
UNLIT: "unlit"
}), c = cc.Class({
name: "cc.Material",
extends: n,
ctor: function() {
this.loaded = !1;
this._manualHash = !1;
this._dirty = !0;
this._effect = null;
},
properties: {
_defines: {
default: void 0,
type: Object
},
_props: {
default: void 0,
type: Object
},
_effectAsset: {
type: s,
default: null
},
_techniqueIndex: 0,
_techniqueData: Object,
effectName: void 0,
effectAsset: {
get: function() {
return this._effectAsset;
},
set: function(t) {
if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
this._effectAsset = t;
t ? this._effect = this._effectAsset.getInstantiatedEffect() : cc.error("Can not set an empty effect asset.");
}
}
},
effect: {
get: function() {
return this._effect;
}
},
techniqueIndex: {
get: function() {
return this._techniqueIndex;
},
set: function(t) {
this._techniqueIndex = t;
this._effect.switchTechnique(t);
}
}
},
statics: {
getBuiltinMaterial: function(t) {
return cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? new cc.Material() : cc.assetManager.builtins.getBuiltin("material", "builtin-" + t);
},
BUILTIN_NAME: a,
createWithBuiltin: function(t, e) {
void 0 === e && (e = 0);
var i = cc.assetManager.builtins.getBuiltin("effect", "builtin-" + t);
return c.create(i, e);
},
create: function(t, e) {
void 0 === e && (e = 0);
if (!t) return null;
var i = new c();
i.effectAsset = t;
i.techniqueIndex = e;
return i;
}
},
setProperty: function(t, e, i, n) {
if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
"string" == typeof i && (i = parseInt(i));
if (e instanceof r) {
var s = e.isAlphaAtlas(), o = "CC_USE_ALPHA_ATLAS_" + t, a = this.getDefine(o, i);
(s || a) && this.define(o, s);
e.loaded || cc.assetManager.postLoadNative(e);
}
this._effect.setProperty(t, e, i, n);
}
},
getProperty: function(t, e) {
"string" == typeof e && (e = parseInt(e));
return this._effect.getProperty(t, e);
},
define: function(t, e, i, n) {
if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
"string" == typeof i && (i = parseInt(i));
this._effect.define(t, e, i, n);
}
},
getDefine: function(t, e) {
"string" == typeof e && (e = parseInt(e));
return this._effect.getDefine(t, e);
},
setCullMode: function(t, e) {
void 0 === t && (t = o.CULL_BACK);
this._effect.setCullMode(t, e);
},
setDepth: function(t, e, i, n) {
void 0 === t && (t = !1);
void 0 === e && (e = !1);
void 0 === i && (i = o.DS_FUNC_LESS);
this._effect.setDepth(t, e, i, n);
},
setBlend: function(t, e, i, n, r, s, a, c, l) {
void 0 === t && (t = !1);
void 0 === e && (e = o.BLEND_FUNC_ADD);
void 0 === i && (i = o.BLEND_SRC_ALPHA);
void 0 === n && (n = o.BLEND_ONE_MINUS_SRC_ALPHA);
void 0 === r && (r = o.BLEND_FUNC_ADD);
void 0 === s && (s = o.BLEND_SRC_ALPHA);
void 0 === a && (a = o.BLEND_ONE_MINUS_SRC_ALPHA);
void 0 === c && (c = 4294967295);
this._effect.setBlend(t, e, i, n, r, s, a, c, l);
},
setStencilEnabled: function(t, e) {
void 0 === t && (t = o.STENCIL_INHERIT);
this._effect.setStencilEnabled(t, e);
},
setStencil: function(t, e, i, n, r, s, a, c, l) {
void 0 === t && (t = o.STENCIL_INHERIT);
void 0 === e && (e = o.DS_FUNC_ALWAYS);
void 0 === i && (i = 0);
void 0 === n && (n = 255);
void 0 === r && (r = o.STENCIL_OP_KEEP);
void 0 === s && (s = o.STENCIL_OP_KEEP);
void 0 === a && (a = o.STENCIL_OP_KEEP);
void 0 === c && (c = 255);
this._effect.setStencil(t, e, i, n, r, s, a, c, l);
},
updateHash: function(t) {
this._manualHash = t;
this._effect && this._effect.updateHash(t);
},
getHash: function() {
return this._manualHash || this._effect && this._effect.getHash();
},
onLoad: function() {
this.effectAsset = this._effectAsset;
if (this._effect) {
this._techniqueIndex && this._effect.switchTechnique(this._techniqueIndex);
this._techniqueData = this._techniqueData || {};
var t = this._techniqueData;
for (var e in t) {
var i = t[e = parseInt(e)];
if (i) {
for (var n in i.defines) this.define(n, i.defines[n], e);
for (var r in i.props) this.setProperty(r, i.props[r], e);
}
}
}
}
}), l = c;
i.default = l;
cc.Material = c;
e.exports = i.default;
}), {
"../../utils/texture-util": 330,
"../CCAsset": 105,
"../CCTexture2D": 120,
"./CCEffectAsset": 123
} ],
125: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = s(t("../../../renderer/core/pass")), r = s(t("../../../renderer/enums"));
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
function o(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function a(t, e, i) {
e && o(t.prototype, e);
i && o(t, i);
return t;
}
var c = cc.gfx, l = (function() {
function t() {
this._dirty = !0;
this._name = "";
this._technique = null;
}
var e = t.prototype;
e._createPassProp = function(t, e) {
var i = e._properties[t];
if (i) {
var n = Object.create(null);
n.name = t;
n.type = i.type;
i.value instanceof Float32Array ? n.value = new Float32Array(i.value) : i.value instanceof Float64Array ? n.value = new Float64Array(i.value) : n.value = i.value;
e._properties[t] = n;
return n;
}
};
e._setPassProperty = function(t, e, i, s) {
var o = i._properties;
o.hasOwnProperty(t) || this._createPassProp(t, i);
var a = o[t], c = e;
a.type === r.default.PARAM_TEXTURE_2D && (c = e && e.getImpl());
if (a.value === c) return !0;
this._dirty = !0;
return n.default.prototype.setProperty.call(i, t, e, s);
};
e.setProperty = function(t, e, i, n) {
var r = !1, s = this.passes, o = 0, a = s.length;
void 0 !== i && (o = i, a = i + 1);
for (var c = o; c < a; c++) this._setPassProperty(t, e, s[c], n) && (r = !0);
r || cc.warnID(9103, this.name, t);
};
e.getProperty = function(t, e) {
var i = this.passes;
if (!(e >= i.length)) {
var n = 0, r = i.length;
void 0 !== e && (n = e, r = e + 1);
for (var s = n; s < r; s++) {
var o = i[s].getProperty(t);
if (void 0 !== o) return o;
}
}
};
e.define = function(t, e, i, n) {
var r = !1, s = this.passes, o = 0, a = s.length;
void 0 !== i && (o = i, a = i + 1);
for (var c = o; c < a; c++) s[c].define(t, e, n) && (r = !0);
r || cc.warnID(9104, this.name, t);
};
e.getDefine = function(t, e) {
var i = this.passes;
if (!(e >= i.length)) {
var n = 0, r = i.length;
void 0 !== e && (n = e, r = e + 1);
for (var s = n; s < r; s++) {
var o = i[s].getDefine(t);
if (void 0 !== o) return o;
}
}
};
e.setCullMode = function(t, e) {
void 0 === t && (t = c.CULL_BACK);
var i = this.passes, n = 0, r = i.length;
void 0 !== e && (n = e, r = e + 1);
for (var s = n; s < r; s++) i[s].setCullMode(t);
this._dirty = !0;
};
e.setDepth = function(t, e, i, n) {
var r = this.passes, s = 0, o = r.length;
void 0 !== n && (s = n, o = n + 1);
for (var a = s; a < o; a++) r[a].setDepth(t, e, i);
this._dirty = !0;
};
e.setBlend = function(t, e, i, n, r, s, o, a, c) {
var l = this.passes, u = 0, h = l.length;
void 0 !== c && (u = c, h = c + 1);
for (var _ = u; _ < h; _++) l[_].setBlend(t, e, i, n, r, s, o, a);
this._dirty = !0;
};
e.setStencilEnabled = function(t, e) {
void 0 === t && (t = c.STENCIL_INHERIT);
var i = this.passes, n = 0, r = i.length;
void 0 !== e && (n = e, r = e + 1);
for (var s = n; s < r; s++) i[s].setStencilEnabled(t);
this._dirty = !0;
};
e.setStencil = function(t, e, i, n, r, s, o, a, c) {
var l = this.passes, u = 0, h = l.length;
void 0 !== c && (u = c, h = c + 1);
for (var _ = u; _ < h; _++) {
var f = l[_];
f.setStencilFront(t, e, i, n, r, s, o, a);
f.setStencilBack(t, e, i, n, r, s, o, a);
}
this._dirty = !0;
};
a(t, [ {
key: "name",
get: function() {
return this._name;
}
}, {
key: "technique",
get: function() {
return this._technique;
}
}, {
key: "passes",
get: function() {
return [];
}
} ]);
return t;
})();
i.default = l;
cc.EffectBase = l;
e.exports = i.default;
}), {
"../../../renderer/core/pass": 360,
"../../../renderer/enums": 362
} ],
126: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.parseEffect = function(t) {
var e = _(t);
return new o.default(t.name, e, 0, t);
};
var n = c(t("../../../renderer/core/pass")), r = t("../../../renderer/types"), s = c(t("../../../renderer/enums")), o = c(t("./effect")), a = c(t("../../../renderer/core/technique"));
function c(t) {
return t && t.__esModule ? t : {
default: t
};
}
function l(t) {
return cc.renderer._forward._programLib.getTemplate(t);
}
function u(t, e) {
var i = e.properties || {}, n = l(e.program), o = function(e) {
if (!n.uniforms.find((function(t) {
return t.name === e;
}))) {
cc.warnID(9107, t.name, e);
return "continue";
}
};
for (var a in i) o(a);
var c = {};
n.uniforms.forEach((function(t) {
var e, n = t.name, o = c[n] = Object.assign({}, t), a = i[n];
void 0 === (e = a ? a.type === s.default.PARAM_TEXTURE_2D ? null : a.type === s.default.PARAM_INT || a.type === s.default.PARAM_FLOAT ? Array.isArray(a.value) ? a.value[0] : a.value : new Float32Array(a.value) : r.enums2default[t.type]) && (e = null);
o.value = e;
}));
return c;
}
function h(t) {
var e = {};
l(t.program).defines.forEach((function(t) {
e[t.name] = r.enums2default[t.type];
}));
return e;
}
function _(t) {
for (var e = t.techniques.length, i = new Array(e), r = 0; r < e; ++r) {
for (var s = t.techniques[r], o = s.name || r, c = s.passes.length, l = new Array(c), _ = 0; _ < c; ++_) {
var f = s.passes[_], d = f.name || _, p = t.name + "-" + o + "-" + d, m = f.stage || "opaque", y = u(t, f), v = h(f), g = l[_] = new n.default(d, p, f.program, m, y, v);
f.rasterizerState && g.setCullMode(f.rasterizerState.cullMode);
var b = f.blendState && f.blendState.targets[0];
b && g.setBlend(b.blend, b.blendEq, b.blendSrc, b.blendDst, b.blendAlphaEq, b.blendSrcAlpha, b.blendDstAlpha, b.blendColor);
var C = f.depthStencilState;
if (C) {
g.setDepth(C.depthTest, C.depthWrite, C.depthFunc);
g.setStencilFront(C.stencilTest, C.stencilFuncFront, C.stencilRefFront, C.stencilMaskFront, C.stencilFailOpFront, C.stencilZFailOpFront, C.stencilZPassOpFront, C.stencilWriteMaskFront);
g.setStencilBack(C.stencilTest, C.stencilFuncBack, C.stencilRefBack, C.stencilMaskBack, C.stencilFailOpBack, C.stencilZFailOpBack, C.stencilZPassOpBack, C.stencilWriteMaskBack);
}
}
i[r] = new a.default(o, l);
}
return i;
}
}), {
"../../../renderer/core/pass": 360,
"../../../renderer/core/technique": 361,
"../../../renderer/enums": 362,
"../../../renderer/types": 368,
"./effect": 128
} ],
127: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = o(t("../../../renderer/murmurhash2_gc")), r = o(t("./utils")), s = o(t("./effect-base"));
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
function a(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function c(t, e, i) {
e && a(t.prototype, e);
i && a(t, i);
return t;
}
function l(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
u(t, e);
}
function u(t, e) {
return (u = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
cc.gfx;
var h = (function(t) {
l(e, t);
function e(e) {
var i;
(i = t.call(this) || this)._effect = void 0;
i._passes = [];
i._stagePasses = {};
i._hash = 0;
i.init(e);
return i;
}
var i = e.prototype;
i._onEffectChanged = function() {};
i.init = function(t) {
t instanceof e && (t = t.effect);
this._effect = t;
this._dirty = !0;
if (t) {
var i = t.passes, n = this._passes;
n.length = 0;
for (var r = this._stagePasses = {}, s = 0; s < i.length; s++) {
var o = n[s] = Object.setPrototypeOf({}, i[s]);
o._properties = Object.setPrototypeOf({}, i[s]._properties);
o._defines = Object.setPrototypeOf({}, i[s]._defines);
r[o._stage] || (r[o._stage] = []);
r[o._stage].push(o);
}
}
};
i.updateHash = function() {};
i.getHash = function() {
if (!this._dirty) return this._hash;
this._dirty = !1;
var t = "";
t += r.default.serializePasses(this._passes);
var e = this._effect;
e && (t += r.default.serializePasses(e.passes));
this._hash = (0, n.default)(t, 666);
this.updateHash(this._hash);
return this._hash;
};
c(e, [ {
key: "effect",
get: function() {
return this._effect;
}
}, {
key: "name",
get: function() {
return this._effect && this._effect.name + " (variant)";
}
}, {
key: "passes",
get: function() {
return this._passes;
}
}, {
key: "stagePasses",
get: function() {
return this._stagePasses;
}
} ]);
return e;
})(s.default);
i.default = h;
cc.EffectVariant = h;
e.exports = i.default;
}), {
"../../../renderer/murmurhash2_gc": 367,
"./effect-base": 125,
"./utils": 132
} ],
128: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n;
function r(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function s(t, e, i) {
e && r(t.prototype, e);
i && r(t, i);
return t;
}
function o(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
a(t, e);
}
function a(t, e) {
return (a = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var c = (function(t) {
o(e, t);
function e(e, i, n, r) {
var s;
(s = t.call(this) || this)._techniques = [];
s._asset = null;
s.init(e, i, n, r, !0);
return s;
}
var i = e.prototype;
i.init = function(t, e, i, n) {
this._name = t;
this._techniques = e;
this._technique = e[i];
this._asset = n;
};
i.switchTechnique = function(t) {
t >= 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; i < this._techniques.length; i++) t.push(this._techniques[i].clone());
var n = this._techniques.indexOf(this._technique);
return new e(this._name, t, n, this._asset);
};
s(e, [ {
key: "technique",
get: function() {
return this._technique;
}
}, {
key: "passes",
get: function() {
return this._technique.passes;
}
} ]);
return e;
})(((n = t("./effect-base")) && n.__esModule ? n : {
default: n
}).default);
i.default = c;
cc.Effect = c;
e.exports = i.default;
}), {
"./effect-base": 125
} ],
129: [ (function(t) {
"use strict";
t("./CCEffectAsset");
t("./CCMaterial");
t("./material-variant");
}), {
"./CCEffectAsset": 123,
"./CCMaterial": 124,
"./material-variant": 131
} ],
130: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = s(t("./utils")), r = s(t("../../utils/pool"));
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
function o(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
a(t, e);
}
function a(t, e) {
return (a = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var c = new (function(t) {
o(e, t);
function e() {
for (var e, i = arguments.length, n = new Array(i), r = 0; r < i; r++) n[r] = arguments[r];
(e = t.call.apply(t, [ this ].concat(n)) || this).enabled = !1;
e._pool = {};
return e;
}
var i = e.prototype;
i.get = function(t, e) {
var i, r = this._pool;
if (t instanceof cc.MaterialVariant) {
if (!t._owner) {
t._owner = e;
return t;
}
if (t._owner === e) return t;
t = t.material;
}
if (this.enabled) {
var s = t.effectAsset._uuid;
if (r[s]) {
var o = n.default.serializeDefines(t._effect._defines) + n.default.serializeTechniques(t._effect._techniques);
i = r[s][o] && r[s][o].pop();
}
}
if (i) this.count--; else {
(i = new cc.MaterialVariant(t))._name = t._name + " (Instance)";
i._uuid = t._uuid;
}
i._owner = e;
return i;
};
i.put = function(t) {
if (this.enabled && t._owner) {
var e = this._pool, i = t.effectAsset._uuid;
e[i] || (e[i] = {});
var r = n.default.serializeDefines(t._effect._defines) + n.default.serializeTechniques(t._effect._techniques);
e[i][r] || (e[i][r] = []);
if (!(this.count > this.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;
};
return e;
}(r.default))();
r.default.register("material", c);
var l = c;
i.default = l;
e.exports = i.default;
}), {
"../../utils/pool": 324,
"./utils": 132
} ],
131: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = a(t("./CCMaterial")), s = a(t("./effect-variant")), o = a(t("./material-pool"));
function a(t) {
return t && t.__esModule ? t : {
default: t
};
}
function c(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function l(t, e, i) {
e && c(t.prototype, e);
i && c(t, i);
return t;
}
function u(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
h(t, e);
}
function h(t, e) {
return (h = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var _ = (0, cc._decorator.ccclass)("cc.MaterialVariant")(n = (function(t) {
u(e, t);
e.createWithBuiltin = function(t, i) {
return e.create(r.default.getBuiltinMaterial(t), i);
};
e.create = function(t, e) {
return t ? o.default.get(t, e) : null;
};
function e(e) {
var i;
(i = t.call(this) || this)._owner = null;
i._material = null;
i.init(e);
return i;
}
e.prototype.init = function(t) {
this._effect = new s.default(t.effect);
this._effectAsset = t._effectAsset;
this._material = t;
};
l(e, [ {
key: "uuid",
get: function() {
return this._material._uuid;
}
}, {
key: "owner",
get: function() {
return this._owner;
}
}, {
key: "material",
get: function() {
return this._material;
}
} ]);
return e;
})(r.default)) || n;
i.default = _;
cc.MaterialVariant = _;
e.exports = i.default;
}), {
"./CCMaterial": 124,
"./effect-variant": 127,
"./material-pool": 130
} ],
132: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../renderer/enums")) && n.__esModule ? n : {
default: n
}, s = [];
function o(t, e) {
for (var i = e.length, n = 0; n < i; n++) {
var r = e[n];
s[n] = r + t[r];
}
s.length = i;
return s.join("");
}
function a(t, e) {
var i = t._programName + t._cullMode;
t._blend && (i += t._blendEq + t._blendAlphaEq + t._blendSrc + t._blendDst + t._blendSrcAlpha + t._blendDstAlpha + t._blendColor);
t._depthTest && (i += t._depthWrite + t._depthFunc);
t._stencilTest && (i += t._stencilFuncFront + t._stencilRefFront + t._stencilMaskFront + t._stencilFailOpFront + t._stencilZFailOpFront + t._stencilZPassOpFront + t._stencilWriteMaskFront + t._stencilFuncBack + t._stencilRefBack + t._stencilMaskBack + t._stencilFailOpBack + t._stencilZFailOpBack + t._stencilZPassOpBack + t._stencilWriteMaskBack);
e || (i += c(t._properties, t._propertyNames));
return i + o(t._defines, t._defineNames);
}
function c(t, e) {
for (var i = 0, n = 0, o = e.length; n < o; n++) {
var a = t[e[n]], c = a.value;
if (c) {
a.type === r.default.PARAM_TEXTURE_2D || a.type === r.default.PARAM_TEXTURE_CUBE ? s[i] = c._id : s[i] = c.toString();
i++;
}
}
s.length = i;
return s.join(";");
}
var l = {
serializeDefines: o,
serializePasses: function(t) {
for (var e = "", i = 0; i < t.length; i++) e += a(t[i]);
return e;
},
serializeUniforms: c
};
i.default = l;
e.exports = i.default;
}), {
"../../../renderer/enums": 362
} ],
133: [ (function(t, e) {
"use strict";
t("../CCNode").EventType;
var i = 56, n = 7, r = cc.Enum({
ONCE: 0,
ON_WINDOW_RESIZE: 1,
ALWAYS: 2
});
function s(t, e, i, n) {
for (var r = t._parent.scaleX, s = t._parent.scaleY, o = 0, a = 0, c = t._parent; ;) {
o += c.x;
a += c.y;
if (!(c = c._parent)) {
i.x = i.y = 0;
n.x = n.y = 1;
return;
}
if (c === e) break;
var l = c.scaleX, u = c.scaleY;
o *= l;
a *= u;
r *= l;
s *= u;
}
n.x = 0 !== r ? 1 / r : 1;
n.y = 0 !== s ? 1 / s : 1;
i.x = -o;
i.y = -a;
}
var o = cc.Vec2.ZERO, a = cc.Vec2.ONE;
function c(t, e) {
var r, c, l, u = e._target;
u ? s(t, r = u, c = o, l = a) : r = t._parent;
var h, _ = (h = r) instanceof cc.Scene ? cc.visibleRect : h._contentSize, f = r._anchorPoint, d = r instanceof cc.Scene, p = t.x, m = t.y, y = t._anchorPoint;
if (e._alignFlags & i) {
var v, g, b = _.width;
if (d) {
v = cc.visibleRect.left.x;
g = cc.visibleRect.right.x;
} else g = (v = -f.x * b) + b;
v += e._isAbsLeft ? e._left : e._left * b;
g -= e._isAbsRight ? e._right : e._right * b;
if (u) {
v += c.x;
v *= l.x;
g += c.x;
g *= l.x;
}
var C, x = y.x, A = t.scaleX;
if (A < 0) {
x = 1 - x;
A = -A;
}
if (e.isStretchWidth) {
C = g - v;
0 !== A && (t.width = C / A);
p = v + x * C;
} else {
C = t.width * A;
if (e.isAlignHorizontalCenter) {
var S = e._isAbsHorizontalCenter ? e._horizontalCenter : e._horizontalCenter * b, T = (.5 - f.x) * _.width;
if (u) {
S *= l.x;
T += c.x;
T *= l.x;
}
p = T + (x - .5) * C + S;
} else p = e.isAlignLeft ? v + x * C : g + (x - 1) * C;
}
}
if (e._alignFlags & n) {
var w, E, M = _.height;
if (d) {
E = cc.visibleRect.bottom.y;
w = cc.visibleRect.top.y;
} else w = (E = -f.y * M) + M;
E += e._isAbsBottom ? e._bottom : e._bottom * M;
w -= e._isAbsTop ? e._top : e._top * M;
if (u) {
E += c.y;
E *= l.y;
w += c.y;
w *= l.y;
}
var B, I = y.y, D = t.scaleY;
if (D < 0) {
I = 1 - I;
D = -D;
}
if (e.isStretchHeight) {
B = w - E;
0 !== D && (t.height = B / D);
m = E + I * B;
} else {
B = t.height * D;
if (e.isAlignVerticalCenter) {
var P = e._isAbsVerticalCenter ? e._verticalCenter : e._verticalCenter * M, R = (.5 - f.y) * _.height;
if (u) {
P *= l.y;
R += c.y;
R *= l.y;
}
m = R + (I - .5) * B + P;
} else m = e.isAlignBottom ? E + I * B : w + (I - 1) * B;
}
}
t.setPosition(p, m);
}
function l(t) {
var e = t._widget;
if (e) {
c(t, e);
e.alignMode !== r.ALWAYS ? _.remove(e) : h.push(e);
}
for (var i = t._children, n = 0; n < i.length; n++) {
var s = i[n];
s._active && l(s);
}
}
function u() {
var t = cc.director.getScene();
if (t) {
_.isAligning = !0;
if (_._nodesOrderDirty) {
h.length = 0;
l(t);
_._nodesOrderDirty = !1;
} else {
var e, i = _._activeWidgetsIterator;
for (i.i = 0; i.i < h.length; ++i.i) c((e = h[i.i]).node, e);
}
_.isAligning = !1;
}
}
var h = [], _ = cc._widgetManager = e.exports = {
_AlignFlags: {
TOP: 1,
MID: 2,
BOT: 4,
LEFT: 8,
CENTER: 16,
RIGHT: 32
},
isAligning: !1,
_nodesOrderDirty: !1,
_activeWidgetsIterator: new cc.js.array.MutableForwardIterator(h),
init: function(t) {
t.on(cc.Director.EVENT_AFTER_UPDATE, u);
var e = this.onResized.bind(this);
cc.view.on("canvas-resize", e);
window.addEventListener("orientationchange", e);
},
add: function(t) {
t.node._widget = t;
this._nodesOrderDirty = !0;
},
remove: function(t) {
t.node._widget = null;
this._activeWidgetsIterator.remove(t);
},
onResized: function() {
var t = cc.director.getScene();
t && this.refreshWidgetOnResized(t);
},
refreshWidgetOnResized: function(t) {
var e = cc.Node.isNode(t) && t.getComponent(cc.Widget);
e && e.enabled && e.alignMode === r.ON_WINDOW_RESIZE && this.add(e);
for (var i = t._children, n = 0; n < i.length; n++) {
var s = i[n];
this.refreshWidgetOnResized(s);
}
},
updateAlignment: function t(e) {
var i = e._parent;
cc.Node.isNode(i) && t(i);
var n = e._widget || e.getComponent(cc.Widget);
n && i && c(e, n);
},
AlignMode: r
};
}), {
"../CCNode": 72
} ],
134: [ (function(t, e) {
"use strict";
var i = t("../value-types"), n = t("../geom-utils"), r = t("../utils/affine-transform"), s = t("../renderer/index"), o = t("../renderer/render-flow"), a = t("../CCGame"), c = null;
c = window.renderer.Camera;
var l = cc.mat4(), u = cc.mat4(), h = cc.v3(), _ = cc.v3(), f = cc.v3(), d = [];
function p() {
for (var t = 0, e = Number.MAX_VALUE; t < d.length; t++) {
var i = d[t];
if (i._depth < e) {
b.main = i;
e = i._depth;
}
}
}
var m = null;
function y() {
if (m) {
var t = m.getNode(), e = cc.game.canvas;
t.z = e.height / 1.1566;
t.x = e.width / 2;
t.y = e.height / 2;
}
}
var v = cc.Enum({
COLOR: 1,
DEPTH: 2,
STENCIL: 4
}), g = cc.Enum({
OPAQUE: 1,
TRANSPARENT: 2
}), b = cc.Class({
name: "cc.Camera",
extends: cc.Component,
ctor: function() {
if (a.renderType !== a.RENDER_TYPE_CANVAS) {
var t = new c();
t.setStages([ "opaque" ]);
t.dirty = !0;
this._inited = !1;
this._camera = t;
} else this._inited = !0;
},
editor: !1,
properties: {
_cullingMask: 4294967295,
_clearFlags: v.DEPTH | v.STENCIL,
_backgroundColor: cc.color(0, 0, 0, 255),
_depth: 0,
_zoomRatio: 1,
_targetTexture: null,
_fov: 60,
_orthoSize: 10,
_nearClip: 1,
_farClip: 4096,
_ortho: !0,
_rect: cc.rect(0, 0, 1, 1),
_renderStages: 1,
_alignWithScreen: !0,
zoomRatio: {
get: function() {
return this._zoomRatio;
},
set: function(t) {
this._zoomRatio = t;
},
tooltip: !1
},
fov: {
get: function() {
return this._fov;
},
set: function(t) {
this._fov = t;
},
tooltip: !1
},
orthoSize: {
get: function() {
return this._orthoSize;
},
set: function(t) {
this._orthoSize = t;
},
tooltip: !1
},
nearClip: {
get: function() {
return this._nearClip;
},
set: function(t) {
this._nearClip = t;
this._updateClippingpPlanes();
},
tooltip: !1
},
farClip: {
get: function() {
return this._farClip;
},
set: function(t) {
this._farClip = t;
this._updateClippingpPlanes();
},
tooltip: !1
},
ortho: {
get: function() {
return this._ortho;
},
set: function(t) {
this._ortho = t;
this._updateProjection();
},
tooltip: !1
},
rect: {
get: function() {
return this._rect;
},
set: function(t) {
this._rect = t;
this._updateRect();
},
tooltip: !1
},
cullingMask: {
get: function() {
return this._cullingMask;
},
set: function(t) {
this._cullingMask = t;
this._updateCameraMask();
},
tooltip: !1
},
clearFlags: {
get: function() {
return this._clearFlags;
},
set: function(t) {
this._clearFlags = t;
this._camera && this._camera.setClearFlags(t);
},
tooltip: !1
},
backgroundColor: {
get: function() {
return this._backgroundColor;
},
set: function(t) {
if (!this._backgroundColor.equals(t)) {
this._backgroundColor.set(t);
this._updateBackgroundColor();
}
},
tooltip: !1
},
depth: {
get: function() {
return this._depth;
},
set: function(t) {
b.main === this ? this._depth < t && p() : b.main && t < b.main._depth && d.includes(this) && (b.main = this);
this._depth = t;
this._camera && this._camera.setPriority(t);
},
tooltip: !1
},
targetTexture: {
get: function() {
return this._targetTexture;
},
set: function(t) {
this._targetTexture = t;
this._updateTargetTexture();
},
tooltip: !1
},
renderStages: {
get: function() {
return this._renderStages;
},
set: function(t) {
this._renderStages = t;
this._updateStages();
},
tooltip: !1
},
alignWithScreen: {
get: function() {
return this._alignWithScreen;
},
set: function(t) {
this._alignWithScreen = t;
}
},
_is3D: {
get: function() {
return this.node && this.node._is3DNode;
}
}
},
statics: {
main: null,
cameras: d,
ClearFlags: v,
findCamera: function(t) {
for (var e = 0, i = d.length; e < i; e++) {
var n = d[e];
if (n.containsNode(t)) return n;
}
return null;
},
_findRendererCamera: function(t) {
for (var e = s.scene._cameras, i = 0; i < e._count; i++) if (e._data[i]._cullingMask & t._cullingMask) return e._data[i];
return null;
},
_setupDebugCamera: function() {
if (!m && a.renderType !== a.RENDER_TYPE_CANVAS) {
var t = new c();
m = t;
t.setStages([ "opaque" ]);
t.setFov(60 * Math.PI / 180);
t.setNear(.1);
t.setFar(4096);
t.dirty = !0;
t.cullingMask = 1 << cc.Node.BuiltinGroupIndex.DEBUG;
t.setPriority(cc.macro.MAX_ZINDEX);
t.setClearFlags(0);
t.setColor(0, 0, 0, 0);
var e = new cc.Node();
t.setNode(e);
y();
cc.view.on("design-resolution-changed", y);
s.scene.addCamera(t);
}
}
},
_updateCameraMask: function() {
if (this._camera) {
var t = this._cullingMask & ~(1 << cc.Node.BuiltinGroupIndex.DEBUG);
this._camera.cullingMask = t;
}
},
_updateBackgroundColor: function() {
if (this._camera) {
var t = this._backgroundColor;
this._camera.setColor(t.r / 255, t.g / 255, t.b / 255, t.a / 255);
}
},
_updateTargetTexture: function() {
if (this._camera) {
var t = this._targetTexture;
this._camera.setFrameBuffer(t ? t._framebuffer : null);
}
},
_updateClippingpPlanes: function() {
if (this._camera) {
this._camera.setNear(this._nearClip);
this._camera.setFar(this._farClip);
}
},
_updateProjection: function() {
if (this._camera) {
var t = this._ortho ? 1 : 0;
this._camera.setType(t);
}
},
_updateRect: function() {
if (this._camera) {
var t = this._rect;
this._camera.setRect(t.x, t.y, t.width, t.height);
}
},
_updateStages: function() {
var t = this._renderStages, e = [];
t & g.OPAQUE && e.push("opaque");
t & g.TRANSPARENT && e.push("transparent");
this._camera.setStages(e);
},
_init: function() {
if (!this._inited) {
this._inited = !0;
var t = this._camera;
if (t) {
t.setNode(this.node);
t.setClearFlags(this._clearFlags);
t.setPriority(this._depth);
this._updateBackgroundColor();
this._updateCameraMask();
this._updateTargetTexture();
this._updateClippingpPlanes();
this._updateProjection();
this._updateStages();
this._updateRect();
this.beforeDraw();
}
}
},
__preload: function() {
this._init();
},
onEnable: function() {
if (a.renderType !== a.RENDER_TYPE_CANVAS) {
cc.director.on(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this);
s.scene.addCamera(this._camera);
}
d.push(this);
(!b.main || this._depth < b.main._depth) && (b.main = this);
},
onDisable: function() {
if (a.renderType !== a.RENDER_TYPE_CANVAS) {
cc.director.off(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this);
s.scene.removeCamera(this._camera);
}
cc.js.array.fastRemove(d, this);
if (b.main === this) {
b.main = null;
p();
}
},
getScreenToWorldMatrix2D: function(t) {
this.getWorldToScreenMatrix2D(t);
i.Mat4.invert(t, t);
return t;
},
getWorldToScreenMatrix2D: function(t) {
this.node.getWorldRT(l);
var e = this.zoomRatio, n = l.m;
n[0] *= e;
n[1] *= e;
n[4] *= e;
n[5] *= e;
var r = n[12], s = n[13], o = cc.visibleRect.center;
n[12] = o.x - (n[0] * r + n[4] * s);
n[13] = o.y - (n[1] * r + n[5] * s);
t !== l && i.Mat4.copy(t, l);
return t;
},
getScreenToWorldPoint: function(t, e) {
if (this.node.is3DNode) {
e = e || new cc.Vec3();
this._camera.screenToWorld(e, t, cc.visibleRect.width, cc.visibleRect.height);
} else {
e = e || new cc.Vec2();
this.getScreenToWorldMatrix2D(l);
i.Vec2.transformMat4(e, t, l);
}
return e;
},
getWorldToScreenPoint: function(t, e) {
if (this.node.is3DNode) {
e = e || new cc.Vec3();
this._camera.worldToScreen(e, t, cc.visibleRect.width, cc.visibleRect.height);
} else {
e = e || new cc.Vec2();
this.getWorldToScreenMatrix2D(l);
i.Vec2.transformMat4(e, t, l);
}
return e;
},
getRay: function(t) {
if (!cc.geomUtils) return t;
i.Vec3.set(f, t.x, t.y, 1);
this._camera.screenToWorld(_, f, cc.visibleRect.width, cc.visibleRect.height);
if (this.ortho) {
i.Vec3.set(f, t.x, t.y, -1);
this._camera.screenToWorld(h, f, cc.visibleRect.width, cc.visibleRect.height);
} else this.node.getWorldPosition(h);
return n.Ray.fromPoints(new n.Ray(), h, _);
},
containsNode: function(t) {
return (t._cullingMask & this.cullingMask) > 0;
},
render: function(t) {
if (!(t = t || cc.director.getScene())) return null;
this.node.getWorldMatrix(l);
this.beforeDraw();
o.renderCamera(this._camera, t);
},
_onAlignWithScreen: function() {
var t = cc.game.canvas.height / cc.view._scaleY;
this._targetTexture && (t = cc.visibleRect.height);
var e = this._fov * cc.macro.RAD;
this.node.z = t / (2 * Math.tan(e / 2));
e = 2 * Math.atan(Math.tan(e / 2) / this.zoomRatio);
this._camera.setFov(e);
this._camera.setOrthoHeight(t / 2 / this.zoomRatio);
this.node.setRotation(0, 0, 0, 1);
},
beforeDraw: function() {
if (this._camera) {
if (this._alignWithScreen) this._onAlignWithScreen(); else {
var t = this._fov * cc.macro.RAD;
t = 2 * Math.atan(Math.tan(t / 2) / this.zoomRatio);
this._camera.setFov(t);
this._camera.setOrthoHeight(this._orthoSize / this.zoomRatio);
}
this._camera.dirty = !0;
}
}
});
cc.js.mixin(b.prototype, {
getNodeToCameraTransform: function(t) {
var e = r.identity();
t.getWorldMatrix(u);
if (this.containsNode(t)) {
this.getWorldToCameraMatrix(l);
i.Mat4.mul(u, u, l);
}
r.fromMat4(e, u);
return e;
},
getCameraToWorldPoint: function(t, e) {
return this.getScreenToWorldPoint(t, e);
},
getWorldToCameraPoint: function(t, e) {
return this.getWorldToScreenPoint(t, e);
},
getCameraToWorldMatrix: function(t) {
return this.getScreenToWorldMatrix2D(t);
},
getWorldToCameraMatrix: function(t) {
return this.getWorldToScreenMatrix2D(t);
}
});
e.exports = cc.Camera = b;
}), {
"../../renderer/scene/camera": void 0,
"../CCGame": 71,
"../geom-utils": 194,
"../renderer/index": 271,
"../renderer/render-flow": 272,
"../utils/affine-transform": 313,
"../value-types": 337
} ],
135: [ (function(t, e) {
"use strict";
cc.Collider.Box = cc.Class({
properties: {
_offset: cc.v2(0, 0),
_size: cc.size(100, 100),
offset: {
tooltip: !1,
get: function() {
return this._offset;
},
set: function(t) {
this._offset = t;
},
type: cc.Vec2
},
size: {
tooltip: !1,
get: function() {
return this._size;
},
set: function(t) {
this._size.width = t.width < 0 ? 0 : t.width;
this._size.height = t.height < 0 ? 0 : t.height;
},
type: cc.Size
}
},
resetInEditor: !1
});
var i = cc.Class({
name: "cc.BoxCollider",
extends: cc.Collider,
mixins: [ cc.Collider.Box ],
editor: !1
});
cc.BoxCollider = e.exports = i;
}), {} ],
136: [ (function(t, e) {
"use strict";
cc.Collider.Circle = cc.Class({
properties: {
_offset: cc.v2(0, 0),
_radius: 50,
offset: {
tooltip: !1,
get: function() {
return this._offset;
},
set: function(t) {
this._offset = t;
},
type: cc.Vec2
},
radius: {
tooltip: !1,
get: function() {
return this._radius;
},
set: function(t) {
this._radius = t < 0 ? 0 : t;
}
}
},
resetInEditor: !1
});
var i = cc.Class({
name: "cc.CircleCollider",
extends: cc.Collider,
mixins: [ cc.Collider.Circle ],
editor: !1
});
cc.CircleCollider = e.exports = i;
}), {} ],
137: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.Collider",
extends: cc.Component,
properties: {
editing: {
default: !1,
serializable: !1,
tooltip: !1
},
tag: {
tooltip: !1,
default: 0,
range: [ 0, 1e7 ],
type: cc.Integer
}
},
onDisable: function() {
cc.director.getCollisionManager().removeCollider(this);
},
onEnable: function() {
cc.director.getCollisionManager().addCollider(this);
}
});
cc.Collider = e.exports = i;
}), {} ],
138: [ (function(t, e) {
"use strict";
var i, n = (i = t("../value-types/vec2")) && i.__esModule ? i : {
default: i
}, r = t("./CCContact"), s = r.CollisionType, o = t("../CCNode").EventType, a = new n.default();
function c(t, e, i, n, r, s) {
var o = t.x, a = t.y, c = t.width, l = t.height, u = e.m, h = u[0], _ = u[1], f = u[4], d = u[5], p = h * o + f * a + u[12], m = _ * o + d * a + u[13], y = h * c, v = _ * c, g = f * l, b = d * l;
n.x = p;
n.y = m;
r.x = y + p;
r.y = v + m;
i.x = g + p;
i.y = b + m;
s.x = y + g + p;
s.y = v + b + m;
}
var l = cc.Class({
mixins: [ cc.EventTarget ],
properties: {
enabled: !1,
enabledDrawBoundingBox: !1
},
ctor: function() {
this._contacts = [];
this._colliders = [];
this._debugDrawer = null;
this._enabledDebugDraw = !1;
cc.director._scheduler && cc.director._scheduler.enableForTarget(this);
},
update: function() {
if (this.enabled) {
var t, e, i = this._colliders;
for (t = 0, e = i.length; t < e; t++) this.updateCollider(i[t]);
var n = this._contacts, r = [];
for (t = 0, e = n.length; t < e; t++) {
var o = n[t].updateState();
o !== s.None && r.push([ o, n[t] ]);
}
for (t = 0, e = r.length; t < e; t++) {
var a = r[t];
this._doCollide(a[0], a[1]);
}
this.drawColliders();
}
},
_doCollide: function(t, e) {
var i;
switch (t) {
case s.CollisionEnter:
i = "onCollisionEnter";
break;

case s.CollisionStay:
i = "onCollisionStay";
break;

case s.CollisionExit:
i = "onCollisionExit";
}
var n, r, o, a = e.collider1, c = e.collider2, l = a.node._components, u = c.node._components;
for (n = 0, r = l.length; n < r; n++) (o = l[n])[i] && o[i](c, a);
for (n = 0, r = u.length; n < r; n++) (o = u[n])[i] && o[i](a, c);
},
shouldCollide: function(t, e) {
var i = t.node, n = e.node, r = cc.game.collisionMatrix;
return i !== n && r[i.groupIndex][n.groupIndex];
},
initCollider: function(t) {
if (!t.world) {
var e = t.world = {};
e.aabb = cc.rect();
e.preAabb = cc.rect();
e.matrix = cc.mat4();
e.radius = 0;
if (t instanceof cc.BoxCollider) {
e.position = null;
e.points = [ cc.v2(), cc.v2(), cc.v2(), cc.v2() ];
} else if (t instanceof cc.PolygonCollider) {
e.position = null;
e.points = t.points.map((function(t) {
return cc.v2(t.x, t.y);
}));
} else if (t instanceof cc.CircleCollider) {
e.position = cc.v2();
e.points = null;
}
}
},
updateCollider: function(t) {
var e = t.offset, i = t.world, r = i.aabb, s = i.matrix;
t.node.getWorldMatrix(s);
var o = i.preAabb;
o.x = r.x;
o.y = r.y;
o.width = r.width;
o.height = r.height;
if (t instanceof cc.BoxCollider) {
var l = t.size;
r.x = e.x - l.width / 2;
r.y = e.y - l.height / 2;
r.width = l.width;
r.height = l.height;
var u = i.points, h = u[0], _ = u[1], f = u[2], d = u[3];
c(r, s, h, _, f, d);
var p = Math.min(h.x, _.x, f.x, d.x), m = Math.min(h.y, _.y, f.y, d.y), y = Math.max(h.x, _.x, f.x, d.x), v = Math.max(h.y, _.y, f.y, d.y);
r.x = p;
r.y = m;
r.width = y - p;
r.height = v - m;
} else if (t instanceof cc.CircleCollider) {
n.default.transformMat4(a, t.offset, s);
i.position.x = a.x;
i.position.y = a.y;
var g = s.m, b = g[12], C = g[13];
g[12] = g[13] = 0;
a.x = t.radius;
a.y = 0;
n.default.transformMat4(a, a, s);
var x = Math.sqrt(a.x * a.x + a.y * a.y);
i.radius = x;
r.x = i.position.x - x;
r.y = i.position.y - x;
r.width = 2 * x;
r.height = 2 * x;
g[12] = b;
g[13] = C;
} else if (t instanceof cc.PolygonCollider) {
var A = t.points, S = i.points;
S.length = A.length;
for (var T = 1e6, w = 1e6, E = -1e6, M = -1e6, B = 0, I = A.length; B < I; B++) {
S[B] || (S[B] = cc.v2());
a.x = A[B].x + e.x;
a.y = A[B].y + e.y;
n.default.transformMat4(a, a, s);
var D = a.x, P = a.y;
S[B].x = D;
S[B].y = P;
D > E && (E = D);
D < T && (T = D);
P > M && (M = P);
P < w && (w = P);
}
r.x = T;
r.y = w;
r.width = E - T;
r.height = M - w;
}
},
addCollider: function(t) {
var e = this._colliders;
if (-1 === e.indexOf(t)) {
for (var i = 0, n = e.length; i < n; i++) {
var s = e[i];
if (this.shouldCollide(t, s)) {
var a = new r(t, s);
this._contacts.push(a);
}
}
e.push(t);
this.initCollider(t);
}
t.node.on(o.GROUP_CHANGED, this.onNodeGroupChanged, this);
},
removeCollider: function(t) {
var e = this._colliders, i = e.indexOf(t);
if (i >= 0) {
e.splice(i, 1);
for (var n = this._contacts, r = n.length - 1; r >= 0; r--) {
var a = n[r];
if (a.collider1 === t || a.collider2 === t) {
a.touching && this._doCollide(s.CollisionExit, a);
n.splice(r, 1);
}
}
t.node.off(o.GROUP_CHANGED, this.onNodeGroupChanged, this);
} else cc.errorID(6600);
},
onNodeGroupChanged: function(t) {
for (var e = t.getComponents(cc.Collider), i = 0, n = e.length; i < n; i++) {
var r = e[i];
if (!(cc.PhysicsCollider && r instanceof cc.PhysicsCollider)) {
this.removeCollider(r);
this.addCollider(r);
}
}
},
drawColliders: function() {
if (this._enabledDebugDraw) {
this._checkDebugDrawValid();
var t = this._debugDrawer;
t.clear();
for (var e = this._colliders, i = 0, n = e.length; i < n; i++) {
var r = e[i];
t.strokeColor = cc.Color.WHITE;
if (r instanceof cc.BoxCollider || r instanceof cc.PolygonCollider) {
var s = r.world.points;
if (s.length > 0) {
t.moveTo(s[0].x, s[0].y);
for (var o = 1; o < s.length; o++) t.lineTo(s[o].x, s[o].y);
t.close();
t.stroke();
}
} else if (r instanceof cc.CircleCollider) {
t.circle(r.world.position.x, r.world.position.y, r.world.radius);
t.stroke();
}
if (this.enabledDrawBoundingBox) {
var a = r.world.aabb;
t.strokeColor = cc.Color.BLUE;
t.moveTo(a.xMin, a.yMin);
t.lineTo(a.xMin, a.yMax);
t.lineTo(a.xMax, a.yMax);
t.lineTo(a.xMax, a.yMin);
t.close();
t.stroke();
}
}
}
},
_checkDebugDrawValid: function() {
if (!this._debugDrawer || !this._debugDrawer.isValid) {
var t = new cc.Node("COLLISION_MANAGER_DEBUG_DRAW");
t.zIndex = cc.macro.MAX_ZINDEX;
cc.game.addPersistRootNode(t);
this._debugDrawer = t.addComponent(cc.Graphics);
}
}
});
cc.js.getset(l.prototype, "enabledDebugDraw", (function() {
return this._enabledDebugDraw;
}), (function(t) {
if (t && !this._enabledDebugDraw) {
this._checkDebugDrawValid();
this._debugDrawer.node.active = !0;
} else if (!t && this._enabledDebugDraw) {
this._debugDrawer.clear(!0);
this._debugDrawer.node.active = !1;
}
this._enabledDebugDraw = t;
}));
cc.CollisionManager = e.exports = l;
}), {
"../CCNode": 72,
"../value-types/vec2": 346,
"./CCContact": 139
} ],
139: [ (function(t, e) {
"use strict";
var i = t("./CCIntersection"), n = cc.Enum({
None: 0,
CollisionEnter: 1,
CollisionStay: 2,
CollisionExit: 3
});
function r(t, e) {
this.collider1 = t;
this.collider2 = e;
this.touching = !1;
var n = t instanceof cc.BoxCollider || t instanceof cc.PolygonCollider, r = e instanceof cc.BoxCollider || e instanceof cc.PolygonCollider, s = t instanceof cc.CircleCollider, o = e instanceof cc.CircleCollider;
if (n && r) this.testFunc = i.polygonPolygon; else if (s && o) this.testFunc = i.circleCircle; else if (n && o) this.testFunc = i.polygonCircle; else if (s && r) {
this.testFunc = i.polygonCircle;
this.collider1 = e;
this.collider2 = t;
} else cc.errorID(6601, cc.js.getClassName(t), cc.js.getClassName(e));
}
r.prototype.test = function() {
var t = this.collider1.world, e = this.collider2.world;
return !!t.aabb.intersects(e.aabb) && (this.testFunc === i.polygonPolygon ? this.testFunc(t.points, e.points) : this.testFunc === i.circleCircle ? this.testFunc(t, e) : this.testFunc === i.polygonCircle && this.testFunc(t.points, e));
};
r.prototype.updateState = function() {
var t = this.test(), e = n.None;
if (t && !this.touching) {
this.touching = !0;
e = n.CollisionEnter;
} else if (t && this.touching) e = n.CollisionStay; else if (!t && this.touching) {
this.touching = !1;
e = n.CollisionExit;
}
return e;
};
r.CollisionType = n;
e.exports = r;
}), {
"./CCIntersection": 140
} ],
140: [ (function(t, e) {
"use strict";
var i = {};
function n(t, e, i, n) {
var r = (n.x - i.x) * (t.y - i.y) - (n.y - i.y) * (t.x - i.x), s = (e.x - t.x) * (t.y - i.y) - (e.y - t.y) * (t.x - i.x), o = (n.y - i.y) * (e.x - t.x) - (n.x - i.x) * (e.y - t.y);
if (0 !== o) {
var a = r / o, c = s / o;
if (0 <= a && a <= 1 && 0 <= c && c <= 1) return !0;
}
return !1;
}
i.lineLine = n;
i.lineRect = function(t, e, i) {
var r = new cc.Vec2(i.x, i.y), s = new cc.Vec2(i.x, i.yMax), o = new cc.Vec2(i.xMax, i.yMax), a = new cc.Vec2(i.xMax, i.y);
return !!(n(t, e, r, s) || n(t, e, s, o) || n(t, e, o, a) || n(t, e, a, r));
};
function r(t, e, i) {
for (var r = i.length, s = 0; s < r; ++s) if (n(t, e, i[s], i[(s + 1) % r])) return !0;
return !1;
}
i.linePolygon = r;
i.rectRect = function(t, e) {
var i = t.x, n = t.y, r = t.x + t.width, s = t.y + t.height, o = e.x, a = e.y, c = e.x + e.width, l = e.y + e.height;
return i <= c && r >= o && n <= l && s >= a;
};
i.rectPolygon = function(t, e) {
var i, n, o = new cc.Vec2(t.x, t.y), a = new cc.Vec2(t.x, t.yMax), c = new cc.Vec2(t.xMax, t.yMax), l = new cc.Vec2(t.xMax, t.y);
if (r(o, a, e)) return !0;
if (r(a, c, e)) return !0;
if (r(c, l, e)) return !0;
if (r(l, o, e)) return !0;
for (i = 0, n = e.length; i < n; ++i) if (s(e[i], t)) return !0;
return !!(s(o, e) || s(a, e) || s(c, e) || s(l, e));
};
i.polygonPolygon = function(t, e) {
var i, n;
for (i = 0, n = t.length; i < n; ++i) if (r(t[i], t[(i + 1) % n], e)) return !0;
for (i = 0, n = e.length; i < n; ++i) if (s(e[i], t)) return !0;
for (i = 0, n = t.length; i < n; ++i) if (s(t[i], e)) return !0;
return !1;
};
i.circleCircle = function(t, e) {
return t.position.sub(e.position).mag() < t.radius + e.radius;
};
i.polygonCircle = function(t, e) {
var i = e.position;
if (s(i, t)) return !0;
for (var n = 0, r = t.length; n < r; n++) if (o(i, 0 === n ? t[t.length - 1] : t[n - 1], t[n], !0) < e.radius) return !0;
return !1;
};
function s(t, e) {
for (var i = !1, n = t.x, r = t.y, s = e.length, o = 0, a = s - 1; o < s; a = o++) {
var c = e[o].x, l = e[o].y, u = e[a].x, h = e[a].y;
l > r != h > r && n < (u - c) * (r - l) / (h - l) + c && (i = !i);
}
return i;
}
i.pointInPolygon = s;
function o(t, e, i, n) {
var r, s = i.x - e.x, o = i.y - e.y, a = s * s + o * o, c = ((t.x - e.x) * s + (t.y - e.y) * o) / a;
r = n ? a ? c < 0 ? e : c > 1 ? i : cc.v2(e.x + c * s, e.y + c * o) : e : cc.v2(e.x + c * s, e.y + c * o);
s = t.x - r.x;
o = t.y - r.y;
return Math.sqrt(s * s + o * o);
}
i.pointLineDistance = o;
cc.Intersection = e.exports = i;
}), {} ],
141: [ (function(t, e) {
"use strict";
cc.Collider.Polygon = cc.Class({
properties: {
threshold: {
default: 1,
serializable: !1,
visible: !1
},
_offset: cc.v2(0, 0),
offset: {
get: function() {
return this._offset;
},
set: function(t) {
this._offset = t;
},
type: cc.Vec2
},
points: {
tooltip: !1,
default: function() {
return [ cc.v2(-50, -50), cc.v2(50, -50), cc.v2(50, 50), cc.v2(-50, 50) ];
},
type: [ cc.Vec2 ]
}
},
resetPointsByContour: !1
});
var i = cc.Class({
name: "cc.PolygonCollider",
extends: cc.Collider,
mixins: [ cc.Collider.Polygon ],
editor: !1
});
cc.PolygonCollider = e.exports = i;
}), {} ],
142: [ (function(t) {
"use strict";
t("./CCCollisionManager");
t("./CCCollider");
t("./CCBoxCollider");
t("./CCCircleCollider");
t("./CCPolygonCollider");
}), {
"./CCBoxCollider": 135,
"./CCCircleCollider": 136,
"./CCCollider": 137,
"./CCCollisionManager": 138,
"./CCPolygonCollider": 141
} ],
143: [ (function(t, e) {
"use strict";
t("./platform/CCClass");
var i = t("./platform/CCObject").Flags, n = t("./platform/js").array, r = i.IsStartCalled, s = i.IsOnEnableCalled;
i.IsEditorOnEnableCalled;
function o(t, e) {
for (var i = e.constructor._executionOrder, n = e._id, r = 0, s = t.length - 1, o = s >>> 1; r <= s; o = r + s >>> 1) {
var a = t[o], c = a.constructor._executionOrder;
if (c > i) s = o - 1; else if (c < i) r = o + 1; else {
var l = a._id;
if (l > n) s = o - 1; else {
if (!(l < n)) return o;
r = o + 1;
}
}
}
return ~r;
}
function a(t, e) {
for (var i = t.array, n = t.i + 1; n < i.length; ) {
var r = i[n];
if (r._enabled && r.node._activeInHierarchy) ++n; else {
t.removeAt(n);
e && (r._objFlags &= ~e);
}
}
}
var c = cc.Class({
__ctor__: function(t) {
var e = n.MutableForwardIterator;
this._zero = new e([]);
this._neg = new e([]);
this._pos = new e([]);
this._invoke = t;
},
statics: {
stableRemoveInactive: a
},
add: null,
remove: null,
invoke: null
});
function l(t, e) {
return t.constructor._executionOrder - e.constructor._executionOrder;
}
var u = cc.Class({
extends: c,
add: function(t) {
var e = t.constructor._executionOrder;
(0 === e ? this._zero : e < 0 ? this._neg : this._pos).array.push(t);
},
remove: function(t) {
var e = t.constructor._executionOrder;
(0 === e ? this._zero : e < 0 ? this._neg : this._pos).fastRemove(t);
},
cancelInactive: function(t) {
a(this._zero, t);
a(this._neg, t);
a(this._pos, t);
},
invoke: function() {
var t = this._neg;
if (t.array.length > 0) {
t.array.sort(l);
this._invoke(t);
t.array.length = 0;
}
this._invoke(this._zero);
this._zero.array.length = 0;
var e = this._pos;
if (e.array.length > 0) {
e.array.sort(l);
this._invoke(e);
e.array.length = 0;
}
}
}), h = cc.Class({
extends: c,
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 _(t, e, i, n) {
var r = "var a=it.array;for(it.i=0;it.i<a.length;++it.i){var c=a[it.i];" + t + "}";
n = e ? Function("it", "dt", r) : Function("it", r);
t = Function("c", "dt", t);
return function(e, r) {
try {
n(e, r);
} catch (n) {
cc._throw(n);
var s = e.array;
i && (s[e.i]._objFlags |= i);
++e.i;
for (;e.i < s.length; ++e.i) try {
t(s[e.i], r);
} catch (t) {
cc._throw(t);
i && (s[e.i]._objFlags |= i);
}
}
};
}
var f = _("c.start();c._objFlags|=" + r, !1, r), d = _("c.update(dt)", !0), p = _("c.lateUpdate(dt)", !0);
function m() {
this.startInvoker = new u(f);
this.updateInvoker = new h(d);
this.lateUpdateInvoker = new h(p);
this._deferredComps = [];
this._updating = !1;
}
var y = cc.Class({
ctor: m,
unscheduleAll: m,
statics: {
LifeCycleInvoker: c,
OneOffInvoker: u,
createInvokeImpl: _,
invokeOnEnable: function(t) {
var e = cc.director._compScheduler, i = t.array;
for (t.i = 0; t.i < i.length; ++t.i) {
var n = i[t.i];
if (n._enabled) {
n.onEnable();
!n.node._activeInHierarchy || e._onEnabled(n);
}
}
}
},
_onEnabled: function(t) {
cc.director.getScheduler().resumeTarget(t);
t._objFlags |= s;
this._updating ? this._deferredComps.push(t) : this._scheduleImmediate(t);
},
_onDisabled: function(t) {
cc.director.getScheduler().pauseTarget(t);
t._objFlags &= ~s;
var e = this._deferredComps.indexOf(t);
if (e >= 0) n.fastRemoveAt(this._deferredComps, e); else {
!t.start || t._objFlags & r || this.startInvoker.remove(t);
t.update && this.updateInvoker.remove(t);
t.lateUpdate && this.lateUpdateInvoker.remove(t);
}
},
enableComp: function(t, e) {
if (!(t._objFlags & s)) {
if (t.onEnable) {
if (e) {
e.add(t);
return;
}
t.onEnable();
if (!t.node._activeInHierarchy) return;
}
this._onEnabled(t);
}
},
disableComp: function(t) {
if (t._objFlags & s) {
t.onDisable && t.onDisable();
this._onDisabled(t);
}
},
_scheduleImmediate: function(t) {
"function" != typeof t.start || t._objFlags & r || this.startInvoker.add(t);
"function" == typeof t.update && this.updateInvoker.add(t);
"function" == typeof t.lateUpdate && this.lateUpdateInvoker.add(t);
},
_deferredSchedule: function() {
for (var t = this._deferredComps, e = 0, i = t.length; e < i; e++) this._scheduleImmediate(t[e]);
t.length = 0;
},
_startForNewComps: function() {
if (this._deferredComps.length > 0) {
this._deferredSchedule();
this.startInvoker.invoke();
}
},
startPhase: function() {
this._updating = !0;
this.startInvoker.invoke();
this._startForNewComps();
},
updatePhase: function(t) {
this.updateInvoker.invoke(t);
},
lateUpdatePhase: function(t) {
this.lateUpdateInvoker.invoke(t);
this._updating = !1;
this._startForNewComps();
}
});
e.exports = y;
}), {
"./platform/CCClass": 239,
"./platform/CCObject": 245,
"./platform/js": 260,
"./utils/misc": 322
} ],
144: [ (function(t, e) {
"use strict";
var i = t("../../animation/animation-animator"), n = t("../../animation/animation-clip"), r = t("../event/event-target"), s = t("../platform/js"), o = function(t, e) {
return t === e;
}, a = cc.Enum({
PLAY: "play",
STOP: "stop",
PAUSE: "pause",
RESUME: "resume",
LASTFRAME: "lastframe",
FINISHED: "finished"
}), c = cc.Class({
name: "cc.Animation",
extends: t("./CCComponent"),
mixins: [ r ],
editor: !1,
statics: {
EventType: a
},
ctor: function() {
cc.EventTarget.call(this);
this._animator = null;
this._nameToState = s.createMap(!0);
this._didInit = !1;
this._currentClip = null;
},
properties: {
_defaultClip: {
default: null,
type: n
},
defaultClip: {
type: n,
get: function() {
return this._defaultClip;
},
set: function() {},
tooltip: !1
},
currentClip: {
get: function() {
return this._currentClip;
},
set: function(t) {
this._currentClip = t;
},
type: n,
visible: !1
},
_writableClips: {
get: function() {
return this._clips;
},
set: function(t) {
this._didInit = !1;
this._clips = t;
this._init();
},
type: [ n ]
},
_clips: {
default: [],
type: [ n ],
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);
this._animator.stopStatesExcept(i);
return 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;
if (n.isPlaying && i.isPlaying) if (i.isPaused) n.resumeState(i); else {
n.stopState(i);
n.playState(i, e);
} else 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.getAnimationState(t);
e && this._animator.resumeState(e);
} else this.enabled = !0;
},
setCurrentTime: function(t, e) {
this._init();
if (e) {
var i = this.getAnimationState(e);
i && this._animator.setStateTime(i, t);
} else this._animator.setStateTime(t);
},
getAnimationState: function(t) {
this._init();
var e = this._nameToState[t];
e && !e.curveLoaded && this._animator._reloadClip(e);
return e || null;
},
hasAnimationState: function(t) {
this._init();
return !!this._nameToState[t];
},
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);
this._nameToState[e] = r;
return r;
}
cc.warnID(3900);
},
removeClip: function(t, e) {
if (t) {
this._init();
var i;
for (var n in this._nameToState) {
i = this._nameToState[n];
if (o(i.clip, t)) break;
}
if (t === this._defaultClip) {
if (!e) {
cc.warnID(3902);
return;
}
this._defaultClip = null;
}
if (i && i.isPlaying) {
if (!e) {
cc.warnID(3903);
return;
}
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) {
this._init();
if (t) {
var e = this.getAnimationState(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 o in s) s[o]._lastframeEventOn = !0;
}
return r;
},
off: function(t, e, i, n) {
this._init();
if ("lastframe" === t) {
var r = this._nameToState;
for (var s in r) r[s]._lastframeEventOn = !1;
}
this._EventTargetOff(t, e, i, n);
},
_init: function() {
if (!this._didInit) {
this._didInit = !0;
this._animator = new i(this.node, this);
this._createStates();
}
},
_createStates: function() {
this._nameToState = s.createMap(!0);
for (var t = null, e = !1, i = 0; i < this._clips.length; ++i) {
var n = this._clips[i];
if (n) {
t = new cc.AnimationState(n);
this._nameToState[t.name] = t;
o(this._defaultClip, n) && (e = t);
}
}
if (this._defaultClip && !e) {
t = new cc.AnimationState(this._defaultClip);
this._nameToState[t.name] = t;
}
}
});
c.prototype._EventTargetOn = r.prototype.on;
c.prototype._EventTargetOff = r.prototype.off;
cc.Animation = e.exports = c;
}), {
"../../animation/animation-animator": 9,
"../../animation/animation-clip": 10,
"../event/event-target": 186,
"../platform/js": 260,
"./CCComponent": 149
} ],
145: [ (function(t, e) {
"use strict";
var i = t("../utils/misc"), n = t("./CCComponent"), r = t("../assets/CCAudioClip"), s = cc.Class({
name: "cc.AudioSource",
extends: n,
editor: !1,
ctor: function() {
this.audio = new cc._Audio();
},
properties: {
_clip: {
default: null,
type: r
},
_volume: 1,
_mute: !1,
_loop: !1,
_pausedFlag: {
default: !1,
serializable: !1
},
_firstlyEnabled: !0,
isPlaying: {
get: function() {
return this.audio.getState() === cc._Audio.State.PLAYING;
},
visible: !1
},
clip: {
get: function() {
return this._clip;
},
set: function(t) {
if (t !== this._clip) {
if (!(t instanceof r)) return cc.error("Wrong type of AudioClip.");
this._clip = t;
this.audio.stop();
this.audio.src = this._clip;
this.preload && this._clip._ensureLoaded();
}
},
type: r,
tooltip: !1,
animatable: !1
},
volume: {
get: function() {
return this._volume;
},
set: function(t) {
t = i.clamp01(t);
this._volume = t;
this._mute || this.audio.setVolume(t);
return t;
},
tooltip: !1
},
mute: {
get: function() {
return this._mute;
},
set: function(t) {
this._mute = t;
this.audio.setVolume(t ? 0 : this._volume);
return t;
},
animatable: !1,
tooltip: !1
},
loop: {
get: function() {
return this._loop;
},
set: function(t) {
this._loop = t;
this.audio.setLoop(t);
return t;
},
animatable: !1,
tooltip: !1
},
playOnLoad: {
default: !1,
tooltip: !1,
animatable: !1
},
preload: {
default: !1,
animatable: !1
}
},
_pausedCallback: function() {
if (this.audio.getState() === cc._Audio.State.PLAYING) {
this.audio.pause();
this._pausedFlag = !0;
}
},
_restoreCallback: function() {
this._pausedFlag && this.audio.resume();
this._pausedFlag = !1;
},
onLoad: function() {
this.audio.src || (this.audio.src = this._clip);
this.preload && this._clip._ensureLoaded();
},
onEnable: function() {
if (this.playOnLoad && this._firstlyEnabled) {
this._firstlyEnabled = !1;
this.play();
}
cc.game.on(cc.game.EVENT_HIDE, this._pausedCallback, this);
cc.game.on(cc.game.EVENT_SHOW, this._restoreCallback, this);
},
onDisable: function() {
this.stop();
cc.game.off(cc.game.EVENT_HIDE, this._pausedCallback, this);
cc.game.off(cc.game.EVENT_SHOW, this._restoreCallback, this);
},
onDestroy: function() {
this.audio.destroy();
},
play: function() {
if (this._clip) {
var t = this.audio;
t.setVolume(this._mute ? 0 : this._volume);
t.setLoop(this._loop);
t.setCurrentTime(0);
t.play();
}
},
stop: function() {
this.audio.stop();
},
pause: function() {
this.audio.pause();
},
resume: function() {
this.audio.resume();
},
rewind: function() {
this.audio.setCurrentTime(0);
},
getCurrentTime: function() {
return this.audio.getCurrentTime();
},
setCurrentTime: function(t) {
this.audio.setCurrentTime(t);
return t;
},
getDuration: function() {
return this.audio.getDuration();
}
});
cc.AudioSource = e.exports = s;
}), {
"../assets/CCAudioClip": 106,
"../utils/misc": 322,
"./CCComponent": 149
} ],
146: [ (function(t, e) {
"use strict";
var i = [ "touchstart", "touchmove", "touchend", "mousedown", "mousemove", "mouseup", "mouseenter", "mouseleave", "mousewheel" ];
function n(t) {
t.stopPropagation();
}
var r = cc.Class({
name: "cc.BlockInputEvents",
extends: t("./CCComponent"),
editor: {
menu: "i18n:MAIN_MENU.component.ui/Block Input Events",
inspector: "packages://inspector/inspectors/comps/block-input-events.js",
help: "i18n:COMPONENT.help_url.block_input_events"
},
onEnable: function() {
for (var t = 0; t < i.length; t++) this.node.on(i[t], n, this);
},
onDisable: function() {
for (var t = 0; t < i.length; t++) this.node.off(i[t], n, this);
}
});
cc.BlockInputEvents = e.exports = r;
}), {
"./CCComponent": 149
} ],
147: [ (function(t, e) {
"use strict";
var i = t("./CCComponent"), n = t("../utils/gray-sprite-state"), r = cc.Enum({
NONE: 0,
COLOR: 1,
SPRITE: 2,
SCALE: 3
}), s = cc.Enum({
NORMAL: 0,
HOVER: 1,
PRESSED: 2,
DISABLED: 3
}), o = cc.Class({
name: "cc.Button",
extends: i,
mixins: [ n ],
ctor: function() {
this._pressed = !1;
this._hovered = !1;
this._fromColor = null;
this._toColor = null;
this._time = 0;
this._transitionFinished = !0;
this._fromScale = cc.Vec2.ZERO;
this._toScale = cc.Vec2.ZERO;
this._originalScale = null;
this._graySpriteMaterial = null;
this._spriteMaterial = null;
this._sprite = null;
},
editor: !1,
properties: {
interactable: {
default: !0,
tooltip: !1,
notify: function() {
this._updateState();
this.interactable || this._resetState();
},
animatable: !1
},
_resizeToTarget: {
animatable: !1,
set: function(t) {
t && this._resizeNodeToTargetNode();
}
},
enableAutoGrayEffect: {
default: !1,
tooltip: !1,
notify: function() {
this._updateDisabledState(!0);
}
},
transition: {
default: r.NONE,
tooltip: !1,
type: r,
animatable: !1,
notify: function(t) {
this._updateTransition(t);
},
formerlySerializedAs: "transition"
},
normalColor: {
default: cc.Color.WHITE,
displayName: "Normal",
tooltip: !1,
notify: function() {
this.transition === r.Color && this._getButtonState() === s.NORMAL && (this._getTarget().opacity = this.normalColor.a);
this._updateState();
}
},
pressedColor: {
default: cc.color(211, 211, 211),
displayName: "Pressed",
tooltip: !1,
notify: function() {
this.transition === r.Color && this._getButtonState() === s.PRESSED && (this._getTarget().opacity = this.pressedColor.a);
this._updateState();
},
formerlySerializedAs: "pressedColor"
},
hoverColor: {
default: cc.Color.WHITE,
displayName: "Hover",
tooltip: !1,
notify: function() {
this.transition === r.Color && this._getButtonState() === s.HOVER && (this._getTarget().opacity = this.hoverColor.a);
this._updateState();
},
formerlySerializedAs: "hoverColor"
},
disabledColor: {
default: cc.color(124, 124, 124),
displayName: "Disabled",
tooltip: !1,
notify: function() {
this.transition === r.Color && this._getButtonState() === s.DISABLED && (this._getTarget().opacity = this.disabledColor.a);
this._updateState();
}
},
duration: {
default: .1,
range: [ 0, 10 ],
tooltip: !1
},
zoomScale: {
default: 1.2,
tooltip: !1
},
normalSprite: {
default: null,
type: cc.SpriteFrame,
displayName: "Normal",
tooltip: !1,
notify: function() {
this._updateState();
}
},
pressedSprite: {
default: null,
type: cc.SpriteFrame,
displayName: "Pressed",
tooltip: !1,
formerlySerializedAs: "pressedSprite",
notify: function() {
this._updateState();
}
},
hoverSprite: {
default: null,
type: cc.SpriteFrame,
displayName: "Hover",
tooltip: !1,
formerlySerializedAs: "hoverSprite",
notify: function() {
this._updateState();
}
},
disabledSprite: {
default: null,
type: cc.SpriteFrame,
displayName: "Disabled",
tooltip: !1,
notify: function() {
this._updateState();
}
},
target: {
default: null,
type: cc.Node,
tooltip: !1,
notify: function(t) {
this._applyTarget();
t && this.target !== t && this._unregisterTargetEvent(t);
}
},
clickEvents: {
default: [],
type: cc.Component.EventHandler,
tooltip: !1
}
},
statics: {
Transition: r
},
__preload: function() {
this._applyTarget();
this._resetState();
},
_resetState: function() {
this._pressed = !1;
this._hovered = !1;
var t = this._getTarget(), e = this.transition, i = this._originalScale;
e === r.COLOR && this.interactable ? this._setTargetColor(this.normalColor) : e === r.SCALE && i && t.setScale(i.x, i.y);
this._transitionFinished = !0;
},
onEnable: function() {
this.normalSprite && this.normalSprite.ensureLoadTexture();
this.hoverSprite && this.hoverSprite.ensureLoadTexture();
this.pressedSprite && this.pressedSprite.ensureLoadTexture();
this.disabledSprite && this.disabledSprite.ensureLoadTexture();
this._registerNodeEvent();
this._updateState();
},
onDisable: function() {
this._resetState();
this._unregisterNodeEvent();
},
_getTarget: function() {
return this.target ? this.target : this.node;
},
_onTargetSpriteFrameChanged: function(t) {
this.transition === r.SPRITE && this._setCurrentStateSprite(t.spriteFrame);
},
_onTargetColorChanged: function(t) {
this.transition === r.COLOR && this._setCurrentStateColor(t);
},
_onTargetScaleChanged: function() {
var t = this._getTarget();
if (this._originalScale && (this.transition !== r.SCALE || this._transitionFinished)) {
this._originalScale.x = t.scaleX;
this._originalScale.y = t.scaleY;
}
},
_setTargetColor: function(t) {
var e = this._getTarget(), i = t.clone();
e.opacity = i.a;
i.a = 255;
e.color = i;
},
_getStateColor: function(t) {
switch (t) {
case s.NORMAL:
return this.normalColor;

case s.HOVER:
return this.hoverColor;

case s.PRESSED:
return this.pressedColor;

case s.DISABLED:
return this.disabledColor;
}
},
_getStateSprite: function(t) {
switch (t) {
case s.NORMAL:
return this.normalSprite;

case s.HOVER:
return this.hoverSprite;

case s.PRESSED:
return this.pressedSprite;

case s.DISABLED:
return this.disabledSprite;
}
},
_setCurrentStateColor: function(t) {
switch (this._getButtonState()) {
case s.NORMAL:
this.normalColor = t;
break;

case s.HOVER:
this.hoverColor = t;
break;

case s.PRESSED:
this.pressedColor = t;
break;

case s.DISABLED:
this.disabledColor = t;
}
},
_setCurrentStateSprite: function(t) {
switch (this._getButtonState()) {
case s.NORMAL:
this.normalSprite = t;
break;

case s.HOVER:
this.hoverSprite = t;
break;

case s.PRESSED:
this.pressedSprite = t;
break;

case s.DISABLED:
this.disabledSprite = t;
}
},
update: function(t) {
var e = this._getTarget();
if (!this._transitionFinished && (this.transition === r.COLOR || this.transition === r.SCALE)) {
this.time += t;
var i = 1;
this.duration > 0 && (i = this.time / this.duration);
i >= 1 && (i = 1);
if (this.transition === r.COLOR) {
var n = this._fromColor.lerp(this._toColor, i);
this._setTargetColor(n);
} else this.transition === r.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;
t && (e = t.getComponent(cc.Sprite));
return 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) {
if (this.interactable && this.enabledInHierarchy) {
this._pressed = !0;
this._updateState();
t.stopPropagation();
}
},
_onTouchMove: function(t) {
if (this.interactable && this.enabledInHierarchy && this._pressed) {
var e = t.touch, i = this.node._hitTest(e.getLocation()), n = this._getTarget(), o = this._originalScale;
if (this.transition === r.SCALE && o) if (i) {
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;
} else {
this.time = 0;
this._transitionFinished = !0;
n.setScale(o.x, o.y);
} else {
var a;
a = i ? s.PRESSED : s.NORMAL;
this._applyTransition(a);
}
t.stopPropagation();
}
},
_onTouchEnded: function(t) {
if (this.interactable && this.enabledInHierarchy) {
if (this._pressed) {
cc.Component.EventHandler.emitEvents(this.clickEvents, t);
this.node.emit("click", this);
}
this._pressed = !1;
this._updateState();
t.stopPropagation();
}
},
_onTouchCancel: function() {
if (this.interactable && this.enabledInHierarchy) {
this._pressed = !1;
this._updateState();
}
},
_onMouseMoveIn: function() {
if (!this._pressed && this.interactable && this.enabledInHierarchy && (this.transition !== r.SPRITE || this.hoverSprite) && !this._hovered) {
this._hovered = !0;
this._updateState();
}
},
_onMouseMoveOut: function() {
if (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 ? s.PRESSED : this._hovered ? s.HOVER : s.NORMAL : s.DISABLED;
},
_updateColorTransitionImmediately: function(t) {
var e = this._getStateColor(t);
this._setTargetColor(e);
this._fromColor = e.clone();
this._toColor = e;
},
_updateColorTransition: function(t) {
if (t === s.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 === s.PRESSED ? this._zoomUp() : this._zoomBack();
},
_zoomUp: function() {
if (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 === r.COLOR ? this._updateColorTransitionImmediately(s.NORMAL) : t === r.SPRITE && this._updateSpriteTransition(s.NORMAL);
this._updateState();
},
_applyTransition: function(t) {
var e = this.transition;
e === r.COLOR ? this._updateColorTransition(t) : e === r.SPRITE ? this._updateSpriteTransition(t) : e === r.SCALE && this._updateScaleTransition(t);
},
_resizeNodeToTargetNode: !1,
_updateDisabledState: function(t) {
if (this._sprite && (this.enableAutoGrayEffect || t)) {
var e = !1;
this.transition === r.SPRITE && this.disabledSprite || (e = this.enableAutoGrayEffect && !this.interactable);
this._switchGrayMaterial(e, this._sprite);
}
}
});
cc.Button = e.exports = o;
}), {
"../utils/gray-sprite-state": 319,
"./CCComponent": 149
} ],
148: [ (function(t, e) {
"use strict";
var i = t("../camera/CCCamera"), n = t("./CCComponent"), r = cc.Class({
name: "cc.Canvas",
extends: n,
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) {
if (this._fitHeight !== t) {
this._fitHeight = t;
this.applySettings();
}
},
tooltip: !1
},
fitWidth: {
get: function() {
return this._fitWidth;
},
set: function(t) {
if (this._fitWidth !== t) {
this._fitWidth = t;
this.applySettings();
}
},
tooltip: !1
}
},
_fitDesignResolution: !1,
__preload: function() {
if (r.instance) return cc.warnID(6700, this.node.name, r.instance.node.name);
r.instance = this;
this.applySettings();
var t = this.getComponent(cc.Widget);
t && t.updateAlignment();
},
start: function() {
if (!i.main && cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
var t = new cc.Node("Main Camera");
t.parent = this.node;
t.setSiblingIndex(0);
var e = t.addComponent(i), n = i.ClearFlags;
e.clearFlags = n.COLOR | n.DEPTH | n.STENCIL;
e.depth = -1;
}
},
onDestroy: function() {
r.instance === this && (r.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 = r;
}), {
"../camera/CCCamera": 134,
"./CCComponent": 149
} ],
149: [ (function(t, e) {
"use strict";
var i = t("../platform/CCObject"), n = t("../platform/js"), r = new (t("../platform/id-generater"))("Comp"), s = (i.Flags.IsOnEnableCalled, 
i.Flags.IsOnLoadCalled), o = !!cc.ActionManager, a = cc.Class({
name: "cc.Component",
extends: i,
ctor: function() {
this._id = r.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(".");
e >= 0 && (t = t.slice(e + 1));
return 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;
if (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 & s;
}
}
},
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) {
t || (t = cc.instantiate._clone(this, this));
t.node = null;
return 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);
}
});
a._requireComponent = null;
a._executionOrder = 0;
n.value(a, "_registerEditorProps", (function(t, e) {
var i = e.requireComponent;
i && (t._requireComponent = i);
var n = e.executionOrder;
n && "number" == typeof n && (t._executionOrder = n);
}));
a.prototype.__scriptUuid = "";
cc.Component = e.exports = a;
}), {
"../platform/CCObject": 245,
"../platform/id-generater": 256,
"../platform/js": 260
} ],
150: [ (function() {
"use strict";
cc.Component.EventHandler = cc.Class({
name: "cc.ClickEvent",
properties: {
target: {
default: null,
type: cc.Node
},
component: "",
_componentId: "",
_componentName: {
get: function() {
this._genCompIdIfNeeded();
return 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; i < n; i++) e[i] = arguments[i + 1];
for (var r = 0, s = t.length; r < s; r++) {
var o = t[r];
o instanceof cc.Component.EventHandler && o.emit(e);
}
}
},
emit: function(t) {
var e = this.target;
if (cc.isValid(e)) {
this._genCompIdIfNeeded();
var i = cc.js._getClassById(this._componentId), n = e.getComponent(i);
if (cc.isValid(n)) {
var r = n[this.handler];
if ("function" == typeof r) {
null != this.customEventData && "" !== this.customEventData && (t = t.slice()).push(this.customEventData);
r.apply(n, t);
}
}
}
},
_compName2Id: function(t) {
var e = cc.js.getClassByName(t);
return cc.js._getClassId(e);
},
_compId2Name: function(t) {
var e = cc.js._getClassById(t);
return cc.js.getClassName(e);
},
_genCompIdIfNeeded: function() {
if (!this._componentId) {
this._componentName = this.component;
this.component = "";
}
}
});
}), {} ],
151: [ (function(t, e) {
"use strict";
var i = t("../platform/CCMacro"), n = t("./CCRenderComponent"), r = (t("../assets/material/CCMaterial"), 
t("../renderer/utils/label/label-frame")), s = t("../utils/blend-func"), o = t("../renderer/utils/utils").deleteFromDynamicAtlas, a = i.TextAlignment, c = i.VerticalTextAlignment, l = cc.Enum({
NONE: 0,
CLAMP: 1,
SHRINK: 2,
RESIZE_HEIGHT: 3
}), u = cc.Enum({
NONE: 0,
BITMAP: 1,
CHAR: 2
}), h = cc.Class({
name: "cc.Label",
extends: n,
mixins: [ s ],
ctor: function() {
this._actualFontSize = 0;
this._assemblerData = null;
this._frame = null;
this._ttfTexture = null;
this._letterTexture = null;
cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? this._updateMaterial = this._updateMaterialCanvas : this._updateMaterial = this._updateMaterialWebgl;
},
editor: !1,
properties: {
_string: {
default: "",
formerlySerializedAs: "_N$string"
},
string: {
get: function() {
return this._string;
},
set: function(t) {
var e = this._string;
this._string = "" + t;
this.string !== e && this.setVertsDirty();
this._checkStringEmpty();
},
multiline: !0,
tooltip: !1
},
horizontalAlign: {
default: a.LEFT,
type: a,
tooltip: !1,
notify: function(t) {
this.horizontalAlign !== t && this.setVertsDirty();
},
animatable: !1
},
verticalAlign: {
default: c.TOP,
type: c,
tooltip: !1,
notify: function(t) {
this.verticalAlign !== t && this.setVertsDirty();
},
animatable: !1
},
actualFontSize: {
displayName: "Actual Font Size",
animatable: !1,
readonly: !0,
get: function() {
return this._actualFontSize;
},
tooltip: !1
},
_fontSize: 40,
fontSize: {
get: function() {
return this._fontSize;
},
set: function(t) {
if (this._fontSize !== t) {
this._fontSize = t;
this.setVertsDirty();
}
},
range: [ 0, 512 ],
tooltip: !1
},
fontFamily: {
default: "Arial",
tooltip: !1,
notify: function(t) {
this.fontFamily !== t && this.setVertsDirty();
},
animatable: !1
},
_lineHeight: 40,
lineHeight: {
get: function() {
return this._lineHeight;
},
set: function(t) {
if (this._lineHeight !== t) {
this._lineHeight = t;
this.setVertsDirty();
}
},
tooltip: !1
},
overflow: {
default: l.NONE,
type: l,
tooltip: !1,
notify: function(t) {
this.overflow !== t && this.setVertsDirty();
},
animatable: !1
},
_enableWrapText: !0,
enableWrapText: {
get: function() {
return this._enableWrapText;
},
set: function(t) {
if (this._enableWrapText !== t) {
this._enableWrapText = t;
this.setVertsDirty();
}
},
animatable: !1,
tooltip: !1
},
_N$file: null,
font: {
get: function() {
return this._N$file;
},
set: function(t) {
if (this.font !== t) {
t || (this._isSystemFontUsed = !0);
this._N$file = t;
t && this._isSystemFontUsed && (this._isSystemFontUsed = !1);
this.enabledInHierarchy && this._forceUpdateRenderData();
}
},
type: cc.Font,
tooltip: !1,
animatable: !1
},
_isSystemFontUsed: !0,
useSystemFont: {
get: function() {
return this._isSystemFontUsed;
},
set: function(t) {
if (this._isSystemFontUsed !== t) {
this._isSystemFontUsed = !!t;
if (t) {
this.font = null;
if (!this.enabledInHierarchy) return;
this._forceUpdateRenderData();
}
this.markForValidate();
}
},
animatable: !1,
tooltip: !1
},
_bmFontOriginalSize: {
displayName: "BMFont Original Size",
get: function() {
return this._N$file instanceof cc.BitmapFont ? this._N$file.fontSize : -1;
},
visible: !0,
animatable: !1
},
_spacingX: 0,
spacingX: {
get: function() {
return this._spacingX;
},
set: function(t) {
this._spacingX = t;
this.setVertsDirty();
},
tooltip: !1
},
_batchAsBitmap: !1,
cacheMode: {
default: u.NONE,
type: u,
tooltip: !1,
notify: function(t) {
if (this.cacheMode !== t) {
t !== u.BITMAP || this.font instanceof cc.BitmapFont || this._frame && this._frame._resetDynamicAtlasFrame();
t === u.CHAR && (this._ttfTexture = null);
this.enabledInHierarchy && this._forceUpdateRenderData();
}
},
animatable: !1
},
_styleFlags: 0,
enableBold: {
get: function() {
return !!(1 & this._styleFlags);
},
set: function(t) {
t ? this._styleFlags |= 1 : this._styleFlags &= -2;
this.setVertsDirty();
},
animatable: !1,
tooltip: !1
},
enableItalic: {
get: function() {
return !!(2 & this._styleFlags);
},
set: function(t) {
t ? this._styleFlags |= 2 : this._styleFlags &= -3;
this.setVertsDirty();
},
animatable: !1,
tooltip: !1
},
enableUnderline: {
get: function() {
return !!(4 & this._styleFlags);
},
set: function(t) {
t ? this._styleFlags |= 4 : this._styleFlags &= -5;
this.setVertsDirty();
},
animatable: !1,
tooltip: !1
},
_underlineHeight: 0,
underlineHeight: {
get: function() {
return this._underlineHeight;
},
set: function(t) {
if (this._underlineHeight !== t) {
this._underlineHeight = t;
this.setVertsDirty();
}
},
tooltip: !1
}
},
statics: {
HorizontalAlign: a,
VerticalAlign: c,
Overflow: l,
CacheMode: u,
_shareAtlas: null,
clearCharCache: function() {
h._shareAtlas && h._shareAtlas.clearAllCache();
}
},
onLoad: function() {
if (this._batchAsBitmap && this.cacheMode === u.NONE) {
this.cacheMode = u.BITMAP;
this._batchAsBitmap = !1;
}
cc.game.renderType === cc.game.RENDER_TYPE_CANVAS && (this.cacheMode = u.NONE);
},
onEnable: function() {
this._super();
this.node.on(cc.Node.EventType.SIZE_CHANGED, this._nodeSizeChanged, this);
this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this.setVertsDirty, this);
this.node.on(cc.Node.EventType.COLOR_CHANGED, this._nodeColorChanged, this);
this._forceUpdateRenderData();
},
onDisable: function() {
this._super();
this.node.off(cc.Node.EventType.SIZE_CHANGED, this._nodeSizeChanged, this);
this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this.setVertsDirty, this);
this.node.off(cc.Node.EventType.COLOR_CHANGED, this._nodeColorChanged, this);
},
onDestroy: function() {
this._assembler && this._assembler._resetAssemblerData && this._assembler._resetAssemblerData(this._assemblerData);
this._assemblerData = null;
this._letterTexture = null;
if (this._ttfTexture) {
this._ttfTexture.destroy();
this._ttfTexture = null;
}
this._super();
},
_nodeSizeChanged: function() {
this.overflow !== l.NONE && this.setVertsDirty();
},
_nodeColorChanged: function() {
this.font instanceof cc.BitmapFont || this.setVertsDirty();
},
setVertsDirty: function() {
this._nativeTTF() && this._assembler && this._assembler.updateRenderData(this);
this._super();
},
_updateColor: function() {
this.font instanceof cc.BitmapFont || this._srcBlendFactor === cc.macro.BlendFactor.SRC_ALPHA && this.node._renderFlag & cc.RenderFlow.FLAG_OPACITY || this.setVertsDirty();
n.prototype._updateColor.call(this);
},
_validateRender: function() {
if (this.string) {
if (this._materials[0]) {
var t = this.font;
if (!(t instanceof cc.BitmapFont)) return;
var e = t.spriteFrame;
if (e && e.textureLoaded() && t._fntConfig) return;
}
this.disableRender();
} else this.disableRender();
},
_resetAssembler: function() {
this._resetFrame();
n.prototype._resetAssembler.call(this);
},
_resetFrame: function() {
if (this._frame && !(this.font instanceof cc.BitmapFont)) {
o(this, this._frame);
this._frame = null;
}
},
_checkStringEmpty: function() {
this.markForRender(!!this.string);
},
_on3DNodeChanged: function() {
this._resetAssembler();
this._applyFontTexture();
},
_onBMFontTextureLoaded: function() {
this._frame._texture = this.font.spriteFrame._texture;
this.markForRender(!0);
this._updateMaterial();
this._assembler && this._assembler.updateRenderData(this);
},
_onBlendChanged: function() {
this.useSystemFont && this.enabledInHierarchy && this._forceUpdateRenderData();
},
_applyFontTexture: function() {
var t = this.font;
if (t instanceof cc.BitmapFont) {
var e = t.spriteFrame;
this._frame = e;
e && e.onTextureLoaded(this._onBMFontTextureLoaded, this);
} else {
if (!this._nativeTTF()) {
this._frame || (this._frame = new r());
if (this.cacheMode === u.CHAR) {
this._letterTexture = this._assembler._getAssemblerData();
this._frame._refreshTexture(this._letterTexture);
} else if (!this._ttfTexture) {
this._ttfTexture = new cc.Texture2D();
this._assemblerData = this._assembler._getAssemblerData();
this._ttfTexture.initWithElement(this._assemblerData.canvas);
}
if (this.cacheMode !== u.CHAR) {
this._frame._resetDynamicAtlasFrame();
this._frame._refreshTexture(this._ttfTexture);
this._srcBlendFactor, cc.macro.BlendFactor.ONE;
}
this._updateMaterial();
}
this._assembler && this._assembler.updateRenderData(this);
}
this.markForValidate();
},
_updateMaterialCanvas: function() {
this._frame && (this._frame._texture._nativeUrl = this.uuid + "_texture");
},
_updateMaterialWebgl: function() {
var t = this.getMaterial(0);
if (this._nativeTTF()) t && this._assembler._updateTTFMaterial(this); else if (this._frame) {
t && t.setProperty("texture", this._frame._texture);
s.prototype._updateMaterial.call(this);
}
},
_forceUseCanvas: !1,
_useNativeTTF: function() {
return cc.macro.ENABLE_NATIVE_TTF_RENDERER && !this._forceUseCanvas;
},
_nativeTTF: function() {
return this._useNativeTTF() && !!this._assembler && !!this._assembler._updateTTFMaterial;
},
_forceUpdateRenderData: function() {
this.setVertsDirty();
this._resetAssembler();
this._applyFontTexture();
},
_enableBold: function(t) {
this.enableBold = !!t;
},
_enableItalics: function(t) {
this.enableItalic = !!t;
},
_enableUnderline: function(t) {
this.enableUnderline = !!t;
}
});
cc.Label = e.exports = h;
}), {
"../assets/material/CCMaterial": 124,
"../platform/CCMacro": 244,
"../renderer/utils/label/label-frame": 276,
"../renderer/utils/utils": 279,
"../utils/blend-func": 316,
"./CCRenderComponent": 160
} ],
152: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.LabelOutline",
extends: t("./CCComponent"),
editor: !1,
properties: {
_color: cc.Color.WHITE,
_width: 1,
color: {
tooltip: !1,
get: function() {
return this._color.clone();
},
set: function(t) {
this._color.equals(t) || this._color.set(t);
this._updateRenderData();
}
},
width: {
tooltip: !1,
get: function() {
return this._width;
},
set: function(t) {
if (this._width !== t) {
this._width = t;
this._updateRenderData();
}
},
range: [ 0, 512 ]
}
},
onEnable: function() {
this._updateRenderData();
},
onDisable: function() {
this._updateRenderData();
},
_updateRenderData: function() {
var t = this.node.getComponent(cc.Label);
t && t.setVertsDirty();
}
});
cc.LabelOutline = e.exports = i;
}), {
"./CCComponent": 149
} ],
153: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.LabelShadow",
extends: t("./CCComponent"),
editor: !1,
properties: {
_color: cc.Color.WHITE,
_offset: cc.v2(2, 2),
_blur: 2,
color: {
tooltip: !1,
get: function() {
return this._color.clone();
},
set: function(t) {
this._color.equals(t) || this._color.set(t);
this._updateRenderData();
}
},
offset: {
tooltip: !1,
get: function() {
return this._offset;
},
set: function(t) {
this._offset = t;
this._updateRenderData();
}
},
blur: {
tooltip: !1,
get: function() {
return this._blur;
},
set: function(t) {
this._blur = t;
this._updateRenderData();
},
range: [ 0, 1024 ]
}
},
onEnable: function() {
this._updateRenderData();
},
onDisable: function() {
this._updateRenderData();
},
_updateRenderData: function() {
var t = this.node.getComponent(cc.Label);
t && t.markForRender(!0);
}
});
cc.LabelShadow = e.exports = i;
}), {
"./CCComponent": 149
} ],
154: [ (function(t, e) {
"use strict";
var i = t("../CCNode").EventType, n = cc.Enum({
NONE: 0,
HORIZONTAL: 1,
VERTICAL: 2,
GRID: 3
}), r = cc.Enum({
NONE: 0,
CONTAINER: 1,
CHILDREN: 2
}), s = cc.Enum({
HORIZONTAL: 0,
VERTICAL: 1
}), o = cc.Enum({
BOTTOM_TO_TOP: 0,
TOP_TO_BOTTOM: 1
}), a = cc.Enum({
LEFT_TO_RIGHT: 0,
RIGHT_TO_LEFT: 1
}), c = cc.Class({
name: "cc.Layout",
extends: t("./CCComponent"),
editor: !1,
properties: {
_layoutSize: cc.size(300, 200),
_layoutDirty: {
default: !0,
serializable: !1
},
_resize: r.NONE,
_N$layoutType: n.NONE,
type: {
type: n,
get: function() {
return this._N$layoutType;
},
set: function(t) {
this._N$layoutType = t;
this._doLayoutDirty();
},
tooltip: !1,
animatable: !1
},
resizeMode: {
type: r,
tooltip: !1,
animatable: !1,
get: function() {
return this._resize;
},
set: function(t) {
if (this.type !== n.NONE || t !== r.CHILDREN) {
this._resize = t;
this._doLayoutDirty();
}
}
},
cellSize: {
default: cc.size(40, 40),
tooltip: !1,
type: cc.Size,
notify: function() {
this._doLayoutDirty();
}
},
startAxis: {
default: s.HORIZONTAL,
tooltip: !1,
type: s,
notify: function() {
this._doLayoutDirty();
},
animatable: !1
},
paddingLeft: {
default: 0,
tooltip: !1,
notify: function() {
this._doLayoutDirty();
}
},
paddingRight: {
default: 0,
tooltip: !1,
notify: function() {
this._doLayoutDirty();
}
},
paddingTop: {
default: 0,
tooltip: !1,
notify: function() {
this._doLayoutDirty();
}
},
paddingBottom: {
default: 0,
tooltip: !1,
notify: function() {
this._doLayoutDirty();
}
},
spacingX: {
default: 0,
notify: function() {
this._doLayoutDirty();
},
tooltip: !1
},
spacingY: {
default: 0,
notify: function() {
this._doLayoutDirty();
},
tooltip: !1
},
verticalDirection: {
default: o.TOP_TO_BOTTOM,
type: o,
notify: function() {
this._doLayoutDirty();
},
tooltip: !1,
animatable: !1
},
horizontalDirection: {
default: a.LEFT_TO_RIGHT,
type: a,
notify: function() {
this._doLayoutDirty();
},
tooltip: !1,
animatable: !1
},
affectedByScale: {
default: !1,
notify: function() {
this._doLayoutDirty();
},
animatable: !1,
tooltip: !1
}
},
statics: {
Type: n,
VerticalDirection: o,
HorizontalDirection: a,
ResizeMode: r,
AxisDirection: s
},
onEnable: function() {
this._addEventListeners();
this.node.getContentSize().equals(cc.size(0, 0)) && this.node.setContentSize(this._layoutSize);
this._doLayoutDirty();
},
onDisable: function() {
this._removeEventListeners();
},
_doLayoutDirty: function() {
this._layoutDirty = !0;
},
_doScaleDirty: function() {
this._layoutDirty = this._layoutDirty || this.affectedByScale;
},
_addEventListeners: function() {
cc.director.on(cc.Director.EVENT_AFTER_UPDATE, this.updateLayout, this);
this.node.on(i.SIZE_CHANGED, this._resized, this);
this.node.on(i.ANCHOR_CHANGED, this._doLayoutDirty, this);
this.node.on(i.CHILD_ADDED, this._childAdded, this);
this.node.on(i.CHILD_REMOVED, this._childRemoved, this);
this.node.on(i.CHILD_REORDER, this._doLayoutDirty, this);
this._addChildrenEventListeners();
},
_removeEventListeners: function() {
cc.director.off(cc.Director.EVENT_AFTER_UPDATE, this.updateLayout, this);
this.node.off(i.SIZE_CHANGED, this._resized, this);
this.node.off(i.ANCHOR_CHANGED, this._doLayoutDirty, this);
this.node.off(i.CHILD_ADDED, this._childAdded, this);
this.node.off(i.CHILD_REMOVED, this._childRemoved, this);
this.node.off(i.CHILD_REORDER, this._doLayoutDirty, this);
this._removeChildrenEventListeners();
},
_addChildrenEventListeners: function() {
for (var t = this.node.children, e = 0; e < t.length; ++e) {
var n = t[e];
n.on(i.SCALE_CHANGED, this._doScaleDirty, this);
n.on(i.SIZE_CHANGED, this._doLayoutDirty, this);
n.on(i.POSITION_CHANGED, this._doLayoutDirty, this);
n.on(i.ANCHOR_CHANGED, this._doLayoutDirty, this);
n.on("active-in-hierarchy-changed", this._doLayoutDirty, this);
}
},
_removeChildrenEventListeners: function() {
for (var t = this.node.children, e = 0; e < t.length; ++e) {
var n = t[e];
n.off(i.SCALE_CHANGED, this._doScaleDirty, this);
n.off(i.SIZE_CHANGED, this._doLayoutDirty, this);
n.off(i.POSITION_CHANGED, this._doLayoutDirty, this);
n.off(i.ANCHOR_CHANGED, this._doLayoutDirty, this);
n.off("active-in-hierarchy-changed", this._doLayoutDirty, this);
}
},
_childAdded: function(t) {
t.on(i.SCALE_CHANGED, this._doScaleDirty, this);
t.on(i.SIZE_CHANGED, this._doLayoutDirty, this);
t.on(i.POSITION_CHANGED, this._doLayoutDirty, this);
t.on(i.ANCHOR_CHANGED, this._doLayoutDirty, this);
t.on("active-in-hierarchy-changed", this._doLayoutDirty, this);
this._doLayoutDirty();
},
_childRemoved: function(t) {
t.off(i.SCALE_CHANGED, this._doScaleDirty, this);
t.off(i.SIZE_CHANGED, this._doLayoutDirty, this);
t.off(i.POSITION_CHANGED, this._doLayoutDirty, this);
t.off(i.ANCHOR_CHANGED, this._doLayoutDirty, this);
t.off("active-in-hierarchy-changed", this._doLayoutDirty, this);
this._doLayoutDirty();
},
_resized: function() {
this._layoutSize = this.node.getContentSize();
this._doLayoutDirty();
},
_doLayoutHorizontally: function(t, e, i, s) {
var c = this.node.getAnchorPoint(), l = this.node.children, u = 1, h = this.paddingLeft, _ = -c.x * t;
if (this.horizontalDirection === a.RIGHT_TO_LEFT) {
u = -1;
_ = (1 - c.x) * t;
h = this.paddingRight;
}
for (var f = _ + u * h - u * this.spacingX, d = 0, p = 0, m = 0, y = 0, v = 0, g = 0, b = 0, C = 0; C < l.length; ++C) (A = l[C]).activeInHierarchy && b++;
var x = this.cellSize.width;
this.type !== n.GRID && this.resizeMode === r.CHILDREN && (x = (t - (this.paddingLeft + this.paddingRight) - (b - 1) * this.spacingX) / b);
for (C = 0; C < l.length; ++C) {
var A = l[C], S = this._getUsedScaleValue(A.scaleX), T = this._getUsedScaleValue(A.scaleY);
if (A.activeInHierarchy) {
if (this._resize === r.CHILDREN) {
A.width = x / S;
this.type === n.GRID && (A.height = this.cellSize.height / T);
}
var w = A.anchorX, E = A.width * S, M = A.height * T;
m > p && (p = m);
if (M >= p) {
m = p;
p = M;
g = A.getAnchorPoint().y;
}
this.horizontalDirection === a.RIGHT_TO_LEFT && (w = 1 - A.anchorX);
f = f + u * w * E + u * this.spacingX;
var B = u * (1 - w) * E;
if (e) {
var I = f + B + u * (u > 0 ? this.paddingRight : this.paddingLeft), D = this.horizontalDirection === a.LEFT_TO_RIGHT && I > (1 - c.x) * t, P = this.horizontalDirection === a.RIGHT_TO_LEFT && I < -c.x * t;
if (D || P) {
if (M >= p) {
0 === m && (m = p);
d += m;
m = p;
} else {
d += p;
m = M;
p = 0;
}
f = _ + u * (h + w * E);
y++;
}
}
var R = i(A, d, y);
t >= E + this.paddingLeft + this.paddingRight && s && A.setPosition(cc.v2(f, R));
var L, O = 1, V = 0 === p ? M : p;
if (this.verticalDirection === o.TOP_TO_BOTTOM) {
v = v || this.node._contentSize.height;
(L = R + (O = -1) * (V * g + this.paddingBottom)) < v && (v = L);
} else {
v = v || -this.node._contentSize.height;
(L = R + O * (V * g + this.paddingTop)) > v && (v = L);
}
f += B;
}
}
return v;
},
_getVerticalBaseHeight: function(t) {
var e = 0, i = 0;
if (this.resizeMode === r.CONTAINER) {
for (var n = 0; n < t.length; ++n) {
var s = t[n];
if (s.activeInHierarchy) {
i++;
e += s.height * this._getUsedScaleValue(s.scaleY);
}
}
e += (i - 1) * this.spacingY + this.paddingBottom + this.paddingTop;
} else e = this.node.getContentSize().height;
return e;
},
_doLayoutVertically: function(t, e, i, s) {
var c = this.node.getAnchorPoint(), l = this.node.children, u = 1, h = this.paddingBottom, _ = -c.y * t;
if (this.verticalDirection === o.TOP_TO_BOTTOM) {
u = -1;
_ = (1 - c.y) * t;
h = this.paddingTop;
}
for (var f = _ + u * h - u * this.spacingY, d = 0, p = 0, m = 0, y = 0, v = 0, g = 0, b = 0, C = 0; C < l.length; ++C) (A = l[C]).activeInHierarchy && b++;
var x = this.cellSize.height;
this.type !== n.GRID && this.resizeMode === r.CHILDREN && (x = (t - (this.paddingTop + this.paddingBottom) - (b - 1) * this.spacingY) / b);
for (C = 0; C < l.length; ++C) {
var A = l[C], S = this._getUsedScaleValue(A.scaleX), T = this._getUsedScaleValue(A.scaleY);
if (A.activeInHierarchy) {
if (this.resizeMode === r.CHILDREN) {
A.height = x / T;
this.type === n.GRID && (A.width = this.cellSize.width / S);
}
var w = A.anchorY, E = A.width * S, M = A.height * T;
m > p && (p = m);
if (E >= p) {
m = p;
p = E;
g = A.getAnchorPoint().x;
}
this.verticalDirection === o.TOP_TO_BOTTOM && (w = 1 - A.anchorY);
f = f + u * w * M + u * this.spacingY;
var B = u * (1 - w) * M;
if (e) {
var I = f + B + u * (u > 0 ? this.paddingTop : this.paddingBottom), D = this.verticalDirection === o.BOTTOM_TO_TOP && I > (1 - c.y) * t, P = this.verticalDirection === o.TOP_TO_BOTTOM && I < -c.y * t;
if (D || P) {
if (E >= p) {
0 === m && (m = p);
d += m;
m = p;
} else {
d += p;
m = E;
p = 0;
}
f = _ + u * (h + w * M);
y++;
}
}
var R = i(A, d, y);
t >= M + (this.paddingTop + this.paddingBottom) && s && A.setPosition(cc.v2(R, f));
var L, O = 1, V = 0 === p ? E : p;
if (this.horizontalDirection === a.RIGHT_TO_LEFT) {
O = -1;
v = v || this.node._contentSize.width;
(L = R + O * (V * g + this.paddingLeft)) < v && (v = L);
} else {
v = v || -this.node._contentSize.width;
(L = R + O * (V * g + this.paddingRight)) > v && (v = L);
}
f += B;
}
}
return v;
},
_doLayoutBasic: function() {
for (var t = this.node.children, e = null, i = 0; i < t.length; ++i) {
var n = t[i];
n.activeInHierarchy && (e ? e.union(e, n.getBoundingBoxToWorld()) : e = n.getBoundingBoxToWorld());
}
if (e) {
var r = this.node.convertToNodeSpaceAR(cc.v2(e.x, e.y));
r = cc.v2(r.x - this.paddingLeft, r.y - this.paddingBottom);
var s = this.node.convertToNodeSpaceAR(cc.v2(e.xMax, e.yMax)), o = (s = cc.v2(s.x + this.paddingRight, s.y + this.paddingTop)).sub(r);
if (0 !== (o = cc.size(parseFloat(o.x.toFixed(2)), parseFloat(o.y.toFixed(2)))).width) {
var a = -r.x / o.width;
this.node.anchorX = parseFloat(a.toFixed(2));
}
if (0 !== o.height) {
var c = -r.y / o.height;
this.node.anchorY = parseFloat(c.toFixed(2));
}
this.node.setContentSize(o);
}
},
_doLayoutGridAxisHorizontal: function(t, e) {
var i = e.width, n = 1, s = -t.y * e.height, a = this.paddingBottom;
if (this.verticalDirection === o.TOP_TO_BOTTOM) {
n = -1;
s = (1 - t.y) * e.height;
a = this.paddingTop;
}
var c = function(t, e, i) {
return s + n * (e + t.anchorY * t.height * this._getUsedScaleValue(t.scaleY) + a + i * this.spacingY);
}.bind(this), l = 0;
if (this.resizeMode === r.CONTAINER) {
var u = this._doLayoutHorizontally(i, !0, c, !1);
(l = s - u) < 0 && (l *= -1);
s = -t.y * l;
if (this.verticalDirection === o.TOP_TO_BOTTOM) {
n = -1;
s = (1 - t.y) * l;
}
}
this._doLayoutHorizontally(i, !0, c, !0);
this.resizeMode === r.CONTAINER && this.node.setContentSize(i, l);
},
_doLayoutGridAxisVertical: function(t, e) {
var i = e.height, n = 1, s = -t.x * e.width, o = this.paddingLeft;
if (this.horizontalDirection === a.RIGHT_TO_LEFT) {
n = -1;
s = (1 - t.x) * e.width;
o = this.paddingRight;
}
var c = function(t, e, i) {
return s + n * (e + t.anchorX * t.width * this._getUsedScaleValue(t.scaleX) + o + i * this.spacingX);
}.bind(this), l = 0;
if (this.resizeMode === r.CONTAINER) {
var u = this._doLayoutVertically(i, !0, c, !1);
(l = s - u) < 0 && (l *= -1);
s = -t.x * l;
if (this.horizontalDirection === a.RIGHT_TO_LEFT) {
n = -1;
s = (1 - t.x) * l;
}
}
this._doLayoutVertically(i, !0, c, !0);
this.resizeMode === r.CONTAINER && this.node.setContentSize(l, i);
},
_doLayoutGrid: function() {
var t = this.node.getAnchorPoint(), e = this.node.getContentSize();
this.startAxis === s.HORIZONTAL ? this._doLayoutGridAxisHorizontal(t, e) : this.startAxis === s.VERTICAL && this._doLayoutGridAxisVertical(t, e);
},
_getHorizontalBaseWidth: function(t) {
var e = 0, i = 0;
if (this.resizeMode === r.CONTAINER) {
for (var n = 0; n < t.length; ++n) {
var s = t[n];
if (s.activeInHierarchy) {
i++;
e += s.width * this._getUsedScaleValue(s.scaleX);
}
}
e += (i - 1) * this.spacingX + this.paddingLeft + this.paddingRight;
} else e = this.node.getContentSize().width;
return e;
},
_doLayout: function() {
if (this.type === n.HORIZONTAL) {
var t = this._getHorizontalBaseWidth(this.node.children);
this._doLayoutHorizontally(t, !1, (function(t) {
return t.y;
}), !0);
this.node.width = t;
} else if (this.type === n.VERTICAL) {
var e = this._getVerticalBaseHeight(this.node.children);
this._doLayoutVertically(e, !1, (function(t) {
return t.x;
}), !0);
this.node.height = e;
} else this.type === n.NONE ? this.resizeMode === r.CONTAINER && this._doLayoutBasic() : this.type === n.GRID && this._doLayoutGrid();
},
_getUsedScaleValue: function(t) {
return this.affectedByScale ? Math.abs(t) : 1;
},
updateLayout: function() {
if (this._layoutDirty && this.node.children.length > 0) {
this._doLayout();
this._layoutDirty = !1;
}
}
});
cc.Layout = e.exports = c;
}), {
"../CCNode": 72,
"./CCComponent": 149
} ],
155: [ (function(t, e) {
"use strict";
var i = o(t("../../renderer/gfx")), n = o(t("../value-types/mat4")), r = o(t("../value-types/vec2")), s = o(t("../assets/material/material-variant"));
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
var a = t("../utils/misc"), c = t("./CCRenderComponent"), l = t("../renderer/render-flow"), u = t("../graphics/graphics"), h = new r.default(), _ = new n.default(), f = [];
function d(t, e, i) {
f.length = 0;
for (var n = 2 * Math.PI / i, r = 0; r < i; ++r) f.push(cc.v2(e.x * Math.cos(n * r) + t.x, e.y * Math.sin(n * r) + t.y));
return f;
}
var p = cc.Enum({
RECT: 0,
ELLIPSE: 1,
IMAGE_STENCIL: 2
}), m = cc.Class({
name: "cc.Mask",
extends: c,
editor: !1,
ctor: function() {
this._graphics = null;
this._enableMaterial = null;
this._exitMaterial = null;
this._clearMaterial = null;
},
properties: {
_spriteFrame: {
default: null,
type: cc.SpriteFrame
},
_type: p.RECT,
type: {
get: function() {
return this._type;
},
set: function(t) {
this._type !== t && this._resetAssembler();
this._type = t;
if (this._type !== p.IMAGE_STENCIL) {
this.spriteFrame = null;
this.alphaThreshold = 0;
this._updateGraphics();
}
this._activateMaterial();
},
type: p,
tooltip: !1
},
spriteFrame: {
type: cc.SpriteFrame,
tooltip: !1,
get: function() {
return this._spriteFrame;
},
set: function(t) {
var e = this._spriteFrame;
if (e !== t) {
e && e.off("load", this.setVertsDirty, this);
this._spriteFrame = t;
this.setVertsDirty();
this._updateMaterial();
}
}
},
alphaThreshold: {
default: .1,
type: cc.Float,
range: [ 0, 1, .1 ],
slide: !0,
tooltip: !1,
notify: function() {
cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS ? this._updateMaterial() : cc.warnID(4201);
}
},
inverted: {
default: !1,
type: cc.Boolean,
tooltip: !1,
notify: function() {
cc.game.renderType === cc.game.RENDER_TYPE_CANVAS && cc.warnID(4202);
}
},
_segments: 64,
segements: {
get: function() {
return this._segments;
},
set: function(t) {
this._segments = a.clampf(t, 3, 1e4);
this._updateGraphics();
},
type: cc.Integer,
tooltip: !1
},
_resizeToTarget: {
animatable: !1,
set: function(t) {
t && this._resizeNodeToTargetNode();
}
}
},
statics: {
Type: p
},
onRestore: function() {
this._activateMaterial();
},
onEnable: function() {
this._super();
this._type !== p.IMAGE_STENCIL ? this._updateGraphics() : this._spriteFrame && this._spriteFrame.once("load", this.setVertsDirty, this);
this.node.on(cc.Node.EventType.POSITION_CHANGED, this._updateGraphics, this);
this.node.on(cc.Node.EventType.ROTATION_CHANGED, this._updateGraphics, this);
this.node.on(cc.Node.EventType.SCALE_CHANGED, this._updateGraphics, this);
this.node.on(cc.Node.EventType.SIZE_CHANGED, this._updateGraphics, this);
this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._updateGraphics, this);
},
onDisable: function() {
this._super();
this.node.off(cc.Node.EventType.POSITION_CHANGED, this._updateGraphics, this);
this.node.off(cc.Node.EventType.ROTATION_CHANGED, this._updateGraphics, this);
this.node.off(cc.Node.EventType.SCALE_CHANGED, this._updateGraphics, this);
this.node.off(cc.Node.EventType.SIZE_CHANGED, this._updateGraphics, this);
this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._updateGraphics, this);
this.node._renderFlag &= ~l.FLAG_POST_RENDER;
},
onDestroy: function() {
this._super();
this._removeGraphics();
this._spriteFrame && this._spriteFrame.off("load", this.setVertsDirty, this);
},
_resizeNodeToTargetNode: !1,
_validateRender: function() {
if (this._type === p.IMAGE_STENCIL) {
var t = this._spriteFrame;
t && t.textureLoaded() || this.disableRender();
}
},
_activateMaterial: function() {
this._createGraphics();
var t = this._materials[0];
(t = t ? s.default.create(t, this) : s.default.createWithBuiltin("2d-sprite", this)).define("USE_ALPHA_TEST", !0);
if (this._type === p.IMAGE_STENCIL) {
t.define("CC_USE_MODEL", !1);
t.define("USE_TEXTURE", !0);
} else {
t.define("CC_USE_MODEL", !0);
t.define("USE_TEXTURE", !1);
}
this._enableMaterial || (this._enableMaterial = s.default.createWithBuiltin("2d-sprite", this));
if (!this._exitMaterial) {
this._exitMaterial = s.default.createWithBuiltin("2d-sprite", this);
this._exitMaterial.setStencilEnabled(i.default.STENCIL_DISABLE);
}
this._clearMaterial || (this._clearMaterial = s.default.createWithBuiltin("clear-stencil", this));
this.setMaterial(0, t);
this._graphics._materials[0] = t;
this._updateMaterial();
},
_updateMaterial: function() {
var t = this._materials[0];
if (t) {
if (this._type === p.IMAGE_STENCIL && this.spriteFrame) {
var e = this.spriteFrame.getTexture();
t.setProperty("texture", e);
}
t.setProperty("alphaThreshold", this.alphaThreshold);
}
},
_createGraphics: function() {
if (!this._graphics) {
this._graphics = new u();
cc.Assembler.init(this._graphics);
this._graphics.node = this.node;
this._graphics.lineWidth = 0;
this._graphics.strokeColor = cc.color(0, 0, 0, 0);
}
},
_updateGraphics: function() {
if (this.enabledInHierarchy) {
var t = this.node, e = this._graphics;
e.clear(!1);
var i = t._contentSize.width, n = t._contentSize.height, r = -i * t._anchorPoint.x, s = -n * t._anchorPoint.y;
if (this._type === p.RECT) e.rect(r, s, i, n); else if (this._type === p.ELLIPSE) {
for (var o = d(cc.v2(r + i / 2, s + n / 2), {
x: i / 2,
y: n / 2
}, this._segments), a = 0; a < o.length; ++a) {
var c = o[a];
0 === a ? e.moveTo(c.x, c.y) : e.lineTo(c.x, c.y);
}
e.close();
}
cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? e.stroke() : e.fill();
}
},
_removeGraphics: function() {
if (this._graphics) {
this._graphics.destroy();
this._graphics._destroyImmediate();
this._graphics = null;
}
},
_hitTest: function(t) {
var e = this.node, i = e.getContentSize(), s = i.width, o = i.height, a = h;
e._updateWorldMatrix();
if (!n.default.invert(_, e._worldMatrix)) return !1;
r.default.transformMat4(a, t, _);
a.x += e._anchorPoint.x * s;
a.y += e._anchorPoint.y * o;
var c = !1;
if (this.type === p.RECT || this.type === p.IMAGE_STENCIL) c = a.x >= 0 && a.y >= 0 && a.x <= s && a.y <= o; else if (this.type === p.ELLIPSE) {
var l = s / 2, u = o / 2, f = a.x - .5 * s, d = a.y - .5 * o;
c = f * f / (l * l) + d * d / (u * u) < 1;
}
this.inverted && (c = !c);
return c;
},
markForRender: function(t) {
var e = l.FLAG_RENDER | l.FLAG_UPDATE_RENDER_DATA | l.FLAG_POST_RENDER;
if (t) {
this.node._renderFlag |= e;
this.markForValidate();
} else t || (this.node._renderFlag &= ~e);
},
disableRender: function() {
this.node._renderFlag &= ~(l.FLAG_RENDER | l.FLAG_UPDATE_RENDER_DATA | l.FLAG_POST_RENDER);
}
});
cc.Mask = e.exports = m;
}), {
"../../renderer/gfx": 363,
"../assets/material/material-variant": 131,
"../graphics/graphics": 202,
"../renderer/render-flow": 272,
"../utils/misc": 322,
"../value-types/mat4": 339,
"../value-types/vec2": 346,
"./CCRenderComponent": 160
} ],
156: [ (function(t, e) {
"use strict";
var i = t("../components/CCRenderComponent"), n = t("../../core/utils/blend-func"), r = cc.Class({
name: "cc.MotionStreak",
extends: i,
mixins: [ n ],
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) {
if (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.clone();
},
set: function(t) {
this._color.equals(t) || this._color.set(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);
n.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 = r;
}), {
"../../core/utils/blend-func": 316,
"../components/CCRenderComponent": 160
} ],
157: [ (function(t, e) {
"use strict";
var i = cc.Enum({
Unified: 0,
Free: 1
}), n = cc.Enum({
Horizontal: 0,
Vertical: 1
}), r = cc.Enum({
PAGE_TURNING: 0
}), s = 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: i.Unified,
type: i,
tooltip: !1,
notify: function() {
this._syncSizeMode();
}
},
direction: {
default: n.Horizontal,
type: n,
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: i,
Direction: n,
EventType: r
},
onEnable: function() {
this._super();
this.node.on(cc.Node.EventType.SIZE_CHANGED, this._updateAllPagesSize, this);
this.node.on("scroll-ended-with-threshold", this._dispatchPageTurningEvent, this);
},
onDisable: function() {
this._super();
this.node.off(cc.Node.EventType.SIZE_CHANGED, this._updateAllPagesSize, this);
this.node.off("scroll-ended-with-threshold", this._dispatchPageTurningEvent, this);
},
onLoad: function() {
this._initPages();
this.indicator && this.indicator.setPageView(this);
},
getCurrentPageIndex: function() {
return this._curPageIdx;
},
setCurrentPageIndex: function(t) {
this.scrollToPage(t, !0);
},
getPages: function() {
return this._pages;
},
addPage: function(t) {
if (t && -1 === this._pages.indexOf(t) && this.content) {
this.content.addChild(t);
this._pages.push(t);
this._updatePageView();
}
},
insertPage: function(t, e) {
if (!(e < 0) && t && -1 === this._pages.indexOf(t) && this.content) if (e >= this._pages.length) this.addPage(t); else {
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];
if (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 < i; e++) this.content.removeChild(t[e]);
this._pages.length = 0;
this._updatePageView();
}
},
scrollToPage: function(t, e) {
if (!(t < 0 || t >= 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 === n.Horizontal;
this.vertical = this.direction === n.Vertical;
},
_syncSizeMode: function() {
if (this.content) {
var t = this.content.getComponent(cc.Layout);
if (t) {
if (this.sizeMode === i.Free && this._pages.length > 0) {
var e = this._pages[this._pages.length - 1];
if (this.direction === n.Horizontal) {
t.paddingLeft = (this._view.width - this._pages[0].width) / 2;
t.paddingRight = (this._view.width - e.width) / 2;
} else if (this.direction === n.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;
if (this._curPageIdx >= e) {
this._curPageIdx = 0 === e ? 0 : e - 1;
this._lastPageIdx = this._curPageIdx;
}
for (var i = this._initContentPos, r = 0; r < e; ++r) {
var s = this._pages[r];
s.setSiblingIndex(r);
this.direction === n.Horizontal ? this._scrollCenterOffsetX[r] = Math.abs(i.x + s.x) : this._scrollCenterOffsetY[r] = Math.abs(i.y + s.y);
}
this.indicator && this.indicator._refresh();
},
_updateAllPagesSize: function() {
if (this.sizeMode === i.Unified && this._view) for (var t = this._pages, e = this._view.getContentSize(), n = 0, r = t.length; n < r; n++) t[n].setContentSize(e);
},
_initPages: function() {
if (this.content) {
this._initContentPos = this.content.position;
for (var t = this.content.children, e = 0; e < t.length; ++e) {
var i = t[e];
this._pages.indexOf(i) >= 0 || this._pages.push(i);
}
this._syncScrollDirection();
this._syncSizeMode();
this._updatePageView();
}
},
_dispatchPageTurningEvent: function() {
if (this._lastPageIdx !== this._curPageIdx) {
this._lastPageIdx = this._curPageIdx;
cc.Component.EventHandler.emitEvents(this.pageEvents, this, r.PAGE_TURNING);
this.node.emit("page-turning", this);
}
},
_isScrollable: function(t, e, r) {
if (this.sizeMode === i.Free) {
var s, o;
if (this.direction === n.Horizontal) {
s = this._scrollCenterOffsetX[e];
o = this._scrollCenterOffsetX[r];
return Math.abs(t.x) >= Math.abs(s - o) * this.scrollThreshold;
}
if (this.direction === n.Vertical) {
s = this._scrollCenterOffsetY[e];
o = this._scrollCenterOffsetY[r];
return Math.abs(t.y) >= Math.abs(s - o) * this.scrollThreshold;
}
} else {
if (this.direction === n.Horizontal) return Math.abs(t.x) >= this._view.width * this.scrollThreshold;
if (this.direction === n.Vertical) return Math.abs(t.y) >= this._view.height * this.scrollThreshold;
}
},
_isQuicklyScrollable: function(t) {
if (this.direction === n.Horizontal) {
if (Math.abs(t.x) > this.autoPageTurningThreshold) return !0;
} else if (this.direction === n.Vertical && Math.abs(t.y) > this.autoPageTurningThreshold) return !0;
return !1;
},
_moveOffsetValue: function(t) {
var e = cc.v2(0, 0);
this.sizeMode === i.Free ? this.direction === n.Horizontal ? e.x = this._scrollCenterOffsetX[t] : this.direction === n.Vertical && (e.y = this._scrollCenterOffsetY[t]) : this.direction === n.Horizontal ? e.x = t * this._view.width : this.direction === n.Vertical && (e.y = t * this._view.height);
return e;
},
_getDragDirection: function(t) {
return this.direction === n.Horizontal ? 0 === t.x ? 0 : t.x > 0 ? 1 : -1 : this.direction === n.Vertical ? 0 === t.y ? 0 : t.y < 0 ? 1 : -1 : void 0;
},
_handleReleaseLogic: function() {
this._autoScrollToPage();
if (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 < this._pages.length) {
if (this._isScrollable(e, i, n)) {
this.scrollToPage(n, r);
return;
}
var s = this._calculateTouchMoveVelocity();
if (this._isQuicklyScrollable(s)) {
this.scrollToPage(n, r);
return;
}
}
this.scrollToPage(i, r);
}
},
_onTouchBegan: function(t, e) {
this._touchBeganPosition = t.touch.getLocation();
this._super(t, e);
},
_onTouchMoved: function(t, e) {
this._super(t, e);
},
_onTouchEnded: function(t, e) {
this._touchEndPosition = t.touch.getLocation();
this._super(t, e);
},
_onTouchCancelled: function(t, e) {
this._touchEndPosition = t.touch.getLocation();
this._super(t, e);
},
_onMouseWheel: function() {}
});
cc.PageView = e.exports = s;
}), {} ],
158: [ (function(t, e) {
"use strict";
var i = cc.Enum({
HORIZONTAL: 0,
VERTICAL: 1
}), n = cc.Class({
name: "cc.PageViewIndicator",
extends: t("./CCComponent"),
editor: !1,
properties: {
_layout: null,
_pageView: null,
_indicators: [],
spriteFrame: {
default: null,
type: cc.SpriteFrame,
tooltip: !1
},
direction: {
default: i.HORIZONTAL,
type: i,
tooltip: !1
},
cellSize: {
default: cc.size(20, 20),
tooltip: !1
},
spacing: {
default: 0,
tooltip: !1
}
},
statics: {
Direction: i
},
onLoad: function() {
this._updateLayout();
},
setPageView: function(t) {
this._pageView = t;
this._refresh();
},
_updateLayout: function() {
this._layout = this.getComponent(cc.Layout);
this._layout || (this._layout = this.addComponent(cc.Layout));
if (this.direction === i.HORIZONTAL) {
this._layout.type = cc.Layout.Type.HORIZONTAL;
this._layout.spacingX = this.spacing;
} else if (this.direction === i.VERTICAL) {
this._layout.type = cc.Layout.Type.VERTICAL;
this._layout.spacingY = this.spacing;
}
this._layout.resizeMode = cc.Layout.ResizeMode.CONTAINER;
},
_createIndicator: function() {
var t = new cc.Node(), e = t.addComponent(cc.Sprite);
e.spriteFrame = this.spriteFrame;
e.sizeMode = cc.Sprite.SizeMode.CUSTOM;
t.parent = this.node;
t.width = this.cellSize.width;
t.height = this.cellSize.height;
return t;
},
_changedState: function() {
var t = this._indicators;
if (0 !== t.length) {
var e = this._pageView._curPageIdx;
if (!(e >= t.length)) {
for (var i = 0; i < t.length; ++i) t[i].opacity = 127.5;
t[e].opacity = 255;
}
}
},
_refresh: function() {
if (this._pageView) {
var t = this._indicators, e = this._pageView.getPages();
if (e.length !== t.length) {
var i = 0;
if (e.length > t.length) for (i = 0; i < e.length; ++i) t[i] || (t[i] = this._createIndicator()); else for (i = t.length - e.length; i > 0; --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 = n;
}), {
"./CCComponent": 149
} ],
159: [ (function(t, e) {
"use strict";
var i = t("../utils/misc"), n = t("./CCComponent"), r = cc.Enum({
HORIZONTAL: 0,
VERTICAL: 1,
FILLED: 2
}), s = cc.Class({
name: "cc.ProgressBar",
extends: n,
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 = r.FILLED);
var s = t.getContentSize();
this.mode === r.HORIZONTAL ? this.totalLength = s.width : this.mode === r.VERTICAL ? this.totalLength = s.height : this.totalLength = this.barSprite.fillRange;
if (t.parent === this.node) {
var o = -e.width * i.x;
t.setPosition(cc.v2(o, 0));
}
}
},
_updateBarStatus: function() {
if (this.barSprite) {
var t = this.barSprite.node;
if (!t) return;
var e, n, s, o = t.getAnchorPoint(), a = t.getContentSize(), c = t.getPosition(), l = cc.v2(0, .5), u = i.clamp01(this.progress), h = this.totalLength * u;
switch (this.mode) {
case r.HORIZONTAL:
this.reverse && (l = cc.v2(1, .5));
e = cc.size(h, a.height);
n = this.totalLength;
s = a.height;
break;

case r.VERTICAL:
l = this.reverse ? cc.v2(.5, 1) : cc.v2(.5, 0);
e = cc.size(a.width, h);
n = a.width;
s = this.totalLength;
}
if (this.mode === r.FILLED) if (this.barSprite.type !== cc.Sprite.Type.FILLED) cc.warn("ProgressBar FILLED mode only works when barSprite's Type is FILLED!"); else {
this.reverse && (h *= -1);
this.barSprite.fillRange = h;
} else if (this.barSprite.type !== cc.Sprite.Type.FILLED) {
var _ = l.x - o.x, f = l.y - o.y, d = cc.v2(n * _, s * f);
t.setPosition(c.x + d.x, c.y + d.y);
t.setAnchorPoint(l);
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: r.HORIZONTAL,
type: r,
tooltip: !1,
notify: function() {
if (this.barSprite) {
var t = this.barSprite.node;
if (!t) return;
var e = t.getContentSize();
this.mode === r.HORIZONTAL ? this.totalLength = e.width : this.mode === r.VERTICAL ? this.totalLength = e.height : this.mode === r.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 === r.FILLED && (t = i.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: r
}
});
cc.ProgressBar = e.exports = s;
}), {
"../utils/misc": 322,
"./CCComponent": 149
} ],
160: [ (function(t, e) {
"use strict";
var i = s(t("../renderer/assembler")), n = s(t("../assets/material/material-variant")), r = t("../value-types");
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
var o = t("./CCComponent"), a = t("../renderer/render-flow"), c = t("../assets/material/CCMaterial"), l = new r.Color(), u = cc.Class({
name: "RenderComponent",
extends: o,
editor: !1,
properties: {
_materials: {
default: [],
type: c
},
materials: {
get: function() {
return this._materials;
},
set: function(t) {
this._materials = t;
this._activateMaterial();
},
type: [ c ],
displayName: "Materials",
animatable: !1
}
},
ctor: function() {
this._vertsDirty = !0;
this._assembler = null;
},
_resetAssembler: function() {
i.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 |= a.FLAG_OPACITY_COLOR;
this.setVertsDirty();
},
onDisable: function() {
this.node._renderComponent = null;
this.disableRender();
},
onDestroy: function() {
for (var t = this._materials, e = 0; e < t.length; e++) cc.pool.material.put(t[e]);
t.length = 0;
cc.pool.assembler.put(this._assembler);
},
setVertsDirty: function() {
this._vertsDirty = !0;
this.markForRender(!0);
},
_on3DNodeChanged: function() {
this._resetAssembler();
},
_validateRender: function() {},
markForValidate: function() {
cc.RenderFlow.registerValidate(this);
},
markForRender: function(t) {
var e = a.FLAG_RENDER | a.FLAG_UPDATE_RENDER_DATA;
if (t) {
this.node._renderFlag |= e;
this.markForValidate();
} else this.node._renderFlag &= ~e;
},
disableRender: function() {
this.node._renderFlag &= ~(a.FLAG_RENDER | a.FLAG_UPDATE_RENDER_DATA);
},
getMaterial: function(t) {
if (t < 0 || t >= this._materials.length) return null;
var e = this._materials[t];
if (!e) return null;
var i = n.default.create(e, this);
i !== e && this.setMaterial(t, i);
return i;
},
getMaterials: function() {
for (var t = this._materials, e = 0; e < t.length; e++) t[e] = n.default.create(t[e], this);
return t;
},
setMaterial: function(t, e) {
if (e !== this._materials[t]) {
e = n.default.create(e, this);
this._materials[t] = e;
}
this._updateMaterial();
this.markForRender(!0);
return e;
},
_getDefaultMaterial: function() {
return c.getBuiltinMaterial("2d-sprite");
},
_activateMaterial: function() {
var t = this._materials;
if (!t[0]) {
var e = this._getDefaultMaterial();
t[0] = e;
}
for (var i = 0; i < t.length; i++) t[i] = n.default.create(t[i], this);
this._updateMaterial();
},
_updateMaterial: function() {},
_updateColor: function() {
if (this._assembler.updateColor) {
var t = this.srcBlendFactor === cc.macro.BlendFactor.ONE;
t && r.Color.premultiplyAlpha(l, this.node._color);
var e = t ? l._val : null;
this._assembler.updateColor(this, e);
}
},
_checkBacth: function(t, e) {
var i = this._materials[0];
if (i && i.getHash() !== t.material.getHash() || t.cullingMask !== e) {
t._flush();
t.node = i.getDefine("CC_USE_MODEL") ? this.node : t._dummyNode;
t.material = i;
t.cullingMask = e;
}
}
});
cc.RenderComponent = e.exports = u;
}), {
"../assets/material/CCMaterial": 124,
"../assets/material/material-variant": 131,
"../renderer/assembler": 268,
"../renderer/render-flow": 272,
"../value-types": 337,
"./CCComponent": 149
} ],
161: [ (function(t, e) {
"use strict";
var i = t("../platform/js"), n = t("../platform/CCMacro"), r = t("../utils/text-utils"), s = new (t("../utils/html-text-parser"))(), o = n.TextAlignment, a = n.VerticalTextAlignment, c = cc.Label.CacheMode, l = new i.Pool(function(t) {
if (!cc.isValid(t)) return !1;
var e = t.getComponent(cc.LabelOutline);
e && (e.width = 0);
return !0;
}, 20);
l.get = function() {
var t = this._get();
t || ((t = new cc.PrivateNode("RICHTEXT_CHILD"))._objFlags |= cc.Object.Flags.DontSave);
t.setPosition(0, 0);
t.setAnchorPoint(.5, .5);
t.skewX = 0;
var e = t.getComponent(cc.Label);
e || (e = t.addComponent(cc.Label));
e.string = "";
e.horizontalAlign = o.LEFT;
e.verticalAlign = a.CENTER;
e._forceUseCanvas = !0;
return t;
};
var u = cc.Class({
name: "cc.RichText",
extends: cc.Component,
ctor: function() {
this._textArray = null;
this._labelSegments = [];
this._labelSegmentsCache = [];
this._linesWidth = [];
this._updateRichTextStatus = this._updateRichText;
},
editor: !1,
properties: {
string: {
default: "<color=#00ff00>Rich</c><color=#0fffff>Text</color>",
multiline: !0,
tooltip: !1,
notify: function() {
this._updateRichTextStatus();
}
},
horizontalAlign: {
default: o.LEFT,
type: o,
tooltip: !1,
animatable: !1,
notify: function(t) {
if (this.horizontalAlign !== t) {
this._layoutDirty = !0;
this._updateRichTextStatus();
}
}
},
fontSize: {
default: 40,
tooltip: !1,
notify: function(t) {
if (this.fontSize !== t) {
this._layoutDirty = !0;
this._updateRichTextStatus();
}
}
},
_fontFamily: "Arial",
fontFamily: {
tooltip: !1,
get: function() {
return this._fontFamily;
},
set: function(t) {
if (this._fontFamily !== t) {
this._fontFamily = t;
this._layoutDirty = !0;
this._updateRichTextStatus();
}
},
animatable: !1
},
font: {
default: null,
type: cc.TTFFont,
tooltip: !1,
notify: function(t) {
if (this.font !== t) {
this._layoutDirty = !0;
if (this.font) {
this.useSystemFont = !1;
this._onTTFLoaded();
} else this.useSystemFont = !0;
this._updateRichTextStatus();
}
}
},
_isSystemFontUsed: !0,
useSystemFont: {
get: function() {
return this._isSystemFontUsed;
},
set: function(t) {
if (this._isSystemFontUsed !== t) {
this._isSystemFontUsed = t;
this._layoutDirty = !0;
this._updateRichTextStatus();
}
},
animatable: !1,
tooltip: !1
},
cacheMode: {
default: c.NONE,
type: c,
tooltip: !1,
notify: function(t) {
this.cacheMode !== t && this._updateRichTextStatus();
},
animatable: !1
},
maxWidth: {
default: 0,
tooltip: !1,
notify: function(t) {
if (this.maxWidth !== t) {
this._layoutDirty = !0;
this._updateRichTextStatus();
}
}
},
lineHeight: {
default: 40,
tooltip: !1,
notify: function(t) {
if (this.lineHeight !== t) {
this._layoutDirty = !0;
this._updateRichTextStatus();
}
}
},
imageAtlas: {
default: null,
type: cc.SpriteAtlas,
tooltip: !1,
notify: function(t) {
if (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: a
},
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 l.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.assetManager.postLoadNative(this.font, (function() {
t._layoutDirty = !0;
t._updateRichText();
}));
} else {
this._layoutDirty = !0;
this._updateRichText();
}
},
_measureText: function(t, e) {
var i = this, n = function(e) {
var n;
if (0 === i._labelSegmentsCache.length) {
n = i._createFontLabel(e);
i._labelSegmentsCache.push(n);
} else n = i._labelSegmentsCache[0];
n._styleIndex = t;
i._applyTextAttribute(n, e, !0);
return 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, o = r._clickParam;
if (s && e._containsTouchLocation(r, t.touch.getLocation())) {
i.forEach((function(e) {
e.enabledInHierarchy && e[s] && e[s](t, o);
}));
t.stopPropagation();
}
}, r = 0; r < this._labelSegments.length; ++r) n(r);
},
_containsTouchLocation: function(t, e) {
return t.getBoundingBoxToWorld().contains(e);
},
_resetState: function() {
for (var t = this.node.children, e = t.length - 1; e >= 0; e--) {
var i = t[e];
if ("RICHTEXT_CHILD" === i.name || "RICHTEXT_Image_CHILD" === i.name) {
i.parent === this.node ? i.parent = null : t.splice(e, 1);
"RICHTEXT_CHILD" === i.name && l.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;
(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);
return i;
},
_updateRichTextWithMaxWidth: function(t, e, i) {
var n = e;
if (this._lineOffsetX > 0 && n + this._lineOffsetX > this.maxWidth) for (var s = 0; this._lineOffsetX <= this.maxWidth; ) {
var o = this._getFirstWordLen(t, s, t.length), a = t.substr(s, o), c = this._measureText(i, a);
if (!(this._lineOffsetX + c <= this.maxWidth)) {
if (s > 0) {
var l = t.substr(0, s);
this._addLabelSegment(l, i);
t = t.substr(s, t.length);
n = this._measureText(i, t);
}
this._updateLineInfo();
break;
}
this._lineOffsetX += c;
s += o;
}
if (n > this.maxWidth) for (var u = r.fragmentText(t, n, this.maxWidth, this._measureText(i)), h = 0; h < u.length; ++h) {
var _ = u[h], f = this._addLabelSegment(_, i).getContentSize();
this._lineOffsetX += f.width;
u.length > 1 && h < u.length - 1 && this._updateLineInfo();
} else {
this._lineOffsetX += n;
this._addLabelSegment(t, i);
}
},
_isLastComponentCR: function(t) {
return t.length - 1 === t.lastIndexOf("\n");
},
_updateLineInfo: function() {
this._linesWidth.push(this._lineOffsetX);
this._lineOffsetX = 0;
this._lineCount++;
},
_needsUpdateTextLayout: function(t) {
if (this._layoutDirty || !this._textArray || !t) return !0;
if (this._textArray.length !== t.length) return !0;
for (var e = 0; e < this._textArray.length; ++e) {
var i = this._textArray[e], n = t[e];
if (i.text !== n.text) return !0;
var r = i.style, s = n.style;
if (r) {
if (s) {
if (!r.outline != !s.outline) return !0;
if (r.size !== s.size || !r.italic != !s.italic || r.isImage !== s.isImage) return !0;
if (r.src !== s.src || r.imageAlign !== s.imageAlign || r.imageHeight !== s.imageHeight || r.imageWidth !== s.imageWidth || r.imageOffset !== s.imageOffset) return !0;
} else if (r.size || r.italic || r.isImage || r.outline) return !0;
} else if (s && (s.size || s.italic || s.isImage || s.outline)) return !0;
}
return !1;
},
_addRichTextImageElement: function(t) {
var e = t.style.src, i = this.imageAtlas.getSpriteFrame(e);
if (i) {
var n = new cc.PrivateNode("RICHTEXT_Image_CHILD");
n._objFlags |= cc.Object.Flags.DontSave;
var r = n.addComponent(cc.Sprite);
switch (t.style.imageAlign) {
case "top":
n.setAnchorPoint(0, 1);
break;

case "center":
n.setAnchorPoint(0, .5);
break;

default:
n.setAnchorPoint(0, 0);
}
t.style.imageOffset && (n._imageOffset = t.style.imageOffset);
r.type = cc.Sprite.Type.SLICED;
r.sizeMode = cc.Sprite.SizeMode.CUSTOM;
this.node.addChild(n);
this._labelSegments.push(n);
var s = i.getRect(), o = 1, a = s.width, c = s.height, l = t.style.imageWidth, u = t.style.imageHeight;
if (u > 0) {
a *= o = u / c;
c *= o;
} else {
a *= o = this.lineHeight / c;
c *= o;
}
l > 0 && (a = l);
if (this.maxWidth > 0) {
this._lineOffsetX + a > this.maxWidth && this._updateLineInfo();
this._lineOffsetX += a;
} else {
this._lineOffsetX += a;
this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX);
}
r.spriteFrame = i;
n.setContentSize(a, c);
n._lineCount = this._lineCount;
if (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 = "";
} else n._clickHandler = null;
} else cc.warnID(4400);
},
_updateRichText: function() {
if (this.enabledInHierarchy) {
var t = s.parse(this.string);
if (this._needsUpdateTextLayout(t)) {
this._textArray = t;
this._resetState();
for (var e, i = !1, n = 0; n < this._textArray.length; ++n) {
var o = this._textArray[n], a = o.text;
if ("" === a) {
if (o.style && o.style.newline) {
this._updateLineInfo();
continue;
}
if (o.style && o.style.isImage && this.imageAtlas) {
this._addRichTextImageElement(o);
continue;
}
}
for (var c = a.split("\n"), l = 0; l < c.length; ++l) {
var u = c[l];
if ("" !== u) {
i = !1;
if (this.maxWidth > 0) {
var h = this._measureText(n, u);
this._updateRichTextWithMaxWidth(u, h, n);
c.length > 1 && l < c.length - 1 && this._updateLineInfo();
} else {
e = this._addLabelSegment(u, n).getContentSize();
this._lineOffsetX += e.width;
this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX);
c.length > 1 && l < c.length - 1 && this._updateLineInfo();
}
} else {
if (this._isLastComponentCR(a) && l === c.length - 1) continue;
this._updateLineInfo();
i = !0;
}
}
}
i || this._linesWidth.push(this._lineOffsetX);
this.maxWidth > 0 && (this._labelWidth = this.maxWidth);
this._labelHeight = (this._lineCount + r.BASELINE_RATIO) * this.lineHeight;
this.node.setContentSize(this._labelWidth, this._labelHeight);
this._updateRichTextPosition();
this._layoutDirty = !1;
} else {
this._textArray = t;
this._updateLabelSegmentTextAttributes();
}
}
},
_getFirstWordLen: function(t, e, i) {
var n = t.charAt(e);
if (r.isUnicodeCJK(n) || r.isUnicodeSpace(n)) return 1;
for (var s = 1, o = e + 1; o < i; ++o) {
n = t.charAt(o);
if (r.isUnicodeSpace(n) || r.isUnicodeCJK(n)) break;
s++;
}
return s;
},
_updateRichTextPosition: function() {
for (var t = 0, e = 1, i = this._lineCount, n = 0; n < this._labelSegments.length; ++n) {
var s = this._labelSegments[n], a = s._lineCount;
if (a > e) {
t = 0;
e = a;
}
var c = 0;
switch (this.horizontalAlign) {
case o.LEFT:
c = -this._labelWidth / 2;
break;

case o.CENTER:
c = -this._linesWidth[a - 1] / 2;
break;

case o.RIGHT:
c = this._labelWidth / 2 - this._linesWidth[a - 1];
}
s.x = t + c;
var l = s.getContentSize();
s.y = this.lineHeight * (i - a) - this._labelHeight / 2;
a === e && (t += l.width);
if (s.getComponent(cc.Sprite)) {
var u = this.lineHeight, h = this.lineHeight * (1 + r.BASELINE_RATIO);
switch (s.anchorY) {
case 1:
s.y += u + (h - u) / 2;
break;

case .5:
s.y += h / 2;
break;

default:
s.y += (h - u) / 2;
}
if (s._imageOffset) {
var _ = s._imageOffset.split(",");
if (1 === _.length && _[0]) {
var f = parseFloat(_[0]);
Number.isInteger(f) && (s.y += f);
} else if (2 === _.length) {
var d = parseFloat(_[0]), p = parseFloat(_[1]);
Number.isInteger(d) && (s.x += d);
Number.isInteger(p) && (s.y += p);
}
}
}
var m = s.getComponent(cc.LabelOutline);
m && m.width && (s.y = s.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;
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;
if (s && s.outline) {
var o = t.getComponent(cc.LabelOutline);
o || (o = t.addComponent(cc.LabelOutline));
o.color = this._convertLiteralColorValue(s.outline.color);
o.width = s.outline.width;
}
s && s.size ? n.fontSize = s.size : n.fontSize = this.fontSize;
if (null !== e) {
"string" != typeof e && (e = "" + e);
n.string = e;
}
i && n._forceUpdateRenderData();
if (s && s.event) {
s.event.click && (t._clickHandler = s.event.click);
s.event.param ? t._clickParam = s.event.param : t._clickParam = "";
} else t._clickHandler = null;
}
},
onDestroy: function() {
for (var t = 0; t < this._labelSegments.length; ++t) {
this._labelSegments[t].removeFromParent();
l.put(this._labelSegments[t]);
}
}
});
cc.RichText = e.exports = u;
}), {
"../platform/CCMacro": 244,
"../platform/js": 260,
"../utils/html-text-parser": 320,
"../utils/text-utils": 329
} ],
162: [ (function(t, e) {
"use strict";
var i = t("./CCWidget"), n = t("../base-ui/CCWidgetManager"), r = cc.Class({
name: "cc.SafeArea",
extends: t("./CCComponent"),
editor: !1,
onEnable: function() {
this.updateArea();
cc.view.on("canvas-resize", this.updateArea, this);
},
onDisable: function() {
cc.view.off("canvas-resize", this.updateArea, this);
},
updateArea: function() {
var t = this.node.getComponent(i);
if (t) {
t.updateAlignment();
var e = this.node.position, r = this.node.getAnchorPoint();
t.isAlignTop = t.isAlignBottom = t.isAlignLeft = t.isAlignRight = !0;
var s = cc.winSize.width, o = cc.winSize.height, a = cc.sys.getSafeAreaRect();
t.top = o - a.y - a.height;
t.bottom = a.y;
t.left = a.x;
t.right = s - a.x - a.width;
t.updateAlignment();
var c = this.node.position, l = r.x - (c.x - e.x) / this.node.width, u = r.y - (c.y - e.y) / this.node.height;
this.node.setAnchorPoint(l, u);
n.add(t);
}
}
});
cc.SafeArea = e.exports = r;
}), {
"../base-ui/CCWidgetManager": 133,
"./CCComponent": 149,
"./CCWidget": 172
} ],
163: [ (function(t, e) {
"use strict";
var i = t("../utils/misc"), n = (t("./CCComponent"), cc.Enum({
HORIZONTAL: 0,
VERTICAL: 1
})), r = cc.Class({
name: "cc.Scrollbar",
extends: t("./CCComponent"),
editor: !1,
properties: {
_scrollView: null,
_touching: !1,
_autoHideRemainingTime: {
default: 0,
serializable: !1
},
_opacity: 255,
handle: {
default: null,
type: cc.Sprite,
tooltip: !1,
notify: function() {
this._onScroll(cc.v2(0, 0));
},
animatable: !1
},
direction: {
default: n.HORIZONTAL,
type: n,
tooltip: !1,
notify: function() {
this._onScroll(cc.v2(0, 0));
},
animatable: !1
},
enableAutoHide: {
default: !0,
animatable: !1,
tooltip: !1
},
autoHideTime: {
default: 1,
animatable: !1,
tooltip: !1
}
},
statics: {
Direction: n
},
setTargetScrollView: function(t) {
this._scrollView = t;
},
_convertToScrollViewSpace: function(t) {
var e = this._scrollView.node, i = t.convertToWorldSpaceAR(cc.v2(-t.anchorX * t.width, -t.anchorY * t.height)), n = e.convertToNodeSpaceAR(i);
n.x += e.anchorX * e.width;
n.y += e.anchorY * e.height;
return n;
},
_setOpacity: function(t) {
if (this.handle) {
this.node.opacity = t;
this.handle.node.opacity = t;
}
},
_onScroll: function(t) {
if (this._scrollView) {
var e = this._scrollView.content;
if (e) {
var i = e.getContentSize(), r = this._scrollView.node.getContentSize(), s = this.node.getContentSize();
if (this._conditionalDisableScrollBar(i, r)) return;
if (this.enableAutoHide) {
this._autoHideRemainingTime = this.autoHideTime;
this._setOpacity(this._opacity);
}
var o = 0, a = 0, c = 0, l = 0, u = 0;
if (this.direction === n.HORIZONTAL) {
o = i.width;
a = r.width;
u = s.width;
c = t.x;
l = -this._convertToScrollViewSpace(e).x;
} else if (this.direction === n.VERTICAL) {
o = i.height;
a = r.height;
u = s.height;
c = t.y;
l = -this._convertToScrollViewSpace(e).y;
}
var h = this._calculateLength(o, a, u, c), _ = this._calculatePosition(o, a, u, l, c, h);
this._updateLength(h);
this._updateHanlderPosition(_);
}
}
},
_updateHanlderPosition: function(t) {
if (this.handle) {
var e = this._fixupHandlerPosition();
this.handle.node.setPosition(t.x + e.x, t.y + e.y);
}
},
_fixupHandlerPosition: function() {
var t = this.node.getContentSize(), e = this.node.getAnchorPoint(), i = this.handle.node.getContentSize(), r = this.handle.node.parent, s = this.node.convertToWorldSpaceAR(cc.v2(-t.width * e.x, -t.height * e.y)), o = r.convertToNodeSpaceAR(s);
this.direction === n.HORIZONTAL ? o = cc.v2(o.x, o.y + (t.height - i.height) / 2) : this.direction === n.VERTICAL && (o = cc.v2(o.x + (t.width - i.width) / 2, o.y));
this.handle.node.setPosition(o);
return o;
},
_onTouchBegan: function() {
this.enableAutoHide && (this._touching = !0);
},
_conditionalDisableScrollBar: function(t, e) {
return t.width <= e.width && this.direction === n.HORIZONTAL || t.height <= e.height && this.direction === n.VERTICAL;
},
_onTouchEnded: function() {
if (this.enableAutoHide) {
this._touching = !1;
if (!(this.autoHideTime <= 0)) {
if (this._scrollView) {
var t = this._scrollView.content;
if (t) {
var e = t.getContentSize(), i = this._scrollView.node.getContentSize();
if (this._conditionalDisableScrollBar(e, i)) return;
}
}
this._autoHideRemainingTime = this.autoHideTime;
}
}
},
_calculateLength: function(t, e, i, n) {
var r = t;
n && (r += 20 * (n > 0 ? n : -n));
return i * (e / r);
},
_calculatePosition: function(t, e, r, s, o, a) {
var c = t - e;
o && (c += Math.abs(o));
var l = 0;
if (c) {
l = s / c;
l = i.clamp01(l);
}
var u = (r - a) * l;
return this.direction === n.VERTICAL ? cc.v2(0, u) : cc.v2(u, 0);
},
_updateLength: function(t) {
if (this.handle) {
var e = this.handle.node, i = e.getContentSize();
e.setAnchorPoint(cc.v2(0, 0));
this.direction === n.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;
if (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 = r;
}), {
"../utils/misc": 322,
"./CCComponent": 149
} ],
164: [ (function(t, e) {
"use strict";
var i = t("../CCNode").EventType, n = cc.v2(), r = cc.v2(), s = function() {
return new Date().getMilliseconds();
}, o = 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
}), a = {
"scroll-to-top": o.SCROLL_TO_TOP,
"scroll-to-bottom": o.SCROLL_TO_BOTTOM,
"scroll-to-left": o.SCROLL_TO_LEFT,
"scroll-to-right": o.SCROLL_TO_RIGHT,
scrolling: o.SCROLLING,
"bounce-bottom": o.BOUNCE_BOTTOM,
"bounce-left": o.BOUNCE_LEFT,
"bounce-right": o.BOUNCE_RIGHT,
"bounce-top": o.BOUNCE_TOP,
"scroll-ended": o.SCROLL_ENDED,
"touch-up": o.TOUCH_UP,
"scroll-ended-with-threshold": o.AUTOSCROLL_ENDED_WITH_THRESHOLD,
"scroll-began": o.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() {
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() {
if (this.horizontalScrollBar) {
this.horizontalScrollBar.setTargetScrollView(this);
this._updateScrollBar(0);
}
},
animatable: !1
},
verticalScrollBar: {
default: void 0,
type: cc.Scrollbar,
tooltip: !1,
notify: function() {
if (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: o
},
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;
i = i >= 0 ? i : 0;
n = n >= 0 ? n : 0;
return 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) {
if (!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;
cc.sys.os === cc.sys.OS_WINDOWS && cc.sys.browserType === cc.sys.BROWSER_TYPE_FIREFOX && (n = -.1 / 3);
n = -7;
this.vertical ? i = cc.v2(0, t.getScrollY() * n) : this.horizontal && (i = cc.v2(t.getScrollY() * n, 0));
this._mouseWheelEventElapsedTime = 0;
this._processDeltaMove(i);
if (!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)) {
this._mouseWheelEventElapsedTime += t;
if (this._mouseWheelEventElapsedTime > .1) {
this._onScrollBarTouchEnded();
this.unschedule(this._checkMouseWheel);
this._dispatchEvent("scroll-ended");
this._stopMouseWheel = !1;
}
} else {
this._processInertiaScroll();
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(), o = this._getContentBottomBoundary() - this._bottomBoundary;
o = -o;
var a = this._getContentLeftBoundary() - this._leftBoundary;
a = -a;
var c = cc.v2(0, 0), l = 0;
if (i) {
l = s.width - r.width;
c.x = a - l * e.x;
}
if (n) {
l = s.height - r.height;
c.y = o - l * e.y;
}
return c;
},
_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;
if (e.height < t.height) {
r = e.height - t.height;
n.y = i - r;
}
if (e.width < t.width) {
r = e.width - t.width;
n.x = s;
}
this._updateScrollBarState();
this._moveContent(n);
this._adjustContentOutOfBoundary();
},
_calculateBoundary: function() {
if (this.content) {
var t = this.content.getComponent(cc.Layout);
t && t.enabledInHierarchy && t.updateLayout();
var e = this._view.getContentSize(), i = e.width * this._view.anchorX, n = e.height * this._view.anchorY;
this._leftBoundary = -i;
this._bottomBoundary = -n;
this._rightBoundary = this._leftBoundary + e.width;
this._topBoundary = this._bottomBoundary + e.height;
this._moveContentToTopLeft(e);
}
},
hasNestedViewGroup: function(t, e) {
if (t.eventPhase === cc.Event.CAPTURING_PHASE) {
if (e) for (var i = 0; i < e.length; ++i) {
var n = e[i];
if (this.node === n) return !!t.target.getComponent(cc.ViewGroup);
if (n.getComponent(cc.ViewGroup)) return !0;
}
return !1;
}
},
_stopPropagationIfTargetIsMe: function(t) {
t.eventPhase === cc.Event.AT_TARGET && t.target === this.node && t.stopPropagation();
},
_onTouchBegan: function(t, e) {
if (this.enabledInHierarchy && !this.hasNestedViewGroup(t, e)) {
var i = t.touch;
this.content && this._handlePressLogic(i);
this._touchMoved = !1;
this._stopPropagationIfTargetIsMe(t);
}
},
_onTouchMoved: function(t, e) {
if (this.enabledInHierarchy && !this.hasNestedViewGroup(t, e)) {
var i = t.touch;
this.content && this._handleMoveLogic(i);
if (this.cancelInnerEvents) {
if (i.getLocation().sub(i.getStartLocation()).mag() > 7 && !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) {
this.node.convertToNodeSpaceAR(t.getLocation(), n);
this.node.convertToNodeSpaceAR(t.getPreviousLocation(), r);
return n.sub(r);
},
_handleMoveLogic: function(t) {
var e = this._getLocalAxisAlignDelta(t);
this._processDeltaMove(e);
},
_scrollChildren: function(t) {
var e, i = t = this._clampDelta(t);
if (this.elastic) {
e = this._getHowMuchOutOfBoundary();
i.x *= 0 === e.x ? 1 : .5;
i.y *= 0 === e.y ? 1 : .5;
}
if (!this.elastic) {
e = this._getHowMuchOutOfBoundary(i);
i = i.add(e);
}
var n = -1;
i.y > 0 ? this.content.y - this.content.anchorY * this.content.height + i.y >= this._bottomBoundary && (n = "scroll-to-bottom") : i.y < 0 && this.content.y - this.content.anchorY * this.content.height + this.content.height + i.y <= this._topBoundary && (n = "scroll-to-top");
i.x < 0 ? this.content.x - this.content.anchorX * this.content.width + this.content.width + i.x <= this._rightBoundary && (n = "scroll-to-right") : i.x > 0 && this.content.x - this.content.anchorX * this.content.width + i.x >= this._leftBoundary && (n = "scroll-to-left");
this._moveContent(i, !1);
if (0 !== i.x || 0 !== i.y) {
if (!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 = s();
this._touchMoveDisplacements.length = 0;
this._touchMoveTimeDeltas.length = 0;
this._onScrollBarTouchBegan();
},
_clampDelta: function(t) {
var e = this.content.getContentSize(), i = this._view.getContentSize();
e.width < i.width && (t.x = 0);
e.height < i.height && (t.y = 0);
return t;
},
_gatherTouchMove: function(t) {
t = this._clampDelta(t);
for (;this._touchMoveDisplacements.length >= 5; ) {
this._touchMoveDisplacements.shift();
this._touchMoveTimeDeltas.shift();
}
this._touchMoveDisplacements.push(t);
var e = s();
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);
this._startAutoScroll(t, e, !0);
if (!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;
}
return !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();
if (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) {
this._autoScrollCurrentlyOutOfBoundary = !0;
this._autoScrollBraking = !0;
this._autoScrollBrakingStartPosition = this.getContentPosition();
return !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, r = Math.min(1, this._autoScrollAccumulatedTime / this._autoScrollTotalTime);
this._autoScrollAttenuate && (r = (n = r, (n -= 1) * n * n * n * n + 1));
var s = this._autoScrollStartPosition.add(this._autoScrollTargetDelta.mul(r)), o = Math.abs(r - 1) <= 1e-4;
if (Math.abs(r - 1) <= this.getScrollEndedEventTiming() && !this._isScrollEndedWithThresholdEventFired) {
this._dispatchEvent("scroll-ended-with-threshold");
this._isScrollEndedWithThresholdEventFired = !0;
}
if (this.elastic) {
var a = s.sub(this._autoScrollBrakingStartPosition);
e && (a = a.mul(i));
s = this._autoScrollBrakingStartPosition.add(a);
} else {
var c = s.sub(this.getContentPosition()), l = this._getHowMuchOutOfBoundary(c);
if (!l.fuzzyEquals(cc.v2(0, 0), 1e-4)) {
s = s.add(l);
o = !0;
}
}
o && (this._autoScrolling = !1);
var u = s.sub(this.getContentPosition());
this._moveContent(this._clampDelta(u), o);
this._dispatchEvent("scrolling");
if (!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(), o = r.width - s.width, a = r.height - s.height, c = this._calculateAttenuatedFactor(o), l = this._calculateAttenuatedFactor(a);
n = cc.v2(n.x * o * (1 - this.brake) * c, n.y * a * l * (1 - this.brake));
var u = t.mag(), h = n.mag() / u;
n = n.add(t);
if (this.brake > 0 && h > 7) {
h = Math.sqrt(h);
n = t.mul(h).add(t);
}
this.brake > 0 && h > 3 && (i *= h = 3);
0 === this.brake && h > 1 && (i *= h);
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);
e = this._touchMoveDisplacements.reduce((function(t, e) {
return t.add(e);
}), e);
return cc.v2(e.x * (1 - this.brake) / t, e.y * (1 - this.brake) / t);
},
_flattenVectorByDirection: function(t) {
var e = t;
e.x = this.horizontal ? e.x : 0;
e.y = this.vertical ? e.y : 0;
return 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);
this._getContentLeftBoundary() + t.x > this._leftBoundary ? e.x = this._leftBoundary - (this._getContentLeftBoundary() + t.x) : this._getContentRightBoundary() + t.x < this._rightBoundary && (e.x = this._rightBoundary - (this._getContentRightBoundary() + t.x));
this._getContentTopBoundary() + t.y < this._topBoundary ? e.y = this._topBoundary - (this._getContentTopBoundary() + t.y) : this._getContentBottomBoundary() + t.y > this._bottomBoundary && (e.y = this._bottomBoundary - (this._getContentBottomBoundary() + t.y));
if (t.fuzzyEquals(cc.v2(0, 0), 1e-4)) {
this._outOfBoundaryAmount = e;
this._outOfBoundaryAmountDirty = !1;
}
return this._clampDelta(e);
},
_updateScrollBarState: function() {
if (this.content) {
var t = this.content.getContentSize(), e = this._view.getContentSize();
this.verticalScrollBar && (t.height < e.height ? this.verticalScrollBar.hide() : this.verticalScrollBar.show());
this.horizontalScrollBar && (t.width < e.width ? this.horizontalScrollBar.hide() : this.horizontalScrollBar.show());
}
},
_updateScrollBar: function(t) {
this.horizontalScrollBar && this.horizontalScrollBar._onScroll(t);
this.verticalScrollBar && this.verticalScrollBar._onScroll(t);
},
_onScrollBarTouchBegan: function() {
this.horizontalScrollBar && this.horizontalScrollBar._onTouchBegan();
this.verticalScrollBar && this.verticalScrollBar._onTouchBegan();
},
_onScrollBarTouchEnded: function() {
this.horizontalScrollBar && this.horizontalScrollBar._onTouchEnded();
this.verticalScrollBar && this.verticalScrollBar._onTouchEnded();
},
_dispatchEvent: function(t) {
if ("scroll-ended" === t) this._scrollEventEmitMask = 0; else if ("scroll-to-top" === t || "scroll-to-bottom" === t || "scroll-to-left" === t || "scroll-to-right" === t) {
var e = 1 << a[t];
if (this._scrollEventEmitMask & e) return;
this._scrollEventEmitMask |= e;
}
cc.Component.EventHandler.emitEvents(this.scrollEvents, this, a[t]);
this.node.emit(t, this);
},
_adjustContentOutOfBoundary: function() {
this._outOfBoundaryAmountDirty = !0;
if (this._isOutOfBoundary()) {
var t = this._getHowMuchOutOfBoundary(cc.v2(0, 0)), e = this.getContentPosition().add(t);
if (this.content) {
this.content.setPosition(e);
this._updateScrollBar(0);
}
}
},
start: function() {
this._calculateBoundary();
this.content && cc.director.once(cc.Director.EVENT_BEFORE_DRAW, this._adjustContentOutOfBoundary, this);
},
_hideScrollbar: function() {
this.horizontalScrollBar && this.horizontalScrollBar.hide();
this.verticalScrollBar && this.verticalScrollBar.hide();
},
onDisable: function() {
this._unregisterEvent();
if (this.content) {
this.content.off(i.SIZE_CHANGED, this._calculateBoundary, this);
this.content.off(i.SCALE_CHANGED, this._calculateBoundary, this);
if (this._view) {
this._view.off(i.POSITION_CHANGED, this._calculateBoundary, this);
this._view.off(i.SCALE_CHANGED, this._calculateBoundary, this);
this._view.off(i.SIZE_CHANGED, this._calculateBoundary, this);
}
}
this._hideScrollbar();
this.stopAutoScroll();
},
onEnable: function() {
this._registerEvent();
if (this.content) {
this.content.on(i.SIZE_CHANGED, this._calculateBoundary, this);
this.content.on(i.SCALE_CHANGED, this._calculateBoundary, this);
if (this._view) {
this._view.on(i.POSITION_CHANGED, this._calculateBoundary, this);
this._view.on(i.SCALE_CHANGED, this._calculateBoundary, this);
this._view.on(i.SIZE_CHANGED, this._calculateBoundary, this);
}
}
this._updateScrollBarState();
},
update: function(t) {
this._autoScrolling && this._processAutoScrolling(t);
}
});
cc.ScrollView = e.exports = c;
}), {
"../CCNode": 72,
"./CCViewGroup": 171
} ],
165: [ (function(t, e) {
"use strict";
var i = t("../utils/misc"), n = t("./CCComponent"), r = cc.Enum({
Horizontal: 0,
Vertical: 1
}), s = cc.Class({
name: "cc.Slider",
extends: n,
editor: !1,
ctor: function() {
this._offset = cc.v2();
this._touchHandle = !1;
this._dragging = !1;
},
properties: {
handle: {
default: null,
type: cc.Button,
tooltip: !1,
notify: function() {}
},
direction: {
default: r.Horizontal,
type: r,
tooltip: !1
},
progress: {
default: .5,
type: cc.Float,
range: [ 0, 1, .1 ],
slide: !0,
tooltip: !1,
notify: function() {
this._updateHandlePosition();
}
},
slideEvents: {
default: [],
type: cc.Component.EventHandler,
tooltip: !1
}
},
statics: {
Direction: r
},
__preload: function() {
this._updateHandlePosition();
},
onEnable: function() {
this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this);
this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this);
this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this);
this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this);
if (this.handle && this.handle.isValid) {
this.handle.node.on(cc.Node.EventType.TOUCH_START, this._onHandleDragStart, this);
this.handle.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this);
this.handle.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this);
}
},
onDisable: function() {
this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this);
this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this);
this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this);
this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this);
if (this.handle && this.handle.isValid) {
this.handle.node.off(cc.Node.EventType.TOUCH_START, this._onHandleDragStart, this);
this.handle.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this);
this.handle.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this);
}
},
_onHandleDragStart: function(t) {
this._dragging = !0;
this._touchHandle = !0;
this._offset = this.handle.node.convertToNodeSpaceAR(t.touch.getLocation());
t.stopPropagation();
},
_onTouchBegan: function(t) {
if (this.handle) {
this._dragging = !0;
this._touchHandle || this._handleSliderLogic(t.touch);
t.stopPropagation();
}
},
_onTouchMoved: function(t) {
if (this._dragging) {
this._handleSliderLogic(t.touch);
t.stopPropagation();
}
},
_onTouchEnded: function(t) {
this._dragging = !1;
this._touchHandle = !1;
this._offset = cc.v2();
t.stopPropagation();
},
_onTouchCancelled: function(t) {
this._dragging = !1;
t.stopPropagation();
},
_handleSliderLogic: function(t) {
this._updateProgress(t);
this._emitSlideEvent();
},
_emitSlideEvent: function() {
cc.Component.EventHandler.emitEvents(this.slideEvents, this);
this.node.emit("slide", this);
},
_updateProgress: function(t) {
if (this.handle) {
var e = this.node, n = e.convertToNodeSpaceAR(t.getLocation());
this.direction === r.Horizontal ? this.progress = i.clamp01((n.x - this._offset.x + e.anchorX * e.width) / e.width) : this.progress = i.clamp01((n.y - this._offset.y + e.anchorY * e.height) / e.height);
}
},
_updateHandlePosition: function() {
if (this.handle) {
var t;
t = this.direction === r.Horizontal ? cc.v2(-this.node.width * this.node.anchorX + this.progress * this.node.width, 0) : cc.v2(0, -this.node.height * this.node.anchorY + this.progress * this.node.height);
var e = this.node.convertToWorldSpaceAR(t);
this.handle.node.position = this.handle.node.parent.convertToNodeSpaceAR(e);
}
}
});
cc.Slider = e.exports = s;
}), {
"../utils/misc": 322,
"./CCComponent": 149
} ],
166: [ (function(t, e) {
"use strict";
var i = t("../utils/misc"), n = (t("../CCNode").EventType, t("./CCRenderComponent")), r = t("../utils/blend-func"), s = cc.Enum({
SIMPLE: 0,
SLICED: 1,
TILED: 2,
FILLED: 3,
MESH: 4
}), o = cc.Enum({
HORIZONTAL: 0,
VERTICAL: 1,
RADIAL: 2
}), a = cc.Enum({
CUSTOM: 0,
TRIMMED: 1,
RAW: 2
}), c = cc.Enum({
NORMAL: 0,
GRAY: 1
}), l = cc.Class({
name: "cc.Sprite",
extends: n,
mixins: [ r ],
editor: !1,
properties: {
_spriteFrame: {
default: null,
type: cc.SpriteFrame
},
_type: s.SIMPLE,
_sizeMode: a.TRIMMED,
_fillType: 0,
_fillCenter: cc.v2(0, 0),
_fillStart: 0,
_fillRange: 0,
_isTrimmedMode: !0,
_atlas: {
default: null,
type: cc.SpriteAtlas,
tooltip: !1,
editorOnly: !0,
visible: !0,
animatable: !1
},
spriteFrame: {
get: function() {
return this._spriteFrame;
},
set: function(t) {
var e = this._spriteFrame;
if (e !== t) {
this._spriteFrame = t;
this._applySpriteFrame(e);
}
},
type: cc.SpriteFrame
},
type: {
get: function() {
return this._type;
},
set: function(t) {
if (this._type !== t) {
this._type = t;
this.setVertsDirty();
this._resetAssembler();
}
},
type: s,
animatable: !1,
tooltip: !1
},
fillType: {
get: function() {
return this._fillType;
},
set: function(t) {
if (t !== this._fillType) {
this._fillType = t;
this.setVertsDirty();
this._resetAssembler();
}
},
type: o,
tooltip: !1
},
fillCenter: {
get: function() {
return this._fillCenter;
},
set: function(t) {
this._fillCenter.x = t.x;
this._fillCenter.y = t.y;
this._type === s.FILLED && this.setVertsDirty();
},
tooltip: !1
},
fillStart: {
get: function() {
return this._fillStart;
},
set: function(t) {
this._fillStart = i.clampf(t, -1, 1);
this._type === s.FILLED && this.setVertsDirty();
},
tooltip: !1
},
fillRange: {
get: function() {
return this._fillRange;
},
set: function(t) {
this._fillRange = i.clampf(t, -1, 1);
this._type === s.FILLED && this.setVertsDirty();
},
tooltip: !1
},
trim: {
get: function() {
return this._isTrimmedMode;
},
set: function(t) {
if (this._isTrimmedMode !== t) {
this._isTrimmedMode = t;
this._type !== s.SIMPLE && this._type !== s.MESH || this.setVertsDirty();
}
},
animatable: !1,
tooltip: !1
},
sizeMode: {
get: function() {
return this._sizeMode;
},
set: function(t) {
this._sizeMode = t;
t !== a.CUSTOM && this._applySpriteSize();
},
animatable: !1,
type: a,
tooltip: !1
}
},
statics: {
FillType: o,
Type: s,
SizeMode: a,
State: c
},
setVisible: function(t) {
this.enabled = t;
},
setState: function() {},
getState: function() {},
__preload: function() {
this._super();
this._applySpriteFrame();
},
onEnable: function() {
this._super();
this._spriteFrame && this._spriteFrame.ensureLoadTexture();
this.node.on(cc.Node.EventType.SIZE_CHANGED, this.setVertsDirty, this);
this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this.setVertsDirty, this);
},
onDisable: function() {
this._super();
this.node.off(cc.Node.EventType.SIZE_CHANGED, this.setVertsDirty, this);
this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this.setVertsDirty, this);
},
_updateMaterial: function() {
var t = null;
this._spriteFrame && (t = this._spriteFrame.getTexture());
var e = this.getMaterial(0);
if (e) {
var i = e.getDefine("USE_TEXTURE");
void 0 === i || i || e.define("USE_TEXTURE", !0);
var n = t && t.getImpl();
e.getProperty("texture") !== n && e.setProperty("texture", t);
}
r.prototype._updateMaterial.call(this);
},
_applyAtlas: !1,
_validateRender: function() {
var t = this._spriteFrame;
this._materials[0] && t && t.textureLoaded() || this.disableRender();
},
_applySpriteSize: function() {
if (this._spriteFrame && this.isValid) {
if (a.RAW === this._sizeMode) {
var t = this._spriteFrame._originalSize;
this.node.setContentSize(t);
} else if (a.TRIMMED === this._sizeMode) {
var e = this._spriteFrame._rect;
this.node.setContentSize(e.width, e.height);
}
this.setVertsDirty();
}
},
_applySpriteFrame: function(t) {
if (this.isValid) {
var e = t && t.getTexture();
e && !e.loaded && t.off("load", this._applySpriteSize, this);
var i = this._spriteFrame, n = i && i.getTexture();
e !== n && this._updateMaterial();
if (n && n.loaded) this._applySpriteSize(); else {
this.disableRender();
i && i.once("load", this._applySpriteSize, this);
}
}
}
});
cc.Sprite = e.exports = l;
}), {
"../CCNode": 72,
"../utils/blend-func": 316,
"../utils/misc": 322,
"./CCRenderComponent": 160
} ],
167: [ (function(t, e) {
"use strict";
var i = cc.Enum({
NONE: 0,
CHECKBOX: 1,
TEXT_ATLAS: 2,
SLIDER_BAR: 3,
LIST_VIEW: 4,
PAGE_VIEW: 5
}), n = cc.Enum({
VERTICAL: 0,
HORIZONTAL: 1
}), r = cc.Enum({
TOP: 0,
CENTER: 1,
BOTTOM: 2
}), s = cc.Enum({
LEFT: 0,
CENTER: 1,
RIGHT: 2
}), o = cc.Class({
name: "cc.StudioComponent",
extends: cc.Component,
editor: !1,
properties: !1,
statics: {
ComponentType: i,
ListDirection: n,
VerticalAlign: r,
HorizontalAlign: s
}
});
cc.StudioComponent = e.exports = o;
var a = cc.Class({
name: "cc.StudioWidget",
extends: cc.Widget,
editor: !1,
_validateTargetInDEV: function() {}
});
cc.StudioWidget = e.exports = a;
}), {} ],
168: [ (function(t, e) {
"use strict";
var i = t("../utils/gray-sprite-state"), n = cc.Class({
name: "cc.Toggle",
extends: t("./CCButton"),
mixins: [ i ],
editor: !1,
properties: {
_N$isChecked: !0,
isChecked: {
get: function() {
return this._N$isChecked;
},
set: function(t) {
if (t !== this._N$isChecked) {
var e = this.toggleGroup || this._toggleContainer;
if (!(e && e.enabled && this._N$isChecked) || e.allowSwitchOff) {
this._N$isChecked = t;
this._updateCheckMark();
e && e.enabled && e.updateToggles(this);
cc.Toggle._triggerEventInScript_isChecked && this._emitToggleEvents();
}
}
},
tooltip: !1
},
toggleGroup: {
default: null,
tooltip: !1,
type: t("./CCToggleGroup")
},
checkMark: {
default: null,
type: cc.Sprite,
tooltip: !1
},
checkEvents: {
default: [],
type: cc.Component.EventHandler
},
_resizeToTarget: {
animatable: !1,
set: function(t) {
t && this._resizeNodeToTargetNode();
}
}
},
statics: {
_triggerEventInScript_check: !1,
_triggerEventInScript_isChecked: !1
},
onEnable: function() {
this._super();
this._registerToggleEvent();
this.toggleGroup && this.toggleGroup.enabledInHierarchy && this.toggleGroup.addToggle(this);
},
onDisable: function() {
this._super();
this._unregisterToggleEvent();
this.toggleGroup && this.toggleGroup.enabledInHierarchy && this.toggleGroup.removeToggle(this);
},
_hideCheckMark: function() {
this._N$isChecked = !1;
this._updateCheckMark();
},
toggle: function(t) {
this.isChecked = !this.isChecked;
cc.Toggle._triggerEventInScript_isChecked || !cc.Toggle._triggerEventInScript_check && !t || this._emitToggleEvents();
},
check: function() {
this.isChecked = !0;
!cc.Toggle._triggerEventInScript_isChecked && cc.Toggle._triggerEventInScript_check && this._emitToggleEvents();
},
uncheck: function() {
this.isChecked = !1;
!cc.Toggle._triggerEventInScript_isChecked && cc.Toggle._triggerEventInScript_check && this._emitToggleEvents();
},
_updateCheckMark: function() {
this.checkMark && (this.checkMark.node.active = !!this.isChecked);
},
_updateDisabledState: function() {
this._super();
if (this.enableAutoGrayEffect && this.checkMark) {
var t = !this.interactable;
this._switchGrayMaterial(t, this.checkMark);
}
},
_registerToggleEvent: function() {
this.node.on("click", this.toggle, this);
},
_unregisterToggleEvent: function() {
this.node.off("click", this.toggle, this);
},
_emitToggleEvents: function() {
this.node.emit("toggle", this);
this.checkEvents && cc.Component.EventHandler.emitEvents(this.checkEvents, this);
}
});
cc.Toggle = e.exports = n;
t("../platform/js").get(n.prototype, "_toggleContainer", (function() {
var t = this.node.parent;
return cc.Node.isNode(t) ? t.getComponent(cc.ToggleContainer) : null;
}));
}), {
"../platform/js": 260,
"../utils/gray-sprite-state": 319,
"./CCButton": 147,
"./CCToggleGroup": 170
} ],
169: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.ToggleContainer",
extends: cc.Component,
editor: !1,
properties: {
allowSwitchOff: {
tooltip: !1,
default: !1
},
checkEvents: {
default: [],
type: cc.Component.EventHandler
}
},
updateToggles: function(t) {
if (this.enabledInHierarchy && t.isChecked) {
this.toggleItems.forEach((function(e) {
e !== t && e.isChecked && e.enabled && e._hideCheckMark();
}));
this.checkEvents && cc.Component.EventHandler.emitEvents(this.checkEvents, t);
}
},
_allowOnlyOneToggleChecked: function() {
var t = !1;
this.toggleItems.forEach((function(e) {
t ? e._hideCheckMark() : e.isChecked && (t = !0);
}));
return t;
},
_makeAtLeastOneToggleChecked: function() {
if (!this._allowOnlyOneToggleChecked() && !this.allowSwitchOff) {
var t = this.toggleItems;
t.length > 0 && t[0].check();
}
},
onEnable: function() {
this._makeAtLeastOneToggleChecked();
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);
}
});
t("../platform/js").get(i.prototype, "toggleItems", (function() {
return this.node._children.map((function(t) {
return t.getComponent(cc.Toggle);
})).filter(Boolean);
}));
cc.ToggleContainer = e.exports = i;
}), {
"../platform/js": 260
} ],
170: [ (function(t, e) {
"use strict";
var i = 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;
this._toggleItems.forEach((function(e) {
t && e.enabled && e._hideCheckMark();
e.isChecked && e.enabled && (t = !0);
}));
return t;
},
_makeAtLeastOneToggleChecked: function() {
this._allowOnlyOneToggleChecked() || this.allowSwitchOff || this._toggleItems.length > 0 && (this._toggleItems[0].isChecked = !0);
},
start: function() {
this._makeAtLeastOneToggleChecked();
}
}), n = t("../platform/js"), r = !1;
n.get(cc, "ToggleGroup", (function() {
if (!r) {
cc.errorID(1405, "cc.ToggleGroup", "cc.ToggleContainer");
r = !0;
}
return i;
}));
e.exports = i;
}), {
"../platform/js": 260
} ],
171: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.ViewGroup",
extends: t("./CCComponent")
});
cc.ViewGroup = e.exports = i;
}), {
"./CCComponent": 149
} ],
172: [ (function(t, e) {
"use strict";
var i = t("../base-ui/CCWidgetManager"), n = i.AlignMode, r = i._AlignFlags, s = r.TOP, o = r.MID, a = r.BOT, c = r.LEFT, l = r.CENTER, u = r.RIGHT, h = s | a, _ = c | u, f = 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 & s) > 0;
},
set: function(t) {
this._setAlign(s, t);
},
animatable: !1,
tooltip: !1
},
isAlignVerticalCenter: {
get: function() {
return (this._alignFlags & o) > 0;
},
set: function(t) {
if (t) {
this.isAlignTop = !1;
this.isAlignBottom = !1;
this._alignFlags |= o;
} else this._alignFlags &= ~o;
},
animatable: !1,
tooltip: !1
},
isAlignBottom: {
get: function() {
return (this._alignFlags & a) > 0;
},
set: function(t) {
this._setAlign(a, t);
},
animatable: !1,
tooltip: !1
},
isAlignLeft: {
get: function() {
return (this._alignFlags & c) > 0;
},
set: function(t) {
this._setAlign(c, t);
},
animatable: !1,
tooltip: !1
},
isAlignHorizontalCenter: {
get: function() {
return (this._alignFlags & l) > 0;
},
set: function(t) {
if (t) {
this.isAlignLeft = !1;
this.isAlignRight = !1;
this._alignFlags |= l;
} else this._alignFlags &= ~l;
},
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 & _) === _;
},
visible: !1
},
isStretchHeight: {
get: function() {
return (this._alignFlags & h) === h;
},
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: n.ON_WINDOW_RESIZE,
type: n,
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: n
},
onLoad: function() {
if (void 0 !== this._wasAlignOnce) {
this.alignMode = this._wasAlignOnce ? n.ONCE : n.ALWAYS;
this._wasAlignOnce = void 0;
}
},
onEnable: function() {
i.add(this);
},
onDisable: function() {
i.remove(this);
},
_validateTargetInDEV: !1,
_setAlign: function(t, e) {
if (e !== (this._alignFlags & t) > 0) {
var i = (t & _) > 0;
if (e) {
this._alignFlags |= t;
if (i) {
this.isAlignHorizontalCenter = !1;
this.isStretchWidth && (this._originalWidth = this.node.width);
} else {
this.isAlignVerticalCenter = !1;
this.isStretchHeight && (this._originalHeight = this.node.height);
}
} else {
i ? this.isStretchWidth && (this.node.width = this._originalWidth) : this.isStretchHeight && (this.node.height = this._originalHeight);
this._alignFlags &= ~t;
}
}
},
updateAlignment: function() {
i.updateAlignment(this.node);
}
});
Object.defineProperty(f.prototype, "isAlignOnce", {
get: function() {
return this.alignMode === n.ONCE;
},
set: function(t) {
this.alignMode = t ? n.ONCE : n.ALWAYS;
}
});
cc.Widget = e.exports = f;
}), {
"../base-ui/CCWidgetManager": 133,
"./CCComponent": 149
} ],
173: [ (function(t, e) {
"use strict";
var i = t("../../platform/CCMacro"), n = t("../editbox/EditBoxImplBase"), r = t("../CCLabel"), s = t("./types"), o = s.InputMode, a = s.InputFlag, c = s.KeyboardReturnType;
function l(t) {
return t.charAt(0).toUpperCase() + t.slice(1);
}
var u = cc.Class({
name: "cc.EditBox",
extends: cc.Component,
editor: !1,
properties: {
_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: r,
notify: function(t) {
if (this.textLabel && this.textLabel !== t) {
this._updateTextLabel();
this._updateLabels();
}
}
},
placeholderLabel: {
tooltip: !1,
default: null,
type: r,
notify: function(t) {
if (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: c.DEFAULT,
tooltip: !1,
displayName: "KeyboardReturnType",
type: c
},
_N$returnType: {
default: void 0,
type: cc.Float
},
inputFlag: {
tooltip: !1,
default: a.DEFAULT,
type: a,
notify: function() {
this._updateString(this._string);
}
},
inputMode: {
tooltip: !1,
default: o.ANY,
type: o,
notify: function(t) {
if (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) {
if (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) {
if (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) {
if (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: n,
KeyboardReturnType: c,
InputFlag: a,
InputMode: o
},
_init: function() {
this._upgradeComp();
this._isLabelVisible = !0;
this.node.on(cc.Node.EventType.SIZE_CHANGED, this._syncSize, this);
(this._impl = new u._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;
if (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(r)) || (t = e.addComponent(r));
e.parent = this.node;
this.textLabel = t;
}
t.node.setAnchorPoint(0, 1);
t.overflow = r.Overflow.CLAMP;
if (this.inputMode === o.ANY) {
t.verticalAlign = i.VerticalTextAlignment.TOP;
t.enableWrapText = !0;
} else {
t.verticalAlign = i.VerticalTextAlignment.CENTER;
t.enableWrapText = !1;
}
t.string = this._updateLabelStringStyle(this._string);
if (void 0 !== this._N$fontColor) {
t.node.color = this._N$fontColor;
t.node.opacity = this._N$fontColor.a;
this._N$fontColor = void 0;
}
if (void 0 !== this._N$fontSize) {
t.fontSize = this._N$fontSize;
this._N$fontSize = void 0;
}
if (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(r)) || (t = e.addComponent(r));
e.parent = this.node;
this.placeholderLabel = t;
}
t.node.setAnchorPoint(0, 1);
t.overflow = r.Overflow.CLAMP;
if (this.inputMode === o.ANY) {
t.verticalAlign = i.VerticalTextAlignment.TOP;
t.enableWrapText = !0;
} else {
t.verticalAlign = i.VerticalTextAlignment.CENTER;
t.enableWrapText = !1;
}
t.string = this.placeholder;
if (void 0 !== this._N$placeholderFontColor) {
t.node.color = this._N$placeholderFontColor;
t.node.opacity = this._N$placeholderFontColor.a;
this._N$placeholderFontColor = void 0;
}
if (void 0 !== this._N$placeholderFontSize) {
t.fontSize = this._N$placeholderFontSize;
this._N$placeholderFontSize = void 0;
}
},
_upgradeComp: function() {
if (void 0 !== this._N$returnType) {
this.returnType = this._N$returnType;
this._N$returnType = void 0;
}
if (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();
if (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 !== a.PASSWORD) i === a.INITIAL_CAPS_ALL_CHARACTERS ? t = t.toUpperCase() : i === a.INITIAL_CAPS_WORD ? t = t.replace(/(?:^|\s)\S/g, (function(t) {
return t.toUpperCase();
})) : i === a.INITIAL_CAPS_SENTENCE && (t = l(t)); else {
for (var n = "", r = t.length, s = 0; s < r; ++s) n += "●";
t = n;
}
return t;
},
editBoxEditingDidBegan: function() {
cc.Component.EventHandler.emitEvents(this.editingDidBegan, this);
this.node.emit("editing-did-began", this);
},
editBoxEditingDidEnded: function() {
cc.Component.EventHandler.emitEvents(this.editingDidEnded, this);
this.node.emit("editing-did-ended", this);
},
editBoxTextChanged: function(t) {
t = this._updateLabelStringStyle(t, !0);
this.string = t;
cc.Component.EventHandler.emitEvents(this.textChanged, t, this);
this.node.emit("text-changed", this);
},
editBoxEditingReturn: function() {
cc.Component.EventHandler.emitEvents(this.editingReturn, this);
this.node.emit("editing-return", this);
},
onEnable: function() {
this._registerEvent();
this._impl && this._impl.enable();
},
onDisable: function() {
this._unregisterEvent();
this._impl && this._impl.disable();
},
onDestroy: function() {
this._impl && this._impl.clear();
},
__preload: function() {
this._init();
},
_registerEvent: function() {
this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this);
this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this);
},
_unregisterEvent: function() {
this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this);
this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this);
},
_onTouchBegan: function(t) {
t.stopPropagation();
},
_onTouchCancel: function(t) {
t.stopPropagation();
},
_onTouchEnded: function(t) {
this._impl && this._impl.beginEditing();
t.stopPropagation();
},
setFocus: function() {
cc.errorID(1400, "setFocus()", "focus()");
this._impl && this._impl.setFocus(!0);
},
focus: function() {
this._impl && this._impl.setFocus(!0);
},
blur: function() {
this._impl && this._impl.setFocus(!1);
},
isFocused: function() {
return !!this._impl && this._impl.isFocused();
},
update: function() {
this._impl && this._impl.update();
}
});
cc.EditBox = e.exports = u;
cc.sys.isBrowser && t("./WebEditBoxImpl");
}), {
"../../platform/CCMacro": 244,
"../CCLabel": 151,
"../editbox/EditBoxImplBase": 174,
"./WebEditBoxImpl": 175,
"./types": 177
} ],
174: [ (function(t, e) {
"use strict";
var i = cc.Class({
ctor: function() {
this._delegate = null;
this._editing = !1;
},
init: function() {},
enable: function() {},
disable: function() {
this._editing && this.endEditing();
},
clear: function() {},
update: function() {},
setTabIndex: function() {},
setSize: function() {},
setFocus: function(t) {
t ? this.beginEditing() : this.endEditing();
},
isFocused: function() {
return this._editing;
},
beginEditing: function() {},
endEditing: function() {}
});
e.exports = i;
}), {} ],
175: [ (function(t) {
"use strict";
var e, i = (e = t("../../value-types/mat4")) && e.__esModule ? e : {
default: e
}, n = t("../../platform/utils"), r = t("../../platform/CCMacro"), s = t("./types"), o = t("../CCLabel"), a = t("./tabIndexUtil"), c = cc.EditBox, l = cc.js, u = s.InputMode, h = s.InputFlag, _ = s.KeyboardReturnType, f = {
zoomInvalid: !1
};
cc.sys.OS_ANDROID !== cc.sys.os || cc.sys.browserType !== cc.sys.BROWSER_TYPE_SOUGOU && cc.sys.browserType !== cc.sys.BROWSER_TYPE_360 || (f.zoomInvalid = !0);
var d = 0, p = cc.v3(), m = null, y = !1, v = !1, g = c._ImplClass;
function b() {
g.call(this);
this._domId = "EditBoxId_" + ++d;
this._placeholderStyleSheet = null;
this._elem = null;
this._isTextArea = !1;
this._worldMat = new i.default();
this._cameraMat = new i.default();
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._cacheViewportRect = cc.rect(0, 0, 0, 0);
this._inputMode = null;
this._inputFlag = null;
this._returnType = null;
this._eventListeners = {};
this._textLabelFont = null;
this._textLabelFontSize = null;
this._textLabelFontColor = null;
this._textLabelAlign = null;
this._placeholderLabelFont = null;
this._placeholderLabelFontSize = null;
this._placeholderLabelFontColor = null;
this._placeholderLabelAlign = null;
this._placeholderLineHeight = null;
}
l.extend(b, g);
c._ImplClass = b;
Object.assign(b.prototype, {
init: function(t) {
if (t) {
this._delegate = t;
t.inputMode === u.ANY ? this._createTextArea() : this._createInput();
a.add(this);
this.setTabIndex(t.tabIndex);
this._initStyleSheet();
this._registerEventListeners();
this._addDomToGameContainer();
y = cc.view.isAutoFullScreenEnabled();
v = cc.view._resizeWithBrowserSize;
}
},
clear: function() {
this._removeEventListeners();
this._removeDomFromGameContainer();
a.remove(this);
m === this && (m = null);
},
update: function() {
this._updateMatrix();
},
setTabIndex: function(t) {
this._elem.tabIndex = t;
a.resort();
},
setSize: function(t, e) {
var i = this._elem;
i.style.width = t + "px";
i.style.height = e + "px";
},
beginEditing: function() {
m && m !== this && m.setFocus(!1);
this._editing = !0;
m = this;
this._delegate.editBoxEditingDidBegan();
this._showDom();
this._elem.focus();
},
endEditing: function() {
this._elem && this._elem.blur();
},
_createInput: function() {
this._isTextArea = !1;
this._elem = document.createElement("input");
},
_createTextArea: function() {
this._isTextArea = !0;
this._elem = document.createElement("textarea");
},
_addDomToGameContainer: function() {
cc.game.container.appendChild(this._elem);
document.head.appendChild(this._placeholderStyleSheet);
},
_removeDomFromGameContainer: function() {
n.contains(cc.game.container, this._elem) && cc.game.container.removeChild(this._elem);
n.contains(document.head, this._placeholderStyleSheet) && document.head.removeChild(this._placeholderStyleSheet);
delete this._elem;
delete this._placeholderStyleSheet;
},
_showDom: function() {
this._updateMaxLength();
this._updateInputType();
this._updateStyleSheet();
this._elem.style.display = "";
this._delegate._hideLabels();
cc.sys.isMobile && this._showDomOnMobile();
},
_hideDom: function() {
this._elem.style.display = "none";
this._delegate._showLabels();
cc.sys.isMobile && this._hideDomOnMobile();
},
_showDomOnMobile: function() {
if (cc.sys.os === cc.sys.OS_ANDROID) {
if (y) {
cc.view.enableAutoFullScreen(!1);
cc.screen.exitFullScreen();
}
v && cc.view.resizeWithBrowserSize(!1);
this._adjustWindowScroll();
}
},
_hideDomOnMobile: function() {
if (cc.sys.os === cc.sys.OS_ANDROID) {
v && cc.view.resizeWithBrowserSize(!0);
setTimeout((function() {
m || y && cc.view.enableAutoFullScreen(!0);
}), 800);
}
},
_adjustWindowScroll: function() {
var t = this;
setTimeout((function() {
window.scrollY < 100 && t._elem.scrollIntoView({
block: "start",
inline: "nearest",
behavior: "smooth"
});
}), 800);
},
_scrollBackWindow: function() {
setTimeout((function() {
var t = cc.sys;
t.browserType !== t.BROWSER_TYPE_WECHAT || t.os !== t.OS_IOS ? window.scrollTo(0, 0) : window.top && window.top.scrollTo(0, 0);
}), 800);
},
_updateCameraMatrix: function() {
var t = this._delegate.node;
t.getWorldMatrix(this._worldMat);
var e = this._worldMat, n = t._contentSize, r = t._anchorPoint;
p.x = -r.x * n.width;
p.y = -r.y * n.height;
i.default.transform(e, e, p);
var s = cc.Camera.findCamera(t);
if (!s) return !1;
s.getWorldToScreenMatrix2D(this._cameraMat);
i.default.mul(this._cameraMat, this._cameraMat, e);
return !0;
},
_updateMatrix: function() {
if (this._updateCameraMatrix()) {
var t = this._cameraMat.m, e = this._delegate.node, i = cc.view;
if (this._m00 !== t[0] || this._m01 !== t[1] || this._m04 !== t[4] || this._m05 !== t[5] || this._m12 !== t[12] || this._m13 !== t[13] || this._w !== e._contentSize.width || this._h !== e._contentSize.height || !this._cacheViewportRect.equals(i._viewportRect)) {
this._m00 = t[0];
this._m01 = t[1];
this._m04 = t[4];
this._m05 = t[5];
this._m12 = t[12];
this._m13 = t[13];
this._w = e._contentSize.width;
this._h = e._contentSize.height;
this._cacheViewportRect.set(i._viewportRect);
var n = i._scaleX, r = i._scaleY, s = i._viewportRect, o = i._devicePixelRatio;
n /= o;
r /= o;
var a = cc.game.container, c = t[0] * n, l = t[1], u = t[4], h = t[5] * r, _ = a && a.style.paddingLeft && parseInt(a.style.paddingLeft);
_ += s.x / o;
var d = a && a.style.paddingBottom && parseInt(a.style.paddingBottom);
d += s.y / o;
var p = t[12] * n + _, m = t[13] * r + d;
if (f.zoomInvalid) {
this.setSize(e.width * c, e.height * h);
c = 1;
h = 1;
}
var y = this._elem, v = "matrix(" + c + "," + -l + "," + -u + "," + h + "," + p + "," + -m + ")";
y.style.transform = v;
y.style["-webkit-transform"] = v;
y.style["transform-origin"] = "0px 100% 0px";
y.style["-webkit-transform-origin"] = "0px 100% 0px";
}
}
},
_updateInputType: function() {
var t = this._delegate, e = t.inputMode, i = t.inputFlag, n = t.returnType, r = this._elem;
if (this._inputMode !== e || this._inputFlag !== i || this._returnType !== n) {
this._inputMode = e;
this._inputFlag = i;
this._returnType = n;
if (this._isTextArea) {
var s = "none";
i === h.INITIAL_CAPS_ALL_CHARACTERS ? s = "uppercase" : i === h.INITIAL_CAPS_WORD && (s = "capitalize");
r.style.textTransform = s;
} else if (i !== h.PASSWORD) {
var o = r.type;
if (e === u.EMAIL_ADDR) o = "email"; else if (e === u.NUMERIC || e === u.DECIMAL) o = "number"; else if (e === u.PHONE_NUMBER) {
o = "number";
r.pattern = "[0-9]*";
} else if (e === u.URL) o = "url"; else {
o = "text";
n === _.SEARCH && (o = "search");
}
r.type = o;
var a = "none";
i === h.INITIAL_CAPS_ALL_CHARACTERS ? a = "uppercase" : i === h.INITIAL_CAPS_WORD && (a = "capitalize");
r.style.textTransform = a;
} else {
r.type = "password";
r.style.textTransform = "none";
}
}
},
_updateMaxLength: function() {
var t = this._delegate.maxLength;
t < 0 && (t = 65535);
this._elem.maxLength = t;
},
_initStyleSheet: function() {
var t = this._elem;
t.style.display = "none";
t.style.border = 0;
t.style.background = "transparent";
t.style.width = "100%";
t.style.height = "100%";
t.style.active = 0;
t.style.outline = "medium";
t.style.padding = "0";
t.style.textTransform = "none";
t.style.position = "absolute";
t.style.bottom = "0px";
t.style.left = "2px";
t.className = "cocosEditBox";
t.id = this._domId;
if (this._isTextArea) {
t.style.resize = "none";
t.style.overflow_y = "scroll";
} else {
t.type = "text";
t.style["-moz-appearance"] = "textfield";
}
this._placeholderStyleSheet = document.createElement("style");
},
_updateStyleSheet: function() {
var t = this._delegate, e = this._elem;
e.value = t.string;
e.placeholder = t.placeholder;
this._updateTextLabel(t.textLabel);
this._updatePlaceholderLabel(t.placeholderLabel);
},
_updateTextLabel: function(t) {
if (t) {
var e = t.font;
e = !e || e instanceof cc.BitmapFont ? t.fontFamily : e._fontFamily;
var i = t.fontSize * t.node.scaleY;
if (this._textLabelFont !== e || this._textLabelFontSize !== i || this._textLabelFontColor !== t.fontColor || this._textLabelAlign !== t.horizontalAlign) {
this._textLabelFont = e;
this._textLabelFontSize = i;
this._textLabelFontColor = t.fontColor;
this._textLabelAlign = t.horizontalAlign;
var n = this._elem;
n.style.fontSize = i + "px";
n.style.color = t.node.color.toCSS();
n.style.fontFamily = e;
switch (t.horizontalAlign) {
case o.HorizontalAlign.LEFT:
n.style.textAlign = "left";
break;

case o.HorizontalAlign.CENTER:
n.style.textAlign = "center";
break;

case o.HorizontalAlign.RIGHT:
n.style.textAlign = "right";
}
}
}
},
_updatePlaceholderLabel: function(t) {
if (t) {
var e = t.font;
e = !e || e instanceof cc.BitmapFont ? t.fontFamily : t.font._fontFamily;
var i = t.fontSize * t.node.scaleY;
if (this._placeholderLabelFont !== e || this._placeholderLabelFontSize !== i || this._placeholderLabelFontColor !== t.fontColor || this._placeholderLabelAlign !== t.horizontalAlign || this._placeholderLineHeight !== t.fontSize) {
this._placeholderLabelFont = e;
this._placeholderLabelFontSize = i;
this._placeholderLabelFontColor = t.fontColor;
this._placeholderLabelAlign = t.horizontalAlign;
this._placeholderLineHeight = t.fontSize;
var n, r = this._placeholderStyleSheet, s = t.node.color.toCSS(), a = t.fontSize;
switch (t.horizontalAlign) {
case o.HorizontalAlign.LEFT:
n = "left";
break;

case o.HorizontalAlign.CENTER:
n = "center";
break;

case o.HorizontalAlign.RIGHT:
n = "right";
}
r.innerHTML = "#" + this._domId + "::-webkit-input-placeholder,#" + this._domId + "::-moz-placeholder,#" + this._domId + ":-ms-input-placeholder{text-transform: initial; font-family: " + e + "; font-size: " + i + "px; color: " + s + "; line-height: " + a + "px; text-align: " + n + ";}";
cc.sys.browserType === cc.sys.BROWSER_TYPE_EDGE && (r.innerHTML += "#" + this._domId + "::-ms-clear{display: none;}");
}
}
},
_registerEventListeners: function() {
var t = this, e = this._elem, i = !1, n = this._eventListeners;
n.compositionStart = function() {
i = !0;
};
n.compositionEnd = function() {
i = !1;
t._delegate.editBoxTextChanged(e.value);
};
n.onInput = function() {
if (!i) {
var n = t._delegate.maxLength;
n >= 0 && (e.value = e.value.slice(0, n));
t._delegate.editBoxTextChanged(e.value);
}
};
n.onClick = function() {
t._editing && cc.sys.isMobile && t._adjustWindowScroll();
};
n.onKeydown = function(i) {
if (i.keyCode === r.KEY.enter) {
i.stopPropagation();
t._delegate.editBoxEditingReturn();
t._isTextArea || e.blur();
} else if (i.keyCode === r.KEY.tab) {
i.stopPropagation();
i.preventDefault();
a.next(t);
}
};
n.onBlur = function() {
cc.sys.isMobile && i && n.compositionEnd();
t._editing = !1;
m = null;
t._hideDom();
t._delegate.editBoxEditingDidEnded();
};
e.addEventListener("compositionstart", n.compositionStart);
e.addEventListener("compositionend", n.compositionEnd);
e.addEventListener("input", n.onInput);
e.addEventListener("keydown", n.onKeydown);
e.addEventListener("blur", n.onBlur);
e.addEventListener("touchstart", n.onClick);
},
_removeEventListeners: function() {
var t = this._elem, e = this._eventListeners;
t.removeEventListener("compositionstart", e.compositionStart);
t.removeEventListener("compositionend", e.compositionEnd);
t.removeEventListener("input", e.onInput);
t.removeEventListener("keydown", e.onKeydown);
t.removeEventListener("blur", e.onBlur);
t.removeEventListener("touchstart", e.onClick);
e.compositionStart = null;
e.compositionEnd = null;
e.onInput = null;
e.onKeydown = null;
e.onBlur = null;
e.onClick = null;
}
});
}), {
"../../platform/CCMacro": 244,
"../../platform/utils": 263,
"../../value-types/mat4": 339,
"../CCLabel": 151,
"./tabIndexUtil": 176,
"./types": 177
} ],
176: [ (function(t, e) {
"use strict";
e.exports = {
_tabIndexList: [],
add: function(t) {
var e = this._tabIndexList;
-1 === e.indexOf(t) && e.push(t);
},
remove: function(t) {
var e = this._tabIndexList, i = e.indexOf(t);
-1 !== i && e.splice(i, 1);
},
resort: function() {
this._tabIndexList.sort((function(t, e) {
return t._delegate._tabIndex - e._delegate._tabIndex;
}));
},
next: function(t) {
var e = this._tabIndexList, i = e.indexOf(t);
t.setFocus(!1);
if (-1 !== i) {
var n = e[i + 1];
n && n._delegate._tabIndex >= 0 && n.setFocus(!0);
}
}
};
}), {} ],
177: [ (function(t, e) {
"use strict";
var i = cc.Enum({
DEFAULT: 0,
DONE: 1,
SEND: 2,
SEARCH: 3,
GO: 4,
NEXT: 5
}), n = cc.Enum({
ANY: 0,
EMAIL_ADDR: 1,
NUMERIC: 2,
PHONE_NUMBER: 3,
URL: 4,
DECIMAL: 5,
SINGLE_LINE: 6
}), r = cc.Enum({
PASSWORD: 0,
SENSITIVE: 1,
INITIAL_CAPS_WORD: 2,
INITIAL_CAPS_SENTENCE: 3,
INITIAL_CAPS_ALL_CHARACTERS: 4,
DEFAULT: 5
});
e.exports = {
KeyboardReturnType: i,
InputMode: n,
InputFlag: r
};
}), {} ],
178: [ (function(t, e) {
"use strict";
t("./CCComponent");
t("./CCComponentEventHandler");
t("./missing-script");
var i = t("./SubContextView");
if (!i) {
i = cc.Class({
name: "cc.SubContextView",
extends: cc.Component
});
cc.SubContextView = cc.WXSubContextView = cc.SwanSubContextView = i;
}
var n = [ 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"), t("./CCSafeArea"), i ];
e.exports = n;
}), {
"./CCAnimation": 144,
"./CCAudioSource": 145,
"./CCBlockInputEvents": 146,
"./CCButton": 147,
"./CCCanvas": 148,
"./CCComponent": 149,
"./CCComponentEventHandler": 150,
"./CCLabel": 151,
"./CCLabelOutline": 152,
"./CCLabelShadow": 153,
"./CCLayout": 154,
"./CCMask": 155,
"./CCMotionStreak": 156,
"./CCPageView": 157,
"./CCPageViewIndicator": 158,
"./CCProgressBar": 159,
"./CCRichText": 161,
"./CCSafeArea": 162,
"./CCScrollBar": 163,
"./CCScrollView": 164,
"./CCSlider": 165,
"./CCSprite": 166,
"./CCToggle": 168,
"./CCToggleContainer": 169,
"./CCToggleGroup": 170,
"./CCWidget": 172,
"./SubContextView": void 0,
"./editbox/CCEditBox": 173,
"./missing-script": 179
} ],
179: [ (function(t, e) {
"use strict";
var i = cc.js, n = 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) {
var e = i._getClassById(t);
if (e) return e;
cc.deserialize.reportMissingClass(t);
return n;
}
},
onLoad: function() {
cc.warnID(4600, this.node.name);
}
});
cc._MissingScript = e.exports = n;
}), {} ],
180: [ (function(t, e) {
"use strict";
var i = cc.js;
t("../event/event");
var n = 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;
};
i.extend(n, cc.Event);
var r = n.prototype;
r.setScrollData = function(t, e) {
this._scrollX = t;
this._scrollY = e;
};
r.getScrollX = function() {
return this._scrollX;
};
r.getScrollY = function() {
return this._scrollY;
};
r.setLocation = function(t, e) {
this._x = t;
this._y = e;
};
r.getLocation = function() {
return cc.v2(this._x, this._y);
};
r.getLocationInView = function() {
return cc.v2(this._x, cc.view._designResolutionSize.height - this._y);
};
r._setPrevCursor = function(t, e) {
this._prevX = t;
this._prevY = e;
};
r.getPreviousLocation = function() {
return cc.v2(this._prevX, this._prevY);
};
r.getDelta = function() {
return cc.v2(this._x - this._prevX, this._y - this._prevY);
};
r.getDeltaX = function() {
return this._x - this._prevX;
};
r.getDeltaY = function() {
return this._y - this._prevY;
};
r.setButton = function(t) {
this._button = t;
};
r.getButton = function() {
return this._button;
};
r.getLocationX = function() {
return this._x;
};
r.getLocationY = function() {
return this._y;
};
n.NONE = 0;
n.DOWN = 1;
n.UP = 2;
n.MOVE = 3;
n.SCROLL = 4;
n.BUTTON_LEFT = 0;
n.BUTTON_RIGHT = 2;
n.BUTTON_MIDDLE = 1;
n.BUTTON_4 = 3;
n.BUTTON_5 = 4;
n.BUTTON_6 = 5;
n.BUTTON_7 = 6;
n.BUTTON_8 = 7;
var s = function(t, e) {
cc.Event.call(this, cc.Event.TOUCH, e);
this._eventCode = 0;
this._touches = t || [];
this.touch = null;
this.currentTouch = null;
};
i.extend(s, cc.Event);
(r = s.prototype).getEventCode = function() {
return this._eventCode;
};
r.getTouches = function() {
return this._touches;
};
r._setEventCode = function(t) {
this._eventCode = t;
};
r._setTouches = function(t) {
this._touches = t;
};
r.setLocation = function(t, e) {
this.touch && this.touch.setTouchInfo(this.touch.getID(), t, e);
};
r.getLocation = function() {
return this.touch ? this.touch.getLocation() : cc.v2();
};
r.getLocationInView = function() {
return this.touch ? this.touch.getLocationInView() : cc.v2();
};
r.getPreviousLocation = function() {
return this.touch ? this.touch.getPreviousLocation() : cc.v2();
};
r.getStartLocation = function() {
return this.touch ? this.touch.getStartLocation() : cc.v2();
};
r.getID = function() {
return this.touch ? this.touch.getID() : null;
};
r.getDelta = function() {
return this.touch ? this.touch.getDelta() : cc.v2();
};
r.getDeltaX = function() {
return this.touch ? this.touch.getDelta().x : 0;
};
r.getDeltaY = function() {
return this.touch ? this.touch.getDelta().y : 0;
};
r.getLocationX = function() {
return this.touch ? this.touch.getLocationX() : 0;
};
r.getLocationY = function() {
return this.touch ? this.touch.getLocationY() : 0;
};
s.MAX_TOUCHES = 5;
s.BEGAN = 0;
s.MOVED = 1;
s.ENDED = 2;
s.CANCELED = 3;
var o = function(t, e) {
cc.Event.call(this, cc.Event.ACCELERATION, e);
this.acc = t;
};
i.extend(o, cc.Event);
var a = function(t, e, i) {
cc.Event.call(this, cc.Event.KEYBOARD, i);
this.keyCode = t;
this.isPressed = e;
};
i.extend(a, cc.Event);
cc.Event.EventMouse = n;
cc.Event.EventTouch = s;
cc.Event.EventAcceleration = o;
cc.Event.EventKeyboard = a;
e.exports = cc.Event;
}), {
"../event/event": 187
} ],
181: [ (function(t, e) {
"use strict";
var i = 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 n = 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"
}, r = function(t, e) {
this._onCustomEvent = e;
cc.EventListener.call(this, cc.EventListener.CUSTOM, t, this._callback);
};
i.extend(r, cc.EventListener);
i.mixin(r.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 r(this._listenerID, this._onCustomEvent);
}
});
var s = function() {
cc.EventListener.call(this, cc.EventListener.MOUSE, n.MOUSE, this._callback);
};
i.extend(s, cc.EventListener);
i.mixin(s.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 s();
t.onMouseDown = this.onMouseDown;
t.onMouseUp = this.onMouseUp;
t.onMouseMove = this.onMouseMove;
t.onMouseScroll = this.onMouseScroll;
return t;
},
checkAvailable: function() {
return !0;
}
});
var o = function() {
cc.EventListener.call(this, cc.EventListener.TOUCH_ONE_BY_ONE, n.TOUCH_ONE_BY_ONE, null);
this._claimedTouches = [];
};
i.extend(o, cc.EventListener);
i.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();
t.onTouchBegan = this.onTouchBegan;
t.onTouchMoved = this.onTouchMoved;
t.onTouchEnded = this.onTouchEnded;
t.onTouchCancelled = this.onTouchCancelled;
t.swallowTouches = this.swallowTouches;
return t;
},
checkAvailable: function() {
if (!this.onTouchBegan) {
cc.logID(1801);
return !1;
}
return !0;
}
});
var a = function() {
cc.EventListener.call(this, cc.EventListener.TOUCH_ALL_AT_ONCE, n.TOUCH_ALL_AT_ONCE, null);
};
i.extend(a, cc.EventListener);
i.mixin(a.prototype, {
constructor: a,
onTouchesBegan: null,
onTouchesMoved: null,
onTouchesEnded: null,
onTouchesCancelled: null,
clone: function() {
var t = new a();
t.onTouchesBegan = this.onTouchesBegan;
t.onTouchesMoved = this.onTouchesMoved;
t.onTouchesEnded = this.onTouchesEnded;
t.onTouchesCancelled = this.onTouchesCancelled;
return t;
},
checkAvailable: function() {
if (null === this.onTouchesBegan && null === this.onTouchesMoved && null === this.onTouchesEnded && null === this.onTouchesCancelled) {
cc.logID(1802);
return !1;
}
return !0;
}
});
var c = function(t) {
this._onAccelerationEvent = t;
cc.EventListener.call(this, cc.EventListener.ACCELERATION, n.ACCELERATION, this._callback);
};
i.extend(c, cc.EventListener);
i.mixin(c.prototype, {
constructor: c,
_onAccelerationEvent: null,
_callback: function(t) {
this._onAccelerationEvent(t.acc, t);
},
checkAvailable: function() {
cc.assertID(this._onAccelerationEvent, 1803);
return !0;
},
clone: function() {
return new c(this._onAccelerationEvent);
}
});
var l = function() {
cc.EventListener.call(this, cc.EventListener.KEYBOARD, n.KEYBOARD, this._callback);
};
i.extend(l, cc.EventListener);
i.mixin(l.prototype, {
constructor: l,
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 l();
t.onKeyPressed = this.onKeyPressed;
t.onKeyReleased = this.onKeyReleased;
return t;
},
checkAvailable: function() {
if (null === this.onKeyPressed && null === this.onKeyReleased) {
cc.logID(1800);
return !1;
}
return !0;
}
});
cc.EventListener.create = function(t) {
cc.assertID(t && t.event, 1900);
var e = t.event;
delete t.event;
var i = null;
if (e === cc.EventListener.TOUCH_ONE_BY_ONE) i = new o(); else if (e === cc.EventListener.TOUCH_ALL_AT_ONCE) i = new a(); else if (e === cc.EventListener.MOUSE) i = new s(); else if (e === cc.EventListener.CUSTOM) {
i = new r(t.eventName, t.callback);
delete t.eventName;
delete t.callback;
} else if (e === cc.EventListener.KEYBOARD) i = new l(); else if (e === cc.EventListener.ACCELERATION) {
i = new c(t.callback);
delete t.callback;
}
for (var n in t) i[n] = t[n];
return i;
};
e.exports = cc.EventListener;
}), {
"../platform/js": 260
} ],
182: [ (function(t, e) {
"use strict";
var i = t("../platform/js");
t("./CCEventListener");
var n = cc.EventListener.ListenerID, r = function() {
this._fixedListeners = [];
this._sceneGraphListeners = [];
this.gt0Index = 0;
};
r.prototype = {
constructor: r,
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 s = function(t) {
var e = cc.Event, i = t.type;
if (i === e.ACCELERATION) return n.ACCELERATION;
if (i === e.KEYBOARD) return n.KEYBOARD;
if (i.startsWith(e.MOUSE)) return n.MOUSE;
i.startsWith(e.TOUCH) && cc.logID(2e3);
return "";
}, 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; i < n; i++) {
var r = e[i]._getListenerID();
null == this._dirtyListeners[r] && (this._dirtyListeners[r] = !0);
}
if (t.childrenCount > 0) for (var s = t._children, o = 0, a = s.length; o < a; o++) this._setDirtyForNode(s[o]);
},
pauseTarget: function(t, e) {
if (t instanceof cc._BaseNode) {
var i, n, r = this._nodeListenersMap[t._id];
if (r) for (i = 0, n = r.length; i < n; i++) {
var s = r[i];
s._setPaused(!0);
s._claimedTouches && s._claimedTouches.includes(this._currentTouch) && this._clearCurTouch();
}
if (!0 === e) {
var o = t._children;
for (i = 0, n = o ? o.length : 0; i < n; i++) this.pauseTarget(o[i], !0);
}
} else cc.warnID(3506);
},
resumeTarget: function(t, e) {
if (t instanceof cc._BaseNode) {
var i, n, r = this._nodeListenersMap[t._id];
if (r) for (i = 0, n = r.length; i < n; i++) r[i]._setPaused(!1);
this._setDirtyForNode(t);
if (!0 === e) {
var s = t._children;
for (i = 0, n = s ? s.length : 0; i < n; i++) this.resumeTarget(s[i], !0);
}
} else cc.warnID(3506);
},
_addListener: function(t) {
0 === this._inDispatch ? this._forceAddEventListener(t) : this._toAddedListeners.push(t);
},
_forceAddEventListener: function(t) {
var e = t._getListenerID(), i = this._listenersMap[e];
if (!i) {
i = new r();
this._listenersMap[e] = i;
}
i.push(t);
if (0 === t._getFixedPriority()) {
this._setDirty(e, this.DIRTY_SCENE_GRAPH_PRIORITY);
var n = t._getSceneGraphPriority();
null === n && cc.logID(3507);
this._associateNodeAndEventListener(n, t);
n.activeInHierarchy && this.resumeTarget(n);
} else this._setDirty(e, this.DIRTY_FIXED_PRIORITY);
},
_getListeners: function(t) {
return this._listenersMap[t];
},
_updateDirtyFlagForSceneGraph: function() {
var t = this._dirtyListeners;
for (var e in t) this._setDirty(e, this.DIRTY_SCENE_GRAPH_PRIORITY);
this._dirtyListeners = {};
},
_removeAllListenersInVector: function(t) {
if (t) for (var e, i = t.length - 1; i >= 0; i--) {
(e = t[i])._setRegistered(!1);
if (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];
if (!this._inDispatch) {
i.clear();
delete this._listenersMap[t];
}
}
var s, o = this._toAddedListeners;
for (e = o.length - 1; e >= 0; e--) (s = o[e]) && s._getListenerID() === t && cc.js.array.removeAt(o, e);
},
_sortEventListeners: function(t) {
var e = this.DIRTY_NONE, i = this._priorityDirtyFlagMap;
i[t] && (e = i[t]);
if (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, o = !1; r._parent._id !== s._parent._id; ) {
r = null === r._parent._parent ? (o = !0) && n : r._parent;
s = null === s._parent._parent ? (o = !0) && i : s._parent;
}
if (r._id === s._id) {
if (r._id === n._id) return -1;
if (r._id === i._id) return 1;
}
return o ? 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 < r && !(i[n]._getFixedPriority() >= 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(), o = this._toRemovedListeners;
if (s) for (e = s.length - 1; e >= 0; e--) if (!(i = s[e])._isRegistered()) {
cc.js.array.removeAt(s, e);
-1 !== (n = o.indexOf(i)) && o.splice(n, 1);
}
if (r) for (e = r.length - 1; e >= 0; e--) if (!(i = r[e])._isRegistered()) {
cc.js.array.removeAt(r, e);
-1 !== (n = o.indexOf(i)) && o.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) if (t[i].empty()) {
delete e[i];
delete t[i];
}
var n = this._toAddedListeners;
if (0 !== n.length) {
for (var r = 0, s = n.length; r < s; r++) this._forceAddEventListener(n[r]);
n.length = 0;
}
0 !== this._toRemovedListeners.length && this._cleanToRemovedListeners();
},
_updateTouchListeners: function() {
var t = this._inDispatch;
cc.assertID(t > 0, 3508);
if (!(t > 1)) {
var e;
(e = this._listenersMap[n.TOUCH_ONE_BY_ONE]) && this._onUpdateListeners(e);
(e = this._listenersMap[n.TOUCH_ALL_AT_ONCE]) && this._onUpdateListeners(e);
cc.assertID(1 === t, 3509);
var i = this._toAddedListeners;
if (0 !== i.length) {
for (var r = 0, s = i.length; r < s; r++) this._forceAddEventListener(i[r]);
this._toAddedListeners.length = 0;
}
0 !== this._toRemovedListeners.length && this._cleanToRemovedListeners();
}
},
_cleanToRemovedListeners: function() {
for (var t = this._toRemovedListeners, e = 0; e < t.length; e++) {
var i = t[e], n = this._listenersMap[i._getListenerID()];
if (n) {
var r, s = n.getFixedPriorityListeners(), o = n.getSceneGraphPriorityListeners();
o && -1 !== (r = o.indexOf(i)) && o.splice(r, 1);
s && -1 !== (r = s.indexOf(i)) && s.splice(r, 1);
}
}
t.length = 0;
},
_onTouchEventCallback: function(t, e) {
if (!t._isRegistered()) return !1;
var i = e.event, n = i.currentTouch;
i.currentTarget = t._node;
var r, s = !1, a = i.getEventCode(), c = cc.Event.EventTouch;
if (a === c.BEGAN) {
if (!cc.macro.ENABLE_MULTI_TOUCH && o._currentTouch) {
var l = o._currentTouchListener._node;
if (l && l.activeInHierarchy) return !1;
}
if (t.onTouchBegan && (s = t.onTouchBegan(n, i)) && t._registered) {
t._claimedTouches.push(n);
o._currentTouchListener = t;
o._currentTouch = n;
}
} else if (t._claimedTouches.length > 0 && -1 !== (r = t._claimedTouches.indexOf(n))) {
s = !0;
if (!cc.macro.ENABLE_MULTI_TOUCH && o._currentTouch && o._currentTouch !== n) return !1;
if (a === c.MOVED && t.onTouchMoved) t.onTouchMoved(n, i); else if (a === c.ENDED) {
t.onTouchEnded && t.onTouchEnded(n, i);
t._registered && t._claimedTouches.splice(r, 1);
o._clearCurTouch();
} else if (a === c.CANCELED) {
t.onTouchCancelled && t.onTouchCancelled(n, i);
t._registered && t._claimedTouches.splice(r, 1);
o._clearCurTouch();
}
}
if (i.isStopped()) {
o._updateTouchListeners(i);
return !0;
}
if (s && t.swallowTouches) {
e.needsMutableSet && e.touches.splice(n, 1);
return !0;
}
return !1;
},
_dispatchTouchEvent: function(t) {
this._sortEventListeners(n.TOUCH_ONE_BY_ONE);
this._sortEventListeners(n.TOUCH_ALL_AT_ONCE);
var e = this._getListeners(n.TOUCH_ONE_BY_ONE), i = this._getListeners(n.TOUCH_ALL_AT_ONCE);
if (null !== e || null !== i) {
var r = t.getTouches(), s = cc.js.array.copy(r), o = {
event: t,
needsMutableSet: e && i,
touches: s,
selTouch: null
};
if (e) for (var a = 0; a < r.length; a++) {
t.currentTouch = r[a];
t._propagationStopped = t._propagationImmediateStopped = !1;
this._dispatchEventToListeners(e, this._onTouchEventCallback, o);
}
if (i && s.length > 0) {
this._dispatchEventToListeners(i, this._onTouchesEventCallback, {
event: t,
touches: s
});
if (t.isStopped()) return;
}
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();
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);
if (n.isStopped()) {
o._updateTouchListeners(n);
return !0;
}
return !1;
},
_associateNodeAndEventListener: function(t, e) {
var i = this._nodeListenersMap[t._id];
if (!i) {
i = [];
this._nodeListenersMap[t._id] = i;
}
i.push(e);
},
_dissociateNodeAndEventListener: function(t, e) {
var i = this._nodeListenersMap[t._id];
if (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, o = t.getFixedPriorityListeners(), a = t.getSceneGraphPriorityListeners(), c = 0;
if (o && 0 !== o.length) for (;c < t.gt0Index; ++c) if ((r = o[c]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) {
s = !0;
break;
}
if (a && !s) for (n = 0; n < a.length; n++) if ((r = a[n]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) {
s = !0;
break;
}
if (o && !s) for (;c < o.length; ++c) if ((r = o[c]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) {
s = !0;
break;
}
},
_setDirty: function(t, e) {
var i = this._priorityDirtyFlagMap;
null == i[t] ? i[t] = e : i[t] = e | i[t];
},
_sortNumberAsc: function(t, e) {
return t - e;
},
hasEventListener: function(t) {
return !!this._getListeners(t);
},
addListener: function(t, e) {
cc.assertID(t && e, 3503);
if (cc.js.isNumber(e) || e instanceof cc._BaseNode) {
if (t instanceof cc.EventListener) {
if (t._isRegistered()) {
cc.logID(3505);
return;
}
} else {
cc.assertID(!cc.js.isNumber(e), 3504);
t = cc.EventListener.create(t);
}
if (t.checkAvailable()) {
if (cc.js.isNumber(e)) {
if (0 === e) {
cc.logID(3500);
return;
}
t._setSceneGraphPriority(null);
t._setFixedPriority(e);
t._setRegistered(!0);
t._setPaused(!1);
this._addListener(t);
} else {
t._setSceneGraphPriority(e);
t._setFixedPriority(0);
t._setRegistered(!0);
this._addListener(t);
}
return t;
}
} else cc.warnID(3506);
},
addCustomListener: function(t, e) {
var i = new cc.EventListener.create({
event: cc.EventListener.CUSTOM,
eventName: t,
callback: e
});
this.addListener(i, 1);
return i;
},
removeListener: function(t) {
if (null != t) {
var e, i = this._listenersMap;
for (var n in i) {
var r = i[n], s = r.getFixedPriorityListeners(), o = r.getSceneGraphPriorityListeners();
(e = this._removeListenerInVector(o, t)) ? this._setDirty(t._getListenerID(), this.DIRTY_SCENE_GRAPH_PRIORITY) : (e = this._removeListenerInVector(s, t)) && this._setDirty(t._getListenerID(), this.DIRTY_FIXED_PRIORITY);
if (r.empty()) {
delete this._priorityDirtyFlagMap[t._getListenerID()];
delete i[n];
}
if (e) break;
}
if (!e) for (var a = this._toAddedListeners, c = a.length - 1; c >= 0; c--) {
var l = a[c];
if (l === t) {
cc.js.array.removeAt(a, c);
l._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) {
n._setRegistered(!1);
if (null != n._getSceneGraphPriority()) {
this._dissociateNodeAndEventListener(n._getSceneGraphPriority(), n);
n._setSceneGraphPriority(null);
}
0 === this._inDispatch ? cc.js.array.removeAt(t, i) : this._toRemovedListeners.push(n);
return !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) {
n._setRegistered(!1);
if (null != n._getSceneGraphPriority()) {
this._dissociateNodeAndEventListener(n._getSceneGraphPriority(), n);
n._setSceneGraphPriority(null);
}
0 === this._inDispatch ? cc.js.array.removeAt(t, i) : this._toRemovedListeners.push(n);
return !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 r, s = i._nodeListenersMap[t._id];
if (s) {
var o = cc.js.array.copy(s);
for (r = 0; r < o.length; r++) i.removeListener(o[r]);
delete i._nodeListenersMap[t._id];
}
var a = i._toAddedListeners;
for (r = 0; r < a.length; ) {
var c = a[r];
if (c._getSceneGraphPriority() === t) {
c._setSceneGraphPriority(null);
c._setRegistered(!1);
a.splice(r, 1);
} else ++r;
}
if (!0 === e) {
var l, u = t.children;
for (r = 0, l = u.length; r < l; r++) i.removeListeners(u[r], !0);
}
} else t === cc.EventListener.TOUCH_ONE_BY_ONE ? i._removeListenersForListenerID(n.TOUCH_ONE_BY_ONE) : t === cc.EventListener.TOUCH_ALL_AT_ONCE ? i._removeListenersForListenerID(n.TOUCH_ALL_AT_ONCE) : t === cc.EventListener.MOUSE ? i._removeListenersForListenerID(n.MOUSE) : t === cc.EventListener.ACCELERATION ? i._removeListenersForListenerID(n.ACCELERATION) : t === cc.EventListener.KEYBOARD ? i._removeListenersForListenerID(n.KEYBOARD) : cc.logID(3501); else cc.warnID(3506);
},
removeCustomListeners: function(t) {
this._removeListenersForListenerID(t);
},
removeAllListeners: function() {
var t = this._listenersMap, e = this._internalCustomListenerIDs;
for (var i in t) -1 === e.indexOf(i) && this._removeListenersForListenerID(i);
},
setPriority: function(t, e) {
if (null != t) {
var i = this._listenersMap;
for (var n in i) {
var r = i[n].getFixedPriorityListeners();
if (r && -1 !== r.indexOf(t)) {
null != t._getSceneGraphPriority() && cc.logID(3502);
if (t._getFixedPriority() !== e) {
t._setFixedPriority(e);
this._setDirty(t._getListenerID(), this.DIRTY_FIXED_PRIORITY);
}
return;
}
}
}
},
setEnabled: function(t) {
this._isEnabled = t;
},
isEnabled: function() {
return this._isEnabled;
},
dispatchEvent: function(t) {
if (this._isEnabled) {
this._updateDirtyFlagForSceneGraph();
this._inDispatch++;
if (t && t.getType) if (t.getType().startsWith(cc.Event.TOUCH)) {
this._dispatchTouchEvent(t);
this._inDispatch--;
} else {
var e = s(t);
this._sortEventListeners(e);
var i = this._listenersMap[e];
if (null != i) {
this._dispatchEventToListeners(i, this._onListenerCallback, t);
this._onUpdateListeners(i);
}
this._inDispatch--;
} else cc.errorID(3511);
}
},
_onListenerCallback: function(t, e) {
e.currentTarget = t._target;
t._onEvent(e);
return e.isStopped();
},
dispatchCustomEvent: function(t, e) {
var i = new cc.Event.EventCustom(t);
i.setUserData(e);
this.dispatchEvent(i);
}
};
i.get(cc, "eventManager", (function() {
cc.errorID(1405, "cc.eventManager", "cc.EventTarget or cc.systemEvent");
return o;
}));
e.exports = cc.internal.eventManager = o;
}), {
"../platform/js": 260,
"./CCEventListener": 181
} ],
183: [ (function() {
"use strict";
cc.Touch = function(t, e, i) {
this._lastModified = 0;
this.setTouchInfo(i, t, e);
};
cc.Touch.prototype = {
constructor: cc.Touch,
getLocation: function() {
return cc.v2(this._point.x, this._point.y);
},
getLocationX: function() {
return this._point.x;
},
getLocationY: function() {
return this._point.y;
},
getPreviousLocation: function() {
return cc.v2(this._prevPoint.x, this._prevPoint.y);
},
getStartLocation: function() {
return cc.v2(this._startPoint.x, this._startPoint.y);
},
getDelta: function() {
return this._point.sub(this._prevPoint);
},
getLocationInView: function() {
return cc.v2(this._point.x, cc.view._designResolutionSize.height - this._point.y);
},
getPreviousLocationInView: function() {
return cc.v2(this._prevPoint.x, cc.view._designResolutionSize.height - this._prevPoint.y);
},
getStartLocationInView: function() {
return cc.v2(this._startPoint.x, cc.view._designResolutionSize.height - this._startPoint.y);
},
getID: function() {
return this._id;
},
setTouchInfo: function(t, e, i) {
this._prevPoint = this._point;
this._point = cc.v2(e || 0, i || 0);
this._id = t;
if (!this._startPointCaptured) {
this._startPoint = cc.v2(this._point);
cc.view._convertPointWithScale(this._startPoint);
this._startPointCaptured = !0;
}
},
_setPoint: function(t, e) {
if (void 0 === e) {
this._point.x = t.x;
this._point.y = t.y;
} else {
this._point.x = t;
this._point.y = e;
}
},
_setPrevPoint: function(t, e) {
this._prevPoint = void 0 === e ? cc.v2(t.x, t.y) : cc.v2(t || 0, e || 0);
}
};
}), {} ],
184: [ (function(t, e) {
"use strict";
t("./CCEvent");
t("./CCTouch");
t("./CCEventListener");
var i = t("./CCEventManager");
e.exports = i;
}), {
"./CCEvent": 180,
"./CCEventListener": 181,
"./CCEventManager": 182,
"./CCTouch": 183
} ],
185: [ (function(t, e) {
"use strict";
var i = cc.js, n = t("../platform/callbacks-invoker");
function r() {
n.call(this);
}
i.extend(r, n);
r.prototype.emit = function(t, e) {
var i = t.type, n = this._callbackTable[i];
if (n) {
var r = !n.isInvoking;
n.isInvoking = !0;
for (var s = n.callbackInfos, o = 0, a = s.length; o < a; ++o) {
var c = s[o];
if (c && c.callback) {
c.callback.call(c.target, t, e);
if (t._propagationImmediateStopped) break;
}
}
if (r) {
n.isInvoking = !1;
n.containCanceled && n.purgeCanceled();
}
}
};
e.exports = r;
}), {
"../platform/callbacks-invoker": 252
} ],
186: [ (function(t, e) {
"use strict";
var i = t("../platform/js"), n = t("../platform/callbacks-invoker"), r = i.array.fastRemove;
function s() {
n.call(this);
}
i.extend(s, n);
var o = s.prototype;
o.__on = o.on;
o.on = function(t, e, i, n) {
if (e) {
if (!this.hasEventListener(t, e, i)) {
this.__on(t, e, i, n);
i && i.__eventTargets && i.__eventTargets.push(this);
}
return e;
}
cc.errorID(6800);
};
o.__off = o.off;
o.off = function(t, e, i) {
if (e) {
this.__off(t, e, i);
i && i.__eventTargets && r(i.__eventTargets, this);
} else {
var n = this._callbackTable[t];
if (!n) return;
for (var s = n.callbackInfos, o = 0; o < s.length; ++o) {
var a = s[o] && s[o].target;
a && a.__eventTargets && r(a.__eventTargets, this);
}
this.removeAll(t);
}
};
o.targetOff = function(t) {
this.removeAll(t);
t && t.__eventTargets && r(t.__eventTargets, this);
};
o.once = function(t, e, i) {
this.on(t, e, i, !0);
};
o.dispatchEvent = function(t) {
this.emit(t.type, t);
};
o.clear = function() {
for (var t in this._callbackTable) for (var e = this._callbackTable[t].callbackInfos, i = e.length - 1; i >= 0; i--) {
var n = e[i];
n && this.off(t, n.callback, n.target);
}
};
cc.EventTarget = e.exports = s;
}), {
"../platform/callbacks-invoker": 252,
"../platform/js": 260
} ],
187: [ (function(t, e) {
"use strict";
var i = t("../platform/js");
cc.Event = function(t, e) {
this.type = t;
this.bubbles = !!e;
this.target = null;
this.currentTarget = null;
this.eventPhase = 0;
this._propagationStopped = !1;
this._propagationImmediateStopped = !1;
};
cc.Event.prototype = {
constructor: cc.Event,
unuse: function() {
this.type = cc.Event.NO_TYPE;
this.target = null;
this.currentTarget = null;
this.eventPhase = cc.Event.NONE;
this._propagationStopped = !1;
this._propagationImmediateStopped = !1;
},
reuse: function(t, e) {
this.type = t;
this.bubbles = e || !1;
},
stopPropagation: function() {
this._propagationStopped = !0;
},
stopPropagationImmediate: function() {
this._propagationImmediateStopped = !0;
},
isStopped: function() {
return this._propagationStopped || this._propagationImmediateStopped;
},
getCurrentTarget: function() {
return this.currentTarget;
},
getType: function() {
return this.type;
}
};
cc.Event.NO_TYPE = "no_type";
cc.Event.TOUCH = "touch";
cc.Event.MOUSE = "mouse";
cc.Event.KEYBOARD = "keyboard";
cc.Event.ACCELERATION = "acceleration";
cc.Event.NONE = 0;
cc.Event.CAPTURING_PHASE = 1;
cc.Event.AT_TARGET = 2;
cc.Event.BUBBLING_PHASE = 3;
var n = function(t, e) {
cc.Event.call(this, t, e);
this.detail = null;
};
i.extend(n, cc.Event);
n.prototype.reset = n;
n.prototype.setUserData = function(t) {
this.detail = t;
};
n.prototype.getUserData = function() {
return this.detail;
};
n.prototype.getEventName = cc.Event.prototype.getType;
var r = new i.Pool(10);
n.put = function(t) {
r.put(t);
};
n.get = function(t, e) {
var i = r._get();
i ? i.reset(t, e) : i = new n(t, e);
return i;
};
cc.Event.EventCustom = n;
e.exports = cc.Event;
}), {
"../platform/js": 260
} ],
188: [ (function(t) {
"use strict";
t("./event");
t("./event-listeners");
t("./event-target");
t("./system-event");
}), {
"./event": 187,
"./event-listeners": 185,
"./event-target": 186,
"./system-event": 189
} ],
189: [ (function(t, e) {
"use strict";
var i = t("../event/event-target"), n = t("../event-manager"), r = t("../platform/CCInputManager"), s = cc.Enum({
KEY_DOWN: "keydown",
KEY_UP: "keyup",
DEVICEMOTION: "devicemotion"
}), o = null, a = null, c = cc.Class({
name: "SystemEvent",
extends: i,
statics: {
EventType: s
},
setAccelerometerEnabled: function(t) {
t && window.DeviceMotionEvent && "function" == typeof DeviceMotionEvent.requestPermission ? DeviceMotionEvent.requestPermission().then((function(t) {
console.log("Device Motion Event request permission: " + t);
r.setAccelerometerEnabled("granted" === t);
})) : r.setAccelerometerEnabled(t);
},
setAccelerometerInterval: function(t) {
r.setAccelerometerInterval(t);
},
on: function(t, e, i, r) {
this._super(t, e, i, r);
if (t === s.KEY_DOWN || t === s.KEY_UP) {
o || (o = cc.EventListener.create({
event: cc.EventListener.KEYBOARD,
onKeyPressed: function(t, e) {
e.type = s.KEY_DOWN;
cc.systemEvent.dispatchEvent(e);
},
onKeyReleased: function(t, e) {
e.type = s.KEY_UP;
cc.systemEvent.dispatchEvent(e);
}
}));
n.hasEventListener(cc.EventListener.ListenerID.KEYBOARD) || n.addListener(o, 1);
}
if (t === s.DEVICEMOTION) {
a || (a = cc.EventListener.create({
event: cc.EventListener.ACCELERATION,
callback: function(t, e) {
e.type = s.DEVICEMOTION;
cc.systemEvent.dispatchEvent(e);
}
}));
n.hasEventListener(cc.EventListener.ListenerID.ACCELERATION) || n.addListener(a, 1);
}
},
off: function(t, e, i) {
this._super(t, e, i);
if (o && (t === s.KEY_DOWN || t === s.KEY_UP)) {
var r = this.hasEventListener(s.KEY_DOWN), c = this.hasEventListener(s.KEY_UP);
r || c || n.removeListener(o);
}
a && t === s.DEVICEMOTION && n.removeListener(a);
}
});
cc.SystemEvent = e.exports = c;
cc.systemEvent = new cc.SystemEvent();
}), {
"../event-manager": 184,
"../event/event-target": 186,
"../platform/CCInputManager": 243
} ],
190: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = o(t("../value-types/vec3")), r = o(t("../value-types/mat3")), s = o(t("./enums"));
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
var a = new n.default(), c = new n.default(), l = new r.default(), u = function(t, e, i) {
var r = l.m, s = i.m;
r[0] = Math.abs(s[0]);
r[1] = Math.abs(s[1]);
r[2] = Math.abs(s[2]);
r[3] = Math.abs(s[4]);
r[4] = Math.abs(s[5]);
r[5] = Math.abs(s[6]);
r[6] = Math.abs(s[8]);
r[7] = Math.abs(s[9]);
r[8] = Math.abs(s[10]);
n.default.transformMat3(t, e, l);
}, h = (function() {
t.create = function(e, i, n, r, s, o) {
return new t(e, i, n, r, s, o);
};
t.clone = function(e) {
return new t(e.center.x, e.center.y, e.center.z, e.halfExtents.x, e.halfExtents.y, e.halfExtents.z);
};
t.copy = function(t, e) {
n.default.copy(t.center, e.center);
n.default.copy(t.halfExtents, e.halfExtents);
return t;
};
t.fromPoints = function(t, e, i) {
n.default.scale(t.center, n.default.add(a, e, i), .5);
n.default.scale(t.halfExtents, n.default.sub(c, i, e), .5);
return t;
};
t.set = function(t, e, i, r, s, o, a) {
n.default.set(t.center, e, i, r);
n.default.set(t.halfExtents, s, o, a);
return t;
};
function t(t, e, i, r, o, a) {
this.center = void 0;
this.halfExtents = void 0;
this._type = void 0;
this._type = s.default.SHAPE_AABB;
this.center = new n.default(t, e, i);
this.halfExtents = new n.default(r, o, a);
}
var e = t.prototype;
e.getBoundary = function(t, e) {
n.default.sub(t, this.center, this.halfExtents);
n.default.add(e, this.center, this.halfExtents);
};
e.transform = function(t, e, i, r, s) {
s || (s = this);
n.default.transformMat4(s.center, this.center, t);
u(s.halfExtents, this.halfExtents, t);
};
return t;
})();
i.default = h;
e.exports = i.default;
}), {
"../value-types/mat3": 338,
"../value-types/vec3": 347,
"./enums": 192
} ],
191: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.point_plane = _;
i.pt_point_plane = function(t, e, i) {
var r = _(e, i);
return n.Vec3.subtract(t, e, n.Vec3.multiplyScalar(t, i.n, r));
};
i.pt_point_aabb = function(t, e, i) {
n.Vec3.copy(t, e);
n.Vec3.subtract(c, i.center, i.halfExtents);
n.Vec3.add(l, i.center, i.halfExtents);
t.x = t.x < c.x ? c.x : t.x;
t.y = t.y < c.x ? c.y : t.y;
t.z = t.z < c.x ? c.z : t.z;
t.x = t.x > l.x ? l.x : t.x;
t.y = t.y > l.x ? l.y : t.y;
t.z = t.z > l.x ? l.z : t.z;
return t;
};
i.pt_point_obb = function(t, e, i) {
var c = i.orientation.m;
n.Vec3.set(r, c[0], c[1], c[2]);
n.Vec3.set(s, c[3], c[4], c[5]);
n.Vec3.set(o, c[6], c[7], c[8]);
u[0] = r;
u[1] = s;
u[2] = o;
h[0] = i.halfExtents.x;
h[1] = i.halfExtents.y;
h[2] = i.halfExtents.z;
n.Vec3.subtract(a, e, i.center);
n.Vec3.set(t, i.center.x, i.center.y, i.center.z);
for (var l = 0; l < 3; l++) {
var _ = n.Vec3.dot(a, u[l]);
_ > h[l] && (_ = h[l]);
_ < -h[l] && (_ = -h[l]);
t.x += _ * u[l].x;
t.y += _ * u[l].y;
t.z += _ * u[l].z;
}
return t;
};
var n = t("../value-types"), r = new n.Vec3(), s = new n.Vec3(), o = new n.Vec3(), a = new n.Vec3(), c = new n.Vec3(), l = new n.Vec3(), u = new Array(3), h = new Array(3);
function _(t, e) {
return n.Vec3.dot(e.n, t) - e.d;
}
}), {
"../value-types": 337
} ],
192: [ (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;
}), {} ],
193: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = t("../value-types"), r = o(t("./enums")), s = o(t("./plane"));
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
function a(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function c(t, e, i) {
e && a(t.prototype, e);
i && a(t, i);
return t;
}
var l = new Array(8);
l[0] = new n.Vec3(1, 1, 1);
l[1] = new n.Vec3(-1, 1, 1);
l[2] = new n.Vec3(-1, -1, 1);
l[3] = new n.Vec3(1, -1, 1);
l[4] = new n.Vec3(1, 1, -1);
l[5] = new n.Vec3(-1, 1, -1);
l[6] = new n.Vec3(-1, -1, -1);
l[7] = new n.Vec3(1, -1, -1);
var u, h = (function() {
t.create = function() {
return new t();
};
t.clone = function(e) {
return t.copy(new t(), e);
};
t.copy = function(t, e) {
t._type = e._type;
for (var i = 0; i < 6; ++i) s.default.copy(t.planes[i], e.planes[i]);
for (var r = 0; r < 8; ++r) n.Vec3.copy(t.vertices[r], e.vertices[r]);
return t;
};
function t() {
this.planes = void 0;
this.vertices = void 0;
this._type = void 0;
this._type = r.default.SHAPE_FRUSTUM;
this.planes = new Array(6);
for (var t = 0; t < 6; ++t) this.planes[t] = s.default.create(0, 0, 0, 0);
this.vertices = new Array(8);
for (var e = 0; e < 8; ++e) this.vertices[e] = new n.Vec3();
}
var e = t.prototype;
e.update = function(t, e) {
var i = t.m;
n.Vec3.set(this.planes[0].n, i[3] + i[0], i[7] + i[4], i[11] + i[8]);
this.planes[0].d = -(i[15] + i[12]);
n.Vec3.set(this.planes[1].n, i[3] - i[0], i[7] - i[4], i[11] - i[8]);
this.planes[1].d = -(i[15] - i[12]);
n.Vec3.set(this.planes[2].n, i[3] + i[1], i[7] + i[5], i[11] + i[9]);
this.planes[2].d = -(i[15] + i[13]);
n.Vec3.set(this.planes[3].n, i[3] - i[1], i[7] - i[5], i[11] - i[9]);
this.planes[3].d = -(i[15] - i[13]);
n.Vec3.set(this.planes[4].n, i[3] + i[2], i[7] + i[6], i[11] + i[10]);
this.planes[4].d = -(i[15] + i[14]);
n.Vec3.set(this.planes[5].n, i[3] - i[2], i[7] - i[6], i[11] - i[10]);
this.planes[5].d = -(i[15] - i[14]);
if (this._type === r.default.SHAPE_FRUSTUM_ACCURATE) {
for (var s = 0; s < 6; s++) {
var o = this.planes[s], a = 1 / o.n.length();
n.Vec3.multiplyScalar(o.n, o.n, a);
o.d *= a;
}
for (var c = 0; c < 8; c++) n.Vec3.transformMat4(this.vertices[c], l[c], e);
}
};
e.transform = function(t) {
if (this._type === r.default.SHAPE_FRUSTUM_ACCURATE) {
for (var e = 0; e < 8; e++) n.Vec3.transformMat4(this.vertices[e], this.vertices[e], t);
s.default.fromPoints(this.planes[0], this.vertices[1], this.vertices[5], this.vertices[6]);
s.default.fromPoints(this.planes[1], this.vertices[3], this.vertices[7], this.vertices[4]);
s.default.fromPoints(this.planes[2], this.vertices[6], this.vertices[7], this.vertices[3]);
s.default.fromPoints(this.planes[3], this.vertices[0], this.vertices[4], this.vertices[5]);
s.default.fromPoints(this.planes[4], this.vertices[2], this.vertices[3], this.vertices[0]);
s.default.fromPoints(this.planes[0], this.vertices[7], this.vertices[6], this.vertices[5]);
}
};
c(t, [ {
key: "accurate",
set: function(t) {
this._type = t ? r.default.SHAPE_FRUSTUM_ACCURATE : r.default.SHAPE_FRUSTUM;
}
} ]);
return t;
})();
i.default = h;
h.createOrtho = (u = new n.Vec3(), function(t, e, i, r, o, a) {
var c = e / 2, l = i / 2;
n.Vec3.set(u, c, l, r);
n.Vec3.transformMat4(t.vertices[0], u, a);
n.Vec3.set(u, -c, l, r);
n.Vec3.transformMat4(t.vertices[1], u, a);
n.Vec3.set(u, -c, -l, r);
n.Vec3.transformMat4(t.vertices[2], u, a);
n.Vec3.set(u, c, -l, r);
n.Vec3.transformMat4(t.vertices[3], u, a);
n.Vec3.set(u, c, l, o);
n.Vec3.transformMat4(t.vertices[4], u, a);
n.Vec3.set(u, -c, l, o);
n.Vec3.transformMat4(t.vertices[5], u, a);
n.Vec3.set(u, -c, -l, o);
n.Vec3.transformMat4(t.vertices[6], u, a);
n.Vec3.set(u, c, -l, o);
n.Vec3.transformMat4(t.vertices[7], u, a);
s.default.fromPoints(t.planes[0], t.vertices[1], t.vertices[6], t.vertices[5]);
s.default.fromPoints(t.planes[1], t.vertices[3], t.vertices[4], t.vertices[7]);
s.default.fromPoints(t.planes[2], t.vertices[6], t.vertices[3], t.vertices[7]);
s.default.fromPoints(t.planes[3], t.vertices[0], t.vertices[5], t.vertices[4]);
s.default.fromPoints(t.planes[4], t.vertices[2], t.vertices[0], t.vertices[3]);
s.default.fromPoints(t.planes[0], t.vertices[7], t.vertices[5], t.vertices[6]);
});
e.exports = i.default;
}), {
"../value-types": 337,
"./enums": 192,
"./plane": 198
} ],
194: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
var n = {
enums: !0,
Triangle: !0,
Aabb: !0,
Ray: !0,
intersect: !0,
Sphere: !0,
Obb: !0,
Frustum: !0,
Line: !0,
Plane: !0
};
i.Plane = i.Line = i.Frustum = i.Obb = i.Sphere = i.intersect = i.Ray = i.Aabb = i.Triangle = i.enums = void 0;
var r = p(t("./enums"));
i.enums = r.default;
var s = p(t("./triangle"));
i.Triangle = s.default;
var o = p(t("./aabb"));
i.Aabb = o.default;
var a = p(t("./ray"));
i.Ray = a.default;
var c = p(t("./intersect"));
i.intersect = c.default;
var l = p(t("./sphere"));
i.Sphere = l.default;
var u = p(t("./obb"));
i.Obb = u.default;
var h = p(t("./frustum"));
i.Frustum = h.default;
var _ = p(t("./line"));
i.Line = _.default;
var f = p(t("./plane"));
i.Plane = f.default;
var d = t("./distance");
Object.keys(d).forEach((function(t) {
"default" !== t && "__esModule" !== t && (Object.prototype.hasOwnProperty.call(n, t) || t in i && i[t] === d[t] || (i[t] = d[t]));
}));
function p(t) {
return t && t.__esModule ? t : {
default: t
};
}
cc.geomUtils = e.exports;
}), {
"./aabb": 190,
"./distance": 191,
"./enums": 192,
"./frustum": 193,
"./intersect": 195,
"./line": 196,
"./obb": 197,
"./plane": 198,
"./ray": 199,
"./sphere": 200,
"./triangle": 201
} ],
195: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = _(t("../../renderer/gfx")), r = _(t("../../renderer/memop/recycle-pool")), s = t("../value-types"), o = _(t("./aabb")), a = (function(t) {
if (t && t.__esModule) return t;
if (null === t || "object" != typeof t && "function" != typeof t) return {
default: t
};
var e = h(void 0);
if (e && e.has(t)) return e.get(t);
var i = {}, n = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var r in t) if ("default" !== r && Object.prototype.hasOwnProperty.call(t, r)) {
var s = n ? Object.getOwnPropertyDescriptor(t, r) : null;
s && (s.get || s.set) ? Object.defineProperty(i, r, s) : i[r] = t[r];
}
i.default = t;
e && e.set(t, i);
return i;
})(t("./distance")), c = _(t("./enums")), l = _(t("./ray")), u = _(t("./triangle"));
function h(t) {
if ("function" != typeof WeakMap) return null;
var e = new WeakMap(), i = new WeakMap();
return (h = function(t) {
return t ? i : e;
})(t);
}
function _(t) {
return t && t.__esModule ? t : {
default: t
};
}
var f, d, p, m, y, v, g, b, C, x, A, S, T, w, E, M = (function() {
var t = u.default.create(), e = Infinity;
function i(t, e, i, n) {
s.Vec3.set(t, e[i * n], e[i * n + 1], e[i * n + 2]);
}
return function(r, s) {
e = Infinity;
for (var o = s._subMeshes, a = 0; a < o.length; a++) if (o[a]._primitiveType === n.default.PT_TRIANGLES) for (var c = s._subDatas[a] || s._subDatas[0], l = s._getAttrMeshData(a, n.default.ATTR_POSITION), u = c.getIData(Uint16Array), h = c.vfm.element(n.default.ATTR_POSITION).num, _ = 0; _ < u.length; _ += 3) {
i(t.a, l, u[_], h);
i(t.b, l, u[_ + 1], h);
i(t.c, l, u[_ + 2], h);
var f = P(r, t);
f > 0 && f < e && (e = f);
}
return e;
};
})(), B = (function() {
function t(e, i) {
for (var n = e.children, r = n.length - 1; r >= 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, o = e.z, a = n[3] * r + n[7] * s + n[11] * o;
a = a ? 1 / a : 1;
t.x = (n[0] * r + n[4] * s + n[8] * o) * a;
t.y = (n[1] * r + n[5] * s + n[9] * o) * a;
t.z = (n[2] * r + n[6] * s + n[10] * o) * a;
return t;
}
var n = new r.default(function() {
return {
distance: 0,
node: null
};
}, 1), a = [], c = o.default.create(), u = new s.Vec3(), h = new s.Vec3(), _ = new l.default(), f = cc.mat4(), d = cc.mat4(), p = new s.Vec3();
function m(t) {
return t > 0 && t < Infinity;
}
return function(r, l, y, v) {
n.reset();
a.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, l.o, d);
s.Vec3.normalize(_.d, i(_.d, l.d, d));
var e = Infinity, r = t._renderComponent;
if (r instanceof cc.MeshRenderer) e = N(_, r._boundingBox); else if (t.width && t.height) {
s.Vec3.set(u, -t.width * t.anchorX, -t.height * t.anchorY, t.z);
s.Vec3.set(h, t.width * (1 - t.anchorX), t.height * (1 - t.anchorY), t.z);
o.default.fromPoints(c, u, h);
e = N(_, c);
}
if (m(e)) {
y && (e = y(_, t, e));
if (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);
a.push(g);
}
}
}
}));
a.sort(e);
return a;
};
})(), I = (f = new s.Vec3(0, 0, 0), function(t, e) {
var i = s.Vec3.dot(t.d, e.n);
if (Math.abs(i) < Number.EPSILON) return 0;
s.Vec3.multiplyScalar(f, e.n, e.d);
var n = s.Vec3.dot(s.Vec3.subtract(f, f, t.o), e.n) / i;
return n < 0 ? 0 : n;
}), D = (d = new s.Vec3(0, 0, 0), function(t, e) {
s.Vec3.subtract(d, t.e, t.s);
var i = (e.d - s.Vec3.dot(t.s, e.n)) / s.Vec3.dot(d, e.n);
return i < 0 || i > 1 ? 0 : i;
}), P = (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(o, a, c) {
s.Vec3.subtract(t, a.b, a.a);
s.Vec3.subtract(e, a.c, a.a);
s.Vec3.cross(i, o.d, e);
var l = s.Vec3.dot(t, i);
if (l < Number.EPSILON && (!c || l > -Number.EPSILON)) return 0;
var u = 1 / l;
s.Vec3.subtract(n, o.o, a.a);
var h = s.Vec3.dot(n, i) * u;
if (h < 0 || h > 1) return 0;
s.Vec3.cross(r, n, t);
var _ = s.Vec3.dot(o.d, r) * u;
if (_ < 0 || h + _ > 1) return 0;
var f = s.Vec3.dot(e, r) * u;
return f < 0 ? 0 : f;
};
})(), R = P, L = (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), o = new s.Vec3(0, 0, 0);
return function(a, c, l) {
s.Vec3.subtract(t, c.b, c.a);
s.Vec3.subtract(e, c.c, c.a);
s.Vec3.subtract(i, a.s, a.e);
s.Vec3.cross(r, t, e);
var u = s.Vec3.dot(i, r);
if (u <= 0) return 0;
s.Vec3.subtract(n, a.s, c.a);
var h = s.Vec3.dot(n, r);
if (h < 0 || h > u) return 0;
s.Vec3.cross(o, i, n);
var _ = s.Vec3.dot(e, o);
if (_ < 0 || _ > u) return 0;
var f = -s.Vec3.dot(t, o);
if (f < 0 || _ + f > u) return 0;
if (l) {
var d = 1 / u, p = 1 - (_ *= d) - (f *= d);
s.Vec3.set(l, c.a.x * p + c.b.x * _ + c.c.x * f, c.a.y * p + c.b.y * _ + c.c.y * f, c.a.z * p + c.b.z * _ + c.c.z * f);
}
return 1;
};
})(), O = (p = new s.Vec3(0, 0, 0), m = new s.Vec3(0, 0, 0), y = new s.Vec3(0, 0, 0), 
v = new s.Vec3(0, 0, 0), g = new s.Vec3(0, 0, 0), b = new s.Vec3(0, 0, 0), C = new s.Vec3(0, 0, 0), 
function(t, e, i, n, r, o, a) {
s.Vec3.subtract(p, e, t);
s.Vec3.subtract(m, i, t);
s.Vec3.subtract(y, n, t);
s.Vec3.subtract(v, r, t);
s.Vec3.cross(b, v, p);
var c = s.Vec3.dot(m, b);
if (c >= 0) {
var l = -s.Vec3.dot(y, b);
if (l < 0) return 0;
var u = s.Vec3.dot(s.Vec3.cross(C, p, y), m);
if (u < 0) return 0;
if (a) {
var h = 1 / (l + c + u);
l *= h;
c *= h;
u *= h;
s.Vec3.set(a, i.x * l + n.x * c + r.x * u, i.y * l + n.y * c + r.y * u, i.z * l + n.z * c + r.z * u);
}
} else {
s.Vec3.subtract(g, o, t);
var _ = s.Vec3.dot(g, b);
if (_ < 0) return 0;
var f = s.Vec3.dot(s.Vec3.cross(C, p, m), g);
if (f < 0) return 0;
if (a) {
var d = 1 / (_ + (c = -c) + f);
_ *= d;
c *= d;
f *= d;
s.Vec3.set(a, i.x * _ + o.x * c + r.x * f, i.y * _ + o.y * c + r.y * f, i.z * _ + o.z * c + r.z * f);
}
}
return 1;
}), V = (function() {
var t = new s.Vec3(0, 0, 0);
return function(e, i) {
var n = i.radius, r = i.center, o = e.o, a = e.d, c = n * n;
s.Vec3.subtract(t, r, o);
var l = t.lengthSqr(), u = s.Vec3.dot(t, a), h = c - (l - u * u);
if (h < 0) return 0;
var _ = Math.sqrt(h), f = l < c ? u + _ : u - _;
return f < 0 ? 0 : f;
};
})(), N = (x = new s.Vec3(), A = new s.Vec3(), function(t, e) {
var i = t.o, n = t.d, r = 1 / n.x, o = 1 / n.y, a = 1 / n.z;
s.Vec3.subtract(x, e.center, e.halfExtents);
s.Vec3.add(A, e.center, e.halfExtents);
var c = (x.x - i.x) * r, l = (A.x - i.x) * r, u = (x.y - i.y) * o, h = (A.y - i.y) * o, _ = (x.z - i.z) * a, f = (A.z - i.z) * a, d = Math.max(Math.max(Math.min(c, l), Math.min(u, h)), Math.min(_, f)), p = Math.min(Math.min(Math.max(c, l), Math.max(u, h)), Math.max(_, f));
return p < 0 || d > p ? 0 : d;
}), F = N, z = (function() {
var t = new s.Vec3(), e = new s.Vec3(), i = new s.Vec3(), n = new s.Vec3(), r = new s.Vec3(), o = new s.Vec3(), a = new s.Vec3(), c = new Array(3), l = new Array(3), u = new Array(3), h = new Array(6);
return function(_, f) {
c[0] = f.halfExtents.x;
c[1] = f.halfExtents.y;
c[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(o, d[6], d[7], d[8]);
s.Vec3.subtract(a, t, e);
l[0] = s.Vec3.dot(n, i);
l[1] = s.Vec3.dot(r, i);
l[2] = s.Vec3.dot(o, i);
u[0] = s.Vec3.dot(n, a);
u[1] = s.Vec3.dot(r, a);
u[2] = s.Vec3.dot(o, a);
for (var p = 0; p < 3; ++p) {
if (0 === l[p]) {
if (-u[p] - c[p] > 0 || -u[p] + c[p] < 0) return 0;
l[p] = 1e-7;
}
h[2 * p + 0] = (u[p] + c[p]) / l[p];
h[2 * p + 1] = (u[p] - c[p]) / l[p];
}
var m = Math.max(Math.max(Math.min(h[0], h[1]), Math.min(h[2], h[3])), Math.min(h[4], h[5])), y = Math.min(Math.min(Math.max(h[0], h[1]), Math.max(h[2], h[3])), Math.max(h[4], h[5]));
return y < 0 || m > y || m < 0 ? 0 : m;
};
})(), k = (S = new s.Vec3(), T = new s.Vec3(), w = new s.Vec3(), E = new s.Vec3(), 
function(t, e) {
s.Vec3.subtract(S, t.center, t.halfExtents);
s.Vec3.add(T, t.center, t.halfExtents);
s.Vec3.subtract(w, e.center, e.halfExtents);
s.Vec3.add(E, e.center, e.halfExtents);
return S.x <= E.x && T.x >= w.x && S.y <= E.y && T.y >= w.y && S.z <= E.z && T.z >= w.z;
});
function G(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 U(t, e, i, n, r, o) {
s.Vec3.set(o[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(o[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(o[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(o[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(o[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(o[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(o[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(o[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 H(t, e) {
for (var i = s.Vec3.dot(e, t[0]), n = i, r = 1; r < 8; ++r) {
var o = s.Vec3.dot(e, t[r]);
i = o < i ? o : i;
n = o > n ? o : n;
}
return [ i, n ];
}
var j, W = (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 o = new s.Vec3(), a = new s.Vec3();
return function(e, r) {
var c = 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], c[0], c[1], c[2]);
s.Vec3.set(t[4], c[3], c[4], c[5]);
s.Vec3.set(t[5], c[6], c[7], c[8]);
for (var l = 0; l < 3; ++l) {
s.Vec3.cross(t[6 + 3 * l], t[l], t[0]);
s.Vec3.cross(t[7 + 3 * l], t[l], t[1]);
s.Vec3.cross(t[7 + 3 * l], t[l], t[2]);
}
s.Vec3.subtract(o, e.center, e.halfExtents);
s.Vec3.add(a, e.center, e.halfExtents);
G(o, a, i);
U(r.center, r.halfExtents, t[3], t[4], t[5], n);
for (var u = 0; u < 15; ++u) {
var h = H(i, t[u]), _ = H(n, t[u]);
if (_[0] > h[1] || h[0] > _[1]) return 0;
}
return 1;
};
})(), q = 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 + i < e.d ? -1 : n - i > e.d ? 0 : 1;
}, X = function(t, e) {
for (var i = 0; i < e.planes.length; i++) if (-1 === q(t, e.planes[i])) return 0;
return 1;
}, Y = (function() {
for (var t = new Array(8), e = 0, i = 0, n = 0; n < t.length; n++) t[n] = new s.Vec3(0, 0, 0);
return function(n, r) {
for (var o = 0, a = !1, c = 0; c < r.planes.length; c++) {
if (-1 === (o = q(n, r.planes[c]))) return 0;
1 === o && (a = !0);
}
if (!a) return 1;
for (var l = 0; l < r.vertices.length; l++) s.Vec3.subtract(t[l], r.vertices[l], n.center);
e = 0, i = 0;
for (var u = 0; u < r.vertices.length; u++) t[u].x > n.halfExtents.x ? e++ : t[u].x < -n.halfExtents.x && i++;
if (e === r.vertices.length || i === r.vertices.length) return 0;
e = 0;
i = 0;
for (var h = 0; h < r.vertices.length; h++) t[h].y > n.halfExtents.y ? e++ : t[h].y < -n.halfExtents.y && i++;
if (e === r.vertices.length || i === r.vertices.length) return 0;
e = 0;
i = 0;
for (var _ = 0; _ < r.vertices.length; _++) t[_].z > n.halfExtents.z ? e++ : t[_].z < -n.halfExtents.z && i++;
return e === r.vertices.length || i === r.vertices.length ? 0 : 1;
};
})(), J = (function() {
var t = new s.Vec3(0, 0, 0), e = new s.Mat3();
return function(i, n) {
s.Vec3.subtract(t, n, i.center);
s.Vec3.transformMat3(t, t, s.Mat3.transpose(e, i.orientation));
return r = t, o = i.halfExtents, Math.abs(r.x) < o.x && Math.abs(r.y) < o.y && Math.abs(r.z) < o.z;
var r, o;
};
})(), Z = (j = function(t, e, i, n) {
return Math.abs(t.x * e + t.y * i + t.z * n);
}, function(t, e) {
var i = t.orientation.m, n = t.halfExtents.x * j(e.n, i[0], i[1], i[2]) + t.halfExtents.y * j(e.n, i[3], i[4], i[5]) + t.halfExtents.z * j(e.n, i[6], i[7], i[8]), r = s.Vec3.dot(e.n, t.center);
return r + n < e.d ? -1 : r - n > e.d ? 0 : 1;
}), K = function(t, e) {
for (var i = 0; i < e.planes.length; i++) if (-1 === Z(t, e.planes[i])) return 0;
return 1;
}, Q = (function() {
for (var t = new Array(8), e = 0, i = 0, n = 0, r = 0; r < t.length; r++) t[r] = new s.Vec3(0, 0, 0);
var o = function(t, e, i, n) {
return t.x * e + t.y * i + t.z * n;
};
return function(r, a) {
for (var c = 0, l = !1, u = 0; u < a.planes.length; u++) {
if (-1 === (c = Z(r, a.planes[u]))) return 0;
1 === c && (l = !0);
}
if (!l) return 1;
for (var h = 0; h < a.vertices.length; h++) s.Vec3.subtract(t[h], a.vertices[h], r.center);
i = 0, n = 0;
for (var _ = r.orientation.m, f = 0; f < a.vertices.length; f++) (e = o(t[f], _[0], _[1], _[2])) > r.halfExtents.x ? i++ : e < -r.halfExtents.x && n++;
if (i === a.vertices.length || n === a.vertices.length) return 0;
i = 0;
n = 0;
for (var d = 0; d < a.vertices.length; d++) (e = o(t[d], _[3], _[4], _[5])) > r.halfExtents.y ? i++ : e < -r.halfExtents.y && n++;
if (i === a.vertices.length || n === a.vertices.length) return 0;
i = 0;
n = 0;
for (var p = 0; p < a.vertices.length; p++) (e = o(t[p], _[6], _[7], _[8])) > r.halfExtents.z ? i++ : e < -r.halfExtents.z && n++;
return i === a.vertices.length || n === a.vertices.length ? 0 : 1;
};
})(), $ = (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 o = e.orientation.m, a = r.orientation.m;
s.Vec3.set(t[0], o[0], o[1], o[2]);
s.Vec3.set(t[1], o[3], o[4], o[5]);
s.Vec3.set(t[2], o[6], o[7], o[8]);
s.Vec3.set(t[3], a[0], a[1], a[2]);
s.Vec3.set(t[4], a[3], a[4], a[5]);
s.Vec3.set(t[5], a[6], a[7], a[8]);
for (var c = 0; c < 3; ++c) {
s.Vec3.cross(t[6 + 3 * c], t[c], t[0]);
s.Vec3.cross(t[7 + 3 * c], t[c], t[1]);
s.Vec3.cross(t[7 + 3 * c], t[c], t[2]);
}
U(e.center, e.halfExtents, t[0], t[1], t[2], i);
U(r.center, r.halfExtents, t[3], t[4], t[5], n);
for (var l = 0; l < 15; ++l) {
var u = H(i, t[l]), h = H(n, t[l]);
if (h[0] > u[1] || u[0] > h[1]) return 0;
}
return 1;
};
})(), tt = function(t, e) {
var i = s.Vec3.dot(e.n, t.center), n = t.radius * e.n.length();
return i + n < e.d ? -1 : i - n > e.d ? 0 : 1;
}, et = function(t, e) {
for (var i = 0; i < e.planes.length; i++) if (-1 === tt(t, e.planes[i])) return 0;
return 1;
}, it = (function() {
var t = new s.Vec3(0, 0, 0), e = [ 1, -1, 1, -1, 1, -1 ];
return function(i, n) {
for (var r = 0; r < 6; r++) {
var o = n.planes[r], a = i.radius, c = i.center, l = o.n, u = o.d, h = s.Vec3.dot(l, c);
if (h + a < u) return 0;
if (!(h - a > u)) {
s.Vec3.add(t, c, s.Vec3.multiplyScalar(t, l, a));
for (var _ = 0; _ < 6; _++) if (_ !== r && _ !== r + e[r]) {
var f = n.planes[_];
if (s.Vec3.dot(f.n, t) < f.d) return 0;
}
}
}
return 1;
};
})(), nt = function(t, e) {
var i = t.radius + e.radius;
return s.Vec3.squaredDistance(t.center, e.center) < i * i;
}, rt = (function() {
var t = new s.Vec3();
return function(e, i) {
a.pt_point_aabb(t, e.center, i);
return s.Vec3.squaredDistance(e.center, t) < e.radius * e.radius;
};
})(), st = (function() {
var t = new s.Vec3();
return function(e, i) {
a.pt_point_obb(t, e.center, i);
return s.Vec3.squaredDistance(e.center, t) < e.radius * e.radius;
};
})(), ot = {
rayAabb: F,
rayMesh: M,
raycast: B,
rayTriangle: R,
ray_sphere: V,
ray_aabb: N,
ray_obb: z,
ray_plane: I,
ray_triangle: P,
line_plane: D,
line_triangle: L,
line_quad: O,
sphere_sphere: nt,
sphere_aabb: rt,
sphere_obb: st,
sphere_plane: tt,
sphere_frustum: et,
sphere_frustum_accurate: it,
aabb_aabb: k,
aabb_obb: W,
aabb_plane: q,
aabb_frustum: X,
aabb_frustum_accurate: Y,
obb_obb: $,
obb_plane: Z,
obb_frustum: K,
obb_frustum_accurate: Q,
obb_point: J,
resolve: function(t, e, i) {
void 0 === i && (i = null);
var n = t._type, r = e._type, s = this[n | r];
return n < r ? s(t, e, i) : s(e, t, i);
}
};
ot[c.default.SHAPE_RAY | c.default.SHAPE_SPHERE] = V;
ot[c.default.SHAPE_RAY | c.default.SHAPE_AABB] = N;
ot[c.default.SHAPE_RAY | c.default.SHAPE_OBB] = z;
ot[c.default.SHAPE_RAY | c.default.SHAPE_PLANE] = I;
ot[c.default.SHAPE_RAY | c.default.SHAPE_TRIANGLE] = P;
ot[c.default.SHAPE_LINE | c.default.SHAPE_PLANE] = D;
ot[c.default.SHAPE_LINE | c.default.SHAPE_TRIANGLE] = L;
ot[c.default.SHAPE_SPHERE] = nt;
ot[c.default.SHAPE_SPHERE | c.default.SHAPE_AABB] = rt;
ot[c.default.SHAPE_SPHERE | c.default.SHAPE_OBB] = st;
ot[c.default.SHAPE_SPHERE | c.default.SHAPE_PLANE] = tt;
ot[c.default.SHAPE_SPHERE | c.default.SHAPE_FRUSTUM] = et;
ot[c.default.SHAPE_SPHERE | c.default.SHAPE_FRUSTUM_ACCURATE] = it;
ot[c.default.SHAPE_AABB] = k;
ot[c.default.SHAPE_AABB | c.default.SHAPE_OBB] = W;
ot[c.default.SHAPE_AABB | c.default.SHAPE_PLANE] = q;
ot[c.default.SHAPE_AABB | c.default.SHAPE_FRUSTUM] = X;
ot[c.default.SHAPE_AABB | c.default.SHAPE_FRUSTUM_ACCURATE] = Y;
ot[c.default.SHAPE_OBB] = $;
ot[c.default.SHAPE_OBB | c.default.SHAPE_PLANE] = Z;
ot[c.default.SHAPE_OBB | c.default.SHAPE_FRUSTUM] = K;
ot[c.default.SHAPE_OBB | c.default.SHAPE_FRUSTUM_ACCURATE] = Q;
var at = ot;
i.default = at;
e.exports = i.default;
}), {
"../../renderer/gfx": 363,
"../../renderer/memop/recycle-pool": 365,
"../value-types": 337,
"./aabb": 190,
"./distance": 191,
"./enums": 192,
"./ray": 199,
"./triangle": 201
} ],
196: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : {
default: n
}, o = (function() {
t.create = function(e, i, n, r, s, o) {
return new t(e, i, n, r, s, o);
};
t.clone = function(e) {
return new t(e.s.x, e.s.y, e.s.z, e.e.x, e.e.y, e.e.z);
};
t.copy = function(t, e) {
r.Vec3.copy(t.s, e.s);
r.Vec3.copy(t.e, e.e);
return t;
};
t.fromPoints = function(t, e, i) {
r.Vec3.copy(t.s, e);
r.Vec3.copy(t.e, i);
return t;
};
t.set = function(t, e, i, n, r, s, o) {
t.s.x = e;
t.s.y = i;
t.s.z = n;
t.e.x = r;
t.e.y = s;
t.e.z = o;
return t;
};
t.len = function(t) {
return r.Vec3.distance(t.s, t.e);
};
function t(t, e, i, n, o, a) {
void 0 === t && (t = 0);
void 0 === e && (e = 0);
void 0 === i && (i = 0);
void 0 === n && (n = 0);
void 0 === o && (o = 0);
void 0 === a && (a = -1);
this.s = void 0;
this.e = void 0;
this._type = void 0;
this._type = s.default.SHAPE_LINE;
this.s = new r.Vec3(t, e, i);
this.e = new r.Vec3(n, o, a);
}
t.prototype.length = function() {
return r.Vec3.distance(this.s, this.e);
};
return t;
})();
i.default = o;
e.exports = i.default;
}), {
"../value-types": 337,
"./enums": 192
} ],
197: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : {
default: n
};
function o(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function a(t, e, i) {
e && o(t.prototype, e);
i && o(t, i);
return t;
}
var c = new r.Vec3(), l = new r.Vec3(), u = new r.Mat3(), h = function(t, e, i) {
var n = u.m, s = i.m;
n[0] = Math.abs(s[0]);
n[1] = Math.abs(s[1]);
n[2] = Math.abs(s[2]);
n[3] = Math.abs(s[3]);
n[4] = Math.abs(s[4]);
n[5] = Math.abs(s[5]);
n[6] = Math.abs(s[6]);
n[7] = Math.abs(s[7]);
n[8] = Math.abs(s[8]);
r.Vec3.transformMat3(t, e, u);
}, _ = (function() {
t.create = function(e, i, n, r, s, o, a, c, l, u, h, _, f, d, p) {
return new t(e, i, n, r, s, o, a, c, l, u, h, _, f, d, p);
};
t.clone = function(e) {
var i = e.orientation.m;
return new t(e.center.x, e.center.y, e.center.z, e.halfExtents.x, e.halfExtents.y, e.halfExtents.z, i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]);
};
t.copy = function(t, e) {
r.Vec3.copy(t.center, e.center);
r.Vec3.copy(t.halfExtents, e.halfExtents);
r.Mat3.copy(t.orientation, e.orientation);
return t;
};
t.fromPoints = function(t, e, i) {
r.Vec3.multiplyScalar(t.center, r.Vec3.add(c, e, i), .5);
r.Vec3.multiplyScalar(t.halfExtents, r.Vec3.subtract(l, i, e), .5);
r.Mat3.identity(t.orientation);
return t;
};
t.set = function(t, e, i, n, s, o, a, c, l, u, h, _, f, d, p, m) {
r.Vec3.set(t.center, e, i, n);
r.Vec3.set(t.halfExtents, s, o, a);
r.Mat3.set(t.orientation, c, l, u, h, _, f, d, p, m);
return t;
};
function t(t, e, i, n, o, a, c, l, u, h, _, f, d, p, m) {
void 0 === t && (t = 0);
void 0 === e && (e = 0);
void 0 === i && (i = 0);
void 0 === n && (n = 1);
void 0 === o && (o = 1);
void 0 === a && (a = 1);
void 0 === c && (c = 1);
void 0 === l && (l = 0);
void 0 === u && (u = 0);
void 0 === h && (h = 0);
void 0 === _ && (_ = 1);
void 0 === f && (f = 0);
void 0 === d && (d = 0);
void 0 === p && (p = 0);
void 0 === m && (m = 1);
this.center = void 0;
this.halfExtents = void 0;
this.orientation = void 0;
this._type = void 0;
this._type = s.default.SHAPE_OBB;
this.center = new r.Vec3(t, e, i);
this.halfExtents = new r.Vec3(n, o, a);
this.orientation = new r.Mat3(c, l, u, h, _, f, d, p, m);
}
var e = t.prototype;
e.getBoundary = function(t, e) {
h(c, this.halfExtents, this.orientation);
r.Vec3.subtract(t, this.center, c);
r.Vec3.add(e, this.center, c);
};
e.transform = function(t, e, i, n, s) {
r.Vec3.transformMat4(s.center, this.center, t);
r.Mat3.fromQuat(s.orientation, i);
r.Vec3.multiply(s.halfExtents, this.halfExtents, n);
};
e.translateAndRotate = function(t, e, i) {
r.Vec3.transformMat4(i.center, this.center, t);
r.Mat3.fromQuat(i.orientation, e);
};
e.setScale = function(t, e) {
r.Vec3.multiply(e.halfExtents, this.halfExtents, t);
};
a(t, [ {
key: "type",
get: function() {
return this._type;
}
} ]);
return t;
})();
i.default = _;
e.exports = i.default;
}), {
"../value-types": 337,
"./enums": 192
} ],
198: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : {
default: n
}, o = new r.Vec3(0, 0, 0), a = new r.Vec3(0, 0, 0), c = cc.mat4(), l = cc.v4(), u = (function() {
t.create = function(e, i, n, r) {
return new t(e, i, n, r);
};
t.clone = function(e) {
return new t(e.n.x, e.n.y, e.n.z, e.d);
};
t.copy = function(t, e) {
r.Vec3.copy(t.n, e.n);
t.d = e.d;
return t;
};
t.fromPoints = function(t, e, i, n) {
r.Vec3.subtract(o, i, e);
r.Vec3.subtract(a, n, e);
r.Vec3.normalize(t.n, r.Vec3.cross(t.n, o, a));
t.d = r.Vec3.dot(t.n, e);
return t;
};
t.set = function(t, e, i, n, r) {
t.n.x = e;
t.n.y = i;
t.n.z = n;
t.d = r;
return t;
};
t.fromNormalAndPoint = function(t, e, i) {
r.Vec3.copy(t.n, e);
t.d = r.Vec3.dot(e, i);
return t;
};
t.normalize = function(t, e) {
var i = e.n.len();
r.Vec3.normalize(t.n, e.n);
i > 0 && (t.d = e.d / i);
return t;
};
function t(t, e, i, n) {
void 0 === t && (t = 0);
void 0 === e && (e = 1);
void 0 === i && (i = 0);
void 0 === n && (n = 0);
this.n = void 0;
this.d = void 0;
this._type = void 0;
this._type = s.default.SHAPE_PLANE;
this.n = new r.Vec3(t, e, i);
this.d = n;
}
t.prototype.transform = function(t) {
r.Mat4.invert(c, t);
r.Mat4.transpose(c, c);
r.Vec4.set(l, this.n.x, this.n.y, this.n.z, this.d);
r.Vec4.transformMat4(l, l, c);
r.Vec3.set(this.n, l.x, l.y, l.z);
this.d = l.w;
};
return t;
})();
i.default = u;
e.exports = i.default;
}), {
"../value-types": 337,
"./enums": 192
} ],
199: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : {
default: n
}, o = (function() {
t.create = function(e, i, n, r, s, o) {
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 === o && (o = 1);
return new t(e, i, n, r, s, o);
};
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) {
r.Vec3.copy(t.o, e.o);
r.Vec3.copy(t.d, e.d);
return t;
};
t.fromPoints = function(t, e, i) {
r.Vec3.copy(t.o, e);
r.Vec3.normalize(t.d, r.Vec3.subtract(t.d, i, e));
return t;
};
t.set = function(t, e, i, n, r, s, o) {
t.o.x = e;
t.o.y = i;
t.o.z = n;
t.d.x = r;
t.d.y = s;
t.d.z = o;
return t;
};
function t(t, e, i, n, o, a) {
void 0 === t && (t = 0);
void 0 === e && (e = 0);
void 0 === i && (i = 0);
void 0 === n && (n = 0);
void 0 === o && (o = 0);
void 0 === a && (a = -1);
this.o = void 0;
this.d = void 0;
this._type = void 0;
this._type = s.default.SHAPE_RAY;
this.o = new r.Vec3(t, e, i);
this.d = new r.Vec3(n, o, a);
}
t.prototype.computeHit = function(t, e) {
r.Vec3.normalize(t, this.d);
r.Vec3.scaleAndAdd(t, this.o, t, e);
};
return t;
})();
i.default = o;
e.exports = i.default;
}), {
"../value-types": 337,
"./enums": 192
} ],
200: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : {
default: n
}, o = new r.Vec3(), a = (function() {
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) {
r.Vec3.copy(t.center, e.center);
t.radius = e.radius;
return t;
};
t.fromPoints = function(t, e, i) {
r.Vec3.multiplyScalar(t.center, r.Vec3.add(o, e, i), .5);
t.radius = .5 * r.Vec3.subtract(o, i, e).len();
return t;
};
t.set = function(t, e, i, n, r) {
t.center.x = e;
t.center.y = i;
t.center.z = n;
t.radius = r;
return t;
};
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 = 1);
this.center = void 0;
this.radius = void 0;
this._type = void 0;
this._type = s.default.SHAPE_SPHERE;
this.center = new r.Vec3(t, e, i);
this.radius = n;
}
var e = t.prototype;
e.clone = function() {
return t.clone(this);
};
e.copy = function(e) {
return t.copy(this, e);
};
e.getBoundary = function(t, e) {
r.Vec3.set(t, this.center.x - this.radius, this.center.y - this.radius, this.center.z - this.radius);
r.Vec3.set(e, this.center.x + this.radius, this.center.y + this.radius, this.center.z + this.radius);
};
e.transform = function(t, e, i, n, s) {
r.Vec3.transformMat4(s.center, this.center, t);
s.radius = this.radius * n.maxAxis();
};
e.translateAndRotate = function(t, e, i) {
r.Vec3.transformMat4(i.center, this.center, t);
};
e.setScale = function(t, e) {
e.radius = this.radius * t.maxAxis();
};
return t;
})();
i.default = a;
e.exports = i.default;
}), {
"../value-types": 337,
"./enums": 192
} ],
201: [ (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 o = (function() {
t.create = function(e, i, n, r, s, o, a, c, l) {
return new t(e, i, n, r, s, o, a, c, l);
};
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) {
n.default.copy(t.a, e.a);
n.default.copy(t.b, e.b);
n.default.copy(t.c, e.c);
return t;
};
t.fromPoints = function(t, e, i, r) {
n.default.copy(t.a, e);
n.default.copy(t.b, i);
n.default.copy(t.c, r);
return t;
};
t.set = function(t, e, i, n, r, s, o, a, c, l) {
t.a.x = e;
t.a.y = i;
t.a.z = n;
t.b.x = r;
t.b.y = s;
t.b.z = o;
t.c.x = a;
t.c.y = c;
t.c.z = l;
return t;
};
function t(t, e, i, s, o, a, c, l, u) {
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, o, a);
this.c = new n.default(c, l, u);
this._type = r.default.SHAPE_TRIANGLE;
}
return t;
})();
i.default = o;
e.exports = i.default;
}), {
"../value-types/vec3": 347,
"./enums": 192
} ],
202: [ (function(t, e) {
"use strict";
var i = t("../components/CCRenderComponent"), n = t("../assets/material/CCMaterial"), r = t("./types"), s = r.LineCap, o = r.LineJoin, a = cc.Class({
name: "cc.Graphics",
extends: i,
editor: !1,
ctor: function() {
this._impl = new a._Impl(this);
},
properties: {
_lineWidth: 2,
_strokeColor: cc.Color.BLACK,
_lineJoin: o.MITER,
_lineCap: s.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: s
},
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: s
},
onRestore: function() {
this._impl || (this._impl = new a._Impl(this));
},
onDestroy: function() {
this.clear(!0);
this._super();
this._impl = null;
},
_getDefaultMaterial: function() {
return n.getBuiltinMaterial("2d-graphics");
},
_updateMaterial: function() {
var t = this._materials[0];
if (t) {
void 0 !== t.getDefine("CC_USE_MODEL") && t.define("CC_USE_MODEL", !0);
void 0 !== t.getDefine("CC_SUPPORT_standard_derivatives") && cc.sys.glExtension("OES_standard_derivatives") && t.define("CC_SUPPORT_standard_derivatives", !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 = a;
cc.Graphics.Types = r;
cc.Graphics.Helper = t("./helper");
}), {
"../assets/material/CCMaterial": 124,
"../components/CCRenderComponent": 160,
"./helper": 203,
"./types": 205
} ],
203: [ (function(t, e) {
"use strict";
var i = t("./types").PointFlags, n = Math.PI, r = Math.min, s = Math.max, o = Math.cos, a = Math.sin, c = Math.abs, l = Math.sign, u = .5522847493;
e.exports = {
arc: function(t, e, i, l, u, h, _) {
var f, d, p, m = 0, y = 0, v = 0, g = 0, b = 0, C = 0, x = 0, A = 0, S = 0, T = 0, w = 0, E = 0, M = 0;
y = h - u;
if (_ = _ || !1) if (c(y) >= 2 * n) y = 2 * n; else for (;y < 0; ) y += 2 * n; else if (c(y) >= 2 * n) y = 2 * -n; else for (;y > 0; ) y -= 2 * n;
p = 0 | s(1, r(c(y) / (.5 * n) + .5, 5));
v = c(4 / 3 * (1 - o(f = y / p / 2)) / a(f));
_ || (v = -v);
for (d = 0; d <= p; d++) {
C = e + (g = o(m = u + y * (d / p))) * l;
x = i + (b = a(m)) * l;
A = -b * l * v;
S = g * l * v;
0 === d ? t.moveTo(C, x) : t.bezierCurveTo(T + E, w + M, C - A, x - S, C, x);
T = C;
w = x;
E = A;
M = S;
}
},
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, s, o) {
if (o < .1) t.rect(e, i, n, s); else {
var a = r(o, .5 * c(n)) * l(n), h = r(o, .5 * c(s)) * l(s);
t.moveTo(e, i + h);
t.lineTo(e, i + s - h);
t.bezierCurveTo(e, i + s - h * (1 - u), e + a * (1 - u), i + s, e + a, i + s);
t.lineTo(e + n - a, i + s);
t.bezierCurveTo(e + n - a * (1 - u), i + s, e + n, i + s - h * (1 - u), e + n, i + s - h);
t.lineTo(e + n, i + h);
t.bezierCurveTo(e + n, i + h * (1 - u), e + n - a * (1 - u), i, e + n - a, i);
t.lineTo(e + a, i);
t.bezierCurveTo(e + a * (1 - u), i, e, i + h * (1 - u), e, i + h);
t.close();
}
},
tesselateBezier: function t(e, n, r, s, o, a, l, u, h, _, f) {
var d, p, m, y, v, g, b, C, x, A, S, T, w, E, M, B;
if (!(_ > 10)) {
v = .5 * (a + u);
g = .5 * (l + h);
b = .5 * ((d = .5 * (n + s)) + (m = .5 * (s + a)));
C = .5 * ((p = .5 * (r + o)) + (y = .5 * (o + l)));
if (((M = c((s - u) * (E = h - r) - (o - h) * (w = u - n))) + (B = c((a - u) * E - (l - h) * w))) * (M + B) < e._tessTol * (w * w + E * E)) e._addPoint(u, h, 0 === f ? f | i.PT_BEVEL : f); else {
t(e, n, r, d, p, b, C, S = .5 * (b + (x = .5 * (m + v))), T = .5 * (C + (A = .5 * (y + g))), _ + 1, 0);
t(e, S, T, x, A, v, g, u, h, _ + 1, f);
}
}
}
};
}), {
"./types": 205
} ],
204: [ (function(t) {
"use strict";
t("./graphics");
}), {
"./graphics": 202
} ],
205: [ (function(t, e) {
"use strict";
var i = cc.Enum({
BUTT: 0,
ROUND: 1,
SQUARE: 2
}), n = cc.Enum({
BEVEL: 0,
ROUND: 1,
MITER: 2
}), r = cc.Enum({
PT_CORNER: 1,
PT_LEFT: 2,
PT_BEVEL: 4,
PT_INNERBEVEL: 8
});
e.exports = {
LineCap: i,
LineJoin: n,
PointFlags: r
};
}), {} ],
206: [ (function(t) {
"use strict";
t("./platform");
t("./assets");
t("./CCNode");
t("./CCPrivateNode");
t("./CCScene");
t("./components");
t("./graphics");
t("./collider");
t("./collider/CCIntersection");
t("./physics");
t("./camera/CCCamera");
t("./geom-utils");
t("./mesh");
t("./3d");
t("./base-ui/CCWidgetManager");
}), {
"./3d": 29,
"./CCNode": 72,
"./CCPrivateNode": 73,
"./CCScene": 74,
"./assets": 122,
"./base-ui/CCWidgetManager": 133,
"./camera/CCCamera": 134,
"./collider": 142,
"./collider/CCIntersection": 140,
"./components": 178,
"./geom-utils": 194,
"./graphics": 204,
"./mesh": 209,
"./physics": 224,
"./platform": 257
} ],
207: [ (function(t, e) {
"use strict";
var i = s(t("../../renderer/core/input-assembler")), n = s(t("../../renderer/gfx")), r = t("./mesh-data");
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
t("../renderer");
var o = t("../event/event-target");
function a(t, e, i) {
t[e] = i._val;
}
function c(t, e, i) {
t[e] = i.x;
t[e + 1] = i.y;
}
function l(t, e, i) {
t[e] = i.x;
t[e + 1] = i.y;
t[e + 2] = i.z;
}
var u = {
5120: "getInt8",
5121: "getUint8",
5122: "getInt16",
5123: "getUint16",
5124: "getInt32",
5125: "getUint32",
5126: "getFloat32"
}, h = {
5120: "setInt8",
5121: "setUint8",
5122: "setInt16",
5123: "setUint16",
5124: "setInt32",
5125: "setUint32",
5126: "setFloat32"
}, _ = (function() {
var t = new ArrayBuffer(2);
new DataView(t).setInt16(0, 256, !0);
return 256 === new Int16Array(t)[0];
})(), f = cc.Class({
name: "cc.Mesh",
extends: cc.Asset,
mixins: [ o ],
properties: {
_nativeAsset: {
override: !0,
get: function() {
return this._buffer;
},
set: function(t) {
this._buffer = ArrayBuffer.isView(t) ? t.buffer : t;
this.initWithBuffer();
}
},
_vertexBundles: {
default: null,
type: r.VertexBundle
},
_primitives: {
default: null,
Primitive: r.Primitive
},
_minPos: cc.v3(),
_maxPos: cc.v3(),
subMeshes: {
get: function() {
return this._subMeshes;
},
set: function(t) {
this._subMeshes = t;
}
},
subDatas: {
get: function() {
return this._subDatas;
}
}
},
ctor: function() {
this._subMeshes = [];
this._subDatas = [];
this.loaded = !1;
},
initWithBuffer: function() {
this._subMeshes.length = 0;
for (var t = this._primitives, e = 0; e < t.length; e++) {
var s = t[e], o = s.data, a = new Uint8Array(this._buffer, o.offset, o.length), c = this._vertexBundles[s.vertexBundleIndices[0]], l = c.data, u = new n.default.VertexFormat(c.formats), h = new Uint8Array(this._buffer, l.offset, l.length), _ = this._canVertexFormatBatch(u), f = new r.MeshData();
f.vData = h;
f.iData = a;
f.vfm = u;
f.offset = l.offset;
f.canBatch = _;
this._subDatas.push(f);
f.vDirty = !0;
this._subMeshes.push(new i.default(null, null));
}
this.loaded = !0;
this.emit("load");
},
_canVertexFormatBatch: function(t) {
var e = t._attr2el[n.default.ATTR_POSITION];
return !e || e.type === n.default.ATTR_TYPE_FLOAT32 && t._bytes % 4 == 0;
},
init: function(t, e, i, n) {
void 0 === i && (i = !1);
void 0 === n && (n = 0);
var s = new Uint8Array(t._bytes * e), o = new r.MeshData();
o.vData = s;
o.vfm = t;
o.vDirty = !0;
o.canBatch = this._canVertexFormatBatch(t);
var a = this._subDatas[n];
if (a) {
a.vb && a.vb.destroy();
a.ib && a.ib.destroy();
}
this._subDatas[n] = o;
this.loaded = !0;
this.emit("load");
this.emit("init-format");
},
setVertices: function(t, e, i) {
i = i || 0;
var r = this._subDatas[i], s = r.vfm.element(t);
if (!s) return cc.warn("Cannot find " + t + " attribute in vertex defines.");
var o, u = "number" == typeof e[0], h = s.num, _ = u ? e.length / h | 0 : e.length;
r.vData.byteLength < _ * s.stride && r.setVData(new Uint8Array(_ * r.vfm._bytes));
var f = 4;
if (t === n.default.ATTR_COLOR) if (u) {
o = r.getVData();
f = 1;
} else o = r.getVData(Uint32Array); else o = r.getVData(Float32Array);
var d = s.stride / f, p = s.offset / f;
if (u) for (var m = 0, y = e.length / h; m < y; m++) for (var v = m * h, g = m * d + p, b = 0; b < h; b++) o[g + b] = e[v + b]; else {
var C;
C = t === n.default.ATTR_COLOR ? a : 2 === h ? c : l;
for (var x = 0, A = e.length; x < A; x++) C(o, x * d + p, e[x]);
}
r.vDirty = !0;
},
setIndices: function(t, e, i) {
e = e || 0;
var r = t;
if (t instanceof Uint16Array) r = new Uint8Array(t.buffer, t.byteOffset, t.byteLength); else if (Array.isArray(t)) {
r = new Uint16Array(t);
r = new Uint8Array(r.buffer, r.byteOffset, r.byteLength);
}
i ? n.default.USAGE_DYNAMIC : n.default.USAGE_STATIC;
var s = this._subDatas[e];
if (s.ib) {
s.iData = r;
s.iDirty = !0;
} else s.iData = r;
},
setPrimitiveType: function(t, e) {
e = e || 0;
this._subMeshes[e] ? this._subMeshes[e]._primitiveType = t : cc.warn("Do not have sub mesh at index " + e);
},
clear: function() {
this._subMeshes.length = 0;
for (var t = this._subDatas, e = 0, i = t.length; e < i; e++) {
var n = t[e].vb;
n && n.destroy();
var r = t[e].ib;
r && r.destroy();
}
t.length = 0;
},
setBoundingBox: function(t, e) {
this._minPos = t;
this._maxPos = e;
},
destroy: function() {
this.clear();
},
_uploadData: function() {
for (var t = this._subDatas, e = 0, i = t.length; e < i; e++) {
var n = t[e];
if (n.vDirty) {
var r = n.vb, s = n.vData;
r.update(0, s);
n.vDirty = !1;
}
if (n.iDirty) {
var o = n.ib, a = n.iData;
o.update(0, a);
n.iDirty = !1;
}
}
},
_getAttrMeshData: function(t, e) {
var i = this._subDatas[t];
if (!i) return [];
var n = i.vfm, r = n.element(e);
if (!r) return [];
i.attrDatas || (i.attrDatas = {});
var s = i.attrDatas, o = s[e];
if (o) return o;
o = s[e] = [];
for (var a = i.vData, c = new DataView(a.buffer, a.byteOffset, a.byteLength), l = r.stride, h = r.offset, f = r.num, d = r.bytes / f, p = u[r.type], m = a.byteLength / n._bytes, y = 0; y < m; y++) for (var v = y * l + h, g = 0; g < f; g++) {
var b = c[p](v + g * d, _);
o.push(b);
}
return o;
},
copyAttribute: function(t, e, i, n, r) {
var s = !1, o = this._subDatas[t];
if (!o) return s;
var a = o.vfm, c = a.element(e);
if (!c) return s;
var l = h[c.type];
if (!l) return s;
var u = this._getAttrMeshData(t, e), f = o.vData.byteLength / a._bytes, d = c.bytes / c.num;
if (u.length > 0) {
for (var p = new DataView(i, r), m = n, y = c.num, v = 0; v < f; ++v) for (var g = v * y, b = 0; b < y; ++b) {
var C = g + b, x = m * v + d * b;
p[l](x, u[C], _);
}
s = !0;
}
return s;
},
copyIndices: function(t, e) {
var i = this._subDatas[t];
if (!i) return !1;
for (var r = i.iData, s = r.length / 2, o = new DataView(r.buffer, r.byteOffset, r.byteLength), a = u[n.default.INDEX_FMT_UINT8], c = 0; c < s; ++c) e[c] = o[a](2 * c);
return !0;
}
});
cc.Mesh = e.exports = f;
}), {
"../../renderer/core/input-assembler": 359,
"../../renderer/gfx": 363,
"../event/event-target": 186,
"../renderer": 271,
"./mesh-data": 210
} ],
208: [ (function(t, e) {
"use strict";
var i = s(t("../../renderer/gfx")), n = (s(t("../../renderer/core/input-assembler")), 
s(t("../geom-utils/aabb"))), r = (s(t("../value-types/vec3")), s(t("../value-types/mat4")), 
s(t("../assets/material/material-variant")));
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
var o = t("../components/CCRenderComponent"), a = t("./CCMesh"), c = t("../renderer/render-flow"), l = (t("../renderer"), 
t("../assets/material/CCMaterial")), u = cc.Enum({
OFF: 0,
ON: 1
}), h = cc.Class({
name: "cc.MeshRenderer",
extends: o,
editor: !1,
properties: {
_mesh: {
default: null,
type: a
},
_receiveShadows: !1,
_shadowCastingMode: u.OFF,
_enableAutoBatch: !1,
mesh: {
get: function() {
return this._mesh;
},
set: function(t) {
if (this._mesh !== t) {
this._setMesh(t);
if (t) {
this.markForRender(!0);
this.node._renderFlag |= c.FLAG_TRANSFORM;
} else this.disableRender();
}
},
type: a,
animatable: !1
},
textures: {
default: [],
type: cc.Texture2D,
visible: !1
},
receiveShadows: {
get: function() {
return this._receiveShadows;
},
set: function(t) {
this._receiveShadows = t;
this._updateReceiveShadow();
},
animatable: !1
},
shadowCastingMode: {
get: function() {
return this._shadowCastingMode;
},
set: function(t) {
this._shadowCastingMode = t;
this._updateCastShadow();
},
type: u,
animatable: !1
},
enableAutoBatch: {
get: function() {
return this._enableAutoBatch;
},
set: function(t) {
this._enableAutoBatch = t;
}
}
},
statics: {
ShadowCastingMode: u
},
ctor: function() {
this._boundingBox = cc.geomUtils && new n.default();
},
onEnable: function() {
var t = this;
this._super();
if (this._mesh && !this._mesh.loaded) {
this.disableRender();
this._mesh.once("load", (function() {
if (t.isValid) {
t._setMesh(t._mesh);
t.markForRender(!0);
}
}));
cc.assetManager.postLoadNative(this._mesh);
} else this._setMesh(this._mesh);
this._updateRenderNode();
this._updateMaterial();
},
onDestroy: function() {
this._setMesh(null);
cc.pool.assembler.put(this._assembler);
},
_updateRenderNode: function() {
this._assembler.setRenderNode(this.node);
},
_setMesh: function(t) {
cc.geomUtils && t && n.default.fromPoints(this._boundingBox, t._minPos, t._maxPos);
this._mesh && this._mesh.off("init-format", this._updateMeshAttribute, this);
t && t.on("init-format", this._updateMeshAttribute, this);
this._mesh = t;
this._assembler && (this._assembler._worldDatas = {});
this._updateMeshAttribute();
},
_getDefaultMaterial: function() {
return l.getBuiltinMaterial("unlit");
},
_validateRender: function() {
var t = this._mesh;
t && t._subDatas.length > 0 || this.disableRender();
},
_updateMaterial: function() {
var t = this.textures;
if (t && t.length > 0) for (var e = this._getDefaultMaterial(), i = 0; i < t.length; i++) {
var n = this._materials[i];
if (!n || n._uuid === e._uuid) {
if (!n) {
n = r.default.create(e, this);
this.setMaterial(i, n);
}
n.setProperty("diffuseTexture", t[i]);
}
}
this._updateReceiveShadow();
this._updateCastShadow();
this._updateMeshAttribute();
},
_updateReceiveShadow: function() {
for (var t = this.getMaterials(), e = 0; e < t.length; e++) t[e].define("CC_USE_SHADOW_MAP", this._receiveShadows, void 0, !0);
},
_updateCastShadow: function() {
for (var t = this.getMaterials(), e = 0; e < t.length; e++) t[e].define("CC_CASTING_SHADOW", this._shadowCastingMode === u.ON, void 0, !0);
},
_updateMeshAttribute: function() {
var t = this._mesh && this._mesh.subDatas;
if (t) {
for (var e = this.getMaterials(), n = 0; n < e.length && t[n]; n++) {
var r = t[n].vfm, s = e[n];
s.define("CC_USE_ATTRIBUTE_COLOR", !!r.element(i.default.ATTR_COLOR), void 0, !0);
s.define("CC_USE_ATTRIBUTE_UV0", !!r.element(i.default.ATTR_UV0), void 0, !0);
s.define("CC_USE_ATTRIBUTE_NORMAL", !!r.element(i.default.ATTR_NORMAL), void 0, !0);
s.define("CC_USE_ATTRIBUTE_TANGENT", !!r.element(i.default.ATTR_TANGENT), void 0, !0);
}
this._assembler.updateMeshData(this);
}
},
_checkBacth: function() {}
});
cc.MeshRenderer = e.exports = h;
}), {
"../../renderer/core/input-assembler": 359,
"../../renderer/gfx": 363,
"../assets/material/CCMaterial": 124,
"../assets/material/material-variant": 131,
"../components/CCRenderComponent": 160,
"../geom-utils/aabb": 190,
"../renderer": 271,
"../renderer/render-flow": 272,
"../value-types/mat4": 339,
"../value-types/vec3": 347,
"./CCMesh": 207
} ],
209: [ (function(t) {
"use strict";
t("./CCMesh");
t("./CCMeshRenderer");
t("./mesh-renderer");
}), {
"./CCMesh": 207,
"./CCMeshRenderer": 208,
"./mesh-renderer": 211
} ],
210: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.MeshData = l;
i.Primitive = i.VertexBundle = i.VertexFormat = i.BufferRange = void 0;
var n, r = (n = t("../../renderer/gfx")) && n.__esModule ? n : {
default: n
}, s = cc.Class({
name: "cc.BufferRange",
properties: {
offset: 0,
length: 0
}
});
i.BufferRange = s;
var o = cc.Class({
name: "cc.mesh.VertexFormat",
properties: {
name: "",
type: -1,
num: -1,
normalize: !1
}
});
i.VertexFormat = o;
var a = cc.Class({
name: "cc.mesh.VertexBundle",
properties: {
data: {
default: null,
type: s
},
formats: {
default: [],
type: o
},
verticesCount: 0
}
});
i.VertexBundle = a;
var c = cc.Class({
name: "cc.mesh.Primitive",
properties: {
vertexBundleIndices: {
default: [],
type: cc.Float
},
data: {
default: null,
type: s
},
indexUnit: r.default.INDEX_FMT_UINT16,
topology: r.default.PT_TRIANGLES
}
});
i.Primitive = c;
function l() {
this.vData = null;
this.float32VData = null;
this.uint32VData = null;
this.iData = null;
this.uint16IData = null;
this.vfm = null;
this.offset = 0;
this.vb = null;
this.ib = null;
this.vDirty = !1;
this.iDirty = !1;
this.enable = !0;
}
l.prototype.setVData = function(t) {
this.vData = t;
this.float32VData = null;
this.uint32VData = null;
};
l.prototype.getVData = function(t) {
if (t === Float32Array) {
this.float32VData || (this.float32VData = new Float32Array(this.vData.buffer, this.vData.byteOffset, this.vData.byteLength / 4));
return this.float32VData;
}
if (t === Uint32Array) {
this.uint32VData || (this.uint32VData = new Uint32Array(this.vData.buffer, this.vData.byteOffset, this.vData.byteLength / 4));
return this.uint32VData;
}
return this.vData;
};
l.prototype.getIData = function(t) {
if (t === Uint16Array) {
this.uint16IData || (this.uint16IData = new Uint16Array(this.iData.buffer, this.iData.byteOffset, this.iData.byteLength / 2));
return this.uint16IData;
}
return this.iData;
};
}), {
"../../renderer/gfx": 363
} ],
211: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = o(t("../renderer/assembler")), r = o(t("../../renderer/gfx")), s = o(t("../value-types/vec3"));
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
function a(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
c(t, e);
}
function c(t, e) {
return (c = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var l = t("./CCMeshRenderer"), u = new s.default(), h = (function(t) {
a(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.init = function(e) {
t.prototype.init.call(this, e);
this._worldDatas = {};
this._renderNode = null;
};
i.setRenderNode = function(t) {
this._renderNode = t;
};
i.fillBuffers = function(t, e) {
if (t.mesh) {
t.mesh._uploadData();
for (var i = e.cullingMask === t.node._cullingMask, n = t.enableAutoBatch, s = t._materials, o = t.mesh._subMeshes, a = t.mesh.subDatas, c = 0; c < o.length; c++) {
var l = o[c], u = a[c], h = s[c] || s[0];
if (n && u.canBatch && l._primitiveType === r.default.PT_TRIANGLES) {
i && h.getHash() === e.material.getHash() || e._flush();
e.material = h;
e.cullingMask = t.node._cullingMask;
e.node = e._dummyNode;
this._fillBuffer(t, u, e, c);
} else {
e._flush();
e.material = h;
e.cullingMask = t.node._cullingMask;
e.node = this._renderNode;
e._flushIA(l);
}
}
}
};
i._fillBuffer = function(t, e, i, n) {
var r = e.getVData(Float32Array), s = e.vfm, o = r.byteLength / s._bytes | 0, a = e.getIData(Uint16Array), c = a.length, l = i.getBuffer("mesh", s), u = l.request(o, c), h = u.indiceOffset, _ = u.byteOffset >> 2, f = u.vertexOffset, d = l._vData, p = l._iData;
!i.worldMatDirty && this._worldDatas[n] || this._updateWorldVertices(n, o, r, s, t.node._worldMatrix);
d.set(this._worldDatas[n], _);
for (var m = 0; m < c; m++) p[h + m] = f + a[m];
};
i._updateWorldVertices = function(t, e, i, n, o) {
var a = this._worldDatas[t];
a || (a = this._worldDatas[t] = new Float32Array(i.length)).set(i);
for (var c = n._bytes / 4, l = n._elements, h = 0, _ = l.length; h < _; h++) {
var f = l[h], d = f.offset / 4;
if (f.name === r.default.ATTR_POSITION || f.name === r.default.ATTR_NORMAL) for (var p = f.name === r.default.ATTR_NORMAL ? s.default.transformMat4Normal : s.default.transformMat4, m = 0; m < e; m++) {
var y = m * c + d;
u.x = i[y];
u.y = i[y + 1];
u.z = i[y + 2];
p(u, u, o);
a[y] = u.x;
a[y + 1] = u.y;
a[y + 2] = u.z;
}
}
};
i._drawDebugDatas = function(t, e, i) {
var n = t._debugDatas[i];
if (n) for (var r = 0; r < n.length; r++) {
var s = n[r];
if (s) {
var o = s.material;
e.material = o;
e._flushIA(s.ia);
}
}
};
return e;
})(n.default);
i.default = h;
n.default.register(l, h);
e.exports = i.default;
}), {
"../../renderer/gfx": 363,
"../renderer/assembler": 268,
"../value-types/vec3": 347,
"./CCMeshRenderer": 208
} ],
212: [ (function(t, e) {
"use strict";
var i = t("./component-scheduler"), n = t("./platform/CCObject").Flags, r = t("./platform/js"), s = n.IsPreloadStarted, o = n.IsOnLoadStarted, a = n.IsOnLoadCalled, c = n.Deactivating, l = cc.Class({
extends: i.LifeCycleInvoker,
add: function(t) {
this._zero.array.push(t);
},
remove: function(t) {
this._zero.fastRemove(t);
},
cancelInactive: function(t) {
i.LifeCycleInvoker.stableRemoveInactive(this._zero, t);
},
invoke: function() {
this._invoke(this._zero);
this._zero.array.length = 0;
}
}), u = i.createInvokeImpl("c.__preload();"), h = i.createInvokeImpl("c.onLoad();c._objFlags|=" + a, !1, a), _ = new r.Pool(4);
_.get = function() {
var t = this._get() || {
preload: new l(u),
onLoad: new i.OneOffInvoker(h),
onEnable: new i.OneOffInvoker(i.invokeOnEnable)
};
t.preload._zero.i = -1;
var e = t.onLoad;
e._zero.i = -1;
e._neg.i = -1;
e._pos.i = -1;
(e = t.onEnable)._zero.i = -1;
e._neg.i = -1;
e._pos.i = -1;
return t;
};
function f(t, e, i) {
e ? t._removeComponent(e) : r.array.removeAt(t._components, i);
}
function d() {
this._activatingStack = [];
}
var p = cc.Class({
ctor: d,
reset: d,
_activateNodeRecursively: function(t, e, i, n) {
if (t._objFlags & c) cc.errorID(3816, t.name); else {
t._activeInHierarchy = !0;
for (var r = t._components.length, s = 0; s < r; ++s) {
var o = t._components[s];
if (o instanceof cc.Component) this.activateComp(o, e, i, n); else {
f(t, o, s);
--s;
--r;
}
}
t._childArrivalOrder = t._children.length;
for (var a = 0, l = t._children.length; a < l; ++a) {
var u = t._children[a];
u._localZOrder = 4294901760 & u._localZOrder | a + 1;
u._active && this._activateNodeRecursively(u, e, i, n);
}
t._onPostActivated(!0);
}
},
_deactivateNodeRecursively: function(t) {
t._objFlags |= c;
t._activeInHierarchy = !1;
for (var e = t._components.length, i = 0; i < e; ++i) {
var n = t._components[i];
if (n._enabled) {
cc.director._compScheduler.disableComp(n);
if (t._activeInHierarchy) {
t._objFlags &= ~c;
return;
}
}
}
for (var r = 0, s = t._children.length; r < s; ++r) {
var o = t._children[r];
if (o._activeInHierarchy) {
this._deactivateNodeRecursively(o);
if (t._activeInHierarchy) {
t._objFlags &= ~c;
return;
}
}
}
t._onPostActivated(!1);
t._objFlags &= ~c;
},
activateNode: function(t, e) {
if (e) {
var i = _.get();
this._activatingStack.push(i);
this._activateNodeRecursively(t, i.preload, i.onLoad, i.onEnable);
i.preload.invoke();
i.onLoad.invoke();
i.onEnable.invoke();
this._activatingStack.pop();
_.put(i);
} else {
this._deactivateNodeRecursively(t);
for (var n = this._activatingStack, r = 0; r < n.length; r++) {
var a = n[r];
a.preload.cancelInactive(s);
a.onLoad.cancelInactive(o);
a.onEnable.cancelInactive();
}
}
t.emit("active-in-hierarchy-changed", t);
},
activateComp: function(t, e, i, n) {
if (cc.isValid(t, !0)) {
if (!(t._objFlags & s)) {
t._objFlags |= s;
t.__preload && (e ? e.add(t) : t.__preload());
}
if (!(t._objFlags & o)) {
t._objFlags |= o;
if (t.onLoad) if (i) i.add(t); else {
t.onLoad();
t._objFlags |= a;
} else t._objFlags |= a;
}
if (t._enabled) {
if (!t.node._activeInHierarchy) return;
cc.director._compScheduler.enableComp(t, n);
}
}
},
destroyComp: function(t) {
cc.director._compScheduler.disableComp(t);
t.onDestroy && t._objFlags & a && t.onDestroy();
},
resetComp: !1
});
e.exports = p;
}), {
"./component-scheduler": 143,
"./platform/CCObject": 245,
"./platform/js": 260,
"./utils/misc": 322
} ],
213: [ (function(t, e) {
"use strict";
var i = t("./CCPhysicsTypes").PTM_RATIO, n = t("./CCPhysicsTypes").ContactType, r = [], s = [ cc.v2(), cc.v2() ], o = new b2.WorldManifold(), a = {
points: [],
separations: [],
normal: cc.v2()
};
function c() {
this.localPoint = cc.v2();
this.normalImpulse = 0;
this.tangentImpulse = 0;
}
var l = [ new c(), new c() ], u = (new b2.Manifold(), {
type: 0,
localPoint: cc.v2(),
localNormal: cc.v2(),
points: []
}), h = {
normalImpulses: [],
tangentImpulses: []
};
function _() {}
_.prototype.init = function(t) {
this.colliderA = t.GetFixtureA().collider;
this.colliderB = t.GetFixtureB().collider;
this.disabled = !1;
this.disabledOnce = !1;
this._impulse = null;
this._inverted = !1;
this._b2contact = t;
t._contact = this;
};
_.prototype.reset = function() {
this.setTangentSpeed(0);
this.resetFriction();
this.resetRestitution();
this.colliderA = null;
this.colliderB = null;
this.disabled = !1;
this._impulse = null;
this._b2contact._contact = null;
this._b2contact = null;
};
_.prototype.getWorldManifold = function() {
var t = a.points, e = a.separations, n = a.normal;
this._b2contact.GetWorldManifold(o);
var r = o.points, c = o.separations, l = this._b2contact.GetManifold().pointCount;
t.length = e.length = l;
for (var u = 0; u < l; u++) {
var h = s[u];
h.x = r[u].x * i;
h.y = r[u].y * i;
t[u] = h;
e[u] = c[u] * i;
}
n.x = o.normal.x;
n.y = o.normal.y;
if (this._inverted) {
n.x *= -1;
n.y *= -1;
}
return a;
};
_.prototype.getManifold = function() {
for (var t = u.points, e = u.localNormal, n = u.localPoint, r = this._b2contact.GetManifold(), s = r.points, o = t.length = r.pointCount, a = 0; a < o; a++) {
var c = l[a], h = s[a];
c.localPoint.x = h.localPoint.x * i;
c.localPoint.Y = h.localPoint.Y * i;
c.normalImpulse = h.normalImpulse * i;
c.tangentImpulse = h.tangentImpulse;
t[a] = c;
}
n.x = r.localPoint.x * i;
n.y = r.localPoint.y * i;
e.x = r.localNormal.x;
e.y = r.localNormal.y;
u.type = r.type;
if (this._inverted) {
e.x *= -1;
e.y *= -1;
}
return u;
};
_.prototype.getImpulse = function() {
var t = this._impulse;
if (!t) return null;
for (var e = h.normalImpulses, n = h.tangentImpulses, r = t.count, s = 0; s < r; s++) {
e[s] = t.normalImpulses[s] * i;
n[s] = t.tangentImpulses[s];
}
n.length = e.length = r;
return h;
};
_.prototype.emit = function(t) {
var e;
switch (t) {
case n.BEGIN_CONTACT:
e = "onBeginContact";
break;

case n.END_CONTACT:
e = "onEndContact";
break;

case n.PRE_SOLVE:
e = "onPreSolve";
break;

case n.POST_SOLVE:
e = "onPostSolve";
}
var i, r, s, o, a = this.colliderA, c = this.colliderB, l = a.body, u = c.body;
if (l.enabledContactListener) {
i = l.node._components;
this._inverted = !1;
for (r = 0, s = i.length; r < s; r++) (o = i[r])[e] && o[e](this, a, c);
}
if (u.enabledContactListener) {
i = u.node._components;
this._inverted = !0;
for (r = 0, s = i.length; r < s; r++) (o = i[r])[e] && o[e](this, c, a);
}
if (this.disabled || this.disabledOnce) {
this.setEnabled(!1);
this.disabledOnce = !1;
}
};
_.get = function(t) {
var e;
(e = 0 === r.length ? new cc.PhysicsContact() : r.pop()).init(t);
return e;
};
_.put = function(t) {
var e = t._contact;
if (e) {
r.push(e);
e.reset();
}
};
var f = _.prototype;
f.setEnabled = function(t) {
this._b2contact.SetEnabled(t);
};
f.isTouching = function() {
return this._b2contact.IsTouching();
};
f.setTangentSpeed = function(t) {
this._b2contact.SetTangentSpeed(t / i);
};
f.getTangentSpeed = function() {
return this._b2contact.GetTangentSpeed() * i;
};
f.setFriction = function(t) {
this._b2contact.SetFriction(t);
};
f.getFriction = function() {
return this._b2contact.GetFriction();
};
f.resetFriction = function() {
return this._b2contact.ResetFriction();
};
f.setRestitution = function(t) {
this._b2contact.SetRestitution(t);
};
f.getRestitution = function() {
return this._b2contact.GetRestitution();
};
f.resetRestitution = function() {
return this._b2contact.ResetRestitution();
};
_.ContactType = n;
cc.PhysicsContact = e.exports = _;
}), {
"./CCPhysicsTypes": 215
} ],
214: [ (function(t, e) {
"use strict";
var i = t("./CCPhysicsTypes"), n = i.ContactType, r = i.BodyType, s = i.RayCastType, o = i.DrawBits, a = i.PTM_RATIO, c = (i.ANGLE_TO_PHYSICS_ANGLE, 
i.PHYSICS_ANGLE_TO_ANGLE), l = t("./utils").convertToNodeRotation, u = t("./platform/CCPhysicsDebugDraw"), h = new b2.AABB(), _ = new b2.Vec2(), f = new b2.Vec2(), d = cc.v2(), p = cc.Class({
mixins: [ cc.EventTarget ],
statics: {
DrawBits: o,
PTM_RATIO: a,
VELOCITY_ITERATIONS: 10,
POSITION_ITERATIONS: 10,
FIXED_TIME_STEP: 1 / 60,
MAX_ACCUMULATOR: .2
},
ctor: function() {
this._debugDrawFlags = 0;
this._debugDrawer = null;
this._world = null;
this._bodies = [];
this._joints = [];
this._contactMap = {};
this._contactID = 0;
this._delayEvents = [];
this._accumulator = 0;
cc.director._scheduler && cc.director._scheduler.enableForTarget(this);
this.enabledAccumulator = !1;
},
pushDelayEvent: function(t, e, i) {
this._steping ? this._delayEvents.push({
target: t,
func: e,
args: i
}) : t[e].apply(t, i);
},
update: function(t) {
var e = this._world;
if (e && this.enabled) {
this.emit("before-step");
this._steping = !0;
var i = p.VELOCITY_ITERATIONS, n = p.POSITION_ITERATIONS;
if (this.enabledAccumulator) {
this._accumulator += t;
var r = p.FIXED_TIME_STEP, s = p.MAX_ACCUMULATOR;
this._accumulator > s && (this._accumulator = s);
for (;this._accumulator > r; ) {
e.Step(r, i, n);
this._accumulator -= r;
}
} else {
var o = 1 / cc.game.config.frameRate;
e.Step(o, i, n);
}
if (this.debugDrawFlags) {
this._checkDebugDrawValid();
this._debugDrawer.clear();
e.DrawDebugData();
}
this._steping = !1;
for (var a = this._delayEvents, c = 0, l = a.length; c < l; c++) {
var u = a[c];
u.target[u.func].apply(u.target, u.args);
}
a.length = 0;
this._syncNode();
}
},
testPoint: function(t) {
var e = _.x = t.x / a, i = _.y = t.y / a, n = .2 / a;
h.lowerBound.x = e - n;
h.lowerBound.y = i - n;
h.upperBound.x = e + n;
h.upperBound.y = i + n;
var r = this._aabbQueryCallback;
r.init(_);
this._world.QueryAABB(r, h);
var s = r.getFixture();
return s ? s.collider : null;
},
testAABB: function(t) {
h.lowerBound.x = t.xMin / a;
h.lowerBound.y = t.yMin / a;
h.upperBound.x = t.xMax / a;
h.upperBound.y = t.yMax / a;
var e = this._aabbQueryCallback;
e.init();
this._world.QueryAABB(e, h);
return e.getFixtures().map((function(t) {
return t.collider;
}));
},
rayCast: function(t, e, i) {
if (t.equals(e)) return [];
i = i || s.Closest;
_.x = t.x / a;
_.y = t.y / a;
f.x = e.x / a;
f.y = e.y / a;
var n = this._raycastQueryCallback;
n.init(i);
this._world.RayCast(n, _, f);
var r = n.getFixtures();
if (r.length > 0) {
for (var o = n.getPoints(), c = n.getNormals(), l = n.getFractions(), u = [], h = 0, d = r.length; h < d; h++) {
var p = r[h], m = p.collider;
if (i === s.AllClosest) {
var y = u.find((function(t) {
return t.collider === m;
}));
if (y) {
if (l[h] < y.fraction) {
y.fixtureIndex = m._getFixtureIndex(p);
y.point.x = o[h].x * a;
y.point.y = o[h].y * a;
y.normal.x = c[h].x;
y.normal.y = c[h].y;
y.fraction = l[h];
}
continue;
}
}
u.push({
collider: m,
fixtureIndex: m._getFixtureIndex(p),
point: cc.v2(o[h].x * a, o[h].y * a),
normal: cc.v2(c[h]),
fraction: l[h]
});
}
return u;
}
return [];
},
syncPosition: function() {
for (var t = this._bodies, e = 0; e < t.length; e++) t[e].syncPosition();
},
syncRotation: function() {
for (var t = this._bodies, e = 0; e < t.length; e++) t[e].syncRotation();
},
_registerContactFixture: function(t) {
this._contactListener.registerContactFixture(t);
},
_unregisterContactFixture: function(t) {
this._contactListener.unregisterContactFixture(t);
},
_addBody: function(t, e) {
var i = this._world, n = t.node;
if (i && n) {
t._b2Body = i.CreateBody(e);
t._b2Body.body = t;
this._bodies.push(t);
}
},
_removeBody: function(t) {
var e = this._world;
if (e) {
t._b2Body.body = null;
e.DestroyBody(t._b2Body);
t._b2Body = null;
cc.js.array.remove(this._bodies, t);
}
},
_addJoint: function(t, e) {
var i = this._world.CreateJoint(e);
if (i) {
i._joint = t;
t._joint = i;
this._joints.push(t);
}
},
_removeJoint: function(t) {
t._isValid() && this._world.DestroyJoint(t._joint);
t._joint && (t._joint._joint = null);
cc.js.array.remove(this._joints, t);
},
_initCallback: function() {
if (this._world) {
if (!this._contactListener) {
var t = new cc.PhysicsContactListener();
t.setBeginContact(this._onBeginContact);
t.setEndContact(this._onEndContact);
t.setPreSolve(this._onPreSolve);
t.setPostSolve(this._onPostSolve);
this._world.SetContactListener(t);
this._contactListener = t;
this._aabbQueryCallback = new cc.PhysicsAABBQueryCallback();
this._raycastQueryCallback = new cc.PhysicsRayCastCallback();
}
} else cc.warn("Please init PhysicsManager first");
},
_init: function() {
this.enabled = !0;
this.debugDrawFlags = o.e_shapeBit;
},
_getWorld: function() {
return this._world;
},
_syncNode: function() {
for (var t = this._bodies, e = 0, i = t.length; e < i; e++) {
var n = t[e], s = n.node, o = n._b2Body, u = o.GetPosition();
d.x = u.x * a;
d.y = u.y * a;
var h = o.GetAngle() * c;
if (null !== s.parent.parent) {
d = s.parent.convertToNodeSpaceAR(d);
h = l(s.parent, h);
}
var _ = s._eventMask;
s._eventMask = 0;
s.position = d;
s.angle = -h;
s._eventMask = _;
n.type === r.Animated && n.resetVelocity();
}
},
_onBeginContact: function(t) {
cc.PhysicsContact.get(t).emit(n.BEGIN_CONTACT);
},
_onEndContact: function(t) {
var e = t._contact;
if (e) {
e.emit(n.END_CONTACT);
cc.PhysicsContact.put(t);
}
},
_onPreSolve: function(t) {
var e = t._contact;
e && e.emit(n.PRE_SOLVE);
},
_onPostSolve: function(t, e) {
var i = t._contact;
if (i) {
i._impulse = e;
i.emit(n.POST_SOLVE);
i._impulse = null;
}
},
_checkDebugDrawValid: function() {
if (!this._debugDrawer || !this._debugDrawer.isValid) {
var t = new cc.Node("PHYSICS_MANAGER_DEBUG_DRAW");
t.zIndex = cc.macro.MAX_ZINDEX;
cc.game.addPersistRootNode(t);
this._debugDrawer = t.addComponent(cc.Graphics);
var e = new u(this._debugDrawer);
e.SetFlags(this.debugDrawFlags);
this._world.SetDebugDraw(e);
}
}
});
cc.js.getset(p.prototype, "enabled", (function() {
return this._enabled;
}), (function(t) {
if (t && !this._world) {
var e = new b2.World(new b2.Vec2(0, -10));
e.SetAllowSleeping(!0);
this._world = e;
this._initCallback();
}
this._enabled = t;
}));
cc.js.getset(p.prototype, "debugDrawFlags", (function() {
return this._debugDrawFlags;
}), (function(t) {
t && !this._debugDrawFlags ? this._debugDrawer && this._debugDrawer.node && (this._debugDrawer.node.active = !0) : !t && this._debugDrawFlags && this._debugDrawer && this._debugDrawer.node && (this._debugDrawer.node.active = !1);
if (t) {
this._checkDebugDrawValid();
this._world.m_debugDraw.SetFlags(t);
}
this._debugDrawFlags = t;
if (t) {
this._checkDebugDrawValid();
this._world.m_debugDraw.SetFlags(t);
}
}));
cc.js.getset(p.prototype, "gravity", (function() {
if (this._world) {
var t = this._world.GetGravity();
return cc.v2(t.x * a, t.y * a);
}
return cc.v2();
}), (function(t) {
this._world && this._world.SetGravity(new b2.Vec2(t.x / a, t.y / a));
}));
cc.PhysicsManager = e.exports = p;
}), {
"./CCPhysicsTypes": 215,
"./platform/CCPhysicsDebugDraw": 236,
"./utils": 238
} ],
215: [ (function(t, e) {
"use strict";
var i = cc.Enum({
Static: 0,
Kinematic: 1,
Dynamic: 2,
Animated: 3
});
cc.RigidBodyType = i;
var n = cc.Enum({
Closest: 0,
Any: 1,
AllClosest: 2,
All: 3
});
cc.RayCastType = n;
e.exports = {
BodyType: i,
ContactType: {
BEGIN_CONTACT: "begin-contact",
END_CONTACT: "end-contact",
PRE_SOLVE: "pre-solve",
POST_SOLVE: "post-solve"
},
RayCastType: n,
DrawBits: b2.DrawFlags,
PTM_RATIO: 32,
ANGLE_TO_PHYSICS_ANGLE: -Math.PI / 180,
PHYSICS_ANGLE_TO_ANGLE: -180 / Math.PI
};
}), {} ],
216: [ (function(t, e) {
"use strict";
function i(t, e) {
var i = e.length;
return e[t < 0 ? i - -t % i : t % i];
}
function n(t, e, n) {
for (var r = []; e < t; ) e += n.length;
for (;t <= e; ++t) r.push(i(t, n));
return r;
}
function r(t, e, n) {
if (s(t, n)) {
if (c(i(t, n), i(t - 1, n), i(e, n)) && l(i(t, n), i(t + 1, n), i(e, n))) return !1;
} else if (l(i(t, n), i(t + 1, n), i(e, n)) || c(i(t, n), i(t - 1, n), i(e, n))) return !1;
if (s(e, n)) {
if (c(i(e, n), i(e - 1, n), i(t, n)) && l(i(e, n), i(e + 1, n), i(t, n))) return !1;
} else if (l(i(e, n), i(e + 1, n), i(t, n)) || c(i(e, n), i(e - 1, n), i(t, n))) return !1;
for (var r = 0; r < n.length; ++r) if ((r + 1) % n.length != t && r != t && (r + 1) % n.length != e && r != e) {
var o = cc.v2();
if (p(i(t, n), i(e, n), i(r, n), i(r + 1, n), o)) return !1;
}
return !0;
}
function s(t, e) {
return o(t, e);
}
function o(t, e, n) {
if ("undefined" == typeof n) {
var r = t, s = e;
t = i(r - 1, s);
e = i(r, s);
n = i(r + 1, s);
}
return m(t, e, n) < 0;
}
function a(t, e, i) {
return m(t, e, i) > 0;
}
function c(t, e, i) {
return m(t, e, i) >= 0;
}
function l(t, e, i) {
return m(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 h(t) {
_(t) || t.reverse();
}
function _(t) {
return t.length < 3 || f(t) > 0;
}
function f(t) {
var e, i = 0;
for (e = 0; e < t.length; e++) {
var n = (e + 1) % t.length;
i += t[e].x * t[n].y;
i -= t[e].y * t[n].x;
}
return i / 2;
}
function d(t, e, i, n) {
var r, s = cc.v2(), o = e.y - t.y, a = t.x - e.x, c = o * t.x + a * t.y, l = n.y - i.y, u = i.x - n.x, h = l * i.x + u * i.y, _ = o * u - l * a;
if (!(r = _, 0, Math.abs(r - 0) <= 1e-6)) {
s.x = (u * c - a * h) / _;
s.y = (o * h - l * c) / _;
}
return s;
}
function p(t, e, i, n, r) {
if (t == i || t == n || e == i || e == n) return !1;
var s = t.x, o = t.y, a = e.x, c = e.y, l = i.x, u = i.y, h = n.x, _ = n.y;
if (Math.max(s, a) < Math.min(l, h) || Math.max(l, h) < Math.min(s, a)) return !1;
if (Math.max(o, c) < Math.min(u, _) || Math.max(u, _) < Math.min(o, c)) return !1;
var f = (h - l) * (o - u) - (_ - u) * (s - l), d = (a - s) * (o - u) - (c - o) * (s - l), p = (_ - u) * (a - s) - (h - l) * (c - o);
if (Math.abs(p) < 1e-6) return !1;
d /= p;
if (0 < (f /= p) && f < 1 && 0 < d && d < 1) {
r.x = s + f * (a - s);
r.y = o + f * (c - o);
return !0;
}
return !1;
}
function m(t, e, i) {
return t.x * (e.y - i.y) + e.x * (i.y - t.y) + i.x * (t.y - e.y);
}
e.exports = {
ConvexPartition: function t(e) {
h(e);
for (var _, f, p, m, y, v, g = [], b = cc.v2(), C = cc.v2(), x = 0, A = 0, S = 0; S < e.length; ++S) if (s(S, e)) {
f = p = 1e8;
for (var T = 0; T < e.length; ++T) {
if (a(i(S - 1, e), i(S, e), i(T, e)) && l(i(S - 1, e), i(S, e), i(T - 1, e))) {
m = d(i(S - 1, e), i(S, e), i(T, e), i(T - 1, e));
if (o(i(S + 1, e), i(S, e), m) && (_ = u(i(S, e), m)) < f) {
f = _;
b = m;
x = T;
}
}
if (a(i(S + 1, e), i(S, e), i(T + 1, e)) && l(i(S + 1, e), i(S, e), i(T, e))) {
m = d(i(S + 1, e), i(S, e), i(T, e), i(T + 1, e));
if (a(i(S - 1, e), i(S, e), m) && (_ = u(i(S, e), m)) < p) {
p = _;
A = T;
C = m;
}
}
}
if (x == (A + 1) % e.length) {
var w = b.add(C).div(2);
(y = n(S, A, e)).push(w);
(v = n(x, S, e)).push(w);
} else {
for (var E = 0, M = x; A < x; ) A += e.length;
for (T = x; T <= A; ++T) if (r(S, T, e)) {
var B = 1 / (u(i(S, e), i(T, e)) + 1);
s(T, e) ? l(i(T - 1, e), i(T, e), i(S, e)) && c(i(T + 1, e), i(T, e), i(S, e)) ? B += 3 : B += 2 : B += 1;
if (B > E) {
M = T;
E = B;
}
}
y = n(S, M, e);
v = n(M, S, e);
}
return (g = g.concat(t(y))).concat(t(v));
}
g.push(e);
for (S = g.length - 1; S >= 0; S--) 0 == g[S].length && g.splice(S, 0);
return g;
},
ForceCounterClockWise: h,
IsCounterClockWise: _
};
}), {} ],
217: [ (function(t, e) {
"use strict";
var i = t("../CCNode").EventType, n = t("./CCPhysicsTypes").PTM_RATIO, r = t("./CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE, s = t("./CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE, o = t("./utils").getWorldRotation, a = t("./CCPhysicsTypes").BodyType, c = new b2.Vec2(), l = new b2.Vec2(), u = cc.Vec2.ZERO, h = cc.Class({
name: "cc.RigidBody",
extends: cc.Component,
editor: !1,
properties: {
_type: a.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: a,
tooltip: !1,
get: function() {
return this._type;
},
set: function(t) {
this._type = t;
this._b2Body && (t === a.Animated ? this._b2Body.SetType(a.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 * n;
t.y = e.y * n;
}
return t;
},
set: function(t) {
this._linearVelocity = t;
var e = this._b2Body;
if (e) {
var i = e.m_linearVelocity;
i.Set(t.x / n, t.y / n);
e.SetLinearVelocity(i);
}
}
},
angularVelocity: {
tooltip: !1,
get: function() {
return this._b2Body ? this._b2Body.GetAngularVelocity() * s : this._angularVelocity;
},
set: function(t) {
this._angularVelocity = t;
this._b2Body && this._b2Body.SetAngularVelocity(t * r);
}
},
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) {
e = e || cc.v2();
if (this._b2Body) {
c.Set(t.x / n, t.y / n);
var i = this._b2Body.GetLocalPoint(c, e);
e.x = i.x * n;
e.y = i.y * n;
}
return e;
},
getWorldPoint: function(t, e) {
e = e || cc.v2();
if (this._b2Body) {
c.Set(t.x / n, t.y / n);
var i = this._b2Body.GetWorldPoint(c, e);
e.x = i.x * n;
e.y = i.y * n;
}
return e;
},
getWorldVector: function(t, e) {
e = e || cc.v2();
if (this._b2Body) {
c.Set(t.x / n, t.y / n);
var i = this._b2Body.GetWorldVector(c, e);
e.x = i.x * n;
e.y = i.y * n;
}
return e;
},
getLocalVector: function(t, e) {
e = e || cc.v2();
if (this._b2Body) {
c.Set(t.x / n, t.y / n);
var i = this._b2Body.GetLocalVector(c, e);
e.x = i.x * n;
e.y = i.y * n;
}
return e;
},
getWorldPosition: function(t) {
t = t || cc.v2();
if (this._b2Body) {
var e = this._b2Body.GetPosition();
t.x = e.x * n;
t.y = e.y * n;
}
return t;
},
getWorldRotation: function() {
return this._b2Body ? this._b2Body.GetAngle() * s : 0;
},
getLocalCenter: function(t) {
t = t || cc.v2();
if (this._b2Body) {
var e = this._b2Body.GetLocalCenter();
t.x = e.x * n;
t.y = e.y * n;
}
return t;
},
getWorldCenter: function(t) {
t = t || cc.v2();
if (this._b2Body) {
var e = this._b2Body.GetWorldCenter();
t.x = e.x * n;
t.y = e.y * n;
}
return t;
},
getLinearVelocityFromWorldPoint: function(t, e) {
e = e || cc.v2();
if (this._b2Body) {
c.Set(t.x / n, t.y / n);
var i = this._b2Body.GetLinearVelocityFromWorldPoint(c, e);
e.x = i.x * n;
e.y = i.y * n;
}
return e;
},
getMass: function() {
return this._b2Body ? this._b2Body.GetMass() : 0;
},
getInertia: function() {
return this._b2Body ? this._b2Body.GetInertia() * n * n : 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) {
if (this._b2Body) {
c.Set(t.x / n, t.y / n);
l.Set(e.x / n, e.y / n);
this._b2Body.ApplyForce(c, l, i);
}
},
applyForceToCenter: function(t, e) {
if (this._b2Body) {
c.Set(t.x / n, t.y / n);
this._b2Body.ApplyForceToCenter(c, e);
}
},
applyTorque: function(t, e) {
this._b2Body && this._b2Body.ApplyTorque(t / n, e);
},
applyLinearImpulse: function(t, e, i) {
if (this._b2Body) {
c.Set(t.x / n, t.y / n);
l.Set(e.x / n, e.y / n);
this._b2Body.ApplyLinearImpulse(c, l, i);
}
},
applyAngularImpulse: function(t, e) {
this._b2Body && this._b2Body.ApplyAngularImpulse(t / n / n, e);
},
syncPosition: function(t) {
var e = this._b2Body;
if (e) {
var i, r = this.node.convertToWorldSpaceAR(u);
(i = this.type === a.Animated ? e.GetLinearVelocity() : e.GetPosition()).x = r.x / n;
i.y = r.y / n;
if (this.type === a.Animated && t) {
var s = e.GetPosition(), o = cc.game.config.frameRate;
i.x = (i.x - s.x) * o;
i.y = (i.y - s.y) * o;
e.SetAwake(!0);
e.SetLinearVelocity(i);
} else e.SetTransformVec(i, e.GetAngle());
}
},
syncRotation: function(t) {
var e = this._b2Body;
if (e) {
var i = r * o(this.node);
if (this.type === a.Animated && t) {
var n = e.GetAngle(), s = cc.game.config.frameRate;
e.SetAwake(!0);
e.SetAngularVelocity((i - n) * s);
} 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(i.POSITION_CHANGED, this._onNodePositionChanged, this);
t.on(i.ROTATION_CHANGED, this._onNodeRotationChanged, this);
t.on(i.SCALE_CHANGED, this._onNodeScaleChanged, this);
},
_unregisterNodeEvents: function() {
var t = this.node;
t.off(i.POSITION_CHANGED, this._onNodePositionChanged, this);
t.off(i.ROTATION_CHANGED, this._onNodeRotationChanged, this);
t.off(i.SCALE_CHANGED, this._onNodeScaleChanged, this);
},
_onNodePositionChanged: function() {
this.syncPosition(!0);
},
_onNodeRotationChanged: function() {
this.syncRotation(!0);
},
_onNodeScaleChanged: function() {
if (this._b2Body) for (var t = this.getComponents(cc.PhysicsCollider), e = 0; e < t.length; e++) t[e].apply();
},
_init: function() {
cc.director.getPhysicsManager().pushDelayEvent(this, "__init", []);
},
_destroy: function() {
cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", []);
},
__init: function() {
if (!this._inited) {
this._registerNodeEvents();
var t = new b2.BodyDef();
this.type === a.Animated ? t.type = a.Kinematic : t.type = this.type;
t.allowSleep = this.allowSleep;
t.gravityScale = this.gravityScale;
t.linearDamping = this.linearDamping;
t.angularDamping = this.angularDamping;
var e = this.linearVelocity;
t.linearVelocity = new b2.Vec2(e.x / n, e.y / n);
t.angularVelocity = this.angularVelocity * r;
t.fixedRotation = this.fixedRotation;
t.bullet = this.bullet;
var i = this.node, s = i.convertToWorldSpaceAR(u);
t.position = new b2.Vec2(s.x / n, s.y / n);
t.angle = -Math.PI / 180 * o(i);
t.awake = this.awakeOnLoad;
cc.director.getPhysicsManager()._addBody(this, t);
this._inited = !0;
}
},
__destroy: function() {
if (this._inited) {
cc.director.getPhysicsManager()._removeBody(this);
this._unregisterNodeEvents();
this._inited = !1;
}
},
_getBody: function() {
return this._b2Body;
}
});
cc.RigidBody = e.exports = h;
}), {
"../CCNode": 72,
"./CCPhysicsTypes": 215,
"./utils": 238
} ],
218: [ (function(t) {
"use strict";
var e = t("../../../external/box2d/box2d");
window.b2 = {};
for (var i in e) if (-1 === i.indexOf("b2_")) {
var n = i.replace("b2", "");
b2[n] = e[i];
}
b2.maxPolygonVertices = 8;
}), {
"../../../external/box2d/box2d": 398
} ],
219: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = cc.Class({
name: "cc.PhysicsBoxCollider",
extends: cc.PhysicsCollider,
mixins: [ cc.Collider.Box ],
editor: {
menu: !1,
requireComponent: cc.RigidBody
},
_createShape: function(t) {
var e = Math.abs(t.x), n = Math.abs(t.y), r = this.size.width / 2 / i * e, s = this.size.height / 2 / i * n, o = this.offset.x / i * e, a = this.offset.y / i * n, c = new b2.PolygonShape();
c.SetAsBox(r, s, new b2.Vec2(o, a), 0);
return c;
}
});
cc.PhysicsBoxCollider = e.exports = n;
}), {
"../CCPhysicsTypes": 215
} ],
220: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = cc.Class({
name: "cc.PhysicsChainCollider",
extends: cc.PhysicsCollider,
editor: {
menu: !1,
inspector: !1,
requireComponent: cc.RigidBody
},
properties: {
loop: !1,
points: {
default: function() {
return [ cc.v2(-50, 0), cc.v2(50, 0) ];
},
type: [ cc.Vec2 ]
},
threshold: {
default: 1,
serializable: !1,
visible: !1
}
},
_createShape: function(t) {
for (var e = new b2.ChainShape(), n = this.points, r = [], s = 0; s < n.length; s++) {
var o = n[s];
r.push(new b2.Vec2(o.x / i * t.x, o.y / i * t.y));
}
this.loop ? e.CreateLoop(r, r.length) : e.CreateChain(r, r.length);
return e;
},
resetInEditor: !1,
resetPointsByContour: !1
});
cc.PhysicsChainCollider = e.exports = n;
}), {
"../CCPhysicsTypes": 215
} ],
221: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = cc.Class({
name: "cc.PhysicsCircleCollider",
extends: cc.PhysicsCollider,
mixins: [ cc.Collider.Circle ],
editor: {
menu: !1,
requireComponent: cc.RigidBody
},
_createShape: function(t) {
var e = Math.abs(t.x), n = Math.abs(t.y), r = this.offset.x / i * e, s = this.offset.y / i * n, o = new b2.CircleShape();
o.m_radius = this.radius / i * e;
o.m_p = new b2.Vec2(r, s);
return o;
}
});
cc.PhysicsCircleCollider = e.exports = n;
}), {
"../CCPhysicsTypes": 215
} ],
222: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = t("../utils").getWorldScale, r = new b2.AABB(), s = cc.Class({
name: "cc.PhysicsCollider",
extends: cc.Collider,
ctor: function() {
this._fixtures = [];
this._shapes = [];
this._inited = !1;
this._rect = cc.rect();
},
properties: {
_density: 1,
_sensor: !1,
_friction: .2,
_restitution: 0,
density: {
tooltip: !1,
get: function() {
return this._density;
},
set: function(t) {
this._density = t;
}
},
sensor: {
tooltip: !1,
get: function() {
return this._sensor;
},
set: function(t) {
this._sensor = t;
}
},
friction: {
tooltip: !1,
get: function() {
return this._friction;
},
set: function(t) {
this._friction = t;
}
},
restitution: {
tooltip: !1,
get: function() {
return this._restitution;
},
set: function(t) {
this._restitution = t;
}
},
body: {
default: null,
type: cc.RigidBody,
visible: !1
}
},
onDisable: function() {
this._destroy();
},
onEnable: function() {
this._init();
},
start: function() {
this._init();
},
_getFixtureIndex: function(t) {
return this._fixtures.indexOf(t);
},
_init: function() {
cc.director.getPhysicsManager().pushDelayEvent(this, "__init", []);
},
_destroy: function() {
cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", []);
},
__init: function() {
if (!this._inited) {
var t = this.body || this.getComponent(cc.RigidBody);
if (t) {
var e = t._getBody();
if (e) {
var i = t.node, r = n(i);
this._scale = r;
var s = 0 === r.x && 0 === r.y ? [] : this._createShape(r);
s instanceof Array || (s = [ s ]);
for (var o = 1 << i.groupIndex, a = 0, c = cc.game.collisionMatrix[i.groupIndex], l = 0; l < c.length; l++) c[l] && (a |= 1 << l);
for (var u = {
categoryBits: o,
maskBits: a,
groupIndex: 0
}, h = cc.director.getPhysicsManager(), _ = 0; _ < s.length; _++) {
var f = s[_], d = new b2.FixtureDef();
d.density = this.density;
d.isSensor = this.sensor;
d.friction = this.friction;
d.restitution = this.restitution;
d.shape = f;
d.filter = u;
var p = e.CreateFixture(d);
p.collider = this;
t.enabledContactListener && h._registerContactFixture(p);
this._shapes.push(f);
this._fixtures.push(p);
}
this.body = t;
this._inited = !0;
}
}
}
},
__destroy: function() {
if (this._inited) {
for (var t = this._fixtures, e = this.body._getBody(), i = cc.director.getPhysicsManager(), n = t.length - 1; n >= 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, n = -1e7, s = -1e7, o = this.body._getBody().GetTransform(), a = this._fixtures, c = 0; c < a.length; c++) for (var l = a[c].GetShape(), u = l.GetChildCount(), h = 0; h < u; h++) {
l.ComputeAABB(r, o, h);
r.lowerBound.x < t && (t = r.lowerBound.x);
r.lowerBound.y < e && (e = r.lowerBound.y);
r.upperBound.x > n && (n = r.upperBound.x);
r.upperBound.y > s && (s = r.upperBound.y);
}
t *= i;
e *= i;
n *= i;
s *= i;
var _ = this._rect;
_.x = t;
_.y = e;
_.width = n - t;
_.height = s - e;
return _;
}
});
cc.PhysicsCollider = e.exports = s;
}), {
"../CCPhysicsTypes": 215,
"../utils": 238
} ],
223: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = t("../CCPolygonSeparator"), r = 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 = [], r = this.points;
r.length > 0 && r[0].equals(r[r.length - 1]) && (r.length -= 1);
for (var s = n.ConvexPartition(r), o = this.offset, a = 0; a < s.length; a++) {
for (var c = s[a], l = null, u = [], h = null, _ = 0, f = c.length; _ < f; _++) {
l || (l = new b2.PolygonShape());
var d = c[_], p = (d.x + o.x) / i * t.x, m = (d.y + o.y) / i * t.y, y = new b2.Vec2(p, m);
u.push(y);
h || (h = y);
if (u.length === b2.maxPolygonVertices) {
l.Set(u, u.length);
e.push(l);
l = null;
_ < f - 1 && (u = [ h, u[u.length - 1] ]);
}
}
if (l) {
l.Set(u, u.length);
e.push(l);
}
}
return e;
}
});
cc.PhysicsPolygonCollider = e.exports = r;
}), {
"../CCPhysicsTypes": 215,
"../CCPolygonSeparator": 216
} ],
224: [ (function(t) {
"use strict";
t("./box2d-adapter");
t("./CCPhysicsManager");
t("./CCRigidBody");
t("./CCPhysicsContact");
t("./collider/CCPhysicsCollider");
t("./collider/CCPhysicsChainCollider");
t("./collider/CCPhysicsCircleCollider");
t("./collider/CCPhysicsBoxCollider");
t("./collider/CCPhysicsPolygonCollider");
t("./joint/CCJoint");
t("./joint/CCDistanceJoint");
t("./joint/CCRevoluteJoint");
t("./joint/CCMouseJoint");
t("./joint/CCMotorJoint");
t("./joint/CCPrismaticJoint");
t("./joint/CCWeldJoint");
t("./joint/CCWheelJoint");
t("./joint/CCRopeJoint");
t("./platform/CCPhysicsContactListner");
t("./platform/CCPhysicsAABBQueryCallback");
t("./platform/CCPhysicsRayCastCallback");
}), {
"./CCPhysicsContact": 213,
"./CCPhysicsManager": 214,
"./CCRigidBody": 217,
"./box2d-adapter": 218,
"./collider/CCPhysicsBoxCollider": 219,
"./collider/CCPhysicsChainCollider": 220,
"./collider/CCPhysicsCircleCollider": 221,
"./collider/CCPhysicsCollider": 222,
"./collider/CCPhysicsPolygonCollider": 223,
"./joint/CCDistanceJoint": 225,
"./joint/CCJoint": 226,
"./joint/CCMotorJoint": 227,
"./joint/CCMouseJoint": 228,
"./joint/CCPrismaticJoint": 229,
"./joint/CCRevoluteJoint": 230,
"./joint/CCRopeJoint": 231,
"./joint/CCWeldJoint": 232,
"./joint/CCWheelJoint": 233,
"./platform/CCPhysicsAABBQueryCallback": 234,
"./platform/CCPhysicsContactListner": 235,
"./platform/CCPhysicsRayCastCallback": 237
} ],
225: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = cc.Class({
name: "cc.DistanceJoint",
extends: cc.Joint,
editor: !1,
properties: {
_distance: 1,
_frequency: 0,
_dampingRatio: 0,
distance: {
tooltip: !1,
get: function() {
return this._distance;
},
set: function(t) {
this._distance = t;
this._joint && this._joint.SetLength(t);
}
},
frequency: {
tooltip: !1,
get: function() {
return this._frequency;
},
set: function(t) {
this._frequency = t;
this._joint && this._joint.SetFrequency(t);
}
},
dampingRatio: {
tooltip: !1,
get: function() {
return this._dampingRatio;
},
set: function(t) {
this._dampingRatio = t;
this._joint && this._joint.SetDampingRatio(t);
}
}
},
_createJointDef: function() {
var t = new b2.DistanceJointDef();
t.localAnchorA = new b2.Vec2(this.anchor.x / i, this.anchor.y / i);
t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i, this.connectedAnchor.y / i);
t.length = this.distance / i;
t.dampingRatio = this.dampingRatio;
t.frequencyHz = this.frequency;
return t;
}
});
cc.DistanceJoint = e.exports = n;
}), {
"../CCPhysicsTypes": 215
} ],
226: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = cc.Class({
name: "cc.Joint",
extends: cc.Component,
editor: {
requireComponent: cc.RigidBody
},
properties: {
anchor: {
default: cc.v2(0, 0),
tooltip: !1
},
connectedAnchor: {
default: cc.v2(0, 0),
tooltip: !1
},
connectedBody: {
default: null,
type: cc.RigidBody,
tooltip: !1
},
collideConnected: {
default: !1,
tooltip: !1
}
},
onDisable: function() {
this._destroy();
},
onEnable: function() {
this._init();
},
start: function() {
this._init();
},
apply: function() {
this._destroy();
this._init();
},
getWorldAnchor: function() {
if (this._joint) {
var t = this._joint.GetAnchorA();
return cc.v2(t.x * i, t.y * i);
}
return cc.Vec2.ZERO;
},
getWorldConnectedAnchor: function() {
if (this._joint) {
var t = this._joint.GetAnchorB();
return cc.v2(t.x * i, t.y * i);
}
return cc.Vec2.ZERO;
},
getReactionForce: function(t) {
var e = cc.v2();
return this._joint ? this._joint.GetReactionForce(t, e) : e;
},
getReactionTorque: function(t) {
return this._joint ? this._joint.GetReactionTorque(t) : 0;
},
_init: function() {
cc.director.getPhysicsManager().pushDelayEvent(this, "__init", []);
},
_destroy: function() {
cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", []);
},
__init: function() {
if (!this._inited) {
this.body = this.getComponent(cc.RigidBody);
if (this._isValid()) {
var t = this._createJointDef();
if (!t) return;
t.bodyA = this.body._getBody();
t.bodyB = this.connectedBody._getBody();
t.collideConnected = this.collideConnected;
cc.director.getPhysicsManager()._addJoint(this, t);
this._inited = !0;
}
}
},
__destroy: function() {
if (this._inited) {
cc.director.getPhysicsManager()._removeJoint(this);
this._joint = null;
this._inited = !1;
}
},
_createJointDef: function() {
return null;
},
_isValid: function() {
return this.body && this.body._getBody() && this.connectedBody && this.connectedBody._getBody();
}
});
cc.Joint = e.exports = n;
}), {
"../CCPhysicsTypes": 215
} ],
227: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE, r = cc.Class({
name: "cc.MotorJoint",
extends: cc.Joint,
editor: !1,
properties: {
_linearOffset: cc.v2(0, 0),
_angularOffset: 0,
_maxForce: 1,
_maxTorque: 1,
_correctionFactor: .3,
anchor: {
tooltip: !1,
default: cc.v2(0, 0),
override: !0,
visible: !1
},
connectedAnchor: {
tooltip: !1,
default: cc.v2(0, 0),
override: !0,
visible: !1
},
linearOffset: {
tooltip: !1,
get: function() {
return this._linearOffset;
},
set: function(t) {
this._linearOffset = t;
this._joint && this._joint.SetLinearOffset(new b2.Vec2(t.x / i, t.y / i));
}
},
angularOffset: {
tooltip: !1,
get: function() {
return this._angularOffset;
},
set: function(t) {
this._angularOffset = t;
this._joint && this._joint.SetAngularOffset(t);
}
},
maxForce: {
tooltip: !1,
get: function() {
return this._maxForce;
},
set: function(t) {
this._maxForce = t;
this._joint && this._joint.SetMaxForce(t);
}
},
maxTorque: {
tooltip: !1,
get: function() {
return this._maxTorque;
},
set: function(t) {
this._maxTorque = t;
this._joint && this._joint.SetMaxTorque(t);
}
},
correctionFactor: {
tooltip: !1,
get: function() {
return this._correctionFactor;
},
set: function(t) {
this._correctionFactor = t;
this._joint && this._joint.SetCorrectionFactor(t);
}
}
},
_createJointDef: function() {
var t = new b2.MotorJointDef();
t.linearOffset = new b2.Vec2(this.linearOffset.x / i, this.linearOffset.y / i);
t.angularOffset = this.angularOffset * n;
t.maxForce = this.maxForce;
t.maxTorque = this.maxTorque;
t.correctionFactor = this.correctionFactor;
return t;
}
});
cc.MotorJoint = e.exports = r;
}), {
"../CCPhysicsTypes": 215
} ],
228: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = new b2.Vec2(), r = cc.Class({
name: "cc.MouseJoint",
extends: cc.Joint,
editor: !1,
properties: {
_target: 1,
_frequency: 5,
_dampingRatio: .7,
_maxForce: 0,
connectedBody: {
default: null,
type: cc.RigidBody,
visible: !1,
override: !0
},
collideConnected: {
default: !0,
visible: !1,
override: !0
},
anchor: {
tooltip: !1,
default: cc.v2(0, 0),
override: !0,
visible: !1
},
connectedAnchor: {
tooltip: !1,
default: cc.v2(0, 0),
override: !0,
visible: !1
},
mouseRegion: {
tooltip: !1,
default: null,
type: cc.Node
},
target: {
tooltip: !1,
visible: !1,
get: function() {
return this._target;
},
set: function(t) {
this._target = t;
if (this._joint) {
n.x = t.x / i;
n.y = t.y / i;
this._joint.SetTarget(n);
}
}
},
frequency: {
tooltip: !1,
get: function() {
return this._frequency;
},
set: function(t) {
this._frequency = t;
this._joint && this._joint.SetFrequency(t);
}
},
dampingRatio: {
tooltip: !1,
get: function() {
return this._dampingRatio;
},
set: function(t) {
this._dampingRatio = t;
this._joint && this._joint.SetDampingRatio(t);
}
},
maxForce: {
tooltip: !1,
visible: !1,
get: function() {
return this._maxForce;
},
set: function(t) {
this._maxForce = t;
this._joint && this._joint.SetMaxForce(t);
}
}
},
onLoad: function() {
var t = this.mouseRegion || this.node;
t.on(cc.Node.EventType.TOUCH_START, this.onTouchBegan, this);
t.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
t.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
t.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
},
onEnable: function() {},
start: function() {},
onTouchBegan: function(t) {
var e = cc.director.getPhysicsManager(), i = this._pressPoint = t.touch.getLocation();
cc.Camera && cc.Camera.main && (i = cc.Camera.main.getScreenToWorldPoint(i));
var n = e.testPoint(i);
if (n) {
(this.connectedBody = n.body).awake = !0;
this.maxForce = 1e3 * this.connectedBody.getMass();
this.target = i;
this._init();
}
},
onTouchMove: function(t) {
this._pressPoint = t.touch.getLocation();
},
onTouchEnd: function() {
this._destroy();
this._pressPoint = null;
},
_createJointDef: function() {
var t = new b2.MouseJointDef();
n.x = this.target.x / i;
n.y = this.target.y / i;
t.target = n;
t.maxForce = this.maxForce;
t.dampingRatio = this.dampingRatio;
t.frequencyHz = this.frequency;
return t;
},
update: function() {
if (this._pressPoint && this._isValid()) {
var t = cc.Camera.findCamera(this.node);
this.target = t ? t.getScreenToWorldPoint(this._pressPoint) : this._pressPoint;
}
}
});
cc.MouseJoint = e.exports = r;
}), {
"../CCPhysicsTypes": 215
} ],
229: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE, r = cc.Class({
name: "cc.PrismaticJoint",
extends: cc.Joint,
editor: !1,
properties: {
localAxisA: {
default: cc.v2(1, 0),
tooltip: !1
},
referenceAngle: {
default: 0,
tooltip: !1
},
enableLimit: {
default: !1,
tooltip: !1
},
enableMotor: {
default: !1,
tooltip: !1
},
lowerLimit: {
default: 0,
tooltip: !1
},
upperLimit: {
default: 0,
tooltip: !1
},
_maxMotorForce: 0,
_motorSpeed: 0,
maxMotorForce: {
tooltip: !1,
get: function() {
return this._maxMotorForce;
},
set: function(t) {
this._maxMotorForce = t;
this._joint && this._joint.SetMaxMotorForce(t);
}
},
motorSpeed: {
tooltip: !1,
get: function() {
return this._motorSpeed;
},
set: function(t) {
this._motorSpeed = t;
this._joint && this._joint.SetMotorSpeed(t);
}
}
},
_createJointDef: function() {
var t = new b2.PrismaticJointDef();
t.localAnchorA = new b2.Vec2(this.anchor.x / i, this.anchor.y / i);
t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i, this.connectedAnchor.y / i);
t.localAxisA = new b2.Vec2(this.localAxisA.x, this.localAxisA.y);
t.referenceAngle = this.referenceAngle * n;
t.enableLimit = this.enableLimit;
t.lowerTranslation = this.lowerLimit / i;
t.upperTranslation = this.upperLimit / i;
t.enableMotor = this.enableMotor;
t.maxMotorForce = this.maxMotorForce;
t.motorSpeed = this.motorSpeed;
return t;
}
});
cc.PrismaticJoint = e.exports = r;
}), {
"../CCPhysicsTypes": 215
} ],
230: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE, r = t("../CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE, s = cc.Class({
name: "cc.RevoluteJoint",
extends: cc.Joint,
editor: !1,
properties: {
_maxMotorTorque: 0,
_motorSpeed: 0,
_enableLimit: !1,
_enableMotor: !1,
referenceAngle: {
default: 0,
tooltip: !1
},
lowerAngle: {
default: 0,
tooltip: !1
},
upperAngle: {
default: 0,
tooltip: !1
},
maxMotorTorque: {
tooltip: !1,
get: function() {
return this._maxMotorTorque;
},
set: function(t) {
this._maxMotorTorque = t;
this._joint && this._joint.SetMaxMotorTorque(t);
}
},
motorSpeed: {
tooltip: !1,
get: function() {
return this._motorSpeed;
},
set: function(t) {
this._motorSpeed = t;
this._joint && this._joint.SetMotorSpeed(t * n);
}
},
enableLimit: {
tooltip: !1,
get: function() {
return this._enableLimit;
},
set: function(t) {
this._enableLimit = t;
this._joint && this._joint.EnableLimit(t);
}
},
enableMotor: {
tooltip: !1,
get: function() {
return this._enableMotor;
},
set: function(t) {
this._enableMotor = t;
this._joint && this._joint.EnableMotor(t);
}
}
},
getJointAngle: function() {
return this._joint ? this._joint.GetJointAngle() * r : 0;
},
setLimits: function(t, e) {
if (this._joint) return this._joint.SetLimits(t * n, e * n);
},
_createJointDef: function() {
var t = new b2.RevoluteJointDef();
t.localAnchorA = new b2.Vec2(this.anchor.x / i, this.anchor.y / i);
t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i, this.connectedAnchor.y / i);
t.lowerAngle = this.upperAngle * n;
t.upperAngle = this.lowerAngle * n;
t.maxMotorTorque = this.maxMotorTorque;
t.motorSpeed = this.motorSpeed * n;
t.enableLimit = this.enableLimit;
t.enableMotor = this.enableMotor;
t.referenceAngle = this.referenceAngle * n;
return t;
}
});
cc.RevoluteJoint = e.exports = s;
}), {
"../CCPhysicsTypes": 215
} ],
231: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = cc.Class({
name: "cc.RopeJoint",
extends: cc.Joint,
editor: !1,
properties: {
_maxLength: 1,
maxLength: {
tooltip: !1,
get: function() {
return this._maxLength;
},
set: function(t) {
this._maxLength = t;
this._joint && this._joint.SetMaxLength(t);
}
}
},
_createJointDef: function() {
var t = new b2.RopeJointDef();
t.localAnchorA = new b2.Vec2(this.anchor.x / i, this.anchor.y / i);
t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i, this.connectedAnchor.y / i);
t.maxLength = this.maxLength / i;
return t;
}
});
cc.RopeJoint = e.exports = n;
}), {
"../CCPhysicsTypes": 215
} ],
232: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE, r = cc.Class({
name: "cc.WeldJoint",
extends: cc.Joint,
editor: !1,
properties: {
referenceAngle: {
default: 0,
tooltip: !1
},
_frequency: 0,
_dampingRatio: 0,
frequency: {
tooltip: !1,
get: function() {
return this._frequency;
},
set: function(t) {
this._frequency = t;
this._joint && this._joint.SetFrequency(t);
}
},
dampingRatio: {
tooltip: !1,
get: function() {
return this._dampingRatio;
},
set: function(t) {
this._dampingRatio = t;
this._joint && this._joint.SetDampingRatio(t);
}
}
},
_createJointDef: function() {
var t = new b2.WeldJointDef();
t.localAnchorA = new b2.Vec2(this.anchor.x / i, this.anchor.y / i);
t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i, this.connectedAnchor.y / i);
t.referenceAngle = this.referenceAngle * n;
t.frequencyHz = this.frequency;
t.dampingRatio = this.dampingRatio;
return t;
}
});
cc.WeldJoint = e.exports = r;
}), {
"../CCPhysicsTypes": 215
} ],
233: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE, r = cc.Class({
name: "cc.WheelJoint",
extends: cc.Joint,
editor: !1,
properties: {
_maxMotorTorque: 0,
_motorSpeed: 0,
_enableMotor: !1,
_frequency: 2,
_dampingRatio: .7,
localAxisA: {
default: cc.v2(1, 0),
tooltip: !1
},
maxMotorTorque: {
tooltip: !1,
get: function() {
return this._maxMotorTorque;
},
set: function(t) {
this._maxMotorTorque = t;
this._joint && this._joint.SetMaxMotorTorque(t);
}
},
motorSpeed: {
tooltip: !1,
get: function() {
return this._motorSpeed;
},
set: function(t) {
this._motorSpeed = t;
this._joint && this._joint.SetMotorSpeed(t * n);
}
},
enableMotor: {
tooltip: !1,
get: function() {
return this._enableMotor;
},
set: function(t) {
this._enableMotor = t;
this._joint && this._joint.EnableMotor(t);
}
},
frequency: {
tooltip: !1,
get: function() {
return this._frequency;
},
set: function(t) {
this._frequency = t;
this._joint && this._joint.SetSpringFrequencyHz(t);
}
},
dampingRatio: {
tooltip: !1,
get: function() {
return this._dampingRatio;
},
set: function(t) {
this._dampingRatio = t;
this._joint && this._joint.SetDampingRatio(t);
}
}
},
_createJointDef: function() {
var t = new b2.WheelJointDef();
t.localAnchorA = new b2.Vec2(this.anchor.x / i, this.anchor.y / i);
t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i, this.connectedAnchor.y / i);
t.localAxisA = new b2.Vec2(this.localAxisA.x, this.localAxisA.y);
t.maxMotorTorque = this.maxMotorTorque;
t.motorSpeed = this.motorSpeed * n;
t.enableMotor = this.enableMotor;
t.dampingRatio = this.dampingRatio;
t.frequencyHz = this.frequency;
return t;
}
});
cc.WheelJoint = e.exports = r;
}), {
"../CCPhysicsTypes": 215
} ],
234: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").BodyType;
function n() {
this._point = new b2.Vec2();
this._isPoint = !1;
this._fixtures = [];
}
n.prototype.init = function(t) {
if (t) {
this._isPoint = !0;
this._point.x = t.x;
this._point.y = t.y;
} else this._isPoint = !1;
this._fixtures.length = 0;
};
n.prototype.ReportFixture = function(t) {
if (t.GetBody().GetType() === i.Dynamic) if (this._isPoint) {
if (t.TestPoint(this._point)) {
this._fixtures.push(t);
return !1;
}
} else this._fixtures.push(t);
return !0;
};
n.prototype.getFixture = function() {
return this._fixtures[0];
};
n.prototype.getFixtures = function() {
return this._fixtures;
};
cc.PhysicsAABBQueryCallback = e.exports = n;
}), {
"../CCPhysicsTypes": 215
} ],
235: [ (function(t, e) {
"use strict";
function i() {
this._contactFixtures = [];
}
i.prototype.setBeginContact = function(t) {
this._BeginContact = t;
};
i.prototype.setEndContact = function(t) {
this._EndContact = t;
};
i.prototype.setPreSolve = function(t) {
this._PreSolve = t;
};
i.prototype.setPostSolve = function(t) {
this._PostSolve = t;
};
i.prototype.BeginContact = function(t) {
if (this._BeginContact) {
var e = t.GetFixtureA(), i = t.GetFixtureB(), n = this._contactFixtures;
t._shouldReport = !1;
if (-1 !== n.indexOf(e) || -1 !== n.indexOf(i)) {
t._shouldReport = !0;
this._BeginContact(t);
}
}
};
i.prototype.EndContact = function(t) {
if (this._EndContact && t._shouldReport) {
t._shouldReport = !1;
this._EndContact(t);
}
};
i.prototype.PreSolve = function(t, e) {
this._PreSolve && t._shouldReport && this._PreSolve(t, e);
};
i.prototype.PostSolve = function(t, e) {
this._PostSolve && t._shouldReport && this._PostSolve(t, e);
};
i.prototype.registerContactFixture = function(t) {
this._contactFixtures.push(t);
};
i.prototype.unregisterContactFixture = function(t) {
cc.js.array.remove(this._contactFixtures, t);
};
cc.PhysicsContactListener = e.exports = i;
}), {} ],
236: [ (function(t, e) {
"use strict";
var i = t("../CCPhysicsTypes").PTM_RATIO, n = cc.v2(), r = cc.Color.GREEN, s = cc.Color.RED;
function o(t) {
b2.Draw.call(this);
this._drawer = t;
this._xf = this._dxf = new b2.Transform();
}
cc.js.extend(o, b2.Draw);
cc.js.mixin(o.prototype, {
_DrawPolygon: function(t, e) {
for (var r = this._drawer, s = 0; s < e; s++) {
b2.Transform.MulXV(this._xf, t[s], n);
var o = n.x * i, a = n.y * i;
0 === s ? r.moveTo(o, a) : r.lineTo(o, a);
}
r.close();
},
DrawPolygon: function(t, e, i) {
this._applyStrokeColor(i);
this._DrawPolygon(t, e);
this._drawer.stroke();
},
DrawSolidPolygon: function(t, e, i) {
this._applyFillColor(i);
this._DrawPolygon(t, e);
this._drawer.fill();
this._drawer.stroke();
},
_DrawCircle: function(t, e) {
var n = this._xf.p;
this._drawer.circle((t.x + n.x) * i, (t.y + n.y) * i, e * i);
},
DrawCircle: function(t, e, i) {
this._applyStrokeColor(i);
this._DrawCircle(t, e);
this._drawer.stroke();
},
DrawSolidCircle: function(t, e, i, n) {
this._applyFillColor(n);
this._DrawCircle(t, e);
this._drawer.fill();
},
DrawSegment: function(t, e, r) {
var s = this._drawer;
if (t.x !== e.x || t.y !== e.y) {
this._applyStrokeColor(r);
b2.Transform.MulXV(this._xf, t, n);
s.moveTo(n.x * i, n.y * i);
b2.Transform.MulXV(this._xf, e, n);
s.lineTo(n.x * i, n.y * i);
s.stroke();
} else {
this._applyFillColor(r);
this._DrawCircle(t, 2 / i);
s.fill();
}
},
DrawTransform: function(t) {
var e = this._drawer;
e.strokeColor = s;
n.x = n.y = 0;
b2.Transform.MulXV(t, n, n);
e.moveTo(n.x * i, n.y * i);
n.x = 1;
n.y = 0;
b2.Transform.MulXV(t, n, n);
e.lineTo(n.x * i, n.y * i);
e.stroke();
e.strokeColor = r;
n.x = n.y = 0;
b2.Transform.MulXV(t, n, n);
e.moveTo(n.x * i, n.y * i);
n.x = 0;
n.y = 1;
b2.Transform.MulXV(t, n, n);
e.lineTo(n.x * i, n.y * i);
e.stroke();
},
DrawPoint: function() {},
_applyStrokeColor: function(t) {
var e = this._drawer.strokeColor;
e.r = 255 * t.r;
e.g = 255 * t.g;
e.b = 255 * t.b;
e.a = 150;
this._drawer.strokeColor = e;
},
_applyFillColor: function(t) {
var e = this._drawer.fillColor;
e.r = 255 * t.r;
e.g = 255 * t.g;
e.b = 255 * t.b;
e.a = 150;
this._drawer.fillColor = e;
},
PushTransform: function(t) {
this._xf = t;
},
PopTransform: function() {
this._xf = this._dxf;
}
});
e.exports = o;
}), {
"../CCPhysicsTypes": 215
} ],
237: [ (function(t, e) {
"use strict";
function i() {
this._type = 0;
this._fixtures = [];
this._points = [];
this._normals = [];
this._fractions = [];
}
i.prototype.init = function(t) {
this._type = t;
this._fixtures.length = 0;
this._points.length = 0;
this._normals.length = 0;
this._fractions.length = 0;
};
i.prototype.ReportFixture = function(t, e, i, n) {
if (0 === this._type) {
this._fixtures[0] = t;
this._points[0] = e;
this._normals[0] = i;
this._fractions[0] = n;
return n;
}
this._fixtures.push(t);
this._points.push(cc.v2(e));
this._normals.push(cc.v2(i));
this._fractions.push(n);
return 1 === this._type ? 0 : this._type >= 2 ? 1 : n;
};
i.prototype.getFixtures = function() {
return this._fixtures;
};
i.prototype.getPoints = function() {
return this._points;
};
i.prototype.getNormals = function() {
return this._normals;
};
i.prototype.getFractions = function() {
return this._fractions;
};
cc.PhysicsRayCastCallback = e.exports = i;
}), {} ],
238: [ (function(t, e) {
"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;
}
};
}), {} ],
239: [ (function(t, e) {
"use strict";
var i = t("./js"), n = t("./CCEnum"), r = t("./utils"), s = (r.isPlainEmptyObj_DEV, 
r.cloneable_DEV, t("./attribute")), o = s.DELIMETER, a = t("./preprocess-class");
t("./requiring-frame");
var c = [ "name", "extends", "mixins", "ctor", "__ctor__", "properties", "statics", "editor", "__ES6__" ];
function l(t, e) {
t.indexOf(e) < 0 && t.push(e);
}
var u = {
datas: null,
push: function(t) {
if (this.datas) this.datas.push(t); else {
this.datas = [ t ];
var e = this;
setTimeout((function() {
e.init();
}), 0);
}
},
init: function() {
var t = this.datas;
if (t) {
for (var e = 0; e < t.length; ++e) {
var n = t[e], r = n.cls, s = n.props;
"function" == typeof s && (s = s());
var o = i.getClassName(r);
s ? E(r, o, s, r.$super, n.mixins) : cc.errorID(3633, o);
}
this.datas = null;
}
}
};
function h(t, e) {
l(t.__props__, e);
}
function _(t, e, i, n) {
var r = n.default;
s.setClassAttr(t, i, "default", r);
h(t, i);
I(t, n, 0, i);
}
function f(t, e, n, r, o) {
var a = r.get, c = r.set, l = t.prototype, u = !Object.getOwnPropertyDescriptor(l, n);
if (a) {
I(t, r, 0, n);
s.setClassAttr(t, n, "serializable", !1);
o || i.get(l, n, a, u, u);
}
c && (o || i.set(l, n, c, u, u));
}
function d(t) {
return "function" == typeof t ? t() : t;
}
function p(t, e, n) {
for (var r in e) t.hasOwnProperty(r) || n && !n(r) || Object.defineProperty(t, r, i.getPropertyDescriptor(e, r));
}
function m(t, e, n, r) {
var o, a, c = r.__ctor__, l = r.ctor, u = r.__ES6__;
if (u) {
o = [ l ];
a = l;
} else {
o = c ? [ c ] : S(e, n, r);
a = A(o, e, t, r);
i.value(a, "extend", (function(t) {
t.extends = this;
return M(t);
}), !0);
}
i.value(a, "__ctors__", o.length > 0 ? o : null, !0);
var h = a.prototype;
if (e) {
if (!u) {
i.extend(a, e);
h = a.prototype;
}
a.$super = e;
}
if (n) {
for (var _ = n.length - 1; _ >= 0; _--) {
var f = n[_];
p(h, f.prototype);
p(a, f, (function(t) {
return f.hasOwnProperty(t) && !0;
}));
M._isCCClass(f) && p(s.getClassAttrs(a), s.getClassAttrs(f));
}
h.constructor = a;
}
u || (h.__initProps__ = x);
i.setClassName(t, a);
return a;
}
function y(t, e, n, r) {
var s = cc.Component, o = cc._RF.peek();
if (o && i.isChildClassOf(e, s)) {
if (i.isChildClassOf(o.cls, s)) {
cc.errorID(3615);
return null;
}
t = t || o.script;
}
var a = m(t, e, n, r);
if (o) if (i.isChildClassOf(e, s)) {
var c = o.uuid;
c && i._setClassId(c, a);
o.cls = a;
} else i.isChildClassOf(o.cls, s) || (o.cls = a);
return a;
}
function v(t) {
for (var e = i.getClassName(t), n = t.constructor, r = "new " + e + "(", s = 0; s < n.__props__.length; s++) {
r += t[n.__props__[s]];
s < n.__props__.length - 1 && (r += ",");
}
return r + ")";
}
function g(t) {
return JSON.stringify(t).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
}
function b(t, e) {
for (var i = [], n = "", r = 0; r < e.length; r++) {
var s = e[r], a = s + o + "default";
if (a in t) {
var c, l;
c = C.test(s) ? "this." + s + "=" : "this[" + g(s) + "]=";
var u = t[a];
if ("object" == typeof u && u) l = u instanceof cc.ValueType ? v(u) : Array.isArray(u) ? "[]" : "{}"; else if ("function" == typeof u) {
var h = i.length;
i.push(u);
l = "F[" + h + "]()";
} else l = "string" == typeof u ? g(u) : u;
n += c = c + l + ";\n";
}
}
return 0 === i.length ? Function(n) : Function("F", "return (function(){\n" + n + "})")(i);
}
var C = /^[A-Za-z_$][0-9A-Za-z_$]*$/;
function x(t) {
var e = s.getClassAttrs(t), i = t.__props__;
if (null === i) {
u.init();
i = t.__props__;
}
var n = b(e, i);
t.prototype.__initProps__ = n;
n.call(this);
}
var A = function(t, e, i, n) {
var r = "return function CCClass(){\n";
e && w(e, n) && (r += "this._super=null;\n");
r += "this.__initProps__(CCClass);\n";
var s = t.length;
if (s > 0) {
var o = "].apply(this,arguments);\n";
if (1 === s) r += "CCClass.__ctors__[0" + o; else {
r += "var cs=CCClass.__ctors__;\n";
for (var a = 0; a < s; a++) r += "cs[" + a + o;
}
}
r += "}";
return Function(r)();
};
function S(t, e, i) {
for (var n, r = [], s = [ t ].concat(e), o = 0; o < s.length; o++) {
var a = s[o];
if (a) for (var c = (n = a, M._isCCClass(n) ? n.__ctors__ || [] : [ n ]), u = 0; u < c.length; u++) l(r, c[u]);
}
var h = i.ctor;
h && r.push(h);
return r;
}
var T = /xyz/.test((function() {
xyz;
})) ? /\b\._super\b/ : /.*/;
/xyz/.test((function() {
xyz;
}));
function w(t, e) {
var n = !1;
for (var r in e) if (!(c.indexOf(r) >= 0)) {
var s = e[r];
if ("function" == typeof s) {
var o = i.getPropertyDescriptor(t.prototype, r);
if (o) {
var a = o.value;
if ("function" == typeof a) {
if (T.test(s)) {
n = !0;
e[r] = (function(t, e) {
return function() {
var i = this._super;
this._super = t;
var n = e.apply(this, arguments);
this._super = i;
return n;
};
})(a, s);
}
continue;
}
}
}
}
return n;
}
function E(t, e, i, n, r, c) {
t.__props__ = [];
n && n.__props__ && (t.__props__ = n.__props__.slice());
if (r) for (var l = 0; l < r.length; ++l) {
var u = r[l];
u.__props__ && (t.__props__ = t.__props__.concat(u.__props__.filter((function(e) {
return t.__props__.indexOf(e) < 0;
}))));
}
if (i) {
a.preprocessAttrs(i, e, t, c);
for (var h in i) {
var d = i[h];
"default" in d ? _(t, 0, h, d) : f(t, 0, h, d, c);
}
}
var p = s.getClassAttrs(t);
t.__values__ = t.__props__.filter((function(t) {
return !1 !== p[t + o + "serializable"];
}));
}
function M(t) {
var e = (t = t || {}).name, n = t.extends, r = t.mixins, s = y(e, n, r, t);
e || (e = cc.js.getClassName(s));
s._sealed = !0;
n && (n._sealed = !1);
var o = t.properties;
if ("function" == typeof o || n && null === n.__props__ || r && r.some((function(t) {
return null === t.__props__;
}))) {
u.push({
cls: s,
props: o,
mixins: r
});
s.__props__ = s.__values__ = null;
} else E(s, e, o, n, t.mixins, t.__ES6__);
var l = t.statics;
if (l) {
var h;
for (h in l) s[h] = l[h];
}
for (var _ in t) if (!(c.indexOf(_) >= 0)) {
var f = t[_];
a.validateMethodWithProps(f, _, e, s, n) && i.value(s.prototype, _, f, !0, !0);
}
var d = t.editor;
d && cc.Component._registerEditorProps(s, d);
return s;
}
M._isCCClass = function(t) {
return t && t.hasOwnProperty("__ctors__");
};
M._fastDefine = function(t, e, n) {
i.setClassName(t, e);
for (var r = e.__props__ = e.__values__ = Object.keys(n), a = s.getClassAttrs(e), c = 0; c < r.length; c++) {
var l = r[c];
a[l + o + "visible"] = !1;
a[l + o + "default"] = n[l];
}
};
M.Attr = s;
M.attr = s.attr;
M.getInheritanceChain = function(t) {
for (var e = []; t = i.getSuper(t); ) t !== Object && e.push(t);
return e;
};
var B = {
Integer: "Number",
Float: "Number",
Boolean: "Boolean",
String: "String"
};
function I(t, e, i, r) {
var a = null, c = "";
function l() {
c = r + o;
return a = s.getClassAttrs(t);
}
var u = e.type;
if (u) {
if (B[u]) (a || l())[c + "type"] = u; else if ("Object" === u) ; else if (u === s.ScriptUuid) {
(a || l())[c + "type"] = "Script";
a[c + "ctor"] = cc.ScriptAsset;
} else if ("object" == typeof u) {
if (n.isEnum(u)) {
(a || l())[c + "type"] = "Enum";
a[c + "enumList"] = n.getList(u);
}
} else if ("function" == typeof u) {
(a || l())[c + "type"] = "Object";
a[c + "ctor"] = u;
}
}
function h(t, i) {
if (t in e) {
var n = e[t];
typeof n === i && ((a || l())[c + t] = n);
}
}
e.editorOnly && ((a || l())[c + "editorOnly"] = !0);
!1 === e.serializable && ((a || l())[c + "serializable"] = !1);
h("formerlySerializedAs", "string");
var _ = e.range;
if (_ && Array.isArray(_) && _.length >= 2) {
(a || l())[c + "min"] = _[0];
a[c + "max"] = _[1];
_.length > 2 && (a[c + "step"] = _[2]);
}
h("min", "number");
h("max", "number");
h("step", "number");
h("userData", "object");
}
cc.Class = M;
e.exports = {
isArray: function(t) {
t = d(t);
return Array.isArray(t);
},
fastDefine: M._fastDefine,
getNewValueTypeCode: v,
IDENTIFIER_RE: C,
escapeForJS: g,
getDefault: d
};
}), {
"./CCEnum": 241,
"./attribute": 251,
"./js": 260,
"./preprocess-class": 261,
"./requiring-frame": 262,
"./utils": 263
} ],
240: [ (function(t, e) {
"use strict";
t("./CCClass");
var i = t("./preprocess-class"), n = t("./js"), r = "__ccclassCache__";
function s(t) {
return t;
}
function o(t, e) {
return t[e] || (t[e] = {});
}
function a(t) {
return function(e) {
return "function" == typeof e ? t(e) : function(i) {
return t(i, e);
};
};
}
function c(t, e) {
return function(t) {
return function(i) {
return e(i, t);
};
};
}
var l = c.bind(null, !1);
function u() {
return c.bind(null, !1);
}
var h = u(), _ = u();
function f(t) {
return o(t, r);
}
function d(t) {
var e;
try {
e = t();
} catch (e) {
return t;
}
return "object" != typeof e || null === e ? e : t;
}
function p(t) {
var e;
try {
e = new t();
} catch (t) {
return {};
}
return e;
}
function m(t, e, r, s, o, a) {
var c, l = o && (o.get || o.set);
s && (c = i.getFullFormOfProperty(s, l));
var u = e[r], h = n.mixin(u || {}, c || s || {});
if (l) {
o.get && (h.get = o.get);
o.set && (h.set = o.set);
} else {
var _ = void 0;
if (o) o.initializer && (_ = d(o.initializer)); else {
var f = a.default || (a.default = p(t));
f.hasOwnProperty(r) && (_ = f[r]);
}
h.default = _;
}
e[r] = h;
}
var y = a((function(t, e) {
var i = n.getSuper(t);
i === Object && (i = null);
var s = {
name: e,
extends: i,
ctor: t,
__ES6__: !0
}, o = t[r];
if (o) {
var a = o.proto;
a && n.mixin(s, a);
t[r] = void 0;
}
return cc.Class(s);
}));
function v(t, e, i) {
return t((function(t, n) {
var r = f(t);
if (r) {
var s = void 0 !== i ? i : n, a = o(r, "proto");
o(a, "editor")[e] = s;
}
}), e);
}
function g(t) {
return t(s);
}
var b = g(a), C = v(l, "requireComponent"), x = g(h), A = v(_, "executionOrder"), S = g(a), T = g(a), w = g(h), E = g(h), M = g(h);
cc._decorator = e.exports = {
ccclass: y,
property: function(t, e, i) {
var n = null;
function r(t, e, i) {
var r = f(t.constructor);
if (r) {
var s = o(r, "proto"), a = o(s, "properties");
m(t.constructor, a, e, n, i, r);
}
}
if ("undefined" == typeof e) {
n = t;
return r;
}
r(t, e, i);
},
executeInEditMode: b,
requireComponent: C,
menu: x,
executionOrder: A,
disallowMultiple: S,
playOnFocus: T,
inspector: w,
icon: E,
help: M,
mixins: function() {
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
return function(e) {
var i = f(e);
i && (o(i, "proto").mixins = t);
};
}
};
}), {
"./CCClass": 239,
"./js": 260,
"./preprocess-class": 261,
"./utils": 263
} ],
241: [ (function(t, e) {
"use strict";
var i = t("./js");
function n(t) {
if ("__enums__" in t) return t;
i.value(t, "__enums__", null, !0);
for (var e = -1, n = Object.keys(t), r = 0; r < n.length; r++) {
var s = n[r], o = t[s];
if (-1 === o) {
o = ++e;
t[s] = o;
} else if ("number" == typeof o) e = o; else if ("string" == typeof o && Number.isInteger(parseFloat(s))) continue;
var a = "" + o;
s !== a && i.value(t, a, s);
}
return t;
}
n.isEnum = function(t) {
return t && t.hasOwnProperty("__enums__");
};
n.getList = function(t) {
if (t.__enums__) return t.__enums__;
var e = t.__enums__ = [];
for (var i in t) {
var n = t[i];
Number.isInteger(n) && e.push({
name: i,
value: n
});
}
e.sort((function(t, e) {
return t.value - e.value;
}));
return e;
};
e.exports = cc.Enum = n;
}), {
"./js": 260
} ],
242: [ (function(t) {
"use strict";
var e, i = t("../event-manager"), n = t("./CCInputManager");
cc.Acceleration = function(t, e, i, n) {
this.x = t || 0;
this.y = e || 0;
this.z = i || 0;
this.timestamp = n || 0;
};
n.setAccelerometerEnabled = function(t) {
var e = this;
if (e._accelEnabled !== t) {
e._accelEnabled = t;
var i = cc.director.getScheduler();
i.enableForTarget(e);
if (e._accelEnabled) {
e._registerAccelerometerEvent();
e._accelCurTime = 0;
i.scheduleUpdate(e);
} else {
e._unregisterAccelerometerEvent();
e._accelCurTime = 0;
i.unscheduleUpdate(e);
}
jsb.device.setMotionEnabled(t);
}
};
n.setAccelerometerInterval = function(t) {
if (this._accelInterval !== t) {
this._accelInterval = t;
jsb.device.setMotionInterval(t);
}
};
n._registerKeyboardEvent = function() {
cc.game.canvas.addEventListener("keydown", (function(t) {
i.dispatchEvent(new cc.Event.EventKeyboard(t.keyCode, !0));
t.stopPropagation();
t.preventDefault();
}), !1);
cc.game.canvas.addEventListener("keyup", (function(t) {
i.dispatchEvent(new cc.Event.EventKeyboard(t.keyCode, !1));
t.stopPropagation();
t.preventDefault();
}), !1);
};
n._registerAccelerometerEvent = function() {
var t = window, i = this;
i._acceleration = new cc.Acceleration();
i._accelDeviceEvent = t.DeviceMotionEvent || t.DeviceOrientationEvent;
cc.sys.browserType === cc.sys.BROWSER_TYPE_MOBILE_QQ && (i._accelDeviceEvent = window.DeviceOrientationEvent);
var n = i._accelDeviceEvent === t.DeviceMotionEvent ? "devicemotion" : "deviceorientation", r = navigator.userAgent;
(/Android/.test(r) || /Adr/.test(r) && cc.sys.browserType === cc.BROWSER_TYPE_UC) && (i._minus = -1);
e = i.didAccelerate.bind(i);
t.addEventListener(n, e, !1);
};
n._unregisterAccelerometerEvent = function() {
var t = window, i = this._accelDeviceEvent === t.DeviceMotionEvent ? "devicemotion" : "deviceorientation";
e && t.removeEventListener(i, e, !1);
};
n.didAccelerate = function(t) {
var e = this, i = window;
if (e._accelEnabled) {
var n, r, s, o = e._acceleration;
if (e._accelDeviceEvent === window.DeviceMotionEvent) {
var a = t.accelerationIncludingGravity;
n = e._accelMinus * a.x * .1;
r = e._accelMinus * a.y * .1;
s = .1 * a.z;
} else {
n = t.gamma / 90 * .981;
r = -t.beta / 90 * .981;
s = t.alpha / 90 * .981;
}
if (cc.view._isRotated) {
var c = n;
n = -r;
r = c;
}
o.x = n;
o.y = r;
o.z = s;
o.timestamp = t.timeStamp || Date.now();
var l = o.x;
if (90 === i.orientation) {
o.x = -o.y;
o.y = l;
} else if (-90 === i.orientation) {
o.x = o.y;
o.y = -l;
} else if (180 === i.orientation) {
o.x = -o.x;
o.y = -o.y;
}
if (cc.sys.os === cc.sys.OS_ANDROID && cc.sys.browserType !== cc.sys.BROWSER_TYPE_MOBILE_QQ) {
o.x = -o.x;
o.y = -o.y;
}
}
};
}), {
"../event-manager": 184,
"./CCInputManager": 243
} ],
243: [ (function(t, e) {
"use strict";
var i = t("./CCMacro"), n = t("./CCSys"), r = t("../event-manager"), s = i.TOUCH_TIMEOUT, o = cc.v2(), a = {
_mousePressed: !1,
_isRegisterEvent: !1,
_preTouchPoint: cc.v2(0, 0),
_prevMousePoint: cc.v2(0, 0),
_preTouchPool: [],
_preTouchPoolPointer: 0,
_touches: [],
_touchesIntegerDict: {},
_indexBitsUsed: 0,
_maxTouches: 8,
_accelEnabled: !1,
_accelInterval: .2,
_accelMinus: 1,
_accelCurTime: 0,
_acceleration: null,
_accelDeviceEvent: null,
_canvasBoundingRect: {
left: 0,
top: 0,
adjustedLeft: 0,
adjustedTop: 0,
width: 0,
height: 0
},
_getUnUsedIndex: function() {
for (var t = this._indexBitsUsed, e = cc.sys.now(), i = 0; i < this._maxTouches; i++) {
if (!(1 & t)) {
this._indexBitsUsed |= 1 << i;
return i;
}
var n = this._touches[i];
if (e - n._lastModified > s) {
this._removeUsedIndexBit(i);
delete this._touchesIntegerDict[n.getID()];
return i;
}
t >>= 1;
}
return -1;
},
_removeUsedIndexBit: function(t) {
if (!(t < 0 || t >= this._maxTouches)) {
var e = 1 << t;
e = ~e;
this._indexBitsUsed &= e;
}
},
_glView: null,
_updateCanvasBoundingRect: function() {
var t = cc.game.canvas, e = this._canvasBoundingRect, i = document.documentElement, n = window.pageXOffset - i.clientLeft, r = window.pageYOffset - i.clientTop;
if (t.getBoundingClientRect) {
var s = t.getBoundingClientRect();
e.left = s.left + n;
e.top = s.top + r;
e.width = s.width;
e.height = s.height;
} else if (t instanceof HTMLCanvasElement) {
e.left = n;
e.top = r;
e.width = t.width;
e.height = t.height;
} else {
e.left = n;
e.top = r;
e.width = parseInt(t.style.width);
e.height = parseInt(t.style.height);
}
},
handleTouchesBegin: function(t) {
for (var e, i, s, o = [], a = this._touchesIntegerDict, c = n.now(), l = 0, u = t.length; l < u; l++) if (null == a[s = (e = t[l]).getID()]) {
var h = this._getUnUsedIndex();
if (-1 === h) {
cc.logID(2300, h);
continue;
}
(i = this._touches[h] = new cc.Touch(e._point.x, e._point.y, e.getID()))._lastModified = c;
i._setPrevPoint(e._prevPoint);
a[s] = h;
o.push(i);
}
if (o.length > 0) {
this._glView._convertTouchesWithScale(o);
var _ = new cc.Event.EventTouch(o);
_._eventCode = cc.Event.EventTouch.BEGAN;
r.dispatchEvent(_);
}
},
handleTouchesMove: function(t) {
for (var e, i, s, o = [], a = this._touches, c = n.now(), l = 0, u = t.length; l < u; l++) {
s = (e = t[l]).getID();
if (null != (i = this._touchesIntegerDict[s]) && a[i]) {
a[i]._setPoint(e._point);
a[i]._setPrevPoint(e._prevPoint);
a[i]._lastModified = c;
o.push(a[i]);
}
}
if (o.length > 0) {
this._glView._convertTouchesWithScale(o);
var h = new cc.Event.EventTouch(o);
h._eventCode = cc.Event.EventTouch.MOVED;
r.dispatchEvent(h);
}
},
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;
r.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;
r.dispatchEvent(i);
}
this._preTouchPool.length = 0;
},
getSetOfTouchesEndOrCancel: function(t) {
for (var e, i, n, r = [], s = this._touches, o = this._touchesIntegerDict, a = 0, c = t.length; a < c; a++) if (null != (i = o[n = (e = t[a]).getID()]) && s[i]) {
s[i]._setPoint(e._point);
s[i]._setPrevPoint(e._prevPoint);
r.push(s[i]);
this._removeUsedIndexBit(i);
delete o[n];
}
return r;
},
getPreTouch: function(t) {
for (var e = null, i = this._preTouchPool, n = t.getID(), r = i.length - 1; r >= 0; r--) if (i[r].getID() === n) {
e = i[r];
break;
}
e || (e = t);
return 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;
}
if (!e) if (i.length <= 50) i.push(t); else {
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);
s._setPrevPoint(n.x, n.y);
n.x = r.x;
n.y = r.y;
return s;
},
getMouseEvent: function(t, e, i) {
var n = this._prevMousePoint, r = new cc.Event.EventMouse(i);
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);
return r;
},
getPointByEvent: function(t, e) {
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();
if (null != t.pageX) return {
x: t.pageX,
y: t.pageY
};
e.left -= document.body.scrollLeft;
e.top -= document.body.scrollTop;
return {
x: t.clientX,
y: t.clientY
};
},
getTouchesByEvent: function(t, e) {
for (var i, r, s, a = [], c = this._glView, l = this._preTouchPoint, u = t.changedTouches.length, h = 0; h < u; h++) if (i = t.changedTouches[h]) {
var _;
_ = n.BROWSER_TYPE_FIREFOX === n.browserType ? c.convertToLocationInView(i.pageX, i.pageY, e, o) : c.convertToLocationInView(i.clientX, i.clientY, e, o);
if (null != i.identifier) {
r = new cc.Touch(_.x, _.y, i.identifier);
s = this.getPreTouch(r).getLocation();
r._setPrevPoint(s.x, s.y);
this.setPreTouch(r);
} else (r = new cc.Touch(_.x, _.y))._setPrevPoint(l.x, l.y);
l.x = _.x;
l.y = _.y;
a.push(r);
}
return a;
},
registerSystemEvent: function(t) {
if (!this._isRegisterEvent) {
this._glView = cc.view;
var e = this, i = this._canvasBoundingRect;
window.addEventListener("resize", this._updateCanvasBoundingRect.bind(this));
var s = n.isMobile, o = "mouse" in n.capabilities, a = "touches" in n.capabilities;
if (o) {
if (!s) {
window.addEventListener("mousedown", (function() {
e._mousePressed = !0;
}), !1);
window.addEventListener("mouseup", (function(t) {
if (e._mousePressed) {
e._mousePressed = !1;
var n = e.getPointByEvent(t, i);
if (!cc.rect(i.left, i.top, i.width, i.height).contains(n)) {
e.handleTouchesEnd([ e.getTouchByXY(n.x, n.y, i) ]);
var s = e.getMouseEvent(n, i, cc.Event.EventMouse.UP);
s.setButton(t.button);
r.dispatchEvent(s);
}
}
}), !1);
}
for (var c = cc.Event.EventMouse, l = [ !s && [ "mousedown", c.DOWN, function(i, n, r, s) {
e._mousePressed = !0;
e.handleTouchesBegin([ e.getTouchByXY(r.x, r.y, s) ]);
t.focus();
} ], !s && [ "mouseup", c.UP, function(t, i, n, r) {
e._mousePressed = !1;
e.handleTouchesEnd([ e.getTouchByXY(n.x, n.y, r) ]);
} ], !s && [ "mousemove", c.MOVE, function(t, i, n, r) {
e.handleTouchesMove([ e.getTouchByXY(n.x, n.y, r) ]);
e._mousePressed || i.setButton(null);
} ], [ "mousewheel", c.SCROLL, function(t, e) {
e.setScrollData(0, t.wheelDelta);
} ], [ "DOMMouseScroll", c.SCROLL, function(t, e) {
e.setScrollData(0, -120 * t.detail);
} ] ], u = 0; u < l.length; ++u) {
var h = l[u];
h && (function() {
var n = h[0], s = h[1], o = h[2];
t.addEventListener(n, (function(t) {
var n = e.getPointByEvent(t, i), a = e.getMouseEvent(n, i, s);
a.setButton(t.button);
o(t, a, n, i);
r.dispatchEvent(a);
t.stopPropagation();
t.preventDefault();
}), !1);
})();
}
}
if (window.navigator.msPointerEnabled) {
var _ = {
MSPointerDown: e.handleTouchesBegin,
MSPointerMove: e.handleTouchesMove,
MSPointerUp: e.handleTouchesEnd,
MSPointerCancel: e.handleTouchesCancel
}, f = function(n) {
var r = _[n];
t.addEventListener(n, (function(t) {
var n = document.documentElement;
i.adjustedLeft = i.left - n.scrollLeft;
i.adjustedTop = i.top - n.scrollTop;
r.call(e, [ e.getTouchByXY(t.clientX, t.clientY, i) ]);
t.stopPropagation();
}), !1);
};
for (var d in _) f(d);
}
if (a) {
var p = {
touchstart: function(i) {
e.handleTouchesBegin(i);
t.focus();
},
touchmove: function(t) {
e.handleTouchesMove(t);
},
touchend: function(t) {
e.handleTouchesEnd(t);
},
touchcancel: function(t) {
e.handleTouchesCancel(t);
}
}, m = function(n) {
var r = p[n];
t.addEventListener(n, (function(t) {
if (t.changedTouches) {
var n = document.body;
i.adjustedLeft = i.left - (n.scrollLeft || window.scrollX || 0);
i.adjustedTop = i.top - (n.scrollTop || window.scrollY || 0);
r(e.getTouchesByEvent(t, i));
t.stopPropagation();
t.preventDefault();
}
}), !1);
};
for (var y in p) m(y);
}
this._registerKeyboardEvent();
this._isRegisterEvent = !0;
}
},
_registerKeyboardEvent: function() {},
_registerAccelerometerEvent: function() {},
update: function(t) {
if (this._accelCurTime > this._accelInterval) {
this._accelCurTime -= this._accelInterval;
r.dispatchEvent(new cc.Event.EventAcceleration(this._acceleration));
}
this._accelCurTime += t;
}
};
e.exports = cc.internal.inputManager = a;
}), {
"../event-manager": 184,
"./CCMacro": 244,
"./CCSys": 248
} ],
244: [ (function(t, e) {
"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,
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,
ALLOW_IMAGE_BITMAP: !cc.sys.isMobile,
ENABLE_NATIVE_TTF_RENDERER: !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;
}), {} ],
245: [ (function(t, e) {
"use strict";
var i = t("./js"), n = t("./CCClass"), r = 1;
function s() {
this._name = "";
this._objFlags = 0;
}
n.fastDefine("cc.Object", s, {
_name: "",
_objFlags: 0
});
i.value(s, "Flags", {
Destroyed: r,
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 = [];
i.value(s, "_deferredDestroy", (function() {
for (var t = o.length, e = 0; e < t; ++e) {
var i = o[e];
i._objFlags & r || i._destroyImmediate();
}
t === o.length ? o.length = 0 : o.splice(0, t);
}));
var a = s.prototype;
i.getset(a, "name", (function() {
return this._name;
}), (function(t) {
this._name = t;
}), !0);
i.get(a, "isValid", (function() {
return !(this._objFlags & r);
}), !0);
a.destroy = function() {
if (this._objFlags & r) {
cc.warnID(5e3);
return !1;
}
if (4 & this._objFlags) return !1;
this._objFlags |= 4;
o.push(this);
return !0;
};
function c(t, e) {
var i, r = t instanceof cc._BaseNode || t instanceof cc.Component, s = r ? "_id" : null, o = {};
for (i in t) if (t.hasOwnProperty(i)) {
if (i === s) continue;
switch (typeof t[i]) {
case "string":
o[i] = "";
break;

case "object":
case "function":
o[i] = null;
}
}
if (cc.Class._isCCClass(e)) for (var a = cc.Class.Attr.getClassAttrs(e), c = e.__props__, l = 0; l < c.length; l++) {
var u = (i = c[l]) + cc.Class.Attr.DELIMETER + "default";
if (u in a) {
if (r && "_id" === i) continue;
switch (typeof a[u]) {
case "string":
o[i] = "";
break;

case "object":
case "function":
o[i] = null;
break;

case "undefined":
o[i] = void 0;
}
}
}
var h = "";
for (i in o) {
var _;
_ = n.IDENTIFIER_RE.test(i) ? "o." + i + "=" : "o[" + n.escapeForJS(i) + "]=";
var f = o[i];
"" === f && (f = '""');
h += _ + f + ";\n";
}
return Function("o", h);
}
a._destruct = function() {
var t = this.constructor, e = t.__destruct__;
if (!e) {
e = c(this, t);
i.value(t, "__destruct__", e, !0);
}
e(this);
};
a._onPreDestroy = null;
a._destroyImmediate = function() {
if (this._objFlags & r) cc.errorID(5e3); else {
this._onPreDestroy && this._onPreDestroy();
this._destruct();
this._objFlags |= r;
}
};
a._deserialize = null;
cc.isValid = function(t, e) {
return "object" == typeof t ? !(!t || t._objFlags & (e ? 4 | r : r)) : "undefined" != typeof t;
};
cc.Object = e.exports = s;
}), {
"./CCClass": 239,
"./js": 260
} ],
246: [ (function(t, e) {
"use strict";
var i = t("../platform/js");
cc.SAXParser = function() {
if (window.DOMParser) {
this._isSupportDOMParser = !0;
this._parser = new DOMParser();
} else {
this._isSupportDOMParser = !1;
this._parser = null;
}
};
cc.SAXParser.prototype = {
constructor: cc.SAXParser,
parse: function(t) {
return this._parseXML(t);
},
_parseXML: function(t) {
var e;
if (this._isSupportDOMParser) e = this._parser.parseFromString(t, "text/xml"); else {
(e = new ActiveXObject("Microsoft.XMLDOM")).async = "false";
e.loadXML(t);
}
return e;
}
};
cc.PlistParser = function() {
cc.SAXParser.call(this);
};
i.extend(cc.PlistParser, cc.SAXParser);
i.mixin(cc.PlistParser.prototype, {
parse: function(t) {
var e = this._parseXML(t), i = e.documentElement;
if ("plist" !== i.tagName) {
cc.warnID(5100);
return {};
}
for (var n = null, r = 0, s = i.childNodes.length; r < s && 1 !== (n = i.childNodes[r]).nodeType; r++) ;
e = null;
return this._parseNode(n);
},
_parseNode: function(t) {
var e = null, i = t.tagName;
if ("dict" === i) e = this._parseDict(t); else if ("array" === i) e = this._parseArray(t); else if ("string" === i) if (1 === t.childNodes.length) e = t.firstChild.nodeValue; else {
e = "";
for (var n = 0; n < t.childNodes.length; n++) e += t.childNodes[n].nodeValue;
} else "false" === i ? e = !1 : "true" === i ? e = !0 : "real" === i ? e = parseFloat(t.firstChild.nodeValue) : "integer" === i && (e = parseInt(t.firstChild.nodeValue, 10));
return e;
},
_parseArray: function(t) {
for (var e = [], i = 0, n = t.childNodes.length; i < n; i++) {
var r = t.childNodes[i];
1 === r.nodeType && e.push(this._parseNode(r));
}
return e;
},
_parseDict: function(t) {
for (var e = {}, i = null, n = 0, r = t.childNodes.length; n < r; n++) {
var s = t.childNodes[n];
1 === s.nodeType && ("key" === s.tagName ? i = s.firstChild.nodeValue : e[i] = this._parseNode(s));
}
return e;
}
});
cc.saxParser = new cc.SAXParser();
cc.plistParser = new cc.PlistParser();
e.exports = {
saxParser: cc.saxParser,
plistParser: cc.plistParser
};
}), {
"../platform/js": 260
} ],
247: [ (function() {
"use strict";
cc.screen = {
_supportsFullScreen: !1,
_onfullscreenchange: null,
_onfullscreenerror: null,
_preOnFullScreenChange: null,
_preOnFullScreenError: null,
_preOnTouch: null,
_touchEvent: "",
_fn: null,
_fnMap: [ [ "requestFullscreen", "exitFullscreen", "fullscreenchange", "fullscreenEnabled", "fullscreenElement", "fullscreenerror" ], [ "requestFullScreen", "exitFullScreen", "fullScreenchange", "fullScreenEnabled", "fullScreenElement", "fullscreenerror" ], [ "webkitRequestFullScreen", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitIsFullScreen", "webkitCurrentFullScreenElement", "webkitfullscreenerror" ], [ "mozRequestFullScreen", "mozCancelFullScreen", "mozfullscreenchange", "mozFullScreen", "mozFullScreenElement", "mozfullscreenerror" ], [ "msRequestFullscreen", "msExitFullscreen", "MSFullscreenChange", "msFullscreenEnabled", "msFullscreenElement", "msfullscreenerror" ] ],
init: function() {
this._fn = {};
var t, e, i, n, r = this._fnMap;
for (t = 0, e = r.length; t < e; t++) if ((i = r[t]) && "undefined" != typeof document[i[1]]) {
for (t = 0, n = i.length; t < n; t++) this._fn[r[0][t]] = i[t];
break;
}
this._supportsFullScreen = void 0 !== this._fn.requestFullscreen;
this._touchEvent = "ontouchend" in window ? "touchend" : "mousedown";
},
fullScreen: function() {
return !!this._supportsFullScreen && !!(document[this._fn.fullscreenElement] || document[this._fn.webkitFullscreenElement] || document[this._fn.mozFullScreenElement]);
},
requestFullScreen: function(t, e, i) {
if (t && "video" === t.tagName.toLowerCase()) {
if (cc.sys.os === cc.sys.OS_IOS && cc.sys.isBrowser && t.readyState > 0) {
t.webkitEnterFullscreen && t.webkitEnterFullscreen();
return;
}
t.setAttribute("x5-video-player-fullscreen", "true");
}
if (this._supportsFullScreen) {
t = t || document.documentElement;
if (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
});
}
var s = t[this._fn.requestFullscreen]();
"undefined" == typeof document[this._fn.fullscreenerror] && window.Promise && s instanceof Promise && s.catch((function() {}));
}
},
exitFullScreen: function(t) {
if (t && "video" === t.tagName.toLowerCase()) {
if (cc.sys.os === cc.sys.OS_IOS && cc.sys.isBrowser) {
t.webkitExitFullscreen && t.webkitExitFullscreen();
return;
}
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;
if (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, s = this._touchEvent;
function o() {
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
});
}
this._preOnFullScreenError && t.removeEventListener(r, this._preOnFullScreenError);
this._preOnFullScreenError = o;
t.addEventListener(r, o, {
once: !0
});
}
};
cc.screen.init();
}), {} ],
248: [ (function(t, e) {
"use strict";
var i, n = "qgame" === (i = window._CCSettings ? _CCSettings.platform : void 0), r = "quickgame" === i, s = "huawei" === i, o = "jkw-game" === i, a = "qtt-game" === i, c = "link-sure" === i, l = "undefined" == typeof window ? global : window, u = cc && cc.sys ? cc.sys : (function() {
cc.sys = {};
var t = cc.sys;
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.BYTEDANCE_GAME = 117;
t.BYTEDANCE_GAME_SUB = 118;
t.LINKSURE = 119;
t.TAOBAO = 120;
t.BROWSER_TYPE_WECHAT = "wechat";
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_HUAWEI = "huawei";
t.BROWSER_TYPE_UNKNOWN = "unknown";
t.isNative = !0;
t.isBrowser = "object" == typeof window && "object" == typeof document && !1;
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;
};
t.getSafeAreaRect = function() {
var t = cc.view.getVisibleSize();
return cc.rect(0, 0, t.width, t.height);
};
if (l.__globalAdapter && l.__globalAdapter.adaptSys) l.__globalAdapter.adaptSys(t); else {
var e, i;
e = n ? t.VIVO_GAME : r ? t.OPPO_GAME : s ? t.HUAWEI_GAME : o ? t.JKW_GAME : a ? t.QTT_GAME : c ? t.LINKSURE : __getPlatform();
t.platform = e;
t.isMobile = e === t.ANDROID || e === t.IPAD || e === t.IPHONE || e === t.WP8 || e === t.TIZEN || e === t.BLACKBERRY || e === t.XIAOMI_GAME || n || r || s || o || a;
t.os = __getOS();
t.language = __getCurrentLanguage();
i = __getCurrentLanguageCode();
t.languageCode = i ? i.toLowerCase() : void 0;
t.osVersion = __getOSVersion();
t.osMainVersion = parseInt(t.osVersion);
t.browserType = null;
t.browserVersion = null;
var u, h = window.innerWidth, _ = window.innerHeight, f = window.devicePixelRatio || 1;
t.windowPixelResolution = {
width: f * h,
height: f * _
};
t.localStorage = window.localStorage;
u = t.capabilities = {
canvas: !1,
opengl: !0,
webp: !0
};
if (t.isMobile) {
u.accelerometer = !0;
u.touches = !0;
} else {
u.keyboard = !0;
u.mouse = !0;
u.touches = !1;
}
u.imageBitmap = !1;
t.__audioSupport = {
ONLY_ONE: !1,
WEB_AUDIO: !1,
DELAY_CREATE_CTX: !1,
format: [ ".mp3" ]
};
}
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.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) {
jsb.openURL(t);
};
t.now = function() {
return Date.now ? Date.now() : +new Date();
};
return t;
})();
e.exports = u;
}), {} ],
249: [ (function(t, e) {
"use strict";
var i = t("../event/event-target"), n = t("../platform/js"), r = t("../renderer");
t("../platform/CCClass");
var s = {
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
};
cc.sys.os === cc.sys.OS_IOS && (s.adaptationType = cc.sys.BROWSER_TYPE_SAFARI);
switch (s.adaptationType) {
case cc.sys.BROWSER_TYPE_SAFARI:
case cc.sys.BROWSER_TYPE_SOUGOU:
case cc.sys.BROWSER_TYPE_UC:
s.meta["minimal-ui"] = "true";
s.availWidth = function(t) {
return t.clientWidth;
};
s.availHeight = function(t) {
return t.clientHeight;
};
}
var o = null, a = function() {
i.call(this);
var t = this, e = cc.ContainerStrategy, n = cc.ContentStrategy;
s.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 = 4;
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, n.EXACT_FIT);
t._rpShowAll = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, n.SHOW_ALL);
t._rpNoBorder = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, n.NO_BORDER);
t._rpFixedHeight = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, n.FIXED_HEIGHT);
t._rpFixedWidth = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, n.FIXED_WIDTH);
cc.game.once(cc.game.EVENT_ENGINE_INITED, this.init, this);
};
cc.js.extend(a, i);
cc.js.mixin(a.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 o = cc.game.container.style, a = o.margin;
o.margin = "0";
o.display = "none";
e._initFrameSize();
o.margin = a;
o.display = "block";
} else e._initFrameSize();
if (!0 === t || e._isRotated !== s || e._frameSize.width !== n || e._frameSize.height !== r) {
var c = e._originalDesignResolutionSize.width, l = e._originalDesignResolutionSize.height;
e._resizing = !0;
c > 0 && e.setDesignResolutionSize(c, l, 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);
},
_resize: function() {
cc.view._resizeEvent(!0);
},
resizeWithBrowserSize: function(t) {
if (t) {
if (!this._resizeWithBrowserSize) {
this._resizeWithBrowserSize = !0;
window.addEventListener("resize", this._resize);
window.addEventListener("orientationchange", this._orientationChange);
}
} else if (this._resizeWithBrowserSize) {
this._resizeWithBrowserSize = !1;
window.removeEventListener("resize", this._resize);
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 = s.availWidth(cc.game.frame), i = s.availHeight(cc.game.frame), n = e >= i;
if (!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;
} else {
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, o = document.getElementsByName("viewport"), a = o ? o[0] : null;
n = a ? a.content : "";
(i = i || document.createElement("meta")).id = "cocosMetaElement";
i.name = "viewport";
i.content = "";
for (r in t) if (-1 == n.indexOf(r)) n += "," + r + "=" + t[r]; else if (e) {
s = new RegExp(r + "s*=s*[^,]+");
n = n.replace(s, r + "=" + t[r]);
}
/^,/.test(n) && (n = n.substr(1));
i.content = n;
a && (a.content = n);
document.head.appendChild(i);
},
_adjustViewportMeta: function() {
this._isAdjustViewport;
},
adjustViewportMeta: function(t) {
this._isAdjustViewport = t;
},
enableRetina: function(t) {
this._retinaEnabled = !!t;
},
isRetinaEnabled: function() {
return this._retinaEnabled;
},
enableAntiAlias: function(t) {
cc.warnID(9200);
if (this._antiAliasEnabled !== t) {
this._antiAliasEnabled = t;
if (cc.game.renderType === cc.game.RENDER_TYPE_WEBGL) cc.assetManager.assets.forEach((function(e) {
if (e instanceof cc.Texture2D) {
var i = cc.Texture2D.Filter;
t ? e.setFilters(i.LINEAR, i.LINEAR) : e.setFilters(i.NEAREST, i.NEAREST);
}
})); else if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) {
var e = cc.game.canvas.getContext("2d");
e.imageSmoothingEnabled = t;
e.mozImageSmoothingEnabled = t;
}
}
},
isAntiAliasEnabled: function() {
return this._antiAliasEnabled;
},
enableAutoFullScreen: function(t) {
if (t && t !== this._autoFullScreen && cc.sys.isMobile) {
this._autoFullScreen = !0;
cc.screen.autoFullScreen(cc.game.frame);
} else {
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;
n && n.preApply(this);
cc.sys.isMobile && this._adjustViewportMeta();
this._orientationChanging = !0;
this._resizing || this._initFrameSize();
if (n) {
this._originalDesignResolutionSize.width = this._designResolutionSize.width = t;
this._originalDesignResolutionSize.height = this._designResolutionSize.height = e;
var s = n.apply(this, this._designResolutionSize);
if (s.scale && 2 === s.scale.length) {
this._scaleX = s.scale[0];
this._scaleY = s.scale[1];
}
if (s.viewport) {
var o = this._viewportRect, a = this._visibleRect, c = s.viewport;
o.x = c.x;
o.y = c.y;
o.width = c.width;
o.height = c.height;
a.x = 0;
a.y = 0;
a.width = c.width / this._scaleX;
a.height = c.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);
r.updateCameraViewport();
cc.internal.inputManager._updateCanvasBoundingRect();
this.emit("design-resolution-changed");
} else cc.logID(2201);
} else cc.errorID(2200);
},
getDesignResolutionSize: function() {
return cc.size(this._designResolutionSize.width, this._designResolutionSize.height);
},
setRealPixelResolution: function(t, e, i) {
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), c = Math.ceil(e * s + this._viewportRect.y), l = Math.ceil(i * r), u = Math.ceil(n * s), h = cc.game._renderContext;
if (!o) {
var _ = h.getParameter(h.SCISSOR_BOX);
o = cc.rect(_[0], _[1], _[2], _[3]);
}
if (o.x !== a || o.y !== c || o.width !== l || o.height !== u) {
o.x = a;
o.y = c;
o.width = l;
o.height = u;
h.scissor(a, c, l, u);
}
},
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, o = i.adjustedTop ? i.adjustedTop : i.top, a = this._devicePixelRatio * (t - s), c = this._devicePixelRatio * (o + i.height - e);
if (this._isRotated) {
r.x = cc.game.canvas.width - c;
r.y = a;
} else {
r.x = a;
r.y = c;
}
return 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, o = this._scaleY, a = 0; a < t.length; a++) {
i = (e = t[a])._point;
n = e._prevPoint;
i.x = (i.x - r.x) / s;
i.y = (i.y - r.y) / o;
n.x = (n.x - r.x) / s;
n.y = (n.y - r.y) / o;
}
}
});
cc.ContainerStrategy = cc.Class({
name: "ContainerStrategy",
preApply: function() {},
apply: function() {},
postApply: function() {},
_setupContainer: function(t, e, i) {
var n = cc.game.canvas;
this._setupStyle(t, e, i);
var r = t._devicePixelRatio = 1;
r = t._devicePixelRatio = window.devicePixelRatio;
n.width = e * r;
n.height = i * r;
},
_setupStyle: function(t, e, i) {
var n = cc.game.canvas, r = cc.game.container;
if (cc.sys.os === cc.sys.OS_ANDROID) {
document.body.style.width = (t._isRotated ? i : e) + "px";
document.body.style.height = (t._isRotated ? e : i) + "px";
}
r.style.width = n.style.width = e + "px";
r.style.height = n.style.height = i + "px";
},
_fixContainer: function() {
document.body.insertBefore(cc.game.container, document.body.firstChild);
var t = document.body.style;
t.width = window.innerWidth + "px";
t.height = window.innerHeight + "px";
t.overflow = "hidden";
var e = cc.game.container.style;
e.position = "fixed";
e.left = e.top = "0px";
document.body.scrollTop = 0;
}
});
cc.ContentStrategy = cc.Class({
name: "ContentStrategy",
ctor: function() {
this._result = {
scale: [ 1, 1 ],
viewport: null
};
},
_buildResult: function(t, e, i, n, r, s) {
Math.abs(t - i) < 2 && (i = t);
Math.abs(e - n) < 2 && (n = e);
var o = cc.rect((t - i) / 2, (e - n) / 2, i, n);
cc.game.renderType, cc.game.RENDER_TYPE_CANVAS;
this._result.scale = [ r, s ];
this._result.viewport = o;
return this._result;
},
preApply: function() {},
apply: function() {
return {
scale: [ 1, 1 ]
};
},
postApply: function() {}
});
(function() {
var t = cc.Class({
name: "EqualToFrame",
extends: cc.ContainerStrategy,
apply: function(t) {
var e = t._frameSize.height, i = cc.game.container.style;
this._setupContainer(t, t._frameSize.width, t._frameSize.height);
t._isRotated ? i.margin = "0 0 0 " + e + "px" : i.margin = "0px";
i.padding = "0px";
}
}), e = cc.Class({
name: "ProportionalToFrame",
extends: cc.ContainerStrategy,
apply: function(t, e) {
var i, n, r = t._frameSize.width, s = t._frameSize.height, o = cc.game.container.style, a = e.width, c = e.height, l = r / a, u = s / c;
l < u ? (i = r, n = c * l) : (i = a * u, n = s);
var h = Math.round((r - i) / 2), _ = Math.round((s - n) / 2);
i = r - 2 * h;
n = s - 2 * _;
this._setupContainer(t, i, n);
t._isRotated ? o.margin = "0 0 0 " + s + "px" : o.margin = "0px";
o.paddingLeft = h + "px";
o.paddingRight = h + "px";
o.paddingTop = _ + "px";
o.paddingBottom = _ + "px";
}
}), i = (cc.Class({
name: "EqualToWindow",
extends: t,
preApply: function(t) {
this._super(t);
cc.game.frame = document.documentElement;
},
apply: function(t) {
this._super(t);
this._fixContainer();
}
}), cc.Class({
name: "ProportionalToWindow",
extends: e,
preApply: function(t) {
this._super(t);
cc.game.frame = document.documentElement;
},
apply: function(t, e) {
this._super(t, e);
this._fixContainer();
}
}), cc.Class({
name: "OriginalContainer",
extends: cc.ContainerStrategy,
apply: function(t) {
this._setupContainer(t, cc.game.canvas.width, cc.game.canvas.height);
}
})), n = ("undefined" == typeof window ? global : window).__globalAdapter;
if (n) {
n.adaptContainerStrategy && n.adaptContainerStrategy(cc.ContainerStrategy.prototype);
n.adaptView && n.adaptView(a.prototype);
}
cc.ContainerStrategy.EQUAL_TO_FRAME = new t();
cc.ContainerStrategy.PROPORTION_TO_FRAME = new e();
cc.ContainerStrategy.ORIGINAL_CONTAINER = new i();
var r = cc.Class({
name: "ExactFit",
extends: cc.ContentStrategy,
apply: function(t, e) {
var i = cc.game.canvas.width, n = cc.game.canvas.height, r = i / e.width, s = n / e.height;
return this._buildResult(i, n, i, n, r, s);
}
}), s = cc.Class({
name: "ShowAll",
extends: cc.ContentStrategy,
apply: function(t, e) {
var i, n, r = cc.game.canvas.width, s = cc.game.canvas.height, o = e.width, a = e.height, c = r / o, l = s / a, u = 0;
c < l ? (i = r, n = a * (u = c)) : (i = o * (u = l), n = s);
return this._buildResult(r, s, i, n, u, u);
}
}), o = cc.Class({
name: "NoBorder",
extends: cc.ContentStrategy,
apply: function(t, e) {
var i, n, r, s = cc.game.canvas.width, o = cc.game.canvas.height, a = e.width, c = e.height, l = s / a, u = o / c;
l < u ? (n = a * (i = u), r = o) : (n = s, r = c * (i = l));
return this._buildResult(s, o, n, r, i, i);
}
}), c = cc.Class({
name: "FixedHeight",
extends: cc.ContentStrategy,
apply: function(t, e) {
var i = cc.game.canvas.width, n = cc.game.canvas.height, r = n / e.height, s = i, o = n;
return this._buildResult(i, n, s, o, r, r);
}
}), l = cc.Class({
name: "FixedWidth",
extends: cc.ContentStrategy,
apply: function(t, e) {
var i = cc.game.canvas.width, n = cc.game.canvas.height, r = i / e.width, s = i, o = n;
return this._buildResult(i, n, s, o, r, r);
}
});
cc.ContentStrategy.EXACT_FIT = new r();
cc.ContentStrategy.SHOW_ALL = new s();
cc.ContentStrategy.NO_BORDER = new o();
cc.ContentStrategy.FIXED_HEIGHT = new c();
cc.ContentStrategy.FIXED_WIDTH = new l();
})();
cc.ResolutionPolicy = cc.Class({
name: "cc.ResolutionPolicy",
ctor: function(t, e) {
this._containerStrategy = null;
this._contentStrategy = null;
this.setContainerStrategy(t);
this.setContentStrategy(e);
},
preApply: function(t) {
this._containerStrategy.preApply(t);
this._contentStrategy.preApply(t);
},
apply: function(t, e) {
this._containerStrategy.apply(t, e);
return this._contentStrategy.apply(t, e);
},
postApply: function(t) {
this._containerStrategy.postApply(t);
this._contentStrategy.postApply(t);
},
setContainerStrategy: function(t) {
t instanceof cc.ContainerStrategy && (this._containerStrategy = t);
},
setContentStrategy: function(t) {
t instanceof cc.ContentStrategy && (this._contentStrategy = t);
}
});
n.get(cc.ResolutionPolicy.prototype, "canvasSize", (function() {
return cc.v2(cc.game.canvas.width, cc.game.canvas.height);
}));
cc.ResolutionPolicy.EXACT_FIT = 0;
cc.ResolutionPolicy.NO_BORDER = 1;
cc.ResolutionPolicy.SHOW_ALL = 2;
cc.ResolutionPolicy.FIXED_HEIGHT = 3;
cc.ResolutionPolicy.FIXED_WIDTH = 4;
cc.ResolutionPolicy.UNKNOWN = 5;
cc.view = new a();
cc.winSize = cc.size();
e.exports = cc.view;
}), {
"../event/event-target": 186,
"../platform/CCClass": 239,
"../platform/js": 260,
"../renderer": 271
} ],
250: [ (function() {
"use strict";
cc.visibleRect = {
topLeft: cc.v2(0, 0),
topRight: cc.v2(0, 0),
top: cc.v2(0, 0),
bottomLeft: cc.v2(0, 0),
bottomRight: cc.v2(0, 0),
bottom: cc.v2(0, 0),
center: cc.v2(0, 0),
left: cc.v2(0, 0),
right: cc.v2(0, 0),
width: 0,
height: 0,
init: function(t) {
var e = this.width = t.width, i = this.height = t.height, n = t.x, r = t.y, s = r + i, o = n + e;
this.topLeft.x = n;
this.topLeft.y = s;
this.topRight.x = o;
this.topRight.y = s;
this.top.x = n + e / 2;
this.top.y = s;
this.bottomLeft.x = n;
this.bottomLeft.y = r;
this.bottomRight.x = o;
this.bottomRight.y = r;
this.bottom.x = n + e / 2;
this.bottom.y = r;
this.center.x = n + e / 2;
this.center.y = r + i / 2;
this.left.x = n;
this.left.y = r + i / 2;
this.right.x = o;
this.right.y = r + i / 2;
}
};
}), {} ],
251: [ (function(t, e) {
"use strict";
var i = t("./js"), n = (t("./utils").isPlainEmptyObj_DEV, "$_$");
function r(t, e) {
var n = e ? Object.create(e) : {};
i.value(t, "__attrs__", n);
return n;
}
function s(t) {
if ("function" != typeof t) return r(t, o(t.constructor));
for (var e, i = cc.Class.getInheritanceChain(t), n = i.length - 1; n >= 0; n--) {
var s = i[n];
s.hasOwnProperty("__attrs__") && s.__attrs__ || r(s, (e = i[n + 1]) && e.__attrs__);
}
r(t, (e = i[0]) && e.__attrs__);
return t.__attrs__;
}
function o(t) {
return t.hasOwnProperty("__attrs__") && t.__attrs__ || s(t);
}
function a(t, e) {
this.name = t;
this.default = e;
}
a.prototype.toString = function() {
return this.name;
};
cc.Integer = new a("Integer", 0);
cc.Float = new a("Float", 0);
cc.Boolean = new a("Boolean", !1);
cc.String = new a("String", "");
e.exports = {
PrimitiveType: a,
attr: function(t, e) {
var i = o(t), r = e + n, s = {};
for (var a in i) a.startsWith(r) && (s[a.slice(r.length)] = i[a]);
return s;
},
getClassAttrs: o,
setClassAttr: function(t, e, i, r) {
o(t)[e + n + i] = r;
},
DELIMETER: n,
getTypeChecker_ET: !1,
getObjTypeChecker_ET: !1,
ScriptUuid: {}
};
}), {
"./CCClass": 239,
"./js": 260,
"./utils": 263
} ],
252: [ (function(t, e) {
"use strict";
var i = t("./js"), n = i.array.fastRemoveAt;
function r() {}
function s() {
this.callback = r;
this.target = void 0;
this.once = !1;
}
s.prototype.set = function(t, e, i) {
this.callback = t;
this.target = e;
this.once = !!i;
};
var o = new i.Pool(function(t) {
t.callback = r;
t.target = void 0;
t.once = !1;
return !0;
}, 32);
o.get = function() {
return this._get() || new s();
};
function a() {
this.callbackInfos = [];
this.isInvoking = !1;
this.containCanceled = !1;
}
var c = a.prototype;
c.removeByCallback = function(t) {
for (var e = 0; e < this.callbackInfos.length; ++e) {
var i = this.callbackInfos[e];
if (i && i.callback === t) {
o.put(i);
n(this.callbackInfos, e);
--e;
}
}
};
c.removeByTarget = function(t) {
for (var e = 0; e < this.callbackInfos.length; ++e) {
var i = this.callbackInfos[e];
if (i && i.target === t) {
o.put(i);
n(this.callbackInfos, e);
--e;
}
}
};
c.cancel = function(t) {
var e = this.callbackInfos[t];
if (e) {
o.put(e);
this.callbackInfos[t] = null;
}
this.containCanceled = !0;
};
c.cancelAll = function() {
for (var t = 0; t < this.callbackInfos.length; t++) {
var e = this.callbackInfos[t];
if (e) {
o.put(e);
this.callbackInfos[t] = null;
}
}
this.containCanceled = !0;
};
c.purgeCanceled = function() {
for (var t = this.callbackInfos.length - 1; t >= 0; --t) this.callbackInfos[t] || n(this.callbackInfos, t);
this.containCanceled = !1;
};
c.clear = function() {
this.cancelAll();
this.callbackInfos.length = 0;
this.isInvoking = !1;
this.containCanceled = !1;
};
var l = new i.Pool(function(t) {
t.callbackInfos = [];
t.isInvoking = !1;
t.containCanceled = !1;
return !0;
}, 16);
l.get = function() {
return this._get() || new a();
};
function u() {
this._callbackTable = i.createMap(!0);
}
(c = u.prototype).on = function(t, e, i, n) {
var r = this._callbackTable[t];
r || (r = this._callbackTable[t] = l.get());
var s = o.get();
s.set(e, i, n);
r.callbackInfos.push(s);
};
c.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; s < r.length; ++s) if (r[s]) return !0;
return !1;
}
return r.length > 0;
}
for (var o = 0; o < r.length; ++o) {
var a = r[o];
if (a && a.callback === e && a.target === i) return !0;
}
return !1;
};
c.removeAll = function(t) {
if ("string" == typeof t) {
var e = this._callbackTable[t];
if (e) if (e.isInvoking) e.cancelAll(); else {
e.clear();
l.put(e);
delete this._callbackTable[t];
}
} else if (t) for (var i in this._callbackTable) {
var n = this._callbackTable[i];
if (n.isInvoking) for (var r = n.callbackInfos, s = 0; s < r.length; ++s) {
var o = r[s];
o && o.target === t && n.cancel(s);
} else n.removeByTarget(t);
}
};
c.off = function(t, e, i) {
var r = this._callbackTable[t];
if (r) for (var s = r.callbackInfos, a = 0; a < s.length; ++a) {
var c = s[a];
if (c && c.callback === e && c.target === i) {
if (r.isInvoking) r.cancel(a); else {
n(s, a);
o.put(c);
}
break;
}
}
};
c.emit = function(t, e, i, n, r, s) {
var o = this._callbackTable[t];
if (o) {
var a = !o.isInvoking;
o.isInvoking = !0;
for (var c = o.callbackInfos, l = 0, u = c.length; l < u; ++l) {
var h = c[l];
if (h) {
var _ = h.target, f = h.callback;
h.once && this.off(t, f, _);
_ ? f.call(_, e, i, n, r, s) : f(e, i, n, r, s);
}
}
if (a) {
o.isInvoking = !1;
o.containCanceled && o.purgeCanceled();
}
}
};
e.exports = u;
}), {
"./js": 260
} ],
253: [ (function(t, e) {
"use strict";
function i(t, e) {
for (var n = 0; n < e.length; n++) {
var r = e[n];
Array.isArray(r) ? i(t, r) : t.push(r);
}
}
e.exports = {
flattenCodeArray: function(t) {
var e = [];
i(e, t);
return e.join("");
}
};
}), {} ],
254: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = L;
i.unpackJSONs = function(t, e) {
if (t[0] < 1) throw new Error(cc.debug.getError(5304, t[0]));
D(t, !0, e);
P(t);
for (var i = new O(t[0]), n = t[1], r = t[2], s = t[3], o = t[4], a = t[v], c = 0; c < a.length; ++c) a[c].unshift(i, n, r, s, o);
return a;
};
i.packCustomObjData = function(t, e, i) {
return [ 1, f, f, [ t ], f, i ? [ e, -1 ] : [ e ], [ 0 ], f, [], [], [] ];
};
i.hasNativeDep = function(t) {
var e = t[5], i = e[e.length - 1];
return "number" == typeof i && i < 0;
};
i.getDependUuidList = function(t) {
var e = t[1];
return t[10].map((function(t) {
return e[t];
}));
};
var n = _(t("./js")), r = _(t("../value-types/vec2")), s = _(t("../value-types/vec3")), o = _(t("../value-types/vec4")), a = _(t("../value-types/color")), c = _(t("../value-types/size")), l = _(t("../value-types/rect")), u = _(t("../value-types/quat")), h = _(t("../value-types/mat4"));
function _(t) {
return t && t.__esModule ? t : {
default: t
};
}
var f = 0, d = [ r.default, s.default, o.default, u.default, a.default, c.default, l.default, h.default ];
function p(t, e) {
t.x = e[1];
t.y = e[2];
t.z = e[3];
t.w = e[4];
}
var m = [ function(t, e) {
t.x = e[1];
t.y = e[2];
}, function(t, e) {
t.x = e[1];
t.y = e[2];
t.z = e[3];
}, p, p, function(t, e) {
t._val = e[1];
}, function(t, e) {
t.width = e[1];
t.height = e[2];
}, function(t, e) {
t.x = e[1];
t.y = e[2];
t.width = e[3];
t.height = e[4];
}, function(t, e) {
h.default.fromArray(t, e, 1);
} ], y = 0, v = 5, g = (function() {
function t() {
this.uuidObjList = null;
this.uuidPropList = null;
this.uuidList = null;
}
var e = t.prototype;
e.init = function(t) {
this.uuidObjList = t[8];
this.uuidPropList = t[9];
this.uuidList = t[10];
};
e.reset = function() {
this.uuidList = null;
this.uuidObjList = null;
this.uuidPropList = null;
};
e.push = function(t, e, i) {
this.uuidObjList.push(t);
this.uuidPropList.push(e);
this.uuidList.push(i);
};
return t;
})();
g.pool = new n.default.Pool(function(t) {
t.reset();
}, 5);
g.pool.get = function() {
return this._get() || new g();
};
function b(t, e, i) {
for (var n = t.length - 1, r = 0, s = 3 * t[n]; r < s; r += 3) {
var o = t[r], a = e[t[r + 2]], c = t[r + 1];
c >= 0 ? o[i[c]] = a : o[~c] = a;
}
for (;r < n; r += 3) {
var l = e[t[r]], u = e[t[r + 2]], h = t[r + 1];
h >= 0 ? l[i[h]] = u : l[~h] = u;
}
}
function C(t, e) {
for (var i = t[4][e[0]], n = i[0], r = new (0, n[0])(), s = n[1], o = n[2], a = i[i.length - 1], c = 1; c < a; ++c) r[s[i[c]]] = e[c];
for (;c < e.length; ++c) {
var l = s[i[c]], u = n[i[c] + o];
(0, E[u])(t, r, l, e[c]);
}
return r;
}
function x(t, e, i) {
var r = new e();
r._deserialize ? r._deserialize(i, t[0]) : cc.errorID(5303, n.default.getClassName(e));
return r;
}
function A(t, e, i, n) {
n >= 0 ? e[i] = t[5][n] : t[7][3 * ~n] = e;
}
function S(t) {
return function(e, i, n, r) {
i[n] = r;
for (var s = 0; s < r.length; ++s) t(e, r, s, r[s]);
};
}
function T(t, e, i, n) {
e[i] = null;
t[8][n] = e;
}
function w(t, e, i, n) {
e[i] = C(t, n);
}
var E = new Array(13);
E[0] = function(t, e, i, n) {
e[i] = n;
};
E[1] = A;
E[2] = S(A);
E[3] = S(T);
E[4] = w;
E[5] = function(t, e, i, n) {
m[n[0]](e[i], n);
};
E[6] = T;
E[7] = function(t, e, i, n) {
e[i].set(n);
};
E[8] = function(t, e, i, n) {
var r = new d[n[0]]();
m[n[0]](r, n);
e[i] = r;
};
E[9] = S(w);
E[10] = function(t, e, i, n) {
var r = t[3][n[0]];
e[i] = x(t, r, n[1]);
};
E[11] = function(t, e, i, n) {
var r = n[0];
e[i] = r;
for (var s = 1; s < n.length; s += 3) {
var o = n[s], a = n[s + 1], c = n[s + 2];
(0, E[a])(t, r, o, c);
}
};
E[12] = function(t, e, i, n) {
var r = n[0];
e[i] = r;
for (var s = 0; s < r.length; ++s) {
var o = r[s], a = n[s + 1];
0 !== a && (0, E[a])(t, r, s, o);
}
};
function M(t) {
var e = t[5], i = t[6], n = 0 === i ? 0 : i.length, r = e[e.length - 1], s = e.length - n;
if ("number" != typeof r) r = 0; else {
r < 0 && (r = ~r);
--s;
}
for (var o = 0; o < s; ++o) e[o] = C(t, e[o]);
for (var a = t[3], c = 0; c < n; ++c, ++o) {
var l = i[c], u = e[o];
if (l >= 0) {
var h = a[l];
e[o] = x(t, h, u);
} else (0, E[l = ~l])(t, e, o, u);
}
return r;
}
function B(t, e) {
t || L.reportMissingClass(e);
return Object;
}
function I(t, e, i, n, r, s) {
var o = t(e);
if (!o) {
if (r) {
i[n] = (function(e, i, n) {
return function() {
var r = t(n) || B(s, n);
e[i] = r;
return new r();
};
})(i, n, e);
return;
}
o = B(s, e);
}
i[n] = o;
}
function D(t, e, i) {
for (var r = i || n.default._getClassById, s = t[3], o = 0; o < s.length; ++o) {
var a = s[o];
"string" != typeof a ? I(r, a[0], a, y, e, i) : I(r, a, s, o, e, i);
}
}
function P(t) {
var e = t[4];
if (e) for (var i = t[3], n = 0; n < e.length; ++n) {
var r = e[n];
r[0] = i[r[0]];
}
}
function R(t) {
for (var e = t[5], i = t[2], n = t[1], r = t[8], s = t[9], o = t[10], a = 0; a < r.length; ++a) {
var c = r[a];
"number" == typeof c && (r[a] = e[c]);
var l = s[a];
if ("number" == typeof l) {
l = l >= 0 ? i[l] : ~l;
s[a] = l;
}
var u = o[a];
"number" == typeof u && (o[a] = n[u]);
}
}
function L(t, e, i) {
"string" == typeof t && (t = JSON.parse(t));
var n = !e;
(e = e || g.pool.get()).init(t);
i = i || {};
var r = t[0], s = !1;
if ("object" == typeof r) {
s = r.preprocessed;
r = r.version;
}
if (r < 1) throw new Error(cc.debug.getError(5304, r));
i._version = r;
i.result = e;
t[0] = i;
if (!s) {
D(t, !1, i.classFinder);
P(t);
}
cc.game._isCloning = !0;
var o = t[5], a = M(t);
cc.game._isCloning = !1;
t[7] && b(t[7], o, t[2]);
R(t);
n && g.pool.put(e);
return o[a];
}
L.Details = g;
var O = function(t) {
this.preprocessed = !0;
this.version = t;
};
}), {
"../value-types/color": 336,
"../value-types/mat4": 339,
"../value-types/quat": 340,
"../value-types/rect": 341,
"../value-types/size": 342,
"../value-types/vec2": 346,
"../value-types/vec3": 347,
"../value-types/vec4": 348,
"./js": 260
} ],
255: [ (function(t) {
"use strict";
var e, i = (e = t("./deserialize-compiled")) && e.__esModule ? e : {
default: e
};
i.default.reportMissingClass = function(t) {
cc.warnID(5302, t);
};
cc.deserialize = i.default;
}), {
"./deserialize-compiled": 254,
"./deserialize-editor": void 0
} ],
256: [ (function(t, e) {
"use strict";
var i = ".";
function n(t) {
this.id = 0 | 998 * Math.random();
this.prefix = t ? t + i : "";
}
n.prototype.getNewId = function() {
return this.prefix + ++this.id;
};
n.global = new n("global");
e.exports = n;
}), {} ],
257: [ (function(t) {
"use strict";
t("./js");
t("./CCClass");
t("./CCClassDecorator");
t("./CCEnum");
t("./CCObject");
t("./callbacks-invoker");
t("./deserialize");
t("./instantiate");
t("./instantiate-jit");
t("./requiring-frame");
t("./CCSys");
t("./CCMacro");
t("./CCVisibleRect");
}), {
"./CCClass": 239,
"./CCClassDecorator": 240,
"./CCEnum": 241,
"./CCMacro": 244,
"./CCObject": 245,
"./CCSys": 248,
"./CCVisibleRect": 250,
"./callbacks-invoker": 252,
"./deserialize": 255,
"./instantiate": 259,
"./instantiate-jit": 258,
"./js": 260,
"./requiring-frame": 262
} ],
258: [ (function(t, e) {
"use strict";
var i = t("./CCObject"), n = i.Flags.Destroyed, r = i.Flags.PersistentMask, s = t("./attribute"), o = t("./js"), a = t("./CCClass"), c = t("./compiler"), l = s.DELIMETER + "default", u = a.IDENTIFIER_RE, h = a.escapeForJS, _ = "var ", f = "o", d = "t", p = {
"cc.Node": "cc.Node",
"cc.Sprite": "cc.Sprite",
"cc.Label": "cc.Label",
"cc.Button": "cc.Button",
"cc.Widget": "cc.Widget",
"cc.Animation": "cc.Animation",
"cc.ClickEvent": !1,
"cc.PrefabInfo": !1
};
try {
!Float32Array.name && (Float32Array.name = "Float32Array");
!Float64Array.name && (Float64Array.name = "Float64Array");
!Int8Array.name && (Int8Array.name = "Int8Array");
!Int16Array.name && (Int16Array.name = "Int16Array");
!Int32Array.name && (Int32Array.name = "Int32Array");
!Uint8Array.name && (Uint8Array.name = "Uint8Array");
!Uint16Array.name && (Uint16Array.name = "Uint16Array");
!Uint32Array.name && (Uint32Array.name = "Uint32Array");
!Uint8ClampedArray.name && (Uint8ClampedArray.name = "Uint8ClampedArray");
} catch (t) {}
function m(t) {
if (t === Float32Array) return "Float32Array";
if (t === Float64Array) return "Float64Array";
if (t === Int8Array) return "Int8Array";
if (t === Int16Array) return "Int16Array";
if (t === Int32Array) return "Int32Array";
if (t === Uint8Array) return "Uint8Array";
if (t === Uint16Array) return "Uint16Array";
if (t === Uint32Array) return "Uint32Array";
if (t === Uint8ClampedArray) return "Uint8ClampedArray";
throw new Error("Unknown TypedArray to instantiate: " + t);
}
function y(t, e) {
this.varName = t;
this.expression = e;
}
y.prototype.toString = function() {
return _ + this.varName + "=" + this.expression + ";";
};
function v(t, e) {
return e instanceof y ? new y(e.varName, t + e.expression) : t + e;
}
function g(t, e, i) {
if (Array.isArray(i)) {
i[0] = v(e, i[0]);
t.push(i);
} else t.push(v(e, i) + ";");
}
function b(t) {
this._exps = [];
this._targetExp = t;
}
b.prototype.append = function(t, e) {
this._exps.push([ t, e ]);
};
b.prototype.writeCode = function(t) {
var e;
if (this._exps.length > 1) {
t.push(d + "=" + this._targetExp + ";");
e = d;
} else {
if (1 !== this._exps.length) return;
e = this._targetExp;
}
for (var i = 0; i < this._exps.length; i++) {
var n = this._exps[i];
g(t, e + x(n[0]) + "=", n[1]);
}
};
b.pool = new o.Pool(function(t) {
t._exps.length = 0;
t._targetExp = null;
}, 1);
b.pool.get = function(t) {
var e = this._get() || new b();
e._targetExp = t;
return e;
};
function C(t, e) {
if ("function" == typeof t) try {
t = t();
} catch (t) {
return !1;
}
if (t === e) return !0;
if (t && e && "object" == typeof t && "object" == typeof e && t.constructor === e.constructor) if (t instanceof cc.ValueType) {
if (t.equals(e)) return !0;
} else {
if (Array.isArray(t)) return 0 === t.length && 0 === e.length;
if (t.constructor === Object) return o.isEmptyObject(t) && o.isEmptyObject(e);
}
return !1;
}
function x(t) {
return u.test(t) ? "." + t : "[" + h(t) + "]";
}
function A(t, e) {
this.parent = e;
this.objsToClear_iN$t = [];
this.codeArray = [];
this.objs = [];
this.funcs = [];
this.funcModuleCache = o.createMap();
o.mixin(this.funcModuleCache, p);
this.globalVariables = [];
this.globalVariableId = 0;
this.localVariableId = 0;
this.codeArray.push(_ + f + "," + d + ";", "if(R){", f + "=R;", "}else{", f + "=R=new " + this.getFuncModule(t.constructor, !0) + "();", "}");
o.value(t, "_iN$t", {
globalVar: "R"
}, !0);
this.objsToClear_iN$t.push(t);
this.enumerateObject(this.codeArray, t);
var i;
this.globalVariables.length > 0 && (i = _ + this.globalVariables.join(",") + ";");
var n = c.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; r < s; ++r) this.objsToClear_iN$t[r]._iN$t = null;
this.objsToClear_iN$t.length = 0;
}
var S = A.prototype;
S.getFuncModule = function(t, e) {
var i = o.getClassName(t);
if (i) {
var n = this.funcModuleCache[i];
if (n) return n;
if (void 0 === n) {
var r = -1 !== i.indexOf(".");
if (r) try {
if (r = t === Function("return " + i)()) {
this.funcModuleCache[i] = i;
return i;
}
} catch (t) {}
}
}
var s = this.funcs.indexOf(t);
if (s < 0) {
s = this.funcs.length;
this.funcs.push(t);
}
var a = "F[" + s + "]";
e && (a = "(" + a + ")");
this.funcModuleCache[i] = a;
return a;
};
S.getObjRef = function(t) {
var e = this.objs.indexOf(t);
if (e < 0) {
e = this.objs.length;
this.objs.push(t);
}
return "O[" + e + "]";
};
S.setValueType = function(t, e, i, n) {
var r = b.pool.get(n), s = e.constructor.__props__;
s || (s = Object.keys(e));
for (var o = 0; o < s.length; o++) {
var a = s[o], c = i[a];
if (e[a] !== c) {
var l = this.enumerateField(i, a, c);
r.append(a, l);
}
}
r.writeCode(t);
b.pool.put(r);
};
S.enumerateCCClass = function(t, e, i) {
for (var n = i.__values__, r = s.getClassAttrs(i), o = 0; o < n.length; o++) {
var c = n[o], u = e[c], h = r[c + l];
if (!C(h, u)) if ("object" == typeof u && u instanceof cc.ValueType && (h = a.getDefault(h)) && h.constructor === u.constructor) {
var _ = f + x(c);
this.setValueType(t, h, u, _);
} else this.setObjProp(t, e, c, u);
}
};
S.instantiateArray = function(t) {
if (0 === t.length) return "[]";
var e = "a" + ++this.localVariableId, i = [ new y(e, "new Array(" + t.length + ")") ];
o.value(t, "_iN$t", {
globalVar: "",
source: i
}, !0);
this.objsToClear_iN$t.push(t);
for (var n = 0; n < t.length; ++n) g(i, e + "[" + n + "]=", this.enumerateField(t, n, t[n]));
return i;
};
S.instantiateTypedArray = function(t) {
var e = t.constructor.name || m(t.constructor);
if (0 === t.length) return "new " + e;
var i = "a" + ++this.localVariableId, n = [ new y(i, "new " + e + "(" + t.length + ")") ];
t._iN$t = {
globalVar: "",
source: n
};
this.objsToClear_iN$t.push(t);
for (var r = 0; r < t.length; ++r) 0 !== t[r] && g(n, i + "[" + r + "]=", t[r]);
return n;
};
S.enumerateField = function(t, e, n) {
if ("object" == typeof n && n) {
var s = n._iN$t;
if (s) {
var o = s.globalVar;
if (!o) {
o = s.globalVar = "v" + ++this.globalVariableId;
this.globalVariables.push(o);
var a = s.source[0];
s.source[0] = v(o + "=", a);
}
return o;
}
return ArrayBuffer.isView(n) ? this.instantiateTypedArray(n) : Array.isArray(n) ? this.instantiateArray(n) : this.instantiateObj(n);
}
if ("function" == typeof n) return this.getFuncModule(n);
if ("string" == typeof n) return h(n);
"_objFlags" === e && t instanceof i && (n &= r);
return n;
};
S.setObjProp = function(t, e, i, n) {
g(t, f + x(i) + "=", this.enumerateField(e, i, n));
};
S.enumerateObject = function(t, e) {
var i = e.constructor;
if (cc.Class._isCCClass(i)) this.enumerateCCClass(t, e, i); else for (var n in e) if (e.hasOwnProperty(n) && (95 !== n.charCodeAt(0) || 95 !== n.charCodeAt(1) || "__type__" === n)) {
var r = e[n];
"object" == typeof r && r && r === e._iN$t || this.setObjProp(t, e, n, r);
}
};
S.instantiateObj = function(t) {
if (t instanceof cc.ValueType) return a.getNewValueTypeCode(t);
if (t instanceof cc.Asset) return this.getObjRef(t);
if (t._objFlags & n) return null;
var e, i = t.constructor;
if (cc.Class._isCCClass(i)) {
if (this.parent) if (this.parent instanceof cc.Component) {
if (t instanceof cc._BaseNode || t instanceof cc.Component) return this.getObjRef(t);
} else if (this.parent instanceof cc._BaseNode) if (t instanceof cc._BaseNode) {
if (!t.isChildOf(this.parent)) return this.getObjRef(t);
} else if (t instanceof cc.Component && !t.node.isChildOf(this.parent)) return this.getObjRef(t);
e = new y(f, "new " + this.getFuncModule(i, !0) + "()");
} else if (i === Object) e = new y(f, "{}"); else {
if (i) return this.getObjRef(t);
e = new y(f, "Object.create(null)");
}
var r = [ e ];
o.value(t, "_iN$t", {
globalVar: "",
source: r
}, !0);
this.objsToClear_iN$t.push(t);
this.enumerateObject(r, t);
return [ "(function(){", r, "return o;})();" ];
};
e.exports = {
compile: function(t) {
return new A(t, t instanceof cc._BaseNode && t).result;
},
equalsToDefault: C
};
}), {
"./CCClass": 239,
"./CCObject": 245,
"./attribute": 251,
"./compiler": 253,
"./js": 260
} ],
259: [ (function(t, e) {
"use strict";
var i = t("./CCObject"), n = t("../value-types/value-type"), r = i.Flags.Destroyed, s = i.Flags.PersistentMask, o = t("./utils").isDomNode, a = t("./js");
function c(t, e) {
if (!e) {
if ("object" != typeof t || Array.isArray(t)) return null;
if (!t) return null;
if (!cc.isValid(t)) return null;
}
var n;
if (t instanceof i) {
if (t._instantiate) {
cc.game._isCloning = !0;
n = t._instantiate(null, !0);
cc.game._isCloning = !1;
return n;
}
if (t instanceof cc.Asset) return null;
}
cc.game._isCloning = !0;
n = u(t);
cc.game._isCloning = !1;
return n;
}
var l = [];
function u(t, e) {
if (Array.isArray(t)) return null;
if (o && o(t)) return null;
var i;
_(t, i = t._iN$t ? t._iN$t : t.constructor ? new (0, t.constructor)() : Object.create(null), e);
for (var n = 0, r = l.length; n < r; ++n) l[n]._iN$t = null;
l.length = 0;
return i;
}
function h(t, e, i, r) {
for (var s = t.__values__, o = 0; o < s.length; o++) {
var a = s[o], c = e[a];
if ("object" == typeof c && c) {
var l = i[a];
l instanceof n && l.constructor === c.constructor ? l.set(c) : i[a] = c._iN$t || f(c, r);
} else i[a] = c;
}
}
function _(t, e, n) {
a.value(t, "_iN$t", e, !0);
l.push(t);
var r = t.constructor;
if (cc.Class._isCCClass(r)) h(r, t, e, n); else for (var o in t) if (t.hasOwnProperty(o) && (95 !== o.charCodeAt(0) || 95 !== o.charCodeAt(1) || "__type__" === o)) {
var c = t[o];
if ("object" == typeof c && c) {
if (c === e) continue;
e[o] = c._iN$t || f(c, n);
} else e[o] = c;
}
t instanceof i && (e._objFlags &= s);
}
function f(t, e) {
if (t instanceof n) return t.clone();
if (t instanceof cc.Asset) return t;
var i;
if (ArrayBuffer.isView(t)) {
var s = t.length;
i = new t.constructor(s);
t._iN$t = i;
l.push(t);
for (var o = 0; o < s; ++o) i[o] = t[o];
return i;
}
if (Array.isArray(t)) {
var c = t.length;
i = new Array(c);
a.value(t, "_iN$t", i, !0);
l.push(t);
for (var u = 0; u < c; ++u) {
var h = t[u];
i[u] = "object" == typeof h && h ? h._iN$t || f(h, e) : h;
}
return i;
}
if (t._objFlags & r) return null;
var d = t.constructor;
if (cc.Class._isCCClass(d)) {
if (e) if (e instanceof cc.Component) {
if (t instanceof cc._BaseNode || t instanceof cc.Component) return t;
} else if (e instanceof cc._BaseNode) if (t instanceof cc._BaseNode) {
if (!t.isChildOf(e)) return t;
} else if (t instanceof cc.Component && !t.node.isChildOf(e)) return t;
i = new d();
} else if (d === Object) i = {}; else {
if (d) return t;
i = Object.create(null);
}
_(t, i, e);
return i;
}
c._clone = u;
cc.instantiate = c;
e.exports = c;
}), {
"../value-types/value-type": 345,
"./CCObject": 245,
"./js": 260,
"./utils": 263
} ],
260: [ (function(t, e) {
"use strict";
var i = new (t("./id-generater"))("TmpCId.");
function n(t, e) {
for (;t; ) {
var i = Object.getOwnPropertyDescriptor(t, e);
if (i) return i;
t = Object.getPrototypeOf(t);
}
return null;
}
function r(t, e, i) {
var r = n(e, t);
Object.defineProperty(i, t, r);
}
var s = {
isNumber: function(t) {
return "number" == typeof t || t instanceof Number;
},
isString: function(t) {
return "string" == typeof t || t instanceof String;
},
addon: function(t) {
t = t || {};
for (var e = 1, i = arguments.length; e < i; e++) {
var n = arguments[e];
if (n) {
if ("object" != typeof n) {
cc.errorID(5402, n);
continue;
}
for (var s in n) s in t || r(s, n, t);
}
}
return t;
},
mixin: function(t) {
t = t || {};
for (var e = 1, i = arguments.length; e < i; e++) {
var n = arguments[e];
if (n) {
if ("object" != typeof n) {
cc.errorID(5403, n);
continue;
}
for (var s in n) r(s, n, t);
}
}
return t;
},
extend: function(t, e) {
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
t.prototype = Object.create(e.prototype, {
constructor: {
value: t,
writable: !0,
configurable: !0
}
});
return t;
},
getSuper: function(t) {
var e = t.prototype, i = e && Object.getPrototypeOf(e);
return i && i.constructor;
},
isChildClassOf: function(t, e) {
if (t && e) {
if ("function" != typeof t) return !1;
if ("function" != typeof e) return !1;
if (t === e) return !0;
for (;;) {
if (!(t = s.getSuper(t))) return !1;
if (t === e) return !0;
}
}
return !1;
},
clear: function(t) {
for (var e = Object.keys(t), i = 0; i < e.length; i++) delete t[e[i]];
},
isEmptyObject: function(t) {
for (var e in t) return !1;
return !0;
},
getPropertyDescriptor: n
}, o = {
value: void 0,
enumerable: !1,
writable: !1,
configurable: !0
};
s.value = function(t, e, i, n, r) {
o.value = i;
o.writable = n;
o.enumerable = r;
Object.defineProperty(t, e, o);
o.value = void 0;
};
var a = {
get: null,
set: null,
enumerable: !1
};
s.getset = function(t, e, i, n, r, s) {
if ("function" != typeof n) {
r = n;
n = void 0;
}
a.get = i;
a.set = n;
a.enumerable = r;
a.configurable = s;
Object.defineProperty(t, e, a);
a.get = null;
a.set = null;
};
var c = {
get: null,
enumerable: !1,
configurable: !1
};
s.get = function(t, e, i, n, r) {
c.get = i;
c.enumerable = n;
c.configurable = r;
Object.defineProperty(t, e, c);
c.get = null;
};
var l = {
set: null,
enumerable: !1,
configurable: !1
};
s.set = function(t, e, i, n, r) {
l.set = i;
l.enumerable = n;
l.configurable = r;
Object.defineProperty(t, e, l);
l.set = null;
};
s.getClassName = function(t) {
if ("function" == typeof t) {
var e = t.prototype;
if (e && e.hasOwnProperty("__classname__") && e.__classname__) return e.__classname__;
var i = "";
t.name && (i = t.name);
if (t.toString) {
var n, r = t.toString();
(n = "[" === r.charAt(0) ? r.match(/\[\w+\s*(\w+)\]/) : r.match(/function\s*(\w+)/)) && 2 === n.length && (i = n[1]);
}
return "Object" !== i ? i : "";
}
return t && t.constructor ? s.getClassName(t.constructor) : "";
};
(function() {
var t = {}, e = {};
function n(t, e, i) {
s.getset(s, e, (function() {
return Object.assign({}, i);
}), (function(t) {
s.clear(i);
Object.assign(i, t);
}));
return function(e, n) {
n.prototype.hasOwnProperty(t) && delete i[n.prototype[t]];
s.value(n.prototype, t, e);
if (e) {
var r = i[e];
if (r && r !== n) {
var o = "A Class already exists with the same " + t + ' : "' + e + '".';
cc.error(o);
} else i[e] = n;
}
};
}
s._setClassId = n("__cid__", "_registeredClassIds", t);
var r = n("__classname__", "_registeredClassNames", e);
s.setClassName = function(t, e) {
r(t, e);
if (!e.prototype.hasOwnProperty("__cid__")) {
var n = t || i.getNewId();
n && s._setClassId(n, e);
}
};
s.unregisterClass = function() {
for (var i = 0; i < arguments.length; i++) {
var n = arguments[i].prototype, r = n.__cid__;
r && delete t[r];
var s = n.__classname__;
s && delete e[s];
}
};
s._getClassById = function(e) {
return t[e];
};
s.getClassByName = function(t) {
return e[t];
};
s._getClassId = function(t, e) {
e = "undefined" == typeof e || e;
if ("function" == typeof t && t.prototype.hasOwnProperty("__cid__")) return t.prototype.__cid__;
if (t && t.constructor) {
var i = t.constructor.prototype;
if (i && i.hasOwnProperty("__cid__")) return t.__cid__;
}
return "";
};
})();
s.obsolete = function(t, e, i, n) {
var r = /([^.]+)$/, o = r.exec(e)[0], a = r.exec(i)[0];
function c() {
return this[a];
}
n ? s.getset(t, o, c, (function(t) {
this[a] = t;
})) : s.get(t, o, c);
};
s.obsoletes = function(t, e, i, n) {
for (var r in i) {
var o = i[r];
s.obsolete(t, e + "." + r, o, n);
}
};
var u = /(%d)|(%s)/, h = /%s/;
s.formatStr = function() {
var t = arguments.length;
if (0 === t) return "";
var e = arguments[0];
if (1 === t) return "" + e;
var i = "string" == typeof e && u.test(e);
if (i) for (var n = 1; n < t; ++n) {
var r = arguments[n], s = "number" == typeof r ? u : h;
if (s.test(e)) {
var o = "" + r;
e = e.replace(s, o);
} else e += " " + r;
} else for (var a = 1; a < t; ++a) e += " " + arguments[a];
return e;
};
s.shiftArguments = function() {
for (var t = arguments.length - 1, e = new Array(t), i = 0; i < t; ++i) e[i] = arguments[i + 1];
return e;
};
s.createMap = function(t) {
var e = Object.create(null);
if (t) {
e["."] = !0;
e["/"] = !0;
delete e["."];
delete e["/"];
}
return e;
};
function _(t, e) {
t.splice(e, 1);
}
function f(t, e) {
var i = t.indexOf(e);
if (i >= 0) {
_(t, i);
return !0;
}
return !1;
}
s.array = {
remove: f,
fastRemove: function(t, e) {
var i = t.indexOf(e);
if (i >= 0) {
t[i] = t[t.length - 1];
--t.length;
}
},
removeAt: _,
fastRemoveAt: function(t, e) {
var i = t.length;
if (!(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; i < t.length; i++) if (!(t[i] instanceof e)) {
cc.logID(1300);
return !1;
}
return !0;
},
removeArray: function(t, e) {
for (var i = 0, n = e.length; i < n; i++) f(t, e[i]);
},
appendObjectsAt: function(t, e, i) {
t.splice.apply(t, [ i, 0 ].concat(e));
return t;
},
copy: function(t) {
var e, i = t.length, n = new Array(i);
for (e = 0; e < i; e += 1) n[e] = t[e];
return n;
},
MutableForwardIterator: t("../utils/mutable-forward-iterator")
};
function d(t, e) {
if (void 0 === e) {
e = t;
t = null;
}
this.get = null;
this.count = 0;
this._pool = new Array(e);
this._cleanup = t;
}
d.prototype._get = function() {
if (this.count > 0) {
--this.count;
var t = this._pool[this.count];
this._pool[this.count] = null;
return t;
}
return null;
};
d.prototype.put = function(t) {
var e = this._pool;
if (this.count < e.length) {
if (this._cleanup && !1 === this._cleanup(t)) return;
e[this.count] = t;
++this.count;
}
};
d.prototype.resize = function(t) {
if (t >= 0) {
this._pool.length = t;
this.count > t && (this.count = t);
}
};
s.Pool = d;
cc.js = s;
e.exports = s;
}), {
"../utils/mutable-forward-iterator": 323,
"./id-generater": 256
} ],
261: [ (function(t, e, i) {
"use strict";
var n = t("./js"), r = t("./attribute"), s = {
default: {},
serializable: {},
editorOnly: {},
formerlySerializedAs: {}
};
function o(t, e, i, n) {
if (t.get || t.set) ; else 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 o = {};
n[r] = o;
for (var a in s) {
var c = s[a];
if (t.hasOwnProperty(a)) {
o[a] = t[a];
c.canUsedInGet || delete t[a];
}
}
}
}
function a(t, e, i, n) {
if (Array.isArray(e)) {
if (!(e.length > 0)) return cc.errorID(5508, i, n);
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 c(t, e, i) {
var n = t ? {
_short: !0
} : {
_short: !0,
default: e
};
i && (n.type = i);
return n;
}
i.getFullFormOfProperty = function(t, e) {
return t && t.constructor === Object ? null : Array.isArray(t) && t.length > 0 ? c(e, [], t) : "function" == typeof t ? c(e, n.isChildClassOf(t, cc.ValueType) ? new t() : null, t) : t instanceof r.PrimitiveType ? c(e, t.default) : c(e, t);
};
i.preprocessAttrs = function(t, e) {
for (var n in t) {
var r = t[n], s = i.getFullFormOfProperty(r, !1);
s && (r = t[n] = s);
if (r) {
var c = r.notify;
c && o(r, n, c, t);
"type" in r && a(r, r.type, e, n);
}
}
};
i.validateMethodWithProps = function(t) {
return "function" == typeof t || null === t;
};
}), {
"./CCClass": 239,
"./attribute": 251,
"./js": 260
} ],
262: [ (function() {
"use strict";
var t = [];
cc._RF = {
push: function(e, i, n) {
if (void 0 === n) {
n = i;
i = "";
}
t.push({
uuid: i,
script: n,
module: e,
exports: e.exports,
beh: null
});
},
pop: function() {
var e = t.pop(), i = e.module, n = i.exports;
if (n === e.exports) {
for (var r in n) return;
i.exports = n = e.cls;
}
},
peek: function() {
return t[t.length - 1];
}
};
}), {} ],
263: [ (function(t, e) {
"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": 260
} ],
264: [ (function(t) {
"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("./asset-manager");
t("./CCDirector");
t("./renderer");
t("./platform/CCView");
t("./platform/CCScreen");
t("./CCScheduler");
t("./event-manager");
}), {
"./CCDirector": 70,
"./CCScheduler": 75,
"./asset-manager": 93,
"./event": 188,
"./event-manager": 184,
"./platform/CCInputExtension": 242,
"./platform/CCInputManager": 243,
"./platform/CCMacro": 244,
"./platform/CCScreen": 247,
"./platform/CCSys": 248,
"./platform/CCView": 249,
"./platform/js": 260,
"./renderer": 271,
"./utils": 321,
"./value-types": 337
} ],
265: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = o(t("./assembler")), r = o(t("./utils/dynamic-atlas/manager")), s = o(t("./webgl/render-data"));
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
function a(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function c(t, e, i) {
e && a(t.prototype, e);
i && a(t, i);
return t;
}
function l(t) {
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t;
}
function u(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
h(t, e);
}
function h(t, e) {
return (h = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var _ = (function(t) {
u(e, t);
function e() {
var e;
(e = t.call(this) || this)._renderData = new s.default();
e._renderData.init(l(e));
e.initData();
e.initLocal();
return e;
}
var i = e.prototype;
i.initData = function() {
this._renderData.createQuadData(0, this.verticesFloats, this.indicesCount);
};
i.initLocal = function() {
this._local = [];
this._local.length = 4;
};
i.updateColor = function(t, e) {
var i = this._renderData.uintVDatas[0];
if (i) {
e = null != e ? e : t.node.color._val;
for (var n = this.floatsPerVert, r = this.colorOffset, s = i.length; r < s; r += n) i[r] = e;
}
};
i.getBuffer = function() {
return cc.renderer._handle._meshBuffer;
};
i.updateWorldVerts = function(t) {
var e = this._local, i = this._renderData.vDatas[0], n = t.node._worldMatrix.m, r = n[0], s = n[1], o = n[4], a = n[5], c = n[12], l = n[13], u = e[0], h = e[2], _ = e[1], f = e[3], d = this.floatsPerVert, p = 0;
if (1 === r && 0 === s && 0 === o && 1 === a) {
i[p] = u + c;
i[p + 1] = _ + l;
i[p += d] = h + c;
i[p + 1] = _ + l;
i[p += d] = u + c;
i[p + 1] = f + l;
i[p += d] = h + c;
i[p + 1] = f + l;
} else {
var m = r * u, y = r * h, v = s * u, g = s * h, b = o * _, C = o * f, x = a * _, A = a * f;
i[p] = m + b + c;
i[p + 1] = v + x + l;
i[p += d] = y + b + c;
i[p + 1] = g + x + l;
i[p += d] = m + C + c;
i[p + 1] = v + A + l;
i[p += d] = y + C + c;
i[p + 1] = g + A + l;
}
};
i.fillBuffers = function(t, e) {
e.worldMatDirty && this.updateWorldVerts(t);
var i = this._renderData, n = i.vDatas[0], r = i.iDatas[0], s = this.getBuffer(e), o = s.request(this.verticesCount, this.indicesCount), a = o.byteOffset >> 2, c = s._vData;
n.length + a > c.length ? c.set(n.subarray(0, c.length - a), a) : c.set(n, a);
for (var l = s._iData, u = o.indiceOffset, h = o.vertexOffset, _ = 0, f = r.length; _ < f; _++) l[u++] = h + r[_];
};
i.packToDynamicAtlas = function(t, e) {
if (!e._original && r.default && e._texture.packable && e._texture.loaded) {
var i = r.default.insertSpriteFrame(e);
i && e._setDynamicAtlasFrame(i);
}
var n = t._materials[0];
if (n && n.getProperty("texture") !== e._texture._texture) {
t._vertsDirty = !0;
t._updateMaterial();
}
};
c(e, [ {
key: "verticesFloats",
get: function() {
return this.verticesCount * this.floatsPerVert;
}
} ]);
return e;
})(n.default);
i.default = _;
cc.js.addon(_.prototype, {
floatsPerVert: 5,
verticesCount: 4,
indicesCount: 6,
uvOffset: 2,
colorOffset: 4
});
cc.Assembler2D = _;
e.exports = i.default;
}), {
"./assembler": 268,
"./utils/dynamic-atlas/manager": 274,
"./webgl/render-data": 310
} ],
266: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
for (var n, r = t("./webgl/vertex-format"), s = (n = t("../value-types/vec3")) && n.__esModule ? n : {
default: n
}, o = [], a = 0; a < 4; a++) o.push(cc.v3());
var c = {
floatsPerVert: 6,
uvOffset: 3,
colorOffset: 5,
getBuffer: function(t) {
return t._meshBuffer3D;
},
getVfmt: function() {
return r.vfmt3D;
},
updateWorldVerts: function(t) {
var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0];
s.default.set(o[0], i[0], i[1], 0);
s.default.set(o[1], i[2], i[1], 0);
s.default.set(o[2], i[0], i[3], 0);
s.default.set(o[3], i[2], i[3], 0);
for (var r = this.floatsPerVert, a = 0; a < 4; a++) {
var c = o[a];
s.default.transformMat4(c, c, e);
var l = r * a;
n[l] = c.x;
n[l + 1] = c.y;
n[l + 2] = c.z;
}
}
};
cc.Assembler3D = c;
var l = c;
i.default = l;
e.exports = i.default;
}), {
"../value-types/vec3": 347,
"./webgl/vertex-format": 311
} ],
267: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../utils/pool")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = 0;
function c(t) {
Object.getOwnPropertyDescriptor(t, "__assemblerId__") || (t.__assemblerId__ = ++a);
return t.__assemblerId__;
}
var l = new (function(t) {
s(e, t);
function e() {
for (var e, i = arguments.length, n = new Array(i), r = 0; r < i; r++) n[r] = arguments[r];
(e = t.call.apply(t, [ this ].concat(n)) || this)._pool = {};
return e;
}
var i = e.prototype;
i.put = function(t) {
if (t) if (this.enabled) {
var e = c(t.constructor), i = this._pool;
i[e] || (i[e] = []);
if (!(this.count > this.maxSize)) {
this._clean(t);
i[e].push(t);
this.count++;
}
} else t.destroy && t.destroy();
};
i.get = function(t) {
var e;
if (this.enabled) {
var i = this._pool, n = c(t);
e = i[n] && i[n].pop();
}
e ? this.count-- : e = new t();
return e;
};
i.clear = function() {
var t = this._pool;
for (var e in t) {
var i = t[e];
if (i) for (var n = 0; n < i.length; n++) i[n].destroy && i[n].destroy();
}
this._pool = {};
this.count = 0;
};
i._clean = function(t) {
t.reset();
t._renderComp = null;
};
return e;
}(r.default))();
r.default.register("assembler", l);
var u = l;
i.default = u;
e.exports = i.default;
}), {
"../utils/pool": 324
} ],
268: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = t("./webgl/vertex-format"), s = (n = t("./assembler-pool")) && n.__esModule ? n : {
default: n
}, o = (function() {
function t() {
this._extendNative && this._extendNative();
}
var e = t.prototype;
e.init = function(t) {
this._renderComp = t;
};
e.updateRenderData = function() {};
e.fillBuffers = function() {};
e.getVfmt = function() {
return r.vfmtPosUvColor;
};
return t;
})();
i.default = o;
o.register = function(t, e) {
t.__assembler__ = e;
};
o.init = function(t) {
for (var e = t.constructor, i = e.__assembler__; !i; ) {
if (!(e = e.$super)) {
cc.warn("Can not find assembler for render component : [" + cc.js.getClassName(t) + "]");
return;
}
i = e.__assembler__;
}
i.getConstructor && (i = i.getConstructor(t));
if (!t._assembler || t._assembler.constructor !== i) {
var n = s.default.get(i);
n.init(t);
t._assembler = n;
}
};
cc.Assembler = o;
e.exports = i.default;
}), {
"./assembler-pool": 267,
"./webgl/vertex-format": 311
} ],
269: [ (function(t, e) {
"use strict";
var i = function(t) {
var e;
try {
e = t.getContext("2d");
} catch (t) {
console.error(t);
return;
}
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;
};
i.prototype._restoreTexture = function() {};
i.prototype.setViewport = function(t, e, i, n) {
if (this._vx !== t || this._vy !== e || this._vw !== i || this._vh !== n) {
this._vx = t;
this._vy = e;
this._vw = i;
this._vh = n;
}
};
i.prototype.setScissor = function(t, e, i, n) {
if (this._sx !== t || this._sy !== e || this._sw !== i || this._sh !== n) {
this._sx = t;
this._sy = e;
this._sw = i;
this._sh = n;
}
};
i.prototype.clear = function(t) {
var e = this._ctx;
e.clearRect(this._vx, this._vy, this._vw, this._vh);
if (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);
}
};
i.prototype.resetDrawCalls = function() {
this._stats.drawcalls = 0;
};
i.prototype.getDrawCalls = function() {
return this._stats.drawcalls;
};
e.exports = i;
}), {} ],
270: [ (function(t, e) {
"use strict";
var i = function(t, e) {
this._device = t;
this._width = 4;
this._height = 4;
this._image = null;
if (e) {
void 0 !== e.width && (this._width = e.width);
void 0 !== e.height && (this._height = e.height);
this.updateImage(e);
}
};
i.prototype.update = function(t) {
this.updateImage(t);
};
i.prototype.updateImage = function(t) {
if (t.images && t.images[0]) {
var e = t.images[0];
e && e !== this._image && (this._image = e);
}
};
i.prototype.destroy = function() {
this._image = null;
};
e.exports = i;
}), {} ],
271: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = o(t("../../renderer/gfx")), r = o(t("../../renderer/core/input-assembler")), s = o(t("../../renderer/core/pass"));
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
var a = 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) {
t("./webgl/assemblers");
t("./webgl/model-batcher");
this.Texture2D = n.default.Texture2D;
this.canvas = e;
this._flow = cc.RenderFlow;
this.device = n.default.Device.getInstance();
this.scene = new renderer.Scene();
var i, r = (i = this.device, {
defaultTexture: new n.default.Texture2D(i, {
images: [],
width: 128,
height: 128,
wrapS: n.default.WRAP_REPEAT,
wrapT: n.default.WRAP_REPEAT,
format: n.default.TEXTURE_FMT_RGB8,
genMipmaps: !1
}),
programTemplates: [],
programChunks: {}
});
this._forward = new renderer.ForwardRenderer(this.device, r);
var s = new renderer.RenderFlow(this.device, this.scene, this._forward);
this._flow.init(s);
},
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();
if (t) {
this._flow.render(t, e);
this.drawCalls = this.device.getDrawCalls();
}
},
clear: function() {
this._handle.reset();
this._forward.clear();
}
};
i.default = a;
e.exports = i.default;
}), {
"../../renderer/core/input-assembler": 359,
"../../renderer/core/pass": 360,
"../../renderer/gfx": 363,
"../../renderer/renderers/forward-renderer": void 0,
"../../renderer/scene/scene": void 0,
"./canvas": void 0,
"./canvas/Device": 269,
"./canvas/Texture2D": 270,
"./webgl/assemblers": 283,
"./webgl/model-batcher": void 0
} ],
272: [ (function(t, e) {
"use strict";
var i, n, r = 0, s = 1 << r++, o = 1 << r++, a = 1 << r++, c = 1 << r++, l = a | c, u = 1 << r++, h = 1 << r++, _ = 1 << r++, f = h | _, d = 1 << r++, p = 1 << r++, m = 1 << r++, y = 1 << r++, v = 0;
function g() {
this._func = T;
this._next = null;
}
var b = g.prototype;
b._doNothing = function() {};
b._localTransform = function(t) {
t._updateLocalMatrix();
t._renderFlag &= ~a;
this._next._func(t);
};
b._worldTransform = function(t) {
i.worldMatDirty++;
var e = t._matrix, n = t._trs, r = e.m;
r[12] = n[0];
r[13] = n[1];
r[14] = n[2];
t._mulMat(t._worldMatrix, t._parent._worldMatrix, e);
t._renderFlag &= ~c;
this._next._func(t);
i.worldMatDirty--;
};
b._opacity = function(t) {
i.parentOpacityDirty++;
this._next._func(t);
t._renderFlag &= ~h;
i.parentOpacityDirty--;
};
b._color = function(t) {
var e = t._renderComponent;
e && e._updateColor();
t._renderFlag &= ~_;
this._next._func(t);
};
b._updateRenderData = function(t) {
var e = t._renderComponent;
e._assembler.updateRenderData(e);
t._renderFlag &= ~u;
this._next._func(t);
};
b._render = function(t) {
var e = t._renderComponent;
e._checkBacth(i, t._cullingMask);
e._assembler.fillBuffers(e, i);
this._next._func(t);
};
b._children = function(t) {
for (var e = v, n = i, r = n.parentOpacity, s = n.parentOpacity *= t._opacity / 255, o = (n.worldMatDirty ? c : 0) | (n.parentOpacityDirty ? f : 0), a = t._children, l = 0, u = a.length; l < u; l++) {
var h = a[l];
h._renderFlag |= o;
if (h._activeInHierarchy && 0 !== h._opacity) {
v = h._cullingMask = 0 === h.groupIndex ? e : 1 << h.groupIndex;
var _ = h._color._val;
h._color._fastSetA(h._opacity * s);
x[h._renderFlag]._func(h);
h._color._val = _;
}
}
n.parentOpacity = r;
this._next._func(t);
};
b._postRender = function(t) {
var e = t._renderComponent;
e._checkBacth(i, t._cullingMask);
e._assembler.postFillBuffers(e, i);
this._next._func(t);
};
var C = new g();
C._func = C._doNothing;
C._next = C;
var x = {};
function A(t, e) {
var i = new g();
i._next = e || C;
switch (t) {
case s:
case o:
i._func = i._doNothing;
break;

case a:
i._func = i._localTransform;
break;

case c:
i._func = i._worldTransform;
break;

case h:
i._func = i._opacity;
break;

case _:
i._func = i._color;
break;

case u:
i._func = i._updateRenderData;
break;

case d:
i._func = i._render;
break;

case p:
i._func = i._children;
break;

case m:
i._func = i._postRender;
}
return i;
}
function S(t) {
for (var e = null, i = y; i > 0; ) {
i & t && (e = A(i, e));
i >>= 1;
}
return e;
}
function T(t) {
var e = t._renderFlag;
(x[e] = S(e))._func(t);
}
g.flows = x;
g.createFlow = A;
var w = [];
g.registerValidate = function(t) {
if (!t._inValidateList) {
w.push(t);
t._inValidateList = !0;
}
};
g.validateRenderers = function() {
for (var t = 0, e = w.length; t < e; t++) {
var i = w[t];
if (i.isValid) {
i.enabledInHierarchy ? i._validateRender() : i.disableRender();
i._inValidateList = !1;
}
}
w.length = 0;
};
g.visitRootNode = function(t) {
g.validateRenderers();
var e = v;
v = t._cullingMask;
if (t._renderFlag & c) {
i.worldMatDirty++;
t._calculWorldMatrix();
t._renderFlag &= ~c;
x[t._renderFlag]._func(t);
i.worldMatDirty--;
} else x[t._renderFlag]._func(t);
v = e;
};
g.render = function(t, e) {
i.reset();
i.walking = !0;
g.visitRootNode(t);
i.terminate();
i.walking = !1;
n.render(i._renderScene, e);
};
g.renderCamera = function(t, e) {
i.reset();
i.walking = !0;
g.visitRootNode(e);
i.terminate();
i.walking = !1;
n.renderCamera(t, i._renderScene);
};
g.init = function(t, e) {
i = t;
n = e;
x[0] = C;
for (var r = 1; r < y; r++) x[r] = new g();
};
g.getBachther = function() {
return i;
};
g.FLAG_DONOTHING = s;
g.FLAG_BREAK_FLOW = o;
g.FLAG_LOCAL_TRANSFORM = a;
g.FLAG_WORLD_TRANSFORM = c;
g.FLAG_TRANSFORM = l;
g.FLAG_OPACITY = h;
g.FLAG_COLOR = _;
g.FLAG_OPACITY_COLOR = f;
g.FLAG_UPDATE_RENDER_DATA = u;
g.FLAG_RENDER = d;
g.FLAG_CHILDREN = p;
g.FLAG_POST_RENDER = m;
g.FLAG_FINAL = y;
e.exports = cc.RenderFlow = g;
}), {} ],
273: [ (function(t, e) {
"use strict";
var i = t("../../../assets/CCRenderTexture"), n = 2;
function r(t, e) {
var r = new i();
r.initWithSize(t, e);
r.update();
this._texture = r;
this._x = n;
this._y = n;
this._nexty = n;
this._width = t;
this._height = e;
this._innerTextureInfos = {};
this._innerSpriteFrames = [];
this._count = 0;
}
r.DEFAULT_HASH = new i()._getHash();
cc.js.mixin(r.prototype, {
insertSpriteFrame: function(t) {
var e = t._rect, i = t._texture, r = this._innerTextureInfos[i._id], s = e.x, o = e.y;
if (r) {
s += r.x;
o += r.y;
} else {
var a = i.width, c = i.height;
if (this._x + a + n > this._width) {
this._x = n;
this._y = this._nexty;
}
this._y + c + n > this._nexty && (this._nexty = this._y + c + n);
if (this._nexty > this._height) return null;
if (cc.dynamicAtlasManager.textureBleeding) {
if (a <= 8 || c <= 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;
o += this._y;
this._x += a + n;
this._dirty = !0;
}
var l = {
x: s,
y: o,
texture: this._texture
};
this._innerSpriteFrames.push(t);
return l;
},
update: function() {
if (this._dirty) {
this._texture.update();
this._dirty = !1;
}
},
deleteInnerTexture: function(t) {
if (t && this._innerTextureInfos[t._id]) {
delete this._innerTextureInfos[t._id];
this._count--;
}
},
isEmpty: function() {
return this._count <= 0;
},
reset: function() {
this._x = n;
this._y = n;
this._nexty = n;
for (var t = this._innerSpriteFrames, e = 0, i = t.length; e < i; e++) {
var r = t[e];
r.isValid && r._resetDynamicAtlasFrame();
}
this._innerSpriteFrames.length = 0;
this._innerTextureInfos = {};
},
destroy: function() {
this.reset();
this._texture.destroy();
}
});
e.exports = r;
}), {
"../../../assets/CCRenderTexture": 113
} ],
274: [ (function(t, e) {
"use strict";
var i = t("./atlas"), n = [], r = -1, s = 5, o = 2048, a = 512, c = !0, l = null;
function u() {
var t = n[++r];
if (!t) {
t = new i(o, o);
n.push(t);
}
return t;
}
function h() {
f.reset();
}
var _ = !1, f = {
Atlas: i,
get enabled() {
return _;
},
set enabled(t) {
if (_ !== t) {
if (t) {
this.reset();
cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, h);
} else cc.director.off(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, h);
_ = t;
}
},
get maxAtlasCount() {
return s;
},
set maxAtlasCount(t) {
s = t;
},
get atlasCount() {
return n.length;
},
get textureBleeding() {
return c;
},
set textureBleeding(t) {
c = t;
},
get textureSize() {
return o;
},
set textureSize(t) {
o = t;
},
get maxFrameSize() {
return a;
},
set maxFrameSize(t) {
a = t;
},
insertSpriteFrame: function(t) {
if (!_ || r === s || !t || t._original) return null;
if (!t._texture.packable) return null;
var e = n[r];
e || (e = u());
var i = e.insertSpriteFrame(t);
return i || r === s ? i : (e = u()).insertSpriteFrame(t);
},
reset: function() {
for (var t = 0, e = n.length; t < e; t++) n[t].destroy();
n.length = 0;
r = -1;
},
deleteAtlasSpriteFrame: function(t) {
if (t._original) {
var e = t._original._texture;
this.deleteAtlasTexture(e);
}
},
deleteAtlasTexture: function(t) {
if (t) for (var e = n.length - 1; e >= 0; e--) {
n[e].deleteInnerTexture(t);
if (n[e].isEmpty()) {
n[e].destroy();
n.splice(e, 1);
r--;
}
}
},
showDebug: function(t) {
if (t) {
if (!l || !l.isValid) {
var e = cc.visibleRect.width, i = cc.visibleRect.height;
(l = new cc.Node("DYNAMIC_ATLAS_DEBUG_NODE")).width = e;
l.height = i;
l.x = e / 2;
l.y = i / 2;
l.zIndex = cc.macro.MAX_ZINDEX;
l.parent = cc.director.getScene();
l.groupIndex = cc.Node.BuiltinGroupIndex.DEBUG;
cc.Camera._setupDebugCamera();
var s = l.addComponent(cc.ScrollView), a = new cc.Node("CONTENT"), c = a.addComponent(cc.Layout);
c.type = cc.Layout.Type.VERTICAL;
c.resizeMode = cc.Layout.ResizeMode.CONTAINER;
a.parent = l;
a.width = o;
a.anchorY = 1;
a.x = o;
s.content = a;
for (var u = 0; u <= r; u++) {
var h = new cc.Node("ATLAS"), _ = (n[u]._texture, new cc.SpriteFrame());
_.setTexture(n[u]._texture);
h.addComponent(cc.Sprite).spriteFrame = _;
h.parent = a;
}
}
return l;
}
if (l) {
l.parent = null;
l = null;
}
},
update: function() {
if (this.enabled) for (var t = 0; t <= r; t++) n[t].update();
}
};
e.exports = cc.dynamicAtlasManager = f;
}), {
"./atlas": 273
} ],
275: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../assembler-2d")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../utils/text-utils"), c = t("../../../platform/CCMacro"), l = t("../../../components/CCLabel").Overflow, u = t("../utils").shareLabelInfo, h = function() {
this.char = "";
this.valid = !0;
this.x = 0;
this.y = 0;
this.line = 0;
this.hash = "";
}, _ = cc.rect(), f = null, d = [], p = [], m = [], y = [], v = null, g = 0, b = 0, C = 0, x = 0, A = 0, S = 1, T = null, w = cc.size(), E = "", M = 0, B = 0, I = 0, D = 0, P = 0, R = 0, L = 0, O = !1, V = 0, N = 0, F = 0, z = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.updateRenderData = function(t) {
if (t._vertsDirty && f !== t) {
f = t;
this._reserveQuads(t, t.string.toString().length);
this._updateFontFamily(t);
this._updateProperties(t);
this._updateLabelInfo(t);
this._updateContent();
this.updateWorldVerts(t);
f._actualFontSize = M;
f.node.setContentSize(w);
f._vertsDirty = !1;
f = null;
this._resetProperties();
}
};
i._updateFontScale = function() {
S = M / B;
};
i._updateFontFamily = function(t) {
var e = t.font;
T = e.spriteFrame;
v = e._fntConfig;
u.fontAtlas = e._fontDefDictionary;
this.packToDynamicAtlas(t, T);
};
i._updateLabelInfo = function() {
u.hash = "";
u.margin = 0;
};
i._updateProperties = function(t) {
E = t.string.toString();
M = t.fontSize;
B = v ? v.fontSize : t.fontSize;
I = t.horizontalAlign;
D = t.verticalAlign;
P = t.spacingX;
L = t.overflow;
R = t._lineHeight;
w.width = t.node.width;
w.height = t.node.height;
if (L === l.NONE) {
O = !1;
w.width += 2 * u.margin;
w.height += 2 * u.margin;
} else if (L === l.RESIZE_HEIGHT) {
O = !0;
w.height += 2 * u.margin;
} else O = t.enableWrapText;
u.lineHeight = R;
u.fontSize = M;
this._setupBMFontOverflowMetrics();
};
i._resetProperties = function() {
v = null;
T = null;
u.hash = "";
u.margin = 0;
};
i._updateContent = function() {
this._updateFontScale();
this._computeHorizontalKerningForText();
this._alignText();
};
i._computeHorizontalKerningForText = function() {
var t, e = E, i = e.length, n = d;
v && (t = v.kerningDict);
if (t && !cc.js.isEmptyObject(t)) for (var r = -1, s = 0; s < i; ++s) {
var o = e.charCodeAt(s), a = t[r << 16 | 65535 & o] || 0;
n[s] = s < i - 1 ? a : 0;
r = o;
} else n.length = 0;
};
i._multilineTextWrap = function(t) {
for (var e = E.length, i = 0, n = 0, r = 0, s = 0, o = 0, c = 0, h = 0, _ = null, f = cc.v2(0, 0), p = 0; p < e; ) {
var y = E.charAt(p);
if ("\n" !== y) {
for (var C = t(E, p, e), T = c, M = h, B = o, I = n, D = !1, z = 0; z < C; ++z) {
var k = p + z;
if ("\r" !== (y = E.charAt(k))) if (_ = u.fontAtlas.getLetterDefinitionForChar(y, u)) {
var G = I + _.offsetX * S - u.margin;
if (O && F > 0 && n > 0 && G + _.w * S > F && !a.isUnicodeSpace(y)) {
m.push(o);
o = 0;
i++;
n = 0;
r -= R * this._getFontScale() + 0;
D = !0;
break;
}
f.x = G;
f.y = r - _.offsetY * S + u.margin;
this._recordLetterInfo(f, y, k, i);
k + 1 < d.length && k < e - 1 && (I += d[k + 1]);
I += _.xAdvance * S + P - 2 * u.margin;
B = f.x + _.w * S - u.margin;
T < f.y && (T = f.y);
M > f.y - _.h * S && (M = f.y - _.h * S);
} else {
this._recordPlaceholderInfo(k, y);
var U = "";
v && (U = v.atlasName);
console.log("Can't find letter definition in texture atlas " + U + " for letter:" + y);
} else this._recordPlaceholderInfo(k, y);
}
if (!D) {
n = I;
c < T && (c = T);
h > M && (h = M);
s < (o = B) && (s = o);
p += C;
}
} else {
m.push(o);
o = 0;
i++;
n = 0;
r -= R * this._getFontScale() + 0;
this._recordPlaceholderInfo(p, y);
p++;
}
}
m.push(o);
b = (g = i + 1) * R * this._getFontScale();
g > 1 && (b += 0 * (g - 1));
w.width = V;
w.height = N;
V <= 0 && (w.width = parseFloat(s.toFixed(2)) + 2 * u.margin);
N <= 0 && (w.height = parseFloat(b.toFixed(2)) + 2 * u.margin);
x = w.height;
A = 0;
if (L !== l.CLAMP) {
c > 0 && (x = w.height + c);
h < -b && (A = b + h);
}
return !0;
};
i._getFirstCharLen = function() {
return 1;
};
i._getFontScale = function() {
return L === l.SHRINK ? S : 1;
};
i._getFirstWordLen = function(t, e, i) {
var n = t.charAt(e);
if (a.isUnicodeCJK(n) || "\n" === n || a.isUnicodeSpace(n)) return 1;
var r = 1, s = u.fontAtlas.getLetterDefinitionForChar(n, u);
if (!s) return r;
for (var o = s.xAdvance * S + P, c = e + 1; c < i; ++c) {
n = t.charAt(c);
if (!(s = u.fontAtlas.getLetterDefinitionForChar(n, u))) break;
if (o + s.offsetX * S + s.w * S > F && !a.isUnicodeSpace(n) && F > 0) return r;
o += s.xAdvance * S + P;
if ("\n" === n || a.isUnicodeSpace(n) || a.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 >= p.length) {
var i = new h();
p.push(i);
}
p[t].char = e;
p[t].hash = e.charCodeAt(0) + u.hash;
p[t].valid = !1;
};
i._recordLetterInfo = function(t, e, i, n) {
if (i >= p.length) {
var r = new h();
p.push(r);
}
var s = e.charCodeAt(0) + u.hash;
p[i].line = n;
p[i].char = e;
p[i].hash = s;
p[i].valid = u.fontAtlas.getLetter(s).valid;
p[i].x = t.x;
p[i].y = t.y;
};
i._alignText = function() {
b = 0;
m.length = 0;
this._multilineTextWrapByWord();
this._computeAlignmentOffset();
L === l.SHRINK && M > 0 && this._isVerticalClamp() && this._shrinkLabelToContentSize(this._isVerticalClamp);
this._updateQuads() || L === l.SHRINK && this._shrinkLabelToContentSize(this._isHorizontalClamp);
};
i._scaleFontSizeDown = function(t) {
var e = !0;
if (!t) {
t = .1;
e = !1;
}
M = t;
e && this._updateContent();
};
i._shrinkLabelToContentSize = function(t) {
for (var e = 0, i = 0 | M, n = 0; e < i; ) {
var r = n = e + i + 1 >> 1;
if (r <= 0) break;
S = r / B;
this._multilineTextWrapByWord();
this._computeAlignmentOffset();
t() ? i = n - 1 : e = n;
}
var s = e;
s >= 0 && this._scaleFontSizeDown(s);
};
i._isVerticalClamp = function() {
return b > w.height;
};
i._isHorizontalClamp = function() {
for (var t = !1, e = 0, i = E.length; e < i; ++e) {
var n = p[e];
if (n.valid) {
var r = u.fontAtlas.getLetter(n.hash), s = n.x + r.w * S, o = n.line;
if (V > 0) if (O) {
if (m[o] > w.width && (s > w.width || s < 0)) {
t = !0;
break;
}
} else if (s > w.width) {
t = !0;
break;
}
}
}
return t;
};
i._isHorizontalClamped = function(t, e) {
var i = m[e], n = t > w.width || t < 0;
return O ? i > w.width && n : n;
};
i._updateQuads = function() {
var t = T ? T._texture : u.fontAtlas.getTexture(), e = f.node;
this.verticesCount = this.indicesCount = 0;
this._renderData && (this._renderData.dataLength = 0);
for (var i = w, n = e._anchorPoint.x * i.width, r = e._anchorPoint.y * i.height, s = !0, o = 0, a = E.length; o < a; ++o) {
var c = p[o];
if (c.valid) {
var h = u.fontAtlas.getLetter(c.hash);
_.height = h.h;
_.width = h.w;
_.x = h.u;
_.y = h.v;
var d = c.y + C;
if (N > 0) {
if (d > x) {
var m = d - x;
_.y += m;
_.height -= m;
d -= m;
}
d - h.h * S < A && L === l.CLAMP && (_.height = d < A ? 0 : (d - A) / S);
}
var v = c.line, g = c.x + h.w / 2 * S + y[v];
if (V > 0 && this._isHorizontalClamped(g, v)) if (L === l.CLAMP) _.width = 0; else if (L === l.SHRINK) {
if (w.width > h.w) {
s = !1;
break;
}
_.width = 0;
}
if (_.height > 0 && _.width > 0) {
var b = this._determineRect(_), M = c.x + y[c.line];
this.appendQuad(f, t, _, b, M - n, d - r, S);
}
}
}
this._quadsUpdated(f);
return s;
};
i._determineRect = function(t) {
var e = T.isRotated(), i = T._originalSize, n = T._rect, r = T._offset, s = r.x + (i.width - n.width) / 2, o = r.y - (i.height - n.height) / 2;
if (e) {
var a = t.x;
t.x = n.x + n.height - t.y - t.height - o;
t.y = a + n.y - s;
t.y < 0 && (t.height = t.height + o);
} else {
t.x += n.x - s;
t.y += n.y + o;
}
return e;
};
i._computeAlignmentOffset = function() {
y.length = 0;
switch (I) {
case c.TextAlignment.LEFT:
for (var t = 0; t < g; ++t) y.push(0);
break;

case c.TextAlignment.CENTER:
for (var e = 0, i = m.length; e < i; e++) y.push((w.width - m[e]) / 2);
break;

case c.TextAlignment.RIGHT:
for (var n = 0, r = m.length; n < r; n++) y.push(w.width - m[n]);
}
C = w.height;
if (D !== c.VerticalTextAlignment.TOP) {
var s = w.height - b + R * this._getFontScale() - B * S;
D === c.VerticalTextAlignment.BOTTOM ? C -= s : C -= s / 2;
}
};
i._setupBMFontOverflowMetrics = function() {
var t = w.width, e = w.height;
L === l.RESIZE_HEIGHT && (e = 0);
if (L === l.NONE) {
t = 0;
e = 0;
}
V = t;
N = e;
F = t;
};
i.updateWorldVerts = function() {};
i.appendQuad = function() {};
i._quadsUpdated = function() {};
i._reserveQuads = function() {};
return e;
})(r.default);
i.default = z;
e.exports = i.default;
}), {
"../../../components/CCLabel": 151,
"../../../platform/CCMacro": 244,
"../../../utils/text-utils": 329,
"../../assembler-2d": 265,
"../utils": 279
} ],
276: [ (function(t, e) {
"use strict";
function i() {
this._rect = null;
this.uv = [];
this._texture = null;
this._original = null;
}
i.prototype = {
constructor: i,
getRect: function() {
return cc.rect(this._rect);
},
setRect: function(t) {
this._rect = t;
this._texture && this._calculateUV();
},
_setDynamicAtlasFrame: function(t) {
if (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() {
if (this._original) {
this._rect.x = this._original._x;
this._rect.y = this._original._y;
this._texture = this._original._texture;
this._original = null;
this._calculateUV();
}
},
_refreshTexture: function(t) {
this._texture = t;
this._rect = cc.rect(0, 0, t.width, t.height);
this._calculateUV();
},
_calculateUV: function() {
var t = this._rect, e = this._texture, i = this.uv, n = e.width, r = e.height, s = 0 === n ? 0 : t.x / n, o = 0 === n ? 0 : (t.x + t.width) / n, a = 0 === r ? 0 : (t.y + t.height) / r, c = 0 === r ? 0 : t.y / r;
i[0] = s;
i[1] = a;
i[2] = o;
i[3] = a;
i[4] = s;
i[5] = c;
i[6] = o;
i[7] = c;
}
};
e.exports = i;
}), {} ],
277: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../webgl/assemblers/label/2d/bmfont")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../components/CCLabel"), c = t("../../../components/CCLabelOutline"), l = t("../../../utils/text-utils"), u = t("../../../components/CCComponent"), h = t("../../../assets/CCRenderTexture"), _ = cc.js.isChildClassOf(c, u), f = t("../utils").getFontFamily, d = t("../utils").shareLabelInfo, p = cc.BitmapFont.FontLetterDefinition, m = cc.BitmapFont.FontAtlas, y = cc.Color.WHITE, v = 0, g = (1 / 255).toFixed(3);
function b(t, e) {
this._texture = null;
this._labelInfo = e;
this._char = t;
this._hash = null;
this._data = null;
this._canvas = null;
this._context = null;
this._width = 0;
this._height = 0;
this._offsetY = 0;
this._hash = t.charCodeAt(0) + e.hash;
}
b.prototype = {
constructor: b,
updateRenderData: function() {
this._updateProperties();
this._updateTexture();
},
_updateProperties: function() {
this._texture = new cc.Texture2D();
this._data = a._canvasPool.get();
this._canvas = this._data.canvas;
this._context = this._data.context;
this._context.font = this._labelInfo.fontDesc;
var t = l.safeMeasureText(this._context, this._char, this._labelInfo.fontDesc), e = 2 * this._labelInfo.margin + 2;
this._width = parseFloat(t.toFixed(2)) + e;
this._height = (1 + l.BASELINE_RATIO) * this._labelInfo.fontSize + e;
this._offsetY = -this._labelInfo.fontSize * l.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 = this._labelInfo.fontSize, s = i / 2, o = n / 2 + r * l.MIDDLE_RATIO + r * l.BASELINE_OFFSET, a = e.color;
t.lineJoin = "round";
t.textAlign = "center";
t.clearRect(0, 0, i, n);
t.fillStyle = "rgba(" + a.r + ", " + a.g + ", " + a.b + ", " + g + ")";
t.fillRect(0, 0, i, n);
t.font = e.fontDesc;
t.fillStyle = "rgba(" + a.r + ", " + a.g + ", " + a.b + ", 1)";
if (e.isOutlined && e.margin > 0) {
var c = e.out || y;
t.strokeStyle = "rgba(" + c.r + ", " + c.g + ", " + c.b + ", " + c.a / 255 + ")";
t.lineWidth = 2 * e.margin;
t.strokeText(this._char, s, o);
}
t.fillText(this._char, s, o);
this._texture.handleLoadedTexture();
},
destroy: function() {
this._texture.destroy();
this._texture = null;
a._canvasPool.put(this._data);
}
};
function C(t, e) {
var i = new h();
i.initWithSize(t, e);
i.update();
this._fontDefDictionary = new m(i);
this._x = v;
this._y = v;
this._nexty = v;
this._width = t;
this._height = e;
cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, this.beforeSceneLoad, this);
}
cc.js.mixin(C.prototype, {
insertLetterTexture: function(t) {
var e = t._texture, i = e.width, n = e.height;
if (this._x + i + v > this._width) {
this._x = v;
this._y = this._nexty;
}
this._y + n > this._nexty && (this._nexty = this._y + n + v);
if (this._nexty > this._height) return null;
this._fontDefDictionary._texture.drawTextureAt(e, this._x, this._y);
this._dirty = !0;
var r = new p();
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 + v;
this._fontDefDictionary.addLetterDefinitions(t._hash, r);
return r;
},
update: function() {
if (this._dirty) {
this._fontDefDictionary._texture.update();
this._dirty = !1;
}
},
reset: function() {
this._x = v;
this._y = v;
this._nexty = v;
for (var t = this._fontDefDictionary._letterDefinitions, e = 0, i = t.length; e < i; e++) {
var n = t[e];
n.isValid && n.destroy();
}
this._fontDefDictionary.clear();
},
destroy: function() {
this.reset();
this._fontDefDictionary._texture.destroy();
this._fontDefDictionary._texture = null;
},
beforeSceneLoad: function() {
this.clearAllCache();
},
clearAllCache: function() {
this.destroy();
var t = new h();
t.initWithSize(this._width, this._height);
t.update();
this._fontDefDictionary._texture = t;
},
getLetter: function(t) {
return this._fontDefDictionary._letterDefinitions[t];
},
getTexture: function() {
return this._fontDefDictionary.getTexture();
},
getLetterDefinitionForChar: function(t, e) {
var i = t.charCodeAt(0) + e.hash, n = this._fontDefDictionary._letterDefinitions[i];
if (!n) {
var r = new b(t, e);
r.updateRenderData();
n = this.insertLetterTexture(r);
r.destroy();
}
return n;
}
});
function x(t) {
var e = t.color.toHEX(), i = "";
t.isOutlined && t.margin > 0 && (i = i + t.margin + t.out.toHEX());
return "" + t.fontSize + t.fontFamily + e + i;
}
var A = null, S = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i._getAssemblerData = function() {
if (!A) {
A = new C(2048, 2048);
cc.Label._shareAtlas = A;
}
return A.getTexture();
};
i._updateFontFamily = function(t) {
d.fontAtlas = A;
d.fontFamily = f(t);
var e = _ && t.getComponent(c);
if (e && e.enabled) {
d.isOutlined = !0;
d.margin = e.width;
d.out = e.color.clone();
d.out.a = e.color.a * t.node.color.a / 255;
} else {
d.isOutlined = !1;
d.margin = 0;
}
};
i._updateLabelInfo = function(t) {
d.fontDesc = this._getFontDesc();
d.color = t.node.color;
d.hash = x(d);
};
i._getFontDesc = function() {
return d.fontSize.toString() + "px " + d.fontFamily;
};
i._computeHorizontalKerningForText = function() {};
i._determineRect = function() {
return !1;
};
return e;
})(r.default);
i.default = S;
e.exports = i.default;
}), {
"../../../assets/CCRenderTexture": 113,
"../../../components/CCComponent": 149,
"../../../components/CCLabel": 151,
"../../../components/CCLabelOutline": 152,
"../../../utils/text-utils": 329,
"../../webgl/assemblers/label/2d/bmfont": 284,
"../utils": 279
} ],
278: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../assembler-2d")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a, c = t("../../../utils/text-utils"), l = t("../../../platform/CCMacro"), u = t("../../../components/CCLabel"), h = t("../../../components/CCLabelOutline"), _ = t("../../../components/CCLabelShadow"), f = u.Overflow, d = t("../utils").deleteFromDynamicAtlas, p = t("../utils").getFontFamily, m = (1 / 255).toFixed(3), y = null, v = null, g = null, b = "", C = "", x = 0, A = 0, S = [], T = cc.Size.ZERO, w = 0, E = 0, M = 0, B = null, I = "", D = f.NONE, P = !1, R = !1, L = null, O = cc.Color.WHITE, V = null, N = cc.Color.BLACK, F = cc.rect(), z = cc.Size.ZERO, k = cc.Size.ZERO, G = !1, U = !1, H = !1, j = 0, W = cc.Vec2.ZERO, q = 0, X = [ "left", "center", "right" ], Y = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i._getAssemblerData = function() {
(a = u._canvasPool.get()).canvas.width = a.canvas.height = 1;
return a;
};
i._resetAssemblerData = function(t) {
t && u._canvasPool.put(t);
};
i.updateRenderData = function(e) {
t.prototype.updateRenderData.call(this, e);
if (e._vertsDirty) {
this._updateProperties(e);
this._calculateLabelFont();
this._updateLabelDimensions();
this._updateTexture(e);
this._calDynamicAtlas(e);
e._actualFontSize = x;
e.node.setContentSize(k);
this.updateVerts(e);
e._vertsDirty = !1;
y = null;
v = null;
g = null;
}
};
i.updateVerts = function() {};
i._updatePaddingRect = function() {
var t = 0, e = 0, i = 0, n = 0, r = 0;
z.width = z.height = 0;
if (L) {
t = e = i = n = r = L.width;
z.width = z.height = 2 * r;
}
if (V) {
var s = V.blur + r;
i = Math.max(i, -V._offset.x + s);
n = Math.max(n, V._offset.x + s);
t = Math.max(t, V._offset.y + s);
e = Math.max(e, -V._offset.y + s);
}
if (U) {
var o = A * Math.tan(.20943951);
n += o;
z.width += o;
}
F.x = i;
F.y = t;
F.width = i + n;
F.height = t + e;
};
i._updateProperties = function(t) {
var e = t._assemblerData;
y = e.context;
v = e.canvas;
g = t._frame._original ? t._frame._original._texture : t._frame._texture;
C = t.string.toString();
x = t._fontSize;
A = x;
j = t.underlineHeight || A / 8;
D = t.overflow;
T.width = t.node.width;
T.height = t.node.height;
k = t.node.getContentSize();
w = t._lineHeight;
E = t.horizontalAlign;
M = t.verticalAlign;
B = t.node.color;
G = t.enableBold;
U = t.enableItalic;
H = t.enableUnderline;
I = p(t);
R = t.srcBlendFactor === cc.macro.BlendFactor.ONE;
y._setPremultiply(R);
P = D !== f.NONE && (D === f.RESIZE_HEIGHT || t.enableWrapText);
(L = (L = h && t.getComponent(h)) && L.enabled && L.width > 0 ? L : null) && O.set(L.color);
if (V = (V = _ && t.getComponent(_)) && V.enabled ? V : null) {
N.set(V.color);
N.a = N.a * t.node.color.a / 255;
}
this._updatePaddingRect();
};
i._calculateFillTextStartPosition = function() {
var t = 0;
E === l.TextAlignment.RIGHT ? t = T.width - F.width : E === l.TextAlignment.CENTER && (t = (T.width - F.width) / 2);
var e = this._getLineHeight() * (S.length - 1), i = x * (1 - c.BASELINE_RATIO / 2);
if (M !== l.VerticalTextAlignment.TOP) {
var n = e + F.height + x - T.height;
M === l.VerticalTextAlignment.BOTTOM ? i -= n += c.BASELINE_RATIO / 2 * x : i -= n / 2;
}
i += c.BASELINE_OFFSET * x;
return cc.v2(t + F.x, i + F.y);
};
i._setupOutline = function() {
y.strokeStyle = "rgba(" + O.r + ", " + O.g + ", " + O.b + ", " + O.a / 255 + ")";
y.lineWidth = 2 * L.width;
};
i._setupShadow = function() {
y.shadowColor = "rgba(" + N.r + ", " + N.g + ", " + N.b + ", " + N.a / 255 + ")";
y.shadowBlur = V.blur;
y.shadowOffsetX = V.offset.x;
y.shadowOffsetY = -V.offset.y;
};
i._drawTextEffect = function(t, e) {
if (V || L || H) {
var i = S.length > 1 && V, n = this._measureText(y, b), r = 0, s = 0;
V && this._setupShadow();
L && this._setupOutline();
for (var o = 0; o < S.length; ++o) {
r = t.x;
s = t.y + o * e;
if (i) {
L && y.strokeText(S[o], r, s);
y.fillText(S[o], r, s);
}
if (H) {
q = n(S[o]);
E === l.TextAlignment.RIGHT ? W.x = t.x - q : E === l.TextAlignment.CENTER ? W.x = t.x - q / 2 : W.x = t.x;
W.y = s + A / 8;
y.fillRect(W.x, W.y, q, j);
}
}
i && (y.shadowColor = "transparent");
}
};
i._updateTexture = function() {
y.clearRect(0, 0, v.width, v.height);
y.lineJoin = "round";
if (R) y.fillStyle = "rgba(" + B.r + ", " + B.g + ", " + B.b + ", " + B.a / 255 + ")"; else {
var t = L ? O : B;
y.fillStyle = "rgba(" + t.r + ", " + t.g + ", " + t.b + ", " + m + ")";
y.fillRect(0, 0, v.width, v.height);
y.fillStyle = "rgba(" + B.r + ", " + B.g + ", " + B.b + ", 1)";
}
var e = this._calculateFillTextStartPosition(), i = this._getLineHeight(), n = e.x, r = 0;
this._drawTextEffect(e, i);
for (var s = 0; s < S.length; ++s) {
r = e.y + s * i;
L && y.strokeText(S[s], n, r);
y.fillText(S[s], n, r);
}
V && (y.shadowColor = "transparent");
g.handleLoadedTexture();
};
i._calDynamicAtlas = function(t) {
if (t.cacheMode === u.CacheMode.BITMAP) {
var e = t._frame;
d(t, e);
e._original || e.setRect(cc.rect(0, 0, v.width, v.height));
this.packToDynamicAtlas(t, e);
}
};
i._updateLabelDimensions = function() {
var t = cc.renderer.device.caps ? cc.renderer.device.caps.maxTextureSize : 2048;
(T.width > t || T.height > t) && cc.warn("The maximum texture size supported by the device is " + t);
T.width = Math.min(T.width, t);
T.height = Math.min(T.height, t);
var e = !1;
if (v.width !== T.width) {
v.width = T.width;
e = !0;
}
if (v.height !== T.height) {
v.height = T.height;
e = !0;
}
e && (y.font = b);
y.textAlign = X[E];
};
i._getFontDesc = function() {
var t = x.toString() + "px ";
t += I;
G && (t = "bold " + t);
U && (t = "italic " + t);
return t;
};
i._getLineHeight = function() {
return 0 | (0 === w ? x : w * x / A);
};
i._calculateParagraphLength = function(t, e) {
for (var i = [], n = 0; n < t.length; ++n) {
var r = c.safeMeasureText(e, t[n], b);
i.push(r);
}
return i;
};
i._measureText = function(t, e) {
return function(i) {
return c.safeMeasureText(t, i, e);
};
};
i._calculateShrinkFont = function(t) {
var e = this._calculateParagraphLength(t, y), i = 0, n = 0, r = 0;
if (P) {
var s = k.width, o = k.height;
if (s < 0 || o < 0) return;
n = o + 1;
for (var a = 0, l = 0 | x + 1, u = 0; a < l; ) {
if ((u = a + l + 1 >> 1) <= 0) {
cc.logID(4003);
break;
}
x = u;
b = this._getFontDesc();
y.font = b;
var h = this._getLineHeight();
n = 0;
for (i = 0; i < t.length; ++i) {
var _ = c.safeMeasureText(y, t[i], b);
n += c.fragmentText(t[i], _, s, this._measureText(y, b)).length * h;
}
n > o ? l = u - 1 : a = u;
}
if (0 === a) cc.logID(4003); else {
x = a;
b = this._getFontDesc();
y.font = b;
}
} else {
n = t.length * this._getLineHeight();
for (i = 0; i < t.length; ++i) r < e[i] && (r = e[i]);
var f = (T.width - F.width) / r, d = T.height / n;
x = A * Math.min(1, f, d) | 0;
b = this._getFontDesc();
y.font = b;
}
};
i._calculateWrapText = function(t) {
if (P) {
S = [];
for (var e = k.width, i = 0; i < t.length; ++i) {
var n = c.safeMeasureText(y, t[i], b), r = c.fragmentText(t[i], n, e, this._measureText(y, b));
S = S.concat(r);
}
}
};
i._calculateLabelFont = function() {
var t = C.split("\n");
S = t;
b = this._getFontDesc();
y.font = b;
switch (D) {
case f.NONE:
for (var e = 0, i = 0, n = 0; n < t.length; ++n) {
var r = c.safeMeasureText(y, t[n], b);
e = e > r ? e : r;
}
i = (S.length + c.BASELINE_RATIO) * this._getLineHeight();
var s = parseFloat(e.toFixed(2)), o = parseFloat(i.toFixed(2));
T.width = s + F.width;
T.height = o + F.height;
k.width = s + z.width;
k.height = o + z.height;
break;

case f.SHRINK:
this._calculateShrinkFont(t);
this._calculateWrapText(t);
break;

case f.CLAMP:
this._calculateWrapText(t);
break;

case f.RESIZE_HEIGHT:
this._calculateWrapText(t);
var a = (S.length + c.BASELINE_RATIO) * this._getLineHeight();
T.height = a + F.height;
k.height = a + z.height;
}
};
return e;
})(r.default);
i.default = Y;
e.exports = i.default;
}), {
"../../../components/CCLabel": 151,
"../../../components/CCLabelOutline": 152,
"../../../components/CCLabelShadow": 153,
"../../../platform/CCMacro": 244,
"../../../utils/text-utils": 329,
"../../assembler-2d": 265,
"../utils": 279
} ],
279: [ (function(t, e) {
"use strict";
var i = t("./dynamic-atlas/manager"), n = cc.Color.WHITE, r = {
fontAtlas: null,
fontSize: 0,
lineHeight: 0,
hAlign: 0,
vAlign: 0,
hash: "",
fontFamily: "",
fontDesc: "Arial",
color: n,
isOutlined: !1,
out: n,
margin: 0
};
e.exports = {
deleteFromDynamicAtlas: function(t, e) {
if (e && e._original && i) {
i.deleteAtlasSpriteFrame(e);
e._resetDynamicAtlasFrame();
}
},
getFontFamily: function(t) {
if (t.useSystemFont) return t.fontFamily || "Arial";
if (t.font) {
if (t.font._nativeAsset) return t.font._nativeAsset;
cc.assetManager.postLoadNative(t.font, (function() {
t.isValid && t.setVertsDirty();
}));
return "Arial";
}
return "Arial";
},
shareLabelInfo: r
};
}), {
"./dynamic-atlas/manager": 274
} ],
280: [ (function(t, e) {
"use strict";
cc.Graphics.earcut = e.exports = i;
function i(t, e, i) {
i = i || 2;
var r, o, a, c, l, h, _, f = e && e.length, d = f ? e[0] * i : t.length, p = n(t, 0, d, i, !0), m = [];
if (!p) return m;
f && (p = u(t, e, p, i));
if (t.length > 80 * i) {
r = a = t[0];
o = c = t[1];
for (var y = i; y < d; y += i) {
(l = t[y]) < r && (r = l);
(h = t[y + 1]) < o && (o = h);
l > a && (a = l);
h > c && (c = h);
}
_ = Math.max(a - r, c - o);
}
s(p, m, i, r, o, _);
return m;
}
function n(t, e, i, n, r) {
var s, o;
if (r === I(t, e, i, n) > 0) for (s = e; s < i; s += n) o = E(s, t[s], t[s + 1], o); else for (s = i - n; s >= e; s -= n) o = E(s, t[s], t[s + 1], o);
if (o && C(o, o.next)) {
M(o);
o = o.next;
}
return o;
}
function r(t, e) {
if (!t) return t;
e || (e = t);
var i, n = t;
do {
i = !1;
if (n.steiner || !C(n, n.next) && 0 !== b(n.prev, n, n.next)) n = n.next; else {
M(n);
if ((n = e = n.prev) === n.next) return null;
i = !0;
}
} while (i || n !== e);
return e;
}
function s(t, e, i, n, u, h, _) {
if (t) {
!_ && h && d(t, n, u, h);
for (var f, p, m = t; t.prev !== t.next; ) {
f = t.prev;
p = t.next;
if (h ? a(t, n, u, h) : o(t)) {
e.push(f.i / i);
e.push(t.i / i);
e.push(p.i / i);
M(t);
t = p.next;
m = p.next;
} else if ((t = p) === m) {
_ ? 1 === _ ? s(t = c(t, e, i), e, i, n, u, h, 2) : 2 === _ && l(t, e, i, n, u, h) : s(r(t), e, i, n, u, h, 1);
break;
}
}
}
}
function o(t) {
var e = t.prev, i = t, n = t.next;
if (b(e, i, n) >= 0) return !1;
for (var r = t.next.next; r !== t.prev; ) {
if (v(e.x, e.y, i.x, i.y, n.x, n.y, r.x, r.y) && b(r.prev, r, r.next) >= 0) return !1;
r = r.next;
}
return !0;
}
function a(t, e, i, n) {
var r = t.prev, s = t, o = t.next;
if (b(r, s, o) >= 0) return !1;
for (var a = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, c = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, l = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, u = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, h = m(a, c, e, i, n), _ = m(l, u, e, i, n), f = t.nextZ; f && f.z <= _; ) {
if (f !== t.prev && f !== t.next && v(r.x, r.y, s.x, s.y, o.x, o.y, f.x, f.y) && b(f.prev, f, f.next) >= 0) return !1;
f = f.nextZ;
}
f = t.prevZ;
for (;f && f.z >= h; ) {
if (f !== t.prev && f !== t.next && v(r.x, r.y, s.x, s.y, o.x, o.y, f.x, f.y) && b(f.prev, f, f.next) >= 0) return !1;
f = f.prevZ;
}
return !0;
}
function c(t, e, i) {
var n = t;
do {
var r = n.prev, s = n.next.next;
if (!C(r, s) && x(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);
M(n);
M(n.next);
n = t = s;
}
n = n.next;
} while (n !== t);
return n;
}
function l(t, e, i, n, o, a) {
var c = t;
do {
for (var l = c.next.next; l !== c.prev; ) {
if (c.i !== l.i && g(c, l)) {
var u = w(c, l);
c = r(c, c.next);
u = r(u, u.next);
s(c, e, i, n, o, a);
s(u, e, i, n, o, a);
return;
}
l = l.next;
}
c = c.next;
} while (c !== t);
}
function u(t, e, i, s) {
var o, a, c, l = [];
for (o = 0, a = e.length; o < a; o++) {
(c = n(t, e[o] * s, o < a - 1 ? e[o + 1] * s : t.length, s, !1)) === c.next && (c.steiner = !0);
l.push(y(c));
}
l.sort(h);
for (o = 0; o < l.length; o++) {
_(l[o], i);
i = r(i, i.next);
}
return i;
}
function h(t, e) {
return t.x - e.x;
}
function _(t, e) {
if (e = f(t, e)) {
var i = w(e, t);
r(i, i.next);
}
}
function f(t, e) {
var i, n = e, r = t.x, s = t.y, o = -Infinity;
do {
if (s <= n.y && s >= n.next.y) {
var a = n.x + (s - n.y) * (n.next.x - n.x) / (n.next.y - n.y);
if (a <= r && a > o) {
o = a;
if (a === r) {
if (s === n.y) return n;
if (s === n.next.y) return n.next;
}
i = n.x < n.next.x ? n : n.next;
}
}
n = n.next;
} while (n !== e);
if (!i) return null;
if (r === o) return i.prev;
var c, l = i, u = i.x, h = i.y, _ = Infinity;
n = i.next;
for (;n !== l; ) {
if (r >= n.x && n.x >= u && v(s < h ? r : o, s, u, h, s < h ? o : r, s, n.x, n.y) && ((c = Math.abs(s - n.y) / (r - n.x)) < _ || c === _ && n.x > i.x) && S(n, t)) {
i = n;
_ = c;
}
n = n.next;
}
return i;
}
function d(t, e, i, n) {
var r = t;
do {
null === r.z && (r.z = m(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;
p(r);
}
function p(t) {
var e, i, n, r, s, o, a, c, l = 1;
do {
i = t;
t = null;
s = null;
o = 0;
for (;i; ) {
o++;
n = i;
a = 0;
for (e = 0; e < l; e++) {
a++;
if (!(n = n.nextZ)) break;
}
c = l;
for (;a > 0 || c > 0 && n; ) {
if (0 === a) {
r = n;
n = n.nextZ;
c--;
} else if (0 !== c && n) if (i.z <= n.z) {
r = i;
i = i.nextZ;
a--;
} else {
r = n;
n = n.nextZ;
c--;
} else {
r = i;
i = i.nextZ;
a--;
}
s ? s.nextZ = r : t = r;
r.prevZ = s;
s = r;
}
i = n;
}
s.nextZ = null;
l *= 2;
} while (o > 1);
return t;
}
function m(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 y(t) {
var e = t, i = t;
do {
e.x < i.x && (i = e);
e = e.next;
} while (e !== t);
return i;
}
function v(t, e, i, n, r, s, o, a) {
return (r - o) * (e - a) - (t - o) * (s - a) >= 0 && (t - o) * (n - a) - (i - o) * (e - a) >= 0 && (i - o) * (s - a) - (r - o) * (n - a) >= 0;
}
function g(t, e) {
return t.next.i !== e.i && t.prev.i !== e.i && !A(t, e) && S(t, e) && S(e, t) && T(t, e);
}
function b(t, e, i) {
return (e.y - t.y) * (i.x - e.x) - (e.x - t.x) * (i.y - e.y);
}
function C(t, e) {
return t.x === e.x && t.y === e.y;
}
function x(t, e, i, n) {
return !!(C(t, e) && C(i, n) || C(t, n) && C(i, e)) || b(t, e, i) > 0 != b(t, e, n) > 0 && b(i, n, t) > 0 != b(i, n, e) > 0;
}
function A(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 && x(i, i.next, t, e)) return !0;
i = i.next;
} while (i !== t);
return !1;
}
function S(t, e) {
return b(t.prev, t, t.next) < 0 ? b(t, e, t.next) >= 0 && b(t, t.prev, e) >= 0 : b(t, e, t.prev) < 0 || b(t, t.next, e) < 0;
}
function T(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 w(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;
t.next = e;
e.prev = t;
i.next = r;
r.prev = i;
n.next = i;
i.prev = n;
s.next = n;
n.prev = s;
return n;
}
function E(t, e, i, n) {
var r = new B(t, e, i);
if (n) {
r.next = n.next;
r.prev = n;
n.next.prev = r;
n.next = r;
} else {
r.prev = r;
r.next = r;
}
return r;
}
function M(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;
}
i.deviation = function(t, e, i, n) {
var r = e && e.length, s = r ? e[0] * i : t.length, o = Math.abs(I(t, 0, s, i));
if (r) for (var a = 0, c = e.length; a < c; a++) {
var l = e[a] * i, u = a < c - 1 ? e[a + 1] * i : t.length;
o -= Math.abs(I(t, l, u, i));
}
var h = 0;
for (a = 0; a < n.length; a += 3) {
var _ = n[a] * i, f = n[a + 1] * i, d = n[a + 2] * i;
h += Math.abs((t[_] - t[d]) * (t[f + 1] - t[_ + 1]) - (t[_] - t[f]) * (t[d + 1] - t[_ + 1]));
}
return 0 === o && 0 === h ? 0 : Math.abs((h - o) / o);
};
function I(t, e, i, n) {
for (var r = 0, s = e, o = i - n; s < i; s += n) {
r += (t[o] - t[s]) * (t[s + 1] + t[o + 1]);
o = s;
}
return r;
}
i.flatten = function(t) {
for (var e = t[0][0].length, i = {
vertices: [],
holes: [],
dimensions: e
}, n = 0, r = 0; r < t.length; r++) {
for (var s = 0; s < t[r].length; s++) for (var o = 0; o < e; o++) i.vertices.push(t[r][s][o]);
if (r > 0) {
n += t[r - 1].length;
i.holes.push(n);
}
}
return i;
};
}), {} ],
281: [ (function(t, e) {
"use strict";
var i = t("../../../../graphics/helper"), n = t("../../../../graphics/types").PointFlags, r = cc.Graphics.Point = cc.Class({
name: "cc.GraphicsPoint",
extends: cc.Vec2,
ctor: function() {
this.reset();
},
reset: function() {
this.dx = 0;
this.dy = 0;
this.dmx = 0;
this.dmy = 0;
this.flags = 0;
this.len = 0;
}
});
function s() {
this.reset();
}
cc.js.mixin(s.prototype, {
reset: function() {
this.closed = !1;
this.nbevel = 0;
this.complex = !0;
this.points ? this.points.length = 0 : this.points = [];
}
});
function o() {
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(o.prototype, {
moveTo: function(t, e) {
if (this._updatePathOffset) {
this._pathOffset = this._pathLength;
this._updatePathOffset = !1;
}
this._addPath();
this._addPoint(t, e, n.PT_CORNER);
this._commandx = t;
this._commandy = e;
},
lineTo: function(t, e) {
this._addPoint(t, e, n.PT_CORNER);
this._commandx = t;
this._commandy = e;
},
bezierCurveTo: function(t, e, r, s, o, a) {
var c = this._curPath, l = c.points[c.points.length - 1];
if (l.x !== t || l.y !== e || r !== o || s !== a) {
i.tesselateBezier(this, l.x, l.y, t, e, r, s, o, a, 0, n.PT_CORNER);
this._commandx = o;
this._commandy = a;
} else this.lineTo(o, a);
},
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, n, r, s, o) {
i.arc(this, t, e, n, r, s, o);
},
ellipse: function(t, e, n, r) {
i.ellipse(this, t, e, n, r);
this._curPath.complex = !1;
},
circle: function(t, e, n) {
i.ellipse(this, t, e, n, n);
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, n, r, s) {
i.roundRect(this, t, e, n, r, s);
this._curPath.complex = !1;
},
clear: function(t) {
this._pathLength = 0;
this._pathOffset = 0;
this._pointsOffset = 0;
this._curPath = null;
if (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];
if (e) e.reset(); else {
e = new s();
this._paths.push(e);
}
this._pathLength++;
this._curPath = e;
return e;
},
_addPoint: function(t, e, i) {
var n = this._curPath;
if (n) {
var s, o = this._points, a = n.points;
if (s = o[this._pointsOffset++]) {
s.x = t;
s.y = e;
} else {
s = new r(t, e);
o.push(s);
}
s.flags = i;
a.push(s);
}
}
});
cc.Graphics._Impl = o;
e.exports = o;
}), {
"../../../../graphics/helper": 203,
"../../../../graphics/types": 205
} ],
282: [ (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 o(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
a(t, e);
}
function a(t, e) {
return (a = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var c = t("../../mesh-buffer"), l = t("../../../index"), u = t("../../../../graphics/graphics"), h = t("../../../../graphics/types").PointFlags, _ = u.LineJoin, f = u.LineCap, d = t("./earcut");
t("./impl");
var p = Math.PI, m = Math.min, y = Math.max, v = Math.ceil, g = Math.acos, b = Math.cos, C = Math.sin, x = Math.atan2;
function A(t, e, i) {
return t < e ? e : t > i ? i : t;
}
var S = cc.gfx, T = new S.VertexFormat([ {
name: S.ATTR_POSITION,
type: S.ATTR_TYPE_FLOAT32,
num: 2
}, {
name: S.ATTR_COLOR,
type: S.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
}, {
name: "a_dist",
type: S.ATTR_TYPE_FLOAT32,
num: 1
} ]);
T.name = "vfmtPosColorSdf";
var w = (function(t) {
o(e, t);
function e(e) {
var i;
(i = t.call(this, e) || this)._buffer = null;
i._buffers = [];
i._bufferOffset = 0;
return i;
}
var i = e.prototype;
i.getVfmt = function() {
return T;
};
i.getVfmtFloatCount = function() {
return 4;
};
i.requestBuffer = function() {
var t = {
indiceStart: 0,
vertexStart: 0
}, e = new c(l._handle, this.getVfmt());
t.meshbuffer = e;
var i = new r.default(e._vb, e._ib);
t.ia = i;
this._buffers.push(t);
return t;
};
i.getBuffers = function() {
0 === this._buffers.length && this.requestBuffer();
return this._buffers;
};
i.clear = function(t) {
this._bufferOffset = 0;
var e = this._buffers;
if (t) {
for (var i = 0, n = e.length; i < n; i++) {
var r = e[i];
r.meshbuffer.destroy();
r.meshbuffer = null;
}
e.length = 0;
} else for (var s = 0, o = e.length; s < o; s++) {
var a = e[s];
a.indiceStart = 0;
a.vertexStart = 0;
a.meshbuffer.reset();
}
};
i.fillBuffers = function(t, e) {
e._flush();
e.node = t.node;
e.material = t._materials[0];
for (var i = this.getBuffers(), n = 0, r = i.length; n < r; n++) {
var s = i[n], o = s.meshbuffer;
s.ia._count = s.indiceStart;
e._flushIA(s.ia);
o.uploadData();
}
};
i.genBuffer = function(t, e) {
var i = this.getBuffers(), n = i[this._bufferOffset], r = n.meshbuffer, s = n.vertexStart + e;
if (s > 65535 || 3 * s > 131070) {
++this._bufferOffset;
s = e;
if (this._bufferOffset < i.length) n = i[this._bufferOffset]; else {
n = this.requestBuffer(t);
i[this._bufferOffset] = n;
}
r = n.meshbuffer;
}
s > r.vertexOffset && r.requestStatic(e, 3 * e);
this._buffer = n;
return 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, i, n, r, s = .5 * t.lineWidth, o = t.lineCap, a = t.lineJoin, c = t.miterLimit, l = t._impl, u = (e = s, 
i = p, n = l._tessTol, r = 2 * g(e / (e + n)), y(2, v(i / r)));
this._calculateJoins(l, s, a, c);
for (var d = l._paths, m = 0, b = l._pathOffset, C = l._pathLength; b < C; b++) {
var x = d[b], A = x.points.length;
a === _.ROUND ? m += 2 * (A + x.nbevel * (u + 2) + 1) : m += 2 * (A + 5 * x.nbevel + 1);
x.closed || (o === f.ROUND ? m += 2 * (2 * u + 2) : m += 12);
}
for (var S = this.genBuffer(t, m), T = S.meshbuffer, w = T._vData, E = T._iData, M = l._pathOffset, B = l._pathLength; M < B; M++) {
var I, D = d[M], P = D.points, R = P.length, L = S.vertexStart, O = void 0, V = void 0, N = void 0, F = void 0;
if (I = D.closed) {
O = P[R - 1];
V = P[0];
N = 0;
F = R;
} else {
O = P[0];
V = P[1];
N = 1;
F = R - 1;
}
V = V || O;
if (!I) {
var z = V.sub(O);
z.normalizeSelf();
var k = z.x, G = z.y;
o === f.BUTT ? this._buttCapStart(O, k, G, s, 0) : o === f.SQUARE ? this._buttCapStart(O, k, G, s, s) : o === f.ROUND && this._roundCapStart(O, k, G, s, u);
}
for (var U = N; U < F; ++U) {
if (a === _.ROUND) this._roundJoin(O, V, s, s, u); else if (0 != (V.flags & (h.PT_BEVEL | h.PT_INNERBEVEL))) this._bevelJoin(O, V, s, s); else {
this._vset(V.x + V.dmx * s, V.y + V.dmy * s, 1);
this._vset(V.x - V.dmx * s, V.y - V.dmy * s, -1);
}
O = V;
V = P[U + 1];
}
if (I) {
var H = this.getVfmtFloatCount(), j = L * H;
this._vset(w[j], w[j + 1], 1);
this._vset(w[j + H], w[j + H + 1], -1);
} else {
var W = V.sub(O);
W.normalizeSelf();
var q = W.x, X = W.y;
o === f.BUTT ? this._buttCapEnd(V, q, X, s, 0) : o === f.SQUARE ? this._buttCapEnd(V, q, X, s, s) : o === f.ROUND && this._roundCapEnd(V, q, X, s, u);
}
for (var Y = S.indiceStart, J = L + 2, Z = S.vertexStart; J < Z; J++) {
E[Y++] = J - 2;
E[Y++] = J - 1;
E[Y++] = J;
}
S.indiceStart = Y;
}
};
i._expandFill = function(t) {
for (var e = t._impl, i = e._paths, n = 0, r = e._pathOffset, s = e._pathLength; r < s; r++) n += i[r].points.length;
for (var o = this.genBuffer(t, n), a = o.meshbuffer, c = a._vData, l = a._iData, u = e._pathOffset, h = e._pathLength; u < h; u++) {
var _ = i[u], f = _.points, p = f.length;
if (0 !== p) {
for (var m = o.vertexStart, y = 0; y < p; ++y) this._vset(f[y].x, f[y].y);
var v = o.indiceStart;
if (_.complex) {
for (var g = [], b = this.getVfmtFloatCount(), C = m, x = o.vertexStart; C < x; C++) {
var A = C * b;
g.push(c[A]);
g.push(c[A + 1]);
}
var S = d(g, null, 2);
if (!S || 0 === S.length) continue;
for (var T = 0, w = S.length; T < w; T++) l[v++] = S[T] + m;
} else for (var E = m, M = m + 2, B = o.vertexStart; M < B; M++) {
l[v++] = E;
l[v++] = M - 1;
l[v++] = M;
}
o.indiceStart = v;
}
}
};
i._calculateJoins = function(t, e, i, n) {
var r = 0;
e > 0 && (r = 1 / e);
for (var s = t._paths, o = t._pathOffset, a = t._pathLength; o < a; o++) {
var c = s[o], l = c.points, u = l.length, f = l[u - 1], d = l[0];
c.nbevel = 0;
for (var p = 0; p < u; p++) {
var v, g, b = f.dy, C = -f.dx, x = d.dy, A = -d.dx;
d.dmx = .5 * (b + x);
d.dmy = .5 * (C + A);
if ((v = d.dmx * d.dmx + d.dmy * d.dmy) > 1e-6) {
var S = 1 / v;
S > 600 && (S = 600);
d.dmx *= S;
d.dmy *= S;
}
d.dx * f.dy - f.dx * d.dy > 0 && (d.flags |= h.PT_LEFT);
v * (g = y(11, m(f.len, d.len) * r)) * g < 1 && (d.flags |= h.PT_INNERBEVEL);
var T = d.dmx * e, w = d.dmy * e, E = T * T + w * w;
(E > d.len * d.len || E > f.len * f.len) && (d.flags |= h.PT_INNERBEVEL);
d.flags & h.PT_CORNER && (v * n * n < 1 || i === _.BEVEL || i === _.ROUND) && (d.flags |= h.PT_BEVEL);
0 != (d.flags & (h.PT_BEVEL | h.PT_INNERBEVEL)) && c.nbevel++;
f = d;
d = l[p + 1];
}
}
};
i._flattenPaths = function(t) {
for (var e = t._paths, i = t._pathOffset, n = t._pathLength; i < n; i++) {
var r = e[i], s = r.points, o = s[s.length - 1], a = s[0];
if (s.length > 2 && o.equals(a)) {
r.closed = !0;
s.pop();
o = s[s.length - 1];
}
for (var c = 0, l = s.length; c < l; c++) {
var u = a.sub(o);
o.len = u.mag();
(u.x || u.y) && u.normalizeSelf();
o.dx = u.x;
o.dy = u.y;
o = a;
a = s[c + 1];
}
}
};
i._chooseBevel = function(t, e, i, n) {
var r, s, o, a, c = i.x, l = i.y;
if (0 !== t) {
r = c + e.dy * n;
s = l - e.dx * n;
o = c + i.dy * n;
a = l - i.dx * n;
} else {
r = o = c + i.dmx * n;
s = a = l + i.dmy * n;
}
return [ r, s, o, a ];
};
i._buttCapStart = function(t, e, i, n, r) {
var s = t.x - e * r, o = t.y - i * r, a = i, c = -e;
this._vset(s + a * n, o + c * n, 1);
this._vset(s - a * n, o - c * n, -1);
};
i._buttCapEnd = function(t, e, i, n, r) {
var s = t.x + e * r, o = t.y + i * r, a = i, c = -e;
this._vset(s + a * n, o + c * n, 1);
this._vset(s - a * n, o - c * n, -1);
};
i._roundCapStart = function(t, e, i, n, r) {
for (var s = t.x, o = t.y, a = i, c = -e, l = 0; l < r; l++) {
var u = l / (r - 1) * p, h = b(u) * n, _ = C(u) * n;
this._vset(s - a * h - e * _, o - c * h - i * _, 1);
this._vset(s, o, 0);
}
this._vset(s + a * n, o + c * n, 1);
this._vset(s - a * n, o - c * n, -1);
};
i._roundCapEnd = function(t, e, i, n, r) {
var s = t.x, o = t.y, a = i, c = -e;
this._vset(s + a * n, o + c * n, 1);
this._vset(s - a * n, o - c * n, -1);
for (var l = 0; l < r; l++) {
var u = l / (r - 1) * p, h = b(u) * n, _ = C(u) * n;
this._vset(s, o, 0);
this._vset(s - a * h + e * _, o - c * h + i * _, 1);
}
};
i._roundJoin = function(t, e, i, n, r) {
var s = t.dy, o = -t.dx, a = e.dy, c = -e.dx, l = e.x, u = e.y;
if (0 != (e.flags & h.PT_LEFT)) {
var _ = this._chooseBevel(e.flags & h.PT_INNERBEVEL, t, e, i), f = _[0], d = _[1], m = _[2], y = _[3], g = x(-o, -s), S = x(-c, -a);
S > g && (S -= 2 * p);
this._vset(f, d, 1);
this._vset(l - s * n, e.y - o * n, -1);
for (var T = A(v((g - S) / p) * r, 2, r), w = 0; w < T; w++) {
var E = g + w / (T - 1) * (S - g), M = l + b(E) * n, B = u + C(E) * n;
this._vset(l, u, 0);
this._vset(M, B, -1);
}
this._vset(m, y, 1);
this._vset(l - a * n, u - c * n, -1);
} else {
var I = this._chooseBevel(e.flags & h.PT_INNERBEVEL, t, e, -n), D = I[0], P = I[1], R = I[2], L = I[3], O = x(o, s), V = x(c, a);
V < O && (V += 2 * p);
this._vset(l + s * n, u + o * n, 1);
this._vset(D, P, -1);
for (var N = A(v((V - O) / p) * r, 2, r), F = 0; F < N; F++) {
var z = O + F / (N - 1) * (V - O), k = l + b(z) * i, G = u + C(z) * i;
this._vset(k, G, 1);
this._vset(l, u, 0);
}
this._vset(l + a * n, u + c * n, 1);
this._vset(R, L, -1);
}
};
i._bevelJoin = function(t, e, i, n) {
var r, s, o, a, c, l, u, _, f = t.dy, d = -t.dx, p = e.dy, m = -e.dx;
if (e.flags & h.PT_LEFT) {
var y = this._chooseBevel(e.flags & h.PT_INNERBEVEL, t, e, i);
c = y[0];
l = y[1];
u = y[2];
_ = y[3];
this._vset(c, l, 1);
this._vset(e.x - f * n, e.y - d * n, -1);
this._vset(u, _, 1);
this._vset(e.x - p * n, e.y - m * n, -1);
} else {
var v = this._chooseBevel(e.flags & h.PT_INNERBEVEL, t, e, -n);
r = v[0];
s = v[1];
o = v[2];
a = v[3];
this._vset(e.x + f * i, e.y + d * i, 1);
this._vset(r, s, -1);
this._vset(e.x + p * i, e.y + m * i, 1);
this._vset(o, a, -1);
}
};
i._vset = function(t, e, i) {
void 0 === i && (i = 0);
var n = this._buffer, r = n.meshbuffer, s = n.vertexStart * this.getVfmtFloatCount(), o = r._vData, a = r._uintVData;
o[s] = t;
o[s + 1] = e;
a[s + 2] = this._curColor;
o[s + 3] = i;
n.vertexStart++;
r._dirty = !0;
};
return e;
})(n.default);
i.default = w;
n.default.register(cc.Graphics, w);
e.exports = i.default;
}), {
"../../../../../renderer/core/input-assembler": 359,
"../../../../graphics/graphics": 202,
"../../../../graphics/types": 205,
"../../../assembler": 268,
"../../../index": 271,
"../../mesh-buffer": 308,
"./earcut": 280,
"./impl": 281
} ],
283: [ (function(t) {
"use strict";
cc.assemblers = {};
t("./sprite");
t("./mask-assembler");
t("./graphics");
t("./label");
t("./motion-streak");
}), {
"./graphics": 282,
"./label": 291,
"./mask-assembler": 292,
"./motion-streak": 293,
"./sprite": 306
} ],
284: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../utils/label/bmfont")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = 0, c = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.initData = function() {
this._renderData.createFlexData(0, 4, 6, this.getVfmt());
};
i._reserveQuads = function(t, e) {
var i = 4 * e, n = 6 * e, r = this._renderData._flexBuffer;
r.reserve(i, n);
r.used(i, n);
for (var s = this._renderData.iDatas[0], o = 0, c = 0, l = n; o < l; o += 6, c += 4) {
s[o] = c;
s[o + 1] = c + 1;
s[o + 2] = c + 2;
s[o + 3] = c + 1;
s[o + 4] = c + 3;
s[o + 5] = c + 2;
}
a = 0;
};
i._quadsUpdated = function() {
a = 0;
this._renderData._flexBuffer.used(this.verticesCount, this.indicesCount);
};
i._getColor = function(t) {
return t.node._color._val;
};
i.appendQuad = function(t, e, i, n, r, s, o) {
var c = this._renderData, l = c.vDatas[0], u = c.uintVDatas[0];
this.verticesCount += 4;
this.indicesCount = this.verticesCount / 2 * 3;
var h, _, f, d, p = e.width, m = e.height, y = i.width, v = i.height, g = this._getColor(t), b = this.floatsPerVert, C = a + this.uvOffset;
if (n) {
h = i.x / p;
f = (i.x + v) / p;
_ = (i.y + y) / m;
d = i.y / m;
l[C] = h;
l[C + 1] = d;
l[C += b] = h;
l[C + 1] = _;
l[C += b] = f;
l[C + 1] = d;
l[C += b] = f;
l[C + 1] = _;
} else {
h = i.x / p;
f = (i.x + y) / p;
_ = (i.y + v) / m;
d = i.y / m;
l[C] = h;
l[C + 1] = _;
l[C += b] = f;
l[C + 1] = _;
l[C += b] = h;
l[C + 1] = d;
l[C += b] = f;
l[C + 1] = d;
}
h = r;
f = r + y * o;
_ = s - v * o;
d = s;
this.appendVerts(t, a, h, f, _, d);
for (var x = a + this.colorOffset, A = 0; A < 4; A++) {
u[x] = g;
x += b;
}
a += 4 * this.floatsPerVert;
};
i.appendVerts = function(t, e, i, n, r, s) {
var o = this._local, a = this.floatsPerVert;
o[e] = i;
o[e + 1] = r;
o[e += a] = n;
o[e + 1] = r;
o[e += a] = i;
o[e + 1] = s;
o[e += a] = n;
o[e + 1] = s;
};
i.updateWorldVerts = function(t) {
for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], c = this._local, l = this._renderData.vDatas[0], u = this.floatsPerVert, h = 0; h < c.length; h += u) {
var _ = c[h], f = c[h + 1];
l[h] = _ * i + f * r + o;
l[h + 1] = _ * n + f * s + a;
}
};
return e;
})(r.default);
i.default = c;
e.exports = i.default;
}), {
"../../../../utils/label/bmfont": 275
} ],
285: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
function n(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
r(t, e);
}
function r(t, e) {
return (r = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
t("../../../../../platform/js"), t("./bmfont");
var s = t("../../../../utils/label/letter-font"), o = cc.color(255, 255, 255, 255), a = (function(t) {
n(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.createData = function(t) {
return t.requestRenderData();
};
i._getColor = function(t) {
o._fastSetA(t.node._color.a);
return o._val;
};
i.updateColor = function(e) {
var i = this._getColor(e);
t.prototype.updateColor.call(this, e, i);
};
return e;
})(s);
i.default = a;
e.exports = i.default;
}), {
"../../../../../platform/js": 260,
"../../../../utils/label/letter-font": 277,
"./bmfont": 284
} ],
286: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../../assets/material/material-variant")) && n.__esModule ? n : {
default: n
};
t("../../../../../components/CCLabel"), t("../../../../../components/CCLabelShadow"), 
t("../../../../../components/CCLabelOutline"), t("../../../../../assets/material/CCMaterial");
var s = (function() {
function t() {}
var e = t.prototype;
e.init = function(t) {
this.labelMaterial = null;
this._label = this._renderComp = t;
renderer.CustomAssembler.prototype.ctor.call(this);
t.node._proxy.setAssembler(this);
this._layout = new jsb.LabelRenderer();
this._layout.init(t);
this._cfg = new DataView(this._layout._cfg);
this._layoutInfo = new DataView(this._layout._layout);
this._cfgFields = jsb.LabelRenderer._cfgFields;
this._layoutFields = jsb.LabelRenderer._layoutFields;
this._layout.bindNodeProxy(t.node._proxy);
this._bindMaterial(t);
};
e._setBufferFlag = function(t, e, i, n, r) {
if ("int8" == n && 1 == i) {
var s = t.getInt8(e);
t.setInt8(e, r | s);
} else if ("int32" == n && 4 == i) {
var o = t.getInt32(e, jsb.__isLittleEndian__);
t.setInt32(e, r | o, jsb.__isLittleEndian__);
} else cc.warn("flag storage type should be int8/int32 only, type/size -> " + n + "/" + i + ".");
};
e._updateCfgFlag = function(t) {
var e = this._cfgFields.updateFlags;
this._setBufferFlag(this._cfg, e.offset, e.size, e.type, t);
};
e._setBufferValue = function(t, e, i, n, r) {
if ("float" == n && 4 == i) t.setFloat32(e, r, jsb.__isLittleEndian__); else if ("int32" == n && 4 == i) t.setInt32(e, r, jsb.__isLittleEndian__); else if ("bool" == n && 1 == i) t.setInt8(e, r ? 1 : 0, jsb.__isLittleEndian__); else if ("Color4B" == n && 4 == i) {
t.setUint8(e, r.r);
t.setUint8(e + 1, r.g);
t.setUint8(e + 2, r.b);
t.setUint8(e + 3, r.a);
} else "int8" == n && 1 == i ? t.setUint8(e, r) : cc.warn("dont know how to set value to buffer, type/size -> " + n + "/" + i + ".");
};
e._setFieldValue = function(t, e, i, n) {
var r = e[i];
this._setBufferValue(t, r.offset, r.size, r.type, n);
};
e._getBufferValue = function(t, e, i, n) {
if ("float" == n && 4 == i) return t.getFloat32(e, jsb.__isLittleEndian__);
if ("int32" == n && 4 == i) return t.getInt32(e, jsb.__isLittleEndian__);
if ("bool" == n && 1 == i) return 0 != t.getInt8(e, jsb.__isLittleEndian__);
if ("Color4B" == n && 4 == i) return {
r: t.getUint8(e),
g: t.getUint8(e + 1),
b: t.getUint8(e + 2),
a: t.getUint8(e + 3)
};
if ("int8" == n && 1 == i) return t.getUint8(e);
cc.warn("dont know how to get value from buffer, type/size -> " + n + "/" + i + ".");
};
e._getFieldValue = function(t, e, i) {
var n = e[i];
return this._getBufferValue(t, n.offset, n.size, n.type);
};
e._getLayoutValue = function(t) {
return this._getFieldValue(this._layoutInfo, this._layoutFields, t);
};
e._setLayoutValue = function(t, e) {
return this._setFieldValue(this._layoutInfo, this._layoutFields, t, e);
};
e._updateCfgFlag_Content = function() {
this._updateCfgFlag(1);
};
e._updateCfgFlag_Font = function() {
this._updateCfgFlag(2);
};
e._colorEqual = function(t, e) {
return t.r == e.r && t.g == e.g && t.b == e.b && t.a == e.a;
};
e._colorToObj = function(t, e, i, n) {
return {
r: t,
g: e,
b: i,
a: n
};
};
e.setString = function(t) {
if (t != this._layout.string) {
this._layout.string = t;
this._updateCfgFlag_Content();
}
};
e.setFontPath = function(t) {
if (t != this._layout.fontPath) {
this._layout.fontPath = t;
this._updateCfgFlag_Font();
}
};
e.setFontSize = function(t, e) {
if (this._getFieldValue(this._cfg, this._cfgFields, "fontSize") != t) {
this._setFieldValue(this._cfg, this._cfgFields, "fontSize", t);
this._setFieldValue(this._cfg, this._cfgFields, "fontSizeRetina", e);
this._updateCfgFlag_Font();
}
};
e.setOutline = function(t) {
var e = this._getLayoutValue("outlineSize");
e > 0 != t > 0 && this._updateCfgFlag_Font();
if (e != t) {
this._updateCfgFlag_Content();
this._setLayoutValue("outlineSize", t);
}
};
e.setOutlineColor = function(t) {
var e = this._getLayoutValue("outlineColor");
if (!this._colorEqual(e, t)) {
this._setLayoutValue("outlineColor", t);
this._updateCfgFlag_Content();
}
};
e.setLineHeight = function(t) {
if (this._getLayoutValue("lineHeight") != t) {
this._setLayoutValue("lineHeight", t);
this._updateCfgFlag_Content();
}
};
e.setOverFlow = function(t) {
if (this._getLayoutValue("overflow") != t) {
this._setLayoutValue("overflow", t);
this._updateCfgFlag_Content();
}
};
e.setEnableWrap = function(t) {
if (this._getLayoutValue("wrap") != t) {
this._setLayoutValue("wrap", t);
this._updateCfgFlag_Content();
}
};
e.setVerticalAlign = function(t) {
if (this._getLayoutValue("valign") != t) {
this._setLayoutValue("valign", t);
this._updateCfgFlag_Content();
}
};
e.setHorizontalAlign = function(t) {
if (this._getLayoutValue("halign") != t) {
this._setLayoutValue("halign", t);
this._updateCfgFlag_Content();
}
};
e.setContentSize = function(t, e) {
var i = this._getLayoutValue("width"), n = this._getLayoutValue("height");
if (i != t || n != e) {
this._setLayoutValue("height", e);
this._setLayoutValue("width", t);
this._updateCfgFlag_Content();
}
};
e.setAnchorPoint = function(t, e) {
var i = this._getLayoutValue("anchorX"), n = this._getLayoutValue("anchorY");
if (i != t || n != e) {
this._setLayoutValue("anchorX", t);
this._setLayoutValue("anchorY", e);
this._updateCfgFlag_Content();
}
};
e.setColor = function(t) {
var e = this._getLayoutValue("color");
if (!this._colorEqual(e, t)) {
this._setLayoutValue("color", t);
this._updateCfgFlag_Content();
}
};
e.setShadow = function(t, e, i) {
var n = this._getLayoutValue("shadowBlur"), r = this._getLayoutValue("shadowX"), s = this._getLayoutValue("shadowY");
n > 0 != i > 0 && this._updateCfgFlag_Font();
var o = !1;
if (n != i) {
this._setLayoutValue("shadowBlur", i);
o = !0;
}
if (r != t) {
this._setLayoutValue("shadowX", t);
o = !0;
}
if (s != e) {
this._setLayoutValue("shadowY", e);
o = !0;
}
o && this._updateCfgFlag_Content();
};
e.setShadowColor = function(t) {
var e = this._getLayoutValue("shadowColor");
if (!this._colorEqual(e, t)) {
this._setLayoutValue("shadowColor", t);
this._updateCfgFlag_Content();
}
};
e.setItalic = function(t) {
if (this._getLayoutValue("italic") != t) {
this._setLayoutValue("italic", t);
this._updateCfgFlag_Content();
}
};
e.setBold = function(t) {
if (this._getLayoutValue("bold") != t) {
this._setLayoutValue("bold", t);
this._updateCfgFlag_Content();
this._updateCfgFlag_Font();
}
};
e.setUnderline = function(t) {
if (this._getLayoutValue("underline") != t) {
this._setLayoutValue("underline", t);
this._updateCfgFlag_Content();
}
};
e.setSpacingX = function(t) {
if (this._getLayoutValue("spaceX") != t && "number" == typeof t && !isNaN(t)) {
this._setLayoutValue("spaceX", t);
this._updateCfgFlag_Content();
}
};
e.updateRenderData = function(t) {
if (t._vertsDirty) {
t.font && t.font.nativeUrl && this.setFontPath(cc.assetManager.cacheManager.getCache(t.font.nativeUrl) || t.font.nativeUrl);
var e = this._layout, i = t.node.color, n = t.node, r = t.fontSize;
this.setString(t.string);
this.setFontSize(t.fontSize, r / 72 * t.fontSize);
this.setLineHeight(t.lineHeight);
this.setEnableWrap(t.enableWrapText);
this.setItalic(t.enableItalic);
this.setUnderline(t.enableUnderline);
this.setBold(t.enableBold);
this.setOverFlow(t.overflow);
this.setVerticalAlign(t.verticalAlign);
this.setHorizontalAlign(t.horizontalAlign);
this.setSpacingX(t.spacingX);
this.setContentSize(n.getContentSize().width, n.getContentSize().height);
this.setAnchorPoint(n.anchorX, n.anchorY);
this.setColor(this._colorToObj(i.getR(), i.getG(), i.getB(), Math.ceil(i.getA() * n.opacity / 255)));
var s = n.getComponent(cc.LabelShadow);
if (s && s.enabled) {
var o = s.color;
this.setShadow(s.offset.x, s.offset.y, s.blur);
this.setShadowColor(this._colorToObj(o.getR(), o.getG(), o.getB(), Math.ceil(o.getA() * n.opacity / 255)));
} else this.setShadow(0, 0, -1);
this._updateTTFMaterial(t);
e.render();
}
};
e._bindMaterial = function(t) {
var e = this.labelMaterial;
if (!e) {
e = r.default.createWithBuiltin("2d-label", t);
this.labelMaterial = e;
}
return e;
};
e._updateTTFMaterial = function(t) {
var e = this._bindMaterial(t), i = this._label.node, n = this._layout, r = i.getComponent(cc.LabelOutline), s = 0;
if (r && r.enabled && r.width > 0) {
s = Math.max(Math.min(r.width / 10, .4), .1);
var o = r.color;
this.setOutlineColor(this._colorToObj(o.getR(), o.getG(), o.getB(), Math.ceil(o.getA() * i.opacity / 255)));
}
this.setOutline(s);
e.define("CC_USE_MODEL", !0);
e.define("USE_TEXTURE_ALPHAONLY", !0);
e.define("USE_SDF", s > 0 || t.enableBold);
e.define("USE_SDF_EXTEND", t.enableBold ? 1 : 0);
void 0 !== e.getDefine("CC_SUPPORT_standard_derivatives") && cc.sys.glExtension("OES_standard_derivatives") && e.define("CC_SUPPORT_standard_derivatives", !0);
n.setEffect(e.effect._nativeObj);
};
e.fillBuffers = function() {
this._layout.render();
};
e.getVfmt = function() {};
return t;
})();
i.default = s;
e.exports = i.default;
}), {
"../../../../../assets/material/CCMaterial": 124,
"../../../../../assets/material/material-variant": 131,
"../../../../../components/CCLabel": 151,
"../../../../../components/CCLabelOutline": 152,
"../../../../../components/CCLabelShadow": 153
} ],
287: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../utils/label/ttf")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../../../components/CCLabelShadow"), c = cc.color(255, 255, 255, 255), l = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.updateUVs = function(t) {
for (var e = this._renderData.vDatas[0], i = t._frame.uv, n = this.uvOffset, r = this.floatsPerVert, s = 0; s < 4; s++) {
var o = 2 * s, a = r * s + n;
e[a] = i[o];
e[a + 1] = i[o + 1];
}
};
i.updateColor = function(e) {
c._fastSetA(e.node._color.a);
var i = c._val;
t.prototype.updateColor.call(this, e, i);
};
i.updateVerts = function(t) {
var e = t.node, i = t._ttfTexture.width, n = t._ttfTexture.height, r = e.anchorX * e.width, s = e.anchorY * e.height, o = a && t.getComponent(a);
if (o && o._enabled) {
var c = (i - e.width) / 2, l = (n - e.height) / 2, u = o.offset;
-u.x > c ? r += i - e.width : c > u.x && (r += c - u.x);
-u.y > l ? s += n - e.height : l > u.y && (s += l - u.y);
}
var h = this._local;
h[0] = -r;
h[1] = -s;
h[2] = i - r;
h[3] = n - s;
this.updateUVs(t);
this.updateWorldVerts(t);
};
return e;
})(r.default);
i.default = l;
e.exports = i.default;
}), {
"../../../../../components/CCLabelShadow": 153,
"../../../../utils/label/ttf": 278
} ],
288: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../../value-types/vec3")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../../assembler-3d"), c = t("../2d/bmfont"), l = new r.default(), u = new r.default(), h = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
return e;
})(c);
i.default = h;
cc.js.mixin(h.prototype, a, {
updateWorldVerts: function(t) {
for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], s = this.floatsPerVert, o = 0; o < n.length; o += s) {
r.default.set(l, i[o], i[o + 1], 0);
r.default.transformMat4(u, l, e);
n[o] = u.x;
n[o + 1] = u.y;
n[o + 2] = u.z;
}
}
});
e.exports = i.default;
}), {
"../../../../../value-types/vec3": 347,
"../../../../assembler-3d": 266,
"../2d/bmfont": 284
} ],
289: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../../value-types/vec3")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../../assembler-3d"), c = t("../2d/letter"), l = new r.default(), u = new r.default(), h = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
return e;
})(c);
i.default = h;
cc.js.mixin(h.prototype, a, {
updateWorldVerts: function(t) {
for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], s = this.floatsPerVert, o = 0; o < n.length; o += s) {
r.default.set(l, i[o], i[o + 1], 0);
r.default.transformMat4(u, l, e);
n[o] = u.x;
n[o + 1] = u.y;
n[o + 2] = u.z;
}
}
});
e.exports = i.default;
}), {
"../../../../../value-types/vec3": 347,
"../../../../assembler-3d": 266,
"../2d/letter": 285
} ],
290: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
function n(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
r(t, e);
}
function r(t, e) {
return (r = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var s = t("../../../../assembler-3d"), o = (function(t) {
n(e, t);
function e() {
return t.apply(this, arguments) || this;
}
return e;
})(t("../2d/ttf"));
i.default = o;
cc.js.mixin(o.prototype, s);
e.exports = i.default;
}), {
"../../../../assembler-3d": 266,
"../2d/ttf": 287
} ],
291: [ (function(t) {
"use strict";
var e = l(t("../../../assembler")), i = l(t("../../../../components/CCLabel")), n = l(t("./2d/ttf")), r = l(t("./2d/bmfont")), s = l(t("./2d/letter")), o = l(t("./3d/ttf")), a = l(t("./3d/bmfont")), c = l(t("./3d/letter"));
function l(t) {
return t && t.__esModule ? t : {
default: t
};
}
var u;
u = t("./2d/nativeTTF");
i.default._canvasPool = {
pool: [],
get: function() {
var t = this.pool.pop();
if (!t) {
var e = document.createElement("canvas"), i = e.getContext("2d");
t = {
canvas: e,
context: i
};
i.textBaseline = "alphabetic";
}
return t;
},
put: function(t) {
this.pool.length >= 32 || this.pool.push(t);
}
};
e.default.register(cc.Label, {
getConstructor: function(t) {
var e = t.node.is3DNode, l = e ? o.default : n.default;
t.font instanceof cc.BitmapFont ? l = e ? a.default : r.default : t.cacheMode === i.default.CacheMode.CHAR && (!e && jsb.LabelRenderer && t.font instanceof cc.TTFFont && t._useNativeTTF() ? l = u : cc.sys.platform === cc.sys.WECHAT_GAME_SUB ? cc.warn("sorry, subdomain does not support CHAR mode currently!") : l = e ? c.default : s.default);
return l;
},
TTF: n.default,
Bmfont: r.default,
Letter: s.default,
TTF3D: o.default,
Bmfont3D: a.default,
Letter3D: c.default,
NativeTTF: u
});
}), {
"../../../../components/CCLabel": 151,
"../../../assembler": 268,
"./2d/bmfont": 284,
"./2d/letter": 285,
"./2d/nativeTTF": 286,
"./2d/ttf": 287,
"./3d/bmfont": 288,
"./3d/letter": 289,
"./3d/ttf": 290
} ],
292: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.MaskAssembler = void 0;
var n, r = (n = t("../../assembler")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../components/CCMask"), c = t("../../render-flow"), l = t("./sprite/2d/simple"), u = t("./graphics"), h = t("../../../../renderer/gfx"), _ = t("../vertex-format").vfmtPos, f = 8, d = [];
function p() {
return 1 << d.length - 1;
}
function m() {
for (var t = 0, e = 0; e < d.length; ++e) t += 1 << e;
return t;
}
function y(t, e, i, n, r, s) {
var o = t.effect, a = h.STENCIL_OP_KEEP, c = h.STENCIL_OP_KEEP;
o.setStencil(h.STENCIL_ENABLE, e, n, r, i, a, c, s);
}
function v(t) {
d.length + 1 > f && cc.errorID(9e3, f);
d.push(t);
}
function g(t, e) {
0 === d.length && cc.errorID(9001);
d.pop();
0 === d.length ? e._flushMaterial(t._exitMaterial) : x(e);
}
function b(t, e) {
var i = h.DS_FUNC_NEVER, n = p(), r = n, s = n, o = t.inverted ? h.STENCIL_OP_REPLACE : h.STENCIL_OP_ZERO;
y(t._clearMaterial, i, o, n, r, s);
var a = e.getBuffer("mesh", _), c = a.request(4, 6), l = c.indiceOffset, u = c.byteOffset >> 2, f = c.vertexOffset, d = a._vData, m = a._iData;
d[u++] = -1;
d[u++] = -1;
d[u++] = -1;
d[u++] = 1;
d[u++] = 1;
d[u++] = 1;
d[u++] = 1;
d[u++] = -1;
m[l++] = f;
m[l++] = f + 3;
m[l++] = f + 1;
m[l++] = f + 1;
m[l++] = f + 3;
m[l++] = f + 2;
e.node = e._dummyNode;
e.material = t._clearMaterial;
e._flush();
}
function C(t, e) {
var i = h.DS_FUNC_NEVER, n = p(), r = n, s = n, o = t.inverted ? h.STENCIL_OP_ZERO : h.STENCIL_OP_REPLACE;
y(t._materials[0], i, o, n, r, s);
e.material = t._materials[0];
if (t._type === a.Type.IMAGE_STENCIL) {
e.node = e._dummyNode;
l.prototype.fillBuffers.call(t._assembler, t, e);
e._flush();
} else {
e.node = t.node;
u.prototype.fillBuffers.call(t._graphics._assembler, t._graphics, e);
}
}
function x(t) {
var e = h.DS_FUNC_EQUAL, i = h.STENCIL_OP_KEEP, n = m(), r = n, s = p(), o = d[d.length - 1];
y(o._enableMaterial, e, i, n, r, s);
t._flushMaterial(o._enableMaterial);
}
var A = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.updateRenderData = function(t) {
if (t._type === a.Type.IMAGE_STENCIL) t.spriteFrame ? l.prototype.updateRenderData.call(this, t) : t.setMaterial(0, null); else {
t._graphics.setMaterial(0, t._materials[0]);
u.prototype.updateRenderData.call(t._graphics._assembler, t._graphics, t._graphics);
}
};
i.fillBuffers = function(t, e) {
if (t._type !== a.Type.IMAGE_STENCIL || t.spriteFrame) {
v(t);
b(t, e);
C(t, e);
x(e);
}
t.node._renderFlag |= c.FLAG_UPDATE_RENDER_DATA;
};
i.postFillBuffers = function(t, e) {
(t._type !== a.Type.IMAGE_STENCIL || t.spriteFrame) && g(t, e);
t.node._renderFlag |= c.FLAG_UPDATE_RENDER_DATA;
};
return e;
})(l);
i.MaskAssembler = A;
r.default.register(a, A);
}), {
"../../../../renderer/gfx": 363,
"../../../components/CCMask": 155,
"../../assembler": 268,
"../../render-flow": 272,
"../vertex-format": 311,
"./graphics": 282,
"./sprite/2d/simple": 297
} ],
293: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../assembler-2d")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../components/CCMotionStreak"), c = t("../../render-flow");
function l(t, e) {
this.point = t || cc.v2();
this.dir = e || cc.v2();
this.distance = 0;
this.time = 0;
}
l.prototype.setPoint = function(t, e) {
this.point.x = t;
this.point.y = e;
};
l.prototype.setDir = function(t, e) {
this.dir.x = t;
this.dir.y = e;
};
cc.v2(), cc.v2();
var u = cc.v2(), h = cc.v2();
function _(t, e) {
t.x = -e.y;
t.y = e.x;
return t;
}
var f = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
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], o = r[13], a = t._points;
if (a.length > 1) {
var c = a[0].point.x - s, f = a[0].point.y - o;
c * c + f * f < t.minSeg && (i = a[0]);
}
if (!i) {
i = new l();
a.splice(0, 0, i);
}
i.setPoint(s, o);
i.time = t._fadeTime + e;
var d, p = 0;
if (!(a.length < 2)) {
var m = t._color, y = m.r, v = m.g, g = m.b, b = m.a, C = a[1];
C.distance = i.point.sub(C.point, h).mag();
h.normalizeSelf();
C.setDir(h.x, h.y);
i.setDir(h.x, h.y);
var x = this._renderData._flexBuffer;
x.reserve(2 * a.length, 6 * (a.length - 1));
for (var A = x.vData, S = x.uintVData, T = t._fadeTime, w = !1, E = a.length - 1; E >= 0; E--) {
var M = a[E], B = M.point, I = M.dir;
M.time -= e;
if (M.time < 0) a.splice(E, 1); else {
var D = M.time / T, P = a[E - 1];
if (!w) {
if (!P) {
a.splice(E, 1);
continue;
}
B.x = P.point.x - I.x * D;
B.y = P.point.y - I.y * D;
}
w = !0;
_(u, I);
var R = (D * b << 24 >>> 0) + (g << 16) + (v << 8) + y, L = 5 * p;
A[L] = B.x + u.x * n;
A[L + 1] = B.y + u.y * n;
A[L + 2] = 1;
A[L + 3] = D;
S[L + 4] = R;
A[L += 5] = B.x - u.x * n;
A[L + 1] = B.y - u.y * n;
A[L + 2] = 0;
A[L + 3] = D;
S[L + 4] = R;
p += 2;
}
}
d = p <= 2 ? 0 : 3 * (p - 2);
x.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, a = e._meshBuffer, l = a.request(r, s), u = l.byteOffset >> 2, h = a._vData;
n.length + u > h.length ? h.set(n.subarray(0, o), u) : h.set(n, u);
for (var _ = a._iData, f = l.indiceOffset, d = l.vertexOffset, p = 0, m = r; p < m; p += 2) {
var y = d + p;
_[f++] = y;
_[f++] = y + 2;
_[f++] = y + 1;
_[f++] = y + 1;
_[f++] = y + 2;
_[f++] = y + 3;
}
t.node._renderFlag |= c.FLAG_UPDATE_RENDER_DATA;
};
return e;
})(r.default);
i.default = f;
f.register(a, f);
e.exports = i.default;
}), {
"../../../components/CCMotionStreak": 156,
"../../assembler-2d": 265,
"../../render-flow": 272
} ],
294: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../assembler-2d")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../../../components/CCSprite").FillType, c = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.updateRenderData = function(t) {
var e = t._spriteFrame;
this.packToDynamicAtlas(t, e);
if (t._vertsDirty) {
var i = t._fillStart, n = t._fillRange;
if (n < 0) {
i += n;
n = -n;
}
n = (n = (n = i + n) > 1 ? 1 : n) < 0 ? 0 : n;
var r = (i = (i = i > 1 ? 1 : i) < 0 ? 0 : 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, s, o, c, l, u, h, _, f, d = t._spriteFrame, p = d._texture.width, m = d._texture.height, y = d._rect;
if (d._rotated) {
n = y.x / p;
r = (y.y + y.width) / m;
s = c = n;
u = _ = (y.x + y.height) / p;
l = f = r;
o = h = y.y / m;
} else {
n = y.x / p;
r = (y.y + y.height) / m;
s = u = n;
c = _ = (y.x + y.width) / p;
o = l = r;
h = f = y.y / m;
}
var v = this._renderData.vDatas[0], g = this.uvOffset, b = this.floatsPerVert;
switch (t._fillType) {
case a.HORIZONTAL:
v[g] = s + (c - s) * e;
v[g + 1] = o + (l - o) * e;
v[g + b] = s + (c - s) * i;
v[g + b + 1] = o + (l - o) * i;
v[g + 2 * b] = u + (_ - u) * e;
v[g + 2 * b + 1] = h + (f - h) * e;
v[g + 3 * b] = u + (_ - u) * i;
v[g + 3 * b + 1] = h + (f - h) * i;
break;

case a.VERTICAL:
v[g] = s + (u - s) * e;
v[g + 1] = o + (h - o) * e;
v[g + b] = c + (_ - c) * e;
v[g + b + 1] = l + (f - l) * e;
v[g + 2 * b] = s + (u - s) * i;
v[g + 2 * b + 1] = o + (h - o) * i;
v[g + 3 * b] = c + (_ - c) * i;
v[g + 3 * b + 1] = l + (f - l) * i;
break;

default:
cc.errorID(2626);
}
};
i.updateVerts = function(t, e, i) {
var n, r = t.node, s = r.width, o = r.height, c = r.anchorX * s, l = r.anchorY * o, u = -c, h = -l, _ = s - c, f = o - l;
switch (t._fillType) {
case a.HORIZONTAL:
n = u + (_ - u) * i;
u += (_ - u) * e;
_ = n;
break;

case a.VERTICAL:
n = h + (f - h) * i;
h += (f - h) * e;
f = n;
break;

default:
cc.errorID(2626);
}
var d = this._local;
d[0] = u;
d[1] = h;
d[2] = _;
d[3] = f;
this.updateWorldVerts(t);
};
return e;
})(r.default);
i.default = c;
e.exports = i.default;
}), {
"../../../../../components/CCSprite": 166,
"../../../../assembler-2d": 265
} ],
295: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n;
function r(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
s(t, e);
}
function s(t, e) {
return (s = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var o = (function(t) {
r(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.initData = function() {
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;
if (n.reserve(this.verticesCount, this.indicesCount)) {
this.updateColor(t);
t._vertsDirty = !0;
}
n.used(this.verticesCount, this.indicesCount);
this.updateIndices(i.triangles);
if (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, o = this._renderData.vDatas[0], a = 0; a < i.length; a++) {
var c = s * a + r;
o[c] = i[a];
o[c + 1] = n[a];
}
};
i.updateVerts = function(t) {
var e = t.node, i = Math.abs(e.width), n = Math.abs(e.height), r = e.anchorX * i, s = e.anchorY * n, o = t.spriteFrame, a = o.vertices, c = a.x, l = a.y, u = o._originalSize.width, h = o._originalSize.height, _ = o._rect.width, f = o._rect.height, d = o._offset.x + (u - _) / 2, p = o._offset.y + (h - f) / 2, m = i / (t.trim ? _ : u), y = n / (t.trim ? f : h), v = this._local;
if (t.trim) for (var g = 0, b = c.length; g < b; g++) {
var C = 2 * g;
v[C] = (c[g] - d) * m - r;
v[C + 1] = (h - l[g] - p) * y - s;
} else for (var x = 0, A = c.length; x < A; x++) {
var S = 2 * x;
v[S] = c[x] * m - r;
v[S + 1] = (h - l[x]) * y - s;
}
if (o._flipX) for (var T = 0, w = this.verticesCount; T < w; T++) v[2 * T] = i - v[2 * T] - 2 * r;
if (o._flipY) for (var E = 0, M = this.verticesCount; E < M; E++) v[2 * E + 1] = n - v[2 * E + 1] - 2 * s;
};
i.updateWorldVerts = function(t) {
for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], c = this._local, l = this._renderData.vDatas[0], u = this.floatsPerVert, h = 0, _ = this.verticesCount; h < _; h++) {
var f = c[2 * h], d = c[2 * h + 1];
l[u * h] = f * i + d * r + o;
l[u * h + 1] = f * n + d * s + a;
}
};
return e;
})(((n = t("../../../../assembler-2d")) && n.__esModule ? n : {
default: n
}).default);
i.default = o;
e.exports = i.default;
}), {
"../../../../assembler-2d": 265
} ],
296: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../assembler-2d")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = 2 * Math.PI, c = [ cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0) ], l = [ 0, 0, 0, 0 ], u = [ 0, 0, 0, 0, 0, 0, 0, 0 ], h = [ cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0) ], _ = [ cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0) ], f = cc.v2(0, 0), d = [];
function p(t, e, i, n, r, s, o) {
var a, c, l = Math.sin(s), u = Math.cos(s);
if (0 !== Math.cos(s)) {
a = l / u;
if ((t - r.x) * u > 0) {
var h = r.y + a * (t - r.x);
o[0].x = t;
o[0].y = h;
}
if ((e - r.x) * u > 0) {
var _ = r.y + a * (e - r.x);
o[2].x = e;
o[2].y = _;
}
}
if (0 !== Math.sin(s)) {
c = u / l;
if ((n - r.y) * l > 0) {
var f = r.x + c * (n - r.y);
o[3].x = f;
o[3].y = n;
}
if ((i - r.y) * l > 0) {
var d = r.x + c * (i - r.y);
o[1].x = d;
o[1].y = i;
}
}
}
function m(t) {
var e = t.node, i = e.width, n = e.height, r = e.anchorX * i, s = e.anchorY * n, o = -r, a = -s, u = i - r, h = n - s, _ = l;
_[0] = o;
_[1] = a;
_[2] = u;
_[3] = h;
var p = t._fillCenter, m = f.x = Math.min(Math.max(0, p.x), 1) * (u - o) + o, y = f.y = Math.min(Math.max(0, p.y), 1) * (h - a) + a;
c[0].x = c[3].x = o;
c[1].x = c[2].x = u;
c[0].y = c[1].y = a;
c[2].y = c[3].y = h;
d.length = 0;
m !== _[0] && (d[0] = [ 3, 0 ]);
m !== _[2] && (d[2] = [ 1, 2 ]);
y !== _[1] && (d[1] = [ 0, 1 ]);
y !== _[3] && (d[3] = [ 2, 3 ]);
}
function y(t) {
var e, i, n, r, s = t._texture.width, o = t._texture.height, a = t._rect, c = u;
if (t._rotated) {
e = a.x / s;
i = (a.x + a.height) / s;
n = a.y / o;
r = (a.y + a.width) / o;
c[0] = c[2] = e;
c[4] = c[6] = i;
c[3] = c[7] = r;
c[1] = c[5] = n;
} else {
e = a.x / s;
i = (a.x + a.width) / s;
n = a.y / o;
r = (a.y + a.height) / o;
c[0] = c[4] = e;
c[2] = c[6] = i;
c[1] = c[3] = r;
c[5] = c[7] = n;
}
}
function v(t, e) {
var i, n;
i = e.x - t.x;
n = e.y - t.y;
if (0 !== i || 0 !== n) {
if (0 === i) return n > 0 ? .5 * Math.PI : 1.5 * Math.PI;
var r = Math.atan(n / i);
i < 0 && (r += Math.PI);
return r;
}
}
var g = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.initData = function() {
this._renderData.createFlexData(0, 4, 6, this.getVfmt());
this.updateIndices();
};
i.updateRenderData = function(e) {
t.prototype.updateRenderData.call(this, e);
var i = e.spriteFrame;
this.packToDynamicAtlas(e, i);
if (e._vertsDirty) {
var n = e._fillStart, r = e._fillRange;
if (r < 0) {
n += r;
r = -r;
}
for (;n >= 1; ) n -= 1;
for (;n < 0; ) n += 1;
n *= a;
r *= a;
m(e);
y(i);
p(l[0], l[2], l[1], l[3], f, n, h);
p(l[0], l[2], l[1], l[3], f, n + r, _);
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 s = 0, o = 3 * this.floatsPerVert, l = 0; l < 4; ++l) {
var u = d[l];
if (u) if (i >= a) {
r.length = s + o;
this._generateTriangle(r, s, f, c[u[0]], c[u[1]]);
s += o;
} else {
var p = v(f, c[u[0]]), m = v(f, c[u[1]]);
m < p && (m += a);
p -= a;
m -= a;
for (var y = 0; y < 3; ++y) {
if (p >= n) ; else if (p >= e) {
r.length = s + o;
m >= n ? this._generateTriangle(r, s, f, c[u[0]], _[l]) : this._generateTriangle(r, s, f, c[u[0]], c[u[1]]);
s += o;
} else if (m <= e) ; else if (m <= n) {
r.length = s + o;
this._generateTriangle(r, s, f, h[l], c[u[1]]);
s += o;
} else {
r.length = s + o;
this._generateTriangle(r, s, f, h[l], _[l]);
s += o;
}
p += a;
m += a;
}
}
}
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 o = i._flexBuffer;
o.reserve(s, s) && this.updateIndices();
o.used(this.verticesCount, this.indicesCount);
for (var a = i.vDatas[0], c = i.uintVDatas[0], l = this.uvOffset, u = 0; u < r.length; u += n) {
var h = u + l;
a[h] = r[h];
a[h + 1] = r[h + 1];
c[h + 2] = e;
}
};
i.updateIndices = function() {
for (var t = this._renderData.iDatas[0], e = 0; e < t.length; e++) t[e] = e;
};
i.updateWorldVerts = function(t) {
for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], c = this._local, l = this._renderData.vDatas[0], u = this.floatsPerVert, h = 0; h < c.length; h += u) {
var _ = c[h], f = c[h + 1];
l[h] = _ * i + f * r + o;
l[h + 1] = _ * n + f * s + a;
}
};
i._generateTriangle = function(t, e, i, n, r) {
var s = l, o = s[0], a = s[1], c = s[2], u = s[3], h = this.floatsPerVert;
t[e] = i.x;
t[e + 1] = i.y;
t[e + h] = n.x;
t[e + h + 1] = n.y;
t[e + 2 * h] = r.x;
t[e + 2 * h + 1] = r.y;
var _, f, d = this.uvOffset;
_ = (i.x - o) / (c - o);
f = (i.y - a) / (u - a);
this._generateUV(_, f, t, e + d);
_ = (n.x - o) / (c - o);
f = (n.y - a) / (u - a);
this._generateUV(_, f, t, e + h + d);
_ = (r.x - o) / (c - o);
f = (r.y - a) / (u - a);
this._generateUV(_, f, t, e + 2 * h + d);
};
i._generateUV = function(t, e, i, n) {
var r = u, s = r[0] + (r[2] - r[0]) * t, o = r[4] + (r[6] - r[4]) * t, a = r[1] + (r[3] - r[1]) * t, c = r[5] + (r[7] - r[5]) * t;
i[n] = s + (o - s) * e;
i[n + 1] = a + (c - a) * e;
};
return e;
})(r.default);
i.default = g;
e.exports = i.default;
}), {
"../../../../assembler-2d": 265
} ],
297: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n;
function r(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
s(t, e);
}
function s(t, e) {
return (s = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var o = (function(t) {
r(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.updateRenderData = function(t) {
this.packToDynamicAtlas(t, t._spriteFrame);
if (t._vertsDirty) {
this.updateUVs(t);
this.updateVerts(t);
t._vertsDirty = !1;
}
};
i.updateUVs = function(t) {
for (var e = t._spriteFrame.uv, i = this.uvOffset, n = this.floatsPerVert, r = this._renderData.vDatas[0], s = 0; s < 4; s++) {
var o = 2 * s, a = n * s + i;
r[a] = e[o];
r[a + 1] = e[o + 1];
}
};
i.updateVerts = function(t) {
var e, i, n, r, s = t.node, o = s.width, a = s.height, c = s.anchorX * o, l = s.anchorY * a;
if (t.trim) {
e = -c;
i = -l;
n = o - c;
r = a - l;
} else {
var u = t.spriteFrame, h = u._originalSize.width, _ = u._originalSize.height, f = u._rect.width, d = u._rect.height, p = u._offset, m = o / h, y = a / _, v = p.x + (h - f) / 2, g = p.x - (h - f) / 2;
e = v * m - c;
i = (p.y + (_ - d) / 2) * y - l;
n = o + g * m - c;
r = a + (p.y - (_ - d) / 2) * y - l;
}
var b = this._local;
b[0] = e;
b[1] = i;
b[2] = n;
b[3] = r;
this.updateWorldVerts(t);
};
return e;
})(((n = t("../../../../assembler-2d")) && n.__esModule ? n : {
default: n
}).default);
i.default = o;
e.exports = i.default;
}), {
"../../../../assembler-2d": 265
} ],
298: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n;
function r(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
s(t, e);
}
function s(t, e) {
return (s = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var o = (function(t) {
r(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.initData = function() {
if (!(this._renderData.meshCount > 0)) {
this._renderData.createData(0, this.verticesFloats, this.indicesCount);
for (var t = this._renderData.iDatas[0], e = 0, i = 0; i < 3; ++i) for (var n = 0; n < 3; ++n) {
var r = 4 * i + n;
t[e++] = r;
t[e++] = r + 1;
t[e++] = r + 4;
t[e++] = r + 1;
t[e++] = r + 5;
t[e++] = r + 4;
}
}
};
i.initLocal = function() {
this._local = [];
this._local.length = 8;
};
i.updateRenderData = function(t) {
var e = t._spriteFrame;
this.packToDynamicAtlas(t, e);
if (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, o = t.spriteFrame, a = o.insetLeft, c = o.insetRight, l = o.insetTop, u = o.insetBottom, h = i - a - c, _ = n - l - u, f = i / (a + c), d = n / (l + u);
f = isNaN(f) || f > 1 ? 1 : f;
d = isNaN(d) || d > 1 ? 1 : d;
h = h < 0 ? 0 : h;
_ = _ < 0 ? 0 : _;
var p = this._local;
p[0] = -r;
p[1] = -s;
p[2] = a * f - r;
p[3] = u * d - s;
p[4] = p[2] + h;
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 o = 0; o < 4; ++o) {
var a = 4 * s + o, c = i[a], l = a * r;
e[l + n] = c.u;
e[l + n + 1] = c.v;
}
};
i.updateWorldVerts = function(t) {
for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], c = this._local, l = this._renderData.vDatas[0], u = this.floatsPerVert, h = 0; h < 4; ++h) for (var _ = c[2 * h + 1], f = 0; f < 4; ++f) {
var d = c[2 * f], p = (4 * h + f) * u;
l[p] = d * i + _ * r + o;
l[p + 1] = d * n + _ * s + a;
}
};
return e;
})(((n = t("../../../../assembler-2d")) && n.__esModule ? n : {
default: n
}).default);
i.default = o;
Object.assign(o.prototype, {
verticesCount: 16,
indicesCount: 54
});
e.exports = i.default;
}), {
"../../../../assembler-2d": 265
} ],
299: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n;
function r(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
s(t, e);
}
function s(t, e) {
return (s = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var o = (function(t) {
r(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.initData = function() {
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; e < n; e += 6, 
i += 4) {
t[e] = i;
t[e + 1] = i + 1;
t[e + 2] = i + 2;
t[e + 3] = i + 1;
t[e + 4] = i + 3;
t[e + 5] = i + 2;
}
};
i.updateRenderData = function(t) {
var e = t._spriteFrame;
this.packToDynamicAtlas(t, e);
var i = t.node, n = this.contentWidth = Math.abs(i.width), r = this.contentHeight = Math.abs(i.height), s = e._rect, o = e.insetLeft, a = e.insetRight, c = s.width - o - a, l = e.insetTop, u = e.insetBottom, h = s.height - l - u;
this.sizableWidth = n - o - a;
this.sizableHeight = r - l - u;
this.sizableWidth = this.sizableWidth > 0 ? this.sizableWidth : 0;
this.sizableHeight = this.sizableHeight > 0 ? this.sizableHeight : 0;
var _ = this.hRepeat = 0 === c ? this.sizableWidth : this.sizableWidth / c, f = this.vRepeat = 0 === h ? this.sizableHeight : this.sizableHeight / h, 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;
if (p.reserve(this.verticesCount, this.indicesCount)) {
this._updateIndices();
this.updateColor(t);
}
p.used(this.verticesCount, this.indicesCount);
if (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, o = this.row, a = this.col, c = this.contentWidth, l = this.contentHeight, u = this._local, h = u.x, _ = u.y;
h.length = _.length = 0;
var f, d, p = e.insetLeft, m = e.insetRight, y = i.width - p - m, v = e.insetTop, g = e.insetBottom, b = i.height - v - g, C = n.width / (p + m) > 1 ? 1 : n.width / (p + m), x = n.height / (v + g) > 1 ? 1 : n.height / (v + g);
f = y > 0 ? Math.floor(1e3 * this.sizableWidth) / 1e3 % y == 0 ? y : this.sizableWidth % y : this.sizableWidth;
d = b > 0 ? Math.floor(1e3 * this.sizableHeight) / 1e3 % b == 0 ? b : this.sizableHeight % b : this.sizableHeight;
for (var A = 0; A <= a; A++) 0 === A ? h[A] = -r : A > 0 && A < a ? h[A] = 1 === A ? p * C + Math.min(y, this.sizableWidth) - r : y > 0 ? A === a - 1 ? p + f + y * (A - 2) - r : p + Math.min(y, this.sizableWidth) + y * (A - 2) - r : p + this.sizableWidth - r : A === a && (h[A] = Math.min(p + this.sizableWidth + m, c) - r);
for (var S = 0; S <= o; S++) 0 === S ? _[S] = -s : S > 0 && S < o ? _[S] = 1 === S ? g * x + Math.min(b, this.sizableHeight) - s : b > 0 ? S === o - 1 ? g + d + (S - 2) * b - s : g + Math.min(b, this.sizableHeight) + (S - 2) * b - s : g + this.sizableHeight - s : S === o && (_[S] = Math.min(g + this.sizableHeight + v, l) - s);
this.updateWorldVerts(t);
};
i.updateWorldVerts = function(t) {
for (var e, i, n, r, s = this._renderData, o = this._local, a = o.x, c = o.y, l = s.vDatas[0], u = this.row, h = this.col, _ = t.node._worldMatrix.m, f = _[0], d = _[1], p = _[4], m = _[5], y = _[12], v = _[13], g = this.floatsPerVert, b = 0, C = 0, x = u; C < x; ++C) {
n = c[C];
r = c[C + 1];
for (var A = 0, S = h; A < S; ++A) {
e = a[A];
i = a[A + 1];
l[b] = e * f + n * p + y;
l[b + 1] = e * d + n * m + v;
l[b += g] = i * f + n * p + y;
l[b + 1] = i * d + n * m + v;
l[b += g] = e * f + r * p + y;
l[b + 1] = e * d + r * m + v;
l[b += g] = i * f + r * p + y;
l[b + 1] = i * d + r * m + v;
b += g;
}
}
};
i.updateUVs = function(t) {
var e = this._renderData.vDatas[0];
if (e) for (var i = t._spriteFrame, n = i._rect, r = i.insetLeft, s = i.insetRight, o = n.width - r - s, a = i.insetTop, c = i.insetBottom, l = n.height - a - c, u = this.row, h = this.col, _ = this.hRepeat, f = this.vRepeat, d = 0, p = 0, m = t.spriteFrame.uv, y = t.spriteFrame.uvSliced, v = t.spriteFrame._rotated, g = this.floatsPerVert, b = this.uvOffset, C = [], x = [], A = 0, S = u; A < S; ++A) {
p = this.sizableHeight > l ? this.sizableHeight >= A * l ? 1 : f % 1 : f;
for (var T = 0, w = h; T < w; ++T) {
d = this.sizableWidth > o ? this.sizableWidth >= T * o ? 1 : _ % 1 : _;
if (v) {
if (0 === A) {
C[0] = y[0].u;
C[1] = y[0].u;
C[2] = y[4].u + (y[8].u - y[4].u) * p;
} else if (A < u - 1) {
C[0] = y[4].u;
C[1] = y[4].u;
C[2] = y[4].u + (y[8].u - y[4].u) * p;
} else if (A === u - 1) {
C[0] = y[8].u;
C[1] = y[8].u;
C[2] = y[12].u;
}
if (0 === T) {
x[0] = y[0].v;
x[1] = y[1].v + (y[2].v - y[1].v) * d;
x[2] = y[0].v;
} else if (T < h - 1) {
x[0] = y[1].v;
x[1] = y[1].v + (y[2].v - y[1].v) * d;
x[2] = y[1].v;
} else if (T === h - 1) {
x[0] = y[2].v;
x[1] = y[3].v;
x[2] = y[2].v;
}
C[3] = C[2];
x[3] = x[1];
} else {
if (0 === T) {
C[0] = y[0].u;
C[1] = y[1].u + (y[2].u - y[1].u) * d;
C[2] = m[0];
} else if (T < h - 1) {
C[0] = y[1].u;
C[1] = y[1].u + (y[2].u - y[1].u) * d;
C[2] = y[1].u;
} else if (T === h - 1) {
C[0] = y[2].u;
C[1] = y[3].u;
C[2] = y[2].u;
}
if (0 === A) {
x[0] = y[0].v;
x[1] = y[0].v;
x[2] = y[4].v + (y[8].v - y[4].v) * p;
} else if (A < u - 1) {
x[0] = y[4].v;
x[1] = y[4].v;
x[2] = y[4].v + (y[8].v - y[4].v) * p;
} else if (A === u - 1) {
x[0] = y[8].v;
x[1] = y[8].v;
x[2] = y[12].v;
}
C[3] = C[1];
x[3] = x[2];
}
e[b] = C[0];
e[b + 1] = x[0];
e[b += g] = C[1];
e[b + 1] = x[1];
e[b += g] = C[2];
e[b + 1] = x[2];
e[b += g] = C[3];
e[b + 1] = x[3];
b += g;
}
}
};
return e;
})(((n = t("../../../../assembler-2d")) && n.__esModule ? n : {
default: n
}).default);
i.default = o;
e.exports = i.default;
}), {
"../../../../assembler-2d": 265
} ],
300: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
function n(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
r(t, e);
}
function r(t, e) {
return (r = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var s = t("../../../../assembler-3d"), o = (function(t) {
n(e, t);
function e() {
return t.apply(this, arguments) || this;
}
return e;
})(t("../2d/bar-filled"));
i.default = o;
cc.js.mixin(o.prototype, s);
e.exports = i.default;
}), {
"../../../../assembler-3d": 266,
"../2d/bar-filled": 294
} ],
301: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../../value-types/vec3")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../../assembler-3d"), c = t("../2d/mesh"), l = new r.default(), u = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
return e;
})(c);
i.default = u;
cc.js.mixin(u.prototype, a, {
updateWorldVerts: function(t) {
for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], s = this.floatsPerVert, o = 0, a = i.length / 2; o < a; o++) {
r.default.set(l, i[2 * o], i[2 * o + 1], 0);
r.default.transformMat4(l, l, e);
var c = s * o;
n[c] = l.x;
n[c + 1] = l.y;
n[c + 2] = l.z;
}
}
});
e.exports = i.default;
}), {
"../../../../../value-types/vec3": 347,
"../../../../assembler-3d": 266,
"../2d/mesh": 295
} ],
302: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../../value-types/vec3")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../../assembler-3d"), c = t("../2d/radial-filled"), l = new r.default(), u = new r.default(), h = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
return e;
})(c);
i.default = h;
cc.js.mixin(h.prototype, a, {
updateWorldVerts: function(t) {
for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], s = this.floatsPerVert, o = 0; o < n.length; o += s) {
r.default.set(l, i[o], i[o + 1], 0);
r.default.transformMat4(u, l, e);
n[o] = u.x;
n[o + 1] = u.y;
n[o + 2] = u.z;
}
}
});
e.exports = i.default;
}), {
"../../../../../value-types/vec3": 347,
"../../../../assembler-3d": 266,
"../2d/radial-filled": 296
} ],
303: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
function n(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
r(t, e);
}
function r(t, e) {
return (r = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var s = t("../../../../assembler-3d"), o = (function(t) {
n(e, t);
function e() {
return t.apply(this, arguments) || this;
}
return e;
})(t("../2d/simple"));
i.default = o;
cc.js.mixin(o.prototype, s);
e.exports = i.default;
}), {
"../../../../assembler-3d": 266,
"../2d/simple": 297
} ],
304: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../../value-types/vec3")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("../../../../assembler-3d"), c = t("../2d/sliced"), l = new r.default(), u = new r.default(), h = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
return e;
})(c);
i.default = h;
cc.js.mixin(h.prototype, a, {
updateWorldVerts: function(t) {
for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], s = this.floatsPerVert, o = 0; o < 4; ++o) for (var a = i[2 * o + 1], c = 0; c < 4; ++c) {
var h = i[2 * c];
r.default.set(l, h, a, 0);
r.default.transformMat4(u, l, e);
var _ = (4 * o + c) * s;
n[_] = u.x;
n[_ + 1] = u.y;
n[_ + 2] = u.z;
}
}
});
e.exports = i.default;
}), {
"../../../../../value-types/vec3": 347,
"../../../../assembler-3d": 266,
"../2d/sliced": 298
} ],
305: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../../../../value-types/vec3")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
for (var a = t("../../../../assembler-3d"), c = t("../2d/tiled"), l = [], u = 0; u < 4; u++) l.push(new r.default());
var h = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
return e;
})(c);
i.default = h;
cc.js.mixin(h.prototype, a, {
updateWorldVerts: function(t) {
for (var e, i, n, s, o = this._local, a = o.x, c = o.y, u = this._renderData.vDatas[0], h = this.row, _ = this.col, f = t.node._worldMatrix, d = 0, p = 0, m = h; p < m; ++p) {
n = c[p];
s = c[p + 1];
for (var y = 0, v = _; y < v; ++y) {
e = a[y];
i = a[y + 1];
r.default.set(l[0], e, n, 0);
r.default.set(l[1], i, n, 0);
r.default.set(l[2], e, s, 0);
r.default.set(l[3], i, s, 0);
for (var g = 0; g < 4; g++) {
var b = l[g];
r.default.transformMat4(b, b, f);
var C = 6 * g;
u[d + C] = b.x;
u[d + C + 1] = b.y;
u[d + C + 2] = b.z;
}
d += 24;
}
}
}
});
e.exports = i.default;
}), {
"../../../../../value-types/vec3": 347,
"../../../../assembler-3d": 266,
"../2d/tiled": 299
} ],
306: [ (function(t) {
"use strict";
var e = p(t("../../../assembler")), i = t("../../../../components/CCSprite"), n = p(t("./2d/simple")), r = p(t("./2d/sliced")), s = p(t("./2d/tiled")), o = p(t("./2d/radial-filled")), a = p(t("./2d/bar-filled")), c = p(t("./2d/mesh")), l = p(t("./3d/simple")), u = p(t("./3d/sliced")), h = p(t("./3d/tiled")), _ = p(t("./3d/radial-filled")), f = p(t("./3d/bar-filled")), d = p(t("./3d/mesh"));
function p(t) {
return t && t.__esModule ? t : {
default: t
};
}
var m = {
getConstructor: function(t) {
var e = t.node.is3DNode, p = e ? l.default : n.default;
switch (t.type) {
case i.Type.SLICED:
p = e ? u.default : r.default;
break;

case i.Type.TILED:
p = e ? h.default : s.default;
break;

case i.Type.FILLED:
p = t._fillType === i.FillType.RADIAL ? e ? _.default : o.default : e ? f.default : a.default;
break;

case i.Type.MESH:
p = e ? d.default : c.default;
}
return p;
},
Simple: n.default,
Sliced: r.default,
Tiled: s.default,
RadialFilled: o.default,
BarFilled: a.default,
Mesh: c.default,
Simple3D: l.default,
Sliced3D: u.default,
Tiled3D: h.default,
RadialFilled3D: _.default,
BarFilled3D: f.default,
Mesh3D: d.default
};
e.default.register(cc.Sprite, m);
}), {
"../../../../components/CCSprite": 166,
"../../../assembler": 268,
"./2d/bar-filled": 294,
"./2d/mesh": 295,
"./2d/radial-filled": 296,
"./2d/simple": 297,
"./2d/sliced": 298,
"./2d/tiled": 299,
"./3d/bar-filled": 300,
"./3d/mesh": 301,
"./3d/radial-filled": 302,
"./3d/simple": 303,
"./3d/sliced": 304,
"./3d/tiled": 305
} ],
307: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = (function() {
function t(t, e, i, n, r) {
this._handler = t;
this._index = e;
this._vfmt = r;
this._verticesBytes = r._bytes;
this._initVerticesCount = i;
this._initIndicesCount = n;
this.reset();
}
var e = t.prototype;
e._reallocVData = function(t, e) {
this.vData = new Float32Array(t);
this.uintVData = new Uint32Array(this.vData.buffer);
e && this.vData.set(e);
this._handler.updateMesh(this._index, this.vData, this.iData);
};
e._reallocIData = function(t, e) {
this.iData = new Uint16Array(t);
e && this.iData.set(e);
this._handler.updateMesh(this._index, this.vData, this.iData);
};
e.reserve = function(t, e) {
var i = t * this._verticesBytes >> 2, n = this.vData.length, r = !1;
if (i > n) {
for (;n < i; ) n *= 2;
this._reallocVData(n, this.vData);
r = !0;
}
var s = this.iData.length;
if (e > s) {
for (;s < e; ) s *= 2;
this._reallocIData(e, this.iData);
r = !0;
}
return r;
};
e.used = function(t, e) {
this.usedVertices = t;
this.usedIndices = e;
this.usedVerticesFloats = t * this._verticesBytes >> 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;
};
return t;
})();
i.default = n;
cc.FlexBuffer = n;
e.exports = i.default;
}), {} ],
308: [ (function(t, e) {
"use strict";
var i, n = (i = t("../../../renderer/gfx")) && i.__esModule ? i : {
default: i
}, r = (cc.sys.os === cc.sys.OS_IOS || cc.sys.os === cc.sys.OS_OSX) && cc.sys.isBrowser && /(OS 1[4-9])|(Version\/1[4-9])/.test(window.navigator.userAgent), s = 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;
if (t < this._vbArr.length) {
this._vb = this._vbArr[t];
this._ib = this._ibArr[t];
} else {
this._vb = new n.default.VertexBuffer(this._batcher._device, this._vertexFormat, n.default.USAGE_DYNAMIC, new ArrayBuffer(), 0);
this._vbArr[t] = this._vb;
this._ib = new n.default.IndexBuffer(this._batcher._device, n.default.INDEX_FMT_UINT16, n.default.USAGE_STATIC, new ArrayBuffer(), 0);
this._ibArr[t] = this._ib;
}
},
checkAndSwitchBuffer: function(t) {
if (this.vertexOffset + t > 65535) {
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 < i || s < n; ) {
this._initVDataCount *= 2;
this._initIDataCount *= 2;
r = 4 * this._initVDataCount;
s = this._initIDataCount;
}
this._reallocBuffer();
}
this._updateOffset(t, e, i);
},
_updateOffset: function(t, e, i) {
var n = this._offsetInfo;
n.vertexOffset = this.vertexOffset;
this.vertexOffset += t;
n.indiceOffset = this.indiceOffset;
this.indiceOffset += e;
n.byteOffset = this.byteOffset;
this.byteOffset = i;
this._dirty = !0;
},
request: function(t, e) {
if (this._batcher._buffer !== this) {
this._batcher._flush();
this._batcher._buffer = this;
}
this.requestStatic(t, e);
return this._offsetInfo;
},
_reallocBuffer: function() {
this._reallocVData(!0);
this._reallocIData(!0);
},
_reallocVData: function(t) {
var e;
this._vData && (e = new Uint8Array(this._vData.buffer));
this._vData = new Float32Array(this._initVDataCount);
this._uintVData = new Uint32Array(this._vData.buffer);
var i = new Uint8Array(this._uintVData.buffer);
if (e && t) for (var n = 0, r = e.length; n < r; n++) i[n] = e[n];
},
_reallocIData: function(t) {
var e = this._iData;
this._iData = new Uint16Array(this._initIDataCount);
if (e && t) for (var i = this._iData, n = 0, r = e.length; n < r; n++) i[n] = e[n];
},
reset: function() {
this._arrOffset = 0;
this._vb = this._vbArr[0];
this._ib = this._ibArr[0];
this.byteOffset = 0;
this.indiceOffset = 0;
this.vertexOffset = 0;
this.indiceStart = 0;
this._dirty = !1;
},
destroy: function() {
this.reset();
for (var t = 0; t < this._vbArr.length; t++) this._vbArr[t].destroy();
this._vbArr = null;
for (var e = 0; e < this._ibArr.length; e++) this._ibArr[e].destroy();
this._ibArr = null;
this._ib = null;
this._vb = null;
},
forwardIndiceStartToOffset: function() {
this.indiceStart = this.indiceOffset;
}
});
if (r) {
s.prototype.checkAndSwitchBuffer = function(t) {
if (this.vertexOffset + t > 65535) {
this.uploadData();
this._batcher._flush();
}
};
s.prototype.forwardIndiceStartToOffset = function() {
this.uploadData();
this.switchBuffer();
};
}
cc.MeshBuffer = e.exports = s;
}), {
"../../../renderer/gfx": 363
} ],
309: [ (function(t, e) {
"use strict";
var i = t("./mesh-buffer"), n = cc.Class({
name: "cc.QuadBuffer",
extends: i,
_fillQuadBuffer: function() {
for (var t = this._initIDataCount / 6, e = this._iData, i = 0, n = 0; i < t; i++) {
var r = 4 * i;
e[n++] = r;
e[n++] = r + 1;
e[n++] = r + 2;
e[n++] = r + 1;
e[n++] = r + 3;
e[n++] = r + 2;
}
var s = new Uint16Array(this._iData.buffer, 0, 6 * t);
this._ib.update(0, s);
},
uploadData: function() {
if (0 !== this.byteOffset && this._dirty) {
var t = new Float32Array(this._vData.buffer, 0, this.byteOffset >> 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 = n;
}), {
"./mesh-buffer": 308
} ],
310: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = o;
var n, r = (n = t("./flex-buffer")) && n.__esModule ? n : {
default: n
}, s = t("./vertex-format");
function o() {
this.vDatas = [];
this.uintVDatas = [];
this.iDatas = [];
this.meshCount = 0;
this._infos = null;
this._flexBuffer = null;
}
cc.js.mixin(o.prototype, {
init: function() {},
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() {},
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, n) {
n = n || s.vfmtPosUvColor;
this._flexBuffer = new r.default(this, t, e, i, n);
},
initQuadIndices: function(t) {
for (var e = t.length / 6, i = 0, n = 0; i < e; i++) {
var r = 4 * i;
t[n++] = r;
t[n++] = r + 1;
t[n++] = r + 2;
t[n++] = r + 1;
t[n++] = r + 3;
t[n++] = r + 2;
}
}
});
cc.RenderData = o;
e.exports = i.default;
}), {
"./flex-buffer": 307,
"./vertex-format": 311
} ],
311: [ (function(t, e) {
"use strict";
var i, n = (i = t("../../../renderer/gfx")) && i.__esModule ? i : {
default: i
}, r = new n.default.VertexFormat([ {
name: n.default.ATTR_POSITION,
type: n.default.ATTR_TYPE_FLOAT32,
num: 3
}, {
name: n.default.ATTR_UV0,
type: n.default.ATTR_TYPE_FLOAT32,
num: 2
}, {
name: n.default.ATTR_COLOR,
type: n.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
} ]);
r.name = "vfmt3D";
n.default.VertexFormat.XYZ_UV_Color = r;
var s = new n.default.VertexFormat([ {
name: n.default.ATTR_POSITION,
type: n.default.ATTR_TYPE_FLOAT32,
num: 2
}, {
name: n.default.ATTR_UV0,
type: n.default.ATTR_TYPE_FLOAT32,
num: 2
}, {
name: n.default.ATTR_COLOR,
type: n.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
} ]);
s.name = "vfmtPosUvColor";
n.default.VertexFormat.XY_UV_Color = s;
var o = new n.default.VertexFormat([ {
name: n.default.ATTR_POSITION,
type: n.default.ATTR_TYPE_FLOAT32,
num: 2
}, {
name: n.default.ATTR_UV0,
type: n.default.ATTR_TYPE_FLOAT32,
num: 2
}, {
name: n.default.ATTR_COLOR,
type: n.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
}, {
name: n.default.ATTR_COLOR0,
type: n.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
} ]);
o.name = "vfmtPosUvTwoColor";
n.default.VertexFormat.XY_UV_Two_Color = o;
var a = new n.default.VertexFormat([ {
name: n.default.ATTR_POSITION,
type: n.default.ATTR_TYPE_FLOAT32,
num: 2
}, {
name: n.default.ATTR_UV0,
type: n.default.ATTR_TYPE_FLOAT32,
num: 2
} ]);
a.name = "vfmtPosUv";
n.default.VertexFormat.XY_UV = a;
var c = new n.default.VertexFormat([ {
name: n.default.ATTR_POSITION,
type: n.default.ATTR_TYPE_FLOAT32,
num: 2
}, {
name: n.default.ATTR_COLOR,
type: n.default.ATTR_TYPE_UINT8,
num: 4,
normalize: !0
} ]);
c.name = "vfmtPosColor";
n.default.VertexFormat.XY_Color = c;
var l = new n.default.VertexFormat([ {
name: n.default.ATTR_POSITION,
type: n.default.ATTR_TYPE_FLOAT32,
num: 2
} ]);
l.name = "vfmtPos";
n.default.VertexFormat.XY = l;
e.exports = {
vfmt3D: r,
vfmtPosUvColor: s,
vfmtPosUvTwoColor: o,
vfmtPosUv: a,
vfmtPosColor: c,
vfmtPos: l
};
}), {
"../../../renderer/gfx": 363
} ],
312: [ (function(t, e) {
"use strict";
t("../platform/CCSys");
var i = /(\.[^\.\/\?\\]*)(\?.*)?$/, n = /((.*)(\/|\\|\\\\))?(.*?\..*$)?/, r = /[^\.\/]+\/\.\.\//;
cc.path = {
join: function() {
for (var t = arguments.length, e = "", i = 0; i < t; i++) e = (e + ("" === e ? "" : "/") + arguments[i]).replace(/(\/|\\\\)$/, "");
return e;
},
extname: function(t) {
var e = i.exec(t);
return e ? e[1] : "";
},
mainFileName: function(t) {
if (t) {
var e = t.lastIndexOf(".");
if (-1 !== e) return t.substring(0, e);
}
return t;
},
basename: function(t, e) {
var i = t.indexOf("?");
i > 0 && (t = t.substring(0, i));
var n = /(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/, ""));
if (!n) return t;
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 = n.exec(t);
return e ? e[2] : "";
},
changeExtname: function(t, e) {
e = e || "";
var i = t.indexOf("?"), n = "";
if (i > 0) {
n = t.substring(i);
t = t.substring(0, i);
}
return (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) : "";
if (n > 0) {
r = t.substring(n);
t = t.substring(0, n);
}
n = (n = t.lastIndexOf("/")) <= 0 ? 0 : n + 1;
return t.substring(0, n) + e + s + r;
},
_normalize: function(t) {
var e = t = String(t);
do {
e = t;
t = t.replace(r, "");
} 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": 248
} ],
313: [ (function(t, e) {
"use strict";
var i = 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;
};
i.create = function(t, e, i, n, r, s) {
return {
a: t,
b: e,
c: i,
d: n,
tx: r,
ty: s
};
};
i.identity = function() {
return {
a: 1,
b: 0,
c: 0,
d: 1,
tx: 0,
ty: 0
};
};
i.clone = function(t) {
return {
a: t.a,
b: t.b,
c: t.c,
d: t.d,
tx: t.tx,
ty: t.ty
};
};
i.concat = function(t, e, i) {
var n = e.a, r = e.b, s = e.c, o = e.d, a = e.tx, c = e.ty;
t.a = n * i.a + r * i.c;
t.b = n * i.b + r * i.d;
t.c = s * i.a + o * i.c;
t.d = s * i.b + o * i.d;
t.tx = a * i.a + c * i.c + i.tx;
t.ty = a * i.b + c * i.d + i.ty;
return t;
};
i.invert = function(t, e) {
var i = e.a, n = e.b, r = e.c, s = e.d, o = 1 / (i * s - n * r), a = e.tx, c = e.ty;
t.a = o * s;
t.b = -o * n;
t.c = -o * r;
t.d = o * i;
t.tx = o * (r * c - s * a);
t.ty = o * (n * a - i * c);
return t;
};
i.fromMat4 = function(t, e) {
var i = e.m;
t.a = i[0];
t.b = i[1];
t.c = i[4];
t.d = i[5];
t.tx = i[12];
t.ty = i[13];
return t;
};
i.transformVec2 = function(t, e, i, n) {
var r, s;
if (void 0 === n) {
n = i;
r = e.x;
s = e.y;
} else {
r = e;
s = i;
}
t.x = n.a * r + n.c * s + n.tx;
t.y = n.b * r + n.d * s + n.ty;
return t;
};
i.transformSize = function(t, e, i) {
t.width = i.a * e.width + i.c * e.height;
t.height = i.b * e.width + i.d * e.height;
return t;
};
i.transformRect = function(t, e, i) {
var n = e.x, r = e.y, s = n + e.width, o = r + e.height, a = i.a * n + i.c * r + i.tx, c = i.b * n + i.d * r + i.ty, l = i.a * s + i.c * r + i.tx, u = i.b * s + i.d * r + i.ty, h = i.a * n + i.c * o + i.tx, _ = i.b * n + i.d * o + i.ty, f = i.a * s + i.c * o + i.tx, d = i.b * s + i.d * o + i.ty, p = Math.min(a, l, h, f), m = Math.max(a, l, h, f), y = Math.min(c, u, _, d), v = Math.max(c, u, _, d);
t.x = p;
t.y = y;
t.width = m - p;
t.height = v - y;
return t;
};
i.transformObb = function(t, e, i, n, r, s) {
var o = r.x, a = r.y, c = r.width, l = r.height, u = s.a * o + s.c * a + s.tx, h = s.b * o + s.d * a + s.ty, _ = s.a * c, f = s.b * c, d = s.c * l, p = s.d * l;
e.x = u;
e.y = h;
i.x = _ + u;
i.y = f + h;
t.x = d + u;
t.y = p + h;
n.x = _ + d + u;
n.y = f + p + h;
};
cc.AffineTransform = e.exports = i;
}), {} ],
314: [ (function(t, e) {
"use strict";
var i = t("../platform/CCObject").Flags, n = t("./misc"), r = t("../platform/js"), s = t("../platform/id-generater"), o = t("../event-manager"), a = t("../renderer/render-flow"), c = i.Destroying, l = i.DontDestroy, u = i.Deactivating, h = new s("Node");
function _(t) {
if (!t) {
cc.errorID(3804);
return null;
}
return "string" == typeof t ? r.getClassByName(t) : t;
}
function f(t, e) {
if (e._sealed) for (var i = 0; i < t._components.length; ++i) {
var n = t._components[i];
if (n.constructor === e) return n;
} else for (var r = 0; r < t._components.length; ++r) {
var s = t._components[r];
if (s instanceof e) return s;
}
return null;
}
function d(t, e, i) {
if (e._sealed) for (var n = 0; n < t._components.length; ++n) {
var r = t._components[n];
r.constructor === e && i.push(r);
} else for (var s = 0; s < t._components.length; ++s) {
var o = t._components[s];
o instanceof e && i.push(o);
}
}
function p(t, e) {
for (var i = 0; i < t.length; ++i) {
var n = t[i], r = f(n, e);
if (r) return r;
if (n._children.length > 0 && (r = p(n._children, e))) return r;
}
return null;
}
function m(t, e, i) {
for (var n = 0; n < t.length; ++n) {
var r = t[n];
d(r, e, i);
r._children.length > 0 && m(r._children, e, i);
}
}
var y = cc.Class({
name: "cc._BaseNode",
extends: cc.Object,
properties: {
_parent: null,
_children: [],
_active: !0,
_components: [],
_prefab: null,
_persistNode: {
get: function() {
return (this._objFlags & l) > 0;
},
set: function(t) {
t ? this._objFlags |= l : this._objFlags &= ~l;
}
},
name: {
get: function() {
return this._name;
},
set: function(t) {
this._name = t;
this._proxy.setName(this._name);
}
},
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) {
t = !!t;
if (this._active !== t) {
this._active = t;
var e = this._parent;
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 = h.getNewId();
cc.director._scheduler && cc.director._scheduler.enableForTarget(this);
this.__eventTargets = [];
},
getParent: function() {
return this._parent;
},
setParent: function(t) {
if (this._parent !== t) {
var e = this._parent;
this._parent = t || null;
this._onSetParent(t);
if (t) {
o._setDirtyForNode(this);
t._children.push(this);
t.emit && t.emit("child-added", this);
t._renderFlag |= a.FLAG_CHILDREN;
}
if (e) {
if (!(e._objFlags & c)) {
var i = e._children.indexOf(this);
e._children.splice(i, 1);
e.emit && e.emit("child-removed", this);
this._onHierarchyChanged(e);
0 === e._children.length && (e._renderFlag &= ~a.FLAG_CHILDREN);
}
} else t && this._onHierarchyChanged(null);
}
},
attr: function(t) {
r.mixin(this, t);
},
getChildByUuid: function(t) {
if (!t) {
cc.log("Invalid uuid");
return null;
}
for (var e = this._children, i = 0, n = e.length; i < n; i++) if (e[i]._id === t) return e[i];
return null;
},
getChildByName: function(t) {
if (!t) {
cc.log("Invalid name");
return null;
}
for (var e = this._children, i = 0, n = e.length; i < n; i++) if (e[i]._name === t) return e[i];
return null;
},
addChild: function(t) {
cc.assertID(t, 1606);
cc.assertID(null === t._parent, 1605);
t.setParent(this);
},
insertChild: function(t, e) {
t.parent = this;
t.setSiblingIndex(e);
},
getSiblingIndex: function() {
return this._parent ? this._parent._children.indexOf(this) : 0;
},
setSiblingIndex: function(t) {
if (this._parent) if (this._parent._objFlags & u) cc.errorID(3821); else {
var e = this._parent._children;
t = -1 !== t ? t : e.length - 1;
var i = e.indexOf(this);
if (t !== i) {
e.splice(i, 1);
t < e.length ? e.splice(t, 0, this) : e.push(this);
this._onSiblingIndexChanged && this._onSiblingIndexChanged(t);
}
}
},
walk: function(t, e) {
var i, n, r, s, o = cc._BaseNode, a = 1, c = o._stacks[o._stackId];
if (!c) {
c = [];
o._stacks.push(c);
}
o._stackId++;
c.length = 0;
c[0] = this;
var l = null;
s = !1;
for (;a; ) if (n = c[--a]) {
!s && t ? t(n) : s && e && e(n);
c[a] = null;
if (s) {
if (l === this._parent) break;
s = !1;
if (i) if (i[++r]) {
c[a] = i[r];
a++;
} else if (l) {
c[a] = l;
a++;
s = !0;
if (l._parent) {
r = (i = l._parent._children).indexOf(l);
l = l._parent;
} else {
l = null;
i = null;
}
if (r < 0) break;
}
} else if (n._children.length > 0) {
l = n;
i = n._children;
r = 0;
c[a] = i[r];
a++;
} else {
c[a] = n;
a++;
s = !0;
}
}
c.length = 0;
o._stackId--;
},
cleanup: function() {},
removeFromParent: function(t) {
if (this._parent) {
void 0 === t && (t = !0);
this._parent.removeChild(this, t);
}
},
removeChild: function(t, e) {
if (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];
if (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 = _(t);
return e ? f(this, e) : null;
},
getComponents: function(t) {
var e = _(t), i = [];
e && d(this, e, i);
return i;
},
getComponentInChildren: function(t) {
var e = _(t);
return e ? p(this._children, e) : null;
},
getComponentsInChildren: function(t) {
var e = _(t), i = [];
if (e) {
d(this, e, i);
m(this._children, e, i);
}
return i;
},
_checkMultipleComp: !1,
addComponent: function(t) {
var e;
if ("string" == typeof t) {
if (!(e = r.getClassByName(t))) {
cc.errorID(3807, t);
cc._RFpeek() && cc.errorID(3808, t);
return null;
}
} else {
if (!t) {
cc.errorID(3804);
return null;
}
e = t;
}
if ("function" != typeof e) {
cc.errorID(3809);
return null;
}
if (!r.isChildClassOf(e, cc.Component)) {
cc.errorID(3810);
return null;
}
var i = e._requireComponent;
if (i && !this.getComponent(i) && !this.addComponent(i)) return null;
var n = new e();
n.node = this;
this._components.push(n);
this._activeInHierarchy && cc.director._nodeActivator.activateComp(n);
return n;
},
_addComponentAt: !1,
removeComponent: function(t) {
if (t) {
t instanceof cc.Component || (t = this.getComponent(t));
t && t.destroy();
} else cc.errorID(3813);
},
_getDependComponent: !1,
_removeComponent: function(t) {
if (t) {
if (!(this._objFlags & c)) {
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 < t.length; ++e) t[e].destroy();
},
_onSetParent: function() {},
_onPostActivated: function() {},
_onBatchCreated: function() {},
_onHierarchyChanged: function() {
var t = this._parent;
!this._persistNode || t instanceof cc.Scene || cc.game.removePersistRootNode(this);
var e = this._active && !(!t || !t._activeInHierarchy);
this._activeInHierarchy !== e && cc.director._nodeActivator.activateNode(this, e);
},
_instantiate: function(t, e) {
t || (t = cc.instantiate._clone(this, this));
t._prefab;
t._parent = null;
t._onBatchCreated(e);
return t;
},
_registerIfAttached: !1,
_onPreDestroy: function() {
var t, e;
this._objFlags |= c;
var i = this._parent, n = i && i._objFlags & c, r = this._children;
for (t = 0, e = r.length; t < e; ++t) r[t]._destroyImmediate();
for (t = 0, e = this._components.length; t < e; ++t) this._components[t]._destroyImmediate();
var s = this.__eventTargets;
for (t = 0, e = s.length; t < e; ++t) {
var o = s[t];
o && o.targetOff(this);
}
s.length = 0;
this._persistNode && cc.game.removePersistRootNode(this);
if (!n && i) {
var a = i._children.indexOf(this);
i._children.splice(a, 1);
i.emit && i.emit("child-removed", this);
}
return n;
},
onRestore: !1
});
y.idGenerater = h;
y._stacks = [ [] ];
y._stackId = 0;
y.prototype._onPreDestroyBase = y.prototype._onPreDestroy;
y.prototype._onHierarchyChangedBase = y.prototype._onHierarchyChanged;
n.propertyDefine(y, [ "parent", "name", "children", "childrenCount" ], {});
cc._BaseNode = e.exports = y;
}), {
"../event-manager": 184,
"../platform/CCObject": 245,
"../platform/id-generater": 256,
"../platform/js": 260,
"../renderer/render-flow": 272,
"./misc": 322
} ],
315: [ (function(t, e) {
"use strict";
e.exports = {
binarySearchEpsilon: function(t, e) {
for (var i = 0, n = t.length - 1, r = n >>> 1; i <= n; r = i + n >>> 1) {
var s = t[r];
if (s > e + 1e-6) n = r - 1; else {
if (!(s < e - 1e-6)) return r;
i = r + 1;
}
}
return ~i;
}
};
}), {} ],
316: [ (function(t, e) {
"use strict";
var i = t("../components/CCRenderComponent"), n = t("../platform/CCMacro").BlendFactor, r = t("../../renderer/gfx"), s = cc.Class({
properties: {
_srcBlendFactor: n.SRC_ALPHA,
_dstBlendFactor: n.ONE_MINUS_SRC_ALPHA,
srcBlendFactor: {
get: function() {
return this._srcBlendFactor;
},
set: function(t) {
if (this._srcBlendFactor !== t) {
this._srcBlendFactor = t;
this._updateBlendFunc(!0);
this._onBlendChanged && this._onBlendChanged();
}
},
animatable: !1,
type: n,
tooltip: !1,
visible: !0
},
dstBlendFactor: {
get: function() {
return this._dstBlendFactor;
},
set: function(t) {
if (this._dstBlendFactor !== t) {
this._dstBlendFactor = t;
this._updateBlendFunc(!0);
}
},
animatable: !1,
type: n,
tooltip: !1,
visible: !0
}
},
setMaterial: function(t, e) {
var r = i.prototype.setMaterial.call(this, t, e);
this._srcBlendFactor === n.SRC_ALPHA && this._dstBlendFactor === n.ONE_MINUS_SRC_ALPHA || this._updateMaterialBlendFunc(r);
return r;
},
_updateMaterial: function() {
this._updateBlendFunc();
},
_updateBlendFunc: function(t) {
if (t || this._srcBlendFactor !== n.SRC_ALPHA || this._dstBlendFactor !== n.ONE_MINUS_SRC_ALPHA) for (var e = this.getMaterials(), i = 0; i < e.length; i++) {
var r = e[i];
this._updateMaterialBlendFunc(r);
}
},
_updateMaterialBlendFunc: function(t) {
t.setBlend(!0, r.BLEND_FUNC_ADD, this._srcBlendFactor, this._dstBlendFactor, r.BLEND_FUNC_ADD, this._srcBlendFactor, this._dstBlendFactor);
i.prototype.markForRender.call(this, !0);
}
});
e.exports = cc.BlendFunc = s;
}), {
"../../renderer/gfx": 363,
"../components/CCRenderComponent": 160,
"../platform/CCMacro": 244
} ],
317: [ (function(t, e) {
"use strict";
var i = t("./misc").BASE64_VALUES, n = "0123456789abcdef".split(""), r = [ "", "", "", "" ], s = r.concat(r, "-", r, "-", r, "-", r, "-", r, r, r), o = s.map((function(t, e) {
return "-" === t ? NaN : e;
})).filter(isFinite);
e.exports = function(t) {
if (22 !== t.length) return t;
s[0] = t[0];
s[1] = t[1];
for (var e = 2, r = 2; e < 22; e += 2) {
var a = i[t.charCodeAt(e)], c = i[t.charCodeAt(e + 1)];
s[o[r++]] = n[a >> 2];
s[o[r++]] = n[(3 & a) << 2 | c >> 4];
s[o[r++]] = n[15 & c];
}
return s.join("");
};
}), {
"./misc": 322
} ],
318: [ (function(t, e) {
"use strict";
cc.find = e.exports = function(t, e) {
if (null == t) {
cc.errorID(3814);
return null;
}
if (e) ; else {
var i = cc.director.getScene();
if (!i) return null;
e = i;
}
for (var n = e, r = "/" !== t[0] ? 0 : 1, s = t.split("/"), o = r; o < s.length; o++) {
var a = s[o], c = n._children;
n = null;
for (var l = 0, u = c.length; l < u; ++l) {
var h = c[l];
if (h.name === a) {
n = h;
break;
}
}
if (!n) return null;
}
return n;
};
}), {} ],
319: [ (function(t, e) {
"use strict";
var i, n = (i = t("../assets/material/material-variant")) && i.__esModule ? i : {
default: i
}, r = t("../assets/material/CCMaterial"), s = cc.Class({
properties: {
_normalMaterial: null,
normalMaterial: {
get: function() {
return this._normalMaterial;
},
set: function(t) {
this._normalMaterial = t;
this._updateDisabledState && this._updateDisabledState();
},
type: r,
tooltip: !1,
animatable: !1
},
_grayMaterial: null,
grayMaterial: {
get: function() {
return this._grayMaterial;
},
set: function(t) {
this._grayMaterial = t;
this._updateDisabledState && this._updateDisabledState();
},
type: r,
tooltip: !1,
animatable: !1
}
},
_switchGrayMaterial: function(t, e) {
var i;
if (t) {
(i = this._grayMaterial) || (i = r.getBuiltinMaterial("2d-gray-sprite"));
i = this._grayMaterial = n.default.create(i, e);
} else {
(i = this._normalMaterial) || (i = r.getBuiltinMaterial("2d-sprite", e));
i = this._normalMaterial = n.default.create(i, e);
}
e.setMaterial(0, i);
}
});
e.exports = s;
}), {
"../assets/material/CCMaterial": 124,
"../assets/material/material-variant": 131
} ],
320: [ (function(t, e) {
"use strict";
var i = /^(click)(\s)*=|(param)(\s)*=/, n = /(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/, r = function() {
this._parsedObject = {};
this._specialSymbolArray = [];
this._specialSymbolArray.push([ /&lt;/g, "<" ]);
this._specialSymbolArray.push([ /&gt;/g, ">" ]);
this._specialSymbolArray.push([ /&amp;/g, "&" ]);
this._specialSymbolArray.push([ /&quot;/g, '"' ]);
this._specialSymbolArray.push([ /&apos;/g, "'" ]);
this._specialSymbolArray.push([ /&nbsp;/g, " " ]);
};
r.prototype = {
constructor: r,
parse: function(t) {
this._resultObjectArray = [];
this._stack = [];
for (var e = 0, i = t.length; e < i; ) {
var n = t.indexOf(">", e), r = -1;
if (n >= 0 && (r = t.lastIndexOf("<", n)) < e - 1) {
r = t.indexOf("<", n + 1);
n = t.indexOf(">", r + 1);
}
if (r < 0) {
this._stack.pop();
this._processResult(t.substring(e));
e = i;
} else {
var s = t.substring(e, r), o = t.substring(r + 1, n);
"" === o && (s = t.substring(e, n + 1));
this._processResult(s);
-1 === n ? n = r : "/" === t.charAt(r + 1) ? this._stack.pop() : this._addToStack(o);
e = n + 1;
}
}
return this._resultObjectArray;
},
_attributeToObject: function(t) {
var e, i, r, s, o = {}, a = (t = t.trim()).match(/^(color|size)(\s)*=/);
if (a) {
e = a[0];
if ("" === (t = t.substring(e.length).trim())) return o;
i = t.indexOf(" ");
switch (e[0]) {
case "c":
o.color = i > -1 ? t.substring(0, i).trim() : t;
break;

case "s":
o.size = parseInt(t);
}
if (i > -1) {
s = t.substring(i + 1).trim();
r = this._processEventHandler(s);
o.event = r;
}
return o;
}
if ((a = t.match(/^(br(\s)*\/)/)) && a[0].length > 0 && (e = a[0].trim()).startsWith("br") && "/" === e[e.length - 1]) {
o.isNewLine = !0;
this._resultObjectArray.push({
text: "",
style: {
newline: !0
}
});
return o;
}
if ((a = t.match(/^(img(\s)*src(\s)*=[^>]+\/)/)) && a[0].length > 0 && (e = a[0].trim()).startsWith("img") && "/" === e[e.length - 1]) {
a = t.match(n);
for (var c, l = !1; a; ) {
e = (t = t.substring(t.indexOf(a[0]))).substr(0, a[0].length);
h = (i = (c = t.substring(e.length).trim()).indexOf(" ")) > -1 ? c.substr(0, i) : c;
e = (e = e.replace(/[^a-zA-Z]/g, "").trim()).toLocaleLowerCase();
t = c.substring(i).trim();
h.endsWith("/") && (h = h.slice(0, -1));
if ("src" === e) {
switch (h.charCodeAt(0)) {
case 34:
case 39:
l = !0;
h = h.slice(1, -1);
}
o.isImage = !0;
o.src = h;
} else if ("height" === e) o.imageHeight = parseInt(h); else if ("width" === e) o.imageWidth = parseInt(h); else if ("align" === e) {
switch (h.charCodeAt(0)) {
case 34:
case 39:
h = h.slice(1, -1);
}
o.imageAlign = h.toLocaleLowerCase();
} else "offset" === e ? o.imageOffset = h : "click" === e && (o.event = this._processEventHandler(e + "=" + h));
o.event && "param" === e && (o.event.param = h.replace(/^\"|\"$/g, ""));
a = t.match(n);
}
l && o.isImage && this._resultObjectArray.push({
text: "",
style: o
});
return {};
}
if (a = t.match(/^(outline(\s)*[^>]*)/)) {
var u = {
color: "#ffffff",
width: 1
};
if (t = a[0].substring("outline".length).trim()) {
var h, _ = /(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;
a = t.match(_);
for (;a; ) {
e = (t = t.substring(t.indexOf(a[0]))).substr(0, a[0].length);
h = (i = (c = t.substring(e.length).trim()).indexOf(" ")) > -1 ? c.substr(0, i) : c;
e = (e = e.replace(/[^a-zA-Z]/g, "").trim()).toLocaleLowerCase();
t = c.substring(i).trim();
"click" === e ? o.event = this._processEventHandler(e + "=" + h) : "color" === e ? u.color = h : "width" === e && (u.width = parseInt(h));
o.event && "param" === e && (o.event.param = h.replace(/^\"|\"$/g, ""));
a = t.match(_);
}
}
o.outline = u;
}
if ((a = t.match(/^(on|u|b|i)(\s)*/)) && a[0].length > 0) {
e = a[0];
t = t.substring(e.length).trim();
switch (e[0]) {
case "u":
o.underline = !0;
break;

case "i":
o.italic = !0;
break;

case "b":
o.bold = !0;
}
if ("" === t) return o;
r = this._processEventHandler(t);
o.event = r;
}
return o;
},
_processEventHandler: function(t) {
for (var e = 0, n = {}, r = t.match(i), s = !1; r; ) {
var o = r[0], a = "";
s = !1;
if ('"' === (t = t.substring(o.length).trim()).charAt(0)) {
if ((e = t.indexOf('"', 1)) > -1) {
a = t.substring(1, e).trim();
s = !0;
}
e++;
} else if ("'" === t.charAt(0)) {
if ((e = t.indexOf("'", 1)) > -1) {
a = t.substring(1, e).trim();
s = !0;
}
e++;
} else {
var c = t.match(/(\S)+/);
e = (a = c ? c[0] : "").length;
}
s && (n[o = o.substring(0, o.length - 1).trim()] = a);
r = (t = t.substring(e).trim()).match(i);
}
return n;
},
_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) {
if ("" !== 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 < this._specialSymbolArray.length; ++e) {
var i = this._specialSymbolArray[e][0], n = this._specialSymbolArray[e][1];
t = t.replace(i, n);
}
return t;
}
};
e.exports = r;
}), {} ],
321: [ (function(t) {
"use strict";
t("./CCPath");
t("./profiler/CCProfiler");
t("./find");
t("./mutable-forward-iterator");
}), {
"./CCPath": 312,
"./find": 318,
"./mutable-forward-iterator": 323,
"./profiler/CCProfiler": 326
} ],
322: [ (function(t, e) {
"use strict";
for (var i = t("../platform/js"), n = {
propertyDefine: function(t, e, n) {
function r(t, e, n, r) {
var s = Object.getOwnPropertyDescriptor(t, e);
if (s) {
s.get && (t[n] = s.get);
s.set && r && (t[r] = s.set);
} else {
var o = t[n];
i.getset(t, e, o, t[r]);
}
}
for (var s, o = t.prototype, a = 0; a < e.length; a++) {
var c = (s = e[a])[0].toUpperCase() + s.slice(1);
r(o, s, "get" + c, "set" + c);
}
for (s in n) {
var l = n[s];
r(o, s, l[0], l[1]);
}
},
NextPOT: function(t) {
t -= 1;
t |= t >> 1;
t |= t >> 2;
t |= t >> 4;
t |= t >> 8;
return 1 + (t |= t >> 16);
},
BUILTIN_CLASSID_RE: /^(?:cc|dragonBones|sp|ccsg)\..+/
}, r = new Array(123), s = 0; s < 123; ++s) r[s] = 64;
for (var o = 0; o < 64; ++o) r["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(o)] = o;
n.BASE64_VALUES = r;
n.pushToMap = function(t, e, i, n) {
var r = t[e];
if (r) if (Array.isArray(r)) if (n) {
r.push(r[0]);
r[0] = i;
} else r.push(i); else t[e] = n ? [ i, r ] : [ r, i ]; else t[e] = i;
};
n.clampf = function(t, e, i) {
if (e > i) {
var n = e;
e = i;
i = n;
}
return t < e ? e : t < i ? t : i;
};
n.clamp01 = function(t) {
return t < 0 ? 0 : t < 1 ? t : 1;
};
n.lerp = function(t, e, i) {
return t + (e - t) * i;
};
n.degreesToRadians = function(t) {
return t * cc.macro.RAD;
};
n.radiansToDegrees = function(t) {
return t * cc.macro.DEG;
};
cc.misc = e.exports = n;
}), {
"../platform/js": 260
} ],
323: [ (function(t, e) {
"use strict";
function i(t) {
this.i = 0;
this.array = t;
}
var n = i.prototype;
n.remove = function(t) {
var e = this.array.indexOf(t);
e >= 0 && this.removeAt(e);
};
n.removeAt = function(t) {
this.array.splice(t, 1);
t <= this.i && --this.i;
};
n.fastRemove = function(t) {
var e = this.array.indexOf(t);
e >= 0 && this.fastRemoveAt(e);
};
n.fastRemoveAt = function(t) {
var e = this.array;
e[t] = e[e.length - 1];
--e.length;
t <= this.i && --this.i;
};
n.push = function(t) {
this.array.push(t);
};
e.exports = i;
}), {} ],
324: [ (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;
e.get = function() {};
e.put = function() {};
e.clear = function() {};
return t;
})();
i.default = n;
cc.pool = {};
n.register = function(t, e) {
cc.pool[t] = e;
};
e.exports = i.default;
}), {} ],
325: [ (function(t, e) {
"use strict";
cc._PrefabInfo = cc.Class({
name: "cc.PrefabInfo",
properties: {
root: null,
asset: null,
fileId: "",
sync: !1
}
});
e.exports = {
syncWithPrefab: function(t) {
var e = t._prefab;
if (e.asset) {
var i = t._objFlags, n = t._parent, r = t._id, s = t._name, o = t._active, a = t._eulerAngles.x, c = t._eulerAngles.y, l = t._eulerAngles.z, u = t._localZOrder, h = t._trs, _ = h[0], f = h[1], d = h[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 = o;
t._localZOrder = u;
(h = t._trs)[0] = _;
h[1] = f;
h[2] = d;
t._eulerAngles.x = a;
t._eulerAngles.y = c;
t._eulerAngles.z = l;
} else {
cc.errorID(3701, t.name);
t._prefab = null;
}
}
};
}), {} ],
326: [ (function(t, e) {
"use strict";
var i = t("../../platform/CCMacro"), n = t("./perf-counter"), r = !1, s = 15, o = null, a = null, c = null;
function l() {
if (!o) {
o = {
fps: {
desc: "Framerate (FPS)",
below: 30,
average: 500
},
draws: {
desc: "Draw Call"
},
frame: {
desc: "Frame time (ms)",
min: 0,
max: 50,
average: 500
},
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 n(e, o[e], t);
}
}
function u() {
if (!a || !a.isValid) {
(a = new cc.Node("PROFILER-NODE")).x = a.y = 10;
a.groupIndex = cc.Node.BuiltinGroupIndex.DEBUG;
cc.Camera._setupDebugCamera();
a.zIndex = i.MAX_ZINDEX;
cc.game.addPersistRootNode(a);
var t = new cc.Node("LEFT-PANEL");
t.anchorX = t.anchorY = 0;
var e = t.addComponent(cc.Label);
e.fontSize = s;
e.lineHeight = s;
t.parent = a;
var n = new cc.Node("RIGHT-PANEL");
n.anchorX = 1;
n.anchorY = 0;
n.x = 200;
var r = n.addComponent(cc.Label);
r.horizontalAlign = cc.Label.HorizontalAlign.RIGHT;
r.fontSize = s;
r.lineHeight = s;
n.parent = a;
if (cc.sys.platform !== cc.sys.BAIDU_GAME_SUB && cc.sys.platform !== cc.sys.WECHAT_GAME_SUB) {
e.cacheMode = cc.Label.CacheMode.CHAR;
r.cacheMode = cc.Label.CacheMode.CHAR;
}
c = {
left: e,
right: r
};
}
}
function h() {
u();
var t = cc.director._lastUpdate;
o.frame._counter.start(t);
o.logic._counter.start(t);
}
function _() {
var t = performance.now();
cc.director.isPaused() ? o.frame._counter.start(t) : o.logic._counter.end(t);
o.render._counter.start(t);
}
function f() {
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";
}
if (c) {
c.left.string = e;
c.right.string = i;
}
}
cc.profiler = e.exports = {
isShowingStats: function() {
return r;
},
hideStats: function() {
if (r) {
a && (a.active = !1);
cc.director.off(cc.Director.EVENT_BEFORE_UPDATE, h);
cc.director.off(cc.Director.EVENT_AFTER_UPDATE, _);
cc.director.off(cc.Director.EVENT_AFTER_DRAW, f);
r = !1;
}
},
showStats: function() {
if (!r) {
l();
a && (a.active = !0);
cc.director.on(cc.Director.EVENT_BEFORE_UPDATE, h);
cc.director.on(cc.Director.EVENT_AFTER_UPDATE, _);
cc.director.on(cc.Director.EVENT_AFTER_DRAW, f);
r = !0;
}
}
};
}), {
"../../platform/CCMacro": 244,
"./perf-counter": 328
} ],
327: [ (function(t, e) {
"use strict";
var i = 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;
if (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._value < this._opts.below || this._opts.over && this._value > this._opts.over;
}
});
e.exports = i;
}), {} ],
328: [ (function(t, e) {
"use strict";
var i = t("./counter"), n = cc.Class({
name: "cc.PerfCounter",
extends: i,
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++;
if (i > (this._opts.average || 1e3)) {
this._value = 1e3 * this._total / i;
this._total = 0;
this._time = e;
this._average(this._value);
}
}
});
e.exports = n;
}), {
"./counter": 327
} ],
329: [ (function(t, e) {
"use strict";
var i, n = new (((i = t("../platform/js")) && i.__esModule ? i : {
default: i
}).default.Pool)(2);
n.get = function() {
return this._get() || {
key: null,
value: null,
prev: null,
next: null
};
};
function r(t) {
this.count = 0;
this.limit = t;
this.datas = {};
this.head = null;
this.tail = null;
}
r.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;
};
r.prototype.put = function(t, e) {
var i = n.get();
i.key = t;
i.value = e;
if (this.count >= this.limit) {
var r = this.tail;
delete this.datas[r.key];
this.count--;
this.tail = r.prev;
this.tail.next = null;
r.prev = null;
r.next = null;
n.put(r);
}
this.moveToHead(i);
};
r.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--;
};
r.prototype.get = function(t) {
var e = this.datas[t];
if (e) {
this.remove(e);
this.moveToHead(e);
return e.value;
}
return null;
};
r.prototype.clear = function() {
this.count = 0;
this.datas = {};
this.head = null;
this.tail = null;
};
r.prototype.has = function(t) {
return !!this.datas[t];
};
r.prototype.delete = function(t) {
var e = this.datas[t];
this.remove(e);
};
var s = new r(100), o = {
BASELINE_RATIO: .26,
MIDDLE_RATIO: .37,
BASELINE_OFFSET: 0,
label_wordRex: /([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,
label_symbolRex: /^[!,.:;'}\]%\?>、‘“》？。，！]/,
label_lastWordRex: /([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁё]+|\S)$/,
label_lastEnglish: /[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁё]+$/,
label_firstEnglish: /^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁё]/,
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) + "🎮" + e, r = s.get(n);
if (null !== r) return r;
var o = t.measureText(e), a = o && o.width || 0;
s.put(n, a);
return a;
},
_safeSubstring: function(t, e, i) {
var n = e, r = i, s = t[e];
this.lowSurrogateRex.test(s) && n--;
if (void 0 !== i) if (i - 1 !== e) {
var o = t[i - 1];
this.highSurrogateRex.test(o) && 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) {
r.push("");
return r;
}
for (var s = t; e > i && s.length > 1; ) {
for (var o = s.length * (i / e) | 0, a = this._safeSubstring(s, o), c = e - n(a), l = a, u = 0, h = 0; c > i && h++ < 10; ) {
o *= i / c;
o |= 0;
c = e - n(a = this._safeSubstring(s, o));
}
h = 0;
for (;c <= i && h++ < 10; ) {
if (a) {
var _ = this.label_wordRex.exec(a);
u = _ ? _[0].length : 1;
l = a;
}
o += u;
c = e - n(a = this._safeSubstring(s, o));
}
if (0 == (o -= u)) {
o = 1;
l = this._safeSubstring(s, 1);
} else if (1 === o && this.highSurrogateRex.test(s[0])) {
o = 2;
l = this._safeSubstring(s, 2);
}
var f, d = this._safeSubstring(s, 0, o);
if (this.label_wrapinspection && this.label_symbolRex.test(l || a)) {
0 == (o -= (f = this.label_lastWordRex.exec(d)) ? f[0].length : 0) && (o = 1);
l = this._safeSubstring(s, o);
d = this._safeSubstring(s, 0, o);
}
if (this.label_firstEnglish.test(l) && (f = this.label_lastEnglish.exec(d)) && d !== f[0]) {
o -= f[0].length;
l = this._safeSubstring(s, o);
d = this._safeSubstring(s, 0, o);
}
0 === r.length ? r.push(d) : (d = d.trimLeft()).length > 0 && r.push(d);
e = n(s = l || a);
}
0 === r.length ? r.push(s) : (s = s.trimLeft()).length > 0 && r.push(s);
return r;
}
};
cc.textUtils = e.exports = o;
}), {
"../platform/js": 260
} ],
330: [ (function(t, e) {
"use strict";
var i = t("../assets/CCTexture2D"), n = {
loadImage: function(t, e, i) {
cc.assertID(t, 3103);
var n = cc.assetManager.assets.get(t);
if (n) {
if (n.loaded) {
e && e.call(i, null, n);
return n;
}
n.once("load", (function() {
e && e.call(i, null, n);
}), i);
return n;
}
cc.assetManager.loadRemote(t, (function(t, n) {
e && e.call(i, t, n);
}));
},
cacheImage: function(t, e) {
if (t && e) {
var n = new i();
n.initWithElement(e);
cc.assetManager.assets.add(t, n);
return n;
}
},
postLoadTexture: function(t, e) {
t.loaded ? e && e() : t.nativeUrl ? cc.assetManager.postLoadNative(t, e) : e && e();
}
};
e.exports = n;
}), {
"../assets/CCTexture2D": 120
} ],
331: [ (function(t, e) {
"use strict";
var i = t("./node-unit"), n = t("./node-mem-pool");
e.exports = {
NodeMemPool: new n(i)
};
}), {
"./node-mem-pool": 333,
"./node-unit": 334
} ],
332: [ (function(t, e) {
"use strict";
var i = function(t) {
this._unitClass = t;
this._pool = [];
this._findOrder = [];
this._initNative();
}, n = i.prototype;
n._initNative = function() {
this._nativeMemPool = new renderer.MemPool();
};
n._buildUnit = function(t) {
var e = new this._unitClass(t, this);
this._nativeMemPool.updateCommonData(t, e._data, e._signData);
return e;
};
n._destroyUnit = function(t) {
this._pool[t] = null;
for (var e = 0, i = this._findOrder.length; e < i; e++) {
var n = this._findOrder[e];
if (n && n.unitID == t) {
this._findOrder.splice(e, 1);
break;
}
}
this._nativeMemPool.removeCommonData(t);
};
n._findUnitID = function() {
for (var t = 0, e = this._pool; e[t]; ) t++;
return t;
};
n.pop = function() {
for (var t = null, e = 0, i = this._findOrder, n = this._pool, r = i.length; e < r; e++) {
var s = i[e];
if (s && s.hasSpace()) {
t = s;
break;
}
}
if (!t) {
var o = this._findUnitID();
t = this._buildUnit(o);
n[o] = t;
i.push(t);
e = i.length - 1;
}
var a = i[0];
if (a !== t) {
i[0] = t;
i[e] = a;
}
return t.pop();
};
n.push = function(t) {
var e = this._pool[t.unitID];
e.push(t.index);
this._findOrder.length > 1 && e.isAllFree() && this._destroyUnit(t.unitID);
return e;
};
e.exports = i;
}), {} ],
333: [ (function(t, e) {
"use strict";
var i = t("./mem-pool"), n = function(t) {
i.call(this, t);
};
(function() {
var t = function() {};
t.prototype = i.prototype;
n.prototype = new t();
})();
var r = n.prototype;
r._initNative = function() {
this._nativeMemPool = new renderer.NodeMemPool();
};
r._destroyUnit = function(t) {
i.prototype._destroyUnit.call(this, t);
this._nativeMemPool.removeNodeData(t);
};
e.exports = n;
}), {
"./mem-pool": 332
} ],
334: [ (function(t, e) {
"use strict";
var i = t("../../value-types/utils"), n = Uint32Array, r = 10 * i.FLOAT_BYTES, s = 16 * i.FLOAT_BYTES, o = 16 * i.FLOAT_BYTES, a = Uint32Array, c = Uint32Array, l = Int32Array, u = Uint8Array, h = Uint8Array, _ = Uint32Array, f = 2 * i.FLOAT_BYTES, d = t("./unit-base"), p = function(t, e) {
d.call(this, t, e);
var p = this._contentNum;
this.trsList = new i.FLOAT_ARRAY_TYPE(10 * p);
this.localMatList = new i.FLOAT_ARRAY_TYPE(16 * p);
this.worldMatList = new i.FLOAT_ARRAY_TYPE(16 * p);
this.dirtyList = new n(1 * p);
this.parentList = new a(2 * p);
this.zOrderList = new c(1 * p);
this.cullingMaskList = new l(1 * p);
this.opacityList = new u(1 * p);
this.is3DList = new h(1 * p);
this.nodeList = new _(2 * p);
this.skewList = new i.FLOAT_ARRAY_TYPE(2 * p);
this._memPool._nativeMemPool.updateNodeData(t, this.dirtyList, this.trsList, this.localMatList, this.worldMatList, this.parentList, this.zOrderList, this.cullingMaskList, this.opacityList, this.is3DList, this.nodeList, this.skewList);
for (var m = 0; m < p; m++) {
var y = this._spacesData[m];
y.trs = new i.FLOAT_ARRAY_TYPE(this.trsList.buffer, m * r, 10);
y.localMat = new i.FLOAT_ARRAY_TYPE(this.localMatList.buffer, m * s, 16);
y.worldMat = new i.FLOAT_ARRAY_TYPE(this.worldMatList.buffer, m * o, 16);
y.dirty = new n(this.dirtyList.buffer, 4 * m, 1);
y.parent = new a(this.parentList.buffer, 8 * m, 2);
y.zOrder = new c(this.zOrderList.buffer, 4 * m, 1);
y.cullingMask = new l(this.cullingMaskList.buffer, 4 * m, 1);
y.opacity = new u(this.opacityList.buffer, 1 * m, 1);
y.is3D = new h(this.is3DList.buffer, 1 * m, 1);
y.skew = new i.FLOAT_ARRAY_TYPE(this.skewList.buffer, m * f, 2);
}
};
(function() {
var t = function() {};
t.prototype = d.prototype;
p.prototype = new t();
})();
e.exports = p;
}), {
"../../value-types/utils": 344,
"./unit-base": 335
} ],
335: [ (function(t, e) {
"use strict";
var i = function(t, e, i) {
i = i || 128;
this.unitID = t;
this._memPool = e;
this._data = new Uint16Array(2);
this._data[0] = 0;
this._data[1] = 0;
this._contentNum = i;
this._signData = new Uint16Array(2 * this._contentNum);
this._spacesData = [];
for (var n = 0; n < i; n++) {
var r = 2 * n;
this._signData[r + 0] = n + 1;
this._signData[r + 1] = 0;
this._spacesData[n] = {
index: n,
unitID: t
};
}
this._signData[2 * (i - 1)] = 65535;
}, n = i.prototype;
n.hasSpace = function() {
return 65535 !== this._data[0];
};
n.isAllFree = function() {
return 0 == this._data[1];
};
n.pop = function() {
var t = this._data[0];
if (65535 === t) return null;
var e = t, i = 2 * e, n = this._spacesData[e];
this._signData[i + 1] = 1;
this._data[0] = this._signData[i + 0];
this._data[1]++;
return n;
};
n.push = function(t) {
var e = 2 * t;
this._signData[e + 1] = 0;
this._signData[e + 0] = this._data[0];
this._data[0] = t;
this._data[1]--;
};
n.dump = function() {
for (var t = 0, e = this._data[0], i = ""; 65535 != e; ) {
t++;
i += e + "->";
e = this._signData[2 * e + 0];
}
for (var n = 0, r = "", s = this._contentNum, o = 0; o < s; o++) if (1 == this._signData[2 * o + 1]) {
n++;
r += o + "->";
}
var a = t + n;
console.log("unitID:", this.unitID, "spaceNum:", t, "calc using num:", n, "store using num:", this._data[1], "calc total num:", a, "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:", a, "actually total num:", this._contentNum);
};
e.exports = i;
}), {} ],
336: [ (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"));
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
function a(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function c(t, e, i) {
e && a(t.prototype, e);
i && a(t, i);
return t;
}
function l(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
u(t, e);
}
function u(t, e) {
return (u = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var h = (function(t) {
l(e, t);
e.copy = function(t, e) {
t.r = e.r;
t.g = e.g;
t.b = e.b;
t.a = e.a;
return t;
};
e.clone = function(t) {
return new e(t.r, t.g, t.b, t.a);
};
e.set = function(t, e, i, n, r) {
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;
return t;
};
e.fromHex = function(t, e) {
var i = e >> 24 & 255, n = e >> 16 & 255, r = e >> 8 & 255, s = 255 & e;
t.r = i;
t.g = n;
t.b = r;
t.a = s;
return t;
};
e.fromHEX = function(t, e) {
e = 0 === e.indexOf("#") ? e.substring(1) : e;
t.r = parseInt(e.substr(0, 2), 16) || 0;
t.g = parseInt(e.substr(2, 2), 16) || 0;
t.b = parseInt(e.substr(4, 2), 16) || 0;
t.a = parseInt(e.substr(6, 2), 16) || 255;
t._val = (t.a << 24 >>> 0) + (t.b << 16) + (t.g << 8) + t.r;
return t;
};
e.add = function(t, e, i) {
t.r = e.r + i.r;
t.g = e.g + i.g;
t.b = e.b + i.b;
t.a = e.a + i.a;
return t;
};
e.subtract = function(t, e, i) {
t.r = e.r - i.r;
t.g = e.g - i.g;
t.b = e.b - i.b;
t.a = e.a - i.a;
return t;
};
e.multiply = function(t, e, i) {
t.r = e.r * i.r;
t.g = e.g * i.g;
t.b = e.b * i.b;
t.a = e.a * i.a;
return t;
};
e.divide = function(t, e, i) {
t.r = e.r / i.r;
t.g = e.g / i.g;
t.b = e.b / i.b;
t.a = e.a / i.a;
return t;
};
e.scale = function(t, e, i) {
t.r = e.r * i;
t.g = e.g * i;
t.b = e.b * i;
t.a = e.a * i;
return t;
};
e.lerp = function(t, e, i, n) {
var r = e.r, s = e.g, o = e.b, a = e.a;
t.r = r + n * (i.r - r);
t.g = s + n * (i.g - s);
t.b = o + n * (i.b - o);
t.a = a + n * (i.a - a);
return t;
};
e.toArray = function(t, i, n) {
void 0 === n && (n = 0);
var r = i instanceof e || i.a > 1 ? 1 / 255 : 1;
t[n + 0] = i.r * r;
t[n + 1] = i.g * r;
t[n + 2] = i.b * r;
t[n + 3] = i.a * r;
return t;
};
e.fromArray = function(t, e, i) {
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];
return e;
};
e.premultiplyAlpha = function(t, e) {
var i = e.a / 255;
t.r = e.r * i;
t.g = e.g * i;
t.b = e.b * i;
t._fastSetA(e.a);
return t;
};
function e(e, i, n, r) {
var s;
void 0 === e && (e = 0);
void 0 === i && (i = 0);
void 0 === n && (n = 0);
void 0 === r && (r = 255);
(s = t.call(this) || this)._val = 0;
if ("object" == typeof e) {
i = e.g;
n = e.b;
r = e.a;
e = e.r;
}
s._val = (r << 24 >>> 0) + (n << 16) + (i << 8) + (0 | e);
return s;
}
var i = e.prototype;
i.clone = function() {
var t = new e();
t._val = this._val;
return 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, o = this.b, a = this.a;
n.r = r + (t.r - r) * i;
n.g = s + (t.g - s) * i;
n.b = o + (t.b - o) * i;
n.a = a + (t.a - a) * i;
return 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) {
t = ~~s.default.clampf(t, 0, 255);
this._val = (4294967040 & this._val | t) >>> 0;
return this;
};
i.getG = function() {
return (65280 & this._val) >> 8;
};
i.setG = function(t) {
t = ~~s.default.clampf(t, 0, 255);
this._val = (4294902015 & this._val | t << 8) >>> 0;
return this;
};
i.getB = function() {
return (16711680 & this._val) >> 16;
};
i.setB = function(t) {
t = ~~s.default.clampf(t, 0, 255);
this._val = (4278255615 & this._val | t << 16) >>> 0;
return this;
};
i.getA = function() {
return (4278190080 & this._val) >>> 24;
};
i.setA = function(t) {
t = ~~s.default.clampf(t, 0, 255);
this._val = (16777215 & this._val | t << 24) >>> 0;
return this;
};
i.toCSS = function(t) {
return t && "rgba" !== t ? "rgb" === t ? "rgb(" + this.r + "," + this.g + "," + this.b + ")" : "#" + this.toHEX(t) : "rgba(" + this.r + "," + this.g + "," + 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;
this._val = (r << 24 >>> 0) + (n << 16) + (i << 8) + e;
return this;
};
i.toHEX = function(t) {
var e = [ (this.r < 16 ? "0" : "") + this.r.toString(16), (this.g < 16 ? "0" : "") + this.g.toString(16), (this.b < 16 ? "0" : "") + this.b.toString(16) ];
if ("#rgb" === t) {
e[0] = e[0][0];
e[1] = e[1][0];
e[2] = e[2][0];
} else "#rrggbbaa" === t && e.push((this.a < 16 ? "0" : "") + this.a.toString(16));
return e.join("");
};
i.toRGBValue = function() {
return 16777215 & this._val;
};
i.fromHSV = function(t, e, i) {
var n, r, s;
if (0 === e) n = r = s = i; else if (0 === i) n = r = s = 0; else {
1 === t && (t = 0);
t *= 6;
var o = Math.floor(t), a = t - o, c = i * (1 - e), l = i * (1 - e * a), u = i * (1 - e * (1 - a));
switch (o) {
case 0:
n = i;
r = u;
s = c;
break;

case 1:
n = l;
r = i;
s = c;
break;

case 2:
n = c;
r = i;
s = u;
break;

case 3:
n = c;
r = l;
s = i;
break;

case 4:
n = u;
r = c;
s = i;
break;

case 5:
n = i;
r = c;
s = l;
}
}
n *= 255;
r *= 255;
s *= 255;
this._val = (this.a << 24 >>> 0) + (s << 16) + (r << 8) + (0 | n);
return 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), o = 0;
n.v = r;
n.s = r ? (r - s) / r : 0;
if (n.s) {
o = r - s;
n.h = t === r ? (e - i) / o : e === r ? 2 + (i - t) / o : 4 + (t - e) / o;
n.h /= 6;
n.h < 0 && (n.h += 1);
} else n.h = 0;
return n;
};
i.set = function(t) {
if (t._val) this._val = t._val; else {
this.r = t.r;
this.g = t.g;
this.b = t.b;
this.a = t.a;
}
return 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;
this._val = 4278190080 & r | 16711680 & n | 65280 & i | 255 & e;
return this;
};
c(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);
}
} ], [ {
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);
}
} ]);
return e;
})(n.default);
i.default = h;
h.div = h.divide;
h.sub = h.subtract;
h.mul = h.multiply;
h.WHITE_R = h.WHITE;
h.BLACK_R = h.BLACK;
h.TRANSPARENT_R = h.TRANSPARENT;
h.GRAY_R = h.GRAY;
h.RED_R = h.RED;
h.GREEN_R = h.GREEN;
h.BLUE_R = h.BLUE;
h.YELLOW_R = h.YELLOW;
h.ORANGE_R = h.ORANGE;
h.CYAN_R = h.CYAN;
h.MAGENTA_R = h.MAGENTA;
r.default.fastDefine("cc.Color", h, {
r: 0,
g: 0,
b: 0,
a: 255
});
cc.Color = h;
cc.color = function(t, e, i, n) {
return "string" == typeof t ? new h().fromHEX(t) : "object" == typeof t ? new h(t.r, t.g, t.b, t.a) : new h(t, e, i, n);
};
e.exports = i.default;
}), {
"../platform/CCClass": 239,
"../utils/misc": 322,
"./value-type": 345
} ],
337: [ (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 o = p(t("./vec4"));
i.Vec4 = o.default;
var a = p(t("./mat4"));
i.Mat4 = a.default;
var c = p(t("./mat3"));
i.Mat3 = c.default;
var l = p(t("./rect"));
i.Rect = l.default;
var u = p(t("./size"));
i.Size = u.default;
var h = p(t("./color"));
i.Color = h.default;
var _ = p(t("./quat"));
i.Quat = _.default;
var f = p(t("./trs"));
i.Trs = f.default;
var d = t("./utils");
Object.keys(d).forEach((function(t) {
"default" !== t && "__esModule" !== t && (Object.prototype.hasOwnProperty.call(n, t) || t in i && i[t] === d[t] || (i[t] = d[t]));
}));
function p(t) {
return t && t.__esModule ? t : {
default: t
};
}
cc.math = e.exports;
}), {
"./color": 336,
"./mat3": 338,
"./mat4": 339,
"./quat": 340,
"./rect": 341,
"./size": 342,
"./trs": 343,
"./utils": 344,
"./vec2": 346,
"./vec3": 347,
"./vec4": 348
} ],
338: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = t("../value-types/utils"), s = (n = t("./vec3")) && n.__esModule ? n : {
default: n
}, o = (function() {
t.create = function(e, i, n, r, s, o, a, c, l) {
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 === o && (o = 0);
void 0 === a && (a = 0);
void 0 === c && (c = 0);
void 0 === l && (l = 1);
return new t(e, i, n, r, s, o, a, c, l);
};
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) {
t.m.set(e.m);
return t;
};
t.set = function(t, e, i, n, r, s, o, a, c, l) {
var u = t.m;
u[0] = e;
u[1] = i;
u[2] = n;
u[3] = r;
u[4] = s;
u[5] = o;
u[6] = a;
u[7] = c;
u[8] = l;
return t;
};
t.identity = function(t) {
var e = t.m;
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;
return t;
};
t.transpose = function(t, e) {
var i = e.m, n = t.m;
if (t === e) {
var r = i[1], s = i[2], o = i[5];
n[1] = i[3];
n[2] = i[6];
n[3] = r;
n[5] = i[7];
n[6] = s;
n[7] = o;
} 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], o = i[2], a = i[3], c = i[4], l = i[5], u = i[6], h = i[7], _ = i[8], f = _ * c - l * h, d = -_ * a + l * u, p = h * a - c * u, m = r * f + s * d + o * p;
if (!m) return t;
m = 1 / m;
n[0] = f * m;
n[1] = (-_ * s + o * h) * m;
n[2] = (l * s - o * c) * m;
n[3] = d * m;
n[4] = (_ * r - o * u) * m;
n[5] = (-l * r + o * a) * m;
n[6] = p * m;
n[7] = (-h * r + s * u) * m;
n[8] = (c * r - s * a) * m;
return t;
};
t.adjoint = function(t, e) {
var i = e.m, n = t.m, r = i[0], s = i[1], o = i[2], a = i[3], c = i[4], l = i[5], u = i[6], h = i[7], _ = i[8];
n[0] = c * _ - l * h;
n[1] = o * h - s * _;
n[2] = s * l - o * c;
n[3] = l * u - a * _;
n[4] = r * _ - o * u;
n[5] = o * a - r * l;
n[6] = a * h - c * u;
n[7] = s * u - r * h;
n[8] = r * c - s * a;
return t;
};
t.determinant = function(t) {
var e = t.m, i = e[0], n = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], u = e[8];
return i * (u * o - a * l) + n * (-u * s + a * c) + r * (l * s - o * c);
};
t.multiply = function(t, e, i) {
var n = e.m, r = i.m, s = t.m, o = n[0], a = n[1], c = n[2], l = n[3], u = n[4], h = 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], b = r[5], C = r[6], x = r[7], A = r[8];
s[0] = p * o + m * l + y * _;
s[1] = p * a + m * u + y * f;
s[2] = p * c + m * h + y * d;
s[3] = v * o + g * l + b * _;
s[4] = v * a + g * u + b * f;
s[5] = v * c + g * h + b * d;
s[6] = C * o + x * l + A * _;
s[7] = C * a + x * u + A * f;
s[8] = C * c + x * h + A * d;
return t;
};
t.multiplyMat4 = function(t, e, i) {
var n = e.m, r = i.m, s = t.m, o = n[0], a = n[1], c = n[2], l = n[3], u = n[4], h = 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], b = r[6], C = r[8], x = r[9], A = r[10];
s[0] = p * o + m * l + y * _;
s[1] = p * a + m * u + y * f;
s[2] = p * c + m * h + y * d;
s[3] = v * o + g * l + b * _;
s[4] = v * a + g * u + b * f;
s[5] = v * c + g * h + b * d;
s[6] = C * o + x * l + A * _;
s[7] = C * a + x * u + A * f;
s[8] = C * c + x * h + A * d;
return t;
};
t.translate = function(t, e, i) {
var n = e.m, r = t.m, s = n[0], o = n[1], a = n[2], c = n[3], l = n[4], u = n[5], h = n[6], _ = n[7], f = n[8], d = i.x, p = i.y;
r[0] = s;
r[1] = o;
r[2] = a;
r[3] = c;
r[4] = l;
r[5] = u;
r[6] = d * s + p * c + h;
r[7] = d * o + p * l + _;
r[8] = d * a + p * u + f;
return t;
};
t.rotate = function(t, e, i) {
var n = e.m, r = t.m, s = n[0], o = n[1], a = n[2], c = n[3], l = n[4], u = n[5], h = n[6], _ = n[7], f = n[8], d = Math.sin(i), p = Math.cos(i);
r[0] = p * s + d * c;
r[1] = p * o + d * l;
r[2] = p * a + d * u;
r[3] = p * c - d * s;
r[4] = p * l - d * o;
r[5] = p * u - d * a;
r[6] = h;
r[7] = _;
r[8] = f;
return t;
};
t.scale = function(t, e, i) {
var n = i.x, r = i.y, s = e.m, o = t.m;
o[0] = n * s[0];
o[1] = n * s[1];
o[2] = n * s[2];
o[3] = r * s[3];
o[4] = r * s[4];
o[5] = r * s[5];
o[6] = s[6];
o[7] = s[7];
o[8] = s[8];
return t;
};
t.fromMat4 = function(t, e) {
var i = e.m, n = t.m;
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];
return t;
};
t.fromTranslation = function(t, e) {
var i = t.m;
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;
return t;
};
t.fromRotation = function(t, e) {
var i = Math.sin(e), n = Math.cos(e), r = t.m;
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;
return t;
};
t.fromScaling = function(t, e) {
var i = t.m;
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;
return t;
};
t.fromQuat = function(t, e) {
var i = t.m, n = e.x, r = e.y, s = e.z, o = e.w, a = n + n, c = r + r, l = s + s, u = n * a, h = r * a, _ = r * c, f = s * a, d = s * c, p = s * l, m = o * a, y = o * c, v = o * l;
i[0] = 1 - _ - p;
i[3] = h - v;
i[6] = f + y;
i[1] = h + v;
i[4] = 1 - u - p;
i[7] = d - m;
i[2] = f - y;
i[5] = d + m;
i[8] = 1 - u - _;
return t;
};
t.fromViewUp = function(e, i, n) {
var o, a, c;
return (o = new s.default(0, 1, 0), a = new s.default(), c = new s.default(), function(e, i, n) {
if (s.default.lengthSqr(i) < r.EPSILON * r.EPSILON) {
t.identity(e);
return e;
}
n = n || o;
s.default.normalize(a, s.default.cross(a, n, i));
if (s.default.lengthSqr(a) < r.EPSILON * r.EPSILON) {
t.identity(e);
return e;
}
s.default.cross(c, i, a);
t.set(e, a.x, a.y, a.z, c.x, c.y, c.z, i.x, i.y, i.z);
return e;
})(e, i, n);
};
t.normalFromMat4 = function(t, e) {
var i = e.m, n = t.m, r = i[0], s = i[1], o = i[2], a = i[3], c = i[4], l = i[5], u = i[6], h = 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], b = r * l - s * c, C = r * u - o * c, x = r * h - a * c, A = s * u - o * l, S = s * h - a * l, T = o * h - a * u, w = _ * y - f * m, E = _ * v - d * m, M = _ * g - p * m, B = f * v - d * y, I = f * g - p * y, D = d * g - p * v, P = b * D - C * I + x * B + A * M - S * E + T * w;
if (!P) return t;
P = 1 / P;
n[0] = (l * D - u * I + h * B) * P;
n[1] = (u * M - c * D - h * E) * P;
n[2] = (c * I - l * M + h * w) * P;
n[3] = (o * I - s * D - a * B) * P;
n[4] = (r * D - o * M + a * E) * P;
n[5] = (s * M - r * I - a * w) * P;
n[6] = (y * T - v * S + g * A) * P;
n[7] = (v * x - m * T - g * C) * P;
n[8] = (m * S - y * x + g * b) * P;
return t;
};
t.frob = function(t) {
var e = t.m;
return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2) + Math.pow(e[4], 2) + Math.pow(e[5], 2) + Math.pow(e[6], 2) + Math.pow(e[7], 2) + Math.pow(e[8], 2));
};
t.add = function(t, e, i) {
var n = e.m, r = i.m, s = t.m;
s[0] = n[0] + r[0];
s[1] = n[1] + r[1];
s[2] = n[2] + r[2];
s[3] = n[3] + r[3];
s[4] = n[4] + r[4];
s[5] = n[5] + r[5];
s[6] = n[6] + r[6];
s[7] = n[7] + r[7];
s[8] = n[8] + r[8];
return t;
};
t.subtract = function(t, e, i) {
var n = e.m, r = i.m, s = t.m;
s[0] = n[0] - r[0];
s[1] = n[1] - r[1];
s[2] = n[2] - r[2];
s[3] = n[3] - r[3];
s[4] = n[4] - r[4];
s[5] = n[5] - r[5];
s[6] = n[6] - r[6];
s[7] = n[7] - r[7];
s[8] = n[8] - r[8];
return t;
};
t.multiplyScalar = function(t, e, i) {
var n = e.m, r = t.m;
r[0] = n[0] * i;
r[1] = n[1] * i;
r[2] = n[2] * i;
r[3] = n[3] * i;
r[4] = n[4] * i;
r[5] = n[5] * i;
r[6] = n[6] * i;
r[7] = n[7] * i;
r[8] = n[8] * i;
return t;
};
t.multiplyScalarAndAdd = function(t, e, i, n) {
var r = e.m, s = i.m, o = t.m;
o[0] = r[0] + s[0] * n;
o[1] = r[1] + s[1] * n;
o[2] = r[2] + s[2] * n;
o[3] = r[3] + s[3] * n;
o[4] = r[4] + s[4] * n;
o[5] = r[5] + s[5] * n;
o[6] = r[6] + s[6] * n;
o[7] = r[7] + s[7] * n;
o[8] = r[8] + s[8] * n;
return t;
};
t.exactEquals = 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];
};
t.equals = function(t, e) {
var i = t.m, n = e.m, s = i[0], o = i[1], a = i[2], c = i[3], l = i[4], u = i[5], h = i[6], _ = i[7], f = i[8], d = n[0], p = n[1], m = n[2], y = n[3], v = n[4], g = n[5], b = n[6], C = n[7], x = n[8];
return Math.abs(s - d) <= r.EPSILON * Math.max(1, Math.abs(s), Math.abs(d)) && Math.abs(o - p) <= r.EPSILON * Math.max(1, Math.abs(o), Math.abs(p)) && Math.abs(a - m) <= r.EPSILON * Math.max(1, Math.abs(a), Math.abs(m)) && Math.abs(c - y) <= r.EPSILON * Math.max(1, Math.abs(c), Math.abs(y)) && Math.abs(l - v) <= r.EPSILON * Math.max(1, Math.abs(l), Math.abs(v)) && Math.abs(u - g) <= r.EPSILON * Math.max(1, Math.abs(u), Math.abs(g)) && Math.abs(h - b) <= r.EPSILON * Math.max(1, Math.abs(h), Math.abs(b)) && Math.abs(_ - C) <= r.EPSILON * Math.max(1, Math.abs(_), Math.abs(C)) && Math.abs(f - x) <= r.EPSILON * Math.max(1, Math.abs(f), Math.abs(x));
};
t.toArray = function(t, e, i) {
void 0 === i && (i = 0);
for (var n = e.m, r = 0; r < 9; r++) t[i + r] = n[r];
return t;
};
t.fromArray = function(t, e, i) {
void 0 === i && (i = 0);
for (var n = t.m, r = 0; r < 9; r++) n[r] = e[i + r];
return t;
};
function t(t, e, i, n, s, o, a, c, l) {
void 0 === t && (t = 1);
void 0 === e && (e = 0);
void 0 === i && (i = 0);
void 0 === n && (n = 0);
void 0 === s && (s = 1);
void 0 === o && (o = 0);
void 0 === a && (a = 0);
void 0 === c && (c = 0);
void 0 === l && (l = 1);
this.m = void 0;
if (t instanceof r.FLOAT_ARRAY_TYPE) this.m = t; else {
this.m = new r.FLOAT_ARRAY_TYPE(9);
var u = this.m;
u[0] = t;
u[1] = e;
u[2] = i;
u[3] = n;
u[4] = s;
u[5] = o;
u[6] = a;
u[7] = c;
u[8] = l;
}
}
t.prototype.toString = function() {
var t = this.m;
return "mat3(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ", " + t[8] + ")";
};
return t;
})();
i.default = o;
o.sub = o.subtract;
o.mul = o.multiply;
o.IDENTITY = Object.freeze(new o());
cc.Mat3 = o;
e.exports = i.default;
}), {
"../value-types/utils": 344,
"./vec3": 347
} ],
339: [ (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")), o = l(t("./quat")), a = t("./utils"), c = l(t("./mat3"));
function l(t) {
return t && t.__esModule ? t : {
default: t
};
}
function u(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
h(t, e);
}
function h(t, e) {
return (h = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var _ = 0, f = 0, d = 0, p = 0, m = 0, y = 0, v = 0, g = 0, b = 0, C = 0, x = 0, A = 0, S = 0, T = 0, w = 0, E = 0, M = (function(t) {
u(i, t);
var e = i.prototype;
e.mul = function(t, e) {
return i.multiply(e || new i(), this, t);
};
e.mulScalar = function(t, e) {
i.multiplyScalar(e || new i(), this, t);
};
e.sub = function(t, e) {
i.subtract(e || new i(), this, t);
};
i.clone = function(t) {
var e = t.m;
return new i(e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]);
};
i.copy = function(t, e) {
var i = t.m, n = e.m;
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];
return t;
};
i.set = function(t, e, i, n, r, s, o, a, c, l, u, h, _, f, d, p, m) {
var y = t.m;
y[0] = e;
y[1] = i;
y[2] = n;
y[3] = r;
y[4] = s;
y[5] = o;
y[6] = a;
y[7] = c;
y[8] = l;
y[9] = u;
y[10] = h;
y[11] = _;
y[12] = f;
y[13] = d;
y[14] = p;
y[15] = m;
return t;
};
i.identity = function(t) {
var e = t.m;
e[0] = 1;
e[1] = 0;
e[2] = 0;
e[3] = 0;
e[4] = 0;
e[5] = 1;
e[6] = 0;
e[7] = 0;
e[8] = 0;
e[9] = 0;
e[10] = 1;
e[11] = 0;
e[12] = 0;
e[13] = 0;
e[14] = 0;
e[15] = 1;
return t;
};
i.transpose = function(t, e) {
var i = t.m, n = e.m;
if (t === e) {
var r = n[1], s = n[2], o = n[3], a = n[6], c = n[7], l = n[11];
i[1] = n[4];
i[2] = n[8];
i[3] = n[12];
i[4] = r;
i[6] = n[9];
i[7] = n[13];
i[8] = s;
i[9] = a;
i[11] = n[14];
i[12] = o;
i[13] = c;
i[14] = l;
} else {
i[0] = n[0];
i[1] = n[4];
i[2] = n[8];
i[3] = n[12];
i[4] = n[1];
i[5] = n[5];
i[6] = n[9];
i[7] = n[13];
i[8] = n[2];
i[9] = n[6];
i[10] = n[10];
i[11] = n[14];
i[12] = n[3];
i[13] = n[7];
i[14] = n[11];
i[15] = n[15];
}
return t;
};
i.invert = function(t, e) {
var i = e.m;
_ = i[0];
f = i[1];
d = i[2];
p = i[3];
m = i[4];
y = i[5];
v = i[6];
g = i[7];
b = i[8];
C = i[9];
x = i[10];
A = i[11];
S = i[12];
T = i[13];
w = i[14];
E = i[15];
var n = _ * y - f * m, r = _ * v - d * m, s = _ * g - p * m, o = f * v - d * y, a = f * g - p * y, c = d * g - p * v, l = b * T - C * S, u = b * w - x * S, h = b * E - A * S, M = C * w - x * T, B = C * E - A * T, I = x * E - A * w, D = n * I - r * B + s * M + o * h - a * u + c * l;
if (0 === D) return null;
D = 1 / D;
var P = t.m;
P[0] = (y * I - v * B + g * M) * D;
P[1] = (d * B - f * I - p * M) * D;
P[2] = (T * c - w * a + E * o) * D;
P[3] = (x * a - C * c - A * o) * D;
P[4] = (v * h - m * I - g * u) * D;
P[5] = (_ * I - d * h + p * u) * D;
P[6] = (w * s - S * c - E * r) * D;
P[7] = (b * c - x * s + A * r) * D;
P[8] = (m * B - y * h + g * l) * D;
P[9] = (f * h - _ * B - p * l) * D;
P[10] = (S * a - T * s + E * n) * D;
P[11] = (C * s - b * a - A * n) * D;
P[12] = (y * u - m * M - v * l) * D;
P[13] = (_ * M - f * u + d * l) * D;
P[14] = (T * r - S * o - w * n) * D;
P[15] = (b * o - C * r + x * n) * D;
return t;
};
i.determinant = function(t) {
var e = t.m;
_ = e[0];
f = e[1];
d = e[2];
p = e[3];
m = e[4];
y = e[5];
v = e[6];
g = e[7];
b = e[8];
C = e[9];
x = e[10];
A = e[11];
S = e[12];
T = e[13];
w = e[14];
E = e[15];
return (_ * y - f * m) * (x * E - A * w) - (_ * v - d * m) * (C * E - A * T) + (_ * g - p * m) * (C * w - x * T) + (f * v - d * y) * (b * E - A * S) - (f * g - p * y) * (b * w - x * S) + (d * g - p * v) * (b * T - C * S);
};
i.multiply = function(t, e, i) {
var n = t.m, r = e.m, s = i.m;
_ = r[0];
f = r[1];
d = r[2];
p = r[3];
m = r[4];
y = r[5];
v = r[6];
g = r[7];
b = r[8];
C = r[9];
x = r[10];
A = r[11];
S = r[12];
T = r[13];
w = r[14];
E = r[15];
var o = s[0], a = s[1], c = s[2], l = s[3];
n[0] = o * _ + a * m + c * b + l * S;
n[1] = o * f + a * y + c * C + l * T;
n[2] = o * d + a * v + c * x + l * w;
n[3] = o * p + a * g + c * A + l * E;
o = s[4];
a = s[5];
c = s[6];
l = s[7];
n[4] = o * _ + a * m + c * b + l * S;
n[5] = o * f + a * y + c * C + l * T;
n[6] = o * d + a * v + c * x + l * w;
n[7] = o * p + a * g + c * A + l * E;
o = s[8];
a = s[9];
c = s[10];
l = s[11];
n[8] = o * _ + a * m + c * b + l * S;
n[9] = o * f + a * y + c * C + l * T;
n[10] = o * d + a * v + c * x + l * w;
n[11] = o * p + a * g + c * A + l * E;
o = s[12];
a = s[13];
c = s[14];
l = s[15];
n[12] = o * _ + a * m + c * b + l * S;
n[13] = o * f + a * y + c * C + l * T;
n[14] = o * d + a * v + c * x + l * w;
n[15] = o * p + a * g + c * A + l * E;
return t;
};
i.transform = function(t, e, i) {
var n = i.x, r = i.y, s = i.z, o = t.m, a = e.m;
if (e === t) {
o[12] = a[0] * n + a[4] * r + a[8] * s + a[12];
o[13] = a[1] * n + a[5] * r + a[9] * s + a[13];
o[14] = a[2] * n + a[6] * r + a[10] * s + a[14];
o[15] = a[3] * n + a[7] * r + a[11] * s + a[15];
} else {
_ = a[0];
f = a[1];
d = a[2];
p = a[3];
m = a[4];
y = a[5];
v = a[6];
g = a[7];
b = a[8];
C = a[9];
x = a[10];
A = a[11];
S = a[12];
T = a[13];
w = a[14];
E = a[15];
o[0] = _;
o[1] = f;
o[2] = d;
o[3] = p;
o[4] = m;
o[5] = y;
o[6] = v;
o[7] = g;
o[8] = b;
o[9] = C;
o[10] = x;
o[11] = A;
o[12] = _ * n + m * r + b * s + a[12];
o[13] = f * n + y * r + C * s + a[13];
o[14] = d * n + v * r + x * s + a[14];
o[15] = p * n + g * r + A * s + a[15];
}
return t;
};
i.translate = function(t, e, i) {
var n = t.m, r = e.m;
if (e === t) {
n[12] += i.x;
n[13] += i.y;
n[14] += i.z;
} else {
n[0] = r[0];
n[1] = r[1];
n[2] = r[2];
n[3] = r[3];
n[4] = r[4];
n[5] = r[5];
n[6] = r[6];
n[7] = r[7];
n[8] = r[8];
n[9] = r[9];
n[10] = r[10];
n[11] = r[11];
n[12] += i.x;
n[13] += i.y;
n[14] += i.z;
n[15] = r[15];
}
return t;
};
i.scale = function(t, e, i) {
var n = i.x, r = i.y, s = i.z, o = t.m, a = e.m;
o[0] = a[0] * n;
o[1] = a[1] * n;
o[2] = a[2] * n;
o[3] = a[3] * n;
o[4] = a[4] * r;
o[5] = a[5] * r;
o[6] = a[6] * r;
o[7] = a[7] * r;
o[8] = a[8] * s;
o[9] = a[9] * s;
o[10] = a[10] * s;
o[11] = a[11] * s;
o[12] = a[12];
o[13] = a[13];
o[14] = a[14];
o[15] = a[15];
return t;
};
i.rotate = function(t, e, i, n) {
var r = n.x, s = n.y, o = n.z, c = Math.sqrt(r * r + s * s + o * o);
if (Math.abs(c) < a.EPSILON) return null;
r *= c = 1 / c;
s *= c;
o *= c;
var l = Math.sin(i), u = Math.cos(i), h = 1 - u, S = e.m;
_ = S[0];
f = S[1];
d = S[2];
p = S[3];
m = S[4];
y = S[5];
v = S[6];
g = S[7];
b = S[8];
C = S[9];
x = S[10];
A = S[11];
var T = r * r * h + u, w = s * r * h + o * l, E = o * r * h - s * l, M = r * s * h - o * l, B = s * s * h + u, I = o * s * h + r * l, D = r * o * h + s * l, P = s * o * h - r * l, R = o * o * h + u, L = t.m;
L[0] = _ * T + m * w + b * E;
L[1] = f * T + y * w + C * E;
L[2] = d * T + v * w + x * E;
L[3] = p * T + g * w + A * E;
L[4] = _ * M + m * B + b * I;
L[5] = f * M + y * B + C * I;
L[6] = d * M + v * B + x * I;
L[7] = p * M + g * B + A * I;
L[8] = _ * D + m * P + b * R;
L[9] = f * D + y * P + C * R;
L[10] = d * D + v * P + x * R;
L[11] = p * D + g * P + A * R;
if (e !== t) {
L[12] = S[12];
L[13] = S[13];
L[14] = S[14];
L[15] = S[15];
}
return t;
};
i.rotateX = function(t, e, i) {
var n = t.m, r = e.m, s = Math.sin(i), o = Math.cos(i), a = r[4], c = r[5], l = r[6], u = r[7], h = r[8], _ = r[9], f = r[10], d = r[11];
if (e !== t) {
n[0] = r[0];
n[1] = r[1];
n[2] = r[2];
n[3] = r[3];
n[12] = r[12];
n[13] = r[13];
n[14] = r[14];
n[15] = r[15];
}
n[4] = a * o + h * s;
n[5] = c * o + _ * s;
n[6] = l * o + f * s;
n[7] = u * o + d * s;
n[8] = h * o - a * s;
n[9] = _ * o - c * s;
n[10] = f * o - l * s;
n[11] = d * o - u * s;
return t;
};
i.rotateY = function(t, e, i) {
var n = t.m, r = e.m, s = Math.sin(i), o = Math.cos(i), a = r[0], c = r[1], l = r[2], u = r[3], h = r[8], _ = r[9], f = r[10], d = r[11];
if (e !== t) {
n[4] = r[4];
n[5] = r[5];
n[6] = r[6];
n[7] = r[7];
n[12] = r[12];
n[13] = r[13];
n[14] = r[14];
n[15] = r[15];
}
n[0] = a * o - h * s;
n[1] = c * o - _ * s;
n[2] = l * o - f * s;
n[3] = u * o - d * s;
n[8] = a * s + h * o;
n[9] = c * s + _ * o;
n[10] = l * s + f * o;
n[11] = u * s + d * o;
return t;
};
i.rotateZ = function(t, e, i) {
var n = e.m, r = t.m, s = Math.sin(i), o = Math.cos(i), a = e.m[0], c = e.m[1], l = e.m[2], u = e.m[3], h = e.m[4], _ = e.m[5], f = e.m[6], d = e.m[7];
if (e !== t) {
r[8] = n[8];
r[9] = n[9];
r[10] = n[10];
r[11] = n[11];
r[12] = n[12];
r[13] = n[13];
r[14] = n[14];
r[15] = n[15];
}
r[0] = a * o + h * s;
r[1] = c * o + _ * s;
r[2] = l * o + f * s;
r[3] = u * o + d * s;
r[4] = h * o - a * s;
r[5] = _ * o - c * s;
r[6] = f * o - l * s;
r[7] = d * o - u * s;
return t;
};
i.fromTranslation = function(t, e) {
var i = t.m;
i[0] = 1;
i[1] = 0;
i[2] = 0;
i[3] = 0;
i[4] = 0;
i[5] = 1;
i[6] = 0;
i[7] = 0;
i[8] = 0;
i[9] = 0;
i[10] = 1;
i[11] = 0;
i[12] = e.x;
i[13] = e.y;
i[14] = e.z;
i[15] = 1;
return t;
};
i.fromScaling = function(t, e) {
var i = t.m;
i[0] = e.x;
i[1] = 0;
i[2] = 0;
i[3] = 0;
i[4] = 0;
i[5] = e.y;
i[6] = 0;
i[7] = 0;
i[8] = 0;
i[9] = 0;
i[10] = e.z;
i[11] = 0;
i[12] = 0;
i[13] = 0;
i[14] = 0;
i[15] = 1;
return t;
};
i.fromRotation = function(t, e, i) {
var n = i.x, r = i.y, s = i.z, o = Math.sqrt(n * n + r * r + s * s);
if (Math.abs(o) < a.EPSILON) return null;
n *= o = 1 / o;
r *= o;
s *= o;
var c = Math.sin(e), l = Math.cos(e), u = 1 - l, h = t.m;
h[0] = n * n * u + l;
h[1] = r * n * u + s * c;
h[2] = s * n * u - r * c;
h[3] = 0;
h[4] = n * r * u - s * c;
h[5] = r * r * u + l;
h[6] = s * r * u + n * c;
h[7] = 0;
h[8] = n * s * u + r * c;
h[9] = r * s * u - n * c;
h[10] = s * s * u + l;
h[11] = 0;
h[12] = 0;
h[13] = 0;
h[14] = 0;
h[15] = 1;
return t;
};
i.fromXRotation = function(t, e) {
var i = Math.sin(e), n = Math.cos(e), r = t.m;
r[0] = 1;
r[1] = 0;
r[2] = 0;
r[3] = 0;
r[4] = 0;
r[5] = n;
r[6] = i;
r[7] = 0;
r[8] = 0;
r[9] = -i;
r[10] = n;
r[11] = 0;
r[12] = 0;
r[13] = 0;
r[14] = 0;
r[15] = 1;
return t;
};
i.fromYRotation = function(t, e) {
var i = Math.sin(e), n = Math.cos(e), r = t.m;
r[0] = n;
r[1] = 0;
r[2] = -i;
r[3] = 0;
r[4] = 0;
r[5] = 1;
r[6] = 0;
r[7] = 0;
r[8] = i;
r[9] = 0;
r[10] = n;
r[11] = 0;
r[12] = 0;
r[13] = 0;
r[14] = 0;
r[15] = 1;
return t;
};
i.fromZRotation = function(t, e) {
var i = Math.sin(e), n = Math.cos(e), r = t.m;
r[0] = n;
r[1] = i;
r[2] = 0;
r[3] = 0;
r[4] = -i;
r[5] = n;
r[6] = 0;
r[7] = 0;
r[8] = 0;
r[9] = 0;
r[10] = 1;
r[11] = 0;
r[12] = 0;
r[13] = 0;
r[14] = 0;
r[15] = 1;
return t;
};
i.fromRT = function(t, e, i) {
var n = e.x, r = e.y, s = e.z, o = e.w, a = n + n, c = r + r, l = s + s, u = n * a, h = n * c, _ = n * l, f = r * c, d = r * l, p = s * l, m = o * a, y = o * c, v = o * l, g = t.m;
g[0] = 1 - (f + p);
g[1] = h + v;
g[2] = _ - y;
g[3] = 0;
g[4] = h - v;
g[5] = 1 - (u + p);
g[6] = d + m;
g[7] = 0;
g[8] = _ + y;
g[9] = d - m;
g[10] = 1 - (u + f);
g[11] = 0;
g[12] = i.x;
g[13] = i.y;
g[14] = i.z;
g[15] = 1;
return t;
};
i.getTranslation = function(t, e) {
var i = e.m;
t.x = i[12];
t.y = i[13];
t.z = i[14];
return t;
};
i.getScaling = function(t, e) {
var i = e.m, n = I.m, r = n[0] = i[0], s = n[1] = i[1], o = n[2] = i[2], a = n[3] = i[4], l = n[4] = i[5], u = n[5] = i[6], h = n[6] = i[8], _ = n[7] = i[9], f = n[8] = i[10];
t.x = Math.sqrt(r * r + s * s + o * o);
t.y = Math.sqrt(a * a + l * l + u * u);
t.z = Math.sqrt(h * h + _ * _ + f * f);
c.default.determinant(I) < 0 && (t.x *= -1);
return t;
};
i.getRotation = function(t, e) {
var i = e.m, n = i[0] + i[5] + i[10], r = 0;
if (n > 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;
} else if (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;
} else if (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;
} else {
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;
}
return t;
};
i.toRTS = function(t, e, i, n) {
var r = t.m, a = I.m;
n.x = s.default.set(B, r[0], r[1], r[2]).mag();
a[0] = r[0] / n.x;
a[1] = r[1] / n.x;
a[2] = r[2] / n.x;
n.y = s.default.set(B, r[4], r[5], r[6]).mag();
a[3] = r[4] / n.y;
a[4] = r[5] / n.y;
a[5] = r[6] / n.y;
n.z = s.default.set(B, r[8], r[9], r[10]).mag();
a[6] = r[8] / n.z;
a[7] = r[9] / n.z;
a[8] = r[10] / n.z;
if (c.default.determinant(I) < 0) {
n.x *= -1;
a[0] *= -1;
a[1] *= -1;
a[2] *= -1;
}
o.default.fromMat3(e, I);
s.default.set(i, r[12], r[13], r[14]);
};
i.fromRTS = function(t, e, i, n) {
var r = e.x, s = e.y, o = e.z, a = e.w, c = r + r, l = s + s, u = o + o, h = r * c, _ = r * l, f = r * u, d = s * l, p = s * u, m = o * u, y = a * c, v = a * l, g = a * u, b = n.x, C = n.y, x = n.z, A = t.m;
A[0] = (1 - (d + m)) * b;
A[1] = (_ + g) * b;
A[2] = (f - v) * b;
A[3] = 0;
A[4] = (_ - g) * C;
A[5] = (1 - (h + m)) * C;
A[6] = (p + y) * C;
A[7] = 0;
A[8] = (f + v) * x;
A[9] = (p - y) * x;
A[10] = (1 - (h + d)) * x;
A[11] = 0;
A[12] = i.x;
A[13] = i.y;
A[14] = i.z;
A[15] = 1;
return t;
};
i.fromRTSOrigin = function(t, e, i, n, r) {
var s = e.x, o = e.y, a = e.z, c = e.w, l = s + s, u = o + o, h = a + a, _ = s * l, f = s * u, d = s * h, p = o * u, m = o * h, y = a * h, v = c * l, g = c * u, b = c * h, C = n.x, x = n.y, A = n.z, S = r.x, T = r.y, w = r.z, E = t.m;
E[0] = (1 - (p + y)) * C;
E[1] = (f + b) * C;
E[2] = (d - g) * C;
E[3] = 0;
E[4] = (f - b) * x;
E[5] = (1 - (_ + y)) * x;
E[6] = (m + v) * x;
E[7] = 0;
E[8] = (d + g) * A;
E[9] = (m - v) * A;
E[10] = (1 - (_ + p)) * A;
E[11] = 0;
E[12] = i.x + S - (E[0] * S + E[4] * T + E[8] * w);
E[13] = i.y + T - (E[1] * S + E[5] * T + E[9] * w);
E[14] = i.z + w - (E[2] * S + E[6] * T + E[10] * w);
E[15] = 1;
return t;
};
i.fromQuat = function(t, e) {
var i = e.x, n = e.y, r = e.z, s = e.w, o = i + i, a = n + n, c = r + r, l = i * o, u = n * o, h = n * a, _ = r * o, f = r * a, d = r * c, p = s * o, m = s * a, y = s * c, v = t.m;
v[0] = 1 - h - d;
v[1] = u + y;
v[2] = _ - m;
v[3] = 0;
v[4] = u - y;
v[5] = 1 - l - d;
v[6] = f + p;
v[7] = 0;
v[8] = _ + m;
v[9] = f - p;
v[10] = 1 - l - h;
v[11] = 0;
v[12] = 0;
v[13] = 0;
v[14] = 0;
v[15] = 1;
return t;
};
i.frustum = function(t, e, i, n, r, s, o) {
var a = 1 / (i - e), c = 1 / (r - n), l = 1 / (s - o), u = t.m;
u[0] = 2 * s * a;
u[1] = 0;
u[2] = 0;
u[3] = 0;
u[4] = 0;
u[5] = 2 * s * c;
u[6] = 0;
u[7] = 0;
u[8] = (i + e) * a;
u[9] = (r + n) * c;
u[10] = (o + s) * l;
u[11] = -1;
u[12] = 0;
u[13] = 0;
u[14] = o * s * 2 * l;
u[15] = 0;
return t;
};
i.perspective = function(t, e, i, n, r) {
var s = 1 / Math.tan(e / 2), o = 1 / (n - r), a = t.m;
a[0] = s / i;
a[1] = 0;
a[2] = 0;
a[3] = 0;
a[4] = 0;
a[5] = s;
a[6] = 0;
a[7] = 0;
a[8] = 0;
a[9] = 0;
a[10] = (r + n) * o;
a[11] = -1;
a[12] = 0;
a[13] = 0;
a[14] = 2 * r * n * o;
a[15] = 0;
return t;
};
i.ortho = function(t, e, i, n, r, s, o) {
var a = 1 / (e - i), c = 1 / (n - r), l = 1 / (s - o), u = t.m;
u[0] = -2 * a;
u[1] = 0;
u[2] = 0;
u[3] = 0;
u[4] = 0;
u[5] = -2 * c;
u[6] = 0;
u[7] = 0;
u[8] = 0;
u[9] = 0;
u[10] = 2 * l;
u[11] = 0;
u[12] = (e + i) * a;
u[13] = (r + n) * c;
u[14] = (o + s) * l;
u[15] = 1;
return t;
};
i.lookAt = function(t, e, i, n) {
var r = e.x, s = e.y, o = e.z, a = n.x, c = n.y, l = n.z, u = r - i.x, h = s - i.y, _ = o - i.z, f = 1 / Math.sqrt(u * u + h * h + _ * _), d = c * (_ *= f) - l * (h *= f), p = l * (u *= f) - a * _, m = a * h - c * u, y = h * (m *= f = 1 / Math.sqrt(d * d + p * p + m * m)) - _ * (p *= f), v = _ * (d *= f) - u * m, g = u * p - h * d, b = t.m;
b[0] = d;
b[1] = y;
b[2] = u;
b[3] = 0;
b[4] = p;
b[5] = v;
b[6] = h;
b[7] = 0;
b[8] = m;
b[9] = g;
b[10] = _;
b[11] = 0;
b[12] = -(d * r + p * s + m * o);
b[13] = -(y * r + v * s + g * o);
b[14] = -(u * r + h * s + _ * o);
b[15] = 1;
return t;
};
i.inverseTranspose = function(t, e) {
var i = e.m;
_ = i[0];
f = i[1];
d = i[2];
p = i[3];
m = i[4];
y = i[5];
v = i[6];
g = i[7];
b = i[8];
C = i[9];
x = i[10];
A = i[11];
S = i[12];
T = i[13];
w = i[14];
E = i[15];
var n = _ * y - f * m, r = _ * v - d * m, s = _ * g - p * m, o = f * v - d * y, a = f * g - p * y, c = d * g - p * v, l = b * T - C * S, u = b * w - x * S, h = b * E - A * S, M = C * w - x * T, B = C * E - A * T, I = x * E - A * w, D = n * I - r * B + s * M + o * h - a * u + c * l;
if (!D) return null;
D = 1 / D;
(i = t.m)[0] = (y * I - v * B + g * M) * D;
i[1] = (v * h - m * I - g * u) * D;
i[2] = (m * B - y * h + g * l) * D;
i[3] = 0;
i[4] = (d * B - f * I - p * M) * D;
i[5] = (_ * I - d * h + p * u) * D;
i[6] = (f * h - _ * B - p * l) * D;
i[7] = 0;
i[8] = (T * c - w * a + E * o) * D;
i[9] = (w * s - S * c - E * r) * D;
i[10] = (S * a - T * s + E * n) * D;
i[11] = 0;
i[12] = 0;
i[13] = 0;
i[14] = 0;
i[15] = 1;
return t;
};
i.add = function(t, e, i) {
var n = t.m, r = e.m, s = i.m;
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];
return t;
};
i.subtract = function(t, e, i) {
var n = t.m, r = e.m, s = i.m;
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];
return t;
};
i.multiplyScalar = function(t, e, i) {
var n = t.m, r = e.m;
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;
return t;
};
i.multiplyScalarAndAdd = function(t, e, i, n) {
var r = t.m, s = e.m, o = i.m;
r[0] = s[0] + o[0] * n;
r[1] = s[1] + o[1] * n;
r[2] = s[2] + o[2] * n;
r[3] = s[3] + o[3] * n;
r[4] = s[4] + o[4] * n;
r[5] = s[5] + o[5] * n;
r[6] = s[6] + o[6] * n;
r[7] = s[7] + o[7] * n;
r[8] = s[8] + o[8] * n;
r[9] = s[9] + o[9] * n;
r[10] = s[10] + o[10] * n;
r[11] = s[11] + o[11] * n;
r[12] = s[12] + o[12] * n;
r[13] = s[13] + o[13] * n;
r[14] = s[14] + o[14] * n;
r[15] = s[15] + o[15] * n;
return 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 = a.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], o = i[2], a = i[3], c = i[4], l = i[5], u = i[6], h = 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];
n[0] = l * (d * g - p * v) - f * (u * g - h * v) + y * (u * p - h * d);
n[1] = -(s * (d * g - p * v) - f * (o * g - a * v) + y * (o * p - a * d));
n[2] = s * (u * g - h * v) - l * (o * g - a * v) + y * (o * h - a * u);
n[3] = -(s * (u * p - h * d) - l * (o * p - a * d) + f * (o * h - a * u));
n[4] = -(c * (d * g - p * v) - _ * (u * g - h * v) + m * (u * p - h * d));
n[5] = r * (d * g - p * v) - _ * (o * g - a * v) + m * (o * p - a * d);
n[6] = -(r * (u * g - h * v) - c * (o * g - a * v) + m * (o * h - a * u));
n[7] = r * (u * p - h * d) - c * (o * p - a * d) + _ * (o * h - a * u);
n[8] = c * (f * g - p * y) - _ * (l * g - h * y) + m * (l * p - h * f);
n[9] = -(r * (f * g - p * y) - _ * (s * g - a * y) + m * (s * p - a * f));
n[10] = r * (l * g - h * y) - c * (s * g - a * y) + m * (s * h - a * l);
n[11] = -(r * (l * p - h * f) - c * (s * p - a * f) + _ * (s * h - a * l));
n[12] = -(c * (f * v - d * y) - _ * (l * v - u * y) + m * (l * d - u * f));
n[13] = r * (f * v - d * y) - _ * (s * v - o * y) + m * (s * d - o * f);
n[14] = -(r * (l * v - u * y) - c * (s * v - o * y) + m * (s * u - o * l));
n[15] = r * (l * d - u * f) - c * (s * d - o * f) + _ * (s * u - o * l);
return 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;
};
function i(e, i, n, r, s, o, c, l, u, h, _, f, d, p, m, y) {
var v;
void 0 === e && (e = 1);
void 0 === i && (i = 0);
void 0 === n && (n = 0);
void 0 === r && (r = 0);
void 0 === s && (s = 0);
void 0 === o && (o = 1);
void 0 === c && (c = 0);
void 0 === l && (l = 0);
void 0 === u && (u = 0);
void 0 === h && (h = 0);
void 0 === _ && (_ = 1);
void 0 === f && (f = 0);
void 0 === d && (d = 0);
void 0 === p && (p = 0);
void 0 === m && (m = 0);
void 0 === y && (y = 1);
(v = t.call(this) || this).m = void 0;
if (e instanceof a.FLOAT_ARRAY_TYPE) v.m = e; else {
v.m = new a.FLOAT_ARRAY_TYPE(16);
var g = v.m;
g[0] = e;
g[1] = i;
g[2] = n;
g[3] = r;
g[4] = s;
g[5] = o;
g[6] = c;
g[7] = l;
g[8] = u;
g[9] = h;
g[10] = _;
g[11] = f;
g[12] = d;
g[13] = p;
g[14] = m;
g[15] = y;
}
return v;
}
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;
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];
return 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) {
t = t || new i();
return i.transpose(t, this);
};
e.invert = function(t) {
t = t || new i();
return i.invert(t, this);
};
e.adjoint = function(t) {
t = t || new i();
return i.adjoint(t, this);
};
e.determinant = function() {
return i.determinant(this);
};
e.add = function(t, e) {
e = e || new i();
return 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) {
e = e || new i();
return i.translate(e, this, t);
};
e.scale = function(t, e) {
e = e || new i();
return i.scale(e, this, t);
};
e.rotate = function(t, e, n) {
n = n || new i();
return i.rotate(n, this, t, e);
};
e.getTranslation = function(t) {
t = t || new s.default();
return i.getTranslation(t, this);
};
e.getScale = function(t) {
t = t || new s.default();
return i.getScaling(t, this);
};
e.getRotation = function(t) {
t = t || new o.default();
return 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);
};
return i;
})(n.default);
i.default = M;
M.mul = M.multiply;
M.sub = M.subtract;
M.IDENTITY = Object.freeze(new M());
var B = new s.default(), I = new c.default();
r.default.fastDefine("cc.Mat4", M, {
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 D = function(t) {
Object.defineProperty(M.prototype, "m" + t, {
get: function() {
return this.m[t];
},
set: function(e) {
this.m[t] = e;
}
});
}, P = 0; P < 16; P++) D(P);
cc.mat4 = function(t, e, i, n, r, s, o, a, c, l, u, h, _, f, d, p) {
var m = new M(t, e, i, n, r, s, o, a, c, l, u, h, _, f, d, p);
void 0 === t && M.identity(m);
return m;
};
cc.Mat4 = M;
e.exports = i.default;
}), {
"../platform/CCClass": 239,
"./mat3": 338,
"./quat": 340,
"./utils": 344,
"./value-type": 345,
"./vec3": 347
} ],
340: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = c(t("./value-type")), r = c(t("../platform/CCClass")), s = c(t("./vec3")), o = c(t("./mat3")), a = t("./utils");
function c(t) {
return t && t.__esModule ? t : {
default: t
};
}
function l(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
u(t, e);
}
function u(t, e) {
return (u = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var h = 0, _ = 0, f = 0, d = 0, p = (function(t) {
l(i, t);
var e = i.prototype;
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) {
t.x = e.x;
t.y = e.y;
t.z = e.z;
t.w = e.w;
return t;
};
i.set = function(t, e, i, n, r) {
t.x = e;
t.y = i;
t.z = n;
t.w = r;
return t;
};
i.identity = function(t) {
t.x = 0;
t.y = 0;
t.z = 0;
t.w = 1;
return t;
};
i.rotationTo = function(t, e, n) {
var r = s.default.dot(e, n);
if (r < -.999999) {
s.default.cross(v, s.default.RIGHT, e);
v.mag() < 1e-6 && s.default.cross(v, s.default.UP, e);
s.default.normalize(v, v);
i.fromAxisAngle(t, v, Math.PI);
return t;
}
if (r > .999999) {
t.x = 0;
t.y = 0;
t.z = 0;
t.w = 1;
return t;
}
s.default.cross(v, e, n);
t.x = v.x;
t.y = v.y;
t.z = v.z;
t.w = 1 + r;
return i.normalize(t, t);
};
i.getAxisAngle = function(t, e) {
var i = 2 * Math.acos(e.w), n = Math.sin(i / 2);
if (0 !== n) {
t.x = e.x / n;
t.y = e.y / n;
t.z = e.z / n;
} else {
t.x = 1;
t.y = 0;
t.z = 0;
}
return i;
};
i.multiply = function(t, e, i) {
h = e.x * i.w + e.w * i.x + e.y * i.z - e.z * i.y;
_ = e.y * i.w + e.w * i.y + e.z * i.x - e.x * i.z;
f = e.z * i.w + e.w * i.z + e.x * i.y - e.y * i.x;
d = e.w * i.w - e.x * i.x - e.y * i.y - e.z * i.z;
t.x = h;
t.y = _;
t.z = f;
t.w = d;
return t;
};
i.multiplyScalar = function(t, e, i) {
t.x = e.x * i;
t.y = e.y * i;
t.z = e.z * i;
t.w = e.w * i;
return t;
};
i.scaleAndAdd = function(t, e, i, n) {
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;
return t;
};
i.rotateX = function(t, e, i) {
i *= .5;
var n = Math.sin(i), r = Math.cos(i);
h = e.x * r + e.w * n;
_ = e.y * r + e.z * n;
f = e.z * r - e.y * n;
d = e.w * r - e.x * n;
t.x = h;
t.y = _;
t.z = f;
t.w = d;
return t;
};
i.rotateY = function(t, e, i) {
i *= .5;
var n = Math.sin(i), r = Math.cos(i);
h = e.x * r - e.z * n;
_ = e.y * r + e.w * n;
f = e.z * r + e.x * n;
d = e.w * r - e.y * n;
t.x = h;
t.y = _;
t.z = f;
t.w = d;
return t;
};
i.rotateZ = function(t, e, i) {
i *= .5;
var n = Math.sin(i), r = Math.cos(i);
h = e.x * r + e.y * n;
_ = e.y * r - e.x * n;
f = e.z * r + e.w * n;
d = e.w * r - e.z * n;
t.x = h;
t.y = _;
t.z = f;
t.w = d;
return t;
};
i.rotateAround = function(t, e, n, r) {
i.invert(m, e);
s.default.transformQuat(v, n, m);
i.fromAxisAngle(m, v, r);
i.multiply(t, e, m);
return t;
};
i.rotateAroundLocal = function(t, e, n, r) {
i.fromAxisAngle(m, n, r);
i.multiply(t, e, m);
return t;
};
i.calculateW = function(t, e) {
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));
return 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) {
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);
return t;
};
i.slerp = function(t, e, i, n) {
var r = 0, s = 0, o = e.x * i.x + e.y * i.y + e.z * i.z + e.w * i.w;
if (o < 0) {
o = -o;
i.x = -i.x;
i.y = -i.y;
i.z = -i.z;
i.w = -i.w;
}
if (1 - o > 1e-6) {
var a = Math.acos(o), c = Math.sin(a);
r = Math.sin((1 - n) * a) / c;
s = Math.sin(n * a) / c;
} else {
r = 1 - n;
s = n;
}
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;
return t;
};
i.sqlerp = function(t, e, n, r, s, o) {
i.slerp(m, e, s, o);
i.slerp(y, n, r, o);
i.slerp(t, m, y, 2 * o * (1 - o));
return 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;
t.x = -e.x * n;
t.y = -e.y * n;
t.z = -e.z * n;
t.w = e.w * n;
return t;
};
i.conjugate = function(t, e) {
t.x = -e.x;
t.y = -e.y;
t.z = -e.z;
t.w = e.w;
return 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;
if (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;
}
return t;
};
i.fromAxes = function(t, e, n, r) {
o.default.set(g, e.x, e.y, e.z, n.x, n.y, n.z, r.x, r.y, r.z);
return i.normalize(t, i.fromMat3(t, g));
};
i.fromViewUp = function(t, e, n) {
o.default.fromViewUp(g, e, n);
return i.normalize(t, i.fromMat3(t, g));
};
i.fromAxisAngle = function(t, e, i) {
i *= .5;
var n = Math.sin(i);
t.x = n * e.x;
t.y = n * e.y;
t.z = n * e.z;
t.w = Math.cos(i);
return t;
};
i.fromAngleZ = function(t, e) {
e *= b;
t.x = t.y = 0;
t.z = Math.sin(e);
t.w = Math.cos(e);
return t;
};
i.fromMat3 = function(t, e) {
var i = e.m, n = i[0], r = i[1], s = i[2], o = i[3], a = i[4], c = i[5], l = i[6], u = i[7], h = i[8], _ = n + a + h;
if (_ > 0) {
var f = .5 / Math.sqrt(_ + 1);
t.w = .25 / f;
t.x = (c - u) * f;
t.y = (l - s) * f;
t.z = (r - o) * f;
} else if (n > a && n > h) {
var d = 2 * Math.sqrt(1 + n - a - h);
t.w = (c - u) / d;
t.x = .25 * d;
t.y = (o + r) / d;
t.z = (l + s) / d;
} else if (a > h) {
var p = 2 * Math.sqrt(1 + a - n - h);
t.w = (l - s) / p;
t.x = (o + r) / p;
t.y = .25 * p;
t.z = (u + c) / p;
} else {
var m = 2 * Math.sqrt(1 + h - n - a);
t.w = (r - o) / m;
t.x = (l + s) / m;
t.y = (u + c) / m;
t.z = .25 * m;
}
return t;
};
i.fromEuler = function(t, e, i, n) {
e *= b;
i *= b;
n *= b;
var r = Math.sin(e), s = Math.cos(e), o = Math.sin(i), a = Math.cos(i), c = Math.sin(n), l = Math.cos(n);
t.x = r * a * l + s * o * c;
t.y = s * o * l + r * a * c;
t.z = s * a * c - r * o * l;
t.w = s * a * l - r * o * c;
return t;
};
i.toAxisX = function(t, e) {
var i = 2 * e.y, n = 2 * e.z;
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;
return t;
};
i.toAxisY = function(t, e) {
var i = 2 * e.x, n = 2 * e.y, r = 2 * e.z;
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;
return t;
};
i.toAxisZ = function(t, e) {
var i = 2 * e.x, n = 2 * e.y, r = 2 * e.z;
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;
return t;
};
i.toEuler = function(t, e, i) {
var n = e.x, r = e.y, s = e.z, o = e.w, c = 0, l = 0, u = 0, h = n * r + s * o;
if (h > .499999) {
c = 0;
l = (0, a.toDegree)(2 * Math.atan2(n, o));
u = 90;
} else if (h < -.499999) {
c = 0;
l = -(0, a.toDegree)(2 * Math.atan2(n, o));
u = -90;
} else {
var _ = n * n, f = r * r, d = s * s;
c = (0, a.toDegree)(Math.atan2(2 * n * o - 2 * r * s, 1 - 2 * _ - 2 * d));
l = (0, a.toDegree)(Math.atan2(2 * r * o - 2 * n * s, 1 - 2 * f - 2 * d));
u = (0, a.toDegree)(Math.asin(2 * h));
if (i) {
c = -180 * Math.sign(c + 1e-6) + c;
l = -180 * Math.sign(l + 1e-6) + l;
u = 180 * Math.sign(u + 1e-6) - u;
}
}
t.x = c;
t.y = l;
t.z = u;
return 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) {
void 0 === i && (i = a.EPSILON);
return 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) {
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;
return t;
};
i.fromArray = function(t, e, i) {
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];
return t;
};
function i(e, i, n, r) {
var s;
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;
if (e && "object" == typeof e) {
s.x = e.x;
s.y = e.y;
s.z = e.z;
s.w = e.w;
} else {
s.x = e;
s.y = i;
s.z = n;
s.w = r;
}
return s;
}
e.clone = function() {
return new i(this.x, this.y, this.z, this.w);
};
e.set = function(t) {
this.x = t.x;
this.y = t.y;
this.z = t.z;
this.w = t.w;
return 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) {
n = n || new i();
i.slerp(n, this, t, e);
return n;
};
e.multiply = function(t) {
return i.multiply(this, this, t);
};
e.rotateAround = function(t, e, n, r) {
r = r || new i();
return i.rotateAround(r, t, e, n);
};
return i;
})(n.default);
i.default = p;
p.mul = p.multiply;
p.scale = p.multiplyScalar;
p.mag = p.len;
p.IDENTITY = Object.freeze(new p());
var m = new p(), y = new p(), v = new s.default(), g = new o.default(), b = .5 * Math.PI / 180;
r.default.fastDefine("cc.Quat", p, {
x: 0,
y: 0,
z: 0,
w: 1
});
cc.quat = function(t, e, i, n) {
return new p(t, e, i, n);
};
cc.Quat = p;
e.exports = i.default;
}), {
"../platform/CCClass": 239,
"./mat3": 338,
"./utils": 344,
"./value-type": 345,
"./vec3": 347
} ],
341: [ (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("./vec2")), o = a(t("./size"));
function a(t) {
return t && t.__esModule ? t : {
default: t
};
}
function c(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function l(t, e, i) {
e && c(t.prototype, e);
i && c(t, i);
return t;
}
function u(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
h(t, e);
}
function h(t, e) {
return (h = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var _ = (function(t) {
u(e, t);
e.fromMinMax = function(t, i) {
var n = Math.min(t.x, i.x), r = Math.min(t.y, i.y);
return new e(n, r, Math.max(t.x, i.x) - n, Math.max(t.y, i.y) - r);
};
function e(e, i, n, r) {
var s;
void 0 === e && (e = 0);
void 0 === i && (i = 0);
void 0 === n && (n = 0);
void 0 === r && (r = 0);
(s = t.call(this) || this).x = void 0;
s.y = void 0;
s.width = void 0;
s.height = void 0;
if (e && "object" == typeof e) {
i = e.y;
n = e.width;
r = e.height;
e = e.x;
}
s.x = e || 0;
s.y = i || 0;
s.width = n || 0;
s.height = r || 0;
return s;
}
var i = e.prototype;
i.clone = function() {
return new e(this.x, this.y, this.width, this.height);
};
i.equals = function(t) {
return t && this.x === t.x && this.y === t.y && this.width === t.width && this.height === t.height;
};
i.lerp = function(t, i, n) {
n = n || new e();
var r = this.x, s = this.y, o = this.width, a = this.height;
n.x = r + (t.x - r) * i;
n.y = s + (t.y - s) * i;
n.width = o + (t.width - o) * i;
n.height = a + (t.height - a) * i;
return n;
};
i.set = function(t) {
this.x = t.x;
this.y = t.y;
this.width = t.width;
this.height = t.height;
return this;
};
i.intersects = function(t) {
var e = this.x + this.width, i = this.y + this.height, n = t.x + t.width, r = t.y + t.height;
return !(e < t.x || n < this.x || i < t.y || r < this.y);
};
i.intersection = function(t, e) {
var i = this.x, n = this.y, r = this.x + this.width, s = this.y + this.height, o = e.x, a = e.y, c = e.x + e.width, l = e.y + e.height;
t.x = Math.max(i, o);
t.y = Math.max(n, a);
t.width = Math.min(r, c) - t.x;
t.height = Math.min(s, l) - t.y;
return t;
};
i.contains = function(t) {
return this.x <= t.x && this.x + this.width >= 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, o = e.x, a = e.y, c = e.width, l = e.height;
t.x = Math.min(i, o);
t.y = Math.min(n, a);
t.width = Math.max(i + r, o + c) - t.x;
t.height = Math.max(n + s, a + l) - t.y;
return t;
};
i.transformMat4 = function(t, e) {
var i = this.x, n = this.y, r = i + this.width, s = n + this.height, o = e.m, a = o[0] * i + o[4] * n + o[12], c = o[1] * i + o[5] * n + o[13], l = o[0] * r + o[4] * n + o[12], u = o[1] * r + o[5] * n + o[13], h = o[0] * i + o[4] * s + o[12], _ = o[1] * i + o[5] * s + o[13], f = o[0] * r + o[4] * s + o[12], d = o[1] * r + o[5] * s + o[13], p = Math.min(a, l, h, f), m = Math.max(a, l, h, f), y = Math.min(c, u, _, d), v = Math.max(c, u, _, d);
t.x = p;
t.y = y;
t.width = m - p;
t.height = v - y;
return t;
};
i.toString = function() {
return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.width.toFixed(2) + ", " + this.height.toFixed(2) + ")";
};
l(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 o.default(this.width, this.height);
},
set: function(t) {
this.width = t.width;
this.height = t.height;
}
} ]);
return e;
})(n.default);
i.default = _;
r.default.fastDefine("cc.Rect", _, {
x: 0,
y: 0,
width: 0,
height: 0
});
cc.Rect = _;
cc.rect = function(t, e, i, n) {
return new _(t, e, i, n);
};
e.exports = i.default;
}), {
"../platform/CCClass": 239,
"./size": 342,
"./value-type": 345,
"./vec2": 346
} ],
342: [ (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 o(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function a(t, e, i) {
e && o(t.prototype, e);
i && o(t, i);
return t;
}
function c(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
l(t, e);
}
function l(t, e) {
return (l = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var u = (function(t) {
c(e, t);
function e(e, i) {
var n;
void 0 === e && (e = 0);
void 0 === i && (i = 0);
(n = t.call(this) || this).width = void 0;
n.height = void 0;
if (e && "object" == typeof e) {
n.width = e.width;
n.height = e.height;
} else {
n.width = e || 0;
n.height = i || 0;
}
return n;
}
var i = e.prototype;
i.clone = function() {
return new e(this.width, this.height);
};
i.equals = function(t) {
return t && this.width === t.width && this.height === t.height;
};
i.lerp = function(t, i, n) {
n = n || new e();
var r = this.width, s = this.height;
n.width = r + (t.width - r) * i;
n.height = s + (t.height - s) * i;
return n;
};
i.set = function(t) {
this.width = t.width;
this.height = t.height;
return this;
};
i.toString = function() {
return "(" + this.width.toFixed(2) + ", " + this.height.toFixed(2) + ")";
};
a(e, null, [ {
key: "ZERO",
get: function() {
return new e();
}
} ]);
return e;
})(n.default);
i.default = u;
u.ZERO_R = u.ZERO;
r.default.fastDefine("cc.Size", u, {
width: 0,
height: 0
});
cc.size = function(t, e) {
return new u(t, e);
};
cc.Size = u;
e.exports = i.default;
}), {
"../platform/CCClass": 239,
"./value-type": 345
} ],
343: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("./quat")) && n.__esModule ? n : {
default: n
}, s = new r.default(), o = (function() {
function t() {}
t.toRotation = function(t, e) {
t.x = e[3];
t.y = e[4];
t.z = e[5];
t.w = e[6];
return t;
};
t.fromRotation = function(t, e) {
t[3] = e.x;
t[4] = e.y;
t[5] = e.z;
t[6] = e.w;
return t;
};
t.toEuler = function(e, i) {
t.toRotation(s, i);
r.default.toEuler(e, s);
return e;
};
t.fromEuler = function(e, i) {
r.default.fromEuler(s, i.x, i.y, i.z);
t.fromRotation(e, s);
return e;
};
t.fromEulerNumber = function(e, i, n, o) {
r.default.fromEuler(s, i, n, o);
t.fromRotation(e, s);
return e;
};
t.toScale = function(t, e) {
t.x = e[7];
t.y = e[8];
t.z = e[9];
return t;
};
t.fromScale = function(t, e) {
t[7] = e.x;
t[8] = e.y;
t[9] = e.z;
return t;
};
t.toPosition = function(t, e) {
t.x = e[0];
t.y = e[1];
t.z = e[2];
return t;
};
t.fromPosition = function(t, e) {
t[0] = e.x;
t[1] = e.y;
t[2] = e.z;
return t;
};
t.fromAngleZ = function(e, i) {
r.default.fromAngleZ(s, i);
t.fromRotation(e, s);
return e;
};
t.toMat4 = function(t, e) {
var i = e[3], n = e[4], r = e[5], s = e[6], o = i + i, a = n + n, c = r + r, l = i * o, u = i * a, h = i * c, _ = n * a, f = n * c, d = r * c, p = s * o, m = s * a, y = s * c, v = e[7], g = e[8], b = e[9], C = t.m;
C[0] = (1 - (_ + d)) * v;
C[1] = (u + y) * v;
C[2] = (h - m) * v;
C[3] = 0;
C[4] = (u - y) * g;
C[5] = (1 - (l + d)) * g;
C[6] = (f + p) * g;
C[7] = 0;
C[8] = (h + m) * b;
C[9] = (f - p) * b;
C[10] = (1 - (l + _)) * b;
C[11] = 0;
C[12] = e[0];
C[13] = e[1];
C[14] = e[2];
C[15] = 1;
return t;
};
return t;
})();
i.default = o;
cc.Trs = o;
e.exports = i.default;
}), {
"./quat": 340
} ],
344: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.equals = function(t, e) {
return Math.abs(t - e) <= s * Math.max(1, Math.abs(t), Math.abs(e));
};
i.approx = function(t, e, i) {
i = i || s;
return Math.abs(t - e) <= i;
};
i.clamp = function(t, e, i) {
return t < e ? e : t > i ? 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 = c;
i.randomRangeInt = function(t, e) {
return Math.floor(c(t, e));
};
i.pseudoRandom = l;
i.pseudoRandomRange = u;
i.pseudoRandomRangeInt = function(t, e, i) {
return Math.floor(u(t, e, i));
};
i.nextPow2 = function(t) {
t = (t = (t = (t = (t = --t >> 1 | t) >> 2 | t) >> 4 | t) >> 8 | t) >> 16 | t;
return ++t;
};
i.repeat = h;
i.pingPong = function(t, e) {
t = h(t, 2 * e);
return 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 o = Float32Array;
i.FLOAT_ARRAY_TYPE = o;
i.FLOAT_BYTES = 4;
var a = Math.random;
i.random = a;
function c(t, e) {
return Math.random() * (e - t) + t;
}
function l(t) {
return (t = (9301 * t + 49297) % 233280) / 233280;
}
function u(t, e, i) {
return l(t) * (i - e) + e;
}
function h(t, e) {
return t - Math.floor(t / e) * e;
}
}), {} ],
345: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../platform/js")) && n.__esModule ? n : {
default: n
}, s = (function() {
function t() {}
var e = t.prototype;
e.clone = function() {
cc.errorID("0100", r.default.getClassName(this) + ".clone");
return null;
};
e.equals = function() {
cc.errorID("0100", r.default.getClassName(this) + ".equals");
return !1;
};
e.lerp = function() {
cc.errorID("0100", r.default.getClassName(this) + ".lerp");
return this.clone();
};
e.set = function() {
cc.errorID("0100", r.default.getClassName(this) + ".set");
};
e.toString = function() {
return "" + {};
};
return t;
})();
i.default = s;
r.default.setClassName("cc.ValueType", s);
cc.ValueType = s;
e.exports = i.default;
}), {
"../platform/js": 260
} ],
346: [ (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")), o = t("./utils");
function a(t) {
return t && t.__esModule ? t : {
default: t
};
}
function c(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function l(t, e, i) {
e && c(t.prototype, e);
i && c(t, i);
return t;
}
function u(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
h(t, e);
}
function h(t, e) {
return (h = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var _ = 0, f = 0, d = (function(t) {
u(i, t);
var e = i.prototype;
e.sub = function(t, e) {
return i.subtract(e || new i(), this, t);
};
e.mul = function(t, e) {
return i.multiplyScalar(e || new i(), this, t);
};
e.div = function(t, e) {
return i.multiplyScalar(e || new i(), this, 1 / t);
};
e.scale = function(t, e) {
return i.multiply(e || new i(), this, t);
};
e.neg = function(t) {
return i.negate(t || new i(), this);
};
i.clone = function(t) {
return new i(t.x, t.y);
};
i.copy = function(t, e) {
t.x = e.x;
t.y = e.y;
return t;
};
i.set = function(t, e, i) {
t.x = e;
t.y = i;
return t;
};
i.add = function(t, e, i) {
t.x = e.x + i.x;
t.y = e.y + i.y;
return t;
};
i.subtract = function(t, e, i) {
t.x = e.x - i.x;
t.y = e.y - i.y;
return t;
};
i.multiply = function(t, e, i) {
t.x = e.x * i.x;
t.y = e.y * i.y;
return t;
};
i.divide = function(t, e, i) {
t.x = e.x / i.x;
t.y = e.y / i.y;
return t;
};
i.ceil = function(t, e) {
t.x = Math.ceil(e.x);
t.y = Math.ceil(e.y);
return t;
};
i.floor = function(t, e) {
t.x = Math.floor(e.x);
t.y = Math.floor(e.y);
return t;
};
i.min = function(t, e, i) {
t.x = Math.min(e.x, i.x);
t.y = Math.min(e.y, i.y);
return t;
};
i.max = function(t, e, i) {
t.x = Math.max(e.x, i.x);
t.y = Math.max(e.y, i.y);
return t;
};
i.round = function(t, e) {
t.x = Math.round(e.x);
t.y = Math.round(e.y);
return t;
};
i.multiplyScalar = function(t, e, i) {
t.x = e.x * i;
t.y = e.y * i;
return t;
};
i.scaleAndAdd = function(t, e, i, n) {
t.x = e.x + i.x * n;
t.y = e.y + i.y * n;
return t;
};
i.distance = function(t, e) {
_ = e.x - t.x;
f = e.y - t.y;
return Math.sqrt(_ * _ + f * f);
};
i.squaredDistance = function(t, e) {
_ = e.x - t.x;
f = e.y - t.y;
return _ * _ + f * f;
};
i.len = function(t) {
_ = t.x;
f = t.y;
return Math.sqrt(_ * _ + f * f);
};
i.lengthSqr = function(t) {
_ = t.x;
f = t.y;
return _ * _ + f * f;
};
i.negate = function(t, e) {
t.x = -e.x;
t.y = -e.y;
return t;
};
i.inverse = function(t, e) {
t.x = 1 / e.x;
t.y = 1 / e.y;
return t;
};
i.inverseSafe = function(t, e) {
_ = e.x;
f = e.y;
Math.abs(_) < o.EPSILON ? t.x = 0 : t.x = 1 / _;
Math.abs(f) < o.EPSILON ? t.y = 0 : t.y = 1 / f;
return t;
};
i.normalize = function(t, e) {
_ = e.x;
f = e.y;
var i = _ * _ + f * f;
if (i > 0) {
i = 1 / Math.sqrt(i);
t.x = _ * i;
t.y = f * i;
}
return t;
};
i.dot = function(t, e) {
return t.x * e.x + t.y * e.y;
};
i.cross = function(t, e, i) {
t.x = t.y = 0;
t.z = e.x * i.y - e.y * i.x;
return t;
};
i.lerp = function(t, e, i, n) {
_ = e.x;
f = e.y;
t.x = _ + n * (i.x - _);
t.y = f + n * (i.y - f);
return t;
};
i.random = function(t, e) {
e = e || 1;
var i = 2 * (0, o.random)() * Math.PI;
t.x = Math.cos(i) * e;
t.y = Math.sin(i) * e;
return t;
};
i.transformMat3 = function(t, e, i) {
_ = e.x;
f = e.y;
var n = i.m;
t.x = n[0] * _ + n[3] * f + n[6];
t.y = n[1] * _ + n[4] * f + n[7];
return t;
};
i.transformMat4 = function(t, e, i) {
_ = e.x;
f = e.y;
var n = i.m;
t.x = n[0] * _ + n[4] * f + n[12];
t.y = n[1] * _ + n[5] * f + n[13];
return t;
};
i.strictEquals = function(t, e) {
return t.x === e.x && t.y === e.y;
};
i.equals = function(t, e, i) {
void 0 === i && (i = o.EPSILON);
return 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(p, t);
i.normalize(m, e);
var n = i.dot(p, m);
return n > 1 ? 0 : n < -1 ? Math.PI : Math.acos(n);
};
i.toArray = function(t, e, i) {
void 0 === i && (i = 0);
t[i + 0] = e.x;
t[i + 1] = e.y;
return t;
};
i.fromArray = function(t, e, i) {
void 0 === i && (i = 0);
t.x = e[i + 0];
t.y = e[i + 1];
return t;
};
function i(e, n) {
var r;
void 0 === e && (e = 0);
void 0 === n && (n = 0);
(r = t.call(this) || this).mag = i.prototype.len;
r.magSqr = i.prototype.lengthSqr;
r.subSelf = i.prototype.subtract;
r.mulSelf = i.prototype.multiplyScalar;
r.divSelf = i.prototype.divide;
r.scaleSelf = i.prototype.multiply;
r.negSelf = i.prototype.negate;
r.x = void 0;
r.y = void 0;
r.z = 0;
if (e && "object" == typeof e) {
r.x = e.x || 0;
r.y = e.y || 0;
} else {
r.x = e || 0;
r.y = n || 0;
}
return r;
}
e.clone = function() {
return new i(this.x, this.y);
};
e.set = function(t) {
this.x = t.x;
this.y = t.y;
return 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;
n.x = r + (t.x - r) * e;
n.y = s + (t.y - s) * e;
return n;
};
e.clampf = function(t, e) {
this.x = s.default.clampf(this.x, t.x, e.x);
this.y = s.default.clampf(this.y, t.y, e.y);
return this;
};
e.add = function(t, e) {
(e = e || new i()).x = this.x + t.x;
e.y = this.y + t.y;
return e;
};
e.addSelf = function(t) {
this.x += t.x;
this.y += t.y;
return this;
};
e.subtract = function(t) {
this.x -= t.x;
this.y -= t.y;
return this;
};
e.multiplyScalar = function(t) {
this.x *= t;
this.y *= t;
return this;
};
e.multiply = function(t) {
this.x *= t.x;
this.y *= t.y;
return this;
};
e.divide = function(t) {
this.x /= t;
this.y /= t;
return this;
};
e.negate = function() {
this.x = -this.x;
this.y = -this.y;
return 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);
this.x *= e;
this.y *= e;
return this;
};
e.normalize = function(t) {
(t = t || new i()).x = this.x;
t.y = this.y;
t.normalizeSelf();
return t;
};
e.angle = function(t) {
var e = this.magSqr(), i = t.magSqr();
if (0 === e || 0 === i) {
console.warn("Can't get angle between zero vector");
return 0;
}
var n = this.dot(t) / Math.sqrt(e * i);
n = s.default.clampf(n, -1, 1);
return Math.acos(n);
};
e.signAngle = function(t) {
var e = this.angle(t);
return this.cross(t) < 0 ? -e : e;
};
e.rotate = function(t, e) {
(e = e || new i()).x = this.x;
e.y = this.y;
return e.rotateSelf(t);
};
e.rotateSelf = function(t) {
var e = Math.sin(t), i = Math.cos(t), n = this.x;
this.x = i * n - e * this.y;
this.y = e * n + i * this.y;
return this;
};
e.project = function(t) {
return t.multiplyScalar(this.dot(t) / t.dot(t));
};
e.transformMat4 = function(t, e) {
e = e || new i();
i.transformMat4(e, this, t);
return e;
};
e.maxAxis = function() {
return Math.max(this.x, this.y);
};
l(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);
}
} ]);
return i;
})(n.default);
i.default = d;
d.sub = d.subtract;
d.mul = d.multiply;
d.scale = d.multiplyScalar;
d.mag = d.len;
d.squaredMagnitude = d.lengthSqr;
d.div = d.divide;
d.ONE_R = d.ONE;
d.ZERO_R = d.ZERO;
d.UP_R = d.UP;
d.RIGHT_R = d.RIGHT;
var p = new d(), m = new d();
r.default.fastDefine("cc.Vec2", d, {
x: 0,
y: 0
});
cc.v2 = function(t, e) {
return new d(t, e);
};
cc.Vec2 = d;
e.exports = i.default;
}), {
"../platform/CCClass": 239,
"../utils/misc": 322,
"./utils": 344,
"./value-type": 345
} ],
347: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = c(t("./value-type")), r = c(t("../platform/CCClass")), s = c(t("../utils/misc")), o = c(t("./vec2")), a = t("./utils");
function c(t) {
return t && t.__esModule ? t : {
default: t
};
}
function l(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function u(t, e, i) {
e && l(t.prototype, e);
i && l(t, i);
return t;
}
function h(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
_(t, e);
}
function _(t, e) {
return (_ = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var f = 0, d = 0, p = 0, m = (function(t) {
h(i, t);
var e = i.prototype;
e.sub = function(t, e) {
return i.subtract(e || new i(), this, t);
};
e.mul = function(t, e) {
return i.multiplyScalar(e || new i(), this, t);
};
e.div = function(t, e) {
return i.multiplyScalar(e || new i(), this, 1 / t);
};
e.scale = function(t, e) {
return i.multiply(e || new i(), this, t);
};
e.neg = function(t) {
return i.negate(t || new i(), this);
};
i.zero = function(t) {
t.x = 0;
t.y = 0;
t.z = 0;
return t;
};
i.clone = function(t) {
return new i(t.x, t.y, t.z);
};
i.copy = function(t, e) {
t.x = e.x;
t.y = e.y;
t.z = e.z;
return t;
};
i.set = function(t, e, i, n) {
t.x = e;
t.y = i;
t.z = n;
return t;
};
i.add = function(t, e, i) {
t.x = e.x + i.x;
t.y = e.y + i.y;
t.z = e.z + i.z;
return t;
};
i.subtract = function(t, e, i) {
t.x = e.x - i.x;
t.y = e.y - i.y;
t.z = e.z - i.z;
return t;
};
i.multiply = function(t, e, i) {
t.x = e.x * i.x;
t.y = e.y * i.y;
t.z = e.z * i.z;
return t;
};
i.divide = function(t, e, i) {
t.x = e.x / i.x;
t.y = e.y / i.y;
t.z = e.z / i.z;
return t;
};
i.ceil = function(t, e) {
t.x = Math.ceil(e.x);
t.y = Math.ceil(e.y);
t.z = Math.ceil(e.z);
return t;
};
i.floor = function(t, e) {
t.x = Math.floor(e.x);
t.y = Math.floor(e.y);
t.z = Math.floor(e.z);
return t;
};
i.min = function(t, e, i) {
t.x = Math.min(e.x, i.x);
t.y = Math.min(e.y, i.y);
t.z = Math.min(e.z, i.z);
return t;
};
i.max = function(t, e, i) {
t.x = Math.max(e.x, i.x);
t.y = Math.max(e.y, i.y);
t.z = Math.max(e.z, i.z);
return t;
};
i.round = function(t, e) {
t.x = Math.round(e.x);
t.y = Math.round(e.y);
t.z = Math.round(e.z);
return t;
};
i.multiplyScalar = function(t, e, i) {
t.x = e.x * i;
t.y = e.y * i;
t.z = e.z * i;
return t;
};
i.scaleAndAdd = function(t, e, i, n) {
t.x = e.x + i.x * n;
t.y = e.y + i.y * n;
t.z = e.z + i.z * n;
return t;
};
i.distance = function(t, e) {
f = e.x - t.x;
d = e.y - t.y;
p = e.z - t.z;
return Math.sqrt(f * f + d * d + p * p);
};
i.squaredDistance = function(t, e) {
f = e.x - t.x;
d = e.y - t.y;
p = e.z - t.z;
return f * f + d * d + p * p;
};
i.len = function(t) {
f = t.x;
d = t.y;
p = t.z;
return Math.sqrt(f * f + d * d + p * p);
};
i.lengthSqr = function(t) {
f = t.x;
d = t.y;
p = t.z;
return f * f + d * d + p * p;
};
i.negate = function(t, e) {
t.x = -e.x;
t.y = -e.y;
t.z = -e.z;
return t;
};
i.inverse = function(t, e) {
t.x = 1 / e.x;
t.y = 1 / e.y;
t.z = 1 / e.z;
return t;
};
i.inverseSafe = function(t, e) {
f = e.x;
d = e.y;
p = e.z;
Math.abs(f) < a.EPSILON ? t.x = 0 : t.x = 1 / f;
Math.abs(d) < a.EPSILON ? t.y = 0 : t.y = 1 / d;
Math.abs(p) < a.EPSILON ? t.z = 0 : t.z = 1 / p;
return t;
};
i.normalize = function(t, e) {
f = e.x;
d = e.y;
p = e.z;
var i = f * f + d * d + p * p;
if (i > 0) {
i = 1 / Math.sqrt(i);
t.x = f * i;
t.y = d * i;
t.z = p * i;
}
return 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, o = i.x, a = i.y, c = i.z;
t.x = r * c - s * a;
t.y = s * o - n * c;
t.z = n * a - r * o;
return t;
};
i.lerp = function(t, e, i, n) {
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);
return t;
};
i.random = function(t, e) {
e = e || 1;
var i = 2 * (0, a.random)() * Math.PI, n = 2 * (0, a.random)() - 1, r = Math.sqrt(1 - n * n);
t.x = r * Math.cos(i) * e;
t.y = r * Math.sin(i) * e;
t.z = n * e;
return t;
};
i.transformMat4 = function(t, e, i) {
f = e.x;
d = e.y;
p = e.z;
var n = i.m, r = n[3] * f + n[7] * d + n[11] * p + n[15];
r = r ? 1 / r : 1;
t.x = (n[0] * f + n[4] * d + n[8] * p + n[12]) * r;
t.y = (n[1] * f + n[5] * d + n[9] * p + n[13]) * r;
t.z = (n[2] * f + n[6] * d + n[10] * p + n[14]) * r;
return t;
};
i.transformMat4Normal = function(t, e, i) {
f = e.x;
d = e.y;
p = e.z;
var n = i.m, r = n[3] * f + n[7] * d + n[11] * p;
r = r ? 1 / r : 1;
t.x = (n[0] * f + n[4] * d + n[8] * p) * r;
t.y = (n[1] * f + n[5] * d + n[9] * p) * r;
t.z = (n[2] * f + n[6] * d + n[10] * p) * r;
return t;
};
i.transformMat3 = function(t, e, i) {
f = e.x;
d = e.y;
p = e.z;
var n = i.m;
t.x = f * n[0] + d * n[3] + p * n[6];
t.y = f * n[1] + d * n[4] + p * n[7];
t.z = f * n[2] + d * n[5] + p * n[8];
return t;
};
i.transformAffine = function(t, e, i) {
f = e.x;
d = e.y;
p = e.z;
var n = i.m;
t.x = n[0] * f + n[1] * d + n[2] * p + n[3];
t.y = n[4] * f + n[5] * d + n[6] * p + n[7];
t.x = n[8] * f + n[9] * d + n[10] * p + n[11];
return 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, o = -i.x * e.x - i.y * e.y - i.z * e.z;
t.x = n * i.w + o * -i.x + r * -i.z - s * -i.y;
t.y = r * i.w + o * -i.y + s * -i.x - n * -i.z;
t.z = s * i.w + o * -i.z + n * -i.y - r * -i.x;
return t;
};
i.transformRTS = function(t, e, i, n, r) {
var s = e.x * r.x, o = e.y * r.y, a = e.z * r.z, c = i.w * s + i.y * a - i.z * o, l = i.w * o + i.z * s - i.x * a, u = i.w * a + i.x * o - i.y * s, h = -i.x * s - i.y * o - i.z * a;
t.x = c * i.w + h * -i.x + l * -i.z - u * -i.y + n.x;
t.y = l * i.w + h * -i.y + u * -i.x - c * -i.z + n.y;
t.z = u * i.w + h * -i.z + c * -i.y - l * -i.x + n.z;
return t;
};
i.transformInverseRTS = function(t, e, i, n, r) {
var s = e.x - n.x, o = e.y - n.y, a = e.z - n.z, c = i.w * s - i.y * a + i.z * o, l = i.w * o - i.z * s + i.x * a, u = i.w * a - i.x * o + i.y * s, h = i.x * s + i.y * o + i.z * a;
t.x = (c * i.w + h * i.x + l * i.z - u * i.y) / r.x;
t.y = (l * i.w + h * i.y + u * i.x - c * i.z) / r.y;
t.z = (u * i.w + h * i.z + c * i.y - l * i.x) / r.z;
return t;
};
i.rotateX = function(t, e, i, n) {
f = e.x - i.x;
d = e.y - i.y;
p = e.z - i.z;
var r = Math.cos(n), s = Math.sin(n), o = f, a = d * r - p * s, c = d * s + p * r;
t.x = o + i.x;
t.y = a + i.y;
t.z = c + i.z;
return t;
};
i.rotateY = function(t, e, i, n) {
f = e.x - i.x;
d = e.y - i.y;
p = e.z - i.z;
var r = Math.cos(n), s = Math.sin(n), o = p * s + f * r, a = d, c = p * r - f * s;
t.x = o + i.x;
t.y = a + i.y;
t.z = c + i.z;
return t;
};
i.rotateZ = function(t, e, i, n) {
f = e.x - i.x;
d = e.y - i.y;
p = e.z - i.z;
var r = Math.cos(n), s = Math.sin(n), o = f * r - d * s, a = f * s + d * r, c = p;
t.x = o + i.x;
t.y = a + i.y;
t.z = c + i.z;
return 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 = a.EPSILON);
var n = t.x, r = t.y, s = t.z, o = e.x, c = e.y, l = e.z;
return Math.abs(n - o) <= i * Math.max(1, Math.abs(n), Math.abs(o)) && Math.abs(r - c) <= i * Math.max(1, Math.abs(r), Math.abs(c)) && Math.abs(s - l) <= i * Math.max(1, Math.abs(s), Math.abs(l));
};
i.angle = function(t, e) {
i.normalize(y, t);
i.normalize(v, e);
var n = i.dot(y, v);
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) {
void 0 === i && (i = 0);
t[i + 0] = e.x;
t[i + 1] = e.y;
t[i + 2] = e.z;
return t;
};
i.fromArray = function(t, e, i) {
void 0 === i && (i = 0);
t.x = e[i + 0];
t.y = e[i + 1];
t.z = e[i + 2];
return t;
};
function i(e, n, r) {
var s;
void 0 === e && (e = 0);
void 0 === n && (n = 0);
void 0 === r && (r = 0);
(s = t.call(this) || this).mag = i.prototype.len;
s.magSqr = i.prototype.lengthSqr;
s.subSelf = i.prototype.subtract;
s.mulSelf = i.prototype.multiplyScalar;
s.divSelf = i.prototype.divide;
s.scaleSelf = i.prototype.multiply;
s.negSelf = i.prototype.negate;
s.x = void 0;
s.y = void 0;
s.z = void 0;
s.angle = o.default.prototype.angle;
s.project = o.default.prototype.project;
if (e && "object" == typeof e) {
s.x = e.x;
s.y = e.y;
s.z = e.z;
} else {
s.x = e;
s.y = n;
s.z = r;
}
return s;
}
e.clone = function() {
return new i(this.x, this.y, this.z);
};
e.set = function(t) {
this.x = t.x;
this.y = t.y;
this.z = t.z;
return 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) {
n = n || new i();
i.lerp(n, this, t, e);
return n;
};
e.clampf = function(t, e) {
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);
return this;
};
e.addSelf = function(t) {
this.x += t.x;
this.y += t.y;
this.z += t.z;
return this;
};
e.add = function(t, e) {
(e = e || new i()).x = this.x + t.x;
e.y = this.y + t.y;
e.z = this.z + t.z;
return e;
};
e.subtract = function(t) {
this.x -= t.x;
this.y -= t.y;
this.z -= t.z;
return this;
};
e.multiplyScalar = function(t) {
this.x *= t;
this.y *= t;
this.z *= t;
return this;
};
e.multiply = function(t) {
this.x *= t.x;
this.y *= t.y;
this.z *= t.z;
return this;
};
e.divide = function(t) {
this.x /= t;
this.y /= t;
this.z /= t;
return this;
};
e.negate = function() {
this.x = -this.x;
this.y = -this.y;
this.z = -this.z;
return this;
};
e.dot = function(t) {
return this.x * t.x + this.y * t.y + this.z * t.z;
};
e.cross = function(t, e) {
e = e || new i();
i.cross(e, this, t);
return 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() {
i.normalize(this, this);
return this;
};
e.normalize = function(t) {
t = t || new i();
i.normalize(t, this);
return t;
};
e.transformMat4 = function(t, e) {
e = e || new i();
i.transformMat4(e, this, t);
return 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 o.default(this.x, this.y), i = new o.default(t.x, t.y);
return e.signAngle(i);
};
e.rotate = function(t, e) {
cc.warnID(1408, "vec3.rotate", "v2.1", "cc.v2(selfVector).rotate(radians, out)");
return o.default.prototype.rotate.call(this, t, e);
};
e.rotateSelf = function(t) {
cc.warnID(1408, "vec3.rotateSelf", "v2.1", "cc.v2(selfVector).rotateSelf(radians)");
return o.default.prototype.rotateSelf.call(this, t);
};
u(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);
}
} ]);
return i;
})(n.default);
i.default = m;
m.sub = m.subtract;
m.mul = m.multiply;
m.scale = m.multiplyScalar;
m.mag = m.len;
m.squaredMagnitude = m.lengthSqr;
m.div = m.divide;
m.ONE_R = m.ONE;
m.ZERO_R = m.ZERO;
m.UP_R = m.UP;
m.RIGHT_R = m.RIGHT;
m.FRONT_R = m.FORWARD;
var y = new m(), v = new m();
r.default.fastDefine("cc.Vec3", m, {
x: 0,
y: 0,
z: 0
});
cc.v3 = function(t, e, i) {
return new m(t, e, i);
};
cc.Vec3 = m;
e.exports = i.default;
}), {
"../platform/CCClass": 239,
"../utils/misc": 322,
"./utils": 344,
"./value-type": 345,
"./vec2": 346
} ],
348: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.v4 = m;
i.default = void 0;
var n = o(t("../platform/CCClass")), r = o(t("./value-type")), s = t("./utils");
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
function a(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function c(t, e, i) {
e && a(t.prototype, e);
i && a(t, i);
return t;
}
function l(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
u(t, e);
}
function u(t, e) {
return (u = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var h = 0, _ = 0, f = 0, d = 0, p = (function(t) {
l(i, t);
var e = i.prototype;
e.sub = function(t, e) {
return i.subtract(e || new i(), this, t);
};
e.mul = function(t, e) {
return i.multiplyScalar(e || new i(), this, t);
};
e.div = function(t, e) {
return i.multiplyScalar(e || new i(), this, 1 / t);
};
e.scale = function(t, e) {
return i.multiply(e || new i(), this, t);
};
e.neg = function(t) {
return i.negate(t || new i(), this);
};
i.clone = function(t) {
return new i(t.x, t.y, t.z, t.w);
};
i.copy = function(t, e) {
t.x = e.x;
t.y = e.y;
t.z = e.z;
t.w = e.w;
return t;
};
i.set = function(t, e, i, n, r) {
t.x = e;
t.y = i;
t.z = n;
t.w = r;
return t;
};
i.add = function(t, e, i) {
t.x = e.x + i.x;
t.y = e.y + i.y;
t.z = e.z + i.z;
t.w = e.w + i.w;
return t;
};
i.subtract = function(t, e, i) {
t.x = e.x - i.x;
t.y = e.y - i.y;
t.z = e.z - i.z;
t.w = e.w - i.w;
return t;
};
i.multiply = function(t, e, i) {
t.x = e.x * i.x;
t.y = e.y * i.y;
t.z = e.z * i.z;
t.w = e.w * i.w;
return t;
};
i.divide = function(t, e, i) {
t.x = e.x / i.x;
t.y = e.y / i.y;
t.z = e.z / i.z;
t.w = e.w / i.w;
return t;
};
i.ceil = function(t, e) {
t.x = Math.ceil(e.x);
t.y = Math.ceil(e.y);
t.z = Math.ceil(e.z);
t.w = Math.ceil(e.w);
return t;
};
i.floor = function(t, e) {
t.x = Math.floor(e.x);
t.y = Math.floor(e.y);
t.z = Math.floor(e.z);
t.w = Math.floor(e.w);
return t;
};
i.min = function(t, e, i) {
t.x = Math.min(e.x, i.x);
t.y = Math.min(e.y, i.y);
t.z = Math.min(e.z, i.z);
t.w = Math.min(e.w, i.w);
return t;
};
i.max = function(t, e, i) {
t.x = Math.max(e.x, i.x);
t.y = Math.max(e.y, i.y);
t.z = Math.max(e.z, i.z);
t.w = Math.max(e.w, i.w);
return t;
};
i.round = function(t, e) {
t.x = Math.round(e.x);
t.y = Math.round(e.y);
t.z = Math.round(e.z);
t.w = Math.round(e.w);
return t;
};
i.multiplyScalar = function(t, e, i) {
t.x = e.x * i;
t.y = e.y * i;
t.z = e.z * i;
t.w = e.w * i;
return t;
};
i.scaleAndAdd = function(t, e, i, n) {
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;
return t;
};
i.distance = function(t, e) {
var i = e.x - t.x, n = e.y - t.y, r = e.z - t.z, s = e.w - t.w;
return Math.sqrt(i * i + n * n + r * r + s * s);
};
i.squaredDistance = function(t, e) {
var i = e.x - t.x, n = e.y - t.y, r = e.z - t.z, s = e.w - t.w;
return i * i + n * n + r * r + s * s;
};
i.len = function(t) {
h = t.x;
_ = t.y;
f = t.z;
d = t.w;
return Math.sqrt(h * h + _ * _ + f * f + d * d);
};
i.lengthSqr = function(t) {
h = t.x;
_ = t.y;
f = t.z;
d = t.w;
return h * h + _ * _ + f * f + d * d;
};
i.negate = function(t, e) {
t.x = -e.x;
t.y = -e.y;
t.z = -e.z;
t.w = -e.w;
return t;
};
i.inverse = function(t, e) {
t.x = 1 / e.x;
t.y = 1 / e.y;
t.z = 1 / e.z;
t.w = 1 / e.w;
return t;
};
i.inverseSafe = function(t, e) {
h = e.x;
_ = e.y;
f = e.z;
d = e.w;
Math.abs(h) < s.EPSILON ? t.x = 0 : t.x = 1 / h;
Math.abs(_) < s.EPSILON ? t.y = 0 : t.y = 1 / _;
Math.abs(f) < s.EPSILON ? t.z = 0 : t.z = 1 / f;
Math.abs(d) < s.EPSILON ? t.w = 0 : t.w = 1 / d;
return t;
};
i.normalize = function(t, e) {
h = e.x;
_ = e.y;
f = e.z;
d = e.w;
var i = h * h + _ * _ + f * f + d * d;
if (i > 0) {
i = 1 / Math.sqrt(i);
t.x = h * i;
t.y = _ * i;
t.z = f * i;
t.w = d * i;
}
return 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) {
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);
return 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);
t.x = r * Math.cos(i) * e;
t.y = r * Math.sin(i) * e;
t.z = n * e;
t.w = 0;
return t;
};
i.transformMat4 = function(t, e, i) {
h = e.x;
_ = e.y;
f = e.z;
d = e.w;
var n = i.m;
t.x = n[0] * h + n[4] * _ + n[8] * f + n[12] * d;
t.y = n[1] * h + n[5] * _ + n[9] * f + n[13] * d;
t.z = n[2] * h + n[6] * _ + n[10] * f + n[14] * d;
t.w = n[3] * h + n[7] * _ + n[11] * f + n[15] * d;
return t;
};
i.transformAffine = function(t, e, i) {
h = e.x;
_ = e.y;
f = e.z;
d = e.w;
var n = i.m;
t.x = n[0] * h + n[1] * _ + n[2] * f + n[3] * d;
t.y = n[4] * h + n[5] * _ + n[6] * f + n[7] * d;
t.x = n[8] * h + n[9] * _ + n[10] * f + n[11] * d;
t.w = e.w;
return t;
};
i.transformQuat = function(t, e, i) {
var n = e.x, r = e.y, s = e.z;
h = i.x;
_ = i.y;
f = i.z;
var o = (d = i.w) * n + _ * s - f * r, a = d * r + f * n - h * s, c = d * s + h * r - _ * n, l = -h * n - _ * r - f * s;
t.x = o * d + l * -h + a * -f - c * -_;
t.y = a * d + l * -_ + c * -h - o * -f;
t.z = c * d + l * -f + o * -_ - a * -h;
t.w = e.w;
return 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) {
void 0 === i && (i = s.EPSILON);
return 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) {
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;
return t;
};
i.fromArray = function(t, e, i) {
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];
return t;
};
function i(e, n, r, s) {
var o;
void 0 === e && (e = 0);
void 0 === n && (n = 0);
void 0 === r && (r = 0);
void 0 === s && (s = 0);
(o = t.call(this) || this).mag = i.prototype.len;
o.magSqr = i.prototype.lengthSqr;
o.subSelf = i.prototype.subtract;
o.mulSelf = i.prototype.multiplyScalar;
o.divSelf = i.prototype.divide;
o.scaleSelf = i.prototype.multiply;
o.negSelf = i.prototype.negate;
o.x = void 0;
o.y = void 0;
o.z = void 0;
o.w = void 0;
if (e && "object" == typeof e) {
o.x = e.x;
o.y = e.y;
o.z = e.z;
o.w = e.w;
} else {
o.x = e;
o.y = n;
o.z = r;
o.w = s;
}
return o;
}
e.clone = function() {
return new i(this.x, this.y, this.z, this.w);
};
e.set = function(t, e, i, n) {
if (t && "object" == typeof t) {
this.x = t.x;
this.y = t.y;
this.z = t.z;
this.w = t.w;
} else {
this.x = t || 0;
this.y = e || 0;
this.z = i || 0;
this.w = n || 0;
}
return this;
};
e.equals = function(t, e) {
void 0 === e && (e = s.EPSILON);
return 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) {
void 0 === r && (r = s.EPSILON);
return 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) {
h = this.x;
_ = this.y;
f = this.z;
d = this.w;
this.x = h + e * (t.x - h);
this.y = _ + e * (t.y - _);
this.z = f + e * (t.z - f);
this.w = d + e * (t.w - d);
return 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) {
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);
return this;
};
e.addSelf = function(t) {
this.x += t.x;
this.y += t.y;
this.z += t.z;
this.w += t.w;
return this;
};
e.add = function(t, e) {
(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;
return e;
};
e.subtract = function(t, e) {
(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;
return e;
};
e.multiplyScalar = function(t) {
this.x *= t;
this.y *= t;
this.z *= t;
this.w *= t;
return this;
};
e.multiply = function(t) {
this.x *= t.x;
this.y *= t.y;
this.z *= t.z;
this.w *= t.w;
return this;
};
e.divide = function(t) {
this.x /= t;
this.y /= t;
this.z /= t;
this.w /= t;
return this;
};
e.negate = function() {
this.x = -this.x;
this.y = -this.y;
this.z = -this.z;
this.w = -this.w;
return 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, o = t.x, a = t.y, c = t.z;
e.x = r * c - s * a;
e.y = s * o - n * c;
e.z = n * a - r * o;
return 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() {
this.normalize(this);
return this;
};
e.normalize = function(t) {
t = t || new i();
h = this.x;
_ = this.y;
f = this.z;
d = this.w;
var e = h * h + _ * _ + f * f + d * d;
if (e > 0) {
e = 1 / Math.sqrt(e);
t.x = h * e;
t.y = _ * e;
t.z = f * e;
t.w = d * e;
}
return t;
};
e.transformMat4 = function(t, e) {
e = e || new i();
h = this.x;
_ = this.y;
f = this.z;
d = this.w;
var n = t.m;
e.x = n[0] * h + n[4] * _ + n[8] * f + n[12] * d;
e.y = n[1] * h + n[5] * _ + n[9] * f + n[13] * d;
e.z = n[2] * h + n[6] * _ + n[10] * f + n[14] * d;
e.w = n[3] * h + n[7] * _ + n[11] * f + n[15] * d;
return e;
};
e.maxAxis = function() {
return Math.max(this.x, this.y, this.z, this.w);
};
c(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);
}
} ]);
return i;
})(r.default);
i.default = p;
p.sub = p.subtract;
p.mul = p.multiply;
p.div = p.divide;
p.scale = p.multiplyScalar;
p.mag = p.len;
p.squaredMagnitude = p.lengthSqr;
p.ZERO_R = p.ZERO;
p.ONE_R = p.ONE;
p.NEG_ONE_R = p.NEG_ONE;
n.default.fastDefine("cc.Vec4", p, {
x: 0,
y: 0,
z: 0,
w: 0
});
function m(t, e, i, n) {
return new p(t, e, i, n);
}
cc.v4 = m;
cc.Vec4 = p;
}), {
"../platform/CCClass": 239,
"./utils": 344,
"./value-type": 345
} ],
349: [ (function() {
"use strict";
cc.js;
}), {} ],
350: [ (function(t) {
"use strict";
t("./core/CCGame");
t("./actions");
}), {
"./actions": 7,
"./core/CCGame": 71
} ],
351: [ (function(t, e) {
"use strict";
var i = t("../compression/zlib.min"), n = t("../core/CCDebug"), r = function(t) {
var e, i, r, s, o, a, c, l, u, h, _, f, d;
this.data = t;
this.pos = 8;
this.palette = [];
this.imgData = [];
this.transparency = {};
this.animation = null;
this.text = {};
o = null;
for (;;) {
e = this.readUInt32();
switch (l = function() {
var t, e;
e = [];
for (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() || Infinity,
frames: []
};
break;

case "PLTE":
this.palette = this.read(e);
break;

case "fcTL":
o && this.animation.frames.push(o);
this.pos += 4;
o = {
width: this.readUInt32(),
height: this.readUInt32(),
xOffset: this.readUInt32(),
yOffset: this.readUInt32()
};
s = this.readUInt16();
r = this.readUInt16() || 100;
o.delay = 1e3 * s / r;
o.disposeOp = this.data[this.pos++];
o.blendOp = this.data[this.pos++];
o.data = [];
break;

case "IDAT":
case "fdAT":
if ("fdAT" === l) {
this.pos += 4;
e -= 4;
}
t = (null != o ? o.data : void 0) || this.imgData;
for (_ = 0; 0 <= e ? _ < e : _ > e; 0 <= e ? ++_ : --_) t.push(this.data[this.pos++]);
break;

case "tRNS":
this.transparency = {};
switch (this.colorType) {
case 3:
this.transparency.indexed = this.read(e);
if ((u = 255 - this.transparency.indexed.length) > 0) for (f = 0; 0 <= u ? f < u : f > u; 0 <= u ? ++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":
a = (h = this.read(e)).indexOf(0);
c = String.fromCharCode.apply(String, h.slice(0, a));
this.text[c] = String.fromCharCode.apply(String, h.slice(a + 1));
break;

case "IEND":
o && this.animation.frames.push(o);
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);
Uint8Array != Array && (this.imgData = new Uint8Array(this.imgData));
return;

default:
this.pos += e;
}
this.pos += 4;
if (this.pos > this.data.length) throw new Error(n.getError(6017));
}
};
r.prototype = {
constructor: r,
read: function(t) {
var e, i;
i = [];
for (e = 0; 0 <= t ? e < t : e > t; 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, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b, C, x, A, S, T;
null == t && (t = this.imgData);
if (0 === t.length) return new Uint8Array(0);
t = new i.Inflate(t, {
index: 0,
verify: !1
}).decompress();
v = (d = this.pixelBitlength / 8) * this.width;
p = new Uint8Array(v * this.height);
c = t.length;
y = 0;
m = 0;
r = 0;
for (;m < c; ) {
switch (t[m++]) {
case 0:
for (o = C = 0; C < v; o = C += 1) p[r++] = t[m++];
break;

case 1:
for (o = x = 0; x < v; o = x += 1) {
e = t[m++];
a = o < d ? 0 : p[r - d];
p[r++] = (e + a) % 256;
}
break;

case 2:
for (o = A = 0; A < v; o = A += 1) {
e = t[m++];
s = (o - o % d) / d;
g = y && p[(y - 1) * v + s * d + o % d];
p[r++] = (g + e) % 256;
}
break;

case 3:
for (o = S = 0; S < v; o = S += 1) {
e = t[m++];
s = (o - o % d) / d;
a = o < d ? 0 : p[r - d];
g = y && p[(y - 1) * v + s * d + o % d];
p[r++] = (e + Math.floor((a + g) / 2)) % 256;
}
break;

case 4:
for (o = T = 0; T < v; o = T += 1) {
e = t[m++];
s = (o - o % d) / d;
a = o < d ? 0 : p[r - d];
if (0 === y) g = b = 0; else {
g = p[(y - 1) * v + s * d + o % d];
b = s && p[(y - 1) * v + (s - 1) * d + o % d];
}
l = a + g - b;
u = Math.abs(l - a);
_ = Math.abs(l - g);
f = Math.abs(l - b);
h = u <= _ && u <= f ? a : _ <= f ? g : b;
p[r++] = (e + h) % 256;
}
break;

default:
throw new Error(n.getError(6018, t[m - 1]));
}
y++;
}
return p;
},
copyToImageData: function(t, e) {
var i, n, r, s, o, a, c, l, u, h, _;
n = this.colors;
u = null;
i = this.hasAlphaChannel;
if (this.palette.length) {
u = null != (_ = this._decodedPalette) ? _ : this._decodedPalette = this.decodePalette();
n = 4;
i = !0;
}
l = (r = t.data || t).length;
o = u || e;
s = a = 0;
if (1 === n) for (;s < l; ) {
c = u ? 4 * e[s / 4] : a;
h = o[c++];
r[s++] = h;
r[s++] = h;
r[s++] = h;
r[s++] = i ? o[c++] : 255;
a = c;
} else for (;s < l; ) {
c = u ? 4 * e[s / 4] : a;
r[s++] = o[c++];
r[s++] = o[c++];
r[s++] = o[c++];
r[s++] = i ? o[c++] : 255;
a = c;
}
},
decodePalette: function() {
var t, e, i, n, r, s, o, a, c;
i = this.palette;
s = this.transparency.indexed || [];
r = new Uint8Array((s.length || 0) + i.length);
n = 0;
t = 0;
for (e = o = 0, a = i.length; o < a; e = o += 3) {
r[n++] = i[e];
r[n++] = i[e + 1];
r[n++] = i[e + 2];
r[n++] = null != (c = s[t++]) ? c : 255;
}
return r;
},
render: function(t) {
var e, i;
t.width = this.width;
t.height = this.height;
i = (e = t.getContext("2d")).createImageData(this.width, this.height);
this.copyToImageData(i, this.decodePixels());
return e.putImageData(i, 0, 0);
}
};
e.exports = r;
}), {
"../compression/zlib.min": 25,
"../core/CCDebug": 69
} ],
352: [ (function(t, e) {
"use strict";
var i = t("../core/assets/CCAsset"), n = t("../core/assets/CCSpriteFrame"), r = cc.Class({
name: "cc.ParticleAsset",
extends: i,
properties: {
spriteFrame: {
default: null,
type: n
}
}
});
cc.ParticleAsset = e.exports = r;
}), {
"../core/assets/CCAsset": 105,
"../core/assets/CCSpriteFrame": 117
} ],
353: [ (function(t, e) {
"use strict";
var i = t("../core/platform/CCMacro"), n = t("./CCParticleAsset"), r = t("../core/components/CCRenderComponent"), s = t("../compression/ZipUtils"), o = t("./CCPNGReader"), a = t("./CCTIFFReader"), c = t("../core/utils/texture-util"), l = (t("../core/renderer/render-flow"), 
t("./particle-simulator")), u = (t("../core/assets/material/CCMaterial"), t("../core/utils/blend-func")), h = cc.Enum({
GRAVITY: 0,
RADIUS: 1
}), _ = cc.Enum({
FREE: 0,
RELATIVE: 1,
GROUPED: 2
}), f = {
preview: {
default: !0,
editorOnly: !0,
notify: !1,
animatable: !1,
tooltip: !1
},
_custom: !1,
custom: {
get: function() {
return this._custom;
},
set: function(t) {
if (this._custom !== t) {
this._custom = t;
this._applyFile();
}
},
animatable: !1,
tooltip: !1
},
_file: {
default: null,
type: n
},
file: {
get: function() {
return this._file;
},
set: function(t) {
if (this._file !== t) {
this._file = t;
t ? this._applyFile() : this.custom = !0;
}
},
animatable: !1,
type: n,
tooltip: !1
},
_spriteFrame: {
default: null,
type: cc.SpriteFrame
},
spriteFrame: {
get: function() {
return this._spriteFrame;
},
set: function(t) {
var e = this._renderSpriteFrame;
if (e !== t) {
this._renderSpriteFrame = t;
t && !t._uuid || (this._spriteFrame = t);
this._applySpriteFrame(e);
}
},
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: _.FREE,
formerlySerializedAs: "positionType"
},
positionType: {
type: _,
get: function() {
return this._positionType;
},
set: function(t) {
this._positionType = t;
this._updateMaterial();
}
},
emitterMode: {
default: h.GRAVITY,
type: h
},
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
}, d = cc.Class({
name: "cc.ParticleSystem",
extends: r,
mixins: [ u ],
editor: !1,
ctor: function() {
this.initProperties();
},
initProperties: function() {
this._previewTimer = null;
this._focused = !1;
this._aspectRatio = 1;
this._simulator = new l(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: f,
statics: {
DURATION_INFINITY: -1,
START_SIZE_EQUAL_TO_END_SIZE: -1,
START_RADIUS_EQUAL_TO_END_RADIUS: -1,
EmitterMode: h,
PositionType: _,
_PNGReader: o,
_TIFFReader: a
},
onFocusInEditor: !1,
onLostFocusInEditor: !1,
_startPreview: !1,
_stopPreview: !1,
_convertTextureToSpriteFrame: !1,
__preload: function() {
this._super();
this._custom && this.spriteFrame && !this._renderSpriteFrame ? this._applySpriteFrame(this.spriteFrame) : this._file && (this._custom ? !this._getTexture() && this._applyFile() : this._applyFile());
this.playOnLoad && this.resetSystem();
},
onDestroy: function() {
this.autoRemoveOnFinish && (this.autoRemoveOnFinish = !1);
if (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.assetManager.postLoadNative(t, (function(i) {
if (!i && t._nativeAsset) {
if (e.isValid) {
e._plistFile = t.nativeUrl;
if (!e._custom) {
e._spriteFrame !== t.spriteFrame && (e.spriteFrame = t.spriteFrame);
e._initWithDictionary(t._nativeAsset);
}
e._spriteFrame ? !e._renderSpriteFrame && e._spriteFrame && e._applySpriteFrame(e.spriteFrame) : t.spriteFrame ? e.spriteFrame = t.spriteFrame : e._custom && e._initTextureWithDictionary(t._nativeAsset);
}
} else cc.errorID(6029);
}));
}
},
_initTextureWithDictionary: function(t) {
var e, n = cc.path.changeBasename(this._plistFile, t.textureFileName || "");
if (t.textureFileName) c.loadImage(n, (function(e, i) {
if (e) {
t.textureFileName = void 0;
this._initTextureWithDictionary(t);
} else {
cc.assetManager.assets.add(n, i);
this.spriteFrame = new cc.SpriteFrame(i);
}
}), this); else if (t.textureImageData) {
var r = t.textureImageData;
if (!(r && r.length > 0)) return !1;
var l = cc.assetManager.assets.get(n);
if (!l) {
var u = s.unzipBase64AsArray(r, 1);
if (!u) {
cc.warnID(6030, this._file.name);
return !1;
}
var h = (e = u).length > 8 && 137 === e[0] && 80 === e[1] && 78 === e[2] && 71 === e[3] && 13 === e[4] && 10 === e[5] && 26 === e[6] && 10 === e[7] ? i.ImageFormat.PNG : e.length > 2 && (73 === e[0] && 73 === e[1] || 77 === e[0] && 77 === e[1] || 255 === e[0] && 216 === e[1]) ? i.ImageFormat.TIFF : i.ImageFormat.UNKNOWN;
if (h !== i.ImageFormat.TIFF && h !== i.ImageFormat.PNG) {
cc.warnID(6031, this._file.name);
return !1;
}
var _ = document.createElement("canvas");
h === i.ImageFormat.PNG ? new o(u).render(_) : a.parseTIFF(u, _);
l = c.cacheImage(n, _);
}
l || cc.warnID(6032, this._file.name);
this.spriteFrame = new cc.SpriteFrame(l);
}
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 || i.SRC_ALPHA);
this.dstBlendFactor = parseInt(t.blendFuncDestination || i.ONE_MINUS_SRC_ALPHA);
var n = this._startColor;
n.r = 255 * parseFloat(t.startColorRed || 0);
n.g = 255 * parseFloat(t.startColorGreen || 0);
n.b = 255 * parseFloat(t.startColorBlue || 0);
n.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 o = this._endColorVar;
o.r = 255 * parseFloat(t.finishColorVarianceRed || 0);
o.g = 255 * parseFloat(t.finishColorVarianceGreen || 0);
o.b = 255 * parseFloat(t.finishColorVarianceBlue || 0);
o.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 : _.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 || h.GRAVITY);
if (this.emitterMode === h.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 a = t.rotationIsDir || "";
if (null !== a) {
a = a.toString().toLowerCase();
this.rotationIsDir = "true" === a || "1" === a;
} else this.rotationIsDir = !1;
} else {
if (this.emitterMode !== h.RADIUS) {
cc.warnID(6009);
return !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);
}
this._initTextureWithDictionary(t);
return !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);
if (t) {
t.define("CC_USE_MODEL", this._positionType !== _.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 = d;
}), {
"../compression/ZipUtils": 22,
"../core/assets/material/CCMaterial": 124,
"../core/components/CCRenderComponent": 160,
"../core/platform/CCMacro": 244,
"../core/renderer/render-flow": 272,
"../core/utils/blend-func": 316,
"../core/utils/texture-util": 330,
"./CCPNGReader": 351,
"./CCParticleAsset": 352,
"./CCTIFFReader": 354,
"./particle-simulator": 356,
"fire-url": void 0
} ],
354: [ (function(t, e) {
"use strict";
var i = t("../core/CCDebug"), n = {
_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) {
console.log(t);
throw TypeError(i.getError(6019));
}
this.littleEndian = !1;
}
return this.littleEndian;
},
hasTowel: function() {
if (42 !== this.getUint16(2)) throw RangeError(i.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;
if (t in e) return e[t];
cc.logID(6021, t);
return "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 o = 0; o < i; o++) {
var a = s * o;
if (s >= 8) if (-1 !== [ "RATIONAL", "SRATIONAL" ].indexOf(e)) {
r.push(this.getUint32(n + a));
r.push(this.getUint32(n + a + 4));
} else cc.logID(8e3); else r.push(this.getBytes(s, n + a));
}
"ASCII" === e && r.forEach((function(t, e, i) {
i[e] = String.fromCharCode(t);
}));
return 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), o = i + t, a = 32 - t;
if (o <= 0) cc.logID(6023); else if (o <= 8) {
n = 24 + i;
r = this.getUint8(s);
} else if (o <= 16) {
n = 16 + i;
r = this.getUint16(s);
} else if (o <= 32) {
n = i;
r = this.getUint32(s);
} else cc.logID(6022);
return {
bits: r << n >>> a,
byteOffset: s + Math.floor(o / 8),
bitOffset: o % 8
};
},
parseFileDirectory: function(t) {
for (var e = this.getUint16(t), i = [], n = t + 2, r = 0; r < e; n += 12, r++) {
var s = this.getUint16(n), o = this.getUint16(n + 2), a = this.getUint32(n + 4), c = this.getUint32(n + 8), l = this.getFieldTagName(s), u = this.getFieldTypeName(o), h = this.getFieldValues(l, u, a, c);
i[l] = {
type: u,
values: h
};
}
this._fileDirectories.push(i);
var _ = this.getUint32(n);
0 !== _ && this.parseFileDirectory(_);
},
clampColorSample: function(t, e) {
var i = Math.pow(2, 8 - e);
return Math.floor(t * i + (i - 1));
},
parseTIFF: function(t, e) {
e = e || document.createElement("canvas");
this._tiffData = t;
this.canvas = e;
this.checkLittleEndian();
if (this.hasTowel()) {
var n = this.getUint32(4);
this._fileDirectories.length = 0;
this.parseFileDirectory(n);
var r = this._fileDirectories[0], s = r.ImageWidth.values[0], o = r.ImageLength.values[0];
this.canvas.width = s;
this.canvas.height = o;
var a = [], c = r.Compression ? r.Compression.values[0] : 1, l = r.SamplesPerPixel.values[0], u = [], h = 0, _ = !1;
r.BitsPerSample.values.forEach((function(t, e) {
u[e] = {
bitsPerSample: t,
hasBytesPerSample: !1,
bytesPerSample: void 0
};
if (t % 8 == 0) {
u[e].hasBytesPerSample = !0;
u[e].bytesPerSample = t / 8;
}
h += t;
}), this);
if (h % 8 == 0) {
_ = !0;
var f = h / 8;
}
var d = r.StripOffsets.values, p = d.length;
if (r.StripByteCounts) var m = r.StripByteCounts.values; else {
cc.logID(8003);
if (1 !== p) throw Error(i.getError(6024));
m = [ Math.ceil(s * o * h / 8) ];
}
for (var y = 0; y < p; y++) {
var v = d[y];
a[y] = [];
for (var g = m[y], b = 0, C = 0, x = 1, A = !0, S = [], T = 0, w = 0, E = 0; b < g; b += x) switch (c) {
case 1:
var M = 0;
for (S = []; M < l; M++) {
if (!u[M].hasBytesPerSample) {
var B = this.getBits(u[M].bitsPerSample, v + b, C);
S.push(B.bits);
b = B.byteOffset - v;
C = B.bitOffset;
throw RangeError(i.getError(6025));
}
var I = u[M].bytesPerSample * M;
S.push(this.getBytes(u[M].bytesPerSample, v + b + I));
}
a[y].push(S);
if (!_) {
x = 0;
throw RangeError(i.getError(6026));
}
x = f;
break;

case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
break;

case 32773:
if (A) {
A = !1;
var D = 1, P = 1, R = this.getInt8(v + b);
R >= 0 && R <= 127 ? D = R + 1 : R >= -127 && R <= -1 ? P = 1 - R : A = !0;
} else {
var L = this.getUint8(v + b);
for (M = 0; M < P; M++) {
if (!u[w].hasBytesPerSample) throw RangeError(i.getError(6025));
E = E << 8 * T | L;
if (++T === u[w].bytesPerSample) {
S.push(E);
E = T = 0;
w++;
}
if (w === l) {
a[y].push(S);
S = [];
w = 0;
}
}
0 == --D && (A = !0);
}
x = 1;
}
}
if (e.getContext) {
var O = this.canvas.getContext("2d");
O.fillStyle = "rgba(255, 255, 255, 0)";
var V = r.RowsPerStrip ? r.RowsPerStrip.values[0] : o, N = a.length, F = o % V, z = 0 === F ? V : F, k = V, G = 0, U = r.PhotometricInterpretation.values[0], H = [], j = 0;
r.ExtraSamples && (j = (H = r.ExtraSamples.values).length);
if (r.ColorMap) var W = r.ColorMap.values, q = Math.pow(2, u[0].bitsPerSample);
for (y = 0; y < N; y++) {
y + 1 === N && (k = z);
for (var X = a[y].length, Y = G * y, J = 0, Z = 0; Z < X; J++) for (var K = 0; K < s; K++, 
Z++) {
var Q = a[y][Z], $ = 0, tt = 0, et = 0, it = 1;
if (j > 0) for (var nt = 0; nt < j; nt++) if (1 === H[nt] || 2 === H[nt]) {
it = Q[3 + nt] / 256;
break;
}
switch (U) {
case 0:
if (u[0].hasBytesPerSample) var rt = Math.pow(16, 2 * u[0].bytesPerSample);
Q.forEach((function(t, e, i) {
i[e] = rt - t;
}));

case 1:
$ = tt = et = this.clampColorSample(Q[0], u[0].bitsPerSample);
break;

case 2:
$ = this.clampColorSample(Q[0], u[0].bitsPerSample);
tt = this.clampColorSample(Q[1], u[1].bitsPerSample);
et = this.clampColorSample(Q[2], u[2].bitsPerSample);
break;

case 3:
if (void 0 === W) throw Error(i.getError(6027));
var st = Q[0];
$ = this.clampColorSample(W[st], 16);
tt = this.clampColorSample(W[q + st], 16);
et = this.clampColorSample(W[2 * q + st], 16);
break;

default:
throw RangeError(i.getError(6028, U));
}
O.fillStyle = "rgba(" + $ + ", " + tt + ", " + et + ", " + it + ")";
O.fillRect(K, Y + J, 1, 1);
}
G = k;
}
}
return this.canvas;
}
},
fieldTagNames: {
315: "Artist",
258: "BitsPerSample",
265: "CellLength",
264: "CellWidth",
320: "ColorMap",
259: "Compression",
33432: "Copyright",
306: "DateTime",
338: "ExtraSamples",
266: "FillOrder",
289: "FreeByteCounts",
288: "FreeOffsets",
291: "GrayResponseCurve",
290: "GrayResponseUnit",
316: "HostComputer",
270: "ImageDescription",
257: "ImageLength",
256: "ImageWidth",
271: "Make",
281: "MaxSampleValue",
280: "MinSampleValue",
272: "Model",
254: "NewSubfileType",
274: "Orientation",
262: "PhotometricInterpretation",
284: "PlanarConfiguration",
296: "ResolutionUnit",
278: "RowsPerStrip",
277: "SamplesPerPixel",
305: "Software",
279: "StripByteCounts",
273: "StripOffsets",
255: "SubfileType",
263: "Threshholding",
282: "XResolution",
283: "YResolution",
326: "BadFaxLines",
327: "CleanFaxData",
343: "ClipPath",
328: "ConsecutiveBadFaxLines",
433: "Decode",
434: "DefaultImageColor",
269: "DocumentName",
336: "DotRange",
321: "HalftoneHints",
346: "Indexed",
347: "JPEGTables",
285: "PageName",
297: "PageNumber",
317: "Predictor",
319: "PrimaryChromaticities",
532: "ReferenceBlackWhite",
339: "SampleFormat",
559: "StripRowCounts",
330: "SubIFDs",
292: "T4Options",
293: "T6Options",
325: "TileByteCounts",
323: "TileLength",
324: "TileOffsets",
322: "TileWidth",
301: "TransferFunction",
318: "WhitePoint",
344: "XClipPathUnits",
286: "XPosition",
529: "YCbCrCoefficients",
531: "YCbCrPositioning",
530: "YCbCrSubSampling",
345: "YClipPathUnits",
287: "YPosition",
37378: "ApertureValue",
40961: "ColorSpace",
36868: "DateTimeDigitized",
36867: "DateTimeOriginal",
34665: "Exif IFD",
36864: "ExifVersion",
33434: "ExposureTime",
41728: "FileSource",
37385: "Flash",
40960: "FlashpixVersion",
33437: "FNumber",
42016: "ImageUniqueID",
37384: "LightSource",
37500: "MakerNote",
37377: "ShutterSpeedValue",
37510: "UserComment",
33723: "IPTC",
34675: "ICC Profile",
700: "XMP",
42112: "GDAL_METADATA",
42113: "GDAL_NODATA",
34377: "Photoshop"
},
fieldTypeNames: {
1: "BYTE",
2: "ASCII",
3: "SHORT",
4: "LONG",
5: "RATIONAL",
6: "SBYTE",
7: "UNDEFINED",
8: "SSHORT",
9: "SLONG",
10: "SRATIONAL",
11: "FLOAT",
12: "DOUBLE"
}
};
e.exports = n;
}), {
"../core/CCDebug": 69
} ],
355: [ (function(t) {
"use strict";
t("./CCParticleAsset");
t("./CCParticleSystem");
t("./particle-simulator");
t("./particle-system-assembler");
}), {
"./CCParticleAsset": 352,
"./CCParticleSystem": 353,
"./particle-simulator": 356,
"./particle-system-assembler": 357
} ],
356: [ (function(t, e) {
"use strict";
var i = t("../core/platform/js"), n = t("../core/utils/misc"), r = cc.v2(0, 0), s = cc.v2(), o = cc.v2(), a = cc.v2(), c = cc.v2(), l = function() {
this.pos = cc.v2(0, 0);
this.startPos = cc.v2(0, 0);
this.color = cc.color(0, 0, 0, 255);
this.deltaColor = {
r: 0,
g: 0,
b: 0,
a: 255
};
this.preciseColor = {
r: 0,
g: 0,
b: 0,
a: 255
};
this.size = 0;
this.deltaSize = 0;
this.rotation = 0;
this.deltaRotation = 0;
this.timeToLive = 0;
this.drawPos = cc.v2(0, 0);
this.aspectRatio = 1;
this.dir = cc.v2(0, 0);
this.radialAccel = 0;
this.tangentialAccel = 0;
this.angle = 0;
this.degreesPerSecond = 0;
this.radius = 0;
this.deltaRadius = 0;
}, u = new i.Pool(function(t) {
t.pos.set(r);
t.startPos.set(r);
t.color._val = 4278190080;
t.deltaColor.r = t.deltaColor.g = t.deltaColor.b = 0;
t.deltaColor.a = 255;
t.size = 0;
t.deltaSize = 0;
t.rotation = 0;
t.deltaRotation = 0;
t.timeToLive = 0;
t.drawPos.set(r);
t.aspectRatio = 1;
t.dir.set(r);
t.radialAccel = 0;
t.tangentialAccel = 0;
t.angle = 0;
t.degreesPerSecond = 0;
t.radius = 0;
t.deltaRadius = 0;
}, 1024);
u.get = function() {
return this._get() || new l();
};
var h = function(t) {
this.sys = t;
this.particles = [];
this.active = !1;
this.readyToPlay = !0;
this.finished = !1;
this.elapsed = 0;
this.emitCounter = 0;
this._uvFilled = 0;
this._worldRotation = 0;
};
h.prototype.stop = function() {
this.active = !1;
this.readyToPlay = !1;
this.elapsed = this.sys.duration;
this.emitCounter = 0;
};
h.prototype.reset = function() {
this.active = !0;
this.readyToPlay = !0;
this.elapsed = 0;
this.emitCounter = 0;
this.finished = !1;
for (var t = this.particles, e = 0; e < t.length; ++e) u.put(t[e]);
t.length = 0;
};
h.prototype.emitParticle = function(t) {
var e = this.sys, i = n.clampf, r = u.get();
this.particles.push(r);
r.timeToLive = e.life + e.lifeVar * (Math.random() - .5) * 2;
var s, o, a, c, l = r.timeToLive = Math.max(0, r.timeToLive);
r.pos.x = e.sourcePos.x + e.posVar.x * (Math.random() - .5) * 2;
r.pos.y = e.sourcePos.y + e.posVar.y * (Math.random() - .5) * 2;
var h = e._startColor, _ = e._startColorVar, f = e._endColor, d = e._endColorVar;
r.color.r = s = i(h.r + _.r * (Math.random() - .5) * 2, 0, 255);
r.color.g = o = i(h.g + _.g * (Math.random() - .5) * 2, 0, 255);
r.color.b = a = i(h.b + _.b * (Math.random() - .5) * 2, 0, 255);
r.color.a = c = i(h.a + _.a * (Math.random() - .5) * 2, 0, 255);
var p = r.color, m = r.preciseColor;
m.r = p.r;
m.g = p.g;
m.b = p.b;
m.a = p.a;
r.deltaColor.r = (i(f.r + d.r * (Math.random() - .5) * 2, 0, 255) - s) / l;
r.deltaColor.g = (i(f.g + d.g * (Math.random() - .5) * 2, 0, 255) - o) / l;
r.deltaColor.b = (i(f.b + d.b * (Math.random() - .5) * 2, 0, 255) - a) / l;
r.deltaColor.a = (i(f.a + d.a * (Math.random() - .5) * 2, 0, 255) - c) / l;
var y = e.startSize + e.startSizeVar * (Math.random() - .5) * 2;
y = Math.max(0, y);
r.size = y;
if (e.endSize === cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE) r.deltaSize = 0; else {
var v = e.endSize + e.endSizeVar * (Math.random() - .5) * 2;
v = Math.max(0, v);
r.deltaSize = (v - y) / l;
}
var g = e.startSpin + e.startSpinVar * (Math.random() - .5) * 2, b = e.endSpin + e.endSpinVar * (Math.random() - .5) * 2;
r.rotation = g;
r.deltaRotation = (b - g) / l;
r.startPos.x = t.x;
r.startPos.y = t.y;
r.aspectRatio = e._aspectRatio || 1;
var C = n.degreesToRadians(e.angle + this._worldRotation + e.angleVar * (Math.random() - .5) * 2);
if (e.emitterMode === cc.ParticleSystem.EmitterMode.GRAVITY) {
var x = e.speed + e.speedVar * (Math.random() - .5) * 2;
r.dir.x = Math.cos(C);
r.dir.y = Math.sin(C);
r.dir.mulSelf(x);
r.radialAccel = e.radialAccel + e.radialAccelVar * (Math.random() - .5) * 2;
r.tangentialAccel = e.tangentialAccel + e.tangentialAccelVar * (Math.random() - .5) * 2;
e.rotationIsDir && (r.rotation = -n.radiansToDegrees(Math.atan2(r.dir.y, r.dir.x)));
} else {
var A = e.startRadius + e.startRadiusVar * (Math.random() - .5) * 2, S = e.endRadius + e.endRadiusVar * (Math.random() - .5) * 2;
r.radius = A;
r.deltaRadius = e.endRadius === cc.ParticleSystem.START_RADIUS_EQUAL_TO_END_RADIUS ? 0 : (S - A) / l;
r.angle = C;
r.degreesPerSecond = n.degreesToRadians(e.rotatePerS + e.rotatePerSVar * (Math.random() - .5) * 2);
}
};
function _(t) {
for (var e = 0, i = t; i; ) {
e += i.angle;
i = i.parent;
}
return e;
}
h.prototype.updateUVs = function(t) {
var e = this.sys._assembler;
if (e) {
var i = e.getBuffer();
if (i && this.sys._renderSpriteFrame) {
for (var n = 4 * e._vfmt._bytes / 4, r = i._vData, s = this.sys._renderSpriteFrame.uv, o = t ? 0 : this._uvFilled, a = this.particles.length, c = o; c < a; c++) {
var l = c * n;
r[l + 2] = s[0];
r[l + 3] = s[1];
r[l + 7] = s[2];
r[l + 8] = s[3];
r[l + 12] = s[4];
r[l + 13] = s[5];
r[l + 17] = s[6];
r[l + 18] = s[7];
}
this._uvFilled = a;
}
}
};
h.prototype.updateParticleBuffer = function(t, e, i, r) {
var s = i._vData, o = i._uintVData, a = e.x, c = e.y, l = t.size, u = l, h = t.aspectRatio;
h > 1 ? u = l / h : l = u * h;
var _ = l / 2, f = u / 2;
if (t.rotation) {
var d = -_, p = -f, m = _, y = f, v = -n.degreesToRadians(t.rotation), g = Math.cos(v), b = Math.sin(v);
s[r] = d * g - p * b + a;
s[r + 1] = d * b + p * g + c;
s[r + 5] = m * g - p * b + a;
s[r + 6] = m * b + p * g + c;
s[r + 10] = d * g - y * b + a;
s[r + 11] = d * b + y * g + c;
s[r + 15] = m * g - y * b + a;
s[r + 16] = m * b + y * g + c;
} else {
s[r] = a - _;
s[r + 1] = c - f;
s[r + 5] = a + _;
s[r + 6] = c - f;
s[r + 10] = a - _;
s[r + 11] = c + f;
s[r + 15] = a + _;
s[r + 16] = c + f;
}
o[r + 4] = t.color._val;
o[r + 9] = t.color._val;
o[r + 14] = t.color._val;
o[r + 19] = t.color._val;
};
h.prototype.step = function(t) {
t = t > cc.director._maxParticleDeltaTime ? cc.director._maxParticleDeltaTime : t;
var e = this.sys, i = e.node, n = this.particles, r = 4 * this.sys._assembler._vfmt._bytes / 4, l = cc.ParticleSystem.PositionType;
i._updateWorldMatrix();
if (e.positionType === l.FREE) {
this._worldRotation = _(i);
var h = i._worldMatrix.m;
s.x = h[12];
s.y = h[13];
} else if (e.positionType === l.RELATIVE) {
this._worldRotation = i.angle;
s.x = i.x;
s.y = i.y;
} else this._worldRotation = 0;
if (this.active && e.emissionRate) {
var f = 1 / e.emissionRate;
n.length < e.totalParticles && (this.emitCounter += t);
for (;n.length < e.totalParticles && this.emitCounter > f; ) {
this.emitParticle(s);
this.emitCounter -= f;
}
this.elapsed += t;
-1 !== e.duration && e.duration < this.elapsed && e.stopSystem();
}
var d = e._assembler.getBuffer(), p = n.length;
d.reset();
d.request(4 * p, 6 * p);
p > this._uvFilled && this.updateUVs();
for (var m = 0; m < n.length; ) {
o.x = o.y = a.x = a.y = c.x = c.y = 0;
var y = n[m];
y.timeToLive -= t;
if (y.timeToLive > 0) {
if (e.emitterMode === cc.ParticleSystem.EmitterMode.GRAVITY) {
var v = c, g = o, b = a;
if (y.pos.x || y.pos.y) {
g.set(y.pos);
g.normalizeSelf();
}
b.set(g);
g.mulSelf(y.radialAccel);
var C = b.x;
b.x = -b.y;
b.y = C;
b.mulSelf(y.tangentialAccel);
v.set(g);
v.addSelf(b);
v.addSelf(e.gravity);
v.mulSelf(t);
y.dir.addSelf(v);
v.set(y.dir);
v.mulSelf(t);
y.pos.addSelf(v);
} else {
y.angle += y.degreesPerSecond * t;
y.radius += y.deltaRadius * t;
y.pos.x = -Math.cos(y.angle) * y.radius;
y.pos.y = -Math.sin(y.angle) * y.radius;
}
var x = y.preciseColor, A = y.deltaColor;
x.r += A.r * t;
x.g += A.g * t;
x.b += A.b * t;
x.a += A.a * t;
var S = y.color;
S.r = x.r;
S.g = x.g;
S.b = x.b;
S.a = x.a;
y.size += y.deltaSize * t;
y.size < 0 && (y.size = 0);
y.rotation += y.deltaRotation * t;
var T = o;
T.set(y.pos);
e.positionType !== l.GROUPED && T.addSelf(y.startPos);
var w = r * m;
this.updateParticleBuffer(y, T, d, w);
++m;
} else {
var E = n[m];
m !== n.length - 1 && (n[m] = n[n.length - 1]);
u.put(E);
n.length--;
}
}
e._assembler._ia._count = 6 * n.length;
if (n.length > 0) d.uploadData(); else if (!this.active && !this.readyToPlay) {
this.finished = !0;
e._finishedSimulation();
}
};
e.exports = h;
}), {
"../core/platform/js": 260,
"../core/utils/misc": 322
} ],
357: [ (function(t, e) {
"use strict";
var i = r(t("../core/renderer/assembler")), n = r(t("../renderer/core/input-assembler"));
function r(t) {
return t && t.__esModule ? t : {
default: t
};
}
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a = t("./CCParticleSystem"), c = t("../core/renderer/"), l = t("../core/renderer/webgl/quad-buffer"), u = t("../core/renderer/webgl/vertex-format").vfmtPosUvColor, h = (function(t) {
s(e, t);
function e(e) {
var i;
(i = t.call(this, e) || this)._buffer = null;
i._ia = null;
i._vfmt = u;
return i;
}
var i = e.prototype;
i.getBuffer = function() {
if (!this._buffer) {
this._buffer = new l(c._handle, u);
this._ia = new n.default();
this._ia._vertexBuffer = this._buffer._vb;
this._ia._indexBuffer = this._buffer._ib;
this._ia._start = 0;
this._ia._count = 0;
}
return this._buffer;
};
i.fillBuffers = function(t, e) {
if (this._ia) {
var i = cc.ParticleSystem.PositionType;
t.positionType === i.RELATIVE ? e.node = t.node.parent : e.node = t.node;
e.material = t._materials[0];
e._flushIA(this._ia);
}
};
return e;
})(i.default);
i.default.register(a, h);
e.exports = h;
}), {
"../core/renderer/": 271,
"../core/renderer/assembler": 268,
"../core/renderer/webgl/quad-buffer": 309,
"../core/renderer/webgl/vertex-format": 311,
"../renderer/core/input-assembler": 359,
"./CCParticleSystem": 353
} ],
358: [ (function(t, e) {
"use strict";
var i, n, r, s, o, a, c, l, u, h, _, f, d, p, m, y, v, g, b, C, x, A, S, T, w, E, M, B, I, D, P, R, L, O, V, N, F, z, k, G, U, H;
(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";
})(i || (i = {}));
(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";
})(n || (n = {}));
(function(t) {
t[t.UNREADY = 0] = "UNREADY";
t[t.FAILED = 1] = "FAILED";
t[t.SUCCESS = 2] = "SUCCESS";
})(r || (r = {}));
(function() {
function t(t) {
this._gfxType = n.UNKNOWN;
this._status = r.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";
})(s || (s = {}));
(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";
})(o || (o = {}));
(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";
})(a || (a = {}));
(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";
})(c || (c = {}));
(function(t) {
t[t.NONE = 0] = "NONE";
t[t.DEVICE = 1] = "DEVICE";
t[t.HOST = 2] = "HOST";
})(l || (l = {}));
(function(t) {
t[t.NONE = 0] = "NONE";
t[t.READ = 1] = "READ";
t[t.WRITE = 2] = "WRITE";
})(u || (u = {}));
(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";
})(h || (h = {}));
(function(t) {
t[t.FILL = 0] = "FILL";
t[t.POINT = 1] = "POINT";
t[t.LINE = 2] = "LINE";
})(_ || (_ = {}));
(function(t) {
t[t.GOURAND = 0] = "GOURAND";
t[t.FLAT = 1] = "FLAT";
})(f || (f = {}));
(function(t) {
t[t.NONE = 0] = "NONE";
t[t.FRONT = 1] = "FRONT";
t[t.BACK = 2] = "BACK";
})(d || (d = {}));
(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";
})(p || (p = {}));
(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";
})(m || (m = {}));
(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";
})(y || (y = {}));
(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";
})(v || (v = {}));
(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";
})(g || (g = {}));
(function(t) {
t[t.NONE = 0] = "NONE";
t[t.POINT = 1] = "POINT";
t[t.LINEAR = 2] = "LINEAR";
t[t.ANISOTROPIC = 3] = "ANISOTROPIC";
})(b || (b = {}));
(function(t) {
t[t.WRAP = 0] = "WRAP";
t[t.MIRROR = 1] = "MIRROR";
t[t.CLAMP = 2] = "CLAMP";
t[t.BORDER = 3] = "BORDER";
})(C || (C = {}));
(function(t) {
t[t.TEX1D = 0] = "TEX1D";
t[t.TEX2D = 1] = "TEX2D";
t[t.TEX3D = 2] = "TEX3D";
})(x || (x = {}));
(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";
})(A || (A = {}));
(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";
})(S || (S = {}));
(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";
})(T || (T = {}));
(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";
})(w || (w = {}));
(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";
})(E || (E = {}));
(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";
})(M || (M = {}));
(function(t) {
t[t.PRIMARY = 0] = "PRIMARY";
t[t.SECONDARY = 1] = "SECONDARY";
})(B || (B = {}));
(function(t) {
t[t.LOAD = 0] = "LOAD";
t[t.CLEAR = 1] = "CLEAR";
t[t.DISCARD = 2] = "DISCARD";
})(I || (I = {}));
(function(t) {
t[t.STORE = 0] = "STORE";
t[t.DISCARD = 1] = "DISCARD";
})(D || (D = {}));
(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";
})(P || (P = {}));
(function(t) {
t[t.GRAPHICS = 0] = "GRAPHICS";
t[t.COMPUTE = 1] = "COMPUTE";
t[t.RAY_TRACING = 2] = "RAY_TRACING";
})(R || (R = {}));
(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";
})(L || (L = {}));
(function(t) {
t[t.FRONT = 0] = "FRONT";
t[t.BACK = 1] = "BACK";
t[t.ALL = 2] = "ALL";
})(O || (O = {}));
(function(t) {
t[t.GRAPHICS = 0] = "GRAPHICS";
t[t.COMPUTE = 1] = "COMPUTE";
t[t.TRANSFER = 2] = "TRANSFER";
})(V || (V = {}));
(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";
})(N || (N = {}));
(function(t) {
t[t.DEFAULT = 100] = "DEFAULT";
})(F || (F = {}));
(function(t) {
t[t.MIN = 0] = "MIN";
t[t.MAX = 255] = "MAX";
t[t.DEFAULT = 128] = "DEFAULT";
})(z || (z = {}));
(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";
})(k || (k = {}));
(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";
})(H || (H = {}));
var j = {};
j[j.bool = o.BOOL] = "bool";
j[j.int = o.INT] = "int";
j[j.ivec2 = o.INT2] = "ivec2invTypeParams";
j[j.ivec3 = o.INT3] = "ivec3";
j[j.ivec4 = o.INT4] = "ivec4";
j[j.float = o.FLOAT] = "float";
j[j.vec2 = o.FLOAT2] = "vec2";
j[j.vec3 = o.FLOAT3] = "vec3";
j[j.vec4 = o.FLOAT4] = "vec4";
j[j.mat2 = o.MAT2] = "mat2";
j[j.mat3 = o.MAT3] = "mat3";
j[j.mat4 = o.MAT4] = "mat4";
j[j.sampler2D = o.SAMPLER2D] = "sampler2D";
j[j.samplerCube = o.SAMPLER_CUBE] = "samplerCube";
var W = ((G = {})[o.BOOL] = 4, G[o.INT] = 4, G[o.INT2] = 8, G[o.INT3] = 12, G[o.INT4] = 16, 
G[o.FLOAT] = 4, G[o.FLOAT2] = 8, G[o.FLOAT3] = 12, G[o.FLOAT4] = 16, G[o.MAT2] = 16, 
G[o.MAT3] = 36, G[o.MAT4] = 64, G[o.SAMPLER2D] = 4, G[o.SAMPLER_CUBE] = 4, G), q = ((U = {})[o.BOOL] = a.R32I, 
U[o.INT] = a.R32I, U[o.INT2] = a.RG32I, U[o.INT3] = a.RGB32I, U[o.INT4] = a.RGBA32I, 
U[o.FLOAT] = a.R32F, U[o.FLOAT2] = a.RG32F, U[o.FLOAT3] = a.RGB32F, U[o.FLOAT4] = a.RGBA32F, 
U), X = {
BACK: 1029,
FRONT: 1028,
NONE: 0,
ADD: 32774,
SUB: 32778,
REV_SUB: 32779,
ZERO: 0,
ONE: 1,
SRC_COLOR: 768,
ONE_MINUS_SRC_COLOR: 769,
DST_COLOR: 774,
ONE_MINUS_DST_COLOR: 775,
SRC_ALPHA: 770,
ONE_MINUS_SRC_ALPHA: 771,
DST_ALPHA: 772,
ONE_MINUS_DST_ALPHA: 773,
CONSTANT_COLOR: 32769,
ONE_MINUS_CONSTANT_COLOR: 32770,
CONSTANT_ALPHA: 32771,
ONE_MINUS_CONSTANT_ALPHA: 32772,
SRC_ALPHA_SATURATE: 776,
NEVER: 512,
LESS: 513,
EQUAL: 514,
LEQUAL: 515,
GREATER: 516,
NOTEQUAL: 517,
GEQUAL: 518,
ALWAYS: 519,
KEEP: 7680,
REPLACE: 7681,
INCR: 7682,
INCR_WRAP: 34055,
DECR: 7683,
DECR_WRAP: 34056,
INVERT: 5386
};
Object.assign(X, F);
var Y = {
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);
}
r = 1540483477 * (65535 & (r ^= r >>> 13)) + ((1540483477 * (r >>> 16) & 65535) << 16);
return (r ^= r >>> 15) >>> 0;
},
SamplerInfoIndex: H,
effectStructure: {
$techniques: [ {
$passes: [ {
depthStencilState: {},
rasterizerState: {},
blendState: {
targets: [ {} ]
},
properties: {
any: {
sampler: {},
inspector: {}
}
}
} ]
} ]
},
typeMap: j,
sizeMap: W,
formatMap: q,
passParams: X,
RenderQueue: {
OPAQUE: 0,
TRANSPARENT: 1,
OVERLAY: 2
},
RenderPriority: z,
GFXGetTypeSize: function(t) {
switch (t) {
case o.BOOL:
case o.INT:
case o.UINT:
case o.FLOAT:
return 4;

case o.BOOL2:
case o.INT2:
case o.UINT2:
case o.FLOAT2:
return 8;

case o.BOOL3:
case o.INT3:
case o.UINT3:
case o.FLOAT3:
return 12;

case o.BOOL4:
case o.INT4:
case o.UINT4:
case o.FLOAT4:
case o.MAT2:
return 16;

case o.MAT2X3:
return 24;

case o.MAT2X4:
return 32;

case o.MAT3X2:
return 24;

case o.MAT3:
return 36;

case o.MAT3X4:
return 48;

case o.MAT4X2:
case o.MAT4X2:
return 32;

case o.MAT4:
return 64;

case o.SAMPLER1D:
case o.SAMPLER1D_ARRAY:
case o.SAMPLER2D:
case o.SAMPLER2D_ARRAY:
case o.SAMPLER3D:
case o.SAMPLER_CUBE:
return 4;

default:
return 0;
}
},
UniformBinding: k
};
e.exports = Y;
}), {} ],
359: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../gfx")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function o(t, e, i) {
e && s(t.prototype, e);
i && s(t, i);
return t;
}
var a = (function() {
function t(t, e, i) {
void 0 === i && (i = r.default.PT_TRIANGLES);
this._vertexBuffer = t;
this._indexBuffer = e;
this._primitiveType = i;
this._start = 0;
this._count = -1;
}
o(t, [ {
key: "count",
get: function() {
return -1 !== this._count ? this._count : this._indexBuffer ? this._indexBuffer.count : this._vertexBuffer ? this._vertexBuffer.count : 0;
}
} ]);
return t;
})();
i.default = a;
e.exports = i.default;
}), {
"../gfx": 363
} ],
360: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = o(t("../gfx")), r = o(t("../enums")), s = o(t("../../core/value-types/value-type"));
function o(t) {
return t && t.__esModule ? t : {
default: t
};
}
var a = (function() {
function t(t, e, i, r, s, o) {
void 0 === s && (s = {});
void 0 === o && (o = {});
this._name = t;
this._detailName = e;
this._programName = i;
this._programKey = null;
this._stage = r;
this._properties = s;
this._defines = o;
this._propertyNames = Object.keys(s);
this._defineNames = Object.keys(o);
this._cullMode = n.default.CULL_BACK;
this._blend = !1;
this._blendEq = n.default.BLEND_FUNC_ADD;
this._blendAlphaEq = n.default.BLEND_FUNC_ADD;
this._blendSrc = n.default.BLEND_SRC_ALPHA;
this._blendDst = n.default.BLEND_ONE_MINUS_SRC_ALPHA;
this._blendSrcAlpha = n.default.BLEND_SRC_ALPHA;
this._blendDstAlpha = n.default.BLEND_ONE_MINUS_SRC_ALPHA;
this._blendColor = 4294967295;
this._depthTest = !1;
this._depthWrite = !1;
this._depthFunc = n.default.DS_FUNC_LESS, this._stencilTest = n.default.STENCIL_INHERIT;
this._stencilFuncFront = n.default.DS_FUNC_ALWAYS;
this._stencilRefFront = 0;
this._stencilMaskFront = 255;
this._stencilFailOpFront = n.default.STENCIL_OP_KEEP;
this._stencilZFailOpFront = n.default.STENCIL_OP_KEEP;
this._stencilZPassOpFront = n.default.STENCIL_OP_KEEP;
this._stencilWriteMaskFront = 255;
this._stencilFuncBack = n.default.DS_FUNC_ALWAYS;
this._stencilRefBack = 0;
this._stencilMaskBack = 255;
this._stencilFailOpBack = n.default.STENCIL_OP_KEEP;
this._stencilZFailOpBack = n.default.STENCIL_OP_KEEP;
this._stencilZPassOpBack = n.default.STENCIL_OP_KEEP;
this._stencilWriteMaskBack = 255;
}
var e = t.prototype;
e.setCullMode = function(t) {
void 0 === t && (t = n.default.CULL_BACK);
this._cullMode = t;
};
e.setBlend = function(t, e, i, r, s, o, a, c) {
void 0 === t && (t = !1);
void 0 === e && (e = n.default.BLEND_FUNC_ADD);
void 0 === i && (i = n.default.BLEND_SRC_ALPHA);
void 0 === r && (r = n.default.BLEND_ONE_MINUS_SRC_ALPHA);
void 0 === s && (s = n.default.BLEND_FUNC_ADD);
void 0 === o && (o = n.default.BLEND_SRC_ALPHA);
void 0 === a && (a = n.default.BLEND_ONE_MINUS_SRC_ALPHA);
void 0 === c && (c = 4294967295);
this._blend = t;
this._blendEq = e;
this._blendSrc = i;
this._blendDst = r;
this._blendAlphaEq = s;
this._blendSrcAlpha = o;
this._blendDstAlpha = a;
this._blendColor = c;
};
e.setDepth = function(t, e, i) {
void 0 === t && (t = !1);
void 0 === e && (e = !1);
void 0 === i && (i = n.default.DS_FUNC_LESS);
this._depthTest = t;
this._depthWrite = e;
this._depthFunc = i;
};
e.setStencilFront = function(t, e, i, r, s, o, a, c) {
void 0 === t && (t = n.default.STENCIL_INHERIT);
void 0 === e && (e = n.default.DS_FUNC_ALWAYS);
void 0 === i && (i = 0);
void 0 === r && (r = 255);
void 0 === s && (s = n.default.STENCIL_OP_KEEP);
void 0 === o && (o = n.default.STENCIL_OP_KEEP);
void 0 === a && (a = n.default.STENCIL_OP_KEEP);
void 0 === c && (c = 255);
this._stencilTest = t;
this._stencilFuncFront = e;
this._stencilRefFront = i;
this._stencilMaskFront = r;
this._stencilFailOpFront = s;
this._stencilZFailOpFront = o;
this._stencilZPassOpFront = a;
this._stencilWriteMaskFront = c;
};
e.setStencilEnabled = function(t) {
void 0 === t && (t = n.default.STENCIL_INHERIT);
this._stencilTest = t;
};
e.setStencilBack = function(t, e, i, r, s, o, a, c) {
void 0 === t && (t = n.default.STENCIL_INHERIT);
void 0 === e && (e = n.default.DS_FUNC_ALWAYS);
void 0 === i && (i = 0);
void 0 === r && (r = 255);
void 0 === s && (s = n.default.STENCIL_OP_KEEP);
void 0 === o && (o = n.default.STENCIL_OP_KEEP);
void 0 === a && (a = n.default.STENCIL_OP_KEEP);
void 0 === c && (c = 255);
this._stencilTest = t;
this._stencilFuncBack = e;
this._stencilRefBack = i;
this._stencilMaskBack = r;
this._stencilFailOpBack = s;
this._stencilZFailOpBack = o;
this._stencilZPassOpBack = a;
this._stencilWriteMaskBack = c;
};
e.setStage = function(t) {
this._stage = t;
};
e.setProperties = function(t) {
this._properties = t;
};
e.getProperty = function(t) {
if (this._properties[t]) return this._properties[t].value;
};
e.setProperty = function(t, e, i) {
var n = this._properties[t];
if (!n) return !1;
n.directly = i;
if (Array.isArray(e)) {
var o = n.value;
if (o.length !== e.length) {
cc.warnID(9105, this._name, t);
return;
}
for (var a = 0; a < e.length; a++) o[a] = e[a];
} else if (e && !ArrayBuffer.isView(e)) if (n.type === r.default.PARAM_TEXTURE_2D) n.value = e.getImpl(); else if (e instanceof s.default) e.constructor.toArray(n.value, e); else {
"object" == typeof e && cc.warnID(9106, this._name, t);
n.value = e;
} else n.value = e;
return !0;
};
e.getDefine = function(t) {
return this._defines[t];
};
e.define = function(t, e, i) {
var n = this._defines[t];
if (!i && void 0 === n) return !1;
if (n !== e) {
this._defines[t] = e;
this._programKey = null;
}
return !0;
};
e.clone = function() {
var e = new t(this._programName);
Object.assign(e, this);
var i = {}, n = this._properties;
for (var r in n) {
var s = n[r], o = i[r] = {}, a = s.value;
Array.isArray(a) ? o.value = a.concat() : ArrayBuffer.isView(a) ? o.value = new a.__proto__.constructor(a) : o.value = a;
for (var c in s) "value" !== c && (o[c] = s[c]);
}
e._properties = i;
e._defines = Object.assign({}, this._defines);
e._propertyNames = this._propertyNames;
e._defineNames = this._defineNames;
return e;
};
return t;
})();
i.default = a;
e.exports = i.default;
}), {
"../../core/value-types/value-type": 345,
"../enums": 362,
"../gfx": 363
} ],
361: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
function n(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function r(t, e, i) {
e && n(t.prototype, e);
i && n(t, i);
return t;
}
var s = (function() {
function t(t, e) {
this._name = t;
this._passes = e;
}
t.prototype.clone = function() {
for (var e = [], i = 0; i < this._passes.length; i++) e.push(this._passes[i].clone());
return new t(this._name, e);
};
r(t, [ {
key: "name",
get: function() {
return this._name;
}
}, {
key: "passes",
get: function() {
return this._passes;
}
} ]);
return t;
})();
i.default = s;
e.exports = i.default;
}), {} ],
362: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = t("./build/mappings"), r = {
PROJ_PERSPECTIVE: 0,
PROJ_ORTHO: 1,
LIGHT_DIRECTIONAL: 0,
LIGHT_POINT: 1,
LIGHT_SPOT: 2,
LIGHT_AMBIENT: 3,
SHADOW_NONE: 0,
SHADOW_HARD: 1,
SHADOW_SOFT: 2,
PARAM_INT: n.typeMap.int,
PARAM_INT2: n.typeMap.ivec2,
PARAM_INT3: n.typeMap.ivec3,
PARAM_INT4: n.typeMap.ivec4,
PARAM_FLOAT: n.typeMap.float,
PARAM_FLOAT2: n.typeMap.vec2,
PARAM_FLOAT3: n.typeMap.vec3,
PARAM_FLOAT4: n.typeMap.vec4,
PARAM_MAT2: n.typeMap.mat2,
PARAM_MAT3: n.typeMap.mat3,
PARAM_MAT4: n.typeMap.mat4,
PARAM_TEXTURE_2D: n.typeMap.sampler2D,
PARAM_TEXTURE_CUBE: n.typeMap.samplerCube,
CLEAR_COLOR: 1,
CLEAR_DEPTH: 2,
CLEAR_STENCIL: 4,
CLEAR_SKYBOX: 8,
BUFFER_VIEW_INT8: 0,
BUFFER_VIEW_UINT8: 1,
BUFFER_VIEW_INT16: 2,
BUFFER_VIEW_UINT16: 3,
BUFFER_VIEW_INT32: 4,
BUFFER_VIEW_UINT32: 5,
BUFFER_VIEW_FLOAT32: 6
};
i.default = r;
e.exports = i.default;
}), {
"./build/mappings": 358
} ],
363: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
t("./enums");
var n, r = n = window.gfx;
i.default = r;
cc.gfx = n;
e.exports = i.default;
}), {
"./device": void 0,
"./enums": void 0,
"./frame-buffer": void 0,
"./index-buffer": void 0,
"./program": void 0,
"./render-buffer": void 0,
"./texture": void 0,
"./texture-2d": void 0,
"./texture-cube": void 0,
"./vertex-buffer": void 0,
"./vertex-format": void 0
} ],
364: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = (function() {
function t(t, e) {
this._fn = t;
this._idx = e - 1;
this._frees = new Array(e);
for (var i = 0; i < e; ++i) this._frees[i] = t();
}
var e = t.prototype;
e._expand = function(t) {
var e = this._frees;
this._frees = new Array(t);
for (var i = t - e.length, n = 0; n < i; ++n) this._frees[n] = this._fn();
for (var r = i, s = 0; r < t; ++r, ++s) this._frees[r] = e[s];
this._idx += i;
};
e.alloc = function() {
this._idx < 0 && this._expand(Math.round(1.2 * this._frees.length) + 1);
var t = this._frees[this._idx];
this._frees[this._idx] = null;
--this._idx;
return t;
};
e.free = function(t) {
++this._idx;
this._frees[this._idx] = t;
};
e.clear = function(t) {
for (var e = 0; e <= this._idx; e++) t && t(this._frees[e]);
this._frees.length = 0;
this._idx = -1;
};
return t;
})();
i.default = n;
e.exports = i.default;
}), {} ],
365: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("./timsort")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1;
n.configurable = !0;
"value" in n && (n.writable = !0);
Object.defineProperty(t, n.key, n);
}
}
function o(t, e, i) {
e && s(t.prototype, e);
i && s(t, i);
return t;
}
var a = (function() {
function t(t, e) {
this._fn = t;
this._count = 0;
this._data = new Array(e);
for (var i = 0; i < e; ++i) this._data[i] = t();
}
var e = t.prototype;
e.reset = function() {
this._count = 0;
};
e.resize = function(t) {
if (t > this._data.length) for (var e = this._data.length; e < t; ++e) this._data[e] = this._fn();
};
e.add = function() {
this._count >= this._data.length && this.resize(2 * this._data.length);
return 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, r.default)(this._data, 0, this._count, t);
};
o(t, [ {
key: "length",
get: function() {
return this._count;
}
}, {
key: "data",
get: function() {
return this._data;
}
} ]);
return t;
})();
i.default = a;
cc.RecyclePool = a;
e.exports = i.default;
}), {
"./timsort": 366
} ],
366: [ (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 = c);
var s = i - e;
if (!(s < 2)) {
var o = 0;
if (s < n) _(t, e, i, e + (o = u(t, e, i, r)), r); else {
var a = new p(t, r), h = l(s);
do {
if ((o = u(t, e, i, r)) < h) {
var f = s;
f > h && (f = h);
_(t, e, e + f, e + o, r);
o = f;
}
a.pushRun(e, o);
a.mergeRuns();
s -= o;
e += o;
} while (0 !== s);
a.forceMergeRuns();
}
}
};
var n = 32, r = 7, s = 256, o = [ 1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9 ];
function a(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 c(t, e) {
if (t === e) return 0;
if (~~t === t && ~~e === e) {
if (0 === t || 0 === e) return t < e ? -1 : 1;
if (t < 0 || e < 0) {
if (e >= 0) return -1;
if (t >= 0) return 1;
t = -t;
e = -e;
}
var i = a(t), n = a(e), r = 0;
if (i < n) {
t *= o[n - i - 1];
e /= 10;
r = -1;
} else if (i > n) {
e *= o[i - n - 1];
t /= 10;
r = 1;
}
return t === e ? r : t < e ? -1 : 1;
}
var s = String(t), c = String(e);
return s === c ? 0 : s < c ? -1 : 1;
}
function l(t) {
for (var e = 0; t >= n; ) {
e |= 1 & t;
t >>= 1;
}
return t + e;
}
function u(t, e, i, n) {
var r = e + 1;
if (r === i) return 1;
if (n(t[r++], t[e]) < 0) {
for (;r < i && n(t[r], t[r - 1]) < 0; ) r++;
h(t, e, r);
} else for (;r < i && n(t[r], t[r - 1]) >= 0; ) r++;
return r - e;
}
function h(t, e, i) {
i--;
for (;e < i; ) {
var n = t[e];
t[e++] = t[i];
t[i--] = n;
}
}
function _(t, e, i, n, r) {
n === e && n++;
for (;n < i; n++) {
for (var s = t[n], o = e, a = n; o < a; ) {
var c = o + a >>> 1;
r(s, t[c]) < 0 ? a = c : o = c + 1;
}
var l = n - o;
switch (l) {
case 3:
t[o + 3] = t[o + 2];

case 2:
t[o + 2] = t[o + 1];

case 1:
t[o + 1] = t[o];
break;

default:
for (;l > 0; ) {
t[o + l] = t[o + l - 1];
l--;
}
}
t[o] = s;
}
}
function f(t, e, i, n, r, s) {
var o = 0, a = 0, c = 1;
if (s(t, e[i + r]) > 0) {
a = n - r;
for (;c < a && s(t, e[i + r + c]) > 0; ) {
o = c;
(c = 1 + (c << 1)) <= 0 && (c = a);
}
c > a && (c = a);
o += r;
c += r;
} else {
a = r + 1;
for (;c < a && s(t, e[i + r - c]) <= 0; ) {
o = c;
(c = 1 + (c << 1)) <= 0 && (c = a);
}
c > a && (c = a);
var l = o;
o = r - c;
c = r - l;
}
o++;
for (;o < c; ) {
var u = o + (c - o >>> 1);
s(t, e[i + u]) > 0 ? o = u + 1 : c = u;
}
return c;
}
function d(t, e, i, n, r, s) {
var o = 0, a = 0, c = 1;
if (s(t, e[i + r]) < 0) {
a = r + 1;
for (;c < a && s(t, e[i + r - c]) < 0; ) {
o = c;
(c = 1 + (c << 1)) <= 0 && (c = a);
}
c > a && (c = a);
var l = o;
o = r - c;
c = r - l;
} else {
a = n - r;
for (;c < a && s(t, e[i + r + c]) >= 0; ) {
o = c;
(c = 1 + (c << 1)) <= 0 && (c = a);
}
c > a && (c = a);
o += r;
c += r;
}
o++;
for (;o < c; ) {
var u = o + (c - o >>> 1);
s(t, e[i + u]) < 0 ? c = u : o = u + 1;
}
return c;
}
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;
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] && t--; else if (this.runLength[t] > 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] < this.runLength[t + 1] && t--;
this.mergeAt(t);
}
};
e.mergeAt = function(t) {
var e = this.compare, i = this.array, n = this.runStart[t], r = this.runLength[t], s = this.runStart[t + 1], o = this.runLength[t + 1];
this.runLength[t] = r + o;
if (t === this.stackSize - 3) {
this.runStart[t + 1] = this.runStart[t + 2];
this.runLength[t + 1] = this.runLength[t + 2];
}
this.stackSize--;
var a = d(i[s], i, n, r, 0, e);
n += a;
0 != (r -= a) && 0 !== (o = f(i[n + r - 1], i, s, o, o - 1, e)) && (r <= o ? this.mergeLow(n, r, s, o) : this.mergeHigh(n, r, s, o));
};
e.mergeLow = function(t, e, i, n) {
var s = this.compare, o = this.array, a = this.tmp, c = 0;
for (c = 0; c < e; c++) a[c] = o[t + c];
var l = 0, u = i, h = t;
o[h++] = o[u++];
if (0 != --n) if (1 !== e) {
for (var _ = this.minGallop; ;) {
var p = 0, m = 0, y = !1;
do {
if (s(o[u], a[l]) < 0) {
o[h++] = o[u++];
m++;
p = 0;
if (0 == --n) {
y = !0;
break;
}
} else {
o[h++] = a[l++];
p++;
m = 0;
if (1 == --e) {
y = !0;
break;
}
}
} while ((p | m) < _);
if (y) break;
do {
if (0 !== (p = d(o[u], a, l, e, 0, s))) {
for (c = 0; c < p; c++) o[h + c] = a[l + c];
h += p;
l += p;
if ((e -= p) <= 1) {
y = !0;
break;
}
}
o[h++] = o[u++];
if (0 == --n) {
y = !0;
break;
}
if (0 !== (m = f(a[l], o, u, n, 0, s))) {
for (c = 0; c < m; c++) o[h + c] = o[u + c];
h += m;
u += m;
if (0 == (n -= m)) {
y = !0;
break;
}
}
o[h++] = a[l++];
if (1 == --e) {
y = !0;
break;
}
_--;
} while (p >= r || m >= r);
if (y) break;
_ < 0 && (_ = 0);
_ += 2;
}
this.minGallop = _;
_ < 1 && (this.minGallop = 1);
if (1 === e) {
for (c = 0; c < n; c++) o[h + c] = o[u + c];
o[h + n] = a[l];
} else {
if (0 === e) throw new Error("mergeLow preconditions were not respected");
for (c = 0; c < e; c++) o[h + c] = a[l + c];
}
} else {
for (c = 0; c < n; c++) o[h + c] = o[u + c];
o[h + n] = a[l];
} else for (c = 0; c < e; c++) o[h + c] = a[l + c];
};
e.mergeHigh = function(t, e, i, n) {
var s = this.compare, o = this.array, a = this.tmp, c = 0;
for (c = 0; c < n; c++) a[c] = o[i + c];
var l = t + e - 1, u = n - 1, h = i + n - 1, _ = 0, p = 0;
o[h--] = o[l--];
if (0 != --e) if (1 !== n) {
for (var m = this.minGallop; ;) {
var y = 0, v = 0, g = !1;
do {
if (s(a[u], o[l]) < 0) {
o[h--] = o[l--];
y++;
v = 0;
if (0 == --e) {
g = !0;
break;
}
} else {
o[h--] = a[u--];
v++;
y = 0;
if (1 == --n) {
g = !0;
break;
}
}
} while ((y | v) < m);
if (g) break;
do {
if (0 != (y = e - d(a[u], o, t, e, e - 1, s))) {
e -= y;
p = 1 + (h -= y);
_ = 1 + (l -= y);
for (c = y - 1; c >= 0; c--) o[p + c] = o[_ + c];
if (0 === e) {
g = !0;
break;
}
}
o[h--] = a[u--];
if (1 == --n) {
g = !0;
break;
}
if (0 != (v = n - f(o[l], a, 0, n, n - 1, s))) {
n -= v;
p = 1 + (h -= v);
_ = 1 + (u -= v);
for (c = 0; c < v; c++) o[p + c] = a[_ + c];
if (n <= 1) {
g = !0;
break;
}
}
o[h--] = o[l--];
if (0 == --e) {
g = !0;
break;
}
m--;
} while (y >= r || v >= r);
if (g) break;
m < 0 && (m = 0);
m += 2;
}
this.minGallop = m;
m < 1 && (this.minGallop = 1);
if (1 === n) {
p = 1 + (h -= e);
_ = 1 + (l -= e);
for (c = e - 1; c >= 0; c--) o[p + c] = o[_ + c];
o[h] = a[u];
} else {
if (0 === n) throw new Error("mergeHigh preconditions were not respected");
_ = h - (n - 1);
for (c = 0; c < n; c++) o[_ + c] = a[c];
}
} else {
p = 1 + (h -= e);
_ = 1 + (l -= e);
for (c = e - 1; c >= 0; c--) o[p + c] = o[_ + c];
o[h] = a[u];
} else {
_ = h - (n - 1);
for (c = 0; c < n; c++) o[_ + c] = a[c];
}
};
return t;
})();
e.exports = i.default;
}), {} ],
367: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = 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);
}
r = 1540483477 * (65535 & (r ^= r >>> 13)) + ((1540483477 * (r >>> 16) & 65535) << 16);
return (r ^= r >>> 15) >>> 0;
};
e.exports = i.default;
}), {} ],
368: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.getInspectorProps = function(t) {
var e = {
type: t.type
};
Object.assign(e, t.editor || t.inspector);
e.defines = t.defines;
e.value = v(e.type)(t.value);
t.range && (e.range = t.range);
var i = g(e.type);
e.typeName = b[i] || i;
e.valueCtor = d[e.type];
if ("cc.Texture2D" == e.typeName) {
e.typeName = "cc.Asset";
e.assetType = "cc.Texture2D";
}
return e;
};
i.getClassName = i.getInstanceCtor = i.getInstanceType = i.enums2default = i.ctor2enums = void 0;
var n, r, s, o, a = u(t("./enums")), c = t("../core/value-types"), l = u(t("../core/assets/CCTexture2D"));
function u(t) {
return t && t.__esModule ? t : {
default: t
};
}
var h;
h = gfx.Texture2D;
var _ = cc.Object, f = ((n = {})[Boolean] = function(t) {
return t || !1;
}, n[Number] = function(t) {
return t ? ArrayBuffer.isView(t) ? t[0] : t : 0;
}, n[c.Vec2] = function(t) {
return t ? cc.v2(t[0], t[1]) : cc.v2();
}, n[c.Vec3] = function(t) {
return t ? cc.v3(t[0], t[1], t[2]) : cc.v3();
}, n[c.Vec4] = function(t) {
return t ? cc.v4(t[0], t[1], t[2], t[3]) : cc.v4();
}, n[c.Color] = function(t) {
return t ? cc.color(255 * t[0], 255 * t[1], 255 * t[2], 255 * (t[3] || 1)) : cc.color();
}, n[c.Mat4] = function(t) {
return t ? cc.mat4(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]) : cc.mat4();
}, n[l.default] = function() {
return null;
}, n[_] = function() {
return null;
}, n), d = ((r = {})[a.default.PARAM_INT] = Number, r[a.default.PARAM_INT2] = c.Vec2, 
r[a.default.PARAM_INT3] = c.Vec3, r[a.default.PARAM_INT4] = c.Vec4, r[a.default.PARAM_FLOAT] = Number, 
r[a.default.PARAM_FLOAT2] = c.Vec2, r[a.default.PARAM_FLOAT3] = c.Vec3, r[a.default.PARAM_FLOAT4] = c.Vec4, 
r[a.default.PARAM_MAT4] = c.Mat4, r[a.default.PARAM_TEXTURE_2D] = l.default, r.color = c.Color, 
r.number = Number, r.boolean = Boolean, r.default = _, r), p = ((s = {})[Number] = a.default.PARAM_FLOAT, 
s[c.Vec2] = a.default.PARAM_FLOAT2, s[c.Vec3] = a.default.PARAM_FLOAT3, s[c.Vec4] = a.default.PARAM_FLOAT4, 
s[c.Color] = a.default.PARAM_COLOR3, s[c.Color] = a.default.PARAM_COLOR4, s[c.Mat4] = a.default.PARAM_MAT4, 
s[l.default] = a.default.PARAM_TEXTURE_2D, s[h] = a.default.PARAM_TEXTURE_2D, s);
i.ctor2enums = p;
var m = ((o = {})[a.default.PARAM_INT] = new Uint32Array([ 0 ]), o[a.default.PARAM_INT2] = new Uint32Array([ 0, 0 ]), 
o[a.default.PARAM_INT3] = new Uint32Array([ 0, 0, 0 ]), o[a.default.PARAM_INT4] = new Uint32Array([ 0, 0, 0, 0 ]), 
o[a.default.PARAM_FLOAT] = new Float32Array([ 0 ]), o[a.default.PARAM_FLOAT2] = new Float32Array([ 0, 0 ]), 
o[a.default.PARAM_FLOAT3] = new Float32Array([ 0, 0, 0 ]), o[a.default.PARAM_FLOAT4] = new Float32Array([ 0, 0, 0, 0 ]), 
o[a.default.PARAM_MAT4] = new Float32Array([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]), 
o[a.default.PARAM_TEXTURE_2D] = null, o.number = 0, o.boolean = !1, o);
i.enums2default = m;
var y = function(t) {
return d[t] || d.default;
};
i.getInstanceType = y;
var v = function(t) {
return f[y(t)];
};
i.getInstanceCtor = v;
var g = function(t) {
return cc.js.getClassName(y(t));
};
i.getClassName = g;
var b = {
Number: "number",
Boolean: "boolean"
};
}), {
"../core/assets/CCTexture2D": 120,
"../core/value-types": 337,
"./enums": 362,
"./gfx/texture-2d": void 0
} ],
369: [ (function(t) {
"use strict";
var e = t("../compression/ZipUtils"), i = t("../compression/zlib.min"), n = t("../core/platform/js");
t("../core/platform/CCSAXParser");
function r(t) {
if (t.length % 4 != 0) return null;
for (var e = t.length / 4, i = window.Uint32Array ? new Uint32Array(e) : [], n = 0; n < e; n++) {
var r = 4 * n;
i[n] = t[r] + 256 * t[r + 1] + 65536 * t[r + 2] + t[r + 3] * (1 << 24);
}
return i;
}
cc.TMXLayerInfo = function() {
this.properties = {};
this.name = "";
this._layerSize = null;
this._tiles = [];
this.visible = !0;
this._opacity = 0;
this.ownTiles = !0;
this._minGID = 1e5;
this._maxGID = 0;
this.offset = cc.v2(0, 0);
};
cc.TMXLayerInfo.prototype = {
constructor: cc.TMXLayerInfo,
getProperties: function() {
return this.properties;
},
setProperties: function(t) {
this.properties = t;
}
};
cc.TMXImageLayerInfo = function() {
this.name = "";
this.visible = !0;
this.width = 0;
this.height = 0;
this.offset = cc.v2(0, 0);
this._opacity = 0;
this._trans = new cc.Color(255, 255, 255, 255);
this.sourceImage = null;
};
cc.TMXObjectGroupInfo = function() {
this.properties = {};
this.name = "";
this._objects = [];
this.visible = !0;
this._opacity = 0;
this._color = new cc.Color(255, 255, 255, 255);
this.offset = cc.v2(0, 0);
this._draworder = "topdown";
};
cc.TMXObjectGroupInfo.prototype = {
constructor: cc.TMXObjectGroupInfo,
getProperties: function() {
return this.properties;
},
setProperties: function(t) {
this.properties = t;
}
};
cc.TMXTilesetInfo = function() {
this.name = "";
this.firstGid = 0;
this.spacing = 0;
this.margin = 0;
this.sourceImage = null;
this.imageSize = cc.size(0, 0);
this.tileOffset = cc.v2(0, 0);
this._tileSize = cc.size(0, 0);
};
cc.TMXTilesetInfo.prototype = {
constructor: cc.TMXTilesetInfo,
rectForGID: function(t, e) {
var i = e || cc.rect(0, 0, 0, 0);
i.width = this._tileSize.width;
i.height = this._tileSize.height;
t &= cc.TiledMap.TileFlag.FLIPPED_MASK;
t -= parseInt(this.firstGid, 10);
var n = parseInt((this.imageSize.width - 2 * this.margin + this.spacing) / (this._tileSize.width + this.spacing), 10);
i.x = parseInt(t % n * (this._tileSize.width + this.spacing) + this.margin, 10);
i.y = parseInt(parseInt(t / n, 10) * (this._tileSize.height + this.spacing) + this.margin, 10);
return i;
}
};
function s(t) {
var e = cc.Label.HorizontalAlign;
switch (t) {
case "center":
return e.CENTER;

case "right":
return e.RIGHT;

default:
return e.LEFT;
}
}
function o(t) {
var e = cc.Label.VerticalAlign;
switch (t) {
case "center":
return e.CENTER;

case "bottom":
return e.BOTTOM;

default:
return e.TOP;
}
}
function a(t) {
if (!t) return cc.color(0, 0, 0, 255);
if (8 === (t = -1 !== t.indexOf("#") ? t.substring(1) : t).length) {
var e = parseInt(t.substr(0, 2), 16) || 255, i = parseInt(t.substr(2, 2), 16) || 0, n = parseInt(t.substr(4, 2), 16) || 0, r = parseInt(t.substr(6, 2), 16) || 0;
return cc.color(i, n, r, e);
}
var s = parseInt(t.substr(0, 2), 16) || 0, o = parseInt(t.substr(2, 2), 16) || 0, a = parseInt(t.substr(4, 2), 16) || 0;
return cc.color(s, o, a, 255);
}
function c(t, e) {
for (var i = [], n = t.getElementsByTagName("properties"), r = 0; r < n.length; ++r) for (var s = n[r].getElementsByTagName("property"), o = 0; o < s.length; ++o) i.push(s[o]);
e = e || {};
for (var c = 0; c < i.length; c++) {
var l = i[c], u = l.getAttribute("name"), h = l.getAttribute("type") || "string", _ = l.getAttribute("value");
"int" === h ? _ = parseInt(_) : "float" === h ? _ = parseFloat(_) : "bool" === h ? _ = "true" === _ : "color" === h && (_ = a(_));
e[u] = _;
}
return e;
}
cc.TMXMapInfo = function(t, e, i, n, r) {
this.properties = [];
this.orientation = null;
this.parentElement = null;
this.parentGID = null;
this.layerAttrs = 0;
this.storingCharacters = !1;
this.currentString = null;
this.renderOrder = cc.TiledMap.RenderOrder.RightDown;
this._supportVersion = [ 1, 2, 0 ];
this._parser = new cc.SAXParser();
this._objectGroups = [];
this._allChildren = [];
this._mapSize = cc.size(0, 0);
this._tileSize = cc.size(0, 0);
this._layers = [];
this._tilesets = [];
this._imageLayers = [];
this._tileProperties = {};
this._tileAnimations = {};
this._tsxMap = null;
this._textures = null;
this._staggerAxis = null;
this._staggerIndex = null;
this._hexSideLength = 0;
this._imageLayerTextures = null;
this.initWithXML(t, e, i, n, r);
};
cc.TMXMapInfo.prototype = {
constructor: cc.TMXMapInfo,
getOrientation: function() {
return this.orientation;
},
setOrientation: function(t) {
this.orientation = t;
},
getStaggerAxis: function() {
return this._staggerAxis;
},
setStaggerAxis: function(t) {
this._staggerAxis = t;
},
getStaggerIndex: function() {
return this._staggerIndex;
},
setStaggerIndex: function(t) {
this._staggerIndex = t;
},
getHexSideLength: function() {
return this._hexSideLength;
},
setHexSideLength: function(t) {
this._hexSideLength = t;
},
getMapSize: function() {
return cc.size(this._mapSize.width, this._mapSize.height);
},
setMapSize: function(t) {
this._mapSize.width = t.width;
this._mapSize.height = t.height;
},
_getMapWidth: function() {
return this._mapSize.width;
},
_setMapWidth: function(t) {
this._mapSize.width = t;
},
_getMapHeight: function() {
return this._mapSize.height;
},
_setMapHeight: function(t) {
this._mapSize.height = t;
},
getTileSize: function() {
return cc.size(this._tileSize.width, this._tileSize.height);
},
setTileSize: function(t) {
this._tileSize.width = t.width;
this._tileSize.height = t.height;
},
_getTileWidth: function() {
return this._tileSize.width;
},
_setTileWidth: function(t) {
this._tileSize.width = t;
},
_getTileHeight: function() {
return this._tileSize.height;
},
_setTileHeight: function(t) {
this._tileSize.height = t;
},
getLayers: function() {
return this._layers;
},
setLayers: function(t) {
this._allChildren.push(t);
this._layers.push(t);
},
getImageLayers: function() {
return this._imageLayers;
},
setImageLayers: function(t) {
this._allChildren.push(t);
this._imageLayers.push(t);
},
getTilesets: function() {
return this._tilesets;
},
setTilesets: function(t) {
this._tilesets.push(t);
},
getObjectGroups: function() {
return this._objectGroups;
},
setObjectGroups: function(t) {
this._allChildren.push(t);
this._objectGroups.push(t);
},
getAllChildren: function() {
return this._allChildren;
},
getParentElement: function() {
return this.parentElement;
},
setParentElement: function(t) {
this.parentElement = t;
},
getParentGID: function() {
return this.parentGID;
},
setParentGID: function(t) {
this.parentGID = t;
},
getLayerAttribs: function() {
return this.layerAttrs;
},
setLayerAttribs: function(t) {
this.layerAttrs = t;
},
getStoringCharacters: function() {
return this.storingCharacters;
},
setStoringCharacters: function(t) {
this.storingCharacters = t;
},
getProperties: function() {
return this.properties;
},
setProperties: function(t) {
this.properties = t;
},
initWithXML: function(t, e, i, n, r) {
this._tilesets.length = 0;
this._layers.length = 0;
this._imageLayers.length = 0;
this._tsxMap = e;
this._textures = i;
this._imageLayerTextures = r;
this._textureSizes = n;
this._objectGroups.length = 0;
this._allChildren.length = 0;
this.properties.length = 0;
this._tileProperties = {};
this._tileAnimations = {};
this.currentString = "";
this.storingCharacters = !1;
this.layerAttrs = cc.TMXLayerInfo.ATTRIB_NONE;
this.parentElement = cc.TiledMap.NONE;
return this.parseXMLString(t);
},
parseXMLString: function(t, e) {
var i, n = this._parser._parseXML(t).documentElement, r = n.getAttribute("orientation"), s = n.getAttribute("staggeraxis"), o = n.getAttribute("staggerindex"), a = n.getAttribute("hexsidelength"), l = n.getAttribute("renderorder"), u = n.getAttribute("version") || "1.0.0";
if ("map" === n.nodeName) {
for (var h = u.split("."), _ = this._supportVersion, f = 0; f < _.length; f++) {
var d = parseInt(h[f]) || 0;
if (_[f] < d) {
cc.logID(7216, u);
break;
}
}
"orthogonal" === r ? this.orientation = cc.TiledMap.Orientation.ORTHO : "isometric" === r ? this.orientation = cc.TiledMap.Orientation.ISO : "hexagonal" === r ? this.orientation = cc.TiledMap.Orientation.HEX : null !== r && cc.logID(7217, r);
this.renderOrder = "right-up" === l ? cc.TiledMap.RenderOrder.RightUp : "left-up" === l ? cc.TiledMap.RenderOrder.LeftUp : "left-down" === l ? cc.TiledMap.RenderOrder.LeftDown : cc.TiledMap.RenderOrder.RightDown;
"x" === s ? this.setStaggerAxis(cc.TiledMap.StaggerAxis.STAGGERAXIS_X) : "y" === s && this.setStaggerAxis(cc.TiledMap.StaggerAxis.STAGGERAXIS_Y);
"odd" === o ? this.setStaggerIndex(cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD) : "even" === o && this.setStaggerIndex(cc.TiledMap.StaggerIndex.STAGGERINDEX_EVEN);
a && this.setHexSideLength(parseFloat(a));
var p = cc.size(0, 0);
p.width = parseFloat(n.getAttribute("width"));
p.height = parseFloat(n.getAttribute("height"));
this.setMapSize(p);
(p = cc.size(0, 0)).width = parseFloat(n.getAttribute("tilewidth"));
p.height = parseFloat(n.getAttribute("tileheight"));
this.setTileSize(p);
this.properties = c(n);
}
var m = n.getElementsByTagName("tileset");
"map" !== n.nodeName && (m = []).push(n);
for (i = 0; i < m.length; i++) {
var y = m[i], v = y.getAttribute("source");
if (v) {
var g = parseInt(y.getAttribute("firstgid")), b = this._tsxMap[v];
b && this.parseXMLString(b, g);
} else {
var C = y.getElementsByTagName("image"), x = C.length > 1, A = C[0], S = A.getAttribute("source");
S = S.replace(/\\/g, "/");
var T = y.getElementsByTagName("tile"), w = T && T.length || 1, E = null, M = y.getAttribute("name") || "", B = parseInt(y.getAttribute("spacing")) || 0, I = parseInt(y.getAttribute("margin")) || 0, D = parseInt(e);
D || (D = 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], L = cc.v2(0, 0);
if (R) {
L.x = parseFloat(R.getAttribute("x"));
L.y = parseFloat(R.getAttribute("y"));
}
for (var O = null, V = 0; V < w; V++) {
if (!O || x) {
(O = new cc.TMXTilesetInfo()).name = M;
O.firstGid = D;
O.spacing = B;
O.margin = I;
O._tileSize = P;
O.tileOffset = L;
O.sourceImage = this._textures[S];
O.imageSize = this._textureSizes[S] || O.imageSize;
O.sourceImage || cc.errorID(7221, S);
this.setTilesets(O);
}
if (E = T && T[V]) {
this.parentGID = parseInt(D) + parseInt(E.getAttribute("id") || 0);
var N = E.getElementsByTagName("image");
if (N && N.length > 0) {
var F = (A = N[0]).getAttribute("source");
F = F.replace(/\\/g, "/");
O.sourceImage = this._textures[F];
O.sourceImage || cc.errorID(7221, F);
var z = cc.size(0, 0);
z.width = parseFloat(A.getAttribute("width"));
z.height = parseFloat(A.getAttribute("height"));
O._tileSize = z;
O.firstGid = this.parentGID;
}
this._tileProperties[this.parentGID] = c(E);
var k = E.getElementsByTagName("animation");
if (k && k.length > 0) {
var G = k[0].getElementsByTagName("frame"), U = {
frames: [],
dt: 0,
frameIdx: 0
};
this._tileAnimations[this.parentGID] = U;
for (var H = U.frames, j = 0; j < G.length; j++) {
var W = G[j], q = parseInt(D) + parseInt(W.getAttribute("tileid")), X = parseFloat(W.getAttribute("duration"));
H.push({
tileid: q,
duration: X / 1e3,
grid: null
});
}
}
}
}
}
}
var Y = n.childNodes;
for (i = 0; i < Y.length; i++) {
var J = Y[i];
if (!this._shouldIgnoreNode(J)) {
if ("imagelayer" === J.nodeName) {
var Z = this._parseImageLayer(J);
Z && this.setImageLayers(Z);
}
if ("layer" === J.nodeName) {
var K = this._parseLayer(J);
this.setLayers(K);
}
if ("objectgroup" === J.nodeName) {
var Q = this._parseObjectGroup(J);
this.setObjectGroups(Q);
}
}
}
return n;
},
_shouldIgnoreNode: function(t) {
return 3 === t.nodeType || 8 === t.nodeType || 4 === t.nodeType;
},
_parseImageLayer: function(t) {
var e = t.getElementsByTagName("image");
if (!e || 0 == e.length) return null;
var i = new cc.TMXImageLayerInfo();
i.name = t.getAttribute("name");
i.offset.x = parseFloat(t.getAttribute("offsetx")) || 0;
i.offset.y = parseFloat(t.getAttribute("offsety")) || 0;
var n = t.getAttribute("visible");
i.visible = !("0" === n);
var r = t.getAttribute("opacity") || 1;
i.opacity = parseInt(255 * parseFloat(r)) || 255;
var s = e[0], o = s.getAttribute("source");
i.sourceImage = this._imageLayerTextures[o];
i.width = parseInt(s.getAttribute("width")) || 0;
i.height = parseInt(s.getAttribute("height")) || 0;
i.trans = a(s.getAttribute("trans"));
if (!i.sourceImage) {
cc.errorID(7221, o);
return null;
}
return i;
},
_parseLayer: function(t) {
var n = t.getElementsByTagName("data")[0], s = new cc.TMXLayerInfo();
s.name = t.getAttribute("name");
var o = cc.size(0, 0);
o.width = parseFloat(t.getAttribute("width"));
o.height = parseFloat(t.getAttribute("height"));
s._layerSize = o;
var a = t.getAttribute("visible");
s.visible = !("0" === a);
var l = t.getAttribute("opacity") || 1;
s._opacity = l ? parseInt(255 * parseFloat(l)) : 255;
s.offset = cc.v2(parseFloat(t.getAttribute("offsetx")) || 0, parseFloat(t.getAttribute("offsety")) || 0);
for (var u = "", h = 0; h < n.childNodes.length; h++) u += n.childNodes[h].nodeValue;
u = u.trim();
var _, f = n.getAttribute("compression"), d = n.getAttribute("encoding");
if (f && "gzip" !== f && "zlib" !== f) {
cc.logID(7218);
return null;
}
switch (f) {
case "gzip":
_ = e.unzipBase64AsArray(u, 4);
break;

case "zlib":
_ = r(new i.Inflate(e.Base64.decodeAsArray(u, 1)).decompress());
break;

case null:
case "":
if ("base64" === d) _ = e.Base64.decodeAsArray(u, 4); else if ("csv" === d) {
_ = [];
for (var p = u.split(","), m = 0; m < p.length; m++) _.push(parseInt(p[m]));
} else {
var y = n.getElementsByTagName("tile");
_ = [];
for (var v = 0; v < y.length; v++) _.push(parseInt(y[v].getAttribute("gid")));
}
break;

default:
this.layerAttrs === cc.TMXLayerInfo.ATTRIB_NONE && cc.logID(7219);
}
_ && (s._tiles = new Uint32Array(_));
s.properties = c(t);
return s;
},
_parseObjectGroup: function(t) {
var e = new cc.TMXObjectGroupInfo();
e.name = t.getAttribute("name") || "";
e.offset = cc.v2(parseFloat(t.getAttribute("offsetx")), parseFloat(t.getAttribute("offsety")));
var i = t.getAttribute("opacity") || 1;
e._opacity = i ? parseInt(255 * parseFloat(i)) : 255;
var n = t.getAttribute("visible");
n && 0 === parseInt(n) && (e.visible = !1);
var r = t.getAttribute("color");
r && e._color.fromHEX(r);
var l = t.getAttribute("draworder");
l && (e._draworder = l);
e.setProperties(c(t));
var u = t.getElementsByTagName("object");
if (u) {
for (var h = 0; h < u.length; h++) {
var _ = u[h], f = {};
f.id = _.getAttribute("id") || h;
f.name = _.getAttribute("name") || "";
f.width = parseFloat(_.getAttribute("width")) || 0;
f.height = parseFloat(_.getAttribute("height")) || 0;
f.x = parseFloat(_.getAttribute("x")) || 0;
f.y = parseFloat(_.getAttribute("y")) || 0;
f.rotation = parseFloat(_.getAttribute("rotation")) || 0;
c(_, f);
var d = _.getAttribute("visible");
f.visible = !(d && 0 === parseInt(d));
var p = _.getElementsByTagName("text");
if (p && p.length > 0) {
var m = p[0];
f.type = cc.TiledMap.TMXObjectType.TEXT;
f.wrap = "1" == m.getAttribute("wrap");
f.color = a(m.getAttribute("color"));
f.halign = s(m.getAttribute("halign"));
f.valign = o(m.getAttribute("valign"));
f.pixelsize = parseInt(m.getAttribute("pixelsize")) || 16;
f.text = m.childNodes[0].nodeValue;
}
var y = _.getAttribute("gid");
if (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 b = g[0].getAttribute("points");
b && (f.points = this._parsePointsString(b));
}
var C = _.getElementsByTagName("polyline");
if (C && C.length > 0) {
f.type = cc.TiledMap.TMXObjectType.POLYLINE;
var x = C[0].getAttribute("points");
x && (f.polylinePoints = this._parsePointsString(x));
}
f.type || (f.type = cc.TiledMap.TMXObjectType.RECT);
e._objects.push(f);
}
"index" !== l && 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; n < i.length; n++) {
var r = i[n].split(",");
e.push({
x: parseFloat(r[0]),
y: parseFloat(r[1])
});
}
return e;
},
setTileAnimations: function(t) {
this._tileAnimations = t;
},
getTileAnimations: function() {
return this._tileAnimations;
},
getTileProperties: function() {
return this._tileProperties;
},
setTileProperties: function(t) {
this._tileProperties = t;
},
getCurrentString: function() {
return this.currentString;
},
setCurrentString: function(t) {
this.currentString = t;
}
};
var l = cc.TMXMapInfo.prototype;
n.getset(l, "mapWidth", l._getMapWidth, l._setMapWidth);
n.getset(l, "mapHeight", l._getMapHeight, l._setMapHeight);
n.getset(l, "tileWidth", l._getTileWidth, l._setTileWidth);
n.getset(l, "tileHeight", l._getTileHeight, l._setTileHeight);
cc.TMXLayerInfo.ATTRIB_NONE = 1;
cc.TMXLayerInfo.ATTRIB_BASE64 = 2;
cc.TMXLayerInfo.ATTRIB_GZIP = 4;
cc.TMXLayerInfo.ATTRIB_ZLIB = 8;
}), {
"../compression/ZipUtils": 22,
"../compression/zlib.min": 25,
"../core/platform/CCSAXParser": 246,
"../core/platform/js": 260
} ],
370: [ (function(t, e) {
"use strict";
var i, n = t("../core/value-types"), r = (i = t("../core/assets/material/material-variant")) && i.__esModule ? i : {
default: i
}, s = t("../core/components/CCRenderComponent"), o = t("../core/assets/material/CCMaterial"), a = t("../core/renderer/render-flow"), c = cc.mat4(), l = cc.v2(), u = cc.v2(), h = cc.v2(), _ = {
row: 0,
col: 0
}, f = cc.Class({
name: "cc.TiledUserNodeData",
extends: cc.Component,
ctor: function() {
this._index = -1;
this._row = -1;
this._col = -1;
this._tiledLayer = null;
}
}), d = cc.Class({
name: "cc.TiledLayer",
extends: s,
editor: {
inspector: "packages://inspector/inspectors/comps/tiled-layer.js"
},
ctor: function() {
this._userNodeGrid = {};
this._userNodeMap = {};
this._userNodeDirty = !1;
this._tiledTiles = [];
this._tilesetIndexArr = [];
this._tilesetIndexToArrIndex = {};
this._texIdToMatIndex = {};
this._viewPort = {
x: -1,
y: -1,
width: -1,
height: -1
};
this._cullingRect = {
leftDown: {
row: -1,
col: -1
},
rightTop: {
row: -1,
col: -1
}
};
this._cullingDirty = !0;
this._rightTop = {
row: -1,
col: -1
};
this._layerInfo = null;
this._mapInfo = null;
this._topOffset = 0;
this._downOffset = 0;
this._leftOffset = 0;
this._rightOffset = 0;
this._tiles = [];
this._vertices = [];
this._verticesDirty = !0;
this._layerName = "";
this._layerOrientation = null;
this._texGrids = null;
this._textures = null;
this._tilesets = null;
this._leftDownToCenterX = 0;
this._leftDownToCenterY = 0;
this._hasTiledNodeGrid = !1;
this._hasAniGrid = !1;
this._animations = null;
this._enableCulling = cc.macro.ENABLE_TILEDMAP_CULLING;
},
_hasTiledNode: function() {
return this._hasTiledNodeGrid;
},
_hasAnimation: function() {
return this._hasAniGrid;
},
enableCulling: function(t) {
if (this._enableCulling != t) {
this._enableCulling = t;
this._cullingDirty = !0;
}
},
addUserNode: function(t) {
var e = t.getComponent(f);
if (e) {
cc.warn("CCTiledLayer:addUserNode node has been added");
return !1;
}
e = t.addComponent(f);
t.parent = this.node;
t._renderFlag |= a.FLAG_BREAK_FLOW;
this._userNodeMap[t._id] = e;
e._row = -1;
e._col = -1;
e._tiledLayer = this;
this._nodeLocalPosToLayerPos(t, l);
this._positionToRowCol(l.x, l.y, _);
this._addUserNodeToGrid(e, _);
this._updateCullingOffsetByUserNode(t);
t.on(cc.Node.EventType.POSITION_CHANGED, this._userNodePosChange, e);
t.on(cc.Node.EventType.SIZE_CHANGED, this._userNodeSizeChange, e);
return !0;
},
removeUserNode: function(t) {
var e = t.getComponent(f);
if (!e) {
cc.warn("CCTiledLayer:removeUserNode node is not exist");
return !1;
}
t.off(cc.Node.EventType.POSITION_CHANGED, this._userNodePosChange, e);
t.off(cc.Node.EventType.SIZE_CHANGED, this._userNodeSizeChange, e);
this._removeUserNodeFromGrid(e);
delete this._userNodeMap[t._id];
t._removeComponent(e);
e.destroy();
t.removeFromParent(!0);
t._renderFlag &= ~a.FLAG_BREAK_FLOW;
return !0;
},
destroyUserNode: function(t) {
this.removeUserNode(t);
t.destroy();
},
_nodeLocalPosToLayerPos: function(t, e) {
e.x = t.x + this._leftDownToCenterX;
e.y = t.y + this._leftDownToCenterY;
},
_getNodesByRowCol: function(t, e) {
var i = this._userNodeGrid[t];
return i ? i[e] : null;
},
_getNodesCountByRow: function(t) {
var e = this._userNodeGrid[t];
return e ? e.count : 0;
},
_updateAllUserNode: function() {
this._userNodeGrid = {};
for (var t in this._userNodeMap) {
var e = this._userNodeMap[t];
this._nodeLocalPosToLayerPos(e.node, l);
this._positionToRowCol(l.x, l.y, _);
this._addUserNodeToGrid(e, _);
this._updateCullingOffsetByUserNode(e.node);
}
},
_updateCullingOffsetByUserNode: function(t) {
this._topOffset < t.height && (this._topOffset = t.height);
this._downOffset < t.height && (this._downOffset = t.height);
this._leftOffset < t.width && (this._leftOffset = t.width);
this._rightOffset < t.width && (this._rightOffset = t.width);
},
_userNodeSizeChange: function() {
var t = this.node;
this._tiledLayer._updateCullingOffsetByUserNode(t);
},
_userNodePosChange: function() {
var t = this.node, e = this._tiledLayer;
e._nodeLocalPosToLayerPos(t, l);
e._positionToRowCol(l.x, l.y, _);
e._limitInLayer(_);
if (_.row !== this._row || _.col !== this._col) {
e._removeUserNodeFromGrid(this);
e._addUserNodeToGrid(this, _);
}
},
_removeUserNodeFromGrid: function(t) {
var e = t._row, i = t._col, n = t._index, r = this._userNodeGrid[e], s = r && r[i];
if (s) {
r.count--;
s.count--;
s.list[n] = null;
if (s.count <= 0) {
s.list.length = 0;
s.count = 0;
}
}
t._row = -1;
t._col = -1;
t._index = -1;
this._userNodeDirty = !0;
},
_limitInLayer: function(t) {
var e = t.row, i = t.col;
e < 0 && (t.row = 0);
e > this._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();
if (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;
if (void 0 !== e) {
i = Math.floor(t);
e = Math.floor(e);
} else {
i = Math.floor(t.x);
e = Math.floor(t.y);
}
switch (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 o = (s & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0, a = this._texGrids[o].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 o = (s & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0, a = this._texGrids[o].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, n = this._mapTileSize.width, r = this._mapTileSize.height, s = this._layerSize.height, o = Math.floor(t) + Math.floor(e) * this._layerSize.width, a = this._tiles[o];
i = this._texGrids[a] ? this._texGrids[a].tileset.tileOffset : {
x: 0,
y: 0
};
var c = this._staggerIndex === cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD ? 1 : -1, l = 0, u = 0, h = 0, _ = 0;
switch (this._staggerAxis) {
case cc.TiledMap.StaggerAxis.STAGGERAXIS_Y:
h = 0;
e % 2 == 1 && (h = n / 2 * c);
l = t * n + h + i.x;
u = (s - e - 1) * (r - (r - this._hexSideLength) / 2) - i.y;
break;

case cc.TiledMap.StaggerAxis.STAGGERAXIS_X:
_ = 0;
t % 2 == 1 && (_ = r / 2 * -c);
l = t * (n - (n - this._hexSideLength) / 2) + i.x;
u = (s - e - 1) * r + _ - i.y;
}
return cc.v2(l, u);
},
setTilesGIDAt: function(t, e, i, n) {
if (t && 0 !== t.length && !(n <= 0)) {
i < 0 && (i = 0);
e < 0 && (e = 0);
for (var r = 0, s = e + n, o = i; ;o++) for (var a = e; a < s; a++) {
if (r >= t.length) return;
this._updateTileForGID(t[r], a, o);
r++;
}
}
},
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;
} else {
h.x = e;
h.y = i;
r = h;
}
var s = t & cc.TiledMap.TileFlag.FLIPPED_MASK;
r.x = Math.floor(r.x);
r.y = Math.floor(r.y);
if (this._isInvalidPosition(r)) throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position");
if (this._tiles && this._tilesets && 0 != this._tilesets.length) if (0 !== s && s < this._tilesets[0].firstGid) cc.logID(7239, t); else {
n = n || 0;
this._updateTileForGID((t | n) >>> 0, r.x, r.y);
} else cc.logID(7238);
},
_updateTileForGID: function(t, e, i) {
var n = 0 | e + i * this._layerSize.width;
if (!(n >= this._tiles.length) && t !== this._tiles[n]) {
var r = (t & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0, s = this._texGrids[r], o = s && s.texId;
if (s) {
this._tiles[n] = t;
this._updateVertex(e, i);
this._buildMaterial(o);
} else this._tiles[n] = 0;
this._cullingDirty = !0;
}
},
getTiles: function() {
return this._tiles;
},
getTileGIDAt: function(t, e) {
if (void 0 === t) throw new Error("cc.TiledLayer.getTileGIDAt(): pos should be non-null");
var i = t;
if (void 0 === e) {
i = t.x;
e = t.y;
}
if (this._isInvalidPosition(i, e)) throw new Error("cc.TiledLayer.getTileGIDAt(): invalid position");
if (!this._tiles) {
cc.logID(7237);
return null;
}
var n = Math.floor(i) + Math.floor(e) * this._layerSize.width;
return (this._tiles[n] & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0;
},
getTileFlagsAt: function(t, e) {
if (!t) throw new Error("TiledLayer.getTileFlagsAt: pos should be non-null");
void 0 !== e && (t = cc.v2(t, e));
if (this._isInvalidPosition(t)) throw new Error("TiledLayer.getTileFlagsAt: invalid position");
if (!this._tiles) {
cc.logID(7240);
return 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, o = this._viewPort.y - this._offset.y + this._leftDownToCenterY, a = s - this._leftOffset, c = o - this._downOffset, l = s + i + this._rightOffset, u = o + n + this._topOffset, h = this._cullingRect.leftDown, f = this._cullingRect.rightTop;
a < 0 && (a = 0);
c < 0 && (c = 0);
this._positionToRowCol(a, c, _);
_.row -= r;
_.col -= r;
_.row = _.row > 0 ? _.row : 0;
_.col = _.col > 0 ? _.col : 0;
if (_.row !== h.row || _.col !== h.col) {
h.row = _.row;
h.col = _.col;
this._cullingDirty = !0;
}
if (l < 0 || u < 0) {
_.row = -1;
_.col = -1;
} else {
this._positionToRowCol(l, u, _);
_.row++;
_.col++;
}
_.row > this._rightTop.row && (_.row = this._rightTop.row);
_.col > this._rightTop.col && (_.col = this._rightTop.col);
if (_.row !== f.row || _.col !== f.col) {
f.row = _.row;
f.col = _.col;
this._cullingDirty = !0;
}
}
},
_positionToRowCol: function(t, e, i) {
var n = cc.TiledMap, r = n.Orientation, s = n.StaggerAxis, o = this._mapTileSize.width, a = this._mapTileSize.height, c = .5 * o, l = .5 * a, u = 0, h = 0, _ = 0, f = 0, d = this._staggerAxis;
this._layerSize.width;
switch (this._layerOrientation) {
case r.ORTHO:
h = Math.floor(t / o);
u = Math.floor(e / a);
break;

case r.ISO:
h = Math.floor(t / c);
u = Math.floor(e / l);
break;

case r.HEX:
if (d === s.STAGGERAXIS_Y) {
_ = (u = Math.floor(e / (a - this._diffY1))) % 2 == 1 ? c * this._odd_even : 0;
h = Math.floor((t - _) / o);
} else {
f = (h = Math.floor(t / (o - this._diffX1))) % 2 == 1 ? l * -this._odd_even : 0;
u = Math.floor((e - f) / a);
}
}
i.row = u;
i.col = h;
return i;
},
_updateCulling: function() {
if (this._enableCulling) {
this.node._updateWorldMatrix();
n.Mat4.invert(c, this.node._worldMatrix);
var t = cc.visibleRect, e = cc.Camera.findCamera(this.node);
if (e) {
l.x = 0;
l.y = 0;
u.x = l.x + t.width;
u.y = l.y + t.height;
e.getScreenToWorldPoint(l, l);
e.getScreenToWorldPoint(u, u);
n.Vec2.transformMat4(l, l, c);
n.Vec2.transformMat4(u, u, c);
this._updateViewPort(l.x, l.y, u.x - l.x, u.y - l.y);
}
}
},
getLayerOrientation: function() {
return this._layerOrientation;
},
getProperties: function() {
return this._properties;
},
_updateVertex: function(t, e) {
var i = cc.TiledMap, n = i.TileFlag.FLIPPED_MASK, r = i.StaggerAxis, s = i.Orientation, o = this._vertices, a = this._layerOrientation, c = this._tiles;
if (c) {
var l, u, h, _, f, d, p, m = this._rightTop, y = this._mapTileSize.width, v = this._mapTileSize.height, g = .5 * y, b = .5 * v, C = this._layerSize.height, x = this._layerSize.width, A = this._texGrids;
if (a === s.HEX) {
_ = this._staggerAxis;
f = this._diffX1;
d = this._diffY1;
p = this._odd_even;
}
var S, T, w, E, M = 0, B = 0, I = 0, D = 0, P = e * x + t;
if (l = A[T = (c[P] & n) >>> 0]) {
this._animations[T] && (this._hasAniGrid = this._hasAniGrid || !0);
switch (a) {
case s.ORTHO:
u = (M = t) * y;
h = (B = C - e - 1) * v;
break;

case s.ISO:
u = g * (M = C + t - e - 1);
h = b * (B = C + x - t - e - 2);
break;

case s.HEX:
u = t * (y - f) + (_ === r.STAGGERAXIS_Y && e % 2 == 1 ? g * p : 0);
h = (C - e - 1) * (v - d) + (_ === r.STAGGERAXIS_X && t % 2 == 1 ? b * -p : 0);
M = t;
B = C - e - 1;
}
var R = o[B] = o[B] || {
minCol: 0,
maxCol: 0
}, L = R[M] = R[M] || {};
R.minCol > M && (R.minCol = M);
R.maxCol < M && (R.maxCol = M);
m.row < B && (m.row = B);
m.col < M && (m.col = M);
S = l.tileset.tileOffset;
u += this._offset.x + S.x;
h += this._offset.y - S.y;
I = (I = -S.y + l.tileset._tileSize.height - v) < 0 ? 0 : I;
w = S.y < 0 ? 0 : S.y;
E = -S.x < 0 ? 0 : -S.x;
D = (D = S.x + l.tileset._tileSize.width - y) < 0 ? 0 : D;
this._rightOffset < E && (this._rightOffset = E);
this._leftOffset < D && (this._leftOffset = D);
this._topOffset < w && (this._topOffset = w);
this._downOffset < I && (this._downOffset = I);
L.left = u;
L.bottom = h;
L.index = P;
this._cullingDirty = !0;
}
}
},
_updateVertices: function() {
this._vertices.length = 0;
if (this._tiles) {
var t = this._rightTop;
t.row = -1;
t.col = -1;
var e = this._layerSize.height, i = this._layerSize.width;
this._topOffset = 0;
this._downOffset = 0;
this._leftOffset = 0;
this._rightOffset = 0;
this._hasAniGrid = !1;
for (var n = 0; n < e; ++n) for (var r = 0; r < i; ++r) this._updateVertex(r, n);
this._verticesDirty = !1;
}
},
getTiledTileAt: function(t, e, i) {
if (this._isInvalidPosition(t, e)) throw new Error("TiledLayer.getTiledTileAt: invalid position");
if (!this._tiles) {
cc.logID(7236);
return null;
}
var n = Math.floor(t) + Math.floor(e) * this._layerSize.width, r = this._tiledTiles[n];
if (!r && i) {
var s = new cc.Node();
(r = s.addComponent(cc.TiledTile))._x = t;
r._y = e;
r._layer = this;
r._updateInfo();
s.parent = this.node;
return r;
}
return r;
},
setTiledTileAt: function(t, e, i) {
if (this._isInvalidPosition(t, e)) throw new Error("TiledLayer.setTiledTileAt: invalid position");
if (!this._tiles) {
cc.logID(7236);
return null;
}
var n = Math.floor(t) + Math.floor(e) * this._layerSize.width;
this._tiledTiles[n] = i;
this._cullingDirty = !0;
this._hasTiledNodeGrid = !!i || this._tiledTiles.some((function(t) {
return !!t;
}));
return i;
},
getTexture: function(t) {
t = t || 0;
return this._textures && t >= 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) {
t = t || 0;
return 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 < t.length; n++) {
var r = t[n];
r && (e[n] = r.sourceImage);
}
cc.TiledMap.loadAllTextures(e, function() {
for (var e = 0, n = t.length; e < n; ++e) {
var r = t[e];
r && cc.TiledMap.fillTextureGrids(r, i, e);
}
this._prepareToRender();
}.bind(this));
},
_traverseAllGrid: function() {
var t = this._tiles, e = this._texGrids, i = this._tilesetIndexArr, n = this._tilesetIndexToArrIndex = {}, r = cc.TiledMap.TileFlag.FLIPPED_MASK;
i.length = 0;
for (var s = 0; s < t.length; s++) {
var o = t[s];
if (0 !== o) {
var a = e[o = (o & r) >>> 0];
if (a) {
var c = a.texId;
if (void 0 === n[c]) {
n[c] = i.length;
i.push(c);
}
} else cc.error("CCTiledLayer:_traverseAllGrid grid is null, gid is:", o);
}
}
},
_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 o = this._mapTileSize.width, a = this._mapTileSize.height, c = this._layerSize.width, l = this._layerSize.height;
if (this._layerOrientation === cc.TiledMap.Orientation.HEX) {
var u = cc.TiledMap, h = u.StaggerAxis, _ = u.StaggerIndex, f = 0, d = 0;
this._odd_even = this._staggerIndex === _.STAGGERINDEX_ODD ? 1 : -1;
if (this._staggerAxis === h.STAGGERAXIS_X) {
this._diffX1 = (o - this._hexSideLength) / 2;
this._diffY1 = 0;
d = a * (l + .5);
f = (o + this._hexSideLength) * Math.floor(c / 2) + o * (c % 2);
} else {
this._diffX1 = 0;
this._diffY1 = (a - this._hexSideLength) / 2;
f = o * (c + .5);
d = (a + this._hexSideLength) * Math.floor(l / 2) + a * (l % 2);
}
this.node.setContentSize(f, d);
} else if (this._layerOrientation === cc.TiledMap.Orientation.ISO) {
var p = c + l;
this.node.setContentSize(.5 * o * p, .5 * a * p);
} else this.node.setContentSize(c * o, l * a);
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();
},
_buildMaterial: function(t) {
var e = this._texIdToMatIndex;
if (void 0 !== e[t]) return null;
var i = this._tilesetIndexArr, n = this._tilesetIndexToArrIndex, s = n[t];
if (void 0 === s) {
n[t] = s = i.length;
i.push(t);
}
var a = this._textures[t], c = this._materials[s];
c || (c = o.getBuiltinMaterial("2d-sprite"));
(c = r.default.create(c, this)).define("CC_USE_MODEL", !0);
c.setProperty("texture", a);
this._materials[s] = c;
e[t] = s;
return c;
},
_activateMaterial: function() {
var t = this._tilesetIndexArr;
if (0 !== t.length) {
for (var e = t.length, i = 0; i < e; i++) this._buildMaterial(t[i]);
this._materials.length = e;
this.markForRender(!0);
} else this.disableRender();
}
});
cc.TiledLayer = e.exports = d;
}), {
"../core/assets/material/CCMaterial": 124,
"../core/assets/material/material-variant": 131,
"../core/components/CCRenderComponent": 160,
"../core/renderer/render-flow": 272,
"../core/value-types": 337
} ],
371: [ (function(t, e) {
"use strict";
t("./CCTMXXMLParser");
t("./CCTiledMapAsset");
t("./CCTiledLayer");
t("./CCTiledTile");
t("./CCTiledObjectGroup");
var i = cc.Enum({
ORTHO: 0,
HEX: 1,
ISO: 2
}), n = cc.Enum({
NONE: 0,
MAP: 1,
LAYER: 2,
OBJECTGROUP: 3,
OBJECT: 4,
TILE: 5
}), r = cc.Enum({
HORIZONTAL: 2147483648,
VERTICAL: 1073741824,
DIAGONAL: 536870912,
FLIPPED_ALL: 4026531840,
FLIPPED_MASK: 268435455
}), s = cc.Enum({
STAGGERAXIS_X: 0,
STAGGERAXIS_Y: 1
}), o = cc.Enum({
STAGGERINDEX_ODD: 0,
STAGGERINDEX_EVEN: 1
}), a = cc.Enum({
RightDown: 0,
RightUp: 1,
LeftDown: 2,
LeftUp: 3
}), c = cc.Enum({
RECT: 0,
ELLIPSE: 1,
POLYGON: 2,
POLYLINE: 3,
IMAGE: 4,
TEXT: 5
}), l = cc.Class({
name: "cc.TiledMap",
extends: cc.Component,
editor: !1,
ctor: function() {
this._texGrids = [];
this._textures = [];
this._tilesets = [];
this._animations = [];
this._imageLayers = [];
this._layers = [];
this._groups = [];
this._images = [];
this._properties = [];
this._tileProperties = [];
this._mapSize = cc.size(0, 0);
this._tileSize = cc.size(0, 0);
},
statics: {
Orientation: i,
Property: n,
TileFlag: r,
StaggerAxis: s,
StaggerIndex: o,
TMXObjectType: c,
RenderOrder: a
},
properties: {
_tmxFile: {
default: null,
type: cc.TiledMapAsset
},
tmxAsset: {
get: function() {
return this._tmxFile;
},
set: function(t) {
if (this._tmxFile !== t) {
this._tmxFile = t;
this._applyFile();
}
},
type: cc.TiledMapAsset
}
},
getMapSize: function() {
return this._mapSize;
},
getTileSize: function() {
return this._tileSize;
},
getMapOrientation: function() {
return this._mapOrientation;
},
getObjectGroups: function() {
return this._groups;
},
getObjectGroup: function(t) {
for (var e = this._groups, i = 0, n = e.length; i < n; i++) {
var r = e[i];
if (r && r.getGroupName() === t) return r;
}
return null;
},
enableCulling: function(t) {
for (var e = this._layers, i = 0; i < e.length; ++i) e[i].enableCulling(t);
},
getProperties: function() {
return this._properties;
},
getLayers: function() {
return this._layers;
},
getLayer: function(t) {
for (var e = this._layers, i = 0, n = e.length; i < n; i++) {
var r = e[i];
if (r && r.getLayerName() === t) return r;
}
return null;
},
_changeLayer: function(t, e) {
for (var i = this._layers, n = 0, r = i.length; n < r; n++) {
var s = i[n];
if (s && s.getLayerName() === t) {
i[n] = e;
return;
}
}
},
getProperty: function(t) {
return this._properties[t.toString()];
},
getPropertiesForGID: function(t) {
return this._tileProperties[t];
},
__preload: function() {
this._tmxFile && this._applyFile();
},
onEnable: function() {
this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this);
},
onDisable: function() {
this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this);
},
_applyFile: function() {
var t = this._tmxFile;
if (t) {
for (var e = t.textures, i = t.textureNames, n = t.textureSizes, r = {}, s = {}, o = 0; o < e.length; ++o) {
var a = i[o];
r[a] = e[o];
s[a] = n[o];
}
var c = {};
e = t.imageLayerTextures;
i = t.imageLayerTextureNames;
for (var l = 0; l < e.length; ++l) c[i[l]] = e[l];
for (var u = t.tsxFileNames, h = t.tsxFiles, _ = {}, f = 0; f < u.length; ++f) u[f].length > 0 && (_[u[f]] = h[f].text);
var d = new cc.TMXMapInfo(t.tmxXmlStr, _, r, s, c), 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; e < i; e++) {
t[e].node.removeFromParent(!0);
t[e].node.destroy();
}
t.length = 0;
for (var n = this._groups, r = 0, s = n.length; r < s; r++) {
n[r].node.removeFromParent(!0);
n[r].node.destroy();
}
n.length = 0;
for (var o = this._images, a = 0, c = o.length; a < c; a++) {
o[a].removeFromParent(!0);
o[a].destroy();
}
o.length = 0;
},
_syncAnchorPoint: function() {
var t, e, i = this.node.getAnchorPoint(), n = this.node.width * i.x, r = this.node.height * (1 - i.y);
for (t = 0, e = this._layers.length; t < e; t++) this._layers[t].node.setAnchorPoint(i);
for (t = 0, e = this._groups.length; t < e; t++) {
var s = this._groups[t], o = s.node;
o.anchorX = .5;
o.anchorY = .5;
o.x = s._offset.x - n + o.width * o.anchorX;
o.y = s._offset.y + r - o.height * o.anchorY;
}
for (t = 0, e = this._images.length; t < e; t++) {
var a = this._images[t];
a.anchorX = .5;
a.anchorY = .5;
a.x = a._offset.x - n + a.width * a.anchorX;
a.y = a._offset.y + r - a.height * a.anchorY;
}
},
_fillAniGrids: function(t, e) {
for (var i in e) {
var n = e[i];
if (n) for (var r = n.frames, s = 0; s < r.length; s++) {
var o = r[s];
o.grid = t[o.tileid];
}
}
},
_buildLayerAndGroup: function() {
var t = this._tilesets, e = this._texGrids, i = this._animations;
e.length = 0;
for (var n = 0, r = t.length; n < r; ++n) {
var s = t[n];
s && cc.TiledMap.fillTextureGrids(s, e, n);
}
this._fillAniGrids(e, i);
for (var o = this._layers, a = this._groups, c = this._images, l = {}, u = 0, h = o.length; u < h; u++) l[o[u].node._name] = !0;
for (var _ = 0, f = a.length; _ < f; _++) l[a[_].node._name] = !0;
for (var d = 0, p = c.length; d < p; d++) l[c[d]._name] = !0;
o = this._layers = [];
a = this._groups = [];
c = this._images = [];
var m = this._mapInfo, y = this.node, v = m.getAllChildren(), g = this._textures, b = 0, C = 0;
if (v && v.length > 0) for (var x = 0, A = v.length; x < A; x++) {
var S = v[x], T = S.name, w = this.node.getChildByName(T);
l[T] = !1;
if (!w) {
(w = new cc.Node()).name = T;
y.addChild(w);
}
w.setSiblingIndex(x);
w.active = S.visible;
if (S instanceof cc.TMXLayerInfo) {
var E = w.getComponent(cc.TiledLayer);
E || (E = w.addComponent(cc.TiledLayer));
E._init(S, m, t, g, e);
S.ownTiles = !1;
o.push(E);
} else if (S instanceof cc.TMXObjectGroupInfo) {
var M = w.getComponent(cc.TiledObjectGroup);
M || (M = w.addComponent(cc.TiledObjectGroup));
M._init(S, m, e);
a.push(M);
} else if (S instanceof cc.TMXImageLayerInfo) {
var B = S.sourceImage;
w.opacity = S.opacity;
w.layerInfo = S;
w._offset = cc.v2(S.offset.x, -S.offset.y);
var I = w.getComponent(cc.Sprite);
I || (I = w.addComponent(cc.Sprite));
var D = I.spriteFrame || new cc.SpriteFrame();
D.setTexture(B);
I.spriteFrame = D;
w.width = B.width;
w.height = B.height;
c.push(w);
}
b = Math.max(b, w.width);
C = Math.max(C, w.height);
}
for (var P = y.children, R = 0, L = P.length; R < L; R++) {
var O = P[R];
l[O._name] && O.destroy();
}
this.node.width = b;
this.node.height = C;
this._syncAnchorPoint();
},
_buildWithMapInfo: function(t) {
this._mapInfo = t;
this._mapSize = t.getMapSize();
this._tileSize = t.getTileSize();
this._mapOrientation = t.orientation;
this._properties = t.properties;
this._tileProperties = t.getTileProperties();
this._imageLayers = t.getImageLayers();
this._animations = t.getTileAnimations();
this._tilesets = t.getTilesets();
var e = this._tilesets;
this._textures.length = 0;
for (var i = [], n = 0, r = e.length; n < r; ++n) {
var s = e[n];
if (s && s.sourceImage) {
this._textures[n] = s.sourceImage;
i.push(s.sourceImage);
}
}
for (var o = 0; o < this._imageLayers.length; o++) {
var a = this._imageLayers[o];
a && a.sourceImage && i.push(a.sourceImage);
}
cc.TiledMap.loadAllTextures(i, function() {
this._buildLayerAndGroup();
}.bind(this));
},
update: function(t) {
var e = this._animations, i = this._texGrids;
for (var n in e) {
var r = e[n], s = r.frames, o = s[r.frameIdx];
r.dt += t;
if (o.duration < r.dt) {
r.dt = 0;
r.frameIdx++;
r.frameIdx >= s.length && (r.frameIdx = 0);
o = s[r.frameIdx];
}
i[n] = o.grid;
}
}
});
cc.TiledMap = e.exports = l;
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 < i; s++) {
var o = t[s];
o.loaded ? r() : o.once("load", (function() {
r();
}));
} else e();
};
cc.TiledMap.fillTextureGrids = function(t, e, i) {
var n = t.sourceImage;
if (!t.imageSize.width || !t.imageSize.height) {
t.imageSize.width = n.width;
t.imageSize.height = n.height;
}
var r = t._tileSize.width, s = t._tileSize.height, o = n.width, a = n.height, c = t.spacing, l = t.margin, u = Math.floor((o - 2 * l + c) / (r + c)), h = Math.floor((a - 2 * l + c) / (s + c)) * u, _ = t.firstGid, f = null, d = !!e[_], p = cc.macro.FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX ? .5 : 0;
h <= 0 && (h = 1);
for (var m = t.firstGid + h; _ < m; ++_) {
d && !e[_] && (d = !1);
if (!d && e[_]) break;
f = {
texId: i,
tileset: t,
x: 0,
y: 0,
width: r,
height: s,
t: 0,
l: 0,
r: 0,
b: 0,
gid: _
};
t.rectForGID(_, f);
f.x += p;
f.y += p;
f.width -= 2 * p;
f.height -= 2 * p;
f.t = f.y / a;
f.l = f.x / o;
f.r = (f.x + f.width) / o;
f.b = (f.y + f.height) / a;
e[_] = f;
}
};
cc.js.obsolete(cc.TiledMap.prototype, "cc.TiledMap.tmxFile", "tmxAsset", !0);
cc.js.get(cc.TiledMap.prototype, "mapLoaded", (function() {
cc.errorID(7203);
return [];
}), !1);
}), {
"./CCTMXXMLParser": 369,
"./CCTiledLayer": 370,
"./CCTiledMapAsset": 372,
"./CCTiledObjectGroup": 374,
"./CCTiledTile": 375
} ],
372: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.TiledMapAsset",
extends: cc.Asset,
properties: {
tmxXmlStr: "",
textures: {
default: [],
type: [ cc.Texture2D ]
},
textureNames: [ cc.String ],
textureSizes: {
default: [],
type: [ cc.Size ]
},
imageLayerTextures: {
default: [],
type: [ cc.Texture2D ]
},
imageLayerTextureNames: [ cc.String ],
tsxFiles: [ cc.TextAsset ],
tsxFileNames: [ cc.String ]
},
statics: {
preventDeferredLoadDependents: !0
},
createNode: !1
});
cc.TiledMapAsset = i;
e.exports = i;
}), {} ],
373: [ (function(t, e) {
"use strict";
var i, n = (i = t("../renderer/core/input-assembler")) && i.__esModule ? i : {
default: i
}, r = cc.Class({
name: "cc.TiledMapRenderDataList",
ctor: function() {
this._dataList = [];
this._offset = 0;
},
_pushRenderData: function() {
var t = {};
t.ia = new n.default();
t.nodesRenderList = [];
this._dataList.push(t);
},
popRenderData: function(t) {
this._offset >= this._dataList.length && this._pushRenderData();
var e = this._dataList[this._offset];
e.nodesRenderList.length = 0;
var i = e.ia;
i._vertexBuffer = t._vb;
i._indexBuffer = t._ib;
i._start = t.indiceOffset;
i._count = 0;
this._offset++;
return e;
},
pushNodesList: function(t, e) {
t.nodesRenderList.push(e);
},
reset: function() {
this._offset = 0;
}
});
cc.TiledMapRenderDataList = e.exports = r;
}), {
"../renderer/core/input-assembler": 359
} ],
374: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.TiledObjectGroup",
extends: cc.Component,
getPositionOffset: function() {
return this._positionOffset;
},
getProperties: function() {
return 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 < i; e++) {
var n = this._objects[e];
if (n && n.name === t) return n;
}
return null;
},
getObjects: function() {
return this._objects;
},
_init: function(t, e, i) {
var n = cc.TiledMap, r = n.TMXObjectType, s = n.Orientation, o = n.StaggerAxis, a = n.TileFlag, c = a.FLIPPED_MASK, l = a.HORIZONTAL, u = a.VERTICAL;
this._groupName = t.name;
this._positionOffset = t.offset;
this._mapInfo = e;
this._properties = t.getProperties();
this._offset = cc.v2(t.offset.x, -t.offset.y);
this._opacity = t._opacity;
var h = e._mapSize, _ = e._tileSize, f = 0, d = 0;
if (e.orientation === s.HEX) if (e.getStaggerAxis() === o.STAGGERAXIS_X) {
d = _.height * (h.height + .5);
f = (_.width + e.getHexSideLength()) * Math.floor(h.width / 2) + _.width * (h.width % 2);
} else {
f = _.width * (h.width + .5);
d = (_.height + e.getHexSideLength()) * Math.floor(h.height / 2) + _.height * (h.height % 2);
} else if (e.orientation === s.ISO) {
var p = h.width + h.height;
f = .5 * _.width * p;
d = .5 * _.height * p;
} else {
f = h.width * _.width;
d = h.height * _.height;
}
this.node.setContentSize(f, d);
for (var m = f * this.node.anchorX, y = d * (1 - this.node.anchorY), v = t._objects, g = {}, b = 0, C = v.length; b < C; b++) {
var x = v[b], A = x.type;
x.offset = cc.v2(x.x, x.y);
var S = x.points || x.polylinePoints;
if (S) for (var T = 0; T < S.length; T++) S[T].y *= -1;
if (s.ISO !== e.orientation) x.y = d - x.y; else {
var w = x.x / _.height, E = x.y / _.height;
x.x = .5 * _.width * (h.height + w - E);
x.y = .5 * _.height * (h.width + h.height - w - E);
}
if (A === r.TEXT) {
var M = "text" + x.id;
g[M] = !0;
var B = this.node.getChildByName(M);
B || (B = new cc.Node());
B.active = x.visible;
B.anchorX = 0;
B.anchorY = 1;
B.angle = -x.rotation;
B.x = x.x - m;
B.y = x.y - y;
B.name = M;
B.parent = this.node;
B.color = x.color;
B.opacity = this._opacity;
B.setSiblingIndex(b);
var I = B.getComponent(cc.Label);
I || (I = B.addComponent(cc.Label));
I.overflow = cc.Label.Overflow.SHRINK;
I.lineHeight = x.height;
I.string = x.text;
I.horizontalAlign = x.halign;
I.verticalAlign = x.valign;
I.fontSize = x.pixelsize;
B.width = x.width;
B.height = x.height;
}
if (A === r.IMAGE) {
var D = x.gid, P = i[(D & c) >>> 0];
if (!P) continue;
var R = P.tileset, L = "img" + x.id;
g[L] = !0;
var O = this.node.getChildByName(L), V = x.width || P.width, N = x.height || P.height, F = R.tileOffset.x, z = R.tileOffset.y;
if (O instanceof cc.PrivateNode) {
O.removeFromParent();
O.destroy();
O = null;
}
O || (O = new cc.Node());
if (s.ISO == e.orientation) {
O.anchorX = .5 + F / V;
O.anchorY = z / N;
} else {
O.anchorX = F / V;
O.anchorY = z / N;
}
O.active = x.visible;
O.angle = -x.rotation;
O.x = x.x - m;
O.y = x.y - y;
O.name = L;
O.parent = this.node;
O.opacity = this._opacity;
O.setSiblingIndex(b);
var k = O.getComponent(cc.Sprite);
k || (k = O.addComponent(cc.Sprite));
var G = k.spriteFrame;
G || (G = new cc.SpriteFrame());
(D & l) >>> 0 ? G.setFlipX(!0) : G.setFlipX(!1);
(D & u) >>> 0 ? G.setFlipY(!0) : G.setFlipY(!1);
G.setTexture(P.tileset.sourceImage, cc.rect(P));
k.spriteFrame = G;
k.setVertsDirty();
O.width = V;
O.height = N;
}
}
this._objects = v;
for (var U = this.node.children, H = /^(?:img|text)\d+$/, j = 0, W = U.length; j < W; j++) {
var q = U[j], X = q._name;
H.test(X) && !g[X] && q.destroy();
}
}
});
cc.TiledObjectGroup = e.exports = i;
}), {} ],
375: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.TiledTile",
extends: cc.Component,
editor: !1,
ctor: function() {
this._layer = null;
},
properties: {
_x: 0,
_y: 0,
x: {
get: function() {
return this._x;
},
set: function(t) {
if (t !== this._x) if (this._layer && this._layer._isInvalidPosition(t, this._y)) cc.warn("Invalid x, the valid value is between [%s] ~ [%s]", 0, this._layer._layerSize.width); else {
this._resetTile();
this._x = t;
this._updateInfo();
}
},
type: cc.Integer
},
y: {
get: function() {
return this._y;
},
set: function(t) {
if (t !== this._y) if (this._layer && this._layer._isInvalidPosition(this._x, t)) cc.warn("Invalid y, the valid value is between [%s] ~ [%s]", 0, this._layer._layerSize.height); else {
this._resetTile();
this._y = t;
this._updateInfo();
}
},
type: cc.Integer
},
gid: {
get: function() {
return this._layer ? this._layer.getTileGIDAt(this._x, this._y) : 0;
},
set: function(t) {
this._layer && this._layer.setTileGIDAt(t, this._x, this._y);
},
type: cc.Integer
}
},
onEnable: function() {
var t = this.node.parent;
this._layer = t.getComponent(cc.TiledLayer);
this._resetTile();
this._updateInfo();
},
onDisable: function() {
this._resetTile();
},
_resetTile: function() {
this._layer && this._layer.getTiledTileAt(this._x, this._y) === this && this._layer.setTiledTileAt(this._x, this._y, null);
},
_updateInfo: function() {
if (this._layer) {
var t = this._x, e = this._y;
if (this._layer.getTiledTileAt(t, e)) cc.warn("There is already a TiledTile at [%s, %s]", t, e); else {
this.node.setPosition(this._layer.getPositionAt(t, e));
this._layer.setTiledTileAt(t, e, this);
}
}
}
});
cc.TiledTile = e.exports = i;
}), {} ],
376: [ (function(t) {
"use strict";
t("./CCTiledMap");
t("./CCTiledMapRenderDataList");
t("./tiledmap-buffer");
t("./tmx-layer-assembler");
}), {
"./CCTiledMap": 371,
"./CCTiledMapRenderDataList": 373,
"./tiledmap-buffer": 377,
"./tmx-layer-assembler": 378
} ],
377: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "cc.TiledMapBuffer",
extends: t("../core/renderer/webgl/quad-buffer"),
_updateOffset: function() {
var t = this._offsetInfo;
t.vertexOffset = this.vertexOffset;
t.indiceOffset = this.indiceOffset;
t.byteOffset = this.byteOffset;
},
adjust: function(t, e) {
this.vertexOffset += t;
this.indiceOffset += e;
this.indiceStart = this.indiceOffset;
this.byteOffset = this.byteOffset + t * this._vertexBytes;
this._dirty = !0;
}
});
cc.TiledMapBuffer = e.exports = i;
}), {
"../core/renderer/webgl/quad-buffer": 309
} ],
378: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../core/renderer/assembler")) && n.__esModule ? n : {
default: n
}, s = t("../core/value-types");
function o(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
a(t, e);
}
function a(t, e) {
return (a = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var c = t("./CCTiledLayer"), l = t("./CCTiledMap"), u = l.TileFlag, h = u.FLIPPED_MASK, _ = t("../core/renderer/"), f = t("../core/renderer/webgl/vertex-format").vfmtPosUvColor, d = parseInt(10922.5), p = l.RenderOrder, m = (t("../core/renderer/render-flow"), 
cc.mat4()), y = cc.v3(), v = {
row: 0,
col: 0
}, g = {
x: 0,
y: 0
}, b = {
x: 0,
y: 0
}, C = {
x: 0,
y: 0
}, x = {
x: 0,
y: 0
}, A = null, S = null, T = 0, w = 0, E = 0, M = 0, B = null, I = null, D = null, P = null, R = null, L = null, O = null;
function V() {
if (0 !== S._count) {
B.material = A.material;
B.node = R.node;
B._flushIA(A.ia);
if (T >= d) {
D.uploadData();
D.switchBuffer();
L = D._vData;
O = D._uintVData;
A = I.popRenderData(D);
S = A.ia;
w = 0;
T = 0;
} else {
A = I.popRenderData(D);
S = A.ia;
}
A.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;
V();
B.worldMatDirty++;
for (;r < i.count; ) {
var o = n[s];
s++;
if (o) {
o.node;
if (r !== s) {
n[r] = o;
o._index = r;
}
r++;
}
}
n.length = r;
B.worldMatDirty--;
I.pushNodesList(A, n);
B._flush();
B.node = R.node;
}
}
function F(t, e) {
g.x = t.l;
g.y = t.t;
b.x = t.r;
b.y = t.t;
C.x = t.l;
C.y = t.b;
x.x = t.r;
x.y = t.b;
var i = null;
if ((e & u.DIAGONAL) >>> 0) {
i = b;
b = C;
C = i;
}
if ((e & u.HORIZONTAL) >>> 0) {
i = g;
g = b;
b = i;
i = C;
C = x;
x = i;
}
if ((e & u.VERTICAL) >>> 0) {
i = g;
g = C;
C = i;
i = b;
b = x;
x = i;
}
}
var z = (function(t) {
o(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.updateRenderData = function(t) {
if (!t._renderDataList) {
t._buffer = new cc.TiledMapBuffer(_._handle, f);
t._renderDataList = new cc.TiledMapRenderDataList();
}
};
i.fillBuffers = function(t, e) {
if (0 !== t._vertices.length) {
t._updateCulling();
var i = t.node;
E = t._leftDownToCenterX;
M = t._leftDownToCenterY;
i._worldMatrix;
B = e;
R = t;
I = t._renderDataList;
D = t._buffer;
if (t._isCullingDirty() || t._isUserNodeDirty() || t._hasAnimation() || t._hasTiledNode()) {
D.reset();
var n, r;
if (t._enableCulling) {
var s = t._cullingRect;
n = s.leftDown;
r = s.rightTop;
} else {
n = v;
r = t._rightTop;
}
var o = (r.row - n.row + 1) * (r.col - n.col + 1);
o > d && (o = d);
D.request(4 * o, 6 * o);
switch (t._renderOrder) {
case p.RightDown:
this.traverseGrids(n, r, -1, 1);
break;

case p.LeftDown:
this.traverseGrids(n, r, -1, -1);
break;

case p.RightUp:
this.traverseGrids(n, r, 1, 1);
break;

case p.LeftUp:
this.traverseGrids(n, r, 1, -1);
}
t._setCullingDirty(!1);
t._setUserNodeDirty(!1);
}
A = null;
S = null;
B = null;
I = null;
D = null;
P = null;
R = null;
L = null;
O = null;
}
};
i.traverseGrids = function(t, e, i, n) {
I.reset();
if (!(e.row < 0 || e.col < 0)) {
A = I.popRenderData(D);
S = A.ia;
L = D._vData;
O = D._uintVData;
T = 0;
w = 0;
P = null;
var r = R.node, s = (r.parent ? r.parent._opacity / 255 : 1) * r._opacity;
r._color._fastSetA(s);
var o, a, c, l, u, _, f, p, m = r._color._val, y = R._tiledTiles, v = R._texGrids, z = R._tiles, k = R._texIdToMatIndex, G = R._materials, U = R._vertices, H = null, j = 0, W = 0, q = 0, X = 0, Y = 0, J = null, Z = -1, K = 0, Q = !0;
if (-1 == i) {
l = e.row;
u = t.row;
} else {
l = t.row;
u = e.row;
}
for (;(u - l) * i >= 0; l += i) {
o = U[l];
Q = 0 == (K = R._getNodesCountByRow(l)) && null != o;
if (1 == n) {
a = Q && t.col < o.minCol ? o.minCol : t.col;
c = Q && e.col > o.maxCol ? o.maxCol : e.col;
} else {
a = Q && e.col > o.maxCol ? o.maxCol : e.col;
c = Q && t.col < o.minCol ? o.minCol : t.col;
}
for (;(c - a) * n >= 0; a += n) if (_ = o && o[a]) {
if (H = v[((j = z[_.index]) & h) >>> 0]) {
if (Z !== H.texId) {
-1 !== Z && V();
p = k[Z = H.texId];
P = G[p];
A.material = P;
}
if (P) {
W = _.left - E;
q = _.bottom - M;
X = W + (f = H.tileset._tileSize).width;
Y = q + f.height;
if (J = y[_.index]) {
if (J.node.active) {
J.node._color._fastSetA(J.node._opacity * s / 255);
this.fillByTiledNode(J.node, L, O, W, X, Y, q);
}
} else {
L[w] = W;
L[w + 1] = Y;
O[w + 4] = m;
L[w + 5] = W;
L[w + 6] = q;
O[w + 9] = m;
L[w + 10] = X;
L[w + 11] = Y;
O[w + 14] = m;
L[w + 15] = X;
L[w + 16] = q;
O[w + 19] = m;
}
F(H, j);
L[w + 2] = g.x;
L[w + 3] = g.y;
L[w + 7] = C.x;
L[w + 8] = C.y;
L[w + 12] = b.x;
L[w + 13] = b.y;
L[w + 17] = x.x;
L[w + 18] = x.y;
w += 20;
D.adjust(4, 6);
S._count += 6;
T++;
K > 0 && N(l, a);
T >= d && V();
}
}
} else K > 0 && N(l, a);
}
D.uploadData();
if (S._count > 0) {
B.material = A.material;
B.node = R.node;
B._flushIA(A.ia);
}
}
};
i.fillByTiledNode = function(t, e, i, n, r, o, a) {
t._updateLocalMatrix();
s.Mat4.copy(m, t._matrix);
s.Vec3.set(y, -(n + E), -(a + M), 0);
s.Mat4.transform(m, m, y);
var c = m.m, l = c[0], u = c[1], h = c[4], _ = c[5], f = c[12], d = c[13], p = t._color._val;
e[w] = n * l + o * h + f;
e[w + 1] = n * u + o * _ + d;
i[w + 4] = p;
e[w + 5] = n * l + a * h + f;
e[w + 6] = n * u + a * _ + d;
i[w + 9] = p;
e[w + 10] = r * l + o * h + f;
e[w + 11] = r * u + o * _ + d;
i[w + 14] = p;
e[w + 15] = r * l + a * h + f;
e[w + 16] = r * u + a * _ + d;
i[w + 19] = p;
};
return e;
})(r.default);
i.default = z;
r.default.register(c, z);
e.exports = i.default;
}), {
"../core/renderer/": 271,
"../core/renderer/assembler": 268,
"../core/renderer/render-flow": 272,
"../core/renderer/webgl/vertex-format": 311,
"../core/value-types": 337,
"./CCTiledLayer": 370,
"./CCTiledMap": 371
} ],
379: [ (function(t, e) {
"use strict";
var i = t("./video-player-impl"), n = i.EventType, r = cc.Enum({
REMOTE: 0,
LOCAL: 1
}), s = cc.Class({
name: "cc.VideoPlayer",
extends: cc.Component,
editor: !1,
properties: {
_resourceType: r.REMOTE,
resourceType: {
tooltip: !1,
type: r,
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.VideoClip
},
clip: {
tooltip: !1,
get: function() {
return this._clip;
},
set: function(t) {
this._clip = t;
this._updateVideoSource();
},
type: cc.VideoClip
},
currentTime: {
tooltip: !1,
type: cc.Float,
set: function(t) {
this._impl && this._impl.seekTo(t);
},
get: function() {
return this._impl ? this._currentStatus === n.NONE || this._currentStatus === n.STOPPED || this._currentStatus === n.META_LOADED || this._currentStatus === n.READY_TO_PLAY ? 0 : this._currentStatus === n.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() {
this._isFullscreen = this._impl && this._impl.isFullScreenEnabled();
return 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: n,
ResourceType: r,
Impl: i
},
ctor: function() {
this._impl = new i();
this._currentStatus = n.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 === r.REMOTE ? t = this.remoteURL : this._clip && (t = this._clip.nativeUrl);
this._impl.setURL(t, this._mute || 0 === this._volume);
this._impl.setKeepAspectRatioEnabled(this.keepAspectRatio);
},
onLoad: function() {
var t = this._impl;
if (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(n.PLAYING, this.onPlaying.bind(this));
t.setEventListener(n.PAUSED, this.onPasued.bind(this));
t.setEventListener(n.STOPPED, this.onStopped.bind(this));
t.setEventListener(n.COMPLETED, this.onCompleted.bind(this));
t.setEventListener(n.META_LOADED, this.onMetaLoaded.bind(this));
t.setEventListener(n.CLICKED, this.onClicked.bind(this));
t.setEventListener(n.READY_TO_PLAY, this.onReadyToPlay.bind(this));
}
},
onRestore: function() {
this._impl || (this._impl = new i());
},
onEnable: function() {
this._impl && this._impl.enable();
},
onDisable: function() {
this._impl && this._impl.disable();
},
onDestroy: function() {
if (this._impl) {
this._impl.destroy();
this._impl = null;
}
},
update: function() {
this._impl && this._impl.updateMatrix(this.node);
},
onReadyToPlay: function() {
this._currentStatus = n.READY_TO_PLAY;
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.READY_TO_PLAY);
this.node.emit("ready-to-play", this);
},
onMetaLoaded: function() {
this._currentStatus = n.META_LOADED;
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.META_LOADED);
this.node.emit("meta-loaded", this);
},
onClicked: function() {
this._currentStatus = n.CLICKED;
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.CLICKED);
this.node.emit("clicked", this);
},
onPlaying: function() {
this._currentStatus = n.PLAYING;
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.PLAYING);
this.node.emit("playing", this);
},
onPasued: function() {
this._currentStatus = n.PAUSED;
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.PAUSED);
this.node.emit("paused", this);
},
onStopped: function() {
this._currentStatus = n.STOPPED;
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.STOPPED);
this.node.emit("stopped", this);
},
onCompleted: function() {
this._currentStatus = n.COMPLETED;
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.COMPLETED);
this.node.emit("completed", this);
},
play: function() {
if (this._impl) {
this._syncVolume();
this._impl.play();
}
},
resume: function() {
if (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 = s;
}), {
"./video-player-impl": 380
} ],
380: [ (function(t, e) {
"use strict";
var i = t("../core/platform/utils"), n = t("../core/platform/CCSys"), r = t("../core/platform/CCMacro"), s = 1, o = 4, a = cc.mat4(), c = 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;
if (e._waitingFullscreen) {
e._waitingFullscreen = !1;
e._toggleFullscreen(!0);
}
e._dispatchEvent(c.EventType.META_LOADED);
};
i.ended = function() {
if (e._video === t) {
e._playing = !1;
e._dispatchEvent(c.EventType.COMPLETED);
}
};
i.play = function() {
if (e._video === t) {
e._playing = !0;
e._updateVisibility();
e._dispatchEvent(c.EventType.PLAYING);
}
};
i.pause = function() {
if (e._video === t) {
e._playing = !1;
e._ignorePause || e._dispatchEvent(c.EventType.PAUSED);
}
};
i.click = function() {
e._dispatchEvent(c.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;
if (t.readyState === o || t.readyState === s) {
t.currentTime = 0;
e._loaded = !0;
e._forceUpdate = !0;
e._dispatchEvent(c.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;
if (t) if (this._visible) t.style.visibility = "visible"; else {
t.style.visibility = "hidden";
t.pause();
this._playing = !1;
}
},
_updateSize: function(t, e) {
var i = this._video;
if (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 ? r.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) {
i.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 = c._polyfill, o = 0; o < s.canPlayType.length; o++) if (n !== s.canPlayType[o]) {
(i = document.createElement("source")).src = t.replace(n, s.canPlayType[o]);
r.appendChild(i);
}
}
},
getURL: function() {
return this._url;
},
play: function() {
var t = this._video;
t && this._visible && !this._playing && t.play();
},
pause: function() {
var t = this._video;
this._playing && t && t.pause();
},
resume: function() {
this.play();
},
stop: function() {
var t = this._video;
if (t && this._visible) {
this._ignorePause = !0;
t.currentTime = 0;
t.pause();
setTimeout(function() {
this._dispatchEvent(c.EventType.STOPPED);
this._ignorePause = !1;
}.bind(this), 0);
}
},
setVolume: function(t) {
var e = this._video;
e && (e.volume = t);
},
seekTo: function(t) {
var e = this._video;
e && (this._loaded ? e.currentTime = t : e.addEventListener(c._polyfill.event, (function i() {
e.currentTime = t;
e.removeEventListener(c._polyfill.event, i);
})));
},
isPlaying: function() {
return this._playing;
},
duration: function() {
var t = this._video, e = -1;
if (!t) return e;
(e = t.duration) <= 0 && cc.logID(7702);
return e;
},
currentTime: function() {
var t = this._video;
return t ? t.currentTime : -1;
},
setKeepAspectRatioEnabled: function() {
cc.logID(7700);
},
isKeepAspectRatioEnabled: function() {
return !0;
},
_toggleFullscreen: function(t) {
var e = this, i = this._video;
if (i) if (t) {
n.browserType === n.BROWSER_TYPE_IE && (i.style.transform = "");
cc.screen.requestFullScreen(i, (function() {
var t = n.browserType === n.BROWSER_TYPE_IE ? document.msFullscreenElement : document.fullscreenElement;
e._fullScreenEnabled = t === i;
}), (function() {
e._fullScreenEnabled = !1;
}));
} else cc.screen.fullScreen() && cc.screen.exitFullScreen(i);
},
setStayOnBottom: function(t) {
this._stayOnBottom = t;
this._video && (this._video.style["z-index"] = t ? r.MIN_ZINDEX : 0);
},
setFullScreenEnabled: function(t) {
!this._loadedmeta && t ? this._waitingFullscreen = !0 : this._toggleFullscreen(t);
},
isFullScreenEnabled: function() {
return this._fullScreenEnabled;
},
setEventListener: function(t, e) {
this._EventList[t] = e;
},
removeEventListener: function(t) {
this._EventList[t] = null;
},
_dispatchEvent: function(t) {
var e = this._EventList[t];
e && e.call(this, this, this._video.src);
},
onPlayEvent: function() {
this._EventList[c.EventType.PLAYING].call(this, this, this._video.src);
},
enable: function() {
var t = c.elements;
-1 === t.indexOf(this) && t.push(this);
this.setVisible(!0);
},
disable: function() {
var t = c.elements, e = t.indexOf(this);
-1 !== e && t.splice(e, 1);
this.setVisible(!1);
},
destroy: function() {
this.disable();
this.removeDom();
},
setVisible: function(t) {
if (this._visible !== t) {
this._visible = !!t;
this._updateVisibility();
}
},
updateMatrix: function(t) {
if (this._video && this._visible && !this._fullScreenEnabled) {
t.getWorldMatrix(a);
var e = cc.Camera._findRendererCamera(t);
e && e.worldMatrixToScreen(a, a, cc.game.canvas.width, cc.game.canvas.height);
var i = a.m;
if (this._forceUpdate || this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) {
this._m00 = i[0];
this._m01 = i[1];
this._m04 = i[4];
this._m05 = i[5];
this._m12 = i[12];
this._m13 = i[13];
this._w = t._contentSize.width;
this._h = t._contentSize.height;
var r, s, o = cc.view._devicePixelRatio, l = 1 / o, u = 1 / o, h = cc.game.container, _ = i[0] * l, f = i[1], d = i[4], p = i[5] * u, m = h && h.style.paddingLeft ? parseInt(h.style.paddingLeft) : 0, y = h && h.style.paddingBottom ? parseInt(h.style.paddingBottom) : 0;
if (c._polyfill.zoomInvalid) {
this._updateSize(this._w * _, this._h * p);
_ = 1;
p = 1;
r = this._w * l;
s = this._h * u;
} else {
r = this._w * l;
s = this._h * u;
this._updateSize(this._w, this._h);
}
var v = r * i[0] * t._anchorPoint.x, g = s * i[5] * t._anchorPoint.y, b = "matrix(" + _ + "," + -f + "," + -d + "," + p + "," + (i[12] * l - v + m) + "," + -(i[13] * u - g + y) + ")";
this._video.style.transform = b;
this._video.style["-webkit-transform"] = b;
this._video.style["transform-origin"] = "0px 100% 0px";
this._video.style["-webkit-transform-origin"] = "0px 100% 0px";
n.browserType !== n.BROWSER_TYPE_IE && (this._forceUpdate = !1);
}
}
}
});
c.EventType = {
NONE: -1,
PLAYING: 0,
PAUSED: 1,
STOPPED: 2,
COMPLETED: 3,
META_LOADED: 4,
CLICKED: 5,
READY_TO_PLAY: 6
};
c.elements = [];
c.pauseElements = [];
cc.game.on(cc.game.EVENT_HIDE, (function() {
for (var t, e = c.elements, i = 0; i < e.length; i++) if ((t = e[i]).isPlaying()) {
t.pause();
c.pauseElements.push(t);
}
}));
cc.game.on(cc.game.EVENT_SHOW, (function() {
for (var t = c.pauseElements, e = t.pop(); e; ) {
e.play();
e = t.pop();
}
}));
c._polyfill = {
devicePixelRatio: !1,
event: "canplay",
canPlayType: []
};
var l = document.createElement("video");
if (l.canPlayType) {
if (l.canPlayType("video/ogg")) {
c._polyfill.canPlayType.push(".ogg");
c._polyfill.canPlayType.push(".ogv");
}
l.canPlayType("video/mp4") && c._polyfill.canPlayType.push(".mp4");
l.canPlayType("video/webm") && c._polyfill.canPlayType.push(".webm");
}
n.OS_ANDROID !== n.os || n.browserType !== n.BROWSER_TYPE_SOUGOU && n.browserType !== n.BROWSER_TYPE_360 || (c._polyfill.zoomInvalid = !0);
var u = document.createElement("style");
u.innerHTML = ".cocosVideo:-moz-full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:-webkit-full-screen{transform:matrix(1,0,0,1,0,0) !important;}";
document.head.appendChild(u);
e.exports = c;
}), {
"../core/platform/CCMacro": 244,
"../core/platform/CCSys": 248,
"../core/platform/utils": 263
} ],
381: [ (function(t, e) {
"use strict";
var i = t("./webview-impl"), n = i.EventType;
function r() {}
var s = cc.Class({
name: "cc.WebView",
extends: cc.Component,
editor: !1,
properties: {
_url: "",
url: {
type: cc.String,
tooltip: !1,
get: function() {
return this._url;
},
set: function(t) {
this._url = t;
var e = this._impl;
e && e.loadURL(t);
}
},
webviewEvents: {
default: [],
type: cc.Component.EventHandler
}
},
statics: {
EventType: n,
Impl: i
},
ctor: function() {
this._impl = new s.Impl();
},
onRestore: function() {
this._impl || (this._impl = new s.Impl());
},
onEnable: function() {
var t = this._impl;
t.createDomElementIfNeeded(this.node.width, this.node.height);
t.setEventListener(n.LOADED, this._onWebViewLoaded.bind(this));
t.setEventListener(n.LOADING, this._onWebViewLoading.bind(this));
t.setEventListener(n.ERROR, this._onWebViewLoadError.bind(this));
t.loadURL(this._url);
t.setVisible(!0);
},
onDisable: function() {
var t = this._impl;
t.setVisible(!1);
t.setEventListener(n.LOADED, r);
t.setEventListener(n.LOADING, r);
t.setEventListener(n.ERROR, r);
},
onDestroy: function() {
if (this._impl) {
this._impl.destroy();
this._impl = null;
}
},
update: function() {
this._impl && this._impl.updateMatrix(this.node);
},
_onWebViewLoaded: function() {
cc.Component.EventHandler.emitEvents(this.webviewEvents, this, n.LOADED);
this.node.emit("loaded", this);
},
_onWebViewLoading: function() {
cc.Component.EventHandler.emitEvents(this.webviewEvents, this, n.LOADING);
this.node.emit("loading", this);
return !0;
},
_onWebViewLoadError: function() {
cc.Component.EventHandler.emitEvents(this.webviewEvents, this, n.ERROR);
this.node.emit("error", this);
},
setJavascriptInterfaceScheme: function(t) {
this._impl && this._impl.setJavascriptInterfaceScheme(t);
},
setOnJSCallback: function(t) {
this._impl && this._impl.setOnJSCallback(t);
},
evaluateJS: function(t) {
this._impl && this._impl.evaluateJS(t);
}
});
cc.WebView = e.exports = s;
}), {
"./webview-impl": 382
} ],
382: [ (function(t, e) {
"use strict";
var i = t("../core/platform/utils"), n = t("../core/platform/CCSys"), r = cc.mat4(), s = cc.Class({
name: "WebViewImpl",
ctor: function() {
this._EventList = {};
this._visible = !1;
this._parent = null;
this._div = null;
this._iframe = null;
this._listener = null;
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 = {};
},
_updateVisibility: function() {
if (this._div) {
var t = this._div;
this._visible ? t.style.visibility = "visible" : t.style.visibility = "hidden";
}
},
_updateSize: function(t, e) {
var i = this._div;
if (i) {
i.style.width = t + "px";
i.style.height = e + "px";
}
},
_initEvent: function() {
var t = this._iframe;
if (t) {
var e = this.__eventListeners, i = this;
e.load = function() {
i._forceUpdate = !0;
i._dispatchEvent(s.EventType.LOADED);
};
e.error = function() {
i._dispatchEvent(s.EventType.ERROR);
};
t.addEventListener("load", e.load);
t.addEventListener("error", e.error);
}
},
_initStyle: function() {
if (this._div) {
var t = this._div;
t.style.position = "absolute";
t.style.bottom = "0px";
t.style.left = "0px";
}
},
_setOpacity: function(t) {
var e = this._iframe;
e && e.style && (e.style.opacity = t / 255);
},
_createDom: function(t, e) {
if (s._polyfill.enableDiv) {
this._div = document.createElement("div");
this._div.style["-webkit-overflow"] = "auto";
this._div.style["-webkit-overflow-scrolling"] = "touch";
this._iframe = document.createElement("iframe");
this._div.appendChild(this._iframe);
this._iframe.style.width = "100%";
this._iframe.style.height = "100%";
} else this._div = this._iframe = document.createElement("iframe");
s._polyfill.enableBG && (this._div.style.background = "#FFF");
this._div.style.height = e + "px";
this._div.style.width = t + "px";
this._div.style.overflow = "scroll";
this._iframe.style.border = "none";
cc.game.container.appendChild(this._div);
this._updateVisibility();
},
_createNativeControl: function(t, e) {
this._createDom(t, e);
this._initStyle();
this._initEvent();
},
createDomElementIfNeeded: function(t, e) {
this._div ? this._updateSize(t, e) : this._createNativeControl(t, e);
},
removeDom: function() {
var t = this._div;
if (t) {
i.contains(cc.game.container, t) && cc.game.container.removeChild(t);
this._div = null;
}
var e = this._iframe;
if (e) {
var n = this.__eventListeners;
e.removeEventListener("load", n.load);
e.removeEventListener("error", n.error);
n.load = null;
n.error = null;
this._iframe = null;
}
},
setOnJSCallback: function() {},
setJavascriptInterfaceScheme: function() {},
loadData: function() {},
loadHTMLString: function() {},
loadURL: function(t) {
var e = this._iframe;
if (e) {
e.src = t;
var i = this;
e.addEventListener("load", (function t() {
i._loaded = !0;
i._updateVisibility();
e.removeEventListener("load", t);
}));
this._dispatchEvent(s.EventType.LOADING);
}
},
stopLoading: function() {
cc.logID(7800);
},
reload: function() {
var t = this._iframe;
if (t) {
var e = t.contentWindow;
e && e.location && e.location.reload();
}
},
canGoBack: function() {
cc.logID(7801);
return !0;
},
canGoForward: function() {
cc.logID(7802);
return !0;
},
goBack: function() {
try {
if (s._polyfill.closeHistory) return cc.logID(7803);
var t = this._iframe;
if (t) {
var e = t.contentWindow;
e && e.location && e.history.back.call(e);
}
} catch (t) {
cc.log(t);
}
},
goForward: function() {
try {
if (s._polyfill.closeHistory) return cc.logID(7804);
var t = this._iframe;
if (t) {
var e = t.contentWindow;
e && e.location && e.history.forward.call(e);
}
} catch (t) {
cc.log(t);
}
},
evaluateJS: function(t) {
var e = this._iframe;
if (e) {
var i = e.contentWindow;
try {
i.eval(t);
this._dispatchEvent(s.EventType.JS_EVALUATED);
} catch (t) {
console.error(t);
}
}
},
setScalesPageToFit: function() {
cc.logID(7805);
},
setEventListener: function(t, e) {
this._EventList[t] = e;
},
removeEventListener: function(t) {
this._EventList[t] = null;
},
_dispatchEvent: function(t) {
var e = this._EventList[t];
e && e.call(this, this, this._iframe.src);
},
_createRenderCmd: function() {
return new s.RenderCmd(this);
},
destroy: function() {
this.removeDom();
},
setVisible: function(t) {
if (this._visible !== t) {
this._visible = !!t;
this._updateVisibility();
}
},
updateMatrix: function(t) {
if (this._div && this._visible) {
t.getWorldMatrix(r);
var e = cc.Camera._findRendererCamera(t);
e && e.worldMatrixToScreen(r, r, cc.game.canvas.width, cc.game.canvas.height);
var i = r.m;
if (this._forceUpdate || this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) {
this._m00 = i[0];
this._m01 = i[1];
this._m04 = i[4];
this._m05 = i[5];
this._m12 = i[12];
this._m13 = i[13];
this._w = t._contentSize.width;
this._h = t._contentSize.height;
var n = cc.view._devicePixelRatio, s = 1 / n, o = 1 / n, a = cc.game.container, c = i[0] * s, l = i[1], u = i[4], h = i[5] * o, _ = a && a.style.paddingLeft ? parseInt(a.style.paddingLeft) : 0, f = a && a.style.paddingBottom ? parseInt(a.style.paddingBottom) : 0;
this._updateSize(this._w, this._h);
var d = this._w * s, p = this._h * o, m = d * i[0] * t._anchorPoint.x, y = p * i[5] * t._anchorPoint.y, v = "matrix(" + c + "," + -l + "," + -u + "," + h + "," + (i[12] * s - m + _) + "," + -(i[13] * o - y + f) + ")";
this._div.style.transform = v;
this._div.style["-webkit-transform"] = v;
this._div.style["transform-origin"] = "0px 100% 0px";
this._div.style["-webkit-transform-origin"] = "0px 100% 0px";
this._setOpacity(t.opacity);
this._forceUpdate = !1;
}
}
}
});
s.EventType = {
LOADING: 0,
LOADED: 1,
ERROR: 2,
JS_EVALUATED: 3
};
var o = s._polyfill = {
devicePixelRatio: !1,
enableDiv: !1
};
n.os === n.OS_IOS && (o.enableDiv = !0);
n.isMobile ? n.browserType === n.BROWSER_TYPE_FIREFOX && (o.enableBG = !0) : n.browserType === n.BROWSER_TYPE_IE && (o.closeHistory = !0);
e.exports = s;
}), {
"../core/platform/CCSys": 248,
"../core/platform/utils": 263
} ],
383: [ (function(t) {
"use strict";
t("./cocos2d/core");
t("./cocos2d/animation");
t("./cocos2d/particle");
t("./cocos2d/tilemap");
t("./cocos2d/videoplayer/CCVideoPlayer");
t("./cocos2d/webview/CCWebView");
t("./cocos2d/core/components/CCStudioComponent");
t("./extensions/ccpool/CCNodePool");
t("./cocos2d/actions");
t("./extensions/spine");
t("./extensions/dragonbones");
t("./cocos2d/deprecated");
}), {
"./cocos2d/actions": 7,
"./cocos2d/animation": 16,
"./cocos2d/core": 206,
"./cocos2d/core/components/CCStudioComponent": 167,
"./cocos2d/deprecated": 349,
"./cocos2d/particle": 355,
"./cocos2d/particle/CCParticleAsset": 352,
"./cocos2d/tilemap": 376,
"./cocos2d/tilemap/CCTiledMapAsset": 372,
"./cocos2d/videoplayer/CCVideoPlayer": 379,
"./cocos2d/webview/CCWebView": 381,
"./extensions/ccpool/CCNodePool": 384,
"./extensions/dragonbones": 389,
"./extensions/spine": 393
} ],
384: [ (function(t, e) {
"use strict";
cc.NodePool = function(t) {
this.poolHandlerComp = t;
this._pool = [];
};
cc.NodePool.prototype = {
constructor: cc.NodePool,
size: function() {
return this._pool.length;
},
clear: function() {
for (var t = this._pool.length, e = 0; e < t; ++e) this._pool[e].destroy();
this._pool.length = 0;
},
put: function(t) {
if (t && -1 === this._pool.indexOf(t)) {
t.removeFromParent(!1);
var e = this.poolHandlerComp ? t.getComponent(this.poolHandlerComp) : null;
e && e.unuse && e.unuse();
this._pool.push(t);
}
},
get: function() {
var t = this._pool.length - 1;
if (t < 0) return null;
var e = this._pool[t];
this._pool.length = t;
var i = this.poolHandlerComp ? e.getComponent(this.poolHandlerComp) : null;
i && i.reuse && i.reuse.apply(i, arguments);
return e;
}
};
e.exports = cc.NodePool;
}), {} ],
385: [ (function(t, e) {
"use strict";
var i = t("../../cocos2d/core/components/CCRenderComponent"), n = t("../../cocos2d/core/event/event-target"), r = t("../../cocos2d/core/graphics/graphics"), s = t("../../cocos2d/core/renderer/render-flow").FLAG_POST_RENDER, o = t("./ArmatureCache"), a = t("./AttachUtil"), c = cc.Enum({
default: -1
}), l = cc.Enum({
"<None>": 0
}), u = (cc.Enum({
REALTIME: 0
}), cc.Enum({
REALTIME: 0,
SHARED_CACHE: 1,
PRIVATE_CACHE: 2
})), h = cc.Class({
name: "dragonBones.ArmatureDisplay",
extends: i,
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;
this.dragonAsset && (e = this.dragonAsset.getArmatureEnum());
if (!e) return cc.errorID(7400, this.name);
t = e[this._defaultArmatureIndex];
}
void 0 !== t ? this.armatureName = t : cc.errorID(7401, this.name);
},
type: c,
visible: !0,
editorOnly: !0,
animatable: !1,
displayName: "Armature",
tooltip: !1
},
_animationIndex: {
default: 0,
notify: function() {
if (0 !== this._animationIndex) {
var t;
this.dragonAsset && (t = this.dragonAsset.getAnimsEnum(this.armatureName));
if (t) {
var e = t[this._animationIndex];
void 0 !== e ? this.playAnimation(e, this.playTimes) : cc.errorID(7402, this.name);
}
} else this.animationName = "";
},
type: l,
visible: !0,
editorOnly: !0,
animatable: !1,
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)) this.setAnimationCacheMode(this._defaultCacheMode); else {
this._defaultCacheMode = u.REALTIME;
cc.warn("Animation cache mode doesn't support skeletal nesting");
}
},
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 n();
this._materialCache = {};
this._inited = !1;
this.attachUtil = new a();
this._factory = dragonBones.CCFactory.getInstance();
},
onLoad: function() {
for (var t = this.node.children, e = 0, i = t.length; e < i; e++) {
var n = t[e];
0 === (n._name && n._name.search("CHILD_ARMATURE-")) && n.destroy();
}
},
_updateBatch: function() {
var t = this.getMaterial(0);
t && t.define("CC_USE_MODEL", !this.enableBatch);
this._materialCache = {};
},
_updateMaterial: function() {
var t = this.getMaterial(0);
if (t) {
t.define("CC_USE_MODEL", !this.enableBatch);
t.define("USE_TEXTURE", !0);
var e = this.premultipliedAlpha ? cc.gfx.BLEND_ONE : cc.gfx.BLEND_SRC_ALPHA, i = cc.gfx.BLEND_ONE_MINUS_SRC_ALPHA;
t.setBlend(!0, cc.gfx.BLEND_FUNC_ADD, e, e, cc.gfx.BLEND_FUNC_ADD, i, i);
}
this._materialCache = {};
},
disableRender: function() {
this._super();
this.node._renderFlag &= ~s;
},
markForRender: function(t) {
this._super(t);
t ? this.node._renderFlag |= s : this.node._renderFlag &= ~s;
},
_validateRender: function() {
var t = this.dragonAtlasAsset && this.dragonAtlasAsset.texture;
t && t.loaded ? this._super() : this.disableRender();
},
__preload: function() {
this._init();
},
_init: function() {
if (!this._inited) {
this._inited = !0;
this._resetAssembler();
this._activateMaterial();
this._parseDragonAtlasAsset();
this._refresh();
for (var t = this.node.children, e = 0, i = t.length; e < i; e++) {
var n = t[e];
n && "DEBUG_DRAW_NODE" === n._name && n.destroy();
}
this._updateDebugDraw();
}
},
getArmatureKey: function() {
return this._armatureKey;
},
setAnimationCacheMode: function(t) {
if (this._preCacheMode !== t) {
this._cacheMode = t;
this._buildArmature();
this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature);
}
},
isAnimationCached: function() {
return this._cacheMode !== u.REALTIME;
},
onEnable: function() {
this._super();
this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature);
},
onDisable: function() {
this._super();
this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.remove(this._armature);
},
_emitCacheCompleteEvent: function() {
this._eventTarget.emit(dragonBones.EventObject.LOOP_COMPLETE);
this._eventTarget.emit(dragonBones.EventObject.COMPLETE);
},
update: function(t) {
if (this.isAnimationCached() && this._frameCache) {
var e = this._frameCache;
if (e.isInited()) {
var i = e.frames;
if (this._playing) {
var n = o.FrameTime;
0 == this._accTime && 0 == this._playCount && this._eventTarget.emit(dragonBones.EventObject.START);
var r = dragonBones.timeScale;
this._accTime += t * this.timeScale * r;
var s = Math.floor(this._accTime / n);
e.isCompleted || e.updateToFrame(s);
if (e.isCompleted && s >= i.length) {
this._playCount++;
if (this.playTimes > 0 && this._playCount >= this.playTimes) {
this._curFrame = i[i.length - 1];
this._accTime = 0;
this._playing = !1;
this._playCount = 0;
this._emitCacheCompleteEvent();
return;
}
this._accTime = 0;
s = 0;
this._emitCacheCompleteEvent();
}
this._curFrame = i[s];
} else if (e.isInvalid()) {
e.updateToFrame();
this._curFrame = i[i.length - 1];
}
}
}
},
onDestroy: function() {
this._super();
this._inited = !1;
if (this._cacheMode === u.PRIVATE_CACHE) {
this._armatureCache.dispose();
this._armatureCache = null;
this._armature = null;
} else if (this._cacheMode === u.SHARED_CACHE) {
this._armatureCache = null;
this._armature = null;
} else if (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(r);
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) {
if (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;
}
if (this._cacheMode === u.SHARED_CACHE) this._armatureCache = o.sharedCache; else if (this._cacheMode === u.PRIVATE_CACHE) {
this._armatureCache = new o();
this._armatureCache.enablePrivateMode();
}
var t = this.dragonAtlasAsset._uuid;
this._armatureKey = this.dragonAsset.init(this._factory, t);
if (this.isAnimationCached()) {
this._armature = this._armatureCache.getArmatureCache(this.armatureName, this._armatureKey, t);
this._armature || (this._cacheMode = u.REALTIME);
}
this._preCacheMode = this._cacheMode;
if (this._cacheMode === u.REALTIME) {
this._displayProxy = this._factory.buildArmatureDisplay(this.armatureName, this._armatureKey, "", t);
if (!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._cacheMode !== u.REALTIME && this.debugBones && cc.warn("Debug bones is invalid in cached mode");
if (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) {
this.playTimes = void 0 === e ? -1 : e;
this.animationName = t;
if (this.isAnimationCached()) {
var i = this._armatureCache.getAnimationCache(this._armatureKey, t);
i || (i = this._armatureCache.initAnimationCache(this._armatureKey, t));
if (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 = h;
}), {
"../../cocos2d/core/components/CCRenderComponent": 160,
"../../cocos2d/core/event/event-target": 186,
"../../cocos2d/core/graphics/graphics": 202,
"../../cocos2d/core/renderer/render-flow": 272,
"./ArmatureCache": void 0,
"./AttachUtil": 386
} ],
386: [ (function(t, e) {
"use strict";
var i, n = (i = t("../../cocos2d/core/value-types/mat4")) && i.__esModule ? i : {
default: i
}, r = t("../../cocos2d/core/renderer/render-flow").FLAG_TRANSFORM, s = function() {}, o = function(t) {
Object.defineProperty(t, "_worldMatDirty", {
get: function() {
return !0;
},
set: function() {}
});
t._calculWorldMatrix = s;
t._mulMat = s;
}, a = new n.default(), c = 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");
if (!t || !t.isValid) {
t = new cc.Node("ATTACHED_NODE_TREE");
o(t);
this._armatureNode.addChild(t);
}
this._armatureDisplay.isAnimationCached() && this._armatureDisplay._frameCache && this._armatureDisplay._frameCache.enableCacheAttachedInfo();
this._attachedRootNode = t;
return t;
}
},
_buildBoneAttachedNode: function(t, e) {
var i = "ATTACHED_NODE:" + t.name, n = new cc.Node(i);
this._buildBoneRelation(n, t, e);
return n;
},
_buildBoneRelation: function(t, e, i) {
o(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 < r; n++) {
var s = e[n];
s && s.isValid && s.name === "ATTACHED_NODE:" + t && i.push(s);
}
return i;
},
_rebuildNodeArray: function() {
for (var t = this._boneIndexToNode = {}, e = this._attachedNodeArray, i = this._attachedNodeArray = [], n = 0, r = e.length; n < r; n++) {
var s = e[n];
if (s && s.isValid && !s._toRemove) {
i.push(s);
t[s._boneIndex] = s;
}
}
},
_sortNodeArray: function() {
this._attachedNodeArray.sort((function(t, e) {
return t._boneIndex < e._boneIndex ? -1 : 1;
}));
},
_getNodeByBoneIndex: function(t) {
var e = this._boneIndexToNode[t];
return e && e.isValid ? e : null;
},
destroyAttachedNodes: function(t) {
if (this._inited) {
for (var e = this._attachedNodeArray, i = function t(e) {
for (var i = e.children, n = 0, r = i.length; n < r; n++) {
var s = i[n];
s && t(s);
}
e._toRemove = !0;
}, n = 0, r = e.length; n < r; n++) {
var s = e[n];
if (s && s.isValid && s.name.split("ATTACHED_NODE:")[1] === t) {
i(s);
s.removeFromParent(!0);
s.destroy();
e[n] = null;
}
}
this._rebuildNodeArray();
}
},
generateAttachedNodes: function(t) {
var e = [];
if (!this._inited) return e;
var i = this._prepareAttachNode();
if (!i) return e;
var n = 0, r = [], s = function(e) {
if (e) {
for (var i, o = e.getBones(), a = 0, c = o.length; a < c; a++) {
(i = o[a])._boneIndex = n++;
t === i.name && r.push(i);
}
for (var l, u = e.getSlots(), h = 0, _ = u.length; h < _; h++) (l = u[h]).childArmature && s(l.childArmature);
}
}.bind(this);
s(this._armature);
for (var o = function(t) {
if (t) {
var e = this._getNodeByBoneIndex(t._boneIndex);
if (e) return e;
e = this._buildBoneAttachedNode(t, t._boneIndex);
var n = null;
t.armature.parent && (n = t.armature.parent.parent);
var r = o(t.parent || n) || i;
e.parent = r;
t.parent ? e._rootNode = r._rootNode : e._rootNode = r;
return e;
}
}.bind(this), a = 0, c = r.length; a < c; a++) {
var l = o(r[a]);
l && e.push(l);
}
this._sortNodeArray();
return e;
},
destroyAllAttachedNodes: function() {
this._attachedRootNode = null;
this._attachedNodeArray.length = 0;
this._boneIndexToNode = {};
if (this._inited) {
var t = this._armatureNode.getChildByName("ATTACHED_NODE_TREE");
if (t) {
t.removeFromParent(!0);
t.destroy();
t = null;
}
}
},
generateAllAttachedNodes: function() {
if (this._inited) {
this._boneIndexToNode = {};
this._attachedNodeArray.length = 0;
var t = this._prepareAttachNode();
if (t) {
var e = 0, i = function(n) {
if (n) {
var r = t;
n.parent && (r = n.parent.parent._attachedNode);
for (var s, o = n.getBones(), a = 0, c = o.length; a < c; a++) {
var l = e++;
(s = o[a])._attachedNode = null;
var u = null;
if (u = s.parent ? s.parent._attachedNode : r) {
var h = u.getChildByName("ATTACHED_NODE:" + s.name);
if (h && h.isValid) this._buildBoneRelation(h, s, l); else {
h = this._buildBoneAttachedNode(s, l);
u.addChild(h);
}
h._rootNode = r;
s._attachedNode = h;
}
}
for (var _, f = n.getSlots(), d = 0, p = f.length; d < p; d++) (_ = f[d]).childArmature && i(_.childArmature);
}
}.bind(this);
i(this._armature);
return t;
}
}
},
_hasAttachedNode: function() {
return !!this._inited && !!this._armatureNode.getChildByName("ATTACHED_NODE_TREE");
},
_associateAttachedNode: function() {
if (this._inited) {
var t = this._armatureNode.getChildByName("ATTACHED_NODE_TREE");
if (t && t.isValid) {
this._attachedRootNode = t;
this._boneIndexToNode = {};
this._attachedNodeArray.length = 0;
var e = this._armature;
if (e) {
o(t);
var i = 0, n = function(e) {
if (e) {
var r = t;
e.parent && (r = e.parent.parent._attachedNode);
for (var s, o = e.getBones(), a = 0, c = o.length; a < c; a++) {
var l = i++;
(s = o[a])._attachedNode = null;
var u = null;
if (u = s.parent ? s.parent._attachedNode : r) {
var h = u.getChildByName("ATTACHED_NODE:" + s.name);
if (h && h.isValid) {
this._buildBoneRelation(h, s, l);
h._rootNode = r;
s._attachedNode = h;
}
}
}
for (var _, f = e.getSlots(), d = 0, p = f.length; d < p; d++) (_ = f[d]).childArmature && n(_.childArmature);
}
}.bind(this);
n(e);
}
}
}
},
_syncAttachedNode: function() {
if (this._inited) {
var t = this._attachedRootNode, e = this._attachedNodeArray;
if (t && t.isValid) {
var i = this._armatureNode._worldMatrix;
n.default.copy(t._worldMatrix, i);
t._renderFlag &= ~r;
var s = null, o = this._armatureDisplay.isAnimationCached();
if (!o || (s = this._armatureDisplay._curFrame && this._armatureDisplay._curFrame.boneInfos)) {
for (var c = this._armatureNode._mulMat, l = function(t, e, i) {
var n = a.m;
n[0] = i.a;
n[1] = i.b;
n[4] = -i.c;
n[5] = -i.d;
n[12] = i.tx;
n[13] = i.ty;
c(t, e, a);
}, u = !1, h = 0, _ = e.length; h < _; h++) {
var f = e[h];
if (f && f.isValid) {
var d = o ? s[f._boneIndex] : f._bone;
if (d && !d._isInPool) {
l(f._worldMatrix, f._rootNode._worldMatrix, d.globalTransformMatrix);
f._renderFlag &= ~r;
} else {
f.removeFromParent(!0);
f.destroy();
e[h] = null;
u = !0;
}
} else {
e[h] = null;
u = !0;
}
}
u && this._rebuildNodeArray();
}
} else {
this._attachedRootNode = null;
e.length = 0;
}
}
}
});
e.exports = dragonBones.AttachUtil = c;
}), {
"../../cocos2d/core/renderer/render-flow": 272,
"../../cocos2d/core/value-types/mat4": 339
} ],
387: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "dragonBones.DragonBonesAsset",
extends: cc.Asset,
ctor: function() {
this.reset();
},
properties: {
_dragonBonesJson: "",
dragonBonesJson: {
get: function() {
return this._dragonBonesJson;
},
set: function(t) {
this._dragonBonesJson = t;
this._dragonBonesJsonData = JSON.parse(t);
this.reset();
}
},
_nativeAsset: {
get: function() {
return this._buffer;
},
set: function(t) {
this._buffer = t.buffer || t;
this.reset();
},
override: !0
}
},
statics: {
preventDeferredLoadDependents: !0
},
createNode: !1,
reset: function() {
this._clear();
},
init: function(t, e) {
this._factory = t;
!this._dragonBonesJsonData && this.dragonBonesJson && (this._dragonBonesJsonData = JSON.parse(this.dragonBonesJson));
var i;
i = this._dragonBonesJsonData ? this._dragonBonesJsonData : this._nativeAsset;
if (!this._uuid) {
var n = this._factory.getDragonBonesDataByRawData(i);
n ? this._uuid = n.name : cc.warn("dragonbones name is empty");
}
var r = this._uuid + "#" + e;
if (this._factory.getDragonBonesData(r)) return r;
this._factory.parseDragonBonesData(i, r);
return r;
},
getArmatureEnum: !1,
getAnimsEnum: !1,
_clear: function() {
if (this._factory) {
(!1).resetArmature(this._uuid);
this._factory.removeDragonBonesDataByUUID(this._uuid, !0);
}
},
destroy: function() {
this._clear();
this._super();
}
});
dragonBones.DragonBonesAsset = e.exports = i;
}), {
"./ArmatureCache": void 0
} ],
388: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "dragonBones.DragonBonesAtlasAsset",
extends: cc.Asset,
ctor: function() {
this._clear();
},
properties: {
_atlasJson: "",
atlasJson: {
get: function() {
return this._atlasJson;
},
set: function(t) {
this._atlasJson = t;
this._atlasJsonData = JSON.parse(this.atlasJson);
this._clear();
}
},
_texture: {
default: null,
type: cc.Texture2D,
formerlySerializedAs: "texture"
},
texture: {
get: function() {
return this._texture;
},
set: function(t) {
this._texture = t;
this._clear();
}
},
_textureAtlasData: null
},
statics: {
preventDeferredLoadDependents: !0
},
createNode: !1,
init: function(t) {
this._factory = t;
this._atlasJsonData || (this._atlasJsonData = JSON.parse(this.atlasJson));
var e = this._atlasJsonData;
this._uuid = this._uuid || e.name;
this._textureAtlasData ? t.addTextureAtlasData(this._textureAtlasData, this._uuid) : this._textureAtlasData = t.parseTextureAtlasData(e, this.texture, this._uuid);
},
_clear: function() {},
destroy: function() {
this._clear();
this._super();
}
});
dragonBones.DragonBonesAtlasAsset = e.exports = i;
}), {
"./ArmatureCache": void 0
} ],
389: [ (function(t) {
"use strict";
if (void 0 !== ("undefined" == typeof window ? global : window).dragonBones) {
dragonBones._timeScale = 1;
Object.defineProperty(dragonBones, "timeScale", {
get: function() {
return this._timeScale;
},
set: function(t) {
this._timeScale = t;
this.CCFactory.getInstance()._dragonBones.clock.timeScale = t;
},
configurable: !0
});
dragonBones.DisplayType = {
Image: 0,
Armature: 1,
Mesh: 2
};
dragonBones.ArmatureType = {
Armature: 0,
MovieClip: 1,
Stage: 2
};
dragonBones.ExtensionType = {
FFD: 0,
AdjustColor: 10,
BevelFilter: 11,
BlurFilter: 12,
DropShadowFilter: 13,
GlowFilter: 14,
GradientBevelFilter: 15,
GradientGlowFilter: 16
};
dragonBones.EventType = {
Frame: 0,
Sound: 1
};
dragonBones.ActionType = {
Play: 0,
Stop: 1,
GotoAndPlay: 2,
GotoAndStop: 3,
FadeIn: 4,
FadeOut: 5
};
dragonBones.AnimationFadeOutMode = {
None: 0,
SameLayer: 1,
SameGroup: 2,
SameLayerAndGroup: 3,
All: 4
};
dragonBones.BinaryOffset = {
WeigthBoneCount: 0,
WeigthFloatOffset: 1,
WeigthBoneIndices: 2,
MeshVertexCount: 0,
MeshTriangleCount: 1,
MeshFloatOffset: 2,
MeshWeightOffset: 3,
MeshVertexIndices: 4,
TimelineScale: 0,
TimelineOffset: 1,
TimelineKeyFrameCount: 2,
TimelineFrameValueCount: 3,
TimelineFrameValueOffset: 4,
TimelineFrameOffset: 5,
FramePosition: 0,
FrameTweenType: 1,
FrameTweenEasingOrCurveSampleCount: 2,
FrameCurveSamples: 3,
DeformMeshOffset: 0,
DeformCount: 1,
DeformValueCount: 2,
DeformValueOffset: 3,
DeformFloatOffset: 4
};
dragonBones.BoneType = {
Bone: 0,
Surface: 1
};
t("./DragonBonesAsset");
t("./DragonBonesAtlasAsset");
t("./ArmatureDisplay");
t("./webgl-assembler");
}
}), {
"./ArmatureCache": void 0,
"./ArmatureDisplay": 385,
"./CCArmatureDisplay": void 0,
"./CCFactory": void 0,
"./CCSlot": void 0,
"./CCTextureData": void 0,
"./DragonBonesAsset": 387,
"./DragonBonesAtlasAsset": 388,
"./lib/dragonBones": void 0,
"./webgl-assembler": 390
} ],
390: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n = s(t("../../cocos2d/core/renderer/assembler")), r = s(t("../../cocos2d/core/value-types/mat4"));
function s(t) {
return t && t.__esModule ? t : {
default: t
};
}
function o(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
a(t, e);
}
function a(t, e) {
return (a = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var c, l, u, h, _, f, d, p, m, y, v, g, b, C, x, A, S, T, w, E, M, B, I, D, P, R, L, O, V, N, F = t("./ArmatureDisplay"), z = t("../../cocos2d/core/renderer/render-flow"), k = cc.gfx, G = cc.color(255, 0, 0, 255), U = cc.color(0, 0, 255, 255), H = cc.color(0, 255, 0, 255);
function j(t, e) {
if (!t) return null;
var i, n;
switch (e) {
case 1:
i = _ ? cc.macro.ONE : cc.macro.SRC_ALPHA;
n = cc.macro.ONE;
break;

case 10:
i = cc.macro.DST_COLOR;
n = cc.macro.ONE_MINUS_SRC_ALPHA;
break;

case 12:
i = cc.macro.ONE;
n = cc.macro.ONE_MINUS_SRC_COLOR;
break;

case 0:
default:
i = _ ? cc.macro.ONE : cc.macro.SRC_ALPHA;
n = cc.macro.ONE_MINUS_SRC_ALPHA;
}
var r = !v.enableBatch, s = v._materials[0];
if (!s) return null;
var o = v._materialCache, a = t.getId() + i + n + r, c = o[a];
if (!c) {
if (o.baseMaterial) c = cc.MaterialVariant.create(s); else {
c = s;
o.baseMaterial = s;
}
c.define("CC_USE_MODEL", r);
c.setProperty("texture", t);
c.setBlend(!0, k.BLEND_FUNC_ADD, i, n, k.BLEND_FUNC_ADD, i, n);
o[a] = c;
}
return c;
}
function W(t, e) {
I = t.a * e * h;
f = _ ? I / 255 : 1;
E = t.r * c * f;
M = t.g * l * f;
B = t.b * u * f;
w = (I << 24 >>> 0) + (B << 16) + (M << 8) + E;
}
var q = (function(t) {
o(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.updateRenderData = function() {};
i.realTimeTraverse = function(t, e, i) {
for (var n, s, o, a, c, l, u, h, _, f, v = t._slots, E = 0, M = v.length; E < M; E++) {
u = (h = v[E])._color;
if (h._visible && h._displayData) {
e ? h._mulMat(h._worldMatrix, e, h._matrix) : r.default.copy(h._worldMatrix, h._matrix);
if (h.childArmature) this.realTimeTraverse(h.childArmature, h._worldMatrix, i * u.a / 255); else if (a = j(h.getTexture(), h._blendMode)) {
if (d || a.getHash() !== y.material.getHash()) {
d = !1;
y._flush();
y.node = m;
y.material = a;
}
W(u, i);
_ = h._worldMatrix.m;
c = h._localVertices;
x = c.length >> 2;
l = h._indices;
A = l.length;
f = p.request(x, A);
b = f.indiceOffset;
g = f.byteOffset >> 2;
C = f.vertexOffset;
n = p._vData;
s = p._iData;
o = p._uintVData;
P = _[0];
R = _[4];
L = _[12];
O = _[1];
V = _[5];
N = _[13];
for (var B = 0, I = c.length; B < I; ) {
S = c[B++];
T = c[B++];
n[g++] = S * P + T * R + L;
n[g++] = S * O + T * V + N;
n[g++] = c[B++];
n[g++] = c[B++];
o[g++] = w;
}
for (var D = 0, F = l.length; D < F; D++) s[b++] = C + l[D];
}
}
}
};
i.cacheTraverse = function(t, e) {
if (t) {
var i = t.segments;
if (0 != i.length) {
var n, r, s, o, a, c = t.vertices, l = t.indices, u = 0, h = 0, _ = 0;
if (e) {
var f = e.m;
P = f[0];
O = f[1];
R = f[4];
V = f[5];
L = f[12];
N = f[13];
}
var v = 16 & D, E = v && 1 === P && 0 === O && 0 === R && 1 === V, M = 0, B = t.colors, I = B[M++], F = I.vfOffset;
W(I, 1);
for (var z = 0, k = i.length; z < k; z++) {
var G = i[z];
o = j(G.tex, G.blendMode);
if (d || o.getHash() !== y.material.getHash()) {
d = !1;
y._flush();
y.node = m;
y.material = o;
}
x = G.vertexCount;
A = G.indexCount;
a = p.request(x, A);
b = a.indiceOffset;
C = a.vertexOffset;
g = a.byteOffset >> 2;
n = p._vData;
r = p._iData;
s = p._uintVData;
for (var U = b, H = b + A; U < H; U++) r[U] = C + l[h++];
_ = G.vfCount;
n.set(c.subarray(u, u + _), g);
u += _;
if (E) for (var q = g, X = g + _; q < X; q += 5) {
n[q] += L;
n[q + 1] += N;
} else if (v) for (var Y = g, J = g + _; Y < J; Y += 5) {
S = n[Y];
T = n[Y + 1];
n[Y] = S * P + T * R + L;
n[Y + 1] = S * O + T * V + N;
}
if (1 & D) for (var Z = u - _, K = g + 4, Q = g + 4 + _; K < Q; K += 5, Z += 5) {
if (Z >= F) {
W(I = B[M++], 1);
F = I.vfOffset;
}
s[K] = w;
}
}
}
}
};
i.fillBuffers = function(t, e) {
t.node._renderFlag |= z.FLAG_UPDATE_RENDER_DATA;
var i = t._armature;
if (i) {
d = !0;
_ = t.premultipliedAlpha;
m = t.node;
p = e._meshBuffer;
y = e;
v = t;
D = 0;
var n = m._color;
c = n.r / 255;
l = n.g / 255;
u = n.b / 255;
h = n.a / 255;
4294967295 !== n._val && (D |= 1);
var r = void 0;
if (v.enableBatch) {
r = m._worldMatrix;
d = !1;
D |= 16;
}
if (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 = U;
for (var o = i.getBones(), a = 0, f = o.length; a < f; a++) {
var g = o[a], b = Math.max(g.boneData.length, 5), C = g.globalTransformMatrix.tx, x = g.globalTransformMatrix.ty, A = C + g.globalTransformMatrix.a * b, S = x + g.globalTransformMatrix.b * b;
s.moveTo(C, x);
s.lineTo(A, S);
s.stroke();
s.circle(C, x, 2 * Math.PI);
s.fill();
0 === a && (s.fillColor = H);
}
}
}
e.worldMatDirty++;
t.attachUtil._syncAttachedNode();
m = void 0;
p = void 0;
y = void 0;
v = void 0;
}
};
i.postFillBuffers = function(t, e) {
e.worldMatDirty--;
};
return e;
})(n.default);
i.default = q;
n.default.register(F, q);
e.exports = i.default;
}), {
"../../cocos2d/core/renderer/assembler": 268,
"../../cocos2d/core/renderer/render-flow": 272,
"../../cocos2d/core/value-types/mat4": 339,
"./ArmatureDisplay": 385
} ],
391: [ (function(t, e) {
"use strict";
var i, n = (i = t("../../cocos2d/core/value-types/mat4")) && i.__esModule ? i : {
default: i
}, r = t("../../cocos2d/core/renderer/render-flow").FLAG_TRANSFORM, s = function() {}, o = function(t) {
Object.defineProperty(t, "_worldMatDirty", {
get: function() {
return !0;
},
set: function() {}
});
t._calculWorldMatrix = s;
t._mulMat = s;
}, a = new n.default(), c = cc.Class({
name: "sp.AttachUtil",
ctor: function() {
this._inited = !1;
this._skeleton = null;
this._skeletonNode = null;
this._skeletonComp = null;
this._attachedRootNode = null;
this._attachedNodeArray = [];
this._boneIndexToNode = {};
},
init: function(t) {
this._inited = !0;
this._skeleton = t._skeleton;
this._skeletonNode = t.node;
this._skeletonComp = t;
},
reset: function() {
this._inited = !1;
this._skeleton = null;
this._skeletonNode = null;
this._skeletonComp = null;
},
_prepareAttachNode: function() {
if (this._skeleton) {
var t = this._skeletonNode.getChildByName("ATTACHED_NODE_TREE");
if (!t || !t.isValid) {
t = new cc.Node("ATTACHED_NODE_TREE");
o(t);
this._skeletonNode.addChild(t);
}
this._skeletonComp.isAnimationCached() && this._skeletonComp._frameCache && this._skeletonComp._frameCache.enableCacheAttachedInfo();
this._attachedRootNode = t;
return t;
}
},
_buildBoneAttachedNode: function(t, e) {
var i = "ATTACHED_NODE:" + t.data.name, n = new cc.Node(i);
this._buildBoneRelation(n, t, e);
return n;
},
_buildBoneRelation: function(t, e, i) {
o(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 < r; n++) {
var s = e[n];
s && s.isValid && s.name === "ATTACHED_NODE:" + t && i.push(s);
}
return i;
},
_rebuildNodeArray: function() {
for (var t = this._boneIndexToNode = {}, e = this._attachedNodeArray, i = this._attachedNodeArray = [], n = 0, r = e.length; n < r; n++) {
var s = e[n];
if (s && s.isValid && !s._toRemove) {
i.push(s);
t[s._boneIndex] = s;
}
}
},
_sortNodeArray: function() {
this._attachedNodeArray.sort((function(t, e) {
return t._boneIndex < e._boneIndex ? -1 : 1;
}));
},
_getNodeByBoneIndex: function(t) {
var e = this._boneIndexToNode[t];
return e && e.isValid ? e : null;
},
destroyAttachedNodes: function(t) {
if (this._inited) {
for (var e = this._attachedNodeArray, i = function t(e) {
for (var i = e.children, n = 0, r = i.length; n < r; n++) {
var s = i[n];
s && t(s);
}
e._toRemove = !0;
}, n = 0, r = e.length; n < r; n++) {
var s = e[n];
if (s && s.isValid && s.name.split("ATTACHED_NODE:")[1] === t) {
i(s);
s.removeFromParent(!0);
s.destroy();
e[n] = null;
}
}
this._rebuildNodeArray();
}
},
generateAttachedNodes: function(t) {
var e = [];
if (!this._inited) return e;
var i = this._prepareAttachNode();
if (!i) return e;
for (var n = [], r = this._skeleton.bones, s = 0, o = r.length; s < o; s++) {
var a = r[s];
a.data.name == t && n.push(a);
}
for (var c = function(t) {
if (t) {
var e = t.data, n = this._getNodeByBoneIndex(e.index);
if (n) return n;
n = this._buildBoneAttachedNode(t, e.index);
var r = c(t.parent) || i;
n.parent = r;
return n;
}
}.bind(this), l = 0, u = n.length; l < u; l++) {
var h = c(n[l]);
e.push(h);
}
this._sortNodeArray();
return e;
},
destroyAllAttachedNodes: function() {
this._attachedRootNode = null;
this._attachedNodeArray.length = 0;
this._boneIndexToNode = {};
if (this._inited) {
var t = this._skeletonNode.getChildByName("ATTACHED_NODE_TREE");
if (t) {
t.removeFromParent(!0);
t.destroy();
t = null;
}
}
},
generateAllAttachedNodes: function() {
if (this._inited) {
this._boneIndexToNode = {};
this._attachedNodeArray.length = 0;
var t = this._prepareAttachNode();
if (t) {
for (var e = this._skeleton.bones, i = 0, n = e.length; i < n; i++) {
var r = e[i], s = r.data, o = null;
if (r.parent) {
var a = r.parent.data.index;
o = this._boneIndexToNode[a];
} else o = t;
if (o) {
var c = o.getChildByName("ATTACHED_NODE:" + s.name);
if (c && c.isValid) this._buildBoneRelation(c, r, s.index); else {
c = this._buildBoneAttachedNode(r, s.index);
o.addChild(c);
}
}
}
return t;
}
}
},
_hasAttachedNode: function() {
return !!this._inited && !!this._skeletonNode.getChildByName("ATTACHED_NODE_TREE");
},
_associateAttachedNode: function() {
if (this._inited) {
var t = this._skeletonNode.getChildByName("ATTACHED_NODE_TREE");
if (t && t.isValid) {
this._attachedRootNode = t;
this._boneIndexToNode = {};
this._attachedNodeArray.length = 0;
o(t);
for (var e = this._skeleton.bones, i = 0, n = e.length; i < n; i++) {
var r = e[i], s = r.data, a = null;
if (r.parent) {
var c = r.parent.data.index;
a = this._boneIndexToNode[c];
} else a = t;
if (a) {
var l = a.getChildByName("ATTACHED_NODE:" + s.name);
l && l.isValid && this._buildBoneRelation(l, r, s.index);
}
}
}
}
},
_syncAttachedNode: function() {
if (this._inited) {
var t = this._attachedRootNode, e = this._attachedNodeArray;
if (t && t.isValid) {
var i = this._skeletonNode._worldMatrix;
n.default.copy(t._worldMatrix, i);
t._renderFlag &= ~r;
var s;
if (s = this._skeletonComp.isAnimationCached() ? this._skeletonComp._curFrame && this._skeletonComp._curFrame.boneInfos : this._skeleton.bones) {
for (var o = this._skeletonNode._mulMat, c = function(t, e, i) {
var n = a.m;
n[0] = i.a;
n[1] = i.c;
n[4] = i.b;
n[5] = i.d;
n[12] = i.worldX;
n[13] = i.worldY;
o(t, e, a);
}, l = !1, u = 0, h = e.length; u < h; u++) {
var _ = e[u];
if (_ && _.isValid) {
var f = s[_._boneIndex];
if (f) {
c(_._worldMatrix, t._worldMatrix, f);
_._renderFlag &= ~r;
} else {
_.removeFromParent(!0);
_.destroy();
e[u] = null;
l = !0;
}
} else {
e[u] = null;
l = !0;
}
}
l && this._rebuildNodeArray();
}
} else {
this._attachedRootNode = null;
e.length = 0;
}
}
}
});
e.exports = sp.AttachUtil = c;
}), {
"../../cocos2d/core/renderer/render-flow": 272,
"../../cocos2d/core/value-types/mat4": 339
} ],
392: [ (function(t, e) {
"use strict";
var i = t("./track-entry-listeners"), n = t("../../cocos2d/core/components/CCRenderComponent"), r = t("./lib/spine"), s = t("../../cocos2d/core/graphics/graphics"), o = t("../../cocos2d/core/renderer/render-flow").FLAG_POST_RENDER, a = t("./skeleton-cache"), c = t("./AttachUtil"), l = cc.Enum({
default: -1
}), u = cc.Enum({
"<None>": 0
}), h = cc.Enum({
REALTIME: 0,
SHARED_CACHE: 1,
PRIVATE_CACHE: 2
});
sp.Skeleton = cc.Class({
name: "sp.Skeleton",
extends: n,
editor: !1,
statics: {
AnimationCacheMode: h
},
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;
if (t) this.setAnimation(0, t, this.loop); else if (!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)) {
this._defaultSkinIndex = 0;
return 0;
}
} else {
var e = t[this.defaultSkin];
if (void 0 !== e) return e;
}
}
return 0;
},
set: function(t) {
var e;
this.skeletonData && (e = this.skeletonData.getSkinsEnum());
if (!e) return cc.errorID("", this.name);
var i = e[t];
if (void 0 !== i) {
this.defaultSkin = i;
this.setSkin(this.defaultSkin);
} else cc.errorID(7501, this.name);
},
type: l,
visible: !0,
animatable: !1,
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;
this.skeletonData && (e = this.skeletonData.getAnimsEnum());
if (!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,
animatable: !1,
displayName: "Animation",
tooltip: !1
},
_preCacheMode: -1,
_cacheMode: h.REALTIME,
_defaultCacheMode: {
default: 0,
type: h,
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 c();
},
_getDefaultMaterial: function() {
return cc.Material.getBuiltinMaterial("2d-spine");
},
_updateMaterial: function() {
var t = this.useTint || this.isAnimationCached() && !1, e = this.getMaterial(0);
if (e) {
e.define("USE_TINT", t);
e.define("CC_USE_MODEL", !this.enableBatch);
var i = this.premultipliedAlpha ? cc.gfx.BLEND_ONE : cc.gfx.BLEND_SRC_ALPHA, n = cc.gfx.BLEND_ONE_MINUS_SRC_ALPHA;
e.setBlend(!0, cc.gfx.BLEND_FUNC_ADD, i, i, cc.gfx.BLEND_FUNC_ADD, n, n);
}
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() && !1;
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) {
null != t.width && null != t.height && this.node.setContentSize(t.width, t.height);
if (this._cacheMode === h.SHARED_CACHE) this._skeletonCache = a.sharedCache; else if (this._cacheMode === h.PRIVATE_CACHE) {
this._skeletonCache = new a();
this._skeletonCache.enablePrivateMode();
}
if (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 r.Skeleton(t);
this._clipper = new r.SkeletonClipping();
this._rootBone = this._skeleton.getRootBone();
}
this.markForRender(!0);
},
setSlotsRange: function(t, e) {
if (this.isAnimationCached()) cc.warn("Slots visible range can not be modified in cached mode."); else {
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 r.AnimationState(t);
if (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; e < i; e++) {
var n = t[e];
n && "DEBUG_DRAW_NODE" === n._name && n.destroy();
}
this._updateSkeletonData();
this._updateDebugDraw();
this._updateUseTint();
this._updateBatch();
},
setAnimationCacheMode: function(t) {
if (this._preCacheMode !== t) {
this._cacheMode = t;
this._updateSkeletonData();
this._updateUseTint();
}
},
isAnimationCached: function() {
return this._cacheMode !== h.REALTIME;
},
update: function(t) {
if (!this.paused) {
t *= this.timeScale * sp.timeScale;
if (this.isAnimationCached()) {
if (this._isAniComplete) {
if (0 === this._animationQueue.length && !this._headAniInfo) {
var e = this._frameCache;
if (e && e.isInvalid()) {
e.updateToFrame();
var i = e.frames;
this._curFrame = i[i.length - 1];
}
return;
}
this._headAniInfo || (this._headAniInfo = this._animationQueue.shift());
this._accTime += t;
if (this._accTime > this._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() {
if (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 = a.FrameTime;
if (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);
e.isCompleted || e.updateToFrame(r);
if (e.isCompleted && r >= i.length) {
this._playCount++;
if (this._playTimes > 0 && this._playCount >= this._playTimes) {
this._curFrame = i[i.length - 1];
this._accTime = 0;
this._playCount = 0;
this._isAniComplete = !0;
this._emitCacheCompleteEvent();
return;
}
this._accTime = 0;
r = 0;
this._emitCacheCompleteEvent();
}
this._curFrame = i[r];
}
},
_updateRealtime: function(t) {
var e = this._skeleton, i = this._state;
if (e) {
e.update(t);
if (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) {
if (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) {
this._playTimes = i ? 0 : 1;
this._animationName = e;
if (this.isAnimationCached()) {
0 !== t && cc.warn("Track index can not greater than 0 in cached mode.");
if (!this._skeletonCache) return null;
var n = this._skeletonCache.getAnimationCache(this.skeletonData._uuid, e);
n || (n = this._skeletonCache.initAnimationCache(this.skeletonData._uuid, e));
if (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) {
cc.logID(7509, e);
return null;
}
var s = this._state.setAnimationWith(t, r, i);
this._state.apply(this._skeleton);
return s;
}
return null;
},
addAnimation: function(t, e, i, n) {
n = n || 0;
if (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);
if (!r) {
cc.logID(7510, e);
return null;
}
return this._state.addAnimationWith(t, r, i, n);
}
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) {
i.getListeners(t).start = e;
},
setTrackInterruptListener: function(t, e) {
i.getListeners(t).interrupt = e;
},
setTrackEndListener: function(t, e) {
i.getListeners(t).end = e;
},
setTrackDisposeListener: function(t, e) {
i.getListeners(t).dispose = e;
},
setTrackCompleteListener: function(t, e) {
i.getListeners(t).complete = function(t) {
var i = Math.floor(t.trackTime / t.animationEnd);
e(t, i);
};
},
setTrackEventListener: function(t, e) {
i.getListeners(t).event = e;
},
getState: function() {
return this._state;
},
_updateAnimEnum: !1,
_updateSkinEnum: !1,
_ensureListener: function() {
if (!this._listener) {
this._listener = new i();
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 r.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(s);
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": 160,
"../../cocos2d/core/graphics/graphics": 202,
"../../cocos2d/core/renderer/render-flow": 272,
"./AttachUtil": 391,
"./lib/spine": void 0,
"./skeleton-cache": void 0,
"./track-entry-listeners": 397
} ],
393: [ (function(t) {
"use strict";
var e = "undefined" == typeof window ? global : window, i = !0;
e.spine || (i = !1);
if (i) {
e.sp = e.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 = e.spine;
t("./skeleton-data");
t("./vertex-effect-delegate");
t("./Skeleton");
t("./spine-assembler");
}
}), {
"./Skeleton": 392,
"./lib/spine": void 0,
"./skeleton-data": 394,
"./skeleton-texture": 395,
"./spine-assembler": 396,
"./vertex-effect-delegate": void 0
} ],
394: [ (function(t, e) {
"use strict";
var i = cc.Class({
name: "sp.SkeletonData",
extends: cc.Asset,
ctor: function() {
this.reset();
},
properties: {
_skeletonJson: null,
skeletonJsonStr: {
get: function() {
return this._skeletonJson ? JSON.stringify(this._skeletonJson) : "";
}
},
skeletonJson: {
get: function() {
return this._skeletonJson;
},
set: function(t) {
this.reset();
this._skeletonJson = "string" == typeof t ? JSON.parse(t) : t;
!this._uuid && t.skeleton && (this._uuid = t.skeleton.hash);
}
},
_atlasText: "",
atlasText: {
get: function() {
return this._atlasText;
},
set: function(t) {
this._atlasText = t;
this.reset();
}
},
textures: {
default: [],
type: [ cc.Texture2D ]
},
textureNames: {
default: [],
type: [ cc.String ]
},
scale: 1,
_nativeAsset: {
get: function() {
return this._buffer;
},
set: function(t) {
this._buffer = t.buffer || t;
this.reset();
},
override: !0
}
},
statics: {
preventDeferredLoadDependents: !0
},
createNode: !1,
reset: function() {
this._skeletonCache = null;
this._atlasCache = null;
},
ensureTexturesLoaded: function(t, e) {
var i = this.textures, n = i.length;
if (0 != n) for (var r = 0, s = function() {
if (++r >= n) {
t && t.call(e, !0);
t = null;
}
}, o = 0; o < n; o++) {
var a = i[o];
a.loaded ? s() : a.once("load", s);
} else t.call(e, !1);
},
isTexturesLoaded: function() {
for (var t = this.textures, e = t.length, i = 0; i < e; i++) if (!t[i].loaded) return !1;
return !0;
},
getRuntimeData: function(t) {
if (this._skeletonCache) return this._skeletonCache;
if (!(this.textures && this.textures.length > 0) && this.textureNames && this.textureNames.length > 0) {
t || cc.errorID(7507, this.name);
return null;
}
var e = this._getAtlas(t);
if (!e) return null;
var i = new sp.spine.AtlasAttachmentLoader(e), n = null, r = null;
if (this.skeletonJson) {
r = new sp.spine.SkeletonJson(i);
n = this.skeletonJson;
} else {
r = new sp.spine.SkeletonBinary(i);
n = new Uint8Array(this._nativeAsset);
}
r.scale = this.scale;
this._skeletonCache = r.readSkeletonData(n);
e.dispose();
return this._skeletonCache;
},
getSkinsEnum: !1,
getAnimsEnum: !1,
_getTexture: function(t) {
for (var e = this.textureNames, i = 0; i < e.length; i++) if (e[i] === t) {
var n = this.textures[i], r = new sp.SkeletonTexture({
width: n.width,
height: n.height
});
r.setRealTexture(n);
return r;
}
cc.errorID(7506, t);
return null;
},
_getAtlas: function(t) {
if (this._atlasCache) return this._atlasCache;
if (!this.atlasText) {
t || cc.errorID(7508, this.name);
return null;
}
return this._atlasCache = new sp.spine.TextureAtlas(this.atlasText, this._getTexture.bind(this));
},
destroy: function() {
(!1).removeSkeleton(this._uuid);
this._super();
}
});
sp.SkeletonData = e.exports = i;
}), {
"./skeleton-cache": void 0
} ],
395: [ (function() {
"use strict";
sp.SkeletonTexture = cc.Class({
name: "sp.SkeletonTexture",
extends: sp.spine.Texture,
_texture: null,
_material: null,
setRealTexture: function(t) {
this._texture = t;
},
getRealTexture: function() {
return this._texture;
},
setFilters: function(t, e) {
this._texture && this._texture.setFilters(t, e);
},
setWraps: function(t, e) {
this._texture && this._texture.setWrapMode(t, e);
},
dispose: function() {}
});
}), {} ],
396: [ (function(t, e, i) {
"use strict";
i.__esModule = !0;
i.default = void 0;
var n, r = (n = t("../../cocos2d/core/renderer/assembler")) && n.__esModule ? n : {
default: n
};
function s(t, e) {
t.prototype = Object.create(e.prototype);
t.prototype.constructor = t;
o(t, e);
}
function o(t, e) {
return (o = Object.setPrototypeOf || function(t, e) {
t.__proto__ = e;
return t;
})(t, e);
}
var a, c, l, u, h, _, f, d, p, m, y, v, g, b, C, x, A, S, T, w, E, M, B, I, D, P, R, L, O, V, N, F, z, k, G, U, H, j, W, q, X, Y, J, Z, K, Q, $ = t("./Skeleton"), tt = t("./lib/spine"), et = t("../../cocos2d/core/renderer/render-flow"), it = t("../../cocos2d/core/renderer/webgl/vertex-format"), nt = it.vfmtPosUvColor, rt = it.vfmtPosUvTwoColor, st = cc.gfx, ot = 0, at = [ 0, 1, 2, 2, 3, 0 ], ct = cc.color(0, 0, 255, 255), lt = cc.color(255, 0, 0, 255), ut = cc.color(0, 255, 0, 255), ht = cc.color(255, 255, 0, 255), _t = 0, ft = 0, dt = 0, pt = 0, mt = 0, yt = 0, vt = 0;
function gt(t, e) {
var i, n;
switch (e) {
case tt.BlendMode.Additive:
i = a ? cc.macro.ONE : cc.macro.SRC_ALPHA;
n = cc.macro.ONE;
break;

case tt.BlendMode.Multiply:
i = cc.macro.DST_COLOR;
n = cc.macro.ONE_MINUS_SRC_ALPHA;
break;

case tt.BlendMode.Screen:
i = cc.macro.ONE;
n = cc.macro.ONE_MINUS_SRC_COLOR;
break;

case tt.BlendMode.Normal:
default:
i = a ? cc.macro.ONE : cc.macro.SRC_ALPHA;
n = cc.macro.ONE_MINUS_SRC_ALPHA;
}
var r = !X.enableBatch, s = X._materials[0];
if (!s) return null;
var o = t.getId() + i + n + h + r, c = X._materialCache, l = c[o];
if (!l) {
if (c.baseMaterial) l = cc.MaterialVariant.create(s); else {
l = s;
c.baseMaterial = s;
}
l.define("CC_USE_MODEL", r);
l.define("USE_TINT", h);
l.setProperty("texture", t);
l.setBlend(!0, st.BLEND_FUNC_ADD, i, n, st.BLEND_FUNC_ADD, i, n);
c[o] = l;
}
return l;
}
function bt(t) {
H = t.fa * v;
N = p * (c = a ? H / 255 : 1);
F = m * c;
z = y * c;
k = t.fr * N;
G = t.fg * F;
U = t.fb * z;
g = (H << 24 >>> 0) + (U << 16) + (G << 8) + k;
j = t.dr * N;
W = t.dg * F;
q = t.db * z;
b = ((a ? 255 : 0) << 24 >>> 0) + (q << 16) + (W << 8) + j;
}
function Ct(t) {
return (t.a << 24 >>> 0) + (t.b << 16) + (t.g << 8) + t.r;
}
var xt = (function(t) {
s(e, t);
function e() {
return t.apply(this, arguments) || this;
}
var i = e.prototype;
i.updateRenderData = function(t) {
if (!t.isAnimationCached()) {
var e = t._skeleton;
e && e.updateWorldTransform();
}
};
i.fillVertices = function(t, e, i, n, r) {
var s, o = Y._vData, l = Y._iData, u = Y._uintVData;
null.a = i.a * e.a * t.a * v * 255;
c = a ? null.a : 255;
S = p * e.r * t.r * c;
T = m * e.g * t.g * c;
w = y * e.b * t.b * c;
null.r = S * i.r;
null.g = T * i.g;
null.b = w * i.b;
if (null == r.darkColor) null.set(0, 0, 0, 1); else {
null.r = r.darkColor.r * S;
null.g = r.darkColor.g * T;
null.b = r.darkColor.b * w;
}
null.a = a ? 255 : 0;
if (n.isClipping()) {
var _ = o.subarray(dt + 2);
n.clipTriangles(o.subarray(dt), _t, l.subarray(yt), mt, _, null, null, h, x);
var f = new Float32Array(n.clippedVertices), d = n.clippedTriangles;
mt = d.length;
_t = f.length / A * x;
s = Y.request(_t / x, mt);
yt = s.indiceOffset, pt = s.vertexOffset, dt = s.byteOffset >> 2;
o = Y._vData, l = Y._iData;
u = Y._uintVData;
l.set(d, yt);
if (Q) for (var C = 0, E = f.length, M = dt; C < E; C += A, M += x) {
null.x = f[C];
null.y = f[C + 1];
null.set(f[C + 2], f[C + 3], f[C + 4], f[C + 5]);
null.x = f[C + 6];
null.y = f[C + 7];
h ? null.set(f[C + 8], f[C + 9], f[C + 10], f[C + 11]) : null.set(0, 0, 0, 0);
Q.transform(null, null, null, null);
o[M] = null.x;
o[M + 1] = null.y;
o[M + 2] = null.x;
o[M + 3] = null.y;
u[M + 4] = Ct(null);
h && (u[M + 5] = Ct(null));
} else for (var B = 0, I = f.length, D = dt; B < I; B += A, D += x) {
o[D] = f[B];
o[D + 1] = f[B + 1];
o[D + 2] = f[B + 6];
o[D + 3] = f[B + 7];
g = (f[B + 5] << 24 >>> 0) + (f[B + 4] << 16) + (f[B + 3] << 8) + f[B + 2];
u[D + 4] = g;
if (h) {
b = (f[B + 11] << 24 >>> 0) + (f[B + 10] << 16) + (f[B + 9] << 8) + f[B + 8];
u[D + 5] = b;
}
}
} else if (Q) for (var P = dt, R = dt + _t; P < R; P += x) {
null.x = o[P];
null.y = o[P + 1];
null.x = o[P + 2];
null.y = o[P + 3];
Q.transform(null, null, null, null);
o[P] = null.x;
o[P + 1] = null.y;
o[P + 2] = null.x;
o[P + 3] = null.y;
u[P + 4] = Ct(null);
h && (u[P + 5] = Ct(null));
} else {
g = Ct(null);
b = Ct(null);
for (var L = dt, O = dt + _t; L < O; L += x) {
u[L + 4] = g;
h && (u[L + 5] = b);
}
}
};
i.realTimeTraverse = function(t) {
var e, i, n, r, s, o, a, c, p, m, y, v, g = X._skeleton, b = g.color, C = X._debugRenderer, S = X._clipper, T = null;
l = X._startSlotIndex;
u = X._endSlotIndex;
E = !1;
-1 == l && (E = !0);
_ = X.debugSlots;
f = X.debugBones;
d = X.debugMesh;
if (C && (f || _ || d)) {
C.clear();
C.lineWidth = 2;
}
A = h ? 12 : 8;
_t = 0;
dt = 0;
pt = 0;
mt = 0;
yt = 0;
for (var w = 0, N = g.drawOrder.length; w < N; w++) if (null != (y = g.drawOrder[w])) {
l >= 0 && l == y.data.index && (E = !0);
if (E) {
u >= 0 && u == y.data.index && (E = !1);
_t = 0;
mt = 0;
if (n = y.getAttachment()) {
c = n instanceof tt.RegionAttachment;
p = n instanceof tt.MeshAttachment;
if (n instanceof tt.ClippingAttachment) S.clipStart(y, n); else if (c || p) if (T = gt(n.region.texture._texture, y.data.blendMode)) {
if (M || T.getHash() !== J.material.getHash()) {
M = !1;
J._flush();
J.node = Z;
J.material = T;
}
if (c) {
a = at;
_t = 4 * x;
mt = 6;
m = Y.request(4, 6);
yt = m.indiceOffset, pt = m.vertexOffset, dt = m.byteOffset >> 2;
e = Y._vData, i = Y._iData;
n.computeWorldVertices(y.bone, e, dt, x);
if (C && _) {
C.strokeColor = ct;
C.moveTo(e[dt], e[dt + 1]);
for (var F = dt + x, z = dt + _t; F < z; F += x) C.lineTo(e[F], e[F + 1]);
C.close();
C.stroke();
}
} else if (p) {
a = n.triangles;
_t = (n.worldVerticesLength >> 1) * x;
mt = a.length;
m = Y.request(_t / x, mt);
yt = m.indiceOffset, pt = m.vertexOffset, dt = m.byteOffset >> 2;
e = Y._vData, i = Y._iData;
n.computeWorldVertices(y, 0, n.worldVerticesLength, e, dt, x);
if (C && d) {
C.strokeColor = ht;
for (var k = 0, G = a.length; k < G; k += 3) {
var U = a[k] * x + dt, H = a[k + 1] * x + dt, j = a[k + 2] * x + dt;
C.moveTo(e[U], e[U + 1]);
C.lineTo(e[H], e[H + 1]);
C.lineTo(e[j], e[j + 1]);
C.close();
C.stroke();
}
}
}
if (0 != _t && 0 != mt) {
i.set(a, yt);
o = n.uvs;
for (var W = dt, q = dt + _t, K = 0; W < q; W += x, K += 2) {
e[W + 2] = o[K];
e[W + 3] = o[K + 1];
}
r = n.color, s = y.color;
this.fillVertices(b, r, s, S, y);
e = Y._vData, i = Y._iData;
if (mt > 0) {
for (var Q = yt, $ = yt + mt; Q < $; Q++) i[Q] += pt;
if (t) {
v = t.m;
D = v[0];
P = v[4];
R = v[12];
L = v[1];
O = v[5];
V = v[13];
for (var et = dt, it = dt + _t; et < it; et += x) {
B = e[et];
I = e[et + 1];
e[et] = B * D + I * P + R;
e[et + 1] = B * L + I * O + V;
}
}
Y.adjust(_t / x, mt);
}
S.clipEndWithSlot(y);
} else S.clipEndWithSlot(y);
} else S.clipEndWithSlot(y); else S.clipEndWithSlot(y);
} else S.clipEndWithSlot(y);
} else S.clipEndWithSlot(y);
}
S.clipEnd();
if (C && f) {
var nt;
C.strokeColor = lt;
C.fillColor = ct;
for (var rt = 0, st = g.bones.length; rt < st; rt++) {
var ot = (nt = g.bones[rt]).data.length * nt.a + nt.worldX, ft = nt.data.length * nt.c + nt.worldY;
C.moveTo(nt.worldX, nt.worldY);
C.lineTo(ot, ft);
C.stroke();
C.circle(nt.worldX, nt.worldY, 1.5 * Math.PI);
C.fill();
0 === rt && (C.fillColor = ut);
}
}
};
i.cacheTraverse = function(t) {
var e = X._curFrame;
if (e) {
var i = e.segments;
if (0 != i.length) {
var n, r, s, o, a, c, l = e.vertices, u = e.indices, h = 0, _ = 0, f = 0;
if (t) {
c = t.m;
D = c[0];
L = c[1];
P = c[4];
O = c[5];
R = c[12];
V = c[13];
}
var d = 16 & ot, p = d && 1 === D && 0 === L && 0 === P && 1 === O, m = 0, y = e.colors, v = y[m++], C = v.vfOffset;
bt(v);
for (var x = 0, A = i.length; x < A; x++) {
var S = i[x];
if (o = gt(S.tex, S.blendMode)) {
if (M || o.getHash() !== J.material.getHash()) {
M = !1;
J._flush();
J.node = Z;
J.material = o;
}
ft = S.vertexCount;
mt = S.indexCount;
a = Y.request(ft, mt);
yt = a.indiceOffset;
pt = a.vertexOffset;
vt = a.byteOffset >> 2;
n = Y._vData;
r = Y._iData;
s = Y._uintVData;
for (var T = yt, w = yt + mt; T < w; T++) r[T] = pt + u[_++];
f = S.vfCount;
n.set(l.subarray(h, h + f), vt);
h += f;
if (p) for (var E = vt, N = vt + f; E < N; E += 6) {
n[E] += R;
n[E + 1] += V;
} else if (d) for (var F = vt, z = vt + f; F < z; F += 6) {
B = n[F];
I = n[F + 1];
n[F] = B * D + I * P + R;
n[F + 1] = B * L + I * O + V;
}
Y.adjust(ft, mt);
if (K) for (var k = h - f, G = vt + 4, U = vt + 4 + f; G < U; G += 6, k += 6) {
if (k >= C) {
bt(v = y[m++]);
C = v.vfOffset;
}
s[G] = g;
s[G + 1] = b;
}
}
}
}
}
};
i.fillBuffers = function(t, e) {
var i = t.node;
i._renderFlag |= et.FLAG_UPDATE_RENDER_DATA;
if (t._skeleton) {
var n = i._color;
p = n.r / 255;
m = n.g / 255;
y = n.b / 255;
v = n.a / 255;
h = t.useTint || t.isAnimationCached();
C = h ? rt : nt;
x = h ? 6 : 5;
Z = t.node;
Y = e.getBuffer("spine", C);
J = e;
X = t;
M = !0;
a = t.premultipliedAlpha;
c = 1;
ot = 0;
K = !1;
Q = t._effectDelegate && t._effectDelegate._vertexEffect;
(4294967295 !== n._val || a) && (K = !0);
h && (ot |= 1);
var r = void 0;
if (X.enableBatch) {
r = Z._worldMatrix;
M = !1;
ot |= 16;
}
if (t.isAnimationCached()) this.cacheTraverse(r); else {
Q && Q.begin(t._skeleton);
this.realTimeTraverse(r);
Q && Q.end();
}
e.worldMatDirty++;
t.attachUtil._syncAttachedNode();
Z = void 0;
Y = void 0;
J = void 0;
X = void 0;
Q = null;
}
};
i.postFillBuffers = function(t, e) {
e.worldMatDirty--;
};
return e;
})(r.default);
i.default = xt;
r.default.register($, xt);
e.exports = i.default;
}), {
"../../cocos2d/core/renderer/assembler": 268,
"../../cocos2d/core/renderer/render-flow": 272,
"../../cocos2d/core/renderer/webgl/vertex-format": 311,
"./Skeleton": 392,
"./lib/spine": void 0
} ],
397: [ (function(t, e) {
"use strict";
var i = function() {
this.start = null;
this.end = null;
this.complete = null;
this.event = null;
this.interrupt = null;
this.dispose = null;
};
i.getListeners = function(t) {
t.listener || (t.listener = new i());
return t.listener;
};
e.exports = i;
}), {} ],
398: [ (function(t, e, i) {
"use strict";
n = function(t) {
function e(t, e) {
return void 0 !== t ? t : e;
}
var i = 1e37, n = 1e-5, r = n * n, s = 3.14159265359, o = 2, a = 8, c = .008, l = 2 / 180 * s, u = 2 * c, h = -1, _ = (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;
}
t.prototype.toString = function() {
return this.major + "." + this.minor + "." + this.revision;
};
return t;
})(), f = new _(2, 3, 2);
function d(t, e) {
for (var i = [], n = 0; n < t; ++n) i.push(e(n));
return i;
}
function p(t, e) {
void 0 === e && (e = 0);
for (var i = [], n = 0; n < t; ++n) i.push(e);
return i;
}
var m = Math.abs, y = Math.min, v = Math.max;
function g(t, e, i) {
return t < e ? e : t > i ? i : t;
}
var b = isFinite;
function C(t) {
return t * t;
}
function x(t) {
return 1 / Math.sqrt(t);
}
var A = Math.sqrt, S = Math.pow, T = Math.cos, w = Math.sin, E = Math.acos, M = Math.asin, B = Math.atan2, I = (function() {
function t(t, e) {
void 0 === t && (t = 0);
void 0 === e && (e = 0);
this.x = t;
this.y = e;
}
t.prototype.Clone = function() {
return new t(this.x, this.y);
};
t.prototype.SetZero = function() {
this.x = 0;
this.y = 0;
return this;
};
t.prototype.Set = function(t, e) {
this.x = t;
this.y = e;
return this;
};
t.prototype.Copy = function(t) {
this.x = t.x;
this.y = t.y;
return this;
};
t.prototype.SelfAdd = function(t) {
this.x += t.x;
this.y += t.y;
return this;
};
t.prototype.SelfAddXY = function(t, e) {
this.x += t;
this.y += e;
return this;
};
t.prototype.SelfSub = function(t) {
this.x -= t.x;
this.y -= t.y;
return this;
};
t.prototype.SelfSubXY = function(t, e) {
this.x -= t;
this.y -= e;
return this;
};
t.prototype.SelfMul = function(t) {
this.x *= t;
this.y *= t;
return this;
};
t.prototype.SelfMulAdd = function(t, e) {
this.x += t * e.x;
this.y += t * e.y;
return this;
};
t.prototype.SelfMulSub = function(t, e) {
this.x -= t * e.x;
this.y -= t * e.y;
return 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;
this.x = e * n - i * this.y;
this.y = i * n + e * this.y;
return this;
};
t.prototype.IsValid = function() {
return isFinite(this.x) && isFinite(this.y);
};
t.prototype.SelfCrossVS = function(t) {
var e = this.x;
this.x = t * this.y;
this.y = -t * e;
return this;
};
t.prototype.SelfCrossSV = function(t) {
var e = this.x;
this.x = -t * this.y;
this.y = t * e;
return this;
};
t.prototype.SelfMinV = function(t) {
this.x = y(this.x, t.x);
this.y = y(this.y, t.y);
return this;
};
t.prototype.SelfMaxV = function(t) {
this.x = v(this.x, t.x);
this.y = v(this.y, t.y);
return this;
};
t.prototype.SelfAbs = function() {
this.x = m(this.x);
this.y = m(this.y);
return this;
};
t.prototype.SelfNeg = function() {
this.x = -this.x;
this.y = -this.y;
return this;
};
t.prototype.SelfSkew = function() {
var t = this.x;
this.x = -this.y;
this.y = t;
return this;
};
t.MakeArray = function(e) {
return d(e, (function() {
return new t();
}));
};
t.AbsV = function(t, e) {
e.x = m(t.x);
e.y = m(t.y);
return e;
};
t.MinV = function(t, e, i) {
i.x = y(t.x, e.x);
i.y = y(t.y, e.y);
return i;
};
t.MaxV = function(t, e, i) {
i.x = v(t.x, e.x);
i.y = v(t.y, e.y);
return i;
};
t.ClampV = function(t, e, i, n) {
n.x = g(t.x, e.x, i.x);
n.y = g(t.y, e.y, i.y);
return n;
};
t.RotateV = function(t, e, i) {
var n = t.x, r = t.y, s = Math.cos(e), o = Math.sin(e);
i.x = s * n - o * r;
i.y = o * n + s * r;
return 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;
i.x = e * t.y;
i.y = -e * n;
return i;
};
t.CrossVOne = function(t, e) {
var i = t.x;
e.x = t.y;
e.y = -i;
return e;
};
t.CrossSV = function(t, e, i) {
var n = e.x;
i.x = -t * e.y;
i.y = t * n;
return i;
};
t.CrossOneV = function(t, e) {
var i = t.x;
e.x = -t.y;
e.y = i;
return e;
};
t.AddVV = function(t, e, i) {
i.x = t.x + e.x;
i.y = t.y + e.y;
return i;
};
t.SubVV = function(t, e, i) {
i.x = t.x - e.x;
i.y = t.y - e.y;
return i;
};
t.MulSV = function(t, e, i) {
i.x = e.x * t;
i.y = e.y * t;
return i;
};
t.MulVS = function(t, e, i) {
i.x = t.x * e;
i.y = t.y * e;
return i;
};
t.AddVMulSV = function(t, e, i, n) {
n.x = t.x + e * i.x;
n.y = t.y + e * i.y;
return n;
};
t.SubVMulSV = function(t, e, i, n) {
n.x = t.x - e * i.x;
n.y = t.y - e * i.y;
return n;
};
t.AddVCrossSV = function(t, e, i, n) {
var r = i.x;
n.x = t.x - e * i.y;
n.y = t.y + e * r;
return n;
};
t.MidVV = function(t, e, i) {
i.x = .5 * (t.x + e.x);
i.y = .5 * (t.y + e.y);
return i;
};
t.ExtVV = function(t, e, i) {
i.x = .5 * (e.x - t.x);
i.y = .5 * (e.y - t.y);
return 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) {
e.x = -t.x;
e.y = -t.y;
return 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();
return t;
})(), D = new I(0, 0), P = (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;
}
t.prototype.Clone = function() {
return new t(this.x, this.y, this.z);
};
t.prototype.SetZero = function() {
this.x = 0;
this.y = 0;
this.z = 0;
return this;
};
t.prototype.SetXYZ = function(t, e, i) {
this.x = t;
this.y = e;
this.z = i;
return this;
};
t.prototype.Copy = function(t) {
this.x = t.x;
this.y = t.y;
this.z = t.z;
return this;
};
t.prototype.SelfNeg = function() {
this.x = -this.x;
this.y = -this.y;
this.z = -this.z;
return this;
};
t.prototype.SelfAdd = function(t) {
this.x += t.x;
this.y += t.y;
this.z += t.z;
return this;
};
t.prototype.SelfAddXYZ = function(t, e, i) {
this.x += t;
this.y += e;
this.z += i;
return this;
};
t.prototype.SelfSub = function(t) {
this.x -= t.x;
this.y -= t.y;
this.z -= t.z;
return this;
};
t.prototype.SelfSubXYZ = function(t, e, i) {
this.x -= t;
this.y -= e;
this.z -= i;
return this;
};
t.prototype.SelfMul = function(t) {
this.x *= t;
this.y *= t;
this.z *= t;
return 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, o = e.x, a = e.y, c = e.z;
i.x = r * c - s * a;
i.y = s * o - n * c;
i.z = n * a - r * o;
return i;
};
t.ZERO = new t(0, 0, 0);
t.s_t0 = new t();
return t;
})(), R = (function() {
function t() {
this.ex = new I(1, 0);
this.ey = new I(0, 1);
}
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) {
this.ex.Set(t, i);
this.ey.Set(e, n);
return this;
};
t.prototype.SetVV = function(t, e) {
this.ex.Copy(t);
this.ey.Copy(e);
return this;
};
t.prototype.SetAngle = function(t) {
var e = Math.cos(t), i = Math.sin(t);
this.ex.Set(e, i);
this.ey.Set(-i, e);
return this;
};
t.prototype.Copy = function(t) {
this.ex.Copy(t.ex);
this.ey.Copy(t.ey);
return this;
};
t.prototype.SetIdentity = function() {
this.ex.Set(1, 0);
this.ey.Set(0, 1);
return this;
};
t.prototype.SetZero = function() {
this.ex.SetZero();
this.ey.SetZero();
return 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;
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;
return t;
};
t.prototype.Solve = function(t, e, i) {
var n = this.ex.x, r = this.ey.x, s = this.ex.y, o = this.ey.y, a = n * o - r * s;
0 !== a && (a = 1 / a);
i.x = a * (o * t - r * e);
i.y = a * (n * e - s * t);
return i;
};
t.prototype.SelfAbs = function() {
this.ex.SelfAbs();
this.ey.SelfAbs();
return this;
};
t.prototype.SelfInv = function() {
this.GetInverse(this);
return this;
};
t.prototype.SelfAddM = function(t) {
this.ex.SelfAdd(t.ex);
this.ey.SelfAdd(t.ey);
return this;
};
t.prototype.SelfSubM = function(t) {
this.ex.SelfSub(t.ex);
this.ey.SelfSub(t.ey);
return this;
};
t.AbsM = function(t, e) {
var i = t.ex, n = t.ey;
e.ex.x = m(i.x);
e.ex.y = m(i.y);
e.ey.x = m(n.x);
e.ey.y = m(n.y);
return e;
};
t.MulMV = function(t, e, i) {
var n = t.ex, r = t.ey, s = e.x, o = e.y;
i.x = n.x * s + r.x * o;
i.y = n.y * s + r.y * o;
return i;
};
t.MulTMV = function(t, e, i) {
var n = t.ex, r = t.ey, s = e.x, o = e.y;
i.x = n.x * s + n.y * o;
i.y = r.x * s + r.y * o;
return i;
};
t.AddMM = function(t, e, i) {
var n = t.ex, r = t.ey, s = e.ex, o = e.ey;
i.ex.x = n.x + s.x;
i.ex.y = n.y + s.y;
i.ey.x = r.x + o.x;
i.ey.y = r.y + o.y;
return i;
};
t.MulMM = function(t, e, i) {
var n = t.ex.x, r = t.ex.y, s = t.ey.x, o = t.ey.y, a = e.ex.x, c = e.ex.y, l = e.ey.x, u = e.ey.y;
i.ex.x = n * a + s * c;
i.ex.y = r * a + o * c;
i.ey.x = n * l + s * u;
i.ey.y = r * l + o * u;
return i;
};
t.MulTMM = function(t, e, i) {
var n = t.ex.x, r = t.ex.y, s = t.ey.x, o = t.ey.y, a = e.ex.x, c = e.ex.y, l = e.ey.x, u = e.ey.y;
i.ex.x = n * a + r * c;
i.ex.y = s * a + o * c;
i.ey.x = n * l + r * u;
i.ey.y = s * l + o * u;
return i;
};
t.IDENTITY = new t();
return t;
})(), L = (function() {
function t() {
this.ex = new P(1, 0, 0);
this.ey = new P(0, 1, 0);
this.ez = new P(0, 0, 1);
}
t.prototype.Clone = function() {
return new t().Copy(this);
};
t.prototype.SetVVV = function(t, e, i) {
this.ex.Copy(t);
this.ey.Copy(e);
this.ez.Copy(i);
return this;
};
t.prototype.Copy = function(t) {
this.ex.Copy(t.ex);
this.ey.Copy(t.ey);
this.ez.Copy(t.ez);
return this;
};
t.prototype.SetIdentity = function() {
this.ex.SetXYZ(1, 0, 0);
this.ey.SetXYZ(0, 1, 0);
this.ez.SetXYZ(0, 0, 1);
return this;
};
t.prototype.SetZero = function() {
this.ex.SetZero();
this.ey.SetZero();
this.ez.SetZero();
return this;
};
t.prototype.SelfAddM = function(t) {
this.ex.SelfAdd(t.ex);
this.ey.SelfAdd(t.ey);
this.ez.SelfAdd(t.ez);
return this;
};
t.prototype.Solve33 = function(t, e, i, n) {
var r = this.ex.x, s = this.ex.y, o = this.ex.z, a = this.ey.x, c = this.ey.y, l = this.ey.z, u = this.ez.x, h = this.ez.y, _ = this.ez.z, f = r * (c * _ - l * h) + s * (l * u - a * _) + o * (a * h - c * u);
0 !== f && (f = 1 / f);
n.x = f * (t * (c * _ - l * h) + e * (l * u - a * _) + i * (a * h - c * u));
n.y = f * (r * (e * _ - i * h) + s * (i * u - t * _) + o * (t * h - e * u));
n.z = f * (r * (c * i - l * e) + s * (l * t - a * i) + o * (a * e - c * t));
return n;
};
t.prototype.Solve22 = function(t, e, i) {
var n = this.ex.x, r = this.ey.x, s = this.ex.y, o = this.ey.y, a = n * o - r * s;
0 !== a && (a = 1 / a);
i.x = a * (o * t - r * e);
i.y = a * (n * e - s * t);
return 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 = P.DotV3V3(this.ex, P.CrossV3V3(this.ey, this.ez, P.s_t0));
0 !== e && (e = 1 / e);
var i = this.ex.x, n = this.ey.x, r = this.ez.x, s = this.ey.y, o = this.ez.y, a = this.ez.z;
t.ex.x = e * (s * a - o * o);
t.ex.y = e * (r * o - n * a);
t.ex.z = e * (n * o - r * s);
t.ey.x = t.ex.y;
t.ey.y = e * (i * a - r * r);
t.ey.z = e * (r * n - i * o);
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;
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;
return i;
};
t.MulM33XYZ = function(t, e, i, n, r) {
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;
return r;
};
t.MulM33V2 = function(t, e, i) {
var n = e.x, r = e.y;
i.x = t.ex.x * n + t.ey.x * r;
i.y = t.ex.y * n + t.ey.y * r;
return i;
};
t.MulM33XY = function(t, e, i, n) {
n.x = t.ex.x * e + t.ey.x * i;
n.y = t.ex.y * e + t.ey.y * i;
return n;
};
t.IDENTITY = new t();
return t;
})(), O = (function() {
function t(t) {
void 0 === t && (t = 0);
this.s = 0;
this.c = 1;
if (t) {
this.s = Math.sin(t);
this.c = Math.cos(t);
}
}
t.prototype.Clone = function() {
return new t().Copy(this);
};
t.prototype.Copy = function(t) {
this.s = t.s;
this.c = t.c;
return this;
};
t.prototype.SetAngle = function(t) {
this.s = Math.sin(t);
this.c = Math.cos(t);
return this;
};
t.prototype.SetIdentity = function() {
this.s = 0;
this.c = 1;
return this;
};
t.prototype.GetAngle = function() {
return Math.atan2(this.s, this.c);
};
t.prototype.GetXAxis = function(t) {
t.x = this.c;
t.y = this.s;
return t;
};
t.prototype.GetYAxis = function(t) {
t.x = -this.s;
t.y = this.c;
return t;
};
t.MulRR = function(t, e, i) {
var n = t.c, r = t.s, s = e.c, o = e.s;
i.s = r * s + n * o;
i.c = n * s - r * o;
return i;
};
t.MulTRR = function(t, e, i) {
var n = t.c, r = t.s, s = e.c, o = e.s;
i.s = n * o - r * s;
i.c = n * s + r * o;
return i;
};
t.MulRV = function(t, e, i) {
var n = t.c, r = t.s, s = e.x, o = e.y;
i.x = n * s - r * o;
i.y = r * s + n * o;
return i;
};
t.MulTRV = function(t, e, i) {
var n = t.c, r = t.s, s = e.x, o = e.y;
i.x = n * s + r * o;
i.y = -r * s + n * o;
return i;
};
t.IDENTITY = new t();
return t;
})(), V = (function() {
function t() {
this.p = new I();
this.q = new O();
}
t.prototype.Clone = function() {
return new t().Copy(this);
};
t.prototype.Copy = function(t) {
this.p.Copy(t.p);
this.q.Copy(t.q);
return this;
};
t.prototype.SetIdentity = function() {
this.p.SetZero();
this.q.SetIdentity();
return this;
};
t.prototype.SetPositionRotation = function(t, e) {
this.p.Copy(t);
this.q.Copy(e);
return this;
};
t.prototype.SetPositionAngle = function(t, e) {
this.p.Copy(t);
this.q.SetAngle(e);
return this;
};
t.prototype.SetPosition = function(t) {
this.p.Copy(t);
return this;
};
t.prototype.SetPositionXY = function(t, e) {
this.p.Set(t, e);
return this;
};
t.prototype.SetRotation = function(t) {
this.q.Copy(t);
return this;
};
t.prototype.SetRotationAngle = function(t) {
this.q.SetAngle(t);
return 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, o = e.y;
i.x = n * s - r * o + t.p.x;
i.y = r * s + n * o + t.p.y;
return i;
};
t.MulTXV = function(t, e, i) {
var n = t.q.c, r = t.q.s, s = e.x - t.p.x, o = e.y - t.p.y;
i.x = n * s + r * o;
i.y = -r * s + n * o;
return i;
};
t.MulXX = function(t, e, i) {
O.MulRR(t.q, e.q, i.q);
I.AddVV(O.MulRV(t.q, e.p, i.p), t.p, i.p);
return i;
};
t.MulTXX = function(t, e, i) {
O.MulTRR(t.q, e.q, i.q);
O.MulTRV(t.q, I.SubVV(e.p, t.p, i.p), i.p);
return i;
};
t.IDENTITY = new t();
return t;
})(), N = (function() {
function t() {
this.localCenter = new I();
this.c0 = new I();
this.c = new I();
this.a0 = 0;
this.a = 0;
this.alpha0 = 0;
}
t.prototype.Clone = function() {
return new t().Copy(this);
};
t.prototype.Copy = function(t) {
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;
return 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;
t.q.SetAngle(n);
t.p.SelfSub(O.MulRV(t.q, this.localCenter, I.s_t0));
return 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;
};
return t;
})(), F = (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;
}
t.prototype.Clone = function() {
return new t().Copy(this);
};
t.prototype.Copy = function(t) {
this.r = t.r;
this.g = t.g;
this.b = t.b;
this.a = t.a;
return 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) {
this.r = t / 255;
this.g = e / 255;
this.b = i / 255;
return this;
};
t.prototype.SetByteRGBA = function(t, e, i, n) {
this.r = t / 255;
this.g = e / 255;
this.b = i / 255;
this.a = n / 255;
return this;
};
t.prototype.SetRGB = function(t, e, i) {
this.r = t;
this.g = e;
this.b = i;
return this;
};
t.prototype.SetRGBA = function(t, e, i, n) {
this.r = t;
this.g = e;
this.b = i;
this.a = n;
return this;
};
t.prototype.SelfAdd = function(t) {
this.r += t.r;
this.g += t.g;
this.b += t.b;
this.a += t.a;
return this;
};
t.prototype.Add = function(t, e) {
e.r = this.r + t.r;
e.g = this.g + t.g;
e.b = this.b + t.b;
e.a = this.a + t.a;
return e;
};
t.prototype.SelfSub = function(t) {
this.r -= t.r;
this.g -= t.g;
this.b -= t.b;
this.a -= t.a;
return this;
};
t.prototype.Sub = function(t, e) {
e.r = this.r - t.r;
e.g = this.g - t.g;
e.b = this.b - t.b;
e.a = this.a - t.a;
return e;
};
t.prototype.SelfMul = function(t) {
this.r *= t;
this.g *= t;
this.b *= t;
this.a *= t;
return this;
};
t.prototype.Mul = function(t, e) {
e.r = this.r * t;
e.g = this.g * t;
e.b = this.b * t;
e.a = this.a * t;
return 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), o = i * (e.a - t.a);
t.r += n;
t.g += r;
t.b += s;
t.a += o;
e.r -= n;
e.g -= r;
e.b -= s;
e.a -= o;
};
t.prototype.MakeStyleString = function(e) {
void 0 === e && (e = this.a);
return t.MakeStyleString(this.r, this.g, this.b, e);
};
t.MakeStyleString = function(t, e, i, n) {
void 0 === n && (n = 1);
t *= 255;
e *= 255;
i *= 255;
return 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);
return 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;
}
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;
};
return t;
})(), k = (function() {
function t() {
this.m_start = Date.now();
}
t.prototype.Reset = function() {
this.m_start = Date.now();
return this;
};
t.prototype.GetMilliseconds = function() {
return Date.now() - this.m_start;
};
return t;
})(), G = (function() {
function t() {
this.m_count = 0;
this.m_min_count = 0;
this.m_max_count = 0;
}
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;
this.m_count = 0;
return 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_count < this.m_count && (this.m_max_count = this.m_count);
};
t.prototype.Decrement = function() {
this.m_count--;
this.m_min_count > this.m_count && (this.m_min_count = this.m_count);
};
return t;
})(), U = (function() {
function t(t) {
this.m_stack = [];
this.m_count = 0;
this.m_stack = d(t, (function() {
return null;
}));
this.m_count = 0;
}
t.prototype.Reset = function() {
this.m_count = 0;
return 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];
this.m_stack[this.m_count] = null;
if (null === t) throw new Error();
return t;
};
t.prototype.GetCount = function() {
return this.m_count;
};
return t;
})(), H = (function() {
function t() {
this.m_buffer = I.MakeArray(2);
this.m_vertices = this.m_buffer;
this.m_count = 0;
this.m_radius = 0;
}
t.prototype.Copy = function(t) {
if (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]);
} else this.m_vertices = t.m_vertices;
this.m_count = t.m_count;
this.m_radius = t.m_radius;
return this;
};
t.prototype.Reset = function() {
this.m_vertices = this.m_buffer;
this.m_count = 0;
this.m_radius = 0;
return 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 = I.DotVV(this.m_vertices[0], t), n = 1; n < this.m_count; ++n) {
var r = I.DotVV(this.m_vertices[n], t);
if (r > i) {
e = n;
i = r;
}
}
return e;
};
t.prototype.GetSupportVertex = function(t) {
for (var e = 0, i = I.DotVV(this.m_vertices[0], t), n = 1; n < this.m_count; ++n) {
var r = I.DotVV(this.m_vertices[n], t);
if (r > i) {
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];
};
return t;
})(), j = (function() {
function t() {
this.metric = 0;
this.count = 0;
this.indexA = [ 0, 0, 0 ];
this.indexB = [ 0, 0, 0 ];
}
t.prototype.Reset = function() {
this.metric = 0;
this.count = 0;
return this;
};
return t;
})(), W = (function() {
function t() {
this.proxyA = new H();
this.proxyB = new H();
this.transformA = new V();
this.transformB = new V();
this.useRadii = !1;
}
t.prototype.Reset = function() {
this.proxyA.Reset();
this.proxyB.Reset();
this.transformA.SetIdentity();
this.transformB.SetIdentity();
this.useRadii = !1;
return this;
};
return t;
})(), q = (function() {
function t() {
this.pointA = new I();
this.pointB = new I();
this.distance = 0;
this.iterations = 0;
}
t.prototype.Reset = function() {
this.pointA.SetZero();
this.pointB.SetZero();
this.distance = 0;
this.iterations = 0;
return this;
};
return t;
})();
t.b2_gjkCalls = 0;
t.b2_gjkIters = 0;
t.b2_gjkMaxIters = 0;
var X = (function() {
function t() {
this.wA = new I();
this.wB = new I();
this.w = new I();
this.a = 0;
this.indexA = 0;
this.indexB = 0;
}
t.prototype.Copy = function(t) {
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;
return this;
};
return t;
})(), Y = (function() {
function t() {
this.m_v1 = new X();
this.m_v2 = new X();
this.m_v3 = new X();
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;
}
t.prototype.ReadCache = function(t, e, i, r, s) {
this.m_count = t.count;
for (var o = this.m_vertices, a = 0; a < this.m_count; ++a) {
(_ = o[a]).indexA = t.indexA[a];
_.indexB = t.indexB[a];
var c = e.GetVertex(_.indexA), l = r.GetVertex(_.indexB);
V.MulXV(i, c, _.wA);
V.MulXV(s, l, _.wB);
I.SubVV(_.wB, _.wA, _.w);
_.a = 0;
}
if (this.m_count > 1) {
var u = t.metric, h = this.GetMetric();
(h < .5 * u || 2 * u < h || h < n) && (this.m_count = 0);
}
if (0 === this.m_count) {
var _;
(_ = o[0]).indexA = 0;
_.indexB = 0;
c = e.GetVertex(0), l = r.GetVertex(0);
V.MulXV(i, c, _.wA);
V.MulXV(s, l, _.wB);
I.SubVV(_.wB, _.wA, _.w);
_.a = 1;
this.m_count = 1;
}
};
t.prototype.WriteCache = function(t) {
t.metric = this.GetMetric();
t.count = this.m_count;
for (var e = this.m_vertices, i = 0; i < this.m_count; ++i) {
t.indexA[i] = e[i].indexA;
t.indexB[i] = e[i].indexB;
}
};
t.prototype.GetSearchDirection = function(t) {
switch (this.m_count) {
case 1:
return I.NegV(this.m_v1.w, t);

case 2:
var e = I.SubVV(this.m_v2.w, this.m_v1.w, t);
return I.CrossVV(e, I.NegV(this.m_v1.w, I.s_t0)) > 0 ? I.CrossOneV(e, t) : I.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 I.DistanceVV(this.m_v1.w, this.m_v2.w);

case 3:
return I.CrossVV(I.SubVV(this.m_v2.w, this.m_v1.w, I.s_t0), I.SubVV(this.m_v3.w, this.m_v1.w, I.s_t1));

default:
return 0;
}
};
t.prototype.Solve2 = function() {
var e = this.m_v1.w, i = this.m_v2.w, n = I.SubVV(i, e, t.s_e12), r = -I.DotVV(e, n);
if (r <= 0) {
this.m_v1.a = 1;
this.m_count = 1;
} else {
var s = I.DotVV(i, n);
if (s <= 0) {
this.m_v2.a = 1;
this.m_count = 1;
this.m_v1.Copy(this.m_v2);
} else {
var o = 1 / (s + r);
this.m_v1.a = s * o;
this.m_v2.a = r * o;
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 = I.SubVV(i, e, t.s_e12), s = I.DotVV(e, r), o = I.DotVV(i, r), a = -s, c = I.SubVV(n, e, t.s_e13), l = I.DotVV(e, c), u = I.DotVV(n, c), h = -l, _ = I.SubVV(n, i, t.s_e23), f = I.DotVV(i, _), d = I.DotVV(n, _), p = -f, m = I.CrossVV(r, c), y = m * I.CrossVV(i, n), v = m * I.CrossVV(n, e), g = m * I.CrossVV(e, i);
if (a <= 0 && h <= 0) {
this.m_v1.a = 1;
this.m_count = 1;
} else if (o > 0 && a > 0 && g <= 0) {
var b = 1 / (o + a);
this.m_v1.a = o * b;
this.m_v2.a = a * b;
this.m_count = 2;
} else if (u > 0 && h > 0 && v <= 0) {
var C = 1 / (u + h);
this.m_v1.a = u * C;
this.m_v3.a = h * C;
this.m_count = 2;
this.m_v2.Copy(this.m_v3);
} else if (o <= 0 && p <= 0) {
this.m_v2.a = 1;
this.m_count = 1;
this.m_v1.Copy(this.m_v2);
} else if (u <= 0 && d <= 0) {
this.m_v3.a = 1;
this.m_count = 1;
this.m_v1.Copy(this.m_v3);
} else if (d > 0 && p > 0 && y <= 0) {
var x = 1 / (d + p);
this.m_v2.a = d * x;
this.m_v3.a = p * x;
this.m_count = 2;
this.m_v1.Copy(this.m_v3);
} else {
var A = 1 / (y + v + g);
this.m_v1.a = y * A;
this.m_v2.a = v * A;
this.m_v3.a = g * A;
this.m_count = 3;
}
};
t.s_e12 = new I();
t.s_e13 = new I();
t.s_e23 = new I();
return t;
})(), J = new Y(), Z = [ 0, 0, 0 ], K = [ 0, 0, 0 ], Q = new I(), $ = new I(), tt = new I(), et = new I(), it = new I();
function nt(e, i, s) {
++t.b2_gjkCalls;
var o = s.proxyA, a = s.proxyB, c = s.transformA, l = s.transformB, u = J;
u.ReadCache(i, o, c, a, l);
for (var h = u.m_vertices, _ = Z, f = K, d = 0, p = 0; p < 20; ) {
d = u.m_count;
for (var m = 0; m < d; ++m) {
_[m] = h[m].indexA;
f[m] = h[m].indexB;
}
switch (u.m_count) {
case 1:
break;

case 2:
u.Solve2();
break;

case 3:
u.Solve3();
}
if (3 === u.m_count) break;
var y = u.GetSearchDirection($);
if (y.LengthSquared() < r) break;
var g = h[u.m_count];
g.indexA = o.GetSupport(O.MulTRV(c.q, I.NegV(y, I.s_t0), et));
V.MulXV(c, o.GetVertex(g.indexA), g.wA);
g.indexB = a.GetSupport(O.MulTRV(l.q, y, it));
V.MulXV(l, a.GetVertex(g.indexB), g.wB);
I.SubVV(g.wB, g.wA, g.w);
++p;
++t.b2_gjkIters;
var b = !1;
for (m = 0; m < d; ++m) if (g.indexA === _[m] && g.indexB === f[m]) {
b = !0;
break;
}
if (b) break;
++u.m_count;
}
t.b2_gjkMaxIters = v(t.b2_gjkMaxIters, p);
u.GetWitnessPoints(e.pointA, e.pointB);
e.distance = I.DistanceVV(e.pointA, e.pointB);
e.iterations = p;
u.WriteCache(i);
if (s.useRadii) {
var C = o.m_radius, x = a.m_radius;
if (e.distance > C + x && e.distance > n) {
e.distance -= C + x;
var A = I.SubVV(e.pointB, e.pointA, tt);
A.Normalize();
e.pointA.SelfMulAdd(C, A);
e.pointB.SelfMulSub(x, A);
} else {
var S = I.MidVV(e.pointA, e.pointB, Q);
e.pointA.Copy(S);
e.pointB.Copy(S);
e.distance = 0;
}
}
}
var rt = new I(), st = new Y(), ot = new I(), at = new I(), ct = new I(), lt = new I(), ut = new I(), ht = new I();
(function(t) {
t[t.e_vertex = 0] = "e_vertex";
t[t.e_face = 1] = "e_face";
})(t.b2ContactFeatureType || (t.b2ContactFeatureType = {}));
var _t = (function() {
function t() {
this._key = 0;
this._key_invalid = !1;
this._indexA = 0;
this._indexB = 0;
this._typeA = 0;
this._typeB = 0;
}
Object.defineProperty(t.prototype, "key", {
get: function() {
if (this._key_invalid) {
this._key_invalid = !1;
this._key = this._indexA | this._indexB << 8 | this._typeA << 16 | this._typeB << 24;
}
return 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
});
return t;
})(), ft = (function() {
function t() {
this.cf = new _t();
}
t.prototype.Copy = function(t) {
this.key = t.key;
return 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
});
return t;
})(), dt = (function() {
function t() {
this.localPoint = new I();
this.normalImpulse = 0;
this.tangentImpulse = 0;
this.id = new ft();
}
t.MakeArray = function(e) {
return d(e, (function() {
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) {
this.localPoint.Copy(t.localPoint);
this.normalImpulse = t.normalImpulse;
this.tangentImpulse = t.tangentImpulse;
this.id.Copy(t.id);
return this;
};
return 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 pt = (function() {
function e() {
this.points = dt.MakeArray(o);
this.localNormal = new I();
this.localPoint = new I();
this.type = t.b2ManifoldType.e_unknown;
this.pointCount = 0;
}
e.prototype.Reset = function() {
for (var e = 0; e < o; ++e) this.points[e].Reset();
this.localNormal.SetZero();
this.localPoint.SetZero();
this.type = t.b2ManifoldType.e_unknown;
this.pointCount = 0;
};
e.prototype.Copy = function(t) {
this.pointCount = t.pointCount;
for (var e = 0; e < o; ++e) this.points[e].Copy(t.points[e]);
this.localNormal.Copy(t.localNormal);
this.localPoint.Copy(t.localPoint);
this.type = t.type;
return this;
};
e.prototype.Clone = function() {
return new e().Copy(this);
};
return e;
})(), mt = (function() {
function e() {
this.normal = new I();
this.points = I.MakeArray(o);
this.separations = p(o);
}
e.prototype.Initialize = function(i, n, s, o, a) {
if (0 !== i.pointCount) switch (i.type) {
case t.b2ManifoldType.e_circles:
this.normal.Set(1, 0);
var c = V.MulXV(n, i.localPoint, e.Initialize_s_pointA), l = V.MulXV(o, i.points[0].localPoint, e.Initialize_s_pointB);
I.DistanceSquaredVV(c, l) > r && I.SubVV(l, c, this.normal).SelfNormalize();
var u = I.AddVMulSV(c, s, this.normal, e.Initialize_s_cA), h = I.SubVMulSV(l, a, this.normal, e.Initialize_s_cB);
I.MidVV(u, h, this.points[0]);
this.separations[0] = I.DotVV(I.SubVV(h, u, I.s_t0), this.normal);
break;

case t.b2ManifoldType.e_faceA:
O.MulRV(n.q, i.localNormal, this.normal);
for (var _ = V.MulXV(n, i.localPoint, e.Initialize_s_planePoint), f = 0; f < i.pointCount; ++f) {
var d = V.MulXV(o, i.points[f].localPoint, e.Initialize_s_clipPoint), p = s - I.DotVV(I.SubVV(d, _, I.s_t0), this.normal);
u = I.AddVMulSV(d, p, this.normal, e.Initialize_s_cA), h = I.SubVMulSV(d, a, this.normal, e.Initialize_s_cB);
I.MidVV(u, h, this.points[f]);
this.separations[f] = I.DotVV(I.SubVV(h, u, I.s_t0), this.normal);
}
break;

case t.b2ManifoldType.e_faceB:
O.MulRV(o.q, i.localNormal, this.normal);
for (_ = V.MulXV(o, i.localPoint, e.Initialize_s_planePoint), f = 0; f < i.pointCount; ++f) {
d = V.MulXV(n, i.points[f].localPoint, e.Initialize_s_clipPoint), p = a - I.DotVV(I.SubVV(d, _, I.s_t0), this.normal), 
h = I.AddVMulSV(d, p, this.normal, e.Initialize_s_cB), u = I.SubVMulSV(d, s, this.normal, e.Initialize_s_cA);
I.MidVV(u, h, this.points[f]);
this.separations[f] = I.DotVV(I.SubVV(u, h, I.s_t0), this.normal);
}
this.normal.SelfNeg();
}
};
e.Initialize_s_pointA = new I();
e.Initialize_s_pointB = new I();
e.Initialize_s_cA = new I();
e.Initialize_s_cB = new I();
e.Initialize_s_planePoint = new I();
e.Initialize_s_clipPoint = new I();
return e;
})();
(function(t) {
t[t.b2_nullState = 0] = "b2_nullState";
t[t.b2_addState = 1] = "b2_addState";
t[t.b2_persistState = 2] = "b2_persistState";
t[t.b2_removeState = 3] = "b2_removeState";
})(t.b2PointState || (t.b2PointState = {}));
var yt = (function() {
function t() {
this.v = new I();
this.id = new ft();
}
t.MakeArray = function(e) {
return d(e, (function() {
return new t();
}));
};
t.prototype.Copy = function(t) {
this.v.Copy(t.v);
this.id.Copy(t.id);
return this;
};
return t;
})(), vt = (function() {
function t() {
this.p1 = new I();
this.p2 = new I();
this.maxFraction = 1;
}
t.prototype.Copy = function(t) {
this.p1.Copy(t.p1);
this.p2.Copy(t.p2);
this.maxFraction = t.maxFraction;
return this;
};
return t;
})(), gt = (function() {
function t() {
this.normal = new I();
this.fraction = 0;
}
t.prototype.Copy = function(t) {
this.normal.Copy(t.normal);
this.fraction = t.fraction;
return this;
};
return t;
})(), bt = (function() {
function t() {
this.lowerBound = new I();
this.upperBound = new I();
this.m_cache_center = new I();
this.m_cache_extent = new I();
}
t.prototype.Copy = function(t) {
this.lowerBound.Copy(t.lowerBound);
this.upperBound.Copy(t.upperBound);
return this;
};
t.prototype.IsValid = function() {
var t = this.upperBound.x - this.lowerBound.x, e = this.upperBound.y - this.lowerBound.y, i = t >= 0 && e >= 0;
return i && this.lowerBound.IsValid() && this.upperBound.IsValid();
};
t.prototype.GetCenter = function() {
return I.MidVV(this.lowerBound, this.upperBound, this.m_cache_center);
};
t.prototype.GetExtents = function() {
return I.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) {
this.lowerBound.x = y(this.lowerBound.x, t.lowerBound.x);
this.lowerBound.y = y(this.lowerBound.y, t.lowerBound.y);
this.upperBound.x = v(this.upperBound.x, t.upperBound.x);
this.upperBound.y = v(this.upperBound.y, t.upperBound.y);
return this;
};
t.prototype.Combine2 = function(t, e) {
this.lowerBound.x = y(t.lowerBound.x, e.lowerBound.x);
this.lowerBound.y = y(t.lowerBound.y, e.lowerBound.y);
this.upperBound.x = v(t.upperBound.x, e.upperBound.x);
this.upperBound.y = v(t.upperBound.y, e.upperBound.y);
return this;
};
t.Combine = function(t, e, i) {
i.Combine2(t, e);
return i;
};
t.prototype.Contains = function(t) {
var e = !0;
return (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, o = e.p1.x, a = e.p1.y, c = e.p2.x - e.p1.x, l = e.p2.y - e.p1.y, u = m(c), h = m(l), _ = t.normal;
if (u < n) {
if (o < this.lowerBound.x || this.upperBound.x < o) return !1;
} else {
var f = 1 / c, d = -1;
if ((v = (this.lowerBound.x - o) * f) > (g = (this.upperBound.x - o) * f)) {
var p = v;
v = g;
g = p;
d = 1;
}
if (v > r) {
_.x = d;
_.y = 0;
r = v;
}
if (r > (s = y(s, g))) return !1;
}
if (h < n) {
if (a < this.lowerBound.y || this.upperBound.y < a) return !1;
} else {
var v, g;
f = 1 / l, d = -1;
if ((v = (this.lowerBound.y - a) * f) > (g = (this.upperBound.y - a) * f)) {
p = v;
v = g;
g = p;
d = 1;
}
if (v > r) {
_.x = 0;
_.y = d;
r = v;
}
if (r > (s = y(s, g))) return !1;
}
if (r < 0 || e.maxFraction < r) return !1;
t.fraction = r;
return !0;
};
t.prototype.TestContain = function(t) {
return !(t.x < this.lowerBound.x || this.upperBound.x < t.x || t.y < this.lowerBound.y || this.upperBound.y < t.y);
};
t.prototype.TestOverlap = function(t) {
var e = t.lowerBound.x - this.upperBound.x, i = t.lowerBound.y - this.upperBound.y, n = this.lowerBound.x - t.upperBound.x, r = this.lowerBound.y - t.upperBound.y;
return !(e > 0 || i > 0 || n > 0 || r > 0);
};
return t;
})();
function Ct(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 xt(e, i, n, r, s) {
var o = 0, a = i[0], c = i[1], l = I.DotVV(n, a.v) - r, u = I.DotVV(n, c.v) - r;
l <= 0 && e[o++].Copy(a);
u <= 0 && e[o++].Copy(c);
if (l * u < 0) {
var h = l / (l - u), _ = e[o].v;
_.x = a.v.x + h * (c.v.x - a.v.x);
_.y = a.v.y + h * (c.v.y - a.v.y);
var f = e[o].id;
f.cf.indexA = s;
f.cf.indexB = a.id.cf.indexB;
f.cf.typeA = t.b2ContactFeatureType.e_vertex;
f.cf.typeB = t.b2ContactFeatureType.e_face;
++o;
}
return o;
}
var At = new W(), St = new j(), Tt = new q();
function wt(t, e, i, r, s, o) {
var a = At.Reset();
a.proxyA.SetShape(t, e);
a.proxyB.SetShape(i, r);
a.transformA.Copy(s);
a.transformB.Copy(o);
a.useRadii = !0;
var c = St.Reset();
c.count = 0;
var l = Tt.Reset();
nt(l, c, a);
return l.distance < 10 * n;
}
function Et(t) {
if (null === t) throw new Error();
return t;
}
var Mt = (function() {
function t(t) {
void 0 === t && (t = 0);
this.m_id = 0;
this.aabb = new bt();
this.parent = null;
this.child1 = null;
this.child2 = null;
this.height = 0;
this.m_id = t;
}
t.prototype.IsLeaf = function() {
return null === this.child1;
};
return t;
})(), Bt = (function() {
function t() {
this.m_root = null;
this.m_freeList = null;
this.m_path = 0;
this.m_insertionCount = 0;
this.m_stack = new U(256);
}
t.prototype.Query = function(t, e) {
if (null !== this.m_root) {
var i = this.m_stack.Reset();
i.Push(this.m_root);
for (;i.GetCount() > 0; ) {
var n = i.Pop();
if (n.aabb.TestOverlap(t)) if (n.IsLeaf()) {
if (!e(n)) return;
} else {
i.Push(Et(n.child1));
i.Push(Et(n.child2));
}
}
}
};
t.prototype.QueryPoint = function(t, e) {
if (null !== this.m_root) {
var i = this.m_stack.Reset();
i.Push(this.m_root);
for (;i.GetCount() > 0; ) {
var n = i.Pop();
if (n.aabb.TestContain(t)) if (n.IsLeaf()) {
if (!e(n)) return;
} else {
i.Push(Et(n.child1));
i.Push(Et(n.child2));
}
}
}
};
t.prototype.RayCast = function(e, i) {
if (null !== this.m_root) {
var n = e.p1, r = e.p2, s = I.SubVV(r, n, t.s_r);
s.Normalize();
var o = I.CrossOneV(s, t.s_v), a = I.AbsV(o, t.s_abs_v), c = e.maxFraction, l = t.s_segmentAABB, u = n.x + c * (r.x - n.x), h = n.y + c * (r.y - n.y);
l.lowerBound.x = y(n.x, u);
l.lowerBound.y = y(n.y, h);
l.upperBound.x = v(n.x, u);
l.upperBound.y = v(n.y, h);
var _ = this.m_stack.Reset();
_.Push(this.m_root);
for (;_.GetCount() > 0; ) {
var f = _.Pop();
if (Ct(f.aabb, l)) {
var d = f.aabb.GetCenter(), p = f.aabb.GetExtents();
if (!(m(I.DotVV(o, I.SubVV(n, d, I.s_t0))) - I.DotVV(a, p) > 0)) if (f.IsLeaf()) {
var g = t.s_subInput;
g.p1.Copy(e.p1);
g.p2.Copy(e.p2);
g.maxFraction = c;
var b = i(g, f);
if (0 === b) return;
if (b > 0) {
c = b;
u = n.x + c * (r.x - n.x);
h = n.y + c * (r.y - n.y);
l.lowerBound.x = y(n.x, u);
l.lowerBound.y = y(n.y, h);
l.upperBound.x = v(n.x, u);
l.upperBound.y = v(n.y, h);
}
} else {
_.Push(Et(f.child1));
_.Push(Et(f.child2));
}
}
}
}
};
t.prototype.AllocateNode = function() {
if (this.m_freeList) {
var e = this.m_freeList;
this.m_freeList = e.parent;
e.parent = null;
e.child1 = null;
e.child2 = null;
e.height = 0;
delete e.userData;
return e;
}
return new Mt(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();
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);
return 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);
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);
return !0;
};
t.prototype.InsertLeaf = function(e) {
++this.m_insertionCount;
if (null !== this.m_root) {
for (var i = e.aabb, n = this.m_root; !n.IsLeaf(); ) {
var r = Et(n.child1), s = Et(n.child2), o = n.aabb.GetPerimeter(), a = t.s_combinedAABB;
a.Combine2(n.aabb, i);
var c = a.GetPerimeter(), l = 2 * c, u = 2 * (c - o), h = void 0, _ = t.s_aabb, f = void 0;
if (r.IsLeaf()) {
_.Combine2(i, r.aabb);
h = _.GetPerimeter() + u;
} else {
_.Combine2(i, r.aabb);
f = r.aabb.GetPerimeter();
h = _.GetPerimeter() - f + u;
}
var d = void 0;
if (s.IsLeaf()) {
_.Combine2(i, s.aabb);
d = _.GetPerimeter() + u;
} else {
_.Combine2(i, s.aabb);
f = s.aabb.GetPerimeter();
d = _.GetPerimeter() - f + u;
}
if (l < h && l < d) break;
n = h < d ? r : s;
}
var p = n, m = p.parent, y = this.AllocateNode();
y.parent = m;
delete y.userData;
y.aabb.Combine2(i, p.aabb);
y.height = p.height + 1;
if (m) {
m.child1 === p ? m.child1 = y : m.child2 = y;
y.child1 = p;
y.child2 = e;
p.parent = y;
e.parent = y;
} else {
y.child1 = p;
y.child2 = e;
p.parent = y;
e.parent = y;
this.m_root = y;
}
for (var g = e.parent; null !== g; ) {
r = Et((g = this.Balance(g)).child1), s = Et(g.child2);
g.height = 1 + v(r.height, s.height);
g.aabb.Combine2(r.aabb, s.aabb);
g = g.parent;
}
} else {
this.m_root = e;
this.m_root.parent = null;
}
};
t.prototype.RemoveLeaf = function(t) {
if (t !== this.m_root) {
var e, i = Et(t.parent), n = i && i.parent;
e = i.child1 === t ? Et(i.child2) : Et(i.child1);
if (n) {
n.child1 === i ? n.child1 = e : n.child2 = e;
e.parent = n;
this.FreeNode(i);
for (var r = n; r; ) {
var s = Et((r = this.Balance(r)).child1), o = Et(r.child2);
r.aabb.Combine2(s.aabb, o.aabb);
r.height = 1 + v(s.height, o.height);
r = r.parent;
}
} else {
this.m_root = e;
e.parent = null;
this.FreeNode(i);
}
} else this.m_root = null;
};
t.prototype.Balance = function(t) {
if (t.IsLeaf() || t.height < 2) return t;
var e = Et(t.child1), i = Et(t.child2), n = i.height - e.height;
if (n > 1) {
var r = Et(i.child1), s = Et(i.child2);
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;
if (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 + v(e.height, s.height);
i.height = 1 + v(t.height, r.height);
} else {
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 + v(e.height, r.height);
i.height = 1 + v(t.height, s.height);
}
return i;
}
if (n < -1) {
var o = Et(e.child1), a = Et(e.child2);
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;
if (o.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 + v(i.height, a.height);
e.height = 1 + v(t.height, o.height);
} else {
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 + v(i.height, o.height);
e.height = 1 + v(t.height, a.height);
}
return 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)) + 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 + v(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 = Et(e.child1), n = Et(e.child2);
this.ValidateStructure(i);
this.ValidateStructure(n);
}
}
};
t.prototype.ValidateMetrics = function(e) {
if (null !== e) {
var i = e;
if (!i.IsLeaf()) {
var n = Et(i.child1), r = Et(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 = Et(t.child1), n = Et(t.child2), r = m(n.height - i.height);
return v(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 I();
t.s_v = new I();
t.s_abs_v = new I();
t.s_segmentAABB = new bt();
t.s_subInput = new vt();
t.s_combinedAABB = new bt();
t.s_aabb = new bt();
t.s_node_id = 0;
return t;
})(), It = function(t, e) {
this.proxyA = t;
this.proxyB = e;
}, Dt = (function() {
function t() {
this.m_tree = new Bt();
this.m_proxyCount = 0;
this.m_moveCount = 0;
this.m_moveBuffer = [];
this.m_pairCount = 0;
this.m_pairBuffer = [];
}
t.prototype.CreateProxy = function(t, e) {
var i = this.m_tree.CreateProxy(t, e);
++this.m_proxyCount;
this.BufferMove(i);
return 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 < i.m_id) {
n = t;
r = i;
} else {
n = i;
r = t;
}
if (e.m_pairCount === e.m_pairBuffer.length) e.m_pairBuffer[e.m_pairCount] = new It(n, r); else {
var s = e.m_pairBuffer[e.m_pairCount];
s.proxyA = n;
s.proxyB = r;
}
++e.m_pairCount;
return !0;
}));
}, n = this, r = 0; r < this.m_moveCount; ++r) i(r);
this.m_moveCount = 0;
this.m_pairBuffer.length = this.m_pairCount;
this.m_pairBuffer.sort(Pt);
for (var s = 0; s < this.m_pairCount; ) {
var o = this.m_pairBuffer[s], a = o.proxyA.userData, c = o.proxyB.userData;
a && c && t(a, c);
++s;
for (;s < this.m_pairCount; ) {
var l = this.m_pairBuffer[s];
if (l.proxyA.m_id !== o.proxyA.m_id || l.proxyB.m_id !== o.proxyB.m_id) break;
++s;
}
}
};
t.prototype.Query = function(t, e) {
this.m_tree.Query(t, e);
};
t.prototype.QueryPoint = function(t, e) {
this.m_tree.QueryPoint(t, e);
};
t.prototype.RayCast = function(t, e) {
this.m_tree.RayCast(t, e);
};
t.prototype.GetTreeHeight = function() {
return this.m_tree.GetHeight();
};
t.prototype.GetTreeBalance = function() {
return this.m_tree.GetMaxBalance();
};
t.prototype.GetTreeQuality = function() {
return this.m_tree.GetAreaRatio();
};
t.prototype.ShiftOrigin = function(t) {
this.m_tree.ShiftOrigin(t);
};
t.prototype.BufferMove = function(t) {
this.m_moveBuffer[this.m_moveCount] = t;
++this.m_moveCount;
};
t.prototype.UnBufferMove = function(t) {
var e = this.m_moveBuffer.indexOf(t);
this.m_moveBuffer[e] = null;
};
return t;
})();
function Pt(t, e) {
return t.proxyA.m_id === e.proxyA.m_id ? t.proxyB.m_id - e.proxyB.m_id : t.proxyA.m_id - e.proxyA.m_id;
}
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;
var Rt = new V(), Lt = new V(), Ot = new I(), Vt = new I(), Nt = new I(), Ft = new I(), zt = new I(), kt = function() {
this.proxyA = new H();
this.proxyB = new H();
this.sweepA = new N();
this.sweepB = new N();
this.tMax = 0;
};
(function(t) {
t[t.e_unknown = 0] = "e_unknown";
t[t.e_failed = 1] = "e_failed";
t[t.e_overlapped = 2] = "e_overlapped";
t[t.e_touching = 3] = "e_touching";
t[t.e_separated = 4] = "e_separated";
})(t.b2TOIOutputState || (t.b2TOIOutputState = {}));
var Gt = function() {
this.state = t.b2TOIOutputState.e_unknown;
this.t = 0;
};
(function(t) {
t[t.e_unknown = -1] = "e_unknown";
t[t.e_points = 0] = "e_points";
t[t.e_faceA = 1] = "e_faceA";
t[t.e_faceB = 2] = "e_faceB";
})(t.b2SeparationFunctionType || (t.b2SeparationFunctionType = {}));
var Ut = (function() {
function e() {
this.m_sweepA = new N();
this.m_sweepB = new N();
this.m_type = t.b2SeparationFunctionType.e_unknown;
this.m_localPoint = new I();
this.m_axis = new I();
}
e.prototype.Initialize = function(e, i, n, r, s, o) {
this.m_proxyA = i;
this.m_proxyB = r;
var a = e.count;
this.m_sweepA.Copy(n);
this.m_sweepB.Copy(s);
var c = Rt, l = Lt;
this.m_sweepA.GetTransform(c, o);
this.m_sweepB.GetTransform(l, o);
if (1 === a) {
this.m_type = t.b2SeparationFunctionType.e_points;
var u = this.m_proxyA.GetVertex(e.indexA[0]), h = this.m_proxyB.GetVertex(e.indexB[0]), _ = V.MulXV(c, u, Ot), f = V.MulXV(l, h, Vt);
I.SubVV(f, _, this.m_axis);
var d = this.m_axis.Normalize();
this.m_localPoint.SetZero();
return d;
}
if (e.indexA[0] === e.indexA[1]) {
this.m_type = t.b2SeparationFunctionType.e_faceB;
var p = this.m_proxyB.GetVertex(e.indexB[0]), m = this.m_proxyB.GetVertex(e.indexB[1]);
I.CrossVOne(I.SubVV(m, p, I.s_t0), this.m_axis).SelfNormalize();
var y = O.MulRV(l.q, this.m_axis, Nt);
I.MidVV(p, m, this.m_localPoint);
f = V.MulXV(l, this.m_localPoint, Vt), u = this.m_proxyA.GetVertex(e.indexA[0]), 
_ = V.MulXV(c, u, Ot);
if ((d = I.DotVV(I.SubVV(_, f, I.s_t0), y)) < 0) {
this.m_axis.SelfNeg();
d = -d;
}
return d;
}
this.m_type = t.b2SeparationFunctionType.e_faceA;
var v = this.m_proxyA.GetVertex(e.indexA[0]), g = this.m_proxyA.GetVertex(e.indexA[1]);
I.CrossVOne(I.SubVV(g, v, I.s_t0), this.m_axis).SelfNormalize();
y = O.MulRV(c.q, this.m_axis, Nt);
I.MidVV(v, g, this.m_localPoint);
_ = V.MulXV(c, this.m_localPoint, Ot), h = this.m_proxyB.GetVertex(e.indexB[0]), 
f = V.MulXV(l, h, Vt);
if ((d = I.DotVV(I.SubVV(f, _, I.s_t0), y)) < 0) {
this.m_axis.SelfNeg();
d = -d;
}
return d;
};
e.prototype.FindMinSeparation = function(e, i, n) {
var r = Rt, s = Lt;
this.m_sweepA.GetTransform(r, n);
this.m_sweepB.GetTransform(s, n);
switch (this.m_type) {
case t.b2SeparationFunctionType.e_points:
var o = O.MulTRV(r.q, this.m_axis, Ft), a = O.MulTRV(s.q, I.NegV(this.m_axis, I.s_t0), zt);
e[0] = this.m_proxyA.GetSupport(o);
i[0] = this.m_proxyB.GetSupport(a);
var c = this.m_proxyA.GetVertex(e[0]), l = this.m_proxyB.GetVertex(i[0]), u = V.MulXV(r, c, Ot), h = V.MulXV(s, l, Vt);
return I.DotVV(I.SubVV(h, u, I.s_t0), this.m_axis);

case t.b2SeparationFunctionType.e_faceA:
var _ = O.MulRV(r.q, this.m_axis, Nt);
u = V.MulXV(r, this.m_localPoint, Ot), a = O.MulTRV(s.q, I.NegV(_, I.s_t0), zt);
e[0] = -1;
i[0] = this.m_proxyB.GetSupport(a);
l = this.m_proxyB.GetVertex(i[0]), h = V.MulXV(s, l, Vt);
return I.DotVV(I.SubVV(h, u, I.s_t0), _);

case t.b2SeparationFunctionType.e_faceB:
_ = O.MulRV(s.q, this.m_axis, Nt), h = V.MulXV(s, this.m_localPoint, Vt), o = O.MulTRV(r.q, I.NegV(_, I.s_t0), Ft);
i[0] = -1;
e[0] = this.m_proxyA.GetSupport(o);
c = this.m_proxyA.GetVertex(e[0]), u = V.MulXV(r, c, Ot);
return I.DotVV(I.SubVV(u, h, I.s_t0), _);

default:
e[0] = -1;
i[0] = -1;
return 0;
}
};
e.prototype.Evaluate = function(e, i, n) {
var r = Rt, s = Lt;
this.m_sweepA.GetTransform(r, n);
this.m_sweepB.GetTransform(s, n);
switch (this.m_type) {
case t.b2SeparationFunctionType.e_points:
var o = this.m_proxyA.GetVertex(e), a = this.m_proxyB.GetVertex(i), c = V.MulXV(r, o, Ot), l = V.MulXV(s, a, Vt);
return I.DotVV(I.SubVV(l, c, I.s_t0), this.m_axis);

case t.b2SeparationFunctionType.e_faceA:
var u = O.MulRV(r.q, this.m_axis, Nt);
c = V.MulXV(r, this.m_localPoint, Ot), a = this.m_proxyB.GetVertex(i), l = V.MulXV(s, a, Vt);
return I.DotVV(I.SubVV(l, c, I.s_t0), u);

case t.b2SeparationFunctionType.e_faceB:
u = O.MulRV(s.q, this.m_axis, Nt), l = V.MulXV(s, this.m_localPoint, Vt), o = this.m_proxyA.GetVertex(e), 
c = V.MulXV(r, o, Ot);
return I.DotVV(I.SubVV(c, l, I.s_t0), u);

default:
return 0;
}
};
return e;
})(), Ht = new k(), jt = new j(), Wt = new W(), qt = new q(), Xt = new Ut(), Yt = [ 0 ], Jt = [ 0 ], Zt = new N(), Kt = new N();
function Qt(e, i) {
var n = Ht.Reset();
++t.b2_toiCalls;
e.state = t.b2TOIOutputState.e_unknown;
e.t = i.tMax;
var r = i.proxyA, s = i.proxyB, o = Zt.Copy(i.sweepA), l = Kt.Copy(i.sweepB);
o.Normalize();
l.Normalize();
var u = i.tMax, h = r.m_radius + s.m_radius, _ = v(c, h - 3 * c), f = .25 * c, d = 0, p = 0, y = jt;
y.count = 0;
var g = Wt;
g.proxyA.Copy(i.proxyA);
g.proxyB.Copy(i.proxyB);
g.useRadii = !1;
for (;;) {
var b = Rt, C = Lt;
o.GetTransform(b, d);
l.GetTransform(C, d);
g.transformA.Copy(b);
g.transformB.Copy(C);
var x = qt;
nt(x, y, g);
if (x.distance <= 0) {
e.state = t.b2TOIOutputState.e_overlapped;
e.t = 0;
break;
}
if (x.distance < _ + f) {
e.state = t.b2TOIOutputState.e_touching;
e.t = d;
break;
}
var A = Xt;
A.Initialize(y, r, o, s, l, d);
for (var S = !1, T = u, w = 0; ;) {
var E = Yt, M = Jt, B = A.FindMinSeparation(E, M, T);
if (B > _ + f) {
e.state = t.b2TOIOutputState.e_separated;
e.t = u;
S = !0;
break;
}
if (B > _ - f) {
d = T;
break;
}
var I = A.Evaluate(E[0], M[0], d);
if (I < _ - f) {
e.state = t.b2TOIOutputState.e_failed;
e.t = d;
S = !0;
break;
}
if (I <= _ + f) {
e.state = t.b2TOIOutputState.e_touching;
e.t = d;
S = !0;
break;
}
for (var D = 0, P = d, R = T; ;) {
var L;
L = 1 & D ? P + (_ - I) * (R - P) / (B - I) : .5 * (P + R);
++D;
++t.b2_toiRootIters;
var O = A.Evaluate(E[0], M[0], L);
if (m(O - _) < f) {
T = L;
break;
}
if (O > _) {
P = L;
I = O;
} else {
R = L;
B = O;
}
if (50 === D) break;
}
t.b2_toiMaxRootIters = v(t.b2_toiMaxRootIters, D);
if (++w === a) break;
}
++p;
++t.b2_toiIters;
if (S) break;
if (20 === p) {
e.state = t.b2TOIOutputState.e_failed;
e.t = d;
break;
}
}
t.b2_toiMaxIters = v(t.b2_toiMaxIters, p);
var V = n.GetMilliseconds();
t.b2_toiMaxTime = v(t.b2_toiMaxTime, V);
t.b2_toiTime += V;
}
var $t = new I(), te = new I();
function ee(e, i, n, r, s) {
e.pointCount = 0;
var o = V.MulXV(n, i.m_p, $t), a = V.MulXV(s, r.m_p, te), c = I.DistanceSquaredVV(o, a), l = i.m_radius + r.m_radius;
if (!(c > l * l)) {
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 ie = new I(), ne = new I(), re = new I();
function se(e, r, s, o, a) {
e.pointCount = 0;
for (var c = V.MulXV(a, o.m_p, ie), l = V.MulTXV(s, c, ne), u = 0, h = -i, _ = r.m_radius + o.m_radius, f = r.m_count, d = r.m_vertices, p = r.m_normals, m = 0; m < f; ++m) {
var y = I.DotVV(p[m], I.SubVV(l, d[m], I.s_t0));
if (y > _) return;
if (y > h) {
h = y;
u = m;
}
}
var v = u, g = (v + 1) % f, b = d[v], C = d[g];
if (h < n) {
e.pointCount = 1;
e.type = t.b2ManifoldType.e_faceA;
e.localNormal.Copy(p[u]);
I.MidVV(b, C, e.localPoint);
e.points[0].localPoint.Copy(o.m_p);
e.points[0].id.key = 0;
} else {
var x = I.DotVV(I.SubVV(l, b, I.s_t0), I.SubVV(C, b, I.s_t1)), A = I.DotVV(I.SubVV(l, C, I.s_t0), I.SubVV(b, C, I.s_t1));
if (x <= 0) {
if (I.DistanceSquaredVV(l, b) > _ * _) return;
e.pointCount = 1;
e.type = t.b2ManifoldType.e_faceA;
I.SubVV(l, b, e.localNormal).SelfNormalize();
e.localPoint.Copy(b);
e.points[0].localPoint.Copy(o.m_p);
e.points[0].id.key = 0;
} else if (A <= 0) {
if (I.DistanceSquaredVV(l, C) > _ * _) return;
e.pointCount = 1;
e.type = t.b2ManifoldType.e_faceA;
I.SubVV(l, C, e.localNormal).SelfNormalize();
e.localPoint.Copy(C);
e.points[0].localPoint.Copy(o.m_p);
e.points[0].id.key = 0;
} else {
var S = I.MidVV(b, C, re);
if (I.DotVV(I.SubVV(l, S, I.s_t1), p[v]) > _) return;
e.pointCount = 1;
e.type = t.b2ManifoldType.e_faceA;
e.localNormal.Copy(p[v]).SelfNormalize();
e.localPoint.Copy(S);
e.points[0].localPoint.Copy(o.m_p);
e.points[0].id.key = 0;
}
}
}
var oe = new I(), ae = new I(), ce = new I(), le = new I();
function ue(t, e, n, r, s) {
for (var o = t.m_vertices, a = t.m_normals, c = r.m_count, l = r.m_vertices, u = O.MulRV(e.q, a[n], oe), h = O.MulTRV(s.q, u, ae), _ = 0, f = i, d = 0; d < c; ++d) {
var p = I.DotVV(l[d], h);
if (p < f) {
f = p;
_ = d;
}
}
var m = V.MulXV(e, o[n], ce), y = V.MulXV(s, l[_], le);
return I.DotVV(I.SubVV(y, m, I.s_t0), u);
}
var he = new I(), _e = new I();
function fe(t, e, n, r, s) {
for (var o = e.m_count, a = e.m_normals, c = I.SubVV(V.MulXV(s, r.m_centroid, I.s_t0), V.MulXV(n, e.m_centroid, I.s_t1), he), l = O.MulTRV(n.q, c, _e), u = 0, h = -i, _ = 0; _ < o; ++_) {
var f = I.DotVV(a[_], l);
if (f > h) {
h = f;
u = _;
}
}
var d = ue(e, n, u, r, s), p = (u + o - 1) % o, m = ue(e, n, p, r, s), y = (u + 1) % o, v = ue(e, n, y, r, s), g = 0, b = 0, C = 0;
if (m > d && m > v) {
C = -1;
g = p;
b = m;
} else {
if (!(v > d)) {
t[0] = u;
return d;
}
C = 1;
g = y;
b = v;
}
for (;(d = ue(e, n, u = -1 === C ? (g + o - 1) % o : (g + 1) % o, r, s)) > b; ) {
g = u;
b = d;
}
t[0] = g;
return b;
}
var de = new I();
function pe(e, n, r, s, o, a) {
for (var c = n.m_normals, l = o.m_count, u = o.m_vertices, h = o.m_normals, _ = O.MulTRV(a.q, O.MulRV(r.q, c[s], I.s_t0), de), f = 0, d = i, p = 0; p < l; ++p) {
var m = I.DotVV(_, h[p]);
if (m < d) {
d = m;
f = p;
}
}
var y = f, v = (y + 1) % l, g = e[0];
V.MulXV(a, u[y], g.v);
var b = g.id.cf;
b.indexA = s;
b.indexB = y;
b.typeA = t.b2ContactFeatureType.e_face;
b.typeB = t.b2ContactFeatureType.e_vertex;
var C = e[1];
V.MulXV(a, u[v], C.v);
var x = C.id.cf;
x.indexA = s;
x.indexB = v;
x.typeA = t.b2ContactFeatureType.e_face;
x.typeB = t.b2ContactFeatureType.e_vertex;
}
var me = yt.MakeArray(2), ye = yt.MakeArray(2), ve = yt.MakeArray(2), ge = [ 0 ], be = [ 0 ], Ce = new I(), xe = new I(), Ae = new I(), Se = new I(), Te = new I(), we = new I(), Ee = new I(), Me = new I();
function Be(e, i, n, r, s) {
e.pointCount = 0;
var a = i.m_radius + r.m_radius, c = ge;
c[0] = 0;
var l = fe(c, i, n, r, s);
if (!(l > a)) {
var u = be;
u[0] = 0;
var h = fe(u, r, s, i, n);
if (!(h > a)) {
var _, f, d, p, m = 0, y = 0;
if (h > .98 * l + .001) {
_ = r;
f = i;
d = s;
p = n;
m = u[0];
e.type = t.b2ManifoldType.e_faceB;
y = 1;
} else {
_ = i;
f = r;
d = n;
p = s;
m = c[0];
e.type = t.b2ManifoldType.e_faceA;
y = 0;
}
var v = me;
pe(v, _, d, m, f, p);
var g = _.m_count, b = _.m_vertices, C = m, x = (m + 1) % g, A = b[C], S = b[x], T = I.SubVV(S, A, Ce);
T.Normalize();
var w = I.CrossVOne(T, xe), E = I.MidVV(A, S, Ae), M = O.MulRV(d.q, T, Te), B = I.CrossVOne(M, Se), D = V.MulXV(d, A, Ee), P = V.MulXV(d, S, Me), R = I.DotVV(B, D), L = -I.DotVV(M, D) + a, N = I.DotVV(M, P) + a, F = ye, z = ve;
if (!(xt(F, v, I.NegV(M, we), L, C) < 2 || xt(z, F, M, N, x) < 2)) {
e.localNormal.Copy(w);
e.localPoint.Copy(E);
for (var k = 0, G = 0; G < o; ++G) {
var U = z[G];
if (I.DotVV(B, U.v) - R <= a) {
var H = e.points[k];
V.MulTXV(p, U.v, H.localPoint);
H.id.Copy(U.id);
if (y) {
var j = H.id.cf;
H.id.cf.indexA = j.indexB;
H.id.cf.indexB = j.indexA;
H.id.cf.typeA = j.typeB;
H.id.cf.typeB = j.typeA;
}
++k;
}
}
e.pointCount = k;
}
}
}
}
var Ie = new I(), De = new I(), Pe = new I(), Re = new I(), Le = new I(), Oe = new I(), Ve = new I(), Ne = new ft();
function Fe(e, i, n, r, s) {
e.pointCount = 0;
var o = V.MulTXV(n, V.MulXV(s, r.m_p, I.s_t0), Ie), a = i.m_vertex1, c = i.m_vertex2, l = I.SubVV(c, a, De), u = I.DotVV(l, I.SubVV(c, o, I.s_t0)), h = I.DotVV(l, I.SubVV(o, a, I.s_t0)), _ = i.m_radius + r.m_radius, f = Ne;
f.cf.indexB = 0;
f.cf.typeB = t.b2ContactFeatureType.e_vertex;
if (h <= 0) {
var d = a, p = I.SubVV(o, d, Pe);
if (I.DotVV(p, p) > _ * _) return;
if (i.m_hasVertex0) {
var m = i.m_vertex0, y = a, v = I.SubVV(y, m, Re);
if (I.DotVV(v, I.SubVV(y, o, I.s_t0)) > 0) 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);
e.points[0].localPoint.Copy(r.m_p);
} else if (u <= 0) {
var g = c, b = I.SubVV(o, g, Pe);
if (I.DotVV(b, b) > _ * _) return;
if (i.m_hasVertex3) {
var C = i.m_vertex3, x = c, A = I.SubVV(C, x, Le);
if (I.DotVV(A, I.SubVV(o, x, I.s_t0)) > 0) 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);
e.points[0].localPoint.Copy(r.m_p);
} else {
var S = I.DotVV(l, l), T = Oe;
T.x = 1 / S * (u * a.x + h * c.x);
T.y = 1 / S * (u * a.y + h * c.y);
var w = I.SubVV(o, T, Pe);
if (!(I.DotVV(w, w) > _ * _)) {
var E = Ve.Set(-l.y, l.x);
I.DotVV(E, I.SubVV(o, a, I.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(a);
e.points[0].id.Copy(f);
e.points[0].localPoint.Copy(r.m_p);
}
}
}
var ze = function() {
this.type = 0;
this.index = 0;
this.separation = 0;
}, ke = function() {
this.vertices = I.MakeArray(a);
this.normals = I.MakeArray(a);
this.count = 0;
}, Ge = function() {
this.i1 = 0;
this.i2 = 0;
this.v1 = new I();
this.v2 = new I();
this.normal = new I();
this.sideNormal1 = new I();
this.sideOffset1 = 0;
this.sideNormal2 = new I();
this.sideOffset2 = 0;
}, Ue = new (function() {
function e() {
this.m_polygonB = new ke();
this.m_xf = new V();
this.m_centroidB = new I();
this.m_v0 = new I();
this.m_v1 = new I();
this.m_v2 = new I();
this.m_v3 = new I();
this.m_normal0 = new I();
this.m_normal1 = new I();
this.m_normal2 = new I();
this.m_normal = new I();
this.m_type1 = 0;
this.m_type2 = 0;
this.m_lowerLimit = new I();
this.m_upperLimit = new I();
this.m_radius = 0;
this.m_front = !1;
}
e.prototype.Collide = function(i, n, r, s, a) {
V.MulTXX(r, a, this.m_xf);
V.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 c = n.m_hasVertex0, l = n.m_hasVertex3, u = I.SubVV(this.m_v2, this.m_v1, e.s_edge1);
u.Normalize();
this.m_normal1.Set(u.y, -u.x);
var h = I.DotVV(this.m_normal1, I.SubVV(this.m_centroidB, this.m_v1, I.s_t0)), _ = 0, f = 0, d = !1, p = !1;
if (c) {
var m = I.SubVV(this.m_v1, this.m_v0, e.s_edge0);
m.Normalize();
this.m_normal0.Set(m.y, -m.x);
d = I.CrossVV(m, u) >= 0;
_ = I.DotVV(this.m_normal0, I.SubVV(this.m_centroidB, this.m_v0, I.s_t0));
}
if (l) {
var y = I.SubVV(this.m_v3, this.m_v2, e.s_edge2);
y.Normalize();
this.m_normal2.Set(y.y, -y.x);
p = I.CrossVV(u, y) > 0;
f = I.DotVV(this.m_normal2, I.SubVV(this.m_centroidB, this.m_v2, I.s_t0));
}
if (c && l) if (d && p) {
this.m_front = _ >= 0 || h >= 0 || f >= 0;
if (this.m_front) {
this.m_normal.Copy(this.m_normal1);
this.m_lowerLimit.Copy(this.m_normal0);
this.m_upperLimit.Copy(this.m_normal2);
} else {
this.m_normal.Copy(this.m_normal1).SelfNeg();
this.m_lowerLimit.Copy(this.m_normal1).SelfNeg();
this.m_upperLimit.Copy(this.m_normal1).SelfNeg();
}
} else if (d) {
this.m_front = _ >= 0 || h >= 0 && f >= 0;
if (this.m_front) {
this.m_normal.Copy(this.m_normal1);
this.m_lowerLimit.Copy(this.m_normal0);
this.m_upperLimit.Copy(this.m_normal1);
} else {
this.m_normal.Copy(this.m_normal1).SelfNeg();
this.m_lowerLimit.Copy(this.m_normal2).SelfNeg();
this.m_upperLimit.Copy(this.m_normal1).SelfNeg();
}
} else if (p) {
this.m_front = f >= 0 || _ >= 0 && h >= 0;
if (this.m_front) {
this.m_normal.Copy(this.m_normal1);
this.m_lowerLimit.Copy(this.m_normal1);
this.m_upperLimit.Copy(this.m_normal2);
} else {
this.m_normal.Copy(this.m_normal1).SelfNeg();
this.m_lowerLimit.Copy(this.m_normal1).SelfNeg();
this.m_upperLimit.Copy(this.m_normal0).SelfNeg();
}
} else {
this.m_front = _ >= 0 && h >= 0 && f >= 0;
if (this.m_front) {
this.m_normal.Copy(this.m_normal1);
this.m_lowerLimit.Copy(this.m_normal1);
this.m_upperLimit.Copy(this.m_normal1);
} else {
this.m_normal.Copy(this.m_normal1).SelfNeg();
this.m_lowerLimit.Copy(this.m_normal2).SelfNeg();
this.m_upperLimit.Copy(this.m_normal0).SelfNeg();
}
} else if (c) if (d) {
this.m_front = _ >= 0 || h >= 0;
if (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();
} else {
this.m_normal.Copy(this.m_normal1).SelfNeg();
this.m_lowerLimit.Copy(this.m_normal1);
this.m_upperLimit.Copy(this.m_normal1).SelfNeg();
}
} else {
this.m_front = _ >= 0 && h >= 0;
if (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();
} else {
this.m_normal.Copy(this.m_normal1).SelfNeg();
this.m_lowerLimit.Copy(this.m_normal1);
this.m_upperLimit.Copy(this.m_normal0).SelfNeg();
}
} else if (l) if (p) {
this.m_front = h >= 0 || f >= 0;
if (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);
} else {
this.m_normal.Copy(this.m_normal1).SelfNeg();
this.m_lowerLimit.Copy(this.m_normal1).SelfNeg();
this.m_upperLimit.Copy(this.m_normal1);
}
} else {
this.m_front = h >= 0 && f >= 0;
if (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);
} else {
this.m_normal.Copy(this.m_normal1).SelfNeg();
this.m_lowerLimit.Copy(this.m_normal2).SelfNeg();
this.m_upperLimit.Copy(this.m_normal1);
}
} else {
this.m_front = h >= 0;
if (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();
} else {
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; v < s.m_count; ++v) {
V.MulXV(this.m_xf, s.m_vertices[v], this.m_polygonB.vertices[v]);
O.MulRV(this.m_xf.q, s.m_normals[v], this.m_polygonB.normals[v]);
}
this.m_radius = s.m_radius + n.m_radius;
i.pointCount = 0;
var g = this.ComputeEdgeSeparation(e.s_edgeAxis);
if (0 !== g.type && !(g.separation > this.m_radius)) {
var b = this.ComputePolygonSeparation(e.s_polygonAxis);
if (!(0 !== b.type && b.separation > this.m_radius)) {
var C;
C = 0 === b.type ? g : b.separation > .98 * g.separation + .001 ? b : g;
var x = e.s_ie, A = e.s_rf;
if (1 === C.type) {
i.type = t.b2ManifoldType.e_faceA;
var S = 0, T = I.DotVV(this.m_normal, this.m_polygonB.normals[0]);
for (v = 1; v < this.m_polygonB.count; ++v) {
var w = I.DotVV(this.m_normal, this.m_polygonB.normals[v]);
if (w < T) {
T = w;
S = v;
}
}
var E = S, M = (E + 1) % this.m_polygonB.count;
(B = x[0]).v.Copy(this.m_polygonB.vertices[E]);
B.id.cf.indexA = 0;
B.id.cf.indexB = E;
B.id.cf.typeA = t.b2ContactFeatureType.e_face;
B.id.cf.typeB = t.b2ContactFeatureType.e_vertex;
(D = x[1]).v.Copy(this.m_polygonB.vertices[M]);
D.id.cf.indexA = 0;
D.id.cf.indexB = M;
D.id.cf.typeA = t.b2ContactFeatureType.e_face;
D.id.cf.typeB = t.b2ContactFeatureType.e_vertex;
if (this.m_front) {
A.i1 = 0;
A.i2 = 1;
A.v1.Copy(this.m_v1);
A.v2.Copy(this.m_v2);
A.normal.Copy(this.m_normal1);
} else {
A.i1 = 1;
A.i2 = 0;
A.v1.Copy(this.m_v2);
A.v2.Copy(this.m_v1);
A.normal.Copy(this.m_normal1).SelfNeg();
}
} else {
i.type = t.b2ManifoldType.e_faceB;
var B, D;
(B = x[0]).v.Copy(this.m_v1);
B.id.cf.indexA = 0;
B.id.cf.indexB = C.index;
B.id.cf.typeA = t.b2ContactFeatureType.e_vertex;
B.id.cf.typeB = t.b2ContactFeatureType.e_face;
(D = x[1]).v.Copy(this.m_v2);
D.id.cf.indexA = 0;
D.id.cf.indexB = C.index;
D.id.cf.typeA = t.b2ContactFeatureType.e_vertex;
D.id.cf.typeB = t.b2ContactFeatureType.e_face;
A.i1 = C.index;
A.i2 = (A.i1 + 1) % this.m_polygonB.count;
A.v1.Copy(this.m_polygonB.vertices[A.i1]);
A.v2.Copy(this.m_polygonB.vertices[A.i2]);
A.normal.Copy(this.m_polygonB.normals[A.i1]);
}
A.sideNormal1.Set(A.normal.y, -A.normal.x);
A.sideNormal2.Copy(A.sideNormal1).SelfNeg();
A.sideOffset1 = I.DotVV(A.sideNormal1, A.v1);
A.sideOffset2 = I.DotVV(A.sideNormal2, A.v2);
var P = e.s_clipPoints1, R = e.s_clipPoints2;
if (!(xt(P, x, A.sideNormal1, A.sideOffset1, A.i1) < o || xt(R, P, A.sideNormal2, A.sideOffset2, A.i2) < o)) {
if (1 === C.type) {
i.localNormal.Copy(A.normal);
i.localPoint.Copy(A.v1);
} else {
i.localNormal.Copy(s.m_normals[A.i1]);
i.localPoint.Copy(s.m_vertices[A.i1]);
}
var L = 0;
for (v = 0; v < o; ++v) if (I.DotVV(A.normal, I.SubVV(R[v].v, A.v1, I.s_t0)) <= this.m_radius) {
var N = i.points[L];
if (1 === C.type) {
V.MulTXV(this.m_xf, R[v].v, N.localPoint);
N.id = R[v].id;
} else {
N.localPoint.Copy(R[v].v);
N.id.cf.typeA = R[v].id.cf.typeB;
N.id.cf.typeB = R[v].id.cf.typeA;
N.id.cf.indexA = R[v].id.cf.indexB;
N.id.cf.indexB = R[v].id.cf.indexA;
}
++L;
}
i.pointCount = L;
}
}
}
};
e.prototype.ComputeEdgeSeparation = function(t) {
var e = t;
e.type = 1;
e.index = this.m_front ? 0 : 1;
e.separation = i;
for (var n = 0; n < this.m_polygonB.count; ++n) {
var r = I.DotVV(this.m_normal, I.SubVV(this.m_polygonB.vertices[n], this.m_v1, I.s_t0));
r < e.separation && (e.separation = r);
}
return e;
};
e.prototype.ComputePolygonSeparation = function(t) {
var n = t;
n.type = 0;
n.index = -1;
n.separation = -i;
for (var r = e.s_perp.Set(-this.m_normal.y, this.m_normal.x), s = 0; s < this.m_polygonB.count; ++s) {
var o = I.NegV(this.m_polygonB.normals[s], e.s_n), a = I.DotVV(o, I.SubVV(this.m_polygonB.vertices[s], this.m_v1, I.s_t0)), c = I.DotVV(o, I.SubVV(this.m_polygonB.vertices[s], this.m_v2, I.s_t0)), u = y(a, c);
if (u > this.m_radius) {
n.type = 2;
n.index = s;
n.separation = u;
return n;
}
if (I.DotVV(o, r) >= 0) {
if (I.DotVV(I.SubVV(o, this.m_upperLimit, I.s_t0), this.m_normal) < -l) continue;
} else if (I.DotVV(I.SubVV(o, this.m_lowerLimit, I.s_t0), this.m_normal) < -l) continue;
if (u > n.separation) {
n.type = 2;
n.index = s;
n.separation = u;
}
}
return n;
};
e.s_edge1 = new I();
e.s_edge0 = new I();
e.s_edge2 = new I();
e.s_ie = yt.MakeArray(2);
e.s_rf = new Ge();
e.s_clipPoints1 = yt.MakeArray(2);
e.s_clipPoints2 = yt.MakeArray(2);
e.s_edgeAxis = new ze();
e.s_polygonAxis = new ze();
e.s_n = new I();
e.s_perp = new I();
return e;
}())();
function He(t, e, i, n, r) {
Ue.Collide(t, e, i, n, r);
}
var je = function() {
this.mass = 0;
this.center = new I(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 We = (function() {
function e(e, i) {
this.m_type = t.b2ShapeType.e_unknown;
this.m_radius = 0;
this.m_type = e;
this.m_radius = i;
}
e.prototype.Copy = function(t) {
this.m_radius = t.m_radius;
return this;
};
e.prototype.GetType = function() {
return this.m_type;
};
return 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 Xe(t, e) {
qe(t, e);
function i() {
this.constructor = t;
}
t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i());
}
var Ye = (function(e) {
Xe(i, e);
function i(i) {
void 0 === i && (i = 0);
var n = e.call(this, t.b2ShapeType.e_circleShape, i) || this;
n.m_p = new I();
return n;
}
i.prototype.Set = function(t, e) {
void 0 === e && (e = this.m_radius);
this.m_p.Copy(t);
this.m_radius = e;
return this;
};
i.prototype.Clone = function() {
return new i().Copy(this);
};
i.prototype.Copy = function(t) {
e.prototype.Copy.call(this, t);
this.m_p.Copy(t.m_p);
return this;
};
i.prototype.GetChildCount = function() {
return 1;
};
i.prototype.TestPoint = function(t, e) {
var n = V.MulXV(t, this.m_p, i.TestPoint_s_center), r = I.SubVV(e, n, i.TestPoint_s_d);
return I.DotVV(r, r) <= C(this.m_radius);
};
i.prototype.ComputeDistance = function(t, e, n) {
var r = V.MulXV(t, this.m_p, i.ComputeDistance_s_center);
I.SubVV(e, r, n);
return n.Normalize() - this.m_radius;
};
i.prototype.RayCast = function(t, e, r) {
var s = V.MulXV(r, this.m_p, i.RayCast_s_position), o = I.SubVV(e.p1, s, i.RayCast_s_s), a = I.DotVV(o, o) - C(this.m_radius), c = I.SubVV(e.p2, e.p1, i.RayCast_s_r), l = I.DotVV(o, c), u = I.DotVV(c, c), h = l * l - u * a;
if (h < 0 || u < n) return !1;
var _ = -(l + A(h));
if (0 <= _ && _ <= e.maxFraction * u) {
_ /= u;
t.fraction = _;
I.AddVMulSV(o, _, c, t.normal).SelfNormalize();
return !0;
}
return !1;
};
i.prototype.ComputeAABB = function(t, e) {
var n = V.MulXV(e, this.m_p, i.ComputeAABB_s_p);
t.lowerBound.Set(n.x - this.m_radius, n.y - this.m_radius);
t.upperBound.Set(n.x + this.m_radius, n.y + this.m_radius);
};
i.prototype.ComputeMass = function(t, e) {
var i = C(this.m_radius);
t.mass = e * s * i;
t.center.Copy(this.m_p);
t.I = t.mass * (.5 * i + I.DotVV(this.m_p, this.m_p));
};
i.prototype.SetupDistanceProxy = function(t) {
t.m_vertices = t.m_buffer;
t.m_vertices[0].Copy(this.m_p);
t.m_count = 1;
t.m_radius = this.m_radius;
};
i.prototype.ComputeSubmergedArea = function(t, e, i, r) {
var o = V.MulXV(i, this.m_p, new I()), a = -(I.DotVV(t, o) - e);
if (a < -this.m_radius + n) return 0;
if (a > this.m_radius) {
r.Copy(o);
return s * this.m_radius * this.m_radius;
}
var c = this.m_radius * this.m_radius, l = a * a, u = c * (M(a / this.m_radius) + s / 2) + a * A(c - l), h = -2 / 3 * S(c - l, 1.5) / u;
r.x = o.x + t.x * h;
r.y = o.y + t.y * h;
return u;
};
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 I();
i.TestPoint_s_d = new I();
i.ComputeDistance_s_center = new I();
i.RayCast_s_position = new I();
i.RayCast_s_s = new I();
i.RayCast_s_r = new I();
i.ComputeAABB_s_p = new I();
return i;
})(We), Je = (function(e) {
Xe(r, e);
function r() {
var i = e.call(this, t.b2ShapeType.e_polygonShape, u) || this;
i.m_centroid = new I(0, 0);
i.m_vertices = [];
i.m_normals = [];
i.m_count = 0;
return i;
}
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 = I.MakeArray(this.m_count);
this.m_normals = I.MakeArray(this.m_count);
for (var i = 0; i < this.m_count; ++i) {
this.m_vertices[i].Copy(t.m_vertices[i]);
this.m_normals[i].Copy(t.m_normals[i]);
}
return this;
};
r.prototype.GetChildCount = function() {
return 1;
};
r.prototype.Set = function(t, e, i) {
void 0 === e && (e = t.length);
void 0 === i && (i = 0);
if (e < 3) return this.SetAsBox(1, 1);
for (var n = y(e, a), s = r.Set_s_ps, o = 0, l = 0; l < n; ++l) {
for (var u = t[i + l], h = !0, _ = 0; _ < o; ++_) if (I.DistanceSquaredVV(u, s[_]) < .25 * c * c) {
h = !1;
break;
}
h && s[o++].Copy(u);
}
if ((n = o) < 3) return this.SetAsBox(1, 1);
var f = 0, d = s[0].x;
for (l = 1; l < n; ++l) {
var p = s[l].x;
if (p > d || p === d && s[l].y < s[f].y) {
f = l;
d = p;
}
}
for (var m = r.Set_s_hull, v = 0, g = f; ;) {
m[v] = g;
var b = 0;
for (_ = 1; _ < n; ++_) if (b !== g) {
var C = I.SubVV(s[b], s[m[v]], r.Set_s_r), x = (u = I.SubVV(s[_], s[m[v]], r.Set_s_v), 
I.CrossVV(C, u));
x < 0 && (b = _);
0 === x && u.LengthSquared() > C.LengthSquared() && (b = _);
} else b = _;
++v;
g = b;
if (b === f) break;
}
this.m_count = v;
this.m_vertices = I.MakeArray(this.m_count);
this.m_normals = I.MakeArray(this.m_count);
for (l = 0; l < v; ++l) this.m_vertices[l].Copy(s[m[l]]);
for (l = 0; l < v; ++l) {
var A = this.m_vertices[l], S = this.m_vertices[(l + 1) % v], T = I.SubVV(S, A, I.s_t0);
I.CrossVOne(T, this.m_normals[l]).SelfNormalize();
}
r.ComputeCentroid(this.m_vertices, v, this.m_centroid);
return this;
};
r.prototype.SetAsArray = function(t, e) {
void 0 === e && (e = t.length);
return this.Set(t, e);
};
r.prototype.SetAsBox = function(t, e, i, n) {
void 0 === n && (n = 0);
this.m_count = 4;
this.m_vertices = I.MakeArray(this.m_count);
this.m_normals = I.MakeArray(this.m_count);
this.m_vertices[0].Set(-t, -e);
this.m_vertices[1].Set(t, -e);
this.m_vertices[2].Set(t, e);
this.m_vertices[3].Set(-t, e);
this.m_normals[0].Set(0, -1);
this.m_normals[1].Set(1, 0);
this.m_normals[2].Set(0, 1);
this.m_normals[3].Set(-1, 0);
this.m_centroid.SetZero();
if (i) {
this.m_centroid.Copy(i);
var r = new V();
r.SetPosition(i);
r.SetRotationAngle(n);
for (var s = 0; s < this.m_count; ++s) {
V.MulXV(r, this.m_vertices[s], this.m_vertices[s]);
O.MulRV(r.q, this.m_normals[s], this.m_normals[s]);
}
}
return this;
};
r.prototype.TestPoint = function(t, e) {
for (var i = V.MulTXV(t, e, r.TestPoint_s_pLocal), n = 0; n < this.m_count; ++n) if (I.DotVV(this.m_normals[n], I.SubVV(i, this.m_vertices[n], I.s_t0)) > 0) return !1;
return !0;
};
r.prototype.ComputeDistance = function(t, e, n) {
for (var s = V.MulTXV(t, e, r.ComputeDistance_s_pLocal), o = -i, a = r.ComputeDistance_s_normalForMaxDistance.Copy(s), c = 0; c < this.m_count; ++c) {
var l = I.DotVV(this.m_normals[c], I.SubVV(s, this.m_vertices[c], I.s_t0));
if (l > o) {
o = l;
a.Copy(this.m_normals[c]);
}
}
if (o > 0) {
var u = r.ComputeDistance_s_minDistance.Copy(a), h = o * o;
for (c = 0; c < this.m_count; ++c) {
var _ = I.SubVV(s, this.m_vertices[c], r.ComputeDistance_s_distance), f = _.LengthSquared();
if (h > f) {
u.Copy(_);
h = f;
}
}
O.MulRV(t.q, u, n);
n.Normalize();
return Math.sqrt(h);
}
O.MulRV(t.q, a, n);
return o;
};
r.prototype.RayCast = function(t, e, i) {
for (var n = V.MulTXV(i, e.p1, r.RayCast_s_p1), s = V.MulTXV(i, e.p2, r.RayCast_s_p2), o = I.SubVV(s, n, r.RayCast_s_d), a = 0, c = e.maxFraction, l = -1, u = 0; u < this.m_count; ++u) {
var h = I.DotVV(this.m_normals[u], I.SubVV(this.m_vertices[u], n, I.s_t0)), _ = I.DotVV(this.m_normals[u], o);
if (0 === _) {
if (h < 0) return !1;
} else if (_ < 0 && h < a * _) {
a = h / _;
l = u;
} else _ > 0 && h < c * _ && (c = h / _);
if (c < a) return !1;
}
if (l >= 0) {
t.fraction = a;
O.MulRV(i.q, this.m_normals[l], t.normal);
return !0;
}
return !1;
};
r.prototype.ComputeAABB = function(t, e) {
for (var i = V.MulXV(e, this.m_vertices[0], t.lowerBound), n = t.upperBound.Copy(i), s = 0; s < this.m_count; ++s) {
var o = V.MulXV(e, this.m_vertices[s], r.ComputeAABB_s_v);
I.MinV(o, i, i);
I.MaxV(o, n, n);
}
var a = this.m_radius;
i.SelfSubXY(a, a);
n.SelfAddXY(a, a);
};
r.prototype.ComputeMass = function(t, e) {
for (var i = r.ComputeMass_s_center.SetZero(), n = 0, s = 0, o = r.ComputeMass_s_s.SetZero(), a = 0; a < this.m_count; ++a) o.SelfAdd(this.m_vertices[a]);
o.SelfMul(1 / this.m_count);
for (a = 0; a < this.m_count; ++a) {
var c = I.SubVV(this.m_vertices[a], o, r.ComputeMass_s_e1), l = I.SubVV(this.m_vertices[(a + 1) % this.m_count], o, r.ComputeMass_s_e2), u = I.CrossVV(c, l), h = .5 * u;
n += h;
i.SelfAdd(I.MulSV(h * (1 / 3), I.AddVV(c, l, I.s_t0), I.s_t1));
var _ = c.x, f = c.y, d = l.x, p = l.y;
s += 1 / 3 * .25 * u * (_ * _ + d * _ + d * d + f * f + p * f + p * p);
}
t.mass = e * n;
i.SelfMul(1 / n);
I.AddVV(i, o, t.center);
t.I = e * s;
t.I += t.mass * (I.DotVV(t.center, t.center) - I.DotVV(i, i));
};
r.prototype.Validate = function() {
for (var t = 0; t < this.m_count; ++t) for (var e = t, i = (t + 1) % this.m_count, n = this.m_vertices[e], s = I.SubVV(this.m_vertices[i], n, r.Validate_s_e), o = 0; o < this.m_count; ++o) if (o !== e && o !== i) {
var a = I.SubVV(this.m_vertices[o], n, r.Validate_s_v);
if (I.CrossVV(s, a) < 0) return !1;
}
return !0;
};
r.prototype.SetupDistanceProxy = function(t) {
t.m_vertices = this.m_vertices;
t.m_count = this.m_count;
t.m_radius = this.m_radius;
};
r.prototype.ComputeSubmergedArea = function(t, e, i, s) {
for (var o = O.MulTRV(i.q, t, r.ComputeSubmergedArea_s_normalL), a = e - I.DotVV(t, i.p), c = r.ComputeSubmergedArea_s_depths, l = 0, u = -1, h = -1, _ = !1, f = 0; f < this.m_count; ++f) {
c[f] = I.DotVV(o, this.m_vertices[f]) - a;
var d = c[f] < -n;
if (f > 0) if (d) {
if (!_) {
u = f - 1;
l++;
}
} else if (_) {
h = f - 1;
l++;
}
_ = d;
}
switch (l) {
case 0:
if (_) {
var p = r.ComputeSubmergedArea_s_md;
this.ComputeMass(p, 1);
V.MulXV(i, p.center, s);
return p.mass;
}
return 0;

case 1:
-1 === u ? u = this.m_count - 1 : h = this.m_count - 1;
}
for (var m, y = (u + 1) % this.m_count, v = (h + 1) % this.m_count, g = (0 - c[u]) / (c[y] - c[u]), b = (0 - c[h]) / (c[v] - c[h]), C = r.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[u].x * (1 - g) + this.m_vertices[y].x * g, this.m_vertices[u].y * (1 - g) + this.m_vertices[y].y * g), x = r.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[h].x * (1 - b) + this.m_vertices[v].x * b, this.m_vertices[h].y * (1 - b) + this.m_vertices[v].y * b), A = 0, S = r.ComputeSubmergedArea_s_center.SetZero(), T = this.m_vertices[y], w = y; w !== v; ) {
m = (w = (w + 1) % this.m_count) === v ? x : this.m_vertices[w];
var E = .5 * ((T.x - C.x) * (m.y - C.y) - (T.y - C.y) * (m.x - C.x));
A += E;
S.x += E * (C.x + T.x + m.x) / 3;
S.y += E * (C.y + T.y + m.y) / 3;
T = m;
}
S.SelfMul(1 / A);
V.MulXV(i, S, s);
return A;
};
r.prototype.Dump = function(t) {
t("    const shape: b2PolygonShape = new b2PolygonShape();\n");
t("    const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n", a);
for (var e = 0; e < this.m_count; ++e) t("    vs[%d].Set(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y);
t("    shape.Set(vs, %d);\n", this.m_count);
};
r.ComputeCentroid = function(t, e, i) {
var n = i;
n.SetZero();
for (var s = 0, o = r.ComputeCentroid_s_pRef.SetZero(), a = 0; a < e; ++a) {
var c = o, l = t[a], u = t[(a + 1) % e], h = I.SubVV(l, c, r.ComputeCentroid_s_e1), _ = I.SubVV(u, c, r.ComputeCentroid_s_e2), f = .5 * I.CrossVV(h, _);
s += f;
n.x += f * (1 / 3) * (c.x + l.x + u.x);
n.y += f * (1 / 3) * (c.y + l.y + u.y);
}
n.SelfMul(1 / s);
return n;
};
r.Set_s_ps = I.MakeArray(a);
r.Set_s_hull = p(a);
r.Set_s_r = new I();
r.Set_s_v = new I();
r.TestPoint_s_pLocal = new I();
r.ComputeDistance_s_pLocal = new I();
r.ComputeDistance_s_normalForMaxDistance = new I();
r.ComputeDistance_s_minDistance = new I();
r.ComputeDistance_s_distance = new I();
r.RayCast_s_p1 = new I();
r.RayCast_s_p2 = new I();
r.RayCast_s_d = new I();
r.ComputeAABB_s_v = new I();
r.ComputeMass_s_center = new I();
r.ComputeMass_s_s = new I();
r.ComputeMass_s_e1 = new I();
r.ComputeMass_s_e2 = new I();
r.Validate_s_e = new I();
r.Validate_s_v = new I();
r.ComputeSubmergedArea_s_normalL = new I();
r.ComputeSubmergedArea_s_depths = p(a);
r.ComputeSubmergedArea_s_md = new je();
r.ComputeSubmergedArea_s_intoVec = new I();
r.ComputeSubmergedArea_s_outoVec = new I();
r.ComputeSubmergedArea_s_center = new I();
r.ComputeCentroid_s_pRef = new I();
r.ComputeCentroid_s_e1 = new I();
r.ComputeCentroid_s_e2 = new I();
return r;
})(We), Ze = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2ShapeType.e_edgeShape, u) || this;
i.m_vertex1 = new I();
i.m_vertex2 = new I();
i.m_vertex0 = new I();
i.m_vertex3 = new I();
i.m_hasVertex0 = !1;
i.m_hasVertex3 = !1;
return i;
}
i.prototype.Set = function(t, e) {
this.m_vertex1.Copy(t);
this.m_vertex2.Copy(e);
this.m_hasVertex0 = !1;
this.m_hasVertex3 = !1;
return this;
};
i.prototype.Clone = function() {
return new i().Copy(this);
};
i.prototype.Copy = function(t) {
e.prototype.Copy.call(this, t);
this.m_vertex1.Copy(t.m_vertex1);
this.m_vertex2.Copy(t.m_vertex2);
this.m_vertex0.Copy(t.m_vertex0);
this.m_vertex3.Copy(t.m_vertex3);
this.m_hasVertex0 = t.m_hasVertex0;
this.m_hasVertex3 = t.m_hasVertex3;
return this;
};
i.prototype.GetChildCount = function() {
return 1;
};
i.prototype.TestPoint = function() {
return !1;
};
i.prototype.ComputeDistance = function(t, e, n) {
var r = V.MulXV(t, this.m_vertex1, i.ComputeDistance_s_v1), s = V.MulXV(t, this.m_vertex2, i.ComputeDistance_s_v2), o = I.SubVV(e, r, i.ComputeDistance_s_d), a = I.SubVV(s, r, i.ComputeDistance_s_s), c = I.DotVV(o, a);
if (c > 0) {
var l = I.DotVV(a, a);
c > l ? I.SubVV(e, s, o) : o.SelfMulSub(c / l, a);
}
n.Copy(o);
return n.Normalize();
};
i.prototype.RayCast = function(t, e, n) {
var r = V.MulTXV(n, e.p1, i.RayCast_s_p1), s = V.MulTXV(n, e.p2, i.RayCast_s_p2), o = I.SubVV(s, r, i.RayCast_s_d), a = this.m_vertex1, c = this.m_vertex2, l = I.SubVV(c, a, i.RayCast_s_e), u = t.normal.Set(l.y, -l.x).SelfNormalize(), h = I.DotVV(u, I.SubVV(a, r, I.s_t0)), _ = I.DotVV(u, o);
if (0 === _) return !1;
var f = h / _;
if (f < 0 || e.maxFraction < f) return !1;
var d = I.AddVMulSV(r, f, o, i.RayCast_s_q), p = I.SubVV(c, a, i.RayCast_s_r), m = I.DotVV(p, p);
if (0 === m) return !1;
var y = I.DotVV(I.SubVV(d, a, I.s_t0), p) / m;
if (y < 0 || 1 < y) return !1;
t.fraction = f;
O.MulRV(n.q, t.normal, t.normal);
h > 0 && t.normal.SelfNeg();
return !0;
};
i.prototype.ComputeAABB = function(t, e) {
var n = V.MulXV(e, this.m_vertex1, i.ComputeAABB_s_v1), r = V.MulXV(e, this.m_vertex2, i.ComputeAABB_s_v2);
I.MinV(n, r, t.lowerBound);
I.MaxV(n, r, t.upperBound);
var s = this.m_radius;
t.lowerBound.SelfSubXY(s, s);
t.upperBound.SelfAddXY(s, s);
};
i.prototype.ComputeMass = function(t) {
t.mass = 0;
I.MidVV(this.m_vertex1, this.m_vertex2, t.center);
t.I = 0;
};
i.prototype.SetupDistanceProxy = function(t) {
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) {
n.SetZero();
return 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 I();
i.ComputeDistance_s_v2 = new I();
i.ComputeDistance_s_d = new I();
i.ComputeDistance_s_s = new I();
i.RayCast_s_p1 = new I();
i.RayCast_s_p2 = new I();
i.RayCast_s_d = new I();
i.RayCast_s_e = new I();
i.RayCast_s_q = new I();
i.RayCast_s_r = new I();
i.ComputeAABB_s_v1 = new I();
i.ComputeAABB_s_v2 = new I();
return i;
})(We), Ke = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2ShapeType.e_chainShape, u) || this;
i.m_vertices = [];
i.m_count = 0;
i.m_prevVertex = new I();
i.m_nextVertex = new I();
i.m_hasPrevVertex = !1;
i.m_hasNextVertex = !1;
return i;
}
i.prototype.CreateLoop = function(t, e, i) {
void 0 === e && (e = t.length);
void 0 === i && (i = 0);
if (e < 3) return this;
this.m_count = e + 1;
this.m_vertices = I.MakeArray(this.m_count);
for (var n = 0; n < e; ++n) this.m_vertices[n].Copy(t[i + n]);
this.m_vertices[e].Copy(this.m_vertices[0]);
this.m_prevVertex.Copy(this.m_vertices[this.m_count - 2]);
this.m_nextVertex.Copy(this.m_vertices[1]);
this.m_hasPrevVertex = !0;
this.m_hasNextVertex = !0;
return this;
};
i.prototype.CreateChain = function(t, e, i) {
void 0 === e && (e = t.length);
void 0 === i && (i = 0);
this.m_count = e;
this.m_vertices = I.MakeArray(e);
for (var n = 0; n < e; ++n) this.m_vertices[n].Copy(t[i + n]);
this.m_hasPrevVertex = !1;
this.m_hasNextVertex = !1;
this.m_prevVertex.SetZero();
this.m_nextVertex.SetZero();
return this;
};
i.prototype.SetPrevVertex = function(t) {
this.m_prevVertex.Copy(t);
this.m_hasPrevVertex = !0;
return this;
};
i.prototype.SetNextVertex = function(t) {
this.m_nextVertex.Copy(t);
this.m_hasNextVertex = !0;
return this;
};
i.prototype.Clone = function() {
return new i().Copy(this);
};
i.prototype.Copy = function(t) {
e.prototype.Copy.call(this, t);
this.CreateChain(t.m_vertices, t.m_count);
this.m_prevVertex.Copy(t.m_prevVertex);
this.m_nextVertex.Copy(t.m_nextVertex);
this.m_hasPrevVertex = t.m_hasPrevVertex;
this.m_hasNextVertex = t.m_hasNextVertex;
return this;
};
i.prototype.GetChildCount = function() {
return this.m_count - 1;
};
i.prototype.GetChildEdge = function(e, i) {
e.m_type = t.b2ShapeType.e_edgeShape;
e.m_radius = this.m_radius;
e.m_vertex1.Copy(this.m_vertices[i]);
e.m_vertex2.Copy(this.m_vertices[i + 1]);
if (i > 0) {
e.m_vertex0.Copy(this.m_vertices[i - 1]);
e.m_hasVertex0 = !0;
} else {
e.m_vertex0.Copy(this.m_prevVertex);
e.m_hasVertex0 = this.m_hasPrevVertex;
}
if (i < this.m_count - 2) {
e.m_vertex3.Copy(this.m_vertices[i + 2]);
e.m_hasVertex3 = !0;
} else {
e.m_vertex3.Copy(this.m_nextVertex);
e.m_hasVertex3 = this.m_hasNextVertex;
}
};
i.prototype.TestPoint = function() {
return !1;
};
i.prototype.ComputeDistance = function(t, e, n, r) {
var s = i.ComputeDistance_s_edgeShape;
this.GetChildEdge(s, r);
return s.ComputeDistance(t, e, n, 0);
};
i.prototype.RayCast = function(t, e, n, r) {
var s = i.RayCast_s_edgeShape;
s.m_vertex1.Copy(this.m_vertices[r]);
s.m_vertex2.Copy(this.m_vertices[(r + 1) % this.m_count]);
return s.RayCast(t, e, n, 0);
};
i.prototype.ComputeAABB = function(t, e, n) {
var r = this.m_vertices[n], s = this.m_vertices[(n + 1) % this.m_count], o = V.MulXV(e, r, i.ComputeAABB_s_v1), a = V.MulXV(e, s, i.ComputeAABB_s_v2);
I.MinV(o, a, t.lowerBound);
I.MaxV(o, a, t.upperBound);
};
i.prototype.ComputeMass = function(t) {
t.mass = 0;
t.center.SetZero();
t.I = 0;
};
i.prototype.SetupDistanceProxy = function(t, e) {
t.m_vertices = t.m_buffer;
t.m_vertices[0].Copy(this.m_vertices[e]);
e + 1 < this.m_count ? t.m_vertices[1].Copy(this.m_vertices[e + 1]) : t.m_vertices[1].Copy(this.m_vertices[0]);
t.m_count = 2;
t.m_radius = this.m_radius;
};
i.prototype.ComputeSubmergedArea = function(t, e, i, n) {
n.SetZero();
return 0;
};
i.prototype.Dump = function(t) {
t("    const shape: b2ChainShape = new b2ChainShape();\n");
t("    const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n", a);
for (var e = 0; e < this.m_count; ++e) t("    vs[%d].Set(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y);
t("    shape.CreateChain(vs, %d);\n", this.m_count);
t("    shape.m_prevVertex.Set(%.15f, %.15f);\n", this.m_prevVertex.x, this.m_prevVertex.y);
t("    shape.m_nextVertex.Set(%.15f, %.15f);\n", this.m_nextVertex.x, this.m_nextVertex.y);
t("    shape.m_hasPrevVertex = %s;\n", this.m_hasPrevVertex ? "true" : "false");
t("    shape.m_hasNextVertex = %s;\n", this.m_hasNextVertex ? "true" : "false");
};
i.ComputeDistance_s_edgeShape = new Ze();
i.RayCast_s_edgeShape = new Ze();
i.ComputeAABB_s_v1 = new I();
i.ComputeAABB_s_v2 = new I();
return i;
})(We), Qe = (function() {
function t() {
this.categoryBits = 1;
this.maskBits = 65535;
this.groupIndex = 0;
}
t.prototype.Clone = function() {
return new t().Copy(this);
};
t.prototype.Copy = function(t) {
this.categoryBits = t.categoryBits;
this.maskBits = t.maskBits;
this.groupIndex = t.groupIndex || 0;
return this;
};
t.DEFAULT = new t();
return t;
})(), $e = function() {
this.userData = null;
this.friction = .2;
this.restitution = 0;
this.density = 0;
this.isSensor = !1;
this.filter = new Qe();
}, ti = function(t) {
this.aabb = new bt();
this.childIndex = 0;
this.fixture = t;
}, ei = (function() {
function t(t, e) {
this.m_density = 0;
this.m_next = null;
this.m_friction = 0;
this.m_restitution = 0;
this.m_proxies = [];
this.m_proxyCount = 0;
this.m_filter = new Qe();
this.m_isSensor = !1;
this.m_userData = null;
this.m_body = e;
this.m_shape = t.shape.Clone();
}
t.prototype.GetType = function() {
return this.m_shape.GetType();
};
t.prototype.GetShape = function() {
return this.m_shape;
};
t.prototype.SetSensor = function(t) {
if (t !== this.m_isSensor) {
this.m_body.SetAwake(!0);
this.m_isSensor = t;
}
};
t.prototype.IsSensor = function() {
return this.m_isSensor;
};
t.prototype.SetFilterData = function(t) {
this.m_filter.Copy(t);
this.Refilter();
};
t.prototype.GetFilterData = function() {
return this.m_filter;
};
t.prototype.Refilter = function() {
for (var t = this.m_body.GetContactList(); t; ) {
var e = t.contact, i = e.GetFixtureA(), n = e.GetFixtureB();
i !== this && n !== this || e.FlagForFiltering();
t = t.next;
}
var r = this.m_body.GetWorld();
if (null !== r) for (var s = r.m_contactManager.m_broadPhase, o = 0; o < this.m_proxyCount; ++o) s.TouchProxy(this.m_proxies[o].treeNode);
};
t.prototype.GetBody = function() {
return this.m_body;
};
t.prototype.GetNext = function() {
return this.m_next;
};
t.prototype.GetUserData = function() {
return this.m_userData;
};
t.prototype.SetUserData = function(t) {
this.m_userData = t;
};
t.prototype.TestPoint = function(t) {
return this.m_shape.TestPoint(this.m_body.GetTransform(), t);
};
t.prototype.ComputeDistance = function(t, e, i) {
return this.m_shape.ComputeDistance(this.m_body.GetTransform(), t, e, i);
};
t.prototype.RayCast = function(t, e, i) {
return this.m_shape.RayCast(t, e, this.m_body.GetTransform(), i);
};
t.prototype.GetMassData = function(t) {
void 0 === t && (t = new je());
this.m_shape.ComputeMass(t, this.m_density);
return t;
};
t.prototype.SetDensity = function(t) {
this.m_density = t;
};
t.prototype.GetDensity = function() {
return this.m_density;
};
t.prototype.GetFriction = function() {
return this.m_friction;
};
t.prototype.SetFriction = function(t) {
this.m_friction = t;
};
t.prototype.GetRestitution = function() {
return this.m_restitution;
};
t.prototype.SetRestitution = function(t) {
this.m_restitution = t;
};
t.prototype.GetAABB = function(t) {
return this.m_proxies[t].aabb;
};
t.prototype.Dump = function(t, e) {
t("    const fd: b2FixtureDef = new b2FixtureDef();\n");
t("    fd.friction = %.15f;\n", this.m_friction);
t("    fd.restitution = %.15f;\n", this.m_restitution);
t("    fd.density = %.15f;\n", this.m_density);
t("    fd.isSensor = %s;\n", this.m_isSensor ? "true" : "false");
t("    fd.filter.categoryBits = %d;\n", this.m_filter.categoryBits);
t("    fd.filter.maskBits = %d;\n", this.m_filter.maskBits);
t("    fd.filter.groupIndex = %d;\n", this.m_filter.groupIndex);
this.m_shape.Dump(t);
t("\n");
t("    fd.shape = shape;\n");
t("\n");
t("    bodies[%d].CreateFixture(fd);\n", e);
};
t.prototype.Create = function(t) {
var i = this;
this.m_userData = t.userData;
this.m_friction = e(t.friction, .2);
this.m_restitution = e(t.restitution, 0);
this.m_next = null;
this.m_filter.Copy(e(t.filter, Qe.DEFAULT));
this.m_isSensor = e(t.isSensor, !1);
this.m_proxies = d(this.m_shape.GetChildCount(), (function() {
return new ti(i);
}));
this.m_proxyCount = 0;
this.m_density = e(t.density, 0);
};
t.prototype.Destroy = function() {};
t.prototype.CreateProxies = function(t) {
var e = this.m_body.m_world.m_contactManager.m_broadPhase;
this.m_proxyCount = this.m_shape.GetChildCount();
for (var i = 0; i < this.m_proxyCount; ++i) {
var n = this.m_proxies[i] = new ti(this);
this.m_shape.ComputeAABB(n.aabb, t, i);
n.treeNode = e.CreateProxy(n.aabb, n);
n.childIndex = i;
}
};
t.prototype.DestroyProxies = function() {
for (var t = this.m_body.m_world.m_contactManager.m_broadPhase, e = 0; e < this.m_proxyCount; ++e) {
var i = this.m_proxies[e];
delete i.treeNode.userData;
t.DestroyProxy(i.treeNode);
delete i.treeNode;
}
this.m_proxyCount = 0;
};
t.prototype.TouchProxies = function() {
for (var t = this.m_body.m_world.m_contactManager.m_broadPhase, e = this.m_proxyCount, i = 0; i < e; ++i) t.TouchProxy(this.m_proxies[i].treeNode);
};
t.prototype.Synchronize = function(e, i) {
if (0 !== this.m_proxyCount) for (var n = this.m_body.m_world.m_contactManager.m_broadPhase, r = 0; r < this.m_proxyCount; ++r) {
var s = this.m_proxies[r], o = t.Synchronize_s_aabb1, a = t.Synchronize_s_aabb2;
this.m_shape.ComputeAABB(o, e, r);
this.m_shape.ComputeAABB(a, i, r);
s.aabb.Combine2(o, a);
var c = I.SubVV(i.p, e.p, t.Synchronize_s_displacement);
n.MoveProxy(s.treeNode, s.aabb, c);
}
};
t.Synchronize_s_aabb1 = new bt();
t.Synchronize_s_aabb2 = new bt();
t.Synchronize_s_displacement = new I();
return t;
})();
(function(t) {
t[t.b2_unknown = -1] = "b2_unknown";
t[t.b2_staticBody = 0] = "b2_staticBody";
t[t.b2_kinematicBody = 1] = "b2_kinematicBody";
t[t.b2_dynamicBody = 2] = "b2_dynamicBody";
})(t.b2BodyType || (t.b2BodyType = {}));
var ii = (function() {
function i(i, n) {
this.m_type = t.b2BodyType.b2_staticBody;
this.m_islandFlag = !1;
this.m_awakeFlag = !1;
this.m_autoSleepFlag = !1;
this.m_bulletFlag = !1;
this.m_fixedRotationFlag = !1;
this.m_activeFlag = !1;
this.m_toiFlag = !1;
this.m_islandIndex = 0;
this.m_xf = new V();
this.m_xf0 = new V();
this.m_sweep = new N();
this.m_linearVelocity = new I();
this.m_angularVelocity = 0;
this.m_force = new I();
this.m_torque = 0;
this.m_prev = null;
this.m_next = null;
this.m_fixtureList = null;
this.m_fixtureCount = 0;
this.m_jointList = null;
this.m_contactList = null;
this.m_mass = 1;
this.m_invMass = 1;
this.m_I = 0;
this.m_invI = 0;
this.m_linearDamping = 0;
this.m_angularDamping = 0;
this.m_gravityScale = 1;
this.m_sleepTime = 0;
this.m_userData = null;
this.m_controllerList = null;
this.m_controllerCount = 0;
this.m_bulletFlag = e(i.bullet, !1);
this.m_fixedRotationFlag = e(i.fixedRotation, !1);
this.m_autoSleepFlag = e(i.allowSleep, !0);
this.m_awakeFlag = e(i.awake, !0);
this.m_activeFlag = e(i.active, !0);
this.m_world = n;
this.m_xf.p.Copy(e(i.position, I.ZERO));
this.m_xf.q.SetAngle(e(i.angle, 0));
this.m_xf0.Copy(this.m_xf);
this.m_sweep.localCenter.SetZero();
this.m_sweep.c0.Copy(this.m_xf.p);
this.m_sweep.c.Copy(this.m_xf.p);
this.m_sweep.a0 = this.m_sweep.a = this.m_xf.q.GetAngle();
this.m_sweep.alpha0 = 0;
this.m_linearVelocity.Copy(e(i.linearVelocity, I.ZERO));
this.m_angularVelocity = e(i.angularVelocity, 0);
this.m_linearDamping = e(i.linearDamping, 0);
this.m_angularDamping = e(i.angularDamping, 0);
this.m_gravityScale = e(i.gravityScale, 1);
this.m_force.SetZero();
this.m_torque = 0;
this.m_sleepTime = 0;
this.m_type = e(i.type, t.b2BodyType.b2_staticBody);
if (i.type === t.b2BodyType.b2_dynamicBody) {
this.m_mass = 1;
this.m_invMass = 1;
} else {
this.m_mass = 0;
this.m_invMass = 0;
}
this.m_I = 0;
this.m_invI = 0;
this.m_userData = i.userData;
this.m_fixtureList = null;
this.m_fixtureCount = 0;
this.m_controllerList = null;
this.m_controllerCount = 0;
}
i.prototype.CreateFixture = function(t, e) {
void 0 === e && (e = 0);
return t instanceof We ? this.CreateFixtureShapeDensity(t, e) : this.CreateFixtureDef(t);
};
i.prototype.CreateFixtureDef = function(t) {
if (this.m_world.IsLocked()) throw new Error();
var e = new ei(t, this);
e.Create(t);
this.m_activeFlag && e.CreateProxies(this.m_xf);
e.m_next = this.m_fixtureList;
this.m_fixtureList = e;
++this.m_fixtureCount;
e.m_density > 0 && this.ResetMassData();
this.m_world.m_newFixture = !0;
return e;
};
i.prototype.CreateFixtureShapeDensity = function(t, e) {
void 0 === e && (e = 0);
var n = i.CreateFixtureShapeDensity_s_def;
n.shape = t;
n.density = e;
return 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(), o = r.GetFixtureB();
t !== s && t !== o || 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);
V.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) {
if (this.m_type !== t.b2BodyType.b2_staticBody) {
I.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) {
if (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) {
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();
return t;
};
i.prototype.ApplyForce = function(e, i, n) {
void 0 === n && (n = !0);
if (this.m_type === t.b2BodyType.b2_dynamicBody) {
n && !this.m_awakeFlag && this.SetAwake(!0);
if (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);
if (this.m_type === t.b2BodyType.b2_dynamicBody) {
i && !this.m_awakeFlag && this.SetAwake(!0);
if (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);
if (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);
if (this.m_type === t.b2BodyType.b2_dynamicBody) {
n && !this.m_awakeFlag && this.SetAwake(!0);
if (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);
if (this.m_type === t.b2BodyType.b2_dynamicBody) {
i && !this.m_awakeFlag && this.SetAwake(!0);
if (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);
if (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 * I.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter);
};
i.prototype.GetMassData = function(t) {
t.mass = this.m_mass;
t.I = this.m_I + this.m_mass * I.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter);
t.center.Copy(this.m_sweep.localCenter);
return 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;
if (e.I > 0 && !this.m_fixedRotationFlag) {
this.m_I = e.I - this.m_mass * I.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);
V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c);
this.m_sweep.c0.Copy(this.m_sweep.c);
I.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, I.SubVV(this.m_sweep.c, n, I.s_t0), this.m_linearVelocity);
}
};
i.prototype.ResetMassData = function() {
this.m_mass = 0;
this.m_invMass = 0;
this.m_I = 0;
this.m_invI = 0;
this.m_sweep.localCenter.SetZero();
if (this.m_type !== t.b2BodyType.b2_staticBody && this.m_type !== t.b2BodyType.b2_kinematicBody) {
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;
}
if (this.m_mass > 0) {
this.m_invMass = 1 / this.m_mass;
e.x *= this.m_invMass;
e.y *= this.m_invMass;
} else {
this.m_mass = 1;
this.m_invMass = 1;
}
if (this.m_I > 0 && !this.m_fixedRotationFlag) {
this.m_I -= this.m_mass * I.DotVV(e, e);
this.m_invI = 1 / this.m_I;
} else {
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);
V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c);
this.m_sweep.c0.Copy(this.m_sweep.c);
I.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, I.SubVV(this.m_sweep.c, s, I.s_t0), this.m_linearVelocity);
} else {
this.m_sweep.c0.Copy(this.m_xf.p);
this.m_sweep.c.Copy(this.m_xf.p);
this.m_sweep.a0 = this.m_sweep.a;
}
};
i.prototype.GetWorldPoint = function(t, e) {
return V.MulXV(this.m_xf, t, e);
};
i.prototype.GetWorldVector = function(t, e) {
return O.MulRV(this.m_xf.q, t, e);
};
i.prototype.GetLocalPoint = function(t, e) {
return V.MulTXV(this.m_xf, t, e);
};
i.prototype.GetLocalVector = function(t, e) {
return O.MulTRV(this.m_xf.q, t, e);
};
i.prototype.GetLinearVelocityFromWorldPoint = function(t, e) {
return I.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, I.SubVV(t, this.m_sweep.c, I.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();
if (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) {
if (t) {
this.m_awakeFlag = !0;
this.m_sleepTime = 0;
} else {
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()) {
this.m_activeFlag = t;
if (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) {
if (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);
O.MulRV(t.q, this.m_sweep.localCenter, t.p);
I.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);
O.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p);
I.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);
O.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p);
I.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 $e();
i.SetMassData_s_oldCenter = new I();
i.ResetMassData_s_localCenter = new I();
i.ResetMassData_s_oldCenter = new I();
i.ResetMassData_s_massData = new je();
i.SynchronizeFixtures_s_xf1 = new V();
return 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 ni = (function() {
function t() {
this.linear = new I();
this.angularA = 0;
this.angularB = 0;
}
t.prototype.SetZero = function() {
this.linear.SetZero();
this.angularA = 0;
this.angularB = 0;
return this;
};
t.prototype.Set = function(t, e, i) {
this.linear.Copy(t);
this.angularA = e;
this.angularB = i;
return this;
};
return t;
})(), ri = function(t, e) {
this.prev = null;
this.next = null;
this.joint = t;
this.other = e;
}, si = function(e) {
this.type = t.b2JointType.e_unknownJoint;
this.userData = null;
this.collideConnected = !1;
this.type = e;
}, oi = (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 ri(this, i.bodyB);
this.m_edgeB = new ri(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;
}
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() {};
return i;
})(), ai = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_distanceJoint) || this;
i.localAnchorA = new I();
i.localAnchorB = new I();
i.length = 1;
i.frequencyHz = 0;
i.dampingRatio = 0;
return i;
}
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 = I.DistanceVV(i, n);
this.frequencyHz = 0;
this.dampingRatio = 0;
};
return i;
})(si), ci = (function(t) {
Xe(i, t);
function i(i) {
var n = t.call(this, i) || this;
n.m_frequencyHz = 0;
n.m_dampingRatio = 0;
n.m_bias = 0;
n.m_localAnchorA = new I();
n.m_localAnchorB = new I();
n.m_gamma = 0;
n.m_impulse = 0;
n.m_length = 0;
n.m_indexA = 0;
n.m_indexB = 0;
n.m_u = new I();
n.m_rA = new I();
n.m_rB = new I();
n.m_localCenterA = new I();
n.m_localCenterB = new I();
n.m_invMassA = 0;
n.m_invMassB = 0;
n.m_invIA = 0;
n.m_invIB = 0;
n.m_mass = 0;
n.m_qA = new O();
n.m_qB = new O();
n.m_lalcA = new I();
n.m_lalcB = new I();
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;
return n;
}
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) {
e.x = t * this.m_impulse * this.m_u.x;
e.y = t * this.m_impulse * this.m_u.y;
return e;
};
i.prototype.GetReactionTorque = function() {
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, o = t.velocities[this.m_indexA].w, a = t.positions[this.m_indexB].c, l = t.positions[this.m_indexB].a, u = t.velocities[this.m_indexB].v, h = t.velocities[this.m_indexB].w, _ = this.m_qA.SetAngle(n), f = this.m_qB.SetAngle(l);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
O.MulRV(_, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
O.MulRV(f, this.m_lalcB, this.m_rB);
this.m_u.x = a.x + this.m_rB.x - e.x - this.m_rA.x;
this.m_u.y = a.y + this.m_rB.y - e.y - this.m_rA.y;
var d = this.m_u.Length();
d > c ? this.m_u.SelfMul(1 / d) : this.m_u.SetZero();
var p = I.CrossVV(this.m_rA, this.m_u), m = I.CrossVV(this.m_rB, this.m_u), y = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m;
this.m_mass = 0 !== y ? 1 / y : 0;
if (this.m_frequencyHz > 0) {
var v = d - this.m_length, g = 2 * s * this.m_frequencyHz, b = 2 * this.m_mass * this.m_dampingRatio * g, C = this.m_mass * g * g, x = t.step.dt;
this.m_gamma = x * (b + x * C);
this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0;
this.m_bias = v * x * C * 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 A = I.MulSV(this.m_impulse, this.m_u, i.InitVelocityConstraints_s_P);
r.SelfMulSub(this.m_invMassA, A);
o -= this.m_invIA * I.CrossVV(this.m_rA, A);
u.SelfMulAdd(this.m_invMassB, A);
h += this.m_invIB * I.CrossVV(this.m_rB, A);
} else this.m_impulse = 0;
t.velocities[this.m_indexA].w = o;
t.velocities[this.m_indexB].w = h;
};
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, o = I.AddVCrossSV(e, n, this.m_rA, i.SolveVelocityConstraints_s_vpA), a = I.AddVCrossSV(r, s, this.m_rB, i.SolveVelocityConstraints_s_vpB), c = I.DotVV(this.m_u, I.SubVV(a, o, I.s_t0)), l = -this.m_mass * (c + this.m_bias + this.m_gamma * this.m_impulse);
this.m_impulse += l;
var u = I.MulSV(l, this.m_u, i.SolveVelocityConstraints_s_P);
e.SelfMulSub(this.m_invMassA, u);
n -= this.m_invIA * I.CrossVV(this.m_rA, u);
r.SelfMulAdd(this.m_invMassB, u);
s += this.m_invIB * I.CrossVV(this.m_rB, u);
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, o = this.m_qA.SetAngle(n), a = this.m_qB.SetAngle(s), l = O.MulRV(o, this.m_lalcA, this.m_rA), u = O.MulRV(a, this.m_lalcB, this.m_rB), h = this.m_u;
h.x = r.x + u.x - e.x - l.x;
h.y = r.y + u.y - e.y - l.y;
var _ = this.m_u.Normalize() - this.m_length;
_ = g(_, -.2, .2);
var f = -this.m_mass * _, d = I.MulSV(f, h, i.SolvePositionConstraints_s_P);
e.SelfMulSub(this.m_invMassA, d);
n -= this.m_invIA * I.CrossVV(l, d);
r.SelfMulAdd(this.m_invMassB, d);
s += this.m_invIB * I.CrossVV(u, d);
t.positions[this.m_indexA].a = n;
t.positions[this.m_indexB].a = s;
return m(_) < c;
};
i.InitVelocityConstraints_s_P = new I();
i.SolveVelocityConstraints_s_vpA = new I();
i.SolveVelocityConstraints_s_vpB = new I();
i.SolveVelocityConstraints_s_P = new I();
i.SolvePositionConstraints_s_P = new I();
return i;
})(oi), li = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_areaJoint) || this;
i.bodies = [];
i.frequencyHz = 0;
i.dampingRatio = 0;
return i;
}
i.prototype.AddBody = function(t) {
this.bodies.push(t);
1 === this.bodies.length ? this.bodyA = t : 2 === this.bodies.length && (this.bodyB = t);
};
return i;
})(si), ui = (function(t) {
Xe(i, t);
function i(i) {
var n = t.call(this, i) || this;
n.m_frequencyHz = 0;
n.m_dampingRatio = 0;
n.m_impulse = 0;
n.m_targetArea = 0;
n.m_bodies = i.bodies;
n.m_frequencyHz = e(i.frequencyHz, 0);
n.m_dampingRatio = e(i.dampingRatio, 0);
n.m_targetLengths = p(i.bodies.length);
n.m_normals = I.MakeArray(i.bodies.length);
n.m_joints = [];
n.m_deltas = I.MakeArray(i.bodies.length);
n.m_delta = new I();
var r = new ai();
r.frequencyHz = n.m_frequencyHz;
r.dampingRatio = n.m_dampingRatio;
n.m_targetArea = 0;
for (var s = 0; s < n.m_bodies.length; ++s) {
var o = n.m_bodies[s], a = n.m_bodies[(s + 1) % n.m_bodies.length], c = o.GetWorldCenter(), l = a.GetWorldCenter();
n.m_targetLengths[s] = I.DistanceVV(c, l);
n.m_targetArea += I.CrossVV(c, l);
r.Initialize(o, a, c, l);
n.m_joints[s] = o.GetWorld().CreateJoint(r);
}
n.m_targetArea *= .5;
return n;
}
i.prototype.GetAnchorA = function(t) {
return t;
};
i.prototype.GetAnchorB = function(t) {
return t;
};
i.prototype.GetReactionForce = function(t, e) {
return e;
};
i.prototype.GetReactionTorque = function() {
return 0;
};
i.prototype.SetFrequency = function(t) {
this.m_frequencyHz = t;
for (var e = 0; e < this.m_joints.length; ++e) this.m_joints[e].SetFrequency(t);
};
i.prototype.GetFrequency = function() {
return this.m_frequencyHz;
};
i.prototype.SetDampingRatio = function(t) {
this.m_dampingRatio = t;
for (var e = 0; e < this.m_joints.length; ++e) this.m_joints[e].SetDampingRatio(t);
};
i.prototype.GetDampingRatio = function() {
return this.m_dampingRatio;
};
i.prototype.Dump = function(t) {
t("Area joint dumping is not supported.\n");
};
i.prototype.InitVelocityConstraints = function(t) {
for (var e = 0; e < this.m_bodies.length; ++e) {
var i = this.m_bodies[(e + this.m_bodies.length - 1) % this.m_bodies.length], n = this.m_bodies[(e + 1) % this.m_bodies.length], r = t.positions[i.m_islandIndex].c, s = t.positions[n.m_islandIndex].c, o = this.m_deltas[e];
I.SubVV(s, r, o);
}
if (t.step.warmStarting) {
this.m_impulse *= t.step.dtRatio;
for (e = 0; e < this.m_bodies.length; ++e) {
var a = this.m_bodies[e], c = t.velocities[a.m_islandIndex].v;
o = this.m_deltas[e];
c.x += a.m_invMass * o.y * .5 * this.m_impulse;
c.y += a.m_invMass * -o.x * .5 * this.m_impulse;
}
} else this.m_impulse = 0;
};
i.prototype.SolveVelocityConstraints = function(t) {
for (var e = 0, i = 0, n = 0; n < this.m_bodies.length; ++n) {
var r = this.m_bodies[n], s = t.velocities[r.m_islandIndex].v;
e += (a = this.m_deltas[n]).LengthSquared() / r.GetMass();
i += I.CrossVV(s, a);
}
var o = -2 * i / e;
this.m_impulse += o;
for (n = 0; n < this.m_bodies.length; ++n) {
r = this.m_bodies[n], s = t.velocities[r.m_islandIndex].v;
var a = this.m_deltas[n];
s.x += r.m_invMass * a.y * .5 * o;
s.y += r.m_invMass * -a.x * .5 * o;
}
};
i.prototype.SolvePositionConstraints = function(t) {
for (var e = 0, i = 0, r = 0; r < this.m_bodies.length; ++r) {
var s = this.m_bodies[r], o = this.m_bodies[(r + 1) % this.m_bodies.length], a = t.positions[s.m_islandIndex].c, l = t.positions[o.m_islandIndex].c, u = (f = I.SubVV(l, a, this.m_delta)).Length();
u < n && (u = 1);
this.m_normals[r].x = f.y / u;
this.m_normals[r].y = -f.x / u;
e += u;
i += I.CrossVV(a, l);
}
i *= .5;
var h = .5 * (this.m_targetArea - i) / e, _ = !0;
for (r = 0; r < this.m_bodies.length; ++r) {
s = this.m_bodies[r], a = t.positions[s.m_islandIndex].c;
var f, d = (r + 1) % this.m_bodies.length;
(f = I.AddVV(this.m_normals[r], this.m_normals[d], this.m_delta)).SelfMul(h);
var p = f.LengthSquared();
p > C(.2) && f.SelfMul(.2 / A(p));
p > C(c) && (_ = !1);
a.x += f.x;
a.y += f.y;
}
return _;
};
return i;
})(oi), hi = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_frictionJoint) || this;
i.localAnchorA = new I();
i.localAnchorB = new I();
i.maxForce = 0;
i.maxTorque = 0;
return i;
}
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);
};
return i;
})(si), _i = (function(t) {
Xe(i, t);
function i(i) {
var n = t.call(this, i) || this;
n.m_localAnchorA = new I();
n.m_localAnchorB = new I();
n.m_linearImpulse = new I();
n.m_angularImpulse = 0;
n.m_maxForce = 0;
n.m_maxTorque = 0;
n.m_indexA = 0;
n.m_indexB = 0;
n.m_rA = new I();
n.m_rB = new I();
n.m_localCenterA = new I();
n.m_localCenterB = new I();
n.m_invMassA = 0;
n.m_invMassB = 0;
n.m_invIA = 0;
n.m_invIB = 0;
n.m_linearMass = new R();
n.m_angularMass = 0;
n.m_qA = new O();
n.m_qB = new O();
n.m_lalcA = new I();
n.m_lalcB = new I();
n.m_K = new R();
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();
return n;
}
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, o = t.velocities[this.m_indexB].w, a = this.m_qA.SetAngle(e), c = this.m_qB.SetAngle(r);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
var l = O.MulRV(a, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
var u = O.MulRV(c, this.m_lalcB, this.m_rB), h = this.m_invMassA, _ = this.m_invMassB, f = this.m_invIA, d = this.m_invIB, p = this.m_K;
p.ex.x = h + _ + f * l.y * l.y + d * u.y * u.y;
p.ex.y = -f * l.x * l.y - d * u.x * u.y;
p.ey.x = p.ex.y;
p.ey.y = h + _ + f * l.x * l.x + d * u.x * u.x;
p.GetInverse(this.m_linearMass);
this.m_angularMass = f + d;
this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass);
if (t.step.warmStarting) {
this.m_linearImpulse.SelfMul(t.step.dtRatio);
this.m_angularImpulse *= t.step.dtRatio;
var m = this.m_linearImpulse;
i.SelfMulSub(h, m);
n -= f * (I.CrossVV(this.m_rA, m) + this.m_angularImpulse);
s.SelfMulAdd(_, m);
o += d * (I.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 = o;
};
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, o = this.m_invMassA, a = this.m_invMassB, c = this.m_invIA, l = this.m_invIB, u = t.step.dt, h = s - n, _ = -this.m_angularMass * h, f = this.m_angularImpulse, d = u * this.m_maxTorque;
this.m_angularImpulse = g(this.m_angularImpulse + _, -d, d);
n -= c * (_ = this.m_angularImpulse - f);
s += l * _;
var p = I.SubVV(I.AddVCrossSV(r, s, this.m_rB, I.s_t0), I.AddVCrossSV(e, n, this.m_rA, I.s_t1), i.SolveVelocityConstraints_s_Cdot_v2), m = R.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 = u * this.m_maxForce;
if (this.m_linearImpulse.LengthSquared() > d * d) {
this.m_linearImpulse.Normalize();
this.m_linearImpulse.SelfMul(d);
}
I.SubVV(this.m_linearImpulse, y, m);
e.SelfMulSub(o, m);
n -= c * I.CrossVV(this.m_rA, m);
r.SelfMulAdd(a, m);
s += l * I.CrossVV(this.m_rB, m);
t.velocities[this.m_indexA].w = n;
t.velocities[this.m_indexB].w = s;
};
i.prototype.SolvePositionConstraints = function() {
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) {
e.x = t * this.m_linearImpulse.x;
e.y = t * this.m_linearImpulse.y;
return 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 I();
i.SolveVelocityConstraints_s_impulseV = new I();
i.SolveVelocityConstraints_s_oldImpulseV = new I();
return i;
})(oi), fi = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_gearJoint) || this;
i.ratio = 1;
return i;
}
return i;
})(si), di = (function(i) {
Xe(n, i);
function n(n) {
var r, s, o = i.call(this, n) || this;
o.m_typeA = t.b2JointType.e_unknownJoint;
o.m_typeB = t.b2JointType.e_unknownJoint;
o.m_localAnchorA = new I();
o.m_localAnchorB = new I();
o.m_localAnchorC = new I();
o.m_localAnchorD = new I();
o.m_localAxisC = new I();
o.m_localAxisD = new I();
o.m_referenceAngleA = 0;
o.m_referenceAngleB = 0;
o.m_constant = 0;
o.m_ratio = 0;
o.m_impulse = 0;
o.m_indexA = 0;
o.m_indexB = 0;
o.m_indexC = 0;
o.m_indexD = 0;
o.m_lcA = new I();
o.m_lcB = new I();
o.m_lcC = new I();
o.m_lcD = new I();
o.m_mA = 0;
o.m_mB = 0;
o.m_mC = 0;
o.m_mD = 0;
o.m_iA = 0;
o.m_iB = 0;
o.m_iC = 0;
o.m_iD = 0;
o.m_JvAC = new I();
o.m_JvBD = new I();
o.m_JwA = 0;
o.m_JwB = 0;
o.m_JwC = 0;
o.m_JwD = 0;
o.m_mass = 0;
o.m_qA = new O();
o.m_qB = new O();
o.m_qC = new O();
o.m_qD = new O();
o.m_lalcA = new I();
o.m_lalcB = new I();
o.m_lalcC = new I();
o.m_lalcD = new I();
o.m_joint1 = n.joint1;
o.m_joint2 = n.joint2;
o.m_typeA = o.m_joint1.GetType();
o.m_typeB = o.m_joint2.GetType();
o.m_bodyC = o.m_joint1.GetBodyA();
o.m_bodyA = o.m_joint1.GetBodyB();
var a = o.m_bodyA.m_xf, c = o.m_bodyA.m_sweep.a, l = o.m_bodyC.m_xf, u = o.m_bodyC.m_sweep.a;
if (o.m_typeA === t.b2JointType.e_revoluteJoint) {
var h = n.joint1;
o.m_localAnchorC.Copy(h.m_localAnchorA);
o.m_localAnchorA.Copy(h.m_localAnchorB);
o.m_referenceAngleA = h.m_referenceAngle;
o.m_localAxisC.SetZero();
r = c - u - o.m_referenceAngleA;
} else {
var _ = n.joint1;
o.m_localAnchorC.Copy(_.m_localAnchorA);
o.m_localAnchorA.Copy(_.m_localAnchorB);
o.m_referenceAngleA = _.m_referenceAngle;
o.m_localAxisC.Copy(_.m_localXAxisA);
var f = o.m_localAnchorC, d = O.MulTRV(l.q, I.AddVV(O.MulRV(a.q, o.m_localAnchorA, I.s_t0), I.SubVV(a.p, l.p, I.s_t1), I.s_t0), I.s_t0);
r = I.DotVV(I.SubVV(d, f, I.s_t0), o.m_localAxisC);
}
o.m_bodyD = o.m_joint2.GetBodyA();
o.m_bodyB = o.m_joint2.GetBodyB();
var p = o.m_bodyB.m_xf, m = o.m_bodyB.m_sweep.a, y = o.m_bodyD.m_xf, v = o.m_bodyD.m_sweep.a;
if (o.m_typeB === t.b2JointType.e_revoluteJoint) {
h = n.joint2;
o.m_localAnchorD.Copy(h.m_localAnchorA);
o.m_localAnchorB.Copy(h.m_localAnchorB);
o.m_referenceAngleB = h.m_referenceAngle;
o.m_localAxisD.SetZero();
s = m - v - o.m_referenceAngleB;
} else {
_ = n.joint2;
o.m_localAnchorD.Copy(_.m_localAnchorA);
o.m_localAnchorB.Copy(_.m_localAnchorB);
o.m_referenceAngleB = _.m_referenceAngle;
o.m_localAxisD.Copy(_.m_localXAxisA);
var g = o.m_localAnchorD, b = O.MulTRV(y.q, I.AddVV(O.MulRV(p.q, o.m_localAnchorB, I.s_t0), I.SubVV(p.p, y.p, I.s_t1), I.s_t0), I.s_t0);
s = I.DotVV(I.SubVV(b, g, I.s_t0), o.m_localAxisD);
}
o.m_ratio = e(n.ratio, 1);
o.m_constant = r + o.m_ratio * s;
o.m_impulse = 0;
return o;
}
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, o = e.positions[this.m_indexB].a, a = e.velocities[this.m_indexB].v, c = e.velocities[this.m_indexB].w, l = e.positions[this.m_indexC].a, u = e.velocities[this.m_indexC].v, h = 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(o), y = this.m_qC.SetAngle(l), v = this.m_qD.SetAngle(_);
this.m_mass = 0;
if (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 = O.MulRV(y, this.m_localAxisC, n.InitVelocityConstraints_s_u);
I.SubVV(this.m_localAnchorC, this.m_lcC, this.m_lalcC);
var b = O.MulRV(y, this.m_lalcC, n.InitVelocityConstraints_s_rC);
I.SubVV(this.m_localAnchorA, this.m_lcA, this.m_lalcA);
var C = O.MulRV(p, this.m_lalcA, n.InitVelocityConstraints_s_rA);
this.m_JvAC.Copy(g);
this.m_JwC = I.CrossVV(b, g);
this.m_JwA = I.CrossVV(C, 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 = O.MulRV(v, this.m_localAxisD, n.InitVelocityConstraints_s_u);
I.SubVV(this.m_localAnchorD, this.m_lcD, this.m_lalcD);
var x = O.MulRV(v, this.m_lalcD, n.InitVelocityConstraints_s_rD);
I.SubVV(this.m_localAnchorB, this.m_lcB, this.m_lalcB);
var A = O.MulRV(m, this.m_lalcB, n.InitVelocityConstraints_s_rB);
I.MulSV(this.m_ratio, g, this.m_JvBD);
this.m_JwD = this.m_ratio * I.CrossVV(x, g);
this.m_JwB = this.m_ratio * I.CrossVV(A, 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;
if (e.step.warmStarting) {
r.SelfMulAdd(this.m_mA * this.m_impulse, this.m_JvAC);
s += this.m_iA * this.m_impulse * this.m_JwA;
a.SelfMulAdd(this.m_mB * this.m_impulse, this.m_JvBD);
c += this.m_iB * this.m_impulse * this.m_JwB;
u.SelfMulSub(this.m_mC * this.m_impulse, this.m_JvAC);
h -= 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;
} else this.m_impulse = 0;
e.velocities[this.m_indexA].w = s;
e.velocities[this.m_indexB].w = c;
e.velocities[this.m_indexC].w = h;
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, o = t.velocities[this.m_indexC].w, a = t.velocities[this.m_indexD].v, c = t.velocities[this.m_indexD].w, l = I.DotVV(this.m_JvAC, I.SubVV(e, s, I.s_t0)) + I.DotVV(this.m_JvBD, I.SubVV(n, a, I.s_t0));
l += this.m_JwA * i - this.m_JwC * o + (this.m_JwB * r - this.m_JwD * c);
var u = -this.m_mass * l;
this.m_impulse += u;
e.SelfMulAdd(this.m_mA * u, this.m_JvAC);
i += this.m_iA * u * this.m_JwA;
n.SelfMulAdd(this.m_mB * u, this.m_JvBD);
r += this.m_iB * u * this.m_JwB;
s.SelfMulSub(this.m_mC * u, this.m_JvAC);
o -= this.m_iC * u * this.m_JwC;
a.SelfMulSub(this.m_mD * u, this.m_JvBD);
c -= this.m_iD * u * this.m_JwD;
t.velocities[this.m_indexA].w = i;
t.velocities[this.m_indexB].w = r;
t.velocities[this.m_indexC].w = o;
t.velocities[this.m_indexD].w = c;
};
n.prototype.SolvePositionConstraints = function(e) {
var i, r, s, o, a, l, u = e.positions[this.m_indexA].c, h = 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(h), g = this.m_qB.SetAngle(f), b = this.m_qC.SetAngle(p), C = this.m_qD.SetAngle(y), x = this.m_JvAC, A = this.m_JvBD, S = 0;
if (this.m_typeA === t.b2JointType.e_revoluteJoint) {
x.SetZero();
s = 1;
a = 1;
S += this.m_iA + this.m_iC;
i = h - p - this.m_referenceAngleA;
} else {
var T = O.MulRV(b, this.m_localAxisC, n.SolvePositionConstraints_s_u), w = O.MulRV(b, this.m_lalcC, n.SolvePositionConstraints_s_rC), E = O.MulRV(v, this.m_lalcA, n.SolvePositionConstraints_s_rA);
x.Copy(T);
a = I.CrossVV(w, T);
s = I.CrossVV(E, T);
S += this.m_mC + this.m_mA + this.m_iC * a * a + this.m_iA * s * s;
var M = this.m_lalcC, B = O.MulTRV(b, I.AddVV(E, I.SubVV(u, d, I.s_t0), I.s_t0), I.s_t0);
i = I.DotVV(I.SubVV(B, M, I.s_t0), this.m_localAxisC);
}
if (this.m_typeB === t.b2JointType.e_revoluteJoint) {
A.SetZero();
o = this.m_ratio;
l = this.m_ratio;
S += this.m_ratio * this.m_ratio * (this.m_iB + this.m_iD);
r = f - y - this.m_referenceAngleB;
} else {
T = O.MulRV(C, this.m_localAxisD, n.SolvePositionConstraints_s_u);
var D = O.MulRV(C, this.m_lalcD, n.SolvePositionConstraints_s_rD), P = O.MulRV(g, this.m_lalcB, n.SolvePositionConstraints_s_rB);
I.MulSV(this.m_ratio, T, A);
l = this.m_ratio * I.CrossVV(D, T);
o = this.m_ratio * I.CrossVV(P, T);
S += this.m_ratio * this.m_ratio * (this.m_mD + this.m_mB) + this.m_iD * l * l + this.m_iB * o * o;
var R = this.m_lalcD, L = O.MulTRV(C, I.AddVV(P, I.SubVV(_, m, I.s_t0), I.s_t0), I.s_t0);
r = I.DotVV(I.SubVV(L, R, I.s_t0), this.m_localAxisD);
}
var V = i + this.m_ratio * r - this.m_constant, N = 0;
S > 0 && (N = -V / S);
u.SelfMulAdd(this.m_mA * N, x);
h += this.m_iA * N * s;
_.SelfMulAdd(this.m_mB * N, A);
f += this.m_iB * N * o;
d.SelfMulSub(this.m_mC * N, x);
p -= this.m_iC * N * a;
m.SelfMulSub(this.m_mD * N, A);
y -= this.m_iD * N * l;
e.positions[this.m_indexA].a = h;
e.positions[this.m_indexB].a = f;
e.positions[this.m_indexC].a = p;
e.positions[this.m_indexD].a = y;
return 0 < c;
};
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 I.MulSV(t * this.m_impulse, this.m_JvAC, e);
};
n.prototype.GetReactionTorque = function(t) {
return t * this.m_impulse * this.m_JwA;
};
n.prototype.GetJoint1 = function() {
return this.m_joint1;
};
n.prototype.GetJoint2 = function() {
return this.m_joint2;
};
n.prototype.GetRatio = function() {
return this.m_ratio;
};
n.prototype.SetRatio = function(t) {
this.m_ratio = t;
};
n.prototype.Dump = function(t) {
var e = this.m_bodyA.m_islandIndex, i = this.m_bodyB.m_islandIndex, n = this.m_joint1.m_index, r = this.m_joint2.m_index;
t("  const jd: b2GearJointDef = new b2GearJointDef();\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.joint1 = joints[%d];\n", n);
t("  jd.joint2 = joints[%d];\n", r);
t("  jd.ratio = %.15f;\n", this.m_ratio);
t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
};
n.InitVelocityConstraints_s_u = new I();
n.InitVelocityConstraints_s_rA = new I();
n.InitVelocityConstraints_s_rB = new I();
n.InitVelocityConstraints_s_rC = new I();
n.InitVelocityConstraints_s_rD = new I();
n.SolvePositionConstraints_s_u = new I();
n.SolvePositionConstraints_s_rA = new I();
n.SolvePositionConstraints_s_rB = new I();
n.SolvePositionConstraints_s_rC = new I();
n.SolvePositionConstraints_s_rD = new I();
return n;
})(oi), pi = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_motorJoint) || this;
i.linearOffset = new I(0, 0);
i.angularOffset = 0;
i.maxForce = 1;
i.maxTorque = 1;
i.correctionFactor = .3;
return i;
}
i.prototype.Initialize = function(t, e) {
this.bodyA = t;
this.bodyB = e;
this.bodyA.GetLocalPoint(this.bodyB.GetPosition(), this.linearOffset);
var i = this.bodyA.GetAngle(), n = this.bodyB.GetAngle();
this.angularOffset = n - i;
};
return i;
})(si), mi = (function(t) {
Xe(i, t);
function i(i) {
var n = t.call(this, i) || this;
n.m_linearOffset = new I();
n.m_angularOffset = 0;
n.m_linearImpulse = new I();
n.m_angularImpulse = 0;
n.m_maxForce = 0;
n.m_maxTorque = 0;
n.m_correctionFactor = .3;
n.m_indexA = 0;
n.m_indexB = 0;
n.m_rA = new I();
n.m_rB = new I();
n.m_localCenterA = new I();
n.m_localCenterB = new I();
n.m_linearError = new I();
n.m_angularError = 0;
n.m_invMassA = 0;
n.m_invMassB = 0;
n.m_invIA = 0;
n.m_invIB = 0;
n.m_linearMass = new R();
n.m_angularMass = 0;
n.m_qA = new O();
n.m_qB = new O();
n.m_K = new R();
n.m_linearOffset.Copy(e(i.linearOffset, I.ZERO));
n.m_linearImpulse.SetZero();
n.m_maxForce = e(i.maxForce, 0);
n.m_maxTorque = e(i.maxTorque, 0);
n.m_correctionFactor = e(i.correctionFactor, .3);
return n;
}
i.prototype.GetAnchorA = function(t) {
var e = this.m_bodyA.GetPosition();
t.x = e.x;
t.y = e.y;
return t;
};
i.prototype.GetAnchorB = function(t) {
var e = this.m_bodyB.GetPosition();
t.x = e.x;
t.y = e.y;
return t;
};
i.prototype.GetReactionForce = function(t, e) {
return I.MulSV(t, this.m_linearImpulse, e);
};
i.prototype.GetReactionTorque = function(t) {
return t * this.m_angularImpulse;
};
i.prototype.SetLinearOffset = function(t) {
if (!I.IsEqualToV(t, this.m_linearOffset)) {
this.m_bodyA.SetAwake(!0);
this.m_bodyB.SetAwake(!0);
this.m_linearOffset.Copy(t);
}
};
i.prototype.GetLinearOffset = function() {
return this.m_linearOffset;
};
i.prototype.SetAngularOffset = function(t) {
if (t !== this.m_angularOffset) {
this.m_bodyA.SetAwake(!0);
this.m_bodyB.SetAwake(!0);
this.m_angularOffset = t;
}
};
i.prototype.GetAngularOffset = function() {
return this.m_angularOffset;
};
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.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, i = t.positions[this.m_indexA].a, n = t.velocities[this.m_indexA].v, r = t.velocities[this.m_indexA].w, s = t.positions[this.m_indexB].c, o = t.positions[this.m_indexB].a, a = t.velocities[this.m_indexB].v, c = t.velocities[this.m_indexB].w, l = this.m_qA.SetAngle(i), u = this.m_qB.SetAngle(o), h = O.MulRV(l, I.SubVV(this.m_linearOffset, this.m_localCenterA, I.s_t0), this.m_rA), _ = O.MulRV(u, I.NegV(this.m_localCenterB, I.s_t0), this.m_rB), f = this.m_invMassA, d = this.m_invMassB, p = this.m_invIA, m = this.m_invIB, y = this.m_K;
y.ex.x = f + d + p * h.y * h.y + m * _.y * _.y;
y.ex.y = -p * h.x * h.y - m * _.x * _.y;
y.ey.x = y.ex.y;
y.ey.y = f + d + p * h.x * h.x + m * _.x * _.x;
y.GetInverse(this.m_linearMass);
this.m_angularMass = p + m;
this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass);
I.SubVV(I.AddVV(s, _, I.s_t0), I.AddVV(e, h, I.s_t1), this.m_linearError);
this.m_angularError = o - i - this.m_angularOffset;
if (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 * (I.CrossVV(h, v) + this.m_angularImpulse);
a.SelfMulAdd(d, v);
c += m * (I.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 = 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, o = this.m_invMassA, a = this.m_invMassB, c = this.m_invIA, l = this.m_invIB, u = t.step.dt, h = t.step.inv_dt, _ = s - n + h * this.m_correctionFactor * this.m_angularError, f = -this.m_angularMass * _, d = this.m_angularImpulse, p = u * this.m_maxTorque;
this.m_angularImpulse = g(this.m_angularImpulse + f, -p, p);
n -= c * (f = this.m_angularImpulse - d);
s += l * f;
var m = this.m_rA, y = this.m_rB, v = I.AddVV(I.SubVV(I.AddVV(r, I.CrossSV(s, y, I.s_t0), I.s_t0), I.AddVV(e, I.CrossSV(n, m, I.s_t1), I.s_t1), I.s_t2), I.MulSV(h * this.m_correctionFactor, this.m_linearError, I.s_t3), i.SolveVelocityConstraints_s_Cdot_v2), b = R.MulMV(this.m_linearMass, v, i.SolveVelocityConstraints_s_impulse_v2).SelfNeg(), C = i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);
this.m_linearImpulse.SelfAdd(b);
p = u * this.m_maxForce;
if (this.m_linearImpulse.LengthSquared() > p * p) {
this.m_linearImpulse.Normalize();
this.m_linearImpulse.SelfMul(p);
}
I.SubVV(this.m_linearImpulse, C, b);
e.SelfMulSub(o, b);
n -= c * I.CrossVV(m, b);
r.SelfMulAdd(a, b);
s += l * I.CrossVV(y, b);
t.velocities[this.m_indexA].w = n;
t.velocities[this.m_indexB].w = s;
};
i.prototype.SolvePositionConstraints = function() {
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 I();
i.SolveVelocityConstraints_s_impulse_v2 = new I();
i.SolveVelocityConstraints_s_oldImpulse_v2 = new I();
return i;
})(oi), yi = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_mouseJoint) || this;
i.target = new I();
i.maxForce = 0;
i.frequencyHz = 5;
i.dampingRatio = .7;
return i;
}
return i;
})(si), vi = (function(t) {
Xe(i, t);
function i(i) {
var n = t.call(this, i) || this;
n.m_localAnchorB = new I();
n.m_targetA = new I();
n.m_frequencyHz = 0;
n.m_dampingRatio = 0;
n.m_beta = 0;
n.m_impulse = new I();
n.m_maxForce = 0;
n.m_gamma = 0;
n.m_indexA = 0;
n.m_indexB = 0;
n.m_rB = new I();
n.m_localCenterB = new I();
n.m_invMassB = 0;
n.m_invIB = 0;
n.m_mass = new R();
n.m_C = new I();
n.m_qB = new O();
n.m_lalcB = new I();
n.m_K = new R();
n.m_targetA.Copy(e(i.target, I.ZERO));
V.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;
return n;
}
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, o = this.m_qB.SetAngle(i), a = this.m_bodyB.GetMass(), c = 2 * s * this.m_frequencyHz, l = 2 * a * this.m_dampingRatio * c, u = a * c * c, h = t.step.dt;
this.m_gamma = h * (l + h * u);
0 !== this.m_gamma && (this.m_gamma = 1 / this.m_gamma);
this.m_beta = h * u * this.m_gamma;
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
O.MulRV(o, 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;
if (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 * I.CrossVV(this.m_rB, this.m_impulse);
} else 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 = I.AddVCrossSV(e, n, this.m_rB, i.SolveVelocityConstraints_s_Cdot), s = R.MulMV(this.m_mass, I.AddVV(r, I.AddVV(this.m_C, I.MulSV(this.m_gamma, this.m_impulse, I.s_t0), I.s_t0), I.s_t0).SelfNeg(), i.SolveVelocityConstraints_s_impulse), o = i.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);
this.m_impulse.SelfAdd(s);
var a = t.step.dt * this.m_maxForce;
this.m_impulse.LengthSquared() > a * a && this.m_impulse.SelfMul(a / this.m_impulse.Length());
I.SubVV(this.m_impulse, o, s);
e.SelfMulAdd(this.m_invMassB, s);
n += this.m_invIB * I.CrossVV(this.m_rB, s);
t.velocities[this.m_indexB].w = n;
};
i.prototype.SolvePositionConstraints = function() {
return !0;
};
i.prototype.GetAnchorA = function(t) {
t.x = this.m_targetA.x;
t.y = this.m_targetA.y;
return t;
};
i.prototype.GetAnchorB = function(t) {
return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
};
i.prototype.GetReactionForce = function(t, e) {
return I.MulSV(t, this.m_impulse, e);
};
i.prototype.GetReactionTorque = function() {
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 I();
i.SolveVelocityConstraints_s_impulse = new I();
i.SolveVelocityConstraints_s_oldImpulse = new I();
return i;
})(oi), gi = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_prismaticJoint) || this;
i.localAnchorA = new I();
i.localAnchorB = new I();
i.localAxisA = new I(1, 0);
i.referenceAngle = 0;
i.enableLimit = !1;
i.lowerTranslation = 0;
i.upperTranslation = 0;
i.enableMotor = !1;
i.maxMotorForce = 0;
i.motorSpeed = 0;
return i;
}
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();
};
return i;
})(si), bi = (function(i) {
Xe(n, i);
function n(n) {
var r = i.call(this, n) || this;
r.m_localAnchorA = new I();
r.m_localAnchorB = new I();
r.m_localXAxisA = new I();
r.m_localYAxisA = new I();
r.m_referenceAngle = 0;
r.m_impulse = new P(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 I();
r.m_localCenterB = new I();
r.m_invMassA = 0;
r.m_invMassB = 0;
r.m_invIA = 0;
r.m_invIB = 0;
r.m_axis = new I(0, 0);
r.m_perp = new I(0, 0);
r.m_s1 = 0;
r.m_s2 = 0;
r.m_a1 = 0;
r.m_a2 = 0;
r.m_K = new L();
r.m_K3 = new L();
r.m_K2 = new R();
r.m_motorMass = 0;
r.m_qA = new O();
r.m_qB = new O();
r.m_lalcA = new I();
r.m_lalcB = new I();
r.m_rA = new I();
r.m_rB = new I();
r.m_localAnchorA.Copy(e(n.localAnchorA, I.ZERO));
r.m_localAnchorB.Copy(e(n.localAnchorB, I.ZERO));
r.m_localXAxisA.Copy(e(n.localAxisA, new I(1, 0))).SelfNormalize();
I.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);
return r;
}
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, o = e.velocities[this.m_indexA].w, a = e.positions[this.m_indexB].c, l = e.positions[this.m_indexB].a, u = e.velocities[this.m_indexB].v, h = e.velocities[this.m_indexB].w, _ = this.m_qA.SetAngle(r), f = this.m_qB.SetAngle(l);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
var d = O.MulRV(_, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
var p = O.MulRV(f, this.m_lalcB, this.m_rB), y = I.AddVV(I.SubVV(a, i, I.s_t0), I.SubVV(p, d, I.s_t1), n.InitVelocityConstraints_s_d), v = this.m_invMassA, g = this.m_invMassB, b = this.m_invIA, C = this.m_invIB;
O.MulRV(_, this.m_localXAxisA, this.m_axis);
this.m_a1 = I.CrossVV(I.AddVV(y, d, I.s_t0), this.m_axis);
this.m_a2 = I.CrossVV(p, this.m_axis);
this.m_motorMass = v + g + b * this.m_a1 * this.m_a1 + C * this.m_a2 * this.m_a2;
this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass);
O.MulRV(_, this.m_localYAxisA, this.m_perp);
this.m_s1 = I.CrossVV(I.AddVV(y, d, I.s_t0), this.m_perp);
this.m_s2 = I.CrossVV(p, this.m_perp);
this.m_K.ex.x = v + g + b * this.m_s1 * this.m_s1 + C * this.m_s2 * this.m_s2;
this.m_K.ex.y = b * this.m_s1 + C * this.m_s2;
this.m_K.ex.z = b * this.m_s1 * this.m_a1 + C * this.m_s2 * this.m_a2;
this.m_K.ey.x = this.m_K.ex.y;
this.m_K.ey.y = b + C;
0 === this.m_K.ey.y && (this.m_K.ey.y = 1);
this.m_K.ey.z = b * this.m_a1 + C * 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 = v + g + b * this.m_a1 * this.m_a1 + C * this.m_a2 * this.m_a2;
if (this.m_enableLimit) {
var x = I.DotVV(this.m_axis, y);
if (m(this.m_upperTranslation - this.m_lowerTranslation) < 2 * c) this.m_limitState = t.b2LimitState.e_equalLimits; else if (x <= this.m_lowerTranslation) {
if (this.m_limitState !== t.b2LimitState.e_atLowerLimit) {
this.m_limitState = t.b2LimitState.e_atLowerLimit;
this.m_impulse.z = 0;
}
} else if (x >= this.m_upperTranslation) {
if (this.m_limitState !== t.b2LimitState.e_atUpperLimit) {
this.m_limitState = t.b2LimitState.e_atUpperLimit;
this.m_impulse.z = 0;
}
} else {
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;
}
this.m_enableMotor || (this.m_motorImpulse = 0);
if (e.step.warmStarting) {
this.m_impulse.SelfMul(e.step.dtRatio);
this.m_motorImpulse *= e.step.dtRatio;
var A = I.AddVV(I.MulSV(this.m_impulse.x, this.m_perp, I.s_t0), I.MulSV(this.m_motorImpulse + this.m_impulse.z, this.m_axis, I.s_t1), n.InitVelocityConstraints_s_P), S = this.m_impulse.x * this.m_s1 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a1, T = this.m_impulse.x * this.m_s2 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a2;
s.SelfMulSub(v, A);
o -= b * S;
u.SelfMulAdd(g, A);
h += C * T;
} else {
this.m_impulse.SetZero();
this.m_motorImpulse = 0;
}
e.velocities[this.m_indexA].w = o;
e.velocities[this.m_indexB].w = h;
};
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, o = e.velocities[this.m_indexB].w, a = this.m_invMassA, c = this.m_invMassB, l = this.m_invIA, u = this.m_invIB;
if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits) {
var h = I.DotVV(this.m_axis, I.SubVV(s, i, I.s_t0)) + this.m_a2 * o - this.m_a1 * r, _ = this.m_motorMass * (this.m_motorSpeed - h), f = this.m_motorImpulse, d = e.step.dt * this.m_maxMotorForce;
this.m_motorImpulse = g(this.m_motorImpulse + _, -d, d);
_ = this.m_motorImpulse - f;
var p = I.MulSV(_, this.m_axis, n.SolveVelocityConstraints_s_P), m = _ * this.m_a1, b = _ * this.m_a2;
i.SelfMulSub(a, p);
r -= l * m;
s.SelfMulAdd(c, p);
o += u * b;
}
var C = I.DotVV(this.m_perp, I.SubVV(s, i, I.s_t0)) + this.m_s2 * o - this.m_s1 * r, x = o - r;
if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit) {
var A = I.DotVV(this.m_axis, I.SubVV(s, i, I.s_t0)) + this.m_a2 * o - this.m_a1 * r, S = n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse), T = this.m_K.Solve33(-C, -x, -A, n.SolveVelocityConstraints_s_df3);
this.m_impulse.SelfAdd(T);
this.m_limitState === t.b2LimitState.e_atLowerLimit ? this.m_impulse.z = v(this.m_impulse.z, 0) : this.m_limitState === t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = y(this.m_impulse.z, 0));
var w = -C - (this.m_impulse.z - S.z) * this.m_K.ez.x, E = -x - (this.m_impulse.z - S.z) * this.m_K.ez.y, M = this.m_K.Solve22(w, E, n.SolveVelocityConstraints_s_f2r);
M.x += S.x;
M.y += S.y;
this.m_impulse.x = M.x;
this.m_impulse.y = M.y;
T.x = this.m_impulse.x - S.x;
T.y = this.m_impulse.y - S.y;
T.z = this.m_impulse.z - S.z;
p = I.AddVV(I.MulSV(T.x, this.m_perp, I.s_t0), I.MulSV(T.z, this.m_axis, I.s_t1), n.SolveVelocityConstraints_s_P), 
m = T.x * this.m_s1 + T.y + T.z * this.m_a1, b = T.x * this.m_s2 + T.y + T.z * this.m_a2;
i.SelfMulSub(a, p);
r -= l * m;
s.SelfMulAdd(c, p);
o += u * b;
} else {
var B = this.m_K.Solve22(-C, -x, n.SolveVelocityConstraints_s_df2);
this.m_impulse.x += B.x;
this.m_impulse.y += B.y;
p = I.MulSV(B.x, this.m_perp, n.SolveVelocityConstraints_s_P), m = B.x * this.m_s1 + B.y, 
b = B.x * this.m_s2 + B.y;
i.SelfMulSub(a, p);
r -= l * m;
s.SelfMulAdd(c, p);
o += u * b;
}
e.velocities[this.m_indexA].w = r;
e.velocities[this.m_indexB].w = o;
};
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, o = this.m_qA.SetAngle(i), a = this.m_qB.SetAngle(s), u = this.m_invMassA, h = this.m_invMassB, _ = this.m_invIA, f = this.m_invIB, d = O.MulRV(o, this.m_lalcA, this.m_rA), p = O.MulRV(a, this.m_lalcB, this.m_rB), y = I.SubVV(I.AddVV(r, p, I.s_t0), I.AddVV(e, d, I.s_t1), n.SolvePositionConstraints_s_d), b = O.MulRV(o, this.m_localXAxisA, this.m_axis), C = I.CrossVV(I.AddVV(y, d, I.s_t0), b), x = I.CrossVV(p, b), A = O.MulRV(o, this.m_localYAxisA, this.m_perp), S = I.CrossVV(I.AddVV(y, d, I.s_t0), A), T = I.CrossVV(p, A), w = n.SolvePositionConstraints_s_impulse, E = I.DotVV(A, y), M = s - i - this.m_referenceAngle, B = m(E), D = m(M), P = !1, R = 0;
if (this.m_enableLimit) {
var L = I.DotVV(b, y);
if (m(this.m_upperTranslation - this.m_lowerTranslation) < 2 * c) {
R = g(L, -.2, .2);
B = v(B, m(L));
P = !0;
} else if (L <= this.m_lowerTranslation) {
R = g(L - this.m_lowerTranslation + c, -.2, 0);
B = v(B, this.m_lowerTranslation - L);
P = !0;
} else if (L >= this.m_upperTranslation) {
R = g(L - this.m_upperTranslation - c, 0, .2);
B = v(B, L - this.m_upperTranslation);
P = !0;
}
}
if (P) {
var V = u + h + _ * S * S + f * T * T, N = _ * S + f * T, F = _ * S * C + f * T * x;
0 === (U = _ + f) && (U = 1);
var z = _ * C + f * x, k = u + h + _ * C * C + f * x * x, G = this.m_K3;
G.ex.SetXYZ(V, N, F);
G.ey.SetXYZ(N, U, z);
G.ez.SetXYZ(F, z, k);
w = G.Solve33(-E, -M, -R, w);
} else {
var U;
V = u + h + _ * S * S + f * T * T, N = _ * S + f * T;
0 === (U = _ + f) && (U = 1);
var H = this.m_K2;
H.ex.Set(V, N);
H.ey.Set(N, U);
var j = H.Solve(-E, -M, n.SolvePositionConstraints_s_impulse1);
w.x = j.x;
w.y = j.y;
w.z = 0;
}
var W = I.AddVV(I.MulSV(w.x, A, I.s_t0), I.MulSV(w.z, b, I.s_t1), n.SolvePositionConstraints_s_P), q = w.x * S + w.y + w.z * C, X = w.x * T + w.y + w.z * x;
e.SelfMulSub(u, W);
i -= _ * q;
r.SelfMulAdd(h, W);
s += f * X;
t.positions[this.m_indexA].a = i;
t.positions[this.m_indexB].a = s;
return B <= c && D <= l;
};
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) {
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);
return 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 = I.SubVV(e, t, n.GetJointTranslation_s_d), r = this.m_bodyA.GetWorldVector(this.m_localXAxisA, n.GetJointTranslation_s_axis);
return I.DotVV(i, r);
};
n.prototype.GetJointSpeed = function() {
var t = this.m_bodyA, e = this.m_bodyB;
I.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA);
var i = O.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB);
var n = O.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB), r = I.AddVV(t.m_sweep.c, i, I.s_t0), s = I.AddVV(e.m_sweep.c, n, I.s_t1), o = I.SubVV(s, r, I.s_t2), a = t.GetWorldVector(this.m_localXAxisA, this.m_axis), c = t.m_linearVelocity, l = e.m_linearVelocity, u = t.m_angularVelocity, h = e.m_angularVelocity;
return I.DotVV(o, I.CrossSV(u, a, I.s_t0)) + I.DotVV(a, I.SubVV(I.AddVCrossSV(l, h, n, I.s_t0), I.AddVCrossSV(c, u, i, I.s_t1), I.s_t0));
};
n.prototype.IsLimitEnabled = function() {
return this.m_enableLimit;
};
n.prototype.EnableLimit = function(t) {
if (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) {
if (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) {
if (t !== this.m_enableMotor) {
this.m_bodyA.SetAwake(!0);
this.m_bodyB.SetAwake(!0);
this.m_enableMotor = t;
}
};
n.prototype.SetMotorSpeed = function(t) {
if (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) {
if (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 I();
n.InitVelocityConstraints_s_P = new I();
n.SolveVelocityConstraints_s_P = new I();
n.SolveVelocityConstraints_s_f2r = new I();
n.SolveVelocityConstraints_s_f1 = new P();
n.SolveVelocityConstraints_s_df3 = new P();
n.SolveVelocityConstraints_s_df2 = new I();
n.SolvePositionConstraints_s_d = new I();
n.SolvePositionConstraints_s_impulse = new P();
n.SolvePositionConstraints_s_impulse1 = new I();
n.SolvePositionConstraints_s_P = new I();
n.GetJointTranslation_s_pA = new I();
n.GetJointTranslation_s_pB = new I();
n.GetJointTranslation_s_d = new I();
n.GetJointTranslation_s_axis = new I();
return n;
})(oi), Ci = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_pulleyJoint) || this;
i.groundAnchorA = new I(-1, 1);
i.groundAnchorB = new I(1, 1);
i.localAnchorA = new I(-1, 0);
i.localAnchorB = new I(1, 0);
i.lengthA = 0;
i.lengthB = 0;
i.ratio = 1;
i.collideConnected = !0;
return i;
}
i.prototype.Initialize = function(t, e, i, n, r, s, o) {
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 = I.DistanceVV(r, i);
this.lengthB = I.DistanceVV(s, n);
this.ratio = o;
};
return i;
})(si), xi = (function(t) {
Xe(i, t);
function i(i) {
var n = t.call(this, i) || this;
n.m_groundAnchorA = new I();
n.m_groundAnchorB = new I();
n.m_lengthA = 0;
n.m_lengthB = 0;
n.m_localAnchorA = new I();
n.m_localAnchorB = new I();
n.m_constant = 0;
n.m_ratio = 0;
n.m_impulse = 0;
n.m_indexA = 0;
n.m_indexB = 0;
n.m_uA = new I();
n.m_uB = new I();
n.m_rA = new I();
n.m_rB = new I();
n.m_localCenterA = new I();
n.m_localCenterB = new I();
n.m_invMassA = 0;
n.m_invMassB = 0;
n.m_invIA = 0;
n.m_invIB = 0;
n.m_mass = 0;
n.m_qA = new O();
n.m_qB = new O();
n.m_lalcA = new I();
n.m_lalcB = new I();
n.m_groundAnchorA.Copy(e(i.groundAnchorA, new I(-1, 1)));
n.m_groundAnchorB.Copy(e(i.groundAnchorB, new I(1, 0)));
n.m_localAnchorA.Copy(e(i.localAnchorA, new I(-1, 0)));
n.m_localAnchorB.Copy(e(i.localAnchorB, new I(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;
return n;
}
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, o = t.positions[this.m_indexB].c, a = t.positions[this.m_indexB].a, l = t.velocities[this.m_indexB].v, u = t.velocities[this.m_indexB].w, h = this.m_qA.SetAngle(n), _ = this.m_qB.SetAngle(a);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
O.MulRV(h, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
O.MulRV(_, this.m_lalcB, this.m_rB);
this.m_uA.Copy(e).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA);
this.m_uB.Copy(o).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);
var f = this.m_uA.Length(), d = this.m_uB.Length();
f > 10 * c ? this.m_uA.SelfMul(1 / f) : this.m_uA.SetZero();
d > 10 * c ? this.m_uB.SelfMul(1 / d) : this.m_uB.SetZero();
var p = I.CrossVV(this.m_rA, this.m_uA), m = I.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;
this.m_mass = y + this.m_ratio * this.m_ratio * v;
this.m_mass > 0 && (this.m_mass = 1 / this.m_mass);
if (t.step.warmStarting) {
this.m_impulse *= t.step.dtRatio;
var g = I.MulSV(-this.m_impulse, this.m_uA, i.InitVelocityConstraints_s_PA), b = I.MulSV(-this.m_ratio * this.m_impulse, this.m_uB, i.InitVelocityConstraints_s_PB);
r.SelfMulAdd(this.m_invMassA, g);
s += this.m_invIA * I.CrossVV(this.m_rA, g);
l.SelfMulAdd(this.m_invMassB, b);
u += this.m_invIB * I.CrossVV(this.m_rB, b);
} else this.m_impulse = 0;
t.velocities[this.m_indexA].w = s;
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, o = I.AddVCrossSV(e, n, this.m_rA, i.SolveVelocityConstraints_s_vpA), a = I.AddVCrossSV(r, s, this.m_rB, i.SolveVelocityConstraints_s_vpB), c = -I.DotVV(this.m_uA, o) - this.m_ratio * I.DotVV(this.m_uB, a), l = -this.m_mass * c;
this.m_impulse += l;
var u = I.MulSV(-l, this.m_uA, i.SolveVelocityConstraints_s_PA), h = I.MulSV(-this.m_ratio * l, this.m_uB, i.SolveVelocityConstraints_s_PB);
e.SelfMulAdd(this.m_invMassA, u);
n += this.m_invIA * I.CrossVV(this.m_rA, u);
r.SelfMulAdd(this.m_invMassB, h);
s += this.m_invIB * I.CrossVV(this.m_rB, h);
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, o = this.m_qA.SetAngle(n), a = this.m_qB.SetAngle(s);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
var l = O.MulRV(o, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
var u = O.MulRV(a, this.m_lalcB, this.m_rB), h = this.m_uA.Copy(e).SelfAdd(l).SelfSub(this.m_groundAnchorA), _ = this.m_uB.Copy(r).SelfAdd(u).SelfSub(this.m_groundAnchorB), f = h.Length(), d = _.Length();
f > 10 * c ? h.SelfMul(1 / f) : h.SetZero();
d > 10 * c ? _.SelfMul(1 / d) : _.SetZero();
var p = I.CrossVV(l, h), y = I.CrossVV(u, _), v = this.m_invMassA + this.m_invIA * p * p, g = this.m_invMassB + this.m_invIB * y * y, b = v + this.m_ratio * this.m_ratio * g;
b > 0 && (b = 1 / b);
var C = this.m_constant - f - this.m_ratio * d, x = m(C), A = -b * C, S = I.MulSV(-A, h, i.SolvePositionConstraints_s_PA), T = I.MulSV(-this.m_ratio * A, _, i.SolvePositionConstraints_s_PB);
e.SelfMulAdd(this.m_invMassA, S);
n += this.m_invIA * I.CrossVV(l, S);
r.SelfMulAdd(this.m_invMassB, T);
s += this.m_invIB * I.CrossVV(u, T);
t.positions[this.m_indexA].a = n;
t.positions[this.m_indexB].a = s;
return x < c;
};
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) {
e.x = t * this.m_impulse * this.m_uB.x;
e.y = t * this.m_impulse * this.m_uB.y;
return e;
};
i.prototype.GetReactionTorque = function() {
return 0;
};
i.prototype.GetGroundAnchorA = function() {
return this.m_groundAnchorA;
};
i.prototype.GetGroundAnchorB = function() {
return this.m_groundAnchorB;
};
i.prototype.GetLengthA = function() {
return this.m_lengthA;
};
i.prototype.GetLengthB = function() {
return this.m_lengthB;
};
i.prototype.GetRatio = function() {
return this.m_ratio;
};
i.prototype.GetCurrentLengthA = function() {
var t = this.m_bodyA.GetWorldPoint(this.m_localAnchorA, i.GetCurrentLengthA_s_p), e = this.m_groundAnchorA;
return I.DistanceVV(t, e);
};
i.prototype.GetCurrentLengthB = function() {
var t = this.m_bodyB.GetWorldPoint(this.m_localAnchorB, i.GetCurrentLengthB_s_p), e = this.m_groundAnchorB;
return I.DistanceVV(t, e);
};
i.prototype.Dump = function(t) {
var e = this.m_bodyA.m_islandIndex, i = this.m_bodyB.m_islandIndex;
t("  const jd: b2PulleyJointDef = new b2PulleyJointDef();\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.groundAnchorA.Set(%.15f, %.15f);\n", this.m_groundAnchorA.x, this.m_groundAnchorA.y);
t("  jd.groundAnchorB.Set(%.15f, %.15f);\n", this.m_groundAnchorB.x, this.m_groundAnchorB.y);
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.lengthA = %.15f;\n", this.m_lengthA);
t("  jd.lengthB = %.15f;\n", this.m_lengthB);
t("  jd.ratio = %.15f;\n", this.m_ratio);
t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
};
i.prototype.ShiftOrigin = function(t) {
this.m_groundAnchorA.SelfSub(t);
this.m_groundAnchorB.SelfSub(t);
};
i.InitVelocityConstraints_s_PA = new I();
i.InitVelocityConstraints_s_PB = new I();
i.SolveVelocityConstraints_s_vpA = new I();
i.SolveVelocityConstraints_s_vpB = new I();
i.SolveVelocityConstraints_s_PA = new I();
i.SolveVelocityConstraints_s_PB = new I();
i.SolvePositionConstraints_s_PA = new I();
i.SolvePositionConstraints_s_PB = new I();
i.GetCurrentLengthA_s_p = new I();
i.GetCurrentLengthB_s_p = new I();
return i;
})(oi), Ai = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_revoluteJoint) || this;
i.localAnchorA = new I(0, 0);
i.localAnchorB = new I(0, 0);
i.referenceAngle = 0;
i.enableLimit = !1;
i.lowerAngle = 0;
i.upperAngle = 0;
i.enableMotor = !1;
i.motorSpeed = 0;
i.maxMotorTorque = 0;
return i;
}
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);
this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
};
return i;
})(si), Si = (function(i) {
Xe(n, i);
function n(n) {
var r = i.call(this, n) || this;
r.m_localAnchorA = new I();
r.m_localAnchorB = new I();
r.m_impulse = new P();
r.m_motorImpulse = 0;
r.m_enableMotor = !1;
r.m_maxMotorTorque = 0;
r.m_motorSpeed = 0;
r.m_enableLimit = !1;
r.m_referenceAngle = 0;
r.m_lowerAngle = 0;
r.m_upperAngle = 0;
r.m_indexA = 0;
r.m_indexB = 0;
r.m_rA = new I();
r.m_rB = new I();
r.m_localCenterA = new I();
r.m_localCenterB = new I();
r.m_invMassA = 0;
r.m_invMassB = 0;
r.m_invIA = 0;
r.m_invIB = 0;
r.m_mass = new L();
r.m_motorMass = 0;
r.m_limitState = t.b2LimitState.e_inactiveLimit;
r.m_qA = new O();
r.m_qB = new O();
r.m_lalcA = new I();
r.m_lalcB = new I();
r.m_K = new R();
r.m_localAnchorA.Copy(e(n.localAnchorA, I.ZERO));
r.m_localAnchorB.Copy(e(n.localAnchorB, I.ZERO));
r.m_referenceAngle = e(n.referenceAngle, 0);
r.m_impulse.SetZero();
r.m_motorImpulse = 0;
r.m_lowerAngle = e(n.lowerAngle, 0);
r.m_upperAngle = e(n.upperAngle, 0);
r.m_maxMotorTorque = e(n.maxMotorTorque, 0);
r.m_motorSpeed = e(n.motorSpeed, 0);
r.m_enableLimit = e(n.enableLimit, !1);
r.m_enableMotor = e(n.enableMotor, !1);
r.m_limitState = t.b2LimitState.e_inactiveLimit;
return r;
}
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].a, r = e.velocities[this.m_indexA].v, s = e.velocities[this.m_indexA].w, o = e.positions[this.m_indexB].a, a = e.velocities[this.m_indexB].v, c = e.velocities[this.m_indexB].w, u = this.m_qA.SetAngle(i), h = this.m_qB.SetAngle(o);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
O.MulRV(u, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
O.MulRV(h, this.m_lalcB, this.m_rB);
var _ = this.m_invMassA, f = this.m_invMassB, d = this.m_invIA, p = this.m_invIB, y = d + p === 0;
this.m_mass.ex.x = _ + f + this.m_rA.y * this.m_rA.y * d + this.m_rB.y * this.m_rB.y * p;
this.m_mass.ey.x = -this.m_rA.y * this.m_rA.x * d - this.m_rB.y * this.m_rB.x * p;
this.m_mass.ez.x = -this.m_rA.y * d - this.m_rB.y * p;
this.m_mass.ex.y = this.m_mass.ey.x;
this.m_mass.ey.y = _ + f + this.m_rA.x * this.m_rA.x * d + this.m_rB.x * this.m_rB.x * p;
this.m_mass.ez.y = this.m_rA.x * d + this.m_rB.x * p;
this.m_mass.ex.z = this.m_mass.ez.x;
this.m_mass.ey.z = this.m_mass.ez.y;
this.m_mass.ez.z = d + p;
this.m_motorMass = d + p;
this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass);
this.m_enableMotor && !y || (this.m_motorImpulse = 0);
if (this.m_enableLimit && !y) {
var v = o - i - this.m_referenceAngle;
if (m(this.m_upperAngle - this.m_lowerAngle) < 2 * l) this.m_limitState = t.b2LimitState.e_equalLimits; else if (v <= this.m_lowerAngle) {
this.m_limitState !== t.b2LimitState.e_atLowerLimit && (this.m_impulse.z = 0);
this.m_limitState = t.b2LimitState.e_atLowerLimit;
} else if (v >= this.m_upperAngle) {
this.m_limitState !== t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = 0);
this.m_limitState = t.b2LimitState.e_atUpperLimit;
} else {
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 * (I.CrossVV(this.m_rA, g) + this.m_motorImpulse + this.m_impulse.z);
a.SelfMulAdd(f, g);
c += p * (I.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 = c;
};
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, o = e.velocities[this.m_indexB].w, a = this.m_invMassA, c = this.m_invMassB, l = this.m_invIA, u = this.m_invIB, h = l + u === 0;
if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits && !h) {
var _ = o - r - this.m_motorSpeed, f = -this.m_motorMass * _, d = this.m_motorImpulse, p = e.step.dt * this.m_maxMotorTorque;
this.m_motorImpulse = g(this.m_motorImpulse + f, -p, p);
r -= l * (f = this.m_motorImpulse - d);
o += u * f;
}
if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !h) {
var m = I.SubVV(I.AddVCrossSV(s, o, this.m_rB, I.s_t0), I.AddVCrossSV(i, r, this.m_rA, I.s_t1), n.SolveVelocityConstraints_s_Cdot1), y = o - 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 b = -m.x + this.m_impulse.z * this.m_mass.ez.x, C = -m.y + this.m_impulse.z * this.m_mass.ez.y, x = this.m_mass.Solve22(b, C, n.SolveVelocityConstraints_s_reduced_v2);
v.x = x.x;
v.y = x.y;
v.z = -this.m_impulse.z;
this.m_impulse.x += x.x;
this.m_impulse.y += x.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) {
b = -m.x + this.m_impulse.z * this.m_mass.ez.x, C = -m.y + this.m_impulse.z * this.m_mass.ez.y, 
x = this.m_mass.Solve22(b, C, n.SolveVelocityConstraints_s_reduced_v2);
v.x = x.x;
v.y = x.y;
v.z = -this.m_impulse.z;
this.m_impulse.x += x.x;
this.m_impulse.y += x.y;
this.m_impulse.z = 0;
} else this.m_impulse.SelfAdd(v);
var A = n.SolveVelocityConstraints_s_P.Set(v.x, v.y);
i.SelfMulSub(a, A);
r -= l * (I.CrossVV(this.m_rA, A) + v.z);
s.SelfMulAdd(c, A);
o += u * (I.CrossVV(this.m_rB, A) + v.z);
} else {
var S = I.SubVV(I.AddVCrossSV(s, o, this.m_rB, I.s_t0), I.AddVCrossSV(i, r, this.m_rA, I.s_t1), n.SolveVelocityConstraints_s_Cdot_v2), T = this.m_mass.Solve22(-S.x, -S.y, n.SolveVelocityConstraints_s_impulse_v2);
this.m_impulse.x += T.x;
this.m_impulse.y += T.y;
i.SelfMulSub(a, T);
r -= l * I.CrossVV(this.m_rA, T);
s.SelfMulAdd(c, T);
o += u * I.CrossVV(this.m_rB, T);
}
e.velocities[this.m_indexA].w = r;
e.velocities[this.m_indexB].w = o;
};
n.prototype.SolvePositionConstraints = function(e) {
var i, r = e.positions[this.m_indexA].c, s = e.positions[this.m_indexA].a, o = e.positions[this.m_indexB].c, a = e.positions[this.m_indexB].a, u = this.m_qA.SetAngle(s), h = this.m_qB.SetAngle(a), _ = 0, f = this.m_invIA + this.m_invIB === 0;
if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !f) {
var d = a - s - this.m_referenceAngle, p = 0;
if (this.m_limitState === t.b2LimitState.e_equalLimits) {
var y = g(d - this.m_lowerAngle, -.13962634015955555, .13962634015955555);
p = -this.m_motorMass * y;
_ = m(y);
} else if (this.m_limitState === t.b2LimitState.e_atLowerLimit) {
_ = -(y = d - this.m_lowerAngle);
y = g(y + l, -.13962634015955555, 0);
p = -this.m_motorMass * y;
} else if (this.m_limitState === t.b2LimitState.e_atUpperLimit) {
_ = y = d - this.m_upperAngle;
y = g(y - l, 0, .13962634015955555);
p = -this.m_motorMass * y;
}
s -= this.m_invIA * p;
a += this.m_invIB * p;
}
u.SetAngle(s);
h.SetAngle(a);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
var v = O.MulRV(u, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
var b = O.MulRV(h, this.m_lalcB, this.m_rB), C = I.SubVV(I.AddVV(o, b, I.s_t0), I.AddVV(r, v, I.s_t1), n.SolvePositionConstraints_s_C_v2);
i = C.Length();
var x = this.m_invMassA, A = this.m_invMassB, S = this.m_invIA, T = this.m_invIB, w = this.m_K;
w.ex.x = x + A + S * v.y * v.y + T * b.y * b.y;
w.ex.y = -S * v.x * v.y - T * b.x * b.y;
w.ey.x = w.ex.y;
w.ey.y = x + A + S * v.x * v.x + T * b.x * b.x;
var E = w.Solve(C.x, C.y, n.SolvePositionConstraints_s_impulse).SelfNeg();
r.SelfMulSub(x, E);
s -= S * I.CrossVV(v, E);
o.SelfMulAdd(A, E);
a += T * I.CrossVV(b, E);
e.positions[this.m_indexA].a = s;
e.positions[this.m_indexB].a = a;
return i <= c && _ <= l;
};
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) {
e.x = t * this.m_impulse.x;
e.y = t * this.m_impulse.y;
return 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) {
if (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) {
if (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) {
if (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) {
if (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) {
if (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 I();
n.SolveVelocityConstraints_s_P = new I();
n.SolveVelocityConstraints_s_Cdot_v2 = new I();
n.SolveVelocityConstraints_s_Cdot1 = new I();
n.SolveVelocityConstraints_s_impulse_v3 = new P();
n.SolveVelocityConstraints_s_reduced_v2 = new I();
n.SolveVelocityConstraints_s_impulse_v2 = new I();
n.SolvePositionConstraints_s_C_v2 = new I();
n.SolvePositionConstraints_s_impulse = new I();
return n;
})(oi), Ti = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_ropeJoint) || this;
i.localAnchorA = new I(-1, 0);
i.localAnchorB = new I(1, 0);
i.maxLength = 0;
return i;
}
return i;
})(si), wi = (function(i) {
Xe(n, i);
function n(n) {
var r = i.call(this, n) || this;
r.m_localAnchorA = new I();
r.m_localAnchorB = new I();
r.m_maxLength = 0;
r.m_length = 0;
r.m_impulse = 0;
r.m_indexA = 0;
r.m_indexB = 0;
r.m_u = new I();
r.m_rA = new I();
r.m_rB = new I();
r.m_localCenterA = new I();
r.m_localCenterB = new I();
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 O();
r.m_qB = new O();
r.m_lalcA = new I();
r.m_lalcB = new I();
r.m_localAnchorA.Copy(e(n.localAnchorA, new I(-1, 0)));
r.m_localAnchorB.Copy(e(n.localAnchorB, new I(1, 0)));
r.m_maxLength = e(n.maxLength, 0);
return r;
}
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, o = e.velocities[this.m_indexA].w, a = e.positions[this.m_indexB].c, l = e.positions[this.m_indexB].a, u = e.velocities[this.m_indexB].v, h = e.velocities[this.m_indexB].w, _ = this.m_qA.SetAngle(r), f = this.m_qB.SetAngle(l);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
O.MulRV(_, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
O.MulRV(f, this.m_lalcB, this.m_rB);
this.m_u.Copy(a).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;
this.m_state = d > 0 ? t.b2LimitState.e_atUpperLimit : t.b2LimitState.e_inactiveLimit;
if (this.m_length > c) {
this.m_u.SelfMul(1 / this.m_length);
var p = I.CrossVV(this.m_rA, this.m_u), m = I.CrossVV(this.m_rB, this.m_u), y = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m;
this.m_mass = 0 !== y ? 1 / y : 0;
if (e.step.warmStarting) {
this.m_impulse *= e.step.dtRatio;
var v = I.MulSV(this.m_impulse, this.m_u, n.InitVelocityConstraints_s_P);
s.SelfMulSub(this.m_invMassA, v);
o -= this.m_invIA * I.CrossVV(this.m_rA, v);
u.SelfMulAdd(this.m_invMassB, v);
h += this.m_invIB * I.CrossVV(this.m_rB, v);
} else this.m_impulse = 0;
e.velocities[this.m_indexA].w = o;
e.velocities[this.m_indexB].w = h;
} else {
this.m_u.SetZero();
this.m_mass = 0;
this.m_impulse = 0;
}
};
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, o = I.AddVCrossSV(e, i, this.m_rA, n.SolveVelocityConstraints_s_vpA), a = I.AddVCrossSV(r, s, this.m_rB, n.SolveVelocityConstraints_s_vpB), c = this.m_length - this.m_maxLength, l = I.DotVV(this.m_u, I.SubVV(a, o, I.s_t0));
c < 0 && (l += t.step.inv_dt * c);
var u = -this.m_mass * l, h = this.m_impulse;
this.m_impulse = y(0, this.m_impulse + u);
u = this.m_impulse - h;
var _ = I.MulSV(u, this.m_u, n.SolveVelocityConstraints_s_P);
e.SelfMulSub(this.m_invMassA, _);
i -= this.m_invIA * I.CrossVV(this.m_rA, _);
r.SelfMulAdd(this.m_invMassB, _);
s += this.m_invIB * I.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, o = this.m_qA.SetAngle(i), a = this.m_qB.SetAngle(s);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
var l = O.MulRV(o, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
var u = O.MulRV(a, this.m_lalcB, this.m_rB), h = this.m_u.Copy(r).SelfAdd(u).SelfSub(e).SelfSub(l), _ = h.Normalize(), f = _ - this.m_maxLength;
f = g(f, 0, .2);
var d = -this.m_mass * f, p = I.MulSV(d, h, n.SolvePositionConstraints_s_P);
e.SelfMulSub(this.m_invMassA, p);
i -= this.m_invIA * I.CrossVV(l, p);
r.SelfMulAdd(this.m_invMassB, p);
s += this.m_invIB * I.CrossVV(u, p);
t.positions[this.m_indexA].a = i;
t.positions[this.m_indexB].a = s;
return _ - this.m_maxLength < c;
};
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 I.MulSV(t * this.m_impulse, this.m_u, e);
};
n.prototype.GetReactionTorque = function() {
return 0;
};
n.prototype.GetLocalAnchorA = function() {
return this.m_localAnchorA;
};
n.prototype.GetLocalAnchorB = function() {
return this.m_localAnchorB;
};
n.prototype.SetMaxLength = function(t) {
this.m_maxLength = t;
};
n.prototype.GetMaxLength = function() {
return this.m_maxLength;
};
n.prototype.GetLimitState = function() {
return this.m_state;
};
n.prototype.Dump = function(t) {
var e = this.m_bodyA.m_islandIndex, i = this.m_bodyB.m_islandIndex;
t("  const jd: b2RopeJointDef = new b2RopeJointDef();\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.maxLength = %.15f;\n", this.m_maxLength);
t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
};
n.InitVelocityConstraints_s_P = new I();
n.SolveVelocityConstraints_s_vpA = new I();
n.SolveVelocityConstraints_s_vpB = new I();
n.SolveVelocityConstraints_s_P = new I();
n.SolvePositionConstraints_s_P = new I();
return n;
})(oi), Ei = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_weldJoint) || this;
i.localAnchorA = new I();
i.localAnchorB = new I();
i.referenceAngle = 0;
i.frequencyHz = 0;
i.dampingRatio = 0;
return i;
}
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);
this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
};
return i;
})(si), Mi = (function(t) {
Xe(i, t);
function i(i) {
var n = t.call(this, i) || this;
n.m_frequencyHz = 0;
n.m_dampingRatio = 0;
n.m_bias = 0;
n.m_localAnchorA = new I();
n.m_localAnchorB = new I();
n.m_referenceAngle = 0;
n.m_gamma = 0;
n.m_impulse = new P(0, 0, 0);
n.m_indexA = 0;
n.m_indexB = 0;
n.m_rA = new I();
n.m_rB = new I();
n.m_localCenterA = new I();
n.m_localCenterB = new I();
n.m_invMassA = 0;
n.m_invMassB = 0;
n.m_invIA = 0;
n.m_invIB = 0;
n.m_mass = new L();
n.m_qA = new O();
n.m_qB = new O();
n.m_lalcA = new I();
n.m_lalcB = new I();
n.m_K = new L();
n.m_frequencyHz = e(i.frequencyHz, 0);
n.m_dampingRatio = e(i.dampingRatio, 0);
n.m_localAnchorA.Copy(e(i.localAnchorA, I.ZERO));
n.m_localAnchorB.Copy(e(i.localAnchorB, I.ZERO));
n.m_referenceAngle = e(i.referenceAngle, 0);
n.m_impulse.SetZero();
return n;
}
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, n = t.velocities[this.m_indexA].v, r = t.velocities[this.m_indexA].w, o = t.positions[this.m_indexB].a, a = t.velocities[this.m_indexB].v, c = t.velocities[this.m_indexB].w, l = this.m_qA.SetAngle(e), u = this.m_qB.SetAngle(o);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
O.MulRV(l, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
O.MulRV(u, this.m_lalcB, this.m_rB);
var h = this.m_invMassA, _ = this.m_invMassB, f = this.m_invIA, d = this.m_invIB, p = this.m_K;
p.ex.x = h + _ + this.m_rA.y * this.m_rA.y * f + this.m_rB.y * this.m_rB.y * d;
p.ey.x = -this.m_rA.y * this.m_rA.x * f - this.m_rB.y * this.m_rB.x * d;
p.ez.x = -this.m_rA.y * f - this.m_rB.y * d;
p.ex.y = p.ey.x;
p.ey.y = h + _ + this.m_rA.x * this.m_rA.x * f + this.m_rB.x * this.m_rB.x * d;
p.ez.y = this.m_rA.x * f + this.m_rB.x * d;
p.ex.z = p.ez.x;
p.ey.z = p.ez.y;
p.ez.z = f + d;
if (this.m_frequencyHz > 0) {
p.GetInverse22(this.m_mass);
var m = f + d, y = m > 0 ? 1 / m : 0, v = o - e - this.m_referenceAngle, g = 2 * s * this.m_frequencyHz, b = 2 * y * this.m_dampingRatio * g, C = y * g * g, x = t.step.dt;
this.m_gamma = x * (b + x * C);
this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0;
this.m_bias = v * x * C * 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 A = i.InitVelocityConstraints_s_P.Set(this.m_impulse.x, this.m_impulse.y);
n.SelfMulSub(h, A);
r -= f * (I.CrossVV(this.m_rA, A) + this.m_impulse.z);
a.SelfMulAdd(_, A);
c += d * (I.CrossVV(this.m_rB, A) + this.m_impulse.z);
} else this.m_impulse.SetZero();
t.velocities[this.m_indexA].w = r;
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, o = this.m_invMassA, a = this.m_invMassB, c = this.m_invIA, l = this.m_invIB;
if (this.m_frequencyHz > 0) {
var u = s - n, h = -this.m_mass.ez.z * (u + this.m_bias + this.m_gamma * this.m_impulse.z);
this.m_impulse.z += h;
n -= c * h;
s += l * h;
var _ = I.SubVV(I.AddVCrossSV(r, s, this.m_rB, I.s_t0), I.AddVCrossSV(e, n, this.m_rA, I.s_t1), i.SolveVelocityConstraints_s_Cdot1), f = L.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(o, d);
n -= c * I.CrossVV(this.m_rA, d);
r.SelfMulAdd(a, d);
s += l * I.CrossVV(this.m_rB, d);
} else {
_ = I.SubVV(I.AddVCrossSV(r, s, this.m_rB, I.s_t0), I.AddVCrossSV(e, n, this.m_rA, I.s_t1), i.SolveVelocityConstraints_s_Cdot1), 
u = s - n;
var p = L.MulM33XYZ(this.m_mass, _.x, _.y, u, i.SolveVelocityConstraints_s_impulse).SelfNeg();
this.m_impulse.SelfAdd(p);
d = i.SolveVelocityConstraints_s_P.Set(p.x, p.y);
e.SelfMulSub(o, d);
n -= c * (I.CrossVV(this.m_rA, d) + p.z);
r.SelfMulAdd(a, d);
s += l * (I.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, o = this.m_qA.SetAngle(n), a = this.m_qB.SetAngle(s), u = this.m_invMassA, h = this.m_invMassB, _ = this.m_invIA, f = this.m_invIB;
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
var d = O.MulRV(o, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
var p, y, v = O.MulRV(a, this.m_lalcB, this.m_rB), g = this.m_K;
g.ex.x = u + h + d.y * d.y * _ + v.y * v.y * f;
g.ey.x = -d.y * d.x * _ - v.y * v.x * f;
g.ez.x = -d.y * _ - v.y * f;
g.ex.y = g.ey.x;
g.ey.y = u + h + d.x * d.x * _ + v.x * v.x * f;
g.ez.y = d.x * _ + v.x * f;
g.ex.z = g.ez.x;
g.ey.z = g.ez.y;
g.ez.z = _ + f;
if (this.m_frequencyHz > 0) {
p = (C = I.SubVV(I.AddVV(r, v, I.s_t0), I.AddVV(e, d, I.s_t1), i.SolvePositionConstraints_s_C1)).Length();
y = 0;
var b = g.Solve22(C.x, C.y, i.SolvePositionConstraints_s_P).SelfNeg();
e.SelfMulSub(u, b);
n -= _ * I.CrossVV(d, b);
r.SelfMulAdd(h, b);
s += f * I.CrossVV(v, b);
} else {
var C = I.SubVV(I.AddVV(r, v, I.s_t0), I.AddVV(e, d, I.s_t1), i.SolvePositionConstraints_s_C1), x = s - n - this.m_referenceAngle;
p = C.Length();
y = m(x);
var A = g.Solve33(C.x, C.y, x, i.SolvePositionConstraints_s_impulse).SelfNeg();
b = i.SolvePositionConstraints_s_P.Set(A.x, A.y);
e.SelfMulSub(u, b);
n -= _ * (I.CrossVV(this.m_rA, b) + A.z);
r.SelfMulAdd(h, b);
s += f * (I.CrossVV(this.m_rB, b) + A.z);
}
t.positions[this.m_indexA].a = n;
t.positions[this.m_indexB].a = s;
return p <= c && y <= l;
};
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) {
e.x = t * this.m_impulse.x;
e.y = t * this.m_impulse.y;
return 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 I();
i.SolveVelocityConstraints_s_Cdot1 = new I();
i.SolveVelocityConstraints_s_impulse1 = new I();
i.SolveVelocityConstraints_s_impulse = new P();
i.SolveVelocityConstraints_s_P = new I();
i.SolvePositionConstraints_s_C1 = new I();
i.SolvePositionConstraints_s_P = new I();
i.SolvePositionConstraints_s_impulse = new P();
return i;
})(oi), Bi = (function(e) {
Xe(i, e);
function i() {
var i = e.call(this, t.b2JointType.e_wheelJoint) || this;
i.localAnchorA = new I(0, 0);
i.localAnchorB = new I(0, 0);
i.localAxisA = new I(1, 0);
i.enableMotor = !1;
i.maxMotorTorque = 0;
i.motorSpeed = 0;
i.frequencyHz = 2;
i.dampingRatio = .7;
return i;
}
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);
};
return i;
})(si), Ii = (function(t) {
Xe(i, t);
function i(i) {
var n = t.call(this, i) || this;
n.m_frequencyHz = 0;
n.m_dampingRatio = 0;
n.m_localAnchorA = new I();
n.m_localAnchorB = new I();
n.m_localXAxisA = new I();
n.m_localYAxisA = new I();
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 I();
n.m_localCenterB = new I();
n.m_invMassA = 0;
n.m_invMassB = 0;
n.m_invIA = 0;
n.m_invIB = 0;
n.m_ax = new I();
n.m_ay = new I();
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 O();
n.m_qB = new O();
n.m_lalcA = new I();
n.m_lalcB = new I();
n.m_rA = new I();
n.m_rB = new I();
n.m_frequencyHz = e(i.frequencyHz, 2);
n.m_dampingRatio = e(i.dampingRatio, .7);
n.m_localAnchorA.Copy(e(i.localAnchorA, I.ZERO));
n.m_localAnchorB.Copy(e(i.localAnchorB, I.ZERO));
n.m_localXAxisA.Copy(e(i.localAxisA, I.UNITX));
I.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();
return n;
}
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, o = this.m_invIB, a = t.positions[this.m_indexA].c, c = t.positions[this.m_indexA].a, l = t.velocities[this.m_indexA].v, u = t.velocities[this.m_indexA].w, h = 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(c), m = this.m_qB.SetAngle(_);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
var y = O.MulRV(p, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
var v = O.MulRV(m, this.m_lalcB, this.m_rB), g = I.SubVV(I.AddVV(h, v, I.s_t0), I.AddVV(a, y, I.s_t1), i.InitVelocityConstraints_s_d);
O.MulRV(p, this.m_localYAxisA, this.m_ay);
this.m_sAy = I.CrossVV(I.AddVV(g, y, I.s_t0), this.m_ay);
this.m_sBy = I.CrossVV(v, this.m_ay);
this.m_mass = e + n + r * this.m_sAy * this.m_sAy + o * 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;
if (this.m_frequencyHz > 0) {
O.MulRV(p, this.m_localXAxisA, this.m_ax);
this.m_sAx = I.CrossVV(I.AddVV(g, y, I.s_t0), this.m_ax);
this.m_sBx = I.CrossVV(v, this.m_ax);
var b = e + n + r * this.m_sAx * this.m_sAx + o * this.m_sBx * this.m_sBx;
if (b > 0) {
this.m_springMass = 1 / b;
var C = I.DotVV(g, this.m_ax), x = 2 * s * this.m_frequencyHz, A = 2 * this.m_springMass * this.m_dampingRatio * x, S = this.m_springMass * x * x, T = t.step.dt;
this.m_gamma = T * (A + T * S);
this.m_gamma > 0 && (this.m_gamma = 1 / this.m_gamma);
this.m_bias = C * T * S * this.m_gamma;
this.m_springMass = b + 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 + o;
this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass);
} else {
this.m_motorMass = 0;
this.m_motorImpulse = 0;
}
if (t.step.warmStarting) {
this.m_impulse *= t.step.dtRatio;
this.m_springImpulse *= t.step.dtRatio;
this.m_motorImpulse *= t.step.dtRatio;
var w = I.AddVV(I.MulSV(this.m_impulse, this.m_ay, I.s_t0), I.MulSV(this.m_springImpulse, this.m_ax, I.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;
l.SelfMulSub(this.m_invMassA, w);
u -= 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 = u;
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, o = t.velocities[this.m_indexA].v, a = t.velocities[this.m_indexA].w, c = t.velocities[this.m_indexB].v, l = t.velocities[this.m_indexB].w, u = I.DotVV(this.m_ax, I.SubVV(c, o, I.s_t0)) + this.m_sBx * l - this.m_sAx * a, h = -this.m_springMass * (u + this.m_bias + this.m_gamma * this.m_springImpulse);
this.m_springImpulse += h;
var _ = I.MulSV(h, this.m_ax, i.SolveVelocityConstraints_s_P), f = h * this.m_sAx, d = h * this.m_sBx;
o.SelfMulSub(e, _);
a -= r * f;
c.SelfMulAdd(n, _);
u = (l += s * d) - a - this.m_motorSpeed, h = -this.m_motorMass * u;
var p = this.m_motorImpulse, m = t.step.dt * this.m_maxMotorTorque;
this.m_motorImpulse = g(this.m_motorImpulse + h, -m, m);
a -= r * (h = this.m_motorImpulse - p);
l += s * h;
u = I.DotVV(this.m_ay, I.SubVV(c, o, I.s_t0)) + this.m_sBy * l - this.m_sAy * a, 
h = -this.m_mass * u;
this.m_impulse += h;
_ = I.MulSV(h, this.m_ay, i.SolveVelocityConstraints_s_P), f = h * this.m_sAy, d = h * this.m_sBy;
o.SelfMulSub(e, _);
a -= r * f;
c.SelfMulAdd(n, _);
l += s * d;
t.velocities[this.m_indexA].w = a;
t.velocities[this.m_indexB].w = l;
};
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, o = this.m_qA.SetAngle(n), a = this.m_qB.SetAngle(s);
I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
var l = O.MulRV(o, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
var u, h = O.MulRV(a, this.m_lalcB, this.m_rB), _ = I.AddVV(I.SubVV(r, e, I.s_t0), I.SubVV(h, l, I.s_t1), i.SolvePositionConstraints_s_d), f = O.MulRV(o, this.m_localYAxisA, this.m_ay), d = I.CrossVV(I.AddVV(_, l, I.s_t0), f), p = I.CrossVV(h, f), y = I.DotVV(_, this.m_ay), v = this.m_invMassA + this.m_invMassB + this.m_invIA * this.m_sAy * this.m_sAy + this.m_invIB * this.m_sBy * this.m_sBy;
u = 0 !== v ? -y / v : 0;
var g = I.MulSV(u, f, i.SolvePositionConstraints_s_P), b = u * d, C = u * p;
e.SelfMulSub(this.m_invMassA, g);
n -= this.m_invIA * b;
r.SelfMulAdd(this.m_invMassB, g);
s += this.m_invIB * C;
t.positions[this.m_indexA].a = n;
t.positions[this.m_indexB].a = s;
return m(y) <= c;
};
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) {
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);
return 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 I()), n = e.GetWorldPoint(this.m_localAnchorB, new I()), r = I.SubVV(n, i, new I()), s = t.GetWorldVector(this.m_localXAxisA, new I());
return I.DotVV(r, s);
};
i.prototype.GetPrismaticJointSpeed = function() {
var t = this.m_bodyA, e = this.m_bodyB;
I.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA);
var i = O.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA);
I.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB);
var n = O.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB), r = I.AddVV(t.m_sweep.c, i, I.s_t0), s = I.AddVV(e.m_sweep.c, n, I.s_t1), o = I.SubVV(s, r, I.s_t2), a = t.GetWorldVector(this.m_localXAxisA, new I()), c = t.m_linearVelocity, l = e.m_linearVelocity, u = t.m_angularVelocity, h = e.m_angularVelocity;
return I.DotVV(o, I.CrossSV(u, a, I.s_t0)) + I.DotVV(a, I.SubVV(I.AddVCrossSV(l, h, n, I.s_t0), I.AddVCrossSV(c, u, i, I.s_t1), I.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) {
if (t !== this.m_enableMotor) {
this.m_bodyA.SetAwake(!0);
this.m_bodyB.SetAwake(!0);
this.m_enableMotor = t;
}
};
i.prototype.SetMotorSpeed = function(t) {
if (t !== this.m_motorSpeed) {
this.m_bodyA.SetAwake(!0);
this.m_bodyB.SetAwake(!0);
this.m_motorSpeed = t;
}
};
i.prototype.SetMaxMotorTorque = function(t) {
if (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 I();
i.InitVelocityConstraints_s_P = new I();
i.SolveVelocityConstraints_s_P = new I();
i.SolvePositionConstraints_s_d = new I();
i.SolvePositionConstraints_s_P = new I();
return i;
})(oi);
function Di(t, e) {
return A(t * e);
}
function Pi(t, e) {
return t > e ? t : e;
}
var Ri = function(t) {
this.prev = null;
this.next = null;
this.contact = t;
}, Li = (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 pt();
this.m_toiCount = 0;
this.m_toi = 0;
this.m_friction = 0;
this.m_restitution = 0;
this.m_tangentSpeed = 0;
this.m_oldManifold = new pt();
this.m_nodeA = new Ri(this);
this.m_nodeB = new Ri(this);
}
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 = Di(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 = Pi(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 = Di(this.m_fixtureA.m_friction, this.m_fixtureB.m_friction);
this.m_restitution = Pi(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(), o = r || s, a = this.m_fixtureA.GetBody(), c = this.m_fixtureB.GetBody(), l = a.GetTransform(), u = c.GetTransform();
if (o) {
var h = this.m_fixtureA.GetShape(), _ = this.m_fixtureB.GetShape();
i = wt(h, this.m_indexA, _, this.m_indexB, l, u);
this.m_manifold.pointCount = 0;
} else {
this.Evaluate(this.m_manifold, l, u);
i = this.m_manifold.pointCount > 0;
for (var f = 0; f < this.m_manifold.pointCount; ++f) {
var d = this.m_manifold.points[f];
d.normalImpulse = 0;
d.tangentImpulse = 0;
for (var p = d.id, m = 0; m < this.m_oldManifold.pointCount; ++m) {
var y = this.m_oldManifold.points[m];
if (y.id.key === p.key) {
d.normalImpulse = y.normalImpulse;
d.tangentImpulse = y.tangentImpulse;
break;
}
}
}
if (i !== n) {
a.SetAwake(!0);
c.SetAwake(!0);
}
}
this.m_touchingFlag = i;
!n && i && t && t.BeginContact(this);
n && !i && t && t.EndContact(this);
!o && i && t && t.PreSolve(this, this.m_oldManifold);
};
t.prototype.ComputeTOI = function(e, i) {
var n = t.ComputeTOI_s_input;
n.proxyA.SetShape(this.m_fixtureA.GetShape(), this.m_indexA);
n.proxyB.SetShape(this.m_fixtureB.GetShape(), this.m_indexB);
n.sweepA.Copy(e);
n.sweepB.Copy(i);
n.tMax = c;
var r = t.ComputeTOI_s_output;
Qt(r, n);
return r.t;
};
t.ComputeTOI_s_input = new kt();
t.ComputeTOI_s_output = new Gt();
return t;
})(), Oi = (function(t) {
Xe(e, t);
function e() {
return t.call(this) || this;
}
e.Create = function() {
return new e();
};
e.Destroy = function() {};
e.prototype.Reset = function(e, i, n, r) {
t.prototype.Reset.call(this, e, i, n, r);
};
e.prototype.Evaluate = function(t, e, i) {
ee(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i);
};
return e;
})(Li), Vi = (function(t) {
Xe(e, t);
function e() {
return t.call(this) || this;
}
e.Create = function() {
return new e();
};
e.Destroy = function() {};
e.prototype.Reset = function(e, i, n, r) {
t.prototype.Reset.call(this, e, i, n, r);
};
e.prototype.Evaluate = function(t, e, i) {
Be(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i);
};
return e;
})(Li), Ni = (function(t) {
Xe(e, t);
function e() {
return t.call(this) || this;
}
e.Create = function() {
return new e();
};
e.Destroy = function() {};
e.prototype.Reset = function(e, i, n, r) {
t.prototype.Reset.call(this, e, i, n, r);
};
e.prototype.Evaluate = function(t, e, i) {
se(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i);
};
return e;
})(Li), Fi = (function(t) {
Xe(e, t);
function e() {
return t.call(this) || this;
}
e.Create = function() {
return new e();
};
e.Destroy = function() {};
e.prototype.Reset = function(e, i, n, r) {
t.prototype.Reset.call(this, e, i, n, r);
};
e.prototype.Evaluate = function(t, e, i) {
Fe(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i);
};
return e;
})(Li), zi = (function(t) {
Xe(e, t);
function e() {
return t.call(this) || this;
}
e.Create = function() {
return new e();
};
e.Destroy = function() {};
e.prototype.Reset = function(e, i, n, r) {
t.prototype.Reset.call(this, e, i, n, r);
};
e.prototype.Evaluate = function(t, e, i) {
He(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i);
};
return e;
})(Li), ki = (function(t) {
Xe(e, t);
function e() {
return t.call(this) || this;
}
e.Create = function() {
return new e();
};
e.Destroy = function() {};
e.prototype.Reset = function(e, i, n, r) {
t.prototype.Reset.call(this, e, i, n, r);
};
e.prototype.Evaluate = function(t, i, n) {
var r = this.m_fixtureA.GetShape(), s = this.m_fixtureB.GetShape(), o = r, a = e.Evaluate_s_edge;
o.GetChildEdge(a, this.m_indexA);
Fe(t, a, i, s, n);
};
e.Evaluate_s_edge = new Ze();
return e;
})(Li), Gi = (function(t) {
Xe(e, t);
function e() {
return t.call(this) || this;
}
e.Create = function() {
return new e();
};
e.Destroy = function() {};
e.prototype.Reset = function(e, i, n, r) {
t.prototype.Reset.call(this, e, i, n, r);
};
e.prototype.Evaluate = function(t, i, n) {
var r = this.m_fixtureA.GetShape(), s = this.m_fixtureB.GetShape(), o = r, a = e.Evaluate_s_edge;
o.GetChildEdge(a, this.m_indexA);
He(t, a, i, s, n);
};
e.Evaluate_s_edge = new Ze();
return e;
})(Li), Ui = function() {
this.createFcn = null;
this.destroyFcn = null;
this.primary = !1;
}, Hi = (function() {
function e(t) {
this.m_allocator = null;
this.m_allocator = t;
this.InitializeRegisters();
}
e.prototype.AddType = function(t, e, i, n) {
var r = this, s = d(256, (function() {
return t(r.m_allocator);
}));
function o(e) {
return s.pop() || t(e);
}
function a(t) {
s.push(t);
}
this.m_registers[i][n].createFcn = o;
this.m_registers[i][n].destroyFcn = a;
this.m_registers[i][n].primary = !0;
if (i !== n) {
this.m_registers[n][i].createFcn = o;
this.m_registers[n][i].destroyFcn = a;
this.m_registers[n][i].primary = !1;
}
};
e.prototype.InitializeRegisters = function() {
this.m_registers = [];
for (var e = 0; e < t.b2ShapeType.e_shapeTypeCount; e++) {
this.m_registers[e] = [];
for (var i = 0; i < t.b2ShapeType.e_shapeTypeCount; i++) this.m_registers[e][i] = new Ui();
}
this.AddType(Oi.Create, Oi.Destroy, t.b2ShapeType.e_circleShape, t.b2ShapeType.e_circleShape);
this.AddType(Ni.Create, Ni.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_circleShape);
this.AddType(Vi.Create, Vi.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_polygonShape);
this.AddType(Fi.Create, Fi.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_circleShape);
this.AddType(zi.Create, zi.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_polygonShape);
this.AddType(ki.Create, ki.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_circleShape);
this.AddType(Gi.Create, Gi.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_polygonShape);
};
e.prototype.Create = function(t, e, i, n) {
var r = t.GetType(), s = i.GetType(), o = this.m_registers[r][s];
if (o.createFcn) {
var a = o.createFcn(this.m_allocator);
o.primary ? a.Reset(t, e, i, n) : a.Reset(i, n, t, e);
return a;
}
return null;
};
e.prototype.Destroy = function(t) {
var e = t.m_fixtureA, i = t.m_fixtureB;
if (t.m_manifold.pointCount > 0 && !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);
};
return e;
})(), ji = (function() {
function t() {}
t.prototype.SayGoodbyeJoint = function() {};
t.prototype.SayGoodbyeFixture = function() {};
t.prototype.SayGoodbyeParticleGroup = function() {};
t.prototype.SayGoodbyeParticle = function() {};
return t;
})(), Wi = (function() {
function e() {}
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(), o = i.GetFilterData();
return s.groupIndex === o.groupIndex && 0 !== s.groupIndex ? s.groupIndex > 0 : 0 != (s.maskBits & o.categoryBits) && 0 != (s.categoryBits & o.maskBits);
};
e.prototype.ShouldCollideFixtureParticle = function() {
return !0;
};
e.prototype.ShouldCollideParticleParticle = function() {
return !0;
};
e.b2_defaultFilter = new e();
return e;
})(), qi = function() {
this.normalImpulses = p(o);
this.tangentImpulses = p(o);
this.count = 0;
}, Xi = (function() {
function t() {}
t.prototype.BeginContact = function() {};
t.prototype.EndContact = function() {};
t.prototype.BeginContactFixtureParticle = function() {};
t.prototype.EndContactFixtureParticle = function() {};
t.prototype.BeginContactParticleParticle = function() {};
t.prototype.EndContactParticleParticle = function() {};
t.prototype.PreSolve = function() {};
t.prototype.PostSolve = function() {};
t.b2_defaultListener = new t();
return t;
})(), Yi = (function() {
function t() {}
t.prototype.ReportFixture = function() {
return !0;
};
t.prototype.ReportParticle = function() {
return !1;
};
t.prototype.ShouldQueryParticleSystem = function() {
return !0;
};
return t;
})(), Ji = (function() {
function t() {}
t.prototype.ReportFixture = function(t, e, i, n) {
return n;
};
t.prototype.ReportParticle = function() {
return 0;
};
t.prototype.ShouldQueryParticleSystem = function() {
return !0;
};
return t;
})(), Zi = (function() {
function e() {
this.m_broadPhase = new Dt();
this.m_contactList = null;
this.m_contactCount = 0;
this.m_contactFilter = Wi.b2_defaultFilter;
this.m_contactListener = Xi.b2_defaultListener;
this.m_allocator = null;
this.m_contactFactory = new Hi(this.m_allocator);
}
e.prototype.AddPair = function(t, e) {
var i = t.fixture, n = e.fixture, r = t.childIndex, s = e.childIndex, o = i.GetBody(), a = n.GetBody();
if (o !== a) {
for (var c = a.GetContactList(); c; ) {
if (c.other === o) {
var l = c.contact.GetFixtureA(), u = c.contact.GetFixtureB(), h = c.contact.GetChildIndexA(), _ = c.contact.GetChildIndexB();
if (l === i && u === n && h === r && _ === s) return;
if (l === n && u === i && h === s && _ === r) return;
}
c = c.next;
}
if (!this.m_contactFilter || this.m_contactFilter.ShouldCollide(i, n)) {
var f = this.m_contactFactory.Create(i, r, n, s);
if (null !== f) {
i = f.GetFixtureA();
n = f.GetFixtureB();
r = f.GetChildIndexA();
s = f.GetChildIndexB();
o = i.m_body;
a = 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 = a;
f.m_nodeA.prev = null;
f.m_nodeA.next = o.m_contactList;
null !== o.m_contactList && (o.m_contactList.prev = f.m_nodeA);
o.m_contactList = f.m_nodeA;
f.m_nodeB.contact = f;
f.m_nodeB.other = o;
f.m_nodeB.prev = null;
f.m_nodeB.next = a.m_contactList;
null !== a.m_contactList && (a.m_contactList.prev = f.m_nodeB);
a.m_contactList = f.m_nodeB;
if (!i.IsSensor() && !n.IsSensor()) {
o.SetAwake(!0);
a.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(), o = i.GetBody(), a = n.GetBody();
if (e.m_filterFlag) {
if (this.m_contactFilter && !this.m_contactFilter.ShouldCollide(i, n)) {
e = (_ = e).m_next;
this.Destroy(_);
continue;
}
e.m_filterFlag = !1;
}
var c = o.IsAwake() && o.m_type !== t.b2BodyType.b2_staticBody, l = a.IsAwake() && a.m_type !== t.b2BodyType.b2_staticBody;
if (c || l) {
var u = i.m_proxies[r].treeNode, h = n.m_proxies[s].treeNode;
if (Ct(u.aabb, h.aabb)) {
e.Update(this.m_contactListener);
e = e.m_next;
} else {
var _;
e = (_ = e).m_next;
this.Destroy(_);
}
} else e = e.m_next;
}
};
return e;
})(), Ki = (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;
}
t.prototype.Reset = function() {
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 this;
};
return t;
})(), Qi = (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;
}
t.prototype.Copy = function(t) {
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;
return this;
};
return t;
})(), $i = (function() {
function t() {
this.c = new I();
this.a = 0;
}
t.MakeArray = function(e) {
return d(e, (function() {
return new t();
}));
};
return t;
})(), tn = (function() {
function t() {
this.v = new I();
this.w = 0;
}
t.MakeArray = function(e) {
return d(e, (function() {
return new t();
}));
};
return t;
})(), en = function() {
this.step = new Qi();
}, nn = (function() {
function t() {
this.rA = new I();
this.rB = new I();
this.normalImpulse = 0;
this.tangentImpulse = 0;
this.normalMass = 0;
this.tangentMass = 0;
this.velocityBias = 0;
}
t.MakeArray = function(e) {
return d(e, (function() {
return new t();
}));
};
return t;
})(), rn = (function() {
function t() {
this.points = nn.MakeArray(o);
this.normal = new I();
this.tangent = new I();
this.normalMass = new R();
this.K = new R();
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;
}
t.MakeArray = function(e) {
return d(e, (function() {
return new t();
}));
};
return t;
})(), sn = (function() {
function e() {
this.localPoints = I.MakeArray(o);
this.localNormal = new I();
this.localPoint = new I();
this.indexA = 0;
this.indexB = 0;
this.invMassA = 0;
this.invMassB = 0;
this.localCenterA = new I();
this.localCenterB = new I();
this.invIA = 0;
this.invIB = 0;
this.type = t.b2ManifoldType.e_unknown;
this.radiusA = 0;
this.radiusB = 0;
this.pointCount = 0;
}
e.MakeArray = function(t) {
return d(t, (function() {
return new e();
}));
};
return e;
})(), on = function() {
this.step = new Qi();
this.count = 0;
this.allocator = null;
}, an = (function() {
function e() {
this.normal = new I();
this.point = new I();
this.separation = 0;
}
e.prototype.Initialize = function(i, n, r, s) {
var o = e.Initialize_s_pointA, a = e.Initialize_s_pointB, c = e.Initialize_s_planePoint, l = e.Initialize_s_clipPoint;
switch (i.type) {
case t.b2ManifoldType.e_circles:
V.MulXV(n, i.localPoint, o);
V.MulXV(r, i.localPoints[0], a);
I.SubVV(a, o, this.normal).SelfNormalize();
I.MidVV(o, a, this.point);
this.separation = I.DotVV(I.SubVV(a, o, I.s_t0), this.normal) - i.radiusA - i.radiusB;
break;

case t.b2ManifoldType.e_faceA:
O.MulRV(n.q, i.localNormal, this.normal);
V.MulXV(n, i.localPoint, c);
V.MulXV(r, i.localPoints[s], l);
this.separation = I.DotVV(I.SubVV(l, c, I.s_t0), this.normal) - i.radiusA - i.radiusB;
this.point.Copy(l);
break;

case t.b2ManifoldType.e_faceB:
O.MulRV(r.q, i.localNormal, this.normal);
V.MulXV(r, i.localPoint, c);
V.MulXV(n, i.localPoints[s], l);
this.separation = I.DotVV(I.SubVV(l, c, I.s_t0), this.normal) - i.radiusA - i.radiusB;
this.point.Copy(l);
this.normal.SelfNeg();
}
};
e.Initialize_s_pointA = new I();
e.Initialize_s_pointB = new I();
e.Initialize_s_planePoint = new I();
e.Initialize_s_clipPoint = new I();
return e;
})(), cn = (function() {
function t() {
this.m_step = new Qi();
this.m_allocator = null;
this.m_positionConstraints = sn.MakeArray(1024);
this.m_velocityConstraints = rn.MakeArray(1024);
this.m_count = 0;
}
t.prototype.Initialize = function(t) {
this.m_step.Copy(t.step);
this.m_allocator = t.allocator;
this.m_count = t.count;
if (this.m_positionConstraints.length < this.m_count) for (var e = v(2 * this.m_positionConstraints.length, this.m_count); this.m_positionConstraints.length < e; ) this.m_positionConstraints[this.m_positionConstraints.length] = new sn();
if (this.m_velocityConstraints.length < this.m_count) for (e = v(2 * this.m_velocityConstraints.length, this.m_count); this.m_velocityConstraints.length < e; ) this.m_velocityConstraints[this.m_velocityConstraints.length] = new rn();
this.m_positions = t.positions;
this.m_velocities = t.velocities;
this.m_contacts = t.contacts;
for (var i = 0; i < this.m_count; ++i) {
var n = this.m_contacts[i], r = n.m_fixtureA, s = n.m_fixtureB, o = r.GetShape(), a = s.GetShape(), c = o.m_radius, l = a.m_radius, u = r.GetBody(), h = s.GetBody(), _ = n.GetManifold(), f = _.pointCount, d = this.m_velocityConstraints[i];
d.friction = n.m_friction;
d.restitution = n.m_restitution;
d.tangentSpeed = n.m_tangentSpeed;
d.indexA = u.m_islandIndex;
d.indexB = h.m_islandIndex;
d.invMassA = u.m_invMass;
d.invMassB = h.m_invMass;
d.invIA = u.m_invI;
d.invIB = h.m_invI;
d.contactIndex = i;
d.pointCount = f;
d.K.SetZero();
d.normalMass.SetZero();
var p = this.m_positionConstraints[i];
p.indexA = u.m_islandIndex;
p.indexB = h.m_islandIndex;
p.invMassA = u.m_invMass;
p.invMassB = h.m_invMass;
p.localCenterA.Copy(u.m_sweep.localCenter);
p.localCenterB.Copy(h.m_sweep.localCenter);
p.invIA = u.m_invI;
p.invIB = h.m_invI;
p.localNormal.Copy(_.localNormal);
p.localPoint.Copy(_.localPoint);
p.pointCount = f;
p.radiusA = c;
p.radiusB = l;
p.type = _.type;
for (var m = 0; m < f; ++m) {
var y = _.points[m], g = d.points[m];
if (this.m_step.warmStarting) {
g.normalImpulse = this.m_step.dtRatio * y.normalImpulse;
g.tangentImpulse = this.m_step.dtRatio * y.tangentImpulse;
} else {
g.normalImpulse = 0;
g.tangentImpulse = 0;
}
g.rA.SetZero();
g.rB.SetZero();
g.normalMass = 0;
g.tangentMass = 0;
g.velocityBias = 0;
p.localPoints[m].Copy(y.localPoint);
}
}
return this;
};
t.prototype.InitializeVelocityConstraints = function() {
for (var e = t.InitializeVelocityConstraints_s_xfA, i = t.InitializeVelocityConstraints_s_xfB, n = t.InitializeVelocityConstraints_s_worldManifold, r = 0; r < this.m_count; ++r) {
var s = this.m_velocityConstraints[r], o = this.m_positionConstraints[r], a = o.radiusA, c = o.radiusB, l = this.m_contacts[s.contactIndex].GetManifold(), u = s.indexA, h = s.indexB, _ = s.invMassA, f = s.invMassB, d = s.invIA, p = s.invIB, m = o.localCenterA, y = o.localCenterB, v = this.m_positions[u].c, g = this.m_positions[u].a, b = this.m_velocities[u].v, C = this.m_velocities[u].w, x = this.m_positions[h].c, A = this.m_positions[h].a, S = this.m_velocities[h].v, T = this.m_velocities[h].w;
e.q.SetAngle(g);
i.q.SetAngle(A);
I.SubVV(v, O.MulRV(e.q, m, I.s_t0), e.p);
I.SubVV(x, O.MulRV(i.q, y, I.s_t0), i.p);
n.Initialize(l, e, a, i, c);
s.normal.Copy(n.normal);
I.CrossVOne(s.normal, s.tangent);
for (var w = s.pointCount, E = 0; E < w; ++E) {
var M = s.points[E];
I.SubVV(n.points[E], v, M.rA);
I.SubVV(n.points[E], x, M.rB);
var B = I.CrossVV(M.rA, s.normal), D = I.CrossVV(M.rB, s.normal), P = _ + f + d * B * B + p * D * D;
M.normalMass = P > 0 ? 1 / P : 0;
var R = s.tangent, L = I.CrossVV(M.rA, R), V = I.CrossVV(M.rB, R), N = _ + f + d * L * L + p * V * V;
M.tangentMass = N > 0 ? 1 / N : 0;
M.velocityBias = 0;
var F = I.DotVV(s.normal, I.SubVV(I.AddVCrossSV(S, T, M.rB, I.s_t0), I.AddVCrossSV(b, C, M.rA, I.s_t1), I.s_t0));
F < -1 && (M.velocityBias += -s.restitution * F);
}
s.pointCount;
}
};
t.prototype.WarmStart = function() {
for (var e = t.WarmStart_s_P, i = 0; i < this.m_count; ++i) {
for (var n = this.m_velocityConstraints[i], r = n.indexA, s = n.indexB, o = n.invMassA, a = n.invIA, c = n.invMassB, l = n.invIB, u = n.pointCount, h = this.m_velocities[r].v, _ = this.m_velocities[r].w, f = this.m_velocities[s].v, d = this.m_velocities[s].w, p = n.normal, m = n.tangent, y = 0; y < u; ++y) {
var v = n.points[y];
I.AddVV(I.MulSV(v.normalImpulse, p, I.s_t0), I.MulSV(v.tangentImpulse, m, I.s_t1), e);
_ -= a * I.CrossVV(v.rA, e);
h.SelfMulSub(o, e);
d += l * I.CrossVV(v.rB, e);
f.SelfMulAdd(c, e);
}
this.m_velocities[r].w = _;
this.m_velocities[s].w = d;
}
};
t.prototype.SolveVelocityConstraints = function() {
for (var e = t.SolveVelocityConstraints_s_dv, i = (t.SolveVelocityConstraints_s_dv1, 
t.SolveVelocityConstraints_s_dv2, t.SolveVelocityConstraints_s_P), n = (t.SolveVelocityConstraints_s_a, 
t.SolveVelocityConstraints_s_b, t.SolveVelocityConstraints_s_x, t.SolveVelocityConstraints_s_d, 
t.SolveVelocityConstraints_s_P1, t.SolveVelocityConstraints_s_P2, t.SolveVelocityConstraints_s_P1P2, 
0); n < this.m_count; ++n) {
for (var r = this.m_velocityConstraints[n], s = r.indexA, o = r.indexB, a = r.invMassA, c = r.invIA, l = r.invMassB, u = r.invIB, h = r.pointCount, _ = this.m_velocities[s].v, f = this.m_velocities[s].w, d = this.m_velocities[o].v, p = this.m_velocities[o].w, m = r.normal, y = r.tangent, b = r.friction, C = 0; C < h; ++C) {
var x = r.points[C];
I.SubVV(I.AddVCrossSV(d, p, x.rB, I.s_t0), I.AddVCrossSV(_, f, x.rA, I.s_t1), e);
var A = I.DotVV(e, y) - r.tangentSpeed, S = x.tangentMass * -A, T = b * x.normalImpulse;
S = (w = g(x.tangentImpulse + S, -T, T)) - x.tangentImpulse;
x.tangentImpulse = w;
I.MulSV(S, y, i);
_.SelfMulSub(a, i);
f -= c * I.CrossVV(x.rA, i);
d.SelfMulAdd(l, i);
p += u * I.CrossVV(x.rB, i);
}
r.pointCount;
for (C = 0; C < h; ++C) {
x = r.points[C];
I.SubVV(I.AddVCrossSV(d, p, x.rB, I.s_t0), I.AddVCrossSV(_, f, x.rA, I.s_t1), e);
var w, E = I.DotVV(e, m);
S = -x.normalMass * (E - x.velocityBias);
S = (w = v(x.normalImpulse + S, 0)) - x.normalImpulse;
x.normalImpulse = w;
I.MulSV(S, m, i);
_.SelfMulSub(a, i);
f -= c * I.CrossVV(x.rA, i);
d.SelfMulAdd(l, i);
p += u * I.CrossVV(x.rB, i);
}
this.m_velocities[s].w = f;
this.m_velocities[o].w = p;
}
};
t.prototype.StoreImpulses = function() {
for (var t = 0; t < this.m_count; ++t) for (var e = this.m_velocityConstraints[t], i = this.m_contacts[e.contactIndex].GetManifold(), n = 0; n < e.pointCount; ++n) {
i.points[n].normalImpulse = e.points[n].normalImpulse;
i.points[n].tangentImpulse = e.points[n].tangentImpulse;
}
};
t.prototype.SolvePositionConstraints = function() {
for (var e = t.SolvePositionConstraints_s_xfA, i = t.SolvePositionConstraints_s_xfB, n = t.SolvePositionConstraints_s_psm, r = t.SolvePositionConstraints_s_rA, s = t.SolvePositionConstraints_s_rB, o = t.SolvePositionConstraints_s_P, a = 0, l = 0; l < this.m_count; ++l) {
for (var u = this.m_positionConstraints[l], h = u.indexA, _ = u.indexB, f = u.localCenterA, d = u.invMassA, p = u.invIA, m = u.localCenterB, v = u.invMassB, b = u.invIB, C = u.pointCount, x = this.m_positions[h].c, A = this.m_positions[h].a, S = this.m_positions[_].c, T = this.m_positions[_].a, w = 0; w < C; ++w) {
e.q.SetAngle(A);
i.q.SetAngle(T);
I.SubVV(x, O.MulRV(e.q, f, I.s_t0), e.p);
I.SubVV(S, O.MulRV(i.q, m, I.s_t0), i.p);
n.Initialize(u, e, i, w);
var E = n.normal, M = n.point, B = n.separation;
I.SubVV(M, x, r);
I.SubVV(M, S, s);
a = y(a, B);
var D = g(.2 * (B + c), -.2, 0), P = I.CrossVV(r, E), R = I.CrossVV(s, E), L = d + v + p * P * P + b * R * R, V = L > 0 ? -D / L : 0;
I.MulSV(V, E, o);
x.SelfMulSub(d, o);
A -= p * I.CrossVV(r, o);
S.SelfMulAdd(v, o);
T += b * I.CrossVV(s, o);
}
this.m_positions[h].a = A;
this.m_positions[_].a = T;
}
return a > -3 * c;
};
t.prototype.SolveTOIPositionConstraints = function(e, i) {
for (var n = t.SolveTOIPositionConstraints_s_xfA, r = t.SolveTOIPositionConstraints_s_xfB, s = t.SolveTOIPositionConstraints_s_psm, o = t.SolveTOIPositionConstraints_s_rA, a = t.SolveTOIPositionConstraints_s_rB, l = t.SolveTOIPositionConstraints_s_P, u = 0, h = 0; h < this.m_count; ++h) {
var _ = this.m_positionConstraints[h], f = _.indexA, d = _.indexB, p = _.localCenterA, m = _.localCenterB, v = _.pointCount, b = 0, C = 0;
if (f === e || f === i) {
b = _.invMassA;
C = _.invIA;
}
var x = 0, A = 0;
if (d === e || d === i) {
x = _.invMassB;
A = _.invIB;
}
for (var S = this.m_positions[f].c, T = this.m_positions[f].a, w = this.m_positions[d].c, E = this.m_positions[d].a, M = 0; M < v; ++M) {
n.q.SetAngle(T);
r.q.SetAngle(E);
I.SubVV(S, O.MulRV(n.q, p, I.s_t0), n.p);
I.SubVV(w, O.MulRV(r.q, m, I.s_t0), r.p);
s.Initialize(_, n, r, M);
var B = s.normal, D = s.point, P = s.separation;
I.SubVV(D, S, o);
I.SubVV(D, w, a);
u = y(u, P);
var R = g(.75 * (P + c), -.2, 0), L = I.CrossVV(o, B), V = I.CrossVV(a, B), N = b + x + C * L * L + A * V * V, F = N > 0 ? -R / N : 0;
I.MulSV(F, B, l);
S.SelfMulSub(b, l);
T -= C * I.CrossVV(o, l);
w.SelfMulAdd(x, l);
E += A * I.CrossVV(a, l);
}
this.m_positions[f].a = T;
this.m_positions[d].a = E;
}
return u >= -1.5 * c;
};
t.InitializeVelocityConstraints_s_xfA = new V();
t.InitializeVelocityConstraints_s_xfB = new V();
t.InitializeVelocityConstraints_s_worldManifold = new mt();
t.WarmStart_s_P = new I();
t.SolveVelocityConstraints_s_dv = new I();
t.SolveVelocityConstraints_s_dv1 = new I();
t.SolveVelocityConstraints_s_dv2 = new I();
t.SolveVelocityConstraints_s_P = new I();
t.SolveVelocityConstraints_s_a = new I();
t.SolveVelocityConstraints_s_b = new I();
t.SolveVelocityConstraints_s_x = new I();
t.SolveVelocityConstraints_s_d = new I();
t.SolveVelocityConstraints_s_P1 = new I();
t.SolveVelocityConstraints_s_P2 = new I();
t.SolveVelocityConstraints_s_P1P2 = new I();
t.SolvePositionConstraints_s_xfA = new V();
t.SolvePositionConstraints_s_xfB = new V();
t.SolvePositionConstraints_s_psm = new an();
t.SolvePositionConstraints_s_rA = new I();
t.SolvePositionConstraints_s_rB = new I();
t.SolvePositionConstraints_s_P = new I();
t.SolveTOIPositionConstraints_s_xfA = new V();
t.SolveTOIPositionConstraints_s_xfB = new V();
t.SolveTOIPositionConstraints_s_psm = new an();
t.SolveTOIPositionConstraints_s_rA = new I();
t.SolveTOIPositionConstraints_s_rB = new I();
t.SolveTOIPositionConstraints_s_P = new I();
return t;
})(), ln = (function() {
function e() {
this.m_allocator = null;
this.m_bodies = [];
this.m_contacts = [];
this.m_joints = [];
this.m_positions = $i.MakeArray(1024);
this.m_velocities = tn.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;
}
e.prototype.Initialize = function(t, e, i, n, r) {
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;
if (this.m_positions.length < t) for (var s = v(2 * this.m_positions.length, t); this.m_positions.length < s; ) this.m_positions[this.m_positions.length] = new $i();
if (this.m_velocities.length < t) for (s = v(2 * this.m_velocities.length, t); this.m_velocities.length < s; ) this.m_velocities[this.m_velocities.length] = new tn();
};
e.prototype.Clear = function() {
this.m_bodyCount = 0;
this.m_contactCount = 0;
this.m_jointCount = 0;
};
e.prototype.AddBody = function(t) {
t.m_islandIndex = this.m_bodyCount;
this.m_bodies[this.m_bodyCount++] = t;
};
e.prototype.AddContact = function(t) {
this.m_contacts[this.m_contactCount++] = t;
};
e.prototype.AddJoint = function(t) {
this.m_joints[this.m_jointCount++] = t;
};
e.prototype.Solve = function(n, r, s, o) {
for (var a = e.s_timer.Reset(), c = r.dt, l = 0; l < this.m_bodyCount; ++l) {
var u = this.m_bodies[l];
this.m_positions[l].c.Copy(u.m_sweep.c);
var h = u.m_sweep.a, _ = this.m_velocities[l].v.Copy(u.m_linearVelocity), f = u.m_angularVelocity;
u.m_sweep.c0.Copy(u.m_sweep.c);
u.m_sweep.a0 = u.m_sweep.a;
if (u.m_type === t.b2BodyType.b2_dynamicBody) {
_.x += c * (u.m_gravityScale * s.x + u.m_invMass * u.m_force.x);
_.y += c * (u.m_gravityScale * s.y + u.m_invMass * u.m_force.y);
f += c * u.m_invI * u.m_torque;
_.SelfMul(1 / (1 + c * u.m_linearDamping));
f *= 1 / (1 + c * u.m_angularDamping);
}
this.m_positions[l].a = h;
this.m_velocities[l].w = f;
}
a.Reset();
var d = e.s_solverData;
d.step.Copy(r);
d.positions = this.m_positions;
d.velocities = this.m_velocities;
var p = e.s_contactSolverDef;
p.step.Copy(r);
p.contacts = this.m_contacts;
p.count = this.m_contactCount;
p.positions = this.m_positions;
p.velocities = this.m_velocities;
p.allocator = this.m_allocator;
var v = e.s_contactSolver.Initialize(p);
v.InitializeVelocityConstraints();
r.warmStarting && v.WarmStart();
for (l = 0; l < this.m_jointCount; ++l) this.m_joints[l].InitVelocityConstraints(d);
n.solveInit = a.GetMilliseconds();
a.Reset();
for (l = 0; l < r.velocityIterations; ++l) {
for (var g = 0; g < this.m_jointCount; ++g) this.m_joints[g].SolveVelocityConstraints(d);
v.SolveVelocityConstraints();
}
v.StoreImpulses();
n.solveVelocity = a.GetMilliseconds();
for (l = 0; l < this.m_bodyCount; ++l) {
var b = this.m_positions[l].c, C = (h = this.m_positions[l].a, _ = this.m_velocities[l].v, 
f = this.m_velocities[l].w, I.MulSV(c, _, e.s_translation));
if (I.DotVV(C, C) > 4) {
var x = 2 / C.Length();
_.SelfMul(x);
}
var A = c * f;
A * A > 2.4674011002726646 && (f *= x = 1.570796326795 / m(A));
b.x += c * _.x;
b.y += c * _.y;
h += c * f;
this.m_positions[l].a = h;
this.m_velocities[l].w = f;
}
a.Reset();
var S = !1;
for (l = 0; l < r.positionIterations; ++l) {
var T = v.SolvePositionConstraints(), w = !0;
for (g = 0; g < this.m_jointCount; ++g) {
var E = this.m_joints[g].SolvePositionConstraints(d);
w = w && E;
}
if (T && w) {
S = !0;
break;
}
}
for (l = 0; l < this.m_bodyCount; ++l) {
var M = this.m_bodies[l];
M.m_sweep.c.Copy(this.m_positions[l].c);
M.m_sweep.a = this.m_positions[l].a;
M.m_linearVelocity.Copy(this.m_velocities[l].v);
M.m_angularVelocity = this.m_velocities[l].w;
M.SynchronizeTransform();
}
n.solvePosition = a.GetMilliseconds();
this.Report(v.m_velocityConstraints);
if (o) {
var B = i;
for (l = 0; l < this.m_bodyCount; ++l) if ((u = this.m_bodies[l]).GetType() !== t.b2BodyType.b2_staticBody) if (!u.m_autoSleepFlag || u.m_angularVelocity * u.m_angularVelocity > .0012184696791469947 || I.DotVV(u.m_linearVelocity, u.m_linearVelocity) > 1e-4) {
u.m_sleepTime = 0;
B = 0;
} else {
u.m_sleepTime += c;
B = y(B, u.m_sleepTime);
}
if (B >= .5 && S) for (l = 0; l < this.m_bodyCount; ++l) (u = this.m_bodies[l]).SetAwake(!1);
}
};
e.prototype.SolveTOI = function(t, i, n) {
for (var r = 0; r < this.m_bodyCount; ++r) {
var s = this.m_bodies[r];
this.m_positions[r].c.Copy(s.m_sweep.c);
this.m_positions[r].a = s.m_sweep.a;
this.m_velocities[r].v.Copy(s.m_linearVelocity);
this.m_velocities[r].w = s.m_angularVelocity;
}
var o = e.s_contactSolverDef;
o.contacts = this.m_contacts;
o.count = this.m_contactCount;
o.allocator = this.m_allocator;
o.step.Copy(t);
o.positions = this.m_positions;
o.velocities = this.m_velocities;
var a = e.s_contactSolver.Initialize(o);
for (r = 0; r < t.positionIterations && !a.SolveTOIPositionConstraints(i, n); ++r) ;
this.m_bodies[i].m_sweep.c0.Copy(this.m_positions[i].c);
this.m_bodies[i].m_sweep.a0 = this.m_positions[i].a;
this.m_bodies[n].m_sweep.c0.Copy(this.m_positions[n].c);
this.m_bodies[n].m_sweep.a0 = this.m_positions[n].a;
a.InitializeVelocityConstraints();
for (r = 0; r < t.velocityIterations; ++r) a.SolveVelocityConstraints();
var c = t.dt;
for (r = 0; r < this.m_bodyCount; ++r) {
var l = this.m_positions[r].c, u = this.m_positions[r].a, h = this.m_velocities[r].v, _ = this.m_velocities[r].w, f = I.MulSV(c, h, e.s_translation);
if (I.DotVV(f, f) > 4) {
var d = 2 / f.Length();
h.SelfMul(d);
}
var p = c * _;
p * p > 2.4674011002726646 && (_ *= d = 1.570796326795 / m(p));
l.SelfMulAdd(c, h);
u += c * _;
this.m_positions[r].a = u;
this.m_velocities[r].w = _;
var y = this.m_bodies[r];
y.m_sweep.c.Copy(l);
y.m_sweep.a = u;
y.m_linearVelocity.Copy(h);
y.m_angularVelocity = _;
y.SynchronizeTransform();
}
this.Report(a.m_velocityConstraints);
};
e.prototype.Report = function(t) {
if (null !== this.m_listener) for (var i = 0; i < this.m_contactCount; ++i) {
var n = this.m_contacts[i];
if (n) {
var r = t[i], s = e.s_impulse;
s.count = r.pointCount;
for (var o = 0; o < r.pointCount; ++o) {
s.normalImpulses[o] = r.points[o].normalImpulse;
s.tangentImpulses[o] = r.points[o].tangentImpulse;
}
this.m_listener.PostSolve(n, s);
}
}
};
e.s_timer = new k();
e.s_solverData = new en();
e.s_contactSolverDef = new on();
e.s_contactSolver = new cn();
e.s_translation = new I();
e.s_impulse = new qi();
return e;
})();
(function(t) {
t[t.b2_waterParticle = 0] = "b2_waterParticle";
t[t.b2_zombieParticle = 2] = "b2_zombieParticle";
t[t.b2_wallParticle = 4] = "b2_wallParticle";
t[t.b2_springParticle = 8] = "b2_springParticle";
t[t.b2_elasticParticle = 16] = "b2_elasticParticle";
t[t.b2_viscousParticle = 32] = "b2_viscousParticle";
t[t.b2_powderParticle = 64] = "b2_powderParticle";
t[t.b2_tensileParticle = 128] = "b2_tensileParticle";
t[t.b2_colorMixingParticle = 256] = "b2_colorMixingParticle";
t[t.b2_destructionListenerParticle = 512] = "b2_destructionListenerParticle";
t[t.b2_barrierParticle = 1024] = "b2_barrierParticle";
t[t.b2_staticPressureParticle = 2048] = "b2_staticPressureParticle";
t[t.b2_reactiveParticle = 4096] = "b2_reactiveParticle";
t[t.b2_repulsiveParticle = 8192] = "b2_repulsiveParticle";
t[t.b2_fixtureContactListenerParticle = 16384] = "b2_fixtureContactListenerParticle";
t[t.b2_particleContactListenerParticle = 32768] = "b2_particleContactListenerParticle";
t[t.b2_fixtureContactFilterParticle = 65536] = "b2_fixtureContactFilterParticle";
t[t.b2_particleContactFilterParticle = 131072] = "b2_particleContactFilterParticle";
})(t.b2ParticleFlag || (t.b2ParticleFlag = {}));
var un = function() {
this.flags = 0;
this.position = new I();
this.velocity = new I();
this.color = new F(0, 0, 0, 0);
this.lifetime = 0;
this.userData = null;
this.group = null;
};
function hn(t, e, i) {
return g(Math.ceil(Math.sqrt(t / (.01 * e)) * i), 1, 8);
}
var _n = (function() {
function t() {
this.m_index = h;
}
t.prototype.GetIndex = function() {
return this.m_index;
};
t.prototype.SetIndex = function(t) {
this.m_index = t;
};
return t;
})();
(function(t) {
t[t.b2_solidParticleGroup = 1] = "b2_solidParticleGroup";
t[t.b2_rigidParticleGroup = 2] = "b2_rigidParticleGroup";
t[t.b2_particleGroupCanBeEmpty = 4] = "b2_particleGroupCanBeEmpty";
t[t.b2_particleGroupWillBeDestroyed = 8] = "b2_particleGroupWillBeDestroyed";
t[t.b2_particleGroupNeedsUpdateDepth = 16] = "b2_particleGroupNeedsUpdateDepth";
t[t.b2_particleGroupInternalMask = 24] = "b2_particleGroupInternalMask";
})(t.b2ParticleGroupFlag || (t.b2ParticleGroupFlag = {}));
var fn = function() {
this.flags = 0;
this.groupFlags = 0;
this.position = new I();
this.angle = 0;
this.linearVelocity = new I();
this.angularVelocity = 0;
this.color = new F();
this.strength = 1;
this.shapeCount = 0;
this.stride = 0;
this.particleCount = 0;
this.lifetime = 0;
this.userData = null;
this.group = null;
}, dn = (function() {
function e(t) {
this.m_firstIndex = 0;
this.m_lastIndex = 0;
this.m_groupFlags = 0;
this.m_strength = 1;
this.m_prev = null;
this.m_next = null;
this.m_timestamp = -1;
this.m_mass = 0;
this.m_inertia = 0;
this.m_center = new I();
this.m_linearVelocity = new I();
this.m_angularVelocity = 0;
this.m_transform = new V();
this.m_userData = null;
this.m_system = t;
}
e.prototype.GetNext = function() {
return this.m_next;
};
e.prototype.GetParticleSystem = function() {
return this.m_system;
};
e.prototype.GetParticleCount = function() {
return this.m_lastIndex - this.m_firstIndex;
};
e.prototype.GetBufferIndex = function() {
return this.m_firstIndex;
};
e.prototype.ContainsParticle = function(t) {
return this.m_firstIndex <= t && t < this.m_lastIndex;
};
e.prototype.GetAllParticleFlags = function() {
if (!this.m_system.m_flagsBuffer.data) throw new Error();
for (var t = 0, e = this.m_firstIndex; e < this.m_lastIndex; e++) t |= this.m_system.m_flagsBuffer.data[e];
return t;
};
e.prototype.GetGroupFlags = function() {
return this.m_groupFlags;
};
e.prototype.SetGroupFlags = function(e) {
e |= this.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupInternalMask;
this.m_system.SetGroupFlags(this, e);
};
e.prototype.GetMass = function() {
this.UpdateStatistics();
return this.m_mass;
};
e.prototype.GetInertia = function() {
this.UpdateStatistics();
return this.m_inertia;
};
e.prototype.GetCenter = function() {
this.UpdateStatistics();
return this.m_center;
};
e.prototype.GetLinearVelocity = function() {
this.UpdateStatistics();
return this.m_linearVelocity;
};
e.prototype.GetAngularVelocity = function() {
this.UpdateStatistics();
return this.m_angularVelocity;
};
e.prototype.GetTransform = function() {
return this.m_transform;
};
e.prototype.GetPosition = function() {
return this.m_transform.p;
};
e.prototype.GetAngle = function() {
return this.m_transform.q.GetAngle();
};
e.prototype.GetLinearVelocityFromWorldPoint = function(t, i) {
var n = e.GetLinearVelocityFromWorldPoint_s_t0;
this.UpdateStatistics();
return I.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, I.SubVV(t, this.m_center, n), i);
};
e.prototype.GetUserData = function() {
return this.m_userData;
};
e.prototype.SetUserData = function(t) {
this.m_userData = t;
};
e.prototype.ApplyForce = function(t) {
this.m_system.ApplyForce(this.m_firstIndex, this.m_lastIndex, t);
};
e.prototype.ApplyLinearImpulse = function(t) {
this.m_system.ApplyLinearImpulse(this.m_firstIndex, this.m_lastIndex, t);
};
e.prototype.DestroyParticles = function(t) {
if (this.m_system.m_world.IsLocked()) throw new Error();
for (var e = this.m_firstIndex; e < this.m_lastIndex; e++) this.m_system.DestroyParticle(e, t);
};
e.prototype.UpdateStatistics = function() {
if (!this.m_system.m_positionBuffer.data) throw new Error();
if (!this.m_system.m_velocityBuffer.data) throw new Error();
var t = new I(), e = new I();
if (this.m_timestamp !== this.m_system.m_timestamp) {
var i = this.m_system.GetParticleMass();
this.m_mass = i * (this.m_lastIndex - this.m_firstIndex);
this.m_center.SetZero();
this.m_linearVelocity.SetZero();
for (var n = this.m_firstIndex; n < this.m_lastIndex; n++) {
this.m_center.SelfMulAdd(i, this.m_system.m_positionBuffer.data[n]);
this.m_linearVelocity.SelfMulAdd(i, this.m_system.m_velocityBuffer.data[n]);
}
if (this.m_mass > 0) {
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; n < this.m_lastIndex; n++) {
I.SubVV(this.m_system.m_positionBuffer.data[n], this.m_center, t);
I.SubVV(this.m_system.m_velocityBuffer.data[n], this.m_linearVelocity, e);
this.m_inertia += i * I.DotVV(t, t);
this.m_angularVelocity += i * I.CrossVV(t, e);
}
this.m_inertia > 0 && (this.m_angularVelocity *= 1 / this.m_inertia);
this.m_timestamp = this.m_system.m_timestamp;
}
};
e.GetLinearVelocityFromWorldPoint_s_t0 = new I();
return e;
})(), pn = (function() {
function t(t) {
this.m_front = 0;
this.m_back = 0;
this.m_capacity = 0;
this.m_buffer = d(t, (function() {
return null;
}));
this.m_capacity = t;
}
t.prototype.Push = function(t) {
if (this.m_back >= this.m_capacity) {
for (var e = this.m_front; e < this.m_back; e++) this.m_buffer[e - this.m_front] = this.m_buffer[e];
this.m_back -= this.m_front;
this.m_front = 0;
if (this.m_back >= this.m_capacity) if (this.m_capacity > 0) {
this.m_buffer.concat(d(this.m_capacity, (function() {
return null;
})));
this.m_capacity *= 2;
} else {
this.m_buffer.concat(d(1, (function() {
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;
};
return t;
})(), mn = (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() {
return new t.Generator();
}));
this.m_generatorCapacity = e;
}
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 I(+i, +i), o = new I(-i, -i), a = 0, c = 0; c < this.m_generatorCount; c++) if ((f = this.m_generatorBuffer[c]).necessary) {
I.MinV(s, f.center, s);
I.MaxV(o, f.center, o);
++a;
}
if (0 !== a) {
s.x -= n;
s.y -= n;
o.x += n;
o.y += n;
this.m_countX = 1 + Math.floor(r * (o.x - s.x));
this.m_countY = 1 + Math.floor(r * (o.y - s.y));
this.m_diagram = [];
var l = new pn(4 * this.m_countX * this.m_countY);
for (c = 0; c < this.m_generatorCount; c++) {
(f = this.m_generatorBuffer[c]).center.SelfSub(s).SelfMul(r);
var u = Math.floor(f.center.x), h = Math.floor(f.center.y);
u >= 0 && h >= 0 && u < this.m_countX && h < this.m_countY && l.Push(new t.Task(u, h, u + h * this.m_countX, f));
}
for (;!l.Empty(); ) {
u = (d = l.Front()).m_x, h = d.m_y;
var _ = d.m_i, f = d.m_generator;
l.Pop();
if (!this.m_diagram[_]) {
this.m_diagram[_] = f;
u > 0 && l.Push(new t.Task(u - 1, h, _ - 1, f));
h > 0 && l.Push(new t.Task(u, h - 1, _ - this.m_countX, f));
u < this.m_countX - 1 && l.Push(new t.Task(u + 1, h, _ + 1, f));
h < this.m_countY - 1 && l.Push(new t.Task(u, h + 1, _ + this.m_countX, f));
}
}
for (h = 0; h < this.m_countY; h++) for (u = 0; u < this.m_countX - 1; u++) {
_ = u + h * this.m_countX;
if ((p = this.m_diagram[_]) !== (m = this.m_diagram[_ + 1])) {
l.Push(new t.Task(u, h, _, m));
l.Push(new t.Task(u + 1, h, _ + 1, p));
}
}
for (h = 0; h < this.m_countY - 1; h++) for (u = 0; u < this.m_countX; u++) {
_ = u + h * this.m_countX;
if ((p = this.m_diagram[_]) !== (m = this.m_diagram[_ + this.m_countX])) {
l.Push(new t.Task(u, h, _, m));
l.Push(new t.Task(u, h + 1, _ + this.m_countX, p));
}
}
for (;!l.Empty(); ) {
var d, p, m;
u = (d = l.Front()).m_x, h = d.m_y, _ = d.m_i, c = d.m_generator;
l.Pop();
if ((p = this.m_diagram[_]) !== (m = c)) {
var y = p.center.x - u, v = p.center.y - h, g = m.center.x - u, b = m.center.y - h;
if (y * y + v * v > g * g + b * b) {
this.m_diagram[_] = m;
u > 0 && l.Push(new t.Task(u - 1, h, _ - 1, m));
h > 0 && l.Push(new t.Task(u, h - 1, _ - this.m_countX, m));
u < this.m_countX - 1 && l.Push(new t.Task(u + 1, h, _ + 1, m));
h < this.m_countY - 1 && l.Push(new t.Task(u, h + 1, _ + this.m_countX, m));
}
}
}
} else {
this.m_countX = 0;
this.m_countY = 0;
}
};
t.prototype.GetNodes = function(t) {
for (var e = 0; e < this.m_countY - 1; e++) for (var i = 0; i < this.m_countX - 1; i++) {
var n = i + e * this.m_countX, r = this.m_diagram[n], s = this.m_diagram[n + 1], o = this.m_diagram[n + this.m_countX], a = this.m_diagram[n + 1 + this.m_countX];
if (s !== o) {
r !== s && r !== o && (r.necessary || s.necessary || o.necessary) && t(r.tag, s.tag, o.tag);
a !== s && a !== o && (r.necessary || s.necessary || o.necessary) && t(s.tag, a.tag, o.tag);
}
}
};
return t;
})();
(function(t) {
t.Generator = function() {
this.center = new I();
this.tag = 0;
this.necessary = !1;
};
t.Task = function(t, e, i, n) {
this.m_x = t;
this.m_y = e;
this.m_i = i;
this.m_generator = n;
};
})(mn || (mn = {}));
function yn(t, e, i) {
var n = t[e];
t[e] = t[i];
t[i] = n;
}
function vn(t, e) {
return t < e;
}
function gn(t, e, i, n) {
void 0 === e && (e = 0);
void 0 === i && (i = t.length - e);
void 0 === n && (n = vn);
for (var r = e, s = [], o = 0; ;) {
for (;r + 1 < i; i++) {
var a = t[r + Math.floor(Math.random() * (i - r))];
s[o++] = i;
for (var c = r - 1; ;) {
for (;n(t[++c], a); ) ;
for (;n(a, t[--i]); ) ;
if (c >= i) break;
yn(t, c, i);
}
}
if (0 === o) break;
r = i;
i = s[--o];
}
return t;
}
function bn(t, e, i, n) {
void 0 === e && (e = 0);
void 0 === i && (i = t.length - e);
void 0 === n && (n = vn);
return gn(t, e, i, n);
}
function Cn(t, e, i) {
void 0 === i && (i = t.length);
for (var n = 0, r = 0; r < i; ++r) e(t[r]) || (r !== n ? yn(t, n++, r) : ++n);
return n;
}
function xn(t, e, i, n, r) {
void 0 === r && (r = vn);
for (var s = i - e; s > 0; ) {
var o = Math.floor(s / 2), a = e + o;
if (r(t[a], n)) {
e = ++a;
s -= o + 1;
} else s = o;
}
return e;
}
function An(t, e, i, n, r) {
void 0 === r && (r = vn);
for (var s = i - e; s > 0; ) {
var o = Math.floor(s / 2), a = e + o;
if (r(n, t[a])) s = o; else {
e = ++a;
s -= o + 1;
}
}
return e;
}
function Sn(t, e, i, n) {
for (var r = i; e !== r; ) {
yn(t, e++, r++);
r === n ? r = i : e === i && (i = r);
}
}
function Tn(t, e, i, n) {
if (e === i) return i;
for (var r = e; ++e !== i; ) n(t[r], t[e]) || yn(t, ++r, e);
return ++r;
}
var wn = (function() {
function t(t) {
this.data = [];
this.count = 0;
this.capacity = 0;
this.allocator = t;
}
t.prototype.Append = function() {
this.count >= this.capacity && this.Grow();
return this.count++;
};
t.prototype.Reserve = function(t) {
if (!(this.capacity >= t)) {
for (var e = this.capacity; e < t; ++e) this.data[e] = this.allocator();
this.capacity = t;
}
};
t.prototype.Grow = function() {
var t = this.capacity ? 2 * this.capacity : 256;
this.Reserve(t);
};
t.prototype.Free = function() {
if (0 !== this.data.length) {
this.data = [];
this.capacity = 0;
this.count = 0;
}
};
t.prototype.Shorten = function() {};
t.prototype.Data = function() {
return this.data;
};
t.prototype.GetCount = function() {
return this.count;
};
t.prototype.SetCount = function(t) {
this.count = t;
};
t.prototype.GetCapacity = function() {
return this.capacity;
};
t.prototype.RemoveIf = function(t) {
this.count = Cn(this.data, t, this.count);
};
t.prototype.Unique = function(t) {
this.count = Tn(this.data, 0, this.count, t);
};
return t;
})(), En = (function(t) {
Xe(e, t);
function e(e) {
var i = t.call(this) || this;
i.m_system = e;
return i;
}
e.prototype.ShouldQueryParticleSystem = function() {
return !1;
};
e.prototype.ReportFixture = function(t) {
if (t.IsSensor()) return !0;
for (var e = t.GetShape().GetChildCount(), i = 0; i < e; i++) for (var n = t.GetAABB(i), r = this.m_system.GetInsideBoundsEnumerator(n), s = void 0; (s = r.GetNext()) >= 0; ) this.ReportFixtureAndParticle(t, i, s);
return !0;
};
e.prototype.ReportParticle = function() {
return !1;
};
e.prototype.ReportFixtureAndParticle = function() {};
return e;
})(Yi), Mn = (function() {
function t() {
this.indexA = 0;
this.indexB = 0;
this.weight = 0;
this.normal = new I();
this.flags = 0;
}
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 && m(this.weight - t.weight) < .01 && I.DistanceSquaredVV(this.normal, t.normal) < 1e-4;
};
return t;
})(), Bn = function() {
this.index = 0;
this.weight = 0;
this.normal = new I();
this.mass = 0;
}, In = function() {
this.indexA = 0;
this.indexB = 0;
this.flags = 0;
this.strength = 0;
this.distance = 0;
}, Dn = function() {
this.indexA = 0;
this.indexB = 0;
this.indexC = 0;
this.flags = 0;
this.strength = 0;
this.pa = new I(0, 0);
this.pb = new I(0, 0);
this.pc = new I(0, 0);
this.ka = 0;
this.kb = 0;
this.kc = 0;
this.s = 0;
}, Pn = (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;
}
t.prototype.Copy = function(t) {
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;
return this;
};
t.prototype.Clone = function() {
return new t().Copy(this);
};
return 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 wn(function() {
return 0;
});
this.m_proxyBuffer = new wn(function() {
return new n.Proxy();
});
this.m_contactBuffer = new wn(function() {
return new Mn();
});
this.m_bodyContactBuffer = new wn(function() {
return new Bn();
});
this.m_pairBuffer = new wn(function() {
return new In();
});
this.m_triadBuffer = new wn(function() {
return new Dn();
});
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 Pn();
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);
}
n.computeTag = function(t, e) {
return (e + n.yOffset >>> 0 << n.yShift) + (n.xScale * t + n.xOffset >>> 0) >>> 0;
};
n.computeRelativeTag = function(t, e, i) {
return t + (i << n.yShift) + (e << n.xShift) >>> 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 h;
this.DestroyOldestParticle(0, !1);
this.SolveZombie();
}
var n = this.m_count++;
if (!this.m_flagsBuffer.data) throw new Error();
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);
if (!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 I()).Copy(e(t.position, I.ZERO));
this.m_velocityBuffer.data[n] = (this.m_velocityBuffer.data[n] || new I()).Copy(e(t.velocity, I.ZERO));
this.m_weightBuffer[n] = 0;
this.m_forceBuffer[n] = (this.m_forceBuffer[n] || new I()).SetZero();
this.m_staticPressureBuffer && (this.m_staticPressureBuffer[n] = 0);
this.m_depthBuffer && (this.m_depthBuffer[n] = 0);
var r = new F().Copy(e(t.color, F.ZERO));
if (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 F()).Copy(r);
}
if (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()], o = e(t.lifetime, 0), a = o > 0;
if (this.m_expirationTimeBuffer.data || a) {
this.SetParticleLifetime(n, a ? o : this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed()));
if (!this.m_indexByExpirationTimeBuffer.data) throw new Error();
this.m_indexByExpirationTimeBuffer.data[n] = n;
}
s.index = n;
var c = e(t.group, null);
this.m_groupBuffer[n] = c;
if (c) if (c.m_firstIndex < c.m_lastIndex) {
this.RotateBuffer(c.m_firstIndex, c.m_lastIndex, n);
c.m_lastIndex = n + 1;
} else {
c.m_firstIndex = n;
c.m_lastIndex = n + 1;
}
this.SetParticleFlags(n, e(t.flags, 0));
return n;
};
n.prototype.GetParticleHandleFromIndex = function(t) {
this.m_handleIndexBuffer.data = this.RequestBuffer(this.m_handleIndexBuffer.data);
var e = this.m_handleIndexBuffer.data[t];
if (e) return e;
(e = new _n()).SetIndex(t);
this.m_handleIndexBuffer.data[t] = e;
return e;
};
n.prototype.DestroyParticle = function(e, i) {
void 0 === i && (i = !1);
if (!this.m_flagsBuffer.data) throw new Error();
var n = t.b2ParticleFlag.b2_zombieParticle;
i && (n |= t.b2ParticleFlag.b2_destructionListenerParticle);
this.SetParticleFlags(e, this.m_flagsBuffer.data[e] | n);
};
n.prototype.DestroyOldestParticle = function(t, e) {
void 0 === e && (e = !1);
var i = this.GetParticleCount();
if (!this.m_indexByExpirationTimeBuffer.data) throw new Error();
if (!this.m_expirationTimeBuffer.data) throw new Error();
var n = this.m_indexByExpirationTimeBuffer.data[i - (t + 1)], r = this.m_indexByExpirationTimeBuffer.data[t];
this.DestroyParticle(this.m_expirationTimeBuffer.data[n] > 0 ? 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), o = r;
t.ComputeAABB(o, e, 0);
this.m_world.QueryAABB(s, o);
return 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, I.ZERO), e(t.angle, 0));
var s = this.m_count;
t.shape && this.CreateParticlesWithShapeForGroup(t.shape, t, r);
t.shapes && this.CreateParticlesWithShapesForGroup(t.shapes, e(t.shapeCount, t.shapes.length), t, r);
if (t.positionData) for (var o = e(t.particleCount, t.positionData.length), a = 0; a < o; a++) {
var c = t.positionData[a];
this.CreateParticleForGroup(t, r, c);
}
var l = this.m_count, u = new dn(this);
u.m_firstIndex = s;
u.m_lastIndex = l;
u.m_strength = e(t.strength, 1);
u.m_userData = t.userData;
u.m_transform.Copy(r);
u.m_prev = null;
u.m_next = this.m_groupList;
this.m_groupList && (this.m_groupList.m_prev = u);
this.m_groupList = u;
++this.m_groupCount;
for (a = s; a < l; a++) this.m_groupBuffer[a] = u;
this.SetGroupFlags(u, e(t.groupFlags, 0));
var h = new n.ConnectionFilter();
this.UpdateContacts(!0);
this.UpdatePairsAndTriads(s, l, h);
if (t.group) {
this.JoinParticleGroups(t.group, u);
u = t.group;
}
return u;
};
n.prototype.JoinParticleGroups = function(t, e) {
if (this.m_world.IsLocked()) throw new Error();
this.RotateBuffer(e.m_firstIndex, e.m_lastIndex, this.m_count);
this.RotateBuffer(t.m_firstIndex, t.m_lastIndex, e.m_firstIndex);
var i = new n.JoinParticleGroupsFilter(e.m_firstIndex);
this.UpdateContacts(!0);
this.UpdatePairsAndTriads(t.m_firstIndex, e.m_lastIndex, i);
for (var r = e.m_firstIndex; r < e.m_lastIndex; r++) this.m_groupBuffer[r] = t;
var s = t.m_groupFlags | e.m_groupFlags;
this.SetGroupFlags(t, s);
t.m_lastIndex = e.m_lastIndex;
e.m_firstIndex = e.m_lastIndex;
this.DestroyParticleGroup(e);
};
n.prototype.SplitParticleGroup = function(t) {
this.UpdateContacts(!0);
var e = d(t.GetParticleCount(), (function() {
return new n.ParticleListNode();
}));
n.InitializeParticleLists(t, e);
this.MergeParticleListsInContact(t, e);
var i = n.FindLongestParticleList(t, e);
this.MergeZombieParticleListNodes(t, e, i);
this.CreateParticleGroupsFromParticleList(t, e, i);
this.UpdatePairsAndTriadsWithParticleList(t, e);
};
n.prototype.GetParticleGroupList = function() {
return this.m_groupList;
};
n.prototype.GetParticleGroupCount = function() {
return this.m_groupCount;
};
n.prototype.GetParticleCount = function() {
return this.m_count;
};
n.prototype.GetMaxParticleCount = function() {
return this.m_def.maxCount;
};
n.prototype.SetMaxParticleCount = function(t) {
this.m_def.maxCount = t;
};
n.prototype.GetAllParticleFlags = function() {
return this.m_allParticleFlags;
};
n.prototype.GetAllGroupFlags = function() {
return this.m_allGroupFlags;
};
n.prototype.SetPaused = function(t) {
this.m_paused = t;
};
n.prototype.GetPaused = function() {
return this.m_paused;
};
n.prototype.SetDensity = function(t) {
this.m_def.density = t;
this.m_inverseDensity = 1 / this.m_def.density;
};
n.prototype.GetDensity = function() {
return this.m_def.density;
};
n.prototype.SetGravityScale = function(t) {
this.m_def.gravityScale = t;
};
n.prototype.GetGravityScale = function() {
return this.m_def.gravityScale;
};
n.prototype.SetDamping = function(t) {
this.m_def.dampingStrength = t;
};
n.prototype.GetDamping = function() {
return this.m_def.dampingStrength;
};
n.prototype.SetStaticPressureIterations = function(t) {
this.m_def.staticPressureIterations = t;
};
n.prototype.GetStaticPressureIterations = function() {
return this.m_def.staticPressureIterations;
};
n.prototype.SetRadius = function(t) {
this.m_particleDiameter = 2 * t;
this.m_squaredDiameter = this.m_particleDiameter * this.m_particleDiameter;
this.m_inverseDiameter = 1 / this.m_particleDiameter;
};
n.prototype.GetRadius = function() {
return this.m_particleDiameter / 2;
};
n.prototype.GetPositionBuffer = function() {
if (!this.m_positionBuffer.data) throw new Error();
return this.m_positionBuffer.data;
};
n.prototype.GetVelocityBuffer = function() {
if (!this.m_velocityBuffer.data) throw new Error();
return this.m_velocityBuffer.data;
};
n.prototype.GetColorBuffer = function() {
this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data);
return this.m_colorBuffer.data;
};
n.prototype.GetGroupBuffer = function() {
return this.m_groupBuffer;
};
n.prototype.GetWeightBuffer = function() {
return this.m_weightBuffer;
};
n.prototype.GetUserDataBuffer = function() {
this.m_userDataBuffer.data = this.RequestBuffer(this.m_userDataBuffer.data);
return this.m_userDataBuffer.data;
};
n.prototype.GetFlagsBuffer = function() {
if (!this.m_flagsBuffer.data) throw new Error();
return this.m_flagsBuffer.data;
};
n.prototype.SetParticleFlags = function(e, i) {
if (!this.m_flagsBuffer.data) throw new Error();
this.m_flagsBuffer.data[e] & ~i && (this.m_needsUpdateAllParticleFlags = !0);
if (~this.m_allParticleFlags & i) {
i & t.b2ParticleFlag.b2_tensileParticle && (this.m_accumulation2Buffer = this.RequestBuffer(this.m_accumulation2Buffer));
i & t.b2ParticleFlag.b2_colorMixingParticle && (this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data));
this.m_allParticleFlags |= i;
}
this.m_flagsBuffer.data[e] = i;
};
n.prototype.GetParticleFlags = function(t) {
if (!this.m_flagsBuffer.data) throw new Error();
return this.m_flagsBuffer.data[t];
};
n.prototype.SetFlagsBuffer = function(t, e) {
this.SetUserOverridableBuffer(this.m_flagsBuffer, t, e);
};
n.prototype.SetPositionBuffer = function(t, e) {
this.SetUserOverridableBuffer(this.m_positionBuffer, t, e);
};
n.prototype.SetVelocityBuffer = function(t, e) {
this.SetUserOverridableBuffer(this.m_velocityBuffer, t, e);
};
n.prototype.SetColorBuffer = function(t, e) {
this.SetUserOverridableBuffer(this.m_colorBuffer, t, e);
};
n.prototype.SetUserDataBuffer = function(t, e) {
this.SetUserOverridableBuffer(this.m_userDataBuffer, t, e);
};
n.prototype.GetContacts = function() {
return this.m_contactBuffer.data;
};
n.prototype.GetContactCount = function() {
return this.m_contactBuffer.count;
};
n.prototype.GetBodyContacts = function() {
return this.m_bodyContactBuffer.data;
};
n.prototype.GetBodyContactCount = function() {
return this.m_bodyContactBuffer.count;
};
n.prototype.GetPairs = function() {
return this.m_pairBuffer.data;
};
n.prototype.GetPairCount = function() {
return this.m_pairBuffer.count;
};
n.prototype.GetTriads = function() {
return this.m_triadBuffer.data;
};
n.prototype.GetTriadCount = function() {
return this.m_triadBuffer.count;
};
n.prototype.SetStuckThreshold = function(t) {
this.m_stuckThreshold = t;
if (t > 0) {
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; r < this.m_contactBuffer.count; r++) {
var s = this.m_contactBuffer.data[r], o = s.indexA, a = s.indexB, c = s.normal, l = I.SubVV(e[a], e[o], t), u = I.DotVV(l, c);
u < 0 && (i += u * u);
}
return .5 * this.GetParticleMass() * i;
};
n.prototype.SetStrictContactCheck = function(t) {
this.m_def.strictContactCheck = t;
};
n.prototype.GetStrictContactCheck = function() {
return this.m_def.strictContactCheck;
};
n.prototype.SetParticleLifetime = function(t, e) {
var i = null === this.m_indexByExpirationTimeBuffer.data;
this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data);
this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data);
if (i) for (var n = this.GetParticleCount(), r = 0; r < n; ++r) this.m_indexByExpirationTimeBuffer.data[r] = r;
var s = e / this.m_def.lifetimeGranularity, o = s > 0 ? this.GetQuantizedTimeElapsed() + s : s;
if (o !== this.m_expirationTimeBuffer.data[t]) {
this.m_expirationTimeBuffer.data[t] = o;
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() {
this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data);
return this.m_expirationTimeBuffer.data;
};
n.prototype.ExpirationTimeToLifetime = function(t) {
return (t > 0 ? t - this.GetQuantizedTimeElapsed() : t) * this.m_def.lifetimeGranularity;
};
n.prototype.GetIndexByExpirationTimeBuffer = function() {
this.GetParticleCount() ? this.SetParticleLifetime(0, this.GetParticleLifetime(0)) : this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data);
if (!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 I().Copy(i).SelfMul(1 / r), o = t; o < e; o++) n[o].SelfAdd(s);
};
n.IsSignificantForce = function(t) {
return 0 !== t.x || 0 !== t.y;
};
n.prototype.ParticleApplyForce = function(t, e) {
if (!this.m_flagsBuffer.data) throw new Error();
if (n.IsSignificantForce(e) && this.ForceCanBeApplied(this.m_flagsBuffer.data[t])) {
this.PrepareForceBuffer();
this.m_forceBuffer[t].SelfAdd(e);
}
};
n.prototype.ApplyForce = function(t, e, i) {
var r = new I().Copy(i).SelfMul(1 / (e - t));
if (n.IsSignificantForce(r)) {
this.PrepareForceBuffer();
for (var s = t; s < e; s++) this.m_forceBuffer[s].SelfAdd(r);
}
};
n.prototype.GetNext = function() {
return this.m_next;
};
n.prototype.QueryAABB = function(t, e) {
if (0 !== this.m_proxyBuffer.count) {
var i = this.m_proxyBuffer.count, r = xn(this.m_proxyBuffer.data, 0, i, n.computeTag(this.m_inverseDiameter * e.lowerBound.x, this.m_inverseDiameter * e.lowerBound.y), n.Proxy.CompareProxyTag), s = An(this.m_proxyBuffer.data, r, i, n.computeTag(this.m_inverseDiameter * e.upperBound.x, this.m_inverseDiameter * e.upperBound.y), n.Proxy.CompareTagProxy);
if (!this.m_positionBuffer.data) throw new Error();
for (var o = this.m_positionBuffer.data, a = r; a < s; ++a) {
var c = this.m_proxyBuffer.data[a].index, l = o[c];
if (e.lowerBound.x < l.x && l.x < e.upperBound.x && e.lowerBound.y < l.y && l.y < e.upperBound.y && !t.ReportParticle(this, c)) break;
}
}
};
n.prototype.QueryShapeAABB = function(t, e, i, r) {
void 0 === r && (r = 0);
var s = n.QueryShapeAABB_s_aabb;
e.ComputeAABB(s, i, r);
this.QueryAABB(t, s);
};
n.prototype.QueryPointAABB = function(t, e, i) {
void 0 === i && (i = c);
var r = n.QueryPointAABB_s_aabb;
r.lowerBound.Set(e.x - i, e.y - i);
r.upperBound.Set(e.x + i, e.y + i);
this.QueryAABB(t, r);
};
n.prototype.RayCast = function(t, e, i) {
var r = n.RayCast_s_aabb, s = n.RayCast_s_p, o = n.RayCast_s_v, a = n.RayCast_s_n, c = n.RayCast_s_point;
if (0 !== this.m_proxyBuffer.count) {
if (!this.m_positionBuffer.data) throw new Error();
var l = this.m_positionBuffer.data, u = r;
I.MinV(e, i, u.lowerBound);
I.MaxV(e, i, u.upperBound);
for (var h, _ = 1, f = I.SubVV(i, e, o), d = I.DotVV(f, f), p = this.GetInsideBoundsEnumerator(u); (h = p.GetNext()) >= 0; ) {
var m = I.SubVV(e, l[h], s), v = I.DotVV(m, f), g = v * v - d * (I.DotVV(m, m) - this.m_squaredDiameter);
if (g >= 0) {
var b = A(g), C = (-v - b) / d;
if (C > _) continue;
if (C < 0 && ((C = (-v + b) / d) < 0 || C > _)) continue;
var x = I.AddVMulSV(m, C, f, a);
x.Normalize();
var S = t.ReportParticle(this, h, I.AddVMulSV(e, C, f, c), x, C);
if ((_ = y(_, S)) <= 0) break;
}
}
}
};
n.prototype.ComputeAABB = function(t) {
var e = this.GetParticleCount();
t.lowerBound.x = +i;
t.lowerBound.y = +i;
t.upperBound.x = -i;
t.upperBound.y = -i;
if (!this.m_positionBuffer.data) throw new Error();
for (var n = this.m_positionBuffer.data, r = 0; r < e; r++) {
var s = n[r];
I.MinV(t.lowerBound, s, t.lowerBound);
I.MaxV(t.upperBound, s, t.upperBound);
}
t.lowerBound.x -= this.m_particleDiameter;
t.lowerBound.y -= this.m_particleDiameter;
t.upperBound.x += this.m_particleDiameter;
t.upperBound.y += this.m_particleDiameter;
};
n.prototype.FreeBuffer = function(t) {
null !== t && (t.length = 0);
};
n.prototype.FreeUserOverridableBuffer = function(t) {
0 === t.userSuppliedCapacity && this.FreeBuffer(t.data, this.m_internalAllocatedCapacity);
};
n.prototype.ReallocateBuffer3 = function(t, e, i) {
if (i <= e) throw new Error();
var n = t ? t.slice() : [];
n.length = i;
return n;
};
n.prototype.ReallocateBuffer5 = function(t, e, i, n, r) {
if (n <= i) throw new Error();
if (e && !(n <= e)) throw new Error();
r && !t || e || (t = this.ReallocateBuffer3(t, i, n));
return t;
};
n.prototype.ReallocateBuffer4 = function(t, e, i, n) {
return this.ReallocateBuffer5(t.data, t.userSuppliedCapacity, e, i, n);
};
n.prototype.RequestBuffer = function(t) {
if (!t) {
0 === this.m_internalAllocatedCapacity && this.ReallocateInternalAllocatedBuffers(256);
(t = []).length = this.m_internalAllocatedCapacity;
}
return t;
};
n.prototype.ReallocateHandleBuffers = function(t) {
this.m_handleIndexBuffer.data = this.ReallocateBuffer4(this.m_handleIndexBuffer, this.m_internalAllocatedCapacity, t, !0);
};
n.prototype.ReallocateInternalAllocatedBuffers = function(t) {
function e(t, e) {
return e && t > e ? e : t;
}
t = e(t, this.m_def.maxCount);
t = e(t, this.m_flagsBuffer.userSuppliedCapacity);
t = e(t, this.m_positionBuffer.userSuppliedCapacity);
t = e(t, this.m_velocityBuffer.userSuppliedCapacity);
t = e(t, this.m_colorBuffer.userSuppliedCapacity);
t = e(t, this.m_userDataBuffer.userSuppliedCapacity);
if (this.m_internalAllocatedCapacity < t) {
this.ReallocateHandleBuffers(t);
this.m_flagsBuffer.data = this.ReallocateBuffer4(this.m_flagsBuffer, this.m_internalAllocatedCapacity, t, !1);
var i = this.m_stuckThreshold > 0;
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 un();
r.flags = e(t.flags, 0);
V.MulXV(i, n, r.position);
I.AddVV(e(t.linearVelocity, I.ZERO), I.CrossSV(e(t.angularVelocity, 0), I.SubVV(r.position, e(t.position, I.ZERO), I.s_t0), I.s_t0), r.velocity);
r.color.Copy(e(t.color, F.ZERO));
r.lifetime = e(t.lifetime, 0);
r.userData = t.userData;
this.CreateParticle(r);
};
n.prototype.CreateParticlesStrokeShapeForGroup = function(i, r, s) {
var o = n.CreateParticlesStrokeShapeForGroup_s_edge, a = n.CreateParticlesStrokeShapeForGroup_s_d, c = n.CreateParticlesStrokeShapeForGroup_s_p, l = e(r.stride, 0);
0 === l && (l = this.GetParticleStride());
for (var u = 0, h = i.GetChildCount(), _ = 0; _ < h; _++) {
var f = null;
if (i.GetType() === t.b2ShapeType.e_edgeShape) f = i; else {
f = o;
i.GetChildEdge(f, _);
}
for (var d = I.SubVV(f.m_vertex2, f.m_vertex1, a), p = d.Length(); u < p; ) {
var m = I.AddVMulSV(f.m_vertex1, u / p, d, c);
this.CreateParticleForGroup(r, s, m);
u += l;
}
u -= p;
}
};
n.prototype.CreateParticlesFillShapeForGroup = function(t, i, r) {
var s = n.CreateParticlesFillShapeForGroup_s_aabb, o = n.CreateParticlesFillShapeForGroup_s_p, a = e(i.stride, 0);
0 === a && (a = this.GetParticleStride());
var c = V.IDENTITY, l = s;
t.ComputeAABB(l, c, 0);
for (var u = Math.floor(l.lowerBound.y / a) * a; u < l.upperBound.y; u += a) for (var h = Math.floor(l.lowerBound.x / a) * a; h < l.upperBound.x; h += a) {
var _ = o.Set(h, u);
t.TestPoint(c, _) && this.CreateParticleForGroup(i, r, _);
}
};
n.prototype.CreateParticlesWithShapeForGroup = function(e, i, n) {
switch (e.GetType()) {
case t.b2ShapeType.e_edgeShape:
case t.b2ShapeType.e_chainShape:
this.CreateParticlesStrokeShapeForGroup(e, i, n);
break;

case t.b2ShapeType.e_polygonShape:
case t.b2ShapeType.e_circleShape:
this.CreateParticlesFillShapeForGroup(e, i, n);
}
};
n.prototype.CreateParticlesWithShapesForGroup = function(t, e, i, r) {
var s = new n.CompositeShape(t, e);
this.CreateParticlesFillShapeForGroup(s, i, r);
};
n.prototype.CloneParticle = function(t, e) {
var i = new un();
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
i.flags = this.m_flagsBuffer.data[t];
i.position.Copy(this.m_positionBuffer.data[t]);
i.velocity.Copy(this.m_velocityBuffer.data[t]);
this.m_colorBuffer.data && i.color.Copy(this.m_colorBuffer.data[t]);
this.m_userDataBuffer.data && (i.userData = this.m_userDataBuffer.data[t]);
i.group = e;
var n = this.CreateParticle(i);
if (this.m_handleIndexBuffer.data) {
var r = this.m_handleIndexBuffer.data[t];
r && r.SetIndex(n);
this.m_handleIndexBuffer.data[n] = r;
this.m_handleIndexBuffer.data[t] = null;
}
this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[n] = this.m_lastBodyContactStepBuffer.data[t]);
this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[n] = this.m_bodyContactCountBuffer.data[t]);
this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[n] = this.m_consecutiveContactStepsBuffer.data[t]);
this.m_hasForce && this.m_forceBuffer[n].Copy(this.m_forceBuffer[t]);
this.m_staticPressureBuffer && (this.m_staticPressureBuffer[n] = this.m_staticPressureBuffer[t]);
this.m_depthBuffer && (this.m_depthBuffer[n] = this.m_depthBuffer[t]);
this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[n] = this.m_expirationTimeBuffer.data[t]);
return n;
};
n.prototype.DestroyParticlesInGroup = function(t, e) {
void 0 === e && (e = !1);
for (var i = t.m_firstIndex; i < t.m_lastIndex; i++) this.DestroyParticle(i, e);
};
n.prototype.DestroyParticleGroup = function(t) {
this.m_world.m_destructionListener && this.m_world.m_destructionListener.SayGoodbyeParticleGroup(t);
this.SetGroupFlags(t, 0);
for (var e = t.m_firstIndex; e < t.m_lastIndex; e++) this.m_groupBuffer[e] = null;
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_groupList && (this.m_groupList = t.m_next);
--this.m_groupCount;
};
n.ParticleCanBeConnected = function(e, i) {
return 0 != (e & (t.b2ParticleFlag.b2_wallParticle | t.b2ParticleFlag.b2_springParticle | t.b2ParticleFlag.b2_elasticParticle)) || null !== i && 0 != (i.GetGroupFlags() & t.b2ParticleGroupFlag.b2_rigidParticleGroup);
};
n.prototype.UpdatePairsAndTriads = function(e, i, r) {
var s = n.UpdatePairsAndTriads_s_dab, o = n.UpdatePairsAndTriads_s_dbc, a = n.UpdatePairsAndTriads_s_dca;
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var c = this.m_positionBuffer.data, l = 0, u = e; u < i; u++) l |= this.m_flagsBuffer.data[u];
if (l & n.k_pairFlags) for (var h = 0; h < this.m_contactBuffer.count; h++) {
var _ = this.m_contactBuffer.data[h], f = _.indexA, d = _.indexB, p = this.m_flagsBuffer.data[f], m = this.m_flagsBuffer.data[d], v = this.m_groupBuffer[f], g = this.m_groupBuffer[d];
if (f >= e && f < i && d >= e && d < i && !((p | m) & t.b2ParticleFlag.b2_zombieParticle) && (p | m) & n.k_pairFlags && (r.IsNecessary(f) || r.IsNecessary(d)) && n.ParticleCanBeConnected(p, v) && n.ParticleCanBeConnected(m, g) && r.ShouldCreatePair(f, d)) {
var b = this.m_pairBuffer.data[this.m_pairBuffer.Append()];
b.indexA = f;
b.indexB = d;
b.flags = _.flags;
b.strength = y(v ? v.m_strength : 1, g ? g.m_strength : 1);
b.distance = I.DistanceVV(c[f], c[d]);
}
bn(this.m_pairBuffer.data, 0, this.m_pairBuffer.count, n.ComparePairIndices);
this.m_pairBuffer.Unique(n.MatchPairIndices);
}
if (l & n.k_triadFlags) {
var C = new mn(i - e);
for (u = e; u < i; u++) {
var x = this.m_flagsBuffer.data[u], A = this.m_groupBuffer[u];
x & t.b2ParticleFlag.b2_zombieParticle || !n.ParticleCanBeConnected(x, A) || C.AddGenerator(c[u], u, r.IsNecessary(u));
}
var S = this.GetParticleStride();
C.Generate(S / 2, 2 * S);
var T = this;
C.GetNodes((function(t, e, i) {
if (!T.m_flagsBuffer.data) throw new Error();
var l = T.m_flagsBuffer.data[t], u = T.m_flagsBuffer.data[e], h = T.m_flagsBuffer.data[i];
if ((l | u | h) & n.k_triadFlags && r.ShouldCreateTriad(t, e, i)) {
var _ = c[t], f = c[e], d = c[i], p = I.SubVV(_, f, s), m = I.SubVV(f, d, o), v = I.SubVV(d, _, a), g = 4 * T.m_squaredDiameter;
if (I.DotVV(p, p) > g || I.DotVV(m, m) > g || I.DotVV(v, v) > g) return;
var b = T.m_groupBuffer[t], C = T.m_groupBuffer[e], x = T.m_groupBuffer[i], A = T.m_triadBuffer.data[T.m_triadBuffer.Append()];
A.indexA = t;
A.indexB = e;
A.indexC = i;
A.flags = l | u | h;
A.strength = y(y(b ? b.m_strength : 1, C ? C.m_strength : 1), x ? x.m_strength : 1);
var S = (_.x + f.x + d.x) / 3, w = (_.y + f.y + d.y) / 3;
A.pa.x = _.x - S;
A.pa.y = _.y - w;
A.pb.x = f.x - S;
A.pb.y = f.y - w;
A.pc.x = d.x - S;
A.pc.y = d.y - w;
A.ka = -I.DotVV(v, p);
A.kb = -I.DotVV(p, m);
A.kc = -I.DotVV(m, v);
A.s = I.CrossVV(_, f) + I.CrossVV(f, d) + I.CrossVV(d, _);
}
}));
bn(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);
this.UpdatePairsAndTriads(0, this.m_count, e);
if (!this.m_flagsBuffer.data) throw new Error();
for (var i = 0; i < this.m_count; i++) this.m_flagsBuffer.data[i] &= ~t.b2ParticleFlag.b2_reactiveParticle;
this.m_allParticleFlags &= ~t.b2ParticleFlag.b2_reactiveParticle;
};
n.ComparePairIndices = function(t, e) {
var i = t.indexA - e.indexA;
return 0 !== i ? i < 0 : t.indexB < e.indexB;
};
n.MatchPairIndices = function(t, e) {
return t.indexA === e.indexA && t.indexB === e.indexB;
};
n.CompareTriadIndices = function(t, e) {
var i = t.indexA - e.indexA;
if (0 !== i) return i < 0;
var n = t.indexB - e.indexB;
return 0 !== n ? n < 0 : t.indexC < e.indexC;
};
n.MatchTriadIndices = function(t, e) {
return t.indexA === e.indexA && t.indexB === e.indexB && t.indexC === e.indexC;
};
n.InitializeParticleLists = function(t, e) {
for (var i = t.GetBufferIndex(), n = t.GetParticleCount(), r = 0; r < n; r++) {
var s = e[r];
s.list = s;
s.next = null;
s.count = 1;
s.index = r + i;
}
};
n.prototype.MergeParticleListsInContact = function(t, e) {
for (var i = t.GetBufferIndex(), r = 0; r < this.m_contactBuffer.count; r++) {
var s = this.m_contactBuffer.data[r], o = s.indexA, a = s.indexB;
if (t.ContainsParticle(o) && t.ContainsParticle(a)) {
var c = e[o - i].list, l = e[a - i].list;
if (c !== l) {
if (c.count < l.count) {
var u = c;
c = l;
l = u;
}
n.MergeParticleLists(c, l);
}
}
}
};
n.MergeParticleLists = function(t, e) {
for (var i = e; ;) {
i.list = t;
var n = i.next;
if (!n) {
i.next = t.next;
break;
}
i = n;
}
t.next = e;
t.count += e.count;
e.count = 0;
};
n.FindLongestParticleList = function(t, e) {
for (var i = t.GetParticleCount(), n = e[0], r = 0; r < i; r++) {
var s = e[r];
n.count < s.count && (n = s);
}
return n;
};
n.prototype.MergeZombieParticleListNodes = function(e, i, r) {
if (!this.m_flagsBuffer.data) throw new Error();
for (var s = e.GetParticleCount(), o = 0; o < s; o++) {
var a = i[o];
a !== r && this.m_flagsBuffer.data[a.index] & t.b2ParticleFlag.b2_zombieParticle && n.MergeParticleListAndNode(r, a);
}
};
n.MergeParticleListAndNode = function(t, e) {
e.list = t;
e.next = t.next;
t.next = e;
t.count++;
e.count = 0;
};
n.prototype.CreateParticleGroupsFromParticleList = function(e, i, n) {
if (!this.m_flagsBuffer.data) throw new Error();
var r = e.GetParticleCount(), s = new fn();
s.groupFlags = e.GetGroupFlags();
s.userData = e.GetUserData();
for (var o = 0; o < r; o++) {
var a = i[o];
if (a.count && a !== n) for (var c = this.CreateParticleGroup(s), l = a; l; l = l.next) {
var u = l.index, h = this.CloneParticle(u, c);
this.m_flagsBuffer.data[u] |= t.b2ParticleFlag.b2_zombieParticle;
l.index = h;
}
}
};
n.prototype.UpdatePairsAndTriadsWithParticleList = function(t, e) {
for (var i = t.GetBufferIndex(), n = 0; n < this.m_pairBuffer.count; n++) {
var r = this.m_pairBuffer.data[n], s = r.indexA, o = r.indexB;
t.ContainsParticle(s) && (r.indexA = e[s - i].index);
t.ContainsParticle(o) && (r.indexB = e[o - i].index);
}
for (n = 0; n < this.m_triadBuffer.count; n++) {
var a = this.m_triadBuffer.data[n], c = (s = a.indexA, o = a.indexB, a.indexC);
t.ContainsParticle(s) && (a.indexA = e[s - i].index);
t.ContainsParticle(o) && (a.indexB = e[o - i].index);
t.ContainsParticle(c) && (a.indexC = e[c - i].index);
}
};
n.prototype.ComputeDepth = function() {
for (var e = [], n = 0, r = 0; r < this.m_contactBuffer.count; r++) {
var s = (v = this.m_contactBuffer.data[r]).indexA, o = v.indexB, a = this.m_groupBuffer[s], c = this.m_groupBuffer[o];
a && a === c && a.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && (e[n++] = v);
}
for (var l = [], u = 0, h = this.m_groupList; h; h = h.GetNext()) if (h.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth) {
l[u++] = h;
this.SetGroupFlags(h, h.m_groupFlags & ~t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);
for (var _ = h.m_firstIndex; _ < h.m_lastIndex; _++) this.m_accumulationBuffer[_] = 0;
}
for (r = 0; r < n; r++) {
s = (v = e[r]).indexA, o = v.indexB;
var f = v.weight;
this.m_accumulationBuffer[s] += f;
this.m_accumulationBuffer[o] += f;
}
for (_ = 0; _ < u; _++) for (var d = (h = l[_]).m_firstIndex; d < h.m_lastIndex; d++) {
f = this.m_accumulationBuffer[d];
this.m_depthBuffer[d] = f < .8 ? 0 : i;
}
for (var p = A(this.m_count) >> 0, m = 0; m < p; m++) {
var y = !1;
for (r = 0; r < n; r++) {
s = (v = e[r]).indexA, o = v.indexB;
var v, g = 1 - v.weight, b = this.m_depthBuffer[s], C = this.m_depthBuffer[o], x = C + g, S = b + g;
if (b > x) {
this.m_depthBuffer[s] = x;
y = !0;
}
if (C > S) {
this.m_depthBuffer[o] = S;
y = !0;
}
}
if (!y) break;
}
for (_ = 0; _ < u; _++) for (var T = (h = l[_]).m_firstIndex; T < h.m_lastIndex; T++) this.m_depthBuffer[T] < i ? this.m_depthBuffer[T] *= this.m_particleDiameter : this.m_depthBuffer[T] = 0;
};
n.prototype.GetInsideBoundsEnumerator = function(t) {
var e = n.computeTag(this.m_inverseDiameter * t.lowerBound.x - 1, this.m_inverseDiameter * t.lowerBound.y - 1), i = n.computeTag(this.m_inverseDiameter * t.upperBound.x + 1, this.m_inverseDiameter * t.upperBound.y + 1), r = this.m_proxyBuffer.count, s = xn(this.m_proxyBuffer.data, 0, r, e, n.Proxy.CompareProxyTag), o = An(this.m_proxyBuffer.data, 0, r, i, n.Proxy.CompareTagProxy);
return new n.InsideBoundsEnumerator(this, e, i, s, o);
};
n.prototype.UpdateAllParticleFlags = function() {
if (!this.m_flagsBuffer.data) throw new Error();
this.m_allParticleFlags = 0;
for (var t = 0; t < this.m_count; t++) this.m_allParticleFlags |= this.m_flagsBuffer.data[t];
this.m_needsUpdateAllParticleFlags = !1;
};
n.prototype.UpdateAllGroupFlags = function() {
this.m_allGroupFlags = 0;
for (var t = this.m_groupList; t; t = t.GetNext()) this.m_allGroupFlags |= t.m_groupFlags;
this.m_needsUpdateAllGroupFlags = !1;
};
n.prototype.AddContact = function(t, e) {
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
var i = n.AddContact_s_d, r = this.m_positionBuffer.data, s = I.SubVV(r[e], r[t], i), o = I.DotVV(s, s);
if (o < this.m_squaredDiameter) {
var a = x(o);
isFinite(a) || (a = 198177537e11);
var c = this.m_contactBuffer.data[this.m_contactBuffer.Append()];
c.indexA = t;
c.indexB = e;
c.flags = this.m_flagsBuffer.data[t] | this.m_flagsBuffer.data[e];
c.weight = 1 - o * a * this.m_inverseDiameter;
I.MulSV(a, s, c.normal);
}
};
n.prototype.FindContacts_Reference = function() {
var t = this.m_proxyBuffer.count;
this.m_contactBuffer.count = 0;
for (var e = 0, i = 0; e < t; e++) {
for (var r = n.computeRelativeTag(this.m_proxyBuffer.data[e].tag, 1, 0), s = e + 1; s < t && !(r < this.m_proxyBuffer.data[s].tag); s++) this.AddContact(this.m_proxyBuffer.data[e].index, this.m_proxyBuffer.data[s].index, this.m_contactBuffer);
for (var o = n.computeRelativeTag(this.m_proxyBuffer.data[e].tag, -1, 1); i < t && !(o <= this.m_proxyBuffer.data[i].tag); i++) ;
var a = n.computeRelativeTag(this.m_proxyBuffer.data[e].tag, 1, 1);
for (s = i; s < t && !(a < this.m_proxyBuffer.data[s].tag); s++) this.AddContact(this.m_proxyBuffer.data[e].index, this.m_proxyBuffer.data[s].index, this.m_contactBuffer);
}
};
n.prototype.FindContacts = function(t) {
this.FindContacts_Reference(t);
};
n.prototype.UpdateProxies_Reference = function() {
if (!this.m_positionBuffer.data) throw new Error();
for (var t = this.m_positionBuffer.data, e = this.m_inverseDiameter, i = 0; i < this.m_proxyBuffer.count; ++i) {
var r = this.m_proxyBuffer.data[i], s = t[r.index];
r.tag = n.computeTag(e * s.x, e * s.y);
}
};
n.prototype.UpdateProxies = function(t) {
this.UpdateProxies_Reference(t);
};
n.prototype.SortProxies = function() {
gn(this.m_proxyBuffer.data, 0, this.m_proxyBuffer.count, n.Proxy.CompareProxyProxy);
};
n.prototype.FilterContacts = function() {
var e = this.GetParticleContactFilter();
if (null !== e) {
var i = this;
this.m_contactBuffer.RemoveIf((function(n) {
return 0 != (n.flags & t.b2ParticleFlag.b2_particleContactFilterParticle) && !e.ShouldCollideParticleParticle(i, n.indexA, n.indexB);
}));
}
};
n.prototype.NotifyContactListenerPreContact = function(t) {
if (null !== this.GetParticleContactListener()) {
t.Initialize(this.m_contactBuffer, this.m_flagsBuffer);
throw new Error();
}
};
n.prototype.NotifyContactListenerPostContact = function() {
var t = this.GetParticleContactListener();
if (null !== t) {
for (var e = 0; e < this.m_contactBuffer.count; ++e) {
var i = this.m_contactBuffer.data[e];
t.BeginContactParticleParticle(this, i);
}
throw new Error();
}
};
n.b2ParticleContactIsZombie = function(e) {
return (e.flags & t.b2ParticleFlag.b2_zombieParticle) === t.b2ParticleFlag.b2_zombieParticle;
};
n.prototype.UpdateContacts = function(t) {
this.UpdateProxies(this.m_proxyBuffer);
this.SortProxies(this.m_proxyBuffer);
var e = new n.b2ParticlePairSet();
this.NotifyContactListenerPreContact(e);
this.FindContacts(this.m_contactBuffer);
this.FilterContacts(this.m_contactBuffer);
this.NotifyContactListenerPostContact(e);
t && this.m_contactBuffer.RemoveIf(n.b2ParticleContactIsZombie);
};
n.prototype.NotifyBodyContactListenerPreContact = function(t) {
if (null !== this.GetFixtureContactListener()) {
t.Initialize(this.m_bodyContactBuffer, this.m_flagsBuffer);
throw new Error();
}
};
n.prototype.NotifyBodyContactListenerPostContact = function() {
var t = this.GetFixtureContactListener();
if (null !== t) {
for (var e = 0; e < this.m_bodyContactBuffer.count; e++) {
var i = this.m_bodyContactBuffer.data[e];
t.BeginContactFixtureParticle(this, i);
}
throw new Error();
}
};
n.prototype.UpdateBodyContacts = function() {
var t = n.UpdateBodyContacts_s_aabb, e = new n.FixtureParticleSet();
this.NotifyBodyContactListenerPreContact(e);
if (this.m_stuckThreshold > 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; r < i; r++) {
this.m_bodyContactCountBuffer.data[r] = 0;
this.m_timestamp > this.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 o = new n.UpdateBodyContactsCallback(this, this.GetFixtureContactFilter());
this.m_world.QueryAABB(o, 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();
if (!this.m_paused) for (this.m_iterationIndex = 0; this.m_iterationIndex < e.particleIterations; this.m_iterationIndex++) {
++this.m_timestamp;
var r = i.Copy(e);
r.dt /= e.particleIterations;
r.inv_dt *= e.particleIterations;
this.UpdateContacts(!1);
this.UpdateBodyContacts();
this.ComputeWeight();
this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && this.ComputeDepth();
this.m_allParticleFlags & t.b2ParticleFlag.b2_reactiveParticle && this.UpdatePairsAndTriadsWithReactiveParticles();
this.m_hasForce && this.SolveForce(r);
this.m_allParticleFlags & t.b2ParticleFlag.b2_viscousParticle && this.SolveViscous();
this.m_allParticleFlags & t.b2ParticleFlag.b2_repulsiveParticle && this.SolveRepulsive(r);
this.m_allParticleFlags & t.b2ParticleFlag.b2_powderParticle && this.SolvePowder(r);
this.m_allParticleFlags & t.b2ParticleFlag.b2_tensileParticle && this.SolveTensile(r);
this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SolveSolid(r);
this.m_allParticleFlags & t.b2ParticleFlag.b2_colorMixingParticle && this.SolveColorMixing();
this.SolveGravity(r);
this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle && this.SolveStaticPressure(r);
this.SolvePressure(r);
this.SolveDamping(r);
this.m_allParticleFlags & n.k_extraDampingFlags && this.SolveExtraDamping();
this.m_allParticleFlags & t.b2ParticleFlag.b2_elasticParticle && this.SolveElastic(r);
this.m_allParticleFlags & t.b2ParticleFlag.b2_springParticle && this.SolveSpring(r);
this.LimitVelocity(r);
this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigidDamping();
this.m_allParticleFlags & t.b2ParticleFlag.b2_barrierParticle && this.SolveBarrier(r);
this.SolveCollision(r);
this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigid(r);
this.m_allParticleFlags & t.b2ParticleFlag.b2_wallParticle && this.SolveWall();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var s = 0; s < this.m_count; s++) this.m_positionBuffer.data[s].SelfMulAdd(r.dt, this.m_velocityBuffer.data[s]);
}
}
};
n.prototype.SolveCollision = function(t) {
var e = n.SolveCollision_s_aabb;
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = e;
o.lowerBound.x = +i;
o.lowerBound.y = +i;
o.upperBound.x = -i;
o.upperBound.y = -i;
for (var a = 0; a < this.m_count; a++) {
var c = s[a], l = r[a], u = l.x + t.dt * c.x, h = l.y + t.dt * c.y;
o.lowerBound.x = y(o.lowerBound.x, y(l.x, u));
o.lowerBound.y = y(o.lowerBound.y, y(l.y, h));
o.upperBound.x = v(o.upperBound.x, v(l.x, u));
o.upperBound.y = v(o.upperBound.y, v(l.y, h));
}
var _ = new n.SolveCollisionCallback(this, t);
this.m_world.QueryAABB(_, o);
};
n.prototype.LimitVelocity = function(t) {
if (!this.m_velocityBuffer.data) throw new Error();
for (var e = this.m_velocityBuffer.data, i = this.GetCriticalVelocitySquared(t), n = 0; n < this.m_count; n++) {
var r = e[n], s = I.DotVV(r, r);
s > i && r.SelfMul(A(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 = I.MulSV(t.dt * this.m_def.gravityScale, this.m_world.GetGravity(), e), s = 0; s < this.m_count; s++) i[s].SelfAdd(r);
};
n.prototype.SolveBarrier = function(e) {
var i = n.SolveBarrier_s_aabb, r = n.SolveBarrier_s_va, s = n.SolveBarrier_s_vb, o = n.SolveBarrier_s_pba, a = n.SolveBarrier_s_vba, c = n.SolveBarrier_s_vc, l = n.SolveBarrier_s_pca, u = n.SolveBarrier_s_vca, h = n.SolveBarrier_s_qba, _ = n.SolveBarrier_s_qca, f = n.SolveBarrier_s_dv, d = n.SolveBarrier_s_f;
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var p = this.m_positionBuffer.data, m = this.m_velocityBuffer.data, y = 0; y < this.m_count; y++) 0 != (this.m_flagsBuffer.data[y] & n.k_barrierWallFlags) && m[y].SetZero();
for (var v = 2.5 * e.dt, g = this.GetParticleMass(), b = 0; b < this.m_pairBuffer.count; b++) {
var C = this.m_pairBuffer.data[b];
if (C.flags & t.b2ParticleFlag.b2_barrierParticle) {
var x = C.indexA, S = C.indexB, T = p[x], w = p[S], E = i;
I.MinV(T, w, E.lowerBound);
I.MaxV(T, w, E.upperBound);
for (var M = this.m_groupBuffer[x], B = this.m_groupBuffer[S], D = this.GetLinearVelocity(M, x, T, r), P = this.GetLinearVelocity(B, S, w, s), R = I.SubVV(w, T, o), L = I.SubVV(P, D, a), O = this.GetInsideBoundsEnumerator(E), V = void 0; (V = O.GetNext()) >= 0; ) {
var N = p[V], F = this.m_groupBuffer[V];
if (M !== F && B !== F) {
var z = this.GetLinearVelocity(F, V, N, c), k = I.SubVV(N, T, l), G = I.SubVV(z, D, u), U = I.CrossVV(L, G), H = I.CrossVV(R, G) - I.CrossVV(k, L), j = I.CrossVV(R, k), W = void 0, q = void 0, X = h, Y = _;
if (0 === U) {
if (0 === H) continue;
if (!((q = -j / H) >= 0 && q < v)) continue;
I.AddVMulSV(R, q, L, X);
I.AddVMulSV(k, q, G, Y);
if (!((W = I.DotVV(X, Y) / I.DotVV(X, X)) >= 0 && W <= 1)) continue;
} else {
var J = H * H - 4 * j * U;
if (J < 0) continue;
var Z = A(J), K = (-H - Z) / (2 * U), Q = (-H + Z) / (2 * U);
if (K > Q) {
var $ = K;
K = Q;
Q = $;
}
q = K;
I.AddVMulSV(R, q, L, X);
I.AddVMulSV(k, q, G, Y);
W = I.DotVV(X, Y) / I.DotVV(X, X);
if (!(q >= 0 && q < v && W >= 0 && W <= 1)) {
if (!((q = Q) >= 0 && q < v)) continue;
I.AddVMulSV(R, q, L, X);
I.AddVMulSV(k, q, G, Y);
if (!((W = I.DotVV(X, Y) / I.DotVV(X, X)) >= 0 && W <= 1)) continue;
}
}
var tt = f;
tt.x = D.x + W * L.x - z.x;
tt.y = D.y + W * L.y - z.y;
var et = I.MulSV(g, tt, d);
if (F && this.IsRigidGroup(F)) {
var it = F.GetMass(), nt = F.GetInertia();
it > 0 && F.m_linearVelocity.SelfMulAdd(1 / it, et);
nt > 0 && (F.m_angularVelocity += I.CrossVV(I.SubVV(N, F.GetCenter(), I.s_t0), et) / nt);
} else m[V].SelfAdd(tt);
this.ParticleApplyForce(V, 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, o = 0; o < this.m_def.staticPressureIterations; o++) {
for (var a = 0; a < this.m_count; a++) this.m_accumulationBuffer[a] = 0;
for (var c = 0; c < this.m_contactBuffer.count; c++) {
var l = this.m_contactBuffer.data[c];
if (l.flags & t.b2ParticleFlag.b2_staticPressureParticle) {
var u = l.indexA, h = l.indexB, _ = l.weight;
this.m_accumulationBuffer[u] += _ * this.m_staticPressureBuffer[h];
this.m_accumulationBuffer[h] += _ * this.m_staticPressureBuffer[u];
}
}
for (a = 0; a < this.m_count; a++) {
_ = this.m_weightBuffer[a];
if (this.m_flagsBuffer.data[a] & t.b2ParticleFlag.b2_staticPressureParticle) {
var f = (this.m_accumulationBuffer[a] + n * (_ - 1)) / (_ + s);
this.m_staticPressureBuffer[a] = g(f, 0, r);
} else this.m_staticPressureBuffer[a] = 0;
}
}
};
n.prototype.ComputeWeight = function() {
for (var t = 0; t < this.m_count; t++) this.m_weightBuffer[t] = 0;
for (t = 0; t < this.m_bodyContactBuffer.count; t++) {
var e = (n = this.m_bodyContactBuffer.data[t]).index, i = n.weight;
this.m_weightBuffer[e] += i;
}
for (t = 0; t < this.m_contactBuffer.count; t++) {
e = (n = this.m_contactBuffer.data[t]).indexA;
var n, r = n.indexB;
i = n.weight;
this.m_weightBuffer[e] += i;
this.m_weightBuffer[r] += i;
}
};
n.prototype.SolvePressure = function(e) {
var i = n.SolvePressure_s_f;
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.GetCriticalPressure(e), a = this.m_def.pressureStrength * o, c = .25 * o, l = 0; l < this.m_count; l++) {
var u = this.m_weightBuffer[l], h = a * v(0, u - 1);
this.m_accumulationBuffer[l] = y(h, c);
}
if (this.m_allParticleFlags & n.k_noPressureFlags) for (l = 0; l < this.m_count; l++) this.m_flagsBuffer.data[l] & n.k_noPressureFlags && (this.m_accumulationBuffer[l] = 0);
if (this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle) for (l = 0; l < this.m_count; l++) this.m_flagsBuffer.data[l] & t.b2ParticleFlag.b2_staticPressureParticle && (this.m_accumulationBuffer[l] += this.m_staticPressureBuffer[l]);
for (var _ = e.dt / (this.m_def.density * this.m_particleDiameter), f = this.GetParticleInvMass(), d = 0; d < this.m_bodyContactBuffer.count; d++) {
var p = (A = this.m_bodyContactBuffer.data[d]).index, m = A.body, g = (u = A.weight, 
A.mass), b = A.normal, C = r[p], x = (h = this.m_accumulationBuffer[p] + a * u, 
I.MulSV(_ * u * g * h, b, i));
s[p].SelfMulSub(f, x);
m.ApplyLinearImpulse(x, C, !0);
}
for (d = 0; d < this.m_contactBuffer.count; d++) {
var A;
p = (A = this.m_contactBuffer.data[d]).indexA, m = A.indexB, u = A.weight, b = A.normal, 
h = this.m_accumulationBuffer[p] + this.m_accumulationBuffer[m], x = I.MulSV(_ * u * h, b, i);
s[p].SelfSub(x);
s[m].SelfAdd(x);
}
};
n.prototype.SolveDamping = function(t) {
var e = n.SolveDamping_s_v, i = n.SolveDamping_s_f;
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.m_def.dampingStrength, a = 1 / this.GetCriticalVelocity(t), c = this.GetParticleInvMass(), l = 0; l < this.m_bodyContactBuffer.count; l++) {
var u = (C = this.m_bodyContactBuffer.data[l]).index, h = C.body, _ = C.weight, f = C.mass, d = C.normal, p = r[u], m = I.SubVV(h.GetLinearVelocityFromWorldPoint(p, I.s_t0), s[u], e);
if ((x = I.DotVV(m, d)) < 0) {
var g = v(o * _, y(-a * x, .5)), b = I.MulSV(g * f * x, d, i);
s[u].SelfMulAdd(c, b);
h.ApplyLinearImpulse(b.SelfNeg(), p, !0);
}
}
for (l = 0; l < this.m_contactBuffer.count; l++) {
var C, x;
u = (C = this.m_contactBuffer.data[l]).indexA, h = C.indexB, _ = C.weight, d = C.normal, 
m = I.SubVV(s[h], s[u], e);
if ((x = I.DotVV(m, d)) < 0) {
g = v(o * _, y(-a * x, .5)), b = I.MulSV(g * x, d, i);
s[u].SelfAdd(b);
s[h].SelfSub(b);
}
}
};
n.prototype.SolveRigidDamping = function() {
var t = n.SolveRigidDamping_s_t0, e = n.SolveRigidDamping_s_t1, i = n.SolveRigidDamping_s_p, r = n.SolveRigidDamping_s_v, s = [ 0 ], o = [ 0 ], a = [ 0 ], c = [ 0 ], l = [ 0 ], u = [ 0 ];
if (!this.m_positionBuffer.data) throw new Error();
for (var h = this.m_positionBuffer.data, _ = this.m_def.dampingStrength, f = 0; f < this.m_bodyContactBuffer.count; f++) {
var d = (x = this.m_bodyContactBuffer.data[f]).index;
if ((A = this.m_groupBuffer[d]) && this.IsRigidGroup(A)) {
var p = x.body, m = x.normal, v = x.weight, g = h[d], b = I.SubVV(p.GetLinearVelocityFromWorldPoint(g, t), A.GetLinearVelocityFromWorldPoint(g, e), r);
if ((E = I.DotVV(b, m)) < 0) {
this.InitDampingParameterWithRigidGroupOrParticle(s, o, a, !0, A, d, g, m);
this.InitDampingParameter(c, l, u, p.GetMass(), p.GetInertia() - p.GetMass() * p.GetLocalCenter().LengthSquared(), p.GetWorldCenter(), g, m);
var C = _ * y(v, 1) * this.ComputeDampingImpulse(s[0], o[0], a[0], c[0], l[0], u[0], E);
this.ApplyDamping(s[0], o[0], a[0], !0, A, d, C, m);
p.ApplyLinearImpulse(I.MulSV(-C, m, I.s_t0), g, !0);
}
}
}
for (f = 0; f < this.m_contactBuffer.count; f++) {
d = (x = this.m_contactBuffer.data[f]).indexA, p = x.indexB, m = x.normal, v = x.weight;
var x, A = this.m_groupBuffer[d], S = this.m_groupBuffer[p], T = this.IsRigidGroup(A), w = this.IsRigidGroup(S);
if (A !== S && (T || w)) {
var E;
g = I.MidVV(h[d], h[p], i), b = I.SubVV(this.GetLinearVelocity(S, p, g, t), this.GetLinearVelocity(A, d, g, e), r);
if ((E = I.DotVV(b, m)) < 0) {
this.InitDampingParameterWithRigidGroupOrParticle(s, o, a, T, A, d, g, m);
this.InitDampingParameterWithRigidGroupOrParticle(c, l, u, w, S, p, g, m);
C = _ * v * this.ComputeDampingImpulse(s[0], o[0], a[0], c[0], l[0], u[0], E);
this.ApplyDamping(s[0], o[0], a[0], T, A, d, C, m);
this.ApplyDamping(c[0], l[0], u[0], w, S, p, -C, m);
}
}
}
};
n.prototype.SolveExtraDamping = function() {
var t = n.SolveExtraDamping_s_v, e = n.SolveExtraDamping_s_f;
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var i = this.m_velocityBuffer.data, r = this.m_positionBuffer.data, s = this.GetParticleInvMass(), o = 0; o < this.m_bodyContactBuffer.count; o++) {
var a = this.m_bodyContactBuffer.data[o], c = a.index;
if (this.m_flagsBuffer.data[c] & n.k_extraDampingFlags) {
var l = a.body, u = a.mass, h = a.normal, _ = r[c], f = I.SubVV(l.GetLinearVelocityFromWorldPoint(_, I.s_t0), i[c], t), d = I.DotVV(f, h);
if (d < 0) {
var p = I.MulSV(.5 * u * d, h, e);
i[c].SelfMulAdd(s, p);
l.ApplyLinearImpulse(p.SelfNeg(), _, !0);
}
}
}
};
n.prototype.SolveWall = function() {
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var e = this.m_velocityBuffer.data, i = 0; i < this.m_count; i++) this.m_flagsBuffer.data[i] & t.b2ParticleFlag.b2_wallParticle && e[i].SetZero();
};
n.prototype.SolveRigid = function(e) {
var i = n.SolveRigid_s_position, r = n.SolveRigid_s_rotation, s = n.SolveRigid_s_transform, o = n.SolveRigid_s_velocityTransform;
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var a = this.m_positionBuffer.data, c = this.m_velocityBuffer.data, l = this.m_groupList; l; l = l.GetNext()) if (l.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup) {
l.UpdateStatistics();
var u = r;
u.SetAngle(e.dt * l.m_angularVelocity);
var h = I.AddVV(l.m_center, I.SubVV(I.MulSV(e.dt, l.m_linearVelocity, I.s_t0), O.MulRV(u, l.m_center, I.s_t1), I.s_t0), i), _ = s;
_.SetPositionRotation(h, u);
V.MulXX(_, l.m_transform, l.m_transform);
var f = o;
f.p.x = e.inv_dt * _.p.x;
f.p.y = e.inv_dt * _.p.y;
f.q.s = e.inv_dt * _.q.s;
f.q.c = e.inv_dt * (_.q.c - 1);
for (var d = l.m_firstIndex; d < l.m_lastIndex; d++) V.MulXV(f, a[d], c[d]);
}
};
n.prototype.SolveElastic = function(e) {
var i = n.SolveElastic_s_pa, r = n.SolveElastic_s_pb, s = n.SolveElastic_s_pc, o = n.SolveElastic_s_r, a = n.SolveElastic_s_t0;
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var c = this.m_positionBuffer.data, l = this.m_velocityBuffer.data, u = e.inv_dt * this.m_def.elasticStrength, h = 0; h < this.m_triadBuffer.count; h++) {
var _ = this.m_triadBuffer.data[h];
if (_.flags & t.b2ParticleFlag.b2_elasticParticle) {
var f = _.indexA, d = _.indexB, p = _.indexC, m = _.pa, y = _.pb, v = _.pc, g = i.Copy(c[f]), b = r.Copy(c[d]), C = s.Copy(c[p]), A = l[f], S = l[d], T = l[p];
g.SelfMulAdd(e.dt, A);
b.SelfMulAdd(e.dt, S);
C.SelfMulAdd(e.dt, T);
var w = (g.x + b.x + C.x) / 3, E = (g.y + b.y + C.y) / 3;
g.x -= w;
g.y -= E;
b.x -= w;
b.y -= E;
C.x -= w;
C.y -= E;
var M = o;
M.s = I.CrossVV(m, g) + I.CrossVV(y, b) + I.CrossVV(v, C);
M.c = I.DotVV(m, g) + I.DotVV(y, b) + I.DotVV(v, C);
var B = x(M.s * M.s + M.c * M.c);
isFinite(B) || (B = 198177537e11);
M.s *= B;
M.c *= B;
var D = u * _.strength;
O.MulRV(M, m, a);
I.SubVV(a, g, a);
I.MulSV(D, a, a);
A.SelfAdd(a);
O.MulRV(M, y, a);
I.SubVV(a, b, a);
I.MulSV(D, a, a);
S.SelfAdd(a);
O.MulRV(M, v, a);
I.SubVV(a, C, a);
I.MulSV(D, a, a);
T.SelfAdd(a);
}
}
};
n.prototype.SolveSpring = function(e) {
var i = n.SolveSpring_s_pa, r = n.SolveSpring_s_pb, s = n.SolveSpring_s_d, o = n.SolveSpring_s_f;
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var a = this.m_positionBuffer.data, c = this.m_velocityBuffer.data, l = e.inv_dt * this.m_def.springStrength, u = 0; u < this.m_pairBuffer.count; u++) {
var h = this.m_pairBuffer.data[u];
if (h.flags & t.b2ParticleFlag.b2_springParticle) {
var _ = h.indexA, f = h.indexB, d = i.Copy(a[_]), p = r.Copy(a[f]), m = c[_], y = c[f];
d.SelfMulAdd(e.dt, m);
p.SelfMulAdd(e.dt, y);
var v = I.SubVV(p, d, s), g = h.distance, b = v.Length(), C = l * h.strength, x = I.MulSV(C * (g - b) / b, v, o);
m.SelfSub(x);
y.SelfAdd(x);
}
}
};
n.prototype.SolveTensile = function(e) {
var i = n.SolveTensile_s_weightedNormal, r = n.SolveTensile_s_s, s = n.SolveTensile_s_f;
if (!this.m_velocityBuffer.data) throw new Error();
for (var o = this.m_velocityBuffer.data, a = 0; a < this.m_count; a++) {
this.m_accumulation2Buffer[a] = new I();
this.m_accumulation2Buffer[a].SetZero();
}
for (var c = 0; c < this.m_contactBuffer.count; c++) if ((g = this.m_contactBuffer.data[c]).flags & t.b2ParticleFlag.b2_tensileParticle) {
var l = g.indexA, u = g.indexB, h = g.weight, _ = g.normal, f = I.MulSV((1 - h) * h, _, i);
this.m_accumulation2Buffer[l].SelfSub(f);
this.m_accumulation2Buffer[u].SelfAdd(f);
}
var d = this.GetCriticalVelocity(e), p = this.m_def.surfaceTensionPressureStrength * d, m = this.m_def.surfaceTensionNormalStrength * d, v = .5 * d;
for (c = 0; c < this.m_contactBuffer.count; c++) {
var g;
if ((g = this.m_contactBuffer.data[c]).flags & t.b2ParticleFlag.b2_tensileParticle) {
l = g.indexA, u = g.indexB, h = g.weight, _ = g.normal;
var b = this.m_weightBuffer[l] + this.m_weightBuffer[u], C = I.SubVV(this.m_accumulation2Buffer[u], this.m_accumulation2Buffer[l], r), x = y(p * (b - 2) + m * I.DotVV(C, _), v) * h, A = I.MulSV(x, _, s);
o[l].SelfSub(A);
o[u].SelfAdd(A);
}
}
};
n.prototype.SolveViscous = function() {
var e = n.SolveViscous_s_v, i = n.SolveViscous_s_f;
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.m_def.viscousStrength, a = this.GetParticleInvMass(), c = 0; c < this.m_bodyContactBuffer.count; c++) {
var l = (m = this.m_bodyContactBuffer.data[c]).index;
if (this.m_flagsBuffer.data[l] & t.b2ParticleFlag.b2_viscousParticle) {
var u = m.body, h = m.weight, _ = m.mass, f = r[l], d = I.SubVV(u.GetLinearVelocityFromWorldPoint(f, I.s_t0), s[l], e), p = I.MulSV(o * _ * h, d, i);
s[l].SelfMulAdd(a, p);
u.ApplyLinearImpulse(p.SelfNeg(), f, !0);
}
}
for (c = 0; c < this.m_contactBuffer.count; c++) {
var m;
if ((m = this.m_contactBuffer.data[c]).flags & t.b2ParticleFlag.b2_viscousParticle) {
l = m.indexA, u = m.indexB, h = m.weight, d = I.SubVV(s[u], s[l], e), p = I.MulSV(o * h, d, i);
s[l].SelfAdd(p);
s[u].SelfSub(p);
}
}
};
n.prototype.SolveRepulsive = function(e) {
var i = n.SolveRepulsive_s_f;
if (!this.m_velocityBuffer.data) throw new Error();
for (var r = this.m_velocityBuffer.data, s = this.m_def.repulsiveStrength * this.GetCriticalVelocity(e), o = 0; o < this.m_contactBuffer.count; o++) {
var a = this.m_contactBuffer.data[o];
if (a.flags & t.b2ParticleFlag.b2_repulsiveParticle) {
var c = a.indexA, l = a.indexB;
if (this.m_groupBuffer[c] !== this.m_groupBuffer[l]) {
var u = a.weight, h = a.normal, _ = I.MulSV(s * u, h, i);
r[c].SelfSub(_);
r[l].SelfAdd(_);
}
}
}
};
n.prototype.SolvePowder = function(e) {
var i = n.SolvePowder_s_f;
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.m_def.powderStrength * this.GetCriticalVelocity(e), a = this.GetParticleInvMass(), c = 0; c < this.m_bodyContactBuffer.count; c++) {
var l = (p = this.m_bodyContactBuffer.data[c]).index;
if (this.m_flagsBuffer.data[l] & t.b2ParticleFlag.b2_powderParticle && (m = p.weight) > .25) {
var u = p.body, h = p.mass, _ = r[l], f = p.normal, d = I.MulSV(o * h * (m - .25), f, i);
s[l].SelfMulSub(a, d);
u.ApplyLinearImpulse(d, _, !0);
}
}
for (c = 0; c < this.m_contactBuffer.count; c++) {
var p;
if ((p = this.m_contactBuffer.data[c]).flags & t.b2ParticleFlag.b2_powderParticle) {
var m;
if ((m = p.weight) > .25) {
l = p.indexA, u = p.indexB, f = p.normal, d = I.MulSV(o * (m - .25), f, i);
s[l].SelfSub(d);
s[u].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 < this.m_contactBuffer.count; s++) {
var o = this.m_contactBuffer.data[s], a = o.indexA, c = o.indexB;
if (this.m_groupBuffer[a] !== this.m_groupBuffer[c]) {
var l = o.weight, u = o.normal, h = this.m_depthBuffer[a] + this.m_depthBuffer[c], _ = I.MulSV(r * h * l, u, e);
i[a].SelfSub(_);
i[c].SelfAdd(_);
}
}
};
n.prototype.SolveForce = function(t) {
if (!this.m_velocityBuffer.data) throw new Error();
for (var e = this.m_velocityBuffer.data, i = t.dt * this.GetParticleInvMass(), n = 0; n < this.m_count; n++) e[n].SelfMulAdd(i, this.m_forceBuffer[n]);
this.m_hasForce = !1;
};
n.prototype.SolveColorMixing = function() {
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_colorBuffer.data) throw new Error();
var e = .5 * this.m_def.colorMixingStrength;
if (e) for (var i = 0; i < this.m_contactBuffer.count; i++) {
var n = this.m_contactBuffer.data[i], r = n.indexA, s = n.indexB;
if (this.m_flagsBuffer.data[r] & this.m_flagsBuffer.data[s] & t.b2ParticleFlag.b2_colorMixingParticle) {
var o = this.m_colorBuffer.data[r], a = this.m_colorBuffer.data[s];
F.MixColors(o, a, e);
}
}
};
n.prototype.SolveZombie = function() {
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
for (var e = 0, i = [], n = 0; n < this.m_count; n++) i[n] = h;
var r = 0;
for (n = 0; n < this.m_count; n++) {
var s = this.m_flagsBuffer.data[n];
if (s & t.b2ParticleFlag.b2_zombieParticle) {
var o = this.m_world.m_destructionListener;
s & t.b2ParticleFlag.b2_destructionListenerParticle && o && o.SayGoodbyeParticle(this, n);
if (this.m_handleIndexBuffer.data && (a = this.m_handleIndexBuffer.data[n])) {
a.SetIndex(h);
this.m_handleIndexBuffer.data[n] = null;
}
i[n] = h;
} else {
i[n] = e;
if (n !== e) {
if (this.m_handleIndexBuffer.data) {
var a;
(a = this.m_handleIndexBuffer.data[n]) && a.SetIndex(e);
this.m_handleIndexBuffer.data[e] = a;
}
this.m_flagsBuffer.data[e] = this.m_flagsBuffer.data[n];
this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[e] = this.m_lastBodyContactStepBuffer.data[n]);
this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[e] = this.m_bodyContactCountBuffer.data[n]);
this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[e] = this.m_consecutiveContactStepsBuffer.data[n]);
this.m_positionBuffer.data[e].Copy(this.m_positionBuffer.data[n]);
this.m_velocityBuffer.data[e].Copy(this.m_velocityBuffer.data[n]);
this.m_groupBuffer[e] = this.m_groupBuffer[n];
this.m_hasForce && this.m_forceBuffer[e].Copy(this.m_forceBuffer[n]);
this.m_staticPressureBuffer && (this.m_staticPressureBuffer[e] = this.m_staticPressureBuffer[n]);
this.m_depthBuffer && (this.m_depthBuffer[e] = this.m_depthBuffer[n]);
this.m_colorBuffer.data && this.m_colorBuffer.data[e].Copy(this.m_colorBuffer.data[n]);
this.m_userDataBuffer.data && (this.m_userDataBuffer.data[e] = this.m_userDataBuffer.data[n]);
this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[e] = this.m_expirationTimeBuffer.data[n]);
}
e++;
r |= s;
}
}
for (var c = 0; c < this.m_proxyBuffer.count; c++) {
var l = this.m_proxyBuffer.data[c];
l.index = i[l.index];
}
this.m_proxyBuffer.RemoveIf((function(t) {
return t.index < 0;
}));
for (c = 0; c < this.m_contactBuffer.count; c++) {
(u = this.m_contactBuffer.data[c]).indexA = i[u.indexA];
u.indexB = i[u.indexB];
}
this.m_contactBuffer.RemoveIf((function(t) {
return t.indexA < 0 || t.indexB < 0;
}));
for (c = 0; c < this.m_bodyContactBuffer.count; c++) {
var u;
(u = this.m_bodyContactBuffer.data[c]).index = i[u.index];
}
this.m_bodyContactBuffer.RemoveIf((function(t) {
return t.index < 0;
}));
for (c = 0; c < this.m_pairBuffer.count; c++) {
var _ = this.m_pairBuffer.data[c];
_.indexA = i[_.indexA];
_.indexB = i[_.indexB];
}
this.m_pairBuffer.RemoveIf((function(t) {
return t.indexA < 0 || t.indexB < 0;
}));
for (c = 0; c < this.m_triadBuffer.count; c++) {
var f = this.m_triadBuffer.data[c];
f.indexA = i[f.indexA];
f.indexB = i[f.indexB];
f.indexC = i[f.indexC];
}
this.m_triadBuffer.RemoveIf((function(t) {
return t.indexA < 0 || t.indexB < 0 || t.indexC < 0;
}));
if (this.m_indexByExpirationTimeBuffer.data) for (var d = 0, p = 0; p < this.m_count; p++) {
var m = i[this.m_indexByExpirationTimeBuffer.data[p]];
m !== h && (this.m_indexByExpirationTimeBuffer.data[d++] = m);
}
for (var g = this.m_groupList; g; g = g.GetNext()) {
var b = e, C = 0, x = !1;
for (n = g.m_firstIndex; n < g.m_lastIndex; n++) {
var A = i[n];
if (A >= 0) {
b = y(b, A);
C = v(C, A + 1);
} else x = !0;
}
if (b < C) {
g.m_firstIndex = b;
g.m_lastIndex = C;
x && g.m_groupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SetGroupFlags(g, g.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);
} else {
g.m_firstIndex = 0;
g.m_lastIndex = 0;
g.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupCanBeEmpty || this.SetGroupFlags(g, g.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed);
}
}
this.m_count = e;
this.m_allParticleFlags = r;
this.m_needsUpdateAllParticleFlags = !1;
for (g = this.m_groupList; g; ) {
var S = g.GetNext();
g.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed && this.DestroyParticleGroup(g);
g = S;
}
};
n.prototype.SolveLifetimes = function(t) {
if (!this.m_expirationTimeBuffer.data) throw new Error();
if (!this.m_indexByExpirationTimeBuffer.data) throw new Error();
this.m_timeElapsed = this.LifetimeToExpirationTime(t.dt);
var e = this.GetQuantizedTimeElapsed(), i = this.m_expirationTimeBuffer.data, n = this.m_indexByExpirationTimeBuffer.data, r = this.GetParticleCount();
if (this.m_expirationTimeBufferRequiresSorting) {
gn(n, 0, r, (function(t, e) {
var n = i[t], r = i[e], s = n <= 0;
return s === r <= 0 ? n > r : s;
}));
this.m_expirationTimeBufferRequiresSorting = !1;
}
for (var s = r - 1; s >= 0; --s) {
var o = n[s], a = i[o];
if (e < a || a <= 0) break;
this.DestroyParticle(o);
}
};
n.prototype.RotateBuffer = function(t, e, i) {
if (t !== e && e !== i) {
if (!this.m_flagsBuffer.data) throw new Error();
if (!this.m_positionBuffer.data) throw new Error();
if (!this.m_velocityBuffer.data) throw new Error();
Sn(this.m_flagsBuffer.data, t, e, i);
this.m_lastBodyContactStepBuffer.data && Sn(this.m_lastBodyContactStepBuffer.data, t, e, i);
this.m_bodyContactCountBuffer.data && Sn(this.m_bodyContactCountBuffer.data, t, e, i);
this.m_consecutiveContactStepsBuffer.data && Sn(this.m_consecutiveContactStepsBuffer.data, t, e, i);
Sn(this.m_positionBuffer.data, t, e, i);
Sn(this.m_velocityBuffer.data, t, e, i);
Sn(this.m_groupBuffer, t, e, i);
this.m_hasForce && Sn(this.m_forceBuffer, t, e, i);
this.m_staticPressureBuffer && Sn(this.m_staticPressureBuffer, t, e, i);
this.m_depthBuffer && Sn(this.m_depthBuffer, t, e, i);
this.m_colorBuffer.data && Sn(this.m_colorBuffer.data, t, e, i);
this.m_userDataBuffer.data && Sn(this.m_userDataBuffer.data, t, e, i);
if (this.m_handleIndexBuffer.data) {
Sn(this.m_handleIndexBuffer.data, t, e, i);
for (var n = t; n < i; ++n) {
var r = this.m_handleIndexBuffer.data[n];
r && r.SetIndex(f(r.GetIndex()));
}
}
if (this.m_expirationTimeBuffer.data) {
Sn(this.m_expirationTimeBuffer.data, t, e, i);
var s = this.GetParticleCount();
if (!this.m_indexByExpirationTimeBuffer.data) throw new Error();
var o = this.m_indexByExpirationTimeBuffer.data;
for (n = 0; n < s; ++n) o[n] = f(o[n]);
}
for (var a = 0; a < this.m_proxyBuffer.count; a++) {
var c = this.m_proxyBuffer.data[a];
c.index = f(c.index);
}
for (a = 0; a < this.m_contactBuffer.count; a++) {
(l = this.m_contactBuffer.data[a]).indexA = f(l.indexA);
l.indexB = f(l.indexB);
}
for (a = 0; a < this.m_bodyContactBuffer.count; a++) {
var l;
(l = this.m_bodyContactBuffer.data[a]).index = f(l.index);
}
for (a = 0; a < this.m_pairBuffer.count; a++) {
var u = this.m_pairBuffer.data[a];
u.indexA = f(u.indexA);
u.indexB = f(u.indexB);
}
for (a = 0; a < this.m_triadBuffer.count; a++) {
var h = this.m_triadBuffer.data[a];
h.indexA = f(h.indexA);
h.indexB = f(h.indexB);
h.indexC = f(h.indexC);
}
for (var _ = this.m_groupList; _; _ = _.GetNext()) {
_.m_firstIndex = f(_.m_firstIndex);
_.m_lastIndex = f(_.m_lastIndex - 1) + 1;
}
}
function f(n) {
return n < t ? n : n < e ? n + i - e : n < i ? n + t - e : n;
}
};
n.prototype.GetCriticalVelocity = function(t) {
return this.m_particleDiameter * t.inv_dt;
};
n.prototype.GetCriticalVelocitySquared = function(t) {
var e = this.GetCriticalVelocity(t);
return e * e;
};
n.prototype.GetCriticalPressure = function(t) {
return this.m_def.density * this.GetCriticalVelocitySquared(t);
};
n.prototype.GetParticleStride = function() {
return .75 * this.m_particleDiameter;
};
n.prototype.GetParticleMass = function() {
var t = this.GetParticleStride();
return this.m_def.density * t * t;
};
n.prototype.GetParticleInvMass = function() {
var t = this.m_inverseDiameter * (1 / .75);
return this.m_inverseDensity * t * t;
};
n.prototype.GetFixtureContactFilter = function() {
return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null;
};
n.prototype.GetParticleContactFilter = function() {
return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null;
};
n.prototype.GetFixtureContactListener = function() {
return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null;
};
n.prototype.GetParticleContactListener = function() {
return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null;
};
n.prototype.SetUserOverridableBuffer = function(t, e, i) {
t.data = e;
t.userSuppliedCapacity = i;
};
n.prototype.SetGroupFlags = function(e, i) {
var n = e.m_groupFlags;
(n ^ i) & t.b2ParticleGroupFlag.b2_solidParticleGroup && (i |= t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);
n & ~i && (this.m_needsUpdateAllGroupFlags = !0);
if (~this.m_allGroupFlags & i) {
i & t.b2ParticleGroupFlag.b2_solidParticleGroup && (this.m_depthBuffer = this.RequestBuffer(this.m_depthBuffer));
this.m_allGroupFlags |= i;
}
e.m_groupFlags = i;
};
n.BodyContactCompare = function(t, e) {
return t.index === e.index ? t.weight > e.weight : t.index < e.index;
};
n.prototype.RemoveSpuriousBodyContacts = function() {
gn(this.m_bodyContactBuffer.data, 0, this.m_bodyContactBuffer.count, n.BodyContactCompare);
var t = n.RemoveSpuriousBodyContacts_s_n, e = n.RemoveSpuriousBodyContacts_s_pos, i = n.RemoveSpuriousBodyContacts_s_normal, r = this, s = -1, o = 0;
this.m_bodyContactBuffer.count = Cn(this.m_bodyContactBuffer.data, (function(n) {
if (n.index !== s) {
o = 0;
s = n.index;
}
if (o++ > 3) return !0;
var a = t.Copy(n.normal);
a.SelfMul(r.m_particleDiameter * (1 - n.weight));
if (!r.m_positionBuffer.data) throw new Error();
var l = I.AddVV(r.m_positionBuffer.data[n.index], a, e);
if (!n.fixture.TestPoint(l)) {
for (var u = n.fixture.GetShape().GetChildCount(), h = 0; h < u; h++) {
var _ = i;
if (n.fixture.ComputeDistance(l, _, h) < c) return !1;
}
return !0;
}
return !1;
}), this.m_bodyContactBuffer.count);
};
n.prototype.DetectStuckParticle = function(t) {
if (!(this.m_stuckThreshold <= 0)) {
if (!this.m_bodyContactCountBuffer.data) throw new Error();
if (!this.m_consecutiveContactStepsBuffer.data) throw new Error();
if (!this.m_lastBodyContactStepBuffer.data) throw new Error();
++this.m_bodyContactCountBuffer.data[t];
if (2 === this.m_bodyContactCountBuffer.data[t]) {
++this.m_consecutiveContactStepsBuffer.data[t];
this.m_consecutiveContactStepsBuffer.data[t] > this.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 && t < this.GetParticleCount() && t !== h;
};
n.prototype.GetQuantizedTimeElapsed = function() {
return Math.floor(this.m_timeElapsed / 4294967296);
};
n.prototype.LifetimeToExpirationTime = function(t) {
return this.m_timeElapsed + Math.floor(t / this.m_def.lifetimeGranularity * 4294967296);
};
n.prototype.ForceCanBeApplied = function(e) {
return !(e & t.b2ParticleFlag.b2_wallParticle);
};
n.prototype.PrepareForceBuffer = function() {
if (!this.m_hasForce) {
for (var t = 0; t < this.m_count; t++) this.m_forceBuffer[t].SetZero();
this.m_hasForce = !0;
}
};
n.prototype.IsRigidGroup = function(e) {
return null !== e && 0 != (e.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup);
};
n.prototype.GetLinearVelocity = function(t, e, i, n) {
if (t && this.IsRigidGroup(t)) return t.GetLinearVelocityFromWorldPoint(i, n);
if (!this.m_velocityBuffer.data) throw new Error();
return n.Copy(this.m_velocityBuffer.data[e]);
};
n.prototype.InitDampingParameter = function(t, e, i, n, r, s, o, a) {
t[0] = n > 0 ? 1 / n : 0;
e[0] = r > 0 ? 1 / r : 0;
i[0] = I.CrossVV(I.SubVV(o, s, I.s_t0), a);
};
n.prototype.InitDampingParameterWithRigidGroupOrParticle = function(e, i, n, r, s, o, a, c) {
if (s && r) this.InitDampingParameter(e, i, n, s.GetMass(), s.GetInertia(), s.GetCenter(), a, c); else {
if (!this.m_flagsBuffer.data) throw new Error();
var l = this.m_flagsBuffer.data[o];
this.InitDampingParameter(e, i, n, l & t.b2ParticleFlag.b2_wallParticle ? 0 : this.GetParticleMass(), 0, a, a, c);
}
};
n.prototype.ComputeDampingImpulse = function(t, e, i, n, r, s, o) {
var a = t + e * i * i + n + r * s * s;
return a > 0 ? o / a : 0;
};
n.prototype.ApplyDamping = function(t, e, i, n, r, s, o, a) {
if (r && n) {
r.m_linearVelocity.SelfMulAdd(o * t, a);
r.m_angularVelocity += o * i * e;
} else {
if (!this.m_velocityBuffer.data) throw new Error();
this.m_velocityBuffer.data[s].SelfMulAdd(o * t, a);
}
};
n.xTruncBits = 12;
n.yTruncBits = 12;
n.tagBits = 32;
n.yOffset = 1 << n.yTruncBits - 1;
n.yShift = n.tagBits - n.yTruncBits;
n.xShift = n.tagBits - n.yTruncBits - n.xTruncBits;
n.xScale = 1 << n.xShift;
n.xOffset = n.xScale * (1 << n.xTruncBits - 1);
n.yMask = (1 << n.yTruncBits) - 1 << n.yShift;
n.xMask = ~n.yMask;
n.DestroyParticlesInShape_s_aabb = new bt();
n.CreateParticleGroup_s_transform = new V();
n.ComputeCollisionEnergy_s_v = new I();
n.QueryShapeAABB_s_aabb = new bt();
n.QueryPointAABB_s_aabb = new bt();
n.RayCast_s_aabb = new bt();
n.RayCast_s_p = new I();
n.RayCast_s_v = new I();
n.RayCast_s_n = new I();
n.RayCast_s_point = new I();
n.k_pairFlags = t.b2ParticleFlag.b2_springParticle;
n.k_triadFlags = t.b2ParticleFlag.b2_elasticParticle;
n.k_noPressureFlags = t.b2ParticleFlag.b2_powderParticle | t.b2ParticleFlag.b2_tensileParticle;
n.k_extraDampingFlags = t.b2ParticleFlag.b2_staticPressureParticle;
n.k_barrierWallFlags = t.b2ParticleFlag.b2_barrierParticle | t.b2ParticleFlag.b2_wallParticle;
n.CreateParticlesStrokeShapeForGroup_s_edge = new Ze();
n.CreateParticlesStrokeShapeForGroup_s_d = new I();
n.CreateParticlesStrokeShapeForGroup_s_p = new I();
n.CreateParticlesFillShapeForGroup_s_aabb = new bt();
n.CreateParticlesFillShapeForGroup_s_p = new I();
n.UpdatePairsAndTriads_s_dab = new I();
n.UpdatePairsAndTriads_s_dbc = new I();
n.UpdatePairsAndTriads_s_dca = new I();
n.AddContact_s_d = new I();
n.UpdateBodyContacts_s_aabb = new bt();
n.Solve_s_subStep = new Qi();
n.SolveCollision_s_aabb = new bt();
n.SolveGravity_s_gravity = new I();
n.SolveBarrier_s_aabb = new bt();
n.SolveBarrier_s_va = new I();
n.SolveBarrier_s_vb = new I();
n.SolveBarrier_s_pba = new I();
n.SolveBarrier_s_vba = new I();
n.SolveBarrier_s_vc = new I();
n.SolveBarrier_s_pca = new I();
n.SolveBarrier_s_vca = new I();
n.SolveBarrier_s_qba = new I();
n.SolveBarrier_s_qca = new I();
n.SolveBarrier_s_dv = new I();
n.SolveBarrier_s_f = new I();
n.SolvePressure_s_f = new I();
n.SolveDamping_s_v = new I();
n.SolveDamping_s_f = new I();
n.SolveRigidDamping_s_t0 = new I();
n.SolveRigidDamping_s_t1 = new I();
n.SolveRigidDamping_s_p = new I();
n.SolveRigidDamping_s_v = new I();
n.SolveExtraDamping_s_v = new I();
n.SolveExtraDamping_s_f = new I();
n.SolveRigid_s_position = new I();
n.SolveRigid_s_rotation = new O();
n.SolveRigid_s_transform = new V();
n.SolveRigid_s_velocityTransform = new V();
n.SolveElastic_s_pa = new I();
n.SolveElastic_s_pb = new I();
n.SolveElastic_s_pc = new I();
n.SolveElastic_s_r = new O();
n.SolveElastic_s_t0 = new I();
n.SolveSpring_s_pa = new I();
n.SolveSpring_s_pb = new I();
n.SolveSpring_s_d = new I();
n.SolveSpring_s_f = new I();
n.SolveTensile_s_weightedNormal = new I();
n.SolveTensile_s_s = new I();
n.SolveTensile_s_f = new I();
n.SolveViscous_s_v = new I();
n.SolveViscous_s_f = new I();
n.SolveRepulsive_s_f = new I();
n.SolvePowder_s_f = new I();
n.SolveSolid_s_f = new I();
n.RemoveSpuriousBodyContacts_s_n = new I();
n.RemoveSpuriousBodyContacts_s_pos = new I();
n.RemoveSpuriousBodyContacts_s_normal = new I();
return n;
})();
(function(e) {
e.UserOverridableBuffer = function() {
this.data = null;
this.userSuppliedCapacity = 0;
};
var n = (function() {
function t() {
this.index = h;
this.tag = 0;
}
t.CompareProxyProxy = function(t, e) {
return t.tag < e.tag;
};
t.CompareTagProxy = function(t, e) {
return t < e.tag;
};
t.CompareProxyTag = function(t, e) {
return t.tag < e;
};
return t;
})();
e.Proxy = n;
var r = (function() {
function t(t, i, n, r, s) {
this.m_system = t;
this.m_xLower = (i & e.xMask) >>> 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;
}
t.prototype.GetNext = function() {
for (;this.m_first < this.m_last; ) {
var t = (this.m_system.m_proxyBuffer.data[this.m_first].tag & e.xMask) >>> 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 h;
};
return t;
})();
e.InsideBoundsEnumerator = r;
e.ParticleListNode = function() {
this.next = null;
this.count = 0;
this.index = 0;
};
var s = (function() {
function t() {}
t.prototype.Allocate = function(t, e) {
return e;
};
t.prototype.Clear = function() {};
t.prototype.GetCount = function() {
return 0;
};
t.prototype.Invalidate = function() {};
t.prototype.GetValidBuffer = function() {
return [];
};
t.prototype.GetBuffer = function() {
return [];
};
t.prototype.SetCount = function() {};
return t;
})();
e.FixedSetAllocator = s;
e.FixtureParticle = function(t, e) {
this.second = h;
this.first = t;
this.second = e;
};
var o = (function(t) {
Xe(e, t);
function e() {
return null !== t && t.apply(this, arguments) || this;
}
e.prototype.Initialize = function() {};
e.prototype.Find = function() {
return h;
};
return e;
})(e.FixedSetAllocator);
e.FixtureParticleSet = o;
e.ParticlePair = function(t, e) {
this.first = h;
this.second = h;
this.first = t;
this.second = e;
};
var a = (function(t) {
Xe(e, t);
function e() {
return null !== t && t.apply(this, arguments) || this;
}
e.prototype.Initialize = function() {};
e.prototype.Find = function() {
return h;
};
return e;
})(e.FixedSetAllocator);
e.b2ParticlePairSet = a;
var l = (function() {
function t() {}
t.prototype.IsNecessary = function() {
return !0;
};
t.prototype.ShouldCreatePair = function() {
return !0;
};
t.prototype.ShouldCreateTriad = function() {
return !0;
};
return t;
})();
e.ConnectionFilter = l;
var u = (function(t) {
Xe(e, t);
function e(e, i, n, r) {
var s = t.call(this) || this;
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;
return s;
}
e.prototype.ReportFixture = function() {
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();
if (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++;
}
return !0;
};
e.prototype.Destroyed = function() {
return this.m_destroyed;
};
return e;
})(Yi);
e.DestroyParticlesInShapeCallback = u;
var _ = (function(t) {
Xe(e, t);
function e(e) {
var i = t.call(this) || this;
i.m_threshold = 0;
i.m_threshold = e;
return i;
}
e.prototype.ShouldCreatePair = function(t, e) {
return t < this.m_threshold && this.m_threshold <= e || e < this.m_threshold && this.m_threshold <= t;
};
e.prototype.ShouldCreateTriad = function(t, e, i) {
return (t < this.m_threshold || e < this.m_threshold || i < this.m_threshold) && (this.m_threshold <= t || this.m_threshold <= e || this.m_threshold <= i);
};
return e;
})(e.ConnectionFilter);
e.JoinParticleGroupsFilter = _;
var f = (function(e) {
Xe(n, e);
function n(i, n) {
void 0 === n && (n = i.length);
var r = e.call(this, t.b2ShapeType.e_unknown, 0) || this;
r.m_shapeCount = 0;
r.m_shapes = i;
r.m_shapeCount = n;
return r;
}
n.prototype.Clone = function() {
throw new Error();
};
n.prototype.GetChildCount = function() {
return 1;
};
n.prototype.TestPoint = function(t, e) {
for (var i = 0; i < this.m_shapeCount; i++) if (this.m_shapes[i].TestPoint(t, e)) return !0;
return !1;
};
n.prototype.ComputeDistance = function() {
return 0;
};
n.prototype.RayCast = function() {
return !1;
};
n.prototype.ComputeAABB = function(t, e) {
var n = new bt();
t.lowerBound.x = +i;
t.lowerBound.y = +i;
t.upperBound.x = -i;
t.upperBound.y = -i;
for (var r = 0; r < this.m_shapeCount; r++) for (var s = this.m_shapes[r].GetChildCount(), o = 0; o < s; o++) {
var a = n;
this.m_shapes[r].ComputeAABB(a, e, o);
t.Combine1(a);
}
};
n.prototype.ComputeMass = function() {};
n.prototype.SetupDistanceProxy = function() {};
n.prototype.ComputeSubmergedArea = function() {
return 0;
};
n.prototype.Dump = function() {};
return n;
})(We);
e.CompositeShape = f;
var d = (function(e) {
Xe(i, e);
function i(t) {
var i = e.call(this) || this;
i.m_flagsBuffer = t;
return i;
}
i.prototype.IsNecessary = function(e) {
if (!this.m_flagsBuffer.data) throw new Error();
return 0 != (this.m_flagsBuffer.data[e] & t.b2ParticleFlag.b2_reactiveParticle);
};
return i;
})(e.ConnectionFilter);
e.ReactiveFilter = d;
var p = (function(i) {
Xe(n, i);
function n(t, e) {
var n = i.call(this, t) || this;
n.m_contactFilter = e;
return n;
}
n.prototype.ShouldCollideFixtureParticle = function(e, i, n) {
return !(this.m_contactFilter && this.m_system.GetFlagsBuffer()[n] & t.b2ParticleFlag.b2_fixtureContactFilterParticle) || this.m_contactFilter.ShouldCollideFixtureParticle(e, this.m_system, n);
};
n.prototype.ReportFixtureAndParticle = function(i, n, r) {
var s = e.UpdateBodyContactsCallback.ReportFixtureAndParticle_s_n, o = e.UpdateBodyContactsCallback.ReportFixtureAndParticle_s_rp;
if (!this.m_system.m_flagsBuffer.data) throw new Error();
if (!this.m_system.m_positionBuffer.data) throw new Error();
var a = this.m_system.m_positionBuffer.data[r], c = s, l = i.ComputeDistance(a, c, n);
if (l < this.m_system.m_particleDiameter && this.ShouldCollideFixtureParticle(i, this.m_system, r)) {
var u = i.GetBody(), h = u.GetWorldCenter(), _ = u.GetMass(), f = u.GetInertia() - _ * u.GetLocalCenter().LengthSquared(), d = _ > 0 ? 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 = I.SubVV(a, h, o), v = I.CrossVV(y, c), g = m + d + p * v * v, b = this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];
b.index = r;
b.body = u;
b.fixture = i;
b.weight = 1 - l * this.m_system.m_inverseDiameter;
b.normal.Copy(c.SelfNeg());
b.mass = g > 0 ? 1 / g : 0;
this.m_system.DetectStuckParticle(r);
}
};
n.ReportFixtureAndParticle_s_n = new I();
n.ReportFixtureAndParticle_s_rp = new I();
return n;
})(En);
e.UpdateBodyContactsCallback = p;
var m = (function(i) {
Xe(n, i);
function n(t, e) {
var n = i.call(this, t) || this;
n.m_step = e;
return n;
}
n.prototype.ReportFixtureAndParticle = function(i, n, r) {
var s = e.SolveCollisionCallback.ReportFixtureAndParticle_s_p1, o = e.SolveCollisionCallback.ReportFixtureAndParticle_s_output, a = e.SolveCollisionCallback.ReportFixtureAndParticle_s_input, l = e.SolveCollisionCallback.ReportFixtureAndParticle_s_p, u = e.SolveCollisionCallback.ReportFixtureAndParticle_s_v, h = 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 = o, m = a;
if (0 === this.m_system.m_iterationIndex) {
var y = V.MulTXV(_.m_xf0, f, s);
if (i.GetShape().GetType() === t.b2ShapeType.e_circleShape) {
y.SelfSub(_.GetLocalCenter());
O.MulRV(_.m_xf0.q, y, y);
O.MulTRV(_.m_xf.q, y, y);
y.SelfAdd(_.GetLocalCenter());
}
V.MulXV(_.m_xf, y, m.p1);
} else m.p1.Copy(f);
I.AddVMulSV(f, this.m_step.dt, d, m.p2);
m.maxFraction = 1;
if (i.RayCast(p, m, n)) {
var v = p.normal, g = l;
g.x = (1 - p.fraction) * m.p1.x + p.fraction * m.p2.x + c * v.x;
g.y = (1 - p.fraction) * m.p1.y + p.fraction * m.p2.y + c * v.y;
var b = u;
b.x = this.m_step.inv_dt * (g.x - f.x);
b.y = this.m_step.inv_dt * (g.y - f.y);
this.m_system.m_velocityBuffer.data[r].Copy(b);
var C = h;
C.x = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.x - b.x);
C.y = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.y - b.y);
this.m_system.ParticleApplyForce(r, C);
}
};
n.prototype.ReportParticle = function() {
return !1;
};
n.ReportFixtureAndParticle_s_p1 = new I();
n.ReportFixtureAndParticle_s_output = new gt();
n.ReportFixtureAndParticle_s_input = new vt();
n.ReportFixtureAndParticle_s_p = new I();
n.ReportFixtureAndParticle_s_v = new I();
n.ReportFixtureAndParticle_s_f = new I();
return n;
})(En);
e.SolveCollisionCallback = m;
})(t.b2ParticleSystem || (t.b2ParticleSystem = {}));
var Rn = (function() {
function e(t) {
this.m_newFixture = !1;
this.m_locked = !1;
this.m_clearForces = !0;
this.m_contactManager = new Zi();
this.m_bodyList = null;
this.m_jointList = null;
this.m_particleSystemList = null;
this.m_bodyCount = 0;
this.m_jointCount = 0;
this.m_gravity = new I();
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 Ki();
this.m_island = new ln();
this.s_stack = [];
this.m_controllerList = null;
this.m_controllerCount = 0;
this.m_gravity.Copy(t);
}
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) {
void 0 === t && (t = {});
if (this.IsLocked()) throw new Error();
var e = new ii(t, this);
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;
return 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 o = s;
s = s.next;
this.m_contactManager.Destroy(o.contact);
}
t.m_contactList = null;
for (var a = t.m_fixtureList; a; ) {
var c = a;
a = a.m_next;
this.m_destructionListener && this.m_destructionListener.SayGoodbyeFixture(c);
c.DestroyProxies();
c.Destroy();
t.m_fixtureList = a;
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) {
switch (e.type) {
case t.b2JointType.e_distanceJoint:
return new ci(e);

case t.b2JointType.e_mouseJoint:
return new vi(e);

case t.b2JointType.e_prismaticJoint:
return new bi(e);

case t.b2JointType.e_revoluteJoint:
return new Si(e);

case t.b2JointType.e_pulleyJoint:
return new xi(e);

case t.b2JointType.e_gearJoint:
return new di(e);

case t.b2JointType.e_wheelJoint:
return new Ii(e);

case t.b2JointType.e_weldJoint:
return new Mi(e);

case t.b2JointType.e_frictionJoint:
return new _i(e);

case t.b2JointType.e_ropeJoint:
return new wi(e);

case t.b2JointType.e_motorJoint:
return new mi(e);

case t.b2JointType.e_areaJoint:
return new ui(e);
}
throw new Error();
};
e._Joint_Destroy = function() {};
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;
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;
if (!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);
i.m_prev = null;
i.m_next = this.m_particleSystemList;
this.m_particleSystemList && (this.m_particleSystemList.m_prev = i);
this.m_particleSystemList = i;
return 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) {
return null === this.m_particleSystemList ? 1 : hn(this.m_gravity.Length(), (function(t) {
for (var e = i, n = t.GetParticleSystemList(); null !== n; n = n.m_next) e = y(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();
if (this.m_newFixture) {
this.m_contactManager.FindNewContacts();
this.m_newFixture = !1;
}
this.m_locked = !0;
var o = e.Step_s_step;
o.dt = t;
o.velocityIterations = i;
o.positionIterations = n;
o.particleIterations = r;
o.inv_dt = t > 0 ? 1 / t : 0;
o.dtRatio = this.m_inv_dt0 * t;
o.warmStarting = this.m_warmStarting;
var a = e.Step_s_timer.Reset();
this.m_contactManager.Collide();
this.m_profile.collide = a.GetMilliseconds();
if (this.m_stepComplete && o.dt > 0) {
for (var c = e.Step_s_timer.Reset(), l = this.m_particleSystemList; l; l = l.m_next) l.Solve(o);
this.Solve(o);
this.m_profile.solve = c.GetMilliseconds();
}
if (this.m_continuousPhysics && o.dt > 0) {
var u = e.Step_s_timer.Reset();
this.SolveTOI(o);
this.m_profile.solveTOI = u.GetMilliseconds();
}
o.dt > 0 && (this.m_inv_dt0 = o.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 o = r.GetFixtureList(); o; o = o.m_next) if (r.IsActive()) if (r.GetType() === t.b2BodyType.b2_staticBody) {
n.SetRGB(.5, .9, .5);
this.DrawShape(o, n);
} else if (r.GetType() === t.b2BodyType.b2_kinematicBody) {
n.SetRGB(.5, .5, .9);
this.DrawShape(o, n);
} else if (r.IsAwake()) {
n.SetRGB(.9, .7, .7);
this.DrawShape(o, n);
} else {
n.SetRGB(.6, .6, .6);
this.DrawShape(o, n);
} else {
n.SetRGB(.5, .5, .3);
this.DrawShape(o, n);
}
this.m_debugDraw.PopTransform(s);
}
if (i & t.b2DrawFlags.e_particleBit) for (var a = this.m_particleSystemList; a; a = a.m_next) this.DrawParticleSystem(a);
if (i & t.b2DrawFlags.e_jointBit) for (var c = this.m_jointList; c; c = c.m_next) this.DrawJoint(c);
if (i & t.b2DrawFlags.e_aabbBit) {
n.SetRGB(.9, .3, .9);
var l = e.DrawDebugData_s_vs;
for (r = this.m_bodyList; r; r = r.m_next) if (r.IsActive()) for (o = r.GetFixtureList(); o; o = o.m_next) for (var u = 0; u < o.m_proxyCount; ++u) {
var h = o.m_proxies[u].treeNode.aabb;
l[0].Set(h.lowerBound.x, h.lowerBound.y);
l[1].Set(h.upperBound.x, h.lowerBound.y);
l[2].Set(h.upperBound.x, h.upperBound.y);
l[3].Set(h.lowerBound.x, h.upperBound.y);
this.m_debugDraw.DrawPolygon(l, 4, n);
}
}
if (i & t.b2DrawFlags.e_centerOfMassBit) for (r = this.m_bodyList; r; r = r.m_next) {
(s = e.DrawDebugData_s_xf).q.Copy(r.m_xf.q);
s.p.Copy(r.GetWorldCenter());
this.m_debugDraw.DrawTransform(s);
}
if (i & t.b2DrawFlags.e_controllerBit) for (var _ = this.m_controllerList; _; _ = _.m_next) _.Draw(this.m_debugDraw);
}
};
e.prototype.QueryAABB = function(t, e, i) {
this.m_contactManager.m_broadPhase.Query(e, (function(e) {
var n = e.userData.fixture;
return t ? t.ReportFixture(n) : !i || i(n);
}));
if (t instanceof Yi) for (var n = this.m_particleSystemList; n; n = n.m_next) t.ShouldQueryParticleSystem(n) && n.QueryAABB(t, e);
};
e.prototype.QueryAllAABB = function(t, e) {
void 0 === e && (e = []);
this.QueryAABB(null, t, (function(t) {
e.push(t);
return !0;
}));
return e;
};
e.prototype.QueryPointAABB = function(t, e, i) {
this.m_contactManager.m_broadPhase.QueryPoint(e, (function(e) {
var n = e.userData.fixture;
return t ? t.ReportFixture(n) : !i || i(n);
}));
if (t instanceof Yi) for (var n = this.m_particleSystemList; n; n = n.m_next) t.ShouldQueryParticleSystem(n) && n.QueryPointAABB(t, e);
};
e.prototype.QueryAllPointAABB = function(t, e) {
void 0 === e && (e = []);
this.QueryPointAABB(null, t, (function(t) {
e.push(t);
return !0;
}));
return e;
};
e.prototype.QueryFixtureShape = function(t, i, n, r, s) {
var o = e.QueryFixtureShape_s_aabb;
i.ComputeAABB(o, r, n);
this.m_contactManager.m_broadPhase.Query(o, (function(e) {
var o = e.userData, a = o.fixture;
if (wt(i, n, a.GetShape(), o.childIndex, r, a.GetBody().GetTransform())) {
if (t) return t.ReportFixture(a);
if (s) return s(a);
}
return !0;
}));
if (t instanceof Yi) for (var a = this.m_particleSystemList; a; a = a.m_next) t.ShouldQueryParticleSystem(a) && a.QueryAABB(t, o);
};
e.prototype.QueryAllFixtureShape = function(t, e, i, n) {
void 0 === n && (n = []);
this.QueryFixtureShape(null, t, e, i, (function(t) {
n.push(t);
return !0;
}));
return n;
};
e.prototype.QueryFixturePoint = function(t, e, i) {
this.m_contactManager.m_broadPhase.QueryPoint(e, (function(n) {
var r = n.userData.fixture;
if (r.TestPoint(e)) {
if (t) return t.ReportFixture(r);
if (i) return i(r);
}
return !0;
}));
if (t) for (var n = this.m_particleSystemList; n; n = n.m_next) t.ShouldQueryParticleSystem(n) && n.QueryPointAABB(t, e);
};
e.prototype.QueryAllFixturePoint = function(t, e) {
void 0 === e && (e = []);
this.QueryFixturePoint(null, t, (function(t) {
e.push(t);
return !0;
}));
return e;
};
e.prototype.RayCast = function(t, i, n, r) {
var s = e.RayCast_s_input;
s.maxFraction = 1;
s.p1.Copy(i);
s.p2.Copy(n);
this.m_contactManager.m_broadPhase.RayCast(s, (function(s, o) {
var a = o.userData, c = a.fixture, l = a.childIndex, u = e.RayCast_s_output;
if (c.RayCast(u, s, l)) {
var h = u.fraction, _ = e.RayCast_s_point;
_.Set((1 - h) * i.x + h * n.x, (1 - h) * i.y + h * n.y);
if (t) return t.ReportFixture(c, _, u.normal, h);
if (r) return r(c, _, u.normal, h);
}
return s.maxFraction;
}));
if (t) for (var o = this.m_particleSystemList; o; o = o.m_next) t.ShouldQueryParticleSystem(o) && o.RayCast(t, i, n);
};
e.prototype.RayCastOne = function(t, e) {
var i = null, n = 1;
this.RayCast(null, t, e, (function(t, e, r, s) {
if (s < n) {
n = s;
i = t;
}
return n;
}));
return i;
};
e.prototype.RayCastAll = function(t, e, i) {
void 0 === i && (i = []);
this.RayCast(null, t, e, (function(t) {
i.push(t);
return 1;
}));
return i;
};
e.prototype.GetBodyList = function() {
return this.m_bodyList;
};
e.prototype.GetJointList = function() {
return this.m_jointList;
};
e.prototype.GetParticleSystemList = function() {
return this.m_particleSystemList;
};
e.prototype.GetContactList = function() {
return this.m_contactManager.m_contactList;
};
e.prototype.SetAllowSleeping = function(t) {
if (t !== this.m_allowSleep) {
this.m_allowSleep = t;
if (!this.m_allowSleep) for (var e = this.m_bodyList; e; e = e.m_next) e.SetAwake(!0);
}
};
e.prototype.GetAllowSleeping = function() {
return this.m_allowSleep;
};
e.prototype.SetWarmStarting = function(t) {
this.m_warmStarting = t;
};
e.prototype.GetWarmStarting = function() {
return this.m_warmStarting;
};
e.prototype.SetContinuousPhysics = function(t) {
this.m_continuousPhysics = t;
};
e.prototype.GetContinuousPhysics = function() {
return this.m_continuousPhysics;
};
e.prototype.SetSubStepping = function(t) {
this.m_subStepping = t;
};
e.prototype.GetSubStepping = function() {
return this.m_subStepping;
};
e.prototype.GetProxyCount = function() {
return this.m_contactManager.m_broadPhase.GetProxyCount();
};
e.prototype.GetBodyCount = function() {
return this.m_bodyCount;
};
e.prototype.GetJointCount = function() {
return this.m_jointCount;
};
e.prototype.GetContactCount = function() {
return this.m_contactManager.m_contactCount;
};
e.prototype.GetTreeHeight = function() {
return this.m_contactManager.m_broadPhase.GetTreeHeight();
};
e.prototype.GetTreeBalance = function() {
return this.m_contactManager.m_broadPhase.GetTreeBalance();
};
e.prototype.GetTreeQuality = function() {
return this.m_contactManager.m_broadPhase.GetTreeQuality();
};
e.prototype.SetGravity = function(t, e) {
void 0 === e && (e = !0);
if (!I.IsEqualToV(this.m_gravity, t)) {
this.m_gravity.Copy(t);
if (e) for (var i = this.m_bodyList; i; i = i.m_next) i.SetAwake(!0);
}
};
e.prototype.GetGravity = function() {
return this.m_gravity;
};
e.prototype.IsLocked = function() {
return this.m_locked;
};
e.prototype.SetAutoClearForces = function(t) {
this.m_clearForces = t;
};
e.prototype.GetAutoClearForces = function() {
return this.m_clearForces;
};
e.prototype.ShiftOrigin = function(t) {
if (this.IsLocked()) throw new Error();
for (var e = this.m_bodyList; e; e = e.m_next) {
e.m_xf.p.SelfSub(t);
e.m_sweep.c0.SelfSub(t);
e.m_sweep.c.SelfSub(t);
}
for (var i = this.m_jointList; i; i = i.m_next) i.ShiftOrigin(t);
this.m_contactManager.m_broadPhase.ShiftOrigin(t);
};
e.prototype.GetContactManager = function() {
return this.m_contactManager;
};
e.prototype.GetProfile = function() {
return this.m_profile;
};
e.prototype.Dump = function(e) {
if (!this.m_locked) {
e("const g: b2Vec2 = new b2Vec2(%.15f, %.15f);\n", this.m_gravity.x, this.m_gravity.y);
e("this.m_world.SetGravity(g);\n");
e("const bodies: b2Body[] = [];\n");
e("const joints: b2Joint[] = [];\n");
for (var i = 0, n = this.m_bodyList; n; n = n.m_next) {
n.m_islandIndex = i;
n.Dump(e);
++i;
}
i = 0;
for (var r = this.m_jointList; r; r = r.m_next) {
r.m_index = i;
++i;
}
for (r = this.m_jointList; r; r = r.m_next) if (r.m_type !== t.b2JointType.e_gearJoint) {
e("{\n");
r.Dump(e);
e("}\n");
}
for (r = this.m_jointList; r; r = r.m_next) if (r.m_type === t.b2JointType.e_gearJoint) {
e("{\n");
r.Dump(e);
e("}\n");
}
}
};
e.prototype.DrawJoint = function(i) {
if (null !== this.m_debugDraw) {
var n = i.GetBodyA(), r = i.GetBodyB(), s = n.m_xf, o = r.m_xf, a = s.p, c = o.p, l = i.GetAnchorA(e.DrawJoint_s_p1), u = i.GetAnchorB(e.DrawJoint_s_p2), h = e.DrawJoint_s_color.SetRGB(.5, .8, .8);
switch (i.m_type) {
case t.b2JointType.e_distanceJoint:
this.m_debugDraw.DrawSegment(l, u, h);
break;

case t.b2JointType.e_pulleyJoint:
var _ = i, f = _.GetGroundAnchorA(), d = _.GetGroundAnchorB();
this.m_debugDraw.DrawSegment(f, l, h);
this.m_debugDraw.DrawSegment(d, u, h);
this.m_debugDraw.DrawSegment(f, d, h);
break;

case t.b2JointType.e_mouseJoint:
var p = e.DrawJoint_s_c;
p.Set(0, 1, 0);
this.m_debugDraw.DrawPoint(l, 4, p);
this.m_debugDraw.DrawPoint(u, 4, p);
p.Set(.8, .8, .8);
this.m_debugDraw.DrawSegment(l, u, p);
break;

default:
this.m_debugDraw.DrawSegment(a, l, h);
this.m_debugDraw.DrawSegment(l, u, h);
this.m_debugDraw.DrawSegment(c, u, h);
}
}
};
e.prototype.DrawShape = function(i, n) {
if (null !== this.m_debugDraw) {
var r = i.GetShape();
switch (r.m_type) {
case t.b2ShapeType.e_circleShape:
var s = r, o = s.m_p, a = s.m_radius, c = I.UNITX;
this.m_debugDraw.DrawSolidCircle(o, a, c, n);
break;

case t.b2ShapeType.e_edgeShape:
var l = r, u = l.m_vertex1, h = l.m_vertex2;
this.m_debugDraw.DrawSegment(u, h, n);
break;

case t.b2ShapeType.e_chainShape:
var _ = r, f = _.m_count, d = _.m_vertices, p = e.DrawShape_s_ghostColor.SetRGBA(.75 * n.r, .75 * n.g, .75 * n.b, n.a);
u = d[0];
this.m_debugDraw.DrawPoint(u, 4, n);
if (_.m_hasPrevVertex) {
var m = _.m_prevVertex;
this.m_debugDraw.DrawSegment(m, u, p);
this.m_debugDraw.DrawCircle(m, .1, p);
}
for (var y = 1; y < f; ++y) {
h = d[y];
this.m_debugDraw.DrawSegment(u, h, n);
this.m_debugDraw.DrawPoint(h, 4, n);
u = h;
}
if (_.m_hasNextVertex) {
var v = _.m_nextVertex;
this.m_debugDraw.DrawSegment(v, u, p);
this.m_debugDraw.DrawCircle(v, .1, p);
}
break;

case t.b2ShapeType.e_polygonShape:
var g = r, b = g.m_count;
d = g.m_vertices;
this.m_debugDraw.DrawSolidPolygon(d, b, n);
}
}
};
e.prototype.Solve = function(e) {
for (var i = this.m_bodyList; i; i = i.m_next) i.m_xf0.Copy(i.m_xf);
for (var n = this.m_controllerList; n; n = n.m_next) n.Step(e);
this.m_profile.solveInit = 0;
this.m_profile.solveVelocity = 0;
this.m_profile.solvePosition = 0;
var r = this.m_island;
r.Initialize(this.m_bodyCount, this.m_contactManager.m_contactCount, this.m_jointCount, null, this.m_contactManager.m_contactListener);
for (i = this.m_bodyList; i; i = i.m_next) i.m_islandFlag = !1;
for (var s = this.m_contactManager.m_contactList; s; s = s.m_next) s.m_islandFlag = !1;
for (var o = this.m_jointList; o; o = o.m_next) o.m_islandFlag = !1;
for (var a = this.s_stack, c = this.m_bodyList; c; c = c.m_next) if (!c.m_islandFlag && c.IsAwake() && c.IsActive() && c.GetType() !== t.b2BodyType.b2_staticBody) {
r.Clear();
var l = 0;
a[l++] = c;
c.m_islandFlag = !0;
for (;l > 0; ) {
if (!(i = a[--l])) throw new Error();
r.AddBody(i);
i.m_awakeFlag = !0;
if (i.GetType() !== t.b2BodyType.b2_staticBody) {
for (var u = i.m_contactList; u; u = u.next) {
var h = u.contact;
if (!h.m_islandFlag && h.IsEnabled() && h.IsTouching()) {
var _ = h.m_fixtureA.m_isSensor, f = h.m_fixtureB.m_isSensor;
if (!_ && !f) {
r.AddContact(h);
h.m_islandFlag = !0;
if (!(p = u.other)) throw new Error();
if (!p.m_islandFlag) {
a[l++] = p;
p.m_islandFlag = !0;
}
}
}
}
for (var d = i.m_jointList; d; d = d.next) if (!d.joint.m_islandFlag) {
var p;
if ((p = d.other).IsActive()) {
r.AddJoint(d.joint);
d.joint.m_islandFlag = !0;
if (!p.m_islandFlag) {
a[l++] = p;
p.m_islandFlag = !0;
}
}
}
}
}
var m = new Ki();
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; y < r.m_bodyCount; ++y) (i = r.m_bodies[y]).GetType() === t.b2BodyType.b2_staticBody && (i.m_islandFlag = !1);
}
for (y = 0; y < a.length && a[y]; ++y) a[y] = null;
var v = new k();
for (i = this.m_bodyList; i; i = i.m_next) i.m_islandFlag && i.GetType() !== t.b2BodyType.b2_staticBody && i.SynchronizeFixtures();
this.m_contactManager.FindNewContacts();
this.m_profile.broadphase = v.GetMilliseconds();
};
e.prototype.SolveTOI = function(i) {
var r = this.m_island;
r.Initialize(64, 32, 0, null, this.m_contactManager.m_contactListener);
if (this.m_stepComplete) {
for (var s = this.m_bodyList; s; s = s.m_next) {
s.m_islandFlag = !1;
s.m_sweep.alpha0 = 0;
}
for (var o = this.m_contactManager.m_contactList; o; o = o.m_next) {
o.m_toiFlag = !1;
o.m_islandFlag = !1;
o.m_toiCount = 0;
o.m_toi = 1;
}
}
for (;;) {
var a = null, c = 1;
for (o = this.m_contactManager.m_contactList; o; o = o.m_next) if (o.IsEnabled() && !(o.m_toiCount > 8)) {
var l = 1;
if (o.m_toiFlag) l = o.m_toi; else {
var u = o.GetFixtureA(), h = o.GetFixtureB();
if (u.IsSensor() || h.IsSensor()) continue;
var _ = u.GetBody(), f = h.GetBody(), d = _.m_type, p = f.m_type, m = _.IsAwake() && d !== t.b2BodyType.b2_staticBody, v = f.IsAwake() && p !== t.b2BodyType.b2_staticBody;
if (!m && !v) continue;
var g = _.IsBullet() || d !== t.b2BodyType.b2_dynamicBody, b = f.IsBullet() || p !== t.b2BodyType.b2_dynamicBody;
if (!g && !b) continue;
var C = _.m_sweep.alpha0;
if (_.m_sweep.alpha0 < f.m_sweep.alpha0) {
C = f.m_sweep.alpha0;
_.m_sweep.Advance(C);
} else if (f.m_sweep.alpha0 < _.m_sweep.alpha0) {
C = _.m_sweep.alpha0;
f.m_sweep.Advance(C);
}
var x = o.GetChildIndexA(), A = o.GetChildIndexB(), S = e.SolveTOI_s_toi_input;
S.proxyA.SetShape(u.GetShape(), x);
S.proxyB.SetShape(h.GetShape(), A);
S.sweepA.Copy(_.m_sweep);
S.sweepB.Copy(f.m_sweep);
S.tMax = 1;
var T = e.SolveTOI_s_toi_output;
Qt(T, S);
var w = T.t;
l = T.state === t.b2TOIOutputState.e_touching ? y(C + (1 - C) * w, 1) : 1;
o.m_toi = l;
o.m_toiFlag = !0;
}
if (l < c) {
a = o;
c = l;
}
}
if (null === a || 1 - 10 * n < c) {
this.m_stepComplete = !0;
break;
}
var E = a.GetFixtureA(), M = a.GetFixtureB(), B = E.GetBody(), I = M.GetBody(), D = e.SolveTOI_s_backup1.Copy(B.m_sweep), P = e.SolveTOI_s_backup2.Copy(I.m_sweep);
B.Advance(c);
I.Advance(c);
a.Update(this.m_contactManager.m_contactListener);
a.m_toiFlag = !1;
++a.m_toiCount;
if (a.IsEnabled() && a.IsTouching()) {
B.SetAwake(!0);
I.SetAwake(!0);
r.Clear();
r.AddBody(B);
r.AddBody(I);
r.AddContact(a);
B.m_islandFlag = !0;
I.m_islandFlag = !0;
a.m_islandFlag = !0;
for (var R = 0; R < 2; ++R) if ((G = 0 === R ? B : I).m_type === t.b2BodyType.b2_dynamicBody) for (var L = G.m_contactList; L && r.m_bodyCount !== r.m_bodyCapacity && r.m_contactCount !== r.m_contactCapacity; L = L.next) {
var O = L.contact;
if (!O.m_islandFlag) {
var V = L.other;
if (V.m_type !== t.b2BodyType.b2_dynamicBody || G.IsBullet() || V.IsBullet()) {
var N = O.m_fixtureA.m_isSensor, F = O.m_fixtureB.m_isSensor;
if (!N && !F) {
var z = e.SolveTOI_s_backup.Copy(V.m_sweep);
V.m_islandFlag || V.Advance(c);
O.Update(this.m_contactManager.m_contactListener);
if (O.IsEnabled()) if (O.IsTouching()) {
O.m_islandFlag = !0;
r.AddContact(O);
if (!V.m_islandFlag) {
V.m_islandFlag = !0;
V.m_type !== t.b2BodyType.b2_staticBody && V.SetAwake(!0);
r.AddBody(V);
}
} else {
V.m_sweep.Copy(z);
V.SynchronizeTransform();
} else {
V.m_sweep.Copy(z);
V.SynchronizeTransform();
}
}
}
}
}
var k = e.SolveTOI_s_subStep;
k.dt = (1 - c) * i.dt;
k.inv_dt = 1 / k.dt;
k.dtRatio = 1;
k.positionIterations = 20;
k.velocityIterations = i.velocityIterations;
k.particleIterations = i.particleIterations;
k.warmStarting = !1;
r.SolveTOI(k, B.m_islandIndex, I.m_islandIndex);
for (R = 0; R < r.m_bodyCount; ++R) {
var G;
(G = r.m_bodies[R]).m_islandFlag = !1;
if (G.m_type === t.b2BodyType.b2_dynamicBody) {
G.SynchronizeFixtures();
for (L = G.m_contactList; L; L = L.next) {
L.contact.m_toiFlag = !1;
L.contact.m_islandFlag = !1;
}
}
}
this.m_contactManager.FindNewContacts();
if (this.m_subStepping) {
this.m_stepComplete = !1;
break;
}
} else {
a.SetEnabled(!1);
B.m_sweep.Copy(D);
I.m_sweep.Copy(P);
B.SynchronizeTransform();
I.SynchronizeTransform();
}
}
};
e.prototype.AddController = function(t) {
t.m_next = this.m_controllerList;
t.m_prev = null;
this.m_controllerList && (this.m_controllerList.m_prev = t);
this.m_controllerList = t;
++this.m_controllerCount;
return t;
};
e.prototype.RemoveController = function(t) {
t.m_prev && (t.m_prev.m_next = t.m_next);
t.m_next && (t.m_next.m_prev = t.m_prev);
this.m_controllerList === t && (this.m_controllerList = t.m_next);
--this.m_controllerCount;
t.m_prev = null;
t.m_next = null;
return t;
};
e.Step_s_step = new Qi();
e.Step_s_stepTimer = new k();
e.Step_s_timer = new k();
e.DrawDebugData_s_color = new F(0, 0, 0);
e.DrawDebugData_s_vs = I.MakeArray(4);
e.DrawDebugData_s_xf = new V();
e.QueryFixtureShape_s_aabb = new bt();
e.RayCast_s_input = new vt();
e.RayCast_s_output = new gt();
e.RayCast_s_point = new I();
e.DrawJoint_s_p1 = new I();
e.DrawJoint_s_p2 = new I();
e.DrawJoint_s_color = new F(.5, .8, .8);
e.DrawJoint_s_c = new F();
e.DrawShape_s_ghostColor = new F();
e.SolveTOI_s_subStep = new Qi();
e.SolveTOI_s_backup = new N();
e.SolveTOI_s_backup1 = new N();
e.SolveTOI_s_backup2 = new N();
e.SolveTOI_s_toi_input = new kt();
e.SolveTOI_s_toi_output = new Gt();
return e;
})(), Ln = function(t, e) {
this.prevBody = null;
this.nextBody = null;
this.prevController = null;
this.nextController = null;
this.controller = t;
this.body = e;
}, On = (function() {
function t() {
this.m_bodyList = null;
this.m_bodyCount = 0;
this.m_prev = null;
this.m_next = null;
}
t.prototype.GetNext = function() {
return this.m_next;
};
t.prototype.GetPrev = function() {
return this.m_prev;
};
t.prototype.GetBodyList = function() {
return this.m_bodyList;
};
t.prototype.AddBody = function(t) {
var e = new Ln(this, t);
e.nextBody = this.m_bodyList;
e.prevBody = null;
this.m_bodyList && (this.m_bodyList.prevBody = e);
this.m_bodyList = e;
++this.m_bodyCount;
e.nextController = t.m_controllerList;
e.prevController = null;
t.m_controllerList && (t.m_controllerList.prevController = e);
t.m_controllerList = e;
++t.m_controllerCount;
};
t.prototype.RemoveBody = function(t) {
if (this.m_bodyCount <= 0) throw new Error();
for (var e = this.m_bodyList; e && e.body !== t; ) e = e.nextBody;
if (null === e) throw new Error();
e.prevBody && (e.prevBody.nextBody = e.nextBody);
e.nextBody && (e.nextBody.prevBody = e.prevBody);
this.m_bodyList === e && (this.m_bodyList = e.nextBody);
--this.m_bodyCount;
e.nextController && (e.nextController.prevController = e.prevController);
e.prevController && (e.prevController.nextController = e.nextController);
t.m_controllerList === e && (t.m_controllerList = e.nextController);
--t.m_controllerCount;
};
t.prototype.Clear = function() {
for (;this.m_bodyList; ) this.RemoveBody(this.m_bodyList.body);
this.m_bodyCount = 0;
};
return t;
})(), Vn = (function(t) {
Xe(e, t);
function e() {
var e = null !== t && t.apply(this, arguments) || this;
e.normal = new I(0, 1);
e.offset = 0;
e.density = 0;
e.velocity = new I(0, 0);
e.linearDrag = 0;
e.angularDrag = 0;
e.useDensity = !1;
e.useWorldGravity = !0;
e.gravity = new I(0, 0);
return e;
}
e.prototype.Step = function() {
if (this.m_bodyList) {
this.useWorldGravity && this.gravity.Copy(this.m_bodyList.body.GetWorld().GetGravity());
for (var t = this.m_bodyList; t; t = t.nextBody) {
var e = t.body;
if (e.IsAwake()) {
for (var i = new I(), r = new I(), s = 0, o = 0, a = e.GetFixtureList(); a; a = a.m_next) {
var c = new I(), l = a.GetShape().ComputeSubmergedArea(this.normal, this.offset, e.GetTransform(), c);
s += l;
i.x += l * c.x;
i.y += l * c.y;
var u;
o += l * (u = this.useDensity ? a.GetDensity() : 1);
r.x += l * c.x * u;
r.y += l * c.y * u;
}
i.x /= s;
i.y /= s;
r.x /= o;
r.y /= o;
if (!(s < n)) {
var h = this.gravity.Clone().SelfNeg();
h.SelfMul(this.density * s);
e.ApplyForce(h, r);
var _ = e.GetLinearVelocityFromWorldPoint(i, new I());
_.SelfSub(this.velocity);
_.SelfMul(-this.linearDrag * s);
e.ApplyForce(_, i);
e.ApplyTorque(-e.GetInertia() / e.GetMass() * s * e.GetAngularVelocity() * this.angularDrag);
}
}
}
}
};
e.prototype.Draw = function(t) {
var e = 100, i = new I(), n = new I();
i.x = this.normal.x * this.offset + this.normal.y * e;
i.y = this.normal.y * this.offset - this.normal.x * e;
n.x = this.normal.x * this.offset - this.normal.y * e;
n.y = this.normal.y * this.offset + this.normal.x * e;
var r = new F(0, 0, .8);
t.DrawSegment(i, n, r);
};
return e;
})(On), Nn = (function(t) {
Xe(e, t);
function e() {
var e = null !== t && t.apply(this, arguments) || this;
e.A = new I(0, 0);
return e;
}
e.prototype.Step = function(t) {
for (var i = I.MulSV(t.dt, this.A, e.Step_s_dtA), n = this.m_bodyList; n; n = n.nextBody) {
var r = n.body;
r.IsAwake() && r.SetLinearVelocity(I.AddVV(r.GetLinearVelocity(), i, I.s_t0));
}
};
e.prototype.Draw = function() {};
e.Step_s_dtA = new I();
return e;
})(On), Fn = (function(t) {
Xe(e, t);
function e() {
var e = null !== t && t.apply(this, arguments) || this;
e.F = new I(0, 0);
return e;
}
e.prototype.Step = function() {
for (var t = this.m_bodyList; t; t = t.nextBody) {
var e = t.body;
e.IsAwake() && e.ApplyForce(this.F, e.GetWorldCenter());
}
};
e.prototype.Draw = function() {};
return e;
})(On), zn = (function(t) {
Xe(e, t);
function e() {
var e = null !== t && t.apply(this, arguments) || this;
e.G = 1;
e.invSqr = !0;
return e;
}
e.prototype.Step = function() {
if (this.invSqr) for (var t = this.m_bodyList; t; t = t.nextBody) for (var i = (c = t.body).GetWorldCenter(), r = c.GetMass(), s = this.m_bodyList; s && s !== t; s = s.nextBody) {
var o = (l = s.body).GetWorldCenter(), a = l.GetMass();
if (!((_ = (u = o.x - i.x) * u + (h = o.y - i.y) * h) < n)) {
(f = e.Step_s_f.Set(u, h)).SelfMul(this.G / _ / A(_) * r * a);
c.IsAwake() && c.ApplyForce(f, i);
l.IsAwake() && l.ApplyForce(f.SelfMul(-1), o);
}
} else for (t = this.m_bodyList; t; t = t.nextBody) {
var c;
for (i = (c = t.body).GetWorldCenter(), r = c.GetMass(), s = this.m_bodyList; s && s !== t; s = s.nextBody) {
var l, u, h, _;
o = (l = s.body).GetWorldCenter(), a = l.GetMass();
if (!((_ = (u = o.x - i.x) * u + (h = o.y - i.y) * h) < n)) {
var f;
(f = e.Step_s_f.Set(u, h)).SelfMul(this.G / _ * r * a);
c.IsAwake() && c.ApplyForce(f, i);
l.IsAwake() && l.ApplyForce(f.SelfMul(-1), o);
}
}
}
};
e.prototype.Draw = function() {};
e.Step_s_f = new I();
return e;
})(On), kn = (function(t) {
Xe(e, t);
function e() {
var e = null !== t && t.apply(this, arguments) || this;
e.T = new R();
e.maxTimestep = 0;
return e;
}
e.prototype.Step = function(t) {
var i = t.dt;
if (!(i <= n)) {
i > this.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 o = s.GetWorldVector(R.MulMV(this.T, s.GetLocalVector(s.GetLinearVelocity(), I.s_t0), I.s_t1), e.Step_s_damping);
s.SetLinearVelocity(I.AddVV(s.GetLinearVelocity(), I.MulSV(i, o, I.s_t0), I.s_t1));
}
}
}
};
e.prototype.Draw = function() {};
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 / v(t, e) : 0;
};
e.Step_s_damping = new I();
return e;
})(On), Gn = (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 I();
this.m_damping = 0;
this.m_k2 = 1;
this.m_k3 = .1;
}
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 = I.MakeArray(this.m_count);
this.m_p0s = I.MakeArray(this.m_count);
this.m_vs = I.MakeArray(this.m_count);
this.m_ims = p(this.m_count);
for (var e = 0; e < this.m_count; ++e) {
this.m_ps[e].Copy(t.vertices[e]);
this.m_p0s[e].Copy(t.vertices[e]);
this.m_vs[e].SetZero();
var i = t.masses[e];
this.m_ims[e] = i > 0 ? 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; e < n; ++e) {
var s = this.m_ps[e], o = this.m_ps[e + 1];
this.m_Ls[e] = I.DistanceVV(s, o);
}
for (e = 0; e < r; ++e) {
s = this.m_ps[e], o = this.m_ps[e + 1];
var a = this.m_ps[e + 2], c = I.SubVV(o, s, I.s_t0), l = I.SubVV(a, o, I.s_t1), u = I.CrossVV(c, l), h = I.DotVV(c, l);
this.m_as[e] = B(u, h);
}
this.m_gravity.Copy(t.gravity);
this.m_damping = t.damping;
this.m_k2 = t.k2;
this.m_k3 = t.k3;
};
t.prototype.Step = function(t, e) {
if (0 !== t) {
for (var i = Math.exp(-t * this.m_damping), n = 0; n < this.m_count; ++n) {
this.m_p0s[n].Copy(this.m_ps[n]);
this.m_ims[n] > 0 && 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; n < e; ++n) {
this.SolveC2();
this.SolveC3();
this.SolveC2();
}
var r = 1 / t;
for (n = 0; n < this.m_count; ++n) I.MulSV(r, I.SubVV(this.m_ps[n], this.m_p0s[n], I.s_t0), this.m_vs[n]);
}
};
t.prototype.SolveC2 = function() {
for (var e = this.m_count - 1, i = 0; i < e; ++i) {
var n = this.m_ps[i], r = this.m_ps[i + 1], s = I.SubVV(r, n, t.s_d), o = s.Normalize(), a = this.m_ims[i], c = this.m_ims[i + 1];
if (a + c !== 0) {
var l = a / (a + c), u = c / (a + c);
n.SelfMulSub(this.m_k2 * l * (this.m_Ls[i] - o), s);
r.SelfMulAdd(this.m_k2 * u * (this.m_Ls[i] - o), s);
}
}
};
t.prototype.SetAngle = function(t) {
for (var e = this.m_count - 2, i = 0; i < e; ++i) this.m_as[i] = t;
};
t.prototype.SolveC3 = function() {
for (var e = this.m_count - 2, i = 0; i < e; ++i) {
var n = this.m_ps[i], r = this.m_ps[i + 1], o = this.m_ps[i + 2], a = this.m_ims[i], c = this.m_ims[i + 1], l = this.m_ims[i + 2], u = I.SubVV(r, n, t.s_d1), h = I.SubVV(o, r, t.s_d2), _ = u.LengthSquared(), f = h.LengthSquared();
if (_ * f != 0) {
var d = I.CrossVV(u, h), p = I.DotVV(u, h), m = B(d, p), y = I.MulSV(-1 / _, u.SelfSkew(), t.s_Jd1), v = I.MulSV(1 / f, h.SelfSkew(), t.s_Jd2), g = I.NegV(y, t.s_J1), b = I.SubVV(y, v, t.s_J2), C = v, x = a * I.DotVV(g, g) + c * I.DotVV(b, b) + l * I.DotVV(C, C);
if (0 !== x) {
x = 1 / x;
for (var A = m - this.m_as[i]; A > s; ) A = (m -= 2 * s) - this.m_as[i];
for (;A < -s; ) A = (m += 2 * s) - this.m_as[i];
var S = -this.m_k3 * x * A;
n.SelfMulAdd(a * S, g);
r.SelfMulAdd(c * S, b);
o.SelfMulAdd(l * S, C);
}
}
}
};
t.prototype.Draw = function(t) {
for (var e = new F(.4, .5, .7), i = 0; i < this.m_count - 1; ++i) t.DrawSegment(this.m_ps[i], this.m_ps[i + 1], e);
};
t.s_d = new I();
t.s_d1 = new I();
t.s_d2 = new I();
t.s_Jd1 = new I();
t.s_Jd2 = new I();
t.s_J1 = new I();
t.s_J2 = new I();
return t;
})();
t.b2Assert = function(t) {
for (var e = [], i = 1; i < arguments.length; i++) e[i - 1] = arguments[i];
if (!t) throw new (Error.bind.apply(Error, [ void 0 ].concat(e)))();
};
t.b2Maybe = e;
t.b2_maxFloat = i;
t.b2_epsilon = n;
t.b2_epsilon_sq = r;
t.b2_pi = s;
t.b2_maxManifoldPoints = o;
t.b2_maxPolygonVertices = a;
t.b2_aabbExtension = .1;
t.b2_aabbMultiplier = 2;
t.b2_linearSlop = c;
t.b2_angularSlop = l;
t.b2_polygonRadius = u;
t.b2_maxSubSteps = 8;
t.b2_maxTOIContacts = 32;
t.b2_velocityThreshold = 1;
t.b2_maxLinearCorrection = .2;
t.b2_maxAngularCorrection = .13962634015955555;
t.b2_maxTranslation = 2;
t.b2_maxTranslationSquared = 4;
t.b2_maxRotation = 1.570796326795;
t.b2_maxRotationSquared = 2.4674011002726646;
t.b2_baumgarte = .2;
t.b2_toiBaumgarte = .75;
t.b2_invalidParticleIndex = h;
t.b2_maxParticleIndex = 2147483647;
t.b2_particleStride = .75;
t.b2_minParticleWeight = 1;
t.b2_maxParticlePressure = .25;
t.b2_maxParticleForce = .5;
t.b2_maxTriadDistance = 2;
t.b2_maxTriadDistanceSquared = 4;
t.b2_minParticleSystemBufferCapacity = 256;
t.b2_barrierCollisionTime = 2.5;
t.b2_timeToSleep = .5;
t.b2_linearSleepTolerance = .01;
t.b2_angularSleepTolerance = .03490658503988889;
t.b2Alloc = function() {
return null;
};
t.b2Free = function() {};
t.b2Log = function(t) {
for (var e = [], i = 1; i < arguments.length; i++) e[i - 1] = arguments[i];
};
t.b2Version = _;
t.b2_version = f;
t.b2_branch = "master";
t.b2_commit = "fbf51801d80fc389d43dc46524520e89043b6faf";
t.b2ParseInt = function(t) {
return parseInt(t, 10);
};
t.b2ParseUInt = function(t) {
return Math.abs(parseInt(t, 10));
};
t.b2MakeArray = d;
t.b2MakeNullArray = function(t) {
for (var e = [], i = 0; i < t; ++i) e.push(null);
return e;
};
t.b2MakeNumberArray = p;
t.b2_pi_over_180 = .017453292519944444;
t.b2_180_over_pi = 57.29577951307855;
t.b2_two_pi = 6.28318530718;
t.b2Abs = m;
t.b2Min = y;
t.b2Max = v;
t.b2Clamp = g;
t.b2Swap = function(t, e) {
var i = t[0];
t[0] = e[0];
e[0] = i;
};
t.b2IsValid = b;
t.b2Sq = C;
t.b2InvSqrt = x;
t.b2Sqrt = A;
t.b2Pow = S;
t.b2DegToRad = function(t) {
return .017453292519944444 * t;
};
t.b2RadToDeg = function(t) {
return 57.29577951307855 * t;
};
t.b2Cos = T;
t.b2Sin = w;
t.b2Acos = E;
t.b2Asin = M;
t.b2Atan2 = B;
t.b2NextPowerOfTwo = function(t) {
t |= t >> 1 & 2147483647;
t |= t >> 2 & 1073741823;
t |= t >> 4 & 268435455;
return 1 + ((t |= t >> 8 & 16777215) | 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 = I;
t.b2Vec2_zero = D;
t.b2Vec3 = P;
t.b2Mat22 = R;
t.b2Mat33 = L;
t.b2Rot = O;
t.b2Transform = V;
t.b2Sweep = N;
t.b2Color = F;
t.b2Draw = z;
t.b2Timer = k;
t.b2Counter = G;
t.b2GrowableStack = U;
t.b2BlockAllocator = function() {};
t.b2StackAllocator = function() {};
t.b2ContactFeature = _t;
t.b2ContactID = ft;
t.b2ManifoldPoint = dt;
t.b2Manifold = pt;
t.b2WorldManifold = mt;
t.b2GetPointStates = function(e, i, n, r) {
var s;
for (s = 0; s < n.pointCount; ++s) {
var a = n.points[s].id.key;
e[s] = t.b2PointState.b2_removeState;
for (var c = 0, l = r.pointCount; c < l; ++c) if (r.points[c].id.key === a) {
e[s] = t.b2PointState.b2_persistState;
break;
}
}
for (;s < o; ++s) e[s] = t.b2PointState.b2_nullState;
for (s = 0; s < r.pointCount; ++s) {
a = r.points[s].id.key;
i[s] = t.b2PointState.b2_addState;
for (c = 0, l = n.pointCount; c < l; ++c) if (n.points[c].id.key === a) {
i[s] = t.b2PointState.b2_persistState;
break;
}
}
for (;s < o; ++s) i[s] = t.b2PointState.b2_nullState;
};
t.b2ClipVertex = yt;
t.b2RayCastInput = vt;
t.b2RayCastOutput = gt;
t.b2AABB = bt;
t.b2TestOverlapAABB = Ct;
t.b2ClipSegmentToLine = xt;
t.b2TestOverlapShape = wt;
t.b2DistanceProxy = H;
t.b2SimplexCache = j;
t.b2DistanceInput = W;
t.b2DistanceOutput = q;
t.b2ShapeCastInput = function() {
this.proxyA = new H();
this.proxyB = new H();
this.transformA = new V();
this.transformB = new V();
this.translationB = new I();
};
t.b2ShapeCastOutput = function() {
this.point = new I();
this.normal = new I();
this.lambda = 0;
this.iterations = 0;
};
t.b2_gjk_reset = function() {
t.b2_gjkCalls = 0;
t.b2_gjkIters = 0;
t.b2_gjkMaxIters = 0;
};
t.b2SimplexVertex = X;
t.b2Simplex = Y;
t.b2Distance = nt;
t.b2ShapeCast = function(t, e) {
t.iterations = 0;
t.lambda = 1;
t.normal.SetZero();
t.point.SetZero();
var i = e.proxyA, n = e.proxyB, r = v(i.m_radius, u) + v(n.m_radius, u), s = e.transformA, o = e.transformB, a = e.translationB, l = rt.Set(0, 0), h = 0, _ = st;
_.m_count = 0;
for (var f = _.m_vertices, d = i.GetSupport(O.MulTRV(s.q, I.NegV(a, I.s_t1), I.s_t0)), p = V.MulXV(s, i.GetVertex(d), ot), y = n.GetSupport(O.MulTRV(o.q, a, I.s_t0)), g = V.MulXV(o, n.GetVertex(y), at), b = I.SubVV(p, g, ct), C = v(u, r - u), x = .5 * c, A = 0; A < 20 && m(b.Length() - C) > x; ) {
t.iterations += 1;
d = i.GetSupport(O.MulTRV(s.q, I.NegV(b, I.s_t1), I.s_t0));
p = V.MulXV(s, i.GetVertex(d), ot);
y = n.GetSupport(O.MulTRV(o.q, b, I.s_t0));
g = V.MulXV(o, n.GetVertex(y), at);
var S = I.SubVV(p, g, lt);
b.Normalize();
var T = I.DotVV(b, S), w = I.DotVV(b, a);
if (T - C > h * w) {
if (w <= 0) return !1;
if ((h = (T - C) / w) > 1) return !1;
l.Copy(b).SelfNeg();
_.m_count = 0;
}
var E = f[_.m_count];
E.indexA = y;
E.wA.Copy(g).SelfMulAdd(h, a);
E.indexB = d;
E.wB.Copy(p);
E.w.Copy(E.wB).SelfSub(E.wA);
E.a = 1;
_.m_count += 1;
switch (_.m_count) {
case 1:
break;

case 2:
_.Solve2();
break;

case 3:
_.Solve3();
}
if (3 === _.m_count) return !1;
_.GetClosestPoint(b);
++A;
}
var M = ut, B = ht;
_.GetWitnessPoints(M, B);
if (b.LengthSquared() > 0) {
l.Copy(b).SelfNeg();
l.Normalize();
}
t.normal.Copy(l);
t.lambda = h;
t.iterations = A;
return !0;
};
t.b2Pair = It;
t.b2BroadPhase = Dt;
t.b2PairLessThan = Pt;
t.b2TreeNode = Mt;
t.b2DynamicTree = Bt;
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 = kt;
t.b2TOIOutput = Gt;
t.b2SeparationFunction = Ut;
t.b2TimeOfImpact = Qt;
t.b2CollideCircles = ee;
t.b2CollidePolygonAndCircle = se;
t.b2CollidePolygons = Be;
t.b2CollideEdgeAndCircle = Fe;
t.b2CollideEdgeAndPolygon = He;
t.b2MassData = je;
t.b2Shape = We;
t.b2CircleShape = Ye;
t.b2PolygonShape = Je;
t.b2EdgeShape = Ze;
t.b2ChainShape = Ke;
t.b2Filter = Qe;
t.b2FixtureDef = $e;
t.b2FixtureProxy = ti;
t.b2Fixture = ei;
t.b2BodyDef = function() {
this.type = t.b2BodyType.b2_staticBody;
this.position = new I(0, 0);
this.angle = 0;
this.linearVelocity = new I(0, 0);
this.angularVelocity = 0;
this.linearDamping = 0;
this.angularDamping = 0;
this.allowSleep = !0;
this.awake = !0;
this.fixedRotation = !1;
this.bullet = !1;
this.active = !0;
this.userData = null;
this.gravityScale = 1;
};
t.b2Body = ii;
t.b2World = Rn;
t.b2DestructionListener = ji;
t.b2ContactFilter = Wi;
t.b2ContactImpulse = qi;
t.b2ContactListener = Xi;
t.b2QueryCallback = Yi;
t.b2RayCastCallback = Ji;
t.b2Island = ln;
t.b2Profile = Ki;
t.b2TimeStep = Qi;
t.b2Position = $i;
t.b2Velocity = tn;
t.b2SolverData = en;
t.b2ContactManager = Zi;
t.b2MixFriction = Di;
t.b2MixRestitution = Pi;
t.b2ContactEdge = Ri;
t.b2Contact = Li;
t.b2ContactRegister = Ui;
t.b2ContactFactory = Hi;
t.g_blockSolve = !1;
t.b2VelocityConstraintPoint = nn;
t.b2ContactVelocityConstraint = rn;
t.b2ContactPositionConstraint = sn;
t.b2ContactSolverDef = on;
t.b2PositionSolverManifold = an;
t.b2ContactSolver = cn;
t.b2CircleContact = Oi;
t.b2PolygonContact = Vi;
t.b2PolygonAndCircleContact = Ni;
t.b2EdgeAndCircleContact = Fi;
t.b2EdgeAndPolygonContact = zi;
t.b2ChainAndCircleContact = ki;
t.b2ChainAndPolygonContact = Gi;
t.b2Jacobian = ni;
t.b2JointEdge = ri;
t.b2JointDef = si;
t.b2Joint = oi;
t.b2AreaJointDef = li;
t.b2AreaJoint = ui;
t.b2DistanceJointDef = ai;
t.b2DistanceJoint = ci;
t.b2FrictionJointDef = hi;
t.b2FrictionJoint = _i;
t.b2GearJointDef = fi;
t.b2GearJoint = di;
t.b2MotorJointDef = pi;
t.b2MotorJoint = mi;
t.b2MouseJointDef = yi;
t.b2MouseJoint = vi;
t.b2PrismaticJointDef = gi;
t.b2PrismaticJoint = bi;
t.b2_minPulleyLength = 2;
t.b2PulleyJointDef = Ci;
t.b2PulleyJoint = xi;
t.b2RevoluteJointDef = Ai;
t.b2RevoluteJoint = Si;
t.b2RopeJointDef = Ti;
t.b2RopeJoint = wi;
t.b2WeldJointDef = Ei;
t.b2WeldJoint = Mi;
t.b2WheelJointDef = Bi;
t.b2WheelJoint = Ii;
t.b2ControllerEdge = Ln;
t.b2Controller = On;
t.b2BuoyancyController = Vn;
t.b2ConstantAccelController = Nn;
t.b2ConstantForceController = Fn;
t.b2GravityController = zn;
t.b2TensorDampingController = kn;
t.b2ParticleDef = un;
t.b2CalculateParticleIterations = hn;
t.b2ParticleHandle = _n;
t.b2ParticleGroupDef = fn;
t.b2ParticleGroup = dn;
t.b2GrowableBuffer = wn;
t.b2FixtureParticleQueryCallback = En;
t.b2ParticleContact = Mn;
t.b2ParticleBodyContact = Bn;
t.b2ParticlePair = In;
t.b2ParticleTriad = Dn;
t.b2ParticleSystemDef = Pn;
t.b2RopeDef = function() {
this.vertices = [];
this.count = 0;
this.masses = [];
this.gravity = new I(0, 0);
this.damping = .1;
this.k2 = .9;
this.k3 = .1;
};
t.b2Rope = Gn;
Object.defineProperty(t, "__esModule", {
value: !0
});
}, "object" == typeof i && "undefined" != typeof e ? n(i) : "function" == typeof define && define.amd ? define([ "exports" ], n) : n((void 0).box2d = {});
var n;
}), {} ],
399: [ (function(t, e) {
"use strict";
var i = "undefined" == typeof window ? global : window;
i.cc = i.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 = i.cc;
}), {
"./cocos2d": 350,
"./cocos2d/core/predefine": 264,
"./extends": 383,
"./package": void 0,
"./polyfill/array": 401,
"./polyfill/array-buffer": 400,
"./polyfill/misc": 402,
"./polyfill/number": 403,
"./polyfill/object": 404,
"./polyfill/string": 405,
"./polyfill/typescript": 406,
"./predefine": 407
} ],
400: [ (function() {
"use strict";
if (!ArrayBuffer.isView) {
var t = Object.getPrototypeOf(Int8Array);
ArrayBuffer.isView = "function" == typeof t ? function(e) {
return e instanceof t;
} : function(t) {
if ("object" != typeof t) return !1;
var e = t.constructor;
return e === Float64Array || e === Float32Array || e === Uint8Array || e === Uint32Array || e === Int8Array;
};
}
}), {} ],
401: [ (function() {
"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; i < e; i++) {
var n = this[i];
if (t.call(this, n, i, this)) return n;
}
});
Array.prototype.includes || (Array.prototype.includes = function(t) {
return -1 !== this.indexOf(t);
});
}), {} ],
402: [ (function() {
"use strict";
Math.sign || (Math.sign = function(t) {
return 0 == (t = +t) || isNaN(t) ? t : t > 0 ? 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;
});
var t = window.performance || Date, e = Object.create(null);
console.time = function(i) {
e[i] = t.now();
};
console.timeEnd = function(i) {
var n = e[i], r = t.now() - n;
console.log(i + ": " + r + "ms");
};
}), {} ],
403: [ (function() {
"use strict";
Number.parseFloat = Number.parseFloat || parseFloat;
Number.parseInt = Number.parseInt || parseInt;
}), {} ],
404: [ (function() {
"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; n < i.length; ++n) {
var r = i[n];
e[r] = Object.getOwnPropertyDescriptor(t, r);
}
return e;
});
}), {} ],
405: [ (function() {
"use strict";
String.prototype.startsWith || (String.prototype.startsWith = function(t, e) {
e = e || 0;
return this.lastIndexOf(t, e) === e;
});
String.prototype.endsWith || (String.prototype.endsWith = function(t, e) {
("undefined" == typeof e || e > this.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+/, "");
});
}), {} ],
406: [ (function() {
"use strict";
var 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]);
};
window.__extends = function(e, i) {
t(e, i);
function n() {
this.constructor = e;
}
e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n());
};
window.__assign = Object.assign || function(t) {
for (var e, i = 1, n = arguments.length; i < n; i++) {
e = arguments[i];
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
}
return t;
};
window.__rest = function(t, e) {
var i = {};
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
if (null != t && "function" == typeof Object.getOwnPropertySymbols) {
var r = 0;
for (n = Object.getOwnPropertySymbols(t); r < n.length; r++) e.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[r]) && (i[n[r]] = t[n[r]]);
}
return i;
};
window.__decorate = function(t, e, i, n) {
var r, s = arguments.length, o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n); else for (var a = t.length - 1; a >= 0; a--) (r = t[a]) && (o = (s < 3 ? r(o) : s > 3 ? r(e, i, o) : r(e, i)) || o);
return s > 3 && o && Object.defineProperty(e, i, o), o;
};
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 o(t) {
try {
c(n.next(t));
} catch (t) {
s(t);
}
}
function a(t) {
try {
c(n.throw(t));
} catch (t) {
s(t);
}
}
function c(t) {
t.done ? r(t.value) : (e = t.value, e instanceof i ? e : new i(function(t) {
t(e);
})).then(o, a);
var e;
}
c((n = n.apply(t, e || [])).next());
});
};
window.__generator = function(t, e) {
var i, n, r, s, o = {
label: 0,
sent: function() {
if (1 & r[0]) throw r[1];
return r[1];
},
trys: [],
ops: []
};
return s = {
next: a(0),
throw: a(1),
return: a(2)
}, "function" == typeof Symbol && (s[Symbol.iterator] = function() {
return this;
}), s;
function a(t) {
return function(e) {
return c([ t, e ]);
};
}
function c(s) {
if (i) throw new TypeError("Generator is already executing.");
for (;o; ) 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;
(n = 0, r) && (s = [ 2 & s[0], r.value ]);
switch (s[0]) {
case 0:
case 1:
r = s;
break;

case 4:
o.label++;
return {
value: s[1],
done: !1
};

case 5:
o.label++;
n = s[1];
s = [ 0 ];
continue;

case 7:
s = o.ops.pop();
o.trys.pop();
continue;

default:
if (!(r = o.trys, r = r.length > 0 && r[r.length - 1]) && (6 === s[0] || 2 === s[0])) {
o = 0;
continue;
}
if (3 === s[0] && (!r || s[1] > r[0] && s[1] < r[3])) {
o.label = s[1];
break;
}
if (6 === s[0] && o.label < r[1]) {
o.label = r[1];
r = s;
break;
}
if (r && o.label < r[2]) {
o.label = r[2];
o.ops.push(s);
break;
}
r[2] && o.ops.pop();
o.trys.pop();
continue;
}
s = e.call(t, o);
} catch (t) {
s = [ 6, t ];
n = 0;
} finally {
i = r = 0;
}
if (5 & s[0]) throw s[1];
return {
value: s[0] ? s[1] : void 0,
done: !0
};
}
};
window.__exportStar = function(t, e) {
for (var i in t) "default" === i || Object.prototype.hasOwnProperty.call(e, i) || __createBinding(e, t, i);
};
window.__createBinding = Object.create ? function(t, e, i, n) {
void 0 === n && (n = i);
Object.defineProperty(t, n, {
enumerable: !0,
get: function() {
return e[i];
}
});
} : function(t, e, i, n) {
void 0 === n && (n = i);
t[n] = e[i];
};
window.__values = function(t) {
var e = "function" == typeof Symbol && Symbol.iterator, i = e && t[e], n = 0;
if (i) return i.call(t);
if (t && "number" == typeof t.length) return {
next: function() {
t && n >= t.length && (t = void 0);
return {
value: t && t[n++],
done: !t
};
}
};
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
window.__read = function(t, e) {
var i = "function" == typeof Symbol && t[Symbol.iterator];
if (!i) return t;
var n, r, s = i.call(t), o = [];
try {
for (;(void 0 === e || e-- > 0) && !(n = s.next()).done; ) o.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 o;
};
window.__spread = function() {
for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(__read(arguments[e]));
return t;
};
window.__spreadArrays = function() {
for (var t = 0, e = 0, i = arguments.length; e < i; e++) t += arguments[e].length;
var n = Array(t), r = 0;
for (e = 0; e < i; e++) for (var s = arguments[e], o = 0, a = s.length; o < a; o++, 
r++) n[r] = s[o];
return n;
};
window.__await = function(t) {
return this instanceof __await ? (this.v = t, this) : new __await(t);
};
window.__asyncGenerator = function(t, e, i) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var n, r = i.apply(t, e || []), s = [];
return n = {}, o("next"), o("throw"), o("return"), n[Symbol.asyncIterator] = function() {
return this;
}, n;
function o(t) {
r[t] && (n[t] = function(e) {
return new Promise(function(i, n) {
s.push([ t, e, i, n ]) > 1 || a(t, e);
});
});
}
function a(t, e) {
try {
(i = r[t](e)).value instanceof __await ? Promise.resolve(i.value.v).then(c, l) : u(s[0][2], i);
} catch (t) {
u(s[0][3], t);
}
var i;
}
function c(t) {
a("next", t);
}
function l(t) {
a("throw", t);
}
function u(t, e) {
(t(e), s.shift(), s.length) && a(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) {
Object.defineProperty ? Object.defineProperty(t, "raw", {
value: e
}) : t.raw = e;
return t;
};
var e = Object.create ? function(t, e) {
Object.defineProperty(t, "default", {
enumerable: !0,
value: e
});
} : function(t, e) {
t.default = e;
};
window.__importStar = function(t) {
if (t && t.__esModule) return t;
var i = {};
if (null != t) for (var n in t) "default" !== n && Object.prototype.hasOwnProperty.call(t, n) && __createBinding(i, t, n);
e(i, t);
return i;
};
window.__importDefault = function(t) {
return t && t.__esModule ? t : {
default: t
};
};
window.__classPrivateFieldGet = function(t, e) {
if (!e.has(t)) throw new TypeError("attempted to get private field on non-instance");
return e.get(t);
};
window.__classPrivateFieldSet = function(t, e, i) {
if (!e.has(t)) throw new TypeError("attempted to set private field on non-instance");
e.set(t, i);
return i;
};
}), {} ],
407: [ (function() {
"use strict";
var t = "undefined" == typeof window ? global : window;
function e(e, i) {
"undefined" == typeof t[e] && Object.defineProperty(t, e, {
get: function() {
var t;
"CC_WECHATGAMESUB" === e ? t = "cc.sys.platform === cc.sys.WECHAT_GAME_SUB" : "CC_WECHATGAME" === e ? t = "cc.sys.platform === cc.sys.WECHAT_GAME" : "CC_QQPLAY" === e && (t = "cc.sys.platform === cc.sys.QQ_PLAY");
cc.warnID(1400, e, t);
return i;
}
});
}
function i(e) {
return "object" == typeof t[e];
}
(function(e, i) {
"undefined" == typeof t[e] && (t[e] = i);
})("CC_BUILD", !1);
t.CC_BUILD = !0;
t.CC_DEV = !1;
t.CC_DEBUG = !1;
t.CC_JSB = !0;
t.CC_NATIVERENDERER = !0;
t.CC_SUPPORT_JIT = !0;
t.CC_PHYSICS_BUILTIN = !1;
t.CC_PHYSICS_CANNON = !0;
t.CC_EDITOR = !1;
t.CC_PREVIEW = !1;
t.CC_TEST = !1;
t.CC_RUNTIME = !1;
t.CC_JSB = !0;
var n = !(!i("wx") || !wx.getSharedCanvas), r = !(!i("wx") || !wx.getSystemInfoSync && !wx.getSharedCanvas), s = i("bk");
e("CC_WECHATGAMESUB", n);
e("CC_WECHATGAME", r);
e("CC_QQPLAY", s);
t.CocosEngine = cc.ENGINE_VERSION = "2.4.6";
}), {} ]
}, {}, [ 399 ]);