Files
discord-decomp/sources/modules/chat_input/native/ApplicationCommandOptionValueParser.tsx
T
2026-07-28 01:06:53 +03:00

922 lines
43 KiB
TypeScript

/* Metro module 11647; source: modules/chat_input/native/ApplicationCommandOptionValueParser.tsx; dependencies: [7, 6, 31, 5071, 1383, 1935, 1945, 1938, 3793, 1878, 6625, 22, 1360, 4805, 6526, 1909, 7076, 2] */
import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import GuildChannelStore from '../../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
import GuildRoleStore from '../../../stores/GuildRoleStore.tsx'; /* Metro dependency 1938 */
import GuildMemberStore from '../../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
import RelationshipStore from '../../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import ActiveJoinedThreadsStore from '../../threads/ActiveJoinedThreadsStore.tsx'; /* Metro dependency 5071 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as ChannelRecordModule from '../../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
import * as ServerModule from '../../../flow/Server.tsx'; /* Metro dependency 1909 */
import * as AutocompleteUtilsModule from '../../../utils/AutocompleteUtils.tsx'; /* Metro dependency 6526 */
import * as ChannelAutocompleteConstantsModule from '../../channel_autocomplete/ChannelAutocompleteConstants.tsx'; /* Metro dependency 6625 */
import * as MessageParserModule from '../../messages/MessageParser.tsx'; /* Metro dependency 7076 */
function _fun89301(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#89301, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:6, offset: 0x020089d8, size: 444 bytes, params: 8, frame: 22
let env0_0 = require;
const _arrayLikeToArray_89304 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const getUsers2 = getUsers;
const getRoles_893102 = getRoles_89310;
const getChannels_893122 = getChannels_89312;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = CreateClass;
const env0_14 = RegExp('^@(([^@#:]+)#([0-9]{4}))$', 'i');
const matchPrefix_89318 = function(a0, a1, a2) {
var env0_0 = a0;
if (a1[0] !== a0) {
return null;
}
var env0_1 = a1.substr(a0.length);
var value = a2.sortBy(_fun89319);
value = value.filter(_fun89320);
value = value.map(_fun89321);
return value.first();
};
value = value(ApplicationCommandOptionValueParser);
(FileImportTrackerModule).fileFinishedImporting('modules/chat_input/native/ApplicationCommandOptionValueParser.tsx');
exports.getUsers = getUsers2;
exports.getRoles = getRoles_893102;
exports.getChannels = getChannels_893122;
exports.ApplicationCommandOptionValueParser = value;
exports.parseOptionValuesForSend = parseOptionValuesForSend;
exports.useApplicationCommandOptionValueParser = useApplicationCommandOptionValueParser;
function _createForOfIteratorHelperLoose_89302(a0, a1) { // fn#89302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:285, offset: 0x02008b94, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun89303;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_89304(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_89304(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_89304(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun89303;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun89303() { // fn#89303, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:856, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function getUsers(a0) { // fn#89305, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:1449, offset: 0x02008d08, size: 264 bytes, params: 2, frame: 16
var r3;
var defaultImport;
var guildMemberStoreBinding;
let value = a0.getGuildId();
if (a0.isPrivate()) {
value = importDefault(22) /* metro dependency 22 */;
value = value(a0.recipients);
value = value.map(function(a0) {
return {userId: a0};
});
r3 = value;
} else if (value != null) {
defaultImport = importDefault(22) /* metro dependency 22 */;
guildMemberStoreBinding = GuildMemberStore;
value = defaultImport(guildMemberStoreBinding.getMembers(value));
value = value.map(_fun89307);
r3 = value;
} else {
value = importDefault(22) /* metro dependency 22 */;
value = value([]);
r3 = value;
}
value = Reflect.apply(r3.map(function({userId}) {
return UserStore.getUser(userId);
}).filter, value, [(require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish]);
return value.map(function(a0) {
return {id: a0.id, text: a0.tag};
});
}
function getRoles_89310({guild_id}) { // fn#89310, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:1738, offset: 0x02008e60, size: 89 bytes, params: 2, frame: 12
return (importDefault(22) /* metro dependency 22 */)(guild_id != null ? GuildRoleStore.getSortedRoles(guild_id) : []).map(function({id,
name}) {
return {id: id, text: name};
});
}
function getChannels_89312(a0, a1) { // fn#89312, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:1868, offset: 0x02008eb9, size: 273 bytes, params: 3, frame: 19
var items2;
const env0_0 = a1;
let value = a0.getGuildId();
if (value == null) {
items2 = [];
value = a1 == null;
if (value || a1.includes(a0.type)) {
items2.push(a0);
}
value = (importDefault(22) /* metro dependency 22 */)(items2);
return value.map(function(a0) {
var object = {id: a0.id};
object.text = require(dependencyMap[13]).computeChannelName(a0, UserStore, RelationshipStore);
return object;
});
}
const env0_2 = GuildChannelStore.getTextChannelNameDisambiguations(value);
const defaultImport = importDefault(22) /* metro dependency 22 */;
const COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS = (AutocompleteUtilsModule).COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS;
const value4 = defaultImport(COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS).flatMap(_fun89314);
const concat = value4.concat;
const activeJoinedThreadsStoreBinding = ActiveJoinedThreadsStore;
value = Reflect.apply(concat, value4, [activeJoinedThreadsStoreBinding.computeAllActiveJoinedThreads(value)]);
value = value.filter(_fun89316);
return value.map(_fun89317);
function _fun89314(a0) { // fn#89314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:2175, offset: 0x0200900c, size: 53 bytes, params: 2, frame: 11
var environment;
const value = environment.__proto__;
return GuildChannelStore.getChannels(env0_1)[a0].map(function(a0) {
return a0.channel;
});
}
function _fun89316(a0) { // fn#89316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:2271, offset: 0x01232d36, size: 40 bytes, params: 2, frame: 12
return require == null || require.includes(a0.type);
}
function _fun89317(a0) { // fn#89317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:2309, offset: 0x02009041, size: 119 bytes, params: 2, frame: 18
var name;
var r1;
var moduleValue;
const object = {};
object.id = a0.id;
const value = environment.__proto__;
if (isGuildSelectableChannelType(a0.type)) {
name = env0_2[a0.id]?.name;
if (name != null) {
r1 = name;
} else {
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
r1 = moduleValue.computeChannelName(a0, UserStore, RelationshipStore);
}
} else {
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
r1 = moduleValue.computeChannelName(a0, UserStore, RelationshipStore);
}
object.text = r1;
return object;
}
}
function matchPrefix_89318(a0, a1, a2) { // fn#89318, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:1242, offset: 0x020090b8, size: 113 bytes, params: 4, frame: 13
const env0_0 = a0;
if (a1[0] !== a0) {
return null;
}
const env0_1 = a1.substr(a0.length);
let value = a2.sortBy(function(a0) {
return -a0.text.length;
});
value = value.filter(_fun89320);
value = value.map(_fun89321);
return value.first();
function _fun89320({text}) { // fn#89320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:1350, offset: 0x02009129, size: 41 bytes, params: 2, frame: 10
const binding = env0_1;
return binding.toLowerCase() === text.toLowerCase();
}
function _fun89321({id, text}) { // fn#89321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:1403, offset: 0x02009152, size: 36 bytes, params: 2, frame: 4
return {text: env0_0 + text, id: id};
}
}
function ApplicationCommandOptionValueParser(a0) { // fn#89322, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:2445, offset: 0x02009176, size: 52 bytes, params: 2, frame: 14
ClassCallCheck(this, ApplicationCommandOptionValueParser);
this.parse = parse_89323;
this.channel = a0;
function ApplicationCommandOptionValueParserParse(a0, a1) { // fn#89323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:2548, owner: ApplicationCommandOptionValueParser.parse, offset: 0x020091aa, size: 578 bytes, params: 3, frame: 26
var userStoreBinding;
var value7;
var value8;
var value9;
var value10;
let value = a0.trim();
const env0_0 = value;
const getUsersBinding = getUsers;
let binding = env0_0;
const usersBinding = getUsersBinding(binding.channel);
const env0_2 = getRoles_89310(binding.channel);
const env0_3 = usersBinding.map(function(a0) {
var r3;
var object = {};
copyDataProperties(object, a0, r3);
object['text'] = a0.text.split('#')[0];
return object;
});
const matchUser2 = matchUser;
const matchRole2 = matchRole;
let type = a1.type;
const ApplicationCommandOptionType = (ServerModule).ApplicationCommandOptionType;
const USER = ApplicationCommandOptionType.USER;
if (type !== USER) {
type = a1.type;
if (type !== ApplicationCommandOptionType.ROLE) {
type = a1.type;
if (type !== ApplicationCommandOptionType.CHANNEL) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
value8 = matchPrefix_89318(CHANNEL_SENTINEL, value, getChannels_89312(env0_0.channel, a1.channelTypes));
if (value8 == null) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
if (value8.id != null) {
return {type: 'channelMention', channelId: value8.id};
}
type = a1.type;
if (type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
value7 = matchRole2();
if (value7 != null) {
return value7;
}
type = a1.type;
if (type !== ApplicationCommandOptionType.CHANNEL) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
value8 = matchPrefix_89318(CHANNEL_SENTINEL, value, getChannels_89312(env0_0.channel, a1.channelTypes));
if (value8 == null) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
if (value8.id != null) {
return {type: 'channelMention', channelId: value8.id};
}
type = a1.type;
if (type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
} else {
var value5 = matchUser2();
if (value5 != null) {
return value5;
}
binding = env1_14;
binding.lastIndex = 0;
var value6 = binding.exec(value);
if (value6 == null) {
type = a1.type;
if (type !== ApplicationCommandOptionType.ROLE) {
type = a1.type;
if (type !== ApplicationCommandOptionType.CHANNEL) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
value8 = matchPrefix_89318(CHANNEL_SENTINEL, value, getChannels_89312(env0_0.channel, a1.channelTypes));
if (value8 == null) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
if (value8.id != null) {
return {type: 'channelMention', channelId: value8.id};
}
type = a1.type;
if (type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
value7 = matchRole2();
if (value7 != null) {
return value7;
}
type = a1.type;
if (type !== ApplicationCommandOptionType.CHANNEL) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
value8 = matchPrefix_89318(CHANNEL_SENTINEL, value, getChannels_89312(env0_0.channel, a1.channelTypes));
if (value8 == null) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
if (value8.id != null) {
return {type: 'channelMention', channelId: value8.id};
}
type = a1.type;
if (type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
var byTag = userStoreBinding.findByTag(value6[2], value6[3]);
if (byTag != null) {
return {type: 'userMention', userId: byTag.id};
}
type = a1.type;
if (type !== ApplicationCommandOptionType.ROLE) {
type = a1.type;
if (type !== ApplicationCommandOptionType.CHANNEL) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
value8 = matchPrefix_89318(CHANNEL_SENTINEL, value, getChannels_89312(env0_0.channel, a1.channelTypes));
if (value8 == null) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
if (value8.id != null) {
return {type: 'channelMention', channelId: value8.id};
}
type = a1.type;
if (type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
value7 = matchRole2();
if (value7 != null) {
return value7;
}
type = a1.type;
if (type !== ApplicationCommandOptionType.CHANNEL) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
value8 = matchPrefix_89318(CHANNEL_SENTINEL, value, getChannels_89312(env0_0.channel, a1.channelTypes));
if (value8 == null) {
if (a1.type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value == null) {
return {type: 'text', text: a0};
}
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
return {type: 'text', text: a0};
}
if (value8.id != null) {
return {type: 'channelMention', channelId: value8.id};
}
type = a1.type;
if (type !== ApplicationCommandOptionType.MENTIONABLE) {
return {type: 'text', text: a0};
}
}
value9 = matchRole2();
if (value9 != null) {
return value9;
}
value10 = matchUser2();
if (value10 != null) {
return value10;
}
binding = env1_14;
binding.lastIndex = 0;
value = binding.exec(value);
if (value != null) {
userStoreBinding = UserStore;
value = userStoreBinding.findByTag(value[2], value[3]);
if (value != null) {
return {type: 'userMention', userId: value.id};
}
}
return {type: 'text', text: a0};
function matchUser() { // fn#89325, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:2680, owner: ApplicationCommandOptionValueParser.parse.matchUser, offset: 0x020093ec, size: 126 bytes, params: 1, frame: 17
var r0;
let value = environment.__proto__.__proto__;
const matchPrefix_89318Binding = matchPrefix_89318;
const binding = env0_0;
const value3 = undefined;
const value4 = matchPrefix_89318Binding(MENTION_SENTINEL, binding, env0_1);
if ((value4 == null ? value3 : value4.id) != null) {
r0 = {type: 'userMention', userId: value4.id};
} else {
value = matchPrefix_89318(MENTION_SENTINEL, env0_0, env0_3);
r0 = (value == null ? value3 : value.id) != null ? {type: 'userMention', userId: value.id} : value3;
}
return r0;
}
function matchRole() { // fn#89326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:2856, owner: ApplicationCommandOptionValueParser.parse.matchRole, offset: 0x0200946a, size: 108 bytes, params: 1, frame: 16
const matchPrefix_89318Binding = matchPrefix_89318;
const binding = env0_0;
const value2 = undefined;
const value3 = matchPrefix_89318Binding(MENTION_SENTINEL, binding, env0_2);
return (value3 == null ? value2 : value3.id) != null ? {type: 'roleMention',
roleId: value3.id} : env0_0 !== '@everyone' ? value2 : {'type': 'textMention', 'text': '@everyone'};
}
}
}
function parseOptionValuesForSend(a0, a1, a2) { // fn#89327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:4067, offset: 0x020094d6, size: 299 bytes, params: 4, frame: 30
var r2;
var value4;
var name;
var property;
var type;
var ApplicationCommandOptionType;
var STRING;
var choices;
var autocomplete;
var defaultImport;
var parse;
var text;
var content;
var value5;
if (a1.options == null) {
return {};
}
const object = {};
const parserState = (MessageParserModule).createParserState(a0);
const value2 = _createForOfIteratorHelperLoose_89302(a1.options);
const value3 = value2();
let done = value3.done;
if (!done) {
r2 = value3;
reducibleLoop2: while (true) {
value4 = r2.value;
name = value4.name;
property = a2[name];
reducibleJoin9: while (true) {
if (property == null) {
break reducibleJoin9;
}
type = property[0].type;
if (type === 'text') {
type = value4.type;
ApplicationCommandOptionType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandOptionType;
STRING = ApplicationCommandOptionType.STRING;
if (type === STRING) {
choices = value4.choices;
if (choices == null) {
autocomplete = value4.autocomplete;
if (!autocomplete) {
name = value4.name;
defaultImport = importDefault(7076) /* metro dependency 7076: MessageParser */;
parse = defaultImport.parse;
text = property[0].text;
content = Reflect.apply(parse, defaultImport, [a0, text, parserState]).content;
object[name] = [{type: 'text', text: content}];
break reducibleJoin9;
}
}
}
}
name = value4.name;
object[name] = property;
break reducibleJoin9;
}
value5 = value2();
done = value5.done;
if (done) {
break reducibleLoop2;
}
r2 = value5;
continue reducibleLoop2;
}
}
return object;
}
function useApplicationCommandOptionValueParser({channel}) { // fn#89328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:4492, offset: 0x02009601, size: 49 bytes, params: 2, frame: 14
return ReactModule.useMemo(_fun89329, [channel]);
function _fun89329() { // fn#89329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:4518, offset: 0x02009632, size: 36 bytes, params: 1, frame: 11
let value = environment.__proto__;
const binding = env1_16;
const channelBinding = channel;
value = Object.create(binding.prototype, {constructor: {value: binding}});
const binding2 = new binding(channelBinding);
return binding2 instanceof Object ? binding2 : value;
}
}
}
function _fun89307({userId}) { // fn#89307, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:1597, offset: 0x02008e1b, size: 16 bytes, params: 2, frame: 2
return {userId: userId};
}
function _fun89319({text}) { // fn#89319, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11833:1318, offset: 0x013c78c3, size: 18 bytes, params: 2, frame: 1
return -text.length;
}
global.__d(_fun89301, 11647, [7, 6, 31, 5071, 1383, 1935, 1945, 1938, 3793, 1878, 6625, 22, 1360, 4805, 6526, 1909,
7076,
2]) /* metro module 11647, dependencies: [7, 6, 31, 5071, 1383, 1935, 1945, 1938, 3793, 1878, 6625, 22, 1360, 4805, 6526, 1909, 7076, 2] */;