// Metro module 12775 (f12776). import Module589 from "../../_bundle/Module589"; import GuildActionCreators from "../../actions/GuildActionCreators"; import Dispatcher from "../../Dispatcher"; let c8806_2, c8806_3, length; const resetStates = function resetStates() { c8806_3 = {}; }; c8806_2 = { NOT_FETCHED: 0, 0: "NOT_FETCHED", FETCHING: 1, 1: "FETCHING", FETCHED: 2, 2: "FETCHED" }; c8806_3 = {}; length = 0; class GuildFriendshipStore extends Module589.Store { isFetchingFriendsForGuild(a0) { let r6 = c8806_3[a0]?.fetchState; if (r6 == null) { r6 = c8806_2.NOT_FETCHED; } return r6 === c8806_2.FETCHING; } fetchFriendMembersIfNotFetched(a0, a1) { let r5 = c8806_3[a0]?.fetchState; if (r5 == null) { r5 = c8806_2.NOT_FETCHED; } if (r5 === c8806_2.NOT_FETCHED) { c8806_3[a0] = { fetchState: c8806_2.FETCHING, foundMembers: 0, notFoundMembers: 0 }; length = a1.length; GuildActionCreators.requestMembersById(a0, a1, false); } } } const guildFriendshipStore = new GuildFriendshipStore(Dispatcher, { CONNECTION_OPEN: resetStates, LOGOUT: resetStates, RELATIONSHIP_ADD: resetStates, RELATIONSHIP_REMOVE: resetStates, GUILD_MEMBERS_CHUNK_BATCH: function onMemberChunk(a0) { const r7 = a0.chunks[0]; const guildId = r7.guildId; let r9 = c8806_3[guildId]?.fetchState; if (r9 == null) { r9 = c8806_2.NOT_FETCHED; } if (r9 === c8806_2.FETCHING) { const r17 = c8806_3[guildId]; r17.foundMembers = r17.foundMembers + r7.members.length; const r22 = c8806_3[guildId]; const notFoundMembers = r22.notFoundMembers; let r26 = r7.notFound?.length; if (r26 == null) { r26 = 0; } r22.notFoundMembers = notFoundMembers + r26; if (c8806_3[guildId].foundMembers + c8806_3[guildId].notFoundMembers >= length) { c8806_3[guildId].fetchState = c8806_2.FETCHED; } } } }); export default guildFriendshipStore;