decord/source/modules/threads/LazyLoadedThreadManager.tsx

241 lines
7.6 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 10417
// Function ID: 10418
// Name: initialize
// Dependencies: [4865, 1376, 1372, 1931, 676, 1379, 709, 5657, 4011, 4024, 530, 2]
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
// Module 10417 (initialize)
import _handleConnectionOpen from "_handleConnectionOpen";
import createChannelRecord from "createChannelRecord";
import ensureGuildLoaded from "ensureGuildLoaded";
import handleConnectionOpen from "handleConnectionOpen";
2026-07-23 10:11:24 +00:00
import ME from "ME";
import { isStaticChannelRoute } from "set";
2026-07-29 08:29:29 +00:00
let c4;
let c5;
let c9;
let metroImportAll;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function initialize() {
2026-07-23 10:11:24 +00:00
if (!c12) {
c12 = true;
2026-07-29 08:29:29 +00:00
const subscription = importDefault(709).subscribe("CONNECTION_OPEN", () => {
let closure_11 = {};
channelId = channelId.getChannelId();
2026-07-20 16:05:17 +00:00
if (tmp2) {
2026-07-29 08:29:29 +00:00
callback(channelId);
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
const obj = importDefault(709);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
function dispatchLoadedThread(arg0, arg1) {
const tmp = callback(arg0);
importDefault(709).dispatch({ type: "THREAD_CREATE", channel: tmp, messageId: undefined });
2026-07-20 16:05:17 +00:00
}
function loadThread(channelId) {
2026-07-23 10:11:24 +00:00
const _require = channelId;
2026-07-20 16:05:17 +00:00
if (null == channelId) {
return Promise.resolve();
2026-07-29 08:29:29 +00:00
} else if (channelId === _require(5657).FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID) {
2026-07-20 16:05:17 +00:00
return Promise.resolve();
} else if (isStaticChannelRoute(channelId)) {
return Promise.resolve();
2026-07-23 10:11:24 +00:00
} else if (null != store.getChannel(channelId)) {
2026-07-20 16:05:17 +00:00
return Promise.resolve();
} else {
2026-07-29 08:29:29 +00:00
if (!c12) {
c12 = true;
let obj = importDefault(709);
const subscription = obj.subscribe("CONNECTION_OPEN", () => {
let closure_11 = {};
channelId = channelId.getChannelId();
if (tmp2) {
callback(channelId);
}
});
}
if (_handleConnectionOpen.isConnected()) {
2026-07-23 10:11:24 +00:00
if (null != dependencyMap[channelId]) {
2026-07-29 08:29:29 +00:00
if ("LOADING" === tmp7.type) {
let resolved = tmp7.promise;
2026-07-20 16:05:17 +00:00
} else {
resolved = Promise.resolve();
}
return resolved;
} else {
2026-07-29 08:29:29 +00:00
let tmp13Result = tmp13(4011);
2026-07-20 16:05:17 +00:00
const _location = location;
2026-07-29 08:29:29 +00:00
obj = { path: null, exact: true };
const RouteParam = tmp13(4024).RouteParam;
const RouteParam2 = tmp13(4024).RouteParam;
obj[0] = closure_9.CHANNEL(RouteParam.guildId(), RouteParam2.channelId(), ":messageId");
importDefault = tmp13Result.matchPath(location.pathname, obj);
const HTTP = tmp13(530).HTTP;
obj = { url: null, rejectWithError: null };
obj[0] = closure_8.CHANNEL(channelId);
tmp13Result = tmp13(530);
obj[1] = tmp13Result.rejectWithMigratedError();
2026-07-20 16:05:17 +00:00
const value = HTTP.get(obj);
2026-07-29 08:29:29 +00:00
const guildIdResult = RouteParam.guildId();
2026-07-20 16:05:17 +00:00
const catchPromise = value.then((body) => {
body = body.body;
2026-07-23 10:11:24 +00:00
outer1_11[closure_0] = { type: "LOADED" };
if (outer1_5.has(body.type)) {
2026-07-20 16:05:17 +00:00
let messageId;
2026-07-29 08:29:29 +00:00
if (lib != null) {
2026-07-20 16:05:17 +00:00
const params = lib.params;
2026-07-29 08:29:29 +00:00
if (params != null) {
2026-07-20 16:05:17 +00:00
messageId = params.messageId;
}
}
2026-07-29 08:29:29 +00:00
let obj = lib(outer1_2[6]);
obj = { type: "THREAD_CREATE", channel: null, messageId: null };
obj[1] = outer1_4(body);
obj[2] = messageId;
obj.dispatch(obj);
const tmp4 = outer1_4(body);
2026-07-20 16:05:17 +00:00
}
}).catch(() => {
2026-07-23 10:11:24 +00:00
outer1_11[closure_0] = { type: "NOT_FOUND" };
let obj = lib(outer1_2[6]);
2026-07-29 08:29:29 +00:00
obj = { id: closure_0, guild_id: null, parent_id: "Array" };
2026-07-20 16:05:17 +00:00
let guildId;
2026-07-29 08:29:29 +00:00
if (lib != null) {
2026-07-20 16:05:17 +00:00
const params = lib.params;
2026-07-29 08:29:29 +00:00
if (params != null) {
2026-07-20 16:05:17 +00:00
guildId = params.guildId;
}
}
2026-07-29 08:29:29 +00:00
obj[1] = guildId;
obj.dispatch({ type: "CHANNEL_DELETE", channel: obj });
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
const obj1 = { type: "LOADING", promise: null };
obj1[1] = catchPromise;
2026-07-23 10:11:24 +00:00
dependencyMap[channelId] = obj1;
2026-07-20 16:05:17 +00:00
return catchPromise;
}
} else {
return Promise.resolve();
}
}
}
2026-07-29 08:29:29 +00:00
({ createChannelRecordFromServer: c4, THREAD_CHANNEL_TYPES: c5 } = createChannelRecord);
({ Endpoints: metroImportAll, Routes: c9 } = ME);
2026-07-20 16:05:17 +00:00
let closure_11 = {};
2026-07-23 10:11:24 +00:00
let c12 = false;
2026-07-29 08:29:29 +00:00
const result = require("ensureGuildLoaded").fileFinishedImporting("modules/threads/LazyLoadedThreadManager.tsx");
2026-07-23 10:11:24 +00:00
export default {
2026-07-29 08:29:29 +00:00
getLoadState(key10013) {
2026-07-20 16:05:17 +00:00
let type;
2026-07-29 08:29:29 +00:00
if (dependencyMap[key10013] != null) {
2026-07-20 16:05:17 +00:00
type = tmp.type;
}
return type;
},
loadThread,
loadThreadsBulk(arr) {
initialize();
2026-07-29 08:29:29 +00:00
if (_handleConnectionOpen.isConnected()) {
2026-07-20 16:05:17 +00:00
const items = [];
const items1 = [];
2026-07-29 08:29:29 +00:00
let iter = arr[Symbol.iterator]();
let nextResult = iter.next();
while (iter !== undefined) {
let tmp9 = nextResult;
let tmp10 = items1;
let tmp11 = dependencyMap;
if (nextResult !== items1(5657).FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID) {
let tmp12 = isStaticChannelRoute;
let tmp13 = nextResult;
if (!isStaticChannelRoute(tmp9)) {
let tmp14 = store;
let tmp15 = nextResult;
if (null == store.getChannel(tmp9)) {
let tmp16 = dependencyMap;
let tmp17 = nextResult;
let tmp18 = dependencyMap[tmp9];
let tmp19 = tmp18;
if (null == tmp18) {
let tmp23 = nextResult;
arr = items1.push(tmp9);
} else {
let tmp20 = tmp18;
if ("LOADING" === tmp19.type) {
let tmp21 = tmp18;
arr = items.push(tmp19.promise);
2026-07-20 16:05:17 +00:00
}
}
}
}
2026-07-29 08:29:29 +00:00
}
continue;
2026-07-20 16:05:17 +00:00
}
if (0 === items1.length) {
return Promise.all(items).then(() => {
});
} else {
2026-07-29 08:29:29 +00:00
const HTTP = items1(530).HTTP;
let obj = { url: null, body: null, rejectWithError: null };
obj[0] = closure_8.THREADS_BULK;
obj = { thread_ids: null };
obj[0] = items1;
obj[1] = obj;
obj[2] = items1(530).rejectWithMigratedError();
const obj4 = items1(530);
2026-07-20 16:05:17 +00:00
const postResult = HTTP.post(obj);
2026-07-29 08:29:29 +00:00
const catchPromise = HTTP.post(obj).then((arg0) => {
2026-07-20 16:05:17 +00:00
const set = new Set();
2026-07-29 08:29:29 +00:00
const iter = arg0.body.items[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let id = nextResult.id;
let addResult = set.add(id);
let tmp3 = outer1_11;
outer1_11[id] = { type: "LOADED" };
let tmp4 = outer1_14;
let tmp5 = outer1_14(nextResult);
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
for (const item10029 of items1) {
let tmp6 = item10029;
if (!set.has(item10029)) {
let tmp7 = outer1_11;
let tmp8 = item10029;
outer1_11[tmp6] = { type: "NOT_FOUND" };
}
continue;
2026-07-20 16:05:17 +00:00
}
}).catch(() => {
2026-07-29 08:29:29 +00:00
for (const item10005 of items1) {
let tmp3 = outer1_11;
delete tmp[tmp2];
continue;
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
for (const item10052 of items1) {
let tmp26 = dependencyMap;
obj = { type: "LOADING", promise: null };
obj[1] = catchPromise;
dependencyMap[item10052] = obj;
continue;
2026-07-20 16:05:17 +00:00
}
let nextPromise1 = catchPromise;
if (0 !== items.length) {
const items2 = [];
2026-07-29 08:29:29 +00:00
items2[HermesBuiltin.arraySpread(items, 0)] = catchPromise;
2026-07-20 16:05:17 +00:00
nextPromise1 = Promise.all(items2).then(() => {
});
const allPromises1 = Promise.all(items2);
}
return nextPromise1;
}
} else {
return Promise.resolve();
}
}
};