package com.discord.widgets.hubs; import c.d.b.a.a; import com.discord.api.channel.Channel; import com.discord.models.guild.Guild; import com.discord.stores.StoreChannels; import com.discord.stores.StoreChannelsSelected; import com.discord.stores.StoreGuilds; import d0.z.d.o; import java.util.Iterator; import java.util.Map; import kotlin.jvm.functions.Function0; /* compiled from: WidgetDiscordHubDescriptionViewModel.kt */ public final class WidgetDiscordHubsDescriptionViewModel$Companion$observeStores$1 extends o implements Function0 { public final /* synthetic */ StoreChannelsSelected $channelsSelectedStore; public final /* synthetic */ StoreChannels $channelsStore; public final /* synthetic */ long $guildId; public final /* synthetic */ StoreGuilds $guildStore; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public WidgetDiscordHubsDescriptionViewModel$Companion$observeStores$1(StoreChannelsSelected storeChannelsSelected, StoreChannels storeChannels, long j, StoreGuilds storeGuilds) { super(0); this.$channelsSelectedStore = storeChannelsSelected; this.$channelsStore = storeChannels; this.$guildId = j; this.$guildStore = storeGuilds; } /* JADX WARNING: Code restructure failed: missing block: B:8:0x0018, code lost: if (r0 != null) goto L_0x0057; */ @Override // kotlin.jvm.functions.Function0 /* renamed from: invoke */ public final HubDescriptionState mo1invoke() { Object obj; boolean z2; Channel selectedChannel = this.$channelsSelectedStore.getSelectedChannel(); String str = null; if (selectedChannel != null) { if (!(selectedChannel.A() == 14)) { selectedChannel = null; } } Iterator it = this.$channelsStore.getChannelsForGuild(this.$guildId).entrySet().iterator(); while (true) { if (!it.hasNext()) { obj = null; break; } obj = it.next(); if (((Channel) ((Map.Entry) obj).getValue()).A() == 14) { z2 = true; continue; } else { z2 = false; continue; } if (z2) { break; } } Map.Entry entry = (Map.Entry) obj; selectedChannel = entry != null ? (Channel) entry.getValue() : null; if (selectedChannel != null) { long h = selectedChannel.h(); Guild guild = this.$guildStore.getGuild(this.$guildId); if (guild != null) { str = guild.getName(); } return new HubDescriptionState(h, str != null ? str : "", null, 4, null); } StringBuilder L = a.L("Guild has no directory channels for id: "); L.append(this.$guildId); throw new IllegalStateException(L.toString()); } }