package com.discord.utilities.stage; import c.d.b.a.a; import com.airbnb.lottie.parser.AnimatableValueParser; import com.discord.api.channel.Channel; import com.discord.models.guild.Guild; import com.discord.models.member.GuildMember; import com.discord.stores.StoreChannels; import com.discord.stores.StoreGuilds; import com.discord.stores.StorePermissions; import com.discord.stores.StoreStageChannels; import com.discord.stores.StoreStageInstances; import com.discord.stores.StoreStream; import com.discord.stores.StoreUser; import com.discord.utilities.permissions.PermissionUtils; import com.discord.widgets.stage.StageRoles; import d0.z.d.m; import java.util.Map; /* compiled from: StageChannelUtils.kt */ public final class StageChannelUtils { public static final StageChannelUtils INSTANCE = new StageChannelUtils(); private StageChannelUtils() { } public static final boolean computeCanEditStageModerators(StorePermissions storePermissions, StoreGuilds storeGuilds, long j, long j2, Channel channel) { m.checkNotNullParameter(storePermissions, "permissionStore"); m.checkNotNullParameter(storeGuilds, "guildStore"); m.checkNotNullParameter(channel, "channel"); Guild guild = storeGuilds.getGuilds().get(Long.valueOf(j2)); if ((guild != null && guild.isOwner(j)) || AnimatableValueParser.S0((Long) a.d(channel, storePermissions.getPermissionsByChannel()), 8) || AnimatableValueParser.S0(storePermissions.getGuildPermissions().get(Long.valueOf(j2)), 289406992)) { return true; } PermissionUtils permissionUtils = PermissionUtils.INSTANCE; Map map = storeGuilds.getMembers().get(Long.valueOf(j2)); return AnimatableValueParser.S0(Long.valueOf(permissionUtils.computeChannelOverwrite(j, j2, map != null ? map.get(Long.valueOf(j)) : null, channel.s())), 268435456); } public static /* synthetic */ boolean shouldShowEndStageBottomSheet$default(StageChannelUtils stageChannelUtils, long j, StoreChannels storeChannels, StoreStageChannels storeStageChannels, StoreStageInstances storeStageInstances, StoreUser storeUser, int i, Object obj) { if ((i & 2) != 0) { storeChannels = StoreStream.Companion.getChannels(); } if ((i & 4) != 0) { storeStageChannels = StoreStream.Companion.getStageChannels(); } if ((i & 8) != 0) { storeStageInstances = StoreStream.Companion.getStageInstances(); } if ((i & 16) != 0) { storeUser = StoreStream.Companion.getUsers(); } return stageChannelUtils.shouldShowEndStageBottomSheet(j, storeChannels, storeStageChannels, storeStageInstances, storeUser); } public final boolean shouldShowEndStageBottomSheet(long j, StoreChannels storeChannels, StoreStageChannels storeStageChannels, StoreStageInstances storeStageInstances, StoreUser storeUser) { StageRoles r9; Map channelRoles; m.checkNotNullParameter(storeChannels, "channelsStore"); m.checkNotNullParameter(storeStageChannels, "stageChannelsStore"); m.checkNotNullParameter(storeStageInstances, "stageInstanceStore"); m.checkNotNullParameter(storeUser, "userStore"); Channel channel = storeChannels.getChannel(j); if (channel == null || !AnimatableValueParser.v1(channel) || storeStageInstances.getStageInstanceForChannel(channel.h()) == null || (r9 = storeStageChannels.m10getMyRolesvisDeB4(channel.h())) == null || !StageRoles.m25isModeratorimpl(r9.m28unboximpl()) || (channelRoles = storeStageChannels.getChannelRoles(channel.h())) == null) { return false; } long id2 = storeUser.getMe().getId(); boolean z2 = false; boolean z3 = false; for (Map.Entry entry : channelRoles.entrySet()) { long longValue = entry.getKey().longValue(); int r2 = entry.getValue().m28unboximpl(); if (longValue != id2 && StageRoles.m25isModeratorimpl(r2)) { if (StageRoles.m26isSpeakerimpl(r2)) { z2 = true; z3 = true; } else { z2 = true; } } } if (!z2) { return true; } if (!StageRoles.m26isSpeakerimpl(r9.m28unboximpl())) { return false; } return !z3; } }