decord/source/modules/guild_home/ActiveChannelsStore.tsx

288 lines
8.2 KiB
TypeScript
Raw Normal View History

2026-07-27 11:26:19 +00:00
// Module ID: 12694
// Function ID: 98582
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-07-25 08:10:48 +00:00
// Dependencies: [6, 7, 15, 17, 18, 1348, 3948, 1355, 21, 22, 566, 686, 2]
2026-07-23 10:11:24 +00:00
2026-07-27 11:26:19 +00:00
// Module 12694 (_isNativeReflectConstruct)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import set from "set";
import _possibleConstructorReturn from "_possibleConstructorReturn";
import _getPrototypeOf from "_getPrototypeOf";
import _inherits from "_inherits";
import closure_7 from "_isNativeReflectConstruct";
import closure_8 from "_isNativeReflectConstruct";
import { isGuildHomeChannel } from "set";
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
let closure_0 = !valueOf.call(Reflect.construct(Boolean, [], () => {
}));
function _isNativeReflectConstruct() {
return closure_0;
}
const result = _isNativeReflectConstruct();
}
function resetStore() {
let closure_11 = {};
let closure_12 = {};
let closure_13 = {};
let closure_14 = {};
}
function truncateOldMessageData(arg0) {
2026-07-23 10:11:24 +00:00
if (null != dependencyMap2[arg0]) {
2026-07-20 16:05:17 +00:00
let nowResult = globalThis;
const _Date2 = Date;
2026-07-23 10:11:24 +00:00
importDefault = importDefault(21).fromTimestamp(Date.now() - c10);
const obj = importDefault(21);
const findIndexResult = importDefault(22).findIndex(arr, (id) => callback(outer1_1[8]).compare(id.id, callback) > 0);
2026-07-20 16:05:17 +00:00
if (-1 === findIndexResult) {
2026-07-23 10:11:24 +00:00
dependencyMap2[arg0] = [];
2026-07-20 16:05:17 +00:00
} else {
const _Math = Math;
const bound = Math.max(findIndexResult, arr.length - 26);
2026-07-23 10:11:24 +00:00
dependencyMap2[arg0] = importDefault(22).slice(arr, bound);
const arr2 = importDefault(22);
2026-07-20 16:05:17 +00:00
}
const _Date = nowResult.Date;
nowResult = _Date.now();
closure_13[arg0] = nowResult;
2026-07-23 10:11:24 +00:00
const obj2 = importDefault(22);
2026-07-20 16:05:17 +00:00
}
}
function addMessage(arg0, arg1, id, userId) {
2026-07-23 10:11:24 +00:00
let obj = dependencyMap[arg0];
2026-07-20 16:05:17 +00:00
obj.add(arg1);
let tmp3 = null == tmp2;
if (!tmp3) {
const _Date = Date;
const sum = tmp2 + 300000;
tmp3 = sum > Date.now();
}
if (tmp3) {
truncateOldMessageData(arg1);
}
2026-07-23 10:11:24 +00:00
if (null == dependencyMap2[arg1]) {
dependencyMap2[arg1] = [];
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let arr = dependencyMap2[arg1];
2026-07-20 16:05:17 +00:00
obj = { id, userId };
arr = arr.push(obj);
}
function handleChannelDelete(channel) {
channel = channel.channel;
2026-07-23 10:11:24 +00:00
delete tmp4[tmp3];
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c10 = 900000;
2026-07-20 16:05:17 +00:00
let closure_11 = {};
let closure_12 = {};
let closure_13 = {};
let closure_14 = {};
2026-07-23 10:11:24 +00:00
let tmp2 = ((Store) => {
2026-07-20 16:05:17 +00:00
class ActiveChannelsStore {
constructor() {
self = this;
2026-07-23 10:11:24 +00:00
tmp = outer1_2(this, ActiveChannelsStore);
obj = outer1_5(ActiveChannelsStore);
tmp2 = outer1_4;
if (outer1_15()) {
2026-07-20 16:05:17 +00:00
tmp6 = globalThis;
_Reflect = Reflect;
2026-07-23 10:11:24 +00:00
tmp7 = outer1_5;
2026-07-20 16:05:17 +00:00
tmp8 = arguments;
2026-07-23 10:11:24 +00:00
constructResult = Reflect.construct(obj, arguments, outer1_5(self).constructor);
2026-07-20 16:05:17 +00:00
} else {
tmp3 = arguments;
tmp4 = arguments;
constructResult = obj(...arguments);
}
return tmp2(self, constructResult);
}
}
callback2(ActiveChannelsStore, Store);
let obj = {
key: "initialize",
value() {
2026-07-23 10:11:24 +00:00
this.waitFor(outer1_7, outer1_8);
2026-07-20 16:05:17 +00:00
}
};
const items = [obj, , , , ];
obj = {
key: "getActiveChannelsFetchStatus",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_14[arg0];
2026-07-20 16:05:17 +00:00
}
};
items[1] = obj;
obj = {
key: "getActiveChannelIds",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_11[arg0];
2026-07-20 16:05:17 +00:00
}
};
items[2] = obj;
items[3] = {
key: "getChannelMessageData",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_12[arg0];
2026-07-20 16:05:17 +00:00
}
};
items[4] = {
key: "shouldFetch",
value(arg0) {
2026-07-23 10:11:24 +00:00
let tmp = null == outer1_11[arg0];
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-23 10:11:24 +00:00
tmp = !(null != outer1_14[arg0] && outer1_14[arg0].loading);
const tmp4 = null != outer1_14[arg0] && outer1_14[arg0].loading;
2026-07-20 16:05:17 +00:00
}
return tmp;
}
};
return callback(ActiveChannelsStore, items);
2026-07-23 10:11:24 +00:00
})(require("initialize").Store);
2026-07-20 16:05:17 +00:00
tmp2.displayName = "ActiveChannelsStore";
2026-07-23 10:11:24 +00:00
tmp2 = new tmp2(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
CHANNEL_SELECT: function handleRefreshChannels(guildId) {
guildId = guildId.guildId;
if (isGuildHomeChannel(guildId.channelId)) {
if (null != guildId) {
2026-07-23 10:11:24 +00:00
if (null == dependencyMap[guildId]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const item = arr.forEach((arg0) => {
2026-07-23 10:11:24 +00:00
outer1_17(arg0);
2026-07-20 16:05:17 +00:00
let length;
2026-07-23 10:11:24 +00:00
if (null != outer1_12[arg0]) {
2026-07-20 16:05:17 +00:00
length = arr.length;
}
if (0 === length) {
2026-07-23 10:11:24 +00:00
delete tmp[tmp2];
2026-07-20 16:05:17 +00:00
}
});
const _Array = Array;
2026-07-23 10:11:24 +00:00
const obj = importDefault(22);
const found = importDefault(22).chain(Array.from(arr)).filter((arg0) => arg0 in outer1_12);
const chainResult = importDefault(22).chain(Array.from(arr));
2026-07-20 16:05:17 +00:00
const _Set = Set;
const set = new Set(found.sortBy((arg0) => {
let length;
2026-07-23 10:11:24 +00:00
if (null != outer1_12[arg0]) {
2026-07-20 16:05:17 +00:00
length = arr.length;
}
let num = 0;
if (null != length) {
num = length;
}
return -num;
}).value());
2026-07-23 10:11:24 +00:00
dependencyMap[guildId] = set;
2026-07-20 16:05:17 +00:00
}
}
}
return false;
},
MESSAGE_CREATE: function handleMessageCreate(optimistic) {
let author;
let channelId;
let id;
let message;
({ channelId, message } = optimistic);
if (!optimistic.optimistic) {
if (!optimistic.isPushNotification) {
2026-07-23 10:11:24 +00:00
channel = channel.getChannel(channelId);
2026-07-20 16:05:17 +00:00
if (null == channel) {
return false;
} else {
const guild_id = channel.guild_id;
let tmp4 = null != guild_id;
if (tmp4) {
2026-07-23 10:11:24 +00:00
if (null != dependencyMap[guild_id]) {
2026-07-20 16:05:17 +00:00
({ id, author } = message);
id = undefined;
if (null != author) {
id = author.id;
}
addMessage(guild_id, channelId, id, id);
const tmp7 = addMessage;
}
tmp4 = tmp6;
}
return tmp4;
}
}
}
return false;
},
GUILD_DELETE: function handleGuildDelete(arg0) {
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
},
CHANNEL_DELETE: handleChannelDelete,
THREAD_DELETE: handleChannelDelete,
ACTIVE_CHANNELS_FETCH_START: function handleActiveChannelsFetchStart(guildId) {
2026-07-23 10:11:24 +00:00
const obj = { loading: true, error: null, fetchedAt: Date.now() };
closure_14[guildId.guildId] = obj;
2026-07-20 16:05:17 +00:00
},
ACTIVE_CHANNELS_FETCH_SUCCESS: function handleActiveChannelsFetchSuccess(guildId) {
guildId = guildId.guildId;
const channels = guildId.channels;
2026-07-23 10:11:24 +00:00
const obj = { loading: false, error: null, fetchedAt: Date.now() };
2026-07-20 16:05:17 +00:00
closure_14[guildId] = obj;
closure_11[guildId] = new Set();
2026-07-23 10:11:24 +00:00
let item = channels.forEach((arg0) => {
let guildId;
2026-07-20 16:05:17 +00:00
let messages;
2026-07-23 10:11:24 +00:00
({ channel_id: guildId, messages } = arg0);
2026-07-20 16:05:17 +00:00
const item = messages.forEach((message_id) => {
2026-07-23 10:11:24 +00:00
outer2_18(outer1_0, closure_0, message_id.message_id, message_id.user_id);
2026-07-20 16:05:17 +00:00
});
});
},
ACTIVE_CHANNELS_FETCH_FAILURE: function handleActiveChannelsFetchFailure(error) {
2026-07-23 10:11:24 +00:00
const obj = { loading: false, error: error.error, fetchedAt: null };
2026-07-22 07:54:56 +00:00
closure_14[error.guildId] = obj;
2026-07-20 16:05:17 +00:00
},
CONNECTION_OPEN: function handleConnectionOpen() {
2026-07-23 10:11:24 +00:00
guildId = guildId.getGuildId();
2026-07-20 16:05:17 +00:00
if (null != guildId) {
let items = tmp7;
2026-07-23 10:11:24 +00:00
if (null == obj[guildId]) {
2026-07-20 16:05:17 +00:00
items = [];
}
const reduced = Array.from(items).reduce((arg0, arg1) => {
let items = obj[arg1];
if (null == items) {
items = [];
}
arg0[arg1] = items;
return arg0;
}, {});
let fetchedAt;
resetStore();
const _Date = Date;
const timestamp = Date.now();
2026-07-23 10:11:24 +00:00
if (null != obj[guildId]) {
2026-07-20 16:05:17 +00:00
fetchedAt = tmp5.fetchedAt;
}
let num = 0;
if (null != fetchedAt) {
num = fetchedAt;
}
2026-07-23 10:11:24 +00:00
if (timestamp - num < c10) {
obj = {};
2026-07-20 16:05:17 +00:00
obj[guildId] = tmp5;
obj = {};
obj[guildId] = tmp7;
obj = {};
const merged = Object.assign(reduced);
}
const arr = Array.from(items);
} else {
resetStore();
}
}
});
2026-07-23 10:11:24 +00:00
let result = require("_possibleConstructorReturn").fileFinishedImporting("modules/guild_home/ActiveChannelsStore.tsx");
2026-07-20 16:05:17 +00:00
export default tmp2;
export const MAX_STORED_MESSAGES = 26;