192 lines
9.7 KiB
TypeScript
192 lines
9.7 KiB
TypeScript
/* Metro module 8362; source: modules/interaction_components/SearchableSelectActionComponentUtils.tsx; dependencies: [1379, 1945, 1938, 1867, 3793, 1878, 8358, 1909, 6526, 4617, 4633, 4805, 8363, 1360, 2] */
|
|
function _fun66591(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66591, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8547:6, offset: 0x01c01b89, size: 269 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = getSnowflakeSelectDefaultValues;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
|
|
const guildRoleStore = importDefault(1938) /* metro dependency 1938: GuildRoleStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const localInteractionComponentStateStore = importDefault(8358) /* metro dependency 8358: LocalInteractionComponentStateStore */;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/interaction_components/SearchableSelectActionComponentUtils.tsx');
|
|
exports.MIN_REREQUEST_TIME = 1000;
|
|
exports.queryMentionables = queryMentionables;
|
|
exports.queryChannels = queryChannels_66597;
|
|
exports.getInitialSnowflakeSelectOptions = getInitialSnowflakeSelectOptions;
|
|
exports.getSnowflakeSelectDefaultValues = closure;
|
|
}
|
|
|
|
function getSnowflakeSelectDefaultValues(a0, a1) { // fn#66592, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8547:166, offset: 0x01c01c96, size: 114 bytes, params: 3, frame: 15
|
|
var value2;
|
|
const value = a2;
|
|
const env0_0 = value !== undefined ? value : [];
|
|
var env0_1;
|
|
if (a0 != null) {
|
|
env0_1 = GuildStore.getGuild(a1);
|
|
value2 = a0.map(_fun66593);
|
|
return value2.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
|
|
}
|
|
}
|
|
|
|
function queryMentionables(a0, a1, a2) { // fn#66594, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8547:1168, offset: 0x01c01f51, size: 350 bytes, params: 4, frame: 20
|
|
const env0_0 = a2;
|
|
var value;
|
|
const channel = ChannelStore.getChannel(a2);
|
|
if (channel == null) {
|
|
return [];
|
|
}
|
|
const ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
|
|
const USER_SELECT = ComponentType.USER_SELECT;
|
|
const r6 = a0 === USER_SELECT || a0 === ComponentType.MENTIONABLE_SELECT;
|
|
const ROLE_SELECT = ComponentType.ROLE_SELECT;
|
|
value = Reflect.apply((importDefault(6526) /* metro dependency 6526: AutocompleteUtils */).queryMentionResults,
|
|
value, [{query: a1, channel: channel, canMentionEveryone: false, canMentionHere: false, canMentionUsers: r6,
|
|
canMentionRoles: a0 === ROLE_SELECT || a0 === ComponentType.MENTIONABLE_SELECT, includeAllGuildUsers: true,
|
|
includeNonMentionableRoles: true, checkRecentlyTalkedOnEmptyQuery: false, limit: 15}]);
|
|
const users = value.users;
|
|
const roles = value.roles;
|
|
value = users.map(_fun66595);
|
|
items = [];
|
|
value = arraySpread(items, value, 0, 7);
|
|
arraySpread(items, roles.map(function(a0) {
|
|
var object = {};
|
|
object.type = require(dependencyMap[10]).SelectOptionType.ROLE;
|
|
object.value = a0.id;
|
|
object.label = a0.name;
|
|
return object;
|
|
}), value, 7);
|
|
return items;
|
|
}
|
|
|
|
function queryChannels_66597(a0, a1, a2) { // fn#66597, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8547:1961, offset: 0x01c0218a, size: 121 bytes, params: 4, frame: 13
|
|
var r0;
|
|
var value;
|
|
const channel = ChannelStore.getChannel(a1);
|
|
if (channel == null) {
|
|
r0 = [];
|
|
} else {
|
|
value = importDefault(6526) /* metro dependency 6526: AutocompleteUtils */;
|
|
value = value.queryApplicationCommandChannelResults({query: a0, channel: channel, channelTypes: a2,
|
|
limit: 15}).channels.map(function(a0) {
|
|
var object = {};
|
|
object.type = require(dependencyMap[10]).SelectOptionType.CHANNEL;
|
|
object.value = a0.id;
|
|
object.label = require(dependencyMap[11]).computeChannelName(a0, UserStore, RelationshipStore);
|
|
return object;
|
|
});
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getInitialSnowflakeSelectOptions(a0, a1, a2) { // fn#66599, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8547:2272, offset: 0x01c02261, size: 310 bytes, params: 4, frame: 20
|
|
const interactionComponentState = LocalInteractionComponentStateStore.getInteractionComponentState(a1, a0.id);
|
|
const getSnowflakeSelectDefaultValuesBinding = getSnowflakeSelectDefaultValues;
|
|
const defaultValues = a0.defaultValues;
|
|
let type = a0.type;
|
|
const value3 = undefined;
|
|
const ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
|
|
const CHANNEL_SELECT = ComponentType.CHANNEL_SELECT;
|
|
const snowflakeSelectDefaultValuesBinding = getSnowflakeSelectDefaultValuesBinding(defaultValues, a2,
|
|
type !== CHANNEL_SELECT ? value3 : a0.channelTypes);
|
|
type = interactionComponentState == null ? value3 : interactionComponentState.type;
|
|
const USER_SELECT = ComponentType.USER_SELECT;
|
|
let r0 = type === USER_SELECT || (interactionComponentState == null ? value3 : interactionComponentState.type) === ComponentType.ROLE_SELECT || (interactionComponentState == null ? value3 : interactionComponentState.type) === ComponentType.MENTIONABLE_SELECT ? interactionComponentState.selectedOptions : (interactionComponentState == null ? value3 : interactionComponentState.type) !== ComponentType.CHANNEL_SELECT ? snowflakeSelectDefaultValuesBinding : interactionComponentState.selectedOptions;
|
|
r0 = r0 ?? [];
|
|
return r0;
|
|
}
|
|
|
|
function _fun66593(a0) { // fn#66593, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8547:263, offset: 0x01c01d08, size: 585 bytes, params: 2, frame: 21
|
|
var r2;
|
|
var value4;
|
|
var id;
|
|
var value5;
|
|
var binding;
|
|
var object2;
|
|
const SelectOptionType = (require(4633) /* metro dependency 4633: InteractionComponentTypes */).SelectOptionType;
|
|
var value7;
|
|
var value8;
|
|
var getUser;
|
|
var value9;
|
|
const type = a0.type;
|
|
const value2 = undefined;
|
|
const SnowflakeSelectDefaultValueTypes = (require(8363) /* metro dependency 8363: SnowflakeSelectDefaultValueTypes */).SnowflakeSelectDefaultValueTypes;
|
|
const USER = SnowflakeSelectDefaultValueTypes.USER;
|
|
if (USER === type) {
|
|
getUser = UserStore.getUser;
|
|
id = a0.id;
|
|
value9 = Reflect.apply(getUser, UserStore, [id]);
|
|
if (value9 == null) {
|
|
return null;
|
|
}
|
|
r2 = env0_1 != null ? GuildMemberStore.getNick(env0_1.id, value9.id) : value2;
|
|
id = value9.id;
|
|
r2 = r2 ?? value9.globalName;
|
|
r2 = r2 ?? value9.username;
|
|
return {type: SelectOptionType.USER, value: id, label: r2};
|
|
}
|
|
const ROLE = SnowflakeSelectDefaultValueTypes.ROLE;
|
|
if (ROLE === type) {
|
|
value7 = null;
|
|
if (value7 == env0_1) {
|
|
return value7;
|
|
}
|
|
value8 = GuildRoleStore.getRole(env0_1.id, a0.id);
|
|
return value7 == value8 ? value7 : {type: SelectOptionType.ROLE, value: value8.id, label: value8.name};
|
|
}
|
|
const CHANNEL = SnowflakeSelectDefaultValueTypes.CHANNEL;
|
|
if (CHANNEL === type) {
|
|
value4 = null;
|
|
if (value4 == env0_1) {
|
|
return value4;
|
|
}
|
|
value5 = ChannelStore.getChannel(a0.id);
|
|
if (value4 == value5) {
|
|
r2 = value4;
|
|
} else if (value5.guild_id !== env0_1.id) {
|
|
r2 = value4;
|
|
} else if (env0_0.length > 0) {
|
|
binding = env0_0;
|
|
if (binding.includes(value5.type)) {
|
|
object2 = {};
|
|
object2.type = SelectOptionType.CHANNEL;
|
|
object2.value = value5.id;
|
|
object2.label = (require(4805) /* metro dependency 4805: useChannelName */).computeChannelName(value5,
|
|
UserStore,
|
|
RelationshipStore);
|
|
r2 = object2;
|
|
} else {
|
|
r2 = value4;
|
|
}
|
|
} else {
|
|
object2 = {};
|
|
object2.type = SelectOptionType.CHANNEL;
|
|
object2.value = value5.id;
|
|
object2.label = (require(4805) /* metro dependency 4805: useChannelName */).computeChannelName(value5,
|
|
UserStore,
|
|
RelationshipStore);
|
|
r2 = object2;
|
|
}
|
|
return r2;
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function _fun66595(a0) { // fn#66595, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8547:1682, offset: 0x01c020af, size: 153 bytes, params: 2, frame: 19
|
|
const defaultImport = importDefault(4617) /* metro dependency 4617: NicknameUtils */;
|
|
const getNickname = defaultImport.getNickname;
|
|
const guildId = env0_1.getGuildId();
|
|
let user = a0.user;
|
|
const value4 = Reflect.apply(getNickname, defaultImport, [guildId, importDefault, user]);
|
|
const SelectOptionType = (require(4633) /* metro dependency 4633: InteractionComponentTypes */).SelectOptionType;
|
|
const USER = SelectOptionType.USER;
|
|
user = a0.user;
|
|
let r1 = value4 ?? a0.user.globalName;
|
|
r1 = r1 ?? a0.user.username;
|
|
return {type: USER, value: user.id, label: r1};
|
|
}
|
|
|