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

308 lines
12 KiB
TypeScript

/* Metro module 7074; source: modules/replies/PendingReplyStore.tsx; dependencies: [57, 6, 7, 15, 17, 18, 1379, 4814, 21, 566, 694, 2] */
function _fun56373(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:6, offset: 0x013c63f4, size: 471 bytes, params: 8, frame: 18
const _arrayLikeToArray_56376 = 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 Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(57) /* metro dependency 57 */;
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const messageStore = importDefault(4814) /* metro dependency 4814: MessageStore */;
let env0_10 = {};
let env0_11 = {};
let env0_12 = {};
const PersistedStore = (importDefault(566) /* metro dependency 566: flux */).PersistedStore;
let value = _fun56381(PersistedStore);
value.displayName = 'PendingReplyStore';
value.persistKey = 'PendingReplyStore';
value.migrations = [function(a0) {
return a0 ?? ({});
}];
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{CREATE_PENDING_REPLY: CREATE_PENDING_REPLY_56388, CREATE_SHALLOW_PENDING_REPLY: CREATE_SHALLOW_PENDING_REPLY,
SET_PENDING_REPLY_SHOULD_MENTION: SET_PENDING_REPLY_SHOULD_MENTION, DELETE_PENDING_REPLY: DELETE_PENDING_REPLY,
CONNECTION_OPEN: CONNECTION_OPEN_56392, LOGOUT: function() {
env0_10 = {};
env0_11 = {};
env0_12 = {};
}, MESSAGE_DELETE: MESSAGE_DELETE_56395, CHANNEL_SELECT: function({channelId}) {
tryHydratePendingReply(channelId);
}, LOAD_MESSAGES_SUCCESS: function({channelId}) {
tryHydratePendingReply(channelId);
}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/replies/PendingReplyStore.tsx');
exports.default = value;
}
function _createForOfIteratorHelperLoose_56374(a0, a1) { // fn#56374, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:180, offset: 0x013c65cb, 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 _fun56375;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_56376(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_56376(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_56376(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun56375;
}
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 _isNativeReflectConstruct_56377() { // fn#56377, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:1090, offset: 0x013c673d, 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_56377_isNativeReflectConstruct = function() {
return !!result;
})();
}
function tryHydratePendingReply(a0) { // fn#56380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:1302, offset: 0x013c679b, size: 139 bytes, params: 2, frame: 17
if (a0 == null) {
return false;
}
const property = env0_11[a0];
if (property == null) {
return false;
}
const message = MessageStore.getMessage(a0, property.messageId);
const channel = ChannelStore.getChannel(property.channelId);
if (message == null) {
return false;
}
if (channel == null) {
return false;
}
env0_10[a0] = {channel: channel, message: message, shouldMention: property.shouldMention,
showMentionToggle: property.showMentionToggle};
delete env0_11[a0];
}
function _fun56381(a0) { // fn#56381, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:1592, offset: 0x013c6826, size: 139 bytes, params: 2, frame: 16
const closure = PendingReplyStore;
env0_7(closure, a0);
return env0_4(closure, [{key: 'getState', value: value_56383}, {key: 'initialize', value: function(a0) {
var value = a0;
this.waitFor(MessageStore, ChannelStore);
env1_11 = value ?? ({});
}}, {key: 'getPendingReply', value: value_56385}, {key: 'getPendingReplyActionSource', value: value_56386}]);
}
function CREATE_PENDING_REPLY_56388({channel, message, shouldMention, showMentionToggle, source, mediaMention}) { // fn#56388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:2529, offset: 0x013c699f, size: 106 bytes, params: 2, frame: 12
shouldMention = shouldMention === undefined || shouldMention;
showMentionToggle = showMentionToggle === undefined || showMentionToggle;
env0_10[channel.id] = {channel: channel, message: message, shouldMention: shouldMention,
showMentionToggle: showMentionToggle, mediaMention: mediaMention};
env0_12[channel.id] = source;
}
function CREATE_SHALLOW_PENDING_REPLY({channel, messageId, shouldMention, showMentionToggle}) { // fn#56389, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:2773, offset: 0x013c6a09, size: 82 bytes, params: 2, frame: 8
shouldMention = shouldMention === undefined || shouldMention;
showMentionToggle = showMentionToggle === undefined || showMentionToggle;
env0_11[channel.id] = {channelId: channel.id, messageId: messageId, shouldMention: shouldMention,
showMentionToggle: showMentionToggle};
}
function SET_PENDING_REPLY_SHOULD_MENTION({channelId, shouldMention}) { // fn#56390, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:2988, offset: 0x013c6a5b, size: 103 bytes, params: 2, frame: 15
var r5;
var binding;
var object2;
var value2;
if (channelId in env0_10) {
binding = env0_10;
object2 = {};
copyDataProperties(object2, binding[channelId], r5);
value2 = 'shouldMention';
object2[value2] = shouldMention;
binding[channelId] = object2;
r5 = value2;
}
if (channelId in env0_11) {
binding = env0_11;
object2 = {};
copyDataProperties(object2, binding[channelId], r5);
object2['shouldMention'] = shouldMention;
binding[channelId] = object2;
}
}
function DELETE_PENDING_REPLY({channelId}) { // fn#56391, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:3167, offset: 0x013c6ac2, size: 31 bytes, params: 2, frame: 3
delete env0_10[channelId];
delete env0_11[channelId];
}
function CONNECTION_OPEN_56392() { // fn#56392, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:3257, offset: 0x013c6ae1, size: 58 bytes, params: 1, frame: 12
(importDefault(21) /* metro dependency 21: SnowflakeUtils */).keys(env0_11).forEach(_fun56393);
}
function MESSAGE_DELETE_56395({id, channelId}) { // fn#56395, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:3419, offset: 0x013c6b5a, size: 126 bytes, params: 2, frame: 8
const property = env0_10[channelId];
const id = property == null || property.message == null ? undefined : property.message.id;
if (id === id) {
delete env0_10[channelId];
} else {
if (env0_11[channelId]?.messageId !== id) {
return false;
}
delete env0_11[channelId];
}
delete env0_12[channelId];
}
function value_56383() { // fn#56383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7252:1905, offset: 0x013c68b1, size: 180 bytes, params: 1, frame: 21
var r11;
var r3;
var value4;
var value5;
var property;
var property2;
var message;
var id;
var shouldMention;
var showMentionToggle;
var value6;
const object2 = {};
const _createForOfIteratorHelperLoose_56374Binding = _createForOfIteratorHelperLoose_56374;
const defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
const value2 = _createForOfIteratorHelperLoose_56374Binding(defaultImport.entries(env1_10));
const value3 = value2();
let done = value3.done;
if (!done) {
for (r3 = value3; true; r3 = value6) {
value4 = r3.value;
value5 = env1_2(value4, 2);
property = value5[0];
property2 = value5[1];
message = property2.message;
id = message.id;
shouldMention = property2.shouldMention;
showMentionToggle = property2.showMentionToggle;
object2[property] = {channelId: property, messageId: id, shouldMention: shouldMention,
showMentionToggle: showMentionToggle};
value6 = value2();
done = value6.done;
if (done) {
r11 = shouldMention;
break;
}
}
}
const object4 = {};
copyDataProperties(object4, env1_11, r11);
copyDataProperties(object4, object2, r11);
return object4;
}