Files
discord-decomp/sources/stores/PrivateChannelReadStateStore.tsx
T
2026-07-28 01:06:53 +03:00

302 lines
14 KiB
TypeScript

/* Metro module 12600; source: stores/PrivateChannelReadStateStore.tsx; dependencies: [6, 7, 15, 17, 18, 1383, 1379, 4605, 1934, 5219, 1944, 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 './ChannelStore.tsx'; /* Metro dependency 1379 */
import SelectedChannelStore from './SelectedChannelStore.tsx'; /* Metro dependency 1934 */
import ReadStateStore from './ReadStateStore.tsx'; /* Metro dependency 4605 */
import PrivateChannelSortStore from './views/PrivateChannelSortStore.tsx'; /* Metro dependency 5219 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ChannelRecordModule from '../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
import * as FunctionUtilsModule from '../utils/FunctionUtils.tsx'; /* Metro dependency 1944 */
function _fun96596(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96596, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:6, offset: 0x02161482, size: 512 bytes, params: 8, frame: 22
const env0_0 = require;
const _arrayLikeToArray_96602 = 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 closure = function() {
return rebuildUnreads();
};
const MESSAGE_CREATE_966062 = MESSAGE_CREATE_96606;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_12 = [];
const Set = global.Set;
let set = new Set();
const Store = (Flux).Store;
_fun96607(Store).displayName = 'PrivateChannelReadStateStore';
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: closure,
OVERLAY_INITIALIZE: closure, MESSAGE_CREATE: MESSAGE_CREATE_966062, MESSAGE_ACK: MESSAGE_CREATE_966062,
CHANNEL_SELECT: CHANNEL_SELECT_96611, CHANNEL_DELETE: CHANNEL_DELETE_96612, WINDOW_FOCUS: WINDOW_FOCUS_96613,
CHANNEL_CREATE: CHANNEL_CREATE_96614, CHANNEL_UPDATES: CHANNEL_UPDATES_96615});
(FileImportTrackerModule).fileFinishedImporting('stores/PrivateChannelReadStateStore.tsx');
exports.default = set;
function _isNativeReflectConstruct_96597() { // fn#96597, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:211, offset: 0x02161682, 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_96597_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_96600(a0, a1) { // fn#96600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:404, offset: 0x021616e4, 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 _fun96601;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_96602(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_96602(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_96602(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun96601;
}
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 _fun96601() { // fn#96601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:975, 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 rebuildUnreads() { // fn#96603, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:1333, offset: 0x02161858, size: 141 bytes, params: 1, frame: 14
var r0;
var set;
const value3 = PrivateChannelSortStore.getPrivateChannelIds().filter(_fun96604);
if (value3.length > 20) {
value3.length = 20;
}
const value4 = (FunctionUtilsModule).areArraysShallowlyEqual(value3, env0_12);
if (value4) {
r0 = !value4;
} else {
set = new global.Set(value3);
r0 = true;
}
return r0;
function _fun96604(a0) { // fn#96604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:1398, offset: 0x021618e5, size: 29 bytes, params: 2, frame: 11
const value = environment.__proto__;
return ReadStateStore.getMentionCount(a0) > 0;
}
}
function MESSAGE_ACK_96606({channelId}) { // fn#96606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:1579, offset: 0x02161911, size: 71 bytes, params: 2, frame: 13
const channel = ChannelStore.getChannel(channelId);
return !(channel == null || !isPrivate(channel.type)) && rebuildUnreads();
}
function _fun96607(a0) { // fn#96607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:1698, offset: 0x02161958, size: 97 bytes, params: 2, frame: 16
const PrivateChannelReadStateStore2 = PrivateChannelReadStateStore;
Inherits(PrivateChannelReadStateStore2, a0);
return CreateClass(PrivateChannelReadStateStore2, [{key: 'initialize', value: function() {
this.waitFor(PrivateChannelSortStore, ChannelStore, SelectedChannelStore, ReadStateStore);
}}, {key: 'getUnreadPrivateChannelIds', value: value_96610}]);
function PrivateChannelReadStateStore() { // fn#96608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:1710, offset: 0x0118e06f, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_2(this, PrivateChannelReadStateStore);
const value3 = env1_5(PrivateChannelReadStateStore);
return env1_4(this, _isNativeReflectConstruct_96597() ? global.Reflect.construct(value3, arguments,
env1_5(this).constructor) : value3.apply(this, arguments));
}
function value_96610() { // fn#96610, offset: 0x00e2f9de, size: 9 bytes, params: 1, frame: 1
return env1_12;
}
}
function CHANNEL_SELECT_96611({channelId}) { // fn#96611, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:2410, offset: 0x02161911, size: 71 bytes, params: 2, frame: 13
const channel = ChannelStore.getChannel(channelId);
return !(channel == null || !isPrivate(channel.type)) && rebuildUnreads();
}
function CHANNEL_DELETE_96612({channel}) { // fn#96612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:2539, offset: 0x021619e0, size: 51 bytes, params: 2, frame: 12
const value2 = env0_13.has(channel.id);
return value2 ? rebuildUnreads() : !!value2;
}
function WINDOW_FOCUS_96613() { // fn#96613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:2635, offset: 0x02161a13, size: 77 bytes, params: 1, frame: 13
const channelStoreBinding = ChannelStore;
const getChannel = channelStoreBinding.getChannel;
const selectedChannelStoreBinding = SelectedChannelStore;
const getChannelId = selectedChannelStoreBinding.getChannelId;
const value2 = Reflect.apply(getChannel, channelStoreBinding, [Reflect.apply(getChannelId,
selectedChannelStoreBinding, [])]);
return !(value2 == null || !isPrivate(value2.type)) && rebuildUnreads();
}
function CHANNEL_CREATE_96614({channel}) { // fn#96614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:2764, offset: 0x02161a60, size: 76 bytes, params: 2, frame: 13
const channel2 = ChannelStore.getChannel(channel.id);
return !(channel2 == null || !isPrivate(channel2.type)) && rebuildUnreads();
}
function CHANNEL_UPDATES_96615({channels}) { // fn#96615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:2897, offset: 0x02161aac, size: 131 bytes, params: 2, frame: 19
var r4;
var r5;
var r0;
var r3;
var value5;
var id;
var channel;
var value7;
var isPrivateBinding;
var type;
var isPrivate2;
var value8;
var value9;
const value2 = _createForOfIteratorHelperLoose_96600(channels);
const value3 = value2();
let done = value3.done;
if (done) {
r3 = false;
} else {
r4 = false;
r5 = value3;
while (true) {
value5 = r5.value;
id = value5.id;
channel = ChannelStore.getChannel(id);
value7 = channel != null;
if (value7) {
isPrivateBinding = isPrivate;
type = channel.type;
isPrivate2 = isPrivateBinding(type);
r0 = isPrivate2;
} else {
r0 = value7;
}
if (!r0) {
continue;
}
value8 = true;
r4 = value8;
value9 = value2();
done = value9.done;
if (done) {
r3 = r4;
break;
}
r5 = value9;
continue;
}
}
return r3 ? rebuildUnreads() : !!r3;
}
}
global.__d(_fun96596, 12600, [6, 7, 15, 17, 18, 1383, 1379, 4605, 1934, 5219, 1944, 566, 694,
2]) /* metro module 12600, dependencies: [6, 7, 15, 17, 18, 1383, 1379, 4605, 1934, 5219, 1944, 566, 694, 2] */;