Files
2026-07-28 01:06:53 +03:00

854 lines
41 KiB
TypeScript

/* Metro module 3784; source: stores/PermissionStore.tsx; dependencies: [6, 7, 15, 17, 18, 1937, 3785, 1384, 3786, 1383, 1422, 1885, 1379, 1945, 1867, 1878, 661, 3788, 3789, 22, 3791, 1418, 483, 3792, 566, 694, 2] */
import ClassCallCheck from '../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Module00022 from '../by-id/module-00022.js'; /* Metro dependency 22 */
import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */
import StageInstanceStore from '../modules/stage_channels/StageInstanceStore.tsx'; /* Metro dependency 1384 */
import GuildStore from './GuildStore.tsx'; /* Metro dependency 1867 */
import UserStore from './UserStore.tsx'; /* Metro dependency 1878 */
import UserRecord from '../records/UserRecord.tsx'; /* Metro dependency 1885 */
import ImpersonateStore from '../modules/impersonate/ImpersonateStore.tsx'; /* Metro dependency 1937 */
import GuildMemberStore from './GuildMemberStore.tsx'; /* Metro dependency 1945 */
import LurkingStore from '../modules/lurker_mode/LurkingStore.tsx'; /* Metro dependency 3785 */
import JoinedThreadsStore from '../modules/threads/JoinedThreadsStore.tsx'; /* Metro dependency 3786 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as BigFlagUtilsModule from '../external/discord_common/js/shared/utils/BigFlagUtils.tsx'; /* Metro dependency 483 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as ChannelRecordModule from '../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
import * as MemberSafetyConstantsModule from '../modules/guild_mod_dash_member_safety/MemberSafetyConstants.tsx'; /* Metro dependency 3788 */
import * as PermissionUtilsModule from '../utils/PermissionUtils.tsx'; /* Metro dependency 3789 */
import * as ThreadActionUtilsModule from '../modules/threads/ThreadActionUtils.tsx'; /* Metro dependency 3791 */
function _fun28667(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#28667, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6, offset: 0x00f7faec, size: 866 bytes, params: 8, frame: 28
const env0_0 = require;
const _arrayLikeToArray_28673 = 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 = function() {
rebuildPermissions();
};
const closure2 = function() {
rebuildPermissions();
};
const closure3 = function(a0) {
var id = a0.user.id;
var value2 = UserStore.getCurrentUser();
var value3 = undefined;
if (id !== (value2 == null ? value3 : value2.id)) {
return false;
}
rebuildPermissions();
return value3;
};
const closure4 = function() {
return true;
};
const closure5 = function({data}) {
return data.some(_fun28684);
};
const GUILD_ROLE_CREATE_286872 = GUILD_ROLE_CREATE_28687;
const STAGE_INSTANCE_CREATE_286892 = STAGE_INSTANCE_CREATE_28689;
const IMPERSONATE_UPDATE_286902 = IMPERSONATE_UPDATE_28690;
const closure9 = function() {
env0_25 = {};
env0_24 = {};
env0_26 = {};
env0_27 = 0;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ChannelRecordModule;
const env0_13 = value.ChannelRecordBase;
const env0_14 = value.THREAD_CHANNEL_TYPES;
value = require(1422) /* metro dependency 1422: GuildRecord */;
const env0_15 = value.isGuildOwner;
const env0_16 = value.isGuildOwnerWithRequiredMfaLevel;
let env0_24 = {};
let env0_25 = {};
let env0_26 = {};
const Store = (Flux).Store;
_fun28694(Store).displayName = 'PermissionStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {BACKGROUND_SYNC: closure,
CONNECTION_OPEN: closure, OVERLAY_INITIALIZE: closure, CACHE_LOADED: closure, CACHE_LOADED_LAZY: closure,
CONNECTION_CLOSED: function() {
LOGOUT_28693();
}, GUILD_CREATE: closure2, GUILD_UPDATE: closure2, GUILD_DELETE: closure2, GUILD_MEMBER_ADD: closure3,
GUILD_MEMBER_UPDATE: closure3, CURRENT_USER_UPDATE: closure3, CHANNEL_CREATE: CHANNEL_CREATE_28714,
THREAD_CREATE: closure4, THREAD_UPDATE: closure4, THREAD_LIST_SYNC: closure4, LOAD_THREADS_SUCCESS: closure4,
LOAD_ARCHIVED_THREADS_SUCCESS: closure4, CHANNEL_UPDATES: CHANNEL_UPDATES_28715,
LOAD_MESSAGES_SUCCESS: function({messages}) {
return messages.some(_fun28717);
}, SEARCH_MESSAGES_SUCCESS: closure5, MOD_VIEW_SEARCH_MESSAGES_SUCCESS: closure5,
THREAD_MEMBER_UPDATE: THREAD_MEMBER_UPDATE, THREAD_MEMBERS_UPDATE: THREAD_MEMBERS_UPDATE_28719,
CHANNEL_DELETE: CHANNEL_DELETE_28720, GUILD_ROLE_CREATE: GUILD_ROLE_CREATE_286872,
GUILD_ROLE_UPDATE: GUILD_ROLE_CREATE_286872, GUILD_ROLE_DELETE: GUILD_ROLE_CREATE_286872, LOGOUT: closure9,
STAGE_INSTANCE_CREATE: STAGE_INSTANCE_CREATE_286892, STAGE_INSTANCE_UPDATE: STAGE_INSTANCE_CREATE_286892,
STAGE_INSTANCE_DELETE: STAGE_INSTANCE_CREATE_286892, IMPERSONATE_UPDATE: IMPERSONATE_UPDATE_286902,
IMPERSONATE_STOP: IMPERSONATE_UPDATE_286902});
(FileImportTrackerModule).fileFinishedImporting('stores/PermissionStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_28668() { // fn#28668, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:433, offset: 0x00f7fe4e, 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_28668_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_28671(a0, a1) { // fn#28671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:626, offset: 0x00f7feac, 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 _fun28672;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_28673(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_28673(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_28673(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun28672;
}
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 _fun28672() { // fn#28672, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:1197, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function _getGuildPermissions(a0) { // fn#28674, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:1559, offset: 0x00f8001e, size: 183 bytes, params: 2, frame: 19
var r2;
var binding;
undefined !== undefined;
var value;
const property = env0_24[a0];
if (property != null) {
return property;
}
const currentUser = UserStore.getCurrentUser();
if (currentUser == null) {
return (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
}
const guild = GuildStore.getGuild(a0);
if (guild == null) {
r2 = (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
} else {
binding = env0_24;
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
value = value.computePermissions({user: currentUser, context: guild, checkElevated: true});
binding[a0] = value;
r2 = value;
}
return r2;
}
function getUncachedChannelPermissions(a0) { // fn#28675, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:1806, offset: 0x00f800d5, size: 312 bytes, params: 2, frame: 21
var r1;
var defaultImport;
let value = a1;
const value2 = undefined;
const r6 = !(value !== value2) || value;
const currentUser = UserStore.getCurrentUser();
if (currentUser == null) {
return (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
}
const channel = ChannelStore.getChannel(a0);
if (channel == null) {
return (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
}
const guildId = channel.getGuildId();
if (channel.isScheduledForDeletion()) {
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
value = value.computePermissions({user: currentUser, context: channel, checkElevated: r6});
r1 = value;
} else if (guildId != null && (LurkingStore.isLurking(guildId) || (GuildMemberStore.getMember(guildId,
currentUser.id) == null ? value2 : GuildMemberStore.getMember(guildId, currentUser.id).isPending))) {
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
value = value.computePermissions({user: currentUser, context: channel, checkElevated: r6});
r1 = value;
} else {
defaultImport = importDefault(22) /* metro dependency 22 */;
if (defaultImport.isEmpty(channel.permissionOverwrites)) {
if (guildId == null) {
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
value = value.computePermissions({user: currentUser, context: channel, checkElevated: r6});
r1 = value;
} else {
r1 = _getGuildPermissions(guildId);
}
} else {
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
value = value.computePermissions({user: currentUser, context: channel, checkElevated: r6});
r1 = value;
}
}
return r1;
}
function _getChannelPermissions(a0) { // fn#28676, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2247, offset: 0x00f8020d, size: 53 bytes, params: 2, frame: 15
var r0;
var binding;
undefined !== undefined;
var uncachedChannelPermissions;
const property = env0_25[a0];
if (property != null) {
r0 = property;
} else {
binding = env0_25;
uncachedChannelPermissions = getUncachedChannelPermissions(a0, true);
binding[a0] = uncachedChannelPermissions;
r0 = uncachedChannelPermissions;
}
return r0;
}
function updateGuildVersion(a0) { // fn#28677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2355, offset: 0x00f80242, size: 47 bytes, params: 2, frame: 5
var binding;
if (a0 != null) {
binding = env0_26;
binding[a0] = (binding[a0] ?? 0) + 1;
}
}
function rebuildPermissions() { // fn#28678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2431, offset: 0x00f80271, size: 76 bytes, params: 1, frame: 10
var propertyName;
var binding2;
env0_24 = {};
env0_25 = {};
for (propertyName in env0_26) {
binding2 = env0_26;
binding2[propertyName] += 1;
}
env0_27 += 1;
}
function MOD_VIEW_SEARCH_MESSAGES_SUCCESS_28683({data}) { // fn#28683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2767, offset: 0x00f8030d, size: 28 bytes, params: 2, frame: 11
return data.some(function(a0) {
return a0.threads.length > 0 || a0.messages.some(_fun28685);
});
function _fun28684({messages, threads}) { // fn#28684, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2829, offset: 0x00f80329, size: 49 bytes, params: 2, frame: 12
return threads.length > 0 || messages.some(function(a0) {
return a0.some(_fun28686);
});
function _fun28685(a0) { // fn#28685, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2875, offset: 0x00f8035a, size: 23 bytes, params: 2, frame: 11
return a0.some(function(a0) {
return a0.thread != null;
});
}
}
}
function GUILD_ROLE_CREATE_28687({guildId}) { // fn#28687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2910, offset: 0x00f80382, size: 100 bytes, params: 2, frame: 16
delete env0_24[guildId];
(Module00022).forEach(ChannelStore.getMutableBasicGuildChannelsForGuild(guildId),
_fun28688);
env0_27 += 1;
updateGuildVersion(guildId);
function _fun28688({id}) { // fn#28688, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:3028, offset: 0x00f803e6, size: 23 bytes, params: 2, frame: 2
delete env1_25[id];
}
}
function STAGE_INSTANCE_CREATE_28689({instance}) { // fn#28689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:3077, offset: 0x00f803fd, size: 148 bytes, params: 2, frame: 15
const channel = ChannelStore.getChannel(instance.channel_id);
if (channel == null) {
return false;
}
const currentUser = UserStore.getCurrentUser();
const permissions = PermissionUtilsModule.computePermissions({user: currentUser, context: channel});
if (permissions === env0_25[channel.id]) {
return false;
}
env0_25[channel.id] = permissions;
env0_27 += 1;
}
function IMPERSONATE_STOP_28690({guildId}) { // fn#28690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:3296, offset: 0x00f80491, size: 100 bytes, params: 2, frame: 16
delete env0_24[guildId];
(Module00022).forEach(ChannelStore.getMutableBasicGuildChannelsForGuild(guildId),
_fun28691);
env0_27 += 1;
updateGuildVersion(guildId);
function _fun28691({id}) { // fn#28691, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:3422, offset: 0x00f803e6, size: 23 bytes, params: 2, frame: 2
delete env1_25[id];
}
}
function _computePermissions(a0, a1, a2, a3) { // fn#28692, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:3471, offset: 0x00f804f5, size: 375 bytes, params: 5, frame: 24
var r0;
var moduleValue2;
var computePermissions;
var object;
var channelStoreBinding;
var value4;
var moduleValue3;
var applyThreadPermissions;
var value5;
var joinedThreadsStoreBinding;
var hasJoined2;
var guildMemberStoreBinding;
const NONE = (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
if (a0 instanceof ChannelRecordBase) {
if (THREAD_CHANNEL_TYPES.has(a0.type)) {
channelStoreBinding = ChannelStore;
value4 = channelStoreBinding.getChannel(a0.parent_id);
if (value4 == null) {
r0 = (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
} else {
moduleValue3 = importAll(3789) /* metro dependency 3789: PermissionUtils */;
applyThreadPermissions = moduleValue3.applyThreadPermissions;
value5 = _computePermissions(value4, a1, a2, a3);
joinedThreadsStoreBinding = JoinedThreadsStore;
hasJoined2 = joinedThreadsStoreBinding.hasJoined(a0.id);
guildMemberStoreBinding = GuildMemberStore;
r0 = Reflect.apply(applyThreadPermissions, moduleValue3, [a0, value5, hasJoined2,
guildMemberStoreBinding.isCurrentUserGuest(a0.guild_id)]);
}
return r0;
}
r0 = _getChannelPermissions(a0.id);
} else {
var moduleValue = require(1418) /* metro dependency 1418: GuildRecordUtils */;
if (moduleValue.isGuildRecord(a0)) {
r0 = _getGuildPermissions(a0.id);
} else {
r0 = NONE;
}
}
if (a1 !== undefined) {
moduleValue2 = importAll(3789) /* metro dependency 3789: PermissionUtils */;
computePermissions = moduleValue2.computePermissions;
object = {};
object.user = UserStore.getCurrentUser();
object.context = a0;
object.overwrites = a1;
object.roles = a2;
object.checkElevated = true;
object.excludeGuildPermissions = a3;
r0 = Reflect.apply(computePermissions, moduleValue2, [object]);
} else if (a2 !== undefined) {
moduleValue2 = importAll(3789) /* metro dependency 3789: PermissionUtils */;
computePermissions = moduleValue2.computePermissions;
object = {};
object.user = UserStore.getCurrentUser();
object.context = a0;
object.overwrites = a1;
object.roles = a2;
object.checkElevated = true;
object.excludeGuildPermissions = a3;
r0 = Reflect.apply(computePermissions, moduleValue2, [object]);
} else if (a3 !== undefined) {
moduleValue2 = importAll(3789) /* metro dependency 3789: PermissionUtils */;
computePermissions = moduleValue2.computePermissions;
object = {};
object.user = UserStore.getCurrentUser();
object.context = a0;
object.overwrites = a1;
object.roles = a2;
object.checkElevated = true;
object.excludeGuildPermissions = a3;
r0 = Reflect.apply(computePermissions, moduleValue2, [object]);
}
return r0;
}
function _fun28694(a0) { // fn#28694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:4020, offset: 0x00f8068b, size: 444 bytes, params: 2, frame: 16
const PermissionStore2 = PermissionStore;
Inherits(PermissionStore2, a0);
return CreateClass(PermissionStore2, [{key: 'initialize', value: function() {
this.waitFor(ChannelStore, GuildMemberStore, GuildStore, ImpersonateStore, JoinedThreadsStore, LurkingStore,
StageInstanceStore, UserStore);
}}, {key: 'getChannelPermissions', value: value_28697}, {key: 'getGuildPermissions', value: function(a0) {
return _getGuildPermissions(a0.id);
}}, {key: 'getGuildPermissionProps', value: value_28699}, {key: 'canAccessMemberSafetyPage', value: function(a0) {
return importAll(dependencyMap[22]).hasAny(_getGuildPermissions(a0.id), MemberSafetyPagePermissions);
}}, {key: 'canAccessGuildSettings', value: value_28701}, {key: 'canWithPartialContext', value: value_28702},
{key: 'can', value: value_28703}, {key: 'canBasicChannel', value: value_28704}, {key: 'computePermissions',
value: function(a0, a1, a2, a3) {
return _computePermissions(a0, a1, a2, a3);
}}, {key: 'computeBasicPermissions', value: value_28706}, {key: 'canManageUser', value: value_28707},
{key: 'getHighestRole', value: value_28708}, {key: 'isRoleHigher', value: value_28709},
{key: 'canImpersonateRole', value: function(a0, a1) {
var value = this.getHighestRole(a0);
return this.can(Permissions.MANAGE_GUILD, a0) && this.can(Permissions.MANAGE_ROLES,
a0) && (this.isRoleHigher(a0,
value, a1) || a1.id === value?.id);
}}, {key: 'getGuildVersion', value: value_28711}, {key: 'getChannelsVersion', value: value_28712}]);
function PermissionStore() { // fn#28695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:4032, offset: 0x00f80847, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_4(this, PermissionStore);
const value3 = env1_7(PermissionStore);
return env1_6(this, _isNativeReflectConstruct_28668() ? global.Reflect.construct(value3, arguments,
env1_7(this).constructor) : value3.apply(this, arguments));
}
function value_28697(a0) { // fn#28697, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:4403, offset: 0x00f808ef, size: 64 bytes, params: 2, frame: 13
const value = environment.__proto__;
return THREAD_CHANNEL_TYPES.has(a0.type) ? getUncachedChannelPermissions(a0.id) : _getChannelPermissions(a0.id);
}
function value_28699(a0) { // fn#28699, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:4621, offset: 0x00f80947, size: 392 bytes, params: 2, frame: 17
const value = environment.__proto__;
const currentUser = UserStore.getCurrentUser();
const object = {};
let can = this.can;
const MANAGE_GUILD = Permissions.MANAGE_GUILD;
object.canManageGuild = Reflect.apply(can, this, [MANAGE_GUILD, a0]);
can = this.can;
const MANAGE_CHANNELS = Permissions.MANAGE_CHANNELS;
object.canManageChannels = Reflect.apply(can, this, [MANAGE_CHANNELS, a0]);
can = this.can;
const MANAGE_ROLES = Permissions.MANAGE_ROLES;
object.canManageRoles = Reflect.apply(can, this, [MANAGE_ROLES, a0]);
can = this.can;
const BAN_MEMBERS = Permissions.BAN_MEMBERS;
object.canManageBans = Reflect.apply(can, this, [BAN_MEMBERS, a0]);
can = this.can;
const MANAGE_NICKNAMES = Permissions.MANAGE_NICKNAMES;
object.canManageNicknames = Reflect.apply(can, this, [MANAGE_NICKNAMES, a0]);
can = this.can;
const MANAGE_GUILD_EXPRESSIONS = Permissions.MANAGE_GUILD_EXPRESSIONS;
object.canManageGuildExpressions = Reflect.apply(can, this, [MANAGE_GUILD_EXPRESSIONS,
a0]) || this.can(Permissions.CREATE_GUILD_EXPRESSIONS, a0);
can = this.can;
let VIEW_AUDIT_LOG = Permissions.VIEW_AUDIT_LOG;
object.canViewAuditLog = Reflect.apply(can, this, [VIEW_AUDIT_LOG, a0]);
can = this.can;
VIEW_AUDIT_LOG = Permissions.VIEW_AUDIT_LOG;
object.canViewAuditLogV2 = Reflect.apply(can, this, [VIEW_AUDIT_LOG, a0]);
can = this.can;
const MANAGE_WEBHOOKS = Permissions.MANAGE_WEBHOOKS;
object.canManageWebhooks = Reflect.apply(can, this, [MANAGE_WEBHOOKS, a0]);
can = this.can;
const VIEW_GUILD_ANALYTICS = Permissions.VIEW_GUILD_ANALYTICS;
object.canViewGuildAnalytics = Reflect.apply(can, this, [VIEW_GUILD_ANALYTICS, a0]);
object.canAccessMembersPage = this.canAccessMemberSafetyPage(a0);
can = this.can;
const ADMINISTRATOR = Permissions.ADMINISTRATOR;
object.isGuildAdmin = Reflect.apply(can, this, [ADMINISTRATOR, a0]);
object.isOwner = currentUser != null && isGuildOwner(a0, currentUser);
object.isOwnerWithRequiredMfaLevel = currentUser != null && isGuildOwnerWithRequiredMfaLevel(a0, currentUser);
object.guild = a0;
return object;
}
function value_28701({id}) { // fn#28701, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:5507, offset: 0x00f80b0b, size: 74 bytes, params: 2, frame: 16
let value = environment.__proto__;
const hasAny = BigFlagUtilsModule.hasAny;
value = _getGuildPermissions(id);
const VIEW_GUILD_SETTINGS = (PermissionUtilsModule).VIEW_GUILD_SETTINGS;
return Reflect.apply(hasAny, BigFlagUtilsModule, [value, VIEW_GUILD_SETTINGS]);
}
function value_28702(a0, a1) { // fn#28702, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:5638, offset: 0x00f80b55, size: 139 bytes, params: 3, frame: 17
var r0;
var value;
var can;
var guildStoreBinding;
var channelStoreBinding;
if ('channelId' in a1) {
if (typeof a1.channelId === 'string') {
can = this.can;
value = environment.__proto__;
channelStoreBinding = ChannelStore;
value = Reflect.apply(can, this, [a0, channelStoreBinding.getChannel(a1.channelId)]);
r0 = value;
} else {
value = 'guildId' in a1;
r0 = value && typeof a1.guildId === 'string';
if (r0) {
can = this.can;
value = environment.__proto__;
guildStoreBinding = GuildStore;
value = Reflect.apply(can, this, [a0, guildStoreBinding.getGuild(a1.guildId)]);
r0 = value;
}
}
} else {
value = 'guildId' in a1;
r0 = value && typeof a1.guildId === 'string';
if (r0) {
can = this.can;
value = environment.__proto__;
guildStoreBinding = GuildStore;
value = Reflect.apply(can, this, [a0, guildStoreBinding.getGuild(a1.guildId)]);
r0 = value;
}
}
return r0;
}
function value_28703(a0, a1, a2, a3, a4) { // fn#28703, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:5838, offset: 0x00f80be0, size: 63 bytes, params: 6, frame: 18
const value = environment.__proto__;
return (BigFlagUtilsModule).has(_computePermissions(a1, a2, a3, a4), a0);
}
function value_28704(a0, a1, a2, a3, a4) { // fn#28704, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:5950, offset: 0x00f80c1f, size: 147 bytes, params: 6, frame: 22
var r0;
var moduleValue;
var has;
var value2;
let value = environment.__proto__;
if ('basicPermissions' in a1) {
value = importDefault(3792) /* metro dependency 3792: BasicPermissionUtils */;
value = value.has(a1.basicPermissions, a0);
r0 = value;
} else {
moduleValue = importAll(483) /* metro dependency 483: BigFlagUtils */;
has = moduleValue.has;
value2 = _computePermissions(a1, a2, a3, a4);
value = importDefault(3792) /* metro dependency 3792: BasicPermissionUtils */;
value = Reflect.apply(has, moduleValue, [value2, value.asBigFlag(a0)]);
r0 = value;
}
return r0;
}
function value_28706(a0) { // fn#28706, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6227, offset: 0x00f80ccd, size: 69 bytes, params: 2, frame: 13
var r0;
var value;
var defaultImport;
if ('basicPermissions' in a0) {
r0 = a0.basicPermissions;
} else {
value = environment.__proto__;
defaultImport = importDefault(3792) /* metro dependency 3792: BasicPermissionUtils */;
value = defaultImport.asBasicFlag(_computePermissions(a0));
r0 = value;
}
return r0;
}
function value_28707(a0, a1, a2) { // fn#28707, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6361, offset: 0x00f80d12, size: 224 bytes, params: 4, frame: 21
var r5;
var r0;
var moduleValue;
var highestRole;
var value6;
let value = a1;
const r1 = value instanceof UserRecord ? value.id : value;
const isGuildOwnerBinding = isGuildOwner;
value = undefined;
if (!isGuildOwnerBinding(a2, r1)) {
var currentUser = UserStore.getCurrentUser();
if (this.can(a0, a2)) {
if (currentUser != null) {
moduleValue = importAll(3789) /* metro dependency 3789: PermissionUtils */;
r5 = moduleValue.getHighestRole(a2, currentUser.id);
} else {
r5 = value;
}
highestRole = (importAll(3789) /* metro dependency 3789: PermissionUtils */).getHighestRole(a2, r1);
value6 = currentUser != null;
if (value6) {
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
value = value.isRoleHigher(a2, currentUser.id, r5, highestRole);
r0 = value;
} else {
r0 = value6;
}
return r0;
}
}
return false;
}
function value_28708(a0) { // fn#28708, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6643, offset: 0x00f80df2, size: 69 bytes, params: 2, frame: 14
var r0;
let value = environment.__proto__;
const currentUser = UserStore.getCurrentUser();
const value3 = null;
if (value3 != currentUser) {
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
value = value.getHighestRole(a0, currentUser.id);
r0 = value;
} else {
r0 = value3;
}
return r0;
}
function value_28709(a0, a1, a2) { // fn#28709, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6761, offset: 0x00f80e37, size: 109 bytes, params: 4, frame: 18
let value = environment.__proto__;
const currentUser = UserStore.getCurrentUser();
const impersonateStoreBinding = ImpersonateStore;
const isViewingRoles2 = impersonateStoreBinding.isViewingRoles(a0.id);
value = undefined;
return PermissionUtilsModule.isRoleHigher(a0, isViewingRoles2 || currentUser == null ? value : currentUser.id, a1,
a2);
}
function value_28711(a0) { // fn#28711, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:7123, offset: 0x00f80f1b, size: 30 bytes, params: 2, frame: 3
const value = environment.__proto__;
return env1_26[a0] ?? 0;
}
function value_28712() { // fn#28712, offset: 0x00df3b32, size: 9 bytes, params: 1, frame: 1
return env1_27;
}
}
function CHANNEL_CREATE_28714({channel}) { // fn#28714, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:7808, offset: 0x00f80f39, size: 185 bytes, params: 2, frame: 15
const channel2 = ChannelStore.getChannel(channel.id);
if (channel2 == null) {
return false;
}
if (channel2.isPrivate()) {
return false;
}
const currentUser = UserStore.getCurrentUser();
const permissions = PermissionUtilsModule.computePermissions({user: currentUser, context: channel2});
if (env0_25[channel2.id] === permissions) {
return false;
}
env0_25[channel2.id] = permissions;
env0_27 += 1;
const updateGuildVersionBinding = updateGuildVersion;
const getGuildId = channel2.getGuildId;
updateGuildVersionBinding(Reflect.apply(getGuildId, channel2, []));
}
function CHANNEL_UPDATES_28715({channels}) { // fn#28715, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:8270, offset: 0x00f80ff2, size: 275 bytes, params: 2, frame: 25
var r4;
var r5;
var r11;
var r1;
var r0;
var value5;
var id;
var channel;
var isPrivate;
var currentUser;
var moduleValue;
var permissions;
var binding;
var updateGuildVersionBinding;
var getGuildId;
var value8;
var value9;
const value2 = _createForOfIteratorHelperLoose_28671(channels);
const value3 = value2();
let done = value3.done;
if (done) {
r1 = false;
} else {
r4 = false;
r5 = value3;
while (true) {
value5 = r5.value;
id = value5.id;
channel = ChannelStore.getChannel(id);
if (channel != null) {
isPrivate = channel.isPrivate;
if (Reflect.apply(isPrivate, channel, [])) {
r11 = r4;
break;
}
currentUser = UserStore.getCurrentUser();
moduleValue = importAll(3789) /* metro dependency 3789: PermissionUtils */;
permissions = moduleValue.computePermissions({user: currentUser, context: channel});
binding = env0_25;
id = channel.id;
if (binding[id] === permissions) {
r11 = r4;
break;
}
binding = env0_25;
id = channel.id;
binding[id] = permissions;
updateGuildVersionBinding = updateGuildVersion;
getGuildId = channel.getGuildId;
updateGuildVersionBinding(Reflect.apply(getGuildId, channel, []));
value8 = true;
r11 = value8;
break;
}
r11 = r4;
value9 = value2();
done = value9.done;
if (done) {
r1 = r11;
break;
}
r4 = r11;
r5 = value9;
continue;
}
}
if (r1) {
env0_27 += 1;
r0 = r1;
} else {
r0 = !!r1;
}
return r0;
}
function LOAD_MESSAGES_SUCCESS({messages}) { // fn#28716, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:8630, offset: 0x00f81105, size: 29 bytes, params: 2, frame: 11
return messages.some(function(a0) {
return a0.thread != null;
});
}
function THREAD_MEMBER_UPDATE(a0) { // fn#28718, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:8849, offset: 0x00f81122, size: 67 bytes, params: 2, frame: 14
var r0;
const id = UserStore.getCurrentUser()?.id;
const userId = a0.userId;
const value4 = id === userId;
if (value4) {
updateGuildVersion(a0.guildId);
r0 = true;
} else {
r0 = value4;
}
return r0;
}
function THREAD_MEMBERS_UPDATE_28719(a0) { // fn#28719, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:9011, offset: 0x00f81165, size: 66 bytes, params: 2, frame: 13
var r0;
const value2 = (ThreadActionUtilsModule).doesThreadMembersActionAffectMe(a0);
if (value2) {
updateGuildVersion(a0.guildId);
r0 = true;
} else {
r0 = !!value2;
}
return r0;
}
function CHANNEL_DELETE_28720({channel}) { // fn#28720, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:9154, offset: 0x00f811a7, size: 59 bytes, params: 2, frame: 12
delete env0_25[channel.id];
env0_27 += 1;
updateGuildVersion(channel.guild_id);
return false;
}
}
function _fun28686({thread}) { // fn#28686, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2886, offset: 0x00f80371, size: 17 bytes, params: 2, frame: 2
return thread != null;
}
function _fun28717({thread}) { // fn#28717, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:8694, offset: 0x00f80371, size: 17 bytes, params: 2, frame: 2
return thread != null;
}
global.__d(_fun28667, 3784, [6, 7, 15, 17, 18, 1937, 3785, 1384, 3786, 1383, 1422, 1885, 1379, 1945, 1867, 1878,
661, 3788, 3789, 22, 3791, 1418, 483, 3792, 566, 694,
2]) /* metro module 3784, dependencies: [6, 7, 15, 17, 18, 1937, 3785, 1384, 3786, 1383, 1422, 1885, 1379, 1945, 1867, 1878, 661, 3788, 3789, 22, 3791, 1418, 483, 3792, 566, 694, 2] */;