/* Metro module 9163; source: stores/InviteSuggestionsStore.tsx; dependencies: [6, 7, 15, 17, 18, 7233, 5221, 1379, 3784, 3793, 661, 4118, 9153, 1360, 566, 694, 2] */ function _fun71847(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#71847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:6, offset: 0x01d2f6df, size: 553 bytes, params: 8, frame: 20 const env0_0 = require; const _arrayLikeToArray_71853 = 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 _updateInviteSuggestions = function(a0) { env0_22 = a0; var Map = global.Map; var value3 = new Map(); a0.forEach(_fun71860); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_2 = importDefault(6) /* metro dependency 6 */; const env0_3 = importDefault(7) /* metro dependency 7 */; const env0_4 = importDefault(15) /* metro dependency 15 */; const env0_5 = importDefault(17) /* metro dependency 17 */; const env0_6 = importDefault(18) /* metro dependency 18 */; const quickSwitcherStore = importDefault(7233) /* metro dependency 7233: QuickSwitcherStore */; const userAffinitiesV2Store = importDefault(5221) /* metro dependency 5221: UserAffinitiesV2Store */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */; const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */; const constantsModule = require(661) /* metro dependency 661: Constants */; const env0_12 = constantsModule.ChannelTypes; const env0_13 = constantsModule.Permissions; const env0_14 = (require(4118) /* metro dependency 4118: Constants */).InviteTargetTypes; const Set = global.Set; const set = new Set(); let env0_22 = []; let Map = global.Map; let map = new Map(); const env0_24 = {'numFriends': 0, 'numDms': 0, 'numGroupDms': 0, 'numChannels': 0}; const Store = (importDefault(566) /* metro dependency 566: flux */).Store; _fun71861(Store).displayName = 'InviteSuggestionsStore'; map = new map(importDefault(694) /* metro dependency 694: Dispatcher */, {LOAD_INVITE_SUGGESTIONS: LOAD_INVITE_SUGGESTIONS, INVITE_SUGGESTIONS_SEARCH: function({query}) { env0_16 = query !== ''; query = _computeRows(query).rows; query.sort(_fun71871); _updateInviteSuggestions(query); }}); (require(2) /* metro dependency 2 */).fileFinishedImporting('stores/InviteSuggestionsStore.tsx'); exports.default = map; } function _isNativeReflectConstruct_71848() { // fn#71848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:275, offset: 0x01d2f908, 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_71848_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_71851(a0, a1) { // fn#71851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:468, offset: 0x01d2f96a, 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 _fun71852; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_71853(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_71853(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_71853(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun71852; } 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 _computeRows(a0) { // fn#71854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:1473, offset: 0x01d2fade, size: 536 bytes, params: 2, frame: 21 var type; var r4; var id; var r8; var EMBEDDED_APPLICATION; var value7; var isBlockedOrIgnored; var id2; var isBlockedOrIgnored2; var add; var id3; var value12; var otherUserId; var value13; var getChannelHistory; var value16; var map; var value17; var filter; var isNotNullish; var value18; var value19; var value20; var slice; var value21; var forEach; let Set = global.Set; let set = new Set(); let binding = env0_18; const value3 = null; reducibleJoin2: while (true) { if (value3 == binding) { type = undefined; break reducibleJoin2; } type = binding.type; break reducibleJoin2; } const GUILD_VOICE = ChannelTypes.GUILD_VOICE; const value5 = type === GUILD_VOICE; const value6 = value3 == env0_17; reducibleJoin4: while (true) { if (value6) { r4 = value6; break reducibleJoin4; } binding = env0_20; EMBEDDED_APPLICATION = InviteTargetTypes.EMBEDDED_APPLICATION; value7 = binding === EMBEDDED_APPLICATION; r4 = value7; break reducibleJoin4; } r4 = !r4 ? value5 : r4; reducibleJoin7: while (true) { if (r4) { id = value3; break reducibleJoin7; } id = env0_17.id; break reducibleJoin7; } const mostRecentDMedUser = (require(9153) /* metro dependency 9153: InstantInviteUtils */).getMostRecentDMedUser(env0_21, id); const value9 = value3 == mostRecentDMedUser; reducibleJoin9: while (true) { if (value9) { r8 = value9; break reducibleJoin9; } isBlockedOrIgnored = RelationshipStore.isBlockedOrIgnored; id2 = mostRecentDMedUser.id; isBlockedOrIgnored2 = Reflect.apply(isBlockedOrIgnored, RelationshipStore, [id2]); r8 = isBlockedOrIgnored2; break reducibleJoin9; } reducibleJoin11: while (true) { if (r8) { break reducibleJoin11; } add = set.add; id3 = mostRecentDMedUser.id; Reflect.apply(add, set, [id3]); break reducibleJoin11; } const _createForOfIteratorHelperLoose_71851Binding = _createForOfIteratorHelperLoose_71851; const getUserAffinities = UserAffinitiesV2Store.getUserAffinities; const value10 = _createForOfIteratorHelperLoose_71851Binding(Reflect.apply(getUserAffinities, UserAffinitiesV2Store, [])); const value11 = value10(); let done = value11.done; if (!done) { r8 = value11; reducibleLoop12: while (true) { value12 = r8.value; add = set.add; otherUserId = value12.otherUserId; Reflect.apply(add, set, [otherUserId]); value13 = value10(); done = value13.done; if (done) { break reducibleLoop12; } r8 = value13; continue reducibleLoop12; } } Set = global.Set; set = new Set(); binding = env0_20; EMBEDDED_APPLICATION = InviteTargetTypes.EMBEDDED_APPLICATION; reducibleJoin15: while (true) { if (binding !== EMBEDDED_APPLICATION) { break reducibleJoin15; } getChannelHistory = QuickSwitcherStore.getChannelHistory; value16 = Reflect.apply(getChannelHistory, QuickSwitcherStore, []); map = value16.map; value17 = Reflect.apply(map, value16, [function(a0) { return ChannelStore.getChannel(a0); }]); filter = value17.filter; isNotNullish = (require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish; value18 = Reflect.apply(filter, value17, [isNotNullish]); filter = value18.filter; value19 = Reflect.apply(filter, value18, [_fun71856]); filter = value19.filter; value20 = Reflect.apply(filter, value19, [_fun71857]); slice = value20.slice; value21 = Reflect.apply(slice, value20, [0, 3]); forEach = value21.forEach; Reflect.apply(forEach, value21, [_fun71858]); break reducibleJoin15; } const instantInviteUtilsModule = require(9153) /* metro dependency 9153: InstantInviteUtils */; return instantInviteUtilsModule.generateRowsForQuery({query: a0, omitUserIds: env0_21, suggestedUserIds: set, maxRowsWithoutQuery: 100, omitGuildId: id, suggestedChannelIds: set, inviteTargetType: env0_20}); } function _updateInviteSuggestions(a0) { // fn#71859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2218, offset: 0x01d2fd49, size: 65 bytes, params: 2, frame: 12 env0_22 = a0; const Map = global.Map; const map = new Map(); a0.forEach(_fun71860); } function _fun71861(a0) { // fn#71861, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2316, offset: 0x01d2fdac, size: 176 bytes, params: 2, frame: 16 const closure = InviteSuggestionsStore; env0_6(closure, a0); return env0_3(closure, [{key: 'initialize', value: function() { this.waitFor(ChannelStore, PermissionStore, QuickSwitcherStore, RelationshipStore, UserAffinitiesV2Store); }}, {key: 'getInviteSuggestionRows', value: value_71864}, {key: 'getTotalSuggestionsCount', value: value_71865}, {key: 'getInitialCounts', value: value_71866}, {key: 'getSelectedInviteMetadata', value: value_71867}]); } function LOAD_INVITE_SUGGESTIONS({omitUserIds, guild, channel, applicationId, inviteTargetType}) { // fn#71869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:3216, offset: 0x01d2ff0b, size: 261 bytes, params: 2, frame: 19 const r3 = channel != null ? guild : null; env0_18 = channel; env0_19 = applicationId; const blockedOrIgnoredIDs = RelationshipStore.getBlockedOrIgnoredIDs(); const instantInviteUtilsModule = require(9153) /* metro dependency 9153: InstantInviteUtils */; const getUsersAlreadyJoined = instantInviteUtilsModule.getUsersAlreadyJoined; const binding = env0_19; const value3 = Reflect.apply(getUsersAlreadyJoined, instantInviteUtilsModule, [{channel: env0_18, applicationId: binding, inviteTargetType: inviteTargetType}]); const Set = global.Set; items = []; arraySpread(items, value3, arraySpread(items, blockedOrIgnoredIDs, arraySpread(items, omitUserIds, 0, binding), binding), binding); const set = new Set(items); const {rows, counts} = _computeRows(''); _updateInviteSuggestions(rows); env0_15 = env0_22.length; } function INVITE_SUGGESTIONS_SEARCH({query}) { // fn#71870, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:3610, offset: 0x01d30010, size: 72 bytes, params: 2, frame: 13 result = query !== ''; const rows = _computeRows(query).rows; rows.sort(function(a0, a1) { return a0.score != null && a1.score != null ? a0.score - a1.score : 0; }); _updateInviteSuggestions(rows); } function _fun71856({type}) { // fn#71856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:1955, offset: 0x01d2fd0c, size: 27 bytes, params: 2, frame: 2 const GUILD_TEXT = ChannelTypes.GUILD_TEXT; return type === GUILD_TEXT; } function _fun71857(a0) { // fn#71857, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:1990, offset: 0x01d2fd27, size: 34 bytes, params: 2, frame: 13 const can = PermissionStore.can; const SEND_MESSAGES = Permissions.SEND_MESSAGES; return Reflect.apply(can, PermissionStore, [SEND_MESSAGES, a0]); } function _fun71860(a0, a1) { // fn#71860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2280, offset: 0x01d2fd8a, size: 34 bytes, params: 3, frame: 13 env1_23.set(a0, {index: a1}); } function value_71867(a0) { // fn#71867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2903, offset: 0x01d2fe87, size: 121 bytes, params: 2, frame: 14 var object2; var length; const value2 = env1_23.get(a0); if (value2 != null) { object2 = {}; object2.rowNum = value2.index; object2.isAffinitySuggestion = a0.isSuggested; length = env1_22.length; object2.numTotal = length; length = UserAffinitiesV2Store.getUserAffinities().map(function(a0) { return a0.otherUserId; }).length; object2.numAffinityConnections = length; object2.isFiltered = env1_16; return object2; } }