Files
discord-decomp/sources/modules/messages/useLongestChannelMessageBeforeReply.tsx
T
2026-07-28 01:06:53 +03:00

203 lines
8.1 KiB
TypeScript

/* Metro module 11908; source: modules/messages/useLongestChannelMessageBeforeReply.tsx; dependencies: [4814, 566, 2] */
import MessageStore from '../../stores/MessageStore.tsx'; /* Metro dependency 4814 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
function _fun91381(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91381, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12094:6, offset: 0x0205d7c1, size: 136 bytes, params: 8, frame: 18
let env0_0 = require;
const _arrayLikeToArray_91384 = 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});
(FileImportTrackerModule).fileFinishedImporting('modules/messages/useLongestChannelMessageBeforeReply.tsx');
exports.useLongestChannelMessageBeforeReply = function(a0, a1) {
var env0_0 = a0;
var env0_1 = a1;
return require(dependencyMap[1]).useStateFromStores([MessageStore], _fun91386, [a0, a1]);
};
function _createForOfIteratorHelperLoose_91382(a0, a1) { // fn#91382, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12094:111, offset: 0x0205d849, size: 372 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 _fun91383;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_91384(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_91384(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_91384(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun91383;
}
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 _fun91383() { // fn#91383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12094:682, 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 useLongestChannelMessageBeforeReply(a0, a1) { // fn#91385, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12094:1151, offset: 0x0205d9bd, size: 86 bytes, params: 3, frame: 17
const env0_0 = a0;
const env0_1 = a1;
return (FluxModule).useStateFromStores([MessageStore], _fun91386, [a0, a1]);
function _fun91386() { // fn#91386, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12094:1241, offset: 0x0205da13, size: 187 bytes, params: 1, frame: 19
var r2;
var r3;
var length;
var r0;
var _createForOfIteratorHelperLoose_91382Binding;
var value4;
var value5;
var value6;
var value7;
var done;
var value8;
var author;
var id;
var content;
var length2;
var value9;
if (require != null) {
var messages = MessageStore.getMessages(env0_0);
var oldest = messages.findOldest(function(a0) {
return a0.author.id === require;
});
if (oldest != null) {
_createForOfIteratorHelperLoose_91382Binding = _createForOfIteratorHelperLoose_91382;
value4 = messages.toArray();
value5 = undefined;
value6 = _createForOfIteratorHelperLoose_91382Binding(value4);
value7 = value6();
done = value7.done;
if (done) {
r0 = oldest;
} else {
r2 = value7;
r3 = oldest;
while (true) {
value8 = r2.value;
author = value8.author;
id = author.id;
if (id !== require) {
r0 = r3;
break;
}
content = value8.content;
length2 = content.length;
if (r3 == null) {
length = value5;
continue;
}
content = r3.content;
length = content.length;
if (length2 > length) {
r3 = value8;
continue;
}
continue;
value9 = value6();
done = value9.done;
if (done) {
r0 = r3;
break;
}
r2 = value9;
continue;
}
}
return r0;
}
}
}
}
}
global.__d(_fun91381, 11908, [4814, 566, 2]) /* metro module 11908, dependencies: [4814, 566, 2] */;