176 lines
9.4 KiB
TypeScript
176 lines
9.4 KiB
TypeScript
/* Metro module 9077; source: modules/permissions/useManageResourcePermissions.tsx; dependencies: [57, 31, 3784, 1878, 9076, 482, 483, 1418, 566, 2] */
|
|
function _fun70925(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#70925, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:6, offset: 0x01d0d4a6, size: 316 bytes, params: 8, frame: 20
|
|
var object2;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_4 = importAll(31) /* metro dependency 31 */;
|
|
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const permissionsConstantsModule = require(9076) /* metro dependency 9076: PermissionsConstants */;
|
|
const env0_7 = permissionsConstantsModule.CREATE_GUILD_EVENT_CORE_PERMISSIONS;
|
|
const env0_8 = permissionsConstantsModule.CREATE_GUILD_EVENT_STAGE_CHANNEL_PERMISSIONS;
|
|
const env0_9 = permissionsConstantsModule.CREATE_GUILD_EVENT_VOICE_CHANNEL_PERMISSIONS;
|
|
const env0_10 = (require(482) /* metro dependency 482: Constants */).Permissions;
|
|
object2 = {'canCreateExpressions': false, 'canCreateGuildEvent': false, 'canManageAllExpressions': false,
|
|
'canManageAllEvents': false};
|
|
object2.canManageGuildExpression = function() {
|
|
return false;
|
|
};
|
|
object2.canManageGuildEvent = function() {
|
|
return false;
|
|
};
|
|
const closure = attachChannelPermissions;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/permissions/useManageResourcePermissions.tsx');
|
|
exports.attachChannelPermissions = closure;
|
|
exports.useManageResourcePermissions = useManageResourcePermissions;
|
|
exports.getManageResourcePermissions = getManageResourcePermissions;
|
|
}
|
|
|
|
function canManageResource(a0, a1, a2, a3) { // fn#70928, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:483, offset: 0x01d0d5e2, size: 183 bytes, params: 5, frame: 11
|
|
var r7;
|
|
var r2;
|
|
var r3;
|
|
var r1;
|
|
var r0;
|
|
var value4;
|
|
var user;
|
|
let value = a3;
|
|
const value2 = a0 != null;
|
|
if (value2) {
|
|
if (a2) {
|
|
r1 = !!a2;
|
|
} else {
|
|
if ('creator_id' in a0) {
|
|
r3 = value && a1 != null;
|
|
r3 = r3 && a0.creator_id === a1.id;
|
|
r2 = r3;
|
|
} else if ('userId' in a0) {
|
|
r7 = value && a1 != null;
|
|
r7 = r7 && a0.userId === a1.id;
|
|
r2 = r7;
|
|
} else {
|
|
value4 = 'user' in a0;
|
|
if (value4) {
|
|
r7 = value && a1 != null;
|
|
if (r7) {
|
|
user = a0.user;
|
|
value = undefined;
|
|
value = (user == null ? value : user.id) === a1.id;
|
|
r7 = value;
|
|
}
|
|
r2 = r7;
|
|
} else {
|
|
r2 = value4;
|
|
}
|
|
}
|
|
r1 = r2;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function attachChannelPermissions(a0) { // fn#70929, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:706, offset: 0x01d0d699, size: 173 bytes, params: 2, frame: 18
|
|
if (a0 == null) {
|
|
return [Permissions.CREATE_EVENTS, Permissions.MANAGE_EVENTS];
|
|
}
|
|
const r4 = a0.isGuildStageVoice() ? CREATE_GUILD_EVENT_STAGE_CHANNEL_PERMISSIONS : a0.isGuildVoice() ? CREATE_GUILD_EVENT_VOICE_CHANNEL_PERMISSIONS : CREATE_GUILD_EVENT_CORE_PERMISSIONS;
|
|
const bigFlagUtilsModule = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
let combine = bigFlagUtilsModule.combine;
|
|
const CREATE_EVENTS = Permissions.CREATE_EVENTS;
|
|
const items2 = [Reflect.apply(combine, bigFlagUtilsModule, [r4, CREATE_EVENTS])];
|
|
const value = bigFlagUtilsModule;
|
|
combine = value.combine;
|
|
const MANAGE_EVENTS = Permissions.MANAGE_EVENTS;
|
|
items2[1] = Reflect.apply(combine, value, [r4, MANAGE_EVENTS]);
|
|
return items2;
|
|
}
|
|
|
|
function useManageResourcePermissions(a0) { // fn#70930, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:1068, offset: 0x01d0d746, size: 380 bytes, params: 2, frame: 24
|
|
const env0_0 = a0;
|
|
const guildRecordUtilsModule = require(1418) /* metro dependency 1418: GuildRecordUtils */;
|
|
const r2 = guildRecordUtilsModule.isGuildRecord(a0) ? [Permissions.CREATE_EVENTS,
|
|
Permissions.MANAGE_EVENTS] : attachChannelPermissions(a0);
|
|
let binding = env0_3;
|
|
const value3 = binding(r2, 2);
|
|
const env0_1 = value3[0];
|
|
const env0_2 = value3[1];
|
|
const fluxModule = require(566) /* metro dependency 566: flux */;
|
|
const useStateFromStoresArray = fluxModule.useStateFromStoresArray;
|
|
const value5 = binding(Reflect.apply(useStateFromStoresArray, fluxModule, [[PermissionStore], _fun70931]), 4);
|
|
const property = value5[0];
|
|
const property2 = value5[1];
|
|
const env0_4 = property2;
|
|
const property3 = value5[2];
|
|
const property4 = value5[3];
|
|
const currentUser = fluxModule.useStateFromStores([UserStore], function() {
|
|
return UserStore.getCurrentUser();
|
|
});
|
|
binding = env0_4;
|
|
let useCallback = binding.useCallback;
|
|
const value6 = Reflect.apply(useCallback, binding, [_fun70933, [property, property2, currentUser]]);
|
|
useCallback = binding.useCallback;
|
|
return a0 == null ? env0_11 : {canCreateExpressions: property, canCreateGuildEvent: property3,
|
|
canManageAllExpressions: property2, canManageAllEvents: property4, canManageGuildExpression: value6,
|
|
canManageGuildEvent: Reflect.apply(useCallback, binding, [_fun70934, [property4, property3, currentUser]])};
|
|
}
|
|
|
|
function getManageResourcePermissions(a0) { // fn#70935, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:1731, offset: 0x01d0d970, size: 313 bytes, params: 2, frame: 19
|
|
const value = a1;
|
|
const value2 = a2;
|
|
const r9 = value !== undefined ? value : PermissionStore;
|
|
const r8 = value2 !== undefined ? value2 : UserStore;
|
|
const env0_3 = undefined;
|
|
const guildRecordUtilsModule = require(1418) /* metro dependency 1418: GuildRecordUtils */;
|
|
const value4 = env0_3(guildRecordUtilsModule.isGuildRecord(a0) ? [Permissions.CREATE_EVENTS,
|
|
Permissions.MANAGE_EVENTS] : attachChannelPermissions(a0), 2);
|
|
const property = value4[0];
|
|
const property2 = value4[1];
|
|
let can = r9.can;
|
|
const CREATE_GUILD_EXPRESSIONS = Permissions.CREATE_GUILD_EXPRESSIONS;
|
|
const value5 = Reflect.apply(can, r9, [CREATE_GUILD_EXPRESSIONS, a0]);
|
|
can = r9.can;
|
|
const MANAGE_GUILD_EXPRESSIONS = Permissions.MANAGE_GUILD_EXPRESSIONS;
|
|
const value6 = Reflect.apply(can, r9, [MANAGE_GUILD_EXPRESSIONS, a0]);
|
|
const value7 = r9.can(property, a0);
|
|
const value8 = r9.can(property2, a0);
|
|
const env0_4 = r8.getCurrentUser();
|
|
return a0 == null ? env0_11 : {canCreateExpressions: value5, canCreateGuildEvent: value7,
|
|
canManageAllExpressions: value6, canManageAllEvents: value8,
|
|
canManageGuildExpression: canManageGuildExpression_70936, canManageGuildEvent: canManageGuildEvent_70937};
|
|
}
|
|
|
|
function _fun70931() { // fn#70931, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:1227, offset: 0x01d0d8c2, size: 108 bytes, params: 1, frame: 15
|
|
let can = PermissionStore.can;
|
|
const CREATE_GUILD_EXPRESSIONS = Permissions.CREATE_GUILD_EXPRESSIONS;
|
|
const binding = env0_0;
|
|
const items2 = [Reflect.apply(can, PermissionStore, [CREATE_GUILD_EXPRESSIONS, binding])];
|
|
can = PermissionStore.can;
|
|
const MANAGE_GUILD_EXPRESSIONS = Permissions.MANAGE_GUILD_EXPRESSIONS;
|
|
items2[1] = Reflect.apply(can, PermissionStore, [MANAGE_GUILD_EXPRESSIONS, binding]);
|
|
items2[2] = PermissionStore.can(env0_1, binding);
|
|
items2[3] = PermissionStore.can(env0_2, binding);
|
|
return items2;
|
|
}
|
|
|
|
function _fun70933(a0) { // fn#70933, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:1442, offset: 0x01d0d92e, size: 33 bytes, params: 2, frame: 17
|
|
return canManageResource(a0, currentUser, env0_4, env0_3);
|
|
}
|
|
|
|
function _fun70934(a0) { // fn#70934, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:1499, offset: 0x01d0d94f, size: 33 bytes, params: 2, frame: 17
|
|
return canManageResource(a0, currentUser, env0_6, env0_5);
|
|
}
|
|
|
|
function getManageResourcePermissionsCanManageGuildExpression(a0) { // fn#70936, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:2119, owner: getManageResourcePermissions.canManageGuildExpression, offset: 0x01d0daa9, size: 33 bytes, params: 2, frame: 17
|
|
return canManageResource(a0, env0_4, env0_1, env0_0);
|
|
}
|
|
|
|
function getManageResourcePermissionsCanManageGuildEvent(a0) { // fn#70937, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9262:2169, owner: getManageResourcePermissions.canManageGuildEvent, offset: 0x01d0daca, size: 33 bytes, params: 2, frame: 17
|
|
return canManageResource(a0, env0_4, env0_3, env0_2);
|
|
}
|
|
|