decord/source/modules/media_uploads/native/ImageConversionDecision.tsx

139 lines
3.9 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 4865
// Function ID: 4866
2026-07-20 16:05:17 +00:00
// Name: isPhotoKitAsset
2026-08-24 06:08:38 +00:00
// Dependencies: [500, 4866, 2]
2026-07-29 08:29:29 +00:00
// Exports: isHeicUTI, isPhotoKitAsset, shouldConvertToJPG, shouldForceConvertToJPG
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 4865 (isPhotoKitAsset)
import set from "set" /* 2 */;
import set2 from "set" /* 500 */;
import _initializeDefault from "_initialize" /* 4866 */;
2026-07-29 08:29:29 +00:00
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/media_uploads/native/ImageConversionDecision.tsx");
export const isPhotoKitAsset = function isPhotoKitAsset(closure_0, closure_1_1) {
2026-07-29 08:29:29 +00:00
let tmp = null != closure_0.match(/^ph:\/\//i);
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-08-24 06:08:38 +00:00
tmp = null != closure_1_1;
2026-07-20 16:05:17 +00:00
}
return tmp;
2026-07-29 08:29:29 +00:00
};
export const isHeicUTI = function isHeicUTI(str) {
2026-07-20 16:05:17 +00:00
if (null == str) {
return false;
} else {
const formatted = str.toLowerCase();
let hasItem = formatted.includes("heic");
if (!hasItem) {
hasItem = formatted.includes("heif");
}
return hasItem;
}
2026-07-29 08:29:29 +00:00
};
2026-08-24 06:08:38 +00:00
export const shouldForceConvertToJPG = function shouldForceConvertToJPG(closure_0, closure_1_1, closure_1_10) {
let isIOSResult = set2.isIOS();
2026-07-29 08:29:29 +00:00
if (isIOSResult) {
let flag = false;
2026-08-24 06:08:38 +00:00
if (null != closure_1_10) {
const formatted = closure_1_10.toLowerCase();
2026-07-29 08:29:29 +00:00
let hasItem = formatted.includes("heic");
if (!hasItem) {
hasItem = formatted.includes("heif");
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
flag = hasItem;
}
if (flag) {
isIOSResult = tmp5;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (tmp8) {
let match;
2026-08-24 06:08:38 +00:00
if (closure_1_1 != null) {
match = closure_1_1.match(/\.HEI[CF]$/i);
2026-07-29 08:29:29 +00:00
}
let tmp9 = null != match;
} else {
tmp9 = null != closure_0.match(/^(assets-library|file):\/\/.+(&ext=|\.)(HEI[CF])$/i);
}
2026-08-24 06:08:38 +00:00
tmp8 = null != closure_0.match(/^ph:\/\//i) && null != closure_1_1;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return isIOSResult;
2026-07-20 16:05:17 +00:00
};
2026-08-24 06:08:38 +00:00
export const shouldConvertToJPG = function shouldConvertToJPG(closure_0, closure_1_1, closure_1_2, closure_1_4, c7) {
2026-07-29 08:29:29 +00:00
let flag = c7;
if (c7 === undefined) {
2026-07-20 16:05:17 +00:00
flag = true;
}
if (obj.isIOS()) {
2026-07-29 08:29:29 +00:00
let num;
2026-08-24 06:08:38 +00:00
if (closure_1_1 != null) {
num = closure_1_1.lastIndexOf(".");
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = -1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (-1 !== num) {
2026-08-24 06:08:38 +00:00
const formatted = closure_1_1.substring(num + 1).toLowerCase();
const str2 = closure_1_1.substring(num + 1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const match = closure_0.match;
2026-07-20 16:05:17 +00:00
if (flag) {
2026-07-29 08:29:29 +00:00
if (tmp8) {
2026-07-20 16:05:17 +00:00
if (null == formatted) {
return false;
} else {
if ("png" === formatted) {
2026-08-24 06:08:38 +00:00
if (closure_1_4) {
2026-07-20 16:05:17 +00:00
return true;
2026-08-24 06:08:38 +00:00
} else if (closure_1_2) {
2026-07-20 16:05:17 +00:00
return true;
}
} else {
if (obj2.isExtensionAnimated(formatted)) {
return false;
} else {
2026-08-24 06:08:38 +00:00
const supportedExtensions = tmp14(4866).getSupportedExtensions();
2026-07-20 16:05:17 +00:00
if (null !== supportedExtensions) {
if (supportedExtensions.has(formatted)) {
return true;
}
}
2026-08-24 06:08:38 +00:00
const tmp14Result = tmp14(4866);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
obj2 = _initializeDefault;
2026-07-29 08:29:29 +00:00
tmp14 = importDefault;
2026-07-20 16:05:17 +00:00
}
return false;
}
} else {
2026-07-29 08:29:29 +00:00
let tmp11 = null != closure_0.match(/^(assets-library|file):\/\/.+(&ext=|\.)(hei[cf]|jpe?g|dng)$/i);
if (!tmp11) {
let tmp12 = null == closure_0.match(/^(assets-library|file):\/\/.+(&ext=|\.)png$/i);
if (!tmp12) {
2026-08-24 06:08:38 +00:00
let tmp13 = !closure_1_2;
if (!closure_1_2) {
tmp13 = !closure_1_4;
2026-07-29 08:29:29 +00:00
}
tmp12 = tmp13;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp11 = !tmp12;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp11;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
tmp8 = null != match(/^ph:\/\//i) && null != closure_1_1;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
let tmp7 = "heic" === formatted;
if (!tmp7) {
tmp7 = "heif" === formatted;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp7) {
tmp7 = tmp6;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp7;
2026-07-20 16:05:17 +00:00
}
} else {
return false;
}
2026-08-24 06:08:38 +00:00
obj = set2;
2026-07-20 16:05:17 +00:00
};