Files
2026-07-28 01:06:53 +03:00

757 lines
35 KiB
TypeScript

/* Metro module 6898; source: modules/threads/ThreadMessageStore.tsx; dependencies: [6, 7, 15, 17, 18, 1383, 3794, 1885, 1379, 4814, 1243, 661, 22, 21, 4625, 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 SnowflakeUtils from '../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */
import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import UserRecord from '../../records/UserRecord.tsx'; /* Metro dependency 1885 */
import MessageRecord from '../../records/MessageRecord.tsx'; /* Metro dependency 3794 */
import MessageStore from '../../stores/MessageStore.tsx'; /* Metro dependency 4814 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as ThreadConstantsModule from './ThreadConstants.tsx'; /* Metro dependency 1243 */
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
function _fun54822(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#54822, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:6, offset: 0x0136ee18, size: 700 bytes, params: 8, frame: 24
let env0_0 = require;
const _arrayLikeToArray_54828 = 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 updateFromThreadMessages = function(a0) {
var value2;
var env0_0 = a0;
if (a0.type !== MessageTypes.THREAD_STARTER_MESSAGE) {
value2 = ChannelStore.getChannel(a0.channel_id);
if (value2 != null) {
updateState_54829(value2, _fun54833);
}
}
};
const updateFromThread = function(a0) {
var env0_0 = a0;
updateState_54829(a0, _fun54835);
};
const closure = function({channel}) {
updateFromThread(channel);
};
const closure2 = function({threads}) {
threads.forEach(updateFromServerThread);
};
const closure3 = function({data}) {
data.forEach(_fun54840);
};
const RELATIONSHIP_ADD_548432 = RELATIONSHIP_ADD_54843;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Set = global.Set;
let set = new Set();
const env0_17 = {};
const env0_18 = {};
const Store = (Flux).Store;
_fun54844(Store).displayName = 'ThreadMessageStore';
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: CONNECTION_OPEN_54851,
OVERLAY_INITIALIZE: OVERLAY_INITIALIZE_54852, GUILD_CREATE: function({guild}) {
updateFromGuild(guild);
}, GUILD_DELETE: function(a0) {
_fun54855(a0.guild.id);
}, THREAD_CREATE: closure, THREAD_UPDATE: closure, THREAD_LIST_SYNC: function({threads, mostRecentMessages}) {
threads.forEach(updateFromThread);
if (mostRecentMessages != null) {
mostRecentMessages.forEach(_fun54858);
}
}, LOAD_THREADS_SUCCESS: closure2, LOAD_ARCHIVED_THREADS_SUCCESS: closure2,
RELATIONSHIP_ADD: RELATIONSHIP_ADD_548432, RELATIONSHIP_UPDATE: RELATIONSHIP_ADD_548432,
RELATIONSHIP_REMOVE: RELATIONSHIP_ADD_548432, SEARCH_MESSAGES_SUCCESS: closure3,
MOD_VIEW_SEARCH_MESSAGES_SUCCESS: closure3, THREAD_DELETE: THREAD_DELETE_54860, CHANNEL_DELETE: function(a0) {
_fun54862(a0.channel.id);
}, MESSAGE_CREATE: MESSAGE_CREATE_54864, MESSAGE_UPDATE: MESSAGE_UPDATE_54866, MESSAGE_DELETE: MESSAGE_DELETE_54868,
MESSAGE_DELETE_BULK: MESSAGE_DELETE_BULK_54870, LOAD_MESSAGES_SUCCESS: LOAD_MESSAGES_SUCCESS_54874});
(FileImportTrackerModule).fileFinishedImporting('modules/threads/ThreadMessageStore.tsx');
exports.default = set;
function _isNativeReflectConstruct_54823() { // fn#54823, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:310, offset: 0x0136f0d4, size: 94 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_54823_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_54826(a0, a1) { // fn#54826, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:503, offset: 0x0136f132, 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 _fun54827;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_54828(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_54828(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_54828(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun54827;
}
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 _fun54827() { // fn#54827, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:1074, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function updateState_54829(a0, a1) { // fn#54829, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:1437, offset: 0x0136f2a4, size: 145 bytes, params: 3, frame: 19
var updateWithStateBinding;
var id;
var binding;
if (ALL_CHANNEL_TYPES.has(a0.type)) {
updateWithStateBinding = updateWithState;
id = a0.id;
if (!(id in env0_17)) {
env0_17[a0.id] = {guildId: a0.guild_id, parentId: a0.parent_id, count: a0.messageCount ?? 0,
mostRecentRawMessage: null, mostRecentMessage: null};
}
binding = env0_17;
id = a0.id;
updateWithStateBinding(binding[id], a1);
}
}
function updateWithState(a0, a1) { // fn#54830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:1690, offset: 0x0136f335, size: 67 bytes, params: 3, frame: 13
env0_18[a0.parentId] = (env0_18[a0.parentId] ?? 0) + 1;
a1(a0);
}
function updateFromGuild({threads, threadMessages}) { // fn#54831, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:1781, offset: 0x0136f378, size: 63 bytes, params: 2, frame: 13
if (threads != null) {
threads.forEach(updateFromThread);
}
if (threadMessages != null) {
threadMessages.forEach(updateFromThreadMessages);
}
}
function updateFromThreadMessages(a0) { // fn#54832, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:1930, offset: 0x0136f3b7, size: 77 bytes, params: 2, frame: 14
var channelStoreBinding;
var value2;
const env0_0 = a0;
const type = a0.type;
const THREAD_STARTER_MESSAGE = MessageTypes.THREAD_STARTER_MESSAGE;
if (type !== THREAD_STARTER_MESSAGE) {
channelStoreBinding = ChannelStore;
value2 = channelStoreBinding.getChannel(a0.channel_id);
if (value2 != null) {
updateState_54829(value2, _fun54833);
}
}
function _fun54833(a0) { // fn#54833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:2062, offset: 0x0136f404, size: 28 bytes, params: 2, frame: 2
a0.mostRecentRawMessage = env0_0;
a0.mostRecentMessage = null;
}
}
function updateFromThread(a0) { // fn#54834, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:2120, offset: 0x0136f420, size: 31 bytes, params: 2, frame: 13
const env0_0 = a0;
updateState_54829(a0, _fun54835);
function _fun54835(a0) { // fn#54835, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:2164, offset: 0x0136f43f, size: 118 bytes, params: 2, frame: 7
if (env0_0.messageCount != null) {
a0.count = env0_0.messageCount;
}
if (env0_0.lastMessageId != null && (a0.mostRecentRawMessage ?? a0.mostRecentMessage)?.id !== env0_0.lastMessageId) {
a0.mostRecentRawMessage = null;
a0.mostRecentMessage = null;
}
}
}
function updateFromServerThread(a0) { // fn#54836, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:2404, offset: 0x0136f4b5, size: 70 bytes, params: 2, frame: 13
if (a0 == null) {
return false;
}
if (a0.id in env0_17) {
return false;
}
const channel = ChannelStore.getChannel(a0.id);
if (channel == null) {
return false;
}
updateFromThread(channel);
return true;
}
function MOD_VIEW_SEARCH_MESSAGES_SUCCESS_54839({data}) { // fn#54839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:2698, offset: 0x0136f531, size: 29 bytes, params: 2, frame: 11
data.forEach(function({messages, threads}) {
messages.forEach(_fun54841);
threads.forEach(updateFromServerThread);
});
function _fun54840({messages, threads}) { // fn#54840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:2756, offset: 0x0136f54e, size: 53 bytes, params: 2, frame: 12
messages.forEach(function(a0) {
a0.forEach(_fun54842);
});
threads.forEach(updateFromServerThread);
function _fun54841(a0) { // fn#54841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:2794, offset: 0x0136f583, size: 24 bytes, params: 2, frame: 11
a0.forEach(function(a0) {
updateFromServerThread(a0.thread);
});
function _fun54842({thread}) { // fn#54842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:2809, offset: 0x0136f59b, size: 25 bytes, params: 2, frame: 11
updateFromServerThread(thread);
}
}
}
}
function RELATIONSHIP_ADD_54843() { // fn#54843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:2889, offset: 0x0136f5b4, size: 102 bytes, params: 1, frame: 23
var r6;
var propertyName;
var propertyName2;
var property;
var mostRecentMessage;
var messageStoreBinding;
var getMessage;
var id;
var value2;
for (propertyName in env0_17) {
property = env0_17[propertyName];
if (property == null) {
r6 = propertyName2;
continue;
}
mostRecentMessage = property.mostRecentMessage;
if (mostRecentMessage == null) {
r6 = propertyName2;
continue;
}
messageStoreBinding = MessageStore;
getMessage = messageStoreBinding.getMessage;
mostRecentMessage = property.mostRecentMessage;
id = mostRecentMessage.id;
value2 = Reflect.apply(getMessage, messageStoreBinding, [propertyName, id]);
if (value2 == null) {
r6 = propertyName2;
continue;
}
property.mostRecentMessage = value2;
r6 = propertyName2;
}
}
function _fun54844(a0) { // fn#54844, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:3086, offset: 0x0136f61a, size: 164 bytes, params: 2, frame: 16
const ThreadMessageStore2 = ThreadMessageStore;
Inherits(ThreadMessageStore2, a0);
return CreateClass(ThreadMessageStore2, [{key: 'initialize', value: function() {
this.waitFor(ChannelStore, MessageStore);
}}, {key: 'getCount', value: value_54847}, {key: 'getMostRecentMessage', value: value_54848},
{key: 'getChannelThreadsVersion', value: value_54849}, {key: 'getInitialOverlayState', value: value_54850}]);
function ThreadMessageStore() { // fn#54845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:3098, offset: 0x00e07435, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, ThreadMessageStore);
const value3 = env1_6(ThreadMessageStore);
return env1_5(this, _isNativeReflectConstruct_54823() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
function value_54847(a0) { // fn#54847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:3459, offset: 0x0136f6dc, size: 44 bytes, params: 2, frame: 4
let value = environment.__proto__;
const property = env1_17[a0];
value = null;
const count = value == property ? undefined : property.count;
return value != count ? count : value;
}
function value_54848(a0) { // fn#54848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:3569, offset: 0x0136f708, size: 153 bytes, params: 2, frame: 16
var messageStoreBinding;
var value5;
let value = environment.__proto__;
const property = env1_17[a0];
const value2 = null;
if (value2 == property) {
return value2;
}
let mostRecentMessage = property.mostRecentMessage;
let r2 = value2 == mostRecentMessage && value2 != property.mostRecentRawMessage;
if (r2) {
messageStoreBinding = MessageStore;
value5 = messageStoreBinding.getMessage(a0, property.mostRecentRawMessage.id);
if (value2 != value5) {
r2 = value5;
} else {
value = require(4625) /* metro dependency 4625: MessageRecordUtils */;
value = value.createMessageRecord(property.mostRecentRawMessage);
r2 = value;
}
property.mostRecentMessage = r2;
property.mostRecentRawMessage = value2;
}
mostRecentMessage = property.mostRecentMessage;
return value2 != mostRecentMessage ? mostRecentMessage : value2;
}
function value_54849(a0) { // fn#54849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:3918, offset: 0x00f8578e, size: 16 bytes, params: 2, frame: 2
return env1_18[a0];
}
function value_54850() { // fn#54850, offset: 0x00e07553, size: 9 bytes, params: 1, frame: 1
return env1_17;
}
}
function CONNECTION_OPEN_54851({guilds}) { // fn#54851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:4094, offset: 0x0136f7a1, size: 50 bytes, params: 2, frame: 11
env0_18 = {};
env0_16.clear();
guilds.forEach(updateFromGuild);
}
function OVERLAY_INITIALIZE_54852({threadMessages}) { // fn#54852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:4196, offset: 0x0136f7d3, size: 161 bytes, params: 2, frame: 24
var r14;
var r5;
var propertyName;
var propertyName2;
var mostRecentMessage;
var property;
var messageRecordBinding;
var object;
var userRecordBinding;
var author;
var prototype;
var value2;
var userRecord2;
var value3;
var value4;
var messageRecord2;
var value5;
const object2 = {};
copyDataProperties(object2, threadMessages, r14);
for (propertyName in object2) {
mostRecentMessage = threadMessages[propertyName].mostRecentMessage;
if (mostRecentMessage == null) {
r5 = propertyName2;
continue;
}
property = threadMessages[propertyName];
messageRecordBinding = MessageRecord;
object = {};
copyDataProperties(object, mostRecentMessage, r14);
userRecordBinding = UserRecord;
author = mostRecentMessage.author;
prototype = userRecordBinding.prototype;
value2 = Object.create(prototype, {constructor: {value: userRecordBinding}});
userRecord2 = new userRecordBinding();
value3 = userRecord2 instanceof Object ? userRecord2 : value2;
object['author'] = value3;
prototype = messageRecordBinding.prototype;
value4 = Object.create(prototype, {constructor: {value: messageRecordBinding}});
messageRecord2 = new messageRecordBinding();
value5 = messageRecord2 instanceof Object ? messageRecord2 : value4;
property.mostRecentMessage = value5;
r5 = propertyName2;
r14 = userRecordBinding;
}
}
function GUILD_DELETE_54854({guild}) { // fn#54854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:4458, offset: 0x0136f88c, size: 29 bytes, params: 2, frame: 11
deleteForGuild(guild.id);
function deleteForGuild(a0) { // fn#54855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:4497, owner: GUILD_DELETE_54854.deleteForGuild, offset: 0x0136f8a9, size: 61 bytes, params: 2, frame: 15
const env0_0 = a0;
const defaultImport = Module00022;
env1_17 = defaultImport.omitBy(env1_17, _fun54856);
function _fun54856(a0) { // fn#54856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:4545, offset: 0x0136f8e6, size: 41 bytes, params: 2, frame: 3
var value2;
const guildId = a0.guildId;
const value = guildId === env0_0;
if (value) {
value2 = environment.__proto__.__proto__;
delete env2_18[a0.parentId];
}
return value;
}
}
}
function THREAD_LIST_SYNC_54857({threads, mostRecentMessages}) { // fn#54857, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:4712, offset: 0x0136f90f, size: 59 bytes, params: 2, frame: 12
threads.forEach(updateFromThread);
if (mostRecentMessages != null) {
mostRecentMessages.forEach(function(a0) {
var env0_0 = a0;
var value2 = ChannelStore.getChannel(a0.channel_id);
if (value2 != null && a0.type !== MessageTypes.THREAD_STARTER_MESSAGE) {
updateState_54829(value2, _fun54859);
}
});
}
function _fun54858(a0) { // fn#54858, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:4824, offset: 0x0136f94a, size: 83 bytes, params: 2, frame: 15
const env0_0 = a0;
const channel = ChannelStore.getChannel(a0.channel_id);
if (channel != null && a0.type !== MessageTypes.THREAD_STARTER_MESSAGE) {
updateState_54829(channel, _fun54859);
}
function _fun54859(a0) { // fn#54859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:4920, offset: 0x0136f404, size: 28 bytes, params: 2, frame: 2
a0.mostRecentRawMessage = env0_0;
a0.mostRecentMessage = null;
}
}
}
function THREAD_DELETE_54860({channel}) { // fn#54860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:5357, offset: 0x0136f99d, size: 28 bytes, params: 2, frame: 2
delete env0_17[channel.id];
}
function CHANNEL_DELETE_54861({channel}) { // fn#54861, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:5429, offset: 0x0136f9b9, size: 29 bytes, params: 2, frame: 11
deleteForChannel(channel.id);
function deleteForChannel(a0) { // fn#54862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:5472, owner: CHANNEL_DELETE_54861.deleteForChannel, offset: 0x0136f9d6, size: 69 bytes, params: 2, frame: 16
const env0_0 = a0;
const defaultImport = Module00022;
env1_17 = defaultImport.omitBy(env1_17, _fun54863);
delete env1_18[a0];
function _fun54863({parentId}) { // fn#54863, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:5522, offset: 0x011768ae, size: 22 bytes, params: 2, frame: 2
return parentId === env0_0;
}
}
}
function MESSAGE_CREATE_54864({message, optimistic, isPushNotification, sendMessageOptions}) { // fn#54864, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:5577, offset: 0x0136fa1b, size: 235 bytes, params: 2, frame: 19
var r4;
var r0;
var value6;
var isForumPost2;
var id;
var defaultImport;
var updateState_54829Binding;
if (optimistic) {
return false;
}
if (isPushNotification) {
return false;
}
if (sendMessageOptions != null) {
return false;
}
var value;
const channel = ChannelStore.getChannel(message.channel_id);
let r1 = channel == null || !THREAD_CHANNEL_TYPES.has(channel.type);
if (r1) {
r0 = !r1;
} else {
value6 = message.type !== MessageTypes.THREAD_STARTER_MESSAGE;
if (value6) {
isForumPost2 = channel.isForumPost();
if (isForumPost2) {
id = message.id;
defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
r1 = id !== defaultImport.castChannelIdAsMessageId(channel.id);
} else {
r1 = !isForumPost2;
}
r4 = r1;
} else {
r4 = value6;
}
if (r4) {
updateState_54829Binding = updateState_54829;
value = undefined;
updateState_54829Binding(channel, _fun54865);
r1 = value;
} else {
r1 = !!r4;
}
r0 = r1;
}
return r0;
function _fun54865(a0) { // fn#54865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:5939, offset: 0x0136fb06, size: 72 bytes, params: 2, frame: 14
const Math = global.Math;
a0.count = Math.min(a0.count + 1, MAX_THREAD_MESSAGE_COUNT);
a0.mostRecentRawMessage = message;
a0.mostRecentMessage = null;
}
}
function MESSAGE_UPDATE_54866({message}) { // fn#54866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:6043, offset: 0x0136fb4e, size: 114 bytes, params: 2, frame: 18
const property = env0_17[message.channel_id];
const r5 = property?.mostRecentRawMessage ?? property?.mostRecentMessage;
if (property == null) {
return false;
}
if (r5 == null) {
return false;
}
if (r5.id !== message.id) {
return false;
}
updateWithState(property, _fun54867);
function _fun54867(a0) { // fn#54867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:6257, offset: 0x0136fbc0, size: 141 bytes, params: 2, frame: 15
var value;
if (a0.mostRecentMessage != null) {
value = environment.__proto__;
value = require(4625) /* metro dependency 4625: MessageRecordUtils */;
a0.mostRecentMessage = value.updateMessageRecord(a0.mostRecentMessage, message);
}
if (a0.mostRecentRawMessage != null) {
value = environment.__proto__;
value = require(4625) /* metro dependency 4625: MessageRecordUtils */;
a0.mostRecentRawMessage = value.updateServerMessage(a0.mostRecentRawMessage, message);
}
}
}
function MESSAGE_DELETE_54868({id, channelId}) { // fn#54868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:6493, offset: 0x0136fc4d, size: 127 bytes, params: 2, frame: 18
const property = env0_17[channelId];
if (property == null) {
return false;
}
const defaultImport = SnowflakeUtils;
const env0_1 = defaultImport.castChannelIdAsMessageId(channelId) !== id;
const binding = env0_16;
const env0_2 = !binding.has(id);
updateWithState(property, _fun54869);
function _fun54869(a0) { // fn#54869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:6651, offset: 0x0136fccc, size: 147 bytes, params: 2, frame: 16
const r3 = a0.mostRecentRawMessage ?? a0.mostRecentMessage;
if (r3 != null && r3.id === id) {
a0.mostRecentMessage = null;
a0.mostRecentRawMessage = null;
}
a0.count = env0_1 && env0_2 ? global.Math.max(a0.count - 1, 0) : a0.count;
const binding = env1_16;
binding.add(id);
}
}
function MESSAGE_DELETE_BULK_54870({ids, channelId}) { // fn#54870, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:6868, offset: 0x0136fd5f, size: 98 bytes, params: 2, frame: 16
const property = env0_17[channelId];
if (property == null) {
return false;
}
if (ids.filter(_fun54871).length > 0) {
updateWithState(property, _fun54872);
}
function _fun54871(a0) { // fn#54871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:6969, offset: 0x0136fdc1, size: 75 bytes, params: 2, frame: 13
const value = environment.__proto__;
const defaultImport = SnowflakeUtils;
const value3 = defaultImport.castChannelIdAsMessageId(channelId) !== a0;
const binding = env1_16;
return value3 && !binding.has(a0);
}
function _fun54872(a0) { // fn#54872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:7078, offset: 0x0136fe0c, size: 112 bytes, params: 2, frame: 14
const r3 = a0.mostRecentRawMessage ?? a0.mostRecentMessage;
if (r3 != null && ids.includes(r3.id)) {
a0.mostRecentMessage = null;
a0.mostRecentRawMessage = null;
}
a0.count = a0.count - length;
ids.forEach(_fun54873);
function _fun54873(a0) { // fn#54873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:7249, offset: 0x0136fe7c, size: 22 bytes, params: 2, frame: 11
return env2_16.add(a0);
}
}
}
function LOAD_MESSAGES_SUCCESS_54874(a0) { // fn#54874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:7289, offset: 0x0136fe92, size: 190 bytes, params: 2, frame: 20
var r6;
var r7;
var r9;
var r0;
var updateFromServerThreadBinding;
var value5;
var thread;
var value6;
var value7;
const env0_0 = a0;
const value2 = _createForOfIteratorHelperLoose_54826(a0.messages);
const value3 = value2();
let done = value3.done;
const value4 = false;
if (done) {
r0 = value4;
} else {
r6 = value4;
r7 = value3;
while (true) {
updateFromServerThreadBinding = updateFromServerThread;
value5 = r7.value;
thread = value5.thread;
value6 = updateFromServerThreadBinding(thread);
r9 = value6 || r6;
value7 = value2();
done = value7.done;
if (done) {
r0 = r9;
break;
}
r6 = r9;
r7 = value7;
continue;
}
}
if (!a0.isAfter) {
if (a0.isBefore) {
return r0;
}
if (a0.hasMoreAfter) {
return r0;
}
var channel = ChannelStore.getChannel(a0.channelId);
if (channel == null) {
return r0;
}
if (THREAD_CHANNEL_TYPES.has(channel.type)) {
updateState_54829(channel, _fun54875);
return undefined;
}
}
return r0;
function _fun54875(a0) { // fn#54875, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7076:7581, offset: 0x0136ff50, size: 164 bytes, params: 2, frame: 7
var r3;
var property;
var value2;
let messages = env0_0.messages;
let length = messages.length;
if (length === 0) {
a0.mostRecentRawMessage = null;
a0.mostRecentMessage = null;
a0.count = 0;
} else {
messages = env0_0.messages;
property = messages[0];
value2 = null;
r3 = value2 != property ? property : value2;
messages = env0_0.messages;
length = messages.length;
value = environment.__proto__;
a0.count = length >= MAX_THREAD_MESSAGE_COUNT ? MAX_THREAD_MESSAGE_COUNT : a0.count;
if ((value2 == r3 ? undefined : r3.type) !== MessageTypes.THREAD_STARTER_MESSAGE) {
a0.mostRecentRawMessage = r3;
a0.mostRecentMessage = value2;
}
}
}
}
}
global.__d(_fun54822, 6898, [6, 7, 15, 17, 18, 1383, 3794, 1885, 1379, 4814, 1243, 661, 22, 21, 4625, 566, 694,
2]) /* metro module 6898, dependencies: [6, 7, 15, 17, 18, 1383, 3794, 1885, 1379, 4814, 1243, 661, 22, 21, 4625, 566, 694, 2] */;