Files
discord-decomp/_bundle/Module1214.js
T
2026-11-01 12:12:55 +02:00

284 lines
7.9 KiB
JavaScript

// Metro module 1214 (f1215).
const r4 = typeof globalThis.window !== "undefined" ? window : global !== void 0 ? global : this;
let c1022_1, c1022_2;
const q = function q(a0) {
let r3, r4, r52;
let r35 = a0;
const r46 = Math.min(65536, a0.length + 1);
const uint16Array = new Uint16Array(r46);
const r51 = [];
let r6 = 0;
let r2 = 0;
while (true) {
L6: {
const r30 = r2 < r35.length;
const r0 = r6;
const r9 = r2;
const r38 = r35;
if (r30) {
const r1 = r46 - 1;
r4 = r9;
r52 = r38;
r3 = r0;
if (!(r1 <= r3)) {
break L6;
}
}
r51.push(String.fromCharCode.apply(null, uint16Array.subarray(0, r0)));
if (!r30) {
return r51.join("");
}
r52 = r38.subarray(r9);
r3 = 0;
r4 = 0;
}
const r61 = r4 + 1;
const r62 = r52[r4];
if (128 & r62) {
if ((224 & r62) === 192) {
r2 = r61 + 1;
const r97 = 63 & r52[r61];
r6 = r3 + 1;
uint16Array[r3] = (31 & r62) << 6 | r97;
r35 = r52;
} else if ((240 & r62) === 224) {
const r86 = r61 + 1;
const r88 = 63 & r52[r61];
r2 = r86 + 1;
const r90 = 63 & r52[r86];
r6 = r3 + 1;
uint16Array[r3] = (31 & r62) << 12 | r88 << 6 | r90;
r35 = r52;
} else {
const r66 = 248 & r62;
r6 = r3;
r2 = r61;
r35 = r52;
if (r66 === 240) {
const r67 = 7 & r62;
const r68 = r61 + 1;
const r7 = 63 & r52[r61];
const r70 = r68 + 1;
const r79 = r67 << 18 | r7 << 12 | (63 & r52[r68]) << 6 | 63 & r52[r70];
let r80 = r3;
let r81 = r79;
if (65535 < r81) {
const r82 = r79 - 65536;
r80 = r3 + 1;
uint16Array[r3] = r82 >>> 10 & 1023 | 55296;
r81 = 56320 | 1023 & r82;
}
r2 = r70 + 1;
r6 = r80 + 1;
uint16Array[r80] = r81;
r35 = r52;
}
}
} else {
r6 = r3 + 1;
uint16Array[r3] = r62;
r2 = r61;
r35 = r52;
}
}
};
if (!(r4.TextEncoder && r4.TextDecoder)) {
const m = function m() {};
const k = function k(a0, a1) {
const r3 = a0 !== void 0 ? a0 : "utf-8";
const r9 = a1 === void 0 ? {
fatal: false
} : a1;
if (c1022_1.indexOf(r3.toLowerCase()) === -1) {
throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('" + r3 + "') is invalid.");
}
if (r9.fatal) {
throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.");
}
};
c1022_1 = ["utf-8", "utf8", "unicode-1-1-utf-8"];
Object.defineProperty(m.prototype, "encoding", {
value: "utf-8"
});
m.prototype.encode = function(a0, a1) {
let r7, r75, r76, r77, r78;
if ((a1 === void 0 ? {
stream: false
} : a1).stream) {
throw Error("Failed to encode: the 'stream' option is unsupported.");
}
const length = a0.length;
let r62 = Math.max(32, length + (length >>> 1) + 7);
let r67 = new Uint8Array(r62 >>> 3 << 3);
const r40 = 0 < length;
let r8 = 0;
let r9 = 0;
let r68 = r67;
let r69 = 0;
if (r40) {
do {
L22: {
const charCodeAt = a0.charCodeAt;
const r3 = r9 + 1;
const r48 = charCodeAt.call(a0, r9);
const r54 = r67;
const r52 = r62;
const r6 = r8;
let r4 = r3;
let r51 = r48;
if (55296 <= r51) {
r51 = r48;
r4 = r3;
if (56319 >= r48) {
let r49 = r48;
let r1 = r3;
if (r3 < length) {
const r71 = a0.charCodeAt(r3);
const r0 = 64512 & r71;
r49 = r48;
r1 = r3;
if (r0 === 56320) {
r1 = r3 + 1;
r49 = ((1023 & r48) << 10) + (1023 & r71) + 65536;
}
}
r51 = r49;
r4 = r1;
if (55296 <= r49) {
r4 = r1;
r75 = r54;
r76 = r52;
r77 = r6;
r78 = r4;
r51 = r49;
if (56319 >= r51) {
break L22;
}
}
}
}
const length2 = r54.length;
const r79 = r6 + 4;
let r50 = r54;
let r80 = r52;
if (r79 > length2) {
const r88 = (r52 + 8) * (1 + r4 / a0.length * 2) >>> 3 << 3;
const uint8Array = new Uint8Array(r88);
uint8Array.set(r54);
r50 = uint8Array;
r80 = r88;
}
if (4294967168 & r51) {
if (4294965248 & r51) {
if (4294901760 & r51) {
const r109 = 4292870144 & r51;
r75 = r50;
r76 = r80;
r77 = r6;
r78 = r4;
if (r109) {
break L22;
}
const r110 = r6 + 1;
r50[r6] = r51 >>> 18 & 7 | 240;
const r114 = r110 + 1;
r50[r110] = r51 >>> 12 & 63 | 128;
r7 = r114 + 1;
r50[r114] = r51 >>> 6 & 63 | 128;
} else {
const r17 = r6 + 1;
r50[r6] = r51 >>> 12 & 15 | 224;
r7 = r17 + 1;
r50[r17] = r51 >>> 6 & 63 | 128;
}
} else {
r7 = r6 + 1;
r50[r6] = r51 >>> 6 & 31 | 192;
}
r77 = r7 + 1;
r50[r7] = 63 & r51 | 128;
r75 = r50;
r76 = r80;
r78 = r4;
} else {
r77 = r6 + 1;
r50[r6] = r51;
r75 = r50;
r76 = r80;
r78 = r4;
}
}
r67 = r75;
r62 = r76;
r8 = r77;
r9 = r78;
r68 = r67;
r69 = r8;
} while (r9 < length);
}
return r68.slice ? r68.slice(0, r69) : r68.subarray(0, r69);
};
Object.defineProperty(k.prototype, "encoding", {
value: "utf-8"
});
Object.defineProperty(k.prototype, "fatal", {
value: false
});
Object.defineProperty(k.prototype, "ignoreBOM", {
value: false
});
c1022_2 = q;
if (typeof globalThis.Buffer === "function" && Buffer.from) {
c1022_2 = function t(a0) {
return Buffer.from(a0.buffer, a0.byteOffset, a0.byteLength).toString("utf-8");
};
} else {
const Blob2 = globalThis.Blob;
if ((typeof Blob2 === "function" ? typeof globalThis.URL === "function" : typeof Blob2 === "function") && typeof URL.createObjectURL === "function") {
c1022_2 = function u(a0) {
let r33, responseText;
const objectURL = URL.createObjectURL(new Blob([a0], {
type: "text/plain;charset=UTF-8"
}));
L2: {
try {
try {
const xMLHttpRequest = new XMLHttpRequest();
xMLHttpRequest.open("GET", objectURL, false);
xMLHttpRequest.send();
responseText = xMLHttpRequest.responseText;
break L2;
} catch ($e) {
r33 = q(a0);
}
} catch (r37) {
URL.revokeObjectURL(objectURL);
throw r37;
}
URL.revokeObjectURL(objectURL);
return r33;
}
URL.revokeObjectURL(objectURL);
return responseText;
};
}
}
k.prototype.decode = function(a0, a1) {
if ((a1 === void 0 ? {
stream: false
} : a1).stream) {
throw Error("Failed to decode: the 'stream' option is unsupported.");
}
const r1 = a0 instanceof Uint8Array;
let r4 = a0;
if (!r1) {
const r13 = a0.buffer instanceof ArrayBuffer;
const r7 = Uint8Array;
r4 = r13 ? new r7(a0.buffer) : new r7(a0);
}
return c1022_2(r4);
};
r4.TextEncoder = m;
r4.TextDecoder = k;
}