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

72 lines
2.4 KiB
JavaScript

// Metro module 4774 (f4775).
let fetchFromObject;
export function getFileChunk(a0, r8 = 32) {
const r7 = a0 instanceof ArrayBuffer ? new Uint8Array(a0) : a0;
if (!(Array.isArray(a0) && a0.every((item) => typeof item === "number")) && !(a0 instanceof ArrayBuffer) && !(a0 instanceof Uint8Array)) {
throw new TypeError(`Expected the \`file\` argument to be of type \`Array<number>\`, \`Uint8Array\`, or \`ArrayBuffer\`, got \`${typeof a0}\``);
}
const r39 = Array.from(r7.slice(0, r8));
if (r39.every((item) => typeof item === "number" ? !isNaN(item) : typeof item === "number")) {
return r39;
}
throw new TypeError("File content contains illegal values");
}
fetchFromObject = function fetchFromObject(a0, a1) {
const r8 = a1.indexOf(".");
return r8 > -1 ? fetchFromObject(a0[a1.slice(0, r8)], a1.slice(r8 + 1)) : a0[a1];
};
export { fetchFromObject };
export function findMatroskaDocTypeElements(a0) {
const r4 = a0.map((item) => String.fromCharCode(item)).join("");
return r4.includes("webm") ? "webm" : r4.includes("matroska") ? "mkv" : void 0;
}
export function isftypStringIncluded(a0) {
let r21;
const r11 = [102, 116, 121, 112];
const r14 = a0.length - r11.length;
let r4 = 0;
if (0 < r14) {
do {
const r8 = 0 < r11.length;
const r2 = r4;
let r0 = 0;
let r6 = true;
if (r8) {
do {
const r16 = a0[r2 + r0];
const r17 = r11[r0];
const r18 = r0;
r6 = false;
if (r16 !== r17) {
break;
}
const r19 = r18 + 1;
r21 = r19 < r11.length;
r0 = r19;
r6 = true;
} while (r21);
}
if (r6) {
return true;
}
r4 = r2 + 1;
} while (r4 < a0.length - r11.length);
}
return false;
}
export function isFlvStringIncluded(a0) {
const r8 = a0.slice(0, 3);
return new TextDecoder().decode(new Uint8Array(r8)).includes("FLV");
}
export function isFileContaineJfiforExifHeader(a0) {
const r4 = a0[3];
return r4 === 224 || r4 === 225;
}
export function isAvifStringIncluded(a0) {
return a0.slice(4, 12).map((item) => String.fromCharCode(item)).join("") === "ftypavif";
}
export function isHeicSignatureIncluded(a0) {
let c14429_0 = a0.map((item) => String.fromCharCode(item)).join("");
return ["ftypheic", "ftyphevc", "ftypmif1", "ftypmsf1"].some((item) => c14429_0.includes(item));
}