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

984 lines
47 KiB
TypeScript

/* Metro module 9619; source: modules/forums/ForumHooks.tsx; dependencies: [5, 31, 6540, 5071, 4790, 6898, 1379, 6269, 1867, 3784, 4605, 1878, 6897, 6865, 9620, 7156, 6900, 661, 1386, 1243, 566, 6899, 694, 22, 1360, 4594, 21, 7169, 1388, 8190, 4634, 8349, 9587, 9621, 5097, 2] */
function _fun75346(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#75346, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:6, offset: 0x01dab348, size: 846 bytes, params: 8, frame: 23
let env0_0 = require;
const closure = useDefaultReactionEmoji;
const closure2 = function(a0) {
var env0_0 = a0;
return require(dependencyMap[20]).useStateFromStores([PermissionStore], _fun75353);
};
const closure3 = function({channelId}) {
return require(dependencyMap[20]).useStateFromStoresObject([ForumSearchStore], _fun75355);
};
const closure4 = function(a0, a1) {
var env0_0 = a0;
var env0_1 = a1;
return require(dependencyMap[20]).useStateFromStores([ActiveJoinedThreadsStore, ReadStateStore, ChannelStore],
_fun75357);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const env0_4 = importAll(31) /* metro dependency 31 */;
const emojiStore = importDefault(6540) /* metro dependency 6540: EmojiStore */;
const activeJoinedThreadsStore = importDefault(5071) /* metro dependency 5071: ActiveJoinedThreadsStore */;
const activeThreadsStore = importDefault(4790) /* metro dependency 4790: ActiveThreadsStore */;
const threadMessageStore = importDefault(6898) /* metro dependency 6898: ThreadMessageStore */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildMemberRequesterStore = importDefault(6269) /* metro dependency 6269: GuildMemberRequesterStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
const readStateStore = importDefault(4605) /* metro dependency 4605: ReadStateStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const forumActivePostStore = importDefault(6897) /* metro dependency 6897: ForumActivePostStore */;
const forumPostMessagesStore = importDefault(6865) /* metro dependency 6865: ForumPostMessagesStore */;
const forumPostUnreadCountStore = importDefault(9620) /* metro dependency 9620: ForumPostUnreadCountStore */;
const forumSearchStore = importDefault(7156) /* metro dependency 7156: ForumSearchStore */;
const env0_19 = (require(6900) /* metro dependency 6900: ForumConstants */).ForumTimestampFormats;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_20 = constantsModule.AnalyticsObjectTypes;
const env0_21 = constantsModule.AnalyticsObjects;
const env0_22 = constantsModule.EMPTY_STRING_SNOWFLAKE_ID;
const env0_23 = constantsModule.Permissions;
const env0_24 = (require(1386) /* metro dependency 1386: ChannelConstants */).ChannelFlags;
const env0_25 = (require(1243) /* metro dependency 1243: ThreadConstants */).MAX_THREAD_UNREAD_MESSAGE_COUNT;
const env0_26 = {'isNew': false, 'hasUnreads': false};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/forums/ForumHooks.tsx');
exports.useLoadForumUnreadCounts = useLoadForumUnreadCounts;
exports.useExistingPin = function(a0) {
var env0_0 = a0;
return require(dependencyMap[20]).useStateFromStores([ActiveThreadsStore, ChannelStore], _fun75364);
};
exports.useFacepileUsers = useFacepileUsers;
exports.useLastActiveTimestamp = useLastActiveTimestamp;
exports.useMostUsedReaction = useMostUsedReaction;
exports.useDefaultReactionEmoji = closure;
exports.useSomeForumPostReactions = useSomeForumPostReactions;
exports.useMaxPossibleForumPostReactions = useMaxPossibleForumPostReactions;
exports.useMessageCount = useMessageCount;
exports.useForumPostMessageAuthor = useForumPostMessageAuthor;
exports.useForumPostAuthor = useForumPostAuthor;
exports.getForumPostAuthor = getForumPostAuthor;
exports.useForumPostFirstMessageMarkup = useForumPostFirstMessageMarkup;
exports.useCanManageChannel = function(a0) {
var env0_0 = a0;
return require(dependencyMap[20]).useStateFromStores([PermissionStore], _fun75397);
};
exports.useForumPostReadStates = function(a0) {
var env0_0 = a0;
return require(dependencyMap[20]).useStateFromStoresObject([GuildStore, ReadStateStore], _fun75399);
};
exports.useChannelTemplate = useChannelTemplate;
exports.useForumThreadsForChannelList = useForumThreadsForChannelList;
exports.useCanSearchForumPosts = closure2;
exports.useCanViewArchivedPosts = function(a0) {
var env0_0 = a0;
return require(dependencyMap[20]).useStateFromStores([PermissionStore], _fun75405);
};
exports.useForumSearchQuery = function({channelId}) {
return require(dependencyMap[20]).useStateFromStores([ForumSearchStore], _fun75407);
};
exports.useForumSearchState = closure3;
exports.useHasForumSearchQuery = function(a0) {
var env0_0 = a0;
return require(dependencyMap[20]).useStateFromStores([ForumSearchStore], _fun75409);
};
exports.useAutomaticForumSearch = useAutomaticForumSearch;
exports.useUnreadThreadsCountForParent = closure4;
exports.useForumActiveThreadIds = useForumActiveThreadIds;
}
function sortForumPostReactionsByPopularityDesc(a0) { // fn#75347, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:481, offset: 0x01dab696, size: 81 bytes, params: 2, frame: 15
return (importDefault(22) /* metro dependency 22 */).orderBy(a0, [function(a0) {
return a0.count + a0.burst_count;
}, function(a0) {
return a0.burst_count;
}], ['desc', 'desc']);
}
function useDefaultReactionEmoji(a0) { // fn#75350, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:620, offset: 0x01dab706, size: 193 bytes, params: 2, frame: 17
const value = null;
const defaultReactionEmoji = value == a0 ? undefined : a0.defaultReactionEmoji;
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([EmojiStore], _fun75351);
return value == defaultReactionEmoji ? value : value == defaultReactionEmoji.emojiId ? value != defaultReactionEmoji.emojiName ? {id: defaultReactionEmoji.emojiId,
name: defaultReactionEmoji.emojiName,
animated: false} : value : value != value4 ? {id: defaultReactionEmoji.emojiId, name: value4.name,
animated: value4.animated} : value != defaultReactionEmoji.emojiName ? {id: defaultReactionEmoji.emojiId,
name: defaultReactionEmoji.emojiName, animated: false} : value;
}
function useCanSearchForumPosts(a0) { // fn#75352, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:1007, offset: 0x01dab80a, size: 66 bytes, params: 2, frame: 14
const env0_0 = a0;
return (require(566) /* metro dependency 566: flux */).useStateFromStores([PermissionStore], _fun75353);
}
function useForumSearchState({channelId}) { // fn#75354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:1120, offset: 0x01dab872, size: 72 bytes, params: 2, frame: 14
return (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([ForumSearchStore], function() {
var object = {};
var channelIdBinding = channelId;
object.isSearchLoading = ForumSearchStore.getSearchLoading(channelIdBinding);
object.searchQuery = ForumSearchStore.getSearchQuery(channelIdBinding);
object.searchResults = ForumSearchStore.getSearchResults(channelIdBinding);
return object;
});
}
function useUnreadThreadsCountForParent(a0, a1) { // fn#75356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:1326, offset: 0x01dab906, size: 89 bytes, params: 3, frame: 15
const env0_0 = a0;
const env0_1 = a1;
return (require(566) /* metro dependency 566: flux */).useStateFromStores([ActiveJoinedThreadsStore, ReadStateStore,
ChannelStore], _fun75357);
}
function useLoadForumUnreadCounts(a0, a1, a2, a3) { // fn#75358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:1880, offset: 0x01daba7f, size: 151 bytes, params: 5, frame: 20
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const env0_3 = a3;
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([ActiveThreadsStore], _fun75359);
value2.useEffect(_fun75360, [a0.id, a0.guild_id, value2, a2, a1, a3]);
}
function useExistingPin(a0) { // fn#75363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2389, offset: 0x01dabc62, size: 74 bytes, params: 2, frame: 15
const env0_0 = a0;
return (require(566) /* metro dependency 566: flux */).useStateFromStores([ActiveThreadsStore, ChannelStore],
_fun75364);
}
function useFacepileUsers(a0, a1) { // fn#75366, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2673, offset: 0x01dabd5e, size: 106 bytes, params: 3, frame: 17
const env0_0 = a0;
const env0_1 = a1;
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([UserStore], _fun75367);
(importDefault(4594) /* metro dependency 4594: useMountEffect */)(_fun75369);
return value2;
}
function useLastActiveTimestamp(a0, a1) { // fn#75371, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2914, offset: 0x01dabe56, size: 205 bytes, params: 3, frame: 19
let value = a2;
const env0_0 = a0;
const env0_1 = a1;
const r1 = value !== undefined ? value : ForumTimestampFormats.DURATION_AGO;
const binding = undefined;
const value2 = binding.useMemo(_fun75372, [a0.id]);
value = require(7169) /* metro dependency 7169: ThreadUtils */;
value = value.useLastMessageTimestamp(a0);
return binding.useMemo(_fun75374, [value, a1, value2, binding.useMemo(_fun75373, [a1, r1])]);
}
function useMostUsedReaction(a0) { // fn#75375, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:3301, offset: 0x01dac00b, size: 61 bytes, params: 2, frame: 15
const env0_0 = a0;
return env0_4.useMemo(_fun75376, [a0?.reactions]);
}
function useSomeForumPostReactions({message, parentChannel, count, sorted}) { // fn#75377, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:3585, offset: 0x01dac08d, size: 255 bytes, params: 2, frame: 21
var object2;
let value = undefined;
count = count === value ? 1 : count;
sorted = sorted === value || sorted;
const value5 = useDefaultReactionEmoji(parentChannel);
const value6 = env0_4.useMemo(_fun75378, [message == null ? value : message.reactions, sorted]);
let r6 = value5 == null ? [] : [{'emoji': null, 'me': false, 'count': 0, 'burst_count': 0, 'me_burst': false,
emoji: value5}];
r6 = value6.length > 0 ? value6 : r6;
object2 = {};
object2.reactions = r6.slice(0, count);
value = importDefault(22) /* metro dependency 22 */;
const sum = value.sum;
const value7 = r6.slice(count, r6.length);
object2.additionalNonUniqueReactionCount = Reflect.apply(sum, value, [value7.map(function(a0) {
return a0.count + a0.burst_count;
})]);
return object2;
}
function useMaxPossibleForumPostReactions({containerWidth, reactionEmojiWidth, digitWidth, message, parentChannel}) { // fn#75380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:4115, offset: 0x01dac1ca, size: 334 bytes, params: 2, frame: 25
var r1;
var r3;
var r7;
var r0;
var r2;
var property;
var burst_count;
var count;
var Math;
var ceil;
var Math2;
var log10;
var value5;
var value6;
var value7;
const value3 = useDefaultReactionEmoji(parentChannel);
let value = env0_4.useMemo(function() {
var r0;
var sortForumPostReactionsByPopularityDescBinding = sortForumPostReactionsByPopularityDesc;
r0 = message?.reactions;
r0 = r0 ?? [];
return sortForumPostReactionsByPopularityDescBinding(r0);
}, [message?.reactions]);
let r5 = value3 == null ? [] : [{'emoji': null, 'me': false, 'count': 0, 'burst_count': 0, 'me_burst': false,
emoji: value3}];
let length = value.length;
r5 = length > 0 ? value : r5;
length = r5.length;
if (0 < length) {
r1 = 0;
r3 = 0;
r7 = 0;
while (true) {
property = r5[r1];
burst_count = property.burst_count;
if (burst_count > 0) {
burst_count = property.burst_count;
r0 = burst_count;
} else {
count = property.count;
r0 = count;
}
Math = global.Math;
ceil = Math.ceil;
Math2 = global.Math;
log10 = Math2.log10;
value = reactionEmojiWidth + digitWidth * Reflect.apply(ceil, Math, [Reflect.apply(log10, Math2,
[r0 + 1])]);
if (r3 + value < containerWidth) {
value = r3 + value;
value5 = r7 + 1;
value6 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
length = r5.length;
if (value6 < length) {
r1 = value6;
r3 = value;
r7 = value5;
continue;
}
r2 = value5;
break;
}
r2 = r7;
break;
}
} else {
r2 = 0;
}
value = r5.length - r2;
if (value > 0) {
value7 = r2 - 1;
value += 1;
r1 = value;
r3 = value7;
} else {
r1 = value;
r3 = r2;
}
return {reactions: r5.slice(0, r3), additionalReactionCount: r1};
}
function useMessageCount(a0) { // fn#75382, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:4762, offset: 0x01dac34c, size: 238 bytes, params: 2, frame: 21
const env0_0 = a0;
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([ThreadMessageStore], _fun75383);
const messageCountText = (require(8190) /* metro dependency 8190: MessageCountUtils */).getMessageCountText(value2,
a0.id);
const env0_2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([ReadStateStore], _fun75384);
return {messageCount: value2, isMaxMessageCount: value2 != null && '' + value2 !== messageCountText,
messageCountText: messageCountText,
unreadCount: (require(566) /* metro dependency 566: flux */).useStateFromStores([ForumPostUnreadCountStore],
_fun75385)};
}
function useForumPostMessageAuthor(a0, a1) { // fn#75386, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:5290, offset: 0x01dac524, size: 283 bytes, params: 3, frame: 22
const value = null;
const value2 = undefined;
const id = value == a0 || value == a0.author ? value2 : a0.author.id;
const guildId = a1.getGuildId();
const user = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
return UserStore.getUser(id);
});
const value5 = (require(4634) /* metro dependency 4634: useMessageAuthor */).useNullableMessageAuthor(a0);
env0_4.useEffect(_fun75388, [guildId, id]);
const nick = value == value5 ? value2 : value5.nick;
const colorString = value == value5 ? value2 : value5.colorString;
const colorStrings = value == value5 ? value2 : value5.colorStrings;
return {authorName: value != nick ? nick : value == user ? value2 : user.username,
authorColor: value != colorString ? colorString : value,
authorColors: value != colorStrings ? colorStrings : value, user: user};
}
function useForumPostAuthor(a0) { // fn#75389, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:5787, offset: 0x01dac694, size: 210 bytes, params: 2, frame: 20
const env0_0 = a0;
const value2 = undefined;
const user = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], _fun75390);
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([ForumPostMessagesStore],
_fun75391);
const value4 = (require(4634) /* metro dependency 4634: useMessageAuthor */).useNullableUserAuthor((value3 == null ? value2 : value3.author) ?? user,
a0);
env0_4.useEffect(_fun75392, [a0.guild_id, a0.ownerId]);
return {user: user, author: value4};
}
function getForumPostAuthor(a0) { // fn#75393, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:6213, offset: 0x01dac7f1, size: 133 bytes, params: 2, frame: 18
const user = UserStore.getUser(a0.ownerId);
const message = ForumPostMessagesStore.getMessage(a0.id);
const value4 = undefined;
const firstMessage = message == null ? value4 : message.firstMessage;
const object2 = {user: user};
object2.author = (require(4634) /* metro dependency 4634: useMessageAuthor */).getUserAuthor((firstMessage == null ? value4 : firstMessage.author) ?? user,
a0);
return object2;
}
function useForumPostFirstMessageMarkup({firstMessage, formatInline, noStyleAndInteraction, hasUnreads}) { // fn#75394, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:6448, offset: 0x01dac876, size: 220 bytes, params: 2, frame: 20
var object2;
formatInline = formatInline === undefined || formatInline;
noStyleAndInteraction = noStyleAndInteraction === undefined || noStyleAndInteraction;
hasUnreads = hasUnreads === undefined || hasUnreads;
const value2 = env0_4.useMemo(_fun75395, [firstMessage, formatInline, noStyleAndInteraction,
hasUnreads ? 'text-default' : 'text-muted']);
const hasSpoilerEmbeds = value2.hasSpoilerEmbeds;
object2 = {hasSpoilerEmbeds: hasSpoilerEmbeds};
object2.content = value2.content;
object2.firstMedia = (require(9587) /* metro dependency 9587: ForumPostMediaUtils */).useFindFirstMediaProperties(firstMessage,
hasSpoilerEmbeds);
object2.firstMediaIsEmbed = (require(9587) /* metro dependency 9587: ForumPostMediaUtils */).useFirstMediaIsEmbed(firstMessage,
hasSpoilerEmbeds);
return object2;
}
function useCanManageChannel(a0) { // fn#75396, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:7027, offset: 0x01dac9e2, size: 66 bytes, params: 2, frame: 14
const env0_0 = a0;
return (require(566) /* metro dependency 566: flux */).useStateFromStores([PermissionStore], _fun75397);
}
function useForumPostReadStates(a0) { // fn#75398, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:7158, offset: 0x01daca4a, size: 75 bytes, params: 2, frame: 15
const env0_0 = a0;
return (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([GuildStore, ReadStateStore],
_fun75399);
}
function useChannelTemplate(a0) { // fn#75400, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:7378, offset: 0x01dacb01, size: 44 bytes, params: 2, frame: 14
const env0_0 = a0;
return env0_4.useMemo(_fun75401, [a0]);
}
function useForumThreadsForChannelList(a0) { // fn#75402, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:7517, offset: 0x01dacb6e, size: 102 bytes, params: 2, frame: 14
const env0_0 = a0;
const value = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([ActiveJoinedThreadsStore],
_fun75403);
return {activeJoinedThreads: value.activeJoinedThreads, activeUnjoinedThreads: value.activeUnjoinedThreads,
newThreadCounts: value.newThreadCounts};
}
function useCanViewArchivedPosts(a0) { // fn#75404, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:7983, offset: 0x01dacc22, size: 66 bytes, params: 2, frame: 14
const env0_0 = a0;
return (require(566) /* metro dependency 566: flux */).useStateFromStores([PermissionStore], _fun75405);
}
function useForumSearchQuery({channelId}) { // fn#75406, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:8120, offset: 0x01dacc64, size: 71 bytes, params: 2, frame: 14
return (require(566) /* metro dependency 566: flux */).useStateFromStores([ForumSearchStore], _fun75407);
}
function useHasForumSearchQuery(a0) { // fn#75408, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:8311, offset: 0x01daccd3, size: 66 bytes, params: 2, frame: 14
const env0_0 = a0;
return (require(566) /* metro dependency 566: flux */).useStateFromStores([ForumSearchStore], _fun75409);
}
function useAutomaticForumSearch(a0, a1, a2) { // fn#75410, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:8445, offset: 0x01dacd36, size: 242 bytes, params: 4, frame: 22
const value = a3;
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const r9 = value !== undefined ? value : false;
const value2 = useForumSearchState({channelId: a0.id});
const isSearchLoading = value2.isSearchLoading;
const env0_4 = isSearchLoading;
const searchQuery = value2.searchQuery;
const value3 = useCanSearchForumPosts(a0);
const binding = env0_4;
let useRef = binding.useRef;
const env0_7 = Reflect.apply(useRef, binding, [null]);
useRef = binding.useRef;
const Set = global.Set;
const env0_8 = Reflect.apply(useRef, binding, [new Set()]);
binding.useEffect(_fun75411, [value3, a0.guild_id, a0.id, r9, isSearchLoading, searchQuery, a1, a2]);
}
function useForumActiveThreadIds({channel, sortOrder, tagFilter, tagSetting, shouldAutomaticallyAck}) { // fn#75415, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:9140, offset: 0x01dacfca, size: 222 bytes, params: 2, frame: 23
const env0_4 = shouldAutomaticallyAck;
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([ForumActivePostStore],
function() {
return ForumActivePostStore.getThreadIds(channel.id, sortOrder, tagFilter, tagSetting);
});
env0_4.useEffect(_fun75418, [channel,
(require(566) /* metro dependency 566: flux */).useStateFromStores([ForumActivePostStore], _fun75417,
[shouldAutomaticallyAck, useUnreadThreadsCountForParent(channel.guild_id, channel.id)])]);
return value2;
}
function _fun75351() { // fn#75351, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:735, offset: 0x01dab7c7, size: 67 bytes, params: 1, frame: 12
const defaultReactionEmojiBinding = defaultReactionEmoji;
const value2 = null;
return value2 != (value2 == defaultReactionEmojiBinding ? undefined : defaultReactionEmoji.emojiId) ? EmojiStore.getUsableCustomEmojiById(defaultReactionEmoji.emojiId) : value2;
}
function _fun75353() { // fn#75353, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:1082, offset: 0x01dab84c, size: 38 bytes, params: 1, frame: 13
const can = PermissionStore.can;
const READ_MESSAGE_HISTORY = Permissions.READ_MESSAGE_HISTORY;
return Reflect.apply(can, PermissionStore, [READ_MESSAGE_HISTORY, env0_0]);
}
function _fun75357() { // fn#75357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:1415, offset: 0x01dab95f, size: 288 bytes, params: 1, frame: 25
var r1;
var r4;
var r13;
var r0;
var r12;
var getActiveJoinedUnreadThreadsForParent;
var binding;
var value4;
var activeUnjoinedUnreadThreadsForParent;
var value6;
var value7;
var properties;
var properties2;
var properties3;
var propertyName;
var propertyName2;
var property;
var lastMessageId;
var channel;
var id;
var value8;
var value9;
var value10;
var value11;
var properties4;
var properties5;
var propertyName3;
var value12;
var value13;
var value14;
var value15;
const channel2 = ChannelStore.getChannel(require);
if (channel2 != null) {
if (channel2.isForumLikeChannel()) {
getActiveJoinedUnreadThreadsForParent = ActiveJoinedThreadsStore.getActiveJoinedUnreadThreadsForParent;
binding = env0_0;
value4 = Reflect.apply(getActiveJoinedUnreadThreadsForParent, ActiveJoinedThreadsStore, [binding, require]);
activeUnjoinedUnreadThreadsForParent = ActiveJoinedThreadsStore.getActiveUnjoinedUnreadThreadsForParent(binding,
require);
value6 = ReadStateStore.ackMessageId(require);
if (value6 == null) {
return 0;
}
value7 = 0;
properties = Object.keys(value4);
properties2 = 0;
properties3 = properties.length;
if (properties === undefined) {
r0 = value7;
} else {
r1 = value7;
r4 = properties2;
while (true) {
propertyName = properties[r4];
propertyName2 = r4 + 1;
if (propertyName === undefined) {
r0 = r1;
break;
}
property = value4[propertyName];
lastMessageId = ReadStateStore.lastMessageId;
channel = property.channel;
id = channel.id;
value8 = Reflect.apply(lastMessageId, ReadStateStore, [id]);
value9 = value8 != null;
if (!value9) {
r13 = value9;
continue;
}
value10 = value8 > value6;
r13 = value10;
if (!r13) {
r4 = propertyName2;
continue;
}
value11 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
r1 = value11;
r4 = propertyName2;
}
}
properties = Object.keys(activeUnjoinedUnreadThreadsForParent);
properties4 = 0;
properties5 = properties.length;
if (properties !== undefined) {
r1 = r0;
r4 = properties4;
while (true) {
propertyName = properties[r4];
propertyName3 = r4 + 1;
if (propertyName === undefined) {
r0 = r1;
break;
}
property = activeUnjoinedUnreadThreadsForParent[propertyName];
lastMessageId = ReadStateStore.lastMessageId;
id = property.id;
value12 = Reflect.apply(lastMessageId, ReadStateStore, [id]);
value13 = value12 != null;
if (!value13) {
r12 = value13;
continue;
}
value14 = value12 > value6;
r12 = value14;
if (!r12) {
r4 = propertyName3;
continue;
}
value15 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
r1 = value15;
r4 = propertyName3;
}
}
return r0;
}
}
return 0;
}
function _fun75359() { // fn#75359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:1962, offset: 0x01dabb16, size: 32 bytes, params: 1, frame: 11
return ActiveThreadsStore.hasLoaded(env0_0.guild_id);
}
function _fun75360() { // fn#75360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2005, offset: 0x01dabb36, size: 211 bytes, params: 1, frame: 21
var environment;
var value2;
var getThreadIds;
var binding;
var value7;
var defaultImport;
var dispatch;
if (env0_4) {
value2 = environment.__proto__;
getThreadIds = ForumActivePostStore.getThreadIds;
binding = env0_0;
value7 = ForumPostUnreadCountStore.getThreadIdsMissingCounts(binding.guild_id, Reflect.apply(getThreadIds,
ForumActivePostStore, [binding.id, require, importDefault, importAll])).filter(function(a0) {
return require(dependencyMap[21]).canDisplayPostUnreadMessageCount(a0, [ReadStateStore]);
}).slice(0, 180).map(_fun75362);
if (value7.length > 0) {
defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */;
dispatch = defaultImport.dispatch;
binding = env0_0;
Reflect.apply(dispatch, defaultImport, [{type: 'REQUEST_FORUM_UNREADS', guildId: binding.guild_id,
channelId: binding.id, threads: value7}]);
}
}
}
function _fun75364() { // fn#75364, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2458, offset: 0x01dabcac, size: 118 bytes, params: 1, frame: 16
const defaultImport = importDefault(22) /* metro dependency 22 */;
const getThreadsForParent = ActiveThreadsStore.getThreadsForParent;
const binding = env0_0;
return ChannelStore.getChannel(defaultImport(Reflect.apply(getThreadsForParent, ActiveThreadsStore,
[binding.guild_id, binding.parent_id])).keys().filter(_fun75365).head());
}
function _fun75367() { // fn#75367, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2748, offset: 0x01dabdc8, size: 69 bytes, params: 1, frame: 13
const value = require.map(function(a0) {
return UserStore.getUser(a0);
});
return value.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
}
function _fun75369() { // fn#75369, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2827, offset: 0x01dabe0d, size: 30 bytes, params: 1, frame: 11
env0_2.forEach(_fun75370);
}
function _fun75372() { // fn#75372, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2985, offset: 0x01dabf23, size: 50 bytes, params: 1, frame: 11
let value = environment.__proto__;
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
return value.extractTimestamp(env0_0.id);
}
function _fun75373() { // fn#75373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:3082, offset: 0x01dabf55, size: 50 bytes, params: 1, frame: 13
const value = environment.__proto__;
return (require(6899) /* metro dependency 6899: ForumUtils */).getForumTimestampFormatter(require, env0_2);
}
function _fun75374() { // fn#75374, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:3153, offset: 0x01dabf87, size: 132 bytes, params: 1, frame: 16
var r0;
var moduleValue;
var moduleValue2;
const ThreadSortOrder = (require(1388) /* metro dependency 1388: ThreadSortOrder */).ThreadSortOrder;
const CREATION_DATE = ThreadSortOrder.CREATION_DATE;
if (require === CREATION_DATE) {
moduleValue2 = require(7169) /* metro dependency 7169: ThreadUtils */;
r0 = moduleValue2.getTimestampString(env0_3, env0_5);
} else {
moduleValue = require(7169) /* metro dependency 7169: ThreadUtils */;
r0 = moduleValue.getTimestampString(env0_4, env0_5);
}
return r0;
}
function _fun75376() { // fn#75376, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:3351, offset: 0x01dac048, size: 69 bytes, params: 1, frame: 13
const value2 = undefined;
const r2 = (env0_0 == null ? value2 : env0_0.reactions) ?? [];
if (r2.length !== 0) {
value = environment.__proto__;
return sortForumPostReactionsByPopularityDesc(r2)[0];
}
return value2;
}
function _fun75378() { // fn#75378, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:3717, offset: 0x01dac18c, size: 62 bytes, params: 1, frame: 13
var r0;
var value;
const r2 = message?.reactions ?? [];
if (sorted) {
value = environment.__proto__;
value = sortForumPostReactionsByPopularityDesc(r2);
r0 = value;
} else {
r0 = r2;
}
return r0;
}
function _fun75383() { // fn#75383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:4829, offset: 0x01dac43a, size: 46 bytes, params: 1, frame: 11
const value = environment.__proto__;
return ThreadMessageStore.getCount(env0_0.id) ?? 0;
}
function _fun75384() { // fn#75384, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:4955, offset: 0x01dac468, size: 63 bytes, params: 1, frame: 14
const forumUtilsModule = require(6899) /* metro dependency 6899: ForumUtils */;
return forumUtilsModule.canDisplayPostUnreadMessageCount(env0_0.id, [ReadStateStore]);
}
function _fun75385() { // fn#75385, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:5048, offset: 0x01dac4a7, size: 125 bytes, params: 1, frame: 15
var value2;
var value3;
var value;
if (env0_2) {
value2 = environment.__proto__;
value3 = ForumPostUnreadCountStore.getCount(env0_0.id);
if (value3 == null) {
return '1+';
}
if (value3 > 0) {
value = global.Math.min(value3, env0_1);
return value >= MAX_THREAD_UNREAD_MESSAGE_COUNT ? '' + MAX_THREAD_UNREAD_MESSAGE_COUNT + '+' : value;
}
return '1+';
}
return null;
}
function _fun75388() { // fn#75388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:5514, offset: 0x01dac65a, size: 58 bytes, params: 1, frame: 13
var value4;
if (id != null && env0_1 != null) {
value4 = environment.__proto__;
GuildMemberRequesterStore.requestMember(env0_1, id);
}
}
function _fun75390() { // fn#75390, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:5859, offset: 0x01dac766, size: 33 bytes, params: 1, frame: 11
return UserStore.getUser(env0_0.ownerId);
}
function _fun75391() { // fn#75391, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:5921, offset: 0x01dac787, size: 49 bytes, params: 1, frame: 11
const value = environment.__proto__;
return ForumPostMessagesStore.getMessage(env0_0.id)?.firstMessage;
}
function _fun75392() { // fn#75392, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:6087, offset: 0x01dac7b8, size: 57 bytes, params: 1, frame: 13
var value2;
var requestMember;
var binding;
if (env0_0.ownerId != null) {
value2 = environment.__proto__;
requestMember = GuildMemberRequesterStore.requestMember;
binding = env0_0;
Reflect.apply(requestMember, GuildMemberRequesterStore, [binding.guild_id, binding.ownerId]);
}
}
function _fun75395() { // fn#75395, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:6616, offset: 0x01dac952, size: 144 bytes, params: 1, frame: 16
return firstMessage?.content == null ? {'hasSpoilerEmbeds': false,
'content': null} : firstMessage.content !== '' ? (importDefault(8349) /* metro dependency 8349: renderMessageMarkup */)(firstMessage,
{'formatInline': null, 'noStyleAndInteraction': null, 'allowHeading': true, 'allowList': true,
'allowGameMentions': true, formatInline: formatInline, noStyleAndInteraction: noStyleAndInteraction,
textColor: env0_3}) : {'hasSpoilerEmbeds': false, 'content': null};
}
function _fun75397() { // fn#75397, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:7099, offset: 0x01daca24, size: 38 bytes, params: 1, frame: 13
const can = PermissionStore.can;
const MANAGE_CHANNELS = Permissions.MANAGE_CHANNELS;
return Reflect.apply(can, PermissionStore, [MANAGE_CHANNELS, env0_0]);
}
function _fun75399() { // fn#75399, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:7241, offset: 0x01daca95, size: 108 bytes, params: 1, frame: 17
var r0;
var moduleValue;
const value = environment.__proto__;
const guild = GuildStore.getGuild(env0_0.getGuildId() ?? EMPTY_STRING_SNOWFLAKE_ID);
if (guild == null) {
r0 = env1_26;
} else {
moduleValue = require(6899) /* metro dependency 6899: ForumUtils */;
r0 = moduleValue.getForumPostReadStates(env0_0, guild, [ReadStateStore]);
}
return r0;
}
function _fun75401() { // fn#75401, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:7427, offset: 0x01dacb2d, size: 65 bytes, params: 1, frame: 12
return env0_0 == null || env0_0.template == null ? '' : env0_0.template.trim();
}
function _fun75403() { // fn#75403, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:7604, offset: 0x01dacbd4, size: 78 bytes, params: 1, frame: 13
const object2 = {};
const getActiveJoinedThreadsForGuild = ActiveJoinedThreadsStore.getActiveJoinedThreadsForGuild;
const binding = env0_0;
object2.activeJoinedThreads = Reflect.apply(getActiveJoinedThreadsForGuild, ActiveJoinedThreadsStore, [binding]);
object2.activeUnjoinedThreads = ActiveJoinedThreadsStore.getActiveUnjoinedThreadsForGuild(binding);
object2.newThreadCounts = ActiveJoinedThreadsStore.getNewThreadCountsForGuild(binding);
return object2;
}
function _fun75407() { // fn#75407, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:8204, offset: 0x01daccab, size: 40 bytes, params: 1, frame: 12
const channelIdBinding = channelId;
const value2 = null;
return value2 == channelIdBinding ? value2 : ForumSearchStore.getSearchQuery(channelId);
}
function _fun75409() { // fn#75409, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:8386, offset: 0x01dacd15, size: 33 bytes, params: 1, frame: 11
const value = environment.__proto__;
return ForumSearchStore.getSearchQuery(env0_0) != null;
}
function _fun75411() { // fn#75411, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:8648, offset: 0x01dace28, size: 280 bytes, params: 1, frame: 16
var environment;
var current;
var value2;
var defaultImport;
var setTimeout;
var value3;
var defaultImport2;
var value;
if (searchQuery != null) {
if (searchQuery == null) {
return undefined;
}
if (searchQuery.length === 0) {
return undefined;
}
if (env0_3) {
return undefined;
}
if (env0_6) {
current = env0_7.current;
if (current !== searchQuery) {
if (isSearchLoading) {
return undefined;
}
setTimeout = global.setTimeout;
value = environment.__proto__;
value = env1_3(_fun75413);
var env0_0 = setTimeout(value, 350);
return _fun75414;
}
current = env0_8.current;
if (current === require) {
return undefined;
}
if (isSearchLoading) {
return undefined;
}
setTimeout = global.setTimeout;
value = environment.__proto__;
value = env1_3(_fun75413);
var env0_0 = setTimeout(value, 350);
return _fun75414;
}
value2 = environment.__proto__;
defaultImport = importDefault(9621) /* metro dependency 9621: ForumActionCreators */;
defaultImport.clearForumSearch(env0_0.id);
} else {
current = env0_7.current;
if (current != null) {
value3 = environment.__proto__;
defaultImport2 = importDefault(9621) /* metro dependency 9621: ForumActionCreators */;
defaultImport2.clearForumSearch(env0_0.id);
env0_7.current = null;
return undefined;
}
if (searchQuery == null) {
return undefined;
}
if (searchQuery.length === 0) {
return undefined;
}
if (env0_3) {
return undefined;
}
if (env0_6) {
current = env0_7.current;
if (current !== searchQuery) {
if (isSearchLoading) {
return undefined;
}
setTimeout = global.setTimeout;
value = environment.__proto__;
value = env1_3(_fun75413);
var env0_0 = setTimeout(value, 350);
return _fun75414;
}
current = env0_8.current;
if (current === require) {
return undefined;
}
if (isSearchLoading) {
return undefined;
}
setTimeout = global.setTimeout;
value = environment.__proto__;
value = env1_3(_fun75413);
var env0_0 = setTimeout(value, 350);
return _fun75414;
}
defaultImport = importDefault(9621) /* metro dependency 9621: ForumActionCreators */;
defaultImport.clearForumSearch(env0_0.id);
}
}
function _fun75417() { // fn#75417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:9410, offset: 0x01dad0d6, size: 47 bytes, params: 1, frame: 11
var r1;
var r0;
var value;
const shouldAutomaticallyAckBinding = shouldAutomaticallyAck;
if (shouldAutomaticallyAckBinding) {
value = env0_5 > 0;
if (value) {
r1 = value;
} else {
value = environment.__proto__;
value = ForumActivePostStore.getCanAckThreads();
r1 = value;
}
r0 = r1;
} else {
r0 = shouldAutomaticallyAckBinding;
}
return r0;
}
function _fun75418() { // fn#75418, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:9473, offset: 0x01dad105, size: 87 bytes, params: 1, frame: 15
var value2;
var moduleValue;
if (env0_6) {
value2 = environment.__proto__;
moduleValue = require(5097) /* metro dependency 5097: ReadStateActionCreators */;
moduleValue.ackChannel(channel, {object: AnalyticsObjects.ACK_FORUM_ACTIVE_THREADS,
objectType: AnalyticsObjectTypes.ACK_AUTOMATIC});
}
}
function _fun75362(a0) { // fn#75362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2173, offset: 0x01dabc3f, size: 35 bytes, params: 2, frame: 12
const object2 = {threadId: a0};
object2.ackMessageId = ReadStateStore.getTrackedAckMessageId(a0);
return object2;
}
function _fun75365(a0) { // fn#75365, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2541, offset: 0x01dabd22, size: 60 bytes, params: 2, frame: 12
const value = environment.__proto__.__proto__;
return ChannelStore.getChannel(a0)?.hasFlag(ChannelFlags.PINNED) === true;
}
function _fun75370({id}) { // fn#75370, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:2843, offset: 0x01dabe2b, size: 43 bytes, params: 2, frame: 13
GuildMemberRequesterStore.requestMember(env1_0.guild_id, id);
}
function* _fun75413() { // fn#75413, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9805:8836, offset: 0x01dacf4b, size: 127 bytes, params: 1, frame: 20
var binding;
var binding2;
var property;
var value4;
var searchForumPosts;
var guild_id;
var id;
var value5;
var error;
if (true) {
value = environment.__proto__.__proto__;
ActiveThreadsStore.current = EmojiStore;
ThreadMessageStore.current = importDefault;
try {
binding = env3_1;
} catch (error) {
return undefined;
}
try {
binding2 = env3_2;
} catch (error) {
return undefined;
}
try {
property = binding2[33];
} catch (error) {
return undefined;
}
try {
value4 = binding(property);
} catch (error) {
return undefined;
}
try {
searchForumPosts = value4.searchForumPosts;
} catch (error) {
return undefined;
}
try {
} catch (error) {
return undefined;
}
try {
guild_id = require.guild_id;
} catch (error) {
return undefined;
}
try {
id = require.id;
} catch (error) {
return undefined;
}
try {
} catch (error) {
return undefined;
}
try {
} catch (error) {
return undefined;
}
try {
} catch (error) {
return undefined;
}
try {
value = Reflect.apply(searchForumPosts, value4, [guild_id, id, EmojiStore, importDefault, dependencyMap]);
} catch (error) {
return undefined;
}
yield value;
try {
value = undefined;
value5 = false;
} catch (error) {
return undefined;
}
if (value5) {
return value;
}
}
}