This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+135
View File
@@ -0,0 +1,135 @@
// Metro module 10471 (f10472).
import LocalActivityStore from "../LocalActivityStore";
import SelfPresenceStore from "../SelfPresenceStore";
import { ActivityActionStates, ActivityActionTypes } from "../../Constants";
import { Timeout } from "../../_bundle/Timeout";
import Dispatcher from "../../Dispatcher";
import Module589 from "../../_bundle/Module589";
function $mk84786($env) {
return () => {
const r4 = $env;
const r1 = $env.$parent;
return (0, r1[1])(r1[2][4]).dispatch({
type: "ACTIVITY_LAUNCH_FAIL",
applicationId: r4[0],
activityType: r4[1]
});
};
}
let handleActivityUpdate, c7018_8, c7018_9, c7018_12;
let env7018 = {};
const handleActivityStateChanged = function handleActivityStateChanged(a0, a1, { applicationId, remotePartyId }) {
if (a0 === ActivityActionStates.COMPLETE) {
const r60 = env7018[7][applicationId];
if (r60 != null) {
delete r60[a1];
}
if (c7018_8[applicationId] != null) {
c7018_8[applicationId].stop();
delete c7018_8[applicationId];
}
return void 0;
}
let r10 = env7018[7][applicationId];
if (r10 == null) {
r10 = {};
}
r10[a1] = {
state: a0,
remotePartyId
};
env7018[7][applicationId] = r10;
if (a0 === ActivityActionStates.FAILED) {
let env17984;
const r39 = env17984 = {
$parent: env7018
};
env17984[0] = applicationId;
env17984[1] = a1;
if (c7018_8[applicationId] != null) {
c7018_8[applicationId].stop();
}
const timeout2 = new Timeout();
timeout2.start(c7018_9, $mk84786(r39));
c7018_8[applicationId] = timeout2;
} else if (a0 === ActivityActionStates.LOADING) {
const r0 = remotePartyId != null ? 15000 : c7018_9;
let env17983;
const r20 = env17983 = {
$parent: env7018
};
env17983[0] = applicationId;
env17983[1] = a1;
if (c7018_8[applicationId] != null) {
c7018_8[applicationId].stop();
}
const timeout = new Timeout();
timeout.start(r0, $mk84786(r20));
c7018_8[applicationId] = timeout;
}
};
const handleActivityComplete = function handleActivityComplete(a0) {
return (a0.type !== "ACTIVITY_JOIN" || a0.parentApplicationId == null) && handleActivityStateChanged(ActivityActionStates.COMPLETE, ActivityActionTypes.JOIN, a0);
};
handleActivityUpdate = function handleActivityUpdate() {
let c17985_0;
const r13 = Object.entries(env7018[7]).map((item) => {
const [applicationId, r14] = item;
return {
applicationId,
remotePartyId: r14[ActivityActionTypes.JOIN]?.remotePartyId
};
}).filter((item) => item.remotePartyId != null);
c17985_0 = false;
r13.forEach(({ applicationId, remotePartyId }) => {
const applicationActivity = LocalActivityStore.getApplicationActivity(applicationId);
const applicationActivity2 = SelfPresenceStore.getApplicationActivity(applicationId);
if (!((applicationActivity == null ? void 0 : applicationActivity.party?.id) !== remotePartyId && (applicationActivity2 == null ? void 0 : applicationActivity2.party?.id) !== remotePartyId)) {
handleActivityStateChanged(ActivityActionStates.COMPLETE, ActivityActionTypes.JOIN, {
applicationId,
remotePartyId
});
c17985_0 = true;
}
});
return c17985_0;
};
env7018[7] = {};
c7018_8 = {};
c7018_9 = 120000;
class ActivityLauncherStore extends Module589.Store {
static displayName = "ActivityLauncherStore";
constructor() {
super(...arguments);
}
initialize() {
this.syncWith([LocalActivityStore, SelfPresenceStore], handleActivityUpdate);
}
getState(a0, a1) {
const r5 = env7018[7][a0];
return r5 == null ? void 0 : r5[a1]?.state;
}
getStates() {
return env7018[7];
}
}
c7018_12 = ActivityLauncherStore;
const r49 = new ActivityLauncherStore(Dispatcher, {
OVERLAY_INITIALIZE: function handleOverlayInitialize(a0) {
env7018[7] = {
...a0.activityLauncherStates
};
},
ACTIVITY_JOIN_LOADING: (a0) => handleActivityStateChanged(ActivityActionStates.LOADING, ActivityActionTypes.JOIN, a0),
ACTIVITY_JOIN_FAILED: (a0) => handleActivityStateChanged(ActivityActionStates.FAILED, ActivityActionTypes.JOIN, a0),
ACTIVITY_JOIN: handleActivityComplete,
EMBEDDED_ACTIVITY_CLOSE: handleActivityComplete,
ACTIVITY_LAUNCH_FAIL: function handleActivityLaunchFail({ applicationId, activityType }) {
const r6 = env7018[7][applicationId];
if (r6 == null) {
return false;
}
delete r6[activityType];
}
});
export default r49;
+118
View File
@@ -0,0 +1,118 @@
// Metro module 9596 (f9597).
import { GIFPickerResultTypes } from "../../Constants";
import { GIFType } from "../../_bundle/Module1341";
import { intl, t } from "../../intl/index.native";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c6338_3, IMAGE, analyticsID, query, query2, c6338_8, c6338_9, items, items2;
const getFormatFromUrl = function getFormatFromUrl(src) {
let VIDEO;
L5: {
L7: {
try {
const r5 = new URL(src).pathname.toLowerCase();
if (!r5.endsWith(".mp4") && !r5.endsWith(".webm")) {
break L7;
}
VIDEO = GIFType.VIDEO;
break L5;
} catch ($e) {}
}
return GIFType.IMAGE;
}
return VIDEO;
};
c6338_3 = "tinywebp";
IMAGE = GIFType.IMAGE;
analyticsID = null;
query = "";
query2 = "";
c6338_8 = [];
c6338_9 = [];
items = [];
items2 = [];
class GIFPickerViewStore extends Module589.Store {
static displayName = "GIFPickerViewStore";
getAnalyticsID() {
return analyticsID;
}
getQuery() {
return query;
}
getResultQuery() {
return query2;
}
getResultItems() {
return c6338_8;
}
getTrendingCategories() {
return c6338_9;
}
getSelectedFormat() {
return c6338_3;
}
getSuggestions() {
return items;
}
getTrendingSearchTerms() {
return items2;
}
}
const gIFPickerViewStore = new GIFPickerViewStore(Dispatcher, {
GIF_PICKER_INITIALIZE: function handleInitialize(a0) {
analyticsID = a0.analyticsID;
},
GIF_PICKER_QUERY: function handleQuery(a0) {
query = a0.query;
if (query === "") {
query2 = "";
c6338_8 = [];
items = [];
}
},
GIF_PICKER_QUERY_SUCCESS: function handleQuerySuccess(a0) {
if (a0.query != null && query === query2) {
return false;
}
if (a0.query != null) {
query2 = a0.query;
}
c6338_8 = a0.items.map((item) => ({
width: item.width,
height: item.height,
src: item.src,
gifSrc: item.gif_src,
url: item.url,
id: item.id,
format: IMAGE
}));
},
GIF_PICKER_QUERY_FAILURE: function handleQueryFailure({ query: query3 }) {
if (query3 == null) {
return false;
}
query2 = query3;
c6338_8 = [];
},
GIF_PICKER_TRENDING_FETCH_SUCCESS: function handleTrendingFetchSuccess(a0) {
const trendingCategories = a0.trendingCategories;
c6338_9 = [...a0.trendingGIFPreview != null ? [{
type: GIFPickerResultTypes.TRENDING_GIFS,
name: intl.string(t.H6zNFz),
src: a0.trendingGIFPreview.src,
format: getFormatFromUrl(a0.trendingGIFPreview.src)
}] : [], ...trendingCategories.map((trendingCategory) => ({
...trendingCategory,
src: trendingCategory.src,
type: GIFPickerResultTypes.TRENDING_CATEGORY,
format: getFormatFromUrl(trendingCategory.src)
}))];
},
GIF_PICKER_SUGGESTIONS_SUCCESS: function handleSuggestionsSuccess(a0) {
items = a0.items;
},
GIF_PICKER_TRENDING_SEARCH_TERMS_SUCCESS: function handleTrendingSearchSuccess(a0) {
items2 = a0.items;
}
});
export default gIFPickerViewStore;
+141
View File
@@ -0,0 +1,141 @@
// Metro module 5654 (f5655).
import MessageRequestStore from "../../modules/message_request/MessageRequestStore";
import SpamMessageRequestStore from "../../modules/message_request/SpamMessageRequestStore";
import { isPrivate } from "../../records/ChannelRecord";
import ChannelStore from "../ChannelStore";
import GuildStore from "../GuildStore";
import ReadStateStore from "../ReadStateStore";
import UserGuildSettingsStore from "../UserGuildSettingsStore";
import UserStore from "../UserStore";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { SecondaryIndexMap } from "../../_bundle/Module3813";
import Module3771 from "../../_bundle/Module3771";
import { FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID } from "../../modules/channel/FakePlaceholderPrivateChannel";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c3491_11, c3491_12, handleConnectionOpen, c3491_15, c3491_16, c3491_17, c3491_18;
const makeSortedChannel = function makeSortedChannel(channel, lastMessageId) {
if (lastMessageId === void 0) {
let r13 = ReadStateStore.lastMessageId(channel.id);
if (r13 == null) {
r13 = channel.lastMessageId;
}
if (r13 == null) {
r13 = channel.id;
}
const isMessageRequestTimestamp = channel.isMessageRequestTimestamp;
let r14 = r13;
if (isMessageRequestTimestamp != null) {
let r22 = SnowflakeUtils.fromTimestamp(Module3771(isMessageRequestTimestamp).valueOf());
if (SnowflakeUtils.compare(r13, r22) > 0) {
r22 = r13;
}
r14 = r22;
}
lastMessageId = r14;
}
return {
channelId: channel.id,
lastMessageId,
isFavorite: UserGuildSettingsStore.isMessagesFavorite(channel.id),
isRequest: MessageRequestStore.isMessageRequest(channel.id) || SpamMessageRequestStore.isSpam(channel.id)
};
};
handleConnectionOpen = function handleConnectionOpen() {
c3491_12.clear();
Object.values(ChannelStore.getMutablePrivateChannels()).forEach((item) => {
c3491_12.set(item.id, makeSortedChannel(item));
});
};
const handleCacheLoaded = function handleCacheLoaded() {
const mutablePrivateChannels = ChannelStore.getMutablePrivateChannels();
for (const key in mutablePrivateChannels) {
c3491_12.set(key, makeSortedChannel(mutablePrivateChannels[key]));
}
};
c3491_11 = {
DEFAULT: "DEFAULT",
FAVORITE: "FAVORITE"
};
c3491_12 = new SecondaryIndexMap(function indexBy({ isRequest, isFavorite }) {
return isRequest ? [] : [isFavorite ? c3491_11.FAVORITE : c3491_11.DEFAULT];
}, function sortBy(a0) {
return -SnowflakeUtils.extractTimestamp(a0.lastMessageId);
});
c3491_15 = [];
c3491_16 = [];
c3491_17 = [];
c3491_18 = () => {};
class PrivateChannelSortStore extends Module589.Store {
static displayName = "PrivateChannelSortStore";
initialize() {
this.waitFor(ChannelStore, GuildStore, MessageRequestStore, ReadStateStore, SpamMessageRequestStore, UserGuildSettingsStore, UserStore);
this.syncWith([UserGuildSettingsStore, MessageRequestStore], handleConnectionOpen);
}
getPrivateChannelIds() {
const r10 = c3491_12.values(c3491_11.FAVORITE);
const r13 = c3491_12.values(c3491_11.DEFAULT);
if (!(c3491_15 === r10 && c3491_16 === r13)) {
c3491_17 = [];
r10.forEach((item) => c3491_17.push(item.channelId));
c3491_15 = r10;
r13.forEach((item) => c3491_17.push(item.channelId));
c3491_16 = r13;
}
return c3491_17;
}
getSortedChannels() {
return [c3491_12.values(c3491_11.FAVORITE), c3491_12.values(c3491_11.DEFAULT)];
}
serializeForOverlay() {
const r0 = {};
let c14979_0 = r0;
c3491_12.values().forEach((item) => {
c14979_0[item.channelId] = item.lastMessageId;
});
return r0;
}
}
const privateChannelSortStore = new PrivateChannelSortStore(Dispatcher, {
CONNECTION_OPEN: handleConnectionOpen,
CONNECTION_OPEN_SUPPLEMENTAL: handleConnectionOpen,
OVERLAY_INITIALIZE: handleConnectionOpen,
CACHE_LOADED: handleCacheLoaded,
CACHE_LOADED_LAZY: handleCacheLoaded,
CHANNEL_UPDATES: function handleChannelUpdates(a0) {
a0.channels.forEach((channel) => {
if (isPrivate(channel.type) || c3491_12.has(channel.id)) {
c3491_12.set(channel.id, makeSortedChannel(channel));
}
});
},
CHANNEL_CREATE: function handleChannelCreate({ channel }) {
let r11 = !!isPrivate(channel.type);
if (r11) {
let r17 = channel.id !== FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID;
if (r17) {
c3491_12.set(channel.id, makeSortedChannel(channel));
r17 = void 0;
}
r11 = r17;
}
return r11;
},
CHANNEL_DELETE: function handleChannelDelete(a0) {
return c3491_12.delete(a0.channel.id);
},
MESSAGE_CREATE: function handleMessageCreate({ channelId, message }) {
if (c3491_12.has(channelId)) {
const channel = ChannelStore.getChannel(channelId);
return channel != null && c3491_12.set(channelId, makeSortedChannel(channel, message.id));
}
return false;
},
GUILD_CREATE: function handleGuildCreate(a0) {
return c3491_12.delete(a0.guild.id);
},
LOGOUT: function handleLogout() {
c3491_12.clear();
}
});
export default privateChannelSortStore;
+560
View File
@@ -0,0 +1,560 @@
// Metro module 4262 (f4263).
import FavoriteStore from "../../modules/favorites/FavoriteStore";
import UserRecord from "../../records/UserRecord";
import AuthenticationStore from "../AuthenticationStore";
import ChannelStore from "../ChannelStore";
import GuildMemberStore from "../GuildMemberStore";
import UserStore from "../UserStore";
import VoiceStateStore from "../VoiceStateStore";
import { ME } from "../../Constants";
import UserUtils from "../../utils/UserUtils";
import * as _Module3813 from "../../_bundle/Module3813";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { FavoriteChannelType } from "../../_bundle/Module1306";
import Module12 from "../../_bundle/Module12";
import Module589 from "../../_bundle/Module589";
import { isFavoritesGuildId } from "../../modules/favorites/FavoritesUtils";
import Dispatcher from "../../Dispatcher";
function $mk74042($env) {
return (a0) => {
let env25003 = {
$parent: $env.$parent
};
env25003[0] = a0;
Object.keys($env[0][a0]).forEach((item) => {
const r2 = env25003.$parent;
let guildId = env25003[0];
if (guildId == null) {
guildId = r2[11];
}
let r3 = r2[13][guildId];
if (r3 == null) {
const r20 = {
__proto__: r2[17].prototype,
_pending: new Set(),
_voiceStates: null
};
const SecondaryIndexMap = (0, r2[0])(r2[2][10]).SecondaryIndexMap;
const r9 = $mk74044();
r20._voiceStates = new SecondaryIndexMap($mk74043(), r9);
r20.guildId = guildId;
r2[13][guildId] = r20;
r3 = r20;
}
r3.updateVoiceState(item);
});
};
}
function $mk74043() {
return (a0) => {
const channelId = a0.voiceState.channelId;
return channelId != null ? [channelId] : [];
};
}
function $mk74044() {
return (a0) => a0.comparator;
}
let makeSortedVoiceState, handleUpdateUsers, handleFavoritesChange, handleFavoriteChannelAppeared, c2500_12, c2500_21;
let env2500 = {};
const getVoiceStatesForGuild = function getVoiceStatesForGuild(a0) {
let r12 = env2500[13][a0];
if (r12 == null) {
const r19 = {
__proto__: SortedVoiceStates.prototype,
_pending: new Set(),
_voiceStates: null
};
const r9 = $mk74044();
r19._voiceStates = new _Module3813.SecondaryIndexMap($mk74043(), r9);
r19.guildId = a0;
env2500[13][a0] = r19;
r12 = r19;
}
return r12;
};
makeSortedVoiceState = function makeSortedVoiceState(a0, a1, a2, a3) {
const user = UserStore.getUser(a2);
const r5 = user == null;
let user2 = user;
if (user2 == null) {
user2 = new UserRecord({
id: a2,
username: "...",
discriminator: a2.slice(-5, -1)
});
}
const member = GuildMemberStore.getMember(a1, user2.id);
let r32 = member?.nick;
if (r32 == null) {
r32 = UserUtils.getName(user2);
}
const r46 = {
voiceState: a0,
user: user2,
member,
comparator: `${a0.selfStream ? "\x00" : "\x01"}${r32.toLowerCase()}\x00${a0.userId}`,
nick: member?.nick,
connectedOn: null
};
let connectedOn = a3?.connectedOn;
if (connectedOn == null) {
connectedOn = Date.now();
}
r46.connectedOn = connectedOn;
if (r5) {
r46._isPlaceholder = true;
}
return r46;
};
handleUpdateUsers = function handleUpdateUsers() {
return Module12.reduce(env2500[13], (a0, a1) => a1.updateUsers() || a0, false);
};
handleFavoritesChange = function handleFavoritesChange() {
const r1 = env2500[14] != null;
env2500[14] = null;
return r1;
};
handleFavoriteChannelAppeared = function handleFavoriteChannelAppeared() {
const r0 = env2500[14] == null || !env2500[14].unknownChannels.some((unknownChannel) => ChannelStore.getChannel(unknownChannel) != null);
let r1 = !r0;
if (!r0) {
env2500[14] = null;
r1 = true;
}
return r1;
};
c2500_12 = Object.freeze([]);
env2500[13] = {};
env2500[14] = null;
class SortedVoiceStates {
constructor(a0) {
const r13 = {
__proto__: new.target.prototype,
_pending: new Set(),
_voiceStates: null
};
const r6 = $mk74044();
r13._voiceStates = new _Module3813.SecondaryIndexMap($mk74043(), r6);
r13.guildId = a0;
return r13;
}
updateVoiceState(a0) {
if (this._pending != null) {
this._pending.add(a0);
return false;
}
const voiceState = VoiceStateStore.getVoiceState(this.guildId, a0);
const r12 = this._voiceStates.get(a0);
const user = UserStore.getUser(a0);
if (voiceState != null && user != null) {
if (r12 == null) {
this._voiceStates.set(a0, makeSortedVoiceState(voiceState, this.guildId, a0));
return true;
}
if (r12.voiceState !== voiceState) {
const member = GuildMemberStore.getMember(this.guildId, user.id);
let nick = member?.nick;
if (nick == null) {
nick = UserUtils.getName(user);
}
this._voiceStates.set(a0, {
...r12,
member,
comparator: `${voiceState.selfStream ? "\x00" : "\x01"}${nick.toLowerCase()}\x00${voiceState.userId}`,
nick,
voiceState
});
return true;
}
} else if (r12 != null) {
this._voiceStates.delete(a0);
return true;
}
return false;
}
updateMember(a0) {
if (this._pending != null) {
this._pending.add(a0);
return false;
}
L13: {
const r10 = this._voiceStates.get(a0);
const user = UserStore.getUser(a0);
if (r10 != null && user != null) {
const member = GuildMemberStore.getMember(this.guildId, user.id);
if (member?.nick === r10.member?.nick) {
if (member?.avatar === r10.member?.avatar) {
break L13;
}
}
const voiceState = r10.voiceState;
let r36 = member?.nick;
if (r36 == null) {
r36 = UserUtils.getName(user);
}
this._voiceStates.set(a0, {
...r10,
member,
comparator: `${voiceState.selfStream ? "\x00" : "\x01"}${r36.toLowerCase()}\x00${voiceState.userId}`,
nick: member?.nick
});
return true;
}
}
return false;
}
updateUsers() {
return this._pending == null && this._voiceStates.values().reduce((acc, item) => {
const user = UserStore.getUser(item.user.id);
let r17 = acc;
if (user != null) {
const user2 = item.user;
r17 = acc;
if (user2 !== user) {
this._voiceStates.set(user.id, makeSortedVoiceState(item.voiceState, this.guildId, user.id, item));
r17 = true;
}
}
return r17;
}, false);
}
getUserIds() {
this.processPending();
return this._voiceStates.keys();
}
getVoiceStates() {
this.processPending();
return this._voiceStates.indexes();
}
getVoiceStatesForChannel(a0) {
this.processPending();
let r7 = this._voiceStates.values(a0);
if (r7.length === 0) {
r7 = c2500_12;
}
return r7;
}
countVoiceStatesForChannel(a0) {
this.processPending();
return this._voiceStates.size(a0);
}
getVersion() {
this.processPending();
return this._voiceStates.version;
}
processPending() {
if (this._pending != null) {
const _pending = this._pending;
this._pending = void 0;
_pending.forEach((item) => this.updateVoiceState(item));
}
}
}
class SortedVoiceStateStore extends Module589.Store {
static displayName = "SortedVoiceStateStore";
constructor() {
super(...arguments);
}
initialize() {
let env14040;
const r2 = env14040 = {
$parent: env2500
};
env2500[13] = {};
env2500[14] = null;
const allVoiceStates = VoiceStateStore.getAllVoiceStates();
env14040[0] = allVoiceStates;
SnowflakeUtils.keys(allVoiceStates).forEach($mk74042(r2));
this.waitFor(AuthenticationStore, ChannelStore, FavoriteStore, GuildMemberStore, UserStore, VoiceStateStore);
this.syncWith([UserStore], handleUpdateUsers);
this.syncWith([FavoriteStore], handleFavoritesChange);
this.syncWith([ChannelStore], handleFavoriteChannelAppeared);
}
getVoiceStates(a0) {
let r37;
if (isFavoritesGuildId(a0)) {
r37 = (function getFavoritesVoiceStates() {
if (env2500[14] != null && (function isFavoritesResultCurrent() {
const r0 = env2500[14];
if (r0 == null) {
return false;
}
if (r0.favoriteChannels !== FavoriteStore.getFavoriteChannels()) {
return false;
}
if (r0.unknownChannels.some((unknownChannel) => ChannelStore.getChannel(unknownChannel) != null)) {
return false;
}
for (const version of r0.versions) {
const [r36, r37] = version;
const r9 = env2500[13][r36];
if ((r9 == null ? void 0 : r9.getVersion()) === r37) {
continue;
}
return false;
}
return true;
})()) {
return env2500[14].result;
}
const favoriteChannels = FavoriteStore.getFavoriteChannels();
const map = new Map();
const unknownChannels = [];
const result = {};
for (const item of SnowflakeUtils.keys(favoriteChannels)) {
if (favoriteChannels[item].type !== FavoriteChannelType.CATEGORY) {
const channel = ChannelStore.getChannel(item);
if (channel != null) {
if (channel.isVocal()) {
let r16 = channel.getGuildId();
if (r16 == null) {
r16 = ME;
}
const voiceStatesForGuild = getVoiceStatesForGuild(r16);
map.set(r16, voiceStatesForGuild.getVersion());
const voiceStatesForChannel = voiceStatesForGuild.getVoiceStatesForChannel(item);
if (voiceStatesForChannel.length > 0) {
result[item] = voiceStatesForChannel;
}
}
} else {
unknownChannels.push(item);
}
}
}
env2500[14] = {
favoriteChannels,
versions: map,
unknownChannels,
result
};
return result;
})();
} else {
const guildId = a0 == null ? ME : a0;
let r18 = env2500[13][guildId];
if (r18 == null) {
const prototype = SortedVoiceStates.prototype;
const set = new Set();
const r11 = $mk74044();
const r34 = {
__proto__: prototype,
_pending: set,
_voiceStates: new _Module3813.SecondaryIndexMap($mk74043(), r11)
};
r34.guildId = guildId;
env2500[13][guildId] = r34;
r18 = r34;
}
r37 = r18.getVoiceStates();
}
return r37;
}
getAllVoiceStates() {
return env2500[13];
}
getVoiceStatesForChannel(a0) {
let guildId = a0.getGuildId();
const id = a0.id;
if (guildId == null) {
guildId = ME;
}
let r14 = env2500[13][guildId];
if (r14 == null) {
const r22 = {
__proto__: SortedVoiceStates.prototype,
_pending: new Set(),
_voiceStates: null
};
const r10 = $mk74044();
r22._voiceStates = new _Module3813.SecondaryIndexMap($mk74043(), r10);
r22.guildId = guildId;
env2500[13][guildId] = r22;
r14 = r22;
}
return r14.getVoiceStatesForChannel(id);
}
getVoiceStatesForChannelAlt(a0, a1) {
const guildId = a1 == null ? ME : a1;
let r3 = env2500[13][guildId];
if (r3 == null) {
const r19 = {
__proto__: SortedVoiceStates.prototype,
_pending: new Set(),
_voiceStates: null
};
const r9 = $mk74044();
r19._voiceStates = new _Module3813.SecondaryIndexMap($mk74043(), r9);
r19.guildId = guildId;
env2500[13][guildId] = r19;
r3 = r19;
}
return r3.getVoiceStatesForChannel(a0);
}
countVoiceStatesForChannel(a0) {
const channel = ChannelStore.getChannel(a0);
const r1 = channel == null;
let r15 = 0;
if (!r1) {
let guildId = channel.getGuildId();
if (guildId == null) {
guildId = ME;
}
let r18 = env2500[13][guildId];
if (r18 == null) {
const r26 = {
__proto__: SortedVoiceStates.prototype,
_pending: new Set(),
_voiceStates: null
};
const r12 = $mk74044();
r26._voiceStates = new _Module3813.SecondaryIndexMap($mk74043(), r12);
r26.guildId = guildId;
env2500[13][guildId] = r26;
r18 = r26;
}
r15 = r18.countVoiceStatesForChannel(a0);
}
return r15;
}
getVoiceStateVersion(a0) {
const guildId = a0 == null ? ME : a0;
let r2 = env2500[13][guildId];
if (r2 == null) {
const r19 = {
__proto__: SortedVoiceStates.prototype,
_pending: new Set(),
_voiceStates: null
};
const r9 = $mk74044();
r19._voiceStates = new _Module3813.SecondaryIndexMap($mk74043(), r9);
r19.guildId = guildId;
env2500[13][guildId] = r19;
r2 = r19;
}
return r2.getVersion();
}
}
c2500_21 = SortedVoiceStateStore;
const r95 = new SortedVoiceStateStore(Dispatcher, {
CONNECTION_OPEN: function handleConnectionOpen() {
env2500[13] = {};
env2500[14] = null;
},
OVERLAY_INITIALIZE: function handleOverlayInitialize() {
let env14041;
const r1 = env14041 = {
$parent: env2500
};
env2500[13] = {};
env2500[14] = null;
const allVoiceStates = VoiceStateStore.getAllVoiceStates();
env14041[0] = allVoiceStates;
SnowflakeUtils.keys(allVoiceStates).forEach($mk74042(r1));
},
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelect({ guildId }) {
const id = AuthenticationStore.getId();
let r15 = id != null;
if (r15) {
if (guildId == null) {
guildId = ME;
}
let r3 = env2500[13][guildId];
if (r3 == null) {
const r24 = {
__proto__: SortedVoiceStates.prototype,
_pending: new Set(),
_voiceStates: null
};
const r11 = $mk74044();
r24._voiceStates = new _Module3813.SecondaryIndexMap($mk74043(), r11);
r24.guildId = guildId;
env2500[13][guildId] = r24;
r3 = r24;
}
r15 = r3.updateVoiceState(id);
}
return r15;
},
VOICE_STATE_UPDATES: function handleVoiceStateUpdates(a0) {
return a0.voiceStates.reduce((acc, voiceState) => {
let guildId = voiceState.guildId;
const userId = voiceState.userId;
if (guildId == null) {
guildId = ME;
}
let r2 = env2500[13][guildId];
if (r2 == null) {
const r21 = {
__proto__: SortedVoiceStates.prototype,
_pending: new Set(),
_voiceStates: null
};
const r10 = $mk74044();
r21._voiceStates = new _Module3813.SecondaryIndexMap($mk74043(), r10);
r21.guildId = guildId;
env2500[13][guildId] = r21;
r2 = r21;
}
return r2.updateVoiceState(userId) || acc;
}, false);
},
GUILD_MEMBER_UPDATE: function handleGuildMemberUpdate({ guildId, user }) {
let r3 = env2500[13][guildId];
if (r3 == null) {
const r21 = {
__proto__: SortedVoiceStates.prototype,
_pending: new Set(),
_voiceStates: null
};
const r10 = $mk74044();
r21._voiceStates = new _Module3813.SecondaryIndexMap($mk74043(), r10);
r21.guildId = guildId;
env2500[13][guildId] = r21;
r3 = r21;
}
return r3.updateMember(user.id);
},
GUILD_CREATE: function handleGuildCreate(a0) {
delete env2500[13][a0.guild.id];
},
GUILD_DELETE: function handleGuildDelete(a0) {
delete env2500[13][a0.guild.id];
},
PASSIVE_UPDATE_V2: function handlePassiveUpdateV2(a0) {
let r0 = false;
const r4 = Set;
const r10 = env2500[13][a0.guildId];
const r31 = new r4(r10 == null ? void 0 : r10.getUserIds());
const r32 = Set;
const voiceStates = a0.voiceStates;
const r34 = voiceStates == null ? void 0 : voiceStates.map((voiceState) => voiceState.userId);
const r40 = new r32(r34);
const set = new Set(a0.removedVoiceStateUsers);
for (const item of new Set([...r31, ...r40])) {
r0 = getVoiceStatesForGuild(a0.guildId).updateVoiceState(item) || r0;
}
for (const item2 of r31) {
if (!set.has(item2)) {
r0 = getVoiceStatesForGuild(a0.guildId).updateMember(item2) || r0;
}
}
return r0;
}
});
export default r95;
export { c2500_12 as NO_VOICE_STATES };
export function makeMemberAndComparator(a0, a1, a2) {
let r6 = a1?.nick;
if (r6 == null) {
r6 = UserUtils.getName(a2);
}
return {
member: a1,
comparator: `${a0.selfStream ? "\x00" : "\x01"}${r6.toLowerCase()}\x00${a0.userId}`
};
}
export function getComparator(a0, a1) {
return `${a0.selfStream ? "\x00" : "\x01"}${a1.toLowerCase()}\x00${a0.userId}`;
}
export { makeSortedVoiceState };