/* Metro module 12548; source: modules/friend_groups/FriendGroupsStore.tsx; dependencies: [6, 7, 15, 17, 18, 5221, 5078, 3793, 1878, 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 Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */ import ConsentStore from '../../stores/ConsentStore.tsx'; /* Metro dependency 5078 */ import UserAffinitiesV2Store from '../user_affinities/UserAffinitiesV2Store.tsx'; /* Metro dependency 5221 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ function _fun95884(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#95884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:6, offset: 0x021514d9, size: 461 bytes, params: 8, frame: 18 const _arrayLikeToArray_95890 = 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 Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_9 = []; const PersistedStore = (Flux).PersistedStore; let value = _fun95891(PersistedStore); value.displayName = 'FriendGroupsStore'; value.persistKey = 'FriendGroupsStoreV2'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {POST_CONNECTION_OPEN: POST_CONNECTION_OPEN_95904, CREATE_FRIEND_GROUP: CREATE_FRIEND_GROUP, UPDATE_FRIEND_GROUP: UPDATE_FRIEND_GROUP, DELETE_FRIEND_GROUP: DELETE_FRIEND_GROUP, REORDER_FRIEND_GROUPS: REORDER_FRIEND_GROUPS, ADD_USERS_TO_GROUP: ADD_USERS_TO_GROUP, REMOVE_USERS_FROM_GROUP: REMOVE_USERS_FROM_GROUP}); (FileImportTrackerModule).fileFinishedImporting('modules/friend_groups/FriendGroupsStore.tsx'); exports.default = value; function _isNativeReflectConstruct_95885() { // fn#95885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:190, offset: 0x021516a6, 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_95885_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_95888(a0, a1) { // fn#95888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:383, offset: 0x02151708, 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 _fun95889; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_95890(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_95890(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_95890(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun95889; } 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 _fun95889() { // fn#95889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:954, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5 return CreateClass >= env0_0.length ? {done: true} : {done: false, value: env0_0[typeof CreateClass === 'bigint' ? CreateClass : +CreateClass]}; } } function _fun95891(a0) { // fn#95891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:1313, offset: 0x0215187c, size: 257 bytes, params: 2, frame: 16 const FriendGroupsStore2 = FriendGroupsStore; Inherits(FriendGroupsStore2, a0); return CreateClass(FriendGroupsStore2, [{key: 'initialize', value: function(a0) { var property; this.waitFor(ConsentStore, RelationshipStore, UserAffinitiesV2Store, UserStore); if (a0 != null) { property = a0.groups; env1_9 = property ?? []; property = a0.isInitialized; env1_10 = property != null && property; } }}, {key: 'getGroups', value: value_95894}, {key: 'getGroup', value: value_95895}, {key: 'getGroupIds', value: value_95897}, {key: 'getUserGroups', value: value_95899}, {key: 'isGroupEmpty', value: function(a0) { var value = this.getGroup(a0); return value == null || value.userIds.length === 0; }}, {key: 'isInitialized', value: value_95902}, {key: 'getState', value: value_95903}]); function FriendGroupsStore() { // fn#95892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:1325, offset: 0x010a3f4a, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_0(this, FriendGroupsStore); const value3 = env1_3(FriendGroupsStore); return env1_2(this, _isNativeReflectConstruct_95885() ? global.Reflect.construct(value3, arguments, env1_3(this).constructor) : value3.apply(this, arguments)); } function value_95894() { // fn#95894, offset: 0x00e07a77, size: 9 bytes, params: 1, frame: 1 return env1_9; } function value_95895(a0) { // fn#95895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:1809, offset: 0x021519d3, size: 48 bytes, params: 2, frame: 11 var environment; const env0_0 = a0; let value = environment.__proto__; value = env1_9.find(_fun95896); const value2 = null; return value2 != value ? value : value2; function _fun95896({id}) { // fn#95896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:1851, offset: 0x00db0c48, size: 21 bytes, params: 2, frame: 2 return id === env0_0; } } function value_95897() { // fn#95897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:1900, offset: 0x02151a03, size: 28 bytes, params: 1, frame: 11 return env1_9.map(function(a0) { return a0.id; }); } function value_95899(a0) { // fn#95899, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:1964, offset: 0x02151a1f, size: 35 bytes, params: 2, frame: 11 const env0_0 = a0; return env1_9.filter(_fun95900); function _fun95900({userIds}) { // fn#95900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:1993, offset: 0x02151a42, size: 28 bytes, params: 2, frame: 11 return userIds.includes(env0_0); } } function value_95902() { // fn#95902, offset: 0x00fbd9ec, size: 9 bytes, params: 1, frame: 1 return env1_10; } function value_95903() { // fn#95903, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:2193, offset: 0x02151a8d, size: 25 bytes, params: 1, frame: 3 return {groups: env1_9, isInitialized: env1_10}; } } function POST_CONNECTION_OPEN_95904() { // fn#95904, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:2378, offset: 0x02151aa6, size: 47 bytes, params: 1, frame: 3 if (env0_10) { return false; } if (items2.length > 0) { return false; } items2 = []; } function CREATE_FRIEND_GROUP({groupId, name}) { // fn#95905, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:2475, offset: 0x02151ad5, size: 88 bytes, params: 2, frame: 14 var r0; let binding = env0_9; const value2 = binding.some(function({id}) { return id === groupId; }); if (value2) { r0 = !value2; } else { binding = env0_9; binding.push({id: groupId, name: name, userIds: []}); r0 = true; } return r0; } function UPDATE_FRIEND_GROUP({groupId, name}) { // fn#95907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:2617, offset: 0x02151b2d, size: 92 bytes, params: 2, frame: 15 var r0; var object; let binding = env0_9; const index = binding.findIndex(function({id}) { return id === groupId; }); const value2 = index !== -1; if (value2) { binding = env0_9; object = {}; copyDataProperties(object, binding[index], name); object['name'] = name; binding[index] = object; r0 = true; } else { r0 = value2; } return r0; } function DELETE_FRIEND_GROUP({groupId}) { // fn#95909, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:2765, offset: 0x02151b89, size: 63 bytes, params: 2, frame: 13 return env0_9.filter(function({id}) { return id !== groupId; }).length !== env0_9.length; } function REORDER_FRIEND_GROUPS({groupIds}) { // fn#95911, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:2894, offset: 0x02151bc8, size: 167 bytes, params: 2, frame: 17 var r3; var value7; var value8; var value9; const items2 = []; const Map = global.Map; const binding = env0_9; let map = binding.map; map = new Map(Reflect.apply(map, binding, [function(a0) { return [a0.id, a0]; }])); const value5 = _createForOfIteratorHelperLoose_95888(groupIds); const value6 = value5(); let done = value6.done; if (!done) { r3 = value6; while (true) { value7 = r3.value; value8 = map.get(value7); if (value8 != null) { items2.push(value8); } value9 = value5(); done = value9.done; if (done) { break; } r3 = value9; continue; } } return items2.length === env0_9.length && true; } function ADD_USERS_TO_GROUP({groupId, userIds}) { // fn#95913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:3144, offset: 0x02151c6f, size: 208 bytes, params: 2, frame: 18 var r0; var object; var items2; let binding = env0_9; const index = binding.findIndex(function({id}) { return id === groupId; }); if (index === -1) { return false; } const property = env0_9[index]; const Set = global.Set; const userIds2 = property.userIds; const set = new Set(userIds2); const value4 = userIds.filter(_fun95915); const value5 = value4.length !== 0; if (value5) { binding = env0_9; object = {}; copyDataProperties(object, property, undefined); userIds = property.userIds; items2 = []; arraySpread(items2, value4, arraySpread(items2, userIds, 0, 0), 0); object['userIds'] = items2; binding[index] = object; r0 = true; } else { r0 = value5; } return r0; function _fun95915(a0) { // fn#95915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:3294, offset: 0x00ec205d, size: 25 bytes, params: 2, frame: 11 return !CreateClass.has(a0); } } function REMOVE_USERS_FROM_GROUP({groupId, userIds}) { // fn#95916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:3400, offset: 0x02151d3f, size: 191 bytes, params: 2, frame: 16 var r0; var object; let binding = env0_9; const index = binding.findIndex(function({id}) { return id === groupId; }); if (index === -1) { return false; } const property = env0_9[index]; const Set = global.Set; const set = new Set(userIds); const userIds2 = property.userIds; const value4 = userIds2.filter(_fun95918); const length = value4.length; const userIds3 = property.userIds; const value5 = length !== userIds3.length; if (value5) { binding = env0_9; object = {}; copyDataProperties(object, property, userIds); object['userIds'] = value4; binding[index] = object; r0 = true; } else { r0 = value5; } return r0; function _fun95918(a0) { // fn#95918, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12738:3555, offset: 0x00ec205d, size: 25 bytes, params: 2, frame: 11 return !CreateClass.has(a0); } } } global.__d(_fun95884, 12548, [6, 7, 15, 17, 18, 5221, 5078, 3793, 1878, 566, 694, 2]) /* metro module 12548, dependencies: [6, 7, 15, 17, 18, 5221, 5078, 3793, 1878, 566, 694, 2] */;