438 lines
19 KiB
TypeScript
438 lines
19 KiB
TypeScript
/* Metro module 15186; source: stores/ChannelSettingsPermissionsStore.tsx; dependencies: [6, 7, 15, 17, 18, 8149, 1379, 661, 8120, 587, 3789, 22, 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 ChannelSettingsStore from './ChannelSettingsStore.tsx'; /* Metro dependency 8149 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as StorageModule from '../external/discord_common/js/packages/storage/Storage.tsx'; /* Metro dependency 587 */
|
|
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as PermissionUtilsModule from '../utils/PermissionUtils.tsx'; /* Metro dependency 3789 */
|
|
import * as ChannelPermissionsConstantsModule from '../modules/channel_permissions/ChannelPermissionsConstants.tsx'; /* Metro dependency 8120 */
|
|
|
|
function _fun116039(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#116039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:6, offset: 0x0247931a, size: 647 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_116045 = 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 CHANNEL_SETTINGS_PERMISSIONS_INIT2 = CHANNEL_SETTINGS_PERMISSIONS_INIT;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const FormStates = ConstantsModule.FormStates;
|
|
const ADVANCED_MODE_ON_KEY = (ChannelPermissionsConstantsModule).ADVANCED_MODE_ON_KEY;
|
|
const Set = global.Set;
|
|
let set = new Set();
|
|
let env0_17 = FormStates.CLOSED;
|
|
set = false;
|
|
let Storage = (StorageModule).Storage;
|
|
let env0_25 = Storage.get(ADVANCED_MODE_ON_KEY) || set;
|
|
const Store = (Flux).Store;
|
|
_fun116050(Store).displayName = 'ChannelSettingsPermissionsStore';
|
|
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{CHANNEL_SETTINGS_SET_SECTION: CHANNEL_SETTINGS_SET_SECTION_116065,
|
|
CHANNEL_SETTINGS_PERMISSIONS_INIT: CHANNEL_SETTINGS_PERMISSIONS_INIT2,
|
|
CHANNEL_SETTINGS_PERMISSIONS_UPDATE_PERMISSION: CHANNEL_SETTINGS_PERMISSIONS_UPDATE_PERMISSION,
|
|
CHANNEL_SETTINGS_PERMISSIONS_SELECT_PERMISSION: CHANNEL_SETTINGS_PERMISSIONS_SELECT_PERMISSION,
|
|
CHANNEL_SETTINGS_INIT: function() {
|
|
if (ChannelSettingsStore.getSection() === ChannelSettingsSections.PERMISSIONS) {
|
|
CHANNEL_SETTINGS_PERMISSIONS_INIT();
|
|
}
|
|
}, CHANNEL_SETTINGS_CLOSE: CHANNEL_SETTINGS_CLOSE_116069, CHANNEL_UPDATES: CHANNEL_UPDATES_116070,
|
|
CHANNEL_SETTINGS_PERMISSIONS_SUBMITTING: function() {
|
|
env0_17 = FormStates.SUBMITTING;
|
|
}, CHANNEL_SETTINGS_PERMISSIONS_SAVE_SUCCESS: function({silent}) {
|
|
if (silent) {
|
|
env0_17 = FormStates.OPEN;
|
|
} else {
|
|
env0_17 = FormStates.CLOSED;
|
|
CHANNEL_SETTINGS_PERMISSIONS_INIT();
|
|
}
|
|
}, CHANNEL_SETTINGS_PERMISSIONS_SET_ADVANCED_MODE: function({advancedMode}) {
|
|
env0_25 = advancedMode;
|
|
var Storage = require(dependencyMap[9]).Storage;
|
|
Storage.set(ADVANCED_MODE_ON_KEY, advancedMode);
|
|
}});
|
|
(FileImportTrackerModule).fileFinishedImporting('stores/ChannelSettingsPermissionsStore.tsx');
|
|
exports.default = set;
|
|
function _isNativeReflectConstruct_116040() { // fn#116040, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:256, offset: 0x024795a1, size: 98 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_116040_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_116043(a0, a1) { // fn#116043, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:449, offset: 0x02479603, size: 372 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 _fun116044;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_116045(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_116045(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_116045(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun116044;
|
|
}
|
|
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 _fun116044() { // fn#116044, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:1020, 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 getPermissionOverwrites(a0) { // fn#116046, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:1465, offset: 0x02479777, size: 90 bytes, params: 2, frame: 14
|
|
var moduleValue;
|
|
const guildId = a0.getGuildId();
|
|
const object = {};
|
|
copyDataProperties(object, a0.permissionOverwrites, undefined);
|
|
if (guildId != null && object[guildId] == null) {
|
|
moduleValue = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
object[guildId] = moduleValue.makeEveryoneOverwrite(guildId);
|
|
}
|
|
return object;
|
|
}
|
|
|
|
function CHANNEL_SETTINGS_PERMISSIONS_INIT() { // fn#116047, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:1624, offset: 0x024797d1, size: 204 bytes, params: 1, frame: 16
|
|
channel = ChannelSettingsStore.getChannel();
|
|
category = ChannelSettingsStore.getCategory();
|
|
if (channel == null) {
|
|
return false;
|
|
}
|
|
const value2 = channel.getGuildId();
|
|
if (getPermissionOverwrites(channel)[env0_23] != null) {
|
|
}
|
|
result = category != null;
|
|
env0_14 = PermissionUtilsModule.areChannelsLocked(channel, category);
|
|
env0_17 = FormStates.CLOSED;
|
|
env0_16.clear();
|
|
}
|
|
|
|
function syncChannelUpdates(a0) { // fn#116048, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:1843, offset: 0x0247989d, size: 367 bytes, params: 2, frame: 17
|
|
var r7;
|
|
var moduleValue;
|
|
if (channel2 == null) {
|
|
return false;
|
|
}
|
|
if (channel2.id !== a0) {
|
|
return false;
|
|
}
|
|
const channel = ChannelStore.getChannel(a0);
|
|
channel2 = channel;
|
|
if (channel == null) {
|
|
return false;
|
|
}
|
|
category = ChannelSettingsStore.getCategory();
|
|
let binding = channel2;
|
|
const guildId = binding.getGuildId();
|
|
if (guildId == null) {
|
|
return false;
|
|
}
|
|
env0_20 = getPermissionOverwrites(channel2);
|
|
const object = {};
|
|
binding = env0_16;
|
|
binding.forEach(_fun116049);
|
|
if (object[guildId] == null && channel2.permissionOverwrites[guildId] == null) {
|
|
moduleValue = importAll(dependencyMap[10]);
|
|
object[guildId] = moduleValue.makeEveryoneOverwrite(guildId);
|
|
r7 = dependencyMap;
|
|
} else {
|
|
r7 = binding;
|
|
}
|
|
const object2 = {};
|
|
copyDataProperties(object2, channel2.permissionOverwrites, r7);
|
|
copyDataProperties(object2, object, r7);
|
|
if (object2[env0_23] != null) {
|
|
if (env0_24 != null && object2[env0_24] != null) {
|
|
}
|
|
}
|
|
const moduleValue2 = importAll(dependencyMap[10]);
|
|
env0_14 = moduleValue2.areChannelsLocked(channel2, category);
|
|
return true;
|
|
function _fun116049(a0) { // fn#116049, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:2057, offset: 0x02479a0c, size: 39 bytes, params: 2, frame: 4
|
|
if (env1_19 != null) {
|
|
env0_0[a0] = env1_19[a0];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function _fun116050(a0) { // fn#116050, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:2300, offset: 0x02479a33, size: 380 bytes, params: 2, frame: 16
|
|
const ChannelSettingsPermissionsStore2 = ChannelSettingsPermissionsStore;
|
|
Inherits(ChannelSettingsPermissionsStore2, a0);
|
|
return CreateClass(ChannelSettingsPermissionsStore2, [{key: 'initialize', value: function() {
|
|
this.waitFor(ChannelSettingsStore, ChannelStore);
|
|
}}, {key: 'hasChanges', value: value_116053}, {key: 'showNotice', value: function() {
|
|
return this.hasChanges();
|
|
}}, {key: 'getPermissionOverwrite', value: value_116055}, {key: 'editedPermissionIds', get: get_116056},
|
|
{key: 'permissionOverwrites', get: get_116057}, {key: 'selectedOverwriteId', get: get_116058},
|
|
{key: 'formState', get: function() {
|
|
return CLOSED;
|
|
}}, {key: 'isLockable', get: get_116060}, {key: 'locked', get: get_116061}, {key: 'channel', get: get_116062},
|
|
{key: 'category', get: get_116063}, {key: 'advancedMode', get: get_116064}]);
|
|
function ChannelSettingsPermissionsStore() { // fn#116051, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:2312, offset: 0x02479baf, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_4(this, ChannelSettingsPermissionsStore);
|
|
const value3 = env1_7(ChannelSettingsPermissionsStore);
|
|
return env1_6(this, _isNativeReflectConstruct_116040() ? global.Reflect.construct(value3, arguments,
|
|
env1_7(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_116053() { // fn#116053, offset: 0x00df0e82, size: 9 bytes, params: 1, frame: 1
|
|
return env1_18;
|
|
}
|
|
|
|
function value_116055(a0) { // fn#116055, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:2860, offset: 0x02479c20, size: 27 bytes, params: 2, frame: 3
|
|
const value = environment.__proto__;
|
|
return env1_19?.[a0];
|
|
}
|
|
|
|
function get_116056() { // fn#116056, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:2942, offset: 0x01bf6ebf, size: 27 bytes, params: 1, frame: 11
|
|
const Array = global.Array;
|
|
return Array.from(env1_16);
|
|
}
|
|
|
|
function get_116057() { // fn#116057, offset: 0x00d406a2, size: 9 bytes, params: 1, frame: 1
|
|
return env1_19;
|
|
}
|
|
|
|
function get_116058() { // fn#116058, offset: 0x00df3ac4, size: 9 bytes, params: 1, frame: 1
|
|
return env1_23;
|
|
}
|
|
|
|
function get_116060() { // fn#116060, offset: 0x00df0e8b, size: 9 bytes, params: 1, frame: 1
|
|
return env1_15;
|
|
}
|
|
|
|
function get_116061() { // fn#116061, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
|
|
return env1_14;
|
|
}
|
|
|
|
function get_116062() { // fn#116062, offset: 0x00f854d6, size: 9 bytes, params: 1, frame: 1
|
|
return env1_21;
|
|
}
|
|
|
|
function get_116063() { // fn#116063, offset: 0x00e425c8, size: 9 bytes, params: 1, frame: 1
|
|
return env1_22;
|
|
}
|
|
|
|
function get_116064() { // fn#116064, offset: 0x00df3ad6, size: 9 bytes, params: 1, frame: 1
|
|
return env1_25;
|
|
}
|
|
|
|
}
|
|
|
|
function CHANNEL_SETTINGS_SET_SECTION_116065({section}) { // fn#116065, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:3457, offset: 0x02479c3b, size: 52 bytes, params: 2, frame: 11
|
|
if (env0_21 != null) {
|
|
return false;
|
|
}
|
|
const PERMISSIONS = ChannelSettingsSections.PERMISSIONS;
|
|
if (section !== PERMISSIONS) {
|
|
return false;
|
|
}
|
|
CHANNEL_SETTINGS_PERMISSIONS_INIT();
|
|
}
|
|
|
|
function CHANNEL_SETTINGS_PERMISSIONS_UPDATE_PERMISSION({id, allow, deny}) { // fn#116066, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:3629, offset: 0x02479c6f, size: 235 bytes, params: 2, frame: 18
|
|
const binding = env0_19;
|
|
const value2 = binding == null;
|
|
const r1 = value2 ? undefined : binding[id];
|
|
if (r1 == null) {
|
|
return false;
|
|
}
|
|
if (env0_21 == null) {
|
|
return false;
|
|
}
|
|
const object = {};
|
|
copyDataProperties(object, r1, value2);
|
|
object['allow'] = allow;
|
|
object['deny'] = deny;
|
|
const object2 = {};
|
|
copyDataProperties(object2, env0_19, value2);
|
|
object2[id] = object;
|
|
env0_19 = object2;
|
|
env0_16.add(id);
|
|
env0_17 = FormStates.OPEN;
|
|
const defaultImport = Module00022;
|
|
result = !defaultImport.isEqual(env0_19, env0_20);
|
|
env0_14 = PermissionUtilsModule.areChannelsLocked(env0_21, env0_22);
|
|
}
|
|
|
|
function CHANNEL_SETTINGS_PERMISSIONS_SELECT_PERMISSION({id}) { // fn#116067, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:3910, offset: 0x02479d5a, size: 59 bytes, params: 2, frame: 4
|
|
if (env0_19 == null) {
|
|
if (env0_21 == null) {
|
|
return false;
|
|
}
|
|
} else {
|
|
if (env0_19[id] != null) {
|
|
return undefined;
|
|
}
|
|
if (env0_21 == null) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
function CHANNEL_SETTINGS_CLOSE_116069() { // fn#116069, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:4115, offset: 0x02479dc2, size: 67 bytes, params: 1, frame: 11
|
|
env0_17 = FormStates.CLOSED;
|
|
env0_16.clear();
|
|
}
|
|
|
|
function CHANNEL_UPDATES_116070({channels}) { // fn#116070, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15383:4223, offset: 0x02479e05, size: 103 bytes, params: 2, frame: 19
|
|
var r2;
|
|
var r3;
|
|
var r0;
|
|
var syncChannelUpdatesBinding;
|
|
var value5;
|
|
var id;
|
|
var value6;
|
|
var value7;
|
|
if (env0_21 == null) {
|
|
return false;
|
|
}
|
|
const value2 = _createForOfIteratorHelperLoose_116043(channels);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (done) {
|
|
r0 = false;
|
|
} else {
|
|
r2 = false;
|
|
r3 = value3;
|
|
while (true) {
|
|
syncChannelUpdatesBinding = syncChannelUpdates;
|
|
value5 = r3.value;
|
|
id = value5.id;
|
|
if (syncChannelUpdatesBinding(id) !== false) {
|
|
value6 = true;
|
|
r2 = value6;
|
|
}
|
|
value7 = value2();
|
|
done = value7.done;
|
|
if (done) {
|
|
r0 = r2;
|
|
break;
|
|
}
|
|
r3 = value7;
|
|
continue;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun116039, 15186, [6, 7, 15, 17, 18, 8149, 1379, 661, 8120, 587, 3789, 22, 566, 694,
|
|
2]) /* metro module 15186, dependencies: [6, 7, 15, 17, 18, 8149, 1379, 661, 8120, 587, 3789, 22, 566, 694, 2] */;
|