Files
discord-decomp/sources/stores/GuildChannelStore.tsx
T
2026-07-27 16:20:00 +03:00

839 lines
35 KiB
TypeScript

/* Metro module 1935; source: stores/GuildChannelStore.tsx; dependencies: [6, 7, 15, 17, 18, 1936, 1382, 3783, 1383, 1226, 1379, 1945, 1867, 3784, 3793, 1878, 661, 22, 4805, 483, 3789, 566, 694, 2] */
function _fun21407(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#21407, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:6, offset: 0x00eefe33, size: 930 bytes, params: 8, frame: 29
var object2;
const env0_0 = require;
const _arrayLikeToArray_21413 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const closure = createGuildChannelList;
const comparator = function({comparator}, a1) {
return comparator - a1.comparator;
};
const closure2 = BACKGROUND_SYNC_21419;
const closure3 = GUILD_CREATE_21424;
const closure4 = CHANNEL_CREATE_21425;
const closure5 = GUILD_ROLE_CREATE;
const hasElevatedPermissions = function(a0, a1) {
return importAll(dependencyMap[19]).hasAny(importAll(dependencyMap[20]).computePermissions({user: a0,
context: a1,
checkElevated: false}), ElevatedPermissions);
};
const handleFavoritesUpdate_21429 = function() {
rebuildGuildChannels(FAVORITES);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = importDefault(6) /* metro dependency 6 */;
const env0_5 = importDefault(7) /* metro dependency 7 */;
const env0_6 = importDefault(15) /* metro dependency 15 */;
const env0_7 = importDefault(17) /* metro dependency 17 */;
const env0_8 = importDefault(18) /* metro dependency 18 */;
const gatedChannelStore = importDefault(1936) /* metro dependency 1936: GatedChannelStore */;
const favoriteStore = importDefault(1382) /* metro dependency 1382: FavoriteStore */;
const env0_11 = (require(3783) /* metro dependency 3783: createFavoritesChannelRecord */).createFavoritesChannelRecord;
let value = require(1383) /* metro dependency 1383: ChannelRecord */;
const env0_12 = value.isGuildSelectableChannelType;
const env0_13 = value.GUILD_NON_CATEGORY_CHANNEL_TYPES;
const env0_14 = value.isGuildVocalChannelType;
const createChannelRecord = value.createChannelRecord;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
value = require(661) /* metro dependency 661: Constants */;
const env0_22 = value.FAVORITES;
const ChannelTypes = value.ChannelTypes;
const env0_24 = value.Permissions;
const env0_25 = value.ElevatedPermissions;
const NULL_STRING_GUILD_ID = value.NULL_STRING_GUILD_ID;
const NULL_STRING_CHANNEL_ID = value.NULL_STRING_CHANNEL_ID;
const env0_29 = {};
const env0_30 = {};
const env0_31 = {};
const env0_33 = {};
object2 = {comparator: -1};
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
object2.channel = createChannelRecord({id: NULL_STRING_CHANNEL_ID, type: GUILD_CATEGORY, name: 'Uncategorized'});
const env0_35 = closure(NULL_STRING_GUILD_ID);
const env0_36 = [];
const env0_37 = {};
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun21430(Store).displayName = 'GuildChannelStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {BACKGROUND_SYNC: closure2,
CHANNEL_SELECT: CHANNEL_SELECT_21453, CONNECTION_OPEN: closure2, OVERLAY_INITIALIZE: closure2,
CACHE_LOADED_LAZY: closure2, GUILD_CREATE: closure3, GUILD_UPDATE: closure3, GUILD_DELETE: GUILD_DELETE_21454,
GUILD_MEMBER_UPDATE: GUILD_MEMBER_UPDATE, CHANNEL_CREATE: closure4, CHANNEL_DELETE: closure4,
CHANNEL_UPDATES: CHANNEL_UPDATES_21456, GUILD_ROLE_CREATE: closure5, GUILD_ROLE_UPDATE: closure5,
GUILD_ROLE_DELETE: closure5, IMPERSONATE_UPDATE: closure5, IMPERSONATE_STOP: closure5,
VOICE_CHANNEL_SELECT: VOICE_CHANNEL_SELECT_21457, VOICE_CHANNEL_STATUS_UPDATE: function(a0) {
var value2 = ChannelStore.getBasicChannel(a0.id);
if (value2 != null && value2.guild_id != null) {
rebuildGuildChannels(value2.guild_id);
}
}, VOICE_STATE_UPDATES: function({voiceStates}) {
return voiceStates.reduce(_fun21460, false);
}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/GuildChannelStore.tsx');
exports.default = value;
exports.GUILD_SELECTABLE_CHANNELS_KEY = 'SELECTABLE';
exports.GUILD_VOCAL_CHANNELS_KEY = 'VOCAL';
}
function _isNativeReflectConstruct_21408() { // fn#21408, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:554, offset: 0x00ef01d5, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_21408_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_21411(a0, a1) { // fn#21411, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:747, offset: 0x00ef0233, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun21412;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_21413(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_21413(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_21413(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun21412;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function createGuildChannelList(a0) { // fn#21414, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:1837, offset: 0x00ef03a5, size: 78 bytes, params: 2, frame: 4
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
return {id: a0, [env0_26]: [], [env0_27]: [], [GUILD_CATEGORY]: [env0_34], ['count']: 0};
}
function getChannelsForGuild(a0) { // fn#21416, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:1992, offset: 0x00ef040b, size: 186 bytes, params: 2, frame: 24
var r5;
var object2;
var propertyName;
var position;
var favoriteChannels;
var propertyName3;
var channel;
var property;
var favoritesChannelRecord;
var mutableGuildChannelsForGuild;
if (a0 === FAVORITES) {
object2 = {};
favoriteChannels = FavoriteStore.getFavoriteChannels();
for (propertyName in favoriteChannels) {
channel = ChannelStore.getChannel(propertyName);
if (channel == null) {
r5 = propertyName3;
continue;
}
property = favoriteChannels[propertyName];
favoritesChannelRecord = createFavoritesChannelRecord(favoriteChannels, property, channel);
position = favoritesChannelRecord.position;
object2[propertyName] = {channel: favoritesChannelRecord, comparator: position};
r5 = propertyName3;
}
} else {
object2 = {};
mutableGuildChannelsForGuild = ChannelStore.getMutableGuildChannelsForGuild(a0);
for (propertyName in mutableGuildChannelsForGuild) {
position = mutableGuildChannelsForGuild[propertyName].position;
object2[propertyName] = {channel: mutableGuildChannelsForGuild[propertyName], comparator: position};
}
}
return object2;
}
function rebuildChannels(a0) { // fn#21417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:2356, offset: 0x00ef04c5, size: 70 bytes, params: 2, frame: 16
const env0_0 = a0;
(importDefault(22) /* metro dependency 22 */).forEach(getChannelsForGuild(a0.id), _fun21418);
return a0;
}
function BACKGROUND_SYNC_21419() { // fn#21419, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:2727, offset: 0x00ef0627, size: 56 bytes, params: 1, frame: 11
env0_29 = {};
env0_33 = {};
env0_30 = {};
env0_31 = {};
if (env0_28 != null) {
rebuildGuildChannels(env0_28);
}
}
function rebuildGuildChannels(a0) { // fn#21420, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:2813, offset: 0x00ef065f, size: 137 bytes, params: 2, frame: 16
const guildChannelList = createGuildChannelList(a0);
env0_29[a0] = guildChannelList;
env0_33[a0] = [];
rebuildChannels(guildChannelList);
const property = guildChannelList[env0_26];
const sort = property.sort;
const comparatorBinding = comparator;
Reflect.apply(sort, property, [comparatorBinding]);
guildChannelList[env0_27].sort(comparatorBinding);
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
guildChannelList[GUILD_CATEGORY].sort(comparatorBinding);
rebuildDisambiguations(guildChannelList);
rebuildGuildElevatedPermissions(a0);
return guildChannelList;
}
function GUILD_CREATE_21424({guild}) { // fn#21424, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:3809, offset: 0x00ef08e3, size: 55 bytes, params: 2, frame: 12
const id = guild.id;
if (id == null) {
return false;
}
env0_29[id] = undefined;
if (env0_28 === id) {
rebuildGuildChannels(id);
}
}
function CHANNEL_CREATE_21425({channel}) { // fn#21425, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:3916, offset: 0x00ef091a, size: 55 bytes, params: 2, frame: 12
const guild_id = channel.guild_id;
if (guild_id == null) {
return false;
}
env0_29[guild_id] = undefined;
if (guild_id === env0_28) {
rebuildGuildChannels(guild_id);
}
}
function GUILD_ROLE_CREATE({guildId}) { // fn#21426, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:4032, offset: 0x00ef0951, size: 40 bytes, params: 2, frame: 12
env0_29[guildId] = undefined;
if (guildId === env0_28) {
rebuildGuildChannels(guildId);
}
}
function updateSelectedVoiceChannel(a0, a1) { // fn#21428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:4249, offset: 0x00ef09d2, size: 86 bytes, params: 3, frame: 14
var r0;
var value6;
env0_32 = a1;
const value2 = null;
const value3 = undefined;
const r1 = value2 == a0 ? value3 : a0.getGuildId();
const r3 = value2 != r1 ? r1 : value2;
const value5 = value2 != r3;
if (value5) {
env0_29[r3] = value3;
value6 = true;
if (r3 !== env0_28) {
r0 = value6;
} else {
rebuildGuildChannels(r3);
r0 = value6;
}
} else {
r0 = value5;
}
return r0;
}
function _fun21430(a0) { // fn#21430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:4480, offset: 0x00ef0a3c, size: 423 bytes, params: 2, frame: 16
const closure = GuildChannelStore;
env0_8(closure, a0);
return env0_5(closure, [{key: 'initialize', value: function() {
this.waitFor(AuthenticationStore, ChannelStore, FavoriteStore, GatedChannelStore, GuildMemberStore, GuildStore,
PermissionStore, UserStore);
this.syncWith([FavoriteStore], handleFavoritesUpdate_21429);
}}, {key: 'getAllGuilds', value: value_21433}, {key: 'getChannels', value: value_21434},
{key: 'getFirstChannelOfType', value: function(a0, a1, a2) {
value = this.getChannels(a0)[a2].find(a1);
var value2 = null;
return value2 != value ? value.channel : value2;
}}, {key: 'getFirstChannel', value: value_21436}, {key: 'getDefaultChannel', value: function(a0) {
var r4;
var value = a1;
var value2 = a2;
r4 = value !== undefined ? value : false;
var env0_0 = value2 !== undefined ? value2 : Permissions.VIEW_CHANNEL;
return this.getFirstChannel(a0, _fun21438, r4);
}}, {key: 'getSFWDefaultChannel', value: function(a0) {
var r4;
var value = a1;
var value2 = a2;
r4 = value !== undefined ? value : false;
var env0_0 = value2 !== undefined ? value2 : Permissions.VIEW_CHANNEL;
return this.getFirstChannel(a0, _fun21440, r4);
}}, {key: 'getSelectableChannelIds', value: value_21441}, {key: 'getSelectableChannels', value: value_21443},
{key: 'getVocalChannelIds', value: value_21444}, {key: 'getDirectoryChannelIds', value: value_21446},
{key: 'hasSelectableChannel', value: function(a0, a1) {
return this.getSelectableChannelIds(a0).includes(a1);
}}, {key: 'hasElevatedPermissions', value: value_21449}, {key: 'hasChannels', value: function(a0) {
return this.getChannels(a0).count > 0;
}}, {key: 'hasCategories', value: function(a0) {
return this.getChannels(a0)[ChannelTypes.GUILD_CATEGORY].length > 1;
}}, {key: 'getTextChannelNameDisambiguations', value: value_21452}]);
}
function CHANNEL_SELECT_21453({guildId}) { // fn#21453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:6593, offset: 0x00ef0f9a, size: 69 bytes, params: 2, frame: 13
var r1;
var rebuildGuildChannelsBinding;
let value = null;
let r0 = value != guildId ? guildId : value;
const value3 = value != guildId;
if (value3) {
value = value == env0_29[guildId];
if (value) {
rebuildGuildChannelsBinding = rebuildGuildChannels;
value = undefined;
rebuildGuildChannelsBinding(guildId);
r1 = value;
} else {
r1 = value;
}
r0 = r1;
} else {
r0 = value3;
}
return r0;
}
function GUILD_DELETE_21454({guild}) { // fn#21454, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:6908, offset: 0x00ef0fdf, size: 52 bytes, params: 2, frame: 3
const id = guild.id;
delete env0_29[id];
delete env0_30[id];
delete env0_31[id];
delete env0_33[id];
return true;
}
function GUILD_MEMBER_UPDATE({guildId, user}) { // fn#21455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:7030, offset: 0x00ef1013, size: 72 bytes, params: 2, frame: 13
if (AuthenticationStore.getId() !== user.id) {
return false;
}
env0_29[guildId] = undefined;
if (guildId === env0_28) {
rebuildGuildChannels(guildId);
}
}
function CHANNEL_UPDATES_21456({channels}) { // fn#21456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:7242, offset: 0x00ef105b, size: 107 bytes, params: 2, frame: 19
var r2;
var r3;
var r0;
var value5;
var guild_id;
var value6;
var value7;
const value2 = _createForOfIteratorHelperLoose_21411(channels);
const value3 = value2();
let done = value3.done;
if (done) {
r0 = false;
} else {
r2 = false;
r3 = value3;
while (true) {
value5 = r3.value;
guild_id = value5.guild_id;
if (guild_id != null) {
env0_29[guild_id] = undefined;
value6 = true;
if (env0_28 !== guild_id) {
r2 = value6;
break;
}
rebuildGuildChannels(guild_id);
r2 = value6;
break;
}
value7 = value2();
done = value7.done;
if (done) {
r0 = r2;
break;
}
r3 = value7;
continue;
}
}
return r0;
}
function VOICE_CHANNEL_SELECT_21457({channelId}) { // fn#21457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:7667, offset: 0x00ef10c6, size: 88 bytes, params: 2, frame: 15
var r0;
var value;
var updateSelectedVoiceChannelBinding;
if (channelId != null) {
updateSelectedVoiceChannelBinding = updateSelectedVoiceChannel;
value = ChannelStore.getChannel(channelId);
value = updateSelectedVoiceChannelBinding(value, channelId);
r0 = value;
} else if (env0_32 != null) {
updateSelectedVoiceChannelBinding = updateSelectedVoiceChannel;
value = ChannelStore.getChannel(env0_32);
value = updateSelectedVoiceChannelBinding(value, null);
r0 = value;
} else {
updateSelectedVoiceChannelBinding = updateSelectedVoiceChannel;
value = ChannelStore.getChannel(channelId);
value = updateSelectedVoiceChannelBinding(value, channelId);
r0 = value;
}
return r0;
}
function VOICE_STATE_UPDATES_21459({voiceStates}) { // fn#21459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:8018, offset: 0x00ef1161, size: 32 bytes, params: 2, frame: 13
return voiceStates.reduce(function(a0, a1) {
var value = a0;
var channelId = a1.channelId;
return AuthenticationStore.getSessionId() !== a1.sessionId ? value : updateSelectedVoiceChannel(ChannelStore.getChannel(channelId),
channelId) || value;
}, false);
}
function _fun21418(a0) { // fn#21418, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:2447, offset: 0x00ef050b, size: 284 bytes, params: 2, frame: 17
var r1;
const channel = a0.channel;
let binding = env0_0;
binding.count = binding.count + 1;
const has = GUILD_NON_CATEGORY_CHANNEL_TYPES.has;
let type = channel.type;
if (Reflect.apply(has, GUILD_NON_CATEGORY_CHANNEL_TYPES, [type])) {
if (PermissionStore.can(Permissions.VIEW_CHANNEL, channel)) {
type = channel.type;
r1 = isGuildSelectableChannelType(type) ? env1_26 : isGuildVocalChannelType(type) ? env1_27 : type;
type = channel.type;
if (type === ChannelTypes.GUILD_DIRECTORY) {
binding = env1_33;
if (binding[id] == null) {
env1_33[id] = [];
}
binding = env1_33;
binding[id].push(a0);
}
if (env0_0[r1] != null) {
env0_0[r1].push(a0);
}
} else if (GatedChannelStore.isChannelGated(channel.guild_id, channel.id)) {
type = channel.type;
r1 = isGuildSelectableChannelType(type) ? env1_26 : isGuildVocalChannelType(type) ? env1_27 : type;
type = channel.type;
if (type === ChannelTypes.GUILD_DIRECTORY) {
binding = env1_33;
if (binding[id] == null) {
env1_33[id] = [];
}
binding = env1_33;
binding[id].push(a0);
}
if (env0_0[r1] != null) {
env0_0[r1].push(a0);
}
} else if (channel.id === env1_32) {
type = channel.type;
r1 = isGuildSelectableChannelType(type) ? env1_26 : isGuildVocalChannelType(type) ? env1_27 : type;
type = channel.type;
if (type === ChannelTypes.GUILD_DIRECTORY) {
binding = env1_33;
if (binding[id] == null) {
env1_33[id] = [];
}
binding = env1_33;
binding[id].push(a0);
}
if (env0_0[r1] != null) {
env0_0[r1].push(a0);
}
}
} else {
type = channel.type;
r1 = isGuildSelectableChannelType(type) ? env1_26 : isGuildVocalChannelType(type) ? env1_27 : type;
type = channel.type;
if (type === ChannelTypes.GUILD_DIRECTORY) {
binding = env1_33;
if (binding[id] == null) {
env1_33[id] = [];
}
binding = env1_33;
binding[id].push(a0);
}
if (env0_0[r1] != null) {
env0_0[r1].push(a0);
}
}
}
function rebuildDisambiguations(a0) { // fn#21421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:3034, owner: rebuildGuildChannels.rebuildDisambiguations, offset: 0x00ef06e8, size: 60 bytes, params: 2, frame: 14
env1_30[a0.id] = {};
const env0_1 = {};
a0[env1_26].forEach(_fun21422);
}
function rebuildGuildElevatedPermissions(a0) { // fn#21423, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:3286, owner: rebuildGuildChannels.rebuildGuildElevatedPermissions, offset: 0x00ef07e9, size: 250 bytes, params: 2, frame: 20
var r4;
var r5;
var r0;
var hasElevatedPermissionsBinding;
var hasElevatedPermissions2;
var value4;
var property;
var value5;
var property2;
var value6;
var value7;
var done;
var value8;
var channel;
var hasElevatedPermissions3;
var value9;
var value10;
var value11;
var value12;
var value13;
var value14;
var hasElevatedPermissions4;
var value15;
var value16;
var binding;
const currentUser = UserStore.getCurrentUser();
const guild = GuildStore.getGuild(a0);
reducibleJoin10: while (true) {
reducibleJoin7: while (true) {
if (guild == null) {
property = env1_29[a0];
reducibleJoin4: while (true) {
if (property != null) {
r4 = property;
break reducibleJoin4;
}
value5 = rebuildGuildChannels(a0);
r4 = value5;
break reducibleJoin4;
}
property = r4[env1_26];
property2 = r4[env1_27];
value6 = _createForOfIteratorHelperLoose_21411(property);
value7 = value6();
done = value7.done;
if (!done) {
r5 = value7;
reducibleLoop5: while (true) {
hasElevatedPermissionsBinding = hasElevatedPermissions;
value8 = r5.value;
channel = value8.channel;
hasElevatedPermissions3 = hasElevatedPermissionsBinding(currentUser, channel);
value9 = true;
if (hasElevatedPermissions3) {
r0 = value9;
break reducibleJoin10;
}
value10 = value6();
done = value10.done;
if (done) {
break reducibleJoin7;
}
r5 = value10;
continue reducibleLoop5;
}
binding = env1_31;
if (r0) {
binding[a0] = true;
} else {
delete binding[a0];
}
return undefined;
}
break reducibleJoin7;
}
hasElevatedPermissions2 = hasElevatedPermissions(currentUser, guild);
value4 = true;
if (hasElevatedPermissions2) {
r0 = value4;
break reducibleJoin10;
}
property = env1_29[a0];
reducibleJoin4: while (true) {
if (property != null) {
r4 = property;
break reducibleJoin4;
}
value5 = rebuildGuildChannels(a0);
r4 = value5;
break reducibleJoin4;
}
property = r4[env1_26];
property2 = r4[env1_27];
value6 = _createForOfIteratorHelperLoose_21411(property);
value7 = value6();
done = value7.done;
if (!done) {
r5 = value7;
reducibleLoop5: while (true) {
hasElevatedPermissionsBinding = hasElevatedPermissions;
value8 = r5.value;
channel = value8.channel;
hasElevatedPermissions3 = hasElevatedPermissionsBinding(currentUser, channel);
value9 = true;
if (hasElevatedPermissions3) {
r0 = value9;
break reducibleJoin10;
}
value10 = value6();
done = value10.done;
if (done) {
break reducibleJoin7;
}
r5 = value10;
continue reducibleLoop5;
}
binding = env1_31;
if (r0) {
binding[a0] = true;
} else {
delete binding[a0];
}
return undefined;
}
break reducibleJoin7;
}
value11 = _createForOfIteratorHelperLoose_21411(property2);
value12 = value11();
done = value12.done;
value13 = false;
if (done) {
r0 = value13;
break reducibleJoin10;
}
r4 = value12;
reducibleLoop8: while (true) {
hasElevatedPermissionsBinding = hasElevatedPermissions;
value14 = r4.value;
channel = value14.channel;
hasElevatedPermissions4 = hasElevatedPermissionsBinding(currentUser, channel);
value15 = true;
if (hasElevatedPermissions4) {
r0 = value15;
break reducibleJoin10;
}
value16 = value11();
done = value16.done;
if (done) {
r0 = value13;
break reducibleJoin10;
}
r4 = value16;
continue reducibleLoop8;
}
break reducibleJoin10;
}
binding = env1_31;
if (r0) {
binding[a0] = true;
} else {
delete binding[a0];
}
}
function GuildChannelStore() { // fn#21431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:4492, offset: 0x00ef0be3, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_4(this, GuildChannelStore);
const value3 = env1_7(GuildChannelStore);
return env1_6(this, _isNativeReflectConstruct_21408() ? global.Reflect.construct(value3, arguments,
env1_7(this).constructor) : value3.apply(this, arguments));
}
function value_21434(a0) { // fn#21434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:4952, offset: 0x00ef0cb0, size: 49 bytes, params: 2, frame: 13
return a0 != null ? env1_29[a0] ?? rebuildGuildChannels(a0) : env1_35;
}
function value_21436(a0, a1) { // fn#21436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:5218, offset: 0x00ef0d17, size: 73 bytes, params: 3, frame: 18
let value = a2;
const r3 = value !== undefined ? value : false;
const getFirstChannelOfType = this.getFirstChannelOfType;
value = environment.__proto__;
const value2 = Reflect.apply(getFirstChannelOfType, this, [a0, a1, env1_26]);
const value3 = null;
return value3 != value2 ? value2 : r3 ? this.getFirstChannelOfType(a0, a1, env1_27) : value3;
}
function value_21437(a0) { // fn#21437, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:5370, offset: 0x00ef0d60, size: 63 bytes, params: 2, frame: 16
const value = a1;
const value2 = a2;
const r4 = value !== undefined ? value : false;
const env0_0 = value2 !== undefined ? value2 : Permissions.VIEW_CHANNEL;
return this.getFirstChannel(a0, _fun21438, r4);
}
function value_21439(a0) { // fn#21439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:5497, offset: 0x00ef0dc3, size: 63 bytes, params: 2, frame: 16
const value = a1;
const value2 = a2;
const r4 = value !== undefined ? value : false;
const env0_0 = value2 !== undefined ? value2 : Permissions.VIEW_CHANNEL;
return this.getFirstChannel(a0, _fun21440, r4);
}
function value_21441(a0) { // fn#21441, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:5644, offset: 0x00ef0e37, size: 47 bytes, params: 2, frame: 11
return this.getChannels(a0)[env1_26].map(function(a0) {
return a0.channel.id;
});
}
function value_21443(a0) { // fn#21443, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:5750, offset: 0x00ef0e75, size: 30 bytes, params: 2, frame: 11
return this.getChannels(a0)[env1_26];
}
function value_21444(a0) { // fn#21444, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:5826, offset: 0x00ef0e93, size: 47 bytes, params: 2, frame: 11
return this.getChannels(a0)[env1_27].map(function(a0) {
return a0.channel.id;
});
}
function value_21446(a0) { // fn#21446, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:5933, offset: 0x00ef0ec2, size: 52 bytes, params: 2, frame: 14
let r0 = env1_33[a0]?.map(function(a0) {
return a0.channel.id;
});
r0 = r0 ?? env1_36;
return r0;
}
function value_21449(a0) { // fn#21449, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:6164, offset: 0x00ef0f16, size: 21 bytes, params: 2, frame: 2
const value = environment.__proto__;
return env1_31[a0] || false;
}
function value_21452(a0) { // fn#21452, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:6410, offset: 0x00ef0f79, size: 33 bytes, params: 2, frame: 3
return a0 == null ? env1_37 : env1_30[a0] ?? env1_37;
}
function _fun21422({channel}) { // fn#21422, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:3105, offset: 0x00ef0724, size: 197 bytes, params: 2, frame: 18
var r4;
let value = environment.__proto__.__proto__;
value = (require(4805) /* metro dependency 4805: useChannelName */).computeChannelName(channel, UserStore,
RelationshipStore);
const Object = global.Object;
const r6 = Object.prototype.hasOwnProperty.call(env0_1, value) ? env0_1[value] : null;
if (r6 == null) {
env0_1[value] = 1;
r4 = value;
} else {
env0_1[value] = r6 + 1;
value += '~' + r6;
r4 = value;
}
env0_0[channel.id] = {id: channel.id, name: r4};
}
function _fun21438({channel}) { // fn#21438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:5435, offset: 0x00ef0d9f, size: 36 bytes, params: 2, frame: 13
return PermissionStore.can(env0_0, channel);
}
function _fun21440(a0) { // fn#21440, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2062:5562, offset: 0x00ef0e02, size: 53 bytes, params: 2, frame: 14
const value = environment.__proto__.__proto__;
return PermissionStore.can(env0_0, a0.channel) && !a0.channel.nsfw;
}