decord/source/modules/interaction_components/native/NativeSearchableSelectActionComponentUtils.tsx

121 lines
4.7 KiB
TypeScript
Raw Normal View History

2026-08-06 08:05:19 +00:00
// Module ID: 8149
// Function ID: 8150
2026-07-29 08:29:29 +00:00
// Name: transformSearchableSelectOptions
2026-08-06 08:05:19 +00:00
// Dependencies: [1372, 1964, 1891, 1903, 676, 4512, 1351, 1419, 5674, 8150, 688, 712, 8151, 4745, 2]
2026-07-29 08:29:29 +00:00
// Exports: getChannelIconData, transformSearchableSelectOptions
2026-07-20 16:05:17 +00:00
2026-08-06 08:05:19 +00:00
// Module 8149 (transformSearchableSelectOptions)
2026-07-29 08:29:29 +00:00
import ensureGuildLoaded from "ensureGuildLoaded";
import createGuildRoleRecordFromRust from "createGuildRoleRecordFromRust";
import createGuildRecordFromRust from "createGuildRecordFromRust";
import mergeGuildAvatar from "mergeGuildAvatar";
2026-07-23 10:11:24 +00:00
import ME from "ME";
2026-07-29 08:29:29 +00:00
let error;
let metroImportAll;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
({ ChannelTypes: error, DEFAULT_ROLE_COLOR: metroImportAll } = ME);
const result = require("createGuildRecordFromRust").fileFinishedImporting("modules/interaction_components/native/NativeSearchableSelectActionComponentUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const transformSearchableSelectOptions = function transformSearchableSelectOptions(initialSnowflakeSelectOptions, guildId) {
2026-07-23 10:11:24 +00:00
const _require = guildId;
2026-07-20 16:05:17 +00:00
const guild2 = guild.getGuild(guildId);
2026-07-29 08:29:29 +00:00
const mapped = initialSnowflakeSelectOptions.map((type) => {
2026-07-20 16:05:17 +00:00
let customIconSrc;
let unicodeEmoji;
type = type.type;
2026-07-23 10:11:24 +00:00
if (guildId(outer1_2[5]).SelectOptionType.USER === type) {
const user = outer1_6.getUser(type.value);
2026-07-29 08:29:29 +00:00
let tmp34 = type;
2026-07-20 16:05:17 +00:00
if (null != user) {
let obj = {};
const merged = Object.assign(type);
2026-07-29 08:29:29 +00:00
let tmpResult = tmp(tmp2[7]);
obj.iconSrc = tmpResult.ensureAvatarSource(user.getAvatarSource(guildId, false)).uri;
tmp34 = obj;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp34;
} else if (tmp(tmp2[5]).SelectOptionType.ROLE === type) {
2026-07-20 16:05:17 +00:00
let role = null;
if (null != callback) {
2026-07-29 08:29:29 +00:00
role = outer1_4.getRole(tmp14.id, type.value);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp18 = type;
2026-07-20 16:05:17 +00:00
if (null != role) {
2026-07-29 08:29:29 +00:00
tmp18 = type;
if (null != tmp14) {
tmpResult = tmp(tmp2[8]);
2026-07-20 16:05:17 +00:00
let roleIconData = null;
2026-07-29 08:29:29 +00:00
if (tmpResult.canGuildUseRoleIcons(tmp14, role)) {
roleIconData = tmp(tmp2[8]).getRoleIconData(role);
const tmpResult1 = tmp(tmp2[8]);
2026-07-20 16:05:17 +00:00
}
if (null == roleIconData) {
obj = {};
const merged1 = Object.assign(type);
2026-07-29 08:29:29 +00:00
obj.iconSrc = tmp(tmp2[7]).ensureAvatarSource(callback(tmp2[9])).uri;
2026-07-20 16:05:17 +00:00
if (null != role.colorString) {
2026-07-29 08:29:29 +00:00
let hex2intResult = tmp(tmp2[10]).hex2int(role.colorString);
const tmpResult3 = tmp(tmp2[10]);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
hex2intResult = outer1_8;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.iconColor = 4278190080 | hex2intResult;
tmp18 = obj;
const tmpResult2 = tmp(tmp2[7]);
2026-07-20 16:05:17 +00:00
} else {
({ customIconSrc, unicodeEmoji } = roleIconData);
if (null != unicodeEmoji) {
const obj1 = {};
const merged2 = Object.assign(type);
2026-07-29 08:29:29 +00:00
({ id: obj8[0], name: obj8[1], animated: obj8[2], url: obj8[3], surrogates: obj8[4] } = unicodeEmoji);
obj1.iconEmoji = { id: null, name: null, animated: null, src: null, surrogates: null };
tmp18 = obj1;
const obj2 = { id: null, name: null, animated: null, src: null, surrogates: null };
2026-07-20 16:05:17 +00:00
} else if (null != customIconSrc) {
2026-07-29 08:29:29 +00:00
const obj3 = {};
2026-07-20 16:05:17 +00:00
const merged3 = Object.assign(type);
2026-07-29 08:29:29 +00:00
obj3.iconSrc = customIconSrc;
tmp18 = obj3;
2026-07-20 16:05:17 +00:00
}
}
}
}
2026-07-29 08:29:29 +00:00
return tmp18;
} else if (tmp(tmp2[5]).SelectOptionType.CHANNEL === type) {
2026-07-23 10:11:24 +00:00
const channel = outer1_3.getChannel(type.value);
2026-07-29 08:29:29 +00:00
if (null == channel) {
return type;
} else {
2026-07-20 16:05:17 +00:00
const obj4 = {};
const merged4 = Object.assign(type);
2026-07-29 08:29:29 +00:00
let tmpResult4 = tmp(tmp2[7]);
let hex2int = tmpResult4.ensureAvatarSource;
if (channel.type === outer1_7.GUILD_CATEGORY) {
let channelIconWithGuild = callback(tmp2[12]);
} else {
channelIconWithGuild = tmp(tmp2[13]).getChannelIconWithGuild(channel, tmp4);
const tmpResult5 = tmp(tmp2[13]);
}
obj4.iconSrc = hex2int(channelIconWithGuild).uri;
tmpResult4 = tmp(tmp2[10]);
hex2int = tmpResult4.hex2int;
obj4.iconColor = 4278190080 | hex2int(callback(tmp2[11]).unsafe_rawColors.PRIMARY_330);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = callback;
2026-07-20 16:05:17 +00:00
} else {
return null;
}
});
2026-07-29 08:29:29 +00:00
return mapped.filter(_require(1351).isNotNullish);
};
export const getChannelIconData = function getChannelIconData(channel, guild) {
if (channel.type === constants.GUILD_CATEGORY) {
2026-08-06 08:05:19 +00:00
let channelIconWithGuild = importDefault(8151);
2026-07-29 08:29:29 +00:00
} else {
2026-08-06 08:05:19 +00:00
channelIconWithGuild = require(4745) /* getChannelIcon */.getChannelIconWithGuild(channel, guild);
const obj = require(4745) /* getChannelIcon */;
2026-07-29 08:29:29 +00:00
}
return channelIconWithGuild;
2026-07-20 16:05:17 +00:00
};