decord/source/utils/native/InstantInviteUtils.tsx
2026-07-25 08:10:48 +00:00

161 lines
5.9 KiB
TypeScript

// Module ID: 8289
// Function ID: 66596
// Name: makeOption
// Dependencies: [1348, 1908, 3759, 653, 1212, 8165, 566, 2]
// Exports: getInviteChannelId, shouldRenderInvite, useShouldShowInviteInActionBar
// Module 8289 (makeOption)
import closure_2 from "_isNativeReflectConstruct";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
import closure_6 from "_isNativeReflectConstruct";
import { Permissions } from "ME";
import option from "_isNativeReflectConstruct";
import option1 from "module_604800";
import option2 from "module_1209600";
import option3 from "module_2592000";
import option4 from "module_5184000";
import option5 from "module_86400";
import option6 from "module_43200";
import option7 from "module_21600";
import option8 from "module_28800";
import option9 from "module_3600";
import option10 from "module_1800";
import option11 from "_isNativeReflectConstruct";
import option12 from "_isNativeReflectConstruct";
import option13 from "canViewInviteModal";
import option14 from "module_10";
import option15 from "module_25";
import option16 from "module_50";
import option17 from "module_100";
let closure_3;
let closure_4;
const require = arg1;
function makeOption(value, arg1, arg2) {
let tmp = arg2;
let closure_0 = arg1;
if (arg2 === undefined) {
tmp = arg1;
}
const dependencyMap = tmp;
const obj = { value };
Object.defineProperty(obj, "label", { get: () => callback(), set: undefined });
Object.defineProperty(obj, "descriptiveLabel", { get: () => tmp(), set: undefined });
return obj;
}
({ GUILD_SELECTABLE_CHANNELS_KEY: closure_3, GUILD_VOCAL_CHANNELS_KEY: closure_4 } = _isNativeReflectConstruct);
let items = [option, option4, option3, option2, option1, option5, option6, option7, option9, option10];
let items1 = [option11, option12, option13, option14, option15, option16, option17];
let result = require("_isNativeReflectConstruct").fileFinishedImporting("utils/native/InstantInviteUtils.tsx");
export const INVITE_OPTIONS_FOREVER = option;
export const INVITE_OPTIONS_7_DAYS = option1;
export const INVITE_OPTIONS_14_DAYS = option2;
export const INVITE_OPTIONS_30_DAYS = option3;
export const INVITE_OPTIONS_60_DAYS = option4;
export const INVITE_OPTIONS_1_DAY = option5;
export const INVITE_OPTIONS_12_HOURS = option6;
export const INVITE_OPTIONS_6_HOURS = option7;
export const INVITE_OPTIONS_8_HOURS = option8;
export const INVITE_OPTIONS_1_HOUR = option9;
export const INVITE_OPTIONS_30_MINUTES = option10;
export const MAX_AGE_OPTIONS = items;
export const INVITE_OPTIONS_UNLIMITED = option11;
export const INVITE_OPTIONS_ONCE = option12;
export const INVITE_OPTIONS_5_TIMES = option13;
export const INVITE_OPTIONS_10_TIMES = option14;
export const INVITE_OPTIONS_25_TIMES = option15;
export const INVITE_OPTIONS_50_TIMES = option16;
export const INVITE_OPTIONS_100_TIMES = option17;
export const MAX_USES_OPTIONS = items1;
export const getInviteChannelId = function getInviteChannelId(channelId, stateFromStores) {
if (null == stateFromStores) {
return null;
} else {
let id = null;
if (null != channelId) {
const obj = { channelId };
const result = closure_6.canWithPartialContext(Permissions.CREATE_INSTANT_INVITE, obj);
const combined = stateFromStores[closure_3].concat(stateFromStores[closure_4]);
const found = combined.find((channel) => outer1_6.can(outer1_7.CREATE_INSTANT_INVITE, channel.channel));
if (result) {
channel = channel.getChannel(channelId);
let parent_id = channelId;
if (null != channel) {
parent_id = channelId;
if (channel.isThread()) {
parent_id = channelId;
if (null != channel.parent_id) {
parent_id = channel.parent_id;
}
}
}
id = parent_id;
} else {
id = null;
if (null != found) {
id = found.channel.id;
}
}
const obj2 = stateFromStores[closure_3];
}
return id;
}
};
export const shouldRenderInvite = function shouldRenderInvite(channels, guild) {
let vanityURLCode;
if (null != guild) {
vanityURLCode = guild.vanityURLCode;
}
let tmp2 = null == vanityURLCode;
if (!tmp2) {
tmp2 = !require(8165) /* canViewInviteModal */.canViewInviteModal(closure_6, guild);
const obj = require(8165) /* canViewInviteModal */;
}
let tmp6 = !tmp2;
if (tmp2) {
let tmp7 = null != channels;
if (tmp7) {
let tmp9 = null != channels[closure_3].find((channel) => outer1_6.can(outer1_7.CREATE_INSTANT_INVITE, channel.channel));
if (!tmp9) {
tmp9 = null != channels[closure_4].find((channel) => outer1_6.can(outer1_7.CREATE_INSTANT_INVITE, channel.channel));
const arr2 = channels[closure_4];
}
tmp7 = tmp9;
const arr = channels[closure_3];
}
tmp6 = tmp7;
}
return tmp6;
};
export const useShouldShowInviteInActionBar = function useShouldShowInviteInActionBar(id) {
const _require = id;
const items = [closure_5];
const items1 = [id.id];
const stateFromStoresObject = _require(566).useStateFromStoresObject(items, () => outer1_5.getChannels(id.id), items1);
let vanityURLCode;
if (null != id) {
vanityURLCode = id.vanityURLCode;
}
let tmp3 = null == vanityURLCode;
if (!tmp3) {
tmp3 = !_require(8165).canViewInviteModal(closure_6, id);
const obj2 = _require(8165);
}
let tmp7 = !tmp3;
if (tmp3) {
let tmp8 = null == stateFromStoresObject;
if (!tmp8) {
let tmp10 = null != stateFromStoresObject[closure_3].find((channel) => outer1_6.can(outer1_7.CREATE_INSTANT_INVITE, channel.channel));
if (!tmp10) {
tmp10 = null != stateFromStoresObject[closure_4].find((channel) => outer1_6.can(outer1_7.CREATE_INSTANT_INVITE, channel.channel));
const arr4 = stateFromStoresObject[closure_4];
}
tmp8 = tmp10;
const arr3 = stateFromStoresObject[closure_3];
}
tmp7 = tmp8;
}
return tmp7;
};