decord/alpha/source/modules/threads/native/useCreateThread.tsx

293 lines
11 KiB
TypeScript
Raw Normal View History

2026-10-08 09:57:35 +00:00
// Module ID: 9650
// Function ID: 9651
2026-07-20 16:05:17 +00:00
// Name: useCreateThread
2026-10-08 09:57:35 +00:00
// Dependencies: [5, 19, 7232, 5083, 558, 576, 6841, 7167, 7358, 9203, 9201, 9199, 9651, 7737, 7752, 9204, 2]
2026-07-20 16:05:17 +00:00
2026-10-08 09:57:35 +00:00
// Module 9650 (useCreateThread)
import MessageConstants from "MessageConstants" /* 5083 */;
import useAnalyticsLocationsDefault from "useAnalyticsLocations" /* 6841 */;
import MessageActionCreatorsDefault from "MessageActionCreators" /* 7167 */;
import DraftStore from "DraftStore" /* 7232 */;
import MessageParserDefault from "MessageParser" /* 7358 */;
import UploadAttachmentActionCreatorsDefault from "UploadAttachmentActionCreators" /* 9201 */;
import handleUploadAttachmentErrors from "handleUploadAttachmentErrors" /* 9203 */;
2026-10-03 08:58:59 +00:00
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
import react from "react" /* 19 */;
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
let files;
2026-10-03 08:58:59 +00:00
const DraftType = DraftStore.DraftType;
const MessageSendLocation = MessageConstants.MessageSendLocation;
let ReactCompilerGating = ReactCompilerGating_mod;
2026-10-08 09:57:35 +00:00
let tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useCreateThread(arg0) {
2026-10-03 08:58:59 +00:00
let _location;
let analyticsLocations;
let onThreadCreated;
let parentChannel;
let parentMessageId;
let privateThreadMode;
let threadSettings;
let tmp4;
let useDefaultThreadName;
let tmp = analyticsLocations;
let tmp2 = dependencyMap;
let obj = analyticsLocations(576);
const cResult = obj.c(11);
({ parentChannel, parentMessageId, threadSettings, privateThreadMode, location: _location, onThreadCreated, useDefaultThreadName } = arg0);
analyticsLocations = useAnalyticsLocationsDefault().analyticsLocations;
if (cResult[0] !== analyticsLocations) {
2026-10-08 09:57:35 +00:00
function handleUploads(id, attachmentsToUpload, arg2) {
2026-10-03 08:58:59 +00:00
const guildId = id;
const uploads = attachmentsToUpload;
id = id.id;
const sendMessage = MessageActionCreatorsDefault.sendMessage;
let obj = MessageParserDefault;
let obj2 = {
location: constants.THREAD_CREATION,
attachmentsToUpload,
onAttachmentUploadError(file, code, reason) {
const obj = handleUploadAttachmentErrors;
const obj2 = { file, guildId: guildId.getGuildId(), analyticsLocations, code, reason };
const tmp2 = guildId;
if (obj.handleUploadMessageAttachmentsErrors(obj2)) {
const obj4 = { channelId: tmp2.id, uploads, draftType: DraftType.FirstThreadMessage, resetState: true };
const obj3 = UploadAttachmentActionCreatorsDefault;
obj3.setUploads(obj4);
}
}
};
sendMessage(id, obj.parse(id, arg2), undefined, obj2);
2026-10-08 09:57:35 +00:00
}
2026-10-03 08:58:59 +00:00
cResult[0] = analyticsLocations;
2026-10-08 09:57:35 +00:00
cResult[1] = handleUploads;
tmp4 = handleUploads;
2026-10-03 08:58:59 +00:00
} else {
tmp4 = cResult[1];
}
if (cResult[2] === tmp4) {
if (cResult[3] === _location) {
if (cResult[4] === onThreadCreated) {
if (cResult[5] === parentChannel) {
if (cResult[6] === parentMessageId) {
if (cResult[7] === privateThreadMode) {
if (cResult[8] === threadSettings) {
let tmp5;
if (cResult[9] === useDefaultThreadName) {
tmp5 = cResult[10];
}
2026-10-08 09:57:35 +00:00
const tmpResult = tmp(9199);
2026-10-03 08:58:59 +00:00
return tmpResult.useCreateThreadCommon(tmp5);
}
}
}
}
}
}
}
let obj2 = { parentChannel, parentMessageId, threadSettings, privateThreadMode, location: _location, onThreadCreated, useDefaultThreadName, uploadHandler: tmp4 };
cResult[2] = tmp4;
cResult[3] = _location;
cResult[4] = onThreadCreated;
cResult[5] = parentChannel;
cResult[6] = parentMessageId;
cResult[7] = privateThreadMode;
cResult[8] = threadSettings;
cResult[9] = useDefaultThreadName;
cResult[10] = obj2;
tmp5 = obj2;
2026-10-08 09:57:35 +00:00
}) : (function useCreateThread(arg0) {
2026-10-03 08:58:59 +00:00
let _location;
let onThreadCreated;
let parentChannel;
let parentMessageId;
let privateThreadMode;
let threadSettings;
let useDefaultThreadName;
2026-07-20 16:05:17 +00:00
({ parentChannel, parentMessageId, threadSettings, privateThreadMode, location: _location, onThreadCreated, useDefaultThreadName } = arg0);
const analyticsLocations = useAnalyticsLocationsDefault().analyticsLocations;
2026-10-08 09:57:35 +00:00
let obj = analyticsLocations(9199);
2026-10-03 08:58:59 +00:00
let obj2 = {
2026-07-20 16:05:17 +00:00
parentChannel,
parentMessageId,
threadSettings,
privateThreadMode,
location: _location,
onThreadCreated,
useDefaultThreadName,
2026-10-08 09:57:35 +00:00
uploadHandler: function handleUploads(id, attachmentsToUpload, arg2) {
const guildId = id;
const uploads = attachmentsToUpload;
2026-10-03 08:58:59 +00:00
id = id.id;
const sendMessage = MessageActionCreatorsDefault.sendMessage;
let obj = MessageParserDefault;
let obj2 = {
location: constants.THREAD_CREATION,
2026-07-20 16:05:17 +00:00
attachmentsToUpload,
onAttachmentUploadError(file, code, reason) {
const obj = handleUploadAttachmentErrors;
2026-10-03 08:58:59 +00:00
const obj2 = { file, guildId: guildId.getGuildId(), analyticsLocations, code, reason };
const tmp2 = guildId;
if (obj.handleUploadMessageAttachmentsErrors(obj2)) {
2026-10-03 08:58:59 +00:00
const obj4 = { channelId: tmp2.id, uploads, draftType: DraftType.FirstThreadMessage, resetState: true };
const obj3 = UploadAttachmentActionCreatorsDefault;
obj3.setUploads(obj4);
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
};
sendMessage(id, obj.parse(id, arg2), undefined, obj2);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
};
return obj.useCreateThreadCommon(obj2);
});
ReactCompilerGating = ReactCompilerGating_mod;
2026-10-08 09:57:35 +00:00
const tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? (function useCreateForumPost(parentChannel) {
2026-10-03 08:58:59 +00:00
let analyticsLocations;
let appliedTags;
let onThreadCreated;
let threadSettings;
const tmp = parentChannel;
let obj = parentChannel(576);
const cResult = obj.c(10);
parentChannel = parentChannel.parentChannel;
({ threadSettings, appliedTags, onThreadCreated } = parentChannel);
2026-10-08 09:57:35 +00:00
analyticsLocations = analyticsLocations(6841)().analyticsLocations;
2026-10-03 08:58:59 +00:00
if (cResult[0] === analyticsLocations) {
let tmp4;
if (cResult[1] === parentChannel) {
tmp4 = cResult[2];
}
let str;
if (threadSettings != null) {
str = threadSettings.name;
}
if (str == null) {
str = "";
}
if (cResult[3] === analyticsLocations) {
if (cResult[4] === appliedTags) {
if (cResult[5] === onThreadCreated) {
if (cResult[6] === parentChannel) {
if (cResult[7] === str) {
let tmp6;
if (cResult[8] === tmp4) {
tmp6 = cResult[9];
}
2026-10-08 09:57:35 +00:00
const tmpResult = tmp(9199);
2026-10-03 08:58:59 +00:00
return tmpResult.useCreateForumPostCommon(tmp6);
}
}
}
}
}
let obj2 = { parentChannel, name: str, appliedTags, analyticsLocations, onThreadCreated, upload: tmp4 };
cResult[3] = analyticsLocations;
cResult[4] = appliedTags;
cResult[5] = onThreadCreated;
cResult[6] = parentChannel;
cResult[7] = str;
cResult[8] = tmp4;
cResult[9] = obj2;
tmp6 = obj2;
}
let closure_0 = _asyncToGenerator(async (arg0) => {
let FirstThreadMessage;
let closure_1;
const guildId = arg0;
let c2 = 0;
let c3 = 0;
return (async function(arg0, value) {
const self = this;
const self2 = this;
const obj7 = new analyticsLocations(closure_2_2[12])();
const obj8 = guildId(closure_2_2[13]);
const maxFileSizeResult = obj8.maxFileSize(guildId.getGuildId());
const obj9 = guildId(closure_2_2[14]);
const effectiveUploadLimit = obj9.getEffectiveUploadLimit(maxFileSizeResult);
obj7.on("progress", (currentSize) => {
if (currentSize.currentSize > closure_3) {
obj7.cancel();
const obj2 = { channelId: guildId.id, uploads, draftType: FirstThreadMessage.FirstThreadMessage, resetState: true };
const obj = obj7(baseMaxSize[10]);
obj.setUploads(obj2);
const obj3 = { file: currentSize, maxSize: tmp, baseMaxSize, guildId: guildId.getGuildId(), analyticsLocations };
const tmp10 = obj7(baseMaxSize[15]);
tmp10(obj3);
}
});
await obj7.uploadFiles(guildId);
files = value;
let obj = { uploaderFile: obj7._file, files };
return obj;
})();
});
2026-10-08 09:57:35 +00:00
function t1() {
2026-10-03 08:58:59 +00:00
return closure_0(...arguments);
2026-10-08 09:57:35 +00:00
}
2026-10-03 08:58:59 +00:00
cResult[0] = analyticsLocations;
cResult[1] = parentChannel;
2026-10-08 09:57:35 +00:00
cResult[2] = t1;
tmp4 = t1;
}) : (function useCreateForumPost(parentChannel) {
2026-10-03 08:58:59 +00:00
let appliedTags;
let onThreadCreated;
let str;
2026-07-20 16:05:17 +00:00
parentChannel = parentChannel.parentChannel;
const threadSettings = parentChannel.threadSettings;
2026-07-29 08:29:29 +00:00
let analyticsLocations;
2026-07-20 16:05:17 +00:00
({ appliedTags, onThreadCreated } = parentChannel);
2026-10-08 09:57:35 +00:00
analyticsLocations = analyticsLocations(6841)().analyticsLocations;
2026-10-03 08:58:59 +00:00
const useCallback = react.useCallback;
let closure_0 = _asyncToGenerator(async (arg0) => {
let FirstThreadMessage;
let closure_1;
const guildId = arg0;
2026-10-03 08:58:59 +00:00
let c2 = 0;
let c3 = 0;
return (async function(arg0, value) {
const self = this;
const self2 = this;
const obj7 = new analyticsLocations(closure_2_2[12])();
const obj8 = guildId(closure_2_2[13]);
const maxFileSizeResult = obj8.maxFileSize(guildId.getGuildId());
const obj9 = guildId(closure_2_2[14]);
const effectiveUploadLimit = obj9.getEffectiveUploadLimit(maxFileSizeResult);
2026-08-04 21:03:28 +00:00
obj7.on("progress", (currentSize) => {
2026-10-03 08:58:59 +00:00
if (currentSize.currentSize > closure_3) {
obj7.cancel();
const obj2 = { channelId: guildId.id, uploads, draftType: FirstThreadMessage.FirstThreadMessage, resetState: true };
const obj = obj7(baseMaxSize[10]);
obj.setUploads(obj2);
const obj3 = { file: currentSize, maxSize: tmp, baseMaxSize, guildId: guildId.getGuildId(), analyticsLocations };
const tmp10 = obj7(baseMaxSize[15]);
tmp10(obj3);
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
});
2026-10-03 08:58:59 +00:00
await obj7.uploadFiles(guildId);
files = value;
let obj = { uploaderFile: obj7._file, files };
return obj;
2026-07-29 08:29:29 +00:00
})();
});
2026-07-20 16:05:17 +00:00
const items = [analyticsLocations, parentChannel];
2026-10-03 08:58:59 +00:00
const callback = useCallback(function() {
return closure_0(...arguments);
2026-07-29 08:29:29 +00:00
}, items);
2026-10-08 09:57:35 +00:00
const tmp2 = parentChannel(9199);
2026-10-03 08:58:59 +00:00
let obj = { parentChannel, name: str, appliedTags, analyticsLocations, onThreadCreated, upload: callback };
str = undefined;
const useCreateForumPostCommon = tmp2.useCreateForumPostCommon;
2026-07-29 08:29:29 +00:00
if (threadSettings != null) {
str = threadSettings.name;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return useCreateForumPostCommon(obj);
});
const result = size.fileFinishedImporting("modules/threads/native/useCreateThread.tsx");
export default tmp2;
export const useCreateForumPost = tmp3;