/* Metro module 11360; source: modules/opt_in_channels/OptInChannelsUtils.tsx; dependencies: [31, 1379, 5098, 4605, 3793, 1878, 661, 1386, 5101, 4865, 5103, 6590, 4805, 5099, 5092, 11361, 5097, 1230, 3968, 1365, 566, 1244, 3738, 21, 2] */ function _fun87029(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#87029, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:6, offset: 0x01fac2b2, size: 389 bytes, params: 8, frame: 19 const env0_0 = require; const setIndex_87030 = function(a0, a1) { a0.index = a1; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importAll(31) /* metro dependency 31 */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const guildCategoryStore = importDefault(5098) /* metro dependency 5098: GuildCategoryStore */; const readStateStore = importDefault(4605) /* metro dependency 4605: ReadStateStore */; const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; let value = require(661) /* metro dependency 661: Constants */; const env0_9 = value.Routes; const env0_10 = value.ChannelTypes; value = require(1386) /* metro dependency 1386: ChannelConstants */; const env0_11 = value.ChannelFlags; const env0_12 = value.StaticChannelRoute; const env0_13 = (require(5101) /* metro dependency 5101: GuildSidebarConstants */).ChannelListGuildActionRow; const env0_14 = (require(4865) /* metro dependency 4865: ReadStateConstants */).ReadStateTypes; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/opt_in_channels/OptInChannelsUtils.tsx'); exports.useFilterCategoriesByQuery = useFilterCategoriesByQuery; exports.getFirstRouteFor = getFirstRouteFor; exports.clearRecentChannels = clearRecentChannels; exports.useChannelBrowserSections = useChannelBrowserSections; exports.useChannelBrowserChannelCount = useChannelBrowserChannelCount; exports.getActiveAgoTimestamp = getActiveAgoTimestamp; } function useFilterCategoriesByQuery(a0, a1, a2, a3) { // fn#87031, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:448, offset: 0x01fac437, size: 150 bytes, params: 5, frame: 17 const env0_0 = a1; const env0_1 = a2; const value = a3.toLowerCase(); const value3 = (require(5103) /* metro dependency 5103: OnboardingHomeUtils */).useCanSeeOnboardingHome(a0); const binding = value3; return binding.useMemo(_fun87033, [a1, a2, binding.useCallback(_fun87032, [value3]), value]); } function getFirstRouteFor(a0) { // fn#87038, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:1184, offset: 0x01fac726, size: 270 bytes, params: 2, frame: 21 var r6; var channel; var row; var getChannelFromSectionRow; var value6; var value7; const sections = a0.getSections(false); const value3 = undefined; const SECTION_INDEX_GUILD_ACTIONS = (require(5092) /* metro dependency 5092: ChannelListState */).SECTION_INDEX_GUILD_ACTIONS; if (sections[SECTION_INDEX_GUILD_ACTIONS] > 0) { row = a0.getGuildActionSection().getRow(0); if (ChannelListGuildActionRow.GUILD_HOME === row) { return StaticChannelRoute.GUILD_HOME; } if (ChannelListGuildActionRow.GUILD_ROLE_SUBSCRIPTIONS === row) { return StaticChannelRoute.ROLE_SUBSCRIPTIONS; } reducibleJoin4: while (true) { if (ChannelListGuildActionRow.GUILD_MOD_DASH_MEMBER_SAFETY === row) { return StaticChannelRoute.MEMBER_SAFETY; } break reducibleJoin4; } } const SECTION_INDEX_UNCATEGORIZED_CHANNELS = (require(5092) /* metro dependency 5092: ChannelListState */).SECTION_INDEX_UNCATEGORIZED_CHANNELS; let voiceChannelsSectionNumber = a0.voiceChannelsSectionNumber; if (SECTION_INDEX_UNCATEGORIZED_CHANNELS < voiceChannelsSectionNumber) { r6 = SECTION_INDEX_UNCATEGORIZED_CHANNELS; reducibleLoop5: while (true) { if (sections[r6] > 0) { getChannelFromSectionRow = a0.getChannelFromSectionRow; value6 = Reflect.apply(getChannelFromSectionRow, a0, [r6, 0]); reducibleJoin8: while (true) { if (value6 == null) { channel = value3; break reducibleJoin8; } channel = value6.channel; break reducibleJoin8; } reducibleJoin9: while (true) { if (channel != null) { return channel.id; } break reducibleJoin9; } } value7 = typeof r6 === 'bigint' ? r6 + 1n : +r6 + 1; voiceChannelsSectionNumber = a0.voiceChannelsSectionNumber; if (!(value7 < voiceChannelsSectionNumber)) { return null; } r6 = value7; continue reducibleLoop5; } } return null; } function clearRecentChannels(a0, a1) { // fn#87039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:1710, offset: 0x01fac834, size: 149 bytes, params: 3, frame: 18 var moduleValue3; const value = a2; const r5 = value !== undefined ? value : null; (require(11361) /* metro dependency 11361: RecentChannelsActionCreators */).bulkClearRecents(a0, a1); const readStateActionCreatorsModule = require(5097) /* metro dependency 5097: ReadStateActionCreators */; readStateActionCreatorsModule.bulkAck(a1.map(function(a0) { var object = {channelId: a0}; object.readStateType = ReadStateTypes.CHANNEL; object.messageId = ReadStateStore.lastMessageId(a0); return object; })); if (r5 != null) { moduleValue3 = require(1230) /* metro dependency 1230: router_utils */; moduleValue3.transitionTo(Routes.CHANNEL(a0, r5)); } } function useChannelBrowserSections(a0, a1, a2, a3) { // fn#87041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:1957, offset: 0x01fac8f9, size: 205 bytes, params: 5, frame: 21 const env0_0 = a0; const env0_1 = a1; const env0_2 = a2; const dismissibleContentUnsafeUtilsModule = require(3968) /* metro dependency 3968: DismissibleContentUnsafeUtils */; const UNSAFE_useIsDismissibleContentDismissed = dismissibleContentUnsafeUtilsModule.UNSAFE_useIsDismissibleContentDismissed; const DismissibleContent = (require(1365) /* metro dependency 1365: dismissible_content */).DismissibleContent; const CHANNEL_BROWSER_NUX = DismissibleContent.CHANNEL_BROWSER_NUX; const value2 = Reflect.apply(UNSAFE_useIsDismissibleContentDismissed, dismissibleContentUnsafeUtilsModule, [CHANNEL_BROWSER_NUX]); const env0_3 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([ChannelStore], _fun87042, [a0]); const value = a1._categories.map(_fun87043); if (!(value2 || a3 == null)) { value.unshift({rowCount: 1, rowHeight: a3}); } return value; } function useChannelBrowserChannelCount(a0) { // fn#87044, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2531, offset: 0x01faca90, size: 222 bytes, params: 2, frame: 17 const env0_0 = a0; const value2 = undefined; const categories = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildCategoryStore], _fun87045); const length = categories._categories.length; const property = categories._categories[categories._categories.length - 1]; if (property == null) { return 0; } const channel = property.channel; const property2 = categories[(channel == null ? value2 : channel.id) ?? 'null']; const value = 0; return property2 == null ? value : value === property2.length ? property.index + 2 - length : property2[property2.length - 1].index + 2 - length; } function getActiveAgoTimestamp(a0) { // fn#87046, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2875, offset: 0x01facb89, size: 155 bytes, params: 2, frame: 20 let value = a0; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; const formatToPlainString = intl.formatToPlainString; const property = (require(1244) /* metro dependency 1244: indexNative */).t['8N0BHR']; const object2 = {}; const defaultImport = importDefault(3738) /* metro dependency 3738 */; const defaultImport2 = importDefault(21) /* metro dependency 21: SnowflakeUtils */; value = defaultImport(defaultImport2.extractTimestamp(ReadStateStore.lastMessageId(value) ?? value)); object2.timeAgo = value.fromNow(); return Reflect.apply(formatToPlainString, intl, [property, object2]); } function _fun87032(a0, a1) { // fn#87032, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:570, offset: 0x01fac4cd, size: 229 bytes, params: 3, frame: 22 var r0; var r3; var r2; var r1; var channel; var hasFlag; var type; var value2; var value3; var defaultImport; var moduleValue; const binding = env0_3; let value = !binding; if (binding) { channel = a0.channel; hasFlag = channel.hasFlag; value = environment.__proto__; value = !Reflect.apply(hasFlag, channel, [ChannelFlags.IS_GUILD_RESOURCE_CHANNEL]); r0 = value; } else { r0 = value; } if (r0) { type = a0.channel.type; value = environment.__proto__; value2 = type !== ChannelTypes.GUILD_DIRECTORY; if (value2) { value3 = a1.length === 0; if (value3) { r2 = value3; } else { defaultImport = importDefault(6590) /* metro dependency 6590 */; moduleValue = require(4805) /* metro dependency 4805: useChannelName */; value = moduleValue.computeChannelName(a0.channel, UserStore, RelationshipStore); value = defaultImport(a1, value.toLowerCase()); if (value) { r3 = value; } else { value = a0.channel.topic.toLowerCase(); value = value.includes(a1); r3 = value; } r2 = r3; } r1 = r2; } else { r1 = value2; } r0 = r1; } return r0; } function _fun87033() { // fn#87033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:824, offset: 0x01fac5b2, size: 150 bytes, params: 1, frame: 16 const object2 = {null: [], _categories: []}; const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY; const property = importDefault[GUILD_CATEGORY]; property.forEach(_fun87034); object2._categories = require._categories.filter(_fun87037); let value = importDefault(5099) /* metro dependency 5099: getFlattedChannelList */; value = value(object2._categories, object2); value.forEach(setIndex_87030); return object2; } function _fun87042() { // fn#87042, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2146, offset: 0x01fac9c6, size: 99 bytes, params: 1, frame: 22 var r7; var r11; var propertyName; var propertyName2; var parent_id; var property; var value2; const object2 = {}; let value = environment.__proto__; value = ChannelStore.getMutableGuildChannelsForGuild(env0_0); for (propertyName in value) { parent_id = value[propertyName].parent_id; if (parent_id == null) { r7 = propertyName2; continue; } property = object2[parent_id]; value2 = 0; if (property != null) { r11 = property; continue; } r11 = value2; continue; object2[parent_id] = r11 + 1; r7 = propertyName2; } return object2; } function _fun87043(a0) { // fn#87043, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2314, offset: 0x01faca29, size: 103 bytes, params: 2, frame: 6 const property = require[a0.channel.id]; const object2 = {}; let length = a0.channel.id === 'null' ? property.length : env0_3[a0.channel.id] === 0 ? 1 : property.length; object2.rowCount = length; length = property.length; const value3 = 0; object2.rowHeight = value3 === length ? value3 : importDefault; return object2; } function _fun87045() { // fn#87045, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2616, offset: 0x01facb6e, size: 27 bytes, params: 1, frame: 11 return GuildCategoryStore.getCategories(env0_0); } function _fun87034({channel}) { // fn#87034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:896, offset: 0x01fac648, size: 119 bytes, params: 2, frame: 14 var environment; var value; var binding; let id = channel.id; if (id === 'null') { binding = env0_0; value = environment.__proto__; binding.null = require.null.filter(_fun87035); } binding = env0_0; id = channel.id; const property = require[channel.id]; binding[id] = property.filter(_fun87036); } function _fun87037(a0) { // fn#87037, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:1038, offset: 0x01fac6d7, size: 79 bytes, params: 2, frame: 4 var r0; let value = a0.channel.id === 'null'; if (value) { r0 = value; } else { value = environment.__proto__; value = env1_2.length === 0; r0 = value; } r0 = !r0 ? env0_0[a0.channel.id].length > 0 : r0; return r0; } function _fun87035(a0) { // fn#87035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:950, offset: 0x01fac6bf, size: 24 bytes, params: 2, frame: 13 return env2_4(a0, env2_2); }