2026-09-16 07:03:15 +00:00
|
|
|
// Module ID: 11826
|
|
|
|
|
// Function ID: 11827
|
2026-09-10 05:38:07 +00:00
|
|
|
// Name: ForwardDestinationUtils
|
2026-09-16 07:03:15 +00:00
|
|
|
// Dependencies: [19, 5588, 1962, 1958, 4276, 4286, 1372, 1074, 11132, 1370, 504, 1095, 4977, 1895, 4849, 1115, 4975, 7796, 4482, 4791, 2]
|
2026-07-29 08:29:29 +00:00
|
|
|
// Exports: getDestinationIsUnavailable, isRatelimitedInChannel, useDestinationNamesWithSlowmode, useSelectedDestinationChannel, useSelectedDestinationNames
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-09-16 07:03:15 +00:00
|
|
|
// Module 11826 (ForwardDestinationUtils)
|
2026-09-15 14:23:42 +00:00
|
|
|
import ChannelTypes from "ChannelTypes" /* 1095 */;
|
|
|
|
|
import GlobalUtils from "GlobalUtils" /* 1370 */;
|
2026-09-16 07:03:15 +00:00
|
|
|
import StickersUtils from "StickersUtils" /* 4977 */;
|
|
|
|
|
import SlowmodeUtils from "SlowmodeUtils" /* 7796 */;
|
2026-09-10 05:38:07 +00:00
|
|
|
import noop from "module_19" /* 19 */;
|
2026-09-16 07:03:15 +00:00
|
|
|
import StickersStore from "StickersStore" /* 5588 */;
|
2026-09-15 14:23:42 +00:00
|
|
|
import ChannelStore from "ChannelStore" /* 1958 */;
|
2026-09-16 07:03:15 +00:00
|
|
|
import PermissionStore from "PermissionStore" /* 4276 */;
|
|
|
|
|
import RelationshipStore from "RelationshipStore" /* 4286 */;
|
2026-09-15 14:23:42 +00:00
|
|
|
import UserStore from "UserStore" /* 1372 */;
|
2026-07-23 10:11:24 +00:00
|
|
|
|
2026-09-10 05:38:07 +00:00
|
|
|
const require = globalThis.__r;
|
|
|
|
|
|
|
|
|
|
require = fn;
|
2026-09-15 14:23:42 +00:00
|
|
|
const ChannelRecord = fn(1962);
|
2026-09-10 05:38:07 +00:00
|
|
|
({ ChannelRecordBase: hasOwnProperty, isGuildChannelType: metroRequire, createChannelRecord: closure_7 } = ChannelRecord);
|
|
|
|
|
const Constants = fn(1074);
|
|
|
|
|
({ MessageFlags: closure_12, Permissions: map1 } = Constants);
|
|
|
|
|
const size = fn(2);
|
|
|
|
|
const result = size.fileFinishedImporting("modules/forwarding/ForwardDestinationUtils.tsx");
|
2026-07-20 16:05:17 +00:00
|
|
|
|
|
|
|
|
export const useSelectedDestinationChannel = function useSelectedDestinationChannel(selectedDestinations) {
|
2026-09-16 07:03:15 +00:00
|
|
|
const mapped = selectedDestinations.map(found(11132).getChannelIdFromDestinationId);
|
2026-09-15 14:23:42 +00:00
|
|
|
found = mapped.find(found(1370).isNotNullish);
|
2026-09-10 05:38:07 +00:00
|
|
|
const items = [ChannelStore];
|
2026-07-20 16:05:17 +00:00
|
|
|
const items1 = [found];
|
2026-09-10 05:38:07 +00:00
|
|
|
const stateFromStores = found(504).useStateFromStores(items, () => ChannelStore.getChannel(found), items1);
|
2026-07-20 16:05:17 +00:00
|
|
|
const items2 = [stateFromStores];
|
2026-09-10 05:38:07 +00:00
|
|
|
return noop.useMemo(() => {
|
2026-07-29 08:29:29 +00:00
|
|
|
let tmp = stateFromStores;
|
|
|
|
|
if (stateFromStores == null) {
|
2026-09-10 05:38:07 +00:00
|
|
|
const obj = { id: "1", type: ChannelTypes.ChannelTypes.DM };
|
|
|
|
|
tmp = React5(obj);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
return tmp;
|
2026-07-20 16:05:17 +00:00
|
|
|
}, items2);
|
|
|
|
|
};
|
2026-09-10 05:38:07 +00:00
|
|
|
export const getDestinationIsUnavailable = function getDestinationIsUnavailable(components, channel, type, fn) {
|
|
|
|
|
_require = type;
|
|
|
|
|
if (null != fn) {
|
|
|
|
|
const tmp2 = fn(type);
|
2026-07-20 16:05:17 +00:00
|
|
|
if (null != tmp2) {
|
|
|
|
|
return tmp2;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
if (null != components) {
|
|
|
|
|
let tmp5 = components.components.length > 0;
|
|
|
|
|
if (tmp5) {
|
2026-09-10 05:38:07 +00:00
|
|
|
tmp5 = components.components[0].type === require("Server").ComponentType.CHECKPOINT_CARD;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
let tmp6 = components.messageSnapshots.length > 0;
|
|
|
|
|
if (tmp6) {
|
|
|
|
|
let message = components.messageSnapshots[0].message;
|
|
|
|
|
let tmp7 = message.components.length > 0;
|
|
|
|
|
if (tmp7) {
|
2026-09-10 05:38:07 +00:00
|
|
|
tmp7 = message.components[0].type === require("Server").ComponentType.CHECKPOINT_CARD;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
tmp6 = tmp7;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
if (null != channel) {
|
|
|
|
|
if (obj.isChannelOrGuildNSFW(channel)) {
|
2026-07-20 16:05:17 +00:00
|
|
|
if (tmp) {
|
2026-09-16 07:03:15 +00:00
|
|
|
const tmp11Result = tmp11(4849);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-09-10 05:38:07 +00:00
|
|
|
const obj2 = { label: null, lineClamp: 2 };
|
2026-09-15 14:23:42 +00:00
|
|
|
const intl = tmp11(1115).intl;
|
|
|
|
|
obj2.label = intl.string(tmp11(1115).t.KgPx1D);
|
2026-09-10 05:38:07 +00:00
|
|
|
return obj2;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
if (tmp) {
|
2026-09-10 05:38:07 +00:00
|
|
|
if (closure_6(type.type)) {
|
2026-07-29 08:29:29 +00:00
|
|
|
if (components.attachments.length > 0) {
|
2026-09-10 05:38:07 +00:00
|
|
|
if (!PermissionStore.can(constants2.ATTACH_FILES, type)) {
|
|
|
|
|
const obj3 = { label: null };
|
2026-09-15 14:23:42 +00:00
|
|
|
const intl2 = tmp11(1115).intl;
|
|
|
|
|
obj3.label = intl2.string(tmp11(1115).t.P7yvbm);
|
2026-09-10 05:38:07 +00:00
|
|
|
return obj3;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2026-07-29 08:29:29 +00:00
|
|
|
const messageSnapshots = components.messageSnapshots;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
if (components.embeds.length > 0) {
|
2026-09-10 05:38:07 +00:00
|
|
|
if (!tmp11Result5.canEmbedLinks(type, PermissionStore)) {
|
|
|
|
|
if (!tmp11Result6.shouldStripEmbeds(components)) {
|
|
|
|
|
const obj4 = { label: null };
|
2026-09-15 14:23:42 +00:00
|
|
|
const intl3 = tmp11(1115).intl;
|
|
|
|
|
obj4.label = intl3.string(tmp11(1115).t.Wr4RIX);
|
2026-09-10 05:38:07 +00:00
|
|
|
return obj4;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-09-16 07:03:15 +00:00
|
|
|
tmp11Result6 = tmp11(4975);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-09-16 07:03:15 +00:00
|
|
|
tmp11Result5 = tmp11(4975);
|
2026-07-20 16:05:17 +00:00
|
|
|
} else {
|
2026-07-29 08:29:29 +00:00
|
|
|
const messageSnapshots2 = components.messageSnapshots;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
if (tmp5) {
|
2026-09-10 05:38:07 +00:00
|
|
|
if (!tmp11Result7.canEmbedLinks(type, PermissionStore)) {
|
|
|
|
|
const obj5 = { label: null };
|
2026-09-15 14:23:42 +00:00
|
|
|
const intl4 = tmp11(1115).intl;
|
|
|
|
|
obj5.label = intl4.string(tmp11(1115).t.Wr4RIX);
|
2026-09-10 05:38:07 +00:00
|
|
|
return obj5;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-09-16 07:03:15 +00:00
|
|
|
tmp11Result7 = tmp11(4975);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
const items = [];
|
2026-07-29 08:29:29 +00:00
|
|
|
const messageSnapshots3 = components.messageSnapshots;
|
2026-09-16 07:03:15 +00:00
|
|
|
const tmp11Result8 = tmp11(4977);
|
|
|
|
|
HermesBuiltin.arraySpread(messageSnapshots3.flatMap((message) => type(dependencyMap[12]).getMessageStickers(message.message)), HermesBuiltin.arraySpread(tmp11(4977).getMessageStickers(components), 0));
|
2026-07-20 16:05:17 +00:00
|
|
|
if (items.length > 0) {
|
2026-09-10 05:38:07 +00:00
|
|
|
if (!PermissionStore.can(constants2.USE_EXTERNAL_STICKERS, type)) {
|
2026-07-20 16:05:17 +00:00
|
|
|
if (items.some((id) => {
|
2026-09-10 05:38:07 +00:00
|
|
|
const stickerById = StickersStore.getStickerById(id.id);
|
2026-07-20 16:05:17 +00:00
|
|
|
let isGuildStickerResult = null != stickerById;
|
|
|
|
|
if (isGuildStickerResult) {
|
2026-09-10 05:38:07 +00:00
|
|
|
isGuildStickerResult = StickersUtils.isGuildSticker(stickerById);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
if (isGuildStickerResult) {
|
2026-07-23 10:11:24 +00:00
|
|
|
isGuildStickerResult = stickerById.guild_id !== type.guild_id || undefined;
|
|
|
|
|
const tmp6 = stickerById.guild_id !== type.guild_id || undefined;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
return isGuildStickerResult;
|
|
|
|
|
})) {
|
2026-09-10 05:38:07 +00:00
|
|
|
const obj6 = { label: null };
|
2026-09-15 14:23:42 +00:00
|
|
|
const intl5 = tmp11(1115).intl;
|
|
|
|
|
obj6.label = intl5.string(tmp11(1115).t["0Yyrua"]);
|
2026-09-10 05:38:07 +00:00
|
|
|
return obj6;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
if (components.hasFlag(constants.IS_VOICE_MESSAGE)) {
|
2026-09-10 05:38:07 +00:00
|
|
|
if (!PermissionStore.can(constants2.SEND_VOICE_MESSAGES, type)) {
|
|
|
|
|
const obj7 = { label: null };
|
2026-09-15 14:23:42 +00:00
|
|
|
const intl6 = tmp11(1115).intl;
|
|
|
|
|
obj7.label = intl6.string(tmp11(1115).t.quj4DY);
|
2026-09-10 05:38:07 +00:00
|
|
|
return obj7;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2026-07-29 08:29:29 +00:00
|
|
|
const messageSnapshots4 = components.messageSnapshots;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-09-16 07:03:15 +00:00
|
|
|
const arraySpreadResult = HermesBuiltin.arraySpread(tmp11(4977).getMessageStickers(components), 0);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-09-10 05:38:07 +00:00
|
|
|
obj = require("AgeGateUtils");
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2026-09-10 05:38:07 +00:00
|
|
|
export const isRatelimitedInChannel = function isRatelimitedInChannel(rateLimitPerUser, can) {
|
|
|
|
|
let tmp = null != rateLimitPerUser.rateLimitPerUser;
|
2026-07-29 08:29:29 +00:00
|
|
|
if (tmp) {
|
2026-09-10 05:38:07 +00:00
|
|
|
tmp = rateLimitPerUser.rateLimitPerUser > 0;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
if (tmp) {
|
2026-09-10 05:38:07 +00:00
|
|
|
tmp = !SlowmodeUtils.canBypassSlowmodeHelper(rateLimitPerUser, can);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
};
|
2026-07-20 16:05:17 +00:00
|
|
|
export const useSelectedDestinationNames = function useSelectedDestinationNames(arg0) {
|
2026-09-10 05:38:07 +00:00
|
|
|
_require = arg0;
|
|
|
|
|
const items = [UserStore, ChannelStore, RelationshipStore];
|
2026-07-20 16:05:17 +00:00
|
|
|
const items1 = [arg0];
|
2026-09-10 05:38:07 +00:00
|
|
|
return require("initialize").useStateFromStoresArray(items, () => {
|
|
|
|
|
const mapped = closure_0.map((id) => {
|
2026-07-20 16:05:17 +00:00
|
|
|
id = id.id;
|
|
|
|
|
if ("user" === id.type) {
|
2026-07-29 08:29:29 +00:00
|
|
|
user = user.getUser(id);
|
2026-07-20 16:05:17 +00:00
|
|
|
let tmp13 = null;
|
|
|
|
|
if (null != user) {
|
2026-07-29 08:29:29 +00:00
|
|
|
nickname = nickname.getNickname(user.id);
|
|
|
|
|
if (nickname == null) {
|
2026-09-16 07:03:15 +00:00
|
|
|
nickname = closure_1_1(4482).getName(user);
|
|
|
|
|
const obj2 = closure_1_1(4482);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
tmp13 = nickname;
|
|
|
|
|
}
|
|
|
|
|
return tmp13;
|
|
|
|
|
} else {
|
2026-07-29 08:29:29 +00:00
|
|
|
channel = channel.getChannel(id);
|
2026-07-20 16:05:17 +00:00
|
|
|
let channelName = null;
|
|
|
|
|
if (null != channel) {
|
2026-09-16 07:03:15 +00:00
|
|
|
const obj = closure_1_0(4791);
|
2026-07-29 08:29:29 +00:00
|
|
|
channelName = obj.computeChannelName(channel, user, nickname, true);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
return channelName;
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-09-10 05:38:07 +00:00
|
|
|
return mapped.filter(GlobalUtils.isNotNullish);
|
2026-07-20 16:05:17 +00:00
|
|
|
}, items1);
|
|
|
|
|
};
|
|
|
|
|
export const useDestinationNamesWithSlowmode = function useDestinationNamesWithSlowmode(selectedDestinations) {
|
2026-09-10 05:38:07 +00:00
|
|
|
_require = selectedDestinations;
|
|
|
|
|
const items = [ChannelStore, PermissionStore];
|
2026-07-20 16:05:17 +00:00
|
|
|
const items1 = [selectedDestinations];
|
2026-09-10 05:38:07 +00:00
|
|
|
const stateFromStoresArray = require("initialize").useStateFromStoresArray(items, () => {
|
2026-07-23 10:11:24 +00:00
|
|
|
const mapped = selectedDestinations.map((type) => {
|
2026-09-10 05:38:07 +00:00
|
|
|
channel = null;
|
2026-07-20 16:05:17 +00:00
|
|
|
if ("channel" === type.type) {
|
2026-07-29 08:29:29 +00:00
|
|
|
channel = channel.getChannel(tmp);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
return channel;
|
|
|
|
|
});
|
2026-09-10 05:38:07 +00:00
|
|
|
const found = mapped.filter(GlobalUtils.isNotNullish);
|
2026-07-29 08:29:29 +00:00
|
|
|
return found.filter((rateLimitPerUser) => {
|
|
|
|
|
let tmp2 = null != rateLimitPerUser.rateLimitPerUser;
|
|
|
|
|
if (tmp2) {
|
|
|
|
|
tmp2 = rateLimitPerUser.rateLimitPerUser > 0;
|
|
|
|
|
}
|
|
|
|
|
if (tmp2) {
|
2026-09-10 05:38:07 +00:00
|
|
|
tmp2 = !selectedDestinations(dependencyMap[17]).canBypassSlowmodeHelper(rateLimitPerUser, closure_1_9);
|
|
|
|
|
const obj = selectedDestinations(dependencyMap[17]);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
return tmp2;
|
|
|
|
|
});
|
2026-07-20 16:05:17 +00:00
|
|
|
}, items1);
|
2026-09-10 05:38:07 +00:00
|
|
|
let obj = require("initialize");
|
|
|
|
|
const items2 = [UserStore, RelationshipStore];
|
2026-07-20 16:05:17 +00:00
|
|
|
const items3 = [stateFromStoresArray];
|
2026-09-10 05:38:07 +00:00
|
|
|
return require("initialize").useStateFromStoresArray(items2, () => stateFromStoresArray.map((item) => selectedDestinations(closure_1_2[19]).computeChannelName(item, closure_1_11, closure_1_10, true)), items3);
|
2026-07-20 16:05:17 +00:00
|
|
|
};
|