haxball.js
Version:
A powerful library for interacting with the Haxball Headless API
2,071 lines • 122 kB
JavaScript
import * as WebRTCNode from "@webrtc-node/webrtc";
import { HttpsProxyAgent } from "https-proxy-agent";
import JSON5 from "json5";
import WebSocket from "ws";
import XMLHttpRequest from "xhr2";
import { constants, deflateRawSync, inflateRawSync } from "node:zlib";
//#region src/generated/headless.ts
function loadHeadless(environment) {
return new Promise((resolve, reject) => {
const { WebSocket, XMLHttpRequest, JSON5, pako, RTCPeerConnection, RTCIceCandidate, RTCSessionDescription, crypto, performance, TextEncoder } = environment;
const window = environment.createWindow(resolve);
try {
(function(wa) {
function pb() {
return q.Zb(this, "");
}
function ib(a, b) {
if (null == b) return null;
b.yd ??= wa.ye++;
var c;
null == a.oe ? a.oe = {} : c = a.oe[b.yd];
c ?? (c = b.bind(a), a.oe[b.yd] = c);
return c;
}
class jb {
constructor(a) {
this.current = 0;
this.zi = a;
}
next() {
return this.zi[this.current++];
}
}
class m {
constructor() {
m.Ka || this.Aa();
}
Aa() {
this.gg = this.hg = this.fb = 0;
}
eg() {
return !0;
}
apply() {
throw r.s("missing implementation");
}
W() {
throw r.s("missing implementation");
}
S() {
throw r.s("missing implementation");
}
static Z(a) {
a.delay ??= !0;
a.ca ??= !0;
return a;
}
static $(a) {
a.mg = m.ke;
if (null == a.U) throw r.s("Class doesn't have a config");
a.prototype.sd = a.U;
m.$f.set(m.ke, a);
m.ke++;
}
static ue(a, b) {
let c = q.Zf(a).mg;
if (null == c) throw r.s("Tried to pack unregistered action");
b.f(c);
a.S(b);
}
static Ji(a) {
a = a.C();
a = Object.create(m.$f.get(a).prototype);
a.fb = 0;
a.eb = 0;
return a;
}
}
class u {
constructor(a, b, c, d, e, f, g, h) {
this.Zc = null;
this.P = a;
this.T = b;
this.Qe = c;
this.kh = d;
this.pa = e;
this.m = h;
this.ji = new W();
this.ji.Qa.push(b);
}
}
class X {
constructor() {
this.ib = "";
this.Rc = this.Tc = 0;
}
static Te(a) {
let b = new X();
b.Rc = a.lat;
b.Tc = a.lon;
b.ib = a.code.toLowerCase();
return b;
}
static Ug() {
return T.Tg(xa.Ke + "api/geo").then(function(a) {
return X.Te(a);
});
}
}
class qb {
static Di(a) {
let b = "";
do
b = "0123456789ABCDEF".charAt(a & 15) + b, a >>>= 4;
while (0 < a);
for (; 2 > b.length;) b = "0" + b;
return b;
}
}
class Xa {
constructor() {}
Ag() {
this.pa = R.qb(this.pa, 40);
this.ib = R.qb(this.ib, 3);
}
G(a) {
this.Ag();
a.ra = !0;
a.Oa(this.si);
a.Uf(this.pa);
a.Uf(this.ib);
a.he(this.Rc);
a.he(this.Tc);
a.f(this.lb ? 1 : 0);
a.f(this.zh);
a.f(this.ba);
a.ra = !1;
}
}
class kb {
static sa(a, b, c, d) {
a?.(b, c, d);
}
}
class Oa {
constructor() {
this.A = [];
}
G(a) {
a.f(this.A.length);
let b = 0, c = this.A.length;
for (; b < c;) {
let d = b++, e = this.A[d];
e.rf = d;
e.G(a);
}
}
Ca(a) {
for (var b = 0, c = this.A; b < c.length;) {
var d = c[b];
++b;
var e = d.a, f = d.a, g = d.u;
e.x = f.x + g.x * a;
e.y = f.y + g.y * a;
f = e = d.u;
g = d.ma;
d = d.ga;
e.x = (f.x + g.x) * d;
e.y = (f.y + g.y) * d;
}
a = 0;
for (b = this.A.length; a < b;) {
d = a++;
c = this.A[d];
d += 1;
for (e = this.A.length; d < e;) f = this.A[d++], 0 != (f.c & c.m) && 0 != (f.m & c.c) && c.Eg(f);
if (0 != c.L) {
d = 0;
for (e = this.Y; d < e.length;) if (f = e[d], ++d, 0 != (f.c & c.m) && 0 != (f.m & c.c)) {
g = f.X;
var h = c.a;
g = f.la - (g.x * h.x + g.y * h.y) + c.M;
if (0 < g) {
var l = h = c.a, p = f.X;
h.x = l.x + p.x * g;
h.y = l.y + p.y * g;
g = c.u;
h = f.X;
g = g.x * h.x + g.y * h.y;
0 > g && (g *= c.i * f.i + 1, l = h = c.u, f = f.X, h.x = l.x - f.x * g, h.y = l.y - f.y * g);
}
}
d = 0;
for (e = this.J; d < e.length;) f = e[d], ++d, 0 != (f.c & c.m) && 0 != (f.m & c.c) && c.Fg(f);
d = 0;
for (e = this.v; d < e.length;) if (f = e[d], ++d, 0 != (f.c & c.m) && 0 != (f.m & c.c) && (h = c.a, l = f.a, g = h.x - l.x, h = h.y - l.y, l = g * g + h * h, 0 < l && l <= c.M * c.M)) {
l = Math.sqrt(l);
g /= l;
h /= l;
l = c.M - l;
let t = p = c.a;
p.x = t.x + g * l;
p.y = t.y + h * l;
l = c.u;
l = g * l.x + h * l.y;
0 > l && (l *= c.i * f.i + 1, p = f = c.u, f.x = p.x - g * l, f.y = p.y - h * l);
}
}
}
for (a = 0; 2 > a;) for (++a, b = 0, c = this.Ta; b < c.length;) c[b++].Ca(this.A);
}
}
class rb {
static Dh(a) {
a = a.split(" ");
let b = a[4];
if ("typ" != a[6]) throw r.s(null);
return {
pi: a[7],
hh: b
};
}
}
class sb {
static Bi(a) {
let b = [];
if (null != a) {
let d = Object.prototype.hasOwnProperty;
for (var c in a) "__id__" != c && "hx__closures__" != c && d.call(a, c) && b.push(c);
}
return b;
}
}
class ya {
constructor() {
this.T = 0;
this.qc = Infinity;
this.La = this.Va = 100;
this.Ic = this.Jc = 0;
}
G(a) {
a.f(this.Ic);
a.f(this.Jc);
a.g(this.La);
a.g(this.Va);
a.g(this.qc);
a.w(this.T);
}
qa(a) {
this.Ic = a.C();
this.Jc = a.C();
this.La = a.o();
this.Va = a.o();
this.qc = a.o();
this.T = a.I();
}
Ca(a) {
var b = a[this.Ic];
a = a[this.Jc];
if (null != b && null != a) {
var c = b.a, d = a.a, e = c.x - d.x;
c = c.y - d.y;
var f = Math.sqrt(e * e + c * c);
if (!(0 >= f)) {
e /= f;
c /= f;
d = b.L / (b.L + a.L);
d != d && (d = .5);
if (this.La >= this.Va) {
var g = this.La;
var h = 0;
} else if (f <= this.La) g = this.La, h = 1;
else if (f >= this.Va) g = this.Va, h = -1;
else return;
f = g - f;
if (0 == 0 * this.qc) d = this.qc * f * .5, e *= d, c *= d, h = d = b.u, b = b.L, d.x = h.x + e * b, d.y = h.y + c * b, d = b = a.u, a = a.L, b.x = d.x + -e * a, b.y = d.y + -c * a;
else {
g = f * d;
var l = b.a, p = b.a;
l.x = p.x + e * g * .5;
l.y = p.y + c * g * .5;
p = l = a.a;
f -= g;
l.x = p.x - e * f * .5;
l.y = p.y - c * f * .5;
f = b.u;
g = a.u;
f = e * (f.x - g.x) + c * (f.y - g.y);
0 >= f * h && (d *= f, b = h = b.u, h.x = b.x - e * d, h.y = b.y - c * d, a = b = a.u, d = f - d, b.x = a.x + e * d, b.y = a.y + c * d);
}
}
}
}
}
class za {
constructor() {
this.rf = 0;
this.c = this.m = 63;
this.T = 16777215;
this.ga = .99;
this.L = 1;
this.i = .5;
this.M = 10;
this.ma = new I(0, 0);
this.u = new I(0, 0);
this.a = new I(0, 0);
}
G(a) {
var b = this.a;
a.g(b.x);
a.g(b.y);
b = this.u;
a.g(b.x);
a.g(b.y);
b = this.ma;
a.g(b.x);
a.g(b.y);
a.g(this.M);
a.g(this.i);
a.g(this.L);
a.g(this.ga);
a.xa(this.T);
a.w(this.c);
a.w(this.m);
}
Eg(a) {
var b = this.a, c = a.a, d = b.x - c.x;
b = b.y - c.y;
var e = a.M + this.M, f = d * d + b * b;
if (0 < f && f <= e * e) {
f = Math.sqrt(f);
d /= f;
b /= f;
c = this.L / (this.L + a.L);
e -= f;
f = e * c;
var g = this.a, h = this.a;
g.x = h.x + d * f;
g.y = h.y + b * f;
h = g = a.a;
e -= f;
g.x = h.x - d * e;
g.y = h.y - b * e;
e = this.u;
f = a.u;
e = d * (e.x - f.x) + b * (e.y - f.y);
0 > e && (e *= this.i * a.i + 1, c *= e, g = f = this.u, f.x = g.x - d * c, f.y = g.y - b * c, a = f = a.u, c = e - c, f.x = a.x + d * c, f.y = a.y + b * c);
}
}
Fg(a) {
if (0 != 0 * a.Ia) {
var b = a.F.a;
var c = a.K.a;
var d = c.x - b.x;
var e = c.y - b.y, f = this.a;
var g = f.x - c.x;
c = f.y - c.y;
f = this.a;
if (0 >= (f.x - b.x) * d + (f.y - b.y) * e || 0 <= g * d + c * e) return;
d = a.X;
b = d.x;
d = d.y;
g = b * g + d * c;
} else {
d = a.ec;
g = this.a;
b = g.x - d.x;
d = g.y - d.y;
g = a.jd;
c = a.kd;
if ((0 < g.x * b + g.y * d && 0 < c.x * b + c.y * d) == 0 >= a.Ia) return;
c = Math.sqrt(b * b + d * d);
if (0 == c) return;
g = c - a.Oe;
b /= c;
d /= c;
}
c = a.ub;
if (0 == c) 0 > g && (g = -g, b = -b, d = -d);
else if (0 > c && (c = -c, g = -g, b = -b, d = -d), g < -c) return;
g >= this.M || (g = this.M - g, e = c = this.a, c.x = e.x + b * g, c.y = e.y + d * g, g = this.u, g = b * g.x + d * g.y, 0 > g && (g *= this.i * a.i + 1, c = a = this.u, a.x = c.x - b * g, a.y = c.y - d * g));
}
}
class lb {}
class Pa {
static sa(a, b, c) {
a?.(b, c);
}
}
class tb {
static ni(a) {
return new Promise(function(b, c) {
let d = window.setTimeout(function() {
c("Timed out");
}, 500);
a.then(function(e) {
window.clearTimeout(d);
b(e);
}, function(e) {
window.clearTimeout(d);
c(e);
});
});
}
}
class ub {
static Ei() {
m.$(Y);
m.$(Aa);
m.$(ka);
m.$(Ba);
m.$(la);
m.$(Z);
m.$(S);
m.$(ma);
m.$(na);
m.$(oa);
m.$(U);
m.$(V);
m.$(aa);
m.$(pa);
m.$(ba);
m.$(Ca);
m.$(Da);
m.$(ca);
m.$(Ea);
m.$(qa);
m.$(da);
m.$(ea);
m.$(fa);
m.$(L);
}
}
class Fa {
constructor() {
this.ja = u.oa;
this.N = null;
this.Wb = this.uc = 0;
this.Db = !1;
this.Kb = this.na = 0;
this.pa = "Player";
this.Ci = this.$c = 0;
this.country = null;
this.ne = !1;
this.Eb = this.Vf = null;
this.Fb = 0;
this.Cb = !1;
}
S(a) {
a.f(this.Cb ? 1 : 0);
a.w(this.Fb);
a.Da(this.Eb);
a.Da(this.Vf);
a.f(this.ne ? 1 : 0);
a.Da(this.country);
a.w(this.Ci);
a.Da(this.pa);
a.w(this.Kb);
a.Ea(this.na);
a.f(this.Db ? 1 : 0);
a.ie(this.Wb);
a.f(this.uc);
a.f(this.ja.P);
a.ie(null == this.N ? -1 : this.N.rf);
}
}
class Qa {
static xe(a) {
return q.Zb(a, "");
}
static parseInt(a) {
a = parseInt(a);
return isNaN(a) ? null : a;
}
}
class ha {
constructor() {
this.c = this.m = 63;
this.T = 16777215;
this.ga = .99;
this.L = 1;
this.i = .5;
this.M = 10;
this.ma = new I(0, 0);
this.u = new I(0, 0);
this.a = new I(0, 0);
}
G(a) {
var b = this.a;
a.g(b.x);
a.g(b.y);
b = this.u;
a.g(b.x);
a.g(b.y);
b = this.ma;
a.g(b.x);
a.g(b.y);
a.g(this.M);
a.g(this.i);
a.g(this.L);
a.g(this.ga);
a.xa(this.T);
a.w(this.c);
a.w(this.m);
}
qa(a) {
var b = this.a;
b.x = a.o();
b.y = a.o();
b = this.u;
b.x = a.o();
b.y = a.o();
b = this.ma;
b.x = a.o();
b.y = a.o();
this.M = a.o();
this.i = a.o();
this.L = a.o();
this.ga = a.o();
this.T = a.Pb();
this.c = a.I();
this.m = a.I();
}
vh() {
let a = new za();
this.Ze(a);
return a;
}
Ze(a) {
var b = a.a, c = this.a;
b.x = c.x;
b.y = c.y;
b = a.u;
c = this.u;
b.x = c.x;
b.y = c.y;
b = a.ma;
c = this.ma;
b.x = c.x;
b.y = c.y;
a.M = this.M;
a.i = this.i;
a.L = this.L;
a.ga = this.ga;
a.T = this.T;
a.c = this.c;
a.m = this.m;
}
}
class mb {
constructor(a, b) {
this.x = a;
this.y = b;
}
}
class Ga {
constructor() {}
}
class xa {}
class Ya {
static sa(a, b, c, d, e) {
a?.(b, c, d, e);
}
}
class Ra {
constructor() {
this.Nc = 0;
this.M = 15;
this.m = 0;
this.ma = new I(0, 0);
this.L = this.i = .5;
this.ga = .96;
this.zc = .1;
this.Oc = .07;
this.Pc = .96;
this.Mc = 5;
}
G(a) {
a.g(this.i);
a.g(this.L);
a.g(this.ga);
a.g(this.zc);
a.g(this.Oc);
a.g(this.Pc);
a.g(this.Mc);
let b = this.ma;
a.g(b.x);
a.g(b.y);
a.w(this.m);
a.g(this.M);
a.g(this.Nc);
}
qa(a) {
this.i = a.o();
this.L = a.o();
this.ga = a.o();
this.zc = a.o();
this.Oc = a.o();
this.Pc = a.o();
this.Mc = a.o();
let b = this.ma;
b.x = a.o();
b.y = a.o();
this.m = a.I();
this.M = a.o();
this.Nc = a.o();
}
}
class P {
constructor() {
this.zb = this.vb = this.Mb = this.Xa = 0;
this.Od = u.fa;
this.Ab = this.$a = 0;
this.ia = new Oa();
this.Na = 0;
this.ab = 5;
this.ea = null;
}
gh(a) {
this.ha = a;
this.ab = a.ab;
this.Na = a.Na;
this.ea = a.ea;
this.ia.v = this.ea.v;
this.ia.Y = this.ea.Y;
this.ia.J = this.ea.J;
this.ia.Ta = this.ea.Ta;
a = 0;
let b = this.ea.A;
for (; a < b.length;) this.ia.A.push(b[a++].vh());
this.af();
}
$e(a) {
if (a.ja == u.oa) a.N = null;
else {
a.Kb = 0;
var b = a.N;
b ?? (b = new za(), a.N = b, this.ia.A.push(b));
var c = this.ea.Nb;
b.T = 0;
b.M = c.M;
b.L = c.L;
b.ga = c.ga;
b.i = c.i;
b.c = 39;
b.m = a.ja.m | c.m;
var d = a.ja == u.fa ? this.ea.Qb : this.ea.Jb;
0 == d.length ? (b.a.x = a.ja.Qe * this.ea.cc, b.a.y = 0) : (a = b.a, d = d[d.length - 1], a.x = d.x, a.y = d.y);
d = b.u;
d.x = 0;
d.y = 0;
b = b.ma;
c = c.ma;
b.x = c.x;
b.y = c.y;
}
}
Ca(a) {
if (0 < this.Xa) 120 > this.Xa && this.Xa--;
else {
var b = this.ha.Qg;
b?.();
b = this.ha.ba;
for (var c = 0; c < b.length;) {
var d = b[c];
++c;
if (null != d.N) {
0 == (d.Kb & 16) && (d.Db = !1);
var e = this.ea.Nb;
0 < d.uc && d.uc--;
d.Wb < this.ha.Qd && d.Wb++;
if (d.Db && 0 >= d.uc && 0 <= d.Wb) {
for (var f = !1, g = 0, h = this.ia.A; g < h.length;) {
var l = h[g];
++g;
if (0 != (l.m & 64) && l != d.N) {
var p = l.a, t = d.N.a, x = p.x - t.x;
p = p.y - t.y;
t = Math.sqrt(x * x + p * p);
if (4 > t - l.M - d.N.M) {
f = x / t;
x = p / t;
p = e.Mc;
var B = t = l.u;
l = l.L;
t.x = B.x + f * p * l;
t.y = B.y + x * p * l;
B = d.N;
l = -e.Nc;
t = p = B.u;
B = B.L;
p.x = t.x + f * l * B;
p.y = t.y + x * l * B;
f = !0;
}
}
}
f && (null != this.ha.vf && this.ha.vf(d), d.Db = !1, d.uc = this.ha.Xc, d.Wb -= this.ha.fc);
}
f = d.Kb;
h = g = 0;
0 != (f & 1) && --h;
0 != (f & 2) && ++h;
0 != (f & 4) && --g;
0 != (f & 8) && ++g;
0 != g && 0 != h && (f = Math.sqrt(g * g + h * h), g /= f, h /= f);
f = d.N.u;
l = d.Db ? e.Oc : e.zc;
f.x += g * l;
f.y += h * l;
d.N.ga = d.Db ? e.Pc : e.ga;
}
}
c = 0;
d = this.ia.A;
e = 0;
for (g = d.length; e < g;) f = e++, h = d[f], 0 != (h.m & 128) && (P.Re[c] = f, f = P.jf[c], h = h.a, f.x = h.x, f.y = h.y, ++c);
this.ia.Ca(a);
if (0 == this.$a) {
for (a = 0; a < b.length;) c = b[a], ++a, null != c.N && (c.N.c = 39 | this.Od.kh);
b = this.ia.A[0].u;
0 < b.x * b.x + b.y * b.y && (this.$a = 1);
} else if (1 == this.$a) {
this.Mb += .016666666666666666;
for (a = 0; a < b.length;) d = b[a], ++a, null != d.N && (d.N.c = 39);
d = u.oa;
b = this.ia.A;
for (a = 0; a < c && (d = a++, d = this.ea.Cg(b[P.Re[d]].a, P.jf[d]), d == u.oa););
d != u.oa ? (this.$a = 2, this.Ab = 150, this.Od = d, d == u.fa ? this.vb++ : this.zb++, null != this.ha.Lf && this.ha.Lf(d.Zc), null != this.ha.yf && this.ha.yf(d.P)) : 0 < this.Na && this.Mb >= 60 * this.Na && this.zb != this.vb && (null != this.ha.li && this.ha.li(), this.If());
} else if (2 == this.$a) this.Ab--, 0 >= this.Ab && (0 < this.ab && (this.zb >= this.ab || this.vb >= this.ab) || 0 < this.Na && this.Mb >= 60 * this.Na && this.zb != this.vb ? this.If() : (this.af(), null != this.ha.wf && this.ha.wf()));
else if (3 == this.$a && (this.Ab--, 0 >= this.Ab && (b = this.ha, null != b.D))) {
b.D = null;
a = 0;
for (c = b.ba; a < c.length;) d = c[a], ++a, d.N = null, d.Fb = 0;
null != b.ld && b.ld(null);
}
}
}
If() {
this.Ab = 300;
this.$a = 3;
null != this.ha.Mf && this.ha.Mf(this.zb > this.vb ? u.fa : u.ta);
}
af() {
let a = this.ha.ba;
this.$a = 0;
for (var b = this.ea.A, c = this.ia.A, d = 0, e = this.ea.dd ? b.length : 1; d < e;) {
var f = d++;
b[f].Ze(c[f]);
}
b = [
0,
0,
0
];
for (c = 0; c < a.length;) if (d = a[c], ++c, this.$e(d), e = d.ja, e != u.oa) {
f = d.N.a;
var g = this.ea, h = b[e.P], l = e == u.fa ? g.Qb : g.Jb;
0 == l.length ? (l = h + 1 >> 1, 0 == (h & 1) && (l = -l), g = g.Ma * e.Qe, h = 55 * l) : (h >= l.length && (h = l.length - 1), h = l[h], g = h.x, h = h.y);
f.x = g;
f.y = h;
b[e.P]++;
d.Fb = b[e.P];
}
}
G(a) {
this.ia.G(a);
a.w(this.Ab);
a.w(this.$a);
a.w(this.zb);
a.w(this.vb);
a.g(this.Mb);
a.w(this.Xa);
a.f(this.Od.P);
}
}
class I {
constructor(a, b) {
this.x = a;
this.y = b;
}
}
class Sa {}
class Ha {
constructor() {
this.rc = u.oa;
this.K = new I(0, 0);
this.F = new I(0, 0);
}
G(a) {
var b = this.F;
a.g(b.x);
a.g(b.y);
b = this.K;
a.g(b.x);
a.g(b.y);
a.f(this.rc.P);
}
qa(a) {
var b = this.F;
b.x = a.o();
b.y = a.o();
b = this.K;
b.x = a.o();
b.y = a.o();
a = a.Wd();
this.rc = 1 == a ? u.fa : 2 == a ? u.ta : u.oa;
}
}
class Q {
static Xf(a, b) {
a = a.charCodeAt(b);
if (a == a) return a;
}
static substr(a, b, c) {
if (null == c) c = a.length;
else if (0 > c) if (0 == b) c = a.length + c;
else return "";
return a.substr(b, c);
}
static remove(a, b) {
b = a.indexOf(b);
if (-1 == b) return !1;
a.splice(b, 1);
return !0;
}
static now() {
return Date.now();
}
}
class ra {
static ti(a, b) {
try {
let c = new M(new DataView(a.buffer, a.byteOffset, a.byteLength), !1);
c.C();
let d = c.Ga(c.kc()), e = c.Ga(), f = new M(new DataView(d.buffer, d.byteOffset, d.byteLength), !1), g = f.mb(), h = f.mb(), l = f.Ga();
if (l.byteLength != b.byteLength) return Promise.reject(null);
a = 0;
let p = l.byteLength;
for (; a < p;) {
let t = a++;
if (l[t] != b[t]) return Promise.reject(null);
}
return ra.wi(g, h).then(function(t) {
return window.crypto.subtle.verify(ra.ei, t, e, d);
}).then(function(t) {
if (!t) throw r.s(null);
return g;
});
} catch (c) {
return Promise.reject(r.Vb(c).Ib());
}
}
static wi(a, b) {
try {
return window.crypto.subtle.importKey("jwk", {
crv: "P-256",
ext: !0,
key_ops: ["verify"],
kty: "EC",
x: a,
y: b
}, ra.ug, !0, ["verify"]);
} catch (c) {
return Promise.reject(r.Vb(c).Ib());
}
}
}
class nb {}
class E {
constructor() {
this.jd = this.kd = this.X = null;
this.Oe = 0;
this.K = this.F = this.ec = null;
this.ub = 0;
this.i = 1;
this.c = 63;
this.m = 32;
this.Ia = Infinity;
this.va = !0;
this.T = 0;
}
G(a) {
let b = 0, c = a.a;
a.f(0);
a.f(this.F.Kc);
a.f(this.K.Kc);
0 != this.ub && (b = 1, a.g(this.ub));
this.Ia != Infinity && (b |= 2, a.g(this.Ia));
0 != this.T && (b |= 4, a.w(this.T));
this.va && (b |= 8);
a.j.setUint8(c, b);
a.g(this.i);
a.w(this.c);
a.w(this.m);
}
qa(a, b) {
let c = a.C();
this.F = b[a.C()];
this.K = b[a.C()];
this.ub = 0 != (c & 1) ? a.o() : 0;
this.Ia = 0 != (c & 2) ? a.o() : Infinity;
this.T = 0 != (c & 4) ? a.I() : 0;
this.va = 0 != (c & 8);
this.i = a.o();
this.c = a.I();
this.m = a.I();
}
bb(a) {
a *= .017453292519943295;
if (0 > a) {
a = -a;
let b = this.F;
this.F = this.K;
this.K = b;
this.ub = -this.ub;
}
a > E.lg && a < E.kg && (this.Ia = 1 / Math.tan(a / 2));
}
Ob() {
if (0 == 0 * this.Ia) {
var a = this.K.a, b = this.F.a, c = .5 * (a.x - b.x);
a = .5 * (a.y - b.y);
b = this.F.a;
let d = this.Ia;
this.ec = new I(b.x + c + -a * d, b.y + a + c * d);
a = this.F.a;
b = this.ec;
c = a.x - b.x;
a = a.y - b.y;
this.Oe = Math.sqrt(c * c + a * a);
c = this.F.a;
a = this.ec;
this.jd = new I(-(c.y - a.y), c.x - a.x);
c = this.ec;
a = this.K.a;
this.kd = new I(-(c.y - a.y), c.x - a.x);
0 >= this.Ia && (a = c = this.jd, c.x = -a.x, c.y = -a.y, a = c = this.kd, c.x = -a.x, c.y = -a.y);
} else a = this.F.a, b = this.K.a, c = a.x - b.x, a = -(a.y - b.y), b = Math.sqrt(a * a + c * c), this.X = new I(a / b, c / b);
}
}
class Za {
constructor(a) {
this.hb = null;
this.Sh = 1e4;
this.Lc = !0;
a.Me();
this.ka = a.ka;
this.jb = a.jb;
this.Sb = a.Sb;
this.hb = a.hb;
this.Nf = window.performance.now();
let b = null, c = this;
b = function() {
var e = c.Sh - c.mi();
0 >= e ? c.cb() : (window.clearTimeout(c.Of), e = window.setTimeout(b, e + 1e3), c.Of = e);
};
b();
this.ka.oniceconnectionstatechange = function() {
let e = c.ka.iceConnectionState;
"closed" != e && "failed" != e || c.cb();
};
a = 0;
let d = this.jb;
for (; a < d.length;) {
let e = d[a];
++a;
e.onmessage = function(f) {
c.Lc && (c.Nf = window.performance.now(), null != c.nf && c.nf(f.data));
};
e.onclose = function() {
c.cb();
};
}
}
mi() {
return window.performance.now() - this.Nf;
}
ob(a, b) {
if (this.Lc) {
var c = this.jb[a];
0 != a && "open" != c.readyState && (c = this.jb[0]);
if ("open" == c.readyState) {
a = b.ge();
try {
c.send(a);
} catch (d) {
c = r.Vb(d).Ib(), wa.console.log(c);
}
}
}
}
cb() {
window.clearTimeout(this.Of);
this.Lc && (this.Lc = !1, this.ka.close(), null != this.mf && this.mf());
}
}
class K {
constructor() {
this.m = 32;
this.c = 63;
this.i = 1;
this.la = 0;
this.X = new I(0, 0);
}
G(a) {
let b = this.X;
a.g(b.x);
a.g(b.y);
a.g(this.la);
a.g(this.i);
a.w(this.c);
a.w(this.m);
}
qa(a) {
let b = this.X;
b.x = a.o();
b.y = a.o();
this.la = a.o();
this.i = a.o();
this.c = a.I();
this.m = a.I();
}
}
class F {
static uh() {
ub.Ei();
X.Ug().then(function(a) {
F.Se = a;
}, function() {}).then(function() {
window.parent.HBInit = F.hi;
let a = window.parent.onHBLoaded;
a?.();
});
F.Xh = window.document.getElementById("roomlink");
}
static di(a, b, c) {
F.bd ?? (F.bd = window.document.getElementById("recaptcha"), F.Rh = a.render(F.bd, {
sitekey: b,
callback: function(d) {
null != F.Xd && F.Xd(d);
}
}));
F.bd.hidden = !1;
a.reset(F.Rh);
F.Xd = function(d) {
window.setTimeout(function() {
F.bd.hidden = !0;
c(d);
}, 1e3);
F.Xd = null;
};
}
static wh(a, b) {
return "https://www.haxball.com/play?c=" + a + (b ? "&p=1" : "");
}
static hi(a) {
function b() {
if (!l) {
var k = new Xa();
k.si = 9;
k.pa = y.Yd;
k.ba = y.ba.length - (x ? 0 : 1);
k.zh = D.Wc;
k.ib = Ia.ib;
k.lb = null != D.lb;
k.Rc = Ia.Rc;
k.Tc = Ia.Tc;
var n = A.aa(16);
k.G(n);
D.ce(n.ge());
}
}
function c(k) {
ob.then(function() {
D.nc(k);
});
}
function d(k) {
return null == k ? null : {
x: k.a.x,
y: k.a.y,
xspeed: k.u.x,
yspeed: k.u.y,
xgravity: k.ma.x,
ygravity: k.ma.y,
radius: k.M,
bCoeff: k.i,
invMass: k.L,
damping: k.ga,
color: k.T,
cMask: k.c,
cGroup: k.m
};
}
function e() {
return null == y.D ? null : {
red: y.D.zb,
blue: y.D.vb,
time: y.D.Mb,
scoreLimit: y.D.ab,
timeLimit: 60 * y.D.Na
};
}
function f(k) {
if (null == k) return null;
let n = null, v = k.N;
null != v && (n = {
x: v.a.x,
y: v.a.y
});
return {
name: k.pa,
team: k.ja.P,
id: k.na,
admin: k.Cb,
position: n
};
}
function g(k, n) {
k = a[k];
return null == k ? n : q.l(k, String);
}
function h(k, n) {
k = a[k];
return null == k ? n : k;
}
if (F.Ff) throw r.s("Can't init twice");
F.Ff = !0;
let l = !h("public", !1);
var p = g("roomName", "Headless Room");
let t = g("playerName", "Host"), x = h("noPlayer", !1), B = q.l(h("maxPlayers", 12), Ja), N = g("password", null), sa = g("token", null), vb = h("geo", null), Ia = F.Se;
if (null != vb && (Ia = X.Te(vb), 3 < Ia.ib.length)) throw r.s("Invalid country code");
let y = new Ta();
y.Yd = p;
x || (p = new Fa(), p.pa = t, p.Cb = !0, p.country = Ia.ib, y.ba.push(p));
let D = new Ua({
iceServers: xa.Nd,
Gi: xa.Ke + "api/host",
state: y,
version: 9,
Ii: sa
});
D.Wc = 2 > B ? 2 : 30 < B ? 30 : B;
D.lb = N;
let ob = Promise.resolve();
b();
let $a = null, J = {
sendChat: function(k, n) {
let v = new la();
v.Pa = k;
null != n ? ob.then(function() {
D.Df(v, n);
}) : c(v);
},
sendAnnouncement: function(k, n, v, G, H) {
G = {
bold: 1,
italic: 2,
small: 3,
"small-bold": 4,
"small-italic": 5
}[G];
G ??= 0;
v ??= -1;
H ??= 1;
let ia = Y.V(k, v, G, H);
null != n ? ob.then(function() {
D.Df(ia, n);
}) : c(ia);
},
setPlayerAdmin: function(k, n) {
c(ba.V(k, n));
},
setPlayerTeam: function(k, n) {
c(aa.V(k, 1 == n ? u.fa : 2 == n ? u.ta : u.oa));
},
setPlayerAvatar: function(k, n) {
c(fa.V(k, n));
},
kickPlayer: function(k, n, v) {
n ??= "";
c(S.V(k, n, v));
},
clearBan: function(k) {
D.Ed(k);
},
clearBans: function() {
D.Fd();
},
setScoreLimit: function(k) {
c(U.V(0, k));
},
setTimeLimit: function(k) {
c(U.V(1, k));
},
setCustomStadium: function(k) {
let n = new w();
try {
n.mh(k);
} catch (v) {
throw r.s(r.Vb(v).Ib());
}
c(V.V(n));
},
setDefaultStadium: function(k) {
let n = w.Hd(), v = null, G = 0;
for (; G < n.length;) {
let H = n[G];
++G;
if (H.pa == k) {
v = H;
break;
}
}
if (null == v) throw r.s("Stadium doesn't exist");
c(V.V(v));
},
setDiscProperties: function(k, n) {
c(L.cg(k, !1, n));
},
setPlayerDiscProperties: function(k, n) {
c(L.cg(k, !0, n));
},
setTeamColors: function(k, n, v, G) {
let H = new qa(), ia = new W();
H.rd = ia;
H.ja = 1 == k ? u.fa : 2 == k ? u.ta : u.oa;
ia.Qa = [];
var ab = G.length;
k = 0;
for (ab = 3 > ab ? ab : 3; k < ab;) ia.Qa.push(G[k++] | 0);
ia.ee = v | 0;
ia.Je = 256 * n / 360 | 0;
c(H);
},
setKickRateLimit: function(k, n, v) {
k ??= 2;
n ??= 0;
v ??= 0;
k = ea.V(k, n, v);
c(k);
},
startGame: function() {
c(new ma());
},
stopGame: function() {
c(new na());
},
pauseGame: function(k) {
let n = new oa();
n.wc = k;
c(n);
},
setTeamsLock: function(k) {
let n = new pa();
n.newValue = k;
c(n);
},
setPassword: function(k) {
D.lb = null == k ? null : q.l(k, String);
b();
},
setRequireRecaptcha: function(k) {
D.be(q.l(k, bb));
},
getPlayerList: function() {
let k = [], n = 0, v = y.ba;
for (; n < v.length;) k.push(f(v[n++]));
return k;
},
getPlayer: function(k) {
k = y.O(k);
return null == k ? null : f(k);
},
getScores: function() {
return e();
},
getBallPosition: function() {
var k = y.D;
if (null == k) return null;
k = k.ia.A[0].a;
return {
x: k.x,
y: k.y
};
},
getPlayerDiscProperties: function(k) {
if (null == y.D) return null;
k = y.O(k);
return null == k ? null : d(k.N);
},
getDiscProperties: function(k) {
let n = y.D;
return null == n ? null : d(n.ia.A[k]);
},
getDiscCount: function() {
let k = y.D;
return null == k ? 0 : k.ia.A.length;
},
startRecording: function() {
$a = new cb(D, 3);
},
stopRecording: function() {
if (null == $a) return null;
let k = $a.stop();
$a = null;
return k;
},
reorderPlayers: function(k, n) {
c(da.V(k, n));
},
CollisionFlags: {
ball: 1,
red: 2,
blue: 4,
redKO: 8,
blueKO: 16,
wall: 32,
kick: 64,
score: 128,
c0: 268435456,
c1: 536870912,
c2: 1073741824,
c3: -2147483648,
all: 63
}
};
D.ic = function(k, n) {
Ka.lh().then(function(v) {
F.di(v, k, n);
});
};
window.setInterval(function() {
D.Ca();
}, 50);
window.setInterval(function() {
D.nc(ca.V(D));
}, 3e3);
D.kf = function(k) {
null != y.O(k) && D.nc(S.V(k, "Bad actor", !1));
};
D.Ah = function(k, n) {
let v = n.mb();
if (25 < v.length) throw r.s("name too long");
let G = n.mb();
if (3 < G.length) throw r.s("country too long");
n = n.Ya();
if (null != n && 2 < n.length) throw r.s("avatar too long");
D.nc(Z.V(k, v, G, n));
b();
};
D.Bh = function(k) {
null != y.O(k) && D.nc(S.V(k, null, !1));
};
D.Yc = function(k) {
k = F.wh(k, null != D.lb);
F.Xh.innerHTML = "<p>Room Link: <a href=\"" + k + "\">" + k + "</a></p>";
{
let n = J.onRoomLink;
n?.(k);
}
};
y.Gh = function(k) {
var n = D.wb.get(k.na), v = null, G = null;
null != n && (v = n.Kg, G = n.jc.hb);
n = v;
v = J.onPlayerJoin;
null != v && (k = f(k), k.auth = n, k.conn = G, v(k));
};
y.Mf = function() {
{
let k = J.onTeamVictory;
null != k && null != y.D && k(e());
}
};
y.tf = function(k, n) {
let v = J.onPlayerChat;
return null == v ? !0 : 0 != v(f(k), n);
};
y.vf = function(k) {
let n = J.onPlayerBallKick;
n?.(f(k));
};
y.Lf = function(k) {
let n = J.onTeamGoal;
null != n && null != y.D && n(k.P);
};
y.Jf = function(k) {
let n = J.onGameStart;
n?.(f(k));
};
y.ld = function(k) {
let n = J.onGameStop;
n?.(f(k));
};
y.Ih = function(k, n) {
let v = J.onPlayerTeamChange;
v?.(f(n), f(k));
};
y.sf = function(k, n) {
let v = J.onPlayerAdminChange;
v?.(f(n), f(k));
};
y.Qg = function() {
let k = J.onGameTick;
k?.();
};
y.Eh = function(k, n) {
n = J[n ? "onGamePause" : "onGameUnpause"];
n?.(f(k));
};
y.wf = function() {
let k = J.onPositionsReset;
k?.();
};
y.uf = function(k) {
{
let n = J.onPlayerActivity;
n?.(f(k));
}
};
y.Hf = function(k, n) {
let v = J.onStadiumChange;
v?.(n.pa, f(k));
};
y.Hh = function(k, n, v, G) {
b();
var H = J.onPlayerLeave;
H?.(f(k));
null != n && (H = null, null != G && (H = G.pa), D.Og(k.na, n, H, v), H = J.onPlayerKicked, H?.(f(k), n, v, f(G)));
};
y.jh = function(k, n, v, G) {
let H = J.onKickRateLimitSet;
H?.(n, v, G, f(k));
};
y.ki = function(k, n) {
let v = J.onTeamsLockChange;
v?.(n, f(k));
};
return J;
}
}
class C {
constructor() {
this.Kc = 0;
this.m = 32;
this.c = 63;
this.i = 1;
this.a = new I(0, 0);
}
G(a) {
let b = this.a;
a.g(b.x);
a.g(b.y);
a.g(this.i);
a.w(this.c);
a.w(this.m);
}
qa(a) {
let b = this.a;
b.x = a.o();
b.y = a.o();
this.i = a.o();
this.c = a.I();
this.m = a.I();
}
}
class db {
constructor(a) {
let b = [], c = 0;
for (; c < a;) ++c, b.push(0);
this.gd = b;
this.tc = this.hc = 0;
}
sg(a) {
this.tc -= this.gd[this.hc];
this.gd[this.hc] = a;
this.tc += a;
this.hc++;
this.hc >= this.gd.length && (this.hc = 0);
}
wg() {
return this.tc / this.gd.length;
}
}
class W {
constructor() {
this.ee = 16777215;
this.Qa = [];
}
G(a) {
a.f(this.Je);
a.w(this.ee);
a.f(this.Qa.length);
let b = 0, c = this.Qa;
for (; b < c.length;) a.w(c[b++]);
}
qa(a) {
this.Je = a.C();
this.ee = a.I();
let b = a.C();
if (3 < b) throw r.s("too many");
this.Qa = [];
let c = 0;
for (; c < b;) ++c, this.Qa.push(a.I());
}
}
class La {
constructor(a, b, c, d) {
this.Ac = /* @__PURE__ */ new Set();
this.$b = /* @__PURE__ */ new Set();
this.ed = this.lc = this.Ef = !1;
this.Za = null;
this.mc = this.P = "";
this.Vh = 5e4;
this.Uh = 1e4;
this.xb = /* @__PURE__ */ new Map();
this.fi = a;
this.Nd = b;
this.Bg = c;
this.mc = d;
this.mc ??= "";
this.de();
}
ce(a) {
if (null != this.Za || null != a) {
if (null != this.Za && null != a && this.Za.byteLength == a.byteLength) {
let c = new Uint8Array(this.Za), d = new Uint8Array(a), e = !1, f = 0, g = this.Za.byteLength;
for (; f < g;) {
let h = f++;
if (c[h] != d[h]) {
e = !0;
break;
}
}
if (!e) return;
}
this.Za = a.slice(0);
this.ed = !0;
var b = this;
null != this.ua && 1 == this.ua.readyState && null == this.fd && (this.$d(), this.fd = window.setTimeout(function() {
b.fd = null;
1 == b.ua.readyState && b.ed && b.$d();
}, 1e4));
}
}
be(a) {
function b() {
null != c.ua && 1 == c.ua.readyState && c.lc != c.Ef && c.Cf();
c.Af = null;
}
this.lc = a;
let c = this;
this.Af ?? (b(), this.Af = window.setTimeout(b, 1e3));
}
de(a) {
function b(e) {
e = e.sitekey;
if (null == e) throw r.s(null);
null != d.ic && d.ic(e, function(f) {
d.de(f);
});
}
function c(e) {
let f = e.url;
if (null == f) throw r.s(null);
e = e.token;
if (null == e) throw r.s(null);
d.ua = new WebSocket(f + "?token=" + e);
d.ua.binaryType = "arraybuffer";
d.ua.onopen = function() {
d.eh();
};
d.ua.onclose = function(g) {
d.Id(4001 != g.code);
};
d.ua.onerror = function() {
d.Id(!0);
};
d.ua.onmessage = ib(d, d.dh);
}
a ??= "";
let d = this;
T.Kh(this.fi, "token=" + this.mc + "&rcr=" + a, T.jg).then(function(e) {
switch (e.action) {
case "connect":
c(e);
break;
case "recaptcha": b(e);
}
}).catch(function() {
d.Id(!0);
});
}
eh() {
null != this.Za && this.$d();
0 != this.lc && this.Cf();
let a = this;
this.Fh = window.setInterval(function() {
a.$h();
}, 4e4);
}
dh(a) {
a = new M(new DataView(a.data), !1);
switch (a.C()) {
case 1:
this.ah(a);
break;
case 4:
this.Wg(a);
break;
case 5:
this.Yg(a);
break;
case 6: this.$g(a);
}
}
ah(a) {
let b = a.Pb(), c = R.Ai(a.Ga(a.C())), d, e, f;
try {
var g = ta.Wf(a.Ga(), wb);
a = new M(new DataView(g.buffer, g.byteOffset, g.byteLength), !1);
d = 0 != a.C();
e = a.mb();
let h = a.xf();
g = [];
let l = 0;
for (; l < h.length;) g.push(new RTCIceCandidate(h[l++]));
f = g;
} catch (h) {
this.oc(b, 0);
return;
}
this.bh(b, c, e, f, a, d);
}
bh(a, b, c, d, e, f) {
if (16 <= this.xb.size) this.oc(a, 4104);
else if (this.Ac.has(b)) this.oc(a, 4102);
else {
for (var g = [], h = 0; h < d.length;) {
let x = La.Ve(d[h++]);
if (null != x) {
if (this.$b.has(x)) {
this.oc(a, 4102);
return;
}
g.push(x);
}
}
if (null != this.Ne && (h = new M(e.j), h.a = e.a, e = this.Ne(b, h), 1 == e.Ld)) {
this.oc(a, e.reason);
return;
}
var l = new ua(a, this.Nd, this.Bg);
f && (l.Pe = 2500);
l.Sb = g;
l.hb = b;
this.xb.set(a, l);
var p = this, t = function() {
p.pc(0, l, null);
p.xb.delete(l.P);
};
l.Td = t;
l.Sd = function() {
p.xb.delete(l.P);
p.pc(0, l, null);
null != p.lf && p.lf(new Za(l));
};
l.ii();
(async function() {
try {
let x = await l.Ig(new RTCSessionDescription({
sdp: c,
type: "offer"
}), d);
p.ai(l, x, l.Md);
l.Ye.then(function() {
p.pc(0, l, null);
});
l.Ud = function(B) {
p.Zh(l, B);
};
} catch (x) {
t();
}
})();
}
}
Wg(a) {
let b = a.Pb(), c;
try {
let d = ta.Wf(a.Ga(), wb);
a = new M(new DataView(d.buffer, d.byteOffset, d.byteLength), !1);
c = new RTCIceCandidate(a.xf());
} catch (d) {
return;
}
this.Xg(b, c);
}
Xg(a, b) {
a = this.xb.get(a);
if (null != a) {
let c = La.Ve(b);
if (null != c && (a.Sb.push(c), this.$b.has(c))) return;
a.Ie(b);
}
}
Yg(a) {
this.P = a.ad(a.C());
null != this.Yc && this.Yc(this.P);
}
$g(a) {
this.mc = a.ad(a.j.byteLength - a.a);
}
pc(a, b, c) {
if (!b.pf) {
0 == a && (b.pf = !0);
var d = b.P;
b = A.aa(32, !1);
b.f(a);
b.xa(d);
null != c && (a = pako.deflateRaw(c.Bb()), b.pb(a));
this.ua.send(b.Tb());
}
}
oc(a, b) {
let c = A.aa(16, !1);
c.f(0);
c.xa(a);
c.Oa(b);
this.ua.send(c.Tb());
}
$h() {
let a = A.aa(1, !1);
a.f(8);
this.ua.send(a.Tb());
}
$d() {
this.ed = !1;
let a = A.aa(256, !1);
a.f(7);
null != this.Za && a.Sf(this.Za);
this.ua.send(a.Tb());
}
Cf() {
let a = A.aa(2, !1);
a.f(9);
a.f(this.lc ? 1 : 0);
this.ua.send(a.Tb());
this.Ef = this.lc;
}
ai(a, b, c) {
let d = A.aa(32, !1);
d.Ub(b.sdp);
d.Tf(c);
this.pc(1, a, d);
}
Zh(a, b) {
let c = A.aa(32, !1);
c.Tf(b);
this.pc(4, a, c);
}
Ng() {
let a = this.xb.values(), b = a.next();
for (; !b.done;) {
let c = b.value;
b = a.next();
c.cb();
}
this.xb.clear();
}
Id(a) {
this.Ng();
window.clearTimeout(this.fd);
this.fd = null;
this.ed = !1;
window.clearInterval(this.Fh);
window.clearTimeout(this.Wh);
let b = this;
a && (this.Wh = window.setTimeout(function() {
b.de();
}, this.Uh + Math.random() * this.Vh | 0));
}
xg(a) {
let b = 0, c = a.Sb;
for (; b < c.length;) this.$b.add(c[b++]);
null != a.hb && this.Ac.add(a.hb);
return {
Hi: a.Sb,
yi: a.hb
};
}
Fd() {
this.$b.clear();
this.Ac.clear();
}
Ed(a) {
let b = 0, c = a.Hi;
for (; b < c.length;) this.$b.delete(c[b++]);
this.Ac.delete(a.yi);
}
static Ve(a) {
try {
let b = rb.Dh(a.candidate);
if ("srflx" == b.pi) return b.hh;
} catch (b) {}
return null;
}
}
class eb {
constructor(a) {
this.hf = new db(15);
this.Kd = 0;
this.He = /* @__PURE__ */ new Map();
this.Vg = new Va(100, 16);
this.cd = !1;
this.$c = 0;
this.jc = a;
a = A.aa(8);
a.g(Math.random());
this.dc = a.Bb();
}
ob(a, b) {
b ??= 0;
this.jc.ob(b, a);
}
}
class Ta {
constructor() {
this.ea = null;
this.Xc = 2;
this.fc = 0;
this.Qd = 1;
this.ab = this.Na = 3;
this.md = !1;
this.D = null;
this.ba = [];
this.Yd = "";
this.ea = w.Hd()[0];
this.sc = [
null,
new W(),
new W()
];
this.sc[1].Qa.push(u.fa.T);
this.sc[2].Qa.push(u.ta.T);
}
gi(a) {
if (null == this.D) {
this.D = new P();
for (var b = 0, c = this.ba; b < c.length;) {
let d = c[b];
++b;
d.N = null;
d.Fb = 0;
}
this.D.gh(this);
null != this.Jf && this.Jf(a);
}
}
Hc(a, b, c) {
if (b.ja != c) {
b.ja = c;
Q.remove(this.ba, b);
this.ba.push(b);
if (null != this.D) {
null != b.N && (Q.remove(this.D.ia.A, b.N), b.N = null);
this.D.$e(b);
let d = 0, e = !1;
for (; !e;) {
++d;
e = !0;
let f = 0, g = this.ba;
for (; f < g.length;) {
let h = g[f];
++f;
if (h != b && h.ja == b.ja && h.Fb == d) {
e = !1;
break;
}
}
}
b.Fb = d;
}
kb.sa(this.Ih, a, b, c);
}
}
O(a) {
let b = 0, c = this.ba;
for (; b < c.length;) {
let d = c[b];
++b;
if (d.na == a) return d;
}
return null;
}
Ca(a) {
null != this.D && this.D.Ca(a);
}
G(a) {
a.Da(this.Yd);
a.f(this.md ? 1 : 0);
a.w(this.ab);
a.w(this.Na);
a.ie(this.Qd);
a.f(this.fc);
a.f(this.Xc);
this.ea.G(a);
a.f(null != this.D ? 1 : 0);
null != this.D && this.D.G(a);
a.f(this.ba.length);
let b = 0, c = this.ba;
for (; b < c.length;) c[b++].S(a);
this.sc[1].G(a);
this.sc[2].G(a);
}
Ue() {
let a = 0;
var b = A.aa();
this.G(b);
for (b = b.oi(); 4 <= b.j.byteLength - b.a;) a ^= b.I();
return a;
}
Sg() {
let a = A.aa(4);
a.w(this.Ue());
return a.ge();
}
Gg(a) {
a = new M(new DataView(a)).I();
Wa.sa(this.Ki, this.Ue() != a);
}
Gf(a) {
this.yf = a;
}
za(a) {
if (0 == a) return !0;
a = this.O(a);
return null != a && a.Cb ? !0 : !1;
}
ci(a, b, c, d) {
this.Xc = 0 > b ? 0 : 255 < b ? 255 : b;
this.fc = 0 > c ? 0 : 255 < c ? 255 : c;
0 > d ? d = 0 : 100 < d && (d = 100);
this.Qd = this.fc * d;
Ya.sa(this.jh, a, this.Xc, this.fc, d);
}
}
class Wa {
static sa(a, b) {
a?.(b);
}
}
class w {
constructor() {
this.v = [];
this.J = [];
this.Y = [];
this.Sa = [];
this.A = [];
this.Ta = [];
this.Qb = [];
this.Jb = [];
this.Nb = new Ra();
this.Gd = 255;
this.Cd = this.Rd = 0;
this.Dd = !0;
this.dd = !1;
}
Uc() {
let a = new ha();
a.T = 16777215;
a.c = 63;
a.m = 193;
a.M = 10;
a.ga = .99;
a.L = 1;
a.i = .5;
return a;
}
G(a) {
a.f(this.Gd);
if (!this.ih()) {
a.Da(this.pa);
a.w(this.Ec);
a.g(this.Fc);
a.g(this.Dc);
a.g(this.bc);
a.g(this.ac);
a.g(this.Ad);
a.w(this.Cc);
a.g(this.cc);
a.g(this.Gc);
a.g(this.Ma);
this.Nb.G(a);
a.Oa(this.Rd);
a.f(this.Cd);
a.f(this.Dd ? 1 : 0);
a.f(this.dd ? 1 : 0);
a.f(this.v.length);
for (var b = 0, c = this.v.length; b < c;) {
var d = b++;
let e = this.v[d];
e.Kc = d;
e.G(a);
}
a.f(this.J.length);
b = 0;
for (c = this.J; b < c.length;) c[b++].G(a);
a.f(this.Y.length);
b = 0;
for (c = this.Y; b < c.length;) c[b++].G(a);
a.f(this.Sa.length);
b = 0;
for (c = this.Sa; b < c.length;) c[b++].G(a);
a.f(this.A.length);
b = 0;
for (c = this.A; b < c.length;) c[b++].G(a);
a.f(this.Ta.length);
b = 0;
for (c = this.Ta; b < c.length;) c[b++].G(a);
a.f(this.Qb.length);
b = 0;
for (c = this.Qb; b < c.length;) d = c[b], ++b, a.g(d.x), a.g(d.y);
a.f(this.Jb.length);
b = 0;
for (c = this.Jb; b < c.length;) d = c[b], ++b, a.g(d.x), a.g(d.y);
}
}
ri(a) {
function b() {
let f = [], g = a.C(), h = 0;
for (; h < g;) {
++h;
let l = new I(0, 0);
l.x = a.o();
l.y = a.o();
f.push(l);
}
return f;
}
this.pa = a.Ya();
this.Ec = a.I();
this.Fc = a.o();
this.Dc = a.o();
this.bc = a.o();
this.ac = a.o();
this.Ad = a.o();
this.Cc = a.I();
this.cc = a.o();
this.Gc = a.o();
this.Ma = a.o();
this.Nb.qa(a);
this.Rd = a.kc();
this.Cd = a.C();
this.Dd = 0 != a.C();
this.dd = 0 != a.C();
this.v = [];
for (var c = a.C(), d = 0; d < c;) {
var e = new C();
e.qa(a);
e.Kc = d++;
this.v.push(e);
}
this.J = [];
c = a.C();
for (d = 0; d < c;) ++d, e = new E(), e.qa(a, this.v), this.J.push(e);
this.Y = [];
c = a.C();
for (d = 0; d < c;) ++d, e = new K(), e.qa