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

80 lines
2.3 KiB
JavaScript

// Metro module 4839 (f4840).
let c2973_0 = {
xmp: "http://ns.adobe.com/xap/1.0/",
tiff: "http://ns.adobe.com/tiff/1.0/",
exif: "http://ns.adobe.com/exif/1.0/",
dc: "http://purl.org/dc/elements/1.1/",
xmpMM: "http://ns.adobe.com/xap/1.0/mm/",
stEvt: "http://ns.adobe.com/xap/1.0/sType/ResourceEvent#",
stRef: "http://ns.adobe.com/xap/1.0/sType/ResourceRef#",
photoshop: "http://ns.adobe.com/photoshop/1.0/"
};
export function isMissingNamespaceError(a0) {
const r6 = ["prefix is non-null and namespace is null", "prefix not bound to a namespace", "prefix inte bundet till en namnrymd", /Namespace prefix .+ is not defined/];
const length = r6.length;
let r0 = 0;
if (0 < length) {
do {
const r17 = new RegExp(r6[r0]).test(a0.message);
const r1 = r0;
if (r17) {
return true;
}
r0 = r1 + 1;
} while (r0 < r6.length);
}
return false;
}
export function addMissingNamespaces(a0) {
const r22 = a0.match(/<([A-Za-z_][A-Za-z0-9._-]*)([^>]*)>/);
if (r22) {
const r13 = r22[1];
const r23 = [];
const r8 = /xmlns:([\w-]+)=["'][^"']+["']/g;
let r25 = r8.exec(a0);
while (r25 !== null) {
const r26 = r23.indexOf(r25[1]);
const r27 = r25;
if (r26 === -1) {
r23.push(r27[1]);
}
r25 = r8.exec(a0);
}
let c14453_0 = r23;
const r33 = [];
const r12 = /\b([A-Za-z_][A-Za-z0-9._-]*):[A-Za-z_][A-Za-z0-9._-]*\b/g;
let r35 = r12.exec(a0);
while (r35 !== null) {
const r15 = r35[1];
if (r15 !== "xmlns" && r15 !== "xml" && r33.indexOf(r15) === -1) {
r33.push(r15);
}
r35 = r12.exec(a0);
}
const r44 = r33.filter((item) => c14453_0.indexOf(item) === -1);
const length = r44.length;
let r46 = a0;
if (length !== 0) {
const r47 = [];
const r49 = 0 < r44.length;
let r55 = 0;
if (r49) {
do {
const r56 = r44[r55];
let r18 = c2973_0[r56];
const r1 = r55;
if (!r18) {
r18 = "http://fallback.namespace/" + r56;
}
r47.push(" xmlns:" + r56 + "=\"" + r18 + "\"");
r55 = r1 + 1;
} while (r55 < r44.length);
}
const r66 = r47.join("");
r46 = a0.replace(new RegExp("<" + r13 + "([^>]*)>"), "<" + r13 + "$1" + r66 + ">");
}
return r46;
}
return a0;
}