37 0 1MB
// // // // // // // // //
==UserScript== @name REAL WORKING HACK @namespace http://tampermonkey.net/ @version 0.1 @description try to take over the world! @author You @match http://*/* @grant none ==/UserScript==
(function() { 'use strict'; // Your code here... })();// ==UserScript== // @name REAL WORKING HACK // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match http://*/* // @grant none // ==/UserScript== (function() { 'use strict'; // Your code here... })();!function(t) { function e(n) { if (i[n]) return i[n].exports; var s = i[n] = { i: n, l: !1, exports: {} }; return t[n].call(s.exports, s, s.exports, e), s.l = !0, s.exports } var i = {}; e.m = t, e.c = i, e.i = function(t) { return t } , e.d = function(t, i, n) { e.o(t, i) || Object.defineProperty(t, i, { configurable: !1, enumerable: !0, get: n }) } , e.n = function(t) { var i = t && t.__esModule ? function() { return t.default
} : function() { return t } ; return e.d(i, "a", i), i
} , e.o = function(t, e) { return Object.prototype.hasOwnProperty.call(t, e) } , e.p = "", e(e.s = 197) }([function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(7) , o = function(t) { function e() { return t.call(this) || this } return n(e, t), e.prototype.start = function() {} , e.prototype.update = function(t) {} , e.prototype.destroy = function() {} , e }(s.EventEmitter); e.Component = o; var r = function(t) { function e(e, i, n) { var s = t.call(this) || this;
return s._components = [], s.components = {}, s.world = e, s.id = i, s.parentId = n, s } return n(e, t), e.prototype.addComponent = function(t) { if (this._components.push(t), t.id) if (this.components[t.id]) { for (var e = 1; this.components.hasOwnProperty(t.id + "_" + e.toString()); ) e++; this.components[t.id + "_" + e.toString()] = t } else this.components[t.id] = t; return t.entity = this, t.world = this.world, t.start(), t } , e.prototype.update = function(t) { for (var e = 0, i = this._components; e < i.length; e++) { i[e].update(t) } } , e.prototype.destroy = function() { for (; this._components.length > 0; ) this._components.pop().destroy(); this.components = {} } , e.prototype.isLocalPlayer = function() { return this.id === this.world.id } , e }(s.EventEmitter); e.Entity = r } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() {
this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype,
new n)
}
}(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(7) , o = function(t) { function e(e) { var i = t.call(this) || this; return i.world = e, i } return n(e, t), e.prototype.update = function(t) {} , e.prototype.cleanup = function() {} , e.prototype.destroy = function() {} , e }(s.EventEmitter); e.Service = o; var r = function() { function t() { this.services = [] } return t.prototype.registerService = function(t) { this.services.push(t) } , t.prototype.getService = function(t) { for (var e = 0, i = this.services; e < i.length; var n = i[e]; if (n instanceof t) return n } return null } , t.prototype.update = function(t) { for (var e = 0, i = this.services; e < i.length; i[e].update(t) } } , t.prototype.cleanup = function() { for (var t = 0, e = this.services; t < e.length; e[t].cleanup() } } , t.prototype.destroy = function() { for (var t = 0, e = this.services; t < e.length;
e++) {
e++) {
t++) {
t++) {
} , t
e[t].destroy() } this.services = []
}(); e.ServiceManager = r } , function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); !function(t) { var e = function() { function t() {} return t.getName = function() { return "frontend_crash" } , t.getPNG = function() { return i(73) } , t }(); t.FrontendCrash = e; var n = function() { function t() {} return t.getName = function() { return "frontend_discord-logo" } , t.getSVG = function() { return i(74) } , t }(); t.FrontendDiscordLogo = n; var s = function() { function t() {} return t.getName = function() { return "frontend_favicon" } , t.getICO = function() { return i(75) } , t }(); t.FrontendFavicon = s; var o = function() { function t() {} return t.getName = function() { return "frontend_load" }
, t.getGIF = function() { return i(76) } , t }(); t.FrontendLoad = o; var r = function() { function t() {} return t.getName = function() { return "frontend_reddit-logo" } , t.getSVG = function() { return i(77) } , t }(); t.FrontendRedditLogo = r; var a = function() { function t() {} return t.getName = function() { return "images_background_template" } , t.getPNG = function() { return i(78) } , t }(); t.ImagesBackgroundTemplate = a; var h = function() { function t() {} return t.getName = function() { return "images_bannertopleft" } , t.getPNG = function() { return i(79) } , t }(); t.ImagesBannertopleft = h; var l = function() { function t() {} return t.getName = function() { return "images_box" } , t.getPNG = function() { return i(80) } , t }();
t.ImagesBox = l; var c = function() { function t() {} return t.getName = function() { return "images_brownbearhat" } , t.getPNG = function() { return i(81) } , t }(); t.ImagesBrownbearhat = c; var u = function() { function t() {} return t.getName = function() { return "images_brownbearhaticon" } , t.getPNG = function() { return i(82) } , t }(); t.ImagesBrownbearhaticon = u; var d = function() { function t() {} return t.getName = function() { return "images_build" } , t.getPNG = function() { return i(83) } , t }(); t.ImagesBuild = d; var p = function() { function t() {} return t.getName = function() { return "images_builderhat" } , t.getPNG = function() { return i(84) } , t }(); t.ImagesBuilderhat = p; var f = function() { function t() {} return t.getName = function() { return "images_builderhaticon" } ,
t.getPNG = function() { return i(85) } , t
}(); t.ImagesBuilderhaticon = f; var m = function() { function t() {} return t.getName = function() { return "images_carrot" } , t.getPNG = function() { return i(86) } , t }(); t.ImagesCarrot = m; var g = function() { function t() {} return t.getName = function() { return "images_carwolf" } , t.getPNG = function() { return i(87) } , t }(); t.ImagesCarwolf = g; var y = function() { function t() {} return t.getName = function() { return "images_chesshat" } , t.getPNG = function() { return i(88) } , t }(); t.ImagesChesshat = y; var v = function() { function t() {} return t.getName = function() { return "images_chesshaticon" } , t.getPNG = function() { return i(89) } , t }(); t.ImagesChesshaticon = v;
var b = function() { function t() {} return t.getName = function() { return "images_chesshatrot" } , t.getPNG = function() { return i(90) } , t }(); t.ImagesChesshatrot = b; var w = function() { function t() {} return t.getName = function() { return "images_chickenhat" } , t.getPNG = function() { return i(91) } , t }(); t.ImagesChickenhat = w; var x = function() { function t() {} return t.getName = function() { return "images_chickenhaticon" } , t.getPNG = function() { return i(92) } , t }(); t.ImagesChickenhaticon = x; var _ = function() { function t() {} return t.getName = function() { return "images_coin" } , t.getPNG = function() { return i(93) } , t }(); t.ImagesCoin = _; var P = function() { function t() {} return t.getName = function() { return "images_cowboyhat" } , t.getPNG = function() {
} , t
return i(94)
}(); t.ImagesCowboyhat = P; var T = function() { function t() {} return t.getName = function() { return "images_cowboyhaticon" } , t.getPNG = function() { return i(95) } , t }(); t.ImagesCowboyhaticon = T; var C = function() { function t() {} return t.getName = function() { return "images_crown" } , t.getPNG = function() { return i(96) } , t }(); t.ImagesCrown = C; var S = function() { function t() {} return t.getName = function() { return "images_darkdoor" } , t.getPNG = function() { return i(97) } , t }(); t.ImagesDarkdoor = S; var A = function() { function t() {} return t.getName = function() { return "images_darkguard" } , t.getPNG = function() { return i(98) } , t }(); t.ImagesDarkguard = A; var k = function() {
function t() {} return t.getName = function() { return "images_darkstonewall" } , t.getPNG = function() { return i(99) } , t }(); t.ImagesDarkstonewall = k; var E = function() { function t() {} return t.getName = function() { return "images_door" } , t.getPNG = function() { return i(100) } , t }(); t.ImagesDoor = E; var I = function() { function t() {} return t.getName = function() { return "images_druidhat" } , t.getPNG = function() { return i(101) } , t }(); t.ImagesDruidhat = I; var M = function() { function t() {} return t.getName = function() { return "images_druidhaticon" } , t.getPNG = function() { return i(102) } , t }(); t.ImagesDruidhaticon = M; var O = function() { function t() {} return t.getName = function() { return "images_egg" } , t.getPNG = function() { return i(103)
} , t
}(); t.ImagesEgg = O; var B = function() { function t() {} return t.getName = function() { return "images_follower" } , t.getPNG = function() { return i(104) } , t }(); t.ImagesFollower = B; var R = function() { function t() {} return t.getName = function() { return "images_foodcrate" } , t.getPNG = function() { return i(105) } , t }(); t.ImagesFoodcrate = R; var L = function() { function t() {} return t.getName = function() { return "images_foodgenerator" } , t.getPNG = function() { return i(106) } , t }(); t.ImagesFoodgenerator = L; var D = function() { function t() {} return t.getName = function() { return "images_foxhat" } , t.getPNG = function() { return i(107) } , t }(); t.ImagesFoxhat = D; var F = function() { function t() {}
return t.getName = function() { return "images_foxhaticon" } , t.getPNG = function() { return i(108) } , t
}(); t.ImagesFoxhaticon = F; var N = function() { function t() {} return t.getName = function() { return "images_garden" } , t.getPNG = function() { return i(109) } , t }(); t.ImagesGarden = N; var G = function() { function t() {} return t.getName = function() { return "images_gardener" } , t.getPNG = function() { return i(110) } , t }(); t.ImagesGardener = G; var U = function() { function t() {} return t.getName = function() { return "images_guard" } , t.getPNG = function() { return i(111) } , t }(); t.ImagesGuard = U; var W = function() { function t() {} return t.getName = function() { return "images_heartstone" } , t.getPNG = function() { return i(112) }
, t }(); t.ImagesHeartstone = W; var j = function() { function t() {} return t.getName = function() { return "images_hockeyhat" } , t.getPNG = function() { return i(113) } , t }(); t.ImagesHockeyhat = j; var H = function() { function t() {} return t.getName = function() { return "images_hockeyhaticon" } , t.getPNG = function() { return i(114) } , t }(); t.ImagesHockeyhaticon = H; var X = function() { function t() {} return t.getName = function() { return "images_icehat" } , t.getPNG = function() { return i(115) } , t }(); t.ImagesIcehat = X; var q = function() { function t() {} return t.getName = function() { return "images_icehaticon" } , t.getPNG = function() { return i(116) } , t }(); t.ImagesIcehaticon = q; var V = function() { function t() {} return t.getName = function() {
return "images_knight" } , t.getPNG = function() { return i(117) } , t }(); t.ImagesKnight = V; var Y = function() { function t() {} return t.getName = function() { return "images_mannequin" } , t.getPNG = function() { return i(118) } , t }(); t.ImagesMannequin = Y; var z = function() { function t() {} return t.getName = function() { return "images_meat" } , t.getPNG = function() { return i(119) } , t }(); t.ImagesMeat = z; var K = function() { function t() {} return t.getName = function() { return "images_minimapwalker" } , t.getPNG = function() { return i(120) } , t }(); t.ImagesMinimapwalker = K; var J = function() { function t() {} return t.getName = function() { return "images_minimapwinner" } , t.getPNG = function() { return i(121) } ,
t }(); t.ImagesMinimapwinner = J; var Z = function() { function t() {} return t.getName = function() { return "images_pickupbot" } , t.getPNG = function() { return i(122) } , t }(); t.ImagesPickupbot = Z; var Q = function() { function t() {} return t.getName = function() { return "images_portal" } , t.getPNG = function() { return i(123) } , t }(); t.ImagesPortal = Q; var $ = function() { function t() {} return t.getName = function() { return "images_rideablebear" } , t.getPNG = function() { return i(124) } , t }(); t.ImagesRideablebear = $; var tt = function() { function t() {} return t.getName = function() { return "images_soccerball" } , t.getPNG = function() { return i(125) } , t }(); t.ImagesSoccerball = tt; var et = function() { function t() {} return t.getName = function() { return "images_sociallogo"
} , t.getPNG = function() { return i(126) } , t
}(); t.ImagesSociallogo = et; var it = function() { function t() {} return t.getName = function() { return "images_soul" } , t.getPNG = function() { return i(127) } , t }(); t.ImagesSoul = it; var nt = function() { function t() {} return t.getName = function() { return "images_stonecrate" } , t.getPNG = function() { return i(128) } , t }(); t.ImagesStonecrate = nt; var st = function() { function t() {} return t.getName = function() { return "images_stonegenerator" } , t.getPNG = function() { return i(129) } , t }(); t.ImagesStonegenerator = st; var ot = function() { function t() {} return t.getName = function() { return "images_stonewall" } , t.getPNG = function() { return i(130) } , t
}(); t.ImagesStonewall = ot; var rt = function() { function t() {} return t.getName = function() { return "images_tankhat" } , t.getPNG = function() { return i(131) } , t }(); t.ImagesTankhat = rt; var at = function() { function t() {} return t.getName = function() { return "images_tankhaticon" } , t.getPNG = function() { return i(132) } , t }(); t.ImagesTankhaticon = at; var ht = function() { function t() {} return t.getName = function() { return "images_team" } , t.getPNG = function() { return i(133) } , t }(); t.ImagesTeam = ht; var lt = function() { function t() {} return t.getName = function() { return "images_tower" } , t.getPNG = function() { return i(134) } , t }(); t.ImagesTower = lt; var ct = function() { function t() {} return t.getName = function() { return "images_unmount" }
, t.getPNG = function() { return i(135) } , t }(); t.ImagesUnmount = ct; var ut = function() { function t() {} return t.getName = function() { return "images_vikinghat" } , t.getPNG = function() { return i(136) } , t }(); t.ImagesVikinghat = ut; var dt = function() { function t() {} return t.getName = function() { return "images_vikinghaticon" } , t.getPNG = function() { return i(137) } , t }(); t.ImagesVikinghaticon = dt; var pt = function() { function t() {} return t.getName = function() { return "images_whitebearhat" } , t.getPNG = function() { return i(138) } , t }(); t.ImagesWhitebearhat = pt; var ft = function() { function t() {} return t.getName = function() { return "images_whitebearhaticon" } , t.getPNG = function() { return i(139) } , t }();
t.ImagesWhitebearhaticon = ft; var mt = function() { function t() {} return t.getName = function() { return "images_winterfloor" } , t.getPNG = function() { return i(140) } , t }(); t.ImagesWinterfloor = mt; var gt = function() { function t() {} return t.getName = function() { return "images_winterstonegenerator" } , t.getPNG = function() { return i(141) } , t }(); t.ImagesWinterstonegenerator = gt; var yt = function() { function t() {} return t.getName = function() { return "images_wintertower" } , t.getPNG = function() { return i(142) } , t }(); t.ImagesWintertower = yt; var vt = function() { function t() {} return t.getName = function() { return "images_winterwall" } , t.getPNG = function() { return i(143) } , t }(); t.ImagesWinterwall = vt; var bt = function() { function t() {} return t.getName = function() { return "images_winterwoodgenerator" } ,
t.getPNG = function() { return i(144) } , t
}(); t.ImagesWinterwoodgenerator = bt; var wt = function() { function t() {} return t.getName = function() { return "images_woodcrate" } , t.getPNG = function() { return i(145) } , t }(); t.ImagesWoodcrate = wt; var xt = function() { function t() {} return t.getName = function() { return "images_woodgenerator" } , t.getPNG = function() { return i(146) } , t }(); t.ImagesWoodgenerator = xt; var _t = function() { function t() {} return t.getName = function() { return "images_woodspikes" } , t.getPNG = function() { return i(147) } , t }(); t.ImagesWoodspikes = _t; var Pt = function() { function t() {} return t.getName = function() { return "images_woodwall" } , t.getPNG = function() { return i(148) } , t }(); t.ImagesWoodwall = Pt
}(e.Images || (e.Images = {})); !function(t) { var e; !function(t) { t[t.Hit1 = "hit1.png"] = "Hit1", t[t.Hit2 = "hit2.png"] = "Hit2", t[t.Hit3 = "hit3.png"] = "Hit3", t[t.Hit4 = "hit4.png"] = "Hit4", t[t.Hit5 = "hit5.png"] = "Hit5", t[t.Hit6 = "hit6.png"] = "Hit6", t[t.Hit7 = "hit7.png"] = "Hit7", t[t.Hit8 = "hit8.png"] = "Hit8", t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8" }(e || (e = {})); var n = function() { function t() {} return t.getName = function() { return "atlases_bear" } , t.getJSONHash = function() { return i(38) } , t.getPNG = function() { return i(39) } , t }(); n.Frames = e, t.AtlasesBear = n; var s; !function(t) { t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8" }(s || (s = {})); var o = function() { function t() {} return t.getName = function() { return "atlases_carpig" } , t.getJSONHash = function() { return i(40) }
, t.getPNG = function() { return i(41) } , t }(); o.Frames = s, t.AtlasesCarpig = o; var r; !function(t) { t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8" }(r || (r = {})); var a = function() { function t() {} return t.getName = function() { return "atlases_carwolf" } , t.getJSONHash = function() { return i(42) } , t.getPNG = function() { return i(43) } , t }(); a.Frames = r, t.AtlasesCarwolf = a; var h; !function(t) { t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8" }(h || (h = {})); var l = function() { function t() {} return t.getName = function() { return "atlases_chicken" } , t.getJSONHash = function() { return i(44) } ,
t.getPNG = function() { return i(45) } , t
}(); l.Frames = h, t.AtlasesChicken = l; var c; !function(t) { t[t.DoorClose = "door_close.png"] = "DoorClose", t[t.DoorOpen = "door_open.png"] = "DoorOpen" }(c || (c = {})); var u = function() { function t() {} return t.getName = function() { return "atlases_darkdoor" } , t.getJSONHash = function() { return i(46) } , t.getPNG = function() { return i(47) } , t }(); u.Frames = c, t.AtlasesDarkdoor = u; var d; !function(t) { t[t.Hit1 = "hit1.png"] = "Hit1", t[t.Hit2 = "hit2.png"] = "Hit2", t[t.Hit3 = "hit3.png"] = "Hit3", t[t.Hit4 = "hit4.png"] = "Hit4", t[t.Hit5 = "hit5.png"] = "Hit5", t[t.Hit6 = "hit6.png"] = "Hit6", t[t.Hit7 = "hit7.png"] = "Hit7", t[t.Hit8 = "hit8.png"] = "Hit8", t[t.Hit9 = "hit9.png"] = "Hit9", t[t.Hit10 = "hit10.png"] = "Hit10", t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8", t[t.Walk9 = "walk9.png"] = "Walk9", t[t.Walk10 = "walk10.png"] = "Walk10", t[t.Walk11 = "walk11.png"] = "Walk11", t[t.Walk12 = "walk12.png"] = "Walk12", t[t.Walk13 = "walk13.png"] = "Walk13", t[t.Walk14 = "walk14.png"] = "Walk14", t[t.Walk15 = "walk15.png"] = "Walk15", t[t.Walk16 = "walk16.png"] = "Walk16"
}(d || (d = {})); var p = function() { function t() {} return t.getName = function() { return "atlases_darkguard" } , t.getJSONHash = function() { return i(48) } , t.getPNG = function() { return i(49) } , t }(); p.Frames = d, t.AtlasesDarkguard = p; var f; !function(t) { t[t.DoorClose = "door_close.png"] = "DoorClose", t[t.DoorOpen = "door_open.png"] = "DoorOpen" }(f || (f = {})); var m = function() { function t() {} return t.getName = function() { return "atlases_door" } , t.getJSONHash = function() { return i(50) } , t.getPNG = function() { return i(51) } , t }(); m.Frames = f, t.AtlasesDoor = m; var g; !function(t) { t[t.Hit1 = "hit1.png"] = "Hit1", t[t.Hit2 = "hit2.png"] = "Hit2", t[t.Hit3 = "hit3.png"] = "Hit3", t[t.Hit4 = "hit4.png"] = "Hit4", t[t.Hit5 = "hit5.png"] = "Hit5", t[t.Hit6 = "hit6.png"] = "Hit6", t[t.Hit7 = "hit7.png"] = "Hit7", t[t.Hit8 = "hit8.png"] = "Hit8", t[t.Hit9 = "hit9.png"] = "Hit9", t[t.Hit10 = "hit10.png"] = "Hit10", t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5",
t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8", t[t.Walk9 = "walk9.png"] = "Walk9", t[t.Walk10 = "walk10.png"] = "Walk10", t[t.Walk11 = "walk11.png"] = "Walk11", t[t.Walk12 = "walk12.png"] = "Walk12", t[t.Walk13 = "walk13.png"] = "Walk13", t[t.Walk14 = "walk14.png"] = "Walk14", t[t.Walk15 = "walk15.png"] = "Walk15", t[t.Walk16 = "walk16.png"] = "Walk16" }(g || (g = {})); var y = function() { function t() {} return t.getName = function() { return "atlases_follower" } , t.getJSONHash = function() { return i(52) } , t.getPNG = function() { return i(53) } , t }(); y.Frames = g, t.AtlasesFollower = y; var v; !function(t) { t[t.Hit1 = "hit1.png"] = "Hit1", t[t.Hit2 = "hit2.png"] = "Hit2", t[t.Hit3 = "hit3.png"] = "Hit3", t[t.Hit4 = "hit4.png"] = "Hit4", t[t.Hit5 = "hit5.png"] = "Hit5", t[t.Hit6 = "hit6.png"] = "Hit6", t[t.Hit7 = "hit7.png"] = "Hit7", t[t.Hit8 = "hit8.png"] = "Hit8", t[t.Hit9 = "hit9.png"] = "Hit9", t[t.Hit10 = "hit10.png"] = "Hit10", t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8", t[t.Walk9 = "walk9.png"] = "Walk9", t[t.Walk10 = "walk10.png"] = "Walk10", t[t.Walk11 = "walk11.png"] = "Walk11", t[t.Walk12 = "walk12.png"] = "Walk12", t[t.Walk13 = "walk13.png"] = "Walk13", t[t.Walk14 = "walk14.png"] = "Walk14", t[t.Walk15 = "walk15.png"] = "Walk15", t[t.Walk16 = "walk16.png"] = "Walk16" }(v || (v = {}));
var b = function() { function t() {} return t.getName = function() { return "atlases_gardener" } , t.getJSONHash = function() { return i(54) } , t.getPNG = function() { return i(55) } , t }(); b.Frames = v, t.AtlasesGardener = b; var w; !function(t) { t[t.Hit1 = "hit1.png"] = "Hit1", t[t.Hit2 = "hit2.png"] = "Hit2", t[t.Hit3 = "hit3.png"] = "Hit3", t[t.Hit4 = "hit4.png"] = "Hit4", t[t.Hit5 = "hit5.png"] = "Hit5", t[t.Hit6 = "hit6.png"] = "Hit6", t[t.Hit7 = "hit7.png"] = "Hit7", t[t.Hit8 = "hit8.png"] = "Hit8", t[t.Hit9 = "hit9.png"] = "Hit9", t[t.Hit10 = "hit10.png"] = "Hit10", t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8", t[t.Walk9 = "walk9.png"] = "Walk9", t[t.Walk10 = "walk10.png"] = "Walk10", t[t.Walk11 = "walk11.png"] = "Walk11", t[t.Walk12 = "walk12.png"] = "Walk12", t[t.Walk13 = "walk13.png"] = "Walk13", t[t.Walk14 = "walk14.png"] = "Walk14", t[t.Walk15 = "walk15.png"] = "Walk15", t[t.Walk16 = "walk16.png"] = "Walk16" }(w || (w = {})); var x = function() { function t() {} return t.getName = function() { return "atlases_guard" } , t.getJSONHash = function() { return i(56) } , t.getPNG = function() { return i(57)
} , t
}(); x.Frames = w, t.AtlasesGuard = x; var _; !function(t) { t[t.Hit1 = "hit1.png"] = "Hit1", t[t.Hit2 = "hit2.png"] = "Hit2", t[t.Hit3 = "hit3.png"] = "Hit3", t[t.Hit4 = "hit4.png"] = "Hit4", t[t.Hit5 = "hit5.png"] = "Hit5", t[t.Hit6 = "hit6.png"] = "Hit6", t[t.Hit7 = "hit7.png"] = "Hit7", t[t.Hit8 = "hit8.png"] = "Hit8", t[t.Hit9 = "hit9.png"] = "Hit9", t[t.Hit10 = "hit10.png"] = "Hit10", t[t.Onpig = "onpig.png"] = "Onpig", t[t.Pighit1 = "pighit1.png"] = "Pighit1", t[t.Pighit2 = "pighit2.png"] = "Pighit2", t[t.Pighit3 = "pighit3.png"] = "Pighit3", t[t.Pighit4 = "pighit4.png"] = "Pighit4", t[t.Pighit5 = "pighit5.png"] = "Pighit5", t[t.Pighit6 = "pighit6.png"] = "Pighit6", t[t.Pighit7 = "pighit7.png"] = "Pighit7", t[t.Pighit8 = "pighit8.png"] = "Pighit8", t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8", t[t.Walk9 = "walk9.png"] = "Walk9", t[t.Walk10 = "walk10.png"] = "Walk10", t[t.Walk11 = "walk11.png"] = "Walk11", t[t.Walk12 = "walk12.png"] = "Walk12", t[t.Walk13 = "walk13.png"] = "Walk13", t[t.Walk14 = "walk14.png"] = "Walk14", t[t.Walk15 = "walk15.png"] = "Walk15", t[t.Walk16 = "walk16.png"] = "Walk16" }(_ || (_ = {})); var P = function() { function t() {} return t.getName = function() { return "atlases_knight" } , t.getJSONHash = function() { return i(58) } , t.getPNG = function() { return i(59) } , t
}(); P.Frames = _, t.AtlasesKnight = P; var T; !function(t) { t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8", t[t.Walk9 = "walk9.png"] = "Walk9", t[t.Walk10 = "walk10.png"] = "Walk10", t[t.Walk11 = "walk11.png"] = "Walk11", t[t.Walk12 = "walk12.png"] = "Walk12", t[t.Walk13 = "walk13.png"] = "Walk13", t[t.Walk14 = "walk14.png"] = "Walk14", t[t.Walk15 = "walk15.png"] = "Walk15", t[t.Walk16 = "walk16.png"] = "Walk16" }(T || (T = {})); var C = function() { function t() {} return t.getName = function() { return "atlases_pickupbot" } , t.getJSONHash = function() { return i(60) } , t.getPNG = function() { return i(61) } , t }(); C.Frames = T, t.AtlasesPickupbot = C; var S; !function(t) { t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8" }(S || (S = {})); var A = function() { function t() {} return t.getName = function() { return "atlases_pig" } , t.getJSONHash = function() { return i(62)
} , t.getPNG = function() { return i(63) } , t
}(); A.Frames = S, t.AtlasesPig = A; var k; !function(t) { t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8" }(k || (k = {})); var E = function() { function t() {} return t.getName = function() { return "atlases_rideablebear" } , t.getJSONHash = function() { return i(64) } , t.getPNG = function() { return i(65) } , t }(); E.Frames = k, t.AtlasesRideablebear = E; var I; !function(t) { t[t.Hit1 = "hit1.png"] = "Hit1", t[t.Hit2 = "hit2.png"] = "Hit2", t[t.Hit3 = "hit3.png"] = "Hit3", t[t.Hit4 = "hit4.png"] = "Hit4", t[t.Hit5 = "hit5.png"] = "Hit5", t[t.Hit6 = "hit6.png"] = "Hit6", t[t.Hit7 = "hit7.png"] = "Hit7", t[t.Hit8 = "hit8.png"] = "Hit8", t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8" }(I || (I = {})); var M = function() {
function t() {} return t.getName = function() { return "atlases_whitebear" } , t.getJSONHash = function() { return i(66) } , t.getPNG = function() { return i(67) } , t }(); M.Frames = I, t.AtlasesWhitebear = M; var O; !function(t) { t[t.Hit1 = "hit1.png"] = "Hit1", t[t.Hit2 = "hit2.png"] = "Hit2", t[t.Hit3 = "hit3.png"] = "Hit3", t[t.Hit4 = "hit4.png"] = "Hit4", t[t.Hit5 = "hit5.png"] = "Hit5", t[t.Hit6 = "hit6.png"] = "Hit6", t[t.Hit7 = "hit7.png"] = "Hit7", t[t.Hit8 = "hit8.png"] = "Hit8", t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8", t[t.Walk9 = "walk9.png"] = "Walk9", t[t.Walk10 = "walk10.png"] = "Walk10", t[t.Walk11 = "walk11.png"] = "Walk11", t[t.Walk12 = "walk12.png"] = "Walk12", t[t.Walk13 = "walk13.png"] = "Walk13", t[t.Walk14 = "walk14.png"] = "Walk14", t[t.Walk15 = "walk15.png"] = "Walk15", t[t.Walk16 = "walk16.png"] = "Walk16" }(O || (O = {})); var B = function() { function t() {} return t.getName = function() { return "atlases_whitewalker" } , t.getJSONHash = function() { return i(68) } , t.getPNG = function() { return i(69) } , t
}(); B.Frames = O, t.AtlasesWhitewalker = B; var R; !function(t) { t[t.Hit1 = "hit1.png"] = "Hit1", t[t.Hit2 = "hit2.png"] = "Hit2", t[t.Hit3 = "hit3.png"] = "Hit3", t[t.Hit4 = "hit4.png"] = "Hit4", t[t.Hit5 = "hit5.png"] = "Hit5", t[t.Hit6 = "hit6.png"] = "Hit6", t[t.Hit7 = "hit7.png"] = "Hit7", t[t.Hit8 = "hit8.png"] = "Hit8", t[t.Walk1 = "walk1.png"] = "Walk1", t[t.Walk2 = "walk2.png"] = "Walk2", t[t.Walk3 = "walk3.png"] = "Walk3", t[t.Walk4 = "walk4.png"] = "Walk4", t[t.Walk5 = "walk5.png"] = "Walk5", t[t.Walk6 = "walk6.png"] = "Walk6", t[t.Walk7 = "walk7.png"] = "Walk7", t[t.Walk8 = "walk8.png"] = "Walk8" }(R || (R = {})); var L = function() { function t() {} return t.getName = function() { return "atlases_wolf" } , t.getJSONHash = function() { return i(70) } , t.getPNG = function() { return i(71) } , t }(); L.Frames = R, t.AtlasesWolf = L; var D; D || (D = {}); var F = function() { function t() {} return t.getName = function() { return "map_map" } , t.getJSONHash = function() { return i(149) } , t.getPNG = function() { return i(150) } , t }(); F.Frames = D,
t.MapMap = F }(e.Atlases || (e.Atlases = {})); !function(t) { var e = function() { function t() {} return t.getName = function() { return "whoosh_1" } , t.getWAV = function() { return i(151) } , t }(); t.SfxWhoosh1 = e }(e.Audio || (e.Audio = {})); !function(t) { !function() { function t() {} }() }(e.Audiosprites || (e.Audiosprites = {})); !function(t) { t.RobotoMono = "Roboto Mono" }(e.GoogleWebFonts || (e.GoogleWebFonts = {})); !function(t) { !function() { function t() {} }() }(e.CustomWebFonts || (e.CustomWebFonts = {})); !function(t) { !function() { function t() {} }() }(e.BitmapFonts || (e.BitmapFonts = {})); !function(t) { !function() { function t() {} }() }(e.JSON || (e.JSON = {})); !function(t) { !function() { function t() {} }() }(e.XML || (e.XML = {})); !function(t) { !function() { function t() {} }() }(e.Text || (e.Text = {})); !function(t) { !function() { function t() {} }() }(e.Scripts || (e.Scripts = {})); !function(t) { !function() { function t() {} }()
}(e.Shaders || (e.Shaders = {})); !function(t) { var e = function() { function t() {} return t.getName = function() { return "style" } , t.getCSS = function() { return i(72) } , t }(); t.CssStyle = e }(e.Misc || (e.Misc = {})) } , function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n = i(18); !function(t) { function e(t) { return h[l[t]] } function s(t) { return l[h[t]] } function o(t) { var e = t.toLowerCase(); return "food" === e ? c.Food : "wood" === e ? c.Wood : "stone" === e ? c.Stone : "gold" === e ? c.Gold : "soul" === e ? c.Soul : c.Food } function r(e) { if (e.length > 0) { var i = e[0] , n = u[i]; if (null != n) { var s = e.slice(1, e.length) , o = void 0; if (p.hasOwnProperty(n) ? o = p[n] : (o = t.ProtobufRoot.lookupType(n), p[n] = o), null != o) return new d(i,o.decode(s)) } } return null } function a(e, i) { var n = u[e] , s = t.ProtobufRoot.lookupType(n) , o = s.encode(i).finish() , r = new Uint8Array(o.length + 1); return r[0] = e, r.set(o, 1), r
} t.ProtobufRoot = n.Root.fromJSON(i(36)); var h; !function(t) { t[t.Spectator = 0] = "Spectator", t[t.Player = 1] = "Player", t[t.WoodGenerator = 2] = "WoodGenerator", t[t.StoneGenerator = 3] = "StoneGenerator", t[t.Pig = 4] = "Pig", t[t.Wolf = 5] = "Wolf", t[t.Chicken = 6] = "Chicken", t[t.Bear = 7] = "Bear", t[t.RideablePig = 8] = "RideablePig", t[t.RideableWolf = 9] = "RideableWolf", t[t.WoodBlock = 10] = "WoodBlock", t[t.StoneBlock = 11] = "StoneBlock", t[t.Door = 12] = "Door", t[t.FoodCrate = 13] = "FoodCrate", t[t.WoodCrate = 14] = "WoodCrate", t[t.StoneCrate = 15] = "StoneCrate", t[t.Tower = 16] = "Tower", t[t.Mannequin = 17] = "Mannequin", t[t.Heartstone = 18] = "Heartstone", t[t.Garden = 19] = "Garden", t[t.PigSpawner = 20] = "PigSpawner", t[t.ChickenSpawner = 21] = "ChickenSpawner", t[t.WolfSpawner = 22] = "WolfSpawner", t[t.BearSpawner = 23] = "BearSpawner", t[t.EggPickup = 24] = "EggPickup", t[t.PigMeatPickup = 25] = "PigMeatPickup", t[t.BearMeatPickup = 26] = "BearMeatPickup", t[t.CarrotPickup = 27] = "CarrotPickup", t[t.BoxPickup = 28] = "BoxPickup", t[t.FollowerBot = 29] = "FollowerBot", t[t.GuardBot = 30] = "GuardBot", t[t.FarmerBot = 31] = "FarmerBot", t[t.GardenBot = 32] = "GardenBot", t[t.WhiteBear = 33] = "WhiteBear", t[t.WinterWoodGenerator = 34] = "WinterWoodGenerator", t[t.WinterStoneGenerator = 35] = "WinterStoneGenerator", t[t.WhiteBearSpawner = 36] = "WhiteBearSpawner", t[t.SoccerBall = 37] = "SoccerBall", t[t.FireballBullet = 38] = "FireballBullet", t[t.NightmareBoss = 39] = "NightmareBoss", t[t.WhiteWalker = 40] = "WhiteWalker", t[t.WhiteWalkerSpawner = 41] = "WhiteWalkerSpawner", t[t.WinterWall = 42] = "WinterWall", t[t.WinterFloor = 43] = "WinterFloor", t[t.WinterTower = 44] = "WinterTower", t[t.WhiteBearHat = 45] = "WhiteBearHat", t[t.BrownBearHat = 46] = "BrownBearHat", t[t.ChessHat = 47] = "ChessHat", t[t.CowboyHat = 48] = "CowboyHat", t[t.HiddenHat = 49] = "HiddenHat", t[t.CatHat = 50] = "CatHat", t[t.CoinPickup = 51] = "CoinPickup", t[t.ChickenHat = 52] = "ChickenHat", t[t.WoodSpikes = 53] = "WoodSpikes", t[t.Portal = 54] = "Portal",
t[t.BuilderHat = 55] = "BuilderHat", t[t.FoxHat = 56] = "FoxHat", t[t.VikingHat = 57] = "VikingHat", t[t.HockeyHat = 58] = "HockeyHat", t[t.SoulPickup = 59] = "SoulPickup", t[t.SoulCrate = 60] = "SoulCrate", t[t.DarkStoneBlock = 61] = "DarkStoneBlock", t[t.DarkDoor = 62] = "DarkDoor", t[t.RideableBear = 63] = "RideableBear", t[t.DarkGuardBot = 64] = "DarkGuardBot", t[t.TankHat = 65] = "TankHat", t[t.DruidHat = 66] = "DruidHat", t[t.IceHat = 67] = "IceHat" }(h = t.EntityType || (t.EntityType = {})); !function(t) { t[t.WhiteBearHat = 0] = "WhiteBearHat", t[t.BrownBearHat = 1] = "BrownBearHat", t[t.ChessHat = 2] = "ChessHat", t[t.CowboyHat = 3] = "CowboyHat", t[t.HiddenHat = 4] = "HiddenHat", t[t.CatHat = 5] = "CatHat", t[t.ChickenHat = 6] = "ChickenHat", t[t.BuilderHat = 7] = "BuilderHat", t[t.FoxHat = 8] = "FoxHat", t[t.HockeyHat = 9] = "HockeyHat", t[t.VikingHat = 10] = "VikingHat", t[t.TankHat = 11] = "TankHat", t[t.DruidHat = 12] = "DruidHat", t[t.IceHat = 13] = "IceHat" }(t.HatType || (t.HatType = {})); var l; !function(t) { t[t.WoodBlock = 0] = "WoodBlock", t[t.StoneBlock = 1] = "StoneBlock", t[t.Door = 2] = "Door", t[t.FarmerBot = 3] = "FarmerBot", t[t.GuardBot = 4] = "GuardBot", t[t.FollowerBot = 5] = "FollowerBot", t[t.Garden = 6] = "Garden", t[t.Heartstone = 7] = "Heartstone", t[t.Tower = 8] = "Tower", t[t.FoodCrate = 9] = "FoodCrate", t[t.WoodCrate = 10] = "WoodCrate", t[t.StoneCrate = 11] = "StoneCrate", t[t.Mannequin = 12] = "Mannequin", t[t.RideableWolf = 13] = "RideableWolf", t[t.GardenBot = 14] = "GardenBot", t[t.SoccerBall = 15] = "SoccerBall", t[t.WoodSpikes = 16] = "WoodSpikes", t[t.Portal = 17] = "Portal", t[t.SoulCrate = 18] = "SoulCrate", t[t.DarkStoneBlock = 19] = "DarkStoneBlock", t[t.DarkDoor = 20] = "DarkDoor", t[t.RideableBear = 21] = "RideableBear", t[t.DarkGuardBot = 22] = "DarkGuardBot" }(l = t.BuildingType || (t.BuildingType = {})), t.BuildingTypeToEntityType = e, t.EntityTypeToBuildingType = s; var c;
!function(t) { t[t.Food = 0] = "Food", t[t.Wood = 1] = "Wood", t[t.Stone = 2] = "Stone", t[t.Gold = 3] = "Gold", t[t.Soul = 4] = "Soul" }(c = t.ResourceType || (t.ResourceType = {})), t.ParseResourceType = o; var u; !function(t) { t[t.SyncObject = 0] = "SyncObject", t[t.SyncObjectDelete = 1] = "SyncObjectDelete", t[t.PlayerSpawnRequest = 2] = "PlayerSpawnRequest", t[t.PlayerInput = 3] = "PlayerInput", t[t.PlayerAction = 4] = "PlayerAction", t[t.PlayerBuildRequest = 5] = "PlayerBuildRequest", t[t.PlayerBuildResponse = 6] = "PlayerBuildResponse", t[t.PlayerChatRequest = 7] = "PlayerChatRequest", t[t.ObjectSendDamage = 8] = "ObjectSendDamage", t[t.ObjectReceiveDamage = 9] = "ObjectReceiveDamage", t[t.SyncBackpack = 10] = "SyncBackpack", t[t.Ping = 11] = "Ping", t[t.RequestServerInfo = 12] = "RequestServerInfo", t[t.ResponseServerInfo = 13] = "ResponseServerInfo", t[t.Assign = 14] = "Assign", t[t.FloatResources = 15] = "FloatResources", t[t.SyncChild = 16] = "SyncChild", t[t.SyncChildDelete = 17] = "SyncChildDelete", t[t.MapMessage = 18] = "MapMessage", t[t.LeaderboardMessage = 19] = "LeaderboardMessage", t[t.ChatMessage = 20] = "ChatMessage", t[t.PlayerUnmountRequest = 21] = "PlayerUnmountRequest", t[t.PlayerCheat = 22] = "PlayerCheat", t[t.ForceDisconnect = 23] = "ForceDisconnect", t[t.PlayerSetViewportSize = 24] = "PlayerSetViewportSize", t[t.PackedMessage = 25] = "PackedMessage", t[t.LeaderboardMessagePlayer = 26] = "LeaderboardMessagePlayer", t[t.PlayerCreateTeam = 27] = "PlayerCreateTeam", t[t.PlayerJoinTeam = 28] = "PlayerJoinTeam", t[t.PlayerApproveRequest = 29] = "PlayerApproveRequest", t[t.PlayerDeclineRequest = 30] = "PlayerDeclineRequest", t[t.PlayerLeaveTeam = 31] = "PlayerLeaveTeam", t[t.PlayerKickRequest = 32] = "PlayerKickRequest", t[t.PlayerTeamMembersRequest = 33] = "PlayerTeamMembersRequest", t[t.PlayerTeamMembersResponse = 34] = "PlayerTeamMembersResponse", t[t.PlayerTeamListRequest = 35] = "PlayerTeamListRequest", t[t.PlayerTeamListResponse = 36] = "PlayerTeamListResponse", t[t.NotifyTeamCreated = 37] = "NotifyTeamCreated", t[t.NotifyTeamRemoved = 38] = "NotifyTeamRemoved", t[t.NotifyJoinRequestCreated = 39] = "NotifyJoinRequestCreated", t[t.NotifyJoinRequestRemoved = 40] = "NotifyJoinRequestRemoved", t[t.NotifyMemberJoin = 41] = "NotifyMemberJoin", t[t.NotifyMemberLeave = 42] = "NotifyMemberLeave", t[t.DayTimeMessage = 43] = "DayTimeMessage", t[t.PlayerTeamPingRequest = 44] = "PlayerTeamPingRequest", t[t.PlayerTeamPingResponse = 45] = "PlayerTeamPingResponse", t[t.PlayerRequestDaytime = 46] = "PlayerRequestDaytime", t[t.SyncHats = 47] = "SyncHats", t[t.PlayerSelectHat = 48] = "PlayerSelectHat",
t[t.ServerVersion = 49] = "ServerVersion" }(u = t.MessageType || (t.MessageType = {})); var d = function() { function t(t, e) { this.type = t, this.content = e } return t }(); t.Message = d; var p = {}; t.decode = r, t.encode = a }(e.Protocol || (e.Protocol = {})) } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(31) , r = function() { function t() { this.serverRotation = 0, this.clientRotation = 0, this.updateTime = 0, this.interpolationTime = .1 } return t.prototype.updateFrame = function(t, e, i) { this.serverRotation = e, this.clientRotation = t, this.updateTime = i } , t.interpolateAngle = function(t, e, i, n) { void 0 === n && (n = !0); var s = n ? Math.PI : 180;
Math.abs(e - t) > s && (e > t ? t += 2 * s : e += 2 * s); var o = t + (e - t) * i; return o >= 0 && o 0 && this._events[t].length > s && (this._events[t].warned = !0, console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[t].length), "function" == typeof console.trace && console.trace()), this } , i.prototype.on = i.prototype.addListener, i.prototype.once = function(t, e) { function i() { this.removeListener(t, i), s || (s = !0, e.apply(this, arguments)) } if (!n(e)) throw TypeError("listener must be a function"); var s = !1; return i.listener = e, this.on(t, i), this } , i.prototype.removeListener = function(t, e) { var i, s, r, a; if (!n(e)) throw TypeError("listener must be a function"); if (!this._events || !this._events[t]) return this; if (i = this._events[t], r = i.length, s = -1, i === e || n(i.listener) && i.listener === e) delete this._events[t], this._events.removeListener && this.emit("removeListener", t, e); else if (o(i)) { for (a = r; a-- > 0; ) if (i[a] === e || i[a].listener && i[a].listener === e) { s = a; break } if (s < 0) return this; 1 === i.length ? (i.length = 0, delete this._events[t]) : i.splice(s, 1), this._events.removeListener && this.emit("removeListener", t, e) }
return this } , i.prototype.removeAllListeners = function(t) { var e, i; if (!this._events) return this; if (!this._events.removeListener) return 0 === arguments.length ? this._events = {} : this._events[t] && delete this._events[t], this; if (0 === arguments.length) { for (e in this._events) "removeListener" !== e && this.removeAllListeners(e); return this.removeAllListeners("removeListener"), this._events = {}, this } if (i = this._events[t], n(i)) this.removeListener(t, i); else if (i) for (; i.length; ) this.removeListener(t, i[i.length - 1]); return delete this._events[t], this } , i.prototype.listeners = function(t) { return this._events && this._events[t] ? n(this._events[t]) ? [this._events[t]] : this._events[t].slice() : [] } , i.prototype.listenerCount = function(t) { if (this._events) { var e = this._events[t]; if (n(e)) return 1; if (e) return e.length } return 0 } , i.listenerCount = function(t, e) { return t.listenerCount(e) } } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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])
} ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = function(t) { function e() { var e = t.call(this) || this; return e.id = "animator", e } return n(e, t), e.prototype.start = function() { this.cachedSpriteComponent = this.entity.components.sprite, this.cachedTransform = this.entity.components.transform } , e.prototype.addAnimation = function(t, e, i, n) { return void 0 === n && (n = !1), this.cachedSpriteComponent.sprite.animations.add(t, e, i, n) } , e.prototype.play = function(t) { this.cachedSpriteComponent.sprite.animations.play(t) } , e.prototype.getCurrentName = function() { return this.cachedSpriteComponent.sprite.animations.name } , e }(s.Component); e.default = o } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) {
function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype =
i.prototype, }
new n)
}(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(1) , o = i(3) , r = o.Protocol.EntityTypeToBuildingType , a = i(10) , h = function() { function t(t, e, i) { this.id = t, this.objectType = e, this.position = i } return t }() , l = function(t) { function e(e) { var i = t.call(this, e) || this; return i.childs = [], i.typeCounts = {}, i } return n(e, t), e.prototype.onCreateChild = function(t) { var e = t.content.objectType; this.childs.push(new h(t.content.id,e,new Phaser.Point(t.content.x,t.content.y))), this.typeCounts.hasOwnProperty(e) ? this.typeCounts[e]++ : this.typeCounts[e] = 1, this.world.services.getService(a.CraftMenuService).updateLimit(r(e), this.typeCounts[e]) } , e.prototype.onRemoveChild = function(t) { for (var e = t.content.id, i = t.content.objectType, n = 0; n < this.childs.length; n++) if (this.childs[n].id === e) { this.typeCounts[i]--, this.childs.splice(n, 1); break } this.world.services.getService(a.CraftMenuService).updateLimit(r(i), this.typeCounts[i]) } , e.prototype.getCountForType = function(t) { return this.typeCounts.hasOwnProperty(t.toString()) ? this.typeCounts[t] : 0 } ,
e.prototype.cleanup = function() { this.childs = [], this.typeCounts = {}, this.world.services.getService(a.CraftMenuService).updateAllLimits() } , e }(s.Service); e.default = l
} , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(1) , o = i(2) , r = i(15) , a = i(3) , h = a.Protocol.BuildingType , l = i(9) , c = a.Protocol.BuildingTypeToEntityType , u = function() { function t(t, e) { this.name = t, this.element = document.createElement("div"), this.element.className = "item", this.element.onclick = this.onClick.bind(this), this.element.id = t, e && (this.key = Phaser.GAMES[0].input.keyboard.addKey(Phaser.Keyboard[e]), this.key.onDown.add(this.onClick, this)) } return t.prototype.action = function() {} , t.prototype.onClick = function() { this.action() }
, t.prototype.destroy = function() { this.key && (this.key.onDown.remove(this.onClick, this), this.key = null), this.element = null } , t.prototype.updateAvailability = function(t) { this.element && (this.element.classList.remove("available"), this.element.classList.remove("unavailable"), this.element.classList.add(t ? "available" : "unavailable")) } , t }(); e.MenuItem = u; var d = function() { function t() { this.items = [] } return t.prototype.appendChild = function(t) { this.element.appendChild(t.element), this.items.push(t) } , t.prototype.destroy = function() { for (var t = 0, e = this.items; t < e.length; t++) { e[t].destroy() } this.items = [] } , t }(); e.MenuContainer = d; var p = function(t) { function e(e) { var i = t.call(this) || this; return i.element = document.getElementById("bottom-panel"), i } return n(e, t), e.prototype.appendMany = function(t, e) { for (var i = [], n = 0, s = e; n < s.length; n++) { var o = s[n] , r = new g(t,o.img,o.name,o.hotKey,o.hotKeyDisplay,o.tooltip,o.maxLimit); this.appendChild(r), i.push(r) } return i } , e }(d) , f = function(t) { function e(e, i) { var n = t.call(this) || this; return n.world = i,
n.element = document.getElementById("left-panel"), n } return n(e, t), e.prototype.appendMany = function(t, e) { for (var i = [], n = 0, s = e; n < s.length; n++) { var o = s[n] , r = new m(t,o.img,o.name,o.hotKey,o.hotKeyDisplay,o.tooltip,o.maxLimit); this.appendChild(r), i.push(r) } return i } , e.prototype.pushRecently = function(t) { for (var e = this.world.services.getService(l.default), i = 0; i < this.items.length; i++) if (this.items[i].name === t.name) return; for (var i = 0; i < this.items.length; i++) { var n = void 0; n = i === this.items.length - 1 ? t : this.items[i + 1], this.items[i].reInit(n.getImage(), n.name, this.items[i].getHotKey(), Phaser.GAMES[0].state.getCurrentState().services.getService(b).getTooltipFor(n.name ), Phaser.GAMES[0].state.getCurrentState().services.getService(b).getMaxLimit(n.name)) , this.items[i].updateLimit(e.getCountForType(c(n.name))) } } , e }(d) , m = function(t) { function e(e, i, n, s, o, r, a) { var h = t.call(this, n, s) || this; return h.img = i, h.hotKey = s, h.world = e, h.maxLimit = a, h.element.className = "ui-tooltip item", h.element.innerHTML = '\n \n ' + r + '\n \n \n ' + o + "\n ", h.limit = document.createElement("div"), h.limit.className = "limit", h.limit.innerHTML = "0/" + a, h.element.appendChild(h.limit), h } return n(e, t), e.prototype.getImage = function() { return this.img } , e.prototype.getHotKey = function() {
return this.hotKey } , e.prototype.reInit = function(t, e, i, n, s) { this.name = e, this.img = t, this.maxLimit = s, this.element.className = "ui-tooltip item", this.element.innerHTML = '\n \n ' + n + '\n \n \n ' + i + "\n ", this.limit = document.createElement("div"), this.limit.className = "limit", this.limit.innerHTML = "0/" + s, this.element.appendChild(this.limit) } , e.prototype.updateLimit = function(t) { this.limit.innerText = t + "/" + this.maxLimit } , e.prototype.onClick = function() { t.prototype.onClick.call(this) } , e.prototype.action = function() { this.world.services.getService(r.default).requestWork(this.name) } , e }(u) , g = function(t) { function e(e, i, n, s, o, r, a) { var h = t.call(this, n, s) || this; return h.world = e, h.maxLimit = a, h.element.className = "ui-tooltip item", h.element.innerHTML = '\n \n ' + r + '\n \n \n ' + o + "\n ", h.limit = document.createElement("div"), h.limit.className = "limit", h.limit.innerHTML = "0/" + a, h.element.appendChild(h.limit), h } return n(e, t), e.prototype.updateLimit = function(t) { this.limit.innerText = t + "/" + this.maxLimit } , e.prototype.onClick = function() { t.prototype.onClick.call(this) } , e.prototype.action = function() { this.world.services.getService(r.default).requestWork(this.name)
} , e
}(u) , y = function(t) { function e(e, i, n, s, o, r, a, h, l) { var c = t.call(this, n, s) || this; return c.img = i, c.world = e, c.maxLimit = r, c.element.className = "shop-item", c.element.innerHTML = '\n ' + l + '\n \n \n \n \n ' + a + ' 0/' + r + '\n ' + h + "\n \n ", c } return n(e, t), e.prototype.getImage = function() { return this.img } , e.prototype.updateLimit = function(t) { this.limit || (this.limit = document.getElementById("n" + this.name + "_building_price")), this.limit.innerText = t + "/" + this.maxLimit } , e.prototype.onClick = function() { t.prototype.onClick.call(this) } , e.prototype.action = function() { this.world.services.getService(r.default).requestWork(this.name), this.world.services.getService(b).recentlyUsed(this) } , e }(u) , v = function(t) { function e(e) { var i = t.call(this) || this; return i.parentElement = document.getElementById("shop"), i.element = document.getElementById("shop-list"), i.key = Phaser.GAMES[0].input.keyboard.addKey(Phaser.KeyCode.ESC), i.key.onDown.add(i.hide, i), document.addEventListener("click", function(t) { "block" === this.parentElement.style.display && (t.target === this.element || "shop-show" === t.target.id || t.target.parentElement && "shopshow" === t.target.parentElement.id || this.hide()) } .bind(i)), i.hide(), i } return n(e, t), e.prototype.appendMany = function(t, e) {
for (var i = [], n = 0, s = e; n < s.length; n++) { var o = s[n] , r = new y(t.world,o.img,o.name,o.hotKey,o.hotKeyDisplay,t.getMaxLimit(o.name),t.getDisplayN ameFor(o.name),t.getDisplayDescription(o.name),t.getDisplayPriceFor(o.name)); this.appendChild(r), i.push(r) } return $("shop-list").scrollTop(0), i } , e.prototype.toggle = function() { "block" === this.parentElement.style.display ? this.hide() : this.show() } , e.prototype.show = function() { this.parentElement.style.display = "block" } , e.prototype.hide = function() { this.parentElement.style.display = "none" } , e.prototype.destroy = function() { t.prototype.destroy.call(this), this.key.onDown.remove(this.hide, this), this.key = null } , e }(d) , b = function(t) { function e(e) { var i = t.call(this, e) || this; i.menuItems = [], i.bottomMenu = new p("bottom-panel"), i.menuItems = i.bottomMenu.appendMany(i.world, [{ img: o.Images.ImagesWoodwall.getPNG(), name: h.WoodBlock, hotKey: "ONE", hotKeyDisplay: "1", tooltip: i.getTooltipFor(h.WoodBlock), maxLimit: Config.buildings[h[h.WoodBlock].toLowerCase()].limit }, { img: o.Images.ImagesStonewall.getPNG(), name: h.StoneBlock, hotKey: "TWO", hotKeyDisplay: "2", tooltip: i.getTooltipFor(h.StoneBlock), maxLimit: Config.buildings[h[h.StoneBlock].toLowerCase()].limit }, { img: o.Images.ImagesDoor.getPNG(), name: h.Door, hotKey: "THREE", hotKeyDisplay: "3", tooltip: i.getTooltipFor(h.Door), maxLimit: Config.buildings[h[h.Door].toLowerCase()].limit
}, {
img: o.Images.ImagesGardener.getPNG(), name: h.FarmerBot, hotKey: "FOUR", hotKeyDisplay: "4", tooltip: i.getTooltipFor(h.FarmerBot), maxLimit: Config.buildings[h[h.FarmerBot].toLowerCase()].limit
}, {
img: o.Images.ImagesGarden.getPNG(), name: h.Garden, hotKey: "FIVE", hotKeyDisplay: "5", tooltip: i.getTooltipFor(h.Garden), maxLimit: Config.buildings[h[h.Garden].toLowerCase()].limit }, {
img: o.Images.ImagesGuard.getPNG(), name: h.GuardBot, hotKey: "SIX", hotKeyDisplay: "6", tooltip: i.getTooltipFor(h.GuardBot), maxLimit: Config.buildings[h[h.GuardBot].toLowerCase()].limit
}, {
img: o.Images.ImagesFollower.getPNG(), name: h.FollowerBot, hotKey: "SEVEN", hotKeyDisplay: "7", tooltip: i.getTooltipFor(h.FollowerBot), maxLimit: Config.buildings[h[h.FollowerBot].toLowerCase()].limit }, {
img: o.Images.ImagesHeartstone.getPNG(), name: h.Heartstone, hotKey: "EIGHT", hotKeyDisplay: "8", tooltip: i.getTooltipFor(h.Heartstone), maxLimit: Config.buildings[h[h.Heartstone].toLowerCase()].limit
}, {
img: o.Images.ImagesTower.getPNG(), name: h.Tower, hotKey: "NINE", hotKeyDisplay: "9", tooltip: i.getTooltipFor(h.Tower), maxLimit: Config.buildings[h[h.Tower].toLowerCase()].limit }]), i.recentlyMenu = new f("left-panel",i.world); var n = i.recentlyMenu.appendMany(i.world, [{ img: o.Images.ImagesFoodcrate.getPNG(), name: h.FoodCrate, hotKey: "Z", hotKeyDisplay: "Z", tooltip: i.getTooltipFor(h.FoodCrate), maxLimit: Config.buildings[h[h.FoodCrate].toLowerCase()].limit }, { img: o.Images.ImagesWoodcrate.getPNG(), name: h.WoodCrate, hotKey: "X", hotKeyDisplay: "X", tooltip: i.getTooltipFor(h.WoodCrate), maxLimit: Config.buildings[h[h.WoodCrate].toLowerCase()].limit }, {
img: o.Images.ImagesStonecrate.getPNG(), name: h.StoneCrate, hotKey: "C", hotKeyDisplay: "C", tooltip: i.getTooltipFor(h.StoneCrate), maxLimit: Config.buildings[h[h.StoneCrate].toLowerCase()].limit }]); i.shopMenu = new v("shop"); var s = i.shopMenu.appendMany(i, [{ img: o.Images.ImagesFoodcrate.getPNG(), name: h.FoodCrate, tooltip: i.getTooltipFor(h.FoodCrate), maxLimit: Config.buildings[h[h.FoodCrate].toLowerCase()].limit }, { img: o.Images.ImagesWoodcrate.getPNG(), name: h.WoodCrate, tooltip: i.getTooltipFor(h.WoodCrate), maxLimit: Config.buildings[h[h.WoodCrate].toLowerCase()].limit }, { img: o.Images.ImagesStonecrate.getPNG(), name: h.StoneCrate, tooltip: i.getTooltipFor(h.StoneCrate), maxLimit: Config.buildings[h[h.StoneCrate].toLowerCase()].limit }, { img: o.Images.ImagesWoodspikes.getPNG(), name: h.WoodSpikes, tooltip: i.getTooltipFor(h.WoodSpikes), maxLimit: Config.buildings[h[h.WoodSpikes].toLowerCase()].limit }, { img: o.Images.ImagesCarwolf.getPNG(), name: h.RideableWolf, tooltip: i.getTooltipFor(h.RideableWolf), maxLimit: Config.buildings[h[h.RideableWolf].toLowerCase()].limit }, { img: o.Images.ImagesPickupbot.getPNG(), name: h.GardenBot, tooltip: i.getTooltipFor(h.GardenBot), maxLimit: Config.buildings[h[h.GardenBot].toLowerCase()].limit }, { img: o.Images.ImagesMannequin.getPNG(), name: h.Mannequin, tooltip: i.getTooltipFor(h.Mannequin), maxLimit: Config.buildings[h[h.Mannequin].toLowerCase()].limit }, { img: o.Images.ImagesRideablebear.getPNG(), name: h.RideableBear, tooltip: i.getTooltipFor(h.RideableBear), maxLimit: Config.buildings[h[h.RideableBear].toLowerCase()].limit }, { img: o.Images.ImagesSoccerball.getPNG(), name: h.SoccerBall, tooltip: i.getTooltipFor(h.SoccerBall), maxLimit: Config.buildings[h[h.SoccerBall].toLowerCase()].limit }]); return i.menuItems = i.menuItems.concat(n), i.menuItems = i.menuItems.concat(s), i.updateAvailability(), i }
return n(e, t), e.prototype.getTooltipFor = function(t) { for (var e = "", i = Config.buildings[h[t].toLowerCase()], n = 0, s = Object.keys(i.price); n < s.length; n++) { var o = s[n]; e += '' + (o.charAt(0).toUpperCase() + o.slice(1)) + ": " + i.price[o] + "" } return '\n ' + i.name + "\n " + i.description + "\n " + e + "\n " } , e.prototype.getDisplayPriceFor = function(t) { for (var e = "", i = Config.buildings[h[t].toLowerCase()], n = 0, s = Object.keys(i.price); n < s.length; n++) { var o = s[n]; e += "" + (o.charAt(0).toUpperCase() + o.slice(1)) + ": " + i.price[o] + "" } return e } , e.prototype.getMaxLimit = function(t) { return Config.buildings[h[t].toLowerCase()].limit } , e.prototype.getDisplayNameFor = function(t) { return Config.buildings[h[t].toLowerCase()].name } , e.prototype.getDisplayDescription = function(t) { return Config.buildings[h[t].toLowerCase()].description } , e.prototype.recentlyUsed = function(t) { this.shopMenu.hide(), this.recentlyMenu.pushRecently(t) } , e.prototype.updateAvailability = function() { for (var t = this.world.services.getService(r.default), e = 0, i = this.menuItems; e < i.length; e++) { var n = i[e]; n.updateAvailability(t.canBuild(n.name)) } } , e.prototype.updateLimit = function(t, e) { for (var i = this.world.services.getService(r.default), n = 0, s = this.menuItems; n < s.length; n++) { var o = s[n]; o.name === t && (o.updateLimit(e), o.updateAvailability(i.canBuild(o.name))) } } , e.prototype.updateAllLimits = function() {
for (var t = this.world.services.getService(l.default), e = 0, i = this.menuItems; e < i.length; e++) { var n = i[e]; n.updateLimit(t.getCountForType(c(n.name))) } } , e.prototype.cleanup = function() { this.updateAvailability() } , e }(s.Service); e.CraftMenuService = b } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = function() { function t(t, e, i, n) { this.width = 120, this.height = 10, this.borderwidth = 1, this.borderheight = 1, this.bgcolor = "#ffffff", this.fgcolor = "#aa0000", this.offset = 10, this.alpha = .5, this.game = t, this.group = e; var s = this.game.add.bitmapData(this.width, this.height); s.ctx.beginPath(), s.ctx.rect(0, 0, this.width, this.height), s.ctx.fillStyle = this.bgcolor, s.ctx.fill(),
this.bitmap1 = s, this.total = e.create(i, n, s), this.total.alpha = this.alpha, this.total.anchor.set(.5, .5), s = this.game.add.bitmapData(this.width - 2 * this.borderwidth, this.height - 2 * this.borderheight), s.ctx.beginPath(), s.ctx.rect(0, 0, this.width - 2 * this.borderwidth, this.height - 2 * this.borderheight), s.ctx.fillStyle = this.fgcolor, s.ctx.fill(), this.bitmap2 = s, this.current = e.create(i, n, s), this.current.alpha = this.alpha, this.current.anchor.set(0, .5), this.croprect = new Phaser.Rectangle(0,0,s.width,s.height), this.totalcrop = s.width, this.current.cropRect = this.croprect } return t.prototype.setposition = function(t, e) { this.current.position.x = t - this.totalcrop / 2, this.current.position.y = e + this.height / 2 + this.offset, this.total.position.x = t, this.total.position.y = e + this.height / 2 + this.offset } , t.prototype.fill = function(t) { this.croprect.width = t * this.totalcrop, this.current.updateCrop() } , t.prototype.destroy = function() { this.current.destroy(), this.total.destroy(), this.bitmap1.destroy(), this.bitmap2.destroy() } , t }(); e.Healthbar = o; var r = function(t) { function e(e) { void 0 === e && (e = 0); var i = t.call(this) || this; return i.health = 1, i.maxHealth = 1, i.offset = e, i } return n(e, t), e.prototype.start = function() { this.cachedTransform = this.entity.components.transform, this.cachedSprite = this.entity.components.sprite, this.bar = new o(this.world.game,this.world.LAYER_UI,this.cachedTransform.position.x,this.cachedTr ansform.position.y), this.bar.fill(1), this.entity.on("networksync", this.onNetworkSync.bind(this))
} , e.prototype.onNetworkSync = function(t) { t.hasOwnProperty("health") && (this.health = t.health), t.hasOwnProperty("maxHealth") && (this.maxHealth = t.maxHealth), this.bar.fill(this.health / this.maxHealth) } , e.prototype.update = function(t) { var e = this.cachedTransform.position.x , i = this.cachedTransform.position.y - this.offset + this.cachedSprite.sprite.height / 2; this.bar.setposition(e, i) } , e.prototype.destroy = function() { this.bar.destroy() } , e }(s.Component); e.default = r } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(8) , o = function(t) { function e() { var e = t.call(this) || this; return e.transportId = -1, e } return n(e, t), e.prototype.start = function() { t.prototype.start.call(this),
this.entity.on("networksync", this.onNetworkSync.bind(this)), this.entity.on("senddamage", this.onSendDamage.bind(this)), this.addAnimation("walk", Phaser.Animation.generateFrameNames("walk", 1, 16, ".png", 0), 30, !0), this.addAnimation("pigwalk", ["onpig.png"], 15, !0), this.addAnimation("punch", Phaser.Animation.generateFrameNames("hit", 1, 10, ".png", 0), 40, !1).onComplete.add(function() { this.walk() } .bind(this)), this.addAnimation("pigpunch", Phaser.Animation.generateFrameNames("pighit", 1, 8, ".png", 0), 30, ! 1).onComplete.add(function() { this.walk() } .bind(this)), this.walk() } , e.prototype.onNetworkSync = function(t) { t.hasOwnProperty("transportId") && (this.transportId = t.transportId) } , e.prototype.walk = function() { this.transportId > -1 ? this.play("pigwalk") : this.play("walk") } , e.prototype.onSendDamage = function(t) { this.transportId > -1 ? this.play("pigpunch") : this.play("punch") } , e.prototype.update = function(e) { t.prototype.update.call(this, e), "punch" !== this.getCurrentName() && "pigpunch" !== this.getCurrentName() && (this.cachedTransform.isMoving() ? this.walk() : this.cachedSpriteComponent.sprite.animations.stop()) } , e.prototype.destroy = function() {} , e }(s.default); e.default = o } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() {
this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype,
new n)
}
}(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = function(t) { function e() { return t.call(this) || this } return n(e, t), e.prototype.start = function() { this.cachedSpriteComponent = this.entity.components.sprite, this.entity.on("receivedamage", this.onReceiveDamage.bind(this)) } , e.prototype.onReceiveDamage = function(t) { this.cachedSpriteComponent.flashRed() } , e }(s.Component); e.default = o
} , function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n = i(35) , s = i(189) , o = function() { function t() {} return t.init = function(e) { s.default.call("/ip", function(i) { t.IP = i.ip, t.PORT = i.port, e() }) } , t.getHostAddress = function() { var e = n.UrlParse.getUrlParameterByName("ip"); return e ? "ws://" + e : "ws://" + t.IP + ":" + t.PORT } , t.getHostAddressRaw = function() { var e = n.UrlParse.getUrlParameterByName("ip"); return e ? "" + e : t.IP + ":" + t.PORT } , t.getNearestServer = function() { return new Promise(function(e, i) {
$.ajax("http://status.glor.io").done(function(n) { for (var s = {}, o = 0, r = n; o < r.length; o++) { var a = r[o]; if (a.status) { var h = a.name.split("-")[0]; h = h.charAt(0).toUpperCase() + h.slice(1), s.hasOwnProperty(h) || (s[h] = []), s[h].push(a.host) } } for (var l = [], c = 0, u = Object.keys(s); c < u.length; c++)
{
var h = u[c]; if (s[h].length > 0) { var d = t.ping("http://" + s[h][0] + "/ip", h, .3); l.push(d) }
} t.successRace(l).then(function(t) { console.log("Nearest server in " + t.city + " with ping " + t.delta + "ms");
var i = s[t.city] , n = i[Math.floor(Math.random() * i.length)]; e(n) }).catch(function(t) { i("All promises unresolved") }) }).fail(function() { i("Can't connect to status.glor.io") })
} ) } , t.successRace = function(t) { return Promise.all(t.map(function(t) { return t.then(function(t) { return Promise.reject(t) }, function(t) { return Promise.resolve(t) }) })).then(function(t) { return Promise.reject(t) }, function(t) { return Promise.resolve(t) }) } , t.request_image = function(t) { return new Promise(function(e, i) { var n = new Image; n.onload = function() { e(n) } , n.onerror = function() { i(t) } ,
n.src = t + "?random-no-cache=" + Math.floor(65536 * (1 + Math.random())).toString(16) } ) } , t.ping = function(e, i, n) { return new Promise(function(s, o) { var r = (new Date).getTime() , a = function() { var t = (new Date).getTime() - r; t *= n || 1, s({ city: i, delta: t }) }; t.request_image(e).then(a).catch(a), setTimeout(function() { o(Error("Timeout")) }, 3e3) } ) } , t }(); o.IP = "127.0.0.1", o.PORT = "5000", e.default = o } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(1) , o = i(2)
, r = i(32) , a = i(9) , h = i(3) , l = h.Protocol.BuildingType , c = h.Protocol.BuildingTypeToEntityType , u = i(29) , d = h.Protocol.MessageType; e.BuildingDefinitions = { WoodBlock: { icon: o.Images.ImagesWoodwall.getPNG(), spriteName: o.Images.ImagesWoodwall.getName(), scale: 1 }, StoneBlock: { icon: o.Images.ImagesStonewall.getPNG(), spriteName: o.Images.ImagesStonewall.getName(), scale: 1 }, DarkStoneBlock: { icon: o.Images.ImagesDarkstonewall.getPNG(), spriteName: o.Images.ImagesDarkstonewall.getName(), scale: 1 }, Garden: { icon: o.Images.ImagesGarden.getPNG(), spriteName: o.Images.ImagesGarden.getName(), scale: 1 }, Tower: { icon: o.Images.ImagesTower.getPNG(), spriteName: o.Images.ImagesTower.getName(), scale: 1 }, Heartstone: { icon: o.Images.ImagesHeartstone.getPNG(), spriteName: o.Images.ImagesHeartstone.getName(), scale: 1 }, GuardBot: { icon: o.Images.ImagesGuard.getPNG(), spriteName: o.Images.ImagesGuard.getName(), scale: .7 }, DarkGuardBot: { icon: o.Images.ImagesDarkguard.getPNG(), spriteName: o.Images.ImagesDarkguard.getName(), scale: .7 }, FollowerBot: { icon: o.Images.ImagesFollower.getPNG(), spriteName: o.Images.ImagesFollower.getName(), scale: .7 }, FarmerBot: { icon: o.Images.ImagesGardener.getPNG(), spriteName: o.Images.ImagesGardener.getName(), scale: .7 }, GardenBot: {
icon: o.Images.ImagesPickupbot.getPNG(), spriteName: o.Images.ImagesPickupbot.getName(), scale: .7
}, Door: { icon: o.Images.ImagesDoor.getPNG(), spriteName: o.Images.ImagesDoor.getName(), scale: 1 }, DarkDoor: { icon: o.Images.ImagesDarkdoor.getPNG(), spriteName: o.Images.ImagesDarkdoor.getName(), scale: 1 }, FoodCrate: { icon: o.Images.ImagesFoodcrate.getPNG(), spriteName: o.Images.ImagesFoodcrate.getName(), scale: 1 }, WoodCrate: { icon: o.Images.ImagesWoodcrate.getPNG(), spriteName: o.Images.ImagesWoodcrate.getName(), scale: 1 }, StoneCrate: { icon: o.Images.ImagesStonecrate.getPNG(), spriteName: o.Images.ImagesStonecrate.getName(), scale: 1 }, RideableWolf: { icon: o.Images.ImagesCarwolf.getPNG(), spriteName: o.Images.ImagesCarwolf.getName(), scale: 1 }, RideableBear: { icon: o.Images.ImagesRideablebear.getPNG(), spriteName: o.Images.ImagesRideablebear.getName(), scale: 1 }, Mannequin: { icon: o.Images.ImagesMannequin.getPNG(), spriteName: o.Images.ImagesMannequin.getName(), scale: 1 }, SoccerBall: { icon: o.Images.ImagesSoccerball.getPNG(), spriteName: o.Images.ImagesSoccerball.getName(), scale: 1 }, WoodSpikes: { icon: o.Images.ImagesWoodspikes.getPNG(), spriteName: o.Images.ImagesWoodspikes.getName(), scale: 1 }, Portal: { icon: o.Images.ImagesPortal.getPNG(), spriteName: o.Images.ImagesPortal.getName(), scale: 1 }
}; var p = function(t) { function i(e) { var i = t.call(this, e) || this; return i.currentBuildingId = null, i.currentBuildingSprite = null, i.world.game.input.onDown.add(i.onMouseDown, i), i.currentBuildingPosition = new Phaser.Point(0,0), i.escapeKey = i.world.game.input.keyboard.addKey(Phaser.Keyboard.ESC), i } return n(i, t), i.prototype.inProgress = function() { return null != this.currentBuildingSprite } , i.prototype.onMouseDown = function(t) { if (this.inProgress()) { var e = this.world.game.input.activePointer.leftButton.isDown , i = this.world.game.input.activePointer.rightButton.isDown; e ? this.commitBuild() : i && this.cancelBuild() } } , i.prototype.requestWork = function(t) { this.inProgress() ? this.cancelBuild() : this.canBuild(t) && this.startBuild(t) } , i.prototype.startBuild = function(t) { this.currentBuildingId = t, this.currentBuildingSprite = this.world.LAYER_FOREGROUND_0.create(this.world.game.input.activePointer.worldX, this.world.game.input.activePointer.worldY, e.BuildingDefinitions[l[t]].spriteName); var i = e.BuildingDefinitions[l[t]].scale; this.currentBuildingSprite.scale.set(i, i), this.currentBuildingSprite.tint = 16751001, this.currentBuildingSprite.anchor.set(.5, .5) } , i.prototype.canBuild = function(t) { var e = l[t].toLowerCase() , i = Config.buildings[e].price , n = Config.buildings[e].limit , s = this.world.services.getService(r.default) , o = this.world.services.getService(a.default); return s.hasResources(i) && o.getCountForType(c(t)) < n } , i.prototype.update = function(t) { if (this.inProgress()) { var e = this.world.assignedObject.components.transform.position; this.currentBuildingPosition.x = this.world.game.input.activePointer.worldX, this.currentBuildingPosition.y = this.world.game.input.activePointer.worldY, this.currentBuildingPosition.x = this.currentBuildingPosition.x e.x,
e.y;
this.currentBuildingPosition.y = this.currentBuildingPosition.y -
var i = this.currentBuildingPosition.getMagnitude(); i > Config.client.build_radius && (i = Config.client.build_radius), this.currentBuildingPosition.normalize(), this.currentBuildingPosition.multiply(i, i), this.currentBuildingPosition.add(e.x, e.y); var n = this.world.services.getService(u.default).tileWidth , s = this.world.services.getService(u.default).tileHeight , o = n / 2 , r = s / 2; Config.buildings[l[this.currentBuildingId].toLowerCase()].radius || Config.buildings[l[this.currentBuildingId].toLowerCase()].subtile ? (this.currentBuildingPosition.x = Math.floor(this.currentBuildingPosition.x / o) * o, this.currentBuildingPosition.y = Math.floor(this.currentBuildingPosition.y / r) * r) : (this.currentBuildingPosition.x = Math.floor(this.currentBuildingPosition.x / n) * n + o, this.currentBuildingPosition.y = Math.floor(this.currentBuildingPosition.y / s) * s + r), this.currentBuildingSprite.position.copyFrom(this.currentBuildingPosition), this.escapeKey.isDown && this.cancelBuild() } } , i.prototype.commitBuild = function() { this.world.socket.sendMessage(d.PlayerBuildRequest, { buildingType: this.currentBuildingId, x: this.currentBuildingPosition.x, y: this.currentBuildingPosition.y }), this.world.assignedObject && this.world.assignedObject.components.networkinput && this.world.assignedObject.components.networkinput.lockPunchUntilMouseUp() } , i.prototype.cancelBuild = function() { this.currentBuildingSprite && (this.currentBuildingSprite.destroy(), this.currentBuildingSprite = null) } , i.prototype.onBuildResponse = function(t) { t.success && this.commitBuild() } , i.prototype.destroy = function() { this.cancelBuild(), this.world.game.input.onDown.remove(this.onMouseDown, this) } , i }(s.Service); e.default = p } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() {
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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(1) , o = i(3) , r = o.Protocol.MessageType , a = i(7) , h = o.Protocol.HatType , l = i(2) , c = i(17) , u = function(t) { function e(i, n) { var s = t.call(this) || this; return s.hatType = i, s.element = document.createElement("div"), s.element.className = n ? "ui-hat-list-item is-active" : "ui-hat-listitem is-aviable", s.element.innerHTML = '\n \n \n \n ', n || (s.element.onclick = function() { this.emit("wear") } .bind(s)), s } return n(e, t), e.getHatSprite = function(t) { return t === h.WhiteBearHat ? l.Images.ImagesWhitebearhaticon.getPNG() : t === h.BrownBearHat ? l.Images.ImagesBrownbearhaticon.getPNG() : t === h.ChessHat ? l.Images.ImagesChesshaticon.getPNG() : t === h.CowboyHat ? l.Images.ImagesCowboyhaticon.getPNG() : t === h.ChickenHat ? l.Images.ImagesChickenhaticon.getPNG() : t === h.FoxHat ? l.Images.ImagesFoxhaticon.getPNG() : t === h.VikingHat ? l.Images.ImagesVikinghaticon.getPNG() : t === h.BuilderHat ? l.Images.ImagesBuilderhaticon.getPNG() : t === h.HockeyHat ? l.Images.ImagesHockeyhaticon.getPNG() : t === h.TankHat ? l.Images.ImagesTankhaticon.getPNG() : t === h.DruidHat ? l.Images.ImagesDruidhaticon.getPNG() : t === h.IceHat ?
l.Images.ImagesIcehaticon.getPNG() : l.Images.ImagesKnight.getPNG() } , e }(a.EventEmitter) , d = function() { function t(t, e) { this.listContainer = e, this.world = t } return t.prototype.cleanup = function() { this.elements = [], this.listContainer.innerHTML = "" } , t.prototype.updateHats = function(t, e) { this.cleanup(); for (var i = function(i) { var s = t[i] , o = new u(s,s === e); o.on("wear", function() { this.world.socket.sendMessage(r.PlayerSelectHat, { hatType: s }), this.world.services.getService(p).toggle() } .bind(n)), n.listContainer.appendChild(o.element) }, n = this, s = 0; s < t.length; s++) i(s); var o = -1 , a = new u(o,o === e); a.on("wear", function() { this.world.socket.sendMessage(r.PlayerSelectHat, { hatType: o }), this.world.services.getService(p).toggle() } .bind(this)), this.listContainer.appendChild(a.element) } , t }() , p = function(t) { function e(e) { var i = t.call(this, e) || this; return i.isEnabled = !1, i.world.socket.onMessage(r.SyncHats, i.onSyncHats.bind(i)), i.container = document.getElementById("ui-hat-list-container"), document.getElementById("ui-hat-list-close").onclick = function() { this.toggle() } .bind(i), document.getElementById("ui-hat-close-button").onclick = function() { this.toggle() } .bind(i), i.hatList = new d(e,document.getElementById("ui-hat-list-content")),
i } return n(e, t), e.prototype.onSyncHats = function(t) { var e = t.content.hatTypes , i = t.content.currentHat; this.hatList.updateHats(e, i) } , e.prototype.hide = function() { this.isEnabled && this.toggle() } , e.prototype.toggle = function() { this.isEnabled = !this.isEnabled, this.isEnabled && this.world.services.getService(c.default).hide(), this.container.style.display = this.isEnabled ? "block" : "none" } , e.prototype.destroy = function() { this.isEnabled && this.toggle() } , e }(s.Service); e.default = p } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(1) , o = i(3) , r = o.Protocol.MessageType , a = i(7) , h = i(16) , l = function() {
function t(t, e) { this.teamId = t, this.teamName = e } return t
}() , c = function() { function t(t, e, i) { this.id = t, this.teamId = e, this.memberName = i } return t }() , u = function() { function t(t, e, i) { this.id = t, this.teamId = e, this.memberName = i } return t }() , d = function(t) { function e(e, i) { var n = t.call(this) || this; return n.requestId = e, n.element = document.createElement("div"), n.element.className = "join-request-content", n.element.innerHTML = "\n " + i + '
ask for join\n \n \n \n \n \n \n \n \n ', $(".approve", n.element).on("click", function() { this.emit("approve", e) } .bind(n)), $(".decline", n.element).on("click", function() { this.emit("decline", e) } .bind(n)), n } return n(e, t), e }(a.EventEmitter) , p = function() { function t(t, e) { this.requests = {}, this.world = t, this.container = e } return t.prototype.clear = function() { for (var t = Object.keys(this.requests), e = 0, i = t; e < i.length; e+ +) { var n = i[e]; this.removeJoinRequest(parseInt(n)) }
} , t.prototype.addJoinRequest = function(t) { this.requests[t.id] = t, this.currentElement || this.show(t.id) } , t.prototype.removeJoinRequest = function(t) { delete this.requests[t], this.currentElement && this.currentElement.requestId === t && (this.hide(), Object.keys(this.requests).length > 0 && this.show(Object.keys(this.requests)[0])) } , t.prototype.show = function(t) { this.requests[t] && (this.currentElement = new d(t,this.requests[t].memberName), this.currentElement.on("approve", function(t) { this.world.services.getService(v).requestApprove(t), this.removeJoinRequest(t) } .bind(this)), this.currentElement.on("decline", function(t) { this.world.services.getService(v).requestDecline(t), this.removeJoinRequest(t) } .bind(this)), this.container.appendChild(this.currentElement.element), this.container.style.visibility = "visible") } , t.prototype.hide = function() { this.currentElement && (this.container.removeChild(this.currentElement.element), this.currentElement = null, this.container.style.visibility = "hidden") } , t }() , f = function(t) { function e(e, i) { var n = t.call(this) || this; return n.element = document.createElement("div"), n.element.className = "ui-team-list-item", n.element.innerHTML = '\n \n JOIN\n \n \n + i + "\n \n ", n.joinButton = $(".ui-join-button", n.element).get(0), n.joinButton.onclick = function() { this.emit("join-request", e) } .bind(n), n } return n(e, t), e.prototype.setJoinStatus = function(t) { t ? (this.joinButton.classList.add("loading"),
'
this.joinButton.innerHTML = ' REQUESTED') : (this.joinButton.classList.remove("loading"), this.joinButton.innerHTML = "JOIN") } , e }(a.EventEmitter) , m = function() { function t(t, e, i) { this.elements = {}, this.listContainer = i, this.container = e, this.world = t } return t.prototype.addTeam = function(t) { var e = new f(t.teamId,t.teamName); this.listContainer.appendChild(e.element), this.elements[t.teamId] = e, e.on("join-request", function(t) { this.world.services.getService(v).requestJoin(t) } .bind(this)) } , t.prototype.removeTeam = function(t) { this.elements[t] && (this.elements[t].element.parentNode.removeChild(this.elements[t].element), delete this.elements[t]) } , t.prototype.setJoinStatus = function(t, e) { this.elements[t] && this.elements[t].setJoinStatus(e) } , t.prototype.toggle = function(t) { this.container.style.visibility = t ? "visible" : "hidden" } , t }() , g = function(t) { function e(e, i, n) { var s = t.call(this) || this; return s.element = document.createElement("div"), s.element.className = "ui-member-list-item", s.element.innerHTML = "\n " + (e.isAdmin && i !== e.networkId ? 'KICK' : "") + '\n \n ' + n + "\n \n ", e.isAdmin && i !== e.networkId && (s.element.childNodes[1].onclick = function() { this.emit("kick-request", i) } .bind(s)), s } return n(e, t), e.prototype.setJoinStatus = function(t) { t ? this.element.childNodes[1].classList.add("loading") : this.element.childNodes[1].classList.remove("loading")
} , e }(a.EventEmitter) , y = function() { function t(t, e, i) { this.elements = {}, this.container = e, this.content = i, this.world = t } return t.prototype.addMember = function(t) { var e = new g(this.world,t.id,t.memberName); this.content.appendChild(e.element), this.elements[t.id] = e, e.on("kick-request", function(t) { this.world.services.getService(v).requestKick(t) } .bind(this)) } , t.prototype.removeMember = function(t) { this.elements[t] && (this.elements[t].element.parentNode.removeChild(this.elements[t].element), delete this.elements[t]) } , t.prototype.toggle = function(t) { this.container.style.visibility = t ? "visible" : "hidden" } , t }() , v = function(t) { function e(e) { var i = t.call(this, e) || this; i.teams = {}, i.joins = {}, i.members = {}, i.enabled = !1, i.teamList = new m(e,document.getElementById("ui-team-listcontainer"),document.getElementById("ui-team-list-content")), i.memberList = new y(e,document.getElementById("ui-member-listcontainer"),document.getElementById("ui-member-list-content")), i.joinRequestList = new p(e,document.getElementById("ui-join-requestlist")), i.world.socket.onMessage(r.PlayerTeamListResponse, i.onTeamListResponse.bind(i)), i.world.socket.onMessage(r.PlayerTeamMembersResponse, i.onMemberListResponse.bind(i)), i.world.socket.onMessage(r.NotifyTeamCreated, i.onTeamCreated.bind(i)), i.world.socket.onMessage(r.NotifyTeamRemoved, i.onTeamRemoved.bind(i)), i.world.socket.onMessage(r.NotifyJoinRequestCreated, i.onJoinRequestCreated.bind(i)), i.world.socket.onMessage(r.NotifyJoinRequestRemoved, i.onJoinRequestRemoved.bind(i)), i.world.socket.onMessage(r.NotifyMemberJoin, i.onMemberJoin.bind(i)), i.world.socket.onMessage(r.NotifyMemberLeave, i.onMemberLeave.bind(i)), i.requestTeamList(),
window.addEventListener("keydown", i.onKeyDown.bind(i), !1), document.getElementById("ui-create-team-button").onclick = function() { this.requestCreateTeam(document.getElementById("ui-input-teamname").value) } .bind(i), document.getElementById("ui-leave-team-button").onclick = function() { this.requestLeave() } .bind(i); for (var n = document.getElementsByClassName("ui-team-list-close"), s = 0; s < n.length; s++) n.item(s).onclick = function() { this.toggle() } .bind(i); return i } return n(e, t), e.prototype.onKeyDown = function(t) { this.enabled && 27 === t.keyCode && this.toggle() } , e.prototype.onJoinRequestCreated = function(t) { var e = new c(t.content.id,t.content.teamId,t.content.fromName); this.joins[e.id] = e, this.teamList.setJoinStatus(e.teamId, !0), this.world.isAdmin && e.teamId === this.world.teamId && this.joinRequestList.addJoinRequest(e) } , e.prototype.onJoinRequestRemoved = function(t) { var e = t.content.id; this.joins[e] && (this.teamList.setJoinStatus(this.joins[e].teamId, ! 1), delete this.joins[e]), this.joinRequestList.removeJoinRequest(e) } , e.prototype.onTeamListResponse = function(t) { for (var e = t.content.teamId, i = t.content.teamName, n = t.content.memberCount, s = 0; s < e.length; s++) this.addTeam(e[s], i[s], n[s]) } , e.prototype.onMemberListResponse = function(t) { for (var e = t.content.teamId, i = t.content.networkId, n = t.content.name, s = 0; s < i.length; s++) this.addMember(e, i[s], n[s]) } , e.prototype.onTeamCreated = function(t) { this.addTeam(t.content.teamId, t.content.teamName, 0) } , e.prototype.onTeamRemoved = function(t) { this.removeTeam(t.content.teamId) } ,
e.prototype.onMemberJoin = function(t) { var e = t.content.teamId , i = t.content.memberId , n = t.content.memberName; this.addMember(e, i, n) } , e.prototype.onMemberLeave = function(t) { var e = (t.content.teamId, t.content.memberId); this.removeMember(e) } , e.prototype.onTeamSwitch = function(t) { if (this.cleanupMembers(), this.world.isAdmin) for (var e in this.joins) this.joins[e].teamId === this.world.teamId && this.joinRequestList.addJoinRequest(this.joins[e]); else this.joinRequestList.clear(); for (var i in this.teams) this.teamList.setJoinStatus(i, !1); t > -1 && this.requestMemberList(t), this.requestTeamList(), this.teamList.toggle(this.enabled && this.world.teamId < 0), this.memberList.toggle(this.enabled && this.world.teamId > -1) } , e.prototype.removeTeam = function(t) { this.teams[t] && (delete this.teams[t], this.teamList.removeTeam(t)) } , e.prototype.addTeam = function(t, e, i) { this.teams[t] || (this.teams[t] = new l(t,e), this.teamList.addTeam(this.teams[t])) } , e.prototype.cleanupMembers = function() { for (var t = Object.keys(this.members), e = 0, i = t; e < i.length; e+ +) { var n = i[e]; this.removeMember(n) } } , e.prototype.addMember = function(t, e, i) { this.members[e] || (this.members[e] = new u(e,t,i), this.memberList.addMember(this.members[e])) } , e.prototype.removeMember = function(t) { this.members[t] && (this.memberList.removeMember(t), delete this.members[t]) } , e.prototype.requestJoin = function(t) { this.world.socket.sendMessage(r.PlayerJoinTeam, {
})
teamId: t
} , e.prototype.requestKick = function(t) { this.world.socket.sendMessage(r.PlayerKickRequest, { networkId: t }) } , e.prototype.requestCreateTeam = function(t) { this.world.socket.sendMessage(r.PlayerCreateTeam, { name: t }) } , e.prototype.requestLeave = function() { this.world.socket.sendMessage(r.PlayerLeaveTeam, {}) } , e.prototype.requestApprove = function(t) { this.world.socket.sendMessage(r.PlayerApproveRequest, { requestId: t }) } , e.prototype.requestDecline = function(t) { this.world.socket.sendMessage(r.PlayerDeclineRequest, { requestId: t }) } , e.prototype.requestTeamList = function() { this.world.socket.sendMessage(r.PlayerTeamListRequest, {}) } , e.prototype.requestMemberList = function(t) { this.world.socket.sendMessage(r.PlayerTeamMembersRequest, { teamId: t }) } , e.prototype.hide = function() { this.enabled && this.toggle() } , e.prototype.toggle = function() { this.enabled = !this.enabled, this.enabled && this.world.services.getService(h.default).hide(), this.teamList.toggle(this.enabled && this.world.teamId < 0), this.memberList.toggle(this.enabled && this.world.teamId > -1), this.world.game.input.keyboard.enabled = !this.enabled, this.world.game.input.keyboard.reset(!1) } , e }(s.Service); e.default = v }
, function(module, exports, __webpack_require__) { (function(module) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; /*! * protobuf.js v6.6.5 (c) 2016, Daniel Wirtz * Compiled Thu, 02 Mar 2017 18:54:44 UTC * Licensed under the BSD-3-Clause License * see: https://github.com/dcodeIO/protobuf.js for details */ !function(e, t) { "use strict"; !function(t, i, n) { function s(e) { var n = i[e]; return n || t[e][0].call(n = i[e] = { exports: {} }, s, n, n.exports), n.exports } var o = e.protobuf = s(n[0]); __webpack_require__(192) && (__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(152)], void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = function(t) { return o.util.Long = t, o.configure(), o } .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)), "object" == typeof module && module && module.exports && (module.exports = o) }({ 1: [function(t, e) { function i(t, e) { for (var i = [], n = 2; n < arguments.length; ) i.push(arguments[n++]); var s = !0; return new Promise(function(n, o) { i.push(function(t) { if (s) if (s = !1, t) o(t); else { for (var e = [], i = 1; i < arguments.length; ) e.push(arguments[i++]); n.apply(null, e) } }); try { t.apply(e || this, i) } catch (t) { s && (s = !1, o(t)) } } ) }
e.exports = i } , {}], 2: [function(e, i, n) { var s = n; s.length = function(t) { var e = t.length; if (!e) return 0; for (var i = 0; --e % 4 > 1 && "=" === t.charAt(e); ) ++i; return Math.ceil(3 * t.length) / 4 - i } ; for (var o = Array(64), r = Array(123), a = 0; a < 64; ) r[o[a] = a < 26 ? a + 65 : a < 52 ? a + 71 : a < 62 ? a - 4 : a - 59 | 43] = a++; s.encode = function(t, e, i) { for (var n, s = [], r = 0, a = 0; e < i; ) { var h = t[e++]; switch (a) { case 0: s[r++] = o[h >> 2], n = (3 & h) > 4], n = (15 & h) > 6], s[r++] = o[63 & h], a = 0 } } return a && (s[r++] = o[n], s[r] = 61, 1 === a && (s[r + 1] = 61)), String.fromCharCode.apply(String, s) } ; var h = "invalid encoding"; s.decode = function(e, i, n) { for (var s, o = n, a = 0, l = 0; l < e.length; ) { var c = e.charCodeAt(l++); if (61 === c && a > 1) break; if ((c = r[c]) === t) throw Error(h); switch (a) { case 0: s = c, a = 1; break; case 1: i[n++] = s > 4, s = c,
a = 2; break; case 2: i[n++] = (15 & s) > 2, s = c, a = 3; break; case 3: i[n++] = (3 & s) 0 && ".." !== e[o - 1] ? e.splice(--o, 2) : i ? e.splice(o, 1) : ++o : "." === e[o] ? e.splice(o, 1) : ++o; return n + e.join("/") } ; n.resolve = function(t, e, i) { return i || (e = o(e)), s(e) ? e : (i || (t = o(t)), (t = t.replace(/(?:\/|^)[^\/]+$/, "")).length ? o(t + "/" + e) : e) } } , {}], 8: [function(t, e) { function i(t, e, i) { var n = i || 8192 , s = n >>> 1 , o = null , r = n; return function(i) { if (i < 1 || i > s) return t(i); r + i > n && (o = t(n), r = 0); var a = e.call(o, r, r += i); return 7 & r && (r = 1 + (7 | r)), a } } e.exports = i }
, {}], 9: [function(t, e, i) { var n = i; n.length = function(t) { for (var e = 0, i = 0, n = 0; n < t.length; ++n) i = t.charCodeAt(n), i < 128 ? e += 1 : i < 2048 ? e += 2 : 55296 == (64512 & i) && 56320 == (64512 & t.charCodeAt(n + 1)) ? (++n, e += 4) : e += 3; return e } , n.read = function(t, e, i) { if (i - e < 1) return ""; for (var n, s = null, o = [], r = 0; e < i; ) n = t[e++], n < 128 ? o[r++] = n : n > 191 && n < 224 ? o[r++] = (31 & n) 239 && n < 365 ? (n = ((7 & n) 6 | 192, e[i++] = 63 & n | 128) : 55296 == (64512 & n) && 56320 == (64512 & (s = t.charCodeAt(r + 1))) ? (n = 65536 + ((1023 & n) > 18 | 240, e[i++] = n >> 12 & 63 | 128, e[i++] = n >> 6 & 63 | 128, e[i++] = 63 & n | 128) : (e[i++] = n >> 12 | 224, e[i++] = n >> 6 & 63 | 128, e[i++] = 63 & n | 128); return i - o } } , {}], 10: [function(t, e) { function i(e, r) { if (n || (n = t(34)), !(e instanceof n)) throw TypeError("type must be a Type"); if (r) { if ("function" != typeof r) throw TypeError("ctor must be a function")
} else r = o.codegen("p")("return c.call(this,p)").eof(e.name, {
c: s }); r.constructor = i, (r.prototype = new s).constructor = r, o.merge(r, s, !0), r.$type = e, r.prototype.$type = e; for (var a = 0; a < e.fieldsArray.length; ++a) r.prototype[e.b[a].name] = Array.isArray(e.b[a].resolve().defaultValue) ? o.emptyArray : o.isObject(e.b[a].defaultValue) && !e.b[a].long ? o.emptyObject : e.b[a].defaultValue; var h = {}; for (a = 0; a < e.oneofsArray.length; ++a) h[e.d[a].resolve().name] = { get: o.oneOfGetter(e.d[a].oneof), set: o.oneOfSetter(e.d[a].oneof) }; return a && Object.defineProperties(r.prototype, h), e.ctor = r, r.prototype } e.exports = i; var n, s = t(21), o = t(36); i.create = i, i.prototype = s } , { 21: 21, 34: 34, 36: 36 }], 11: [function(t, e) { function i(t, e) { /\/|\./.test(t) || (t = "google/protobuf/" + t + ".proto", e = { nested: { google: { nested: { protobuf: { nested: e } } } } }), i[t] = e } e.exports = i, i("any", { Any: { fields: { type_url: { type: "string", id: 1 },
value: { type: "bytes", id: 2 } }
}
}); var n; i("duration", { Duration: n = { fields: { seconds: { type: "int64", id: 1 }, nanos: { type: "int32", id: 2 } } } }), i("timestamp", { Timestamp: n }), i("empty", { Empty: { fields: {} } }), i("struct", { Struct: { fields: { fields: { keyType: "string", type: "Value", id: 1 } } }, Value: { oneofs: { kind: { oneof: ["nullValue", "numberValue", "stringValue", "boolValue", "structValue", "listValue"] } }, fields: { nullValue: { type: "NullValue", id: 1 }, numberValue: { type: "double", id: 2 }, stringValue: { type: "string", id: 3
}, boolValue: { type: "bool", id: 4 }, structValue: { type: "Struct", id: 5 }, listValue: { type: "ListValue", id: 6 }
} }, NullValue: { values: { NULL_VALUE: 0 } }, ListValue: { fields: { values: { rule: "repeated", type: "Value", id: 1 } } }
}), i("wrappers", { DoubleValue: { fields: { value: { type: id: 1 } } }, FloatValue: { fields: { value: { type: id: 1 } } }, Int64Value: { fields: { value: { type: id: 1 } } }, UInt64Value: { fields: { value: { type:
"double",
"float",
"int64",
"uint64",
}
id: 1
} }, Int32Value: { fields: { value: { type: id: 1 } } }, UInt32Value: { fields: { value: { type: id: 1 } } }, BoolValue: { fields: { value: { type: id: 1 } } }, StringValue: { fields: { value: { type: id: 1 } } }, BytesValue: { fields: { value: { type: id: 1 } } }
"int32",
"uint32",
"bool",
"string",
"bytes",
}) } , {}], 12: [function(t, e, i) { function n(t, e, i, n) { if (e.resolvedType) if (e.resolvedType instanceof r) { t("switch(d%s){", n); for (var s = e.resolvedType.values, o = Object.keys(s), a = 0; a < o.length; ++a) e.repeated && s[o[a]] === e.typeDefault && t("default:"), t("case%j:", o[a])("case %j:", s[o[a]])("m%s= %j", n, s[o[a]])("break"); t("}")
} else t('if(typeof d%s!=="object")', n)("throw TypeError(%j)", e.fullName + ": object expected")("m%s=types[%d].fromObject(d%s)", n, i, n); else { var h = !1; switch (e.type) { case "double": case "float": t("m%s=Number(d%s)", n, n); break; case "uint32": case "fixed32": t("m%s=d%s>>>0", n, n); break; case "int32": case "sint32": case "sfixed32": t("m%s=d%s|0", n, n); break; case "uint64": h = !0; case "int64": case "sint64": case "fixed64": case "sfixed64": t("if(util.Long)")("(m%s=util.Long.fromValue(d %s)).unsigned=%j", n, n, h)('else if(typeof d%s==="string")', n)("m%s=parseInt(d %s,10)", n, n)('else if(typeof d%s==="number")', n)("m%s=d%s", n, n)('else if(typeof d%s==="object")', n)("m%s=new util.LongBits(d%s.low>>>0,d %s.high>>>0).toNumber(%s)", n, n, n, h ? "true" : ""); break; case "bytes": t('if(typeof d%s==="string")', n) ("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", n, n, n) ("else if(d%s.length)", n)("m%s=d%s", n, n); break; case "string": t("m%s=String(d%s)", n, n); break; case "bool": t("m%s=Boolean(d%s)", n, n) } } return t } function s(t, e, i, n) { if (e.resolvedType) e.resolvedType instanceof r ? t("d%s=o.enums===String? types[%d].values[m%s]:m%s", n, i, n, n) : t("d%s=types[%d].toObject(m%s,o)", n, i, n); else { var s = !1; switch (e.type) { case "uint64": s = !0; case "int64": case "sint64": case "fixed64":
case "sfixed64": t('if(typeof m%s==="number")', n)("d %s=o.longs===String?String(m%s):m%s", n, n, n)("else")("d%s=o.longs===String? util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m %s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", n, n, n, n, s ? "true" : "", n); break; case "bytes": t("d%s=o.bytes===String?util.base64.encode(m%s,0,m %s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", n, n, n, n, n); break; default: t("d%s=m%s", n, n) } } return t } var o = i , r = t(15) , a = t(36); o.fromObject = function(t) { var e = t.fieldsArray , i = a.codegen("d")("if(d instanceof this.ctor)") ("return d"); if (!e.length) return i("return new this.ctor"); i("var m=new this.ctor"); for (var s = 0; s < e.length; ++s) { var o = e[s].resolve() , h = a.safeProp(o.name); o.map ? (i("if(d%s){", h)('if(typeof d%s!=="object")', h)("throw TypeError(%j)", o.fullName + ": object expected")("m%s={}", h)("for(var ks=Object.keys(d%s),i=0;i 0; ) { var n = t.shift(); if (i.nested && i.nested[n]) { if (!((i = i.nested[n])instanceof s)) throw Error("path conflicts with non-namespace } else i.add(i = new s(n)) } return e && i.addJSON(e), i
} , s.prototype.resolveAll = function() { for (var t = this.nestedArray, e = 0; e < t.length; ) t[e]instanceof s ? t[e++].resolveAll() : t[e+ +].resolve();
return this.resolve() } , s.prototype.lookup = function(e, i, n) { if ("boolean" == typeof i && (n = i, i = t), u.isString(e) && e.length) { if ("." === e) return this.root; e = e.split(".") } else if (!e.length) return this; if ("" === e[0]) return this.root.lookup(e.slice(1), i); var o = this.get(e[0]); if (o) if (1 === e.length) { if (!i || o instanceof i)
return o } else if (o instanceof s && (o = o.lookup(e.slice(1), i, !0)))
return o; return null === this.parent || n ? null :
this.parent.lookup(e, i) } , s.prototype.lookupType = function(t) { var e = this.lookup(t, a); if (!e) throw Error("no such type"); return e } , s.prototype.lookupService = function(t) { var e = this.lookup(t, h); if (!e) throw Error("no such service"); return e } , s.prototype.lookupEnum = function(t) { var e = this.lookup(t, l); if (!e) throw Error("no such enum"); return e.values } , s.f = function(t, e) { a = t, h = e } } , { 15: 15, 16: 16, 24: 24, 36: 36 }], 24: [function(e, i) { function n(t, e) { if (!o.isString(t)) throw TypeError("name must be a string"); if (e && !o.isObject(e)) throw TypeError("options must be an object"); this.options = e, this.name = t, this.parent = null, this.resolved = !1, this.comment = null, this.filename = null } i.exports = n, n.className = "ReflectionObject"; var s, o = e(36); Object.defineProperties(n.prototype, { root: { get: function() {
for (var t = this; null !== t.parent; ) t = t.parent; return t
} }, fullName: { get: function() { for (var t = [this.name], e = this.parent; e; ) t.unshift(e.name), e = e.parent; return t.join(".") } }
}), n.prototype.toJSON = function() { throw Error() } , n.prototype.onAdd = function(t) { this.parent && this.parent !== t && this.parent.remove(this), this.parent = t, this.resolved = !1; var e = t.root; e instanceof s && e.h(this) } , n.prototype.onRemove = function(t) { var e = t.root; e instanceof s && e.i(this), this.parent = null, this.resolved = !1 } , n.prototype.resolve = function() { return this.resolved ? this : (this.root instanceof s && (this.resolved = !0), this) } , n.prototype.getOption = function(e) { return this.options ? this.options[e] : t } , n.prototype.setOption = function(e, i, n) { return n && this.options && this.options[e] !== t || ((this.options || (this.options = {}))[e] = i), this } , n.prototype.setOptions = function(t, e) { if (t) for (var i = Object.keys(t), n = 0; n < i.length; ++n) this.setOption(i[n], t[i[n]], e); return this } , n.prototype.toString = function() { var t = this.constructor.className
, e = this.fullName; return e.length ? t + " " + e : t
} , {
} , n.f = function(t) { s = t }
36: 36 }], 25: [function(e, i) { function n(e, i, n) { if (Array.isArray(i) || (n = i, i = t), o.call(this, e, n), i !== t && !Array.isArray(i)) throw TypeError("fieldNames must be an Array"); this.oneof = i || [], this.fieldsArray = [] } function s(t) { if (t.parent) for (var e = 0; e < t.fieldsArray.length; ++e) t.fieldsArray[e].parent || t.parent.add(t.fieldsArray[e]) } i.exports = n; var o = e(24); ((n.prototype = Object.create(o.prototype)).constructor = n).className = "OneOf"; var r = e(16); n.fromJSON = function(t, e) { return new n(t,e.oneof,e.options) } , n.prototype.toJSON = function() { return { oneof: this.oneof, options: this.options } } , n.prototype.add = function(t) { if (!(t instanceof r)) throw TypeError("field must be a Field"); return t.parent && t.parent !== this.parent && t.parent.remove(t), this.oneof.push(t.name), this.fieldsArray.push(t), t.partOf = this, s(this), this } , n.prototype.remove = function(t) { if (!(t instanceof r)) throw TypeError("field must be a Field"); var e = this.fieldsArray.indexOf(t);
if (e < 0) throw Error(t + " is not a member of " + this); return this.fieldsArray.splice(e, 1), e = this.oneof.indexOf(t.name), e > -1 && this.oneof.splice(e, 1), t.partOf = null, this
} , n.prototype.onAdd = function(t) { o.prototype.onAdd.call(this, t); for (var e = this, i = 0; i < this.oneof.length; ++i) { var n = t.get(this.oneof[i]); n && !n.partOf && (n.partOf = e, e.fieldsArray.push(n)) } s(this) } , n.prototype.onRemove = function(t) { for (var e, i = 0; i < this.fieldsArray.length; ++i) (e = this.fieldsArray[i]).parent && e.parent.remove(e); o.prototype.onRemove.call(this, t) } } , { 16: 16, 24: 24 }], 26: [function(e, i) { function n(t) { return /^[a-zA-Z_][a-zA-Z_0-9]*$/.test(t) } function s(t) { return /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/.test(t) } function o(t) { return /^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/.test(t) } function r(t) { return null === t ? null : t.toLowerCase() } function a(t) { return t.substring(0, 1) + t.substring(1).replace(/_([a-z]) (?=[a-z]|$)/g, function(t, e) { return e.toUpperCase() }) } function h(e, i, w) { function x(t, e, i) { var n = h.filename; return i || (h.filename = null), Error("illegal " + (e || "token") + " '" + t + "' (" + (n ? n + ", " : "") + "line " + J.line() + ")") } function _() { var t, e = []; do { if ('"' !== (t = Z()) && "'" !== t)
throw x(t); e.push(Z()), tt(t), t = $() } while ('"' === t || "'" === t);return e.join("")
} function P(t) { var e = Z(); switch (r(e)) { case "'": case '"': return Q(e), _(); case "true": return !0; case "false": return !1 } try { return C(e, !0) } catch (i) { if (t && s(e)) return e; throw x(e, "value") } } function T(t, e) { var i, n; do { !e || '"' !== (i = $()) && "'" !== i ? t.push([n = S(Z()), tt("to", !0) ? S(Z()) : n]) : t.push(_()) } while (tt(",", !0));tt(";") } function C(t, e) { var i = 1; "-" === t.charAt(0) && (i = -1, t = t.substring(1)); var n = r(t); switch (n) { case "inf": return i * (1 / 0); case "nan": return NaN; case "0": return 0 } if (/^[1-9][0-9]*$/.test(t)) return i * parseInt(t, 10); if (/^0[x][0-9a-f]+$/.test(n)) return i * parseInt(t, 16); if (/^0[0-7]+$/.test(t)) return i * parseInt(t, 8); if (/^(?!e)[0-9]*(?:\.[0-9]*)?(?:[e][+-]?[0-9]+)? $/.test(n)) return i * parseFloat(t); throw x(t, "number", e) } function S(t, e) { var i = r(t);
switch (i) { case "max": return 536870911; case "0": return 0 } if ("-" === t.charAt(0) && !e) throw x(t, "id"); if (/^-?[1-9][0-9]*$/.test(t)) return parseInt(t, 10); if (/^-?0[x][0-9a-f]+$/.test(i)) return parseInt(t, 16); if (/^-?0[0-7]+$/.test(t)) return parseInt(t, 8); throw x(t, "id")
} function A() { if (q !== t) throw x("package"); if (q = Z(), !s(q)) throw x(q, "name"); st = st.define(q), tt(";") } function k() { var t, e = $(); switch (e) { case "weak": t = Y || (Y = []), Z(); break; case "public": Z(); default: t = V || (V = []) } e = _(), tt(";"), t.push(e) } function E() { if (tt("="), z = r(_()), !(nt = "proto3" === z) && "proto2" !== z) throw x(z, "syntax"); tt(";") } function I(t, e) { switch (e) { case "option": return N(t, e), tt(";"), !0; case "message": return M(t, e), !0; case "enum": return D(t, e),
!0; case "service": return j(t, e), !0; case "extend": return X(t, e), !0 } return !1
} function M(t, e) { var i = Z(); if (!n(i)) throw x(i, "type name"); var o = new u(i); if (o.comment = et(), o.filename = h.filename, tt("{", !0)) { for (; "}" !== (e = Z()); ) { var a = r(e); if (!I(o, e)) switch (a) { case "map": R(o, a); break; case "required": case "optional": case "repeated": O(o, a); break; case "oneof": L(o, a); break; case "extensions": T(o.extensions || (o.extensions = [])); break; case "reserved": T(o.reserved || (o.reserved = []), !0); break; default: if (!nt || !s(e)) throw x(e); Q(e), O(o, "optional") } } tt(";", !0) } else tt(";"); t.add(o) } function O(e, i, o) { var r = Z(); if ("group" === r) return B(e, i), t; if (!s(r)) throw x(r, "type"); var a = Z();
if (!n(a)) throw x(a, "name"); a = ot(a), tt("="); var l = new d(a,S(Z()),r,i,o) , c = J.line(); l.comment = et(), l.filename = h.filename, W(l), l.comment || (l.comment = et(c)), !nt && l.repeated && l.setOption("packed", !1, !0), e.add(l) } function B(t, e) { var i = Z(); if (!n(i)) throw x(i, "name"); var s = b.lcFirst(i); i === s && (i = b.ucFirst(i)), tt("="); var o = S(Z()) , a = new u(i); a.group = !0, a.comment = et(); var l = new d(s,o,i,e); for (a.filename = l.filename = h.filename, tt("{"); "}" !== (K = Z()); ) switch (K = r(K)) { case "option": N(a, K), tt(";"); break; case "required": case "optional": case "repeated": O(a, K); break; default: throw x(K) } tt(";", !0), t.add(a).add(l) } function R(e) { tt(""); var r = Z(); if (!n(r)) throw x(r, "name"); r = ot(r), tt("="); var a = new p(r,S(Z()),i,o)
, l = J.line(); a.comment = et(), a.filename = h.filename, W(a), a.comment || (a.comment = et(l)), e.add(a) } function L(t, e) { var i = Z(); if (!n(i)) throw x(i, "name"); i = ot(i); var s = new f(i) , o = J.line(); if (s.comment = et(), s.filename = h.filename, tt("{", !0)) { for (; "}" !== (e = Z()); ) "option" === e ? (N(s, e), tt(";")) : (Q(e), O(s, "optional")); tt(";", !0) } else tt(";"), s.comment || (s.comment = et(o)); t.add(s) } function D(t, e) { var i = Z(); if (!n(i)) throw x(i, "name"); var s = new m(i); if (s.comment = et(), s.filename = h.filename, tt("{", !0)) { for (; "}" !== (e = Z()); ) "option" === r(e) ? (N(s, e), tt(";")) : F(s, e); tt(";", !0) } else tt(";"); t.add(s) } function F(t, e) { if (!n(e)) throw x(e, "name"); var i = e; tt("="); var s = S(Z(), !0) , o = J.line(); t.add(i, s, et()), W({}), t.comments[i] || (t.comments[i] = et(o)) } function N(t, e) { var i = tt("(", !0) , n = Z(); if (!s(n)) throw x(n, "name");
i && (tt(")"), n = "(" + n + ")", e = $(), o(e) && (n += e, Z())), tt("="), G(t, n)
} function G(t, e) { if (tt("{", !0)) do { if (!n(K = Z())) throw x(K, "name"); "{" === $() ? G(t, e + "." + K) : (tt(":"), U(t, e + "." + K, P(!0))) } while (!tt("}", !0)); else U(t, e, P(!0)) } function U(t, e, i) { t.setOption && t.setOption(e, i) } function W(t) { if (tt("[", !0)) { do { N(t, "option") } while (tt(",", !0));tt("]") } return tt(";"), t } function j(t, e) { if (e = Z(), !n(e)) throw x(e, "service name"); var i = e , s = new g(i); if (s.comment = et(), s.filename = h.filename, tt("{", !0)) { for (; "}" !== (e = Z()); ) { var o = r(e); switch (o) { case "option": N(s, o), tt(";"); break; case "rpc": H(s, o); break; default: throw x(e) } } tt(";", !0) } else tt(";"); t.add(s) }
function H(t, e) { var i = e , o = Z(); if (!n(o)) throw x(o, "name"); var a, l, c, u; if (tt("("), tt("stream", !0) && (l = !0), !s(e = Z())) throw x(e); if (a = e, tt(")"), tt("returns"), tt("("), tt("stream", !0) && (u = !0), !s(e = Z())) throw x(e); c = e, tt(")"); var d = new y(o,i,a,c,l,u) , p = J.line(); if (d.comment = et(), d.filename = h.filename, tt("{", !0)) { for (; "}" !== (e = Z()); ) { var f = r(e); switch (f) { case "option": N(d, f), tt(";"); break; default: throw x(e) } } tt(";", !0) } else tt(";"), d.comment || (d.comment = et(p)); t.add(d) } function X(t, e) { var i = Z(); if (!s(i)) throw x(i, "reference"); if (tt("{", !0)) { for (; "}" !== (e = Z()); ) { var n = r(e); switch (n) { case "required": case "repeated": case "optional": O(t, n, i); break; default: if (!nt || !s(e)) throw x(e); Q(e), O(t, "optional", i)
} } tt(";", !0) } else tt(";")
} i instanceof c || (w = i, i = new c), w || (w = h.defaults); for (var q, V, Y, z, K, J = l(e), Z = J.next, Q = J.push, $ = J.peek, tt = J.skip, et = J.cmnt, it = !0, nt = !1, st = i, ot = w.keepCase ? function(t) { return t } : a; null !== (K = Z()); ) { switch (r(K)) { case "package": if (!it) throw x(K); A(); break; case "import": if (!it) throw x(K); k(); break; case "syntax": if (!it) throw x(K); E(); break; case "option": if (!it) throw x(K); N(st, K), tt(";"); break; default: if (I(st, K)) { it = !1; continue } throw x(K) } } return h.filename = null, { package: q, imports: V, weakImports: Y, syntax: z, root: i } } i.exports = h, h.filename = null, h.defaults = { keepCase: !1 };
} , {
var , , , , , , , , , ,
l c u d p f m g y v b
= = = = = = = = = = =
15: 16: 20: 22: 25: 29: 32: 33: 34: 35: 36:
15, 16, 20, 22, 25, 29, 32, 33, 34, 35, 36
e(33) e(29) e(34) e(16) e(20) e(25) e(15) e(32) e(22) e(35) e(36)
}], 27: [function(t, e) { function i(t, e) { return RangeError("index out of range: " + t.pos + " + " + (e || 1) + " > " + t.len) } function n(t) { this.buf = t, this.pos = 0, this.len = t.length } function s() { var t = new b(0,0) , e = 0; if (!(this.len - this.pos > 4)) { for (; e < 3; ++e) { if (this.pos >= this.len) throw i(this); if (t.lo = (t.lo | (127 & this.buf[this.pos]) >> 0, this.buf[this.pos++] < 128) return t } return t.lo = (t.lo | (127 & this.buf[this.pos++]) >> 0, t } for (; e < 4; ++e) if (t.lo = (t.lo | (127 & this.buf[this.pos]) >> 0, this.buf[this.pos++] < 128) return t; if (t.lo = (t.lo | (127 & this.buf[this.pos]) >> 0, t.hi = (t.hi | (127 & this.buf[this.pos]) >> 4) >>> 0, this.buf[this.pos++] < 128)
* e + 3) >>> 0,
return if (e = 0, this.len for (; if
t; this.pos > 4) { e < 5; ++e) (t.hi = (t.hi | (127 & this.buf[this.pos]) >> 0,
} else for (; e < 5; ++e) { if (this.pos >= this.len) throw i(this); if (t.hi = (t.hi | (127 & this.buf[this.pos]) > 0
this.pos += 4))
} function o() { return s.call(this).toLong() } function r() { return s.call(this).toNumber() } function a() { return s.call(this).toLong(!0) } function h() { return s.call(this).toNumber(!0) } function l() { return s.call(this).zzDecode().toLong() } function c() { return s.call(this).zzDecode().toNumber() } function u(t, e) { return (t[e - 4] | t[e - 3] >> 0, this.buf[this.pos++] < 128) return t; if (t = (t | (127 & this.buf[this.pos]) >> 0, this.buf[this.pos++] < 128) return t; if (t = (t | (127 & this.buf[this.pos]) >> 0, this.buf[this.pos++] < 128) return t; if (t = (t | (127 & this.buf[this.pos]) >> 0, this.buf[this.pos++] < 128) return t; if (t = (t | (15 & this.buf[this.pos]) >> 0, this.buf[this.pos++] < 128) return t; if ((this.pos += 5) > this.len) throw this.pos = this.len, i(this, 10); return t } }(), n.prototype.int32 = function() { return 0 | this.uint32() } , n.prototype.sint32 = function() { var t = this.uint32(); return t >>> 1 ^ -(1 & t) | 0 } , n.prototype.bool = function() { return 0 !== this.uint32() } , n.prototype.fixed32 = function() { if (this.pos + 4 > this.len) throw i(this, 4); return u(this.buf, this.pos += 4) } , n.prototype.sfixed32 = function() { if (this.pos + 4 > this.len)
throw i(this, 4); return 0 | u(this.buf, this.pos += 4) } ; var x = "undefined" != typeof Float32Array ? function() { var t = new Float32Array(1) , e = new Uint8Array(t.buffer); return t[0] = -0, e[3] ? function(i, n) { return e[0] = i[n], e[1] = i[n + 1], e[2] = i[n + 2], e[3] = i[n + 3], t[0] } : function(i, n) { return e[3] = i[n], e[2] = i[n + 1], e[1] = i[n + 2], e[0] = i[n + 3], t[0] } }() : function(t, e) { var i = u(t, e + 4) , n = 2 * (i >> 31) + 1 , s = i >>> 23 & 255 , o = 8388607 & i; return 255 === s ? o ? NaN : n * (1 / 0) : 0 === s ? 1.401298464324817e-45 * n * o : n * Math.pow(2, s - 150) * (o + 8388608) } ; n.prototype.float = function() { if (this.pos + 4 > this.len) throw i(this, 4); var t = x(this.buf, this.pos); return this.pos += 4, t } ; var _ = "undefined" != typeof Float64Array ? function() { var t = new Float64Array(1) , e = new Uint8Array(t.buffer); return t[0] = -0, e[7] ? function(i, n) { return e[0] = i[n], e[1] = i[n + 1], e[2] = i[n + 2], e[3] = i[n + 3], e[4] = i[n + 4], e[5] = i[n + 5], e[6] = i[n + 6], e[7] = i[n + 7], t[0] } : function(i, n) { return e[7] = i[n], e[6] = i[n + 1], e[5] = i[n + 2], e[4] = i[n + 3],
e[3] e[2] e[1] e[0] t[0]
= = = =
i[n i[n i[n i[n
+ + + +
4], 5], 6], 7],
} }() : function(t, e) { var i = u(t, e + 4) , n = u(t, e + 8) , s = 2 * (n >> 31) + 1 , o = n >>> 20 & 2047 , r = 4294967296 * (1048575 & n) + i; return 2047 === o ? r ? NaN : s * (1 / 0) : 0 === o ? 5e324 * s * r : s * Math.pow(2, o - 1075) * (r + 4503599627370496) } ; n.prototype.double = function() { if (this.pos + 8 > this.len) throw i(this, 4); var t = _(this.buf, this.pos); return this.pos += 8, t } , n.prototype.bytes = function() { var t = this.uint32() , e = this.pos , n = this.pos + t; if (n > this.len) throw i(this, t); return this.pos += t, e === n ? new this.buf.constructor(0) : this.j.call(this.buf, e, n) } , n.prototype.string = function() { var t = this.bytes(); return w.read(t, 0, t.length) } , n.prototype.skip = function(t) { if ("number" == typeof t) { if (this.pos + t > this.len) throw i(this, t); this.pos += t } else do { if (this.pos >= this.len) throw i(this) } while (128 & this.buf[this.pos++]);return this } , n.prototype.skipType = function(t) { switch (t) { case 0: this.skip(); break; case 1: this.skip(8);
break; case 2: this.skip(this.uint32()); break; case 3: for (; 4 != (t = 7 & this.uint32()); ) this.skipType(t); break; case 5: this.skip(4); break; default: throw Error("invalid wire type " + t + " at offset " +
this.pos)
} return this } , n.f = function(t) { y = t, v.Long ? (n.prototype.int64 = o, n.prototype.uint64 = a, n.prototype.sint64 = l, n.prototype.fixed64 = p, n.prototype.sfixed64 = m) : (n.prototype.int64 = r, n.prototype.uint64 = h, n.prototype.sint64 = c, n.prototype.fixed64 = f, n.prototype.sfixed64 = g) } } , { 38: 38 }], 28: [function(t, e) { function i(t) { n.call(this, t) } e.exports = i; var n = t(27); (i.prototype = Object.create(n.prototype)).constructor = i; var s = t(38); s.Buffer && (i.prototype.j = s.Buffer.prototype.slice), i.prototype.string = function() { var t = this.uint32(); return this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + t, this.len)) } } , { 27: 27, 38: 38 }], 29: [function(e, i) { function n(t) { r.call(this, "", t), this.deferred = [], this.files = [] }
function s() {} function o(e, i) { var n = i.parent.lookup(i.extend); if (n) { var s = new c(i.fullName,i.id,i.type,i.rule,t,i.options); return s.declaringField = i, i.extensionField = s, n.add(s), !0 } return !1 } i.exports = n; var r = e(23); ((n.prototype = Object.create(r.prototype)).constructor = n).className = "Root"; var a, h, l, c = e(16), u = e(15), d = e(36); n.fromJSON = function(t, e) { return e || (e = new n), t.options && e.setOptions(t.options), e.addJSON(t.nested) } , n.prototype.resolvePath = d.path.resolve, n.prototype.load = function e(i, n, o) { function r(t, e) { if (o) { var i = o; if (o = null, p) throw t; i(t, e) } } function a(t, e) { try { if (d.isString(e) && "{" === e.charAt(0) && (e = JSON.parse(e)), d.isString(e)) { h.filename = t; var i, s = h(e, u, n), o = 0; if (s.imports) for (; o < s.imports.length; ++o) (i = u.resolvePath(t, s.imports[o])) && c(i); if (s.weakImports) for (o = 0; o < s.weakImports.length; ++o) (i = u.resolvePath(t, s.weakImports[o])) && c(i, !0) } else u.setOptions(e.options).addJSON(e.nested) } catch (t) { r(t) } p || f || r(null, u) } function c(e, i) { var n = e.lastIndexOf("google/protobuf/");
if (n > -1) { var s = e.substring(n); s in l && (e = s) } if (!(u.files.indexOf(e) > -1)) { if (u.files.push(e), e in l) return p ? a(e, l[e]) : (++f, setTimeout(function() { --f, a(e, l[e]) })), t; if (p) { var h; try { h = d.fs.readFileSync(e).toString("utf8") } catch (e) { return i || r(e), t } a(e, h) } else ++f, d.fetch(e, function(n, s) { if (--f, o) return n ? (i ? f || r(null, u) : r(n), t) : (a(e, s), t) }) } } "function" == typeof n && (o = n, n = t); var u = this; if (!o) return d.asPromise(e, u, i); var p = o === s , f = 0; d.isString(i) && (i = [i]); for (var m, g = 0; g < i.length; ++g) (m = u.resolvePath("", i[g])) && c(m); return p ? u : (f || r(null, u), t)
} , n.prototype.loadSync = function(t, e) { if (!d.isNode) throw Error("not supported"); return this.load(t, e, s) } , n.prototype.resolveAll = function() { if (this.deferred.length) throw Error("unresolvable extensions: " + this.deferred.map(function(t) { return "'extend " + t.extend + "' in " + t.parent.fullName
}).join(", ")); return r.prototype.resolveAll.call(this) } ; var p = /^[A-Z]/; n.prototype.h = function(e) { if (e instanceof c) e.extend === t || e.extensionField || o(this, e) || this.deferred.push(e); else if (e instanceof u) p.test(e.name) && (e.parent[e.name] = e.values); else { if (e instanceof a) for (var i = 0; i < this.deferred.length; ) o(this, this.deferred[i]) ? this.deferred.splice(i, 1) : ++i; for (var n = 0; n < e.nestedArray.length; ++n) this.h(e.g[n]); p.test(e.name) && (e.parent[e.name] = e) } } , n.prototype.i = function(e) { if (e instanceof c) { if (e.extend !== t) if (e.extensionField) e.extensionField.parent.remove(e.extensionField), e.extensionField = null; else { var i = this.deferred.indexOf(e); i > -1 && this.deferred.splice(i, 1) } } else if (e instanceof u) p.test(e.name) && delete e.parent[e.name]; else if (e instanceof r) { for (var n = 0; n < e.nestedArray.length; ++n) this.i(e.g[n]); p.test(e.name) && delete e.parent[e.name] } } , n.f = function(t, e, i) { a = t, h = e, l = i } } , { 15: 15, 16: 16, 23: 23, 36: 36 }], 30: [function(t, e, i) { i.Service = t(31) } , { 31: 31
}], 31: [function(e, i) { function n(t, e, i) { if ("function" != typeof t) throw TypeError("rpcImpl must be a function"); s.EventEmitter.call(this), this.rpcImpl = t, this.requestDelimited = !!e, this.responseDelimited = !!i } i.exports = n; var s = e(38); (n.prototype = Object.create(s.EventEmitter.prototype)).constructor = n, n.prototype.rpcCall = function e(i, n, o, r, a) { if (!r) throw TypeError("request must be specified"); var h = this; if (!a) return s.asPromise(e, h, i, n, o, r); if (!h.rpcImpl) return setTimeout(function() { a(Error("already ended")) }, 0), t; try { return h.rpcImpl(i, n[h.requestDelimited ? "encodeDelimited" : "encode"](r).finish(), function(e, n) { if (e) return h.emit("error", e, i), a(e); if (null === n) return h.end(!0), t; if (!(n instanceof o)) try { n = o[h.responseDelimited ? "decodeDelimited" : "decode"](n) } catch (e) { return h.emit("error", e, i), a(e) } return h.emit("data", n, i), a(null, n) }) } catch (e) { return h.emit("error", e, i), setTimeout(function() { a(e) }, 0), t } } , n.prototype.end = function(t) { return this.rpcImpl && (t || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()),
}
this
} , { 38: 38 }], 32: [function(e, i) { function n(t, e) { o.call(this, t, e), this.methods = {}, this.k = null } function s(t) { return t.k = null, t } i.exports = n; var o = e(23); ((n.prototype = Object.create(o.prototype)).constructor = n).className = "Service"; var r = e(22) , a = e(36) , h = e(30); n.fromJSON = function(t, e) { var i = new n(t,e.options); if (e.methods) for (var s = Object.keys(e.methods), o = 0; o < s.length; ++o) i.add(r.fromJSON(s[o], e.methods[s[o]])); return i } , Object.defineProperty(n.prototype, "methodsArray", { get: function() { return this.k || (this.k = a.toArray(this.methods)) } }), n.prototype.toJSON = function() { var e = o.prototype.toJSON.call(this); return { options: e && e.options || t, methods: o.arrayToJSON(this.methodsArray) || {}, nested: e && e.nested || t } } , n.prototype.get = function(t) { return this.methods[t] || o.prototype.get.call(this, t) } , n.prototype.resolveAll = function() { for (var t = this.methodsArray, e = 0; e < t.length; ++e) t[e].resolve(); return o.prototype.resolve.call(this) } , n.prototype.add = function(t) { if (this.get(t.name)) throw Error("duplicate name '" + t.name + "' in " +
this);
return t instanceof r ? (this.methods[t.name] = t, t.parent = this, s(this)) : o.prototype.add.call(this, t)
} , n.prototype.remove = function(t) { if (t instanceof r) { if (this.methods[t.name] !== t) throw Error(t + " is not a member of " + this); return delete this.methods[t.name], t.parent = null, s(this) } return o.prototype.remove.call(this, t) } , n.prototype.create = function(t, e, i) { for (var n = new h.Service(t,e,i), s = 0; s < this.methodsArray.length; ++s) n[a.lcFirst(this.k[s].resolve().name)] = a.codegen("r", "c")("return this.rpcCall(m,q,s,r,c)").eof(a.lcFirst(this.k[s].name), { m: this.k[s], q: this.k[s].resolvedRequestType.ctor, s: this.k[s].resolvedResponseType.ctor }); return n } } , { 22: 22, 23: 23, 30: 30, 36: 36 }], 33: [function(e, i) { function n(t) { return t.replace(/\\(.?)/g, function(t, e) { switch (e) { case "\\": case "": return e; default: return n.map[e] || "" } }) } function s(e) { function i(t) { return Error("illegal " + t + " (line " + g + ")") } function s() { var t = "'" === x ? a : r; t.lastIndex = f - 1; var s = t.exec(e); if (!s) throw i("string"); return f = t.lastIndex, u(x),
x = null, n(s[1]) } function h(t) { return e.charAt(t) } function l(t, i) { y = e.charAt(t++), b = g; for (var n = e.substring(t, i).split(/\n/g), s = 0; s < n.length; ++s)
n[s] = n[s].replace(/^ *[*\/]+ */, "").trim(); v = n.join("\n").trim()
} function c() { if (w.length > 0) return w.shift(); if (x) return s(); var t, n, r, a, c; do { if (f === m) return null; for (t = !1; /\s/.test(r = h(f)); ) if ("\n" === r && ++g, ++f === m) return null; if ("/" === h(f)) { if (++f === m) throw i("comment"); if ("/" === h(f)) { for (c = "/" === h(a = f + 1); "\n" !== h(+ +f); )
if (f === m) return null;
++f, c && l(a, f - 1), ++g, t = !0 } else { if ("*" !== (r = h(f))) return "/"; c = "*" === h(a = f + 1); do { if ("\n" === r && ++g, ++f === m) throw i("comment"); n = r, r = h(f) } while ("*" !== n || "/" !== r);++f, c && l(a, f - 2), t = !0 }
} } while (t);var u = f; if (o.lastIndex = 0, !o.test(h(u++))) for (; u < m && !o.test(h(u)); ) ++u;
var d = e.substring(f, f = u); return '"' !== d && "'" !== d || (x = d), d
|| d(),
} function u(t) { w.push(t) } function d() { if (!w.length) { var t = c(); if (null === t) return null; u(t) } return w[0] } function p(t, e) { var n = d(); if (n === t) return c(), !0; if (!e) throw i("token '" + n + "', '" + t + "' expected"); return !1 } e = "" + e; var f = 0 , m = e.length , g = 1 , y = null , v = null , b = 0 , w = [] , x = null; return { next: c, peek: d, push: u, skip: p, line: function() { return g }, cmnt: function(e) { var i; return e === t ? i = b === g - 1 && v || null : (v i = b === e && "/" === y && v || null), i && (y = v = null, b = 0), i }
}
} i.exports = s; var o = /[\s{}=;:[\],'"()]/g , r = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g , a = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g; n.map = { 0: "\0",
r: "\r", n: "\n", t: "\t"
}, s.unescape = n
} , {}], 34: [function(e, i) { function n(e, i) { o.call(this, e, i), this.fields = {}, this.oneofs = t, this.extensions = t, this.reserved = t, this.group = t, this.l = null, this.b = null, this.d = null, this.o = null } function s(t) { return t.l = t.b = t.d = t.o = null, delete t.encode, delete t.decode, delete t.verify, t } i.exports = n; var o = e(23); ((n.prototype = Object.create(o.prototype)).constructor = n).className = "Type"; var r = e(15) , a = e(25) , h = e(16) , l = e(20) , c = e(32) , u = e(10) , d = e(21) , p = e(27) , f = e(40) , m = e(36) , g = e(14) , y = e(13) , v = e(39) , b = e(12); n.fromJSON = function(e, i) { var s = new n(e,i.options); s.extensions = i.extensions, s.reserved = i.reserved; for (var u = Object.keys(i.fields), d = 0; d < u.length; + +d) s.add((t !== i.fields[u[d]].keyType ? l.fromJSON : h.fromJSON)(u[d], i.fields[u[d]])); if (i.oneofs) for (u = Object.keys(i.oneofs), d = 0; d < u.length; ++d) s.add(a.fromJSON(u[d], i.oneofs[u[d]])); if (i.nested) for (u = Object.keys(i.nested),
d = 0; d < u.length; ++d) { var p = i.nested[u[d]]; s.add((p.id !== t ? h.fromJSON : p.fields !== t ? n.fromJSON : p.values !== t ? r.fromJSON : p.methods !== t ? c.fromJSON : o.fromJSON)(u[d], p)) } return i.extensions && i.extensions.length && (s.extensions = i.extensions), i.reserved && i.reserved.length && (s.reserved = i.reserved), i.group && (s.group = !0), s } , Object.defineProperties(n.prototype, { fieldsById: { get: function() { if (this.l) return this.l; this.l = {}; for (var t = Object.keys(this.fields), e = 0; e < t.length; ++e) { var i = this.fields[t[e]] , n = i.id; if (this.l[n]) throw Error("duplicate id " + n + " in " + this); this.l[n] = i } return this.l } }, fieldsArray: { get: function() { return this.b || (this.b = m.toArray(this.fields)) } }, oneofsArray: { get: function() { return this.d || (this.d = m.toArray(this.oneofs)) } }, ctor: { get: function() { return this.o || (this.o = u(this).constructor) }, set: function(t) { if (t && !(t.prototype instanceof d)) throw TypeError("ctor must be a Message constructor"); t.from || (t.from = d.from), this.o = t } } }), n.prototype.toJSON = function() { var e = o.prototype.toJSON.call(this); return { options: e && e.options || t,
oneofs: o.arrayToJSON(this.oneofsArray), fields: o.arrayToJSON(this.fieldsArray.filter(function(t) { return !t.declaringField })) || {}, extensions: this.extensions && this.extensions.length ? this.extensions : t, reserved: this.reserved && this.reserved.length ? this.reserved : t, group: this.group || t, nested: e && e.nested || t } } , n.prototype.resolveAll = function() { for (var t = this.fieldsArray, e = 0; e < t.length; ) t[e++].resolve(); var i = this.oneofsArray; for (e = 0; e < i.length; ) i[e++].resolve(); return o.prototype.resolve.call(this) } , n.prototype.get = function(t) { return this.fields[t] || this.oneofs && this.oneofs[t] || this.nested && this.nested[t] || null } , n.prototype.add = function(e) { if (this.get(e.name)) throw Error("duplicate name '" + e.name + "' in " + this); if (e instanceof h && e.extend === t) { if (this.l ? this.l[e.id] : this.fieldsById[e.id]) throw Error("duplicate id " + e.id + " in " + this); if (this.isReservedId(e.id)) throw Error("id " + e.id + " is reserved in " + this); if (this.isReservedName(e.name)) throw Error("name '" + e.name + "' is reserved in " + this); return e.parent && e.parent.remove(e), this.fields[e.name] = e, e.message = this, e.onAdd(this), s(this) } return e instanceof a ? (this.oneofs || (this.oneofs = {}), this.oneofs[e.name] = e, e.onAdd(this), s(this)) : o.prototype.add.call(this, e) } , n.prototype.remove = function(e) { if (e instanceof h && e.extend === t) { if (!this.fields || this.fields[e.name] !== e) throw Error(e + " is not a member of " + this); return delete this.fields[e.name],
e.parent = null, e.onRemove(this), s(this)
} if (e instanceof a) { if (!this.oneofs || this.oneofs[e.name] !== e) throw Error(e + " is not a member of " + this); return delete this.oneofs[e.name], e.parent = null, e.onRemove(this), s(this) } return o.prototype.remove.call(this, e)
} , n.prototype.isReservedId = function(t) { if (this.reserved) for (var e = 0; e < this.reserved.length; ++e) if ("string" != typeof this.reserved[e] && this.reserved[e][0] = t) return !0; return !1 } , n.prototype.isReservedName = function(t) { if (this.reserved) for (var e = 0; e < this.reserved.length; ++e) if (this.reserved[e] === t) return !0; return !1 } , n.prototype.create = function(t) { return new this.ctor(t) } , n.prototype.setup = function() { for (var t = this.fullName, e = [], i = 0; i < this.fieldsArray.length; ++i) e.push(this.b[i].resolve().resolvedType); return this.encode = g(this).eof(t + "$encode", { Writer: f, types: e, util: m }), this.decode = y(this).eof(t + "$decode", { Reader: p, types: e, util: m }), this.verify = v(this).eof(t + "$verify", { types: e, util: m }), this.fromObject = this.from = b.fromObject(this).eof(t + "$fromObject", { types: e, util: m }),
this.toObject = b.toObject(this).eof(t + "$toObject", { types: e, util: m }), this
} , n.prototype.encode = function(t, e) { return this.setup().encode(t, e) } , n.prototype.encodeDelimited = function(t, e) { return this.encode(t, e && e.len ? e.fork() : e).ldelim() } , n.prototype.decode = function(t, e) { return this.setup().decode(t, e) } , n.prototype.decodeDelimited = function(t) { return t instanceof p || (t = p.create(t)), this.decode(t, t.uint32()) } , n.prototype.verify = function(t) { return this.setup().verify(t) } , n.prototype.fromObject = function(t) { return this.setup().fromObject(t) } , n.prototype.from = n.prototype.fromObject, n.prototype.toObject = function(t, e) { return this.setup().toObject(t, e) } } , { 10: 12: 13: 14: 15: 16: 20: 21: 23: 25: 27: 32: 36: 39: 40:
10, 12, 13, 14, 15, 16, 20, 21, 23, 25, 27, 32, 36, 39, 40
}], 35: [function(t, e, i) { function n(t, e) { var i = 0 , n = {}; for (e |= 0; i < t.length; )
n[r[i + e]] = t[i++]; return n } var s = i , o = t(36) , r = ["double", "float", "int32", "uint32", "sint32", "fixed32", "sfixed32", "int64", "uint64", "sint64", "fixed64", "sfixed64", "bool", "string", "bytes"]; s.basic = n([1, 5, 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0, 2, 2]), s.defaults = n([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, !1, "", o.emptyArray, null]), s.long = n([0, 0, 0, 1, 1], 7), s.mapKey = n([0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0, 2], 2), s.packed = n([1, 5, 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0]) } , { 36: 36 }], 36: [function(t, e) { var i = e.exports = t(38); i.codegen = t(3), i.fetch = t(5), i.path = t(7), i.fs = i.inquire("fs"), i.toArray = function(t) { var e = []; if (t) for (var i = Object.keys(t), n = 0; n < i.length; ++n) e.push(t[i[n]]); return e } , i.safeProp = function(t) { return '["' + t.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"]' } , i.ucFirst = function(t) { return t.charAt(0).toUpperCase() + t.substring(1) } } , { 3: 3, 38: 38, 5: 5, 7: 7 }], 37: [function(t, e) { function i(t, e) { this.lo = t >>> 0, this.hi = e >>> 0 } e.exports = i; var n = t(38) , s = i.zero = new i(0,0); s.toNumber = function() { return 0 } ,
s.zzEncode = s.zzDecode = function() { return this } , s.length = function() { return 1 } ; var o = i.zeroHash = "\0\0\0\0\0\0\0\0"; i.fromNumber = function(t) { if (0 === t) return s; var e = t < 0; e && (t = -t); var n = t >>> 0 , o = (t - n) / 4294967296 >>> 0; return e && (o = ~o >>> 0, n = ~n >>> 0, ++n > 4294967295 && (n = 0, ++o > 4294967295 && (o = 0))), new i(n,o) } , i.from = function(t) { if ("number" == typeof t) return i.fromNumber(t); if (n.isString(t)) { if (!n.Long) return i.fromNumber(parseInt(t, 10)); t = n.Long.fromString(t) } return t.low || t.high ? new i(t.low >>> 0,t.high >>> 0) : s
} , i.prototype.toNumber = function(t) { if (!t && this.hi >>> 31) { var e = 1 + ~this.lo >>> 0 , i = ~this.hi >>> 0; return e || (i = i + 1 >>> 0), -(e + 4294967296 * i) } return this.lo + 4294967296 * this.hi } , i.prototype.toLong = function(t) { return n.Long ? new n.Long(0 | this.lo,0 | this.hi,!!t) : { low: 0 | this.lo, high: 0 | this.hi, unsigned: !!t } } ; var r = String.prototype.charCodeAt; i.fromHash = function(t) { return t === o ? s : new i((r.call(t, 0) | r.call(t, 1) 0,(r.call(t, 4) | r.call(t, 5) 0) }
, i.prototype.toHash = function() { return String.fromCharCode(255 & this.lo, this.lo >>> 8 & 255, this.lo >>> 16 & 255, this.lo >>> 24, 255 & this.hi, this.hi >>> 8 & 255, this.hi >>> 16 & 255, this.hi >>> 24) } , i.prototype.zzEncode = function() { var t = this.hi >> 31; return this.hi = ((this.hi >> 31) ^ t) >>> 0, this.lo = (this.lo >> 0, this } , i.prototype.zzDecode = function() { var t = -(1 & this.lo); return this.lo = ((this.lo >>> 1 | this.hi >> 0, this.hi = (this.hi >>> 1 ^ t) >>> 0, this } , i.prototype.length = function() { var t = this.lo , e = (this.lo >>> 28 | this.hi >> 0 , i = this.hi >>> 24; return 0 === i ? 0 === e ? t < 16384 ? t < 128 ? 1 : 2 : t < 2097152 ? 3 : 4 : e < 16384 ? e < 128 ? 5 : 6 : e < 2097152 ? 7 : 8 : i < 128 ? 9 : 10 } } , { 38: 38 }], 38: [function(i, n, s) { var o = s; o.asPromise = i(1), o.base64 = i(2), o.EventEmitter = i(4), o.inquire = i(6), o.utf8 = i(9), o.pool = i(8), o.LongBits = i(37), o.emptyArray = Object.freeze ? Object.freeze([]) : [], o.emptyObject = Object.freeze ? Object.freeze({}) : {}, o.isNode = !!(e.process && e.process.versions && e.process.versions.node), o.isInteger = Number.isInteger || function(t) { return "number" == typeof t && isFinite(t) && Math.floor(t) === t } , o.isString = function(t) { return "string" == typeof t || t instanceof String } , o.isObject = function(t) { return t && "object" == typeof t
} , o.Buffer = function() { try { var t = o.inquire("buffer").Buffer; return t.prototype.utf8Write ? t : null } catch (t) { return null } }(), o.p = null, o.u = null, o.newBuffer = function(t) { return "number" == typeof t ? o.Buffer ? o.u(t) : new o.Array(t) : o.Buffer ? o.p(t) : "undefined" == typeof Uint8Array ? t : new Uint8Array(t) } , o.Array = "undefined" != typeof Uint8Array ? Uint8Array : Array, o.Long = e.dcodeIO && e.dcodeIO.Long || o.inquire("long"), o.longToHash = function(t) { return t ? o.LongBits.from(t).toHash() : o.LongBits.zeroHash } , o.longFromHash = function(t, e) { var i = o.LongBits.fromHash(t); return o.Long ? o.Long.fromBits(i.lo, i.hi, e) : i.toNumber(!!e) } , o.merge = function(e, i, n) { for (var s = Object.keys(i), o = 0; o < s.length; ++o) e[s[o]] !== t && n || (e[s[o]] = i[s[o]]); return e } , o.lcFirst = function(t) { return t.charAt(0).toLowerCase() + t.substring(1) } , o.oneOfGetter = function(e) { for (var i = {}, n = 0; n < e.length; ++n) i[e[n]] = 1; return function() { for (var e = Object.keys(this), n = e.length - 1; n > -1; --n) if (1 === i[e[n]] && this[e[n]] !== t && null !== this[e[n]]) return e[n] } } , o.oneOfSetter = function(t) { return function(e) { for (var i = 0; i < t.length; ++i) t[i] !== e && delete this[t[i]] }
} , o.lazyResolve = function(t, e) { for (var i = 0; i < e.length; ++i) for (var n = Object.keys(e[i]), s = 0; s < n.length; +
+s) {
for (var o = e[i][n[s]].split("."), r = t;
o.length; )
r = r[o.shift()]; e[i][n[s]] = r } } , o.toJSONOptions = { longs: String, enums: String, bytes: String }, o.f = function() { var e = o.Buffer; return e ? (o.p = e.from !== Uint8Array.from && e.from ||
function(t, i) {
}
return new e(t,i) } , o.u = e.allocUnsafe || function(t) { return new e(t) } , t) : (o.p = o.u = null, t)
} , { 1: 1, 2: 2, 37: 37, 4: 4, 6: 6, 8: 8, 9: 9
}], 39: [function(t, e) { function i(t, e) { return t.name + ": " + e + (t.repeated && "array" !== e ? "[]" : t.map && "object" !== e ? "{k:" + t.keyType + "}" : "") + " expected" } function n(t, e, n, s) { if (e.resolvedType) if (e.resolvedType instanceof r) { t("switch(%s){", s)("default:")("return%j", i(e, "enum value")); for (var o = Object.keys(e.resolvedType.values), a = 0; a < o.length; ++a) t("case %d:", e.resolvedType.values[o[a]]); t("break")("}") } else t("var e=types[%d].verify(%s);", n, s)("if(e)") ("return%j+e", e.name + ".");
else
switch (e.type) { case "int32": case "uint32": case "sint32": case "fixed32": case "sfixed32": t("if(!util.isInteger(%s))", s)("return%j", i(e,
"integer"));
break; "int64": "uint64": "sint64": "fixed64": "sfixed64": t("if(!util.isInteger(%s)&&! (%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", s, s, s, s)("return%j", i(e, "integer|Long")); break; case "float": case "double": t('if(typeof %s!=="number")', s)("return%j", i(e, "number")); break; case "bool": t('if(typeof %s!=="boolean")', s)("return%j", i(e, "boolean")); break; case "string": t("if(!util.isString(%s))", s)("return%j", i(e, "string")); break; case "bytes": t('if(!(%s&&typeof %s.length==="number"|| util.isString(%s)))', s, s, s)("return%j", i(e, "buffer")) } return t } function s(t, e, n) { switch (e.keyType) { case "int32": case "uint32": case "sint32": case "fixed32": case "sfixed32": t("if(!/^-?(?:0|[1-9][0-9]*)$/.test(%s))", n)("return %j", i(e, "integer key")); break; case "int64": case "uint64": case "sint64": case "fixed64": case "sfixed64": t("if(!/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*)) $/.test(%s))", n)("return%j", i(e, "integer|Long key")); break; case "bool": t("if(!/^true|false|0|1$/.test(%s))", n)("return%j", i(e, "boolean key")) case case case case case
} return t } function o(t) { for (var e = a.codegen("m")('if(typeof m!=="object"|| m===null)')("return%j", "object expected"), o = 0; o < t.fieldsArray.length; ++o) { var h = t.b[o].resolve() , l = "m" + a.safeProp(h.name); h.map ? (e("if(%s!==undefined){", l)("if(! util.isObject(%s))", l)("return%j", i(h, "object"))("var k=Object.keys(%s)", l) ("for(var i=0;i 0 ? this._maxWidth : null, l = [], c = 0; c < i.length; c++) { var u = c === i.length - 1; if (/(?:\r\n|\r|\n)/.test(i.charAt(c))) return { width: s,
text: i.substr(0, c), end: u, chars: l
}; var d = i.charCodeAt(c) , p = t.chars[d] , f = 0; void 0 === p && (d = 32, p = t.chars[d]); var m = a && p.kerning[a] ? p.kerning[a] : 0; if (/(\s)/.test(i.charAt(c)) && (o = c, r = s), f = (m + p.texture.width + p.xOffset) * e, h && s + f >= h && o > -1) return { width: r || s, text: i.substr(0, c - (c - o)), end: u, chars: l }; s += (p.xAdvance + m) * e, l.push(n + (p.xOffset + m) * e), n += (p.xAdvance + m) * e, a = d } return { width: s, text: i, end: u, chars: l }
} , s.BitmapText.prototype.cleanText = function(t, e) { void 0 === e && (e = ""); var i = this._data.font; if (!i) return ""; for (var n = /\r\n|\n\r|\n|\r/g, s = t.replace(n, "\n").split("\n"), o = 0; o < s.length; o++) { for (var r = "", a = s[o], h = 0; h < a.length; h++) r = i.chars[a.charCodeAt(h)] ? r.concat(a[h]) : r.concat(e); s[o] = r } return s.join("\n") } , s.BitmapText.prototype.updateText = function() { var t = this._data.font; if (t) { var e = this.text , i = this._fontSize / t.size , n = [] , s = 0; this.textWidth = 0; do { var o = this.scanLine(t, i, e); o.y = s, n.push(o),
o.width > this.textWidth && (this.textWidth = o.width), s += t.lineHeight * i, e = e.substr(o.text.length + 1) } while (!1 === o.end);this.textHeight = s; for (var r = 0, a = 0, h = this.textWidth * this.anchor.x, l = this.textHeight * this.anchor.y, c = 0; c < n.length; c++) { var o = n[c]; "right" === this._align ? a = this.textWidth - o.width : "center" === this._align && (a = (this.textWidth - o.width) / 2); for (var u = 0; u < o.text.length; u++) { var d = o.text.charCodeAt(u) , p = t.chars[d]; void 0 === p && (d = 32, p = t.chars[d]); var f = this._glyphs[r]; f ? f.texture = p.texture : (f = new PIXI.Sprite(p.texture), f.name = o.text[u], this._glyphs.push(f)), f.position.x = o.chars[u] + a - h, f.position.y = o.y + p.yOffset * i - l, f.scale.set(i), f.tint = this.tint, f.texture.requiresReTint = !0, f.parent || this.addChild(f), r++ } } for (c = r; c < this._glyphs.length; c++) this.removeChild(this._glyphs[c]) } } , s.BitmapText.prototype.purgeGlyphs = function() { for (var t = this._glyphs.length, e = [], i = 0; i < this._glyphs.length; i++) this._glyphs[i].parent !== this ? this._glyphs[i].destroy() : e.push(this._glyphs[i]); return this._glyphs = [], this._glyphs = e, this.updateText(), t - e.length } , s.BitmapText.prototype.updateTransform = function() { !this.dirty && this.anchor.equals(this._prevAnchor) || (this.updateText(), this.dirty = !1, this._prevAnchor.copyFrom(this.anchor)), PIXI.DisplayObjectContainer.prototype.updateTransform.call(this) } , Object.defineProperty(s.BitmapText.prototype, "align", { get: function() { return this._align }, set: function(t) { t === this._align || "left" !== t && "center" !== t && "right" !== t || (this._align = t,
}
this.updateText())
}), Object.defineProperty(s.BitmapText.prototype, "tint", { get: function() { return this._tint }, set: function(t) { t !== this._tint && (this._tint = t, this.updateText()) } }), Object.defineProperty(s.BitmapText.prototype, "font", { get: function() { return this._font }, set: function(t) { t !== this._font && (this._font = t.trim(), this._data = this.game.cache.getBitmapFont(this._font), this.updateText()) } }), Object.defineProperty(s.BitmapText.prototype, "fontSize", { get: function() { return this._fontSize }, set: function(t) { (t = parseInt(t, 10)) !== this._fontSize && t > 0 && (this._fontSize = t, this.updateText()) } }), Object.defineProperty(s.BitmapText.prototype, "text", { get: function() { return this._text }, set: function(t) { t !== this._text && (this._text = t.toString() || "", this.updateText()) } }), Object.defineProperty(s.BitmapText.prototype, "maxWidth", { get: function() { return this._maxWidth }, set: function(t) { t !== this._maxWidth && (this._maxWidth = t, this.updateText()) } }), Object.defineProperty(s.BitmapText.prototype, "smoothed", { get: function() { return !this._data.base.scaleMode }, set: function(t) { this._data.base.scaleMode = t ? 0 : 1 } }), s.RetroFont = function(t, e, i, n, o, r, a, h, l, c) {
if (!t.cache.checkImageKey(e)) return !1; void 0 !== r && null !== r || (r = t.cache.getImage(e).width / i), this.characterWidth = i, this.characterHeight = n, this.characterSpacingX = a || 0, this.characterSpacingY = h || 0, this.characterPerRow = r, this.offsetX = l || 0, this.offsetY = c || 0, this.align = "left", this.multiLine = !1, this.autoUpperCase = !0, this.customSpacingX = 0, this.customSpacingY = 0, this.fixedWidth = 0, this.fontSet = t.cache.getImage(e), this._text = "", this.grabData = [], this.frameData = new s.FrameData; for (var u = this.offsetX, d = this.offsetY, p = 0, f = 0; f < o.length; f++) { var m = this.frameData.addFrame(new s.Frame(f,u,d,this.characterWidth,this.characterHeight)); this.grabData[o.charCodeAt(f)] = m.index, p++, p === this.characterPerRow ? (p = 0, u = this.offsetX, d += this.characterHeight + this.characterSpacingY) : u += this.characterWidth + this.characterSpacingX } t.cache.updateFrameData(e, this.frameData), this.stamp = new s.Image(t,0,0,e,0), s.RenderTexture.call(this, t, 100, 100, "", s.scaleModes.NEAREST), this.type = s.RETROFONT } , s.RetroFont.prototype = Object.create(s.RenderTexture.prototype), s.RetroFont.prototype.constructor = s.RetroFont, s.RetroFont.ALIGN_LEFT = "left", s.RetroFont.ALIGN_RIGHT = "right", s.RetroFont.ALIGN_CENTER = "center", s.RetroFont.TEXT_SET1 = " !\"#$%&'()*+,-./0123456789:;? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", s.RetroFont.TEXT_SET2 = " !\"#$%&'()*+,-./0123456789:;? @ABCDEFGHIJKLMNOPQRSTUVWXYZ", s.RetroFont.TEXT_SET3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ", s.RetroFont.TEXT_SET4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789", s.RetroFont.TEXT_SET5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789", s.RetroFont.TEXT_SET6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ", s.RetroFont.TEXT_SET7 = "AGMSY+:4BHNTZ!;5CIOU.?06DJPV, (17EKQW\")28FLRX-'39", s.RetroFont.TEXT_SET8 = "0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ", s.RetroFont.TEXT_SET9 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!", s.RetroFont.TEXT_SET10 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", s.RetroFont.TEXT_SET11 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!? ()':;0123456789", s.RetroFont.prototype.setFixedWidth = function(t, e) {
void 0 === e && (e = "left"), this.fixedWidth = t, this.align = e
} , s.RetroFont.prototype.setText = function(t, e, i, n, s, o) { this.multiLine = e || !1, this.customSpacingX = i || 0, this.customSpacingY = n || 0, this.align = s || "left", this.autoUpperCase = !o, t.length > 0 && (this.text = t) } , s.RetroFont.prototype.buildRetroFontText = function() { var t = 0 , e = 0; if (this.clear(), this.multiLine) { var i = this._text.split("\n"); this.fixedWidth > 0 ? this.resize(this.fixedWidth, i.length * (this.characterHeight + this.customSpacingY) - this.customSpacingY, !0) : this.resize(this.getLongestLine() * (this.characterWidth + this.customSpacingX), i.length * (this.characterHeight + this.customSpacingY) - this.customSpacingY, !0); for (var n = 0; n < i.length; n++) t = 0, this.align === s.RetroFont.ALIGN_RIGHT ? t = this.width i[n].length * (this.characterWidth + this.customSpacingX) : this.align === s.RetroFont.ALIGN_CENTER && (t = this.width / 2 - i[n].length * (this.characterWidth + this.customSpacingX) / 2, t += this.customSpacingX / 2), t < 0 && (t = 0), this.pasteLine(i[n], t, e, this.customSpacingX), e += this.characterHeight + this.customSpacingY } else this.fixedWidth > 0 ? this.resize(this.fixedWidth, this.characterHeight, !0) : this.resize(this._text.length * (this.characterWidth + this.customSpacingX), this.characterHeight, !0), t = 0, this.align === s.RetroFont.ALIGN_RIGHT ? t = this.width this._text.length * (this.characterWidth + this.customSpacingX) : this.align === s.RetroFont.ALIGN_CENTER && (t = this.width / 2 - this._text.length * (this.characterWidth + this.customSpacingX) / 2, t += this.customSpacingX / 2), t < 0 && (t = 0), this.pasteLine(this._text, t, 0, this.customSpacingX); this.requiresReTint = !0 } , s.RetroFont.prototype.pasteLine = function(t, e, i, n) { for (var s = 0; s < t.length; s++) if (" " === t.charAt(s)) e += this.characterWidth + n; else if (this.grabData[t.charCodeAt(s)] >= 0 && (this.stamp.frame = this.grabData[t.charCodeAt(s)], this.renderXY(this.stamp, e, i, !1), (e += this.characterWidth + n) > this.width)) break }
, s.RetroFont.prototype.getLongestLine = function() { var t = 0; if (this._text.length > 0) for (var e = this._text.split("\n"), i = 0; i < e.length; i++) e[i].length > t && (t = e[i].length); return t } , s.RetroFont.prototype.removeUnsupportedCharacters = function(t) { for (var e = "", i = 0; i < this._text.length; i++) { var n = this._text[i] , s = n.charCodeAt(0); (this.grabData[s] >= 0 || !t && "\n" === n) && (e = e.concat(n)) } return e } , s.RetroFont.prototype.updateOffset = function(t, e) { if (this.offsetX !== t || this.offsetY !== e) { for (var i = t - this.offsetX, n = e - this.offsetY, s = this.game.cache.getFrameData(this.stamp.key).getFrames(), o = s.length; o--; ) s[o].x += i, s[o].y += n; this.buildRetroFontText() } } , Object.defineProperty(s.RetroFont.prototype, "text", { get: function() { return this._text }, set: function(t) { var e; (e = this.autoUpperCase ? t.toUpperCase() : t) !== this._text && (this._text = e, this.removeUnsupportedCharacters(this.multiLine), this.buildRetroFontText()) } }), Object.defineProperty(s.RetroFont.prototype, "smoothed", { get: function() { return this.stamp.smoothed }, set: function(t) { this.stamp.smoothed = t, this.buildRetroFontText() } }), s.Rope = function(t, e, i, n, o, r) { this.points = [], this.points = r, this._hasUpdateAnimation = !1, this._updateAnimationCallback = null, e = e || 0, i = i || 0, n = n || null, o = o || null, this.type = s.ROPE,
this.points = r, PIXI.DisplayObjectContainer.call(this), this.texture = s.Cache.DEFAULT, this.uvs = new Float32Array([0, 1, 1, 1, 1, 0, 0, 1]), this.vertices = new Float32Array([0, 0, 100, 0, 100, 100, 0, 100]), this.colors = new Float32Array([1, 1, 1, 1]), this.indices = new Uint16Array([0, 1, 2, 3]), r && (this.vertices = new Float32Array(4 * r.length), this.uvs = new Float32Array(4 * r.length), this.colors = new Float32Array(2 * r.length), this.indices = new Uint16Array(2 * r.length)), this.dirty = !0, this.canvasPadding = 0, this.drawMode = s.Rope.TRIANGLE_STRIP, s.Component.Core.init.call(this, t, e, i, n, o), this.refresh() } , s.Rope.prototype = Object.create(PIXI.DisplayObjectContainer.prototype), s.Rope.prototype.constructor = s.Rope, s.Component.Core.install.call(s.Rope.prototype, ["Angle", "Animation", "AutoCull", "Bounds", "BringToTop", "Crop", "Delta", "Destroy", "FixedToCamera", "InWorld", "LifeSpan", "LoadTexture", "Overlap", "PhysicsBody", "Reset", "ScaleMinMax", "Smoothed"]), s.Rope.prototype.preUpdatePhysics = s.Component.PhysicsBody.preUpdate, s.Rope.prototype.preUpdateLifeSpan = s.Component.LifeSpan.preUpdate, s.Rope.prototype.preUpdateInWorld = s.Component.InWorld.preUpdate, s.Rope.prototype.preUpdateCore = s.Component.Core.preUpdate, s.Rope.TRIANGLE_STRIP = 0, s.Rope.TRIANGLES = 1, s.Rope.prototype.preUpdate = function() { return !!(this.preUpdatePhysics() && this.preUpdateLifeSpan() && this.preUpdateInWorld()) && this.preUpdateCore() } , s.Rope.prototype.update = function() { this._hasUpdateAnimation && this.updateAnimation.call(this) } , s.Rope.prototype.reset = function(t, e) { return s.Component.Reset.prototype.reset.call(this, t, e), this } , s.Rope.prototype.refresh = function() { var t = this.points; if (!(t.length < 1)) { var e = this.uvs , i = this.indices , n = this.colors; this.count -= .2, e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, n[0] = 1, n[1] = 1, i[0] = 0, i[1] = 1;
}
c; u++)
for (var s, o, s = 4 * a, o = a / (r e[s] = o, e[s + 1] = e[s + 2] = e[s + 3] = s = 2 * a, n[s] = 1, n[s + 1] = s = 2 * a, i[s] = s, i[s + 1] =
r = t.length, a = 1; a < r; a++) - 1), 0, o, 1, 1, s + 1
} , s.Rope.prototype.updateTransform = function() { var t = this.points; if (!(t.length < 1)) { var e, i = t[0], n = { x: 0, y: 0 }; this.count -= .2; for (var s, o, r, a, h, l = this.vertices, c = t.length, u = 0; u < s = t[u], o = 4 * u, e = u < t.length - 1 ? t[u + 1] : s, n.y = -(e.x - i.x), n.x = e.y - i.y, r = 10 * (1 - u / (c - 1)), r > 1 && (r = 1), a = Math.sqrt(n.x * n.x + n.y * n.y), h = this.texture.height / 2, n.x /= a, n.y /= a, n.x *= h, n.y *= h, l[o] = s.x + n.x, l[o + 1] = s.y + n.y, l[o + 2] = s.x - n.x, l[o + 3] = s.y - n.y, i = s; PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)
} } , s.Rope.prototype.setTexture = function(t) { this.texture = t } , s.Rope.prototype._renderWebGL = function(t) { !this.visible || this.alpha 0) { var x = this.canvasPadding / this.worldTransform.a , _ = this.canvasPadding / this.worldTransform.d , P = (l + c + u) / 3 , T = (d + p + f) / 3 , C = l - P , S = d - T , A = Math.sqrt(C * C + S * S); l = P + C / A * (A + x), d = T + S / A * (A + _),
C S A c p C S A u f
= = = = = = = = = =
c - P, p - T, Math.sqrt(C P + C / A * T + S / A * u - P, f - T, Math.sqrt(C P + C / A * T + S / A *
} t.save(), t.beginPath(), t.moveTo(l, d), t.lineTo(c, p), t.lineTo(u, f), t.closePath(), t.clip(); var k = m * b + , E = l * b + , I = m * c + , M = m * b * c * w
p * w;
v v l u
* * * +
* C + S * S), (A + x), (A + _), * C + S * S), (A + x), (A + _)
y u y v
+ + + *
g c g c
* * * *
w w u y
+
b b c l
* * * *
y u y g
*
v v l w
* * * -
g c g l
*
m l m b
* * * *
w w u y - v * g * u - m *
, O = d * b + v * f + p * w - b * f - v * p - d * w , B = m * p + d * y + g * f - p * y - d * g - m * f , R = m * b * f + v * p * y + d * g * w - d * b * y - v * g * f - m * t.transform(E / k, O / k, I / k, B / k, M / k, R / k), t.drawImage(r, 0, 0), t.restore()
} , s.Rope.prototype.renderStripFlat = function(t) { var e = this.context , i = t.vertices , n = i.length / 2; this.count++, e.beginPath(); for (var s = 1; s < n - 2; s++) { var o = 2 * s , r = i[o] , a = i[o + 2] , h = i[o + 4] , l = i[o + 1] , c = i[o + 3] , u = i[o + 5]; e.moveTo(r, l), e.lineTo(a, c), e.lineTo(h, u) } e.fillStyle = "#FF0000", e.fill(), e.closePath() } , s.Rope.prototype.getBounds = function(t) { for (var e = t || this.worldTransform, i = e.a, n = e.b, s = e.c, o = e.d, r = e.tx, a = e.ty, h = -1 / 0, l = -1 / 0, c = 1 / 0, u = 1 / 0, d = this.vertices, p = 0; p < d.length; p += 2) {
var , , , c = u = h = l =
f m g y g y g y
= = = = < < > >
d[p] d[p + i * f o * m c ? g u ? y h ? g l ? y
1] + s * m + r + n * f + a; : c, : u, : h, : l
} if (c === -1 / 0 || l === 1 / 0) return PIXI.EmptyRectangle; var v = this._bounds; return v.x = c, v.width = h - c, v.y = u, v.height = l - u, this._currentBounds = v, v } , Object.defineProperty(s.Rope.prototype, "updateAnimation", { get: function() { return this._updateAnimation }, set: function(t) { t && "function" == typeof t ? (this._hasUpdateAnimation = !0, this._updateAnimation = t) : (this._hasUpdateAnimation = !1, this._updateAnimation = null) } }), Object.defineProperty(s.Rope.prototype, "segments", { get: function() { for (var t, e, i, n, o, r, a, h, l = [], c = 0; c < this.points.length; c++) t = 4 * c, e = this.vertices[t] * this.scale.x, i = this.vertices[t + 1] * this.scale.y, n = this.vertices[t + 4] * this.scale.x, o = this.vertices[t + 3] * this.scale.y, r = s.Math.difference(e, n), a = s.Math.difference(i, o), e += this.world.x, i += this.world.y, h = new s.Rectangle(e,i,r,a), l.push(h); return l } }), s.TileSprite = function(t, e, i, n, o, r, a) { e = e || 0, i = i || 0, n = n || 256, o = o || 256, r = r || null, a = a || null; var h = t.cache.getImage("__default", !0); PIXI.Sprite.call(this, new PIXI.Texture(h.base), n, o), this.type = s.TILESPRITE, this.physicsType = s.SPRITE,
this._scroll = new s.Point, this.tileScale = new s.Point(1,1), this.tileScaleOffset = new s.Point(1,1), this.tilePosition = new s.Point, this.textureDebug = !1, this.canvasBuffer = null, this.tilingTexture = null, this.tilePattern = null, this.refreshTexture = !0, this.frameWidth = 0, this.frameHeight = 0, this._width = n, this._height = o, s.Component.Core.init.call(this, t, e, i, r, a) } , s.TileSprite.prototype = Object.create(PIXI.Sprite.prototype), s.TileSprite.prototype.constructor = s.TileSprite, s.Component.Core.install.call(s.TileSprite.prototype, ["Angle", "Animation", "AutoCull", "Bounds", "BringToTop", "Destroy", "FixedToCamera", "Health", "InCamera", "InputEnabled", "InWorld", "LifeSpan", "LoadTexture", "Overlap", "PhysicsBody", "Reset", "Smoothed"]), s.TileSprite.prototype.preUpdatePhysics = s.Component.PhysicsBody.preUpdate, s.TileSprite.prototype.preUpdateLifeSpan = s.Component.LifeSpan.preUpdate, s.TileSprite.prototype.preUpdateInWorld = s.Component.InWorld.preUpdate, s.TileSprite.prototype.preUpdateCore = s.Component.Core.preUpdate, s.TileSprite.prototype.preUpdate = function() { return 0 !== this._scroll.x && (this.tilePosition.x += this._scroll.x * this.game.time.physicsElapsed), 0 !== this._scroll.y && (this.tilePosition.y += this._scroll.y * this.game.time.physicsElapsed), !!(this.preUpdatePhysics() && this.preUpdateLifeSpan() && this.preUpdateInWorld()) && this.preUpdateCore() } , s.TileSprite.prototype.autoScroll = function(t, e) { return this._scroll.set(t, e), this } , s.TileSprite.prototype.stopScroll = function() { return this._scroll.set(0, 0), this } , s.TileSprite.prototype.destroy = function(t) { s.Component.Destroy.prototype.destroy.call(this, t), PIXI.Sprite.prototype.destroy.call(this), this.canvasBuffer && (this.canvasBuffer.destroy(), this.canvasBuffer = null), this.tileScale = null, this.tileScaleOffset = null, this.tilePosition = null, this.tilingTexture && (this.tilingTexture.destroy(!0), this.tilingTexture = null) } , s.TileSprite.prototype.reset = function(t, e) {
return s.Component.Reset.prototype.reset.call(this, t, e), this.tilePosition.x = 0, this.tilePosition.y = 0, this } , s.TileSprite.prototype.setTexture = function(t) { return this.texture !== t && (this.texture = t, this.refreshTexture = !0, this.cachedTint = 16777215), this } , s.TileSprite.prototype._renderWebGL = function(t) { if (this.visible && this.renderable && 0 !== this.alpha) { if (this._mask && (t.spriteBatch.stop(), t.maskManager.pushMask(this.mask, t), t.spriteBatch.start()), this._filters && (t.spriteBatch.flush(), t.filterManager.pushFilter(this._filterBlock)), this.refreshTexture) { if (this.generateTilingTexture(!0, t), !this.tilingTexture) return; this.tilingTexture.needsUpdate && (this.tilingTexture.baseTexture.textureIndex = this.texture.baseTexture.textureIndex, t.renderer.updateTexture(this.tilingTexture.baseTexture), this.tilingTexture.needsUpdate = !1) } t.spriteBatch.renderTilingSprite(this); for (var e = 0; e < this.children.length; e++) this.children[e]._renderWebGL(t); var i = !1; this._filters && (i = !0, t.spriteBatch.stop(), t.filterManager.popFilter()), this._mask && (i || t.spriteBatch.stop(), t.maskManager.popMask(this._mask, t)), i && t.spriteBatch.start() } } , s.TileSprite.prototype._renderCanvas = function(t) { if (this.visible && this.renderable && 0 !== this.alpha) { var e = t.context; this._mask && t.maskManager.pushMask(this._mask, t), e.globalAlpha = this.worldAlpha; var i = this.worldTransform , n = t.resolution , s = i.tx * n + t.shakeX , o = i.ty * n + t.shakeY; if (e.setTransform(i.a * n, i.b * n, i.c * n, i.d * n, s, o), this.refreshTexture) { if (this.generateTilingTexture(!1, t), !this.tilingTexture) return; this.tilePattern = e.createPattern(this.tilingTexture.baseTexture.source, "repeat")
this.blendMode,
} var r = t.currentBlendMode; this.blendMode !== t.currentBlendMode && (t.currentBlendMode =
e.globalCompositeOperation = PIXI.blendModesCanvas[t.currentBlendMode]); var a = this.tilePosition , h = this.tileScale; a.x %= this.tilingTexture.baseTexture.width, a.y %= this.tilingTexture.baseTexture.height, e.scale(h.x, h.y), e.translate(a.x + this.anchor.x * -this._width, a.y + this.anchor.y * -this._height), e.fillStyle = this.tilePattern, s = -a.x, o = -a.y; var l = this._width / h.x , c = this._height / h.y; t.roundPixels && (s |= 0, o |= 0, l |= 0, c |= 0), e.fillRect(s, o, l, c), e.scale(1 / h.x, 1 / h.y), e.translate(-a.x + this.anchor.x * this._width, -a.y + this.anchor.y * this._height), this._mask && t.maskManager.popMask(t); for (var u = 0; u < this.children.length; u++) this.children[u]._renderCanvas(t); r !== this.blendMode && (t.currentBlendMode = r, e.globalCompositeOperation = PIXI.blendModesCanvas[r]) } } , s.TileSprite.prototype.onTextureUpdate = function() {} , s.TileSprite.prototype.generateTilingTexture = function(t) { if (this.texture.baseTexture.hasLoaded) { var e = this.texture , i = e.frame , n = this._frame.sourceSizeW || this._frame.width , o = this._frame.sourceSizeH || this._frame.height , r = 0 , a = 0; this._frame.trimmed && (r = this._frame.spriteSourceSizeX, a = this._frame.spriteSourceSizeY), t && (n = s.Math.getNextPowerOfTwo(n), o = s.Math.getNextPowerOfTwo(o)), this.canvasBuffer ? (this.canvasBuffer.resize(n, o), this.tilingTexture.baseTexture.width = n, this.tilingTexture.baseTexture.height = o, this.tilingTexture.needsUpdate = !0) : (this.canvasBuffer = new PIXI.CanvasBuffer(n,o), this.tilingTexture = PIXI.Texture.fromCanvas(this.canvasBuffer.canvas), this.tilingTexture.isTiling = !0, this.tilingTexture.needsUpdate = !0), this.textureDebug && (this.canvasBuffer.context.strokeStyle = "#00ff00",
this.canvasBuffer.context.strokeRect(0, 0, n, o)); var h = e.crop.width , l = e.crop.height; h === n && l === o || (h = n, l = o), this.canvasBuffer.context.drawImage(e.baseTexture.source, e.crop.x, e.crop.y, e.crop.width, e.crop.height, r, a, h, l), this.tileScaleOffset.x = i.width / n, this.tileScaleOffset.y = i.height / o, this.refreshTexture = !1, this.tilingTexture.baseTexture._powerOf2 = !0 } } , s.TileSprite.prototype.getBounds = function() { var t = this._width , e = this._height , i = t * (1 - this.anchor.x) , n = t * -this.anchor.x , s = e * (1 - this.anchor.y) , o = e * -this.anchor.y , r = this.worldTransform , a = r.a , h = r.b , l = r.c , c = r.d , u = r.tx , d = r.ty , p = a * n + l * o + u , f = c * o + h * n + d , m = a * i + l * o + u , g = c * o + h * i + d , y = a * i + l * s + u , v = c * s + h * i + d , b = a * n + l * s + u , w = c * s + h * n + d , x = -1 / 0 , _ = -1 / 0 , P = 1 / 0 , T = 1 / 0; P = p < P ? p : P, P = m < P ? m : P, P = y < P ? y : P, P = b < P ? b : P, T = f < T ? f : T, T = g < T ? g : T, T = v < T ? v : T, T = w < T ? w : T, x = p > x ? p : x, x = m > x ? m : x, x = y > x ? y : x, x = b > x ? b : x, _ = f > _ ? f : _, _ = g > _ ? g : _, _ = v > _ ? v : _, _ = w > _ ? w : _; var C = this._bounds; return C.x = P, C.width = x - P,
C.y = T, C.height = _ - T, this._currentBounds = C, C } , Object.defineProperty(s.TileSprite.prototype, "width", { get: function() { return this._width }, set: function(t) { this._width = t } }), Object.defineProperty(s.TileSprite.prototype, "height", { get: function() { return this._height }, set: function(t) { this._height = t } }), s.CanvasPool = { create: function(t, e, i) { var n, o = s.CanvasPool.getFirst(); if (-1 === o) { var r = { parent: t, canvas: document.createElement("canvas") }; s.CanvasPool.pool.push(r), n = r.canvas } else s.CanvasPool.pool[o].parent = t, n = s.CanvasPool.pool[o].canvas; return void 0 !== e && (n.width = e, n.height = i), n }, getFirst: function() { for (var t = s.CanvasPool.pool, e = 0; e < t.length; e++) if (!t[e].parent) return e; return -1 }, remove: function(t) { for (var e = s.CanvasPool.pool, i = 0; i < e.length; i++) e[i].parent === t && (e[i].parent = null, e[i].canvas.width = 1, e[i].canvas.height = 1) }, removeByCanvas: function(t) { for (var e = s.CanvasPool.pool, i = 0; i < e.length; i++) e[i].canvas === t && (e[i].parent = null, e[i].canvas.width = 1, e[i].canvas.height = 1) }, getTotal: function() { for (var t = s.CanvasPool.pool, e = 0, i = 0; i < t.length; i++)
t[i].parent && e++; return e }, getFree: function() { for (var t = s.CanvasPool.pool, e = 0, i = 0; i < t.length; i++) t[i].parent || e++; return e } }, s.CanvasPool.pool = [], s.Device = function() { this.deviceReadyAt = 0, this.initialized = !1, this.desktop = !1, this.iOS = !1, this.iOSVersion = 0, this.cocoonJS = !1, this.cocoonJSApp = !1, this.cordova = !1, this.node = !1, this.nodeWebkit = !1, this.electron = !1, this.ejecta = !1, this.crosswalk = !1, this.android = !1, this.chromeOS = !1, this.linux = !1, this.macOS = !1, this.windows = !1, this.windowsPhone = !1, this.canvas = !1, this.canvasBitBltShift = null, this.canHandleAlpha = !1, this.canUseMultiply = !1, this.webGL = !1, this.file = !1, this.fileSystem = !1, this.localStorage = !1, this.worker = !1, this.css3D = !1, this.pointerLock = !1, this.typedArray = !1, this.vibration = !1, this.getUserMedia = !0, this.quirksMode = !1, this.touch = !1, this.mspointer = !1, this.wheelEvent = null, this.arora = !1, this.chrome = !1, this.chromeVersion = 0, this.epiphany = !1, this.firefox = !1, this.firefoxVersion = 0, this.ie = !1, this.ieVersion = 0, this.trident = !1, this.tridentVersion = 0, this.edge = !1,
this.mobileSafari = !1, this.midori = !1, this.opera = !1, this.safari = !1, this.safariVersion = 0, this.webApp = !1, this.silk = !1, this.audioData = !1, this.webAudio = !1, this.ogg = !1, this.opus = !1, this.mp3 = !1, this.wav = !1, this.m4a = !1, this.webm = !1, this.dolby = !1, this.oggVideo = !1, this.h264Video = !1, this.mp4Video = !1, this.webmVideo = !1, this.vp9Video = !1, this.hlsVideo = !1, this.iPhone = !1, this.iPhone4 = !1, this.iPad = !1, this.pixelRatio = 0, this.littleEndian = !1, this.LITTLE_ENDIAN = !1, this.support32bit = !1, this.fullscreen = !1, this.requestFullscreen = "", this.cancelFullscreen = "", this.fullscreenKeyboard = !1
} , s.Device = new s.Device, s.Device.onInitialized = new s.Signal, s.Device.whenReady = function(t, e, i) { var n = this._readyCheck; if (this.deviceReadyAt || !n) t.call(e, this); else if (n._monitor || i) n._queue = n._queue || [], n._queue.push([t, e]); else { n._monitor = n.bind(this), n._queue = n._queue || [], n._queue.push([t, e]); var s = void 0 !== window.cordova , o = navigator.isCocoonJS; "complete" === document.readyState || "interactive" === document.readyState ? window.setTimeout(n._monitor, 0) : s && !o ? document.addEventListener("deviceready", n._monitor, !1) : (document.addEventListener("DOMContentLoaded", n._monitor, !1), window.addEventListener("load", n._monitor, !1)) } } , s.Device._readyCheck = function() {
var t = this._readyCheck; if (document.body) { if (!this.deviceReadyAt) { this.deviceReadyAt = Date.now(), document.removeEventListener("deviceready", t._monitor), document.removeEventListener("DOMContentLoaded", t._monitor), window.removeEventListener("load", t._monitor), this._initialize(), this.initialized = !0, this.onInitialized.dispatch(this); for (var e; e = t._queue.shift(); ) { var i = e[0] , n = e[1]; i.call(n, this) } this._readyCheck = null, this._initialize = null, this.onInitialized = null } } else window.setTimeout(t._monitor, 20)
} , s.Device._initialize = function() { function t() { var t = navigator.userAgent; /Playstation Vita/.test(t) ? p.vita = !0 : /Kindle/.test(t) || /\bKF[A-Z][A-Z]+/.test(t) || /Silk.*Mobile Safari/.test(t) ? p.kindle = !0 : /Android/.test(t) ? p.android = !0 : /CrOS/.test(t) ? p.chromeOS = !0 : /iP[ao]d| iPhone/i.test(t) ? (p.iOS = !0, navigator.appVersion.match(/OS (\d+)/), p.iOSVersion = parseInt(RegExp.$1, 10)) : /Linux/.test(t) ? p.linux = !0 : /Mac OS/.test(t) ? p.macOS = !0 : /Windows/.test(t) && (p.windows = !0), (/Windows Phone/i.test(t) || /IEMobile/i.test(t)) && (p.android = ! 1, p.iOS = !1, p.macOS = !1, p.windows = !0, p.windowsPhone = !0); var e = /Silk/.test(t); (p.windows || p.macOS || p.linux && !e || p.chromeOS) && (p.desktop = !0), (p.windowsPhone || /Windows NT/i.test(t) && /Touch/i.test(t)) && (p.desktop = !1) } function e() { var t = s.CanvasPool.create(this, 6, 1) , e = t.getContext("2d"); e.fillStyle = "rgba(10, 20, 30, 0.5)", e.fillRect(0, 0, 1, 1); var i = e.getImageData(0, 0, 1, 1); if (i) { e.putImageData(i, 1, 0); var n = e.getImageData(1, 0, 1, 1); p.canHandleAlpha = n.data[0] === i.data[0] && n.data[1] === i.data[1] && n.data[2] === i.data[2] && n.data[3] === i.data[3] } var o = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/"
, r = "AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==" , a = new Image; a.src = o + "AP804Oa6" + r; var h = new Image; if (h.src = o + "/wCKxvRF" + r, e.clearRect(0, 0, 6, 1), e.globalCompositeOperation = "multiply", e.drawImage(a, 0, 0), e.drawImage(h, 2, 0), e.getImageData(2, 0, 1, 1)) { var l = e.getImageData(2, 0, 1, 1).data; p.canUseMultiply = 255 === l[0] && 0 === l[1] && 0 === l[2] } s.CanvasPool.removeByCanvas(t), PIXI.CanvasTinter.tintMethod = p.canUseMultiply ? PIXI.CanvasTinter.tintWithMultiply : PIXI.CanvasTinter.tintWithPerPixel } function i() { p.canvas = !!window.CanvasRenderingContext2D || p.cocoonJS; try { p.localStorage = !!localStorage.getItem } catch (t) { p.localStorage = !1 } p.file = !!(window.File && window.FileReader && window.FileList && window.Blob), p.fileSystem = !!window.requestFileSystem, p.webGL = function() { try { var t = document.createElement("canvas"); return t.screencanvas = !1, !!window.WebGLRenderingContext && (t.getContext("webgl") || t.getContext("experimental-webgl")) } catch (t) { return !1 } }(), p.webGL = !!p.webGL, p.worker = !!window.Worker, p.pointerLock = "pointerLockElement"in document || "mozPointerLockElement"in document || "webkitPointerLockElement"in document, p.quirksMode = "CSS1Compat" !== document.compatMode, navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia, window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL, p.getUserMedia = p.getUserMedia && !!navigator.getUserMedia && !! window.URL, p.firefox && p.firefoxVersion < 21 && (p.getUserMedia = !1), !p.iOS && (p.ie || p.firefox || p.chrome) && (p.canvasBitBltShift = !0), (p.safari || p.mobileSafari) && (p.canvasBitBltShift = !1) } function n() { ("ontouchstart"in document.documentElement || window.navigator.maxTouchPoints && window.navigator.maxTouchPoints >= 1) && (p.touch = !0), (window.PointerEvent || window.MSPointerEvent ||
window.navigator.msPointerEnabled || window.navigator.pointerEnabled) && (p.mspointer = !0), p.cocoonJS || ("onwheel"in window || p.ie && "WheelEvent"in window ? p.wheelEvent = "wheel" : "onmousewheel"in window ? p.wheelEvent = "mousewheel" : p.firefox && "MouseScrollEvent"in window && (p.wheelEvent = "DOMMouseScroll")) } function o() { for (var t = ["requestFullscreen", "requestFullScreen", "webkitRequestFullscreen", "webkitRequestFullScreen", "msRequestFullscreen", "msRequestFullScreen", "mozRequestFullScreen", "mozRequestFullscreen"], e = document.createElement("div"), i = 0; i < t.length; i++) if (e[t[i]]) { p.fullscreen = !0, p.requestFullscreen = t[i]; break } var n = ["cancelFullScreen", "exitFullscreen", "webkitCancelFullScreen", "webkitExitFullscreen", "msCancelFullScreen", "msExitFullscreen", "mozCancelFullScreen", "mozExitFullscreen"]; if (p.fullscreen) for (var i = 0; i < n.length; i++) if (document[n[i]]) { p.cancelFullscreen = n[i]; break } window.Element && Element.ALLOW_KEYBOARD_INPUT && (p.fullscreenKeyboard = !0) } function r() { var t = navigator.userAgent; if (/Arora/.test(t) ? p.arora = !0 : /Edge\/\d+/.test(t) ? p.edge = !0 : /Chrome\/(\d+)/.test(t) && !p.windowsPhone ? (p.chrome = !0, p.chromeVersion = parseInt(RegExp.$1, 10)) : /Epiphany/.test(t) ? p.epiphany = !0 : /Firefox\D+(\d+)/.test(t) ? (p.firefox = !0, p.firefoxVersion = parseInt(RegExp.$1, 10)) : /AppleWebKit/.test(t) && p.iOS ? p.mobileSafari = !0 : /MSIE (\d+\.\d+);/.test(t) ? (p.ie = !0, p.ieVersion = parseInt(RegExp.$1, 10)) : /Midori/.test(t) ? p.midori = !0 : /Opera/.test(t) ? p.opera = !0 : /Safari\/(\d+)/.test(t) && ! p.windowsPhone ? (p.safari = !0, /Version\/(\d+)\./.test(t) && (p.safariVersion = parseInt(RegExp. $1, 10))) : /Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(t) && (p.ie = !0, p.trident = !0, p.tridentVersion = parseInt(RegExp.$1, 10), p.ieVersion = parseInt(RegExp.$3, 10)), /Silk/.test(t) && (p.silk = !0), navigator.standalone && (p.webApp = !0), void 0 !== window.cordova && (p.cordova = !0), "undefined" != typeof process && "undefined" != typeof require && (p.node = !0), p.node && "object" == typeof process.versions && (p.nodeWebkit = !! process.versions["node-webkit"], p.electron = !!process.versions.electron), navigator.isCocoonJS && (p.cocoonJS = !0), p.cocoonJS) try { p.cocoonJSApp = "undefined" != typeof CocoonJS } catch (t) { p.cocoonJSApp = !1
} void 0 !== window.ejecta && (p.ejecta = !0), /Crosswalk/.test(t) && (p.crosswalk = !0)
} function a() { var t = document.createElement("video"); try { !!t.canPlayType && (t.canPlayType('video/ogg; codecs="theora"').replace(/^no$/, "") && (p.oggVideo = !0), t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/, "") && (p.h264Video = !0, p.mp4Video = !0), t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/, "") && (p.webmVideo = !0), t.canPlayType('video/webm; codecs="vp9"').replace(/^no$/, "") && (p.vp9Video = !0), t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/, "") && (p.hlsVideo = !0)) } catch (t) {} } function h() { p.audioData = !!window.Audio, p.webAudio = !(!window.AudioContext && !window.webkitAudioContext); var t = document.createElement("audio"); try { if (!!t.canPlayType && (t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, "") && (p.ogg = !0), (t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, "") || t.canPlayType("audio/opus;").replace(/^no$/, "")) && (p.opus = !0), t.canPlayType("audio/mpeg;").replace(/^no$/, "") && (p.mp3 = ! 0), t.canPlayType('audio/wav; codecs="1"').replace(/^no$/, "") && (p.wav = !0), (t.canPlayType("audio/x-m4a;") || t.canPlayType("audio/aac;").replace(/^no$/, "")) && (p.m4a = !0), t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "") && (p.webm = !0), "" !== t.canPlayType('audio/mp4;codecs="ec-3"'))) if (p.edge) p.dolby = !0; else if (p.safari && p.safariVersion >= 9 && /Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)) { var e = parseInt(RegExp.$1, 10) , i = parseInt(RegExp.$2, 10); (10 === e && i >= 11 || e > 10) && (p.dolby = !0) } } catch (t) {} } function l() { var t = new ArrayBuffer(4) , e = new Uint8Array(t) , i = new Uint32Array(t); return e[0] = 161, e[1] = 178, e[2] = 195, e[3] = 212, 3569595041 === i[0] || 2712847316 !== i[0] && null } function c() {
if (void 0 === Uint8ClampedArray) return !1; var t = s.CanvasPool.create(this, 1, 1) , e = t.getContext("2d"); if (!e) return !1; var i = e.createImageData(1, 1); return s.CanvasPool.remove(this), i.data instanceof Uint8ClampedArray
} function u() { p.pixelRatio = window.devicePixelRatio || 1, p.iPhone = -1 !== navigator.userAgent.toLowerCase().indexOf("iphone"), p.iPhone4 = 2 === p.pixelRatio && p.iPhone, p.iPad = -1 !== navigator.userAgent.toLowerCase().indexOf("ipad"), "undefined" != typeof Int8Array ? p.typedArray = !0 : p.typedArray = !1, "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array && "undefined" != typeof Uint32Array && (p.littleEndian = l(), p.LITTLE_ENDIAN = p.littleEndian), p.support32bit = "undefined" != typeof ArrayBuffer && "undefined" ! = typeof Uint8ClampedArray && "undefined" != typeof Int32Array && null !== p.littleEndian && c(), navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate, navigator.vibrate && (p.vibration = !0) } function d() { var t, e = document.createElement("p"), i = { webkitTransform: "-webkit-transform", OTransform: "-o-transform", msTransform: "-ms-transform", MozTransform: "-moz-transform", transform: "transform" }; document.body.insertBefore(e, null); for (var n in i) void 0 !== e.style[n] && (e.style[n] = "translate3d(1px,1px,1px)", t = window.getComputedStyle(e).getPropertyValue(i[n])); document.body.removeChild(e), p.css3D = void 0 !== t && t.length > 0 && "none" !== t } var p = this; t(), r(), h(), a(), d(), u(), i(), e(), o(), n() } , s.Device.canPlayAudio = function(t) { return !("mp3" !== t || !this.mp3) || (!("ogg" !== t || !this.ogg && !
this.opus) || (!("m4a" !== t || !this.m4a) || (!("opus" !== t || !this.opus) || (! ("wav" !== t || !this.wav) || (!("webm" !== t || !this.webm) || !("mp4" !== t || ! this.dolby)))))) } , s.Device.canPlayVideo = function(t) { return !("webm" !== t || !this.webmVideo && !this.vp9Video) || (!("mp4" !== t || !this.mp4Video && !this.h264Video) || (!("ogg" !== t && "ogv" !== t || ! this.oggVideo) || !("mpeg" !== t || !this.hlsVideo))) } , s.Device.isConsoleOpen = function() { return !(!window.console || !window.console.firebug) || !(! window.console || (console.profile(), console.profileEnd(), console.clear && console.clear(), !console.profiles)) && console.profiles.length > 0 } , s.Device.isAndroidStockBrowser = function() { var t = window.navigator.userAgent.match(/Android.*AppleWebKit\/([\d.] +)/); return t && t[1] < 537 } , s.Canvas = { create: function(t, e, i, n, o) { e = e || 256, i = i || 256; var r = o ? document.createElement("canvas") : s.CanvasPool.create(t, e, i); return "string" == typeof n && "" !== n && (r.id = n), r.width = e, r.height = i, r.style.display = "block", r }, setBackgroundColor: function(t, e) { return e = e || "rgb(0,0,0)", t.style.backgroundColor = e, t }, setTouchAction: function(t, e) { return e = e || "none", t.style.msTouchAction = e, t.style["ms-touch-action"] = e, t.style["touch-action"] = e, t }, setUserSelect: function(t, e) { return e = e || "none", t.style["-webkit-touch-callout"] = e, t.style["-webkit-user-select"] = e, t.style["-khtml-user-select"] = e, t.style["-moz-user-select"] = e, t.style["-ms-user-select"] = e, t.style["user-select"] = e, t.style["-webkit-tap-highlight-color"] = "rgba(0, 0, 0, 0)", t
}, addToDOM: function(t, e, i) { var n; return void 0 === i && (i = !0), e && ("string" == typeof e ? n = document.getElementById(e) : "object" == typeof e && 1 === e.nodeType && (n = e)), n || (n = document.body), i && n.style && (n.style.overflow = "hidden"), n.appendChild(t), t }, removeFromDOM: function(t) { t.parentNode && t.parentNode.removeChild(t) }, setTransform: function(t, e, i, n, s, o, r) { return t.setTransform(n, o, r, s, e, i), t }, setSmoothingEnabled: function(t, e) { var i = s.Canvas.getSmoothingPrefix(t); return i && (t[i] = e), t }, getSmoothingPrefix: function(t) { var e = ["i", "webkitI", "msI", "mozI", "oI"]; for (var i in e) { var n = e[i] + "mageSmoothingEnabled"; if (n in t) return n } return null }, getSmoothingEnabled: function(t) { var e = s.Canvas.getSmoothingPrefix(t); if (e) return t[e] }, setImageRenderingCrisp: function(t) { for (var e = ["optimizeSpeed", "crisp-edges", "-moz-crisp-edges", "-webkit-optimize-contrast", "optimize-contrast", "pixelated"], i = 0; i < e.length; i++) t.style["image-rendering"] = e[i]; return t.style.msInterpolationMode = "nearest-neighbor", t }, setImageRenderingBicubic: function(t) { return t.style["image-rendering"] = "auto", t.style.msInterpolationMode = "bicubic", t } }, s.RequestAnimationFrame = function(t, e) { void 0 === e && (e = !1), this.game = t, this.isRunning = !1, this.forceSetTimeOut = e; for (var i = ["ms", "moz", "webkit", "o"], n = 0; n < i.length && ! window.requestAnimationFrame; n++) window.requestAnimationFrame = window[i[n] +
"RequestAnimationFrame"], window.cancelAnimationFrame = window[i[n] + "CancelAnimationFrame"] || window[i[n] + "CancelRequestAnimationFrame"]; this._isSetTimeOut = !1, this._onLoop = null, this._timeOutID = null } , s.RequestAnimationFrame.prototype = { start: function() { this.isRunning = !0; var t = this; !window.requestAnimationFrame || this.forceSetTimeOut ? (this._isSetTimeOut = !0, this._onLoop = function() { return t.updateSetTimeout() } , this._timeOutID = window.setTimeout(this._onLoop, 0)) : (this._isSetTimeOut = !1, this._onLoop = function(e) { return t.updateRAF(e) } , this._timeOutID = window.requestAnimationFrame(this._onLoop)) }, updateRAF: function(t) { this.isRunning && (this.game.update(Math.floor(t)), this._timeOutID = window.requestAnimationFrame(this._onLoop)) }, updateSetTimeout: function() { this.isRunning && (this.game.update(Date.now()), this._timeOutID = window.setTimeout(this._onLoop, this.game.time.timeToCall)) }, stop: function() { this._isSetTimeOut ? clearTimeout(this._timeOutID) : window.cancelAnimationFrame(this._timeOutID), this.isRunning = !1 }, isSetTimeOut: function() { return this._isSetTimeOut }, isRAF: function() { return !1 === this._isSetTimeOut } }, s.RequestAnimationFrame.prototype.constructor = s.RequestAnimationFrame, s.Math = { PI2: 2 * Math.PI, DEG_TO_RAD: Math.PI / 180, RAD_TO_DEG: 180 / Math.PI, degToRad: function(t) { return t * s.Math.DEG_TO_RAD }, radToDeg: function(t) { return t * s.Math.RAD_TO_DEG }, getNextPowerOfTwo: function(t) {
if (t > 0 && 0 == (t & t - 1)) return t; for (var e = 1; e < t; ) e 0 && 0 == (e & e - 1) }, random: function(t, e) { if (void 0 === t && (t = 0), void 0 === e && (e = 1), t === e) return t; if (t < e) { var i = t; t = e, e = i } return Math.random() * (e - t) + t }, between: function(t, e) { if (void 0 === t && (t = 0), void 0 === e && (e = 1), t === e) return t; if (t < e) { var i = t; t = e, e = i } return t = Math.ceil(t), e = Math.floor(e), Math.floor(Math.random() * (e - t + 1)) + t }, fuzzyEqual: function(t, e, i) { return void 0 === i && (i = 1e-4), Math.abs(t - e) < i }, fuzzyLessThan: function(t, e, i) { return void 0 === i && (i = 1e-4), t < e + i }, fuzzyGreaterThan: function(t, e, i) { return void 0 === i && (i = 1e-4), t > e - i }, fuzzyCeil: function(t, e) { return void 0 === e && (e = 1e-4), Math.ceil(t - e) }, fuzzyFloor: function(t, e) { return void 0 === e && (e = 1e-4), Math.floor(t + e) }, average: function() { for (var t = 0, e = arguments.length, i = 0; i < e; i++) t += +arguments[i]; return t / e
}, shear: function(t) { return t % 1 }, snapTo: function(t, e, i) { return void 0 === i && (i = 0), 0 === e ? t : (t -= i, t = e * Math.round(t / e), i + t) }, snapToFloor: function(t, e, i) { return void 0 === i && (i = 0), 0 === e ? t : (t -= i, t = e * Math.floor(t / e), i + t) }, snapToCeil: function(t, e, i) { return void 0 === i && (i = 0), 0 === e ? t : (t -= i, t = e * Math.ceil(t / e), i + t) }, roundTo: function(t, e, i) { void 0 === e && (e = 0), void 0 === i && (i = 10); var n = Math.pow(i, -e); return Math.round(t * n) / n }, floorTo: function(t, e, i) { void 0 === e && (e = 0), void 0 === i && (i = 10); var n = Math.pow(i, -e); return Math.floor(t * n) / n }, ceilTo: function(t, e, i) { void 0 === e && (e = 0), void 0 === i && (i = 10); var n = Math.pow(i, -e); return Math.ceil(t * n) / n }, rotateToAngle: function(t, e, i) { return void 0 === i && (i = .05), t === e ? t : (Math.abs(e - t) = s.Math.PI2 - i ? t = e : (Math.abs(e - t) > Math.PI && (e < t ? e += s.Math.PI2 : e -= s.Math.PI2), e > t ? t += i : e < t && (t -= i)), t) }, getShortestAngle: function(t, e) { var i = e - t; return 0 === i ? 0 : i - 360 * Math.floor((i - -180) / 360) }, angleBetween: function(t, e, i, n) { return Math.atan2(n - e, i - t) }, angleBetweenY: function(t, e, i, n) { return Math.atan2(i - t, n - e) }, angleBetweenPoints: function(t, e) {
return Math.atan2(e.y - t.y, e.x - t.x) }, angleBetweenPointsY: function(t, e) { return Math.atan2(e.x - t.x, e.y - t.y) }, reverseAngle: function(t) { return this.normalizeAngle(t + Math.PI, !0) }, normalizeAngle: function(t) { return t %= 2 * Math.PI, t >= 0 ? t : t + 2 * Math.PI }, maxAdd: function(t, e, i) { return Math.min(t + e, i) }, minSub: function(t, e, i) { return Math.max(t - e, i) }, wrap: function(t, e, i) { var n = i - e; if (n t[i] && (i = e); return t[i] }, minProperty: function(t) { if (2 === arguments.length && "object" == typeof arguments[1]) var e = arguments[1];
else
var e = arguments.slice(1); for (var i = 1, n = 0, s = e.length; i < s; i++) e[i][t] < e[n][t] && (n = i); return e[n][t]
180)
}, maxProperty: function(t) { if (2 === arguments.length && "object" == typeof arguments[1]) var e = arguments[1]; else var e = arguments.slice(1); for (var i = 1, n = 0, s = e.length; i < s; i++) e[i][t] > e[n][t] && (n = i); return e[n][t] }, wrapAngle: function(t, e) { return e ? this.wrap(t, -Math.PI, Math.PI) : this.wrap(t, -180,
}, linearInterpolation: function(t, e) { var i = t.length - 1 , n = i * e , s = Math.floor(n); return e < 0 ? this.linear(t[0], t[1], n) : e > 1 ? this.linear(t[i], t[i - 1], i - n) : this.linear(t[s], t[s + 1 > i ? i : s + 1], n - s) }, bezierInterpolation: function(t, e) { for (var i = 0, n = t.length - 1, s = 0; s 1 ? t[i] - (this.catmullRom(t[i], t[i], t[i - 1], t[i - 1], n - i) - t[i]) : this.catmullRom(t[s ? s - 1 : 0], t[s], t[i < s + 1 ? i : s + 1], t[i < s + 2 ? i : s + 2], n - s) }, linear: function(t, e, i) { return (e - t) * i + t }, bernstein: function(t, e) { return this.factorial(t) / this.factorial(e) / this.factorial(t e) }, factorial: function(t) { if (0 === t) return 1; for (var e = t; --t; ) e *= t; return e }, catmullRom: function(t, e, i, n, s) {
var o = .5 * (i - t) , r = .5 * (n - e) , a = s * s; return (2 * e - 2 * i + o + r) * (s * a) + (-3 * e + 3 * i - 2 * o - r) * a + o * s + e }, difference: function(t, e) { return Math.abs(t - e) }, roundAwayFromZero: function(t) { return t > 0 ? Math.ceil(t) : Math.floor(t) }, sinCosGenerator: function(t, e, i, n) { void 0 === e && (e = 1), void 0 === i && (i = 1), void 0 === n && (n = 1); for (var s = e, o = i, r = n * Math.PI / t, a = [], h = [], l = 0; l < t; l++) o -= s * r, s += o * r, a[l] = o, h[l] = s; return { sin: h, cos: a, length: t } }, distance: function(t, e, i, n) { var s = t - i , o = e - n; return Math.sqrt(s * s + o * o) }, distanceSq: function(t, e, i, n) { var s = t - i , o = e - n; return s * s + o * o }, distancePow: function(t, e, i, n, s) { return void 0 === s && (s = 2), Math.sqrt(Math.pow(i - t, s) + Math.pow(n - e, s)) }, clamp: function(t, e, i) { return t < e ? e : i < t ? i : t }, clampBottom: function(t, e) { return t < e ? e : t }, within: function(t, e, i) { return Math.abs(t - e) 0 ? 1 : 0 }, percent: function(t, e, i) { return void 0 === i && (i = 0), t > e || i > e ? 1 : t < i || i > t ? 0 : (t - i) / e } }, s.RandomDataGenerator = function(t) { void 0 === t && (t = []), this.c = 1, this.s0 = 0, this.s1 = 0, this.s2 = 0, "string" == typeof t ? this.state(t) : this.sow(t) } , s.RandomDataGenerator.prototype = { rnd: function() { var t = 2091639 * this.s0 + 2.3283064365386963e-10 * this.c; return this.c = 0 | t, this.s0 = this.s1, this.s1 = this.s2, this.s2 = t - this.c, this.s2 }, sow: function(t) { if (this.s0 = this.hash(" "), this.s1 = this.hash(this.s0), this.s2 = this.hash(this.s1), this.c = 1, t) for (var e = 0; e < t.length && null != t[e]; e++) { var i = t[e]; this.s0 -= this.hash(i), this.s0 += ~~(this.s0 < 0), this.s1 -= this.hash(i), this.s1 += ~~(this.s1 < 0), this.s2 -= this.hash(i), this.s2 += ~~(this.s2 < 0) } }, hash: function(t) { var e, i, n; for (n = 4022871197, t = t.toString(), i = 0; i < t.length; i++) n += t.charCodeAt(i), e = .02519603282416938 * n, n = e >>> 0, e -= n, e *= n, n = e >>> 0, e -= n, n += 4294967296 * e; return 2.3283064365386963e-10 * (n >>> 0)
}, integer: function() { return 4294967296 * this.rnd.apply(this) }, frac: function() { return this.rnd.apply(this) + 1.1102230246251565e-16 * (2097152 * this.rnd.apply(this) | 0) }, real: function() { return this.integer() + this.frac() }, integerInRange: function(t, e) { return Math.floor(this.realInRange(0, e - t + 1) + t) }, between: function(t, e) { return this.integerInRange(t, e) }, realInRange: function(t, e) { return this.frac() * (e - t) + t }, normal: function() { return 1 - 2 * this.frac() }, uuid: function() { var t = "" , e = ""; for (e = t = ""; t++ < 36; e += ~t % 5 | 3 * t & 4 ? (15 ^ t ? 8 ^ this.frac() * (20 ^ t ? 16 : 4) : 4).toString(16) : "-") ; return e }, pick: function(t) { return t[this.integerInRange(0, t.length - 1)] }, sign: function() { return this.pick([-1, 1]) }, weightedPick: function(t) { return t[~~(Math.pow(this.frac(), 2) * (t.length - 1) + .5)] }, timestamp: function(t, e) { return this.realInRange(t || 9466848e5, e || 1577862e6) }, angle: function() { return this.integerInRange(-180, 180) }, state: function(t) { return "string" == typeof t && t.match(/^!rnd/) && (t = t.split(","), this.c = parseFloat(t[1]), this.s0 = parseFloat(t[2]), this.s1 = parseFloat(t[3]), this.s2 = parseFloat(t[4])), ["!rnd", this.c, this.s0, this.s1, this.s2].join(",") } }, s.RandomDataGenerator.prototype.constructor = s.RandomDataGenerator, s.QuadTree = function(t, e, i, n, s, o, r) { this.maxObjects = 10,
this.maxLevels = 4, this.level = 0, this.bounds = {}, this.objects = [], this.nodes = [], this._empty = [], this.reset(t, e, i, n, s, o, r)
} , s.QuadTree.prototype = { reset: function(t, e, i, n, s, o, r) { this.maxObjects = s || 10, this.maxLevels = o || 4, this.level = r || 0, this.bounds = { x: Math.round(t), y: Math.round(e), width: i, height: n, subWidth: Math.floor(i / 2), subHeight: Math.floor(n / 2), right: Math.round(t) + Math.floor(i / 2), bottom: Math.round(e) + Math.floor(n / 2) }, this.objects.length = 0, this.nodes.length = 0 }, populate: function(t) { t.forEach(this.populateHandler, this, !0) }, populateHandler: function(t) { t.body && t.exists && this.insert(t.body) }, split: function() { this.nodes[0] = new s.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeig ht,this.maxObjects,this.maxLevels,this.level + 1), this.nodes[1] = new s.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,t his.maxObjects,this.maxLevels,this.level + 1), this.nodes[2] = new s.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHei ght,this.maxObjects,this.maxLevels,this.level + 1), this.nodes[3] = new s.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.su bHeight,this.maxObjects,this.maxLevels,this.level + 1) }, insert: function(t) { var e, i = 0; if (null != this.nodes[0] && -1 !== (e = this.getIndex(t))) return void this.nodes[e].insert(t); if (this.objects.push(t), this.objects.length > this.maxObjects && this.level < this.maxLevels) for (null == this.nodes[0] && this.split(); i < this.objects.length; ) e = this.getIndex(this.objects[i]), -1 !== e ? this.nodes[e].insert(this.objects.splice(i, 1) [0]) : i++
}, getIndex: function(t) { var e = -1; return t.x < this.bounds.right && t.right < this.bounds.right ? t.y < this.bounds.bottom && t.bottom < this.bounds.bottom ? e = 1 : t.y > this.bounds.bottom && (e = 2) : t.x > this.bounds.right && (t.y < this.bounds.bottom && t.bottom < this.bounds.bottom ? e = 0 : t.y > this.bounds.bottom && (e = 3)), e }, retrieve: function(t) { if (t instanceof s.Rectangle) var e = this.objects , i = this.getIndex(t); else { if (!t.body) return this._empty; var e = this.objects , i = this.getIndex(t.body) } return this.nodes[0] && (-1 !== i ? e = e.concat(this.nodes[i].retrieve(t)) : (e = e.concat(this.nodes[0].retrieve(t)), e = e.concat(this.nodes[1].retrieve(t)), e = e.concat(this.nodes[2].retrieve(t)), e = e.concat(this.nodes[3].retrieve(t)))), e }, clear: function() { this.objects.length = 0; for (var t = this.nodes.length; t--; ) this.nodes[t].clear(), this.nodes.splice(t, 1); this.nodes.length = 0 } }, s.QuadTree.prototype.constructor = s.QuadTree, s.Net = function(t) { this.game = t } , s.Net.prototype = { getHostName: function() { return window.location && window.location.hostname ? window.location.hostname : null }, checkDomainName: function(t) { return -1 !== window.location.hostname.indexOf(t) }, updateQueryString: function(t, e, i, n) { void 0 === i && (i = !1), void 0 !== n && "" !== n || (n = window.location.href); var s = "" , o = new RegExp("([?|&])" + t + "=.*?(&|#|$)(.*)","gi"); if (o.test(n)) s = void 0 !== e && null !== e ? n.replace(o, "$1" + t + "=" + e + "$2$3") : n.replace(o, "$1$3").replace(/(&|\?)$/, ""); else if (void 0 !== e && null !== e) { var r = -1 !== n.indexOf("?") ? "&" : "?" , a = n.split("#");
n = a[0] + r + t + "=" + e, a[1] && (n += "#" + a[1]), s = n } else s = n; if (!i) return s; window.location.href = s }, getQueryString: function(t) { void 0 === t && (t = ""); var e = {} , i = location.search.substring(1).split("&"); for (var n in i) { var s = i[n].split("="); if (s.length > 1) { if (t && t === this.decodeURI(s[0])) return this.decodeURI(s[1]); e[this.decodeURI(s[0])] = this.decodeURI(s[1]) } } return e }, decodeURI: function(t) { return decodeURIComponent(t.replace(/\+/g, " ")) } }, s.Net.prototype.constructor = s.Net, s.TweenManager = function(t) { this.game = t, this.frameBased = !1, this._tweens = [], this._add = [], this.easeMap = { Power0: s.Easing.Power0, Power1: s.Easing.Power1, Power2: s.Easing.Power2, Power3: s.Easing.Power3, Power4: s.Easing.Power4, Linear: s.Easing.Linear.None, Quad: s.Easing.Quadratic.Out, Cubic: s.Easing.Cubic.Out, Quart: s.Easing.Quartic.Out, Quint: s.Easing.Quintic.Out, Sine: s.Easing.Sinusoidal.Out, Expo: s.Easing.Exponential.Out, Circ: s.Easing.Circular.Out, Elastic: s.Easing.Elastic.Out, Back: s.Easing.Back.Out, Bounce: s.Easing.Bounce.Out, "Quad.easeIn": s.Easing.Quadratic.In, "Cubic.easeIn": s.Easing.Cubic.In, "Quart.easeIn": s.Easing.Quartic.In, "Quint.easeIn": s.Easing.Quintic.In, "Sine.easeIn": s.Easing.Sinusoidal.In, "Expo.easeIn": s.Easing.Exponential.In, "Circ.easeIn": s.Easing.Circular.In, "Elastic.easeIn": s.Easing.Elastic.In, "Back.easeIn": s.Easing.Back.In,
"Bounce.easeIn": s.Easing.Bounce.In, "Quad.easeOut": s.Easing.Quadratic.Out, "Cubic.easeOut": s.Easing.Cubic.Out, "Quart.easeOut": s.Easing.Quartic.Out, "Quint.easeOut": s.Easing.Quintic.Out, "Sine.easeOut": s.Easing.Sinusoidal.Out, "Expo.easeOut": s.Easing.Exponential.Out, "Circ.easeOut": s.Easing.Circular.Out, "Elastic.easeOut": s.Easing.Elastic.Out, "Back.easeOut": s.Easing.Back.Out, "Bounce.easeOut": s.Easing.Bounce.Out, "Quad.easeInOut": s.Easing.Quadratic.InOut, "Cubic.easeInOut": s.Easing.Cubic.InOut, "Quart.easeInOut": s.Easing.Quartic.InOut, "Quint.easeInOut": s.Easing.Quintic.InOut, "Sine.easeInOut": s.Easing.Sinusoidal.InOut, "Expo.easeInOut": s.Easing.Exponential.InOut, "Circ.easeInOut": s.Easing.Circular.InOut, "Elastic.easeInOut": s.Easing.Elastic.InOut, "Back.easeInOut": s.Easing.Back.InOut, "Bounce.easeInOut": s.Easing.Bounce.InOut
}, this.game.onPause.add(this._pauseAll, this), this.game.onResume.add(this._resumeAll, this)
} , s.TweenManager.prototype = { getAll: function() { return this._tweens }, removeAll: function() { for (var t = 0; t < this._tweens.length; t++) this._tweens[t].pendingDelete = !0; this._add = [] }, removeFrom: function(t, e) { void 0 === e && (e = !0); var i, n; if (Array.isArray(t)) for (i = 0, n = t.length; i < n; i++) this.removeFrom(t[i]); else if (t.type === s.GROUP && e) for (var i = 0, n = t.children.length; i < n; i++) this.removeFrom(t.children[i]); else { for (i = 0, n = this._tweens.length; i < n; i++) t === this._tweens[i].target && this.remove(this._tweens[i]); for (i = 0, n = this._add.length; i < n; i++) t === this._add[i].target && this.remove(this._add[i]) } }, add: function(t) { t._manager = this, this._add.push(t) },
create: function(t) { return new s.Tween(t,this.game,this) }, remove: function(t) { var e = this._tweens.indexOf(t); -1 !== e ? this._tweens[e].pendingDelete = !0 : -1 !== (e = this._add.indexOf(t)) && (this._add[e].pendingDelete = !0) }, update: function() { var t = this._add.length , e = this._tweens.length; if (0 === e && 0 === t) return !1; for (var i = 0; i < e; ) this._tweens[i].update(this.game.time.time) ? i++ : (this._tweens.splice(i, 1), e--); return t > 0 && (this._tweens = this._tweens.concat(this._add), this._add.length = 0), !0 }, isTweening: function(t) { return this._tweens.some(function(e) { return e.target === t }) }, _pauseAll: function() { for (var t = this._tweens.length - 1; t >= 0; t--) this._tweens[t]._pause() }, _resumeAll: function() { for (var t = this._tweens.length - 1; t >= 0; t--) this._tweens[t]._resume() }, pauseAll: function() { for (var t = this._tweens.length - 1; t >= 0; t--) this._tweens[t].pause() }, resumeAll: function() { for (var t = this._tweens.length - 1; t >= 0; t--) this._tweens[t].resume(!0) } }, s.TweenManager.prototype.constructor = s.TweenManager, s.Tween = function(t, e, i) { this.game = e, this.target = t, this.manager = i, this.timeline = [], this.reverse = !1, this.timeScale = 1, this.repeatCounter = 0, this.pendingDelete = !1, this.onStart = new s.Signal, this.onLoop = new s.Signal, this.onRepeat = new s.Signal, this.onChildComplete = new s.Signal, this.onComplete = new s.Signal, this.isRunning = !1,
this.current = 0, this.properties = {}, this.chainedTween = null, this.isPaused = !1, this.frameBased = i.frameBased, this._onUpdateCallback = null, this._onUpdateCallbackContext = null, this._pausedTime = 0, this._codePaused = !1, this._hasStarted = !1 } , s.Tween.prototype = { to: function(t, e, i, n, o, r, a) { return (void 0 === e || e this.timeline.length - 1) && (t = 0), this.current = t, this.timeline[this.current].start(), this }, stop: function(t) { return void 0 === t && (t = !1), this.isRunning = !1, this._onUpdateCallback = null, this._onUpdateCallbackContext = null, t && (this.onComplete.dispatch(this.target, this), this._hasStarted = !1, this.chainedTween && this.chainedTween.start()), this.manager.remove(this), this }, updateTweenData: function(t, e, i) { if (0 === this.timeline.length) return this; if (void 0 === i && (i = 0), -1 === i) for (var n = 0; n < this.timeline.length; n++) this.timeline[n][t] = e; else this.timeline[i][t] = e; return this }, delay: function(t, e) { return this.updateTweenData("delay", t, e) }, repeat: function(t, e, i) { return void 0 === e && (e = 0), this.updateTweenData("repeatCounter", t, i), this.updateTweenData("repeatDelay", e, i) }, repeatDelay: function(t, e) { return this.updateTweenData("repeatDelay", t, e) }, yoyo: function(t, e, i) { return void 0 === e && (e = 0), this.updateTweenData("yoyo", t, i), this.updateTweenData("yoyoDelay", e, i) }, yoyoDelay: function(t, e) { return this.updateTweenData("yoyoDelay", t, e) }, easing: function(t, e) { return "string" == typeof t && this.manager.easeMap[t] && (t = this.manager.easeMap[t]), this.updateTweenData("easingFunction", t, e) }, interpolation: function(t, e, i) { return void 0 === e && (e = s.Math), this.updateTweenData("interpolationFunction", t, i), this.updateTweenData("interpolationContext", e, i) }, repeatAll: function(t) { return void 0 === t && (t = 0), this.repeatCounter = t,
this }, chain: function() { for (var t = arguments.length; t--; ) t > 0 ? arguments[t - 1].chainedTween = arguments[t] : this.chainedTween = arguments[t]; return this }, loop: function(t) { return void 0 === t && (t = !0), this.repeatCounter = t ? -1 : 0, this }, onUpdateCallback: function(t, e) { return this._onUpdateCallback = t, this._onUpdateCallbackContext = e, this }, pause: function() { this.isPaused = !0, this._codePaused = !0, this._pausedTime = this.game.time.time }, _pause: function() { this._codePaused || (this.isPaused = !0, this._pausedTime = this.game.time.time) }, resume: function() { if (this.isPaused) { this.isPaused = !1, this._codePaused = !1; for (var t = 0; t < this.timeline.length; t++) this.timeline[t].isRunning || (this.timeline[t].startTime += this.game.time.time - this._pausedTime) } }, _resume: function() { this._codePaused || this.resume() }, update: function(t) { if (this.pendingDelete || !this.target) return !1; if (this.isPaused) return !0; var e = this.timeline[this.current].update(t); if (e === s.TweenData.PENDING) return !0; if (e === s.TweenData.RUNNING) return this._hasStarted || (this.onStart.dispatch(this.target, this), this._hasStarted = !0), null !== this._onUpdateCallback && this._onUpdateCallback.call(this._onUpdateCallbackContext, this, this.timeline[this.current].value, this.timeline[this.current]), this.isRunning; if (e === s.TweenData.LOOPED) return -1 === this.timeline[this.current].repeatCounter ? this.onLoop.dispatch(this.target, this) : this.onRepeat.dispatch(this.target, this),
!0; if (e === s.TweenData.COMPLETE) { var i = !1; return this.reverse ? --this.current < 0 && (this.current = this.timeline.length - 1, i = !0) : ++this.current === this.timeline.length && (this.current = 0, i = !0), i ? -1 === this.repeatCounter ? (this.timeline[this.current].start(), this.onLoop.dispatch(this.target, this), !0) : this.repeatCounter > 0 ? (this.repeatCounter--, this.timeline[this.current].start(), this.onRepeat.dispatch(this.target, this), !0) : (this.isRunning = !1, this.onComplete.dispatch(this.target, this), this._hasStarted = !1, this.chainedTween && this.chainedTween.start(), !1) : (this.onChildComplete.dispatch(this.target, this), this.timeline[this.current].start(), !0) } }, generateData: function(t, e) { if (null === this.game || null === this.target) return null; void 0 === t && (t = 60), void 0 === e && (e = []); for (var i = 0; i < this.timeline.length; i++) for (var n in this.timeline[i].vEnd) this.properties[n] = this.target[n] || 0, Array.isArray(this.properties[n]) || (this.properties[n] *= 1); for (var i = 0; i < this.timeline.length; i++) this.timeline[i].loadValues(); for (var i = 0; i < this.timeline.length; i++) e = e.concat(this.timeline[i].generateData(t)); return e } }, Object.defineProperty(s.Tween.prototype, "totalDuration", { get: function() { for (var t = 0, e = 0; e < this.timeline.length; e++) t += this.timeline[e].duration; return t } }), s.Tween.prototype.constructor = s.Tween, s.TweenData = function(t) { this.parent = t, this.game = t.game, this.vStart = {}, this.vStartCache = {}, this.vEnd = {}, this.vEndCache = {}, this.duration = 1e3, this.percent = 0, this.value = 0, this.repeatCounter = 0,
this.repeatDelay = 0, this.repeatTotal = 0, this.interpolate = !1, this.yoyo = !1, this.yoyoDelay = 0, this.inReverse = !1, this.delay = 0, this.dt = 0, this.startTime = null, this.easingFunction = s.Easing.Default, this.interpolationFunction = s.Math.linearInterpolation, this.interpolationContext = s.Math, this.isRunning = !1, this.isFrom = !1 } , s.TweenData.PENDING = 0, s.TweenData.RUNNING = 1, s.TweenData.LOOPED = 2, s.TweenData.COMPLETE = 3, s.TweenData.prototype = { to: function(t, e, i, n, s, o) { return this.vEnd = t, this.duration = e, this.easingFunction = i, this.delay = n, this.repeatTotal = s, this.yoyo = o, this.isFrom = !1, this }, from: function(t, e, i, n, s, o) { return this.vEnd = t, this.duration = e, this.easingFunction = i, this.delay = n, this.repeatTotal = s, this.yoyo = o, this.isFrom = !0, this }, start: function() { if (this.startTime = this.game.time.time + this.delay, this.parent.reverse ? this.dt = this.duration : this.dt = 0, this.delay > 0 ? this.isRunning = !1 : this.isRunning = !0, this.isFrom) for (var t in this.vStartCache) this.vStart[t] = this.vEndCache[t], this.vEnd[t] = this.vStartCache[t], this.parent.target[t] = this.vStart[t]; return this.value = 0, this.yoyoCounter = 0, this.repeatCounter = this.repeatTotal, this }, loadValues: function() { for (var t in this.parent.properties) { if (this.vStart[t] = this.parent.properties[t], Array.isArray(this.vEnd[t])) {
if (0 === this.vEnd[t].length) continue; 0 === this.percent && (this.vEnd[t] = [this.vStart[t]].concat(this.vEnd[t])) } void 0 !== this.vEnd[t] ? ("string" == typeof this.vEnd[t] && (this.vEnd[t] = this.vStart[t] + parseFloat(this.vEnd[t], 10)), this.parent.properties[t] = this.vEnd[t]) : this.vEnd[t] = this.vStart[t], this.vStartCache[t] = this.vStart[t], this.vEndCache[t] = this.vEnd[t] } return this }, update: function(t) { if (this.isRunning) { if (t < this.startTime) return s.TweenData.RUNNING } else { if (!(t >= this.startTime)) return s.TweenData.PENDING; this.isRunning = !0 } var e = this.parent.frameBased ? this.game.time.physicsElapsedMS : this.game.time.elapsedMS; this.parent.reverse ? (this.dt -= e * this.parent.timeScale, this.dt = Math.max(this.dt, 0)) : (this.dt += e * this.parent.timeScale, this.dt = Math.min(this.dt, this.duration)), this.percent = this.dt / this.duration, this.value = this.easingFunction(this.percent); for (var i in this.vEnd) { var n = this.vStart[i] , o = this.vEnd[i]; Array.isArray(o) ? this.parent.target[i] = this.interpolationFunction.call(this.interpolationContext, o, this.value) : this.parent.target[i] = n + (o - n) * this.value } return !this.parent.reverse && 1 === this.percent || this.parent.reverse && 0 === this.percent ? this.repeat() : s.TweenData.RUNNING }, generateData: function(t) { this.parent.reverse ? this.dt = this.duration : this.dt = 0; var e = [] , i = !1 , n = 1 / t * 1e3; do { this.parent.reverse ? (this.dt -= n, this.dt = Math.max(this.dt, 0)) : (this.dt += n, this.dt = Math.min(this.dt, this.duration)), this.percent = this.dt / this.duration, this.value = this.easingFunction(this.percent); var s = {}; for (var o in this.vEnd) { var r = this.vStart[o] , a = this.vEnd[o]; Array.isArray(a) ? s[o] = this.interpolationFunction(a, this.value) : s[o] = r + (a - r) * this.value }
e.push(s), (!this.parent.reverse && 1 === this.percent || this.parent.reverse && 0 === this.percent) && (i = !0) } while (!i);if (this.yoyo) { var h = e.slice(); h.reverse(), e = e.concat(h) } return e }, repeat: function() { if (this.yoyo) { if (this.inReverse && 0 === this.repeatCounter) { for (var t in this.vStartCache) this.vStart[t] = this.vStartCache[t], this.vEnd[t] = this.vEndCache[t]; return this.inReverse = !1, s.TweenData.COMPLETE } this.inReverse = !this.inReverse } else if (0 === this.repeatCounter) return s.TweenData.COMPLETE; if (this.inReverse) for (var t in this.vStartCache) this.vStart[t] = this.vEndCache[t], this.vEnd[t] = this.vStartCache[t]; else { for (var t in this.vStartCache) this.vStart[t] = this.vStartCache[t], this.vEnd[t] = this.vEndCache[t]; this.repeatCounter > 0 && this.repeatCounter-} return this.startTime = this.game.time.time, this.yoyo && this.inReverse ? this.startTime += this.yoyoDelay : this.inReverse || (this.startTime += this.repeatDelay), this.parent.reverse ? this.dt = this.duration : this.dt = 0, s.TweenData.LOOPED } }, s.TweenData.prototype.constructor = s.TweenData, s.Easing = { Linear: { None: function(t) { return t } }, Quadratic: { In: function(t) { return t * t }, Out: function(t) { return t * (2 - t) }, InOut: function(t) { return (t *= 2) < 1 ? .5 * t * t : -.5 * (--t * (t - 2) - 1) } }, Cubic: { In: function(t) {
2)
return t * t * t }, Out: function(t) { return --t * t * t + 1 }, InOut: function(t) { return (t *= 2) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + } }, Quartic: { In: function(t) { return t * t * t * t }, Out: function(t) { return 1 - --t * t * t * t }, InOut: function(t) { return (t *= 2) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t
* t * t - 2)
} }, Quintic: { In: function(t) { return t * t * t * t * t }, Out: function(t) { return --t * t * t * t * t + 1 }, InOut: function(t) { return (t *= 2) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2) } }, Sinusoidal: { In: function(t) { return 0 === t ? 0 : 1 === t ? 1 : 1 - Math.cos(t * Math.PI / 2) }, Out: function(t) { return 0 === t ? 0 : 1 === t ? 1 : Math.sin(t * Math.PI / 2) }, InOut: function(t) { return 0 === t ? 0 : 1 === t ? 1 : .5 * (1 - Math.cos(Math.PI * t)) } }, Exponential: { In: function(t) { return 0 === t ? 0 : Math.pow(1024, t - 1) }, Out: function(t) { return 1 === t ? 1 : 1 - Math.pow(2, -10 * t) }, InOut: 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))) } },
Circular: { In: function(t) { return 1 - Math.sqrt(1 - t * t) }, Out: function(t) { return Math.sqrt(1 - --t * t) }, InOut: function(t) { return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1) } }, Elastic: { In: function(t) { var e, i = .1, n = .4; return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, e = n / 4) : e = n * Math.asin(1 / i) / (2 * Math.PI), -i * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / n)) }, Out: function(t) { var e, i = .1, n = .4; return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, e = n / 4) : e = n * Math.asin(1 / i) / (2 * Math.PI), i * Math.pow(2, -10 * t) * Math.sin((t - e) * (2 * Math.PI) / n) + 1) }, InOut: function(t) { var e, i = .1, n = .4; return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, e = n / 4) : e = n * Math.asin(1 / i) / (2 * Math.PI), (t *= 2) < 1 ? i * Math.pow(2, 10 * (t -= 1)) * Math.sin((t e) * (2 * Math.PI) / n) * -.5 : i * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / n) * .5 + 1) } }, Back: { In: function(t) { var e = 1.70158; return t * t * ((e + 1) * t - e) }, Out: function(t) { var e = 1.70158; return --t * t * ((e + 1) * t + e) + 1 }, InOut: 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) } }, Bounce: { In: function(t) { return 1 - s.Easing.Bounce.Out(1 - t) }, Out: 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
}, InOut: function(t) { return t < .5 ? .5 * s.Easing.Bounce.In(2 * t) : .5 * s.Easing.Bounce.Out(2 * t - 1) + .5 } } }, s.Easing.Default = s.Easing.Linear.None, s.Easing.Power0 = s.Easing.Linear.None, s.Easing.Power1 = s.Easing.Quadratic.Out, s.Easing.Power2 = s.Easing.Cubic.Out, s.Easing.Power3 = s.Easing.Quartic.Out, s.Easing.Power4 = s.Easing.Quintic.Out, s.Time = function(t) { this.game = t, this.time = 0, this.prevTime = 0, this.now = 0, this.elapsed = 0, this.elapsedMS = 0, this.physicsElapsed = 1 / 60, this.physicsElapsedMS = 1 / 60 * 1e3, this.desiredFpsMult = 1 / 60, this._desiredFps = 60, this.suggestedFps = this.desiredFps, this.slowMotion = 1, this.advancedTiming = !1, this.frames = 0, this.fps = 0, this.fpsMin = 1e3, this.fpsMax = 0, this.msMin = 1e3, this.msMax = 0, this.pauseDuration = 0, this.timeToCall = 0, this.timeExpected = 0, this.events = new s.Timer(this.game,!1), this._frameCount = 0, this._elapsedAccumulator = 0, this._started = 0, this._timeLastSecond = 0, this._pauseStarted = 0, this._justResumed = !1, this._timers = [] } , s.Time.prototype = { boot: function() { this._started = Date.now(), this.time = Date.now(), this.events.start(), this.timeExpected = this.time }, add: function(t) { return this._timers.push(t), t }, create: function(t) { void 0 === t && (t = !0);
var e = new s.Timer(this.game,t); return this._timers.push(e), e
}, removeAll: function() { for (var t = 0; t < this._timers.length; t++) this._timers[t].destroy(); this._timers = [], this.events.removeAll() }, refresh: function() { var t = this.time; this.time = Date.now(), this.elapsedMS = this.time - t }, update: function(t) { var e = this.time; this.time = Date.now(), this.elapsedMS = this.time - e, this.prevTime = this.now, this.now = t, this.elapsed = this.now - this.prevTime, this.game.raf._isSetTimeOut && (this.timeToCall = Math.floor(Math.max(0, 1e3 / this._desiredFps - (this.timeExpected - t))), this.timeExpected = t + this.timeToCall), this.advancedTiming && this.updateAdvancedTiming(), this.game.paused || (this.events.update(this.time), this._timers.length && this.updateTimers()) }, updateTimers: function() { for (var t = 0, e = this._timers.length; t < e; ) this._timers[t].update(this.time) ? t++ : (this._timers.splice(t, 1), e--) }, updateAdvancedTiming: function() { this._frameCount++, this._elapsedAccumulator += this.elapsed, this._frameCount >= 2 * this._desiredFps && (this.suggestedFps = 5 * Math.floor(200 / (this._elapsedAccumulator / this._frameCount)), this._frameCount = 0, this._elapsedAccumulator = 0), this.msMin = Math.min(this.msMin, this.elapsed), this.msMax = Math.max(this.msMax, this.elapsed), this.frames++, this.now > this._timeLastSecond + 1e3 && (this.fps = Math.round(1e3 * this.frames / (this.now - this._timeLastSecond)), this.fpsMin = Math.min(this.fpsMin, this.fps), this.fpsMax = Math.max(this.fpsMax, this.fps), this._timeLastSecond = this.now, this.frames = 0) }, gamePaused: function() { this._pauseStarted = Date.now(), this.events.pause(); for (var t = this._timers.length; t--; ) this._timers[t]._pause() }, gameResumed: function() {
this.time = Date.now(), this.pauseDuration = this.time - this._pauseStarted, this.events.resume(); for (var t = this._timers.length; t--; ) this._timers[t]._resume()
}, totalElapsedSeconds: function() { return .001 * (this.time - this._started) }, elapsedSince: function(t) { return this.time - t }, elapsedSecondsSince: function(t) { return .001 * (this.time - t) }, reset: function() { this._started = this.time, this.removeAll() }
}, Object.defineProperty(s.Time.prototype, "desiredFps", { get: function() { return this._desiredFps }, set: function(t) { this._desiredFps = t, this.physicsElapsed = 1 / t, this.physicsElapsedMS = 1e3 * this.physicsElapsed, this.desiredFpsMult = 1 / t } }), s.Time.prototype.constructor = s.Time, s.Timer = function(t, e) { void 0 === e && (e = !0), this.game = t, this.running = !1, this.autoDestroy = e, this.expired = !1, this.elapsed = 0, this.events = [], this.onComplete = new s.Signal, this.nextTick = 0, this.timeCap = 1e3, this.paused = !1, this._codePaused = !1, this._started = 0, this._pauseStarted = 0, this._pauseTotal = 0, this._now = Date.now(), this._len = 0, this._marked = 0, this._i = 0, this._diff = 0, this._newTick = 0 } , s.Timer.MINUTE = 6e4, s.Timer.SECOND = 1e3, s.Timer.HALF = 500,
s.Timer.QUARTER = 250, s.Timer.prototype = { create: function(t, e, i, n, o, r) { t = Math.round(t); var a = t; 0 === this._now ? a += this.game.time.time : a += this._now; var h = new s.TimerEvent(this,t,a,i,e,n,o,r); return this.events.push(h), this.order(), this.expired = !1, h }, add: function(t, e, i) { return this.create(t, !1, 0, e, i, Array.prototype.slice.call(arguments, 3)) }, repeat: function(t, e, i, n) { return this.create(t, !1, e, i, n, Array.prototype.slice.call(arguments, 4)) }, loop: function(t, e, i) { return this.create(t, !0, 0, e, i, Array.prototype.slice.call(arguments, 3)) }, start: function(t) { if (!this.running) { this._started = this.game.time.time + (t || 0), this.running = !0; for (var e = 0; e < this.events.length; e++) this.events[e].tick = this.events[e].delay + this._started } }, stop: function(t) { this.running = !1, void 0 === t && (t = !0), t && (this.events.length = 0) }, remove: function(t) { for (var e = 0; e < this.events.length; e++) if (this.events[e] === t) return this.events[e].pendingDelete = !0, !0; return !1 }, order: function() { this.events.length > 0 && (this.events.sort(this.sortHandler), this.nextTick = this.events[0].tick) }, sortHandler: function(t, e) { return t.tick < e.tick ? -1 : t.tick > e.tick ? 1 : 0 }, clearPendingEvents: function() { for (this._i = this.events.length; this._i--; ) this.events[this._i].pendingDelete && this.events.splice(this._i, 1); this._len = this.events.length, this._i = 0 }, update: function(t) {
if (this.paused) return !0; if (this.elapsed = t - this._now, this._now = t, this.elapsed > this.timeCap && this.adjustEvents(t - this.elapsed), this._marked = 0, this.clearPendingEvents(), this.running && this._now >= this.nextTick && this._len > 0) { for (; this._i < this._len && this.running && this._now >= this.events[this._i].tick && !this.events[this._i].pendingDelete; ) this._newTick = this._now + this.events[this._i].delay (this._now - this.events[this._i].tick), this._newTick < 0 && (this._newTick = this._now + this.events[this._i].delay), !0 === this.events[this._i].loop ? (this.events[this._i].tick = this._newTick, this.events[this._i].callback.apply(this.events[this._i].callbackContext, this.events[this._i].args)) : this.events[this._i].repeatCount > 0 ? (this.events[this._i].repeatCount--, this.events[this._i].tick = this._newTick, this.events[this._i].callback.apply(this.events[this._i].callbackContext, this.events[this._i].args)) : (this._marked++, this.events[this._i].pendingDelete = !0, this.events[this._i].callback.apply(this.events[this._i].callbackContext, this.events[this._i].args)), this._i++; this.events.length > this._marked ? this.order() : (this.expired = !0, this.onComplete.dispatch(this)) } return !this.expired || !this.autoDestroy }, pause: function() { this.running && (this._codePaused = !0, this.paused || (this._pauseStarted = this.game.time.time, this.paused = !0)) }, _pause: function() { !this.paused && this.running && (this._pauseStarted = this.game.time.time, this.paused = !0) }, adjustEvents: function(t) { for (var e = 0; e < this.events.length; e++) if (!this.events[e].pendingDelete) { var i = this.events[e].tick - t; i < 0 && (i = 0), this.events[e].tick = this._now + i } var n = this.nextTick - t; this.nextTick = n < 0 ? this._now : this._now + n }, resume: function() { if (this.paused) { var t = this.game.time.time; this._pauseTotal += t - this._now,
this._now = t, this.adjustEvents(this._pauseStarted), this.paused = !1, this._codePaused = !1 } }, _resume: function() { this._codePaused || this.resume() }, removeAll: function() { this.onComplete.removeAll(), this.events.length = 0, this._len = 0, this._i = 0 }, destroy: function() { this.onComplete.removeAll(), this.running = !1, this.events = [], this._len = 0, this._i = 0 } }, Object.defineProperty(s.Timer.prototype, "next", { get: function() { return this.nextTick } }), Object.defineProperty(s.Timer.prototype, "duration", { get: function() { return this.running && this.nextTick > this._now ? this.nextTick this._now : 0 } }), Object.defineProperty(s.Timer.prototype, "length", { get: function() { return this.events.length } }), Object.defineProperty(s.Timer.prototype, "ms", { get: function() { return this.running ? this._now - this._started this._pauseTotal : 0 } }), Object.defineProperty(s.Timer.prototype, "seconds", { get: function() { return this.running ? .001 * this.ms : 0 } }), s.Timer.prototype.constructor = s.Timer, s.TimerEvent = function(t, e, i, n, s, o, r, a) { this.timer = t, this.delay = e, this.tick = i, this.repeatCount = n - 1, this.loop = s, this.callback = o, this.callbackContext = r,
this.args = a, this.pendingDelete = !1 } , s.TimerEvent.prototype.constructor = s.TimerEvent, s.AnimationManager = function(t) { this.sprite = t, this.game = t.game, this.currentFrame = null, this.currentAnim = null, this.updateIfVisible = !0, this.isLoaded = !1, this._frameData = null, this._anims = {}, this._outputFrames = [] } , s.AnimationManager.prototype = { loadFrameData: function(t, e) { if (void 0 === t) return !1; if (this.isLoaded) for (var i in this._anims) this._anims[i].updateFrameData(t); return this._frameData = t, void 0 === e || null === e ? this.frame = 0 : "string" == typeof e ? this.frameName = e : this.frame = e, this.isLoaded = !0, !0 }, copyFrameData: function(t, e) { if (this._frameData = t.clone(), this.isLoaded) for (var i in this._anims) this._anims[i].updateFrameData(this._frameData); return void 0 === e || null === e ? this.frame = 0 : "string" == typeof e ? this.frameName = e : this.frame = e, this.isLoaded = !0, !0 }, add: function(t, e, i, n, o) { return e = e || [], i = i || 60, void 0 === n && (n = !1), void 0 === o && (o = !(!e || "number" != typeof e[0])), this._outputFrames = [], this._frameData.getFrameIndexes(e, o, this._outputFrames), this._anims[t] = new s.Animation(this.game,this.sprite,t,this._frameData,this._outputFrames,i,n), this.currentAnim = this._anims[t], this.sprite.tilingTexture && (this.sprite.refreshTexture = !0), this._anims[t] }, validateFrames: function(t, e) { void 0 === e && (e = !0); for (var i = 0; i < t.length; i++) if (!0 === e) { if (t[i] > this._frameData.total) return !1
} else if (!1 === this._frameData.checkFrameName(t[i])) return !1; return !0
}, play: function(t, e, i, n) { if (this._anims[t]) return this.currentAnim === this._anims[t] ? !1 === this.currentAnim.isPlaying ? (this.currentAnim.paused = !1, this.currentAnim.play(e, i, n)) : this.currentAnim : (this.currentAnim && this.currentAnim.isPlaying && this.currentAnim.stop(), this.currentAnim = this._anims[t], this.currentAnim.paused = !1, this.currentFrame = this.currentAnim.currentFrame, this.currentAnim.play(e, i, n)) }, stop: function(t, e) { void 0 === e && (e = !1), !this.currentAnim || "string" == typeof t && t !== this.currentAnim.name || this.currentAnim.stop(e) }, update: function() { return !(this.updateIfVisible && !this.sprite.visible) && (!(! this.currentAnim || !this.currentAnim.update()) && (this.currentFrame = this.currentAnim.currentFrame, !0)) }, next: function(t) { this.currentAnim && (this.currentAnim.next(t), this.currentFrame = this.currentAnim.currentFrame) }, previous: function(t) { this.currentAnim && (this.currentAnim.previous(t), this.currentFrame = this.currentAnim.currentFrame) }, getAnimation: function(t) { return "string" == typeof t && this._anims[t] ? this._anims[t] : null }, refreshFrame: function() {}, destroy: function() { var t = null; for (var t in this._anims) this._anims.hasOwnProperty(t) && this._anims[t].destroy(); this._anims = {}, this._outputFrames = [], this._frameData = null, this.currentAnim = null, this.currentFrame = null, this.sprite = null, this.game = null } }, s.AnimationManager.prototype.constructor = s.AnimationManager, Object.defineProperty(s.AnimationManager.prototype, "frameData", { get: function() { return this._frameData } }), Object.defineProperty(s.AnimationManager.prototype, "frameTotal", {
get: function() { return this._frameData.total }
}), Object.defineProperty(s.AnimationManager.prototype, "paused", { get: function() { return this.currentAnim.isPaused }, set: function(t) { this.currentAnim.paused = t } }), Object.defineProperty(s.AnimationManager.prototype, "name", { get: function() { if (this.currentAnim) return this.currentAnim.name } }), Object.defineProperty(s.AnimationManager.prototype, "frame", { get: function() { if (this.currentFrame) return this.currentFrame.index }, set: function(t) { "number" == typeof t && this._frameData && null !== this._frameData.getFrame(t) && (this.currentFrame = this._frameData.getFrame(t), this.currentFrame && this.sprite.setFrame(this.currentFrame)) } }), Object.defineProperty(s.AnimationManager.prototype, "frameName", { get: function() { if (this.currentFrame) return this.currentFrame.name }, set: function(t) { "string" == typeof t && this._frameData && null !== this._frameData.getFrameByName(t) ? (this.currentFrame = this._frameData.getFrameByName(t), this.currentFrame && (this._frameIndex = this.currentFrame.index, this.sprite.setFrame(this.currentFrame))) : console.warn("Cannot set frameName: " + t) } }), s.Animation = function(t, e, i, n, o, r, a) { void 0 === a && (a = !1), this.game = t, this._parent = e, this._frameData = n, this.name = i, this._frames = [], this._frames = this._frames.concat(o), this.delay = 1e3 / r, this.loop = a, this.loopCount = 0, this.killOnComplete = !1, this.isFinished = !1, this.isPlaying = !1, this.isPaused = !1, this._pauseStartTime = 0,
this._frameIndex = 0, this._frameDiff = 0, this._frameSkip = 1, this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]), this.onStart = new s.Signal, this.onUpdate = null, this.onComplete = new s.Signal, this.onLoop = new s.Signal, this.isReversed = !1, this.game.onPause.add(this.onPause, this), this.game.onResume.add(this.onResume, this) } , s.Animation.prototype = { play: function(t, e, i) { return "number" == typeof t && (this.delay = 1e3 / t), "boolean" == typeof e && (this.loop = e), void 0 !== i && (this.killOnComplete = i), this.isPlaying = !0, this.isFinished = !1, this.paused = !1, this.loopCount = 0, this._timeLastFrame = this.game.time.time, this._timeNextFrame = this.game.time.time + this.delay, this._frameIndex = this.isReversed ? this._frames.length - 1 : 0, this.updateCurrentFrame(!1, !0), this._parent.events.onAnimationStart$dispatch(this._parent, this), this.onStart.dispatch(this._parent, this), this._parent.animations.currentAnim = this, this._parent.animations.currentFrame = this.currentFrame, this }, restart: function() { this.isPlaying = !0, this.isFinished = !1, this.paused = !1, this.loopCount = 0, this._timeLastFrame = this.game.time.time, this._timeNextFrame = this.game.time.time + this.delay, this._frameIndex = 0, this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]), this._parent.setFrame(this.currentFrame), this._parent.animations.currentAnim = this, this._parent.animations.currentFrame = this.currentFrame, this.onStart.dispatch(this._parent, this) }, reverse: function() { return this.reversed = !this.reversed, this }, reverseOnce: function() { return this.onComplete.addOnce(this.reverse, this), this.reverse() }, setFrame: function(t, e) { var i; if (void 0 === e && (e = !1),
= n);
"string" == typeof t) for (var n = 0; n < this._frames.length; n++) this._frameData.getFrame(this._frames[n]).name === t && (i else if ("number" == typeof t) if (e) i = t; else for (var n = 0; n < this._frames.length; n++) this._frames[n] === t && (i = n); if (i) { var s = this.isReversed ? -1 : 1; this._frameIndex = i - s, this._timeNextFrame = this.game.time.time, this.update() }
}, stop: function(t, e) { void 0 === t && (t = !1), void 0 === e && (e = !1), this.isPlaying = !1, this.isFinished = !0, this.paused = !1, t && (this.currentFrame = this._frameData.getFrame(this._frames[0]), this._parent.setFrame(this.currentFrame)), e && (this._parent.events.onAnimationComplete$dispatch(this._parent, this), this.onComplete.dispatch(this._parent, this)) }, onPause: function() { this.isPlaying && (this._frameDiff = this._timeNextFrame this.game.time.time) }, onResume: function() { this.isPlaying && (this._timeNextFrame = this.game.time.time + this._frameDiff) }, update: function() { return !this.isPaused && (!!(this.isPlaying && this.game.time.time >= this._timeNextFrame) && (this._frameSkip = 1, this._frameDiff = this.game.time.time - this._timeNextFrame, this._timeLastFrame = this.game.time.time, this._frameDiff > this.delay && (this._frameSkip = Math.floor(this._frameDiff / this.delay), this._frameDiff -= this._frameSkip * this.delay), this._timeNextFrame = this.game.time.time + (this.delay this._frameDiff), this.isReversed ? this._frameIndex -= this._frameSkip : this._frameIndex += this._frameSkip, !this.isReversed && this._frameIndex >= this._frames.length || this.isReversed && this._frameIndex = this._frames.length && (this.loop ? e %= this._frames.length : e = this._frames.length - 1), e !== this._frameIndex && (this._frameIndex = e, this.updateCurrentFrame(!0)) }, previous: function(t) { void 0 === t && (t = 1); var e = this._frameIndex - t; e < 0 && (this.loop ? e = this._frames.length + e : e++), e !== this._frameIndex && (this._frameIndex = e, this.updateCurrentFrame(!0)) }, updateFrameData: function(t) { this._frameData = t, this.currentFrame = this._frameData ? this._frameData.getFrame(this._frames[this._frameIndex % this._frames.length]) : null }, destroy: function() { this._frameData && (this.game.onPause.remove(this.onPause, this), this.game.onResume.remove(this.onResume, this), this.game = null, this._parent = null, this._frames = null, this._frameData = null, this.currentFrame = null, this.isPlaying = !1, this.onStart.dispose(), this.onLoop.dispose(), this.onComplete.dispose(), this.onUpdate && this.onUpdate.dispose()) }, complete: function() { this._frameIndex = this._frames.length - 1, this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]), this.isPlaying = !1,
this),
this.isFinished = !0, this.paused = !1, this._parent.events.onAnimationComplete$dispatch(this._parent, this.onComplete.dispatch(this._parent, this), this.killOnComplete && this._parent.kill()
} }, s.Animation.prototype.constructor = s.Animation, Object.defineProperty(s.Animation.prototype, "paused", { get: function() { return this.isPaused }, set: function(t) { this.isPaused = t, t ? this._pauseStartTime = this.game.time.time : this.isPlaying && (this._timeNextFrame = this.game.time.time + this.delay) } }), Object.defineProperty(s.Animation.prototype, "reversed", { get: function() { return this.isReversed }, set: function(t) { this.isReversed = t } }), Object.defineProperty(s.Animation.prototype, "frameTotal", { get: function() { return this._frames.length } }), Object.defineProperty(s.Animation.prototype, "frame", { get: function() { return null !== this.currentFrame ? this.currentFrame.index : this._frameIndex }, set: function(t) { this.currentFrame = this._frameData.getFrame(this._frames[t]), null !== this.currentFrame && (this._frameIndex = t, this._parent.setFrame(this.currentFrame), this.onUpdate && this.onUpdate.dispatch(this, this.currentFrame)) } }), Object.defineProperty(s.Animation.prototype, "speed", { get: function() { return 1e3 / this.delay }, set: function(t) { t > 0 && (this.delay = 1e3 / t) } }), Object.defineProperty(s.Animation.prototype, "enableUpdate", { get: function() { return null !== this.onUpdate }, set: function(t) { t && null === this.onUpdate ? this.onUpdate = new s.Signal : t || null === this.onUpdate || (this.onUpdate.dispose(),
}
this.onUpdate = null)
}), s.Animation.generateFrameNames = function(t, e, i, n, o) { void 0 === n && (n = ""); var r = [] , a = ""; if (e < i) for (var h = e; h = i; h--) a = "number" == typeof o ? s.Utils.pad(h.toString(), o, "0", 1) : h.toString(), a = t + a + n, r.push(a); return r } , s.Frame = function(t, e, i, n, o, r) { this.index = t, this.x = e, this.y = i, this.width = n, this.height = o, this.name = r, this.centerX = Math.floor(n / 2), this.centerY = Math.floor(o / 2), this.distance = s.Math.distance(0, 0, n, o), this.rotated = !1, this.trimmed = !1, this.sourceSizeW = n, this.sourceSizeH = o, this.spriteSourceSizeX = 0, this.spriteSourceSizeY = 0, this.spriteSourceSizeW = 0, this.spriteSourceSizeH = 0, this.right = this.x + this.width, this.bottom = this.y + this.height } , s.Frame.prototype = { resize: function(t, e) { this.width = t, this.height = e, this.centerX = Math.floor(t / 2), this.centerY = Math.floor(e / 2), this.distance = s.Math.distance(0, 0, t, e), this.sourceSizeW = t, this.sourceSizeH = e, this.right = this.x + t, this.bottom = this.y + e }, setTrim: function(t, e, i, n, s, o, r) { this.trimmed = t, t && (this.sourceSizeW = e,
this.sourceSizeH = i, this.centerX = Math.floor(e / 2), this.centerY = Math.floor(i / 2), this.spriteSourceSizeX = n, this.spriteSourceSizeY = s, this.spriteSourceSizeW = o, this.spriteSourceSizeH = r)
}, clone: function() { var t = new s.Frame(this.index,this.x,this.y,this.width,this.height,this.name); for (var e in this) this.hasOwnProperty(e) && (t[e] = this[e]); return t }, getRect: function(t) { return void 0 === t ? t = new s.Rectangle(this.x,this.y,this.width,this.height) : t.setTo(this.x, this.y, this.width, this.height), t } }, s.Frame.prototype.constructor = s.Frame, s.FrameData = function() { this._frames = [], this._frameNames = [] } , s.FrameData.prototype = { addFrame: function(t) { return t.index = this._frames.length, this._frames.push(t), "" !== t.name && (this._frameNames[t.name] = t.index), t }, getFrame: function(t) { return t >= this._frames.length && (t = 0), this._frames[t] }, getFrameByName: function(t) { return "number" == typeof this._frameNames[t] ? this._frames[this._frameNames[t]] : null }, checkFrameName: function(t) { return null != this._frameNames[t] }, clone: function() { for (var t = new s.FrameData, e = 0; e < this._frames.length; e++) t._frames.push(this._frames[e].clone()); for (var i in this._frameNames) this._frameNames.hasOwnProperty(i) && t._frameNames.push(this._frameNames[i]); return t }, getFrameRange: function(t, e, i) { void 0 === i && (i = []); for (var n = t; n -1 }, getAssetIndex: function(t, e) { for (var i = -1, n = 0; n < this._fileList.length; n++) { var s = this._fileList[n]; if (s.type === t && s.key === e && (i = n, !s.loaded && !s.loading)) break } return i }, getAsset: function(t, e) { var i = this.getAssetIndex(t, e); return i > -1 && { index: i, file: this._fileList[i] } }, reset: function(t, e) { void 0 === e && (e = !1), this.resetLocked || (t && (this.preloadSprite = null), this.isLoading = !1, this._processingHead = 0, this._fileList.length = 0, this._flightQueue.length = 0, this._fileLoadStarted = !1, this._totalFileCount = 0, this._totalPackCount = 0, this._loadedPackCount = 0, this._loadedFileCount = 0, e && (this.onLoadStart.removeAll(), this.onLoadComplete.removeAll(), this.onPackComplete.removeAll(), this.onFileStart.removeAll(), this.onFileComplete.removeAll(), this.onFileError.removeAll())) }, addToFileList: function(t, e, i, n, s, o) { if (void 0 === s && (s = !1), void 0 === e || "" === e) return console.warn("Phaser.Loader: Invalid or no key given of type " + t), this; if (void 0 === i || null === i) { if (!o) return console.warn("Phaser.Loader: No URL given for file type: " + t + " key: " + e), this; i = e + o } var r = {
type: t, key: e, path: this.path, url: i, syncPoint: this._withSyncPointDepth > 0, data: null, loading: !1, loaded: !1, error: !1
}; if (n) for (var a in n) r[a] = n[a]; var h = this.getAssetIndex(t, e); if (s && h > -1) { var l = this._fileList[h]; l.loading || l.loaded ? (this._fileList.push(r), this._totalFileCount++) : this._fileList[h] = r } else -1 === h && (this._fileList.push(r), this._totalFileCount++); return this }, replaceInFileList: function(t, e, i, n) { return this.addToFileList(t, e, i, n, !0) }, pack: function(t, e, i, n) { if (void 0 === e && (e = null), void 0 === i && (i = null), void 0 === n && (n = null), !e && !i) return console.warn("Phaser.Loader.pack - Both url and data are null. One must be set."), this; var s = { type: "packfile", key: t, url: e, path: this.path, syncPoint: !0, data: null, loading: !1, loaded: !1, error: !1, callbackContext: n }; i && ("string" == typeof i && (i = JSON.parse(i)), s.data = i || {}, s.loaded = !0); for (var o = 0; o < this._fileList.length + 1; o++) { var r = this._fileList[o]; if (!r || !r.loaded && !r.loading && "packfile" !== r.type) { this._fileList.splice(o, 0, s), this._totalPackCount++; break } } return this },
image: function(t, e, i) { return "object" == typeof e ? this.texture(t, e, i) : this.addToFileList("image", t, e, void 0, i, ".png") }, texture: function(t, e, i) { if (this.game.renderType === s.WEBGL) { var n, o = this.game.renderer.extensions.compression; for (n in e) if (n.toUpperCase()in o) return this.addToFileList("texture", t, e[n], void 0, i, ".pvr") } return e.truecolor && this.addToFileList("image", t, e.truecolor, void 0, i, ".png"), this }, images: function(t, e) { if (Array.isArray(e)) for (var i = 0; i < t.length; i++) this.image(t[i], e[i]); else for (var i = 0; i < t.length; i++) this.image(t[i]); return this }, text: function(t, e, i) { return this.addToFileList("text", t, e, void 0, i, ".txt") }, json: function(t, e, i) { return this.addToFileList("json", t, e, void 0, i, ".json") }, shader: function(t, e, i) { return this.addToFileList("shader", t, e, void 0, i, ".frag") }, xml: function(t, e, i) { return this.addToFileList("xml", t, e, void 0, i, ".xml") }, script: function(t, e, i, n) { return void 0 === i && (i = !1), !1 !== i && void 0 === n && (n = this), this.addToFileList("script", t, e, { syncPoint: !0, callback: i, callbackContext: n }, !1, ".js") }, binary: function(t, e, i, n) { return void 0 === i && (i = !1), !1 !== i && void 0 === n && (n = i), this.addToFileList("binary", t, e, { callback: i, callbackContext: n }, !1, ".bin") }, spritesheet: function(t, e, i, n, s, o, r, a) { return void 0 === s && (s = -1), void 0 === o && (o = 0), void 0 === r && (r = 0), void 0 === a && (a = 0),
this.addToFileList("spritesheet", t, e, { frameWidth: i, frameHeight: n, frameMax: s, margin: o, spacing: r, skipFrames: a }, !1, ".png")
null),
}, audio: function(t, e, i) { return this.game.sound.noAudio ? this : (void 0 === i && (i = !0), "string" == typeof e && (e = [e]), this.addToFileList("audio", t, e, { buffer: null, autoDecode: i })) }, audioSprite: function(t, e, i, n, s) { return this.game.sound.noAudio ? this : (void 0 === i && (i =
void 0 === n && (n = null), void 0 === s && (s = !0), this.audio(t, e, s), i ? this.json(t + "-audioatlas", i) : n ? ("string" == typeof n && (n = JSON.parse(n)), this.cache.addJSON(t + "-audioatlas", "", n)) : console.warn("Phaser.Loader.audiosprite - You must specify either a jsonURL or provide a jsonData object"), this) }, audiosprite: function(t, e, i, n, s) { return this.audioSprite(t, e, i, n, s) }, video: function(t, e, i, n) { return void 0 === i && (i = this.game.device.firefox ? "loadeddata" : "canplaythrough"), void 0 === n && (n = !1), "string" == typeof e && (e = [e]), this.addToFileList("video", t, e, { buffer: null, asBlob: n, loadEvent: i }) }, tilemap: function(t, e, i, n) { if (void 0 === e && (e = null), void 0 === i && (i = null), void 0 === n && (n = s.Tilemap.CSV), e || i || (e = n === s.Tilemap.CSV ? t + ".csv" : t + ".json"), i) { switch (n) { case s.Tilemap.CSV: break; case s.Tilemap.TILED_JSON: "string" == typeof i && (i = JSON.parse(i)) } this.cache.addTilemap(t, null, i, n) } else this.addToFileList("tilemap", t, e, {
format: n }); return this
}, physics: function(t, e, i, n) { return void 0 === e && (e = null), void 0 === i && (i = null), void 0 === n && (n = s.Physics.LIME_CORONA_JSON), e || i || (e = t + ".json"), i ? ("string" == typeof i && (i = JSON.parse(i)), this.cache.addPhysicsData(t, null, i, n)) : this.addToFileList("physics", t, e, { format: n }), this }, bitmapFont: function(t, e, i, n, s, o) { if (void 0 !== e && null !== e || (e = t + ".png"), void 0 === i && (i = null), void 0 === n && (n = null), null === i && null === n && (i = t + ".xml"), void 0 === s && (s = 0), void 0 === o && (o = 0), i) this.addToFileList("bitmapfont", t, e, { atlasURL: i, xSpacing: s, ySpacing: o }); else if ("string" == typeof n) { var r, a; try { r = JSON.parse(n) } catch (t) { a = this.parseXml(n) } if (!a && !r) throw new Error("Phaser.Loader. Invalid Bitmap Font atlas given"); this.addToFileList("bitmapfont", t, e, { atlasURL: null, atlasData: r || a, atlasType: r ? "json" : "xml", xSpacing: s, ySpacing: o }) } return this }, atlasJSONArray: function(t, e, i, n) { return this.atlas(t, e, i, n, s.Loader.TEXTURE_ATLAS_JSON_ARRAY) }, atlasJSONHash: function(t, e, i, n) { return this.atlas(t, e, i, n, s.Loader.TEXTURE_ATLAS_JSON_HASH) }, atlasXML: function(t, e, i, n) { return void 0 === i && (i = null), void 0 === n && (n = null), i || n || (i = t + ".xml"),
this.atlas(t, e, i, n, s.Loader.TEXTURE_ATLAS_XML_STARLING) }, atlas: function(t, e, i, n, o) { if (void 0 !== e && null !== e || (e = t + ".png"), void 0 === i && (i = null), void 0 === n && (n = null), void 0 === o && (o = s.Loader.TEXTURE_ATLAS_JSON_ARRAY), i || n || (i = o === s.Loader.TEXTURE_ATLAS_XML_STARLING ? t + ".xml" : t + ".json"), i) this.addToFileList("textureatlas", t, e, { atlasURL: i, format: o }); else { switch (o) { case s.Loader.TEXTURE_ATLAS_JSON_ARRAY: "string" == typeof n && (n = JSON.parse(n)); break; case s.Loader.TEXTURE_ATLAS_XML_STARLING: if ("string" == typeof n) { var r = this.parseXml(n); if (!r) throw new Error("Phaser.Loader. Invalid Texture Atlas XML given"); n = r } } this.addToFileList("textureatlas", t, e, { atlasURL: null, atlasData: n, format: o }) } return this }, withSyncPoint: function(t, e) { this._withSyncPointDepth++; try { t.call(e || this, this) } finally { this._withSyncPointDepth-} return this }, addSyncPoint: function(t, e) { var i = this.getAsset(t, e); return i && (i.file.syncPoint = !0), this }, removeFile: function(t, e) { var i = this.getAsset(t, e); i && (i.loaded || i.loading || this._fileList.splice(i.index, 1)) }, removeAll: function() { this._fileList.length = 0, this._flightQueue.length = 0 }, start: function() {
this.isLoading || (this.hasLoaded = !1, this.isLoading = !0, this.updateProgress(), this.processLoadQueue()) }, processLoadQueue: function() { if (!this.isLoading) return console.warn("Phaser.Loader - active loading canceled / reset"),
void this.finishedLoading(!0); for (var t = 0; t < this._flightQueue.length; t++) { var e = this._flightQueue[t]; (e.loaded || e.error) && (this._flightQueue.splice(t, 1), t--, e.loading = !1, e.requestUrl = null, e.requestObject = null, e.error && this.onFileError.dispatch(e.key, e), "packfile" !== e.type ? (this._loadedFileCount++, this.onFileComplete.dispatch(this.progress, e.key, !e.error, this._loadedFileCount, this._totalFileCount)) : "packfile" === e.type && e.error && (this._loadedPackCount++, this.onPackComplete.dispatch(e.key, !e.error, this._loadedPackCount, this._totalPackCount))) } for (var i = !1, n = this.enableParallel ? s.Math.clamp(this.maxParallelDownloads, 1, 12) : 1, t = this._processingHead; t < this._fileList.length; t++) { var e = this._fileList[t]; if ("packfile" === e.type && !e.error && e.loaded && t === this._processingHead && (this.processPack(e), this._loadedPackCount++, this.onPackComplete.dispatch(e.key, !e.error, this._loadedPackCount, this._totalPackCount)), e.loaded || e.error ? t === this._processingHead && (this._processingHead = t + 1) : !e.loading && this._flightQueue.length < n && ("packfile" !== e.type || e.data ? i || (this._fileLoadStarted || (this._fileLoadStarted = !0, this.onLoadStart.dispatch()), this._flightQueue.push(e), e.loading = !0, this.onFileStart.dispatch(this.progress, e.key, e.url), this.loadFile(e)) : (this._flightQueue.push(e), e.loading = !0, this.loadFile(e))), !e.loaded && e.syncPoint && (i = !0), this._flightQueue.length >= n || i && this._loadedPackCount === this._totalPackCount) break } if (this.updateProgress(), this._processingHead >= this._fileList.length) this.finishedLoading(); else if (!this._flightQueue.length) { console.warn("Phaser.Loader - aborting: processing queue empty, loading may have stalled"); var o = this; setTimeout(function() { o.finishedLoading(!0)
}
}, 2e3)
}, finishedLoading: function(t) { this.hasLoaded || (this.hasLoaded = !0, this.isLoading = !1, t || this._fileLoadStarted || (this._fileLoadStarted = !0, this.onLoadStart.dispatch()), this.onLoadComplete.dispatch(), this.game.state.loadComplete(), this.reset()) }, asyncComplete: function(t, e) { void 0 === e && (e = ""), t.loaded = !0, t.error = !!e, e && (t.errorMessage = e, console.warn("Phaser.Loader - " + t.type + "[" + t.key + "]: " + e)),
this.processLoadQueue() }, processPack: function(t) { var e = t.data[t.key]; if (!e) return void console.warn("Phaser.Loader - " + t.key + ": pack has data, but not for pack key"); for (var i = 0; i < e.length; i++) { var n = e[i]; switch (n.type) { case "image": this.image(n.key, n.url, n.overwrite); break; case "text": this.text(n.key, n.url, n.overwrite); break; case "json": this.json(n.key, n.url, n.overwrite); break; case "xml": this.xml(n.key, n.url, n.overwrite); break; case "script": this.script(n.key, n.url, n.callback, t.callbackContext || this); break; case "binary": this.binary(n.key, n.url, n.callback, t.callbackContext || this); break; case "spritesheet": this.spritesheet(n.key, n.url, n.frameWidth, n.frameHeight, n.frameMax, n.margin, n.spacing, n.skipFrames); break; case "video": this.video(n.key, n.urls); break; case "audio": this.audio(n.key, n.urls, n.autoDecode); break;
case "audiosprite": this.audiosprite(n.key, n.urls, n.jsonURL, n.jsonData, n.autoDecode);
break; case "tilemap": this.tilemap(n.key, n.url, n.data, s.Tilemap[n.format]); break; case "physics": this.physics(n.key, n.url, n.data, s.Loader[n.format]); break; case "bitmapFont": this.bitmapFont(n.key, n.textureURL, n.atlasURL, n.atlasData, n.xSpacing, n.ySpacing); break; case "atlasJSONArray": this.atlasJSONArray(n.key, n.textureURL, n.atlasURL, n.atlasData); break; case "atlasJSONHash": this.atlasJSONHash(n.key, n.textureURL, n.atlasURL, n.atlasData); break; case "atlasXML": this.atlasXML(n.key, n.textureURL, n.atlasURL, n.atlasData); break; case "atlas": this.atlas(n.key, n.textureURL, n.atlasURL, n.atlasData, s.Loader[n.format]); break; case "shader": this.shader(n.key, n.url, n.overwrite) } } }, transformUrl: function(t, e) { return !!t && (t.match(/^(?:blob:|data:|http:\/\/| https:\/\/|\/\/)/) ? t : this.baseURL + e.path + t) }, loadFile: function(t) { switch (t.type) { case "packfile": this.xhrLoad(t, this.transformUrl(t.url, t), "text", this.fileComplete); break; case "image": case "spritesheet": case "textureatlas": case "bitmapfont": this.loadImageTag(t); break; case "audio": t.url = this.getAudioURL(t.url), t.url ? this.game.sound.usingWebAudio ? this.xhrLoad(t, this.transformUrl(t.url, t), "arraybuffer", this.fileComplete) : this.game.sound.usingAudioTag && this.loadAudioTag(t) : this.fileError(t, null, "No supported audio URL specified or device does not have audio playback support"); break; case "video":
t.url = this.getVideoURL(t.url), t.url ? t.asBlob ? this.xhrLoad(t, this.transformUrl(t.url, t), "blob", this.fileComplete) : this.loadVideoTag(t) : this.fileError(t, null, "No supported video URL specified or device does not have video playback support"); break; case "json": this.xhrLoad(t, this.transformUrl(t.url, t), "text", this.jsonLoadComplete); break; case "xml": this.xhrLoad(t, this.transformUrl(t.url, t), "text", this.xmlLoadComplete); break; case "tilemap": t.format === s.Tilemap.TILED_JSON ? this.xhrLoad(t, this.transformUrl(t.url, t), "text", this.jsonLoadComplete) : t.format === s.Tilemap.CSV ? this.xhrLoad(t, this.transformUrl(t.url, t), "text", this.csvLoadComplete) : this.asyncComplete(t, "invalid Tilemap format: " + t.format); break; case "text": case "script": case "shader": case "physics": this.xhrLoad(t, this.transformUrl(t.url, t), "text", this.fileComplete); break; case "texture": "truecolor" === t.key.split("_").pop() && this.loadImageTag(t); break; case "binary": this.xhrLoad(t, this.transformUrl(t.url, t), "arraybuffer", this.fileComplete) } }, loadImageTag: function(t) { var e = this; t.data = new Image, t.data.name = t.key, this.crossOrigin && (t.data.crossOrigin = this.crossOrigin), t.data.onload = function() { t.data.onload && (t.data.onload = null, t.data.onerror = null, e.fileComplete(t)) } , t.data.onerror = function() { t.data.onload && (t.data.onload = null, t.data.onerror = null, e.fileError(t)) } , t.data.src = this.transformUrl(t.url, t), t.data.complete && t.data.width && t.data.height && (t.data.onload = null, t.data.onerror = null, this.fileComplete(t)) }, loadVideoTag: function(t) {
var e = this; t.data = document.createElement("video"), t.data.name = t.key, t.data.controls = !1, t.data.autoplay = !1; var i = function() { t.data.removeEventListener(t.loadEvent, i, !1), t.data.onerror = null, t.data.canplay = !0, s.GAMES[e.game.id].load.fileComplete(t) }; t.data.onerror = function() { t.data.removeEventListener(t.loadEvent, i, !1), t.data.onerror = null, t.data.canplay = !1, e.fileError(t) } , t.data.addEventListener(t.loadEvent, i, !1), t.data.src = this.transformUrl(t.url, t), t.data.load()
}, loadAudioTag: function(t) { var e = this; if (this.game.sound.touchLocked) t.data = new Audio, t.data.name = t.key, t.data.preload = "auto", t.data.src = this.transformUrl(t.url, t), this.fileComplete(t); else { t.data = new Audio, t.data.name = t.key; var i = function() { t.data.removeEventListener("canplaythrough", i, !1), t.data.onerror = null, e.fileComplete(t) }; t.data.onerror = function() { t.data.removeEventListener("canplaythrough", i, !1), t.data.onerror = null, e.fileError(t) } , t.data.preload = "auto", t.data.src = this.transformUrl(t.url, t), t.data.addEventListener("canplaythrough", i, !1), t.data.load() } }, xhrLoad: function(t, e, i, n, s) { if (this.useXDomainRequest && window.XDomainRequest) return void this.xhrLoadWithXDR(t, e, i, n, s); var o = new XMLHttpRequest; o.open("GET", e, !0), o.responseType = i, !1 !== this.headers.requestedWith && o.setRequestHeader("XRequested-With", this.headers.requestedWith), this.headers[t.type] && o.setRequestHeader("Accept",
this.headers[t.type]), s = s || this.fileError; var r = this; o.onload = function() { try { return 4 === o.readyState && o.status >= 400 && o.status = 10) || (this._warnedAboutXDomainRequest = !0, console.warn("Phaser.Loader - using XDomainRequest outside of IE 9")); var o = new window.XDomainRequest; o.open("GET", e, !0), o.responseType = i, o.timeout = 3e3, s = s || this.fileError; var r = this; o.onerror = function() { try { return s.call(r, t, o) } catch (e) { r.asyncComplete(t, e.message || "Exception") } } , o.ontimeout = function() { try { return s.call(r, t, o) } catch (e) { r.asyncComplete(t, e.message || "Exception") } } , o.onprogress = function() {} , o.onload = function() { try { return 4 === o.readyState && o.status >= 400 && o.status = 0 && (n = n.substr(0, n.indexOf("?"))); if (i = n.substr((Math.max(0, n.lastIndexOf(".")) || 1 / 0) + 1).toLowerCase(), this.game.device.canPlayVideo(i)) return t[e] } } return null }, getAudioURL: function(t) { if (this.game.sound.noAudio) return null; for (var e = 0; e < t.length; e++) { var i, n = t[e]; if (n.uri) { if (i = n.type, n = n.uri, this.game.device.canPlayAudio(i)) return n } else { if (0 === n.indexOf("blob:") || 0 === n.indexOf("data:")) return n; n.indexOf("?") >= 0 && (n = n.substr(0, n.indexOf("?"))); if (i = n.substr((Math.max(0, n.lastIndexOf(".")) || 1 / 0) + 1).toLowerCase(), this.game.device.canPlayAudio(i)) return t[e] } } return null }, fileError: function(t, e, i) { var n = t.requestUrl || this.transformUrl(t.url, t) , s = "error loading asset from URL " + n; !i && e && (i = e.status), i && (s = s + " (" + i + ")"), this.asyncComplete(t, s)
}, fileComplete: function(t, e) { var i = !0; switch (t.type) { case "packfile": var n = JSON.parse(e.responseText); t.data = n || {}; break; case "texture": null !== t.data ? this.cache.addCompressedTextureMetaData(t.key, t.url, t.url.split(".").pop().toLowerCase(), t.data) : this.cache.addCompressedTextureMetaData(t.key, t.url, t.url.split(".").pop().toLowerCase(), e.response); break; case "image": this.cache.addImage(t.key, t.url, t.data); break; case "spritesheet": this.cache.addSpriteSheet(t.key, t.url, t.data, t.frameWidth, t.frameHeight, t.frameMax, t.margin, t.spacing, t.skipFrames); break; case "textureatlas": if (null == t.atlasURL) this.cache.addTextureAtlas(t.key, t.url, t.data, t.atlasData, t.format); else if (i = !1, t.format === s.Loader.TEXTURE_ATLAS_JSON_ARRAY || t.format === s.Loader.TEXTURE_ATLAS_JSON_HASH || t.format === s.Loader.TEXTURE_ATLAS_JSON_PYXEL) this.xhrLoad(t, this.transformUrl(t.atlasURL, t), "text", this.jsonLoadComplete); else { if (t.format !== s.Loader.TEXTURE_ATLAS_XML_STARLING) throw new Error("Phaser.Loader. Invalid Texture Atlas format: " + t.format); this.xhrLoad(t, this.transformUrl(t.atlasURL, t), "text", this.xmlLoadComplete) } break; case "bitmapfont": t.atlasURL ? (i = !1, this.xhrLoad(t, this.transformUrl(t.atlasURL, t), "text", function(t, e) { var i; try { i = JSON.parse(e.responseText) } catch (t) {} i ? (t.atlasType = "json", this.jsonLoadComplete(t, e)) : (t.atlasType = "xml", this.xmlLoadComplete(t, e)) })) : this.cache.addBitmapFont(t.key, t.url, t.data, t.atlasData, t.atlasType, t.xSpacing, t.ySpacing); break; case "video": if (t.asBlob) try { t.data = e.response } catch (e) { throw new Error("Phaser.Loader. Unable to parse video
file as Blob: " + t.key)
} this.cache.addVideo(t.key, t.url, t.data, t.asBlob); break; case "audio": this.game.sound.usingWebAudio ? (t.data = e.response, this.cache.addSound(t.key, t.url, t.data, !0, !1), t.autoDecode && this.game.sound.decode(t.key)) : this.cache.addSound(t.key, t.url, t.data, !1, !0); break; case "text": t.data = e.responseText, this.cache.addText(t.key, t.url, t.data); break; case "shader": t.data = e.responseText, this.cache.addShader(t.key, t.url, t.data); break; case "physics": var n = JSON.parse(e.responseText); this.cache.addPhysicsData(t.key, t.url, n, t.format); break; case "script": t.data = document.createElement("script"), t.data.language = "javascript", t.data.type = "text/javascript", t.data.defer = !1, t.data.text = e.responseText, document.head.appendChild(t.data), t.callback && (t.data = t.callback.call(t.callbackContext, t.key, e.responseText)); break; case "binary": t.callback ? t.data = t.callback.call(t.callbackContext, t.key, e.response) : t.data = e.response, this.cache.addBinary(t.key, t.data) } i && this.asyncComplete(t) }, jsonLoadComplete: function(t, e) { var i = JSON.parse(e.responseText); "tilemap" === t.type ? this.cache.addTilemap(t.key, t.url, i, t.format) : "bitmapfont" === t.type ? this.cache.addBitmapFont(t.key, t.url, t.data, i, t.atlasType, t.xSpacing, t.ySpacing) : "json" === t.type ? this.cache.addJSON(t.key, t.url, i) : this.cache.addTextureAtlas(t.key, t.url, t.data, i, t.format), this.asyncComplete(t) }, csvLoadComplete: function(t, e) { var i = e.responseText; this.cache.addTilemap(t.key, t.url, i, t.format), this.asyncComplete(t) }, xmlLoadComplete: function(t, e) { var i = e.responseText , n = this.parseXml(i); if (!n) { var s = e.responseType || e.contentType; return console.warn("Phaser.Loader - " + t.key + ": invalid XML
(" + s + ")"),
void this.asyncComplete(t, "invalid XML") } "bitmapfont" === t.type ? this.cache.addBitmapFont(t.key, t.url, t.data, n, t.atlasType, t.xSpacing, t.ySpacing) : "textureatlas" === t.type ? this.cache.addTextureAtlas(t.key, t.url, t.data, n, t.format) : "xml" === t.type && this.cache.addXML(t.key, t.url, n), this.asyncComplete(t) }, parseXml: function(t) { var e; try { if (window.DOMParser) { var i = new DOMParser; e = i.parseFromString(t, "text/xml") } else e = new ActiveXObject("Microsoft.XMLDOM"), e.async = "false", e.loadXML(t) } catch (t) { e = null } return e && e.documentElement && ! e.getElementsByTagName("parsererror").length ? e : null }, updateProgress: function() { this.preloadSprite && (0 === this.preloadSprite.direction ? this.preloadSprite.rect.width = Math.floor(this.preloadSprite.width / 100 * this.progress) : this.preloadSprite.rect.height = Math.floor(this.preloadSprite.height / 100 * this.progress), this.preloadSprite.sprite ? this.preloadSprite.sprite.updateCrop() : this.preloadSprite = null) }, totalLoadedFiles: function() { return this._loadedFileCount }, totalQueuedFiles: function() { return this._totalFileCount - this._loadedFileCount }, totalLoadedPacks: function() { return this._totalPackCount }, totalQueuedPacks: function() { return this._totalPackCount - this._loadedPackCount } }, Object.defineProperty(s.Loader.prototype, "progressFloat", { get: function() { var t = this._loadedFileCount / this._totalFileCount * 100; return s.Math.clamp(t || 0, 0, 100) } }), Object.defineProperty(s.Loader.prototype, "progress", { get: function() { return Math.round(this.progressFloat) } }), s.Loader.prototype.constructor = s.Loader, s.LoaderParser = {
bitmapFont: function(t, e, i, n) { return this.xmlBitmapFont(t, e, i, n) }, xmlBitmapFont: function(t, e, i, n, s, o) { var r = {} , a = t.getElementsByTagName("info")[0] , h = t.getElementsByTagName("common")[0]; r.font = a.getAttribute("face"), r.size = parseInt(a.getAttribute("size"), 10), r.lineHeight = parseInt(h.getAttribute("lineHeight"), 10) + n, r.chars = {}; for (var l = t.getElementsByTagName("char"), c = s ? s.x : 0, u = s ? s.y : 0, d = 0; d < l.length; d++) { var p = parseInt(l[d].getAttribute("id"), 10); r.chars[p] = { x: c + parseInt(l[d].getAttribute("x"), 10), y: u + parseInt(l[d].getAttribute("y"), 10), width: parseInt(l[d].getAttribute("width"), 10), height: parseInt(l[d].getAttribute("height"), 10), xOffset: parseInt(l[d].getAttribute("xoffset"), 10) / o, yOffset: parseInt(l[d].getAttribute("yoffset"), 10) / o, xAdvance: (parseInt(l[d].getAttribute("xadvance"), 10) + i) / o, kerning: {} } } var f = t.getElementsByTagName("kerning"); for (d = 0; d < f.length; d++) { var m = parseInt(f[d].getAttribute("first"), 10) , g = parseInt(f[d].getAttribute("second"), 10) , y = parseInt(f[d].getAttribute("amount"), 10) / o; r.chars[g].kerning[m] = y } return this.finalizeBitmapFont(e, r) }, jsonBitmapFont: function(t, e, i, n, s, o) { var r = { font: t.font.info._face, size: parseInt(t.font.info._size, 10), lineHeight: parseInt(t.font.common._lineHeight, 10) + n, chars: {} } , a = s ? s.x : 0 , h = s ? s.y : 0; return t.font.chars.char.forEach(function(t) { var e = parseInt(t._id, 10); r.chars[e] = { x: a + parseInt(t._x, 10), y: h + parseInt(t._y, 10), width: parseInt(t._width, 10), height: parseInt(t._height, 10), xOffset: parseInt(t._xoffset, 10) / o, yOffset: parseInt(t._yoffset, 10) / o, xAdvance: (parseInt(t._xadvance, 10) + i) / o, kerning: {} } }), t.font.kernings && t.font.kernings.kerning && t.font.kernings.kerning.forEach(function(t) {
10) / o
r.chars[t._second].kerning[t._first] = parseInt(t._amount, }), this.finalizeBitmapFont(e, r)
}, finalizeBitmapFont: function(t, e) { return Object.keys(e.chars).forEach(function(i) { var n = e.chars[i]; n.texture = new PIXI.Texture(t,new s.Rectangle(n.x,n.y,n.width,n.height)) }), e }, pvr: function(t) { var e, i = new Uint32Array(t.slice(0, 52)), n = new Uint8Array(t), s = null, o = i[3] = 0) { switch (o >= 0 && o = 7 && o = 0) { switch (r) { case 36196: a = "ETC1"; break; case 35840: case 35841: case 35842: case 35843: a = "PVRTC"; break; case 33776: case 33777: case 33778: case 33779: a = "S3TC" } n = { complete: !0, fileFormat: "KTX", compressionAlgorithm: a, endianness: i[3], glType: i[4], glTypeSize: i[5], glFormat: i[6], glInternalFormat: i[7], glBaseInternalFormat: i[8], width: i[9], height: i[10], pixelDepth: i[11], numberOfArrayElements: i[12], numberOfFaces: i[13], numberOfMipmapLevels: i[14], bytesOfKeyValueData: i[15], keyAndValueByteSize: i[16], imageSize: o, textureData: e.subarray(4 * (s + 1), o + 100) } } return n }, pkm: function(t) { var e = new Uint8Array(t) , i = null; return 80 === e[0] && 75 === e[1] && 77 === e[2] && 32 === e[3] && (i = { complete: !0, fileFormat: "PKM", compressionAlgorithm: "ETC1", format: 65535 & (e[6] = 400 ? 0 : 100, this.dom.getOffset(this.game.canvas, this.offset); var e = this._parentBounds.width , i = this._parentBounds.height , n = this.getParentBounds(this._parentBounds) , o = n.width !== e || n.height !== i , r = this.updateOrientationState(); (o || r) && (this.onResize && this.onResize.call(this.onResizeContext, this, n), this.updateLayout(), this.signalSizeChange()); var a = 2 * this._updateThrottle; this._updateThrottle < t && (a = Math.min(t, this._updateThrottleReset)), this._updateThrottle = s.Math.clamp(a, 25, this.trackParentInterval), this._lastUpdate = this.game.time.time } }, pauseUpdate: function() { this.preUpdate(), this._updateThrottle = this.trackParentInterval }, updateDimensions: function(t, e, i) { this.width = t * this.parentScaleFactor.x, this.height = e * this.parentScaleFactor.y, this.game.width = this.width, this.game.height = this.height, this.sourceAspectRatio = this.width / this.height, this.updateScalingAndBounds(), i && (this.game.renderer.resize(this.width, this.height), this.game.camera.setSize(this.width, this.height), this.game.world.resize(this.width, this.height)) }, updateScalingAndBounds: function() { this.scaleFactor.x = this.game.width / this.width, this.scaleFactor.y = this.game.height / this.height, this.scaleFactorInversed.x = this.width / this.game.width, this.scaleFactorInversed.y = this.height / this.game.height, this.aspectRatio = this.width / this.height, this.game.canvas && this.dom.getOffset(this.game.canvas, this.offset), this.bounds.setTo(this.offset.x, this.offset.y, this.width, this.height), this.game.input && this.game.input.scale && this.game.input.scale.setTo(this.scaleFactor.x, this.scaleFactor.y) },
forceOrientation: function(t, e) { void 0 === e && (e = !1), this.forceLandscape = t, this.forcePortrait = e, this.queueUpdate(!0) }, classifyOrientation: function(t) { return "portrait-primary" === t || "portrait-secondary" === t ? "portrait" : "landscape-primary" === t || "landscape-secondary" === t ? "landscape" : null }, updateOrientationState: function() { var t = this.screenOrientation , e = this.incorrectOrientation; this.screenOrientation = this.dom.getScreenOrientation(this.compatibility.orientationFallback), this.incorrectOrientation = this.forceLandscape && ! this.isLandscape || this.forcePortrait && !this.isPortrait; var i = t !== this.screenOrientation , n = e !== this.incorrectOrientation; return n && (this.incorrectOrientation ? this.enterIncorrectOrientation.dispatch() : this.leaveIncorrectOrientation.dispatch()), (i || n) && this.onOrientationChange.dispatch(this, t, e), i || n }, orientationChange: function(t) { this.event = t, this.queueUpdate(!0) }, windowResize: function(t) { this.event = t, this.queueUpdate(!0) }, scrollTop: function() { var t = this.compatibility.scrollTo; t && window.scrollTo(t.x, t.y) }, refresh: function() { this.scrollTop(), this.queueUpdate(!0) }, updateLayout: function() { var t = this.currentScaleMode; if (t === s.ScaleManager.RESIZE) return void this.reflowGame(); if (this.scrollTop(), this.compatibility.forceMinimumDocumentHeight && (document.documentElement.style.minHeight = window.innerHeight + "px"), this.incorrectOrientation ? this.setMaximum() : t === s.ScaleManager.EXACT_FIT ? this.setExactFit() : t === s.ScaleManager.SHOW_ALL ? ! this.isFullScreen && this.boundingParent && this.compatibility.canExpandParent ? (this.setShowAll(!0), this.resetCanvas(), this.setShowAll()) : this.setShowAll() : t === s.ScaleManager.NO_SCALE ? (this.width = this.game.width, this.height = this.game.height) : t === s.ScaleManager.USER_SCALE && (this.width = this.game.width * this._userScaleFactor.x - this._userScaleTrim.x, this.height = this.game.height * this._userScaleFactor.y -
this._userScaleTrim.y), !this.compatibility.canExpandParent && (t === s.ScaleManager.SHOW_ALL || t === s.ScaleManager.USER_SCALE)) { var e = this.getParentBounds(this._tempBounds); this.width = Math.min(this.width, e.width), this.height = Math.min(this.height, e.height) } this.width = 0 | this.width, this.height = 0 | this.height, this.reflowCanvas() }, getParentBounds: function(t) { var e = t || new s.Rectangle , i = this.boundingParent , n = this.dom.visualBounds , o = this.dom.layoutBounds; if (i) { var r = i.getBoundingClientRect() , a = i.offsetParent ? i.offsetParent.getBoundingClientRect() : i.getBoundingClientRect(); e.setTo(r.left - a.left, r.top - a.top, r.width, r.height); var h = this.windowConstraints; if (h.right) { var l = "layout" === h.right ? o : n; e.right = Math.min(e.right, l.width) } if (h.bottom) { var l = "layout" === h.bottom ? o : n; e.bottom = Math.min(e.bottom, l.height) } } else e.setTo(0, 0, n.width, n.height); return e.setTo(Math.round(e.x), Math.round(e.y), Math.round(e.width), Math.round(e.height)), e }, alignCanvas: function(t, e) { var i = this.getParentBounds(this._tempBounds) , n = this.game.canvas , s = this.margin; if (t) { s.left = s.right = 0; var o = n.getBoundingClientRect(); if (this.width < i.width && !this.incorrectOrientation) { var r = o.left - i.x , a = i.width / 2 - this.width / 2; a = Math.max(a, 0); var h = a - r; s.left = Math.round(h) } n.style.marginLeft = s.left + "px", 0 !== s.left && (s.right = -(i.width - o.width - s.left), n.style.marginRight = s.right + "px") } if (e) { s.top = s.bottom = 0; var o = n.getBoundingClientRect(); if (this.height < i.height && !this.incorrectOrientation) { var r = o.top - i.y
, a = i.height / 2 - this.height / 2; a = Math.max(a, 0); var h = a - r; s.top = Math.round(h) } n.style.marginTop = s.top + "px", 0 !== s.top && (s.bottom = -(i.height - o.height - s.top), n.style.marginBottom = s.bottom + "px") } s.x = s.left, s.y = s.top
}, reflowGame: function() { this.resetCanvas("", ""); var t = this.getParentBounds(this._tempBounds); this.updateDimensions(t.width, t.height, !0) }, reflowCanvas: function() { this.incorrectOrientation || (this.width = s.Math.clamp(this.width, this.minWidth || 0, this.maxWidth || this.width), this.height = s.Math.clamp(this.height, this.minHeight || 0, this.maxHeight || this.height)), this.resetCanvas(), this.compatibility.noMargins || (this.isFullScreen && this._createdFullScreenTarget ? this.alignCanvas(!0, !0) : this.alignCanvas(this.pageAlignHorizontally, this.pageAlignVertically)), this.updateScalingAndBounds() }, resetCanvas: function(t, e) { void 0 === t && (t = this.width + "px"), void 0 === e && (e = this.height + "px"); var i = this.game.canvas; this.compatibility.noMargins || (i.style.marginLeft = "", i.style.marginTop = "", i.style.marginRight = "", i.style.marginBottom = ""), i.style.width = t, i.style.height = e }, queueUpdate: function(t) { t && (this._parentBounds.width = 0, this._parentBounds.height = 0), this._updateThrottle = this._updateThrottleReset }, reset: function(t) { t && this.grid && this.grid.reset() }, setMaximum: function() { this.width = this.dom.visualBounds.width, this.height = this.dom.visualBounds.height }, setShowAll: function(t) { var e, i = this.getParentBounds(this._tempBounds), n = i.width, s = i.height; e = t ? Math.max(s / this.game.height, n / this.game.width) : Math.min(s / this.game.height, n / this.game.width), this.width = Math.round(this.game.width * e), this.height = Math.round(this.game.height * e) },
setExactFit: function() { var t = this.getParentBounds(this._tempBounds); this.width = t.width, this.height = t.height, this.isFullScreen || (this.maxWidth && (this.width = Math.min(this.width, this.maxWidth)), this.maxHeight && (this.height = Math.min(this.height, this.maxHeight))) }, createFullScreenTarget: function() { var t = document.createElement("div"); return t.style.margin = "0", t.style.padding = "0", t.style.background = "#000", t }, startFullScreen: function(t, e) { if (this.isFullScreen) return !1; if (!this.compatibility.supportsFullScreen) { var i = this; return void setTimeout(function() { i.fullScreenError() }, 10) } if ("when-not-mouse" === this.compatibility.clickTrampoline) { var n = this.game.input; if (n.activePointer && n.activePointer !== n.mousePointer && (e || !1 !== e)) return void n.activePointer.addClickTrampoline("startFullScreen", this.startFullScreen, this, [t, !1]) } void 0 !== t && this.game.renderType === s.CANVAS && (this.game.stage.smoothed = t); var o = this.fullScreenTarget; o || (this.cleanupCreatedTarget(), this._createdFullScreenTarget = this.createFullScreenTarget(), o = this._createdFullScreenTarget); var r = { targetElement: o }; if (this.hasPhaserSetFullScreen = !0, this.onFullScreenInit.dispatch(this, r), this._createdFullScreenTarget) { var a = this.game.canvas; a.parentNode.insertBefore(o, a), o.appendChild(a) } return this.game.device.fullscreenKeyboard ? o[this.game.device.requestFullscreen](Element.ALLOW_KEYBOARD_INPUT) : o[this.game.device.requestFullscreen](), !0 }, stopFullScreen: function() { return !(!this.isFullScreen || ! this.compatibility.supportsFullScreen) && (this.hasPhaserSetFullScreen = !1, document[this.game.device.cancelFullscreen](), !0)
}, cleanupCreatedTarget: function() { var t = this._createdFullScreenTarget; if (t && t.parentNode) { var e = t.parentNode; e.insertBefore(this.game.canvas, t), e.removeChild(t) } this._createdFullScreenTarget = null }, prepScreenMode: function(t) { var e = !!this._createdFullScreenTarget , i = this._createdFullScreenTarget || this.fullScreenTarget; t ? (e || this.fullScreenScaleMode === s.ScaleManager.EXACT_FIT) && i !== this.game.canvas && (this._fullScreenRestore = { targetWidth: i.style.width, targetHeight: i.style.height }, i.style.width = "100%", i.style.height = "100%") : (this._fullScreenRestore && (i.style.width = this._fullScreenRestore.targetWidth, i.style.height = this._fullScreenRestore.targetHeight, this._fullScreenRestore = null), this.updateDimensions(this._gameSize.width, this._gameSize.height, !0), this.resetCanvas()) }, fullScreenChange: function(t) { this.event = t, this.isFullScreen ? (this.prepScreenMode(!0), this.updateLayout(), this.queueUpdate(!0)) : (this.prepScreenMode(!1), this.cleanupCreatedTarget(), this.updateLayout(), this.queueUpdate(!0)), this.onFullScreenChange.dispatch(this, this.width, this.height) }, fullScreenError: function(t) { this.event = t, this.cleanupCreatedTarget(), console.warn("Phaser.ScaleManager: requestFullscreen failed or device does not support the Fullscreen API"), this.onFullScreenError.dispatch(this) }, scaleSprite: function(t, e, i, n) { if (void 0 === e && (e = this.width), void 0 === i && (i = this.height), void 0 === n && (n = !1), !t || !t.scale) return t; if (t.scale.x = 1, t.scale.y = 1, t.width 0) for (var e = 0; e < t.children.length; e++) this.game.debug.displayList(t.children[e]) }, destroy: function() { s.CanvasPool.remove(this) } }, s.Utils.Debug.prototype.constructor = s.Utils.Debug, s.DOM = { getOffset: function(t, e) { e = e || new s.Point; var i = t.getBoundingClientRect() , n = s.DOM.scrollY , o = s.DOM.scrollX , r = document.documentElement.clientTop , a = document.documentElement.clientLeft; return e.x = i.left + o - a, e.y = i.top + n - r, e }, getBounds: function(t, e) { return void 0 === e && (e = 0), !(!(t = t && !t.nodeType ? t[0] : t) || 1 !== t.nodeType) && this.calibrate(t.getBoundingClientRect(), e) }, calibrate: function(t, e) { e = +e || 0; var i = { width: 0, height: 0, left: 0, right: 0, top: 0, bottom: 0
}; return i.width = (i.right = t.right + e) - (i.left = t.left - e), i.height = (i.bottom = t.bottom + e) - (i.top = t.top - e), i }, getAspectRatio: function(t) { t = null == t ? this.visualBounds : 1 === t.nodeType ? this.getBounds(t) : t; var e = t.width , i = t.height; return "function" == typeof e && (e = e.call(t)), "function" == typeof i && (i = i.call(t)), e / i }, inLayoutViewport: function(t, e) { var i = this.getBounds(t, e); return !!i && i.bottom >= 0 && i.right >= 0 && i.top this.visualBounds.width ? n : s; if ("window.orientation" === t && "number" == typeof window.orientation) return 0 === window.orientation || 180 === window.orientation ? n : s; if (window.matchMedia) { if (window.matchMedia("(orientation: portrait)").matches) return n; if (window.matchMedia("(orientation: landscape)").matches) return s } return this.visualBounds.height > this.visualBounds.width ? n : s }, visualBounds: new s.Rectangle, layoutBounds: new s.Rectangle, documentBounds: new s.Rectangle }, s.Device.whenReady(function(t) { var e = window && "pageXOffset"in window ? function() { return window.pageXOffset } : function() { return document.documentElement.scrollLeft } , i = window && "pageYOffset"in window ? function() { return window.pageYOffset }
: function() { return document.documentElement.scrollTop } ; if (Object.defineProperty(s.DOM, "scrollX", { get: e }), Object.defineProperty(s.DOM, "scrollY", { get: i }), Object.defineProperty(s.DOM.visualBounds, "x", { get: e }), Object.defineProperty(s.DOM.visualBounds, "y", { get: i }), Object.defineProperty(s.DOM.layoutBounds, "x", { value: 0 }), Object.defineProperty(s.DOM.layoutBounds, "y", { value: 0 }), t.desktop && document.documentElement.clientWidth -1) return this.list.splice(e, 1), t
}, setAll: function(t, e) { for (var i = this.list.length; i--; ) this.list[i] && (this.list[i][t] = e) }, callAll: function(t) { for (var e = Array.prototype.slice.call(arguments, 1), i = this.list.length; i--; ) this.list[i] && this.list[i][t] && this.list[i] [t].apply(this.list[i], e) }, removeAll: function(t) { void 0 === t && (t = !1); for (var e = this.list.length; e--; ) if (this.list[e]) { var i = this.remove(this.list[e]); t && i.destroy() } this.position = 0, this.list = [] } }, Object.defineProperty(s.ArraySet.prototype, "total", { get: function() { return this.list.length } }), Object.defineProperty(s.ArraySet.prototype, "first", { get: function() { return this.position = 0, this.list.length > 0 ? this.list[0] : null } }), Object.defineProperty(s.ArraySet.prototype, "next", { get: function() { return this.position < this.list.length ? (this.position++, this.list[this.position]) : null } }), s.ArraySet.prototype.constructor = s.ArraySet, s.ArrayUtils = { getRandomItem: function(t, e, i) { if (null === t) return null; void 0 === e && (e = 0), void 0 === i && (i = t.length); var n = e + Math.floor(Math.random() * i); return void 0 === t[n] ? null : t[n] }, removeRandomItem: function(t, e, i) { if (null == t) return null; void 0 === e && (e = 0), void 0 === i && (i = t.length); var n = e + Math.floor(Math.random() * i); if (n < t.length) { var s = t.splice(n, 1); return void 0 === s[0] ? null : s[0] }
< i; s++) {
return null }, shuffle: function(t) { for (var e = t.length - 1; e > 0; e--) { var i = Math.floor(Math.random() * (e + 1)) , n = t[e]; t[e] = t[i], t[i] = n } return t }, transposeMatrix: function(t) { for (var e = t.length, i = t[0].length, n = new Array(i), s = 0; s n[s] = new Array(e); for (var o = e - 1; o > -1; o--) n[s][o] = t[o][s]
} return n
}, rotateMatrix: function(t, e) { if ("string" != typeof e && (e = (e % 360 + 360) % 360), 90 === e || -270 === e || "rotateLeft" === e) t = s.ArrayUtils.transposeMatrix(t), t = t.reverse(); else if (-90 === e || 270 === e || "rotateRight" === e) t = t.reverse(), t = s.ArrayUtils.transposeMatrix(t); else if (180 === Math.abs(e) || "rotate180" === e) { for (var i = 0; i < t.length; i++) t[i].reverse(); t = t.reverse() } return t }, findClosest: function(t, e) { if (!e.length) return NaN; if (1 === e.length || t < e[0]) return e[0]; for (var i = 1; e[i] < t; ) i++; var n = e[i - 1] , s = i < e.length ? e[i] : Number.POSITIVE_INFINITY; return s - t > 24, e.b = (16711680 & t) >>> 16, e.g = (65280 & t) >>> 8, e.r = 255 & t) : (e.r = (4278190080 & t) >>> 24, e.g = (16711680 & t) >>> 16, e.b = (65280 & t) >>> 8, e.a = 255 & t), e.color = t, e.rgba = "rgba(" + e.r + "," + e.g + "," + e.b + "," + e.a / 255 + ")", i && s.Color.RGBtoHSL(e.r, e.g, e.b, e), n && s.Color.RGBtoHSV(e.r, e.g, e.b, e), e }, fromRGBA: function(t, e) { return e || (e = s.Color.createColor()), e.r = (4278190080 & t) >>> 24, e.g = (16711680 & t) >>> 16, e.b = (65280 & t) >>> 8, e.a = 255 & t, e.rgba = "rgba(" + e.r + "," + e.g + "," + e.b + "," + e.a + ")", e }, toRGBA: function(t, e, i, n) { return t > 8 & 255) / 255, (255 & t) / 255] }, RGBArrayToHex: function(t) { return (255 * t[0] 1 && (i -= 1), i < 1 / 6 ? t + 6 * (e - t) * i : i < .5 ? e : i < 2 / 3 ? t + (e t) * (2 / 3 - i) * 6 : t }, createColor: function(t, e, i, n, o, r, a, h) { var l = { r: t || 0, g: e || 0, b: i || 0, a: n || 1, h: o || 0, s: r || 0, l: a || 0, v: h || 0, color: 0, color32: 0, rgba: "" }; return s.Color.updateColor(l) }, updateColor: function(t) { return t.rgba = "rgba(" + t.r.toString() + "," + t.g.toString() + "," + t.b.toString() + "," + t.a.toString() + ")", t.color = s.Color.getColor(t.r, t.g, t.b), t.color32 = s.Color.getColor32(255 * t.a, t.r, t.g, t.b), t }, getColor32: function(t, e, i, n) { return t 8 & 255, blue: 255 & t, a: t >>> 24, r: t >> 16 & 255, g: t >> 8 & 255, b: 255 & t } : { alpha: 255, red: t >> 16 & 255,
green: t >> 8 & 255, blue: 255 & t, a: 255, r: t >> 16 & 255, g: t >> 8 & 255, b: 255 & t } }, getWebRGB: function(t) { if ("object" == typeof t) return "rgba(" + t.r.toString() + "," + t.g.toString() + "," + t.b.toString() + "," + (t.a / 255).toString() + ")"; var e = s.Color.getRGB(t); return "rgba(" + e.r.toString() + "," + e.g.toString() + "," + e.b.toString() + "," + (e.a / 255).toString() + ")" }, getAlpha: function(t) { return t >>> 24 }, getAlphaFloat: function(t) { return (t >>> 24) / 255 }, getRed: function(t) { return t >> 16 & 255 }, getGreen: function(t) { return t >> 8 & 255 }, getBlue: function(t) { return 255 & t }, blendNormal: function(t) { return t }, blendLighten: function(t, e) { return e > t ? e : t }, blendDarken: function(t, e) { return e > t ? t : e }, blendMultiply: function(t, e) { return t * e / 255 }, blendAverage: function(t, e) { return (t + e) / 2 }, blendAdd: function(t, e) { return Math.min(255, t + e) }, blendSubtract: function(t, e) { return Math.max(0, t + e - 255) }, blendDifference: function(t, e) { return Math.abs(t - e) }, blendNegation: function(t, e) { return 255 - Math.abs(255 - t - e) }, blendScreen: function(t, e) {
e) / 255
return 255 - ((255 - t) * (255 - e) >> 8) }, blendExclusion: function(t, e) { return t + e - 2 * t * e / 255 }, blendOverlay: function(t, e) { return e < 128 ? 2 * t * e / 255 : 255 - 2 * (255 - t) * (255 -
}, blendSoftLight: function(t, e) { return e < 128 ? 2 * (64 + (t >> 1)) * (e / 255) : 255 - 2 * (255 (64 + (t >> 1))) * (255 - e) / 255 }, blendHardLight: function(t, e) { return s.Color.blendOverlay(e, t) }, blendColorDodge: function(t, e) { return 255 === e ? e : Math.min(255, (t 0 && this.enable(t.children, !0)) }, enableBody: function(t) { t.hasOwnProperty("body") && null === t.body && (t.body = new s.Physics.Arcade.Body(t), t.parent && t.parent instanceof s.Group && t.parent.addToHash(t)) }, updateMotion: function(t) { var e = this.computeVelocity(0, t, t.angularVelocity, t.angularAcceleration, t.angularDrag, t.maxAngular) - t.angularVelocity; t.angularVelocity += e, t.rotation += t.angularVelocity * this.game.time.physicsElapsed, t.velocity.x = this.computeVelocity(1, t, t.velocity.x, t.acceleration.x, t.drag.x, t.maxVelocity.x), t.velocity.y = this.computeVelocity(2, t, t.velocity.y, t.acceleration.y, t.drag.y, t.maxVelocity.y) }, computeVelocity: function(t, e, i, n, s, o) { return void 0 === o && (o = 1e4), 1 === t && e.allowGravity ? i += (this.gravity.x + e.gravity.x) * this.game.time.physicsElapsed : 2 === t && e.allowGravity && (i += (this.gravity.y + e.gravity.y) * this.game.time.physicsElapsed), n ? i += n * this.game.time.physicsElapsed : s && (s *= this.game.time.physicsElapsed, i - s > 0 ? i -= s : i + s < 0 ? i += s : i = 0), i > o ? i = o : i < -o && (i = -o), i }, overlap: function(t, e, i, n, s) { if (i = i || null, n = n || null, s = s || i, this._total = 0, !Array.isArray(t) && Array.isArray(e)) for (var o = 0; o < e.length; o++) this.collideHandler(t, e[o], i, n, s, !0); else if (Array.isArray(t) && !Array.isArray(e)) for (var o = 0; o < t.length; o++) this.collideHandler(t[o], e, i, n, s, !0);
else if (Array.isArray(t) && Array.isArray(e)) for (var o = 0; o < t.length; o++) for (var r = 0; r < e.length; r++) this.collideHandler(t[o], e[r], i, n, s, !0); else this.collideHandler(t, e, i, n, s, !0); return this._total > 0
}, collide: function(t, e, i, n, s) { if (i = i || null, n = n || null, s = s || i, this._total = 0, !Array.isArray(t) && Array.isArray(e)) for (var o = 0; o < e.length; o++) this.collideHandler(t, e[o], i, n, s, !1); else if (Array.isArray(t) && !Array.isArray(e)) for (var o = 0; o < t.length; o++) this.collideHandler(t[o], e, i, n, s, !1); else if (Array.isArray(t) && Array.isArray(e)) for (var o = 0; o < t.length; o++) for (var r = 0; r < e.length; r++) this.collideHandler(t[o], e[r], i, n, s, !1); else this.collideHandler(t, e, i, n, s, !1); return this._total > 0 }, sortLeftRight: function(t, e) { return t.body && e.body ? t.body.x - e.body.x : 0 }, sortRightLeft: function(t, e) { return t.body && e.body ? e.body.x - t.body.x : 0 }, sortTopBottom: function(t, e) { return t.body && e.body ? t.body.y - e.body.y : 0 }, sortBottomTop: function(t, e) { return t.body && e.body ? e.body.y - t.body.y : 0 }, sort: function(t, e) { null !== t.physicsSortDirection ? e = t.physicsSortDirection : void 0 === e && (e = this.sortDirection), e === s.Physics.Arcade.LEFT_RIGHT ? t.hash.sort(this.sortLeftRight) : e === s.Physics.Arcade.RIGHT_LEFT ? t.hash.sort(this.sortRightLeft) : e === s.Physics.Arcade.TOP_BOTTOM ? t.hash.sort(this.sortTopBottom) : e === s.Physics.Arcade.BOTTOM_TOP && t.hash.sort(this.sortBottomTop) }, collideHandler: function(t, e, i, n, o, r) { if (void 0 === e && t.physicsType === s.GROUP) return this.sort(t), void this.collideGroupVsSelf(t, i, n, o, r); t && e && t.exists && e.exists && (this.sortDirection !== s.Physics.Arcade.SORT_NONE && (t.physicsType === s.GROUP && this.sort(t), e.physicsType === s.GROUP && this.sort(e)), t.physicsType === s.SPRITE ? e.physicsType === s.SPRITE ? this.collideSpriteVsSprite(t, e, i, n, o, r) : e.physicsType === s.GROUP ? this.collideSpriteVsGroup(t, e, i, n, o, r) : e.physicsType === s.TILEMAPLAYER && this.collideSpriteVsTilemapLayer(t, e, i, n, o, r) : t.physicsType === s.GROUP ? e.physicsType === s.SPRITE ? this.collideSpriteVsGroup(e, t, i, n, o, r) :
e.physicsType === s.GROUP ? this.collideGroupVsGroup(t, e, i, n, o, r) : e.physicsType === s.TILEMAPLAYER && this.collideGroupVsTilemapLayer(t, e, i, n, o, r) : t.physicsType === s.TILEMAPLAYER && (e.physicsType === s.SPRITE ? this.collideSpriteVsTilemapLayer(e, t, i, n, o, r) : e.physicsType === s.GROUP && this.collideGroupVsTilemapLayer(e, t, i, n, o, r))) }, collideSpriteVsSprite: function(t, e, i, n, s, o) { return !(!t.body || !e.body) && (this.separate(t.body, e.body, n, s, o) && (i && i.call(s, t, e), this._total++), !0) }, collideSpriteVsGroup: function(t, e, i, n, o, r) { if (0 !== e.length && t.body) if (this.skipQuadTree || t.body.skipQuadTree) for (var a = {}, h = 0; h < e.hash.length; h++) { var l = e.hash[h]; if (l && l.exists && l.body) { if (a = l.body.getBounds(a), this.sortDirection === s.Physics.Arcade.LEFT_RIGHT) { if (t.body.right < a.x) break; if (a.right < t.body.x) continue } else if (this.sortDirection === s.Physics.Arcade.RIGHT_LEFT) { if (t.body.x > a.right) break; if (a.x > t.body.right) continue } else if (this.sortDirection === s.Physics.Arcade.TOP_BOTTOM) { if (t.body.bottom < a.y) break; if (a.bottom < t.body.y) continue } else if (this.sortDirection === s.Physics.Arcade.BOTTOM_TOP) { if (t.body.y > a.bottom) break; if (a.y > t.body.bottom) continue } this.collideSpriteVsSprite(t, l, i, n, o, r) } } else { this.quadTree.clear(), this.quadTree.reset(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height, this.maxObjects, this.maxLevels), this.quadTree.populate(e); for (var c = this.quadTree.retrieve(t), h = 0; h < c.length; h++) this.separate(t.body, c[h], n, o, r) && (i && i.call(o, t, c[h].sprite), this._total++) }
}, collideGroupVsSelf: function(t, e, i, n, o) { if (0 !== t.length) for (var r = 0; r < t.hash.length; r++) { var a = {} , h = t.hash[r]; if (h && h.exists && h.body) { a = h.body.getBounds(a); for (var l = r + 1; l < t.hash.length; l++) { var c = {} , u = t.hash[l]; if (u && u.exists && u.body) { if (c = u.body.getBounds(c), this.sortDirection === s.Physics.Arcade.LEFT_RIGHT) { if (a.right < c.x) break; if (c.right < a.x) continue } else if (this.sortDirection === s.Physics.Arcade.RIGHT_LEFT) { if (a.x > c.right) continue; if (c.x > a.right) break } else if (this.sortDirection === s.Physics.Arcade.TOP_BOTTOM) { if (a.bottom < c.y) continue; if (c.bottom < a.y) break } else if (this.sortDirection === s.Physics.Arcade.BOTTOM_TOP) { if (a.y > c.bottom) continue; if (c.y > h.body.bottom) break } this.collideSpriteVsSprite(h, u, e, i, n, o) } } } } }, collideGroupVsGroup: function(t, e, i, n, o, r) { if (0 !== t.length && 0 !== e.length) for (var a = 0; a < t.children.length; a++) t.children[a].exists && (t.children[a].physicsType === s.GROUP ? this.collideGroupVsGroup(t.children[a], e, i, n, o, r) : this.collideSpriteVsGroup(t.children[a], e, i, n, o, r)) }, separate: function(t, e, i, n, s) { if (!t.enable || !e.enable || t.checkCollision.none || e.checkCollision.none || !this.intersects(t, e)) return !1; if (i && !1 === i.call(n, t.sprite, e.sprite)) return !1; if (t.isCircle && e.isCircle) return this.separateCircle(t, e, s);
if (t.isCircle !== e.isCircle) { var o = t.isCircle ? e : t , r = t.isCircle ? t : e , a = { x: o.x, y: o.y, right: o.right, bottom: o.bottom } , h = { x: r.x + r.radius, y: r.y + r.radius }; if ((h.y < a.y || h.y > a.bottom) && (h.x < a.x || h.x > a.right))
return this.separateCircle(t, e, s) } var l = !1 , c = !1; this.forceX || Math.abs(this.gravity.y + t.gravity.y) < Math.abs(this.gravity.x + t.gravity.x) ? (l = this.separateX(t, e, s), this.intersects(t, e) && (c = this.separateY(t, e, s))) : (c = this.separateY(t, e, s), this.intersects(t, e) && (l = this.separateX(t, e, s))); var u = l || c; return u && (s ? (t.onOverlap && t.onOverlap.dispatch(t.sprite, e.sprite), e.onOverlap && e.onOverlap.dispatch(e.sprite, t.sprite)) : (t.onCollide && t.onCollide.dispatch(t.sprite, e.sprite), e.onCollide && e.onCollide.dispatch(e.sprite, t.sprite))), u }, intersects: function(t, e) { return t !== e && (t.isCircle ? e.isCircle ? s.Math.distance(t.center.x, t.center.y, e.center.x, e.center.y) h.bottom && (l.x < h.x ? a = s.Math.distance(l.x, l.y, h.x, h.bottom) - l.radius : l.x > h.right && (a = s.Math.distance(l.x, l.y, h.right, h.bottom) - l.radius)), a *= -1 } else a = t.radius + e.radius - s.Math.distance(t.center.x, t.center.y, e.center.x, e.center.y); if (i || 0 === a || t.immovable && e.immovable || t.customSeparateX || e.customSeparateX) return 0 !== a && (t.onOverlap && t.onOverlap.dispatch(t.sprite, e.sprite), e.onOverlap && e.onOverlap.dispatch(e.sprite, t.sprite)), 0 !== a; var c = { x: t.velocity.x * Math.cos(r) + t.velocity.y * Math.sin(r), y: t.velocity.x * Math.sin(r) - t.velocity.y * Math.cos(r) } , u = { x: e.velocity.x * Math.cos(r) + e.velocity.y * Math.sin(r), y: e.velocity.x * Math.sin(r) - e.velocity.y * Math.cos(r) } , d = ((t.mass - e.mass) * c.x + 2 * e.mass * u.x) / (t.mass + e.mass) , p = (2 * t.mass * c.x + (e.mass - t.mass) * u.x) / (t.mass + e.mass); return t.immovable || (t.velocity.x = (d * Math.cos(r) - c.y * Math.sin(r)) * t.bounce.x, t.velocity.y = (c.y * Math.cos(r) + d * Math.sin(r)) * t.bounce.y), e.immovable || (e.velocity.x = (p * Math.cos(r) - u.y * Math.sin(r)) * e.bounce.x, e.velocity.y = (u.y * Math.cos(r) + p * Math.sin(r)) * e.bounce.y), Math.abs(r) < Math.PI / 2 ? t.velocity.x > 0 && !t.immovable && e.velocity.x > t.velocity.x ? t.velocity.x *= -1 : e.velocity.x < 0 && !e.immovable && t.velocity.x < e.velocity.x ? e.velocity.x *= -1 : t.velocity.y > 0 && ! t.immovable && e.velocity.y > t.velocity.y ? t.velocity.y *= -1 : e.velocity.y < 0 && !e.immovable && t.velocity.y < e.velocity.y && (e.velocity.y *= -1) : Math.abs(r) > Math.PI / 2 && (t.velocity.x < 0 && !t.immovable && e.velocity.x < t.velocity.x ? t.velocity.x *= -1 : e.velocity.x > 0 && !e.immovable && t.velocity.x > e.velocity.x ? e.velocity.x *= -1 : t.velocity.y < 0 && !t.immovable && e.velocity.y < t.velocity.y ? t.velocity.y *= -1 : e.velocity.y > 0 && ! e.immovable && t.velocity.x > e.velocity.y && (e.velocity.y *= -1)), t.immovable || (t.x += t.velocity.x * this.game.time.physicsElapsed - a * Math.cos(r), t.y += t.velocity.y * this.game.time.physicsElapsed - a * Math.sin(r)), e.immovable || (e.x += e.velocity.x * this.game.time.physicsElapsed + a * Math.cos(r), e.y += e.velocity.y * this.game.time.physicsElapsed + a * Math.sin(r)), t.onCollide && t.onCollide.dispatch(t.sprite, e.sprite),
e.onCollide && e.onCollide.dispatch(e.sprite, t.sprite), !0 }, getOverlapX: function(t, e, i) { var n = 0 , s = t.deltaAbsX() + e.deltaAbsX() + this.OVERLAP_BIAS; return 0 === t.deltaX() && 0 === e.deltaX() ? (t.embedded = !0, e.embedded = !0) : t.deltaX() > e.deltaX() ? (n = t.right - e.x, n > s && !i || !1 === t.checkCollision.right || !1 === e.checkCollision.left ? n = 0 : (t.touching.none = !1, t.touching.right = !0, e.touching.none = !1, e.touching.left = !0)) : t.deltaX() < e.deltaX() && (n = t.x e.width - e.x, -n > s && !i || !1 === t.checkCollision.left || !1 === e.checkCollision.right ? n = 0 : (t.touching.none = !1, t.touching.left = !0, e.touching.none = !1, e.touching.right = !0)), t.overlapX = n, e.overlapX = n, n }, getOverlapY: function(t, e, i) { var n = 0 , s = t.deltaAbsY() + e.deltaAbsY() + this.OVERLAP_BIAS; return 0 === t.deltaY() && 0 === e.deltaY() ? (t.embedded = !0, e.embedded = !0) : t.deltaY() > e.deltaY() ? (n = t.bottom - e.y, n > s && !i || !1 === t.checkCollision.down || !1 === e.checkCollision.up ? n = 0 : (t.touching.none = !1, t.touching.down = !0, e.touching.none = !1, e.touching.up = !0)) : t.deltaY() < e.deltaY() && (n = t.y e.bottom, -n > s && !i || !1 === t.checkCollision.up || !1 === e.checkCollision.down ? n = 0 : (t.touching.none = !1, t.touching.up = !0, e.touching.none = !1, e.touching.down = !0)), t.overlapY = n, e.overlapY = n, n }, separateX: function(t, e, i) { var n = this.getOverlapX(t, e, i); if (i || 0 === n || t.immovable && e.immovable || t.customSeparateX || e.customSeparateX) return 0 !== n || t.embedded && e.embedded; var s = t.velocity.x , o = e.velocity.x; if (t.immovable || e.immovable) t.immovable ? (e.x += n, e.velocity.x = s - o * e.bounce.x, t.moves && (e.y += (t.y - t.prev.y) * t.friction.y)) : (t.x -= n, t.velocity.x = o - s * t.bounce.x, e.moves && (t.y += (e.y - e.prev.y) * e.friction.y)); else { n *= .5,
t.x -= n, e.x += n; var r = Math.sqrt(o * o * e.mass / t.mass) * (o > 0 ? 1 : -1) , a = Math.sqrt(s * s * t.mass / e.mass) * (s > 0 ? 1 : -1) , h = .5 * (r + a); r -= h, a -= h, t.velocity.x = h + r * t.bounce.x, e.velocity.x = h + a * e.bounce.x
} return !0
}, separateY: function(t, e, i) { var n = this.getOverlapY(t, e, i); if (i || 0 === n || t.immovable && e.immovable || t.customSeparateY || e.customSeparateY) return 0 !== n || t.embedded && e.embedded; var s = t.velocity.y , o = e.velocity.y; if (t.immovable || e.immovable) t.immovable ? (e.y += n, e.velocity.y = s - o * e.bounce.y, t.moves && (e.x += (t.x - t.prev.x) * t.friction.x)) : (t.y -= n, t.velocity.y = o - s * t.bounce.y, e.moves && (t.x += (e.x - e.prev.x) * e.friction.x)); else { n *= .5, t.y -= n, e.y += n; var r = Math.sqrt(o * o * e.mass / t.mass) * (o > 0 ? 1 : -1) , a = Math.sqrt(s * s * t.mass / e.mass) * (s > 0 ? 1 : -1) , h = .5 * (r + a); r -= h, a -= h, t.velocity.y = h + r * t.bounce.y, e.velocity.y = h + a * e.bounce.y } return !0 }, getObjectsUnderPointer: function(t, e, i, n) { if (0 !== e.length && t.exists) return this.getObjectsAtLocation(t.x, t.y, e, i, n, t) }, getObjectsAtLocation: function(t, e, i, n, o, r) { this.quadTree.clear(), this.quadTree.reset(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height, this.maxObjects, this.maxLevels), this.quadTree.populate(i); for (var a = new s.Rectangle(t,e,1,1), h = [], l = this.quadTree.retrieve(a), c = 0; c < l.length; c++) l[c].hitTest(t, e) && (n && n.call(o, r, l[c].sprite), h.push(l[c].sprite)); return h }, moveToObject: function(t, e, i, n) { void 0 === i && (i = 60), void 0 === n && (n = 0);
var s = Math.atan2(e.y - t.y, e.x - t.x); return n > 0 && (i = this.distanceBetween(t, e) / (n / 1e3)), t.body.velocity.x = Math.cos(s) * i, t.body.velocity.y = Math.sin(s) * i, s
}, moveToPointer: function(t, e, i, n) { void 0 === e && (e = 60), i = i || this.game.input.activePointer, void 0 === n && (n = 0); var s = this.angleToPointer(t, i); return n > 0 && (e = this.distanceToPointer(t, i) / (n / 1e3)), t.body.velocity.x = Math.cos(s) * e, t.body.velocity.y = Math.sin(s) * e, s }, moveToXY: function(t, e, i, n, s) { void 0 === n && (n = 60), void 0 === s && (s = 0); var o = Math.atan2(i - t.y, e - t.x); return s > 0 && (n = this.distanceToXY(t, e, i) / (s / 1e3)), t.body.velocity.x = Math.cos(o) * n, t.body.velocity.y = Math.sin(o) * n, o }, velocityFromAngle: function(t, e, i) { return void 0 === e && (e = 60), i = i || new s.Point, i.setTo(Math.cos(this.game.math.degToRad(t)) * e, Math.sin(this.game.math.degToRad(t)) * e) }, velocityFromRotation: function(t, e, i) { return void 0 === e && (e = 60), i = i || new s.Point, i.setTo(Math.cos(t) * e, Math.sin(t) * e) }, accelerationFromRotation: function(t, e, i) { return void 0 === e && (e = 60), i = i || new s.Point, i.setTo(Math.cos(t) * e, Math.sin(t) * e) }, accelerateToObject: function(t, e, i, n, s) { void 0 === i && (i = 60), void 0 === n && (n = 1e3), void 0 === s && (s = 1e3); var o = this.angleBetween(t, e); return t.body.acceleration.setTo(Math.cos(o) * i, Math.sin(o) * i), t.body.maxVelocity.setTo(n, s), o }, accelerateToPointer: function(t, e, i, n, s) { void 0 === i && (i = 60), void 0 === e && (e = this.game.input.activePointer), void 0 === n && (n = 1e3), void 0 === s && (s = 1e3); var o = this.angleToPointer(t, e); return t.body.acceleration.setTo(Math.cos(o) * i, Math.sin(o) * i), t.body.maxVelocity.setTo(n, s), o
}, accelerateToXY: function(t, e, i, n, s, o) { void 0 === n && (n = 60), void 0 === s && (s = 1e3), void 0 === o && (o = 1e3); var r = this.angleToXY(t, e, i); return t.body.acceleration.setTo(Math.cos(r) * n, Math.sin(r) * n), t.body.maxVelocity.setTo(s, o), r }, distanceBetween: function(t, e, i) { void 0 === i && (i = !1); var n = i ? t.world.x - e.world.x : t.x - e.x , s = i ? t.world.y - e.world.y : t.y - e.y; return Math.sqrt(n * n + s * s) }, distanceToXY: function(t, e, i, n) { void 0 === n && (n = !1); var s = n ? t.world.x - e : t.x - e , o = n ? t.world.y - i : t.y - i; return Math.sqrt(s * s + o * o) }, distanceToPointer: function(t, e, i) { void 0 === e && (e = this.game.input.activePointer), void 0 === i && (i = !1); var n = i ? t.world.x - e.worldX : t.x - e.worldX , s = i ? t.world.y - e.worldY : t.y - e.worldY; return Math.sqrt(n * n + s * s) }, angleBetween: function(t, e, i) { return void 0 === i && (i = !1), i ? Math.atan2(e.world.y - t.world.y, e.world.x - t.world.x) : Math.atan2(e.y - t.y, e.x - t.x) }, angleBetweenCenters: function(t, e) { var i = e.centerX - t.centerX , n = e.centerY - t.centerY; return Math.atan2(n, i) }, angleToXY: function(t, e, i, n) { return void 0 === n && (n = !1), n ? Math.atan2(i - t.world.y, e - t.world.x) : Math.atan2(i - t.y, e - t.x) }, angleToPointer: function(t, e, i) { return void 0 === e && (e = this.game.input.activePointer), void 0 === i && (i = !1), i ? Math.atan2(e.worldY - t.world.y, e.worldX - t.world.x) : Math.atan2(e.worldY - t.y, e.worldX - t.x) }, worldAngleToPointer: function(t, e) { return this.angleToPointer(t, e, !0) } }, s.Physics.Arcade.Body = function(t) { this.sprite = t, this.game = t.game, this.type = s.Physics.ARCADE, this.enable = !0,
this.isCircle = !1, this.radius = 0, this.offset = new s.Point, this.position = new s.Point(t.x,t.y), this.prev = new s.Point(this.position.x,this.position.y), this.allowRotation = !0, this.rotation = t.angle, this.preRotation = t.angle, this.width = t.width, this.height = t.height, this.sourceWidth = t.width, this.sourceHeight = t.height, t.texture && (this.sourceWidth = t.texture.frame.width, this.sourceHeight = t.texture.frame.height), this.halfWidth = Math.abs(t.width / 2), this.halfHeight = Math.abs(t.height / 2), this.center = new s.Point(t.x + this.halfWidth,t.y + this.halfHeight), this.velocity = new s.Point, this.newVelocity = new s.Point, this.deltaMax = new s.Point, this.acceleration = new s.Point, this.drag = new s.Point, this.allowGravity = !0, this.gravity = new s.Point, this.bounce = new s.Point, this.worldBounce = null, this.onWorldBounds = null, this.onCollide = null, this.onOverlap = null, this.maxVelocity = new s.Point(1e4,1e4), this.friction = new s.Point(1,0), this.angularVelocity = 0, this.angularAcceleration = 0, this.angularDrag = 0, this.maxAngular = 1e3, this.mass = 1, this.angle = 0, this.speed = 0, this.facing = s.NONE, this.immovable = !1, this.moves = !0, this.customSeparateX = !1, this.customSeparateY = !1, this.overlapX = 0, this.overlapY = 0, this.overlapR = 0, this.embedded = !1, this.collideWorldBounds = !1, this.checkCollision = { none: !1, any: !0, up: !0, down: !0, left: !0, right: !0 }, this.touching = { none: !0, up: !1,
down: !1, left: !1, right: !1
}, this.wasTouching = { none: !0, up: !1, down: !1, left: !1, right: !1 }, this.blocked = { up: !1, down: !1, left: !1, right: !1 }, this.tilePadding = new s.Point, this.dirty = !1, this.skipQuadTree = !1, this.syncBounds = !1, this.isMoving = !1, this.stopVelocityOnCollide = !0, this.moveTimer = 0, this.moveDistance = 0, this.moveDuration = 0, this.moveTarget = null, this.moveEnd = null, this.onMoveComplete = new s.Signal, this.movementCallback = null, this.movementCallbackContext = null, this._reset = !0, this._sx = t.scale.x, this._sy = t.scale.y, this._dx = 0, this._dy = 0 } , s.Physics.Arcade.Body.prototype = { updateBounds: function() { if (this.syncBounds) { var t = this.sprite.getBounds(); t.ceilAll(), t.width === this.width && t.height === this.height || (this.width = t.width, this.height = t.height, this._reset = !0) } else { var e = Math.abs(this.sprite.scale.x) , i = Math.abs(this.sprite.scale.y); e === this._sx && i === this._sy || (this.width = this.sourceWidth * e, this.height = this.sourceHeight * i, this._sx = e, this._sy = i, this._reset = !0) } this._reset && (this.halfWidth = Math.floor(this.width / 2), this.halfHeight = Math.floor(this.height / 2),
this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight)) }, preUpdate: function() { this.enable && !this.game.physics.arcade.isPaused && (this.dirty = !0, this.wasTouching.none = this.touching.none, this.wasTouching.up = this.touching.up, this.wasTouching.down = this.touching.down, this.wasTouching.left = this.touching.left, this.wasTouching.right = this.touching.right, this.touching.none = !0, this.touching.up = !1, this.touching.down = !1, this.touching.left = !1, this.touching.right = !1, this.blocked.up = !1, this.blocked.down = !1, this.blocked.left = !1, this.blocked.right = !1, this.embedded = !1, this.updateBounds(), this.position.x = this.sprite.world.x - this.sprite.anchor.x * this.sprite.width + this.sprite.scale.x * this.offset.x, this.position.x -= this.sprite.scale.x < 0 ? this.width : 0, this.position.y = this.sprite.world.y - this.sprite.anchor.y * this.sprite.height + this.sprite.scale.y * this.offset.y, this.position.y -= this.sprite.scale.y < 0 ? this.height : 0, this.rotation = this.sprite.angle, this.preRotation = this.rotation, (this._reset || this.sprite.fresh) && (this.prev.x = this.position.x, this.prev.y = this.position.y), this.moves && (this.game.physics.arcade.updateMotion(this), this.newVelocity.set(this.velocity.x * this.game.time.physicsElapsed, this.velocity.y * this.game.time.physicsElapsed), this.position.x += this.newVelocity.x, this.position.y += this.newVelocity.y, this.position.x === this.prev.x && this.position.y === this.prev.y || (this.angle = Math.atan2(this.velocity.y, this.velocity.x)), this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y), this.collideWorldBounds && this.checkWorldBounds() && this.onWorldBounds && this.onWorldBounds.dispatch(this.sprite, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right)), this._dx = this.deltaX(), this._dy = this.deltaY(), this._reset = !1) }, updateMovement: function() { var t = 0 , e = 0 !== this.overlapX || 0 !== this.overlapY; if (this.moveDuration > 0 ? (this.moveTimer += this.game.time.elapsedMS, t = this.moveTimer / this.moveDuration) : (this.moveTarget.end.set(this.position.x, this.position.y), t = this.moveTarget.length / this.moveDistance), this.movementCallback) var i =
this.movementCallback.call(this.movementCallbackContext, this, this.velocity, t); return !(e || t >= 1 || void 0 !== i && !0 !== i) || (this.stopMovement(t >= 1 || this.stopVelocityOnCollide && e), !1) }, stopMovement: function(t) { this.isMoving && (this.isMoving = !1, t && this.velocity.set(0), this.onMoveComplete.dispatch(this.sprite, 0 !== this.overlapX || 0 !== this.overlapY)) }, postUpdate: function() { this.enable && this.dirty && (this.isMoving && this.updateMovement(), this.dirty = !1, this.deltaX() < 0 ? this.facing = s.LEFT : this.deltaX() > 0 && (this.facing = s.RIGHT), this.deltaY() < 0 ? this.facing = s.UP : this.deltaY() > 0 && (this.facing = s.DOWN), this.moves && (this._dx = this.deltaX(), this._dy = this.deltaY(), 0 !== this.deltaMax.x && 0 !== this._dx && (this._dx < 0 && this._dx < -this.deltaMax.x ? this._dx = -this.deltaMax.x : this._dx > 0 && this._dx > this.deltaMax.x && (this._dx = this.deltaMax.x)), 0 !== this.deltaMax.y && 0 !== this._dy && (this._dy < 0 && this._dy < -this.deltaMax.y ? this._dy = -this.deltaMax.y : this._dy > 0 && this._dy > this.deltaMax.y && (this._dy = this.deltaMax.y)), this.sprite.position.x += this._dx, this.sprite.position.y += this._dy, this._reset = !0), this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight), this.allowRotation && (this.sprite.angle += this.deltaZ()), this.prev.x = this.position.x, this.prev.y = this.position.y) }, checkWorldBounds: function() { var t = this.position , e = this.game.physics.arcade.bounds , i = this.game.physics.arcade.checkCollision , n = this.worldBounce ? -this.worldBounce.x : -this.bounce.x , s = this.worldBounce ? -this.worldBounce.y : -this.bounce.y; if (this.isCircle) { var o = { x: this.center.x - this.radius, y: this.center.y - this.radius, right: this.center.x + this.radius, bottom: this.center.y + this.radius }; o.x < e.x && i.left ? (t.x = e.x - this.halfWidth + this.radius, this.velocity.x *= n, this.blocked.left = !0) : o.right > e.right && i.right && (t.x = e.right - this.halfWidth - this.radius, this.velocity.x *= n, this.blocked.right = !0), o.y < e.y && i.up ? (t.y = e.y - this.halfHeight + this.radius, this.velocity.y *= s, this.blocked.up = !0) : o.bottom > e.bottom && i.down && (t.y =
e.bottom - this.halfHeight - this.radius, this.velocity.y *= s, this.blocked.down = !0) } else t.x < e.x && i.left ? (t.x = e.x, this.velocity.x *= n, this.blocked.left = !0) : this.right > e.right && i.right && (t.x = e.right - this.width, this.velocity.x *= n, this.blocked.right = !0), t.y < e.y && i.up ? (t.y = e.y, this.velocity.y *= s, this.blocked.up = !0) : this.bottom > e.bottom && i.down && (t.y = e.bottom - this.height, this.velocity.y *= s, this.blocked.down = !0); return this.blocked.up || this.blocked.down || this.blocked.left || this.blocked.right }, moveFrom: function(t, e, i) { if (void 0 === e && (e = this.speed), 0 === e) return !1; var n; return void 0 === i ? (n = this.angle, i = this.game.math.radToDeg(n)) : n = this.game.math.degToRad(i), this.moveTimer = 0, this.moveDuration = t, 0 === i || 180 === i ? this.velocity.set(Math.cos(n) * e, 0) : 90 === i || 270 === i ? this.velocity.set(0, Math.sin(n) * e) : this.velocity.set(Math.cos(n) * e, Math.sin(n) * e), this.isMoving = !0, !0 }, moveTo: function(t, e, i) { var n = e / (t / 1e3); if (0 === n) return !1; var o; return void 0 === i ? (o = this.angle, i = this.game.math.radToDeg(o)) : o = this.game.math.degToRad(i), e = Math.abs(e), this.moveDuration = 0, this.moveDistance = e, null === this.moveTarget && (this.moveTarget = new s.Line, this.moveEnd = new s.Point), this.moveTarget.fromAngle(this.x, this.y, o, e), this.moveEnd.set(this.moveTarget.end.x, this.moveTarget.end.y), this.moveTarget.setTo(this.x, this.y, this.x, this.y), 0 === i || 180 === i ? this.velocity.set(Math.cos(o) * n, 0) : 90 === i || 270 === i ? this.velocity.set(0, Math.sin(o) * n) : this.velocity.set(Math.cos(o) * n, Math.sin(o) * n), this.isMoving = !0, !0 }, setSize: function(t, e, i, n) { void 0 === i && (i = this.offset.x), void 0 === n && (n = this.offset.y), this.sourceWidth = t,
this.sourceHeight = e, this.width = this.sourceWidth * this._sx, this.height = this.sourceHeight * this._sy, this.halfWidth = Math.floor(this.width / 2), this.halfHeight = Math.floor(this.height / 2), this.offset.setTo(i, n), this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight), this.isCircle = !1, this.radius = 0 }, setCircle: function(t, e, i) { void 0 === e && (e = this.offset.x), void 0 === i && (i = this.offset.y), t > 0 ? (this.isCircle = !0, this.radius = t, this.sourceWidth = 2 * t, this.sourceHeight = 2 * t, this.width = this.sourceWidth * this._sx, this.height = this.sourceHeight * this._sy, this.halfWidth = Math.floor(this.width / 2), this.halfHeight = Math.floor(this.height / 2), this.offset.setTo(e, i), this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight)) : this.isCircle = !1 }, reset: function(t, e) { this.velocity.set(0), this.acceleration.set(0), this.speed = 0, this.angularVelocity = 0, this.angularAcceleration = 0, this.position.x = t - this.sprite.anchor.x * this.sprite.width + this.sprite.scale.x * this.offset.x, this.position.x -= this.sprite.scale.x < 0 ? this.width : 0, this.position.y = e - this.sprite.anchor.y * this.sprite.height + this.sprite.scale.y * this.offset.y, this.position.y -= this.sprite.scale.y < 0 ? this.height : 0, this.prev.x = this.position.x, this.prev.y = this.position.y, this.rotation = this.sprite.angle, this.preRotation = this.rotation, this._sx = this.sprite.scale.x, this._sy = this.sprite.scale.y, this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight) }, getBounds: function(t) { return this.isCircle ? (t.x = this.center.x - this.radius, t.y = this.center.y - this.radius, t.right = this.center.x + this.radius, t.bottom = this.center.y + this.radius) : (t.x = this.x, t.y = this.y, t.right = this.right, t.bottom = this.bottom), t }, hitTest: function(t, e) { return this.isCircle ? s.Circle.contains(this, t, e) :
s.Rectangle.contains(this, t, e) }, onFloor: function() { return this.blocked.down }, onCeiling: function() { return this.blocked.up }, onWall: function() { return this.blocked.left || this.blocked.right }, deltaAbsX: function() { return this.deltaX() > 0 ? this.deltaX() : -this.deltaX() }, deltaAbsY: function() { return this.deltaY() > 0 ? this.deltaY() : -this.deltaY() }, deltaX: function() { return this.position.x - this.prev.x }, deltaY: function() { return this.position.y - this.prev.y }, deltaZ: function() { return this.rotation - this.preRotation }, destroy: function() { this.sprite.parent && this.sprite.parent instanceof s.Group && this.sprite.parent.removeFromHash(this.sprite), this.sprite.body = null, this.sprite = null } }, Object.defineProperty(s.Physics.Arcade.Body.prototype, "left", { get: function() { return this.position.x } }), Object.defineProperty(s.Physics.Arcade.Body.prototype, "right", { get: function() { return this.position.x + this.width } }), Object.defineProperty(s.Physics.Arcade.Body.prototype, "top", { get: function() { return this.position.y } }), Object.defineProperty(s.Physics.Arcade.Body.prototype, "bottom", { get: function() { return this.position.y + this.height } }), Object.defineProperty(s.Physics.Arcade.Body.prototype, "x", { get: function() { return this.position.x }, set: function(t) { this.position.x = t
} }), Object.defineProperty(s.Physics.Arcade.Body.prototype, "y", { get: function() { return this.position.y }, set: function(t) { this.position.y = t } }), s.Physics.Arcade.Body.render = function(t, e, i, n) { void 0 === n && (n = !0), i = i || "rgba(0,255,0,0.4)", t.fillStyle = i, t.strokeStyle = i, e.isCircle ? (t.beginPath(), t.arc(e.center.x - e.game.camera.x, e.center.y - e.game.camera.y, e.radius, 0, 2 * Math.PI), n ? t.fill() : t.stroke()) : n ? t.fillRect(e.position.x e.game.camera.x, e.position.y - e.game.camera.y, e.width, e.height) : t.strokeRect(e.position.x - e.game.camera.x, e.position.y - e.game.camera.y, e.width, e.height) } , s.Physics.Arcade.Body.renderBodyInfo = function(t, e) { t.line("x: " + e.x.toFixed(2), "y: " + e.y.toFixed(2), "width: " + e.width, "height: " + e.height), t.line("velocity x: " + e.velocity.x.toFixed(2), "y: " + e.velocity.y.toFixed(2), "deltaX: " + e._dx.toFixed(2), "deltaY: " + e._dy.toFixed(2)), t.line("acceleration x: " + e.acceleration.x.toFixed(2), "y: " + e.acceleration.y.toFixed(2), "speed: " + e.speed.toFixed(2), "angle: " + e.angle.toFixed(2)), t.line("gravity x: " + e.gravity.x, "y: " + e.gravity.y, "bounce x: " + e.bounce.x.toFixed(2), "y: " + e.bounce.y.toFixed(2)), t.line("touching left: " + e.touching.left, "right: " + e.touching.right, "up: " + e.touching.up, "down: " + e.touching.down), t.line("blocked left: " + e.blocked.left, "right: " + e.blocked.right, "up: " + e.blocked.up, "down: " + e.blocked.down) } , s.Physics.Arcade.Body.prototype.constructor = s.Physics.Arcade.Body, s.Physics.Arcade.TilemapCollision = function() {} , s.Physics.Arcade.TilemapCollision.prototype = { TILE_BIAS: 16, collideSpriteVsTilemapLayer: function(t, e, i, n, s, o) { if (t.body) { var r = e.getTiles(t.body.position.x - t.body.tilePadding.x, t.body.position.y - t.body.tilePadding.y, t.body.width + t.body.tilePadding.x, t.body.height + t.body.tilePadding.y, !1, !1); if (0 !== r.length) for (var a = 0; a < r.length; a++) n ? n.call(s, t, r[a]) && this.separateTile(a, t.body, r[a], e, o) && (this._total++, i && i.call(s, t, r[a])) : this.separateTile(a, t.body, r[a], e, o) && (this._total++, i && i.call(s, t, r[a])) }
}, collideGroupVsTilemapLayer: function(t, e, i, n, s, o) { if (0 !== t.length) for (var r = 0; r < t.children.length; r++) t.children[r].exists && this.collideSpriteVsTilemapLayer(t.children[r], e, i, n, s, o) }, separateTile: function(t, e, i, n, s) { if (!e.enable) return !1; var o = n.fixedToCamera ? 0 : n.position.x , r = n.fixedToCamera ? 0 : n.position.y; if (!i.intersects(e.position.x - o, e.position.y - r, e.right - o, e.bottom - r)) return !1; if (s) return !0; if (i.collisionCallback && ! i.collisionCallback.call(i.collisionCallbackContext, e.sprite, i)) return !1; if (void 0 !== i.layer.callbacks && i.layer.callbacks[i.index] && ! i.layer.callbacks[i.index].callback.call(i.layer.callbacks[i.index].callbackContext , e.sprite, i)) return !1; if (!(i.faceLeft || i.faceRight || i.faceTop || i.faceBottom)) return !1; var a = 0 , h = 0 , l = 0 , c = 1; if (e.deltaAbsX() > e.deltaAbsY() ? l = -1 : e.deltaAbsX() < e.deltaAbsY() && (c = -1), 0 !== e.deltaX() && 0 !== e.deltaY() && (i.faceLeft || i.faceRight) && (i.faceTop || i.faceBottom) && (l = Math.min(Math.abs(e.position.x - o i.right), Math.abs(e.right - o - i.left)), c = Math.min(Math.abs(e.position.y - r - i.bottom), Math.abs(e.bottom - r - i.top))), l < c) { if ((i.faceLeft || i.faceRight) && 0 !== (a = this.tileCheckX(e, i, n)) && !i.intersects(e.position.x - o, e.position.y - r, e.right - o, e.bottom - r)) return !0; (i.faceTop || i.faceBottom) && (h = this.tileCheckY(e, i, n)) } else { if ((i.faceTop || i.faceBottom) && 0 !== (h = this.tileCheckY(e, i, n)) && !i.intersects(e.position.x - o, e.position.y - r, e.right - o, e.bottom - r)) return !0; (i.faceLeft || i.faceRight) && (a = this.tileCheckX(e, i, n)) } return 0 !== a || 0 !== h }, tileCheckX: function(t, e, i) { var n = 0 , s = i.fixedToCamera ? 0 : i.position.x; return t.deltaX() < 0 && !t.blocked.left && e.collideRight && t.checkCollision.left ? e.faceRight && t.x - s < e.right && (n = t.x - s - e.right) < -this.TILE_BIAS && (n = 0) : t.deltaX() > 0 && !t.blocked.right && e.collideLeft && t.checkCollision.right && e.faceLeft && t.right - s > e.left && (n = t.right - s
- e.left) > this.TILE_BIAS && (n = 0), 0 !== n && (t.customSeparateX ? t.overlapX = n : this.processTileSeparationX(t, n)), n }, tileCheckY: function(t, e, i) { var n = 0 , s = i.fixedToCamera ? 0 : i.position.y; return t.deltaY() < 0 && !t.blocked.up && e.collideDown && t.checkCollision.up ? e.faceBottom && t.y - s < e.bottom && (n = t.y - s e.bottom) < -this.TILE_BIAS && (n = 0) : t.deltaY() > 0 && !t.blocked.down && e.collideUp && t.checkCollision.down && e.faceTop && t.bottom - s > e.top && (n = t.bottom - s - e.top) > this.TILE_BIAS && (n = 0), 0 !== n && (t.customSeparateY ? t.overlapY = n : this.processTileSeparationY(t, n)), n }, processTileSeparationX: function(t, e) { e < 0 ? t.blocked.left = !0 : e > 0 && (t.blocked.right = !0), t.position.x -= e, 0 === t.bounce.x ? t.velocity.x = 0 : t.velocity.x = -t.velocity.x * t.bounce.x }, processTileSeparationY: function(t, e) { e < 0 ? t.blocked.up = !0 : e > 0 && (t.blocked.down = !0), t.position.y -= e, 0 === t.bounce.y ? t.velocity.y = 0 : t.velocity.y = -t.velocity.y * t.bounce.y } }, s.Utils.mixinPrototype(s.Physics.Arcade.prototype, s.Physics.Arcade.TilemapCollision.prototype), p2.Body.prototype.parent = null, p2.Spring.prototype.parent = null, s.Physics.P2 = function(t, e) { this.game = t, void 0 === e ? e = { gravity: [0, 0], broadphase: new p2.SAPBroadphase } : (e.hasOwnProperty("gravity") || (e.gravity = [0, 0]), e.hasOwnProperty("broadphase") || (e.broadphase = new p2.SAPBroadphase)), this.config = e, this.world = new p2.World(this.config), this.frameRate = 1 / 60, this.useElapsedTime = !1, this.paused = !1, this.materials = [], this.gravity = new s.Physics.P2.InversePointProxy(this,this.world.gravity), this.walls = { left: null, right: null, top: null, bottom: null }, this.onBodyAdded = new s.Signal, this.onBodyRemoved = new s.Signal, this.onSpringAdded = new s.Signal,
this.onSpringRemoved = new s.Signal, this.onConstraintAdded = new s.Signal, this.onConstraintRemoved = new s.Signal, this.onContactMaterialAdded = new s.Signal, this.onContactMaterialRemoved = new s.Signal, this.postBroadphaseCallback = null, this.callbackContext = null, this.onBeginContact = new s.Signal, this.onEndContact = new s.Signal, e.hasOwnProperty("mpx") && e.hasOwnProperty("pxm") && e.hasOwnProperty("mpxi") && e.hasOwnProperty("pxmi") && (this.mpx = e.mpx, this.mpxi = e.mpxi, this.pxm = e.pxm, this.pxmi = e.pxmi), this.world.on("beginContact", this.beginContactHandler, this), this.world.on("endContact", this.endContactHandler, this), this.collisionGroups = [], this.nothingCollisionGroup = new s.Physics.P2.CollisionGroup(1), this.boundsCollisionGroup = new s.Physics.P2.CollisionGroup(2), this.everythingCollisionGroup = new s.Physics.P2.CollisionGroup(2147483648), this.boundsCollidesWith = [], this._toRemove = [], this._collisionGroupID = 2, this._boundsLeft = !0, this._boundsRight = !0, this._boundsTop = !0, this._boundsBottom = !0, this._boundsOwnGroup = !1, this.setBoundsToWorld(!0, !0, !0, !0, !1) } , s.Physics.P2.prototype = { removeBodyNextStep: function(t) { this._toRemove.push(t) }, preUpdate: function() { for (var t = this._toRemove.length; t--; ) this.removeBody(this._toRemove[t]); this._toRemove.length = 0 }, enable: function(t, e, i) { void 0 === e && (e = !1), void 0 === i && (i = !0); var n = 1; if (Array.isArray(t)) for (n = t.length; n--; ) t[n]instanceof s.Group ? this.enable(t[n].children, e, i) : (this.enableBody(t[n], e), i && t[n].hasOwnProperty("children") && t[n].children.length > 0 && this.enable(t[n], e, !0)); else t instanceof s.Group ? this.enable(t.children, e, i) : (this.enableBody(t, e), i && t.hasOwnProperty("children") && t.children.length > 0 && this.enable(t.children, e, !0)) }, enableBody: function(t, e) { t.hasOwnProperty("body") && null === t.body && (t.body = new
s.Physics.P2.Body(this.game,t,t.x,t.y,1), t.body.debug = e, void 0 !== t.anchor && t.anchor.set(.5)) }, setImpactEvents: function(t) { t ? this.world.on("impact", this.impactHandler, this) : this.world.off("impact", this.impactHandler, this) }, setPostBroadphaseCallback: function(t, e) { this.postBroadphaseCallback = t, this.callbackContext = e, null !== t ? this.world.on("postBroadphase", this.postBroadphaseHandler, this) : this.world.off("postBroadphase", this.postBroadphaseHandler, this) }, postBroadphaseHandler: function(t) { if (this.postBroadphaseCallback && 0 !== t.pairs.length) for (var e = t.pairs.length - 2; e >= 0; e -= 2) t.pairs[e].parent && t.pairs[e + 1].parent && ! this.postBroadphaseCallback.call(this.callbackContext, t.pairs[e].parent, t.pairs[e + 1].parent) && t.pairs.splice(e, 2) }, impactHandler: function(t) { if (t.bodyA.parent && t.bodyB.parent) { var e = t.bodyA.parent , i = t.bodyB.parent; e._bodyCallbacks[t.bodyB.id] && e._bodyCallbacks[t.bodyB.id].call(e._bodyCallbackContext[t.bodyB.id], e, i, t.shapeA, t.shapeB), i._bodyCallbacks[t.bodyA.id] && i._bodyCallbacks[t.bodyA.id].call(i._bodyCallbackContext[t.bodyA.id], i, e, t.shapeB, t.shapeA), e._groupCallbacks[t.shapeB.collisionGroup] && e._groupCallbacks[t.shapeB.collisionGroup].call(e._groupCallbackContext[t.shapeB.co llisionGroup], e, i, t.shapeA, t.shapeB), i._groupCallbacks[t.shapeA.collisionGroup] && i._groupCallbacks[t.shapeA.collisionGroup].call(i._groupCallbackContext[t.shapeA.co llisionGroup], i, e, t.shapeB, t.shapeA) } }, beginContactHandler: function(t) { t.bodyA && t.bodyB && (this.onBeginContact.dispatch(t.bodyA, t.bodyB, t.shapeA, t.shapeB, t.contactEquations), t.bodyA.parent && t.bodyA.parent.onBeginContact.dispatch(t.bodyB.parent, t.bodyB, t.shapeA, t.shapeB, t.contactEquations), t.bodyB.parent && t.bodyB.parent.onBeginContact.dispatch(t.bodyA.parent, t.bodyA, t.shapeB, t.shapeA, t.contactEquations)) }, endContactHandler: function(t) { t.bodyA && t.bodyB && (this.onEndContact.dispatch(t.bodyA, t.bodyB, t.shapeA, t.shapeB), t.bodyA.parent && t.bodyA.parent.onEndContact.dispatch(t.bodyB.parent, t.bodyB, t.shapeA, t.shapeB), t.bodyB.parent && t.bodyB.parent.onEndContact.dispatch(t.bodyA.parent, t.bodyA, t.shapeB, t.shapeA)) }, setBoundsToWorld: function(t, e, i, n, s) {
this.setBounds(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height, t, e, i, n, s) }, setWorldMaterial: function(t, e, i, n, s) { void 0 === e && (e = !0), void 0 === i && (i = !0), void 0 === n && (n = !0), void 0 === s && (s = !0), e && this.walls.left && (this.walls.left.shapes[0].material = t), i && this.walls.right && (this.walls.right.shapes[0].material = t), n && this.walls.top && (this.walls.top.shapes[0].material = t), s && this.walls.bottom && (this.walls.bottom.shapes[0].material = t) }, updateBoundsCollisionGroup: function(t) { void 0 === t && (t = !0); var e = t ? this.boundsCollisionGroup.mask : this.everythingCollisionGroup.mask; this.walls.left && (this.walls.left.shapes[0].collisionGroup = e), this.walls.right && (this.walls.right.shapes[0].collisionGroup = e), this.walls.top && (this.walls.top.shapes[0].collisionGroup = e), this.walls.bottom && (this.walls.bottom.shapes[0].collisionGroup = e), this._boundsOwnGroup = t }, setBounds: function(t, e, i, n, s, o, r, a, h) { void 0 === s && (s = this._boundsLeft), void 0 === o && (o = this._boundsRight), void 0 === r && (r = this._boundsTop), void 0 === a && (a = this._boundsBottom), void 0 === h && (h = this._boundsOwnGroup), this.setupWall(s, "left", t, e, 1.5707963267948966, h), this.setupWall(o, "right", t + i, e, -1.5707963267948966, h), this.setupWall(r, "top", t, e, -3.141592653589793, h), this.setupWall(a, "bottom", t, e + n, 0, h), this._boundsLeft = s, this._boundsRight = o, this._boundsTop = r, this._boundsBottom = a, this._boundsOwnGroup = h }, setupWall: function(t, e, i, n, s, o) { t ? (this.walls[e] ? this.walls[e].position = [this.pxmi(i), this.pxmi(n)] : (this.walls[e] = new p2.Body({ mass: 0, position: [this.pxmi(i), this.pxmi(n)], angle: s }), this.walls[e].addShape(new p2.Plane), this.world.addBody(this.walls[e])), o && (this.walls[e].shapes[0].collisionGroup = this.boundsCollisionGroup.mask)) : this.walls[e] && (this.world.removeBody(this.walls[e]), this.walls[e] = null) }, pause: function() { this.paused = !0 },
resume: function() { this.paused = !1 }, update: function() { this.paused || (this.useElapsedTime ? this.world.step(this.game.time.physicsElapsed) : this.world.step(this.frameRate)) }, reset: function() { this.world.on("beginContact", this.beginContactHandler, this), this.world.on("endContact", this.endContactHandler, this), this.nothingCollisionGroup = new s.Physics.P2.CollisionGroup(1), this.boundsCollisionGroup = new s.Physics.P2.CollisionGroup(2), this.everythingCollisionGroup = new s.Physics.P2.CollisionGroup(2147483648), this._collisionGroupID = 2, this.setBoundsToWorld(!0, !0, !0, !0, !1) }, clear: function() { this.world.time = 0, this.world.fixedStepTime = 0, this.world.solver && this.world.solver.equations.length && this.world.solver.removeAllEquations(); for (var t = this.world.constraints, e = t.length - 1; e >= 0; e--) this.world.removeConstraint(t[e]); for (var i = this.world.bodies, e = i.length - 1; e >= 0; e--) this.world.removeBody(i[e]); for (var n = this.world.springs, e = n.length - 1; e >= 0; e--) this.world.removeSpring(n[e]); for (var s = this.world.contactMaterials, e = s.length - 1; e >= 0; e--) this.world.removeContactMaterial(s[e]); this.world.off("beginContact", this.beginContactHandler, this), this.world.off("endContact", this.endContactHandler, this), this.postBroadphaseCallback = null, this.callbackContext = null, this.impactCallback = null, this.collisionGroups = [], this._toRemove = [], this.boundsCollidesWith = [], this.walls = { left: null, right: null, top: null, bottom: null } }, destroy: function() { this.clear(), this.game = null }, addBody: function(t) { return !t.data.world && (this.world.addBody(t.data), this.onBodyAdded.dispatch(t), !0) }, removeBody: function(t) { return t.data.world === this.world && (this.world.removeBody(t.data), this.onBodyRemoved.dispatch(t)),
t }, addSpring: function(t) { return t instanceof s.Physics.P2.Spring || t instanceof s.Physics.P2.RotationalSpring ? this.world.addSpring(t.data) : this.world.addSpring(t), this.onSpringAdded.dispatch(t), t }, removeSpring: function(t) { return t instanceof s.Physics.P2.Spring || t instanceof s.Physics.P2.RotationalSpring ? this.world.removeSpring(t.data) : this.world.removeSpring(t), this.onSpringRemoved.dispatch(t), t }, createDistanceConstraint: function(t, e, i, n, o, r) { if (t = this.getBody(t), e = this.getBody(e), t && e) return this.addConstraint(new s.Physics.P2.DistanceConstraint(this,t,e,i,n,o,r)); console.warn("Cannot create Constraint, invalid body objects given") }, createGearConstraint: function(t, e, i, n) { if (t = this.getBody(t), e = this.getBody(e), t && e) return this.addConstraint(new s.Physics.P2.GearConstraint(this,t,e,i,n)); console.warn("Cannot create Constraint, invalid body objects given") }, createRevoluteConstraint: function(t, e, i, n, o, r) { if (t = this.getBody(t), i = this.getBody(i), t && i) return this.addConstraint(new s.Physics.P2.RevoluteConstraint(this,t,e,i,n,o,r)); console.warn("Cannot create Constraint, invalid body objects given") }, createLockConstraint: function(t, e, i, n, o) { if (t = this.getBody(t), e = this.getBody(e), t && e) return this.addConstraint(new s.Physics.P2.LockConstraint(this,t,e,i,n,o)); console.warn("Cannot create Constraint, invalid body objects given") }, createPrismaticConstraint: function(t, e, i, n, o, r, a) { if (t = this.getBody(t), e = this.getBody(e), t && e) return this.addConstraint(new s.Physics.P2.PrismaticConstraint(this,t,e,i,n,o,r,a)); console.warn("Cannot create Constraint, invalid body objects
given")
}, addConstraint: function(t) { return this.world.addConstraint(t), this.onConstraintAdded.dispatch(t), t }, removeConstraint: function(t) { return this.world.removeConstraint(t), this.onConstraintRemoved.dispatch(t), t }, addContactMaterial: function(t) { return this.world.addContactMaterial(t), this.onContactMaterialAdded.dispatch(t), t }, removeContactMaterial: function(t) { return this.world.removeContactMaterial(t), this.onContactMaterialRemoved.dispatch(t), t }, getContactMaterial: function(t, e) { return this.world.getContactMaterial(t, e) }, setMaterial: function(t, e) { for (var i = e.length; i--; ) e[i].setMaterial(t) }, createMaterial: function(t, e) { t = t || ""; var i = new s.Physics.P2.Material(t); return this.materials.push(i), void 0 !== e && e.setMaterial(i), i }, createContactMaterial: function(t, e, i) { void 0 === t && (t = this.createMaterial()), void 0 === e && (e = this.createMaterial()); var n = new s.Physics.P2.ContactMaterial(t,e,i); return this.addContactMaterial(n) }, getBodies: function() { for (var t = [], e = this.world.bodies.length; e--; ) t.push(this.world.bodies[e].parent); return t }, getBody: function(t) { return t instanceof p2.Body ? t : t instanceof s.Physics.P2.Body ? t.data : t.body && t.body.type === s.Physics.P2JS ? t.body.data : null }, getSprings: function() { for (var t = [], e = this.world.springs.length; e--; ) t.push(this.world.springs[e].parent); return t }, getConstraints: function() { for (var t = [], e = this.world.constraints.length; e--; ) t.push(this.world.constraints[e]);
return t }, hitTest: function(t, e, i, n) { void 0 === e && (e = this.world.bodies), void 0 === i && (i = 5), void 0 === n && (n = !1); for (var o = [this.pxmi(t.x), this.pxmi(t.y)], r = [], a = e.length; a--; ) e[a]instanceof s.Physics.P2.Body && (!n || e[a].data.type !== p2.Body.STATIC) ? r.push(e[a].data) : e[a]instanceof p2.Body && e[a].parent && (!n || e[a].type !== p2.Body.STATIC) ? r.push(e[a]) : e[a]instanceof s.Sprite && e[a].hasOwnProperty("body") && (!n || e[a].body.data.type !== p2.Body.STATIC) && r.push(e[a].body.data); return this.world.hitTest(o, r, i) }, toJSON: function() { return this.world.toJSON() }, createCollisionGroup: function(t) { var e = Math.pow(2, this._collisionGroupID); this.walls.left && (this.walls.left.shapes[0].collisionMask = this.walls.left.shapes[0].collisionMask | e), this.walls.right && (this.walls.right.shapes[0].collisionMask = this.walls.right.shapes[0].collisionMask | e), this.walls.top && (this.walls.top.shapes[0].collisionMask = this.walls.top.shapes[0].collisionMask | e), this.walls.bottom && (this.walls.bottom.shapes[0].collisionMask = this.walls.bottom.shapes[0].collisionMask | e), this._collisionGroupID++; var i = new s.Physics.P2.CollisionGroup(e); return this.collisionGroups.push(i), t && this.setCollisionGroup(t, i), i }, setCollisionGroup: function(t, e) { if (t instanceof s.Group) for (var i = 0; i < t.total; i++) t.children[i].body && t.children[i].body.type === s.Physics.P2JS && t.children[i].body.setCollisionGroup(e); else t.body.setCollisionGroup(e) }, createSpring: function(t, e, i, n, o, r, a, h, l) { if (t = this.getBody(t), e = this.getBody(e), t && e) return this.addSpring(new s.Physics.P2.Spring(this,t,e,i,n,o,r,a,h,l)); console.warn("Cannot create Spring, invalid body objects given") }, createRotationalSpring: function(t, e, i, n, o) { if (t = this.getBody(t), e = this.getBody(e), t && e) return this.addSpring(new s.Physics.P2.RotationalSpring(this,t,e,i,n,o)); console.warn("Cannot create Rotational Spring, invalid body objects given") },
a++) {
createBody: function(t, e, i, n, o, r) { void 0 === n && (n = !1); var a = new s.Physics.P2.Body(this.game,null,t,e,i); if (r) { if (!a.addPolygon(o, r)) return !1 } return n && this.world.addBody(a.data), a }, createParticle: function(t, e, i, n, o, r) { void 0 === n && (n = !1); var a = new s.Physics.P2.Body(this.game,null,t,e,i); if (r) { if (!a.addPolygon(o, r)) return !1 } return n && this.world.addBody(a.data), a }, convertCollisionObjects: function(t, e, i) { void 0 === i && (i = !0); for (var n = [], s = 0, o = t.collision[e].length; s < o; s++) { var r = t.collision[e][s] , a = this.createBody(r.x, r.y, 0, i, {}, r.polyline); a && n.push(a) } return n }, clearTilemapLayerBodies: function(t, e) { e = t.getLayer(e); for (var i = t.layers[e].bodies.length; i--; ) t.layers[e].bodies[i].destroy(); t.layers[e].bodies.length = 0 }, convertTilemap: function(t, e, i, n) { e = t.getLayer(e), void 0 === i && (i = !0), void 0 === n && (n = !0), this.clearTilemapLayerBodies(t, e); for (var s = 0, o = 0, r = 0, a = 0, h = t.layers[e].height; a < h; s = 0; for (var l = 0, c = t.layers[e].width; l < c; l++) { var u = t.layers[e].data[a][l]; if (u && u.index > -1 && u.collides) if (n) { var d = t.getTileRight(e, l, a); if (0 === s && (o = u.x * u.width, r = u.y * u.height, s = u.width), d && d.collides) s += u.width; else { var p = this.createBody(o, r, 0, !1); p.addRectangle(s, u.height, s / 2, u.height /
2, 0),
i && this.addBody(p), t.layers[e].bodies.push(p),
s = 0 } } else { var p = this.createBody(u.x * u.width, u.y * u.height, 0, !1);
p.addRectangle(u.width, u.height, u.width / 2,
u.height / 2, 0), }
i && this.addBody(p), t.layers[e].bodies.push(p)
}
} return t.layers[e].bodies
}, mpx: function(t) { return t *= 20 }, pxm: function(t) { return .05 * t }, mpxi: function(t) { return t *= -20 }, pxmi: function(t) { return -.05 * t }
}, Object.defineProperty(s.Physics.P2.prototype, "friction", { get: function() { return this.world.defaultContactMaterial.friction }, set: function(t) { this.world.defaultContactMaterial.friction = t } }), Object.defineProperty(s.Physics.P2.prototype, "restitution", { get: function() { return this.world.defaultContactMaterial.restitution }, set: function(t) { this.world.defaultContactMaterial.restitution = t } }), Object.defineProperty(s.Physics.P2.prototype, "contactMaterial", { get: function() { return this.world.defaultContactMaterial }, set: function(t) { this.world.defaultContactMaterial = t } }), Object.defineProperty(s.Physics.P2.prototype, "applySpringForces", { get: function() { return this.world.applySpringForces }, set: function(t) { this.world.applySpringForces = t } }),
Object.defineProperty(s.Physics.P2.prototype, get: function() { return this.world.applyDamping }, set: function(t) { this.world.applyDamping = t } }), Object.defineProperty(s.Physics.P2.prototype, get: function() { return this.world.applyGravity }, set: function(t) { this.world.applyGravity = t } }), Object.defineProperty(s.Physics.P2.prototype, get: function() { return this.world.solveConstraints }, set: function(t) { this.world.solveConstraints = t } }), Object.defineProperty(s.Physics.P2.prototype, get: function() { return this.world.time } }), Object.defineProperty(s.Physics.P2.prototype, get: function() { return this.world.emitImpactEvent }, set: function(t) { this.world.emitImpactEvent = t } }), Object.defineProperty(s.Physics.P2.prototype, get: function() { return this.world.sleepMode }, set: function(t) { this.world.sleepMode = t } }), Object.defineProperty(s.Physics.P2.prototype, get: function() { return this.world.bodies.length } }), s.Physics.P2.FixtureList = function(t) { Array.isArray(t) || (t = [t]), this.rawList = t, this.init(), this.parse(this.rawList) } , s.Physics.P2.FixtureList.prototype = { init: function() {
"applyDamping", {
"applyGravity", {
"solveConstraints", {
"time", {
"emitImpactEvent", {
"sleepMode", {
"total", {
this.namedFixtures = {}, this.groupedFixtures = [], this.allFixtures = []
}, setCategory: function(t, e) { var i = function(e) { e.collisionGroup = t }; this.getFixtures(e).forEach(i) }, setMask: function(t, e) { var i = function(e) { e.collisionMask = t }; this.getFixtures(e).forEach(i) }, setSensor: function(t, e) { var i = function(e) { e.sensor = t }; this.getFixtures(e).forEach(i) }, setMaterial: function(t, e) { var i = function(e) { e.material = t }; this.getFixtures(e).forEach(i) }, getFixtures: function(t) { var e = []; if (t) { t instanceof Array || (t = [t]); var i = this; return t.forEach(function(t) { i.namedFixtures[t] && e.push(i.namedFixtures[t]) }), this.flatten(e) } return this.allFixtures }, getFixtureByKey: function(t) { return this.namedFixtures[t] }, getGroup: function(t) { return this.groupedFixtures[t] }, parse: function() { var t, e, i, n; i = this.rawList, n = []; for (t in i) e = i[t], isNaN(t - 0) ? this.namedFixtures[t] = this.flatten(e) : (this.groupedFixtures[t] = this.groupedFixtures[t] || [], this.groupedFixtures[t] = this.groupedFixtures[t].concat(e)), n.push(this.allFixtures = this.flatten(this.groupedFixtures)) }, flatten: function(t) { var e, i;
return e = [], i = arguments.callee, t.forEach(function(t) { return Array.prototype.push.apply(e, Array.isArray(t) ? i(t) : [t])
}), e
} }, s.Physics.P2.PointProxy = function(t, e) { this.world = t, this.destination = e } , s.Physics.P2.PointProxy.prototype.constructor = s.Physics.P2.PointProxy, Object.defineProperty(s.Physics.P2.PointProxy.prototype, "x", { get: function() { return this.world.mpx(this.destination[0]) }, set: function(t) { this.destination[0] = this.world.pxm(t) } }), Object.defineProperty(s.Physics.P2.PointProxy.prototype, "y", { get: function() { return this.world.mpx(this.destination[1]) }, set: function(t) { this.destination[1] = this.world.pxm(t) } }), Object.defineProperty(s.Physics.P2.PointProxy.prototype, "mx", { get: function() { return this.destination[0] }, set: function(t) { this.destination[0] = t } }), Object.defineProperty(s.Physics.P2.PointProxy.prototype, "my", { get: function() { return this.destination[1] }, set: function(t) { this.destination[1] = t } }), s.Physics.P2.InversePointProxy = function(t, e) { this.world = t, this.destination = e } , s.Physics.P2.InversePointProxy.prototype.constructor = s.Physics.P2.InversePointProxy, Object.defineProperty(s.Physics.P2.InversePointProxy.prototype, "x", { get: function() { return this.world.mpxi(this.destination[0]) }, set: function(t) {
}
this.destination[0] = this.world.pxmi(t)
}), Object.defineProperty(s.Physics.P2.InversePointProxy.prototype, "y", { get: function() { return this.world.mpxi(this.destination[1]) }, set: function(t) { this.destination[1] = this.world.pxmi(t) } }), Object.defineProperty(s.Physics.P2.InversePointProxy.prototype, "mx", { get: function() { return this.destination[0] }, set: function(t) { this.destination[0] = -t } }), Object.defineProperty(s.Physics.P2.InversePointProxy.prototype, "my", { get: function() { return this.destination[1] }, set: function(t) { this.destination[1] = -t } }), s.Physics.P2.Body = function(t, e, i, n, o) { e = e || null, i = i || 0, n = n || 0, void 0 === o && (o = 1), this.game = t, this.world = t.physics.p2, this.sprite = e, this.type = s.Physics.P2JS, this.offset = new s.Point, this.data = new p2.Body({ position: [this.world.pxmi(i), this.world.pxmi(n)], mass: o }), this.data.parent = this, this.velocity = new s.Physics.P2.InversePointProxy(this.world,this.data.velocity), this.force = new s.Physics.P2.InversePointProxy(this.world,this.data.force), this.gravity = new s.Point, this.onBeginContact = new s.Signal, this.onEndContact = new s.Signal, this.collidesWith = [], this.removeNextStep = !1, this.debugBody = null, this.dirty = !1, this._collideWorldBounds = !0, this._bodyCallbacks = {}, this._bodyCallbackContext = {}, this._groupCallbacks = {}, this._groupCallbackContext = {}, this._reset = !1,
e && (this.setRectangleFromSprite(e), e.exists && this.game.physics.p2.addBody(this)) } , s.Physics.P2.Body.prototype = { createBodyCallback: function(t, e, i) { var n = -1; t.id ? n = t.id : t.body && (n = t.body.id), n > -1 && (null === e ? (delete this._bodyCallbacks[n], delete this._bodyCallbackContext[n]) : (this._bodyCallbacks[n] = e, this._bodyCallbackContext[n] = i)) }, createGroupCallback: function(t, e, i) { null === e ? (delete this._groupCallbacks[t.mask], delete this._groupCallbackContext[t.mask]) : (this._groupCallbacks[t.mask] = e, this._groupCallbackContext[t.mask] = i) }, getCollisionMask: function() { var t = 0; this._collideWorldBounds && (t = this.game.physics.p2.boundsCollisionGroup.mask); for (var e = 0; e < this.collidesWith.length; e++) t |= this.collidesWith[e].mask; return t }, updateCollisionMask: function(t) { var e = this.getCollisionMask(); if (void 0 === t) for (var i = this.data.shapes.length - 1; i >= 0; i--) this.data.shapes[i].collisionMask = e; else t.collisionMask = e }, setCollisionGroup: function(t, e) { var i = this.getCollisionMask(); if (void 0 === e) for (var n = this.data.shapes.length - 1; n >= 0; n--) this.data.shapes[n].collisionGroup = t.mask, this.data.shapes[n].collisionMask = i; else e.collisionGroup = t.mask, e.collisionMask = i }, clearCollision: function(t, e, i) { if (void 0 === t && (t = !0), void 0 === e && (e = !0), void 0 === i) for (var n = this.data.shapes.length - 1; n >= 0; n--) t && (this.data.shapes[n].collisionGroup = null), e && (this.data.shapes[n].collisionMask = null); else t && (i.collisionGroup = null), e && (i.collisionMask = null); t && (this.collidesWith.length = 0) }, removeCollisionGroup: function(t, e, i) { void 0 === e && (e = !0); var n;
if (Array.isArray(t)) for (var s = 0; s < t.length; s++) (n = this.collidesWith.indexOf(t[s])) > -1 && (this.collidesWith.splice(n, 1), e && (delete this._groupCallbacks[t.mask], delete this._groupCallbackContext[t.mask])); else (n = this.collidesWith.indexOf(t)) > -1 && (this.collidesWith.splice(n, 1), e && (delete this._groupCallbacks[t.mask], delete this._groupCallbackContext[t.mask])); var o = this.getCollisionMask(); if (void 0 === i) for (var s = this.data.shapes.length - 1; s >= 0; s--) this.data.shapes[s].collisionMask = o; else i.collisionMask = o }, collides: function(t, e, i, n) { if (Array.isArray(t)) for (var s = 0; s < t.length; s++) -1 === this.collidesWith.indexOf(t[s]) && (this.collidesWith.push(t[s]), e && this.createGroupCallback(t[s], e, i)); else -1 === this.collidesWith.indexOf(t) && (this.collidesWith.push(t), e && this.createGroupCallback(t, e, i)); var o = this.getCollisionMask(); if (void 0 === n) for (var s = this.data.shapes.length - 1; s >= 0; s--) this.data.shapes[s].collisionMask = o; else n.collisionMask = o }, adjustCenterOfMass: function() { this.data.adjustCenterOfMass(), this.shapeChanged() }, getVelocityAtPoint: function(t, e) { return this.data.getVelocityAtPoint(t, e) }, applyDamping: function(t) { this.data.applyDamping(t) }, applyImpulse: function(t, e, i) { this.data.applyImpulse(t, [this.world.pxmi(e), this.world.pxmi(i)]) }, applyImpulseLocal: function(t, e, i) { this.data.applyImpulseLocal(t, [this.world.pxmi(e), this.world.pxmi(i)]) }, applyForce: function(t, e, i) { this.data.applyForce(t, [this.world.pxmi(e), this.world.pxmi(i)]) }, setZeroForce: function() { this.data.setZeroForce() }, setZeroRotation: function() {
this.data.angularVelocity = 0 }, setZeroVelocity: function() { this.data.velocity[0] = 0, this.data.velocity[1] = 0 }, setZeroDamping: function() { this.data.damping = 0, this.data.angularDamping = 0 }, toLocalFrame: function(t, e) { return this.data.toLocalFrame(t, e) }, toWorldFrame: function(t, e) { return this.data.toWorldFrame(t, e) }, rotateLeft: function(t) { this.data.angularVelocity = this.world.pxm(-t) }, rotateRight: function(t) { this.data.angularVelocity = this.world.pxm(t) }, moveForward: function(t) { var e = this.world.pxmi(-t) , i = this.data.angle + Math.PI / 2; this.data.velocity[0] = e * Math.cos(i), this.data.velocity[1] = e * Math.sin(i) }, moveBackward: function(t) { var e = this.world.pxmi(-t) , i = this.data.angle + Math.PI / 2; this.data.velocity[0] = -e * Math.cos(i), this.data.velocity[1] = -e * Math.sin(i) }, thrust: function(t) { var e = this.world.pxmi(-t) , i = this.data.angle + Math.PI / 2; this.data.force[0] += e * Math.cos(i), this.data.force[1] += e * Math.sin(i) }, thrustLeft: function(t) { var e = this.world.pxmi(-t) , i = this.data.angle; this.data.force[0] += e * Math.cos(i), this.data.force[1] += e * Math.sin(i) }, thrustRight: function(t) { var e = this.world.pxmi(-t) , i = this.data.angle; this.data.force[0] -= e * Math.cos(i), this.data.force[1] -= e * Math.sin(i) }, reverse: function(t) { var e = this.world.pxmi(-t) , i = this.data.angle + Math.PI / 2; this.data.force[0] -= e * Math.cos(i), this.data.force[1] -= e * Math.sin(i) }, moveLeft: function(t) {
this.data.velocity[0] = this.world.pxmi(-t) }, moveRight: function(t) { this.data.velocity[0] = this.world.pxmi(t) }, moveUp: function(t) { this.data.velocity[1] = this.world.pxmi(-t) }, moveDown: function(t) { this.data.velocity[1] = this.world.pxmi(t) }, preUpdate: function() { this.dirty = !0, this.removeNextStep && (this.removeFromWorld(), this.removeNextStep = !1) }, postUpdate: function() { this.sprite.x = this.world.mpxi(this.data.position[0]) + this.offset.x, this.sprite.y = this.world.mpxi(this.data.position[1]) + this.offset.y, this.fixedRotation || (this.sprite.rotation = this.data.angle), this.debugBody && this.debugBody.updateSpriteTransform(), this.dirty = !1 }, reset: function(t, e, i, n) { void 0 === i && (i = !1), void 0 === n && (n = !1), this.setZeroForce(), this.setZeroVelocity(), this.setZeroRotation(), i && this.setZeroDamping(), n && (this.mass = 1), this.x = t, this.y = e }, addToWorld: function() { if (this.game.physics.p2._toRemove) for (var t = 0; t < this.game.physics.p2._toRemove.length; t++) this.game.physics.p2._toRemove[t] === this && this.game.physics.p2._toRemove.splice(t, 1); this.data.world !== this.game.physics.p2.world && this.game.physics.p2.addBody(this) }, removeFromWorld: function() { this.data.world === this.game.physics.p2.world && this.game.physics.p2.removeBodyNextStep(this) }, destroy: function() { this.removeFromWorld(), this.clearShapes(), this._bodyCallbacks = {}, this._bodyCallbackContext = {}, this._groupCallbacks = {}, this._groupCallbackContext = {}, this.debugBody && this.debugBody.destroy(!0, !0), this.debugBody = null, this.sprite && (this.sprite.body = null, this.sprite = null)
}, clearShapes: function() { for (var t = this.data.shapes.length; t--; ) this.data.removeShape(this.data.shapes[t]); this.shapeChanged() }, addShape: function(t, e, i, n) { return void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 0), this.data.addShape(t, [this.world.pxmi(e), this.world.pxmi(i)], n), this.shapeChanged(), t }, addCircle: function(t, e, i, n) { var s = new p2.Circle({ radius: this.world.pxm(t) }); return this.addShape(s, e, i, n) }, addRectangle: function(t, e, i, n, s) { var o = new p2.Box({ width: this.world.pxm(t), height: this.world.pxm(e) }); return this.addShape(o, i, n, s) }, addPlane: function(t, e, i) { var n = new p2.Plane; return this.addShape(n, t, e, i) }, addParticle: function(t, e, i) { var n = new p2.Particle; return this.addShape(n, t, e, i) }, addLine: function(t, e, i, n) { var s = new p2.Line({ length: this.world.pxm(t) }); return this.addShape(s, e, i, n) }, addCapsule: function(t, e, i, n, s) { var o = new p2.Capsule({ length: this.world.pxm(t), radius: this.world.pxm(e) }); return this.addShape(o, i, n, s) }, addPolygon: function(t, e) { t = t || {}, Array.isArray(e) || (e = Array.prototype.slice.call(arguments, 1)); var i = []; if (1 === e.length && Array.isArray(e[0])) i = e[0].slice(0); else if (Array.isArray(e[0])) i = e.slice(); else if ("number" == typeof e[0]) for (var n = 0, s = e.length; n < s; n += 2) i.push([e[n], e[n + 1]]);
var o = i.length - 1; i[o][0] === i[0][0] && i[o][1] === i[0][1] && i.pop(); for (var r = 0; r < i.length; r++) i[r][0] = this.world.pxmi(i[r][0]), i[r][1] = this.world.pxmi(i[r][1]); var a = this.data.fromPolygon(i, t); return this.shapeChanged(), a }, removeShape: function(t) { var e = this.data.removeShape(t); return this.shapeChanged(), e }, setCircle: function(t, e, i, n) { return this.clearShapes(), this.addCircle(t, e, i, n) }, setRectangle: function(t, e, i, n, s) { return void 0 === t && (t = 16), void 0 === e && (e = 16), this.clearShapes(), this.addRectangle(t, e, i, n, s) }, setRectangleFromSprite: function(t) { return void 0 === t && (t = this.sprite), this.clearShapes(), this.addRectangle(t.width, t.height, 0, 0, t.rotation) }, setMaterial: function(t, e) { if (void 0 === e) for (var i = this.data.shapes.length - 1; i >= 0; i--) this.data.shapes[i].material = t; else e.material = t }, shapeChanged: function() { this.debugBody && this.debugBody.draw() }, addPhaserPolygon: function(t, e) { for (var i = this.game.cache.getPhysicsData(t, e), n = [], s = 0; s < i.length; s++) { var o = i[s] , r = this.addFixture(o); n[o.filter.group] = n[o.filter.group] || [], n[o.filter.group] = n[o.filter.group].concat(r), o.fixtureKey && (n[o.fixtureKey] = r) } return this.data.aabbNeedsUpdate = !0, this.shapeChanged(), n }, addFixture: function(t) { var e = []; if (t.circle) { var i = new p2.Circle({ radius: this.world.pxm(t.circle.radius) }); i.collisionGroup = t.filter.categoryBits,
i.collisionMask = t.filter.maskBits, i.sensor = t.isSensor; var n = p2.vec2.create(); n[0] = this.world.pxmi(t.circle.position[0] - this.sprite.width / 2),
n[1] = this.world.pxmi(t.circle.position[1] this.sprite.height / 2), this.data.addShape(i, n), e.push(i) } else for (var s = t.polygons, o = p2.vec2.create(), r = 0; r < s.length; r++) { for (var a = s[r], h = [], l = 0; l < a.length; l += 2) h.push([this.world.pxmi(a[l]), this.world.pxmi(a[l + 1])]); for (var i = new p2.Convex({ vertices: h }), c = 0; c !== i.vertices.length; c++) { var u = i.vertices[c]; p2.vec2.sub(u, u, i.centerOfMass) } p2.vec2.scale(o, i.centerOfMass, 1), o[0] -= this.world.pxmi(this.sprite.width / 2), o[1] -= this.world.pxmi(this.sprite.height / 2), i.updateTriangles(), i.updateCenterOfMass(), i.updateBoundingRadius(), i.collisionGroup = t.filter.categoryBits, i.collisionMask = t.filter.maskBits, i.sensor = t.isSensor, this.data.addShape(i, o), e.push(i) } return e }, loadPolygon: function(t, e) { if (null === t) var i = e; else var i = this.game.cache.getPhysicsData(t, e); for (var n = p2.vec2.create(), s = 0; s < i.length; s++) { for (var o = [], r = 0; r < i[s].shape.length; r += 2) o.push([this.world.pxmi(i[s].shape[r]), this.world.pxmi(i[s].shape[r + 1])]); for (var a = new p2.Convex({ vertices: o }), h = 0; h !== a.vertices.length; h++) { var l = a.vertices[h]; p2.vec2.sub(l, l, a.centerOfMass) } p2.vec2.scale(n, a.centerOfMass, 1), n[0] -= this.world.pxmi(this.sprite.width / 2), n[1] -= this.world.pxmi(this.sprite.height / 2), a.updateTriangles(), a.updateCenterOfMass(), a.updateBoundingRadius(), this.data.addShape(a, n) } return this.data.aabbNeedsUpdate = !0,
this.shapeChanged(), !0 } }, s.Physics.P2.Body.prototype.constructor = s.Physics.P2.Body, s.Physics.P2.Body.DYNAMIC = 1, s.Physics.P2.Body.STATIC = 2, s.Physics.P2.Body.KINEMATIC = 4, Object.defineProperty(s.Physics.P2.Body.prototype, "static", { get: function() { return this.data.type === s.Physics.P2.Body.STATIC }, set: function(t) { t && this.data.type !== s.Physics.P2.Body.STATIC ? (this.data.type = s.Physics.P2.Body.STATIC, this.mass = 0) : t || this.data.type !== s.Physics.P2.Body.STATIC || (this.data.type = s.Physics.P2.Body.DYNAMIC, this.mass = 1) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "dynamic", { get: function() { return this.data.type === s.Physics.P2.Body.DYNAMIC }, set: function(t) { t && this.data.type !== s.Physics.P2.Body.DYNAMIC ? (this.data.type = s.Physics.P2.Body.DYNAMIC, this.mass = 1) : t || this.data.type !== s.Physics.P2.Body.DYNAMIC || (this.data.type = s.Physics.P2.Body.STATIC, this.mass = 0) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "kinematic", { get: function() { return this.data.type === s.Physics.P2.Body.KINEMATIC }, set: function(t) { t && this.data.type !== s.Physics.P2.Body.KINEMATIC ? (this.data.type = s.Physics.P2.Body.KINEMATIC, this.mass = 4) : t || this.data.type !== s.Physics.P2.Body.KINEMATIC || (this.data.type = s.Physics.P2.Body.STATIC, this.mass = 0) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "allowSleep", { get: function() { return this.data.allowSleep }, set: function(t) { t !== this.data.allowSleep && (this.data.allowSleep = t) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "angle", { get: function() { return s.Math.wrapAngle(s.Math.radToDeg(this.data.angle)) }, set: function(t) { this.data.angle = s.Math.degToRad(s.Math.wrapAngle(t)) }
}), Object.defineProperty(s.Physics.P2.Body.prototype, "angularDamping", { get: function() { return this.data.angularDamping }, set: function(t) { this.data.angularDamping = t } }), Object.defineProperty(s.Physics.P2.Body.prototype, "angularForce", { get: function() { return this.data.angularForce }, set: function(t) { this.data.angularForce = t } }), Object.defineProperty(s.Physics.P2.Body.prototype, "angularVelocity", { get: function() { return this.data.angularVelocity }, set: function(t) { this.data.angularVelocity = t } }), Object.defineProperty(s.Physics.P2.Body.prototype, "damping", { get: function() { return this.data.damping }, set: function(t) { this.data.damping = t } }), Object.defineProperty(s.Physics.P2.Body.prototype, "fixedRotation", { get: function() { return this.data.fixedRotation }, set: function(t) { t !== this.data.fixedRotation && (this.data.fixedRotation = t) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "inertia", { get: function() { return this.data.inertia }, set: function(t) { this.data.inertia = t } }), Object.defineProperty(s.Physics.P2.Body.prototype, "mass", { get: function() { return this.data.mass }, set: function(t) { t !== this.data.mass && (this.data.mass = t, this.data.updateMassProperties()) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "motionState", {
get: function() { return this.data.type }, set: function(t) { t !== this.data.type && (this.data.type = t) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "rotation", { get: function() { return this.data.angle }, set: function(t) { this.data.angle = t } }), Object.defineProperty(s.Physics.P2.Body.prototype, "sleepSpeedLimit", { get: function() { return this.data.sleepSpeedLimit }, set: function(t) { this.data.sleepSpeedLimit = t } }), Object.defineProperty(s.Physics.P2.Body.prototype, "x", { get: function() { return this.world.mpxi(this.data.position[0]) }, set: function(t) { this.data.position[0] = this.world.pxmi(t) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "y", { get: function() { return this.world.mpxi(this.data.position[1]) }, set: function(t) { this.data.position[1] = this.world.pxmi(t) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "id", { get: function() { return this.data.id } }), Object.defineProperty(s.Physics.P2.Body.prototype, "debug", { get: function() { return null !== this.debugBody }, set: function(t) { t && !this.debugBody ? this.debugBody = new s.Physics.P2.BodyDebug(this.game,this.data) : !t && this.debugBody && (this.debugBody.destroy(), this.debugBody = null) } }), Object.defineProperty(s.Physics.P2.Body.prototype, "collideWorldBounds", { get: function() { return this._collideWorldBounds },
set: function(t) { t && !this._collideWorldBounds ? (this._collideWorldBounds = !0, this.updateCollisionMask()) : !t && this._collideWorldBounds && (this._collideWorldBounds = !1, this.updateCollisionMask()) } }), s.Physics.P2.BodyDebug = function(t, e, i) { s.Group.call(this, t); var n = { pixelsPerLengthUnit: t.physics.p2.mpx(1), debugPolygons: !1, lineWidth: 1, alpha: .5 }; this.settings = s.Utils.extend(n, i), this.ppu = this.settings.pixelsPerLengthUnit, this.ppu = -1 * this.ppu, this.body = e, this.canvas = new s.Graphics(t), this.canvas.alpha = this.settings.alpha, this.add(this.canvas), this.draw(), this.updateSpriteTransform() } , s.Physics.P2.BodyDebug.prototype = Object.create(s.Group.prototype), s.Physics.P2.BodyDebug.prototype.constructor = s.Physics.P2.BodyDebug, s.Utils.extend(s.Physics.P2.BodyDebug.prototype, { updateSpriteTransform: function() { this.position.x = this.body.position[0] * this.ppu, this.position.y = this.body.position[1] * this.ppu, this.rotation = this.body.angle }, draw: function() { var t, e, i, n, s, o, r, a, h, l, c, u, d, p, f; if (a = this.body, l = this.canvas, l.clear(), i = parseInt(this.randomPastelHex(), 16), o = 16711680, r = this.lineWidth, a instanceof p2.Body && a.shapes.length) { var m = a.shapes.length; for (n = 0; n !== m; ) { if (e = a.shapes[n], h = e.position || 0, t = e.angle || 0, e instanceof p2.Circle) this.drawCircle(l, h[0] * this.ppu, h[1] * this.ppu, t, e.radius * this.ppu, i, r); else if (e instanceof p2.Capsule) this.drawCapsule(l, h[0] * this.ppu, h[1] * this.ppu, t, e.length * this.ppu, e.radius * this.ppu, o, i, r); else if (e instanceof p2.Plane) this.drawPlane(l, h[0] * this.ppu, -h[1] * this.ppu, i, o, 5 * r, 10 * r, 10 * r, 100 * this.ppu, t); else if (e instanceof p2.Line) this.drawLine(l, e.length * this.ppu, o, r);
else if (e instanceof p2.Box) this.drawRectangle(l, h[0] * this.ppu, h[1] * this.ppu, t, e.width * this.ppu, e.height * this.ppu, o, i, r); else if (e instanceof p2.Convex) { for (u = [], d = p2.vec2.create(), s = p = 0, f = e.vertices.length; 0 f; s = 0 2) return t.moveTo(e[e.length - 1][0], -e[e.length - 1][1]), t.lineTo(e[0][0], -e[0][1]) }, drawPath: function(t, e, i, n, s) { var o, r, a, h, l, c, u, d, p, f, m, g; for (void 0 === s && (s = 1), void 0 === i && (i = 0), t.lineStyle(s, i, 1), "number" == typeof n && t.beginFill(n), r = null, a = null, o = 0; o < e.length; ) f = e[o], m = f[0], g = f[1], m === r && g === a || (0 === o ? t.moveTo(m, g) : (h = r, l = a, c = m, u = g, d = e[(o + 1) % e.length][0], p = e[(o + 1) % e.length][1], 0 !== (c - h) * (p - l) - (d - h) * (u - l) && t.lineTo(m, g)), r = m, a = g), o++; "number" == typeof n && t.endFill(), e.length > 2 && "number" == typeof n && (t.moveTo(e[e.length - 1] [0], e[e.length - 1][1]), t.lineTo(e[0][0], e[0][1])) }, drawPlane: function(t, e, i, n, s, o, r, a, h, l) { var c, u; void 0 === o && (o = 1), void 0 === n && (n = 16777215), t.lineStyle(o, s, 11), t.beginFill(n), t.moveTo(e, -i), c = e + Math.cos(l) * this.game.width, u = i + Math.sin(l) * this.game.height, t.lineTo(c, -u), t.moveTo(e, -i), c = e + Math.cos(l) * -this.game.width, u = i + Math.sin(l) * -this.game.height,
t.lineTo(c, -u) }, drawCapsule: function(t, e, i, n, s, o, r, a, h) { void 0 === h && (h = 1), void 0 === r && (r = 0), t.lineStyle(h, r, 1); var l = Math.cos(n) , c = Math.sin(n); t.beginFill(a, 1), t.drawCircle(-s / 2 * l + e, -s / 2 * c + i, 2 * -o), t.drawCircle(s / 2 * l + e, s / 2 * c + i, 2 * -o), t.endFill(), t.lineStyle(h, r, 0), t.beginFill(a, 1), t.moveTo(-s / 2 * l + o * c + e, -s / 2 * c + o * l + i), t.lineTo(s / 2 * l + o * c + e, s / 2 * c + o * l + i), t.lineTo(s / 2 * l - o * c + e, s / 2 * c - o * l + i), t.lineTo(-s / 2 * l - o * c + e, -s / 2 * c - o * l + i), t.endFill(), t.lineStyle(h, r, 1), t.moveTo(-s / 2 * l + o * c + e, -s / 2 * c + o * l + i), t.lineTo(s / 2 * l + o * c + e, s / 2 * c + o * l + i), t.moveTo(-s / 2 * l - o * c + e, -s / 2 * c - o * l + i), t.lineTo(s / 2 * l - o * c + e, s / 2 * c - o * l + i) }, randomPastelHex: function() { var t, e, i, n; return i = [255, 255, 255], n = Math.floor(256 * Math.random()), e = Math.floor(256 * Math.random()), t = Math.floor(256 * Math.random()), n = Math.floor((n + 3 * i[0]) / 4), e = Math.floor((e + 3 * i[1]) / 4), t = Math.floor((t + 3 * i[2]) / 4), this.rgbToHex(n, e, t) }, rgbToHex: function(t, e, i) { return this.componentToHex(t) + this.componentToHex(e) + this.componentToHex(i) }, componentToHex: function(t) { var e; return e = t.toString(16), 2 === e.length ? e : e + "0" } }), s.Physics.P2.Spring = function(t, e, i, n, s, o, r, a, h, l) { this.game = t.game, this.world = t, void 0 === n && (n = 1), void 0 === s && (s = 100), void 0 === o && (o = 1), n = t.pxm(n); var c = { restLength: n, stiffness: s, damping: o }; void 0 !== r && null !== r && (c.worldAnchorA = [t.pxm(r[0]),
t.pxm(r[1])]), void 0 !== a && null !== a && (c.worldAnchorB = [t.pxm(a[0]), t.pxm(a[1])]), void 0 !== h && null !== h && (c.localAnchorA = [t.pxm(h[0]), t.pxm(h[1])]), void 0 !== l && null !== l && (c.localAnchorB = [t.pxm(l[0]), t.pxm(l[1])]), this.data = new p2.LinearSpring(e,i,c), this.data.parent = this } , s.Physics.P2.Spring.prototype.constructor = s.Physics.P2.Spring, s.Physics.P2.RotationalSpring = function(t, e, i, n, s, o) { this.game = t.game, this.world = t, void 0 === n && (n = null), void 0 === s && (s = 100), void 0 === o && (o = 1), n && (n = t.pxm(n)); var r = { restAngle: n, stiffness: s, damping: o }; this.data = new p2.RotationalSpring(e,i,r), this.data.parent = this } , s.Physics.P2.Spring.prototype.constructor = s.Physics.P2.Spring, s.Physics.P2.Material = function(t) { this.name = t, p2.Material.call(this) } , s.Physics.P2.Material.prototype = Object.create(p2.Material.prototype), s.Physics.P2.Material.prototype.constructor = s.Physics.P2.Material, s.Physics.P2.ContactMaterial = function(t, e, i) { p2.ContactMaterial.call(this, t, e, i) } , s.Physics.P2.ContactMaterial.prototype = Object.create(p2.ContactMaterial.prototype), s.Physics.P2.ContactMaterial.prototype.constructor = s.Physics.P2.ContactMaterial, s.Physics.P2.CollisionGroup = function(t) { this.mask = t } , s.Physics.P2.DistanceConstraint = function(t, e, i, n, s, o, r) { void 0 === n && (n = 100), void 0 === s && (s = [0, 0]), void 0 === o && (o = [0, 0]), void 0 === r && (r = Number.MAX_VALUE), this.game = t.game, this.world = t, n = t.pxm(n), s = [t.pxmi(s[0]), t.pxmi(s[1])], o = [t.pxmi(o[0]), t.pxmi(o[1])]; var a = {
distance: n, localAnchorA: s, localAnchorB: o, maxForce: r }; p2.DistanceConstraint.call(this, e, i, a) } , s.Physics.P2.DistanceConstraint.prototype = Object.create(p2.DistanceConstraint.prototype), s.Physics.P2.DistanceConstraint.prototype.constructor = s.Physics.P2.DistanceConstraint, s.Physics.P2.GearConstraint = function(t, e, i, n, s) { void 0 === n && (n = 0), void 0 === s && (s = 1), this.game = t.game, this.world = t; var o = { angle: n, ratio: s }; p2.GearConstraint.call(this, e, i, o) } , s.Physics.P2.GearConstraint.prototype = Object.create(p2.GearConstraint.prototype), s.Physics.P2.GearConstraint.prototype.constructor = s.Physics.P2.GearConstraint, s.Physics.P2.LockConstraint = function(t, e, i, n, s, o) { void 0 === n && (n = [0, 0]), void 0 === s && (s = 0), void 0 === o && (o = Number.MAX_VALUE), this.game = t.game, this.world = t, n = [t.pxm(n[0]), t.pxm(n[1])]; var r = { localOffsetB: n, localAngleB: s, maxForce: o }; p2.LockConstraint.call(this, e, i, r) } , s.Physics.P2.LockConstraint.prototype = Object.create(p2.LockConstraint.prototype), s.Physics.P2.LockConstraint.prototype.constructor = s.Physics.P2.LockConstraint, s.Physics.P2.PrismaticConstraint = function(t, e, i, n, s, o, r, a) { void 0 === n && (n = !0), void 0 === s && (s = [0, 0]), void 0 === o && (o = [0, 0]), void 0 === r && (r = [0, 0]), void 0 === a && (a = Number.MAX_VALUE), this.game = t.game, this.world = t, s = [t.pxmi(s[0]), t.pxmi(s[1])], o = [t.pxmi(o[0]), t.pxmi(o[1])]; var h = { localAnchorA: s,
localAnchorB: o, localAxisA: r, maxForce: a, disableRotationalLock: !n }; p2.PrismaticConstraint.call(this, e, i, h) } , s.Physics.P2.PrismaticConstraint.prototype = Object.create(p2.PrismaticConstraint.prototype), s.Physics.P2.PrismaticConstraint.prototype.constructor = s.Physics.P2.PrismaticConstraint, s.Physics.P2.RevoluteConstraint = function(t, e, i, n, s, o, r) { void 0 === o && (o = Number.MAX_VALUE), void 0 === r && (r = null), this.game = t.game, this.world = t, i = [t.pxmi(i[0]), t.pxmi(i[1])], s = [t.pxmi(s[0]), t.pxmi(s[1])], r && (r = [t.pxmi(r[0]), t.pxmi(r[1])]); var a = { worldPivot: r, localPivotA: i, localPivotB: s, maxForce: o }; p2.RevoluteConstraint.call(this, e, n, a) } , s.Physics.P2.RevoluteConstraint.prototype = Object.create(p2.RevoluteConstraint.prototype), s.Physics.P2.RevoluteConstraint.prototype.constructor = s.Physics.P2.RevoluteConstraint, s.ImageCollection = function(t, e, i, n, s, o, r) { (void 0 === i || i this.right || e > this.bottom) }, intersects: function(t, e, i, n) { return !(i = this.worldY + this.height))) }, setCollisionCallback: function(t, e) { this.collisionCallback = t, this.collisionCallbackContext = e }, destroy: function() { this.collisionCallback = null, this.collisionCallbackContext = null, this.properties = null }, setCollision: function(t, e, i, n) { this.collideLeft = t, this.collideRight = e, this.collideUp = i, this.collideDown = n, this.faceLeft = t, this.faceRight = e, this.faceTop = i, this.faceBottom = n },
resetCollision: function() { this.collideLeft = !1, this.collideRight = !1, this.collideUp = !1, this.collideDown = !1, this.faceTop = !1, this.faceBottom = !1, this.faceLeft = !1, this.faceRight = !1 }, isInteresting: function(t, e) { return t && e ? this.collideLeft || this.collideRight || this.collideUp || this.collideDown || this.faceTop || this.faceBottom || this.faceLeft || this.faceRight || this.collisionCallback : t ? this.collideLeft || this.collideRight || this.collideUp || this.collideDown : !!e && (this.faceTop || this.faceBottom || this.faceLeft || this.faceRight) }, copy: function(t) { this.index = t.index, this.alpha = t.alpha, this.properties = t.properties, this.collideUp = t.collideUp, this.collideDown = t.collideDown, this.collideLeft = t.collideLeft, this.collideRight = t.collideRight, this.collisionCallback = t.collisionCallback, this.collisionCallbackContext = t.collisionCallbackContext } }, s.Tile.prototype.constructor = s.Tile, Object.defineProperty(s.Tile.prototype, "collides", { get: function() { return this.collideLeft || this.collideRight || this.collideUp || this.collideDown } }), Object.defineProperty(s.Tile.prototype, "canCollide", { get: function() { return this.collideLeft || this.collideRight || this.collideUp || this.collideDown || this.collisionCallback } }), Object.defineProperty(s.Tile.prototype, "left", { get: function() { return this.worldX } }), Object.defineProperty(s.Tile.prototype, "right", { get: function() { return this.worldX + this.width } }), Object.defineProperty(s.Tile.prototype, "top", { get: function() { return this.worldY } }), Object.defineProperty(s.Tile.prototype, "bottom", { get: function() {
}
return this.worldY + this.height
}), s.Tilemap = function(t, e, i, n, o, r) { this.game = t, this.key = e; var a = s.TilemapParser.parse(this.game, e, i, n, o, r); null !== a && (this.width = a.width, this.height = a.height, this.tileWidth = a.tileWidth, this.tileHeight = a.tileHeight, this.orientation = a.orientation, this.format = a.format, this.version = a.version, this.properties = a.properties, this.widthInPixels = a.widthInPixels, this.heightInPixels = a.heightInPixels, this.layers = a.layers, this.tilesets = a.tilesets, this.imagecollections = a.imagecollections, this.tiles = a.tiles, this.objects = a.objects, this.collideIndexes = [], this.collision = a.collision, this.images = a.images, this.enableDebug = !1, this.currentLayer = 0, this.debugMap = [], this._results = [], this._tempA = 0, this._tempB = 0) } , s.Tilemap.CSV = 0, s.Tilemap.TILED_JSON = 1, s.Tilemap.NORTH = 0, s.Tilemap.EAST = 1, s.Tilemap.SOUTH = 2, s.Tilemap.WEST = 3, s.Tilemap.prototype = { create: function(t, e, i, n, s, o) { return void 0 === o && (o = this.game.world), this.width = e, this.height = i, this.setTileSize(n, s), this.layers.length = 0, this.createBlankLayer(t, e, i, n, s, o) }, setTileSize: function(t, e) { this.tileWidth = t, this.tileHeight = e, this.widthInPixels = this.width * t, this.heightInPixels = this.height * e }, addTilesetImage: function(t, e, i, n, o, r, a) { if (void 0 === t) return null; void 0 === i && (i = this.tileWidth), void 0 === n && (n = this.tileHeight),
void 0 === o && (o = 0), void 0 === r && (r = 0), void 0 === a && (a = 0), 0 === i && (i = 32), 0 === n && (n = 32); var h = null; if (void 0 !== e && null !== e || (e = t), e instanceof s.BitmapData) h = e.canvas; else { if (!this.game.cache.checkImageKey(e)) return console.warn('Phaser.Tilemap.addTilesetImage: Invalid image key given: "' + e + '"'), null; h = this.game.cache.getImage(e) } var l = this.getTilesetIndex(t); if (null === l && this.format === s.Tilemap.TILED_JSON) return console.warn('Phaser.Tilemap.addTilesetImage: No data found in the JSON matching the tileset name: "' + t + '"'), null; if (this.tilesets[l]) return this.tilesets[l].setImage(h), this.tilesets[l]; var c = new s.Tileset(t,a,i,n,o,r,{}); c.setImage(h), this.tilesets.push(c); for (var u = this.tilesets.length - 1, d = o, p = o, f = 0, m = 0, g = 0, y = a; y < a + c.total && (this.tiles[y] = [d, p, u], d += i + r, ++f !== c.total) && (++m !== c.columns || (d = o, p += n + r, m = 0, ++g !== c.rows)); y++) ; return c }, createFromObjects: function(t, e, i, n, o, r, a, h, l) { if (void 0 === o && (o = !0), void 0 === r && (r = !1), void 0 === a && (a = this.game.world), void 0 === h && (h = s.Sprite), void 0 === l && (l = !0), !this.objects[t]) return void console.warn("Tilemap.createFromObjects: Invalid objectgroup name given: " + t); for (var c = 0; c < this.objects[t].length; c++) { var u = !1 , d = this.objects[t][c]; if (void 0 !== d.gid && "number" == typeof e && d.gid === e ? u = !0 : void 0 !== d.id && "number" == typeof e && d.id === e ? u = !0 : void 0 !== d.name && "string" == typeof e && d.name === e && (u = !0), u) { var p = new h(this.game,parseFloat(d.x, 10),parseFloat(d.y, 10),i,n); p.name = d.name, p.visible = d.visible, p.autoCull = r, p.exists = o,
}
d.width && (p.width = d.width), d.height && (p.height = d.height), d.rotation && (p.angle = d.rotation), l && (p.y -= p.height), a.add(p); for (var f in d.properties) a.set(p, f, d.properties[f], !1, !1, 0, !0)
}
[e]),
}, createFromTiles: function(t, e, i, n, o, r) { "number" == typeof t && (t = [t]), void 0 === e || null === e ? e = [] : "number" == typeof e && (e =
n = this.getLayer(n), void 0 === o && (o = this.game.world), void 0 === r && (r = {}), void 0 === r.customClass && (r.customClass = s.Sprite), void 0 === r.adjustY && (r.adjustY = !0); var a = this.layers[n].width , h = this.layers[n].height; if (this.copy(0, 0, a, h, n), this._results.length < 2) return 0; for (var l, c = 0, u = 1, d = this._results.length; u < d; u++) if (-1 !== t.indexOf(this._results[u].index)) { l = new r.customClass(this.game,this._results[u].worldX,this._results[u].worldY,i); for (var p in r) l[p] = r[p]; o.add(l), c++ } if (1 === e.length) for (u = 0; u < t.length; u++) this.replace(t[u], e[0], 0, 0, a, h, n); else if (e.length > 1) for (u = 0; u < t.length; u++) this.replace(t[u], e[u], 0, 0, a, h, n); return c }, createLayer: function(t, e, i, n) { void 0 === e && (e = this.game.width), void 0 === i && (i = this.game.height), void 0 === n && (n = this.game.world); var o = t; if ("string" == typeof t && (o = this.getLayerIndex(t)), null === o || o > this.layers.length) return void console.warn("Tilemap.createLayer: Invalid layer ID given: " + o); void 0 === e || e this.game.width && (e = this.game.width), void 0 === i || i this.game.height && (i = this.game.height), this.enableDebug && (console.group("Tilemap.createLayer"), console.log("Name:", this.layers[o].name), console.log("Size:", e, "x", i), console.log("Tileset:", this.tilesets[0].name, "index:", o)); var r = n.add(new s.TilemapLayer(this.game,this,o,e,i));
return this.enableDebug && console.groupEnd(), r }, createBlankLayer: function(t, e, i, n, o, r) { if (void 0 === r && (r = this.game.world), null !== this.getLayerIndex(t)) return void console.warn("Tilemap.createBlankLayer: Layer with matching name already exists: " + t); for (var a, h = { name: t, x: 0, y: 0, width: e, height: i, widthInPixels: e * n, heightInPixels: i * o, alpha: 1, visible: !0, properties: {}, indexes: [], callbacks: [], bodies: [], data: null }, l = [], c = 0; c < i; c++) { a = []; for (var u = 0; u < e; u++) a.push(new s.Tile(h,-1,u,c,n,o)); l.push(a) } h.data = l, this.layers.push(h), this.currentLayer = this.layers.length - 1; var d = h.widthInPixels , p = h.heightInPixels; d > this.game.width && (d = this.game.width), p > this.game.height && (p = this.game.height); var l = new s.TilemapLayer(this.game,this,this.layers.length 1,d,p); return l.name = t, r.add(l) }, getIndex: function(t, e) { for (var i = 0; i < t.length; i++) if (t[i].name === e) return i; return null }, getLayerIndex: function(t) { return this.getIndex(this.layers, t) }, getTilesetIndex: function(t) { return this.getIndex(this.tilesets, t) }, getImageIndex: function(t) { return this.getIndex(this.images, t) }, setTileIndexCallback: function(t, e, i, n) { if (n = this.getLayer(n), "number" == typeof t)
this.layers[n].callbacks[t] = { callback: e, callbackContext: i }; else
for (var s = 0, o = t.length; s < o; s++) this.layers[n].callbacks[t[s]] = { callback: e, callbackContext: i }
}, setTileLocationCallback: function(t, e, i, n, s, o, r) { if (r = this.getLayer(r), this.copy(t, e, i, n, r), !(this._results.length < 2)) for (var a = 1; a < this._results.length; a++) this._results[a].setCollisionCallback(s, o) }, setCollision: function(t, e, i, n) { if (void 0 === e && (e = !0), void 0 === n && (n = !0), i = this.getLayer(i), "number" == typeof t) return this.setCollisionByIndex(t, e, i, !0); if (Array.isArray(t)) { for (var s = 0; s < t.length; s++) this.setCollisionByIndex(t[s], e, i, !1); n && this.calculateFaces(i) } }, setCollisionBetween: function(t, e, i, n, s) { if (void 0 === i && (i = !0), void 0 === s && (s = !0), n = this.getLayer(n), !(t > e)) { for (var o = t; o -1 && this.collideIndexes.splice(s, 1) } for (var o = 0; o < this.layers[i].height; o++)
a.resetCollision(),
for (var r = 0; r < this.layers[i].width; r++) { var a = this.layers[i].data[o][r]; a && a.index === t && (e ? a.setCollision(!0, !0, !0, !0) : a.faceTop = e, a.faceBottom = e, a.faceLeft = e, a.faceRight = e)
} return n && this.calculateFaces(i), i
}, getLayer: function(t) { return void 0 === t ? t = this.currentLayer : "string" == typeof t ? t = this.getLayerIndex(t) : t instanceof s.TilemapLayer && (t = t.index), t }, setPreventRecalculate: function(t) { if (!0 === t && !0 !== this.preventingRecalculate && (this.preventingRecalculate = !0, this.needToRecalculate = {}), !1 === t && !0 === this.preventingRecalculate) { this.preventingRecalculate = !1; for (var e in this.needToRecalculate) this.calculateFaces(e); this.needToRecalculate = !1 } }, calculateFaces: function(t) { if (this.preventingRecalculate) return void (this.needToRecalculate[t] = !0); for (var e = null, i = null, n = null, s = null, o = 0, r = this.layers[t].height; o < r; o++) for (var a = 0, h = this.layers[t].width; a < h; a++) { var l = this.layers[t].data[o][a]; l && (e = this.getTileAbove(t, a, o), i = this.getTileBelow(t, a, o), n = this.getTileLeft(t, a, o), s = this.getTileRight(t, a, o), l.collides && (l.faceTop = !0, l.faceBottom = !0, l.faceLeft = !0, l.faceRight = !0), e && e.collides && (l.faceTop = !1), i && i.collides && (l.faceBottom = !1), n && n.collides && (l.faceLeft = !1), s && s.collides && (l.faceRight = !1)) } }, getTileAbove: function(t, e, i) { return i > 0 ? this.layers[t].data[i - 1][e] : null }, getTileBelow: function(t, e, i) { return i < this.layers[t].height - 1 ? this.layers[t].data[i + 1] [e] : null }, getTileLeft: function(t, e, i) { return e > 0 ? this.layers[t].data[i][e - 1] : null },
getTileRight: function(t, e, i) { return e < this.layers[t].width - 1 ? this.layers[t].data[i][e + 1] : null
}, setLayer: function(t) { t = this.getLayer(t), this.layers[t] && (this.currentLayer = t) }, hasTile: function(t, e, i) { return i = this.getLayer(i), void 0 !== this.layers[i].data[e] && void 0 !== this.layers[i].data[e][t] && this.layers[i].data[e][t].index > -1 }, removeTile: function(t, e, i) { if (i = this.getLayer(i), t >= 0 && t < this.layers[i].width && e >= 0 && e < this.layers[i].height && this.hasTile(t, e, i)) { var n = this.layers[i].data[e][t]; return this.layers[i].data[e][t] = new s.Tile(this.layers[i],1,t,e,this.tileWidth,this.tileHeight), this.layers[i].dirty = !0, this.calculateFaces(i), n } }, removeTileWorldXY: function(t, e, i, n, s) { return s = this.getLayer(s), t = this.game.math.snapToFloor(t, i) / i, e = this.game.math.snapToFloor(e, n) / n, this.removeTile(t, e, s) }, putTile: function(t, e, i, n) { if (null === t) return this.removeTile(e, i, n); if (n = this.getLayer(n), e >= 0 && e < this.layers[n].width && i >= 0 && i < this.layers[n].height) { var o; return t instanceof s.Tile ? (o = t.index, this.hasTile(e, i, n) ? this.layers[n].data[i][e].copy(t) : this.layers[n].data[i][e] = new s.Tile(n,o,e,i,t.width,t.height)) : (o = t, this.hasTile(e, i, n) ? this.layers[n].data[i][e].index = o : this.layers[n].data[i][e] = new s.Tile(this.layers[n],o,e,i,this.tileWidth,this.tileHeight)), this.collideIndexes.indexOf(o) > -1 ? this.layers[n].data[i] [e].setCollision(!0, !0, !0, !0) : this.layers[n].data[i][e].resetCollision(), this.layers[n].dirty = !0, this.calculateFaces(n), this.layers[n].data[i][e] } return null }, putTileWorldXY: function(t, e, i, n, s, o) { return o = this.getLayer(o), e = this.game.math.snapToFloor(e, n) / n, i = this.game.math.snapToFloor(i, s) / s, this.putTile(t, e, i, o) }, searchTileIndex: function(t, e, i, n) {
void 0 === e && (e = 0), void 0 === i && (i = !1), n = this.getLayer(n); var s = 0; if (i) { for (var o = this.layers[n].height - 1; o >= 0; o--) for (var r = this.layers[n].width - 1; r >= 0; r--) if (this.layers[n].data[o][r].index === t) { if (s === e) return this.layers[n].data[o][r]; s++ } } else for (var o = 0; o < this.layers[n].height; o++) for (var r = 0; r < this.layers[n].width; r++) if (this.layers[n].data[o][r].index === t) { if (s === e) return this.layers[n].data[o][r]; s++ } return null
}, getTile: function(t, e, i, n) { return void 0 === n && (n = !1), i = this.getLayer(i), t >= 0 && t < this.layers[i].width && e >= 0 && e < this.layers[i].height ? -1 === this.layers[i].data[e][t].index ? n ? this.layers[i].data[e][t] : null : this.layers[i].data[e][t] : null }, getTileWorldXY: function(t, e, i, n, s, o) { return void 0 === i && (i = this.tileWidth), void 0 === n && (n = this.tileHeight), s = this.getLayer(s), t = this.game.math.snapToFloor(t, i) / i, e = this.game.math.snapToFloor(e, n) / n, this.getTile(t, e, s, o) }, copy: function(t, e, i, n, s) { if (s = this.getLayer(s), !this.layers[s]) return void (this._results.length = 0); void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = this.layers[s].width), void 0 === n && (n = this.layers[s].height), t < 0 && (t = 0), e < 0 && (e = 0), i > this.layers[s].width && (i = this.layers[s].width), n > this.layers[s].height && (n = this.layers[s].height), this._results.length = 0, this._results.push({ x: t, y: e, width: i, height: n, layer: s }); for (var o = e; o < e + n; o++) for (var r = t; r < t + i; r++)
this._results.push(this.layers[s].data[o][r]); return this._results
r++)
}, paste: function(t, e, i, n) { if (void 0 === t && (t = 0), void 0 === e && (e = 0), n = this.getLayer(n), i && !(i.length < 2)) { for (var s = t - i[1].x, o = e - i[1].y, r = 1; r < i.length; this.layers[n].data[o + i[r].y][s + i[r].x].copy(i[r]); this.layers[n].dirty = !0, this.calculateFaces(n)
} }, swap: function(t, e, i, n, s, o, r) { r = this.getLayer(r), this.copy(i, n, s, o, r), this._results.length < 2 || (this._tempA = t, this._tempB = e, this._results.forEach(this.swapHandler, this), this.paste(i, n, this._results, r)) }, swapHandler: function(t) { t.index === this._tempA ? t.index = this._tempB : t.index === this._tempB && (t.index = this._tempA) }, forEach: function(t, e, i, n, s, o, r) { r = this.getLayer(r), this.copy(i, n, s, o, r), this._results.length < 2 || (this._results.forEach(t, e), this.paste(i, n, this._results, r)) }, replace: function(t, e, i, n, s, o, r) { if (r = this.getLayer(r), this.copy(i, n, s, o, r), !(this._results.length < 2)) { for (var a = 1; a < this._results.length; a++) this._results[a].index === t && (this._results[a].index = e); this.paste(i, n, this._results, r) } }, random: function(t, e, i, n, s) { if (s = this.getLayer(s), this.copy(t, e, i, n, s), !(this._results.length < 2)) { for (var o = [], r = 1; r < this._results.length; r++) if (this._results[r].index) { var a = this._results[r].index; -1 === o.indexOf(a) && o.push(a) } for (var h = 1; h < this._results.length; h++) this._results[h].index = this.game.rnd.pick(o); this.paste(t, e, this._results, s) } }, shuffle: function(t, e, i, n, o) { if (o = this.getLayer(o),
this.copy(t, e, i, n, o), !(this._results.length < 2)) { for (var r = [], a = 1; a < this._results.length; a++) this._results[a].index && r.push(this._results[a].index); s.ArrayUtils.shuffle(r); for (var h = 1; h < this._results.length; h++) this._results[h].index = r[h - 1]; this.paste(t, e, this._results, o) }
}, fill: function(t, e, i, n, s, o) { if (o = this.getLayer(o), this.copy(e, i, n, s, o), !(this._results.length < 2)) { for (var r = 1; r < this._results.length; r++) this._results[r].index = t; this.paste(e, i, this._results, o) } }, removeAllLayers: function() { this.layers.length = 0, this.currentLayer = 0 }, dump: function() { for (var t = "", e = [""], i = 0; i < this.layers[this.currentLayer].height; i++) { for (var n = 0; n < this.layers[this.currentLayer].width; n++) t += "%c ", this.layers[this.currentLayer].data[i][n] > 1 ? this.debugMap[this.layers[this.currentLayer].data[i][n]] ? e.push("background: " + this.debugMap[this.layers[this.currentLayer].data[i][n]]) : e.push("background: #ffffff") : e.push("background: rgb(0, 0, 0)"); t += "\n" } e[0] = t, console.log.apply(console, e) }, destroy: function() { this.removeAllLayers(), this.data = [], this.game = null } }, s.Tilemap.prototype.constructor = s.Tilemap, Object.defineProperty(s.Tilemap.prototype, "layer", { get: function() { return this.layers[this.currentLayer] }, set: function(t) { t !== this.currentLayer && this.setLayer(t) } }), s.TilemapLayer = function(t, e, i, n, o) { n |= 0, o |= 0, s.Sprite.call(this, t, 0, 0), this.map = e, this.index = i, this.layer = e.layers[i],
this.canvas = s.CanvasPool.create(this, n, o), this.context = this.canvas.getContext("2d"), this.setTexture(new PIXI.Texture(new PIXI.BaseTexture(this.canvas,null,this.game.resolution))), this.type = s.TILEMAPLAYER, this.physicsType = s.TILEMAPLAYER, this.renderSettings = { enableScrollDelta: !0, overdrawRatio: .2, copyCanvas: null }, this.debug = !1, this.exists = !0, this.debugSettings = { missingImageFill: "rgb(255,255,255)", debuggedTileOverfill: "rgba(0,255,0,0.4)", forceFullRedraw: !0, debugAlpha: .5, facingEdgeStroke: "rgba(0,255,0,1)", collidingTileOverfill: "rgba(0,255,0,0.2)" }, this.scrollFactorX = 1, this.scrollFactorY = 1, this.dirty = !0, this.rayStepRate = 4, this._wrap = !1, this._mc = { scrollX: 0, scrollY: 0, renderWidth: 0, renderHeight: 0, tileWidth: e.tileWidth, tileHeight: e.tileHeight, cw: e.tileWidth, ch: e.tileHeight, tilesets: [] }, this._scrollX = 0, this._scrollY = 0, this._results = [], t.device.canvasBitBltShift || (this.renderSettings.copyCanvas = s.TilemapLayer.ensureSharedCopyCanvas()), this.fixedToCamera = !0 } , s.TilemapLayer.prototype = Object.create(s.Sprite.prototype), s.TilemapLayer.prototype.constructor = s.TilemapLayer, s.TilemapLayer.prototype.preUpdateCore = s.Component.Core.preUpdate, s.TilemapLayer.sharedCopyCanvas = null, s.TilemapLayer.ensureSharedCopyCanvas = function() { return this.sharedCopyCanvas || (this.sharedCopyCanvas = s.CanvasPool.create(this, 2, 2)), this.sharedCopyCanvas } , s.TilemapLayer.prototype.preUpdate = function() { return this.preUpdateCore() } ,
s.TilemapLayer.prototype.postUpdate = function() { this.fixedToCamera && (this.position.x = (this.game.camera.view.x this.cameraOffset.x) / this.game.camera.scale.x, this.position.y = (this.game.camera.view.y + this.cameraOffset.y) this.game.camera.scale.y), this._scrollX = this.game.camera.view.x * this.scrollFactorX / this.scale.x, this._scrollY = this.game.camera.view.y * this.scrollFactorY / this.scale.y } , s.TilemapLayer.prototype._renderCanvas = function(t) { this.fixedToCamera && (this.position.x = (this.game.camera.view.x this.cameraOffset.x) / this.game.camera.scale.x, this.position.y = (this.game.camera.view.y + this.cameraOffset.y) this.game.camera.scale.y), this._scrollX = this.game.camera.view.x * this.scrollFactorX / this.scale.x, this._scrollY = this.game.camera.view.y * this.scrollFactorY / this.scale.y, this.render(), PIXI.Sprite.prototype._renderCanvas.call(this, t) } , s.TilemapLayer.prototype._renderWebGL = function(t) { this.fixedToCamera && (this.position.x = (this.game.camera.view.x this.cameraOffset.x) / this.game.camera.scale.x, this.position.y = (this.game.camera.view.y + this.cameraOffset.y) this.game.camera.scale.y), this._scrollX = this.game.camera.view.x * this.scrollFactorX / this.scale.x, this._scrollY = this.game.camera.view.y * this.scrollFactorY / this.scale.y, this.render(), PIXI.Sprite.prototype._renderWebGL.call(this, t) } , s.TilemapLayer.prototype.destroy = function() { s.CanvasPool.remove(this), s.Component.Destroy.prototype.destroy.call(this) } , s.TilemapLayer.prototype.resize = function(t, e) { this.canvas.width = t, this.canvas.height = e, this.texture.frame.resize(t, e), this.texture.width = t, this.texture.height = e, this.texture.crop.width = t, this.texture.crop.height = e, this.texture.baseTexture.width = t, this.texture.baseTexture.height = e, this.texture.baseTexture.dirty(), this.texture.requiresUpdate = !0, this.texture._updateUvs(), this.dirty = !0 } , s.TilemapLayer.prototype.resizeWorld = function() {
+ /
+ /
+ /
this.game.world.setBounds(0, 0, this.layer.widthInPixels * this.scale.x, this.layer.heightInPixels * this.scale.y) } , s.TilemapLayer.prototype._fixX = function(t) { return 1 === this.scrollFactorX || 0 === this.scrollFactorX && 0 === this.position.x ? t : 0 === this.scrollFactorX && 0 !== this.position.x ? t this.position.x : this._scrollX + (t - this._scrollX / this.scrollFactorX) } , s.TilemapLayer.prototype._unfixX = function(t) { return 1 === this.scrollFactorX ? t : this._scrollX / this.scrollFactorX + (t - this._scrollX) } , s.TilemapLayer.prototype._fixY = function(t) { return 1 === this.scrollFactorY || 0 === this.scrollFactorY && 0 === this.position.y ? t : 0 === this.scrollFactorY && 0 !== this.position.y ? t this.position.y : this._scrollY + (t - this._scrollY / this.scrollFactorY) } , s.TilemapLayer.prototype._unfixY = function(t) { return 1 === this.scrollFactorY ? t : this._scrollY / this.scrollFactorY + (t - this._scrollY) } , s.TilemapLayer.prototype.getTileX = function(t) { return Math.floor(this._fixX(t) / this._mc.tileWidth) } , s.TilemapLayer.prototype.getTileY = function(t) { return Math.floor(this._fixY(t) / this._mc.tileHeight) } , s.TilemapLayer.prototype.getTileXY = function(t, e, i) { return i.x = this.getTileX(t), i.y = this.getTileY(e), i } , s.TilemapLayer.prototype.getRayCastTiles = function(t, e, i, n) { e || (e = this.rayStepRate), void 0 === i && (i = !1), void 0 === n && (n = !1); var s = this.getTiles(t.x, t.y, t.width, t.height, i, n); if (0 === s.length) return []; for (var o = t.coordinatesOnLine(e), r = [], a = 0; a < s.length; a++) for (var h = 0; h < o.length; h++) { var l = s[a] , c = o[h]; if (l.containsPoint(c[0], c[1])) { r.push(l); break } } return r } ,
s.TilemapLayer.prototype.getTiles = function(t, e, i, n, s, o) { void 0 === s && (s = !1), void 0 === o && (o = !1); var r = !(s || o); t = this._fixX(t), e = this._fixY(e); for (var a = Math.floor(t / (this._mc.cw * this.scale.x)), h = Math.floor(e / (this._mc.ch * this.scale.y)), l = Math.ceil((t + i) / (this._mc.cw * this.scale.x)) - a, c = Math.ceil((e + n) / (this._mc.ch * this.scale.y)) - h; this._results.length; ) this._results.pop(); for (var u = h; u < h + c; u++) for (var d = a; d < a + l; d++) { var p = this.layer.data[u]; p && p[d] && (r || p[d].isInteresting(s, o)) && this._results.push(p[d]) } return this._results.slice() } , s.TilemapLayer.prototype.resolveTileset = function(t) { var e = this._mc.tilesets; if (t < 2e3) for (; e.length < t; ) e.push(void 0); var i = this.map.tiles[t] && this.map.tiles[t][2]; if (null !== i) { var n = this.map.tilesets[i]; if (n && n.containsTileIndex(t)) return e[t] = n } return e[t] = null } , s.TilemapLayer.prototype.resetTilesetCache = function() { for (var t = this._mc.tilesets; t.length; ) t.pop() } , s.TilemapLayer.prototype.setScale = function(t, e) { t = t || 1, e = e || t; for (var i = 0; i < this.layer.data.length; i++) for (var n = this.layer.data[i], s = 0; s < n.length; s++) { var o = n[s]; o.width = this.map.tileWidth * t, o.height = this.map.tileHeight * e, o.worldX = o.x * o.width, o.worldY = o.y * o.height } this.scale.setTo(t, e) } , s.TilemapLayer.prototype.shiftCanvas = function(t, e, i) { var n = t.canvas , s = n.width - Math.abs(e) , o = n.height - Math.abs(i) , r = 0 , a = 0
, h = e , l = i; e < 0 && (r = -e, h = 0), i < 0 && (a = -i, l = 0); var c = this.renderSettings.copyCanvas; if (c) { (c.width < s || c.height < o) && (c.width = s, c.height = o); var u = c.getContext("2d"); u.clearRect(0, 0, s, o), u.drawImage(n, r, a, s, o, 0, 0, s, o), t.clearRect(h, l, s, o), t.drawImage(c, 0, 0, s, o, h, l, s, o) } else t.save(), t.globalCompositeOperation = "copy", t.drawImage(n, r, a, s, o, h, l, s, o), t.restore() } , s.TilemapLayer.prototype.renderRegion = function(t, e, i, n, s, o) { var r = this.context , a = this.layer.width , h = this.layer.height , l = this._mc.tileWidth , c = this._mc.tileHeight , u = this._mc.tilesets , d = NaN; this._wrap || (i = a && (m -= a); var T = P[m]; if (T && !(T.index < 0)) { var C = T.index , S = u[C]; void 0 === S && (S = this.resolveTileset(C)), T.alpha === d || this.debug || (r.globalAlpha = T.alpha, d = T.alpha), S ? T.rotation || T.flipped ? (r.save(), r.translate(p + T.centerX, f + T.centerY), r.rotate(T.rotation),
T.flipped && r.scale(-1, 1), S.draw(r, -T.centerX, -T.centerY, C), r.restore()) : S.draw(r, p, f, C) : this.debugSettings.missingImageFill && (r.fillStyle = this.debugSettings.missingImageFill, r.fillRect(p, f, l, c)), T.debug && this.debugSettings.debuggedTileOverfill && (r.fillStyle = this.debugSettings.debuggedTileOverfill, r.fillRect(p, f, l, c)) } } } } , s.TilemapLayer.prototype.renderDeltaScroll = function(t, e) { var i = this._mc.scrollX , n = this._mc.scrollY , s = this.canvas.width , o = this.canvas.height , r = this._mc.tileWidth , a = this._mc.tileHeight , h = 0 , l = -r , c = 0 , u = -a; if (t < 0 ? (h = s + t, l = s - 1) : t > 0 && (l = t), e < 0 ? (c = o + e, u = o - 1) : e > 0 && (u = e), this.shiftCanvas(this.context, t, e), h = Math.floor((h + i) / r), l = Math.floor((l + i) / r), c = Math.floor((c + n) / a), u = Math.floor((u + n) / a), h = u && (i -= u);
var T = P[i]; !T || T.index < 0 || !T.collides || (this.debugSettings.collidingTileOverfill && (h.fillStyle = this.debugSettings.collidingTileOverfill, h.fillRect(t, e, this._mc.cw, this._mc.ch)), this.debugSettings.facingEdgeStroke && (h.beginPath(), T.faceTop && (h.moveTo(t, e), h.lineTo(t + this._mc.cw, e)), T.faceBottom && (h.moveTo(t, e + this._mc.ch), h.lineTo(t + this._mc.cw, e + this._mc.ch)), T.faceLeft && (h.moveTo(t, e), h.lineTo(t, e + this._mc.ch)), T.faceRight && (h.moveTo(t + this._mc.cw, e), h.lineTo(t + this._mc.cw, e + this._mc.ch)), h.closePath(), h.stroke())) } } } , Object.defineProperty(s.TilemapLayer.prototype, "wrap", { get: function() { return this._wrap }, set: function(t) { this._wrap = t, this.dirty = !0 } }), Object.defineProperty(s.TilemapLayer.prototype, "scrollX", { get: function() { return this._scrollX }, set: function(t) { this._scrollX = t } }), Object.defineProperty(s.TilemapLayer.prototype, "scrollY", { get: function() { return this._scrollY }, set: function(t) { this._scrollY = t } }), Object.defineProperty(s.TilemapLayer.prototype, "collisionWidth", { get: function() { return this._mc.cw }, set: function(t) { this._mc.cw = 0 | t, this.dirty = !0 } }), Object.defineProperty(s.TilemapLayer.prototype, "collisionHeight", { get: function() { return this._mc.ch }, set: function(t) {
this._mc.ch = 0 | t, this.dirty = !0 } }), s.TilemapParser = { INSERT_NULL: !1, parse: function(t, e, i, n, o, r) { if (void 0 === i && (i = 32), void 0 === n && (n = 32), void 0 === o && (o = 10), void 0 === r && (r = 10), void 0 === e) return this.getEmptyData(); if (null === e) return this.getEmptyData(i, n, o, r); var a = t.cache.getTilemapData(e); if (a) { if (a.format === s.Tilemap.CSV) return this.parseCSV(e, a.data, i, n); if (!a.format || a.format === s.Tilemap.TILED_JSON) return this.parseTiledJSON(a.data) } else console.warn("Phaser.TilemapParser.parse - No map data found for key " + e) }, parseCSV: function(t, e, i, n) { var o = this.getEmptyData(); e = e.trim(); for (var r = [], a = e.split("\n"), h = a.length, l = 0, c = 0; c < a.length; c++) { r[c] = []; for (var u = a[c].split(","), d = 0; d < u.length; d++) r[c][d] = new s.Tile(o.layers[0],parseInt(u[d], 10),d,c,i,n); 0 === l && (l = u.length) } return o.format = s.Tilemap.CSV, o.name = t, o.width = l, o.height = h, o.tileWidth = i, o.tileHeight = n, o.widthInPixels = l * i, o.heightInPixels = h * n, o.layers[0].width = l, o.layers[0].height = h, o.layers[0].widthInPixels = o.widthInPixels, o.layers[0].heightInPixels = o.heightInPixels, o.layers[0].data = r, o }, getEmptyData: function(t, e, i, n) { return { width: void 0 !== i && null !== i ? i : 0, height: void 0 !== n && null !== n ? n : 0, tileWidth: void 0 !== t && null !== t ? t : 0, tileHeight: void 0 !== e && null !== e ? e : 0, orientation: "orthogonal", version: "1",
properties: {}, widthInPixels: 0, heightInPixels: 0, layers: [{ name: "layer", x: 0, y: 0, width: 0, height: 0, widthInPixels: 0, heightInPixels: 0, alpha: 1, visible: !0, properties: {}, indexes: [], callbacks: [], bodies: [], data: [] }], images: [], objects: {}, collision: {}, tilesets: [], tiles: [] } }, parseTiledJSON: function(t) { function e(t, e) { var i = {}; for (var n in e) { var s = e[n]; void 0 !== t[s] && (i[s] = t[s]) } return i } if ("orthogonal" !== t.orientation) return console.warn("TilemapParser.parseTiledJSON - Only orthogonal map types are supported in this version of Phaser"), null; for (var i = { width: t.width, height: t.height, tileWidth: t.tilewidth, tileHeight: t.tileheight, orientation: t.orientation, format: s.Tilemap.TILED_JSON, version: t.version, properties: t.properties, widthInPixels: t.width * t.tilewidth, heightInPixels: t.height * t.tileheight }, n = [], o = 0; o < t.layers.length; o++) if ("tilelayer" === t.layers[o].type) { var r = t.layers[o]; if (!r.compression && r.encoding && "base64" === r.encoding) { for (var a = window.atob(r.data), h = a.length, l = new Array(h), c = 0; c < h; c += 4) l[c / 4] = (a.charCodeAt(c) | a.charCodeAt(c + 1) 0;
r.data = l, delete r.encoding } else if (r.compression) { console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '" + r.name + "'"); continue } var u = { name: r.name, x: r.x, y: r.y, width: r.width, height: r.height, widthInPixels: r.width * t.tilewidth, heightInPixels: r.height * t.tileheight, alpha: r.opacity, visible: r.visible, properties: {}, indexes: [], callbacks: [], bodies: [] }; r.properties && (u.properties = r.properties); for (var d, p, f, m, g = 0, y = [], v = [], b = 0, h = r.data.length; b < h; b++) { if (d = 0, p = !1, m = r.data[b], f = 0, m > 536870912) switch (m > 2147483648 && (m -= 2147483648, f += 4), m > 1073741824 && (m -= 1073741824, f += 2), m > 536870912 && (m -= 536870912, f += 1), f) { case 5: d = Math.PI / 2; break; case 6: d = Math.PI; break; case 3: d = 3 * Math.PI / 2; break; case 4: d = 0, p = !0; break; case 7: d = Math.PI / 2, p = !0; break; case 2: d = Math.PI, p = !0; break; case 1:
d = 3 * Math.PI / 2, p = !0 } if (m > 0) { var w = new s.Tile(u,m,g,v.length,t.tilewidth,t.tileheight); w.rotation = d, w.flipped = p, 0 !== f && (w.flippedVal = f), y.push(w) } else s.TilemapParser.INSERT_NULL ? y.push(null) : y.push(new s.Tile(u,-1,g,v.length,t.tilewidth,t.tileheight)); g++, g === r.width && (v.push(y), g = 0, y = []) } u.data = v, n.push(u) } i.layers = n; for (var x = [], o = 0; o < t.layers.length; o++) if ("imagelayer" === t.layers[o].type) { var _ = t.layers[o] , P = { name: _.name, image: _.image, x: _.x, y: _.y, alpha: _.opacity, visible: _.visible, properties: {} }; _.properties && (P.properties = _.properties), x.push(P) } i.images = x; for (var T = [], C = [], S = null, o = 0; o < t.tilesets.length; o+ +) { var A = t.tilesets[o]; if (A.image) { var k = new s.Tileset(A.name,A.firstgid,A.tilewidth,A.tileheight,A.margin,A.spacing,A.propertie s); A.tileproperties && (k.tileProperties = A.tileproperties), k.updateTileData(A.imagewidth, A.imageheight), T.push(k) } else { var E = new s.ImageCollection(A.name,A.firstgid,A.tilewidth,A.tileheight,A.margin,A.spacing,A.p roperties); for (var I in A.tiles) { var P = A.tiles[I].image , m = A.firstgid + parseInt(I, 10); E.addImage(m, P) } C.push(E) }
S && (S.lastgid = A.firstgid - 1), S = A } i.tilesets = T, i.imagecollections = C; for (var M = {}, O = {}, o = 0; o < t.layers.length; o++) if ("objectgroup" === t.layers[o].type) { var B = t.layers[o]; M[B.name] = [], O[B.name] = []; for (var R = 0, h = B.objects.length; R < h; R++) if (B.objects[R].gid) { var L = { gid: B.objects[R].gid, name: B.objects[R].name, type: B.objects[R].hasOwnProperty("type") ? B.objects[R].type : "", x: B.objects[R].x, y: B.objects[R].y, visible: B.objects[R].visible, properties: B.objects[R].properties }; B.objects[R].rotation && (L.rotation = B.objects[R].rotation), M[B.name].push(L) } else if (B.objects[R].polyline) { var L = { name: B.objects[R].name, type: B.objects[R].type, x: B.objects[R].x, y: B.objects[R].y, width: B.objects[R].width, height: B.objects[R].height, visible: B.objects[R].visible, properties: B.objects[R].properties }; B.objects[R].rotation && (L.rotation = B.objects[R].rotation), L.polyline = []; for (var D = 0; D < B.objects[R].polyline.length; D++) L.polyline.push([B.objects[R].polyline[D].x, B.objects[R].polyline[D].y]); O[B.name].push(L), M[B.name].push(L) } else if (B.objects[R].polygon) { var L = e(B.objects[R], ["name", "type", "x", "y", "visible", "rotation", "properties"]); L.polygon = []; for (var D = 0; D < B.objects[R].polygon.length; D+ +) L.polygon.push([B.objects[R].polygon[D].x, B.objects[R].polygon[D].y]); M[B.name].push(L) } else if (B.objects[R].ellipse) { var L = e(B.objects[R], ["name", "type", "ellipse", "x", "y", "width", "height", "visible", "rotation", "properties"]); M[B.name].push(L) } else {
var L = e(B.objects[R], ["name", "type", "x", "y", "width", "height", "visible", "rotation", "properties"]); L.rectangle = !0, M[B.name].push(L) } } i.objects = M, i.collision = O, i.tiles = []; for (var o = 0; o < i.tilesets.length; o++) for (var A = i.tilesets[o], g = A.tileMargin, F = A.tileMargin, N = 0, G = 0, U = 0, b = A.firstgid; b < A.firstgid + A.total && (i.tiles[b] = [g, F, o], g += A.tileWidth + A.tileSpacing, ++N !== A.total) && (++G !== A.columns || (g = A.tileMargin, F += A.tileHeight + A.tileSpacing, G = 0, ++U !== A.rows)); b++) ; for (var u, w, W, A, o = 0; o < i.layers.length; o++) { u = i.layers[o], A = null; for (var c = 0; c < u.data.length; c++) { y = u.data[c]; for (var j = 0; j < y.length; j++) null === (w = y[j]) || w.index < 0 || (W = i.tiles[w.index][2], A = i.tilesets[W], A.tileProperties && A.tileProperties[w.index A.firstgid] && (w.properties = s.Utils.mixin(A.tileProperties[w.index A.firstgid], w.properties))) } } return i } }, s.Tileset = function(t, e, i, n, s, o, r) { (void 0 === i || i = this._timer) if (this._timer = this.game.time.time + this.frequency * this.game.time.slowMotion, 0 !== this._flowTotal) if (this._flowQuantity > 0) { for (var t = 0; t < this._flowQuantity; t++) if (this.emitParticle() && (this._counter++, -1 !== this._flowTotal && this._counter >= this._flowTotal)) { this.on = !1; break } } else this.emitParticle() && (this._counter++, -1 !== this._flowTotal && this._counter >= this._flowTotal && (this.on = !1)); else this.emitParticle() && (this._counter++,
this._quantity > 0 && this._counter >= this._quantity && (this.on = !1)); for (var t = this.children.length; t--; ) this.children[t].exists && this.children[t].update() } , s.Particles.Arcade.Emitter.prototype.makeParticles = function(t, e, i, n, s) { void 0 === e && (e = 0), void 0 === i && (i = this.maxParticles), void 0 === n && (n = !1), void 0 === s && (s = !1); var o, r = 0, a = t, h = e; for (this._frames = e, i > this.maxParticles && (this.maxParticles = i); r < i; ) Array.isArray(t) && (a = this.game.rnd.pick(t)), Array.isArray(e) && (h = this.game.rnd.pick(e)), o = new this.particleClass(this.game,0,0,a,h), this.game.physics.arcade.enable(o, !1), n ? (o.body.checkCollision.any = !0, o.body.checkCollision.none = !1) : o.body.checkCollision.none = !0, o.body.collideWorldBounds = s, o.body.skipQuadTree = !0, o.exists = !1, o.visible = !1, o.anchor.copyFrom(this.particleAnchor), this.add(o), r++; return this } , s.Particles.Arcade.Emitter.prototype.kill = function() { return this.on = !1, this.alive = !1, this.exists = !1, this } , s.Particles.Arcade.Emitter.prototype.revive = function() { return this.alive = !0, this.exists = !0, this } , s.Particles.Arcade.Emitter.prototype.explode = function(t, e) { return this._flowTotal = 0, this.start(!0, t, 0, e, !1), this } , s.Particles.Arcade.Emitter.prototype.flow = function(t, e, i, n, s) { return void 0 !== e && null !== e || (e = 250), void 0 !== i && 0 !== i || (i = 1), void 0 === n && (n = -1), void 0 === s && (s = !0), i > this.maxParticles && (i = this.maxParticles), this._counter = 0, this._flowQuantity = i, this._flowTotal = n,
s ? (this.start(!0, t, e, i), this._counter += i, this.on = !0, this._timer = this.game.time.time + e * this.game.time.slowMotion) : this.start(!1, t, e, i), this } , s.Particles.Arcade.Emitter.prototype.start = function(t, e, i, n, s) { if (void 0 === t && (t = !0), void 0 === e && (e = 0), void 0 !== i && null !== i || (i = 250), void 0 === n && (n = 0), void 0 === s && (s = !1), n > this.maxParticles && (n = this.maxParticles), this.revive(), this.visible = !0, this.lifespan = e, this.frequency = i, t || s) for (var o = 0; o < n; o++) this.emitParticle(); else this.on = !0, this._quantity = n, this._counter = 0, this._timer = this.game.time.time + i * this.game.time.slowMotion; return this } , s.Particles.Arcade.Emitter.prototype.emitParticle = function(t, e, i, n) { void 0 === t && (t = null), void 0 === e && (e = null); var s = this.getFirstExists(!1); if (null === s) return !1; var o = this.game.rnd; void 0 !== i && void 0 !== n ? s.loadTexture(i, n) : void 0 !== i && s.loadTexture(i); var r = this.emitX , a = this.emitY; null !== t ? r = t : this.width > 1 && (r = o.between(this.left, this.right)), null !== e ? a = e : this.height > 1 && (a = o.between(this.top, this.bottom)), s.reset(r, a), s.angle = 0, s.lifespan = this.lifespan, this.particleBringToTop ? this.bringToTop(s) : this.particleSendToBack && this.sendToBack(s), this.autoScale ? s.setScaleData(this.scaleData) : 1 !== this.minParticleScale || 1 !== this.maxParticleScale ? s.scale.set(o.realInRange(this.minParticleScale, this.maxParticleScale)) : this._minParticleScale.x === this._maxParticleScale.x && this._minParticleScale.y === this._maxParticleScale.y || s.scale.set(o.realInRange(this._minParticleScale.x, this._maxParticleScale.x), o.realInRange(this._minParticleScale.y, this._maxParticleScale.y)), void 0 === n && (Array.isArray(this._frames) ? s.frame = this.game.rnd.pick(this._frames) : s.frame = this._frames),
this.autoAlpha ? s.setAlphaData(this.alphaData) : s.alpha = o.realInRange(this.minParticleAlpha, this.maxParticleAlpha), s.blendMode = this.blendMode; var h = s.body; return h.updateBounds(), h.bounce.copyFrom(this.bounce), h.drag.copyFrom(this.particleDrag), h.velocity.x = o.between(this.minParticleSpeed.x, this.maxParticleSpeed.x), h.velocity.y = o.between(this.minParticleSpeed.y, this.maxParticleSpeed.y), h.angularVelocity = o.between(this.minRotation, this.maxRotation), h.gravity = this.gravity, h.angularDrag = this.angularDrag, s.onEmit(), !0 } , s.Particles.Arcade.Emitter.prototype.destroy = function() { this.game.particles.remove(this), s.Group.prototype.destroy.call(this, !0, !1) } , s.Particles.Arcade.Emitter.prototype.setSize = function(t, e) { return this.area.width = t, this.area.height = e, this } , s.Particles.Arcade.Emitter.prototype.setXSpeed = function(t, e) { return t = t || 0, e = e || 0, this.minParticleSpeed.x = t, this.maxParticleSpeed.x = e, this } , s.Particles.Arcade.Emitter.prototype.setYSpeed = function(t, e) { return t = t || 0, e = e || 0, this.minParticleSpeed.y = t, this.maxParticleSpeed.y = e, this } , s.Particles.Arcade.Emitter.prototype.setRotation = function(t, e) { return t = t || 0, e = e || 0, this.minRotation = t, this.maxRotation = e, this } , s.Particles.Arcade.Emitter.prototype.setAlpha = function(t, e, i, n, o) { if (void 0 === t && (t = 1), void 0 === e && (e = 1), void 0 === i && (i = 0), void 0 === n && (n = s.Easing.Linear.None), void 0 === o && (o = !1),
this.minParticleAlpha = t, this.maxParticleAlpha = e, this.autoAlpha = !1, i > 0 && t !== e) { var r = { v: t } , a = this.game.make.tween(r).to({ v: e }, i, n); a.yoyo(o), this.alphaData = a.generateData(60), this.alphaData.reverse(), this.autoAlpha = !0 } return this
a) {
} , s.Particles.Arcade.Emitter.prototype.setScale = function(t, e, i, n, o, r, if (void 0 === t && (t = 1), void 0 === e && (e = 1), void 0 === i && (i = 1), void 0 === n && (n = 1), void 0 === o && (o = 0), void 0 === r && (r = s.Easing.Linear.None), void 0 === a && (a = !1), this.minParticleScale = 1, this.maxParticleScale = 1, this._minParticleScale.set(t, i), this._maxParticleScale.set(e, n), this.autoScale = !1, o > 0 && (t !== e || i !== n)) { var h = { x: t, y: i } , l = this.game.make.tween(h).to({ x: e, y: n }, o, r); l.yoyo(a), this.scaleData = l.generateData(60), this.scaleData.reverse(), this.autoScale = !0 } return this
} , s.Particles.Arcade.Emitter.prototype.at = function(t) { return t.center ? (this.emitX = t.center.x, this.emitY = t.center.y) : (this.emitX = t.world.x + t.anchor.x * t.width,
this.emitY = t.world.y + t.anchor.y * t.height), this
} , Object.defineProperty(s.Particles.Arcade.Emitter.prototype, "id", { get: function() {
}
return this._id
}), Object.defineProperty(s.Particles.Arcade.Emitter.prototype, get: function() { return this.area.width }, set: function(t) { this.area.width = t } }), Object.defineProperty(s.Particles.Arcade.Emitter.prototype, get: function() { return this.area.height }, set: function(t) { this.area.height = t } }), Object.defineProperty(s.Particles.Arcade.Emitter.prototype, get: function() { return this.emitX }, set: function(t) { this.emitX = t } }), Object.defineProperty(s.Particles.Arcade.Emitter.prototype, get: function() { return this.emitY }, set: function(t) { this.emitY = t } }), Object.defineProperty(s.Particles.Arcade.Emitter.prototype, get: function() { return Math.floor(this.x - this.area.width / 2) } }), Object.defineProperty(s.Particles.Arcade.Emitter.prototype, get: function() { return Math.floor(this.x + this.area.width / 2) } }), Object.defineProperty(s.Particles.Arcade.Emitter.prototype, get: function() { return Math.floor(this.y - this.area.height / 2) } }), Object.defineProperty(s.Particles.Arcade.Emitter.prototype, get: function() { return Math.floor(this.y + this.area.height / 2) } }), s.Weapon = function(t, e) { s.Plugin.call(this, t, e), this.bullets = null, this.autoExpandBulletsGroup = !1,
"width", {
"height", {
"x", {
"y", {
"left", {
"right", {
"top", {
"bottom", {
this.autofire = !1, this.shots = 0, this.fireLimit = 0, this.fireRate = 100, this.fireRateVariance = 0, this.fireFrom = new s.Rectangle(0,0,1,1), this.fireAngle = s.ANGLE_UP, this.bulletInheritSpriteSpeed = !1, this.bulletAnimation = "", this.bulletFrameRandom = !1, this.bulletFrameCycle = !1, this.bulletWorldWrap = !1, this.bulletWorldWrapPadding = 0, this.bulletAngleOffset = 0, this.bulletAngleVariance = 0, this.bulletSpeed = 200, this.bulletSpeedVariance = 0, this.bulletLifespan = 0, this.bulletKillDistance = 0, this.bulletGravity = new s.Point(0,0), this.bulletRotateToVelocity = !1, this.bulletKey = "", this.bulletFrame = "", this._bulletClass = s.Bullet, this._bulletCollideWorldBounds = !1, this._bulletKillType = s.Weapon.KILL_WORLD_BOUNDS, this._data = { customBody: !1, width: 0, height: 0, offsetX: 0, offsetY: 0 }, this.bounds = new s.Rectangle, this.bulletBounds = t.world.bounds, this.bulletFrames = [], this.bulletFrameIndex = 0, this.anims = {}, this.onFire = new s.Signal, this.onKill = new s.Signal, this.onFireLimit = new s.Signal, this.trackedSprite = null, this.trackedPointer = null, this.multiFire = !1, this._hasFired = !1, this.trackRotation = !1, this.trackOffset = new s.Point, this._nextFire = 0, this._tempNextFire = 0, this._rotatedPoint = new s.Point } , s.Weapon.prototype = Object.create(s.Plugin.prototype), s.Weapon.prototype.constructor = s.Weapon, s.Weapon.KILL_NEVER = 0, s.Weapon.KILL_LIFESPAN = 1, s.Weapon.KILL_DISTANCE = 2, s.Weapon.KILL_WEAPON_BOUNDS = 3, s.Weapon.KILL_CAMERA_BOUNDS = 4,
s.Weapon.KILL_WORLD_BOUNDS = 5, s.Weapon.KILL_STATIC_BOUNDS = 6, s.Weapon.prototype.createBullets = function(t, e, i, n) { return void 0 === t && (t = 1), void 0 === n && (n = this.game.world), this.bullets || (this.bullets = this.game.add.physicsGroup(s.Physics.ARCADE, n), this.bullets.classType = this._bulletClass), 0 !== t && (-1 === t && (this.autoExpandBulletsGroup = !0, t = 1), this.bullets.createMultiple(t, e, i), this.bullets.setAll("data.bulletManager", this), this.bulletKey = e, this.bulletFrame = i), this } , s.Weapon.prototype.forEach = function(t, e) { return this.bullets.forEachExists(t, e, arguments), this } , s.Weapon.prototype.pauseAll = function() { return this.bullets.setAll("body.enable", !1), this } , s.Weapon.prototype.resumeAll = function() { return this.bullets.setAll("body.enable", !0), this } , s.Weapon.prototype.killAll = function() { return this.bullets.callAllExists("kill", !0), this.bullets.setAll("body.enable", !0), this } , s.Weapon.prototype.resetShots = function(t) { return this.shots = 0, void 0 !== t && (this.fireLimit = t), this } , s.Weapon.prototype.destroy = function() { this.parent.remove(this, !1), this.bullets.destroy(), this.game = null, this.parent = null, this.active = !1, this.visible = !1 } , s.Weapon.prototype.update = function() { this._bulletKillType === s.Weapon.KILL_WEAPON_BOUNDS && (this.trackedSprite ? (this.trackedSprite.updateTransform(), this.bounds.centerOn(this.trackedSprite.worldPosition.x, this.trackedSprite.worldPosition.y)) : this.trackedPointer && this.bounds.centerOn(this.trackedPointer.worldX, this.trackedPointer.worldY)),
this.autofire && this.fire() } , s.Weapon.prototype.postRender = function() { this.multiFire && this._hasFired && (this._hasFired = !1, this._nextFire = this._tempNextFire) } , s.Weapon.prototype.trackSprite = function(t, e, i, n) { return void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = !1), this.trackedPointer = null, this.trackedSprite = t, this.trackRotation = n, this.trackOffset.set(e, i), this } , s.Weapon.prototype.trackPointer = function(t, e, i) { return void 0 === t && (t = this.game.input.activePointer), void 0 === e && (e = 0), void 0 === i && (i = 0), this.trackedPointer = t, this.trackedSprite = null, this.trackRotation = !1, this.trackOffset.set(e, i), this } , s.Weapon.prototype.fireMany = function(t, e) { this.multiFire = !0; var i = [] , n = this; return e || this.trackedSprite || this.trackedPointer ? t.forEach(function(t) { i.push(n.fire(e, null, null, t.x, t.y)) }) : t.forEach(function(t) { i.push(n.fire(t)) }), i } , s.Weapon.prototype.fireOffset = function(t, e) { return void 0 === t && (t = 0), void 0 === e && (e = 0), this.fire(null, null, null, t, e) } , s.Weapon.prototype.fire = function(t, e, i, n, o) { if (void 0 === e && (e = null), void 0 === i && (i = null), this.game.time.now < this._nextFire || this.fireLimit > 0 && this.shots === this.fireLimit) return null; var r = this.bulletSpeed; 0 !== this.bulletSpeedVariance && (r += s.Math.between(this.bulletSpeedVariance, this.bulletSpeedVariance)), t ? this.fireFrom.width > 1 ? this.fireFrom.centerOn(t.x, t.y) :
(this.fireFrom.x = t.x, this.fireFrom.y = t.y) : this.trackedSprite ? (this.trackRotation ? (this._rotatedPoint.set(this.trackedSprite.world.x + this.trackOffset.x, this.trackedSprite.world.y + this.trackOffset.y), this._rotatedPoint.rotate(this.trackedSprite.world.x, this.trackedSprite.world.y, this.trackedSprite.rotation), this.fireFrom.width > 1 ? this.fireFrom.centerOn(this._rotatedPoint.x, this._rotatedPoint.y) : (this.fireFrom.x = this._rotatedPoint.x, this.fireFrom.y = this._rotatedPoint.y)) : this.fireFrom.width > 1 ? this.fireFrom.centerOn(this.trackedSprite.world.x + this.trackOffset.x, this.trackedSprite.world.y + this.trackOffset.y) : (this.fireFrom.x = this.trackedSprite.world.x + this.trackOffset.x, this.fireFrom.y = this.trackedSprite.world.y + this.trackOffset.y), this.bulletInheritSpriteSpeed && (r += this.trackedSprite.body.speed)) : this.trackedPointer && (this.fireFrom.width > 1 ? this.fireFrom.centerOn(this.trackedPointer.world.x + this.trackOffset.x, this.trackedPointer.world.y + this.trackOffset.y) : (this.fireFrom.x = this.trackedPointer.world.x + this.trackOffset.x, this.fireFrom.y = this.trackedPointer.world.y + this.trackOffset.y)), void 0 !== n && (this.fireFrom.x += n), void 0 !== o && (this.fireFrom.y += o); var a = this.fireFrom.width > 1 ? this.fireFrom.randomX : this.fireFrom.x , h = this.fireFrom.height > 1 ? this.fireFrom.randomY : this.fireFrom.y , l = this.trackRotation ? this.trackedSprite.angle : this.fireAngle; null !== e && null !== i && (l = this.game.math.radToDeg(Math.atan2(i h, e - a))), 0 !== this.bulletAngleVariance && (l += s.Math.between(this.bulletAngleVariance, this.bulletAngleVariance)); var c = 0 , u = 0; 0 === l || 180 === l ? c = Math.cos(this.game.math.degToRad(l)) * r : 90 === l || 270 === l ? u = Math.sin(this.game.math.degToRad(l)) * r : (c = Math.cos(this.game.math.degToRad(l)) * r, u = Math.sin(this.game.math.degToRad(l)) * r); var d = null; if (this.autoExpandBulletsGroup ? (d = this.bullets.getFirstExists(! 1, !0, a, h, this.bulletKey, this.bulletFrame), d.data.bulletManager = this) : d = this.bullets.getFirstExists(!1), d) { if (d.reset(a, h), d.data.fromX = a, d.data.fromY = h, d.data.killType = this.bulletKillType, d.data.killDistance = this.bulletKillDistance, d.data.rotateToVelocity = this.bulletRotateToVelocity, this.bulletKillType === s.Weapon.KILL_LIFESPAN && (d.lifespan = this.bulletLifespan), d.angle = l + this.bulletAngleOffset, "" !== this.bulletAnimation) { if (null === d.animations.getAnimation(this.bulletAnimation)) { var p = this.anims[this.bulletAnimation]; d.animations.add(p.name, p.frames, p.frameRate, p.loop, p.useNumericIndex) } d.animations.play(this.bulletAnimation) } else this.bulletFrameCycle ? (d.frame =
this.bulletFrames[this.bulletFrameIndex], ++this.bulletFrameIndex >= this.bulletFrames.length && (this.bulletFrameIndex = 0)) : this.bulletFrameRandom && (d.frame = this.bulletFrames[Math.floor(Math.random() * this.bulletFrames.length)]); d.data.bodyDirty && (this._data.customBody && d.body.setSize(this._data.width, this._data.height, this._data.offsetX, this._data.offsetY), d.body.collideWorldBounds = this.bulletCollideWorldBounds, d.data.bodyDirty = !1), d.body.velocity.set(c, u), d.body.gravity.set(this.bulletGravity.x, this.bulletGravity.y); var f = 0; if (0 !== this.bulletSpeedVariance) { var m = this.fireRate; m += s.Math.between(-this.fireRateVariance, this.fireRateVariance), m < 0 && (m = 0), f = this.game.time.now + m } else f = this.game.time.now + this.fireRate; this.multiFire ? this._hasFired || (this._hasFired = !0, this._tempNextFire = f, this.shots++) : (this._nextFire = f, this.shots++), this.onFire.dispatch(d, this, r), this.fireLimit > 0 && this.shots === this.fireLimit && this.onFireLimit.dispatch(this, this.fireLimit) } return d } , s.Weapon.prototype.fireAtPointer = function(t) { return void 0 === t && (t = this.game.input.activePointer), this.fire(null, t.worldX, t.worldY) } , s.Weapon.prototype.fireAtSprite = function(t) { return this.fire(null, t.world.x, t.world.y) } , s.Weapon.prototype.fireAtXY = function(t, e) { return this.fire(null, t, e) } , s.Weapon.prototype.setBulletBodyOffset = function(t, e, i, n) { return void 0 === i && (i = 0), void 0 === n && (n = 0), this._data.customBody = !0, this._data.width = t, this._data.height = e, this._data.offsetX = i, this._data.offsetY = n, this.bullets.callAll("body.setSize", "body", t, e, i, n), this.bullets.setAll("data.bodyDirty", !1), this } , s.Weapon.prototype.setBulletFrames = function(t, e, i, n) { return void 0 === i && (i = !0),
void 0 === n && (n = !1), this.bulletFrames = s.ArrayUtils.numberArray(t, e), this.bulletFrameIndex = 0, this.bulletFrameCycle = i, this.bulletFrameRandom = n, this } , s.Weapon.prototype.addBulletAnimation = function(t, e, i, n, s) { return this.anims[t] = { name: t, frames: e, frameRate: i, loop: n, useNumericIndex: s }, this.bullets.callAll("animations.add", "animations", t, e, i, n, s), this.bulletAnimation = t, this } , s.Weapon.prototype.debug = function(t, e, i) { void 0 === t && (t = 16), void 0 === e && (e = 32), void 0 === i && (i = !1), this.game.debug.text("Weapon Plugin", t, e), this.game.debug.text("Bullets Alive: " + this.bullets.total + " Total: " + this.bullets.length, t, e + 24), i && this.bullets.forEachExists(this.game.debug.body, this.game.debug, "rgba(255, 0, 255, 0.8)") } , Object.defineProperty(s.Weapon.prototype, "bulletClass", { get: function() { return this._bulletClass }, set: function(t) { this._bulletClass = t, this.bullets && (this.bullets.classType = this._bulletClass) } }), Object.defineProperty(s.Weapon.prototype, "bulletKillType", { get: function() { return this._bulletKillType }, set: function(t) { switch (t) { case s.Weapon.KILL_STATIC_BOUNDS: case s.Weapon.KILL_WEAPON_BOUNDS: this.bulletBounds = this.bounds; break; case s.Weapon.KILL_CAMERA_BOUNDS: this.bulletBounds = this.game.camera.view; break; case s.Weapon.KILL_WORLD_BOUNDS: this.bulletBounds = this.game.world.bounds } this._bulletKillType = t }
}), Object.defineProperty(s.Weapon.prototype, "bulletCollideWorldBounds", { get: function() { return this._bulletCollideWorldBounds }, set: function(t) { this._bulletCollideWorldBounds = t, this.bullets.setAll("body.collideWorldBounds", t), this.bullets.setAll("data.bodyDirty", !1) } }), Object.defineProperty(s.Weapon.prototype, "x", { get: function() { return this.fireFrom.x }, set: function(t) { this.fireFrom.x = t } }), Object.defineProperty(s.Weapon.prototype, "y", { get: function() { return this.fireFrom.y }, set: function(t) { this.fireFrom.y = t } }), s.Bullet = function(t, e, i, n, o) { s.Sprite.call(this, t, e, i, n, o), this.anchor.set(.5), this.data = { bulletManager: null, fromX: 0, fromY: 0, bodyDirty: !0, rotateToVelocity: !1, killType: 0, killDistance: 0 } } , s.Bullet.prototype = Object.create(s.Sprite.prototype), s.Bullet.prototype.constructor = s.Bullet, s.Bullet.prototype.kill = function() { return this.alive = !1, this.exists = !1, this.visible = !1, this.data.bulletManager.onKill.dispatch(this), this } , s.Bullet.prototype.update = function() { this.exists && (this.data.killType > s.Weapon.KILL_LIFESPAN && (this.data.killType === s.Weapon.KILL_DISTANCE ? this.game.physics.arcade.distanceToXY(this, this.data.fromX, this.data.fromY, !0) > this.data.killDistance && this.kill() : this.data.bulletManager.bulletBounds.intersects(this) || this.kill()), this.data.rotateToVelocity && (this.rotation = Math.atan2(this.body.velocity.y, this.body.velocity.x)),
this.data.bulletManager.bulletWorldWrap && this.game.world.wrap(this, this.data.bulletManager.bulletWorldWrapPadding)) } , s.Video = function(t, e, i) { if (void 0 === e && (e = null), void 0 === i && (i = null), this.game = t, this.key = e, this.width = 0, this.height = 0, this.type = s.VIDEO, this.disableTextureUpload = !1, this.touchLocked = !1, this.onPlay = new s.Signal, this.onChangeSource = new s.Signal, this.onComplete = new s.Signal, this.onAccess = new s.Signal, this.onError = new s.Signal, this.onTimeout = new s.Signal, this.timeout = 15e3, this._timeOutID = null, this.video = null, this.videoStream = null, this.isStreaming = !1, this.retryLimit = 20, this.retry = 0, this.retryInterval = 500, this._retryID = null, this._codeMuted = !1, this._muted = !1, this._codePaused = !1, this._paused = !1, this._pending = !1, this._pendingChangeSource = !1, this._autoplay = !1, this._endCallback = null, this._playCallback = null, e && this.game.cache.checkVideoKey(e)) { var n = this.game.cache.getVideo(e); n.isBlob ? this.createVideoFromBlob(n.data) : this.video = n.data, this.width = this.video.videoWidth, this.height = this.video.videoHeight } else i && this.createVideoFromURL(i, !1); this.video && !i ? (this.baseTexture = new PIXI.BaseTexture(this.video,null,this.game.resolution), this.baseTexture.forceLoaded(this.width, this.height)) : (this.baseTexture = new PIXI.BaseTexture(s.Cache.DEFAULT.baseTexture.source,null,this.game.resolution), this.baseTexture.forceLoaded(this.width, this.height)), this.texture = new PIXI.Texture(this.baseTexture), this.textureFrame = new s.Frame(0,0,0,this.width,this.height,"video"), this.texture.setFrame(this.textureFrame), this.texture.valid = !1, null !== e && this.video && (this.texture.valid = this.video.canplay), this.snapshot = null, s.BitmapData && (this.snapshot = new s.BitmapData(this.game,"",this.width,this.height)),
!this.game.device.cocoonJS && (this.game.device.iOS || this.game.device.android) || window.PhaserGlobal && window.PhaserGlobal.fakeiOSTouchLock ? this.setTouchLock() : n && (n.locked = !1) } , s.Video.prototype = { connectToMediaStream: function(t, e) { return t && e && (this.video = t, this.videoStream = e, this.isStreaming = !0, this.baseTexture.source = this.video, this.updateTexture(null, this.video.videoWidth, this.video.videoHeight), this.onAccess.dispatch(this)), this }, startMediaStream: function(t, e, i) { if (void 0 === t && (t = !1), void 0 === e && (e = null), void 0 === i && (i = null), !this.game.device.getUserMedia) return this.onError.dispatch(this, "No getUserMedia"), !1; null !== this.videoStream && (this.videoStream.active ? this.videoStream.active = !1 : this.videoStream.stop()), this.removeVideoElement(), this.video = document.createElement("video"), this.video.setAttribute("autoplay", "autoplay"), null !== e && (this.video.width = e), null !== i && (this.video.height = i), this._timeOutID = window.setTimeout(this.getUserMediaTimeout.bind(this), this.timeout); try { navigator.getUserMedia({ audio: t, video: !0 }, this.getUserMediaSuccess.bind(this), this.getUserMediaError.bind(this)) } catch (t) { this.getUserMediaError(t) } return this }, getUserMediaTimeout: function() { clearTimeout(this._timeOutID), this.onTimeout.dispatch(this) }, getUserMediaError: function(t) { clearTimeout(this._timeOutID), this.onError.dispatch(this, t) }, getUserMediaSuccess: function(t) { clearTimeout(this._timeOutID), this.videoStream = t, void 0 !== this.video.mozSrcObject ? this.video.mozSrcObject = t : this.video.src = window.URL && window.URL.createObjectURL(t) || t; var e = this; this.video.onloadeddata = function() { function t() {
if (i > 0) if (e.video.videoWidth > 0) { var n = e.video.videoWidth , s = e.video.videoHeight; isNaN(e.video.videoHeight) && (s = n / (4 / 3)), e.video.play(), e.isStreaming = !0, e.baseTexture.source = e.video, e.updateTexture(null, n, s), e.onAccess.dispatch(e) } else window.setTimeout(t, 500); else console.warn("Unable to connect to video stream. Webcam error?");
i-} var i = 10; t()
} }, createVideoFromBlob: function(t) { var e = this; return this.video = document.createElement("video"), this.video.controls = !1, this.video.setAttribute("autoplay", "autoplay"), this.video.addEventListener("loadeddata", function(t) { e.updateTexture(t) }, !0), this.video.src = window.URL.createObjectURL(t), this.video.canplay = !0, this }, createVideoFromURL: function(t, e) { return void 0 === e && (e = !1), this.texture && (this.texture.valid = !1), this.video = document.createElement("video"), this.video.controls = !1, e && this.video.setAttribute("autoplay", "autoplay"), this.video.src = t, this.video.canplay = !0, this.video.load(), this.retry = this.retryLimit, this._retryID = window.setTimeout(this.checkVideoProgress.bind(this), this.retryInterval), this.key = t, this }, updateTexture: function(t, e, i) { var n = !1; void 0 !== e && null !== e || (e = this.video.videoWidth, n = !0), void 0 !== i && null !== i || (i = this.video.videoHeight), this.width = e, this.height = i, this.baseTexture.source !== this.video && (this.baseTexture.source = this.video), this.baseTexture.forceLoaded(e, i), this.texture.frame.resize(e, i),
i),
this.texture.width = e, this.texture.height = i, this.texture.valid = !0, this.snapshot && this.snapshot.resize(e, i), n && null !== this.key && (this.onChangeSource.dispatch(this, e, this._autoplay && (this.video.play(), this.onPlay.dispatch(this, this.loop, this.playbackRate))) }, complete: function() { this.onComplete.dispatch(this) }, play: function(t, e) { return this._pendingChangeSource ? this : (void 0 === t && (t = !
1), this),
void 0 === e && (e = 1), this.game.sound.onMute && (this.game.sound.onMute.add(this.setMute,
this.game.sound.onUnMute.add(this.unsetMute, this), this.game.sound.mute && this.setMute()), this.game.onPause.add(this.setPause, this), this.game.onResume.add(this.setResume, this), this._endCallback = this.complete.bind(this), this.video.addEventListener("ended", this._endCallback, !0), this.video.addEventListener("webkitendfullscreen", this._endCallback, !0), this.video.loop = t ? "loop" : "", this.video.playbackRate = e, this.touchLocked ? this._pending = !0 : (this._pending = !1, null !== this.key && (4 !== this.video.readyState ? (this.retry = this.retryLimit, this._retryID = window.setTimeout(this.checkVideoProgress.bind(this), this.retryInterval)) : (this._playCallback = this.playHandler.bind(this), this.video.addEventListener("playing", this._playCallback, !0))), this.video.play(), this.onPlay.dispatch(this, t, e)), this) }, playHandler: function() { this.video.removeEventListener("playing", this._playCallback, !0), this.updateTexture() }, stop: function() { return this.game.sound.onMute && (this.game.sound.onMute.remove(this.setMute, this), this.game.sound.onUnMute.remove(this.unsetMute, this)), this.game.onPause.remove(this.setPause, this), this.game.onResume.remove(this.setResume, this), this.isStreaming ? (this.video.mozSrcObject ? (this.video.mozSrcObject.stop(), this.video.src = null) : (this.video.src = "", this.videoStream.active ? this.videoStream.active = !1 : this.videoStream.getTracks ? this.videoStream.getTracks().forEach(function(t) { t.stop() }) : this.videoStream.stop()), this.videoStream = null, this.isStreaming = !1) : (this.video.removeEventListener("ended", this._endCallback, !0),
this.video.removeEventListener("webkitendfullscreen", this._endCallback, !0), this.video.removeEventListener("playing", this._playCallback, !0), this.touchLocked ? this._pending = !1 : this.video.pause()), this }, add: function(t) { if (Array.isArray(t)) for (var e = 0; e < t.length; e++) t[e].loadTexture && t[e].loadTexture(this); else t.loadTexture(this); return this }, addToWorld: function(t, e, i, n, s, o) { s = s || 1, o = o || 1; var r = this.game.add.image(t, e, this); return r.anchor.set(i, n), r.scale.set(s, o), r }, render: function() { !this.disableTextureUpload && this.playing && this.baseTexture.dirty() }, setMute: function() { this._muted || (this._muted = !0, this.video.muted = !0) }, unsetMute: function() { this._muted && !this._codeMuted && (this._muted = !1, this.video.muted = !1) }, setPause: function() { this._paused || this.touchLocked || (this._paused = !0, this.video.pause()) }, setResume: function() { !this._paused || this._codePaused || this.touchLocked || (this._paused = !1, this.video.ended || this.video.play()) }, changeSource: function(t, e) { return void 0 === e && (e = !0), this.texture.valid = !1, this.video.pause(), this._pendingChangeSource = !0, this.retry = this.retryLimit, this._retryID = window.setTimeout(this.checkVideoProgress.bind(this), this.retryInterval), this.video.src = t, this.video.load(), this._autoplay = e, e || (this.paused = !0), this }, checkVideoProgress: function() { 4 === this.video.readyState ? (this._pendingChangeSource = !1,
this.updateTexture()) : (this.retry--, this.retry > 0 ? this._retryID = window.setTimeout(this.checkVideoProgress.bind(this), this.retryInterval) : console.warn("Phaser.Video: Unable to start downloading video in time", this.isStreaming)) }, setTouchLock: function() { this.game.input.touch.addTouchLockCallback(this.unlock, this), this.touchLocked = !0 }, unlock: function() { if (this.touchLocked = !1, this.video.play(), this.onPlay.dispatch(this, this.loop, this.playbackRate), this.key) { var t = this.game.cache.getVideo(this.key); t && !t.isBlob && (t.locked = !1) } return !0 }, grab: function(t, e, i) { return void 0 === t && (t = !1), void 0 === e && (e = 1), void 0 === i && (i = null), null === this.snapshot ? void console.warn("Video.grab cannot run because Phaser.BitmapData is unavailable") : (t && this.snapshot.cls(), this.snapshot.copy(this.video, 0, 0, this.width, this.height, 0, 0, this.width, this.height, 0, 0, 0, 1, 1, e, i), this.snapshot) }, removeVideoElement: function() { if (this.video) { for (this.video.parentNode && this.video.parentNode.removeChild(this.video); this.video.hasChildNodes(); ) this.video.removeChild(this.video.firstChild); this.video.removeAttribute("autoplay"), this.video.removeAttribute("src"), this.video = null } }, destroy: function() { this.stop(), this.removeVideoElement(), this.touchLocked && this.game.input.touch.removeTouchLockCallback(this.unlock, this), this._retryID && window.clearTimeout(this._retryID) } }, Object.defineProperty(s.Video.prototype, "currentTime", { get: function() { return this.video ? this.video.currentTime : 0 }, set: function(t) { this.video.currentTime = t } }), Object.defineProperty(s.Video.prototype, "duration", { get: function() { return this.video ? this.video.duration : 0
0
} }), Object.defineProperty(s.Video.prototype, "progress", { get: function() { return this.video ? this.video.currentTime / this.video.duration : } }), Object.defineProperty(s.Video.prototype, "mute", { get: function() { return this._muted }, set: function(t) { if (t = t || null) { if (this._muted) return; this._codeMuted = !0, this.setMute() } else { if (!this._muted) return; this._codeMuted = !1, this.unsetMute() } } }), Object.defineProperty(s.Video.prototype, "paused", { get: function() { return this._paused }, set: function(t) { if (t = t || null, !this.touchLocked) if (t) { if (this._paused) return; this._codePaused = !0, this.setPause() } else { if (!this._paused) return; this._codePaused = !1, this.setResume() } } }), Object.defineProperty(s.Video.prototype, "volume", { get: function() { return this.video ? this.video.volume : 1 }, set: function(t) { t < 0 ? t = 0 : t > 1 && (t = 1), this.video && (this.video.volume = t) } }), Object.defineProperty(s.Video.prototype, "playbackRate", { get: function() { return this.video ? this.video.playbackRate : 1 },
set: function(t) { this.video && (this.video.playbackRate = t) }
}), Object.defineProperty(s.Video.prototype, "loop", { get: function() { return !!this.video && this.video.loop }, set: function(t) { t && this.video ? this.video.loop = "loop" : this.video && (this.video.loop = "") } }), Object.defineProperty(s.Video.prototype, "playing", { get: function() { return !!this.video && !(this.video.paused && this.video.ended) } }), s.Video.prototype.constructor = s.Video, void 0 === PIXI.blendModes && (PIXI.blendModes = s.blendModes), void 0 === PIXI.scaleModes && (PIXI.scaleModes = s.scaleModes), void 0 === PIXI.Texture.emptyTexture && (PIXI.Texture.emptyTexture = new PIXI.Texture(new PIXI.BaseTexture)), void 0 === PIXI.DisplayObject._tempMatrix && (PIXI.DisplayObject._tempMatrix = new PIXI.Matrix), PIXI.TextureSilentFail = !0, void 0 !== e ? (void 0 !== t && t.exports && (e = t.exports = s), e.Phaser = s) : "undefined" != typeof define && define.amd ? define("Phaser", function() { return n.Phaser = s }()) : n.Phaser = s, s } ).call(this) } , function(t, e) { /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} * * @overview * * Phaser - http://phaser.io * * v2.7.3 "2017-01-09" - Built: Mon Jan 09 2017 13:26:34 * * By Richard Davey http://www.photonstorm.com @photonstorm * * Phaser is a fun, free and fast 2D game framework for making HTML5 games * for desktop and mobile web browsers, supporting Canvas and WebGL rendering. * * Phaser uses Pixi.js for rendering, created by Mat Groves http://matgroves.com @Doormat23 * Phaser uses p2.js for full-body physics, created by Stefan Hedman https://github.com/schteppe/p2.js @schteppe * Phaser contains a port of N+ Physics, converted by Richard Davey, original by http://www.metanetsoftware.com
* * Many thanks to Adam Saltsman (@ADAMATOMIC) for releasing Flixel, from which both Phaser and my love of framework development originate. * * Follow development at http://phaser.io and on our forum * * "If you want your children to be intelligent, read them fairy tales." * "If you want them to be more intelligent, read them more fairy tales." * -- Albert Einstein */ (function() { function i(t, e, i, n) { var s = t.createTexture(); return t.bindTexture(t.TEXTURE_2D, s), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, n === o.scaleModes.LINEAR ? t.LINEAR : t.NEAREST), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, n === o.scaleModes.LINEAR ? t.LINEAR : t.NEAREST), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, e, i, 0, t.RGBA, t.UNSIGNED_BYTE, null), s } function n(t, e, n, s, o) { var a = t.createFramebuffer() , h = t.createRenderbuffer() , l = null , c = 0; return t.activeTexture(t.TEXTURE0 + o), t.bindFramebuffer(t.FRAMEBUFFER, a), t.bindRenderbuffer(t.RENDERBUFFER, h), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_STENCIL_ATTACHMENT, t.RENDERBUFFER, this.renderBuffer), l = i(t, e, n, s), t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, l, 0), c = t.checkFramebufferStatus(t.FRAMEBUFFER), c !== t.FRAMEBUFFER_COMPLETE && console.error("Incomplete GL framebuffer. ", r[c]), a.width = e, a.height = n, a.targetTexture = l, a.renderBuffer = h, a } var s = this , o = o || {}; /** * @author Mat Groves http://matgroves.com @Doormat23 * @author Richard Davey * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ o.DisplayObject = function() { this.position = new o.Point(0,0), this.scale = new o.Point(1,1), this.pivot = new o.Point(0,0), this.rotation = 0,
this.alpha = 1, this.visible = !0, this.hitArea = null, this.renderable = !1, this.parent = null, this.worldAlpha = 1, this.worldTransform = new o.Matrix, this.worldPosition = new o.Point(0,0), this.worldScale = new o.Point(1,1), this.worldRotation = 0, this.filterArea = null, this._sr = 0, this._cr = 1, this._bounds = new o.Rectangle(0,0,0,0), this._currentBounds = null, this._mask = null, this._cacheAsBitmap = !1, this._cacheIsDirty = !1 } , o.DisplayObject.prototype.constructor = o.DisplayObject, o.DisplayObject.prototype = { destroy: function() { if (this.children) { for (var t = this.children.length; t--; ) this.children[t].destroy(); this.children = [] } this.hitArea = null, this.parent = null, this.worldTransform = null, this.filterArea = null, this.renderable = !1, this._bounds = null, this._currentBounds = null, this._mask = null, this._destroyCachedSprite() }, updateTransform: function(t) { if (!t && !this.parent && !this.game) return this; var e = this.parent; t ? e = t : this.parent || (e = this.game.world); var i, n, s, o, r, a, h = e.worldTransform, l = this.worldTransform; return this.rotation % Phaser.Math.PI2 ? (this.rotation !== this.rotationCache && (this.rotationCache = this.rotation, this._sr = Math.sin(this.rotation), this._cr = Math.cos(this.rotation)), i = this._cr * this.scale.x, n = this._sr * this.scale.x, s = -this._sr * this.scale.y, o = this._cr * this.scale.y, r = this.position.x, a = this.position.y, (this.pivot.x || this.pivot.y) && (r -= this.pivot.x * i + this.pivot.y * s, a -= this.pivot.x * n + this.pivot.y * o), l.a = i * h.a + n * h.c,
l.b = i * h.b + n * h.d, l.c = s * h.a + o * h.c, l.d = s * h.b + o * h.d, l.tx = r * h.a + a * h.c + h.tx, l.ty = r * h.b + a * h.d + h.ty) : (i = this.scale.x, o = this.scale.y, r = this.position.x - this.pivot.x * i, a = this.position.y - this.pivot.y * o, l.a = i * h.a, l.b = i * h.b, l.c = o * h.c, l.d = o * h.d, l.tx = r * h.a + a * h.c + h.tx, l.ty = r * h.b + a * h.d + h.ty), this.worldAlpha = this.alpha * e.worldAlpha, this.worldPosition.set(l.tx, l.ty), this.worldScale.set(this.scale.x * Math.sqrt(l.a * l.a + l.c * l.c), this.scale.y * Math.sqrt(l.b * l.b + l.d * l.d)), this.worldRotation = Math.atan2(-l.c, l.d), this._currentBounds = null, this.transformCallback && this.transformCallback.call(this.transformCallbackContext, l, h), this }, preUpdate: function() {}, generateTexture: function(t, e, i) { var n = this.getLocalBounds() , s = new Phaser.RenderTexture(this.game,0 | n.width,0 | n.height,i,e,t); return o.DisplayObject._tempMatrix.tx = -n.x, o.DisplayObject._tempMatrix.ty = -n.y, s.render(this, o.DisplayObject._tempMatrix), s }, updateCache: function() { return this._generateCachedSprite(), this }, toGlobal: function(t) { return this.updateTransform(), this.worldTransform.apply(t) }, toLocal: function(t, e) { return e && (t = e.toGlobal(t)), this.updateTransform(), this.worldTransform.applyInverse(t) }, _renderCachedSprite: function(t) { this._cachedSprite.worldAlpha = this.worldAlpha, t.gl ? o.Sprite.prototype._renderWebGL.call(this._cachedSprite, t) : o.Sprite.prototype._renderCanvas.call(this._cachedSprite, t) }, _generateCachedSprite: function() { this._cacheAsBitmap = !1; var t = this.getLocalBounds(); if (t.width = Math.max(1, Math.ceil(t.width)), t.height = Math.max(1, Math.ceil(t.height)), this.updateTransform(), this._cachedSprite)
this._cachedSprite.texture.resize(t.width, t.height); else { var e = 0; this.texture && this.texture.baseTexture && o._enableMultiTextureToggle && (e = this.texture.baseTexture.textureIndex); var i = new Phaser.RenderTexture(t.width,t.height,null,null,null,e); this._cachedSprite = new o.Sprite(i), this._cachedSprite.worldTransform = this.worldTransform } var n = this._filters; this._filters = null, this._cachedSprite.filters = n, o.DisplayObject._tempMatrix.tx = -t.x, o.DisplayObject._tempMatrix.ty = -t.y, this._cachedSprite.texture.render(this, o.DisplayObject._tempMatrix, !0), this._cachedSprite.anchor.x = -t.x / t.width, this._cachedSprite.anchor.y = -t.y / t.height, this._filters = n, this._cacheAsBitmap = !0 }, _destroyCachedSprite: function() { this._cachedSprite && (this._cachedSprite.texture.destroy(!0), this._cachedSprite = null) } }, o.DisplayObject.prototype.displayObjectUpdateTransform = o.DisplayObject.prototype.updateTransform, Object.defineProperties(o.DisplayObject.prototype, { x: { get: function() { return this.position.x }, set: function(t) { this.position.x = t } }, y: { get: function() { return this.position.y }, set: function(t) { this.position.y = t } }, worldVisible: { get: function() { if (this.visible) { var t = this.parent; if (!t) return this.visible; do { if (!t.visible) return !1; t = t.parent } while (t);return !0 } return !1
} }, mask: { get: function() { return this._mask }, set: function(t) { this._mask && (this._mask.isMask = !1), this._mask = t, t && (this._mask.isMask = !0) } }, filters: { get: function() { return this._filters }, set: function(t) { if (Array.isArray(t)) { for (var e = [], i = 0; i < t.length; i++) for (var n = t[i].passes, s = 0; s < n.length; s++) e.push(n[s]); this._filterBlock = { target: this, filterPasses: e } } this._filters = t, this.blendMode && this.blendMode === o.blendModes.MULTIPLY && (this.blendMode = o.blendModes.NORMAL) } }, cacheAsBitmap: { get: function() { return this._cacheAsBitmap }, set: function(t) { this._cacheAsBitmap !== t && (t ? this._generateCachedSprite() : this._destroyCachedSprite(), this._cacheAsBitmap = t) } } }), o.DisplayObjectContainer = function() { o.DisplayObject.call(this), this.children = [], this.ignoreChildInput = !1 } , o.DisplayObjectContainer.prototype = Object.create(o.DisplayObject.prototype), o.DisplayObjectContainer.prototype.constructor = o.DisplayObjectContainer, o.DisplayObjectContainer.prototype.addChild = function(t) { return this.addChildAt(t, this.children.length) } , o.DisplayObjectContainer.prototype.addChildAt = function(t, e) { if (e >= 0 && e = this.children.length) throw new Error("The supplied index is out of bounds"); var i = this.getChildIndex(t); this.children.splice(i, 1), this.children.splice(e, 0, t) } , o.DisplayObjectContainer.prototype.getChildAt = function(t) { if (t < 0 || t >= this.children.length) throw new Error("getChildAt: Supplied index " + t + " does not exist in the child list, or the supplied DisplayObject must be a child of the caller"); return this.children[t] } , o.DisplayObjectContainer.prototype.removeChild = function(t) { var e = this.children.indexOf(t); if (-1 !== e) return this.removeChildAt(e) } , o.DisplayObjectContainer.prototype.removeChildAt = function(t) { var e = this.getChildAt(t); return e && (e.parent = void 0, this.children.splice(t, 1)), e } , o.DisplayObjectContainer.prototype.removeChildren = function(t, e) { void 0 === t && (t = 0), void 0 === e && (e = this.children.length); var i = e - t;
if (i > 0 && i a ? u : a, d = d > h ? d : h) } var f = this._bounds; if (!p) { f = new o.Rectangle; var m = f.x , g = f.width + f.x , y = f.y , v = f.height + f.y , b = this.worldTransform , w = b.a , x = b.b , _ = b.c , P = b.d , T = b.tx , C = b.ty
u d l c l l l c c c u u u d d d
, , , , , , , , = = = = = = = = = = = = = = = =
S = A = k = E = I = M = O = B = S, A, S, A, k < I < O < E < M < B < k > I > O > E > M > B >
w P w P w P w P
* * * * * * * *
g v m v m y g y
+ + + + + + + +
_ x _ x _ x _ x
l l l c c c u u u d d d
? ? ? ? ? ? ? ? ? ? ? ?
k I O E M B k I O E M B
: : : : : : : : : : : :
l, l, l, c, c, c, u, u, u, d, d, d
* * * * * * * *
v g v m y m y g
+ + + + + + + +
T C T C T C T C;
} if (f.x = l, f.y = c, f.width = u - l, f.height = d - c, e) for (t.worldTransform = s, n = 0; n < t.children.length; n++) t.children[n].updateTransform(); if (!i) { var R = t.getBounds(); f.x -= R.x, f.y -= R.y } return f
} , o.DisplayObjectContainer.prototype.getLocalBounds = function() { return this.getBounds(this) } , o.DisplayObjectContainer.prototype.contains = function(t) { return !!t && (t === this || this.contains(t.parent)) } , o.DisplayObjectContainer.prototype._renderWebGL = function(t) { if (this.visible && !(this.alpha f ? b : f, f = x > f ? x : f, f = P > f ? P : f, f = C > f ? C : f, m = w > m ? w : m, m = _ > m ? _ : m, m = T > m ? T : m, m = S > m ? S : m } var A = this._bounds; return A.x = g, A.width = f - g, A.y = y, A.height = m - y, this._currentBounds = A, A
+ + + + + + + +
d p d p d p d p;
} , o.Sprite.prototype.getLocalBounds = function() { var t = this.worldTransform; this.worldTransform = o.identityMatrix; for (var e = 0; e < this.children.length; e++) this.children[e].updateTransform(); var i = this.getBounds(); for (this.worldTransform = t, e = 0; e < this.children.length; e++) this.children[e].updateTransform(); return i } , o.Sprite.prototype._renderWebGL = function(t, e) {
if (this.visible && !(this.alpha > 1, t |= t >> 2, t |= t >> 4, t |= t >> 8, t |= t >> 16,
++t }, i = this.gl, n = i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS), s = i.getParameter(i.MAX_TEXTURE_SIZE), r = this.game.cache._cache.image, a = null, h = 0; h < this.currentBatchedTextures.length; h++) (a = t[c])in r && (r[a].base.textureIndex = 0); var l = s - e(Math.max(this.width, this.height)); this.currentBatchedTextures.length = 0; for (var c = 0; c < t.length; ++c) if ((a = t[c])in r) { var u = r[a].base; l -= e(Math.max(u.width, u.height)), u.textureIndex = l = this.size && (this.flush(), this.currentBaseTexture = i.baseTexture); var a = i._uvs; if (a) { var h, l, c, u, d = t.anchor.x, p = t.anchor.y; if (i.trim) { var f = i.trim; l = f.x - d * f.width, h = l + i.crop.width, u = f.y - p * f.height, c = u + i.crop.height } else h = i.frame.width * (1 - d), l = i.frame.width * -d, c = i.frame.height * (1 - p), u = i.frame.height * -p; var m = this.currentBatchSize * this.vertexSize , g = (this.currentBatchSize, i.baseTexture.resolution) , y = i.baseTexture.textureIndex , v = r.a / g , b = r.b / g , w = r.c / g , x = r.d / g , _ = r.tx , P = r.ty , T = (i.crop.width, i.crop.height); if (i.rotated) { var C = r.a , S = r.b , A = r.c , k = r.d , E = l , I = h; _ = r.c * T + _, P = r.d * T + P, v = 6.123233995736766e-17 * C - A, b = 6.123233995736766e-17 * S - k, w = C + 6.123233995736766e-17 * A, x = S + 6.123233995736766e-17 * k, i._updateUvsInverted(), h = c, l = u, c = I, u = E } var M = this.colors , O = this.positions , B = t.tint , R = (B >> 16) + (65280 & B) + ((255 & B) > 16) + (65280 & p) + ((255 & p) 0 && (v = !1), (f || m) && (this.renderBatch(u, l, c), c = g, l = 0, u = s, f && (d = r, this.renderSession.blendModeManager.setBlendMode(d)), m)) { p = a, t = p.shaders[e.id], t || (t = new o.PixiShader(e), t.fragmentSrc = p.fragmentSrc, t.uniforms = p.uniforms, t.init(), p.shaders[e.id] = t), this.renderSession.shaderManager.setShader(t), t.dirty && t.syncUniforms(); var b = this.renderSession.projection; e.uniform2f(t.projectionVector, b.x, b.y);
var w = this.renderSession.offset; e.uniform2f(t.offsetVector, w.x, w.y) } l++ } this.renderBatch(u, l, c), this.currentBatchSize = 0
} } , o.WebGLSpriteBatch.prototype.renderBatch = function(t, e, i) { if (0 !== e) { var n = this.gl; t._dirty[n.id] && !this.renderSession.renderer.updateTexture(t) || (n.drawElements(n.TRIANGLES, 6 * e, n.UNSIGNED_SHORT, 6 * i * 2), this.renderSession.drawCount++) } } , o.WebGLSpriteBatch.prototype.stop = function() { this.flush(), this.dirty = !0 } , o.WebGLSpriteBatch.prototype.start = function() { this.dirty = !0 } , o.WebGLSpriteBatch.prototype.destroy = function() { this.vertices = null, this.indices = null, this.gl.deleteBuffer(this.vertexBuffer), this.gl.deleteBuffer(this.indexBuffer), this.currentBaseTexture = null, this.gl = null } , o.WebGLFastSpriteBatch = function(t) { this.vertSize = 11, this.maxSize = 6e3, this.size = this.maxSize; var e = 4 * this.size * this.vertSize , i = 6 * this.maxSize; this.vertices = new Float32Array(e), this.indices = new Uint16Array(i), this.vertexBuffer = null, this.indexBuffer = null, this.lastIndexCount = 0; for (var n = 0, s = 0; n < i; n += 6, s += 4) this.indices[n + 0] = s + 0, this.indices[n + 1] = s + 1, this.indices[n + 2] = s + 2, this.indices[n + 3] = s + 0, this.indices[n + 4] = s + 2, this.indices[n + 5] = s + 3; this.drawing = !1, this.currentBatchSize = 0, this.currentBaseTexture = null,
this.currentBlendMode = 0, this.renderSession = null, this.shader = null, this.matrix = null, this.setContext(t)
} , o.WebGLFastSpriteBatch.prototype.constructor = o.WebGLFastSpriteBatch, o.WebGLFastSpriteBatch.prototype.setContext = function(t) { this.gl = t, this.vertexBuffer = t.createBuffer(), this.indexBuffer = t.createBuffer(), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this.indexBuffer), t.bufferData(t.ELEMENT_ARRAY_BUFFER, this.indices, t.STATIC_DRAW), t.bindBuffer(t.ARRAY_BUFFER, this.vertexBuffer), t.bufferData(t.ARRAY_BUFFER, this.vertices, t.DYNAMIC_DRAW) } , o.WebGLFastSpriteBatch.prototype.begin = function(t, e) { this.renderSession = e, this.shader = this.renderSession.shaderManager.fastShader, this.matrix = t.worldTransform.toArray(!0), this.start() } , o.WebGLFastSpriteBatch.prototype.end = function() { this.flush() } , o.WebGLFastSpriteBatch.prototype.render = function(t) { var e = t.children , i = e[0]; if (i.texture._uvs) { this.currentBaseTexture = i.texture.baseTexture, i.blendMode !== this.renderSession.blendModeManager.currentBlendMode && (this.flush(), this.renderSession.blendModeManager.setBlendMode(i.blendMode)); for (var n = 0, s = e.length; n < s; n++) this.renderSprite(e[n]); this.flush() } } , o.WebGLFastSpriteBatch.prototype.renderSprite = function(t) { var e = t.texture , i = e.baseTexture , n = this.gl , s = t.texture.baseTexture.textureIndex; if ((o.WebGLRenderer.textureArray[s] == i || !i._glTextures[n.id] || t.texture.baseTexture.skipRender || (this.flush(), n.activeTexture(n.TEXTURE0 + s), n.bindTexture(n.TEXTURE_2D, i._glTextures[n.id]), o.WebGLRenderer.textureArray[s] = i, t.texture._uvs)) && t.visible) { var r, a, h, l, c, u, d = this.vertices; if (r = t.texture._uvs, t.texture.frame.width, t.texture.frame.height, t.texture.trim) {
} }
var p = t.texture.trim; h = p.x - t.anchor.x * p.width, a = h + t.texture.crop.width, c = p.y - t.anchor.y * p.height, l = c + t.texture.crop.height } else a = t.texture.frame.width * (1 - t.anchor.x), h = t.texture.frame.width * -t.anchor.x, l = t.texture.frame.height * (1 - t.anchor.y), c = t.texture.frame.height * -t.anchor.y; u = 4 * this.currentBatchSize * this.vertSize, d[u++] = h, d[u++] = c, d[u++] = t.position.x, d[u++] = t.position.y, d[u++] = t.scale.x, d[u++] = t.scale.y, d[u++] = t.rotation, d[u++] = r.x0, d[u++] = r.y1, d[u++] = t.alpha, d[u++] = s, d[u++] = a, d[u++] = c, d[u++] = t.position.x, d[u++] = t.position.y, d[u++] = t.scale.x, d[u++] = t.scale.y, d[u++] = t.rotation, d[u++] = r.x1, d[u++] = r.y1, d[u++] = t.alpha, d[u++] = s, d[u++] = a, d[u++] = l, d[u++] = t.position.x, d[u++] = t.position.y, d[u++] = t.scale.x, d[u++] = t.scale.y, d[u++] = t.rotation, d[u++] = r.x2, d[u++] = r.y2, d[u++] = t.alpha, d[u++] = s, d[u++] = h, d[u++] = l, d[u++] = t.position.x, d[u++] = t.position.y, d[u++] = t.scale.x, d[u++] = t.scale.y, d[u++] = t.rotation, d[u++] = r.x3, d[u++] = r.y3, d[u++] = t.alpha, d[u++] = s, this.currentBatchSize++, this.currentBatchSize >= this.size && this.flush()
, o.WebGLFastSpriteBatch.prototype.flush = function() { if (0 !== this.currentBatchSize) { var t = this.gl; if (!this.currentBaseTexture._glTextures[t.id]) return void this.renderSession.renderer.updateTexture(this.currentBaseTexture, t); if (this.currentBatchSize > .5 * this.size) t.bufferSubData(t.ARRAY_BUFFER, 0, this.vertices); else { var e = this.vertices.subarray(0, 4 * this.currentBatchSize * this.vertSize); t.bufferSubData(t.ARRAY_BUFFER, 0, e) } t.drawElements(t.TRIANGLES, 6 * this.currentBatchSize, t.UNSIGNED_SHORT, 0), this.currentBatchSize = 0, this.renderSession.drawCount++ } } , o.WebGLFastSpriteBatch.prototype.stop = function() { this.flush() } , o.WebGLFastSpriteBatch.prototype.start = function() { var t = this.gl; t.activeTexture(t.TEXTURE0), t.bindBuffer(t.ARRAY_BUFFER, this.vertexBuffer), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this.indexBuffer); var e = this.renderSession.projection; t.uniform2f(this.shader.projectionVector, e.x, e.y), t.uniformMatrix3fv(this.shader.uMatrix, !1, this.matrix); var i = 4 * this.vertSize; t.vertexAttribPointer(this.shader.aVertexPosition, 2, t.FLOAT, !1, i, 0), t.vertexAttribPointer(this.shader.aPositionCoord, 2, t.FLOAT, !1, i, 8), t.vertexAttribPointer(this.shader.aScale, 2, t.FLOAT, !1, i, 16), t.vertexAttribPointer(this.shader.aRotation, 1, t.FLOAT, !1, i, 24), t.vertexAttribPointer(this.shader.aTextureCoord, 2, t.FLOAT, !1, i, 28), t.vertexAttribPointer(this.shader.colorAttribute, 1, t.FLOAT, !1, i, 36), t.vertexAttribPointer(this.shader.aTextureIndex, 1, t.FLOAT, !1, i, 40) } , o.WebGLFilterManager = function() { this.filterStack = [], this.offsetX = 0, this.offsetY = 0 } , o.WebGLFilterManager.prototype.constructor = o.WebGLFilterManager, o.WebGLFilterManager.prototype.setContext = function(t) { this.gl = t, this.texturePool = [], this.initShaderBuffers() }
, o.WebGLFilterManager.prototype.begin = function(t, e) { this.renderSession = t, this.defaultShader = t.shaderManager.defaultShader; var i = this.renderSession.projection; this.width = 2 * i.x, this.height = 2 * -i.y, this.buffer = e } , o.WebGLFilterManager.prototype.pushFilter = function(t) { var e = this.gl , i = this.renderSession.projection , n = this.renderSession.offset; t._filterArea = t.target.filterArea || t.target.getBounds(), t._previous_stencil_mgr = this.renderSession.stencilManager, this.renderSession.stencilManager = new o.WebGLStencilManager, this.renderSession.stencilManager.setContext(e), e.disable(e.STENCIL_TEST), this.filterStack.push(t); var s = t.filterPasses[0]; this.offsetX += t._filterArea.x, this.offsetY += t._filterArea.y; var r = this.texturePool.pop(); r ? r.resize(this.width * this.renderSession.resolution, this.height * this.renderSession.resolution) : r = new o.FilterTexture(this.gl,this.width * this.renderSession.resolution,this.height * this.renderSession.resolution), e.bindTexture(e.TEXTURE_2D, r.texture); var a = t._filterArea , h = s.padding; a.x -= h, a.y -= h, a.width += 2 * h, a.height += 2 * h, a.x < 0 && (a.x = 0), a.width > this.width && (a.width = this.width), a.y < 0 && (a.y = 0), a.height > this.height && (a.height = this.height), e.bindFramebuffer(e.FRAMEBUFFER, r.frameBuffer), e.viewport(0, 0, a.width * this.renderSession.resolution, a.height * this.renderSession.resolution), i.x = a.width / 2, i.y = -a.height / 2, n.x = -a.x, n.y = -a.y, e.colorMask(!0, !0, !0, !0), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), t._glFilterTexture = r } , o.WebGLFilterManager.prototype.popFilter = function() { var t = this.gl , e = this.filterStack.pop() , i = e._filterArea , n = e._glFilterTexture , s = this.renderSession.projection , r = this.renderSession.offset; if (e.filterPasses.length > 1) {
t.viewport(0, 0, i.width * this.renderSession.resolution, i.height * this.renderSession.resolution), t.bindBuffer(t.ARRAY_BUFFER, this.vertexBuffer), this.vertexArray[0] = 0, this.vertexArray[1] = i.height, this.vertexArray[2] = i.width, this.vertexArray[3] = i.height, this.vertexArray[4] = 0, this.vertexArray[5] = 0, this.vertexArray[6] = i.width, this.vertexArray[7] = 0, t.bufferSubData(t.ARRAY_BUFFER, 0, this.vertexArray), t.bindBuffer(t.ARRAY_BUFFER, this.uvBuffer), this.uvArray[2] = i.width / this.width, this.uvArray[5] = i.height / this.height, this.uvArray[6] = i.width / this.width, this.uvArray[7] = i.height / this.height, t.bufferSubData(t.ARRAY_BUFFER, 0, this.uvArray); var a = n , h = this.texturePool.pop(); h || (h = new o.FilterTexture(this.gl,this.width * this.renderSession.resolution,this.height * this.renderSession.resolution)), h.resize(this.width * this.renderSession.resolution, this.height * this.renderSession.resolution), t.bindFramebuffer(t.FRAMEBUFFER, h.frameBuffer), t.clear(t.COLOR_BUFFER_BIT), t.disable(t.BLEND); for (var l = 0; l < e.filterPasses.length - 1; l++) { var c = e.filterPasses[l]; t.bindFramebuffer(t.FRAMEBUFFER, h.frameBuffer), t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, a.texture), this.applyFilterPass(c, i, i.width, i.height); var u = a; a = h, h = u } t.enable(t.BLEND), n = a, this.texturePool.push(h) } var d = e.filterPasses[e.filterPasses.length - 1]; this.offsetX -= i.x, this.offsetY -= i.y; var p = this.width , f = this.height , m = 0 , g = 0 , y = this.buffer; if (0 === this.filterStack.length) t.colorMask(!0, !0, !0, !0); else { var v = this.filterStack[this.filterStack.length - 1]; i = v._filterArea, p = i.width, f = i.height, m = i.x, g = i.y, y = v._glFilterTexture.frameBuffer
} s.x = p / 2, s.y = -f / 2, r.x = m, r.y = g, i = e._filterArea; var b = i.x - m , w = i.y - g; t.bindBuffer(t.ARRAY_BUFFER, this.vertexBuffer), this.vertexArray[0] = b, this.vertexArray[1] = w + i.height, this.vertexArray[2] = b + i.width, this.vertexArray[3] = w + i.height, this.vertexArray[4] = b, this.vertexArray[5] = w, this.vertexArray[6] = b + i.width, this.vertexArray[7] = w, t.bufferSubData(t.ARRAY_BUFFER, 0, this.vertexArray), t.bindBuffer(t.ARRAY_BUFFER, this.uvBuffer), this.uvArray[2] = i.width / this.width, this.uvArray[5] = i.height / this.height, this.uvArray[6] = i.width / this.width, this.uvArray[7] = i.height / this.height, t.bufferSubData(t.ARRAY_BUFFER, 0, this.uvArray), t.viewport(0, 0, p * this.renderSession.resolution, f * this.renderSession.resolution), t.bindFramebuffer(t.FRAMEBUFFER, y), t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, n.texture), this.renderSession.stencilManager && this.renderSession.stencilManager.destroy(), this.renderSession.stencilManager = e._previous_stencil_mgr, e._previous_stencil_mgr = null, this.renderSession.stencilManager.count > 0 ? t.enable(t.STENCIL_TEST) : t.disable(t.STENCIL_TEST), this.applyFilterPass(d, i, p, f), this.texturePool.push(n), e._glFilterTexture = null } , o.WebGLFilterManager.prototype.applyFilterPass = function(t, e, i, n) { var s = this.gl , r = t.shaders[s.id]; r || (r = new o.PixiShader(s), r.fragmentSrc = t.fragmentSrc, r.uniforms = t.uniforms, r.init(!0), t.shaders[s.id] = r), this.renderSession.shaderManager.setShader(r), s.uniform2f(r.projectionVector, i / 2, -n / 2), s.uniform2f(r.offsetVector, 0, 0), t.uniforms.dimensions && (t.uniforms.dimensions.value[0] = this.width, t.uniforms.dimensions.value[1] = this.height, t.uniforms.dimensions.value[2] = this.vertexArray[0], t.uniforms.dimensions.value[3] = this.vertexArray[5]), r.syncUniforms(), s.bindBuffer(s.ARRAY_BUFFER, this.vertexBuffer), s.vertexAttribPointer(r.aVertexPosition, 2, s.FLOAT, !1, 0, 0), s.bindBuffer(s.ARRAY_BUFFER, this.uvBuffer),
s.vertexAttribPointer(r.aTextureCoord, 2, s.FLOAT, !1, 0, 0), s.bindBuffer(s.ARRAY_BUFFER, this.colorBuffer), s.vertexAttribPointer(r.colorAttribute, 2, s.FLOAT, !1, 0, 0), s.bindBuffer(s.ELEMENT_ARRAY_BUFFER, this.indexBuffer), s.drawElements(s.TRIANGLES, 6, s.UNSIGNED_SHORT, 0), this.renderSession.drawCount++ } , o.WebGLFilterManager.prototype.initShaderBuffers = function() { var t = this.gl; this.vertexBuffer = t.createBuffer(), this.uvBuffer = t.createBuffer(), this.colorBuffer = t.createBuffer(), this.indexBuffer = t.createBuffer(), this.vertexArray = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]), t.bindBuffer(t.ARRAY_BUFFER, this.vertexBuffer), t.bufferData(t.ARRAY_BUFFER, this.vertexArray, t.STATIC_DRAW), this.uvArray = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]), t.bindBuffer(t.ARRAY_BUFFER, this.uvBuffer), t.bufferData(t.ARRAY_BUFFER, this.uvArray, t.STATIC_DRAW), this.colorArray = new Float32Array([1, 16777215, 1, 16777215, 1, 16777215, 1, 16777215]), t.bindBuffer(t.ARRAY_BUFFER, this.colorBuffer), t.bufferData(t.ARRAY_BUFFER, this.colorArray, t.STATIC_DRAW), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this.indexBuffer), t.bufferData(t.ELEMENT_ARRAY_BUFFER, new Uint16Array([0, 1, 2, 1, 3, 2]), t.STATIC_DRAW) } , o.WebGLFilterManager.prototype.destroy = function() { var t = this.gl; this.filterStack = null, this.offsetX = 0, this.offsetY = 0; for (var e = 0; e < this.texturePool.length; e++) this.texturePool[e].destroy(); this.texturePool = null, t.deleteBuffer(this.vertexBuffer), t.deleteBuffer(this.uvBuffer), t.deleteBuffer(this.colorBuffer), t.deleteBuffer(this.indexBuffer) } ; var r = { 36054: "Incomplete attachment", 36055: "Missing attachment", 36057: "Incomplete dimensions", 36061: "Framebuffer unsupported" }; return o.FilterTexture = function(t, e, i, s, r) { r = "number" == typeof r ? r : 0, this.gl = t, this.frameBuffer = n(t, e, i, s || o.scaleModes.DEFAULT, r), this.texture = this.frameBuffer.targetTexture, this.width = e, this.height = i, this.renderBuffer = this.frameBuffer.renderBuffer } ,
o.FilterTexture.prototype.constructor = o.FilterTexture, o.FilterTexture.prototype.clear = function() { var t = this.gl; t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT) } , o.FilterTexture.prototype.resize = function(t, e) { if (this.width !== t || this.height !== e) { this.width = t, this.height = e; var i = this.gl; i.bindTexture(i.TEXTURE_2D, this.texture), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, t, e, 0, i.RGBA, i.UNSIGNED_BYTE, null), i.bindRenderbuffer(i.RENDERBUFFER, this.renderBuffer), i.renderbufferStorage(i.RENDERBUFFER, i.DEPTH_STENCIL, t, e) } } , o.FilterTexture.prototype.destroy = function() { var t = this.gl; t.deleteFramebuffer(this.frameBuffer), t.deleteTexture(this.texture), this.frameBuffer = null, this.texture = null } , o.CanvasBuffer = function(t, e) { this.width = t, this.height = e, this.canvas = Phaser.CanvasPool.create(this, this.width, this.height), this.context = this.canvas.getContext("2d"), this.canvas.width = t, this.canvas.height = e } , o.CanvasBuffer.prototype.constructor = o.CanvasBuffer, o.CanvasBuffer.prototype.clear = function() { this.context.setTransform(1, 0, 0, 1, 0, 0), this.context.clearRect(0, 0, this.width, this.height) } , o.CanvasBuffer.prototype.resize = function(t, e) { this.width = this.canvas.width = t, this.height = this.canvas.height = e } , o.CanvasBuffer.prototype.destroy = function() { Phaser.CanvasPool.remove(this) } , o.CanvasMaskManager = function() {} , o.CanvasMaskManager.prototype.constructor = o.CanvasMaskManager, o.CanvasMaskManager.prototype.pushMask = function(t, e) { var i = e.context; i.save(); var n = t.alpha
, s = t.worldTransform , r = e.resolution; i.setTransform(s.a * r, s.b * r, s.c * r, s.d * r, s.tx * r, s.ty * r), o.CanvasGraphics.renderGraphicsMask(t, i), i.clip(), t.worldAlpha = n } , o.CanvasMaskManager.prototype.popMask = function(t) { t.context.restore() } , o.CanvasTinter = function() {} , o.CanvasTinter.getTintedTexture = function(t, e) { var i = t.tintedTexture || Phaser.CanvasPool.create(this); return o.CanvasTinter.tintMethod(t.texture, e, i), i } , o.CanvasTinter.tintWithMultiply = function(t, e, i) { var n = i.getContext("2d") , s = t.crop , o = s.width , r = s.height; t.rotated && (o = r, r = s.width), i.width === o && i.height === r || (i.width = o, i.height = r), n.clearRect(0, 0, o, r), n.fillStyle = "#" + ("00000" + (0 | e).toString(16)).substr(-6), n.fillRect(0, 0, o, r), n.globalCompositeOperation = "multiply", n.drawImage(t.baseTexture.source, s.x, s.y, o, r, 0, 0, o, r), n.globalCompositeOperation = "destination-atop", n.drawImage(t.baseTexture.source, s.x, s.y, o, r, 0, 0, o, r) } , o.CanvasTinter.tintWithPerPixel = function(t, e, i) { var n = i.getContext("2d") , s = t.crop , r = s.width , a = s.height; t.rotated && (r = a, a = s.width), i.width === r && i.height === a || (i.width = r, i.height = a), n.globalCompositeOperation = "copy", n.drawImage(t.baseTexture.source, s.x, s.y, r, a, 0, 0, r, a); for (var h = Phaser.Color.hexToRGBArray(e), l = h[0], c = h[1], u = h[2], d = n.getImageData(0, 0, r, a), p = d.data, f = 0; f < p.length; f += 4) if (p[f + 0] *= l, p[f + 1] *= c, p[f + 2] *= u, !o.CanvasTinter.canHandleAlpha) { var m = p[f + 3]; p[f + 0] /= 255 / m, p[f + 1] /= 255 / m, p[f + 2] /= 255 / m
} n.putImageData(d, 0, 0) } , o.CanvasRenderer = function(t) { this.game = t, o.defaultRenderer || (o.defaultRenderer = this), this.type = Phaser.CANVAS, this.resolution = t.resolution, this.clearBeforeRender = t.clearBeforeRender, this.transparent = t.transparent, this.autoResize = !1, this.width = t.width * this.resolution, this.height = t.height * this.resolution, this.view = t.canvas, this.context = this.view.getContext("2d", { alpha: this.transparent }), this.refresh = !0, this.count = 0, this.maskManager = new o.CanvasMaskManager, this.renderSession = { context: this.context, maskManager: this.maskManager, scaleMode: null, smoothProperty: Phaser.Canvas.getSmoothingPrefix(this.context), roundPixels: !1 }, this.mapBlendModes(), this.resize(this.width, this.height) } , o.CanvasRenderer.prototype.constructor = o.CanvasRenderer, o.CanvasRenderer.prototype.render = function(t) { this.context.setTransform(1, 0, 0, 1, 0, 0), this.context.globalAlpha = 1, this.renderSession.currentBlendMode = 0, this.renderSession.shakeX = this.game.camera._shake.x, this.renderSession.shakeY = this.game.camera._shake.y, this.context.globalCompositeOperation = "source-over", navigator.isCocoonJS && this.view.screencanvas && (this.context.fillStyle = "black", this.context.clear()), this.clearBeforeRender && (this.transparent ? this.context.clearRect(0, 0, this.width, this.height) : t._bgColor && (this.context.fillStyle = t._bgColor.rgba, this.context.fillRect(0, 0, this.width, this.height))), this.renderDisplayObject(t) } , o.CanvasRenderer.prototype.setTexturePriority = function(t) {} , o.CanvasRenderer.prototype.destroy = function(t) { void 0 === t && (t = !0), t && this.view.parent && this.view.parent.removeChild(this.view), this.view = null, this.context = null, this.maskManager = null, this.renderSession = null
} , o.CanvasRenderer.prototype.resize = function(t, e) { this.width = t * this.resolution, this.height = e * this.resolution, this.view.width = this.width, this.view.height = this.height, this.autoResize && (this.view.style.width = this.width / this.resolution + "px", this.view.style.height = this.height / this.resolution + "px"), this.renderSession.smoothProperty && (this.context[this.renderSession.smoothProperty] = this.renderSession.scaleMode === o.scaleModes.LINEAR) } , o.CanvasRenderer.prototype.renderDisplayObject = function(t, e, i) { this.renderSession.context = e || this.context, this.renderSession.resolution = this.resolution, t._renderCanvas(this.renderSession, i) } , o.CanvasRenderer.prototype.mapBlendModes = function() { if (!o.blendModesCanvas) { var t = [] , e = o.blendModes , i = this.game.device.canUseMultiply; t[e.NORMAL] = "source-over", t[e.ADD] = "lighter", t[e.MULTIPLY] = i ? "multiply" : "source-over", t[e.SCREEN] = i ? "screen" : "source-over", t[e.OVERLAY] = i ? "overlay" : "source-over", t[e.DARKEN] = i ? "darken" : "source-over", t[e.LIGHTEN] = i ? "lighten" : "source-over", t[e.COLOR_DODGE] = i ? "color-dodge" : "source-over", t[e.COLOR_BURN] = i ? "color-burn" : "source-over", t[e.HARD_LIGHT] = i ? "hard-light" : "source-over", t[e.SOFT_LIGHT] = i ? "soft-light" : "source-over", t[e.DIFFERENCE] = i ? "difference" : "source-over", t[e.EXCLUSION] = i ? "exclusion" : "source-over", t[e.HUE] = i ? "hue" : "source-over", t[e.SATURATION] = i ? "saturation" : "source-over", t[e.COLOR] = i ? "color" : "source-over", t[e.LUMINOSITY] = i ? "luminosity" : "source-over", o.blendModesCanvas = t } } , o.BaseTexture = function(t, e, i) { this.resolution = i || 1, this.width = 100, this.height = 100, this.scaleMode = e || o.scaleModes.DEFAULT, this.hasLoaded = !1, this.source = t, this.premultipliedAlpha = !0, this._glTextures = [], this.mipmap = !1, this.textureIndex = 0, this._dirty = [!0, !0, !0, !0],
t && ((this.source.complete || this.source.getContext) && this.source.width && this.source.height && (this.hasLoaded = !0, this.width = this.source.naturalWidth || this.source.width, this.height = this.source.naturalHeight || this.source.height, this.dirty()), this.skipRender = !1, this._powerOf2 = !1) } , o.BaseTexture.prototype.constructor = o.BaseTexture, o.BaseTexture.prototype.forceLoaded = function(t, e) { this.hasLoaded = !0, this.width = t, this.height = e, this.dirty() } , o.BaseTexture.prototype.destroy = function() { this.source && Phaser.CanvasPool.removeByCanvas(this.source), this.source = null, this.unloadFromGPU() } , o.BaseTexture.prototype.updateSourceImage = function(t) { console.warn("PIXI.BaseTexture.updateSourceImage is deprecated. Use Phaser.Sprite.loadTexture instead.") } , o.BaseTexture.prototype.dirty = function() { for (var t = 0; t < this._glTextures.length; t++) this._dirty[t] = !0 } , o.BaseTexture.prototype.unloadFromGPU = function() { this.dirty(); for (var t = this._glTextures.length - 1; t >= 0; t--) { var e = this._glTextures[t] , i = o.glContexts[t]; i && e && i.deleteTexture(e) } this._glTextures.length = 0, this.dirty() } , o.BaseTexture.fromCanvas = function(t, e, i) { return 0 === t.width && (t.width = 1), 0 === t.height && (t.height = 1), i = i || 1, new o.BaseTexture(t,e,i) } , o.TextureSilentFail = !1, o.Texture = function(t, e, i, n) { this.noFrame = !1, e || (this.noFrame = !0, e = new o.Rectangle(0,0,1,1)), t instanceof o.Texture && (t = t.baseTexture), this.baseTexture = t, this.frame = e,
this.trim = n, this.valid = !1, this.isTiling = !1, this.requiresUpdate = !1, this.requiresReTint = !1, this._uvs = null, this.width = 0, this.height = 0, this.crop = i || new o.Rectangle(0,0,1,1), this.rotated = !1, t.hasLoaded && (this.noFrame && (e = new o.Rectangle(0,0,t.width,t.height)), this.setFrame(e)) } , o.Texture.prototype.constructor = o.Texture, o.Texture.prototype.onBaseTextureLoaded = function() { var t = this.baseTexture; this.noFrame && (this.frame = new o.Rectangle(0,0,t.width,t.height)), this.setFrame(this.frame) } , o.Texture.prototype.destroy = function(t) { t && this.baseTexture.destroy(), this.valid = !1 } , o.Texture.prototype.setFrame = function(t) { if (this.noFrame = !1, this.frame = t, this.width = t.width, this.height = t.height, this.crop.x = t.x, this.crop.y = t.y, this.crop.width = t.width, this.crop.height = t.height, !this.trim && (t.x + t.width > this.baseTexture.width || t.y + t.height > this.baseTexture.height)) { if (!o.TextureSilentFail) throw new Error("Texture Error: frame does not fit inside the base Texture dimensions " + this); return void (this.valid = !1) } this.valid = t && t.width && t.height && this.baseTexture.source && this.baseTexture.hasLoaded, this.trim && (this.width = this.trim.width, this.height = this.trim.height, this.frame.width = this.trim.width, this.frame.height = this.trim.height), this.valid && this._updateUvs() } , o.Texture.prototype._updateUvs = function() { this._uvs || (this._uvs = new o.TextureUvs); var t = this.crop , e = this.baseTexture.width , i = this.baseTexture.height; this._uvs.x0 = t.x / e, this._uvs.y0 = t.y / i,
this._uvs.x1 this._uvs.y1 this._uvs.x2 this._uvs.y2 this._uvs.x3 this._uvs.y3
= = = = = =
(t.x + t.width) / e, t.y / i, (t.x + t.width) / e, (t.y + t.height) / i, t.x / e, (t.y + t.height) / i
} , o.Texture.prototype._updateUvsInverted = function() { this._uvs || (this._uvs = new o.TextureUvs); var t = this.crop , e = this.baseTexture.width , i = this.baseTexture.height; this._uvs.x0 = t.x / e, this._uvs.y0 = t.y / i, this._uvs.x1 = (t.x + t.height) / e, this._uvs.y1 = t.y / i, this._uvs.x2 = (t.x + t.height) / e, this._uvs.y2 = (t.y + t.width) / i, this._uvs.x3 = t.x / e, this._uvs.y3 = (t.y + t.width) / i } , o.Texture.fromCanvas = function(t, e) { var i = o.BaseTexture.fromCanvas(t, e); return new o.Texture(i) } , o.TextureUvs = function() { this.x0 = 0, this.y0 = 0, this.x1 = 0, this.y1 = 0, this.x2 = 0, this.y2 = 0, this.x3 = 0, this.y3 = 0 } , void 0 !== e ? (void 0 !== t && t.exports && (e = t.exports = o), e.PIXI = o) : "undefined" != typeof define && define.amd ? define("PIXI", function() { return s.PIXI = o }()) : s.PIXI = o, o } ).call(this) } , function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n = i(19) , s = function() { function t(t) { var e = this; this.state = t, this.window = document.getElementById("respawn-window"),
this.button = document.getElementById("respawn-button"), this.ad = document.getElementById("respawn-ad"), this.button.onclick = function() { e.requestRespawn() }
} return t.prototype.requestRespawn = function() { if (this.seconds < 1) { this.stop(); var t = this; n.default.play(function() { t.state.request_respawn() }) } } , t.prototype.show = function() { this.state.game.time.events.add(2 * Phaser.Timer.SECOND, function() { this.reallyShow() }, this), this.state.game.time.events.add(3 * Phaser.Timer.SECOND, function() { this.ad.style.display = "block" }, this) } , t.prototype.reallyShow = function() { var t = this; this.window.style.display = "block", this.button.className = "inactive", this.seconds = 5, this.button.innerText = "Spawn in " + this.seconds + " seconds..", this.interval = setInterval(function() { t.update() }, 1e3) } , t.prototype.update = function() { this.seconds -= 1, this.seconds < 1 ? (clearInterval(this.interval), this.button.innerText = "Spawn", this.button.className = "active") : this.button.innerText = "Spawn in " + this.seconds + " seconds.." } , t.prototype.stop = function() { this.ad.style.display = "none", this.window.style.display = "none" } , t }(); e.default = s } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(5) , r = i(4) , a = i(6) , h = i(2) , l = i(165) , c = i(11) , u = i(160) , d = i(13) , p = i(12) , f = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_1,h.Atlases.AtlasesWhitewalker.getName(),new Phaser.Point(.5,.55))), s.addComponent(new p.default), s.addComponent(new c.default(100)), s.addComponent(new d.default), s } return n(e, t), e }(s.Entity); e.WhiteWalker = f; var m = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesPig.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s.addComponent(new d.default), s }
return n(e, t), e }(s.Entity); e.Pig = m; var g = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesChicken.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s.addComponent(new d.default), s } return n(e, t), e }(s.Entity); e.Chicken = g; var y = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesWolf.getName(),new Phaser.Point(.5,.5))), s.addComponent(new u.default), s.addComponent(new c.default(50)), s.addComponent(new d.default), s } return n(e, t), e }(s.Entity); e.Wolf = y; var v = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesBear.getName(),new Phaser.Point(.5,.5))), s.addComponent(new u.default), s.addComponent(new c.default(50)), s.addComponent(new d.default), s } return n(e, t), e }(s.Entity); e.Bear = v; var b = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default),
s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesWhitebear.getName(),new Phaser.Point(.5,.5))), s.addComponent(new u.default), s.addComponent(new c.default(50)), s.addComponent(new d.default), s } return n(e, t), e }(s.Entity); e.WhiteBear = b; var w = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesCarpig.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.RideablePig = w; var x = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesCarwolf.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.RideableWolf = x; var _ = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesRideablebear.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.RideableBear = _ } , function(t, e, i) {
"use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(5) , r = i(4) , a = i(6) , h = i(12) , l = i(21) , c = i(2) , u = i(11) , d = i(13) , p = i(23) , f = i(22) , m = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_1,c.Atlases.AtlasesKnight.getName(),new Phaser.Point(.485,.533))), s.addComponent(new h.default), s.addComponent(new l.default), s.addComponent(new u.default(50)), s.addComponent(new d.default), s.addComponent(new p.default), n === e.id && s.addComponent(new f.default(50)).setPlayerName("Mercenary"), s } return n(e, t), e }(s.Entity); e.FollowerBot = m; var g = function(t) { function e(e, i, n) {
var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_1,c.Atlases.AtlasesGardener.getName(),new Phaser.Point(.485,.533))), s.addComponent(new h.default), s.addComponent(new l.default), s.addComponent(new u.default(50)), s.addComponent(new d.default), s.addComponent(new p.default), n === e.id && s.addComponent(new f.default(50)).setPlayerName("Peasant"), s } return n(e, t), e }(s.Entity); e.FarmerBot = g; var y = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_1,c.Atlases.AtlasesGuard.getName(),new Phaser.Point(.485,.533))), s.addComponent(new h.default), s.addComponent(new l.default), s.addComponent(new u.default(50)), s.addComponent(new d.default), s.addComponent(new p.default), n === e.id && s.addComponent(new f.default(50)).setPlayerName("Guard"), s } return n(e, t), e }(s.Entity); e.GuardBot = y; var v = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_1,c.Atlases.AtlasesDarkguard.getName(),new Phaser.Point(.485,.533))), s.addComponent(new h.default), s.addComponent(new l.default), s.addComponent(new u.default(50)), s.addComponent(new d.default), s.addComponent(new p.default), n === e.id && s.addComponent(new f.default(50)).setPlayerName("Guard"), s } return n(e, t), e }(s.Entity); e.DarkGuardBot = v;
var b = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_1,c.Atlases.AtlasesPickupbot.getName(),new Phaser.Point(.485,.533))), s.addComponent(new h.default), s.addComponent(new l.default), s.addComponent(new u.default(50)), s.addComponent(new d.default), s.addComponent(new p.default), n === e.id && s.addComponent(new f.default(50)).setPlayerName("Gardener"), s } return n(e, t), e }(s.Entity); e.GardenBot = b } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(5) , r = i(4) , a = i(6) , h = i(2) , l = i(20) , c = i(164) , u = i(161) , d = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this;
return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_FOREGROUND_0,h.Images.ImagesWoodwall.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.WoodBlock = d; var p = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_FOREGROUND_0,h.Images.ImagesDarkstonewall.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.DarkStoneBlock = p; var f = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_FOREGROUND_0,h.Images.ImagesStonewall.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.StoneBlock = f; var m = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesDoor.getName(),new Phaser.Point(.5,.5))), s.addComponent(new c.default), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.Door = m; var g = function(t) {
function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Atlases.AtlasesDarkdoor.getName(),new Phaser.Point(.5,.5))), s.addComponent(new c.default), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.DarkDoor = g; var y = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_BACKGROUND_0,h.Images.ImagesGarden.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.Garden = y; var v = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_BACKGROUND_0,h.Images.ImagesWoodspikes.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.WoodSpikes = v; var b = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_BACKGROUND_0,h.Images.ImagesPortal.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity);
e.Portal = b; var w = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_FOREGROUND_0,h.Images.ImagesTower.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.Tower = w; var x = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_FOREGROUND_0,h.Images.ImagesHeartstone.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.Heartstone = x; var _ = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_1,h.Images.ImagesFoodcrate.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.FoodCrate = _; var P = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_1,h.Images.ImagesWoodcrate.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e
}(s.Entity); e.WoodCrate = P; var T = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_1,h.Images.ImagesStonecrate.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.StoneCrate = T; var C = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Images.ImagesMannequin.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.Mannequin = C; var S = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default(!0,!1)), s.addComponent(new a.default(e.LAYER_MIDDLE_0,h.Images.ImagesSoccerball.getName(),new Phaser.Point(.5,.5))), s.addComponent(new u.default), s } return n(e, t), e }(s.Entity); e.SoccerBall = S } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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])
} ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(8) , o = function(t) { function e() { return t.call(this) || this } return n(e, t), e.prototype.start = function() { t.prototype.start.call(this), this.entity.on("senddamage", this.onSendDamage.bind(this)), this.addAnimation("walk", Phaser.Animation.generateFrameNames("walk", 1, 8, ".png", 0), 15, !0), this.addAnimation("punch", Phaser.Animation.generateFrameNames("hit", 1, 8, ".png", 0), 30, !1).onComplete.add(function() { this.walk() } .bind(this)), this.walk() } , e.prototype.walk = function() { this.play("walk") } , e.prototype.onSendDamage = function(t) { this.play("punch") } , e.prototype.update = function(e) { t.prototype.update.call(this, e), "punch" !== this.getCurrentName() && "pigpunch" !== this.getCurrentName() && (this.cachedTransform.isMoving() ? this.walk() : this.cachedSpriteComponent.sprite.animations.stop()) } , e.prototype.destroy = function() {} , e }(s.default); e.default = o } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(8) , o = function(t) { function e() { return t.call(this) || this } return n(e, t), e.prototype.start = function() { t.prototype.start.call(this) } , e.prototype.update = function(e) { t.prototype.update.call(this, e), this.cachedTransform.isMoving() ? this.cachedTransform.rotation += . 01 : this.cachedSpriteComponent.sprite.animations.stop() } , e.prototype.destroy = function() {} , e }(s.default); e.default = o } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() {
this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype,
new n)
}
}(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = function() { function t(t) { this.container = document.createElement("div"), this.container.innerText = t, this.container.style.left = "0px", this.container.style.top = "0px", this.container.className = "speechbubble", document.body.appendChild(this.container) } return t.prototype.setPosition = function(t, e) { t = Math.round(t), e = Math.round(e); var i = this.container.offsetWidth , n = this.container.offsetHeight; t -= i / 2, e -= n, this.container.style.left = t + "px", this.container.style.top = e + "px" } , t.prototype.setText = function(t) { this.container.innerText = t } , t.prototype.destroy = function() { this.container.parentElement.removeChild(this.container) } , t }() , r = function(t) { function e(e) { var i = t.call(this) || this; return i.chatBubble = null, i.chatBubbleTimer = null, i.offset = e, i } return n(e, t), e.prototype.start = function() { t.prototype.start.call(this), this.cachedTransform = this.entity.components.transform, this.cachedSprite = this.entity.components.sprite, this.entity.on("chatmessage", this.onChatMessage.bind(this)) } , e.prototype.onChatMessage = function(t) {
this.chatBubble ? (this.world.game.time.events.remove(this.chatBubbleTimer), this.chatBubble.setText(t)) : this.chatBubble = new o(t), this.align(), this.chatBubbleTimer = this.world.game.time.events.add(7 * Phaser.Timer.SECOND, function() { this.chatBubble && (this.chatBubble.destroy(), this.chatBubble = null) }, this) } , e.prototype.align = function() { if (this.chatBubble) { var t = this.cachedTransform.position.y + this.offset; if (this.cachedSprite && (t -= this.cachedSprite.sprite.height / 2), this.world.game.scale.scaleMode === Phaser.ScaleManager.USER_SCALE) { var e = this.cachedTransform.position.x this.world.game.camera.x; e = e / this.world.game.scale.scaleFactor.x this.world.game.screenOffsetWidth, t -= this.world.game.camera.y, t = t / this.world.game.scale.scaleFactor.y this.world.game.screenOffsetHeight, this.chatBubble.setPosition(e, t) } else this.chatBubble.setPosition(this.cachedTransform.position.x this.world.game.camera.x, t - this.world.game.camera.y) } } , e.prototype.update = function(e) { t.prototype.update.call(this, e), this.align() } , e.prototype.destroy = function() { this.chatBubble && (this.chatBubble.destroy(), this.chatBubble = null) } , e }(s.Component); e.default = r } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ;
return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(3) , r = o.Protocol.MessageType , a = function() { function t(t, e) { this.callback = t, this.cancelcallback = e, this.container = document.createElement("div"), this.container.style.left = "0px", this.container.style.top = "0px", this.container.style.position = "absolute", this.container.className = "speechbubble", this.input = document.createElement("input"), this.input.type = "text", this.input.maxLength = 60, this.container.appendChild(this.input); var i = this; this.input.addEventListener("keydown", function(t) { 13 === t.keyCode && (i.send(), t.stopImmediatePropagation()) }), this.input.addEventListener("keydown", function(t) { 27 === t.keyCode && i.cancel() }), document.body.appendChild(this.container), this.input.focus() } return t.prototype.cancel = function() { this.cancelcallback() } , t.prototype.send = function() { this.callback(this.input.value) } , t.prototype.setposition = function(t, e) { t = Math.round(t), e = Math.round(e); var i = this.container.offsetWidth , n = this.container.offsetHeight; t -= i / 2, e -= n, this.container.style.left = t + "px", this.container.style.top = e + "px" } ,
t.prototype.destroy = function() { this.container.parentElement.removeChild(this.container) } , t
}() , h = function(t) { function e(e) { var i = t.call(this) || this; return i.id = "chatinput", i.chatInput = null, i.offset = e, i } return n(e, t), e.prototype.start = function() { t.prototype.start.call(this), this.cachedTransform = this.entity.components.transform, this.cachedSprite = this.entity.components.sprite, this.returnKey = this.world.game.input.keyboard.addKey(Phaser.Keyboard.ENTER), this.returnKey.onDown.add(this.onReturnKey, this), this.escapeKey = this.world.game.input.keyboard.addKey(Phaser.Keyboard.ESC) } , e.prototype.onReturnKey = function() { this.chatInput || (this.chatInput = new a(this.onChatRequest.bind(this),this.onChatCancel.bind(this)), this.align(), this.world.game.input.keyboard.enabled = !1) } , e.prototype.onChatRequest = function(t) { this.chatInput && (this.world.socket.sendMessage(r.PlayerChatRequest, { message: t }), this.stopInput()) } , e.prototype.onChatCancel = function() { this.stopInput() } , e.prototype.stopInput = function() { this.chatInput && (this.chatInput.destroy(), this.world.game.input.keyboard.reset(!1), this.world.game.input.keyboard.enabled = !0, this.chatInput = null) } , e.prototype.align = function() { if (this.chatInput) { var t = this.cachedTransform.position.y + this.offset; if (this.cachedSprite && (t -= this.cachedSprite.sprite.height / 2), this.world.game.scale.scaleMode === Phaser.ScaleManager.USER_SCALE) { var e = this.cachedTransform.position.x -
this.world.game.camera.x; e = e / this.world.game.scale.scaleFactor.x this.world.game.screenOffsetWidth, t -= this.world.game.camera.y, t = t / this.world.game.scale.scaleFactor.y this.world.game.screenOffsetHeight, this.chatInput.setposition(e, t) } else this.chatInput.setposition(this.cachedTransform.position.x this.world.game.camera.x, t - this.world.game.camera.y) } } , e.prototype.update = function(e) { t.prototype.update.call(this, e), this.align(), this.escapeKey.isDown && this.stopInput() } , e.prototype.destroy = function() { this.stopInput(), this.returnKey.onDown.remove(this.onReturnKey, this) } , e }(s.Component); e.default = h } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(8) , o = function(t) { function e() { var e = t.call(this) || this; return e.isOpened = !1,
e } return n(e, t), e.prototype.start = function() { t.prototype.start.call(this), this.entity.on("networksync", this.onNetworkSync.bind(this)) } , e.prototype.set = function(t) { this.cachedSpriteComponent.sprite.frameName = t } , e.prototype.onNetworkSync = function(t) { var e = !1; t.hasOwnProperty("isOpened") && (this.isOpened = t.isOpened, e = !0), e && (this.isOpened ? this.set("door_open.png") : this.set("door_close.png")) } , e }(s.default); e.default = o } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(8) , o = function(t) { function e() { return t.call(this) || this } return n(e, t), e.prototype.start = function() { t.prototype.start.call(this), this.addAnimation("walk", Phaser.Animation.generateFrameNames("walk",
1, 8, ".png", 0), 15, !0), this.walk() } , e.prototype.walk = function() { this.play("walk") } , e.prototype.update = function(e) { t.prototype.update.call(this, e), this.cachedTransform.isMoving() ? this.walk() : this.cachedSpriteComponent.sprite.animations.stop() } , e.prototype.destroy = function() {} , e }(s.default); e.default = o } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(3) , r = o.Protocol.HatType , a = i(2) , h = function(t) { function e(e) { var i = t.call(this) || this; return i.id = "hat", i.hatId = -1, i.currentTintColor = 16777215, i.currentScale = 1, i.layer = e, i
} return n(e, t), e.prototype.start = function() { this.cachedTransform = this.entity.components.transform, this.entity.on("networksync", this.onNetworkSync.bind(this)) } , e.prototype.update = function(t) { if (this.hatSprite && (this.hatSprite.position.copyFrom(this.cachedTransform.position), this.hatSprite.rotation = this.cachedTransform.rotation, this.hatId === r.ChessHat)) { var e = this.hatSprite.getChildAt(0); e && (e.rotation = e.rotation + .1, e.rotation > 100 && (e.rotation = e.rotation % Math.PI)) } } , e.prototype.onNetworkSync = function(t) { t.hasOwnProperty("hatId") && this.hatId !== t.hatId && this.setHat(t.hatId) } , e.prototype.setHat = function(t) { if (this.hatId = t, this.hatSprite && (this.hatSprite.destroy(), this.hatSprite = null), t > -1) { if (this.hatSprite = this.layer.create(this.cachedTransform.position.x, this.cachedTransform.position.y, this.getHatSprite(t)), this.hatSprite.anchor.set(.5, .5), t === r.ChessHat) { var e = this.world.game.make.image(0, 0, a.Images.ImagesChesshatrot.getName()); e.anchor.set(.5, .5), this.hatSprite.addChild(e), e.position.set(0, 0) } this.setScale(this.currentScale), this.setColor(this.currentTintColor) } } , e.prototype.getHatSprite = function(t) { return t === r.WhiteBearHat ? a.Images.ImagesWhitebearhat.getName() : t === r.BrownBearHat ? a.Images.ImagesBrownbearhat.getName() : t === r.ChessHat ? a.Images.ImagesChesshat.getName() : t === r.CowboyHat ? a.Images.ImagesCowboyhat.getName() : t === r.ChickenHat ? a.Images.ImagesChickenhat.getName() : t === r.FoxHat ? a.Images.ImagesFoxhat.getName() : t === r.VikingHat ? a.Images.ImagesVikinghat.getName() : t === r.BuilderHat ? a.Images.ImagesBuilderhat.getName() : t === r.HockeyHat ? a.Images.ImagesHockeyhat.getName() : t === r.TankHat ? a.Images.ImagesTankhat.getName() : t === r.DruidHat ? a.Images.ImagesDruidhat.getName() : t === r.IceHat ? a.Images.ImagesIcehat.getName() : a.Images.ImagesWhitebearhat.getName() } ,
e.prototype.setScale = function(t) { this.currentScale = t, this.hatSprite && this.hatSprite.scale.set(t, t) } , e.prototype.setColor = function(t) { this.currentTintColor = t, this.hatSprite && (this.hatSprite.tint = t) } , e.prototype.getHatId = function() { return this.hatId } , e.prototype.destroy = function() { this.hatSprite && (this.hatSprite.destroy(), this.hatSprite = null) } , e }(s.Component); e.default = h } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(4) , r = function(t) { function e() { var e = t.call(this) || this; return e.id = "localrotationinput", e.lockTimeout = 0, e } return n(e, t),
e.prototype.start = function() { this.cachedTransform = this.entity.components.transform, this.entity.on("senddamage", this.onSendDamage.bind(this)) } , e.prototype.onSendDamage = function(t) { this.lockTimeout = .5, this.latestPunchRotation = Phaser.Math.angleBetween(0, 0, t.directionX, t.directionY) + Phaser.Math.degToRad(90) } , e.prototype.update = function(t) { if (this.lockTimeout > 0) this.lockTimeout -= t, this.cachedTransform.rotation = this.latestPunchRotation; else { var e = Phaser.Math.angleBetween(0, 0, this.world.game.input.activePointer.worldX - this.cachedTransform.position.x, this.world.game.input.activePointer.worldY - this.cachedTransform.position.y); e += Phaser.Math.degToRad(90), e = parseFloat(e.toPrecision(2)), this.cachedTransform.rotation = o.RotationInterpolator.interpolateAngle(this.cachedTransform.rotation, e, 12 * t) } } , e.prototype.destroy = function() {} , e }(s.Component); e.default = r } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0)
, , , ,
o = i(3) r = o.Protocol.MessageType a = i(15) h = function(t) { function e() { var e = t.call(this) || this; return e.id = "networkinput", e.currentInput = new Phaser.Point, e.currentRotation = 0, e.previousInput = new Phaser.Point, e.previousRotation = 0, e.punchDirection = new Phaser.Point, e.needSendPunch = !1, e._lockPunchUntilMouseUp = !1, e } return n(e, t), e.prototype.lockPunchUntilMouseUp = function() { this._lockPunchUntilMouseUp = !0 } , e.prototype.onNetworkSend = function() { this.previousInput.equals(this.currentInput) && this.previousRotation === this.currentRotation || (this.world.socket.sendMessage(r.PlayerInput, { x: this.currentInput.x, y: this.currentInput.y, rotation: this.currentRotation }), this.previousInput.copyFrom(this.currentInput), this.previousRotation = this.currentRotation), this.needSendPunch && (this.punchDirection.normalize(), this.world.socket.sendMessage(r.PlayerAction, { x: this.punchDirection.x, y: this.punchDirection.y, action: 0 }), this.needSendPunch = !1) } , e.prototype.start = function() { this.cachedTransform = this.entity.components.transform, this.entity.on("networksend", this.onNetworkSend.bind(this)), this.cursors = this.world.game.input.keyboard.createCursorKeys(), this.wasd = { up: this.world.game.input.keyboard.addKey(Phaser.Keyboard.W), down: this.world.game.input.keyboard.addKey(Phaser.Keyboard.S), left: this.world.game.input.keyboard.addKey(Phaser.Keyboard.A), right: this.world.game.input.keyboard.addKey(Phaser.Keyboard.D) }, this.world.game.input.onDown.add(this.onMouseDown, this) } , e.prototype.onMouseDown = function() { this.world.services.getService(a.default).inProgress() || (this.punchDirection.set(this.world.game.input.activePointer.worldX this.cachedTransform.position.x, this.world.game.input.activePointer.worldY this.cachedTransform.position.y), this.needSendPunch = !0, this.entity.emit("sendpunch"))
} , e.prototype.update = function(t) { var e = 0 , i = 0; this.cursors.up.isDown || this.wasd.up.isDown ? i = -1 : (this.cursors.down.isDown || this.wasd.down.isDown) && (i = 1), this.cursors.left.isDown || this.wasd.left.isDown ? e = -1 : (this.cursors.right.isDown || this.wasd.right.isDown) && (e = 1), this.currentInput.set(e, i); var n = Phaser.Math.angleBetween(0, 0, this.world.game.input.activePointer.worldX - this.cachedTransform.position.x, this.world.game.input.activePointer.worldY - this.cachedTransform.position.y); n += Phaser.Math.degToRad(90), n = parseFloat(n.toPrecision(2)), this.currentRotation = n, this.world.game.input.activePointer.isDown ? this._lockPunchUntilMouseUp || this.onMouseDown() : this._lockPunchUntilMouseUp && (this._lockPunchUntilMouseUp = !1) } , e.prototype.destroy = function() { this.world.game.input.onDown.remove(this.onMouseDown, this) } , e }(s.Component); e.default = h } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(2) , r = function(t) { function e(e) {
var i = t.call(this) || this; return i.id = "teamlabel", i.labelColor = "#ffffff", i.isAdmin = !1, i.offset = e, i } return n(e, t), e.prototype.start = function() { this.entity.on("networksync", this.onNetworkSync.bind(this)), this.cachedTransform = this.entity.components.transform, this.cachedSprite = this.entity.components.sprite, this.label = this.world.game.add.text(this.cachedTransform.position.x, this.cachedTransform.position.y + this.offset - this.cachedSprite.sprite.height / 2, "", { fontSize: "18px", font: "Roboto Mono" }), this.label.anchor.set(.5, 1), this.label.stroke = "rgba(0,0,0,0.7)", this.label.strokeThickness = 3, this.label.fill = this.labelColor, this.crownImage = this.world.make.image(this.cachedTransform.position.x, this.cachedTransform.position.y + this.offset - this.cachedSprite.sprite.height / 2, o.Images.ImagesCrown.getName()), this.crownImage.anchor.set(.5, .5) } , e.prototype.setTeamName = function(t) { this.teamName = t, this.label.setText(this.teamName) } , e.prototype.setColor = function(t) { this.labelColor = t, this.label.fill = this.labelColor } , e.prototype.align = function() { var t = this.cachedTransform.position.x , e = this.cachedTransform.position.y + this.offset this.cachedSprite.sprite.height / 2; this.label.position.set(t, e), this.crownImage.position.set(t, e - 45) } , e.prototype.onNetworkSync = function(t) { var e = !1; t.hasOwnProperty("teamName") && (this.teamName = t.teamName, e = !0), t.hasOwnProperty("isTeamAdmin") && (this.isAdmin = t.isTeamAdmin, e = !0), e && (this.teamName ? this.label.setText("[" + this.teamName + "]") : this.label.setText(""), this.isAdmin ? this.crownImage.parent !== this.world.LAYER_UI && this.world.LAYER_UI.add(this.crownImage) : this.crownImage.parent === this.world.LAYER_UI && this.crownImage.parent.removeChild(this.crownImage)) }
, e.prototype.update = function(t) { this.align() } , e.prototype.destroy = function() { this.label.destroy(), this.crownImage.destroy() } , e }(s.Component); e.default = r
} , function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n = i(0) , s = i(25) , o = i(24) , r = i(157) , a = i(3) , h = a.Protocol.EntityType , l = i(172) , c = i(171) , u = i(159) , d = i(158) , p = i(173) , f = function() { function t() {} return t.create = function(t, e, i, a) { return void 0 === a && (a = -1), t === h.Spectator ? new s.default(e,i,a) : t === h.Player ? new o.default(e,i,a) : t === h.FollowerBot ? new d.FollowerBot(e,i,a) : t === h.FarmerBot ? new d.FarmerBot(e,i,a) : t === h.GuardBot ? new d.GuardBot(e,i,a) : t === h.WoodGenerator ? new c.WoodGenerator(e,i,a) : t === h.StoneGenerator ? new c.StoneGenerator(e,i,a) : t === h.Pig ? new r.Pig(e,i,a) : t === h.Chicken ? new r.Chicken(e,i,a) : t === h.Wolf ? new r.Wolf(e,i,a) : t === h.Bear ? new r.Bear(e,i,a) : t === h.RideablePig ? new r.RideablePig(e,i,a) : t === h.PigMeatPickup ? new l.PigMeatPickup(e,i,a) : t === h.BearMeatPickup ? new l.BearMeatPickup(e,i,a) : t === h.EggPickup ? new l.EggPickup(e,i,a) : t === h.CarrotPickup ? new l.CarrotPickup(e,i,a) : t === h.BoxPickup ? new l.BoxPickup(e,i,a) : t === h.WoodBlock ? new u.WoodBlock(e,i,a) : t === h.StoneBlock ? new u.StoneBlock(e,i,a) : t === h.Door ? new u.Door(e,i,a) : t === h.Garden ? new u.Garden(e,i,a) : t === h.Tower ? new u.Tower(e,i,a) : t === h.Heartstone ? new u.Heartstone(e,i,a) : t === h.FoodCrate ? new u.FoodCrate(e,i,a) : t === h.WoodCrate ? new u.WoodCrate(e,i,a) : t === h.StoneCrate ? new u.StoneCrate(e,i,a) : t === h.RideableWolf ? new r.RideableWolf(e,i,a) : t === h.Mannequin ? new u.Mannequin(e,i,a) : t === h.GardenBot ? new d.GardenBot(e,i,a) : t === h.WhiteBear ? new r.WhiteBear(e,i,a) : t === h.WinterStoneGenerator ? new c.WinterStoneGenerator(e,i,a) : t === h.WinterWoodGenerator ? new c.WinterWoodGenerator(e,i,a) : t === h.SoccerBall ? new u.SoccerBall(e,i,a) : t === h.FireballBullet ? new u.SoccerBall(e,i,a) : t === h.NightmareBoss ? new d.GardenBot(e,i,a) : t === h.WhiteWalker ? new r.WhiteWalker(e,i,a) : t === h.WinterWall ? new p.WinterWall(e,i,a) : t === h.WinterFloor ? new p.WinterFloor(e,i,a) : t === h.WinterTower ? new p.WinterTower(e,i,a) : t === h.WhiteBearHat ? new l.WhiteBearHat(e,i,a) : t === h.BrownBearHat ? new
l.BrownBearHat(e,i,a) : t === h.CowboyHat ? new l.CowboyHat(e,i,a) : t === h.ChessHat ? new l.ChessHat(e,i,a) : t === h.ChickenHat ? new l.ChickenHat(e,i,a) : t === h.CoinPickup ? new l.CoinPickup(e,i,a) : t === h.WoodSpikes ? new u.WoodSpikes(e,i,a) : t === h.Portal ? new u.Portal(e,i,a) : t === h.BuilderHat ? new l.BuilderHat(e,i,a) : t === h.FoxHat ? new l.FoxHat(e,i,a) : t === h.VikingHat ? new l.VikingHat(e,i,a) : t === h.HockeyHat ? new l.HockeyHat(e,i,a) : t === h.SoulPickup ? new l.SoulPickup(e,i,a) : t === h.RideableBear ? new r.RideableBear(e,i,a) : t === h.DarkDoor ? new u.DarkDoor(e,i,a) : t === h.DarkGuardBot ? new d.DarkGuardBot(e,i,a) : t === h.DarkStoneBlock ? new u.DarkStoneBlock(e,i,a) : t === h.TankHat ? new l.TankHat(e,i,a) : t === h.DruidHat ? new l.DruidHat(e,i,a) : t === h.IceHat ? new l.IceHat(e,i,a) : new n.Entity(e,i,a) } , t }(); e.EntityFactory = f } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(5) , r = i(4) , a = i(6) , h = i(2) , l = i(20) , c = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_FOREGROUND_0,h.Images.ImagesWoodgenerator.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default),
s } return n(e, t), e }(s.Entity); e.WoodGenerator = c; var u = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_BACKGROUND_0,h.Images.ImagesStonegenerator.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.StoneGenerator = u; var d = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_FOREGROUND_0,h.Images.ImagesWinterwoodgenerator.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.WinterWoodGenerator = d; var p = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_BACKGROUND_0,h.Images.ImagesWinterstonegenerator.getName(),new Phaser.Point(.5,.5))), s.addComponent(new l.default), s } return n(e, t), e }(s.Entity); e.WinterStoneGenerator = p } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(5) , r = i(4) , a = i(6) , h = i(2) , l = function(t) { function e(e, i, n, s, h) { var l = t.call(this, e, i, -1) || this; return l.addComponent(new o.default), l.addComponent(new r.default), l.addComponent(new a.default(n,s,h)), l } return n(e, t), e }(s.Entity); e.default = l; var c = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesMeat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.PigMeatPickup = c; var u = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesMeat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.BearMeatPickup = u; var d = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesEgg.getName(), new Phaser.Point(.5,.5)) || this }
return n(e, t), e }(l); e.EggPickup = d; var p = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesSoul.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.SoulPickup = p; var f = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_1, h.Images.ImagesCarrot.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.CarrotPickup = f; var m = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesBox.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.BoxPickup = m; var g = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesCoin.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.CoinPickup = g; var y = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesWhitebearhat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.WhiteBearHat = y; var v = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesBrownbearhat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.BrownBearHat = v; var b = function(t) {
function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesChesshat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.ChessHat = b; var w = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesCowboyhat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.CowboyHat = w; var x = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesChickenhat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.ChickenHat = x; var _ = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesVikinghat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.VikingHat = _; var P = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesFoxhat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.FoxHat = P; var T = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesBuilderhat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.BuilderHat = T; var C = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesHockeyhat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t),
e }(l); e.HockeyHat = C; var S = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesTankhat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.TankHat = S; var A = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesDruidhat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.DruidHat = A; var k = function(t) { function e(e, i, n) { return t.call(this, e, i, e.LAYER_BACKGROUND_0, h.Images.ImagesIcehat.getName(), new Phaser.Point(.5,.5)) || this } return n(e, t), e }(l); e.IceHat = k } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(0) , o = i(5)
, , , ,
r = i(4) a = i(6) h = i(2) l = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_FOREGROUND_0,h.Images.ImagesWinterwall.getName(),new Phaser.Point(.5,.5))), s } return n(e, t), e }(s.Entity); e.WinterWall = l; var c = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_BACKGROUND_0,h.Images.ImagesWinterfloor.getName(),new Phaser.Point(.5,.5))), s } return n(e, t), e }(s.Entity); e.WinterFloor = c; var u = function(t) { function e(e, i, n) { var s = t.call(this, e, i, n) || this; return s.addComponent(new o.default), s.addComponent(new r.default), s.addComponent(new a.default(e.LAYER_FOREGROUND_0,h.Images.ImagesWintertower.getName(),new Phaser.Point(.5,.5))), s } return n(e, t), e }(s.Entity); e.WinterTower = u } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ;
return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(10) , o = i(1) , r = i(3) , a = r.Protocol.MessageType , h = i(2) , l = i(17) , c = i(16) , u = function(t) { function e() { var e = t.call(this) || this; return e.element = document.getElementById("top-panel"), e } return n(e, t), e }(s.MenuContainer) , d = function(t) { function e(e, i, n, s, o) { var r = t.call(this, n, s) || this; return r.world = e, r.element.className = "item", r.element.innerHTML = '\n \n ' + o + "\n ", r } return n(e, t), e.prototype.onClick = function() { t.prototype.onClick.call(this) } , e.prototype.action = function() { this.world.services.getService(p).requestWork(this.name) } , e }(s.MenuItem) , p = function(t) { function e(e) { var i = t.call(this, e) || this; return i.actionMenu = new u, i.actionMenu.appendChild(new d(i.world,h.Images.ImagesBuild.getPNG(),"shop-show","B","B")), i.actionMenu.appendChild(new d(i.world,h.Images.ImagesUnmount.getPNG(),"unmount","U","U")), i.actionMenu.appendChild(new d(i.world,h.Images.ImagesTeam.getPNG(),"team","T","T")),
i.actionMenu.appendChild(new d(i.world,h.Images.ImagesCowboyhaticon.getPNG(),"hat","H","H")), i } return n(e, t), e.prototype.requestWork = function(t) { "shop-show" === t ? this.world.services.getService(s.CraftMenuService).shopMenu.toggle() : "unmount" === t ? this.world.socket.sendMessage(a.PlayerUnmountRequest, {}) : "team" === t ? this.world.services.getService(l.default).toggle() : "hat" === t && this.world.services.getService(c.default).toggle() } , e }(o.Service); e.ActionService = p } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(1) , o = i(3) , r = o.Protocol.ResourceType , a = i(2) , h = function(t) { function e(e) { return t.call(this, e) || this } return n(e, t), e.prototype.float = function(t, e, i) { for (var n = 0, s = function(s) { var r = s , a = i[s]; a > 0 && (o.world.game.time.events.add(.4 * Phaser.Timer.SECOND * n, function() { this._float(t, e, r, a)
}, o), n++) }, o = this, r = 0; r < i.length; r++) s(r) } , e.prototype._float = function(t, e, i, n) { var s = this.world.game.add.text(t, e, "+" + n + " " + r[i], { font: "20px " + a.GoogleWebFonts.RobotoMono }); s.anchor.set(.5, 1), s.stroke = "#000000", s.strokeThickness = 3, s.fill = "#00ff00"; var o = this.world.game.add.tween(s); o.to({ y: s.y - 60 }), o.onComplete.add(function() { s.destroy() }, this), o.start() } , e }(s.Service); e.default = h
} , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(1) , o = i(3) , r = i(9) , a = o.Protocol.EntityType , h = i(2)
, , , , ,
l = Phaser.Rectangle c = i(27) u = i(26) d = o.Protocol.HatType p = function(t) { function e(e) { var i = t.call(this, e) || this; return i.x_ratio = 150 / 25600, i.y_ratio = 150 / 25600, i.minimapWinnerImage = i.world.game.make.image(0, 0, h.Images.ImagesMinimapwinner.getName()), i.minimapWalkerImage = i.world.game.make.image(0, 0, h.Images.ImagesMinimapwalker.getName()), i.bitmapData = i.world.game.add.bitmapData(150, 150), i.image = i.bitmapData.addToWorld(), i.image.fixedToCamera = !0, i.image.cameraOffset.setTo(15, i.world.game.height - 170), i.image.alpha = .7, i.childService = e.services.getService(r.default), i.preRenderBitmapData = i.world.game.add.bitmapData(150, 150), i.initializePrerendered(), i } return n(e, t), e.prototype.initializePrerendered = function() { this.preRenderBitmapData.clear(0, 0, this.preRenderBitmapData.width, this.preRenderBitmapData.height); for (var t = this.world.game.cache.getTilemapData("mapdata").data, e = 0, i = t.layers; e < i.length; e++) { var n = i[e]; if ("objectgroup" === n.type) for (var s = 0, o = n.objects; s < o.length; s++) { var r = o[s] , a = r.x , h = r.y; "woodgenerator" === r.type || "winterwoodgenerator" === r.type ? (this.preRenderBitmapData.ctx.beginPath(), this.preRenderBitmapData.ctx.rect(a * this.x_ratio - 1, h * this.y_ratio - 1, 2, 2), this.preRenderBitmapData.ctx.fillStyle = "#00ff00", this.preRenderBitmapData.ctx.fill()) : "stonegenerator" !== r.type && "winterstonegenerator" !== r.type || (this.preRenderBitmapData.ctx.beginPath(), this.preRenderBitmapData.ctx.rect(a * this.x_ratio - 1, h * this.y_ratio - 1, 2, 2), this.preRenderBitmapData.ctx.fillStyle = "#ffffff", this.preRenderBitmapData.ctx.fill()) } } } , e.prototype.drawMinimapObject = function(t, e, i, n, s, o, r, a, h) { this.bitmapData.ctx.beginPath(), i >= -1 ? this.world.id === t ? t === r ? this.bitmapData.draw(this.minimapWinnerImage, s - 5, o - 5, 10, 10) : (this.bitmapData.ctx.rect(s - 4, o - 4, 10, 10), this.bitmapData.ctx.fillStyle = n < 0 ? "#00aa00" : "#00ff00") : this.world.networkId === e ? (this.bitmapData.ctx.rect(s - 2, o - 2, 5, 5), this.bitmapData.ctx.fillStyle = "#00bb00") : this.world.teamId === i &&
i > -1 ? t === r ? this.bitmapData.draw(this.minimapWinnerImage, s - 5, o - 5, 10, 10) : (this.bitmapData.ctx.rect(s - 2, o - 2, 6, 6), this.bitmapData.ctx.fillStyle = "#00bb00") : n > -1 && (!a || a || h) && (t === r ? this.bitmapData.draw(this.minimapWinnerImage, s - 5, o - 5, 10, 10) : (this.bitmapData.ctx.rect(s - 1, o - 1, 4, 4), this.bitmapData.ctx.fillStyle = "#ff0000")) : -2 === i && (a || !a) && this.drawWhiteWalker(s, o), this.bitmapData.ctx.fill() } , e.prototype.drawWhiteWalker = function(t, e) { this.bitmapData.draw(this.minimapWalkerImage, t - 5, e - 5, 10, 10) } , e.prototype.onMapMessage = function(t) { var e = -1 , i = new Phaser.Point(0,0); if (this.world.assignedObject) { if (this.world.assignedObject.components.hat) { e = this.world.assignedObject.components.hat.getHatId() } this.world.assignedObject.components.transform && (i = this.world.assignedObject.components.transform.position) } var n = this.world.services.getService(c.default).topId , s = this.world.services.getService(u.default).isNight(); this.bitmapData.clear(0, 0, this.bitmapData.width, this.bitmapData.height), this.bitmapData.ctx.beginPath(), this.bitmapData.ctx.rect(0, 0, 150, 150), this.bitmapData.ctx.fillStyle = "#222222", this.bitmapData.ctx.fill(), this.bitmapData.copyRect(this.preRenderBitmapData, new l(0,0,this.bitmapData.width,this.bitmapData.height), 0, 0, .2); for (var o = 0; o < this.childService.childs.length; o++) { var r = this.childService.childs[o] , h = r.position.x * this.x_ratio , p = r.position.y * this.y_ratio , f = r.objectType; f === a.Tower ? (this.bitmapData.ctx.beginPath(), this.bitmapData.ctx.rect(h - 3, p - 3, 6, 6), this.bitmapData.ctx.fillStyle = "#aaaaaa", this.bitmapData.ctx.fill()) : f !== a.StoneBlock && f !== a.WoodBlock || (this.bitmapData.ctx.beginPath(), this.bitmapData.ctx.rect(h - 1, p - 1, 2, 2), this.bitmapData.ctx.fillStyle = "#aaaaaa", this.bitmapData.ctx.fill()) } for (var m = t.content.data, g = t.content.teamIdData, o = 0; o < m.length; o += 5) { var y = m[o] , h = m[o + 1] * this.x_ratio , p = m[o + 2] * this.y_ratio , v = m[o + 3] , b = m[o + 4] , w = g[o / 5]; e === d.FoxHat && Phaser.Math.distance(m[o + 1], m[o + 2], i.x, i.y) < 5e3 ? this.drawMinimapObject(y, b, w, v, h, p, n, s, !0) : this.drawMinimapObject(y, b, w, v, h, p, n, s, !1)
} } , e.prototype.update = function(t) { this.world.game.scale.scaleMode === Phaser.ScaleManager.USER_SCALE ? this.image.cameraOffset.setTo(20 + this.world.game.screenOffsetWidth * this.world.game.scale.scaleFactor.x, this.world.game.height - 170 this.world.game.screenOffsetHeight * this.world.scale.scaleFactor.y) : this.world.game.scale.scaleMode === Phaser.ScaleManager.RESIZE && this.image.cameraOffset.setTo(20, this.world.game.height - 170) } , e.prototype.destroy = function() { this.image.destroy(), this.bitmapData.destroy() } , e }(s.Service); e.default = p } , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(1) , o = function(t) { function e(e) { var i = t.call(this, e) || this; return i.updateTimeoutMax = .05, i.updateTimeout = 0, i } return n(e, t), e.prototype.update = function(t) { this.updateTimeout -= t, this.updateTimeout 1 } , e.prototype.initializeLoginButton = function() { var t = document.getElementById("login-input"); t.focus(), w.default.read("nickname") && (t.value = w.default.read("nickname")), document.getElementById("login-button").onclick = this.onLoginButtonClick.bind(this) } , e.prototype.onLoginButtonClick = function() { var t = document.getElementById("login-input") , e = t.value; w.default.write("nickname", e), P.default.play(function() { this.request_spawn(e) } .bind(this)) } , e.prototype.initializeGameState = function(t) { t === s.LOBBY ? (document.getElementById("lobby-layout").style.display = "block", document.getElementById("game-layout").style.display = "none", document.getElementById("respawn-layout").style.display = "none", this.game.input.keyboard.enabled = !1) : t === s.GAME ? (document.getElementById("lobby-layout").style.display = "none", document.getElementById("game-layout").style.display = "block", document.getElementById("respawn-layout").style.display = "none", this.game.input.keyboard.enabled = !0) : t === s.RESPAWN && (document.getElementById("lobby-layout").style.display = "none", document.getElementById("game-layout").style.display = "none", document.getElementById("respawn-layout").style.display = "block", this.game.input.keyboard.reset(!1), this.game.input.keyboard.enabled = !1, this.respawnWindow.show()), this.gameState = t } , e.prototype.onBuildResponse = function(t) { this.services.getService(g.default).onBuildResponse(t.content) } , e.prototype.onChatMessage = function(t) { var e = t.content.id;
this.entityHash.hasOwnProperty(e.toString()) && this.entityHash[e].emit("chatmessage", t.content.message) } , e.prototype.onMapMessage = function(t) { this.services.getService(v.default).onMapMessage(t) } , e.prototype.onLeaderboardMessage = function(t) { this.services.getService(y.default).onScoreMessage(t) } , e.prototype.onLeaderboardMessagePlayer = function(t) { this.services.getService(y.default).onScoreMessagePlayer(t) } , e.prototype.onSyncChild = function(t) { this.services.getService(m.default).onCreateChild(t) } , e.prototype.onSyncChildDelete = function(t) { this.services.getService(m.default).onRemoveChild(t) } , e.prototype.onFloatResources = function(t) { var e = t.content.id; if (this.entityHash.hasOwnProperty(e.toString())) { var i = this.entityHash[e].components.transform.position; this.services.getService(f.default).float(i.x, i.y, t.content.counts) } } , e.prototype.onPingReply = function(t) { this.services.getService(p.default).onPingReply(t) } , e.prototype.onSyncBackpack = function(t) { this.services.getService(u.default).sync(t.content.counts) } , e.prototype.onReceiveDamage = function(t) { var e = t.content.id; this.entityHash.hasOwnProperty(e.toString()) && this.entityHash[e].emit("receivedamage") } , e.prototype.onSendDamage = function(t) { var e = t.content.id; this.entityHash.hasOwnProperty(e.toString()) && this.entityHash[e].emit("senddamage", t.content) } , e.prototype.onSyncMessageDelete = function(t) { var e = t.content.id; this.entityHash.hasOwnProperty(e.toString()) && (this.entityHash[e].destroy(), delete this.entityHash[e]) }
, e.prototype.initializePartyLink = function() { var t = document.getElementById("partylink"); t.style.visibility = "visible", t.onclick = function() { history.pushState({ id: 0 }, "", "/?ip=" + E.default.getHostAddressRaw()) } .bind(this) } , e.prototype.onSyncMessage = function(t) { var e = !1 , i = t.content.id , n = !1; this.entityHash[i] || (this.entityHash[i] = a.EntityFactory.create(t.content.objectType, this, i, t.content.parentId), n = !0), i === this.id && (t.content.hasOwnProperty("networkId") && (this.networkId = t.content.networkId), t.content.hasOwnProperty("teamId") && (this.teamId = t.content.teamId, n || (e = !0)), t.content.hasOwnProperty("isTeamAdmin") && (this.isAdmin = t.content.isTeamAdmin, e = !0)), this.entityHash[i].emit("networksync", t.content), i === this.id && n && (this.assignedObject = this.entityHash[i], this.assignedObject instanceof d.default ? this.onGameStart() : this.assignedObject instanceof C.default && this.gameState === s.GAME && this.initializeGameState(s.RESPAWN), this.assignedObject.components.sprite ? this.camera.follow(this.assignedObject.components.sprite.sprite, Phaser.Camera.FOLLOW_LOCKON, .1, .1) : t.content.x && t.content.y && this.camera.focusOnXY(t.content.x, t.content.y), this.broadcastEvent("hostspawn"), this.services.getService(M.default).onTeamSwitch(this.teamId)), e && (this.broadcastEvent("hostteamchanged"), this.services.getService(M.default).onTeamSwitch(this.teamId)) } , e.prototype.broadcastEvent = function(t) { for (var e in this.entityHash) this.entityHash[e] && this.entityHash[e].emit(t) } , e.prototype.onAssignMessage = function(t) { this.id = t.content.id, this.camera.unfollow(), this.cleanup() } , e.prototype.onGameStart = function() { this.initializeGameState(s.GAME) } , e.prototype.preload = function() {} , e.prototype.cleanup = function() {
for (var t in this.entityHash) this.entityHash[t].destroy(); this.entityHash = {}, this.assignedObject = null, this.services.cleanup()
} , e.prototype.getTeamId = function() { return _("networkId") || "" } , e.prototype.request_respawn = function() { var t = document.getElementById("login-input") , e = t.value; this.request_spawn(e) } , e.prototype.request_spawn = function(t) { this.socket.sendMessage(r.PlayerSpawnRequest, { name: t, teamId: this.getTeamId() }) } , e.prototype.createLayers = function() { this.LAYER_BACKGROUND_0 = this.game.add.group(), this.LAYER_BACKGROUND_1 = this.game.add.group(), this.LAYER_MIDDLE_0 = this.game.add.group(), this.LAYER_MIDDLE_1 = this.game.add.group(), this.LAYER_FOREGROUND_0 = this.game.add.group(), this.LAYER_UI = this.game.add.group() } , e.prototype.create = function() { this.createLayers(), this.services.registerService(new R.default(this)), this.services.registerService(new l.default(this)), this.services.registerService(new S.default(this)), this.services.registerService(new c.default(this)), this.services.registerService(new u.default(this)), this.services.registerService(new p.default(this)), this.services.registerService(new f.default(this)), this.services.registerService(new g.default(this)), this.services.registerService(new m.default(this)), this.services.registerService(new y.default(this)), this.services.registerService(new v.default(this)), this.services.registerService(new b.default(this)), this.services.registerService(new A.CraftMenuService(this)), this.services.registerService(new k.ActionService(this)), this.services.registerService(new M.default(this)), this.services.registerService(new O.default(this)), this.services.registerService(new B.default(this)), this.services.registerService(new L.default(this)), $.ajax("http://status.glor.io").done(function(t) { this.services.registerService(new I.default(this,t)) } .bind(this)) } ,
e.prototype.update = function() { var t = this.game.time.elapsed / 1e3; for (var e in this.entityHash) this.entityHash[e].update(t); this.services.update(t) } , e.prototype.shutdown = function() { this.cleanup(), this.services.destroy() } , e }(Phaser.State); e.default = D
} , function(t, e, i) { "use strict"; var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = function(t) { function e() { return null !== t && t.apply(this, arguments) || this } return n(e, t), e.prototype.preload = function() {} , e.prototype.create = function() { document.getElementById("kickedscreen").style.display = "block" } , e }(Phaser.State); e.default = s } , function(t, e, i) { "use strict";
var n = this && this.__extends || function() { 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]) } ; return function(e, i) { function n() { this.constructor = e } t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n) } }(); Object.defineProperty(e, "__esModule", { value: !0 }); var s = i(2) , o = i(34) , r = i(190) , a = function(t) { function e() { var e = null !== t && t.apply(this, arguments) || this; return e.nextState = "connection", e } return n(e, t), e.prototype.preload = function() { this.game.load.tilemap("mapdata", s.Atlases.MapMap.getJSONHash(), null, Phaser.Tilemap.TILED_JSON), this.game.load.image("mapimage", s.Atlases.MapMap.getPNG()), this.game.load.image(s.Images.ImagesBox.getName(), s.Images.ImagesBox.getPNG()), this.game.load.image(s.Images.ImagesStonegenerator.getName(), s.Images.ImagesStonegenerator.getPNG()), this.game.load.image(s.Images.ImagesWoodgenerator.getName(), s.Images.ImagesWoodgenerator.getPNG()), this.game.load.image(s.Images.ImagesWinterstonegenerator.getName(), s.Images.ImagesWinterstonegenerator.getPNG()), this.game.load.image(s.Images.ImagesWinterwoodgenerator.getName(), s.Images.ImagesWinterwoodgenerator.getPNG()), this.game.load.image(s.Images.ImagesEgg.getName(), s.Images.ImagesEgg.getPNG()), this.game.load.image(s.Images.ImagesCarrot.getName(), s.Images.ImagesCarrot.getPNG()), this.game.load.image(s.Images.ImagesMeat.getName(), s.Images.ImagesMeat.getPNG()), this.game.load.image(s.Images.ImagesWoodwall.getName(), s.Images.ImagesWoodwall.getPNG()), this.game.load.image(s.Images.ImagesStonewall.getName(), s.Images.ImagesStonewall.getPNG()), this.game.load.image(s.Images.ImagesGarden.getName(),
s.Images.ImagesGarden.getPNG()), this.game.load.image(s.Images.ImagesTower.getName(), s.Images.ImagesTower.getPNG()), this.game.load.image(s.Images.ImagesDoor.getName(), s.Images.ImagesDoor.getPNG()), this.game.load.image(s.Images.ImagesHeartstone.getName(), s.Images.ImagesHeartstone.getPNG()), this.game.load.image(s.Images.ImagesKnight.getName(), s.Images.ImagesKnight.getPNG()), this.game.load.image(s.Images.ImagesGardener.getName(), s.Images.ImagesGardener.getPNG()), this.game.load.image(s.Images.ImagesGuard.getName(), s.Images.ImagesGuard.getPNG()), this.game.load.image(s.Images.ImagesFollower.getName(), s.Images.ImagesFollower.getPNG()), this.game.load.image(s.Images.ImagesFoodcrate.getName(), s.Images.ImagesFoodcrate.getPNG()), this.game.load.image(s.Images.ImagesWoodcrate.getName(), s.Images.ImagesWoodcrate.getPNG()), this.game.load.image(s.Images.ImagesStonecrate.getName(), s.Images.ImagesStonecrate.getPNG()), this.game.load.image(s.Images.ImagesCarwolf.getName(), s.Images.ImagesCarwolf.getPNG()), this.game.load.image(s.Images.ImagesUnmount.getName(), s.Images.ImagesUnmount.getPNG()), this.game.load.image(s.Images.ImagesMannequin.getName(), s.Images.ImagesMannequin.getPNG()), this.game.load.image(s.Images.ImagesPickupbot.getName(), s.Images.ImagesPickupbot.getPNG()), this.game.load.image(s.Images.ImagesBuild.getName(), s.Images.ImagesBuild.getPNG()), this.game.load.image(s.Images.ImagesSoccerball.getName(), s.Images.ImagesSoccerball.getPNG()), this.game.load.image(s.Images.ImagesTeam.getName(), s.Images.ImagesTeam.getPNG()), this.game.load.image(s.Images.ImagesMinimapwinner.getName(), s.Images.ImagesMinimapwinner.getPNG()), this.game.load.image(s.Images.ImagesCrown.getName(), s.Images.ImagesCrown.getPNG()), this.game.load.image(s.Images.ImagesWinterwall.getName(), s.Images.ImagesWinterwall.getPNG()), this.game.load.image(s.Images.ImagesWinterfloor.getName(), s.Images.ImagesWinterfloor.getPNG()), this.game.load.image(s.Images.ImagesWintertower.getName(), s.Images.ImagesWintertower.getPNG()), this.game.load.image(s.Images.ImagesCoin.getName(), s.Images.ImagesCoin.getPNG()), this.game.load.image(s.Images.ImagesMinimapwalker.getName(), s.Images.ImagesMinimapwalker.getPNG()), this.game.load.image(s.Images.ImagesBannertopleft.getName(), s.Images.ImagesBannertopleft.getPNG()), this.game.load.image(s.Images.ImagesWoodspikes.getName(), s.Images.ImagesWoodspikes.getPNG()), this.game.load.image(s.Images.ImagesPortal.getName(), s.Images.ImagesPortal.getPNG()), this.game.load.image(s.Images.ImagesSoul.getName(), s.Images.ImagesSoul.getPNG()), this.game.load.image(s.Images.ImagesDarkdoor.getName(), s.Images.ImagesDarkdoor.getPNG()),
this.game.load.image(s.Images.ImagesDarkguard.getName(), s.Images.ImagesDarkguard.getPNG()), this.game.load.image(s.Images.ImagesRideablebear.getName(), s.Images.ImagesRideablebear.getPNG()), this.game.load.image(s.Images.ImagesDarkstonewall.getName(), s.Images.ImagesDarkstonewall.getPNG()), this.game.load.image(s.Images.ImagesWhitebearhat.getName(), s.Images.ImagesWhitebearhat.getPNG()), this.game.load.image(s.Images.ImagesBrownbearhat.getName(), s.Images.ImagesBrownbearhat.getPNG()), this.game.load.image(s.Images.ImagesChesshat.getName(), s.Images.ImagesChesshat.getPNG()), this.game.load.image(s.Images.ImagesChesshatrot.getName(), s.Images.ImagesChesshatrot.getPNG()), this.game.load.image(s.Images.ImagesCowboyhat.getName(), s.Images.ImagesCowboyhat.getPNG()), this.game.load.image(s.Images.ImagesChickenhat.getName(), s.Images.ImagesChickenhat.getPNG()), this.game.load.image(s.Images.ImagesVikinghat.getName(), s.Images.ImagesVikinghat.getPNG()), this.game.load.image(s.Images.ImagesBuilderhat.getName(), s.Images.ImagesBuilderhat.getPNG()), this.game.load.image(s.Images.ImagesFoxhat.getName(), s.Images.ImagesFoxhat.getPNG()), this.game.load.image(s.Images.ImagesHockeyhat.getName(), s.Images.ImagesHockeyhat.getPNG()), this.game.load.image(s.Images.ImagesTankhat.getName(), s.Images.ImagesTankhat.getPNG()), this.game.load.image(s.Images.ImagesDruidhat.getName(), s.Images.ImagesDruidhat.getPNG()), this.game.load.image(s.Images.ImagesIcehat.getName(), s.Images.ImagesIcehat.getPNG()), this.game.load.image(s.Images.ImagesWhitebearhaticon.getName(), s.Images.ImagesWhitebearhaticon.getPNG()), this.game.load.image(s.Images.ImagesBrownbearhaticon.getName(), s.Images.ImagesBrownbearhaticon.getPNG()), this.game.load.image(s.Images.ImagesChesshaticon.getName(), s.Images.ImagesChesshaticon.getPNG()), this.game.load.image(s.Images.ImagesCowboyhaticon.getName(), s.Images.ImagesCowboyhaticon.getPNG()), this.game.load.image(s.Images.ImagesChickenhaticon.getName(), s.Images.ImagesChickenhaticon.getPNG()), this.game.load.image(s.Images.ImagesVikinghaticon.getName(), s.Images.ImagesVikinghaticon.getPNG()), this.game.load.image(s.Images.ImagesBuilderhaticon.getName(), s.Images.ImagesBuilderhaticon.getPNG()), this.game.load.image(s.Images.ImagesFoxhaticon.getName(), s.Images.ImagesFoxhaticon.getPNG()), this.game.load.image(s.Images.ImagesHockeyhaticon.getName(), s.Images.ImagesHockeyhaticon.getPNG()), this.game.load.image(s.Images.ImagesTankhaticon.getName(), s.Images.ImagesTankhaticon.getPNG()), this.game.load.image(s.Images.ImagesDruidhaticon.getName(), s.Images.ImagesDruidhaticon.getPNG()), this.game.load.image(s.Images.ImagesIcehaticon.getName(), s.Images.ImagesIcehaticon.getPNG()), this.game.load.atlasJSONHash(s.Atlases.AtlasesChicken.getName(), s.Atlases.AtlasesChicken.getPNG(), s.Atlases.AtlasesChicken.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesKnight.getName(),
s.Atlases.AtlasesKnight.getPNG(), s.Atlases.AtlasesKnight.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesGuard.getName(), s.Atlases.AtlasesGuard.getPNG(), s.Atlases.AtlasesGuard.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesGardener.getName(), s.Atlases.AtlasesGardener.getPNG(), s.Atlases.AtlasesGardener.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesFollower.getName(), s.Atlases.AtlasesFollower.getPNG(), s.Atlases.AtlasesFollower.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesPig.getName(), s.Atlases.AtlasesPig.getPNG(), s.Atlases.AtlasesPig.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesWolf.getName(), s.Atlases.AtlasesWolf.getPNG(), s.Atlases.AtlasesWolf.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesBear.getName(), s.Atlases.AtlasesBear.getPNG(), s.Atlases.AtlasesBear.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesWhitebear.getName(), s.Atlases.AtlasesWhitebear.getPNG(), s.Atlases.AtlasesWhitebear.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesCarpig.getName(), s.Atlases.AtlasesCarpig.getPNG(), s.Atlases.AtlasesCarpig.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesDoor.getName(), s.Atlases.AtlasesDoor.getPNG(), s.Atlases.AtlasesDoor.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesCarwolf.getName(), s.Atlases.AtlasesCarwolf.getPNG(), s.Atlases.AtlasesCarwolf.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesPickupbot.getName(), s.Atlases.AtlasesPickupbot.getPNG(), s.Atlases.AtlasesPickupbot.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesWhitewalker.getName(), s.Atlases.AtlasesWhitewalker.getPNG(), s.Atlases.AtlasesWhitewalker.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesRideablebear.getName(), s.Atlases.AtlasesRideablebear.getPNG(), s.Atlases.AtlasesRideablebear.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesDarkdoor.getName(), s.Atlases.AtlasesDarkdoor.getPNG(), s.Atlases.AtlasesDarkdoor.getJSONHash()), this.game.load.atlasJSONHash(s.Atlases.AtlasesDarkguard.getName(), s.Atlases.AtlasesDarkguard.getPNG(), s.Atlases.AtlasesDarkguard.getJSONHash()), this.game.load.audio(s.Audio.SfxWhoosh1.getName(), s.Audio.SfxWhoosh1.getWAV(), !0), this.loadLeaderboards() } , e.prototype.create = function() { r.Loader.waitForSoundDecoding(function() { this.game.state.start(this.nextState) }, this) } , e.prototype.loadLeaderboards = function() { $.ajax("http://leaderboard.glor.io").done(function(t) { for (var e = t[1], i = [], n = 0; n < e.length; n += 2) { var s = e[n] , r = e[n + 1] , a = r > 1e4 ? Math.floor(r / 1e3).toString() + "k" : r.toString(); i.push(' \n \n #' + (Math.floor(n / 2) + 1) + '\n ' + o.escapeHtml(s) + '\n ' + a + "\n ") } $("#weekly-leaderboard").append(i.join("")) } .bind(this))
} , e }(Phaser.State); e.default = a
} , function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n = function() { function t() {} return t.call = function(t, e) { var i; i = new XMLHttpRequest, i.onreadystatechange = function() { 4 === i.readyState && 200 === i.status && e(JSON.parse(i.responseText)) } , i.open("GET", t, !0), i.send() } , t }(); e.default = n } , function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n = i(2) , s = function() { function t() {} return t.loadImages = function() { for (var t in n.Images) if (!this.game.cache.checkImageKey(n.Images[t].getName())) for (var e in n.Images[t]) "getName" !== e && this.game.load.image(n.Images[t].getName(), n.Images[t][e]()) } , t.loadAtlases = function() { for (var t in n.Atlases) if (!this.game.cache.checkImageKey(n.Atlases[t].getName())) { var e = null , i = null; for (var s in n.Atlases[t]) "getXML" === s || "getJSONArray" === s || "getJSONHash" === s ? i = s : "getName" !== s && "Frames" !== s && (e = s); "getXML" === i ? this.game.load.atlasXML(n.Atlases[t].getName(), n.Atlases[t][e](), n.Atlases[t].getXML()) : "getJSONArray" === i ? this.game.load.atlasJSONArray(n.Atlases[t].getName(), n.Atlases[t][e](), n.Atlases[t].getJSONArray()) : "getJSONHash" === i && this.game.load.atlasJSONHash(n.Atlases[t].getName(), n.Atlases[t][e](),
n.Atlases[t].getJSONHash()) } } , t.orderAudioSourceArrayBasedOnSoundExtensionPreference = function(t) { var e = this , i = []; for (var n in this.soundExtensionsPreference) { var s = t.filter(function(t) { return t.substring(t.lastIndexOf(".") + 1, t.length) === e.soundExtensionsPreference[n] }); i = i.concat(s) } return i } , t.loadAudio = function() { for (var t in n.Audio) { var e = n.Audio[t].getName(); if (this.soundKeys.push(e), !this.game.cache.checkSoundKey(e)) { var i = []; for (var s in n.Audio[t]) "getName" !== s && i.push(n.Audio[t][s]()); i = this.orderAudioSourceArrayBasedOnSoundExtensionPreference(i), this.game.load.audio(e, i, !0) } } } , t.loadAudiosprites = function() { for (var t in n.Audiosprites) { var e = n.Audiosprites[t].getName(); if (this.soundKeys.push(e), !this.game.cache.checkSoundKey(e)) { var i = []; for (var s in n.Audiosprites[t]) "getName" !== s && "getJSON" !== s && "Sprites" !== s && i.push(n.Audiosprites[t][s]()); i = this.orderAudioSourceArrayBasedOnSoundExtensionPreference(i), this.game.load.audiosprite(e, i, n.Audiosprites[t].getJSON(), null, !0) } } } , t.loadBitmapFonts = function() { for (var t in n.BitmapFonts) if (! this.game.cache.checkBitmapFontKey(n.BitmapFonts[t].getName())) { var e = null , i = null; for (var s in n.BitmapFonts[t]) "getXML" === s || "getFNT" === s ? i = s : "getName" !== s && (e = s); this.game.load.bitmapFont(n.BitmapFonts[t].getName(),
n.BitmapFonts[t][e](), n.BitmapFonts[t][i]()) } } , t.loadJSON = function() { for (var t in n.JSON) this.game.cache.checkJSONKey(n.JSON[t].getName()) || this.game.load.json(n.JSON[t].getName(), n.JSON[t].getJSON(), !0) } , t.loadXML = function() { for (var t in n.XML) this.game.cache.checkXMLKey(n.XML[t].getName()) || this.game.load.xml(n.XML[t].getName(), n.XML[t].getXML(), !0) } , t.loadText = function() { for (var t in n.Text) this.game.cache.checkTextKey(n.Text[t].getName()) || this.game.load.xml(n.Text[t].getName(), n.Text[t].getText(), !0) } , t.loadScripts = function() { for (var t in n.Scripts) this.game.load.script(n.Scripts[t].getName(), n.Scripts[t].getJS()) } , t.loadShaders = function() { for (var t in n.Shaders) this.game.cache.checkShaderKey(n.Shaders[t].getName()) || this.game.load.shader(n.Shaders[t].getName(), n.Shaders[t].getFRAG(), !0) } , t.loadAllAssets = function(t, e, i) { this.game = t, e && this.game.load.onLoadComplete.addOnce(e, i), this.loadImages(), this.loadAtlases(), this.loadAudio(), this.loadAudiosprites(), this.loadBitmapFonts(), this.loadJSON(), this.loadXML(), this.loadText(), this.loadScripts(), this.loadShaders() } , t.waitForSoundDecoding = function(t, e) { this.soundKeys.length > 0 ? this.game.sound.setDecodedCallback(this.soundKeys, t, e) : t.call(e) } , t }(); s.game = null, s.soundKeys = [], s.soundExtensionsPreference = ["webm", "ogg", "m4a", "mp3", "aac", "ac3", "caf", "flac", "mp4", "wav"],
e.Loader = s } , function(t, e, i) { var n; !function() { function s(t, e, i) { return t.call.apply(t.bind, arguments) } function o(t, e, i) { if (!t) throw Error(); if (2 < arguments.length) { var n = Array.prototype.slice.call(arguments, 2); return function() { var i = Array.prototype.slice.call(arguments); return Array.prototype.unshift.apply(i, n), t.apply(e, i) } } return function() { return t.apply(e, arguments) } } function r(t, e, i) { return r = Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? s : o, r.apply(null, arguments) } function a(t, e) { this.a = t, this.m = e || t, this.c = this.m.document } function h(t, e, i, n) { if (e = t.c.createElement(e), i) for (var s in i) i.hasOwnProperty(s) && ("style" == s ? e.style.cssText = i[s] : e.setAttribute(s, i[s])); return n && e.appendChild(t.c.createTextNode(n)), e } function l(t, e, i) { t = t.c.getElementsByTagName(e)[0], t || (t = document.documentElement), t.insertBefore(i, t.lastChild) } function c(t) { t.parentNode && t.parentNode.removeChild(t) } function u(t, e, i) { e = e || [], i = i || []; for (var n = t.className.split(/\s+/), s = 0; s < e.length; s += 1) { for (var o = !1, r = 0; r < n.length; r += 1) if (e[s] === n[r]) { o = !0; break }
o || n.push(e[s]) } for (e = [], s = 0; s < n.length; s += 1) { for (o = !1, r = 0; r < i.length; r += 1) if (n[s] === i[r]) { o = !0; break } o || e.push(n[s]) } t.className = e.join(" ").replace(/\s+/g, " ").replace(/^\s+|\s+$/, "")
} function d(t, e) { for (var i = t.className.split(/\s+/), n = 0, s = i.length; n < s; n++) if (i[n] == e) return !0; return !1 } function p(t) { if ("string" == typeof t.f) return t.f; var e = t.m.location.protocol; return "about:" == e && (e = t.a.location.protocol), "https:" == e ? "https:" : "http:" } function f(t) { return t.m.location.hostname || t.a.location.hostname } function m(t, e, i) { function n() { a && s && o && (a(r), a = null) } e = h(t, "link", { rel: "stylesheet", href: e, media: "all" }); var s = !1 , o = !0 , r = null , a = i || null; at ? (e.onload = function() { s = !0, n() } , e.onerror = function() { s = !0, r = Error("Stylesheet failed to load"), n() } ) : setTimeout(function() { s = !0, n() }, 0), l(t, "head", e)
} function g(t, e, i, n) { var s = t.c.getElementsByTagName("head")[0]; if (s) { var o = h(t, "script", { src: e }) , r = !1; return o.onload = o.onreadystatechange = function() { r || this.readyState && "loaded" != this.readyState && "complete" != this.readyState || (r = !0, i && i(null), o.onload = o.onreadystatechange = null, "HEAD" == o.parentNode.tagName && s.removeChild(o)) } , s.appendChild(o), setTimeout(function() { r || (r = !0, i && i(Error("Script load timeout"))) }, n || 5e3), o } return null } function y() { this.a = 0, this.c = null } function v(t) { return t.a++, function() { t.a--, w(t) } } function b(t, e) { t.c = e, w(t) } function w(t) { 0 == t.a && t.c && (t.c(), t.c = null) } function x(t) { this.a = t || "-" } function _(t, e) { this.c = t, this.f = 4, this.a = "n"; var i = (e || "n4").match(/^([nio])([1-9])$/i); i && (this.a = i[1], this.f = parseInt(i[2], 10)) } function P(t) { return S(t) + " " + t.f + "00 300px " + T(t.c) } function T(t) {
e.push(n)
var e = []; t = t.split(/,\s*/); for (var i = 0; i < t.length; i++) { var n = t[i].replace(/['"]/g, ""); -1 != n.indexOf(" ") || /^\d/.test(n) ? e.push("'" + n + "'") : } return e.join(",")
} function C(t) { return t.a + t.f } function S(t) { var e = "normal"; return "o" === t.a ? e = "oblique" : "i" === t.a && (e = "italic"), e } function A(t) { var e = 4 , i = "n" , n = null; return t && ((n = t.match(/(normal|oblique|italic)/i)) && n[1] && (i = n[1].substr(0, 1).toLowerCase()), (n = t.match(/([1-9]00|normal|bold)/i)) && n[1] && (/bold/i.test(n[1]) ? e = 7 : /[1-9]00/.test(n[1]) && (e = parseInt(n[1].substr(0, 1), 10)))), i + e } function k(t, e) { this.c = t, this.f = t.m.document.documentElement, this.h = e, this.a = new x("-"), this.j = !1 !== e.events, this.g = !1 !== e.classes } function E(t) { t.g && u(t.f, [t.a.c("wf", "loading")]), M(t, "loading") } function I(t) { if (t.g) { var e = d(t.f, t.a.c("wf", "active")) , i = [] , n = [t.a.c("wf", "loading")]; e || i.push(t.a.c("wf", "inactive")), u(t.f, i, n) } M(t, "inactive") } function M(t, e, i) { t.j && t.h[e] && (i ? t.h[e](i.c, C(i)) : t.h[e]()) } function O() { this.c = {} } function B(t, e, i) { var n, s = []; for (n in e)
if (e.hasOwnProperty(n)) { var o = t.c[n]; o && s.push(o(e[n], i)) } return s
} function R(t, e) { this.c = t, this.f = e, this.a = h(this.c, "span", { "aria-hidden": "true" }, this.f) } function L(t) { l(t.c, "body", t.a) } function D(t) { return "display:block;position:absolute;top:-9999px;left:-9999px;fontsize:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;fontvariant:normal;white-space:nowrap;font-family:" + T(t.c) + ";font-style:" + S(t) + ";font-weight:" + t.f + "00;" } function F(t, e, i, n, s, o) { this.g = t, this.j = e, this.a = n, this.c = i, this.f = s || 3e3, this.h = o || void 0 } function N(t, e, i, n, s, o, r) { this.v = t, this.B = e, this.c = i, this.a = n, this.s = r || "BESbswy", this.f = {}, this.w = s || 3e3, this.u = o || null, this.o = this.j = this.h = this.g = null, this.g = new R(this.c,this.s), this.h = new R(this.c,this.s), this.j = new R(this.c,this.s), this.o = new R(this.c,this.s), t = new _(this.a.c + ",serif",C(this.a)), t = D(t), this.g.a.style.cssText = t, t = new _(this.a.c + ",sans-serif",C(this.a)), t = D(t), this.h.a.style.cssText = t, t = new _("serif",C(this.a)), t = D(t), this.j.a.style.cssText = t, t = new _("sans-serif",C(this.a)), t = D(t), this.o.a.style.cssText = t, L(this.g), L(this.h), L(this.j),
L(this.o) } function G() { if (null === lt) { var t = /AppleWebKit\/([0-9]+)(?:\.([09]+))/.exec(window.navigator.userAgent); lt = !!t && (536 > parseInt(t[1], 10) || 536 === parseInt(t[1], 10) && 11 >= parseInt(t[2], 10)) } return lt } function U(t, e, i) { for (var n in ht) if (ht.hasOwnProperty(n) && e === t.f[ht[n]] && i === t.f[ht[n]]) return !0; return !1 } function W(t) { var e, i = t.g.a.offsetWidth, n = t.h.a.offsetWidth; (e = i === t.f.serif && n === t.f["sans-serif"]) || (e = G() && U(t, i, n)), e ? rt() - t.A >= t.w ? G() && U(t, i, n) && (null === t.u || t.u.hasOwnProperty(t.a.c)) ? H(t, t.v) : H(t, t.B) : j(t) : H(t, t.v) } function j(t) { setTimeout(r(function() { W(this) }, t), 50) } function H(t, e) { setTimeout(r(function() { c(this.g.a), c(this.h.a), c(this.j.a), c(this.o.a), e(this.a) }, t), 0) } function X(t, e, i) { this.c = t, this.a = e, this.f = 0, this.o = this.j = !1, this.s = i } function q(t) { 0 == --t.f && t.j && (t.o ? (t = t.a, t.g && u(t.f, [t.a.c("wf", "active")], [t.a.c("wf", "loading"), t.a.c("wf", "inactive")]), M(t, "active")) : I(t.a)) } function V(t) { this.j = t, this.a = new O, this.h = 0, this.f = this.g = !0 } function Y(t, e, i, n, s) { var o = 0 == --t.h;
(t.f || t.g) && setTimeout(function() { var t = s || null , a = n || null || {}; if (0 === i.length && o) I(e.a); else { e.f += i.length, o && (e.j = o); var h, l = []; for (h = 0; h < i.length; h++) { var c = i[h] , d = a[c.c] , p = e.a , f = c; if (p.g && u(p.f, [p.a.c("wf", f.c, C(f).toString(), "loading")]), M(p, "fontloading", f), p = null, null === ct) if (window.FontFace) { var f = /Gecko.*Firefox\/ (\d+)/.exec(window.navigator.userAgent) , m = /OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent) && /Apple/.exec(window.navigator.vendor); ct = f ? 42 < parseInt(f[1], 10) : !m } else ct = !1; p = ct ? new F(r(e.g, e),r(e.h, e),e.c,c,e.s,d) : new N(r(e.g, e),r(e.h, e),e.c,c,e.s,t,d), l.push(p) } for (h = 0; h < l.length; h++) l[h].start() } }, 0) } function z(t, e, i) { var n = [] , s = i.timeout; E(e); var n = B(t.a, i, t.c) , o = new X(t.c,e,s); for (t.h = n.length, e = 0, i = n.length; e < i; e++) n[e].load(function(e, i, n) { Y(t, o, e, i, n) }) } function K(t, e) { this.c = t, this.a = e } function J(t, e, i) { var n = p(t.c); return t = (t.a.api || "fast.fonts.net/jsapi").replace(/^.*http(s?): (\/\/)?/, ""), n + "//" + t + "/" + e + ".js" + (i ? "?v=" + i : "")
{
} function Z(t, e) { this.c = t, this.a = e } function Q(t, e, i) { this.c = t || e + ut, this.a = [], this.f = [], this.g = i || "" } function $(t, e) { for (var i = e.length, n = 0; n < i; n++) { var s = e[n].split(":"); 3 == s.length && t.f.push(s.pop()); var o = ""; 2 == s.length && "" != s[1] && (o = ":"), t.a.push(s.join(o)) } } function tt(t) { if (0 == t.a.length) throw Error("No fonts to load!"); if (-1 != t.c.indexOf("kit=")) return t.c; for (var e = t.a.length, i = [], n = 0; n < e; n++) i.push(t.a[n].replace(/ /g, "+")); return e = t.c + "?family=" + i.join("%7C"), 0 < t.f.length && (e += "&subset=" + t.f.join(",")), 0 < t.g.length && (e += "&text=" + encodeURIComponent(t.g)), e } function et(t) { this.f = t, this.a = [], this.c = {} } function it(t) { for (var e = t.f.length, i = 0; i < e; i++) { var n = t.f[i].split(":") , s = n[0].replace(/\+/g, " ") , o = ["n4"]; if (2 = e.f ? s() : t.fonts.load(P(e.a), e.h).then(function(t) { 1