320 lines
13 KiB
TypeScript
320 lines
13 KiB
TypeScript
/* Metro module 15951; source: modules/guild_settings/roles/GuildSettingsRolesUtils.tsx; dependencies: [31, 1945, 1878, 15942, 661, 566, 3995, 6738, 6592, 683, 6590, 1360, 2] */
|
|
function _fun123270(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#123270, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:6, offset: 0x02586758, size: 313 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_123273 = 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 = useGuildMembers;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const env0_6 = (require(15942) /* metro dependency 15942: GuildSettingsConstants */).GuildSettingsRoleEditSections;
|
|
const env0_7 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_settings/roles/GuildSettingsRolesUtils.tsx');
|
|
exports.ADD_MEMBER_QUERY_LIMIT = 50;
|
|
exports.MAX_PREFETCH_MEMBER_COUNT = 1000;
|
|
exports.useGuildMembers = closure;
|
|
exports.useGuildRoleMembers = useGuildRoleMembers;
|
|
exports.useQueryGuildMembers = useQueryGuildMembers;
|
|
exports.filterFullMembersByQuery = filterFullMembersByQuery;
|
|
exports.getSectionAnalyticsName = getSectionAnalyticsName;
|
|
exports.filterRole = function(a0, a1) {
|
|
var r0;
|
|
var value = a1 === '';
|
|
if (value) {
|
|
r0 = value;
|
|
} else {
|
|
value = a0.name.toLowerCase();
|
|
value = value.includes(a1.toLowerCase());
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_123271(a0, a1) { // fn#123271, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:198, offset: 0x02586891, 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 _fun123272;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_123273(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_123273(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_123273(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun123272;
|
|
}
|
|
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 useGuildMembers(a0, a1) { // fn#123274, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:1108, offset: 0x02586a05, size: 182 bytes, params: 3, frame: 23
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([GuildMemberStore],
|
|
_fun123275, [a0, a1]);
|
|
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([UserStore], _fun123276,
|
|
[value2]);
|
|
return value3.useMemo(_fun123278, [value2, value3, a0]);
|
|
}
|
|
|
|
function useGuildRoleMembers(a0, a1, a2) { // fn#123279, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:1978, offset: 0x02586c5e, size: 143 bytes, params: 4, frame: 17
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const env0_2 = a2;
|
|
const env0_3Binding = env0_3.useRef(a2);
|
|
env0_3Binding.useEffect(_fun123280);
|
|
env0_3Binding.useEffect(_fun123281, [a0, a1]);
|
|
return useGuildMembers(a0, env0_3Binding.useCallback(function({roles}) {
|
|
return roles.includes(require);
|
|
}, [a1]));
|
|
}
|
|
|
|
function useQueryGuildMembers(a0, a1) { // fn#123283, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:2248, offset: 0x02586d4f, size: 77 bytes, params: 3, frame: 16
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const env0_2 = env0_3.useRef(false);
|
|
env0_3.useEffect(_fun123284, [a0, a1]);
|
|
}
|
|
|
|
function filterFullMembersByQuery(a0, a1) { // fn#123285, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:2485, offset: 0x02586e2b, size: 136 bytes, params: 3, frame: 16
|
|
var r0;
|
|
var defaultImport;
|
|
var name;
|
|
var defaultImport2;
|
|
var userTag;
|
|
let value = a0.trim();
|
|
value = value.toLowerCase();
|
|
const value2 = a1.id === value;
|
|
if (value2) {
|
|
r0 = value2;
|
|
} else {
|
|
defaultImport = importDefault(6590) /* metro dependency 6590 */;
|
|
name = a1.name;
|
|
r0 = defaultImport(value, name.toLowerCase());
|
|
}
|
|
if (!r0) {
|
|
defaultImport2 = importDefault(6590) /* metro dependency 6590 */;
|
|
userTag = a1.userTag;
|
|
value = defaultImport2(value, userTag.toLowerCase());
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getSectionAnalyticsName(a0) { // fn#123286, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:2668, offset: 0x02586eb3, size: 125 bytes, params: 2, frame: 12
|
|
const MEMBERS = GuildSettingsRoleEditSections.MEMBERS;
|
|
if (MEMBERS === a0) {
|
|
return 'Members';
|
|
}
|
|
const PERMISSIONS = GuildSettingsRoleEditSections.PERMISSIONS;
|
|
if (PERMISSIONS === a0) {
|
|
return 'Permissions';
|
|
}
|
|
const DISPLAY = GuildSettingsRoleEditSections.DISPLAY;
|
|
if (DISPLAY === a0) {
|
|
return 'Role Settings';
|
|
}
|
|
const VERIFICATIONS = GuildSettingsRoleEditSections.VERIFICATIONS;
|
|
if (VERIFICATIONS === a0) {
|
|
return 'Connections';
|
|
}
|
|
(require(1360) /* metro dependency 1360: GlobalUtils */).assertNever(a0);
|
|
}
|
|
|
|
function _fun123275() { // fn#123275, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:1182, offset: 0x02586abb, size: 54 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
const members = GuildMemberStore.getMembers(env0_0);
|
|
return require == null ? members : members.filter(require);
|
|
}
|
|
|
|
function _fun123276() { // fn#123276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:1288, offset: 0x02586af1, size: 32 bytes, params: 1, frame: 13
|
|
return env0_2.reduce(_fun123277, {});
|
|
}
|
|
|
|
function _fun123278() { // fn#123278, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:1400, offset: 0x02586b3f, size: 287 bytes, params: 1, frame: 27
|
|
var r3;
|
|
var r15;
|
|
var value5;
|
|
var binding;
|
|
var userId;
|
|
var property;
|
|
var push;
|
|
var object2;
|
|
var nick;
|
|
var defaultImport;
|
|
var name;
|
|
var defaultImport2;
|
|
var getAvatarSource;
|
|
var bot;
|
|
var roles;
|
|
var value7;
|
|
const items2 = [];
|
|
const value3 = _createForOfIteratorHelperLoose_123271(env0_2);
|
|
const value4 = value3();
|
|
let done = value4.done;
|
|
if (!done) {
|
|
r3 = value4;
|
|
while (true) {
|
|
value5 = r3.value;
|
|
binding = env0_3;
|
|
userId = value5.userId;
|
|
property = binding[userId];
|
|
if (property != null) {
|
|
push = items2.push;
|
|
object2 = {};
|
|
nick = value5.nick;
|
|
if (nick != null) {
|
|
r15 = nick;
|
|
continue;
|
|
}
|
|
defaultImport = importDefault(3995) /* metro dependency 3995: UserUtils */;
|
|
name = defaultImport.getName(property);
|
|
r15 = name;
|
|
object2.name = r15;
|
|
defaultImport2 = importDefault(3995) /* metro dependency 3995: UserUtils */;
|
|
object2.userTag = defaultImport2.getUserTag(property);
|
|
userId = value5.userId;
|
|
object2.id = userId;
|
|
getAvatarSource = property.getAvatarSource;
|
|
binding = env0_0;
|
|
object2.avatarSource = Reflect.apply(getAvatarSource, property, [binding]);
|
|
object2.avatarURL = property.getAvatarURL(binding, 80);
|
|
bot = property.bot;
|
|
object2.bot = bot;
|
|
object2.verifiedBot = property.isVerifiedBot();
|
|
roles = value5.roles;
|
|
object2.roles = roles;
|
|
userId = value5.userId;
|
|
object2.key = userId;
|
|
object2.user = property;
|
|
Reflect.apply(push, items2, [object2]);
|
|
}
|
|
value7 = value3();
|
|
done = value7.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r3 = value7;
|
|
continue;
|
|
}
|
|
}
|
|
return items2;
|
|
}
|
|
|
|
function _fun123281() { // fn#123281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:2078, offset: 0x02586ced, size: 70 bytes, params: 1, frame: 15
|
|
let value = environment.__proto__;
|
|
value = Reflect.apply((require(6738) /* metro dependency 6738: GuildRoleMemberActionCreators */).requestMembersForRole,
|
|
value, [env0_0, require]);
|
|
value.catch(env0_3.current);
|
|
}
|
|
|
|
function _fun123284() { // fn#123284, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:2315, offset: 0x02586d9c, size: 143 bytes, params: 1, frame: 18
|
|
var defaultImport2;
|
|
const defaultImport = importDefault(6592) /* metro dependency 6592: GuildUtils */;
|
|
defaultImport.requestMembers(env0_0, require, 200);
|
|
if (!(require === '' || env0_2.current)) {
|
|
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport2.track(AnalyticEvents.SEARCH_STARTED, {search_type: 'Role Members'});
|
|
env0_2.current = true;
|
|
}
|
|
}
|
|
|
|
function _fun123277(a0, a1) { // fn#123277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16159:1302, offset: 0x02586b11, size: 46 bytes, params: 3, frame: 13
|
|
let value = environment.__proto__.__proto__;
|
|
const getUser = UserStore.getUser;
|
|
const userId = a1.userId;
|
|
value = Reflect.apply(getUser, UserStore, [userId]);
|
|
if (value != null) {
|
|
a0[a1.userId] = value;
|
|
}
|
|
return a0;
|
|
}
|
|
|