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

2506 lines
67 KiB
JavaScript

// Metro module 511 (f512).
import { toByteArray, fromByteArray } from "./Module206";
import * as _Module512 from "./Module512";
import { read } from "./Module512";
let c493_3, from, allocUnsafe, fromArrayLike, byteLength, slowToString, bidirectionalIndexOf, arrayIndexOf, utf8Slice, c493_13, c493_14, utf8ToBytes, c493_16;
const Buffer2 = function(a0, a1, a2) {
if (typeof a0 === "number") {
if (typeof a1 === "string") {
throw new TypeError("The \"string\" argument must be of type string. Received type number");
}
return allocUnsafe(a0);
}
return from(a0, a1, a2);
};
from = function from(a0, a1, a2) {
let r68, r78;
if (typeof a0 === "string") {
const r262 = (typeof a1 === "string" ? a1 !== "" : typeof a1 === "string") ? a1 : "utf8";
if (Buffer2.isEncoding(r262)) {
const r277 = byteLength(a0, r262) | 0;
if (r277 > c493_3) {
throw new RangeError("The value \"" + r277 + "\" is invalid for option \"size\"");
}
const uint8Array3 = new Uint8Array(r277);
Object.setPrototypeOf(uint8Array3, Buffer2.prototype);
const r291 = uint8Array3.write(a0, r262);
return r291 !== r277 ? uint8Array3.slice(0, r291) : uint8Array3;
}
throw new TypeError("Unknown encoding: " + r262);
}
if (ArrayBuffer.isView(a0)) {
return fromArrayLike(a0);
}
if (a0 == null) {
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof a0);
}
const r26 = ArrayBuffer;
const r3 = a0 instanceof r26 || a0 != null && a0.constructor != null && a0.constructor.name != null && a0.constructor.name === r26.name;
L89: {
if (!r3) {
if (a0) {
const buffer = a0.buffer;
const r34 = ArrayBuffer;
if (buffer instanceof r34 || buffer != null && buffer.constructor != null && buffer.constructor.name != null && buffer.constructor.name === r34.name) {
break L89;
}
}
L42: {
if (typeof globalThis.SharedArrayBuffer !== "undefined") {
const r43 = SharedArrayBuffer;
if (!(a0 instanceof r43 || a0 != null && a0.constructor != null && a0.constructor.name != null && a0.constructor.name === r43.name)) {
if (!a0) {
break L42;
}
const buffer2 = a0.buffer;
const r53 = SharedArrayBuffer;
if (!(buffer2 instanceof r53 || buffer2 != null && buffer2.constructor != null && buffer2.constructor.name != null && buffer2.constructor.name === r53.name)) {
break L42;
}
}
if (!(a1 < 0) && !(a0.byteLength < a1)) {
if (a0.byteLength < a1 + (a2 ? a2 : 0)) {
throw new RangeError("\"length\" is outside of buffer bounds");
}
const r178 = a1 === void 0 && a2 === void 0 ? new Uint8Array(a0) : a2 === void 0 ? new Uint8Array(a0, a1) : new Uint8Array(a0, a1, a2);
Object.setPrototypeOf(r178, Buffer2.prototype);
return r178;
}
throw new RangeError("\"offset\" is outside of buffer bounds");
}
}
if (typeof a0 === "number") {
throw new TypeError("The \"value\" argument must not be of type number. Received type number");
}
const r62 = a0.valueOf && a0.valueOf();
if (r62 != null && r62 !== a0) {
return Buffer2.from(r62, a1, a2);
}
const isBuffer2 = Buffer2.isBuffer(a0);
const length = a0.length;
if (isBuffer2) {
if (length >= c493_3) {
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + c493_3.toString(16) + " bytes");
}
const r98 = length | 0 | 0;
if (r98 > c493_3) {
throw new RangeError("The value \"" + r98 + "\" is invalid for option \"size\"");
}
const uint8Array2 = new Uint8Array(r98);
Object.setPrototypeOf(uint8Array2, Buffer2.prototype);
const length3 = uint8Array2.length;
r68 = uint8Array2;
if (length3 !== 0) {
a0.copy(uint8Array2, 0, 0, r98);
r68 = uint8Array2;
}
} else if (length !== void 0) {
L57: {
if (typeof a0.length === "number") {
const length2 = a0.length;
if (length2 == length2) {
r78 = fromArrayLike(a0);
break L57;
}
}
if (0 > c493_3) {
throw new RangeError("The value \"" + 0 + "\" is invalid for option \"size\"");
}
const uint8Array = new Uint8Array(0);
Object.setPrototypeOf(uint8Array, Buffer2.prototype);
r78 = uint8Array;
}
r68 = r78;
} else {
r68 = a0.type === "Buffer" ? Array.isArray(a0.data) ? fromArrayLike(a0.data) : void 0 : void 0;
}
if (r68) {
return r68;
}
if (typeof globalThis.Symbol !== "undefined" && Symbol.toPrimitive != null && typeof a0[Symbol.toPrimitive] === "function") {
return Buffer2.from(a0[Symbol.toPrimitive]("string"), a1, a2);
}
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof a0);
}
}
if (!(a1 < 0) && !(a0.byteLength < a1)) {
if (a0.byteLength < a1 + (a2 ? a2 : 0)) {
throw new RangeError("\"length\" is outside of buffer bounds");
}
const r220 = a1 === void 0 && a2 === void 0 ? new Uint8Array(a0) : a2 === void 0 ? new Uint8Array(a0, a1) : new Uint8Array(a0, a1, a2);
Object.setPrototypeOf(r220, Buffer2.prototype);
return r220;
}
throw new RangeError("\"offset\" is outside of buffer bounds");
};
allocUnsafe = function allocUnsafe(a0) {
if (typeof a0 !== "number") {
throw new TypeError("\"size\" argument must be of type number");
}
if (a0 < 0) {
throw new RangeError("The value \"" + a0 + "\" is invalid for option \"size\"");
}
const r2 = a0 < 0;
let r12 = 0;
if (!r2) {
if (a0 >= c493_3) {
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + c493_3.toString(16) + " bytes");
}
r12 = a0 | 0 | 0;
}
if (r12 > c493_3) {
throw new RangeError("The value \"" + r12 + "\" is invalid for option \"size\"");
}
const uint8Array = new Uint8Array(r12);
Object.setPrototypeOf(uint8Array, Buffer2.prototype);
return uint8Array;
};
fromArrayLike = function fromArrayLike(data) {
const r5 = data.length < 0;
let r4 = 0;
if (!r5) {
const length = data.length;
if (length >= c493_3) {
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + c493_3.toString(16) + " bytes");
}
r4 = length | 0 | 0;
}
if (r4 > c493_3) {
throw new RangeError("The value \"" + r4 + "\" is invalid for option \"size\"");
}
const uint8Array = new Uint8Array(r4);
Object.setPrototypeOf(uint8Array, Buffer2.prototype);
let r39 = 0;
while (r39 < r4) {
uint8Array[r39] = 255 & data[r39];
r39 = r39 + 1;
}
return uint8Array;
};
byteLength = function byteLength(a0, a1) {
let r62;
if (Buffer2.isBuffer(a0)) {
return a0.length;
}
if (!ArrayBuffer.isView(a0)) {
const r30 = ArrayBuffer;
if (!(a0 instanceof r30 || a0 != null && a0.constructor != null && a0.constructor.name != null && a0.constructor.name === r30.name)) {
if (typeof a0 !== "string") {
throw new TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof a0);
}
const length = a0.length;
const r40 = arguments.length > 2 && arguments[2] === true;
let r44 = false;
let r45 = a1;
if (!r40) {
r44 = false;
r45 = a1;
if (length === 0) {
return 0;
}
}
while (true) {
const r46 = r44;
const r47 = r45;
switch (r47) {
case "ascii":
case "latin1":
case "binary":
return length;
case "utf8":
case "utf-8":
return utf8ToBytes(a0).length;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return 2 * length;
case "hex":
return length >>> 1;
case "base64":
const r21 = a0.split("=")[0].trim();
let r54 = "";
const r55 = r21.replace(c493_14, "");
if (!(r55.length < 2)) {
const r58 = r55.length % 4;
let r59 = r55;
let r60 = r59;
if (r58 !== 0) {
do {
const r61 = r59 + "=";
r62 = r61.length % 4;
r59 = r61;
r60 = r59;
} while (r62 !== 0);
}
r54 = r60;
}
return toByteArray(r54).length;
default:
if (r46) {
return r40 ? -1 : utf8ToBytes(a0).length;
}
r45 = ("" + r47).toLowerCase();
r44 = true;
}
}
}
}
return a0.byteLength;
};
slowToString = function slowToString(a0, a1, a2) {
let length;
const r13 = a1 === void 0 || a1 < 0 ? 0 : a1;
if (r13 > this.length) {
return "";
}
const r29 = a2 === void 0 || a2 > this.length ? this.length : a2;
if (r29 <= 0) {
return "";
}
const r6 = r29 >>> 0;
const r31 = r13 >>> 0;
if (r6 <= r31) {
return "";
}
let r32 = a0;
let r33 = false;
if (!a0) {
r32 = "utf8";
r33 = false;
}
while (true) {
const r10 = r33;
const r34 = r32;
switch (r34) {
case "hex":
const length2 = this.length;
let r90 = (r31 ? r31 < 0 : !r31) ? 0 : r31;
const r92 = (r6 ? r6 < 0 : !r6) || r6 > length2 ? length2 : r6;
const r93 = r90 < r92;
let r94 = "";
let r96 = "";
if (r93) {
do {
r94 = r94 + c493_16[this[r90]];
r90 = r90 + 1;
r96 = r94;
} while (r90 < r92);
}
return r96;
case "utf8":
case "utf-8":
return utf8Slice(this, r31, r6);
case "ascii":
const r74 = Math.min(this.length, r6);
const r75 = r31 < r74;
let r76 = "";
let r79 = r31;
let r80 = "";
if (r75) {
do {
r76 = r76 + String.fromCharCode(127 & this[r79]);
r79 = r79 + 1;
r80 = r76;
} while (r79 < r74);
}
return r80;
case "latin1":
case "binary":
const r60 = Math.min(this.length, r6);
const r61 = r31 < r60;
let r62 = "";
let r64 = r31;
let r65 = "";
if (r61) {
do {
r62 = r62 + String.fromCharCode(this[r64]);
r64 = r64 + 1;
r65 = r62;
} while (r64 < r60);
}
return r65;
case "base64":
return r31 === 0 && r6 === this.length ? fromByteArray(this) : fromByteArray(this.slice(r31, r6));
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
const r21 = this.slice(r31, r6);
const r9 = 0 < r21.length;
let r19 = "";
let r0 = 0;
let r37 = "";
if (r9) {
do {
r19 = r19 + String.fromCharCode(r21[r0] + 256 * r21[r0 + 1]);
r0 = r0 + 2;
length = r21.length;
r37 = r19;
} while (r0 < length);
}
return r37;
default:
if (r10) {
throw new TypeError("Unknown encoding: " + r34);
}
r32 = ("" + r34).toLowerCase();
r33 = true;
}
}
};
bidirectionalIndexOf = function bidirectionalIndexOf(a0, a1, a2, a3, a4) {
let r51;
if (a0.length === 0) {
return -1;
}
let r9 = a2;
let r20 = 0;
if (typeof a2 !== "string") {
const r4 = a2 > 2147483647;
r9 = a3;
r20 = 2147483647;
if (!r4) {
r9 = a3;
r20 = a2;
if (a2 < -2147483648) {
r9 = a3;
r20 = -2147483648;
}
}
}
let r23 = +r20;
if (r23 !== r23) {
r23 = a4 ? 0 : a0.length - 1;
}
let r8 = r23;
if (r8 < 0) {
r8 = a0.length + r23;
}
if (r8 >= a0.length) {
if (a4) {
return -1;
}
r8 = a0.length - 1;
} else if (r8 < 0) {
r8 = 0;
if (!a4) {
return -1;
}
}
const r31 = typeof a1 === "string" ? Buffer2.from(a1, r9) : a1;
if (Buffer2.isBuffer(r31)) {
return r31.length !== 0 ? arrayIndexOf(a0, r31, r8, r9, a4) : -1;
}
if (typeof r31 === "number") {
const r42 = r31 & 255;
if (typeof Uint8Array.prototype.indexOf === "function") {
const prototype = Uint8Array.prototype;
r51 = a4 ? prototype.indexOf.call(a0, r42, r8) : prototype.lastIndexOf.call(a0, r42, r8);
} else {
r51 = arrayIndexOf(a0, [r42], r8, r9, a4);
}
return r51;
}
throw new TypeError("val must be string, number or Buffer");
};
arrayIndexOf = function arrayIndexOf(a0, a1, a2, a3, a4) {
let r3, r6, r13, r14, r15, r43, r57, r59;
L8: {
const length2 = a0.length;
const length = a1.length;
r3 = 1;
r15 = length;
r14 = length2;
r6 = 1;
r13 = a2;
if (a3 !== void 0) {
const r24 = String(a3).toLowerCase();
if (r24 !== "ucs2" && r24 !== "ucs-2" && r24 !== "utf16le") {
r3 = 1;
r15 = length;
r14 = length2;
r6 = 1;
r13 = a2;
if (r24 !== "utf-16le") {
break L8;
}
}
if (!(a0.length < 2) && !(a1.length < 2)) {
r14 = length2 / 2;
r15 = length / 2;
r13 = a2 / 2;
r3 = 2;
r6 = 2;
break L8;
}
return -1;
}
}
if (a4) {
const r44 = r13 < r14;
let r46 = -1;
if (r44) {
do {
let r47 = r46;
const r48 = r13;
const r51 = r3 === 1 ? a0[r48] : a0.readUInt16BE(r48 * r3);
const r52 = r47 === -1;
const r53 = r52 ? 0 : r48 - r47;
if (r51 === (r3 === 1 ? a1[r53] : a1.readUInt16BE(r53 * r3))) {
if (r52) {
r47 = r48;
}
const r61 = r48 - r47 + 1;
r59 = r47;
r57 = r48;
if (r61 === r15) {
return r47 * r6;
}
} else {
r57 = r47 !== -1 ? r48 - (r48 - r47) : r48;
r59 = -1;
}
r13 = r57 + 1;
r46 = r59;
} while (r13 < r14);
}
} else {
let r33 = r13 + r15 > r14 ? r14 - r15 : r13;
while (r33 >= 0) {
const r10 = 0 < r15;
const r34 = r33;
let r35 = 0;
let r7 = true;
if (r10) {
do {
const r36 = r34 + r35;
const r0 = r35;
const r38 = r3 === 1 ? a0[r36] : a0.readUInt16BE(r36 * r3);
const r41 = r3 === 1 ? a1[r0] : a1.readUInt16BE(r0 * r3);
r7 = false;
if (r38 !== r41) {
break;
}
const r42 = r0 + 1;
r43 = r42 < r15;
r35 = r42;
r7 = true;
} while (r43);
}
if (r7) {
return r34;
}
r33 = r34 - 1;
}
}
return -1;
};
utf8Slice = function utf8Slice(a0, a1, a2) {
let r117;
let r7 = a1;
const r51 = Math.min(a0.length, a2);
const r52 = [];
const r35 = a1 < r51;
let r39 = void 0;
if (r35) {
do {
const r53 = a0[r7];
const r54 = r53 > 239;
const r38 = r39;
const r4 = r7;
const r3 = r54 ? 4 : r53 > 223 ? 3 : r53 > 191 ? 2 : 1;
const r34 = r4 + r3 <= r51;
let r58 = null;
let r59 = r38;
if (r34) {
if (r3 === 1) {
const r99 = r53 < 128;
r58 = null;
r59 = r38;
if (r99) {
r58 = r53;
r59 = r38;
}
} else if (r3 === 2) {
const r91 = a0[r4 + 1];
const r92 = 192 & r91;
let r93 = r92 === 128;
let r94 = r38;
if (r92 === 128) {
const r98 = (31 & r53) << 6 | 63 & r91;
r93 = r98 > 127;
r94 = r98;
}
r58 = null;
r59 = r94;
if (r93) {
r58 = r94;
r59 = r58;
}
} else if (r3 === 3) {
const r76 = a0[r4 + 1];
const r78 = a0[r4 + 2];
const r79 = 192 & r76;
let r80 = r79 === 128 ? (192 & r78) === 128 : r79 === 128;
let r82 = r38;
if (r80) {
const r89 = (15 & r53) << 12 | (63 & r76) << 6 | 63 & r78;
r80 = r89 > 2047;
r82 = r89;
}
if (r80) {
r80 = r82 < 55296 || r82 > 57343;
}
r58 = null;
r59 = r82;
if (r80) {
r58 = r82;
r59 = r58;
}
} else {
r58 = null;
r59 = r38;
if (r3 === 4) {
const r49 = a0[r4 + 1];
const r48 = a0[r4 + 2];
const r47 = a0[r4 + 3];
const r63 = 192 & r49;
let r33 = (r63 === 128 ? (192 & r48) === 128 : r63 === 128) && (192 & r47) === 128;
let r66 = r38;
if (r33) {
const r74 = (15 & r53) << 18 | (63 & r49) << 12 | (63 & r48) << 6 | 63 & r47;
r33 = r74 > 65535;
r66 = r74;
}
if (r33) {
r33 = r66 < 1114112;
}
r58 = null;
r59 = r66;
if (r33) {
r58 = r66;
r59 = r58;
}
}
}
}
let r100 = 1;
let r101 = 65533;
if (r58 !== null) {
r100 = r3;
r101 = r58;
if (r101 > 65535) {
const r102 = r58 - 65536;
r52.push(r102 >>> 10 & 1023 | 55296);
r101 = 56320 | 1023 & r102;
r100 = r3;
}
}
r52.push(r101);
r7 = r4 + r100;
r39 = r59;
} while (r7 < r51);
}
const length = r52.length;
if (length <= c493_13) {
r117 = String.fromCharCode.apply(String, r52);
} else {
let r114 = 0;
const r115 = 0 < length;
let r116 = "";
r117 = "";
if (r115) {
do {
const fromCharCode = String.fromCharCode;
const r120 = String;
const r123 = r114 + c493_13;
r116 = r116 + fromCharCode.apply(r120, r52.slice(r114, r123));
r117 = r116;
r114 = r123;
} while (r114 < length);
}
}
return r117;
};
utf8ToBytes = function utf8ToBytes(a0, a1) {
let r14, r34, r45, r58, r59;
let r36 = a1 ? a1 : Infinity;
const length = a0.length;
const r38 = [];
const r33 = 0 < length;
let r6 = 0;
let r39 = null;
if (r33) {
do {
L33: {
L18: {
const r43 = a0.charCodeAt(r6);
r14 = r6;
const r44 = r39;
const r35 = r36;
if (r43 > 55295 && r43 < 57344) {
if (r44) {
if (r43 < 56320) {
const r100 = r35 - 3;
r58 = r43;
r59 = r100;
if (!(-1 < r100)) {
break L33;
}
r38.push(239, 191, 189);
r58 = r43;
r59 = r100;
break L33;
}
r45 = 65536 + (r44 - 55296 << 10 | r43 - 56320);
r34 = r35;
break L18;
}
if (r43 > 56319) {
const r62 = r35 - 3;
r58 = r44;
r59 = r62;
if (!(-1 < r59)) {
break L33;
}
r38.push(239, 191, 189);
r58 = r44;
r59 = r62;
break L33;
}
const r57 = r14 + 1;
r58 = r43;
r59 = r35;
if (r57 !== length) {
break L33;
}
const r60 = r35 - 3;
r58 = r44;
r59 = r60;
if (!(-1 < r59)) {
break L33;
}
r38.push(239, 191, 189);
r58 = r44;
r59 = r60;
break L33;
}
let r53 = r44;
let r54 = r35;
if (r44) {
const r0 = r35 - 3;
r53 = r0 > -1;
r54 = r0;
}
r45 = r43;
r34 = r54;
if (r53) {
r38.push(239, 191, 189);
r45 = r43;
r34 = r54;
}
}
if (r45 < 128) {
const r97 = r34 - 1;
if (r97 < 0) {
break;
}
r38.push(r45);
r58 = null;
r59 = r97;
} else if (r45 < 2048) {
const r90 = r34 - 2;
if (r90 < 0) {
break;
}
r38.push(r45 >> 6 | 192, 63 & r45 | 128);
r58 = null;
r59 = r90;
} else if (r45 < 65536) {
const r80 = r34 - 3;
if (r80 < 0) {
break;
}
r38.push(r45 >> 12 | 224, r45 >> 6 & 63 | 128, 63 & r45 | 128);
r58 = null;
r59 = r80;
} else {
if (!(r45 < 1114112)) {
throw new Error("Invalid code point");
}
const r72 = r34 - 4;
if (r72 < 0) {
break;
}
r38.push(r45 >> 18 | 240, r45 >> 12 & 63 | 128, r45 >> 6 & 63 | 128, 63 & r45 | 128);
r58 = null;
r59 = r72;
}
}
r6 = r14 + 1;
r39 = r58;
r36 = r59;
} while (r6 < length);
}
return r38;
};
const r15 = typeof globalThis.Symbol === "function" ? typeof Symbol.for === "function" ? Symbol.for("nodejs.util.inspect.custom") : null : null;
export { Buffer2 as Buffer };
export function SlowBuffer(a0) {
return Buffer2.alloc(+(+a0 != a0 ? 0 : a0));
}
export const INSPECT_MAX_BYTES = 50;
c493_3 = 2147483647;
export const kMaxLength = 2147483647;
Buffer2.TYPED_ARRAY_SUPPORT = (function typedArraySupport() {
let r20;
try {
const uint8Array = new Uint8Array(1);
const r12 = {
foo: function foo() {
return 42;
}
};
Object.setPrototypeOf(r12, Uint8Array.prototype);
Object.setPrototypeOf(uint8Array, r12);
r20 = uint8Array.foo();
} catch ($e) {
return false;
}
return r20 === 42;
})();
if (!(Buffer2.TYPED_ARRAY_SUPPORT || typeof globalThis.console === "undefined" || typeof console.error !== "function")) {
console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
}
Object.defineProperty(Buffer2.prototype, "parent", {
enumerable: true,
get: function get() {
if (Buffer2.isBuffer(this)) {
return this.buffer;
}
}
});
Object.defineProperty(Buffer2.prototype, "offset", {
enumerable: true,
get: function get() {
if (Buffer2.isBuffer(this)) {
return this.byteOffset;
}
}
});
Buffer2.poolSize = 8192;
Buffer2.from = function(a0, a1, a2) {
return from(a0, a1, a2);
};
Object.setPrototypeOf(Buffer2.prototype, Uint8Array.prototype);
Object.setPrototypeOf(Buffer2, Uint8Array);
Buffer2.alloc = function(a0, a1, a2) {
let r17, r45;
if (typeof a0 !== "number") {
throw new TypeError("\"size\" argument must be of type number");
}
if (a0 < 0) {
throw new RangeError("The value \"" + a0 + "\" is invalid for option \"size\"");
}
if (a0 <= 0) {
if (a0 > c493_3) {
throw new RangeError("The value \"" + a0 + "\" is invalid for option \"size\"");
}
const uint8Array3 = new Uint8Array(a0);
Object.setPrototypeOf(uint8Array3, Buffer2.prototype);
r17 = uint8Array3;
} else if (a1 !== void 0) {
if (typeof a2 === "string") {
if (a0 > c493_3) {
throw new RangeError("The value \"" + a0 + "\" is invalid for option \"size\"");
}
const uint8Array2 = new Uint8Array(a0);
Object.setPrototypeOf(uint8Array2, Buffer2.prototype);
r45 = uint8Array2.fill(a1, a2);
} else {
if (a0 > c493_3) {
throw new RangeError("The value \"" + a0 + "\" is invalid for option \"size\"");
}
const uint8Array = new Uint8Array(a0);
Object.setPrototypeOf(uint8Array, Buffer2.prototype);
r45 = uint8Array.fill(a1);
}
r17 = r45;
} else {
if (a0 > c493_3) {
throw new RangeError("The value \"" + a0 + "\" is invalid for option \"size\"");
}
r17 = new Uint8Array(a0);
Object.setPrototypeOf(r17, Buffer2.prototype);
}
return r17;
};
Buffer2.allocUnsafe = function(a0) {
return allocUnsafe(a0);
};
Buffer2.allocUnsafeSlow = function(a0) {
return allocUnsafe(a0);
};
Buffer2.isBuffer = function isBuffer(a0) {
return a0 != null && a0._isBuffer === true && a0 !== Buffer2.prototype;
};
Buffer2.compare = function compare(a0, a1) {
const r10 = Uint8Array;
const r28 = a0 instanceof r10 || a0 != null && a0.constructor != null && a0.constructor.name != null && a0.constructor.name === r10.name ? Buffer2.from(a0, a0.offset, a0.byteLength) : a0;
const r29 = Uint8Array;
const r39 = a1 instanceof r29 || a1 != null && a1.constructor != null && a1.constructor.name != null && a1.constructor.name === r29.name ? Buffer2.from(a1, a1.offset, a1.byteLength) : a1;
if (Buffer2.isBuffer(r28) && Buffer2.isBuffer(r39)) {
if (r28 === r39) {
return 0;
}
const length = r28.length;
const length2 = r39.length;
const r57 = Math.min(length, length2);
const r58 = 0 < r57;
let r0 = 0;
let r59 = length2;
let r60 = length;
if (r58) {
do {
const r61 = r28[r0];
const r62 = r39[r0];
const r1 = r0;
if (r61 !== r62) {
r60 = r28[r1];
r59 = r39[r1];
break;
}
r0 = r1 + 1;
r59 = length2;
r60 = length;
} while (r0 < r57);
}
return r60 < r59 ? -1 : r59 < r60 ? 1 : 0;
}
throw new TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
};
Buffer2.isEncoding = function isEncoding(a0) {
switch (String(a0).toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "latin1":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return true;
default:
return false;
}
};
Buffer2.concat = function concat(a0, a1) {
let length;
if (Array.isArray(a0)) {
if (a0.length === 0) {
return Buffer2.alloc(0);
}
let r11 = a1;
if (a1 === void 0) {
const r28 = 0 < a0.length;
let r0 = 0;
let r29 = 0;
r11 = 0;
if (r28) {
do {
r29 = r29 + a0[r0].length;
r0 = r0 + 1;
length = a0.length;
r11 = r29;
} while (r0 < length);
}
}
const r35 = Buffer2.allocUnsafe(r11);
const r5 = 0 < a0.length;
let r39 = 0;
let r40 = 0;
if (r5) {
do {
const r17 = a0[r40];
const r41 = Uint8Array;
let r42 = r17 instanceof r41;
const r14 = r39;
const r2 = r40;
if (!r42) {
r42 = r17 != null && r17.constructor != null && r17.constructor.name != null && r17.constructor.name === r41.name;
}
const r48 = r42 ? Buffer2.from(r17) : r17;
if (!Buffer2.isBuffer(r48)) {
throw new TypeError("\"list\" argument must be an Array of Buffers");
}
r48.copy(r35, r14);
r39 = r14 + r48.length;
r40 = r2 + 1;
} while (r40 < a0.length);
}
return r35;
}
throw new TypeError("\"list\" argument must be an Array of Buffers");
};
Buffer2.byteLength = byteLength;
Buffer2.prototype._isBuffer = true;
Buffer2.prototype.swap16 = function swap16() {
const length = this.length;
if (length % 2 !== 0) {
throw new RangeError("Buffer size must be a multiple of 16-bits");
}
const r4 = 0 < length;
let r12 = 0;
if (r4) {
do {
const r1 = r12 + 1;
const r7 = this[r12];
this[r12] = this[r1];
this[r1] = r7;
r12 = r12 + 2;
} while (r12 < length);
}
return this;
};
Buffer2.prototype.swap32 = function swap32() {
const length = this.length;
if (length % 4 !== 0) {
throw new RangeError("Buffer size must be a multiple of 32-bits");
}
const r7 = 0 < length;
let r15 = 0;
if (r7) {
do {
const r1 = r15 + 3;
const r10 = this[r15];
this[r15] = this[r1];
this[r1] = r10;
const r2 = r15 + 1;
const r16 = r15 + 2;
const r17 = this[r2];
this[r2] = this[r16];
this[r16] = r17;
r15 = r15 + 4;
} while (r15 < length);
}
return this;
};
Buffer2.prototype.swap64 = function swap64() {
const length = this.length;
if (length % 8 !== 0) {
throw new RangeError("Buffer size must be a multiple of 64-bits");
}
const r11 = 0 < length;
let r19 = 0;
if (r11) {
do {
const r1 = r19 + 7;
const r14 = this[r19];
this[r19] = this[r1];
this[r1] = r14;
const r2 = r19 + 1;
const r20 = r19 + 6;
const r21 = this[r2];
this[r2] = this[r20];
this[r20] = r21;
const r23 = r19 + 2;
const r24 = r19 + 5;
const r25 = this[r23];
this[r23] = this[r24];
this[r24] = r25;
const r27 = r19 + 3;
const r28 = r19 + 4;
const r29 = this[r27];
this[r27] = this[r28];
this[r28] = r29;
r19 = r19 + 8;
} while (r19 < length);
}
return this;
};
Buffer2.prototype.toString = function toString() {
const length = this.length;
return length !== 0 ? arguments.length === 0 ? utf8Slice(this, 0, length) : slowToString.apply(this, arguments) : "";
};
Buffer2.prototype.toLocaleString = Buffer2.prototype.toString;
Buffer2.prototype.equals = function equals(a0) {
if (Buffer2.isBuffer(a0)) {
return this === a0 || Buffer2.compare(this, a0) === 0;
}
throw new TypeError("Argument must be a Buffer");
};
Buffer2.prototype.inspect = function inspect() {
const INSPECT_MAX_BYTES = exports.INSPECT_MAX_BYTES;
const r13 = this.toString("hex", 0, INSPECT_MAX_BYTES).replace(/(.{2})/g, "$1 ").trim();
return "<Buffer " + (this.length > INSPECT_MAX_BYTES ? r13 + " ... " : r13) + ">";
};
if (r15) {
Buffer2.prototype[r15] = Buffer2.prototype.inspect;
}
Buffer2.prototype.compare = function compare(a0, a1, a2, a3, a4) {
const r12 = Uint8Array;
const r29 = a0 instanceof r12 || a0 != null && a0.constructor != null && a0.constructor.name != null && a0.constructor.name === r12.name ? Buffer2.from(a0, a0.offset, a0.byteLength) : a0;
if (Buffer2.isBuffer(r29)) {
const r39 = a1 === void 0 ? 0 : a1;
const r41 = a2 === void 0 ? r29 ? r29.length : 0 : a2;
const r43 = a3 === void 0 ? 0 : a3;
const r45 = a4 === void 0 ? this.length : a4;
if (!(r39 < 0) && !(r41 > r29.length) && !(r43 < 0) && !(r45 > this.length)) {
if (r43 >= r45 && r39 >= r41) {
return 0;
}
if (r43 >= r45) {
return -1;
}
if (r39 >= r41) {
return 1;
}
if (this === r29) {
return 0;
}
const r6 = r45 >>> 0;
const r2 = r43 >>> 0;
const r3 = r6 - r2;
const r0 = r41 >>> 0;
const r1 = r39 >>> 0;
const r4 = r0 - r1;
const r50 = Math.min(r3, r4);
const r52 = this.slice(r2, r6);
const r54 = r29.slice(r1, r0);
const r55 = 0 < r50;
let r57 = 0;
let r58 = r4;
let r59 = r3;
if (r55) {
do {
const r60 = r52[r57];
const r61 = r54[r57];
const r62 = r57;
if (r60 !== r61) {
r59 = r52[r62];
r58 = r54[r62];
break;
}
r57 = r62 + 1;
r58 = r4;
r59 = r3;
} while (r57 < r50);
}
return r59 < r58 ? -1 : r58 < r59 ? 1 : 0;
}
throw new RangeError("out of range index");
}
throw new TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof r29);
};
Buffer2.prototype.includes = function includes(a0, a1, a2) {
return this.indexOf(a0, a1, a2) !== -1;
};
Buffer2.prototype.indexOf = function indexOf(a0, a1, a2) {
return bidirectionalIndexOf(this, a0, a1, a2, true);
};
Buffer2.prototype.lastIndexOf = function lastIndexOf(a0, a1, a2) {
return bidirectionalIndexOf(this, a0, a1, a2, false);
};
Buffer2.prototype.write = function write(a0, a1, a2, a3) {
let r4, r37, r94, r203, length, length10, length12, length4, length6, length8;
L10: {
if (a1 === void 0) {
length = this.length;
r37 = "utf8";
r4 = 0;
} else {
if (a2 === void 0 && typeof a1 === "string") {
length = this.length;
r4 = 0;
r37 = a1;
break L10;
}
if (!isFinite(a1)) {
throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
}
const r7 = a1 >>> 0;
const isFinite2 = isFinite(a2);
r37 = a2;
length = void 0;
r4 = r7;
if (isFinite2) {
r37 = a3;
length = a2 >>> 0;
r4 = r7;
if (a3 === void 0) {
r37 = "utf8";
length = length;
r4 = r7;
}
}
}
}
const r41 = this.length - r4;
if (length === void 0 || length > r41) {
length = r41;
}
L84: {
if (a0.length > 0) {
if (length < 0) {
break L84;
}
if (r4 < 0) {
break L84;
}
}
if (!(r4 > this.length)) {
if (!r37) {
r37 = "utf8";
}
let r10 = false;
while (true) {
const r14 = r10;
const r46 = r37;
switch (r46) {
case "hex":
const r184 = Number(r4) || 0;
const r186 = this.length - r184;
let r187 = r186;
if (length) {
r187 = Number(length);
if (r187 > r186) {
r187 = r186;
}
}
const length13 = a0.length;
if (r187 > length13 / 2) {
r187 = length13 / 2;
}
L80: {
const r192 = 0 < r187;
let r195 = 0;
let r196 = 0;
if (r192) {
do {
const r201 = parseInt(a0.substr(2 * r195, 2), 16);
const r202 = r195;
r203 = r202;
if (r201 != r201) {
break L80;
}
this[r184 + r202] = r201;
r195 = r202 + 1;
r196 = r195;
} while (r196 < r187);
}
r203 = r196;
}
return r203;
case "utf8":
case "utf-8":
const r166 = utf8ToBytes(a0, this.length - r4);
const r167 = 0 < length;
let r168 = 0;
if (r167) {
const r171 = 0 + r4 >= this.length;
r168 = 0;
if (!r171) {
const r173 = 0 >= r166.length;
let r175 = 0;
r168 = 0;
if (!r173) {
do {
this[r175 + r4] = r166[r175];
const r178 = r175 + 1;
r168 = r178;
if (!(r178 < length)) {
break;
}
const length11 = this.length;
const r180 = r178 + r4;
r168 = r178;
if (r180 >= length11) {
break;
}
length12 = r166.length;
r175 = r178;
r168 = r175;
} while (!(r168 >= length12));
}
}
}
return r168;
case "ascii":
const r137 = [];
const r139 = 0 < a0.length;
let r142 = 0;
if (r139) {
do {
r137.push(255 & a0.charCodeAt(r142));
r142 = r142 + 1;
} while (r142 < a0.length);
}
const r149 = 0 < length;
let r150 = 0;
if (r149) {
const r153 = 0 + r4 >= this.length;
r150 = 0;
if (!r153) {
const r155 = 0 >= r137.length;
let r156 = 0;
r150 = 0;
if (!r155) {
do {
this[r156 + r4] = r137[r156];
const r159 = r156 + 1;
r150 = r159;
if (!(r159 < length)) {
break;
}
const length9 = this.length;
const r161 = r159 + r4;
r150 = r159;
if (r161 >= length9) {
break;
}
length10 = r137.length;
r156 = r159;
r150 = r156;
} while (!(r150 >= length10));
}
}
}
return r150;
case "latin1":
case "binary":
const r111 = [];
const r113 = 0 < a0.length;
let r116 = 0;
if (r113) {
do {
r111.push(255 & a0.charCodeAt(r116));
r116 = r116 + 1;
} while (r116 < a0.length);
}
const r123 = 0 < length;
let r124 = 0;
if (r123) {
const r127 = 0 + r4 >= this.length;
r124 = 0;
if (!r127) {
const r129 = 0 >= r111.length;
let r130 = 0;
r124 = 0;
if (!r129) {
do {
this[r130 + r4] = r111[r130];
const r133 = r130 + 1;
r124 = r133;
if (!(r133 < length)) {
break;
}
const length7 = this.length;
const r135 = r133 + r4;
r124 = r133;
if (r135 >= length7) {
break;
}
length8 = r111.length;
r130 = r133;
r124 = r130;
} while (!(r124 >= length8));
}
}
}
return r124;
case "base64":
const r27 = a0.split("=")[0].trim();
let r83 = "";
const r84 = r27.replace(c493_14, "");
if (!(r84.length < 2)) {
const r90 = r84.length % 4;
let r91 = r84;
let r92 = r91;
if (r90 !== 0) {
do {
const r93 = r91 + "=";
r94 = r93.length % 4;
r91 = r93;
r92 = r91;
} while (r94 !== 0);
}
r83 = r92;
}
const r95 = toByteArray(r83);
const r96 = 0 < length;
let r97 = 0;
if (r96) {
const r100 = 0 + r4 >= this.length;
r97 = 0;
if (!r100) {
const r102 = 0 >= r95.length;
let r104 = 0;
r97 = 0;
if (!r102) {
do {
this[r104 + r4] = r95[r104];
const r107 = r104 + 1;
r97 = r107;
if (!(r107 < length)) {
break;
}
const length5 = this.length;
const r109 = r107 + r4;
r97 = r107;
if (r109 >= length5) {
break;
}
length6 = r95.length;
r104 = r107;
r97 = r104;
} while (!(r97 >= length6));
}
}
}
return r97;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
const r48 = this.length - r4;
const r49 = [];
if (0 < a0.length) {
let r5 = r48 - 2;
let r51 = 0;
while (!(r5 < 0)) {
const r53 = a0.charCodeAt(r51);
const r6 = r53 >> 8;
r49.push(r53 % 256);
r49.push(r6);
const r58 = r51 + 1;
const length2 = a0.length;
const r60 = r5;
if (!(r58 < length2)) {
break;
}
r5 = r60 - 2;
r51 = r58;
}
}
const r12 = 0 < length;
let r61 = 0;
if (r12) {
const r64 = 0 + r4 >= this.length;
r61 = 0;
if (!r64) {
const r66 = 0 >= r49.length;
let r68 = 0;
r61 = 0;
if (!r66) {
do {
this[r68 + r4] = r49[r68];
const r71 = r68 + 1;
r61 = r71;
if (!(r71 < length)) {
break;
}
const length3 = this.length;
const r73 = r71 + r4;
r61 = r71;
if (r73 >= length3) {
break;
}
length4 = r49.length;
r68 = r71;
r61 = r68;
} while (!(r61 >= length4));
}
}
}
return r61;
default:
if (r14) {
throw new TypeError("Unknown encoding: " + r46);
}
r37 = ("" + r46).toLowerCase();
r10 = true;
}
}
}
}
throw new RangeError("Attempt to write outside buffer bounds");
};
Buffer2.prototype.toJSON = function toJSON() {
return {
type: "Buffer",
data: Array.prototype.slice.call(this._arr || this, 0)
};
};
c493_13 = 4096;
Buffer2.prototype.slice = function slice(a0, a1) {
let r5, r11;
const length = this.length;
const r8 = ~~a0;
if (r8 < 0) {
r5 = r8 + length;
if (r5 < 0) {
r5 = 0;
}
} else {
r5 = r8;
if (r5 > length) {
r5 = length;
}
}
const r9 = a1 !== void 0 ? ~~a1 : length;
if (r9 < 0) {
r11 = r9 + length;
if (r11 < 0) {
r11 = 0;
}
} else {
r11 = r9;
if (r11 > length) {
r11 = length;
}
}
if (r11 < r5) {
r11 = r5;
}
const r14 = this.subarray(r5, r11);
Object.setPrototypeOf(r14, Buffer2.prototype);
return r14;
};
Buffer2.prototype.readUIntLE = function readUIntLE(a0, a1, a2) {
let r4, r7;
L6: {
r4 = a0 >>> 0;
r7 = a1 >>> 0;
if (!a2) {
const length = this.length;
if (r4 % 1 === 0 && !(r4 < 0)) {
if (!(r4 + r7 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
let r29 = this[r4];
let r30 = 256;
let r31 = r29;
let r32 = 1;
if (1 < r7) {
do {
const r35 = r29 + this[r4 + r32] * r30;
const r3 = r32 + 1;
const r36 = r30;
r31 = r35;
if (!(r3 < r7)) {
break;
}
r30 = r36 * 256;
r32 = r3;
r29 = r35;
r31 = r29;
} while (r30);
}
return r31;
};
Buffer2.prototype.readUIntBE = function readUIntBE(a0, a1, a2) {
let r0, r5;
L6: {
r5 = a0 >>> 0;
r0 = a1 >>> 0;
if (!a2) {
const length = this.length;
if (r5 % 1 === 0 && !(r5 < 0)) {
if (!(r5 + r0 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
let r2 = r0 - 1;
let r30 = this[r5 + r2];
let r32 = 256;
let r33 = r30;
if (0 < r2) {
do {
const r3 = r2 - 1;
const r36 = r30 + this[r5 + r3] * r32;
const r37 = r32;
r33 = r36;
if (!(0 < r3)) {
break;
}
r32 = r37 * 256;
r30 = r36;
r2 = r3;
r33 = r30;
} while (r32);
}
return r33;
};
Buffer2.prototype.readUInt8 = function readUInt8(a0, a1) {
let r1;
L6: {
r1 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r1 % 1 === 0 && !(r1 < 0)) {
if (!(r1 + 1 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return this[r1];
};
Buffer2.prototype.readUInt16LE = function readUInt16LE(a0, a1) {
let r1;
L6: {
r1 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r1 % 1 === 0 && !(r1 < 0)) {
if (!(r1 + 2 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return this[r1] | this[r1 + 1] << 8;
};
Buffer2.prototype.readUInt16BE = function readUInt16BE(a0, a1) {
let r2;
L6: {
r2 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r2 % 1 === 0 && !(r2 < 0)) {
if (!(r2 + 2 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return this[r2] << 8 | this[r2 + 1];
};
Buffer2.prototype.readUInt32LE = function readUInt32LE(a0, a1) {
let r2;
L6: {
r2 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r2 % 1 === 0 && !(r2 < 0)) {
if (!(r2 + 4 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return (this[r2] | this[r2 + 1] << 8 | this[r2 + 2] << 16) + 16777216 * this[r2 + 3];
};
Buffer2.prototype.readUInt32BE = function readUInt32BE(a0, a1) {
let r1;
L6: {
r1 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r1 % 1 === 0 && !(r1 < 0)) {
if (!(r1 + 4 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return 16777216 * this[r1] + (this[r1 + 1] << 16 | this[r1 + 2] << 8 | this[r1 + 3]);
};
Buffer2.prototype.readIntLE = function readIntLE(a0, a1, a2) {
let r5, r8;
L6: {
r5 = a0 >>> 0;
r8 = a1 >>> 0;
if (!a2) {
const length = this.length;
if (r5 % 1 === 0 && !(r5 < 0)) {
if (!(r5 + r8 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
let r31 = this[r5];
let r2 = 1;
let r32 = 256;
let r33 = r31;
let r34 = 1;
if (1 < r8) {
do {
const r37 = r31 + this[r5 + r2] * r32;
const r4 = r2 + 1;
const r38 = r32;
r34 = r38;
r33 = r37;
if (!(r4 < r8)) {
break;
}
r32 = r38 * 256;
r2 = r4;
r31 = r37;
r33 = r31;
r34 = r32;
} while (r34);
}
const r40 = r34 * 128;
let r41 = r33;
if (r41 >= r40) {
r41 = r33 - Math.pow(2, 8 * r8);
}
return r41;
};
Buffer2.prototype.readIntBE = function readIntBE(a0, a1, a2) {
let r5, r8;
L6: {
r5 = a0 >>> 0;
r8 = a1 >>> 0;
if (!a2) {
const length = this.length;
if (r5 % 1 === 0 && !(r5 < 0)) {
if (!(r5 + r8 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
let r2 = r8 - 1;
let r33 = this[r5 + r2];
let r34 = 256;
let r35 = r33;
let r4 = 1;
if (0 < r2) {
do {
const r3 = r2 - 1;
const r38 = r33 + this[r5 + r3] * r34;
const r39 = r34;
r35 = r38;
r4 = r39;
if (!(0 < r3)) {
break;
}
r34 = r39 * 256;
r33 = r38;
r2 = r3;
r35 = r33;
r4 = r34;
} while (r4);
}
const r41 = r4 * 128;
let r42 = r35;
if (r42 >= r41) {
r42 = r35 - Math.pow(2, 8 * r8);
}
return r42;
};
Buffer2.prototype.readInt8 = function readInt8(a0, a1) {
let r1;
L6: {
r1 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r1 % 1 === 0 && !(r1 < 0)) {
if (!(r1 + 1 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
const r25 = 128 & this[r1];
const r26 = this[r1];
return r25 ? -1 * (255 - r26 + 1) : r26;
};
Buffer2.prototype.readInt16LE = function readInt16LE(a0, a1) {
let r1;
L6: {
r1 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r1 % 1 === 0 && !(r1 < 0)) {
if (!(r1 + 2 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
const r30 = this[r1] | this[r1 + 1] << 8;
return 32768 & r30 ? 4294901760 | r30 : r30;
};
Buffer2.prototype.readInt16BE = function readInt16BE(a0, a1) {
let r0;
L6: {
r0 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r0 % 1 === 0 && !(r0 < 0)) {
if (!(r0 + 2 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
const r30 = this[r0 + 1] | this[r0] << 8;
return 32768 & r30 ? 4294901760 | r30 : r30;
};
Buffer2.prototype.readInt32LE = function readInt32LE(a0, a1) {
let r2;
L6: {
r2 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r2 % 1 === 0 && !(r2 < 0)) {
if (!(r2 + 4 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return this[r2] | this[r2 + 1] << 8 | this[r2 + 2] << 16 | this[r2 + 3] << 24;
};
Buffer2.prototype.readInt32BE = function readInt32BE(a0, a1) {
let r2;
L6: {
r2 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r2 % 1 === 0 && !(r2 < 0)) {
if (!(r2 + 4 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return this[r2] << 24 | this[r2 + 1] << 16 | this[r2 + 2] << 8 | this[r2 + 3];
};
Buffer2.prototype.readFloatLE = function readFloatLE(a0, a1) {
let r2;
L6: {
r2 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r2 % 1 === 0 && !(r2 < 0)) {
if (!(r2 + 4 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return read(this, r2, true, 23, 4);
};
Buffer2.prototype.readFloatBE = function readFloatBE(a0, a1) {
let r2;
L6: {
r2 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r2 % 1 === 0 && !(r2 < 0)) {
if (!(r2 + 4 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return read(this, r2, false, 23, 4);
};
Buffer2.prototype.readDoubleLE = function readDoubleLE(a0, a1) {
let r2;
L6: {
r2 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r2 % 1 === 0 && !(r2 < 0)) {
if (!(r2 + 8 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return read(this, r2, true, 52, 8);
};
Buffer2.prototype.readDoubleBE = function readDoubleBE(a0, a1) {
let r2;
L6: {
r2 = a0 >>> 0;
if (!a1) {
const length = this.length;
if (r2 % 1 === 0 && !(r2 < 0)) {
if (!(r2 + 8 > length)) {
break L6;
}
throw new RangeError("Trying to access beyond buffer length");
}
throw new RangeError("offset is not uint");
}
}
return read(this, r2, false, 52, 8);
};
Buffer2.prototype.writeUIntLE = function writeUIntLE(a0, a1, a2, a3) {
let r5, r6, r9;
L8: {
r6 = +a0;
r5 = a1 >>> 0;
r9 = a2 >>> 0;
if (!a3) {
const r25 = Math.pow(2, 8 * r9) - 1;
if (Buffer2.isBuffer(this)) {
if (!(r25 < r6) && !(r6 < 0)) {
if (!(r5 + r9 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r5] = 255 & r6;
let r49 = 256;
let r50 = 1;
if (1 < r9) {
do {
this[r5 + r50] = r6 / r49 & 255;
const r52 = r50 + 1;
const r53 = r49;
if (!(r52 < r9)) {
break;
}
r49 = r53 * 256;
r50 = r52;
} while (r49);
}
return r5 + r9;
};
Buffer2.prototype.writeUIntBE = function writeUIntBE(a0, a1, a2, a3) {
let r5, r7, r9;
L8: {
r7 = +a0;
r5 = a1 >>> 0;
r9 = a2 >>> 0;
if (!a3) {
const r26 = Math.pow(2, 8 * r9) - 1;
if (Buffer2.isBuffer(this)) {
if (!(r26 < r7) && !(r7 < 0)) {
if (!(r5 + r9 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
const r48 = r9 - 1;
this[r5 + r48] = 255 & r7;
let r50 = r48 - 1;
let r52 = 256;
if (0 <= r50) {
do {
this[r5 + r50] = r7 / r52 & 255;
const r54 = r50 - 1;
const r55 = r52;
if (!(0 <= r54)) {
break;
}
r52 = r55 * 256;
r50 = r54;
} while (r52);
}
return r5 + r9;
};
Buffer2.prototype.writeUInt8 = function writeUInt8(a0, a1, a2) {
let r1, r2;
L8: {
r2 = +a0;
r1 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(255 < r2) && !(r2 < 0)) {
if (!(r1 + 1 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r1] = 255 & r2;
return r1 + 1;
};
Buffer2.prototype.writeUInt16LE = function writeUInt16LE(a0, a1, a2) {
let r1, r2;
L8: {
r1 = +a0;
r2 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(65535 < r1) && !(r1 < 0)) {
if (!(r2 + 2 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r2] = 255 & r1;
this[r2 + 1] = r1 >>> 8;
return r2 + 2;
};
Buffer2.prototype.writeUInt16BE = function writeUInt16BE(a0, a1, a2) {
let r1, r2;
L8: {
r1 = +a0;
r2 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(65535 < r1) && !(r1 < 0)) {
if (!(r2 + 2 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r2] = r1 >>> 8;
this[r2 + 1] = 255 & r1;
return r2 + 2;
};
Buffer2.prototype.writeUInt32LE = function writeUInt32LE(a0, a1, a2) {
let r1, r2;
L8: {
r2 = +a0;
r1 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(4294967295 < r2) && !(r2 < 0)) {
if (!(r1 + 4 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r1 + 3] = r2 >>> 24;
this[r1 + 2] = r2 >>> 16;
this[r1 + 1] = r2 >>> 8;
this[r1] = 255 & r2;
return r1 + 4;
};
Buffer2.prototype.writeUInt32BE = function writeUInt32BE(a0, a1, a2) {
let r1, r2;
L8: {
r1 = +a0;
r2 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(4294967295 < r1) && !(r1 < 0)) {
if (!(r2 + 4 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r2] = r1 >>> 24;
this[r2 + 1] = r1 >>> 16;
this[r2 + 2] = r1 >>> 8;
this[r2 + 3] = 255 & r1;
return r2 + 4;
};
Buffer2.prototype.writeIntLE = function writeIntLE(a0, a1, a2, a3) {
let r9, r10;
L8: {
r10 = +a0;
r9 = a1 >>> 0;
if (!a3) {
const r32 = Math.pow(2, 8 * a2 - 1);
const r33 = r32 - 1;
const r34 = -r32;
if (Buffer2.isBuffer(this)) {
if (!(r33 < r10) && !(r10 < r34)) {
if (!(r9 + a2 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r9] = 255 & r10;
const r14 = 1 < a2;
const r15 = r10 < 0;
let r56 = 0;
let r57 = 256;
let r58 = 1;
if (r14) {
do {
let r0 = r56;
const r7 = r57;
const r2 = r58;
if ((r10 < 0 ? r0 === 0 : r15) && this[r9 + r2 - 1] !== 0) {
r0 = 1;
}
this[r9 + r2] = (r10 / r7 | 0) - r0 & 255;
const r66 = r2 + 1;
if (!(r66 < a2)) {
break;
}
r57 = r7 * 256;
r56 = r0;
r58 = r66;
} while (r57);
}
return r9 + a2;
};
Buffer2.prototype.writeIntBE = function writeIntBE(a0, a1, a2, a3) {
let r9, r11;
L8: {
r11 = +a0;
r9 = a1 >>> 0;
if (!a3) {
const r32 = Math.pow(2, 8 * a2 - 1);
const r33 = r32 - 1;
const r34 = -r32;
if (Buffer2.isBuffer(this)) {
if (!(r33 < r11) && !(r11 < r34)) {
if (!(r9 + a2 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
const r55 = a2 - 1;
this[r9 + r55] = 255 & r11;
let r5 = r55 - 1;
const r15 = r11 < 0;
let r59 = 256;
let r60 = 0;
if (0 <= r5) {
do {
let r0 = r60;
const r7 = r59;
const r2 = r5;
if ((r11 < 0 ? r0 === 0 : r15) && this[r9 + r2 + 1] !== 0) {
r0 = 1;
}
this[r9 + r2] = (r11 / r7 | 0) - r0 & 255;
const r67 = r2 - 1;
if (!(0 <= r67)) {
break;
}
r59 = r7 * 256;
r60 = r0;
r5 = r67;
} while (r59);
}
return r9 + a2;
};
Buffer2.prototype.writeInt8 = function writeInt8(a0, a1, a2) {
let r2, r3;
L8: {
r2 = +a0;
r3 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(127 < r2) && !(r2 < -128)) {
if (!(r3 + 1 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
let r38 = r2;
if (r38 < 0) {
r38 = 255 + r2 + 1;
}
this[r3] = 255 & r38;
return r3 + 1;
};
Buffer2.prototype.writeInt16LE = function writeInt16LE(a0, a1, a2) {
let r1, r2;
L8: {
r1 = +a0;
r2 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(32767 < r1) && !(r1 < -32768)) {
if (!(r2 + 2 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r2] = 255 & r1;
this[r2 + 1] = r1 >>> 8;
return r2 + 2;
};
Buffer2.prototype.writeInt16BE = function writeInt16BE(a0, a1, a2) {
let r1, r2;
L8: {
r1 = +a0;
r2 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(32767 < r1) && !(r1 < -32768)) {
if (!(r2 + 2 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r2] = r1 >>> 8;
this[r2 + 1] = 255 & r1;
return r2 + 2;
};
Buffer2.prototype.writeInt32LE = function writeInt32LE(a0, a1, a2) {
let r1, r2;
L8: {
r1 = +a0;
r2 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(2147483647 < r1) && !(r1 < -2147483648)) {
if (!(r2 + 4 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
this[r2] = 255 & r1;
this[r2 + 1] = r1 >>> 8;
this[r2 + 2] = r1 >>> 16;
this[r2 + 3] = r1 >>> 24;
return r2 + 4;
};
Buffer2.prototype.writeInt32BE = function writeInt32BE(a0, a1, a2) {
let r2, r4;
L8: {
r4 = +a0;
r2 = a1 >>> 0;
if (!a2) {
if (Buffer2.isBuffer(this)) {
if (!(2147483647 < r4) && !(r4 < -2147483648)) {
if (!(r2 + 4 > this.length)) {
break L8;
}
throw new RangeError("Index out of range");
}
throw new RangeError("\"value\" argument is out of bounds");
}
throw new TypeError("\"buffer\" argument must be a Buffer instance");
}
}
let r38 = r4;
if (r38 < 0) {
r38 = 4294967295 + r4 + 1;
}
this[r2] = r38 >>> 24;
this[r2 + 1] = r38 >>> 16;
this[r2 + 2] = r38 >>> 8;
this[r2 + 3] = 255 & r38;
return r2 + 4;
};
Buffer2.prototype.writeFloatLE = function writeFloatLE(a0, a1, a2) {
const r3 = +a0;
const r2 = a1 >>> 0;
if (!a2) {
if (r2 + 4 > this.length) {
throw new RangeError("Index out of range");
}
if (r2 < 0) {
throw new RangeError("Index out of range");
}
}
_Module512.write(this, r3, r2, true, 23, 4);
return r2 + 4;
};
Buffer2.prototype.writeFloatBE = function writeFloatBE(a0, a1, a2) {
const r3 = +a0;
const r2 = a1 >>> 0;
if (!a2) {
if (r2 + 4 > this.length) {
throw new RangeError("Index out of range");
}
if (r2 < 0) {
throw new RangeError("Index out of range");
}
}
_Module512.write(this, r3, r2, false, 23, 4);
return r2 + 4;
};
Buffer2.prototype.writeDoubleLE = function writeDoubleLE(a0, a1, a2) {
const r3 = +a0;
const r2 = a1 >>> 0;
if (!a2) {
if (r2 + 8 > this.length) {
throw new RangeError("Index out of range");
}
if (r2 < 0) {
throw new RangeError("Index out of range");
}
}
_Module512.write(this, r3, r2, true, 52, 8);
return r2 + 8;
};
Buffer2.prototype.writeDoubleBE = function writeDoubleBE(a0, a1, a2) {
const r3 = +a0;
const r2 = a1 >>> 0;
if (!a2) {
if (r2 + 8 > this.length) {
throw new RangeError("Index out of range");
}
if (r2 < 0) {
throw new RangeError("Index out of range");
}
}
_Module512.write(this, r3, r2, false, 52, 8);
return r2 + 8;
};
Buffer2.prototype.copy = function copy(a0, a1, a2, a3) {
let r38;
if (Buffer2.isBuffer(a0)) {
const r11 = a2 ? a2 : 0;
let r10 = (a3 ? a3 : a3 === 0) ? a3 : this.length;
const r27 = (a1 >= a0.length ? a0.length : a1) || 0;
if (r10 > 0 && r10 < r11) {
r10 = r11;
}
if (r10 === r11) {
return 0;
}
if (a0.length !== 0 && this.length !== 0) {
if (r27 < 0) {
throw new RangeError("targetStart out of bounds");
}
if (!(r11 < 0) && !(r11 >= this.length)) {
if (r10 < 0) {
throw new RangeError("sourceEnd out of bounds");
}
if (r10 > this.length) {
r10 = this.length;
}
if (a0.length - r27 < r10 - r11) {
r10 = a0.length - r27 + r11;
}
L39: {
r38 = r10 - r11;
const r39 = this === a0;
if (r39 && typeof Uint8Array.prototype.copyWithin === "function") {
this.copyWithin(r27, r11, r10);
} else {
if (r39 && r11 < r27 && r27 < r10) {
let r0 = r38 - 1;
if (!(0 <= r0)) {
break L39;
}
while (true) {
a0[r0 + r27] = this[r0 + r11];
r0 = r0 - 1;
if (!(0 <= r0)) {
break L39;
}
}
}
Uint8Array.prototype.set.call(a0, this.subarray(r11, r10), r27);
}
}
return r38;
}
throw new RangeError("Index out of range");
}
return 0;
}
throw new TypeError("argument should be a Buffer");
};
Buffer2.prototype.fill = function fill(a0, a1, a2, a3) {
let r8, r9, r11, r13, r14, length;
let r16 = a3;
if (typeof a0 === "string") {
if (typeof a1 === "string") {
length = this.length;
r14 = 0;
r16 = a1;
} else {
length = a2;
r14 = a1;
if (typeof a2 === "string") {
length = this.length;
r16 = a2;
r14 = a1;
}
}
if (r16 !== void 0 && typeof r16 !== "string") {
throw new TypeError("encoding must be a string");
}
if (typeof r16 === "string" && !Buffer2.isEncoding(r16)) {
throw new TypeError("Unknown encoding: " + r16);
}
const length2 = a0.length;
r13 = r16;
r8 = length;
r11 = r14;
r9 = a0;
if (length2 === 1) {
const r38 = a0.charCodeAt(0);
const r40 = r16 === "utf8" && r38 < 128 || r16 === "latin1";
r13 = r16;
r8 = length;
r11 = r14;
r9 = a0;
if (r40) {
r13 = r16;
r8 = length;
r11 = r14;
r9 = r38;
}
}
} else if (typeof a0 === "number") {
r9 = a0 & 255;
r13 = a3;
r8 = a2;
r11 = a1;
} else {
r13 = a3;
r8 = a2;
r11 = a1;
r9 = a0;
if (typeof a0 === "boolean") {
r9 = Number(a0);
r13 = a3;
r8 = a2;
r11 = a1;
}
}
if (!(r11 < 0) && !(this.length < r11) && !(this.length < r8)) {
if (r8 <= r11) {
return this;
}
let r1 = r11 >>> 0;
const r46 = r8 === void 0 ? this.length : r8 >>> 0;
if (!r9) {
r9 = 0;
}
if (typeof r9 === "number") {
while (r1 < r46) {
this[r1] = r9;
r1 = r1 + 1;
}
} else {
const r50 = Buffer2.isBuffer(r9) ? r9 : Buffer2.from(r9, r13);
const length3 = r50.length;
if (length3 === 0) {
throw new TypeError("The value \"" + r9 + "\" is invalid for argument \"value\"");
}
const r53 = r46 - r1;
let r54 = 0;
if (0 < r53) {
do {
this[r54 + r1] = r50[r54 % length3];
r54 = r54 + 1;
} while (r54 < r46 - r1);
}
}
return this;
}
throw new RangeError("Out of range index");
};
c493_14 = /[^+/0-9A-Za-z-_]/g;
const array = new Array(256);
let r197 = 0;
loop12: while (true) {
const r3 = 16 * r197;
const r1 = r197;
let r0 = 0;
while (true) {
array[r3 + r0] = "0123456789abcdef"[r1] + "0123456789abcdef"[r0];
r0 = r0 + 1;
if (!(r0 < 16)) {
r197 = r1 + 1;
if (r197 < 16) {
continue loop12;
}
c493_16 = array;
return void 0;
}
}
}