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

119 lines
4.7 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 8381
// Function ID: 8382
2026-07-29 08:29:29 +00:00
// Name: transformSearchableSelectOptions
2026-08-25 06:04:03 +00:00
// Dependencies: [1391, 1985, 1910, 1922, 676, 4633, 1370, 1438, 5859, 8382, 688, 712, 8383, 4866, 2]
2026-07-29 08:29:29 +00:00
// Exports: getChannelIconData, transformSearchableSelectOptions
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 8381 (transformSearchableSelectOptions)
import getChannelIcon from "getChannelIcon" /* 4866 */;
import registerAssetDefault from "registerAsset" /* 8383 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "ensureGuildLoaded" /* 1391 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "createGuildRoleRecordFromRust" /* 1985 */;
2026-08-24 06:08:38 +00:00
import closure_5 from "createGuildRecordFromRust" /* 1910 */;
import closure_6 from "mergeGuildAvatar" /* 1922 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
({ ChannelTypes: error, DEFAULT_ROLE_COLOR: closure_8 } = ME);
const result = require("set").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
type = type.type;
2026-08-24 06:08:38 +00:00
if (guildId(closure_1_2[5]).SelectOptionType.USER === type) {
const user = closure_1_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-08-24 06:08:38 +00:00
role = closure_1_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-08-24 06:08:38 +00:00
hex2intResult = closure_1_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) {
2026-08-24 06:08:38 +00:00
obj1 = {};
2026-07-20 16:05:17 +00:00
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-08-24 06:08:38 +00:00
const channel = closure_1_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;
2026-08-24 06:08:38 +00:00
if (channel.type === closure_1_7.GUILD_CATEGORY) {
2026-07-29 08:29:29 +00:00
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-08-11 06:20:06 +00:00
return mapped.filter(_require(1370).isNotNullish);
2026-07-29 08:29:29 +00:00
};
export const getChannelIconData = function getChannelIconData(channel, guild) {
if (channel.type === constants.GUILD_CATEGORY) {
2026-08-24 06:08:38 +00:00
let channelIconWithGuild = registerAssetDefault;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
channelIconWithGuild = getChannelIcon.getChannelIconWithGuild(channel, guild);
const obj = getChannelIcon;
2026-07-29 08:29:29 +00:00
}
return channelIconWithGuild;
2026-07-20 16:05:17 +00:00
};