decord/source/stores/GuildSubscriptionsStore.tsx

498 lines
15 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 6002
2026-07-27 11:26:19 +00:00
// Function ID: 53436
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-07-25 08:10:48 +00:00
// Dependencies: [6, 7, 15, 17, 18, 57, 4045, 3760, 4812, 1194, 6003, 5846, 1348, 4470, 1918, 1838, 4203, 3768, 1907, 3948, 653, 6004, 686, 22, 1841, 566, 2]
2026-07-23 10:11:24 +00:00
2026-07-25 08:10:48 +00:00
// Module 6002 (_isNativeReflectConstruct)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
import closure_7 from "_isNativeReflectConstruct";
import closure_8 from "_isNativeReflectConstruct";
import _slicedToArray from "_slicedToArray";
import closure_10 from "_isNativeReflectConstruct";
import closure_11 from "_isNativeReflectConstruct";
import closure_12 from "_isNativeReflectConstruct";
import closure_13 from "_isNativeReflectConstruct";
import { EVERYONE_CHANNEL_ID } from "_isNativeReflectConstruct";
import closure_15 from "_isNativeReflectConstruct";
import closure_16 from "_isNativeReflectConstruct";
import closure_17 from "_isNativeReflectConstruct";
import closure_18 from "_isNativeReflectConstruct";
import closure_19 from "_createForOfIteratorHelperLoose";
import closure_20 from "_isNativeReflectConstruct";
import closure_21 from "_isNativeReflectConstruct";
import closure_22 from "_isNativeReflectConstruct";
import closure_23 from "_isNativeReflectConstruct";
import ME from "ME";
import importDefaultResult from "validateGuildId";
2026-07-20 16:05:17 +00:00
let ChannelSections;
2026-07-23 10:11:24 +00:00
let closure_24;
const require = arg1;
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
let closure_0 = !valueOf.call(Reflect.construct(Boolean, [], () => {
}));
function _isNativeReflectConstruct() {
return closure_0;
}
const result = _isNativeReflectConstruct();
}
2026-07-23 10:11:24 +00:00
function _createForOfIteratorHelperLoose(iterable) {
let closure_0 = iterable;
iterable = "undefined" !== typeof Symbol;
if (iterable) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol;
2026-07-23 10:11:24 +00:00
iterable = iterable[Symbol.iterator];
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (!iterable) {
iterable = iterable[Symbol.iterator];
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (iterable) {
const iter = iterable.call(iterable);
2026-07-20 16:05:17 +00:00
const next = iter.next;
return next.bind(iter);
} else {
const _Array = Array;
2026-07-23 10:11:24 +00:00
let tmp = iterable;
if (!Array.isArray(iterable)) {
2026-07-20 16:05:17 +00:00
let tmp2;
2026-07-23 10:11:24 +00:00
if (iterable) {
if ("string" === typeof iterable) {
tmp2 = _arrayLikeToArray(iterable, undefined);
2026-07-20 16:05:17 +00:00
} else {
const toString = {}.toString;
2026-07-23 10:11:24 +00:00
const substr = toString.call(iterable).slice(8, -1);
2026-07-20 16:05:17 +00:00
let name = substr;
if (tmp3) {
2026-07-23 10:11:24 +00:00
name = iterable.constructor.name;
2026-07-20 16:05:17 +00:00
}
if ("Map" !== name) {
if ("Set" !== name) {
if ("Arguments" === name) {
2026-07-23 10:11:24 +00:00
let arr = _arrayLikeToArray(iterable, undefined);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/;
2026-07-20 16:05:17 +00:00
}
}
tmp2 = arr;
}
const _Array2 = Array;
2026-07-23 10:11:24 +00:00
arr = Array.from(iterable);
const callResult = toString.call(iterable);
tmp3 = "Object" === substr && iterable.constructor;
2026-07-20 16:05:17 +00:00
}
}
tmp = tmp2;
if (!tmp2) {
const _TypeError = TypeError;
const typeError = new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
throw typeError;
}
}
if (tmp) {
2026-07-23 10:11:24 +00:00
closure_0 = tmp;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c1 = 0;
2026-07-20 16:05:17 +00:00
return () => {
2026-07-23 10:11:24 +00:00
if (closure_1 >= length.length) {
2026-07-20 16:05:17 +00:00
let obj = { done: true };
} else {
obj = { done: false };
closure_1 = tmp3 + 1;
2026-07-23 10:11:24 +00:00
obj.value = length[+closure_1];
2026-07-20 16:05:17 +00:00
}
return obj;
};
}
}
function _arrayLikeToArray(arg0, arg1) {
let length;
if (tmp) {
length = arg0.length;
}
const ArrayResult = Array(length);
for (let num = 0; num < length; num = num + 1) {
ArrayResult[num] = arg0[num];
}
return ArrayResult;
}
function prune(arg0, arg1) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const importDefault = arg1;
let obj = {};
const item = importDefaultResult.forEach((arg0) => {
2026-07-23 10:11:24 +00:00
let tmp = arg0 === outer1_23.getGuildId();
2026-07-20 16:05:17 +00:00
if (!tmp) {
2026-07-23 10:11:24 +00:00
tmp = arg0 === outer1_20.getGuildId();
2026-07-20 16:05:17 +00:00
}
if (!tmp) {
2026-07-23 10:11:24 +00:00
const channel = outer1_16.getChannel(outer1_22.getChannelId());
2026-07-20 16:05:17 +00:00
let guildId;
if (null != channel) {
guildId = channel.getGuildId();
}
tmp = arg0 === guildId;
}
if (!tmp) {
2026-07-23 10:11:24 +00:00
let tmp9 = null != outer1_3;
2026-07-20 16:05:17 +00:00
if (tmp9) {
2026-07-23 10:11:24 +00:00
tmp9 = outer1_3.guildId === arg0;
2026-07-20 16:05:17 +00:00
}
tmp = tmp9;
}
if (!tmp) {
2026-07-25 08:10:48 +00:00
outer1_25.clearWithoutFlushing(arg0, closure_0);
2026-07-23 10:11:24 +00:00
if (closure_1) {
2026-07-25 08:10:48 +00:00
obj[arg0] = outer1_25.get(arg0);
2026-07-20 16:05:17 +00:00
}
}
});
if (!obj2.isEmpty(obj)) {
obj = { type: "GUILD_SUBSCRIPTIONS_FLUSH" };
obj.subscriptions = obj;
2026-07-23 10:11:24 +00:00
importDefault(obj[22]).dispatch(obj);
const obj3 = importDefault(obj[22]);
2026-07-20 16:05:17 +00:00
}
}
function subscribe(guildId, channelId) {
let tmp = guildId;
if (obj.isFavoritesGuildId(guildId)) {
tmp = guildId;
if (null != channelId) {
const channel = store.getChannel(channelId);
guildId = undefined;
if (null != channel) {
guildId = channel.getGuildId();
}
tmp = guildId;
if (null != guildId) {
tmp = guildId;
}
}
}
importDefaultResult.subscribeToGuild(tmp);
return false;
}
function handleConnectionOpenOrResumed(type) {
2026-07-23 10:11:24 +00:00
let obj;
let set;
let dependencyMap;
2026-07-20 16:05:17 +00:00
if ("CONNECTION_OPEN" === type.type) {
prune(true, false);
}
const guildId = store3.getGuildId();
if (null != guildId) {
subscribe(guildId, store2.getChannelId(guildId));
}
2026-07-23 10:11:24 +00:00
obj = {};
set = new Set(closure_11.lurkingGuildIds());
dependencyMap = closure_11.mostRecentLurkedGuildId();
2026-07-20 16:05:17 +00:00
const item = importDefaultResult.forEach((guildId) => {
2026-07-23 10:11:24 +00:00
if (null == outer1_19.getGuild(guildId)) {
2026-07-25 08:10:48 +00:00
outer1_25.clearWithoutFlushing(guildId, true);
2026-07-20 16:05:17 +00:00
} else {
let hasItem = set.has(guildId);
if (hasItem) {
hasItem = guildId !== closure_2;
}
if (!hasItem) {
2026-07-25 08:10:48 +00:00
obj[guildId] = outer1_25.get(guildId);
2026-07-20 16:05:17 +00:00
}
}
});
if (!obj2.isEmpty(obj)) {
obj = { type: "GUILD_SUBSCRIPTIONS_FLUSH" };
obj.subscriptions = obj;
2026-07-23 10:11:24 +00:00
set(686).dispatch(obj);
const obj3 = set(686);
2026-07-20 16:05:17 +00:00
}
}
function handleChannelSelect(guildId) {
guildId = guildId.guildId;
2026-07-23 10:11:24 +00:00
let flag = !closure_17.isUnavailable(guildId);
2026-07-20 16:05:17 +00:00
if (flag) {
subscribe(guildId, guildId.channelId);
flag = false;
}
return flag;
}
function resubscribe() {
const guildId = store3.getGuildId();
subscribe(guildId, store2.getChannelId());
return false;
}
function handleSpotifyUpdate() {
2026-07-23 10:11:24 +00:00
syncingWith = syncingWith.getSyncingWith();
2026-07-20 16:05:17 +00:00
if (null == syncingWith) {
if (null != obj) {
importDefaultResult.unsubscribeUser(obj.guildId, obj.userId);
2026-07-23 10:11:24 +00:00
obj = null;
2026-07-20 16:05:17 +00:00
}
} else {
const userId = syncingWith.userId;
if (null != obj) {
if (obj.userId === userId) {
return false;
}
}
if (friend.isFriend(userId)) {
return false;
} else {
const memberOfResult = closure_18.memberOf(userId);
if (0 === memberOfResult.length) {
return false;
} else {
const first = callback3(memberOfResult, 1)[0];
obj = { guildId: first, userId };
importDefaultResult.subscribeUser(first, userId);
}
}
}
return false;
}
2026-07-25 08:10:48 +00:00
({ ChannelSections, ChannelTypes: closure_24 } = ME);
2026-07-20 16:05:17 +00:00
importDefaultResult = new importDefaultResult((subscriptions) => {
for (const key10004 in arg0) {
2026-07-23 10:11:24 +00:00
let tmp6 = key10004;
let tmp7 = guild;
let isUnavailableResult = null != guild.getGuild(key10004);
2026-07-20 16:05:17 +00:00
if (!isUnavailableResult) {
2026-07-23 10:11:24 +00:00
let tmp3 = closure_17;
2026-07-20 16:05:17 +00:00
isUnavailableResult = closure_17.isUnavailable(key10004);
}
if (isUnavailableResult) {
continue;
} else {
2026-07-23 10:11:24 +00:00
delete tmp[tmp2];
continue;
2026-07-20 16:05:17 +00:00
}
continue;
}
2026-07-23 10:11:24 +00:00
let obj = importDefault(686);
2026-07-20 16:05:17 +00:00
obj = { type: "GUILD_SUBSCRIPTIONS_FLUSH", subscriptions };
obj.dispatch(obj);
});
2026-07-23 10:11:24 +00:00
let tmp5 = ((Store) => {
2026-07-20 16:05:17 +00:00
class GuildSubscriptionsStore {
constructor() {
self = this;
2026-07-23 10:11:24 +00:00
tmp = outer1_4(this, GuildSubscriptionsStore);
obj = outer1_7(GuildSubscriptionsStore);
tmp2 = outer1_6;
2026-07-25 08:10:48 +00:00
if (outer1_26()) {
2026-07-20 16:05:17 +00:00
tmp6 = globalThis;
_Reflect = Reflect;
2026-07-23 10:11:24 +00:00
tmp7 = outer1_7;
2026-07-20 16:05:17 +00:00
tmp8 = arguments;
2026-07-23 10:11:24 +00:00
constructResult = Reflect.construct(obj, arguments, outer1_7(self).constructor);
2026-07-20 16:05:17 +00:00
} else {
tmp3 = arguments;
tmp4 = arguments;
constructResult = obj(...arguments);
}
return tmp2(self, constructResult);
}
}
callback2(GuildSubscriptionsStore, Store);
let obj = {
key: "initialize",
value() {
2026-07-23 10:11:24 +00:00
this.waitFor(outer1_13, outer1_15, outer1_16, outer1_10, outer1_17, outer1_18, outer1_19, outer1_11, outer1_20, outer1_21, outer1_22, outer1_23, outer1_12);
const items = [outer1_12];
2026-07-25 08:10:48 +00:00
this.syncWith(items, outer1_32);
2026-07-23 10:11:24 +00:00
const items1 = [outer1_15];
2026-07-25 08:10:48 +00:00
this.syncWith(items1, outer1_31);
2026-07-20 16:05:17 +00:00
}
};
2026-07-23 10:11:24 +00:00
let items = [obj, , , , , ];
2026-07-20 16:05:17 +00:00
obj = {
key: "getSubscribedThreadIds",
value() {
2026-07-25 08:10:48 +00:00
return outer1_25.getSubscribedThreadIds();
2026-07-20 16:05:17 +00:00
}
};
items[1] = obj;
obj = {
key: "isSubscribedToThreads",
value(arg0) {
2026-07-25 08:10:48 +00:00
return outer1_25.isSubscribedToThreads(arg0);
2026-07-20 16:05:17 +00:00
}
};
items[2] = obj;
items[3] = {
key: "isSubscribedToAnyMember",
value(arg0) {
2026-07-25 08:10:48 +00:00
return outer1_25.isSubscribedToAnyMember(arg0);
2026-07-20 16:05:17 +00:00
}
};
items[4] = {
key: "isSubscribedToMemberUpdates",
value(arg0) {
2026-07-25 08:10:48 +00:00
return outer1_25.isSubscribedToMemberUpdates(arg0);
2026-07-20 16:05:17 +00:00
}
};
items[5] = {
key: "isSubscribedToAnyGuildChannel",
value(arg0) {
2026-07-25 08:10:48 +00:00
const channels = outer1_25.get(arg0).channels;
2026-07-20 16:05:17 +00:00
let tmp = null != channels;
if (tmp) {
const _Object = Object;
tmp = Object.keys(channels).length > 0;
}
return tmp;
}
};
return callback(GuildSubscriptionsStore, items);
2026-07-23 10:11:24 +00:00
})(require("initialize").Store);
2026-07-20 16:05:17 +00:00
tmp5.displayName = "GuildSubscriptionsStore";
2026-07-23 10:11:24 +00:00
tmp5 = new tmp5(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: handleConnectionOpenOrResumed,
CONNECTION_RESUMED: handleConnectionOpenOrResumed,
CONNECTION_CLOSED: function handleConnectionClosed() {
prune(false, false);
},
IDLE: function handleIdle(idle) {
if (idle.idle) {
prune(false, true);
} else {
return false;
}
},
LOGOUT: function handleLogout() {
importDefaultResult.reset();
},
VOICE_CHANNEL_SELECT: handleChannelSelect,
CHANNEL_SELECT: handleChannelSelect,
GUILD_CREATE: function handleGuildCreate(guild) {
if (guild.guild.id === store3.getGuildId()) {
resubscribe();
}
},
GUILD_DELETE: function handleGuildDelete(guild) {
importDefaultResult.clearWithoutFlushing(guild.guild.id, true);
},
GUILD_SUBSCRIPTIONS_MEMBERS_ADD: function handleMembersAdd(arg0) {
2026-07-23 10:11:24 +00:00
let require;
2026-07-20 16:05:17 +00:00
let userIds;
2026-07-23 10:11:24 +00:00
({ guildId: require, userIds } = arg0);
2026-07-20 16:05:17 +00:00
const item = userIds.forEach((arg0) => {
2026-07-23 10:11:24 +00:00
if (arg0 !== outer1_13.getId()) {
2026-07-25 08:10:48 +00:00
outer1_25.subscribeUser(closure_0, arg0);
2026-07-20 16:05:17 +00:00
}
});
return false;
},
GUILD_SUBSCRIPTIONS_MEMBERS_REMOVE: function handleMembersRemove(arg0) {
2026-07-23 10:11:24 +00:00
let require;
2026-07-20 16:05:17 +00:00
let userIds;
2026-07-23 10:11:24 +00:00
({ guildId: require, userIds } = arg0);
2026-07-20 16:05:17 +00:00
const item = userIds.forEach((arg0) => {
2026-07-25 08:10:48 +00:00
outer1_25.unsubscribeUser(closure_0, arg0);
2026-07-20 16:05:17 +00:00
});
return false;
},
GUILD_SUBSCRIPTIONS_ADD_MEMBER_UPDATES: function handleAddMemberUpdatesGuildSubscription(guildId) {
const result = importDefaultResult.subscribeToMemberUpdates(guildId.guildId);
},
GUILD_SUBSCRIPTIONS_REMOVE_MEMBER_UPDATES: function handleRemoveMemberUpdatesGuildSubscription(guildId) {
const result = importDefaultResult.unsubscribeFromMemberUpdates(guildId.guildId);
},
GUILD_SUBSCRIPTIONS_CHANNEL: function handleChannel(arg0) {
let channelId;
let guildId;
let ranges;
({ guildId, channelId, ranges } = arg0);
if (channelId === EVERYONE_CHANNEL_ID) {
let flag = importDefaultResult.subscribeChannel(guildId, channelId, ranges);
} else {
let parent_id = store.getChannel(channelId);
flag = false;
if (null != parent_id) {
guildId = parent_id.getGuildId();
2026-07-25 08:10:48 +00:00
let isFavoritesGuildIdResult = guildId !== guildId;
if (isFavoritesGuildIdResult) {
isFavoritesGuildIdResult = require(1841) /* isFavoritesGuildId */.isFavoritesGuildId(guildId);
const obj = require(1841) /* isFavoritesGuildId */;
2026-07-20 16:05:17 +00:00
}
2026-07-25 08:10:48 +00:00
if (isFavoritesGuildIdResult) {
2026-07-20 16:05:17 +00:00
importDefaultResult.subscribeToGuild(guildId);
}
if (null != parent_id) {
if (parent_id.isThread()) {
if (parent_id.type === constants.ANNOUNCEMENT_THREAD) {
parent_id = parent_id.parent_id;
let subscribeChannelResult = importDefaultResult.subscribeChannel(guildId, parent_id, ranges);
} else {
2026-07-25 08:10:48 +00:00
const tmp9 = !parent_id.isActiveThread();
subscribeChannelResult = !tmp9;
if (!tmp9) {
2026-07-20 16:05:17 +00:00
subscribeChannelResult = importDefaultResult.subscribeThreadMemberList(guildId, channelId, store2.getChannelId());
}
}
}
}
flag = importDefaultResult.subscribeChannel(guildId, channelId, ranges);
}
}
return flag;
},
GUILD_SUBSCRIPTIONS: function handleGuild(guildId) {
return importDefaultResult.subscribeToGuild(guildId.guildId);
},
CHANNEL_PRELOAD: function handleChannelPreload(guildId) {
subscribe(guildId.guildId, guildId.channelId);
return false;
},
2026-07-21 06:55:02 +00:00
OVERLAY_TEXT_CHAT_SELECT_CHANNEL: function handleOverlayTextChatSelectChannel(guildId) {
subscribe(guildId.guildId, guildId.channelId);
return false;
},
2026-07-20 16:05:17 +00:00
INBOX_OPEN: function handleInboxOpen(guildIds) {
let iter2;
const tmp = _createForOfIteratorHelperLoose(guildIds.guildIds);
let iter = tmp();
if (!iter.done) {
do {
let value = iter.value;
if (null != value) {
2026-07-23 10:11:24 +00:00
let tmp2 = importDefaultResult;
let subscribeToGuildResult = importDefaultResult.subscribeToGuild(value);
2026-07-20 16:05:17 +00:00
}
iter2 = tmp();
iter = iter2;
} while (!iter2.done);
}
return false;
},
THREAD_UPDATE: function handleThreadUpdate(channel) {
let guild_id;
let id;
channel = channel.channel;
if (channel.isArchivedThread()) {
let result = importDefaultResult.unsubscribeThreadMemberList(channel.guild_id, channel.id);
} else {
let tmp = !channel.isActiveThread();
if (!tmp) {
tmp = store2.getChannelId() !== channel.id;
}
result = !tmp;
if (!tmp) {
({ guild_id, id } = channel);
const result1 = importDefaultResult.subscribeThreadMemberList(guild_id, id, store2.getChannelId());
}
}
return result;
},
THREAD_DELETE: function handleThreadDelete(channel) {
channel = channel.channel;
return importDefaultResult.unsubscribeThreadMemberList(channel.guild_id, channel.id);
},
THREAD_LIST_SYNC: resubscribe
});
2026-07-23 10:11:24 +00:00
let result = require("_possibleConstructorReturn").fileFinishedImporting("stores/GuildSubscriptionsStore.tsx");
2026-07-20 16:05:17 +00:00
export default tmp5;