/* Metro module 11930; source: modules/guild_progress/GuildProgressHooks.tsx; dependencies: [31, 1226, 1379, 1935, 4111, 1867, 11931, 4814, 3784, 661, 566, 9050, 21, 22, 5216, 2] */ import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */ import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */ import GuildChannelStore from '../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */ import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */ import GuildMemberCountStore from '../../stores/GuildMemberCountStore.tsx'; /* Metro dependency 4111 */ import MessageStore from '../../stores/MessageStore.tsx'; /* Metro dependency 4814 */ import LayerStore from '../../stores/LayerStore.tsx'; /* Metro dependency 11931 */ 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 FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as GuildChannelStoreModule from '../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */ import * as CanViewInviteModalModule from '../instant_invite/canViewInviteModal.tsx'; /* Metro dependency 9050 */ function _fun91530(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:6, offset: 0x0206958a, size: 412 bytes, params: 8, frame: 24 let env0_0 = require; const closure = function(a0) { var env0_0 = a0; return require(dependencyMap[10]).useStateFromStores([GuildChannelStore], _fun91532, [a0]); }; const useGuildPopulated2 = useGuildPopulated; const useGuildPersonalized2 = useGuildPersonalized; const closure4 = function(a0) { var env0_0 = a0; var env0_1 = require(dependencyMap[10]).useStateFromStores([AuthenticationStore], _fun91543); return require(dependencyMap[10]).useStateFromStores([MessageStore], _fun91544); }; const useGuildMessaged2 = useGuildMessaged; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = GuildChannelStoreModule; const env0_6 = value.GUILD_SELECTABLE_CHANNELS_KEY; const env0_7 = value.GUILD_VOCAL_CHANNELS_KEY; value = require(661) /* metro dependency 661: Constants */; const env0_14 = value.Permissions; const env0_15 = value.MessageTypes; (FileImportTrackerModule).fileFinishedImporting('modules/guild_progress/GuildProgressHooks.tsx'); exports.usePermissions = function(a0, a1) { var env0_0 = a0; var env0_1 = a1; return require(dependencyMap[10]).useStateFromStoresObject([PermissionStore], _fun91551, [a1, a0]); }; exports.useGuildChannelCreated = closure; exports.useGuildPopulated = useGuildPopulated2; exports.useGuildPersonalized = useGuildPersonalized2; exports.useChannelsMessaged = closure4; exports.useGuildMessaged = useGuildMessaged2; exports.useCompletedStates = function(a0) { var object = {}; object.guildPopulated = useGuildPopulated(a0); object.guildMessaged = useGuildMessaged(a0); object.guildPersonalized = useGuildPersonalized(a0); object.guildChannelCreated = useGuildChannelCreated(a0); return object; }; function useGuildChannelCreated(a0) { // fn#91531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:302, offset: 0x02069726, size: 75 bytes, params: 2, frame: 16 const env0_0 = a0; return (FluxModule).useStateFromStores([GuildChannelStore], _fun91532, [a0]); function _fun91532() { // fn#91532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:377, offset: 0x02069771, size: 97 bytes, params: 1, frame: 15 var environment; const hasNewChannel2 = hasNewChannel; const value = environment.__proto__; const channels = GuildChannelStore.getChannels(env0_0?.id); return channels[GUILD_SELECTABLE_CHANNELS_KEY].some(hasNewChannel2) || channels[GUILD_VOCAL_CHANNELS_KEY].some(hasNewChannel2); function hasNewChannel(a0) { // fn#91533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:430, offset: 0x020697d2, size: 110 bytes, params: 2, frame: 17 var r0; var value3; var defaultImport; var extractTimestamp; var id; var value4; var defaultImport2; let value = environment.__proto__; const value2 = env1_0 != null; if (value2) { value3 = environment.__proto__.__proto__; defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */; extractTimestamp = defaultImport.extractTimestamp; id = a0.channel.id; value4 = Reflect.apply(extractTimestamp, defaultImport, [id]); defaultImport2 = importDefault(21) /* metro dependency 21: SnowflakeUtils */; extractTimestamp = defaultImport2.extractTimestamp; id = env1_0.id; value = value4 - Reflect.apply(extractTimestamp, defaultImport2, [id]); value = value > 500; r0 = value; } else { r0 = value2; } return r0; } } } function useGuildPopulated(a0) { // fn#91534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:610, offset: 0x02069840, size: 166 bytes, params: 2, frame: 21 const env0_0 = a0; const env0_1 = (FluxModule).useStateFromStores([ChannelStore], _fun91535); return (FluxModule).useStateFromStores([GuildMemberCountStore], _fun91537, [a0, (FluxModule).useStateFromStoresArray([MessageStore], _fun91536)]); function _fun91535() { // fn#91535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:679, offset: 0x020698e6, size: 47 bytes, params: 1, frame: 13 return ChannelStore.getChannel(env0_0?.systemChannelId); } function _fun91536() { // fn#91536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:772, offset: 0x02069915, size: 58 bytes, params: 1, frame: 12 var r0; var value2; var messageStoreBinding; var value; if (channel != null) { value2 = environment.__proto__; messageStoreBinding = MessageStore; value = messageStoreBinding.getMessages(channel.id); value = value.toArray(); r0 = value; } else { r0 = []; } return r0; } function _fun91537() { // fn#91537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:859, offset: 0x0206994f, size: 96 bytes, params: 1, frame: 14 var environment; const value = environment.__proto__; return (GuildMemberCountStore.getMemberCount(env0_0?.id) ?? 0) > 1 || env0_2.some(function({type}) { return type === MessageTypes.USER_JOIN; }); } } function useGuildPersonalized(a0) { // fn#91539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:983, offset: 0x020699ca, size: 129 bytes, params: 2, frame: 19 const env0_0 = a0; const value2 = undefined; const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([LayerStore], function() { return LayerStore.hasLayers(); }); const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], _fun91541); return (guild == null ? value2 : guild.icon) != null && !value3; function _fun91541() { // fn#91541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1110, offset: 0x02069a60, size: 47 bytes, params: 1, frame: 13 return GuildStore.getGuild(env0_0?.id); } } function useChannelsMessaged(a0) { // fn#91542, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1189, offset: 0x02069a8f, size: 109 bytes, params: 2, frame: 19 const env0_0 = a0; const env0_1 = (require(566) /* metro dependency 566: flux */).useStateFromStores([AuthenticationStore], function() { return AuthenticationStore.getId(); }); return (require(566) /* metro dependency 566: flux */).useStateFromStores([MessageStore], _fun91544); function _fun91543() { // fn#91543, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1260, offset: 0x01d54117, size: 19 bytes, params: 1, frame: 9 return AuthenticationStore.getId(); } function _fun91544() { // fn#91544, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1316, offset: 0x02069afc, size: 55 bytes, params: 1, frame: 13 var environment; let value = environment.__proto__; value = importDefault(22) /* metro dependency 22 */; return value.some(env0_0, _fun91545); function _fun91545({id}) { // fn#91545, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1337, offset: 0x02069b33, size: 81 bytes, params: 2, frame: 13 var environment; const value = environment.__proto__.__proto__; return (Module00022).some(MessageStore.getMessages(id).toArray(), _fun91546); function _fun91546(a0) { // fn#91546, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1401, offset: 0x02069b84, size: 63 bytes, params: 2, frame: 13 var r0; const id2 = a0.author.id; let value = environment.__proto__.__proto__; value = id2 === id; if (value) { value = environment.__proto__.__proto__.__proto__; value = !(importDefault(5216) /* metro dependency 5216: isSystemMessage */)(a0); r0 = value; } else { r0 = value; } return r0; } } } } function useGuildMessaged(a0) { // fn#91547, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1441, offset: 0x02069bc3, size: 109 bytes, params: 2, frame: 16 const env0_0 = a0; const value2 = (FluxModule).useStateFromStores([ChannelStore], _fun91548); const useMemo = ReactModule.useMemo; return useChannelsMessaged(Reflect.apply(useMemo, ReactModule, [_fun91549, [value2]])); function _fun91548() { // fn#91548, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1509, offset: 0x02069c30, size: 45 bytes, params: 1, frame: 12 const value2 = null; return value2 != env0_0 ? ChannelStore.getMutableBasicGuildChannelsForGuild(env0_0.id) : value2; } function _fun91549() { // fn#91549, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1611, offset: 0x02069c5d, size: 60 bytes, params: 1, frame: 12 return env0_1 == null ? [] : (importDefault(22) /* metro dependency 22 */).values(env0_1); } } function usePermissions(a0, a1) { // fn#91550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1749, offset: 0x02069c99, size: 87 bytes, params: 3, frame: 17 const env0_0 = a0; const env0_1 = a1; return (FluxModule).useStateFromStoresObject([PermissionStore], _fun91551, [a1, a0]); function _fun91551() { // fn#91551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12116:1824, offset: 0x02069cf0, size: 200 bytes, params: 1, frame: 19 const value = environment.__proto__; return {canInvite: CanViewInviteModalModule.canViewInviteModal(PermissionStore, require, env0_0), canManageGuild: require != null && PermissionStore.can(Permissions.MANAGE_GUILD, require), canMessage: env0_0 != null && PermissionStore.can(Permissions.SEND_MESSAGES, env0_0), canCreateChannel: require != null && PermissionStore.can(Permissions.MANAGE_CHANNELS, require)}; } } } global.__d(_fun91530, 11930, [31, 1226, 1379, 1935, 4111, 1867, 11931, 4814, 3784, 661, 566, 9050, 21, 22, 5216, 2]) /* metro module 11930, dependencies: [31, 1226, 1379, 1935, 4111, 1867, 11931, 4814, 3784, 661, 566, 9050, 21, 22, 5216, 2] */;