/* Metro module 12548; source: modules/friend_groups/FriendGroupsStore.tsx; dependencies: [6, 7, 15, 17, 18, 5221, 5078, 3793, 1878, 566, 694, 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_0 = importDefault(6) /* metro dependency 6 */; const env0_1 = importDefault(7) /* metro dependency 7 */; const env0_2 = importDefault(15) /* metro dependency 15 */; const env0_3 = importDefault(17) /* metro dependency 17 */; const env0_4 = importDefault(18) /* metro dependency 18 */; const userAffinitiesV2Store = importDefault(5221) /* metro dependency 5221: UserAffinitiesV2Store */; const consentStore = importDefault(5078) /* metro dependency 5078: ConsentStore */; const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const env0_9 = []; const PersistedStore = (importDefault(566) /* metro dependency 566: 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}); (require(2) /* metro dependency 2 */).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 _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 closure = FriendGroupsStore; env0_4(closure, a0); return env0_1(closure, [{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 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 (env0_9.length > 0) { return false; } env0_9 = []; } 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 object2; let binding = env0_9; const index = binding.findIndex(function({id}) { return id === groupId; }); const value2 = index !== -1; if (value2) { binding = env0_9; object2 = {}; copyDataProperties(object2, binding[index], name); object2['name'] = name; binding[index] = object2; 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 object2; 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; object2 = {}; copyDataProperties(object2, property, undefined); userIds = property.userIds; items2 = []; arraySpread(items2, value4, arraySpread(items2, userIds, 0, 0), 0); object2['userIds'] = items2; binding[index] = object2; r0 = true; } else { r0 = value5; } return r0; } 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 object2; 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; object2 = {}; copyDataProperties(object2, property, userIds); object2['userIds'] = value4; binding[index] = object2; r0 = true; } else { r0 = value5; } return r0; } 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 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 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 _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); }