package com.discord.widgets.channels.memberlist; import android.content.Context; import androidx.annotation.MainThread; import c.d.b.a.a; import com.airbnb.lottie.parser.AnimatableValueParser; import com.discord.api.channel.Channel; import com.discord.api.role.GuildRole; import com.discord.app.AppViewModel; import com.discord.models.domain.ModelApplicationStream; import com.discord.models.domain.ModelUserRelationship; import com.discord.models.member.GuildMember; import com.discord.models.presence.Presence; import com.discord.models.user.User; import com.discord.stores.StoreApplicationStreaming; import com.discord.stores.StoreChannelMembers; import com.discord.stores.StoreChannels; import com.discord.stores.StoreChannelsSelected; import com.discord.stores.StoreEmojiCustom; import com.discord.stores.StoreGuilds; import com.discord.stores.StoreNavigation; import com.discord.stores.StorePermissions; import com.discord.stores.StoreStream; import com.discord.stores.StoreThreadMembers; import com.discord.stores.StoreUser; import com.discord.stores.StoreUserPresence; import com.discord.stores.StoreUserRelationships; import com.discord.utilities.lazy.memberlist.ChannelMemberList; import com.discord.utilities.permissions.PermissionUtils; import com.discord.utilities.rx.ObservableExtensionsKt; import com.discord.widgets.channels.memberlist.adapter.ChannelMembersListAdapter; import d0.z.d.m; import d0.z.d.o; import java.util.Map; import java.util.Set; import kotlin.NoWhenBranchMatchedException; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.ranges.IntRange; import rx.Observable; import rx.subjects.PublishSubject; /* compiled from: WidgetChannelMembersListViewModel.kt */ public final class WidgetChannelMembersListViewModel extends AppViewModel { public static final Companion Companion = new Companion(null); private final PublishSubject eventSubject; private final GuildChannelSubscriber guildChannelSubscriber; private final StoreEmojiCustom storeCustomEmojis; private final StoreGuilds storeGuilds; /* compiled from: WidgetChannelMembersListViewModel.kt */ /* renamed from: com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel$1 reason: invalid class name */ public static final class AnonymousClass1 implements GuildChannelSubscriber { @Override // com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel.GuildChannelSubscriber public void subscribeToChannelRange(Channel channel, IntRange intRange) { m.checkNotNullParameter(channel, "channel"); m.checkNotNullParameter(intRange, "range"); StoreStream.Companion.getGuildSubscriptions().subscribeChannelRange(channel.f(), channel.h(), intRange); } @Override // com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel.GuildChannelSubscriber public void subscribeToThread(Channel channel) { m.checkNotNullParameter(channel, "channel"); StoreStream.Companion.getGuildSubscriptions().subscribeThread(channel.f(), channel.h()); } } /* compiled from: WidgetChannelMembersListViewModel.kt */ /* renamed from: com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel$2 reason: invalid class name */ public static final class AnonymousClass2 extends o implements Function1 { public final /* synthetic */ WidgetChannelMembersListViewModel this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnonymousClass2(WidgetChannelMembersListViewModel widgetChannelMembersListViewModel) { super(1); this.this$0 = widgetChannelMembersListViewModel; } /* 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) { m.checkNotNullParameter(storeState, "storeState"); WidgetChannelMembersListViewModel.access$handleStoreState(this.this$0, storeState); } } /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private final Observable observeStoreState(StoreGuilds storeGuilds, StoreChannelMembers storeChannelMembers, StoreThreadMembers storeThreadMembers, StoreChannelsSelected storeChannelsSelected, StoreNavigation storeNavigation, PrivateChannelMemberListService privateChannelMemberListService, StorePermissions storePermissions, StoreUserRelationships storeUserRelationships, StoreChannels storeChannels, StoreUser storeUser, StoreUserPresence storeUserPresence, StoreApplicationStreaming storeApplicationStreaming) { Observable Y = storeChannelsSelected.observeSelectedChannel().Y(new WidgetChannelMembersListViewModel$Companion$observeStoreState$1(storeNavigation.observeRightPanelState().F(WidgetChannelMembersListViewModel$Companion$observeStoreState$isPanelOpenObservable$1.INSTANCE), privateChannelMemberListService, storeUserRelationships, storeChannels, storePermissions, storeChannelMembers, storeGuilds, storeThreadMembers, storeUser, storeUserPresence, storeApplicationStreaming)); m.checkNotNullExpressionValue(Y, "storeChannelsSelected\n … }\n }"); return Y; } public static /* synthetic */ Observable observeStoreState$default(Companion companion, StoreGuilds storeGuilds, StoreChannelMembers storeChannelMembers, StoreThreadMembers storeThreadMembers, StoreChannelsSelected storeChannelsSelected, StoreNavigation storeNavigation, PrivateChannelMemberListService privateChannelMemberListService, StorePermissions storePermissions, StoreUserRelationships storeUserRelationships, StoreChannels storeChannels, StoreUser storeUser, StoreUserPresence storeUserPresence, StoreApplicationStreaming storeApplicationStreaming, int i, Object obj) { return companion.observeStoreState((i & 1) != 0 ? StoreStream.Companion.getGuilds() : storeGuilds, (i & 2) != 0 ? StoreStream.Companion.getChannelMembers() : storeChannelMembers, (i & 4) != 0 ? StoreStream.Companion.getThreadMembers() : storeThreadMembers, (i & 8) != 0 ? StoreStream.Companion.getChannelsSelected() : storeChannelsSelected, (i & 16) != 0 ? StoreStream.Companion.getNavigation() : storeNavigation, (i & 32) != 0 ? new PrivateChannelMemberListService(null, null, null, 7, null) : privateChannelMemberListService, (i & 64) != 0 ? StoreStream.Companion.getPermissions() : storePermissions, (i & 128) != 0 ? StoreStream.Companion.getUserRelationships() : storeUserRelationships, (i & 256) != 0 ? StoreStream.Companion.getChannels() : storeChannels, (i & 512) != 0 ? StoreStream.Companion.getUsers() : storeUser, (i & 1024) != 0 ? StoreStream.Companion.getPresences() : storeUserPresence, (i & 2048) != 0 ? StoreStream.Companion.getApplicationStreaming() : storeApplicationStreaming); } } /* compiled from: WidgetChannelMembersListViewModel.kt */ public static abstract class Event { /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class ScrollToTop extends Event { public static final ScrollToTop INSTANCE = new ScrollToTop(); private ScrollToTop() { super(null); } } /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class UpdateRanges extends Event { public static final UpdateRanges INSTANCE = new UpdateRanges(); private UpdateRanges() { super(null); } } private Event() { } public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) { this(); } } /* compiled from: WidgetChannelMembersListViewModel.kt */ public interface GuildChannelSubscriber { void subscribeToChannelRange(Channel channel, IntRange intRange); void subscribeToThread(Channel channel); } /* compiled from: WidgetChannelMembersListViewModel.kt */ public interface MemberList { public static final Companion Companion = Companion.$$INSTANCE; /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class Companion { public static final /* synthetic */ Companion $$INSTANCE = new Companion(); private static final MemberList EMPTY = new WidgetChannelMembersListViewModel$MemberList$Companion$EMPTY$1(); private Companion() { } public final MemberList getEMPTY() { return EMPTY; } } ChannelMembersListAdapter.Item get(int i); Integer getHeaderPositionForItem(int i); String getListId(); int getSize(); } /* compiled from: WidgetChannelMembersListViewModel.kt */ public static abstract class StoreState { private final Channel channel; private final boolean isPanelOpen; /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class Guild extends StoreState { private final Channel channel; private final ChannelMemberList channelMembers; private final Long channelPermissions; private final com.discord.models.guild.Guild guild; private final Map guildRoles; private final boolean isPanelOpen; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public Guild(boolean z2, Channel channel, com.discord.models.guild.Guild guild, ChannelMemberList channelMemberList, Long l, Map map) { super(z2, channel, null); m.checkNotNullParameter(channel, "channel"); m.checkNotNullParameter(channelMemberList, "channelMembers"); m.checkNotNullParameter(map, "guildRoles"); this.isPanelOpen = z2; this.channel = channel; this.guild = guild; this.channelMembers = channelMemberList; this.channelPermissions = l; this.guildRoles = map; } /* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel$StoreState$Guild */ /* JADX WARN: Multi-variable type inference failed */ public static /* synthetic */ Guild copy$default(Guild guild, boolean z2, Channel channel, com.discord.models.guild.Guild guild2, ChannelMemberList channelMemberList, Long l, Map map, int i, Object obj) { if ((i & 1) != 0) { z2 = guild.isPanelOpen(); } if ((i & 2) != 0) { channel = guild.getChannel(); } if ((i & 4) != 0) { guild2 = guild.guild; } if ((i & 8) != 0) { channelMemberList = guild.channelMembers; } if ((i & 16) != 0) { l = guild.channelPermissions; } if ((i & 32) != 0) { map = guild.guildRoles; } return guild.copy(z2, channel, guild2, channelMemberList, l, map); } public final boolean component1() { return isPanelOpen(); } public final Channel component2() { return getChannel(); } public final com.discord.models.guild.Guild component3() { return this.guild; } public final ChannelMemberList component4() { return this.channelMembers; } public final Long component5() { return this.channelPermissions; } public final Map component6() { return this.guildRoles; } public final Guild copy(boolean z2, Channel channel, com.discord.models.guild.Guild guild, ChannelMemberList channelMemberList, Long l, Map map) { m.checkNotNullParameter(channel, "channel"); m.checkNotNullParameter(channelMemberList, "channelMembers"); m.checkNotNullParameter(map, "guildRoles"); return new Guild(z2, channel, guild, channelMemberList, l, map); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Guild)) { return false; } Guild guild = (Guild) obj; return isPanelOpen() == guild.isPanelOpen() && m.areEqual(getChannel(), guild.getChannel()) && m.areEqual(this.guild, guild.guild) && m.areEqual(this.channelMembers, guild.channelMembers) && m.areEqual(this.channelPermissions, guild.channelPermissions) && m.areEqual(this.guildRoles, guild.guildRoles); } @Override // com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel.StoreState public Channel getChannel() { return this.channel; } public final ChannelMemberList getChannelMembers() { return this.channelMembers; } public final Long getChannelPermissions() { return this.channelPermissions; } public final com.discord.models.guild.Guild getGuild() { return this.guild; } public final Map getGuildRoles() { return this.guildRoles; } public int hashCode() { boolean isPanelOpen = isPanelOpen(); if (isPanelOpen) { isPanelOpen = true; } int i = isPanelOpen ? 1 : 0; int i2 = isPanelOpen ? 1 : 0; int i3 = isPanelOpen ? 1 : 0; int i4 = i * 31; Channel channel = getChannel(); int i5 = 0; int hashCode = (i4 + (channel != null ? channel.hashCode() : 0)) * 31; com.discord.models.guild.Guild guild = this.guild; int hashCode2 = (hashCode + (guild != null ? guild.hashCode() : 0)) * 31; ChannelMemberList channelMemberList = this.channelMembers; int hashCode3 = (hashCode2 + (channelMemberList != null ? channelMemberList.hashCode() : 0)) * 31; Long l = this.channelPermissions; int hashCode4 = (hashCode3 + (l != null ? l.hashCode() : 0)) * 31; Map map = this.guildRoles; if (map != null) { i5 = map.hashCode(); } return hashCode4 + i5; } @Override // com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel.StoreState public boolean isPanelOpen() { return this.isPanelOpen; } public String toString() { StringBuilder K = a.K("Guild(isPanelOpen="); K.append(isPanelOpen()); K.append(", channel="); K.append(getChannel()); K.append(", guild="); K.append(this.guild); K.append(", channelMembers="); K.append(this.channelMembers); K.append(", channelPermissions="); K.append(this.channelPermissions); K.append(", guildRoles="); return a.E(K, this.guildRoles, ")"); } } /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class None extends StoreState { private final boolean isPanelOpen; public None(boolean z2) { super(z2, null, null); this.isPanelOpen = z2; } public static /* synthetic */ None copy$default(None none, boolean z2, int i, Object obj) { if ((i & 1) != 0) { z2 = none.isPanelOpen(); } return none.copy(z2); } public final boolean component1() { return isPanelOpen(); } public final None copy(boolean z2) { return new None(z2); } public boolean equals(Object obj) { if (this != obj) { return (obj instanceof None) && isPanelOpen() == ((None) obj).isPanelOpen(); } return true; } public int hashCode() { boolean isPanelOpen = isPanelOpen(); if (isPanelOpen) { return 1; } return isPanelOpen ? 1 : 0; } @Override // com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel.StoreState public boolean isPanelOpen() { return this.isPanelOpen; } public String toString() { StringBuilder K = a.K("None(isPanelOpen="); K.append(isPanelOpen()); K.append(")"); return K.toString(); } } /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class Private extends StoreState { private final Map applicationStreams; private final Channel channel; private final boolean isPanelOpen; private final Map presences; private final Map relationships; private final Map users; /* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.Map */ /* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: java.util.Map */ /* JADX WARN: Multi-variable type inference failed */ /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public Private(boolean z2, Channel channel, Map map, Map map2, Map map3, Map map4) { super(z2, channel, null); m.checkNotNullParameter(channel, "channel"); m.checkNotNullParameter(map, "users"); m.checkNotNullParameter(map2, "presences"); m.checkNotNullParameter(map3, "applicationStreams"); m.checkNotNullParameter(map4, "relationships"); this.isPanelOpen = z2; this.channel = channel; this.users = map; this.presences = map2; this.applicationStreams = map3; this.relationships = map4; } /* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel$StoreState$Private */ /* JADX WARN: Multi-variable type inference failed */ public static /* synthetic */ Private copy$default(Private r4, boolean z2, Channel channel, Map map, Map map2, Map map3, Map map4, int i, Object obj) { if ((i & 1) != 0) { z2 = r4.isPanelOpen(); } if ((i & 2) != 0) { channel = r4.getChannel(); } if ((i & 4) != 0) { map = r4.users; } if ((i & 8) != 0) { map2 = r4.presences; } if ((i & 16) != 0) { map3 = r4.applicationStreams; } if ((i & 32) != 0) { map4 = r4.relationships; } return r4.copy(z2, channel, map, map2, map3, map4); } public final boolean component1() { return isPanelOpen(); } public final Channel component2() { return getChannel(); } public final Map component3() { return this.users; } public final Map component4() { return this.presences; } public final Map component5() { return this.applicationStreams; } public final Map component6() { return this.relationships; } public final Private copy(boolean z2, Channel channel, Map map, Map map2, Map map3, Map map4) { m.checkNotNullParameter(channel, "channel"); m.checkNotNullParameter(map, "users"); m.checkNotNullParameter(map2, "presences"); m.checkNotNullParameter(map3, "applicationStreams"); m.checkNotNullParameter(map4, "relationships"); return new Private(z2, channel, map, map2, map3, map4); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Private)) { return false; } Private r3 = (Private) obj; return isPanelOpen() == r3.isPanelOpen() && m.areEqual(getChannel(), r3.getChannel()) && m.areEqual(this.users, r3.users) && m.areEqual(this.presences, r3.presences) && m.areEqual(this.applicationStreams, r3.applicationStreams) && m.areEqual(this.relationships, r3.relationships); } public final Map getApplicationStreams() { return this.applicationStreams; } @Override // com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel.StoreState public Channel getChannel() { return this.channel; } public final Map getPresences() { return this.presences; } public final Map getRelationships() { return this.relationships; } public final Map getUsers() { return this.users; } public int hashCode() { boolean isPanelOpen = isPanelOpen(); if (isPanelOpen) { isPanelOpen = true; } int i = isPanelOpen ? 1 : 0; int i2 = isPanelOpen ? 1 : 0; int i3 = isPanelOpen ? 1 : 0; int i4 = i * 31; Channel channel = getChannel(); int i5 = 0; int hashCode = (i4 + (channel != null ? channel.hashCode() : 0)) * 31; Map map = this.users; int hashCode2 = (hashCode + (map != null ? map.hashCode() : 0)) * 31; Map map2 = this.presences; int hashCode3 = (hashCode2 + (map2 != null ? map2.hashCode() : 0)) * 31; Map map3 = this.applicationStreams; int hashCode4 = (hashCode3 + (map3 != null ? map3.hashCode() : 0)) * 31; Map map4 = this.relationships; if (map4 != null) { i5 = map4.hashCode(); } return hashCode4 + i5; } @Override // com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel.StoreState public boolean isPanelOpen() { return this.isPanelOpen; } public String toString() { StringBuilder K = a.K("Private(isPanelOpen="); K.append(isPanelOpen()); K.append(", channel="); K.append(getChannel()); K.append(", users="); K.append(this.users); K.append(", presences="); K.append(this.presences); K.append(", applicationStreams="); K.append(this.applicationStreams); K.append(", relationships="); return a.E(K, this.relationships, ")"); } } /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class Thread extends StoreState { private final Channel channel; private final com.discord.models.guild.Guild guild; private final Map guildMembers; private final boolean isPanelOpen; private final Map presences; private final Map roles; private final Map streams; private final Set threadMembers; private final Map users; /* JADX DEBUG: Multi-variable search result rejected for r7v0, resolved type: java.util.Map */ /* JADX DEBUG: Multi-variable search result rejected for r9v0, resolved type: java.util.Map */ /* JADX WARN: Multi-variable type inference failed */ /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public Thread(boolean z2, Channel channel, com.discord.models.guild.Guild guild, Map map, Map map2, Map map3, Map map4, Map map5, Set set) { super(z2, channel, null); m.checkNotNullParameter(channel, "channel"); m.checkNotNullParameter(map, "roles"); m.checkNotNullParameter(map2, "guildMembers"); m.checkNotNullParameter(map3, "users"); m.checkNotNullParameter(map4, "presences"); m.checkNotNullParameter(map5, "streams"); m.checkNotNullParameter(set, "threadMembers"); this.isPanelOpen = z2; this.channel = channel; this.guild = guild; this.roles = map; this.guildMembers = map2; this.users = map3; this.presences = map4; this.streams = map5; this.threadMembers = set; } public static /* synthetic */ Thread copy$default(Thread thread, boolean z2, Channel channel, com.discord.models.guild.Guild guild, Map map, Map map2, Map map3, Map map4, Map map5, Set set, int i, Object obj) { return thread.copy((i & 1) != 0 ? thread.isPanelOpen() : z2, (i & 2) != 0 ? thread.getChannel() : channel, (i & 4) != 0 ? thread.guild : guild, (i & 8) != 0 ? thread.roles : map, (i & 16) != 0 ? thread.guildMembers : map2, (i & 32) != 0 ? thread.users : map3, (i & 64) != 0 ? thread.presences : map4, (i & 128) != 0 ? thread.streams : map5, (i & 256) != 0 ? thread.threadMembers : set); } public final boolean component1() { return isPanelOpen(); } public final Channel component2() { return getChannel(); } public final com.discord.models.guild.Guild component3() { return this.guild; } public final Map component4() { return this.roles; } public final Map component5() { return this.guildMembers; } public final Map component6() { return this.users; } public final Map component7() { return this.presences; } public final Map component8() { return this.streams; } public final Set component9() { return this.threadMembers; } public final Thread copy(boolean z2, Channel channel, com.discord.models.guild.Guild guild, Map map, Map map2, Map map3, Map map4, Map map5, Set set) { m.checkNotNullParameter(channel, "channel"); m.checkNotNullParameter(map, "roles"); m.checkNotNullParameter(map2, "guildMembers"); m.checkNotNullParameter(map3, "users"); m.checkNotNullParameter(map4, "presences"); m.checkNotNullParameter(map5, "streams"); m.checkNotNullParameter(set, "threadMembers"); return new Thread(z2, channel, guild, map, map2, map3, map4, map5, set); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Thread)) { return false; } Thread thread = (Thread) obj; return isPanelOpen() == thread.isPanelOpen() && m.areEqual(getChannel(), thread.getChannel()) && m.areEqual(this.guild, thread.guild) && m.areEqual(this.roles, thread.roles) && m.areEqual(this.guildMembers, thread.guildMembers) && m.areEqual(this.users, thread.users) && m.areEqual(this.presences, thread.presences) && m.areEqual(this.streams, thread.streams) && m.areEqual(this.threadMembers, thread.threadMembers); } @Override // com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel.StoreState public Channel getChannel() { return this.channel; } public final com.discord.models.guild.Guild getGuild() { return this.guild; } public final Map getGuildMembers() { return this.guildMembers; } public final Map getPresences() { return this.presences; } public final Map getRoles() { return this.roles; } public final Map getStreams() { return this.streams; } public final Set getThreadMembers() { return this.threadMembers; } public final Map getUsers() { return this.users; } public int hashCode() { boolean isPanelOpen = isPanelOpen(); if (isPanelOpen) { isPanelOpen = true; } int i = isPanelOpen ? 1 : 0; int i2 = isPanelOpen ? 1 : 0; int i3 = isPanelOpen ? 1 : 0; int i4 = i * 31; Channel channel = getChannel(); int i5 = 0; int hashCode = (i4 + (channel != null ? channel.hashCode() : 0)) * 31; com.discord.models.guild.Guild guild = this.guild; int hashCode2 = (hashCode + (guild != null ? guild.hashCode() : 0)) * 31; Map map = this.roles; int hashCode3 = (hashCode2 + (map != null ? map.hashCode() : 0)) * 31; Map map2 = this.guildMembers; int hashCode4 = (hashCode3 + (map2 != null ? map2.hashCode() : 0)) * 31; Map map3 = this.users; int hashCode5 = (hashCode4 + (map3 != null ? map3.hashCode() : 0)) * 31; Map map4 = this.presences; int hashCode6 = (hashCode5 + (map4 != null ? map4.hashCode() : 0)) * 31; Map map5 = this.streams; int hashCode7 = (hashCode6 + (map5 != null ? map5.hashCode() : 0)) * 31; Set set = this.threadMembers; if (set != null) { i5 = set.hashCode(); } return hashCode7 + i5; } @Override // com.discord.widgets.channels.memberlist.WidgetChannelMembersListViewModel.StoreState public boolean isPanelOpen() { return this.isPanelOpen; } public String toString() { StringBuilder K = a.K("Thread(isPanelOpen="); K.append(isPanelOpen()); K.append(", channel="); K.append(getChannel()); K.append(", guild="); K.append(this.guild); K.append(", roles="); K.append(this.roles); K.append(", guildMembers="); K.append(this.guildMembers); K.append(", users="); K.append(this.users); K.append(", presences="); K.append(this.presences); K.append(", streams="); K.append(this.streams); K.append(", threadMembers="); K.append(this.threadMembers); K.append(")"); return K.toString(); } } private StoreState(boolean z2, Channel channel) { this.isPanelOpen = z2; this.channel = channel; } public /* synthetic */ StoreState(boolean z2, Channel channel, DefaultConstructorMarker defaultConstructorMarker) { this(z2, channel); } public Channel getChannel() { return this.channel; } public boolean isPanelOpen() { return this.isPanelOpen; } } /* compiled from: WidgetChannelMembersListViewModel.kt */ public static abstract class ViewState { private final String listId; /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class Empty extends ViewState { public static final Empty INSTANCE = new Empty(); private Empty() { super("empty", null); } } /* compiled from: WidgetChannelMembersListViewModel.kt */ public static final class Loaded extends ViewState { private final Channel channel; private final boolean isOpen; private final MemberList listItems; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public Loaded(MemberList memberList, boolean z2, Channel channel) { super(memberList.getListId(), null); m.checkNotNullParameter(memberList, "listItems"); this.listItems = memberList; this.isOpen = z2; this.channel = channel; } public static /* synthetic */ Loaded copy$default(Loaded loaded, MemberList memberList, boolean z2, Channel channel, int i, Object obj) { if ((i & 1) != 0) { memberList = loaded.listItems; } if ((i & 2) != 0) { z2 = loaded.isOpen; } if ((i & 4) != 0) { channel = loaded.channel; } return loaded.copy(memberList, z2, channel); } public final MemberList component1() { return this.listItems; } public final boolean component2() { return this.isOpen; } public final Channel component3() { return this.channel; } public final Loaded copy(MemberList memberList, boolean z2, Channel channel) { m.checkNotNullParameter(memberList, "listItems"); return new Loaded(memberList, z2, channel); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Loaded)) { return false; } Loaded loaded = (Loaded) obj; return m.areEqual(this.listItems, loaded.listItems) && this.isOpen == loaded.isOpen && m.areEqual(this.channel, loaded.channel); } public final Channel getChannel() { return this.channel; } public final MemberList getListItems() { return this.listItems; } public int hashCode() { MemberList memberList = this.listItems; int i = 0; int hashCode = (memberList != null ? memberList.hashCode() : 0) * 31; boolean z2 = this.isOpen; if (z2) { z2 = true; } int i2 = z2 ? 1 : 0; int i3 = z2 ? 1 : 0; int i4 = z2 ? 1 : 0; int i5 = (hashCode + i2) * 31; Channel channel = this.channel; if (channel != null) { i = channel.hashCode(); } return i5 + i; } public final boolean isOpen() { return this.isOpen; } public String toString() { StringBuilder K = a.K("Loaded(listItems="); K.append(this.listItems); K.append(", isOpen="); K.append(this.isOpen); K.append(", channel="); K.append(this.channel); K.append(")"); return K.toString(); } } private ViewState(String str) { this.listId = str; } public /* synthetic */ ViewState(String str, DefaultConstructorMarker defaultConstructorMarker) { this(str); } public final String getListId() { return this.listId; } } public WidgetChannelMembersListViewModel() { this(null, null, null, null, 15, null); } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public WidgetChannelMembersListViewModel(GuildChannelSubscriber guildChannelSubscriber, StoreGuilds storeGuilds, StoreEmojiCustom storeEmojiCustom, Observable observable) { super(ViewState.Empty.INSTANCE); m.checkNotNullParameter(guildChannelSubscriber, "guildChannelSubscriber"); m.checkNotNullParameter(storeGuilds, "storeGuilds"); m.checkNotNullParameter(storeEmojiCustom, "storeCustomEmojis"); m.checkNotNullParameter(observable, "storeStateObservable"); this.guildChannelSubscriber = guildChannelSubscriber; this.storeGuilds = storeGuilds; this.storeCustomEmojis = storeEmojiCustom; this.eventSubject = PublishSubject.k0(); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable), this, null, 2, null), WidgetChannelMembersListViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass2(this), 62, (Object) null); } public /* synthetic */ WidgetChannelMembersListViewModel(GuildChannelSubscriber guildChannelSubscriber, StoreGuilds storeGuilds, StoreEmojiCustom storeEmojiCustom, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) { StoreEmojiCustom storeEmojiCustom2; Observable observable2; WidgetChannelMembersListViewModel widgetChannelMembersListViewModel; GuildChannelSubscriber r0 = (i & 1) != 0 ? new AnonymousClass1() : guildChannelSubscriber; StoreGuilds guilds = (i & 2) != 0 ? StoreStream.Companion.getGuilds() : storeGuilds; StoreEmojiCustom customEmojis = (i & 4) != 0 ? StoreStream.Companion.getCustomEmojis() : storeEmojiCustom; if ((i & 8) != 0) { observable2 = Companion.observeStoreState$default(Companion, guilds, null, null, null, null, null, null, null, null, null, null, null, 4094, null); widgetChannelMembersListViewModel = this; storeEmojiCustom2 = customEmojis; } else { widgetChannelMembersListViewModel = this; observable2 = observable; storeEmojiCustom2 = customEmojis; } new WidgetChannelMembersListViewModel(r0, guilds, storeEmojiCustom2, observable2); } public static final /* synthetic */ void access$handleStoreState(WidgetChannelMembersListViewModel widgetChannelMembersListViewModel, StoreState storeState) { widgetChannelMembersListViewModel.handleStoreState(storeState); } @MainThread private final void handleStoreState(StoreState storeState) { MemberList memberList; if (storeState instanceof StoreState.None) { updateViewState(ViewState.Empty.INSTANCE); return; } if (storeState instanceof StoreState.Guild) { StoreState.Guild guild = (StoreState.Guild) storeState; memberList = GuildMemberListItemGeneratorKt.generateGuildMemberListItems(guild.getChannelMembers(), guild.getGuild(), guild.getChannel(), guild.getGuildRoles(), PermissionUtils.can(1, guild.getChannelPermissions()), this.storeGuilds, this.storeCustomEmojis); } else if (storeState instanceof StoreState.Private) { StoreState.Private r0 = (StoreState.Private) storeState; Map relationships = r0.getRelationships(); User v0 = AnimatableValueParser.v0(r0.getChannel()); Long valueOf = v0 != null ? Long.valueOf(v0.getId()) : null; boolean z2 = true; boolean isType = ModelUserRelationship.isType(relationships.get(valueOf), 1); if (!AnimatableValueParser.k1(r0.getChannel()) && !isType) { z2 = false; } memberList = PrivateChannelMemberListItemGeneratorKt.generateGroupDmMemberListItems(r0.getChannel(), r0.getUsers(), r0.getPresences(), r0.getApplicationStreams(), z2); } else if (storeState instanceof StoreState.Thread) { StoreState.Thread thread = (StoreState.Thread) storeState; memberList = ThreadMemberListItemGeneratorKt.generateThreadMemberListItems(thread.getChannel(), thread.getRoles(), thread.getGuild(), thread.getGuildMembers(), thread.getUsers(), thread.getPresences(), thread.getStreams(), thread.getThreadMembers(), this.storeGuilds, this.storeCustomEmojis); } else { throw new NoWhenBranchMatchedException(); } ViewState.Loaded loaded = new ViewState.Loaded(memberList, storeState.isPanelOpen(), storeState.getChannel()); updateViewState(loaded); updateSubscriptions(getViewState(), loaded, storeState); } public final Observable observeEvents() { PublishSubject publishSubject = this.eventSubject; m.checkNotNullExpressionValue(publishSubject, "eventSubject"); return publishSubject; } public final void updateSubscriptions(ViewState viewState, ViewState.Loaded loaded, StoreState storeState) { m.checkNotNullParameter(loaded, "newViewState"); m.checkNotNullParameter(storeState, "storeState"); boolean z2 = (m.areEqual(viewState != null ? viewState.getListId() : null, loaded.getListId()) ^ true) && storeState.isPanelOpen(); Channel channel = loaded.getChannel(); if (channel == null || !AnimatableValueParser.A1(channel)) { if (z2) { this.eventSubject.j.onNext(Event.ScrollToTop.INSTANCE); updateSubscriptionsForChannel(new IntRange(0, 99)); } else if ((viewState instanceof ViewState.Loaded) && !((ViewState.Loaded) viewState).isOpen() && loaded.isOpen()) { this.eventSubject.j.onNext(Event.UpdateRanges.INSTANCE); } } else if (z2) { this.eventSubject.j.onNext(Event.ScrollToTop.INSTANCE); updateSubscriptionsForThread(loaded.getChannel()); } else if ((viewState instanceof ViewState.Loaded) && !((ViewState.Loaded) viewState).isOpen() && loaded.isOpen()) { updateSubscriptionsForThread(loaded.getChannel()); } } @MainThread public final void updateSubscriptionsForChannel(IntRange intRange) { m.checkNotNullParameter(intRange, "range"); ViewState viewState = getViewState(); if (!(viewState instanceof ViewState.Loaded)) { viewState = null; } ViewState.Loaded loaded = (ViewState.Loaded) viewState; if (loaded != null && loaded.getChannel() != null && loaded.isOpen()) { this.guildChannelSubscriber.subscribeToChannelRange(loaded.getChannel(), intRange); } } public final void updateSubscriptionsForThread(Channel channel) { if (channel != null && !AnimatableValueParser.e1(channel)) { m.checkNotNullParameter(channel, "$this$isAnnouncementThread"); if (!(channel.A() == 10)) { this.guildChannelSubscriber.subscribeToThread(channel); } } } }