Files
discord-decomp/sources/modules/channel_text_area/PlaintextResolvers.tsx
T
2026-07-27 16:20:00 +03:00

951 lines
44 KiB
TypeScript

/* Metro module 8054; source: modules/channel_text_area/PlaintextResolvers.tsx; dependencies: [57, 6540, 5071, 1379, 1935, 1945, 1938, 1867, 3784, 3793, 1878, 661, 1881, 7079, 4805, 21, 6526, 3797, 3801, 2] */
function _fun63886(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#63886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8232:6, offset: 0x01b94571, size: 383 bytes, params: 8, frame: 20
const env0_0 = require;
const _arrayLikeToArray_63889 = 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 closure = resolvePlaintextInlineVoid;
const matchesUser = function(a0, a1, a2) {
var r1;
var r0;
var value = a1;
var value2 = a3;
var property = (value2 !== undefined ? value2 : {}).requireExact;
r1 = property !== undefined ? property : false;
var value4 = a2 != null;
if (value4) {
property = a2.username;
r1 = r1 ? property === a0 : property.startsWith(a0);
r1 = r1 && a2.discriminator === (value ?? '0');
r0 = r1;
} else {
r0 = value4;
}
return r0;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
const emojiStore = importDefault(6540) /* metro dependency 6540: EmojiStore */;
const activeJoinedThreadsStore = importDefault(5071) /* metro dependency 5071: ActiveJoinedThreadsStore */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildChannelStore = importDefault(1935) /* metro dependency 1935: GuildChannelStore */;
const env0_8 = (require(1935) /* metro dependency 1935: GuildChannelStore */).GUILD_SELECTABLE_CHANNELS_KEY;
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 permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const env0_15 = (require(661) /* metro dependency 661: Constants */).Permissions;
const env0_16 = (require(1881) /* metro dependency 1881: EmojiConstants */).EmojiIntention;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/channel_text_area/PlaintextResolvers.tsx');
exports.resolvePlaintextInlineVoid = closure;
exports.resolveApplicationCommandOption = resolveApplicationCommandOption;
}
function _createForOfIteratorHelperLoose_63887(a0, a1) { // fn#63887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8232:303, offset: 0x01b946f0, size: 370 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 _fun63888;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_63889(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_63889(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_63889(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun63888;
}
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 resolvePlaintextInlineVoid(a0, a1, a2, a3) { // fn#63890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8232:1213, offset: 0x01b94862, size: 1338 bytes, params: 5, frame: 38
var environment;
var r0;
var r17;
var r10;
var r12;
var r21;
var r19;
var r14;
var object2;
var length;
var slice;
var unescapeChannelName;
var getTextChannelNameDisambiguations;
var value3;
var _createForOfIteratorHelperLoose_63887Binding;
var defaultImport;
var keys;
var value4;
var value5;
var done;
var value6;
var name;
var value7;
const COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS = (require(6526) /* metro dependency 6526: AutocompleteUtils */).COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS;
var value8;
var value9;
var value10;
var getChannels;
var value11;
var value12;
var value13;
var channel;
var moduleValue;
var computeChannelName;
var isCategory;
var can;
var VIEW_CHANNEL;
var value14;
var id;
var value15;
var getActiveJoinedThreadsForGuild;
var value16;
var defaultImport2;
var value17;
var value18;
var value19;
var defaultImport3;
var value20;
var value21;
var value22;
var moduleValue2;
var value23;
var value24;
var value25;
var getDisambiguatedEmojiContext;
var value26;
var getCustomEmoji;
var value27;
var get;
var value28;
var getChannel;
var value29;
var defaultImport4;
var isEmojiFiltered;
var CHAT;
var require_colons;
var HermesInternal;
var concat;
var animated;
let value = a3;
const value2 = null;
reducibleJoin2: while (true) {
if (value2 != value) {
r0 = value;
break reducibleJoin2;
}
r0 = {};
break reducibleJoin2;
}
const allowUsers = r0.allowUsers;
const r2 = allowUsers === undefined || allowUsers;
const allowRoles = r0.allowRoles;
const r1 = allowRoles === undefined || allowRoles;
let property = a0[0];
if (property === '@') {
return resolveUserOrRole(a0, a1, a2, r2, r1);
}
if (property === ':') {
value = environment;
value25 = (importDefault(3797) /* metro dependency 3797: UnicodeEmojis */).EMOJI_NAME_RE.exec(a0);
reducibleJoin44: while (true) {
if (value2 == value25) {
r0 = value2;
break reducibleJoin44;
}
property = value25[1];
getDisambiguatedEmojiContext = EmojiStore.getDisambiguatedEmojiContext;
value26 = Reflect.apply(getDisambiguatedEmojiContext, EmojiStore, [a1]);
getCustomEmoji = value26.getCustomEmoji;
value27 = Reflect.apply(getCustomEmoji, value26, []);
get = value27.get;
value28 = Reflect.apply(get, value27, [property]);
reducibleJoin37: while (true) {
if (value2 != a2) {
getChannel = ChannelStore.getChannel;
value29 = Reflect.apply(getChannel, ChannelStore, [a2]);
r14 = value29;
break reducibleJoin37;
}
r14 = value2;
break reducibleJoin37;
}
if (value2 != value28) {
defaultImport4 = importDefault(3801) /* metro dependency 3801: EmojiUtils */;
isEmojiFiltered = defaultImport4.isEmojiFiltered;
object2 = {emoji: value28, channel: r14};
CHAT = EmojiIntention.CHAT;
object2.intention = CHAT;
if (Reflect.apply(isEmojiFiltered, defaultImport4, [object2])) {
r0 = value2;
break reducibleJoin44;
}
id = value28.id;
reducibleJoin43: while (true) {
reducibleJoin41: while (true) {
if ('require_colons' in value28) {
require_colons = value28.require_colons;
if (require_colons) {
name = value28.name;
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value = ':' + name + ':';
r10 = value;
break reducibleJoin43;
}
break reducibleJoin41;
}
break reducibleJoin41;
}
name = value28.name;
r10 = name;
break reducibleJoin43;
}
animated = value28.animated;
r0 = {type: 'customEmoji', emoji: {emojiId: id, name: r10, animated: animated === true,
jumboable: false},
children: [{text: ''}]};
break reducibleJoin44;
}
r0 = value2;
break reducibleJoin44;
}
return r0;
}
if (property === '#') {
reducibleJoin33: while (true) {
if (value2 == a1) {
r0 = value2;
break reducibleJoin33;
}
length = a0.length;
reducibleJoin14: while (true) {
reducibleJoin12: while (true) {
if (length > 3) {
if (a0[1] !== '"') {
break reducibleJoin12;
}
length = a0.length;
if (a0[length - 1] === '"') {
value = environment;
value = require(4805) /* metro dependency 4805: useChannelName */;
unescapeChannelName = value.unescapeChannelName;
slice = a0.slice;
length = a0.length;
value = Reflect.apply(unescapeChannelName, value, [Reflect.apply(slice, a0, [2,
length - 1])]);
r17 = value;
break reducibleJoin14;
}
break reducibleJoin12;
}
break reducibleJoin12;
}
slice = a0.slice;
value = Reflect.apply(slice, a0, [1]);
r17 = value;
break reducibleJoin14;
}
value = environment;
getTextChannelNameDisambiguations = GuildChannelStore.getTextChannelNameDisambiguations;
value3 = Reflect.apply(getTextChannelNameDisambiguations, GuildChannelStore, [a1]);
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
keys = defaultImport.keys;
value4 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(keys, defaultImport, [value3]));
value5 = value4();
done = value5.done;
if (!done) {
r10 = value5;
reducibleLoop15: while (true) {
value6 = r10.value;
name = value3[value6].name;
if (name === r17) {
r0 = {type: 'channelMention', channelId: value6, children: [{text: ''}]};
break reducibleJoin33;
}
value7 = value4();
done = value7.done;
if (done) {
value8 = _createForOfIteratorHelperLoose_63887(COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS);
value9 = value8();
done = value9.done;
if (!done) {
r12 = value9;
reducibleLoop19: while (true) {
value10 = r12.value;
if (value10 !== GUILD_SELECTABLE_CHANNELS_KEY) {
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
getChannels = GuildChannelStore.getChannels;
value11 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(getChannels,
GuildChannelStore,
[a1])[value10]);
value12 = value11();
done = value12.done;
reducibleJoin26: while (true) {
if (done) {
break reducibleJoin26;
}
r21 = value12;
reducibleLoop21: while (true) {
value13 = r21.value;
channel = value13.channel;
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
computeChannelName = moduleValue.computeChannelName;
if (Reflect.apply(computeChannelName, moduleValue, [channel, UserStore,
RelationshipStore]) === r17) {
isCategory = channel.isCategory;
reducibleJoin24: while (true) {
reducibleJoin33: while (true) {
if (Reflect.apply(isCategory, channel, [])) {
can = PermissionStore.can;
VIEW_CHANNEL = Permissions.VIEW_CHANNEL;
if (Reflect.apply(can, PermissionStore, [VIEW_CHANNEL,
channel])) {
r0 = {type: 'channelMention', channelId: channel.id,
children: [{text: ''}]};
break reducibleJoin33;
}
break reducibleJoin24;
}
id = channel.id;
r0 = {type: 'channelMention', channelId: id,
children: [{text: ''}]};
break reducibleJoin33;
}
return r0;
}
}
value14 = value11();
done = value14.done;
if (done) {
break reducibleJoin26;
}
r21 = value14;
continue reducibleLoop21;
}
}
}
value15 = value8();
done = value15.done;
if (done) {
getActiveJoinedThreadsForGuild = ActiveJoinedThreadsStore.getActiveJoinedThreadsForGuild;
value16 = Reflect.apply(getActiveJoinedThreadsForGuild, ActiveJoinedThreadsStore,
[a1]);
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
defaultImport2 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
keys = defaultImport2.keys;
value17 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(keys,
defaultImport2,
[value16]));
value18 = value17();
done = value18.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value18;
reducibleLoop28: while (true) {
value19 = r10.value;
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
defaultImport3 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
keys = defaultImport3.keys;
value20 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(keys,
defaultImport3,
[value16[value19]]));
value21 = value20();
done = value21.done;
if (!done) {
r19 = value21;
reducibleLoop29: while (true) {
value22 = r19.value;
channel = value16[value19][value22].channel;
moduleValue2 = require(4805) /* metro dependency 4805: useChannelName */;
computeChannelName = moduleValue2.computeChannelName;
if (Reflect.apply(computeChannelName, moduleValue2, [channel, UserStore,
RelationshipStore]) === r17) {
id = channel.id;
r0 = {type: 'channelMention', channelId: id,
children: [{text: ''}]};
break reducibleJoin33;
}
value23 = value20();
done = value23.done;
if (done) {
value24 = value17();
done = value24.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value24;
continue reducibleLoop28;
}
r19 = value23;
continue reducibleLoop29;
}
}
value24 = value17();
done = value24.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value24;
continue reducibleLoop28;
}
break reducibleLoop19;
}
r12 = value15;
continue reducibleLoop19;
}
return r0;
}
getActiveJoinedThreadsForGuild = ActiveJoinedThreadsStore.getActiveJoinedThreadsForGuild;
value16 = Reflect.apply(getActiveJoinedThreadsForGuild, ActiveJoinedThreadsStore, [a1]);
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
defaultImport2 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
keys = defaultImport2.keys;
value17 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(keys, defaultImport2,
[value16]));
value18 = value17();
done = value18.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value18;
reducibleLoop28: while (true) {
value19 = r10.value;
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
defaultImport3 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
keys = defaultImport3.keys;
value20 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(keys, defaultImport3,
[value16[value19]]));
value21 = value20();
done = value21.done;
if (!done) {
r19 = value21;
reducibleLoop29: while (true) {
value22 = r19.value;
channel = value16[value19][value22].channel;
moduleValue2 = require(4805) /* metro dependency 4805: useChannelName */;
computeChannelName = moduleValue2.computeChannelName;
if (Reflect.apply(computeChannelName, moduleValue2, [channel, UserStore,
RelationshipStore]) === r17) {
id = channel.id;
r0 = {type: 'channelMention', channelId: id, children: [{text: ''}]};
break reducibleJoin33;
}
value23 = value20();
done = value23.done;
if (done) {
value24 = value17();
done = value24.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value24;
continue reducibleLoop28;
}
r19 = value23;
continue reducibleLoop29;
}
}
value24 = value17();
done = value24.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value24;
continue reducibleLoop28;
}
break reducibleLoop15;
}
r10 = value7;
continue reducibleLoop15;
}
return r0;
}
value8 = _createForOfIteratorHelperLoose_63887(COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS);
value9 = value8();
done = value9.done;
if (!done) {
r12 = value9;
reducibleLoop19: while (true) {
value10 = r12.value;
if (value10 !== GUILD_SELECTABLE_CHANNELS_KEY) {
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
getChannels = GuildChannelStore.getChannels;
value11 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(getChannels,
GuildChannelStore,
[a1])[value10]);
value12 = value11();
done = value12.done;
reducibleJoin26: while (true) {
if (done) {
break reducibleJoin26;
}
r21 = value12;
reducibleLoop21: while (true) {
value13 = r21.value;
channel = value13.channel;
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
computeChannelName = moduleValue.computeChannelName;
if (Reflect.apply(computeChannelName, moduleValue, [channel, UserStore,
RelationshipStore]) === r17) {
isCategory = channel.isCategory;
reducibleJoin24: while (true) {
reducibleJoin33: while (true) {
if (Reflect.apply(isCategory, channel, [])) {
can = PermissionStore.can;
VIEW_CHANNEL = Permissions.VIEW_CHANNEL;
if (Reflect.apply(can, PermissionStore, [VIEW_CHANNEL, channel])) {
r0 = {type: 'channelMention', channelId: channel.id,
children: [{text: ''}]};
break reducibleJoin33;
}
break reducibleJoin24;
}
id = channel.id;
r0 = {type: 'channelMention', channelId: id, children: [{text: ''}]};
break reducibleJoin33;
}
return r0;
}
}
value14 = value11();
done = value14.done;
if (done) {
break reducibleJoin26;
}
r21 = value14;
continue reducibleLoop21;
}
}
}
value15 = value8();
done = value15.done;
if (done) {
getActiveJoinedThreadsForGuild = ActiveJoinedThreadsStore.getActiveJoinedThreadsForGuild;
value16 = Reflect.apply(getActiveJoinedThreadsForGuild, ActiveJoinedThreadsStore, [a1]);
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
defaultImport2 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
keys = defaultImport2.keys;
value17 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(keys, defaultImport2,
[value16]));
value18 = value17();
done = value18.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value18;
reducibleLoop28: while (true) {
value19 = r10.value;
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
defaultImport3 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
keys = defaultImport3.keys;
value20 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(keys, defaultImport3,
[value16[value19]]));
value21 = value20();
done = value21.done;
if (!done) {
r19 = value21;
reducibleLoop29: while (true) {
value22 = r19.value;
channel = value16[value19][value22].channel;
moduleValue2 = require(4805) /* metro dependency 4805: useChannelName */;
computeChannelName = moduleValue2.computeChannelName;
if (Reflect.apply(computeChannelName, moduleValue2, [channel, UserStore,
RelationshipStore]) === r17) {
id = channel.id;
r0 = {type: 'channelMention', channelId: id, children: [{text: ''}]};
break reducibleJoin33;
}
value23 = value20();
done = value23.done;
if (done) {
value24 = value17();
done = value24.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value24;
continue reducibleLoop28;
}
r19 = value23;
continue reducibleLoop29;
}
}
value24 = value17();
done = value24.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value24;
continue reducibleLoop28;
}
break reducibleLoop19;
}
r12 = value15;
continue reducibleLoop19;
}
return r0;
}
getActiveJoinedThreadsForGuild = ActiveJoinedThreadsStore.getActiveJoinedThreadsForGuild;
value16 = Reflect.apply(getActiveJoinedThreadsForGuild, ActiveJoinedThreadsStore, [a1]);
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
defaultImport2 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
keys = defaultImport2.keys;
value17 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(keys, defaultImport2, [value16]));
value18 = value17();
done = value18.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value18;
reducibleLoop28: while (true) {
value19 = r10.value;
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
defaultImport3 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
keys = defaultImport3.keys;
value20 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(keys, defaultImport3,
[value16[value19]]));
value21 = value20();
done = value21.done;
if (!done) {
r19 = value21;
reducibleLoop29: while (true) {
value22 = r19.value;
channel = value16[value19][value22].channel;
moduleValue2 = require(4805) /* metro dependency 4805: useChannelName */;
computeChannelName = moduleValue2.computeChannelName;
if (Reflect.apply(computeChannelName, moduleValue2, [channel, UserStore,
RelationshipStore]) === r17) {
id = channel.id;
r0 = {type: 'channelMention', channelId: id, children: [{text: ''}]};
break reducibleJoin33;
}
value23 = value20();
done = value23.done;
if (done) {
value24 = value17();
done = value24.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value24;
continue reducibleLoop28;
}
r19 = value23;
continue reducibleLoop29;
}
}
value24 = value17();
done = value24.done;
if (done) {
r0 = value2;
break reducibleJoin33;
}
r10 = value24;
continue reducibleLoop28;
}
}
return r0;
}
return value2;
}
function resolveApplicationCommandOption(a0, a1, a2, a3) { // fn#63896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8232:4009, offset: 0x01b95007, size: 69 bytes, params: 5, frame: 18
var r0;
var value;
const plaintextInlineVoid = resolvePlaintextInlineVoid(a0, a1, a2, a3);
const value2 = null;
if (value2 == plaintextInlineVoid) {
r0 = value2;
} else {
value = require(7079) /* metro dependency 7079: SlateUtils */;
value = value.voidToOptionValue(plaintextInlineVoid);
r0 = value;
}
return r0;
}
function resolveUserOrRole(a0, a1, a2, a3, a4) { // fn#63891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8232:1367, owner: resolvePlaintextInlineVoid.resolveUserOrRole, offset: 0x01b94d9c, size: 456 bytes, params: 6, frame: 26
var r10;
var _createForOfIteratorHelperLoose_63887Binding;
var getSortedRoles;
var id;
var value4;
var value5;
var done;
var value6;
var name;
var value7;
var object2;
var getChannel;
var value8;
var isPrivate;
var getMembers;
var value9;
var map;
var value10;
var recipients;
var value11;
var filter;
var value12;
var length;
var property3;
var matchesUserBinding;
let value = a0.slice(1);
value = value.split('#', 2);
value = env1_3(value, 2);
const property = value[0];
const property2 = value[1];
value = null;
let r7 = value != a1 ? GuildStore.getGuild(a1) : value;
if (a4) {
if (value != property2) {
if (a3) {
r7 = value != a2 ? ChannelStore.getChannel(a2) : value;
if (value == r7) {
return value;
}
value12 = (r7.isPrivate() ? r7.recipients : GuildMemberStore.getMembers(a1).map(function(a0) {
return a0.userId;
})).map(_fun63893).filter(_fun63894);
if (value12.length !== 1) {
return value;
}
property3 = value12[0];
if (matchesUser(property, property2, property3, {requireExact: true})) {
return {type: 'userMention', userId: property3.id, children: [{text: ''}]};
}
return value;
}
return value;
}
if (value == r7) {
if (a3) {
r7 = value != a2 ? ChannelStore.getChannel(a2) : value;
if (value == r7) {
return value;
}
value12 = (r7.isPrivate() ? r7.recipients : GuildMemberStore.getMembers(a1).map(_fun63892)).map(_fun63893).filter(_fun63894);
if (value12.length !== 1) {
return value;
}
property3 = value12[0];
if (matchesUser(property, property2, property3, {requireExact: true})) {
return {type: 'userMention', userId: property3.id, children: [{text: ''}]};
}
return value;
}
return value;
}
_createForOfIteratorHelperLoose_63887Binding = _createForOfIteratorHelperLoose_63887;
getSortedRoles = GuildRoleStore.getSortedRoles;
id = r7.id;
value4 = _createForOfIteratorHelperLoose_63887Binding(Reflect.apply(getSortedRoles, GuildRoleStore, [id]));
value5 = value4();
done = value5.done;
if (done) {
if (a3) {
r7 = value != a2 ? ChannelStore.getChannel(a2) : value;
if (value == r7) {
return value;
}
value12 = (r7.isPrivate() ? r7.recipients : GuildMemberStore.getMembers(a1).map(_fun63892)).map(_fun63893).filter(_fun63894);
if (value12.length !== 1) {
return value;
}
property3 = value12[0];
if (matchesUser(property, property2, property3, {requireExact: true})) {
return {type: 'userMention', userId: property3.id, children: [{text: ''}]};
}
return value;
}
return value;
}
r10 = value5;
loopExit6: while (true) {
value6 = r10.value;
name = value6.name;
if (property === name) {
break loopExit6;
}
value7 = value4();
done = value7.done;
if (done) {
if (a3) {
if (value == a2) {
r7 = value;
continue;
}
getChannel = ChannelStore.getChannel;
value8 = Reflect.apply(getChannel, ChannelStore, [a2]);
r7 = value8;
if (value == r7) {
return value;
}
isPrivate = r7.isPrivate;
if (Reflect.apply(isPrivate, r7, [])) {
recipients = r7.recipients;
r10 = recipients;
} else {
getMembers = GuildMemberStore.getMembers;
value9 = Reflect.apply(getMembers, GuildMemberStore, [a1]);
value10 = value9.map(_fun63892);
r10 = value10;
}
map = r10.map;
value11 = Reflect.apply(map, r10, [_fun63893]);
filter = value11.filter;
value12 = Reflect.apply(filter, value11, [_fun63894]);
length = value12.length;
if (length !== 1) {
return value;
}
property3 = value12[0];
matchesUserBinding = matchesUser;
object2 = {requireExact: true};
if (matchesUserBinding(property, property2, property3, object2)) {
return {type: 'userMention', userId: property3.id, children: [{text: ''}]};
}
return value;
}
return value;
}
r10 = value7;
continue;
}
id = value6.id;
return {type: 'roleMention', roleId: id, children: [{text: ''}]};
}
if (a3) {
r7 = value != a2 ? ChannelStore.getChannel(a2) : value;
if (value == r7) {
return value;
}
value12 = (r7.isPrivate() ? r7.recipients : GuildMemberStore.getMembers(a1).map(function(a0) {
return a0.userId;
})).map(_fun63893).filter(_fun63894);
if (value12.length !== 1) {
return value;
}
property3 = value12[0];
if (matchesUser(property, property2, property3, {requireExact: true})) {
return {type: 'userMention', userId: property3.id, children: [{text: ''}]};
}
}
return value;
}
function _fun63894(a0) { // fn#63894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8232:1851, offset: 0x01b94f7b, size: 39 bytes, params: 2, frame: 16
var r0;
let value = a0 !== undefined;
if (value) {
value = environment.__proto__.__proto__;
value = matchesUser(env0_0, env0_1, a0);
r0 = value;
} else {
r0 = value;
}
return r0;
}