decord/source/modules/guild_settings/GuildSettingsModalChannelsStore.tsx

355 lines
11 KiB
TypeScript
Raw Normal View History

2026-08-13 17:34:28 +00:00
// Module ID: 15340
// Function ID: 15341
2026-07-29 08:29:29 +00:00
// Name: sortCategoryList
2026-08-13 07:00:46 +00:00
// Dependencies: [109, 1395, 1980, 3989, 676, 5295, 1913, 12, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-13 17:34:28 +00:00
// Module 15340 (sortCategoryList)
2026-07-23 10:11:24 +00:00
import _objectWithoutProperties from "_objectWithoutProperties";
2026-07-29 08:29:29 +00:00
import createChannelRecord from "createChannelRecord";
import comparator from "comparator";
2026-08-07 06:50:47 +00:00
import closure_9 from "comparator";
2026-07-29 08:29:29 +00:00
import getUncachedChannelPermissions from "getUncachedChannelPermissions";
2026-07-23 10:11:24 +00:00
import ME from "ME";
2026-07-29 08:29:29 +00:00
import { Store } from "initialize";
2026-07-23 10:11:24 +00:00
import importDefaultResult from "apply";
2026-07-29 08:29:29 +00:00
let c5;
2026-08-07 06:50:47 +00:00
let closure_12;
2026-07-29 08:29:29 +00:00
let closure_6;
let error;
2026-08-07 06:50:47 +00:00
let metroImportAll;
2026-07-29 08:29:29 +00:00
let unpackModuleId;
2026-08-07 06:50:47 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function sortCategoryList(channel, channel2) {
channel = channel.channel;
const type = channel.type;
channel2 = channel2.channel;
const type2 = channel2.type;
if (type !== type2) {
2026-07-29 08:29:29 +00:00
if (!callback(type)) {
if (callback2(type)) {
2026-07-20 16:05:17 +00:00
return num;
}
2026-07-23 10:11:24 +00:00
num = 1;
2026-07-20 16:05:17 +00:00
if (type === constants.GUILD_TEXT) {
num = -1;
}
2026-07-29 08:29:29 +00:00
const tmp2 = callback2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmp = callback;
2026-07-20 16:05:17 +00:00
}
num = channel.position - channel2.position;
}
function setIndex(arg0, index) {
arg0.index = index;
}
function buildSortedChannels() {
const _null = { _categories: [], null: [] };
2026-08-07 06:50:47 +00:00
const keys = Object.keys(closure_19);
2026-07-20 16:05:17 +00:00
const item = keys.forEach((arg0) => {
2026-07-29 08:29:29 +00:00
if (null != table[arg0]) {
2026-07-20 16:05:17 +00:00
if (null != _categories) {
2026-07-29 08:29:29 +00:00
if (tmp.type === constants.GUILD_CATEGORY) {
2026-07-23 10:11:24 +00:00
_categories = _categories._categories;
2026-07-29 08:29:29 +00:00
let obj = { channel: null, index: -1 };
obj[0] = tmp;
2026-07-20 16:05:17 +00:00
let arr = _categories.push(obj);
if (null == _categories[tmp.id]) {
_categories[tmp.id] = [];
}
} else {
2026-07-29 08:29:29 +00:00
let str = tmp.parent_id;
if (str == null) {
str = "null";
2026-07-20 16:05:17 +00:00
}
const StringResult = String(str);
if (null == _categories[StringResult]) {
_categories[StringResult] = [];
}
arr = _categories[StringResult];
2026-07-29 08:29:29 +00:00
obj = { channel: null, index: -1 };
obj[0] = tmp;
2026-07-20 16:05:17 +00:00
arr = arr.push(obj);
}
}
}
});
let _categories = _null._categories;
2026-07-23 10:11:24 +00:00
let sorted = _categories.sort(sortCategoryList);
2026-07-20 16:05:17 +00:00
_categories = _null._categories;
const item1 = _categories.forEach((channel) => {
channel = channel.channel;
2026-07-23 10:11:24 +00:00
if (null != _categories) {
2026-07-20 16:05:17 +00:00
if (null != channel) {
2026-07-23 10:11:24 +00:00
if (null != _categories[channel.id]) {
2026-08-07 06:50:47 +00:00
const sorted = obj.sort(closure_20);
2026-07-20 16:05:17 +00:00
}
}
}
});
2026-08-13 07:00:46 +00:00
const item2 = importDefault(5295)(_null._categories, _null).forEach(setIndex);
2026-07-29 08:29:29 +00:00
if (null != _null) {
2026-08-13 07:00:46 +00:00
const arr4 = importDefault(5295)(_null._categories, _null, (channel) => {
2026-07-29 08:29:29 +00:00
channel = channel.channel;
let tmp = channel.type === constants.GUILD_CATEGORY;
if (!tmp) {
let hasItem = null != _null;
if (hasItem) {
hasItem = _null.has(channel.type);
}
tmp = hasItem;
}
return tmp;
});
2026-08-07 06:50:47 +00:00
let closure_14 = arr4.map((channel) => channel.channel.id);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
2026-08-07 06:50:47 +00:00
let closure_3 = ["lock_permissions", "id"];
({ isGuildSelectableChannelType: c5, isGuildVocalChannelType: closure_6 } = createChannelRecord);
({ GUILD_SELECTABLE_CHANNELS_KEY: error, GUILD_VOCAL_CHANNELS_KEY: metroImportAll } = comparator);
({ ChannelTypes: unpackModuleId, Permissions: closure_12 } = ME);
2026-07-29 08:29:29 +00:00
let c13 = null;
let c14 = null;
let c15 = null;
let c16 = null;
let c17 = null;
2026-08-07 06:50:47 +00:00
let c18 = null;
let closure_19 = {};
let closure_23 = require("apply").debounce(() => {
const channels = store.getChannels(c13);
2026-07-29 08:29:29 +00:00
if (channels !== channels) {
2026-08-07 06:50:47 +00:00
let closure_19 = {};
const item = channels[closure_7].forEach((channel) => {
2026-07-20 16:05:17 +00:00
channel = channel.channel;
2026-08-07 06:50:47 +00:00
closure_19[channel.id] = channel;
2026-07-20 16:05:17 +00:00
return channel;
});
2026-08-07 06:50:47 +00:00
const item1 = channels[closure_8].forEach((channel) => {
2026-07-20 16:05:17 +00:00
channel = channel.channel;
2026-08-07 06:50:47 +00:00
closure_19[channel.id] = channel;
2026-07-20 16:05:17 +00:00
return channel;
});
2026-08-11 06:20:06 +00:00
_require = _require(1913).isFavoritesGuildId(c13);
2026-07-23 10:11:24 +00:00
const item2 = channels[constants.GUILD_CATEGORY].forEach((channel) => {
2026-07-20 16:05:17 +00:00
channel = channel.channel;
2026-08-07 06:50:47 +00:00
let canResult = "null" === channel.id || closure_0;
2026-07-20 16:05:17 +00:00
if (!canResult) {
2026-08-07 06:50:47 +00:00
canResult = outer1_10.can(outer1_12.VIEW_CHANNEL, channel);
2026-07-20 16:05:17 +00:00
}
if (canResult) {
2026-08-07 06:50:47 +00:00
closure_19[channel.id] = channel;
2026-07-20 16:05:17 +00:00
}
});
buildSortedChannels();
2026-08-07 06:50:47 +00:00
const arr = channels[closure_7];
const arr2 = channels[closure_8];
2026-07-29 08:29:29 +00:00
const arr3 = channels[constants.GUILD_CATEGORY];
2026-08-11 06:20:06 +00:00
const obj = _require(1913);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
guildSettingsModalChannelsStoreClass.emitChange();
}, 500);
class GuildSettingsModalChannelsStoreClass extends Store {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = GuildSettingsModalChannelsStoreClass.prototype;
prototype["initialize"] = function initialize() {
2026-08-07 06:50:47 +00:00
this.waitFor(closure_9, getUncachedChannelPermissions);
const items = [closure_9];
2026-07-29 08:29:29 +00:00
this.syncWith(items, () => {
callback();
return false;
});
};
2026-08-07 06:50:47 +00:00
prototype["initGuild"] = function initGuild(closure_6) {
let closure_13 = closure_6;
let _require;
const channels = store.getChannels(closure_13);
2026-07-29 08:29:29 +00:00
if (channels !== channels) {
2026-08-07 06:50:47 +00:00
let closure_19 = {};
const item = channels[closure_7].forEach((channel) => {
2026-07-20 16:05:17 +00:00
channel = channel.channel;
2026-08-07 06:50:47 +00:00
closure_19[channel.id] = channel;
2026-07-29 08:29:29 +00:00
return channel;
2026-07-20 16:05:17 +00:00
});
2026-08-07 06:50:47 +00:00
const item1 = channels[closure_8].forEach((channel) => {
2026-07-29 08:29:29 +00:00
channel = channel.channel;
2026-08-07 06:50:47 +00:00
closure_19[channel.id] = channel;
2026-07-29 08:29:29 +00:00
return channel;
});
2026-08-11 06:20:06 +00:00
_require = _require(1913).isFavoritesGuildId(closure_13);
2026-07-29 08:29:29 +00:00
const item2 = channels[constants.GUILD_CATEGORY].forEach((channel) => {
channel = channel.channel;
2026-08-07 06:50:47 +00:00
let canResult = "null" === channel.id || closure_0;
2026-07-29 08:29:29 +00:00
if (!canResult) {
2026-08-07 06:50:47 +00:00
canResult = outer1_10.can(outer1_12.VIEW_CHANNEL, channel);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (canResult) {
2026-08-07 06:50:47 +00:00
closure_19[channel.id] = channel;
2026-07-29 08:29:29 +00:00
}
});
buildSortedChannels();
2026-08-07 06:50:47 +00:00
const arr = channels[closure_7];
const arr2 = channels[closure_8];
2026-07-29 08:29:29 +00:00
const arr3 = channels[constants.GUILD_CATEGORY];
2026-08-11 06:20:06 +00:00
const obj = _require(1913);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
Object.defineProperty(prototype, "channels", {
get: function channels(c0) {
2026-08-07 06:50:47 +00:00
return c15;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
Object.defineProperty(prototype, "order", {
get: function order() {
2026-08-07 06:50:47 +00:00
return c14;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
Object.defineProperty(prototype, "sortingType", {
get: function sortingType(arg0) {
2026-08-07 06:50:47 +00:00
return c17;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
Object.defineProperty(prototype, "channelList", {
get: function channelList() {
2026-08-07 06:50:47 +00:00
return c18;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
prototype["getLocalChannel"] = function getLocalChannel(id) {
return table[id];
};
GuildSettingsModalChannelsStoreClass.displayName = "GuildSettingsModalChannelsStore";
const guildSettingsModalChannelsStoreClass = new GuildSettingsModalChannelsStoreClass(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
GUILD_SETTINGS_MODAL_CHANNELS_TERMINATE: function handleTerminate() {
2026-07-29 08:29:29 +00:00
let c13 = null;
let c14 = null;
let c15 = null;
2026-08-07 06:50:47 +00:00
let c17 = null;
let c18 = null;
let c16 = null;
2026-07-20 16:05:17 +00:00
},
GUILD_SETTINGS_MODAL_CHANNELS_START_REORDER: function handleStartReorder(sortingType) {
sortingType = sortingType.sortingType;
2026-07-29 08:29:29 +00:00
if (null == _null) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const _Set = Set;
const set = new Set(sortingType);
2026-07-29 08:29:29 +00:00
if (null != _null) {
2026-08-13 07:00:46 +00:00
const arr = importDefault(5295)(_null._categories, _null, (channel) => {
2026-07-29 08:29:29 +00:00
channel = channel.channel;
let tmp = channel.type === constants.GUILD_CATEGORY;
if (!tmp) {
let hasItem = null != _null;
if (hasItem) {
hasItem = _null.has(channel.type);
}
tmp = hasItem;
}
return tmp;
});
2026-08-07 06:50:47 +00:00
let closure_14 = arr.map((channel) => channel.channel.id);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
},
GUILD_SETTINGS_MODAL_CHANNELS_STOP_REORDER: function handleStopReorder() {
2026-08-07 06:50:47 +00:00
let c17 = null;
2026-07-29 08:29:29 +00:00
if (null != _null) {
2026-08-13 07:00:46 +00:00
const arr = importDefault(5295)(_null._categories, _null, (channel) => {
2026-07-29 08:29:29 +00:00
channel = channel.channel;
let tmp = channel.type === constants.GUILD_CATEGORY;
if (!tmp) {
let hasItem = null != _null;
if (hasItem) {
hasItem = _null.has(channel.type);
}
tmp = hasItem;
}
return tmp;
});
2026-08-07 06:50:47 +00:00
let closure_14 = arr.map((channel) => channel.channel.id);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
},
GUILD_SETTINGS_MODAL_LOCAL_SORT_CHANGE: function handleLocalSortChange(updates) {
updates = updates.updates;
const item = updates.forEach((id) => {
let lock_permissions;
2026-07-29 08:29:29 +00:00
if (null != dependencyMap[id.id]) {
2026-07-20 16:05:17 +00:00
({ lock_permissions, id } = id);
2026-08-07 06:50:47 +00:00
dependencyMap[id.id] = dependencyMap[id.id].merge(callback(id, closure_3));
2026-07-29 08:29:29 +00:00
const obj = dependencyMap[id.id];
2026-07-20 16:05:17 +00:00
}
});
buildSortedChannels();
}
});
2026-07-23 10:11:24 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
GUILD_SETTINGS_MODAL_CHANNELS_TERMINATE: function handleTerminate() {
2026-07-29 08:29:29 +00:00
let c13 = null;
let c14 = null;
let c15 = null;
2026-08-07 06:50:47 +00:00
let c17 = null;
let c18 = null;
let c16 = null;
2026-07-20 16:05:17 +00:00
},
GUILD_SETTINGS_MODAL_CHANNELS_START_REORDER: function handleStartReorder(sortingType) {
sortingType = sortingType.sortingType;
2026-07-29 08:29:29 +00:00
if (null == _null) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const _Set = Set;
const set = new Set(sortingType);
2026-07-29 08:29:29 +00:00
if (null != _null) {
2026-08-13 07:00:46 +00:00
const arr = importDefault(5295)(_null._categories, _null, (channel) => {
2026-07-29 08:29:29 +00:00
channel = channel.channel;
let tmp = channel.type === constants.GUILD_CATEGORY;
if (!tmp) {
let hasItem = null != _null;
if (hasItem) {
hasItem = _null.has(channel.type);
}
tmp = hasItem;
}
return tmp;
});
2026-08-07 06:50:47 +00:00
let closure_14 = arr.map((channel) => channel.channel.id);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
},
GUILD_SETTINGS_MODAL_CHANNELS_STOP_REORDER: function handleStopReorder() {
2026-08-07 06:50:47 +00:00
let c17 = null;
2026-07-29 08:29:29 +00:00
if (null != _null) {
2026-08-13 07:00:46 +00:00
const arr = importDefault(5295)(_null._categories, _null, (channel) => {
2026-07-29 08:29:29 +00:00
channel = channel.channel;
let tmp = channel.type === constants.GUILD_CATEGORY;
if (!tmp) {
let hasItem = null != _null;
if (hasItem) {
hasItem = _null.has(channel.type);
}
tmp = hasItem;
}
return tmp;
});
2026-08-07 06:50:47 +00:00
let closure_14 = arr.map((channel) => channel.channel.id);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
},
GUILD_SETTINGS_MODAL_LOCAL_SORT_CHANGE: function handleLocalSortChange(updates) {
updates = updates.updates;
const item = updates.forEach((id) => {
let lock_permissions;
2026-07-29 08:29:29 +00:00
if (null != dependencyMap[id.id]) {
2026-07-20 16:05:17 +00:00
({ lock_permissions, id } = id);
2026-08-07 06:50:47 +00:00
dependencyMap[id.id] = dependencyMap[id.id].merge(callback(id, closure_3));
2026-07-29 08:29:29 +00:00
const obj = dependencyMap[id.id];
2026-07-20 16:05:17 +00:00
}
});
buildSortedChannels();
}
};
2026-07-29 08:29:29 +00:00
const result = require("comparator").fileFinishedImporting("modules/guild_settings/GuildSettingsModalChannelsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default guildSettingsModalChannelsStoreClass;