이 스크립트는 직접 설치해서 쓰는 게 아닙니다. 다른 스크립트가 메타 명령 // @require https://update.greasyfork.org/scripts/484816/1316319/bundlejs%20override.js
(으)로 포함하여 쓰는 라이브러리입니다.
(() => {
window.NEWEST_VERSION = 5;
const timeoutMs = 30;
let canPlace = true;
let buildings = new Map();
let missingBuildings = new Map();
let buildingsToUpgrade = new Map();
const towers = ["RocketTower", "SawTower", "MageTower", "CannonTower", "ArrowTower", "Drill", "LightningTower", "Wall", "Door"];
window.autoRebuilder = true;
window.saveBuildings = () => {
for (let building in game.ui.buildings) {
let { x, y, tier, type } = game.ui.buildings[building];
if (type !== "Factory") buildings.set(`${x}, ${y}, ${type}`, { tier: tier, type: type, x: x, y: y });
};
};
let sendMsg = (msg) => {
console.log(msg)
const b = document.createElement("div");
b.className = "hud-chat-message";
b.innerHTML = "<strong style=\"" + ("color:#00FF00;") + "\">[Script] </strong><strong><span id=\"name\"></span>: </strong><span id=\"message\"></span>";
const d = document.createTextNode(msg);
b.querySelector("#message").appendChild(d);
game.ui.components.uiChat.messagesElem.appendChild(b);
b.addEventListener("mousedown", a => {
a.stopPropagation();
});
b.addEventListener("mouseup", a => {
a.stopPropagation();
});
};
let recordBase = () => {
let buildCode = "";
for (let building of Object.values(game.ui.buildings)) {
const { factory } = game.ui;
const { x, y, type } = building;
const towercode = `${x - factory.x}, ${y - factory.y}, ${towers.indexOf(type)};`;
if (type == "Factory") continue;
buildCode += towercode;
};
return new Promise((resolve, reject) => {
resolve(buildCode);
})
};
let buildBase = (buildCode) => {
if (!game.ui?.factory) throw new Error("Cant place without a stash");
const buildings = buildCode.split(";");
let buildingPackets = [];
for (const building of buildings.slice(0, buildings.length - 1)) {
const { x, y } = game.ui.factory;
const properties = building.replaceAll(",", "").split(" "); //split into properties of different towers
const packet = { name: "PlaceBuilding", x: (parseInt(properties[0]) + x), y: (parseInt(properties[1]) + y), type: towers[properties[2]], yaw: 0 };
buildingPackets.push(packet)
}
for (let i = 0; i < buildingPackets.length; i++) {
setTimeout(() => {
const { x, y } = buildingPackets[i];
game.network.sendInput({ x: x, y: y })
game.network.sendRpc(buildingPackets[i])
}, i * 100)
};
}
!localStorage.recordedBase && (localStorage.recordedBase = "{}");
var a = {
779: function (a, b, c) {
var d;
var e;
var f;
e = [c(514)];
d = function (a) {
'use strict';
function b(a, c, e) {
if (a === undefined) {
a = b.DEFAULT_CAPACITY;
}
if (c === undefined) {
c = b.DEFAULT_ENDIAN;
}
if (e === undefined) {
e = b.DEFAULT_NOASSERT;
}
if (!e) {
if ((a |= 0) < 0) {
throw RangeError("Illegal capacity");
}
c = !!c;
e = !!e;
}
this.buffer = a === 0 ? d : new ArrayBuffer(a);
this.view = a === 0 ? null : new Uint8Array(this.buffer);
this.offset = 0;
this.markedOffset = -1;
this.limit = a;
this.littleEndian = c;
this.noAssert = e;
}
b.VERSION = "5.0.1";
b.LITTLE_ENDIAN = true;
b.BIG_ENDIAN = false;
b.DEFAULT_CAPACITY = 16;
b.DEFAULT_ENDIAN = b.BIG_ENDIAN;
b.DEFAULT_NOASSERT = false;
b.Long = a || null;
var c = b.prototype;
c.__isByteBuffer__;
Object.defineProperty(c, "__isByteBuffer__", {
value: true,
enumerable: false,
configurable: false
});
var d = new ArrayBuffer(0);
var e = String.fromCharCode;
function f(a) {
var b = 0;
return function () {
if (b < a.length) {
return a.charCodeAt(b++);
} else {
return null;
}
};
}
function g() {
var a = [];
var b = [];
return function () {
if (arguments.length === 0) {
return b.join("") + e.apply(String, a);
}
if (a.length + arguments.length > 1024) {
b.push(e.apply(String, a));
a.length = 0;
}
Array.prototype.push.apply(a, arguments);
};
}
function h(a, b, c, d, e) {
var f;
var g;
var h = e * 8 - d - 1;
var i = (1 << h) - 1;
var j = i >> 1;
var k = -7;
var l = c ? e - 1 : 0;
var m = c ? -1 : 1;
var n = a[b + l];
l += m;
f = n & (1 << -k) - 1;
n >>= -k;
k += h;
for (; k > 0; k -= 8) {
f = f * 256 + a[b + l];
l += m;
}
g = f & (1 << -k) - 1;
f >>= -k;
k += d;
for (; k > 0; k -= 8) {
g = g * 256 + a[b + l];
l += m;
}
if (f === 0) {
f = 1 - j;
} else {
if (f === i) {
if (g) {
return NaN;
} else {
return (n ? -1 : 1) * Infinity;
}
}
g += Math.pow(2, d);
f -= j;
}
return (n ? -1 : 1) * g * Math.pow(2, f - d);
}
function i(a, b, c, d, e, f) {
var g;
var h;
var i;
var j = f * 8 - e - 1;
var k = (1 << j) - 1;
var l = k >> 1;
var m = e === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
var n = d ? 0 : f - 1;
var o = d ? 1 : -1;
var p = b < 0 || b === 0 && 1 / b < 0 ? 1 : 0;
b = Math.abs(b);
if (isNaN(b) || b === Infinity) {
h = isNaN(b) ? 1 : 0;
g = k;
} else {
g = Math.floor(Math.log(b) / Math.LN2);
if (b * (i = Math.pow(2, -g)) < 1) {
g--;
i *= 2;
}
if ((b += g + l >= 1 ? m / i : m * Math.pow(2, 1 - l)) * i >= 2) {
g++;
i /= 2;
}
if (g + l >= k) {
h = 0;
g = k;
} else if (g + l >= 1) {
h = (b * i - 1) * Math.pow(2, e);
g += l;
} else {
h = b * Math.pow(2, l - 1) * Math.pow(2, e);
g = 0;
}
}
for (; e >= 8; e -= 8) {
a[c + n] = h & 255;
n += o;
h /= 256;
}
g = g << e | h;
j += e;
for (; j > 0; j -= 8) {
a[c + n] = g & 255;
n += o;
g /= 256;
}
a[c + n - o] |= p * 128;
}
b.accessor = function () {
return Uint8Array;
};
b.allocate = function (a, c, d) {
return new b(a, c, d);
};
b.concat = function (a, c, d, e) {
if (typeof c == "boolean" || typeof c != "string") {
e = d;
d = c;
c = undefined;
}
for (var f, g = 0, h = 0, i = a.length; h < i; ++h) {
if (!b.isByteBuffer(a[h])) {
a[h] = b.wrap(a[h], c);
}
if ((f = a[h].limit - a[h].offset) > 0) {
g += f;
}
}
if (g === 0) {
return new b(0, d, e);
}
var j;
var k = new b(g, d, e);
for (h = 0; h < i;) {
if ((f = (j = a[h++]).limit - j.offset) > 0) {
k.view.set(j.view.subarray(j.offset, j.limit), k.offset);
k.offset += f;
}
}
k.limit = k.offset;
k.offset = 0;
return k;
};
b.isByteBuffer = function (a) {
return (a && a.__isByteBuffer__) === true;
};
b.type = function () {
return ArrayBuffer;
};
b.wrap = function (a, d, e, f) {
if (typeof d != "string") {
f = e;
e = d;
d = undefined;
}
if (typeof a == "string") {
if (d === undefined) {
d = "utf8";
}
switch (d) {
case "base64":
return b.fromBase64(a, e);
case "hex":
return b.fromHex(a, e);
case "binary":
return b.fromBinary(a, e);
case "utf8":
return b.fromUTF8(a, e);
case "debug":
return b.fromDebug(a, e);
default:
throw Error("Unsupported encoding: " + d);
}
}
if (a === null || typeof a != "object") {
throw TypeError("Illegal buffer");
}
var g;
if (b.isByteBuffer(a)) {
(g = c.clone.call(a)).markedOffset = -1;
return g;
}
if (a instanceof Uint8Array) {
g = new b(0, e, f);
if (a.length > 0) {
g.buffer = a.buffer;
g.offset = a.byteOffset;
g.limit = a.byteOffset + a.byteLength;
g.view = new Uint8Array(a.buffer);
}
} else if (a instanceof ArrayBuffer) {
g = new b(0, e, f);
if (a.byteLength > 0) {
g.buffer = a;
g.offset = 0;
g.limit = a.byteLength;
g.view = a.byteLength > 0 ? new Uint8Array(a) : null;
}
} else {
if (Object.prototype.toString.call(a) !== "[object Array]") {
throw TypeError("Illegal buffer");
}
(g = new b(a.length, e, f)).limit = a.length;
for (var h = 0; h < a.length; ++h) {
g.view[h] = a[h];
}
}
return g;
};
c.writeBitSet = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (!(a instanceof Array)) {
throw TypeError("Illegal BitSet: Not an array");
}
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
var d;
var e = b;
var f = a.length;
var g = f >> 3;
var h = 0;
for (b += this.writeVarint32(f, b); g--;) {
d = !!a[h++] & 1 | (!!a[h++] & 1) << 1 | (!!a[h++] & 1) << 2 | (!!a[h++] & 1) << 3 | (!!a[h++] & 1) << 4 | (!!a[h++] & 1) << 5 | (!!a[h++] & 1) << 6 | (!!a[h++] & 1) << 7;
this.writeByte(d, b++);
}
if (h < f) {
var i = 0;
for (d = 0; h < f;) {
d |= (!!a[h++] & 1) << i++;
}
this.writeByte(d, b++);
}
if (c) {
this.offset = b;
return this;
} else {
return b - e;
}
};
c.readBitSet = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
var c;
var d = this.readVarint32(a);
var e = d.value;
var f = e >> 3;
var g = 0;
var h = [];
for (a += d.length; f--;) {
c = this.readByte(a++);
h[g++] = !!(c & 1);
h[g++] = !!(c & 2);
h[g++] = !!(c & 4);
h[g++] = !!(c & 8);
h[g++] = !!(c & 16);
h[g++] = !!(c & 32);
h[g++] = !!(c & 64);
h[g++] = !!(c & 128);
}
if (g < e) {
var i = 0;
for (c = this.readByte(a++); g < e;) {
h[g++] = !!(c >> i++ & 1);
}
}
if (b) {
this.offset = a;
}
return h;
};
c.readBytes = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + a > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+" + a + ") <= " + this.buffer.byteLength);
}
}
var d = this.slice(b, b + a);
if (c) {
this.offset += a;
}
return d;
};
c.writeBytes = c.append;
c.writeInt8 = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal value: " + a + " (not an integer)");
}
a |= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
b += 1;
var d = this.buffer.byteLength;
if (b > d) {
this.resize((d *= 2) > b ? d : b);
}
b -= 1;
this.view[b] = a;
if (c) {
this.offset += 1;
}
return this;
};
c.writeByte = c.writeInt8;
c.readInt8 = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 1 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+1) <= " + this.buffer.byteLength);
}
}
var c = this.view[a];
if ((c & 128) == 128) {
c = -(255 - c + 1);
}
if (b) {
this.offset += 1;
}
return c;
};
c.readByte = c.readInt8;
c.writeUint8 = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal value: " + a + " (not an integer)");
}
a >>>= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
b += 1;
var d = this.buffer.byteLength;
if (b > d) {
this.resize((d *= 2) > b ? d : b);
}
b -= 1;
this.view[b] = a;
if (c) {
this.offset += 1;
}
return this;
};
c.writeUInt8 = c.writeUint8;
c.readUint8 = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 1 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+1) <= " + this.buffer.byteLength);
}
}
var c = this.view[a];
if (b) {
this.offset += 1;
}
return c;
};
c.readUInt8 = c.readUint8;
c.writeInt16 = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal value: " + a + " (not an integer)");
}
a |= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
b += 2;
var d = this.buffer.byteLength;
if (b > d) {
this.resize((d *= 2) > b ? d : b);
}
b -= 2;
if (this.littleEndian) {
this.view[b + 1] = (a & 65280) >>> 8;
this.view[b] = a & 255;
} else {
this.view[b] = (a & 65280) >>> 8;
this.view[b + 1] = a & 255;
}
if (c) {
this.offset += 2;
}
return this;
};
c.writeShort = c.writeInt16;
c.readInt16 = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 2 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+2) <= " + this.buffer.byteLength);
}
}
var c = 0;
if (this.littleEndian) {
c = this.view[a];
c |= this.view[a + 1] << 8;
} else {
c = this.view[a] << 8;
c |= this.view[a + 1];
}
if ((c & 32768) == 32768) {
c = -(65535 - c + 1);
}
if (b) {
this.offset += 2;
}
return c;
};
c.readShort = c.readInt16;
c.writeUint16 = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal value: " + a + " (not an integer)");
}
a >>>= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
b += 2;
var d = this.buffer.byteLength;
if (b > d) {
this.resize((d *= 2) > b ? d : b);
}
b -= 2;
if (this.littleEndian) {
this.view[b + 1] = (a & 65280) >>> 8;
this.view[b] = a & 255;
} else {
this.view[b] = (a & 65280) >>> 8;
this.view[b + 1] = a & 255;
}
if (c) {
this.offset += 2;
}
return this;
};
c.writeUInt16 = c.writeUint16;
c.readUint16 = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 2 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+2) <= " + this.buffer.byteLength);
}
}
var c = 0;
if (this.littleEndian) {
c = this.view[a];
c |= this.view[a + 1] << 8;
} else {
c = this.view[a] << 8;
c |= this.view[a + 1];
}
if (b) {
this.offset += 2;
}
return c;
};
c.readUInt16 = c.readUint16;
c.writeInt32 = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal value: " + a + " (not an integer)");
}
a |= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
b += 4;
var d = this.buffer.byteLength;
if (b > d) {
this.resize((d *= 2) > b ? d : b);
}
b -= 4;
if (this.littleEndian) {
this.view[b + 3] = a >>> 24 & 255;
this.view[b + 2] = a >>> 16 & 255;
this.view[b + 1] = a >>> 8 & 255;
this.view[b] = a & 255;
} else {
this.view[b] = a >>> 24 & 255;
this.view[b + 1] = a >>> 16 & 255;
this.view[b + 2] = a >>> 8 & 255;
this.view[b + 3] = a & 255;
}
if (c) {
this.offset += 4;
}
return this;
};
c.writeInt = c.writeInt32;
c.readInt32 = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 4 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+4) <= " + this.buffer.byteLength);
}
}
var c = 0;
if (this.littleEndian) {
c = this.view[a + 2] << 16;
c |= this.view[a + 1] << 8;
c |= this.view[a];
c += this.view[a + 3] << 24 >>> 0;
} else {
c = this.view[a + 1] << 16;
c |= this.view[a + 2] << 8;
c |= this.view[a + 3];
c += this.view[a] << 24 >>> 0;
}
c |= 0;
if (b) {
this.offset += 4;
}
return c;
};
c.readInt = c.readInt32;
c.writeUint32 = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal value: " + a + " (not an integer)");
}
a >>>= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
b += 4;
var d = this.buffer.byteLength;
if (b > d) {
this.resize((d *= 2) > b ? d : b);
}
b -= 4;
if (this.littleEndian) {
this.view[b + 3] = a >>> 24 & 255;
this.view[b + 2] = a >>> 16 & 255;
this.view[b + 1] = a >>> 8 & 255;
this.view[b] = a & 255;
} else {
this.view[b] = a >>> 24 & 255;
this.view[b + 1] = a >>> 16 & 255;
this.view[b + 2] = a >>> 8 & 255;
this.view[b + 3] = a & 255;
}
if (c) {
this.offset += 4;
}
return this;
};
c.writeUInt32 = c.writeUint32;
c.readUint32 = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 4 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+4) <= " + this.buffer.byteLength);
}
}
var c = 0;
if (this.littleEndian) {
c = this.view[a + 2] << 16;
c |= this.view[a + 1] << 8;
c |= this.view[a];
c += this.view[a + 3] << 24 >>> 0;
} else {
c = this.view[a + 1] << 16;
c |= this.view[a + 2] << 8;
c |= this.view[a + 3];
c += this.view[a] << 24 >>> 0;
}
if (b) {
this.offset += 4;
}
return c;
};
c.readUInt32 = c.readUint32;
if (a) {
c.writeInt64 = function (b, c) {
var d = c === undefined;
if (d) {
c = this.offset;
}
if (!this.noAssert) {
if (typeof b == "number") {
b = a.fromNumber(b);
} else if (typeof b == "string") {
b = a.fromString(b);
} else if (!b || !(b instanceof a)) {
throw TypeError("Illegal value: " + b + " (not an integer or Long)");
}
if (typeof c != "number" || c % 1 != 0) {
throw TypeError("Illegal offset: " + c + " (not an integer)");
}
if ((c >>>= 0) < 0 || c + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + c + " (+0) <= " + this.buffer.byteLength);
}
}
if (typeof b == "number") {
b = a.fromNumber(b);
} else if (typeof b == "string") {
b = a.fromString(b);
}
c += 8;
var e = this.buffer.byteLength;
if (c > e) {
this.resize((e *= 2) > c ? e : c);
}
c -= 8;
var f = b.low;
var g = b.high;
if (this.littleEndian) {
this.view[c + 3] = f >>> 24 & 255;
this.view[c + 2] = f >>> 16 & 255;
this.view[c + 1] = f >>> 8 & 255;
this.view[c] = f & 255;
c += 4;
this.view[c + 3] = g >>> 24 & 255;
this.view[c + 2] = g >>> 16 & 255;
this.view[c + 1] = g >>> 8 & 255;
this.view[c] = g & 255;
} else {
this.view[c] = g >>> 24 & 255;
this.view[c + 1] = g >>> 16 & 255;
this.view[c + 2] = g >>> 8 & 255;
this.view[c + 3] = g & 255;
c += 4;
this.view[c] = f >>> 24 & 255;
this.view[c + 1] = f >>> 16 & 255;
this.view[c + 2] = f >>> 8 & 255;
this.view[c + 3] = f & 255;
}
if (d) {
this.offset += 8;
}
return this;
};
c.writeLong = c.writeInt64;
c.readInt64 = function (b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 8 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+8) <= " + this.buffer.byteLength);
}
}
var d = 0;
var e = 0;
if (this.littleEndian) {
d = this.view[b + 2] << 16;
d |= this.view[b + 1] << 8;
d |= this.view[b];
d += this.view[b + 3] << 24 >>> 0;
b += 4;
e = this.view[b + 2] << 16;
e |= this.view[b + 1] << 8;
e |= this.view[b];
e += this.view[b + 3] << 24 >>> 0;
} else {
e = this.view[b + 1] << 16;
e |= this.view[b + 2] << 8;
e |= this.view[b + 3];
e += this.view[b] << 24 >>> 0;
b += 4;
d = this.view[b + 1] << 16;
d |= this.view[b + 2] << 8;
d |= this.view[b + 3];
d += this.view[b] << 24 >>> 0;
}
var f = new a(d, e, false);
if (c) {
this.offset += 8;
}
return f;
};
c.readLong = c.readInt64;
c.writeUint64 = function (b, c) {
var d = c === undefined;
if (d) {
c = this.offset;
}
if (!this.noAssert) {
if (typeof b == "number") {
b = a.fromNumber(b);
} else if (typeof b == "string") {
b = a.fromString(b);
} else if (!b || !(b instanceof a)) {
throw TypeError("Illegal value: " + b + " (not an integer or Long)");
}
if (typeof c != "number" || c % 1 != 0) {
throw TypeError("Illegal offset: " + c + " (not an integer)");
}
if ((c >>>= 0) < 0 || c + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + c + " (+0) <= " + this.buffer.byteLength);
}
}
if (typeof b == "number") {
b = a.fromNumber(b);
} else if (typeof b == "string") {
b = a.fromString(b);
}
c += 8;
var e = this.buffer.byteLength;
if (c > e) {
this.resize((e *= 2) > c ? e : c);
}
c -= 8;
var f = b.low;
var g = b.high;
if (this.littleEndian) {
this.view[c + 3] = f >>> 24 & 255;
this.view[c + 2] = f >>> 16 & 255;
this.view[c + 1] = f >>> 8 & 255;
this.view[c] = f & 255;
c += 4;
this.view[c + 3] = g >>> 24 & 255;
this.view[c + 2] = g >>> 16 & 255;
this.view[c + 1] = g >>> 8 & 255;
this.view[c] = g & 255;
} else {
this.view[c] = g >>> 24 & 255;
this.view[c + 1] = g >>> 16 & 255;
this.view[c + 2] = g >>> 8 & 255;
this.view[c + 3] = g & 255;
c += 4;
this.view[c] = f >>> 24 & 255;
this.view[c + 1] = f >>> 16 & 255;
this.view[c + 2] = f >>> 8 & 255;
this.view[c + 3] = f & 255;
}
if (d) {
this.offset += 8;
}
return this;
};
c.writeUInt64 = c.writeUint64;
c.readUint64 = function (b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 8 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+8) <= " + this.buffer.byteLength);
}
}
var d = 0;
var e = 0;
if (this.littleEndian) {
d = this.view[b + 2] << 16;
d |= this.view[b + 1] << 8;
d |= this.view[b];
d += this.view[b + 3] << 24 >>> 0;
b += 4;
e = this.view[b + 2] << 16;
e |= this.view[b + 1] << 8;
e |= this.view[b];
e += this.view[b + 3] << 24 >>> 0;
} else {
e = this.view[b + 1] << 16;
e |= this.view[b + 2] << 8;
e |= this.view[b + 3];
e += this.view[b] << 24 >>> 0;
b += 4;
d = this.view[b + 1] << 16;
d |= this.view[b + 2] << 8;
d |= this.view[b + 3];
d += this.view[b] << 24 >>> 0;
}
var f = new a(d, e, true);
if (c) {
this.offset += 8;
}
return f;
};
c.readUInt64 = c.readUint64;
}
c.writeFloat32 = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number") {
throw TypeError("Illegal value: " + a + " (not a number)");
}
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
b += 4;
var d = this.buffer.byteLength;
if (b > d) {
this.resize((d *= 2) > b ? d : b);
}
b -= 4;
i(this.view, a, b, this.littleEndian, 23, 4);
if (c) {
this.offset += 4;
}
return this;
};
c.writeFloat = c.writeFloat32;
c.readFloat32 = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 4 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+4) <= " + this.buffer.byteLength);
}
}
var c = h(this.view, a, this.littleEndian, 23, 4);
if (b) {
this.offset += 4;
}
return c;
};
c.readFloat = c.readFloat32;
c.writeFloat64 = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number") {
throw TypeError("Illegal value: " + a + " (not a number)");
}
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
b += 8;
var d = this.buffer.byteLength;
if (b > d) {
this.resize((d *= 2) > b ? d : b);
}
b -= 8;
i(this.view, a, b, this.littleEndian, 52, 8);
if (c) {
this.offset += 8;
}
return this;
};
c.writeDouble = c.writeFloat64;
c.readFloat64 = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 8 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+8) <= " + this.buffer.byteLength);
}
}
var c = h(this.view, a, this.littleEndian, 52, 8);
if (b) {
this.offset += 8;
}
return c;
};
c.readDouble = c.readFloat64;
b.MAX_VARINT32_BYTES = 5;
b.calculateVarint32 = function (a) {
if ((a >>>= 0) < 128) {
return 1;
} else if (a < 16384) {
return 2;
} else if (a < 1 << 21) {
return 3;
} else if (a < 1 << 28) {
return 4;
} else {
return 5;
}
};
b.zigZagEncode32 = function (a) {
return ((a |= 0) << 1 ^ a >> 31) >>> 0;
};
b.zigZagDecode32 = function (a) {
return a >>> 1 ^ -(a & 1) | 0;
};
c.writeVarint32 = function (a, c) {
var d = c === undefined;
if (d) {
c = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal value: " + a + " (not an integer)");
}
a |= 0;
if (typeof c != "number" || c % 1 != 0) {
throw TypeError("Illegal offset: " + c + " (not an integer)");
}
if ((c >>>= 0) < 0 || c + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + c + " (+0) <= " + this.buffer.byteLength);
}
}
var e;
var f = b.calculateVarint32(a);
c += f;
var g = this.buffer.byteLength;
if (c > g) {
this.resize((g *= 2) > c ? g : c);
}
c -= f;
a >>>= 0;
while (a >= 128) {
e = a & 127 | 128;
this.view[c++] = e;
a >>>= 7;
}
this.view[c++] = a;
if (d) {
this.offset = c;
return this;
} else {
return f;
}
};
c.writeVarint32ZigZag = function (a, c) {
return this.writeVarint32(b.zigZagEncode32(a), c);
};
c.readVarint32 = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 1 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+1) <= " + this.buffer.byteLength);
}
}
var c;
var d = 0;
var e = 0;
do {
if (!this.noAssert && a > this.limit) {
var f = Error("Truncated");
f.truncated = true;
throw f;
}
c = this.view[a++];
if (d < 5) {
e |= (c & 127) << d * 7;
}
++d;
} while ((c & 128) != 0);
e |= 0;
if (b) {
this.offset = a;
return e;
} else {
return {
value: e,
length: d
};
}
};
c.readVarint32ZigZag = function (a) {
var c = this.readVarint32(a);
if (typeof c == "object") {
c.value = b.zigZagDecode32(c.value);
} else {
c = b.zigZagDecode32(c);
}
return c;
};
if (a) {
b.MAX_VARINT64_BYTES = 10;
b.calculateVarint64 = function (b) {
if (typeof b == "number") {
b = a.fromNumber(b);
} else if (typeof b == "string") {
b = a.fromString(b);
}
var c = b.toInt() >>> 0;
var d = b.shiftRightUnsigned(28).toInt() >>> 0;
var e = b.shiftRightUnsigned(56).toInt() >>> 0;
if (e == 0) {
if (d == 0) {
if (c < 16384) {
if (c < 128) {
return 1;
} else {
return 2;
}
} else if (c < 1 << 21) {
return 3;
} else {
return 4;
}
} else if (d < 16384) {
if (d < 128) {
return 5;
} else {
return 6;
}
} else if (d < 1 << 21) {
return 7;
} else {
return 8;
}
} else if (e < 128) {
return 9;
} else {
return 10;
}
};
b.zigZagEncode64 = function (b) {
if (typeof b == "number") {
b = a.fromNumber(b, false);
} else if (typeof b == "string") {
b = a.fromString(b, false);
} else if (b.unsigned !== false) {
b = b.toSigned();
}
return b.shiftLeft(1).xor(b.shiftRight(63)).toUnsigned();
};
b.zigZagDecode64 = function (b) {
if (typeof b == "number") {
b = a.fromNumber(b, false);
} else if (typeof b == "string") {
b = a.fromString(b, false);
} else if (b.unsigned !== false) {
b = b.toSigned();
}
return b.shiftRightUnsigned(1).xor(b.and(a.ONE).toSigned().negate()).toSigned();
};
c.writeVarint64 = function (c, d) {
var e = d === undefined;
if (e) {
d = this.offset;
}
if (!this.noAssert) {
if (typeof c == "number") {
c = a.fromNumber(c);
} else if (typeof c == "string") {
c = a.fromString(c);
} else if (!c || !(c instanceof a)) {
throw TypeError("Illegal value: " + c + " (not an integer or Long)");
}
if (typeof d != "number" || d % 1 != 0) {
throw TypeError("Illegal offset: " + d + " (not an integer)");
}
if ((d >>>= 0) < 0 || d + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + d + " (+0) <= " + this.buffer.byteLength);
}
}
if (typeof c == "number") {
c = a.fromNumber(c, false);
} else if (typeof c == "string") {
c = a.fromString(c, false);
} else if (c.unsigned !== false) {
c = c.toSigned();
}
var f = b.calculateVarint64(c);
var g = c.toInt() >>> 0;
var h = c.shiftRightUnsigned(28).toInt() >>> 0;
var i = c.shiftRightUnsigned(56).toInt() >>> 0;
d += f;
var j = this.buffer.byteLength;
if (d > j) {
this.resize((j *= 2) > d ? j : d);
}
d -= f;
switch (f) {
case 10:
this.view[d + 9] = i >>> 7 & 1;
case 9:
this.view[d + 8] = f !== 9 ? i | 128 : i & 127;
case 8:
this.view[d + 7] = f !== 8 ? h >>> 21 | 128 : h >>> 21 & 127;
case 7:
this.view[d + 6] = f !== 7 ? h >>> 14 | 128 : h >>> 14 & 127;
case 6:
this.view[d + 5] = f !== 6 ? h >>> 7 | 128 : h >>> 7 & 127;
case 5:
this.view[d + 4] = f !== 5 ? h | 128 : h & 127;
case 4:
this.view[d + 3] = f !== 4 ? g >>> 21 | 128 : g >>> 21 & 127;
case 3:
this.view[d + 2] = f !== 3 ? g >>> 14 | 128 : g >>> 14 & 127;
case 2:
this.view[d + 1] = f !== 2 ? g >>> 7 | 128 : g >>> 7 & 127;
case 1:
this.view[d] = f !== 1 ? g | 128 : g & 127;
}
if (e) {
this.offset += f;
return this;
} else {
return f;
}
};
c.writeVarint64ZigZag = function (a, c) {
return this.writeVarint64(b.zigZagEncode64(a), c);
};
c.readVarint64 = function (b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 1 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+1) <= " + this.buffer.byteLength);
}
}
var d = b;
var e = 0;
var f = 0;
var g = 0;
var h = 0;
e = (h = this.view[b++]) & 127;
if (h & 128 && (e |= ((h = this.view[b++]) & 127) << 7, (h & 128 || this.noAssert && h === undefined) && (e |= ((h = this.view[b++]) & 127) << 14, (h & 128 || this.noAssert && h === undefined) && (e |= ((h = this.view[b++]) & 127) << 21, (h & 128 || this.noAssert && h === undefined) && (f = (h = this.view[b++]) & 127, (h & 128 || this.noAssert && h === undefined) && (f |= ((h = this.view[b++]) & 127) << 7, (h & 128 || this.noAssert && h === undefined) && (f |= ((h = this.view[b++]) & 127) << 14, (h & 128 || this.noAssert && h === undefined) && (f |= ((h = this.view[b++]) & 127) << 21, (h & 128 || this.noAssert && h === undefined) && (g = (h = this.view[b++]) & 127, (h & 128 || this.noAssert && h === undefined) && (g |= ((h = this.view[b++]) & 127) << 7, h & 128 || this.noAssert && h === undefined)))))))))) {
throw Error("Buffer overrun");
}
var i = a.fromBits(e | f << 28, f >>> 4 | g << 24, false);
if (c) {
this.offset = b;
return i;
} else {
return {
value: i,
length: b - d
};
}
};
c.readVarint64ZigZag = function (c) {
var d = this.readVarint64(c);
if (d && d.value instanceof a) {
d.value = b.zigZagDecode64(d.value);
} else {
d = b.zigZagDecode64(d);
}
return d;
};
}
c.writeCString = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
var d;
var e = a.length;
if (!this.noAssert) {
if (typeof a != "string") {
throw TypeError("Illegal str: Not a string");
}
for (d = 0; d < e; ++d) {
if (a.charCodeAt(d) === 0) {
throw RangeError("Illegal str: Contains NULL-characters");
}
}
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
e = k.calculateUTF16asUTF8(f(a))[1];
b += e + 1;
var g = this.buffer.byteLength;
if (b > g) {
this.resize((g *= 2) > b ? g : b);
}
b -= e + 1;
k.encodeUTF16toUTF8(f(a), function (a) {
this.view[b++] = a;
}.bind(this));
this.view[b++] = 0;
if (c) {
this.offset = b;
return this;
} else {
return e;
}
};
c.readCString = function (a) {
var b = a === undefined;
if (b) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 1 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+1) <= " + this.buffer.byteLength);
}
}
var c;
var d = a;
var e = -1;
k.decodeUTF8toUTF16(function () {
if (e === 0) {
return null;
}
if (a >= this.limit) {
throw RangeError("Illegal range: Truncated data, " + a + " < " + this.limit);
}
if ((e = this.view[a++]) === 0) {
return null;
} else {
return e;
}
}.bind(this), c = g(), true);
if (b) {
this.offset = a;
return c();
} else {
return {
string: c(),
length: a - d
};
}
};
c.writeIString = function (a, b) {
var c = b === undefined;
if (c) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof a != "string") {
throw TypeError("Illegal str: Not a string");
}
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
var d;
var e = b;
d = k.calculateUTF16asUTF8(f(a), this.noAssert)[1];
b += 4 + d;
var g = this.buffer.byteLength;
if (b > g) {
this.resize((g *= 2) > b ? g : b);
}
b -= 4 + d;
if (this.littleEndian) {
this.view[b + 3] = d >>> 24 & 255;
this.view[b + 2] = d >>> 16 & 255;
this.view[b + 1] = d >>> 8 & 255;
this.view[b] = d & 255;
} else {
this.view[b] = d >>> 24 & 255;
this.view[b + 1] = d >>> 16 & 255;
this.view[b + 2] = d >>> 8 & 255;
this.view[b + 3] = d & 255;
}
b += 4;
k.encodeUTF16toUTF8(f(a), function (a) {
this.view[b++] = a;
}.bind(this));
if (b !== e + 4 + d) {
throw RangeError("Illegal range: Truncated data, " + b + " == " + (b + 4 + d));
}
if (c) {
this.offset = b;
return this;
} else {
return b - e;
}
};
c.readIString = function (a) {
var c = a === undefined;
if (c) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 4 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+4) <= " + this.buffer.byteLength);
}
}
var d = a;
var e = this.readUint32(a);
var f = this.readUTF8String(e, b.METRICS_BYTES, a += 4);
a += f.length;
if (c) {
this.offset = a;
return f.string;
} else {
return {
string: f.string,
length: a - d
};
}
};
b.METRICS_CHARS = "c";
b.METRICS_BYTES = "b";
c.writeUTF8String = function (a, b) {
var c;
var d = b === undefined;
if (d) {
b = this.offset;
}
if (!this.noAssert) {
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: " + b + " (not an integer)");
}
if ((b >>>= 0) < 0 || b + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + b + " (+0) <= " + this.buffer.byteLength);
}
}
var e = b;
c = k.calculateUTF16asUTF8(f(a))[1];
b += c;
var g = this.buffer.byteLength;
if (b > g) {
this.resize((g *= 2) > b ? g : b);
}
b -= c;
k.encodeUTF16toUTF8(f(a), function (a) {
this.view[b++] = a;
}.bind(this));
if (d) {
this.offset = b;
return this;
} else {
return b - e;
}
};
c.writeString = c.writeUTF8String;
b.calculateUTF8Chars = function (a) {
return k.calculateUTF16asUTF8(f(a))[0];
};
b.calculateUTF8Bytes = function (a) {
return k.calculateUTF16asUTF8(f(a))[1];
};
b.calculateString = b.calculateUTF8Bytes;
c.readUTF8String = function (a, c, d) {
if (typeof c == "number") {
d = c;
c = undefined;
}
var e = d === undefined;
if (e) {
d = this.offset;
}
if (c === undefined) {
c = b.METRICS_CHARS;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal length: " + a + " (not an integer)");
}
a |= 0;
if (typeof d != "number" || d % 1 != 0) {
throw TypeError("Illegal offset: " + d + " (not an integer)");
}
if ((d >>>= 0) < 0 || d + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + d + " (+0) <= " + this.buffer.byteLength);
}
}
var f;
var h = 0;
var i = d;
if (c === b.METRICS_CHARS) {
f = g();
k.decodeUTF8(function () {
if (h < a && d < this.limit) {
return this.view[d++];
} else {
return null;
}
}.bind(this), function (a) {
++h;
k.UTF8toUTF16(a, f);
});
if (h !== a) {
throw RangeError("Illegal range: Truncated data, " + h + " == " + a);
}
if (e) {
this.offset = d;
return f();
} else {
return {
string: f(),
length: d - i
};
}
}
if (c === b.METRICS_BYTES) {
if (!this.noAssert) {
if (typeof d != "number" || d % 1 != 0) {
throw TypeError("Illegal offset: " + d + " (not an integer)");
}
if ((d >>>= 0) < 0 || d + a > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + d + " (+" + a + ") <= " + this.buffer.byteLength);
}
}
var j = d + a;
k.decodeUTF8toUTF16(function () {
if (d < j) {
return this.view[d++];
} else {
return null;
}
}.bind(this), f = g(), this.noAssert);
if (d !== j) {
throw RangeError("Illegal range: Truncated data, " + d + " == " + j);
}
if (e) {
this.offset = d;
return f();
} else {
return {
string: f(),
length: d - i
};
}
}
throw TypeError("Unsupported metrics: " + c);
};
c.readString = c.readUTF8String;
c.writeVString = function (a, c) {
var d = c === undefined;
if (d) {
c = this.offset;
}
if (!this.noAssert) {
if (typeof a != "string") {
throw TypeError("Illegal str: Not a string");
}
if (typeof c != "number" || c % 1 != 0) {
throw TypeError("Illegal offset: " + c + " (not an integer)");
}
if ((c >>>= 0) < 0 || c + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + c + " (+0) <= " + this.buffer.byteLength);
}
}
var e;
var g;
var h = c;
e = k.calculateUTF16asUTF8(f(a), this.noAssert)[1];
g = b.calculateVarint32(e);
c += g + e;
var i = this.buffer.byteLength;
if (c > i) {
this.resize((i *= 2) > c ? i : c);
}
c -= g + e;
c += this.writeVarint32(e, c);
k.encodeUTF16toUTF8(f(a), function (a) {
this.view[c++] = a;
}.bind(this));
if (c !== h + e + g) {
throw RangeError("Illegal range: Truncated data, " + c + " == " + (c + e + g));
}
if (d) {
this.offset = c;
return this;
} else {
return c - h;
}
};
c.readVString = function (a) {
var c = a === undefined;
if (c) {
a = this.offset;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 1 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+1) <= " + this.buffer.byteLength);
}
}
var d = a;
var e = this.readVarint32(a);
var f = this.readUTF8String(e.value, b.METRICS_BYTES, a += e.length);
a += f.length;
if (c) {
this.offset = a;
return f.string;
} else {
return {
string: f.string,
length: a - d
};
}
};
c.append = function (a, c, d) {
if (typeof c == "number" || typeof c != "string") {
d = c;
c = undefined;
}
var e = d === undefined;
if (e) {
d = this.offset;
}
if (!this.noAssert) {
if (typeof d != "number" || d % 1 != 0) {
throw TypeError("Illegal offset: " + d + " (not an integer)");
}
if ((d >>>= 0) < 0 || d + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + d + " (+0) <= " + this.buffer.byteLength);
}
}
if (!(a instanceof b)) {
a = b.wrap(a, c);
}
var f = a.limit - a.offset;
if (f <= 0) {
return this;
}
d += f;
var g = this.buffer.byteLength;
if (d > g) {
this.resize((g *= 2) > d ? g : d);
}
d -= f;
this.view.set(a.view.subarray(a.offset, a.limit), d);
a.offset += f;
if (e) {
this.offset += f;
}
return this;
};
c.appendTo = function (a, b) {
a.append(this, b);
return this;
};
c.assert = function (a) {
this.noAssert = !a;
return this;
};
c.capacity = function () {
return this.buffer.byteLength;
};
c.clear = function () {
this.offset = 0;
this.limit = this.buffer.byteLength;
this.markedOffset = -1;
return this;
};
c.clone = function (a) {
var c = new b(0, this.littleEndian, this.noAssert);
if (a) {
c.buffer = new ArrayBuffer(this.buffer.byteLength);
c.view = new Uint8Array(c.buffer);
} else {
c.buffer = this.buffer;
c.view = this.view;
}
c.offset = this.offset;
c.markedOffset = this.markedOffset;
c.limit = this.limit;
return c;
};
c.compact = function (a, b) {
if (a === undefined) {
a = this.offset;
}
if (b === undefined) {
b = this.limit;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal begin: Not an integer");
}
a >>>= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal end: Not an integer");
}
b >>>= 0;
if (a < 0 || a > b || b > this.buffer.byteLength) {
throw RangeError("Illegal range: 0 <= " + a + " <= " + b + " <= " + this.buffer.byteLength);
}
}
if (a === 0 && b === this.buffer.byteLength) {
return this;
}
var c = b - a;
if (c === 0) {
this.buffer = d;
this.view = null;
if (this.markedOffset >= 0) {
this.markedOffset -= a;
}
this.offset = 0;
this.limit = 0;
return this;
}
var e = new ArrayBuffer(c);
var f = new Uint8Array(e);
f.set(this.view.subarray(a, b));
this.buffer = e;
this.view = f;
if (this.markedOffset >= 0) {
this.markedOffset -= a;
}
this.offset = 0;
this.limit = c;
return this;
};
c.copy = function (a, c) {
if (a === undefined) {
a = this.offset;
}
if (c === undefined) {
c = this.limit;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal begin: Not an integer");
}
a >>>= 0;
if (typeof c != "number" || c % 1 != 0) {
throw TypeError("Illegal end: Not an integer");
}
c >>>= 0;
if (a < 0 || a > c || c > this.buffer.byteLength) {
throw RangeError("Illegal range: 0 <= " + a + " <= " + c + " <= " + this.buffer.byteLength);
}
}
if (a === c) {
return new b(0, this.littleEndian, this.noAssert);
}
var d = c - a;
var e = new b(d, this.littleEndian, this.noAssert);
e.offset = 0;
e.limit = d;
if (e.markedOffset >= 0) {
e.markedOffset -= a;
}
this.copyTo(e, 0, a, c);
return e;
};
c.copyTo = function (a, c, d, e) {
var f;
var g;
if (!this.noAssert && !b.isByteBuffer(a)) {
throw TypeError("Illegal target: Not a ByteBuffer");
}
c = (g = c === undefined) ? a.offset : c | 0;
d = (f = d === undefined) ? this.offset : d | 0;
e = e === undefined ? this.limit : e | 0;
if (c < 0 || c > a.buffer.byteLength) {
throw RangeError("Illegal target range: 0 <= " + c + " <= " + a.buffer.byteLength);
}
if (d < 0 || e > this.buffer.byteLength) {
throw RangeError("Illegal source range: 0 <= " + d + " <= " + this.buffer.byteLength);
}
var h = e - d;
if (h === 0) {
return a;
} else {
a.ensureCapacity(c + h);
a.view.set(this.view.subarray(d, e), c);
if (f) {
this.offset += h;
}
if (g) {
a.offset += h;
}
return this;
}
};
c.ensureCapacity = function (a) {
var b = this.buffer.byteLength;
if (b < a) {
return this.resize((b *= 2) > a ? b : a);
} else {
return this;
}
};
c.fill = function (a, b, c) {
var d = b === undefined;
if (d) {
b = this.offset;
}
if (typeof a == "string" && a.length > 0) {
a = a.charCodeAt(0);
}
if (b === undefined) {
b = this.offset;
}
if (c === undefined) {
c = this.limit;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal value: " + a + " (not an integer)");
}
a |= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal begin: Not an integer");
}
b >>>= 0;
if (typeof c != "number" || c % 1 != 0) {
throw TypeError("Illegal end: Not an integer");
}
c >>>= 0;
if (b < 0 || b > c || c > this.buffer.byteLength) {
throw RangeError("Illegal range: 0 <= " + b + " <= " + c + " <= " + this.buffer.byteLength);
}
}
if (b >= c) {
return this;
}
while (b < c) {
this.view[b++] = a;
}
if (d) {
this.offset = b;
}
return this;
};
c.flip = function () {
this.limit = this.offset;
this.offset = 0;
return this;
};
c.mark = function (a) {
a = a === undefined ? this.offset : a;
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal offset: " + a + " (not an integer)");
}
if ((a >>>= 0) < 0 || a + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + a + " (+0) <= " + this.buffer.byteLength);
}
}
this.markedOffset = a;
return this;
};
c.order = function (a) {
if (!this.noAssert && typeof a != "boolean") {
throw TypeError("Illegal littleEndian: Not a boolean");
}
this.littleEndian = !!a;
return this;
};
c.LE = function (a) {
this.littleEndian = a === undefined || !!a;
return this;
};
c.BE = function (a) {
this.littleEndian = a !== undefined && !a;
return this;
};
c.prepend = function (a, c, d) {
if (typeof c == "number" || typeof c != "string") {
d = c;
c = undefined;
}
var e = d === undefined;
if (e) {
d = this.offset;
}
if (!this.noAssert) {
if (typeof d != "number" || d % 1 != 0) {
throw TypeError("Illegal offset: " + d + " (not an integer)");
}
if ((d >>>= 0) < 0 || d + 0 > this.buffer.byteLength) {
throw RangeError("Illegal offset: 0 <= " + d + " (+0) <= " + this.buffer.byteLength);
}
}
if (!(a instanceof b)) {
a = b.wrap(a, c);
}
var f = a.limit - a.offset;
if (f <= 0) {
return this;
}
var g = f - d;
if (g > 0) {
var h = new ArrayBuffer(this.buffer.byteLength + g);
var i = new Uint8Array(h);
i.set(this.view.subarray(d, this.buffer.byteLength), f);
this.buffer = h;
this.view = i;
this.offset += g;
if (this.markedOffset >= 0) {
this.markedOffset += g;
}
this.limit += g;
d += g;
} else {
new Uint8Array(this.buffer);
}
this.view.set(a.view.subarray(a.offset, a.limit), d - f);
a.offset = a.limit;
if (e) {
this.offset -= f;
}
return this;
};
c.prependTo = function (a, b) {
a.prepend(this, b);
return this;
};
c.printDebug = function (a) {
if (typeof a != "function") {
a = console.log.bind(console);
}
a(this.toString() + "\n-------------------------------------------------------------------\n" + this.toDebug(true));
};
c.remaining = function () {
return this.limit - this.offset;
};
c.reset = function () {
if (this.markedOffset >= 0) {
this.offset = this.markedOffset;
this.markedOffset = -1;
} else {
this.offset = 0;
}
return this;
};
c.resize = function (a) {
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal capacity: " + a + " (not an integer)");
}
if ((a |= 0) < 0) {
throw RangeError("Illegal capacity: 0 <= " + a);
}
}
if (this.buffer.byteLength < a) {
var b = new ArrayBuffer(a);
var c = new Uint8Array(b);
c.set(this.view);
this.buffer = b;
this.view = c;
}
return this;
};
c.reverse = function (a, b) {
if (a === undefined) {
a = this.offset;
}
if (b === undefined) {
b = this.limit;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal begin: Not an integer");
}
a >>>= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal end: Not an integer");
}
b >>>= 0;
if (a < 0 || a > b || b > this.buffer.byteLength) {
throw RangeError("Illegal range: 0 <= " + a + " <= " + b + " <= " + this.buffer.byteLength);
}
}
if (a !== b) {
Array.prototype.reverse.call(this.view.subarray(a, b));
}
return this;
};
c.skip = function (a) {
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal length: " + a + " (not an integer)");
}
a |= 0;
}
var b = this.offset + a;
if (!this.noAssert && (b < 0 || b > this.buffer.byteLength)) {
throw RangeError("Illegal length: 0 <= " + this.offset + " + " + a + " <= " + this.buffer.byteLength);
}
this.offset = b;
return this;
};
c.slice = function (a, b) {
if (a === undefined) {
a = this.offset;
}
if (b === undefined) {
b = this.limit;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal begin: Not an integer");
}
a >>>= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal end: Not an integer");
}
b >>>= 0;
if (a < 0 || a > b || b > this.buffer.byteLength) {
throw RangeError("Illegal range: 0 <= " + a + " <= " + b + " <= " + this.buffer.byteLength);
}
}
var c = this.clone();
c.offset = a;
c.limit = b;
return c;
};
c.toBuffer = function (a) {
var b = this.offset;
var c = this.limit;
if (!this.noAssert) {
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal offset: Not an integer");
}
b >>>= 0;
if (typeof c != "number" || c % 1 != 0) {
throw TypeError("Illegal limit: Not an integer");
}
c >>>= 0;
if (b < 0 || b > c || c > this.buffer.byteLength) {
throw RangeError("Illegal range: 0 <= " + b + " <= " + c + " <= " + this.buffer.byteLength);
}
}
if (!a && b === 0 && c === this.buffer.byteLength) {
return this.buffer;
}
if (b === c) {
return d;
}
var e = new ArrayBuffer(c - b);
new Uint8Array(e).set(new Uint8Array(this.buffer).subarray(b, c), 0);
return e;
};
c.toArrayBuffer = c.toBuffer;
c.toString = function (a, b, c) {
if (a === undefined) {
return "ByteBufferAB(offset=" + this.offset + ",markedOffset=" + this.markedOffset + ",limit=" + this.limit + ",capacity=" + this.capacity() + ")";
}
if (typeof a == "number") {
c = b = a = "utf8";
}
switch (a) {
case "utf8":
return this.toUTF8(b, c);
case "base64":
return this.toBase64(b, c);
case "hex":
return this.toHex(b, c);
case "binary":
return this.toBinary(b, c);
case "debug":
return this.toDebug();
case "columns":
return this.toColumns();
default:
throw Error("Unsupported encoding: " + a);
}
};
var j = function () {
for (var a = {}, b = [65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47], c = [], d = 0, e = b.length; d < e; ++d) {
c[b[d]] = d;
}
a.encode = function (a, c) {
for (var d, e;
(d = a()) !== null;) {
c(b[d >> 2 & 63]);
e = (d & 3) << 4;
if ((d = a()) !== null) {
c(b[((e |= d >> 4 & 15) | d >> 4 & 15) & 63]);
e = (d & 15) << 2;
if ((d = a()) !== null) {
c(b[(e | d >> 6 & 3) & 63]);
c(b[d & 63]);
} else {
c(b[e & 63]);
c(61);
}
} else {
c(b[e & 63]);
c(61);
c(61);
}
}
};
a.decode = function (a, b) {
var d;
var e;
var f;
function g(a) {
throw Error("Illegal character code: " + a);
}
while ((d = a()) !== null) {
if ((e = c[d]) === undefined) {
g(d);
}
if ((d = a()) !== null && ((f = c[d]) === undefined && g(d), b(e << 2 >>> 0 | (f & 48) >> 4), (d = a()) !== null)) {
if ((e = c[d]) === undefined) {
if (d === 61) {
break;
}
g(d);
}
b((f & 15) << 4 >>> 0 | (e & 60) >> 2);
if ((d = a()) !== null) {
if ((f = c[d]) === undefined) {
if (d === 61) {
break;
}
g(d);
}
b((e & 3) << 6 >>> 0 | f);
}
}
}
};
a.test = function (a) {
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a);
};
return a;
}();
c.toBase64 = function (a, b) {
if (a === undefined) {
a = this.offset;
}
if (b === undefined) {
b = this.limit;
}
b |= 0;
if ((a |= 0) < 0 || b > this.capacity || a > b) {
throw RangeError("begin, end");
}
var c;
j.encode(function () {
if (a < b) {
return this.view[a++];
} else {
return null;
}
}.bind(this), c = g());
return c();
};
b.fromBase64 = function (a, c) {
if (typeof a != "string") {
throw TypeError("str");
}
var d = new b(a.length / 4 * 3, c);
var e = 0;
j.decode(f(a), function (a) {
d.view[e++] = a;
});
d.limit = e;
return d;
};
b.btoa = function (a) {
return b.fromBinary(a).toBase64();
};
b.atob = function (a) {
return b.fromBase64(a).toBinary();
};
c.toBinary = function (a, b) {
if (a === undefined) {
a = this.offset;
}
if (b === undefined) {
b = this.limit;
}
b |= 0;
if ((a |= 0) < 0 || b > this.capacity() || a > b) {
throw RangeError("begin, end");
}
if (a === b) {
return "";
}
for (var c = [], d = []; a < b;) {
c.push(this.view[a++]);
if (c.length >= 1024) {
d.push(String.fromCharCode.apply(String, c));
c = [];
}
}
return d.join("") + String.fromCharCode.apply(String, c);
};
b.fromBinary = function (a, c) {
if (typeof a != "string") {
throw TypeError("str");
}
for (var d, e = 0, f = a.length, g = new b(f, c); e < f;) {
if ((d = a.charCodeAt(e)) > 255) {
throw RangeError("illegal char code: " + d);
}
g.view[e++] = d;
}
g.limit = f;
return g;
};
c.toDebug = function (a) {
for (var b, c = -1, d = this.buffer.byteLength, e = "", f = "", g = ""; c < d;) {
if (c !== -1) {
e += (b = this.view[c]) < 16 ? "0" + b.toString(16).toUpperCase() : b.toString(16).toUpperCase();
if (a) {
f += b > 32 && b < 127 ? String.fromCharCode(b) : ".";
}
}
++c;
if (a && c > 0 && c % 16 == 0 && c !== d) {
while (e.length < 51) {
e += " ";
}
g += e + f + "\n";
e = f = "";
}
if (c === this.offset && c === this.limit) {
e += c === this.markedOffset ? "!" : "|";
} else if (c === this.offset) {
e += c === this.markedOffset ? "[" : "<";
} else if (c === this.limit) {
e += c === this.markedOffset ? "]" : ">";
} else {
e += c === this.markedOffset ? "'" : a || c !== 0 && c !== d ? " " : "";
}
}
if (a && e !== " ") {
while (e.length < 51) {
e += " ";
}
g += e + f + "\n";
}
if (a) {
return g;
} else {
return e;
}
};
b.fromDebug = function (a, c, d) {
for (var e, f, g = a.length, h = new b((g + 1) / 3 | 0, c, d), i = 0, j = 0, k = false, l = false, m = false, n = false, o = false; i < g;) {
switch (e = a.charAt(i++)) {
case "!":
if (!d) {
if (l || m || n) {
o = true;
break;
}
l = m = n = true;
}
h.offset = h.markedOffset = h.limit = j;
k = false;
break;
case "|":
if (!d) {
if (l || n) {
o = true;
break;
}
l = n = true;
}
h.offset = h.limit = j;
k = false;
break;
case "[":
if (!d) {
if (l || m) {
o = true;
break;
}
l = m = true;
}
h.offset = h.markedOffset = j;
k = false;
break;
case "<":
if (!d) {
if (l) {
o = true;
break;
}
l = true;
}
h.offset = j;
k = false;
break;
case "]":
if (!d) {
if (n || m) {
o = true;
break;
}
n = m = true;
}
h.limit = h.markedOffset = j;
k = false;
break;
case ">":
if (!d) {
if (n) {
o = true;
break;
}
n = true;
}
h.limit = j;
k = false;
break;
case "'":
if (!d) {
if (m) {
o = true;
break;
}
m = true;
}
h.markedOffset = j;
k = false;
break;
case " ":
k = false;
break;
default:
if (!d && k) {
o = true;
break;
}
f = parseInt(e + a.charAt(i++), 16);
if (!d && (isNaN(f) || f < 0 || f > 255)) {
throw TypeError("Illegal str: Not a debug encoded string");
}
h.view[j++] = f;
k = true;
}
if (o) {
throw TypeError("Illegal str: Invalid symbol at " + i);
}
}
if (!d) {
if (!l || !n) {
throw TypeError("Illegal str: Missing offset or limit");
}
if (j < h.buffer.byteLength) {
throw TypeError("Illegal str: Not a debug encoded string (is it hex?) " + j + " < " + g);
}
}
return h;
};
c.toHex = function (a, b) {
a = a === undefined ? this.offset : a;
b = b === undefined ? this.limit : b;
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal begin: Not an integer");
}
a >>>= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal end: Not an integer");
}
b >>>= 0;
if (a < 0 || a > b || b > this.buffer.byteLength) {
throw RangeError("Illegal range: 0 <= " + a + " <= " + b + " <= " + this.buffer.byteLength);
}
}
for (var c, d = new Array(b - a); a < b;) {
if ((c = this.view[a++]) < 16) {
d.push("0", c.toString(16));
} else {
d.push(c.toString(16));
}
}
return d.join("");
};
b.fromHex = function (a, c, d) {
if (!d) {
if (typeof a != "string") {
throw TypeError("Illegal str: Not a string");
}
if (a.length % 2 != 0) {
throw TypeError("Illegal str: Length not a multiple of 2");
}
}
for (var e, f = a.length, g = new b(f / 2 | 0, c), h = 0, i = 0; h < f; h += 2) {
e = parseInt(a.substring(h, h + 2), 16);
if (!d && (!isFinite(e) || e < 0 || e > 255)) {
throw TypeError("Illegal str: Contains non-hex characters");
}
g.view[i++] = e;
}
g.limit = i;
return g;
};
var k = function () {
var a = {
MAX_CODEPOINT: 1114111,
encodeUTF8: function (a, b) {
var c = null;
for (typeof a == "number" && (c = a, a = function () {
return null;
}); c !== null || (c = a()) !== null;) {
if (c < 128) {
b(c & 127);
} else if (c < 2048) {
b(c >> 6 & 31 | 192);
b(c & 63 | 128);
} else if (c < 65536) {
b(c >> 12 & 15 | 224);
b(c >> 6 & 63 | 128);
b(c & 63 | 128);
} else {
b(c >> 18 & 7 | 240);
b(c >> 12 & 63 | 128);
b(c >> 6 & 63 | 128);
b(c & 63 | 128);
}
c = null;
}
},
decodeUTF8: function (a, b) {
for (var c, d, e, f, g = function (a) {
a = a.slice(0, a.indexOf(null));
var b = Error(a.toString());
b.name = "TruncatedError";
b.bytes = a;
throw b;
};
(c = a()) !== null;) {
if ((c & 128) == 0) {
b(c);
} else if ((c & 224) == 192) {
if ((d = a()) === null) {
g([c, d]);
}
b((c & 31) << 6 | d & 63);
} else if ((c & 240) == 224) {
if ((d = a()) === null || (e = a()) === null) {
g([c, d, e]);
}
b((c & 15) << 12 | (d & 63) << 6 | e & 63);
} else {
if ((c & 248) != 240) {
throw RangeError("Illegal starting byte: " + c);
}
if ((d = a()) === null || (e = a()) === null || (f = a()) === null) {
g([c, d, e, f]);
}
b((c & 7) << 18 | (d & 63) << 12 | (e & 63) << 6 | f & 63);
}
}
},
UTF16toUTF8: function (a, b) {
for (var c, d = null;
(c = d !== null ? d : a()) !== null;) {
if (c >= 55296 && c <= 57343 && (d = a()) !== null && d >= 56320 && d <= 57343) {
b((c - 55296) * 1024 + d - 56320 + 65536);
d = null;
} else {
b(c);
}
}
if (d !== null) {
b(d);
}
},
UTF8toUTF16: function (a, b) {
var c = null;
for (typeof a == "number" && (c = a, a = function () {
return null;
}); c !== null || (c = a()) !== null;) {
if (c <= 65535) {
b(c);
} else {
b(55296 + ((c -= 65536) >> 10));
b(c % 1024 + 56320);
}
c = null;
}
},
encodeUTF16toUTF8: function (b, c) {
a.UTF16toUTF8(b, function (b) {
a.encodeUTF8(b, c);
});
},
decodeUTF8toUTF16: function (b, c) {
a.decodeUTF8(b, function (b) {
a.UTF8toUTF16(b, c);
});
},
calculateCodePoint: function (a) {
if (a < 128) {
return 1;
} else if (a < 2048) {
return 2;
} else if (a < 65536) {
return 3;
} else {
return 4;
}
},
calculateUTF8: function (a) {
for (var b, c = 0;
(b = a()) !== null;) {
c += b < 128 ? 1 : b < 2048 ? 2 : b < 65536 ? 3 : 4;
}
return c;
},
calculateUTF16asUTF8: function (b) {
var c = 0;
var d = 0;
a.UTF16toUTF8(b, function (a) {
++c;
d += a < 128 ? 1 : a < 2048 ? 2 : a < 65536 ? 3 : 4;
});
return [c, d];
}
};
return a;
}();
c.toUTF8 = function (a, b) {
if (a === undefined) {
a = this.offset;
}
if (b === undefined) {
b = this.limit;
}
if (!this.noAssert) {
if (typeof a != "number" || a % 1 != 0) {
throw TypeError("Illegal begin: Not an integer");
}
a >>>= 0;
if (typeof b != "number" || b % 1 != 0) {
throw TypeError("Illegal end: Not an integer");
}
b >>>= 0;
if (a < 0 || a > b || b > this.buffer.byteLength) {
throw RangeError("Illegal range: 0 <= " + a + " <= " + b + " <= " + this.buffer.byteLength);
}
}
var c;
try {
k.decodeUTF8toUTF16(function () {
if (a < b) {
return this.view[a++];
} else {
return null;
}
}.bind(this), c = g());
} catch (c) {
if (a !== b) {
throw RangeError("Illegal range: Truncated data, " + a + " != " + b);
}
}
return c();
};
b.fromUTF8 = function (a, c, d) {
if (!d && typeof a != "string") {
throw TypeError("Illegal str: Not a string");
}
var e = new b(k.calculateUTF16asUTF8(f(a), true)[1], c, d);
var g = 0;
k.encodeUTF16toUTF8(f(a), function (a) {
e.view[g++] = a;
});
e.limit = g;
return e;
};
return b;
};
if ((f = d.apply(b, e)) !== undefined) {
a.exports = f;
}
},
924: (a, b, c) => {
'use strict';
var d = c(210);
var e = c(559);
var f = e(d("String.prototype.indexOf"));
a.exports = function (a, b) {
var c = d(a, !!b);
if (typeof c == "function" && f(a, ".prototype.") > -1) {
return e(c);
} else {
return c;
}
};
},
559: (a, b, c) => {
'use strict';
var d = c(612);
var e = c(210);
var f = e("%Function.prototype.apply%");
var g = e("%Function.prototype.call%");
var h = e("%Reflect.apply%", true) || d.call(g, f);
var i = e("%Object.getOwnPropertyDescriptor%", true);
var j = e("%Object.defineProperty%", true);
var k = e("%Math.max%");
if (j) {
try {
j({}, "a", {
value: 1
});
} catch (a) {
j = null;
}
}
a.exports = function (a) {
var b = h(d, g, arguments);
if (i && j && i(b, "length").configurable) {
j(b, "length", {
value: 1 + k(0, a.length - (arguments.length - 1))
});
}
return b;
};
function l() {
return h(d, f, arguments);
}
if (j) {
j(a.exports, "apply", {
value: l
});
} else {
a.exports.apply = l;
}
},
187: a => {
'use strict';
function b(a, b, d) {
d = d || 2;
var f;
var g;
var h;
var i;
var l;
var m;
var o;
var p = b && b.length;
var q = p ? b[0] * d : a.length;
var r = c(a, 0, q, d, true);
var s = [];
if (!r || r.next === r.prev) {
return s;
}
if (p) {
r = function (a, b, d, e) {
var f;
var g;
var h;
var i = [];
f = 0;
g = b.length;
for (; f < g; f++) {
if ((h = c(a, b[f] * e, f < g - 1 ? b[f + 1] * e : a.length, e, false)) === h.next) {
h.steiner = true;
}
i.push(n(h));
}
i.sort(j);
f = 0;
for (; f < i.length; f++) {
d = k(i[f], d);
}
return d;
}(a, b, r, d);
}
if (a.length > d * 80) {
f = h = a[0];
g = i = a[1];
for (var t = d; t < q; t += d) {
if ((l = a[t]) < f) {
f = l;
}
if ((m = a[t + 1]) < g) {
g = m;
}
if (l > h) {
h = l;
}
if (m > i) {
i = m;
}
}
o = (o = Math.max(h - f, i - g)) !== 0 ? 32767 / o : 0;
}
e(r, s, d, f, g, o, 0);
return s;
}
function c(a, b, c, d, e) {
var f;
var g;
if (e === A(a, b, c, d) > 0) {
for (f = b; f < c; f += d) {
g = x(f, a[f], a[f + 1], g);
}
} else {
for (f = c - d; f >= b; f -= d) {
g = x(f, a[f], a[f + 1], g);
}
}
if (g && r(g, g.next)) {
y(g);
g = g.next;
}
return g;
}
function d(a, b) {
if (!a) {
return a;
}
b ||= a;
var c;
var d = a;
do {
c = false;
if (d.steiner || !r(d, d.next) && q(d.prev, d, d.next) !== 0) {
d = d.next;
} else {
y(d);
if ((d = b = d.prev) === d.next) {
break;
}
c = true;
}
} while (c || d !== b);
return b;
}
function e(a, b, c, j, k, l, n) {
if (a) {
if (!n && l) {
(function (a, b, c, d) {
var e = a;
do {
if (e.z === 0) {
e.z = m(e.x, e.y, b, c, d);
}
e.prevZ = e.prev;
e.nextZ = e.next;
e = e.next;
} while (e !== a);
e.prevZ.nextZ = null;
e.prevZ = null;
(function (a) {
var b;
var c;
var d;
var e;
var f;
var g;
var h;
var i;
var j = 1;
do {
c = a;
a = null;
f = null;
g = 0;
while (c) {
g++;
d = c;
h = 0;
b = 0;
for (; b < j && (h++, d = d.nextZ); b++);
for (i = j; h > 0 || i > 0 && d;) {
if (h !== 0 && (i === 0 || !d || c.z <= d.z)) {
e = c;
c = c.nextZ;
h--;
} else {
e = d;
d = d.nextZ;
i--;
}
if (f) {
f.nextZ = e;
} else {
a = e;
}
e.prevZ = f;
f = e;
}
c = d;
}
f.nextZ = null;
j *= 2;
} while (g > 1);
})(e);
})(a, j, k, l);
}
for (var o, p, q = a; a.prev !== a.next;) {
o = a.prev;
p = a.next;
if (l ? g(a, j, k, l) : f(a)) {
b.push(o.i / c | 0);
b.push(a.i / c | 0);
b.push(p.i / c | 0);
y(a);
a = p.next;
q = p.next;
} else if ((a = p) === q) {
if (n) {
if (n === 1) {
e(a = h(d(a), b, c), b, c, j, k, l, 2);
} else if (n === 2) {
i(a, b, c, j, k, l);
}
} else {
e(d(a), b, c, j, k, l, 1);
}
break;
}
}
}
}
function f(a) {
var b = a.prev;
var c = a;
var d = a.next;
if (q(b, c, d) >= 0) {
return false;
}
for (var e = b.x, f = c.x, g = d.x, h = b.y, i = c.y, j = d.y, k = e < f ? e < g ? e : g : f < g ? f : g, l = h < i ? h < j ? h : j : i < j ? i : j, m = e > f ? e > g ? e : g : f > g ? f : g, n = h > i ? h > j ? h : j : i > j ? i : j, p = d.next; p !== b;) {
if (p.x >= k && p.x <= m && p.y >= l && p.y <= n && o(e, h, f, i, g, j, p.x, p.y) && q(p.prev, p, p.next) >= 0) {
return false;
}
p = p.next;
}
return true;
}
function g(a, b, c, d) {
var e = a.prev;
var f = a;
var g = a.next;
if (q(e, f, g) >= 0) {
return false;
}
for (var h = e.x, i = f.x, j = g.x, k = e.y, l = f.y, n = g.y, p = h < i ? h < j ? h : j : i < j ? i : j, r = k < l ? k < n ? k : n : l < n ? l : n, s = h > i ? h > j ? h : j : i > j ? i : j, t = k > l ? k > n ? k : n : l > n ? l : n, u = m(p, r, b, c, d), v = m(s, t, b, c, d), w = a.prevZ, x = a.nextZ; w && w.z >= u && x && x.z <= v;) {
if (w.x >= p && w.x <= s && w.y >= r && w.y <= t && w !== e && w !== g && o(h, k, i, l, j, n, w.x, w.y) && q(w.prev, w, w.next) >= 0) {
return false;
}
w = w.prevZ;
if (x.x >= p && x.x <= s && x.y >= r && x.y <= t && x !== e && x !== g && o(h, k, i, l, j, n, x.x, x.y) && q(x.prev, x, x.next) >= 0) {
return false;
}
x = x.nextZ;
}
while (w && w.z >= u) {
if (w.x >= p && w.x <= s && w.y >= r && w.y <= t && w !== e && w !== g && o(h, k, i, l, j, n, w.x, w.y) && q(w.prev, w, w.next) >= 0) {
return false;
}
w = w.prevZ;
}
while (x && x.z <= v) {
if (x.x >= p && x.x <= s && x.y >= r && x.y <= t && x !== e && x !== g && o(h, k, i, l, j, n, x.x, x.y) && q(x.prev, x, x.next) >= 0) {
return false;
}
x = x.nextZ;
}
return true;
}
function h(a, b, c) {
var e = a;
do {
var f = e.prev;
var g = e.next.next;
if (!r(f, g) && s(f, e, e.next, g) && v(f, g) && v(g, f)) {
b.push(f.i / c | 0);
b.push(e.i / c | 0);
b.push(g.i / c | 0);
y(e);
y(e.next);
e = a = g;
}
e = e.next;
} while (e !== a);
return d(e);
}
function i(a, b, c, f, g, h) {
var i = a;
do {
for (var j = i.next.next; j !== i.prev;) {
if (i.i !== j.i && p(i, j)) {
var k = w(i, j);
i = d(i, i.next);
k = d(k, k.next);
e(i, b, c, f, g, h, 0);
e(k, b, c, f, g, h, 0);
return;
}
j = j.next;
}
i = i.next;
} while (i !== a);
}
function j(a, b) {
return a.x - b.x;
}
function k(a, b) {
var c = function (a, b) {
var c;
var d = b;
var e = a.x;
var f = a.y;
var g = -Infinity;
do {
if (f <= d.y && f >= d.next.y && d.next.y !== d.y) {
var h = d.x + (f - d.y) * (d.next.x - d.x) / (d.next.y - d.y);
if (h <= e && h > g && (g = h, c = d.x < d.next.x ? d : d.next, h === e)) {
return c;
}
}
d = d.next;
} while (d !== b);
if (!c) {
return null;
}
var i;
var j = c;
var k = c.x;
var m = c.y;
var n = Infinity;
d = c;
do {
if (e >= d.x && d.x >= k && e !== d.x && o(f < m ? e : g, f, k, m, f < m ? g : e, f, d.x, d.y)) {
i = Math.abs(f - d.y) / (e - d.x);
if (v(d, a) && (i < n || i === n && (d.x > c.x || d.x === c.x && l(c, d)))) {
c = d;
n = i;
}
}
d = d.next;
} while (d !== j);
return c;
}(a, b);
if (!c) {
return b;
}
var e = w(c, a);
d(e, e.next);
return d(c, c.next);
}
function l(a, b) {
return q(a.prev, a, b.prev) < 0 && q(b.next, a, a.next) < 0;
}
function m(a, b, c, d, e) {
return (a = ((a = ((a = ((a = ((a = (a - c) * e | 0) | a << 8) & 16711935) | a << 4) & 252645135) | a << 2) & 858993459) | a << 1) & 1431655765) | (b = ((b = ((b = ((b = ((b = (b - d) * e | 0) | b << 8) & 16711935) | b << 4) & 252645135) | b << 2) & 858993459) | b << 1) & 1431655765) << 1;
}
function n(a) {
var b = a;
var c = a;
do {
if (b.x < c.x || b.x === c.x && b.y < c.y) {
c = b;
}
b = b.next;
} while (b !== a);
return c;
}
function o(a, b, c, d, e, f, g, h) {
return (e - g) * (b - h) >= (a - g) * (f - h) && (a - g) * (d - h) >= (c - g) * (b - h) && (c - g) * (f - h) >= (e - g) * (d - h);
}
function p(a, b) {
return a.next.i !== b.i && a.prev.i !== b.i && ! function (a, b) {
var c = a;
do {
if (c.i !== a.i && c.next.i !== a.i && c.i !== b.i && c.next.i !== b.i && s(c, c.next, a, b)) {
return true;
}
c = c.next;
} while (c !== a);
return false;
}(a, b) && (v(a, b) && v(b, a) && function (a, b) {
var c = a;
var d = false;
var e = (a.x + b.x) / 2;
var f = (a.y + b.y) / 2;
do {
if (c.y > f != c.next.y > f && c.next.y !== c.y && e < (c.next.x - c.x) * (f - c.y) / (c.next.y - c.y) + c.x) {
d = !d;
}
c = c.next;
} while (c !== a);
return d;
}(a, b) && (q(a.prev, a, b.prev) || q(a, b.prev, b)) || r(a, b) && q(a.prev, a, a.next) > 0 && q(b.prev, b, b.next) > 0);
}
function q(a, b, c) {
return (b.y - a.y) * (c.x - b.x) - (b.x - a.x) * (c.y - b.y);
}
function r(a, b) {
return a.x === b.x && a.y === b.y;
}
function s(a, b, c, d) {
var e = u(q(a, b, c));
var f = u(q(a, b, d));
var g = u(q(c, d, a));
var h = u(q(c, d, b));
return e !== f && g !== h || e === 0 && !!t(a, c, b) || f === 0 && !!t(a, d, b) || g === 0 && !!t(c, a, d) || h === 0 && !!t(c, b, d);
}
function t(a, b, c) {
return b.x <= Math.max(a.x, c.x) && b.x >= Math.min(a.x, c.x) && b.y <= Math.max(a.y, c.y) && b.y >= Math.min(a.y, c.y);
}
function u(a) {
if (a > 0) {
return 1;
} else if (a < 0) {
return -1;
} else {
return 0;
}
}
function v(a, b) {
if (q(a.prev, a, a.next) < 0) {
return q(a, b, a.next) >= 0 && q(a, a.prev, b) >= 0;
} else {
return q(a, b, a.prev) < 0 || q(a, a.next, b) < 0;
}
}
function w(a, b) {
var c = new z(a.i, a.x, a.y);
var d = new z(b.i, b.x, b.y);
var e = a.next;
var f = b.prev;
a.next = b;
b.prev = a;
c.next = e;
e.prev = c;
d.next = c;
c.prev = d;
f.next = d;
d.prev = f;
return d;
}
function x(a, b, c, d) {
var e = new z(a, b, c);
if (d) {
e.next = d.next;
e.prev = d;
d.next.prev = e;
d.next = e;
} else {
e.prev = e;
e.next = e;
}
return e;
}
function y(a) {
a.next.prev = a.prev;
a.prev.next = a.next;
if (a.prevZ) {
a.prevZ.nextZ = a.nextZ;
}
if (a.nextZ) {
a.nextZ.prevZ = a.prevZ;
}
}
function z(a, b, c) {
this.i = a;
this.x = b;
this.y = c;
this.prev = null;
this.next = null;
this.z = 0;
this.prevZ = null;
this.nextZ = null;
this.steiner = false;
}
function A(a, b, c, d) {
for (var e = 0, f = b, g = c - d; f < c; f += d) {
e += (a[g] - a[f]) * (a[f + 1] + a[g + 1]);
g = f;
}
return e;
}
a.exports = b;
a.exports.default = b;
b.deviation = function (a, b, c, d) {
var e = b && b.length;
var f = e ? b[0] * c : a.length;
var g = Math.abs(A(a, 0, f, c));
if (e) {
for (var h = 0, i = b.length; h < i; h++) {
var j = b[h] * c;
var k = h < i - 1 ? b[h + 1] * c : a.length;
g -= Math.abs(A(a, j, k, c));
}
}
var l = 0;
for (h = 0; h < d.length; h += 3) {
var m = d[h] * c;
var n = d[h + 1] * c;
var o = d[h + 2] * c;
l += Math.abs((a[m] - a[o]) * (a[n + 1] - a[m + 1]) - (a[m] - a[n]) * (a[o + 1] - a[m + 1]));
}
if (g === 0 && l === 0) {
return 0;
} else {
return Math.abs((l - g) / g);
}
};
b.flatten = function (a) {
for (var b = a[0][0].length, c = {
vertices: [],
holes: [],
dimensions: b
}, d = 0, e = 0; e < a.length; e++) {
for (var f = 0; f < a[e].length; f++) {
for (var g = 0; g < b; g++) {
c.vertices.push(a[e][f][g]);
}
}
if (e > 0) {
d += a[e - 1].length;
c.holes.push(d);
}
}
return c;
};
},
729: a => {
'use strict';
var b = Object.prototype.hasOwnProperty;
var c = "~";
function d() {}
function e(a, b, c) {
this.fn = a;
this.context = b;
this.once = c || false;
}
function f(a, b, d, f, g) {
if (typeof d != "function") {
throw new TypeError("The listener must be a function");
}
var h = new e(d, f || a, g);
var i = c ? c + b : b;
if (a._events[i]) {
if (a._events[i].fn) {
a._events[i] = [a._events[i], h];
} else {
a._events[i].push(h);
}
} else {
a._events[i] = h;
a._eventsCount++;
}
return a;
}
function g(a, b) {
if (--a._eventsCount == 0) {
a._events = new d();
} else {
delete a._events[b];
}
}
function h() {
this._events = new d();
this._eventsCount = 0;
}
if (Object.create) {
d.prototype = Object.create(null);
if (!new d().__proto__) {
c = false;
}
}
h.prototype.eventNames = function () {
var a;
var d;
var e = [];
if (this._eventsCount === 0) {
return e;
}
for (d in a = this._events) {
if (b.call(a, d)) {
e.push(c ? d.slice(1) : d);
}
}
if (Object.getOwnPropertySymbols) {
return e.concat(Object.getOwnPropertySymbols(a));
} else {
return e;
}
};
h.prototype.listeners = function (a) {
var b = c ? c + a : a;
var d = this._events[b];
if (!d) {
return [];
}
if (d.fn) {
return [d.fn];
}
for (var e = 0, f = d.length, g = new Array(f); e < f; e++) {
g[e] = d[e].fn;
}
return g;
};
h.prototype.listenerCount = function (a) {
var b = c ? c + a : a;
var d = this._events[b];
if (d) {
if (d.fn) {
return 1;
} else {
return d.length;
}
} else {
return 0;
}
};
h.prototype.emit = function (a, b, d, e, f, g) {
var h = c ? c + a : a;
if (!this._events[h]) {
return false;
}
var i;
var j;
var k = this._events[h];
var l = arguments.length;
if (k.fn) {
if (k.once) {
this.removeListener(a, k.fn, undefined, true);
}
switch (l) {
case 1:
k.fn.call(k.context);
return true;
case 2:
k.fn.call(k.context, b);
return true;
case 3:
k.fn.call(k.context, b, d);
return true;
case 4:
k.fn.call(k.context, b, d, e);
return true;
case 5:
k.fn.call(k.context, b, d, e, f);
return true;
case 6:
k.fn.call(k.context, b, d, e, f, g);
return true;
}
j = 1;
i = new Array(l - 1);
for (; j < l; j++) {
i[j - 1] = arguments[j];
}
k.fn.apply(k.context, i);
} else {
var m;
var n = k.length;
for (j = 0; j < n; j++) {
if (k[j].once) {
this.removeListener(a, k[j].fn, undefined, true);
}
switch (l) {
case 1:
k[j].fn.call(k[j].context);
break;
case 2:
k[j].fn.call(k[j].context, b);
break;
case 3:
k[j].fn.call(k[j].context, b, d);
break;
case 4:
k[j].fn.call(k[j].context, b, d, e);
break;
default:
if (!i) {
m = 1;
i = new Array(l - 1);
for (; m < l; m++) {
i[m - 1] = arguments[m];
}
}
k[j].fn.apply(k[j].context, i);
}
}
}
return true;
};
h.prototype.on = function (a, b, c) {
return f(this, a, b, c, false);
};
h.prototype.once = function (a, b, c) {
return f(this, a, b, c, true);
};
h.prototype.removeListener = function (a, b, d, e) {
var f = c ? c + a : a;
if (!this._events[f]) {
return this;
}
if (!b) {
g(this, f);
return this;
}
var h = this._events[f];
if (h.fn) {
if (h.fn === b && (!e || !!h.once) && (!d || h.context === d)) {
g(this, f);
}
} else {
for (var i = 0, j = [], k = h.length; i < k; i++) {
if (h[i].fn !== b || e && !h[i].once || d && h[i].context !== d) {
j.push(h[i]);
}
}
if (j.length) {
this._events[f] = j.length === 1 ? j[0] : j;
} else {
g(this, f);
}
}
return this;
};
h.prototype.removeAllListeners = function (a) {
var b;
if (a) {
b = c ? c + a : a;
if (this._events[b]) {
g(this, b);
}
} else {
this._events = new d();
this._eventsCount = 0;
}
return this;
};
h.prototype.off = h.prototype.removeListener;
h.prototype.addListener = h.prototype.on;
h.prefixed = c;
h.EventEmitter = h;
a.exports = h;
},
370: a => {
'use strict';
var b;
var c = typeof Reflect == "object" ? Reflect : null;
var d = c && typeof c.apply == "function" ? c.apply : function (a, b, c) {
return Function.prototype.apply.call(a, b, c);
};
b = c && typeof c.ownKeys == "function" ? c.ownKeys : Object.getOwnPropertySymbols ? function (a) {
return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a));
} : function (a) {
return Object.getOwnPropertyNames(a);
};
var e = Number.isNaN || function (a) {
return a != a;
};
function f() {
f.init.call(this);
}
a.exports = f;
a.exports.once = function (a, b) {
return new Promise(function (c, d) {
function e(c) {
a.removeListener(b, f);
d(c);
}
function f() {
if (typeof a.removeListener == "function") {
a.removeListener("error", e);
}
c([].slice.call(arguments));
}
p(a, b, f, {
once: true
});
if (b !== "error") {
(function (a, b, c) {
if (typeof a.on == "function") {
p(a, "error", b, {
once: true
});
}
})(a, e);
}
});
};
f.EventEmitter = f;
f.prototype._events = undefined;
f.prototype._eventsCount = 0;
f.prototype._maxListeners = undefined;
var g = 10;
function h(a) {
if (typeof a != "function") {
throw new TypeError("The \"listener\" argument must be of type Function. Received type " + typeof a);
}
}
function i(a) {
if (a._maxListeners === undefined) {
return f.defaultMaxListeners;
} else {
return a._maxListeners;
}
}
function j(a, b, c, d) {
var e;
var f;
var g;
var j;
h(c);
if ((f = a._events) === undefined) {
f = a._events = Object.create(null);
a._eventsCount = 0;
} else {
if (f.newListener !== undefined) {
a.emit("newListener", b, c.listener ? c.listener : c);
f = a._events;
}
g = f[b];
}
if (g === undefined) {
g = f[b] = c;
++a._eventsCount;
} else {
if (typeof g == "function") {
g = f[b] = d ? [c, g] : [g, c];
} else if (d) {
g.unshift(c);
} else {
g.push(c);
}
if ((e = i(a)) > 0 && g.length > e && !g.warned) {
g.warned = true;
var k = new Error("Possible EventEmitter memory leak detected. " + g.length + " " + String(b) + " listeners added. Use emitter.setMaxListeners() to increase limit");
k.name = "MaxListenersExceededWarning";
k.emitter = a;
k.type = b;
k.count = g.length;
j = k;
if (console && console.warn) {
console.warn(j);
}
}
}
return a;
}
function k() {
if (!this.fired) {
this.target.removeListener(this.type, this.wrapFn);
this.fired = true;
if (arguments.length === 0) {
return this.listener.call(this.target);
} else {
return this.listener.apply(this.target, arguments);
}
}
}
function l(a, b, c) {
var d = {
fired: false,
wrapFn: undefined,
target: a,
type: b,
listener: c
};
var e = k.bind(d);
e.listener = c;
d.wrapFn = e;
return e;
}
function m(a, b, c) {
var d = a._events;
if (d === undefined) {
return [];
}
var e = d[b];
if (e === undefined) {
return [];
} else if (typeof e == "function") {
if (c) {
return [e.listener || e];
} else {
return [e];
}
} else if (c) {
return function (a) {
for (var b = new Array(a.length), c = 0; c < b.length; ++c) {
b[c] = a[c].listener || a[c];
}
return b;
}(e);
} else {
return o(e, e.length);
}
}
function n(a) {
var b = this._events;
if (b !== undefined) {
var c = b[a];
if (typeof c == "function") {
return 1;
}
if (c !== undefined) {
return c.length;
}
}
return 0;
}
function o(a, b) {
for (var c = new Array(b), d = 0; d < b; ++d) {
c[d] = a[d];
}
return c;
}
function p(a, b, c, d) {
if (typeof a.on == "function") {
if (d.once) {
a.once(b, c);
} else {
a.on(b, c);
}
} else {
if (typeof a.addEventListener != "function") {
throw new TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof a);
}
a.addEventListener(b, function f(e) {
if (d.once) {
a.removeEventListener(b, f);
}
c(e);
});
}
}
Object.defineProperty(f, "defaultMaxListeners", {
enumerable: true,
get: function () {
return g;
},
set: function (a) {
if (typeof a != "number" || a < 0 || e(a)) {
throw new RangeError("The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received " + a + ".");
}
g = a;
}
});
f.init = function () {
if (this._events === undefined || this._events === Object.getPrototypeOf(this)._events) {
this._events = Object.create(null);
this._eventsCount = 0;
}
this._maxListeners = this._maxListeners || undefined;
};
f.prototype.setMaxListeners = function (a) {
if (typeof a != "number" || a < 0 || e(a)) {
throw new RangeError("The value of \"n\" is out of range. It must be a non-negative number. Received " + a + ".");
}
this._maxListeners = a;
return this;
};
f.prototype.getMaxListeners = function () {
return i(this);
};
f.prototype.emit = function (a) {
for (var b = [], c = 1; c < arguments.length; c++) {
b.push(arguments[c]);
}
var e = a === "error";
var f = this._events;
if (f !== undefined) {
e = e && f.error === undefined;
} else if (!e) {
return false;
}
if (e) {
var g;
if (b.length > 0) {
g = b[0];
}
if (g instanceof Error) {
throw g;
}
var h = new Error("Unhandled error." + (g ? " (" + g.message + ")" : ""));
h.context = g;
throw h;
}
var i = f[a];
if (i === undefined) {
return false;
}
if (typeof i == "function") {
d(i, this, b);
} else {
var j = i.length;
var k = o(i, j);
for (c = 0; c < j; ++c) {
d(k[c], this, b);
}
}
return true;
};
f.prototype.addListener = function (a, b) {
return j(this, a, b, false);
};
f.prototype.on = f.prototype.addListener;
f.prototype.prependListener = function (a, b) {
return j(this, a, b, true);
};
f.prototype.once = function (a, b) {
h(b);
this.on(a, l(this, a, b));
return this;
};
f.prototype.prependOnceListener = function (a, b) {
h(b);
this.prependListener(a, l(this, a, b));
return this;
};
f.prototype.removeListener = function (a, b) {
var c;
var d;
var e;
var f;
var g;
h(b);
if ((d = this._events) === undefined) {
return this;
}
if ((c = d[a]) === undefined) {
return this;
}
if (c === b || c.listener === b) {
if (--this._eventsCount == 0) {
this._events = Object.create(null);
} else {
delete d[a];
if (d.removeListener) {
this.emit("removeListener", a, c.listener || b);
}
}
} else if (typeof c != "function") {
e = -1;
f = c.length - 1;
for (; f >= 0; f--) {
if (c[f] === b || c[f].listener === b) {
g = c[f].listener;
e = f;
break;
}
}
if (e < 0) {
return this;
}
if (e === 0) {
c.shift();
} else {
(function (a, b) {
for (; b + 1 < a.length; b++) {
a[b] = a[b + 1];
}
a.pop();
})(c, e);
}
if (c.length === 1) {
d[a] = c[0];
}
if (d.removeListener !== undefined) {
this.emit("removeListener", a, g || b);
}
}
return this;
};
f.prototype.off = f.prototype.removeListener;
f.prototype.removeAllListeners = function (a) {
var b;
var c;
var d;
if ((c = this._events) === undefined) {
return this;
}
if (c.removeListener === undefined) {
if (arguments.length === 0) {
this._events = Object.create(null);
this._eventsCount = 0;
} else if (c[a] !== undefined) {
if (--this._eventsCount == 0) {
this._events = Object.create(null);
} else {
delete c[a];
}
}
return this;
}
if (arguments.length === 0) {
var e;
var f = Object.keys(c);
for (d = 0; d < f.length; ++d) {
if ((e = f[d]) !== "removeListener") {
this.removeAllListeners(e);
}
}
this.removeAllListeners("removeListener");
this._events = Object.create(null);
this._eventsCount = 0;
return this;
}
if (typeof (b = c[a]) == "function") {
this.removeListener(a, b);
} else if (b !== undefined) {
for (d = b.length - 1; d >= 0; d--) {
this.removeListener(a, b[d]);
}
}
return this;
};
f.prototype.listeners = function (a) {
return m(this, a, true);
};
f.prototype.rawListeners = function (a) {
return m(this, a, false);
};
f.listenerCount = function (a, b) {
if (typeof a.listenerCount == "function") {
return a.listenerCount(b);
} else {
return n.call(a, b);
}
};
f.prototype.listenerCount = n;
f.prototype.eventNames = function () {
if (this._eventsCount > 0) {
return b(this._events);
} else {
return [];
}
};
},
648: a => {
'use strict';
var b = Array.prototype.slice;
var c = Object.prototype.toString;
a.exports = function (a) {
var d = this;
if (typeof d != "function" || c.call(d) !== "[object Function]") {
throw new TypeError("Function.prototype.bind called on incompatible " + d);
}
for (var e, f = b.call(arguments, 1), g = Math.max(0, d.length - f.length), h = [], i = 0; i < g; i++) {
h.push("$" + i);
}
e = Function("binder", "return function (" + h.join(",") + "){ return binder.apply(this,arguments); }")(function () {
if (this instanceof e) {
var c = d.apply(this, f.concat(b.call(arguments)));
if (Object(c) === c) {
return c;
} else {
return this;
}
}
return d.apply(a, f.concat(b.call(arguments)));
});
if (d.prototype) {
function a() {}
a.prototype = d.prototype;
e.prototype = new a();
a.prototype = null;
}
return e;
};
},
612: (a, b, c) => {
'use strict';
var d = c(648);
a.exports = Function.prototype.bind || d;
},
210: (a, b, c) => {
'use strict';
var d;
var e = SyntaxError;
var f = Function;
var g = TypeError;
function h(a) {
try {
return f("\"use strict\"; return (" + a + ").constructor;")();
} catch (a) {}
}
var i = Object.getOwnPropertyDescriptor;
if (i) {
try {
i({}, "");
} catch (a) {
i = null;
}
}
function j() {
throw new g();
}
var k = i ? function () {
try {
return j;
} catch (a) {
try {
return i(arguments, "callee").get;
} catch (a) {
return j;
}
}
}() : j;
var l = c(405)();
var m = Object.getPrototypeOf || function (a) {
return a.__proto__;
};
var n = {};
var o = typeof Uint8Array == "undefined" ? d : m(Uint8Array);
var p = {
"%AggregateError%": typeof AggregateError == "undefined" ? d : AggregateError,
"%Array%": Array,
"%ArrayBuffer%": typeof ArrayBuffer == "undefined" ? d : ArrayBuffer,
"%ArrayIteratorPrototype%": l ? m([][Symbol.iterator]()) : d,
"%AsyncFromSyncIteratorPrototype%": d,
"%AsyncFunction%": n,
"%AsyncGenerator%": n,
"%AsyncGeneratorFunction%": n,
"%AsyncIteratorPrototype%": n,
"%Atomics%": typeof Atomics == "undefined" ? d : Atomics,
"%BigInt%": typeof BigInt == "undefined" ? d : BigInt,
"%Boolean%": Boolean,
"%DataView%": typeof DataView == "undefined" ? d : DataView,
"%Date%": Date,
"%decodeURI%": decodeURI,
"%decodeURIComponent%": decodeURIComponent,
"%encodeURI%": encodeURI,
"%encodeURIComponent%": encodeURIComponent,
"%Error%": Error,
"%eval%": eval,
"%EvalError%": EvalError,
"%Float32Array%": typeof Float32Array == "undefined" ? d : Float32Array,
"%Float64Array%": typeof Float64Array == "undefined" ? d : Float64Array,
"%FinalizationRegistry%": typeof FinalizationRegistry == "undefined" ? d : FinalizationRegistry,
"%Function%": f,
"%GeneratorFunction%": n,
"%Int8Array%": typeof Int8Array == "undefined" ? d : Int8Array,
"%Int16Array%": typeof Int16Array == "undefined" ? d : Int16Array,
"%Int32Array%": typeof Int32Array == "undefined" ? d : Int32Array,
"%isFinite%": isFinite,
"%isNaN%": isNaN,
"%IteratorPrototype%": l ? m(m([][Symbol.iterator]())) : d,
"%JSON%": typeof JSON == "object" ? JSON : d,
"%Map%": typeof Map == "undefined" ? d : Map,
"%MapIteratorPrototype%": typeof Map != "undefined" && l ? m(new Map()[Symbol.iterator]()) : d,
"%Math%": Math,
"%Number%": Number,
"%Object%": Object,
"%parseFloat%": parseFloat,
"%parseInt%": parseInt,
"%Promise%": typeof Promise == "undefined" ? d : Promise,
"%Proxy%": typeof Proxy == "undefined" ? d : Proxy,
"%RangeError%": RangeError,
"%ReferenceError%": ReferenceError,
"%Reflect%": typeof Reflect == "undefined" ? d : Reflect,
"%RegExp%": RegExp,
"%Set%": typeof Set == "undefined" ? d : Set,
"%SetIteratorPrototype%": typeof Set != "undefined" && l ? m(new Set()[Symbol.iterator]()) : d,
"%SharedArrayBuffer%": typeof SharedArrayBuffer == "undefined" ? d : SharedArrayBuffer,
"%String%": String,
"%StringIteratorPrototype%": l ? m("" [Symbol.iterator]()) : d,
"%Symbol%": l ? Symbol : d,
"%SyntaxError%": e,
"%ThrowTypeError%": k,
"%TypedArray%": o,
"%TypeError%": g,
"%Uint8Array%": typeof Uint8Array == "undefined" ? d : Uint8Array,
"%Uint8ClampedArray%": typeof Uint8ClampedArray == "undefined" ? d : Uint8ClampedArray,
"%Uint16Array%": typeof Uint16Array == "undefined" ? d : Uint16Array,
"%Uint32Array%": typeof Uint32Array == "undefined" ? d : Uint32Array,
"%URIError%": URIError,
"%WeakMap%": typeof WeakMap == "undefined" ? d : WeakMap,
"%WeakRef%": typeof WeakRef == "undefined" ? d : WeakRef,
"%WeakSet%": typeof WeakSet == "undefined" ? d : WeakSet
};
var q = function b(a) {
var c;
if (a === "%AsyncFunction%") {
c = h("async function () {}");
} else if (a === "%GeneratorFunction%") {
c = h("function* () {}");
} else if (a === "%AsyncGeneratorFunction%") {
c = h("async function* () {}");
} else if (a === "%AsyncGenerator%") {
var d = b("%AsyncGeneratorFunction%");
if (d) {
c = d.prototype;
}
} else if (a === "%AsyncIteratorPrototype%") {
var e = b("%AsyncGenerator%");
if (e) {
c = m(e.prototype);
}
}
p[a] = c;
return c;
};
var r = {
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
"%ArrayPrototype%": ["Array", "prototype"],
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
"%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
"%ArrayProto_keys%": ["Array", "prototype", "keys"],
"%ArrayProto_values%": ["Array", "prototype", "values"],
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
"%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
"%BooleanPrototype%": ["Boolean", "prototype"],
"%DataViewPrototype%": ["DataView", "prototype"],
"%DatePrototype%": ["Date", "prototype"],
"%ErrorPrototype%": ["Error", "prototype"],
"%EvalErrorPrototype%": ["EvalError", "prototype"],
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
"%FunctionPrototype%": ["Function", "prototype"],
"%Generator%": ["GeneratorFunction", "prototype"],
"%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
"%JSONParse%": ["JSON", "parse"],
"%JSONStringify%": ["JSON", "stringify"],
"%MapPrototype%": ["Map", "prototype"],
"%NumberPrototype%": ["Number", "prototype"],
"%ObjectPrototype%": ["Object", "prototype"],
"%ObjProto_toString%": ["Object", "prototype", "toString"],
"%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
"%PromisePrototype%": ["Promise", "prototype"],
"%PromiseProto_then%": ["Promise", "prototype", "then"],
"%Promise_all%": ["Promise", "all"],
"%Promise_reject%": ["Promise", "reject"],
"%Promise_resolve%": ["Promise", "resolve"],
"%RangeErrorPrototype%": ["RangeError", "prototype"],
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
"%RegExpPrototype%": ["RegExp", "prototype"],
"%SetPrototype%": ["Set", "prototype"],
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
"%StringPrototype%": ["String", "prototype"],
"%SymbolPrototype%": ["Symbol", "prototype"],
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
"%TypeErrorPrototype%": ["TypeError", "prototype"],
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
"%URIErrorPrototype%": ["URIError", "prototype"],
"%WeakMapPrototype%": ["WeakMap", "prototype"],
"%WeakSetPrototype%": ["WeakSet", "prototype"]
};
var s = c(612);
var t = c(642);
var u = s.call(Function.call, Array.prototype.concat);
var v = s.call(Function.apply, Array.prototype.splice);
var w = s.call(Function.call, String.prototype.replace);
var x = s.call(Function.call, String.prototype.slice);
var y = s.call(Function.call, RegExp.prototype.exec);
var z = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var A = /\\(\\)?/g;
function B(a, b) {
var c;
var d = a;
if (t(r, d)) {
d = "%" + (c = r[d])[0] + "%";
}
if (t(p, d)) {
var f = p[d];
if (f === n) {
f = q(d);
}
if (f === undefined && !b) {
throw new g("intrinsic " + a + " exists, but is not available. Please file an issue!");
}
return {
alias: c,
name: d,
value: f
};
}
throw new e("intrinsic " + a + " does not exist!");
}
a.exports = function (a, b) {
if (typeof a != "string" || a.length === 0) {
throw new g("intrinsic name must be a non-empty string");
}
if (arguments.length > 1 && typeof b != "boolean") {
throw new g("\"allowMissing\" argument must be a boolean");
}
if (y(/^%?[^%]*%?$/g, a) === null) {
throw new e("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
}
var c = function (a) {
var b = x(a, 0, 1);
var c = x(a, -1);
if (b === "%" && c !== "%") {
throw new e("invalid intrinsic syntax, expected closing `%`");
}
if (c === "%" && b !== "%") {
throw new e("invalid intrinsic syntax, expected opening `%`");
}
var d = [];
w(a, z, function (a, b, c, e) {
d[d.length] = c ? w(e, A, "$1") : b || a;
});
return d;
}(a);
var d = c.length > 0 ? c[0] : "";
var f = B("%" + d + "%", b);
var h = f.name;
var j = f.value;
var k = false;
var l = f.alias;
if (l) {
d = l[0];
v(c, u([0, 1], l));
}
for (var m = 1, n = true; m < c.length; m += 1) {
var o = c[m];
var q = x(o, 0, 1);
var r = x(o, -1);
if ((q === "\"" || q === "'" || q === "`" || r === "\"" || r === "'" || r === "`") && q !== r) {
throw new e("property names with quotes must have matching quotes");
}
if (o === "constructor" || !n) {
k = true;
}
if (t(p, h = "%" + (d += "." + o) + "%")) {
j = p[h];
} else if (j != null) {
if (!(o in j)) {
if (!b) {
throw new g("base intrinsic for " + a + " exists, but the property is not available.");
}
return;
}
if (i && m + 1 >= c.length) {
var s = i(j, o);
j = (n = !!s) && "get" in s && !("originalValue" in s.get) ? s.get : j[o];
} else {
n = t(j, o);
j = j[o];
}
if (n && !k) {
p[h] = j;
}
}
}
return j;
};
},
573: (a, b, c) => {
'use strict';
const d = c(6).GrawlixPlugin;
const e = c(6).FilterTemplate;
const f = c(50);
const g = {
style: "nazi"
};
var h = [{
word: "niggas",
pattern: /n+[i1]+gg+[a@]+[s\$z]+/i,
priority: 0,
expandable: true
}, {
word: "niggers",
pattern: /n+[i1]+gg+e+r+[s\$z]+/i,
priority: 0,
expandable: true
}, {
word: "nigga",
pattern: /n+[\W023456789_]{0,42}[i1]+[\W023456789_]{0,42}g[\W\d_]{0,42}g+[\W\d_]{0,42}[a@]+(?!rd)/i,
priority: 1,
expandable: true
}, {
word: "nigger",
pattern: /(\b|^|[^s])n+[\W02-9_]{0,42}[i1]+[\W02-9_]{0,42}g[\W\d_]{0,42}g+[\W0-24-9_]{0,42}[e3]+[\W0-24-9_]{0,42}r+/i,
priority: 1,
expandable: true,
template: e.PRE
}, {
word: "migger",
pattern: /m+[i1]+gg+[e3]+r+/i,
priority: 1,
expandable: true
}, {
word: "yigger",
pattern: /y+[i1]+gg+[e3]+r+/i,
priority: 1,
expandable: true
}, {
word: "darkies",
pattern: /d+[a@]+r+k+[i1]+[e3]+s+/i,
priority: 0,
expandable: true
}, {
word: "darkie",
pattern: /d+[\W\d_]{0,42}[a@]+[\W\d_]{0,42}r+[\W\d_]{0,42}k+[\W02-9_]{0,42}[i1]+[\W024-9_]{0,42}[e3]+/i,
priority: 1,
expandable: true
}, {
word: "shvatsas",
pattern: /[s$z]+h+v+[a@]+t+[s$z]+[a@]+[s$z]+/i,
priority: 0,
expandable: true
}, {
word: "shvatsa",
pattern: /[s$z]+h+v+[a@]+t+[s$z]+[a@]+/i,
priority: 1,
expandable: true
}, {
word: "spics",
pattern: /(\b|^)[s$]+p+[i1]+c+k{0,32}[s$]+/i,
priority: 0,
expandable: true,
template: e.PRE
}, {
word: "spic",
pattern: /(\b|^)[s$]+[\W\d_]{0,42}p+[\W02-9_]{0,42}[i1]+[\W02-9_]{0,42}c+(\b|$)/i,
priority: 1,
expandable: true,
template: e.BETWEEN
}, {
word: "wetbacks",
pattern: /w+[e3]+t+b+[a@]+c+k+[s$z]+/i,
priority: 0,
expandable: true
}, {
word: "wetback",
pattern: /w+[e3]+t+b+[a@]+c+k+/i,
priority: 1,
expandable: true
}, {
word: "kikes",
pattern: /k+[i1]+k+[e3]+[s$z]+/i,
priority: 0,
expandable: true
}, {
word: "kike",
pattern: /k+[\W02-9_]{0,42}[i1]+[\W02-9_]{0,42}k+[\W0124-9_]{0,42}[e3]+(\b|$)/i,
priority: 1,
expandable: true,
template: e.POST
}, {
word: "gooks",
pattern: /g+[\W1-9_]{0,42}[o0][\W1-9_]{0,42}[o0]+[\W1-9_]{0,42}k+[\W\d_]{0,42}[s$]+/i,
priority: 0,
expandable: true
}, {
word: "gook",
pattern: /(\b|^)g+[\W1-9_]{0,42}[o0][\W1-9_]{0,42}[o0]+[\W1-9_]{0,42}k+(?!y)/i,
priority: 1,
expandable: true,
template: e.PRE
}, {
word: "ragheads",
pattern: /r+[a@]+g+[\W\d_]{0,42}h+[e3]+[a@]+d+[s$]+/i,
priority: 0,
expandable: true
}, {
word: "raghead",
pattern: /r+[\W\d_]{0,42}[a@]+[\W\d_]{0,42}g+[\W\d_]{0,42}h+[\W0-24-9_]{0,42}[e3]+[\W0-24-9_]{0,42}[a@]+[\W\d_]{0,42}d+/i,
priority: 1,
expandable: true
}, {
word: "towelheads",
pattern: /t+[o0]+w+[e3]+[l1]+[\W02-9_]{0,42}h+[e3]+[a@]+d+[s$]+/i,
priority: 0,
expandable: true
}, {
word: "towelhead",
pattern: /t+[\W1-9_]{0,42}[o0]+[\W1-9_]{0,42}w+[\W0-24-9_]{0,42}[e3]+[\W024-9_]{0,42}[l1]+[\W02-9_]{0,42}h+[\W0-24-9_]{0,42}[e3]+[\W0-24-9_]{0,42}[a@]+[\W\d_]{0,42}d+/i,
priority: 1,
expandable: true
}, {
word: "injuns",
pattern: /[i1]+n+j+u+n+[s$]+/i,
priority: 0,
expandable: true
}, {
word: "injun",
pattern: /[i1]+[\W02-9_]{0,42}n+[\W\d_]{0,42}j+[\W\d_]{0,42}u+[\W\d_]{0,42}n+(\b|$)/i,
priority: 1,
expandable: true,
template: e.POST
}, {
word: "squaws",
pattern: /(\b|^)[s$]+q+u+[a@]+w+s+/i,
priority: 0,
expandable: true,
template: e.PRE
}, {
word: "squaw",
pattern: /(\b|^)[s$]+q+u+[a@]+w+(\b|$)/i,
priority: 1,
expandable: true,
template: e.BETWEEN
}, {
word: "golliwogs",
pattern: /g[o0][l1][l1][i1y]w[o0]g+[s$]/i,
priority: 0,
expandable: true
}, {
word: "golliwog",
pattern: /g[o0][l1][l1][i1y]w[o0]g+/i,
priority: 1,
expandable: true
}, {
word: "wogs",
pattern: /w+[\W1-9_]{0,42}[o0]+[\W1-9_]{0,42}g+[\W\d_]{0,42}[s$]+/i,
priority: 1,
expandable: true
}, {
word: "wog",
pattern: /(\b|^)w+[\W1-9_]{0,42}[o0]+[\W1-9_]{0,42}g+(\b|$)/i,
priority: 2,
expandable: true,
template: e.BETWEEN
}, {
word: "kaffirs",
pattern: /[ck][a@]ff[ie3]r[s$z]/i,
priority: 0
}, {
word: "caffres",
pattern: /[ck][a@]ffr[e3][s$z]/i,
priority: 0
}, {
word: "caffre",
pattern: /[ck][\W\d_]{0,42}[a@][\W\d_]{0,42}f[\W\d_]{0,42}f[\W\d_]{0,42}r[\W0-24-9_]{0,42}[e3]/i,
priority: 1,
expandable: true
}, {
word: "kaffir",
pattern: /[ck]+[\W\d_]{0,42}[a@]+[\W\d_]{0,42}(?:f[\W024-9_]{0,42})+[i1e3]+[\W024-9_]{0,42}r+/i,
priority: 2,
expandable: true
}, {
word: "shitskins",
pattern: /[s$]h[i1]t[s$]k[i1]n[s$]/i,
priority: 0
}, {
word: "shitskin",
pattern: /[s$]h[i1]t[s$]k[i1]n/i,
priority: 1
}, {
word: "shit",
minPriority: 2
}, {
word: "latrinos",
pattern: /[l1][a@]tr[i1]n[o0][s$z]/i,
priority: 0
}, {
word: "latrino",
pattern: /[l1][a@]tr[i1]n[o0]/i,
priority: 1
}, {
word: "chinkerbell",
pattern: /ch[i1]nk[e3]rb[e3][l1][l1]+/i,
priority: 0,
expandable: true
}, {
word: "shvoogas",
pattern: /[s$]hv[o0][o0]g[a@][s$]/i,
priority: 0
}, {
word: "shvooga",
pattern: /[s$]hv[o0][o0]g[a@]/i,
priority: 1
}, {
word: "negress",
pattern: /n[e3]gr[e3][s$z][s$z]+/i,
priority: 0,
expandable: true
}, {
word: "sambos",
pattern: /[s$][a@]mb[o0][e3]*[s$]/i,
priority: 0
}, {
word: "sambo",
pattern: /[s$][\W\d_]{0,42}[a@][\W\d_]{0,42}m[\W\d_]{0,42}b[\W1-9_]{0,42}[o0]/i,
priority: 1
}];
a.exports = new d({
name: "grawlix-racism",
filters: h,
styles: [{
name: "nazi",
char: "卐"
}],
init: function (a) {
f.defaults(a, g);
if (a.style === false || f.isEmpty(a.style)) {
f.each(this.filters, function (a) {
if (f.has(a, "style")) {
delete a.style;
}
});
} else {
f.each(this.filters, function (b) {
if (f.has(b, "pattern")) {
b.style = a.style;
}
});
}
}
});
},
17: (a, b, c) => {
'use strict';
const d = c(50);
const e = {
PRE: "$1<%= word %>",
POST: "<%= word %>$1",
BETWEEN: "$1<%= word %>$2"
};
const f = function (a, b, c) {
this.word = a;
this.regex = b;
this.priority = 0;
this.template = null;
this.isExpandable = false;
this.style = null;
this.isValid = function () {
return !d.isEmpty(this.word) && d.isRegExp(this.regex);
};
this.isMatch = function (a) {
return a.search(this.regex) > -1;
};
this.getMatch = function (a) {
return this.regex.exec(a);
};
this.getMatchLen = function (a) {
var b = this.getMatch(a);
if (b === null || b.length === 0) {
return 0;
}
var c = b[0].length;
if (b.length > 1) {
for (var d = 1; d < b.length; d++) {
c -= b[d].length;
}
}
return c;
};
this.hasTemplate = function () {
return this.template !== null && d.isFunction(this.template);
};
this.hasStyle = function () {
return this.style !== null;
};
this.configure = function (a) {
if (!d.isUndefined(a)) {
if (d.has(a, "priority") && d.isNumber(a.priority)) {
this.priority = a.priority;
} else if (d.has(a, "minPriority") && d.isNumber(a.minPriority) && this.priority < a.minPriority) {
this.priority = a.minPriority;
}
if (d.has(a, "template") && d.isString(a.template)) {
this.template = d.template(a.template, {
variable: "word"
});
}
if (d.has(a, "expandable") && d.isBoolean(a.expandable)) {
this.isExpandable = a.expandable;
}
if (d.has(a, "style") && d.isString(a.style)) {
this.style = a.style;
}
}
};
this.clone = function () {
var a = new f(this.word, this.regex);
a.priority = this.priority;
a.template = this.template;
a.isExpandable = this.isExpandable;
a.style = this.style;
return a;
};
this.configure(c);
};
f.prototype = {};
const g = function (a) {
this.name = "GrawlixFilterError";
this.filter = d.has(a, "filter") ? a.filter : null;
this.plugin = d.has(a, "plugin") ? a.plugin : null;
if (d.has(a, "trace") && a.trace instanceof Error) {
this.stack = a.trace.stack;
} else {
this.stack = new Error().stack;
}
if (d.has(a, "msg")) {
this.message = a.msg;
} else if (d.has(a, "message")) {
this.message = a.message;
} else {
this.message = a;
}
};
(g.prototype = Object.create(Error.prototype)).constructor = g;
var h = [new f("motherfucker", /m[o0u]th(?:er|a)f+u+c+k+[e3]r/i, {
expandable: true
}), new f("motherfuck", /m[o0u]th(?:er|a)f+u+c+k+/i, {
priority: 1,
expandable: true
}), new f("fuck", /f+[\s\d_\^\+\=\*\.\-,:"'>|\/\\]{0,42}u+[\s\d_\^\+\=\*\.\-,:"'>|\/\\]{0,42}c+[\s\d_\^\+\=\*\.\-,:"'>|\/\\]{0,42}k+/i, {
priority: 2,
expandable: true
}), new f("shit", /[s$]+[\s\d_\^\+\=\*\.\-,:"'>|\/\\]{0,42}h+[\s\d_\^\+\=\*\.\-,:"'>|\/\\]{0,42}[i1]+[\s023456789_\^\+\=\*\.\-,:"'>|\/\\]{0,42}t+(?!ake)/i, {
expandable: true
}), new f("cocksucker", /c+[o0]+c+k+s+u+c+k+[e3]+r+/i, {
expandable: true
}), new f("cocksuck", /c+[o0]+c+k+s+u+c+k+/i, {
priority: 1,
expandable: true
}), new f("assholes", /[a@][s\$][s\$]h[o0]l[e3][s\$]/i), new f("asshole", /[a@][s\$][s\$]h[o0]+l[e3]/i, {
priority: 1,
expandable: true
}), new f("asses", /(\b|^|[^glmp])[a@][s\$][s\$][e3][s\$](?:\b|$)/i, {
template: e.PRE
}), new f("dumbass", /\b(dumb)[a@][s\$][s\$]+/i, {
priority: 1,
expandable: true,
template: e.PRE
}), new f("ass", /(\b|^|\s|[^bcglmprstvu])[a@][\s\d_\^\+\=\*\.\-,:"'>|\/\\]{0,42}[s\$][\s\d_\^\+\=\*\.\-,:"'>|\/\\]{0,42}[s\$]+(?:\b|$)/i, {
priority: 2,
template: e.PRE,
expandable: true
}), new f("titties", /\bt[i1]tt[i1]e[s\$]/i), new f("tittie", /\bt[i1]tt[i1]e/i, {
priority: 1
}), new f("titty", /\bt[i1]tty/i), new f("tits", /\bt+[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}[i1]+[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}t+[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}[s\$]+/i, {
priority: 1,
expandable: true
}), new f("tit", /\bt+[i1]+t([^ahilmrtu])/i, {
priority: 2,
template: e.POST,
expandable: true
}), new f("piss", /p[i1]+ss+(?!ant)/i, {
expandable: true
}), new f("dick", /d[i1]+c+k+(?!e|i)/i, {
expandable: true
}), new f("cunt", /(\b|[^s])c+[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}u+[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}n+[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}t/i, {
template: e.PRE,
expandable: true
}), new f("bastard", /\bb[a@]+st[a@]+r+d(?!ise|ize)/i, {
expandable: true
}), new f("bitch", /b+[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}[i1]+[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}t[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}c[\s_\^\+\=\*\.\-,:"'>|\/\\]{0,42}h/i, {
expandable: true
})];
function i(a, b) {
if (a.priority === b.priority) {
return 0;
} else if (a.priority < b.priority) {
return -1;
} else {
return 1;
}
}
a.exports = {
GrawlixFilter: f,
GrawlixFilterError: g,
FilterSort: i,
FilterTemplate: e,
filters: h.sort(i),
toGrawlixFilter: function (a) {
if (!d.has(a, "word") || !d.isString(a.word)) {
throw new g({
msg: "word parameter is required",
filter: a
});
}
if (!d.has(a, "pattern") || !d.isRegExp(a.pattern)) {
throw new g({
msg: "pattern parameter is required",
filter: a
});
}
return new f(a.word, a.pattern, a);
}
};
},
6: (a, b, c) => {
'use strict';
const d = c(50);
const e = c(2);
const f = c(13).Style;
const g = c(434).GrawlixPlugin;
const h = c(434).GrawlixPluginError;
var i = {
style: f.ASCII,
randomize: true,
plugins: [],
filters: [],
styles: [],
allowed: []
};
var j = null;
function k(a, b) {
var c;
if (d.isUndefined(b) && j !== null) {
c = j;
} else if (d.isUndefined(b)) {
c = e.parseOptions(i);
j = c;
} else {
c = e.parseOptions(b, i);
}
return e.replaceMatches(a, c);
}
k.getDefaults = function () {
return i;
};
k.setDefaults = function (a) {
i = d.extend({}, i, a);
j = null;
};
k.isObscene = function (a, b, c) {
var f;
if (d.isUndefined(b) && d.isUndefined(c) && j !== null) {
f = j;
} else if (d.isArray(b) || d.isArray(c)) {
f = e.parseOptions({
filters: d.isUndefined(b) || b === null ? [] : b,
allowed: d.isUndefined(c) || c === null ? [] : c
}, i);
} else {
f = e.parseOptions(i);
j = f;
}
return e.isMatch(a, f);
};
k.loadPlugin = function (a, b) {
var c = {};
if (a instanceof g || d.isFunction(a)) {
c.plugin = a;
} else {
if (!d.isString(a)) {
throw new h({
message: "invalid plugin",
plugin: a,
trace: new Error()
});
}
c.module = a;
}
c.options = d.isUndefined(b) ? {} : b;
i.plugins.push(c);
return k;
};
k.hasPlugin = function (a) {
return e.hasPlugin(a, i);
};
k.Style = f;
k.GrawlixPlugin = g;
k.FilterTemplate = c(17).FilterTemplate;
k.error = {
GrawlixFilterError: c(17).GrawlixFilterError,
GrawlixPluginError: h,
GrawlixStyleError: c(13).GrawlixStyleError
};
a.exports = k;
},
434: (a, b, c) => {
'use strict';
const d = c(50);
const e = function (a) {
this.name = null;
this.filters = [];
this.styles = [];
this.init = function (a) {};
if (!d.isUndefined(a)) {
if (d.has(a, "name") && d.isString(a.name)) {
this.name = a.name;
} else if (d.isString(a)) {
this.name = a;
}
if (d.has(a, "filters") && d.isArray(a.filters)) {
this.filters = a.filters;
}
if (d.has(a, "styles") && d.isArray(a.styles)) {
this.styles = a.styles;
}
if (d.has(a, "init") && d.isFunction(a.init)) {
this.init = d.bind(a.init, this);
}
}
};
e.prototype = {};
const f = function (a) {
var b;
this.name = "GrawlixPluginError";
this.plugin = d.has(a, "plugin") ? a.plugin : null;
if (d.has(a, "trace") && a.trace instanceof Error) {
this.stack = a.trace.stack;
} else {
this.stack = new Error().stack;
}
b = d.has(a, "msg") ? a.msg : d.has(a, "message") ? a.message : a;
if (this.plugin !== null && d.has(this.plugin, "name")) {
this.message = "[plugin " + this.plugin.name + "] " + b;
} else {
this.message = b;
}
};
(f.prototype = Object.create(Error.prototype)).constructor = f;
a.exports = {
GrawlixPlugin: e,
GrawlixPluginError: f
};
},
13: (a, b, c) => {
'use strict';
const d = c(50);
const e = {
ASCII: "ascii",
ASTERIX: "asterix",
DINGBATS: "dingbats",
NEXTWAVE: "nextwave",
REDACTED: "redacted",
UNICODE: "unicode",
UNDERSCORE: "underscore"
};
const f = function (a, b) {
this.name = a;
this.chars = null;
this.fixed = {};
this.isOverrideAllowed = true;
this.isValid = function () {
return d.isString(this.name) && !d.isEmpty(this.name) && (d.isString(this.chars) && !d.isEmpty(this.chars) || d.isFunction(this.chars) || !d.isEmpty(this.fixed) && d.keys(this.fixed).length > 0);
};
this.canRandomize = function () {
return d.isFunction(this.chars) || d.isString(this.chars) && this.chars.length > 1;
};
this.getRandomGrawlix = function (a) {
if (!this.canRandomize()) {
throw new g({
msg: "Random grawlixes not supported",
style: this,
styleName: this.name
});
}
if (d.isFunction(this.chars)) {
return this.chars(a);
}
for (var b, c, e = []; e.length < a;) {
if ((b = this.chars.charAt(d.random(this.chars.length - 1))) !== c) {
if (b !== "!" || e.length !== a - 1) {
e.push(b);
c = b;
}
}
}
return e.join("");
};
this.getFillGrawlix = function (a) {
var b;
b = this.chars.length > 1 ? this.chars.charAt(0) : this.chars;
for (var c = [], d = 0; d < a; d++) {
c.push(b);
}
return c.join("");
};
this.hasFixed = function (a) {
return d.has(this.fixed, a) && !d.isEmpty(this.fixed[a]);
};
this.getFixed = function (a) {
return this.fixed[a];
};
this.addChars = function (a) {
var b = this;
var c = d.isArray(a) ? a : a.split("");
var e = 0;
d.each(c, function (a) {
if (b.chars.indexOf(a) === -1) {
b.chars += a;
e++;
}
});
return e;
};
this.removeChars = function (a) {
var b = this.chars.split("");
var c = d.filter(b, function (b) {
return a.indexOf(b) === -1;
});
this.chars = c.join("");
return b.length - c.length;
};
this.replaceChars = function (a) {
var b = this.chars.split("");
var c = 0;
var e = d.map(b, function (b) {
if (d.has(a, b) && d.isString(a[b])) {
c++;
return a[b];
} else {
return b;
}
});
this.chars = e.join("");
return c;
};
this.configure = function (a) {
if (d.has(a, "char") && d.isString(a.char)) {
this.chars = a.char;
} else if (d.has(a, "randomChars") && (d.isString(a.randomChars) || d.isFunction(a.randomChars))) {
this.chars = a.randomChars;
}
if (d.isString(this.chars) && d.has(a, "randomChars") && d.isObject(a.randomChars)) {
if (d.has(a.randomChars, "add")) {
this.addChars(a.randomChars.add);
}
if (d.has(a.randomChars, "remove")) {
this.removeChars(a.randomChars.remove);
}
if (d.has(a.randomChars, "replace") && d.isObject(a.randomChars.replace)) {
this.replaceChars(a.randomChars.replace);
}
}
if (d.has(a, "fixed") && d.isObject(a.fixed)) {
d.each(a.fixed, function (a, b) {
if (!d.has(this.fixed, b) || a !== false && d.isString(a)) {
this.fixed[b] = a;
} else {
delete this.fixed[b];
}
}, this);
}
if (d.has(a, "allowOverride") && d.isBoolean(a.allowOverride)) {
this.isOverrideAllowed = a.allowOverride;
}
};
this.clone = function () {
var a = new f(this.name);
a.chars = this.chars;
a.fixed = d.clone(this.fixed);
a.isOverrideAllowed = this.isOverrideAllowed;
return a;
};
if (!d.isUndefined(b)) {
this.configure(b);
}
};
f.prototype = {};
const g = function (a) {
var b;
this.name = "GrawlixStyleError";
this.styleName = d.has(a, "styleName") ? a.styleName : null;
this.style = d.has(a, "style") ? a.style : null;
this.plugin = d.has(a, "plugin") ? a.plugin : null;
if (d.has(a, "trace") && a.trace instanceof Error) {
this.stack = a.trace.stack;
} else {
this.stack = new Error().stack;
}
b = d.has(a, "msg") ? a.msg : d.has(a, "message") ? a.message : a;
if (this.styleName !== null) {
this.message = "[style " + this.styleName + "] " + b;
} else if (this.style !== null && d.has(this.style, "name")) {
this.styleName = this.style.name;
this.message = "[style " + this.style.name + "] " + b;
} else {
this.message = b;
}
};
g.prototype = Object.create(Error.prototype);
g.prototype.constructor = g;
const h = [new f(e.ASCII, {
randomChars: "@!#$%^&*",
fixed: {
fuck: "%!&#",
motherfuck: "%*^##*%!&#",
motherfucker: "%*^##*%!&##&",
shit: "$$#!%",
dick: "%!&#",
piss: "&!$$$$",
cunt: "#^&%",
cocksuck: "#*#%$$!#%",
cocksucker: "#*#%$$!#%#&",
ass: "@**",
asses: "@**#*",
asshole: "@**#%!&",
assholes: "@**#%!&*",
dumbass: "@**",
bastard: "%@$$%@*#",
bitch: "%!#*%",
tit: "%!%",
tits: "%!%$$",
titty: "%!%%^",
tittie: "%!%%!#",
titties: "%!%%!#$$"
}
}), new f(e.DINGBATS, {
randomChars: "★☒☎☠☢☣☹♡♢♤♧⚓⚔⚑⚡♯✓☝",
fixed: {
fuck: "⚑☠♧⚔",
motherfuck: "★☹⚓♯⚡☢⚑☠♧⚔",
motherfucker: "★☹⚓♯⚡☢⚑☠♧⚔⚡☢",
shit: "☠♯☝⚓",
dick: "♢☝♧⚔",
piss: "☣☝☠☠",
cunt: "♧♡⚔⚓",
cocksuck: "♧☹♧⚔☠♡♧⚔",
cocksucker: "♧☹♧⚔☠♡♧⚔⚡☢",
ass: "☹☠☠",
asses: "☹☠☠♯☠",
asshole: "☹☠☠♯☢✓⚡",
assholes: "☹☠☠♯☢✓⚡☠",
dumbass: "☹☠☠",
bastard: "☣☹☠⚓@☢♢",
bitch: "☣☝⚓♧♯",
tit: "⚓☝⚓",
tits: "⚓☝⚓☠",
titty: "⚓☝⚓⚓⚔",
tittie: "⚓☝⚓⚓☝♯",
titties: "⚓☝⚓⚓☝♯☠"
}
}), new f(e.UNICODE, {
randomChars: "!@#$%★☒☎☠☢☣☹♡♢♤♧⚓⚔⚑⚡",
fixed: {
fuck: "⚑☠♧⚔",
motherfuck: "★☹⚓#⚡☢⚑☠♧⚔",
motherfucker: "★☹⚓#⚡☢⚑☠♧⚔⚡☢",
shit: "$$#!⚓",
dick: "♢!♧⚔",
piss: "☣!$$$$",
cunt: "♧♡⚔⚓",
cocksuck: "♧☹♧⚔$$♡♧⚔",
cocksucker: "♧☹♧⚔$$♡♧⚔⚡☢",
ass: "@$$$$",
asses: "@$$$$#$$",
asshole: "@$$$$#☢!⚡",
assholes: "@$$$$#☢!⚡$$",
dumbass: "@$$$$",
bastard: "☣@$$⚓@☢♢",
bitch: "☣!⚓♧#",
tit: "⚓!⚓",
tits: "⚓!⚓$$",
titty: "⚓!⚓⚓⚔",
tittie: "⚓!⚓⚓!#",
titties: "⚓!⚓⚓!#$$"
}
}), new f(e.ASTERIX, {
char: "*"
}), new f(e.NEXTWAVE, {
char: "☠"
}), new f(e.REDACTED, {
char: "█"
}), new f(e.UNDERSCORE, {
char: "_"
})];
a.exports = {
styles: h,
Style: e,
GrawlixStyle: f,
GrawlixStyleError: g,
toGrawlixStyle: function (a) {
if (!d.has(a, "name") || !d.isString(a.name) || d.isEmpty(a.name)) {
throw new g({
msg: "name parameter is required",
style: a,
trace: new Error()
});
}
if (!d.has(a, "char") && !d.has(a, "randomChars") && !d.has(a, "fixed")) {
throw new g({
msg: "char, randomChars or fixed parameter required",
style: a,
trace: new Error()
});
}
return new f(a.name, a);
}
};
},
2: (a, b, c) => {
'use strict';
const d = c(50);
const e = c(17).filters;
const f = c(13).styles;
const g = c(17).FilterSort;
c(17).GrawlixFilter;
const h = c(17).toGrawlixFilter;
const i = c(13).GrawlixStyle;
const j = c(13).toGrawlixStyle;
const k = c(13).GrawlixStyleError;
const l = c(434).GrawlixPlugin;
const m = c(434).GrawlixPluginError;
b.parseOptions = function (a, b) {
if (!d.isUndefined(b)) {
d.defaults(a, b);
}
var c;
var h = new n();
h.isRandom = a.randomize;
d.each(e, function (b) {
var c = d.contains(a.allowed, b.word);
var e = d.some(a.filters, function (a) {
return d.has(a, "word") && a.word === b.word && d.has(a, "pattern");
});
if (!c && !e) {
h.filters.push(b.clone());
}
});
d.each(f, function (a) {
h.styles.push(a.clone());
});
if (a.plugins.length > 0) {
d.each(a.plugins, function (b) {
o(h, b, a);
});
}
p(h, a.filters, a.allowed);
h.filters.sort(g);
q(h, a.styles);
if (!d.has(a, "style") || a.style === null) {
throw new k({
msg: "main style not found",
style: a.style,
trace: new Error()
});
}
if (d.has(a.style, "name")) {
c = d.findWhere(h.styles, {
name: a.style.name
});
if (d.isUndefined(c)) {
c = j(a.style);
} else {
c.configure(a.style);
}
} else {
c = d.findWhere(h.styles, {
name: a.style
});
}
if (!(c instanceof i)) {
throw new k({
msg: "main style not found",
styleName: a.style,
style: a.style,
trace: new Error()
});
}
h.style = c;
return h;
};
function n() {
this.isRandom = true;
this.filters = [];
this.style = null;
this.styles = [];
this.loadedPlugins = [];
this.loadedModules = [];
}
n.prototype = {};
b.GrawlixSettings = n;
function o(a, b, e) {
var f;
if (d.has(b, "plugin")) {
f = b.plugin;
} else if (d.has(b, "module")) {
if (d.contains(a.loadedModules, b.module)) {
return a;
}
try {
f = c(717)(b.module);
} catch (a) {
throw new m({
msg: "cannot find module '" + b.module + "'",
plugin: b,
trace: new Error()
});
}
a.loadedModules.push(b.module);
} else {
f = b;
}
var g = d.has(b, "options") ? b.options : {};
if (d.isFunction(f)) {
f = f(g, e);
}
if (!(f instanceof l)) {
throw new m({
msg: "invalid plugin",
plugin: b
});
}
if (f.name === null || d.isEmpty(f.name)) {
throw new m({
msg: "invalid plugin - name property not provided",
plugin: b
});
}
if (d.contains(a.loadedPlugins, f.name)) {
return a;
}
f.init(g);
if (!d.isUndefined(f.filters) && d.isArray(f.filters)) {
try {
p(a, f.filters, e.allowed);
} catch (a) {
a.plugin = b;
throw a;
}
}
if (!d.isUndefined(f.styles) && d.isArray(f.styles)) {
try {
q(a, f.styles);
} catch (a) {
a.plugin = b;
throw a;
}
}
a.loadedPlugins.push(f.name);
return a;
}
b.loadPlugin = o;
function p(a, b, c) {
if (b.length > 0) {
d.each(b, function (b) {
if (d.has(b, "word")) {
if (d.has(b, "pattern")) {
if (!d.contains(c, b.word)) {
a.filters.push(h(b));
}
} else {
var e = d.findWhere(a.filters, {
word: b.word
});
if (!d.isUndefined(e)) {
e.configure(b);
}
}
}
});
}
return a;
}
b.loadFilters = p;
function q(a, b) {
if (d.isArray(b) && b.length > 0) {
d.each(b, function (b) {
if (d.has(b, "name")) {
var c = d.findWhere(a.styles, {
name: b.name
});
if (d.isUndefined(c)) {
a.styles.push(j(b));
} else {
c.configure(b);
}
}
});
}
return a;
}
b.loadStyles = q;
b.hasPlugin = function (a, b) {
if (d.has(b, "plugins") && d.isArray(b.plugins)) {
if (a instanceof l) {
return d.some(b.plugins, function (b) {
return d.has(b, "plugin") && b.plugin instanceof l && (b.plugin === a || b.plugin.name === a.name);
});
}
if (d.isFunction(a)) {
return d.some(b.plugins, function (b) {
return d.has(b, "plugin") && b.plugin === a;
});
}
if (d.isString(a)) {
return d.some(b.plugins, function (b) {
return d.has(b, "module") && b.module === a || d.has(b, "plugin") && b.plugin instanceof l && b.plugin.name === a;
});
}
}
return false;
};
b.isMatch = function (a, b) {
return b.filters.length !== 0 && d.some(b.filters, function (b) {
return b.isMatch(a);
});
};
b.replaceMatches = function (a, b) {
d.each(b.filters, function (c) {
while (c.isMatch(a)) {
a = r(a, c, b);
}
});
return a;
};
function r(a, b, c) {
var e;
var f;
if (b.hasStyle() && c.style.isOverrideAllowed) {
e = d.findWhere(c.styles, {
name: b.style
});
}
if (d.isUndefined(e)) {
e = c.style;
}
f = !c.isRandom && e.hasFixed(b.word) ? e.getFixed(b.word) : s(a, b, e);
if (b.hasTemplate()) {
f = b.template(f);
}
return a.replace(b.regex, f);
}
b.replaceMatch = r;
function s(a, b, c) {
var d;
d = b.isExpandable ? b.getMatchLen(a) : b.word.length;
if (c.canRandomize()) {
return c.getRandomGrawlix(d);
} else {
return c.getFillGrawlix(d);
}
}
b.generateGrawlix = s;
},
717: a => {
function b(a) {
var b = new Error("Cannot find module '" + a + "'");
b.code = "MODULE_NOT_FOUND";
throw b;
}
b.keys = () => [];
b.resolve = b;
b.id = 717;
a.exports = b;
},
405: (a, b, c) => {
'use strict';
var d = typeof Symbol != "undefined" && Symbol;
var e = c(419);
a.exports = function () {
return typeof d == "function" && typeof Symbol == "function" && typeof d("foo") == "symbol" && typeof Symbol("bar") == "symbol" && e();
};
},
419: a => {
'use strict';
a.exports = function () {
if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function") {
return false;
}
if (typeof Symbol.iterator == "symbol") {
return true;
}
var a = {};
var b = Symbol("test");
var c = Object(b);
if (typeof b == "string") {
return false;
}
if (Object.prototype.toString.call(b) !== "[object Symbol]") {
return false;
}
if (Object.prototype.toString.call(c) !== "[object Symbol]") {
return false;
}
a[b] = 42;
for (b in a) {
return false;
}
if (typeof Object.keys == "function" && Object.keys(a).length !== 0) {
return false;
}
if (typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(a).length !== 0) {
return false;
}
var d = Object.getOwnPropertySymbols(a);
if (d.length !== 1 || d[0] !== b) {
return false;
}
if (!Object.prototype.propertyIsEnumerable.call(a, b)) {
return false;
}
if (typeof Object.getOwnPropertyDescriptor == "function") {
var e = Object.getOwnPropertyDescriptor(a, b);
if (e.value !== 42 || e.enumerable !== true) {
return false;
}
}
return true;
};
},
642: (a, b, c) => {
'use strict';
var d = c(612);
a.exports = d.call(Function.call, Object.prototype.hasOwnProperty);
},
514: function (a, b) {
var c;
var d;
if ((d = typeof (c = function () {
'use strict';
function a(a, b, c) {
this.low = a | 0;
this.high = b | 0;
this.unsigned = !!c;
}
function b(a) {
return (a && a.__isLong__) === true;
}
a.prototype.__isLong__;
Object.defineProperty(a.prototype, "__isLong__", {
value: true,
enumerable: false,
configurable: false
});
a.isLong = b;
var c = {};
var d = {};
function e(a, b) {
var e;
var f;
var h;
if (b) {
if ((h = (a >>>= 0) >= 0 && a < 256) && (f = d[a])) {
return f;
} else {
e = g(a, (a | 0) < 0 ? -1 : 0, true);
if (h) {
d[a] = e;
}
return e;
}
} else if ((h = (a |= 0) >= -128 && a < 128) && (f = c[a])) {
return f;
} else {
e = g(a, a < 0 ? -1 : 0, false);
if (h) {
c[a] = e;
}
return e;
}
}
function f(a, b) {
if (isNaN(a) || !isFinite(a)) {
if (b) {
return p;
} else {
return o;
}
}
if (b) {
if (a < 0) {
return p;
}
if (a >= l) {
return u;
}
} else {
if (a <= -m) {
return v;
}
if (a + 1 >= m) {
return t;
}
}
if (a < 0) {
return f(-a, b).neg();
} else {
return g(a % k | 0, a / k | 0, b);
}
}
function g(b, c, d) {
return new a(b, c, d);
}
a.fromInt = e;
a.fromNumber = f;
a.fromBits = g;
var h = Math.pow;
function i(a, b, c) {
if (a.length === 0) {
throw Error("empty string");
}
if (a === "NaN" || a === "Infinity" || a === "+Infinity" || a === "-Infinity") {
return o;
}
if (typeof b == "number") {
c = b;
b = false;
} else {
b = !!b;
}
if ((c = c || 10) < 2 || c > 36) {
throw RangeError("radix");
}
var d;
if ((d = a.indexOf("-")) > 0) {
throw Error("interior hyphen");
}
if (d === 0) {
return i(a.substring(1), b, c).neg();
}
for (var e = f(h(c, 8)), g = o, j = 0; j < a.length; j += 8) {
var k = Math.min(8, a.length - j);
var l = parseInt(a.substring(j, j + k), c);
if (k < 8) {
var m = f(h(c, k));
g = g.mul(m).add(f(l));
} else {
g = (g = g.mul(e)).add(f(l));
}
}
g.unsigned = b;
return g;
}
function j(b) {
if (b instanceof a) {
return b;
} else if (typeof b == "number") {
return f(b);
} else if (typeof b == "string") {
return i(b);
} else {
return g(b.low, b.high, b.unsigned);
}
}
a.fromString = i;
a.fromValue = j;
var k = 4294967296;
var l = k * k;
var m = l / 2;
var n = e(1 << 24);
var o = e(0);
a.ZERO = o;
var p = e(0, true);
a.UZERO = p;
var q = e(1);
a.ONE = q;
var r = e(1, true);
a.UONE = r;
var s = e(-1);
a.NEG_ONE = s;
var t = g(-1, 2147483647, false);
a.MAX_VALUE = t;
var u = g(-1, -1, true);
a.MAX_UNSIGNED_VALUE = u;
var v = g(0, -2147483648, false);
a.MIN_VALUE = v;
var w = a.prototype;
w.toInt = function () {
if (this.unsigned) {
return this.low >>> 0;
} else {
return this.low;
}
};
w.toNumber = function () {
if (this.unsigned) {
return (this.high >>> 0) * k + (this.low >>> 0);
} else {
return this.high * k + (this.low >>> 0);
}
};
w.toString = function (a) {
if ((a = a || 10) < 2 || a > 36) {
throw RangeError("radix");
}
if (this.isZero()) {
return "0";
}
if (this.isNegative()) {
if (this.eq(v)) {
var b = f(a);
var c = this.div(b);
var d = c.mul(b).sub(this);
return c.toString(a) + d.toInt().toString(a);
}
return "-" + this.neg().toString(a);
}
var e = f(h(a, 6), this.unsigned);
var g = this;
var i = "";
while (true) {
var j = g.div(e);
var k = (g.sub(j.mul(e)).toInt() >>> 0).toString(a);
if ((g = j).isZero()) {
return k + i;
}
while (k.length < 6) {
k = "0" + k;
}
i = "" + k + i;
}
};
w.getHighBits = function () {
return this.high;
};
w.getHighBitsUnsigned = function () {
return this.high >>> 0;
};
w.getLowBits = function () {
return this.low;
};
w.getLowBitsUnsigned = function () {
return this.low >>> 0;
};
w.getNumBitsAbs = function () {
if (this.isNegative()) {
if (this.eq(v)) {
return 64;
} else {
return this.neg().getNumBitsAbs();
}
}
for (var a = this.high != 0 ? this.high : this.low, b = 31; b > 0 && (a & 1 << b) == 0; b--);
if (this.high != 0) {
return b + 33;
} else {
return b + 1;
}
};
w.isZero = function () {
return this.high === 0 && this.low === 0;
};
w.isNegative = function () {
return !this.unsigned && this.high < 0;
};
w.isPositive = function () {
return this.unsigned || this.high >= 0;
};
w.isOdd = function () {
return (this.low & 1) == 1;
};
w.isEven = function () {
return (this.low & 1) == 0;
};
w.equals = function (a) {
if (!b(a)) {
a = j(a);
}
return (this.unsigned === a.unsigned || this.high >>> 31 != 1 || a.high >>> 31 != 1) && this.high === a.high && this.low === a.low;
};
w.eq = w.equals;
w.notEquals = function (a) {
return !this.eq(a);
};
w.neq = w.notEquals;
w.lessThan = function (a) {
return this.comp(a) < 0;
};
w.lt = w.lessThan;
w.lessThanOrEqual = function (a) {
return this.comp(a) <= 0;
};
w.lte = w.lessThanOrEqual;
w.greaterThan = function (a) {
return this.comp(a) > 0;
};
w.gt = w.greaterThan;
w.greaterThanOrEqual = function (a) {
return this.comp(a) >= 0;
};
w.gte = w.greaterThanOrEqual;
w.compare = function (a) {
if (!b(a)) {
a = j(a);
}
if (this.eq(a)) {
return 0;
}
var c = this.isNegative();
var d = a.isNegative();
if (c && !d) {
return -1;
} else if (!c && d) {
return 1;
} else if (this.unsigned) {
if (a.high >>> 0 > this.high >>> 0 || a.high === this.high && a.low >>> 0 > this.low >>> 0) {
return -1;
} else {
return 1;
}
} else if (this.sub(a).isNegative()) {
return -1;
} else {
return 1;
}
};
w.comp = w.compare;
w.negate = function () {
if (!this.unsigned && this.eq(v)) {
return v;
} else {
return this.not().add(q);
}
};
w.neg = w.negate;
w.add = function (a) {
if (!b(a)) {
a = j(a);
}
var c = this.high >>> 16;
var d = this.high & 65535;
var e = this.low >>> 16;
var f = this.low & 65535;
var h = a.high >>> 16;
var i = a.high & 65535;
var k = a.low >>> 16;
var l = 0;
var m = 0;
var n = 0;
var o = 0;
n += (o += f + (a.low & 65535)) >>> 16;
m += (n += e + k) >>> 16;
l += (m += d + i) >>> 16;
l += c + h;
return g((n &= 65535) << 16 | (o &= 65535), (l &= 65535) << 16 | (m &= 65535), this.unsigned);
};
w.subtract = function (a) {
if (!b(a)) {
a = j(a);
}
return this.add(a.neg());
};
w.sub = w.subtract;
w.multiply = function (a) {
if (this.isZero()) {
return o;
}
if (!b(a)) {
a = j(a);
}
if (a.isZero()) {
return o;
}
if (this.eq(v)) {
if (a.isOdd()) {
return v;
} else {
return o;
}
}
if (a.eq(v)) {
if (this.isOdd()) {
return v;
} else {
return o;
}
}
if (this.isNegative()) {
if (a.isNegative()) {
return this.neg().mul(a.neg());
} else {
return this.neg().mul(a).neg();
}
}
if (a.isNegative()) {
return this.mul(a.neg()).neg();
}
if (this.lt(n) && a.lt(n)) {
return f(this.toNumber() * a.toNumber(), this.unsigned);
}
var c = this.high >>> 16;
var d = this.high & 65535;
var e = this.low >>> 16;
var h = this.low & 65535;
var i = a.high >>> 16;
var k = a.high & 65535;
var l = a.low >>> 16;
var m = a.low & 65535;
var p = 0;
var q = 0;
var r = 0;
var s = 0;
r += (s += h * m) >>> 16;
q += (r += e * m) >>> 16;
r &= 65535;
q += (r += h * l) >>> 16;
p += (q += d * m) >>> 16;
q &= 65535;
p += (q += e * l) >>> 16;
q &= 65535;
p += (q += h * k) >>> 16;
p += c * m + d * l + e * k + h * i;
return g((r &= 65535) << 16 | (s &= 65535), (p &= 65535) << 16 | (q &= 65535), this.unsigned);
};
w.mul = w.multiply;
w.divide = function (a) {
if (!b(a)) {
a = j(a);
}
if (a.isZero()) {
throw Error("division by zero");
}
if (this.isZero()) {
if (this.unsigned) {
return p;
} else {
return o;
}
}
var c;
var d;
var e;
if (this.unsigned) {
if (!a.unsigned) {
a = a.toUnsigned();
}
if (a.gt(this)) {
return p;
}
if (a.gt(this.shru(1))) {
return r;
}
e = p;
} else {
if (this.eq(v)) {
if (a.eq(q) || a.eq(s)) {
return v;
} else if (a.eq(v)) {
return q;
} else if ((c = this.shr(1).div(a).shl(1)).eq(o)) {
if (a.isNegative()) {
return q;
} else {
return s;
}
} else {
d = this.sub(a.mul(c));
return e = c.add(d.div(a));
}
}
if (a.eq(v)) {
if (this.unsigned) {
return p;
} else {
return o;
}
}
if (this.isNegative()) {
if (a.isNegative()) {
return this.neg().div(a.neg());
} else {
return this.neg().div(a).neg();
}
}
if (a.isNegative()) {
return this.div(a.neg()).neg();
}
e = o;
}
for (d = this; d.gte(a);) {
c = Math.max(1, Math.floor(d.toNumber() / a.toNumber()));
for (var g = Math.ceil(Math.log(c) / Math.LN2), i = g <= 48 ? 1 : h(2, g - 48), k = f(c), l = k.mul(a); l.isNegative() || l.gt(d);) {
l = (k = f(c -= i, this.unsigned)).mul(a);
}
if (k.isZero()) {
k = q;
}
e = e.add(k);
d = d.sub(l);
}
return e;
};
w.div = w.divide;
w.modulo = function (a) {
if (!b(a)) {
a = j(a);
}
return this.sub(this.div(a).mul(a));
};
w.mod = w.modulo;
w.not = function () {
return g(~this.low, ~this.high, this.unsigned);
};
w.and = function (a) {
if (!b(a)) {
a = j(a);
}
return g(this.low & a.low, this.high & a.high, this.unsigned);
};
w.or = function (a) {
if (!b(a)) {
a = j(a);
}
return g(this.low | a.low, this.high | a.high, this.unsigned);
};
w.xor = function (a) {
if (!b(a)) {
a = j(a);
}
return g(this.low ^ a.low, this.high ^ a.high, this.unsigned);
};
w.shiftLeft = function (a) {
if (b(a)) {
a = a.toInt();
}
if ((a &= 63) == 0) {
return this;
} else if (a < 32) {
return g(this.low << a, this.high << a | this.low >>> 32 - a, this.unsigned);
} else {
return g(0, this.low << a - 32, this.unsigned);
}
};
w.shl = w.shiftLeft;
w.shiftRight = function (a) {
if (b(a)) {
a = a.toInt();
}
if ((a &= 63) == 0) {
return this;
} else if (a < 32) {
return g(this.low >>> a | this.high << 32 - a, this.high >> a, this.unsigned);
} else {
return g(this.high >> a - 32, this.high >= 0 ? 0 : -1, this.unsigned);
}
};
w.shr = w.shiftRight;
w.shiftRightUnsigned = function (a) {
if (b(a)) {
a = a.toInt();
}
if ((a &= 63) == 0) {
return this;
}
var c = this.high;
if (a < 32) {
return g(this.low >>> a | c << 32 - a, c >>> a, this.unsigned);
} else {
return g(a === 32 ? c : c >>> a - 32, 0, this.unsigned);
}
};
w.shru = w.shiftRightUnsigned;
w.toSigned = function () {
if (this.unsigned) {
return g(this.low, this.high, false);
} else {
return this;
}
};
w.toUnsigned = function () {
if (this.unsigned) {
return this;
} else {
return g(this.low, this.high, true);
}
};
w.toBytes = function (a) {
if (a) {
return this.toBytesLE();
} else {
return this.toBytesBE();
}
};
w.toBytesLE = function () {
var a = this.high;
var b = this.low;
return [b & 255, b >>> 8 & 255, b >>> 16 & 255, b >>> 24 & 255, a & 255, a >>> 8 & 255, a >>> 16 & 255, a >>> 24 & 255];
};
w.toBytesBE = function () {
var a = this.high;
var b = this.low;
return [a >>> 24 & 255, a >>> 16 & 255, a >>> 8 & 255, a & 255, b >>> 24 & 255, b >>> 16 & 255, b >>> 8 & 255, b & 255];
};
return a;
}) == "function" ? c.apply(b, []) : c) !== undefined) {
a.exports = d;
}
},
418: a => {
'use strict';
var b = Object.getOwnPropertySymbols;
var c = Object.prototype.hasOwnProperty;
var d = Object.prototype.propertyIsEnumerable;
a.exports = function () {
try {
if (!Object.assign) {
return false;
}
var a = new String("abc");
a[5] = "de";
if (Object.getOwnPropertyNames(a)[0] === "5") {
return false;
}
for (var b = {}, c = 0; c < 10; c++) {
b["_" + String.fromCharCode(c)] = c;
}
if (Object.getOwnPropertyNames(b).map(function (a) {
return b[a];
}).join("") !== "0123456789") {
return false;
}
var d = {};
"abcdefghijklmnopqrst".split("").forEach(function (a) {
d[a] = a;
});
return Object.keys(Object.assign({}, d)).join("") === "abcdefghijklmnopqrst";
} catch (a) {
return false;
}
}() ? Object.assign : function (a, e) {
for (var f, g, h = function (a) {
if (a == null) {
throw new TypeError("Object.assign cannot be called with null or undefined");
}
return Object(a);
}(a), i = 1; i < arguments.length; i++) {
for (var j in f = Object(arguments[i])) {
if (c.call(f, j)) {
h[j] = f[j];
}
}
if (b) {
g = b(f);
for (var k = 0; k < g.length; k++) {
if (d.call(f, g[k])) {
h[g[k]] = f[g[k]];
}
}
}
}
return h;
};
},
631: (a, b, c) => {
var d = typeof Map == "function" && Map.prototype;
var e = Object.getOwnPropertyDescriptor && d ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null;
var f = d && e && typeof e.get == "function" ? e.get : null;
var g = d && Map.prototype.forEach;
var h = typeof Set == "function" && Set.prototype;
var i = Object.getOwnPropertyDescriptor && h ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null;
var j = h && i && typeof i.get == "function" ? i.get : null;
var k = h && Set.prototype.forEach;
var l = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap.prototype.has : null;
var m = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet.prototype.has : null;
var n = typeof WeakRef == "function" && WeakRef.prototype ? WeakRef.prototype.deref : null;
var o = Boolean.prototype.valueOf;
var p = Object.prototype.toString;
var q = Function.prototype.toString;
var r = String.prototype.match;
var s = String.prototype.slice;
var t = String.prototype.replace;
var u = String.prototype.toUpperCase;
var v = String.prototype.toLowerCase;
var w = RegExp.prototype.test;
var x = Array.prototype.concat;
var y = Array.prototype.join;
var z = Array.prototype.slice;
var A = Math.floor;
var B = typeof BigInt == "function" ? BigInt.prototype.valueOf : null;
var C = Object.getOwnPropertySymbols;
var D = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null;
var E = typeof Symbol == "function" && typeof Symbol.iterator == "object";
var F = typeof Symbol == "function" && Symbol.toStringTag && (Symbol.toStringTag, 1) ? Symbol.toStringTag : null;
var G = Object.prototype.propertyIsEnumerable;
var H = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function (a) {
return a.__proto__;
} : null);
function I(a, b) {
if (a === Infinity || a === -Infinity || a != a || a && a > -1000 && a < 1000 || w.call(/e/, b)) {
return b;
}
var c = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
if (typeof a == "number") {
var d = a < 0 ? -A(-a) : A(a);
if (d !== a) {
var e = String(d);
var f = s.call(b, e.length + 1);
return t.call(e, c, "$&_") + "." + t.call(t.call(f, /([0-9]{3})/g, "$&_"), /_$/, "");
}
}
return t.call(b, c, "$&_");
}
var J = c(654);
var K = J.custom;
var L = Q(K) ? K : null;
function M(a, b, c) {
var d = (c.quoteStyle || b) === "double" ? "\"" : "'";
return d + a + d;
}
function N(a) {
return t.call(String(a), /"/g, """);
}
function O(a) {
return T(a) === "[object Array]" && (!F || typeof a != "object" || !(F in a));
}
function P(a) {
return T(a) === "[object RegExp]" && (!F || typeof a != "object" || !(F in a));
}
function Q(a) {
if (E) {
return a && typeof a == "object" && a instanceof Symbol;
}
if (typeof a == "symbol") {
return true;
}
if (!a || typeof a != "object" || !D) {
return false;
}
try {
D.call(a);
return true;
} catch (a) {}
return false;
}
a.exports = function e(a, b, c, d) {
var h = b || {};
if (S(h, "quoteStyle") && h.quoteStyle !== "single" && h.quoteStyle !== "double") {
throw new TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
}
if (S(h, "maxStringLength") && (typeof h.maxStringLength == "number" ? h.maxStringLength < 0 && h.maxStringLength !== Infinity : h.maxStringLength !== null)) {
throw new TypeError("option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`");
}
var i = !S(h, "customInspect") || h.customInspect;
if (typeof i != "boolean" && i !== "symbol") {
throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
}
if (S(h, "indent") && h.indent !== null && h.indent !== "\t" && (parseInt(h.indent, 10) !== h.indent || h.indent <= 0)) {
throw new TypeError("option \"indent\" must be \"\\t\", an integer > 0, or `null`");
}
if (S(h, "numericSeparator") && typeof h.numericSeparator != "boolean") {
throw new TypeError("option \"numericSeparator\", if provided, must be `true` or `false`");
}
var p = h.numericSeparator;
if (a === undefined) {
return "undefined";
}
if (a === null) {
return "null";
}
if (typeof a == "boolean") {
if (a) {
return "true";
} else {
return "false";
}
}
if (typeof a == "string") {
return V(a, h);
}
if (typeof a == "number") {
if (a === 0) {
if (Infinity / a > 0) {
return "0";
} else {
return "-0";
}
}
var u = String(a);
if (p) {
return I(a, u);
} else {
return u;
}
}
if (typeof a == "bigint") {
var w = String(a) + "n";
if (p) {
return I(a, w);
} else {
return w;
}
}
var A = h.depth === undefined ? 5 : h.depth;
if (c === undefined) {
c = 0;
}
if (c >= A && A > 0 && typeof a == "object") {
if (O(a)) {
return "[Array]";
} else {
return "[Object]";
}
}
var C;
var K = function (a, b) {
var c;
if (a.indent === "\t") {
c = "\t";
} else {
if (typeof a.indent != "number" || a.indent <= 0) {
return null;
}
c = y.call(Array(a.indent + 1), " ");
}
return {
base: c,
prev: y.call(Array(b + 1), c)
};
}(h, c);
if (d === undefined) {
d = [];
} else if (U(d, a) >= 0) {
return "[Circular]";
}
function R(a, b, f) {
if (b) {
(d = z.call(d)).push(b);
}
if (f) {
var g = {
depth: h.depth
};
if (S(h, "quoteStyle")) {
g.quoteStyle = h.quoteStyle;
}
return e(a, g, c + 1, d);
}
return e(a, h, c + 1, d);
}
if (typeof a == "function" && !P(a)) {
var W = function (a) {
if (a.name) {
return a.name;
}
var b = r.call(q.call(a), /^function\s*([\w$]+)/);
if (b) {
return b[1];
} else {
return null;
}
}(a);
var aa = _(a, R);
return "[Function" + (W ? ": " + W : " (anonymous)") + "]" + (aa.length > 0 ? " { " + y.call(aa, ", ") + " }" : "");
}
if (Q(a)) {
var ba = E ? t.call(String(a), /^(Symbol\(.*\))_[^)]*$/, "$1") : D.call(a);
if (typeof a != "object" || E) {
return ba;
} else {
return X(ba);
}
}
if ((C = a) && typeof C == "object" && (typeof HTMLElement != "undefined" && C instanceof HTMLElement || typeof C.nodeName == "string" && typeof C.getAttribute == "function")) {
for (var ca = "<" + v.call(String(a.nodeName)), da = a.attributes || [], ea = 0; ea < da.length; ea++) {
ca += " " + da[ea].name + "=" + M(N(da[ea].value), "double", h);
}
ca += ">";
if (a.childNodes && a.childNodes.length) {
ca += "...";
}
return ca + "</" + v.call(String(a.nodeName)) + ">";
}
if (O(a)) {
if (a.length === 0) {
return "[]";
}
var fa = _(a, R);
if (K && ! function (a) {
for (var b = 0; b < a.length; b++) {
if (U(a[b], "\n") >= 0) {
return false;
}
}
return true;
}(fa)) {
return "[" + $(fa, K) + "]";
} else {
return "[ " + y.call(fa, ", ") + " ]";
}
}
if (function (a) {
return T(a) === "[object Error]" && (!F || typeof a != "object" || !(F in a));
}(a)) {
var ga = _(a, R);
if ("cause" in Error.prototype || !("cause" in a) || G.call(a, "cause")) {
if (ga.length === 0) {
return "[" + String(a) + "]";
} else {
return "{ [" + String(a) + "] " + y.call(ga, ", ") + " }";
}
} else {
return "{ [" + String(a) + "] " + y.call(x.call("[cause]: " + R(a.cause), ga), ", ") + " }";
}
}
if (typeof a == "object" && i) {
if (L && typeof a[L] == "function" && J) {
return J(a, {
depth: A - c
});
}
if (i !== "symbol" && typeof a.inspect == "function") {
return a.inspect();
}
}
if (function (a) {
if (!f || !a || typeof a != "object") {
return false;
}
try {
f.call(a);
try {
j.call(a);
} catch (a) {
return true;
}
return a instanceof Map;
} catch (a) {}
return false;
}(a)) {
var ha = [];
g.call(a, function (b, c) {
ha.push(R(c, a, true) + " => " + R(b, a));
});
return Z("Map", f.call(a), ha, K);
}
if (function (a) {
if (!j || !a || typeof a != "object") {
return false;
}
try {
j.call(a);
try {
f.call(a);
} catch (a) {
return true;
}
return a instanceof Set;
} catch (a) {}
return false;
}(a)) {
var ia = [];
k.call(a, function (b) {
ia.push(R(b, a));
});
return Z("Set", j.call(a), ia, K);
}
if (function (a) {
if (!l || !a || typeof a != "object") {
return false;
}
try {
l.call(a, l);
try {
m.call(a, m);
} catch (a) {
return true;
}
return a instanceof WeakMap;
} catch (a) {}
return false;
}(a)) {
return Y("WeakMap");
}
if (function (a) {
if (!m || !a || typeof a != "object") {
return false;
}
try {
m.call(a, m);
try {
l.call(a, l);
} catch (a) {
return true;
}
return a instanceof WeakSet;
} catch (a) {}
return false;
}(a)) {
return Y("WeakSet");
}
if (function (a) {
if (!n || !a || typeof a != "object") {
return false;
}
try {
n.call(a);
return true;
} catch (a) {}
return false;
}(a)) {
return Y("WeakRef");
}
if (function (a) {
return T(a) === "[object Number]" && (!F || typeof a != "object" || !(F in a));
}(a)) {
return X(R(Number(a)));
}
if (function (a) {
if (!a || typeof a != "object" || !B) {
return false;
}
try {
B.call(a);
return true;
} catch (a) {}
return false;
}(a)) {
return X(R(B.call(a)));
}
if (function (a) {
return T(a) === "[object Boolean]" && (!F || typeof a != "object" || !(F in a));
}(a)) {
return X(o.call(a));
}
if (function (a) {
return T(a) === "[object String]" && (!F || typeof a != "object" || !(F in a));
}(a)) {
return X(R(String(a)));
}
if (! function (a) {
return T(a) === "[object Date]" && (!F || typeof a != "object" || !(F in a));
}(a) && !P(a)) {
var ja = _(a, R);
var ka = H ? H(a) === Object.prototype : a instanceof Object || a.constructor === Object;
var la = a instanceof Object ? "" : "null prototype";
var ma = !ka && F && Object(a) === a && F in a ? s.call(T(a), 8, -1) : la ? "Object" : "";
var na = (ka || typeof a.constructor != "function" ? "" : a.constructor.name ? a.constructor.name + " " : "") + (ma || la ? "[" + y.call(x.call([], ma || [], la || []), ": ") + "] " : "");
if (ja.length === 0) {
return na + "{}";
} else if (K) {
return na + "{" + $(ja, K) + "}";
} else {
return na + "{ " + y.call(ja, ", ") + " }";
}
}
return String(a);
};
var R = Object.prototype.hasOwnProperty || function (a) {
return a in this;
};
function S(a, b) {
return R.call(a, b);
}
function T(a) {
return p.call(a);
}
function U(a, b) {
if (a.indexOf) {
return a.indexOf(b);
}
for (var c = 0, d = a.length; c < d; c++) {
if (a[c] === b) {
return c;
}
}
return -1;
}
function V(a, b) {
if (a.length > b.maxStringLength) {
var c = a.length - b.maxStringLength;
var d = "... " + c + " more character" + (c > 1 ? "s" : "");
return V(s.call(a, 0, b.maxStringLength), b) + d;
}
return M(t.call(t.call(a, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, W), "single", b);
}
function W(a) {
var b = a.charCodeAt(0);
var c = {
8: "b",
9: "t",
10: "n",
12: "f",
13: "r"
} [b];
if (c) {
return "\\" + c;
} else {
return "\\x" + (b < 16 ? "0" : "") + u.call(b.toString(16));
}
}
function X(a) {
return "Object(" + a + ")";
}
function Y(a) {
return a + " { ? }";
}
function Z(a, b, c, d) {
return a + " (" + b + ") {" + (d ? $(c, d) : y.call(c, ", ")) + "}";
}
function $(a, b) {
if (a.length === 0) {
return "";
}
var c = "\n" + b.prev + b.base;
return c + y.call(a, "," + c) + "\n" + b.prev;
}
function _(a, b) {
var c = O(a);
var d = [];
if (c) {
d.length = a.length;
for (var e = 0; e < a.length; e++) {
d[e] = S(a, e) ? b(a[e], a) : "";
}
}
var f;
var g = typeof C == "function" ? C(a) : [];
if (E) {
f = {};
for (var h = 0; h < g.length; h++) {
f["$" + g[h]] = g[h];
}
}
for (var i in a) {
if (S(a, i)) {
if ((!c || String(Number(i)) !== i || i >= a.length) && (!E || !(f["$" + i] instanceof Symbol))) {
if (w.call(/[^\w$]/, i)) {
d.push(b(i, a) + ": " + b(a[i], a));
} else {
d.push(i + ": " + b(a[i], a));
}
}
}
}
if (typeof C == "function") {
for (var j = 0; j < g.length; j++) {
if (G.call(a, g[j])) {
d.push("[" + b(g[j]) + "]: " + b(a[g[j]], a));
}
}
}
return d;
}
},
478: (a, b, c) => {
'use strict';
var d = c(210);
var e = c(924);
var f = c(631);
var g = d("%TypeError%");
var h = d("%WeakMap%", true);
var i = d("%Map%", true);
var j = e("WeakMap.prototype.get", true);
var k = e("WeakMap.prototype.set", true);
var l = e("WeakMap.prototype.has", true);
var m = e("Map.prototype.get", true);
var n = e("Map.prototype.set", true);
var o = e("Map.prototype.has", true);
function p(a, b) {
for (var c, d = a;
(c = d.next) !== null; d = c) {
if (c.key === b) {
d.next = c.next;
c.next = a.next;
a.next = c;
return c;
}
}
}
a.exports = function () {
var a;
var b;
var c;
var d = {
assert: function (a) {
if (!d.has(a)) {
throw new g("Side channel does not contain " + f(a));
}
},
get: function (d) {
if (h && d && (typeof d == "object" || typeof d == "function")) {
if (a) {
return j(a, d);
}
} else if (i) {
if (b) {
return m(b, d);
}
} else if (c) {
return function (a, b) {
var c = p(a, b);
return c && c.value;
}(c, d);
}
},
has: function (d) {
if (h && d && (typeof d == "object" || typeof d == "function")) {
if (a) {
return l(a, d);
}
} else if (i) {
if (b) {
return o(b, d);
}
} else if (c) {
return function (a, b) {
return !!p(a, b);
}(c, d);
}
return false;
},
set: function (d, e) {
if (h && d && (typeof d == "object" || typeof d == "function")) {
a ||= new h();
k(a, d, e);
} else if (i) {
b ||= new i();
n(b, d, e);
} else {
c ||= {
key: {},
next: null
};
(function (a, b, c) {
var d = p(a, b);
if (d) {
d.value = c;
} else {
a.next = {
key: b,
next: a.next,
value: c
};
}
})(c, d, e);
}
}
};
return d;
};
},
511: function (a, b, c) {
var d;
a = c.nmd(a);
(function (e) {
if (b) {
b.nodeType;
}
if (a) {
a.nodeType;
}
var f = typeof c.g == "object" && c.g;
if (f.global !== f && f.window !== f) {
f.self;
}
var g;
var h = 2147483647;
var i = 36;
var j = 26;
var k = 38;
var l = 700;
var m = /^xn--/;
var n = /[^\x20-\x7E]/;
var o = /[\x2E\u3002\uFF0E\uFF61]/g;
var p = {
overflow: "Overflow: input needs wider integers to process",
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
"invalid-input": "Invalid input"
};
var q = i - 1;
var r = Math.floor;
var s = String.fromCharCode;
function t(a) {
throw new RangeError(p[a]);
}
function u(a, b) {
for (var c = a.length, d = []; c--;) {
d[c] = b(a[c]);
}
return d;
}
function v(a, b) {
var c = a.split("@");
var d = "";
if (c.length > 1) {
d = c[0] + "@";
a = c[1];
}
return d + u((a = a.replace(o, ".")).split("."), b).join(".");
}
function w(a) {
for (var b, c, d = [], e = 0, f = a.length; e < f;) {
if ((b = a.charCodeAt(e++)) >= 55296 && b <= 56319 && e < f) {
if (((c = a.charCodeAt(e++)) & 64512) == 56320) {
d.push(((b & 1023) << 10) + (c & 1023) + 65536);
} else {
d.push(b);
e--;
}
} else {
d.push(b);
}
}
return d;
}
function x(a) {
return u(a, function (a) {
var b = "";
if (a > 65535) {
b += s((a -= 65536) >>> 10 & 1023 | 55296);
a = a & 1023 | 56320;
}
return b + s(a);
}).join("");
}
function y(a, b) {
return a + 22 + (a < 26) * 75 - ((b != 0) << 5);
}
function z(a, b, c) {
var d = 0;
a = c ? r(a / l) : a >> 1;
a += r(a / b);
for (; a > q * j >> 1; d += i) {
a = r(a / q);
}
return r(d + (q + 1) * a / (a + k));
}
function A(a) {
var b;
var c;
var d;
var e;
var f;
var g;
var k;
var l;
var m;
var n;
var o;
var p = [];
var q = a.length;
var s = 0;
var u = 128;
var v = 72;
if ((c = a.lastIndexOf("-")) < 0) {
c = 0;
}
d = 0;
for (; d < c; ++d) {
if (a.charCodeAt(d) >= 128) {
t("not-basic");
}
p.push(a.charCodeAt(d));
}
for (e = c > 0 ? c + 1 : 0; e < q;) {
f = s;
g = 1;
k = i;
for (; e >= q && t("invalid-input"), ((l = (o = a.charCodeAt(e++)) - 48 < 10 ? o - 22 : o - 65 < 26 ? o - 65 : o - 97 < 26 ? o - 97 : i) >= i || l > r((h - s) / g)) && t("overflow"), s += l * g, l >= (m = k <= v ? 1 : k >= v + j ? j : k - v); k += i) {
if (g > r(h / (n = i - m))) {
t("overflow");
}
g *= n;
}
v = z(s - f, b = p.length + 1, f == 0);
if (r(s / b) > h - u) {
t("overflow");
}
u += r(s / b);
s %= b;
p.splice(s++, 0, u);
}
return x(p);
}
function B(a) {
var b;
var c;
var d;
var e;
var f;
var g;
var k;
var l;
var m;
var n;
var o;
var p;
var q;
var u;
var v;
var x = [];
p = (a = w(a)).length;
b = 128;
c = 0;
f = 72;
g = 0;
for (; g < p; ++g) {
if ((o = a[g]) < 128) {
x.push(s(o));
}
}
d = e = x.length;
if (e) {
x.push("-");
}
while (d < p) {
k = h;
g = 0;
for (; g < p; ++g) {
if ((o = a[g]) >= b && o < k) {
k = o;
}
}
if (k - b > r((h - c) / (q = d + 1))) {
t("overflow");
}
c += (k - b) * q;
b = k;
g = 0;
for (; g < p; ++g) {
if ((o = a[g]) < b && ++c > h) {
t("overflow");
}
if (o == b) {
l = c;
m = i;
for (; l >= (n = m <= f ? 1 : m >= f + j ? j : m - f); m += i) {
v = l - n;
u = i - n;
x.push(s(y(n + v % u, 0)));
l = r(v / u);
}
x.push(s(y(l, 0)));
f = z(c, q, d == e);
c = 0;
++d;
}
}
++c;
++b;
}
return x.join("");
}
g = {
version: "1.4.1",
ucs2: {
decode: w,
encode: x
},
decode: A,
encode: B,
toASCII: function (a) {
return v(a, function (a) {
if (n.test(a)) {
return "xn--" + B(a);
} else {
return a;
}
});
},
toUnicode: function (a) {
return v(a, function (a) {
if (m.test(a)) {
return A(a.slice(4).toLowerCase());
} else {
return a;
}
});
}
};
if ((d = function () {
return g;
}.call(b, c, b, a)) !== undefined) {
a.exports = d;
}
})();
},
532: a => {
'use strict';
var b = String.prototype.replace;
var c = /%20/g;
var d = "RFC3986";
a.exports = {
default: d,
formatters: {
RFC1738: function (a) {
return b.call(a, c, "+");
},
RFC3986: function (a) {
return String(a);
}
},
RFC1738: "RFC1738",
RFC3986: d
};
},
984: (a, b, c) => {
'use strict';
var d = c(730);
var e = c(325);
var f = c(532);
a.exports = {
formats: f,
parse: e,
stringify: d
};
},
325: (a, b, c) => {
'use strict';
var d = c(368);
var e = Object.prototype.hasOwnProperty;
var f = Array.isArray;
var g = {
allowDots: false,
allowPrototypes: false,
allowSparse: false,
arrayLimit: 20,
charset: "utf-8",
charsetSentinel: false,
comma: false,
decoder: d.decode,
delimiter: "&",
depth: 5,
ignoreQueryPrefix: false,
interpretNumericEntities: false,
parameterLimit: 1000,
parseArrays: true,
plainObjects: false,
strictNullHandling: false
};
function h(a) {
return a.replace(/&#(\d+);/g, function (a, b) {
return String.fromCharCode(parseInt(b, 10));
});
}
function i(a, b) {
if (a && typeof a == "string" && b.comma && a.indexOf(",") > -1) {
return a.split(",");
} else {
return a;
}
}
function j(a, b, c, d) {
if (a) {
var f = c.allowDots ? a.replace(/\.([^.[]+)/g, "[$1]") : a;
var g = /(\[[^[\]]*])/g;
var h = c.depth > 0 && /(\[[^[\]]*])/.exec(f);
var j = h ? f.slice(0, h.index) : f;
var k = [];
if (j) {
if (!c.plainObjects && e.call(Object.prototype, j) && !c.allowPrototypes) {
return;
}
k.push(j);
}
for (var l = 0; c.depth > 0 && (h = g.exec(f)) !== null && l < c.depth;) {
l += 1;
if (!c.plainObjects && e.call(Object.prototype, h[1].slice(1, -1)) && !c.allowPrototypes) {
return;
}
k.push(h[1]);
}
if (h) {
k.push("[" + f.slice(h.index) + "]");
}
return function (a, b, c, d) {
for (var e = d ? b : i(b, c), f = a.length - 1; f >= 0; --f) {
var g;
var h = a[f];
if (h === "[]" && c.parseArrays) {
g = [].concat(e);
} else {
g = c.plainObjects ? Object.create(null) : {};
var j = h.charAt(0) === "[" && h.charAt(h.length - 1) === "]" ? h.slice(1, -1) : h;
var k = parseInt(j, 10);
if (c.parseArrays || j !== "") {
if (!isNaN(k) && h !== j && String(k) === j && k >= 0 && c.parseArrays && k <= c.arrayLimit) {
(g = [])[k] = e;
} else if (j !== "__proto__") {
g[j] = e;
}
} else {
g = {
0: e
};
}
}
e = g;
}
return e;
}(k, b, c, d);
}
}
a.exports = function (a, b) {
var c = function (a) {
if (!a) {
return g;
}
if (a.decoder !== null && a.decoder !== undefined && typeof a.decoder != "function") {
throw new TypeError("Decoder has to be a function.");
}
if (a.charset !== undefined && a.charset !== "utf-8" && a.charset !== "iso-8859-1") {
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
}
var b = a.charset === undefined ? g.charset : a.charset;
return {
allowDots: a.allowDots === undefined ? g.allowDots : !!a.allowDots,
allowPrototypes: typeof a.allowPrototypes == "boolean" ? a.allowPrototypes : g.allowPrototypes,
allowSparse: typeof a.allowSparse == "boolean" ? a.allowSparse : g.allowSparse,
arrayLimit: typeof a.arrayLimit == "number" ? a.arrayLimit : g.arrayLimit,
charset: b,
charsetSentinel: typeof a.charsetSentinel == "boolean" ? a.charsetSentinel : g.charsetSentinel,
comma: typeof a.comma == "boolean" ? a.comma : g.comma,
decoder: typeof a.decoder == "function" ? a.decoder : g.decoder,
delimiter: typeof a.delimiter == "string" || d.isRegExp(a.delimiter) ? a.delimiter : g.delimiter,
depth: typeof a.depth == "number" || a.depth === false ? +a.depth : g.depth,
ignoreQueryPrefix: a.ignoreQueryPrefix === true,
interpretNumericEntities: typeof a.interpretNumericEntities == "boolean" ? a.interpretNumericEntities : g.interpretNumericEntities,
parameterLimit: typeof a.parameterLimit == "number" ? a.parameterLimit : g.parameterLimit,
parseArrays: a.parseArrays !== false,
plainObjects: typeof a.plainObjects == "boolean" ? a.plainObjects : g.plainObjects,
strictNullHandling: typeof a.strictNullHandling == "boolean" ? a.strictNullHandling : g.strictNullHandling
};
}(b);
if (a === "" || a == null) {
if (c.plainObjects) {
return Object.create(null);
} else {
return {};
}
}
for (var k = typeof a == "string" ? function (a, b) {
var c;
var j = {
"__proto__": null
};
var k = b.ignoreQueryPrefix ? a.replace(/^\?/, "") : a;
var l = b.parameterLimit === Infinity ? undefined : b.parameterLimit;
var m = k.split(b.delimiter, l);
var n = -1;
var o = b.charset;
if (b.charsetSentinel) {
for (c = 0; c < m.length; ++c) {
if (m[c].indexOf("utf8=") === 0) {
if (m[c] === "utf8=%E2%9C%93") {
o = "utf-8";
} else if (m[c] === "utf8=%26%2310003%3B") {
o = "iso-8859-1";
}
n = c;
c = m.length;
}
}
}
for (c = 0; c < m.length; ++c) {
if (c !== n) {
var p;
var q;
var r = m[c];
var s = r.indexOf("]=");
var t = s === -1 ? r.indexOf("=") : s + 1;
if (t === -1) {
p = b.decoder(r, g.decoder, o, "key");
q = b.strictNullHandling ? null : "";
} else {
p = b.decoder(r.slice(0, t), g.decoder, o, "key");
q = d.maybeMap(i(r.slice(t + 1), b), function (a) {
return b.decoder(a, g.decoder, o, "value");
});
}
if (q && b.interpretNumericEntities && o === "iso-8859-1") {
q = h(q);
}
if (r.indexOf("[]=") > -1) {
q = f(q) ? [q] : q;
}
if (e.call(j, p)) {
j[p] = d.combine(j[p], q);
} else {
j[p] = q;
}
}
}
return j;
}(a, c) : a, l = c.plainObjects ? Object.create(null) : {}, m = Object.keys(k), n = 0; n < m.length; ++n) {
var o = m[n];
var p = j(o, k[o], c, typeof a == "string");
l = d.merge(l, p, c);
}
if (c.allowSparse === true) {
return l;
} else {
return d.compact(l);
}
};
},
730: (a, b, c) => {
'use strict';
var d = c(478);
var e = c(368);
var f = c(532);
var g = Object.prototype.hasOwnProperty;
var h = {
brackets: function (a) {
return a + "[]";
},
comma: "comma",
indices: function (a, b) {
return a + "[" + b + "]";
},
repeat: function (a) {
return a;
}
};
var i = Array.isArray;
var j = Array.prototype.push;
function k(a, b) {
j.apply(a, i(b) ? b : [b]);
}
var l = Date.prototype.toISOString;
var m = f.default;
var n = {
addQueryPrefix: false,
allowDots: false,
charset: "utf-8",
charsetSentinel: false,
delimiter: "&",
encode: true,
encoder: e.encode,
encodeValuesOnly: false,
format: m,
formatter: f.formatters[m],
indices: false,
serializeDate: function (a) {
return l.call(a);
},
skipNulls: false,
strictNullHandling: false
};
var o = {};
var p = function w(a, b, c, f, g, h, j, l, m, p, q, r, s, t, u, v) {
for (var x, y = a, z = v, A = 0, B = false;
(z = z.get(o)) !== undefined && !B;) {
var C = z.get(a);
A += 1;
if (C !== undefined) {
if (C === A) {
throw new RangeError("Cyclic object value");
}
B = true;
}
if (z.get(o) === undefined) {
A = 0;
}
}
if (typeof l == "function") {
y = l(b, y);
} else if (y instanceof Date) {
y = q(y);
} else if (c === "comma" && i(y)) {
y = e.maybeMap(y, function (a) {
if (a instanceof Date) {
return q(a);
} else {
return a;
}
});
}
if (y === null) {
if (g) {
if (j && !t) {
return j(b, n.encoder, u, "key", r);
} else {
return b;
}
}
y = "";
}
if (typeof (x = y) == "string" || typeof x == "number" || typeof x == "boolean" || typeof x == "symbol" || typeof x == "bigint" || e.isBuffer(y)) {
if (j) {
return [s(t ? b : j(b, n.encoder, u, "key", r)) + "=" + s(j(y, n.encoder, u, "value", r))];
} else {
return [s(b) + "=" + s(String(y))];
}
}
var D;
var E = [];
if (y === undefined) {
return E;
}
if (c === "comma" && i(y)) {
if (t && j) {
y = e.maybeMap(y, j);
}
D = [{
value: y.length > 0 ? y.join(",") || null : undefined
}];
} else if (i(l)) {
D = l;
} else {
var F = Object.keys(y);
D = m ? F.sort(m) : F;
}
for (var G = f && i(y) && y.length === 1 ? b + "[]" : b, H = 0; H < D.length; ++H) {
var I = D[H];
var J = typeof I == "object" && I.value !== undefined ? I.value : y[I];
if (!h || J !== null) {
var K = i(y) ? typeof c == "function" ? c(G, I) : G : G + (p ? "." + I : "[" + I + "]");
v.set(a, A);
var L = d();
L.set(o, v);
k(E, w(J, K, c, f, g, h, c === "comma" && t && i(y) ? null : j, l, m, p, q, r, s, t, u, L));
}
}
return E;
};
a.exports = function (a, b) {
var c;
var e = a;
var j = function (a) {
if (!a) {
return n;
}
if (a.encoder !== null && a.encoder !== undefined && typeof a.encoder != "function") {
throw new TypeError("Encoder has to be a function.");
}
var b = a.charset || n.charset;
if (a.charset !== undefined && a.charset !== "utf-8" && a.charset !== "iso-8859-1") {
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
}
var c = f.default;
if (a.format !== undefined) {
if (!g.call(f.formatters, a.format)) {
throw new TypeError("Unknown format option provided.");
}
c = a.format;
}
var d = f.formatters[c];
var e = n.filter;
if (typeof a.filter == "function" || i(a.filter)) {
e = a.filter;
}
return {
addQueryPrefix: typeof a.addQueryPrefix == "boolean" ? a.addQueryPrefix : n.addQueryPrefix,
allowDots: a.allowDots === undefined ? n.allowDots : !!a.allowDots,
charset: b,
charsetSentinel: typeof a.charsetSentinel == "boolean" ? a.charsetSentinel : n.charsetSentinel,
delimiter: a.delimiter === undefined ? n.delimiter : a.delimiter,
encode: typeof a.encode == "boolean" ? a.encode : n.encode,
encoder: typeof a.encoder == "function" ? a.encoder : n.encoder,
encodeValuesOnly: typeof a.encodeValuesOnly == "boolean" ? a.encodeValuesOnly : n.encodeValuesOnly,
filter: e,
format: c,
formatter: d,
serializeDate: typeof a.serializeDate == "function" ? a.serializeDate : n.serializeDate,
skipNulls: typeof a.skipNulls == "boolean" ? a.skipNulls : n.skipNulls,
sort: typeof a.sort == "function" ? a.sort : null,
strictNullHandling: typeof a.strictNullHandling == "boolean" ? a.strictNullHandling : n.strictNullHandling
};
}(b);
if (typeof j.filter == "function") {
e = (0, j.filter)("", e);
} else if (i(j.filter)) {
c = j.filter;
}
var l;
var m = [];
if (typeof e != "object" || e === null) {
return "";
}
l = b && b.arrayFormat in h ? b.arrayFormat : b && "indices" in b ? b.indices ? "indices" : "repeat" : "indices";
var o = h[l];
if (b && "commaRoundTrip" in b && typeof b.commaRoundTrip != "boolean") {
throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
}
var q = o === "comma" && b && b.commaRoundTrip;
c ||= Object.keys(e);
if (j.sort) {
c.sort(j.sort);
}
for (var r = d(), s = 0; s < c.length; ++s) {
var t = c[s];
if (!j.skipNulls || e[t] !== null) {
k(m, p(e[t], t, o, q, j.strictNullHandling, j.skipNulls, j.encode ? j.encoder : null, j.filter, j.sort, j.allowDots, j.serializeDate, j.format, j.formatter, j.encodeValuesOnly, j.charset, r));
}
}
var u = m.join(j.delimiter);
var v = j.addQueryPrefix === true ? "?" : "";
if (j.charsetSentinel) {
if (j.charset === "iso-8859-1") {
v += "utf8=%26%2310003%3B&";
} else {
v += "utf8=%E2%9C%93&";
}
}
if (u.length > 0) {
return v + u;
} else {
return "";
}
};
},
368: (a, b, c) => {
'use strict';
var d = c(532);
var e = Object.prototype.hasOwnProperty;
var f = Array.isArray;
var g = function () {
for (var a = [], b = 0; b < 256; ++b) {
a.push("%" + ((b < 16 ? "0" : "") + b.toString(16)).toUpperCase());
}
return a;
}();
function h(a, b) {
for (var c = b && b.plainObjects ? Object.create(null) : {}, d = 0; d < a.length; ++d) {
if (a[d] !== undefined) {
c[d] = a[d];
}
}
return c;
}
a.exports = {
arrayToObject: h,
assign: function (a, b) {
return Object.keys(b).reduce(function (a, c) {
a[c] = b[c];
return a;
}, a);
},
combine: function (a, b) {
return [].concat(a, b);
},
compact: function (a) {
for (var b = [{
obj: {
o: a
},
prop: "o"
}], c = [], d = 0; d < b.length; ++d) {
for (var e = b[d], g = e.obj[e.prop], h = Object.keys(g), i = 0; i < h.length; ++i) {
var j = h[i];
var k = g[j];
if (typeof k == "object" && k !== null && c.indexOf(k) === -1) {
b.push({
obj: g,
prop: j
});
c.push(k);
}
}
}
(function (a) {
while (a.length > 1) {
var b = a.pop();
var c = b.obj[b.prop];
if (f(c)) {
for (var d = [], e = 0; e < c.length; ++e) {
if (c[e] !== undefined) {
d.push(c[e]);
}
}
b.obj[b.prop] = d;
}
}
})(b);
return a;
},
decode: function (a, b, c) {
var d = a.replace(/\+/g, " ");
if (c === "iso-8859-1") {
return d.replace(/%[0-9a-f]{2}/gi, unescape);
}
try {
return decodeURIComponent(d);
} catch (a) {
return d;
}
},
encode: function (a, b, c, e, f) {
if (a.length === 0) {
return a;
}
var h = a;
if (typeof a == "symbol") {
h = Symbol.prototype.toString.call(a);
} else if (typeof a != "string") {
h = String(a);
}
if (c === "iso-8859-1") {
return escape(h).replace(/%u[0-9a-f]{4}/gi, function (a) {
return "%26%23" + parseInt(a.slice(2), 16) + "%3B";
});
}
for (var i = "", j = 0; j < h.length; ++j) {
var k = h.charCodeAt(j);
if (k === 45 || k === 46 || k === 95 || k === 126 || k >= 48 && k <= 57 || k >= 65 && k <= 90 || k >= 97 && k <= 122 || f === d.RFC1738 && (k === 40 || k === 41)) {
i += h.charAt(j);
} else if (k < 128) {
i += g[k];
} else if (k < 2048) {
i += g[k >> 6 | 192] + g[k & 63 | 128];
} else if (k < 55296 || k >= 57344) {
i += g[k >> 12 | 224] + g[k >> 6 & 63 | 128] + g[k & 63 | 128];
} else {
j += 1;
k = 65536 + ((k & 1023) << 10 | h.charCodeAt(j) & 1023);
i += g[k >> 18 | 240] + g[k >> 12 & 63 | 128] + g[k >> 6 & 63 | 128] + g[k & 63 | 128];
}
}
return i;
},
isBuffer: function (a) {
return !!a && typeof a == "object" && !!a.constructor && !!a.constructor.isBuffer && !!a.constructor.isBuffer(a);
},
isRegExp: function (a) {
return Object.prototype.toString.call(a) === "[object RegExp]";
},
maybeMap: function (a, b) {
if (f(a)) {
for (var c = [], d = 0; d < a.length; d += 1) {
c.push(b(a[d]));
}
return c;
}
return b(a);
},
merge: function d(a, b, c) {
if (!b) {
return a;
}
if (typeof b != "object") {
if (f(a)) {
a.push(b);
} else {
if (!a || typeof a != "object") {
return [a, b];
}
if (c && (c.plainObjects || c.allowPrototypes) || !e.call(Object.prototype, b)) {
a[b] = true;
}
}
return a;
}
if (!a || typeof a != "object") {
return [a].concat(b);
}
var g = a;
if (f(a) && !f(b)) {
g = h(a, c);
}
if (f(a) && f(b)) {
b.forEach(function (b, f) {
if (e.call(a, f)) {
var g = a[f];
if (g && typeof g == "object" && b && typeof b == "object") {
a[f] = d(g, b, c);
} else {
a.push(b);
}
} else {
a[f] = b;
}
});
return a;
} else {
return Object.keys(b).reduce(function (a, f) {
var g = b[f];
if (e.call(a, f)) {
a[f] = d(a[f], g, c);
} else {
a[f] = g;
}
return a;
}, g);
}
}
};
},
575: (a, b, c) => {
'use strict';
var d = c(511);
function e() {
this.protocol = null;
this.slashes = null;
this.auth = null;
this.host = null;
this.port = null;
this.hostname = null;
this.hash = null;
this.search = null;
this.query = null;
this.pathname = null;
this.path = null;
this.href = null;
}
var f = /^([a-z0-9.+-]+:)/i;
var g = /:[0-9]*$/;
var h = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/;
var i = ["{", "}", "|", "\\", "^", "`"].concat(["<", ">", "\"", "`", " ", "\r", "\n", "\t"]);
var j = ["'"].concat(i);
var k = ["%", "/", "?", ";", "#"].concat(j);
var l = ["/", "?", "#"];
var m = /^[+a-z0-9A-Z_-]{0,63}$/;
var n = /^([+a-z0-9A-Z_-]{0,63})(.*)$/;
var o = {
javascript: true,
"javascript:": true
};
var p = {
javascript: true,
"javascript:": true
};
var q = {
http: true,
https: true,
ftp: true,
gopher: true,
file: true,
"http:": true,
"https:": true,
"ftp:": true,
"gopher:": true,
"file:": true
};
var r = c(984);
function s(a, b, c) {
if (a && typeof a == "object" && a instanceof e) {
return a;
}
var d = new e();
d.parse(a, b, c);
return d;
}
e.prototype.parse = function (a, b, c) {
if (typeof a != "string") {
throw new TypeError("Parameter 'url' must be a string, not " + typeof a);
}
var e = a.indexOf("?");
var g = e !== -1 && e < a.indexOf("#") ? "?" : "#";
var i = a.split(g);
i[0] = i[0].replace(/\\/g, "/");
var s = a = i.join(g);
s = s.trim();
if (!c && a.split("#").length === 1) {
var t = h.exec(s);
if (t) {
this.path = s;
this.href = s;
this.pathname = t[1];
if (t[2]) {
this.search = t[2];
this.query = b ? r.parse(this.search.substr(1)) : this.search.substr(1);
} else if (b) {
this.search = "";
this.query = {};
}
return this;
}
}
var u = f.exec(s);
if (u) {
var v = (u = u[0]).toLowerCase();
this.protocol = v;
s = s.substr(u.length);
}
if (c || u || s.match(/^\/\/[^@/]+@[^@/]+/)) {
var w = s.substr(0, 2) === "//";
if (!!w && (!u || !p[u])) {
s = s.substr(2);
this.slashes = true;
}
}
if (!p[u] && (w || u && !q[u])) {
for (var x, y, z = -1, A = 0; A < l.length; A++) {
if ((B = s.indexOf(l[A])) !== -1 && (z === -1 || B < z)) {
z = B;
}
}
if ((y = z === -1 ? s.lastIndexOf("@") : s.lastIndexOf("@", z)) !== -1) {
x = s.slice(0, y);
s = s.slice(y + 1);
this.auth = decodeURIComponent(x);
}
z = -1;
A = 0;
for (; A < k.length; A++) {
var B;
if ((B = s.indexOf(k[A])) !== -1 && (z === -1 || B < z)) {
z = B;
}
}
if (z === -1) {
z = s.length;
}
this.host = s.slice(0, z);
s = s.slice(z);
this.parseHost();
this.hostname = this.hostname || "";
var C = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
if (!C) {
for (var D = this.hostname.split(/\./), E = (A = 0, D.length); A < E; A++) {
var F = D[A];
if (F && !F.match(m)) {
for (var G = "", H = 0, I = F.length; H < I; H++) {
if (F.charCodeAt(H) > 127) {
G += "x";
} else {
G += F[H];
}
}
if (!G.match(m)) {
var J = D.slice(0, A);
var K = D.slice(A + 1);
var L = F.match(n);
if (L) {
J.push(L[1]);
K.unshift(L[2]);
}
if (K.length) {
s = "/" + K.join(".") + s;
}
this.hostname = J.join(".");
break;
}
}
}
}
if (this.hostname.length > 255) {
this.hostname = "";
} else {
this.hostname = this.hostname.toLowerCase();
}
if (!C) {
this.hostname = d.toASCII(this.hostname);
}
var M = this.port ? ":" + this.port : "";
var N = this.hostname || "";
this.host = N + M;
this.href += this.host;
if (C) {
this.hostname = this.hostname.substr(1, this.hostname.length - 2);
if (s[0] !== "/") {
s = "/" + s;
}
}
}
if (!o[v]) {
A = 0;
E = j.length;
A = 0;
E = j.length;
for (; A < E; A++) {
var O = j[A];
if (s.indexOf(O) !== -1) {
var P = encodeURIComponent(O);
if (P === O) {
P = escape(O);
}
s = s.split(O).join(P);
}
}
}
var Q = s.indexOf("#");
if (Q !== -1) {
this.hash = s.substr(Q);
s = s.slice(0, Q);
}
var R = s.indexOf("?");
if (R !== -1) {
this.search = s.substr(R);
this.query = s.substr(R + 1);
if (b) {
this.query = r.parse(this.query);
}
s = s.slice(0, R);
} else if (b) {
this.search = "";
this.query = {};
}
if (s) {
this.pathname = s;
}
if (q[v] && this.hostname && !this.pathname) {
this.pathname = "/";
}
if (this.pathname || this.search) {
M = this.pathname || "";
var S = this.search || "";
this.path = M + S;
}
this.href = this.format();
return this;
};
e.prototype.format = function () {
var a = this.auth || "";
if (a) {
a = (a = encodeURIComponent(a)).replace(/%3A/i, ":");
a += "@";
}
var b = this.protocol || "";
var c = this.pathname || "";
var d = this.hash || "";
var e = false;
var f = "";
if (this.host) {
e = a + this.host;
} else if (this.hostname) {
e = a + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]");
if (this.port) {
e += ":" + this.port;
}
}
if (this.query && typeof this.query == "object" && Object.keys(this.query).length) {
f = r.stringify(this.query, {
arrayFormat: "repeat",
addQueryPrefix: false
});
}
var g = this.search || f && "?" + f || "";
if (b && b.substr(-1) !== ":") {
b += ":";
}
if (this.slashes || (!b || q[b]) && e !== false) {
e = "//" + (e || "");
if (c && c.charAt(0) !== "/") {
c = "/" + c;
}
} else {
e ||= "";
}
if (d && d.charAt(0) !== "#") {
d = "#" + d;
}
if (g && g.charAt(0) !== "?") {
g = "?" + g;
}
return b + e + (c = c.replace(/[?#]/g, function (a) {
return encodeURIComponent(a);
})) + (g = g.replace("#", "%23")) + d;
};
e.prototype.resolve = function (a) {
return this.resolveObject(s(a, false, true)).format();
};
e.prototype.resolveObject = function (a) {
if (typeof a == "string") {
var b = new e();
b.parse(a, false, true);
a = b;
}
for (var c = new e(), d = Object.keys(this), f = 0; f < d.length; f++) {
var g = d[f];
c[g] = this[g];
}
c.hash = a.hash;
if (a.href === "") {
c.href = c.format();
return c;
}
if (a.slashes && !a.protocol) {
for (var h = Object.keys(a), i = 0; i < h.length; i++) {
var j = h[i];
if (j !== "protocol") {
c[j] = a[j];
}
}
if (q[c.protocol] && c.hostname && !c.pathname) {
c.pathname = "/";
c.path = c.pathname;
}
c.href = c.format();
return c;
}
if (a.protocol && a.protocol !== c.protocol) {
if (!q[a.protocol]) {
for (var k = Object.keys(a), l = 0; l < k.length; l++) {
var m = k[l];
c[m] = a[m];
}
c.href = c.format();
return c;
}
c.protocol = a.protocol;
if (a.host || p[a.protocol]) {
c.pathname = a.pathname;
} else {
for (var n = (a.pathname || "").split("/"); n.length && !(a.host = n.shift()););
a.host ||= "";
a.hostname ||= "";
if (n[0] !== "") {
n.unshift("");
}
if (n.length < 2) {
n.unshift("");
}
c.pathname = n.join("/");
}
c.search = a.search;
c.query = a.query;
c.host = a.host || "";
c.auth = a.auth;
c.hostname = a.hostname || a.host;
c.port = a.port;
if (c.pathname || c.search) {
var o = c.pathname || "";
var r = c.search || "";
c.path = o + r;
}
c.slashes = c.slashes || a.slashes;
c.href = c.format();
return c;
}
var s = c.pathname && c.pathname.charAt(0) === "/";
var t = a.host || a.pathname && a.pathname.charAt(0) === "/";
var u = t || s || c.host && a.pathname;
var v = u;
var w = c.pathname && c.pathname.split("/") || [];
n = a.pathname && a.pathname.split("/") || [];
var x = c.protocol && !q[c.protocol];
if (x) {
c.hostname = "";
c.port = null;
if (c.host) {
if (w[0] === "") {
w[0] = c.host;
} else {
w.unshift(c.host);
}
}
c.host = "";
if (a.protocol) {
a.hostname = null;
a.port = null;
if (a.host) {
if (n[0] === "") {
n[0] = a.host;
} else {
n.unshift(a.host);
}
}
a.host = null;
}
u = u && (n[0] === "" || w[0] === "");
}
if (t) {
c.host = a.host || a.host === "" ? a.host : c.host;
c.hostname = a.hostname || a.hostname === "" ? a.hostname : c.hostname;
c.search = a.search;
c.query = a.query;
w = n;
} else if (n.length) {
w ||= [];
w.pop();
w = w.concat(n);
c.search = a.search;
c.query = a.query;
} else if (a.search != null) {
if (x) {
c.host = w.shift();
c.hostname = c.host;
if (C = !!c.host && c.host.indexOf("@") > 0 && c.host.split("@")) {
c.auth = C.shift();
c.hostname = C.shift();
c.host = c.hostname;
}
}
c.search = a.search;
c.query = a.query;
if (c.pathname !== null || c.search !== null) {
c.path = (c.pathname ? c.pathname : "") + (c.search ? c.search : "");
}
c.href = c.format();
return c;
}
if (!w.length) {
c.pathname = null;
if (c.search) {
c.path = "/" + c.search;
} else {
c.path = null;
}
c.href = c.format();
return c;
}
for (var y = w.slice(-1)[0], z = (c.host || a.host || w.length > 1) && (y === "." || y === "..") || y === "", A = 0, B = w.length; B >= 0; B--) {
if ((y = w[B]) === ".") {
w.splice(B, 1);
} else if (y === "..") {
w.splice(B, 1);
A++;
} else if (A) {
w.splice(B, 1);
A--;
}
}
if (!u && !v) {
for (; A--; A) {
w.unshift("..");
}
}
if (!!u && w[0] !== "" && (!w[0] || w[0].charAt(0) !== "/")) {
w.unshift("");
}
if (z && w.join("/").substr(-1) !== "/") {
w.push("");
}
var C;
var D = w[0] === "" || w[0] && w[0].charAt(0) === "/";
if (x) {
c.hostname = D ? "" : w.length ? w.shift() : "";
c.host = c.hostname;
if (C = !!c.host && c.host.indexOf("@") > 0 && c.host.split("@")) {
c.auth = C.shift();
c.hostname = C.shift();
c.host = c.hostname;
}
}
if ((u = u || c.host && w.length) && !D) {
w.unshift("");
}
if (w.length > 0) {
c.pathname = w.join("/");
} else {
c.pathname = null;
c.path = null;
}
if (c.pathname !== null || c.search !== null) {
c.path = (c.pathname ? c.pathname : "") + (c.search ? c.search : "");
}
c.auth = a.auth || c.auth;
c.slashes = c.slashes || a.slashes;
c.href = c.format();
return c;
};
e.prototype.parseHost = function () {
var a = this.host;
var b = g.exec(a);
if (b) {
if ((b = b[0]) !== ":") {
this.port = b.substr(1);
}
a = a.substr(0, a.length - b.length);
}
if (a) {
this.hostname = a;
}
};
b.Qc = s;
b.DB = function (a, b) {
return s(a, false, true).resolve(b);
};
b.WU = function (a) {
if (typeof a == "string") {
a = s(a);
}
if (a instanceof e) {
return a.format();
} else {
return e.prototype.format.call(a);
}
};
},
241: (a, b, c) => {
'use strict';
c.d(b, {
c: () => f
});
var d = c(911);
var e = c(42);
class f {
constructor() {
this.visible = false;
this.ticks = 0;
this.averageServerFrameTime = 0;
this.lastByteSizes = [];
}
init() {
document.body.insertAdjacentHTML("beforeend", "<div id=\"hud-debug-container\" class=\"hud-debug-container\"></div>");
this.stats = new e.j();
this.stats.domElement.addEventListener("mousedown", this.onMouseClick);
this.stats.domElement.style = "position: relative; transform: scale(1.5); transform-origin: 0 0; cursor:pointer; width: min-content;";
document.getElementById("hud-debug-container").appendChild(this.stats.domElement);
this.debugElem = document.createElement("div");
this.debugElem.id = "hud-debug";
this.debugElem.className = "hud-debug";
this.debugElem.style = "color:#ffffff;font-family:sans-serif;background-color:rgba(0,0,0,0.8); margin-top: 30px;";
document.getElementById("hud-debug-container").appendChild(this.debugElem);
this.debugElem.addEventListener("mousedown", this.onMouseClick);
d.l.eventEmitter.on("RendererUpdated", this.onRendererTick.bind(this));
d.l.eventEmitter.on("117Up", this.onKeyRelease.bind(this));
d.l.eventEmitter.on("EntityUpdate", this.onEntityUpdate.bind(this));
if (this.visible) {
this.show();
} else {
this.hide();
}
}
onEntityUpdate(a) {
this.averageServerFrameTime = a.averageServerFrameTime;
this.lastByteSize = a.byteSize;
this.lastByteSizes.push(this.lastByteSize);
if (this.lastByteSizes.length > 1000 / d.l.renderer.replicator.msPerTick) {
this.lastByteSizes.shift();
}
}
onMouseClick(a) {
a.stopPropagation();
a.preventDefault();
}
begin() {
if (this.stats && this.visible) {
this.stats.begin();
}
}
end() {
if (this.stats && this.visible) {
this.stats.end();
}
}
show() {
this.visible = true;
document.getElementById("hud-debug-container").style.display = "block";
}
hide() {
this.visible = false;
document.getElementById("hud-debug-container").style.display = "none";
}
onRendererTick() {
if (!this.visible) {
return;
}
if (this.ticks >= 20) {
this.ticks = 0;
}
this.ticks++;
if (this.ticks % 20 != 0) {
return;
}
const a = d.l.renderer.world.entities[d.l.renderer.world.localPlayer]?.targetTick;
this.debugElem.innerHTML = "\n Ping: " + d.l.network.getPing() + " ms<br>\n FPS: " + Math.round(d.l.renderer.replicator.getFps()) + "<br>\n X: " + a?.position.x + "<br>\n Y: " + a?.position.y + "<br>\n Server Uptime: " + Math.floor(d.l.renderer.replicator.getServerTime()).toLocaleString() + " ms<br>\n Entities shared with client: " + Object.keys(d.l.renderer.world.entities).length + "<br>\n Tick flow rate: " + Math.floor(d.l.network.entityUpdateTimeDelta) + " ms<br>\n Average server frame time: " + this.averageServerFrameTime + " ms<br>\n Last byte size: " + this.lastByteSize + " bytes (" + g(eval(this.lastByteSizes.join("+")), 3) + "b/sec)<br>\n Frame stutters: " + d.l.renderer.replicator.frameStutters + "<br>\n ";
}
onKeyRelease() {
if (this.visible) {
this.hide();
} else {
this.show();
}
}
}
const g = (a, b) => {
const c = ["k", "m", "g"];
b = Math.pow(10, b);
for (let d = c.length - 1; d >= 0; d--) {
const e = Math.pow(10, (d + 1) * 3);
if (e <= a) {
if ((a = Math.round(a * b / e) / b) == 1000 && d < c.length - 1) {
a = 1;
d++;
}
a += " " + c[d];
break;
}
}
return a;
};
},
911: (a, b, c) => {
'use strict';
c.d(b, {
l: () => Jj
});
class d {
constructor(a) {
this.element = a;
}
show() {
this.element.style.display = "block";
}
hide() {
this.element.style.display = "none";
}
isVisible() {
return window.getComputedStyle(this.element).display !== "none";
}
}
class e extends d {
constructor() {
super(document.getElementById("hud-intro"));
this.nameElem = this.element.querySelector(".hud-intro-name");
this.serversElem = this.element.querySelector(".hud-intro-servers");
this.playElem = this.element.querySelector(".hud-intro-play");
this.errorElem = this.element.querySelector(".hud-intro-error");
this.partyKey = "";
this.socketIntentionallyClosed = false;
window.addEventListener("load", this.onPageLoad.bind(this));
const a = ["tree", "stone"];
const b = Math.floor(Math.random() * 15) + 7;
for (let c = 0; c < b; c++) {
let b = document.createElement("span");
b.className = "hud-intro-" + a[Math.floor(Math.random() * a.length)] + "-" + (Math.floor(Math.random() * 2) + 1);
b.style = "top:" + Math.floor(Math.random() * 100) + "%;\n left: " + Math.floor(Math.random() * 100) + "%;\n transform: rotate(" + Math.floor(Math.random() * 360) + "deg);";
this.element.appendChild(b);
}
this.servers = JSON.parse(window.servers);
if (this.servers.length == 0) {
this.servers = [{
id: "v1001",
country: "Local",
city: "Local",
status: "Low"
}];
}
let c = {};
for (let a of this.servers) {
if (!(a.country in c)) {
c[a.country] = {};
}
c[a.country][a.id] = a;
}
for (let a in c) {
let b = document.createElement("optgroup");
b.label = a;
this.serversElem.appendChild(b);
let d = 1;
for (let e in c[a]) {
const f = document.createElement("option");
f.value = e;
const g = c[a][e];
f.textContent = a + " (" + g.city + ") #" + d++ + " [" + g.status + "]";
b.appendChild(f);
}
}
this.playElem.addEventListener("mouseup", this.connect.bind(this));
this.nameElem.addEventListener("keyup", a => {
if (a.key == "Enter") {
this.connect();
}
});
if (document.location.hash !== "") {
const [a, b] = document.location.hash.substring(2).split("/");
this.partyKey = b || "";
if (this.servers.find(b => b.id == a) !== undefined) {
this.serversElem.querySelector("option[value=" + a + "]").setAttribute("selected", "true");
}
}
if (window.storage.getItem("settings-preload") == null) {
window.storage.setItem("settings-preload", "true");
}
document.getElementsByClassName("hud-settings-preload")[0].checked = window.storage.getItem("settings-preload") === "true";
}
init() {
Jj.eventEmitter.on("SocketClosed", this.onSocketClosed.bind(this));
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorldResponse.bind(this));
}
connect() {
if (!this.playElem.classList.contains("disabled")) {
this.playElem.innerHTML = "<span class='hud-loading'></span>";
Jj.network.setConnectionData(this.nameElem.value, this.partyKey, this.servers.find(a => a.id == this.serversElem.value));
Jj.network.connect();
}
}
onPageLoad() {
this.nameElem.value = window.storage.getItem("displayName") || "";
}
onSocketClosed() {
if (this.socketIntentionallyClosed !== true) {
if (!Jj.getInWorld()) {
this.playElem.innerHTML = "Play";
this.serversElem.classList.add("has-error");
this.errorElem.style.display = "block";
this.errorElem.innerText = "You were not able to connect to this server for unknown reasons. Check your internet connection then try again.";
}
} else {
this.socketIntentionallyClosed = false;
}
}
onEnterWorldResponse(a) {
window.storage.setItem("displayName", a.name);
this.hide();
}
setFailure(a) {
this.socketIntentionallyClosed = true;
let b = "Unknown reason.";
if (a.reason) {
switch (a.reason) {
case "MaxPlayerCount":
b = "This server is currently full. Please try again later or select another server.";
break;
case "MaxIpLimit":
b = "You've reached the maximum number of tabs.";
}
}
this.playElem.innerHTML = "Play";
this.errorElem.innerText = b;
this.serversElem.classList.add("has-error");
this.errorElem.style.display = "block";
}
}
class f extends d {
constructor() {
super(document.getElementsByClassName("hud-intro-leaderboard")[0]);
this.leaderboardToggle = document.getElementsByClassName("hud-intro-leaderboard-toggle")[0];
this.leaderboardWrapper = this.element.querySelector(".hud-intro-leaderboard-wrapper");
this.categoryElem = this.element.querySelector(".hud-intro-leaderboard-category");
this.timeElem = this.element.querySelector(".hud-intro-leaderboard-time");
this.leaderboardToggle.addEventListener("click", () => {
this.element.classList.add("visible");
this.leaderboardToggle.style.display = "none";
});
this.element.querySelector(".hud-grid-exit").addEventListener("click", () => {
this.element.classList.remove("visible");
this.leaderboardToggle.style.display = "block";
});
this.categoryElem.addEventListener("change", this.requestLeaderboard.bind(this));
this.timeElem.addEventListener("change", this.requestLeaderboard.bind(this));
this.requestLeaderboard();
this.element.addEventListener("click", a => {
if (a.target == this.element) {
this.element.classList.remove("visible");
this.leaderboardToggle.style.display = "block";
}
});
}
requestLeaderboard() {
this.leaderboardWrapper.innerHTML = "<div class='hud-loading'></div>";
const a = new XMLHttpRequest();
a.open("GET", "http://zombia.io/leaderboard/data?category=" + this.categoryElem.value + "&time=" + this.timeElem.value);
a.onreadystatechange = () => {
if (a.readyState !== 4) {
return;
}
const b = JSON.parse(a.responseText);
if (b.length == 0) {
this.leaderboardWrapper.innerHTML = "<span>We couldn't find any entries with that query.</span>";
return;
}
let c = "<div class='hud-intro-leaderboard-results'>";
const d = new Intl.ListFormat("en", {
style: "long",
type: "conjunction"
});
for (let a = 0; a < b.length; a++) {
const e = b[a];
if (this.categoryElem.value == "wave") {
c += "<div class=\"hud-intro-leaderboard-result\"><strong style=\"float: left; font-style: italic;\">" + (a + 1) + "</strong><div>" + d.format(e.players) + " — <strong>" + e.wave.toLocaleString() + "</strong></div></div>";
} else if (this.categoryElem.value == "score") {
c += "<div class=\"hud-intro-leaderboard-result\"><strong style=\"float: left; font-style: italic;\">" + (a + 1) + "</strong><div>" + d.format(e.players) + " — <strong>" + e.score.toLocaleString() + "</strong></div></div>";
}
}
c += "</div>";
this.leaderboardWrapper.innerHTML = c;
};
a.send();
}
}
class g extends d {
constructor() {
let a = document.createElement("div");
a.className = "hud-reconnect";
document.getElementById("hud").appendChild(a);
super(a);
}
updateReconnectionText() {
this.element.innerHTML = "\n <div class=\"hud-reconnect-wrapper\">\n <div class=\"hud-reconnect-main\">\n <span class=\"hud-loading\"></span>\n <p>You've lost connection to the server.</p>\n <small>Not your internet? Report to the <a target=\"_blank\" href=\"https://discord.gg/4cxREnV4WE\">Discord server</a>.</small>\n <p style=\"position:absolute;bottom:0;left:50%;transform:translateX(-50%);\">Server ID: " + Jj.network.options.serverData.id + "</p>\n </div>\n </div>\n ";
}
show() {
if (!this.isVisible()) {
this.updateReconnectionText();
}
super.show();
}
}
class h extends d {
constructor(a) {
const b = document.createElement("div");
b.className = "hud-buildingbar-building";
if (a !== "Factory") {
b.textContent = Jj.ui.buildingData[a].hotkey;
} else {
b.classList.add("gold-stash");
}
super(b);
this.type = a;
this.element.setAttribute("BuildingType", a);
this.element.addEventListener("mouseenter", () => {
this.element.style.cursor = "pointer";
Jj.ui.components.uiBuildingBar.buildingTooltip.moveTo(this.element);
});
this.element.addEventListener("mouseleave", () => {
Jj.ui.components.uiBuildingBar.buildingTooltip.hide();
});
this.element.addEventListener("mouseup", this.onMouseUp.bind(this));
this.tier = null;
this.update();
}
init() {
Jj.eventEmitter.on("BuildingsUpdated", this.updateBuildingData.bind(this));
if (Jj.ui.buildingData[this.type].hotkey) {
Jj.eventEmitter.on(Jj.ui.buildingData[this.type].hotkey.toString().charCodeAt(0) + "Up", () => {
this.onMouseUp();
});
}
Jj.eventEmitter.on("PartyMembersUpdatedRpcReceived", this.updateBuildingData.bind(this));
}
updateBuildingData() {
if (Jj.ui.factory !== null) {
this.update(Jj.ui.factory.tier);
} else {
this.update();
}
}
update(a = 1) {
if (this.type !== "Factory") {
if (Jj.ui.factory !== null) {
const a = Jj.ui.buildingData[this.type];
this.element.classList[a.built >= a.limit ? "add" : "remove"]("disabled");
this.show();
Jj.ui.components.uiBuildingBar.unlock();
} else {
this.hide();
Jj.ui.components.uiBuildingBar.lock();
}
} else if (Jj.ui.factory !== null) {
this.hide();
} else {
this.show();
}
if (a !== this.tier) {
this.tier = a;
this.element.style["background-image"] = "url('http://zombia.io/asset/images/Ui/Buildings/" + this.type + "/" + this.type + "Tier" + a + ".svg')";
}
}
onMouseUp(a) {
for (let b in Jj.ui.components.uiTopBar.menuIcons) {
Jj.ui.components.uiTopBar.menuIcons[b].hide();
}
if (Jj.network.connected === true && Jj.ui.playerTick.health > 0 && Jj.ui.buildingData[this.type].built < Jj.ui.buildingData[this.type].limit && (Jj.ui.factory == null && this.type == "Factory" || Jj.ui.factory !== null && this.type !== "Factory")) {
Jj.ui.components.uiPlacementOverlay.startPlacing(this.type);
Jj.ui.components.uiBuildingBar.buildingTooltip.hide();
}
}
}
const i = new class {
constructor() {
this.checkedIfMobile = false;
this.actuallyIsMobile = false;
}
lerp(a, b, c) {
return a * (1 - c) + b * c;
}
mod(a, b) {
return (a % b + b) % b;
}
interpolateYaw(a, b) {
const c = Math.min(1, Jj.renderer.replicator.getMsInThisTick() / Jj.renderer.replicator.msPerTick);
let d = a + this.lerp(0, this.mod(b - a + 180, 360) - 180, c);
if (d < 0) {
d += 360;
}
if (d >= 360) {
d -= 360;
}
return d;
}
angleTo(a, b) {
return (Math.atan2(b.y - a.y, b.x - a.x) * 180 / Math.PI + 90 + 360) % 360;
}
measureDistance(a, b) {
if (a.x === undefined || a.y === undefined || b.x === undefined || b.y === undefined) {
return Infinity;
}
let c = b.x - a.x;
let d = b.y - a.y;
return Math.abs(c ** 2 + d ** 2);
}
isMobile() {
if (!this.checkedIfMobile) {
this.actuallyIsMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
this.checkedIfMobile = true;
}
return this.actuallyIsMobile;
}
hexToRgb(a) {
a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (a, b, c, d) {
return b + b + c + c + d + d;
});
var b = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);
if (b) {
return {
r: parseInt(b[1], 16),
g: parseInt(b[2], 16),
b: parseInt(b[3], 16)
};
} else {
return null;
}
}
createResourceCostString(a, b = 1, c = 1, d = true) {
const e = ["wood", "stone", "gold", "tokens"];
const f = [];
const g = Jj.ui.getPlayerTick();
for (const h of e) {
const e = h + "Costs";
if (e in a) {
const i = a[e][b - 1] * c;
if (i === 0) {
continue;
}
f.push("<span class=\"" + (g !== null && d === true ? g[h] >= i ? "" : "hud-resource-low" : "") + "\">" + this.abbreviateNumber(i, 3).toLocaleString() + " " + h + "</span>");
}
}
if (f.length > 0) {
return {
elem: f.join(", ")
};
} else {
return {
elem: "<span class='hud-resource-free'>Free</span>",
lowResource: false
};
}
}
createResourceRefundString(a, b = 1, c = 0) {
const d = ["wood", "stone", "gold", "tokens"];
const e = [];
for (const f of d) {
const d = f + "Costs";
if (a[d]) {
const g = Math.floor(a[d].slice(0, b).reduce((a, b) => a + b) * c * 0.75);
if (g > 0) {
e.push(this.abbreviateNumber(g, 3).toLocaleString() + " " + f);
}
}
}
if (e.length > 0) {
return "" + e.join(", ");
} else {
return "<span class='hud-resource-free'>None</span>";
}
}
abbreviateNumber(a, b) {
const c = ["K", "M", "B", "T", "q", "Q", "s", "S", "O", "N", "D"];
b = Math.pow(10, b);
for (let d = c.length - 1; d >= 0; d--) {
const e = Math.pow(10, (d + 1) * 3);
if (e <= a) {
if ((a = Math.round(a * b / e) / b) == 1000 && d < c.length - 1) {
a = 1;
d++;
}
a += c[d];
break;
}
}
return a;
}
}();
class j extends d {
constructor(a) {
document.body.insertAdjacentHTML("beforeend", "<div id=\"hud-tooltip\" class=\"hud-tooltip\"></div>");
super(document.getElementById("hud-tooltip"));
this.direction = a;
this.element.classList.add("hud-tooltip-" + a);
}
moveTo(a) {
this.show();
this.element.classList.remove("hud-tooltip-" + this.direction);
if (a.getAttribute("BuildingType") !== null) {
this.direction = "top";
const b = Jj.ui.buildingData[a.getAttribute("BuildingType")];
if (b !== undefined) {
this.element.innerHTML = "\n <div class=\"hud-tooltip-toolbar\">\n <h2>" + b.name.split(/(?=[A-Z])/).join(" ") + "</h2>\n <span class=\"hud-tooltip-built\"><strong " + (b.built >= b.limit ? "class='hud-resource-low'" : "") + ">" + b.built + "</strong>/" + b.limit + "</span>\n <div class=\"hud-tooltip-body\">" + b.description + "</div>\n <div class=\"hud-tooltip-body\">" + i.createResourceCostString(b).elem + "</div>\n </div>";
}
} else if (a.getAttribute("potion-type") !== null) {
this.direction = "top";
const b = Jj.ui.toolData[a.getAttribute("potion-type")];
if (b !== undefined) {
this.element.innerHTML = "\n <div class=\"hud-tooltip-toolbar\">\n <h2>" + b.name.split(/(?=[A-Z])/).join(" ") + "</h2>\n <span>" + b.description + "</span>\n <div class=\"hud-tooltip-body\">" + i.createResourceCostString(b).elem + "</div>\n </div>";
}
} else if (a.getAttribute("item-type") !== null) {
this.direction = "top";
const b = Jj.ui.toolData[a.getAttribute("item-type")];
if (b.name === "ZombieShield") {
this.element.innerHTML = "\n <div class=\"hud-tooltip-toolbar\">\n <h2>" + b.name.split(/(?=[A-Z])/).join(" ") + "</h2>\n <h3>Tier " + Jj.ui.components.uiArmourIndicator.tier + "</h3>\n <h3>" + b.description + "</h3>\n </div>";
}
} else if (a.getAttribute("icon-type") !== undefined) {
this.direction = "bottom";
const b = a.getAttribute("icon-type");
this.element.innerHTML = "\n <div class=\"hud-tooltip-toolbar\">\n <h2>" + b + "</h2>\n </div>\n ";
}
this.element.classList.add("hud-tooltip-" + this.direction);
const b = a.getBoundingClientRect();
const c = {
left: 0,
top: 0
};
if (this.direction == "top") {
c.left = b.left + b.width / 2 - this.element.offsetWidth / 2;
c.top = b.top - this.element.offsetHeight - 30;
} else if (this.direction == "bottom") {
c.left = b.left + b.width / 2 - this.element.offsetWidth / 2;
c.top = b.top + b.height + 70;
} else if (this.direction == "left") {
c.left = b.left - this.element.offsetWidth - 30;
c.top = b.top + b.height / 2 - this.element.offsetHeight / 2;
} else if (this.direction == "right") {
c.left = b.left + b.width + 30;
c.top = b.top + b.height / 2 - this.element.offsetHeight / 2;
}
this.element.style.left = c.left + "px";
this.element.style.top = c.top + "px";
}
}
class k extends d {
constructor() {
let a = document.createElement("div");
a.className = "hud-buildingbar";
a.id = "hud-buildingbar";
document.getElementById("hud-bottom").appendChild(a);
super(a);
this.buildingButtons = [];
this.buildingTooltip = new j("top");
this.element.addEventListener("mouseenter", () => {
window.storage.setItem("walkthrough_BuildingBar", "true");
Jj.ui.components.uiWalkthrough.hideBuildingBarIndicator();
});
this.element.addEventListener("mousedown", a => {
a.stopPropagation();
});
}
init() {
Jj.eventEmitter.on("BuildingDataReceived", this.onDataReceived.bind(this));
}
unlock() {
this.element.classList.remove("locked");
}
lock() {
this.element.classList.add("locked");
}
onDataReceived() {
const a = Jj.ui.buildingData;
for (let a = 0; a < this.buildingButtons.length; a++) {
this.buildingButtons[a].element.remove();
this.buildingButtons.shift();
a--;
}
for (const b in a) {
const c = new h(a[b].name);
this.element.appendChild(c.element);
this.buildingButtons.push(c);
c.init();
}
}
}
function l(a, b) {
this.name = "AggregateError";
this.errors = a;
this.message = b || "";
}
l.prototype = Error.prototype;
var m = setTimeout;
function n(a) {
return Boolean(a && a.length !== undefined);
}
function o() {}
function p(a) {
if (!(this instanceof p)) {
throw new TypeError("Promises must be constructed via new");
}
if (typeof a != "function") {
throw new TypeError("not a function");
}
this._state = 0;
this._handled = false;
this._value = undefined;
this._deferreds = [];
v(a, this);
}
function q(a, b) {
while (a._state === 3) {
a = a._value;
}
if (a._state !== 0) {
a._handled = true;
p._immediateFn(function () {
var c = a._state === 1 ? b.onFulfilled : b.onRejected;
if (c !== null) {
var d;
try {
d = c(a._value);
} catch (a) {
s(b.promise, a);
return;
}
r(b.promise, d);
} else {
(a._state === 1 ? r : s)(b.promise, a._value);
}
});
} else {
a._deferreds.push(b);
}
}
function r(a, b) {
try {
if (b === a) {
throw new TypeError("A promise cannot be resolved with itself.");
}
if (b && (typeof b == "object" || typeof b == "function")) {
var c = b.then;
if (b instanceof p) {
a._state = 3;
a._value = b;
t(a);
return;
}
if (typeof c == "function") {
v((d = c, e = b, function () {
d.apply(e, arguments);
}), a);
return;
}
}
a._state = 1;
a._value = b;
t(a);
} catch (b) {
s(a, b);
}
var d;
var e;
}
function s(a, b) {
a._state = 2;
a._value = b;
t(a);
}
function t(a) {
if (a._state === 2 && a._deferreds.length === 0) {
p._immediateFn(function () {
if (!a._handled) {
p._unhandledRejectionFn(a._value);
}
});
}
for (var b = 0, c = a._deferreds.length; b < c; b++) {
q(a, a._deferreds[b]);
}
a._deferreds = null;
}
function u(a, b, c) {
this.onFulfilled = typeof a == "function" ? a : null;
this.onRejected = typeof b == "function" ? b : null;
this.promise = c;
}
function v(a, b) {
var c = false;
try {
a(function (a) {
if (!c) {
c = true;
r(b, a);
}
}, function (a) {
if (!c) {
c = true;
s(b, a);
}
});
} catch (a) {
if (c) {
return;
}
c = true;
s(b, a);
}
}
p.prototype.catch = function (a) {
return this.then(null, a);
};
p.prototype.then = function (a, b) {
var c = new this.constructor(o);
q(this, new u(a, b, c));
return c;
};
p.prototype.finally = function (a) {
var b = this.constructor;
return this.then(function (c) {
return b.resolve(a()).then(function () {
return c;
});
}, function (c) {
return b.resolve(a()).then(function () {
return b.reject(c);
});
});
};
p.all = function (a) {
return new p(function (b, c) {
if (!n(a)) {
return c(new TypeError("Promise.all accepts an array"));
}
var d = Array.prototype.slice.call(a);
if (d.length === 0) {
return b([]);
}
var e = d.length;
function f(a, g) {
try {
if (g && (typeof g == "object" || typeof g == "function")) {
var h = g.then;
if (typeof h == "function") {
h.call(g, function (b) {
f(a, b);
}, c);
return;
}
}
d[a] = g;
if (--e == 0) {
b(d);
}
} catch (a) {
c(a);
}
}
for (var g = 0; g < d.length; g++) {
f(g, d[g]);
}
});
};
p.any = function (a) {
var b = this;
return new b(function (c, d) {
if (!a || a.length === undefined) {
return d(new TypeError("Promise.any accepts an array"));
}
var e = Array.prototype.slice.call(a);
if (e.length === 0) {
return d();
}
for (var f = [], g = 0; g < e.length; g++) {
try {
b.resolve(e[g]).then(c).catch(function (a) {
f.push(a);
if (f.length === e.length) {
d(new l(f, "All promises were rejected"));
}
});
} catch (a) {
d(a);
}
}
});
};
p.allSettled = function (a) {
return new this(function (b, c) {
if (!a || a.length === undefined) {
return c(new TypeError(typeof a + " " + a + " is not iterable(cannot read property Symbol(Symbol.iterator))"));
}
var d = Array.prototype.slice.call(a);
if (d.length === 0) {
return b([]);
}
var e = d.length;
function f(a, c) {
if (c && (typeof c == "object" || typeof c == "function")) {
var g = c.then;
if (typeof g == "function") {
g.call(c, function (b) {
f(a, b);
}, function (c) {
d[a] = {
status: "rejected",
reason: c
};
if (--e == 0) {
b(d);
}
});
return;
}
}
d[a] = {
status: "fulfilled",
value: c
};
if (--e == 0) {
b(d);
}
}
for (var g = 0; g < d.length; g++) {
f(g, d[g]);
}
});
};
p.resolve = function (a) {
if (a && typeof a == "object" && a.constructor === p) {
return a;
} else {
return new p(function (b) {
b(a);
});
}
};
p.reject = function (a) {
return new p(function (b, c) {
c(a);
});
};
p.race = function (a) {
return new p(function (b, c) {
if (!n(a)) {
return c(new TypeError("Promise.race accepts an array"));
}
for (var d = 0, e = a.length; d < e; d++) {
p.resolve(a[d]).then(b, c);
}
});
};
p._immediateFn = typeof setImmediate == "function" && function (a) {
setImmediate(a);
} || function (a) {
m(a, 0);
};
p._unhandledRejectionFn = function (a) {
if (typeof console != "undefined" && console) {
console.warn("Possible Unhandled Promise Rejection:", a);
}
};
const w = p;
var x = c(418);
var y = c.n(x);
if (typeof globalThis == "undefined") {
if (typeof self != "undefined") {
self.globalThis = self;
} else if (c.g !== undefined) {
c.g.globalThis = c.g;
}
}
globalThis.Promise ||= w;
Object.assign ||= y();
if (!Date.now || !Date.prototype.getTime) {
Date.now = function () {
return new Date().getTime();
};
}
if (!globalThis.performance || !globalThis.performance.now) {
var z = Date.now();
globalThis.performance ||= {};
globalThis.performance.now = function () {
return Date.now() - z;
};
}
for (var A = Date.now(), B = ["ms", "moz", "webkit", "o"], C = 0; C < B.length && !globalThis.requestAnimationFrame; ++C) {
var D = B[C];
globalThis.requestAnimationFrame = globalThis[D + "RequestAnimationFrame"];
globalThis.cancelAnimationFrame = globalThis[D + "CancelAnimationFrame"] || globalThis[D + "CancelRequestAnimationFrame"];
}
globalThis.requestAnimationFrame ||= function (a) {
if (typeof a != "function") {
throw new TypeError(a + "is not a function");
}
var b = Date.now();
var c = 16 + A - b;
if (c < 0) {
c = 0;
}
A = b;
return globalThis.self.setTimeout(function () {
A = Date.now();
a(performance.now());
}, c);
};
globalThis.cancelAnimationFrame ||= function (a) {
return clearTimeout(a);
};
Math.sign ||= function (a) {
if ((a = Number(a)) === 0 || isNaN(a)) {
return a;
} else if (a > 0) {
return 1;
} else {
return -1;
}
};
Number.isInteger ||= function (a) {
return typeof a == "number" && isFinite(a) && Math.floor(a) === a;
};
globalThis.ArrayBuffer ||= Array;
globalThis.Float32Array ||= Array;
globalThis.Uint32Array ||= Array;
globalThis.Uint16Array ||= Array;
globalThis.Uint8Array ||= Array;
globalThis.Int32Array ||= Array;
var E;
var F;
var G;
var H;
var I;
var J;
var K;
var L;
var M;
var N;
var O;
var P;
var Q;
var R;
var S;
var T;
var U;
var V;
var W;
var X = /iPhone/i;
var Y = /iPod/i;
var Z = /iPad/i;
var $ = /\biOS-universal(?:.+)Mac\b/i;
var _ = /\bAndroid(?:.+)Mobile\b/i;
var aa = /Android/i;
var ba = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i;
var ca = /Silk/i;
var da = /Windows Phone/i;
var ea = /\bWindows(?:.+)ARM\b/i;
var fa = /BlackBerry/i;
var ga = /BB10/i;
var ha = /Opera Mini/i;
var ia = /\b(CriOS|Chrome)(?:.+)Mobile/i;
var ja = /Mobile(?:.+)Firefox\b/i;
function ka(a) {
return a !== undefined && a.platform === "MacIntel" && typeof a.maxTouchPoints == "number" && a.maxTouchPoints > 1 && typeof MSStream == "undefined";
}
var la = function (a) {
var b = {
userAgent: "",
platform: "",
maxTouchPoints: 0
};
if (a || typeof navigator == "undefined") {
if (typeof a == "string") {
b.userAgent = a;
} else if (a && a.userAgent) {
b = {
userAgent: a.userAgent,
platform: a.platform,
maxTouchPoints: a.maxTouchPoints || 0
};
}
} else {
b = {
userAgent: navigator.userAgent,
platform: navigator.platform,
maxTouchPoints: navigator.maxTouchPoints || 0
};
}
var c = b.userAgent;
var d = c.split("[FBAN");
if (d[1] !== undefined) {
c = d[0];
}
if ((d = c.split("Twitter"))[1] !== undefined) {
c = d[0];
}
var e = function (a) {
return function (b) {
return b.test(a);
};
}(c);
var f = {
apple: {
phone: e(X) && !e(da),
ipod: e(Y),
tablet: !e(X) && (e(Z) || ka(b)) && !e(da),
universal: e($),
device: (e(X) || e(Y) || e(Z) || e($) || ka(b)) && !e(da)
},
amazon: {
phone: e(ba),
tablet: !e(ba) && e(ca),
device: e(ba) || e(ca)
},
android: {
phone: !e(da) && e(ba) || !e(da) && e(_),
tablet: !e(da) && !e(ba) && !e(_) && (e(ca) || e(aa)),
device: !e(da) && (e(ba) || e(ca) || e(_) || e(aa)) || e(/\bokhttp\b/i)
},
windows: {
phone: e(da),
tablet: e(ea),
device: e(da) || e(ea)
},
other: {
blackberry: e(fa),
blackberry10: e(ga),
opera: e(ha),
firefox: e(ja),
chrome: e(ia),
device: e(fa) || e(ga) || e(ha) || e(ja) || e(ia)
},
any: false,
phone: false,
tablet: false
};
f.any = f.apple.device || f.android.device || f.windows.device || f.other.device;
f.phone = f.apple.phone || f.android.phone || f.windows.phone;
f.tablet = f.apple.tablet || f.android.tablet || f.windows.tablet;
return f;
}(globalThis.navigator);
(function (a) {
a[a.WEBGL_LEGACY = 0] = "WEBGL_LEGACY";
a[a.WEBGL = 1] = "WEBGL";
a[a.WEBGL2 = 2] = "WEBGL2";
})(E ||= {});
(function (a) {
a[a.UNKNOWN = 0] = "UNKNOWN";
a[a.WEBGL = 1] = "WEBGL";
a[a.CANVAS = 2] = "CANVAS";
})(F ||= {});
(function (a) {
a[a.COLOR = 16384] = "COLOR";
a[a.DEPTH = 256] = "DEPTH";
a[a.STENCIL = 1024] = "STENCIL";
})(G ||= {});
(function (a) {
a[a.NORMAL = 0] = "NORMAL";
a[a.ADD = 1] = "ADD";
a[a.MULTIPLY = 2] = "MULTIPLY";
a[a.SCREEN = 3] = "SCREEN";
a[a.OVERLAY = 4] = "OVERLAY";
a[a.DARKEN = 5] = "DARKEN";
a[a.LIGHTEN = 6] = "LIGHTEN";
a[a.COLOR_DODGE = 7] = "COLOR_DODGE";
a[a.COLOR_BURN = 8] = "COLOR_BURN";
a[a.HARD_LIGHT = 9] = "HARD_LIGHT";
a[a.SOFT_LIGHT = 10] = "SOFT_LIGHT";
a[a.DIFFERENCE = 11] = "DIFFERENCE";
a[a.EXCLUSION = 12] = "EXCLUSION";
a[a.HUE = 13] = "HUE";
a[a.SATURATION = 14] = "SATURATION";
a[a.COLOR = 15] = "COLOR";
a[a.LUMINOSITY = 16] = "LUMINOSITY";
a[a.NORMAL_NPM = 17] = "NORMAL_NPM";
a[a.ADD_NPM = 18] = "ADD_NPM";
a[a.SCREEN_NPM = 19] = "SCREEN_NPM";
a[a.NONE = 20] = "NONE";
a[a.SRC_OVER = 0] = "SRC_OVER";
a[a.SRC_IN = 21] = "SRC_IN";
a[a.SRC_OUT = 22] = "SRC_OUT";
a[a.SRC_ATOP = 23] = "SRC_ATOP";
a[a.DST_OVER = 24] = "DST_OVER";
a[a.DST_IN = 25] = "DST_IN";
a[a.DST_OUT = 26] = "DST_OUT";
a[a.DST_ATOP = 27] = "DST_ATOP";
a[a.ERASE = 26] = "ERASE";
a[a.SUBTRACT = 28] = "SUBTRACT";
a[a.XOR = 29] = "XOR";
})(H ||= {});
(function (a) {
a[a.POINTS = 0] = "POINTS";
a[a.LINES = 1] = "LINES";
a[a.LINE_LOOP = 2] = "LINE_LOOP";
a[a.LINE_STRIP = 3] = "LINE_STRIP";
a[a.TRIANGLES = 4] = "TRIANGLES";
a[a.TRIANGLE_STRIP = 5] = "TRIANGLE_STRIP";
a[a.TRIANGLE_FAN = 6] = "TRIANGLE_FAN";
})(I ||= {});
(function (a) {
a[a.RGBA = 6408] = "RGBA";
a[a.RGB = 6407] = "RGB";
a[a.RG = 33319] = "RG";
a[a.RED = 6403] = "RED";
a[a.RGBA_INTEGER = 36249] = "RGBA_INTEGER";
a[a.RGB_INTEGER = 36248] = "RGB_INTEGER";
a[a.RG_INTEGER = 33320] = "RG_INTEGER";
a[a.RED_INTEGER = 36244] = "RED_INTEGER";
a[a.ALPHA = 6406] = "ALPHA";
a[a.LUMINANCE = 6409] = "LUMINANCE";
a[a.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA";
a[a.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT";
a[a.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL";
})(J ||= {});
(function (a) {
a[a.TEXTURE_2D = 3553] = "TEXTURE_2D";
a[a.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP";
a[a.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY";
a[a.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z";
})(K ||= {});
(function (a) {
a[a.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE";
a[a.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT";
a[a.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5";
a[a.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4";
a[a.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1";
a[a.UNSIGNED_INT = 5125] = "UNSIGNED_INT";
a[a.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV";
a[a.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV";
a[a.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8";
a[a.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV";
a[a.BYTE = 5120] = "BYTE";
a[a.SHORT = 5122] = "SHORT";
a[a.INT = 5124] = "INT";
a[a.FLOAT = 5126] = "FLOAT";
a[a.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV";
a[a.HALF_FLOAT = 36193] = "HALF_FLOAT";
})(L ||= {});
(function (a) {
a[a.FLOAT = 0] = "FLOAT";
a[a.INT = 1] = "INT";
a[a.UINT = 2] = "UINT";
})(M ||= {});
(function (a) {
a[a.NEAREST = 0] = "NEAREST";
a[a.LINEAR = 1] = "LINEAR";
})(N ||= {});
(function (a) {
a[a.CLAMP = 33071] = "CLAMP";
a[a.REPEAT = 10497] = "REPEAT";
a[a.MIRRORED_REPEAT = 33648] = "MIRRORED_REPEAT";
})(O ||= {});
(function (a) {
a[a.OFF = 0] = "OFF";
a[a.POW2 = 1] = "POW2";
a[a.ON = 2] = "ON";
a[a.ON_MANUAL = 3] = "ON_MANUAL";
})(P ||= {});
(function (a) {
a[a.NPM = 0] = "NPM";
a[a.UNPACK = 1] = "UNPACK";
a[a.PMA = 2] = "PMA";
a[a.NO_PREMULTIPLIED_ALPHA = 0] = "NO_PREMULTIPLIED_ALPHA";
a[a.PREMULTIPLY_ON_UPLOAD = 1] = "PREMULTIPLY_ON_UPLOAD";
a[a.PREMULTIPLY_ALPHA = 2] = "PREMULTIPLY_ALPHA";
a[a.PREMULTIPLIED_ALPHA = 2] = "PREMULTIPLIED_ALPHA";
})(Q ||= {});
(function (a) {
a[a.NO = 0] = "NO";
a[a.YES = 1] = "YES";
a[a.AUTO = 2] = "AUTO";
a[a.BLEND = 0] = "BLEND";
a[a.CLEAR = 1] = "CLEAR";
a[a.BLIT = 2] = "BLIT";
})(R ||= {});
(function (a) {
a[a.AUTO = 0] = "AUTO";
a[a.MANUAL = 1] = "MANUAL";
})(S ||= {});
(function (a) {
a.LOW = "lowp";
a.MEDIUM = "mediump";
a.HIGH = "highp";
})(T ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.SCISSOR = 1] = "SCISSOR";
a[a.STENCIL = 2] = "STENCIL";
a[a.SPRITE = 3] = "SPRITE";
})(U ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.LOW = 2] = "LOW";
a[a.MEDIUM = 4] = "MEDIUM";
a[a.HIGH = 8] = "HIGH";
})(V ||= {});
(function (a) {
a[a.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER";
a[a.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER";
a[a.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER";
})(W ||= {});
var ma;
var na;
var oa;
var pa;
var qa;
var ra;
var sa;
var ta;
var ua;
var va;
var wa;
var xa;
var ya;
var za;
var Aa;
var Ba;
var Ca;
var Da;
var Ea;
var Fa = {
MIPMAP_TEXTURES: P.POW2,
ANISOTROPIC_LEVEL: 0,
RESOLUTION: 1,
FILTER_RESOLUTION: 1,
FILTER_MULTISAMPLE: V.NONE,
SPRITE_MAX_TEXTURES: function (a) {
var b;
var c = true;
if (la.tablet || la.phone) {
if (la.apple.device && (b = navigator.userAgent.match(/OS (\d+)_(\d+)?/)) && parseInt(b[1], 10) < 11) {
c = false;
}
if (la.android.device && (b = navigator.userAgent.match(/Android\s([0-9.]*)/)) && parseInt(b[1], 10) < 7) {
c = false;
}
}
if (c) {
return 32;
} else {
return 4;
}
}(),
SPRITE_BATCH_SIZE: 4096,
RENDER_OPTIONS: {
view: null,
antialias: false,
autoDensity: false,
backgroundColor: 0,
backgroundAlpha: 1,
useContextAlpha: true,
clearBeforeRender: true,
preserveDrawingBuffer: false,
width: 800,
height: 600,
legacy: false
},
GC_MODE: S.AUTO,
GC_MAX_IDLE: 3600,
GC_MAX_CHECK_COUNT: 600,
WRAP_MODE: O.CLAMP,
SCALE_MODE: N.LINEAR,
PRECISION_VERTEX: T.HIGH,
PRECISION_FRAGMENT: la.apple.device ? T.HIGH : T.MEDIUM,
CAN_UPLOAD_SAME_BUFFER: !la.apple.device,
CREATE_IMAGE_BITMAP: false,
ROUND_PIXELS: false
};
var Ga = c(729);
var Ha = c.n(Ga);
var Ia = c(187);
var Ja = c.n(Ia);
var Ka = c(575);
(function (a) {
a[a.WEBGL_LEGACY = 0] = "WEBGL_LEGACY";
a[a.WEBGL = 1] = "WEBGL";
a[a.WEBGL2 = 2] = "WEBGL2";
})(ma ||= {});
(function (a) {
a[a.UNKNOWN = 0] = "UNKNOWN";
a[a.WEBGL = 1] = "WEBGL";
a[a.CANVAS = 2] = "CANVAS";
})(na ||= {});
(function (a) {
a[a.COLOR = 16384] = "COLOR";
a[a.DEPTH = 256] = "DEPTH";
a[a.STENCIL = 1024] = "STENCIL";
})(oa ||= {});
(function (a) {
a[a.NORMAL = 0] = "NORMAL";
a[a.ADD = 1] = "ADD";
a[a.MULTIPLY = 2] = "MULTIPLY";
a[a.SCREEN = 3] = "SCREEN";
a[a.OVERLAY = 4] = "OVERLAY";
a[a.DARKEN = 5] = "DARKEN";
a[a.LIGHTEN = 6] = "LIGHTEN";
a[a.COLOR_DODGE = 7] = "COLOR_DODGE";
a[a.COLOR_BURN = 8] = "COLOR_BURN";
a[a.HARD_LIGHT = 9] = "HARD_LIGHT";
a[a.SOFT_LIGHT = 10] = "SOFT_LIGHT";
a[a.DIFFERENCE = 11] = "DIFFERENCE";
a[a.EXCLUSION = 12] = "EXCLUSION";
a[a.HUE = 13] = "HUE";
a[a.SATURATION = 14] = "SATURATION";
a[a.COLOR = 15] = "COLOR";
a[a.LUMINOSITY = 16] = "LUMINOSITY";
a[a.NORMAL_NPM = 17] = "NORMAL_NPM";
a[a.ADD_NPM = 18] = "ADD_NPM";
a[a.SCREEN_NPM = 19] = "SCREEN_NPM";
a[a.NONE = 20] = "NONE";
a[a.SRC_OVER = 0] = "SRC_OVER";
a[a.SRC_IN = 21] = "SRC_IN";
a[a.SRC_OUT = 22] = "SRC_OUT";
a[a.SRC_ATOP = 23] = "SRC_ATOP";
a[a.DST_OVER = 24] = "DST_OVER";
a[a.DST_IN = 25] = "DST_IN";
a[a.DST_OUT = 26] = "DST_OUT";
a[a.DST_ATOP = 27] = "DST_ATOP";
a[a.ERASE = 26] = "ERASE";
a[a.SUBTRACT = 28] = "SUBTRACT";
a[a.XOR = 29] = "XOR";
})(pa ||= {});
(function (a) {
a[a.POINTS = 0] = "POINTS";
a[a.LINES = 1] = "LINES";
a[a.LINE_LOOP = 2] = "LINE_LOOP";
a[a.LINE_STRIP = 3] = "LINE_STRIP";
a[a.TRIANGLES = 4] = "TRIANGLES";
a[a.TRIANGLE_STRIP = 5] = "TRIANGLE_STRIP";
a[a.TRIANGLE_FAN = 6] = "TRIANGLE_FAN";
})(qa ||= {});
(function (a) {
a[a.RGBA = 6408] = "RGBA";
a[a.RGB = 6407] = "RGB";
a[a.RG = 33319] = "RG";
a[a.RED = 6403] = "RED";
a[a.RGBA_INTEGER = 36249] = "RGBA_INTEGER";
a[a.RGB_INTEGER = 36248] = "RGB_INTEGER";
a[a.RG_INTEGER = 33320] = "RG_INTEGER";
a[a.RED_INTEGER = 36244] = "RED_INTEGER";
a[a.ALPHA = 6406] = "ALPHA";
a[a.LUMINANCE = 6409] = "LUMINANCE";
a[a.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA";
a[a.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT";
a[a.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL";
})(ra ||= {});
(function (a) {
a[a.TEXTURE_2D = 3553] = "TEXTURE_2D";
a[a.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP";
a[a.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY";
a[a.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z";
})(sa ||= {});
(function (a) {
a[a.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE";
a[a.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT";
a[a.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5";
a[a.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4";
a[a.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1";
a[a.UNSIGNED_INT = 5125] = "UNSIGNED_INT";
a[a.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV";
a[a.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV";
a[a.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8";
a[a.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV";
a[a.BYTE = 5120] = "BYTE";
a[a.SHORT = 5122] = "SHORT";
a[a.INT = 5124] = "INT";
a[a.FLOAT = 5126] = "FLOAT";
a[a.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV";
a[a.HALF_FLOAT = 36193] = "HALF_FLOAT";
})(ta ||= {});
(function (a) {
a[a.FLOAT = 0] = "FLOAT";
a[a.INT = 1] = "INT";
a[a.UINT = 2] = "UINT";
})(ua ||= {});
(function (a) {
a[a.NEAREST = 0] = "NEAREST";
a[a.LINEAR = 1] = "LINEAR";
})(va ||= {});
(function (a) {
a[a.CLAMP = 33071] = "CLAMP";
a[a.REPEAT = 10497] = "REPEAT";
a[a.MIRRORED_REPEAT = 33648] = "MIRRORED_REPEAT";
})(wa ||= {});
(function (a) {
a[a.OFF = 0] = "OFF";
a[a.POW2 = 1] = "POW2";
a[a.ON = 2] = "ON";
a[a.ON_MANUAL = 3] = "ON_MANUAL";
})(xa ||= {});
(function (a) {
a[a.NPM = 0] = "NPM";
a[a.UNPACK = 1] = "UNPACK";
a[a.PMA = 2] = "PMA";
a[a.NO_PREMULTIPLIED_ALPHA = 0] = "NO_PREMULTIPLIED_ALPHA";
a[a.PREMULTIPLY_ON_UPLOAD = 1] = "PREMULTIPLY_ON_UPLOAD";
a[a.PREMULTIPLY_ALPHA = 2] = "PREMULTIPLY_ALPHA";
a[a.PREMULTIPLIED_ALPHA = 2] = "PREMULTIPLIED_ALPHA";
})(ya ||= {});
(function (a) {
a[a.NO = 0] = "NO";
a[a.YES = 1] = "YES";
a[a.AUTO = 2] = "AUTO";
a[a.BLEND = 0] = "BLEND";
a[a.CLEAR = 1] = "CLEAR";
a[a.BLIT = 2] = "BLIT";
})(za ||= {});
(function (a) {
a[a.AUTO = 0] = "AUTO";
a[a.MANUAL = 1] = "MANUAL";
})(Aa ||= {});
(function (a) {
a.LOW = "lowp";
a.MEDIUM = "mediump";
a.HIGH = "highp";
})(Ba ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.SCISSOR = 1] = "SCISSOR";
a[a.STENCIL = 2] = "STENCIL";
a[a.SPRITE = 3] = "SPRITE";
})(Ca ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.LOW = 2] = "LOW";
a[a.MEDIUM = 4] = "MEDIUM";
a[a.HIGH = 8] = "HIGH";
})(Da ||= {});
(function (a) {
a[a.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER";
a[a.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER";
a[a.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER";
})(Ea ||= {});
var La = {
parse: Ka.Qc,
format: Ka.WU,
resolve: Ka.DB
};
Fa.RETINA_PREFIX = /@([0-9\.]+)x/;
Fa.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;
var Ma;
var Na = false;
var Oa = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
goldenrod: "#daa520",
gold: "#ffd700",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavenderblush: "#fff0f5",
lavender: "#e6e6fa",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
function Pa(a, b) {
if (b === undefined) {
b = [];
}
b[0] = (a >> 16 & 255) / 255;
b[1] = (a >> 8 & 255) / 255;
b[2] = (a & 255) / 255;
return b;
}
function Qa(a) {
var b = a.toString(16);
return "#" + ("000000".substring(0, 6 - b.length) + b);
}
function Ra(a) {
if (typeof a == "string" && (a = Oa[a.toLowerCase()] || a)[0] === "#") {
a = a.slice(1);
}
return parseInt(a, 16);
}
var Sa = function () {
for (var a = [], b = [], c = 0; c < 32; c++) {
a[c] = c;
b[c] = c;
}
a[pa.NORMAL_NPM] = pa.NORMAL;
a[pa.ADD_NPM] = pa.ADD;
a[pa.SCREEN_NPM] = pa.SCREEN;
b[pa.NORMAL] = pa.NORMAL_NPM;
b[pa.ADD] = pa.ADD_NPM;
b[pa.SCREEN] = pa.SCREEN_NPM;
var d = [];
d.push(b);
d.push(a);
return d;
}();
function Ta(a, b) {
return Sa[b ? 1 : 0][a];
}
function Ua(a, b) {
if (b === 1) {
return (b * 255 << 24) + a;
}
if (b === 0) {
return 0;
}
var c = a >> 16 & 255;
var d = a >> 8 & 255;
var e = a & 255;
return (b * 255 << 24) + ((c = c * b + 0.5 | 0) << 16) + ((d = d * b + 0.5 | 0) << 8) + (e * b + 0.5 | 0);
}
function Va(a, b, c, d) {
(c = c || new Float32Array(4))[0] = (a >> 16 & 255) / 255;
c[1] = (a >> 8 & 255) / 255;
c[2] = (a & 255) / 255;
if (d || d === undefined) {
c[0] *= b;
c[1] *= b;
c[2] *= b;
}
c[3] = b;
return c;
}
function Wa(a) {
if (a.BYTES_PER_ELEMENT === 4) {
if (a instanceof Float32Array) {
return "Float32Array";
} else if (a instanceof Uint32Array) {
return "Uint32Array";
} else {
return "Int32Array";
}
}
if (a.BYTES_PER_ELEMENT === 2) {
if (a instanceof Uint16Array) {
return "Uint16Array";
}
} else if (a.BYTES_PER_ELEMENT === 1 && a instanceof Uint8Array) {
return "Uint8Array";
}
return null;
}
function Xa(a) {
a += a === 0 ? 1 : 0;
--a;
a |= a >>> 1;
a |= a >>> 2;
a |= a >>> 4;
a |= a >>> 8;
return 1 + (a |= a >>> 16);
}
function Ya(a) {
return !(a & a - 1) && !!a;
}
function Za(a) {
var b = (a > 65535 ? 1 : 0) << 4;
var c = ((a >>>= b) > 255 ? 1 : 0) << 3;
b |= c;
b |= c = ((a >>>= c) > 15 ? 1 : 0) << 2;
return (b |= c = ((a >>>= c) > 3 ? 1 : 0) << 1) | (a >>>= c) >> 1;
}
function $a(a, b, c) {
var d;
var e = a.length;
if (b < e && c !== 0) {
var f = e - (c = b + c > e ? e - b : c);
for (d = b; d < f; ++d) {
a[d] = a[d + c];
}
a.length = f;
}
}
function _a(a) {
if (a === 0) {
return 0;
} else if (a < 0) {
return -1;
} else {
return 1;
}
}
Float32Array;
Uint32Array;
Int32Array;
Uint8Array;
var ab = 0;
function bb() {
return ++ab;
}
var cb = {};
function db(a, b, c) {
if (c === undefined) {
c = 3;
}
if (!cb[b]) {
var d = new Error().stack;
if (d === undefined) {
console.warn("PixiJS Deprecation Warning: ", b + "\nDeprecated since v" + a);
} else {
d = d.split("\n").splice(c).join("\n");
if (console.groupCollapsed) {
console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s", "color:#614108;background:#fffbe6", "font-weight:normal;color:#614108;background:#fffbe6", b + "\nDeprecated since v" + a);
console.warn(d);
console.groupEnd();
} else {
console.warn("PixiJS Deprecation Warning: ", b + "\nDeprecated since v" + a);
console.warn(d);
}
}
cb[b] = true;
}
}
var eb;
var fb = {};
var gb = Object.create(null);
var hb = Object.create(null);
var ib = function () {
function a(a, b, c) {
this.canvas = document.createElement("canvas");
this.context = this.canvas.getContext("2d");
this.resolution = c || Fa.RESOLUTION;
this.resize(a, b);
}
a.prototype.clear = function () {
this.context.setTransform(1, 0, 0, 1, 0, 0);
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
};
a.prototype.resize = function (a, b) {
this.canvas.width = Math.round(a * this.resolution);
this.canvas.height = Math.round(b * this.resolution);
};
a.prototype.destroy = function () {
this.context = null;
this.canvas = null;
};
Object.defineProperty(a.prototype, "width", {
get: function () {
return this.canvas.width;
},
set: function (a) {
this.canvas.width = Math.round(a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "height", {
get: function () {
return this.canvas.height;
},
set: function (a) {
this.canvas.height = Math.round(a);
},
enumerable: false,
configurable: true
});
return a;
}();
function jb(a, b) {
var c = Fa.RETINA_PREFIX.exec(a);
if (c) {
return parseFloat(c[1]);
} else if (b !== undefined) {
return b;
} else {
return 1;
}
}
var kb;
var lb = Math.PI * 2;
var mb = 180 / Math.PI;
var nb = Math.PI / 180;
(function (a) {
a[a.POLY = 0] = "POLY";
a[a.RECT = 1] = "RECT";
a[a.CIRC = 2] = "CIRC";
a[a.ELIP = 3] = "ELIP";
a[a.RREC = 4] = "RREC";
})(kb ||= {});
var ob = function () {
function a(a, b) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = 0;
}
this.x = 0;
this.y = 0;
this.x = a;
this.y = b;
}
a.prototype.clone = function () {
return new a(this.x, this.y);
};
a.prototype.copyFrom = function (a) {
this.set(a.x, a.y);
return this;
};
a.prototype.copyTo = function (a) {
a.set(this.x, this.y);
return a;
};
a.prototype.equals = function (a) {
return a.x === this.x && a.y === this.y;
};
a.prototype.set = function (a, b) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = a;
}
this.x = a;
this.y = b;
return this;
};
a.prototype.toString = function () {
return "[@pixi/math:Point x=" + this.x + " y=" + this.y + "]";
};
return a;
}();
var pb = [new ob(), new ob(), new ob(), new ob()];
var qb = function () {
function a(a, b, c, d) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = 0;
}
if (c === undefined) {
c = 0;
}
if (d === undefined) {
d = 0;
}
this.x = Number(a);
this.y = Number(b);
this.width = Number(c);
this.height = Number(d);
this.type = kb.RECT;
}
Object.defineProperty(a.prototype, "left", {
get: function () {
return this.x;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "right", {
get: function () {
return this.x + this.width;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "top", {
get: function () {
return this.y;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "bottom", {
get: function () {
return this.y + this.height;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a, "EMPTY", {
get: function () {
return new a(0, 0, 0, 0);
},
enumerable: false,
configurable: true
});
a.prototype.clone = function () {
return new a(this.x, this.y, this.width, this.height);
};
a.prototype.copyFrom = function (a) {
this.x = a.x;
this.y = a.y;
this.width = a.width;
this.height = a.height;
return this;
};
a.prototype.copyTo = function (a) {
a.x = this.x;
a.y = this.y;
a.width = this.width;
a.height = this.height;
return a;
};
a.prototype.contains = function (a, b) {
return this.width > 0 && this.height > 0 && a >= this.x && a < this.x + this.width && b >= this.y && b < this.y + this.height;
};
a.prototype.intersects = function (a, b) {
if (!b) {
var c = this.x < a.x ? a.x : this.x;
if ((this.right > a.right ? a.right : this.right) <= c) {
return false;
}
var d = this.y < a.y ? a.y : this.y;
return (this.bottom > a.bottom ? a.bottom : this.bottom) > d;
}
var e = this.left;
var f = this.right;
var g = this.top;
var h = this.bottom;
if (f <= e || h <= g) {
return false;
}
var i = pb[0].set(a.left, a.top);
var j = pb[1].set(a.left, a.bottom);
var k = pb[2].set(a.right, a.top);
var l = pb[3].set(a.right, a.bottom);
if (k.x <= i.x || j.y <= i.y) {
return false;
}
var m = Math.sign(b.a * b.d - b.b * b.c);
if (m === 0) {
return false;
}
b.apply(i, i);
b.apply(j, j);
b.apply(k, k);
b.apply(l, l);
if (Math.max(i.x, j.x, k.x, l.x) <= e || Math.min(i.x, j.x, k.x, l.x) >= f || Math.max(i.y, j.y, k.y, l.y) <= g || Math.min(i.y, j.y, k.y, l.y) >= h) {
return false;
}
var n = m * (j.y - i.y);
var o = m * (i.x - j.x);
var p = n * e + o * g;
var q = n * f + o * g;
var r = n * e + o * h;
var s = n * f + o * h;
if (Math.max(p, q, r, s) <= n * i.x + o * i.y || Math.min(p, q, r, s) >= n * l.x + o * l.y) {
return false;
}
var t = m * (i.y - k.y);
var u = m * (k.x - i.x);
var v = t * e + u * g;
var w = t * f + u * g;
var x = t * e + u * h;
var y = t * f + u * h;
return Math.max(v, w, x, y) > t * i.x + u * i.y && Math.min(v, w, x, y) < t * l.x + u * l.y;
};
a.prototype.pad = function (a, b) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = a;
}
this.x -= a;
this.y -= b;
this.width += a * 2;
this.height += b * 2;
return this;
};
a.prototype.fit = function (a) {
var b = Math.max(this.x, a.x);
var c = Math.min(this.x + this.width, a.x + a.width);
var d = Math.max(this.y, a.y);
var e = Math.min(this.y + this.height, a.y + a.height);
this.x = b;
this.width = Math.max(c - b, 0);
this.y = d;
this.height = Math.max(e - d, 0);
return this;
};
a.prototype.ceil = function (a, b) {
if (a === undefined) {
a = 1;
}
if (b === undefined) {
b = 0.001;
}
var c = Math.ceil((this.x + this.width - b) * a) / a;
var d = Math.ceil((this.y + this.height - b) * a) / a;
this.x = Math.floor((this.x + b) * a) / a;
this.y = Math.floor((this.y + b) * a) / a;
this.width = c - this.x;
this.height = d - this.y;
return this;
};
a.prototype.enlarge = function (a) {
var b = Math.min(this.x, a.x);
var c = Math.max(this.x + this.width, a.x + a.width);
var d = Math.min(this.y, a.y);
var e = Math.max(this.y + this.height, a.y + a.height);
this.x = b;
this.width = c - b;
this.y = d;
this.height = e - d;
return this;
};
a.prototype.toString = function () {
return "[@pixi/math:Rectangle x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + "]";
};
return a;
}();
var rb = function () {
function a(a, b, c) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = 0;
}
if (c === undefined) {
c = 0;
}
this.x = a;
this.y = b;
this.radius = c;
this.type = kb.CIRC;
}
a.prototype.clone = function () {
return new a(this.x, this.y, this.radius);
};
a.prototype.contains = function (a, b) {
if (this.radius <= 0) {
return false;
}
var c = this.radius * this.radius;
var d = this.x - a;
var e = this.y - b;
return (d *= d) + (e *= e) <= c;
};
a.prototype.getBounds = function () {
return new qb(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);
};
a.prototype.toString = function () {
return "[@pixi/math:Circle x=" + this.x + " y=" + this.y + " radius=" + this.radius + "]";
};
return a;
}();
var sb = function () {
function a(a, b, c, d) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = 0;
}
if (c === undefined) {
c = 0;
}
if (d === undefined) {
d = 0;
}
this.x = a;
this.y = b;
this.width = c;
this.height = d;
this.type = kb.ELIP;
}
a.prototype.clone = function () {
return new a(this.x, this.y, this.width, this.height);
};
a.prototype.contains = function (a, b) {
if (this.width <= 0 || this.height <= 0) {
return false;
}
var c = (a - this.x) / this.width;
var d = (b - this.y) / this.height;
return (c *= c) + (d *= d) <= 1;
};
a.prototype.getBounds = function () {
return new qb(this.x - this.width, this.y - this.height, this.width, this.height);
};
a.prototype.toString = function () {
return "[@pixi/math:Ellipse x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + "]";
};
return a;
}();
var tb = function () {
function a() {
for (var a = arguments, b = [], c = 0; c < arguments.length; c++) {
b[c] = a[c];
}
var d = Array.isArray(b[0]) ? b[0] : b;
if (typeof d[0] != "number") {
for (var e = [], f = 0, g = d.length; f < g; f++) {
e.push(d[f].x, d[f].y);
}
d = e;
}
this.points = d;
this.type = kb.POLY;
this.closeStroke = true;
}
a.prototype.clone = function () {
var b = new a(this.points.slice());
b.closeStroke = this.closeStroke;
return b;
};
a.prototype.contains = function (a, b) {
for (var c = false, d = this.points.length / 2, e = 0, f = d - 1; e < d; f = e++) {
var g = this.points[e * 2];
var h = this.points[e * 2 + 1];
var i = this.points[f * 2];
var j = this.points[f * 2 + 1];
if (h > b != j > b && a < (b - h) / (j - h) * (i - g) + g) {
c = !c;
}
}
return c;
};
a.prototype.toString = function () {
return "[@pixi/math:PolygoncloseStroke=" + this.closeStroke + "points=" + this.points.reduce(function (a, b) {
return a + ", " + b;
}, "") + "]";
};
return a;
}();
var ub = function () {
function a(a, b, c, d, e) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = 0;
}
if (c === undefined) {
c = 0;
}
if (d === undefined) {
d = 0;
}
if (e === undefined) {
e = 20;
}
this.x = a;
this.y = b;
this.width = c;
this.height = d;
this.radius = e;
this.type = kb.RREC;
}
a.prototype.clone = function () {
return new a(this.x, this.y, this.width, this.height, this.radius);
};
a.prototype.contains = function (a, b) {
if (this.width <= 0 || this.height <= 0) {
return false;
}
if (a >= this.x && a <= this.x + this.width && b >= this.y && b <= this.y + this.height) {
var c = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));
if (b >= this.y + c && b <= this.y + this.height - c || a >= this.x + c && a <= this.x + this.width - c) {
return true;
}
var d = a - (this.x + c);
var e = b - (this.y + c);
var f = c * c;
if (d * d + e * e <= f) {
return true;
}
if ((d = a - (this.x + this.width - c)) * d + e * e <= f) {
return true;
}
if (d * d + (e = b - (this.y + this.height - c)) * e <= f) {
return true;
}
if ((d = a - (this.x + c)) * d + e * e <= f) {
return true;
}
}
return false;
};
a.prototype.toString = function () {
return "[@pixi/math:RoundedRectangle x=" + this.x + " y=" + this.y + "width=" + this.width + " height=" + this.height + " radius=" + this.radius + "]";
};
return a;
}();
var vb = function () {
function a(a, b, c, d) {
if (c === undefined) {
c = 0;
}
if (d === undefined) {
d = 0;
}
this._x = c;
this._y = d;
this.cb = a;
this.scope = b;
}
a.prototype.clone = function (b, c) {
if (b === undefined) {
b = this.cb;
}
if (c === undefined) {
c = this.scope;
}
return new a(b, c, this._x, this._y);
};
a.prototype.set = function (a, b) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = a;
}
if (this._x !== a || this._y !== b) {
this._x = a;
this._y = b;
this.cb.call(this.scope);
}
return this;
};
a.prototype.copyFrom = function (a) {
if (this._x !== a.x || this._y !== a.y) {
this._x = a.x;
this._y = a.y;
this.cb.call(this.scope);
}
return this;
};
a.prototype.copyTo = function (a) {
a.set(this._x, this._y);
return a;
};
a.prototype.equals = function (a) {
return a.x === this._x && a.y === this._y;
};
a.prototype.toString = function () {
return "[@pixi/math:ObservablePoint x=0 y=0 scope=" + this.scope + "]";
};
Object.defineProperty(a.prototype, "x", {
get: function () {
return this._x;
},
set: function (a) {
if (this._x !== a) {
this._x = a;
this.cb.call(this.scope);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "y", {
get: function () {
return this._y;
},
set: function (a) {
if (this._y !== a) {
this._y = a;
this.cb.call(this.scope);
}
},
enumerable: false,
configurable: true
});
return a;
}();
var wb = function () {
function a(a, b, c, d, e, f) {
if (a === undefined) {
a = 1;
}
if (b === undefined) {
b = 0;
}
if (c === undefined) {
c = 0;
}
if (d === undefined) {
d = 1;
}
if (e === undefined) {
e = 0;
}
if (f === undefined) {
f = 0;
}
this.array = null;
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.tx = e;
this.ty = f;
}
a.prototype.fromArray = function (a) {
this.a = a[0];
this.b = a[1];
this.c = a[3];
this.d = a[4];
this.tx = a[2];
this.ty = a[5];
};
a.prototype.set = function (a, b, c, d, e, f) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.tx = e;
this.ty = f;
return this;
};
a.prototype.toArray = function (a, b) {
this.array ||= new Float32Array(9);
var c = b || this.array;
if (a) {
c[0] = this.a;
c[1] = this.b;
c[2] = 0;
c[3] = this.c;
c[4] = this.d;
c[5] = 0;
c[6] = this.tx;
c[7] = this.ty;
c[8] = 1;
} else {
c[0] = this.a;
c[1] = this.c;
c[2] = this.tx;
c[3] = this.b;
c[4] = this.d;
c[5] = this.ty;
c[6] = 0;
c[7] = 0;
c[8] = 1;
}
return c;
};
a.prototype.apply = function (a, b) {
b = b || new ob();
var c = a.x;
var d = a.y;
b.x = this.a * c + this.c * d + this.tx;
b.y = this.b * c + this.d * d + this.ty;
return b;
};
a.prototype.applyInverse = function (a, b) {
b = b || new ob();
var c = 1 / (this.a * this.d + this.c * -this.b);
var d = a.x;
var e = a.y;
b.x = this.d * c * d + -this.c * c * e + (this.ty * this.c - this.tx * this.d) * c;
b.y = this.a * c * e + -this.b * c * d + (-this.ty * this.a + this.tx * this.b) * c;
return b;
};
a.prototype.translate = function (a, b) {
this.tx += a;
this.ty += b;
return this;
};
a.prototype.scale = function (a, b) {
this.a *= a;
this.d *= b;
this.c *= a;
this.b *= b;
this.tx *= a;
this.ty *= b;
return this;
};
a.prototype.rotate = function (a) {
var b = Math.cos(a);
var c = Math.sin(a);
var d = this.a;
var e = this.c;
var f = this.tx;
this.a = d * b - this.b * c;
this.b = d * c + this.b * b;
this.c = e * b - this.d * c;
this.d = e * c + this.d * b;
this.tx = f * b - this.ty * c;
this.ty = f * c + this.ty * b;
return this;
};
a.prototype.append = function (a) {
var b = this.a;
var c = this.b;
var d = this.c;
var e = this.d;
this.a = a.a * b + a.b * d;
this.b = a.a * c + a.b * e;
this.c = a.c * b + a.d * d;
this.d = a.c * c + a.d * e;
this.tx = a.tx * b + a.ty * d + this.tx;
this.ty = a.tx * c + a.ty * e + this.ty;
return this;
};
a.prototype.setTransform = function (a, b, c, d, e, f, g, h, i) {
this.a = Math.cos(g + i) * e;
this.b = Math.sin(g + i) * e;
this.c = -Math.sin(g - h) * f;
this.d = Math.cos(g - h) * f;
this.tx = a - (c * this.a + d * this.c);
this.ty = b - (c * this.b + d * this.d);
return this;
};
a.prototype.prepend = function (a) {
var b = this.tx;
if (a.a !== 1 || a.b !== 0 || a.c !== 0 || a.d !== 1) {
var c = this.a;
var d = this.c;
this.a = c * a.a + this.b * a.c;
this.b = c * a.b + this.b * a.d;
this.c = d * a.a + this.d * a.c;
this.d = d * a.b + this.d * a.d;
}
this.tx = b * a.a + this.ty * a.c + a.tx;
this.ty = b * a.b + this.ty * a.d + a.ty;
return this;
};
a.prototype.decompose = function (a) {
var b = this.a;
var c = this.b;
var d = this.c;
var e = this.d;
var f = a.pivot;
var g = -Math.atan2(-d, e);
var h = Math.atan2(c, b);
var i = Math.abs(g + h);
if (i < 0.00001 || Math.abs(lb - i) < 0.00001) {
a.rotation = h;
a.skew.x = a.skew.y = 0;
} else {
a.rotation = 0;
a.skew.x = g;
a.skew.y = h;
}
a.scale.x = Math.sqrt(b * b + c * c);
a.scale.y = Math.sqrt(d * d + e * e);
a.position.x = this.tx + (f.x * b + f.y * d);
a.position.y = this.ty + (f.x * c + f.y * e);
return a;
};
a.prototype.invert = function () {
var a = this.a;
var b = this.b;
var c = this.c;
var d = this.d;
var e = this.tx;
var f = a * d - b * c;
this.a = d / f;
this.b = -b / f;
this.c = -c / f;
this.d = a / f;
this.tx = (c * this.ty - d * e) / f;
this.ty = -(a * this.ty - b * e) / f;
return this;
};
a.prototype.identity = function () {
this.a = 1;
this.b = 0;
this.c = 0;
this.d = 1;
this.tx = 0;
this.ty = 0;
return this;
};
a.prototype.clone = function () {
var b = new a();
b.a = this.a;
b.b = this.b;
b.c = this.c;
b.d = this.d;
b.tx = this.tx;
b.ty = this.ty;
return b;
};
a.prototype.copyTo = function (a) {
a.a = this.a;
a.b = this.b;
a.c = this.c;
a.d = this.d;
a.tx = this.tx;
a.ty = this.ty;
return a;
};
a.prototype.copyFrom = function (a) {
this.a = a.a;
this.b = a.b;
this.c = a.c;
this.d = a.d;
this.tx = a.tx;
this.ty = a.ty;
return this;
};
a.prototype.toString = function () {
return "[@pixi/math:Matrix a=" + this.a + " b=" + this.b + " c=" + this.c + " d=" + this.d + " tx=" + this.tx + " ty=" + this.ty + "]";
};
Object.defineProperty(a, "IDENTITY", {
get: function () {
return new a();
},
enumerable: false,
configurable: true
});
Object.defineProperty(a, "TEMP_MATRIX", {
get: function () {
return new a();
},
enumerable: false,
configurable: true
});
return a;
}();
var xb = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];
var yb = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];
var zb = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];
var Ab = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];
var Bb = [];
var Cb = [];
var Db = Math.sign;
(function () {
for (var a = 0; a < 16; a++) {
var b = [];
Bb.push(b);
for (var c = 0; c < 16; c++) {
for (var d = Db(xb[a] * xb[c] + zb[a] * yb[c]), e = Db(yb[a] * xb[c] + Ab[a] * yb[c]), f = Db(xb[a] * zb[c] + zb[a] * Ab[c]), g = Db(yb[a] * zb[c] + Ab[a] * Ab[c]), h = 0; h < 16; h++) {
if (xb[h] === d && yb[h] === e && zb[h] === f && Ab[h] === g) {
b.push(h);
break;
}
}
}
}
for (a = 0; a < 16; a++) {
var i = new wb();
i.set(xb[a], yb[a], zb[a], Ab[a], 0, 0);
Cb.push(i);
}
})();
var Eb = {
E: 0,
SE: 1,
S: 2,
SW: 3,
W: 4,
NW: 5,
N: 6,
NE: 7,
MIRROR_VERTICAL: 8,
MAIN_DIAGONAL: 10,
MIRROR_HORIZONTAL: 12,
REVERSE_DIAGONAL: 14,
uX: function (a) {
return xb[a];
},
uY: function (a) {
return yb[a];
},
vX: function (a) {
return zb[a];
},
vY: function (a) {
return Ab[a];
},
inv: function (a) {
if (a & 8) {
return a & 15;
} else {
return -a & 7;
}
},
add: function (a, b) {
return Bb[a][b];
},
sub: function (a, b) {
return Bb[a][Eb.inv(b)];
},
rotate180: function (a) {
return a ^ 4;
},
isVertical: function (a) {
return (a & 3) == 2;
},
byDirection: function (a, b) {
if (Math.abs(a) * 2 <= Math.abs(b)) {
if (b >= 0) {
return Eb.S;
} else {
return Eb.N;
}
} else if (Math.abs(b) * 2 <= Math.abs(a)) {
if (a > 0) {
return Eb.E;
} else {
return Eb.W;
}
} else if (b > 0) {
if (a > 0) {
return Eb.SE;
} else {
return Eb.SW;
}
} else if (a > 0) {
return Eb.NE;
} else {
return Eb.NW;
}
},
matrixAppendRotationInv: function (a, b, c, d) {
if (c === undefined) {
c = 0;
}
if (d === undefined) {
d = 0;
}
var e = Cb[Eb.inv(b)];
e.tx = c;
e.ty = d;
a.append(e);
}
};
var Fb = function () {
function a() {
this.worldTransform = new wb();
this.localTransform = new wb();
this.position = new vb(this.onChange, this, 0, 0);
this.scale = new vb(this.onChange, this, 1, 1);
this.pivot = new vb(this.onChange, this, 0, 0);
this.skew = new vb(this.updateSkew, this, 0, 0);
this._rotation = 0;
this._cx = 1;
this._sx = 0;
this._cy = 0;
this._sy = 1;
this._localID = 0;
this._currentLocalID = 0;
this._worldID = 0;
this._parentID = 0;
}
a.prototype.onChange = function () {
this._localID++;
};
a.prototype.updateSkew = function () {
this._cx = Math.cos(this._rotation + this.skew.y);
this._sx = Math.sin(this._rotation + this.skew.y);
this._cy = -Math.sin(this._rotation - this.skew.x);
this._sy = Math.cos(this._rotation - this.skew.x);
this._localID++;
};
a.prototype.toString = function () {
return "[@pixi/math:Transform position=(" + this.position.x + ", " + this.position.y + ") rotation=" + this.rotation + " scale=(" + this.scale.x + ", " + this.scale.y + ") skew=(" + this.skew.x + ", " + this.skew.y + ") ]";
};
a.prototype.updateLocalTransform = function () {
var a = this.localTransform;
if (this._localID !== this._currentLocalID) {
a.a = this._cx * this.scale.x;
a.b = this._sx * this.scale.x;
a.c = this._cy * this.scale.y;
a.d = this._sy * this.scale.y;
a.tx = this.position.x - (this.pivot.x * a.a + this.pivot.y * a.c);
a.ty = this.position.y - (this.pivot.x * a.b + this.pivot.y * a.d);
this._currentLocalID = this._localID;
this._parentID = -1;
}
};
a.prototype.updateTransform = function (a) {
var b = this.localTransform;
if (this._localID !== this._currentLocalID) {
b.a = this._cx * this.scale.x;
b.b = this._sx * this.scale.x;
b.c = this._cy * this.scale.y;
b.d = this._sy * this.scale.y;
b.tx = this.position.x - (this.pivot.x * b.a + this.pivot.y * b.c);
b.ty = this.position.y - (this.pivot.x * b.b + this.pivot.y * b.d);
this._currentLocalID = this._localID;
this._parentID = -1;
}
if (this._parentID !== a._worldID) {
var c = a.worldTransform;
var d = this.worldTransform;
d.a = b.a * c.a + b.b * c.c;
d.b = b.a * c.b + b.b * c.d;
d.c = b.c * c.a + b.d * c.c;
d.d = b.c * c.b + b.d * c.d;
d.tx = b.tx * c.a + b.ty * c.c + c.tx;
d.ty = b.tx * c.b + b.ty * c.d + c.ty;
this._parentID = a._worldID;
this._worldID++;
}
};
a.prototype.setFromMatrix = function (a) {
a.decompose(this);
this._localID++;
};
Object.defineProperty(a.prototype, "rotation", {
get: function () {
return this._rotation;
},
set: function (a) {
if (this._rotation !== a) {
this._rotation = a;
this.updateSkew();
}
},
enumerable: false,
configurable: true
});
a.IDENTITY = new a();
return a;
}();
Fa.SORTABLE_CHILDREN = false;
var Gb = function () {
function a() {
this.minX = Infinity;
this.minY = Infinity;
this.maxX = -Infinity;
this.maxY = -Infinity;
this.rect = null;
this.updateID = -1;
}
a.prototype.isEmpty = function () {
return this.minX > this.maxX || this.minY > this.maxY;
};
a.prototype.clear = function () {
this.minX = Infinity;
this.minY = Infinity;
this.maxX = -Infinity;
this.maxY = -Infinity;
};
a.prototype.getRectangle = function (a) {
if (this.minX > this.maxX || this.minY > this.maxY) {
return qb.EMPTY;
} else {
(a = a || new qb(0, 0, 1, 1)).x = this.minX;
a.y = this.minY;
a.width = this.maxX - this.minX;
a.height = this.maxY - this.minY;
return a;
}
};
a.prototype.addPoint = function (a) {
this.minX = Math.min(this.minX, a.x);
this.maxX = Math.max(this.maxX, a.x);
this.minY = Math.min(this.minY, a.y);
this.maxY = Math.max(this.maxY, a.y);
};
a.prototype.addPointMatrix = function (a, b) {
var c = a.a;
var d = a.b;
var e = a.c;
var f = a.d;
var g = a.tx;
var h = a.ty;
var i = c * b.x + e * b.y + g;
var j = d * b.x + f * b.y + h;
this.minX = Math.min(this.minX, i);
this.maxX = Math.max(this.maxX, i);
this.minY = Math.min(this.minY, j);
this.maxY = Math.max(this.maxY, j);
};
a.prototype.addQuad = function (a) {
var b = this.minX;
var c = this.minY;
var d = this.maxX;
var e = this.maxY;
var f = a[0];
var g = a[1];
b = f < b ? f : b;
c = g < c ? g : c;
d = f > d ? f : d;
e = g > e ? g : e;
b = (f = a[2]) < b ? f : b;
c = (g = a[3]) < c ? g : c;
d = f > d ? f : d;
e = g > e ? g : e;
b = (f = a[4]) < b ? f : b;
c = (g = a[5]) < c ? g : c;
d = f > d ? f : d;
e = g > e ? g : e;
b = (f = a[6]) < b ? f : b;
c = (g = a[7]) < c ? g : c;
d = f > d ? f : d;
e = g > e ? g : e;
this.minX = b;
this.minY = c;
this.maxX = d;
this.maxY = e;
};
a.prototype.addFrame = function (a, b, c, d, e) {
this.addFrameMatrix(a.worldTransform, b, c, d, e);
};
a.prototype.addFrameMatrix = function (a, b, c, d, e) {
var f = a.a;
var g = a.b;
var h = a.c;
var i = a.d;
var j = a.tx;
var k = a.ty;
var l = this.minX;
var m = this.minY;
var n = this.maxX;
var o = this.maxY;
var p = f * b + h * c + j;
var q = g * b + i * c + k;
l = p < l ? p : l;
m = q < m ? q : m;
n = p > n ? p : n;
o = q > o ? q : o;
l = (p = f * d + h * c + j) < l ? p : l;
m = (q = g * d + i * c + k) < m ? q : m;
n = p > n ? p : n;
o = q > o ? q : o;
l = (p = f * b + h * e + j) < l ? p : l;
m = (q = g * b + i * e + k) < m ? q : m;
n = p > n ? p : n;
o = q > o ? q : o;
l = (p = f * d + h * e + j) < l ? p : l;
m = (q = g * d + i * e + k) < m ? q : m;
n = p > n ? p : n;
o = q > o ? q : o;
this.minX = l;
this.minY = m;
this.maxX = n;
this.maxY = o;
};
a.prototype.addVertexData = function (a, b, c) {
for (var d = this.minX, e = this.minY, f = this.maxX, g = this.maxY, h = b; h < c; h += 2) {
var i = a[h];
var j = a[h + 1];
d = i < d ? i : d;
e = j < e ? j : e;
f = i > f ? i : f;
g = j > g ? j : g;
}
this.minX = d;
this.minY = e;
this.maxX = f;
this.maxY = g;
};
a.prototype.addVertices = function (a, b, c, d) {
this.addVerticesMatrix(a.worldTransform, b, c, d);
};
a.prototype.addVerticesMatrix = function (a, b, c, d, e, f) {
if (e === undefined) {
e = 0;
}
if (f === undefined) {
f = e;
}
for (var g = a.a, h = a.b, i = a.c, j = a.d, k = a.tx, l = a.ty, m = this.minX, n = this.minY, o = this.maxX, p = this.maxY, q = c; q < d; q += 2) {
var r = b[q];
var s = b[q + 1];
var t = g * r + i * s + k;
var u = j * s + h * r + l;
m = Math.min(m, t - e);
o = Math.max(o, t + e);
n = Math.min(n, u - f);
p = Math.max(p, u + f);
}
this.minX = m;
this.minY = n;
this.maxX = o;
this.maxY = p;
};
a.prototype.addBounds = function (a) {
var b = this.minX;
var c = this.minY;
var d = this.maxX;
var e = this.maxY;
this.minX = a.minX < b ? a.minX : b;
this.minY = a.minY < c ? a.minY : c;
this.maxX = a.maxX > d ? a.maxX : d;
this.maxY = a.maxY > e ? a.maxY : e;
};
a.prototype.addBoundsMask = function (a, b) {
var c = a.minX > b.minX ? a.minX : b.minX;
var d = a.minY > b.minY ? a.minY : b.minY;
var e = a.maxX < b.maxX ? a.maxX : b.maxX;
var f = a.maxY < b.maxY ? a.maxY : b.maxY;
if (c <= e && d <= f) {
var g = this.minX;
var h = this.minY;
var i = this.maxX;
var j = this.maxY;
this.minX = c < g ? c : g;
this.minY = d < h ? d : h;
this.maxX = e > i ? e : i;
this.maxY = f > j ? f : j;
}
};
a.prototype.addBoundsMatrix = function (a, b) {
this.addFrameMatrix(b, a.minX, a.minY, a.maxX, a.maxY);
};
a.prototype.addBoundsArea = function (a, b) {
var c = a.minX > b.x ? a.minX : b.x;
var d = a.minY > b.y ? a.minY : b.y;
var e = a.maxX < b.x + b.width ? a.maxX : b.x + b.width;
var f = a.maxY < b.y + b.height ? a.maxY : b.y + b.height;
if (c <= e && d <= f) {
var g = this.minX;
var h = this.minY;
var i = this.maxX;
var j = this.maxY;
this.minX = c < g ? c : g;
this.minY = d < h ? d : h;
this.maxX = e > i ? e : i;
this.maxY = f > j ? f : j;
}
};
a.prototype.pad = function (a, b) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = a;
}
if (!this.isEmpty()) {
this.minX -= a;
this.maxX += a;
this.minY -= b;
this.maxY += b;
}
};
a.prototype.addFramePad = function (a, b, c, d, e, f) {
a -= e;
b -= f;
c += e;
d += f;
this.minX = this.minX < a ? this.minX : a;
this.maxX = this.maxX > c ? this.maxX : c;
this.minY = this.minY < b ? this.minY : b;
this.maxY = this.maxY > d ? this.maxY : d;
};
return a;
}();
function Hb(a, b) {
Hb = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return Hb(a, b);
}
function Ib(a, b) {
function c() {
this.constructor = a;
}
Hb(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
}
var Jb;
var Kb;
var Lb;
var Mb;
var Nb;
var Ob;
var Pb;
var Qb;
var Rb;
var Sb;
var Tb;
var Ub;
var Vb;
var Wb;
var Xb;
var Yb;
var Zb;
var $b;
var _b;
var ac = function (a) {
function b() {
var b = a.call(this) || this;
b.tempDisplayObjectParent = null;
b.transform = new Fb();
b.alpha = 1;
b.visible = true;
b.renderable = true;
b.cullable = false;
b.cullArea = null;
b.parent = null;
b.worldAlpha = 1;
b._lastSortedIndex = 0;
b._zIndex = 0;
b.filterArea = null;
b.filters = null;
b._enabledFilters = null;
b._bounds = new Gb();
b._localBounds = null;
b._boundsID = 0;
b._boundsRect = null;
b._localBoundsRect = null;
b._mask = null;
b._maskRefCount = 0;
b._destroyed = false;
b.isSprite = false;
b.isMask = false;
return b;
}
Ib(b, a);
b.mixin = function (a) {
for (var c = Object.keys(a), d = 0; d < c.length; ++d) {
var e = c[d];
Object.defineProperty(b.prototype, e, Object.getOwnPropertyDescriptor(a, e));
}
};
Object.defineProperty(b.prototype, "destroyed", {
get: function () {
return this._destroyed;
},
enumerable: false,
configurable: true
});
b.prototype._recursivePostUpdateTransform = function () {
if (this.parent) {
this.parent._recursivePostUpdateTransform();
this.transform.updateTransform(this.parent.transform);
} else {
this.transform.updateTransform(this._tempDisplayObjectParent.transform);
}
};
b.prototype.updateTransform = function () {
this._boundsID++;
this.transform.updateTransform(this.parent.transform);
this.worldAlpha = this.alpha * this.parent.worldAlpha;
};
b.prototype.getBounds = function (a, b) {
if (!a) {
if (this.parent) {
this._recursivePostUpdateTransform();
this.updateTransform();
} else {
this.parent = this._tempDisplayObjectParent;
this.updateTransform();
this.parent = null;
}
}
if (this._bounds.updateID !== this._boundsID) {
this.calculateBounds();
this._bounds.updateID = this._boundsID;
}
if (!b) {
this._boundsRect ||= new qb();
b = this._boundsRect;
}
return this._bounds.getRectangle(b);
};
b.prototype.getLocalBounds = function (a) {
if (!a) {
this._localBoundsRect ||= new qb();
a = this._localBoundsRect;
}
this._localBounds ||= new Gb();
var b = this.transform;
var c = this.parent;
this.parent = null;
this.transform = this._tempDisplayObjectParent.transform;
var d = this._bounds;
var e = this._boundsID;
this._bounds = this._localBounds;
var f = this.getBounds(false, a);
this.parent = c;
this.transform = b;
this._bounds = d;
this._bounds.updateID += this._boundsID - e;
return f;
};
b.prototype.toGlobal = function (a, b, c) {
if (c === undefined) {
c = false;
}
if (!c) {
this._recursivePostUpdateTransform();
if (this.parent) {
this.displayObjectUpdateTransform();
} else {
this.parent = this._tempDisplayObjectParent;
this.displayObjectUpdateTransform();
this.parent = null;
}
}
return this.worldTransform.apply(a, b);
};
b.prototype.toLocal = function (a, b, c, d) {
if (b) {
a = b.toGlobal(a, c, d);
}
if (!d) {
this._recursivePostUpdateTransform();
if (this.parent) {
this.displayObjectUpdateTransform();
} else {
this.parent = this._tempDisplayObjectParent;
this.displayObjectUpdateTransform();
this.parent = null;
}
}
return this.worldTransform.applyInverse(a, c);
};
b.prototype.setParent = function (a) {
if (!a || !a.addChild) {
throw new Error("setParent: Argument must be a Container");
}
a.addChild(this);
return a;
};
b.prototype.setTransform = function (a, b, c, d, e, f, g, h, i) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = 0;
}
if (c === undefined) {
c = 1;
}
if (d === undefined) {
d = 1;
}
if (e === undefined) {
e = 0;
}
if (f === undefined) {
f = 0;
}
if (g === undefined) {
g = 0;
}
if (h === undefined) {
h = 0;
}
if (i === undefined) {
i = 0;
}
this.position.x = a;
this.position.y = b;
this.scale.x = c || 1;
this.scale.y = d || 1;
this.rotation = e;
this.skew.x = f;
this.skew.y = g;
this.pivot.x = h;
this.pivot.y = i;
return this;
};
b.prototype.destroy = function (a) {
if (this.parent) {
this.parent.removeChild(this);
}
this.emit("destroyed");
this.removeAllListeners();
this.transform = null;
this.parent = null;
this._bounds = null;
this.mask = null;
this.cullArea = null;
this.filters = null;
this.filterArea = null;
this.hitArea = null;
this.interactive = false;
this.interactiveChildren = false;
this._destroyed = true;
};
Object.defineProperty(b.prototype, "_tempDisplayObjectParent", {
get: function () {
if (this.tempDisplayObjectParent === null) {
this.tempDisplayObjectParent = new bc();
}
return this.tempDisplayObjectParent;
},
enumerable: false,
configurable: true
});
b.prototype.enableTempParent = function () {
var a = this.parent;
this.parent = this._tempDisplayObjectParent;
return a;
};
b.prototype.disableTempParent = function (a) {
this.parent = a;
};
Object.defineProperty(b.prototype, "x", {
get: function () {
return this.position.x;
},
set: function (a) {
this.transform.position.x = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "y", {
get: function () {
return this.position.y;
},
set: function (a) {
this.transform.position.y = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "worldTransform", {
get: function () {
return this.transform.worldTransform;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "localTransform", {
get: function () {
return this.transform.localTransform;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "position", {
get: function () {
return this.transform.position;
},
set: function (a) {
this.transform.position.copyFrom(a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "scale", {
get: function () {
return this.transform.scale;
},
set: function (a) {
this.transform.scale.copyFrom(a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "pivot", {
get: function () {
return this.transform.pivot;
},
set: function (a) {
this.transform.pivot.copyFrom(a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "skew", {
get: function () {
return this.transform.skew;
},
set: function (a) {
this.transform.skew.copyFrom(a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "rotation", {
get: function () {
return this.transform.rotation;
},
set: function (a) {
this.transform.rotation = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "angle", {
get: function () {
return this.transform.rotation * mb;
},
set: function (a) {
this.transform.rotation = a * nb;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "zIndex", {
get: function () {
return this._zIndex;
},
set: function (a) {
this._zIndex = a;
if (this.parent) {
this.parent.sortDirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "worldVisible", {
get: function () {
var a = this;
do {
if (!a.visible) {
return false;
}
a = a.parent;
} while (a);
return true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "mask", {
get: function () {
return this._mask;
},
set: function (a) {
var b;
if (this._mask !== a) {
if (this._mask) {
(b = this._mask.maskObject || this._mask)._maskRefCount--;
if (b._maskRefCount === 0) {
b.renderable = true;
b.isMask = false;
}
}
this._mask = a;
if (this._mask) {
if ((b = this._mask.maskObject || this._mask)._maskRefCount === 0) {
b.renderable = false;
b.isMask = true;
}
b._maskRefCount++;
}
}
},
enumerable: false,
configurable: true
});
return b;
}(Ha());
var bc = function (a) {
function b() {
var b = a !== null && a.apply(this, arguments) || this;
b.sortDirty = null;
return b;
}
Ib(b, a);
return b;
}(ac);
function cc(a, b) {
if (a.zIndex === b.zIndex) {
return a._lastSortedIndex - b._lastSortedIndex;
} else {
return a.zIndex - b.zIndex;
}
}
ac.prototype.displayObjectUpdateTransform = ac.prototype.updateTransform;
(function (a) {
a[a.WEBGL_LEGACY = 0] = "WEBGL_LEGACY";
a[a.WEBGL = 1] = "WEBGL";
a[a.WEBGL2 = 2] = "WEBGL2";
})(Jb ||= {});
(function (a) {
a[a.UNKNOWN = 0] = "UNKNOWN";
a[a.WEBGL = 1] = "WEBGL";
a[a.CANVAS = 2] = "CANVAS";
})(Kb ||= {});
(function (a) {
a[a.COLOR = 16384] = "COLOR";
a[a.DEPTH = 256] = "DEPTH";
a[a.STENCIL = 1024] = "STENCIL";
})(Lb ||= {});
(function (a) {
a[a.NORMAL = 0] = "NORMAL";
a[a.ADD = 1] = "ADD";
a[a.MULTIPLY = 2] = "MULTIPLY";
a[a.SCREEN = 3] = "SCREEN";
a[a.OVERLAY = 4] = "OVERLAY";
a[a.DARKEN = 5] = "DARKEN";
a[a.LIGHTEN = 6] = "LIGHTEN";
a[a.COLOR_DODGE = 7] = "COLOR_DODGE";
a[a.COLOR_BURN = 8] = "COLOR_BURN";
a[a.HARD_LIGHT = 9] = "HARD_LIGHT";
a[a.SOFT_LIGHT = 10] = "SOFT_LIGHT";
a[a.DIFFERENCE = 11] = "DIFFERENCE";
a[a.EXCLUSION = 12] = "EXCLUSION";
a[a.HUE = 13] = "HUE";
a[a.SATURATION = 14] = "SATURATION";
a[a.COLOR = 15] = "COLOR";
a[a.LUMINOSITY = 16] = "LUMINOSITY";
a[a.NORMAL_NPM = 17] = "NORMAL_NPM";
a[a.ADD_NPM = 18] = "ADD_NPM";
a[a.SCREEN_NPM = 19] = "SCREEN_NPM";
a[a.NONE = 20] = "NONE";
a[a.SRC_OVER = 0] = "SRC_OVER";
a[a.SRC_IN = 21] = "SRC_IN";
a[a.SRC_OUT = 22] = "SRC_OUT";
a[a.SRC_ATOP = 23] = "SRC_ATOP";
a[a.DST_OVER = 24] = "DST_OVER";
a[a.DST_IN = 25] = "DST_IN";
a[a.DST_OUT = 26] = "DST_OUT";
a[a.DST_ATOP = 27] = "DST_ATOP";
a[a.ERASE = 26] = "ERASE";
a[a.SUBTRACT = 28] = "SUBTRACT";
a[a.XOR = 29] = "XOR";
})(Mb ||= {});
(function (a) {
a[a.POINTS = 0] = "POINTS";
a[a.LINES = 1] = "LINES";
a[a.LINE_LOOP = 2] = "LINE_LOOP";
a[a.LINE_STRIP = 3] = "LINE_STRIP";
a[a.TRIANGLES = 4] = "TRIANGLES";
a[a.TRIANGLE_STRIP = 5] = "TRIANGLE_STRIP";
a[a.TRIANGLE_FAN = 6] = "TRIANGLE_FAN";
})(Nb ||= {});
(function (a) {
a[a.RGBA = 6408] = "RGBA";
a[a.RGB = 6407] = "RGB";
a[a.RG = 33319] = "RG";
a[a.RED = 6403] = "RED";
a[a.RGBA_INTEGER = 36249] = "RGBA_INTEGER";
a[a.RGB_INTEGER = 36248] = "RGB_INTEGER";
a[a.RG_INTEGER = 33320] = "RG_INTEGER";
a[a.RED_INTEGER = 36244] = "RED_INTEGER";
a[a.ALPHA = 6406] = "ALPHA";
a[a.LUMINANCE = 6409] = "LUMINANCE";
a[a.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA";
a[a.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT";
a[a.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL";
})(Ob ||= {});
(function (a) {
a[a.TEXTURE_2D = 3553] = "TEXTURE_2D";
a[a.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP";
a[a.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY";
a[a.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z";
})(Pb ||= {});
(function (a) {
a[a.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE";
a[a.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT";
a[a.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5";
a[a.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4";
a[a.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1";
a[a.UNSIGNED_INT = 5125] = "UNSIGNED_INT";
a[a.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV";
a[a.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV";
a[a.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8";
a[a.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV";
a[a.BYTE = 5120] = "BYTE";
a[a.SHORT = 5122] = "SHORT";
a[a.INT = 5124] = "INT";
a[a.FLOAT = 5126] = "FLOAT";
a[a.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV";
a[a.HALF_FLOAT = 36193] = "HALF_FLOAT";
})(Qb ||= {});
(function (a) {
a[a.FLOAT = 0] = "FLOAT";
a[a.INT = 1] = "INT";
a[a.UINT = 2] = "UINT";
})(Rb ||= {});
(function (a) {
a[a.NEAREST = 0] = "NEAREST";
a[a.LINEAR = 1] = "LINEAR";
})(Sb ||= {});
(function (a) {
a[a.CLAMP = 33071] = "CLAMP";
a[a.REPEAT = 10497] = "REPEAT";
a[a.MIRRORED_REPEAT = 33648] = "MIRRORED_REPEAT";
})(Tb ||= {});
(function (a) {
a[a.OFF = 0] = "OFF";
a[a.POW2 = 1] = "POW2";
a[a.ON = 2] = "ON";
a[a.ON_MANUAL = 3] = "ON_MANUAL";
})(Ub ||= {});
(function (a) {
a[a.NPM = 0] = "NPM";
a[a.UNPACK = 1] = "UNPACK";
a[a.PMA = 2] = "PMA";
a[a.NO_PREMULTIPLIED_ALPHA = 0] = "NO_PREMULTIPLIED_ALPHA";
a[a.PREMULTIPLY_ON_UPLOAD = 1] = "PREMULTIPLY_ON_UPLOAD";
a[a.PREMULTIPLY_ALPHA = 2] = "PREMULTIPLY_ALPHA";
a[a.PREMULTIPLIED_ALPHA = 2] = "PREMULTIPLIED_ALPHA";
})(Vb ||= {});
(function (a) {
a[a.NO = 0] = "NO";
a[a.YES = 1] = "YES";
a[a.AUTO = 2] = "AUTO";
a[a.BLEND = 0] = "BLEND";
a[a.CLEAR = 1] = "CLEAR";
a[a.BLIT = 2] = "BLIT";
})(Wb ||= {});
(function (a) {
a[a.AUTO = 0] = "AUTO";
a[a.MANUAL = 1] = "MANUAL";
})(Xb ||= {});
(function (a) {
a.LOW = "lowp";
a.MEDIUM = "mediump";
a.HIGH = "highp";
})(Yb ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.SCISSOR = 1] = "SCISSOR";
a[a.STENCIL = 2] = "STENCIL";
a[a.SPRITE = 3] = "SPRITE";
})(Zb ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.LOW = 2] = "LOW";
a[a.MEDIUM = 4] = "MEDIUM";
a[a.HIGH = 8] = "HIGH";
})($b ||= {});
(function (a) {
a[a.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER";
a[a.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER";
a[a.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER";
})(_b ||= {});
var dc = function (a) {
function b() {
var b = a.call(this) || this;
b.children = [];
b.sortableChildren = Fa.SORTABLE_CHILDREN;
b.sortDirty = false;
return b;
}
Ib(b, a);
b.prototype.onChildrenChange = function (a) {};
b.prototype.addChild = function () {
for (var a = arguments, b = [], c = 0; c < arguments.length; c++) {
b[c] = a[c];
}
if (b.length > 1) {
for (var d = 0; d < b.length; d++) {
this.addChild(b[d]);
}
} else {
var e = b[0];
if (e.parent) {
e.parent.removeChild(e);
}
e.parent = this;
this.sortDirty = true;
e.transform._parentID = -1;
this.children.push(e);
this._boundsID++;
this.onChildrenChange(this.children.length - 1);
this.emit("childAdded", e, this, this.children.length - 1);
e.emit("added", this);
}
return b[0];
};
b.prototype.addChildAt = function (a, b) {
if (b < 0 || b > this.children.length) {
throw new Error(a + "addChildAt: The index " + b + " supplied is out of bounds " + this.children.length);
}
if (a.parent) {
a.parent.removeChild(a);
}
a.parent = this;
this.sortDirty = true;
a.transform._parentID = -1;
this.children.splice(b, 0, a);
this._boundsID++;
this.onChildrenChange(b);
a.emit("added", this);
this.emit("childAdded", a, this, b);
return a;
};
b.prototype.swapChildren = function (a, b) {
if (a !== b) {
var c = this.getChildIndex(a);
var d = this.getChildIndex(b);
this.children[c] = b;
this.children[d] = a;
this.onChildrenChange(c < d ? c : d);
}
};
b.prototype.getChildIndex = function (a) {
var b = this.children.indexOf(a);
if (b === -1) {
throw new Error("The supplied DisplayObject must be a child of the caller");
}
return b;
};
b.prototype.setChildIndex = function (a, b) {
if (b < 0 || b >= this.children.length) {
throw new Error("The index " + b + " supplied is out of bounds " + this.children.length);
}
var c = this.getChildIndex(a);
$a(this.children, c, 1);
this.children.splice(b, 0, a);
this.onChildrenChange(b);
};
b.prototype.getChildAt = function (a) {
if (a < 0 || a >= this.children.length) {
throw new Error("getChildAt: Index (" + a + ") does not exist.");
}
return this.children[a];
};
b.prototype.removeChild = function () {
for (var a = arguments, b = [], c = 0; c < arguments.length; c++) {
b[c] = a[c];
}
if (b.length > 1) {
for (var d = 0; d < b.length; d++) {
this.removeChild(b[d]);
}
} else {
var e = b[0];
var f = this.children.indexOf(e);
if (f === -1) {
return null;
}
e.parent = null;
e.transform._parentID = -1;
$a(this.children, f, 1);
this._boundsID++;
this.onChildrenChange(f);
e.emit("removed", this);
this.emit("childRemoved", e, this, f);
}
return b[0];
};
b.prototype.removeChildAt = function (a) {
var b = this.getChildAt(a);
b.parent = null;
b.transform._parentID = -1;
$a(this.children, a, 1);
this._boundsID++;
this.onChildrenChange(a);
b.emit("removed", this);
this.emit("childRemoved", b, this, a);
return b;
};
b.prototype.removeChildren = function (a, b) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = this.children.length;
}
var c;
var d = a;
var e = b - d;
if (e > 0 && e <= b) {
c = this.children.splice(d, e);
for (var f = 0; f < c.length; ++f) {
c[f].parent = null;
if (c[f].transform) {
c[f].transform._parentID = -1;
}
}
this._boundsID++;
this.onChildrenChange(a);
f = 0;
for (; f < c.length; ++f) {
c[f].emit("removed", this);
this.emit("childRemoved", c[f], this, f);
}
return c;
}
if (e === 0 && this.children.length === 0) {
return [];
}
throw new RangeError("removeChildren: numeric values are outside the acceptable range.");
};
b.prototype.sortChildren = function () {
for (var a = false, b = 0, c = this.children.length; b < c; ++b) {
var d = this.children[b];
d._lastSortedIndex = b;
if (!a && d.zIndex !== 0) {
a = true;
}
}
if (a && this.children.length > 1) {
this.children.sort(cc);
}
this.sortDirty = false;
};
b.prototype.updateTransform = function () {
if (this.sortableChildren && this.sortDirty) {
this.sortChildren();
}
this._boundsID++;
this.transform.updateTransform(this.parent.transform);
this.worldAlpha = this.alpha * this.parent.worldAlpha;
for (var a = 0, b = this.children.length; a < b; ++a) {
var c = this.children[a];
if (c.visible) {
c.updateTransform();
}
}
};
b.prototype.calculateBounds = function () {
this._bounds.clear();
this._calculateBounds();
for (var a = 0; a < this.children.length; a++) {
var b = this.children[a];
if (b.visible && b.renderable) {
b.calculateBounds();
if (b._mask) {
var c = b._mask.maskObject || b._mask;
c.calculateBounds();
this._bounds.addBoundsMask(b._bounds, c._bounds);
} else if (b.filterArea) {
this._bounds.addBoundsArea(b._bounds, b.filterArea);
} else {
this._bounds.addBounds(b._bounds);
}
}
}
this._bounds.updateID = this._boundsID;
};
b.prototype.getLocalBounds = function (b, c) {
if (c === undefined) {
c = false;
}
var d = a.prototype.getLocalBounds.call(this, b);
if (!c) {
for (var e = 0, f = this.children.length; e < f; ++e) {
var g = this.children[e];
if (g.visible) {
g.updateTransform();
}
}
}
return d;
};
b.prototype._calculateBounds = function () {};
b.prototype._renderWithCulling = function (a) {
var c = a.renderTexture.sourceFrame;
if (c.width > 0 && c.height > 0) {
var d;
var e;
if (this.cullArea) {
d = this.cullArea;
e = this.worldTransform;
} else if (this._render !== b.prototype._render) {
d = this.getBounds(true);
}
if (d && c.intersects(d, e)) {
this._render(a);
} else if (this.cullArea) {
return;
}
for (var f = 0, g = this.children.length; f < g; ++f) {
var h = this.children[f];
var i = h.cullable;
h.cullable = i || !this.cullArea;
h.render(a);
h.cullable = i;
}
}
};
b.prototype.render = function (a) {
if (this.visible && this.worldAlpha > 0 && this.renderable) {
if (this._mask || this.filters && this.filters.length) {
this.renderAdvanced(a);
} else if (this.cullable) {
this._renderWithCulling(a);
} else {
this._render(a);
for (var b = 0, c = this.children.length; b < c; ++b) {
this.children[b].render(a);
}
}
}
};
b.prototype.renderAdvanced = function (a) {
var b = this.filters;
var c = this._mask;
if (b) {
this._enabledFilters ||= [];
this._enabledFilters.length = 0;
for (var d = 0; d < b.length; d++) {
if (b[d].enabled) {
this._enabledFilters.push(b[d]);
}
}
}
var e = b && this._enabledFilters && this._enabledFilters.length || c && (!c.isMaskData || c.enabled && (c.autoDetect || c.type !== Zb.NONE));
if (e) {
a.batch.flush();
}
if (b && this._enabledFilters && this._enabledFilters.length) {
a.filter.push(this, this._enabledFilters);
}
if (c) {
a.mask.push(this, this._mask);
}
if (this.cullable) {
this._renderWithCulling(a);
} else {
this._render(a);
d = 0;
for (var f = this.children.length; d < f; ++d) {
this.children[d].render(a);
}
}
if (e) {
a.batch.flush();
}
if (c) {
a.mask.pop(this);
}
if (b && this._enabledFilters && this._enabledFilters.length) {
a.filter.pop();
}
};
b.prototype._render = function (a) {};
b.prototype.destroy = function (b) {
a.prototype.destroy.call(this);
this.sortDirty = false;
var c = typeof b == "boolean" ? b : b && b.children;
var d = this.removeChildren(0, this.children.length);
if (c) {
for (var e = 0; e < d.length; ++e) {
d[e].destroy(b);
}
}
};
Object.defineProperty(b.prototype, "width", {
get: function () {
return this.scale.x * this.getLocalBounds().width;
},
set: function (a) {
var b = this.getLocalBounds().width;
this.scale.x = b !== 0 ? a / b : 1;
this._width = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "height", {
get: function () {
return this.scale.y * this.getLocalBounds().height;
},
set: function (a) {
var b = this.getLocalBounds().height;
this.scale.y = b !== 0 ? a / b : 1;
this._height = a;
},
enumerable: false,
configurable: true
});
return b;
}(ac);
dc.prototype.containerUpdateTransform = dc.prototype.updateTransform;
ac.mixin({
accessible: false,
accessibleTitle: null,
accessibleHint: null,
tabIndex: 0,
_accessibleActive: false,
_accessibleDiv: null,
accessibleType: "button",
accessiblePointerEvents: "auto",
accessibleChildren: true,
renderId: -1
});
var ec;
var fc = 100;
var gc = function () {
function a(a) {
this.debug = false;
this._isActive = false;
this._isMobileAccessibility = false;
this.pool = [];
this.renderId = 0;
this.children = [];
this.androidUpdateCount = 0;
this.androidUpdateFrequency = 500;
this._hookDiv = null;
if (la.tablet || la.phone) {
this.createTouchHook();
}
var b = document.createElement("div");
b.style.width = fc + "px";
b.style.height = fc + "px";
b.style.position = "absolute";
b.style.top = "0px";
b.style.left = "0px";
b.style.zIndex = 2 .toString();
this.div = b;
this.renderer = a;
this._onKeyDown = this._onKeyDown.bind(this);
this._onMouseMove = this._onMouseMove.bind(this);
globalThis.addEventListener("keydown", this._onKeyDown, false);
}
Object.defineProperty(a.prototype, "isActive", {
get: function () {
return this._isActive;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "isMobileAccessibility", {
get: function () {
return this._isMobileAccessibility;
},
enumerable: false,
configurable: true
});
a.prototype.createTouchHook = function () {
var a = this;
var b = document.createElement("button");
b.style.width = "1px";
b.style.height = "1px";
b.style.position = "absolute";
b.style.top = "-1000px";
b.style.left = "-1000px";
b.style.zIndex = 2 .toString();
b.style.backgroundColor = "#FF0000";
b.title = "select to enable accessibility for this content";
b.addEventListener("focus", function () {
a._isMobileAccessibility = true;
a.activate();
a.destroyTouchHook();
});
document.body.appendChild(b);
this._hookDiv = b;
};
a.prototype.destroyTouchHook = function () {
if (this._hookDiv) {
document.body.removeChild(this._hookDiv);
this._hookDiv = null;
}
};
a.prototype.activate = function () {
var a;
if (!this._isActive) {
this._isActive = true;
globalThis.document.addEventListener("mousemove", this._onMouseMove, true);
globalThis.removeEventListener("keydown", this._onKeyDown, false);
this.renderer.on("postrender", this.update, this);
if ((a = this.renderer.view.parentNode) !== null && a !== undefined) {
a.appendChild(this.div);
}
}
};
a.prototype.deactivate = function () {
var a;
if (this._isActive && !this._isMobileAccessibility) {
this._isActive = false;
globalThis.document.removeEventListener("mousemove", this._onMouseMove, true);
globalThis.addEventListener("keydown", this._onKeyDown, false);
this.renderer.off("postrender", this.update);
if ((a = this.div.parentNode) !== null && a !== undefined) {
a.removeChild(this.div);
}
}
};
a.prototype.updateAccessibleObjects = function (a) {
if (a.visible && a.accessibleChildren) {
if (a.accessible && a.interactive) {
if (!a._accessibleActive) {
this.addChild(a);
}
a.renderId = this.renderId;
}
var b = a.children;
if (b) {
for (var c = 0; c < b.length; c++) {
this.updateAccessibleObjects(b[c]);
}
}
}
};
a.prototype.update = function () {
var a = performance.now();
if ((!la.android.device || a >= this.androidUpdateCount) && (this.androidUpdateCount = a + this.androidUpdateFrequency, this.renderer.renderingToScreen)) {
if (this.renderer._lastObjectRendered) {
this.updateAccessibleObjects(this.renderer._lastObjectRendered);
}
var b = this.renderer.view.getBoundingClientRect();
var c = b.left;
var d = b.top;
var e = b.width;
var f = b.height;
var g = this.renderer;
var h = g.width;
var i = g.height;
var j = g.resolution;
var k = e / h * j;
var l = f / i * j;
var m = this.div;
m.style.left = c + "px";
m.style.top = d + "px";
m.style.width = h + "px";
m.style.height = i + "px";
for (var n = 0; n < this.children.length; n++) {
var o = this.children[n];
if (o.renderId !== this.renderId) {
o._accessibleActive = false;
$a(this.children, n, 1);
this.div.removeChild(o._accessibleDiv);
this.pool.push(o._accessibleDiv);
o._accessibleDiv = null;
n--;
} else {
m = o._accessibleDiv;
var p = o.hitArea;
var q = o.worldTransform;
if (o.hitArea) {
m.style.left = (q.tx + p.x * q.a) * k + "px";
m.style.top = (q.ty + p.y * q.d) * l + "px";
m.style.width = p.width * q.a * k + "px";
m.style.height = p.height * q.d * l + "px";
} else {
p = o.getBounds();
this.capHitArea(p);
m.style.left = p.x * k + "px";
m.style.top = p.y * l + "px";
m.style.width = p.width * k + "px";
m.style.height = p.height * l + "px";
if (m.title !== o.accessibleTitle && o.accessibleTitle !== null) {
m.title = o.accessibleTitle;
}
if (m.getAttribute("aria-label") !== o.accessibleHint && o.accessibleHint !== null) {
m.setAttribute("aria-label", o.accessibleHint);
}
}
if (o.accessibleTitle !== m.title || o.tabIndex !== m.tabIndex) {
m.title = o.accessibleTitle;
m.tabIndex = o.tabIndex;
if (this.debug) {
this.updateDebugHTML(m);
}
}
}
}
this.renderId++;
}
};
a.prototype.updateDebugHTML = function (a) {
a.innerHTML = "type: " + a.type + "</br> title : " + a.title + "</br> tabIndex: " + a.tabIndex;
};
a.prototype.capHitArea = function (a) {
if (a.x < 0) {
a.width += a.x;
a.x = 0;
}
if (a.y < 0) {
a.height += a.y;
a.y = 0;
}
var b = this.renderer;
var c = b.width;
var d = b.height;
if (a.x + a.width > c) {
a.width = c - a.x;
}
if (a.y + a.height > d) {
a.height = d - a.y;
}
};
a.prototype.addChild = function (a) {
var b = this.pool.pop();
if (!b) {
(b = document.createElement("button")).style.width = fc + "px";
b.style.height = fc + "px";
b.style.backgroundColor = this.debug ? "rgba(255,255,255,0.5)" : "transparent";
b.style.position = "absolute";
b.style.zIndex = 2 .toString();
b.style.borderStyle = "none";
if (navigator.userAgent.toLowerCase().indexOf("chrome") > -1) {
b.setAttribute("aria-live", "off");
} else {
b.setAttribute("aria-live", "polite");
}
if (navigator.userAgent.match(/rv:.*Gecko\//)) {
b.setAttribute("aria-relevant", "additions");
} else {
b.setAttribute("aria-relevant", "text");
}
b.addEventListener("click", this._onClick.bind(this));
b.addEventListener("focus", this._onFocus.bind(this));
b.addEventListener("focusout", this._onFocusOut.bind(this));
}
b.style.pointerEvents = a.accessiblePointerEvents;
b.type = a.accessibleType;
if (a.accessibleTitle && a.accessibleTitle !== null) {
b.title = a.accessibleTitle;
} else if (!a.accessibleHint || a.accessibleHint === null) {
b.title = "displayObject " + a.tabIndex;
}
if (a.accessibleHint && a.accessibleHint !== null) {
b.setAttribute("aria-label", a.accessibleHint);
}
if (this.debug) {
this.updateDebugHTML(b);
}
a._accessibleActive = true;
a._accessibleDiv = b;
b.displayObject = a;
this.children.push(a);
this.div.appendChild(a._accessibleDiv);
a._accessibleDiv.tabIndex = a.tabIndex;
};
a.prototype._onClick = function (a) {
var b = this.renderer.plugins.interaction;
var c = a.target.displayObject;
var d = b.eventData;
b.dispatchEvent(c, "click", d);
b.dispatchEvent(c, "pointertap", d);
b.dispatchEvent(c, "tap", d);
};
a.prototype._onFocus = function (a) {
if (!a.target.getAttribute("aria-live")) {
a.target.setAttribute("aria-live", "assertive");
}
var b = this.renderer.plugins.interaction;
var c = a.target.displayObject;
var d = b.eventData;
b.dispatchEvent(c, "mouseover", d);
};
a.prototype._onFocusOut = function (a) {
if (!a.target.getAttribute("aria-live")) {
a.target.setAttribute("aria-live", "polite");
}
var b = this.renderer.plugins.interaction;
var c = a.target.displayObject;
var d = b.eventData;
b.dispatchEvent(c, "mouseout", d);
};
a.prototype._onKeyDown = function (a) {
if (a.keyCode === 9) {
this.activate();
}
};
a.prototype._onMouseMove = function (a) {
if (a.movementX !== 0 || a.movementY !== 0) {
this.deactivate();
}
};
a.prototype.destroy = function () {
this.destroyTouchHook();
this.div = null;
globalThis.document.removeEventListener("mousemove", this._onMouseMove, true);
globalThis.removeEventListener("keydown", this._onKeyDown);
this.pool = null;
this.children = null;
this.renderer = null;
};
return a;
}();
Fa.TARGET_FPMS = 0.06;
(function (a) {
a[a.INTERACTION = 50] = "INTERACTION";
a[a.HIGH = 25] = "HIGH";
a[a.NORMAL = 0] = "NORMAL";
a[a.LOW = -25] = "LOW";
a[a.UTILITY = -50] = "UTILITY";
})(ec ||= {});
var hc = function () {
function a(a, b, c, d) {
if (b === undefined) {
b = null;
}
if (c === undefined) {
c = 0;
}
if (d === undefined) {
d = false;
}
this.next = null;
this.previous = null;
this._destroyed = false;
this.fn = a;
this.context = b;
this.priority = c;
this.once = d;
}
a.prototype.match = function (a, b) {
if (b === undefined) {
b = null;
}
return this.fn === a && this.context === b;
};
a.prototype.emit = function (a) {
if (this.fn) {
if (this.context) {
this.fn.call(this.context, a);
} else {
this.fn(a);
}
}
var b = this.next;
if (this.once) {
this.destroy(true);
}
if (this._destroyed) {
this.next = null;
}
return b;
};
a.prototype.connect = function (a) {
this.previous = a;
if (a.next) {
a.next.previous = this;
}
this.next = a.next;
a.next = this;
};
a.prototype.destroy = function (a) {
if (a === undefined) {
a = false;
}
this._destroyed = true;
this.fn = null;
this.context = null;
if (this.previous) {
this.previous.next = this.next;
}
if (this.next) {
this.next.previous = this.previous;
}
var b = this.next;
this.next = a ? null : b;
this.previous = null;
return b;
};
return a;
}();
var ic = function () {
function a() {
var a = this;
this.autoStart = false;
this.deltaTime = 1;
this.lastTime = -1;
this.speed = 1;
this.started = false;
this._requestId = null;
this._maxElapsedMS = 100;
this._minElapsedMS = 0;
this._protected = false;
this._lastFrame = -1;
this._head = new hc(null, null, Infinity);
this.deltaMS = 1 / Fa.TARGET_FPMS;
this.elapsedMS = 1 / Fa.TARGET_FPMS;
this._tick = function (b) {
a._requestId = null;
if (a.started) {
a.update(b);
if (a.started && a._requestId === null && a._head.next) {
a._requestId = requestAnimationFrame(a._tick);
}
}
};
}
a.prototype._requestIfNeeded = function () {
if (this._requestId === null && this._head.next) {
this.lastTime = performance.now();
this._lastFrame = this.lastTime;
this._requestId = requestAnimationFrame(this._tick);
}
};
a.prototype._cancelIfNeeded = function () {
if (this._requestId !== null) {
cancelAnimationFrame(this._requestId);
this._requestId = null;
}
};
a.prototype._startIfPossible = function () {
if (this.started) {
this._requestIfNeeded();
} else if (this.autoStart) {
this.start();
}
};
a.prototype.add = function (a, b, c) {
if (c === undefined) {
c = ec.NORMAL;
}
return this._addListener(new hc(a, b, c));
};
a.prototype.addOnce = function (a, b, c) {
if (c === undefined) {
c = ec.NORMAL;
}
return this._addListener(new hc(a, b, c, true));
};
a.prototype._addListener = function (a) {
var b = this._head.next;
var c = this._head;
if (b) {
while (b) {
if (a.priority > b.priority) {
a.connect(c);
break;
}
c = b;
b = b.next;
}
if (!a.previous) {
a.connect(c);
}
} else {
a.connect(c);
}
this._startIfPossible();
return this;
};
a.prototype.remove = function (a, b) {
for (var c = this._head.next; c;) {
c = c.match(a, b) ? c.destroy() : c.next;
}
if (!this._head.next) {
this._cancelIfNeeded();
}
return this;
};
Object.defineProperty(a.prototype, "count", {
get: function () {
if (!this._head) {
return 0;
}
for (var a = 0, b = this._head; b = b.next;) {
a++;
}
return a;
},
enumerable: false,
configurable: true
});
a.prototype.start = function () {
if (!this.started) {
this.started = true;
this._requestIfNeeded();
}
};
a.prototype.stop = function () {
if (this.started) {
this.started = false;
this._cancelIfNeeded();
}
};
a.prototype.destroy = function () {
if (!this._protected) {
this.stop();
for (var a = this._head.next; a;) {
a = a.destroy(true);
}
this._head.destroy();
this._head = null;
}
};
a.prototype.update = function (a) {
var b;
if (a === undefined) {
a = performance.now();
}
if (a > this.lastTime) {
if ((b = this.elapsedMS = a - this.lastTime) > this._maxElapsedMS) {
b = this._maxElapsedMS;
}
b *= this.speed;
if (this._minElapsedMS) {
var c = a - this._lastFrame | 0;
if (c < this._minElapsedMS) {
return;
}
this._lastFrame = a - c % this._minElapsedMS;
}
this.deltaMS = b;
this.deltaTime = this.deltaMS * Fa.TARGET_FPMS;
for (var d = this._head, e = d.next; e;) {
e = e.emit(this.deltaTime);
}
if (!d.next) {
this._cancelIfNeeded();
}
} else {
this.deltaTime = this.deltaMS = this.elapsedMS = 0;
}
this.lastTime = a;
};
Object.defineProperty(a.prototype, "FPS", {
get: function () {
return 1000 / this.elapsedMS;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "minFPS", {
get: function () {
return 1000 / this._maxElapsedMS;
},
set: function (a) {
var b = Math.min(this.maxFPS, a);
var c = Math.min(Math.max(0, b) / 1000, Fa.TARGET_FPMS);
this._maxElapsedMS = 1 / c;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "maxFPS", {
get: function () {
if (this._minElapsedMS) {
return Math.round(1000 / this._minElapsedMS);
} else {
return 0;
}
},
set: function (a) {
if (a === 0) {
this._minElapsedMS = 0;
} else {
var b = Math.max(this.minFPS, a);
this._minElapsedMS = 1 / (b / 1000);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a, "shared", {
get: function () {
if (!a._shared) {
var b = a._shared = new a();
b.autoStart = true;
b._protected = true;
}
return a._shared;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a, "system", {
get: function () {
if (!a._system) {
var b = a._system = new a();
b.autoStart = true;
b._protected = true;
}
return a._system;
},
enumerable: false,
configurable: true
});
return a;
}();
var jc = function () {
function a() {}
a.init = function (a) {
var b = this;
a = Object.assign({
autoStart: true,
sharedTicker: false
}, a);
Object.defineProperty(this, "ticker", {
set: function (a) {
if (this._ticker) {
this._ticker.remove(this.render, this);
}
this._ticker = a;
if (a) {
a.add(this.render, this, ec.LOW);
}
},
get: function () {
return this._ticker;
}
});
this.stop = function () {
b._ticker.stop();
};
this.start = function () {
b._ticker.start();
};
this._ticker = null;
this.ticker = a.sharedTicker ? ic.shared : new ic();
if (a.autoStart) {
this.start();
}
};
a.destroy = function () {
if (this._ticker) {
var a = this._ticker;
this.ticker = null;
a.destroy();
}
};
return a;
}();
var kc = function () {
function a() {
this.pressure = 0;
this.rotationAngle = 0;
this.twist = 0;
this.tangentialPressure = 0;
this.global = new ob();
this.target = null;
this.originalEvent = null;
this.identifier = null;
this.isPrimary = false;
this.button = 0;
this.buttons = 0;
this.width = 0;
this.height = 0;
this.tiltX = 0;
this.tiltY = 0;
this.pointerType = null;
this.pressure = 0;
this.rotationAngle = 0;
this.twist = 0;
this.tangentialPressure = 0;
}
Object.defineProperty(a.prototype, "pointerId", {
get: function () {
return this.identifier;
},
enumerable: false,
configurable: true
});
a.prototype.getLocalPosition = function (a, b, c) {
return a.worldTransform.applyInverse(c || this.global, b);
};
a.prototype.copyEvent = function (a) {
if ("isPrimary" in a && a.isPrimary) {
this.isPrimary = true;
}
this.button = "button" in a && a.button;
var b = "buttons" in a && a.buttons;
this.buttons = Number.isInteger(b) ? b : "which" in a && a.which;
this.width = "width" in a && a.width;
this.height = "height" in a && a.height;
this.tiltX = "tiltX" in a && a.tiltX;
this.tiltY = "tiltY" in a && a.tiltY;
this.pointerType = "pointerType" in a && a.pointerType;
this.pressure = "pressure" in a && a.pressure;
this.rotationAngle = "rotationAngle" in a && a.rotationAngle;
this.twist = "twist" in a && a.twist || 0;
this.tangentialPressure = "tangentialPressure" in a && a.tangentialPressure || 0;
};
a.prototype.reset = function () {
this.isPrimary = false;
};
return a;
}();
function lc(a, b) {
lc = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return lc(a, b);
}
var mc = function () {
function a() {
this.stopped = false;
this.stopsPropagatingAt = null;
this.stopPropagationHint = false;
this.target = null;
this.currentTarget = null;
this.type = null;
this.data = null;
}
a.prototype.stopPropagation = function () {
this.stopped = true;
this.stopPropagationHint = true;
this.stopsPropagatingAt = this.currentTarget;
};
a.prototype.reset = function () {
this.stopped = false;
this.stopsPropagatingAt = null;
this.stopPropagationHint = false;
this.currentTarget = null;
this.target = null;
};
return a;
}();
var nc = function () {
function a(b) {
this._pointerId = b;
this._flags = a.FLAGS.NONE;
}
a.prototype._doSet = function (a, b) {
this._flags = b ? this._flags | a : this._flags & ~a;
};
Object.defineProperty(a.prototype, "pointerId", {
get: function () {
return this._pointerId;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "flags", {
get: function () {
return this._flags;
},
set: function (a) {
this._flags = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "none", {
get: function () {
return this._flags === a.FLAGS.NONE;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "over", {
get: function () {
return (this._flags & a.FLAGS.OVER) != 0;
},
set: function (b) {
this._doSet(a.FLAGS.OVER, b);
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "rightDown", {
get: function () {
return (this._flags & a.FLAGS.RIGHT_DOWN) != 0;
},
set: function (b) {
this._doSet(a.FLAGS.RIGHT_DOWN, b);
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "leftDown", {
get: function () {
return (this._flags & a.FLAGS.LEFT_DOWN) != 0;
},
set: function (b) {
this._doSet(a.FLAGS.LEFT_DOWN, b);
},
enumerable: false,
configurable: true
});
a.FLAGS = Object.freeze({
NONE: 0,
OVER: 1,
LEFT_DOWN: 2,
RIGHT_DOWN: 4
});
return a;
}();
var oc = function () {
function a() {
this._tempPoint = new ob();
}
a.prototype.recursiveFindHit = function (a, b, c, d, e) {
if (!b || !b.visible) {
return false;
}
var f = a.data.global;
var g = false;
var h = e = b.interactive || e;
var i = true;
if (b.hitArea) {
if (d) {
b.worldTransform.applyInverse(f, this._tempPoint);
if (b.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) {
g = true;
} else {
d = false;
i = false;
}
}
h = false;
} else if (b._mask && d) {
if (!b._mask.containsPoint || !b._mask.containsPoint(f)) {
d = false;
}
}
if (i && b.interactiveChildren && b.children) {
for (var j = b.children, k = j.length - 1; k >= 0; k--) {
var l = j[k];
var m = this.recursiveFindHit(a, l, c, d, h);
if (m) {
if (!l.parent) {
continue;
}
h = false;
if (m) {
if (a.target) {
d = false;
}
g = true;
}
}
}
}
if (e) {
if (d && !a.target && !b.hitArea && b.containsPoint && b.containsPoint(f)) {
g = true;
}
if (b.interactive) {
if (g && !a.target) {
a.target = b;
}
if (c) {
c(a, b, !!g);
}
}
}
return g;
};
a.prototype.findHit = function (a, b, c, d) {
this.recursiveFindHit(a, b, c, d, false);
};
return a;
}();
var pc = {
interactive: false,
interactiveChildren: true,
hitArea: null,
get buttonMode() {
return this.cursor === "pointer";
},
set buttonMode(a) {
if (a) {
this.cursor = "pointer";
} else if (this.cursor === "pointer") {
this.cursor = null;
}
},
cursor: null,
get trackedPointers() {
if (this._trackedPointers === undefined) {
this._trackedPointers = {};
}
return this._trackedPointers;
},
_trackedPointers: undefined
};
ac.mixin(pc);
var qc = {
target: null,
data: {
global: null
}
};
var rc = function (a) {
function b(b, c) {
var d = a.call(this) || this;
c = c || {};
d.renderer = b;
d.autoPreventDefault = c.autoPreventDefault === undefined || c.autoPreventDefault;
d.interactionFrequency = c.interactionFrequency || 10;
d.mouse = new kc();
d.mouse.identifier = 1;
d.mouse.global.set(-999999);
d.activeInteractionData = {};
d.activeInteractionData[1] = d.mouse;
d.interactionDataPool = [];
d.eventData = new mc();
d.interactionDOMElement = null;
d.moveWhenInside = false;
d.eventsAdded = false;
d.tickerAdded = false;
d.mouseOverRenderer = !("PointerEvent" in globalThis);
d.supportsTouchEvents = "ontouchstart" in globalThis;
d.supportsPointerEvents = !!globalThis.PointerEvent;
d.onPointerUp = d.onPointerUp.bind(d);
d.processPointerUp = d.processPointerUp.bind(d);
d.onPointerCancel = d.onPointerCancel.bind(d);
d.processPointerCancel = d.processPointerCancel.bind(d);
d.onPointerDown = d.onPointerDown.bind(d);
d.processPointerDown = d.processPointerDown.bind(d);
d.onPointerMove = d.onPointerMove.bind(d);
d.processPointerMove = d.processPointerMove.bind(d);
d.onPointerOut = d.onPointerOut.bind(d);
d.processPointerOverOut = d.processPointerOverOut.bind(d);
d.onPointerOver = d.onPointerOver.bind(d);
d.cursorStyles = {
default: "inherit",
pointer: "pointer"
};
d.currentCursorMode = null;
d.cursor = null;
d.resolution = 1;
d.delayedEvents = [];
d.search = new oc();
d._tempDisplayObject = new bc();
d._eventListenerOptions = {
capture: true,
passive: false
};
d._useSystemTicker = c.useSystemTicker === undefined || c.useSystemTicker;
d.setTargetElement(d.renderer.view, d.renderer.resolution);
return d;
}
(function (a, b) {
function c() {
this.constructor = a;
}
lc(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
Object.defineProperty(b.prototype, "useSystemTicker", {
get: function () {
return this._useSystemTicker;
},
set: function (a) {
this._useSystemTicker = a;
if (a) {
this.addTickerListener();
} else {
this.removeTickerListener();
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "lastObjectRendered", {
get: function () {
return this.renderer._lastObjectRendered || this._tempDisplayObject;
},
enumerable: false,
configurable: true
});
b.prototype.hitTest = function (a, b) {
qc.target = null;
qc.data.global = a;
b ||= this.lastObjectRendered;
this.processInteractive(qc, b, null, true);
return qc.target;
};
b.prototype.setTargetElement = function (a, b) {
if (b === undefined) {
b = 1;
}
this.removeTickerListener();
this.removeEvents();
this.interactionDOMElement = a;
this.resolution = b;
this.addEvents();
this.addTickerListener();
};
b.prototype.addTickerListener = function () {
if (!this.tickerAdded && this.interactionDOMElement && this._useSystemTicker) {
ic.system.add(this.tickerUpdate, this, ec.INTERACTION);
this.tickerAdded = true;
}
};
b.prototype.removeTickerListener = function () {
if (this.tickerAdded) {
ic.system.remove(this.tickerUpdate, this);
this.tickerAdded = false;
}
};
b.prototype.addEvents = function () {
if (!this.eventsAdded && this.interactionDOMElement) {
var a = this.interactionDOMElement.style;
if (globalThis.navigator.msPointerEnabled) {
a.msContentZooming = "none";
a.msTouchAction = "none";
} else if (this.supportsPointerEvents) {
a.touchAction = "none";
}
if (this.supportsPointerEvents) {
globalThis.document.addEventListener("pointermove", this.onPointerMove, this._eventListenerOptions);
this.interactionDOMElement.addEventListener("pointerdown", this.onPointerDown, this._eventListenerOptions);
this.interactionDOMElement.addEventListener("pointerleave", this.onPointerOut, this._eventListenerOptions);
this.interactionDOMElement.addEventListener("pointerover", this.onPointerOver, this._eventListenerOptions);
globalThis.addEventListener("pointercancel", this.onPointerCancel, this._eventListenerOptions);
globalThis.addEventListener("pointerup", this.onPointerUp, this._eventListenerOptions);
} else {
globalThis.document.addEventListener("mousemove", this.onPointerMove, this._eventListenerOptions);
this.interactionDOMElement.addEventListener("mousedown", this.onPointerDown, this._eventListenerOptions);
this.interactionDOMElement.addEventListener("mouseout", this.onPointerOut, this._eventListenerOptions);
this.interactionDOMElement.addEventListener("mouseover", this.onPointerOver, this._eventListenerOptions);
globalThis.addEventListener("mouseup", this.onPointerUp, this._eventListenerOptions);
}
if (this.supportsTouchEvents) {
this.interactionDOMElement.addEventListener("touchstart", this.onPointerDown, this._eventListenerOptions);
this.interactionDOMElement.addEventListener("touchcancel", this.onPointerCancel, this._eventListenerOptions);
this.interactionDOMElement.addEventListener("touchend", this.onPointerUp, this._eventListenerOptions);
this.interactionDOMElement.addEventListener("touchmove", this.onPointerMove, this._eventListenerOptions);
}
this.eventsAdded = true;
}
};
b.prototype.removeEvents = function () {
if (this.eventsAdded && this.interactionDOMElement) {
var a = this.interactionDOMElement.style;
if (globalThis.navigator.msPointerEnabled) {
a.msContentZooming = "";
a.msTouchAction = "";
} else if (this.supportsPointerEvents) {
a.touchAction = "";
}
if (this.supportsPointerEvents) {
globalThis.document.removeEventListener("pointermove", this.onPointerMove, this._eventListenerOptions);
this.interactionDOMElement.removeEventListener("pointerdown", this.onPointerDown, this._eventListenerOptions);
this.interactionDOMElement.removeEventListener("pointerleave", this.onPointerOut, this._eventListenerOptions);
this.interactionDOMElement.removeEventListener("pointerover", this.onPointerOver, this._eventListenerOptions);
globalThis.removeEventListener("pointercancel", this.onPointerCancel, this._eventListenerOptions);
globalThis.removeEventListener("pointerup", this.onPointerUp, this._eventListenerOptions);
} else {
globalThis.document.removeEventListener("mousemove", this.onPointerMove, this._eventListenerOptions);
this.interactionDOMElement.removeEventListener("mousedown", this.onPointerDown, this._eventListenerOptions);
this.interactionDOMElement.removeEventListener("mouseout", this.onPointerOut, this._eventListenerOptions);
this.interactionDOMElement.removeEventListener("mouseover", this.onPointerOver, this._eventListenerOptions);
globalThis.removeEventListener("mouseup", this.onPointerUp, this._eventListenerOptions);
}
if (this.supportsTouchEvents) {
this.interactionDOMElement.removeEventListener("touchstart", this.onPointerDown, this._eventListenerOptions);
this.interactionDOMElement.removeEventListener("touchcancel", this.onPointerCancel, this._eventListenerOptions);
this.interactionDOMElement.removeEventListener("touchend", this.onPointerUp, this._eventListenerOptions);
this.interactionDOMElement.removeEventListener("touchmove", this.onPointerMove, this._eventListenerOptions);
}
this.interactionDOMElement = null;
this.eventsAdded = false;
}
};
b.prototype.tickerUpdate = function (a) {
this._deltaTime += a;
if (this._deltaTime >= this.interactionFrequency) {
this._deltaTime = 0;
this.update();
}
};
b.prototype.update = function () {
if (this.interactionDOMElement) {
if (this._didMove) {
this._didMove = false;
} else {
this.cursor = null;
for (var a in this.activeInteractionData) {
if (this.activeInteractionData.hasOwnProperty(a)) {
var b = this.activeInteractionData[a];
if (b.originalEvent && b.pointerType !== "touch") {
var c = this.configureInteractionEventForDOMEvent(this.eventData, b.originalEvent, b);
this.processInteractive(c, this.lastObjectRendered, this.processPointerOverOut, true);
}
}
}
this.setCursorMode(this.cursor);
}
}
};
b.prototype.setCursorMode = function (a) {
a = a || "default";
var b = true;
if (globalThis.OffscreenCanvas && this.interactionDOMElement instanceof OffscreenCanvas) {
b = false;
}
if (this.currentCursorMode !== a) {
this.currentCursorMode = a;
var c = this.cursorStyles[a];
if (c) {
switch (typeof c) {
case "string":
if (b) {
this.interactionDOMElement.style.cursor = c;
}
break;
case "function":
c(a);
break;
case "object":
if (b) {
Object.assign(this.interactionDOMElement.style, c);
}
}
} else if (b && typeof a == "string" && !Object.prototype.hasOwnProperty.call(this.cursorStyles, a)) {
this.interactionDOMElement.style.cursor = a;
}
}
};
b.prototype.dispatchEvent = function (a, b, c) {
if (!c.stopPropagationHint || a === c.stopsPropagatingAt) {
c.currentTarget = a;
c.type = b;
a.emit(b, c);
if (a[b]) {
a[b](c);
}
}
};
b.prototype.delayDispatchEvent = function (a, b, c) {
this.delayedEvents.push({
displayObject: a,
eventString: b,
eventData: c
});
};
b.prototype.mapPositionToPoint = function (a, b, c) {
var d;
d = this.interactionDOMElement.parentElement ? this.interactionDOMElement.getBoundingClientRect() : {
x: 0,
y: 0,
width: this.interactionDOMElement.width,
height: this.interactionDOMElement.height,
left: 0,
top: 0
};
var e = 1 / this.resolution;
a.x = (b - d.left) * (this.interactionDOMElement.width / d.width) * e;
a.y = (c - d.top) * (this.interactionDOMElement.height / d.height) * e;
};
b.prototype.processInteractive = function (a, b, c, d) {
var e = this.search.findHit(a, b, c, d);
var f = this.delayedEvents;
if (!f.length) {
return e;
}
a.stopPropagationHint = false;
var g = f.length;
this.delayedEvents = [];
for (var h = 0; h < g; h++) {
var i = f[h];
var j = i.displayObject;
var k = i.eventString;
var l = i.eventData;
if (l.stopsPropagatingAt === j) {
l.stopPropagationHint = true;
}
this.dispatchEvent(j, k, l);
}
return e;
};
b.prototype.onPointerDown = function (a) {
if (!this.supportsTouchEvents || a.pointerType !== "touch") {
var b = this.normalizeToPointerData(a);
if (this.autoPreventDefault && b[0].isNormalized && (a.cancelable || !("cancelable" in a))) {
a.preventDefault();
}
for (var c = b.length, d = 0; d < c; d++) {
var e = b[d];
var f = this.getInteractionDataForPointerId(e);
var g = this.configureInteractionEventForDOMEvent(this.eventData, e, f);
g.data.originalEvent = a;
this.processInteractive(g, this.lastObjectRendered, this.processPointerDown, true);
this.emit("pointerdown", g);
if (e.pointerType === "touch") {
this.emit("touchstart", g);
} else if (e.pointerType === "mouse" || e.pointerType === "pen") {
var h = e.button === 2;
this.emit(h ? "rightdown" : "mousedown", this.eventData);
}
}
}
};
b.prototype.processPointerDown = function (a, b, c) {
var d = a.data;
var e = a.data.identifier;
if (c) {
b.trackedPointers[e] ||= new nc(e);
this.dispatchEvent(b, "pointerdown", a);
if (d.pointerType === "touch") {
this.dispatchEvent(b, "touchstart", a);
} else if (d.pointerType === "mouse" || d.pointerType === "pen") {
var f = d.button === 2;
if (f) {
b.trackedPointers[e].rightDown = true;
} else {
b.trackedPointers[e].leftDown = true;
}
this.dispatchEvent(b, f ? "rightdown" : "mousedown", a);
}
}
};
b.prototype.onPointerComplete = function (a, b, c) {
for (var d = this.normalizeToPointerData(a), e = d.length, f = a.target !== this.interactionDOMElement ? "outside" : "", g = 0; g < e; g++) {
var h = d[g];
var i = this.getInteractionDataForPointerId(h);
var j = this.configureInteractionEventForDOMEvent(this.eventData, h, i);
j.data.originalEvent = a;
this.processInteractive(j, this.lastObjectRendered, c, b || !f);
this.emit(b ? "pointercancel" : "pointerup" + f, j);
if (h.pointerType === "mouse" || h.pointerType === "pen") {
var k = h.button === 2;
this.emit(k ? "rightup" + f : "mouseup" + f, j);
} else if (h.pointerType === "touch") {
this.emit(b ? "touchcancel" : "touchend" + f, j);
this.releaseInteractionDataForPointerId(h.pointerId);
}
}
};
b.prototype.onPointerCancel = function (a) {
if (!this.supportsTouchEvents || a.pointerType !== "touch") {
this.onPointerComplete(a, true, this.processPointerCancel);
}
};
b.prototype.processPointerCancel = function (a, b) {
var c = a.data;
var d = a.data.identifier;
if (b.trackedPointers[d] !== undefined) {
delete b.trackedPointers[d];
this.dispatchEvent(b, "pointercancel", a);
if (c.pointerType === "touch") {
this.dispatchEvent(b, "touchcancel", a);
}
}
};
b.prototype.onPointerUp = function (a) {
if (!this.supportsTouchEvents || a.pointerType !== "touch") {
this.onPointerComplete(a, false, this.processPointerUp);
}
};
b.prototype.processPointerUp = function (a, b, c) {
var d = a.data;
var e = a.data.identifier;
var f = b.trackedPointers[e];
var g = d.pointerType === "touch";
var h = d.pointerType === "mouse" || d.pointerType === "pen";
var i = false;
if (h) {
var j = d.button === 2;
var k = nc.FLAGS;
var l = j ? k.RIGHT_DOWN : k.LEFT_DOWN;
var m = f !== undefined && f.flags & l;
if (c) {
this.dispatchEvent(b, j ? "rightup" : "mouseup", a);
if (m) {
this.dispatchEvent(b, j ? "rightclick" : "click", a);
i = true;
}
} else if (m) {
this.dispatchEvent(b, j ? "rightupoutside" : "mouseupoutside", a);
}
if (f) {
if (j) {
f.rightDown = false;
} else {
f.leftDown = false;
}
}
}
if (c) {
this.dispatchEvent(b, "pointerup", a);
if (g) {
this.dispatchEvent(b, "touchend", a);
}
if (f) {
if (!h || !!i) {
this.dispatchEvent(b, "pointertap", a);
}
if (g) {
this.dispatchEvent(b, "tap", a);
f.over = false;
}
}
} else if (f) {
this.dispatchEvent(b, "pointerupoutside", a);
if (g) {
this.dispatchEvent(b, "touchendoutside", a);
}
}
if (f && f.none) {
delete b.trackedPointers[e];
}
};
b.prototype.onPointerMove = function (a) {
if (!this.supportsTouchEvents || a.pointerType !== "touch") {
var b = this.normalizeToPointerData(a);
if (b[0].pointerType === "mouse" || b[0].pointerType === "pen") {
this._didMove = true;
this.cursor = null;
}
for (var c = b.length, d = 0; d < c; d++) {
var e = b[d];
var f = this.getInteractionDataForPointerId(e);
var g = this.configureInteractionEventForDOMEvent(this.eventData, e, f);
g.data.originalEvent = a;
this.processInteractive(g, this.lastObjectRendered, this.processPointerMove, true);
this.emit("pointermove", g);
if (e.pointerType === "touch") {
this.emit("touchmove", g);
}
if (e.pointerType === "mouse" || e.pointerType === "pen") {
this.emit("mousemove", g);
}
}
if (b[0].pointerType === "mouse") {
this.setCursorMode(this.cursor);
}
}
};
b.prototype.processPointerMove = function (a, b, c) {
var d = a.data;
var e = d.pointerType === "touch";
var f = d.pointerType === "mouse" || d.pointerType === "pen";
if (f) {
this.processPointerOverOut(a, b, c);
}
if (!this.moveWhenInside || !!c) {
this.dispatchEvent(b, "pointermove", a);
if (e) {
this.dispatchEvent(b, "touchmove", a);
}
if (f) {
this.dispatchEvent(b, "mousemove", a);
}
}
};
b.prototype.onPointerOut = function (a) {
if (!this.supportsTouchEvents || a.pointerType !== "touch") {
var b = this.normalizeToPointerData(a)[0];
if (b.pointerType === "mouse") {
this.mouseOverRenderer = false;
this.setCursorMode(null);
}
var c = this.getInteractionDataForPointerId(b);
var d = this.configureInteractionEventForDOMEvent(this.eventData, b, c);
d.data.originalEvent = b;
this.processInteractive(d, this.lastObjectRendered, this.processPointerOverOut, false);
this.emit("pointerout", d);
if (b.pointerType === "mouse" || b.pointerType === "pen") {
this.emit("mouseout", d);
} else {
this.releaseInteractionDataForPointerId(c.identifier);
}
}
};
b.prototype.processPointerOverOut = function (a, b, c) {
var d = a.data;
var e = a.data.identifier;
var f = d.pointerType === "mouse" || d.pointerType === "pen";
var g = b.trackedPointers[e];
if (c && !g) {
g = b.trackedPointers[e] = new nc(e);
}
if (g !== undefined) {
if (c && this.mouseOverRenderer) {
if (!g.over) {
g.over = true;
this.delayDispatchEvent(b, "pointerover", a);
if (f) {
this.delayDispatchEvent(b, "mouseover", a);
}
}
if (f && this.cursor === null) {
this.cursor = b.cursor;
}
} else if (g.over) {
g.over = false;
this.dispatchEvent(b, "pointerout", this.eventData);
if (f) {
this.dispatchEvent(b, "mouseout", a);
}
if (g.none) {
delete b.trackedPointers[e];
}
}
}
};
b.prototype.onPointerOver = function (a) {
var b = this.normalizeToPointerData(a)[0];
var c = this.getInteractionDataForPointerId(b);
var d = this.configureInteractionEventForDOMEvent(this.eventData, b, c);
d.data.originalEvent = b;
if (b.pointerType === "mouse") {
this.mouseOverRenderer = true;
}
this.emit("pointerover", d);
if (b.pointerType === "mouse" || b.pointerType === "pen") {
this.emit("mouseover", d);
}
};
b.prototype.getInteractionDataForPointerId = function (a) {
var b;
var c = a.pointerId;
if (c === 1 || a.pointerType === "mouse") {
b = this.mouse;
} else if (this.activeInteractionData[c]) {
b = this.activeInteractionData[c];
} else {
(b = this.interactionDataPool.pop() || new kc()).identifier = c;
this.activeInteractionData[c] = b;
}
b.copyEvent(a);
return b;
};
b.prototype.releaseInteractionDataForPointerId = function (a) {
var b = this.activeInteractionData[a];
if (b) {
delete this.activeInteractionData[a];
b.reset();
this.interactionDataPool.push(b);
}
};
b.prototype.configureInteractionEventForDOMEvent = function (a, b, c) {
a.data = c;
this.mapPositionToPoint(c.global, b.clientX, b.clientY);
if (b.pointerType === "touch") {
b.globalX = c.global.x;
b.globalY = c.global.y;
}
c.originalEvent = b;
a.reset();
return a;
};
b.prototype.normalizeToPointerData = function (a) {
var b = [];
if (this.supportsTouchEvents && a instanceof TouchEvent) {
for (var c = 0, d = a.changedTouches.length; c < d; c++) {
var e = a.changedTouches[c];
if (e.button === undefined) {
e.button = a.touches.length ? 1 : 0;
}
if (e.buttons === undefined) {
e.buttons = a.touches.length ? 1 : 0;
}
if (e.isPrimary === undefined) {
e.isPrimary = a.touches.length === 1 && a.type === "touchstart";
}
if (e.width === undefined) {
e.width = e.radiusX || 1;
}
if (e.height === undefined) {
e.height = e.radiusY || 1;
}
if (e.tiltX === undefined) {
e.tiltX = 0;
}
if (e.tiltY === undefined) {
e.tiltY = 0;
}
if (e.pointerType === undefined) {
e.pointerType = "touch";
}
if (e.pointerId === undefined) {
e.pointerId = e.identifier || 0;
}
if (e.pressure === undefined) {
e.pressure = e.force || 0.5;
}
if (e.twist === undefined) {
e.twist = 0;
}
if (e.tangentialPressure === undefined) {
e.tangentialPressure = 0;
}
if (e.layerX === undefined) {
e.layerX = e.offsetX = e.clientX;
}
if (e.layerY === undefined) {
e.layerY = e.offsetY = e.clientY;
}
e.isNormalized = true;
b.push(e);
}
} else if (!globalThis.MouseEvent || a instanceof MouseEvent && (!this.supportsPointerEvents || !(a instanceof globalThis.PointerEvent))) {
var f = a;
if (f.isPrimary === undefined) {
f.isPrimary = true;
}
if (f.width === undefined) {
f.width = 1;
}
if (f.height === undefined) {
f.height = 1;
}
if (f.tiltX === undefined) {
f.tiltX = 0;
}
if (f.tiltY === undefined) {
f.tiltY = 0;
}
if (f.pointerType === undefined) {
f.pointerType = "mouse";
}
if (f.pointerId === undefined) {
f.pointerId = 1;
}
if (f.pressure === undefined) {
f.pressure = 0.5;
}
if (f.twist === undefined) {
f.twist = 0;
}
if (f.tangentialPressure === undefined) {
f.tangentialPressure = 0;
}
f.isNormalized = true;
b.push(f);
} else {
b.push(a);
}
return b;
};
b.prototype.destroy = function () {
this.removeEvents();
this.removeTickerListener();
this.removeAllListeners();
this.renderer = null;
this.mouse = null;
this.eventData = null;
this.interactionDOMElement = null;
this.onPointerDown = null;
this.processPointerDown = null;
this.onPointerUp = null;
this.processPointerUp = null;
this.onPointerCancel = null;
this.processPointerCancel = null;
this.onPointerMove = null;
this.processPointerMove = null;
this.onPointerOut = null;
this.processPointerOverOut = null;
this.onPointerOver = null;
this.search = null;
};
return b;
}(Ha());
var sc = function () {
function a(a) {
this.items = [];
this._name = a;
this._aliasCount = 0;
}
a.prototype.emit = function (a, b, c, d, e, f, g, h) {
if (arguments.length > 8) {
throw new Error("max arguments reached");
}
var i = this.name;
var j = this.items;
this._aliasCount++;
for (var k = 0, l = j.length; k < l; k++) {
j[k][i](a, b, c, d, e, f, g, h);
}
if (j === this.items) {
this._aliasCount--;
}
return this;
};
a.prototype.ensureNonAliasedItems = function () {
if (this._aliasCount > 0 && this.items.length > 1) {
this._aliasCount = 0;
this.items = this.items.slice(0);
}
};
a.prototype.add = function (a) {
if (a[this._name]) {
this.ensureNonAliasedItems();
this.remove(a);
this.items.push(a);
}
return this;
};
a.prototype.remove = function (a) {
var b = this.items.indexOf(a);
if (b !== -1) {
this.ensureNonAliasedItems();
this.items.splice(b, 1);
}
return this;
};
a.prototype.contains = function (a) {
return this.items.indexOf(a) !== -1;
};
a.prototype.removeAll = function () {
this.ensureNonAliasedItems();
this.items.length = 0;
return this;
};
a.prototype.destroy = function () {
this.removeAll();
this.items = null;
this._name = null;
};
Object.defineProperty(a.prototype, "empty", {
get: function () {
return this.items.length === 0;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "name", {
get: function () {
return this._name;
},
enumerable: false,
configurable: true
});
return a;
}();
Object.defineProperties(sc.prototype, {
dispatch: {
value: sc.prototype.emit
},
run: {
value: sc.prototype.emit
}
});
Fa.PREFER_ENV = la.any ? ma.WEBGL : ma.WEBGL2;
Fa.STRICT_TEXTURE_CACHE = false;
var tc = [];
function uc(a, b) {
if (!a) {
return null;
}
var c = "";
if (typeof a == "string") {
var d = /\.(\w{3,4})(?:$|\?|#)/i.exec(a);
if (d) {
c = d[1].toLowerCase();
}
}
for (var e = tc.length - 1; e >= 0; --e) {
var f = tc[e];
if (f.test && f.test(a, c)) {
return new f(a, b);
}
}
throw new Error("Unrecognized source type to auto-detect Resource");
}
function vc(a, b) {
vc = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return vc(a, b);
}
function wc(a, b) {
function c() {
this.constructor = a;
}
vc(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
}
function xc() {
xc = Object.assign || function (a) {
for (var b, c = arguments, d = 1, e = arguments.length; d < e; d++) {
for (var f in b = c[d]) {
if (Object.prototype.hasOwnProperty.call(b, f)) {
a[f] = b[f];
}
}
}
return a;
};
return xc.apply(this, arguments);
}
var yc = function () {
function a(a, b) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = 0;
}
this._width = a;
this._height = b;
this.destroyed = false;
this.internal = false;
this.onResize = new sc("setRealSize");
this.onUpdate = new sc("update");
this.onError = new sc("onError");
}
a.prototype.bind = function (a) {
this.onResize.add(a);
this.onUpdate.add(a);
this.onError.add(a);
if (this._width || this._height) {
this.onResize.emit(this._width, this._height);
}
};
a.prototype.unbind = function (a) {
this.onResize.remove(a);
this.onUpdate.remove(a);
this.onError.remove(a);
};
a.prototype.resize = function (a, b) {
if (a !== this._width || b !== this._height) {
this._width = a;
this._height = b;
this.onResize.emit(a, b);
}
};
Object.defineProperty(a.prototype, "valid", {
get: function () {
return !!this._width && !!this._height;
},
enumerable: false,
configurable: true
});
a.prototype.update = function () {
if (!this.destroyed) {
this.onUpdate.emit();
}
};
a.prototype.load = function () {
return Promise.resolve(this);
};
Object.defineProperty(a.prototype, "width", {
get: function () {
return this._width;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "height", {
get: function () {
return this._height;
},
enumerable: false,
configurable: true
});
a.prototype.style = function (a, b, c) {
return false;
};
a.prototype.dispose = function () {};
a.prototype.destroy = function () {
if (!this.destroyed) {
this.destroyed = true;
this.dispose();
this.onError.removeAll();
this.onError = null;
this.onResize.removeAll();
this.onResize = null;
this.onUpdate.removeAll();
this.onUpdate = null;
}
};
a.test = function (a, b) {
return false;
};
return a;
}();
var zc = function (a) {
function b(b, c) {
var d = this;
var e = c || {};
var f = e.width;
var g = e.height;
if (!f || !g) {
throw new Error("BufferResource width or height invalid");
}
(d = a.call(this, f, g) || this).data = b;
return d;
}
wc(b, a);
b.prototype.upload = function (a, b, c) {
var d = a.gl;
d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL, b.alphaMode === ya.UNPACK);
var e = b.realWidth;
var f = b.realHeight;
if (c.width === e && c.height === f) {
d.texSubImage2D(b.target, 0, 0, 0, e, f, b.format, c.type, this.data);
} else {
c.width = e;
c.height = f;
d.texImage2D(b.target, 0, c.internalFormat, e, f, 0, b.format, c.type, this.data);
}
return true;
};
b.prototype.dispose = function () {
this.data = null;
};
b.test = function (a) {
return a instanceof Float32Array || a instanceof Uint8Array || a instanceof Uint32Array;
};
return b;
}(yc);
var Ac = {
scaleMode: va.NEAREST,
format: ra.RGBA,
alphaMode: ya.NPM
};
var Bc = function (a) {
function b(b, c) {
if (b === undefined) {
b = null;
}
if (c === undefined) {
c = null;
}
var d = a.call(this) || this;
var e = (c = c || {}).alphaMode;
var f = c.mipmap;
var g = c.anisotropicLevel;
var h = c.scaleMode;
var i = c.width;
var j = c.height;
var k = c.wrapMode;
var l = c.format;
var m = c.type;
var n = c.target;
var o = c.resolution;
var p = c.resourceOptions;
if (!!b && !(b instanceof yc)) {
(b = uc(b, p)).internal = true;
}
d.resolution = o || Fa.RESOLUTION;
d.width = Math.round((i || 0) * d.resolution) / d.resolution;
d.height = Math.round((j || 0) * d.resolution) / d.resolution;
d._mipmap = f !== undefined ? f : Fa.MIPMAP_TEXTURES;
d.anisotropicLevel = g !== undefined ? g : Fa.ANISOTROPIC_LEVEL;
d._wrapMode = k || Fa.WRAP_MODE;
d._scaleMode = h !== undefined ? h : Fa.SCALE_MODE;
d.format = l || ra.RGBA;
d.type = m || ta.UNSIGNED_BYTE;
d.target = n || sa.TEXTURE_2D;
d.alphaMode = e !== undefined ? e : ya.UNPACK;
d.uid = bb();
d.touched = 0;
d.isPowerOfTwo = false;
d._refreshPOT();
d._glTextures = {};
d.dirtyId = 0;
d.dirtyStyleId = 0;
d.cacheId = null;
d.valid = i > 0 && j > 0;
d.textureCacheIds = [];
d.destroyed = false;
d.resource = null;
d._batchEnabled = 0;
d._batchLocation = 0;
d.parentTextureArray = null;
d.setResource(b);
return d;
}
wc(b, a);
Object.defineProperty(b.prototype, "realWidth", {
get: function () {
return Math.round(this.width * this.resolution);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "realHeight", {
get: function () {
return Math.round(this.height * this.resolution);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "mipmap", {
get: function () {
return this._mipmap;
},
set: function (a) {
if (this._mipmap !== a) {
this._mipmap = a;
this.dirtyStyleId++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "scaleMode", {
get: function () {
return this._scaleMode;
},
set: function (a) {
if (this._scaleMode !== a) {
this._scaleMode = a;
this.dirtyStyleId++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "wrapMode", {
get: function () {
return this._wrapMode;
},
set: function (a) {
if (this._wrapMode !== a) {
this._wrapMode = a;
this.dirtyStyleId++;
}
},
enumerable: false,
configurable: true
});
b.prototype.setStyle = function (a, b) {
var c;
if (a !== undefined && a !== this.scaleMode) {
this.scaleMode = a;
c = true;
}
if (b !== undefined && b !== this.mipmap) {
this.mipmap = b;
c = true;
}
if (c) {
this.dirtyStyleId++;
}
return this;
};
b.prototype.setSize = function (a, b, c) {
c = c || this.resolution;
return this.setRealSize(a * c, b * c, c);
};
b.prototype.setRealSize = function (a, b, c) {
this.resolution = c || this.resolution;
this.width = Math.round(a) / this.resolution;
this.height = Math.round(b) / this.resolution;
this._refreshPOT();
this.update();
return this;
};
b.prototype._refreshPOT = function () {
this.isPowerOfTwo = Ya(this.realWidth) && Ya(this.realHeight);
};
b.prototype.setResolution = function (a) {
var b = this.resolution;
if (b !== a) {
this.resolution = a;
if (this.valid) {
this.width = Math.round(this.width * b) / a;
this.height = Math.round(this.height * b) / a;
this.emit("update", this);
}
this._refreshPOT();
}
return this;
};
b.prototype.setResource = function (a) {
if (this.resource === a) {
return this;
}
if (this.resource) {
throw new Error("Resource can be set only once");
}
a.bind(this);
this.resource = a;
return this;
};
b.prototype.update = function () {
if (this.valid) {
this.dirtyId++;
this.dirtyStyleId++;
this.emit("update", this);
} else if (this.width > 0 && this.height > 0) {
this.valid = true;
this.emit("loaded", this);
this.emit("update", this);
}
};
b.prototype.onError = function (a) {
this.emit("error", this, a);
};
b.prototype.destroy = function () {
if (this.resource) {
this.resource.unbind(this);
if (this.resource.internal) {
this.resource.destroy();
}
this.resource = null;
}
if (this.cacheId) {
delete hb[this.cacheId];
delete gb[this.cacheId];
this.cacheId = null;
}
this.dispose();
b.removeFromCache(this);
this.textureCacheIds = null;
this.destroyed = true;
};
b.prototype.dispose = function () {
this.emit("dispose", this);
};
b.prototype.castToBaseTexture = function () {
return this;
};
b.from = function (a, c, d) {
if (d === undefined) {
d = Fa.STRICT_TEXTURE_CACHE;
}
var e = typeof a == "string";
var f = null;
if (e) {
f = a;
} else {
if (!a._pixiId) {
var g = c && c.pixiIdPrefix || "pixiid";
a._pixiId = g + "_" + bb();
}
f = a._pixiId;
}
var h = hb[f];
if (e && d && !h) {
throw new Error("The cacheId \"" + f + "\" does not exist in BaseTextureCache.");
}
if (!h) {
(h = new b(a, c)).cacheId = f;
b.addToCache(h, f);
}
return h;
};
b.fromBuffer = function (a, c, d, e) {
a = a || new Float32Array(c * d * 4);
var f = new zc(a, {
width: c,
height: d
});
var g = a instanceof Float32Array ? ta.FLOAT : ta.UNSIGNED_BYTE;
return new b(f, Object.assign(Ac, e || {
width: c,
height: d,
type: g
}));
};
b.addToCache = function (a, b) {
if (b) {
if (a.textureCacheIds.indexOf(b) === -1) {
a.textureCacheIds.push(b);
}
if (hb[b]) {
console.warn("BaseTexture added to the cache with an id [" + b + "] that already had an entry");
}
hb[b] = a;
}
};
b.removeFromCache = function (a) {
if (typeof a == "string") {
var b = hb[a];
if (b) {
var c = b.textureCacheIds.indexOf(a);
if (c > -1) {
b.textureCacheIds.splice(c, 1);
}
delete hb[a];
return b;
}
} else if (a && a.textureCacheIds) {
for (var d = 0; d < a.textureCacheIds.length; ++d) {
delete hb[a.textureCacheIds[d]];
}
a.textureCacheIds.length = 0;
return a;
}
return null;
};
b._globalBatch = 0;
return b;
}(Ha());
var Cc = function (a) {
function b(b, c) {
var d = this;
var e = c || {};
var f = e.width;
var g = e.height;
(d = a.call(this, f, g) || this).items = [];
d.itemDirtyIds = [];
for (var h = 0; h < b; h++) {
var i = new Bc();
d.items.push(i);
d.itemDirtyIds.push(-2);
}
d.length = b;
d._load = null;
d.baseTexture = null;
return d;
}
wc(b, a);
b.prototype.initFromArray = function (a, b) {
for (var c = 0; c < this.length; c++) {
if (a[c]) {
if (a[c].castToBaseTexture) {
this.addBaseTextureAt(a[c].castToBaseTexture(), c);
} else if (a[c] instanceof yc) {
this.addResourceAt(a[c], c);
} else {
this.addResourceAt(uc(a[c], b), c);
}
}
}
};
b.prototype.dispose = function () {
for (var a = 0, b = this.length; a < b; a++) {
this.items[a].destroy();
}
this.items = null;
this.itemDirtyIds = null;
this._load = null;
};
b.prototype.addResourceAt = function (a, b) {
if (!this.items[b]) {
throw new Error("Index " + b + " is out of bounds");
}
if (a.valid && !this.valid) {
this.resize(a.width, a.height);
}
this.items[b].setResource(a);
return this;
};
b.prototype.bind = function (b) {
if (this.baseTexture !== null) {
throw new Error("Only one base texture per TextureArray is allowed");
}
a.prototype.bind.call(this, b);
for (var c = 0; c < this.length; c++) {
this.items[c].parentTextureArray = b;
this.items[c].on("update", b.update, b);
}
};
b.prototype.unbind = function (b) {
a.prototype.unbind.call(this, b);
for (var c = 0; c < this.length; c++) {
this.items[c].parentTextureArray = null;
this.items[c].off("update", b.update, b);
}
};
b.prototype.load = function () {
var a = this;
if (this._load) {
return this._load;
}
var b = this.items.map(function (a) {
return a.resource;
}).filter(function (a) {
return a;
}).map(function (a) {
return a.load();
});
this._load = Promise.all(b).then(function () {
var b = a.items[0];
var c = b.realWidth;
var d = b.realHeight;
a.resize(c, d);
return Promise.resolve(a);
});
return this._load;
};
return b;
}(yc);
var Dc = function (a) {
function b(b, c) {
var d;
var e;
var f = this;
var g = c || {};
var h = g.width;
var i = g.height;
if (Array.isArray(b)) {
d = b;
e = b.length;
} else {
e = b;
}
f = a.call(this, e, {
width: h,
height: i
}) || this;
if (d) {
f.initFromArray(d, c);
}
return f;
}
wc(b, a);
b.prototype.addBaseTextureAt = function (a, b) {
if (!a.resource) {
throw new Error("ArrayResource does not support RenderTexture");
}
this.addResourceAt(a.resource, b);
return this;
};
b.prototype.bind = function (b) {
a.prototype.bind.call(this, b);
b.target = sa.TEXTURE_2D_ARRAY;
};
b.prototype.upload = function (a, b, c) {
var d = this;
var e = d.length;
var f = d.itemDirtyIds;
var g = d.items;
var h = a.gl;
if (c.dirtyId < 0) {
h.texImage3D(h.TEXTURE_2D_ARRAY, 0, c.internalFormat, this._width, this._height, e, 0, b.format, c.type, null);
}
for (var i = 0; i < e; i++) {
var j = g[i];
if (f[i] < j.dirtyId) {
f[i] = j.dirtyId;
if (j.valid) {
h.texSubImage3D(h.TEXTURE_2D_ARRAY, 0, 0, 0, i, j.resource.width, j.resource.height, 1, b.format, c.type, j.resource.source);
}
}
}
return true;
};
return b;
}(Cc);
var Ec = function (a) {
function b(b) {
var c = this;
var d = b;
var e = d.naturalWidth || d.videoWidth || d.width;
var f = d.naturalHeight || d.videoHeight || d.height;
(c = a.call(this, e, f) || this).source = b;
c.noSubImage = false;
return c;
}
wc(b, a);
b.crossOrigin = function (a, b, c) {
if (c === undefined && b.indexOf("data:") !== 0) {
a.crossOrigin = function (a, b) {
if (b === undefined) {
b = globalThis.location;
}
if (a.indexOf("data:") === 0) {
return "";
}
b = b || globalThis.location;
eb ||= document.createElement("a");
eb.href = a;
var c = La.parse(eb.href);
var d = !c.port && b.port === "" || c.port === b.port;
if (c.hostname === b.hostname && d && c.protocol === b.protocol) {
return "";
} else {
return "anonymous";
}
}(b);
} else if (c !== false) {
a.crossOrigin = typeof c == "string" ? c : "anonymous";
}
};
b.prototype.upload = function (a, b, c, d) {
var e = a.gl;
var f = b.realWidth;
var g = b.realHeight;
if ((d = d || this.source) instanceof HTMLImageElement) {
if (!d.complete || d.naturalWidth === 0) {
return false;
}
} else if (d instanceof HTMLVideoElement && d.readyState <= 1) {
return false;
}
e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, b.alphaMode === ya.UNPACK);
if (this.noSubImage || b.target !== e.TEXTURE_2D || c.width !== f || c.height !== g) {
c.width = f;
c.height = g;
e.texImage2D(b.target, 0, c.internalFormat, b.format, c.type, d);
} else {
e.texSubImage2D(e.TEXTURE_2D, 0, 0, 0, b.format, c.type, d);
}
return true;
};
b.prototype.update = function () {
if (!this.destroyed) {
var b = this.source;
var c = b.naturalWidth || b.videoWidth || b.width;
var d = b.naturalHeight || b.videoHeight || b.height;
this.resize(c, d);
a.prototype.update.call(this);
}
};
b.prototype.dispose = function () {
this.source = null;
};
return b;
}(yc);
var Fc = function (a) {
function b(b) {
return a.call(this, b) || this;
}
wc(b, a);
b.test = function (a) {
var b = globalThis.OffscreenCanvas;
return !!b && !!(a instanceof b) || globalThis.HTMLCanvasElement && a instanceof HTMLCanvasElement;
};
return b;
}(Ec);
var Gc = function (a) {
function b(c, d) {
var e = this;
var f = d || {};
var g = f.width;
var h = f.height;
var i = f.autoLoad;
var j = f.linkBaseTexture;
if (c && c.length !== b.SIDES) {
throw new Error("Invalid length. Got " + c.length + ", expected 6");
}
e = a.call(this, 6, {
width: g,
height: h
}) || this;
for (var k = 0; k < b.SIDES; k++) {
e.items[k].target = sa.TEXTURE_CUBE_MAP_POSITIVE_X + k;
}
e.linkBaseTexture = j !== false;
if (c) {
e.initFromArray(c, d);
}
if (i !== false) {
e.load();
}
return e;
}
wc(b, a);
b.prototype.bind = function (b) {
a.prototype.bind.call(this, b);
b.target = sa.TEXTURE_CUBE_MAP;
};
b.prototype.addBaseTextureAt = function (a, b, c) {
if (!this.items[b]) {
throw new Error("Index " + b + " is out of bounds");
}
if (!this.linkBaseTexture || a.parentTextureArray || Object.keys(a._glTextures).length > 0) {
if (!a.resource) {
throw new Error("CubeResource does not support copying of renderTexture.");
}
this.addResourceAt(a.resource, b);
} else {
a.target = sa.TEXTURE_CUBE_MAP_POSITIVE_X + b;
a.parentTextureArray = this.baseTexture;
this.items[b] = a;
}
if (a.valid && !this.valid) {
this.resize(a.realWidth, a.realHeight);
}
this.items[b] = a;
return this;
};
b.prototype.upload = function (a, c, d) {
for (var e = this.itemDirtyIds, f = 0; f < b.SIDES; f++) {
var g = this.items[f];
if (e[f] < g.dirtyId) {
if (g.valid && g.resource) {
g.resource.upload(a, g, d);
e[f] = g.dirtyId;
} else if (e[f] < -1) {
a.gl.texImage2D(g.target, 0, d.internalFormat, c.realWidth, c.realHeight, 0, c.format, d.type, null);
e[f] = -1;
}
}
}
return true;
};
b.test = function (a) {
return Array.isArray(a) && a.length === b.SIDES;
};
b.SIDES = 6;
return b;
}(Cc);
var Hc = function (a) {
function b(b, c) {
var d = this;
c = c || {};
if (!(b instanceof HTMLImageElement)) {
var e = new Image();
Ec.crossOrigin(e, b, c.crossorigin);
e.src = b;
b = e;
}
d = a.call(this, b) || this;
if (!b.complete && d._width && d._height) {
d._width = 0;
d._height = 0;
}
d.url = b.src;
d._process = null;
d.preserveBitmap = false;
d.createBitmap = (c.createBitmap !== undefined ? c.createBitmap : Fa.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap;
d.alphaMode = typeof c.alphaMode == "number" ? c.alphaMode : null;
d.bitmap = null;
d._load = null;
if (c.autoLoad !== false) {
d.load();
}
return d;
}
wc(b, a);
b.prototype.load = function (a) {
var b = this;
if (!this._load) {
if (a !== undefined) {
this.createBitmap = a;
}
this._load = new Promise(function (a, c) {
var d = b.source;
b.url = d.src;
function e() {
if (!b.destroyed) {
d.onload = null;
d.onerror = null;
b.resize(d.width, d.height);
b._load = null;
if (b.createBitmap) {
a(b.process());
} else {
a(b);
}
}
}
if (d.complete && d.src) {
e();
} else {
d.onload = e;
d.onerror = function (a) {
c(a);
b.onError.emit(a);
};
}
});
}
return this._load;
};
b.prototype.process = function () {
var a = this;
var b = this.source;
if (this._process !== null) {
return this._process;
}
if (this.bitmap !== null || !globalThis.createImageBitmap) {
return Promise.resolve(this);
}
var c = globalThis.createImageBitmap;
var d = !b.crossOrigin || b.crossOrigin === "anonymous";
this._process = fetch(b.src, {
mode: d ? "cors" : "no-cors"
}).then(function (a) {
return a.blob();
}).then(function (d) {
return c(d, 0, 0, b.width, b.height, {
premultiplyAlpha: a.alphaMode === ya.UNPACK ? "premultiply" : "none"
});
}).then(function (b) {
if (a.destroyed) {
return Promise.reject();
} else {
a.bitmap = b;
a.update();
a._process = null;
return Promise.resolve(a);
}
});
return this._process;
};
b.prototype.upload = function (b, c, d) {
if (typeof this.alphaMode == "number") {
c.alphaMode = this.alphaMode;
}
if (!this.createBitmap) {
return a.prototype.upload.call(this, b, c, d);
}
if (!this.bitmap && (this.process(), !this.bitmap)) {
return false;
}
a.prototype.upload.call(this, b, c, d, this.bitmap);
if (!this.preserveBitmap) {
var e = true;
var f = c._glTextures;
for (var g in f) {
var h = f[g];
if (h !== d && h.dirtyId !== c.dirtyId) {
e = false;
break;
}
}
if (e) {
if (this.bitmap.close) {
this.bitmap.close();
}
this.bitmap = null;
}
}
return true;
};
b.prototype.dispose = function () {
this.source.onload = null;
this.source.onerror = null;
a.prototype.dispose.call(this);
if (this.bitmap) {
this.bitmap.close();
this.bitmap = null;
}
this._process = null;
this._load = null;
};
b.test = function (a) {
return typeof a == "string" || a instanceof HTMLImageElement;
};
return b;
}(Ec);
var Ic = function (a) {
function b(b, c) {
var d = this;
c = c || {};
(d = a.call(this, document.createElement("canvas")) || this)._width = 0;
d._height = 0;
d.svg = b;
d.scale = c.scale || 1;
d._overrideWidth = c.width;
d._overrideHeight = c.height;
d._resolve = null;
d._crossorigin = c.crossorigin;
d._load = null;
if (c.autoLoad !== false) {
d.load();
}
return d;
}
wc(b, a);
b.prototype.load = function () {
var a = this;
this._load ||= new Promise(function (c) {
a._resolve = function () {
a.resize(a.source.width, a.source.height);
c(a);
};
if (b.SVG_XML.test(a.svg.trim())) {
if (!btoa) {
throw new Error("Your browser doesn't support base64 conversions.");
}
a.svg = "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(a.svg)));
}
a._loadSvg();
});
return this._load;
};
b.prototype._loadSvg = function () {
var a = this;
var b = new Image();
Ec.crossOrigin(b, this.svg, this._crossorigin);
b.src = this.svg;
b.onerror = function (c) {
if (a._resolve) {
b.onerror = null;
a.onError.emit(c);
}
};
b.onload = function () {
if (a._resolve) {
var c = b.width;
var d = b.height;
if (!c || !d) {
throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");
}
var e = c * a.scale;
var f = d * a.scale;
if (a._overrideWidth || a._overrideHeight) {
e = a._overrideWidth || a._overrideHeight / d * c;
f = a._overrideHeight || a._overrideWidth / c * d;
}
e = Math.round(e);
f = Math.round(f);
var g = a.source;
g.width = e;
g.height = f;
g._pixiId = "canvas_" + bb();
g.getContext("2d").drawImage(b, 0, 0, c, d, 0, 0, e, f);
a._resolve();
a._resolve = null;
}
};
};
b.getSize = function (a) {
var c = b.SVG_SIZE.exec(a);
var d = {};
if (c) {
d[c[1]] = Math.round(parseFloat(c[3]));
d[c[5]] = Math.round(parseFloat(c[7]));
}
return d;
};
b.prototype.dispose = function () {
a.prototype.dispose.call(this);
this._resolve = null;
this._crossorigin = null;
};
b.test = function (a, c) {
return c === "svg" || typeof a == "string" && /^data:image\/svg\+xml(;(charset=utf8|utf8))?;base64/.test(a) || typeof a == "string" && b.SVG_XML.test(a);
};
b.SVG_XML = /^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m;
b.SVG_SIZE = /<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;
return b;
}(Ec);
var Jc = function (a) {
function b(c, d) {
var e = this;
d = d || {};
if (!(c instanceof HTMLVideoElement)) {
var f = document.createElement("video");
f.setAttribute("preload", "auto");
f.setAttribute("webkit-playsinline", "");
f.setAttribute("playsinline", "");
if (typeof c == "string") {
c = [c];
}
var g = c[0].src || c[0];
Ec.crossOrigin(f, g, d.crossorigin);
for (var h = 0; h < c.length; ++h) {
var i = document.createElement("source");
var j = c[h];
var k = j.src;
var l = j.mime;
var m = (k = k || c[h]).split("?").shift().toLowerCase();
var n = m.slice(m.lastIndexOf(".") + 1);
l = l || b.MIME_TYPES[n] || "video/" + n;
i.src = k;
i.type = l;
f.appendChild(i);
}
c = f;
}
(e = a.call(this, c) || this).noSubImage = true;
e._autoUpdate = true;
e._isConnectedToTicker = false;
e._updateFPS = d.updateFPS || 0;
e._msToNextUpdate = 0;
e.autoPlay = d.autoPlay !== false;
e._load = null;
e._resolve = null;
e._onCanPlay = e._onCanPlay.bind(e);
e._onError = e._onError.bind(e);
if (d.autoLoad !== false) {
e.load();
}
return e;
}
wc(b, a);
b.prototype.update = function (b) {
if (!this.destroyed) {
var c = ic.shared.elapsedMS * this.source.playbackRate;
this._msToNextUpdate = Math.floor(this._msToNextUpdate - c);
if (!this._updateFPS || this._msToNextUpdate <= 0) {
a.prototype.update.call(this);
this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;
}
}
};
b.prototype.load = function () {
var a = this;
if (this._load) {
return this._load;
}
var b = this.source;
if ((b.readyState === b.HAVE_ENOUGH_DATA || b.readyState === b.HAVE_FUTURE_DATA) && b.width && b.height) {
b.complete = true;
}
b.addEventListener("play", this._onPlayStart.bind(this));
b.addEventListener("pause", this._onPlayStop.bind(this));
if (this._isSourceReady()) {
this._onCanPlay();
} else {
b.addEventListener("canplay", this._onCanPlay);
b.addEventListener("canplaythrough", this._onCanPlay);
b.addEventListener("error", this._onError, true);
}
this._load = new Promise(function (c) {
if (a.valid) {
c(a);
} else {
a._resolve = c;
b.load();
}
});
return this._load;
};
b.prototype._onError = function (a) {
this.source.removeEventListener("error", this._onError, true);
this.onError.emit(a);
};
b.prototype._isSourcePlaying = function () {
var a = this.source;
return a.currentTime > 0 && a.paused === false && a.ended === false && a.readyState > 2;
};
b.prototype._isSourceReady = function () {
var a = this.source;
return a.readyState === 3 || a.readyState === 4;
};
b.prototype._onPlayStart = function () {
if (!this.valid) {
this._onCanPlay();
}
if (this.autoUpdate && !this._isConnectedToTicker) {
ic.shared.add(this.update, this);
this._isConnectedToTicker = true;
}
};
b.prototype._onPlayStop = function () {
if (this._isConnectedToTicker) {
ic.shared.remove(this.update, this);
this._isConnectedToTicker = false;
}
};
b.prototype._onCanPlay = function () {
var a = this.source;
a.removeEventListener("canplay", this._onCanPlay);
a.removeEventListener("canplaythrough", this._onCanPlay);
var b = this.valid;
this.resize(a.videoWidth, a.videoHeight);
if (!b && this._resolve) {
this._resolve(this);
this._resolve = null;
}
if (this._isSourcePlaying()) {
this._onPlayStart();
} else if (this.autoPlay) {
a.play();
}
};
b.prototype.dispose = function () {
if (this._isConnectedToTicker) {
ic.shared.remove(this.update, this);
this._isConnectedToTicker = false;
}
var b = this.source;
if (b) {
b.removeEventListener("error", this._onError, true);
b.pause();
b.src = "";
b.load();
}
a.prototype.dispose.call(this);
};
Object.defineProperty(b.prototype, "autoUpdate", {
get: function () {
return this._autoUpdate;
},
set: function (a) {
if (a !== this._autoUpdate) {
this._autoUpdate = a;
if (!this._autoUpdate && this._isConnectedToTicker) {
ic.shared.remove(this.update, this);
this._isConnectedToTicker = false;
} else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) {
ic.shared.add(this.update, this);
this._isConnectedToTicker = true;
}
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "updateFPS", {
get: function () {
return this._updateFPS;
},
set: function (a) {
if (a !== this._updateFPS) {
this._updateFPS = a;
}
},
enumerable: false,
configurable: true
});
b.test = function (a, c) {
return globalThis.HTMLVideoElement && a instanceof HTMLVideoElement || b.TYPES.indexOf(c) > -1;
};
b.TYPES = ["mp4", "m4v", "webm", "ogg", "ogv", "h264", "avi", "mov"];
b.MIME_TYPES = {
ogv: "video/ogg",
mov: "video/quicktime",
m4v: "video/mp4"
};
return b;
}(Ec);
var Kc = function (a) {
function b(b) {
return a.call(this, b) || this;
}
wc(b, a);
b.test = function (a) {
return !!globalThis.createImageBitmap && a instanceof ImageBitmap;
};
return b;
}(Ec);
tc.push(Hc, Kc, Fc, Jc, Ic, zc, Gc, Dc);
var Lc = {
"__proto__": null,
Resource: yc,
BaseImageResource: Ec,
INSTALLED: tc,
autoDetectResource: uc,
AbstractMultiResource: Cc,
ArrayResource: Dc,
BufferResource: zc,
CanvasResource: Fc,
CubeResource: Gc,
ImageResource: Hc,
SVGResource: Ic,
VideoResource: Jc,
ImageBitmapResource: Kc
};
var Mc = function (a) {
function b() {
return a !== null && a.apply(this, arguments) || this;
}
wc(b, a);
b.prototype.upload = function (a, b, c) {
var d = a.gl;
d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL, b.alphaMode === ya.UNPACK);
var e = b.realWidth;
var f = b.realHeight;
if (c.width === e && c.height === f) {
d.texSubImage2D(b.target, 0, 0, 0, e, f, b.format, c.type, this.data);
} else {
c.width = e;
c.height = f;
d.texImage2D(b.target, 0, c.internalFormat, e, f, 0, b.format, c.type, this.data);
}
return true;
};
return b;
}(zc);
var Nc = function () {
function a(a, b) {
this.width = Math.round(a || 100);
this.height = Math.round(b || 100);
this.stencil = false;
this.depth = false;
this.dirtyId = 0;
this.dirtyFormat = 0;
this.dirtySize = 0;
this.depthTexture = null;
this.colorTextures = [];
this.glFramebuffers = {};
this.disposeRunner = new sc("disposeFramebuffer");
this.multisample = Da.NONE;
}
Object.defineProperty(a.prototype, "colorTexture", {
get: function () {
return this.colorTextures[0];
},
enumerable: false,
configurable: true
});
a.prototype.addColorTexture = function (a, b) {
if (a === undefined) {
a = 0;
}
this.colorTextures[a] = b || new Bc(null, {
scaleMode: va.NEAREST,
resolution: 1,
mipmap: xa.OFF,
width: this.width,
height: this.height
});
this.dirtyId++;
this.dirtyFormat++;
return this;
};
a.prototype.addDepthTexture = function (a) {
this.depthTexture = a || new Bc(new Mc(null, {
width: this.width,
height: this.height
}), {
scaleMode: va.NEAREST,
resolution: 1,
width: this.width,
height: this.height,
mipmap: xa.OFF,
format: ra.DEPTH_COMPONENT,
type: ta.UNSIGNED_SHORT
});
this.dirtyId++;
this.dirtyFormat++;
return this;
};
a.prototype.enableDepth = function () {
this.depth = true;
this.dirtyId++;
this.dirtyFormat++;
return this;
};
a.prototype.enableStencil = function () {
this.stencil = true;
this.dirtyId++;
this.dirtyFormat++;
return this;
};
a.prototype.resize = function (a, b) {
a = Math.round(a);
b = Math.round(b);
if (a !== this.width || b !== this.height) {
this.width = a;
this.height = b;
this.dirtyId++;
this.dirtySize++;
for (var c = 0; c < this.colorTextures.length; c++) {
var d = this.colorTextures[c];
var e = d.resolution;
d.setSize(a / e, b / e);
}
if (this.depthTexture) {
e = this.depthTexture.resolution;
this.depthTexture.setSize(a / e, b / e);
}
}
};
a.prototype.dispose = function () {
this.disposeRunner.emit(this, false);
};
a.prototype.destroyDepthTexture = function () {
if (this.depthTexture) {
this.depthTexture.destroy();
this.depthTexture = null;
++this.dirtyId;
++this.dirtyFormat;
}
};
return a;
}();
var Oc = function (a) {
function b(b) {
if (b === undefined) {
b = {};
}
var c = this;
if (typeof b == "number") {
b = {
width: arguments[0],
height: arguments[1],
scaleMode: arguments[2],
resolution: arguments[3]
};
}
b.width = b.width || 100;
b.height = b.height || 100;
b.multisample = b.multisample !== undefined ? b.multisample : Da.NONE;
(c = a.call(this, null, b) || this).mipmap = xa.OFF;
c.valid = true;
c.clearColor = [0, 0, 0, 0];
c.framebuffer = new Nc(c.realWidth, c.realHeight).addColorTexture(0, c);
c.framebuffer.multisample = b.multisample;
c.maskStack = [];
c.filterStack = [{}];
return c;
}
wc(b, a);
b.prototype.resize = function (a, b) {
this.framebuffer.resize(a * this.resolution, b * this.resolution);
this.setRealSize(this.framebuffer.width, this.framebuffer.height);
};
b.prototype.dispose = function () {
this.framebuffer.dispose();
a.prototype.dispose.call(this);
};
b.prototype.destroy = function () {
a.prototype.destroy.call(this);
this.framebuffer.destroyDepthTexture();
this.framebuffer = null;
};
return b;
}(Bc);
var Pc = function () {
function a() {
this.x0 = 0;
this.y0 = 0;
this.x1 = 1;
this.y1 = 0;
this.x2 = 1;
this.y2 = 1;
this.x3 = 0;
this.y3 = 1;
this.uvsFloat32 = new Float32Array(8);
}
a.prototype.set = function (a, b, c) {
var d = b.width;
var e = b.height;
if (c) {
var f = a.width / 2 / d;
var g = a.height / 2 / e;
var h = a.x / d + f;
var i = a.y / e + g;
c = Eb.add(c, Eb.NW);
this.x0 = h + f * Eb.uX(c);
this.y0 = i + g * Eb.uY(c);
c = Eb.add(c, 2);
this.x1 = h + f * Eb.uX(c);
this.y1 = i + g * Eb.uY(c);
c = Eb.add(c, 2);
this.x2 = h + f * Eb.uX(c);
this.y2 = i + g * Eb.uY(c);
c = Eb.add(c, 2);
this.x3 = h + f * Eb.uX(c);
this.y3 = i + g * Eb.uY(c);
} else {
this.x0 = a.x / d;
this.y0 = a.y / e;
this.x1 = (a.x + a.width) / d;
this.y1 = a.y / e;
this.x2 = (a.x + a.width) / d;
this.y2 = (a.y + a.height) / e;
this.x3 = a.x / d;
this.y3 = (a.y + a.height) / e;
}
this.uvsFloat32[0] = this.x0;
this.uvsFloat32[1] = this.y0;
this.uvsFloat32[2] = this.x1;
this.uvsFloat32[3] = this.y1;
this.uvsFloat32[4] = this.x2;
this.uvsFloat32[5] = this.y2;
this.uvsFloat32[6] = this.x3;
this.uvsFloat32[7] = this.y3;
};
a.prototype.toString = function () {
return "[@pixi/core:TextureUvs x0=" + this.x0 + " y0=" + this.y0 + " x1=" + this.x1 + " y1=" + this.y1 + " x2=" + this.x2 + " y2=" + this.y2 + " x3=" + this.x3 + " y3=" + this.y3 + "]";
};
return a;
}();
var Qc = new Pc();
function Rc(a) {
a.destroy = function () {};
a.on = function () {};
a.once = function () {};
a.emit = function () {};
}
var Sc = function (a) {
function b(c, d, e, f, g, h) {
var i = a.call(this) || this;
i.noFrame = false;
if (!d) {
i.noFrame = true;
d = new qb(0, 0, 1, 1);
}
if (c instanceof b) {
c = c.baseTexture;
}
i.baseTexture = c;
i._frame = d;
i.trim = f;
i.valid = false;
i._uvs = Qc;
i.uvMatrix = null;
i.orig = e || d;
i._rotate = Number(g || 0);
if (g === true) {
i._rotate = 2;
} else if (i._rotate % 2 != 0) {
throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");
}
i.defaultAnchor = h ? new ob(h.x, h.y) : new ob(0, 0);
i._updateID = 0;
i.textureCacheIds = [];
if (c.valid) {
if (i.noFrame) {
if (c.valid) {
i.onBaseTextureUpdated(c);
}
} else {
i.frame = d;
}
} else {
c.once("loaded", i.onBaseTextureUpdated, i);
}
if (i.noFrame) {
c.on("update", i.onBaseTextureUpdated, i);
}
return i;
}
wc(b, a);
b.prototype.update = function () {
if (this.baseTexture.resource) {
this.baseTexture.resource.update();
}
};
b.prototype.onBaseTextureUpdated = function (a) {
if (this.noFrame) {
if (!this.baseTexture.valid) {
return;
}
this._frame.width = a.width;
this._frame.height = a.height;
this.valid = true;
this.updateUvs();
} else {
this.frame = this._frame;
}
this.emit("update", this);
};
b.prototype.destroy = function (a) {
if (this.baseTexture) {
if (a) {
var c = this.baseTexture.resource;
if (c && c.url && gb[c.url]) {
b.removeFromCache(c.url);
}
this.baseTexture.destroy();
}
this.baseTexture.off("loaded", this.onBaseTextureUpdated, this);
this.baseTexture.off("update", this.onBaseTextureUpdated, this);
this.baseTexture = null;
}
this._frame = null;
this._uvs = null;
this.trim = null;
this.orig = null;
this.valid = false;
b.removeFromCache(this);
this.textureCacheIds = null;
};
b.prototype.clone = function () {
var a = this._frame.clone();
var c = this._frame === this.orig ? a : this.orig.clone();
var d = new b(this.baseTexture, !this.noFrame && a, c, this.trim && this.trim.clone(), this.rotate, this.defaultAnchor);
if (this.noFrame) {
d._frame = a;
}
return d;
};
b.prototype.updateUvs = function () {
if (this._uvs === Qc) {
this._uvs = new Pc();
}
this._uvs.set(this._frame, this.baseTexture, this.rotate);
this._updateID++;
};
b.from = function (a, c, d) {
if (c === undefined) {
c = {};
}
if (d === undefined) {
d = Fa.STRICT_TEXTURE_CACHE;
}
var e = typeof a == "string";
var f = null;
if (e) {
f = a;
} else if (a instanceof Bc) {
if (!a.cacheId) {
var g = c && c.pixiIdPrefix || "pixiid";
a.cacheId = g + "-" + bb();
Bc.addToCache(a, a.cacheId);
}
f = a.cacheId;
} else {
if (!a._pixiId) {
g = c && c.pixiIdPrefix || "pixiid";
a._pixiId = g + "_" + bb();
}
f = a._pixiId;
}
var h = gb[f];
if (e && d && !h) {
throw new Error("The cacheId \"" + f + "\" does not exist in TextureCache.");
}
if (h || a instanceof Bc) {
if (!h && a instanceof Bc) {
h = new b(a);
b.addToCache(h, f);
}
} else {
c.resolution ||= jb(a);
(h = new b(new Bc(a, c))).baseTexture.cacheId = f;
Bc.addToCache(h.baseTexture, f);
b.addToCache(h, f);
}
return h;
};
b.fromURL = function (a, c) {
var d = Object.assign({
autoLoad: false
}, c == null ? undefined : c.resourceOptions);
var e = b.from(a, Object.assign({
resourceOptions: d
}, c), false);
var f = e.baseTexture.resource;
if (e.baseTexture.valid) {
return Promise.resolve(e);
} else {
return f.load().then(function () {
return Promise.resolve(e);
});
}
};
b.fromBuffer = function (a, c, d, e) {
return new b(Bc.fromBuffer(a, c, d, e));
};
b.fromLoader = function (a, c, d, e) {
var f = new Bc(a, Object.assign({
scaleMode: Fa.SCALE_MODE,
resolution: jb(c)
}, e));
var g = f.resource;
if (g instanceof Hc) {
g.url = c;
}
var h = new b(f);
d ||= c;
Bc.addToCache(h.baseTexture, d);
b.addToCache(h, d);
if (d !== c) {
Bc.addToCache(h.baseTexture, c);
b.addToCache(h, c);
}
if (h.baseTexture.valid) {
return Promise.resolve(h);
} else {
return new Promise(function (a) {
h.baseTexture.once("loaded", function () {
return a(h);
});
});
}
};
b.addToCache = function (a, b) {
if (b) {
if (a.textureCacheIds.indexOf(b) === -1) {
a.textureCacheIds.push(b);
}
if (gb[b]) {
console.warn("Texture added to the cache with an id [" + b + "] that already had an entry");
}
gb[b] = a;
}
};
b.removeFromCache = function (a) {
if (typeof a == "string") {
var b = gb[a];
if (b) {
var c = b.textureCacheIds.indexOf(a);
if (c > -1) {
b.textureCacheIds.splice(c, 1);
}
delete gb[a];
return b;
}
} else if (a && a.textureCacheIds) {
for (var d = 0; d < a.textureCacheIds.length; ++d) {
if (gb[a.textureCacheIds[d]] === a) {
delete gb[a.textureCacheIds[d]];
}
}
a.textureCacheIds.length = 0;
return a;
}
return null;
};
Object.defineProperty(b.prototype, "resolution", {
get: function () {
return this.baseTexture.resolution;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "frame", {
get: function () {
return this._frame;
},
set: function (a) {
this._frame = a;
this.noFrame = false;
var b = a.x;
var c = a.y;
var d = a.width;
var e = a.height;
var f = b + d > this.baseTexture.width;
var g = c + e > this.baseTexture.height;
if (f || g) {
var h = f && g ? "and" : "or";
var i = "X: " + b + " + " + d + " = " + (b + d) + " > " + this.baseTexture.width;
var j = "Y: " + c + " + " + e + " = " + (c + e) + " > " + this.baseTexture.height;
throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: " + i + " " + h + " " + j);
}
this.valid = d && e && this.baseTexture.valid;
if (!this.trim && !this.rotate) {
this.orig = a;
}
if (this.valid) {
this.updateUvs();
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "rotate", {
get: function () {
return this._rotate;
},
set: function (a) {
this._rotate = a;
if (this.valid) {
this.updateUvs();
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "width", {
get: function () {
return this.orig.width;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "height", {
get: function () {
return this.orig.height;
},
enumerable: false,
configurable: true
});
b.prototype.castToBaseTexture = function () {
return this.baseTexture;
};
Object.defineProperty(b, "EMPTY", {
get: function () {
if (!b._EMPTY) {
b._EMPTY = new b(new Bc());
Rc(b._EMPTY);
Rc(b._EMPTY.baseTexture);
}
return b._EMPTY;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b, "WHITE", {
get: function () {
if (!b._WHITE) {
var a = document.createElement("canvas");
var c = a.getContext("2d");
a.width = 16;
a.height = 16;
c.fillStyle = "white";
c.fillRect(0, 0, 16, 16);
b._WHITE = new b(new Bc(new Fc(a)));
Rc(b._WHITE);
Rc(b._WHITE.baseTexture);
}
return b._WHITE;
},
enumerable: false,
configurable: true
});
return b;
}(Ha());
var Tc = function (a) {
function b(b, c) {
var d = a.call(this, b, c) || this;
d.valid = true;
d.filterFrame = null;
d.filterPoolKey = null;
d.updateUvs();
return d;
}
wc(b, a);
Object.defineProperty(b.prototype, "framebuffer", {
get: function () {
return this.baseTexture.framebuffer;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "multisample", {
get: function () {
return this.framebuffer.multisample;
},
set: function (a) {
this.framebuffer.multisample = a;
},
enumerable: false,
configurable: true
});
b.prototype.resize = function (a, b, c) {
if (c === undefined) {
c = true;
}
var d = this.baseTexture.resolution;
var e = Math.round(a * d) / d;
var f = Math.round(b * d) / d;
this.valid = e > 0 && f > 0;
this._frame.width = this.orig.width = e;
this._frame.height = this.orig.height = f;
if (c) {
this.baseTexture.resize(e, f);
}
this.updateUvs();
};
b.prototype.setResolution = function (a) {
var b = this.baseTexture;
if (b.resolution !== a) {
b.setResolution(a);
this.resize(b.width, b.height, false);
}
};
b.create = function (a) {
for (var c = arguments, d = [], e = 1; e < arguments.length; e++) {
d[e - 1] = c[e];
}
if (typeof a == "number") {
db("6.0.0", "Arguments (width, height, scaleMode, resolution) have been deprecated.");
a = {
width: a,
height: d[0],
scaleMode: d[1],
resolution: d[2]
};
}
return new b(new Oc(a));
};
return b;
}(Sc);
var Uc = function () {
function a(a) {
this.texturePool = {};
this.textureOptions = a || {};
this.enableFullScreen = false;
this._pixelsWidth = 0;
this._pixelsHeight = 0;
}
a.prototype.createTexture = function (a, b, c) {
if (c === undefined) {
c = Da.NONE;
}
var d = new Oc(Object.assign({
width: a,
height: b,
resolution: 1,
multisample: c
}, this.textureOptions));
return new Tc(d);
};
a.prototype.getOptimalTexture = function (a, b, c, d) {
var e;
if (c === undefined) {
c = 1;
}
if (d === undefined) {
d = Da.NONE;
}
a = Math.ceil(a * c - 0.000001);
b = Math.ceil(b * c - 0.000001);
if (this.enableFullScreen && a === this._pixelsWidth && b === this._pixelsHeight) {
e = d > 1 ? -d : -1;
} else {
e = (((a = Xa(a)) & 65535) << 16 | (b = Xa(b)) & 65535) >>> 0;
if (d > 1) {
e += d * 4294967296;
}
}
this.texturePool[e] ||= [];
var f = this.texturePool[e].pop();
f ||= this.createTexture(a, b, d);
f.filterPoolKey = e;
f.setResolution(c);
return f;
};
a.prototype.getFilterTexture = function (a, b, c) {
var d = this.getOptimalTexture(a.width, a.height, b || a.resolution, c || Da.NONE);
d.filterFrame = a.filterFrame;
return d;
};
a.prototype.returnTexture = function (a) {
var b = a.filterPoolKey;
a.filterFrame = null;
this.texturePool[b].push(a);
};
a.prototype.returnFilterTexture = function (a) {
this.returnTexture(a);
};
a.prototype.clear = function (a) {
if (a = a !== false) {
for (var b in this.texturePool) {
var c = this.texturePool[b];
if (c) {
for (var d = 0; d < c.length; d++) {
c[d].destroy(true);
}
}
}
}
this.texturePool = {};
};
a.prototype.setScreenSize = function (a) {
if (a.width !== this._pixelsWidth || a.height !== this._pixelsHeight) {
this.enableFullScreen = a.width > 0 && a.height > 0;
for (var b in this.texturePool) {
if (Number(b) < 0) {
var c = this.texturePool[b];
if (c) {
for (var d = 0; d < c.length; d++) {
c[d].destroy(true);
}
}
this.texturePool[b] = [];
}
}
this._pixelsWidth = a.width;
this._pixelsHeight = a.height;
}
};
a.SCREEN_KEY = -1;
return a;
}();
var Vc = function () {
function a(a, b, c, d, e, f, g) {
if (b === undefined) {
b = 0;
}
if (c === undefined) {
c = false;
}
if (d === undefined) {
d = ta.FLOAT;
}
this.buffer = a;
this.size = b;
this.normalized = c;
this.type = d;
this.stride = e;
this.start = f;
this.instance = g;
}
a.prototype.destroy = function () {
this.buffer = null;
};
a.from = function (b, c, d, e, f) {
return new a(b, c, d, e, f);
};
return a;
}();
var Wc = 0;
var Xc = function () {
function a(a, b, c) {
if (b === undefined) {
b = true;
}
if (c === undefined) {
c = false;
}
this.data = a || new Float32Array(1);
this._glBuffers = {};
this._updateID = 0;
this.index = c;
this.static = b;
this.id = Wc++;
this.disposeRunner = new sc("disposeBuffer");
}
a.prototype.update = function (a) {
if (a instanceof Array) {
a = new Float32Array(a);
}
this.data = a || this.data;
this._updateID++;
};
a.prototype.dispose = function () {
this.disposeRunner.emit(this, false);
};
a.prototype.destroy = function () {
this.dispose();
this.data = null;
};
Object.defineProperty(a.prototype, "index", {
get: function () {
return this.type === Ea.ELEMENT_ARRAY_BUFFER;
},
set: function (a) {
this.type = a ? Ea.ELEMENT_ARRAY_BUFFER : Ea.ARRAY_BUFFER;
},
enumerable: false,
configurable: true
});
a.from = function (b) {
if (b instanceof Array) {
b = new Float32Array(b);
}
return new a(b);
};
return a;
}();
var Yc = {
Float32Array: Float32Array,
Uint32Array: Uint32Array,
Int32Array: Int32Array,
Uint8Array: Uint8Array
};
var Zc = {
5126: 4,
5123: 2,
5121: 1
};
var $c = 0;
var _c = {
Float32Array: Float32Array,
Uint32Array: Uint32Array,
Int32Array: Int32Array,
Uint8Array: Uint8Array,
Uint16Array: Uint16Array
};
var ad = function () {
function a(a, b) {
if (a === undefined) {
a = [];
}
if (b === undefined) {
b = {};
}
this.buffers = a;
this.indexBuffer = null;
this.attributes = b;
this.glVertexArrayObjects = {};
this.id = $c++;
this.instanced = false;
this.instanceCount = 1;
this.disposeRunner = new sc("disposeGeometry");
this.refCount = 0;
}
a.prototype.addAttribute = function (a, b, c, d, e, f, g, h) {
if (c === undefined) {
c = 0;
}
if (d === undefined) {
d = false;
}
if (h === undefined) {
h = false;
}
if (!b) {
throw new Error("You must pass a buffer when creating an attribute");
}
if (!(b instanceof Xc)) {
if (b instanceof Array) {
b = new Float32Array(b);
}
b = new Xc(b);
}
var i = a.split("|");
if (i.length > 1) {
for (var j = 0; j < i.length; j++) {
this.addAttribute(i[j], b, c, d, e);
}
return this;
}
var k = this.buffers.indexOf(b);
if (k === -1) {
this.buffers.push(b);
k = this.buffers.length - 1;
}
this.attributes[a] = new Vc(k, c, d, e, f, g, h);
this.instanced = this.instanced || h;
return this;
};
a.prototype.getAttribute = function (a) {
return this.attributes[a];
};
a.prototype.getBuffer = function (a) {
return this.buffers[this.getAttribute(a).buffer];
};
a.prototype.addIndex = function (a) {
if (!(a instanceof Xc)) {
if (a instanceof Array) {
a = new Uint16Array(a);
}
a = new Xc(a);
}
a.type = Ea.ELEMENT_ARRAY_BUFFER;
this.indexBuffer = a;
if (this.buffers.indexOf(a) === -1) {
this.buffers.push(a);
}
return this;
};
a.prototype.getIndex = function () {
return this.indexBuffer;
};
a.prototype.interleave = function () {
if (this.buffers.length === 1 || this.buffers.length === 2 && this.indexBuffer) {
return this;
}
var a;
var b = [];
var c = [];
var d = new Xc();
for (a in this.attributes) {
var e = this.attributes[a];
var f = this.buffers[e.buffer];
b.push(f.data);
c.push(e.size * Zc[e.type] / 4);
e.buffer = 0;
}
d.data = function (a, b) {
for (var c = 0, d = 0, e = {}, f = 0; f < a.length; f++) {
d += b[f];
c += a[f].length;
}
var g = new ArrayBuffer(c * 4);
var h = null;
var i = 0;
for (f = 0; f < a.length; f++) {
var j = b[f];
var k = a[f];
var l = Wa(k);
e[l] ||= new Yc[l](g);
h = e[l];
for (var m = 0; m < k.length; m++) {
h[(m / j | 0) * d + i + m % j] = k[m];
}
i += j;
}
return new Float32Array(g);
}(b, c);
a = 0;
for (; a < this.buffers.length; a++) {
if (this.buffers[a] !== this.indexBuffer) {
this.buffers[a].destroy();
}
}
this.buffers = [d];
if (this.indexBuffer) {
this.buffers.push(this.indexBuffer);
}
return this;
};
a.prototype.getSize = function () {
for (var a in this.attributes) {
var b = this.attributes[a];
return this.buffers[b.buffer].data.length / (b.stride / 4 || b.size);
}
return 0;
};
a.prototype.dispose = function () {
this.disposeRunner.emit(this, false);
};
a.prototype.destroy = function () {
this.dispose();
this.buffers = null;
this.indexBuffer = null;
this.attributes = null;
};
a.prototype.clone = function () {
for (var b = new a(), c = 0; c < this.buffers.length; c++) {
b.buffers[c] = new Xc(this.buffers[c].data.slice(0));
}
for (var c in this.attributes) {
var d = this.attributes[c];
b.attributes[c] = new Vc(d.buffer, d.size, d.normalized, d.type, d.stride, d.start, d.instance);
}
if (this.indexBuffer) {
b.indexBuffer = b.buffers[this.buffers.indexOf(this.indexBuffer)];
b.indexBuffer.type = Ea.ELEMENT_ARRAY_BUFFER;
}
return b;
};
a.merge = function (b) {
for (var c, d = new a(), e = [], f = [], g = [], h = 0; h < b.length; h++) {
c = b[h];
for (var i = 0; i < c.buffers.length; i++) {
f[i] = f[i] || 0;
f[i] += c.buffers[i].data.length;
g[i] = 0;
}
}
for (h = 0; h < c.buffers.length; h++) {
e[h] = new _c[Wa(c.buffers[h].data)](f[h]);
d.buffers[h] = new Xc(e[h]);
}
for (h = 0; h < b.length; h++) {
c = b[h];
i = 0;
c = b[h];
i = 0;
for (; i < c.buffers.length; i++) {
e[i].set(c.buffers[i].data, g[i]);
g[i] += c.buffers[i].data.length;
}
}
d.attributes = c.attributes;
if (c.indexBuffer) {
d.indexBuffer = d.buffers[c.buffers.indexOf(c.indexBuffer)];
d.indexBuffer.type = Ea.ELEMENT_ARRAY_BUFFER;
var j = 0;
var k = 0;
var l = 0;
var m = 0;
for (h = 0; h < c.buffers.length; h++) {
if (c.buffers[h] !== c.indexBuffer) {
m = h;
break;
}
}
for (var h in c.attributes) {
var n = c.attributes[h];
if ((n.buffer | 0) === m) {
k += n.size * Zc[n.type] / 4;
}
}
for (h = 0; h < b.length; h++) {
var o = b[h].indexBuffer.data;
for (i = 0; i < o.length; i++) {
d.indexBuffer.data[i + l] += j;
}
j += b[h].buffers[m].data.length / k;
l += o.length;
}
}
return d;
};
return a;
}();
var bd = function (a) {
function b() {
var b = a.call(this) || this;
b.addAttribute("aVertexPosition", new Float32Array([0, 0, 1, 0, 1, 1, 0, 1])).addIndex([0, 1, 3, 2]);
return b;
}
wc(b, a);
return b;
}(ad);
var cd = function (a) {
function b() {
var b = a.call(this) || this;
b.vertices = new Float32Array([-1, -1, 1, -1, 1, 1, -1, 1]);
b.uvs = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);
b.vertexBuffer = new Xc(b.vertices);
b.uvBuffer = new Xc(b.uvs);
b.addAttribute("aVertexPosition", b.vertexBuffer).addAttribute("aTextureCoord", b.uvBuffer).addIndex([0, 1, 2, 0, 2, 3]);
return b;
}
wc(b, a);
b.prototype.map = function (a, b) {
var c = 0;
var d = 0;
this.uvs[0] = c;
this.uvs[1] = d;
this.uvs[2] = c + b.width / a.width;
this.uvs[3] = d;
this.uvs[4] = c + b.width / a.width;
this.uvs[5] = d + b.height / a.height;
this.uvs[6] = c;
this.uvs[7] = d + b.height / a.height;
c = b.x;
d = b.y;
this.vertices[0] = c;
this.vertices[1] = d;
this.vertices[2] = c + b.width;
this.vertices[3] = d;
this.vertices[4] = c + b.width;
this.vertices[5] = d + b.height;
this.vertices[6] = c;
this.vertices[7] = d + b.height;
this.invalidate();
return this;
};
b.prototype.invalidate = function () {
this.vertexBuffer._updateID++;
this.uvBuffer._updateID++;
return this;
};
return b;
}(ad);
var dd = 0;
var ed = function () {
function a(a, b, c) {
this.group = true;
this.syncUniforms = {};
this.dirtyId = 0;
this.id = dd++;
this.static = !!b;
this.ubo = !!c;
if (a instanceof Xc) {
this.buffer = a;
this.buffer.type = Ea.UNIFORM_BUFFER;
this.autoManage = false;
this.ubo = true;
} else {
this.uniforms = a;
if (this.ubo) {
this.buffer = new Xc(new Float32Array(1));
this.buffer.type = Ea.UNIFORM_BUFFER;
this.autoManage = true;
}
}
}
a.prototype.update = function () {
this.dirtyId++;
if (!this.autoManage && this.buffer) {
this.buffer.update();
}
};
a.prototype.add = function (b, c, d) {
if (this.ubo) {
throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");
}
this.uniforms[b] = new a(c, d);
};
a.from = function (b, c, d) {
return new a(b, c, d);
};
a.uboFrom = function (b, c) {
return new a(b, c == null || c, true);
};
return a;
}();
var fd = function () {
function a() {
this.renderTexture = null;
this.target = null;
this.legacy = false;
this.resolution = 1;
this.multisample = Da.NONE;
this.sourceFrame = new qb();
this.destinationFrame = new qb();
this.bindingSourceFrame = new qb();
this.bindingDestinationFrame = new qb();
this.filters = [];
this.transform = null;
}
a.prototype.clear = function () {
this.target = null;
this.filters = null;
this.renderTexture = null;
};
return a;
}();
var gd = [new ob(), new ob(), new ob(), new ob()];
var hd = new wb();
var id = function () {
function a(a) {
this.renderer = a;
this.defaultFilterStack = [{}];
this.texturePool = new Uc();
this.texturePool.setScreenSize(a.view);
this.statePool = [];
this.quad = new bd();
this.quadUv = new cd();
this.tempRect = new qb();
this.activeState = {};
this.globalUniforms = new ed({
outputFrame: new qb(),
inputSize: new Float32Array(4),
inputPixel: new Float32Array(4),
inputClamp: new Float32Array(4),
resolution: 1,
filterArea: new Float32Array(4),
filterClamp: new Float32Array(4)
}, true);
this.forceClear = false;
this.useMaxPadding = false;
}
a.prototype.push = function (a, b) {
for (var c, d, e = this.renderer, f = this.defaultFilterStack, g = this.statePool.pop() || new fd(), h = this.renderer.renderTexture, i = b[0].resolution, j = b[0].multisample, k = b[0].padding, l = b[0].autoFit, m = (c = b[0].legacy) === null || c === undefined || c, n = 1; n < b.length; n++) {
var o = b[n];
i = Math.min(i, o.resolution);
j = Math.min(j, o.multisample);
k = this.useMaxPadding ? Math.max(k, o.padding) : k + o.padding;
l = l && o.autoFit;
m = m || (d = o.legacy) === null || d === undefined || d;
}
if (f.length === 1) {
this.defaultFilterStack[0].renderTexture = h.current;
}
f.push(g);
g.resolution = i;
g.multisample = j;
g.legacy = m;
g.target = a;
g.sourceFrame.copyFrom(a.filterArea || a.getBounds(true));
g.sourceFrame.pad(k);
var p = this.tempRect.copyFrom(h.sourceFrame);
if (e.projection.transform) {
this.transformAABB(hd.copyFrom(e.projection.transform).invert(), p);
}
if (l) {
g.sourceFrame.fit(p);
if (g.sourceFrame.width <= 0 || g.sourceFrame.height <= 0) {
g.sourceFrame.width = 0;
g.sourceFrame.height = 0;
}
} else if (!g.sourceFrame.intersects(p)) {
g.sourceFrame.width = 0;
g.sourceFrame.height = 0;
}
this.roundFrame(g.sourceFrame, h.current ? h.current.resolution : e.resolution, h.sourceFrame, h.destinationFrame, e.projection.transform);
g.renderTexture = this.getOptimalFilterTexture(g.sourceFrame.width, g.sourceFrame.height, i, j);
g.filters = b;
g.destinationFrame.width = g.renderTexture.width;
g.destinationFrame.height = g.renderTexture.height;
var q = this.tempRect;
q.x = 0;
q.y = 0;
q.width = g.sourceFrame.width;
q.height = g.sourceFrame.height;
g.renderTexture.filterFrame = g.sourceFrame;
g.bindingSourceFrame.copyFrom(h.sourceFrame);
g.bindingDestinationFrame.copyFrom(h.destinationFrame);
g.transform = e.projection.transform;
e.projection.transform = null;
h.bind(g.renderTexture, g.sourceFrame, q);
e.framebuffer.clear(0, 0, 0, 0);
};
a.prototype.pop = function () {
var a = this.defaultFilterStack;
var b = a.pop();
var c = b.filters;
this.activeState = b;
var d = this.globalUniforms.uniforms;
d.outputFrame = b.sourceFrame;
d.resolution = b.resolution;
var e = d.inputSize;
var f = d.inputPixel;
var g = d.inputClamp;
e[0] = b.destinationFrame.width;
e[1] = b.destinationFrame.height;
e[2] = 1 / e[0];
e[3] = 1 / e[1];
f[0] = Math.round(e[0] * b.resolution);
f[1] = Math.round(e[1] * b.resolution);
f[2] = 1 / f[0];
f[3] = 1 / f[1];
g[0] = f[2] * 0.5;
g[1] = f[3] * 0.5;
g[2] = b.sourceFrame.width * e[2] - f[2] * 0.5;
g[3] = b.sourceFrame.height * e[3] - f[3] * 0.5;
if (b.legacy) {
var h = d.filterArea;
h[0] = b.destinationFrame.width;
h[1] = b.destinationFrame.height;
h[2] = b.sourceFrame.x;
h[3] = b.sourceFrame.y;
d.filterClamp = d.inputClamp;
}
this.globalUniforms.update();
var i = a[a.length - 1];
this.renderer.framebuffer.blit();
if (c.length === 1) {
c[0].apply(this, b.renderTexture, i.renderTexture, za.BLEND, b);
this.returnFilterTexture(b.renderTexture);
} else {
var j = b.renderTexture;
var k = this.getOptimalFilterTexture(j.width, j.height, b.resolution);
k.filterFrame = j.filterFrame;
var l = 0;
for (l = 0; l < c.length - 1; ++l) {
if (l === 1 && b.multisample > 1) {
(k = this.getOptimalFilterTexture(j.width, j.height, b.resolution)).filterFrame = j.filterFrame;
}
c[l].apply(this, j, k, za.CLEAR, b);
var m = j;
j = k;
k = m;
}
c[l].apply(this, j, i.renderTexture, za.BLEND, b);
if (l > 1 && b.multisample > 1) {
this.returnFilterTexture(b.renderTexture);
}
this.returnFilterTexture(j);
this.returnFilterTexture(k);
}
b.clear();
this.statePool.push(b);
};
a.prototype.bindAndClear = function (a, b) {
if (b === undefined) {
b = za.CLEAR;
}
var c = this.renderer;
var d = c.renderTexture;
var e = c.state;
if (a === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) {
this.renderer.projection.transform = this.activeState.transform;
} else {
this.renderer.projection.transform = null;
}
if (a && a.filterFrame) {
var f = this.tempRect;
f.x = 0;
f.y = 0;
f.width = a.filterFrame.width;
f.height = a.filterFrame.height;
d.bind(a, a.filterFrame, f);
} else if (a !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) {
d.bind(a);
} else {
this.renderer.renderTexture.bind(a, this.activeState.bindingSourceFrame, this.activeState.bindingDestinationFrame);
}
var g = e.stateId & 1 || this.forceClear;
if (b === za.CLEAR || b === za.BLIT && g) {
this.renderer.framebuffer.clear(0, 0, 0, 0);
}
};
a.prototype.applyFilter = function (a, b, c, d) {
var e = this.renderer;
e.state.set(a.state);
this.bindAndClear(c, d);
a.uniforms.uSampler = b;
a.uniforms.filterGlobals = this.globalUniforms;
e.shader.bind(a);
a.legacy = !!a.program.attributeData.aTextureCoord;
if (a.legacy) {
this.quadUv.map(b._frame, b.filterFrame);
e.geometry.bind(this.quadUv);
e.geometry.draw(qa.TRIANGLES);
} else {
e.geometry.bind(this.quad);
e.geometry.draw(qa.TRIANGLE_STRIP);
}
};
a.prototype.calculateSpriteMatrix = function (a, b) {
var c = this.activeState;
var d = c.sourceFrame;
var e = c.destinationFrame;
var f = b._texture.orig;
var g = a.set(e.width, 0, 0, e.height, d.x, d.y);
var h = b.worldTransform.copyTo(wb.TEMP_MATRIX);
h.invert();
g.prepend(h);
g.scale(1 / f.width, 1 / f.height);
g.translate(b.anchor.x, b.anchor.y);
return g;
};
a.prototype.destroy = function () {
this.renderer = null;
this.texturePool.clear(false);
};
a.prototype.getOptimalFilterTexture = function (a, b, c, d) {
if (c === undefined) {
c = 1;
}
if (d === undefined) {
d = Da.NONE;
}
return this.texturePool.getOptimalTexture(a, b, c, d);
};
a.prototype.getFilterTexture = function (a, b, c) {
if (typeof a == "number") {
var d = a;
a = b;
b = d;
}
a = a || this.activeState.renderTexture;
var e = this.texturePool.getOptimalTexture(a.width, a.height, b || a.resolution, c || Da.NONE);
e.filterFrame = a.filterFrame;
return e;
};
a.prototype.returnFilterTexture = function (a) {
this.texturePool.returnTexture(a);
};
a.prototype.emptyPool = function () {
this.texturePool.clear(true);
};
a.prototype.resize = function () {
this.texturePool.setScreenSize(this.renderer.view);
};
a.prototype.transformAABB = function (a, b) {
var c = gd[0];
var d = gd[1];
var e = gd[2];
var f = gd[3];
c.set(b.left, b.top);
d.set(b.left, b.bottom);
e.set(b.right, b.top);
f.set(b.right, b.bottom);
a.apply(c, c);
a.apply(d, d);
a.apply(e, e);
a.apply(f, f);
var g = Math.min(c.x, d.x, e.x, f.x);
var h = Math.min(c.y, d.y, e.y, f.y);
var i = Math.max(c.x, d.x, e.x, f.x);
var j = Math.max(c.y, d.y, e.y, f.y);
b.x = g;
b.y = h;
b.width = i - g;
b.height = j - h;
};
a.prototype.roundFrame = function (a, b, c, d, e) {
if (a.width > 0 && a.height > 0 && c.width > 0 && c.height > 0) {
if (e) {
var f = e.a;
var g = e.b;
var h = e.c;
var i = e.d;
if ((Math.abs(g) > 0.0001 || Math.abs(h) > 0.0001) && (Math.abs(f) > 0.0001 || Math.abs(i) > 0.0001)) {
return;
}
}
(e = e ? hd.copyFrom(e) : hd.identity()).translate(-c.x, -c.y).scale(d.width / c.width, d.height / c.height).translate(d.x, d.y);
this.transformAABB(e, a);
a.ceil(b);
this.transformAABB(e.invert(), a);
}
};
return a;
}();
var jd = function () {
function a(a) {
this.renderer = a;
}
a.prototype.flush = function () {};
a.prototype.destroy = function () {
this.renderer = null;
};
a.prototype.start = function () {};
a.prototype.stop = function () {
this.flush();
};
a.prototype.render = function (a) {};
return a;
}();
var kd = function () {
function a(a) {
this.renderer = a;
this.emptyRenderer = new jd(a);
this.currentRenderer = this.emptyRenderer;
}
a.prototype.setObjectRenderer = function (a) {
if (this.currentRenderer !== a) {
this.currentRenderer.stop();
this.currentRenderer = a;
this.currentRenderer.start();
}
};
a.prototype.flush = function () {
this.setObjectRenderer(this.emptyRenderer);
};
a.prototype.reset = function () {
this.setObjectRenderer(this.emptyRenderer);
};
a.prototype.copyBoundTextures = function (a, b) {
for (var c = this.renderer.texture.boundTextures, d = b - 1; d >= 0; --d) {
a[d] = c[d] || null;
if (a[d]) {
a[d]._batchLocation = d;
}
}
};
a.prototype.boundArray = function (a, b, c, d) {
for (var e = a.elements, f = a.ids, g = a.count, h = 0, i = 0; i < g; i++) {
var j = e[i];
var k = j._batchLocation;
if (k >= 0 && k < d && b[k] === j) {
f[i] = k;
} else {
while (h < d) {
var l = b[h];
if (!l || l._batchEnabled !== c || l._batchLocation !== h) {
f[i] = h;
j._batchLocation = h;
b[h] = j;
break;
}
h++;
}
}
}
};
a.prototype.destroy = function () {
this.renderer = null;
};
return a;
}();
var ld = 0;
var md = function () {
function a(a) {
this.renderer = a;
this.webGLVersion = 1;
this.extensions = {};
this.supports = {
uint32Indices: false
};
this.handleContextLost = this.handleContextLost.bind(this);
this.handleContextRestored = this.handleContextRestored.bind(this);
a.view.addEventListener("webglcontextlost", this.handleContextLost, false);
a.view.addEventListener("webglcontextrestored", this.handleContextRestored, false);
}
Object.defineProperty(a.prototype, "isLost", {
get: function () {
return !this.gl || this.gl.isContextLost();
},
enumerable: false,
configurable: true
});
a.prototype.contextChange = function (a) {
this.gl = a;
this.renderer.gl = a;
this.renderer.CONTEXT_UID = ld++;
if (a.isContextLost() && a.getExtension("WEBGL_lose_context")) {
a.getExtension("WEBGL_lose_context").restoreContext();
}
};
a.prototype.initFromContext = function (a) {
this.gl = a;
this.validateContext(a);
this.renderer.gl = a;
this.renderer.CONTEXT_UID = ld++;
this.renderer.runners.contextChange.emit(a);
};
a.prototype.initFromOptions = function (a) {
var b = this.createContext(this.renderer.view, a);
this.initFromContext(b);
};
a.prototype.createContext = function (a, b) {
var c;
if (Fa.PREFER_ENV >= ma.WEBGL2) {
c = a.getContext("webgl2", b);
}
if (c) {
this.webGLVersion = 2;
} else {
this.webGLVersion = 1;
if (!(c = a.getContext("webgl", b) || a.getContext("experimental-webgl", b))) {
throw new Error("This browser does not support WebGL. Try using the canvas renderer");
}
}
this.gl = c;
this.getExtensions();
return this.gl;
};
a.prototype.getExtensions = function () {
var a = this.gl;
var b = {
anisotropicFiltering: a.getExtension("EXT_texture_filter_anisotropic"),
floatTextureLinear: a.getExtension("OES_texture_float_linear"),
s3tc: a.getExtension("WEBGL_compressed_texture_s3tc"),
s3tc_sRGB: a.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
etc: a.getExtension("WEBGL_compressed_texture_etc"),
etc1: a.getExtension("WEBGL_compressed_texture_etc1"),
pvrtc: a.getExtension("WEBGL_compressed_texture_pvrtc") || a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
atc: a.getExtension("WEBGL_compressed_texture_atc"),
astc: a.getExtension("WEBGL_compressed_texture_astc")
};
if (this.webGLVersion === 1) {
Object.assign(this.extensions, b, {
drawBuffers: a.getExtension("WEBGL_draw_buffers"),
depthTexture: a.getExtension("WEBGL_depth_texture"),
loseContext: a.getExtension("WEBGL_lose_context"),
vertexArrayObject: a.getExtension("OES_vertex_array_object") || a.getExtension("MOZ_OES_vertex_array_object") || a.getExtension("WEBKIT_OES_vertex_array_object"),
uint32ElementIndex: a.getExtension("OES_element_index_uint"),
floatTexture: a.getExtension("OES_texture_float"),
floatTextureLinear: a.getExtension("OES_texture_float_linear"),
textureHalfFloat: a.getExtension("OES_texture_half_float"),
textureHalfFloatLinear: a.getExtension("OES_texture_half_float_linear")
});
} else if (this.webGLVersion === 2) {
Object.assign(this.extensions, b, {
colorBufferFloat: a.getExtension("EXT_color_buffer_float")
});
}
};
a.prototype.handleContextLost = function (a) {
a.preventDefault();
};
a.prototype.handleContextRestored = function () {
this.renderer.runners.contextChange.emit(this.gl);
};
a.prototype.destroy = function () {
var a = this.renderer.view;
this.renderer = null;
a.removeEventListener("webglcontextlost", this.handleContextLost);
a.removeEventListener("webglcontextrestored", this.handleContextRestored);
this.gl.useProgram(null);
if (this.extensions.loseContext) {
this.extensions.loseContext.loseContext();
}
};
a.prototype.postrender = function () {
if (this.renderer.renderingToScreen) {
this.gl.flush();
}
};
a.prototype.validateContext = function (a) {
var b = a.getContextAttributes();
var c = "WebGL2RenderingContext" in globalThis && a instanceof globalThis.WebGL2RenderingContext;
if (c) {
this.webGLVersion = 2;
}
if (!b.stencil) {
console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");
}
var d = c || !!a.getExtension("OES_element_index_uint");
this.supports.uint32Indices = d;
if (!d) {
console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly");
}
};
return a;
}();
function nd(a) {
this.framebuffer = a;
this.stencil = null;
this.dirtyId = -1;
this.dirtyFormat = -1;
this.dirtySize = -1;
this.multisample = Da.NONE;
this.msaaBuffer = null;
this.blitFramebuffer = null;
this.mipLevel = 0;
}
var od = new qb();
var pd = function () {
function a(a) {
this.renderer = a;
this.managedFramebuffers = [];
this.unknownFramebuffer = new Nc(10, 10);
this.msaaSamples = null;
}
a.prototype.contextChange = function () {
var a = this.gl = this.renderer.gl;
this.CONTEXT_UID = this.renderer.CONTEXT_UID;
this.current = this.unknownFramebuffer;
this.viewport = new qb();
this.hasMRT = true;
this.writeDepthTexture = true;
this.disposeAll(true);
if (this.renderer.context.webGLVersion === 1) {
var b = this.renderer.context.extensions.drawBuffers;
var c = this.renderer.context.extensions.depthTexture;
if (Fa.PREFER_ENV === ma.WEBGL_LEGACY) {
b = null;
c = null;
}
if (b) {
a.drawBuffers = function (a) {
return b.drawBuffersWEBGL(a);
};
} else {
this.hasMRT = false;
a.drawBuffers = function () {};
}
if (!c) {
this.writeDepthTexture = false;
}
} else {
this.msaaSamples = a.getInternalformatParameter(a.RENDERBUFFER, a.RGBA8, a.SAMPLES);
}
};
a.prototype.bind = function (a, b, c) {
if (c === undefined) {
c = 0;
}
var d = this.gl;
if (a) {
var e = a.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(a);
if (this.current !== a) {
this.current = a;
d.bindFramebuffer(d.FRAMEBUFFER, e.framebuffer);
}
if (e.mipLevel !== c) {
a.dirtyId++;
a.dirtyFormat++;
e.mipLevel = c;
}
if (e.dirtyId !== a.dirtyId) {
e.dirtyId = a.dirtyId;
if (e.dirtyFormat !== a.dirtyFormat) {
e.dirtyFormat = a.dirtyFormat;
e.dirtySize = a.dirtySize;
this.updateFramebuffer(a, c);
} else if (e.dirtySize !== a.dirtySize) {
e.dirtySize = a.dirtySize;
this.resizeFramebuffer(a);
}
}
for (var f = 0; f < a.colorTextures.length; f++) {
var g = a.colorTextures[f];
this.renderer.texture.unbind(g.parentTextureArray || g);
}
if (a.depthTexture) {
this.renderer.texture.unbind(a.depthTexture);
}
if (b) {
var h = b.width >> c;
var i = b.height >> c;
var j = h / b.width;
this.setViewport(b.x * j, b.y * j, h, i);
} else {
h = a.width >> c;
i = a.height >> c;
this.setViewport(0, 0, h, i);
}
} else {
if (this.current) {
this.current = null;
d.bindFramebuffer(d.FRAMEBUFFER, null);
}
if (b) {
this.setViewport(b.x, b.y, b.width, b.height);
} else {
this.setViewport(0, 0, this.renderer.width, this.renderer.height);
}
}
};
a.prototype.setViewport = function (a, b, c, d) {
var e = this.viewport;
a = Math.round(a);
b = Math.round(b);
c = Math.round(c);
d = Math.round(d);
if (e.width !== c || e.height !== d || e.x !== a || e.y !== b) {
e.x = a;
e.y = b;
e.width = c;
e.height = d;
this.gl.viewport(a, b, c, d);
}
};
Object.defineProperty(a.prototype, "size", {
get: function () {
if (this.current) {
return {
x: 0,
y: 0,
width: this.current.width,
height: this.current.height
};
} else {
return {
x: 0,
y: 0,
width: this.renderer.width,
height: this.renderer.height
};
}
},
enumerable: false,
configurable: true
});
a.prototype.clear = function (a, b, c, d, e) {
if (e === undefined) {
e = oa.COLOR | oa.DEPTH;
}
var f = this.gl;
f.clearColor(a, b, c, d);
f.clear(e);
};
a.prototype.initFramebuffer = function (a) {
var b = this.gl;
var c = new nd(b.createFramebuffer());
c.multisample = this.detectSamples(a.multisample);
a.glFramebuffers[this.CONTEXT_UID] = c;
this.managedFramebuffers.push(a);
a.disposeRunner.add(this);
return c;
};
a.prototype.resizeFramebuffer = function (a) {
var b = this.gl;
var c = a.glFramebuffers[this.CONTEXT_UID];
if (c.msaaBuffer) {
b.bindRenderbuffer(b.RENDERBUFFER, c.msaaBuffer);
b.renderbufferStorageMultisample(b.RENDERBUFFER, c.multisample, b.RGBA8, a.width, a.height);
}
if (c.stencil) {
b.bindRenderbuffer(b.RENDERBUFFER, c.stencil);
if (c.msaaBuffer) {
b.renderbufferStorageMultisample(b.RENDERBUFFER, c.multisample, b.DEPTH24_STENCIL8, a.width, a.height);
} else {
b.renderbufferStorage(b.RENDERBUFFER, b.DEPTH_STENCIL, a.width, a.height);
}
}
var d = a.colorTextures;
var e = d.length;
if (!b.drawBuffers) {
e = Math.min(e, 1);
}
for (var f = 0; f < e; f++) {
var g = d[f];
var h = g.parentTextureArray || g;
this.renderer.texture.bind(h, 0);
}
if (a.depthTexture && this.writeDepthTexture) {
this.renderer.texture.bind(a.depthTexture, 0);
}
};
a.prototype.updateFramebuffer = function (a, b) {
var c = this.gl;
var d = a.glFramebuffers[this.CONTEXT_UID];
var e = a.colorTextures;
var f = e.length;
if (!c.drawBuffers) {
f = Math.min(f, 1);
}
if (d.multisample > 1 && this.canMultisampleFramebuffer(a)) {
d.msaaBuffer = d.msaaBuffer || c.createRenderbuffer();
c.bindRenderbuffer(c.RENDERBUFFER, d.msaaBuffer);
c.renderbufferStorageMultisample(c.RENDERBUFFER, d.multisample, c.RGBA8, a.width, a.height);
c.framebufferRenderbuffer(c.FRAMEBUFFER, c.COLOR_ATTACHMENT0, c.RENDERBUFFER, d.msaaBuffer);
} else if (d.msaaBuffer) {
c.deleteRenderbuffer(d.msaaBuffer);
d.msaaBuffer = null;
if (d.blitFramebuffer) {
d.blitFramebuffer.dispose();
d.blitFramebuffer = null;
}
}
for (var g = [], h = 0; h < f; h++) {
var i = e[h];
var j = i.parentTextureArray || i;
this.renderer.texture.bind(j, 0);
if (h !== 0 || !d.msaaBuffer) {
c.framebufferTexture2D(c.FRAMEBUFFER, c.COLOR_ATTACHMENT0 + h, i.target, j._glTextures[this.CONTEXT_UID].texture, b);
g.push(c.COLOR_ATTACHMENT0 + h);
}
}
if (g.length > 1) {
c.drawBuffers(g);
}
if (a.depthTexture && this.writeDepthTexture) {
var k = a.depthTexture;
this.renderer.texture.bind(k, 0);
c.framebufferTexture2D(c.FRAMEBUFFER, c.DEPTH_ATTACHMENT, c.TEXTURE_2D, k._glTextures[this.CONTEXT_UID].texture, b);
}
if (!a.stencil && !a.depth || a.depthTexture && this.writeDepthTexture) {
if (d.stencil) {
c.deleteRenderbuffer(d.stencil);
d.stencil = null;
}
} else {
d.stencil = d.stencil || c.createRenderbuffer();
c.bindRenderbuffer(c.RENDERBUFFER, d.stencil);
if (d.msaaBuffer) {
c.renderbufferStorageMultisample(c.RENDERBUFFER, d.multisample, c.DEPTH24_STENCIL8, a.width, a.height);
} else {
c.renderbufferStorage(c.RENDERBUFFER, c.DEPTH_STENCIL, a.width, a.height);
}
c.framebufferRenderbuffer(c.FRAMEBUFFER, c.DEPTH_STENCIL_ATTACHMENT, c.RENDERBUFFER, d.stencil);
}
};
a.prototype.canMultisampleFramebuffer = function (a) {
return this.renderer.context.webGLVersion !== 1 && a.colorTextures.length <= 1 && !a.depthTexture;
};
a.prototype.detectSamples = function (a) {
var b = this.msaaSamples;
var c = Da.NONE;
if (a <= 1 || b === null) {
return c;
}
for (var d = 0; d < b.length; d++) {
if (b[d] <= a) {
c = b[d];
break;
}
}
if (c === 1) {
c = Da.NONE;
}
return c;
};
a.prototype.blit = function (a, b, c) {
var d = this;
var e = d.current;
var f = d.renderer;
var g = d.gl;
var h = d.CONTEXT_UID;
if (f.context.webGLVersion === 2 && e) {
var i = e.glFramebuffers[h];
if (i) {
if (!a) {
if (!i.msaaBuffer) {
return;
}
var j = e.colorTextures[0];
if (!j) {
return;
}
if (!i.blitFramebuffer) {
i.blitFramebuffer = new Nc(e.width, e.height);
i.blitFramebuffer.addColorTexture(0, j);
}
if ((a = i.blitFramebuffer).colorTextures[0] !== j) {
a.colorTextures[0] = j;
a.dirtyId++;
a.dirtyFormat++;
}
if (a.width !== e.width || a.height !== e.height) {
a.width = e.width;
a.height = e.height;
a.dirtyId++;
a.dirtySize++;
}
}
if (!b) {
(b = od).width = e.width;
b.height = e.height;
}
c ||= b;
var k = b.width === c.width && b.height === c.height;
this.bind(a);
g.bindFramebuffer(g.READ_FRAMEBUFFER, i.framebuffer);
g.blitFramebuffer(b.left, b.top, b.right, b.bottom, c.left, c.top, c.right, c.bottom, g.COLOR_BUFFER_BIT, k ? g.NEAREST : g.LINEAR);
}
}
};
a.prototype.disposeFramebuffer = function (a, b) {
var c = a.glFramebuffers[this.CONTEXT_UID];
var d = this.gl;
if (c) {
delete a.glFramebuffers[this.CONTEXT_UID];
var e = this.managedFramebuffers.indexOf(a);
if (e >= 0) {
this.managedFramebuffers.splice(e, 1);
}
a.disposeRunner.remove(this);
if (!b) {
d.deleteFramebuffer(c.framebuffer);
if (c.msaaBuffer) {
d.deleteRenderbuffer(c.msaaBuffer);
}
if (c.stencil) {
d.deleteRenderbuffer(c.stencil);
}
}
if (c.blitFramebuffer) {
c.blitFramebuffer.dispose();
}
}
};
a.prototype.disposeAll = function (a) {
var b = this.managedFramebuffers;
this.managedFramebuffers = [];
for (var c = 0; c < b.length; c++) {
this.disposeFramebuffer(b[c], a);
}
};
a.prototype.forceStencil = function () {
var a = this.current;
if (a) {
var b = a.glFramebuffers[this.CONTEXT_UID];
if (b && !b.stencil) {
a.stencil = true;
var c = a.width;
var d = a.height;
var e = this.gl;
var f = e.createRenderbuffer();
e.bindRenderbuffer(e.RENDERBUFFER, f);
if (b.msaaBuffer) {
e.renderbufferStorageMultisample(e.RENDERBUFFER, b.multisample, e.DEPTH24_STENCIL8, c, d);
} else {
e.renderbufferStorage(e.RENDERBUFFER, e.DEPTH_STENCIL, c, d);
}
b.stencil = f;
e.framebufferRenderbuffer(e.FRAMEBUFFER, e.DEPTH_STENCIL_ATTACHMENT, e.RENDERBUFFER, f);
}
}
};
a.prototype.reset = function () {
this.current = this.unknownFramebuffer;
this.viewport = new qb();
};
a.prototype.destroy = function () {
this.renderer = null;
};
return a;
}();
var qd = {
5126: 4,
5123: 2,
5121: 1
};
var rd = function () {
function a(a) {
this.renderer = a;
this._activeGeometry = null;
this._activeVao = null;
this.hasVao = true;
this.hasInstance = true;
this.canUseUInt32ElementIndex = false;
this.managedGeometries = {};
}
a.prototype.contextChange = function () {
this.disposeAll(true);
var a = this.gl = this.renderer.gl;
var b = this.renderer.context;
this.CONTEXT_UID = this.renderer.CONTEXT_UID;
if (b.webGLVersion !== 2) {
var c = this.renderer.context.extensions.vertexArrayObject;
if (Fa.PREFER_ENV === ma.WEBGL_LEGACY) {
c = null;
}
if (c) {
a.createVertexArray = function () {
return c.createVertexArrayOES();
};
a.bindVertexArray = function (a) {
return c.bindVertexArrayOES(a);
};
a.deleteVertexArray = function (a) {
return c.deleteVertexArrayOES(a);
};
} else {
this.hasVao = false;
a.createVertexArray = function () {
return null;
};
a.bindVertexArray = function () {
return null;
};
a.deleteVertexArray = function () {
return null;
};
}
}
if (b.webGLVersion !== 2) {
var d = a.getExtension("ANGLE_instanced_arrays");
if (d) {
a.vertexAttribDivisor = function (a, b) {
return d.vertexAttribDivisorANGLE(a, b);
};
a.drawElementsInstanced = function (a, b, c, e, f) {
return d.drawElementsInstancedANGLE(a, b, c, e, f);
};
a.drawArraysInstanced = function (a, b, c, e) {
return d.drawArraysInstancedANGLE(a, b, c, e);
};
} else {
this.hasInstance = false;
}
}
this.canUseUInt32ElementIndex = b.webGLVersion === 2 || !!b.extensions.uint32ElementIndex;
};
a.prototype.bind = function (a, b) {
b = b || this.renderer.shader.shader;
var c = this.gl;
var d = a.glVertexArrayObjects[this.CONTEXT_UID];
var e = false;
if (!d) {
this.managedGeometries[a.id] = a;
a.disposeRunner.add(this);
a.glVertexArrayObjects[this.CONTEXT_UID] = d = {};
e = true;
}
var f = d[b.program.id] || this.initGeometryVao(a, b, e);
this._activeGeometry = a;
if (this._activeVao !== f) {
this._activeVao = f;
if (this.hasVao) {
c.bindVertexArray(f);
} else {
this.activateVao(a, b.program);
}
}
this.updateBuffers();
};
a.prototype.reset = function () {
this.unbind();
};
a.prototype.updateBuffers = function () {
for (var a = this._activeGeometry, b = this.renderer.buffer, c = 0; c < a.buffers.length; c++) {
var d = a.buffers[c];
b.update(d);
}
};
a.prototype.checkCompatibility = function (a, b) {
var c = a.attributes;
var d = b.attributeData;
for (var e in d) {
if (!c[e]) {
throw new Error("shader and geometry incompatible, geometry missing the \"" + e + "\" attribute");
}
}
};
a.prototype.getSignature = function (a, b) {
var c = a.attributes;
var d = b.attributeData;
var e = ["g", a.id];
for (var f in c) {
if (d[f]) {
e.push(f, d[f].location);
}
}
return e.join("-");
};
a.prototype.initGeometryVao = function (a, b, c) {
if (c === undefined) {
c = true;
}
var d = this.gl;
var e = this.CONTEXT_UID;
var f = this.renderer.buffer;
var g = b.program;
if (!g.glPrograms[e]) {
this.renderer.shader.generateProgram(b);
}
this.checkCompatibility(a, g);
var h = this.getSignature(a, g);
var i = a.glVertexArrayObjects[this.CONTEXT_UID];
var j = i[h];
if (j) {
i[g.id] = j;
return j;
}
var k = a.buffers;
var l = a.attributes;
var m = {};
var n = {};
for (var o in k) {
m[o] = 0;
n[o] = 0;
}
for (var o in l) {
if (!l[o].size && g.attributeData[o]) {
l[o].size = g.attributeData[o].size;
} else if (!l[o].size) {
console.warn("PIXI Geometry attribute '" + o + "' size cannot be determined (likely the bound shader does not have the attribute)");
}
m[l[o].buffer] += l[o].size * qd[l[o].type];
}
for (var o in l) {
var p = l[o];
var q = p.size;
if (p.stride === undefined) {
if (m[p.buffer] === q * qd[p.type]) {
p.stride = 0;
} else {
p.stride = m[p.buffer];
}
}
if (p.start === undefined) {
p.start = n[p.buffer];
n[p.buffer] += q * qd[p.type];
}
}
j = d.createVertexArray();
d.bindVertexArray(j);
for (var r = 0; r < k.length; r++) {
var s = k[r];
f.bind(s);
if (c) {
s._glBuffers[e].refCount++;
}
}
this.activateVao(a, g);
this._activeVao = j;
i[g.id] = j;
i[h] = j;
return j;
};
a.prototype.disposeGeometry = function (a, b) {
if (this.managedGeometries[a.id]) {
delete this.managedGeometries[a.id];
var c = a.glVertexArrayObjects[this.CONTEXT_UID];
var d = this.gl;
var e = a.buffers;
var f = this.renderer?.buffer;
a.disposeRunner.remove(this);
if (c) {
if (f) {
for (var g = 0; g < e.length; g++) {
var h = e[g]._glBuffers[this.CONTEXT_UID];
if (h) {
h.refCount--;
if (h.refCount === 0 && !b) {
f.dispose(e[g], b);
}
}
}
}
if (!b) {
for (var i in c) {
if (i[0] === "g") {
var j = c[i];
if (this._activeVao === j) {
this.unbind();
}
d.deleteVertexArray(j);
}
}
}
delete a.glVertexArrayObjects[this.CONTEXT_UID];
}
}
};
a.prototype.disposeAll = function (a) {
for (var b = Object.keys(this.managedGeometries), c = 0; c < b.length; c++) {
this.disposeGeometry(this.managedGeometries[b[c]], a);
}
};
a.prototype.activateVao = function (a, b) {
var c = this.gl;
var d = this.CONTEXT_UID;
var e = this.renderer.buffer;
var f = a.buffers;
var g = a.attributes;
if (a.indexBuffer) {
e.bind(a.indexBuffer);
}
var h = null;
for (var i in g) {
var j = g[i];
var k = f[j.buffer];
var l = k._glBuffers[d];
if (b.attributeData[i]) {
if (h !== l) {
e.bind(k);
h = l;
}
var m = b.attributeData[i].location;
c.enableVertexAttribArray(m);
c.vertexAttribPointer(m, j.size, j.type || c.FLOAT, j.normalized, j.stride, j.start);
if (j.instance) {
if (!this.hasInstance) {
throw new Error("geometry error, GPU Instancing is not supported on this device");
}
c.vertexAttribDivisor(m, 1);
}
}
}
};
a.prototype.draw = function (a, b, c, d) {
var e = this.gl;
var f = this._activeGeometry;
if (f.indexBuffer) {
var g = f.indexBuffer.data.BYTES_PER_ELEMENT;
var h = g === 2 ? e.UNSIGNED_SHORT : e.UNSIGNED_INT;
if (g === 2 || g === 4 && this.canUseUInt32ElementIndex) {
if (f.instanced) {
e.drawElementsInstanced(a, b || f.indexBuffer.data.length, h, (c || 0) * g, d || 1);
} else {
e.drawElements(a, b || f.indexBuffer.data.length, h, (c || 0) * g);
}
} else {
console.warn("unsupported index buffer type: uint32");
}
} else if (f.instanced) {
e.drawArraysInstanced(a, c, b || f.getSize(), d || 1);
} else {
e.drawArrays(a, c, b || f.getSize());
}
return this;
};
a.prototype.unbind = function () {
this.gl.bindVertexArray(null);
this._activeVao = null;
this._activeGeometry = null;
};
a.prototype.destroy = function () {
this.renderer = null;
};
return a;
}();
var sd = function () {
function a(a) {
if (a === undefined) {
a = null;
}
this.type = Ca.NONE;
this.autoDetect = true;
this.maskObject = a || null;
this.pooled = false;
this.isMaskData = true;
this.resolution = null;
this.multisample = Fa.FILTER_MULTISAMPLE;
this.enabled = true;
this._filters = null;
this._stencilCounter = 0;
this._scissorCounter = 0;
this._scissorRect = null;
this._scissorRectLocal = null;
this._target = null;
}
Object.defineProperty(a.prototype, "filter", {
get: function () {
if (this._filters) {
return this._filters[0];
} else {
return null;
}
},
set: function (a) {
if (a) {
if (this._filters) {
this._filters[0] = a;
} else {
this._filters = [a];
}
} else {
this._filters = null;
}
},
enumerable: false,
configurable: true
});
a.prototype.reset = function () {
if (this.pooled) {
this.maskObject = null;
this.type = Ca.NONE;
this.autoDetect = true;
}
this._target = null;
this._scissorRectLocal = null;
};
a.prototype.copyCountersOrReset = function (a) {
if (a) {
this._stencilCounter = a._stencilCounter;
this._scissorCounter = a._scissorCounter;
this._scissorRect = a._scissorRect;
} else {
this._stencilCounter = 0;
this._scissorCounter = 0;
this._scissorRect = null;
}
};
return a;
}();
function td(a, b, c) {
var d = a.createShader(b);
a.shaderSource(d, c);
a.compileShader(d);
return d;
}
function ud(a, b) {
var c = a.getShaderSource(b).split("\n").map(function (a, b) {
return b + ": " + a;
});
var d = a.getShaderInfoLog(b);
var e = d.split("\n");
var f = {};
var g = e.map(function (a) {
return parseFloat(a.replace(/^ERROR\: 0\:([\d]+)\:.*$/, "$1"));
}).filter(function (a) {
return !!a && !f[a] && !(f[a] = true, 0);
});
var h = [""];
g.forEach(function (a) {
c[a - 1] = "%c" + c[a - 1] + "%c";
h.push("background: #FF0000; color:#FFFFFF; font-size: 10px", "font-size: 10px");
});
var i = c.join("\n");
h[0] = i;
console.error(d);
console.groupCollapsed("click to view full shader code");
console.warn.apply(console, h);
console.groupEnd();
}
function vd(a) {
for (var b = new Array(a), c = 0; c < b.length; c++) {
b[c] = false;
}
return b;
}
function wd(a, b) {
switch (a) {
case "float":
case "int":
case "uint":
case "sampler2D":
case "sampler2DArray":
return 0;
case "vec2":
return new Float32Array(b * 2);
case "vec3":
return new Float32Array(b * 3);
case "vec4":
return new Float32Array(b * 4);
case "ivec2":
return new Int32Array(b * 2);
case "ivec3":
return new Int32Array(b * 3);
case "ivec4":
return new Int32Array(b * 4);
case "uvec2":
return new Uint32Array(b * 2);
case "uvec3":
return new Uint32Array(b * 3);
case "uvec4":
return new Uint32Array(b * 4);
case "bool":
return false;
case "bvec2":
return vd(b * 2);
case "bvec3":
return vd(b * 3);
case "bvec4":
return vd(b * 4);
case "mat2":
return new Float32Array([1, 0, 0, 1]);
case "mat3":
return new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
case "mat4":
return new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
}
return null;
}
var xd;
var yd = {};
var zd = yd;
function Ad(a, b, c) {
if (a.substring(0, 9) !== "precision") {
var d = b;
if (b === Ba.HIGH && c !== Ba.HIGH) {
d = Ba.MEDIUM;
}
return "precision " + d + " float;\n" + a;
}
if (c !== Ba.HIGH && a.substring(0, 15) === "precision highp") {
return a.replace("precision highp", "precision mediump");
} else {
return a;
}
}
var Bd = {
float: 1,
vec2: 2,
vec3: 3,
vec4: 4,
int: 1,
ivec2: 2,
ivec3: 3,
ivec4: 4,
uint: 1,
uvec2: 2,
uvec3: 3,
uvec4: 4,
bool: 1,
bvec2: 2,
bvec3: 3,
bvec4: 4,
mat2: 4,
mat3: 9,
mat4: 16,
sampler2D: 1
};
function Cd(a) {
return Bd[a];
}
var Dd = null;
var Ed = {
FLOAT: "float",
FLOAT_VEC2: "vec2",
FLOAT_VEC3: "vec3",
FLOAT_VEC4: "vec4",
INT: "int",
INT_VEC2: "ivec2",
INT_VEC3: "ivec3",
INT_VEC4: "ivec4",
UNSIGNED_INT: "uint",
UNSIGNED_INT_VEC2: "uvec2",
UNSIGNED_INT_VEC3: "uvec3",
UNSIGNED_INT_VEC4: "uvec4",
BOOL: "bool",
BOOL_VEC2: "bvec2",
BOOL_VEC3: "bvec3",
BOOL_VEC4: "bvec4",
FLOAT_MAT2: "mat2",
FLOAT_MAT3: "mat3",
FLOAT_MAT4: "mat4",
SAMPLER_2D: "sampler2D",
INT_SAMPLER_2D: "sampler2D",
UNSIGNED_INT_SAMPLER_2D: "sampler2D",
SAMPLER_CUBE: "samplerCube",
INT_SAMPLER_CUBE: "samplerCube",
UNSIGNED_INT_SAMPLER_CUBE: "samplerCube",
SAMPLER_2D_ARRAY: "sampler2DArray",
INT_SAMPLER_2D_ARRAY: "sampler2DArray",
UNSIGNED_INT_SAMPLER_2D_ARRAY: "sampler2DArray"
};
function Fd(a, b) {
if (!Dd) {
var c = Object.keys(Ed);
Dd = {};
for (var d = 0; d < c.length; ++d) {
var e = c[d];
Dd[a[e]] = Ed[e];
}
}
return Dd[b];
}
var Gd;
var Hd = [{
test: function (a) {
return a.type === "float" && a.size === 1;
},
code: function (a) {
return "\n if(uv[\"" + a + "\"] !== ud[\"" + a + "\"].value)\n {\n ud[\"" + a + "\"].value = uv[\"" + a + "\"]\n gl.uniform1f(ud[\"" + a + "\"].location, uv[\"" + a + "\"])\n }\n ";
}
}, {
test: function (a) {
return (a.type === "sampler2D" || a.type === "samplerCube" || a.type === "sampler2DArray") && a.size === 1 && !a.isArray;
},
code: function (a) {
return "t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"" + a + "\"], t);\n\n if(ud[\"" + a + "\"].value !== t)\n {\n ud[\"" + a + "\"].value = t;\n gl.uniform1i(ud[\"" + a + "\"].location, t);\n; // eslint-disable-line max-len\n }";
}
}, {
test: function (a, b) {
return a.type === "mat3" && a.size === 1 && b.a !== undefined;
},
code: function (a) {
return "\n gl.uniformMatrix3fv(ud[\"" + a + "\"].location, false, uv[\"" + a + "\"].toArray(true));\n ";
},
codeUbo: function (a) {
return "\n var " + a + "_matrix = uv." + a + ".toArray(true);\n\n data[offset] = " + a + "_matrix[0];\n data[offset+1] = " + a + "_matrix[1];\n data[offset+2] = " + a + "_matrix[2];\n \n data[offset + 4] = " + a + "_matrix[3];\n data[offset + 5] = " + a + "_matrix[4];\n data[offset + 6] = " + a + "_matrix[5];\n \n data[offset + 8] = " + a + "_matrix[6];\n data[offset + 9] = " + a + "_matrix[7];\n data[offset + 10] = " + a + "_matrix[8];\n ";
}
}, {
test: function (a, b) {
return a.type === "vec2" && a.size === 1 && b.x !== undefined;
},
code: function (a) {
return "\n cv = ud[\"" + a + "\"].value;\n v = uv[\"" + a + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"" + a + "\"].location, v.x, v.y);\n }";
},
codeUbo: function (a) {
return "\n v = uv." + a + ";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n ";
}
}, {
test: function (a) {
return a.type === "vec2" && a.size === 1;
},
code: function (a) {
return "\n cv = ud[\"" + a + "\"].value;\n v = uv[\"" + a + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"" + a + "\"].location, v[0], v[1]);\n }\n ";
}
}, {
test: function (a, b) {
return a.type === "vec4" && a.size === 1 && b.width !== undefined;
},
code: function (a) {
return "\n cv = ud[\"" + a + "\"].value;\n v = uv[\"" + a + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"" + a + "\"].location, v.x, v.y, v.width, v.height)\n }";
},
codeUbo: function (a) {
return "\n v = uv." + a + ";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n ";
}
}, {
test: function (a) {
return a.type === "vec4" && a.size === 1;
},
code: function (a) {
return "\n cv = ud[\"" + a + "\"].value;\n v = uv[\"" + a + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"" + a + "\"].location, v[0], v[1], v[2], v[3])\n }";
}
}];
var Id = {
float: "\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }",
vec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }",
vec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",
vec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }",
int: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",
ivec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",
ivec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",
ivec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",
uint: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }",
uvec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }",
uvec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }",
uvec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }",
bool: "\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }",
bvec2: "\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",
bvec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",
bvec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",
mat2: "gl.uniformMatrix2fv(location, false, v)",
mat3: "gl.uniformMatrix3fv(location, false, v)",
mat4: "gl.uniformMatrix4fv(location, false, v)",
sampler2D: "gl.uniform1i(location, v)",
samplerCube: "gl.uniform1i(location, v)",
sampler2DArray: "gl.uniform1i(location, v)"
};
var Jd = {
float: "gl.uniform1fv(location, v)",
vec2: "gl.uniform2fv(location, v)",
vec3: "gl.uniform3fv(location, v)",
vec4: "gl.uniform4fv(location, v)",
mat4: "gl.uniformMatrix4fv(location, false, v)",
mat3: "gl.uniformMatrix3fv(location, false, v)",
mat2: "gl.uniformMatrix2fv(location, false, v)",
int: "gl.uniform1iv(location, v)",
ivec2: "gl.uniform2iv(location, v)",
ivec3: "gl.uniform3iv(location, v)",
ivec4: "gl.uniform4iv(location, v)",
uint: "gl.uniform1uiv(location, v)",
uvec2: "gl.uniform2uiv(location, v)",
uvec3: "gl.uniform3uiv(location, v)",
uvec4: "gl.uniform4uiv(location, v)",
bool: "gl.uniform1iv(location, v)",
bvec2: "gl.uniform2iv(location, v)",
bvec3: "gl.uniform3iv(location, v)",
bvec4: "gl.uniform4iv(location, v)",
sampler2D: "gl.uniform1iv(location, v)",
samplerCube: "gl.uniform1iv(location, v)",
sampler2DArray: "gl.uniform1iv(location, v)"
};
var Kd = ["precision mediump float;", "void main(void){", "float test = 0.1;", "%forloop%", "gl_FragColor = vec4(0.0);", "}"].join("\n");
function Ld(a) {
for (var b = "", c = 0; c < a; ++c) {
if (c > 0) {
b += "\nelse ";
}
if (c < a - 1) {
b += "if(test == " + c + ".0){}";
}
}
return b;
}
var Md = 0;
var Nd = {};
var Od = function () {
function a(b, c, d) {
if (d === undefined) {
d = "pixi-shader";
}
this.id = Md++;
this.vertexSrc = b || a.defaultVertexSrc;
this.fragmentSrc = c || a.defaultFragmentSrc;
this.vertexSrc = this.vertexSrc.trim();
this.fragmentSrc = this.fragmentSrc.trim();
if (this.vertexSrc.substring(0, 8) !== "#version") {
d = d.replace(/\s+/g, "-");
if (Nd[d]) {
Nd[d]++;
d += "-" + Nd[d];
} else {
Nd[d] = 1;
}
this.vertexSrc = "#define SHADER_NAME " + d + "\n" + this.vertexSrc;
this.fragmentSrc = "#define SHADER_NAME " + d + "\n" + this.fragmentSrc;
this.vertexSrc = Ad(this.vertexSrc, Fa.PRECISION_VERTEX, Ba.HIGH);
this.fragmentSrc = Ad(this.fragmentSrc, Fa.PRECISION_FRAGMENT, function () {
if (!xd) {
xd = Ba.MEDIUM;
var a = function () {
if (zd === yd || zd && zd.isContextLost()) {
var a = document.createElement("canvas");
var b = undefined;
if (Fa.PREFER_ENV >= ma.WEBGL2) {
b = a.getContext("webgl2", {});
}
if (!b) {
if (b = a.getContext("webgl", {}) || a.getContext("experimental-webgl", {})) {
b.getExtension("WEBGL_draw_buffers");
} else {
b = null;
}
}
zd = b;
}
return zd;
}();
if (a && a.getShaderPrecisionFormat) {
var b = a.getShaderPrecisionFormat(a.FRAGMENT_SHADER, a.HIGH_FLOAT);
xd = b.precision ? Ba.HIGH : Ba.MEDIUM;
}
}
return xd;
}());
}
this.glPrograms = {};
this.syncUniforms = null;
}
Object.defineProperty(a, "defaultVertexSrc", {
get: function () {
return "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n";
},
enumerable: false,
configurable: true
});
Object.defineProperty(a, "defaultFragmentSrc", {
get: function () {
return "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}";
},
enumerable: false,
configurable: true
});
a.from = function (b, c, d) {
var e = b + c;
var f = fb[e];
if (!f) {
fb[e] = f = new a(b, c, d);
}
return f;
};
return a;
}();
var Pd = function () {
function a(a, b) {
this.uniformBindCount = 0;
this.program = a;
this.uniformGroup = b ? b instanceof ed ? b : new ed(b) : new ed({});
}
a.prototype.checkUniformExists = function (a, b) {
if (b.uniforms[a]) {
return true;
}
for (var c in b.uniforms) {
var d = b.uniforms[c];
if (d.group && this.checkUniformExists(a, d)) {
return true;
}
}
return false;
};
a.prototype.destroy = function () {
this.uniformGroup = null;
};
Object.defineProperty(a.prototype, "uniforms", {
get: function () {
return this.uniformGroup.uniforms;
},
enumerable: false,
configurable: true
});
a.from = function (b, c, d) {
return new a(Od.from(b, c), d);
};
return a;
}();
var Qd = function () {
function a() {
this.data = 0;
this.blendMode = pa.NORMAL;
this.polygonOffset = 0;
this.blend = true;
this.depthMask = true;
}
Object.defineProperty(a.prototype, "blend", {
get: function () {
return !!(this.data & 1);
},
set: function (a) {
if (!!(this.data & 1) !== a) {
this.data ^= 1;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "offsets", {
get: function () {
return !!(this.data & 2);
},
set: function (a) {
if (!!(this.data & 2) !== a) {
this.data ^= 2;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "culling", {
get: function () {
return !!(this.data & 4);
},
set: function (a) {
if (!!(this.data & 4) !== a) {
this.data ^= 4;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "depthTest", {
get: function () {
return !!(this.data & 8);
},
set: function (a) {
if (!!(this.data & 8) !== a) {
this.data ^= 8;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "depthMask", {
get: function () {
return !!(this.data & 32);
},
set: function (a) {
if (!!(this.data & 32) !== a) {
this.data ^= 32;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "clockwiseFrontFace", {
get: function () {
return !!(this.data & 16);
},
set: function (a) {
if (!!(this.data & 16) !== a) {
this.data ^= 16;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "blendMode", {
get: function () {
return this._blendMode;
},
set: function (a) {
this.blend = a !== pa.NONE;
this._blendMode = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "polygonOffset", {
get: function () {
return this._polygonOffset;
},
set: function (a) {
this.offsets = !!a;
this._polygonOffset = a;
},
enumerable: false,
configurable: true
});
a.prototype.toString = function () {
return "[@pixi/core:State blendMode=" + this.blendMode + " clockwiseFrontFace=" + this.clockwiseFrontFace + " culling=" + this.culling + " depthMask=" + this.depthMask + " polygonOffset=" + this.polygonOffset + "]";
};
a.for2d = function () {
var b = new a();
b.depthTest = false;
b.blend = true;
return b;
};
return a;
}();
var Rd = function (a) {
function b(c, d, e) {
var f = this;
var g = Od.from(c || b.defaultVertexSrc, d || b.defaultFragmentSrc);
(f = a.call(this, g, e) || this).padding = 0;
f.resolution = Fa.FILTER_RESOLUTION;
f.multisample = Fa.FILTER_MULTISAMPLE;
f.enabled = true;
f.autoFit = true;
f.state = new Qd();
return f;
}
wc(b, a);
b.prototype.apply = function (a, b, c, d, e) {
a.applyFilter(this, b, c, d);
};
Object.defineProperty(b.prototype, "blendMode", {
get: function () {
return this.state.blendMode;
},
set: function (a) {
this.state.blendMode = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "resolution", {
get: function () {
return this._resolution;
},
set: function (a) {
this._resolution = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b, "defaultVertexSrc", {
get: function () {
return "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n";
},
enumerable: false,
configurable: true
});
Object.defineProperty(b, "defaultFragmentSrc", {
get: function () {
return "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n";
},
enumerable: false,
configurable: true
});
return b;
}(Pd);
var Sd = new wb();
var Td = function () {
function a(a, b) {
this._texture = a;
this.mapCoord = new wb();
this.uClampFrame = new Float32Array(4);
this.uClampOffset = new Float32Array(2);
this._textureID = -1;
this._updateID = 0;
this.clampOffset = 0;
this.clampMargin = b === undefined ? 0.5 : b;
this.isSimple = false;
}
Object.defineProperty(a.prototype, "texture", {
get: function () {
return this._texture;
},
set: function (a) {
this._texture = a;
this._textureID = -1;
},
enumerable: false,
configurable: true
});
a.prototype.multiplyUvs = function (a, b) {
if (b === undefined) {
b = a;
}
for (var c = this.mapCoord, d = 0; d < a.length; d += 2) {
var e = a[d];
var f = a[d + 1];
b[d] = e * c.a + f * c.c + c.tx;
b[d + 1] = e * c.b + f * c.d + c.ty;
}
return b;
};
a.prototype.update = function (a) {
var b = this._texture;
if (!b || !b.valid) {
return false;
}
if (!a && this._textureID === b._updateID) {
return false;
}
this._textureID = b._updateID;
this._updateID++;
var c = b._uvs;
this.mapCoord.set(c.x1 - c.x0, c.y1 - c.y0, c.x3 - c.x0, c.y3 - c.y0, c.x0, c.y0);
var d = b.orig;
var e = b.trim;
if (e) {
Sd.set(d.width / e.width, 0, 0, d.height / e.height, -e.x / e.width, -e.y / e.height);
this.mapCoord.append(Sd);
}
var f = b.baseTexture;
var g = this.uClampFrame;
var h = this.clampMargin / f.resolution;
var i = this.clampOffset;
g[0] = (b._frame.x + h + i) / f.width;
g[1] = (b._frame.y + h + i) / f.height;
g[2] = (b._frame.x + b._frame.width - h + i) / f.width;
g[3] = (b._frame.y + b._frame.height - h + i) / f.height;
this.uClampOffset[0] = i / f.realWidth;
this.uClampOffset[1] = i / f.realHeight;
this.isSimple = b._frame.width === f.width && b._frame.height === f.height && b.rotate === 0;
return true;
};
return a;
}();
var Ud = function (a) {
function b(b, c, d) {
var e = this;
var f = null;
if (typeof b != "string" && c === undefined && d === undefined) {
f = b;
b = undefined;
c = undefined;
d = undefined;
}
(e = a.call(this, b || "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n", c || "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n", d) || this).maskSprite = f;
e.maskMatrix = new wb();
return e;
}
wc(b, a);
Object.defineProperty(b.prototype, "maskSprite", {
get: function () {
return this._maskSprite;
},
set: function (a) {
this._maskSprite = a;
if (this._maskSprite) {
this._maskSprite.renderable = false;
}
},
enumerable: false,
configurable: true
});
b.prototype.apply = function (a, b, c, d) {
var e = this._maskSprite;
var f = e._texture;
if (f.valid) {
f.uvMatrix ||= new Td(f, 0);
f.uvMatrix.update();
this.uniforms.npmAlpha = f.baseTexture.alphaMode ? 0 : 1;
this.uniforms.mask = f;
this.uniforms.otherMatrix = a.calculateSpriteMatrix(this.maskMatrix, e).prepend(f.uvMatrix.mapCoord);
this.uniforms.alpha = e.worldAlpha;
this.uniforms.maskClamp = f.uvMatrix.uClampFrame;
a.applyFilter(this, b, c, d);
}
};
return b;
}(Rd);
var Vd = function () {
function a(a) {
this.renderer = a;
this.enableScissor = true;
this.alphaMaskPool = [];
this.maskDataPool = [];
this.maskStack = [];
this.alphaMaskIndex = 0;
}
a.prototype.setMaskStack = function (a) {
this.maskStack = a;
this.renderer.scissor.setMaskStack(a);
this.renderer.stencil.setMaskStack(a);
};
a.prototype.push = function (a, b) {
var c = b;
if (!c.isMaskData) {
var d = this.maskDataPool.pop() || new sd();
d.pooled = true;
d.maskObject = b;
c = d;
}
var e = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;
c.copyCountersOrReset(e);
if (c.autoDetect) {
this.detect(c);
}
c._target = a;
if (c.type !== Ca.SPRITE) {
this.maskStack.push(c);
}
if (c.enabled) {
switch (c.type) {
case Ca.SCISSOR:
this.renderer.scissor.push(c);
break;
case Ca.STENCIL:
this.renderer.stencil.push(c);
break;
case Ca.SPRITE:
c.copyCountersOrReset(null);
this.pushSpriteMask(c);
}
}
if (c.type === Ca.SPRITE) {
this.maskStack.push(c);
}
};
a.prototype.pop = function (a) {
var b = this.maskStack.pop();
if (b && b._target === a) {
if (b.enabled) {
switch (b.type) {
case Ca.SCISSOR:
this.renderer.scissor.pop();
break;
case Ca.STENCIL:
this.renderer.stencil.pop(b.maskObject);
break;
case Ca.SPRITE:
this.popSpriteMask(b);
}
}
b.reset();
if (b.pooled) {
this.maskDataPool.push(b);
}
if (this.maskStack.length !== 0) {
var c = this.maskStack[this.maskStack.length - 1];
if (c.type === Ca.SPRITE && c._filters) {
c._filters[0].maskSprite = c.maskObject;
}
}
}
};
a.prototype.detect = function (a) {
if (a.maskObject.isSprite) {
a.type = Ca.SPRITE;
} else if (this.enableScissor && this.renderer.scissor.testScissor(a)) {
a.type = Ca.SCISSOR;
} else {
a.type = Ca.STENCIL;
}
};
a.prototype.pushSpriteMask = function (a) {
var b = a.maskObject;
var c = a._target;
var d = a._filters;
if (!(d ||= this.alphaMaskPool[this.alphaMaskIndex])) {
d = this.alphaMaskPool[this.alphaMaskIndex] = [new Ud()];
}
var e;
var f;
var g = this.renderer;
var h = g.renderTexture;
if (h.current) {
var i = h.current;
e = a.resolution || i.resolution;
f = a.multisample ?? i.multisample;
} else {
e = a.resolution || g.resolution;
f = a.multisample ?? g.multisample;
}
d[0].resolution = e;
d[0].multisample = f;
d[0].maskSprite = b;
var j = c.filterArea;
c.filterArea = b.getBounds(true);
g.filter.push(c, d);
c.filterArea = j;
if (!a._filters) {
this.alphaMaskIndex++;
}
};
a.prototype.popSpriteMask = function (a) {
this.renderer.filter.pop();
if (a._filters) {
a._filters[0].maskSprite = null;
} else {
this.alphaMaskIndex--;
this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;
}
};
a.prototype.destroy = function () {
this.renderer = null;
};
return a;
}();
var Wd = function () {
function a(a) {
this.renderer = a;
this.maskStack = [];
this.glConst = 0;
}
a.prototype.getStackLength = function () {
return this.maskStack.length;
};
a.prototype.setMaskStack = function (a) {
var b = this.renderer.gl;
var c = this.getStackLength();
this.maskStack = a;
var d = this.getStackLength();
if (d !== c) {
if (d === 0) {
b.disable(this.glConst);
} else {
b.enable(this.glConst);
this._useCurrent();
}
}
};
a.prototype._useCurrent = function () {};
a.prototype.destroy = function () {
this.renderer = null;
this.maskStack = null;
};
return a;
}();
var Xd = new wb();
var Yd = function (a) {
function b(b) {
var c = a.call(this, b) || this;
c.glConst = WebGLRenderingContext.SCISSOR_TEST;
return c;
}
wc(b, a);
b.prototype.getStackLength = function () {
var a = this.maskStack[this.maskStack.length - 1];
if (a) {
return a._scissorCounter;
} else {
return 0;
}
};
b.prototype.calcScissorRect = function (a) {
if (!a._scissorRectLocal) {
var b = a._scissorRect;
var c = a.maskObject;
var d = this.renderer;
var e = d.renderTexture;
c.renderable = true;
var f = c.getBounds();
this.roundFrameToPixels(f, e.current ? e.current.resolution : d.resolution, e.sourceFrame, e.destinationFrame, d.projection.transform);
c.renderable = false;
if (b) {
f.fit(b);
}
a._scissorRectLocal = f;
}
};
b.isMatrixRotated = function (a) {
if (!a) {
return false;
}
var b = a.a;
var c = a.b;
var d = a.c;
var e = a.d;
return (Math.abs(c) > 0.0001 || Math.abs(d) > 0.0001) && (Math.abs(b) > 0.0001 || Math.abs(e) > 0.0001);
};
b.prototype.testScissor = function (a) {
var c = a.maskObject;
if (!c.isFastRect || !c.isFastRect()) {
return false;
}
if (b.isMatrixRotated(c.worldTransform)) {
return false;
}
if (b.isMatrixRotated(this.renderer.projection.transform)) {
return false;
}
this.calcScissorRect(a);
var d = a._scissorRectLocal;
return d.width > 0 && d.height > 0;
};
b.prototype.roundFrameToPixels = function (a, c, d, e, f) {
if (!b.isMatrixRotated(f)) {
(f = f ? Xd.copyFrom(f) : Xd.identity()).translate(-d.x, -d.y).scale(e.width / d.width, e.height / d.height).translate(e.x, e.y);
this.renderer.filter.transformAABB(f, a);
a.fit(e);
a.x = Math.round(a.x * c);
a.y = Math.round(a.y * c);
a.width = Math.round(a.width * c);
a.height = Math.round(a.height * c);
}
};
b.prototype.push = function (a) {
if (!a._scissorRectLocal) {
this.calcScissorRect(a);
}
var b = this.renderer.gl;
if (!a._scissorRect) {
b.enable(b.SCISSOR_TEST);
}
a._scissorCounter++;
a._scissorRect = a._scissorRectLocal;
this._useCurrent();
};
b.prototype.pop = function () {
var a = this.renderer.gl;
if (this.getStackLength() > 0) {
this._useCurrent();
} else {
a.disable(a.SCISSOR_TEST);
}
};
b.prototype._useCurrent = function () {
var a;
var b = this.maskStack[this.maskStack.length - 1]._scissorRect;
a = this.renderer.renderTexture.current ? b.y : this.renderer.height - b.height - b.y;
this.renderer.gl.scissor(b.x, a, b.width, b.height);
};
return b;
}(Wd);
var Zd = function (a) {
function b(b) {
var c = a.call(this, b) || this;
c.glConst = WebGLRenderingContext.STENCIL_TEST;
return c;
}
wc(b, a);
b.prototype.getStackLength = function () {
var a = this.maskStack[this.maskStack.length - 1];
if (a) {
return a._stencilCounter;
} else {
return 0;
}
};
b.prototype.push = function (a) {
var b = a.maskObject;
var c = this.renderer.gl;
var d = a._stencilCounter;
if (d === 0) {
this.renderer.framebuffer.forceStencil();
c.clearStencil(0);
c.clear(c.STENCIL_BUFFER_BIT);
c.enable(c.STENCIL_TEST);
}
a._stencilCounter++;
c.colorMask(false, false, false, false);
c.stencilFunc(c.EQUAL, d, 4294967295);
c.stencilOp(c.KEEP, c.KEEP, c.INCR);
b.renderable = true;
b.render(this.renderer);
this.renderer.batch.flush();
b.renderable = false;
this._useCurrent();
};
b.prototype.pop = function (a) {
var b = this.renderer.gl;
if (this.getStackLength() === 0) {
b.disable(b.STENCIL_TEST);
} else {
b.colorMask(false, false, false, false);
b.stencilOp(b.KEEP, b.KEEP, b.DECR);
a.renderable = true;
a.render(this.renderer);
this.renderer.batch.flush();
a.renderable = false;
this._useCurrent();
}
};
b.prototype._useCurrent = function () {
var a = this.renderer.gl;
a.colorMask(true, true, true, true);
a.stencilFunc(a.EQUAL, this.getStackLength(), 4294967295);
a.stencilOp(a.KEEP, a.KEEP, a.KEEP);
};
return b;
}(Wd);
var $d = function () {
function a(a) {
this.renderer = a;
this.destinationFrame = null;
this.sourceFrame = null;
this.defaultFrame = null;
this.projectionMatrix = new wb();
this.transform = null;
}
a.prototype.update = function (a, b, c, d) {
this.destinationFrame = a || this.destinationFrame || this.defaultFrame;
this.sourceFrame = b || this.sourceFrame || a;
this.calculateProjection(this.destinationFrame, this.sourceFrame, c, d);
if (this.transform) {
this.projectionMatrix.append(this.transform);
}
var e = this.renderer;
e.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;
e.globalUniforms.update();
if (e.shader.shader) {
e.shader.syncUniformGroup(e.shader.shader.uniforms.globals);
}
};
a.prototype.calculateProjection = function (a, b, c, d) {
var e = this.projectionMatrix;
var f = d ? -1 : 1;
e.identity();
e.a = 1 / b.width * 2;
e.d = f * (1 / b.height * 2);
e.tx = -1 - b.x * e.a;
e.ty = -f - b.y * e.d;
};
a.prototype.setTransform = function (a) {};
a.prototype.destroy = function () {
this.renderer = null;
};
return a;
}();
var _d = new qb();
var ae = new qb();
var be = function () {
function a(a) {
this.renderer = a;
this.clearColor = a._backgroundColorRgba;
this.defaultMaskStack = [];
this.current = null;
this.sourceFrame = new qb();
this.destinationFrame = new qb();
this.viewportFrame = new qb();
}
a.prototype.bind = function (a, b, c) {
if (a === undefined) {
a = null;
}
var d;
var e;
var f;
var g = this.renderer;
this.current = a;
if (a) {
f = (d = a.baseTexture).resolution;
if (!b) {
_d.width = a.frame.width;
_d.height = a.frame.height;
b = _d;
}
if (!c) {
ae.x = a.frame.x;
ae.y = a.frame.y;
ae.width = b.width;
ae.height = b.height;
c = ae;
}
e = d.framebuffer;
} else {
f = g.resolution;
if (!b) {
_d.width = g.screen.width;
_d.height = g.screen.height;
b = _d;
}
if (!c) {
(c = _d).width = b.width;
c.height = b.height;
}
}
var h = this.viewportFrame;
h.x = c.x * f;
h.y = c.y * f;
h.width = c.width * f;
h.height = c.height * f;
if (!a) {
h.y = g.view.height - (h.y + h.height);
}
h.ceil();
this.renderer.framebuffer.bind(e, h);
this.renderer.projection.update(c, b, f, !e);
if (a) {
this.renderer.mask.setMaskStack(d.maskStack);
} else {
this.renderer.mask.setMaskStack(this.defaultMaskStack);
}
this.sourceFrame.copyFrom(b);
this.destinationFrame.copyFrom(c);
};
a.prototype.clear = function (a, b) {
a = this.current ? a || this.current.baseTexture.clearColor : a || this.clearColor;
var c = this.destinationFrame;
var d = this.current ? this.current.baseTexture : this.renderer.screen;
var e = c.width !== d.width || c.height !== d.height;
if (e) {
var f = this.viewportFrame;
var g = f.x;
var h = f.y;
var i = f.width;
var j = f.height;
g = Math.round(g);
h = Math.round(h);
i = Math.round(i);
j = Math.round(j);
this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);
this.renderer.gl.scissor(g, h, i, j);
}
this.renderer.framebuffer.clear(a[0], a[1], a[2], a[3], b);
if (e) {
this.renderer.scissor.pop();
}
};
a.prototype.resize = function () {
this.bind(null);
};
a.prototype.reset = function () {
this.bind(null);
};
a.prototype.destroy = function () {
this.renderer = null;
};
return a;
}();
function ce(a, b, c, d, e) {
c.buffer.update(e);
}
var de = {
float: "\n data[offset] = v;\n ",
vec2: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",
vec3: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",
vec4: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",
mat2: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",
mat3: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",
mat4: "\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "
};
var ee = {
float: 4,
vec2: 8,
vec3: 12,
vec4: 16,
int: 4,
ivec2: 8,
ivec3: 12,
ivec4: 16,
uint: 4,
uvec2: 8,
uvec3: 12,
uvec4: 16,
bool: 4,
bvec2: 8,
bvec3: 12,
bvec4: 16,
mat2: 32,
mat3: 48,
mat4: 64
};
var fe = function () {
function a(a, b) {
this.program = a;
this.uniformData = b;
this.uniformGroups = {};
this.uniformDirtyGroups = {};
this.uniformBufferBindings = {};
}
a.prototype.destroy = function () {
this.uniformData = null;
this.uniformGroups = null;
this.uniformDirtyGroups = null;
this.uniformBufferBindings = null;
this.program = null;
};
return a;
}();
var ge = 0;
var he = {
textureCount: 0,
uboCount: 0
};
var ie = function () {
function a(a) {
this.destroyed = false;
this.renderer = a;
this.systemCheck();
this.gl = null;
this.shader = null;
this.program = null;
this.cache = {};
this._uboCache = {};
this.id = ge++;
}
a.prototype.systemCheck = function () {
if (! function () {
if (typeof Gd == "boolean") {
return Gd;
}
try {
var a = new Function("param1", "param2", "param3", "return param1[param2] === param3;");
Gd = a({
a: "b"
}, "a", "b") === true;
} catch (a) {
Gd = false;
}
return Gd;
}()) {
throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.");
}
};
a.prototype.contextChange = function (a) {
this.gl = a;
this.reset();
};
a.prototype.bind = function (a, b) {
a.uniforms.globals = this.renderer.globalUniforms;
var c = a.program;
var d = c.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(a);
this.shader = a;
if (this.program !== c) {
this.program = c;
this.gl.useProgram(d.program);
}
if (!b) {
he.textureCount = 0;
he.uboCount = 0;
this.syncUniformGroup(a.uniformGroup, he);
}
return d;
};
a.prototype.setUniforms = function (a) {
var b = this.shader.program;
var c = b.glPrograms[this.renderer.CONTEXT_UID];
b.syncUniforms(c.uniformData, a, this.renderer);
};
a.prototype.syncUniformGroup = function (a, b) {
var c = this.getGlProgram();
if (!a.static || a.dirtyId !== c.uniformDirtyGroups[a.id]) {
c.uniformDirtyGroups[a.id] = a.dirtyId;
this.syncUniforms(a, c, b);
}
};
a.prototype.syncUniforms = function (a, b, c) {
(a.syncUniforms[this.shader.program.id] || this.createSyncGroups(a))(b.uniformData, a.uniforms, this.renderer, c);
};
a.prototype.createSyncGroups = function (a) {
var b = this.getSignature(a, this.shader.program.uniformData, "u");
this.cache[b] ||= function (a, b) {
var c = ["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "];
for (var d in a.uniforms) {
var e = b[d];
if (e) {
for (var f = a.uniforms[d], g = false, h = 0; h < Hd.length; h++) {
if (Hd[h].test(e, f)) {
c.push(Hd[h].code(d, f));
g = true;
break;
}
}
if (!g) {
var i = (e.size === 1 ? Id : Jd)[e.type].replace("location", "ud[\"" + d + "\"].location");
c.push("\n cu = ud[\"" + d + "\"];\n cv = cu.value;\n v = uv[\"" + d + "\"];\n " + i + ";");
}
} else if (a.uniforms[d]?.group) {
if (a.uniforms[d].ubo) {
c.push("\n renderer.shader.syncUniformBufferGroup(uv." + d + ", '" + d + "');\n ");
} else {
c.push("\n renderer.shader.syncUniformGroup(uv." + d + ", syncData);\n ");
}
}
}
return new Function("ud", "uv", "renderer", "syncData", c.join("\n"));
}(a, this.shader.program.uniformData);
a.syncUniforms[this.shader.program.id] = this.cache[b];
return a.syncUniforms[this.shader.program.id];
};
a.prototype.syncUniformBufferGroup = function (a, b) {
var c = this.getGlProgram();
if (!a.static || a.dirtyId !== 0 || !c.uniformGroups[a.id]) {
a.dirtyId = 0;
var d = c.uniformGroups[a.id] || this.createSyncBufferGroup(a, c, b);
a.buffer.update();
d(c.uniformData, a.uniforms, this.renderer, he, a.buffer);
}
this.renderer.buffer.bindBufferBase(a.buffer, c.uniformBufferBindings[b]);
};
a.prototype.createSyncBufferGroup = function (a, b, c) {
var d = this.renderer.gl;
this.renderer.buffer.bind(a.buffer);
var e = this.gl.getUniformBlockIndex(b.program, c);
b.uniformBufferBindings[c] = this.shader.uniformBindCount;
d.uniformBlockBinding(b.program, e, this.shader.uniformBindCount);
this.shader.uniformBindCount++;
var f = this.getSignature(a, this.shader.program.uniformData, "ubo");
var g = this._uboCache[f];
g ||= this._uboCache[f] = function (a, b) {
if (!a.autoManage) {
return {
size: 0,
syncFunc: ce
};
}
for (var c = function (a, b) {
var c = [];
for (var d in a) {
if (b[d]) {
c.push(b[d]);
}
}
c.sort(function (a, b) {
return a.index - b.index;
});
return c;
}(a.uniforms, b), d = function (a) {
for (var b = a.map(function (a) {
return {
data: a,
offset: 0,
dataLen: 0,
dirty: 0
};
}), c = 0, d = 0, e = 0, f = 0; f < b.length; f++) {
var g = b[f];
c = ee[g.data.type];
if (g.data.size > 1) {
c = Math.max(c, 16) * g.data.size;
}
g.dataLen = c;
if (d % c != 0 && d < 16) {
var h = d % c % 16;
d += h;
e += h;
}
if (d + c > 16) {
e = Math.ceil(e / 16) * 16;
g.offset = e;
e += c;
d = c;
} else {
g.offset = e;
d += c;
e += c;
}
}
return {
uboElements: b,
size: e = Math.ceil(e / 16) * 16
};
}(c), e = d.uboElements, f = d.size, g = ["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "], h = 0; h < e.length; h++) {
for (var i = e[h], j = a.uniforms[i.data.name], k = i.data.name, l = false, m = 0; m < Hd.length; m++) {
var n = Hd[m];
if (n.codeUbo && n.test(i.data, j)) {
g.push("offset = " + i.offset / 4 + ";", Hd[m].codeUbo(i.data.name, j));
l = true;
break;
}
}
if (!l) {
if (i.data.size > 1) {
var o = Cd(i.data.type);
var p = Math.max(ee[i.data.type] / 16, 1);
var q = o / p;
var r = (4 - q % 4) % 4;
g.push("\n cv = ud." + k + ".value;\n v = uv." + k + ";\n offset = " + i.offset / 4 + ";\n\n t = 0;\n\n for(var i=0; i < " + i.data.size * p + "; i++)\n {\n for(var j = 0; j < " + q + "; j++)\n {\n data[offset++] = v[t++];\n }\n offset += " + r + ";\n }\n\n ");
} else {
var s = de[i.data.type];
g.push("\n cv = ud." + k + ".value;\n v = uv." + k + ";\n offset = " + i.offset / 4 + ";\n " + s + ";\n ");
}
}
}
g.push("\n renderer.buffer.update(buffer);\n ");
return {
size: f,
syncFunc: new Function("ud", "uv", "renderer", "syncData", "buffer", g.join("\n"))
};
}(a, this.shader.program.uniformData);
if (a.autoManage) {
var h = new Float32Array(g.size / 4);
a.buffer.update(h);
}
b.uniformGroups[a.id] = g.syncFunc;
return b.uniformGroups[a.id];
};
a.prototype.getSignature = function (a, b, c) {
var d = a.uniforms;
var e = [c + "-"];
for (var f in d) {
e.push(f);
if (b[f]) {
e.push(b[f].type);
}
}
return e.join("-");
};
a.prototype.getGlProgram = function () {
if (this.shader) {
return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];
} else {
return null;
}
};
a.prototype.generateProgram = function (a) {
var b = this.gl;
var c = a.program;
var d = function (a, b) {
var c = td(a, a.VERTEX_SHADER, b.vertexSrc);
var d = td(a, a.FRAGMENT_SHADER, b.fragmentSrc);
var e = a.createProgram();
a.attachShader(e, c);
a.attachShader(e, d);
a.linkProgram(e);
if (!a.getProgramParameter(e, a.LINK_STATUS)) {
(function (a, b, c, d) {
if (!a.getProgramParameter(b, a.LINK_STATUS)) {
if (!a.getShaderParameter(c, a.COMPILE_STATUS)) {
ud(a, c);
}
if (!a.getShaderParameter(d, a.COMPILE_STATUS)) {
ud(a, d);
}
console.error("PixiJS Error: Could not initialize shader.");
if (a.getProgramInfoLog(b) !== "") {
console.warn("PixiJS Warning: gl.getProgramInfoLog()", a.getProgramInfoLog(b));
}
}
})(a, e, c, d);
}
b.attributeData = function (a, b) {
for (var c = {}, d = b.getProgramParameter(a, b.ACTIVE_ATTRIBUTES), e = 0; e < d; e++) {
var f = b.getActiveAttrib(a, e);
if (f.name.indexOf("gl_") !== 0) {
var g = Fd(b, f.type);
var h = {
type: g,
name: f.name,
size: Cd(g),
location: b.getAttribLocation(a, f.name)
};
c[f.name] = h;
}
}
return c;
}(e, a);
b.uniformData = function (a, b) {
for (var c = {}, d = b.getProgramParameter(a, b.ACTIVE_UNIFORMS), e = 0; e < d; e++) {
var f = b.getActiveUniform(a, e);
var g = f.name.replace(/\[.*?\]$/, "");
var h = !!f.name.match(/\[.*?\]$/);
var i = Fd(b, f.type);
c[g] = {
name: g,
index: e,
type: i,
size: f.size,
isArray: h,
value: wd(i, f.size)
};
}
return c;
}(e, a);
if (!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(b.vertexSrc)) {
var f = Object.keys(b.attributeData);
f.sort(function (a, b) {
if (a > b) {
return 1;
} else {
return -1;
}
});
for (var g = 0; g < f.length; g++) {
b.attributeData[f[g]].location = g;
a.bindAttribLocation(e, g, f[g]);
}
a.linkProgram(e);
}
a.deleteShader(c);
a.deleteShader(d);
var h = {};
for (var g in b.uniformData) {
var i = b.uniformData[g];
h[g] = {
location: a.getUniformLocation(e, g),
value: wd(i.type, i.size)
};
}
return new fe(e, h);
}(b, c);
c.glPrograms[this.renderer.CONTEXT_UID] = d;
return d;
};
a.prototype.reset = function () {
this.program = null;
this.shader = null;
};
a.prototype.destroy = function () {
this.renderer = null;
this.destroyed = true;
};
return a;
}();
var je = function () {
function a() {
this.gl = null;
this.stateId = 0;
this.polygonOffset = 0;
this.blendMode = pa.NONE;
this._blendEq = false;
this.map = [];
this.map[0] = this.setBlend;
this.map[1] = this.setOffset;
this.map[2] = this.setCullFace;
this.map[3] = this.setDepthTest;
this.map[4] = this.setFrontFace;
this.map[5] = this.setDepthMask;
this.checks = [];
this.defaultState = new Qd();
this.defaultState.blend = true;
}
a.prototype.contextChange = function (a) {
this.gl = a;
this.blendModes = function (a, b) {
if (b === undefined) {
b = [];
}
b[pa.NORMAL] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.ADD] = [a.ONE, a.ONE];
b[pa.MULTIPLY] = [a.DST_COLOR, a.ONE_MINUS_SRC_ALPHA, a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.SCREEN] = [a.ONE, a.ONE_MINUS_SRC_COLOR, a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.OVERLAY] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.DARKEN] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.LIGHTEN] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.COLOR_DODGE] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.COLOR_BURN] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.HARD_LIGHT] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.SOFT_LIGHT] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.DIFFERENCE] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.EXCLUSION] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.HUE] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.SATURATION] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.COLOR] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.LUMINOSITY] = [a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.NONE] = [0, 0];
b[pa.NORMAL_NPM] = [a.SRC_ALPHA, a.ONE_MINUS_SRC_ALPHA, a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.ADD_NPM] = [a.SRC_ALPHA, a.ONE, a.ONE, a.ONE];
b[pa.SCREEN_NPM] = [a.SRC_ALPHA, a.ONE_MINUS_SRC_COLOR, a.ONE, a.ONE_MINUS_SRC_ALPHA];
b[pa.SRC_IN] = [a.DST_ALPHA, a.ZERO];
b[pa.SRC_OUT] = [a.ONE_MINUS_DST_ALPHA, a.ZERO];
b[pa.SRC_ATOP] = [a.DST_ALPHA, a.ONE_MINUS_SRC_ALPHA];
b[pa.DST_OVER] = [a.ONE_MINUS_DST_ALPHA, a.ONE];
b[pa.DST_IN] = [a.ZERO, a.SRC_ALPHA];
b[pa.DST_OUT] = [a.ZERO, a.ONE_MINUS_SRC_ALPHA];
b[pa.DST_ATOP] = [a.ONE_MINUS_DST_ALPHA, a.SRC_ALPHA];
b[pa.XOR] = [a.ONE_MINUS_DST_ALPHA, a.ONE_MINUS_SRC_ALPHA];
b[pa.SUBTRACT] = [a.ONE, a.ONE, a.ONE, a.ONE, a.FUNC_REVERSE_SUBTRACT, a.FUNC_ADD];
return b;
}(a);
this.set(this.defaultState);
this.reset();
};
a.prototype.set = function (a) {
a = a || this.defaultState;
if (this.stateId !== a.data) {
for (var b = this.stateId ^ a.data, c = 0; b;) {
if (b & 1) {
this.map[c].call(this, !!(a.data & 1 << c));
}
b >>= 1;
c++;
}
this.stateId = a.data;
}
for (c = 0; c < this.checks.length; c++) {
this.checks[c](this, a);
}
};
a.prototype.forceState = function (a) {
a = a || this.defaultState;
for (var b = 0; b < this.map.length; b++) {
this.map[b].call(this, !!(a.data & 1 << b));
}
for (b = 0; b < this.checks.length; b++) {
this.checks[b](this, a);
}
this.stateId = a.data;
};
a.prototype.setBlend = function (b) {
this.updateCheck(a.checkBlendMode, b);
this.gl[b ? "enable" : "disable"](this.gl.BLEND);
};
a.prototype.setOffset = function (b) {
this.updateCheck(a.checkPolygonOffset, b);
this.gl[b ? "enable" : "disable"](this.gl.POLYGON_OFFSET_FILL);
};
a.prototype.setDepthTest = function (a) {
this.gl[a ? "enable" : "disable"](this.gl.DEPTH_TEST);
};
a.prototype.setDepthMask = function (a) {
this.gl.depthMask(a);
};
a.prototype.setCullFace = function (a) {
this.gl[a ? "enable" : "disable"](this.gl.CULL_FACE);
};
a.prototype.setFrontFace = function (a) {
this.gl.frontFace(this.gl[a ? "CW" : "CCW"]);
};
a.prototype.setBlendMode = function (a) {
if (a !== this.blendMode) {
this.blendMode = a;
var b = this.blendModes[a];
var c = this.gl;
if (b.length === 2) {
c.blendFunc(b[0], b[1]);
} else {
c.blendFuncSeparate(b[0], b[1], b[2], b[3]);
}
if (b.length === 6) {
this._blendEq = true;
c.blendEquationSeparate(b[4], b[5]);
} else if (this._blendEq) {
this._blendEq = false;
c.blendEquationSeparate(c.FUNC_ADD, c.FUNC_ADD);
}
}
};
a.prototype.setPolygonOffset = function (a, b) {
this.gl.polygonOffset(a, b);
};
a.prototype.reset = function () {
this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);
this.forceState(this.defaultState);
this._blendEq = true;
this.blendMode = -1;
this.setBlendMode(0);
};
a.prototype.updateCheck = function (a, b) {
var c = this.checks.indexOf(a);
if (b && c === -1) {
this.checks.push(a);
} else if (!b && c !== -1) {
this.checks.splice(c, 1);
}
};
a.checkBlendMode = function (a, b) {
a.setBlendMode(b.blendMode);
};
a.checkPolygonOffset = function (a, b) {
a.setPolygonOffset(1, b.polygonOffset);
};
a.prototype.destroy = function () {
this.gl = null;
};
return a;
}();
var ke = function () {
function a(a) {
this.renderer = a;
this.count = 0;
this.checkCount = 0;
this.maxIdle = Fa.GC_MAX_IDLE;
this.checkCountMax = Fa.GC_MAX_CHECK_COUNT;
this.mode = Fa.GC_MODE;
}
a.prototype.postrender = function () {
if (this.renderer.renderingToScreen) {
this.count++;
if (this.mode !== Aa.MANUAL) {
this.checkCount++;
if (this.checkCount > this.checkCountMax) {
this.checkCount = 0;
this.run();
}
}
}
};
a.prototype.run = function () {
for (var a = this.renderer.texture, b = a.managedTextures, c = false, d = 0; d < b.length; d++) {
var e = b[d];
if (!e.framebuffer && this.count - e.touched > this.maxIdle) {
a.destroyTexture(e, true);
b[d] = null;
c = true;
}
}
if (c) {
var f = 0;
for (d = 0; d < b.length; d++) {
if (b[d] !== null) {
b[f++] = b[d];
}
}
b.length = f;
}
};
a.prototype.unload = function (a) {
var b = this.renderer.texture;
var c = a._texture;
if (c && !c.framebuffer) {
b.destroyTexture(c);
}
for (var d = a.children.length - 1; d >= 0; d--) {
this.unload(a.children[d]);
}
};
a.prototype.destroy = function () {
this.renderer = null;
};
return a;
}();
function le(a) {
this.texture = a;
this.width = -1;
this.height = -1;
this.dirtyId = -1;
this.dirtyStyleId = -1;
this.mipmap = false;
this.wrapMode = 33071;
this.type = ta.UNSIGNED_BYTE;
this.internalFormat = ra.RGBA;
this.samplerType = 0;
}
var me = function () {
function a(a) {
this.renderer = a;
this.boundTextures = [];
this.currentLocation = -1;
this.managedTextures = [];
this._unknownBoundTextures = false;
this.unknownTexture = new Bc();
this.hasIntegerTextures = false;
}
a.prototype.contextChange = function () {
var a = this.gl = this.renderer.gl;
this.CONTEXT_UID = this.renderer.CONTEXT_UID;
this.webGLVersion = this.renderer.context.webGLVersion;
this.internalFormats = function (a) {
var b;
var c;
var d;
var e;
var f;
var g;
var h;
var i;
var j;
var k;
var l;
var m;
var n;
var o;
var p;
var q;
var r;
var s;
var t;
var u;
var v;
var w;
var x;
if ("WebGL2RenderingContext" in globalThis && a instanceof globalThis.WebGL2RenderingContext) {
(b = {})[ta.UNSIGNED_BYTE] = ((c = {})[ra.RGBA] = a.RGBA8, c[ra.RGB] = a.RGB8, c[ra.RG] = a.RG8, c[ra.RED] = a.R8, c[ra.RGBA_INTEGER] = a.RGBA8UI, c[ra.RGB_INTEGER] = a.RGB8UI, c[ra.RG_INTEGER] = a.RG8UI, c[ra.RED_INTEGER] = a.R8UI, c[ra.ALPHA] = a.ALPHA, c[ra.LUMINANCE] = a.LUMINANCE, c[ra.LUMINANCE_ALPHA] = a.LUMINANCE_ALPHA, c);
b[ta.BYTE] = ((d = {})[ra.RGBA] = a.RGBA8_SNORM, d[ra.RGB] = a.RGB8_SNORM, d[ra.RG] = a.RG8_SNORM, d[ra.RED] = a.R8_SNORM, d[ra.RGBA_INTEGER] = a.RGBA8I, d[ra.RGB_INTEGER] = a.RGB8I, d[ra.RG_INTEGER] = a.RG8I, d[ra.RED_INTEGER] = a.R8I, d);
b[ta.UNSIGNED_SHORT] = ((e = {})[ra.RGBA_INTEGER] = a.RGBA16UI, e[ra.RGB_INTEGER] = a.RGB16UI, e[ra.RG_INTEGER] = a.RG16UI, e[ra.RED_INTEGER] = a.R16UI, e[ra.DEPTH_COMPONENT] = a.DEPTH_COMPONENT16, e);
b[ta.SHORT] = ((f = {})[ra.RGBA_INTEGER] = a.RGBA16I, f[ra.RGB_INTEGER] = a.RGB16I, f[ra.RG_INTEGER] = a.RG16I, f[ra.RED_INTEGER] = a.R16I, f);
b[ta.UNSIGNED_INT] = ((g = {})[ra.RGBA_INTEGER] = a.RGBA32UI, g[ra.RGB_INTEGER] = a.RGB32UI, g[ra.RG_INTEGER] = a.RG32UI, g[ra.RED_INTEGER] = a.R32UI, g[ra.DEPTH_COMPONENT] = a.DEPTH_COMPONENT24, g);
b[ta.INT] = ((h = {})[ra.RGBA_INTEGER] = a.RGBA32I, h[ra.RGB_INTEGER] = a.RGB32I, h[ra.RG_INTEGER] = a.RG32I, h[ra.RED_INTEGER] = a.R32I, h);
b[ta.FLOAT] = ((i = {})[ra.RGBA] = a.RGBA32F, i[ra.RGB] = a.RGB32F, i[ra.RG] = a.RG32F, i[ra.RED] = a.R32F, i[ra.DEPTH_COMPONENT] = a.DEPTH_COMPONENT32F, i);
b[ta.HALF_FLOAT] = ((j = {})[ra.RGBA] = a.RGBA16F, j[ra.RGB] = a.RGB16F, j[ra.RG] = a.RG16F, j[ra.RED] = a.R16F, j);
b[ta.UNSIGNED_SHORT_5_6_5] = ((k = {})[ra.RGB] = a.RGB565, k);
b[ta.UNSIGNED_SHORT_4_4_4_4] = ((l = {})[ra.RGBA] = a.RGBA4, l);
b[ta.UNSIGNED_SHORT_5_5_5_1] = ((m = {})[ra.RGBA] = a.RGB5_A1, m);
b[ta.UNSIGNED_INT_2_10_10_10_REV] = ((n = {})[ra.RGBA] = a.RGB10_A2, n[ra.RGBA_INTEGER] = a.RGB10_A2UI, n);
b[ta.UNSIGNED_INT_10F_11F_11F_REV] = ((o = {})[ra.RGB] = a.R11F_G11F_B10F, o);
b[ta.UNSIGNED_INT_5_9_9_9_REV] = ((p = {})[ra.RGB] = a.RGB9_E5, p);
b[ta.UNSIGNED_INT_24_8] = ((q = {})[ra.DEPTH_STENCIL] = a.DEPTH24_STENCIL8, q);
b[ta.FLOAT_32_UNSIGNED_INT_24_8_REV] = ((r = {})[ra.DEPTH_STENCIL] = a.DEPTH32F_STENCIL8, r);
x = b;
} else {
(s = {})[ta.UNSIGNED_BYTE] = ((t = {})[ra.RGBA] = a.RGBA, t[ra.RGB] = a.RGB, t[ra.ALPHA] = a.ALPHA, t[ra.LUMINANCE] = a.LUMINANCE, t[ra.LUMINANCE_ALPHA] = a.LUMINANCE_ALPHA, t);
s[ta.UNSIGNED_SHORT_5_6_5] = ((u = {})[ra.RGB] = a.RGB, u);
s[ta.UNSIGNED_SHORT_4_4_4_4] = ((v = {})[ra.RGBA] = a.RGBA, v);
s[ta.UNSIGNED_SHORT_5_5_5_1] = ((w = {})[ra.RGBA] = a.RGBA, w);
x = s;
}
return x;
}(a);
var b = a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS);
this.boundTextures.length = b;
for (var c = 0; c < b; c++) {
this.boundTextures[c] = null;
}
this.emptyTextures = {};
var d = new le(a.createTexture());
a.bindTexture(a.TEXTURE_2D, d.texture);
a.texImage2D(a.TEXTURE_2D, 0, a.RGBA, 1, 1, 0, a.RGBA, a.UNSIGNED_BYTE, new Uint8Array(4));
this.emptyTextures[a.TEXTURE_2D] = d;
this.emptyTextures[a.TEXTURE_CUBE_MAP] = new le(a.createTexture());
a.bindTexture(a.TEXTURE_CUBE_MAP, this.emptyTextures[a.TEXTURE_CUBE_MAP].texture);
c = 0;
for (; c < 6; c++) {
a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X + c, 0, a.RGBA, 1, 1, 0, a.RGBA, a.UNSIGNED_BYTE, null);
}
a.texParameteri(a.TEXTURE_CUBE_MAP, a.TEXTURE_MAG_FILTER, a.LINEAR);
a.texParameteri(a.TEXTURE_CUBE_MAP, a.TEXTURE_MIN_FILTER, a.LINEAR);
c = 0;
for (; c < this.boundTextures.length; c++) {
this.bind(null, c);
}
};
a.prototype.bind = function (a, b) {
if (b === undefined) {
b = 0;
}
var c = this.gl;
if ((a = a == null ? undefined : a.castToBaseTexture()) && a.valid && !a.parentTextureArray) {
a.touched = this.renderer.textureGC.count;
var d = a._glTextures[this.CONTEXT_UID] || this.initTexture(a);
if (this.boundTextures[b] !== a) {
if (this.currentLocation !== b) {
this.currentLocation = b;
c.activeTexture(c.TEXTURE0 + b);
}
c.bindTexture(a.target, d.texture);
}
if (d.dirtyId !== a.dirtyId) {
if (this.currentLocation !== b) {
this.currentLocation = b;
c.activeTexture(c.TEXTURE0 + b);
}
this.updateTexture(a);
}
this.boundTextures[b] = a;
} else {
if (this.currentLocation !== b) {
this.currentLocation = b;
c.activeTexture(c.TEXTURE0 + b);
}
c.bindTexture(c.TEXTURE_2D, this.emptyTextures[c.TEXTURE_2D].texture);
this.boundTextures[b] = null;
}
};
a.prototype.reset = function () {
this._unknownBoundTextures = true;
this.hasIntegerTextures = false;
this.currentLocation = -1;
for (var a = 0; a < this.boundTextures.length; a++) {
this.boundTextures[a] = this.unknownTexture;
}
};
a.prototype.unbind = function (a) {
var b = this.gl;
var c = this.boundTextures;
if (this._unknownBoundTextures) {
this._unknownBoundTextures = false;
for (var d = 0; d < c.length; d++) {
if (c[d] === this.unknownTexture) {
this.bind(null, d);
}
}
}
for (d = 0; d < c.length; d++) {
if (c[d] === a) {
if (this.currentLocation !== d) {
b.activeTexture(b.TEXTURE0 + d);
this.currentLocation = d;
}
b.bindTexture(a.target, this.emptyTextures[a.target].texture);
c[d] = null;
}
}
};
a.prototype.ensureSamplerType = function (a) {
var b = this;
var c = b.boundTextures;
var d = b.hasIntegerTextures;
var e = b.CONTEXT_UID;
if (d) {
for (var f = a - 1; f >= 0; --f) {
var g = c[f];
if (g && g._glTextures[e].samplerType !== ua.FLOAT) {
this.renderer.texture.unbind(g);
}
}
}
};
a.prototype.initTexture = function (a) {
var b = new le(this.gl.createTexture());
b.dirtyId = -1;
a._glTextures[this.CONTEXT_UID] = b;
this.managedTextures.push(a);
a.on("dispose", this.destroyTexture, this);
return b;
};
a.prototype.initTextureType = function (a, b) {
b.internalFormat = this.internalFormats[a.type]?.[a.format] ?? a.format;
if (this.webGLVersion === 2 && a.type === ta.HALF_FLOAT) {
b.type = this.gl.HALF_FLOAT;
} else {
b.type = a.type;
}
};
a.prototype.updateTexture = function (a) {
var b = a._glTextures[this.CONTEXT_UID];
if (b) {
var c = this.renderer;
this.initTextureType(a, b);
if (a.resource && a.resource.upload(c, a, b)) {
if (b.samplerType !== ua.FLOAT) {
this.hasIntegerTextures = true;
}
} else {
var d = a.realWidth;
var e = a.realHeight;
var f = c.gl;
if (b.width !== d || b.height !== e || b.dirtyId < 0) {
b.width = d;
b.height = e;
f.texImage2D(a.target, 0, b.internalFormat, d, e, 0, a.format, b.type, null);
}
}
if (a.dirtyStyleId !== b.dirtyStyleId) {
this.updateTextureStyle(a);
}
b.dirtyId = a.dirtyId;
}
};
a.prototype.destroyTexture = function (a, b) {
var c = this.gl;
if ((a = a.castToBaseTexture())._glTextures[this.CONTEXT_UID] && (this.unbind(a), c.deleteTexture(a._glTextures[this.CONTEXT_UID].texture), a.off("dispose", this.destroyTexture, this), delete a._glTextures[this.CONTEXT_UID], !b)) {
var d = this.managedTextures.indexOf(a);
if (d !== -1) {
$a(this.managedTextures, d, 1);
}
}
};
a.prototype.updateTextureStyle = function (a) {
var b = a._glTextures[this.CONTEXT_UID];
if (b) {
if (a.mipmap !== xa.POW2 && this.webGLVersion === 2 || a.isPowerOfTwo) {
b.mipmap = a.mipmap >= 1;
} else {
b.mipmap = false;
}
if (this.webGLVersion === 2 || a.isPowerOfTwo) {
b.wrapMode = a.wrapMode;
} else {
b.wrapMode = wa.CLAMP;
}
if (!a.resource || !a.resource.style(this.renderer, a, b)) {
this.setStyle(a, b);
}
b.dirtyStyleId = a.dirtyStyleId;
}
};
a.prototype.setStyle = function (a, b) {
var c = this.gl;
if (b.mipmap && a.mipmap !== xa.ON_MANUAL) {
c.generateMipmap(a.target);
}
c.texParameteri(a.target, c.TEXTURE_WRAP_S, b.wrapMode);
c.texParameteri(a.target, c.TEXTURE_WRAP_T, b.wrapMode);
if (b.mipmap) {
c.texParameteri(a.target, c.TEXTURE_MIN_FILTER, a.scaleMode === va.LINEAR ? c.LINEAR_MIPMAP_LINEAR : c.NEAREST_MIPMAP_NEAREST);
var d = this.renderer.context.extensions.anisotropicFiltering;
if (d && a.anisotropicLevel > 0 && a.scaleMode === va.LINEAR) {
var e = Math.min(a.anisotropicLevel, c.getParameter(d.MAX_TEXTURE_MAX_ANISOTROPY_EXT));
c.texParameterf(a.target, d.TEXTURE_MAX_ANISOTROPY_EXT, e);
}
} else {
c.texParameteri(a.target, c.TEXTURE_MIN_FILTER, a.scaleMode === va.LINEAR ? c.LINEAR : c.NEAREST);
}
c.texParameteri(a.target, c.TEXTURE_MAG_FILTER, a.scaleMode === va.LINEAR ? c.LINEAR : c.NEAREST);
};
a.prototype.destroy = function () {
this.renderer = null;
};
return a;
}();
var ne = {
"__proto__": null,
FilterSystem: id,
BatchSystem: kd,
ContextSystem: md,
FramebufferSystem: pd,
GeometrySystem: rd,
MaskSystem: Vd,
ScissorSystem: Yd,
StencilSystem: Zd,
ProjectionSystem: $d,
RenderTextureSystem: be,
ShaderSystem: ie,
StateSystem: je,
TextureGCSystem: ke,
TextureSystem: me
};
var oe = new wb();
var pe = function (a) {
function b(b, c) {
if (b === undefined) {
b = na.UNKNOWN;
}
var d = a.call(this) || this;
c = Object.assign({}, Fa.RENDER_OPTIONS, c);
d.options = c;
d.type = b;
d.screen = new qb(0, 0, c.width, c.height);
d.view = c.view || document.createElement("canvas");
d.resolution = c.resolution || Fa.RESOLUTION;
d.useContextAlpha = c.useContextAlpha;
d.autoDensity = !!c.autoDensity;
d.preserveDrawingBuffer = c.preserveDrawingBuffer;
d.clearBeforeRender = c.clearBeforeRender;
d._backgroundColor = 0;
d._backgroundColorRgba = [0, 0, 0, 1];
d._backgroundColorString = "#000000";
d.backgroundColor = c.backgroundColor || d._backgroundColor;
d.backgroundAlpha = c.backgroundAlpha;
if (c.transparent !== undefined) {
db("6.0.0", "Option transparent is deprecated, please use backgroundAlpha instead.");
d.useContextAlpha = c.transparent;
d.backgroundAlpha = c.transparent ? 0 : 1;
}
d._lastObjectRendered = null;
d.plugins = {};
return d;
}
wc(b, a);
b.prototype.initPlugins = function (a) {
for (var b in a) {
this.plugins[b] = new a[b](this);
}
};
Object.defineProperty(b.prototype, "width", {
get: function () {
return this.view.width;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "height", {
get: function () {
return this.view.height;
},
enumerable: false,
configurable: true
});
b.prototype.resize = function (a, b) {
this.view.width = Math.round(a * this.resolution);
this.view.height = Math.round(b * this.resolution);
var c = this.view.width / this.resolution;
var d = this.view.height / this.resolution;
this.screen.width = c;
this.screen.height = d;
if (this.autoDensity) {
this.view.style.width = c + "px";
this.view.style.height = d + "px";
}
this.emit("resize", c, d);
};
b.prototype.generateTexture = function (a, b, c, d) {
if (b === undefined) {
b = {};
}
if (typeof b == "number") {
db("6.1.0", "generateTexture options (scaleMode, resolution, region) are now object options.");
b = {
scaleMode: b,
resolution: c,
region: d
};
}
var e = b.region;
var f = function (a, b) {
var c = {};
for (var d in a) {
if (Object.prototype.hasOwnProperty.call(a, d) && b.indexOf(d) < 0) {
c[d] = a[d];
}
}
if (a != null && typeof Object.getOwnPropertySymbols == "function") {
var e = 0;
for (d = Object.getOwnPropertySymbols(a); e < d.length; e++) {
if (b.indexOf(d[e]) < 0) {
c[d[e]] = a[d[e]];
}
}
}
return c;
}(b, ["region"]);
if ((d = e || a.getLocalBounds(null, true)).width === 0) {
d.width = 1;
}
if (d.height === 0) {
d.height = 1;
}
var g = Tc.create(xc({
width: d.width,
height: d.height
}, f));
oe.tx = -d.x;
oe.ty = -d.y;
this.render(a, {
renderTexture: g,
clear: false,
transform: oe,
skipUpdateTransform: !!a.parent
});
return g;
};
b.prototype.destroy = function (a) {
for (var b in this.plugins) {
this.plugins[b].destroy();
this.plugins[b] = null;
}
if (a && this.view.parentNode) {
this.view.parentNode.removeChild(this.view);
}
var c = this;
c.plugins = null;
c.type = na.UNKNOWN;
c.view = null;
c.screen = null;
c._tempDisplayObjectParent = null;
c.options = null;
this._backgroundColorRgba = null;
this._backgroundColorString = null;
this._lastObjectRendered = null;
};
Object.defineProperty(b.prototype, "backgroundColor", {
get: function () {
return this._backgroundColor;
},
set: function (a) {
this._backgroundColor = a;
this._backgroundColorString = Qa(a);
Pa(a, this._backgroundColorRgba);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "backgroundAlpha", {
get: function () {
return this._backgroundColorRgba[3];
},
set: function (a) {
this._backgroundColorRgba[3] = a;
},
enumerable: false,
configurable: true
});
return b;
}(Ha());
function qe(a) {
this.buffer = a || null;
this.updateID = -1;
this.byteLength = -1;
this.refCount = 0;
}
var re = function () {
function a(a) {
this.renderer = a;
this.managedBuffers = {};
this.boundBufferBases = {};
}
a.prototype.destroy = function () {
this.renderer = null;
};
a.prototype.contextChange = function () {
this.disposeAll(true);
this.gl = this.renderer.gl;
this.CONTEXT_UID = this.renderer.CONTEXT_UID;
};
a.prototype.bind = function (a) {
var b = this.gl;
var c = this.CONTEXT_UID;
var d = a._glBuffers[c] || this.createGLBuffer(a);
b.bindBuffer(a.type, d.buffer);
};
a.prototype.bindBufferBase = function (a, b) {
var c = this.gl;
var d = this.CONTEXT_UID;
if (this.boundBufferBases[b] !== a) {
var e = a._glBuffers[d] || this.createGLBuffer(a);
this.boundBufferBases[b] = a;
c.bindBufferBase(c.UNIFORM_BUFFER, b, e.buffer);
}
};
a.prototype.bindBufferRange = function (a, b, c) {
var d = this.gl;
var e = this.CONTEXT_UID;
c = c || 0;
var f = a._glBuffers[e] || this.createGLBuffer(a);
d.bindBufferRange(d.UNIFORM_BUFFER, b || 0, f.buffer, c * 256, 256);
};
a.prototype.update = function (a) {
var b = this.gl;
var c = this.CONTEXT_UID;
var d = a._glBuffers[c];
if (a._updateID !== d.updateID) {
d.updateID = a._updateID;
b.bindBuffer(a.type, d.buffer);
if (d.byteLength >= a.data.byteLength) {
b.bufferSubData(a.type, 0, a.data);
} else {
var e = a.static ? b.STATIC_DRAW : b.DYNAMIC_DRAW;
d.byteLength = a.data.byteLength;
b.bufferData(a.type, a.data, e);
}
}
};
a.prototype.dispose = function (a, b) {
if (this.managedBuffers[a.id]) {
delete this.managedBuffers[a.id];
var c = a._glBuffers[this.CONTEXT_UID];
var d = this.gl;
a.disposeRunner.remove(this);
if (c) {
if (!b) {
d.deleteBuffer(c.buffer);
}
delete a._glBuffers[this.CONTEXT_UID];
}
}
};
a.prototype.disposeAll = function (a) {
for (var b = Object.keys(this.managedBuffers), c = 0; c < b.length; c++) {
this.dispose(this.managedBuffers[b[c]], a);
}
};
a.prototype.createGLBuffer = function (a) {
var b = this.CONTEXT_UID;
var c = this.gl;
a._glBuffers[b] = new qe(c.createBuffer());
this.managedBuffers[a.id] = a;
a.disposeRunner.add(this);
return a._glBuffers[b];
};
return a;
}();
var se = function (a) {
function b(c) {
var d = a.call(this, na.WEBGL, c) || this;
c = d.options;
d.gl = null;
d.CONTEXT_UID = 0;
d.runners = {
destroy: new sc("destroy"),
contextChange: new sc("contextChange"),
reset: new sc("reset"),
update: new sc("update"),
postrender: new sc("postrender"),
prerender: new sc("prerender"),
resize: new sc("resize")
};
d.runners.contextChange.add(d);
d.globalUniforms = new ed({
projectionMatrix: new wb()
}, true);
d.addSystem(Vd, "mask").addSystem(md, "context").addSystem(je, "state").addSystem(ie, "shader").addSystem(me, "texture").addSystem(re, "buffer").addSystem(rd, "geometry").addSystem(pd, "framebuffer").addSystem(Yd, "scissor").addSystem(Zd, "stencil").addSystem($d, "projection").addSystem(ke, "textureGC").addSystem(id, "filter").addSystem(be, "renderTexture").addSystem(kd, "batch");
d.initPlugins(b.__plugins);
d.multisample = undefined;
if (c.context) {
d.context.initFromContext(c.context);
} else {
d.context.initFromOptions({
alpha: !!d.useContextAlpha,
antialias: c.antialias,
premultipliedAlpha: d.useContextAlpha && d.useContextAlpha !== "notMultiplied",
stencil: true,
preserveDrawingBuffer: c.preserveDrawingBuffer,
powerPreference: d.options.powerPreference
});
}
d.renderingToScreen = true;
(function (a) {
var b;
if (!Na) {
if (navigator.userAgent.toLowerCase().indexOf("chrome") > -1) {
var c = ["\n %c %c %c PixiJS 6.3.2 - ✰ " + a + " ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n", "background: #ff66a5; padding:5px 0;", "background: #ff66a5; padding:5px 0;", "color: #ff66a5; background: #030307; padding:5px 0;", "background: #ff66a5; padding:5px 0;", "background: #ffc3dc; padding:5px 0;", "background: #ff66a5; padding:5px 0;", "color: #ff2424; background: #fff; padding:5px 0;", "color: #ff2424; background: #fff; padding:5px 0;", "color: #ff2424; background: #fff; padding:5px 0;"];
(b = globalThis.console).log.apply(b, c);
} else if (globalThis.console) {
globalThis.console.log("PixiJS 6.3.2 - " + a + " - http://www.pixijs.com/");
}
Na = true;
}
})(d.context.webGLVersion === 2 ? "WebGL 2" : "WebGL 1");
d.resize(d.options.width, d.options.height);
return d;
}
wc(b, a);
b.create = function (a) {
if (Ma === undefined) {
Ma = function () {
var a = {
stencil: true,
failIfMajorPerformanceCaveat: Fa.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT
};
try {
if (!globalThis.WebGLRenderingContext) {
return false;
}
var b = document.createElement("canvas");
var c = b.getContext("webgl", a) || b.getContext("experimental-webgl", a);
var d = !!c && !!c.getContextAttributes().stencil;
if (c) {
var e = c.getExtension("WEBGL_lose_context");
if (e) {
e.loseContext();
}
}
c = null;
return d;
} catch (a) {
return false;
}
}();
}
if (Ma) {
return new b(a);
}
throw new Error("WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.");
};
b.prototype.contextChange = function () {
var a;
var b = this.gl;
if (this.context.webGLVersion === 1) {
var c = b.getParameter(b.FRAMEBUFFER_BINDING);
b.bindFramebuffer(b.FRAMEBUFFER, null);
a = b.getParameter(b.SAMPLES);
b.bindFramebuffer(b.FRAMEBUFFER, c);
} else {
c = b.getParameter(b.DRAW_FRAMEBUFFER_BINDING);
b.bindFramebuffer(b.DRAW_FRAMEBUFFER, null);
a = b.getParameter(b.SAMPLES);
b.bindFramebuffer(b.DRAW_FRAMEBUFFER, c);
}
if (a >= Da.HIGH) {
this.multisample = Da.HIGH;
} else if (a >= Da.MEDIUM) {
this.multisample = Da.MEDIUM;
} else if (a >= Da.LOW) {
this.multisample = Da.LOW;
} else {
this.multisample = Da.NONE;
}
};
b.prototype.addSystem = function (a, b) {
var c = new a(this);
if (this[b]) {
throw new Error("Whoops! The name \"" + b + "\" is already in use");
}
this[b] = c;
for (var d in this.runners) {
this.runners[d].add(c);
}
return this;
};
b.prototype.render = function (a, b) {
var c;
var d;
var e;
var f;
if (b) {
if (b instanceof Tc) {
db("6.0.0", "Renderer#render arguments changed, use options instead.");
c = b;
d = arguments[2];
e = arguments[3];
f = arguments[4];
} else {
c = b.renderTexture;
d = b.clear;
e = b.transform;
f = b.skipUpdateTransform;
}
}
this.renderingToScreen = !c;
this.runners.prerender.emit();
this.emit("prerender");
this.projection.transform = e;
if (!this.context.isLost) {
if (!c) {
this._lastObjectRendered = a;
}
if (!f) {
var g = a.enableTempParent();
a.updateTransform();
a.disableTempParent(g);
}
this.renderTexture.bind(c);
this.batch.currentRenderer.start();
if (d !== undefined ? d : this.clearBeforeRender) {
this.renderTexture.clear();
}
a.render(this);
this.batch.currentRenderer.flush();
if (c) {
c.baseTexture.update();
}
this.runners.postrender.emit();
this.projection.transform = null;
this.emit("postrender");
}
};
b.prototype.generateTexture = function (b, c, d, e) {
if (c === undefined) {
c = {};
}
var f = a.prototype.generateTexture.call(this, b, c, d, e);
this.framebuffer.blit();
return f;
};
b.prototype.resize = function (b, c) {
a.prototype.resize.call(this, b, c);
this.runners.resize.emit(this.screen.height, this.screen.width);
};
b.prototype.reset = function () {
this.runners.reset.emit();
return this;
};
b.prototype.clear = function () {
this.renderTexture.bind();
this.renderTexture.clear();
};
b.prototype.destroy = function (b) {
this.runners.destroy.emit();
for (var c in this.runners) {
this.runners[c].destroy();
}
a.prototype.destroy.call(this, b);
this.gl = null;
};
Object.defineProperty(b.prototype, "extract", {
get: function () {
db("6.0.0", "Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.");
return this.plugins.extract;
},
enumerable: false,
configurable: true
});
b.registerPlugin = function (a, c) {
b.__plugins = b.__plugins || {};
b.__plugins[a] = c;
};
return b;
}(pe);
var te = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n";
function ue() {
this.texArray = null;
this.blend = 0;
this.type = qa.TRIANGLES;
this.start = 0;
this.size = 0;
this.data = null;
}
var ve = function () {
function a() {
this.elements = [];
this.ids = [];
this.count = 0;
}
a.prototype.clear = function () {
for (var a = 0; a < this.count; a++) {
this.elements[a] = null;
}
this.count = 0;
};
return a;
}();
var we = function () {
function a(a) {
if (typeof a == "number") {
this.rawBinaryData = new ArrayBuffer(a);
} else if (a instanceof Uint8Array) {
this.rawBinaryData = a.buffer;
} else {
this.rawBinaryData = a;
}
this.uint32View = new Uint32Array(this.rawBinaryData);
this.float32View = new Float32Array(this.rawBinaryData);
}
Object.defineProperty(a.prototype, "int8View", {
get: function () {
this._int8View ||= new Int8Array(this.rawBinaryData);
return this._int8View;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "uint8View", {
get: function () {
this._uint8View ||= new Uint8Array(this.rawBinaryData);
return this._uint8View;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "int16View", {
get: function () {
this._int16View ||= new Int16Array(this.rawBinaryData);
return this._int16View;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "uint16View", {
get: function () {
this._uint16View ||= new Uint16Array(this.rawBinaryData);
return this._uint16View;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "int32View", {
get: function () {
this._int32View ||= new Int32Array(this.rawBinaryData);
return this._int32View;
},
enumerable: false,
configurable: true
});
a.prototype.view = function (a) {
return this[a + "View"];
};
a.prototype.destroy = function () {
this.rawBinaryData = null;
this._int8View = null;
this._uint8View = null;
this._int16View = null;
this._uint16View = null;
this._int32View = null;
this.uint32View = null;
this.float32View = null;
};
a.sizeOf = function (a) {
switch (a) {
case "int8":
case "uint8":
return 1;
case "int16":
case "uint16":
return 2;
case "int32":
case "uint32":
case "float32":
return 4;
default:
throw new Error(a + " isn't a valid view type");
}
};
return a;
}();
var xe = function (a) {
function b(b) {
var c = a.call(this, b) || this;
c.shaderGenerator = null;
c.geometryClass = null;
c.vertexSize = null;
c.state = Qd.for2d();
c.size = Fa.SPRITE_BATCH_SIZE * 4;
c._vertexCount = 0;
c._indexCount = 0;
c._bufferedElements = [];
c._bufferedTextures = [];
c._bufferSize = 0;
c._shader = null;
c._packedGeometries = [];
c._packedGeometryPoolSize = 2;
c._flushId = 0;
c._aBuffers = {};
c._iBuffers = {};
c.MAX_TEXTURES = 1;
c.renderer.on("prerender", c.onPrerender, c);
b.runners.contextChange.add(c);
c._dcIndex = 0;
c._aIndex = 0;
c._iIndex = 0;
c._attributeBuffer = null;
c._indexBuffer = null;
c._tempBoundTextures = [];
return c;
}
wc(b, a);
b.prototype.contextChange = function () {
var a = this.renderer.gl;
if (Fa.PREFER_ENV === ma.WEBGL_LEGACY) {
this.MAX_TEXTURES = 1;
} else {
this.MAX_TEXTURES = Math.min(a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS), Fa.SPRITE_MAX_TEXTURES);
this.MAX_TEXTURES = function (a, b) {
if (a === 0) {
throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");
}
for (var c = b.createShader(b.FRAGMENT_SHADER);;) {
var d = Kd.replace(/%forloop%/gi, Ld(a));
b.shaderSource(c, d);
b.compileShader(c);
if (b.getShaderParameter(c, b.COMPILE_STATUS)) {
break;
}
a = a / 2 | 0;
}
return a;
}(this.MAX_TEXTURES, a);
}
this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);
for (var b = 0; b < this._packedGeometryPoolSize; b++) {
this._packedGeometries[b] = new this.geometryClass();
}
this.initFlushBuffers();
};
b.prototype.initFlushBuffers = function () {
for (var a = b._drawCallPool, c = b._textureArrayPool, d = this.size / 4, e = Math.floor(d / this.MAX_TEXTURES) + 1; a.length < d;) {
a.push(new ue());
}
while (c.length < e) {
c.push(new ve());
}
for (var f = 0; f < this.MAX_TEXTURES; f++) {
this._tempBoundTextures[f] = null;
}
};
b.prototype.onPrerender = function () {
this._flushId = 0;
};
b.prototype.render = function (a) {
if (a._texture.valid) {
if (this._vertexCount + a.vertexData.length / 2 > this.size) {
this.flush();
}
this._vertexCount += a.vertexData.length / 2;
this._indexCount += a.indices.length;
this._bufferedTextures[this._bufferSize] = a._texture.baseTexture;
this._bufferedElements[this._bufferSize++] = a;
}
};
b.prototype.buildTexturesAndDrawCalls = function () {
var a = this._bufferedTextures;
var c = this.MAX_TEXTURES;
var d = b._textureArrayPool;
var e = this.renderer.batch;
var f = this._tempBoundTextures;
var g = this.renderer.textureGC.count;
var h = ++Bc._globalBatch;
var i = 0;
var j = d[0];
var k = 0;
e.copyBoundTextures(f, c);
for (var l = 0; l < this._bufferSize; ++l) {
var m = a[l];
a[l] = null;
if (m._batchEnabled !== h) {
if (j.count >= c) {
e.boundArray(j, f, h, c);
this.buildDrawCalls(j, k, l);
k = l;
j = d[++i];
++h;
}
m._batchEnabled = h;
m.touched = g;
j.elements[j.count++] = m;
}
}
if (j.count > 0) {
e.boundArray(j, f, h, c);
this.buildDrawCalls(j, k, this._bufferSize);
++i;
++h;
}
l = 0;
for (; l < f.length; l++) {
f[l] = null;
}
Bc._globalBatch = h;
};
b.prototype.buildDrawCalls = function (a, c, d) {
var e = this;
var f = e._bufferedElements;
var g = e._attributeBuffer;
var h = e._indexBuffer;
var i = e.vertexSize;
var j = b._drawCallPool;
var k = this._dcIndex;
var l = this._aIndex;
var m = this._iIndex;
var n = j[k];
n.start = this._iIndex;
n.texArray = a;
for (var o = c; o < d; ++o) {
var p = f[o];
var q = p._texture.baseTexture;
var r = Sa[q.alphaMode ? 1 : 0][p.blendMode];
f[o] = null;
if (c < o && n.blend !== r) {
n.size = m - n.start;
c = o;
(n = j[++k]).texArray = a;
n.start = m;
}
this.packInterleavedGeometry(p, g, h, l, m);
l += p.vertexData.length / 2 * i;
m += p.indices.length;
n.blend = r;
}
if (c < d) {
n.size = m - n.start;
++k;
}
this._dcIndex = k;
this._aIndex = l;
this._iIndex = m;
};
b.prototype.bindAndClearTexArray = function (a) {
for (var b = this.renderer.texture, c = 0; c < a.count; c++) {
b.bind(a.elements[c], a.ids[c]);
a.elements[c] = null;
}
a.count = 0;
};
b.prototype.updateGeometry = function () {
var a = this;
var b = a._packedGeometries;
var c = a._attributeBuffer;
var d = a._indexBuffer;
if (Fa.CAN_UPLOAD_SAME_BUFFER) {
b[this._flushId]._buffer.update(c.rawBinaryData);
b[this._flushId]._indexBuffer.update(d);
this.renderer.geometry.updateBuffers();
} else {
if (this._packedGeometryPoolSize <= this._flushId) {
this._packedGeometryPoolSize++;
b[this._flushId] = new this.geometryClass();
}
b[this._flushId]._buffer.update(c.rawBinaryData);
b[this._flushId]._indexBuffer.update(d);
this.renderer.geometry.bind(b[this._flushId]);
this.renderer.geometry.updateBuffers();
this._flushId++;
}
};
b.prototype.drawBatches = function () {
for (var a = this._dcIndex, c = this.renderer, d = c.gl, e = c.state, f = b._drawCallPool, g = null, h = 0; h < a; h++) {
var i = f[h];
var j = i.texArray;
var k = i.type;
var l = i.size;
var m = i.start;
var n = i.blend;
if (g !== j) {
g = j;
this.bindAndClearTexArray(j);
}
this.state.blendMode = n;
e.set(this.state);
d.drawElements(k, l, d.UNSIGNED_SHORT, m * 2);
}
};
b.prototype.flush = function () {
if (this._vertexCount !== 0) {
this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);
this._indexBuffer = this.getIndexBuffer(this._indexCount);
this._aIndex = 0;
this._iIndex = 0;
this._dcIndex = 0;
this.buildTexturesAndDrawCalls();
this.updateGeometry();
this.drawBatches();
this._bufferSize = 0;
this._vertexCount = 0;
this._indexCount = 0;
}
};
b.prototype.start = function () {
this.renderer.state.set(this.state);
this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES);
this.renderer.shader.bind(this._shader);
if (Fa.CAN_UPLOAD_SAME_BUFFER) {
this.renderer.geometry.bind(this._packedGeometries[this._flushId]);
}
};
b.prototype.stop = function () {
this.flush();
};
b.prototype.destroy = function () {
for (var b = 0; b < this._packedGeometryPoolSize; b++) {
if (this._packedGeometries[b]) {
this._packedGeometries[b].destroy();
}
}
this.renderer.off("prerender", this.onPrerender, this);
this._aBuffers = null;
this._iBuffers = null;
this._packedGeometries = null;
this._attributeBuffer = null;
this._indexBuffer = null;
if (this._shader) {
this._shader.destroy();
this._shader = null;
}
a.prototype.destroy.call(this);
};
b.prototype.getAttributeBuffer = function (a) {
var b = Xa(Math.ceil(a / 8));
var c = Za(b);
var d = b * 8;
if (this._aBuffers.length <= c) {
this._iBuffers.length = c + 1;
}
var e = this._aBuffers[d];
if (!e) {
this._aBuffers[d] = e = new we(d * this.vertexSize * 4);
}
return e;
};
b.prototype.getIndexBuffer = function (a) {
var b = Xa(Math.ceil(a / 12));
var c = Za(b);
var d = b * 12;
if (this._iBuffers.length <= c) {
this._iBuffers.length = c + 1;
}
var e = this._iBuffers[c];
if (!e) {
this._iBuffers[c] = e = new Uint16Array(d);
}
return e;
};
b.prototype.packInterleavedGeometry = function (a, b, c, d, e) {
for (var f = b.uint32View, g = b.float32View, h = d / this.vertexSize, i = a.uvs, j = a.indices, k = a.vertexData, l = a._texture.baseTexture._batchLocation, m = Math.min(a.worldAlpha, 1), n = m < 1 && a._texture.baseTexture.alphaMode ? Ua(a._tintRGB, m) : a._tintRGB + (m * 255 << 24), o = 0; o < k.length; o += 2) {
g[d++] = k[o];
g[d++] = k[o + 1];
g[d++] = i[o];
g[d++] = i[o + 1];
f[d++] = n;
g[d++] = l;
}
for (o = 0; o < j.length; o++) {
c[e++] = h + j[o];
}
};
b._drawCallPool = [];
b._textureArrayPool = [];
return b;
}(jd);
var ye = function () {
function a(a, b) {
this.vertexSrc = a;
this.fragTemplate = b;
this.programCache = {};
this.defaultGroupCache = {};
if (b.indexOf("%count%") < 0) {
throw new Error("Fragment template must contain \"%count%\".");
}
if (b.indexOf("%forloop%") < 0) {
throw new Error("Fragment template must contain \"%forloop%\".");
}
}
a.prototype.generateShader = function (a) {
if (!this.programCache[a]) {
for (var b = new Int32Array(a), c = 0; c < a; c++) {
b[c] = c;
}
this.defaultGroupCache[a] = ed.from({
uSamplers: b
}, true);
var d = this.fragTemplate;
d = (d = d.replace(/%count%/gi, "" + a)).replace(/%forloop%/gi, this.generateSampleSrc(a));
this.programCache[a] = new Od(this.vertexSrc, d);
}
var e = {
tint: new Float32Array([1, 1, 1, 1]),
translationMatrix: new wb(),
default: this.defaultGroupCache[a]
};
return new Pd(this.programCache[a], e);
};
a.prototype.generateSampleSrc = function (a) {
var b = "";
b += "\n";
b += "\n";
for (var c = 0; c < a; c++) {
if (c > 0) {
b += "\nelse ";
}
if (c < a - 1) {
b += "if(vTextureId < " + c + ".5)";
}
b += "\n{";
b += "\n\tcolor = texture2D(uSamplers[" + c + "], vTextureCoord);";
b += "\n}";
}
return (b += "\n") + "\n";
};
return a;
}();
var ze = function (a) {
function b(b) {
if (b === undefined) {
b = false;
}
var c = a.call(this) || this;
c._buffer = new Xc(null, b, false);
c._indexBuffer = new Xc(null, b, true);
c.addAttribute("aVertexPosition", c._buffer, 2, false, ta.FLOAT).addAttribute("aTextureCoord", c._buffer, 2, false, ta.FLOAT).addAttribute("aColor", c._buffer, 4, true, ta.UNSIGNED_BYTE).addAttribute("aTextureId", c._buffer, 1, true, ta.FLOAT).addIndex(c._indexBuffer);
return c;
}
wc(b, a);
return b;
}(ad);
var Ae = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n";
var Be = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n";
var Ce = function () {
function a() {}
a.create = function (a) {
var b = Object.assign({
vertex: Ae,
fragment: Be,
geometryClass: ze,
vertexSize: 6
}, a);
var c = b.vertex;
var d = b.fragment;
var e = b.vertexSize;
var f = b.geometryClass;
return function (a) {
function b(b) {
var g = a.call(this, b) || this;
g.shaderGenerator = new ye(c, d);
g.geometryClass = f;
g.vertexSize = e;
return g;
}
wc(b, a);
return b;
}(xe);
};
Object.defineProperty(a, "defaultVertexSrc", {
get: function () {
return Ae;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a, "defaultFragmentTemplate", {
get: function () {
return Be;
},
enumerable: false,
configurable: true
});
return a;
}();
var De = Ce.create();
var Ee = {};
function Fe(a) {
Object.defineProperty(Ee, a, {
get: function () {
db("6.0.0", "PIXI.systems." + a + " has moved to PIXI." + a);
return Lc[a];
}
});
}
for (var Ge in Lc) {
Fe(Ge);
}
var He = {};
function Ie(a) {
Object.defineProperty(He, a, {
get: function () {
db("6.0.0", "PIXI.resources." + a + " has moved to PIXI." + a);
return ne[a];
}
});
}
for (var Ge in ne) {
Ie(Ge);
}
var Je = function () {
function a(b) {
var c = this;
this.stage = new dc();
b = Object.assign({
forceCanvas: false
}, b);
this.renderer = function (a) {
return se.create(a);
}(b);
a._plugins.forEach(function (a) {
a.init.call(c, b);
});
}
a.registerPlugin = function (b) {
a._plugins.push(b);
};
a.prototype.render = function () {
this.renderer.render(this.stage);
};
Object.defineProperty(a.prototype, "view", {
get: function () {
return this.renderer.view;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "screen", {
get: function () {
return this.renderer.screen;
},
enumerable: false,
configurable: true
});
a.prototype.destroy = function (b, c) {
var d = this;
var e = a._plugins.slice(0);
e.reverse();
e.forEach(function (a) {
a.destroy.call(d);
});
this.stage.destroy(c);
this.stage = null;
this.renderer.destroy(b);
this.renderer = null;
};
a._plugins = [];
return a;
}();
var Ke = function () {
function a() {}
a.init = function (a) {
var b = this;
Object.defineProperty(this, "resizeTo", {
set: function (a) {
globalThis.removeEventListener("resize", this.queueResize);
this._resizeTo = a;
if (a) {
globalThis.addEventListener("resize", this.queueResize);
this.resize();
}
},
get: function () {
return this._resizeTo;
}
});
this.queueResize = function () {
if (b._resizeTo) {
b.cancelResize();
b._resizeId = requestAnimationFrame(function () {
return b.resize();
});
}
};
this.cancelResize = function () {
if (b._resizeId) {
cancelAnimationFrame(b._resizeId);
b._resizeId = null;
}
};
this.resize = function () {
if (b._resizeTo) {
var a;
var c;
b.cancelResize();
if (b._resizeTo === globalThis.window) {
a = globalThis.innerWidth;
c = globalThis.innerHeight;
} else {
var d = b._resizeTo;
a = d.clientWidth;
c = d.clientHeight;
}
b.renderer.resize(a, c);
}
};
this._resizeId = null;
this._resizeTo = null;
this.resizeTo = a.resizeTo || null;
};
a.destroy = function () {
globalThis.removeEventListener("resize", this.queueResize);
this.cancelResize();
this.cancelResize = null;
this.queueResize = null;
this.resizeTo = null;
this.resize = null;
};
return a;
}();
Je.registerPlugin(Ke);
var Le = new qb();
var Me = function () {
function a(a) {
this.renderer = a;
}
a.prototype.image = function (a, b, c) {
var d = new Image();
d.src = this.base64(a, b, c);
return d;
};
a.prototype.base64 = function (a, b, c) {
return this.canvas(a).toDataURL(b, c);
};
a.prototype.canvas = function (b) {
var c;
var d;
var e;
var f = this.renderer;
var g = false;
var h = false;
if (b) {
if (b instanceof Tc) {
e = b;
} else {
e = this.renderer.generateTexture(b);
h = true;
}
}
if (e) {
c = e.baseTexture.resolution;
d = e.frame;
g = false;
f.renderTexture.bind(e);
} else {
c = this.renderer.resolution;
g = true;
(d = Le).width = this.renderer.width;
d.height = this.renderer.height;
f.renderTexture.bind(null);
}
var i = Math.floor(d.width * c + 0.0001);
var j = Math.floor(d.height * c + 0.0001);
var k = new ib(i, j, 1);
var l = new Uint8Array(i * 4 * j);
var m = f.gl;
m.readPixels(d.x * c, d.y * c, i, j, m.RGBA, m.UNSIGNED_BYTE, l);
var n = k.context.getImageData(0, 0, i, j);
a.arrayPostDivide(l, n.data);
k.context.putImageData(n, 0, 0);
if (g) {
var o = new ib(k.width, k.height, 1);
o.context.scale(1, -1);
o.context.drawImage(k.canvas, 0, -j);
k.destroy();
k = o;
}
if (h) {
e.destroy(true);
}
return k.canvas;
};
a.prototype.pixels = function (b) {
var c;
var d;
var e;
var f = this.renderer;
var g = false;
if (b) {
if (b instanceof Tc) {
e = b;
} else {
e = this.renderer.generateTexture(b);
g = true;
}
}
if (e) {
c = e.baseTexture.resolution;
d = e.frame;
f.renderTexture.bind(e);
} else {
c = f.resolution;
(d = Le).width = f.width;
d.height = f.height;
f.renderTexture.bind(null);
}
var h = d.width * c;
var i = d.height * c;
var j = new Uint8Array(h * 4 * i);
var k = f.gl;
k.readPixels(d.x * c, d.y * c, h, i, k.RGBA, k.UNSIGNED_BYTE, j);
if (g) {
e.destroy(true);
}
a.arrayPostDivide(j, j);
return j;
};
a.prototype.destroy = function () {
this.renderer = null;
};
a.arrayPostDivide = function (a, b) {
for (var c = 0; c < a.length; c += 4) {
var d = b[c + 3] = a[c + 3];
if (d !== 0) {
b[c] = Math.round(Math.min(a[c] * 255 / d, 255));
b[c + 1] = Math.round(Math.min(a[c + 1] * 255 / d, 255));
b[c + 2] = Math.round(Math.min(a[c + 2] * 255 / d, 255));
} else {
b[c] = a[c];
b[c + 1] = a[c + 1];
b[c + 2] = a[c + 2];
}
}
};
return a;
}();
var Ne = function () {
function a(a, b, c) {
if (b === undefined) {
b = false;
}
this._fn = a;
this._once = b;
this._thisArg = c;
this._next = this._prev = this._owner = null;
}
a.prototype.detach = function () {
return this._owner !== null && (this._owner.detach(this), true);
};
return a;
}();
function Oe(a, b) {
if (a._head) {
a._tail._next = b;
b._prev = a._tail;
a._tail = b;
} else {
a._head = b;
a._tail = b;
}
b._owner = a;
return b;
}
var Pe;
var Qe = function () {
function a() {
this._head = this._tail = undefined;
}
a.prototype.handlers = function (a) {
if (a === undefined) {
a = false;
}
var b = this._head;
if (a) {
return !!b;
}
for (var c = []; b;) {
c.push(b);
b = b._next;
}
return c;
};
a.prototype.has = function (a) {
if (!(a instanceof Ne)) {
throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");
}
return a._owner === this;
};
a.prototype.dispatch = function () {
for (var a = arguments, b = [], c = 0; c < arguments.length; c++) {
b[c] = a[c];
}
var d = this._head;
if (!d) {
return false;
}
while (d) {
if (d._once) {
this.detach(d);
}
d._fn.apply(d._thisArg, b);
d = d._next;
}
return true;
};
a.prototype.add = function (a, b) {
if (b === undefined) {
b = null;
}
if (typeof a != "function") {
throw new Error("MiniSignal#add(): First arg must be a Function.");
}
return Oe(this, new Ne(a, false, b));
};
a.prototype.once = function (a, b) {
if (b === undefined) {
b = null;
}
if (typeof a != "function") {
throw new Error("MiniSignal#once(): First arg must be a Function.");
}
return Oe(this, new Ne(a, true, b));
};
a.prototype.detach = function (a) {
if (!(a instanceof Ne)) {
throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");
}
if (a._owner === this) {
if (a._prev) {
a._prev._next = a._next;
}
if (a._next) {
a._next._prev = a._prev;
}
if (a === this._head) {
this._head = a._next;
if (a._next === null) {
this._tail = null;
}
} else if (a === this._tail) {
this._tail = a._prev;
this._tail._next = null;
}
a._owner = null;
}
return this;
};
a.prototype.detachAll = function () {
var a = this._head;
if (!a) {
return this;
}
for (this._head = this._tail = null; a;) {
a._owner = null;
a = a._next;
}
return this;
};
return a;
}();
function Re(a, b) {
b = b || {};
for (var c = {
key: ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"],
q: {
name: "queryKey",
parser: /(?:^|&)([^&=]*)=?([^&]*)/g
},
parser: {
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
}
}, d = c.parser[b.strictMode ? "strict" : "loose"].exec(a), e = {}, f = 14; f--;) {
e[c.key[f]] = d[f] || "";
}
e[c.q.name] = {};
e[c.key[12]].replace(c.q.parser, function (a, b, d) {
if (b) {
e[c.q.name][b] = d;
}
});
return e;
}
var Se = null;
function Te() {}
function Ue(a, b, c) {
if (b && b.indexOf(".") === 0) {
b = b.substring(1);
}
if (b) {
a[b] = c;
}
}
function Ve(a) {
return a.toString().replace("object ", "");
}
var We = function () {
function a(b, c, d) {
this._dequeue = Te;
this._onLoadBinding = null;
this._elementTimer = 0;
this._boundComplete = null;
this._boundOnError = null;
this._boundOnProgress = null;
this._boundOnTimeout = null;
this._boundXhrOnError = null;
this._boundXhrOnTimeout = null;
this._boundXhrOnAbort = null;
this._boundXhrOnLoad = null;
if (typeof b != "string" || typeof c != "string") {
throw new Error("Both name and url are required for constructing a resource.");
}
d = d || {};
this._flags = 0;
this._setFlag(a.STATUS_FLAGS.DATA_URL, c.indexOf("data:") === 0);
this.name = b;
this.url = c;
this.extension = this._getExtension();
this.data = null;
this.crossOrigin = d.crossOrigin === true ? "anonymous" : d.crossOrigin;
this.timeout = d.timeout || 0;
this.loadType = d.loadType || this._determineLoadType();
this.xhrType = d.xhrType;
this.metadata = d.metadata || {};
this.error = null;
this.xhr = null;
this.children = [];
this.type = a.TYPE.UNKNOWN;
this.progressChunk = 0;
this._dequeue = Te;
this._onLoadBinding = null;
this._elementTimer = 0;
this._boundComplete = this.complete.bind(this);
this._boundOnError = this._onError.bind(this);
this._boundOnProgress = this._onProgress.bind(this);
this._boundOnTimeout = this._onTimeout.bind(this);
this._boundXhrOnError = this._xhrOnError.bind(this);
this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);
this._boundXhrOnAbort = this._xhrOnAbort.bind(this);
this._boundXhrOnLoad = this._xhrOnLoad.bind(this);
this.onStart = new Qe();
this.onProgress = new Qe();
this.onComplete = new Qe();
this.onAfterMiddleware = new Qe();
}
a.setExtensionLoadType = function (b, c) {
Ue(a._loadTypeMap, b, c);
};
a.setExtensionXhrType = function (b, c) {
Ue(a._xhrTypeMap, b, c);
};
Object.defineProperty(a.prototype, "isDataUrl", {
get: function () {
return this._hasFlag(a.STATUS_FLAGS.DATA_URL);
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "isComplete", {
get: function () {
return this._hasFlag(a.STATUS_FLAGS.COMPLETE);
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "isLoading", {
get: function () {
return this._hasFlag(a.STATUS_FLAGS.LOADING);
},
enumerable: false,
configurable: true
});
a.prototype.complete = function () {
this._clearEvents();
this._finish();
};
a.prototype.abort = function (b) {
if (!this.error) {
this.error = new Error(b);
this._clearEvents();
if (this.xhr) {
this.xhr.abort();
} else if (this.xdr) {
this.xdr.abort();
} else if (this.data) {
if (this.data.src) {
this.data.src = a.EMPTY_GIF;
} else {
while (this.data.firstChild) {
this.data.removeChild(this.data.firstChild);
}
}
}
this._finish();
}
};
a.prototype.load = function (b) {
var c = this;
if (!this.isLoading) {
if (this.isComplete) {
if (b) {
setTimeout(function () {
return b(c);
}, 1);
}
} else {
if (b) {
this.onComplete.once(b);
}
this._setFlag(a.STATUS_FLAGS.LOADING, true);
this.onStart.dispatch(this);
if (this.crossOrigin === false || typeof this.crossOrigin != "string") {
this.crossOrigin = this._determineCrossOrigin(this.url);
}
switch (this.loadType) {
case a.LOAD_TYPE.IMAGE:
this.type = a.TYPE.IMAGE;
this._loadElement("image");
break;
case a.LOAD_TYPE.AUDIO:
this.type = a.TYPE.AUDIO;
this._loadSourceElement("audio");
break;
case a.LOAD_TYPE.VIDEO:
this.type = a.TYPE.VIDEO;
this._loadSourceElement("video");
break;
case a.LOAD_TYPE.XHR:
default:
if (Pe === undefined) {
Pe = !!globalThis.XDomainRequest && !("withCredentials" in new XMLHttpRequest());
}
if (Pe && this.crossOrigin) {
this._loadXdr();
} else {
this._loadXhr();
}
}
}
}
};
a.prototype._hasFlag = function (a) {
return (this._flags & a) != 0;
};
a.prototype._setFlag = function (a, b) {
this._flags = b ? this._flags | a : this._flags & ~a;
};
a.prototype._clearEvents = function () {
clearTimeout(this._elementTimer);
if (this.data && this.data.removeEventListener) {
this.data.removeEventListener("error", this._boundOnError, false);
this.data.removeEventListener("load", this._boundComplete, false);
this.data.removeEventListener("progress", this._boundOnProgress, false);
this.data.removeEventListener("canplaythrough", this._boundComplete, false);
}
if (this.xhr) {
if (this.xhr.removeEventListener) {
this.xhr.removeEventListener("error", this._boundXhrOnError, false);
this.xhr.removeEventListener("timeout", this._boundXhrOnTimeout, false);
this.xhr.removeEventListener("abort", this._boundXhrOnAbort, false);
this.xhr.removeEventListener("progress", this._boundOnProgress, false);
this.xhr.removeEventListener("load", this._boundXhrOnLoad, false);
} else {
this.xhr.onerror = null;
this.xhr.ontimeout = null;
this.xhr.onprogress = null;
this.xhr.onload = null;
}
}
};
a.prototype._finish = function () {
if (this.isComplete) {
throw new Error("Complete called again for an already completed resource.");
}
this._setFlag(a.STATUS_FLAGS.COMPLETE, true);
this._setFlag(a.STATUS_FLAGS.LOADING, false);
this.onComplete.dispatch(this);
};
a.prototype._loadElement = function (a) {
if (this.metadata.loadElement) {
this.data = this.metadata.loadElement;
} else if (a === "image" && globalThis.Image !== undefined) {
this.data = new Image();
} else {
this.data = document.createElement(a);
}
if (this.crossOrigin) {
this.data.crossOrigin = this.crossOrigin;
}
if (!this.metadata.skipSource) {
this.data.src = this.url;
}
this.data.addEventListener("error", this._boundOnError, false);
this.data.addEventListener("load", this._boundComplete, false);
this.data.addEventListener("progress", this._boundOnProgress, false);
if (this.timeout) {
this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);
}
};
a.prototype._loadSourceElement = function (a) {
if (this.metadata.loadElement) {
this.data = this.metadata.loadElement;
} else if (a === "audio" && globalThis.Audio !== undefined) {
this.data = new Audio();
} else {
this.data = document.createElement(a);
}
if (this.data !== null) {
if (this.crossOrigin) {
this.data.crossOrigin = this.crossOrigin;
}
if (!this.metadata.skipSource) {
if (navigator.isCocoonJS) {
this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;
} else if (Array.isArray(this.url)) {
for (var b = this.metadata.mimeType, c = 0; c < this.url.length; ++c) {
this.data.appendChild(this._createSource(a, this.url[c], Array.isArray(b) ? b[c] : b));
}
} else {
b = this.metadata.mimeType;
this.data.appendChild(this._createSource(a, this.url, Array.isArray(b) ? b[0] : b));
}
}
this.data.addEventListener("error", this._boundOnError, false);
this.data.addEventListener("load", this._boundComplete, false);
this.data.addEventListener("progress", this._boundOnProgress, false);
this.data.addEventListener("canplaythrough", this._boundComplete, false);
this.data.load();
if (this.timeout) {
this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);
}
} else {
this.abort("Unsupported element: " + a);
}
};
a.prototype._loadXhr = function () {
if (typeof this.xhrType != "string") {
this.xhrType = this._determineXhrType();
}
var b = this.xhr = new XMLHttpRequest();
if (this.crossOrigin === "use-credentials") {
b.withCredentials = true;
}
b.open("GET", this.url, true);
b.timeout = this.timeout;
if (this.xhrType === a.XHR_RESPONSE_TYPE.JSON || this.xhrType === a.XHR_RESPONSE_TYPE.DOCUMENT) {
b.responseType = a.XHR_RESPONSE_TYPE.TEXT;
} else {
b.responseType = this.xhrType;
}
b.addEventListener("error", this._boundXhrOnError, false);
b.addEventListener("timeout", this._boundXhrOnTimeout, false);
b.addEventListener("abort", this._boundXhrOnAbort, false);
b.addEventListener("progress", this._boundOnProgress, false);
b.addEventListener("load", this._boundXhrOnLoad, false);
b.send();
};
a.prototype._loadXdr = function () {
if (typeof this.xhrType != "string") {
this.xhrType = this._determineXhrType();
}
var a = this.xhr = new globalThis.XDomainRequest();
a.timeout = this.timeout || 5000;
a.onerror = this._boundXhrOnError;
a.ontimeout = this._boundXhrOnTimeout;
a.onprogress = this._boundOnProgress;
a.onload = this._boundXhrOnLoad;
a.open("GET", this.url, true);
setTimeout(function () {
return a.send();
}, 1);
};
a.prototype._createSource = function (a, b, c) {
c ||= a + "/" + this._getExtension(b);
var d = document.createElement("source");
d.src = b;
d.type = c;
return d;
};
a.prototype._onError = function (a) {
this.abort("Failed to load element using: " + a.target.nodeName);
};
a.prototype._onProgress = function (a) {
if (a && a.lengthComputable) {
this.onProgress.dispatch(this, a.loaded / a.total);
}
};
a.prototype._onTimeout = function () {
this.abort("Load timed out.");
};
a.prototype._xhrOnError = function () {
var a = this.xhr;
this.abort(Ve(a) + " Request failed. Status: " + a.status + ", text: \"" + a.statusText + "\"");
};
a.prototype._xhrOnTimeout = function () {
var a = this.xhr;
this.abort(Ve(a) + " Request timed out.");
};
a.prototype._xhrOnAbort = function () {
var a = this.xhr;
this.abort(Ve(a) + " Request was aborted by the user.");
};
a.prototype._xhrOnLoad = function () {
var b = this.xhr;
var c = "";
var d = b.status === undefined ? 200 : b.status;
if (b.responseType === "" || b.responseType === "text" || b.responseType === undefined) {
c = b.responseText;
}
if (d === 0 && (c.length > 0 || b.responseType === a.XHR_RESPONSE_TYPE.BUFFER)) {
d = 200;
} else if (d === 1223) {
d = 204;
}
if ((d / 100 | 0) == 2) {
if (this.xhrType === a.XHR_RESPONSE_TYPE.TEXT) {
this.data = c;
this.type = a.TYPE.TEXT;
} else if (this.xhrType === a.XHR_RESPONSE_TYPE.JSON) {
try {
this.data = JSON.parse(c);
this.type = a.TYPE.JSON;
} catch (a) {
this.abort("Error trying to parse loaded json: " + a);
return;
}
} else if (this.xhrType === a.XHR_RESPONSE_TYPE.DOCUMENT) {
try {
if (globalThis.DOMParser) {
var e = new DOMParser();
this.data = e.parseFromString(c, "text/xml");
} else {
var f = document.createElement("div");
f.innerHTML = c;
this.data = f;
}
this.type = a.TYPE.XML;
} catch (a) {
this.abort("Error trying to parse loaded xml: " + a);
return;
}
} else {
this.data = b.response || c;
}
this.complete();
} else {
this.abort("[" + b.status + "] " + b.statusText + ": " + b.responseURL);
}
};
a.prototype._determineCrossOrigin = function (a, b) {
if (a.indexOf("data:") === 0) {
return "";
}
if (globalThis.origin !== globalThis.location.origin) {
return "anonymous";
}
b = b || globalThis.location;
Se ||= document.createElement("a");
Se.href = a;
var c = Re(Se.href, {
strictMode: true
});
var d = !c.port && b.port === "" || c.port === b.port;
var e = c.protocol ? c.protocol + ":" : "";
if (c.host === b.hostname && d && e === b.protocol) {
return "";
} else {
return "anonymous";
}
};
a.prototype._determineXhrType = function () {
return a._xhrTypeMap[this.extension] || a.XHR_RESPONSE_TYPE.TEXT;
};
a.prototype._determineLoadType = function () {
return a._loadTypeMap[this.extension] || a.LOAD_TYPE.XHR;
};
a.prototype._getExtension = function (a) {
if (a === undefined) {
a = this.url;
}
var b = "";
if (this.isDataUrl) {
var c = a.indexOf("/");
b = a.substring(c + 1, a.indexOf(";", c));
} else {
var d = a.indexOf("?");
var e = a.indexOf("#");
var f = Math.min(d > -1 ? d : a.length, e > -1 ? e : a.length);
b = (a = a.substring(0, f)).substring(a.lastIndexOf(".") + 1);
}
return b.toLowerCase();
};
a.prototype._getMimeFromXhrType = function (b) {
switch (b) {
case a.XHR_RESPONSE_TYPE.BUFFER:
return "application/octet-binary";
case a.XHR_RESPONSE_TYPE.BLOB:
return "application/blob";
case a.XHR_RESPONSE_TYPE.DOCUMENT:
return "application/xml";
case a.XHR_RESPONSE_TYPE.JSON:
return "application/json";
case a.XHR_RESPONSE_TYPE.DEFAULT:
case a.XHR_RESPONSE_TYPE.TEXT:
default:
return "text/plain";
}
};
return a;
}();
function Xe() {}
function Ye(a) {
return function () {
for (var b = arguments, c = [], d = 0; d < arguments.length; d++) {
c[d] = b[d];
}
if (a === null) {
throw new Error("Callback was already called.");
}
var e = a;
a = null;
e.apply(this, c);
};
}
(function (a) {
var b;
var c;
var d;
var e;
(b = a.STATUS_FLAGS ||= {})[b.NONE = 0] = "NONE";
b[b.DATA_URL = 1] = "DATA_URL";
b[b.COMPLETE = 2] = "COMPLETE";
b[b.LOADING = 4] = "LOADING";
(c = a.TYPE ||= {})[c.UNKNOWN = 0] = "UNKNOWN";
c[c.JSON = 1] = "JSON";
c[c.XML = 2] = "XML";
c[c.IMAGE = 3] = "IMAGE";
c[c.AUDIO = 4] = "AUDIO";
c[c.VIDEO = 5] = "VIDEO";
c[c.TEXT = 6] = "TEXT";
(d = a.LOAD_TYPE ||= {})[d.XHR = 1] = "XHR";
d[d.IMAGE = 2] = "IMAGE";
d[d.AUDIO = 3] = "AUDIO";
d[d.VIDEO = 4] = "VIDEO";
(e = a.XHR_RESPONSE_TYPE ||= {}).DEFAULT = "text";
e.BUFFER = "arraybuffer";
e.BLOB = "blob";
e.DOCUMENT = "document";
e.JSON = "json";
e.TEXT = "text";
a._loadTypeMap = {
gif: a.LOAD_TYPE.IMAGE,
png: a.LOAD_TYPE.IMAGE,
bmp: a.LOAD_TYPE.IMAGE,
jpg: a.LOAD_TYPE.IMAGE,
jpeg: a.LOAD_TYPE.IMAGE,
tif: a.LOAD_TYPE.IMAGE,
tiff: a.LOAD_TYPE.IMAGE,
webp: a.LOAD_TYPE.IMAGE,
tga: a.LOAD_TYPE.IMAGE,
svg: a.LOAD_TYPE.IMAGE,
"svg+xml": a.LOAD_TYPE.IMAGE,
mp3: a.LOAD_TYPE.AUDIO,
ogg: a.LOAD_TYPE.AUDIO,
wav: a.LOAD_TYPE.AUDIO,
mp4: a.LOAD_TYPE.VIDEO,
webm: a.LOAD_TYPE.VIDEO
};
a._xhrTypeMap = {
xhtml: a.XHR_RESPONSE_TYPE.DOCUMENT,
html: a.XHR_RESPONSE_TYPE.DOCUMENT,
htm: a.XHR_RESPONSE_TYPE.DOCUMENT,
xml: a.XHR_RESPONSE_TYPE.DOCUMENT,
tmx: a.XHR_RESPONSE_TYPE.DOCUMENT,
svg: a.XHR_RESPONSE_TYPE.DOCUMENT,
tsx: a.XHR_RESPONSE_TYPE.DOCUMENT,
gif: a.XHR_RESPONSE_TYPE.BLOB,
png: a.XHR_RESPONSE_TYPE.BLOB,
bmp: a.XHR_RESPONSE_TYPE.BLOB,
jpg: a.XHR_RESPONSE_TYPE.BLOB,
jpeg: a.XHR_RESPONSE_TYPE.BLOB,
tif: a.XHR_RESPONSE_TYPE.BLOB,
tiff: a.XHR_RESPONSE_TYPE.BLOB,
webp: a.XHR_RESPONSE_TYPE.BLOB,
tga: a.XHR_RESPONSE_TYPE.BLOB,
json: a.XHR_RESPONSE_TYPE.JSON,
text: a.XHR_RESPONSE_TYPE.TEXT,
txt: a.XHR_RESPONSE_TYPE.TEXT,
ttf: a.XHR_RESPONSE_TYPE.BUFFER,
otf: a.XHR_RESPONSE_TYPE.BUFFER
};
a.EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
})(We ||= {});
function Ze(a, b) {
this.data = a;
this.callback = b;
}
var $e = function () {
function a(a, b) {
var c = this;
if (b === undefined) {
b = 1;
}
this.workers = 0;
this.saturated = Xe;
this.unsaturated = Xe;
this.empty = Xe;
this.drain = Xe;
this.error = Xe;
this.started = false;
this.paused = false;
this._tasks = [];
this._insert = function (a, b, d) {
if (d && typeof d != "function") {
throw new Error("task callback must be a function");
}
c.started = true;
if (a == null && c.idle()) {
setTimeout(function () {
return c.drain();
}, 1);
} else {
var e = new Ze(a, typeof d == "function" ? d : Xe);
if (b) {
c._tasks.unshift(e);
} else {
c._tasks.push(e);
}
setTimeout(c.process, 1);
}
};
this.process = function () {
while (!c.paused && c.workers < c.concurrency && c._tasks.length) {
var a = c._tasks.shift();
if (c._tasks.length === 0) {
c.empty();
}
c.workers += 1;
if (c.workers === c.concurrency) {
c.saturated();
}
c._worker(a.data, Ye(c._next(a)));
}
};
this._worker = a;
if (b === 0) {
throw new Error("Concurrency must not be zero");
}
this.concurrency = b;
this.buffer = b / 4;
}
a.prototype._next = function (a) {
var b = this;
return function () {
for (var c = arguments, d = [], e = 0; e < arguments.length; e++) {
d[e] = c[e];
}
b.workers -= 1;
a.callback.apply(a, d);
if (d[0] != null) {
b.error(d[0], a.data);
}
if (b.workers <= b.concurrency - b.buffer) {
b.unsaturated();
}
if (b.idle()) {
b.drain();
}
b.process();
};
};
a.prototype.push = function (a, b) {
this._insert(a, false, b);
};
a.prototype.kill = function () {
this.workers = 0;
this.drain = Xe;
this.started = false;
this._tasks = [];
};
a.prototype.unshift = function (a, b) {
this._insert(a, true, b);
};
a.prototype.length = function () {
return this._tasks.length;
};
a.prototype.running = function () {
return this.workers;
};
a.prototype.idle = function () {
return this._tasks.length + this.workers === 0;
};
a.prototype.pause = function () {
if (this.paused !== true) {
this.paused = true;
}
};
a.prototype.resume = function () {
if (this.paused !== false) {
this.paused = false;
for (var a = 1; a <= this.concurrency; a++) {
this.process();
}
}
};
a.eachSeries = function (a, b, c, d) {
var e = 0;
var f = a.length;
(function h(g) {
if (g || e === f) {
if (c) {
c(g);
}
} else if (d) {
setTimeout(function () {
b(a[e++], h);
}, 1);
} else {
b(a[e++], h);
}
})();
};
a.queue = function (b, c) {
return new a(b, c);
};
return a;
}();
var _e = /(#[\w-]+)?$/;
var af = function () {
function a(b, c) {
var d = this;
if (b === undefined) {
b = "";
}
if (c === undefined) {
c = 10;
}
this.progress = 0;
this.loading = false;
this.defaultQueryString = "";
this._beforeMiddleware = [];
this._afterMiddleware = [];
this._resourcesParsing = [];
this._boundLoadResource = function (a, b) {
return d._loadResource(a, b);
};
this.resources = {};
this.baseUrl = b;
this._beforeMiddleware = [];
this._afterMiddleware = [];
this._resourcesParsing = [];
this._boundLoadResource = function (a, b) {
return d._loadResource(a, b);
};
this._queue = $e.queue(this._boundLoadResource, c);
this._queue.pause();
this.resources = {};
this.onProgress = new Qe();
this.onError = new Qe();
this.onLoad = new Qe();
this.onStart = new Qe();
this.onComplete = new Qe();
for (var e = 0; e < a._plugins.length; ++e) {
var f = a._plugins[e];
var g = f.pre;
var h = f.use;
if (g) {
this.pre(g);
}
if (h) {
this.use(h);
}
}
this._protected = false;
}
a.prototype._add = function (a, b, c, d) {
if (this.loading && (!c || !c.parentResource)) {
throw new Error("Cannot add resources while the loader is running.");
}
if (this.resources[a]) {
throw new Error("Resource named \"" + a + "\" already exists.");
}
b = this._prepareUrl(b);
this.resources[a] = new We(a, b, c);
if (typeof d == "function") {
this.resources[a].onAfterMiddleware.once(d);
}
if (this.loading) {
for (var e = c.parentResource, f = [], g = 0; g < e.children.length; ++g) {
if (!e.children[g].isComplete) {
f.push(e.children[g]);
}
}
var h = e.progressChunk * (f.length + 1) / (f.length + 2);
e.children.push(this.resources[a]);
e.progressChunk = h;
g = 0;
for (; g < f.length; ++g) {
f[g].progressChunk = h;
}
this.resources[a].progressChunk = h;
}
this._queue.push(this.resources[a]);
return this;
};
a.prototype.pre = function (a) {
this._beforeMiddleware.push(a);
return this;
};
a.prototype.use = function (a) {
this._afterMiddleware.push(a);
return this;
};
a.prototype.reset = function () {
this.progress = 0;
this.loading = false;
this._queue.kill();
this._queue.pause();
for (var a in this.resources) {
var b = this.resources[a];
if (b._onLoadBinding) {
b._onLoadBinding.detach();
}
if (b.isLoading) {
b.abort("loader reset");
}
}
this.resources = {};
return this;
};
a.prototype.load = function (a) {
if (typeof a == "function") {
this.onComplete.once(a);
}
if (this.loading) {
return this;
}
if (this._queue.idle()) {
this._onStart();
this._onComplete();
} else {
for (var b = 100 / this._queue._tasks.length, c = 0; c < this._queue._tasks.length; ++c) {
this._queue._tasks[c].data.progressChunk = b;
}
this._onStart();
this._queue.resume();
}
return this;
};
Object.defineProperty(a.prototype, "concurrency", {
get: function () {
return this._queue.concurrency;
},
set: function (a) {
this._queue.concurrency = a;
},
enumerable: false,
configurable: true
});
a.prototype._prepareUrl = function (a) {
var b;
var c = Re(a, {
strictMode: true
});
b = c.protocol || !c.path || a.indexOf("//") === 0 ? a : this.baseUrl.length && this.baseUrl.lastIndexOf("/") !== this.baseUrl.length - 1 && a.charAt(0) !== "/" ? this.baseUrl + "/" + a : this.baseUrl + a;
if (this.defaultQueryString) {
var d = _e.exec(b)[0];
if ((b = b.slice(0, b.length - d.length)).indexOf("?") !== -1) {
b += "&" + this.defaultQueryString;
} else {
b += "?" + this.defaultQueryString;
}
b += d;
}
return b;
};
a.prototype._loadResource = function (a, b) {
var c = this;
a._dequeue = b;
$e.eachSeries(this._beforeMiddleware, function (b, d) {
b.call(c, a, function () {
d(a.isComplete ? {} : null);
});
}, function () {
if (a.isComplete) {
c._onLoad(a);
} else {
a._onLoadBinding = a.onComplete.once(c._onLoad, c);
a.load();
}
}, true);
};
a.prototype._onStart = function () {
this.progress = 0;
this.loading = true;
this.onStart.dispatch(this);
};
a.prototype._onComplete = function () {
this.progress = 100;
this.loading = false;
this.onComplete.dispatch(this, this.resources);
};
a.prototype._onLoad = function (a) {
var b = this;
a._onLoadBinding = null;
this._resourcesParsing.push(a);
a._dequeue();
$e.eachSeries(this._afterMiddleware, function (c, d) {
c.call(b, a, d);
}, function () {
a.onAfterMiddleware.dispatch(a);
b.progress = Math.min(100, b.progress + a.progressChunk);
b.onProgress.dispatch(b, a);
if (a.error) {
b.onError.dispatch(a.error, b, a);
} else {
b.onLoad.dispatch(b, a);
}
b._resourcesParsing.splice(b._resourcesParsing.indexOf(a), 1);
if (b._queue.idle() && b._resourcesParsing.length === 0) {
b._onComplete();
}
}, true);
};
a.prototype.destroy = function () {
if (!this._protected) {
this.reset();
}
};
Object.defineProperty(a, "shared", {
get: function () {
var b = a._shared;
if (!b) {
(b = new a())._protected = true;
a._shared = b;
}
return b;
},
enumerable: false,
configurable: true
});
a.registerPlugin = function (b) {
a._plugins.push(b);
if (b.add) {
b.add();
}
return a;
};
a._plugins = [];
return a;
}();
af.prototype.add = function (a, b, c, d) {
if (Array.isArray(a)) {
for (var e = 0; e < a.length; ++e) {
this.add(a[e]);
}
return this;
}
if (typeof a == "object") {
c = a;
d = b || c.callback || c.onComplete;
b = c.url;
a = c.name || c.key || c.url;
}
if (typeof b != "string") {
d = c;
c = b;
b = a;
}
if (typeof b != "string") {
throw new Error("No url passed to add resource to loader.");
}
if (typeof c == "function") {
d = c;
c = null;
}
return this._add(a, b, c, d);
};
var bf;
var cf;
var df = function () {
function a() {}
a.init = function (a) {
a = Object.assign({
sharedLoader: false
}, a);
this.loader = a.sharedLoader ? af.shared : new af();
};
a.destroy = function () {
if (this.loader) {
this.loader.destroy();
this.loader = null;
}
};
return a;
}();
var ef = function () {
function a() {}
a.add = function () {
We.setExtensionLoadType("svg", We.LOAD_TYPE.XHR);
We.setExtensionXhrType("svg", We.XHR_RESPONSE_TYPE.TEXT);
};
a.use = function (a, b) {
if (!a.data || a.type !== We.TYPE.IMAGE && a.extension !== "svg") {
b();
} else {
var c = a.data;
var d = a.url;
var e = a.name;
var f = a.metadata;
Sc.fromLoader(c, d, e, f).then(function (c) {
a.texture = c;
b();
}).catch(b);
}
};
return a;
}();
af.registerPlugin({
use: function (a, b) {
if (a.data) {
if (a.xhr && a.xhrType === We.XHR_RESPONSE_TYPE.BLOB) {
if (self.Blob && typeof a.data != "string") {
if (a.data.type.indexOf("image") === 0) {
var c = globalThis.URL || globalThis.webkitURL;
var d = c.createObjectURL(a.data);
a.blob = a.data;
a.data = new Image();
a.data.src = d;
a.type = We.TYPE.IMAGE;
a.data.onload = function () {
c.revokeObjectURL(d);
a.data.onload = null;
b();
};
return;
}
} else {
var e = a.xhr.getResponseHeader("content-type");
if (e && e.indexOf("image") === 0) {
a.data = new Image();
a.data.src = "data:" + e + ";base64," + function (a) {
for (var b = "", c = 0; c < a.length;) {
for (var d = [0, 0, 0], e = [0, 0, 0, 0], f = 0; f < d.length; ++f) {
if (c < a.length) {
d[f] = a.charCodeAt(c++) & 255;
} else {
d[f] = 0;
}
}
e[0] = d[0] >> 2;
e[1] = (d[0] & 3) << 4 | d[1] >> 4;
e[2] = (d[1] & 15) << 2 | d[2] >> 6;
e[3] = d[2] & 63;
switch (c - (a.length - 1)) {
case 2:
e[3] = 64;
e[2] = 64;
break;
case 1:
e[3] = 64;
}
for (f = 0; f < e.length; ++f) {
b += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e[f]);
}
}
return b;
}(a.xhr.responseText);
a.type = We.TYPE.IMAGE;
a.data.onload = function () {
a.data.onload = null;
b();
};
return;
}
}
}
b();
} else {
b();
}
}
});
af.registerPlugin(ef);
(function (a) {
a[a.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT";
a[a.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT";
a[a.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT";
a[a.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT";
a[a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT";
a[a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT";
a[a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT";
a[a.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT";
a[a.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC";
a[a.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC";
a[a.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC";
a[a.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC";
a[a.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2";
a[a.COMPRESSED_RGBA8_ETC2_EAC = 37496] = "COMPRESSED_RGBA8_ETC2_EAC";
a[a.COMPRESSED_SRGB8_ETC2 = 37493] = "COMPRESSED_SRGB8_ETC2";
a[a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC";
a[a.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2";
a[a.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2";
a[a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG";
a[a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG";
a[a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG";
a[a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG";
a[a.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL";
a[a.COMPRESSED_RGB_ATC_WEBGL = 35986] = "COMPRESSED_RGB_ATC_WEBGL";
a[a.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35986] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL";
a[a.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL";
})(cf ||= {});
(bf = {})[cf.COMPRESSED_RGB_S3TC_DXT1_EXT] = 0.5;
bf[cf.COMPRESSED_RGBA_S3TC_DXT1_EXT] = 0.5;
bf[cf.COMPRESSED_RGBA_S3TC_DXT3_EXT] = 1;
bf[cf.COMPRESSED_RGBA_S3TC_DXT5_EXT] = 1;
bf[cf.COMPRESSED_SRGB_S3TC_DXT1_EXT] = 0.5;
bf[cf.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT] = 0.5;
bf[cf.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT] = 1;
bf[cf.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT] = 1;
bf[cf.COMPRESSED_R11_EAC] = 0.5;
bf[cf.COMPRESSED_SIGNED_R11_EAC] = 0.5;
bf[cf.COMPRESSED_RG11_EAC] = 1;
bf[cf.COMPRESSED_SIGNED_RG11_EAC] = 1;
bf[cf.COMPRESSED_RGB8_ETC2] = 0.5;
bf[cf.COMPRESSED_RGBA8_ETC2_EAC] = 1;
bf[cf.COMPRESSED_SRGB8_ETC2] = 0.5;
bf[cf.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC] = 1;
bf[cf.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2] = 0.5;
bf[cf.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2] = 0.5;
bf[cf.COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = 0.5;
bf[cf.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = 0.5;
bf[cf.COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = 0.25;
bf[cf.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = 0.25;
bf[cf.COMPRESSED_RGB_ETC1_WEBGL] = 0.5;
bf[cf.COMPRESSED_RGB_ATC_WEBGL] = 0.5;
bf[cf.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL] = 1;
bf[cf.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL] = 1;
var ff = bf;
function gf(a, b) {
gf = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return gf(a, b);
}
function hf(a, b) {
function c() {
this.constructor = a;
}
gf(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
}
var jf;
var kf;
var lf = function (a) {
function b(b, c) {
if (c === undefined) {
c = {
width: 1,
height: 1,
autoLoad: true
};
}
var d;
var e;
var f = this;
if (typeof b == "string") {
d = b;
e = new Uint8Array();
} else {
d = null;
e = b;
}
(f = a.call(this, e, c) || this).origin = d;
f.buffer = e ? new we(e) : null;
if (f.origin && c.autoLoad !== false) {
f.load();
}
if (e && e.length) {
f.loaded = true;
f.onBlobLoaded(f.buffer.rawBinaryData);
}
return f;
}
hf(b, a);
b.prototype.onBlobLoaded = function (a) {};
b.prototype.load = function () {
a = this;
undefined;
c = function () {
var a;
return function (a, b) {
var c;
var d;
var e;
var f;
var g = {
label: 0,
sent: function () {
if (e[0] & 1) {
throw e[1];
}
return e[1];
},
trys: [],
ops: []
};
f = {
next: h(0),
throw: h(1),
return: h(2)
};
if (typeof Symbol == "function") {
f[Symbol.iterator] = function () {
return this;
};
}
return f;
function h(f) {
return function (h) {
return function (f) {
if (c) {
throw new TypeError("Generator is already executing.");
}
while (g) {
try {
c = 1;
if (d && (e = f[0] & 2 ? d.return : f[0] ? d.throw || ((e = d.return) && e.call(d), 0) : d.next) && !(e = e.call(d, f[1])).done) {
return e;
}
d = 0;
if (e) {
f = [f[0] & 2, e.value];
}
switch (f[0]) {
case 0:
case 1:
e = f;
break;
case 4:
g.label++;
return {
value: f[1],
done: false
};
case 5:
g.label++;
d = f[1];
f = [0];
continue;
case 7:
f = g.ops.pop();
g.trys.pop();
continue;
default:
if (!(e = (e = g.trys).length > 0 && e[e.length - 1]) && (f[0] === 6 || f[0] === 2)) {
g = 0;
continue;
}
if (f[0] === 3 && (!e || f[1] > e[0] && f[1] < e[3])) {
g.label = f[1];
break;
}
if (f[0] === 6 && g.label < e[1]) {
g.label = e[1];
e = f;
break;
}
if (e && g.label < e[2]) {
g.label = e[2];
g.ops.push(f);
break;
}
if (e[2]) {
g.ops.pop();
}
g.trys.pop();
continue;
}
f = b.call(a, g);
} catch (a) {
f = [6, a];
d = 0;
} finally {
c = e = 0;
}
}
if (f[0] & 5) {
throw f[1];
}
return {
value: f[0] ? f[1] : undefined,
done: true
};
}([f, h]);
};
}
}(this, function (b) {
switch (b.label) {
case 0:
return [4, fetch(this.origin)];
case 1:
return [4, b.sent().blob()];
case 2:
return [4, b.sent().arrayBuffer()];
case 3:
a = b.sent();
this.data = new Uint32Array(a);
this.buffer = new we(a);
this.loaded = true;
this.onBlobLoaded(a);
this.update();
return [2, this];
}
});
};
return new((b = Promise) || (b = Promise))(function (d, e) {
function f(a) {
try {
h(c.next(a));
} catch (a) {
e(a);
}
}
function g(a) {
try {
h(c.throw(a));
} catch (a) {
e(a);
}
}
function h(a) {
if (a.done) {
d(a.value);
} else {
new b(function (b) {
b(a.value);
}).then(f, g);
}
}
h((c = c.apply(a, [])).next());
});
var a;
var b;
var c;
};
return b;
}(zc);
var mf = function (a) {
function b(c, d) {
var e = a.call(this, c, d) || this;
e.format = d.format;
e.levels = d.levels || 1;
e._width = d.width;
e._height = d.height;
e._extension = b._formatToExtension(e.format);
if (d.levelBuffers || e.buffer) {
e._levelBuffers = d.levelBuffers || b._createLevelBuffers(c instanceof Uint8Array ? c : e.buffer.uint8View, e.format, e.levels, 4, 4, e.width, e.height);
}
return e;
}
hf(b, a);
b.prototype.upload = function (a, b, c) {
var d = a.gl;
if (!a.context.extensions[this._extension]) {
throw new Error(this._extension + " textures are not supported on the current machine");
}
if (!this._levelBuffers) {
return false;
}
for (var e = 0, f = this.levels; e < f; e++) {
var g = this._levelBuffers[e];
var h = g.levelID;
var i = g.levelWidth;
var j = g.levelHeight;
var k = g.levelBuffer;
d.compressedTexImage2D(d.TEXTURE_2D, h, this.format, i, j, 0, k);
}
return true;
};
b.prototype.onBlobLoaded = function () {
this._levelBuffers = b._createLevelBuffers(this.buffer.uint8View, this.format, this.levels, 4, 4, this.width, this.height);
};
b._formatToExtension = function (a) {
if (a >= 33776 && a <= 33779) {
return "s3tc";
}
if (a >= 37488 && a <= 37497) {
return "etc";
}
if (a >= 35840 && a <= 35843) {
return "pvrtc";
}
if (a >= 36196) {
return "etc1";
}
if (a >= 35986 && a <= 34798) {
return "atc";
}
throw new Error("Invalid (compressed) texture format given!");
};
b._createLevelBuffers = function (a, b, c, d, e, f, g) {
for (var h = new Array(c), i = a.byteOffset, j = f, k = g, l = j + d - 1 & ~(d - 1), m = k + e - 1 & ~(e - 1), n = l * m * ff[b], o = 0; o < c; o++) {
h[o] = {
levelID: o,
levelWidth: c > 1 ? j : l,
levelHeight: c > 1 ? k : m,
levelBuffer: new Uint8Array(a.buffer, i, n)
};
i += n;
n = (l = (j = j >> 1 || 1) + d - 1 & ~(d - 1)) * (m = (k = k >> 1 || 1) + e - 1 & ~(e - 1)) * ff[b];
}
return h;
};
return b;
}(lf);
var nf = function () {
function a() {}
a.use = function (b, c) {
var d = b.data;
if (b.type === We.TYPE.JSON && d && d.cacheID && d.textures) {
for (var e = d.textures, f = undefined, g = undefined, h = 0, i = e.length; h < i; h++) {
var j = e[h];
var k = j.src;
var l = j.format;
if (!l) {
g = k;
}
if (a.textureFormats[l]) {
f = k;
break;
}
}
if (!(f = f || g)) {
c(new Error("Cannot load compressed-textures in " + b.url + ", make sure you provide a fallback"));
return;
}
if (f === b.url) {
c(new Error("URL of compressed texture cannot be the same as the manifest's URL"));
return;
}
var m = {
crossOrigin: b.crossOrigin,
metadata: b.metadata.imageMetadata,
parentResource: b
};
var n = La.resolve(b.url.replace(this.baseUrl, ""), f);
var o = d.cacheID;
this.add(o, n, m, function (a) {
if (a.error) {
c(a.error);
} else {
var d = a.texture;
var e = d === undefined ? null : d;
var f = a.textures;
var g = f === undefined ? {} : f;
Object.assign(b, {
texture: e,
textures: g
});
c();
}
});
} else {
c();
}
};
Object.defineProperty(a, "textureExtensions", {
get: function () {
if (!a._textureExtensions) {
var b = document.createElement("canvas").getContext("webgl");
if (!b) {
console.warn("WebGL not available for compressed textures. Silently failing.");
return {};
}
var c = {
s3tc: b.getExtension("WEBGL_compressed_texture_s3tc"),
s3tc_sRGB: b.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
etc: b.getExtension("WEBGL_compressed_texture_etc"),
etc1: b.getExtension("WEBGL_compressed_texture_etc1"),
pvrtc: b.getExtension("WEBGL_compressed_texture_pvrtc") || b.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
atc: b.getExtension("WEBGL_compressed_texture_atc"),
astc: b.getExtension("WEBGL_compressed_texture_astc")
};
a._textureExtensions = c;
}
return a._textureExtensions;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a, "textureFormats", {
get: function () {
if (!a._textureFormats) {
var b = a.textureExtensions;
a._textureFormats = {};
for (var c in b) {
var d = b[c];
if (d) {
Object.assign(a._textureFormats, Object.getPrototypeOf(d));
}
}
}
return a._textureFormats;
},
enumerable: false,
configurable: true
});
return a;
}();
function of(a, b, c) {
var d = {
textures: {},
texture: null
};
if (b) {
b.map(function (a) {
return new Sc(new Bc(a, Object.assign({
mipmap: xa.OFF,
alphaMode: ya.NO_PREMULTIPLIED_ALPHA
}, c)));
}).forEach(function (b, c) {
var e = b.baseTexture;
var f = a + "-" + (c + 1);
Bc.addToCache(e, f);
Sc.addToCache(b, f);
if (c === 0) {
Bc.addToCache(e, a);
Sc.addToCache(b, a);
d.texture = b;
}
d.textures[f] = b;
});
return d;
} else {
return d;
}
}
We.setExtensionXhrType("dds", We.XHR_RESPONSE_TYPE.BUFFER);
var pf;
var qf;
(function (a) {
a[a.DXGI_FORMAT_UNKNOWN = 0] = "DXGI_FORMAT_UNKNOWN";
a[a.DXGI_FORMAT_R32G32B32A32_TYPELESS = 1] = "DXGI_FORMAT_R32G32B32A32_TYPELESS";
a[a.DXGI_FORMAT_R32G32B32A32_FLOAT = 2] = "DXGI_FORMAT_R32G32B32A32_FLOAT";
a[a.DXGI_FORMAT_R32G32B32A32_UINT = 3] = "DXGI_FORMAT_R32G32B32A32_UINT";
a[a.DXGI_FORMAT_R32G32B32A32_SINT = 4] = "DXGI_FORMAT_R32G32B32A32_SINT";
a[a.DXGI_FORMAT_R32G32B32_TYPELESS = 5] = "DXGI_FORMAT_R32G32B32_TYPELESS";
a[a.DXGI_FORMAT_R32G32B32_FLOAT = 6] = "DXGI_FORMAT_R32G32B32_FLOAT";
a[a.DXGI_FORMAT_R32G32B32_UINT = 7] = "DXGI_FORMAT_R32G32B32_UINT";
a[a.DXGI_FORMAT_R32G32B32_SINT = 8] = "DXGI_FORMAT_R32G32B32_SINT";
a[a.DXGI_FORMAT_R16G16B16A16_TYPELESS = 9] = "DXGI_FORMAT_R16G16B16A16_TYPELESS";
a[a.DXGI_FORMAT_R16G16B16A16_FLOAT = 10] = "DXGI_FORMAT_R16G16B16A16_FLOAT";
a[a.DXGI_FORMAT_R16G16B16A16_UNORM = 11] = "DXGI_FORMAT_R16G16B16A16_UNORM";
a[a.DXGI_FORMAT_R16G16B16A16_UINT = 12] = "DXGI_FORMAT_R16G16B16A16_UINT";
a[a.DXGI_FORMAT_R16G16B16A16_SNORM = 13] = "DXGI_FORMAT_R16G16B16A16_SNORM";
a[a.DXGI_FORMAT_R16G16B16A16_SINT = 14] = "DXGI_FORMAT_R16G16B16A16_SINT";
a[a.DXGI_FORMAT_R32G32_TYPELESS = 15] = "DXGI_FORMAT_R32G32_TYPELESS";
a[a.DXGI_FORMAT_R32G32_FLOAT = 16] = "DXGI_FORMAT_R32G32_FLOAT";
a[a.DXGI_FORMAT_R32G32_UINT = 17] = "DXGI_FORMAT_R32G32_UINT";
a[a.DXGI_FORMAT_R32G32_SINT = 18] = "DXGI_FORMAT_R32G32_SINT";
a[a.DXGI_FORMAT_R32G8X24_TYPELESS = 19] = "DXGI_FORMAT_R32G8X24_TYPELESS";
a[a.DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20] = "DXGI_FORMAT_D32_FLOAT_S8X24_UINT";
a[a.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21] = "DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS";
a[a.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22] = "DXGI_FORMAT_X32_TYPELESS_G8X24_UINT";
a[a.DXGI_FORMAT_R10G10B10A2_TYPELESS = 23] = "DXGI_FORMAT_R10G10B10A2_TYPELESS";
a[a.DXGI_FORMAT_R10G10B10A2_UNORM = 24] = "DXGI_FORMAT_R10G10B10A2_UNORM";
a[a.DXGI_FORMAT_R10G10B10A2_UINT = 25] = "DXGI_FORMAT_R10G10B10A2_UINT";
a[a.DXGI_FORMAT_R11G11B10_FLOAT = 26] = "DXGI_FORMAT_R11G11B10_FLOAT";
a[a.DXGI_FORMAT_R8G8B8A8_TYPELESS = 27] = "DXGI_FORMAT_R8G8B8A8_TYPELESS";
a[a.DXGI_FORMAT_R8G8B8A8_UNORM = 28] = "DXGI_FORMAT_R8G8B8A8_UNORM";
a[a.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29] = "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB";
a[a.DXGI_FORMAT_R8G8B8A8_UINT = 30] = "DXGI_FORMAT_R8G8B8A8_UINT";
a[a.DXGI_FORMAT_R8G8B8A8_SNORM = 31] = "DXGI_FORMAT_R8G8B8A8_SNORM";
a[a.DXGI_FORMAT_R8G8B8A8_SINT = 32] = "DXGI_FORMAT_R8G8B8A8_SINT";
a[a.DXGI_FORMAT_R16G16_TYPELESS = 33] = "DXGI_FORMAT_R16G16_TYPELESS";
a[a.DXGI_FORMAT_R16G16_FLOAT = 34] = "DXGI_FORMAT_R16G16_FLOAT";
a[a.DXGI_FORMAT_R16G16_UNORM = 35] = "DXGI_FORMAT_R16G16_UNORM";
a[a.DXGI_FORMAT_R16G16_UINT = 36] = "DXGI_FORMAT_R16G16_UINT";
a[a.DXGI_FORMAT_R16G16_SNORM = 37] = "DXGI_FORMAT_R16G16_SNORM";
a[a.DXGI_FORMAT_R16G16_SINT = 38] = "DXGI_FORMAT_R16G16_SINT";
a[a.DXGI_FORMAT_R32_TYPELESS = 39] = "DXGI_FORMAT_R32_TYPELESS";
a[a.DXGI_FORMAT_D32_FLOAT = 40] = "DXGI_FORMAT_D32_FLOAT";
a[a.DXGI_FORMAT_R32_FLOAT = 41] = "DXGI_FORMAT_R32_FLOAT";
a[a.DXGI_FORMAT_R32_UINT = 42] = "DXGI_FORMAT_R32_UINT";
a[a.DXGI_FORMAT_R32_SINT = 43] = "DXGI_FORMAT_R32_SINT";
a[a.DXGI_FORMAT_R24G8_TYPELESS = 44] = "DXGI_FORMAT_R24G8_TYPELESS";
a[a.DXGI_FORMAT_D24_UNORM_S8_UINT = 45] = "DXGI_FORMAT_D24_UNORM_S8_UINT";
a[a.DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46] = "DXGI_FORMAT_R24_UNORM_X8_TYPELESS";
a[a.DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47] = "DXGI_FORMAT_X24_TYPELESS_G8_UINT";
a[a.DXGI_FORMAT_R8G8_TYPELESS = 48] = "DXGI_FORMAT_R8G8_TYPELESS";
a[a.DXGI_FORMAT_R8G8_UNORM = 49] = "DXGI_FORMAT_R8G8_UNORM";
a[a.DXGI_FORMAT_R8G8_UINT = 50] = "DXGI_FORMAT_R8G8_UINT";
a[a.DXGI_FORMAT_R8G8_SNORM = 51] = "DXGI_FORMAT_R8G8_SNORM";
a[a.DXGI_FORMAT_R8G8_SINT = 52] = "DXGI_FORMAT_R8G8_SINT";
a[a.DXGI_FORMAT_R16_TYPELESS = 53] = "DXGI_FORMAT_R16_TYPELESS";
a[a.DXGI_FORMAT_R16_FLOAT = 54] = "DXGI_FORMAT_R16_FLOAT";
a[a.DXGI_FORMAT_D16_UNORM = 55] = "DXGI_FORMAT_D16_UNORM";
a[a.DXGI_FORMAT_R16_UNORM = 56] = "DXGI_FORMAT_R16_UNORM";
a[a.DXGI_FORMAT_R16_UINT = 57] = "DXGI_FORMAT_R16_UINT";
a[a.DXGI_FORMAT_R16_SNORM = 58] = "DXGI_FORMAT_R16_SNORM";
a[a.DXGI_FORMAT_R16_SINT = 59] = "DXGI_FORMAT_R16_SINT";
a[a.DXGI_FORMAT_R8_TYPELESS = 60] = "DXGI_FORMAT_R8_TYPELESS";
a[a.DXGI_FORMAT_R8_UNORM = 61] = "DXGI_FORMAT_R8_UNORM";
a[a.DXGI_FORMAT_R8_UINT = 62] = "DXGI_FORMAT_R8_UINT";
a[a.DXGI_FORMAT_R8_SNORM = 63] = "DXGI_FORMAT_R8_SNORM";
a[a.DXGI_FORMAT_R8_SINT = 64] = "DXGI_FORMAT_R8_SINT";
a[a.DXGI_FORMAT_A8_UNORM = 65] = "DXGI_FORMAT_A8_UNORM";
a[a.DXGI_FORMAT_R1_UNORM = 66] = "DXGI_FORMAT_R1_UNORM";
a[a.DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67] = "DXGI_FORMAT_R9G9B9E5_SHAREDEXP";
a[a.DXGI_FORMAT_R8G8_B8G8_UNORM = 68] = "DXGI_FORMAT_R8G8_B8G8_UNORM";
a[a.DXGI_FORMAT_G8R8_G8B8_UNORM = 69] = "DXGI_FORMAT_G8R8_G8B8_UNORM";
a[a.DXGI_FORMAT_BC1_TYPELESS = 70] = "DXGI_FORMAT_BC1_TYPELESS";
a[a.DXGI_FORMAT_BC1_UNORM = 71] = "DXGI_FORMAT_BC1_UNORM";
a[a.DXGI_FORMAT_BC1_UNORM_SRGB = 72] = "DXGI_FORMAT_BC1_UNORM_SRGB";
a[a.DXGI_FORMAT_BC2_TYPELESS = 73] = "DXGI_FORMAT_BC2_TYPELESS";
a[a.DXGI_FORMAT_BC2_UNORM = 74] = "DXGI_FORMAT_BC2_UNORM";
a[a.DXGI_FORMAT_BC2_UNORM_SRGB = 75] = "DXGI_FORMAT_BC2_UNORM_SRGB";
a[a.DXGI_FORMAT_BC3_TYPELESS = 76] = "DXGI_FORMAT_BC3_TYPELESS";
a[a.DXGI_FORMAT_BC3_UNORM = 77] = "DXGI_FORMAT_BC3_UNORM";
a[a.DXGI_FORMAT_BC3_UNORM_SRGB = 78] = "DXGI_FORMAT_BC3_UNORM_SRGB";
a[a.DXGI_FORMAT_BC4_TYPELESS = 79] = "DXGI_FORMAT_BC4_TYPELESS";
a[a.DXGI_FORMAT_BC4_UNORM = 80] = "DXGI_FORMAT_BC4_UNORM";
a[a.DXGI_FORMAT_BC4_SNORM = 81] = "DXGI_FORMAT_BC4_SNORM";
a[a.DXGI_FORMAT_BC5_TYPELESS = 82] = "DXGI_FORMAT_BC5_TYPELESS";
a[a.DXGI_FORMAT_BC5_UNORM = 83] = "DXGI_FORMAT_BC5_UNORM";
a[a.DXGI_FORMAT_BC5_SNORM = 84] = "DXGI_FORMAT_BC5_SNORM";
a[a.DXGI_FORMAT_B5G6R5_UNORM = 85] = "DXGI_FORMAT_B5G6R5_UNORM";
a[a.DXGI_FORMAT_B5G5R5A1_UNORM = 86] = "DXGI_FORMAT_B5G5R5A1_UNORM";
a[a.DXGI_FORMAT_B8G8R8A8_UNORM = 87] = "DXGI_FORMAT_B8G8R8A8_UNORM";
a[a.DXGI_FORMAT_B8G8R8X8_UNORM = 88] = "DXGI_FORMAT_B8G8R8X8_UNORM";
a[a.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89] = "DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM";
a[a.DXGI_FORMAT_B8G8R8A8_TYPELESS = 90] = "DXGI_FORMAT_B8G8R8A8_TYPELESS";
a[a.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91] = "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB";
a[a.DXGI_FORMAT_B8G8R8X8_TYPELESS = 92] = "DXGI_FORMAT_B8G8R8X8_TYPELESS";
a[a.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93] = "DXGI_FORMAT_B8G8R8X8_UNORM_SRGB";
a[a.DXGI_FORMAT_BC6H_TYPELESS = 94] = "DXGI_FORMAT_BC6H_TYPELESS";
a[a.DXGI_FORMAT_BC6H_UF16 = 95] = "DXGI_FORMAT_BC6H_UF16";
a[a.DXGI_FORMAT_BC6H_SF16 = 96] = "DXGI_FORMAT_BC6H_SF16";
a[a.DXGI_FORMAT_BC7_TYPELESS = 97] = "DXGI_FORMAT_BC7_TYPELESS";
a[a.DXGI_FORMAT_BC7_UNORM = 98] = "DXGI_FORMAT_BC7_UNORM";
a[a.DXGI_FORMAT_BC7_UNORM_SRGB = 99] = "DXGI_FORMAT_BC7_UNORM_SRGB";
a[a.DXGI_FORMAT_AYUV = 100] = "DXGI_FORMAT_AYUV";
a[a.DXGI_FORMAT_Y410 = 101] = "DXGI_FORMAT_Y410";
a[a.DXGI_FORMAT_Y416 = 102] = "DXGI_FORMAT_Y416";
a[a.DXGI_FORMAT_NV12 = 103] = "DXGI_FORMAT_NV12";
a[a.DXGI_FORMAT_P010 = 104] = "DXGI_FORMAT_P010";
a[a.DXGI_FORMAT_P016 = 105] = "DXGI_FORMAT_P016";
a[a.DXGI_FORMAT_420_OPAQUE = 106] = "DXGI_FORMAT_420_OPAQUE";
a[a.DXGI_FORMAT_YUY2 = 107] = "DXGI_FORMAT_YUY2";
a[a.DXGI_FORMAT_Y210 = 108] = "DXGI_FORMAT_Y210";
a[a.DXGI_FORMAT_Y216 = 109] = "DXGI_FORMAT_Y216";
a[a.DXGI_FORMAT_NV11 = 110] = "DXGI_FORMAT_NV11";
a[a.DXGI_FORMAT_AI44 = 111] = "DXGI_FORMAT_AI44";
a[a.DXGI_FORMAT_IA44 = 112] = "DXGI_FORMAT_IA44";
a[a.DXGI_FORMAT_P8 = 113] = "DXGI_FORMAT_P8";
a[a.DXGI_FORMAT_A8P8 = 114] = "DXGI_FORMAT_A8P8";
a[a.DXGI_FORMAT_B4G4R4A4_UNORM = 115] = "DXGI_FORMAT_B4G4R4A4_UNORM";
a[a.DXGI_FORMAT_P208 = 116] = "DXGI_FORMAT_P208";
a[a.DXGI_FORMAT_V208 = 117] = "DXGI_FORMAT_V208";
a[a.DXGI_FORMAT_V408 = 118] = "DXGI_FORMAT_V408";
a[a.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 119] = "DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE";
a[a.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 120] = "DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE";
a[a.DXGI_FORMAT_FORCE_UINT = 121] = "DXGI_FORMAT_FORCE_UINT";
})(pf ||= {});
(function (a) {
a[a.DDS_DIMENSION_TEXTURE1D = 2] = "DDS_DIMENSION_TEXTURE1D";
a[a.DDS_DIMENSION_TEXTURE2D = 3] = "DDS_DIMENSION_TEXTURE2D";
a[a.DDS_DIMENSION_TEXTURE3D = 6] = "DDS_DIMENSION_TEXTURE3D";
})(qf ||= {});
var rf;
var sf;
var tf;
(jf = {})[827611204] = cf.COMPRESSED_RGBA_S3TC_DXT1_EXT;
jf[861165636] = cf.COMPRESSED_RGBA_S3TC_DXT3_EXT;
jf[894720068] = cf.COMPRESSED_RGBA_S3TC_DXT5_EXT;
var uf = jf;
(kf = {})[pf.DXGI_FORMAT_BC1_TYPELESS] = cf.COMPRESSED_RGBA_S3TC_DXT1_EXT;
kf[pf.DXGI_FORMAT_BC1_UNORM] = cf.COMPRESSED_RGBA_S3TC_DXT1_EXT;
kf[pf.DXGI_FORMAT_BC2_TYPELESS] = cf.COMPRESSED_RGBA_S3TC_DXT3_EXT;
kf[pf.DXGI_FORMAT_BC2_UNORM] = cf.COMPRESSED_RGBA_S3TC_DXT3_EXT;
kf[pf.DXGI_FORMAT_BC3_TYPELESS] = cf.COMPRESSED_RGBA_S3TC_DXT5_EXT;
kf[pf.DXGI_FORMAT_BC3_UNORM] = cf.COMPRESSED_RGBA_S3TC_DXT5_EXT;
kf[pf.DXGI_FORMAT_BC1_UNORM_SRGB] = cf.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
kf[pf.DXGI_FORMAT_BC2_UNORM_SRGB] = cf.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
kf[pf.DXGI_FORMAT_BC3_UNORM_SRGB] = cf.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
var vf = kf;
var wf = function () {
function a() {}
a.use = function (b, c) {
if (b.extension === "dds" && b.data) {
try {
Object.assign(b, of(b.name || b.url, a.parse(b.data), b.metadata));
} catch (a) {
c(a);
return;
}
}
c();
};
a.parse = function (a) {
var b = new Uint32Array(a);
if (b[0] !== 542327876) {
throw new Error("Invalid DDS file magic word");
}
var c = new Uint32Array(a, 0, 124 / Uint32Array.BYTES_PER_ELEMENT);
var d = c[3];
var e = c[4];
var f = c[7];
var g = new Uint32Array(a, Uint32Array.BYTES_PER_ELEMENT * 19, 32 / Uint32Array.BYTES_PER_ELEMENT);
var h = g[1];
if (h & 4) {
var i = g[2];
if (i !== 808540228) {
var j = uf[i];
var k = new Uint8Array(a, 128);
return [new mf(k, {
format: j,
width: e,
height: d,
levels: f
})];
}
var l = new Uint32Array(b.buffer, 128, 20 / Uint32Array.BYTES_PER_ELEMENT);
var m = l[0];
var n = l[1];
var o = l[2];
var p = l[3];
var q = vf[m];
if (q === undefined) {
throw new Error("DDSLoader cannot parse texture data with DXGI format " + m);
}
if (o === 4) {
throw new Error("DDSLoader does not support cubemap textures");
}
if (n === qf.DDS_DIMENSION_TEXTURE3D) {
throw new Error("DDSLoader does not supported 3D texture data");
}
var r = new Array();
if (p === 1) {
r.push(new Uint8Array(a, 148));
} else {
for (var s = ff[q], t = 0, u = e, v = d, w = 0; w < f; w++) {
t += Math.max(1, u + 3 & -4) * Math.max(1, v + 3 & -4) * s;
u >>>= 1;
v >>>= 1;
}
var x = 148;
for (w = 0; w < p; w++) {
r.push(new Uint8Array(a, x, t));
x += t;
}
}
return r.map(function (a) {
return new mf(a, {
format: q,
width: e,
height: d,
levels: f
});
});
}
if (h & 64) {
throw new Error("DDSLoader does not support uncompressed texture data.");
}
if (h & 512) {
throw new Error("DDSLoader does not supported YUV uncompressed texture data.");
}
if (h & 131072) {
throw new Error("DDSLoader does not support single-channel (lumninance) texture data!");
}
if (h & 2) {
throw new Error("DDSLoader does not support single-channel (alpha) texture data!");
}
throw new Error("DDSLoader failed to load a texture file due to an unknown reason!");
};
return a;
}();
We.setExtensionXhrType("ktx", We.XHR_RESPONSE_TYPE.BUFFER);
var xf = [171, 75, 84, 88, 32, 49, 49, 187, 13, 10, 26, 10];
(rf = {})[ta.UNSIGNED_BYTE] = 1;
rf[ta.UNSIGNED_SHORT] = 2;
rf[ta.INT] = 4;
rf[ta.UNSIGNED_INT] = 4;
rf[ta.FLOAT] = 4;
rf[ta.HALF_FLOAT] = 8;
var yf = rf;
(sf = {})[ra.RGBA] = 4;
sf[ra.RGB] = 3;
sf[ra.RG] = 2;
sf[ra.RED] = 1;
sf[ra.LUMINANCE] = 1;
sf[ra.LUMINANCE_ALPHA] = 2;
sf[ra.ALPHA] = 1;
var zf = sf;
(tf = {})[ta.UNSIGNED_SHORT_4_4_4_4] = 2;
tf[ta.UNSIGNED_SHORT_5_5_5_1] = 2;
tf[ta.UNSIGNED_SHORT_5_6_5] = 2;
var Af = tf;
var Bf = function () {
function a() {}
a.use = function (b, c) {
if (b.extension === "ktx" && b.data) {
try {
var d = b.name || b.url;
var e = a.parse(d, b.data);
var f = e.compressed;
var g = e.uncompressed;
if (f) {
Object.assign(b, of(d, f, b.metadata));
} else if (g) {
var h = {};
g.forEach(function (a, b) {
var c = new Sc(new Bc(a.resource, {
mipmap: xa.OFF,
alphaMode: ya.NO_PREMULTIPLIED_ALPHA,
type: a.type,
format: a.format
}));
var e = d + "-" + (b + 1);
Bc.addToCache(c.baseTexture, e);
Sc.addToCache(c, e);
if (b === 0) {
h[d] = c;
Bc.addToCache(c.baseTexture, d);
Sc.addToCache(c, d);
}
h[e] = c;
});
Object.assign(b, {
textures: h
});
}
} catch (a) {
c(a);
return;
}
}
c();
};
a.parse = function (b, c) {
var d = new DataView(c);
if (!a.validate(b, d)) {
return null;
}
var e = d.getUint32(12, true) === 67305985;
var f = d.getUint32(16, e);
var g = d.getUint32(24, e);
var h = d.getUint32(28, e);
var i = d.getUint32(36, e);
var j = d.getUint32(40, e) || 1;
var k = d.getUint32(44, e) || 1;
var l = d.getUint32(48, e) || 1;
var m = d.getUint32(52, e);
var n = d.getUint32(56, e);
var o = d.getUint32(60, e);
if (j === 0 || k !== 1) {
throw new Error("Only 2D textures are supported");
}
if (m !== 1) {
throw new Error("CubeTextures are not supported by KTXLoader yet!");
}
if (l !== 1) {
throw new Error("WebGL does not support array textures");
}
var p;
var q = i + 3 & -4;
var r = j + 3 & -4;
var s = new Array(l);
var t = i * j;
if (f === 0) {
t = q * r;
}
if ((p = f !== 0 ? yf[f] ? yf[f] * zf[g] : Af[f] : ff[h]) === undefined) {
throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");
}
for (var u = t * p, v = i, w = j, x = q, y = r, z = 64 + o, A = 0; A < n; A++) {
for (var B = d.getUint32(z, e), C = z + 4, D = 0; D < l; D++) {
var E = s[D];
E ||= s[D] = new Array(n);
E[A] = {
levelID: A,
levelWidth: n > 1 || f !== 0 ? v : x,
levelHeight: n > 1 || f !== 0 ? w : y,
levelBuffer: new Uint8Array(c, C, u)
};
C += u;
}
z = (z += B + 4) % 4 != 0 ? z + 4 - z % 4 : z;
u = (x = (v = v >> 1 || 1) + 4 - 1 & -4) * (y = (w = w >> 1 || 1) + 4 - 1 & -4) * p;
}
if (f !== 0) {
return {
uncompressed: s.map(function (b) {
var c = b[0].levelBuffer;
var d = false;
if (f === ta.FLOAT) {
c = new Float32Array(b[0].levelBuffer.buffer, b[0].levelBuffer.byteOffset, b[0].levelBuffer.byteLength / 4);
} else if (f === ta.UNSIGNED_INT) {
d = true;
c = new Uint32Array(b[0].levelBuffer.buffer, b[0].levelBuffer.byteOffset, b[0].levelBuffer.byteLength / 4);
} else if (f === ta.INT) {
d = true;
c = new Int32Array(b[0].levelBuffer.buffer, b[0].levelBuffer.byteOffset, b[0].levelBuffer.byteLength / 4);
}
return {
resource: new zc(c, {
width: b[0].levelWidth,
height: b[0].levelHeight
}),
type: f,
format: d ? a.convertFormatToInteger(g) : g
};
})
};
} else {
return {
compressed: s.map(function (a) {
return new mf(null, {
format: h,
width: i,
height: j,
levels: n,
levelBuffers: a
});
})
};
}
};
a.validate = function (a, b) {
for (var c = 0; c < xf.length; c++) {
if (b.getUint8(c) !== xf[c]) {
console.error(a + " is not a valid *.ktx file!");
return false;
}
}
return true;
};
a.convertFormatToInteger = function (a) {
switch (a) {
case ra.RGBA:
return ra.RGBA_INTEGER;
case ra.RGB:
return ra.RGB_INTEGER;
case ra.RG:
return ra.RG_INTEGER;
case ra.RED:
return ra.RED_INTEGER;
default:
return a;
}
};
return a;
}();
function Cf(a, b) {
Cf = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return Cf(a, b);
}
function Df(a, b) {
function c() {
this.constructor = a;
}
Cf(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
}
(function (a) {
function b(b, c, d, e) {
if (b === undefined) {
b = 1500;
}
if (d === undefined) {
d = 16384;
}
if (e === undefined) {
e = false;
}
var f = a.call(this) || this;
if (d > 16384) {
d = 16384;
}
f._properties = [false, true, false, false, false];
f._maxSize = b;
f._batchSize = d;
f._buffers = null;
f._bufferUpdateIDs = [];
f._updateID = 0;
f.interactiveChildren = false;
f.blendMode = pa.NORMAL;
f.autoResize = e;
f.roundPixels = true;
f.baseTexture = null;
f.setProperties(c);
f._tint = 0;
f.tintRgb = new Float32Array(4);
f.tint = 16777215;
return f;
}
Df(b, a);
b.prototype.setProperties = function (a) {
if (a) {
this._properties[0] = "vertices" in a || "scale" in a ? !!a.vertices || !!a.scale : this._properties[0];
this._properties[1] = "position" in a ? !!a.position : this._properties[1];
this._properties[2] = "rotation" in a ? !!a.rotation : this._properties[2];
this._properties[3] = "uvs" in a ? !!a.uvs : this._properties[3];
this._properties[4] = "tint" in a || "alpha" in a ? !!a.tint || !!a.alpha : this._properties[4];
}
};
b.prototype.updateTransform = function () {
this.displayObjectUpdateTransform();
};
Object.defineProperty(b.prototype, "tint", {
get: function () {
return this._tint;
},
set: function (a) {
this._tint = a;
Pa(a, this.tintRgb);
},
enumerable: false,
configurable: true
});
b.prototype.render = function (a) {
var b = this;
if (this.visible && this.worldAlpha > 0 && this.children.length && this.renderable) {
if (!this.baseTexture) {
this.baseTexture = this.children[0]._texture.baseTexture;
if (!this.baseTexture.valid) {
this.baseTexture.once("update", function () {
return b.onChildrenChange(0);
});
}
}
a.batch.setObjectRenderer(a.plugins.particle);
a.plugins.particle.render(this);
}
};
b.prototype.onChildrenChange = function (a) {
for (var b = Math.floor(a / this._batchSize); this._bufferUpdateIDs.length < b;) {
this._bufferUpdateIDs.push(0);
}
this._bufferUpdateIDs[b] = ++this._updateID;
};
b.prototype.dispose = function () {
if (this._buffers) {
for (var a = 0; a < this._buffers.length; ++a) {
this._buffers[a].destroy();
}
this._buffers = null;
}
};
b.prototype.destroy = function (b) {
a.prototype.destroy.call(this, b);
this.dispose();
this._properties = null;
this._buffers = null;
this._bufferUpdateIDs = null;
};
})(dc);
var Ef;
var Ff;
var Gf = function () {
function a(a, b, c) {
this.geometry = new ad();
this.indexBuffer = null;
this.size = c;
this.dynamicProperties = [];
this.staticProperties = [];
for (var d = 0; d < a.length; ++d) {
var e = a[d];
e = {
attributeName: e.attributeName,
size: e.size,
uploadFunction: e.uploadFunction,
type: e.type || ta.FLOAT,
offset: e.offset
};
if (b[d]) {
this.dynamicProperties.push(e);
} else {
this.staticProperties.push(e);
}
}
this.staticStride = 0;
this.staticBuffer = null;
this.staticData = null;
this.staticDataUint32 = null;
this.dynamicStride = 0;
this.dynamicBuffer = null;
this.dynamicData = null;
this.dynamicDataUint32 = null;
this._updateID = 0;
this.initBuffers();
}
a.prototype.initBuffers = function () {
var a = this.geometry;
var b = 0;
this.indexBuffer = new Xc(function (a, b) {
if (b === undefined) {
b = null;
}
var c = a * 6;
if ((b = b || new Uint16Array(c)).length !== c) {
throw new Error("Out buffer length is incorrect, got " + b.length + " and expected " + c);
}
for (var d = 0, e = 0; d < c; d += 6, e += 4) {
b[d + 0] = e + 0;
b[d + 1] = e + 1;
b[d + 2] = e + 2;
b[d + 3] = e + 0;
b[d + 4] = e + 2;
b[d + 5] = e + 3;
}
return b;
}(this.size), true, true);
a.addIndex(this.indexBuffer);
this.dynamicStride = 0;
for (var c = 0; c < this.dynamicProperties.length; ++c) {
(g = this.dynamicProperties[c]).offset = b;
b += g.size;
this.dynamicStride += g.size;
}
var d = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);
this.dynamicData = new Float32Array(d);
this.dynamicDataUint32 = new Uint32Array(d);
this.dynamicBuffer = new Xc(this.dynamicData, false, false);
var e = 0;
this.staticStride = 0;
c = 0;
for (; c < this.staticProperties.length; ++c) {
(g = this.staticProperties[c]).offset = e;
e += g.size;
this.staticStride += g.size;
}
var f = new ArrayBuffer(this.size * this.staticStride * 4 * 4);
this.staticData = new Float32Array(f);
this.staticDataUint32 = new Uint32Array(f);
this.staticBuffer = new Xc(this.staticData, true, false);
c = 0;
for (; c < this.dynamicProperties.length; ++c) {
var g = this.dynamicProperties[c];
a.addAttribute(g.attributeName, this.dynamicBuffer, 0, g.type === ta.UNSIGNED_BYTE, g.type, this.dynamicStride * 4, g.offset * 4);
}
for (c = 0; c < this.staticProperties.length; ++c) {
g = this.staticProperties[c];
a.addAttribute(g.attributeName, this.staticBuffer, 0, g.type === ta.UNSIGNED_BYTE, g.type, this.staticStride * 4, g.offset * 4);
}
};
a.prototype.uploadDynamic = function (a, b, c) {
for (var d = 0; d < this.dynamicProperties.length; d++) {
var e = this.dynamicProperties[d];
e.uploadFunction(a, b, c, e.type === ta.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, this.dynamicStride, e.offset);
}
this.dynamicBuffer._updateID++;
};
a.prototype.uploadStatic = function (a, b, c) {
for (var d = 0; d < this.staticProperties.length; d++) {
var e = this.staticProperties[d];
e.uploadFunction(a, b, c, e.type === ta.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, this.staticStride, e.offset);
}
this.staticBuffer._updateID++;
};
a.prototype.destroy = function () {
this.indexBuffer = null;
this.dynamicProperties = null;
this.dynamicBuffer = null;
this.dynamicData = null;
this.dynamicDataUint32 = null;
this.staticProperties = null;
this.staticBuffer = null;
this.staticData = null;
this.staticDataUint32 = null;
this.geometry.destroy();
};
return a;
}();
var Hf = function (a) {
function b(b) {
var c = a.call(this, b) || this;
c.shader = null;
c.properties = null;
c.tempMatrix = new wb();
c.properties = [{
attributeName: "aVertexPosition",
size: 2,
uploadFunction: c.uploadVertices,
offset: 0
}, {
attributeName: "aPositionCoord",
size: 2,
uploadFunction: c.uploadPosition,
offset: 0
}, {
attributeName: "aRotation",
size: 1,
uploadFunction: c.uploadRotation,
offset: 0
}, {
attributeName: "aTextureCoord",
size: 2,
uploadFunction: c.uploadUvs,
offset: 0
}, {
attributeName: "aColor",
size: 1,
type: ta.UNSIGNED_BYTE,
uploadFunction: c.uploadTint,
offset: 0
}];
c.shader = Pd.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n", "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}", {});
c.state = Qd.for2d();
return c;
}
Df(b, a);
b.prototype.render = function (a) {
var b = a.children;
var c = a._maxSize;
var d = a._batchSize;
var e = this.renderer;
var f = b.length;
if (f !== 0) {
if (f > c && !a.autoResize) {
f = c;
}
var g = a._buffers;
g ||= a._buffers = this.generateBuffers(a);
var h = b[0]._texture.baseTexture;
this.state.blendMode = Ta(a.blendMode, h.alphaMode);
e.state.set(this.state);
var i;
var j;
var k;
var l;
var m = e.gl;
var n = a.worldTransform.copyTo(this.tempMatrix);
n.prepend(e.globalUniforms.uniforms.projectionMatrix);
this.shader.uniforms.translationMatrix = n.toArray(true);
this.shader.uniforms.uColor = (i = a.tintRgb, j = a.worldAlpha, k = this.shader.uniforms.uColor, l = h.alphaMode, k = k || new Float32Array(4), l || l === undefined ? (k[0] = i[0] * j, k[1] = i[1] * j, k[2] = i[2] * j) : (k[0] = i[0], k[1] = i[1], k[2] = i[2]), k[3] = j, k);
this.shader.uniforms.uSampler = h;
this.renderer.shader.bind(this.shader);
for (var o = false, p = 0, q = 0; p < f; p += d, q += 1) {
var r = f - p;
if (r > d) {
r = d;
}
if (q >= g.length) {
g.push(this._generateOneMoreBuffer(a));
}
var s = g[q];
s.uploadDynamic(b, p, r);
var t = a._bufferUpdateIDs[q] || 0;
if (o = o || s._updateID < t) {
s._updateID = a._updateID;
s.uploadStatic(b, p, r);
}
e.geometry.bind(s.geometry);
m.drawElements(m.TRIANGLES, r * 6, m.UNSIGNED_SHORT, 0);
}
}
};
b.prototype.generateBuffers = function (a) {
for (var b = [], c = a._maxSize, d = a._batchSize, e = a._properties, f = 0; f < c; f += d) {
b.push(new Gf(this.properties, e, d));
}
return b;
};
b.prototype._generateOneMoreBuffer = function (a) {
var b = a._batchSize;
var c = a._properties;
return new Gf(this.properties, c, b);
};
b.prototype.uploadVertices = function (a, b, c, d, e, f) {
for (var g = 0, h = 0, i = 0, j = 0, k = 0; k < c; ++k) {
var l = a[b + k];
var m = l._texture;
var n = l.scale.x;
var o = l.scale.y;
var p = m.trim;
var q = m.orig;
if (p) {
g = (h = p.x - l.anchor.x * q.width) + p.width;
i = (j = p.y - l.anchor.y * q.height) + p.height;
} else {
g = q.width * (1 - l.anchor.x);
h = q.width * -l.anchor.x;
i = q.height * (1 - l.anchor.y);
j = q.height * -l.anchor.y;
}
d[f] = h * n;
d[f + 1] = j * o;
d[f + e] = g * n;
d[f + e + 1] = j * o;
d[f + e * 2] = g * n;
d[f + e * 2 + 1] = i * o;
d[f + e * 3] = h * n;
d[f + e * 3 + 1] = i * o;
f += e * 4;
}
};
b.prototype.uploadPosition = function (a, b, c, d, e, f) {
for (var g = 0; g < c; g++) {
var h = a[b + g].position;
d[f] = h.x;
d[f + 1] = h.y;
d[f + e] = h.x;
d[f + e + 1] = h.y;
d[f + e * 2] = h.x;
d[f + e * 2 + 1] = h.y;
d[f + e * 3] = h.x;
d[f + e * 3 + 1] = h.y;
f += e * 4;
}
};
b.prototype.uploadRotation = function (a, b, c, d, e, f) {
for (var g = 0; g < c; g++) {
var h = a[b + g].rotation;
d[f] = h;
d[f + e] = h;
d[f + e * 2] = h;
d[f + e * 3] = h;
f += e * 4;
}
};
b.prototype.uploadUvs = function (a, b, c, d, e, f) {
for (var g = 0; g < c; ++g) {
var h = a[b + g]._texture._uvs;
if (h) {
d[f] = h.x0;
d[f + 1] = h.y0;
d[f + e] = h.x1;
d[f + e + 1] = h.y1;
d[f + e * 2] = h.x2;
d[f + e * 2 + 1] = h.y2;
d[f + e * 3] = h.x3;
d[f + e * 3 + 1] = h.y3;
f += e * 4;
} else {
d[f] = 0;
d[f + 1] = 0;
d[f + e] = 0;
d[f + e + 1] = 0;
d[f + e * 2] = 0;
d[f + e * 2 + 1] = 0;
d[f + e * 3] = 0;
d[f + e * 3 + 1] = 0;
f += e * 4;
}
}
};
b.prototype.uploadTint = function (a, b, c, d, e, f) {
for (var g = 0; g < c; ++g) {
var h = a[b + g];
var i = h._texture.baseTexture.alphaMode > 0;
var j = h.alpha;
var k = j < 1 && i ? Ua(h._tintRGB, j) : h._tintRGB + (j * 255 << 24);
d[f] = k;
d[f + e] = k;
d[f + e * 2] = k;
d[f + e * 3] = k;
f += e * 4;
}
};
b.prototype.destroy = function () {
a.prototype.destroy.call(this);
if (this.shader) {
this.shader.destroy();
this.shader = null;
}
this.tempMatrix = null;
};
return b;
}(jd);
(function (a) {
a.MITER = "miter";
a.BEVEL = "bevel";
a.ROUND = "round";
})(Ef ||= {});
(function (a) {
a.BUTT = "butt";
a.ROUND = "round";
a.SQUARE = "square";
})(Ff ||= {});
var If = {
adaptive: true,
maxLength: 10,
minSegments: 8,
maxSegments: 2048,
epsilon: 0.0001,
_segmentsCount: function (a, b) {
if (b === undefined) {
b = 20;
}
if (!this.adaptive || !a || isNaN(a)) {
return b;
}
var c = Math.ceil(a / this.maxLength);
if (c < this.minSegments) {
c = this.minSegments;
} else if (c > this.maxSegments) {
c = this.maxSegments;
}
return c;
}
};
var Jf = function () {
function a() {
this.color = 16777215;
this.alpha = 1;
this.texture = Sc.WHITE;
this.matrix = null;
this.visible = false;
this.reset();
}
a.prototype.clone = function () {
var b = new a();
b.color = this.color;
b.alpha = this.alpha;
b.texture = this.texture;
b.matrix = this.matrix;
b.visible = this.visible;
return b;
};
a.prototype.reset = function () {
this.color = 16777215;
this.alpha = 1;
this.texture = Sc.WHITE;
this.matrix = null;
this.visible = false;
};
a.prototype.destroy = function () {
this.texture = null;
this.matrix = null;
};
return a;
}();
function Kf(a, b) {
Kf = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return Kf(a, b);
}
function Lf(a, b) {
function c() {
this.constructor = a;
}
Kf(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
}
function Mf(a, b) {
var c;
var d;
if (b === undefined) {
b = false;
}
var e = a.length;
if (e >= 6) {
for (var f = 0, g = 0, h = a[e - 2], i = a[e - 1]; g < e; g += 2) {
var j = a[g];
var k = a[g + 1];
f += (j - h) * (k + i);
h = j;
i = k;
}
if (!b && f > 0 || b && f <= 0) {
var l = e / 2;
for (g = l + l % 2; g < e; g += 2) {
var m = e - g - 2;
var n = e - g - 1;
var o = g;
var p = g + 1;
c = [a[o], a[m]];
a[m] = c[0];
a[o] = c[1];
d = [a[p], a[n]];
a[n] = d[0];
a[p] = d[1];
}
}
}
}
var Nf = {
build: function (a) {
a.points = a.shape.points.slice();
},
triangulate: function (a, b) {
var c = a.points;
var d = a.holes;
var e = b.points;
var f = b.indices;
if (c.length >= 6) {
Mf(c, false);
for (var g = [], h = 0; h < d.length; h++) {
var i = d[h];
Mf(i.points, true);
g.push(c.length / 2);
c = c.concat(i.points);
}
var j = Ja()(c, g, 2);
if (!j) {
return;
}
var k = e.length / 2;
for (h = 0; h < j.length; h += 3) {
f.push(j[h] + k);
f.push(j[h + 1] + k);
f.push(j[h + 2] + k);
}
for (h = 0; h < c.length; h++) {
e.push(c[h]);
}
}
}
};
var Of = {
build: function (a) {
var b;
var c;
var d;
var e;
var f;
var g;
var h = a.points;
if (a.type === kb.CIRC) {
var i = a.shape;
b = i.x;
c = i.y;
f = g = i.radius;
d = e = 0;
} else if (a.type === kb.ELIP) {
var j = a.shape;
b = j.x;
c = j.y;
f = j.width;
g = j.height;
d = e = 0;
} else {
var k = a.shape;
var l = k.width / 2;
var m = k.height / 2;
b = k.x + l;
c = k.y + m;
d = l - (f = g = Math.max(0, Math.min(k.radius, Math.min(l, m))));
e = m - g;
}
var n = Math.ceil(Math.sqrt(f + g) * 2.3);
var o = n * 8 + (d ? 4 : 0) + (e ? 4 : 0);
h.length = o;
if (o !== 0) {
if (n === 0) {
h.length = 8;
h[0] = h[6] = b + d;
h[1] = h[3] = c + e;
h[2] = h[4] = b - d;
h[5] = h[7] = c - e;
return;
}
var p;
var q;
var r = 0;
var s = n * 4 + (d ? 2 : 0) + 2;
var t = s;
var u = o;
var v = b + (p = d + f);
var w = b - p;
var x = c + (q = e);
h[r++] = v;
h[r++] = x;
h[--s] = x;
h[--s] = w;
if (e) {
var y = c - q;
h[t++] = w;
h[t++] = y;
h[--u] = y;
h[--u] = v;
}
for (var z = 1; z < n; z++) {
var A = Math.PI / 2 * (z / n);
v = b + (p = d + Math.cos(A) * f);
w = b - p;
x = c + (q = e + Math.sin(A) * g);
y = c - q;
h[r++] = v;
h[r++] = x;
h[--s] = x;
h[--s] = w;
h[t++] = w;
h[t++] = y;
h[--u] = y;
h[--u] = v;
}
v = b + (p = d);
w = b - p;
x = c + (q = e + g);
y = c - q;
h[r++] = v;
h[r++] = x;
h[--u] = y;
h[--u] = v;
if (d) {
h[r++] = w;
h[r++] = x;
h[--u] = y;
h[--u] = w;
}
}
},
triangulate: function (a, b) {
var c;
var d;
var e = a.points;
var f = b.points;
var g = b.indices;
var h = f.length / 2;
var i = h;
if (a.type !== kb.RREC) {
var j = a.shape;
c = j.x;
d = j.y;
} else {
var k = a.shape;
c = k.x + k.width / 2;
d = k.y + k.height / 2;
}
var l = a.matrix;
f.push(a.matrix ? l.a * c + l.c * d + l.tx : c, a.matrix ? l.b * c + l.d * d + l.ty : d);
h++;
f.push(e[0], e[1]);
for (var m = 2; m < e.length; m += 2) {
f.push(e[m], e[m + 1]);
g.push(h++, i, h);
}
g.push(i + 1, i, h);
}
};
function Pf(a, b, c) {
return a + (b - a) * c;
}
function Qf(a, b, c, d, e, f, g) {
if (g === undefined) {
g = [];
}
for (var h = g, i = 0, j = 0, k = 0, l = 0, m = 0, n = 0, o = 0, p = 0; o <= 20; ++o) {
i = Pf(a, c, p = o / 20);
j = Pf(b, d, p);
k = Pf(c, e, p);
l = Pf(d, f, p);
m = Pf(i, k, p);
n = Pf(j, l, p);
if (o !== 0 || h[h.length - 2] !== m || h[h.length - 1] !== n) {
h.push(m, n);
}
}
return h;
}
var Rf = {
build: function (a) {
if (jg.nextRoundedRectBehavior) {
Of.build(a);
} else {
var b = a.shape;
var c = a.points;
var d = b.x;
var e = b.y;
var f = b.width;
var g = b.height;
var h = Math.max(0, Math.min(b.radius, Math.min(f, g) / 2));
c.length = 0;
if (h) {
Qf(d, e + h, d, e, d + h, e, c);
Qf(d + f - h, e, d + f, e, d + f, e + h, c);
Qf(d + f, e + g - h, d + f, e + g, d + f - h, e + g, c);
Qf(d + h, e + g, d, e + g, d, e + g - h, c);
} else {
c.push(d, e, d + f, e, d + f, e + g, d, e + g);
}
}
},
triangulate: function (a, b) {
if (jg.nextRoundedRectBehavior) {
Of.triangulate(a, b);
} else {
for (var c = a.points, d = b.points, e = b.indices, f = d.length / 2, g = Ja()(c, null, 2), h = 0, i = g.length; h < i; h += 3) {
e.push(g[h] + f);
e.push(g[h + 1] + f);
e.push(g[h + 2] + f);
}
h = 0;
i = c.length;
for (; h < i; h++) {
d.push(c[h], c[++h]);
}
}
}
};
function Sf(a, b, c, d, e, f, g, h) {
var i;
var j;
if (g) {
i = d;
j = -c;
} else {
i = -d;
j = c;
}
var k = a - c * e + i;
var l = b - d * e + j;
var m = a + c * f + i;
var n = b + d * f + j;
h.push(k, l);
h.push(m, n);
return 2;
}
function Tf(a, b, c, d, e, f, g, h) {
var i = c - a;
var j = d - b;
var k = Math.atan2(i, j);
var l = Math.atan2(e - a, f - b);
if (h && k < l) {
k += Math.PI * 2;
} else if (!h && k > l) {
l += Math.PI * 2;
}
var m = k;
var n = l - k;
var o = Math.abs(n);
var p = Math.sqrt(i * i + j * j);
var q = 1 + (o * 15 * Math.sqrt(p) / Math.PI >> 0);
var r = n / q;
m += r;
if (h) {
g.push(a, b);
g.push(c, d);
for (var s = 1, t = m; s < q; s++, t += r) {
g.push(a, b);
g.push(a + Math.sin(t) * p, b + Math.cos(t) * p);
}
g.push(a, b);
g.push(e, f);
} else {
g.push(c, d);
g.push(a, b);
s = 1;
t = m;
for (; s < q; s++, t += r) {
g.push(a + Math.sin(t) * p, b + Math.cos(t) * p);
g.push(a, b);
}
g.push(e, f);
g.push(a, b);
}
return q * 2;
}
function Uf(a, b) {
if (a.lineStyle.native) {
(function (a, b) {
var c = 0;
var d = a.shape;
var e = a.points || d.points;
var f = d.type !== kb.POLY || d.closeStroke;
if (e.length !== 0) {
var g = b.points;
var h = b.indices;
var i = e.length / 2;
var j = g.length / 2;
var k = j;
g.push(e[0], e[1]);
c = 1;
for (; c < i; c++) {
g.push(e[c * 2], e[c * 2 + 1]);
h.push(k, k + 1);
k++;
}
if (f) {
h.push(k, j);
}
}
})(a, b);
} else {
(function (a, b) {
var c = a.shape;
var d = a.points || c.points.slice();
var e = b.closePointEps;
if (d.length !== 0) {
var f = a.lineStyle;
var g = new ob(d[0], d[1]);
var h = new ob(d[d.length - 2], d[d.length - 1]);
var i = c.type !== kb.POLY || c.closeStroke;
var j = Math.abs(g.x - h.x) < e && Math.abs(g.y - h.y) < e;
if (i) {
d = d.slice();
if (j) {
d.pop();
d.pop();
h.set(d[d.length - 2], d[d.length - 1]);
}
var k = (g.x + h.x) * 0.5;
var l = (h.y + g.y) * 0.5;
d.unshift(k, l);
d.push(k, l);
}
var m = b.points;
var n = d.length / 2;
var o = d.length;
var p = m.length / 2;
var q = f.width / 2;
var r = q * q;
var s = f.miterLimit * f.miterLimit;
var t = d[0];
var u = d[1];
var v = d[2];
var w = d[3];
var x = 0;
var y = 0;
var z = -(u - w);
var A = t - v;
var B = 0;
var C = 0;
var D = Math.sqrt(z * z + A * A);
z /= D;
A /= D;
z *= q;
A *= q;
var E = f.alignment;
var F = (1 - E) * 2;
var G = E * 2;
if (!i) {
if (f.cap === Ff.ROUND) {
o += Tf(t - z * (F - G) * 0.5, u - A * (F - G) * 0.5, t - z * F, u - A * F, t + z * G, u + A * G, m, true) + 2;
} else if (f.cap === Ff.SQUARE) {
o += Sf(t, u, z, A, F, G, true, m);
}
}
m.push(t - z * F, u - A * F);
m.push(t + z * G, u + A * G);
for (var H = 1; H < n - 1; ++H) {
t = d[(H - 1) * 2];
u = d[(H - 1) * 2 + 1];
v = d[H * 2];
w = d[H * 2 + 1];
x = d[(H + 1) * 2];
y = d[(H + 1) * 2 + 1];
z = -(u - w);
A = t - v;
z /= D = Math.sqrt(z * z + A * A);
A /= D;
z *= q;
A *= q;
B = -(w - y);
C = v - x;
B /= D = Math.sqrt(B * B + C * C);
C /= D;
B *= q;
C *= q;
var I = v - t;
var J = u - w;
var K = v - x;
var L = y - w;
var M = J * K - L * I;
var N = M < 0;
if (Math.abs(M) < 0.1) {
m.push(v - z * F, w - A * F);
m.push(v + z * G, w + A * G);
} else {
var O = (-z + t) * (-A + w) - (-z + v) * (-A + u);
var P = (-B + x) * (-C + w) - (-B + v) * (-C + y);
var Q = (I * P - K * O) / M;
var R = (L * O - J * P) / M;
var S = (Q - v) * (Q - v) + (R - w) * (R - w);
var T = v + (Q - v) * F;
var U = w + (R - w) * F;
var V = v - (Q - v) * G;
var W = w - (R - w) * G;
var X = N ? F : G;
if (S <= Math.min(I * I + J * J, K * K + L * L) + X * X * r) {
if (f.join === Ef.BEVEL || S / r > s) {
if (N) {
m.push(T, U);
m.push(v + z * G, w + A * G);
m.push(T, U);
m.push(v + B * G, w + C * G);
} else {
m.push(v - z * F, w - A * F);
m.push(V, W);
m.push(v - B * F, w - C * F);
m.push(V, W);
}
o += 2;
} else if (f.join === Ef.ROUND) {
if (N) {
m.push(T, U);
m.push(v + z * G, w + A * G);
o += Tf(v, w, v + z * G, w + A * G, v + B * G, w + C * G, m, true) + 4;
m.push(T, U);
m.push(v + B * G, w + C * G);
} else {
m.push(v - z * F, w - A * F);
m.push(V, W);
o += Tf(v, w, v - z * F, w - A * F, v - B * F, w - C * F, m, false) + 4;
m.push(v - B * F, w - C * F);
m.push(V, W);
}
} else {
m.push(T, U);
m.push(V, W);
}
} else {
m.push(v - z * F, w - A * F);
m.push(v + z * G, w + A * G);
if (f.join !== Ef.BEVEL && S / r <= s) {
if (f.join === Ef.ROUND) {
o += N ? Tf(v, w, v + z * G, w + A * G, v + B * G, w + C * G, m, true) + 2 : Tf(v, w, v - z * F, w - A * F, v - B * F, w - C * F, m, false) + 2;
} else {
if (N) {
m.push(V, W);
m.push(V, W);
} else {
m.push(T, U);
m.push(T, U);
}
o += 2;
}
}
m.push(v - B * F, w - C * F);
m.push(v + B * G, w + C * G);
o += 2;
}
}
}
t = d[(n - 2) * 2];
u = d[(n - 2) * 2 + 1];
v = d[(n - 1) * 2];
z = -(u - (w = d[(n - 1) * 2 + 1]));
A = t - v;
z /= D = Math.sqrt(z * z + A * A);
A /= D;
z *= q;
A *= q;
m.push(v - z * F, w - A * F);
m.push(v + z * G, w + A * G);
if (!i) {
if (f.cap === Ff.ROUND) {
o += Tf(v - z * (F - G) * 0.5, w - A * (F - G) * 0.5, v - z * F, w - A * F, v + z * G, w + A * G, m, false) + 2;
} else if (f.cap === Ff.SQUARE) {
o += Sf(v, w, z, A, F, G, false, m);
}
}
var Y = b.indices;
var Z = If.epsilon * If.epsilon;
for (H = p; H < o + p - 2; ++H) {
t = m[H * 2];
u = m[H * 2 + 1];
v = m[(H + 1) * 2];
w = m[(H + 1) * 2 + 1];
x = m[(H + 2) * 2];
y = m[(H + 2) * 2 + 1];
if (Math.abs(t * (w - y) + v * (y - u) + x * (u - w)) >= Z) {
Y.push(H, H + 1, H + 2);
}
}
}
})(a, b);
}
}
var Vf;
var Wf;
var Xf = function () {
function a() {}
a.curveTo = function (a, b, c, d, e, f) {
var g = f[f.length - 2];
var h = f[f.length - 1] - b;
var i = g - a;
var j = d - b;
var k = c - a;
var l = Math.abs(h * k - i * j);
if (l < 1e-8 || e === 0) {
if (f[f.length - 2] !== a || f[f.length - 1] !== b) {
f.push(a, b);
}
return null;
}
var m = h * h + i * i;
var n = j * j + k * k;
var o = h * j + i * k;
var p = e * Math.sqrt(m) / l;
var q = e * Math.sqrt(n) / l;
var r = p * o / m;
var s = q * o / n;
var t = p * k + q * i;
var u = p * j + q * h;
var v = i * (q + r);
var w = h * (q + r);
var x = k * (p + s);
var y = j * (p + s);
return {
cx: t + a,
cy: u + b,
radius: e,
startAngle: Math.atan2(w - u, v - t),
endAngle: Math.atan2(y - u, x - t),
anticlockwise: i * j > k * h
};
};
a.arc = function (a, b, c, d, e, f, g, h, i) {
for (var j = g - f, k = If._segmentsCount(Math.abs(j) * e, Math.ceil(Math.abs(j) / lb) * 40), l = j / (k * 2), m = l * 2, n = Math.cos(l), o = Math.sin(l), p = k - 1, q = p % 1 / p, r = 0; r <= p; ++r) {
var s = l + f + m * (r + q * r);
var t = Math.cos(s);
var u = -Math.sin(s);
i.push((n * t + o * u) * e + c, (n * -u + o * t) * e + d);
}
};
return a;
}();
var Yf = function () {
function a() {}
a.curveLength = function (a, b, c, d, e, f, g, h) {
for (var i = 0, j = 0, k = 0, l = 0, m = 0, n = 0, o = 0, p = 0, q = 0, r = 0, s = 0, t = a, u = b, v = 1; v <= 10; ++v) {
r = t - (p = (o = (n = (m = 1 - (j = v / 10)) * m) * m) * a + n * 3 * j * c + m * 3 * (k = j * j) * e + (l = k * j) * g);
s = u - (q = o * b + n * 3 * j * d + m * 3 * k * f + l * h);
t = p;
u = q;
i += Math.sqrt(r * r + s * s);
}
return i;
};
a.curveTo = function (b, c, d, e, f, g, h) {
var i = h[h.length - 2];
var j = h[h.length - 1];
h.length -= 2;
var k = If._segmentsCount(a.curveLength(i, j, b, c, d, e, f, g));
var l = 0;
var m = 0;
var n = 0;
var o = 0;
var p = 0;
h.push(i, j);
for (var q = 1, r = 0; q <= k; ++q) {
n = (m = (l = 1 - (r = q / k)) * l) * l;
p = (o = r * r) * r;
h.push(n * i + m * 3 * r * b + l * 3 * o * d + p * f, n * j + m * 3 * r * c + l * 3 * o * e + p * g);
}
};
return a;
}();
var Zf = function () {
function a() {}
a.curveLength = function (a, b, c, d, e, f) {
var g = a - c * 2 + e;
var h = b - d * 2 + f;
var i = c * 2 - a * 2;
var j = d * 2 - b * 2;
var k = (g * g + h * h) * 4;
var l = (g * i + h * j) * 4;
var m = i * i + j * j;
var n = Math.sqrt(k + l + m) * 2;
var o = Math.sqrt(k);
var p = k * 2 * o;
var q = Math.sqrt(m) * 2;
var r = l / o;
return (p * n + o * l * (n - q) + (m * 4 * k - l * l) * Math.log((o * 2 + r + n) / (r + q))) / (p * 4);
};
a.curveTo = function (b, c, d, e, f) {
for (var g = f[f.length - 2], h = f[f.length - 1], i = If._segmentsCount(a.curveLength(g, h, b, c, d, e)), j = 0, k = 0, l = 1; l <= i; ++l) {
var m = l / i;
j = g + (b - g) * m;
k = h + (c - h) * m;
f.push(j + (b + (d - b) * m - j) * m, k + (c + (e - c) * m - k) * m);
}
};
return a;
}();
var $f = function () {
function a() {
this.reset();
}
a.prototype.begin = function (a, b, c) {
this.reset();
this.style = a;
this.start = b;
this.attribStart = c;
};
a.prototype.end = function (a, b) {
this.attribSize = b - this.attribStart;
this.size = a - this.start;
};
a.prototype.reset = function () {
this.style = null;
this.size = 0;
this.start = 0;
this.attribStart = 0;
this.attribSize = 0;
};
return a;
}();
(Vf = {})[kb.POLY] = Nf;
Vf[kb.CIRC] = Of;
Vf[kb.ELIP] = Of;
Vf[kb.RECT] = {
build: function (a) {
var b = a.shape;
var c = b.x;
var d = b.y;
var e = b.width;
var f = b.height;
var g = a.points;
g.length = 0;
g.push(c, d, c + e, d, c + e, d + f, c, d + f);
},
triangulate: function (a, b) {
var c = a.points;
var d = b.points;
var e = d.length / 2;
d.push(c[0], c[1], c[2], c[3], c[6], c[7], c[4], c[5]);
b.indices.push(e, e + 1, e + 2, e + 1, e + 2, e + 3);
}
};
Vf[kb.RREC] = Rf;
var _f = Vf;
var ag = [];
var bg = [];
var cg = function () {
function a(a, b, c, d) {
if (b === undefined) {
b = null;
}
if (c === undefined) {
c = null;
}
if (d === undefined) {
d = null;
}
this.points = [];
this.holes = [];
this.shape = a;
this.lineStyle = c;
this.fillStyle = b;
this.matrix = d;
this.type = a.type;
}
a.prototype.clone = function () {
return new a(this.shape, this.fillStyle, this.lineStyle, this.matrix);
};
a.prototype.destroy = function () {
this.shape = null;
this.holes.length = 0;
this.holes = null;
this.points.length = 0;
this.points = null;
this.lineStyle = null;
this.fillStyle = null;
};
return a;
}();
var dg = new ob();
var eg = new Gb();
var fg = function (a) {
function b() {
var b = a.call(this) || this;
b.closePointEps = 0.0001;
b.boundsPadding = 0;
b.uvsFloat32 = null;
b.indicesUint16 = null;
b.batchable = false;
b.points = [];
b.colors = [];
b.uvs = [];
b.indices = [];
b.textureIds = [];
b.graphicsData = [];
b.drawCalls = [];
b.batchDirty = -1;
b.batches = [];
b.dirty = 0;
b.cacheDirty = -1;
b.clearDirty = 0;
b.shapeIndex = 0;
b._bounds = new Gb();
b.boundsDirty = -1;
return b;
}
Lf(b, a);
Object.defineProperty(b.prototype, "bounds", {
get: function () {
if (this.boundsDirty !== this.dirty) {
this.boundsDirty = this.dirty;
this.calculateBounds();
}
return this._bounds;
},
enumerable: false,
configurable: true
});
b.prototype.invalidate = function () {
this.boundsDirty = -1;
this.dirty++;
this.batchDirty++;
this.shapeIndex = 0;
this.points.length = 0;
this.colors.length = 0;
this.uvs.length = 0;
this.indices.length = 0;
this.textureIds.length = 0;
for (var a = 0; a < this.drawCalls.length; a++) {
this.drawCalls[a].texArray.clear();
bg.push(this.drawCalls[a]);
}
this.drawCalls.length = 0;
a = 0;
for (; a < this.batches.length; a++) {
var b = this.batches[a];
b.reset();
ag.push(b);
}
this.batches.length = 0;
};
b.prototype.clear = function () {
if (this.graphicsData.length > 0) {
this.invalidate();
this.clearDirty++;
this.graphicsData.length = 0;
}
return this;
};
b.prototype.drawShape = function (a, b, c, d) {
if (b === undefined) {
b = null;
}
if (c === undefined) {
c = null;
}
if (d === undefined) {
d = null;
}
var e = new cg(a, b, c, d);
this.graphicsData.push(e);
this.dirty++;
return this;
};
b.prototype.drawHole = function (a, b) {
if (b === undefined) {
b = null;
}
if (!this.graphicsData.length) {
return null;
}
var c = new cg(a, null, null, b);
var d = this.graphicsData[this.graphicsData.length - 1];
c.lineStyle = d.lineStyle;
d.holes.push(c);
this.dirty++;
return this;
};
b.prototype.destroy = function () {
a.prototype.destroy.call(this);
for (var b = 0; b < this.graphicsData.length; ++b) {
this.graphicsData[b].destroy();
}
this.points.length = 0;
this.points = null;
this.colors.length = 0;
this.colors = null;
this.uvs.length = 0;
this.uvs = null;
this.indices.length = 0;
this.indices = null;
this.indexBuffer.destroy();
this.indexBuffer = null;
this.graphicsData.length = 0;
this.graphicsData = null;
this.drawCalls.length = 0;
this.drawCalls = null;
this.batches.length = 0;
this.batches = null;
this._bounds = null;
};
b.prototype.containsPoint = function (a) {
for (var b = this.graphicsData, c = 0; c < b.length; ++c) {
var d = b[c];
if (d.fillStyle.visible && d.shape && (d.matrix ? d.matrix.applyInverse(a, dg) : dg.copyFrom(a), d.shape.contains(dg.x, dg.y))) {
var e = false;
if (d.holes) {
for (var f = 0; f < d.holes.length; f++) {
if (d.holes[f].shape.contains(dg.x, dg.y)) {
e = true;
break;
}
}
}
if (!e) {
return true;
}
}
}
return false;
};
b.prototype.updateBatches = function (a) {
if (this.graphicsData.length) {
if (this.validateBatching()) {
this.cacheDirty = this.dirty;
var b = this.uvs;
var c = this.graphicsData;
var d = null;
var e = null;
if (this.batches.length > 0) {
e = (d = this.batches[this.batches.length - 1]).style;
}
for (var f = this.shapeIndex; f < c.length; f++) {
this.shapeIndex++;
var g = c[f];
var h = g.fillStyle;
var i = g.lineStyle;
_f[g.type].build(g);
if (g.matrix) {
this.transformPoints(g.points, g.matrix);
}
if (h.visible || i.visible) {
this.processHoles(g.holes);
}
for (var j = 0; j < 2; j++) {
var k = j === 0 ? h : i;
if (k.visible) {
var l = k.texture.baseTexture;
var m = this.indices.length;
var n = this.points.length / 2;
l.wrapMode = wa.REPEAT;
if (j === 0) {
this.processFill(g);
} else {
this.processLine(g);
}
var o = this.points.length / 2 - n;
if (o !== 0) {
if (d && !this._compareStyles(e, k)) {
d.end(m, n);
d = null;
}
if (!d) {
(d = ag.pop() || new $f()).begin(k, m, n);
this.batches.push(d);
e = k;
}
this.addUvs(this.points, b, k.texture, n, o, k.matrix);
}
}
}
}
var p = this.indices.length;
var q = this.points.length / 2;
if (d) {
d.end(p, q);
}
if (this.batches.length !== 0) {
if (this.indicesUint16 && this.indices.length === this.indicesUint16.length) {
this.indicesUint16.set(this.indices);
} else {
var r = q > 65535 && a;
this.indicesUint16 = r ? new Uint32Array(this.indices) : new Uint16Array(this.indices);
}
this.batchable = this.isBatchable();
if (this.batchable) {
this.packBatches();
} else {
this.buildDrawCalls();
}
} else {
this.batchable = true;
}
}
} else {
this.batchable = true;
}
};
b.prototype._compareStyles = function (a, b) {
return !!a && !!b && a.texture.baseTexture === b.texture.baseTexture && a.color + a.alpha === b.color + b.alpha && !!a.native == !!b.native;
};
b.prototype.validateBatching = function () {
if (this.dirty === this.cacheDirty || !this.graphicsData.length) {
return false;
}
for (var a = 0, b = this.graphicsData.length; a < b; a++) {
var c = this.graphicsData[a];
var d = c.fillStyle;
var e = c.lineStyle;
if (d && !d.texture.baseTexture.valid) {
return false;
}
if (e && !e.texture.baseTexture.valid) {
return false;
}
}
return true;
};
b.prototype.packBatches = function () {
this.batchDirty++;
this.uvsFloat32 = new Float32Array(this.uvs);
for (var a = this.batches, b = 0, c = a.length; b < c; b++) {
for (var d = a[b], e = 0; e < d.size; e++) {
var f = d.start + e;
this.indicesUint16[f] = this.indicesUint16[f] - d.attribStart;
}
}
};
b.prototype.isBatchable = function () {
if (this.points.length > 131070) {
return false;
}
for (var a = this.batches, c = 0; c < a.length; c++) {
if (a[c].style.native) {
return false;
}
}
return this.points.length < b.BATCHABLE_SIZE * 2;
};
b.prototype.buildDrawCalls = function () {
for (var a = ++Bc._globalBatch, b = 0; b < this.drawCalls.length; b++) {
this.drawCalls[b].texArray.clear();
bg.push(this.drawCalls[b]);
}
this.drawCalls.length = 0;
var c = this.colors;
var d = this.textureIds;
var e = bg.pop();
if (!e) {
(e = new ue()).texArray = new ve();
}
e.texArray.count = 0;
e.start = 0;
e.size = 0;
e.type = qa.TRIANGLES;
var f = 0;
var g = null;
var h = 0;
var i = false;
var j = qa.TRIANGLES;
var k = 0;
this.drawCalls.push(e);
b = 0;
for (; b < this.batches.length; b++) {
var l = this.batches[b];
var m = l.style;
var n = m.texture.baseTexture;
if (i !== !!m.native) {
j = (i = !!m.native) ? qa.LINES : qa.TRIANGLES;
g = null;
f = 8;
a++;
}
if (g !== n) {
g = n;
if (n._batchEnabled !== a) {
if (f === 8) {
a++;
f = 0;
if (e.size > 0) {
if (!(e = bg.pop())) {
(e = new ue()).texArray = new ve();
}
this.drawCalls.push(e);
}
e.start = k;
e.size = 0;
e.texArray.count = 0;
e.type = j;
}
n.touched = 1;
n._batchEnabled = a;
n._batchLocation = f;
n.wrapMode = wa.REPEAT;
e.texArray.elements[e.texArray.count++] = n;
f++;
}
}
e.size += l.size;
k += l.size;
h = n._batchLocation;
this.addColors(c, m.color, m.alpha, l.attribSize, l.attribStart);
this.addTextureIds(d, h, l.attribSize, l.attribStart);
}
Bc._globalBatch = a;
this.packAttributes();
};
b.prototype.packAttributes = function () {
for (var a = this.points, b = this.uvs, c = this.colors, d = this.textureIds, e = new ArrayBuffer(a.length * 3 * 4), f = new Float32Array(e), g = new Uint32Array(e), h = 0, i = 0; i < a.length / 2; i++) {
f[h++] = a[i * 2];
f[h++] = a[i * 2 + 1];
f[h++] = b[i * 2];
f[h++] = b[i * 2 + 1];
g[h++] = c[i];
f[h++] = d[i];
}
this._buffer.update(e);
this._indexBuffer.update(this.indicesUint16);
};
b.prototype.processFill = function (a) {
if (a.holes.length) {
Nf.triangulate(a, this);
} else {
_f[a.type].triangulate(a, this);
}
};
b.prototype.processLine = function (a) {
Uf(a, this);
for (var b = 0; b < a.holes.length; b++) {
Uf(a.holes[b], this);
}
};
b.prototype.processHoles = function (a) {
for (var b = 0; b < a.length; b++) {
var c = a[b];
_f[c.type].build(c);
if (c.matrix) {
this.transformPoints(c.points, c.matrix);
}
}
};
b.prototype.calculateBounds = function () {
var a = this._bounds;
var b = eg;
var c = wb.IDENTITY;
this._bounds.clear();
b.clear();
for (var d = 0; d < this.graphicsData.length; d++) {
var e = this.graphicsData[d];
var f = e.shape;
var g = e.type;
var h = e.lineStyle;
var i = e.matrix || wb.IDENTITY;
var j = 0;
if (h && h.visible) {
j = h.width;
if (g !== kb.POLY || e.fillStyle.visible) {
j *= Math.max(0, h.alignment);
} else {
j *= Math.max(h.alignment, 1 - h.alignment);
}
}
if (c !== i) {
if (!b.isEmpty()) {
a.addBoundsMatrix(b, c);
b.clear();
}
c = i;
}
if (g === kb.RECT || g === kb.RREC) {
var k = f;
b.addFramePad(k.x, k.y, k.x + k.width, k.y + k.height, j, j);
} else if (g === kb.CIRC) {
var l = f;
b.addFramePad(l.x, l.y, l.x, l.y, l.radius + j, l.radius + j);
} else if (g === kb.ELIP) {
var m = f;
b.addFramePad(m.x, m.y, m.x, m.y, m.width + j, m.height + j);
} else {
var n = f;
a.addVerticesMatrix(c, n.points, 0, n.points.length, j, j);
}
}
if (!b.isEmpty()) {
a.addBoundsMatrix(b, c);
}
a.pad(this.boundsPadding, this.boundsPadding);
};
b.prototype.transformPoints = function (a, b) {
for (var c = 0; c < a.length / 2; c++) {
var d = a[c * 2];
var e = a[c * 2 + 1];
a[c * 2] = b.a * d + b.c * e + b.tx;
a[c * 2 + 1] = b.b * d + b.d * e + b.ty;
}
};
b.prototype.addColors = function (a, b, c, d, e) {
if (e === undefined) {
e = 0;
}
var f = Ua((b >> 16) + (b & 65280) + ((b & 255) << 16), c);
a.length = Math.max(a.length, e + d);
for (var g = 0; g < d; g++) {
a[e + g] = f;
}
};
b.prototype.addTextureIds = function (a, b, c, d) {
if (d === undefined) {
d = 0;
}
a.length = Math.max(a.length, d + c);
for (var e = 0; e < c; e++) {
a[d + e] = b;
}
};
b.prototype.addUvs = function (a, b, c, d, e, f) {
if (f === undefined) {
f = null;
}
for (var g = 0, h = b.length, i = c.frame; g < e;) {
var j = a[(d + g) * 2];
var k = a[(d + g) * 2 + 1];
if (f) {
var l = f.a * j + f.c * k + f.tx;
k = f.b * j + f.d * k + f.ty;
j = l;
}
g++;
b.push(j / i.width, k / i.height);
}
var m = c.baseTexture;
if (i.width < m.width || i.height < m.height) {
this.adjustUvs(b, c, h, e);
}
};
b.prototype.adjustUvs = function (a, b, c, d) {
for (var e = b.baseTexture, f = 0.000001, g = c + d * 2, h = b.frame, i = h.width / e.width, j = h.height / e.height, k = h.x / h.width, l = h.y / h.height, m = Math.floor(a[c] + f), n = Math.floor(a[c + 1] + f), o = c + 2; o < g; o += 2) {
m = Math.min(m, Math.floor(a[o] + f));
n = Math.min(n, Math.floor(a[o + 1] + f));
}
k -= m;
l -= n;
o = c;
for (; o < g; o += 2) {
a[o] = (a[o] + k) * i;
a[o + 1] = (a[o + 1] + l) * j;
}
};
b.BATCHABLE_SIZE = 100;
return b;
}(ze);
var gg = function (a) {
function b() {
var b = a !== null && a.apply(this, arguments) || this;
b.width = 0;
b.alignment = 0.5;
b.native = false;
b.cap = Ff.BUTT;
b.join = Ef.MITER;
b.miterLimit = 10;
return b;
}
Lf(b, a);
b.prototype.clone = function () {
var a = new b();
a.color = this.color;
a.alpha = this.alpha;
a.texture = this.texture;
a.matrix = this.matrix;
a.visible = this.visible;
a.width = this.width;
a.alignment = this.alignment;
a.native = this.native;
a.cap = this.cap;
a.join = this.join;
a.miterLimit = this.miterLimit;
return a;
};
b.prototype.reset = function () {
a.prototype.reset.call(this);
this.color = 0;
this.alignment = 0.5;
this.width = 0;
this.native = false;
};
return b;
}(Jf);
var hg = new Float32Array(3);
var ig = {};
var jg = function (a) {
function b(b) {
if (b === undefined) {
b = null;
}
var c = a.call(this) || this;
c.shader = null;
c.pluginName = "batch";
c.currentPath = null;
c.batches = [];
c.batchTint = -1;
c.batchDirty = -1;
c.vertexData = null;
c._fillStyle = new Jf();
c._lineStyle = new gg();
c._matrix = null;
c._holeMode = false;
c.state = Qd.for2d();
c._geometry = b || new fg();
c._geometry.refCount++;
c._transformID = -1;
c.tint = 16777215;
c.blendMode = pa.NORMAL;
return c;
}
Lf(b, a);
Object.defineProperty(b.prototype, "geometry", {
get: function () {
return this._geometry;
},
enumerable: false,
configurable: true
});
b.prototype.clone = function () {
this.finishPoly();
return new b(this._geometry);
};
Object.defineProperty(b.prototype, "blendMode", {
get: function () {
return this.state.blendMode;
},
set: function (a) {
this.state.blendMode = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "tint", {
get: function () {
return this._tint;
},
set: function (a) {
this._tint = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "fill", {
get: function () {
return this._fillStyle;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "line", {
get: function () {
return this._lineStyle;
},
enumerable: false,
configurable: true
});
b.prototype.lineStyle = function (a, b, c, d, e) {
if (a === undefined) {
a = null;
}
if (b === undefined) {
b = 0;
}
if (c === undefined) {
c = 1;
}
if (d === undefined) {
d = 0.5;
}
if (e === undefined) {
e = false;
}
if (typeof a == "number") {
a = {
width: a,
color: b,
alpha: c,
alignment: d,
native: e
};
}
return this.lineTextureStyle(a);
};
b.prototype.lineTextureStyle = function (a) {
a = Object.assign({
width: 0,
texture: Sc.WHITE,
color: a && a.texture ? 16777215 : 0,
alpha: 1,
matrix: null,
alignment: 0.5,
native: false,
cap: Ff.BUTT,
join: Ef.MITER,
miterLimit: 10
}, a);
if (this.currentPath) {
this.startPoly();
}
var b = a.width > 0 && a.alpha > 0;
if (b) {
if (a.matrix) {
a.matrix = a.matrix.clone();
a.matrix.invert();
}
Object.assign(this._lineStyle, {
visible: b
}, a);
} else {
this._lineStyle.reset();
}
return this;
};
b.prototype.startPoly = function () {
if (this.currentPath) {
var a = this.currentPath.points;
var b = this.currentPath.points.length;
if (b > 2) {
this.drawShape(this.currentPath);
this.currentPath = new tb();
this.currentPath.closeStroke = false;
this.currentPath.points.push(a[b - 2], a[b - 1]);
}
} else {
this.currentPath = new tb();
this.currentPath.closeStroke = false;
}
};
b.prototype.finishPoly = function () {
if (this.currentPath) {
if (this.currentPath.points.length > 2) {
this.drawShape(this.currentPath);
this.currentPath = null;
} else {
this.currentPath.points.length = 0;
}
}
};
b.prototype.moveTo = function (a, b) {
this.startPoly();
this.currentPath.points[0] = a;
this.currentPath.points[1] = b;
return this;
};
b.prototype.lineTo = function (a, b) {
if (!this.currentPath) {
this.moveTo(0, 0);
}
var c = this.currentPath.points;
var d = c[c.length - 2];
var e = c[c.length - 1];
if (d !== a || e !== b) {
c.push(a, b);
}
return this;
};
b.prototype._initCurve = function (a, b) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = 0;
}
if (this.currentPath) {
if (this.currentPath.points.length === 0) {
this.currentPath.points = [a, b];
}
} else {
this.moveTo(a, b);
}
};
b.prototype.quadraticCurveTo = function (a, b, c, d) {
this._initCurve();
var e = this.currentPath.points;
if (e.length === 0) {
this.moveTo(0, 0);
}
Zf.curveTo(a, b, c, d, e);
return this;
};
b.prototype.bezierCurveTo = function (a, b, c, d, e, f) {
this._initCurve();
Yf.curveTo(a, b, c, d, e, f, this.currentPath.points);
return this;
};
b.prototype.arcTo = function (a, b, c, d, e) {
this._initCurve(a, b);
var f = this.currentPath.points;
var g = Xf.curveTo(a, b, c, d, e, f);
if (g) {
var h = g.cx;
var i = g.cy;
var j = g.radius;
var k = g.startAngle;
var l = g.endAngle;
var m = g.anticlockwise;
this.arc(h, i, j, k, l, m);
}
return this;
};
b.prototype.arc = function (a, b, c, d, e, f) {
if (f === undefined) {
f = false;
}
if (d === e) {
return this;
}
if (!f && e <= d) {
e += lb;
} else if (f && d <= e) {
d += lb;
}
if (e - d == 0) {
return this;
}
var g = a + Math.cos(d) * c;
var h = b + Math.sin(d) * c;
var i = this._geometry.closePointEps;
var j = this.currentPath ? this.currentPath.points : null;
if (j) {
var k = Math.abs(j[j.length - 2] - g);
var l = Math.abs(j[j.length - 1] - h);
if (k >= i || l >= i) {
j.push(g, h);
}
} else {
this.moveTo(g, h);
j = this.currentPath.points;
}
Xf.arc(g, h, a, b, c, d, e, f, j);
return this;
};
b.prototype.beginFill = function (a, b) {
if (a === undefined) {
a = 0;
}
if (b === undefined) {
b = 1;
}
return this.beginTextureFill({
texture: Sc.WHITE,
color: a,
alpha: b
});
};
b.prototype.beginTextureFill = function (a) {
a = Object.assign({
texture: Sc.WHITE,
color: 16777215,
alpha: 1,
matrix: null
}, a);
if (this.currentPath) {
this.startPoly();
}
var b = a.alpha > 0;
if (b) {
if (a.matrix) {
a.matrix = a.matrix.clone();
a.matrix.invert();
}
Object.assign(this._fillStyle, {
visible: b
}, a);
} else {
this._fillStyle.reset();
}
return this;
};
b.prototype.endFill = function () {
this.finishPoly();
this._fillStyle.reset();
return this;
};
b.prototype.drawRect = function (a, b, c, d) {
return this.drawShape(new qb(a, b, c, d));
};
b.prototype.drawRoundedRect = function (a, b, c, d, e) {
return this.drawShape(new ub(a, b, c, d, e));
};
b.prototype.drawCircle = function (a, b, c) {
return this.drawShape(new rb(a, b, c));
};
b.prototype.drawEllipse = function (a, b, c, d) {
return this.drawShape(new sb(a, b, c, d));
};
b.prototype.drawPolygon = function () {
for (var a, b = arguments, c = [], d = 0; d < arguments.length; d++) {
c[d] = b[d];
}
var e = true;
var f = c[0];
if (f.points) {
e = f.closeStroke;
a = f.points;
} else {
a = Array.isArray(c[0]) ? c[0] : c;
}
var g = new tb(a);
g.closeStroke = e;
this.drawShape(g);
return this;
};
b.prototype.drawShape = function (a) {
if (this._holeMode) {
this._geometry.drawHole(a, this._matrix);
} else {
this._geometry.drawShape(a, this._fillStyle.clone(), this._lineStyle.clone(), this._matrix);
}
return this;
};
b.prototype.clear = function () {
this._geometry.clear();
this._lineStyle.reset();
this._fillStyle.reset();
this._boundsID++;
this._matrix = null;
this._holeMode = false;
this.currentPath = null;
return this;
};
b.prototype.isFastRect = function () {
var a = this._geometry.graphicsData;
return a.length === 1 && a[0].shape.type === kb.RECT && !a[0].matrix && !a[0].holes.length && (!a[0].lineStyle.visible || !a[0].lineStyle.width);
};
b.prototype._render = function (a) {
this.finishPoly();
var b = this._geometry;
var c = a.context.supports.uint32Indices;
b.updateBatches(c);
if (b.batchable) {
if (this.batchDirty !== b.batchDirty) {
this._populateBatches();
}
this._renderBatched(a);
} else {
a.batch.flush();
this._renderDirect(a);
}
};
b.prototype._populateBatches = function () {
var a = this._geometry;
var b = this.blendMode;
var c = a.batches.length;
this.batchTint = -1;
this._transformID = -1;
this.batchDirty = a.batchDirty;
this.batches.length = c;
this.vertexData = new Float32Array(a.points);
for (var d = 0; d < c; d++) {
var e = a.batches[d];
var f = e.style.color;
var g = new Float32Array(this.vertexData.buffer, e.attribStart * 4 * 2, e.attribSize * 2);
var h = new Float32Array(a.uvsFloat32.buffer, e.attribStart * 4 * 2, e.attribSize * 2);
var i = {
vertexData: g,
blendMode: b,
indices: new Uint16Array(a.indicesUint16.buffer, e.start * 2, e.size),
uvs: h,
_batchRGB: Pa(f),
_tintRGB: f,
_texture: e.style.texture,
alpha: e.style.alpha,
worldAlpha: 1
};
this.batches[d] = i;
}
};
b.prototype._renderBatched = function (a) {
if (this.batches.length) {
a.batch.setObjectRenderer(a.plugins[this.pluginName]);
this.calculateVertices();
this.calculateTints();
for (var b = 0, c = this.batches.length; b < c; b++) {
var d = this.batches[b];
d.worldAlpha = this.worldAlpha * d.alpha;
a.plugins[this.pluginName].render(d);
}
}
};
b.prototype._renderDirect = function (a) {
var b = this._resolveDirectShader(a);
var c = this._geometry;
var d = this.tint;
var e = this.worldAlpha;
var f = b.uniforms;
var g = c.drawCalls;
f.translationMatrix = this.transform.worldTransform;
f.tint[0] = (d >> 16 & 255) / 255 * e;
f.tint[1] = (d >> 8 & 255) / 255 * e;
f.tint[2] = (d & 255) / 255 * e;
f.tint[3] = e;
a.shader.bind(b);
a.geometry.bind(c, b);
a.state.set(this.state);
for (var h = 0, i = g.length; h < i; h++) {
this._renderDrawCallDirect(a, c.drawCalls[h]);
}
};
b.prototype._renderDrawCallDirect = function (a, b) {
for (var c = b.texArray, d = b.type, e = b.size, f = b.start, g = c.count, h = 0; h < g; h++) {
a.texture.bind(c.elements[h], h);
}
a.geometry.draw(d, e, f);
};
b.prototype._resolveDirectShader = function (a) {
var b = this.shader;
var c = this.pluginName;
if (!b) {
if (!ig[c]) {
for (var d = a.plugins[c].MAX_TEXTURES, e = new Int32Array(d), f = 0; f < d; f++) {
e[f] = f;
}
var g = {
tint: new Float32Array([1, 1, 1, 1]),
translationMatrix: new wb(),
default: ed.from({
uSamplers: e
}, true)
};
var h = a.plugins[c]._shader.program;
ig[c] = new Pd(h, g);
}
b = ig[c];
}
return b;
};
b.prototype._calculateBounds = function () {
this.finishPoly();
var a = this._geometry;
if (a.graphicsData.length) {
var b = a.bounds;
var c = b.minX;
var d = b.minY;
var e = b.maxX;
var f = b.maxY;
this._bounds.addFrame(this.transform, c, d, e, f);
}
};
b.prototype.containsPoint = function (a) {
this.worldTransform.applyInverse(a, b._TEMP_POINT);
return this._geometry.containsPoint(b._TEMP_POINT);
};
b.prototype.calculateTints = function () {
if (this.batchTint !== this.tint) {
this.batchTint = this.tint;
for (var a = Pa(this.tint, hg), b = 0; b < this.batches.length; b++) {
var c = this.batches[b];
var d = c._batchRGB;
var e = (a[0] * d[0] * 255 << 16) + (a[1] * d[1] * 255 << 8) + (a[2] * d[2] * 255 | 0);
c._tintRGB = (e >> 16) + (e & 65280) + ((e & 255) << 16);
}
}
};
b.prototype.calculateVertices = function () {
var a = this.transform._worldID;
if (this._transformID !== a) {
this._transformID = a;
for (var b = this.transform.worldTransform, c = b.a, d = b.b, e = b.c, f = b.d, g = b.tx, h = b.ty, i = this._geometry.points, j = this.vertexData, k = 0, l = 0; l < i.length; l += 2) {
var m = i[l];
var n = i[l + 1];
j[k++] = c * m + e * n + g;
j[k++] = f * n + d * m + h;
}
}
};
b.prototype.closePath = function () {
var a = this.currentPath;
if (a) {
a.closeStroke = true;
this.finishPoly();
}
return this;
};
b.prototype.setMatrix = function (a) {
this._matrix = a;
return this;
};
b.prototype.beginHole = function () {
this.finishPoly();
this._holeMode = true;
return this;
};
b.prototype.endHole = function () {
this.finishPoly();
this._holeMode = false;
return this;
};
b.prototype.destroy = function (b) {
this._geometry.refCount--;
if (this._geometry.refCount === 0) {
this._geometry.dispose();
}
this._matrix = null;
this.currentPath = null;
this._lineStyle.destroy();
this._lineStyle = null;
this._fillStyle.destroy();
this._fillStyle = null;
this._geometry = null;
this.shader = null;
this.vertexData = null;
this.batches.length = 0;
this.batches = null;
a.prototype.destroy.call(this, b);
};
b.nextRoundedRectBehavior = false;
b._TEMP_POINT = new ob();
return b;
}(dc);
function kg(a, b) {
kg = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return kg(a, b);
}
var lg = new ob();
var mg = new Uint16Array([0, 1, 2, 0, 2, 3]);
var ng = function (a) {
function b(b) {
var c = a.call(this) || this;
c._anchor = new vb(c._onAnchorUpdate, c, b ? b.defaultAnchor.x : 0, b ? b.defaultAnchor.y : 0);
c._texture = null;
c._width = 0;
c._height = 0;
c._tint = null;
c._tintRGB = null;
c.tint = 16777215;
c.blendMode = pa.NORMAL;
c._cachedTint = 16777215;
c.uvs = null;
c.texture = b || Sc.EMPTY;
c.vertexData = new Float32Array(8);
c.vertexTrimmedData = null;
c._transformID = -1;
c._textureID = -1;
c._transformTrimmedID = -1;
c._textureTrimmedID = -1;
c.indices = mg;
c.pluginName = "batch";
c.isSprite = true;
c._roundPixels = Fa.ROUND_PIXELS;
return c;
}
(function (a, b) {
function c() {
this.constructor = a;
}
kg(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
b.prototype._onTextureUpdate = function () {
this._textureID = -1;
this._textureTrimmedID = -1;
this._cachedTint = 16777215;
if (this._width) {
this.scale.x = _a(this.scale.x) * this._width / this._texture.orig.width;
}
if (this._height) {
this.scale.y = _a(this.scale.y) * this._height / this._texture.orig.height;
}
};
b.prototype._onAnchorUpdate = function () {
this._transformID = -1;
this._transformTrimmedID = -1;
};
b.prototype.calculateVertices = function () {
var a = this._texture;
if (this._transformID !== this.transform._worldID || this._textureID !== a._updateID) {
if (this._textureID !== a._updateID) {
this.uvs = this._texture._uvs.uvsFloat32;
}
this._transformID = this.transform._worldID;
this._textureID = a._updateID;
var b = this.transform.worldTransform;
var c = b.a;
var d = b.b;
var e = b.c;
var f = b.d;
var g = b.tx;
var h = b.ty;
var i = this.vertexData;
var j = a.trim;
var k = a.orig;
var l = this._anchor;
var m = 0;
var n = 0;
var o = 0;
var p = 0;
if (j) {
m = (n = j.x - l._x * k.width) + j.width;
o = (p = j.y - l._y * k.height) + j.height;
} else {
m = (n = -l._x * k.width) + k.width;
o = (p = -l._y * k.height) + k.height;
}
i[0] = c * n + e * p + g;
i[1] = f * p + d * n + h;
i[2] = c * m + e * p + g;
i[3] = f * p + d * m + h;
i[4] = c * m + e * o + g;
i[5] = f * o + d * m + h;
i[6] = c * n + e * o + g;
i[7] = f * o + d * n + h;
if (this._roundPixels) {
for (var q = Fa.RESOLUTION, r = 0; r < i.length; ++r) {
i[r] = Math.round((i[r] * q | 0) / q);
}
}
}
};
b.prototype.calculateTrimmedVertices = function () {
if (this.vertexTrimmedData) {
if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) {
return;
}
} else {
this.vertexTrimmedData = new Float32Array(8);
}
this._transformTrimmedID = this.transform._worldID;
this._textureTrimmedID = this._texture._updateID;
var a = this._texture;
var b = this.vertexTrimmedData;
var c = a.orig;
var d = this._anchor;
var e = this.transform.worldTransform;
var f = e.a;
var g = e.b;
var h = e.c;
var i = e.d;
var j = e.tx;
var k = e.ty;
var l = -d._x * c.width;
var m = l + c.width;
var n = -d._y * c.height;
var o = n + c.height;
b[0] = f * l + h * n + j;
b[1] = i * n + g * l + k;
b[2] = f * m + h * n + j;
b[3] = i * n + g * m + k;
b[4] = f * m + h * o + j;
b[5] = i * o + g * m + k;
b[6] = f * l + h * o + j;
b[7] = i * o + g * l + k;
};
b.prototype._render = function (a) {
this.calculateVertices();
a.batch.setObjectRenderer(a.plugins[this.pluginName]);
a.plugins[this.pluginName].render(this);
};
b.prototype._calculateBounds = function () {
var a = this._texture.trim;
var b = this._texture.orig;
if (!a || a.width === b.width && a.height === b.height) {
this.calculateVertices();
this._bounds.addQuad(this.vertexData);
} else {
this.calculateTrimmedVertices();
this._bounds.addQuad(this.vertexTrimmedData);
}
};
b.prototype.getLocalBounds = function (b) {
if (this.children.length === 0) {
this._localBounds ||= new Gb();
this._localBounds.minX = this._texture.orig.width * -this._anchor._x;
this._localBounds.minY = this._texture.orig.height * -this._anchor._y;
this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x);
this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y);
if (!b) {
this._localBoundsRect ||= new qb();
b = this._localBoundsRect;
}
return this._localBounds.getRectangle(b);
} else {
return a.prototype.getLocalBounds.call(this, b);
}
};
b.prototype.containsPoint = function (a) {
this.worldTransform.applyInverse(a, lg);
var b = this._texture.orig.width;
var c = this._texture.orig.height;
var d = -b * this.anchor.x;
var e = 0;
return lg.x >= d && lg.x < d + b && (e = -c * this.anchor.y, lg.y >= e && lg.y < e + c);
};
b.prototype.destroy = function (b) {
a.prototype.destroy.call(this, b);
this._texture.off("update", this._onTextureUpdate, this);
this._anchor = null;
if (typeof b == "boolean" ? b : b && b.texture) {
var c = typeof b == "boolean" ? b : b && b.baseTexture;
this._texture.destroy(!!c);
}
this._texture = null;
};
b.from = function (a, c) {
return new b(a instanceof Sc ? a : Sc.from(a, c));
};
Object.defineProperty(b.prototype, "roundPixels", {
get: function () {
return this._roundPixels;
},
set: function (a) {
if (this._roundPixels !== a) {
this._transformID = -1;
}
this._roundPixels = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "width", {
get: function () {
return Math.abs(this.scale.x) * this._texture.orig.width;
},
set: function (a) {
var b = _a(this.scale.x) || 1;
this.scale.x = b * a / this._texture.orig.width;
this._width = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "height", {
get: function () {
return Math.abs(this.scale.y) * this._texture.orig.height;
},
set: function (a) {
var b = _a(this.scale.y) || 1;
this.scale.y = b * a / this._texture.orig.height;
this._height = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "anchor", {
get: function () {
return this._anchor;
},
set: function (a) {
this._anchor.copyFrom(a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "tint", {
get: function () {
return this._tint;
},
set: function (a) {
this._tint = a;
this._tintRGB = (a >> 16) + (a & 65280) + ((a & 255) << 16);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "texture", {
get: function () {
return this._texture;
},
set: function (a) {
if (this._texture !== a) {
if (this._texture) {
this._texture.off("update", this._onTextureUpdate, this);
}
this._texture = a || Sc.EMPTY;
this._cachedTint = 16777215;
this._textureID = -1;
this._textureTrimmedID = -1;
if (a) {
if (a.baseTexture.valid) {
this._onTextureUpdate();
} else {
a.once("update", this._onTextureUpdate, this);
}
}
}
},
enumerable: false,
configurable: true
});
return b;
}(dc);
function og(a, b) {
og = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return og(a, b);
}
(function (a) {
a[a.LINEAR_VERTICAL = 0] = "LINEAR_VERTICAL";
a[a.LINEAR_HORIZONTAL = 1] = "LINEAR_HORIZONTAL";
})(Wf ||= {});
var pg = {
align: "left",
breakWords: false,
dropShadow: false,
dropShadowAlpha: 1,
dropShadowAngle: Math.PI / 6,
dropShadowBlur: 0,
dropShadowColor: "black",
dropShadowDistance: 5,
fill: "black",
fillGradientType: Wf.LINEAR_VERTICAL,
fillGradientStops: [],
fontFamily: "Arial",
fontSize: 26,
fontStyle: "normal",
fontVariant: "normal",
fontWeight: "normal",
letterSpacing: 0,
lineHeight: 0,
lineJoin: "miter",
miterLimit: 10,
padding: 0,
stroke: "black",
strokeThickness: 0,
textBaseline: "alphabetic",
trim: false,
whiteSpace: "pre",
wordWrap: false,
wordWrapWidth: 100,
leading: 0
};
var qg = ["serif", "sans-serif", "monospace", "cursive", "fantasy", "system-ui"];
var rg = function () {
function a(a) {
this.styleID = 0;
this.reset();
ug(this, a, a);
}
a.prototype.clone = function () {
var b = {};
ug(b, this, pg);
return new a(b);
};
a.prototype.reset = function () {
ug(this, pg, pg);
};
Object.defineProperty(a.prototype, "align", {
get: function () {
return this._align;
},
set: function (a) {
if (this._align !== a) {
this._align = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "breakWords", {
get: function () {
return this._breakWords;
},
set: function (a) {
if (this._breakWords !== a) {
this._breakWords = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "dropShadow", {
get: function () {
return this._dropShadow;
},
set: function (a) {
if (this._dropShadow !== a) {
this._dropShadow = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "dropShadowAlpha", {
get: function () {
return this._dropShadowAlpha;
},
set: function (a) {
if (this._dropShadowAlpha !== a) {
this._dropShadowAlpha = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "dropShadowAngle", {
get: function () {
return this._dropShadowAngle;
},
set: function (a) {
if (this._dropShadowAngle !== a) {
this._dropShadowAngle = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "dropShadowBlur", {
get: function () {
return this._dropShadowBlur;
},
set: function (a) {
if (this._dropShadowBlur !== a) {
this._dropShadowBlur = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "dropShadowColor", {
get: function () {
return this._dropShadowColor;
},
set: function (a) {
var b = tg(a);
if (this._dropShadowColor !== b) {
this._dropShadowColor = b;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "dropShadowDistance", {
get: function () {
return this._dropShadowDistance;
},
set: function (a) {
if (this._dropShadowDistance !== a) {
this._dropShadowDistance = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "fill", {
get: function () {
return this._fill;
},
set: function (a) {
var b = tg(a);
if (this._fill !== b) {
this._fill = b;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "fillGradientType", {
get: function () {
return this._fillGradientType;
},
set: function (a) {
if (this._fillGradientType !== a) {
this._fillGradientType = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "fillGradientStops", {
get: function () {
return this._fillGradientStops;
},
set: function (a) {
if (! function (a, b) {
if (!Array.isArray(a) || !Array.isArray(b)) {
return false;
}
if (a.length !== b.length) {
return false;
}
for (var c = 0; c < a.length; ++c) {
if (a[c] !== b[c]) {
return false;
}
}
return true;
}(this._fillGradientStops, a)) {
this._fillGradientStops = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "fontFamily", {
get: function () {
return this._fontFamily;
},
set: function (a) {
if (this.fontFamily !== a) {
this._fontFamily = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "fontSize", {
get: function () {
return this._fontSize;
},
set: function (a) {
if (this._fontSize !== a) {
this._fontSize = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "fontStyle", {
get: function () {
return this._fontStyle;
},
set: function (a) {
if (this._fontStyle !== a) {
this._fontStyle = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "fontVariant", {
get: function () {
return this._fontVariant;
},
set: function (a) {
if (this._fontVariant !== a) {
this._fontVariant = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "fontWeight", {
get: function () {
return this._fontWeight;
},
set: function (a) {
if (this._fontWeight !== a) {
this._fontWeight = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "letterSpacing", {
get: function () {
return this._letterSpacing;
},
set: function (a) {
if (this._letterSpacing !== a) {
this._letterSpacing = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "lineHeight", {
get: function () {
return this._lineHeight;
},
set: function (a) {
if (this._lineHeight !== a) {
this._lineHeight = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "leading", {
get: function () {
return this._leading;
},
set: function (a) {
if (this._leading !== a) {
this._leading = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "lineJoin", {
get: function () {
return this._lineJoin;
},
set: function (a) {
if (this._lineJoin !== a) {
this._lineJoin = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "miterLimit", {
get: function () {
return this._miterLimit;
},
set: function (a) {
if (this._miterLimit !== a) {
this._miterLimit = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "padding", {
get: function () {
return this._padding;
},
set: function (a) {
if (this._padding !== a) {
this._padding = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "stroke", {
get: function () {
return this._stroke;
},
set: function (a) {
var b = tg(a);
if (this._stroke !== b) {
this._stroke = b;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "strokeThickness", {
get: function () {
return this._strokeThickness;
},
set: function (a) {
if (this._strokeThickness !== a) {
this._strokeThickness = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "textBaseline", {
get: function () {
return this._textBaseline;
},
set: function (a) {
if (this._textBaseline !== a) {
this._textBaseline = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "trim", {
get: function () {
return this._trim;
},
set: function (a) {
if (this._trim !== a) {
this._trim = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "whiteSpace", {
get: function () {
return this._whiteSpace;
},
set: function (a) {
if (this._whiteSpace !== a) {
this._whiteSpace = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "wordWrap", {
get: function () {
return this._wordWrap;
},
set: function (a) {
if (this._wordWrap !== a) {
this._wordWrap = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(a.prototype, "wordWrapWidth", {
get: function () {
return this._wordWrapWidth;
},
set: function (a) {
if (this._wordWrapWidth !== a) {
this._wordWrapWidth = a;
this.styleID++;
}
},
enumerable: false,
configurable: true
});
a.prototype.toFontString = function () {
var a = typeof this.fontSize == "number" ? this.fontSize + "px" : this.fontSize;
var b = this.fontFamily;
if (!Array.isArray(this.fontFamily)) {
b = this.fontFamily.split(",");
}
for (var c = b.length - 1; c >= 0; c--) {
var d = b[c].trim();
if (!/([\"\'])[^\'\"]+\1/.test(d) && qg.indexOf(d) < 0) {
d = "\"" + d + "\"";
}
b[c] = d;
}
return this.fontStyle + " " + this.fontVariant + " " + this.fontWeight + " " + a + " " + b.join(",");
};
return a;
}();
function sg(a) {
if (typeof a == "number") {
return Qa(a);
} else {
if (typeof a == "string" && a.indexOf("0x") === 0) {
a = a.replace("0x", "#");
}
return a;
}
}
function tg(a) {
if (Array.isArray(a)) {
for (var b = 0; b < a.length; ++b) {
a[b] = sg(a[b]);
}
return a;
}
return sg(a);
}
function ug(a, b, c) {
for (var d in c) {
if (Array.isArray(b[d])) {
a[d] = b[d].slice();
} else {
a[d] = b[d];
}
}
}
var vg = function () {
function a(a, b, c, d, e, f, g, h, i) {
this.text = a;
this.style = b;
this.width = c;
this.height = d;
this.lines = e;
this.lineWidths = f;
this.lineHeight = g;
this.maxLineWidth = h;
this.fontProperties = i;
}
a.measureText = function (b, c, d, e) {
if (e === undefined) {
e = a._canvas;
}
d = d == null ? c.wordWrap : d;
var f = c.toFontString();
var g = a.measureFont(f);
if (g.fontSize === 0) {
g.fontSize = c.fontSize;
g.ascent = c.fontSize;
}
var h = e.getContext("2d");
h.font = f;
for (var i = (d ? a.wordWrap(b, c, e) : b).split(/(?:\r\n|\r|\n)/), j = new Array(i.length), k = 0, l = 0; l < i.length; l++) {
var m = h.measureText(i[l]).width + (i[l].length - 1) * c.letterSpacing;
j[l] = m;
k = Math.max(k, m);
}
var n = k + c.strokeThickness;
if (c.dropShadow) {
n += c.dropShadowDistance;
}
var o = c.lineHeight || g.fontSize + c.strokeThickness;
var p = Math.max(o, g.fontSize + c.strokeThickness) + (i.length - 1) * (o + c.leading);
if (c.dropShadow) {
p += c.dropShadowDistance;
}
return new a(b, c, n, p, i, j, o + c.leading, k, g);
};
a.wordWrap = function (b, c, d) {
if (d === undefined) {
d = a._canvas;
}
for (var e = d.getContext("2d"), f = 0, g = "", h = "", i = Object.create(null), j = c.letterSpacing, k = c.whiteSpace, l = a.collapseSpaces(k), m = a.collapseNewlines(k), n = !l, o = c.wordWrapWidth + j, p = a.tokenize(b), q = 0; q < p.length; q++) {
var r = p[q];
if (a.isNewline(r)) {
if (!m) {
h += a.addLine(g);
n = !l;
g = "";
f = 0;
continue;
}
r = " ";
}
if (l) {
var s = a.isBreakingSpace(r);
var t = a.isBreakingSpace(g[g.length - 1]);
if (s && t) {
continue;
}
}
var u = a.getFromCache(r, j, i, e);
if (u > o) {
if (g !== "") {
h += a.addLine(g);
g = "";
f = 0;
}
if (a.canBreakWords(r, c.breakWords)) {
for (var v = a.wordWrapSplit(r), w = 0; w < v.length; w++) {
for (var x = v[w], y = 1; v[w + y];) {
var z = v[w + y];
var A = x[x.length - 1];
if (a.canBreakChars(A, z, r, w, c.breakWords)) {
break;
}
x += z;
y++;
}
w += x.length - 1;
var B = a.getFromCache(x, j, i, e);
if (B + f > o) {
h += a.addLine(g);
n = false;
g = "";
f = 0;
}
g += x;
f += B;
}
} else {
if (g.length > 0) {
h += a.addLine(g);
g = "";
f = 0;
}
var C = q === p.length - 1;
h += a.addLine(r, !C);
n = false;
g = "";
f = 0;
}
} else {
if (u + f > o) {
n = false;
h += a.addLine(g);
g = "";
f = 0;
}
if (g.length > 0 || !a.isBreakingSpace(r) || n) {
g += r;
f += u;
}
}
}
return h + a.addLine(g, false);
};
a.addLine = function (b, c) {
if (c === undefined) {
c = true;
}
b = a.trimRight(b);
if (c) {
return b + "\n";
} else {
return b;
}
};
a.getFromCache = function (a, b, c, d) {
var e = c[a];
if (typeof e != "number") {
var f = a.length * b;
e = d.measureText(a).width + f;
c[a] = e;
}
return e;
};
a.collapseSpaces = function (a) {
return a === "normal" || a === "pre-line";
};
a.collapseNewlines = function (a) {
return a === "normal";
};
a.trimRight = function (b) {
if (typeof b != "string") {
return "";
}
for (var c = b.length - 1; c >= 0; c--) {
var d = b[c];
if (!a.isBreakingSpace(d)) {
break;
}
b = b.slice(0, -1);
}
return b;
};
a.isNewline = function (b) {
return typeof b == "string" && a._newlines.indexOf(b.charCodeAt(0)) >= 0;
};
a.isBreakingSpace = function (b, c) {
return typeof b == "string" && a._breakingSpaces.indexOf(b.charCodeAt(0)) >= 0;
};
a.tokenize = function (b) {
var c = [];
var d = "";
if (typeof b != "string") {
return c;
}
for (var e = 0; e < b.length; e++) {
var f = b[e];
var g = b[e + 1];
if (a.isBreakingSpace(f, g) || a.isNewline(f)) {
if (d !== "") {
c.push(d);
d = "";
}
c.push(f);
} else {
d += f;
}
}
if (d !== "") {
c.push(d);
}
return c;
};
a.canBreakWords = function (a, b) {
return b;
};
a.canBreakChars = function (a, b, c, d, e) {
return true;
};
a.wordWrapSplit = function (a) {
return a.split("");
};
a.measureFont = function (b) {
if (a._fonts[b]) {
return a._fonts[b];
}
var c = {
ascent: 0,
descent: 0,
fontSize: 0
};
var d = a._canvas;
var e = a._context;
e.font = b;
var f = a.METRICS_STRING + a.BASELINE_SYMBOL;
var g = Math.ceil(e.measureText(f).width);
var h = Math.ceil(e.measureText(a.BASELINE_SYMBOL).width);
var i = Math.ceil(a.HEIGHT_MULTIPLIER * h);
h = h * a.BASELINE_MULTIPLIER | 0;
d.width = g;
d.height = i;
e.fillStyle = "#f00";
e.fillRect(0, 0, g, i);
e.font = b;
e.textBaseline = "alphabetic";
e.fillStyle = "#000";
e.fillText(f, 0, h);
var j = e.getImageData(0, 0, g, i).data;
var k = j.length;
var l = g * 4;
var m = 0;
var n = 0;
var o = false;
for (m = 0; m < h; ++m) {
for (var p = 0; p < l; p += 4) {
if (j[n + p] !== 255) {
o = true;
break;
}
}
if (o) {
break;
}
n += l;
}
c.ascent = h - m;
n = k - l;
o = false;
m = i;
for (; m > h; --m) {
for (p = 0; p < l; p += 4) {
if (j[n + p] !== 255) {
o = true;
break;
}
}
if (o) {
break;
}
n -= l;
}
c.descent = m - h;
c.fontSize = c.ascent + c.descent;
a._fonts[b] = c;
return c;
};
a.clearMetrics = function (b) {
if (b === undefined) {
b = "";
}
if (b) {
delete a._fonts[b];
} else {
a._fonts = {};
}
};
Object.defineProperty(a, "_canvas", {
get: function () {
if (!a.__canvas) {
var b = undefined;
try {
var c = new OffscreenCanvas(0, 0);
var d = c.getContext("2d");
if (d && d.measureText) {
a.__canvas = c;
return c;
}
b = document.createElement("canvas");
} catch (a) {
b = document.createElement("canvas");
}
b.width = b.height = 10;
a.__canvas = b;
}
return a.__canvas;
},
enumerable: false,
configurable: true
});
Object.defineProperty(a, "_context", {
get: function () {
a.__context ||= a._canvas.getContext("2d");
return a.__context;
},
enumerable: false,
configurable: true
});
return a;
}();
vg._fonts = {};
vg.METRICS_STRING = "|ÉqÅ";
vg.BASELINE_SYMBOL = "M";
vg.BASELINE_MULTIPLIER = 1.4;
vg.HEIGHT_MULTIPLIER = 2;
vg._newlines = [10, 13];
vg._breakingSpaces = [9, 32, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8200, 8201, 8202, 8287, 12288];
var wg = {
texture: true,
children: false,
baseTexture: true
};
var xg = function (a) {
function b(b, c, d) {
var e = this;
var f = false;
if (!d) {
d = document.createElement("canvas");
f = true;
}
d.width = 3;
d.height = 3;
var g = Sc.from(d);
g.orig = new qb();
g.trim = new qb();
(e = a.call(this, g) || this)._ownCanvas = f;
e.canvas = d;
e.context = e.canvas.getContext("2d");
e._resolution = Fa.RESOLUTION;
e._autoResolution = true;
e._text = null;
e._style = null;
e._styleListener = null;
e._font = "";
e.text = b;
e.style = c;
e.localStyleID = -1;
return e;
}
(function (a, b) {
function c() {
this.constructor = a;
}
og(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
b.prototype.updateText = function (a) {
var c = this._style;
if (this.localStyleID !== c.styleID) {
this.dirty = true;
this.localStyleID = c.styleID;
}
if (this.dirty || !a) {
this._font = this._style.toFontString();
var d;
var e;
var f = this.context;
var g = vg.measureText(this._text || " ", this._style, this._style.wordWrap, this.canvas);
var h = g.width;
var i = g.height;
var j = g.lines;
var k = g.lineHeight;
var l = g.lineWidths;
var m = g.maxLineWidth;
var n = g.fontProperties;
this.canvas.width = Math.ceil(Math.ceil(Math.max(1, h) + c.padding * 2) * this._resolution);
this.canvas.height = Math.ceil(Math.ceil(Math.max(1, i) + c.padding * 2) * this._resolution);
f.scale(this._resolution, this._resolution);
f.clearRect(0, 0, this.canvas.width, this.canvas.height);
f.font = this._font;
f.lineWidth = c.strokeThickness;
f.textBaseline = c.textBaseline;
f.lineJoin = c.lineJoin;
f.miterLimit = c.miterLimit;
for (var o = c.dropShadow ? 2 : 1, p = 0; p < o; ++p) {
var q = c.dropShadow && p === 0;
var r = q ? Math.ceil(Math.max(1, i) + c.padding * 2) : 0;
var s = r * this._resolution;
if (q) {
f.fillStyle = "black";
f.strokeStyle = "black";
var t = c.dropShadowColor;
var u = Pa(typeof t == "number" ? t : Ra(t));
var v = c.dropShadowBlur * this._resolution;
var w = c.dropShadowDistance * this._resolution;
f.shadowColor = "rgba(" + u[0] * 255 + "," + u[1] * 255 + "," + u[2] * 255 + "," + c.dropShadowAlpha + ")";
f.shadowBlur = v;
f.shadowOffsetX = Math.cos(c.dropShadowAngle) * w;
f.shadowOffsetY = Math.sin(c.dropShadowAngle) * w + s;
} else {
f.fillStyle = this._generateFillStyle(c, j, g);
f.strokeStyle = c.stroke;
f.shadowColor = "black";
f.shadowBlur = 0;
f.shadowOffsetX = 0;
f.shadowOffsetY = 0;
}
var x = (k - n.fontSize) / 2;
if (!b.nextLineHeightBehavior || k - n.fontSize < 0) {
x = 0;
}
for (var y = 0; y < j.length; y++) {
d = c.strokeThickness / 2;
e = c.strokeThickness / 2 + y * k + n.ascent + x;
if (c.align === "right") {
d += m - l[y];
} else if (c.align === "center") {
d += (m - l[y]) / 2;
}
if (c.stroke && c.strokeThickness) {
this.drawLetterSpacing(j[y], d + c.padding, e + c.padding - r, true);
}
if (c.fill) {
this.drawLetterSpacing(j[y], d + c.padding, e + c.padding - r);
}
}
}
this.updateTexture();
}
};
b.prototype.drawLetterSpacing = function (a, c, d, e) {
if (e === undefined) {
e = false;
}
var f = this._style.letterSpacing;
var g = b.experimentalLetterSpacing && ("letterSpacing" in CanvasRenderingContext2D.prototype || "textLetterSpacing" in CanvasRenderingContext2D.prototype);
if (f === 0 || g) {
if (g) {
this.context.letterSpacing = f;
this.context.textLetterSpacing = f;
}
if (e) {
this.context.strokeText(a, c, d);
} else {
this.context.fillText(a, c, d);
}
return;
}
for (var h = c, i = Array.from ? Array.from(a) : a.split(""), j = this.context.measureText(a).width, k = 0, l = 0; l < i.length; ++l) {
var m = i[l];
if (e) {
this.context.strokeText(m, h, d);
} else {
this.context.fillText(m, h, d);
}
for (var n = "", o = l + 1; o < i.length; ++o) {
n += i[o];
}
h += j - (k = this.context.measureText(n).width) + f;
j = k;
}
};
b.prototype.updateTexture = function () {
var a = this.canvas;
if (this._style.trim) {
var b = function (a) {
var b;
var c;
var d;
var e = a.width;
var f = a.height;
var g = a.getContext("2d");
var h = g.getImageData(0, 0, e, f).data;
var i = h.length;
var j = {
top: null,
left: null,
right: null,
bottom: null
};
var k = null;
for (b = 0; b < i; b += 4) {
if (h[b + 3] !== 0) {
c = b / 4 % e;
d = ~~(b / 4 / e);
if (j.top === null) {
j.top = d;
}
if (j.left === null || c < j.left) {
j.left = c;
}
if (j.right === null || j.right < c) {
j.right = c + 1;
}
if (j.bottom === null || j.bottom < d) {
j.bottom = d;
}
}
}
if (j.top !== null) {
e = j.right - j.left;
f = j.bottom - j.top + 1;
k = g.getImageData(j.left, j.top, e, f);
}
return {
height: f,
width: e,
data: k
};
}(a);
if (b.data) {
a.width = b.width;
a.height = b.height;
this.context.putImageData(b.data, 0, 0);
}
}
var c = this._texture;
var d = this._style;
var e = d.trim ? 0 : d.padding;
var f = c.baseTexture;
c.trim.width = c._frame.width = a.width / this._resolution;
c.trim.height = c._frame.height = a.height / this._resolution;
c.trim.x = -e;
c.trim.y = -e;
c.orig.width = c._frame.width - e * 2;
c.orig.height = c._frame.height - e * 2;
this._onTextureUpdate();
f.setRealSize(a.width, a.height, this._resolution);
c.updateUvs();
this._recursivePostUpdateTransform();
this.dirty = false;
};
b.prototype._render = function (b) {
if (this._autoResolution && this._resolution !== b.resolution) {
this._resolution = b.resolution;
this.dirty = true;
}
this.updateText(true);
a.prototype._render.call(this, b);
};
b.prototype.getLocalBounds = function (b) {
this.updateText(true);
return a.prototype.getLocalBounds.call(this, b);
};
b.prototype._calculateBounds = function () {
this.updateText(true);
this.calculateVertices();
this._bounds.addQuad(this.vertexData);
};
b.prototype._generateFillStyle = function (a, b, c) {
var d;
var e = a.fill;
if (!Array.isArray(e)) {
return e;
}
if (e.length === 1) {
return e[0];
}
var f = a.dropShadow ? a.dropShadowDistance : 0;
var g = a.padding || 0;
var h = this.canvas.width / this._resolution - f - g * 2;
var i = this.canvas.height / this._resolution - f - g * 2;
var j = e.slice();
var k = a.fillGradientStops.slice();
if (!k.length) {
for (var l = j.length + 1, m = 1; m < l; ++m) {
k.push(m / l);
}
}
j.unshift(e[0]);
k.unshift(0);
j.push(e[e.length - 1]);
k.push(1);
if (a.fillGradientType === Wf.LINEAR_VERTICAL) {
d = this.context.createLinearGradient(h / 2, g, h / 2, i + g);
var n = c.fontProperties.fontSize + a.strokeThickness;
for (m = 0; m < b.length; m++) {
var o = c.lineHeight * (m - 1) + n;
var p = c.lineHeight * m;
var q = p;
if (m > 0 && o > p) {
q = (p + o) / 2;
}
var r = p + n;
var s = c.lineHeight * (m + 1);
var t = r;
if (m + 1 < b.length && s < r) {
t = (r + s) / 2;
}
for (var u = (t - q) / i, v = 0; v < j.length; v++) {
var w;
w = typeof k[v] == "number" ? k[v] : v / j.length;
var x = Math.min(1, Math.max(0, q / i + w * u));
x = Number(x.toFixed(5));
d.addColorStop(x, j[v]);
}
}
} else {
d = this.context.createLinearGradient(g, i / 2, h + g, i / 2);
var y = j.length + 1;
var z = 1;
for (m = 0; m < j.length; m++) {
var A;
A = typeof k[m] == "number" ? k[m] : z / y;
d.addColorStop(A, j[m]);
z++;
}
}
return d;
};
b.prototype.destroy = function (b) {
if (typeof b == "boolean") {
b = {
children: b
};
}
b = Object.assign({}, wg, b);
a.prototype.destroy.call(this, b);
if (this._ownCanvas) {
this.canvas.height = this.canvas.width = 0;
}
this.context = null;
this.canvas = null;
this._style = null;
};
Object.defineProperty(b.prototype, "width", {
get: function () {
this.updateText(true);
return Math.abs(this.scale.x) * this._texture.orig.width;
},
set: function (a) {
this.updateText(true);
var b = _a(this.scale.x) || 1;
this.scale.x = b * a / this._texture.orig.width;
this._width = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "height", {
get: function () {
this.updateText(true);
return Math.abs(this.scale.y) * this._texture.orig.height;
},
set: function (a) {
this.updateText(true);
var b = _a(this.scale.y) || 1;
this.scale.y = b * a / this._texture.orig.height;
this._height = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "style", {
get: function () {
return this._style;
},
set: function (a) {
a = a || {};
this._style = a instanceof rg ? a : new rg(a);
this.localStyleID = -1;
this.dirty = true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "text", {
get: function () {
return this._text;
},
set: function (a) {
a = String(a == null ? "" : a);
if (this._text !== a) {
this._text = a;
this.dirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "resolution", {
get: function () {
return this._resolution;
},
set: function (a) {
this._autoResolution = false;
if (this._resolution !== a) {
this._resolution = a;
this.dirty = true;
}
},
enumerable: false,
configurable: true
});
b.nextLineHeightBehavior = false;
b.experimentalLetterSpacing = false;
return b;
}(ng);
Fa.UPLOADS_PER_FRAME = 4;
function yg(a, b) {
yg = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return yg(a, b);
}
var zg = function () {
function a(a) {
this.maxItemsPerFrame = a;
this.itemsLeft = 0;
}
a.prototype.beginFrame = function () {
this.itemsLeft = this.maxItemsPerFrame;
};
a.prototype.allowedToUpload = function () {
return this.itemsLeft-- > 0;
};
return a;
}();
function Ag(a, b) {
var c = false;
if (a && a._textures && a._textures.length) {
for (var d = 0; d < a._textures.length; d++) {
if (a._textures[d] instanceof Sc) {
var e = a._textures[d].baseTexture;
if (b.indexOf(e) === -1) {
b.push(e);
c = true;
}
}
}
}
return c;
}
function Bg(a, b) {
if (a.baseTexture instanceof Bc) {
var c = a.baseTexture;
if (b.indexOf(c) === -1) {
b.push(c);
}
return true;
}
return false;
}
function Cg(a, b) {
if (a._texture && a._texture instanceof Sc) {
var c = a._texture.baseTexture;
if (b.indexOf(c) === -1) {
b.push(c);
}
return true;
}
return false;
}
function Dg(a, b) {
return b instanceof xg && (b.updateText(true), true);
}
function Eg(a, b) {
if (b instanceof rg) {
var c = b.toFontString();
vg.measureFont(c);
return true;
}
return false;
}
function Fg(a, b) {
if (a instanceof xg) {
if (b.indexOf(a.style) === -1) {
b.push(a.style);
}
if (b.indexOf(a) === -1) {
b.push(a);
}
var c = a._texture.baseTexture;
if (b.indexOf(c) === -1) {
b.push(c);
}
return true;
}
return false;
}
function Gg(a, b) {
return a instanceof rg && (b.indexOf(a) === -1 && b.push(a), true);
}
function Hg(a, b) {
return b instanceof Bc && (b._glTextures[a.CONTEXT_UID] || a.texture.bind(b), true);
}
function Ig(a, b) {
if (!(b instanceof jg)) {
return false;
}
var c = b.geometry;
b.finishPoly();
c.updateBatches();
for (var d = c.batches, e = 0; e < d.length; e++) {
var f = d[e].style.texture;
if (f) {
Hg(a, f.baseTexture);
}
}
if (!c.batchable) {
a.geometry.bind(c, b._resolveDirectShader(a));
}
return true;
}
function Jg(a, b) {
return a instanceof jg && (b.push(a), true);
}
var Kg = function (a) {
function b(b) {
var c = a.call(this, b) || this;
c.uploadHookHelper = c.renderer;
c.registerFindHook(Jg);
c.registerUploadHook(Hg);
c.registerUploadHook(Ig);
return c;
}
(function (a, b) {
function c() {
this.constructor = a;
}
yg(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
return b;
}(function () {
function a(a) {
var b = this;
this.limiter = new zg(Fa.UPLOADS_PER_FRAME);
this.renderer = a;
this.uploadHookHelper = null;
this.queue = [];
this.addHooks = [];
this.uploadHooks = [];
this.completes = [];
this.ticking = false;
this.delayedTick = function () {
if (b.queue) {
b.prepareItems();
}
};
this.registerFindHook(Fg);
this.registerFindHook(Gg);
this.registerFindHook(Ag);
this.registerFindHook(Bg);
this.registerFindHook(Cg);
this.registerUploadHook(Dg);
this.registerUploadHook(Eg);
}
a.prototype.upload = function (a, b) {
if (typeof a == "function") {
b = a;
a = null;
}
if (a) {
this.add(a);
}
if (this.queue.length) {
if (b) {
this.completes.push(b);
}
if (!this.ticking) {
this.ticking = true;
ic.system.addOnce(this.tick, this, ec.UTILITY);
}
} else if (b) {
b();
}
};
a.prototype.tick = function () {
setTimeout(this.delayedTick, 0);
};
a.prototype.prepareItems = function () {
for (this.limiter.beginFrame(); this.queue.length && this.limiter.allowedToUpload();) {
var a = this.queue[0];
var b = false;
if (a && !a._destroyed) {
for (var c = 0, d = this.uploadHooks.length; c < d; c++) {
if (this.uploadHooks[c](this.uploadHookHelper, a)) {
this.queue.shift();
b = true;
break;
}
}
}
if (!b) {
this.queue.shift();
}
}
if (this.queue.length) {
ic.system.addOnce(this.tick, this, ec.UTILITY);
} else {
this.ticking = false;
var e = this.completes.slice(0);
this.completes.length = 0;
c = 0;
d = e.length;
for (; c < d; c++) {
e[c]();
}
}
};
a.prototype.registerFindHook = function (a) {
if (a) {
this.addHooks.push(a);
}
return this;
};
a.prototype.registerUploadHook = function (a) {
if (a) {
this.uploadHooks.push(a);
}
return this;
};
a.prototype.add = function (a) {
for (var b = 0, c = this.addHooks.length; b < c && !this.addHooks[b](a, this.queue); b++);
if (a instanceof dc) {
for (b = a.children.length - 1; b >= 0; b--) {
this.add(a.children[b]);
}
}
return this;
};
a.prototype.destroy = function () {
if (this.ticking) {
ic.system.remove(this.tick, this);
}
this.ticking = false;
this.addHooks = null;
this.uploadHooks = null;
this.renderer = null;
this.completes = null;
this.queue = null;
this.limiter = null;
this.uploadHookHelper = null;
};
return a;
}());
(function () {
function a(a) {
this.maxMilliseconds = a;
this.frameStart = 0;
}
a.prototype.beginFrame = function () {
this.frameStart = Date.now();
};
a.prototype.allowedToUpload = function () {
return Date.now() - this.frameStart < this.maxMilliseconds;
};
})();
var Lg = function () {
function a(a, b, c) {
if (c === undefined) {
c = null;
}
this._texture = a instanceof Sc ? a : null;
this.baseTexture = a instanceof Bc ? a : this._texture.baseTexture;
this.textures = {};
this.animations = {};
this.data = b;
var d = this.baseTexture.resource;
this.resolution = this._updateResolution(c || (d ? d.url : null));
this._frames = this.data.frames;
this._frameKeys = Object.keys(this._frames);
this._batchIndex = 0;
this._callback = null;
}
a.prototype._updateResolution = function (a) {
if (a === undefined) {
a = null;
}
var b = this.data.meta.scale;
var c = jb(a, null);
if (c === null) {
c = b !== undefined ? parseFloat(b) : 1;
}
if (c !== 1) {
this.baseTexture.setResolution(c);
}
return c;
};
a.prototype.parse = function (b) {
this._batchIndex = 0;
this._callback = b;
if (this._frameKeys.length <= a.BATCH_SIZE) {
this._processFrames(0);
this._processAnimations();
this._parseComplete();
} else {
this._nextBatch();
}
};
a.prototype._processFrames = function (b) {
for (var c = b, d = a.BATCH_SIZE; c - b < d && c < this._frameKeys.length;) {
var e = this._frameKeys[c];
var f = this._frames[e];
var g = f.frame;
if (g) {
var h;
var i = null;
var j = f.trimmed !== false && f.sourceSize ? f.sourceSize : f.frame;
var k = new qb(0, 0, Math.floor(j.w) / this.resolution, Math.floor(j.h) / this.resolution);
h = f.rotated ? new qb(Math.floor(g.x) / this.resolution, Math.floor(g.y) / this.resolution, Math.floor(g.h) / this.resolution, Math.floor(g.w) / this.resolution) : new qb(Math.floor(g.x) / this.resolution, Math.floor(g.y) / this.resolution, Math.floor(g.w) / this.resolution, Math.floor(g.h) / this.resolution);
if (f.trimmed !== false && f.spriteSourceSize) {
i = new qb(Math.floor(f.spriteSourceSize.x) / this.resolution, Math.floor(f.spriteSourceSize.y) / this.resolution, Math.floor(g.w) / this.resolution, Math.floor(g.h) / this.resolution);
}
this.textures[e] = new Sc(this.baseTexture, h, k, i, f.rotated ? 2 : 0, f.anchor);
Sc.addToCache(this.textures[e], e);
}
c++;
}
};
a.prototype._processAnimations = function () {
var a = this.data.animations || {};
for (var b in a) {
this.animations[b] = [];
for (var c = 0; c < a[b].length; c++) {
var d = a[b][c];
this.animations[b].push(this.textures[d]);
}
}
};
a.prototype._parseComplete = function () {
var a = this._callback;
this._callback = null;
this._batchIndex = 0;
a.call(this, this.textures);
};
a.prototype._nextBatch = function () {
var b = this;
this._processFrames(this._batchIndex * a.BATCH_SIZE);
this._batchIndex++;
setTimeout(function () {
if (b._batchIndex * a.BATCH_SIZE < b._frameKeys.length) {
b._nextBatch();
} else {
b._processAnimations();
b._parseComplete();
}
}, 0);
};
a.prototype.destroy = function (a) {
var b;
if (a === undefined) {
a = false;
}
for (var c in this.textures) {
this.textures[c].destroy();
}
this._frames = null;
this._frameKeys = null;
this.data = null;
this.textures = null;
if (a) {
if ((b = this._texture) !== null && b !== undefined) {
b.destroy();
}
this.baseTexture.destroy();
}
this._texture = null;
this.baseTexture = null;
};
a.BATCH_SIZE = 1000;
return a;
}();
var Mg = function () {
function a() {}
a.use = function (b, c) {
var d = this;
var e = b.name + "_image";
if (b.data && b.type === We.TYPE.JSON && b.data.frames && !d.resources[e]) {
var f = b.data?.meta?.related_multi_packs;
if (Array.isArray(f)) {
for (var g = function (a) {
if (typeof a != "string") {
return "continue";
}
var c = a.replace(".json", "");
var e = La.resolve(b.url.replace(d.baseUrl, ""), a);
if (d.resources[c] || Object.values(d.resources).some(function (a) {
return La.format(La.parse(a.url)) === e;
})) {
return "continue";
}
var f = {
crossOrigin: b.crossOrigin,
loadType: We.LOAD_TYPE.XHR,
xhrType: We.XHR_RESPONSE_TYPE.JSON,
parentResource: b,
metadata: b.metadata
};
d.add(c, e, f);
}, h = 0, i = f; h < i.length; h++) {
g(i[h]);
}
}
var j = {
crossOrigin: b.crossOrigin,
metadata: b.metadata.imageMetadata,
parentResource: b
};
var k = a.getResourcePath(b, d.baseUrl);
d.add(e, k, j, function (a) {
if (a.error) {
c(a.error);
} else {
var d = new Lg(a.texture, b.data, b.url);
d.parse(function () {
b.spritesheet = d;
b.textures = d.textures;
c();
});
}
});
} else {
c();
}
};
a.getResourcePath = function (a, b) {
if (a.isDataUrl) {
return a.data.meta.image;
} else {
return La.resolve(a.url.replace(b, ""), a.data.meta.image);
}
};
return a;
}();
function Ng(a, b) {
Ng = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return Ng(a, b);
}
function Og(a, b) {
function c() {
this.constructor = a;
}
Ng(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
}
var Pg = new ob();
var Qg = function (a) {
function b(b, c, d) {
if (c === undefined) {
c = 100;
}
if (d === undefined) {
d = 100;
}
var e = a.call(this, b) || this;
e.tileTransform = new Fb();
e._width = c;
e._height = d;
e.uvMatrix = e.texture.uvMatrix || new Td(b);
e.pluginName = "tilingSprite";
e.uvRespectAnchor = false;
return e;
}
Og(b, a);
Object.defineProperty(b.prototype, "clampMargin", {
get: function () {
return this.uvMatrix.clampMargin;
},
set: function (a) {
this.uvMatrix.clampMargin = a;
this.uvMatrix.update(true);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "tileScale", {
get: function () {
return this.tileTransform.scale;
},
set: function (a) {
this.tileTransform.scale.copyFrom(a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "tilePosition", {
get: function () {
return this.tileTransform.position;
},
set: function (a) {
this.tileTransform.position.copyFrom(a);
},
enumerable: false,
configurable: true
});
b.prototype._onTextureUpdate = function () {
if (this.uvMatrix) {
this.uvMatrix.texture = this._texture;
}
this._cachedTint = 16777215;
};
b.prototype._render = function (a) {
var b = this._texture;
if (b && b.valid) {
this.tileTransform.updateLocalTransform();
this.uvMatrix.update();
a.batch.setObjectRenderer(a.plugins[this.pluginName]);
a.plugins[this.pluginName].render(this);
}
};
b.prototype._calculateBounds = function () {
var a = this._width * -this._anchor._x;
var b = this._height * -this._anchor._y;
var c = this._width * (1 - this._anchor._x);
var d = this._height * (1 - this._anchor._y);
this._bounds.addFrame(this.transform, a, b, c, d);
};
b.prototype.getLocalBounds = function (b) {
if (this.children.length === 0) {
this._bounds.minX = this._width * -this._anchor._x;
this._bounds.minY = this._height * -this._anchor._y;
this._bounds.maxX = this._width * (1 - this._anchor._x);
this._bounds.maxY = this._height * (1 - this._anchor._y);
if (!b) {
this._localBoundsRect ||= new qb();
b = this._localBoundsRect;
}
return this._bounds.getRectangle(b);
} else {
return a.prototype.getLocalBounds.call(this, b);
}
};
b.prototype.containsPoint = function (a) {
this.worldTransform.applyInverse(a, Pg);
var b = this._width;
var c = this._height;
var d = -b * this.anchor._x;
if (Pg.x >= d && Pg.x < d + b) {
var e = -c * this.anchor._y;
if (Pg.y >= e && Pg.y < e + c) {
return true;
}
}
return false;
};
b.prototype.destroy = function (b) {
a.prototype.destroy.call(this, b);
this.tileTransform = null;
this.uvMatrix = null;
};
b.from = function (a, c) {
return new b(a instanceof Sc ? a : Sc.from(a, c), c.width, c.height);
};
Object.defineProperty(b.prototype, "width", {
get: function () {
return this._width;
},
set: function (a) {
this._width = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "height", {
get: function () {
return this._height;
},
set: function (a) {
this._height = a;
},
enumerable: false,
configurable: true
});
return b;
}(ng);
var Rg = "#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n";
var Sg = new wb();
var Tg = function (a) {
function b(b) {
var c = a.call(this, b) || this;
b.runners.contextChange.add(c);
c.quad = new cd();
c.state = Qd.for2d();
return c;
}
Og(b, a);
b.prototype.contextChange = function () {
var a = this.renderer;
var b = {
globals: a.globalUniforms
};
this.simpleShader = Pd.from(Rg, "#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n", b);
this.shader = a.context.webGLVersion > 1 ? Pd.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n", "#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n", b) : Pd.from(Rg, "#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n", b);
};
b.prototype.render = function (a) {
var b = this.renderer;
var c = this.quad;
var d = c.vertices;
d[0] = d[6] = a._width * -a.anchor.x;
d[1] = d[3] = a._height * -a.anchor.y;
d[2] = d[4] = a._width * (1 - a.anchor.x);
d[5] = d[7] = a._height * (1 - a.anchor.y);
var e = a.uvRespectAnchor ? a.anchor.x : 0;
var f = a.uvRespectAnchor ? a.anchor.y : 0;
(d = c.uvs)[0] = d[6] = -e;
d[1] = d[3] = -f;
d[2] = d[4] = 1 - e;
d[5] = d[7] = 1 - f;
c.invalidate();
var g = a._texture;
var h = g.baseTexture;
var i = a.tileTransform.localTransform;
var j = a.uvMatrix;
var k = h.isPowerOfTwo && g.frame.width === h.width && g.frame.height === h.height;
if (k) {
if (h._glTextures[b.CONTEXT_UID]) {
k = h.wrapMode !== wa.CLAMP;
} else if (h.wrapMode === wa.CLAMP) {
h.wrapMode = wa.REPEAT;
}
}
var l = k ? this.simpleShader : this.shader;
var m = g.width;
var n = g.height;
var o = a._width;
var p = a._height;
Sg.set(i.a * m / o, i.b * m / p, i.c * n / o, i.d * n / p, i.tx / o, i.ty / p);
Sg.invert();
if (k) {
Sg.prepend(j.mapCoord);
} else {
l.uniforms.uMapCoord = j.mapCoord.toArray(true);
l.uniforms.uClampFrame = j.uClampFrame;
l.uniforms.uClampOffset = j.uClampOffset;
}
l.uniforms.uTransform = Sg.toArray(true);
l.uniforms.uColor = Va(a.tint, a.worldAlpha, l.uniforms.uColor, h.alphaMode);
l.uniforms.translationMatrix = a.transform.worldTransform.toArray(true);
l.uniforms.uSampler = g;
b.shader.bind(l);
b.geometry.bind(c);
this.state.blendMode = Ta(a.blendMode, h.alphaMode);
b.state.set(this.state);
b.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);
};
return b;
}(jd);
function Ug(a, b) {
Ug = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return Ug(a, b);
}
function Vg(a, b) {
function c() {
this.constructor = a;
}
Ug(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
}
var Wg = function () {
function a(a, b) {
this.uvBuffer = a;
this.uvMatrix = b;
this.data = null;
this._bufferUpdateId = -1;
this._textureUpdateId = -1;
this._updateID = 0;
}
a.prototype.update = function (a) {
if (a || this._bufferUpdateId !== this.uvBuffer._updateID || this._textureUpdateId !== this.uvMatrix._updateID) {
this._bufferUpdateId = this.uvBuffer._updateID;
this._textureUpdateId = this.uvMatrix._updateID;
var b = this.uvBuffer.data;
if (!this.data || this.data.length !== b.length) {
this.data = new Float32Array(b.length);
}
this.uvMatrix.multiplyUvs(b, this.data);
this._updateID++;
}
};
return a;
}();
var Xg = new ob();
var Yg = new tb();
var Zg = function (a) {
function b(b, c, d, e) {
if (e === undefined) {
e = qa.TRIANGLES;
}
var f = a.call(this) || this;
f.geometry = b;
f.shader = c;
f.state = d || Qd.for2d();
f.drawMode = e;
f.start = 0;
f.size = 0;
f.uvs = null;
f.indices = null;
f.vertexData = new Float32Array(1);
f.vertexDirty = -1;
f._transformID = -1;
f._roundPixels = Fa.ROUND_PIXELS;
f.batchUvs = null;
return f;
}
Vg(b, a);
Object.defineProperty(b.prototype, "geometry", {
get: function () {
return this._geometry;
},
set: function (a) {
if (this._geometry !== a) {
if (this._geometry) {
this._geometry.refCount--;
if (this._geometry.refCount === 0) {
this._geometry.dispose();
}
}
this._geometry = a;
if (this._geometry) {
this._geometry.refCount++;
}
this.vertexDirty = -1;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "uvBuffer", {
get: function () {
return this.geometry.buffers[1];
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "verticesBuffer", {
get: function () {
return this.geometry.buffers[0];
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "material", {
get: function () {
return this.shader;
},
set: function (a) {
this.shader = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "blendMode", {
get: function () {
return this.state.blendMode;
},
set: function (a) {
this.state.blendMode = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "roundPixels", {
get: function () {
return this._roundPixels;
},
set: function (a) {
if (this._roundPixels !== a) {
this._transformID = -1;
}
this._roundPixels = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "tint", {
get: function () {
if ("tint" in this.shader) {
return this.shader.tint;
} else {
return null;
}
},
set: function (a) {
this.shader.tint = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "texture", {
get: function () {
if ("texture" in this.shader) {
return this.shader.texture;
} else {
return null;
}
},
set: function (a) {
this.shader.texture = a;
},
enumerable: false,
configurable: true
});
b.prototype._render = function (a) {
var c = this.geometry.buffers[0].data;
if (this.shader.batchable && this.drawMode === qa.TRIANGLES && c.length < b.BATCHABLE_SIZE * 2) {
this._renderToBatch(a);
} else {
this._renderDefault(a);
}
};
b.prototype._renderDefault = function (a) {
var b = this.shader;
b.alpha = this.worldAlpha;
if (b.update) {
b.update();
}
a.batch.flush();
b.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);
a.shader.bind(b);
a.state.set(this.state);
a.geometry.bind(this.geometry, b);
a.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);
};
b.prototype._renderToBatch = function (a) {
var b = this.geometry;
var c = this.shader;
if (c.uvMatrix) {
c.uvMatrix.update();
this.calculateUvs();
}
this.calculateVertices();
this.indices = b.indexBuffer.data;
this._tintRGB = c._tintRGB;
this._texture = c.texture;
var d = this.material.pluginName;
a.batch.setObjectRenderer(a.plugins[d]);
a.plugins[d].render(this);
};
b.prototype.calculateVertices = function () {
var a = this.geometry.buffers[0];
var b = a.data;
var c = a._updateID;
if (c !== this.vertexDirty || this._transformID !== this.transform._worldID) {
this._transformID = this.transform._worldID;
if (this.vertexData.length !== b.length) {
this.vertexData = new Float32Array(b.length);
}
for (var d = this.transform.worldTransform, e = d.a, f = d.b, g = d.c, h = d.d, i = d.tx, j = d.ty, k = this.vertexData, l = 0; l < k.length / 2; l++) {
var m = b[l * 2];
var n = b[l * 2 + 1];
k[l * 2] = e * m + g * n + i;
k[l * 2 + 1] = f * m + h * n + j;
}
if (this._roundPixels) {
var o = Fa.RESOLUTION;
for (l = 0; l < k.length; ++l) {
k[l] = Math.round((k[l] * o | 0) / o);
}
}
this.vertexDirty = c;
}
};
b.prototype.calculateUvs = function () {
var a = this.geometry.buffers[1];
var b = this.shader;
if (b.uvMatrix.isSimple) {
this.uvs = a.data;
} else {
this.batchUvs ||= new Wg(a, b.uvMatrix);
this.batchUvs.update();
this.uvs = this.batchUvs.data;
}
};
b.prototype._calculateBounds = function () {
this.calculateVertices();
this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);
};
b.prototype.containsPoint = function (a) {
if (!this.getBounds().contains(a.x, a.y)) {
return false;
}
this.worldTransform.applyInverse(a, Xg);
for (var b = this.geometry.getBuffer("aVertexPosition").data, c = Yg.points, d = this.geometry.getIndex().data, e = d.length, f = this.drawMode === 4 ? 3 : 1, g = 0; g + 2 < e; g += f) {
var h = d[g] * 2;
var i = d[g + 1] * 2;
var j = d[g + 2] * 2;
c[0] = b[h];
c[1] = b[h + 1];
c[2] = b[i];
c[3] = b[i + 1];
c[4] = b[j];
c[5] = b[j + 1];
if (Yg.contains(Xg.x, Xg.y)) {
return true;
}
}
return false;
};
b.prototype.destroy = function (b) {
a.prototype.destroy.call(this, b);
if (this._cachedTexture) {
this._cachedTexture.destroy();
this._cachedTexture = null;
}
this.geometry = null;
this.shader = null;
this.state = null;
this.uvs = null;
this.indices = null;
this.vertexData = null;
};
b.BATCHABLE_SIZE = 100;
return b;
}(dc);
var $g = function (a) {
function b(b, c) {
var d = this;
var e = {
uSampler: b,
alpha: 1,
uTextureMatrix: wb.IDENTITY,
uColor: new Float32Array([1, 1, 1, 1])
};
if ((c = Object.assign({
tint: 16777215,
alpha: 1,
pluginName: "batch"
}, c)).uniforms) {
Object.assign(e, c.uniforms);
}
(d = a.call(this, c.program || Od.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n", "varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"), e) || this)._colorDirty = false;
d.uvMatrix = new Td(b);
d.batchable = c.program === undefined;
d.pluginName = c.pluginName;
d.tint = c.tint;
d.alpha = c.alpha;
return d;
}
Vg(b, a);
Object.defineProperty(b.prototype, "texture", {
get: function () {
return this.uniforms.uSampler;
},
set: function (a) {
if (this.uniforms.uSampler !== a) {
this.uniforms.uSampler = a;
this.uvMatrix.texture = a;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "alpha", {
get: function () {
return this._alpha;
},
set: function (a) {
if (a !== this._alpha) {
this._alpha = a;
this._colorDirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "tint", {
get: function () {
return this._tint;
},
set: function (a) {
if (a !== this._tint) {
this._tint = a;
this._tintRGB = (a >> 16) + (a & 65280) + ((a & 255) << 16);
this._colorDirty = true;
}
},
enumerable: false,
configurable: true
});
b.prototype.update = function () {
if (this._colorDirty) {
this._colorDirty = false;
var a = this.texture.baseTexture;
Va(this._tint, this._alpha, this.uniforms.uColor, a.alphaMode);
}
if (this.uvMatrix.update()) {
this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;
}
};
return b;
}(Pd);
var _g = function (a) {
function b(b, c, d) {
var e = a.call(this) || this;
var f = new Xc(b);
var g = new Xc(c, true);
var h = new Xc(d, true, true);
e.addAttribute("aVertexPosition", f, 2, false, ta.FLOAT).addAttribute("aTextureCoord", g, 2, false, ta.FLOAT).addIndex(h);
e._updateId = -1;
return e;
}
Vg(b, a);
Object.defineProperty(b.prototype, "vertexDirtyId", {
get: function () {
return this.buffers[0]._updateID;
},
enumerable: false,
configurable: true
});
return b;
}(ad);
function ah(a, b) {
ah = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return ah(a, b);
}
function bh() {
this.info = [];
this.common = [];
this.page = [];
this.char = [];
this.kerning = [];
this.distanceField = [];
}
var ch = function () {
function a() {}
a.test = function (a) {
return typeof a == "string" && a.indexOf("info face=") === 0;
};
a.parse = function (a) {
var b = a.match(/^[a-z]+\s+.+$/gm);
var c = {
info: [],
common: [],
page: [],
char: [],
chars: [],
kerning: [],
kernings: [],
distanceField: []
};
for (var d in b) {
var e = b[d].match(/^[a-z]+/gm)[0];
var f = b[d].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm);
var g = {};
for (var h in f) {
var i = f[h].split("=");
var j = i[0];
var k = i[1].replace(/"/gm, "");
var l = parseFloat(k);
var m = isNaN(l) ? k : l;
g[j] = m;
}
c[e].push(g);
}
var n = new bh();
c.info.forEach(function (a) {
return n.info.push({
face: a.face,
size: parseInt(a.size, 10)
});
});
c.common.forEach(function (a) {
return n.common.push({
lineHeight: parseInt(a.lineHeight, 10)
});
});
c.page.forEach(function (a) {
return n.page.push({
id: parseInt(a.id, 10),
file: a.file
});
});
c.char.forEach(function (a) {
return n.char.push({
id: parseInt(a.id, 10),
page: parseInt(a.page, 10),
x: parseInt(a.x, 10),
y: parseInt(a.y, 10),
width: parseInt(a.width, 10),
height: parseInt(a.height, 10),
xoffset: parseInt(a.xoffset, 10),
yoffset: parseInt(a.yoffset, 10),
xadvance: parseInt(a.xadvance, 10)
});
});
c.kerning.forEach(function (a) {
return n.kerning.push({
first: parseInt(a.first, 10),
second: parseInt(a.second, 10),
amount: parseInt(a.amount, 10)
});
});
c.distanceField.forEach(function (a) {
return n.distanceField.push({
distanceRange: parseInt(a.distanceRange, 10),
fieldType: a.fieldType
});
});
return n;
};
return a;
}();
var dh = function () {
function a() {}
a.test = function (a) {
return a instanceof XMLDocument && a.getElementsByTagName("page").length && a.getElementsByTagName("info")[0].getAttribute("face") !== null;
};
a.parse = function (a) {
for (var b = new bh(), c = a.getElementsByTagName("info"), d = a.getElementsByTagName("common"), e = a.getElementsByTagName("page"), f = a.getElementsByTagName("char"), g = a.getElementsByTagName("kerning"), h = a.getElementsByTagName("distanceField"), i = 0; i < c.length; i++) {
b.info.push({
face: c[i].getAttribute("face"),
size: parseInt(c[i].getAttribute("size"), 10)
});
}
for (i = 0; i < d.length; i++) {
b.common.push({
lineHeight: parseInt(d[i].getAttribute("lineHeight"), 10)
});
}
for (i = 0; i < e.length; i++) {
b.page.push({
id: parseInt(e[i].getAttribute("id"), 10) || 0,
file: e[i].getAttribute("file")
});
}
for (i = 0; i < f.length; i++) {
var j = f[i];
b.char.push({
id: parseInt(j.getAttribute("id"), 10),
page: parseInt(j.getAttribute("page"), 10) || 0,
x: parseInt(j.getAttribute("x"), 10),
y: parseInt(j.getAttribute("y"), 10),
width: parseInt(j.getAttribute("width"), 10),
height: parseInt(j.getAttribute("height"), 10),
xoffset: parseInt(j.getAttribute("xoffset"), 10),
yoffset: parseInt(j.getAttribute("yoffset"), 10),
xadvance: parseInt(j.getAttribute("xadvance"), 10)
});
}
for (i = 0; i < g.length; i++) {
b.kerning.push({
first: parseInt(g[i].getAttribute("first"), 10),
second: parseInt(g[i].getAttribute("second"), 10),
amount: parseInt(g[i].getAttribute("amount"), 10)
});
}
for (i = 0; i < h.length; i++) {
b.distanceField.push({
fieldType: h[i].getAttribute("fieldType"),
distanceRange: parseInt(h[i].getAttribute("distanceRange"), 10)
});
}
return b;
};
return a;
}();
var eh = function () {
function a() {}
a.test = function (a) {
if (typeof a == "string" && a.indexOf("<font>") > -1) {
var b = new globalThis.DOMParser().parseFromString(a, "text/xml");
return dh.test(b);
}
return false;
};
a.parse = function (a) {
var b = new globalThis.DOMParser().parseFromString(a, "text/xml");
return dh.parse(b);
};
return a;
}();
var fh = [ch, dh, eh];
function gh(a) {
for (var b = 0; b < fh.length; b++) {
if (fh[b].test(a)) {
return fh[b];
}
}
return null;
}
function hh(a, b, c, d, e, f, g) {
var h = c.text;
var i = c.fontProperties;
b.translate(d, e);
b.scale(f, f);
var j = g.strokeThickness / 2;
var k = -g.strokeThickness / 2;
b.font = g.toFontString();
b.lineWidth = g.strokeThickness;
b.textBaseline = g.textBaseline;
b.lineJoin = g.lineJoin;
b.miterLimit = g.miterLimit;
b.fillStyle = function (a, b, c, d, e, f) {
var g;
var h = c.fill;
if (!Array.isArray(h)) {
return h;
}
if (h.length === 1) {
return h[0];
}
var i = c.dropShadow ? c.dropShadowDistance : 0;
var j = c.padding || 0;
var k = a.width / d - i - j * 2;
var l = a.height / d - i - j * 2;
var m = h.slice();
var n = c.fillGradientStops.slice();
if (!n.length) {
for (var o = m.length + 1, p = 1; p < o; ++p) {
n.push(p / o);
}
}
m.unshift(h[0]);
n.unshift(0);
m.push(h[h.length - 1]);
n.push(1);
if (c.fillGradientType === Wf.LINEAR_VERTICAL) {
g = b.createLinearGradient(k / 2, j, k / 2, l + j);
var q = 0;
var r = (f.fontProperties.fontSize + c.strokeThickness) / l;
for (p = 0; p < e.length; p++) {
for (var s = f.lineHeight * p, t = 0; t < m.length; t++) {
var u = s / l + (typeof n[t] == "number" ? n[t] : t / m.length) * r;
var v = Math.max(q, u);
v = Math.min(v, 1);
g.addColorStop(v, m[t]);
q = v;
}
}
} else {
g = b.createLinearGradient(j, l / 2, k + j, l / 2);
var w = m.length + 1;
var x = 1;
for (p = 0; p < m.length; p++) {
var y;
y = typeof n[p] == "number" ? n[p] : x / w;
g.addColorStop(y, m[p]);
x++;
}
}
return g;
}(a, b, g, f, [h], c);
b.strokeStyle = g.stroke;
if (g.dropShadow) {
var l = g.dropShadowColor;
var m = Pa(typeof l == "number" ? l : Ra(l));
var n = g.dropShadowBlur * f;
var o = g.dropShadowDistance * f;
b.shadowColor = "rgba(" + m[0] * 255 + "," + m[1] * 255 + "," + m[2] * 255 + "," + g.dropShadowAlpha + ")";
b.shadowBlur = n;
b.shadowOffsetX = Math.cos(g.dropShadowAngle) * o;
b.shadowOffsetY = Math.sin(g.dropShadowAngle) * o;
} else {
b.shadowColor = "black";
b.shadowBlur = 0;
b.shadowOffsetX = 0;
b.shadowOffsetY = 0;
}
if (g.stroke && g.strokeThickness) {
b.strokeText(h, j, k + c.lineHeight - i.descent);
}
if (g.fill) {
b.fillText(h, j, k + c.lineHeight - i.descent);
}
b.setTransform(1, 0, 0, 1, 0, 0);
b.fillStyle = "rgba(0, 0, 0, 0)";
}
function ih(a) {
if (Array.from) {
return Array.from(a);
} else {
return a.split("");
}
}
function jh(a) {
if (a.codePointAt) {
return a.codePointAt(0);
} else {
return a.charCodeAt(0);
}
}
var kh = function () {
function a(a, b, c) {
var d;
var e = a.info[0];
var f = a.common[0];
var g = a.page[0];
var h = a.distanceField[0];
var i = jb(g.file);
var j = {};
this._ownsTextures = c;
this.font = e.face;
this.size = e.size;
this.lineHeight = f.lineHeight / i;
this.chars = {};
this.pageTextures = j;
for (var k = 0; k < a.page.length; k++) {
var l = a.page[k];
var m = l.id;
var n = l.file;
j[m] = b instanceof Array ? b[k] : b[n];
if ((h == null ? undefined : h.fieldType) && h.fieldType !== "none") {
j[m].baseTexture.alphaMode = ya.NO_PREMULTIPLIED_ALPHA;
}
}
for (k = 0; k < a.char.length; k++) {
var o = a.char[k];
m = o.id;
var p = o.page;
var q = a.char[k];
var r = q.x;
var s = q.y;
var t = q.width;
var u = q.height;
var v = q.xoffset;
var w = q.yoffset;
var x = q.xadvance;
s /= i;
t /= i;
u /= i;
v /= i;
w /= i;
x /= i;
var y = new qb((r /= i) + j[p].frame.x / i, s + j[p].frame.y / i, t, u);
this.chars[m] = {
xOffset: v,
yOffset: w,
xAdvance: x,
kerning: {},
texture: new Sc(j[p].baseTexture, y),
page: p
};
}
for (k = 0; k < a.kerning.length; k++) {
var z = a.kerning[k];
var A = z.first;
var B = z.second;
var C = z.amount;
A /= i;
B /= i;
C /= i;
if (this.chars[B]) {
this.chars[B].kerning[A] = C;
}
}
this.distanceFieldRange = h == null ? undefined : h.distanceRange;
this.distanceFieldType = ((d = h == null ? undefined : h.fieldType) === null || d === undefined ? undefined : d.toLowerCase()) ?? "none";
}
a.prototype.destroy = function () {
for (var a in this.chars) {
this.chars[a].texture.destroy();
this.chars[a].texture = null;
}
for (var a in this.pageTextures) {
if (this._ownsTextures) {
this.pageTextures[a].destroy(true);
}
this.pageTextures[a] = null;
}
this.chars = null;
this.pageTextures = null;
};
a.install = function (b, c, d) {
var e;
if (b instanceof bh) {
e = b;
} else {
var f = gh(b);
if (!f) {
throw new Error("Unrecognized data format for font.");
}
e = f.parse(b);
}
if (c instanceof Sc) {
c = [c];
}
var g = new a(e, c, d);
a.available[g.font] = g;
return g;
};
a.uninstall = function (b) {
var c = a.available[b];
if (!c) {
throw new Error("No font found named '" + b + "'");
}
c.destroy();
delete a.available[b];
};
a.from = function (b, c, d) {
if (!b) {
throw new Error("[BitmapFont] Property `name` is required.");
}
var e = Object.assign({}, a.defaultOptions, d);
var f = e.chars;
var g = e.padding;
var h = e.resolution;
var i = e.textureWidth;
var j = e.textureHeight;
var k = function (a) {
if (typeof a == "string") {
a = [a];
}
for (var b = [], c = 0, d = a.length; c < d; c++) {
var e = a[c];
if (Array.isArray(e)) {
if (e.length !== 2) {
throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got " + e.length + ".");
}
var f = e[0].charCodeAt(0);
var g = e[1].charCodeAt(0);
if (g < f) {
throw new Error("[BitmapFont]: Invalid character range.");
}
for (var h = f, i = g; h <= i; h++) {
b.push(String.fromCharCode(h));
}
} else {
b.push.apply(b, ih(e));
}
}
if (b.length === 0) {
throw new Error("[BitmapFont]: Empty set when resolving characters.");
}
return b;
}(f);
var l = c instanceof rg ? c : new rg(c);
var m = i;
var n = new bh();
n.info[0] = {
face: l.fontFamily,
size: l.fontSize
};
n.common[0] = {
lineHeight: l.fontSize
};
for (var o, p, q, r = 0, s = 0, t = 0, u = [], v = 0; v < k.length; v++) {
if (!o) {
(o = document.createElement("canvas")).width = i;
o.height = j;
p = o.getContext("2d");
q = new Bc(o, {
resolution: h
});
u.push(new Sc(q));
n.page.push({
id: u.length - 1,
file: ""
});
}
var w = vg.measureText(k[v], l, false, o);
var x = w.width;
var y = Math.ceil(w.height);
var z = Math.ceil((l.fontStyle === "italic" ? 2 : 1) * x);
if (s >= j - y * h) {
if (s === 0) {
throw new Error("[BitmapFont] textureHeight " + j + "px is too small for " + l.fontSize + "px fonts");
}
--v;
o = null;
p = null;
q = null;
s = 0;
r = 0;
t = 0;
} else {
t = Math.max(y + w.fontProperties.descent, t);
if (z * h + r >= m) {
--v;
s += t * h;
s = Math.ceil(s);
r = 0;
t = 0;
} else {
hh(o, p, w, r, s, h, l);
var A = jh(w.text);
n.char.push({
id: A,
page: u.length - 1,
x: r / h,
y: s / h,
width: z,
height: y,
xoffset: 0,
yoffset: 0,
xadvance: Math.ceil(x - (l.dropShadow ? l.dropShadowDistance : 0) - (l.stroke ? l.strokeThickness : 0))
});
r += (z + g * 2) * h;
r = Math.ceil(r);
}
}
}
v = 0;
for (var B = k.length; v < B; v++) {
for (var C = k[v], D = 0; D < B; D++) {
var E = k[D];
var F = p.measureText(C).width;
var G = p.measureText(E).width;
var H = p.measureText(C + E).width - (F + G);
if (H) {
n.kerning.push({
first: jh(C),
second: jh(E),
amount: H
});
}
}
}
var I = new a(n, u, true);
if (a.available[b] !== undefined) {
a.uninstall(b);
}
a.available[b] = I;
return I;
};
a.ALPHA = [
["a", "z"],
["A", "Z"], " "
];
a.NUMERIC = [
["0", "9"]
];
a.ALPHANUMERIC = [
["a", "z"],
["A", "Z"],
["0", "9"], " "
];
a.ASCII = [
[" ", "~"]
];
a.defaultOptions = {
resolution: 1,
textureWidth: 512,
textureHeight: 512,
padding: 4,
chars: a.ALPHANUMERIC
};
a.available = {};
return a;
}();
var lh = [];
var mh = [];
var nh = [];
(function (a) {
function b(c, d) {
if (d === undefined) {
d = {};
}
var e = a.call(this) || this;
e._tint = 16777215;
var f = Object.assign({}, b.styleDefaults, d);
var g = f.align;
var h = f.tint;
var i = f.maxWidth;
var j = f.letterSpacing;
var k = f.fontName;
var l = f.fontSize;
if (!kh.available[k]) {
throw new Error("Missing BitmapFont \"" + k + "\"");
}
e._activePagesMeshData = [];
e._textWidth = 0;
e._textHeight = 0;
e._align = g;
e._tint = h;
e._fontName = k;
e._fontSize = l || kh.available[k].size;
e.text = c;
e._maxWidth = i;
e._maxLineHeight = 0;
e._letterSpacing = j;
e._anchor = new vb(function () {
e.dirty = true;
}, e, 0, 0);
e._roundPixels = Fa.ROUND_PIXELS;
e.dirty = true;
e._textureCache = {};
return e;
}
(function (a, b) {
function c() {
this.constructor = a;
}
ah(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
b.prototype.updateText = function () {
for (var a = kh.available[this._fontName], b = this._fontSize / a.size, c = new ob(), d = [], e = [], f = [], g = ih(this._text.replace(/(?:\r\n|\r)/g, "\n") || " "), h = this._maxWidth * a.size / this._fontSize, i = a.distanceFieldType === "none" ? lh : mh, j = null, k = 0, l = 0, m = 0, n = -1, o = 0, p = 0, q = 0, r = 0, s = 0; s < g.length; s++) {
var t = jh(N = g[s]);
if (/(?:\s)/.test(N)) {
n = s;
o = k;
r++;
}
if (N !== "\r" && N !== "\n") {
var u = a.chars[t];
if (u) {
if (j && u.kerning[j]) {
c.x += u.kerning[j];
}
var v = nh.pop() || {
texture: Sc.EMPTY,
line: 0,
charCode: 0,
prevSpaces: 0,
position: new ob()
};
v.texture = u.texture;
v.line = m;
v.charCode = t;
v.position.x = c.x + u.xOffset + this._letterSpacing / 2;
v.position.y = c.y + u.yOffset;
v.prevSpaces = r;
d.push(v);
k = v.position.x + Math.max(u.xAdvance, u.texture.orig.width);
c.x += u.xAdvance + this._letterSpacing;
q = Math.max(q, u.yOffset + u.texture.height);
j = t;
if (n !== -1 && h > 0 && c.x > h) {
$a(d, 1 + n - ++p, 1 + s - n);
s = n;
n = -1;
e.push(o);
f.push(d.length > 0 ? d[d.length - 1].prevSpaces : 0);
l = Math.max(l, o);
m++;
c.x = 0;
c.y += a.lineHeight;
j = null;
r = 0;
}
}
} else {
e.push(k);
f.push(-1);
l = Math.max(l, k);
++m;
++p;
c.x = 0;
c.y += a.lineHeight;
j = null;
r = 0;
}
}
var w = g[g.length - 1];
if (w !== "\r" && w !== "\n") {
if (/(?:\s)/.test(w)) {
k = o;
}
e.push(k);
l = Math.max(l, k);
f.push(-1);
}
var x = [];
for (s = 0; s <= m; s++) {
var y = 0;
if (this._align === "right") {
y = l - e[s];
} else if (this._align === "center") {
y = (l - e[s]) / 2;
} else if (this._align === "justify") {
y = f[s] < 0 ? 0 : (l - e[s]) / f[s];
}
x.push(y);
}
var z = d.length;
var A = {};
var B = [];
var C = this._activePagesMeshData;
for (s = 0; s < C.length; s++) {
i.push(C[s]);
}
for (s = 0; s < z; s++) {
var D = (P = d[s].texture).baseTexture.uid;
if (!A[D]) {
if (!(W = i.pop())) {
var E = new _g();
var F = undefined;
var G = undefined;
if (a.distanceFieldType === "none") {
F = new $g(Sc.EMPTY);
G = pa.NORMAL;
} else {
F = new $g(Sc.EMPTY, {
program: Od.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n", "// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n // MSDF\r\n float median = texColor.r + texColor.g + texColor.b -\r\n min(texColor.r, min(texColor.g, texColor.b)) -\r\n max(texColor.r, max(texColor.g, texColor.b));\r\n // SDF\r\n median = min(median, texColor.a);\r\n\r\n float screenPxDistance = uFWidth * (median - 0.5);\r\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),
uniforms: {
uFWidth: 0
}
});
G = pa.NORMAL_NPM;
}
var H = new Zg(E, F);
H.blendMode = G;
W = {
index: 0,
indexCount: 0,
vertexCount: 0,
uvsCount: 0,
total: 0,
mesh: H,
vertices: null,
uvs: null,
indices: null
};
}
W.index = 0;
W.indexCount = 0;
W.vertexCount = 0;
W.uvsCount = 0;
W.total = 0;
var I = this._textureCache;
I[D] = I[D] || new Sc(P.baseTexture);
W.mesh.texture = I[D];
W.mesh.tint = this._tint;
B.push(W);
A[D] = W;
}
A[D].total++;
}
for (s = 0; s < C.length; s++) {
if (B.indexOf(C[s]) === -1) {
this.removeChild(C[s].mesh);
}
}
for (s = 0; s < B.length; s++) {
if (B[s].mesh.parent !== this) {
this.addChild(B[s].mesh);
}
}
this._activePagesMeshData = B;
for (var s in A) {
var J = (W = A[s]).total;
if (W.indices?.length <= J * 6 || W.vertices.length < Zg.BATCHABLE_SIZE * 2) {
W.vertices = new Float32Array(J * 8);
W.uvs = new Float32Array(J * 8);
W.indices = new Uint16Array(J * 6);
} else {
for (var K = W.total, L = W.vertices, M = K * 4 * 2; M < L.length; M++) {
L[M] = 0;
}
}
W.mesh.size = J * 6;
}
for (s = 0; s < z; s++) {
var N;
var O = (N = d[s]).position.x + x[N.line] * (this._align === "justify" ? N.prevSpaces : 1);
if (this._roundPixels) {
O = Math.round(O);
}
var P;
var Q = O * b;
var R = N.position.y * b;
var S = A[(P = N.texture).baseTexture.uid];
var T = P.frame;
var U = P._uvs;
var V = S.index++;
S.indices[V * 6 + 0] = 0 + V * 4;
S.indices[V * 6 + 1] = 1 + V * 4;
S.indices[V * 6 + 2] = 2 + V * 4;
S.indices[V * 6 + 3] = 0 + V * 4;
S.indices[V * 6 + 4] = 2 + V * 4;
S.indices[V * 6 + 5] = 3 + V * 4;
S.vertices[V * 8 + 0] = Q;
S.vertices[V * 8 + 1] = R;
S.vertices[V * 8 + 2] = Q + T.width * b;
S.vertices[V * 8 + 3] = R;
S.vertices[V * 8 + 4] = Q + T.width * b;
S.vertices[V * 8 + 5] = R + T.height * b;
S.vertices[V * 8 + 6] = Q;
S.vertices[V * 8 + 7] = R + T.height * b;
S.uvs[V * 8 + 0] = U.x0;
S.uvs[V * 8 + 1] = U.y0;
S.uvs[V * 8 + 2] = U.x1;
S.uvs[V * 8 + 3] = U.y1;
S.uvs[V * 8 + 4] = U.x2;
S.uvs[V * 8 + 5] = U.y2;
S.uvs[V * 8 + 6] = U.x3;
S.uvs[V * 8 + 7] = U.y3;
}
this._textWidth = l * b;
this._textHeight = (c.y + a.lineHeight) * b;
for (var s in A) {
var W = A[s];
if (this.anchor.x !== 0 || this.anchor.y !== 0) {
for (var X = 0, Y = this._textWidth * this.anchor.x, Z = this._textHeight * this.anchor.y, $ = 0; $ < W.total; $++) {
W.vertices[X++] -= Y;
W.vertices[X++] -= Z;
W.vertices[X++] -= Y;
W.vertices[X++] -= Z;
W.vertices[X++] -= Y;
W.vertices[X++] -= Z;
W.vertices[X++] -= Y;
W.vertices[X++] -= Z;
}
}
this._maxLineHeight = q * b;
var _ = W.mesh.geometry.getBuffer("aVertexPosition");
var aa = W.mesh.geometry.getBuffer("aTextureCoord");
var ba = W.mesh.geometry.getIndex();
_.data = W.vertices;
aa.data = W.uvs;
ba.data = W.indices;
_.update();
aa.update();
ba.update();
}
for (s = 0; s < d.length; s++) {
nh.push(d[s]);
}
};
b.prototype.updateTransform = function () {
this.validate();
this.containerUpdateTransform();
};
b.prototype._render = function (b) {
var c = kh.available[this._fontName];
var d = c.distanceFieldRange;
var e = c.distanceFieldType;
var f = c.size;
if (e !== "none") {
for (var g = this.worldTransform, h = g.a, i = g.b, j = g.c, k = g.d, l = Math.sqrt(h * h + i * i), m = Math.sqrt(j * j + k * k), n = (Math.abs(l) + Math.abs(m)) / 2, o = this._fontSize / f, p = 0, q = this._activePagesMeshData; p < q.length; p++) {
q[p].mesh.shader.uniforms.uFWidth = n * d * o * b.resolution;
}
}
a.prototype._render.call(this, b);
};
b.prototype.getLocalBounds = function () {
this.validate();
return a.prototype.getLocalBounds.call(this);
};
b.prototype.validate = function () {
if (this.dirty) {
this.updateText();
this.dirty = false;
}
};
Object.defineProperty(b.prototype, "tint", {
get: function () {
return this._tint;
},
set: function (a) {
if (this._tint !== a) {
this._tint = a;
for (var b = 0; b < this._activePagesMeshData.length; b++) {
this._activePagesMeshData[b].mesh.tint = a;
}
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "align", {
get: function () {
return this._align;
},
set: function (a) {
if (this._align !== a) {
this._align = a;
this.dirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "fontName", {
get: function () {
return this._fontName;
},
set: function (a) {
if (!kh.available[a]) {
throw new Error("Missing BitmapFont \"" + a + "\"");
}
if (this._fontName !== a) {
this._fontName = a;
this.dirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "fontSize", {
get: function () {
return this._fontSize;
},
set: function (a) {
if (this._fontSize !== a) {
this._fontSize = a;
this.dirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "anchor", {
get: function () {
return this._anchor;
},
set: function (a) {
if (typeof a == "number") {
this._anchor.set(a);
} else {
this._anchor.copyFrom(a);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "text", {
get: function () {
return this._text;
},
set: function (a) {
a = String(a == null ? "" : a);
if (this._text !== a) {
this._text = a;
this.dirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "maxWidth", {
get: function () {
return this._maxWidth;
},
set: function (a) {
if (this._maxWidth !== a) {
this._maxWidth = a;
this.dirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "maxLineHeight", {
get: function () {
this.validate();
return this._maxLineHeight;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "textWidth", {
get: function () {
this.validate();
return this._textWidth;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "letterSpacing", {
get: function () {
return this._letterSpacing;
},
set: function (a) {
if (this._letterSpacing !== a) {
this._letterSpacing = a;
this.dirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "roundPixels", {
get: function () {
return this._roundPixels;
},
set: function (a) {
if (a !== this._roundPixels) {
this._roundPixels = a;
this.dirty = true;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "textHeight", {
get: function () {
this.validate();
return this._textHeight;
},
enumerable: false,
configurable: true
});
b.prototype.destroy = function (b) {
var c = this._textureCache;
for (var d in c) {
c[d].destroy();
delete c[d];
}
this._textureCache = null;
a.prototype.destroy.call(this, b);
};
b.styleDefaults = {
align: "left",
tint: 16777215,
maxWidth: 0,
letterSpacing: 0
};
})(dc);
var oh = function () {
function a() {}
a.add = function () {
We.setExtensionXhrType("fnt", We.XHR_RESPONSE_TYPE.TEXT);
};
a.use = function (b, c) {
var d = gh(b.data);
if (d) {
for (var e = a.getBaseUrl(this, b), f = d.parse(b.data), g = {}, h = function (a) {
g[a.metadata.pageFile] = a.texture;
if (Object.keys(g).length === f.page.length) {
b.bitmapFont = kh.install(f, g, true);
c();
}
}, i = 0; i < f.page.length; ++i) {
var j = f.page[i].file;
var k = e + j;
var l = false;
for (var m in this.resources) {
var n = this.resources[m];
if (n.url === k) {
n.metadata.pageFile = j;
if (n.texture) {
h(n);
} else {
n.onAfterMiddleware.add(h);
}
l = true;
break;
}
}
if (!l) {
var o = {
crossOrigin: b.crossOrigin,
loadType: We.LOAD_TYPE.IMAGE,
metadata: Object.assign({
pageFile: j
}, b.metadata.imageMetadata),
parentResource: b
};
this.add(k, o, h);
}
}
} else {
c();
}
};
a.getBaseUrl = function (b, c) {
var d = c.isDataUrl ? "" : a.dirname(c.url);
if (c.isDataUrl) {
if (d === ".") {
d = "";
}
if (b.baseUrl && d && b.baseUrl.charAt(b.baseUrl.length - 1) === "/") {
d += "/";
}
}
if ((d = d.replace(b.baseUrl, "")) && d.charAt(d.length - 1) !== "/") {
d += "/";
}
return d;
};
a.dirname = function (a) {
var b = a.replace(/\\/g, "/").replace(/\/$/, "").replace(/\/[^\/]*$/, "");
if (b === a) {
return ".";
} else if (b === "") {
return "/";
} else {
return b;
}
};
return a;
}();
function ph(a, b) {
ph = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return ph(a, b);
}
(function (a) {
function b(b) {
if (b === undefined) {
b = 1;
}
var c = a.call(this, "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}", "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n", {
uAlpha: 1
}) || this;
c.alpha = b;
return c;
}
(function (a, b) {
function c() {
this.constructor = a;
}
ph(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
Object.defineProperty(b.prototype, "alpha", {
get: function () {
return this.uniforms.uAlpha;
},
set: function (a) {
this.uniforms.uAlpha = a;
},
enumerable: false,
configurable: true
});
})(Rd);
function qh(a, b) {
qh = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return qh(a, b);
}
function rh(a, b) {
function c() {
this.constructor = a;
}
qh(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
}
var sh;
var th;
var uh;
var vh;
var wh;
var xh;
var yh;
var zh;
var Ah;
var Bh;
var Ch;
var Dh;
var Eh;
var Fh;
var Gh;
var Hh;
var Ih;
var Jh;
var Kh;
var Lh = {
5: [0.153388, 0.221461, 0.250301],
7: [0.071303, 0.131514, 0.189879, 0.214607],
9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],
11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],
13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],
15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448]
};
var Mh = ["varying vec2 vBlurTexCoords[%size%];", "uniform sampler2D uSampler;", "void main(void)", "{", " gl_FragColor = vec4(0.0);", " %blur%", "}"].join("\n");
(function (a) {
a[a.WEBGL_LEGACY = 0] = "WEBGL_LEGACY";
a[a.WEBGL = 1] = "WEBGL";
a[a.WEBGL2 = 2] = "WEBGL2";
})(sh ||= {});
(function (a) {
a[a.UNKNOWN = 0] = "UNKNOWN";
a[a.WEBGL = 1] = "WEBGL";
a[a.CANVAS = 2] = "CANVAS";
})(th ||= {});
(function (a) {
a[a.COLOR = 16384] = "COLOR";
a[a.DEPTH = 256] = "DEPTH";
a[a.STENCIL = 1024] = "STENCIL";
})(uh ||= {});
(function (a) {
a[a.NORMAL = 0] = "NORMAL";
a[a.ADD = 1] = "ADD";
a[a.MULTIPLY = 2] = "MULTIPLY";
a[a.SCREEN = 3] = "SCREEN";
a[a.OVERLAY = 4] = "OVERLAY";
a[a.DARKEN = 5] = "DARKEN";
a[a.LIGHTEN = 6] = "LIGHTEN";
a[a.COLOR_DODGE = 7] = "COLOR_DODGE";
a[a.COLOR_BURN = 8] = "COLOR_BURN";
a[a.HARD_LIGHT = 9] = "HARD_LIGHT";
a[a.SOFT_LIGHT = 10] = "SOFT_LIGHT";
a[a.DIFFERENCE = 11] = "DIFFERENCE";
a[a.EXCLUSION = 12] = "EXCLUSION";
a[a.HUE = 13] = "HUE";
a[a.SATURATION = 14] = "SATURATION";
a[a.COLOR = 15] = "COLOR";
a[a.LUMINOSITY = 16] = "LUMINOSITY";
a[a.NORMAL_NPM = 17] = "NORMAL_NPM";
a[a.ADD_NPM = 18] = "ADD_NPM";
a[a.SCREEN_NPM = 19] = "SCREEN_NPM";
a[a.NONE = 20] = "NONE";
a[a.SRC_OVER = 0] = "SRC_OVER";
a[a.SRC_IN = 21] = "SRC_IN";
a[a.SRC_OUT = 22] = "SRC_OUT";
a[a.SRC_ATOP = 23] = "SRC_ATOP";
a[a.DST_OVER = 24] = "DST_OVER";
a[a.DST_IN = 25] = "DST_IN";
a[a.DST_OUT = 26] = "DST_OUT";
a[a.DST_ATOP = 27] = "DST_ATOP";
a[a.ERASE = 26] = "ERASE";
a[a.SUBTRACT = 28] = "SUBTRACT";
a[a.XOR = 29] = "XOR";
})(vh ||= {});
(function (a) {
a[a.POINTS = 0] = "POINTS";
a[a.LINES = 1] = "LINES";
a[a.LINE_LOOP = 2] = "LINE_LOOP";
a[a.LINE_STRIP = 3] = "LINE_STRIP";
a[a.TRIANGLES = 4] = "TRIANGLES";
a[a.TRIANGLE_STRIP = 5] = "TRIANGLE_STRIP";
a[a.TRIANGLE_FAN = 6] = "TRIANGLE_FAN";
})(wh ||= {});
(function (a) {
a[a.RGBA = 6408] = "RGBA";
a[a.RGB = 6407] = "RGB";
a[a.RG = 33319] = "RG";
a[a.RED = 6403] = "RED";
a[a.RGBA_INTEGER = 36249] = "RGBA_INTEGER";
a[a.RGB_INTEGER = 36248] = "RGB_INTEGER";
a[a.RG_INTEGER = 33320] = "RG_INTEGER";
a[a.RED_INTEGER = 36244] = "RED_INTEGER";
a[a.ALPHA = 6406] = "ALPHA";
a[a.LUMINANCE = 6409] = "LUMINANCE";
a[a.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA";
a[a.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT";
a[a.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL";
})(xh ||= {});
(function (a) {
a[a.TEXTURE_2D = 3553] = "TEXTURE_2D";
a[a.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP";
a[a.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY";
a[a.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z";
})(yh ||= {});
(function (a) {
a[a.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE";
a[a.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT";
a[a.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5";
a[a.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4";
a[a.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1";
a[a.UNSIGNED_INT = 5125] = "UNSIGNED_INT";
a[a.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV";
a[a.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV";
a[a.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8";
a[a.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV";
a[a.BYTE = 5120] = "BYTE";
a[a.SHORT = 5122] = "SHORT";
a[a.INT = 5124] = "INT";
a[a.FLOAT = 5126] = "FLOAT";
a[a.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV";
a[a.HALF_FLOAT = 36193] = "HALF_FLOAT";
})(zh ||= {});
(function (a) {
a[a.FLOAT = 0] = "FLOAT";
a[a.INT = 1] = "INT";
a[a.UINT = 2] = "UINT";
})(Ah ||= {});
(function (a) {
a[a.NEAREST = 0] = "NEAREST";
a[a.LINEAR = 1] = "LINEAR";
})(Bh ||= {});
(function (a) {
a[a.CLAMP = 33071] = "CLAMP";
a[a.REPEAT = 10497] = "REPEAT";
a[a.MIRRORED_REPEAT = 33648] = "MIRRORED_REPEAT";
})(Ch ||= {});
(function (a) {
a[a.OFF = 0] = "OFF";
a[a.POW2 = 1] = "POW2";
a[a.ON = 2] = "ON";
a[a.ON_MANUAL = 3] = "ON_MANUAL";
})(Dh ||= {});
(function (a) {
a[a.NPM = 0] = "NPM";
a[a.UNPACK = 1] = "UNPACK";
a[a.PMA = 2] = "PMA";
a[a.NO_PREMULTIPLIED_ALPHA = 0] = "NO_PREMULTIPLIED_ALPHA";
a[a.PREMULTIPLY_ON_UPLOAD = 1] = "PREMULTIPLY_ON_UPLOAD";
a[a.PREMULTIPLY_ALPHA = 2] = "PREMULTIPLY_ALPHA";
a[a.PREMULTIPLIED_ALPHA = 2] = "PREMULTIPLIED_ALPHA";
})(Eh ||= {});
(function (a) {
a[a.NO = 0] = "NO";
a[a.YES = 1] = "YES";
a[a.AUTO = 2] = "AUTO";
a[a.BLEND = 0] = "BLEND";
a[a.CLEAR = 1] = "CLEAR";
a[a.BLIT = 2] = "BLIT";
})(Fh ||= {});
(function (a) {
a[a.AUTO = 0] = "AUTO";
a[a.MANUAL = 1] = "MANUAL";
})(Gh ||= {});
(function (a) {
a.LOW = "lowp";
a.MEDIUM = "mediump";
a.HIGH = "highp";
})(Hh ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.SCISSOR = 1] = "SCISSOR";
a[a.STENCIL = 2] = "STENCIL";
a[a.SPRITE = 3] = "SPRITE";
})(Ih ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.LOW = 2] = "LOW";
a[a.MEDIUM = 4] = "MEDIUM";
a[a.HIGH = 8] = "HIGH";
})(Jh ||= {});
(function (a) {
a[a.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER";
a[a.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER";
a[a.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER";
})(Kh ||= {});
var Nh = function (a) {
function b(b, c, d, e, f) {
if (c === undefined) {
c = 8;
}
if (d === undefined) {
d = 4;
}
if (e === undefined) {
e = Fa.FILTER_RESOLUTION;
}
if (f === undefined) {
f = 5;
}
var g = this;
var h = function (a, b) {
var c;
var d = Math.ceil(a / 2);
var e = "\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }";
var f = "";
c = b ? "vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);" : "vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";
for (var g = 0; g < a; g++) {
var h = c.replace("%index%", g.toString());
f += h = h.replace("%sampleIndex%", g - (d - 1) + ".0");
f += "\n";
}
return (e = e.replace("%blur%", f)).replace("%size%", a.toString());
}(f, b);
var i = function (a) {
for (var b, c = Lh[a], d = c.length, e = Mh, f = "", g = 0; g < a; g++) {
var h = "gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%", g.toString());
b = g;
if (g >= d) {
b = a - g - 1;
}
f += h = h.replace("%value%", c[b].toString());
f += "\n";
}
return (e = e.replace("%blur%", f)).replace("%size%", a.toString());
}(f);
(g = a.call(this, h, i) || this).horizontal = b;
g.resolution = e;
g._quality = 0;
g.quality = d;
g.blur = c;
return g;
}
rh(b, a);
b.prototype.apply = function (a, b, c, d) {
if (c) {
if (this.horizontal) {
this.uniforms.strength = 1 / c.width * (c.width / b.width);
} else {
this.uniforms.strength = 1 / c.height * (c.height / b.height);
}
} else if (this.horizontal) {
this.uniforms.strength = 1 / a.renderer.width * (a.renderer.width / b.width);
} else {
this.uniforms.strength = 1 / a.renderer.height * (a.renderer.height / b.height);
}
this.uniforms.strength *= this.strength;
this.uniforms.strength /= this.passes;
if (this.passes === 1) {
a.applyFilter(this, b, c, d);
} else {
var e = a.getFilterTexture();
var f = a.renderer;
var g = b;
var h = e;
this.state.blend = false;
a.applyFilter(this, g, h, Fh.CLEAR);
for (var i = 1; i < this.passes - 1; i++) {
a.bindAndClear(g, Fh.BLIT);
this.uniforms.uSampler = h;
var j = h;
h = g;
g = j;
f.shader.bind(this);
f.geometry.draw(5);
}
this.state.blend = true;
a.applyFilter(this, h, c, d);
a.returnFilterTexture(e);
}
};
Object.defineProperty(b.prototype, "blur", {
get: function () {
return this.strength;
},
set: function (a) {
this.padding = 1 + Math.abs(a) * 2;
this.strength = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "quality", {
get: function () {
return this._quality;
},
set: function (a) {
this._quality = a;
this.passes = a;
},
enumerable: false,
configurable: true
});
return b;
}(Rd);
(function (a) {
function b(b, c, d, e) {
if (b === undefined) {
b = 8;
}
if (c === undefined) {
c = 4;
}
if (d === undefined) {
d = Fa.FILTER_RESOLUTION;
}
if (e === undefined) {
e = 5;
}
var f = a.call(this) || this;
f.blurXFilter = new Nh(true, b, c, d, e);
f.blurYFilter = new Nh(false, b, c, d, e);
f.resolution = d;
f.quality = c;
f.blur = b;
f.repeatEdgePixels = false;
return f;
}
rh(b, a);
b.prototype.apply = function (a, b, c, d) {
var e = Math.abs(this.blurXFilter.strength);
var f = Math.abs(this.blurYFilter.strength);
if (e && f) {
var g = a.getFilterTexture();
this.blurXFilter.apply(a, b, g, Fh.CLEAR);
this.blurYFilter.apply(a, g, c, d);
a.returnFilterTexture(g);
} else if (f) {
this.blurYFilter.apply(a, b, c, d);
} else {
this.blurXFilter.apply(a, b, c, d);
}
};
b.prototype.updatePadding = function () {
if (this._repeatEdgePixels) {
this.padding = 0;
} else {
this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;
}
};
Object.defineProperty(b.prototype, "blur", {
get: function () {
return this.blurXFilter.blur;
},
set: function (a) {
this.blurXFilter.blur = this.blurYFilter.blur = a;
this.updatePadding();
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "quality", {
get: function () {
return this.blurXFilter.quality;
},
set: function (a) {
this.blurXFilter.quality = this.blurYFilter.quality = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "blurX", {
get: function () {
return this.blurXFilter.blur;
},
set: function (a) {
this.blurXFilter.blur = a;
this.updatePadding();
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "blurY", {
get: function () {
return this.blurYFilter.blur;
},
set: function (a) {
this.blurYFilter.blur = a;
this.updatePadding();
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "blendMode", {
get: function () {
return this.blurYFilter.blendMode;
},
set: function (a) {
this.blurYFilter.blendMode = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "repeatEdgePixels", {
get: function () {
return this._repeatEdgePixels;
},
set: function (a) {
this._repeatEdgePixels = a;
this.updatePadding();
},
enumerable: false,
configurable: true
});
})(Rd);
function Oh(a, b) {
Oh = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return Oh(a, b);
}
var Ph = function (a) {
function b() {
var b = this;
var c = {
m: new Float32Array([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]),
uAlpha: 1
};
(b = a.call(this, te, "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n", c) || this).alpha = 1;
return b;
}
(function (a, b) {
function c() {
this.constructor = a;
}
Oh(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
b.prototype._loadMatrix = function (a, b) {
if (b === undefined) {
b = false;
}
var c = a;
if (b) {
this._multiply(c, this.uniforms.m, a);
c = this._colorMatrix(c);
}
this.uniforms.m = c;
};
b.prototype._multiply = function (a, b, c) {
a[0] = b[0] * c[0] + b[1] * c[5] + b[2] * c[10] + b[3] * c[15];
a[1] = b[0] * c[1] + b[1] * c[6] + b[2] * c[11] + b[3] * c[16];
a[2] = b[0] * c[2] + b[1] * c[7] + b[2] * c[12] + b[3] * c[17];
a[3] = b[0] * c[3] + b[1] * c[8] + b[2] * c[13] + b[3] * c[18];
a[4] = b[0] * c[4] + b[1] * c[9] + b[2] * c[14] + b[3] * c[19] + b[4];
a[5] = b[5] * c[0] + b[6] * c[5] + b[7] * c[10] + b[8] * c[15];
a[6] = b[5] * c[1] + b[6] * c[6] + b[7] * c[11] + b[8] * c[16];
a[7] = b[5] * c[2] + b[6] * c[7] + b[7] * c[12] + b[8] * c[17];
a[8] = b[5] * c[3] + b[6] * c[8] + b[7] * c[13] + b[8] * c[18];
a[9] = b[5] * c[4] + b[6] * c[9] + b[7] * c[14] + b[8] * c[19] + b[9];
a[10] = b[10] * c[0] + b[11] * c[5] + b[12] * c[10] + b[13] * c[15];
a[11] = b[10] * c[1] + b[11] * c[6] + b[12] * c[11] + b[13] * c[16];
a[12] = b[10] * c[2] + b[11] * c[7] + b[12] * c[12] + b[13] * c[17];
a[13] = b[10] * c[3] + b[11] * c[8] + b[12] * c[13] + b[13] * c[18];
a[14] = b[10] * c[4] + b[11] * c[9] + b[12] * c[14] + b[13] * c[19] + b[14];
a[15] = b[15] * c[0] + b[16] * c[5] + b[17] * c[10] + b[18] * c[15];
a[16] = b[15] * c[1] + b[16] * c[6] + b[17] * c[11] + b[18] * c[16];
a[17] = b[15] * c[2] + b[16] * c[7] + b[17] * c[12] + b[18] * c[17];
a[18] = b[15] * c[3] + b[16] * c[8] + b[17] * c[13] + b[18] * c[18];
a[19] = b[15] * c[4] + b[16] * c[9] + b[17] * c[14] + b[18] * c[19] + b[19];
return a;
};
b.prototype._colorMatrix = function (a) {
var b = new Float32Array(a);
b[4] /= 255;
b[9] /= 255;
b[14] /= 255;
b[19] /= 255;
return b;
};
b.prototype.brightness = function (a, b) {
var c = [a, 0, 0, 0, 0, 0, a, 0, 0, 0, 0, 0, a, 0, 0, 0, 0, 0, 1, 0];
this._loadMatrix(c, b);
};
b.prototype.tint = function (a, b) {
var c = [(a >> 16 & 255) / 255, 0, 0, 0, 0, 0, (a >> 8 & 255) / 255, 0, 0, 0, 0, 0, (a & 255) / 255, 0, 0, 0, 0, 0, 1, 0];
this._loadMatrix(c, b);
};
b.prototype.greyscale = function (a, b) {
var c = [a, a, a, 0, 0, a, a, a, 0, 0, a, a, a, 0, 0, 0, 0, 0, 1, 0];
this._loadMatrix(c, b);
};
b.prototype.blackAndWhite = function (a) {
this._loadMatrix([0.3, 0.6, 0.1, 0, 0, 0.3, 0.6, 0.1, 0, 0, 0.3, 0.6, 0.1, 0, 0, 0, 0, 0, 1, 0], a);
};
b.prototype.hue = function (a, b) {
a = (a || 0) / 180 * Math.PI;
var c = Math.cos(a);
var d = Math.sin(a);
var e = 1 / 3;
var f = (0, Math.sqrt)(e);
var g = [c + (1 - c) * e, e * (1 - c) - f * d, e * (1 - c) + f * d, 0, 0, e * (1 - c) + f * d, c + e * (1 - c), e * (1 - c) - f * d, 0, 0, e * (1 - c) - f * d, e * (1 - c) + f * d, c + e * (1 - c), 0, 0, 0, 0, 0, 1, 0];
this._loadMatrix(g, b);
};
b.prototype.contrast = function (a, b) {
var c = (a || 0) + 1;
var d = (c - 1) * -0.5;
var e = [c, 0, 0, 0, d, 0, c, 0, 0, d, 0, 0, c, 0, d, 0, 0, 0, 1, 0];
this._loadMatrix(e, b);
};
b.prototype.saturate = function (a, b) {
if (a === undefined) {
a = 0;
}
var c = a * 2 / 3 + 1;
var d = (c - 1) * -0.5;
var e = [c, d, d, 0, 0, d, c, d, 0, 0, d, d, c, 0, 0, 0, 0, 0, 1, 0];
this._loadMatrix(e, b);
};
b.prototype.desaturate = function () {
this.saturate(-1);
};
b.prototype.negative = function (a) {
this._loadMatrix([-1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, 0], a);
};
b.prototype.sepia = function (a) {
this._loadMatrix([0.393, 0.7689999, 0.18899999, 0, 0, 0.349, 0.6859999, 0.16799999, 0, 0, 0.272, 0.5339999, 0.13099999, 0, 0, 0, 0, 0, 1, 0], a);
};
b.prototype.technicolor = function (a) {
this._loadMatrix([1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, 0, 0, 0, 1, 0], a);
};
b.prototype.polaroid = function (a) {
this._loadMatrix([1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016, 1.483, 0, 0, 0, 0, 0, 1, 0], a);
};
b.prototype.toBGR = function (a) {
this._loadMatrix([0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], a);
};
b.prototype.kodachrome = function (a) {
this._loadMatrix([1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, 0, 0, 0, 1, 0], a);
};
b.prototype.browni = function (a) {
this._loadMatrix([0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, 0, 0, 0, 1, 0], a);
};
b.prototype.vintage = function (a) {
this._loadMatrix([0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, 0, 0, 0, 1, 0], a);
};
b.prototype.colorTone = function (a, b, c, d, e) {
var f = ((c = c || 16770432) >> 16 & 255) / 255;
var g = (c >> 8 & 255) / 255;
var h = (c & 255) / 255;
var i = ((d = d || 3375104) >> 16 & 255) / 255;
var j = (d >> 8 & 255) / 255;
var k = (d & 255) / 255;
var l = [0.3, 0.59, 0.11, 0, 0, f, g, h, a = a || 0.2, 0, i, j, k, b = b || 0.15, 0, f - i, g - j, h - k, 0, 0];
this._loadMatrix(l, e);
};
b.prototype.night = function (a, b) {
var c = [(a = a || 0.1) * -2, -a, 0, 0, 0, -a, 0, a, 0, 0, 0, a, a * 2, 0, 0, 0, 0, 0, 1, 0];
this._loadMatrix(c, b);
};
b.prototype.predator = function (a, b) {
var c = [a * 11.224130630493164, a * -4.794486999511719, a * -2.8746118545532227, a * 0, a * 0.40342438220977783, a * -3.6330697536468506, a * 9.193157196044922, a * -2.951810836791992, a * 0, a * -1.316135048866272, a * -3.2184197902679443, a * -4.2375030517578125, a * 7.476448059082031, a * 0, a * 0.8044459223747253, 0, 0, 0, 1, 0];
this._loadMatrix(c, b);
};
b.prototype.lsd = function (a) {
this._loadMatrix([2, -0.4, 0.5, 0, 0, -0.5, 2, -0.4, 0, 0, -0.4, -0.5, 3, 0, 0, 0, 0, 0, 1, 0], a);
};
b.prototype.reset = function () {
this._loadMatrix([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], false);
};
Object.defineProperty(b.prototype, "matrix", {
get: function () {
return this.uniforms.m;
},
set: function (a) {
this.uniforms.m = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "alpha", {
get: function () {
return this.uniforms.uAlpha;
},
set: function (a) {
this.uniforms.uAlpha = a;
},
enumerable: false,
configurable: true
});
return b;
}(Rd);
Ph.prototype.grayscale = Ph.prototype.greyscale;
function Qh(a, b) {
Qh = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return Qh(a, b);
}
(function (a) {
function b(b, c) {
var d = this;
var e = new wb();
b.renderable = false;
(d = a.call(this, "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n", "varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n", {
mapSampler: b._texture,
filterMatrix: e,
scale: {
x: 1,
y: 1
},
rotation: new Float32Array([1, 0, 0, 1])
}) || this).maskSprite = b;
d.maskMatrix = e;
if (c == null) {
c = 20;
}
d.scale = new ob(c, c);
return d;
}
(function (a, b) {
function c() {
this.constructor = a;
}
Qh(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
b.prototype.apply = function (a, b, c, d) {
this.uniforms.filterMatrix = a.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);
this.uniforms.scale.x = this.scale.x;
this.uniforms.scale.y = this.scale.y;
var e = this.maskSprite.worldTransform;
var f = Math.sqrt(e.a * e.a + e.b * e.b);
var g = Math.sqrt(e.c * e.c + e.d * e.d);
if (f !== 0 && g !== 0) {
this.uniforms.rotation[0] = e.a / f;
this.uniforms.rotation[1] = e.b / f;
this.uniforms.rotation[2] = e.c / g;
this.uniforms.rotation[3] = e.d / g;
}
a.applyFilter(this, b, c, d);
};
Object.defineProperty(b.prototype, "map", {
get: function () {
return this.uniforms.mapSampler;
},
set: function (a) {
this.uniforms.mapSampler = a;
},
enumerable: false,
configurable: true
});
})(Rd);
var Rh;
function Sh(a, b) {
Sh = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return Sh(a, b);
}
(function (a, b) {
function c() {
this.constructor = a;
}
Sh(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(function () {
return Rh.call(this, "\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n", "varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it's\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n") || this;
}, Rh = Rd);
var Th;
var Uh;
var Vh;
var Wh;
var Xh;
var Yh;
var Zh;
var $h;
var _h;
var ai;
var bi;
var ci;
var di;
var ei;
var fi;
var gi;
var hi;
var ii;
var ji;
function ki(a, b) {
ki = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return ki(a, b);
}
(function (a) {
function b(b, c) {
if (b === undefined) {
b = 0.5;
}
if (c === undefined) {
c = Math.random();
}
var d = a.call(this, te, "precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n", {
uNoise: 0,
uSeed: 0
}) || this;
d.noise = b;
d.seed = c;
return d;
}
(function (a, b) {
function c() {
this.constructor = a;
}
ki(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
Object.defineProperty(b.prototype, "noise", {
get: function () {
return this.uniforms.uNoise;
},
set: function (a) {
this.uniforms.uNoise = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "seed", {
get: function () {
return this.uniforms.uSeed;
},
set: function (a) {
this.uniforms.uSeed = a;
},
enumerable: false,
configurable: true
});
})(Rd);
(function (a) {
a[a.WEBGL_LEGACY = 0] = "WEBGL_LEGACY";
a[a.WEBGL = 1] = "WEBGL";
a[a.WEBGL2 = 2] = "WEBGL2";
})(Th ||= {});
(function (a) {
a[a.UNKNOWN = 0] = "UNKNOWN";
a[a.WEBGL = 1] = "WEBGL";
a[a.CANVAS = 2] = "CANVAS";
})(Uh ||= {});
(function (a) {
a[a.COLOR = 16384] = "COLOR";
a[a.DEPTH = 256] = "DEPTH";
a[a.STENCIL = 1024] = "STENCIL";
})(Vh ||= {});
(function (a) {
a[a.NORMAL = 0] = "NORMAL";
a[a.ADD = 1] = "ADD";
a[a.MULTIPLY = 2] = "MULTIPLY";
a[a.SCREEN = 3] = "SCREEN";
a[a.OVERLAY = 4] = "OVERLAY";
a[a.DARKEN = 5] = "DARKEN";
a[a.LIGHTEN = 6] = "LIGHTEN";
a[a.COLOR_DODGE = 7] = "COLOR_DODGE";
a[a.COLOR_BURN = 8] = "COLOR_BURN";
a[a.HARD_LIGHT = 9] = "HARD_LIGHT";
a[a.SOFT_LIGHT = 10] = "SOFT_LIGHT";
a[a.DIFFERENCE = 11] = "DIFFERENCE";
a[a.EXCLUSION = 12] = "EXCLUSION";
a[a.HUE = 13] = "HUE";
a[a.SATURATION = 14] = "SATURATION";
a[a.COLOR = 15] = "COLOR";
a[a.LUMINOSITY = 16] = "LUMINOSITY";
a[a.NORMAL_NPM = 17] = "NORMAL_NPM";
a[a.ADD_NPM = 18] = "ADD_NPM";
a[a.SCREEN_NPM = 19] = "SCREEN_NPM";
a[a.NONE = 20] = "NONE";
a[a.SRC_OVER = 0] = "SRC_OVER";
a[a.SRC_IN = 21] = "SRC_IN";
a[a.SRC_OUT = 22] = "SRC_OUT";
a[a.SRC_ATOP = 23] = "SRC_ATOP";
a[a.DST_OVER = 24] = "DST_OVER";
a[a.DST_IN = 25] = "DST_IN";
a[a.DST_OUT = 26] = "DST_OUT";
a[a.DST_ATOP = 27] = "DST_ATOP";
a[a.ERASE = 26] = "ERASE";
a[a.SUBTRACT = 28] = "SUBTRACT";
a[a.XOR = 29] = "XOR";
})(Wh ||= {});
(function (a) {
a[a.POINTS = 0] = "POINTS";
a[a.LINES = 1] = "LINES";
a[a.LINE_LOOP = 2] = "LINE_LOOP";
a[a.LINE_STRIP = 3] = "LINE_STRIP";
a[a.TRIANGLES = 4] = "TRIANGLES";
a[a.TRIANGLE_STRIP = 5] = "TRIANGLE_STRIP";
a[a.TRIANGLE_FAN = 6] = "TRIANGLE_FAN";
})(Xh ||= {});
(function (a) {
a[a.RGBA = 6408] = "RGBA";
a[a.RGB = 6407] = "RGB";
a[a.RG = 33319] = "RG";
a[a.RED = 6403] = "RED";
a[a.RGBA_INTEGER = 36249] = "RGBA_INTEGER";
a[a.RGB_INTEGER = 36248] = "RGB_INTEGER";
a[a.RG_INTEGER = 33320] = "RG_INTEGER";
a[a.RED_INTEGER = 36244] = "RED_INTEGER";
a[a.ALPHA = 6406] = "ALPHA";
a[a.LUMINANCE = 6409] = "LUMINANCE";
a[a.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA";
a[a.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT";
a[a.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL";
})(Yh ||= {});
(function (a) {
a[a.TEXTURE_2D = 3553] = "TEXTURE_2D";
a[a.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP";
a[a.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY";
a[a.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y";
a[a.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z";
a[a.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z";
})(Zh ||= {});
(function (a) {
a[a.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE";
a[a.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT";
a[a.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5";
a[a.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4";
a[a.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1";
a[a.UNSIGNED_INT = 5125] = "UNSIGNED_INT";
a[a.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV";
a[a.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV";
a[a.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8";
a[a.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV";
a[a.BYTE = 5120] = "BYTE";
a[a.SHORT = 5122] = "SHORT";
a[a.INT = 5124] = "INT";
a[a.FLOAT = 5126] = "FLOAT";
a[a.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV";
a[a.HALF_FLOAT = 36193] = "HALF_FLOAT";
})($h ||= {});
(function (a) {
a[a.FLOAT = 0] = "FLOAT";
a[a.INT = 1] = "INT";
a[a.UINT = 2] = "UINT";
})(_h ||= {});
(function (a) {
a[a.NEAREST = 0] = "NEAREST";
a[a.LINEAR = 1] = "LINEAR";
})(ai ||= {});
(function (a) {
a[a.CLAMP = 33071] = "CLAMP";
a[a.REPEAT = 10497] = "REPEAT";
a[a.MIRRORED_REPEAT = 33648] = "MIRRORED_REPEAT";
})(bi ||= {});
(function (a) {
a[a.OFF = 0] = "OFF";
a[a.POW2 = 1] = "POW2";
a[a.ON = 2] = "ON";
a[a.ON_MANUAL = 3] = "ON_MANUAL";
})(ci ||= {});
(function (a) {
a[a.NPM = 0] = "NPM";
a[a.UNPACK = 1] = "UNPACK";
a[a.PMA = 2] = "PMA";
a[a.NO_PREMULTIPLIED_ALPHA = 0] = "NO_PREMULTIPLIED_ALPHA";
a[a.PREMULTIPLY_ON_UPLOAD = 1] = "PREMULTIPLY_ON_UPLOAD";
a[a.PREMULTIPLY_ALPHA = 2] = "PREMULTIPLY_ALPHA";
a[a.PREMULTIPLIED_ALPHA = 2] = "PREMULTIPLIED_ALPHA";
})(di ||= {});
(function (a) {
a[a.NO = 0] = "NO";
a[a.YES = 1] = "YES";
a[a.AUTO = 2] = "AUTO";
a[a.BLEND = 0] = "BLEND";
a[a.CLEAR = 1] = "CLEAR";
a[a.BLIT = 2] = "BLIT";
})(ei ||= {});
(function (a) {
a[a.AUTO = 0] = "AUTO";
a[a.MANUAL = 1] = "MANUAL";
})(fi ||= {});
(function (a) {
a.LOW = "lowp";
a.MEDIUM = "mediump";
a.HIGH = "highp";
})(gi ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.SCISSOR = 1] = "SCISSOR";
a[a.STENCIL = 2] = "STENCIL";
a[a.SPRITE = 3] = "SPRITE";
})(hi ||= {});
(function (a) {
a[a.NONE = 0] = "NONE";
a[a.LOW = 2] = "LOW";
a[a.MEDIUM = 4] = "MEDIUM";
a[a.HIGH = 8] = "HIGH";
})(ii ||= {});
(function (a) {
a[a.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER";
a[a.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER";
a[a.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER";
})(ji ||= {});
var li = new wb();
ac.prototype._cacheAsBitmap = false;
ac.prototype._cacheData = null;
ac.prototype._cacheAsBitmapResolution = null;
ac.prototype._cacheAsBitmapMultisample = ii.NONE;
function mi() {
this.textureCacheId = null;
this.originalRender = null;
this.originalRenderCanvas = null;
this.originalCalculateBounds = null;
this.originalGetLocalBounds = null;
this.originalUpdateTransform = null;
this.originalDestroy = null;
this.originalMask = null;
this.originalFilterArea = null;
this.originalContainsPoint = null;
this.sprite = null;
}
Object.defineProperties(ac.prototype, {
cacheAsBitmapResolution: {
get: function () {
return this._cacheAsBitmapResolution;
},
set: function (a) {
if (a !== this._cacheAsBitmapResolution) {
this._cacheAsBitmapResolution = a;
if (this.cacheAsBitmap) {
this.cacheAsBitmap = false;
this.cacheAsBitmap = true;
}
}
}
},
cacheAsBitmapMultisample: {
get: function () {
return this._cacheAsBitmapMultisample;
},
set: function (a) {
if (a !== this._cacheAsBitmapMultisample) {
this._cacheAsBitmapMultisample = a;
if (this.cacheAsBitmap) {
this.cacheAsBitmap = false;
this.cacheAsBitmap = true;
}
}
}
},
cacheAsBitmap: {
get: function () {
return this._cacheAsBitmap;
},
set: function (a) {
var b;
if (this._cacheAsBitmap !== a) {
this._cacheAsBitmap = a;
if (a) {
this._cacheData ||= new mi();
(b = this._cacheData).originalRender = this.render;
b.originalRenderCanvas = this.renderCanvas;
b.originalUpdateTransform = this.updateTransform;
b.originalCalculateBounds = this.calculateBounds;
b.originalGetLocalBounds = this.getLocalBounds;
b.originalDestroy = this.destroy;
b.originalContainsPoint = this.containsPoint;
b.originalMask = this._mask;
b.originalFilterArea = this.filterArea;
this.render = this._renderCached;
this.renderCanvas = this._renderCachedCanvas;
this.destroy = this._cacheAsBitmapDestroy;
} else {
if ((b = this._cacheData).sprite) {
this._destroyCachedDisplayObject();
}
this.render = b.originalRender;
this.renderCanvas = b.originalRenderCanvas;
this.calculateBounds = b.originalCalculateBounds;
this.getLocalBounds = b.originalGetLocalBounds;
this.destroy = b.originalDestroy;
this.updateTransform = b.originalUpdateTransform;
this.containsPoint = b.originalContainsPoint;
this._mask = b.originalMask;
this.filterArea = b.originalFilterArea;
}
}
}
}
});
ac.prototype._renderCached = function (a) {
if (!!this.visible && this.worldAlpha > 0 && !!this.renderable) {
this._initCachedDisplayObject(a);
this._cacheData.sprite.transform._worldID = this.transform._worldID;
this._cacheData.sprite.worldAlpha = this.worldAlpha;
this._cacheData.sprite._render(a);
}
};
ac.prototype._initCachedDisplayObject = function (a) {
if (!this._cacheData || !this._cacheData.sprite) {
var b = this.alpha;
this.alpha = 1;
a.batch.flush();
var c = this.getLocalBounds(null, true).clone();
if (this.filters && this.filters.length) {
var d = this.filters[0].padding;
c.pad(d);
}
c.ceil(Fa.RESOLUTION);
var e = a.renderTexture.current;
var f = a.renderTexture.sourceFrame.clone();
var g = a.renderTexture.destinationFrame.clone();
var h = a.projection.transform;
var i = Tc.create({
width: c.width,
height: c.height,
resolution: this.cacheAsBitmapResolution || a.resolution,
multisample: this.cacheAsBitmapMultisample ?? a.multisample
});
var j = "cacheAsBitmap_" + bb();
this._cacheData.textureCacheId = j;
Bc.addToCache(i.baseTexture, j);
Sc.addToCache(i, j);
var k = this.transform.localTransform.copyTo(li).invert().translate(-c.x, -c.y);
this.render = this._cacheData.originalRender;
a.render(this, {
renderTexture: i,
clear: true,
transform: k,
skipUpdateTransform: false
});
a.framebuffer.blit();
a.projection.transform = h;
a.renderTexture.bind(e, f, g);
this.render = this._renderCached;
this.updateTransform = this.displayObjectUpdateTransform;
this.calculateBounds = this._calculateCachedBounds;
this.getLocalBounds = this._getCachedLocalBounds;
this._mask = null;
this.filterArea = null;
this.alpha = b;
var l = new ng(i);
l.transform.worldTransform = this.transform.worldTransform;
l.anchor.x = -c.x / c.width;
l.anchor.y = -c.y / c.height;
l.alpha = b;
l._bounds = this._bounds;
this._cacheData.sprite = l;
this.transform._parentID = -1;
if (this.parent) {
this.updateTransform();
} else {
this.enableTempParent();
this.updateTransform();
this.disableTempParent(null);
}
this.containsPoint = l.containsPoint.bind(l);
}
};
ac.prototype._renderCachedCanvas = function (a) {
if (!!this.visible && this.worldAlpha > 0 && !!this.renderable) {
this._initCachedDisplayObjectCanvas(a);
this._cacheData.sprite.worldAlpha = this.worldAlpha;
this._cacheData.sprite._renderCanvas(a);
}
};
ac.prototype._initCachedDisplayObjectCanvas = function (a) {
if (!this._cacheData || !this._cacheData.sprite) {
var b = this.getLocalBounds(null, true);
var c = this.alpha;
this.alpha = 1;
var d = a.context;
var e = a._projTransform;
b.ceil(Fa.RESOLUTION);
var f = Tc.create({
width: b.width,
height: b.height
});
var g = "cacheAsBitmap_" + bb();
this._cacheData.textureCacheId = g;
Bc.addToCache(f.baseTexture, g);
Sc.addToCache(f, g);
var h = li;
this.transform.localTransform.copyTo(h);
h.invert();
h.tx -= b.x;
h.ty -= b.y;
this.renderCanvas = this._cacheData.originalRenderCanvas;
a.render(this, {
renderTexture: f,
clear: true,
transform: h,
skipUpdateTransform: false
});
a.context = d;
a._projTransform = e;
this.renderCanvas = this._renderCachedCanvas;
this.updateTransform = this.displayObjectUpdateTransform;
this.calculateBounds = this._calculateCachedBounds;
this.getLocalBounds = this._getCachedLocalBounds;
this._mask = null;
this.filterArea = null;
this.alpha = c;
var i = new ng(f);
i.transform.worldTransform = this.transform.worldTransform;
i.anchor.x = -b.x / b.width;
i.anchor.y = -b.y / b.height;
i.alpha = c;
i._bounds = this._bounds;
this._cacheData.sprite = i;
this.transform._parentID = -1;
if (this.parent) {
this.updateTransform();
} else {
this.parent = a._tempDisplayObjectParent;
this.updateTransform();
this.parent = null;
}
this.containsPoint = i.containsPoint.bind(i);
}
};
ac.prototype._calculateCachedBounds = function () {
this._bounds.clear();
this._cacheData.sprite.transform._worldID = this.transform._worldID;
this._cacheData.sprite._calculateBounds();
this._bounds.updateID = this._boundsID;
};
ac.prototype._getCachedLocalBounds = function () {
return this._cacheData.sprite.getLocalBounds(null);
};
ac.prototype._destroyCachedDisplayObject = function () {
this._cacheData.sprite._texture.destroy(true);
this._cacheData.sprite = null;
Bc.removeFromCache(this._cacheData.textureCacheId);
Sc.removeFromCache(this._cacheData.textureCacheId);
this._cacheData.textureCacheId = null;
};
ac.prototype._cacheAsBitmapDestroy = function (a) {
this.cacheAsBitmap = false;
this.destroy(a);
};
ac.prototype.name = null;
dc.prototype.getChildByName = function (a, b) {
for (var c = 0, d = this.children.length; c < d; c++) {
if (this.children[c].name === a) {
return this.children[c];
}
}
if (b) {
c = 0;
d = this.children.length;
for (; c < d; c++) {
if (this.children[c].getChildByName) {
var e = this.children[c].getChildByName(a, true);
if (e) {
return e;
}
}
}
}
return null;
};
ac.prototype.getGlobalPosition = function (a, b) {
if (a === undefined) {
a = new ob();
}
if (b === undefined) {
b = false;
}
if (this.parent) {
this.parent.toGlobal(this.position, a, b);
} else {
a.x = this.position.x;
a.y = this.position.y;
}
return a;
};
function ni(a, b) {
ni = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return ni(a, b);
}
function oi(a, b) {
function c() {
this.constructor = a;
}
ni(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
}
var pi = function (a) {
function b(b, c, d, e) {
if (b === undefined) {
b = 100;
}
if (c === undefined) {
c = 100;
}
if (d === undefined) {
d = 10;
}
if (e === undefined) {
e = 10;
}
var f = a.call(this) || this;
f.segWidth = d;
f.segHeight = e;
f.width = b;
f.height = c;
f.build();
return f;
}
oi(b, a);
b.prototype.build = function () {
for (var a = this.segWidth * this.segHeight, b = [], c = [], d = [], e = this.segWidth - 1, f = this.segHeight - 1, g = this.width / e, h = this.height / f, i = 0; i < a; i++) {
var j = i % this.segWidth;
var k = i / this.segWidth | 0;
b.push(j * g, k * h);
c.push(j / e, k / f);
}
var l = e * f;
for (i = 0; i < l; i++) {
var m = i % e;
var n = i / e | 0;
var o = n * this.segWidth + m;
var p = n * this.segWidth + m + 1;
var q = (n + 1) * this.segWidth + m;
var r = (n + 1) * this.segWidth + m + 1;
d.push(o, p, q, p, r, q);
}
this.buffers[0].data = new Float32Array(b);
this.buffers[1].data = new Float32Array(c);
this.indexBuffer.data = new Uint16Array(d);
this.buffers[0].update();
this.buffers[1].update();
this.indexBuffer.update();
};
return b;
}(_g);
var qi = function (a) {
function b(b, c, d) {
if (b === undefined) {
b = 200;
}
if (d === undefined) {
d = 0;
}
var e = a.call(this, new Float32Array(c.length * 4), new Float32Array(c.length * 4), new Uint16Array((c.length - 1) * 6)) || this;
e.points = c;
e._width = b;
e.textureScale = d;
e.build();
return e;
}
oi(b, a);
Object.defineProperty(b.prototype, "width", {
get: function () {
return this._width;
},
enumerable: false,
configurable: true
});
b.prototype.build = function () {
var a = this.points;
if (a) {
var b = this.getBuffer("aVertexPosition");
var c = this.getBuffer("aTextureCoord");
var d = this.getIndex();
if (a.length >= 1) {
if (b.data.length / 4 !== a.length) {
b.data = new Float32Array(a.length * 4);
c.data = new Float32Array(a.length * 4);
d.data = new Uint16Array((a.length - 1) * 6);
}
var e = c.data;
var f = d.data;
e[0] = 0;
e[1] = 0;
e[2] = 0;
e[3] = 1;
for (var g = 0, h = a[0], i = this._width * this.textureScale, j = a.length, k = 0; k < j; k++) {
var l = k * 4;
if (this.textureScale > 0) {
var m = h.x - a[k].x;
var n = h.y - a[k].y;
var o = Math.sqrt(m * m + n * n);
h = a[k];
g += o / i;
} else {
g = k / (j - 1);
}
e[l] = g;
e[l + 1] = 0;
e[l + 2] = g;
e[l + 3] = 1;
}
var p = 0;
for (k = 0; k < j - 1; k++) {
l = k * 2;
f[p++] = l;
f[p++] = l + 1;
f[p++] = l + 2;
f[p++] = l + 2;
f[p++] = l + 1;
f[p++] = l + 3;
}
c.update();
d.update();
this.updateVertices();
}
}
};
b.prototype.updateVertices = function () {
var a = this.points;
if (a.length >= 1) {
for (var b, c = a[0], d = 0, e = 0, f = this.buffers[0].data, g = a.length, h = 0; h < g; h++) {
var i = a[h];
var j = h * 4;
e = -((b = h < a.length - 1 ? a[h + 1] : i).x - c.x);
d = b.y - c.y;
var k = Math.sqrt(d * d + e * e);
var l = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
d /= k;
e /= k;
d *= l;
e *= l;
f[j] = i.x + d;
f[j + 1] = i.y + e;
f[j + 2] = i.x - d;
f[j + 3] = i.y - e;
c = i;
}
this.buffers[0].update();
}
};
b.prototype.update = function () {
if (this.textureScale > 0) {
this.build();
} else {
this.updateVertices();
}
};
return b;
}(_g);
(function (a) {
function b(b, c, d) {
if (d === undefined) {
d = 0;
}
var e = this;
var f = new qi(b.height, c, d);
var g = new $g(b);
if (d > 0) {
b.baseTexture.wrapMode = wa.REPEAT;
}
(e = a.call(this, f, g) || this).autoUpdate = true;
return e;
}
oi(b, a);
b.prototype._render = function (b) {
var c = this.geometry;
if (this.autoUpdate || c._width !== this.shader.texture.height) {
c._width = this.shader.texture.height;
c.update();
}
a.prototype._render.call(this, b);
};
})(Zg);
var ri = function (a) {
function b(b, c, d) {
var e = this;
var f = new pi(b.width, b.height, c, d);
var g = new $g(Sc.WHITE);
(e = a.call(this, f, g) || this).texture = b;
e.autoResize = true;
return e;
}
oi(b, a);
b.prototype.textureUpdated = function () {
this._textureID = this.shader.texture._updateID;
var a = this.geometry;
var b = this.shader.texture;
var c = b.width;
var d = b.height;
if (!!this.autoResize && (a.width !== c || a.height !== d)) {
a.width = this.shader.texture.width;
a.height = this.shader.texture.height;
a.build();
}
};
Object.defineProperty(b.prototype, "texture", {
get: function () {
return this.shader.texture;
},
set: function (a) {
if (this.shader.texture !== a) {
this.shader.texture = a;
this._textureID = -1;
if (a.baseTexture.valid) {
this.textureUpdated();
} else {
a.once("update", this.textureUpdated, this);
}
}
},
enumerable: false,
configurable: true
});
b.prototype._render = function (b) {
if (this._textureID !== this.shader.texture._updateID) {
this.textureUpdated();
}
a.prototype._render.call(this, b);
};
b.prototype.destroy = function (b) {
this.shader.texture.off("update", this.textureUpdated, this);
a.prototype.destroy.call(this, b);
};
return b;
}(Zg);
(function (a) {
function b(b, c, d, e, f) {
if (b === undefined) {
b = Sc.EMPTY;
}
var g = this;
var h = new _g(c, d, e);
h.getBuffer("aVertexPosition").static = false;
var i = new $g(b);
(g = a.call(this, h, i, null, f) || this).autoUpdate = true;
return g;
}
oi(b, a);
Object.defineProperty(b.prototype, "vertices", {
get: function () {
return this.geometry.getBuffer("aVertexPosition").data;
},
set: function (a) {
this.geometry.getBuffer("aVertexPosition").data = a;
},
enumerable: false,
configurable: true
});
b.prototype._render = function (b) {
if (this.autoUpdate) {
this.geometry.getBuffer("aVertexPosition").update();
}
a.prototype._render.call(this, b);
};
})(Zg);
(function (a) {
function b(b, c, d, e, f) {
if (c === undefined) {
c = 10;
}
if (d === undefined) {
d = 10;
}
if (e === undefined) {
e = 10;
}
if (f === undefined) {
f = 10;
}
var g = a.call(this, Sc.WHITE, 4, 4) || this;
g._origWidth = b.orig.width;
g._origHeight = b.orig.height;
g._width = g._origWidth;
g._height = g._origHeight;
g._leftWidth = c;
g._rightWidth = e;
g._topHeight = d;
g._bottomHeight = f;
g.texture = b;
return g;
}
oi(b, a);
b.prototype.textureUpdated = function () {
this._textureID = this.shader.texture._updateID;
this._refresh();
};
Object.defineProperty(b.prototype, "vertices", {
get: function () {
return this.geometry.getBuffer("aVertexPosition").data;
},
set: function (a) {
this.geometry.getBuffer("aVertexPosition").data = a;
},
enumerable: false,
configurable: true
});
b.prototype.updateHorizontalVertices = function () {
var a = this.vertices;
var b = this._getMinScale();
a[9] = a[11] = a[13] = a[15] = this._topHeight * b;
a[17] = a[19] = a[21] = a[23] = this._height - this._bottomHeight * b;
a[25] = a[27] = a[29] = a[31] = this._height;
};
b.prototype.updateVerticalVertices = function () {
var a = this.vertices;
var b = this._getMinScale();
a[2] = a[10] = a[18] = a[26] = this._leftWidth * b;
a[4] = a[12] = a[20] = a[28] = this._width - this._rightWidth * b;
a[6] = a[14] = a[22] = a[30] = this._width;
};
b.prototype._getMinScale = function () {
var a = this._leftWidth + this._rightWidth;
var b = this._width > a ? 1 : this._width / a;
var c = this._topHeight + this._bottomHeight;
var d = this._height > c ? 1 : this._height / c;
return Math.min(b, d);
};
Object.defineProperty(b.prototype, "width", {
get: function () {
return this._width;
},
set: function (a) {
this._width = a;
this._refresh();
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "height", {
get: function () {
return this._height;
},
set: function (a) {
this._height = a;
this._refresh();
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "leftWidth", {
get: function () {
return this._leftWidth;
},
set: function (a) {
this._leftWidth = a;
this._refresh();
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "rightWidth", {
get: function () {
return this._rightWidth;
},
set: function (a) {
this._rightWidth = a;
this._refresh();
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "topHeight", {
get: function () {
return this._topHeight;
},
set: function (a) {
this._topHeight = a;
this._refresh();
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "bottomHeight", {
get: function () {
return this._bottomHeight;
},
set: function (a) {
this._bottomHeight = a;
this._refresh();
},
enumerable: false,
configurable: true
});
b.prototype._refresh = function () {
var a = this.texture;
var b = this.geometry.buffers[1].data;
this._origWidth = a.orig.width;
this._origHeight = a.orig.height;
var c = 1 / this._origWidth;
var d = 1 / this._origHeight;
b[0] = b[8] = b[16] = b[24] = 0;
b[1] = b[3] = b[5] = b[7] = 0;
b[6] = b[14] = b[22] = b[30] = 1;
b[25] = b[27] = b[29] = b[31] = 1;
b[2] = b[10] = b[18] = b[26] = c * this._leftWidth;
b[4] = b[12] = b[20] = b[28] = 1 - c * this._rightWidth;
b[9] = b[11] = b[13] = b[15] = d * this._topHeight;
b[17] = b[19] = b[21] = b[23] = 1 - d * this._bottomHeight;
this.updateHorizontalVertices();
this.updateVerticalVertices();
this.geometry.buffers[0].update();
this.geometry.buffers[1].update();
};
})(ri);
function si(a, b) {
si = Object.setPrototypeOf || {
"__proto__": []
}
instanceof Array && function (a, b) {
a.__proto__ = b;
} || function (a, b) {
for (var c in b) {
if (b.hasOwnProperty(c)) {
a[c] = b[c];
}
}
};
return si(a, b);
}
(function (a) {
function b(b, c) {
if (c === undefined) {
c = true;
}
var d = a.call(this, b[0] instanceof Sc ? b[0] : b[0].texture) || this;
d._textures = null;
d._durations = null;
d._autoUpdate = c;
d._isConnectedToTicker = false;
d.animationSpeed = 1;
d.loop = true;
d.updateAnchor = false;
d.onComplete = null;
d.onFrameChange = null;
d.onLoop = null;
d._currentTime = 0;
d._playing = false;
d._previousFrame = null;
d.textures = b;
return d;
}
(function (a, b) {
function c() {
this.constructor = a;
}
si(a, b);
a.prototype = b === null ? Object.create(b) : (c.prototype = b.prototype, new c());
})(b, a);
b.prototype.stop = function () {
if (this._playing) {
this._playing = false;
if (this._autoUpdate && this._isConnectedToTicker) {
ic.shared.remove(this.update, this);
this._isConnectedToTicker = false;
}
}
};
b.prototype.play = function () {
if (!this._playing) {
this._playing = true;
if (this._autoUpdate && !this._isConnectedToTicker) {
ic.shared.add(this.update, this, ec.HIGH);
this._isConnectedToTicker = true;
}
}
};
b.prototype.gotoAndStop = function (a) {
this.stop();
var b = this.currentFrame;
this._currentTime = a;
if (b !== this.currentFrame) {
this.updateTexture();
}
};
b.prototype.gotoAndPlay = function (a) {
var b = this.currentFrame;
this._currentTime = a;
if (b !== this.currentFrame) {
this.updateTexture();
}
this.play();
};
b.prototype.update = function (a) {
if (this._playing) {
var b = this.animationSpeed * a;
var c = this.currentFrame;
if (this._durations !== null) {
var d = this._currentTime % 1 * this._durations[this.currentFrame];
for (d += b / 60 * 1000; d < 0;) {
this._currentTime--;
d += this._durations[this.currentFrame];
}
var e = Math.sign(this.animationSpeed * a);
for (this._currentTime = Math.floor(this._currentTime); d >= this._durations[this.currentFrame];) {
d -= this._durations[this.currentFrame] * e;
this._currentTime += e;
}
this._currentTime += d / this._durations[this.currentFrame];
} else {
this._currentTime += b;
}
if (this._currentTime < 0 && !this.loop) {
this.gotoAndStop(0);
if (this.onComplete) {
this.onComplete();
}
} else if (this._currentTime >= this._textures.length && !this.loop) {
this.gotoAndStop(this._textures.length - 1);
if (this.onComplete) {
this.onComplete();
}
} else if (c !== this.currentFrame) {
if (this.loop && this.onLoop && (this.animationSpeed > 0 && this.currentFrame < c || this.animationSpeed < 0 && this.currentFrame > c)) {
this.onLoop();
}
this.updateTexture();
}
}
};
b.prototype.updateTexture = function () {
var a = this.currentFrame;
if (this._previousFrame !== a) {
this._previousFrame = a;
this._texture = this._textures[a];
this._textureID = -1;
this._textureTrimmedID = -1;
this._cachedTint = 16777215;
this.uvs = this._texture._uvs.uvsFloat32;
if (this.updateAnchor) {
this._anchor.copyFrom(this._texture.defaultAnchor);
}
if (this.onFrameChange) {
this.onFrameChange(this.currentFrame);
}
}
};
b.prototype.destroy = function (b) {
this.stop();
a.prototype.destroy.call(this, b);
this.onComplete = null;
this.onFrameChange = null;
this.onLoop = null;
};
b.fromFrames = function (a) {
for (var c = [], d = 0; d < a.length; ++d) {
c.push(Sc.from(a[d]));
}
return new b(c);
};
b.fromImages = function (a) {
for (var c = [], d = 0; d < a.length; ++d) {
c.push(Sc.from(a[d]));
}
return new b(c);
};
Object.defineProperty(b.prototype, "totalFrames", {
get: function () {
return this._textures.length;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "textures", {
get: function () {
return this._textures;
},
set: function (a) {
if (a[0] instanceof Sc) {
this._textures = a;
this._durations = null;
} else {
this._textures = [];
this._durations = [];
for (var b = 0; b < a.length; b++) {
this._textures.push(a[b].texture);
this._durations.push(a[b].time);
}
}
this._previousFrame = null;
this.gotoAndStop(0);
this.updateTexture();
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "currentFrame", {
get: function () {
var a = Math.floor(this._currentTime) % this._textures.length;
if (a < 0) {
a += this._textures.length;
}
return a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "playing", {
get: function () {
return this._playing;
},
enumerable: false,
configurable: true
});
Object.defineProperty(b.prototype, "autoUpdate", {
get: function () {
return this._autoUpdate;
},
set: function (a) {
if (a !== this._autoUpdate) {
this._autoUpdate = a;
if (!this._autoUpdate && this._isConnectedToTicker) {
ic.shared.remove(this.update, this);
this._isConnectedToTicker = false;
} else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) {
ic.shared.add(this.update, this);
this._isConnectedToTicker = true;
}
}
},
enumerable: false,
configurable: true
});
})(ng);
se.registerPlugin("accessibility", gc);
se.registerPlugin("extract", Me);
se.registerPlugin("interaction", rc);
se.registerPlugin("particle", Hf);
se.registerPlugin("prepare", Kg);
se.registerPlugin("batch", De);
se.registerPlugin("tilingSprite", Tg);
af.registerPlugin(oh);
af.registerPlugin(nf);
af.registerPlugin(wf);
af.registerPlugin(Bf);
af.registerPlugin(Mg);
Je.registerPlugin(jc);
Je.registerPlugin(df);
class ti {
constructor(a = null) {
this.attachments = [];
this.parent = null;
this.isVisible = true;
this.setNode(a || new dc());
}
getNode() {
return this.node;
}
setNode(a) {
this.node = a;
}
getParent() {
return this.parent;
}
setParent(a) {
if (a == null) {
this.currentModel?.removedParentFunction?.();
}
this.parent = a;
}
getAttachments() {
return this.attachments;
}
addAttachment(a, b = 0) {
a.getNode().zIndex = b;
a.setParent(this);
this.node.addChild(a.getNode());
this.attachments.push(a);
this.node.children.sort((a, b) => a.zIndex == b.zIndex ? 0 : a.zIndex < b.zIndex ? -1 : 1);
}
removeAttachment(a) {
if (a) {
this.node.removeChild(a.getNode());
a.setParent(null);
if (this.attachments.indexOf(a) > -1) {
this.attachments.splice(this.attachments.indexOf(a), 1);
}
}
}
getRotation() {
return this.node.rotation * 180 / Math.PI;
}
setRotation(a) {
this.node.rotation = a * Math.PI / 180;
}
getAlpha() {
return this.node.alpha;
}
setAlpha(a) {
if (this.node.alpha !== a) {
this.node.alpha = a;
}
}
getScale() {
return this.node.scale;
}
setScale(a) {
this.node.scale.x = a;
this.node.scale.y = a;
}
getScaleX() {
return this.node.scale.x;
}
setScaleX(a) {
this.node.scale.x = a;
}
getScaleY() {
return this.node.scale.y;
}
setScaleY(a) {
this.node.scale.y = a;
}
getFilters() {
return this.node.filters;
}
setFilters(a) {
this.node.filters = a;
}
getPosition() {
return this.node.position;
}
setPosition(a, b) {
if (this.node.position.x !== a) {
this.node.position.x = a;
}
if (this.node.position.y !== b) {
this.node.position.y = b;
}
}
getPositionX() {
return this.node.position.x;
}
setPositionX(a) {
if (this.node.position.x !== a) {
this.node.position.x = a;
}
}
getPositionY() {
return this.node.position.y;
}
setPositionY(a) {
if (this.node.position.y !== a) {
this.node.position.y = a;
}
}
getPivotPoint() {
return this.node.pivot;
}
setPivotPoint(a, b) {
this.node.pivot.x = a;
this.node.pivot.y = b;
}
getVisible() {
return this.isVisible;
}
setVisible(a) {
this.isVisible = a;
this.node.visible = a;
}
update(a, b) {
for (let c = 0; c < this.attachments.length; c++) {
this.attachments[c].update(a, b);
}
}
}
class ui extends ti {
constructor(a, b, c) {
super();
this.text = new xg(a, {
fontFamily: b,
fontSize: c,
lineJoin: "round",
padding: 10
});
this.text.resolution = window.devicePixelRatio * 2;
this.setNode(this.text);
}
setColor(a, b, c) {
this.text.style.fill = a << 16 | b << 8 | c;
}
setStroke(a, b, c, d) {
this.text.style.stroke = a << 16 | b << 8 | c;
this.text.style.strokeThickness = d;
}
setFontWeight(a) {
this.text.style.fontWeight = a;
}
setLetterSpacing(a) {
this.text.style.letterSpacing = a;
}
setAnchor(a, b) {
this.text.anchor.set(a, b);
}
setString(a) {
this.text.text = a;
}
getString() {
return this.text.text;
}
}
class vi extends ti {
constructor() {
super();
this.wasPreloaded = false;
}
preload() {
this.wasPreloaded = true;
}
reset() {
this.setParent(null);
}
}
class wi extends vi {
constructor() {
super();
this.lastDamagedTick = 0;
this.lastDamagedAnimationDone = true;
this.lastFiringTick = 0;
this.lastFiringAnimationDone = true;
}
update(a, b) {
const c = this.getParent();
if (b) {
this.updateDamageTint(b);
this.weaponUpdateFunc?.(b, c);
}
super.update(a, b);
}
updateDamageTint(a) {
if (a.lastDamagedTick && (a.lastDamagedTick !== this.lastDamagedTick || !this.lastDamagedAnimationDone)) {
this.lastDamagedTick = a.lastDamagedTick;
this.lastDamagedAnimationDone = false;
const b = Jj.renderer.replicator.getMsSinceTick(a.lastDamagedTick);
const c = 100;
const d = Math.min(b / c, 1);
const e = Math.sin(d * Math.PI);
let f = 255 << 16 | 255 - e * 255 / 4 << 8 | 255 - e * 255 / 4 << 0;
if (d === 1) {
f = 16777215;
this.lastDamagedAnimationDone = true;
}
this.base.setTint(f);
if (this.weapon) {
this.weapon.setTint(f);
}
}
}
updatePunchingWeapon(a = 300) {
return (b, c) => {
if (b.firingTick && (b.firingTick !== this.lastFiringTick || !this.lastFiringAnimationDone)) {
this.lastFiringTick = b.firingTick;
this.lastFiringAnimationDone = false;
const c = Jj.currentGame.world.getReplicator().getMsSinceTick(b.firingTick);
const d = Math.min(c / a, 1);
const e = Math.sin(d * 2 * Math.PI) / Math.PI * -1;
if (d === 1) {
this.lastFiringAnimationDone = true;
}
this.weapon.setPositionY(e * 20);
}
};
}
updateStabbingWeapon(a = 300) {
return (b, c) => {
if (b.firingTick && (b.firingTick !== this.lastFiringTick || !this.lastFiringAnimationDone)) {
this.lastFiringTick = b.firingTick;
this.lastFiringAnimationDone = false;
const c = Jj.renderer.replicator.getMsSinceTick(b.firingTick);
const d = Math.min(c / a, 1);
const e = Math.sin(d * 2 * Math.PI) / Math.PI * -1;
if (d === 1) {
this.lastFiringAnimationDone = true;
}
if (c < a / 2) {
this.weaponLeft.setPositionY(e * 20);
} else {
this.weaponRight.setPositionY(e * 20);
}
}
};
}
updateAntiClockwiseSwingingWeapon(a = 300, b = 100) {
return (c, d) => {
if (c.firingTick && (c.firingTick !== this.lastFiringTick || !this.lastFiringAnimationDone)) {
this.lastFiringTick = c.firingTick;
this.lastFiringAnimationDone = false;
const d = Jj.renderer.replicator.getMsSinceTick(c.firingTick);
const e = Math.min(d / a, 1);
const f = Math.sin(e * Math.PI) * b;
if (e === 1) {
this.lastFiringAnimationDone = true;
}
this.weapon.setRotation(-f);
}
};
}
updateClockwiseSwingingWeapon(a = 300, b = 100) {
return (c, d) => {
if (c.firingTick && (c.firingTick !== this.lastFiringTick || !this.lastFiringAnimationDone)) {
this.lastFiringTick = c.firingTick;
this.lastFiringAnimationDone = false;
const d = Jj.renderer.replicator.getMsSinceTick(c.firingTick);
const e = Math.min(d / a, 1);
const f = Math.sin(e * Math.PI) * b;
if (e === 1) {
this.lastFiringAnimationDone = true;
}
this.weapon.setRotation(f);
}
};
}
updateBowWeapon(a = 500, b = 250) {
return (c, d) => {
if (c.firingTick && (c.firingTick !== this.lastFiringTick || !this.lastFiringAnimationDone)) {
if (c.startChargingTick) {
this.lastFiringAnimationDone = false;
const b = Jj.renderer.replicator.getMsSinceTick(c.startChargingTick);
const d = Math.min(b / a, 1);
this.bowHands.setPositionY(d * 10);
} else if (c.firingTick && (c.firingTick !== this.lastFiringTick || !this.lastFiringAnimationDone)) {
this.lastFiringTick = c.firingTick;
this.lastFiringAnimationDone = false;
const a = Jj.renderer.replicator.getMsSinceTick(c.firingTick);
const d = Math.min(a / b, 1);
if (d === 1) {
this.lastFiringAnimationDone = true;
}
this.bowHands.setPositionY(10 - d * 10);
}
}
};
}
}
class xi extends ti {
constructor() {
super();
this.draw = new jg();
this.clear();
this.setNode(this.draw);
}
drawTriangle(a, b, c, d = null, e = null, f = null) {
if (f && f > 0) {
this.draw.lineStyle(f, e.r << 16 | e.g << 8 | e.b, e.a);
}
if (d) {
this.draw.beginFill(d.r << 16 | d.g << 8 | d.b, d.a);
}
this.draw.drawPolygon([a.x, a.y, b.x, b.y, c.x, c.y]);
if (d) {
this.draw.endFill();
}
}
drawArc(a, b, c, d, e, f, g = null, h = null, i = null) {
if (i && i > 0) {
this.draw.lineStyle(i, h.r << 16 | h.g << 8 | h.b, h.a);
}
d = d * Math.PI / 180;
e = e * Math.PI / 180;
if (g) {
this.draw.beginFill(g.r << 16 | g.g << 8 | g.b, g.a);
}
this.draw.arc(a, b, c, d, e, f);
if (g) {
this.draw.endFill();
}
}
drawCircle(a, b, c, d = null, e = null, f = null) {
if (f && f > 0) {
this.draw.lineStyle(f, e.r << 16 | e.g << 8 | e.b, e.a);
}
if (d) {
this.draw.beginFill(d.r << 16 | d.g << 8 | d.b, d.a);
}
this.draw.drawCircle(a, b, c);
if (d) {
this.draw.endFill();
}
}
drawRect(a, b, c, d, e = null, f = null, g = null) {
if (g && g > 0) {
this.draw.lineStyle(g, f.r << 16 | f.g << 8 | f.b, f.a);
}
if (e) {
this.draw.beginFill(e.r << 16 | e.g << 8 | e.b, e.a);
}
this.draw.drawRect(a, b, c - a, d - b);
if (e) {
this.draw.endFill();
}
}
drawRoundedRect(a, b, c, d, e, f = null, g = null, h = null) {
if (h && h > 0) {
this.draw.lineStyle(h, g.r << 16 | g.g << 8 | g.b, g.a);
}
if (f) {
this.draw.beginFill(f.r << 16 | f.g << 8 | f.b, f.a);
}
this.draw.drawRoundedRect(a, b, c - a, d - b, e);
if (f) {
this.draw.endFill();
}
}
drawEllipse(a, b, c, d, e = null, f = null, g = null) {
if (g && g > 0) {
this.draw.lineStyle(g, f.r << 16 | f.g << 8 | f.b, f.a);
}
if (e) {
this.draw.beginFill(e.r << 16 | e.g << 8 | e.b, e.a);
}
this.draw.drawEllipse(a, b, c, d);
if (e) {
this.draw.endFill();
}
}
getTexture() {
return Jj.renderer.getInternalRenderer().generateTexture(this.draw);
}
clear() {
this.draw.clear();
}
}
class yi extends ti {
constructor(a) {
super();
this.barColor = a || {
r: 100,
g: 161,
b: 10
};
this.width = 84;
this.height = 12;
this.backgroundNode = new xi();
this.backgroundNode.drawRoundedRect(0, 0, this.width, this.height, 3, {
r: 0,
g: 0,
b: 0
});
this.backgroundNode.setAlpha(0.3);
this.barNode = new xi();
this.barNode.drawRoundedRect(2, 2, this.width - 2, this.height - 2, 2, this.barColor);
this.addAttachment(this.backgroundNode);
this.addAttachment(this.barNode);
this.setPivotPoint(this.width / 2, -64);
this.setMaxHealth(100);
this.setHealth(100);
}
setSize(a, b) {
const c = this.percent;
this.width = a;
this.height = b;
this.percent = null;
this.backgroundNode.clear();
this.backgroundNode.drawRoundedRect(0, 0, this.width, this.height, 3, {
r: 0,
g: 0,
b: 0
});
this.barNode.clear();
this.barNode.drawRoundedRect(2, 2, this.width - 2, this.height - 2, 2, this.barColor);
this.setPivotPoint(this.width / 2, -64);
this.setPercent(c);
}
setHealth(a) {
this.health = a;
this.setPercent(this.health / this.maxHealth);
}
setMaxHealth(a) {
this.maxHealth = a;
this.setPercent(this.health / this.maxHealth);
}
setPercent(a) {
if (this.percent !== a) {
this.percent = a;
this.barNode.setScaleX(this.percent);
}
}
update(a, b) {
if (b) {
this.setHealth(b.health);
this.setMaxHealth(b.maxHealth);
}
this.setRotation(-this.getParent().getParent().getRotation());
super.update(a, b);
}
}
class zi extends ti {
constructor() {
super();
this.barColor = {
r: 61,
g: 161,
b: 217
};
this.width = 76;
this.height = 8;
this.percent = 1;
this.backgroundNode = new xi();
this.backgroundNode.drawRoundedRect(0, 0, this.width, this.height, 3, {
r: 0,
g: 0,
b: 0
});
this.backgroundNode.setAlpha(0.3);
this.barNode = new xi();
this.addAttachment(this.backgroundNode);
this.addAttachment(this.barNode);
this.setPivotPoint(this.width / 2, -80);
this.setMaxHealth(100);
this.setHealth(100);
}
setSize(a, b) {
var c = this.percent;
this.width = a;
this.height = b;
this.percent = null;
this.backgroundNode.clear();
this.backgroundNode.drawRoundedRect(0, 0, this.width, this.height, 3, {
r: 0,
g: 0,
b: 0
});
this.setPivotPoint(this.width / 2, -80);
this.setPercent(c);
}
setHealth(a) {
this.health = a;
this.setPercent(this.health / this.maxHealth);
}
setMaxHealth(a) {
this.maxHealth = a;
this.setPercent(this.health / this.maxHealth);
}
setPercent(a) {
if (this.percent !== a && (this.percent = a, this.barNode.clear(), this.health !== 0)) {
var b = (this.width - 2) * this.percent;
this.barNode.drawRoundedRect(2, 2, b, this.height - 2, 2, this.barColor);
}
}
update(a, b) {
this.getParent();
if (b) {
this.setHealth(b.zombieShieldHealth);
this.setMaxHealth(b.zombieShieldMaxHealth);
}
this.setRotation(-this.getParent().getParent().getRotation());
super.update(a, b);
}
}
class Ai extends ti {
constructor(a, b = false) {
super();
this.sprite = null;
if (typeof a == "string") {
a = Jj.renderer.loader.resources[a] !== undefined ? Jj.renderer.loader.resources[a].texture : Sc.from(a);
}
if (b) {
this.sprite = new Qg(a);
this.sprite.texture.baseTexture.scaleMode = va.NEAREST;
} else {
this.sprite = new ng(a);
}
this.sprite.anchor.x = 0.5;
this.sprite.anchor.y = 0.5;
this.setNode(this.sprite);
}
getAnchor() {
return this.sprite.anchor;
}
setAnchor(a, b) {
this.sprite.anchor.x = a;
this.sprite.anchor.y = b;
}
getTint() {
return this.node.tint;
}
setTint(a) {
this.node.tint = a;
}
getBlendMode() {
return this.node.tint;
}
setBlendMode(a) {
this.node.blendMode = a;
}
getMask() {
return this.node.mask;
}
setMask(a) {
this.node.mask = a.getNode();
}
setDimensions(a, b, c, d) {
this.sprite.x = a;
this.sprite.y = b;
this.sprite.width = c;
this.sprite.height = d;
}
}
const Bi = c(6);
const Ci = c(573);
Bi.loadPlugin(Ci);
Bi.setDefaults({
randomize: false
});
class Di extends vi {
constructor(a) {
super();
this.type = a;
this.healthBar = new yi();
this.healthBar.setSize(82, 16);
this.healthBar.setPivotPoint(41, -25);
this.healthBar.setVisible(false);
this.addAttachment(this.healthBar, 100);
this.lastYaw = 0;
}
update(a, b) {
if (b) {
this.updateModel(b.tier);
this.updateHealthBar(b);
this.head?.setRotation(b.aimingYaw);
}
super.update(a, b);
}
updateModel(a = 1) {
if (a != this.currentTier) {
this.currentTier = a;
this.removeAttachment(this.base);
this.removeAttachment(this.head);
if (![1, 2, 3, 4, 5, 6, 7, 8].includes(a)) {
throw new Error("Unknown tier encountered for " + this.type + " tower: " + a);
}
this.base = new Ai("http://zombia.io/asset/images/Entity/" + this.type + "/" + this.type + "Tier" + a + "Base.svg");
this.head = new Ai("http://zombia.io/asset/images/Entity/" + this.type + "/" + this.type + "Tier" + a + "Head.svg");
this.addAttachment(this.base, 2);
this.addAttachment(this.head, 3);
}
}
updateHealthBar(a) {
this.healthBar.setVisible(a.health !== a.maxHealth);
}
}
let Ei = {
Player: class extends wi {
constructor() {
super();
this.base = new Ai("https://cdn.glitch.com/65698807-c047-4e77-bf51-7937b4cef560%2Fzombie-boss-t1-base%5B1%5D.svg");
this.addAttachment(this.base, 2);
this.nameEntity = new ui("Player", "Hammersmith One", 20);
this.nameEntity.setAnchor(0.5, 0.5);
this.nameEntity.setPivotPoint(0, 70);
this.nameEntity.setColor(220, 220, 220);
this.nameEntity.setFontWeight("bold");
this.nameEntity.setStroke(51, 51, 51, 6);
this.nameEntity.setLetterSpacing(1);
this.addAttachment(this.nameEntity, 0);
this.healthBar = new yi();
this.addAttachment(this.healthBar, 0);
this.shieldBar = new zi();
this.addAttachment(this.shieldBar, 0);
this.shieldBar.setVisible(false);
this.rotationLocked = true;
this.nameFiltered = undefined;
this.invulnerabilityAnimationProps = {
isForward: true,
elapsedTime: 0,
animationDuration: 750
};
}
update(a, b) {
const c = this.getParent();
if (b) {
if (c.isLocal() && c.getTargetTick().dead !== true) {
c.getTargetTick().aimingYaw = c.getFromTick().aimingYaw = Jj.network.inputPacketManager.getLastSentYaw();
}
if (b.name !== this.lastName) {
this.lastName = b.name;
this.nameEntity.setString(b.name);
}
if (this.nameFiltered !== Jj.network.languageFilterEnabled) {
this.nameFiltered = !!Jj.network.languageFilterEnabled;
this.nameEntity.setString(this.nameFiltered ? Bi(this.lastName) : this.lastName);
}
if (b.weaponName !== this.lastWeaponName || b.weaponTier !== this.lastWeaponTier) {
this.updateWeapon(b);
}
this.healthBar.setVisible(b.health < b.maxHealth);
if (b.zombieShieldMaxHealth > 0) {
this.shieldBar.setVisible(b.zombieShieldHealth < b.zombieShieldMaxHealth);
} else {
this.shieldBar.setVisible(false);
}
if (b.invulnerable !== undefined) {
this.updateInvulnerabilityIndicator(a, b);
}
}
super.update(a, b);
this.nameEntity.setRotation(-c.getRotation());
}
updateInvulnerabilityIndicator(a, b) {
if (b.invulnerable == 1) {
let b = 16752543;
let c = 16777215;
this.invulnerabilityAnimationProps.elapsedTime += a;
let d = Math.min(this.invulnerabilityAnimationProps.elapsedTime / this.invulnerabilityAnimationProps.animationDuration, 1);
if (!this.invulnerabilityAnimationProps.isForward) {
d = 1 - d;
}
const e = c >> 16 & 255;
const f = c >> 8 & 255;
const g = c & 255;
const h = (e + ((b >> 16 & 255) - e) * d << 16) + (f + ((b >> 8 & 255) - f) * d << 8) + (g + ((b & 255) - g) * d);
this.base.setTint(h);
this.weapon.setTint(h);
if (d >= 1 || d <= 0) {
this.invulnerabilityAnimationProps.isForward = !this.invulnerabilityAnimationProps.isForward;
this.invulnerabilityAnimationProps.elapsedTime = 0;
}
} else {
this.base.setTint(16777215);
this.weapon.setTint(16777215);
}
}
updateAntiClockwiseSwingingWeapon(a = 300, b = 100) {
return (c, d) => {
const e = i.interpolateYaw(d.getFromTick().aimingYaw, d.getTargetTick().aimingYaw);
this.setRotation(e);
if (c.firingTick && (c.firingTick !== this.lastFiringTick || !this.lastFiringAnimationDone)) {
this.lastFiringTick = c.firingTick;
this.lastFiringAnimationDone = false;
var f = Jj.renderer.replicator.getMsSinceTick(c.firingTick);
var g = Math.min(f / a, 1);
var h = Math.sin(g * Math.PI) * b;
if (g === 1) {
this.lastFiringAnimationDone = true;
}
this.setRotation(e - h);
}
};
}
updateBowWeapon(a = 500, b = 250) {
return (c, d) => {
const e = i.interpolateYaw(d.getFromTick().aimingYaw, d.getTargetTick().aimingYaw);
this.setRotation(e);
if (c.startChargingTick) {
this.lastFiringAnimationDone = false;
let b = Jj.renderer.replicator.getMsSinceTick(c.startChargingTick);
let d = Math.min(b / a, 1);
this.bowHands.setPositionY(d * 10);
} else if (c.firingTick && (c.firingTick !== this.lastFiringTick || !this.lastFiringAnimationDone)) {
this.lastFiringTick = c.firingTick;
this.lastFiringAnimationDone = false;
const a = Jj.renderer.replicator.getMsSinceTick(c.firingTick);
const d = Math.min(a / b, 1);
if (d === 1) {
this.lastFiringAnimationDone = true;
}
this.bowHands.setPositionY(10 - d * 10);
}
};
}
updateDynamiteWeapon(a = 300, b = 100) {
return (c, d) => {
const e = i.interpolateYaw(d.getFromTick().aimingYaw, d.getTargetTick().aimingYaw);
this.setRotation(e);
if (c.firingTick && (c.firingTick !== this.lastFiringTick || !this.lastFiringAnimationDone)) {
this.lastFiringTick = c.firingTick;
this.lastFiringAnimationDone = false;
var f = Jj.renderer.replicator.getMsSinceTick(c.firingTick);
var g = Math.min(f / a, 1);
var h = Math.sin(g * Math.PI) * b;
if (g === 1) {
this.lastFiringAnimationDone = true;
}
this.weapon.setRotation(-h);
}
};
}
updateWeapon(a) {
this.lastWeaponName = a.weaponName;
this.lastWeaponTier = a.weaponTier;
this.removeAttachment(this.weapon);
this.removeAttachment(this.dormantArm);
this.removeAttachment(this.bowHands);
this.bowHands = null;
switch (a.weaponName) {
case "Pickaxe":
case "Sword":
let b = new Ai("http://zombia.io/asset/images/Entity/Player/Player" + a.weaponName + "Tier" + a.weaponTier + ".svg");
b.setAnchor(0.5, 0.9);
this.weapon = b;
this.weaponUpdateFunc = this.updateAntiClockwiseSwingingWeapon(Jj.ui.toolData[a.weaponName].msBetweenFires[a.weaponTier - 1], 100);
break;
case "Crossbow":
let c = new Ai("http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier" + a.weaponTier + ".svg");
let d = new Ai("http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier" + a.weaponTier + ".svg");
d.setAnchor(1, 1);
c.setAnchor(0.5, 1);
this.weapon = c;
this.bowHands = d;
this.weaponUpdateFunc = this.updateBowWeapon(Jj.ui.toolData[a.weaponName].msBetweenFires[a.weaponTier - 1], 250);
break;
case "Dynamite":
let e = new Ai("http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier" + a.weaponTier + ".svg");
e.setAnchor(0.5, 0.9);
this.dormantArm = new Ai("http://zombia.io/asset/images/Entity/Player/PlayerEmptyDynamiteHand.svg");
this.dormantArm.setAnchor(0.5, 1.35);
this.addAttachment(this.dormantArm, 1);
this.weapon = e;
this.weaponUpdateFunc = this.updateDynamiteWeapon(250, 75);
break;
default:
throw new Error("Unknown player weapon: " + a.weaponName);
}
if (this.bowHands !== null) {
this.addAttachment(this.bowHands);
}
this.addAttachment(this.weapon, 1);
}
updateDamageTint(a) {
if (a.zombieShieldHealth > 0) {
this.base.setTint(16777215);
this.weapon.setTint(16777215);
return;
}
super.updateDamageTint(a);
}
},
Resource: class extends vi {
constructor(a) {
super();
this.base = new Ai("http://zombia.io/asset/images/Map/" + a + ".svg");
this.addAttachment(this.base, 1);
}
update(a, b) {
if (b) {
if (b.hits !== undefined) {
this.updateHit(b);
}
if (Math.round(this.base.getRotation()) !== b.aimingYaw) {
this.base.setRotation(b.aimingYaw);
}
}
super.update(a, b);
}
updateHit(a) {
let b = 0;
let c = 0;
for (let d = 0; d < a.hits.length / 2; d++) {
const e = a.hits[d * 2 + 0];
const f = a.hits[d * 2 + 1];
const g = Jj.renderer.replicator.getMsSinceTick(e);
if (g >= 250) {
continue;
}
const h = Math.min(g / 250, 1);
const i = Math.sin(f * Math.PI / 180);
const j = Math.cos(f * Math.PI / 180) * -1;
b += i * 10 * Math.sin(h * Math.PI);
c += j * 10 * Math.sin(h * Math.PI);
}
const d = Math.sqrt(b * b + c * c);
if (d > 10) {
b /= d;
c /= d;
b *= 10;
c *= 10;
}
this.base.setPosition(b, c);
}
},
ArrowTower: class extends Di {
constructor() {
super("ArrowTower");
}
},
MageTower: class extends Di {
constructor() {
super("MageTower");
}
update(a, b) {
super.update(a, b);
if (b && b.firingTick) {
const a = Jj.renderer.replicator.getMsSinceTick(b.firingTick);
const c = 250;
const d = 0.4;
const e = Math.min(a / c, 1);
const f = 1 + Math.sin(e * Math.PI) * d;
this.head.setScale(f);
}
}
updateModel(a = 1) {
if (a != this.currentTier) {
this.currentTier = a;
this.removeAttachment(this.base);
this.removeAttachment(this.head);
if (![1, 2, 3, 4, 5, 6, 7, 8].includes(this.currentTier)) {
throw new Error("Unknown tier encountered for " + this.type + " tower: " + a);
}
this.base = new Ai("http://zombia.io/asset/images/Entity/" + this.type + "/" + this.type + "Tier" + a + "Base.svg");
this.head = new Ai("http://zombia.io/asset/images/Entity/" + this.type + "/" + this.type + "Head.svg");
this.addAttachment(this.base, 2);
this.addAttachment(this.head, 3);
}
}
},
Factory: class extends vi {
constructor() {
super();
this.healthBar = new yi();
this.healthBar.setSize(82, 16);
this.healthBar.setPivotPoint(41, -25);
this.healthBar.setVisible(false);
this.addAttachment(this.healthBar, 3);
this.currentTier = null;
this.updateModel();
}
update(a, b) {
if (b) {
this.updateModel(b.tier);
this.updateHealthBar(b);
}
super.update(a, b);
}
updateModel(a = 1) {
if (a !== this.currentTier) {
this.currentTier = a;
this.removeAttachment(this.base);
if (![1, 2, 3, 4, 5, 6, 7, 8].includes(a)) {
throw new Error("Unknown tier encountered for gold stash: " + a);
}
this.base = new Ai("http://zombia.io/asset/images/Entity/Factory/FactoryTier" + a + "Base.svg");
this.addAttachment(this.base, 2);
}
}
updateHealthBar(a) {
this.healthBar.setVisible(a.health !== a.maxHealth);
}
},
Projectile: class extends vi {
constructor(a) {
super();
this.base = new Ai("http://zombia.io/asset/images/Entity/Projectile/" + a + ".svg");
this.addAttachment(this.base);
}
},
DynamiteProjectile: class extends vi {
constructor(a, b = 1) {
super();
this.tier = b;
this.currentRotation = 0;
this.base = new Ai("http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier" + b + ".svg");
this.addAttachment(this.base);
}
update(a, b) {
if (b) {
this.currentRotation += a * 540 / 1000;
this.currentRotation %= 360;
this.base.setRotation(this.currentRotation);
}
}
onDie() {
if (window.storage.getItem("settings-special-effects") == "true") {
return;
}
const a = new jg();
Jj.renderer.groundLayer.node.addChild(a);
const b = this.getParent().targetTick.position;
let c = 0;
const d = Jj.ui.toolData.Dynamite.projectileSplashDamageRange[this.getParent().targetTick.tier - 1];
a.update = e => {
a.clear();
a.lineStyle(10, 16777215, 0.1);
a.drawCircle(b.x, b.y, c);
a.endFill();
c += d / 200 * e;
if (c >= d) {
Jj.renderer.groundLayer.node.removeChild(a);
Jj.renderer.renderingFilters.splice(Jj.renderer.renderingFilters.indexOf(a), 1);
a.destroy();
}
};
Jj.renderer.renderingFilters.push(a);
}
},
RocketProjectile: class extends vi {
constructor(a, b = 1) {
super();
this.tier = b;
this.currentRotation = 0;
this.base = new Ai("http://zombia.io/asset/images/Entity/Projectile/RocketProjectile.svg");
this.addAttachment(this.base);
}
onDie() {
if (window.storage.getItem("settings-special-effects") == "true") {
return;
}
const a = new jg();
Jj.renderer.groundLayer.node.addChild(a);
const b = this.getParent().targetTick.position;
let c = 0;
const d = Jj.ui.buildingData.RocketTower.projectileAoeRadius[this.tier - 1];
a.update = e => {
a.clear();
a.lineStyle(10, 16777215, 0.1);
a.drawCircle(b.x, b.y, c);
a.endFill();
c += d / 100 * e;
if (c >= d) {
Jj.renderer.groundLayer.node.removeChild(a);
Jj.renderer.renderingFilters.splice(Jj.renderer.renderingFilters.indexOf(a), 1);
a.destroy();
}
};
Jj.renderer.renderingFilters.push(a);
}
},
Wall: class extends vi {
constructor() {
super();
this.healthBar = new yi();
this.healthBar.setSize(35, 10);
this.healthBar.setPivotPoint(17.5, -8);
this.healthBar.setVisible(false);
this.addAttachment(this.healthBar, 3);
this.currentTier = null;
this.updateModel();
}
update(a, b) {
if (b) {
this.updateModel(b.tier);
this.updateHealthBar(b);
}
super.update(a, b);
}
updateModel(a = 1) {
if (a !== this.currentTier) {
this.currentTier = a;
this.removeAttachment(this.base);
if (![1, 2, 3, 4, 5, 6, 7, 8].includes(a)) {
throw new Error("Unknown tier encountered for wall: " + a);
}
this.base = new Ai("http://zombia.io/asset/images/Entity/Wall/WallTier" + a + ".svg");
this.addAttachment(this.base, 2);
}
}
updateHealthBar(a) {
this.healthBar.setVisible(a.health !== a.maxHealth);
}
},
Door: class extends vi {
constructor() {
super();
this.healthBar = new yi();
this.healthBar.setSize(35, 10);
this.healthBar.setPivotPoint(17.5, -8);
this.healthBar.setVisible(false);
this.addAttachment(this.healthBar, 3);
this.currentTier = null;
this.updateModel();
}
update(a, b) {
if (b) {
this.updateModel(b.tier);
this.updateHealthBar(b);
this.updateVisibility(b);
}
super.update(a, b);
}
updateModel(a = 1) {
if (a !== this.currentTier) {
this.currentTier = a;
this.removeAttachment(this.base);
if (![1, 2, 3, 4, 5, 6, 7, 8].includes(a)) {
throw new Error("Unknown tier encountered for door: " + a);
}
this.base = new Ai("http://zombia.io/asset/images/Entity/Door/DoorTier" + a + ".svg");
this.addAttachment(this.base, 2);
}
}
updateVisibility(a) {
if (Jj.ui.buildings[a.uid] !== undefined) {
this.base.setAlpha(0.5);
} else {
this.base.setAlpha(1);
}
}
updateHealthBar(a) {
this.healthBar.setVisible(a.health !== a.maxHealth);
}
},
SlowTrap: class extends vi {
constructor() {
super();
this.healthBar = new yi();
this.healthBar.setSize(35, 10);
this.healthBar.setPivotPoint(17.5, -8);
this.healthBar.setVisible(false);
this.addAttachment(this.healthBar, 3);
this.currentTier = null;
this.updateModel();
}
update(a, b) {
if (b) {
this.updateModel(b.tier);
this.updateHealthBar(b);
this.updateVisibility(b);
}
super.update(a, b);
}
updateModel(a = 1) {
if (a !== this.currentTier) {
this.currentTier = a;
this.removeAttachment(this.base);
if (![1, 2, 3, 4, 5, 6, 7, 8].includes(a)) {
throw new Error("Unknown tier encountered for slow trap: " + a);
}
this.base = new Ai("http://zombia.io/asset/images/Entity/SlowTrap/SlowTrapTier" + a + ".svg");
this.addAttachment(this.base, 2);
}
}
updateVisibility(a) {
if (Jj.ui.buildings[a.uid] !== undefined) {
this.base.setAlpha(0.5);
} else {
this.base.setAlpha(1);
}
}
updateHealthBar(a) {
this.healthBar.setVisible(a.health !== a.maxHealth);
}
},
CannonTower: class extends Di {
constructor() {
super("CannonTower");
}
},
RocketTower: class extends Di {
constructor() {
super("RocketTower");
}
},
Drill: class extends vi {
constructor() {
super();
this.healthBar = new yi();
this.healthBar.setSize(82, 16);
this.healthBar.setPivotPoint(41, -25);
this.healthBar.setVisible(false);
this.addAttachment(this.healthBar, 4);
this.currentRotation = 0;
this.currentTier = null;
this.updateModel();
}
update(a, b) {
if (b) {
this.updateModel(b.tier);
this.updateHealthBar(b);
this.currentRotation += b.tier * 45 * a / 1000;
this.currentRotation %= 360;
this.drill.setRotation(this.currentRotation);
}
super.update(a, b);
}
updateModel(a = 1) {
if (a != this.currentTier) {
this.currentTier = a;
this.removeAttachment(this.head);
this.removeAttachment(this.drill);
if (![1, 2, 3, 4, 5, 6, 7, 8].includes(a)) {
throw new Error("Unknown tier encountered for drill: " + a);
}
this.drill = new Ai("http://zombia.io/asset/images/Entity/Drill/Drill.svg");
this.head = new Ai("http://zombia.io/asset/images/Entity/Drill/DrillTier" + a + "Head.svg");
this.addAttachment(this.drill, 2);
this.addAttachment(this.head, 3);
}
}
updateHealthBar(a) {
this.healthBar.setVisible(a.health !== a.maxHealth);
}
},
SawTower: class extends Di {
constructor() {
super("SawTower");
this.currentRotation = 0;
this.extensionPosition = 0;
this.updateModel();
}
update(a, b) {
if (b) {
this.updateModel(b.tier);
this.updateAnimation(a, b);
this.updateHealthBar(b);
}
super.update(a, b);
}
updateModel(a = 1) {
if (a != this.currentTier) {
this.currentTier = a;
this.removeAttachment(this.base);
this.removeAttachment(this.arm);
this.removeAttachment(this.blade);
this.removeAttachment(this.top);
this.removeAttachment(this.brace);
if (![1, 2, 3, 4, 5, 6, 7, 8].includes(a)) {
throw new Error("Unknown tier encountered for SawTower: " + a);
}
this.base = new Ai("http://zombia.io/asset/images/Entity/SawTower/SawTowerTier" + a + "Base.svg");
this.blade = new Ai("http://zombia.io/asset/images/Entity/SawTower/SawTowerBlade.svg");
this.top = new Ai("http://zombia.io/asset/images/Entity/SawTower/SawTowerTier" + a + "Top.svg");
this.top.setPositionY(-16);
this.brace = new Ai("http://zombia.io/asset/images/Entity/SawTower/SawTowerTier" + a + "Brace.svg");
this.arm = new xi();
this.arm.drawRect(-8, 0, 8, 48, {
r: 51,
g: 51,
b: 51
});
this.addAttachment(this.arm, 2);
this.addAttachment(this.base, 1);
this.addAttachment(this.blade, 3);
this.addAttachment(this.top, 4);
this.addAttachment(this.brace, 5);
this.brace.setAnchor(0.5, 1);
}
}
updateHealthBar(a) {
this.healthBar.setVisible(a.health !== a.maxHealth);
}
updateAnimation(a, b) {
if (b.firingTick !== 0) {
this.currentRotation += a * 720 / 1000;
this.currentRotation %= 360;
this.blade.setRotation(this.currentRotation);
this.extending = true;
} else {
this.extending = false;
}
if (this.extending === true) {
this.extensionPosition -= 4;
if (this.extensionPosition < -64) {
this.extensionPosition = -64;
}
} else {
this.extensionPosition += 8;
if (this.extensionPosition > 0) {
this.extensionPosition = 0;
}
}
this.blade.setPositionY(this.extensionPosition - 12 - 16);
this.arm.draw.height = this.extensionPosition;
this.brace.setPositionY(this.extensionPosition - 16);
}
},
LightningTower: class extends Di {
constructor() {
super("LightningTower");
this.targetBeams = new xi();
Jj.renderer.projectiles.addAttachment(this.targetBeams, 2);
this.lastFiringTick = 0;
this.hasFired = false;
this.branchTextures = [];
this.currentRotation = 0;
this.currentRotationSpeed = 0;
}
removedParentFunction() {
Jj.renderer.projectiles.removeAttachment(this.targetBeams);
}
createLightningTexture(a, b) {
const c = i.angleTo(a, b);
const d = Math.sqrt(i.measureDistance(a, b));
const e = (2 + Math.floor(Math.random() * 3)) * 2;
this.targetBeams.draw.lineStyle(3, 16777215);
this.targetBeams.draw.moveTo(a.x, a.y);
let f = {
x: a.x,
y: a.y
};
for (let g = 0; g <= e; g++) {
if (g == e) {
this.targetBeams.draw.lineTo(b.x, b.y);
} else if (g % 2 == 0) {
const a = (c - (40 - Math.floor(Math.random() * 10)) + 360) % 360;
const b = {
x: f.x + Math.sin(a * Math.PI / 180) * (d / e * 1.25),
y: f.y - Math.cos(a * Math.PI / 180) * (d / e * 1.25)
};
this.targetBeams.draw.lineTo(b.x, b.y);
f = b;
} else {
const a = (c + (40 - Math.floor(Math.random() * 10)) + 360) % 360;
const b = {
x: f.x + Math.sin(a * Math.PI / 180) * (d / e * 1.25),
y: f.y - Math.cos(a * Math.PI / 180) * (d / e * 1.25)
};
this.targetBeams.draw.lineTo(b.x, b.y);
f = b;
}
}
}
update(a, b) {
if (b) {
this.updateSpinningAnimation(a, b);
this.updateFiringAnimation(a, b);
}
super.update(a, b);
}
updateSpinningAnimation(a, b) {
if (Jj.renderer.replicator.getMsSinceTick(this.lastFiringTick) > 1000) {
this.currentRotationSpeed = Math.max(0, this.currentRotationSpeed - a * 15 / 1000);
} else {
this.currentRotationSpeed = Math.min(this.currentRotationSpeed + a * 36 / 1000, a * 720 / 1000);
}
if (this.currentRotationSpeed > 0) {
this.currentRotation += this.currentRotationSpeed;
this.currentRotation %= 360;
this.coil.setRotation(this.currentRotation);
}
}
clearLightning(a) {
this.hasFired = false;
this.targetBeams.draw.clear();
this.branchTextures.forEach(a => {
a.draw.destroy();
this.targetBeams.removeAttachment(a);
});
this.branchTextures = [];
}
updateFiringAnimation(a, b) {
if (b.firingTick == 0) {
return;
}
const c = Jj.renderer.replicator.getMsSinceTick(b.firingTick);
if (b.firingTick !== this.lastFiringTick) {
this.clearLightning();
const a = this.parent.targetTick.position;
this.targetBeams.setAlpha(1);
this.hasFired = true;
let c = {
x: 0,
y: 0
};
const d = i.angleTo(a, {
x: b.targetBeams[0],
y: b.targetBeams[1]
});
c.x += Math.sin(d * Math.PI / 180) * (Math.floor(Math.random() * 8) + 22);
c.y -= Math.cos(d * Math.PI / 180) * (Math.floor(Math.random() * 8) + 22);
c.x += a.x;
c.y += a.y;
for (let a = 0; a < b.targetBeams.length; a += 2) {
const d = {
x: b.targetBeams[a],
y: b.targetBeams[a + 1]
};
this.createLightningTexture(c, d);
c = d;
}
this.lastFiringTick = b.firingTick;
} else if (this.hasFired == 1) {
const a = Math.min(1, Math.max(0, c / 50));
this.targetBeams.setAlpha(1 - a);
}
if (c >= 100 && this.hasFired == 1) {
this.clearLightning();
}
}
updateModel(a = 1) {
if (a != this.currentTier) {
this.currentTier = a;
this.removeAttachment(this.base);
this.removeAttachment(this.coil);
if (![1, 2, 3, 4, 5, 6, 7, 8].includes(a)) {
throw new Error("Unknown tier encountered for " + this.type + " tower: " + a);
}
this.base = new Ai("http://zombia.io/asset/images/Entity/" + this.type + "/" + this.type + "Tier" + a + "Base.svg");
this.coil = new Ai("http://zombia.io/asset/images/Entity/" + this.type + "/" + this.type + "Tier" + a + "Coil.svg");
this.addAttachment(this.base, 2);
this.addAttachment(this.coil, 3);
this.coil.setRotation(this.currentRotation);
}
}
},
Zombie: class extends wi {
constructor() {
super();
this.healthBar = new yi({
r: 183,
g: 70,
b: 20
});
this.healthBar.setPosition(0, -5);
this.healthBar.setScale(0.6);
this.addAttachment(this.healthBar, 0);
}
update(a, b) {
const c = this.getParent();
if (b) {
if (this.base === undefined) {
this.updateModel(b, c);
}
this.healthBar.setVisible(b.health < b.maxHealth);
if (b.yaw !== undefined) {
c.targetTick.aimingYaw = b.yaw;
}
}
super.update(a, b);
}
updateModel(a, b) {
if (["Grey", "Green", "Blue"].indexOf(a.colour) < 0) {
throw new Error("Invalid zombie colour received: " + a.colour);
}
if (a.tier < 0 || a.tier > 10) {
throw new Error("Invalid zombie tier received: " + a.tier);
}
if (a.tier == 3) {
this.base = new Ai("http://zombia.io/asset/images/Entity/Zombie/Zombie" + a.colour + "/Zombie" + a.colour + "Tier" + a.tier + "Base.svg");
this.weaponLeft = new Ai("http://zombia.io/asset/images/Entity/Zombie/Zombie" + a.colour + "/Zombie" + a.colour + "Tier" + a.tier + "WeaponLeft.svg");
this.weaponRight = new Ai("http://zombia.io/asset/images/Entity/Zombie/Zombie" + a.colour + "/Zombie" + a.colour + "Tier" + a.tier + "WeaponRight.svg");
this.weaponLeft.setAnchor(0.5, 0.75);
this.weaponRight.setAnchor(0.5, 0.75);
this.weaponUpdateFunc = this.updateStabbingWeapon(500);
this.addAttachment(this.base, 2);
this.addAttachment(this.weaponLeft, 1);
this.addAttachment(this.weaponRight, 1);
} else {
this.base = new Ai("http://zombia.io/asset/images/Entity/Zombie/Zombie" + a.colour + "/Zombie" + a.colour + "Tier" + a.tier + "Base.svg");
this.weapon = new Ai("http://zombia.io/asset/images/Entity/Zombie/Zombie" + a.colour + "/Zombie" + a.colour + "Tier" + a.tier + "Weapon.svg");
switch (a.tier) {
case 2:
this.weapon.setAnchor(0.5, 0.75);
this.weaponUpdateFunc = this.updateAntiClockwiseSwingingWeapon(300, 100);
break;
case 4:
case 5:
this.weapon.setAnchor(0.5, 0.85);
this.weaponUpdateFunc = this.updateClockwiseSwingingWeapon(300, 100);
break;
case 6:
case 7:
case 8:
this.weapon.setAnchor(0.5, 0.9);
this.weaponUpdateFunc = this.updateClockwiseSwingingWeapon(300, 100);
break;
default:
this.weapon.setAnchor(0.5, 1);
this.weaponUpdateFunc = this.updateAntiClockwiseSwingingWeapon(300, 100);
}
this.addAttachment(this.base, 2);
this.addAttachment(this.weapon, 1);
}
}
},
Visualiser: class extends vi {
constructor() {
super();
this.text = new ui("X", "Hammersmith One", 15);
this.addAttachment(this.text);
}
}
};
class Fi extends vi {
constructor(a) {
super();
this.isOccupied = false;
this.redSquare = new xi();
this.redSquare.drawRect(-a.width / 2, -a.height / 2, a.width / 2, a.height / 2, {
r: 255,
g: 0,
b: 0
});
this.redSquare.setAlpha(0.2);
this.redSquare.setVisible(false);
this.addAttachment(this.redSquare);
}
setIsOccupied(a) {
this.redSquare.setVisible(this.isOccupied = a);
}
}
class Gi extends vi {
constructor(a) {
super();
this.isCircular = a.isCircular || false;
this.goldRegion = new xi();
this.goldRegion.setAlpha(0.1);
if (this.isCircular) {
this.goldRegion.drawCircle(0, 0, a.radius, a.fill || {
r: 200,
g: 160,
b: 0
}, a.lineFill || {
r: 255,
g: 200,
b: 0
}, 8);
} else {
this.goldRegion.drawRect(-a.width / 2, -a.height / 2, a.width / 2, a.height / 2, a.fill || {
r: 200,
g: 160,
b: 0
}, a.lineFill || {
r: 255,
g: 200,
b: 0
}, a.lineWidth || 8);
}
this.addAttachment(this.goldRegion);
}
}
class Hi extends d {
constructor() {
super("<span></span>");
this.placeholderTints = [];
this.borderTints = [];
this.direction = 0;
this.disableDirection = true;
this.placeholderEntity = null;
this.rangeIndicator = null;
this.placeholderText = new ui("Press R to rotate...", "Hammersmith One", 16);
this.placeholderText.setAnchor(0.5, 0.5);
this.placeholderText.setColor(220, 220, 220);
this.placeholderText.setStroke(51, 51, 51, 3);
this.placeholderText.setFontWeight("bold");
this.placeholderText.setLetterSpacing(1);
this.placeholderText.setAlpha(0);
this.placeholderText.setPosition(-1000, -1000);
}
init() {
Jj.renderer.uiLayer.addAttachment(this.placeholderText);
Jj.eventEmitter.on("82Up", this.cycleDirection.bind(this));
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
Jj.eventEmitter.on("CameraUpdate", this.update.bind(this));
Jj.eventEmitter.on("DeadRpcReceived", this.onDead.bind(this));
Jj.eventEmitter.on("27Up", this.cancelPlacing.bind(this));
Jj.eventEmitter.on("BuildingsUpdated", this.onBuildingData.bind(this));
}
onBuildingData(a) {
for (let b in a) {
const c = a[b];
if (c.type == this.buildingType && Jj.ui.buildingData[c.type].built >= Jj.ui.buildingData[c.type].limit) {
this.cancelPlacing();
}
}
}
onEnterWorld(a) {
this.minWallDistance = a.minimumBuildDistanceFromWall;
this.maxFactoryDistance = a.maxFactoryBuildDistance;
this.maxPlayerDistance = a.maxPlayerBuildDistance;
}
cycleDirection() {
if (this.disableDirection !== true && this.placeholderEntity !== null) {
this.direction = (this.direction + 1) % 4;
this.placeholderEntity.setRotation(this.direction * 90);
}
}
onDead() {
this.cancelPlacing();
}
startPlacing(a) {
if (this.buildingType) {
this.cancelPlacing();
}
Jj.ui.components.uiBuildingOverlay.stopWatching();
this.buildingType = a;
const b = Jj.ui.buildingData[a];
if (["SawTower", "Harvester"].includes(this.buildingType)) {
this.disableDirection = false;
this.placeholderText.setAlpha(0.75);
this.placeholderText.setPosition(-1000, -1000);
} else {
this.disableDirection = true;
this.direction = 0;
this.placeholderText.setAlpha(0);
this.placeholderText.setPosition(-1000, -1000);
}
const c = Jj.renderer.world.entityGrid.cellSize;
const d = b.gridWidth * b.gridHeight;
if (Ei[a]) {
this.placeholderEntity = new Ai("http://zombia.io/asset/images/Ui/Buildings/" + a + "/" + a + "Tier1.svg");
this.placeholderEntity.setAlpha(0.5);
this.placeholderEntity.setRotation(this.direction * 90);
Jj.renderer.uiLayer.addAttachment(this.placeholderEntity);
}
for (let b = 0; b < d; b++) {
this.placeholderTints[b] = new Fi({
width: c,
height: c
});
Jj.renderer.uiLayer.addAttachment(this.placeholderTints[b]);
}
if (a !== "Factory" && Jj.ui.getFactory() !== null) {
this.rangeIndicator = new Gi({
width: this.maxFactoryDistance * c * 2,
height: this.maxFactoryDistance * c * 2,
fill: {
r: 0,
b: 0,
g: 0
},
lineFill: {
r: 255,
b: 0,
g: 0
},
lineWidth: 12
});
Jj.renderer.groundLayer.addAttachment(this.rangeIndicator);
this.rangeIndicator.setPosition(Jj.ui.getFactory().x, Jj.ui.getFactory().y);
}
const e = Jj.renderer.world.worldSize.x / c;
const f = Jj.renderer.world.worldSize.y / c;
for (let b = 0; b < 4; b++) {
const a = this.minWallDistance / 2;
if (b == 0 || b == 1) {
this.borderTints[b] = new Fi({
width: c * this.minWallDistance,
height: c * f
});
} else if (b == 2 || b == 3) {
this.borderTints[b] = new Fi({
width: c * (e - this.minWallDistance * 2),
height: c * this.minWallDistance
});
}
Jj.renderer.groundLayer.addAttachment(this.borderTints[b]);
if (b == 0) {
this.borderTints[b].setPosition(c * a, c * (f / 2));
} else if (b == 1) {
this.borderTints[b].setPosition(c * (e - a), c * (f / 2));
} else if (b == 2) {
this.borderTints[b].setPosition(c * (e / 2), c * a);
} else if (b == 3) {
this.borderTints[b].setPosition(c * (e / 2), c * (f - a));
}
this.borderTints[b].setIsOccupied(true);
}
this.update();
}
update() {
if (!this.buildingType) {
return;
}
const a = Jj.ui.buildingData[this.buildingType];
const b = Jj.ui.mousePosition;
const c = Jj.renderer.world;
const d = Jj.renderer.screenToWorld(b.x, b.y);
const e = c.entityGrid.getCellIndices(d.x, d.y, {
width: a.gridWidth,
height: a.gridHeight
});
const f = c.entityGrid.cellSize;
let g = {
x: 0,
y: 0
};
for (let a in e) {
if (!e[a]) {
this.placeholderTints[a].setVisible(false);
continue;
}
const b = c.entityGrid.getCellCoords(e[a]);
let d = {
x: b.x * f + f / 2,
y: b.y * f + f / 2
};
const h = Jj.renderer.worldToUi(d.x, d.y);
const i = this.checkIsOccupied(e[a], b);
this.placeholderTints[a].setPosition(h.x, h.y);
this.placeholderTints[a].setIsOccupied(i);
this.placeholderTints[a].setVisible(true);
g.x += b.x;
g.y += b.y;
}
g.x = g.x / e.length;
g.y = g.y / e.length;
let h = {
x: g.x * f + f / 2,
y: g.y * f + f / 2
};
const i = Jj.renderer.worldToUi(h.x, h.y);
if (this.placeholderEntity !== null) {
this.placeholderEntity.setPosition(i.x, i.y);
this.placeholderText.setPosition(i.x, i.y - 110);
}
}
checkIsOccupied(a, b) {
const c = Jj.renderer.world;
const d = c.entityGrid.cellSize;
const e = c.entityGrid.getEntitiesInCell(a);
const f = b.x * d + d / 2;
const g = b.y * d + d / 2;
if (!e) {
return true;
}
for (const d in e) {
const a = c.entities[parseInt(d)];
if (!a) {
continue;
}
const b = a.getTargetTick();
if (b && b.entityClass !== "Projectile") {
return true;
}
}
const h = Math.min(b.x, c.entityGrid.columns - 1 - b.x);
const i = Math.min(b.y, c.entityGrid.rows - 1 - b.y);
if (h < this.minWallDistance || i < this.minWallDistance) {
return true;
}
if (c.getLocalPlayer()) {
const a = c.entities[c.getLocalPlayer()];
if (a) {
const b = Math.abs(a.getPositionX() - f) / d;
const c = Math.abs(a.getPositionY() - g) / d;
if (b > this.maxPlayerDistance || c > this.maxPlayerDistance) {
return true;
}
}
}
if (Jj.ui.factory && this.buildingType !== "Harvester") {
const a = Math.abs(Jj.ui.factory.x - f) / d;
const b = Math.abs(Jj.ui.factory.y - g) / d;
if (a > this.maxFactoryDistance || b > this.maxFactoryDistance) {
return true;
}
}
return false;
}
cancelPlacing() {
if (this.buildingType) {
Jj.renderer.uiLayer.removeAttachment(this.placeholderEntity);
for (let a in this.placeholderTints) {
Jj.renderer.uiLayer.removeAttachment(this.placeholderTints[a]);
}
for (let a in this.borderTints) {
Jj.renderer.groundLayer.removeAttachment(this.borderTints[a]);
}
if (this.rangeIndicator) {
Jj.renderer.groundLayer.removeAttachment(this.rangeIndicator);
delete this.rangeIndicator;
}
this.placeholderText.setAlpha(0);
this.placeholderText.setPosition(-1000, -1000);
this.placeholderEntity = null;
this.placeholderTints = [];
this.borderTints = [];
this.buildingType = null;
}
}
placeBuilding() {
if (!this.buildingType) {
return;
}
const a = Jj.renderer.world.getLocalPlayer();
if (!a) {
return false;
}
if (!Jj.renderer.world.entities[a]) {
return false;
}
const b = Jj.ui.buildingData[this.buildingType];
const c = Jj.ui.mousePosition;
const d = Jj.renderer.world;
const e = Jj.renderer.screenToWorld(c.x, c.y);
const f = d.entityGrid.getCellIndices(e.x, e.y, {
width: b.gridWidth,
height: b.gridHeight
});
const g = d.entityGrid.cellSize;
let h = {
x: 0,
y: 0
};
for (let a in f) {
if (!f[a]) {
return false;
}
const b = d.entityGrid.getCellCoords(f[a]);
h.x += b.x;
h.y += b.y;
}
h.x /= f.length;
h.y /= f.length;
let i = {
x: h.x * g + g / 2,
y: h.y * g + g / 2
};
Jj.network.sendRpc({
name: "PlaceBuilding",
x: i.x,
y: i.y,
type: this.buildingType,
yaw: this.direction * 90
});
return true;
}
isActive() {
return !!this.buildingType;
}
}
class Ii extends d {
constructor() {
let a = document.createElement("div");
a.className = "hud-building-overlay hud-tooltip hud-tooltip-top";
document.getElementById("hud").appendChild(a);
super(a);
this.element.innerHTML = "\n <div class=\"hud-tooltip-building\">\n <h2 class=\"hud-building-name\"></h2>\n <h3>Tier <span id=\"hud-building-tier\" class=\"hud-building-tier\"></span></h3>\n <div class=\"hud-tooltip-body\">\n <div id=\"hud-building-stats\" class=\"hud-building-stats\"></div>\n <p class=\"hud-building-actions\">\n <a class=\"btn btn-green hud-building-upgrade\"></a>\n <a class=\"btn btn-red hud-building-sell\">Sell</a>\n </p>\n </div>\n </div>\n ";
this.nameElem = this.element.querySelector(".hud-building-name");
this.tierElem = this.element.querySelector(".hud-building-tier");
this.statsElem = this.element.querySelector(".hud-building-stats");
this.upgradeElem = this.element.querySelector(".hud-building-upgrade");
this.sellElem = this.element.querySelector(".hud-building-sell");
this.upgradeElem.addEventListener("mouseup", this.upgradeBuilding.bind(this));
this.sellElem.addEventListener("mouseup", this.sellBuilding.bind(this));
this.element.addEventListener("mousedown", this.onMouseDown.bind(this));
this.element.addEventListener("mouseup", this.onMouseUp.bind(this));
}
init() {
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
Jj.eventEmitter.on("PlayerTickUpdated", this.updateText.bind(this));
Jj.eventEmitter.on("CameraUpdate", this.update.bind(this));
Jj.eventEmitter.on("BuildingsUpdated", this.updateText.bind(this));
Jj.eventEmitter.on("16Down", this.updateText.bind(this));
Jj.eventEmitter.on("16Up", this.updateText.bind(this));
Jj.eventEmitter.on("69Up", this.upgradeBuilding.bind(this));
Jj.eventEmitter.on("84Up", this.sellBuilding.bind(this));
Jj.eventEmitter.on("27Up", this.stopWatching.bind(this));
}
onEnterWorld(a) {
this.maxFactoryDistance = a.maxFactoryBuildDistance;
}
onMouseDown(a) {
a.stopPropagation();
}
onMouseUp(a) {
a.stopPropagation();
}
upgradeBuilding() {
if (!this.buildingUid) {
return;
}
let a = new Set();
a.add(this.buildingUid);
if (Jj.network.inputPacketManager.shiftDown) {
for (const b in Jj.ui.buildings) {
const c = Jj.ui.buildings[b];
if (c.type == this.buildingId && c.tier == this.buildingTier) {
a.add(c.uid);
}
}
}
Jj.network.sendRpc({
name: "UpgradeBuilding",
uids: Array.from(a)
});
}
sellBuilding() {
if (!this.buildingUid || !Jj.ui.playerPartyCanSell) {
return;
}
let a = new Set();
a.add(this.buildingUid);
if (Jj.network.inputPacketManager.shiftDown) {
for (const b in Jj.ui.buildings) {
const c = Jj.ui.buildings[b];
if (c.type == this.buildingId && c.tier == this.buildingTier) {
a.add(c.uid);
}
}
}
if (a.size > 1) {
Jj.ui.components.uiPopupOverlay.showConfirmation("Are you sure you want to sell all <b>" + this.buildingId + "</b>s?", 5000, () => {
Jj.network.sendRpc({
name: "SellBuilding",
uids: Array.from(a)
});
});
} else {
Jj.network.sendRpc({
name: "SellBuilding",
uids: Array.from(a)
});
}
}
update() {
if (!this.buildingUid) {
return;
}
const a = Jj.renderer.world.entities[this.buildingUid];
if (!a) {
return this.stopWatching();
}
const b = Jj.renderer.worldToScreen(a.getPositionX(), a.getPositionY());
const c = Jj.ui.buildingData[this.buildingId];
if (!Jj.ui.buildings[this.buildingUid]) {
return this.stopWatching();
}
const d = c.gridHeight / 2 * 48 * (Jj.renderer.scale / window.devicePixelRatio);
this.element.style.left = b.x - this.element.offsetWidth / 2 + "px";
this.element.style.top = b.y - d - this.element.offsetHeight - 20 + "px";
if (this.rangeIndicator) {
this.rangeIndicator.setPosition(a.getPositionX(), a.getPositionY());
}
}
updateText() {
if (!this.isActive()) {
return;
}
if (!Jj.ui.buildings[this.buildingUid]) {
return this.stopWatching();
}
const a = Jj.ui.buildingData[this.buildingId];
this.buildingId = Jj.ui.buildings[this.buildingUid].type;
this.buildingTier = Jj.ui.buildings[this.buildingUid].tier;
const b = this.buildingTier >= a.tiers || this.buildingId !== "Factory" && this.buildingTier >= Jj.ui.getFactory().tier;
this.nameElem.innerHTML = this.buildingId;
this.tierElem.innerHTML = this.buildingTier;
let c = 1;
if (Jj.network.inputPacketManager.shiftDown) {
for (const a in Jj.ui.buildings) {
const b = Jj.ui.buildings[a];
if (b.type == this.buildingId && b.tier == this.buildingTier && b.uid !== this.buildingUid) {
c++;
}
}
}
if (b) {
this.upgradeElem.classList.add("is-disabled");
}
const d = i.createResourceRefundString(a, this.buildingTier, c);
if (["Factory"].includes(this.buildingId)) {
this.sellElem.classList.add("is-disabled");
this.sellElem.innerHTML = "<span>Can't sell</span>";
} else if (Jj.ui.playerPartyCanSell) {
this.sellElem.classList.remove("is-disabled");
this.sellElem.innerHTML = "<span>Sell" + (Jj.network.inputPacketManager.shiftDown ? " All" : "") + " (" + d + ")</span>";
} else {
this.sellElem.classList.add("is-disabled");
this.sellElem.innerHTML = "<span>Need permission to sell</span>";
}
const e = i.createResourceCostString(a, b ? this.buildingTier : this.buildingTier + 1, c, true);
const f = Jj.ui.getFactory();
if (b) {
if (["Factory"].includes(this.buildingId) || f.tier == this.buildingTier && f.tier >= Jj.ui.buildingData.Factory.tiers) {
this.upgradeElem.innerHTML = "<span>Maximum tier!</span>";
} else {
this.upgradeElem.innerHTML = "<span>Upgrade your Factory</span>";
}
} else {
this.upgradeElem.innerHTML = "<span>Upgrade " + (Jj.network.inputPacketManager.shiftDown ? "All " : "") + " (" + e.elem + ")</span>";
}
const g = {
Range: "towerRadius",
"Max Health": "health",
"Gold/Second": "goldPerSecond",
"Firing Rate": "msBetweenFires",
"Projectile Speed": "projectileSpeed",
"Damage to Zombies": "damageToZombies",
"Target Limit": "attackTargetLimit"
};
let h = "";
let j = "";
for (let b in g) {
if (a[g[b]]) {
h += "<p>" + b + ": <strong class=\"hud-stats-current\">" + a[g[b]][this.buildingTier - 1] + "</strong></p>";
j += "<p>" + b + ": <strong class=\"hud-stats-next\">" + a[g[b]][this.buildingTier - (this.buildingTier >= a.tiers ? 1 : 0)] + "</strong></p>";
}
}
this.statsElem.innerHTML = "<div class=\"hud-stats-current hud-stats-values\">" + h + "</div>\n <div class=\"hud-stats-next hud-stats-values\">" + j + "</div>";
}
stopWatching() {
if (this.buildingUid) {
if (this.rangeIndicator) {
Jj.renderer.groundLayer.removeAttachment(this.rangeIndicator);
delete this.rangeIndicator;
}
this.element.style.left = "-1000px";
this.element.style.top = "-1000px";
this.upgradeElem.classList.remove("is-disabled");
this.buildingUid = null;
this.buildingId = null;
this.buildingTier = null;
this.hide();
}
}
startWatching(a) {
if (this.buildingUid) {
this.stopWatching();
}
Jj.ui.components.uiPlacementOverlay.cancelPlacing();
this.buildingUid = a;
if (!Jj.ui.buildings[a]) {
return;
}
this.buildingId = Jj.ui.buildings[a].type;
this.buildingTier = Jj.ui.buildings[a].tier;
const b = Jj.ui.buildingData[this.buildingId];
if (this.buildingId == "Factory") {
const a = Jj.renderer.world.entityGrid.cellSize;
this.rangeIndicator = new Gi({
width: this.maxFactoryDistance * a * 2,
height: this.maxFactoryDistance * a * 2,
fill: {
r: 0,
b: 0,
g: 0
},
lineFill: {
r: 255,
b: 0,
g: 0
},
lineWidth: 12
});
Jj.renderer.groundLayer.addAttachment(this.rangeIndicator);
} else if (b.towerRadius) {
this.rangeIndicator = new Gi({
isCircular: true,
radius: b.towerRadius[this.buildingTier - 1]
});
Jj.renderer.groundLayer.addAttachment(this.rangeIndicator);
}
this.updateText();
this.show();
this.update();
}
isActive() {
return !!this.buildingUid;
}
}
class Ji extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-map";
document.getElementById("hud-bottom").appendChild(a);
super(a);
this.element.addEventListener("mousedown", this.onMouseDown.bind(this));
this.element.addEventListener("mouseup", this.onMouseUp.bind(this));
this.playerElems = {};
this.buildingElems = {};
}
init() {
Jj.eventEmitter.on("RendererUpdated", this.update.bind(this));
Jj.eventEmitter.on("PartyMembersUpdated", this.onPartyMembersUpdate.bind(this));
Jj.eventEmitter.on("BuildingsUpdated", this.onBuildingsUpdate.bind(this));
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
}
onEnterWorld() {
for (let a in this.buildingElems) {
this.buildingElems[a].remove();
delete this.buildingElems[a];
}
}
onMouseDown(a) {
a.stopPropagation();
a.preventDefault();
}
onMouseUp(a) {
a.stopPropagation();
a.preventDefault();
}
update() {
for (const a in this.playerElems) {
const b = this.playerElems[a];
const c = Jj.renderer.world.entities[a];
if (!c) {
//b.marker.style.display = "none";
continue;
}
const d = c.getPositionX() / Jj.renderer.world.worldSize.x * 100;
const e = c.getPositionY() / Jj.renderer.world.worldSize.y * 100;
b.marker.setAttribute("data-index", b.index.toString());
b.marker.style.display = "block";
b.marker.style.left = d + "%";
b.marker.style.top = e + "%";
}
}
onPartyMembersUpdate(a) {
const b = {};
for (const c in this.playerElems) {
b[c] = true;
}
for (const c in a) {
const d = parseInt(c);
const e = Object.values(a)[c].uid;
delete b[e];
if (this.playerElems[e]) {
this.playerElems[e].index = d;
} else {
const a = document.createElement("div");
a.className = "hud-map-player";
a.setAttribute("data-index", d);
this.element.appendChild(a);
this.playerElems[e] = {
index: d,
marker: a
};
}
}
for (const c in b) {
if (this.playerElems[c]) {
this.playerElems[c].marker.remove();
delete this.playerElems[c];
}
}
}
onBuildingsUpdate(a) {
const b = {};
for (const c in a) {
if (a[c].dead !== true) {
if (this.buildingElems[a[c].uid] === undefined) {
const b = document.createElement("div");
b.className = "hud-map-building";
const d = a[c].x / Jj.renderer.world.worldSize.x * 100;
const e = a[c].y / Jj.renderer.world.worldSize.y * 100;
b.style.left = d + "%";
b.style.top = e + "%";
this.element.appendChild(b);
this.buildingElems[a[c].uid] = b;
}
} else {
b[a[c].uid] = true;
}
}
for (const c in b) {
if (this.buildingElems[c]) {
this.buildingElems[c].remove();
delete this.buildingElems[c];
}
}
}
}
const Ki = c(6);
const Li = c(573);
Ki.loadPlugin(Li);
Ki.setDefaults({
randomize: false
});
class Mi extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-chat";
a.innerHTML = "\n <div class=\"hud-chat-messages\" id=\"hud-chat-messages\"></div>\n <input type=\"text\" class=\"hud-chat-input\" id=\"hud-chat-input\" placeholder=\"Send a message to the [All] channel.\" maxlength=\"140\">\n <div class=\"hud-chat-toggle-channel\" id=\"hud-chat-toggle-channel\"></div>";
document.getElementById("hud-top").appendChild(a);
super(a);
this.element.addEventListener("mouseup", this.onMouseUp.bind(this));
this.element.addEventListener("mousedown", this.onMouseDown.bind(this));
this.messagesElem = document.getElementById("hud-chat-messages");
this.inputElem = document.getElementById("hud-chat-input");
this.toggleChannelButton = document.getElementById("hud-chat-toggle-channel");
this.inputElem.addEventListener("keydown", a => {
if (!["Enter", "Escape"].includes(a.code)) {
a.stopPropagation();
}
});
this.inputElem.addEventListener("keyup", a => {
if (!["Enter", "Escape"].includes(a.code)) {
a.stopPropagation();
}
});
this.toggleChannelButton.addEventListener("mousedown", a => {
a.stopPropagation();
});
this.toggleChannelButton.addEventListener("mouseup", a => {
this.toggleChannel();
a.stopPropagation();
this.inputElem.focus();
});
this.typing = false;
this.channels = ["All", "Party"];
this.channelIndex = 0;
}
init() {
Jj.eventEmitter.on("ReceiveChatMessageRpcReceived", this.onMessageReceived.bind(this));
Jj.eventEmitter.on("13Up", this.toggleTyping.bind(this));
Jj.eventEmitter.on("27Up", () => {
if (this.typing == 1) {
this.hideChat();
}
});
Jj.eventEmitter.on("mouseDown", () => {
if (this.typing == 1) {
this.hideChat();
}
});
}
showChat() {
this.toggleChannelButton.style.display = "block";
this.element.classList.add("is-focused");
this.inputElem.focus();
this.typing = true;
}
hideChat() {
this.toggleChannelButton.style.display = "none";
this.element.classList.remove("is-focused");
this.inputElem.blur();
this.typing = false;
}
onMouseUp(a) {
if (this.typing) {
a.stopPropagation();
}
}
onMouseDown(a) {
if (this.typing) {
a.stopPropagation();
}
}
onMessageReceived(a) {
const b = document.createElement("div");
b.className = "hud-chat-message";
b.innerHTML = "<strong style=\"" + (a.channel === "All" ? "color:#FF0000;" : "color:#00FF00;") + "\">[" + a.channel + "] </strong><strong><span id=\"name\"></span>: </strong><span id=\"message\"></span>";
const c = document.createTextNode(Jj.network.languageFilterEnabled ? Ki(a.name) : a.name);
b.querySelector("#name").appendChild(c);
const d = document.createTextNode(Jj.network.languageFilterEnabled ? Ki(a.message) : a.message);
b.querySelector("#message").appendChild(d);
this.messagesElem.appendChild(b);
b.addEventListener("mousedown", a => {
a.stopPropagation();
});
b.addEventListener("mouseup", a => {
a.stopPropagation();
});
this.messagesElem.scrollTop = this.messagesElem.scrollHeight;
if (window.storage.getItem("settings-delete-chat") == "true" && document.getElementsByClassName("hud-chat-message").length > 100) {
document.getElementsByClassName("hud-chat-message")[0].remove();
}
}
toggleTyping() {
if (this.typing) {
if (this.inputElem.value.trim().length > 0) {
let message = this.inputElem.value.trim();
let sendOrginalMsg = () => {
Jj.network.sendRpc({
name: "SendChatMessage",
message: message,
channel: this.channels[this.channelIndex]
});
}
let spearTiers = {
1: 100,
2: 500,
3: 3500,
4: 8600,
5: 30000,
6: 80000,
7: 280000,
}
let chatMsgReceived = (msg) => {
!msg.startsWith("!!") && (msg = msg.split("!")[1]);
let input = msg.split(" ")[0].toLowerCase();
switch (input) {
case "send":
for (let i = 0; i < parseInt(msg.split(" ")[1]); i++)(window.b = new Bot(scannerNames[i % scannerNames.length], game.network.options.serverData.id))
break;
case "reset":
for (let i in sockets) sockets[i].ws.close()
break;
case "r":
for (let i in sockets) {
sockets[i].shouldRespawn = true;
sockets[i].respawn();
}
break;
case "sockets":
sendMsg(`You currently have ${Object.keys(sockets).length}`)
break;
case "arb":
saveBuildings();
autoRebuilder = true;
sendMsg(`AutoRebuilder enabled`)
break;
case "record":
let baseName = msg.split(" ")[1];
recordBase().then(buildCode => {
const parsedObj = JSON.parse(localStorage.recordedBase);
parsedObj[baseName] = buildCode;
localStorage.recordedBase = JSON.stringify(parsedObj);
sendMsg(`Base recorded with name "${baseName}"`)
})
break;
case "list":
let recordedBases = JSON.parse(localStorage.recordedBase);
let baseNames = Object.keys(recordedBases);
if (baseNames.length == 0) {
sendMsg("No bases recorded");
return;
}
sendMsg(`Bases recorded: ${baseNames.join(",")}`);
break;
case "xkey":
xkey = true;
sendMsg(`Enabled xkey`);
break;
case "delete":
const baseToDelete = msg.split(" ")[1];
let recordedBase = JSON.parse(localStorage.recordedBase);
if (recordedBase[baseToDelete]) {
delete recordedBase[baseToDelete];
localStorage.recordedBase = JSON.stringify(recordedBase);
sendMsg(`Deleted base with name ${baseToDelete}`);
return;
};
sendMsg(`base with name ${baseToDelete} is not recorded/does not exist`);
break;
case "build":
const baseToBuild = msg.split(" ")[1];
let Bases = JSON.parse(localStorage.recordedBase);
if(!Bases[baseToBuild]) {
sendMsg(`base with name ${baseToDelete} is not recorded/does not exist`);
return;
};
buildBase(Bases[baseToBuild]);
break;
case "!!arb":
autoRebuilder = false;
buildings.clear();
missingBuildings.clear();
buildingsToUpgrade.clear();
sendMsg(`AutoRebuilder disabled`)
break;
case "!!xkey":
xkey = false;
sendMsg("Disabled xkey");
break;
case "!!as":
spearFarm.enabled = false;
spearFarm.tier = null;
spearFarm.price = null;
sendMsg(`Auto farm spear disabled`)
break
case "!!r":
for (let i in sockets) sockets[i].shouldRespawn = false;
break;
}
if (input.startsWith("as")) {
let tier = parseInt(input.split("as")[1]);
spearTiers[tier] && (spearFarm = { tier: tier, price: spearTiers[tier], enabled: true });
sendMsg(`Auto farm spear tier ${tier} enabled`)
};
};
message.startsWith("!") ? chatMsgReceived(message) : sendOrginalMsg();
}
this.inputElem.value = "";
this.hideChat();
} else {
this.showChat();
}
}
toggleChannel(a) {
if (this.typing) {
this.channelIndex++;
if (this.channelIndex + 1 > this.channels.length) {
this.channelIndex = 0;
}
this.inputElem.placeholder = "Send a message to the [" + this.channels[this.channelIndex] + "] channel.";
}
}
}
class Ni extends d {
constructor(a) {
const b = document.createElement("div");
b.className = "hud-tool";
super(b);
this.type = a;
this.element.addEventListener("click", this.onClick.bind(this));
this.element.addEventListener("mousedown", this.onMouseDown);
this.update();
}
init() {
Jj.eventEmitter.on("SetToolRpcReceived", a => {
for (let b of a) {
if (b.toolName == this.type) {
this.update(b.toolTier);
}
}
});
}
onClick() {
Jj.network.sendRpc({
name: "EquipTool",
toolName: this.type
});
}
onMouseDown(a) {
a.stopPropagation();
a.preventDefault();
}
update(a = 0) {
this.element.classList[a > 0 ? "remove" : "add"]("is-empty");
this.element.style["background-image"] = a > 0 ? "url('http://zombia.io/asset/images/Ui/Icons/Tools/" + this.type + "Tier" + a + ".svg')" : "";
}
}
class Oi extends d {
constructor(a) {
let b = document.createElement("div");
b.className = "hud-grid";
b.setAttribute("grid-type", a);
super(b);
this.type = a;
this.element.addEventListener("mousedown", this.onMouseDown);
this.element.addEventListener("mouseup", this.onMouseUp);
}
onMouseDown(a) {
a.stopPropagation();
}
onMouseUp(a) {
a.stopPropagation();
}
}
class Pi extends d {
constructor(a) {
const b = document.createElement("div");
b.className = "hud-shop-item";
b.setAttribute("item-type", a.class);
super(b);
this.disabled = false;
this.toolData = a;
if (a.name == "ZombieShield") {
this.element.innerHTML = "\n <img class=\"hud-shop-info-preview\" src=\"http://zombia.io/asset/images/Ui/Icons/Armour/ZombieShield.svg\">\n <strong style=\"font-size:20px;margin-left: 5px;\">" + a.name.split(/(?=[A-Z])/).join(" ") + "</strong> <small class=\"hud-shop-item-tier\" style=\"color: rgba(255, 255, 255, 0.4); font-size: 12px;\">Tier 1</small>\n <div class=\"hud-shop-item-cost\"></div>\n ";
} else {
this.element.innerHTML = "\n <img class=\"hud-shop-info-preview\" src=\"http://zombia.io/asset/images/Ui/Icons/" + a.class + "/" + a.name + (a.tiers > 0 ? "Tier1" : "") + ".svg\">\n <strong style=\"font-size:20px;margin-left: 5px;\">" + a.name.split(/(?=[A-Z])/).join(" ") + "</strong> <small class=\"hud-shop-item-tier\" style=\"color: rgba(255, 255, 255, 0.4); font-size: 12px;\">Tier 1</small>\n <div class=\"hud-shop-item-cost\"></div>\n ";
}
this.tierElem = this.element.querySelector(".hud-shop-item-tier");
this.previewElem = this.element.querySelector(".hud-shop-info-preview");
this.costElem = this.element.querySelector(".hud-shop-item-cost");
this.tier = 0;
this.element.addEventListener("click", this.onClick.bind(this));
this.element.addEventListener("mousedown", this.onMouseDown);
this.element.addEventListener("mouseenter", () => {
Jj.ui.components.uiMenuGridShop.shopInfo.setTargetItem(this.toolData, this.tier);
});
this.element.addEventListener("mouseleave", () => {
Jj.ui.components.uiMenuGridShop.shopInfo.setTargetItem(null);
});
this.update();
}
init() {
Jj.eventEmitter.on("SetToolRpcReceived", a => {
for (let b of a) {
if (b.toolName == this.toolData.name) {
this.update(b.toolTier);
}
}
});
}
onClick() {
if (!this.disabled) {
Jj.network.sendRpc({
name: "BuyTool",
toolName: this.toolData.name
});
}
}
onMouseDown(a) {
a.stopPropagation();
a.preventDefault();
}
update(a = 0) {
this.tier = a;
const b = a >= (this.toolData.tiers || 1);
const c = b ? a : a + 1;
this.element.classList[b ? "add" : "remove"]("is-disabled");
this.disabled = b;
if (this.toolData.name == "ZombieShield") {
this.previewElem.src = "http://zombia.io/asset/images/Ui/Icons/Armour/ZombieShield.svg";
} else {
this.previewElem.src = "http://zombia.io/asset/images/Ui/Icons/" + this.toolData.class + "/" + this.toolData.name + (this.toolData.tiers > 0 ? "Tier" + (a == 0 ? 1 : c) : "") + ".svg";
}
if (this.toolData.tiers !== undefined) {
this.tierElem.textContent = a == 0 ? "Not Purchased" : "Tier " + c;
} else {
this.tierElem.textContent = "";
}
this.costElem.innerHTML = "<small>" + i.createResourceCostString(this.toolData, c, 1, false).elem.split(", ").join("<br>") + "</small>";
}
}
class Qi extends d {
constructor(a) {
const b = document.createElement("div");
b.className = "hud-ui-potion";
b.setAttribute("potion-type", a.name);
document.getElementById("hud-bottom").appendChild(b);
super(b);
this.potionName = a.name;
this.element.addEventListener("mouseup", this.onMouseUp.bind(this));
this.element.addEventListener("mousedown", a => {
a.stopPropagation();
});
this.element.addEventListener("mouseenter", () => {
Jj.ui.components.uiBuildingBar.buildingTooltip.moveTo(this.element);
});
this.element.addEventListener("mouseleave", () => {
Jj.ui.components.uiBuildingBar.buildingTooltip.hide();
});
}
onMouseUp(a) {
a.stopPropagation();
if (this.potionName === "HealthPotion") {
Jj.network.sendRpc({
name: "BuyTool",
toolName: "HealthPotion"
});
}
}
}
class Ri extends d {
constructor() {
super(document.getElementById("hud-shop-info"));
this.targetItem = null;
this.statsElem = null;
Jj.eventEmitter.on("SetToolRpcReceived", a => {
if (this.targetItem !== null) {
for (let b of a) {
if (b.toolName == this.targetItem.name) {
this.updateItemStats(b.toolTier);
}
}
}
});
}
setTargetItem(a, b) {
this.targetItem = a;
if (a !== null) {
this.element.innerHTML = "\n <strong id=\"hud-shop-info-name\">" + a.name.split(/(?=[A-Z])/).join(" ") + " <small class=\"hud-shop-info-tier\" style=\"color: rgba(255, 255, 255, 0.4); font-size: 12px;\">Tier 1</small></strong>\n <img class=\"hud-shop-info-preview shop-info\" src=\"http://zombia.io/asset/images/Ui/Icons/" + a.class + "/" + a.name + (a.tiers > 0 ? "Tier1" : "") + ".svg\">\n <div class=\"hud-shop-item-description\">" + (a.description || "") + "</div>\n <div class=\"hud-shop-item-stats\"></div>\n ";
this.statsElem = this.element.querySelector(".hud-shop-item-stats");
this.updateItemStats(b);
} else {
this.element.innerHTML = "";
}
}
updateItemStats(a) {
const b = a >= (this.targetItem.tiers || 1);
this.element.classList[b ? "add" : "remove"]("is-disabled");
this.disabled = b;
const c = {
Range: "towerRadius",
"Damage to zombies": "damageToZombies",
"Damage to buildings": "damageToBuildings",
"Damage to players": "damageToPlayers",
"Harvest Amount": "harvestAmount",
"Firing Rate": "msBetweenFires",
"Health Regen/sec": "healthRegenPerSecond",
"Max Health": "health"
};
let d = "";
const e = b ? a : a + 1;
let f = "";
for (const b in c) {
if (this.targetItem[c[b]]) {
d += "<p>" + b + ": <strong class=\"hud-stats-current\">" + (this.targetItem[c[b]][a - 1] || "—") + "</strong></p>";
f += "<p>" + b + ": <strong class=\"hud-stats-next\">" + this.targetItem[c[b]][e - 1] + "</strong></p>";
}
}
this.statsElem.innerHTML = d !== "" && f !== "" ? "<div class=\"hud-stats-current hud-stats-values\">" + d + "</div>\n <div class=\"hud-stats-next hud-stats-values\">" + f + "</div>" : "";
if (this.targetItem.name == "ZombieShield") {
document.getElementsByClassName("hud-shop-info-preview shop-info")[0].src = "http://zombia.io/asset/images/Ui/Icons/Armour/ZombieShield.svg";
document.getElementsByClassName("hud-shop-info-tier")[0].innerHTML = a == 0 ? "Not Purchased" : "Tier " + e;
} else if (a == 0) {
document.getElementsByClassName("hud-shop-info-tier")[0].innerHTML = "Tier 1";
document.getElementsByClassName("hud-shop-info-preview shop-info")[0].src = "http://zombia.io/asset/images/Ui/Icons/" + this.targetItem.class + "/" + this.targetItem.name + "Tier1.svg";
} else {
document.getElementsByClassName("hud-shop-info-tier")[0].innerHTML = "Tier " + e;
document.getElementsByClassName("hud-shop-info-preview shop-info")[0].src = "http://zombia.io/asset/images/Ui/Icons/" + this.targetItem.class + "/" + this.targetItem.name + (this.targetItem.tiers > 0 ? "Tier" + e : "") + ".svg";
}
}
}
class Si extends Oi {
constructor() {
super("Shop");
Jj.ui.components.uiMenuGridShop = this;
this.element.innerHTML = "\n <div class=\"hud-grid-exit\"></div>\n <h3>Shop</h3>\n <div class=\"hud-shop-tabs\">\n <a class=\"hud-shop-tabs-link\">Tools</a>\n <a class=\"hud-shop-tabs-link\">Armour</a>\n <a class=\"hud-shop-tabs-link\">Hats</a>\n <a class=\"hud-shop-tabs-link\">Utility</a>\n </div>\n <div class=\"hud-shop-items\">\n <div id=\"hud-shop-grid\" class=\"hud-shop-grid\"></div>\n <div id=\"hud-shop-info\" class=\"hud-shop-info\"></div>\n </div>\n ";
this.init();
}
init() {
const a = this.element.querySelectorAll(".hud-shop-tabs-link");
for (let b of a) {
b.addEventListener("mouseup", this.setTab.bind(this, b));
}
Jj.eventEmitter.on("ToolDataReceived", () => {
document.getElementById("hud-shop-grid").innerHTML = "<h1 id='hud-shop-coming-soon' style='display:none;'>Coming soon</h1>";
for (const a of document.querySelectorAll(".hud-ui-potion")) {
a.remove();
}
const b = Jj.ui.toolData;
for (let a in b) {
const c = b[a];
if (!c.canPurchase) {
continue;
}
let d;
if (c.class == "Potion") {
d = new Qi(c);
} else {
d = new Pi(c);
document.getElementById("hud-shop-grid").appendChild(d.element);
}
d.init?.();
}
this.setTab(a[0]);
});
setTimeout(() => {
this.shopInfo = new Ri();
}, 0);
}
setTab(a) {
const b = this.element.querySelectorAll(".hud-shop-tabs-link");
a.classList.add("is-active");
for (let c of b) {
if (c.textContent !== a.textContent) {
c.classList.remove("is-active");
}
}
const c = this.element.querySelectorAll(".hud-shop-item");
let d = false;
for (let b of c) {
if (b.getAttribute("item-type") == a.textContent) {
b.style.display = "block";
d = true;
} else {
b.style.display = "none";
}
}
document.getElementById("hud-shop-coming-soon").style.display = d ? "none" : "block";
}
}
class Ti extends Oi {
constructor() {
super("Settings");
Jj.ui.components.uiMenuGridSettings = this;
this.element.innerHTML = "\n <div class=\"hud-grid-exit\"></div>\n <div class=\"hud-grid-settings-controls\">\n <h1 style=\"margin: 0;\">Controls</h1>\n <span style=\"font-size: 24px;\">Buildings</span><br>\n <span>Move your mouse to the bottom of the screen to reveal the buildings</span><br><br>\n <span style=\"font-size: 24px;\">Hotkeys</span><br>\n <span>\n Scroll your mouse wheel to zoom in/out<br>\n [Enter] - Toggle the chat<br>\n [T] - Sell selected building - Hold [Shift] to sell all of the same type and tier<br>\n [E] - Upgrade selected building - Hold [Shift] to upgrade all of the same type and tier<br>\n [F6] - Toggle debugging statistics<br>\n [B] - Toggle the shop menu<br>\n [P] - Toggle the party menu<br>\n [0-9] - Selects a building from the building bar<br>\n [G] - Lock/Unlock inputs\n </span>\n </div>\n <div class=\"hud-grid-settings-divider\"></div>\n <div class=\"hud-grid-settings-options\" style=\"display:flex;flex-direction: column; padding-left: 5px;\">\n <h1 style=\"margin: 0;\">Settings</h1>\n <input type=\"checkbox\" class=\"hud-settings-day-night-opacity dark\" id=\"hud-settings-day-night-opacity\">\n <label style=\"word-wrap:break-word\" for=\"hud-settings-day-night-opacity\">Disable night's screen darkening</label>\n <input type=\"checkbox\" class=\"hud-settings-language-filter dark\" id=\"hud-settings-language-filter\">\n <label style=\"word-wrap:break-word\" for=\"hud-settings-language-filter\">Enable language filter</label>\n <input type=\"checkbox\" class=\"hud-settings-building-bar dark\" id=\"hud-settings-building-bar\">\n <label style=\"word-wrap:break-word\" for=\"hud-settings-building-bar\">Keep building bar visible</label>\n <input type=\"checkbox\" class=\"hud-settings-special-effects dark\" id=\"hud-settings-special-effects\">\n <label style=\"word-wrap:break-word\" for=\"hud-settings-special-effects\">Disable special effects</label>\n <input type=\"checkbox\" class=\"hud-settings-delete-chat dark\" id=\"hud-settings-delete-chat\">\n <label style=\"word-wrap:break-word\" for=\"hud-settings-delete-chat\">Delete old chat messages</label>\n </div>\n <div class=\"hud-grid-settings-socials\">\n <p><a target=\"_blank\" href=\"https://discord.gg/4cxREnV4WE\">Discord Server</a></p>\n <p>Programmed by <a target=\"_blank\" href=\"https://www.youtube.com/channel/UCrVyJ-ivzuBDETc7y0MZf9A\"><b>Apex</b></a></p>\n <p>Designed by <a target=\"_blank\" href=\"https://www.youtube.com/c/XperienceYT\"><b>Xperience</b></a></p>\n </div>\n ";
this.element.querySelector(".hud-settings-language-filter").addEventListener("change", () => {
window.storage.setItem("settings-language-filter", this.element.querySelector(".hud-settings-language-filter").checked);
Jj.network.languageFilterEnabled = this.element.querySelector(".hud-settings-language-filter").checked;
});
this.element.querySelector(".hud-settings-building-bar").addEventListener("change", () => {
let a = this.element.querySelector(".hud-settings-building-bar").checked;
window.storage.setItem("settings-building-bar", a);
Jj.ui.components.uiBuildingBar.element.classList[a ? "add" : "remove"]("remain-visible");
if (a == 0 && window.storage.getItem("walkthrough_BuildingBar") == "false") {
Jj.ui.components.uiWalkthrough.showBuildingBarIndicator();
} else if (a == 1) {
Jj.ui.components.uiWalkthrough.hideBuildingBarIndicator();
}
});
this.element.querySelector(".hud-settings-special-effects").addEventListener("change", () => {
window.storage.setItem("settings-special-effects", this.element.querySelector(".hud-settings-special-effects").checked);
});
this.element.querySelector(".hud-settings-delete-chat").addEventListener("change", () => {
const a = this.element.querySelector(".hud-settings-delete-chat").checked;
window.storage.setItem("settings-delete-chat", a);
if (a == 1) {
while (document.getElementsByClassName("hud-chat-message").length > 100) {
document.getElementsByClassName("hud-chat-message")[0].remove();
}
}
});
if (window.storage.getItem("settings-language-filter") == null) {
window.storage.setItem("settings-language-filter", "true");
}
this.element.querySelector(".hud-settings-language-filter").checked = window.storage.getItem("settings-language-filter") === "true";
if (window.storage.getItem("settings-building-bar") == null) {
window.storage.setItem("settings-building-bar", "true");
}
this.element.querySelector(".hud-settings-building-bar").checked = window.storage.getItem("settings-building-bar") === "true";
this.element.querySelector(".hud-settings-special-effects").checked = window.storage.getItem("settings-special-effects") === "true";
this.element.querySelector(".hud-settings-delete-chat").checked = window.storage.getItem("settings-delete-chat") === "true";
Jj.network.languageFilterEnabled = this.element.querySelector(".hud-settings-language-filter").checked;
Jj.ui.components.uiBuildingBar.element.classList[this.element.querySelector(".hud-settings-building-bar").checked ? "add" : "remove"]("remain-visible");
}
}
class Ui extends d {
constructor(a) {
const b = document.createElement("div");
b.className = "hud-spells-item";
super(b);
this.disabled = false;
this.spellData = a;
this.element.innerHTML = "\n <img class=\"hud-spells-item-preview\" src=\"http://zombia.io/asset/images/Ui/Icons/Spells/" + a.name + (a.tiers > 0 ? "Tier1" : "") + ".svg\">\n <strong>" + a.name.split(/(?=[A-Z])/).join(" ") + "</strong> <small class=\"hud-spells-item-tier\" style=\"color: rgba(255, 255, 255, 0.4); font-size: 12px;\">Tier 1</small>\n <div class=\"hud-spells-item-description\">" + (a.description || "") + "</div>\n <div class=\"hud-spells-item-stats\"></div>\n <div class=\"hud-spells-item-cost\"></div>\n ";
this.tierElem = this.element.querySelector(".hud-spells-item-tier");
this.previewElem = this.element.querySelector(".hud-spells-item-preview");
this.statsElem = this.element.querySelector(".hud-spells-item-stats");
this.costElem = this.element.querySelector(".hud-spells-item-cost");
this.element.addEventListener("click", this.onClick.bind(this));
this.element.addEventListener("mousedown", this.onMouseDown);
this.update();
}
init() {
Jj.eventEmitter.on("BuySpellResponseRpcReceived", a => {
if (a.name == this.spellData.name) {
this.disabled = true;
this.element.classList.add("is-disabled");
setTimeout(() => {
this.disabled = false;
this.element.classList.remove("is-disabled");
}, a.cooldown);
}
});
Jj.eventEmitter.on("ClearActiveSpellRpcReceived", a => {
if (a.name == this.spellData.name) {
this.disabled = false;
this.element.classList.remove("is-disabled");
}
});
}
onClick() {
if (!this.disabled) {
Jj.network.sendRpc({
name: "BuySpell",
spellName: this.spellData.name
});
}
}
onMouseDown(a) {
a.stopPropagation();
a.preventDefault();
}
update(a = 0) {
const b = a >= (this.spellData.tiers || 1);
this.element.classList[b ? "add" : "remove"]("is-disabled");
this.disabled = b;
const c = {};
let d = "";
const e = b ? a : a + 1;
let f = "";
for (const b in c) {
if (this.spellData[c[b]]) {
d += "<p>" + b + ": <strong class=\"hud-stats-current\">" + (this.spellData[c[b]][a - 1] || "—") + "</strong></p>";
f += "<p>" + b + ": <strong class=\"hud-stats-next\">" + this.spellData[c[b]][e - 1] + "</strong></p>";
}
}
this.statsElem.innerHTML = d !== "" && f !== "" ? "<div class=\"hud-stats-current hud-stats-values\">" + d + "</div>\n <div class=\"hud-stats-next hud-stats-values\">" + f + "</div>" : "";
this.previewElem = this.element.querySelector(".hud-spells-item-preview").src = "http://zombia.io/asset/images/Ui/Icons/Spells/" + this.spellData.name + (this.spellData.tiers > 0 ? "Tier" + e : "") + ".svg";
if (this.spellData.tiers !== undefined) {
this.tierElem.textContent = "Tier " + e;
} else {
this.tierElem.textContent = "";
}
this.costElem.innerHTML = "<small>" + i.createResourceCostString(this.spellData, e, 1, false).elem.split(", ").join("<br>") + "</small>";
}
}
class Vi extends Oi {
constructor() {
super("Spells");
Jj.ui.components.uiMenuGridSpells = this;
this.element.innerHTML = "\n <div class=\"hud-grid-exit\"></div>\n <h3>Spells</h3>\n <div id=\"hud-spells-grid\" class=\"hud-spells-grid\"></div>\n ";
this.init();
}
init() {
Jj.eventEmitter.on("SpellInfoRpcReceived", this.onSpellDataReceived.bind(this));
}
onSpellDataReceived(a) {
document.getElementById("hud-spells-grid").innerHTML = "";
const b = JSON.parse(a.json);
for (let c in b) {
const a = b[c];
const d = new Ui(a);
document.getElementById("hud-spells-grid").appendChild(d.element);
d.init?.();
}
}
}
const Wi = c(6);
const Xi = c(573);
Wi.loadPlugin(Xi);
Wi.setDefaults({
randomize: false
});
class Yi extends Oi {
constructor() {
super("Parties");
Jj.ui.components.uiMenuGridParties = this;
this.partyLeader = 0;
this.element.innerHTML = "\n <div class=\"hud-grid-exit\"></div>\n <h3>Parties</h3>\n <div class=\"hud-party-tabs\">\n <a class=\"hud-party-tabs-link\">Your Party</a>\n <a class=\"hud-party-tabs-link\">Open Parties</a>\n </div>\n <div id=\"hud-party-members\" class=\"hud-party-members\"></div>\n <div id=\"hud-party-grid\" class=\"hud-party-grid\">\n <div class=\"hud-party-joining\">Requesting to join...</div>\n <button class=\"hud-party-cancel-request\">Cancel your request</button>\n <div class=\"hud-party-empty\">No parties are currently available to join.</div>\n </div>\n <div class=\"hud-party-actions\">\n <input type=\"text\" class=\"hud-party-name\" placeholder=\"Your party\"s name...\" maxlength=\"16\">\n <input type=\"text\" class=\"hud-party-key\" placeholder=\"Your party link...\">\n <a class=\"hud-party-key-randomise\">\n <a class=\"btn btn-red hud-party-leave\">Leave Party</a>\n <a class=\"btn hud-party-visibility is-private\">Private</a>\n </div>\n ";
this.membersElem = this.element.querySelector(".hud-party-members");
this.memberElems = {};
this.requestedUids = {};
this.gridJoiningElem = this.element.querySelector(".hud-party-joining");
this.cancelRequestButton = this.element.querySelector(".hud-party-cancel-request");
this.cancelRequestButton.addEventListener("mouseup", () => {
Jj.network.sendRpc({
name: "CancelPartyRequest"
});
});
this.gridEmptyElem = this.element.querySelector(".hud-party-empty");
this.gridElem = this.element.querySelector(".hud-party-grid");
this.partyNameElem = this.element.querySelector(".hud-party-name");
this.partyNameElem.addEventListener("keydown", a => {
a.stopPropagation();
});
this.partyNameElem.addEventListener("keyup", this.onPartyNameKeyUp.bind(this));
this.partyKeyElem = this.element.querySelector(".hud-party-key");
this.partyKeyElem.addEventListener("focus", () => {
this.partyKeyElem.select();
});
this.partyKeyElem.addEventListener("keydown", a => {
a.stopPropagation();
});
this.partyKeyElem.addEventListener("keyup", a => {
a.stopPropagation();
});
this.leaveElem = this.element.querySelector(".hud-party-leave");
this.leaveElem.addEventListener("click", this.leaveParty.bind(this));
this.visibilityElem = this.element.querySelector(".hud-party-visibility");
this.visibilityElem.addEventListener("click", this.toggleVisiblity.bind(this));
this.randomiseKeyButton = this.element.querySelector(".hud-party-key-randomise");
this.randomiseKeyButton.addEventListener("click", () => {
Jj.network.sendRpc({
name: "RandomisePartyKey"
});
});
this.partyElems = {};
this.partyData = null;
this.init();
}
init() {
const a = this.element.querySelectorAll(".hud-party-tabs-link");
for (let b of a) {
b.addEventListener("mouseup", this.setTab.bind(this, b));
}
this.setTab(a[0]);
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
Jj.eventEmitter.on("UpdatePartyRpcReceived", this.onPartyUpdate.bind(this));
Jj.eventEmitter.on("PartyKeyRpcReceived", this.onPartyKey.bind(this));
Jj.eventEmitter.on("PartyMembersUpdatedRpcReceived", this.onMembersUpdated.bind(this));
Jj.eventEmitter.on("PartyRequestRpcReceived", this.onPartyRequest.bind(this));
Jj.eventEmitter.on("PartyRequestMetRpcReceived", this.onPartyRequestMet.bind(this));
Jj.eventEmitter.on("PartyRequestCancelledRpcReceived", this.onPartyRequestCancelled.bind(this));
}
onEnterWorld() {
this.gridJoiningElem.style.display = "none";
this.cancelRequestButton.style.display = "none";
}
setTab(a) {
const b = this.element.querySelectorAll(".hud-party-tabs-link");
a.classList.add("is-active");
for (let c of b) {
if (c.textContent !== a.textContent) {
c.classList.remove("is-active");
}
}
this.gridElem.style.display = a.textContent == "Your Party" ? "none" : "block";
this.membersElem.style.display = a.textContent == "Your Party" ? "block" : "none";
}
onPartyUpdate(a) {
let b = {};
for (let c in a) {
b[a[c].partyId] = a[c];
}
this.partyData = b;
this.update();
if (!a.find(e => e.partyId == game.ui.playerTick?.partyId)?.isOpen && game.ui.playerTick?.uid == game.ui.playerPartyLeader) game.network.sendPacket(9, { response: { name: 'TogglePartyVisibility' } })
}
update() {
for (let a in this.partyData) {
if (!(a in this.partyElems) && this.partyData[a].isOpen !== false) {
for (let a in this.partyElems) {
this.partyElems[a].remove();
delete this.partyElems[a];
}
}
}
const a = {};
for (let b in this.partyElems) {
a[b] = true;
}
for (let b in this.partyData) {
if (b == Jj.ui.getPlayerTick()?.partyId && this.partyData[b].isOpen === false) {
continue;
}
delete a[b];
const c = this.partyData[b];
let d = this.partyElems[b];
if (!this.partyElems[b]) {
d = document.createElement("div");
d.className = "hud-party-link";
this.gridElem.appendChild(d);
this.partyElems[b] = d;
d.addEventListener("click", this.onPartyClick.bind(this, c.partyId));
}
if (Jj.ui.getPlayerTick()?.partyId == b) {
d.classList.add("is-active");
d.classList.remove("is-disabled");
} else if (c.memberCount >= c.memberLimit) {
d.classList.remove("is-active");
d.classList.add("is-disabled");
} else {
d.classList.remove("is-active");
d.classList.remove("is-disabled");
}
d.innerHTML = "\n <strong id=\"name\"></strong>\n <span>" + c.memberCount + "/" + c.memberLimit + "</span>";
d.querySelector("#name").appendChild(document.createTextNode(Jj.network.languageFilterEnabled ? Wi(c.partyName) : c.partyName));
}
for (let b in a) {
if (this.partyElems[b]) {
this.partyElems[b].remove();
delete this.partyElems[b];
}
}
this.gridEmptyElem.style.display = Object.keys(this.partyElems || {}).length > 0 ? "none" : "block";
const b = this.partyData?.[Jj.ui.getPlayerTick()?.partyId];
if (!b) {
return;
}
this.partyKeyElem.removeAttribute("disabled");
if (document.activeElement !== this.partyNameElem) {
this.partyNameElem.value = b.partyName;
}
const c = Jj.renderer.world.localPlayer === this.partyLeader;
this.visibilityElem.classList[c ? "remove" : "add"]("is-disabled");
if (c) {
this.partyNameElem.removeAttribute("disabled");
} else {
this.partyNameElem.setAttribute("disabled", "true");
}
this.visibilityElem.classList[b.isOpen ? "remove" : "add"]("is-private");
this.visibilityElem.innerText = b.isOpen ? "Public" : "Private";
}
onPartyKey(a) {
Jj.ui.partyKey = a.partyKey;
this.partyKeyElem.value = window.location.protocol + "//" + document.location.hostname + "/#/" + Jj.network.options.serverData.id + "/" + a.partyKey;
this.update();
}
onPartyNameKeyUp(a) {
Jj.network.sendRpc({
name: "SetPartyName",
partyName: this.partyNameElem.value
});
a.stopPropagation();
}
onMembersUpdated(a) {
this.partyLeader = a.find(a => a.isLeader === true).uid;
const b = Jj.renderer.world.localPlayer === this.partyLeader;
Jj.ui.playerPartyLeader = this.partyLeader;
for (let b in this.memberElems) {
this.memberElems[b].remove();
delete this.memberElems[b];
}
if (a.length <= 1) {
this.leaveElem.classList.add("is-disabled");
} else {
this.leaveElem.classList.remove("is-disabled");
}
for (let c in a) {
const d = document.createElement("div");
const e = a[c];
d.className = "hud-member-link";
d.innerHTML = "\n <strong id=\"name\"></strong>\n <small>" + (e.uid == this.partyLeader ? "Leader" : "Member") + "</small>\n <div class=\"hud-member-actions\">\n <a class=\"hud-member-can-place btn " + (b && e.uid !== this.partyLeader ? "" : " is-disabled") + " " + (e.canPlace ? " is-active" : "") + "\">\n <span class=\"hud-party-permissions-tick\">✓</span> Can place\n </a>\n <a class=\"hud-member-can-sell btn " + (b && e.uid !== this.partyLeader ? "" : " is-disabled") + " " + (e.canSell ? " is-active" : "") + "\">\n <span class=\"hud-party-permissions-tick\">✓</span> Can sell\n </a>\n <a class=\"hud-member-kick btn btn-red " + (b && e.uid !== this.partyLeader ? "" : " is-disabled") + "\">Kick</a>\n </div>\n ";
d.querySelector("#name").appendChild(document.createTextNode(Jj.network.languageFilterEnabled ? Wi(e.name) : e.name));
this.membersElem.appendChild(d);
this.memberElems[e.uid] = d;
if (b && e.uid !== this.partyLeader) {
d.querySelector(".hud-member-kick").addEventListener("click", this.onPartyMemberKick.bind(this, e));
d.querySelector(".hud-member-can-place").addEventListener("click", this.onPartyMemberPermissionToggle.bind(this, e.uid, "Place"));
d.querySelector(".hud-member-can-sell").addEventListener("click", this.onPartyMemberPermissionToggle.bind(this, e.uid, "Sell"));
}
}
this.randomiseKeyButton.classList[b ? "remove" : "add"]("locked");
}
leaveParty() {
Jj.network.sendRpc({
name: "LeaveParty"
});
}
toggleVisiblity() {
Jj.network.sendRpc({
name: "TogglePartyVisibility"
});
}
onPartyClick(a) {
if (a != Jj.ui.getPlayerTick()?.partyId) {
if (Jj.ui.factory !== null) {
Jj.ui.components.uiPopupOverlay.showConfirmation("Are you sure you want to abandon your base?", 10000, () => {
this.requestParty(a);
});
} else {
this.requestParty(a);
}
}
}
requestParty(a) {
if (!this.partyElems[a].classList.contains("is-disabled")) {
this.gridJoiningElem.style.display = "block";
this.cancelRequestButton.style.display = "block";
this.gridElem.classList.add("is-disabled");
Jj.network.sendRpc({
name: "JoinParty",
partyId: a
});
}
}
onPartyMemberKick(a) {
Jj.ui.components.uiPopupOverlay.showConfirmation("Are you sure you want to kick <b>" + a.name + "</b> from your party?", 10000, () => {
Jj.network.sendRpc({
name: "KickMember",
uid: parseInt(a.uid)
});
});
}
onPartyMemberPermissionToggle(a, b) {
Jj.network.sendRpc({
name: "TogglePartyPermission",
permission: b,
uid: parseInt(a)
});
}
onPartyRequest(a) {
this.requestedUids[a.uid] = Jj.ui.components.uiPopupOverlay.showConfirmation("<b>" + a.name + "</b> has requested to join your party.", 30000, () => {
Jj.network.sendRpc({
name: "PartyRequestResponse",
accepted: true,
uid: parseInt(a.uid)
});
}, () => {
Jj.network.sendRpc({
name: "PartyRequestResponse",
accepted: false,
uid: parseInt(a.uid)
});
});
for (let i in sockets) {
if (sockets[i].myPlayer.uid == a.uid) {
game.network.sendPacket(9, { response: { name: 'PartyRequestResponse', accepted: true, uid: a.uid } });
Array.from(document.getElementsByClassName("hud-popup-confirmation hud-popup-confirmation is-visible")).forEach(e => e.remove()) //removes confirmation divs
}
}
}
onPartyRequestMet() {
this.gridJoiningElem.style.display = "none";
this.cancelRequestButton.style.display = "none";
this.gridElem.classList.remove("is-disabled");
}
onPartyRequestCancelled(a) {
Jj.ui.components.uiPopupOverlay.removePopup(this.requestedUids[a.uid]);
delete this.requestedUids[a.uid];
}
}
class script extends Oi {
constructor() {
super("Menu");
this.element.innerHTML = `\n <div class=\"hud-grid-exit\"></div>\n <h3>Script</h3>\n`;
}
}
class Zi extends d {
constructor(a) {
let b;
let c = document.createElement("div");
c.className = "hud-icon";
c.setAttribute("icon-type", a);
super(c);
this.type = a;
this.visible = false;
this.element.addEventListener("click", this.onClick.bind(this));
this.element.addEventListener("mousedown", this.onMouseClick.bind(this));
this.element.addEventListener("mouseup", this.onMouseClick.bind(this));
switch (this.type) {
case "Shop":
this.menuGrid = new Si();
b = 66;
break;
case "Settings":
this.menuGrid = new Ti();
break;
case "Spells":
this.menuGrid = new Vi();
break;
case "Parties":
b = 80;
this.menuGrid = new Yi();
break;
case "Menu":
this.menuGrid = new script();
}
document.body.appendChild(this.menuGrid.element);
this.menuGrid.element.querySelector(".hud-grid-exit").addEventListener("click", () => {
this.hide();
});
if (b !== undefined) {
Jj.eventEmitter.on(b + "Up", this.onClick.bind(this));
}
Jj.eventEmitter.on("27Up", this.hide.bind(this));
}
onClick(a) {
if (Jj.network.connected === true && Jj.ui.playerTick?.health > 0) {
for (let a in Jj.ui.components.uiTopBar.menuIcons) {
if (a == this.type) {
if (this.visible) {
this.hide();
} else {
this.show();
Jj.ui.components.uiPlacementOverlay.cancelPlacing();
Jj.ui.components.uiBuildingOverlay.stopWatching();
}
} else {
Jj.ui.components.uiTopBar.menuIcons[a].hide();
}
}
}
if (a) {
a.stopPropagation();
a.preventDefault();
}
}
show() {
this.visible = true;
this.menuGrid.show();
}
hide() {
this.visible = false;
this.menuGrid.hide();
}
onMouseClick(a) {
a.stopPropagation();
a.preventDefault();
}
}
class $i extends d {
constructor() {
let a = document.createElement("div");
a.className = "hud-top-bar";
a.innerHTML = "\n <div id=\"hud-top-bar-left\" class=\"hud-top-bar-left\"></div>\n <div id=\"hud-top-bar-tools\" class=\"hud-top-bar-tools\"></div>\n <div id=\"hud-top-bar-right\" class=\"hud-top-bar-right\"></div>\n ";
document.getElementById("hud-top").appendChild(a);
super(a);
this.tools = {};
}
init() {
this.menuIcons = {};
for (const a of ["Shop", "Settings"]) {
const b = new Zi(a);
document.getElementById("hud-top-bar-left").appendChild(b.element);
this.menuIcons[a] = b;
}
for (const a of ["Spells", "Parties", "Menu"]) {
const b = new Zi(a);
document.getElementById("hud-top-bar-right").appendChild(b.element);
this.menuIcons[a] = b;
}
for (let a in this.menuIcons) {
this.menuIcons[a].element.addEventListener("mouseenter", () => {
Jj.ui.components.uiBuildingBar.buildingTooltip.moveTo(this.menuIcons[a].element);
});
this.menuIcons[a].element.addEventListener("mouseleave", () => {
Jj.ui.components.uiBuildingBar.buildingTooltip.hide();
});
}
Jj.eventEmitter.on("ToolDataReceived", this.onToolDataReceived.bind(this));
Jj.eventEmitter.on("81Up", this.onToggleWeapon.bind(this));
Jj.eventEmitter.on("SetToolRpcReceived", a => {
for (const b of a) {
if (this.tools[b.toolName] !== undefined) {
this.tools[b.toolName] = b.toolTier > 0;
}
}
});
}
onToolDataReceived() {
this.tools = {};
const a = Jj.ui.toolData;
const b = document.getElementById("hud-top-bar-tools");
b.innerHTML = "";
for (let c in a) {
const d = a[c];
if (d.class !== "Tools") {
continue;
}
this.tools[d.name] = false;
const e = new Ni(d.name);
b.appendChild(e.element);
e.init();
}
}
onToggleWeapon() {
const a = [];
for (let b in this.tools) {
if (this.tools[b] === true) {
a.push(b);
}
}
let b = a[0];
let c = false;
for (let d of a) {
if (c) {
b = d;
break;
}
if (d == Jj.ui.playerTick.weaponName) {
c = true;
}
}
if (b !== Jj.ui.playerTick.weaponName) {
Jj.network.sendRpc({
name: "EquipTool",
toolName: b
});
}
}
}
class _i extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-resources";
a.innerHTML = "\n <div class=\"hud-resources-resource hud-resources-wood\" id=\"hud-resources-wood\"></div>\n <div class=\"hud-resources-resource hud-resources-stone\" id=\"hud-resources-stone\"></div>\n <div class=\"hud-resources-resource hud-resources-gold\" id=\"hud-resources-gold\"></div>\n <div class=\"hud-resources-resource hud-resources-tokens\" id=\"hud-resources-tokens\"></div>";
document.getElementById("hud-bottom").appendChild(a);
super(a);
this.woodElem = document.getElementById("hud-resources-wood");
this.stoneElem = document.getElementById("hud-resources-stone");
this.goldElem = document.getElementById("hud-resources-gold");
this.tokensElem = document.getElementById("hud-resources-tokens");
}
init() {
const a = ["wood", "stone", "gold", "tokens"];
for (let b of a) {
Jj.eventEmitter.on(b + "CountUpdated", () => {
let a = Math.round(Jj.ui.getPlayerTick()[b]);
if (a >= 10000) {
a = aj(a, 2);
}
this[b + "Elem"].innerHTML = a;
});
}
}
}
const aj = (a, b) => {
const c = ["K", "M", "B", "T", "q", "Q", "s", "S", "O", "N", "D"];
b = Math.pow(10, b);
for (let d = c.length - 1; d >= 0; d--) {
const e = Math.pow(10, (d + 1) * 3);
if (e <= a) {
if ((a = Math.round(a * b / e) / b) == 1000 && d < c.length - 1) {
a = 1;
d++;
}
a += c[d];
break;
}
}
return a;
};
class bj extends d {
constructor() {
let a = document.createElement("div");
a.className = "hud-popup-overlay";
document.getElementById("hud").appendChild(a);
let b = document.createElement("div");
b.className = "hud-confirmation-overlay";
document.getElementById("hud").appendChild(b);
super(a);
this.popupElems = {};
this.popupTimers = {};
this.hintMessages = {};
this.confirmationOverlayDiv = b;
this.confirmationMessages = {};
}
init() {
Jj.eventEmitter.on("FailureRpcReceived", this.onFailure.bind(this));
}
onFailure(a) {
this.showHint(a.failure, 4000);
}
showHint(a, b = 8000) {
for (const c in this.hintMessages) {
if (this.hintMessages[c] == a) {
return null;
}
}
const c = Math.round(Math.random() * 10000000);
const d = document.createElement("div");
d.className = "hud-popup-message hud-popup-hint is-visible";
d.textContent = a;
this.element.insertBefore(d, this.element.firstChild);
this.popupElems[c] = d;
this.popupTimers[c] = setTimeout(() => {
this.removePopup(c);
}, b);
this.hintMessages[c] = a;
return c;
}
showConfirmation(a, b = 30000, c = null, d = null) {
const e = Math.round(Math.random() * 10000000);
const f = document.createElement("div");
f.className = "hud-popup-confirmation hud-popup-confirmation is-visible";
f.innerHTML = "\n <span>" + a + "</span>\n <div class=\"hud-confirmation-actions\">\n <a class=\"btn btn-green hud-confirmation-accept\">✓</a>\n <a class=\"btn btn-red hud-confirmation-decline\">✗</a>\n </div>\n ";
f.addEventListener("mousedown", a => a.stopPropagation());
this.confirmationOverlayDiv.appendChild(f);
this.popupElems[e] = f;
const g = f.querySelector(".hud-confirmation-accept");
const h = f.querySelector(".hud-confirmation-decline");
g.addEventListener("mousedown", a => a.stopPropagation());
g.addEventListener("click", a => {
a.stopPropagation();
this.removePopup(e);
if (c) {
c();
}
});
h.addEventListener("mousedown", a => a.stopPropagation());
h.addEventListener("click", a => {
a.stopPropagation();
this.removePopup(e);
if (d) {
d();
}
});
this.popupTimers[e] = setTimeout(() => {
this.removePopup(e);
}, b);
return e;
}
removePopup(a) {
const b = this.popupElems[a];
if (b) {
if (this.popupTimers[a]) {
clearInterval(this.popupTimers[a]);
}
delete this.popupElems[a];
delete this.popupTimers[a];
delete this.confirmationMessages[a];
delete this.hintMessages[a];
b.classList.remove("is-visible");
setTimeout(() => {
b.remove();
}, 500);
}
}
}
class cj extends d {
constructor() {
const a = document.createElement("div");
a.className = a.id = "hud-pip-overlay";
document.getElementById("hud").appendChild(a);
super(a);
this.resourceGainElems = {};
this.damageElems = {};
this.lastPlayerTick = {
wood: 0,
stone: 0,
gold: 0,
tokens: 0
};
}
init() {
Jj.eventEmitter.on("PlayerTickUpdated", this.onPlayerTickUpdated.bind(this));
}
onPlayerTickUpdated() {
const a = Jj.ui.getPlayerTick();
const b = Jj.ui.getLastPlayerTick();
if (!a || !b) {
return;
}
if (Jj.renderer.replicator.getMsSinceTick(Jj.renderer.replicator.currentTick.tick) > 500) {
return;
}
for (let b = 0; b < a.lastPlayerDamages.length; b += 2) {
this.showDamage(a.lastPlayerDamages[b], a.lastPlayerDamages[b + 1]);
}
const c = ["gold", "wood", "stone", "tokens"];
for (let d of c) {
if (d == "gold" && a[d] > b[d]) {
continue;
}
if (a[d] == b[d]) {
continue;
}
const c = a[d] - b[d];
this.showResourceGain(a.uid, d, c);
}
}
showDamage(a, b) {
const c = Jj.renderer.replicator.currentTick.tick;
for (let d in this.damageElems) {
if (this.damageElems[d].uid == a && this.damageElems[d].value == b && this.damageElems[d].tick == c || this.damageElems[d].tick == c - 1) {
return;
}
}
const d = Math.round(Math.random() * 10000);
const e = document.createElement("div");
e.className = "hud-pip-damage";
e.innerHTML = b.toLocaleString();
const f = Jj.renderer.world.entities[a];
if (!f) {
return;
}
const g = Jj.renderer.worldToScreen(f.getPositionX(), f.getPositionY());
this.element.appendChild(e);
e.style.left = g.x - e.offsetWidth / 2 + "px";
e.style.top = g.y - e.offsetHeight - 10 + "px";
this.damageElems[d] = {
uid: a,
value: b,
tick: c,
elem: e
};
setTimeout(() => {
e.remove();
delete this.damageElems[d].elem;
}, 500);
}
showResourceGain(a, b, c) {
if (Math.abs(c) < 0.5) {
return;
}
c = Math.round(c);
const d = Math.round(Math.random() * 10000);
const e = document.createElement("div");
e.className = "hud-pip-resource-gain";
e.innerText = (c > 0 ? "+" + c.toLocaleString() : c.toLocaleString()) + " " + b;
const f = Jj.renderer.world.entities[a];
if (!f) {
return;
}
this.element.appendChild(e);
const g = Jj.renderer.worldToScreen(f.getPositionX(), f.getPositionY());
e.style.left = g.x - e.offsetWidth / 2 + "px";
e.style.top = g.y - e.offsetHeight - 70 + Object.keys(this.resourceGainElems).length * 16 + "px";
this.resourceGainElems[d] = e;
setTimeout(() => {
e.remove();
}, 500);
setTimeout(() => {
delete this.resourceGainElems[d];
}, 250);
}
}
class dj extends d {
constructor() {
let a = document.createElement("div");
a.className = "hud-respawn";
a.innerHTML = "\n <div class=\"hud-respawn-wrapper\">\n <div class=\"hud-respawn-main\">\n <div class=\"hud-respawn-info\">\n <h2>Oh no...</h2>\n <p class=\"hud-respawn-text\"></p>\n <button type=\"submit\" class=\"hud-respawn-btn\">Respawn</button>\n <div class=\"hud-respawn-share\">\n <a href=\"https://discord.gg/4cxREnV4WE\" target=\"_blank\" class=\"btn btn-discord\"></a>\n </div>\n </div>\n </div>\n </div>";
document.getElementById("hud").appendChild(a);
super(a);
this.respawnTextElem = this.element.querySelector(".hud-respawn-text");
this.element.querySelector(".hud-respawn-btn").addEventListener("mouseup", () => {
Jj.network.sendRpc({
name: "Respawn"
});
});
}
init() {
Jj.eventEmitter.on("DeadRpcReceived", this.onDead.bind(this));
Jj.eventEmitter.on("RespawnedRpcReceived", this.onRespawned.bind(this));
}
onDead(a) {
this.show();
let b = "a staggering";
if (a.wave <= 5) {
b = "a disappointing";
} else if (a.wave <= 50) {
b = "a fine";
} else if (a.wave <= 100) {
b = "a decent";
} else if (a.wave <= 300) {
b = "a strong";
} else if (a.wave <= 1000) {
b = "an impressive";
} else if (a.wave <= 20000) {
b = "a staggering";
} else if (a.wave > 20000) {
b = "an amazing (I sure hope you didn't cheat)";
}
switch (a.reason) {
case "FactoryDied":
this.respawnTextElem.innerHTML = "Your base was destroyed after " + b + " " + parseInt(a.wave)?.toLocaleString() + " waves and " + parseInt(a.score)?.toLocaleString() + " score. Totalling " + parseInt(a.partyScore).toLocaleString() + " score across your party.";
break;
case "KilledWithBase":
this.respawnTextElem.innerHTML = "Your player got killed at wave " + parseInt(a.wave)?.toLocaleString() + " with a score of " + parseInt(a.score)?.toLocaleString() + "; but fear not! Your base remains.";
break;
case "Killed":
this.respawnTextElem.innerHTML = "Your player got killed. Too bad you don't have a base to return to.";
}
Jj.ui.components.uiMenuGridParties.hide();
Jj.ui.components.uiMenuGridSettings.hide();
Jj.ui.components.uiMenuGridShop.hide();
Jj.ui.components.uiMenuGridSpells.hide();
}
onRespawned() {
this.hide();
}
}
class ej extends d {
constructor() {
let a = document.createElement("div");
a.className = "hud-day-night-ticker";
document.getElementById("hud-bottom").appendChild(a);
super(a);
this.clockCircle = document.createElement("div");
this.clockCircle.className = "hud-day-night-ticker-clock";
this.element.appendChild(this.clockCircle);
this.waveElement = document.createElement("div");
this.waveElement.className = "hud-day-night-ticker-wave";
this.element.appendChild(this.waveElement);
this.lastArmRotation = 0;
this.announcedNight = false;
}
init() {
Jj.eventEmitter.on("UpdateDayNightCycleRpcReceived", this.onDayNightCycleData.bind(this));
Jj.eventEmitter.on("RendererUpdated", this.onRendererUpdate.bind(this));
Jj.eventEmitter.on("waveCountUpdated", () => {
this.waveElement.innerHTML = "<span>" + Jj.ui.getPlayerTick().wave.toLocaleString() + "</span>";
});
}
onDayNightCycleData(a) {
this.nightLength = a.nightLength;
this.dayLength = a.dayLength;
this.cycleLength = this.dayLength + this.nightLength;
let b = this.dayLength / this.cycleLength * 360;
this.clockCircle.style.background = "conic-gradient(#d6ab35ff 0deg " + b + "deg, #8473d4ff " + b + "deg 0deg)";
}
onRendererUpdate() {
if (this.cycleLength == null) {
return;
}
const a = Jj.renderer.replicator.getTickIndex();
const b = this.cycleLength - a % this.cycleLength;
const c = a % this.cycleLength < this.dayLength;
if (c === true) {
let b = this.dayLength - a % this.cycleLength;
if (this.announcedNight === false && b <= this.dayLength / 5) {
this.announcedNight = true;
Jj.ui.components.uiAnnouncementOverlay.showAnnouncement("Night is fast approaching. Get to safety...", this.dayLength / 5 * Jj.renderer.replicator.msPerTick);
}
} else if (c === false) {
this.announcedNight = false;
}
const d = b / this.cycleLength * 360;
if (d < 0) {
return;
}
const e = i.interpolateYaw(this.lastArmRotation, d);
this.clockCircle.style.rotate = e + "deg";
this.lastArmRotation = e;
}
}
class fj extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-day-night-overlay";
a.id = "hud-day-night-overlay";
document.getElementById("hud").appendChild(a);
super(a);
}
init() {
Jj.eventEmitter.on("UpdateDayNightCycleRpcReceived", this.onDayNightCycleData.bind(this));
Jj.eventEmitter.on("RendererUpdated", this.update.bind(this));
}
update() {
if (document.getElementsByClassName("hud-settings-day-night-opacity")[0].checked) {
this.element.style.opacity = "0";
return;
}
const a = Jj.renderer.replicator.getTickIndex();
let b = 0;
let c = 0;
let d = 0;
if (a % this.cycleLength < this.dayLength == 1) {
b = 1 - (this.dayLength - a % this.cycleLength) / this.dayLength;
d = b < 0.2 ? (1 - b / 0.2) * 0.5 : b > 0.8 ? (b - 0.8) / 0.2 * 0.5 : 0;
} else {
b = 1;
c = 1 - (this.nightLength - (a - this.dayLength) % this.cycleLength) / this.nightLength;
d = c < 0.2 ? 0.5 + c / 0.2 * 0.5 : c > 0.8 ? 0.5 + (1 - (c - 0.8) / 0.2) * 0.5 : 1;
}
this.element.style.opacity = d.toString();
}
onDayNightCycleData(a) {
this.nightLength = a.nightLength;
this.dayLength = a.dayLength;
this.cycleLength = this.dayLength + this.nightLength;
}
}
class gj extends d {
constructor() {
let a = document.createElement("div");
a.className = "hud-announcement-overlay";
document.getElementById("hud").appendChild(a);
super(a);
}
showAnnouncement(a, b = 8000) {
const c = document.createElement("div");
c.className = "hud-announcement-message";
c.style["animation-duration"] = b + "ms";
c.innerHTML = a;
this.element.appendChild(c);
setTimeout(() => {
c.remove();
}, b);
}
}
const hj = c(6);
const ij = c(573);
hj.loadPlugin(ij);
hj.setDefaults({
randomize: false
});
class jj extends d {
constructor() {
const a = document.createElement("div");
a.id = "hud-leaderboard";
a.className = "hud-leaderboard";
a.innerHTML = "\n <div class=\"hud-leaderboard-player is-header\">\n <span class=\"player-rank\">Rank</span>\n <span class=\"player-name\">Name</span>\n <span class=\"player-score\">Score</span>\n <span class=\"player-wave\">Wave</span>\n </div>\n <div class=\"hud-leaderboard-players\"></div>\n ";
document.getElementById("hud-top").appendChild(a);
super(a);
this.playerElems = [];
this.playerRankElems = [];
this.playerNameElems = [];
this.playerScoreElems = [];
this.playerWaveElems = [];
this.playerNames = {};
this.leaderboardData = [];
this.playersElem = this.element.querySelector(".hud-leaderboard-players");
}
init() {
Jj.eventEmitter.on("UpdateLeaderboardRpcReceived", this.onLeaderboardData.bind(this));
}
update() {
this.playersElem.style.height = this.leaderboardData.length * 28 + "px";
setTimeout(() => {
for (let a = 0; a < this.leaderboardData.length; a++) {
const b = this.leaderboardData[a];
this.playerNames[b.uid] ||= b.name;
if (!(a in this.playerElems)) {
this.playerElems[a] = document.createElement("div");
this.playerElems[a].className = "hud-leaderboard-player";
this.playerRankElems[a] = document.createElement("span");
this.playerRankElems[a].className = "player-rank";
this.playerRankElems[a].innerHTML = "-";
this.playerNameElems[a] = document.createElement("strong");
this.playerNameElems[a].className = "player-name";
this.playerNameElems[a].innerHTML = "-";
this.playerScoreElems[a] = document.createElement("span");
this.playerScoreElems[a].className = "player-score";
this.playerScoreElems[a].innerHTML = "-";
this.playerWaveElems[a] = document.createElement("span");
this.playerWaveElems[a].className = "player-wave";
this.playerWaveElems[a].innerHTML = "-";
this.playerElems[a].appendChild(this.playerRankElems[a]);
this.playerElems[a].appendChild(this.playerNameElems[a]);
this.playerElems[a].appendChild(this.playerScoreElems[a]);
this.playerElems[a].appendChild(this.playerWaveElems[a]);
this.playersElem.appendChild(this.playerElems[a]);
}
if (Jj.renderer.world.localPlayer == b.uid) {
this.playerElems[a].classList.add("is-active");
} else {
this.playerElems[a].classList.remove("is-active");
}
this.playerElems[a].style.display = "block";
this.playerRankElems[a].innerText = "#" + b.rank;
this.playerNameElems[a].innerText = Jj.network.languageFilterEnabled ? hj(b.name) : b.name;
this.playerScoreElems[a].innerText = parseInt(b.score).toLocaleString();
this.playerWaveElems[a].innerHTML = b.wave === 0 ? "<small>—</small>" : parseInt(b.wave).toLocaleString();
}
}, 100);
if (this.leaderboardData.length < this.playerElems.length) {
for (let a = this.leaderboardData.length; a < this.playerElems.length; a++) {
this.playerElems[a].style.display = "none";
}
}
}
onLeaderboardData(a) {
this.leaderboardData = a;
this.update();
}
}
class kj extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-party-member-indicator";
document.getElementById("hud-bottom").appendChild(a);
super(a);
this.memberElements = {};
}
init() {
Jj.eventEmitter.on("PartyMembersUpdatedRpcReceived", this.onMembersUpdated.bind(this));
}
onMembersUpdated(a) {
for (let b in this.memberElements) {
this.memberElements[b].remove();
delete this.memberElements[b];
}
for (let b of a) {
if (this.memberElements[b.uid] == null) {
this.memberElements[b.uid] = document.createElement("div");
this.memberElements[b.uid].className = "member-indicator";
this.element.appendChild(this.memberElements[b.uid]);
}
this.memberElements[b.uid].setAttribute("data-index", a.indexOf(b));
this.memberElements[b.uid].innerHTML = "<span>" + b.name.substring(0, 2) + "</span>";
}
}
}
class lj extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-ui-armour-indicator";
a.setAttribute("item-type", "ZombieShield");
document.getElementById("hud-bottom").appendChild(a);
super(a);
this.element.addEventListener("mousedown", a => {
a.stopPropagation();
});
this.element.addEventListener("mouseenter", () => {
Jj.ui.components.uiBuildingBar.buildingTooltip.moveTo(this.element);
});
this.element.addEventListener("mouseleave", () => {
Jj.ui.components.uiBuildingBar.buildingTooltip.hide();
});
this.tier = 0;
}
init() {
Jj.eventEmitter.on("SetToolRpcReceived", a => {
for (let b of a) {
if (b.toolName == "ZombieShield") {
if (b.toolTier > 0) {
this.show();
} else {
this.hide();
}
this.tier = b.toolTier;
}
}
});
Jj.eventEmitter.on("EnterWorldResponse", this.hide.bind(this));
}
}
class mj extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-active-spells";
super(a);
this.activeSpells = {};
document.getElementById("hud-right").appendChild(a);
}
init() {
Jj.eventEmitter.on("BuySpellResponseRpcReceived", this.createActiveSpellIcon.bind(this));
Jj.eventEmitter.on("ClearActiveSpellRpcReceived", a => {
this.clearActiveSpell(a.name);
});
}
createActiveSpellIcon(a) {
const b = document.createElement("img");
b.className = "hud-active-spell";
this.element.appendChild(b);
b.src = "http://zombia.io/asset/images/Ui/Icons/Spells/" + a.name + ".svg";
this.activeSpells[a.name] = b;
setTimeout(() => {
this.clearActiveSpell(a.name);
}, a.iconCooldown);
}
clearActiveSpell(a) {
this.activeSpells[a].remove();
}
}
class nj extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-ui-walkthrough";
document.getElementById("hud").appendChild(a);
super(a);
if (window.storage.getItem("walkthrough_BuildingBar") == null) {
window.storage.setItem("walkthrough_BuildingBar", "false");
}
this.buildingBarIndicator = document.createElement("div");
this.buildingBarIndicator.className = "hud-ui-walkthrough building-bar";
this.buildingBarIndicator.innerHTML = "<h3>Hover to reveal buildings</h3>";
this.element.appendChild(this.buildingBarIndicator);
}
init() {
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorldResponse.bind(this));
}
onEnterWorldResponse(a) {
if (window.storage.getItem("walkthrough_BuildingBar") == "false" && window.storage.getItem("settings-building-bar") == "false") {
this.showBuildingBarIndicator();
}
}
showBuildingBarIndicator() {
this.buildingBarIndicator.style.display = "block";
}
hideBuildingBarIndicator() {
this.buildingBarIndicator.style.display = "none";
}
}
class oj extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-ui-input-lock";
document.getElementById("hud").appendChild(a);
super(a);
this.timeVisible = 0;
}
toggle(a) {
this.element.classList.add("visible");
let b = Date.now();
this.timeVisible = b;
setTimeout(() => {
if (b == this.timeVisible) {
this.element.classList.remove("visible");
}
}, 3000);
this.element.classList[a ? "add" : "remove"]("enabled");
}
}
class pj extends d {
constructor() {
super(document.getElementById("hud"));
this.components = {};
this.components.uiIntro = new e();
this.components.uiIntroLeaderboard = new f();
this.components.uiReconnection = new g();
this.components.uiMap = new Ji();
this.components.uiBuildingBar = new k();
this.components.uiChat = new Mi();
this.components.uiTopBar = new $i();
this.components.uiResources = new _i();
this.components.uiPlacementOverlay = new Hi();
this.components.uiBuildingOverlay = new Ii();
this.components.uiPopupOverlay = new bj();
this.components.uiPipOverlay = new cj();
this.components.uiRespawn = new dj();
this.components.uiDayNightTicker = new ej();
this.components.uiDayNightOverlay = new fj();
this.components.uiAnnouncementOverlay = new gj();
this.components.uiLeaderboard = new jj();
this.components.uiPartyMemberIndicator = new kj();
this.components.uiArmourIndicator = new lj();
this.components.uiActiveSpells = new mj();
this.components.uiWalkthrough = new nj();
this.components.uiInputLock = new oj();
this.hasInitialised = false;
this.playerTick = null;
this.lastPlayerTick = null;
this.factory = null;
this.buildings = {};
this.buildingData = null;
this.mousePosition = {
x: 0,
y: 0
};
this.playerPartyMembers = [];
this.playerPartyLeader = false;
this.playerPartyCanSell = false;
this.playerPartyCanPlace = false;
}
init() {
if (!this.hasInitialised) {
this.hasInitialised = true;
for (let a in this.components) {
if (this.components[a].init) {
this.components[a].init();
}
}
Jj.eventEmitter.on("SocketOpened", this.onSocketOpened.bind(this));
Jj.eventEmitter.on("SocketClosed", this.onSocketClosed.bind(this));
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
Jj.eventEmitter.on("BuildingInfoRpcReceived", this.onBuildingDataReceived.bind(this));
Jj.eventEmitter.on("ToolInfoRpcReceived", this.onItemDataReceived.bind(this));
Jj.eventEmitter.on("PartyMembersUpdatedRpcReceived", this.onPartyInfoUpdate.bind(this));
Jj.eventEmitter.on("mouseMoved", this.onMouseMoved.bind(this));
Jj.eventEmitter.on("mouseUp", this.onMouseUp.bind(this));
Jj.eventEmitter.on("mouseDown", this.onMouseDown.bind(this));
Jj.eventEmitter.on("rightMouseUp", this.onRightMouseUp.bind(this));
Jj.eventEmitter.on("PartyBuildingRpcReceived", this.onPartyBuildingUpdate.bind(this));
window.addEventListener("beforeunload", this.onBeforeUnload);
window.addEventListener("keydown", a => {
if (a.code == "Space" && a.target == document.body) {
a.preventDefault();
}
});
}
}
onEnterWorld() {
this.factory = null;
this.playerTick = null;
this.buildings = {};
}
onBuildingDataReceived(a) {
this.buildingData = JSON.parse(a.json);
for (const b in this.buildingData) {
this.buildingData[b].built = 0;
}
Jj.eventEmitter.emit("BuildingDataReceived");
}
onItemDataReceived(a) {
this.toolData = JSON.parse(a.json);
Jj.eventEmitter.emit("ToolDataReceived");
}
onPartyInfoUpdate(a) {
const b = a.length;
const c = Jj.renderer.world.getLocalPlayer();
this.playerPartyMembers = a;
this.playerPartyCanSell = a.find(a => a.uid === c).canSell === true;
this.playerPartyCanPlace = a.find(a => a.uid === c).canPlace === true;
Jj.eventEmitter.emit("PartyMembersUpdated", a);
for (const c in this.buildingData) {
const a = this.buildingData[c];
a.limit = a.limitPerMember * (a.limitStatic === false ? b : 1);
}
Jj.eventEmitter.emit("BuildingDataUpdated");
}
onMouseMoved({
event: a
}) {
this.mousePosition = {
x: a.clientX,
y: a.clientY
};
this.components.uiPlacementOverlay.update();
if (this.components.uiPlacementOverlay.isActive() && Jj.network.inputPacketManager.mouseDown === true) {
this.components.uiPlacementOverlay.placeBuilding();
}
}
onMouseDown({
event: a
}) {
if (this.components.uiPlacementOverlay.isActive()) {
this.components.uiPlacementOverlay.placeBuilding();
}
for (let b in this.components.uiTopBar.menuIcons) {
this.components.uiTopBar.menuIcons[b].hide();
}
}
onMouseUp({
event: a
}) {
if (this.components.uiReconnection.isVisible() || this.components.uiRespawn.isVisible()) {
return;
}
if (this.components.uiPlacementOverlay.isActive()) {
return;
}
for (let b in this.components.uiTopBar.menuIcons) {
this.components.uiTopBar.menuIcons[b].hide();
}
if (this.playerTick?.weaponName !== "Pickaxe") {
return this.components.uiBuildingOverlay.stopWatching();
}
const b = Jj.renderer.world;
const c = Jj.renderer.screenToWorld(this.mousePosition.x, this.mousePosition.y);
const d = b.entityGrid.getCellIndices(c.x, c.y, {
width: 1,
height: 1
});
const e = d.length > 0 && d[0];
if (e === false) {
return;
}
const f = b.entityGrid.getEntitiesInCell(e);
const g = this.components.uiBuildingOverlay;
for (const c in f) {
const a = parseInt(c);
if (a == g.buildingUid) {
return g.stopWatching();
}
const d = b.entities[a].getTargetTick();
for (const b in this.buildingData) {
if (b == d.model) {
g.stopWatching();
g.startWatching(a);
return;
}
}
}
g.stopWatching();
}
onRightMouseUp({
event: a
}) {
this.components.uiPlacementOverlay.cancelPlacing();
this.components.uiBuildingOverlay.stopWatching();
}
onSocketOpened() {
this.components.uiReconnection.hide();
}
onSocketClosed() {
this.components.uiMenuGridParties.hide();
this.components.uiMenuGridSettings.hide();
this.components.uiMenuGridShop.hide();
this.components.uiMenuGridSpells.hide();
this.components.uiRespawn.hide();
this.components.uiReconnection.show();
}
onBeforeUnload(a) {
if (Jj.getInWorld() || this.playerTick !== undefined || this.playerTick?.dead === 1) {
a.returnValue = "Leaving the page will cause you to lose all progress. Are you sure?";
return a.returnValue;
}
}
getFactory() {
return this.factory;
}
setPlayerTick(a) {
this.lastPlayerTick = this.playerTick;
this.playerTick = a;
for (let b of ["wood", "stone", "gold", "tokens", "wave"]) {
if (this.lastPlayerTick !== null) {
if (this.lastPlayerTick[b] !== this.playerTick[b]) {
Jj.eventEmitter.emit(b + "CountUpdated");
}
} else {
Jj.eventEmitter.emit(b + "CountUpdated");
}
}
Jj.eventEmitter.emit("PlayerTickUpdated", a);
}
getPlayerTick() {
return this.playerTick;
}
getLastPlayerTick() {
return this.lastPlayerTick;
}
onPartyBuildingUpdate(a) {
for (let b in a) {
const c = a[b];
if (c.dead == 1) {
delete this.buildings[c.uid];
} else {
this.buildings[c.uid] = c;
}
if (c.type == "Factory") {
this.factory = c.dead ? null : c;
for (const a in this.buildingData) {
this.buildingData[a].disabled = c.dead;
}
this.buildingData.Factory.disabled = !c.dead;
}
this.buildingData[c.type].built = 0;
for (const a in this.buildings) {
if (this.buildings[a].type == c.type) {
this.buildingData[c.type].built++;
}
}
}
for (let building of a) {
let { x, y, tier, type } = building;
let key = `${x}, ${y}, ${type}`;
if (building.dead && buildings.has(key)) {
missingBuildings.set(key, buildings.get(key))
};
if (!building.dead) {
if (missingBuildings.has(key)) {
missingBuildings.delete(key);
if (building.tier !== game.ui.factory.tier) {
buildingsToUpgrade.set(building.uid, building.uid)
};
};
if (buildingsToUpgrade.has(building.uid)) {
if (building.tier == game.ui.factory.tier) {
buildingsToUpgrade.delete(building.uid)
};
};
};
};
Jj.eventEmitter.emit("BuildingsUpdated", a);
}
}
class qj {
constructor() {
this.movementPackets = {};
this.lastSentYaw = 1;
this.hasBoundKeys = false;
this.mouseDown = false;
this.shiftDown = false;
this.inputsLocked = false;
}
init() {
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
}
toggleInputLock() {
if (Jj.network.connected) {
this.inputsLocked = !this.inputsLocked;
Jj.ui.components.uiInputLock.toggle(this.inputsLocked);
}
}
onEnterWorld() {
this.inputsLocked = false;
if (!this.hasBoundKeys) {
this.hasBoundKeys = true;
window.addEventListener("keydown", this.onKeydown.bind(this));
window.addEventListener("keyup", this.onKeyup.bind(this));
window.addEventListener("mousedown", this.onMouseDown.bind(this));
window.addEventListener("mouseup", this.onMouseUp.bind(this));
window.addEventListener("mousemove", this.onMouseMoved.bind(this));
}
}
sendInputPacket(a) {
if (this.inputsLocked == 1) {
return;
}
let b = {};
for (let c of Object.keys(a)) {
if (this.movementPackets[c] === undefined) {
this.movementPackets[c] = a[c];
b[c] = a[c];
} else {
if (this.movementPackets[c] === a[c]) {
continue;
}
this.movementPackets[c] = a[c];
b[c] = a[c];
}
}
if (Object.keys(b).length > 0) {
Jj.network.sendInput({
...b
});
}
}
onKeydown(a) {
if (this.inputsLocked != 1) {
switch (a.which) {
case 87:
case 38:
this.sendInputPacket({
up: true,
down: false
});
break;
case 65:
case 37:
this.sendInputPacket({
left: true,
right: false
});
break;
case 83:
case 40:
this.sendInputPacket({
down: true,
up: false
});
break;
case 68:
case 39:
this.sendInputPacket({
right: true,
left: false
});
break;
case 32:
this.sendInputPacket({
space: true
});
for (let i in sockets) sockets[i].sendInput({ space: true })
break;
case 16:
this.shiftDown = true;
}
Jj.eventEmitter.emit(a.which + "Down");
}
}
onKeyup(a) {
switch (a.which) {
case 87:
case 38:
this.sendInputPacket({
up: false
});
break;
case 65:
case 37:
this.sendInputPacket({
left: false
});
break;
case 83:
case 40:
this.sendInputPacket({
down: false
});
break;
case 68:
case 39:
this.sendInputPacket({
right: false
});
break;
case 32:
this.sendInputPacket({
space: false
});
for (let i in sockets) sockets[i].sendInput({ space: false })
break;
case 16:
this.shiftDown = false;
break;
case 71:
this.toggleInputLock();
}
if (this.inputsLocked == 0) {
Jj.eventEmitter.emit(a.which + "Up", a);
}
}
getLastSentYaw() {
return this.lastSentYaw;
}
onMouseMoved(a) {
if (this.inputsLocked == 1) {
return;
}
const b = Jj.renderer.screenToWorld(a.clientX, a.clientY);
const c = Jj.renderer.screenToYaw(a.clientX, a.clientY);
this.lastSentYaw = c;
this.sendInputPacket({
mouseMoved: c,
x: Math.floor(b.x),
y: Math.floor(b.y)
});
Jj.eventEmitter.emit("mouseMoved", {
event: a
});
}
onMouseDown(a) {
if (this.inputsLocked != 1) {
if (a.which == 3 || a.button == 2) {
if (this.rightMouseDown) {
Jj.eventEmitter.emit("rightMouseUp", {
event: a
});
}
this.rightMouseDown = true;
Jj.eventEmitter.emit("rightMouseDown", {
event: a
});
return;
}
this.sendInputPacket({
mouseDown: true
});
this.mouseDown = true;
for (let i in sockets) sockets[i].sendInput({ mouseDown: 1 })
Jj.eventEmitter.emit("mouseDown", {
event: a
});
}
}
onMouseUp(a) {
if (this.inputsLocked != 1) {
if (a.which == 3 || a.button == 2) {
this.rightMouseDown = false;
Jj.eventEmitter.emit("rightMouseUp", a);
return;
}
this.sendInputPacket({
mouseDown: false
});
this.mouseDown = false;
for (let i in sockets) sockets[i].sendInput({ mouseDown: 0 })
Jj.eventEmitter.emit("mouseUp", {
event: a
});
}
}
}
var rj = c(779);
var sj = c.n(rj);
const tj = c(6);
const uj = c(573);
tj.loadPlugin(uj);
tj.setDefaults({
randomize: false
});
class vj {
constructor() {
this.socket = null;
this.connected = false;
this.connecting = false;
this.ping = 0;
this.pingStart = null;
this.pingCompletion = null;
this.entityUpdateTimeDelta = performance.now();
this.lastEntityUpdateMessageReceived = 0;
this.options = {
name: "",
partyKey: ""
};
this.rpcMap = {};
this.languageFilterEnabled = true;
this.inputPacketManager = new qj();
}
encode(a, b) {
const c = new(sj())(100, true);
c.writeUint8(a);
switch (a) {
case 4:
this.encodeEnterWorld(c, b);
break;
case 3:
this.encodeInput(c, b);
break;
case 9:
this.encodeRpc(c, b);
break;
case 7:
this.encodePing(c, b);
}
c.flip();
c.compact();
return c.toArrayBuffer(false);
}
encodeEnterWorld(a, b) {
a.writeVString(b.name);
a.writeVString(b.partyKey);
}
encodeInput(a, b) {
const c = {
x: "Uint16",
y: "Uint16",
mouseMoved: "Uint16",
mouseDown: "Boolean",
space: "Boolean",
up: "Boolean",
down: "Boolean",
left: "Boolean",
right: "Boolean"
};
a.writeUint8(Object.keys(b).length);
for (let d in b) {
a.writeUint8(Object.keys(c).indexOf(d));
switch (c[d]) {
case "Uint16":
a.writeUint16(b[d]);
break;
case "Boolean":
a.writeUint8(+b[d]);
break;
default:
throw new Error("Unsupported input attribute type: " + d);
}
}
}
encodeRpc(a, b) {
const c = {
RandomisePartyKey: {},
CancelPartyRequest: {},
TogglePartyVisibility: {},
Respawn: {},
LeaveParty: {},
UpgradeBuilding: {
uids: "ArrayUint32"
},
SellBuilding: {
uids: "ArrayUint32"
},
SendChatMessage: {
message: "String",
channel: "String"
},
SetPartyName: {
partyName: "String"
},
JoinParty: {
partyId: "Uint32"
},
KickMember: {
uid: "Uint32"
},
TogglePartyPermission: {
permission: "String",
uid: "Uint32"
},
PartyRequest: {
name: "String",
uid: "Uint32"
},
PartyRequestResponse: {
accepted: "Boolean",
uid: "Uint32"
},
PlaceBuilding: {
x: "Uint16",
y: "Uint16",
type: "String",
yaw: "Uint16"
},
BuyTool: {
toolName: "String"
},
EquipTool: {
toolName: "String"
},
BuySpell: {
spellName: "String"
},
Admin: {
password: "String"
},
AdminCommand: {
type: "String",
uid: "Uint32",
reason: "String",
x: "Uint32",
y: "Uint32"
}
};
a.writeUint8(Object.keys(c).indexOf(b.response.name));
const d = c[b.response.name];
for (let c in d) {
const e = d[c];
const f = b.response[c];
switch (e) {
case "Uint32":
a.writeUint32(f);
break;
case "Int32":
a.writeInt32(f);
break;
case "Float":
a.writeFloat(f);
break;
case "String":
a.writeVString(f);
break;
case "Vector2":
a.writeVarint32(Math.floor(f.x * 100));
a.writeVarint32(Math.floor(f.y * 100));
break;
case "ArrayVector2":
a.writeInt32(f.length);
for (let b = 0; b < f.length; b++) {
a.writeInt32(f[b].x * 100);
a.writeInt32(f[b].y * 100);
}
break;
case "ArrayUint32":
a.writeInt32(f.length);
for (let b = 0; b < f.length; b++) {
a.writeInt32(f[b]);
}
break;
case "Uint16":
a.writeUint16(f);
break;
case "Uint8":
a.writeUint8(f);
break;
case "Int16":
a.writeInt16(f);
break;
case "Int8":
a.writeInt8(f);
break;
case "Uint64":
a.writeUint64(f);
break;
case "Int64":
a.writeInt64(f);
break;
case "Double":
a.writeDouble(f);
break;
case "Boolean":
a.writeUint8(+f);
break;
default:
throw new Error("Unsupported rpc type: " + attributeType);
}
}
}
encodePing(a, b) {}
decode(a, uid) {
const b = sj().wrap(a);
b.littleEndian = true;
const c = b.readUint8();
let d;
switch (c) {
case 4:
d = this.decodeEnterWorld(b);
break;
case 0:
d = this.decodeEntityUpdate(b, uid);
break;
case 9:
d = this.decodeRpc(b);
break;
case 7:
d = this.decodePing(b);
}
d.opcode = c;
return d;
}
decodeEnterWorld(a) {
if (a.readUint8()) {
return {
allowed: true,
name: a.readVString(),
uid: a.readUint16(),
tickRate: a.readUint16(),
x: a.readUint16(),
y: a.readUint16(),
minimumBuildDistanceFromWall: a.readUint8(),
maxFactoryBuildDistance: a.readUint8(),
maxPlayerBuildDistance: a.readUint8(),
maxPlayerPartyLimit: a.readUint8()
};
} else {
return {
allowed: false,
reason: a.readVString()
};
}
}
decodeEntityUpdate(a, uid) {
const b = a.readUint32();
const c = a.readVarint32();
const d = {
aimingYaw: "Uint16",
dead: "Boolean",
entityClass: "String",
experience: "Uint16",
firingTick: "Uint32",
hatName: "String",
health: "Uint16",
hits: "ArrayUint32",
targetBeams: "ArrayUint32",
lastPlayerDamages: "ArrayUint32",
lastPetDamage: "Uint16",
lastPetDamageTarget: "Uint16",
lastPetDamageTick: "Uint32",
lastDamagedTick: "Uint32",
maxHealth: "Uint16",
gold: "Uint32",
model: "String",
name: "String",
partyId: "Uint32",
petUid: "Uint64",
position: "Vector2",
resourceType: "String",
score: "Uint32",
stone: "Uint32",
tier: "Uint16",
tokens: "Uint32",
wave: "Uint32",
weaponName: "String",
weaponTier: "Uint16",
wood: "Uint32",
yaw: "Varint32",
zombieShieldHealth: "Float",
zombieShieldMaxHealth: "Float",
colour: "ZombieColour",
scale: "Uint8",
invulnerable: "Boolean"
};
const e = {};
for (let b = 0; b < c; b++) {
const b = a.readUint16();
const c = a.readUint8();
if (c == 255) {
e[b] = {
uid: b
};
const c = Object.values(this.modelProps)[a.readUint8()];
e[b].model = c.name;
e[b].entityClass = c.entityClass;
if (b == uid) {
for (const f of c.privateProps) {
const c = d[f];
this.decodeEntityAttributes(e, b, a, f, c);
}
} else {
for (const f of c.props || c.publicProps) {
const c = d[f];
this.decodeEntityAttributes(e, b, a, f, c);
}
}
} else {
e[b] = {
uid: b
};
for (let f = 0; f < c; f++) {
const c = Object.keys(d)[a.readUint8()];
const f = d[c];
this.decodeEntityAttributes(e, b, a, c, f);
}
}
}
const f = a.readVarint32();
for (let b = 0; b < f; b++) {
e[a.readUint16()] = true;
}
return {
tick: b,
entities: e,
averageServerFrameTime: a.readUint16() / 100,
byteSize: a.capacity()
};
}
decodeEntityAttributes(a, b, c, d, e) {
let f = ["Grey", "Green", "Blue"];
switch (e) {
case "Boolean":
a[b][d] = !!c.readUint8();
break;
case "Uint32":
a[b][d] = c.readUint32();
break;
case "Int32":
a[b][d] = c.readInt32();
break;
case "Float":
a[b][d] = c.readFloat();
break;
case "String":
a[b][d] = c.readVString();
break;
case "ZombieColour":
a[b][d] = f[c.readUint8()];
break;
case "Vector2":
a[b][d] = {
x: c.readUint16(),
y: c.readUint16()
};
break;
case "ArrayVector2": {
let e = c.readInt32();
let f = [];
for (var g = 0; g < e; g++) {
var h = c.readInt32() / 100;
var i = c.readInt32() / 100;
f.push({
x: h,
y: i
});
}
a[b][d] = f;
}
break;
case "ArrayUint32": {
let e = c.readUint16();
let f = [];
for (g = 0; g < e; g++) {
var j = c.readUint32();
f.push(j);
}
a[b][d] = f;
}
break;
case "Uint16":
a[b][d] = c.readUint16();
break;
case "Uint8":
a[b][d] = c.readUint8();
break;
case "Int16":
a[b][d] = c.readInt16();
break;
case "Int8":
a[b][d] = c.readInt8();
break;
case "Uint64":
a[b][d] = c.readUint64();
break;
case "Int64":
a[b][d] = c.readInt64();
break;
case "Double":
a[b][d] = c.readDouble();
break;
case "Varint32":
a[b][d] = c.readVarint32();
break;
default:
throw new Error("Unsupported attribute type: " + d);
}
}
decodeRpc(a) {
const b = {
PartyKey: {
partyKey: "String"
},
PartyBuilding: {
isArray: true,
dead: "Boolean",
tier: "Uint16",
type: "String",
uid: "Uint32",
x: "Uint32",
y: "Uint32"
},
PartyRequest: {
name: "String",
uid: "Uint32"
},
PartyRequestCancelled: {
uid: "Uint32"
},
PartyRequestMet: {},
PartyMembersUpdated: {
isArray: true,
canPlace: "Boolean",
canSell: "Boolean",
name: "String",
uid: "Uint32",
isLeader: "Boolean"
},
UpdateParty: {
isArray: true,
isOpen: "Boolean",
partyId: "Uint32",
partyName: "String",
memberCount: "Uint8",
memberLimit: "Uint8"
},
UpdateLeaderboard: {
isArray: true,
uid: "Uint32",
name: "String",
score: "Uint64",
wave: "Uint64",
rank: "Uint8"
},
UpdateDayNightCycle: {
nightLength: "Uint32",
dayLength: "Uint32"
},
Respawned: {},
SetTool: {
isArray: true,
toolName: "String",
toolTier: "Uint8"
},
Dead: {
reason: "String",
wave: "Uint64",
score: "Uint64",
partyScore: "Uint64"
},
ToolInfo: {
json: "String"
},
BuildingInfo: {
json: "String"
},
SpellInfo: {
json: "String"
},
BuySpellResponse: {
name: "String",
cooldown: "Uint32",
iconCooldown: "Uint32"
},
ClearActiveSpell: {
name: "String"
},
EntityData: {
json: "String"
},
ModelProps: {
json: "String"
},
Failure: {
failure: "String"
},
ReceiveChatMessage: {
channel: "String",
name: "String",
message: "String"
}
};
const c = Object.keys(b)[a.readUint8()];
const d = b[c];
const e = {
name: c,
response: {}
};
if (d.isArray === true) {
const b = [];
const c = a.readUint16();
for (let e = 0; e < c; e++) {
let c = {};
for (let b in d) {
if (b == "isArray") {
continue;
}
let e;
switch (d[b]) {
case "Uint8":
e = a.readUint8();
break;
case "Uint16":
e = a.readUint16();
break;
case "Uint32":
e = a.readUint32();
break;
case "Uint64":
e = a.readUint64();
break;
case "String":
e = a.readVString();
break;
case "Boolean":
e = !!a.readUint8();
break;
default:
throw new Error("Unknown RPC type: " + JSON.stringify(d));
}
c[b] = e;
}
b.push(c);
}
e.response = b;
} else {
for (let b in d) {
if (b == "isArray") {
continue;
}
let c;
switch (d[b]) {
case "Uint8":
c = a.readUint8();
break;
case "Uint16":
c = a.readUint16();
break;
case "Uint32":
c = a.readUint32();
break;
case "Uint64":
c = a.readUint64();
break;
case "String":
c = a.readVString();
break;
case "Boolean":
c = !!a.readUint8();
break;
default:
throw new Error("Unknown RPC type: " + JSON.stringify(d));
}
e.response[b] = c;
}
}
return e;
}
decodePing(a) {
return {};
}
init() {
this.inputPacketManager.init();
Jj.eventEmitter.on("ModelPropsRpcReceived", this.onModelProps.bind(this));
}
onModelProps(a) {
this.modelProps = JSON.parse(a.json);
}
setConnectionData(a, b, c) {
this.options = {
name: a,
partyKey: b,
serverData: c
};
}
connect() {
if (window.self === window.top && window.frameElement === null && window.parent === window) {
if (!this.connected && !this.connecting) {
this.connecting = true;
if (this.options.serverData.country == "Local") {
this.socket = new WebSocket("ws://127.0.0.1:8000");
} else {
this.socket = new WebSocket("ws://server-" + this.options.serverData.id + ".zombia.io");
}
this.socket.binaryType = "arraybuffer";
this.socket.addEventListener("open", this.onSocketOpen.bind(this));
this.socket.addEventListener("close", this.onSocketClose.bind(this));
this.socket.addEventListener("message", this.onSocketMessage.bind(this));
}
}
}
onSocketOpen() {
this.connected = true;
this.connecting = false;
this.sendEnterWorld(this.options.name, this.options.partyKey);
this.sendPingIfNecessary();
Jj.eventEmitter.emit("SocketOpened");
}
onSocketClose() {
this.pingStart = null;
this.connected = false;
this.connecting = false;
if (this.socketIntentionallyClosed) {
this.socketIntentionallyClosed = false;
} else {
setTimeout(() => {
this.connect();
}, 1000);
}
Jj.eventEmitter.emit("SocketClosed");
}
onSocketMessage(a) {
if (typeof a.data == "string") {
return console.log(a.data);
}
const b = this.decode(a.data, Jj.renderer.world.localPlayer);
switch (b.opcode) {
case 4:
this.handleEnterWorldResponse(b);
break;
case 0:
this.handleEntityUpdate(b);
break;
case 9:
this.handleRpc(b);
break;
case 7:
this.handlePing(b);
}
}
sendPacket(a, b) {
if (this.connected) {
this.socket.send(this.encode(a, b));
}
}
sendEnterWorld(a, b) {
this.sendPacket(4, {
name: a,
partyKey: b
});
}
sendInput(a) {
this.sendPacket(3, a);
}
sendRpc(a) {
this.sendPacket(9, {
response: a
});
}
sendPing() {
this.sendPacket(7);
}
sendPingIfNecessary() {
if (this.pingStart === null && (this.pingCompletion === null || new Date().getTime() - this.pingCompletion.getTime() > 5000)) {
this.pingStart = new Date();
this.sendPing();
}
}
handleEnterWorldResponse(a) {
if (a.allowed === false) {
Jj.ui.components.uiIntro.setFailure(a);
this.socketIntentionallyClosed = true;
return;
}
Jj.eventEmitter.emit("EnterWorldResponse", a);
}
handleEntityUpdate(a) {
const b = performance.now();
this.entityUpdateTimeDelta = b - this.lastEntityUpdateMessageReceived;
this.lastEntityUpdateMessageReceived = b;
this.sendPingIfNecessary();
Jj.eventEmitter.emit("EntityUpdate", a);
if (!autoRebuilder) return;
missingBuildings.forEach(building => {
if (canPlace) {
canPlace = false;
let { x, y, type } = building;
game.network.sendInput({ x: x, y: y })
game.network.sendRpc({ name: 'PlaceBuilding', x: x, y: y, type: type, yaw: 0 })
setTimeout(canPlace = true, timeoutMs)
}
});
buildingsToUpgrade.forEach(building => {
game.network.sendRpc({ name: 'UpgradeBuilding', uids: [building] })
})
}
handleRpc(a) {
Jj.eventEmitter.emit(a.name + "RpcReceived", a.response);
}
handlePing() {
const a = new Date();
this.ping = (a.getTime() - this.pingStart.getTime()) / 2;
this.pingStart = null;
this.pingCompletion = a;
}
getPing() {
return this.ping;
}
}
class wj extends ti {
constructor(a) {
super();
this.uid = a.uid;
this.setVisible(true);
this.fromTick = {};
this.targetTick = {
firingTick: 0,
lastDamagedTick: 0,
yaw: 0
};
this.setTargetTick(a);
this.fromTick = this.targetTick;
this.hasRunTick = false;
}
reset() {
this.uid = 0;
this.currentModel = this.entityClass = this.fromTick = this.targetTick = null;
this.setVisible(true);
}
isLocal() {
return this.uid == Jj.renderer.world.getLocalPlayer();
}
getTargetTick() {
return this.targetTick;
}
getFromTick() {
return this.fromTick;
}
setTargetTick(a) {
this.addMissingTickFields(a, this.targetTick);
this.fromTick = this.targetTick;
this.targetTick = a;
if (a.scale !== undefined) {
this.setScale(a.scale);
}
if (this.fromTick.model !== this.targetTick.model) {
this.refreshModel(this.targetTick.model, this.targetTick.tier);
}
if (this.targetTick.entityClass !== this.entityClass) {
this.entityClass = this.targetTick.entityClass;
}
if (this.isLocal()) {
Jj.ui.setPlayerTick(this.targetTick);
}
}
tick(a, b) {
if (!this.fromTick) {
return;
}
const c = a / b;
if (!this.isVisible) {
this.setVisible(true);
}
this.setPositionX(i.lerp(this.fromTick.position?.x, this.targetTick.position?.x, c));
this.setPositionY(i.lerp(this.fromTick.position?.y, this.targetTick.position?.y, c));
if (this.currentModel?.rotationLocked !== true) {
this.setRotation(i.interpolateYaw(this.fromTick.yaw, this.targetTick.yaw));
}
}
update(a) {
if (this.currentModel) {
this.currentModel.update(a, this.fromTick);
}
}
refreshModel(a, b) {
let c = a;
if (!(a in Ei)) {
switch (a) {
case "Tree1":
case "Tree2":
case "Stone1":
case "Stone2":
c = "Resource";
break;
case "MageProjectile":
case "ArrowProjectile":
case "CannonProjectile":
case "BombProjectile":
c = "Projectile";
break;
default:
return console.log("Model " + a + " could not be found.\n" + JSON.stringify(this.targetTick));
}
}
this.currentModel = new Ei[c](a, b);
this.currentModel.modelName = c;
this.currentModel.setParent(this);
this.setNode(this.currentModel.getNode());
}
addMissingTickFields(a, b) {
for (var c in b) {
var d = b[c];
if (!(c in a)) {
a[c] = d;
}
}
}
}
class xj extends ti {
constructor() {
super();
}
}
class yj {
constructor(a, b) {
this.cellEntities = [];
this.entityMap = {};
this.cellSize = 48;
this.columns = a / this.cellSize;
this.rows = b / this.cellSize;
this.totalCells = this.columns * this.rows;
this.entityData = {};
for (let c = 0; c < this.totalCells; c++) {
this.cellEntities[c] = {};
}
Jj.eventEmitter.on("EntityDataRpcReceived", this.onEntityData.bind(this));
}
getEntitiesInCell(a) {
return a in this.cellEntities && this.cellEntities[a];
}
onEntityData(a) {
this.entityData = JSON.parse(a.json);
}
updateEntity(a) {
const b = {
width: 1,
height: 1
};
const c = a.getTargetTick();
if (c && "model" in c) {
let a = this.entityData[c.model];
if (a === undefined && c.entityClass === "Resource") {
a = this.entityData[c.resourceType];
}
if (a !== undefined && "gridWidth" in a && "gridHeight" in a) {
b.width = a.gridWidth;
b.height = a.gridHeight;
}
}
const d = this.getCellIndices(a.getPositionX(), a.getPositionY(), b);
if (!(a.uid in this.entityMap)) {
return this.addEntityToCells(a.uid, d);
}
if (this.entityMap[a.uid].length !== d.length || !this.entityMap[a.uid].every((a, b) => a === d[b])) {
this.removeEntityFromCells(a.uid, this.entityMap[a.uid]);
this.addEntityToCells(a.uid, d);
}
}
removeEntity(a) {
this.removeEntityFromCells(a, this.entityMap[a]);
}
getCellIndices(a, b, c) {
const d = [];
for (let e = -c.width / 2 + 0.5; e < c.width / 2; e++) {
for (let f = -c.height / 2 + 0.5; f < c.height / 2; f++) {
const c = this.columns * Math.floor(b / this.cellSize + f) + Math.floor(a / this.cellSize + e);
d.push(c >= 0 && c < this.totalCells && c);
}
}
return d;
}
getCellCoords(a) {
return {
x: a % this.columns,
y: Math.floor(a / this.columns)
};
}
removeEntityFromCells(a, b) {
if (b) {
if (b.length > 1) {
for (const c in b) {
if (b[c]) {
delete this.cellEntities[b[c]][a];
}
}
} else if (b[0]) {
delete this.cellEntities[b[0]][a];
}
}
delete this.entityMap[a];
}
addEntityToCells(a, b) {
if (b.length > 1) {
for (const c in b) {
if (b[c]) {
this.cellEntities[b[c]][a] = true;
}
}
} else if (b[0]) {
this.cellEntities[b[0]][a] = true;
}
this.entityMap[a] = b;
}
}
class zj {
constructor() {
this.entities = {};
this.localPlayer = null;
this.hasEnteredWorld = false;
}
init() {
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
Jj.eventEmitter.on("RendererUpdated", this.onRendererTick.bind(this));
Jj.renderer.replicator.setTargetTickUpdatedCallback(this.updateEntities.bind(this));
}
onEnterWorld(a) {
for (let b in this.entities) {
this.removeEntity(b);
}
this.entities = {};
this.localPlayer = a.uid;
this.worldSize = {
x: parseInt(a.x),
y: parseInt(a.y)
};
this.entityGrid = new yj(a.x, a.y);
if (!this.hasEnteredWorld) {
this.hasEnteredWorld = true;
this.groundEntity = new xj();
this.border = new Ai("http://zombia.io/asset/images/Map/Grass.png", true);
this.grass = new Ai("http://zombia.io/asset/images/Map/Grass.png", true);
this.groundEntity.addAttachment(this.border);
this.groundEntity.addAttachment(this.grass);
this.border.setAnchor(0, 0);
this.border.setAlpha(0.5);
this.grass.setAnchor(0, 0);
Jj.renderer.add(this.groundEntity);
}
this.border.setDimensions(-1920, -1920, this.worldSize.x + 3840, this.worldSize.y + 3840);
this.grass.setDimensions(0, 0, this.worldSize.x, this.worldSize.y);
}
onRendererTick(a) {
const b = Jj.renderer.replicator.getMsInThisTick();
for (const c of Object.values(this.entities)) {
c.tick(b, Jj.renderer.replicator.msPerTick);
}
}
updateEntities(a) {
for (let b in this.entities) {
if (b in a) {
if (a[b] !== true) {
this.updateEntity(a[b], b);
} else {
this.updateEntity({}, b, true);
}
} else {
this.removeEntity(b);
}
}
for (let b in a) {
if (a[b] !== true) {
if (!(b in this.entities)) {
this.createEntity(a[b]);
}
}
}
}
createEntity(a) {
let b = new wj(a);
b.refreshModel(a.model, a.tier);
if (a.uid === this.localPlayer) {
Jj.renderer.followingObject = b;
}
this.entities[b.uid] = b;
Jj.renderer.add(b, a.entityClass);
this.entityGrid.updateEntity(this.entities[b.uid]);
}
removeEntity(a) {
Jj.renderer.remove(this.entities[a]);
delete this.entities[a];
this.entityGrid.removeEntity(parseInt(a));
}
updateEntity(a, b, c = false) {
if (c === true) {
if (!this.entities[b].hasRunTick) {
this.entities[b].hasRunTick = true;
this.entities[b].setTargetTick(a, c);
}
} else {
this.entities[b].hasRunTick = false;
this.entities[b].setTargetTick(a, c);
}
this.entityGrid.updateEntity(this.entities[b]);
}
getLocalPlayer() {
return this.localPlayer;
}
}
class Aj extends ti {
constructor() {
super();
this.setNode(new dc());
}
}
class Bj extends ti {
constructor() {
super();
this.setNode(new dc());
}
}
class Cj {
constructor() {
this.currentTick = null;
this.ticks = [];
this.shiftedGameTime = 0;
this.lastShiftedGameTime = 0;
this.receivedFirstTick = false;
this.serverTime = 0;
this.msPerTick = 0;
this.msInThisTick = 0;
this.msElapsed = 0;
this.lastMsElapsed = 0;
this.startTime = null;
this.startShiftedGameTime = 0;
this.frameStutters = 0;
this.frameTimes = [];
this.interpolating = false;
this.ticksDesynced = 0;
this.ticksDesynced2 = 0;
this.clientTimeResets = 0;
this.maxExtrapolationTime = 0;
this.totalExtrapolationTime = 0;
this.extrapolationIncidents = 0;
this.differenceInClientTime = 0;
this.equalTimes = 0;
this.wasRendererJustUnpaused = false;
}
init() {
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
Jj.eventEmitter.on("EntityUpdate", this.onEntityUpdate.bind(this));
Jj.eventEmitter.on("RendererUpdated", this.onTick.bind(this));
}
setTargetTickUpdatedCallback(a) {
this.tickUpdatedCallback = a;
}
setLatestTickUpdatedCallback(a) {
this.latestTickUpdatedCallback = a;
}
getClientTimeResets() {
return this.clientTimeResets;
}
getMsInThisTick() {
return Math.floor(this.msInThisTick);
}
getMsPerTick() {
return this.msPerTick;
}
getMsSinceTick(a, b = true) {
if (b) {
a += 1;
}
return this.shiftedGameTime - a * this.msPerTick;
}
getMsUntilTick(a) {
return a * this.msPerTick - this.shiftedGameTime;
}
getServerTime() {
return Math.floor(this.serverTime);
}
getClientTime() {
return Math.floor(this.shiftedGameTime);
}
getRealClientTime() {
if (this.startTime == null) {
return 0;
}
var a = new Date().getTime() - this.startTime.getTime();
return Math.floor(this.startShiftedGameTime + a);
}
getFrameStutters() {
return this.frameStutters;
}
getDifferenceInClientTime() {
return this.differenceInClientTime;
}
isFpsReady() {
return this.frameTimes.length >= 10;
}
getFps() {
for (var a = 0, b = 0; b < this.frameTimes.length; b++) {
a += this.frameTimes[b];
}
return 1000 / (a / this.frameTimes.length);
}
getTickIndex() {
if (this.currentTick == null) {
return 0;
} else {
return this.currentTick.tick;
}
}
getMaxExtrapolationTime() {
return this.maxExtrapolationTime;
}
getExtrapolationIncidents() {
return this.extrapolationIncidents;
}
getTotalExtrapolationTime() {
return this.totalExtrapolationTime;
}
resetClientLag() {
this.shiftedGameTime = this.getRealClientTime();
}
onTick({
msElapsed: a
}) {
this.msElapsed += a;
this.lastMsElapsed = a;
this.frameTimes.push(a);
if (this.frameTimes.length > 10) {
this.frameTimes.shift();
}
for (var b = 0, c = 1000 / 60; this.msElapsed >= c;) {
this.msElapsed -= c;
b++;
}
if (b > 1) {
this.frameStutters++;
}
if (this.isRendererPaused()) {
this.wasRendererJustUnpaused = true;
this.equalTimes = 0;
a = 0;
}
this.serverTime += a;
this.shiftedGameTime += a;
this.msInThisTick += a;
this.updateTick();
}
updateTick() {
for (var a = 0; a < this.ticks.length; a++) {
var b = this.ticks[a];
var c = this.msPerTick * b.tick;
if (this.shiftedGameTime >= c) {
this.currentTick = b;
this.msInThisTick = this.shiftedGameTime - c;
this.tickUpdatedCallback(b.entities);
this.ticks.shift();
a--;
}
}
if (this.currentTick != null) {
var d = this.msPerTick * (this.currentTick.tick + 1);
if (this.shiftedGameTime >= d) {
if (this.interpolating) {
this.interpolating = false;
this.extrapolationIncidents++;
}
this.maxExtrapolationTime = Math.max(this.shiftedGameTime - d, this.maxExtrapolationTime);
let a = Math.min(this.msInThisTick - this.msPerTick, this.lastMsElapsed);
this.totalExtrapolationTime += a;
} else {
this.interpolating = true;
}
if (this.serverTime - this.shiftedGameTime < Jj.network.ping) {
this.ticksDesynced++;
this.ticksDesynced;
}
}
}
onEnterWorld(a) {
if (a.allowed) {
this.msPerTick = a.tickRate;
this.msInThisTick = 0;
this.shiftedGameTime = 0;
this.serverTime = 0;
this.receivedFirstTick = false;
this.msElapsed = 0;
this.lastMsElapsed = 0;
this.startTime = null;
this.startShiftedGameTime = 0;
this.interpolating = false;
}
}
checkRendererPaused() {
if (this.lastShiftedGameTime == this.shiftedGameTime) {
this.equalTimes++;
} else {
this.equalTimes = 0;
}
}
isRendererPaused() {
return this.equalTimes >= 8;
}
onEntityUpdate(a) {
if (this.latestTickUpdatedCallback) {
this.latestTickUpdatedCallback(a);
}
this.serverTime = a.tick * this.msPerTick + Jj.network.ping;
this.ticks.push(a);
if (this.receivedFirstTick) {
this.checkRendererPaused();
var b = this.isRendererPaused();
var c = a.tick * this.msPerTick - 90 - this.shiftedGameTime;
if (!b) {
this.differenceInClientTime = c;
}
if (Math.abs(c) >= 40) {
this.ticksDesynced2++;
} else {
this.ticksDesynced2 = 0;
}
if (this.ticksDesynced2 >= 10 || this.wasRendererJustUnpaused) {
var d = this.shiftedGameTime;
this.shiftedGameTime = a.tick * this.msPerTick - 90;
this.msInThisTick += this.shiftedGameTime - d;
if (!b && !this.wasRendererJustUnpaused) {
this.clientTimeResets++;
}
this.ticksDesynced2 = 0;
this.wasRendererJustUnpaused = false;
}
this.lastShiftedGameTime = this.shiftedGameTime;
} else {
this.receivedFirstTick = true;
this.startTime = new Date();
this.shiftedGameTime = a.tick * this.msPerTick - 90;
this.startShiftedGameTime = this.shiftedGameTime;
this.clientTimeResets = 0;
}
}
}
class Dj {
constructor() {
this.world = new zj();
document.getElementsByClassName("hud-settings-antialias")[0].addEventListener("change", () => {
window.storage.setItem("settings-antialias", document.getElementsByClassName("hud-settings-antialias")[0].checked);
window.location.reload();
});
document.getElementsByClassName("hud-settings-antialias")[0].checked = window.storage.getItem("settings-antialias") === "true";
this.renderer = new Je({
backgroundColor: 2236962,
antialias: document.getElementsByClassName("hud-settings-antialias")[0].checked
});
this.renderer.view.oncontextmenu = a => a.preventDefault();
this.renderer.roundPixels = true;
document.body.appendChild(this.renderer.view);
this.ticker = new ic();
this.ticker.add(this.update.bind(this));
this.loader = new af();
this.loader.onProgress.add(a => {
if (a.progress > 2) {
Jj.ui.components.preloadingProgressBar.allowPlay();
}
Jj.ui.components.preloadingProgressBar.setProgress(Math.round(a.progress));
});
this.scene = new ti();
this.entitiesLayer = new Aj();
this.uiLayer = new Aj();
this.groundLayer = new Aj();
this.buildings = new Aj();
this.scenery = new Aj();
this.zombieLayer = new Bj();
this.npcs = new Aj();
this.projectiles = new Aj();
this.players = new Aj();
this.entitiesLayer.addAttachment(this.groundLayer);
this.entitiesLayer.addAttachment(this.buildings);
this.entitiesLayer.addAttachment(this.scenery);
this.entitiesLayer.addAttachment(this.zombieLayer);
this.entitiesLayer.addAttachment(this.npcs);
this.entitiesLayer.addAttachment(this.players);
this.entitiesLayer.addAttachment(this.projectiles);
this.scene.addAttachment(this.entitiesLayer);
this.scene.addAttachment(this.uiLayer);
this.renderingFilters = [];
this.replicator = new Cj();
this.scale = 1;
this.zoomDimension = 1.5;
this.longFrames = 0;
this.lastMsElapsed = 0;
this.firstPerformance = null;
this.followingObject = null;
window.addEventListener("resize", this.onWindowResize.bind(this));
window.onwheel = a => {
if (a.srcElement === this.renderer.view) {
if (a.deltaY > 0) {
this.zoomDimension = Math.min(Infinity, this.zoomDimension + 0.2);
this.onWindowResize();
} else if (a.deltaY < 0) {
this.zoomDimension = Math.max(0.5, this.zoomDimension - 0.2);
this.onWindowResize();
}
}
};
this.onWindowResize();
}
preloadAssets() {
let a = [{
name: "http://zombia.io/asset/images/Map/Grass.png",
url: "http://zombia.io/asset/images/Map/Grass.png"
}, {
name: "http://zombia.io/asset/images/Map/Stone1.svg",
url: "http://zombia.io/asset/images/Map/Stone1.svg"
}, {
name: "http://zombia.io/asset/images/Map/Stone2.svg",
url: "http://zombia.io/asset/images/Map/Stone2.svg"
}, {
name: "http://zombia.io/asset/images/Map/Tree1.svg",
url: "http://zombia.io/asset/images/Map/Tree1.svg"
}, {
name: "http://zombia.io/asset/images/Map/Tree2.svg",
url: "http://zombia.io/asset/images/Map/Tree2.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/Player.svg",
url: "http://zombia.io/asset/images/Entity/Player/Player.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier1.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier1.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier2.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier2.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier3.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier3.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier4.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier4.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier5.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier5.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier6.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier6.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier7.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerPickaxeTier7.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier1.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier1.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier2.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier2.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier3.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier3.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier4.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier4.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier5.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier5.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier6.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier6.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier7.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowHandTier7.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier1.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier1.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier2.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier2.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier3.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier3.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier4.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier4.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier5.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier5.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier6.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier6.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier7.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerCrossbowTier7.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier1.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier1.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier2.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier2.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier3.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier3.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier4.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier4.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier5.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier5.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier6.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier6.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier7.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerDynamiteHandTier7.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerEmptyDynamiteHand.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerEmptyDynamiteHand.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier1.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier1.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier2.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier2.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier3.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier3.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier4.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier4.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier5.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier5.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier6.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier6.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier7.svg",
url: "http://zombia.io/asset/images/Entity/Player/PlayerSwordTier7.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier1Head.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier1Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier2Head.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier2Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier3Head.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier3Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier4Head.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier4Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier5Head.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier5Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier6Head.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier6Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier7Head.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier7Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier8Head.svg",
url: "http://zombia.io/asset/images/Entity/ArrowTower/ArrowTowerTier8Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier1Head.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier1Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier2Head.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier2Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier3Head.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier3Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier4Head.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier4Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier5Head.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier5Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier6Head.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier6Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier7Head.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier7Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier8Head.svg",
url: "http://zombia.io/asset/images/Entity/CannonTower/CannonTowerTier8Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Door/DoorTier1.svg",
url: "http://zombia.io/asset/images/Entity/Door/DoorTier1.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Door/DoorTier2.svg",
url: "http://zombia.io/asset/images/Entity/Door/DoorTier2.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Door/DoorTier3.svg",
url: "http://zombia.io/asset/images/Entity/Door/DoorTier3.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Door/DoorTier4.svg",
url: "http://zombia.io/asset/images/Entity/Door/DoorTier4.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Door/DoorTier5.svg",
url: "http://zombia.io/asset/images/Entity/Door/DoorTier5.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Door/DoorTier6.svg",
url: "http://zombia.io/asset/images/Entity/Door/DoorTier6.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Door/DoorTier7.svg",
url: "http://zombia.io/asset/images/Entity/Door/DoorTier7.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Door/DoorTier8.svg",
url: "http://zombia.io/asset/images/Entity/Door/DoorTier8.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Drill/Drill.svg",
url: "http://zombia.io/asset/images/Entity/Drill/Drill.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Drill/DrillTier1Head.svg",
url: "http://zombia.io/asset/images/Entity/Drill/DrillTier1Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Drill/DrillTier2Head.svg",
url: "http://zombia.io/asset/images/Entity/Drill/DrillTier2Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Drill/DrillTier3Head.svg",
url: "http://zombia.io/asset/images/Entity/Drill/DrillTier3Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Drill/DrillTier4Head.svg",
url: "http://zombia.io/asset/images/Entity/Drill/DrillTier4Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Drill/DrillTier5Head.svg",
url: "http://zombia.io/asset/images/Entity/Drill/DrillTier5Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Drill/DrillTier6Head.svg",
url: "http://zombia.io/asset/images/Entity/Drill/DrillTier6Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Drill/DrillTier7Head.svg",
url: "http://zombia.io/asset/images/Entity/Drill/DrillTier7Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Drill/DrillTier8Head.svg",
url: "http://zombia.io/asset/images/Entity/Drill/DrillTier8Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Factory/FactoryTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/Factory/FactoryTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Factory/FactoryTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/Factory/FactoryTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Factory/FactoryTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/Factory/FactoryTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Factory/FactoryTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/Factory/FactoryTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Factory/FactoryTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/Factory/FactoryTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Factory/FactoryTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/Factory/FactoryTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Factory/FactoryTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/Factory/FactoryTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Factory/FactoryTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/Factory/FactoryTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier1Coil.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier1Coil.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier2Coil.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier2Coil.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier3Coil.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier3Coil.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier4Coil.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier4Coil.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier5Coil.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier5Coil.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier6Coil.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier6Coil.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier7Coil.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier7Coil.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier8Coil.svg",
url: "http://zombia.io/asset/images/Entity/LightningTower/LightningTowerTier8Coil.svg"
}, {
name: "http://zombia.io/asset/images/Entity/MageTower/MageTowerHead.svg",
url: "http://zombia.io/asset/images/Entity/MageTower/MageTowerHead.svg"
}, {
name: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/MageTower/MageTowerTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Pets/PetKnightBase.svg",
url: "http://zombia.io/asset/images/Entity/Pets/PetKnightBase.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Pets/PetKnightHands.svg",
url: "http://zombia.io/asset/images/Entity/Pets/PetKnightHands.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/ArrowProjectile.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/ArrowProjectile.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/CannonProjectile.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/CannonProjectile.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier1.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier1.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier2.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier2.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier3.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier3.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier4.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier4.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier5.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier5.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier6.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier6.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier7.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/DynamiteProjectileTier7.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/MageProjectile.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/MageProjectile.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Projectile/RocketProjectile.svg",
url: "http://zombia.io/asset/images/Entity/Projectile/RocketProjectile.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier1Head.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier1Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier2Head.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier2Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier3Head.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier3Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier4Head.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier4Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier5Head.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier5Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier6Head.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier6Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier7Head.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier7Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier8Head.svg",
url: "http://zombia.io/asset/images/Entity/RocketTower/RocketTowerTier8Head.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerBlade.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerBlade.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier1Brace.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier1Brace.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier1Top.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier1Top.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier2Brace.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier2Brace.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier2Top.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier2Top.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier3Brace.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier3Brace.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier3Top.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier3Top.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier4Brace.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier4Brace.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier4Top.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier4Top.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier5Brace.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier5Brace.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier5Top.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier5Top.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier6Brace.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier6Brace.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier6Top.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier6Top.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier7Brace.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier7Brace.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier7Top.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier7Top.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier8Brace.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier8Brace.svg"
}, {
name: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier8Top.svg",
url: "http://zombia.io/asset/images/Entity/SawTower/SawTowerTier8Top.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Wall/WallTier1.svg",
url: "http://zombia.io/asset/images/Entity/Wall/WallTier1.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Wall/WallTier2.svg",
url: "http://zombia.io/asset/images/Entity/Wall/WallTier2.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Wall/WallTier3.svg",
url: "http://zombia.io/asset/images/Entity/Wall/WallTier3.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Wall/WallTier4.svg",
url: "http://zombia.io/asset/images/Entity/Wall/WallTier4.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Wall/WallTier5.svg",
url: "http://zombia.io/asset/images/Entity/Wall/WallTier5.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Wall/WallTier6.svg",
url: "http://zombia.io/asset/images/Entity/Wall/WallTier6.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Wall/WallTier7.svg",
url: "http://zombia.io/asset/images/Entity/Wall/WallTier7.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Wall/WallTier8.svg",
url: "http://zombia.io/asset/images/Entity/Wall/WallTier8.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier1Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier1Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier2Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier2Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier3WeaponLeft.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier3WeaponLeft.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier3WeaponRight.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier3WeaponRight.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier4Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier4Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier5Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier5Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier6Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier6Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier7Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier7Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier8Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieBlue/ZombieBlueTier8Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier1Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier1Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier2Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier2Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier3WeaponLeft.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier3WeaponLeft.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier3WeaponRight.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier3WeaponRight.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier4Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier4Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier5Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier5Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier6Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier6Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier7Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier7Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier8Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGreen/ZombieGreenTier8Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier1Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier1Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier1Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier1Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier2Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier2Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier2Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier2Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier3Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier3Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier3WeaponLeft.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier3WeaponLeft.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier3WeaponRight.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier3WeaponRight.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier4Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier4Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier4Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier4Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier5Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier5Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier5Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier5Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier6Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier6Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier6Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier6Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier7Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier7Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier7Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier7Weapon.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier8Base.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier8Base.svg"
}, {
name: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier8Weapon.svg",
url: "http://zombia.io/asset/images/Entity/Zombie/ZombieGrey/ZombieGreyTier8Weapon.svg"
}];
this.loader.add(a).load(() => {
console.log(a.length + " images successfully preloaded.");
});
}
init() {
this.replicator.init();
this.world.init();
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
document.getElementsByClassName("hud-settings-preload")[0].addEventListener("change", () => {
window.storage.setItem("settings-preload", document.getElementsByClassName("hud-settings-preload")[0].checked);
window.location.reload();
});
}
onEnterWorld() {
this.start();
}
start() {
this.ticker.start();
}
add(a, b = undefined) {
if (b === undefined) b = undefined;
if (a instanceof wj) {
switch (b) {
case "Building":
this.buildings.addAttachment(a);
break;
case "Resource":
this.scenery.addAttachment(a);
break;
case "Zombie":
this.zombieLayer.addAttachment(a);
break;
case "Projectile":
this.projectiles.addAttachment(a);
break;
case "Player":
case "Pet":
this.players.addAttachment(a);
break;
default:
this.npcs.addAttachment(a);
}
} else if (a instanceof xj) {
this.groundLayer.addAttachment(a);
} else {
if (!(a instanceof ui)) {
throw new Error("Unhandled object: " + JSON.stringify(a));
}
this.uiLayer.addAttachment(a);
}
}
remove(a) {
a.currentModel?.onDie?.();
if (a instanceof wj) {
switch (a.entityClass) {
case "Building":
this.buildings.removeAttachment(a);
break;
case "Resource":
this.scenery.removeAttachment(a);
break;
case "Zombie":
this.zombieLayer.removeAttachment(a);
break;
case "Projectile":
this.projectiles.removeAttachment(a);
break;
case "Player":
case "Pet":
this.players.removeAttachment(a);
break;
default:
this.npcs.removeAttachment(a);
}
} else if (a instanceof xj) {
this.groundLayer.removeAttachment(a);
} else if (a instanceof ui) {
this.uiLayer.removeAttachment(a);
}
}
update(a) {
if (this.firstPerformance === null) {
return this.firstPerformance = performance.now();
}
const b = performance.now();
const c = b - this.firstPerformance;
const d = c - this.lastMsElapsed;
this.lastMsElapsed = c;
a = d;
Jj.debug.begin();
try {
Jj.eventEmitter.emit("RendererUpdated", {
msElapsed: a
});
} catch (a) {
console.log("Had an issue with the event listener on 'RendererUpdated'.", a);
}
try {
this.scene.update(a, null);
} catch (a) {
console.log("Had an issue updating the scene.", a);
}
if (this.followingObject !== null) {
this.lookAtPosition(this.followingObject.getPosition());
}
this.renderer.renderer.render(this.scene.getNode());
if (Math.round((performance.now() - b) * 100) / 100 >= 10) {
this.longFrames++;
}
for (let b of this.renderingFilters) {
b.update(a);
}
Jj.debug.end();
}
lookAtPosition({
x: a,
y: b
}) {
const c = window.innerWidth * window.devicePixelRatio / 2;
const d = window.innerHeight * window.devicePixelRatio / 2;
a *= this.scale;
b *= this.scale;
const e = this.entitiesLayer.getPositionX();
const f = this.entitiesLayer.getPositionY();
const g = {
x: -a + c,
y: -b + d
};
this.entitiesLayer.setPosition(g.x, g.y);
if (e !== g.x || f !== g.y) {
Jj.eventEmitter.emit("CameraUpdate", {
newPosition: g
});
}
}
onWindowResize() {
const a = window.innerWidth * window.devicePixelRatio;
const b = window.innerHeight * window.devicePixelRatio;
const c = Math.max(a / (this.zoomDimension * 1920), b / (this.zoomDimension * 1080));
this.scale = c;
this.entitiesLayer.setScale(c);
this.uiLayer.setScale(c);
this.renderer.renderer.resize(a, b);
if (this.followingObject !== null) {
this.lookAtPosition(this.followingObject.getPosition());
}
}
screenToWorld(a, b) {
let c = -this.entitiesLayer.getPositionX();
let d = -this.entitiesLayer.getPositionY();
c *= 1 / this.scale;
d *= 1 / this.scale;
return {
x: c + (a *= 1 / this.scale * window.devicePixelRatio),
y: d + (b *= 1 / this.scale * window.devicePixelRatio)
};
}
worldToUi(a, b) {
let c = -this.entitiesLayer.getPositionX();
let d = -this.entitiesLayer.getPositionY();
c *= 1 / this.scale;
d *= 1 / this.scale;
return {
x: a - c,
y: b - d
};
}
worldToScreen(a, b) {
let c = -this.entitiesLayer.getPositionX();
let d = -this.entitiesLayer.getPositionY();
c *= 1 / this.scale;
d *= 1 / this.scale;
return {
x: (a - c) * this.scale * (1 / window.devicePixelRatio),
y: (b - d) * this.scale * (1 / window.devicePixelRatio)
};
}
screenToYaw(a, b) {
return Math.round(i.angleTo({
x: Jj.renderer.getWidth() / 2,
y: Jj.renderer.getHeight() / 2
}, {
x: a,
y: b
})) % 360;
}
getWidth() {
return this.renderer.renderer.width / window.devicePixelRatio;
}
getHeight() {
return this.renderer.renderer.height / window.devicePixelRatio;
}
}
var Ej = c(241);
class Fj extends d {
constructor() {
const a = document.createElement("div");
a.className = "hud-preloading-progress";
super(a);
document.getElementById("hud-intro").appendChild(a);
this.element.innerHTML = "\n <h2 id=\"preloading-text\" >Preloading...</h2>\n <div class=\"hud-preloading-progress-bar\">\n <div class=\"hud-preloading-progress-bar-filler\" id=\"progress-bar-filler\"></div>\n </div>\n ";
this.popupId = null;
this.preloadComplete = false;
}
init() {
Jj.eventEmitter.on("EnterWorldResponse", this.onEnterWorld.bind(this));
}
show() {
this.element.style.display = "block";
}
hide() {
this.element.style.display = "none";
}
setProgress(a) {
document.getElementById("progress-bar-filler").style.width = a + "%";
if (a >= 100) {
document.getElementById("preloading-text").innerText = "Preloading complete!";
this.allowPlay();
this.preloadComplete = true;
this.element.style.opacity = 0;
if (this.popupId !== null) {
Jj.ui.components.uiPopupOverlay.removePopup(this.popupId);
}
}
}
allowPlay() {
Jj.ui.components.uiIntro.playElem.classList.remove("disabled");
}
onEnterWorld() {
if (this.preloadComplete == 0) {
this.popupId = Jj.ui.components.uiPopupOverlay.showHint("Caution: preloading is still in effect, your connection may be slow!");
}
}
}
var Gj = c(370);
var Hj = c.n(Gj);
var Ij = c(50);
const Jj = new class {
constructor() {
try {
localStorage.setItem("dummyProp", "dummy");
localStorage.removeItem("dummyProp");
window.storage = localStorage;
} catch (a) {
window.storage = {
getItem() {},
setItem() {}
};
if (window.confirm("localStorage has been denied access. Not all functionality is possible. Press OK for more info (popup must be allowed).")) {
window.open("https://support.google.com/chrome/answer/14114868", "_blank");
}
}
this.ui = new pj();
this.network = new vj();
this.renderer = new Dj();
this.debug = new Ej.c();
this.eventEmitter = new(Hj())();
this.eventEmitter.setMaxListeners(100);
if (window.storage.getItem("settings-preload") === "true") {
Ij.default.defer(this.renderer.preloadAssets.bind(this.renderer));
this.ui.components.uiIntro.playElem.classList.add("disabled");
this.ui.components.preloadingProgressBar = new Fj();
}
}
init() {
this.ui.init();
this.renderer.init();
this.debug.init();
this.network.init();
}
getInWorld() {
return this.network.connected;
}
}();
Jj.init();
window.game = Jj
},
42: (a, b, c) => {
'use strict';
c.d(b, {
j: () => d
});
function d() {
var a = 0;
var b = document.createElement("div");
function c(a) {
b.appendChild(a.dom);
return a;
}
function e(c) {
for (var d = 0; d < b.children.length; d++) {
b.children[d].style.display = d === c ? "block" : "none";
}
a = c;
}
b.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";
b.addEventListener("click", function (c) {
c.preventDefault();
e(++a % b.children.length);
}, false);
var f = (performance || Date).now();
var g = f;
var h = 0;
var i = c(new d.Panel("FPS", "#0ff", "#002"));
var j = c(new d.Panel("MS", "#0f0", "#020"));
if (self.performance && self.performance.memory) {
var k = c(new d.Panel("MB", "#f08", "#201"));
}
e(0);
return {
REVISION: 16,
dom: b,
addPanel: c,
showPanel: e,
begin: function () {
f = (performance || Date).now();
},
end: function () {
h++;
var a = (performance || Date).now();
j.update(a - f, 200);
if (a >= g + 1000 && (i.update(h * 1000 / (a - g), 100), g = a, h = 0, k)) {
var b = performance.memory;
k.update(b.usedJSHeapSize / 1048576, b.jsHeapSizeLimit / 1048576);
}
return a;
},
update: function () {
f = this.end();
},
domElement: b,
setMode: e
};
}
d.Panel = function (a, b, c) {
var d = Infinity;
var e = 0;
var f = Math.round;
var g = f(window.devicePixelRatio || 1);
var h = (g *= 4) * 80;
var i = g * 48;
var j = g * 3;
var k = g * 2;
var l = g * 3;
var m = g * 15;
var n = g * 74;
var o = g * 30;
var p = document.createElement("canvas");
p.width = h;
p.height = i;
p.style.cssText = "width:80px;height:48px";
var q = p.getContext("2d");
q.font = "bold " + g * 9 + "px Helvetica,Arial,sans-serif";
q.textBaseline = "top";
q.fillStyle = c;
q.fillRect(0, 0, h, i);
q.fillStyle = b;
q.fillText(a, j, k);
q.fillRect(l, m, n, o);
q.fillStyle = c;
q.globalAlpha = 0.9;
q.fillRect(l, m, n, o);
return {
dom: p,
update: function (i, r) {
d = Math.min(d, i);
e = Math.max(e, i);
q.fillStyle = c;
q.globalAlpha = 1;
q.fillRect(0, 0, h, m);
q.fillStyle = b;
q.fillText(f(i) + " " + a + " (" + f(d) + "-" + f(e) + ")", j, k);
q.drawImage(p, l + g, m, n - g, o, l, m, n - g, o);
q.fillRect(l + n - g, m, g, o);
q.fillStyle = c;
q.globalAlpha = 0.9;
q.fillRect(l + n - g, m, g, f((1 - i / r) * o));
}
};
};
},
654: () => {},
50: (a, b, c) => {
'use strict';
c.r(b);
c.d(b, {
VERSION: () => e,
after: () => Ib,
all: () => ac,
allKeys: () => qa,
any: () => bc,
assign: () => Ia,
before: () => Jb,
bind: () => wb,
bindAll: () => zb,
chain: () => sb,
chunk: () => Lc,
clone: () => Ma,
collect: () => Wb,
compact: () => Ac,
compose: () => Hb,
constant: () => $,
contains: () => cc,
countBy: () => qc,
create: () => La,
debounce: () => Eb,
default: () => Qc,
defaults: () => Ja,
defer: () => Cb,
delay: () => Bb,
detect: () => Tb,
difference: () => Cc,
drop: () => yc,
each: () => Vb,
escape: () => gb,
every: () => ac,
extend: () => Ha,
extendOwn: () => Ia,
filter: () => $b,
find: () => Tb,
findIndex: () => Nb,
findKey: () => Lb,
findLastIndex: () => Ob,
findWhere: () => Ub,
first: () => xc,
flatten: () => Bc,
foldl: () => Yb,
foldr: () => Zb,
forEach: () => Vb,
functions: () => Fa,
get: () => Ra,
groupBy: () => oc,
has: () => Sa,
head: () => xc,
identity: () => Ta,
include: () => cc,
includes: () => cc,
indexBy: () => pc,
indexOf: () => Rb,
initial: () => wc,
inject: () => Yb,
intersection: () => Gc,
invert: () => Ea,
invoke: () => dc,
isArguments: () => X,
isArray: () => U,
isArrayBuffer: () => L,
isBoolean: () => C,
isDataView: () => T,
isDate: () => H,
isElement: () => D,
isEmpty: () => ia,
isEqual: () => pa,
isError: () => J,
isFinite: () => Y,
isFunction: () => O,
isMap: () => ya,
isMatch: () => ja,
isNaN: () => Z,
isNull: () => A,
isNumber: () => G,
isObject: () => z,
isRegExp: () => I,
isSet: () => Aa,
isString: () => F,
isSymbol: () => K,
isTypedArray: () => ea,
isUndefined: () => B,
isWeakMap: () => za,
isWeakSet: () => Ba,
iteratee: () => Ya,
keys: () => ha,
last: () => zc,
lastIndexOf: () => Sb,
map: () => Wb,
mapObject: () => $a,
matcher: () => Ua,
matches: () => Ua,
max: () => gc,
memoize: () => Ab,
methods: () => Fa,
min: () => hc,
mixin: () => Nc,
negate: () => Gb,
noop: () => _a,
now: () => db,
object: () => Jc,
omit: () => vc,
once: () => Kb,
pairs: () => Da,
partial: () => vb,
partition: () => rc,
pick: () => uc,
pluck: () => ec,
property: () => Va,
propertyOf: () => ab,
random: () => cb,
range: () => Kc,
reduce: () => Yb,
reduceRight: () => Zb,
reject: () => _b,
rest: () => yc,
restArguments: () => y,
result: () => pb,
sample: () => kc,
select: () => $b,
shuffle: () => lc,
size: () => sc,
some: () => bc,
sortBy: () => mc,
sortedIndex: () => Pb,
tail: () => yc,
take: () => xc,
tap: () => Na,
template: () => ob,
templateSettings: () => ib,
throttle: () => Db,
times: () => bb,
toArray: () => jc,
toPath: () => Oa,
transpose: () => Hc,
unescape: () => hb,
union: () => Fc,
uniq: () => Ec,
unique: () => Ec,
uniqueId: () => rb,
unzip: () => Hc,
values: () => Ca,
where: () => fc,
without: () => Dc,
wrap: () => Fb,
zip: () => Ic
});
var d = {};
c.r(d);
c.d(d, {
VERSION: () => e,
after: () => Ib,
all: () => ac,
allKeys: () => qa,
any: () => bc,
assign: () => Ia,
before: () => Jb,
bind: () => wb,
bindAll: () => zb,
chain: () => sb,
chunk: () => Lc,
clone: () => Ma,
collect: () => Wb,
compact: () => Ac,
compose: () => Hb,
constant: () => $,
contains: () => cc,
countBy: () => qc,
create: () => La,
debounce: () => Eb,
default: () => Oc,
defaults: () => Ja,
defer: () => Cb,
delay: () => Bb,
detect: () => Tb,
difference: () => Cc,
drop: () => yc,
each: () => Vb,
escape: () => gb,
every: () => ac,
extend: () => Ha,
extendOwn: () => Ia,
filter: () => $b,
find: () => Tb,
findIndex: () => Nb,
findKey: () => Lb,
findLastIndex: () => Ob,
findWhere: () => Ub,
first: () => xc,
flatten: () => Bc,
foldl: () => Yb,
foldr: () => Zb,
forEach: () => Vb,
functions: () => Fa,
get: () => Ra,
groupBy: () => oc,
has: () => Sa,
head: () => xc,
identity: () => Ta,
include: () => cc,
includes: () => cc,
indexBy: () => pc,
indexOf: () => Rb,
initial: () => wc,
inject: () => Yb,
intersection: () => Gc,
invert: () => Ea,
invoke: () => dc,
isArguments: () => X,
isArray: () => U,
isArrayBuffer: () => L,
isBoolean: () => C,
isDataView: () => T,
isDate: () => H,
isElement: () => D,
isEmpty: () => ia,
isEqual: () => pa,
isError: () => J,
isFinite: () => Y,
isFunction: () => O,
isMap: () => ya,
isMatch: () => ja,
isNaN: () => Z,
isNull: () => A,
isNumber: () => G,
isObject: () => z,
isRegExp: () => I,
isSet: () => Aa,
isString: () => F,
isSymbol: () => K,
isTypedArray: () => ea,
isUndefined: () => B,
isWeakMap: () => za,
isWeakSet: () => Ba,
iteratee: () => Ya,
keys: () => ha,
last: () => zc,
lastIndexOf: () => Sb,
map: () => Wb,
mapObject: () => $a,
matcher: () => Ua,
matches: () => Ua,
max: () => gc,
memoize: () => Ab,
methods: () => Fa,
min: () => hc,
mixin: () => Nc,
negate: () => Gb,
noop: () => _a,
now: () => db,
object: () => Jc,
omit: () => vc,
once: () => Kb,
pairs: () => Da,
partial: () => vb,
partition: () => rc,
pick: () => uc,
pluck: () => ec,
property: () => Va,
propertyOf: () => ab,
random: () => cb,
range: () => Kc,
reduce: () => Yb,
reduceRight: () => Zb,
reject: () => _b,
rest: () => yc,
restArguments: () => y,
result: () => pb,
sample: () => kc,
select: () => $b,
shuffle: () => lc,
size: () => sc,
some: () => bc,
sortBy: () => mc,
sortedIndex: () => Pb,
tail: () => yc,
take: () => xc,
tap: () => Na,
template: () => ob,
templateSettings: () => ib,
throttle: () => Db,
times: () => bb,
toArray: () => jc,
toPath: () => Oa,
transpose: () => Hc,
unescape: () => hb,
union: () => Fc,
uniq: () => Ec,
unique: () => Ec,
uniqueId: () => rb,
unzip: () => Hc,
values: () => Ca,
where: () => fc,
without: () => Dc,
wrap: () => Fb,
zip: () => Ic
});
var e = "1.13.6";
var f = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || Function("return this")() || {};
var g = Array.prototype;
var h = Object.prototype;
var i = typeof Symbol != "undefined" ? Symbol.prototype : null;
var j = g.push;
var k = g.slice;
var l = h.toString;
var m = h.hasOwnProperty;
var n = typeof ArrayBuffer != "undefined";
var o = typeof DataView != "undefined";
var p = Array.isArray;
var q = Object.keys;
var r = Object.create;
var s = n && ArrayBuffer.isView;
var t = isNaN;
var u = isFinite;
var v = !{
toString: null
}.propertyIsEnumerable("toString");
var w = ["valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"];
var x = Math.pow(2, 53) - 1;
function y(a, b) {
b = b == null ? a.length - 1 : +b;
return function () {
for (var c = Math.max(arguments.length - b, 0), d = Array(c), e = 0; e < c; e++) {
d[e] = arguments[e + b];
}
switch (b) {
case 0:
return a.call(this, d);
case 1:
return a.call(this, arguments[0], d);
case 2:
return a.call(this, arguments[0], arguments[1], d);
}
var f = Array(b + 1);
for (e = 0; e < b; e++) {
f[e] = arguments[e];
}
f[b] = d;
return a.apply(this, f);
};
}
function z(a) {
var b = typeof a;
return b === "function" || b === "object" && !!a;
}
function A(a) {
return a === null;
}
function B(a) {
return a === undefined;
}
function C(a) {
return a === true || a === false || l.call(a) === "[object Boolean]";
}
function D(a) {
return !!a && a.nodeType === 1;
}
function E(a) {
var b = "[object " + a + "]";
return function (a) {
return l.call(a) === b;
};
}
const F = E("String");
const G = E("Number");
const H = E("Date");
const I = E("RegExp");
const J = E("Error");
const K = E("Symbol");
const L = E("ArrayBuffer");
var M = E("Function");
var N = f.document && f.document.childNodes;
if (typeof Int8Array != "object" && typeof N != "function") {
M = function (a) {
return typeof a == "function" || false;
};
}
const O = M;
const P = E("Object");
var Q = o && P(new DataView(new ArrayBuffer(8)));
var R = typeof Map != "undefined" && P(new Map());
var S = E("DataView");
const T = Q ? function (a) {
return a != null && O(a.getInt8) && L(a.buffer);
} : S;
const U = p || E("Array");
function V(a, b) {
return a != null && m.call(a, b);
}
var W = E("Arguments");
(function () {
if (!W(arguments)) {
W = function (a) {
return V(a, "callee");
};
}
})();
const X = W;
function Y(a) {
return !K(a) && u(a) && !isNaN(parseFloat(a));
}
function Z(a) {
return G(a) && t(a);
}
function $(a) {
return function () {
return a;
};
}
function _(a) {
return function (b) {
var c = a(b);
return typeof c == "number" && c >= 0 && c <= x;
};
}
function aa(a) {
return function (b) {
if (b == null) {
return undefined;
} else {
return b[a];
}
};
}
const ba = aa("byteLength");
const ca = _(ba);
var da = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
const ea = n ? function (a) {
if (s) {
return s(a) && !T(a);
} else {
return ca(a) && da.test(l.call(a));
}
} : $(false);
const fa = aa("length");
function ga(a, b) {
b = function (a) {
for (var b = {}, c = a.length, d = 0; d < c; ++d) {
b[a[d]] = true;
}
return {
contains: function (a) {
return b[a] === true;
},
push: function (c) {
b[c] = true;
return a.push(c);
}
};
}(b);
var c = w.length;
var d = a.constructor;
var e = O(d) && d.prototype || h;
var f = "constructor";
for (V(a, f) && !b.contains(f) && b.push(f); c--;) {
if ((f = w[c]) in a && a[f] !== e[f] && !b.contains(f)) {
b.push(f);
}
}
}
function ha(a) {
if (!z(a)) {
return [];
}
if (q) {
return q(a);
}
var b = [];
for (var c in a) {
if (V(a, c)) {
b.push(c);
}
}
if (v) {
ga(a, b);
}
return b;
}
function ia(a) {
if (a == null) {
return true;
}
var b = fa(a);
if (typeof b == "number" && (U(a) || F(a) || X(a))) {
return b === 0;
} else {
return fa(ha(a)) === 0;
}
}
function ja(a, b) {
var c = ha(b);
var d = c.length;
if (a == null) {
return !d;
}
for (var e = Object(a), f = 0; f < d; f++) {
var g = c[f];
if (b[g] !== e[g] || !(g in e)) {
return false;
}
}
return true;
}
function ka(a) {
if (a instanceof ka) {
return a;
} else if (this instanceof ka) {
this._wrapped = a;
return;
} else {
return new ka(a);
}
}
function la(a) {
return new Uint8Array(a.buffer || a, a.byteOffset || 0, ba(a));
}
ka.VERSION = e;
ka.prototype.value = function () {
return this._wrapped;
};
ka.prototype.valueOf = ka.prototype.toJSON = ka.prototype.value;
ka.prototype.toString = function () {
return String(this._wrapped);
};
var ma = "[object DataView]";
function na(a, b, c, d) {
if (a === b) {
return a !== 0 || 1 / a == 1 / b;
}
if (a == null || b == null) {
return false;
}
if (a != a) {
return b != b;
}
var e = typeof a;
return (e === "function" || e === "object" || typeof b == "object") && oa(a, b, c, d);
}
function oa(a, b, c, d) {
if (a instanceof ka) {
a = a._wrapped;
}
if (b instanceof ka) {
b = b._wrapped;
}
var e = l.call(a);
if (e !== l.call(b)) {
return false;
}
if (Q && e == "[object Object]" && T(a)) {
if (!T(b)) {
return false;
}
e = ma;
}
switch (e) {
case "[object RegExp]":
case "[object String]":
return "" + a == "" + b;
case "[object Number]":
if (+a != +a) {
return +b != +b;
} else if (+a == 0) {
return 1 / +a == 1 / b;
} else {
return +a == +b;
}
case "[object Date]":
case "[object Boolean]":
return +a == +b;
case "[object Symbol]":
return i.valueOf.call(a) === i.valueOf.call(b);
case "[object ArrayBuffer]":
case ma:
return oa(la(a), la(b), c, d);
}
var f = e === "[object Array]";
if (!f && ea(a)) {
if (ba(a) !== ba(b)) {
return false;
}
if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) {
return true;
}
f = true;
}
if (!f) {
if (typeof a != "object" || typeof b != "object") {
return false;
}
var g = a.constructor;
var h = b.constructor;
if (g !== h && (!O(g) || !(g instanceof g) || !O(h) || !(h instanceof h)) && "constructor" in a && "constructor" in b) {
return false;
}
}
d = d || [];
for (var j = (c = c || []).length; j--;) {
if (c[j] === a) {
return d[j] === b;
}
}
c.push(a);
d.push(b);
if (f) {
if ((j = a.length) !== b.length) {
return false;
}
while (j--) {
if (!na(a[j], b[j], c, d)) {
return false;
}
}
} else {
var k;
var m = ha(a);
j = m.length;
if (ha(b).length !== j) {
return false;
}
while (j--) {
if (!V(b, k = m[j]) || !na(a[k], b[k], c, d)) {
return false;
}
}
}
c.pop();
d.pop();
return true;
}
function pa(a, b) {
return na(a, b);
}
function qa(a) {
if (!z(a)) {
return [];
}
var b = [];
for (var c in a) {
b.push(c);
}
if (v) {
ga(a, b);
}
return b;
}
function ra(a) {
var b = fa(a);
return function (c) {
if (c == null) {
return false;
}
var d = qa(c);
if (fa(d)) {
return false;
}
for (var e = 0; e < b; e++) {
if (!O(c[a[e]])) {
return false;
}
}
return a !== wa || !O(c[sa]);
};
}
var sa = "forEach";
var ta = ["clear", "delete"];
var ua = ["get", "has", "set"];
var va = ta.concat(sa, ua);
var wa = ta.concat(ua);
var xa = ["add"].concat(ta, sa, "has");
const ya = R ? ra(va) : E("Map");
const za = R ? ra(wa) : E("WeakMap");
const Aa = R ? ra(xa) : E("Set");
const Ba = E("WeakSet");
function Ca(a) {
for (var b = ha(a), c = b.length, d = Array(c), e = 0; e < c; e++) {
d[e] = a[b[e]];
}
return d;
}
function Da(a) {
for (var b = ha(a), c = b.length, d = Array(c), e = 0; e < c; e++) {
d[e] = [b[e], a[b[e]]];
}
return d;
}
function Ea(a) {
for (var b = {}, c = ha(a), d = 0, e = c.length; d < e; d++) {
b[a[c[d]]] = c[d];
}
return b;
}
function Fa(a) {
var b = [];
for (var c in a) {
if (O(a[c])) {
b.push(c);
}
}
return b.sort();
}
function Ga(a, b) {
return function (c) {
var d = arguments.length;
if (b) {
c = Object(c);
}
if (d < 2 || c == null) {
return c;
}
for (var e = 1; e < d; e++) {
for (var f = arguments[e], g = a(f), h = g.length, i = 0; i < h; i++) {
var j = g[i];
if (!b || c[j] === undefined) {
c[j] = f[j];
}
}
}
return c;
};
}
const Ha = Ga(qa);
const Ia = Ga(ha);
const Ja = Ga(qa, true);
function Ka(a) {
if (!z(a)) {
return {};
}
if (r) {
return r(a);
}
function b() {}
b.prototype = a;
var c = new b();
b.prototype = null;
return c;
}
function La(a, b) {
var c = Ka(a);
if (b) {
Ia(c, b);
}
return c;
}
function Ma(a) {
if (z(a)) {
if (U(a)) {
return a.slice();
} else {
return Ha({}, a);
}
} else {
return a;
}
}
function Na(a, b) {
b(a);
return a;
}
function Oa(a) {
if (U(a)) {
return a;
} else {
return [a];
}
}
function Pa(a) {
return ka.toPath(a);
}
function Qa(a, b) {
for (var c = b.length, d = 0; d < c; d++) {
if (a == null) {
return;
}
a = a[b[d]];
}
if (c) {
return a;
} else {
return undefined;
}
}
function Ra(a, b, c) {
var d = Qa(a, Pa(b));
if (B(d)) {
return c;
} else {
return d;
}
}
function Sa(a, b) {
for (var c = (b = Pa(b)).length, d = 0; d < c; d++) {
var e = b[d];
if (!V(a, e)) {
return false;
}
a = a[e];
}
return !!c;
}
function Ta(a) {
return a;
}
function Ua(a) {
a = Ia({}, a);
return function (b) {
return ja(b, a);
};
}
function Va(a) {
a = Pa(a);
return function (b) {
return Qa(b, a);
};
}
function Wa(a, b, c) {
if (b === undefined) {
return a;
}
switch (c == null ? 3 : c) {
case 1:
return function (c) {
return a.call(b, c);
};
case 3:
return function (c, d, e) {
return a.call(b, c, d, e);
};
case 4:
return function (c, d, e, f) {
return a.call(b, c, d, e, f);
};
}
return function () {
return a.apply(b, arguments);
};
}
function Xa(a, b, c) {
if (a == null) {
return Ta;
} else if (O(a)) {
return Wa(a, b, c);
} else if (z(a) && !U(a)) {
return Ua(a);
} else {
return Va(a);
}
}
function Ya(a, b) {
return Xa(a, b, Infinity);
}
function Za(a, b, c) {
if (ka.iteratee !== Ya) {
return ka.iteratee(a, b);
} else {
return Xa(a, b, c);
}
}
function $a(a, b, c) {
b = Za(b, c);
for (var d = ha(a), e = d.length, f = {}, g = 0; g < e; g++) {
var h = d[g];
f[h] = b(a[h], h, a);
}
return f;
}
function _a() {}
function ab(a) {
if (a == null) {
return _a;
} else {
return function (b) {
return Ra(a, b);
};
}
}
function bb(a, b, c) {
var d = Array(Math.max(0, a));
b = Wa(b, c, 1);
for (var e = 0; e < a; e++) {
d[e] = b(e);
}
return d;
}
function cb(a, b) {
if (b == null) {
b = a;
a = 0;
}
return a + Math.floor(Math.random() * (b - a + 1));
}
ka.toPath = Oa;
ka.iteratee = Ya;
const db = Date.now || function () {
return new Date().getTime();
};
function eb(a) {
function b(b) {
return a[b];
}
var c = "(?:" + ha(a).join("|") + ")";
var d = RegExp(c);
var e = RegExp(c, "g");
return function (a) {
a = a == null ? "" : "" + a;
if (d.test(a)) {
return a.replace(e, b);
} else {
return a;
}
};
}
const fb = {
"&": "&",
"<": "<",
">": ">",
"\"": """,
"'": "'",
"`": "`"
};
const gb = eb(fb);
const hb = eb(Ea(fb));
const ib = ka.templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g
};
var jb = /(.)^/;
var kb = {
"'": "'",
"\\": "\\",
"\r": "r",
"\n": "n",
"\u2028": "u2028",
"\u2029": "u2029"
};
var lb = /\\|'|\r|\n|\u2028|\u2029/g;
function mb(a) {
return "\\" + kb[a];
}
var nb = /^\s*(\w|\$)+\s*$/;
function ob(a, b, c) {
if (!b && c) {
b = c;
}
b = Ja({}, b, ka.templateSettings);
var d = RegExp([(b.escape || jb).source, (b.interpolate || jb).source, (b.evaluate || jb).source].join("|") + "|$", "g");
var e = 0;
var f = "__p+='";
a.replace(d, function (b, c, d, g, h) {
f += a.slice(e, h).replace(lb, mb);
e = h + b.length;
if (c) {
f += "'+\n((__t=(" + c + "))==null?'':_.escape(__t))+\n'";
} else if (d) {
f += "'+\n((__t=(" + d + "))==null?'':__t)+\n'";
} else if (g) {
f += "';\n" + g + "\n__p+='";
}
return b;
});
f += "';\n";
var g;
var h = b.variable;
if (h) {
if (!nb.test(h)) {
throw new Error("variable is not a bare identifier: " + h);
}
} else {
f = "with(obj||{}){\n" + f + "}\n";
h = "obj";
}
f = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + f + "return __p;\n";
try {
g = new Function(h, "_", f);
} catch (a) {
a.source = f;
throw a;
}
function i(a) {
return g.call(this, a, ka);
}
i.source = "function(" + h + "){\n" + f + "}";
return i;
}
function pb(a, b, c) {
var d = (b = Pa(b)).length;
if (!d) {
if (O(c)) {
return c.call(a);
} else {
return c;
}
}
for (var e = 0; e < d; e++) {
var f = a == null ? undefined : a[b[e]];
if (f === undefined) {
f = c;
e = d;
}
a = O(f) ? f.call(a) : f;
}
return a;
}
var qb = 0;
function rb(a) {
var b = ++qb + "";
if (a) {
return a + b;
} else {
return b;
}
}
function sb(a) {
var b = ka(a);
b._chain = true;
return b;
}
function tb(a, b, c, d, e) {
if (!(d instanceof b)) {
return a.apply(c, e);
}
var f = Ka(a.prototype);
var g = a.apply(f, e);
if (z(g)) {
return g;
} else {
return f;
}
}
var ub = y(function (a, b) {
var c = ub.placeholder;
function d() {
for (var e = 0, f = b.length, g = Array(f), h = 0; h < f; h++) {
g[h] = b[h] === c ? arguments[e++] : b[h];
}
while (e < arguments.length) {
g.push(arguments[e++]);
}
return tb(a, d, this, this, g);
}
return d;
});
ub.placeholder = ka;
const vb = ub;
const wb = y(function (a, b, c) {
if (!O(a)) {
throw new TypeError("Bind must be called on a function");
}
var d = y(function (e) {
return tb(a, d, b, this, c.concat(e));
});
return d;
});
const xb = _(fa);
function yb(a, b, c, d) {
d = d || [];
if (b || b === 0) {
if (b <= 0) {
return d.concat(a);
}
} else {
b = Infinity;
}
for (var e = d.length, f = 0, g = fa(a); f < g; f++) {
var h = a[f];
if (xb(h) && (U(h) || X(h))) {
if (b > 1) {
yb(h, b - 1, c, d);
e = d.length;
} else {
for (var i = 0, j = h.length; i < j;) {
d[e++] = h[i++];
}
}
} else if (!c) {
d[e++] = h;
}
}
return d;
}
const zb = y(function (a, b) {
var c = (b = yb(b, false, false)).length;
if (c < 1) {
throw new Error("bindAll must be passed function names");
}
while (c--) {
var d = b[c];
a[d] = wb(a[d], a);
}
return a;
});
function Ab(a, b) {
function c(d) {
var e = c.cache;
var f = "" + (b ? b.apply(this, arguments) : d);
if (!V(e, f)) {
e[f] = a.apply(this, arguments);
}
return e[f];
}
c.cache = {};
return c;
}
const Bb = y(function (a, b, c) {
return setTimeout(function () {
return a.apply(null, c);
}, b);
});
const Cb = vb(Bb, ka, 1);
function Db(a, b, c) {
var d;
var e;
var f;
var g;
var h = 0;
c ||= {};
function i() {
h = c.leading === false ? 0 : db();
d = null;
g = a.apply(e, f);
if (!d) {
e = f = null;
}
}
function j() {
var j = db();
if (!h && c.leading === false) {
h = j;
}
var k = b - (j - h);
e = this;
f = arguments;
if (k <= 0 || k > b) {
if (d) {
clearTimeout(d);
d = null;
}
h = j;
g = a.apply(e, f);
if (!d) {
e = f = null;
}
} else if (!d && c.trailing !== false) {
d = setTimeout(i, k);
}
return g;
}
j.cancel = function () {
clearTimeout(d);
h = 0;
d = e = f = null;
};
return j;
}
function Eb(a, b, c) {
var d;
var e;
var f;
var g;
var h;
function i() {
var j = db() - e;
if (b > j) {
d = setTimeout(i, b - j);
} else {
d = null;
if (!c) {
g = a.apply(h, f);
}
if (!d) {
f = h = null;
}
}
}
var j = y(function (j) {
h = this;
f = j;
e = db();
if (!d) {
d = setTimeout(i, b);
if (c) {
g = a.apply(h, f);
}
}
return g;
});
j.cancel = function () {
clearTimeout(d);
d = f = h = null;
};
return j;
}
function Fb(a, b) {
return vb(b, a);
}
function Gb(a) {
return function () {
return !a.apply(this, arguments);
};
}
function Hb() {
var a = arguments;
var b = a.length - 1;
return function () {
for (var c = b, d = a[b].apply(this, arguments); c--;) {
d = a[c].call(this, d);
}
return d;
};
}
function Ib(a, b) {
return function () {
if (--a < 1) {
return b.apply(this, arguments);
}
};
}
function Jb(a, b) {
var c;
return function () {
if (--a > 0) {
c = b.apply(this, arguments);
}
if (a <= 1) {
b = null;
}
return c;
};
}
const Kb = vb(Jb, 2);
function Lb(a, b, c) {
b = Za(b, c);
for (var d, e = ha(a), f = 0, g = e.length; f < g; f++) {
if (b(a[d = e[f]], d, a)) {
return d;
}
}
}
function Mb(a) {
return function (b, c, d) {
c = Za(c, d);
for (var e = fa(b), f = a > 0 ? 0 : e - 1; f >= 0 && f < e; f += a) {
if (c(b[f], f, b)) {
return f;
}
}
return -1;
};
}
const Nb = Mb(1);
const Ob = Mb(-1);
function Pb(a, b, c, d) {
for (var e = (c = Za(c, d, 1))(b), f = 0, g = fa(a); f < g;) {
var h = Math.floor((f + g) / 2);
if (c(a[h]) < e) {
f = h + 1;
} else {
g = h;
}
}
return f;
}
function Qb(a, b, c) {
return function (d, e, f) {
var g = 0;
var h = fa(d);
if (typeof f == "number") {
if (a > 0) {
g = f >= 0 ? f : Math.max(f + h, g);
} else {
h = f >= 0 ? Math.min(f + 1, h) : f + h + 1;
}
} else if (c && f && h) {
if (d[f = c(d, e)] === e) {
return f;
} else {
return -1;
}
}
if (e != e) {
if ((f = b(k.call(d, g, h), Z)) >= 0) {
return f + g;
} else {
return -1;
}
}
for (f = a > 0 ? g : h - 1; f >= 0 && f < h; f += a) {
if (d[f] === e) {
return f;
}
}
return -1;
};
}
const Rb = Qb(1, Nb, Pb);
const Sb = Qb(-1, Ob);
function Tb(a, b, c) {
var d = (xb(a) ? Nb : Lb)(a, b, c);
if (d !== undefined && d !== -1) {
return a[d];
}
}
function Ub(a, b) {
return Tb(a, Ua(b));
}
function Vb(a, b, c) {
var d;
var e;
b = Wa(b, c);
if (xb(a)) {
d = 0;
e = a.length;
for (; d < e; d++) {
b(a[d], d, a);
}
} else {
var f = ha(a);
d = 0;
e = f.length;
for (; d < e; d++) {
b(a[f[d]], f[d], a);
}
}
return a;
}
function Wb(a, b, c) {
b = Za(b, c);
for (var d = !xb(a) && ha(a), e = (d || a).length, f = Array(e), g = 0; g < e; g++) {
var h = d ? d[g] : g;
f[g] = b(a[h], h, a);
}
return f;
}
function Xb(a) {
return function (b, c, d, e) {
var f = arguments.length >= 3;
return function (b, c, d, e) {
var f = !xb(b) && ha(b);
var g = (f || b).length;
var h = a > 0 ? 0 : g - 1;
for (e || (d = b[f ? f[h] : h], h += a); h >= 0 && h < g; h += a) {
var i = f ? f[h] : h;
d = c(d, b[i], i, b);
}
return d;
}(b, Wa(c, e, 4), d, f);
};
}
const Yb = Xb(1);
const Zb = Xb(-1);
function $b(a, b, c) {
var d = [];
b = Za(b, c);
Vb(a, function (a, c, e) {
if (b(a, c, e)) {
d.push(a);
}
});
return d;
}
function _b(a, b, c) {
return $b(a, Gb(Za(b)), c);
}
function ac(a, b, c) {
b = Za(b, c);
for (var d = !xb(a) && ha(a), e = (d || a).length, f = 0; f < e; f++) {
var g = d ? d[f] : f;
if (!b(a[g], g, a)) {
return false;
}
}
return true;
}
function bc(a, b, c) {
b = Za(b, c);
for (var d = !xb(a) && ha(a), e = (d || a).length, f = 0; f < e; f++) {
var g = d ? d[f] : f;
if (b(a[g], g, a)) {
return true;
}
}
return false;
}
function cc(a, b, c, d) {
if (!xb(a)) {
a = Ca(a);
}
if (typeof c != "number" || d) {
c = 0;
}
return Rb(a, b, c) >= 0;
}
const dc = y(function (a, b, c) {
var d;
var e;
if (O(b)) {
e = b;
} else {
b = Pa(b);
d = b.slice(0, -1);
b = b[b.length - 1];
}
return Wb(a, function (a) {
var f = e;
if (!f) {
if (d && d.length) {
a = Qa(a, d);
}
if (a == null) {
return;
}
f = a[b];
}
if (f == null) {
return f;
} else {
return f.apply(a, c);
}
});
});
function ec(a, b) {
return Wb(a, Va(b));
}
function fc(a, b) {
return $b(a, Ua(b));
}
function gc(a, b, c) {
var d;
var e;
var f = -Infinity;
var g = -Infinity;
if (b == null || typeof b == "number" && typeof a[0] != "object" && a != null) {
for (var h = 0, i = (a = xb(a) ? a : Ca(a)).length; h < i; h++) {
if ((d = a[h]) != null && d > f) {
f = d;
}
}
} else {
b = Za(b, c);
Vb(a, function (a, c, d) {
if ((e = b(a, c, d)) > g || e === -Infinity && f === -Infinity) {
f = a;
g = e;
}
});
}
return f;
}
function hc(a, b, c) {
var d;
var e;
var f = Infinity;
var g = Infinity;
if (b == null || typeof b == "number" && typeof a[0] != "object" && a != null) {
for (var h = 0, i = (a = xb(a) ? a : Ca(a)).length; h < i; h++) {
if ((d = a[h]) != null && d < f) {
f = d;
}
}
} else {
b = Za(b, c);
Vb(a, function (a, c, d) {
if ((e = b(a, c, d)) < g || e === Infinity && f === Infinity) {
f = a;
g = e;
}
});
}
return f;
}
var ic = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
function jc(a) {
if (a) {
if (U(a)) {
return k.call(a);
} else if (F(a)) {
return a.match(ic);
} else if (xb(a)) {
return Wb(a, Ta);
} else {
return Ca(a);
}
} else {
return [];
}
}
function kc(a, b, c) {
if (b == null || c) {
if (!xb(a)) {
a = Ca(a);
}
return a[cb(a.length - 1)];
}
var d = jc(a);
var e = fa(d);
b = Math.max(Math.min(b, e), 0);
for (var f = e - 1, g = 0; g < b; g++) {
var h = cb(g, f);
var i = d[g];
d[g] = d[h];
d[h] = i;
}
return d.slice(0, b);
}
function lc(a) {
return kc(a, Infinity);
}
function mc(a, b, c) {
var d = 0;
b = Za(b, c);
return ec(Wb(a, function (a, c, e) {
return {
value: a,
index: d++,
criteria: b(a, c, e)
};
}).sort(function (a, b) {
var c = a.criteria;
var d = b.criteria;
if (c !== d) {
if (c > d || c === undefined) {
return 1;
}
if (c < d || d === undefined) {
return -1;
}
}
return a.index - b.index;
}), "value");
}
function nc(a, b) {
return function (c, d, e) {
var f = b ? [
[],
[]
] : {};
d = Za(d, e);
Vb(c, function (b, e) {
var g = d(b, e, c);
a(f, b, g);
});
return f;
};
}
const oc = nc(function (a, b, c) {
if (V(a, c)) {
a[c].push(b);
} else {
a[c] = [b];
}
});
const pc = nc(function (a, b, c) {
a[c] = b;
});
const qc = nc(function (a, b, c) {
if (V(a, c)) {
a[c]++;
} else {
a[c] = 1;
}
});
const rc = nc(function (a, b, c) {
a[c ? 0 : 1].push(b);
}, true);
function sc(a) {
if (a == null) {
return 0;
} else if (xb(a)) {
return a.length;
} else {
return ha(a).length;
}
}
function tc(a, b, c) {
return b in c;
}
const uc = y(function (a, b) {
var c = {};
var d = b[0];
if (a == null) {
return c;
}
if (O(d)) {
if (b.length > 1) {
d = Wa(d, b[1]);
}
b = qa(a);
} else {
d = tc;
b = yb(b, false, false);
a = Object(a);
}
for (var e = 0, f = b.length; e < f; e++) {
var g = b[e];
var h = a[g];
if (d(h, g, a)) {
c[g] = h;
}
}
return c;
});
const vc = y(function (a, b) {
var c;
var d = b[0];
if (O(d)) {
d = Gb(d);
if (b.length > 1) {
c = b[1];
}
} else {
b = Wb(yb(b, false, false), String);
d = function (a, c) {
return !cc(b, c);
};
}
return uc(a, d, c);
});
function wc(a, b, c) {
return k.call(a, 0, Math.max(0, a.length - (b == null || c ? 1 : b)));
}
function xc(a, b, c) {
if (a == null || a.length < 1) {
if (b == null || c) {
return undefined;
} else {
return [];
}
} else if (b == null || c) {
return a[0];
} else {
return wc(a, a.length - b);
}
}
function yc(a, b, c) {
return k.call(a, b == null || c ? 1 : b);
}
function zc(a, b, c) {
if (a == null || a.length < 1) {
if (b == null || c) {
return undefined;
} else {
return [];
}
} else if (b == null || c) {
return a[a.length - 1];
} else {
return yc(a, Math.max(0, a.length - b));
}
}
function Ac(a) {
return $b(a, Boolean);
}
function Bc(a, b) {
return yb(a, b, false);
}
const Cc = y(function (a, b) {
b = yb(b, true, true);
return $b(a, function (a) {
return !cc(b, a);
});
});
const Dc = y(function (a, b) {
return Cc(a, b);
});
function Ec(a, b, c, d) {
if (!C(b)) {
d = c;
c = b;
b = false;
}
if (c != null) {
c = Za(c, d);
}
for (var e = [], f = [], g = 0, h = fa(a); g < h; g++) {
var i = a[g];
var j = c ? c(i, g, a) : i;
if (b && !c) {
if (!g || f !== j) {
e.push(i);
}
f = j;
} else if (c) {
if (!cc(f, j)) {
f.push(j);
e.push(i);
}
} else if (!cc(e, i)) {
e.push(i);
}
}
return e;
}
const Fc = y(function (a) {
return Ec(yb(a, true, true));
});
function Gc(a) {
for (var b = [], c = arguments.length, d = 0, e = fa(a); d < e; d++) {
var f = a[d];
if (!cc(b, f)) {
var g;
for (g = 1; g < c && cc(arguments[g], f); g++);
if (g === c) {
b.push(f);
}
}
}
return b;
}
function Hc(a) {
for (var b = a && gc(a, fa).length || 0, c = Array(b), d = 0; d < b; d++) {
c[d] = ec(a, d);
}
return c;
}
const Ic = y(Hc);
function Jc(a, b) {
for (var c = {}, d = 0, e = fa(a); d < e; d++) {
if (b) {
c[a[d]] = b[d];
} else {
c[a[d][0]] = a[d][1];
}
}
return c;
}
function Kc(a, b, c) {
if (b == null) {
b = a || 0;
a = 0;
}
c ||= b < a ? -1 : 1;
for (var d = Math.max(Math.ceil((b - a) / c), 0), e = Array(d), f = 0; f < d; f++, a += c) {
e[f] = a;
}
return e;
}
function Lc(a, b) {
if (b == null || b < 1) {
return [];
}
for (var c = [], d = 0, e = a.length; d < e;) {
c.push(k.call(a, d, d += b));
}
return c;
}
function Mc(a, b) {
if (a._chain) {
return ka(b).chain();
} else {
return b;
}
}
function Nc(a) {
Vb(Fa(a), function (b) {
var c = ka[b] = a[b];
ka.prototype[b] = function () {
var a = [this._wrapped];
j.apply(a, arguments);
return Mc(this, c.apply(ka, a));
};
});
return ka;
}
Vb(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (a) {
var b = g[a];
ka.prototype[a] = function () {
var c = this._wrapped;
if (c != null) {
b.apply(c, arguments);
if ((a === "shift" || a === "splice") && c.length === 0) {
delete c[0];
}
}
return Mc(this, c);
};
});
Vb(["concat", "join", "slice"], function (a) {
var b = g[a];
ka.prototype[a] = function () {
var a = this._wrapped;
if (a != null) {
a = b.apply(a, arguments);
}
return Mc(this, a);
};
});
const Oc = ka;
var Pc = Nc(d);
Pc._ = Pc;
const Qc = Pc;
}
};
var b = {};
function c(d) {
var e = b[d];
if (e !== undefined) {
return e.exports;
}
var f = b[d] = {
id: d,
loaded: false,
exports: {}
};
a[d].call(f.exports, f, f.exports, c);
f.loaded = true;
return f.exports;
}
c.n = a => {
var b = a && a.__esModule ? () => a.default : () => a;
c.d(b, {
a: b
});
return b;
};
c.d = (a, b) => {
for (var d in b) {
if (c.o(b, d) && !c.o(a, d)) {
Object.defineProperty(a, d, {
enumerable: true,
get: b[d]
});
}
}
};
c.g = function () {
if (typeof globalThis == "object") {
return globalThis;
}
try {
return this || new Function("return this")();
} catch (a) {
if (typeof window == "object") {
return window;
}
}
}();
c.o = (a, b) => Object.prototype.hasOwnProperty.call(a, b);
c.r = a => {
if (typeof Symbol != "undefined" && Symbol.toStringTag) {
Object.defineProperty(a, Symbol.toStringTag, {
value: "Module"
});
}
Object.defineProperty(a, "__esModule", {
value: true
});
};
c.nmd = a => {
a.paths = [];
a.children ||= [];
return a;
};
var d = c(911);
})();