decord/beta/source/modules/quickswitcher/QuickSwitcherStore.tsx

702 lines
26 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 8699
// Function ID: 8700
// Name: QuickSwitcherStore
2026-10-12 16:32:48 +00:00
// Dependencies: [8236, 6034, 1205, 502, 2065, 7244, 4748, 2125, 2087, 4750, 6035, 2116, 4939, 5966, 1085, 8700, 12, 8713, 5970, 1126, 8714, 1388, 510, 504, 584, 2]
2026-10-12 16:32:48 +00:00
// Module 8699 (QuickSwitcherStore)
import _modDef12 from "module_12" /* 12 */;
2026-10-01 14:13:23 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import Storage2 from "Storage" /* 510 */;
2026-10-07 22:43:51 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */;
import intl8 from "intl" /* 1126 */;
2026-10-12 16:32:48 +00:00
import GuildChannelStore2 from "GuildChannelStore" /* 4748 */;
import DraftStore2 from "DraftStore" /* 7244 */;
import _mod8700 from "module_8700" /* 8700 */;
import createAutocompleterResultForChannelIdDefault from "createAutocompleterResultForChannelId" /* 8713 */;
import ReadStateUtils from "ReadStateUtils" /* 8714 */;
import GameAutocompleteStore from "GameAutocompleteStore" /* 8236 */;
import ActiveJoinedThreadsStore from "ActiveJoinedThreadsStore" /* 6034 */;
import ThemeStore from "ThemeStore" /* 1205 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
2026-10-12 16:32:48 +00:00
import ChannelStore from "ChannelStore" /* 2065 */;
import GuildMemberStore from "GuildMemberStore" /* 2125 */;
import GuildStore from "GuildStore" /* 2087 */;
import PermissionStore from "PermissionStore" /* 4750 */;
import ReadStateStore from "ReadStateStore" /* 6035 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2116 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4939 */;
import UserGuildSettingsStore from "UserGuildSettingsStore" /* 5966 */;
2026-10-07 22:43:51 +00:00
import Constants from "Constants" /* 1085 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-01 14:13:23 +00:00
const require = globalThis.__r;
2026-10-12 16:32:48 +00:00
const _modDef8700 = _mod8700;
2026-10-01 14:13:23 +00:00
const DraftStore = DraftStore2;
const GuildChannelStore = GuildChannelStore2;
2026-10-07 22:43:51 +00:00
let _null, importDefault, recentlyEditedDrafts;
2026-10-01 14:13:23 +00:00
let closure_20;
let closure_21;
function handleConnectionOpen() {
let tmp = GuildStore.getGuildCount() >= 3;
if (!tmp) {
2026-10-01 14:13:23 +00:00
const obj = _modDef12;
tmp = obj.size(ChannelStore.getMutablePrivateChannels()) >= 20;
}
closure_25 = tmp;
2026-10-01 14:13:23 +00:00
let closure_30 = [];
}
2026-10-01 14:13:23 +00:00
function generateResultFromId(channelHistory) {
const tmp2 = createAutocompleterResultForChannelIdDefault(channelHistory);
if (null == tmp2) {
return null;
} else {
2026-10-12 16:32:48 +00:00
const tmp3 = queryMode === _mod8700.AutocompleterResultTypes.USER || queryMode === _mod8700.AutocompleterResultTypes.USER_GLOBAL;
if (tmp3) {
2026-10-12 16:32:48 +00:00
if (tmp2.type !== _mod8700.AutocompleterResultTypes.USER) {
return null;
}
} else if (null != queryMode) {
if (queryMode !== tmp2.type) {
return null;
}
}
return tmp2;
}
}
function generateInitialResults() {
2026-10-01 14:13:23 +00:00
let ChannelMessage;
let channelId;
let closure_1;
let result;
function getDrafts(arg0) {
let closure_0 = arg0;
const items = [];
recentlyEditedDrafts = recentlyEditedDrafts.getRecentlyEditedDrafts(ChannelMessage.ChannelMessage);
const item = recentlyEditedDrafts.forEach((channelId) => {
channelId = channelId.channelId;
if (!closure_0(channelId)) {
const tmp3 = items(set[17])(channelId);
let tmp5 = null;
if (null != tmp3) {
const tmp8 = queryMode === channelId1(set[15]).AutocompleterResultTypes.USER || queryMode === channelId1(set[15]).AutocompleterResultTypes.USER_GLOBAL;
if (tmp8) {
tmp5 = tmp3;
if (tmp3.type !== channelId1(set[15]).AutocompleterResultTypes.USER) {
tmp5 = null;
}
} else {
tmp5 = tmp3;
if (null != queryMode) {
tmp5 = tmp3;
if (queryMode !== tmp3.type) {
tmp5 = null;
}
}
}
}
if (null != tmp5) {
const obj = { record: tmp5, channelId };
items.push(obj);
}
}
});
return items;
}
let obj = SelectedGuildStore;
const guildId = SelectedGuildStore.getGuildId();
const channelId1 = SelectedChannelStore.getChannelId();
2026-10-01 14:13:23 +00:00
let tmp3 = queryMode;
let tmp4 = channelId1;
let tmp5 = set;
if (channelId1(set[15]).AutocompleterResultTypes.USER_GLOBAL !== queryMode) {
if (tmp4(tmp5[15]).AutocompleterResultTypes.USER !== tmp3) {
if (tmp4(tmp5[15]).AutocompleterResultTypes.APPLICATION === tmp3) {
2026-10-01 14:13:23 +00:00
const obj6 = require("AutocompleteUtils");
return obj6.queryApplications({ query: "", limit: 100, fuzzy: true });
} else if (tmp4(tmp5[15]).AutocompleterResultTypes.GAME_PROFILE === tmp3) {
return [];
} else if (tmp4(tmp5[15]).AutocompleterResultTypes.GUILD === tmp3) {
2026-10-01 14:13:23 +00:00
const obj5 = require("AutocompleteUtils");
return obj5.queryGuilds({ query: "", limit: 100, fuzzy: true });
} else if (tmp4(tmp5[15]).AutocompleterResultTypes.TEXT_CHANNEL === tmp3) {
const obj2 = { query: "", guildId: obj.getGuildId(), limit: 100, fuzzy: true, allowEmptyQueries: true };
2026-10-01 14:13:23 +00:00
const queryChannels2 = require("AutocompleteUtils").queryChannels;
require("AutocompleteUtils");
return queryChannels2(obj2);
} else if (tmp4(tmp5[15]).AutocompleterResultTypes.VOICE_CHANNEL === tmp3) {
const obj3 = {
query: "",
guildId: obj.getGuildId(),
limit: 100,
fuzzy: true,
filter() {
return true;
},
type: GUILD_VOCAL_CHANNELS_KEY,
allowEmptyQueries: true
};
2026-10-01 14:13:23 +00:00
const queryChannels = require("AutocompleteUtils").queryChannels;
require("AutocompleteUtils");
return queryChannels(obj3);
} else {
const _Set = Set;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
set = new Set();
let items = [];
let num = 1;
2026-10-01 14:13:23 +00:00
if (1 < channelHistory.length) {
do {
2026-10-01 14:13:23 +00:00
let tmp6 = generateResultFromId;
let tmp8 = generateResultFromId(channelHistory[num]);
let tmp9 = num;
if (null != tmp8) {
2026-10-01 14:13:23 +00:00
let tmp45 = channelId1;
let tmp46 = set;
let canResult = tmp8.type !== channelId1(set[15]).AutocompleterResultTypes.TEXT_CHANNEL && tmp8.type !== tmp45(tmp46[15]).AutocompleterResultTypes.VOICE_CHANNEL;
if (!canResult) {
2026-10-01 14:13:23 +00:00
let tmp11 = PermissionStore;
let tmp12 = constants;
canResult = PermissionStore.can(constants.VIEW_CHANNEL, tmp8.record);
}
if (canResult) {
let arr = items.push(tmp8);
if (set.size < 3) {
2026-10-01 14:13:23 +00:00
let tmp14 = channelHistory;
let addResult = set.add(channelHistory[num]);
}
}
}
num = num + 1;
2026-10-01 14:13:23 +00:00
} while (num < channelHistory.length);
}
const items1 = [];
2026-10-01 14:13:23 +00:00
const arr2 = getDrafts((arg0) => {
const hasItem = arg0 === channelId1 || set.has(arg0);
return hasItem;
});
if (arr2.length > 0) {
2026-10-01 14:13:23 +00:00
const push2 = items1.push;
const createHeaderResult2 = channelId1(set[15]).createHeaderResult;
const intl2 = channelId1(set[19]).intl;
2026-10-01 14:13:23 +00:00
push2(createHeaderResult2(intl2.string(channelId1(set[19]).t["4B63jZ"])));
for (const item10048 of arr2) {
let addResult1 = set.add(item10048.channelId);
2026-10-01 14:13:23 +00:00
let arr3 = items1.push(item10048.record);
continue;
}
}
const mentionChannelIds = ReadStateStore.getMentionChannelIds();
2026-10-01 14:13:23 +00:00
const found = mentionChannelIds.filter((item) => {
const tmp = item !== channelId1 && !set.has(item);
return tmp;
});
const items2 = [];
let diff = found.length - 1;
if (0 <= diff) {
do {
let tmp22 = found[diff];
if (null != tmp22) {
let tmp25 = generateResultFromId(tmp22);
if (null != tmp25) {
2026-10-01 14:13:23 +00:00
let obj4 = { channelId: tmp22, result: tmp25 };
let arr4 = items2.push(obj4);
}
}
diff = diff - 1;
} while (0 <= diff);
}
if (items2.length > 0) {
2026-10-01 14:13:23 +00:00
const push3 = items1.push;
const createHeaderResult3 = channelId1(set[15]).createHeaderResult;
const intl3 = channelId1(set[19]).intl;
2026-10-01 14:13:23 +00:00
push3(createHeaderResult3(intl3.string(channelId1(set[19]).t["61Df13"])));
for (const item10075 of items2) {
({ result, channelId } = item10075);
let addResult2 = set.add(result.record.id);
let addResult3 = set.add(channelId);
2026-10-01 14:13:23 +00:00
let arr5 = items1.push(result);
continue;
}
}
let combined = items1;
if (null != guildId) {
const selectableChannelIds = GuildChannelStore.getSelectableChannelIds(guildId);
const found1 = selectableChannelIds.filter((item) => {
const channel = ChannelStore.getChannel(item);
2026-10-01 14:13:23 +00:00
let hasItem = null == channel || item === channelId1 || set.has(item) || UserGuildSettingsStore.isChannelMuted(channel.guild_id, item);
if (!hasItem) {
2026-10-01 14:13:23 +00:00
hasItem = null != channel.parent_id && UserGuildSettingsStore.isChannelMuted(channel.guild_id, channel.parent_id);
const isChannelMutedResult = null != channel.parent_id && UserGuildSettingsStore.isChannelMuted(channel.guild_id, channel.parent_id);
}
let hasImportantUnread = !hasItem;
2026-10-01 14:13:23 +00:00
if (hasImportantUnread) {
const obj = ReadStateUtils;
hasImportantUnread = obj.getHasImportantUnread(channel);
}
return hasImportantUnread;
});
const mapped = found1.map((item) => {
const tmp2 = closure_1(set[17])(item);
let tmp3 = null;
if (null != tmp2) {
2026-10-01 14:13:23 +00:00
const tmp6 = queryMode === channelId1(set[15]).AutocompleterResultTypes.USER || queryMode === channelId1(set[15]).AutocompleterResultTypes.USER_GLOBAL;
if (tmp6) {
tmp3 = tmp2;
2026-10-01 14:13:23 +00:00
if (tmp2.type !== channelId1(set[15]).AutocompleterResultTypes.USER) {
tmp3 = null;
}
} else {
tmp3 = tmp2;
if (null != queryMode) {
tmp3 = tmp2;
if (queryMode !== tmp2.type) {
tmp3 = null;
}
}
}
}
return tmp3;
});
const found2 = mapped.filter(channelId1(set[21]).isNotNullish);
const _Object = Object;
const values = Object.values(ActiveJoinedThreadsStore.getActiveJoinedUnreadThreadsForGuild(guildId));
let item = values.forEach((item) => {
2026-10-01 14:13:23 +00:00
for (const key10004 in item) {
let tmp14 = createAutocompleterResultForChannelIdDefault(key10004);
let tmp5 = null;
if (null != tmp14) {
let tmp2 = require;
let tmp = queryMode;
2026-10-12 16:32:48 +00:00
let tmp3 = queryMode === _mod8700.AutocompleterResultTypes.USER || tmp === tmp2(8700).AutocompleterResultTypes.USER_GLOBAL;
if (tmp3) {
tmp5 = tmp14;
2026-10-12 16:32:48 +00:00
if (tmp14.type !== tmp2(8700).AutocompleterResultTypes.USER) {
tmp5 = null;
}
} else {
tmp5 = tmp14;
if (null != queryMode) {
tmp5 = tmp14;
if (queryMode !== tmp14.type) {
tmp5 = null;
}
}
}
}
let hasItem = null == tmp5;
if (!hasItem) {
hasItem = set.has(tmp5.record.id);
}
if (hasItem) {
continue;
} else {
let arr = found2.push(tmp5);
continue;
}
continue;
}
});
combined = items1;
if (found2.length > 0) {
2026-10-01 14:13:23 +00:00
const push = items1.push;
const createHeaderResult = channelId1(set[15]).createHeaderResult;
const intl = tmp58(tmp59[19]).intl;
push(createHeaderResult(intl.string(channelId1(set[19]).t.ieCAhD)));
combined = items1.concat(found2);
}
}
let num3 = 7;
if (combined.length > 0) {
num3 = 3;
}
if (items.length > num3) {
items.splice(num3);
}
2026-10-01 14:13:23 +00:00
let tmp34 = combined;
if (items.length > 0) {
2026-10-01 14:13:23 +00:00
const createHeaderResult4 = channelId1(set[15]).createHeaderResult;
const intl4 = channelId1(set[19]).intl;
2026-10-01 14:13:23 +00:00
const items3 = [createHeaderResult4(intl4.string(channelId1(set[19]).t["80lOZ1"]))];
HermesBuiltin.arraySpread(items3, items, 1);
const items4 = [];
2026-10-01 14:13:23 +00:00
HermesBuiltin.arraySpread(items4, combined, HermesBuiltin.arraySpread(items4, items3, 0));
tmp34 = items4;
}
2026-10-01 14:13:23 +00:00
return tmp34;
}
}
}
importDefault = AuthenticationStore.getId();
2026-10-01 14:13:23 +00:00
const obj7 = require("AutocompleteUtils");
const recentlyTalked = obj7.getRecentlyTalked(channelId1, 100);
return recentlyTalked.filter((record) => record.record.id !== closure_1);
}
function handleQuickSwitcherShow(arg0) {
2026-10-01 14:13:23 +00:00
let query;
({ query, queryMode } = arg0);
const trimmed = query.trim();
const guildId = SelectedGuildStore.getGuildId();
const items = ["user:" + AuthenticationStore.getId()];
2026-10-01 14:13:23 +00:00
set = new Set(items);
if (null != guildId) {
const _HermesInternal = HermesInternal;
set.add("guild:" + guildId);
}
closure_32 = Date.now();
2026-10-01 14:13:23 +00:00
let tmp112 = _null;
if (_null == null) {
2026-10-01 14:13:23 +00:00
const items1 = [, , , , , , , ];
2026-10-12 16:32:48 +00:00
const tmp11 = _modDef8700;
items1[0] = _mod8700.AutocompleterResultTypes.USER;
items1[1] = _mod8700.AutocompleterResultTypes.GROUP_DM;
items1[2] = _mod8700.AutocompleterResultTypes.TEXT_CHANNEL;
items1[3] = _mod8700.AutocompleterResultTypes.GUILD;
items1[4] = _mod8700.AutocompleterResultTypes.APPLICATION;
items1[5] = _mod8700.AutocompleterResultTypes.GAME_PROFILE;
items1[6] = _mod8700.AutocompleterResultTypes.LINK;
items1[7] = _mod8700.AutocompleterResultTypes.IN_APP_NAVIGATION;
let num = 5;
if (null != queryMode) {
num = 100;
}
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const obj = { frecencyBoosters: true, blacklist: set, allowSnowflake: true };
2026-10-01 14:13:23 +00:00
tmp112 = new tmp11(tmp12, items1, num, obj, 100);
}
2026-10-01 14:13:23 +00:00
_null = tmp112;
c28 = null;
2026-10-01 14:13:23 +00:00
let c29 = trimmed.length;
_null.search(trimmed);
}
function handleUserSearchUpdate(arr, str) {
str = str.trim();
if ("" === str.trim()) {
arr = generateInitialResults();
}
let flag = false;
if (arr.length === length.length) {
let num2 = 0;
flag = true;
if (0 < arr.length) {
flag = false;
2026-10-01 14:13:23 +00:00
while (arr[num2].record.id === tmp3[num2].record.id) {
flag = false;
2026-10-01 14:13:23 +00:00
if (tmp4.type !== tmp5.type) {
break;
} else {
let sum = num2 + 1;
num2 = sum;
flag = true;
if (sum >= arr.length) {
break;
}
}
}
}
}
if (!flag) {
2026-10-01 14:13:23 +00:00
let formatToPlainStringResult;
length = arr;
2026-10-12 16:32:48 +00:00
if (_mod8700.AutocompleterResultTypes.USER_GLOBAL !== queryMode) {
if (_mod8700.AutocompleterResultTypes.USER !== queryMode) {
2026-10-01 14:13:23 +00:00
let items;
2026-10-12 16:32:48 +00:00
if (_mod8700.AutocompleterResultTypes.TEXT_CHANNEL === queryMode) {
2026-10-01 14:13:23 +00:00
const unshift5 = arr.unshift;
2026-10-12 16:32:48 +00:00
const createHeaderResult5 = _mod8700.createHeaderResult;
2026-10-07 22:43:51 +00:00
const intl5 = tmp9(1126).intl;
2026-10-01 14:13:23 +00:00
unshift5(createHeaderResult5(intl5.string(intl8.t.W26k4V)));
items = arr;
2026-10-12 16:32:48 +00:00
} else if (_mod8700.AutocompleterResultTypes.VOICE_CHANNEL === queryMode) {
2026-10-01 14:13:23 +00:00
const unshift4 = arr.unshift;
2026-10-12 16:32:48 +00:00
const createHeaderResult4 = _mod8700.createHeaderResult;
2026-10-07 22:43:51 +00:00
const intl4 = tmp9(1126).intl;
2026-10-01 14:13:23 +00:00
unshift4(createHeaderResult4(intl4.string(intl8.t.zUoI5C)));
items = arr;
2026-10-12 16:32:48 +00:00
} else if (_mod8700.AutocompleterResultTypes.GUILD === queryMode) {
2026-10-01 14:13:23 +00:00
const unshift3 = arr.unshift;
2026-10-12 16:32:48 +00:00
const createHeaderResult3 = _mod8700.createHeaderResult;
2026-10-07 22:43:51 +00:00
const intl3 = tmp9(1126).intl;
2026-10-01 14:13:23 +00:00
unshift3(createHeaderResult3(intl3.string(intl8.t.olADPs)));
items = arr;
2026-10-12 16:32:48 +00:00
} else if (_mod8700.AutocompleterResultTypes.APPLICATION === queryMode) {
2026-10-01 14:13:23 +00:00
const unshift2 = arr.unshift;
2026-10-12 16:32:48 +00:00
const createHeaderResult2 = _mod8700.createHeaderResult;
2026-10-07 22:43:51 +00:00
const intl2 = tmp9(1126).intl;
2026-10-01 14:13:23 +00:00
unshift2(createHeaderResult2(intl2.string(intl8.t.VwK1ld)));
items = arr;
2026-10-12 16:32:48 +00:00
} else if (_mod8700.AutocompleterResultTypes.GAME_PROFILE === queryMode) {
2026-10-01 14:13:23 +00:00
const unshift = arr.unshift;
2026-10-12 16:32:48 +00:00
const createHeaderResult = _mod8700.createHeaderResult;
2026-10-07 22:43:51 +00:00
const intl = tmp9(1126).intl;
2026-10-01 14:13:23 +00:00
unshift(createHeaderResult(intl.string(intl8.t.gEp2SG)));
items = arr;
} else {
2026-10-12 16:32:48 +00:00
const found = arr.filter((type) => type.type === _mod8700.AutocompleterResultTypes.GAME_PROFILE);
const substr = found.slice(0, 3);
items = [];
2026-10-12 16:32:48 +00:00
HermesBuiltin.arraySpread(items, substr, HermesBuiltin.arraySpread(items, arr.filter((type) => type.type !== _mod8700.AutocompleterResultTypes.GAME_PROFILE), 0));
arr = items;
}
2026-10-01 14:13:23 +00:00
}
if (str !== c28) {
c28 = str;
const _Math = Math;
c29 = Math.max(str.length, c29);
2026-10-12 16:32:48 +00:00
const tmp9Result12 = _mod8700;
selectedIndex = tmp9Result12.findNextSelectedResult(tmp9(8700).FindResultDirections.DOWN, -1, arr);
2026-10-01 14:13:23 +00:00
} else {
2026-10-12 16:32:48 +00:00
const tmp38 = null != tmp36 && tmp36.type === tmp9(8700).AutocompleterResultTypes.HEADER;
2026-10-01 14:13:23 +00:00
if (tmp38) {
2026-10-12 16:32:48 +00:00
const tmp9Result13 = _mod8700;
selectedIndex = tmp9Result13.findNextSelectedResult(tmp9(8700).FindResultDirections.DOWN, selectedIndex, arr);
}
}
2026-10-01 14:13:23 +00:00
quickSwitcherStoreClass.emitChange();
}
let guild = null;
2026-10-12 16:32:48 +00:00
if (queryMode !== _mod8700.AutocompleterResultTypes.USER_GLOBAL) {
guild = GuildStore.getGuild(SelectedGuildStore.getGuildId());
}
2026-10-01 14:13:23 +00:00
const unshift6 = arr.unshift;
2026-10-12 16:32:48 +00:00
const createHeaderResult6 = _mod8700.createHeaderResult;
if (null != guild) {
2026-10-07 22:43:51 +00:00
const intl7 = tmp9(1126).intl;
2026-10-01 14:13:23 +00:00
const obj = { name: guild.name };
2026-10-07 22:43:51 +00:00
formatToPlainStringResult = intl7.formatToPlainString(tmp9(1126).t.FREzQs, obj);
} else {
2026-10-07 22:43:51 +00:00
const intl6 = tmp9(1126).intl;
formatToPlainStringResult = intl6.string(tmp9(1126).t.XFYW1o);
}
2026-10-01 14:13:23 +00:00
unshift6(createHeaderResult6(formatToPlainStringResult));
items = arr;
}
}
function handleQuickSwitcherHide() {
c28 = null;
2026-10-01 14:13:23 +00:00
let c29 = 0;
let closure_30 = [];
if (null != _null) {
_null.destroy();
_null = null;
}
}
function handleGameAutocompleteSettled() {
if (null == _null) {
return false;
} else {
_null.refreshGameProfiles();
}
}
2026-10-01 14:13:23 +00:00
const DraftType = DraftStore2.DraftType;
const GUILD_VOCAL_CHANNELS_KEY = GuildChannelStore2.GUILD_VOCAL_CHANNELS_KEY;
({ CHANNEL_NOTICE_SHOW_DELAY: closure_20, Permissions: closure_21 } = Constants);
const seenQSTutorial = "seenQSTutorial";
let selectedIndex = 0;
let c24 = false;
let closure_25 = false;
const queryMode = null;
let results = [];
let c28 = null;
2026-10-07 22:43:51 +00:00
let set = 0;
2026-10-01 14:13:23 +00:00
let length = [];
let channelHistory = [];
let closure_32 = null;
2026-10-01 14:13:23 +00:00
const PersistedStore = get_initializedDefault.PersistedStore;
class QuickSwitcherStoreClass extends PersistedStore {
2026-10-01 14:13:23 +00:00
initialize(channelHistory) {
this.waitFor(ActiveJoinedThreadsStore, AuthenticationStore, ChannelStore, DraftStore, GameAutocompleteStore, GuildChannelStore, GuildMemberStore, GuildStore, PermissionStore, ReadStateStore, SelectedChannelStore, SelectedGuildStore, ThemeStore, UserGuildSettingsStore);
const items = [ThemeStore];
this.syncWith(items, () => true);
const Storage = Storage2.Storage;
let c24 = Storage.get(seenQSTutorial) || false;
channelHistory = undefined;
Storage.get(seenQSTutorial) || false;
if (channelHistory != null) {
channelHistory = channelHistory.channelHistory;
}
if (channelHistory == null) {
channelHistory = [];
}
}
2026-10-01 14:13:23 +00:00
getState() {
return { channelHistory };
}
2026-10-01 14:13:23 +00:00
isOpen() {
return null != c3;
}
getResultTotals(GROUP_DM) {
let num = 0;
if (null != _null) {
let reduced;
if (null == GROUP_DM) {
results = _null.results;
reduced = results.reduce((acc, type) => {
let sum = acc;
if (type.type !== GROUP_DM(dependencyMap[15]).AutocompleterResultTypes.HEADER) {
sum = acc + 1;
}
return sum;
}, 0);
} else {
const results1 = _null.results;
reduced = results1.reduce((acc, type) => {
let sum = acc;
if (type.type === GROUP_DM) {
sum = acc + 1;
}
return sum;
}, 0);
}
2026-10-01 14:13:23 +00:00
num = reduced;
}
return num;
}
2026-10-01 14:13:23 +00:00
channelNoticePredicate(arg0, arg1) {
const tmp = closure_25 && Date.now() - arg1 >= closure_20;
return tmp;
}
2026-10-01 14:13:23 +00:00
getFrequentGuilds() {
let queryGuildsResult = null;
if (null != _null) {
queryGuildsResult = _null.queryGuilds("", 100);
}
return queryGuildsResult;
}
2026-10-01 14:13:23 +00:00
getFrequentGuildsLength() {
let num = 0;
if (null != _null) {
num = _null.queryGuilds("", 100).length;
}
return num;
}
2026-10-01 14:13:23 +00:00
getChannelHistory() {
return channelHistory;
}
2026-10-01 14:13:23 +00:00
getLastShowTimestamp() {
return closure_32;
}
getProps() {
let str;
const obj = { theme: ThemeStore.theme, query: str, queryMode, results, selectedIndex, seenTutorial, maxQueryLength };
str = "";
if (null != _null) {
str = _null.query;
}
return obj;
}
}
const prototype = QuickSwitcherStoreClass.prototype;
QuickSwitcherStoreClass.displayName = "QuickSwitcherStore";
QuickSwitcherStoreClass.persistKey = "QuickSwitcherStore";
2026-10-01 14:13:23 +00:00
let obj = {
CONNECTION_OPEN: handleConnectionOpen,
CONNECTION_OPEN_SUPPLEMENTAL: handleConnectionOpen,
QUICKSWITCHER_SHOW: handleQuickSwitcherShow,
SHOW_ACTION_SHEET_QUICK_SWITCHER: handleQuickSwitcherShow,
QUICKSWITCHER_HIDE: handleQuickSwitcherHide,
OVERLAY_SET_INPUT_LOCKED: handleQuickSwitcherHide,
HIDE_ACTION_SHEET_QUICK_SWITCHER: handleQuickSwitcherHide,
QUICKSWITCHER_SEARCH: function handleQuickSwitcherSearch(arg0) {
2026-10-01 14:13:23 +00:00
let obj2;
let query;
({ query, queryMode } = arg0);
const trimmed = query.trim();
if (null == _null) {
return false;
} else {
if (queryMode !== queryMode) {
2026-10-01 14:13:23 +00:00
let tmp6;
if (null == queryMode) {
2026-10-01 14:13:23 +00:00
const items = [, , , , , , , ];
const setResultTypes2 = _null.setResultTypes;
2026-10-12 16:32:48 +00:00
items[0] = _mod8700.AutocompleterResultTypes.USER;
items[1] = _mod8700.AutocompleterResultTypes.GROUP_DM;
items[2] = _mod8700.AutocompleterResultTypes.TEXT_CHANNEL;
items[3] = _mod8700.AutocompleterResultTypes.GUILD;
items[4] = _mod8700.AutocompleterResultTypes.APPLICATION;
items[5] = _mod8700.AutocompleterResultTypes.GAME_PROFILE;
items[6] = _mod8700.AutocompleterResultTypes.LINK;
items[7] = _mod8700.AutocompleterResultTypes.IN_APP_NAVIGATION;
2026-10-01 14:13:23 +00:00
setResultTypes2(items);
tmp6 = require;
} else {
2026-10-12 16:32:48 +00:00
const tmp2 = queryMode === _mod8700.AutocompleterResultTypes.USER || queryMode === _mod8700.AutocompleterResultTypes.USER_GLOBAL;
if (tmp2) {
2026-10-12 16:32:48 +00:00
const items1 = [_mod8700.AutocompleterResultTypes.USER];
2026-10-01 14:13:23 +00:00
_null.setResultTypes(items1);
tmp6 = tmp31;
} else {
const items2 = [queryMode];
2026-10-01 14:13:23 +00:00
_null.setResultTypes(items2);
tmp6 = tmp31;
}
}
let num = 5;
2026-10-01 14:13:23 +00:00
const setLimit = _null.setLimit;
if (null != queryMode) {
num = 100;
}
2026-10-01 14:13:23 +00:00
setLimit(num);
const guildId = SelectedGuildStore.getGuildId();
2026-10-12 16:32:48 +00:00
if (queryMode === tmp6(8700).AutocompleterResultTypes.USER) {
if (null != guildId) {
2026-10-01 14:13:23 +00:00
const obj = { userFilters: obj2 };
obj2 = { guild: guildId, friends: true };
_null.setOptions(obj, true);
}
}
2026-10-12 16:32:48 +00:00
if (queryMode === tmp6(8700).AutocompleterResultTypes.VOICE_CHANNEL) {
_null.setOptions({ voiceChannelGuildFilter: null }, true);
} else {
2026-10-12 16:32:48 +00:00
_null.setOptions({ userFilters: null, voiceChannelGuildFilter: "r" }, true);
}
}
2026-10-12 16:32:48 +00:00
if (queryMode === _mod8700.AutocompleterResultTypes.USER) {
let guildId1 = SelectedGuildStore.getGuildId();
if (guildId1 == null) {
guildId1 = null;
}
_null.search(trimmed, guildId1);
} else {
_null.search(trimmed, undefined);
}
}
},
QUICKSWITCHER_SELECT: function handleQuickSwitcherSelect(selectedIndex) {
selectedIndex = selectedIndex.selectedIndex;
},
QUICKSWITCHER_SWITCH_TO: function handleQuickSwitcherSwitchTo() {
2026-10-01 14:13:23 +00:00
const tmp = c24;
if (tmp) {
return false;
} else {
c24 = true;
const Storage = Storage2.Storage;
const result = Storage.set(seenQSTutorial, true);
}
},
CHANNEL_SELECT: function handleChannelSelect(channelId) {
channelId = channelId.channelId;
if (null == channelId) {
return false;
} else {
2026-10-01 14:13:23 +00:00
const found = channelHistory.filter((item) => item !== channelId);
channelHistory = found;
found.unshift(channelId);
2026-10-01 14:13:23 +00:00
if (channelHistory.length > 8) {
channelHistory.length = 8;
}
}
},
GAME_AUTOCOMPLETE_FETCH_SUCCESS: handleGameAutocompleteSettled,
GAME_AUTOCOMPLETE_FETCH_FAILURE: handleGameAutocompleteSettled
2026-10-01 14:13:23 +00:00
};
const quickSwitcherStoreClass = new QuickSwitcherStoreClass(DispatcherDefault, obj);
let result = size.fileFinishedImporting("modules/quickswitcher/QuickSwitcherStore.tsx");
export default quickSwitcherStoreClass;
export { generateResultFromId };