132 lines
3.6 KiB
TypeScript
132 lines
3.6 KiB
TypeScript
// Metro module 4799 (f4800).
|
|
import decodeImage from "../../../../_bundle/decodeImage";
|
|
import { load } from "../../../../_bundle/loadView";
|
|
class DiscordImagePng {
|
|
constructor(a0, a1) {
|
|
this.img = a0;
|
|
this.originalBuffer = a1;
|
|
}
|
|
static create(a0) {
|
|
let discordImagePng;
|
|
try {
|
|
discordImagePng = new DiscordImagePng(decodeImage.decode(a0), a0);
|
|
} catch ($e) {}
|
|
return discordImagePng;
|
|
}
|
|
hasTransparency() {
|
|
if (this.img.ctype !== 4 && this.img.ctype !== 6) {
|
|
return false;
|
|
}
|
|
const uint8Array = new Uint8Array(decodeImage.toRGBA8(this.img)[0]);
|
|
const length = uint8Array.length;
|
|
let r0 = 3;
|
|
if (3 < length) {
|
|
do {
|
|
const r28 = uint8Array[r0];
|
|
const r1 = r0;
|
|
if (r28 < 255) {
|
|
return true;
|
|
}
|
|
r0 = r1 + 4;
|
|
} while (r0 < uint8Array.length);
|
|
}
|
|
return false;
|
|
}
|
|
isAnimated() {
|
|
return this.img.tabs.acTL != null;
|
|
}
|
|
isPng8() {
|
|
return this.img.ctype === 3 && this.img.depth <= 8;
|
|
}
|
|
async hasSrgbIccProfile() {
|
|
let r34, r110;
|
|
const _this = this;
|
|
let c25297_0, c25297_1, c25297_4;
|
|
let c25297_5 = 0;
|
|
let c29441_0, c29441_1, c29441_2, c29441_3;
|
|
L22: {
|
|
L21: {
|
|
try {
|
|
c29441_0 = void 0;
|
|
c29441_1 = void 0;
|
|
c29441_2 = void 0;
|
|
c29441_3 = void 0;
|
|
c29441_0 = await load(_this.originalBuffer, {
|
|
async: true,
|
|
expanded: true,
|
|
includeUnknown: true
|
|
});
|
|
if (c29441_0.icc == null) {
|
|
break L22;
|
|
}
|
|
c29441_1 = c29441_0.icc;
|
|
c29441_2 = Object.keys(c29441_1);
|
|
const r81 = c29441_2;
|
|
c25297_1 = r81;
|
|
const r83 = r81[Symbol.iterator]();
|
|
c25297_1 = r83.next;
|
|
c25297_0 = r83;
|
|
while (true) {
|
|
const r85 = c25297_1;
|
|
let r86 = c25297_0;
|
|
const r87 = r86 === void 0 ? void 0 : (r34 = r85.call(r86)).done ? r86 = void 0 : r34.value;
|
|
c25297_0 = r86;
|
|
if (r86 === void 0) {
|
|
break L21;
|
|
}
|
|
c25297_5 = 1;
|
|
c29441_3 = r87;
|
|
if (c29441_3 === "ICC Description") {
|
|
if (c29441_1[c29441_3]?.description != null) {
|
|
if (c29441_1[c29441_3].description !== "") {
|
|
r110 = !c29441_1[c29441_3].description.toLowerCase().includes("srgb");
|
|
c25297_5 = 0;
|
|
const r111 = c25297_0;
|
|
if (r111 !== void 0 && typeof r111.return === "function") {
|
|
r111.return();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
c25297_5 = 0;
|
|
}
|
|
} catch ($e) {
|
|
const r40 = $e;
|
|
let r8 = r40;
|
|
c25297_4 = r40;
|
|
if (c25297_5 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r119 = c25297_4;
|
|
c25297_5 = 0;
|
|
const r121 = c25297_0;
|
|
if (r121 !== void 0 && typeof r121.return === "function") {
|
|
try {
|
|
r121.return();
|
|
} catch {}
|
|
}
|
|
throw r119;
|
|
} catch (r117) {
|
|
r8 = r117;
|
|
c25297_4 = r117;
|
|
if (c25297_5 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return !r110;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
getBuffer() {
|
|
return this.originalBuffer;
|
|
}
|
|
}
|
|
export { DiscordImagePng };
|