100 lines
5.5 KiB
TypeScript
100 lines
5.5 KiB
TypeScript
/* Metro module 1901; source: modules/collectibles/nameplates/utils.tsx; dependencies: [1902, 482, 1905, 1907, 1244, 2] */
|
|
function _fun20855(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#20855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2028:6, offset: 0x00eddbcf, size: 237 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = getNameplateData;
|
|
const closure2 = isValidPalette;
|
|
const isValidHex_20858 = function(a0) {
|
|
return RegExp('^#([0-9a-fA-F]{6})$', '').test(a0);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = (require(1902) /* metro dependency 1902: NameplateRecord */).isNameplateRecord;
|
|
const env0_4 = (require(482) /* metro dependency 482: Constants */).ThemeTypes;
|
|
const closure3 = function(a0) {
|
|
var property = require(dependencyMap[2]).NAMEPLATE_PALETTES;
|
|
property = property[a0];
|
|
return property ?? require(dependencyMap[2]).INVALID_NAMEPLATE_PALETTE;
|
|
};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/collectibles/nameplates/utils.tsx');
|
|
exports.getNameplateData = closure;
|
|
exports.getNameplateDataFromProductRecord = getNameplateDataFromProductRecord;
|
|
exports.getBackgroundGradientColors = function(a0, a1) {
|
|
var r4;
|
|
if (isValidPalette(a0)) {
|
|
r4 = a1 === ThemeTypes.LIGHT ? a0.lightBackground : a0.darkBackground;
|
|
return {left: '' + r4 + '00', right: '' + r4 + '4D'};
|
|
}
|
|
};
|
|
exports.isValidPalette = closure2;
|
|
exports.getNameplatePalette = closure3;
|
|
exports.parseFirstFrame = parseFirstFrame;
|
|
exports.getNameplateSampleUsers = getNameplateSampleUsers;
|
|
}
|
|
|
|
function getNameplateData(a0) { // fn#20856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2028:145, offset: 0x00eddcbc, size: 74 bytes, params: 2, frame: 13
|
|
var r0;
|
|
var object2;
|
|
const value = null;
|
|
if (value == a0) {
|
|
r0 = value;
|
|
} else {
|
|
object2 = {};
|
|
object2.skuId = a0.skuId;
|
|
object2.src = a0.asset;
|
|
object2.imgAlt = a0.label;
|
|
object2.palette = getNameplatePalette(a0.palette);
|
|
r0 = object2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function isValidPalette(a0) { // fn#20857, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2028:276, offset: 0x00eddd06, size: 122 bytes, params: 2, frame: 16
|
|
const name = a0.name;
|
|
const INVALID_PALETTE_KEY = (require(1905) /* metro dependency 1905: constants */).INVALID_PALETTE_KEY;
|
|
return name !== INVALID_PALETTE_KEY && (a0.name !== (require(1905) /* metro dependency 1905: constants */).CUSTOM_PALETTE_KEY || isValidHex_20858(a0.darkBackground) && isValidHex_20858(a0.lightBackground));
|
|
}
|
|
|
|
function getNameplateDataFromProductRecord(a0) { // fn#20860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2028:771, offset: 0x00eddde2, size: 64 bytes, params: 2, frame: 13
|
|
if (a0.items.length === 0) {
|
|
return null;
|
|
}
|
|
const property = a0.items[0];
|
|
return isNameplateRecord(property) ? getNameplateData(property) : null;
|
|
}
|
|
|
|
function parseFirstFrame(a0) { // fn#20862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2028:1184, offset: 0x00edde94, size: 226 bytes, params: 2, frame: 18
|
|
let value = importDefault(1907) /* metro dependency 1907 */;
|
|
value = value.decode(a0);
|
|
const property = (importDefault(1907) /* metro dependency 1907 */).toRGBA8(value)[0];
|
|
const element = global.document.createElement('canvas');
|
|
element.width = value.width;
|
|
element.height = value.height;
|
|
const context = element.getContext('2d');
|
|
const ImageData = global.ImageData;
|
|
const Uint8ClampedArray = global.Uint8ClampedArray;
|
|
context.putImageData(new ImageData(new Uint8ClampedArray(property), value.width, value.height), 0, 0);
|
|
return element.toDataURL('image/png');
|
|
}
|
|
|
|
function getNameplateSampleUsers() { // fn#20863, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2028:1494, offset: 0x00eddf76, size: 362 bytes, params: 1, frame: 17
|
|
const object2 = {};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
const SbKDHi = t.SbKDHi;
|
|
object2.mallow = {name: Reflect.apply(string, intl, [SbKDHi]),
|
|
avatarSrc: 'https://cdn.discordapp.com/assets/content/6dcafe1231097505560fd098f0e6698990f0082369d34c35d8c3ee9615709f84.png'};
|
|
const object4 = {};
|
|
object4.name = intl.string(t['LMSo+F']);
|
|
object4.avatarSrc = 'https://cdn.discordapp.com/assets/content/17ae2ee3b8476755370ca9fa4d776d0bb811e50962409a7ae2dedd1b96c95eab.png';
|
|
object2.phibi = object4;
|
|
object2.locke = {name: intl.string(t.g5Dumi),
|
|
avatarSrc: 'https://cdn.discordapp.com/assets/content/a82a9daadc5c7842f183c0f61966b07d3aeeea478b7c8a4b8af48334eb1ce15f.png'};
|
|
object2.cherry = {name: intl.string(t.p5Z3Ol),
|
|
avatarSrc: 'https://cdn.discordapp.com/assets/content/afc2e8306ce540dccac7da1ca0871684d0bf67e77967ff0f679be84a0a6e51b7.png'};
|
|
object2.boom = {name: intl.string(t.ncslie),
|
|
avatarSrc: 'https://cdn.discordapp.com/assets/content/e264a2b0b8d963edd255c223abf1c0554f00a2f3a38640e509a38bc03d73b606.png'};
|
|
return object2;
|
|
}
|
|
|