decord/alpha/source/modules/activities/ActivitiesInTextUtils.tsx

205 lines
6.1 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 8496
// Function ID: 8497
// Name: ActivitiesInTextUtils
2026-10-09 10:00:15 +00:00
// Dependencies: [2064, 4709, 1096, 1106, 558, 576, 504, 2]
2026-10-03 08:58:59 +00:00
// Exports: getIsAppLauncherEnabled, isActivitiesInTextEnabled
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 8496 (ActivitiesInTextUtils)
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1096 */;
import ChannelTypes from "ChannelTypes" /* 1106 */;
2026-10-09 10:00:15 +00:00
import ChannelStore from "ChannelStore" /* 2064 */;
import PermissionStore from "PermissionStore" /* 4709 */;
2026-10-03 08:58:59 +00:00
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
2026-10-03 08:58:59 +00:00
let _require;
2026-07-20 16:05:17 +00:00
function isActivityInTextSupportedForChannel(channel) {
if (null == channel) {
return false;
} else {
channel = ChannelStore.getChannel(channel.parent_id);
2026-07-20 16:05:17 +00:00
let hasItem = null == channel;
if (!hasItem) {
2026-10-03 08:58:59 +00:00
let type1;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-10-03 08:58:59 +00:00
type1 = channel.type;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
hasItem = type1 === ChannelTypes.ChannelTypes.GUILD_CATEGORY;
2026-07-20 16:05:17 +00:00
}
if (hasItem) {
2026-10-03 08:58:59 +00:00
const type = channel.type;
const items = [ChannelTypes.ChannelTypes.GUILD_TEXT, ChannelTypes.ChannelTypes.GUILD_VOICE, ChannelTypes.ChannelTypes.GROUP_DM, ChannelTypes.ChannelTypes.DM, ChannelTypes.ChannelTypes.GUILD_SPACE];
2026-10-03 08:58:59 +00:00
hasItem = items.includes(type);
2026-07-20 16:05:17 +00:00
}
return hasItem;
}
}
2026-10-03 08:58:59 +00:00
const Permissions = Constants.Permissions;
let ReactCompilerGating = ReactCompilerGating_mod;
2026-10-08 09:57:35 +00:00
let tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useIsActivitiesInTextEnabled(arg0) {
2026-10-03 08:58:59 +00:00
let closure_0;
let first;
let tmp7;
_require = arg0;
let obj = require("react");
const cResult = obj.c(3);
const tmp = _require;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [ChannelStore, PermissionStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] !== arg0) {
const fn = function u() {
const channel = ChannelStore.getChannel(closure_0);
let flag = false;
const obj = PermissionStore;
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
if (isActivityInTextSupportedForChannel(channel)) {
flag = true;
if (null != channel.guild_id) {
flag = true;
if (!obj.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
flag = false;
}
}
2026-07-20 16:05:17 +00:00
}
}
}
2026-10-03 08:58:59 +00:00
return flag;
};
cResult[1] = arg0;
cResult[2] = fn;
tmp7 = fn;
} else {
tmp7 = cResult[2];
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const tmpResult = tmp(504);
return tmpResult.useStateFromStores(first, tmp7);
2026-10-08 09:57:35 +00:00
}) : (function useIsActivitiesInTextEnabled(arg0) {
2026-10-03 08:58:59 +00:00
let closure_0;
_require = arg0;
let obj = require("get initialized");
const items = [ChannelStore, PermissionStore];
2026-10-03 08:58:59 +00:00
return obj.useStateFromStores(items, () => {
const channel = ChannelStore.getChannel(closure_0);
2026-07-29 08:29:29 +00:00
let flag = false;
2026-10-03 08:58:59 +00:00
const obj = PermissionStore;
2026-07-29 08:29:29 +00:00
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
if (isActivityInTextSupportedForChannel(channel)) {
2026-07-29 08:29:29 +00:00
flag = true;
if (null != channel.guild_id) {
flag = true;
2026-10-03 08:58:59 +00:00
if (!obj.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
2026-07-29 08:29:29 +00:00
flag = false;
}
}
}
}
}
return flag;
});
2026-10-03 08:58:59 +00:00
});
ReactCompilerGating = ReactCompilerGating_mod;
function getIsAppLauncherEnabled(channel) {
2026-07-20 16:05:17 +00:00
let guild_id;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
guild_id = channel.guild_id;
}
2026-10-03 08:58:59 +00:00
const tmp2 = null != guild_id || isActivityInTextSupportedForChannel(channel);
2026-07-20 16:05:17 +00:00
return tmp2;
2026-10-03 08:58:59 +00:00
}
2026-10-08 09:57:35 +00:00
const tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? (function useIsAppLauncherEnabled(arg0) {
2026-10-03 08:58:59 +00:00
let closure_0;
let first;
let tmp6;
_require = arg0;
let tmp2 = dependencyMap;
const obj = require("react");
const cResult = obj.c(3);
const tmp = _require;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [ChannelStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] !== arg0) {
const fn = function l() {
const channel = ChannelStore.getChannel(closure_0);
let tmp2 = null != channel;
if (tmp2) {
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
tmp2 = null != guild_id || isActivityInTextSupportedForChannel(channel);
const tmp4 = null != guild_id || isActivityInTextSupportedForChannel(channel);
}
return tmp2;
};
cResult[1] = arg0;
cResult[2] = fn;
tmp6 = fn;
} else {
tmp6 = cResult[2];
}
const tmpResult = tmp(504);
return tmpResult.useStateFromStores(first, tmp6);
2026-10-08 09:57:35 +00:00
}) : (function useIsAppLauncherEnabled(arg0) {
2026-10-03 08:58:59 +00:00
let closure_0;
_require = arg0;
const items = [ChannelStore];
2026-10-03 08:58:59 +00:00
const obj = require("get initialized");
return obj.useStateFromStores(items, () => {
const channel = ChannelStore.getChannel(closure_0);
2026-07-20 16:05:17 +00:00
let tmp2 = null != channel;
if (tmp2) {
2026-07-29 08:29:29 +00:00
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
2026-10-03 08:58:59 +00:00
tmp2 = null != guild_id || isActivityInTextSupportedForChannel(channel);
const tmp4 = null != guild_id || isActivityInTextSupportedForChannel(channel);
2026-07-20 16:05:17 +00:00
}
return tmp2;
});
2026-10-03 08:58:59 +00:00
});
const result = size.fileFinishedImporting("modules/activities/ActivitiesInTextUtils.tsx");
export { isActivityInTextSupportedForChannel };
export const isActivitiesInTextEnabled = function isActivitiesInTextEnabled(channel) {
let flag = false;
const obj = PermissionStore;
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
if (isActivityInTextSupportedForChannel(channel)) {
flag = true;
if (null != channel.guild_id) {
flag = true;
if (!obj.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
flag = false;
}
}
}
}
}
return flag;
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
export const useIsActivitiesInTextEnabled = tmp2;
export { getIsAppLauncherEnabled };
export const useIsAppLauncherEnabled = tmp3;