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

314 lines
14 KiB
TypeScript

/* Metro module 4622; source: modules/message_request/SpamMessageRequestStore.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 1228, 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 MobileCacheSnapshotStore from '../../stores/MobileCacheSnapshotStore.tsx'; /* Metro dependency 1228 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun39679(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#39679, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:6, offset: 0x010e804c, size: 395 bytes, params: 8, frame: 19
const _arrayLikeToArray_39685 = 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 isSpam = function(a0) {
return a0.isSpam;
};
const handleChannelCreate_39691 = function({channel}) {
return processChannel_39687(channel);
};
const handleChannelUpdates_39692 = function({channels}) {
var r2;
var value4;
var value2 = _createForOfIteratorHelperLoose_39683(channels);
var value3 = value2();
if (!value3.done) {
for (r2 = value3; true; r2 = value4) {
processChannel_39687(r2.value);
value4 = value2();
if (value4.done) {
break;
}
}
}
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = MobileCacheSnapshotStore;
let Set = global.Set;
let set = new Set();
Set = global.Set;
set = new Set();
value = _fun39694(value);
value.displayName = 'SpamMessageRequestStore';
value.LATEST_SNAPSHOT_VERSION = 1;
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/message_request/SpamMessageRequestStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_39680() { // fn#39680, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:170, offset: 0x010e81d7, 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_39680_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_39683(a0, a1) { // fn#39683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:363, offset: 0x010e8235, 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 _fun39684;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_39685(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_39685(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_39685(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun39684;
}
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 _fun39684() { // fn#39684, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:934, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return CreateClass >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof CreateClass === 'bigint' ? CreateClass : +CreateClass]};
}
}
function processChannel_39687(a0) { // fn#39687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:1337, offset: 0x010e7bb0, size: 186 bytes, params: 2, frame: 16
var r3;
var r0;
var binding;
const isSpam2 = isSpam(a0);
if (isSpam2) {
binding = env0_6;
r3 = !binding.has(a0.id);
} else {
r3 = isSpam2;
}
if (r3) {
binding = env0_6;
binding.add(a0.id);
r0 = true;
} else {
r0 = false;
}
if (!isSpam(a0) && env0_6.has(a0.id)) {
env0_6.delete(a0.id);
r0 = true;
}
if (!isSpam(a0) && env0_7.has(a0.id)) {
env0_7.delete(a0.id);
r0 = true;
}
return r0;
}
function handleConnectionOpen_39688() { // fn#39688, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:1520, offset: 0x010e83b2, size: 90 bytes, params: 1, frame: 13
env0_6.clear();
env0_7.clear();
const Object = global.Object;
const values = Object.values;
const channelStoreBinding = ChannelStore;
const getMutablePrivateChannels = channelStoreBinding.getMutablePrivateChannels;
Reflect.apply(values, Object, [Reflect.apply(getMutablePrivateChannels, channelStoreBinding,
[])]).forEach(function(a0) {
processChannel_39687(a0);
});
}
function handleSpamAcceptOptimistic({channelId}) { // fn#39690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:1656, offset: 0x010e7cd7, size: 29 bytes, params: 2, frame: 11
env0_7.add(channelId);
}
function handleChannelDelete_39693({channel}) { // fn#39693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:1915, offset: 0x010e840c, size: 58 bytes, params: 2, frame: 13
var r0;
const binding = env0_6;
if (binding.has(channel.id)) {
env0_6.delete(channel.id);
r0 = true;
} else {
r0 = false;
}
return r0;
}
function _fun39694(a0) { // fn#39694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:2016, offset: 0x010e8446, size: 233 bytes, params: 2, frame: 16
const SpamMessageRequestStore2 = SpamMessageRequestStore;
Inherits(SpamMessageRequestStore2, a0);
return CreateClass(SpamMessageRequestStore2, [{key: 'initialize', value: function() {
this.waitFor(ChannelStore);
}}, {key: 'loadCache', value: value_39698}, {key: 'takeSnapshot', value: value_39699}, {key: 'getSpamChannelIds',
value: value_39700}, {key: 'getSpamChannelsCount', value: value_39701}, {key: 'isSpam', value: value_39702},
{key: 'isAcceptedOptimistic', value: value_39703}, {key: 'isReady', value: value_39704}]);
function SpamMessageRequestStore() { // fn#39695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:2028, offset: 0x010e852f, size: 180 bytes, params: 1, frame: 20
var environment;
const value = environment.__proto__;
env1_0(this, SpamMessageRequestStore);
const handleConnectionOpen_39688Binding = handleConnectionOpen_39688;
const items2 = [{CONNECTION_OPEN: handleConnectionOpen_39688Binding,
CONNECTION_OPEN_SUPPLEMENTAL: handleConnectionOpen_39688Binding, CACHE_LOADED_LAZY: CACHE_LOADED_LAZY_39696,
CHANNEL_CREATE: handleChannelCreate_39691, CHANNEL_UPDATES: handleChannelUpdates_39692,
CHANNEL_DELETE: handleChannelDelete_39693, MESSAGE_REQUEST_ACCEPT_OPTIMISTIC: handleSpamAcceptOptimistic}];
const value3 = env1_3(SpamMessageRequestStore);
return env1_2(this, _isNativeReflectConstruct_39680() ? global.Reflect.construct(value3, items2,
env1_3(this).constructor) : value3.apply(this, items2));
function SpamMessageRequestStoreCACHE_LOADED_LAZY() { // fn#39696, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:2378, owner: SpamMessageRequestStore.CACHE_LOADED_LAZY, offset: 0x010e7f68, size: 19 bytes, params: 1, frame: 9
return ClassCallCheck.loadCache();
}
}
function value_39698() { // fn#39698, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:2706, offset: 0x010e7f94, size: 75 bytes, params: 1, frame: 11
var set;
var value3;
const readSnapshot = this.readSnapshot;
const LATEST_SNAPSHOT_VERSION = SpamMessageRequestStore.LATEST_SNAPSHOT_VERSION;
if (Reflect.apply(readSnapshot, this, [LATEST_SNAPSHOT_VERSION]) != null) {
set = new global.Set();
value3 = environment.__proto__;
}
}
function value_39699() { // fn#39699, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:2842, offset: 0x010e7fdf, size: 51 bytes, params: 1, frame: 12
const object = {};
const LATEST_SNAPSHOT_VERSION = SpamMessageRequestStore.LATEST_SNAPSHOT_VERSION;
object.version = LATEST_SNAPSHOT_VERSION;
const Array = global.Array;
object.data = Array.from(env1_6);
return object;
}
function value_39700() { // fn#39700, offset: 0x00c82288, size: 9 bytes, params: 1, frame: 1
return env1_6;
}
function value_39701() { // fn#39701, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:3025, offset: 0x010e8012, size: 14 bytes, params: 1, frame: 1
return env1_6.size;
}
function value_39702(a0) { // fn#39702, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:3072, offset: 0x010e8020, size: 22 bytes, params: 2, frame: 11
return env1_6.has(a0);
}
function value_39703(a0) { // fn#39703, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4800:3136, offset: 0x010e8036, size: 22 bytes, params: 2, frame: 11
return env1_7.has(a0);
}
function value_39704() { // fn#39704, offset: 0x00fbd9d4, size: 9 bytes, params: 1, frame: 1
return env1_8;
}
}
}
global.__d(_fun39679, 4622, [6, 7, 15, 17, 18, 1379, 1228,
2]) /* metro module 4622, dependencies: [6, 7, 15, 17, 18, 1379, 1228, 2] */;