package com.discord.widgets.guilds.list; import a0.a.a.b; import android.content.Context; import androidx.fragment.app.FragmentManager; import androidx.media.AudioAttributesCompat; import c.d.b.a.a; import com.airbnb.lottie.parser.AnimatableValueParser; import com.discord.R; import com.discord.api.channel.Channel; import com.discord.api.guildjoinrequest.ApplicationStatus; import com.discord.api.guildjoinrequest.GuildJoinRequest; import com.discord.api.permission.Permission; import com.discord.app.AppViewModel; import com.discord.models.domain.ModelNotificationSettings; import com.discord.models.guild.Guild; import com.discord.restapi.RestAPIParams; import com.discord.stores.StoreGuildsSorted; import com.discord.stores.StoreNavigation; import com.discord.stores.StoreStream; import com.discord.stores.StoreUser; import com.discord.utilities.channel.ChannelSelector; import com.discord.utilities.features.GrowthTeamFeatures; import com.discord.utilities.guilds.MemberVerificationUtils; import com.discord.utilities.permissions.PermissionUtils; import com.discord.utilities.rest.RestAPI; import com.discord.utilities.rx.ObservableExtensionsKt; import com.discord.utilities.streams.StreamContext; import com.discord.utilities.streams.StreamContextService; import com.discord.utilities.time.Clock; import com.discord.utilities.time.ClockFactory; import com.discord.widgets.guilds.list.GuildListItem; import com.discord.widgets.guilds.list.WidgetGuildListAdapter; import d0.c0.c; import d0.f0.q; import d0.t.n; import d0.t.r; import d0.t.u; import d0.z.d.m; import d0.z.d.o; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.TimeUnit; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.sequences.Sequence; import rx.Observable; import rx.subjects.PublishSubject; /* compiled from: WidgetGuildsListViewModel.kt */ public final class WidgetGuildsListViewModel extends AppViewModel { public static final Companion Companion = new Companion(null); private final Clock clock; private WidgetGuildListAdapter.Operation.TargetOperation currentTargetOperation; private final PublishSubject eventSubject; private boolean wasLeftPanelOpened; private boolean wasOnHomeTab; /* compiled from: WidgetGuildsListViewModel.kt */ /* renamed from: com.discord.widgets.guilds.list.WidgetGuildsListViewModel$1 reason: invalid class name */ public static final class AnonymousClass1 extends o implements Function1 { public final /* synthetic */ WidgetGuildsListViewModel this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnonymousClass1(WidgetGuildsListViewModel widgetGuildsListViewModel) { super(1); this.this$0 = widgetGuildsListViewModel; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kotlin.jvm.functions.Function1 public /* bridge */ /* synthetic */ Unit invoke(StoreState storeState) { invoke(storeState); return Unit.a; } public final void invoke(StoreState storeState) { WidgetGuildsListViewModel widgetGuildsListViewModel = this.this$0; m.checkNotNullExpressionValue(storeState, "storeState"); WidgetGuildsListViewModel.access$handleStoreState(widgetGuildsListViewModel, storeState); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class Companion { /* compiled from: WidgetGuildsListViewModel.kt */ public static final class Chunk { private final Map> channelIds; private final Map guildSettings; private final Map mentionCounts; private final Map privateChannels; private final long selectedGuildId; private final long selectedVoiceChannelId; private final List sortedGuilds; private final Set unavailableGuilds; private final Set unreadGuildIds; /* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: java.util.Map */ /* JADX DEBUG: Multi-variable search result rejected for r9v0, resolved type: java.util.Map> */ /* JADX DEBUG: Multi-variable search result rejected for r12v0, resolved type: java.util.List */ /* JADX WARN: Multi-variable type inference failed */ public Chunk(long j, long j2, Map map, Set set, Map map2, Map> map3, Set set2, Map map4, List list) { m.checkNotNullParameter(map, "guildSettings"); m.checkNotNullParameter(set, "unreadGuildIds"); m.checkNotNullParameter(map2, "mentionCounts"); m.checkNotNullParameter(map3, "channelIds"); m.checkNotNullParameter(set2, "unavailableGuilds"); m.checkNotNullParameter(map4, "privateChannels"); m.checkNotNullParameter(list, "sortedGuilds"); this.selectedGuildId = j; this.selectedVoiceChannelId = j2; this.guildSettings = map; this.unreadGuildIds = set; this.mentionCounts = map2; this.channelIds = map3; this.unavailableGuilds = set2; this.privateChannels = map4; this.sortedGuilds = list; } public static /* synthetic */ Chunk copy$default(Chunk chunk, long j, long j2, Map map, Set set, Map map2, Map map3, Set set2, Map map4, List list, int i, Object obj) { return chunk.copy((i & 1) != 0 ? chunk.selectedGuildId : j, (i & 2) != 0 ? chunk.selectedVoiceChannelId : j2, (i & 4) != 0 ? chunk.guildSettings : map, (i & 8) != 0 ? chunk.unreadGuildIds : set, (i & 16) != 0 ? chunk.mentionCounts : map2, (i & 32) != 0 ? chunk.channelIds : map3, (i & 64) != 0 ? chunk.unavailableGuilds : set2, (i & 128) != 0 ? chunk.privateChannels : map4, (i & 256) != 0 ? chunk.sortedGuilds : list); } public final long component1() { return this.selectedGuildId; } public final long component2() { return this.selectedVoiceChannelId; } public final Map component3() { return this.guildSettings; } public final Set component4() { return this.unreadGuildIds; } public final Map component5() { return this.mentionCounts; } public final Map> component6() { return this.channelIds; } public final Set component7() { return this.unavailableGuilds; } public final Map component8() { return this.privateChannels; } public final List component9() { return this.sortedGuilds; } public final Chunk copy(long j, long j2, Map map, Set set, Map map2, Map> map3, Set set2, Map map4, List list) { m.checkNotNullParameter(map, "guildSettings"); m.checkNotNullParameter(set, "unreadGuildIds"); m.checkNotNullParameter(map2, "mentionCounts"); m.checkNotNullParameter(map3, "channelIds"); m.checkNotNullParameter(set2, "unavailableGuilds"); m.checkNotNullParameter(map4, "privateChannels"); m.checkNotNullParameter(list, "sortedGuilds"); return new Chunk(j, j2, map, set, map2, map3, set2, map4, list); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Chunk)) { return false; } Chunk chunk = (Chunk) obj; return this.selectedGuildId == chunk.selectedGuildId && this.selectedVoiceChannelId == chunk.selectedVoiceChannelId && m.areEqual(this.guildSettings, chunk.guildSettings) && m.areEqual(this.unreadGuildIds, chunk.unreadGuildIds) && m.areEqual(this.mentionCounts, chunk.mentionCounts) && m.areEqual(this.channelIds, chunk.channelIds) && m.areEqual(this.unavailableGuilds, chunk.unavailableGuilds) && m.areEqual(this.privateChannels, chunk.privateChannels) && m.areEqual(this.sortedGuilds, chunk.sortedGuilds); } public final Map> getChannelIds() { return this.channelIds; } public final Map getGuildSettings() { return this.guildSettings; } public final Map getMentionCounts() { return this.mentionCounts; } public final Map getPrivateChannels() { return this.privateChannels; } public final long getSelectedGuildId() { return this.selectedGuildId; } public final long getSelectedVoiceChannelId() { return this.selectedVoiceChannelId; } public final List getSortedGuilds() { return this.sortedGuilds; } public final Set getUnavailableGuilds() { return this.unavailableGuilds; } public final Set getUnreadGuildIds() { return this.unreadGuildIds; } public int hashCode() { int a = (b.a(this.selectedVoiceChannelId) + (b.a(this.selectedGuildId) * 31)) * 31; Map map = this.guildSettings; int i = 0; int hashCode = (a + (map != null ? map.hashCode() : 0)) * 31; Set set = this.unreadGuildIds; int hashCode2 = (hashCode + (set != null ? set.hashCode() : 0)) * 31; Map map2 = this.mentionCounts; int hashCode3 = (hashCode2 + (map2 != null ? map2.hashCode() : 0)) * 31; Map> map3 = this.channelIds; int hashCode4 = (hashCode3 + (map3 != null ? map3.hashCode() : 0)) * 31; Set set2 = this.unavailableGuilds; int hashCode5 = (hashCode4 + (set2 != null ? set2.hashCode() : 0)) * 31; Map map4 = this.privateChannels; int hashCode6 = (hashCode5 + (map4 != null ? map4.hashCode() : 0)) * 31; List list = this.sortedGuilds; if (list != null) { i = list.hashCode(); } return hashCode6 + i; } public String toString() { StringBuilder L = a.L("Chunk(selectedGuildId="); L.append(this.selectedGuildId); L.append(", selectedVoiceChannelId="); L.append(this.selectedVoiceChannelId); L.append(", guildSettings="); L.append(this.guildSettings); L.append(", unreadGuildIds="); L.append(this.unreadGuildIds); L.append(", mentionCounts="); L.append(this.mentionCounts); L.append(", channelIds="); L.append(this.channelIds); L.append(", unavailableGuilds="); L.append(this.unavailableGuilds); L.append(", privateChannels="); L.append(this.privateChannels); L.append(", sortedGuilds="); return a.E(L, this.sortedGuilds, ")"); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class SecondChunk { private final Map channels; private final Set guildIds; private final Set guildIdsWithActiveStageEvents; private final Map guildJoinRequests; private final List pendingGuilds; private final boolean showHubSparkle; public SecondChunk(Map map, List list, Set set, Set set2, Map map2, boolean z2) { m.checkNotNullParameter(map, "guildJoinRequests"); m.checkNotNullParameter(list, "pendingGuilds"); m.checkNotNullParameter(set, "guildIds"); m.checkNotNullParameter(set2, "guildIdsWithActiveStageEvents"); m.checkNotNullParameter(map2, "channels"); this.guildJoinRequests = map; this.pendingGuilds = list; this.guildIds = set; this.guildIdsWithActiveStageEvents = set2; this.channels = map2; this.showHubSparkle = z2; } /* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.discord.widgets.guilds.list.WidgetGuildsListViewModel$Companion$SecondChunk */ /* JADX WARN: Multi-variable type inference failed */ public static /* synthetic */ SecondChunk copy$default(SecondChunk secondChunk, Map map, List list, Set set, Set set2, Map map2, boolean z2, int i, Object obj) { if ((i & 1) != 0) { map = secondChunk.guildJoinRequests; } if ((i & 2) != 0) { list = secondChunk.pendingGuilds; } if ((i & 4) != 0) { set = secondChunk.guildIds; } if ((i & 8) != 0) { set2 = secondChunk.guildIdsWithActiveStageEvents; } if ((i & 16) != 0) { map2 = secondChunk.channels; } if ((i & 32) != 0) { z2 = secondChunk.showHubSparkle; } return secondChunk.copy(map, list, set, set2, map2, z2); } public final Map component1() { return this.guildJoinRequests; } public final List component2() { return this.pendingGuilds; } public final Set component3() { return this.guildIds; } public final Set component4() { return this.guildIdsWithActiveStageEvents; } public final Map component5() { return this.channels; } public final boolean component6() { return this.showHubSparkle; } public final SecondChunk copy(Map map, List list, Set set, Set set2, Map map2, boolean z2) { m.checkNotNullParameter(map, "guildJoinRequests"); m.checkNotNullParameter(list, "pendingGuilds"); m.checkNotNullParameter(set, "guildIds"); m.checkNotNullParameter(set2, "guildIdsWithActiveStageEvents"); m.checkNotNullParameter(map2, "channels"); return new SecondChunk(map, list, set, set2, map2, z2); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof SecondChunk)) { return false; } SecondChunk secondChunk = (SecondChunk) obj; return m.areEqual(this.guildJoinRequests, secondChunk.guildJoinRequests) && m.areEqual(this.pendingGuilds, secondChunk.pendingGuilds) && m.areEqual(this.guildIds, secondChunk.guildIds) && m.areEqual(this.guildIdsWithActiveStageEvents, secondChunk.guildIdsWithActiveStageEvents) && m.areEqual(this.channels, secondChunk.channels) && this.showHubSparkle == secondChunk.showHubSparkle; } public final Map getChannels() { return this.channels; } public final Set getGuildIds() { return this.guildIds; } public final Set getGuildIdsWithActiveStageEvents() { return this.guildIdsWithActiveStageEvents; } public final Map getGuildJoinRequests() { return this.guildJoinRequests; } public final List getPendingGuilds() { return this.pendingGuilds; } public final boolean getShowHubSparkle() { return this.showHubSparkle; } public int hashCode() { Map map = this.guildJoinRequests; int i = 0; int hashCode = (map != null ? map.hashCode() : 0) * 31; List list = this.pendingGuilds; int hashCode2 = (hashCode + (list != null ? list.hashCode() : 0)) * 31; Set set = this.guildIds; int hashCode3 = (hashCode2 + (set != null ? set.hashCode() : 0)) * 31; Set set2 = this.guildIdsWithActiveStageEvents; int hashCode4 = (hashCode3 + (set2 != null ? set2.hashCode() : 0)) * 31; Map map2 = this.channels; if (map2 != null) { i = map2.hashCode(); } int i2 = (hashCode4 + i) * 31; boolean z2 = this.showHubSparkle; if (z2) { z2 = true; } int i3 = z2 ? 1 : 0; int i4 = z2 ? 1 : 0; int i5 = z2 ? 1 : 0; return i2 + i3; } public String toString() { StringBuilder L = a.L("SecondChunk(guildJoinRequests="); L.append(this.guildJoinRequests); L.append(", pendingGuilds="); L.append(this.pendingGuilds); L.append(", guildIds="); L.append(this.guildIds); L.append(", guildIdsWithActiveStageEvents="); L.append(this.guildIdsWithActiveStageEvents); L.append(", channels="); L.append(this.channels); L.append(", showHubSparkle="); return a.G(L, this.showHubSparkle, ")"); } } private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public static final /* synthetic */ Observable access$observeStores(Companion companion, Clock clock) { return companion.observeStores(clock); } private final Observable observeStores(Clock clock) { WidgetGuildsListViewModel$Companion$observeStores$1 widgetGuildsListViewModel$Companion$observeStores$1 = WidgetGuildsListViewModel$Companion$observeStores$1.INSTANCE; WidgetGuildsListViewModel$Companion$observeStores$2 widgetGuildsListViewModel$Companion$observeStores$2 = WidgetGuildsListViewModel$Companion$observeStores$2.INSTANCE; Observable invoke = widgetGuildsListViewModel$Companion$observeStores$1.mo1invoke(); Observable invoke2 = widgetGuildsListViewModel$Companion$observeStores$2.mo1invoke(); StoreStream.Companion companion = StoreStream.Companion; Observable c2 = Observable.c(invoke, invoke2, companion.getLurking().getLurkingGuildIds(), companion.getExpandedGuildFolders().observeOpenFolderIds(), StoreUser.observeMe$default(companion.getUsers(), false, 1, null).r().F(new WidgetGuildsListViewModel$Companion$observeStores$3(clock)), new StreamContextService(null, null, null, null, null, null, null, null, 255, null).getForAllStreamingUsers(), companion.getPermissions().observePermissionsForAllChannels(), companion.getNavigation().observeLeftPanelState().F(WidgetGuildsListViewModel$Companion$observeStores$4.INSTANCE), companion.getTabsNavigation().observeSelectedTab().F(WidgetGuildsListViewModel$Companion$observeStores$5.INSTANCE), WidgetGuildsListViewModel$Companion$observeStores$6.INSTANCE); m.checkNotNullExpressionValue(c2, "Observable.combineLatest…Sparkle\n )\n }"); return ObservableExtensionsKt.leadingEdgeThrottle(c2, 100, TimeUnit.MILLISECONDS); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static abstract class Event { /* compiled from: WidgetGuildsListViewModel.kt */ public static final class AnnounceFolderToggleForAccessibility extends Event { private final GuildListItem.FolderItem item; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnnounceFolderToggleForAccessibility(GuildListItem.FolderItem folderItem) { super(null); m.checkNotNullParameter(folderItem, "item"); this.item = folderItem; } public static /* synthetic */ AnnounceFolderToggleForAccessibility copy$default(AnnounceFolderToggleForAccessibility announceFolderToggleForAccessibility, GuildListItem.FolderItem folderItem, int i, Object obj) { if ((i & 1) != 0) { folderItem = announceFolderToggleForAccessibility.item; } return announceFolderToggleForAccessibility.copy(folderItem); } public final GuildListItem.FolderItem component1() { return this.item; } public final AnnounceFolderToggleForAccessibility copy(GuildListItem.FolderItem folderItem) { m.checkNotNullParameter(folderItem, "item"); return new AnnounceFolderToggleForAccessibility(folderItem); } public boolean equals(Object obj) { if (this != obj) { return (obj instanceof AnnounceFolderToggleForAccessibility) && m.areEqual(this.item, ((AnnounceFolderToggleForAccessibility) obj).item); } return true; } public final GuildListItem.FolderItem getItem() { return this.item; } public int hashCode() { GuildListItem.FolderItem folderItem = this.item; if (folderItem != null) { return folderItem.hashCode(); } return 0; } public String toString() { StringBuilder L = a.L("AnnounceFolderToggleForAccessibility(item="); L.append(this.item); L.append(")"); return L.toString(); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class FocusFirstElement extends Event { public static final FocusFirstElement INSTANCE = new FocusFirstElement(); private FocusFirstElement() { super(null); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class ShowChannelActions extends Event { private final long channelId; public ShowChannelActions(long j) { super(null); this.channelId = j; } public static /* synthetic */ ShowChannelActions copy$default(ShowChannelActions showChannelActions, long j, int i, Object obj) { if ((i & 1) != 0) { j = showChannelActions.channelId; } return showChannelActions.copy(j); } public final long component1() { return this.channelId; } public final ShowChannelActions copy(long j) { return new ShowChannelActions(j); } public boolean equals(Object obj) { if (this != obj) { return (obj instanceof ShowChannelActions) && this.channelId == ((ShowChannelActions) obj).channelId; } return true; } public final long getChannelId() { return this.channelId; } public int hashCode() { return b.a(this.channelId); } public String toString() { return a.y(a.L("ShowChannelActions(channelId="), this.channelId, ")"); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class ShowCreateGuild extends Event { public static final ShowCreateGuild INSTANCE = new ShowCreateGuild(); private ShowCreateGuild() { super(null); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class ShowHelp extends Event { public static final ShowHelp INSTANCE = new ShowHelp(); private ShowHelp() { super(null); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class ShowHubVerification extends Event { public static final ShowHubVerification INSTANCE = new ShowHubVerification(); private ShowHubVerification() { super(null); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class ShowUnavailableGuilds extends Event { private final int unavailableGuildCount; public ShowUnavailableGuilds(int i) { super(null); this.unavailableGuildCount = i; } public static /* synthetic */ ShowUnavailableGuilds copy$default(ShowUnavailableGuilds showUnavailableGuilds, int i, int i2, Object obj) { if ((i2 & 1) != 0) { i = showUnavailableGuilds.unavailableGuildCount; } return showUnavailableGuilds.copy(i); } public final int component1() { return this.unavailableGuildCount; } public final ShowUnavailableGuilds copy(int i) { return new ShowUnavailableGuilds(i); } public boolean equals(Object obj) { if (this != obj) { return (obj instanceof ShowUnavailableGuilds) && this.unavailableGuildCount == ((ShowUnavailableGuilds) obj).unavailableGuildCount; } return true; } public final int getUnavailableGuildCount() { return this.unavailableGuildCount; } public int hashCode() { return this.unavailableGuildCount; } public String toString() { return a.w(a.L("ShowUnavailableGuilds(unavailableGuildCount="), this.unavailableGuildCount, ")"); } } private Event() { } public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) { this(); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class StoreState { private final Map allApplicationStreamContexts; private final Map allChannelPermissions; private final Map> channelIds; private final Map channels; private final Set guildIds; private final Set guildIdsWithActiveStageEvents; private final Map guildJoinRequests; private final Map guildSettings; private final boolean isLeftPanelOpened; private final boolean isNewUser; private final boolean isOnHomeTab; private final Set lurkingGuildIds; private final Map mentionCounts; private final Set openFolderIds; private final List pendingGuilds; private final Map privateChannels; private final long selectedGuildId; private final long selectedVoiceChannelId; private final boolean showHubSparkle; private final List sortedGuilds; private final Set unavailableGuilds; private final Set unreadGuildIds; /* JADX DEBUG: Multi-variable search result rejected for r21v0, resolved type: java.util.Map */ /* JADX DEBUG: Multi-variable search result rejected for r24v0, resolved type: java.util.Map> */ /* JADX DEBUG: Multi-variable search result rejected for r27v0, resolved type: java.util.List */ /* JADX WARN: Multi-variable type inference failed */ public StoreState(long j, long j2, Map map, Set set, Map map2, Map> map3, Set set2, Map map4, List list, Map map5, List list2, Set set3, Set set4, Set set5, Map map6, Set set6, boolean z2, Map map7, Map map8, boolean z3, boolean z4, boolean z5) { m.checkNotNullParameter(map, "guildSettings"); m.checkNotNullParameter(set, "unreadGuildIds"); m.checkNotNullParameter(map2, "mentionCounts"); m.checkNotNullParameter(map3, "channelIds"); m.checkNotNullParameter(set2, "unavailableGuilds"); m.checkNotNullParameter(map4, "privateChannels"); m.checkNotNullParameter(list, "sortedGuilds"); m.checkNotNullParameter(map5, "guildJoinRequests"); m.checkNotNullParameter(list2, "pendingGuilds"); m.checkNotNullParameter(set3, "guildIds"); m.checkNotNullParameter(set4, "lurkingGuildIds"); m.checkNotNullParameter(set5, "guildIdsWithActiveStageEvents"); m.checkNotNullParameter(map6, "channels"); m.checkNotNullParameter(set6, "openFolderIds"); m.checkNotNullParameter(map7, "allApplicationStreamContexts"); m.checkNotNullParameter(map8, "allChannelPermissions"); this.selectedGuildId = j; this.selectedVoiceChannelId = j2; this.guildSettings = map; this.unreadGuildIds = set; this.mentionCounts = map2; this.channelIds = map3; this.unavailableGuilds = set2; this.privateChannels = map4; this.sortedGuilds = list; this.guildJoinRequests = map5; this.pendingGuilds = list2; this.guildIds = set3; this.lurkingGuildIds = set4; this.guildIdsWithActiveStageEvents = set5; this.channels = map6; this.openFolderIds = set6; this.isNewUser = z2; this.allApplicationStreamContexts = map7; this.allChannelPermissions = map8; this.isLeftPanelOpened = z3; this.isOnHomeTab = z4; this.showHubSparkle = z5; } public static /* synthetic */ StoreState copy$default(StoreState storeState, long j, long j2, Map map, Set set, Map map2, Map map3, Set set2, Map map4, List list, Map map5, List list2, Set set3, Set set4, Set set5, Map map6, Set set6, boolean z2, Map map7, Map map8, boolean z3, boolean z4, boolean z5, int i, Object obj) { return storeState.copy((i & 1) != 0 ? storeState.selectedGuildId : j, (i & 2) != 0 ? storeState.selectedVoiceChannelId : j2, (i & 4) != 0 ? storeState.guildSettings : map, (i & 8) != 0 ? storeState.unreadGuildIds : set, (i & 16) != 0 ? storeState.mentionCounts : map2, (i & 32) != 0 ? storeState.channelIds : map3, (i & 64) != 0 ? storeState.unavailableGuilds : set2, (i & 128) != 0 ? storeState.privateChannels : map4, (i & 256) != 0 ? storeState.sortedGuilds : list, (i & 512) != 0 ? storeState.guildJoinRequests : map5, (i & 1024) != 0 ? storeState.pendingGuilds : list2, (i & 2048) != 0 ? storeState.guildIds : set3, (i & 4096) != 0 ? storeState.lurkingGuildIds : set4, (i & 8192) != 0 ? storeState.guildIdsWithActiveStageEvents : set5, (i & 16384) != 0 ? storeState.channels : map6, (i & 32768) != 0 ? storeState.openFolderIds : set6, (i & 65536) != 0 ? storeState.isNewUser : z2, (i & 131072) != 0 ? storeState.allApplicationStreamContexts : map7, (i & 262144) != 0 ? storeState.allChannelPermissions : map8, (i & 524288) != 0 ? storeState.isLeftPanelOpened : z3, (i & 1048576) != 0 ? storeState.isOnHomeTab : z4, (i & 2097152) != 0 ? storeState.showHubSparkle : z5); } public final long component1() { return this.selectedGuildId; } public final Map component10() { return this.guildJoinRequests; } public final List component11() { return this.pendingGuilds; } public final Set component12() { return this.guildIds; } public final Set component13() { return this.lurkingGuildIds; } public final Set component14() { return this.guildIdsWithActiveStageEvents; } public final Map component15() { return this.channels; } public final Set component16() { return this.openFolderIds; } public final boolean component17() { return this.isNewUser; } public final Map component18() { return this.allApplicationStreamContexts; } public final Map component19() { return this.allChannelPermissions; } public final long component2() { return this.selectedVoiceChannelId; } public final boolean component20() { return this.isLeftPanelOpened; } public final boolean component21() { return this.isOnHomeTab; } public final boolean component22() { return this.showHubSparkle; } public final Map component3() { return this.guildSettings; } public final Set component4() { return this.unreadGuildIds; } public final Map component5() { return this.mentionCounts; } public final Map> component6() { return this.channelIds; } public final Set component7() { return this.unavailableGuilds; } public final Map component8() { return this.privateChannels; } public final List component9() { return this.sortedGuilds; } public final StoreState copy(long j, long j2, Map map, Set set, Map map2, Map> map3, Set set2, Map map4, List list, Map map5, List list2, Set set3, Set set4, Set set5, Map map6, Set set6, boolean z2, Map map7, Map map8, boolean z3, boolean z4, boolean z5) { m.checkNotNullParameter(map, "guildSettings"); m.checkNotNullParameter(set, "unreadGuildIds"); m.checkNotNullParameter(map2, "mentionCounts"); m.checkNotNullParameter(map3, "channelIds"); m.checkNotNullParameter(set2, "unavailableGuilds"); m.checkNotNullParameter(map4, "privateChannels"); m.checkNotNullParameter(list, "sortedGuilds"); m.checkNotNullParameter(map5, "guildJoinRequests"); m.checkNotNullParameter(list2, "pendingGuilds"); m.checkNotNullParameter(set3, "guildIds"); m.checkNotNullParameter(set4, "lurkingGuildIds"); m.checkNotNullParameter(set5, "guildIdsWithActiveStageEvents"); m.checkNotNullParameter(map6, "channels"); m.checkNotNullParameter(set6, "openFolderIds"); m.checkNotNullParameter(map7, "allApplicationStreamContexts"); m.checkNotNullParameter(map8, "allChannelPermissions"); return new StoreState(j, j2, map, set, map2, map3, set2, map4, list, map5, list2, set3, set4, set5, map6, set6, z2, map7, map8, z3, z4, z5); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof StoreState)) { return false; } StoreState storeState = (StoreState) obj; return this.selectedGuildId == storeState.selectedGuildId && this.selectedVoiceChannelId == storeState.selectedVoiceChannelId && m.areEqual(this.guildSettings, storeState.guildSettings) && m.areEqual(this.unreadGuildIds, storeState.unreadGuildIds) && m.areEqual(this.mentionCounts, storeState.mentionCounts) && m.areEqual(this.channelIds, storeState.channelIds) && m.areEqual(this.unavailableGuilds, storeState.unavailableGuilds) && m.areEqual(this.privateChannels, storeState.privateChannels) && m.areEqual(this.sortedGuilds, storeState.sortedGuilds) && m.areEqual(this.guildJoinRequests, storeState.guildJoinRequests) && m.areEqual(this.pendingGuilds, storeState.pendingGuilds) && m.areEqual(this.guildIds, storeState.guildIds) && m.areEqual(this.lurkingGuildIds, storeState.lurkingGuildIds) && m.areEqual(this.guildIdsWithActiveStageEvents, storeState.guildIdsWithActiveStageEvents) && m.areEqual(this.channels, storeState.channels) && m.areEqual(this.openFolderIds, storeState.openFolderIds) && this.isNewUser == storeState.isNewUser && m.areEqual(this.allApplicationStreamContexts, storeState.allApplicationStreamContexts) && m.areEqual(this.allChannelPermissions, storeState.allChannelPermissions) && this.isLeftPanelOpened == storeState.isLeftPanelOpened && this.isOnHomeTab == storeState.isOnHomeTab && this.showHubSparkle == storeState.showHubSparkle; } public final Map getAllApplicationStreamContexts() { return this.allApplicationStreamContexts; } public final Map getAllChannelPermissions() { return this.allChannelPermissions; } public final Map> getChannelIds() { return this.channelIds; } public final Map getChannels() { return this.channels; } public final Set getGuildIds() { return this.guildIds; } public final Set getGuildIdsWithActiveStageEvents() { return this.guildIdsWithActiveStageEvents; } public final Map getGuildJoinRequests() { return this.guildJoinRequests; } public final Map getGuildSettings() { return this.guildSettings; } public final Set getLurkingGuildIds() { return this.lurkingGuildIds; } public final Map getMentionCounts() { return this.mentionCounts; } public final Set getOpenFolderIds() { return this.openFolderIds; } public final List getPendingGuilds() { return this.pendingGuilds; } public final Map getPrivateChannels() { return this.privateChannels; } public final long getSelectedGuildId() { return this.selectedGuildId; } public final long getSelectedVoiceChannelId() { return this.selectedVoiceChannelId; } public final boolean getShowHubSparkle() { return this.showHubSparkle; } public final List getSortedGuilds() { return this.sortedGuilds; } public final Set getUnavailableGuilds() { return this.unavailableGuilds; } public final Set getUnreadGuildIds() { return this.unreadGuildIds; } public int hashCode() { int a = (b.a(this.selectedVoiceChannelId) + (b.a(this.selectedGuildId) * 31)) * 31; Map map = this.guildSettings; int i = 0; int hashCode = (a + (map != null ? map.hashCode() : 0)) * 31; Set set = this.unreadGuildIds; int hashCode2 = (hashCode + (set != null ? set.hashCode() : 0)) * 31; Map map2 = this.mentionCounts; int hashCode3 = (hashCode2 + (map2 != null ? map2.hashCode() : 0)) * 31; Map> map3 = this.channelIds; int hashCode4 = (hashCode3 + (map3 != null ? map3.hashCode() : 0)) * 31; Set set2 = this.unavailableGuilds; int hashCode5 = (hashCode4 + (set2 != null ? set2.hashCode() : 0)) * 31; Map map4 = this.privateChannels; int hashCode6 = (hashCode5 + (map4 != null ? map4.hashCode() : 0)) * 31; List list = this.sortedGuilds; int hashCode7 = (hashCode6 + (list != null ? list.hashCode() : 0)) * 31; Map map5 = this.guildJoinRequests; int hashCode8 = (hashCode7 + (map5 != null ? map5.hashCode() : 0)) * 31; List list2 = this.pendingGuilds; int hashCode9 = (hashCode8 + (list2 != null ? list2.hashCode() : 0)) * 31; Set set3 = this.guildIds; int hashCode10 = (hashCode9 + (set3 != null ? set3.hashCode() : 0)) * 31; Set set4 = this.lurkingGuildIds; int hashCode11 = (hashCode10 + (set4 != null ? set4.hashCode() : 0)) * 31; Set set5 = this.guildIdsWithActiveStageEvents; int hashCode12 = (hashCode11 + (set5 != null ? set5.hashCode() : 0)) * 31; Map map6 = this.channels; int hashCode13 = (hashCode12 + (map6 != null ? map6.hashCode() : 0)) * 31; Set set6 = this.openFolderIds; int hashCode14 = (hashCode13 + (set6 != null ? set6.hashCode() : 0)) * 31; boolean z2 = this.isNewUser; int i2 = 1; if (z2) { z2 = true; } int i3 = z2 ? 1 : 0; int i4 = z2 ? 1 : 0; int i5 = z2 ? 1 : 0; int i6 = (hashCode14 + i3) * 31; Map map7 = this.allApplicationStreamContexts; int hashCode15 = (i6 + (map7 != null ? map7.hashCode() : 0)) * 31; Map map8 = this.allChannelPermissions; if (map8 != null) { i = map8.hashCode(); } int i7 = (hashCode15 + i) * 31; boolean z3 = this.isLeftPanelOpened; if (z3) { z3 = true; } int i8 = z3 ? 1 : 0; int i9 = z3 ? 1 : 0; int i10 = z3 ? 1 : 0; int i11 = (i7 + i8) * 31; boolean z4 = this.isOnHomeTab; if (z4) { z4 = true; } int i12 = z4 ? 1 : 0; int i13 = z4 ? 1 : 0; int i14 = z4 ? 1 : 0; int i15 = (i11 + i12) * 31; boolean z5 = this.showHubSparkle; if (!z5) { i2 = z5 ? 1 : 0; } return i15 + i2; } public final boolean isLeftPanelOpened() { return this.isLeftPanelOpened; } public final boolean isNewUser() { return this.isNewUser; } public final boolean isOnHomeTab() { return this.isOnHomeTab; } public String toString() { StringBuilder L = a.L("StoreState(selectedGuildId="); L.append(this.selectedGuildId); L.append(", selectedVoiceChannelId="); L.append(this.selectedVoiceChannelId); L.append(", guildSettings="); L.append(this.guildSettings); L.append(", unreadGuildIds="); L.append(this.unreadGuildIds); L.append(", mentionCounts="); L.append(this.mentionCounts); L.append(", channelIds="); L.append(this.channelIds); L.append(", unavailableGuilds="); L.append(this.unavailableGuilds); L.append(", privateChannels="); L.append(this.privateChannels); L.append(", sortedGuilds="); L.append(this.sortedGuilds); L.append(", guildJoinRequests="); L.append(this.guildJoinRequests); L.append(", pendingGuilds="); L.append(this.pendingGuilds); L.append(", guildIds="); L.append(this.guildIds); L.append(", lurkingGuildIds="); L.append(this.lurkingGuildIds); L.append(", guildIdsWithActiveStageEvents="); L.append(this.guildIdsWithActiveStageEvents); L.append(", channels="); L.append(this.channels); L.append(", openFolderIds="); L.append(this.openFolderIds); L.append(", isNewUser="); L.append(this.isNewUser); L.append(", allApplicationStreamContexts="); L.append(this.allApplicationStreamContexts); L.append(", allChannelPermissions="); L.append(this.allChannelPermissions); L.append(", isLeftPanelOpened="); L.append(this.isLeftPanelOpened); L.append(", isOnHomeTab="); L.append(this.isOnHomeTab); L.append(", showHubSparkle="); return a.G(L, this.showHubSparkle, ")"); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static abstract class ViewState { /* compiled from: WidgetGuildsListViewModel.kt */ public static final class Loaded extends ViewState { private final boolean hasChannels; private final List items; private final boolean wasDragResult; /* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: java.util.List */ /* JADX WARN: Multi-variable type inference failed */ /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public Loaded(List list, boolean z2, boolean z3) { super(null); m.checkNotNullParameter(list, "items"); this.items = list; this.hasChannels = z2; this.wasDragResult = z3; } /* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.guilds.list.WidgetGuildsListViewModel$ViewState$Loaded */ /* JADX WARN: Multi-variable type inference failed */ public static /* synthetic */ Loaded copy$default(Loaded loaded, List list, boolean z2, boolean z3, int i, Object obj) { if ((i & 1) != 0) { list = loaded.items; } if ((i & 2) != 0) { z2 = loaded.hasChannels; } if ((i & 4) != 0) { z3 = loaded.wasDragResult; } return loaded.copy(list, z2, z3); } public final List component1() { return this.items; } public final boolean component2() { return this.hasChannels; } public final boolean component3() { return this.wasDragResult; } public final Loaded copy(List list, boolean z2, boolean z3) { m.checkNotNullParameter(list, "items"); return new Loaded(list, z2, z3); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Loaded)) { return false; } Loaded loaded = (Loaded) obj; return m.areEqual(this.items, loaded.items) && this.hasChannels == loaded.hasChannels && this.wasDragResult == loaded.wasDragResult; } public final boolean getHasChannels() { return this.hasChannels; } public final List getItems() { return this.items; } public final boolean getWasDragResult() { return this.wasDragResult; } public int hashCode() { List list = this.items; int hashCode = (list != null ? list.hashCode() : 0) * 31; boolean z2 = this.hasChannels; int i = 1; if (z2) { z2 = true; } int i2 = z2 ? 1 : 0; int i3 = z2 ? 1 : 0; int i4 = z2 ? 1 : 0; int i5 = (hashCode + i2) * 31; boolean z3 = this.wasDragResult; if (!z3) { i = z3 ? 1 : 0; } return i5 + i; } public String toString() { StringBuilder L = a.L("Loaded(items="); L.append(this.items); L.append(", hasChannels="); L.append(this.hasChannels); L.append(", wasDragResult="); return a.G(L, this.wasDragResult, ")"); } } /* compiled from: WidgetGuildsListViewModel.kt */ public static final class Uninitialized extends ViewState { public static final Uninitialized INSTANCE = new Uninitialized(); private Uninitialized() { super(null); } } private ViewState() { } public /* synthetic */ ViewState(DefaultConstructorMarker defaultConstructorMarker) { this(); } } public WidgetGuildsListViewModel() { this(null, null, 3, null); } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public WidgetGuildsListViewModel(Clock clock, Observable observable) { super(ViewState.Uninitialized.INSTANCE); m.checkNotNullParameter(clock, "clock"); m.checkNotNullParameter(observable, "storeObservable"); this.clock = clock; this.eventSubject = PublishSubject.j0(); Observable r = ObservableExtensionsKt.computationLatest(observable).r(); m.checkNotNullExpressionValue(r, "storeObservable\n … .distinctUntilChanged()"); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(r, this, null, 2, null), WidgetGuildsListViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null); } /* JADX WARNING: Illegal instructions before constructor call */ public /* synthetic */ WidgetGuildsListViewModel(Clock clock, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) { this(clock, (i & 2) != 0 ? Companion.access$observeStores(Companion, clock) : observable); clock = (i & 1) != 0 ? ClockFactory.get() : clock; } public static final /* synthetic */ void access$handleStoreState(WidgetGuildsListViewModel widgetGuildsListViewModel, StoreState storeState) { widgetGuildsListViewModel.handleStoreState(storeState); } private final Sequence createDirectMessageItems(Map map, Map map2, ModelNotificationSettings modelNotificationSettings) { return q.map(q.sortedWith(q.filter(q.filterNotNull(u.asSequence(map.values())), new WidgetGuildsListViewModel$createDirectMessageItems$1(modelNotificationSettings, map2)), AnimatableValueParser.K0(Channel.Companion)), new WidgetGuildsListViewModel$createDirectMessageItems$2(map2)); } private final GuildListItem.GuildItem createGuildItem(Guild guild, long j, long j2, Set set, Map map, int i, Map> map2, Map map3, Set set2, Set set3, Long l, Boolean bool, Map map4, Map map5, ApplicationStatus applicationStatus, boolean z2) { boolean z3; boolean z4; long id2 = guild.getId(); List list = (List) map2.get(Long.valueOf(id2)); ModelNotificationSettings modelNotificationSettings = (ModelNotificationSettings) map.get(Long.valueOf(id2)); boolean contains = (modelNotificationSettings == null || !modelNotificationSettings.isMuted()) ? set.contains(Long.valueOf(id2)) : false; boolean z5 = id2 == j; if (j2 > 0 && list != null && !list.isEmpty()) { Iterator it = list.iterator(); while (true) { if (!it.hasNext()) { break; } if (j2 == ((Number) it.next()).longValue()) { z4 = true; continue; } else { z4 = false; continue; } if (z4) { z3 = true; break; } } boolean shouldDisplayVideoIconOnGuild = shouldDisplayVideoIconOnGuild(id2, modelNotificationSettings, map4, map5); boolean contains2 = set2.contains(Long.valueOf(guild.getId())); boolean contains3 = set3.contains(Long.valueOf(guild.getId())); Channel channel = map3.get(Long.valueOf(j2)); return new GuildListItem.GuildItem(guild, i, contains2, contains, z5, l, z3, shouldDisplayVideoIconOnGuild, false, bool, applicationStatus, z2, contains3, channel == null && AnimatableValueParser.x1(channel), 256, null); } z3 = false; boolean shouldDisplayVideoIconOnGuild = shouldDisplayVideoIconOnGuild(id2, modelNotificationSettings, map4, map5); boolean contains2 = set2.contains(Long.valueOf(guild.getId())); boolean contains3 = set3.contains(Long.valueOf(guild.getId())); Channel channel = map3.get(Long.valueOf(j2)); return new GuildListItem.GuildItem(guild, i, contains2, contains, z5, l, z3, shouldDisplayVideoIconOnGuild, false, bool, applicationStatus, z2, contains3, channel == null && AnimatableValueParser.x1(channel), 256, null); } public static /* synthetic */ GuildListItem.GuildItem createGuildItem$default(WidgetGuildsListViewModel widgetGuildsListViewModel, Guild guild, long j, long j2, Set set, Map map, int i, Map map2, Map map3, Set set2, Set set3, Long l, Boolean bool, Map map4, Map map5, ApplicationStatus applicationStatus, boolean z2, int i2, Object obj) { return widgetGuildsListViewModel.createGuildItem(guild, j, j2, set, map, i, map2, map3, set2, set3, l, bool, map4, map5, applicationStatus, (i2 & 32768) != 0 ? false : z2); } private final List createPendingGuildsFolder(List list, Map map, Set set, long j, long j2, Set set2, Map map2, Map> map3, Map map4, Set set3, Set set4, Map map5, Map map6) { ArrayList arrayList = new ArrayList(); GuildListItem.FolderItem folderItem = new GuildListItem.FolderItem(-7, null, null, set.contains(-7L), list, false, false, false, 0, false, false); arrayList.add(folderItem); if (folderItem.isOpen()) { ArrayList arrayList2 = new ArrayList(d0.t.o.collectionSizeOrDefault(list, 10)); int i = 0; for (Object obj : list) { int i2 = i + 1; if (i < 0) { n.throwIndexOverflow(); } Guild guild = (Guild) obj; Long valueOf = Long.valueOf(folderItem.getFolderId()); Boolean valueOf2 = Boolean.valueOf(n.getLastIndex(list) == i); GuildJoinRequest guildJoinRequest = map.get(Long.valueOf(guild.getId())); arrayList2.add(createGuildItem(guild, j, j2, set2, map2, 0, map3, map4, set3, set4, valueOf, valueOf2, map5, map6, guildJoinRequest != null ? guildJoinRequest.a() : null, true)); i = i2; } arrayList.addAll(arrayList2); } return arrayList; } /* JADX WARNING: Code restructure failed: missing block: B:53:0x024e, code lost: if (com.airbnb.lottie.parser.AnimatableValueParser.x1(r7) == true) goto L_0x0255; */ /* JADX WARNING: Removed duplicated region for block: B:112:0x042d */ /* JADX WARNING: Removed duplicated region for block: B:113:0x0471 */ /* JADX WARNING: Removed duplicated region for block: B:116:0x0490 */ /* JADX WARNING: Removed duplicated region for block: B:119:0x04ad */ /* JADX WARNING: Removed duplicated region for block: B:128:0x04ca */ /* JADX WARNING: Removed duplicated region for block: B:154:0x029d A[SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:50:0x0235 */ /* JADX WARNING: Removed duplicated region for block: B:56:0x0254 */ /* JADX WARNING: Removed duplicated region for block: B:59:0x0258 */ /* JADX WARNING: Removed duplicated region for block: B:70:0x029b */ private final void handleStoreState(StoreState storeState) { boolean z2; ArrayList arrayList; ArrayList arrayList2; GrowthTeamFeatures growthTeamFeatures; ArrayList arrayList3; Sequence sequence; HashMap hashMap; ArrayList arrayList4; HashMap hashMap2; boolean z3; int i; boolean z4; boolean z5; boolean z6; HashMap hashMap3; boolean z7; Integer num; ModelNotificationSettings modelNotificationSettings; ArrayList arrayList5 = new ArrayList(storeState.getPendingGuilds().size() + storeState.getSortedGuilds().size() + 3); arrayList5.add(new GuildListItem.FriendsItem(storeState.getSelectedGuildId() <= 0)); r.addAll(arrayList5, createDirectMessageItems(storeState.getPrivateChannels(), storeState.getMentionCounts(), storeState.getGuildSettings().get(0L))); HashMap hashMap4 = new HashMap(); for (StoreGuildsSorted.Entry entry : storeState.getSortedGuilds()) { if (entry instanceof StoreGuildsSorted.Entry.SingletonGuild) { long id2 = ((StoreGuildsSorted.Entry.SingletonGuild) entry).getGuild().getId(); hashMap4.put(Long.valueOf(id2), Integer.valueOf(sumMentionCountsForGuild(id2, storeState.getChannelIds(), storeState.getMentionCounts()))); } else if (entry instanceof StoreGuildsSorted.Entry.Folder) { for (Guild guild : ((StoreGuildsSorted.Entry.Folder) entry).getGuilds()) { long id3 = guild.getId(); hashMap4.put(Long.valueOf(id3), Integer.valueOf(sumMentionCountsForGuild(id3, storeState.getChannelIds(), storeState.getMentionCounts()))); } } } Sequence filter = q.filter(u.asSequence(storeState.getSortedGuilds()), WidgetGuildsListViewModel$handleStoreState$$inlined$filterIsInstance$1.INSTANCE); Objects.requireNonNull(filter, "null cannot be cast to non-null type kotlin.sequences.Sequence"); Sequence map = q.map(q.filter(filter, new WidgetGuildsListViewModel$handleStoreState$lurkerGuildItems$1(storeState)), new WidgetGuildsListViewModel$handleStoreState$lurkerGuildItems$2(this, storeState, hashMap4)); ArrayList arrayList6 = new ArrayList(); for (StoreGuildsSorted.Entry entry2 : q.filter(u.asSequence(storeState.getSortedGuilds()), new WidgetGuildsListViewModel$handleStoreState$2(storeState))) { ApplicationStatus applicationStatus = null; if (entry2 instanceof StoreGuildsSorted.Entry.SingletonGuild) { StoreGuildsSorted.Entry.SingletonGuild singletonGuild = (StoreGuildsSorted.Entry.SingletonGuild) entry2; Guild guild2 = singletonGuild.getGuild(); long selectedGuildId = storeState.getSelectedGuildId(); long selectedVoiceChannelId = storeState.getSelectedVoiceChannelId(); Set unreadGuildIds = storeState.getUnreadGuildIds(); Map guildSettings = storeState.getGuildSettings(); Integer num2 = (Integer) hashMap4.get(Long.valueOf(singletonGuild.getGuild().getId())); if (num2 == null) { num2 = 0; } m.checkNotNullExpressionValue(num2, "mentionCountsByGuild[folder.guild.id] ?: 0"); int intValue = num2.intValue(); Map> channelIds = storeState.getChannelIds(); Map channels = storeState.getChannels(); Set lurkingGuildIds = storeState.getLurkingGuildIds(); Set guildIdsWithActiveStageEvents = storeState.getGuildIdsWithActiveStageEvents(); Map allApplicationStreamContexts = storeState.getAllApplicationStreamContexts(); Map allChannelPermissions = storeState.getAllChannelPermissions(); GuildJoinRequest guildJoinRequest = storeState.getGuildJoinRequests().get(Long.valueOf(singletonGuild.getGuild().getId())); if (guildJoinRequest != null) { applicationStatus = guildJoinRequest.a(); } sequence = map; hashMap2 = hashMap4; arrayList3 = arrayList5; arrayList4 = arrayList6; arrayList4.add(createGuildItem$default(this, guild2, selectedGuildId, selectedVoiceChannelId, unreadGuildIds, guildSettings, intValue, channelIds, channels, lurkingGuildIds, guildIdsWithActiveStageEvents, null, null, allApplicationStreamContexts, allChannelPermissions, applicationStatus, false, 32768, null)); } else { arrayList4 = arrayList6; sequence = map; hashMap2 = hashMap4; arrayList3 = arrayList5; if (entry2 instanceof StoreGuildsSorted.Entry.Folder) { StoreGuildsSorted.Entry.Folder folder = (StoreGuildsSorted.Entry.Folder) entry2; boolean contains = storeState.getOpenFolderIds().contains(Long.valueOf(folder.getId())); String str = "mentionCountsByGuild[guild.id] ?: 0"; if (!contains) { boolean z8 = false; int i2 = 0; boolean z9 = false; boolean z10 = false; boolean z11 = false; for (Guild guild3 : folder.getGuilds()) { z9 = z9 || guild3.getId() == storeState.getSelectedGuildId(); if (!z10) { List list = storeState.getChannelIds().get(Long.valueOf(guild3.getId())); if (!(list != null ? list.contains(Long.valueOf(storeState.getSelectedVoiceChannelId())) : false)) { z10 = false; if (z11) { Channel channel = storeState.getChannels().get(Long.valueOf(storeState.getSelectedVoiceChannelId())); if (channel != null) { z7 = true; } else { z7 = true; } z11 = false; if (!z8) { z8 = storeState.getUnreadGuildIds().contains(Long.valueOf(guild3.getId())) && ((modelNotificationSettings = storeState.getGuildSettings().get(Long.valueOf(guild3.getId()))) == null || modelNotificationSettings.isMuted() != z7); } num = (Integer) hashMap2.get(Long.valueOf(guild3.getId())); if (num == null) { num = 0; } m.checkNotNullExpressionValue(num, str); i2 += num.intValue(); hashMap2 = hashMap2; } else { z7 = true; } z11 = true; if (!z8) { } num = (Integer) hashMap2.get(Long.valueOf(guild3.getId())); if (num == null) { } m.checkNotNullExpressionValue(num, str); i2 += num.intValue(); hashMap2 = hashMap2; } } z10 = true; if (z11) { } z11 = true; if (!z8) { } num = (Integer) hashMap2.get(Long.valueOf(guild3.getId())); if (num == null) { } m.checkNotNullExpressionValue(num, str); i2 += num.intValue(); hashMap2 = hashMap2; } hashMap3 = hashMap2; z3 = z8; i = i2; z6 = z9; z5 = z10; z4 = z11; } else { hashMap3 = hashMap2; z6 = false; z5 = false; z4 = false; i = 0; z3 = false; } arrayList4.add(new GuildListItem.FolderItem(folder.getId(), folder.getColor(), folder.getName(), contains, folder.getGuilds(), z6, z5, z4, i, z3, false, 1024, null)); if (contains) { List guilds = folder.getGuilds(); ArrayList arrayList7 = new ArrayList(d0.t.o.collectionSizeOrDefault(guilds, 10)); int i3 = 0; for (Object obj : guilds) { int i4 = i3 + 1; if (i3 < 0) { n.throwIndexOverflow(); } Guild guild4 = (Guild) obj; long selectedGuildId2 = storeState.getSelectedGuildId(); long selectedVoiceChannelId2 = storeState.getSelectedVoiceChannelId(); Set unreadGuildIds2 = storeState.getUnreadGuildIds(); Map guildSettings2 = storeState.getGuildSettings(); Integer num3 = (Integer) hashMap3.get(Long.valueOf(guild4.getId())); if (num3 == null) { num3 = 0; } m.checkNotNullExpressionValue(num3, str); int intValue2 = num3.intValue(); Map> channelIds2 = storeState.getChannelIds(); Map channels2 = storeState.getChannels(); Set lurkingGuildIds2 = storeState.getLurkingGuildIds(); Set guildIdsWithActiveStageEvents2 = storeState.getGuildIdsWithActiveStageEvents(); Long valueOf = Long.valueOf(folder.getId()); Boolean valueOf2 = Boolean.valueOf(n.getLastIndex(folder.getGuilds()) == i3); Map allApplicationStreamContexts2 = storeState.getAllApplicationStreamContexts(); Map allChannelPermissions2 = storeState.getAllChannelPermissions(); GuildJoinRequest guildJoinRequest2 = storeState.getGuildJoinRequests().get(Long.valueOf(guild4.getId())); arrayList7.add(createGuildItem$default(this, guild4, selectedGuildId2, selectedVoiceChannelId2, unreadGuildIds2, guildSettings2, intValue2, channelIds2, channels2, lurkingGuildIds2, guildIdsWithActiveStageEvents2, valueOf, valueOf2, allApplicationStreamContexts2, allChannelPermissions2, guildJoinRequest2 != null ? guildJoinRequest2.a() : null, false, 32768, null)); arrayList7 = arrayList7; i3 = i4; str = str; hashMap3 = hashMap3; arrayList4 = arrayList4; } hashMap = hashMap3; arrayList4.addAll(arrayList7); arrayList6 = arrayList4; hashMap4 = hashMap; map = sequence; arrayList5 = arrayList3; } else { hashMap = hashMap3; arrayList6 = arrayList4; hashMap4 = hashMap; map = sequence; arrayList5 = arrayList3; } } } hashMap = hashMap2; arrayList6 = arrayList4; hashMap4 = hashMap; map = sequence; arrayList5 = arrayList3; } if (storeState.getOpenFolderIds().contains(-7L)) { StoreStream.Companion.getGuildJoinRequests().fetchPendingGuilds(); } Map guildJoinRequests = storeState.getGuildJoinRequests(); if (!guildJoinRequests.isEmpty()) { Iterator> it = guildJoinRequests.entrySet().iterator(); while (true) { if (it.hasNext()) { if (n.emptyList().contains(it.next().getKey())) { z2 = true; break; } } else { break; } } if (!z2) { arrayList = arrayList6; arrayList2 = arrayList5; arrayList2.addAll(createPendingGuildsFolder(storeState.getPendingGuilds(), storeState.getGuildJoinRequests(), storeState.getOpenFolderIds(), storeState.getSelectedGuildId(), storeState.getSelectedVoiceChannelId(), storeState.getUnreadGuildIds(), storeState.getGuildSettings(), storeState.getChannelIds(), storeState.getChannels(), storeState.getLurkingGuildIds(), storeState.getGuildIdsWithActiveStageEvents(), storeState.getAllApplicationStreamContexts(), storeState.getAllChannelPermissions())); } else { arrayList = arrayList6; arrayList2 = arrayList5; } r.addAll(arrayList2, map); GuildListItem.DividerItem dividerItem = GuildListItem.DividerItem.INSTANCE; arrayList2.add(dividerItem); arrayList2.addAll(arrayList); if (!storeState.getUnavailableGuilds().isEmpty()) { arrayList2.add(new GuildListItem.UnavailableItem(storeState.getUnavailableGuilds().size())); } arrayList2.add(GuildListItem.CreateItem.INSTANCE); growthTeamFeatures = GrowthTeamFeatures.INSTANCE; if (growthTeamFeatures.isHubDiscoveryEnabled()) { arrayList2.add(new GuildListItem.HubItem(storeState.getShowHubSparkle() && growthTeamFeatures.isHubDiscoverySparkleEnabled())); } if (storeState.isNewUser()) { arrayList2.add(dividerItem); arrayList2.add(GuildListItem.HelpItem.INSTANCE); } arrayList2.add(GuildListItem.SpaceItem.INSTANCE); ViewState.Loaded loaded = new ViewState.Loaded(arrayList2, !storeState.getChannelIds().isEmpty(), false); if (!(storeState.isLeftPanelOpened() == this.wasLeftPanelOpened && storeState.isOnHomeTab() == this.wasOnHomeTab)) { if (storeState.isLeftPanelOpened() && storeState.isOnHomeTab()) { this.eventSubject.j.onNext(Event.FocusFirstElement.INSTANCE); } this.wasLeftPanelOpened = storeState.isLeftPanelOpened(); this.wasOnHomeTab = storeState.isOnHomeTab(); } updateViewState(loaded); } z2 = false; if (!z2) { } r.addAll(arrayList2, map); GuildListItem.DividerItem dividerItem = GuildListItem.DividerItem.INSTANCE; arrayList2.add(dividerItem); arrayList2.addAll(arrayList); if (!storeState.getUnavailableGuilds().isEmpty()) { } arrayList2.add(GuildListItem.CreateItem.INSTANCE); growthTeamFeatures = GrowthTeamFeatures.INSTANCE; if (growthTeamFeatures.isHubDiscoveryEnabled()) { } if (storeState.isNewUser()) { } arrayList2.add(GuildListItem.SpaceItem.INSTANCE); ViewState.Loaded loaded = new ViewState.Loaded(arrayList2, !storeState.getChannelIds().isEmpty(), false); this.eventSubject.j.onNext(Event.FocusFirstElement.INSTANCE); this.wasLeftPanelOpened = storeState.isLeftPanelOpened(); this.wasOnHomeTab = storeState.isOnHomeTab(); updateViewState(loaded); } private final void move(int i, int i2, Long l) { ArrayList arrayList; int i3 = i2; ViewState viewState = getViewState(); if (!(viewState instanceof ViewState.Loaded)) { viewState = null; } ViewState.Loaded loaded = (ViewState.Loaded) viewState; if (loaded != null) { List items = loaded.getItems(); GuildListItem guildListItem = items.get(i); if (this.currentTargetOperation != null || (i > i3 || Math.abs(i - i3) >= 2) || ((guildListItem instanceof GuildListItem.GuildItem) && (m.areEqual(((GuildListItem.GuildItem) guildListItem).getFolderId(), l) ^ true))) { ArrayList arrayList2 = new ArrayList<>(items); untargetCurrentTarget(arrayList2); if (i < i3) { i3--; } if (guildListItem instanceof GuildListItem.FolderItem) { arrayList2.remove(i); arrayList2.add(i3, guildListItem); } else if (guildListItem instanceof GuildListItem.GuildItem) { arrayList2.remove(i); GuildListItem.GuildItem guildItem = (GuildListItem.GuildItem) guildListItem; arrayList = arrayList2; arrayList.add(i3, GuildListItem.GuildItem.copy$default(guildItem, null, 0, false, false, false, l, false, false, false, null, null, false, false, false, 16351, null)); rebuildFolders(arrayList, u.toSet(n.listOfNotNull((Object[]) new Long[]{guildItem.getFolderId(), l}))); updateViewState(ViewState.Loaded.copy$default(loaded, arrayList, false, true, 2, null)); } arrayList = arrayList2; updateViewState(ViewState.Loaded.copy$default(loaded, arrayList, false, true, 2, null)); } } } private final void performTargetOperation(ArrayList arrayList, int i, int i2) { GuildListItem guildListItem = arrayList.get(i); m.checkNotNullExpressionValue(guildListItem, "editingList[fromPosition]"); GuildListItem guildListItem2 = guildListItem; GuildListItem guildListItem3 = arrayList.get(i2); m.checkNotNullExpressionValue(guildListItem3, "editingList[toPosition]"); GuildListItem guildListItem4 = guildListItem3; boolean z2 = guildListItem2 instanceof GuildListItem.GuildItem; if (z2 && (guildListItem4 instanceof GuildListItem.GuildItem)) { GuildListItem.GuildItem guildItem = (GuildListItem.GuildItem) guildListItem4; GuildListItem.GuildItem guildItem2 = (GuildListItem.GuildItem) guildListItem2; arrayList.set(i2, new GuildListItem.FolderItem(c.b.nextLong(), null, null, false, n.listOf((Object[]) new Guild[]{guildItem.getGuild(), guildItem2.getGuild()}), guildItem.isSelected() || guildItem2.isSelected(), guildItem.isConnectedToVoice() || guildItem2.isConnectedToVoice(), guildItem.isConnectedToStageChannel() || guildItem2.isConnectedToStageChannel(), guildItem2.getMentionCount() + guildItem.getMentionCount(), guildItem.isUnread() || guildItem2.isUnread(), false)); m.checkNotNullExpressionValue(arrayList.remove(i), "editingList.removeAt(fromPosition)"); } else if (z2 && (guildListItem4 instanceof GuildListItem.FolderItem)) { GuildListItem.FolderItem folderItem = (GuildListItem.FolderItem) guildListItem4; GuildListItem.GuildItem guildItem3 = (GuildListItem.GuildItem) guildListItem2; arrayList.set(i2, GuildListItem.FolderItem.copy$default(folderItem, 0, null, null, false, u.plus((Collection) u.toMutableList((Collection) folderItem.getGuilds()), guildItem3.getGuild()), folderItem.isAnyGuildSelected() || guildItem3.isSelected(), folderItem.isAnyGuildConnectedToVoice() || guildItem3.isConnectedToVoice(), false, 0, folderItem.isUnread() || guildItem3.isUnread(), false, 399, null)); arrayList.remove(i); } } private final void rebuildFolders(ArrayList arrayList, Set set) { if (!set.isEmpty()) { HashMap hashMap = new HashMap(); ArrayList arrayList2 = new ArrayList(); for (Object obj : arrayList) { if (obj instanceof GuildListItem.GuildItem) { arrayList2.add(obj); } } for (GuildListItem.GuildItem guildItem : arrayList2) { Long folderId = guildItem.getFolderId(); if (folderId != null) { long longValue = folderId.longValue(); ArrayList arrayList3 = (ArrayList) hashMap.get(Long.valueOf(longValue)); if (arrayList3 == null) { arrayList3 = new ArrayList(); } arrayList3.add(guildItem.getGuild()); hashMap.put(Long.valueOf(longValue), arrayList3); } } for (Number number : set) { long longValue2 = number.longValue(); Iterator it = arrayList.iterator(); int i = 0; while (true) { if (!it.hasNext()) { i = -1; break; } GuildListItem next = it.next(); if ((next instanceof GuildListItem.FolderItem) && ((GuildListItem.FolderItem) next).getFolderId() == longValue2) { break; } i++; } GuildListItem guildListItem = arrayList.get(i); Objects.requireNonNull(guildListItem, "null cannot be cast to non-null type com.discord.widgets.guilds.list.GuildListItem.FolderItem"); GuildListItem.FolderItem folderItem = (GuildListItem.FolderItem) guildListItem; ArrayList arrayList4 = (ArrayList) hashMap.get(Long.valueOf(longValue2)); if (arrayList4 == null) { arrayList4 = new ArrayList(); } arrayList.set(i, GuildListItem.FolderItem.copy$default(folderItem, 0, null, null, false, arrayList4, false, false, false, 0, false, false, 2031, null)); } } } private final boolean shouldDisplayVideoIconOnGuild(long j, ModelNotificationSettings modelNotificationSettings, Map map, Map map2) { boolean z2; if (map == null || map.isEmpty()) { return false; } if (modelNotificationSettings != null && modelNotificationSettings.isMuted()) { return false; } Collection values = map.values(); if (!(values instanceof Collection) || !values.isEmpty()) { for (StreamContext streamContext : values) { Guild guild = streamContext.getGuild(); if (guild == null || guild.getId() != j || !PermissionUtils.can(Permission.VIEW_CHANNEL, map2.get(Long.valueOf(streamContext.getStream().getChannelId())))) { z2 = false; continue; } else { z2 = true; continue; } if (z2) { return true; } } } return false; } private final int sumMentionCountsForGuild(long j, Map> map, Map map2) { Collection collection = (Collection) map.get(Long.valueOf(j)); if (collection == null) { return 0; } ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(collection, 10)); for (Number number : collection) { Integer num = map2.get(Long.valueOf(number.longValue())); arrayList.add(Integer.valueOf(num != null ? num.intValue() : 0)); } return u.sumOfInt(arrayList); } private final void untargetCurrentTarget(ArrayList arrayList) { GuildListItem guildListItem; WidgetGuildListAdapter.Operation.TargetOperation targetOperation = this.currentTargetOperation; if (targetOperation != null) { int component2 = targetOperation.component2(); GuildListItem guildListItem2 = arrayList.get(component2); m.checkNotNullExpressionValue(guildListItem2, "editingList[toPosition]"); GuildListItem guildListItem3 = guildListItem2; if (guildListItem3 instanceof GuildListItem.GuildItem) { guildListItem = GuildListItem.GuildItem.copy$default((GuildListItem.GuildItem) guildListItem3, null, 0, false, false, false, null, false, false, false, null, null, false, false, false, 16127, null); } else if (guildListItem3 instanceof GuildListItem.FolderItem) { guildListItem = GuildListItem.FolderItem.copy$default((GuildListItem.FolderItem) guildListItem3, 0, null, null, false, null, false, false, false, 0, false, false, AudioAttributesCompat.FLAG_ALL, null); } arrayList.set(component2, guildListItem); } this.currentTargetOperation = null; } public final Observable listenForEvents() { PublishSubject publishSubject = this.eventSubject; m.checkNotNullExpressionValue(publishSubject, "eventSubject"); return publishSubject; } public final void moveAbove(int i, int i2) { ViewState viewState = getViewState(); Long l = null; if (!(viewState instanceof ViewState.Loaded)) { viewState = null; } ViewState.Loaded loaded = (ViewState.Loaded) viewState; if (loaded != null) { GuildListItem guildListItem = loaded.getItems().get(i2); if (guildListItem instanceof GuildListItem.GuildItem) { l = ((GuildListItem.GuildItem) guildListItem).getFolderId(); } else if (!(guildListItem instanceof GuildListItem.FolderItem) && !(guildListItem instanceof GuildListItem.HelpItem) && !(guildListItem instanceof GuildListItem.CreateItem)) { throw new IllegalStateException("invalid target"); } move(i, i2, l); } } public final void moveBelow(int i, int i2) { ViewState viewState = getViewState(); Long l = null; if (!(viewState instanceof ViewState.Loaded)) { viewState = null; } ViewState.Loaded loaded = (ViewState.Loaded) viewState; if (loaded != null) { GuildListItem guildListItem = loaded.getItems().get(i2); if (guildListItem instanceof GuildListItem.GuildItem) { l = ((GuildListItem.GuildItem) guildListItem).getFolderId(); } else if (guildListItem instanceof GuildListItem.FolderItem) { GuildListItem.FolderItem folderItem = (GuildListItem.FolderItem) guildListItem; if (folderItem.isOpen()) { l = Long.valueOf(folderItem.getFolderId()); } } else { throw new IllegalStateException("invalid target"); } move(i, i2 + 1, l); } } public final boolean onDrop() { ViewState viewState = getViewState(); if (!(viewState instanceof ViewState.Loaded)) { viewState = null; } ViewState.Loaded loaded = (ViewState.Loaded) viewState; if (loaded == null) { return false; } List items = loaded.getItems(); ArrayList arrayList = new ArrayList(); WidgetGuildListAdapter.Operation.TargetOperation targetOperation = this.currentTargetOperation; if (targetOperation != null) { ArrayList arrayList2 = new ArrayList<>(items); untargetCurrentTarget(arrayList2); performTargetOperation(arrayList2, targetOperation.getFromPosition(), targetOperation.getTargetPosition()); items = arrayList2; } for (GuildListItem guildListItem : items) { if (guildListItem instanceof GuildListItem.FolderItem) { GuildListItem.FolderItem folderItem = (GuildListItem.FolderItem) guildListItem; arrayList.add(new StoreGuildsSorted.Entry.Folder(folderItem.getFolderId(), folderItem.getGuilds(), folderItem.getColor(), folderItem.getName())); } else if (guildListItem instanceof GuildListItem.GuildItem) { GuildListItem.GuildItem guildItem = (GuildListItem.GuildItem) guildListItem; if (guildItem.getFolderId() == null) { arrayList.add(new StoreGuildsSorted.Entry.SingletonGuild(guildItem.getGuild())); } } } StoreStream.Companion.getGuildsSorted().setPositions(arrayList); ArrayList arrayList3 = new ArrayList(d0.t.o.collectionSizeOrDefault(arrayList, 10)); for (StoreGuildsSorted.Entry entry : arrayList) { arrayList3.add(entry.asModelGuildFolder()); } ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(RestAPI.Companion.getApi().updateUserSettings(RestAPIParams.UserSettings.Companion.createWithGuildFolders(arrayList3)), false, 1, null), WidgetGuildsListViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, WidgetGuildsListViewModel$onDrop$2.INSTANCE, 62, (Object) null); return targetOperation != null; } public final void onItemClicked(GuildListItem guildListItem, Context context, FragmentManager fragmentManager) { m.checkNotNullParameter(guildListItem, "item"); m.checkNotNullParameter(context, "context"); m.checkNotNullParameter(fragmentManager, "fragmentManager"); boolean z2 = !GrowthTeamFeatures.INSTANCE.isHubEnabled(); if (guildListItem instanceof GuildListItem.GuildItem) { GuildListItem.GuildItem guildItem = (GuildListItem.GuildItem) guildListItem; if (guildItem.isPendingGuild()) { MemberVerificationUtils.maybeShowVerificationGate$default(MemberVerificationUtils.INSTANCE, context, fragmentManager, guildItem.getGuild().getId(), "Guilds List", null, WidgetGuildsListViewModel$onItemClicked$1.INSTANCE, 16, null); } else if (guildItem.isSelected()) { StoreNavigation.setNavigationPanelAction$default(StoreStream.Companion.getNavigation(), StoreNavigation.PanelAction.CLOSE, null, 2, null); } else if (!guildItem.getGuild().isHub() || !z2) { StoreStream.Companion.getGuildSelected().set(guildItem.getGuild().getId()); } else { c.a.d.m.g(context, R.string.discord_u_coming_soon_to_mobile, 0, null, 12); } } else if (guildListItem instanceof GuildListItem.PrivateChannelItem) { ChannelSelector.selectChannel$default(ChannelSelector.Companion.getInstance(), 0, ((GuildListItem.PrivateChannelItem) guildListItem).getChannel().h(), null, null, 12, null); } else if (guildListItem instanceof GuildListItem.UnavailableItem) { this.eventSubject.j.onNext(new Event.ShowUnavailableGuilds(((GuildListItem.UnavailableItem) guildListItem).getUnavailableGuildCount())); } else if (guildListItem instanceof GuildListItem.FriendsItem) { if (((GuildListItem.FriendsItem) guildListItem).isSelected()) { StoreNavigation.setNavigationPanelAction$default(StoreStream.Companion.getNavigation(), StoreNavigation.PanelAction.CLOSE, null, 2, null); } else { StoreStream.Companion.getGuildSelected().set(0); } } else if (m.areEqual(guildListItem, GuildListItem.CreateItem.INSTANCE)) { this.eventSubject.j.onNext(Event.ShowCreateGuild.INSTANCE); } else if (guildListItem instanceof GuildListItem.HubItem) { StoreStream.Companion.getDirectories().markDiscordHubClicked(); this.eventSubject.j.onNext(Event.ShowHubVerification.INSTANCE); } else if (m.areEqual(guildListItem, GuildListItem.HelpItem.INSTANCE)) { this.eventSubject.j.onNext(Event.ShowHelp.INSTANCE); } else if (guildListItem instanceof GuildListItem.FolderItem) { GuildListItem.FolderItem folderItem = (GuildListItem.FolderItem) guildListItem; if (folderItem.isOpen()) { StoreStream.Companion.getExpandedGuildFolders().closeFolder(guildListItem.getItemId()); } else { StoreStream.Companion.getExpandedGuildFolders().openFolder(guildListItem.getItemId()); } this.eventSubject.j.onNext(new Event.AnnounceFolderToggleForAccessibility(folderItem)); } } public final void onItemLongPressed(GuildListItem guildListItem) { m.checkNotNullParameter(guildListItem, "item"); if (guildListItem instanceof GuildListItem.PrivateChannelItem) { PublishSubject publishSubject = this.eventSubject; publishSubject.j.onNext(new Event.ShowChannelActions(((GuildListItem.PrivateChannelItem) guildListItem).getChannel().h())); } } public final void target(int i, int i2) { GuildListItem guildListItem; ViewState viewState = getViewState(); if (!(viewState instanceof ViewState.Loaded)) { viewState = null; } ViewState.Loaded loaded = (ViewState.Loaded) viewState; if (loaded != null) { ArrayList arrayList = new ArrayList<>(loaded.getItems()); untargetCurrentTarget(arrayList); GuildListItem guildListItem2 = arrayList.get(i2); if (guildListItem2 instanceof GuildListItem.GuildItem) { guildListItem = GuildListItem.GuildItem.copy$default((GuildListItem.GuildItem) guildListItem2, null, 0, false, false, false, null, false, false, true, null, null, false, false, false, 16127, null); } else if (guildListItem2 instanceof GuildListItem.FolderItem) { guildListItem = GuildListItem.FolderItem.copy$default((GuildListItem.FolderItem) guildListItem2, 0, null, null, false, null, false, false, false, 0, false, true, AudioAttributesCompat.FLAG_ALL, null); } else { throw new IllegalStateException("invalid target item: " + guildListItem2); } arrayList.set(i2, guildListItem); this.currentTargetOperation = new WidgetGuildListAdapter.Operation.TargetOperation(i, i2); updateViewState(ViewState.Loaded.copy$default(loaded, arrayList, false, true, 2, null)); return; } throw new IllegalStateException("targeting with no items"); } }