/* Metro module 12552; source: modules/guild_home/ActiveChannelsStore.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 3969, 1386, 21, 22, 566, 694, 2] */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import SelectedGuildStore from '../../stores/SelectedGuildStore.tsx'; /* Metro dependency 3969 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ChannelConstantsModule from '../channel/ChannelConstants.tsx'; /* Metro dependency 1386 */ function _fun95994(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#95994, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:6, offset: 0x02152fd3, size: 498 bytes, params: 8, frame: 20 const resetStore = function() { env0_11 = {}; env0_12 = {}; env0_13 = {}; env0_14 = {}; }; const CHANNEL_DELETE_960022 = CHANNEL_DELETE_96002; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let env0_11 = {}; let env0_12 = {}; let env0_13 = {}; let env0_14 = {}; const Store = (Flux).Store; let value = _fun96003(Store); value.displayName = 'ActiveChannelsStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CHANNEL_SELECT: CHANNEL_SELECT_96010, MESSAGE_CREATE: MESSAGE_CREATE_96014, GUILD_DELETE: GUILD_DELETE_96015, CHANNEL_DELETE: CHANNEL_DELETE_960022, THREAD_DELETE: CHANNEL_DELETE_960022, ACTIVE_CHANNELS_FETCH_START: ACTIVE_CHANNELS_FETCH_START, ACTIVE_CHANNELS_FETCH_SUCCESS: ACTIVE_CHANNELS_FETCH_SUCCESS, ACTIVE_CHANNELS_FETCH_FAILURE: ACTIVE_CHANNELS_FETCH_FAILURE, CONNECTION_OPEN: CONNECTION_OPEN_96021}); (FileImportTrackerModule).fileFinishedImporting('modules/guild_home/ActiveChannelsStore.tsx'); exports.default = value; exports.MAX_STORED_MESSAGES = 26; function _isNativeReflectConstruct_95995() { // fn#95995, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:197, offset: 0x021531c5, size: 98 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_95995_isNativeReflectConstruct = function() { return !!result; })(); } function truncateOldMessageData(a0) { // fn#95999, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:462, offset: 0x02153246, size: 234 bytes, params: 2, frame: 21 var defaultImport; var fromTimestamp; var Date; var index; var Math; var value3; var binding; var defaultImport3; const property = env0_12[a0]; if (property != null) { defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */; fromTimestamp = defaultImport.fromTimestamp; Date = global.Date; var env0_0 = Reflect.apply(fromTimestamp, defaultImport, [Date.now() - env0_10]); index = (importDefault(22) /* metro dependency 22 */).findIndex(property, _fun96000); if (index === -1) { env0_12[a0] = []; } else { Math = global.Math; value3 = Math.max(index, property.length - 26); binding = env0_12; defaultImport3 = importDefault(22) /* metro dependency 22 */; binding[a0] = defaultImport3.slice(property, value3); } binding = env0_13; Date = global.Date; binding[a0] = Date.now(); } function _fun96000({id}) { // fn#96000, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:629, offset: 0x02153330, size: 60 bytes, params: 2, frame: 13 let value = environment.__proto__; value = importDefault(21) /* metro dependency 21: SnowflakeUtils */; value = value.compare(id, env0_0); return value > 0; } } function addMessage(a0, a1, a2, a3) { // fn#96001, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:754, offset: 0x0215336c, size: 151 bytes, params: 5, frame: 15 let property = env0_11[a0]; property.add(a1); property = env0_13[a1]; if (property == null || property + 300000 > global.Date.now()) { truncateOldMessageData(a1); } if (env0_12[a1] == null) { env0_12[a1] = []; } env0_12[a1].push({id: a2, userId: a3}); } function CHANNEL_DELETE_96002({channel}) { // fn#96002, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:910, offset: 0x02153403, size: 41 bytes, params: 2, frame: 4 delete env0_12[channel.id]; delete env0_13[channel.id]; } function _fun96003(a0) { // fn#96003, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:988, offset: 0x0215342c, size: 176 bytes, params: 2, frame: 16 const ActiveChannelsStore2 = ActiveChannelsStore; Inherits(ActiveChannelsStore2, a0); return CreateClass(ActiveChannelsStore2, [{key: 'initialize', value: function() { this.waitFor(ChannelStore, SelectedGuildStore); }}, {key: 'getActiveChannelsFetchStatus', value: value_96006}, {key: 'getActiveChannelIds', value: value_96007}, {key: 'getChannelMessageData', value: value_96008}, {key: 'shouldFetch', value: value_96009}]); function ActiveChannelsStore() { // fn#96004, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:1000, offset: 0x00e474d4, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_2(this, ActiveChannelsStore); const value3 = env1_5(ActiveChannelsStore); return env1_4(this, _isNativeReflectConstruct_95995() ? global.Reflect.construct(value3, arguments, env1_5(this).constructor) : value3.apply(this, arguments)); } function value_96006(a0) { // fn#96006, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:1386, offset: 0x00f7ecf6, size: 16 bytes, params: 2, frame: 2 return env1_14[a0]; } function value_96007(a0) { // fn#96007, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:1445, offset: 0x0108d3ec, size: 16 bytes, params: 2, frame: 2 return env1_11[a0]; } function value_96008(a0) { // fn#96008, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:1506, offset: 0x00f8559b, size: 16 bytes, params: 2, frame: 2 return env1_12[a0]; } function value_96009(a0) { // fn#96009, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:1557, offset: 0x021534dc, size: 49 bytes, params: 2, frame: 5 var r0; var property; let value = environment.__proto__; const value2 = env1_11[a0] == null; if (value2) { property = env1_14[a0]; value = property != null; value = !(value && property.loading); r0 = value; } else { r0 = value2; } return r0; } } function CHANNEL_SELECT_96010({channelId, guildId}) { // fn#96010, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:1717, offset: 0x0215350d, size: 213 bytes, params: 2, frame: 18 var property; var defaultImport; var chain; var Array; var value6; if (isGuildHomeChannel(channelId)) { if (guildId == null) { return false; } property = env0_11[guildId]; if (property == null) { return false; } property.forEach(_fun96011); defaultImport = importDefault(22) /* metro dependency 22 */; chain = defaultImport.chain; Array = global.Array; value6 = Reflect.apply(chain, defaultImport, [Array.from(property)]).filter(_fun96012).sortBy(_fun96013).value(); env0_11[guildId] = new global.Set(); return undefined; } return false; function _fun96011(a0) { // fn#96011, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:1842, offset: 0x021535e2, size: 57 bytes, params: 2, frame: 14 const truncateOldMessageDataBinding = truncateOldMessageData; const value2 = undefined; truncateOldMessageDataBinding(a0); const property = env1_12[a0]; if ((property == null ? value2 : property.length) === 0) { delete env1_12[a0]; } return value2; } function _fun96012(a0) { // fn#96012, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:1974, offset: 0x0215361b, size: 16 bytes, params: 2, frame: 2 return a0 in env1_12; } function _fun96013(a0) { // fn#96013, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:1994, offset: 0x0215362b, size: 47 bytes, params: 2, frame: 4 const value = environment.__proto__; return -(env1_12[a0]?.length ?? 0); } } function MESSAGE_CREATE_96014({channelId, message, optimistic, isPushNotification}) { // fn#96014, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:2103, offset: 0x0215365a, size: 143 bytes, params: 2, frame: 21 var r1; var r0; var value4; var addMessageBinding; var id2; var author; if (optimistic) { return false; } if (isPushNotification) { return false; } var value; const channel = ChannelStore.getChannel(channelId); if (channel == null) { return false; } const guild_id = channel.guild_id; const value3 = guild_id != null; if (value3) { value4 = env0_11[guild_id] != null; if (value4) { addMessageBinding = addMessage; id2 = message.id; author = message.author; value = undefined; addMessageBinding(guild_id, channelId, id2, author == null ? value : author.id); r1 = value; } else { r1 = value4; } r0 = r1; } else { r0 = value3; } return r0; } function GUILD_DELETE_96015({guild}) { // fn#96015, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:2374, offset: 0x01f1e4df, size: 28 bytes, params: 2, frame: 2 delete env0_11[guild.id]; } function ACTIVE_CHANNELS_FETCH_START({guildId}) { // fn#96016, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:2525, offset: 0x021536e9, size: 59 bytes, params: 2, frame: 12 const binding = env0_14; const object = {'loading': true, 'error': null}; const Date = global.Date; object.fetchedAt = Date.now(); binding[guildId] = object; } function ACTIVE_CHANNELS_FETCH_SUCCESS({guildId, channels}) { // fn#96017, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:2659, offset: 0x02153724, size: 122 bytes, params: 2, frame: 17 let binding = env0_14; const object = {'loading': false, 'error': null}; const Date = global.Date; object.fetchedAt = Date.now(); binding[guildId] = object; binding = env0_11; const Set = global.Set; binding[guildId] = new Set(); channels.forEach(function({channel_id, messages}) { messages.forEach(_fun96019); }); function _fun96018({channel_id, messages}) { // fn#96018, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:2799, offset: 0x0215379e, size: 41 bytes, params: 2, frame: 11 messages.forEach(function(a0) { addMessage(guildId, channel_id, a0.message_id, a0.user_id); }); function _fun96019({message_id, user_id}) { // fn#96019, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:2840, offset: 0x021537c7, size: 46 bytes, params: 2, frame: 17 addMessage(guildId, channel_id, message_id, user_id); } } } function ACTIVE_CHANNELS_FETCH_FAILURE({guildId, error}) { // fn#96020, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:2920, offset: 0x021537f5, size: 48 bytes, params: 2, frame: 4 env0_14[guildId] = {'loading': false, 'error': null, 'fetchedAt': null, error: error}; } function CONNECTION_OPEN_96021() { // fn#96021, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:3041, offset: 0x02153825, size: 210 bytes, params: 1, frame: 19 var resetStoreBinding; var property; var property2; var Array; var object; var value3; var value4; var value5; const guildId = SelectedGuildStore.getGuildId(); if (guildId != null) { property = env0_14[guildId]; property2 = env0_11[guildId]; Array = global.Array; value3 = Array.from(property2 ?? []); value4 = value3.reduce(_fun96022, {}); resetStoreBinding = resetStore; value5 = undefined; resetStoreBinding(); if (global.Date.now() - ((property == null ? value5 : property.fetchedAt) ?? 0) < env0_10) { object = {}; object[guildId] = property; object = {}; object[guildId] = property2; copyDataProperties({}, value4, value3); } } else { resetStore(); } function _fun96022(a0, a1) { // fn#96022, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12742:3161, offset: 0x021538f7, size: 33 bytes, params: 3, frame: 4 a0[a1] = env1_12[a1] ?? []; return a0; } } } global.__d(_fun95994, 12552, [6, 7, 15, 17, 18, 1379, 3969, 1386, 21, 22, 566, 694, 2]) /* metro module 12552, dependencies: [6, 7, 15, 17, 18, 1379, 3969, 1386, 21, 22, 566, 694, 2] */;