discord-jadx/app/src/main/java/com/discord/utilities/auditlogs/AuditLogChangeUtils.java

1520 lines
73 KiB
Java

package com.discord.utilities.auditlogs;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Typeface;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import androidx.annotation.StringRes;
import c.a.l.b;
import c.d.b.a.a;
import com.discord.api.guild.GuildExplicitContentFilter;
import com.discord.api.guild.GuildVerificationLevel;
import com.discord.api.guildscheduledevent.GuildScheduledEventEntityType;
import com.discord.api.guildscheduledevent.GuildScheduledEventStatus;
import com.discord.api.stageinstance.StageInstancePrivacyLevel;
import com.discord.app.AppLog;
import com.discord.models.domain.ModelAuditLogEntry;
import com.discord.models.user.User;
import com.discord.rtcconnection.MediaSinkWantsManager;
import com.discord.stores.StoreStream;
import com.discord.utilities.color.ColorCompat;
import com.discord.utilities.font.FontUtils;
import com.discord.utilities.logging.Logger;
import com.discord.utilities.resources.StringResourceUtilsKt;
import com.discord.utilities.spans.TypefaceSpanCompat;
import d0.f0.q;
import d0.g0.w;
import d0.t.n;
import d0.t.u;
import d0.z.d.m;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.MissingFormatArgumentException;
import java.util.Objects;
import java.util.Set;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Pair;
/* compiled from: AuditLogChangeUtils.kt */
public final class AuditLogChangeUtils {
private static final List<String> CHANGE_KEYS_REFERENCING_CHANNEL = n.listOf((Object[]) new String[]{"channel_id", "afk_channel_id", "system_channel_id", "rules_channel_id", "public_updates_channel_id"});
public static final AuditLogChangeUtils INSTANCE = new AuditLogChangeUtils();
private static final List<Integer> RENDERABLE_DELETE_ACTION_TYPES = n.listOf((Object[]) new Integer[]{22, 20, 21});
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
public static final /* synthetic */ int[] $EnumSwitchMapping$1;
public static final /* synthetic */ int[] $EnumSwitchMapping$2;
static {
ModelAuditLogEntry.TargetType.values();
int[] iArr = new int[13];
$EnumSwitchMapping$0 = iArr;
iArr[ModelAuditLogEntry.TargetType.ALL.ordinal()] = 1;
iArr[ModelAuditLogEntry.TargetType.GUILD.ordinal()] = 2;
iArr[ModelAuditLogEntry.TargetType.CHANNEL.ordinal()] = 3;
iArr[ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE.ordinal()] = 4;
iArr[ModelAuditLogEntry.TargetType.USER.ordinal()] = 5;
iArr[ModelAuditLogEntry.TargetType.ROLE.ordinal()] = 6;
iArr[ModelAuditLogEntry.TargetType.INVITE.ordinal()] = 7;
iArr[ModelAuditLogEntry.TargetType.WEBHOOK.ordinal()] = 8;
iArr[ModelAuditLogEntry.TargetType.EMOJI.ordinal()] = 9;
iArr[ModelAuditLogEntry.TargetType.INTEGRATION.ordinal()] = 10;
iArr[ModelAuditLogEntry.TargetType.STAGE_INSTANCE.ordinal()] = 11;
iArr[ModelAuditLogEntry.TargetType.GUILD_SCHEDULED_EVENT.ordinal()] = 12;
MediaSinkWantsManager.VideoQualityMode.values();
int[] iArr2 = new int[2];
$EnumSwitchMapping$1 = iArr2;
iArr2[MediaSinkWantsManager.VideoQualityMode.AUTO.ordinal()] = 1;
iArr2[MediaSinkWantsManager.VideoQualityMode.FULL.ordinal()] = 2;
ModelAuditLogEntry.ActionType.values();
int[] iArr3 = new int[4];
$EnumSwitchMapping$2 = iArr3;
iArr3[ModelAuditLogEntry.ActionType.CREATE.ordinal()] = 1;
iArr3[ModelAuditLogEntry.ActionType.UPDATE.ordinal()] = 2;
iArr3[ModelAuditLogEntry.ActionType.DELETE.ordinal()] = 3;
}
}
private AuditLogChangeUtils() {
}
public static final /* synthetic */ int access$getStringForPermission(AuditLogChangeUtils auditLogChangeUtils, long j, ModelAuditLogEntry modelAuditLogEntry) {
return auditLogChangeUtils.getStringForPermission(j, modelAuditLogEntry);
}
private final Pair<HashSet<Long>, HashSet<Long>> calculatePermissionChange(ModelAuditLogEntry.Change change) {
Object oldValue = change.getOldValue();
String str = null;
if (!(oldValue instanceof String)) {
oldValue = null;
}
String str2 = (String) oldValue;
long j = 0;
long parseLong = str2 != null ? Long.parseLong(str2) : 0;
Object newValue = change.getNewValue();
if (newValue instanceof String) {
str = newValue;
}
String str3 = str;
if (str3 != null) {
j = Long.parseLong(str3);
}
long j2 = (~parseLong) & j;
long j3 = parseLong & (~j);
HashSet hashSet = new HashSet();
HashSet hashSet2 = new HashSet();
for (int i = 0; i <= 63; i++) {
long j4 = 1 << i;
if ((j2 & j4) == j4) {
hashSet.add(Long.valueOf(j4));
}
if ((j3 & j4) == j4) {
hashSet2.add(Long.valueOf(j4));
}
}
return new Pair<>(hashSet, hashSet2);
}
/* JADX DEBUG: TODO: convert one arg to string using `String.valueOf()`, args: [('0' char), (r3v0 int)] */
private final String getChangeNumberString(int i) {
if (i < 0 || 9 < i) {
return String.valueOf(i);
}
StringBuilder sb = new StringBuilder();
sb.append('0');
sb.append(i);
return sb.toString();
}
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x00bd: APUT (r15v31 java.lang.Object[]), (0 ??[int, short, byte, char]), (r1v77 java.lang.String) */
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x00ae: APUT
(r2v27 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Integer : 0x00aa: INVOKE (r3v17 java.lang.Integer) =
(wrap: int : 0x00a9: ARITH (r3v16 int) = (16777215 int) & (wrap: int : 0x00a8: CAST (r4v5 int) = (int) (wrap: long : 0x00a4: INVOKE (r8v10 long) = (wrap: java.lang.Long : 0x00a2: CHECK_CAST (r8v9 java.lang.Long) = (java.lang.Long) (r8v8 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long)))
type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x00e8: APUT
(r15v30 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.CharSequence : 0x00e4: INVOKE (r1v74 java.lang.CharSequence) =
(r10v0 'this' com.discord.utilities.auditlogs.AuditLogChangeUtils A[IMMUTABLE_TYPE, THIS])
(wrap: int : 0x00e3: CAST (r2v26 int) = (int) (wrap: long : 0x00df: INVOKE (r1v73 long) = (wrap: java.lang.Long : 0x00dd: CHECK_CAST (r1v72 java.lang.Long) = (java.lang.Long) (r1v71 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long))
(r11v0 android.content.Context)
type: DIRECT call: com.discord.utilities.auditlogs.AuditLogChangeUtils.getExpireAfterString(int, android.content.Context):java.lang.CharSequence)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x01d8: APUT (r1v50 java.lang.Object[]), (0 ??[int, short, byte, char]), (r15v23 java.lang.CharSequence) */
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x01ff: APUT
(r15v20 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Long : 0x01fb: INVOKE (r1v46 java.lang.Long) =
(wrap: long : 0x01fa: ARITH (r1v45 long) = (wrap: long : 0x01f3: INVOKE (r1v44 long) = (wrap: java.lang.Long : 0x01f1: CHECK_CAST (r1v43 java.lang.Long) = (java.lang.Long) (r1v42 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long) / (wrap: long : 0x01f9: CAST (r3v14 long) = (long) (1000 int)))
type: STATIC call: java.lang.Long.valueOf(long):java.lang.Long)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0241: APUT (r15v19 java.lang.Object[]), (0 ??[int, short, byte, char]), (r1v38 java.lang.String) */
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0287: APUT
(r15v18 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.CharSequence : 0x0283: INVOKE (r1v31 java.lang.CharSequence) =
(r2v9 android.content.res.Resources)
(r11v0 android.content.Context)
(2131755142 int)
(r3v12 int)
(r6v3 java.lang.Object[])
type: STATIC call: com.discord.utilities.resources.StringResourceUtilsKt.getQuantityString(android.content.res.Resources, android.content.Context, int, int, java.lang.Object[]):java.lang.CharSequence)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0281: APUT
(r6v3 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Integer : 0x027d: INVOKE (r4v4 java.lang.Integer) =
(wrap: int : 0x027c: CAST (r4v3 int) = (int) (wrap: long : 0x0278: INVOKE (r8v5 long) = (wrap: java.lang.Long : 0x0276: CHECK_CAST (r8v4 java.lang.Long) = (java.lang.Long) (r8v3 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long))
type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x02ba: APUT
(r15v17 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Long : 0x02b6: INVOKE (r1v28 java.lang.Long) =
(wrap: long : 0x02b5: ARITH (r1v27 long) = (wrap: long : 0x02ae: INVOKE (r1v26 long) = (wrap: java.lang.Long : 0x02ac: CHECK_CAST (r1v25 java.lang.Long) = (java.lang.Long) (r1v24 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long) / (wrap: long : 0x02b4: CAST (r3v9 long) = (long) (60 int)))
type: STATIC call: java.lang.Long.valueOf(long):java.lang.Long)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x02fd: APUT
(r15v16 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.CharSequence : 0x02f9: INVOKE (r1v22 java.lang.CharSequence) =
(r2v8 android.content.res.Resources)
(r11v0 android.content.Context)
(2131755148 int)
(r3v7 int)
(r6v2 java.lang.Object[])
type: STATIC call: com.discord.utilities.resources.StringResourceUtilsKt.getQuantityString(android.content.res.Resources, android.content.Context, int, int, java.lang.Object[]):java.lang.CharSequence)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x02f7: APUT
(r6v2 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Integer : 0x02f5: CHECK_CAST (r8v1 java.lang.Integer) = (java.lang.Integer) (r8v0 java.lang.Object))
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0351: APUT
(r15v15 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.CharSequence : 0x034d: INVOKE (r1v14 java.lang.CharSequence) =
(r10v0 'this' com.discord.utilities.auditlogs.AuditLogChangeUtils A[IMMUTABLE_TYPE, THIS])
(r1v13 com.discord.rtcconnection.MediaSinkWantsManager$VideoQualityMode)
(r11v0 android.content.Context)
type: DIRECT call: com.discord.utilities.auditlogs.AuditLogChangeUtils.getStringForVideoQualityMode(com.discord.rtcconnection.MediaSinkWantsManager$VideoQualityMode, android.content.Context):java.lang.CharSequence)
*/
/* JADX WARNING: Removed duplicated region for block: B:19:0x004c */
/* JADX WARNING: Removed duplicated region for block: B:28:0x0073 A[ADDED_TO_REGION] */
private final CharSequence getChangeTextWithParams(Context context, ModelAuditLogEntry modelAuditLogEntry, ModelAuditLogEntry.Change change, @StringRes int i, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, ? extends CharSequence>> map) {
CharSequence charSequence;
CharSequence charSequence2;
try {
if (hasNewValue(change, "type") && modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL) {
if (change.getOldValue() != null) {
Object oldValue = change.getOldValue();
if (oldValue != null) {
int channelTypeStringResIdFromValue = getChannelTypeStringResIdFromValue(Integer.valueOf((int) ((Long) oldValue).longValue()));
if (channelTypeStringResIdFromValue != 0) {
charSequence = b.g(context, channelTypeStringResIdFromValue, new Object[0], null, 4);
if (change.getNewValue() != null) {
Object newValue = change.getNewValue();
if (newValue != null) {
int channelTypeStringResIdFromValue2 = getChannelTypeStringResIdFromValue(Integer.valueOf((int) ((Long) newValue).longValue()));
if (channelTypeStringResIdFromValue2 != 0) {
charSequence2 = b.g(context, channelTypeStringResIdFromValue2, new Object[0], null, 4);
return (charSequence == null || charSequence2 == null) ? b.g(context, i, new Object[]{charSequence, charSequence2}, null, 4) : b.g(context, i, new Object[]{charSequence2}, null, 4);
}
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
}
}
charSequence2 = null;
if (charSequence == null) {
}
}
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
}
}
charSequence = null;
if (change.getNewValue() != null) {
}
charSequence2 = null;
if (charSequence == null) {
}
} else if (hasNewValue(change, "color")) {
Object[] objArr = new Object[1];
Object[] objArr2 = new Object[1];
Object newValue2 = change.getNewValue();
if (newValue2 != null) {
objArr2[0] = Integer.valueOf(16777215 & ((int) ((Long) newValue2).longValue()));
String format = String.format("#%06X", Arrays.copyOf(objArr2, 1));
m.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
objArr[0] = format;
return b.g(context, i, objArr, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (hasNewValue(change, "max_age")) {
Object[] objArr3 = new Object[1];
Object newValue3 = change.getNewValue();
if (newValue3 != null) {
objArr3[0] = getExpireAfterString((int) ((Long) newValue3).longValue(), context);
return b.g(context, i, objArr3, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (change.getNewValue() != null && modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE && (m.areEqual(change.getKey(), "allow") || m.areEqual(change.getKey(), "deny") || m.areEqual(change.getKey(), "reset"))) {
return renderPermissions(change, modelAuditLogEntry, context, map);
} else {
if (change.getNewValue() != null && (m.areEqual(change.getKey(), "allow") || m.areEqual(change.getKey(), "deny"))) {
return b.g(context, i, new Object[]{getPluralString(context, change).toString() + "\n" + renderPermissionList(change, modelAuditLogEntry, context)}, null, 4);
} else if (change.getNewValue() != null && (m.areEqual(change.getKey(), "$remove") || m.areEqual(change.getKey(), "$add"))) {
return b.g(context, i, new Object[]{renderRoles(context, change)}, null, 4);
} else {
if (change.getNewValue() != null && CHANGE_KEYS_REFERENCING_CHANNEL.contains(change.getKey())) {
Object[] objArr4 = new Object[1];
Map map2 = (Map) map.get(ModelAuditLogEntry.TargetType.CHANNEL);
objArr4[0] = map2 != null ? (CharSequence) map2.get(Long.valueOf(Long.parseLong(change.getValue().toString()))) : null;
return b.g(context, i, objArr4, null, 4);
} else if (hasNewValue(change, "bitrate")) {
Object[] objArr5 = new Object[1];
Object newValue4 = change.getNewValue();
if (newValue4 != null) {
objArr5[0] = Long.valueOf(((Long) newValue4).longValue() / ((long) 1000));
return b.g(context, i, objArr5, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (hasNewValue(change, "owner_id")) {
Object[] objArr6 = new Object[1];
User user = StoreStream.Companion.getUsers().getUsers().get(Long.valueOf(Long.parseLong(change.getNewValue().toString())));
objArr6[0] = user != null ? user.getUsername() : null;
return b.g(context, i, objArr6, null, 4);
} else if (hasNewValue(change, "rate_limit_per_user")) {
Object[] objArr7 = new Object[1];
Resources resources = context.getResources();
m.checkNotNullExpressionValue(resources, "context.resources");
Object newValue5 = change.getNewValue();
if (newValue5 != null) {
int longValue = (int) ((Long) newValue5).longValue();
Object[] objArr8 = new Object[1];
Object newValue6 = change.getNewValue();
if (newValue6 != null) {
objArr8[0] = Integer.valueOf((int) ((Long) newValue6).longValue());
objArr7[0] = StringResourceUtilsKt.getQuantityString(resources, context, 2131755142, longValue, objArr8);
return b.g(context, i, objArr7, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (hasNewValue(change, "afk_timeout")) {
Object[] objArr9 = new Object[1];
Object newValue7 = change.getNewValue();
if (newValue7 != null) {
objArr9[0] = Long.valueOf(((Long) newValue7).longValue() / ((long) 60));
return b.g(context, i, objArr9, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (hasNewValue(change, "prune_delete_days")) {
Object[] objArr10 = new Object[1];
Resources resources2 = context.getResources();
m.checkNotNullExpressionValue(resources2, "context.resources");
Object newValue8 = change.getNewValue();
if (newValue8 != null) {
int intValue = ((Integer) newValue8).intValue();
Object[] objArr11 = new Object[1];
Object newValue9 = change.getNewValue();
if (newValue9 != null) {
objArr11[0] = (Integer) newValue9;
objArr10[0] = StringResourceUtilsKt.getQuantityString(resources2, context, 2131755148, intValue, objArr11);
return b.g(context, i, objArr10, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Int");
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Int");
} else if (!hasNewValue(change, "video_quality_mode")) {
return b.a(context, i, new Object[0], new AuditLogChangeUtils$getChangeTextWithParams$1(change));
} else {
Object[] objArr12 = new Object[1];
MediaSinkWantsManager.VideoQualityMode.a aVar = MediaSinkWantsManager.VideoQualityMode.Companion;
Object newValue10 = change.getNewValue();
if (newValue10 != null) {
Integer valueOf = Integer.valueOf((int) ((Long) newValue10).longValue());
Objects.requireNonNull(aVar);
objArr12[0] = getStringForVideoQualityMode((valueOf != null && valueOf.intValue() == 1) ? MediaSinkWantsManager.VideoQualityMode.AUTO : (valueOf != null && valueOf.intValue() == 2) ? MediaSinkWantsManager.VideoQualityMode.FULL : MediaSinkWantsManager.VideoQualityMode.AUTO, context);
return b.g(context, i, objArr12, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
}
}
}
} catch (MissingFormatArgumentException unused) {
StringBuilder L = a.L("Failed to get string for action id: ");
L.append(modelAuditLogEntry.getActionTypeId() + " and change: " + change.getKey());
String sb = L.toString();
m.checkNotNullExpressionValue(sb, "StringBuilder()\n …}\")\n .toString()");
Logger.e$default(AppLog.g, "Audit Logs", sb, null, null, 12, null);
return "";
} catch (ClassCastException e) {
StringBuilder sb2 = new StringBuilder();
sb2.append(e.getLocalizedMessage() + " for change: ");
sb2.append(change.getKey() + ' ' + change.getNewValue() + ' ' + change.getOldValue());
String sb3 = sb2.toString();
m.checkNotNullExpressionValue(sb3, "StringBuilder()\n …}\")\n .toString()");
Logger.w$default(AppLog.g, sb3, null, 2, null);
return "";
}
}
@StringRes
private final int getChannelChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1920783726:
if (key.equals("rtc_region")) {
return getNullableNewOrOldValueString$default(this, change, 2131889425, 2131889426, 2131889427, null, 8, null);
}
break;
case -1451708889:
if (key.equals("video_quality_mode")) {
return getNullableOldValueString(change, 2131889439, 2131889438);
}
break;
case -934964668:
if (key.equals("reason")) {
return 2131889441;
}
break;
case -102270099:
if (key.equals("bitrate")) {
return getNullableOldValueString(change, 2131889406, 2131889405);
}
break;
case 3079692:
if (key.equals("deny")) {
return 2131889418;
}
break;
case 3373707:
if (key.equals("name")) {
return getNullableOldValueString(change, 2131889412, 2131889411);
}
break;
case 3390806:
if (key.equals("nsfw")) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value).booleanValue();
if (!booleanValue) {
return 2131889413;
}
if (booleanValue) {
return 2131889414;
}
throw new NoWhenBranchMatchedException();
}
break;
case 3575610:
if (key.equals("type")) {
return getNullableOldValueString(change, 2131889434, 2131889433);
}
break;
case 92906313:
if (key.equals("allow")) {
return 2131889419;
}
break;
case 108404047:
if (key.equals("reset")) {
return 2131889420;
}
break;
case 110546223:
if (key.equals("topic")) {
return getNullableNewOrOldValueString$default(this, change, 2131889430, 2131889432, 2131889431, null, 8, null);
}
break;
case 747804969:
if (key.equals("position")) {
return getNullableOldValueString(change, 2131889422, 2131889421);
}
break;
case 987155184:
if (key.equals("rate_limit_per_user")) {
return getNullableOldValueString(change, 2131889424, 2131889423);
}
break;
}
}
return 0;
}
@StringRes
private final int getChannelTypeStringResIdFromValue(Integer num) {
if (num != null && num.intValue() == 1) {
return 2131888170;
}
if (num != null && num.intValue() == 3) {
return 2131889140;
}
if (num != null && num.intValue() == 0) {
return 2131893925;
}
if (num != null && num.intValue() == 2) {
return 2131894635;
}
if (num != null && num.intValue() == 5) {
return 2131891427;
}
if (num != null && num.intValue() == 6) {
return 2131893691;
}
if (num != null && num.intValue() == 13) {
return 2131893410;
}
if ((num != null && num.intValue() == 10) || ((num != null && num.intValue() == 11) || (num != null && num.intValue() == 12))) {
return 2131893945;
}
return (num != null && num.intValue() == 4) ? 2131887200 : 0;
}
@StringRes
private final int getEmojiChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
int hashCode = key.hashCode();
if (hashCode != -934964668) {
if (hashCode == 3373707 && key.equals("name")) {
return getNullableOldValueString(change, 2131889445, 2131889444);
}
} else if (key.equals("reason")) {
return 2131889441;
}
}
return 0;
}
private final CharSequence getExpireAfterString(int i, Context context) {
if (i == 0) {
return b.g(context, 2131891496, new Object[0], null, 4);
}
if (i == 1800) {
Resources resources = context.getResources();
m.checkNotNullExpressionValue(resources, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources, context, 2131755067, 30, 30);
} else if (i == 3600) {
Resources resources2 = context.getResources();
m.checkNotNullExpressionValue(resources2, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources2, context, 2131755065, 1, 1);
} else if (i == 21600) {
Resources resources3 = context.getResources();
m.checkNotNullExpressionValue(resources3, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources3, context, 2131755065, 6, 6);
} else if (i == 43200) {
Resources resources4 = context.getResources();
m.checkNotNullExpressionValue(resources4, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources4, context, 2131755065, 12, 12);
} else if (i == 86400) {
Resources resources5 = context.getResources();
m.checkNotNullExpressionValue(resources5, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources5, context, 2131755063, 1, 1);
} else if (i != 604800) {
return "";
} else {
Resources resources6 = context.getResources();
m.checkNotNullExpressionValue(resources6, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources6, context, 2131755063, 7, 7);
}
}
@StringRes
private final int getGuildChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key == null) {
return 0;
}
switch (key.hashCode()) {
case -1907190207:
return key.equals("banner_hash") ? 2131889450 : 0;
case -1724546052:
if (key.equals("description")) {
return getNullableNewValueString(change, 2131889454, 2131889453);
}
return 0;
case -1705139351:
if (!key.equals("explicit_content_filter")) {
return 0;
}
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
int longValue = (int) ((Long) value).longValue();
if (longValue == GuildExplicitContentFilter.NONE.getApiValue()) {
return 2131889457;
}
if (longValue == GuildExplicitContentFilter.SOME.getApiValue()) {
return 2131889458;
}
return longValue == GuildExplicitContentFilter.ALL.getApiValue() ? 2131889456 : 0;
case -1572429104:
if (key.equals("afk_channel_id")) {
return getNullableNewValueString(change, 2131889448, 2131889447);
}
return 0;
case -1390796524:
return key.equals("icon_hash") ? 2131889459 : 0;
case -1100074521:
if (key.equals("system_channel_id")) {
return getNullableNewValueString(change, 2131889470, 2131889469);
}
return 0;
case -934964668:
return key.equals("reason") ? 2131889441 : 0;
case -934795532:
return key.equals("region") ? 2131889465 : 0;
case -506227616:
if (!key.equals("verification_level")) {
return 0;
}
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Long");
int longValue2 = (int) ((Long) value2).longValue();
if (longValue2 == GuildVerificationLevel.NONE.getApiValue()) {
return 2131889479;
}
if (longValue2 == GuildVerificationLevel.LOW.getApiValue()) {
return 2131889477;
}
if (longValue2 == GuildVerificationLevel.MEDIUM.getApiValue()) {
return 2131889478;
}
if (longValue2 == GuildVerificationLevel.HIGH.getApiValue()) {
return 2131889476;
}
return longValue2 == GuildVerificationLevel.HIGHEST.getApiValue() ? 2131889480 : 0;
case -154917112:
return key.equals("afk_timeout") ? 2131889449 : 0;
case 3373707:
return key.equals("name") ? 2131889462 : 0;
case 226923479:
return key.equals("discovery_splash_hash") ? 2131889455 : 0;
case 643741670:
return key.equals("splash_hash") ? 2131889468 : 0;
case 706006559:
if (key.equals("rules_channel_id")) {
return getNullableNewValueString(change, 2131889467, 2131889466);
}
return 0;
case 945133165:
if (!key.equals("mfa_level")) {
return 0;
}
Object value3 = change.getValue();
Objects.requireNonNull(value3, "null cannot be cast to non-null type kotlin.Long");
int longValue3 = (int) ((Long) value3).longValue();
if (longValue3 != 0) {
return longValue3 != 1 ? 0 : 2131889461;
}
return 2131889460;
case 950953474:
if (key.equals("public_updates_channel_id")) {
return getNullableNewValueString(change, 2131889473, 2131889472);
}
return 0;
case 1207357234:
if (!key.equals("default_message_notifications")) {
return 0;
}
Object value4 = change.getValue();
Objects.requireNonNull(value4, "null cannot be cast to non-null type kotlin.Long");
int longValue4 = (int) ((Long) value4).longValue();
if (longValue4 != 0) {
return longValue4 != 1 ? 0 : 2131889452;
}
return 2131889451;
case 1580684753:
if (key.equals("vanity_url_code")) {
return getNullableNewValueString(change, 2131889475, 2131889474);
}
return 0;
case 1639242418:
if (key.equals("widget_channel_id")) {
return getNullableNewValueString(change, 2131889482, 2131889481);
}
return 0;
case 1663147559:
return key.equals("owner_id") ? 2131889463 : 0;
case 1792613336:
return key.equals("preferred_locale") ? 2131889464 : 0;
case 2010777670:
if (!key.equals("widget_enabled")) {
return 0;
}
Object value5 = change.getValue();
Objects.requireNonNull(value5, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value5).booleanValue();
if (booleanValue) {
return 2131889484;
}
if (!booleanValue) {
return 2131889483;
}
throw new NoWhenBranchMatchedException();
default:
return 0;
}
}
@StringRes
private final int getGuildScheduledEventChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key == null) {
return 0;
}
switch (key.hashCode()) {
case -2136953706:
return key.equals("sku_ids") ? 2131889547 : 0;
case -1724546052:
return key.equals("description") ? 2131889543 : 0;
case -892481550:
if (!key.equals("status")) {
return 0;
}
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
int longValue = (int) ((Long) value).longValue();
if (longValue == GuildScheduledEventStatus.SCHEDULED.getApiValue()) {
return 2131889551;
}
if (longValue == GuildScheduledEventStatus.ACTIVE.getApiValue()) {
return 2131889548;
}
if (longValue == GuildScheduledEventStatus.COMPLETED.getApiValue()) {
return 2131889550;
}
return longValue == GuildScheduledEventStatus.CANCELED.getApiValue() ? 2131889549 : 0;
case 3373707:
return key.equals("name") ? 2131889546 : 0;
case 1281710614:
if (!key.equals("entity_type")) {
return 0;
}
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Long");
int longValue2 = (int) ((Long) value2).longValue();
if (longValue2 == GuildScheduledEventEntityType.NONE.getApiValue()) {
return 2131889544;
}
return longValue2 == GuildScheduledEventEntityType.STAGE_INSTANCE.getApiValue() ? 2131889545 : 0;
case 1965579277:
if (!key.equals("privacy_level")) {
return 0;
}
Object value3 = change.getValue();
Objects.requireNonNull(value3, "null cannot be cast to non-null type kotlin.Long");
int longValue3 = (int) ((Long) value3).longValue();
if (longValue3 == StageInstancePrivacyLevel.GUILD_ONLY.getApiValue()) {
return 2131889556;
}
return longValue3 == StageInstancePrivacyLevel.PUBLIC.getApiValue() ? 2131889557 : 0;
default:
return 0;
}
}
@StringRes
private final int getIntegrationChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key == null) {
return 0;
}
int hashCode = key.hashCode();
if (hashCode != -1743820047) {
if (hashCode != -486786702) {
return (hashCode == 1767574344 && key.equals("expire_grace_period")) ? 2131889491 : 0;
}
if (!key.equals("expire_behavior")) {
return 0;
}
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
int longValue = (int) ((Long) value).longValue();
if (longValue != 0) {
return longValue != 1 ? 0 : 2131889489;
}
return 2131889490;
} else if (!key.equals("enable_emoticons")) {
return 0;
} else {
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value2).booleanValue();
if (booleanValue) {
return 2131889488;
}
if (!booleanValue) {
return 2131889487;
}
throw new NoWhenBranchMatchedException();
}
}
@StringRes
private final int getInviteChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1930808873:
if (key.equals("channel_id")) {
return 2131889493;
}
break;
case -934964668:
if (key.equals("reason")) {
return 2131889441;
}
break;
case 3059181:
if (key.equals("code")) {
return 2131889494;
}
break;
case 408141255:
if (key.equals("max_uses")) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
return ((int) ((Long) value).longValue()) != 0 ? 2131889499 : 2131889500;
}
break;
case 844430244:
if (key.equals("max_age")) {
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Long");
return ((int) ((Long) value2).longValue()) != 0 ? 2131889497 : 2131889498;
}
break;
case 1984986705:
if (key.equals("temporary")) {
Object value3 = change.getValue();
Objects.requireNonNull(value3, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value3).booleanValue();
if (booleanValue) {
return 2131889502;
}
if (!booleanValue) {
return 2131889501;
}
throw new NoWhenBranchMatchedException();
}
break;
}
}
return 0;
}
private final int getNullableNewOrOldValueString(ModelAuditLogEntry.Change change, @StringRes Integer num, @StringRes Integer num2, @StringRes Integer num3, @StringRes Integer num4) {
if (change.getNewValue() == null || change.getOldValue() == null) {
num = change.getNewValue() != null ? num2 : change.getOldValue() != null ? num3 : num4;
}
if (num != null) {
return num.intValue();
}
return 0;
}
public static /* synthetic */ int getNullableNewOrOldValueString$default(AuditLogChangeUtils auditLogChangeUtils, ModelAuditLogEntry.Change change, Integer num, Integer num2, Integer num3, Integer num4, int i, Object obj) {
return auditLogChangeUtils.getNullableNewOrOldValueString(change, (i & 1) != 0 ? null : num, (i & 2) != 0 ? null : num2, (i & 4) != 0 ? null : num3, (i & 8) != 0 ? null : num4);
}
private final int getNullableNewValueString(ModelAuditLogEntry.Change change, @StringRes int i, @StringRes int i2) {
return change.getNewValue() == null ? i : i2;
}
private final int getNullableOldValueString(ModelAuditLogEntry.Change change, @StringRes int i, @StringRes int i2) {
return change.getOldValue() == null ? i : i2;
}
/* JADX WARNING: Removed duplicated region for block: B:25:0x0069 */
private final String getOverridesPluralString(Context context, ModelAuditLogEntry.Change change, ModelAuditLogEntry modelAuditLogEntry, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, ? extends CharSequence>> map) {
Object obj;
String key;
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.collections.Collection<*>");
Collection collection = (Collection) value;
ModelAuditLogEntry.Options options = modelAuditLogEntry.getOptions();
Integer valueOf = options != null ? Integer.valueOf(options.getType()) : null;
Object obj2 = "";
if (valueOf != null && valueOf.intValue() == 1) {
Map map2 = (Map) map.get(ModelAuditLogEntry.TargetType.USER);
if (map2 != null) {
ModelAuditLogEntry.Options options2 = modelAuditLogEntry.getOptions();
obj = (CharSequence) map2.get(options2 != null ? Long.valueOf(options2.getId()) : null);
key = change.getKey();
if (key != null) {
int hashCode = key.hashCode();
if (hashCode != 3079692) {
if (hashCode != 92906313) {
if (hashCode == 108404047 && key.equals("reset")) {
Resources resources = context.getResources();
m.checkNotNullExpressionValue(resources, "context.resources");
obj2 = b.g(context, 2131889420, new Object[]{StringResourceUtilsKt.getQuantityString(resources, context, 2131755141, collection.size(), Integer.valueOf(collection.size())), obj}, null, 4);
}
} else if (key.equals("allow")) {
Resources resources2 = context.getResources();
m.checkNotNullExpressionValue(resources2, "context.resources");
obj2 = b.g(context, 2131889419, new Object[]{StringResourceUtilsKt.getQuantityString(resources2, context, 2131755140, collection.size(), Integer.valueOf(collection.size())), obj}, null, 4);
}
} else if (key.equals("deny")) {
Resources resources3 = context.getResources();
m.checkNotNullExpressionValue(resources3, "context.resources");
obj2 = b.g(context, 2131889418, new Object[]{StringResourceUtilsKt.getQuantityString(resources3, context, 2131755139, collection.size(), Integer.valueOf(collection.size())), obj}, null, 4);
}
}
return obj2.toString();
}
} else if (valueOf != null && valueOf.intValue() == 0) {
ModelAuditLogEntry.Options options3 = modelAuditLogEntry.getOptions();
if (options3 != null) {
obj = options3.getRoleName();
key = change.getKey();
if (key != null) {
}
return obj2.toString();
}
} else {
obj = obj2;
key = change.getKey();
if (key != null) {
}
return obj2.toString();
}
obj = null;
key = change.getKey();
if (key != null) {
}
return obj2.toString();
}
private final CharSequence getPluralString(Context context, ModelAuditLogEntry.Change change) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.collections.Collection<*>");
Collection collection = (Collection) value;
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case 1168893:
if (key.equals("$add")) {
Resources resources = context.getResources();
m.checkNotNullExpressionValue(resources, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources, context, 2131755149, collection.size(), Integer.valueOf(collection.size()));
}
break;
case 3079692:
if (key.equals("deny")) {
Resources resources2 = context.getResources();
m.checkNotNullExpressionValue(resources2, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources2, context, 2131755139, collection.size(), Integer.valueOf(collection.size()));
}
break;
case 92906313:
if (key.equals("allow")) {
Resources resources3 = context.getResources();
m.checkNotNullExpressionValue(resources3, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources3, context, 2131755140, collection.size(), Integer.valueOf(collection.size()));
}
break;
case 950750632:
if (key.equals("$remove")) {
Resources resources4 = context.getResources();
m.checkNotNullExpressionValue(resources4, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources4, context, 2131755150, collection.size(), Integer.valueOf(collection.size()));
}
break;
}
}
return "";
}
@StringRes
private final int getRoleChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -934964668:
if (key.equals("reason")) {
return 2131889441;
}
break;
case 3079692:
if (key.equals("deny")) {
return 2131889538;
}
break;
case 3373707:
if (key.equals("name")) {
return getNullableOldValueString(change, 2131889537, 2131889536);
}
break;
case 64859716:
if (key.equals("mentionable")) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value).booleanValue();
if (booleanValue) {
return 2131889535;
}
if (!booleanValue) {
return 2131889534;
}
throw new NoWhenBranchMatchedException();
}
break;
case 92906313:
if (key.equals("allow")) {
return 2131889539;
}
break;
case 94842723:
if (key.equals("color")) {
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Long");
return ((Long) value2).longValue() == 0 ? 2131889529 : 2131889527;
}
break;
case 99457571:
if (key.equals("hoist")) {
Object value3 = change.getValue();
Objects.requireNonNull(value3, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue2 = ((Boolean) value3).booleanValue();
if (booleanValue2) {
return 2131889533;
}
if (!booleanValue2) {
return 2131889532;
}
throw new NoWhenBranchMatchedException();
}
break;
}
}
return 0;
}
@StringRes
private final int getStageInstanceChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key == null) {
return 0;
}
int hashCode = key.hashCode();
if (hashCode != 110546223) {
if (hashCode != 1965579277 || !key.equals("privacy_level")) {
return 0;
}
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
int longValue = (int) ((Long) value).longValue();
if (longValue == StageInstancePrivacyLevel.GUILD_ONLY.getApiValue()) {
return 2131889556;
}
return longValue == StageInstancePrivacyLevel.PUBLIC.getApiValue() ? 2131889557 : 0;
} else if (key.equals("topic")) {
return getNullableOldValueString(change, 2131889432, 2131889430);
} else {
return 0;
}
}
@StringRes
private final int getStringForPermission(long j, ModelAuditLogEntry modelAuditLogEntry) {
if (j == 1) {
return 2131887912;
}
if (j == 2) {
return 2131890827;
}
if (j == 4) {
return 2131886816;
}
if (j == 8) {
return 2131886301;
}
if (j == 16) {
return (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL || modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE) ? 2131890977 : 2131890979;
}
if (j == 32) {
return 2131890993;
}
if (j == 524288) {
return 2131894620;
}
if (j == 67108864) {
return 2131887246;
}
if (j == 134217728) {
return 2131890987;
}
if (j == 268435456) {
return 2131890991;
}
if (j == 536870912) {
return 2131890998;
}
if (j == 1073741824) {
return 2131890982;
}
if (j == 8589934592L) {
return 2131890983;
}
if (j == 128) {
return 2131894616;
}
if (j == 1024) {
return 2131892602;
}
if (j == 2048) {
return 2131893243;
}
if (j == 4096) {
return 2131893245;
}
if (j == 8192) {
return 2131890984;
}
if (j == 16384) {
return 2131888226;
}
if (j == 32768) {
return 2131886721;
}
if (j == 65536) {
return 2131892601;
}
if (j == 131072) {
return 2131891214;
}
if (j == 262144) {
return 2131894257;
}
if (j == 64) {
return 2131886291;
}
if (j == 1048576) {
return 2131887501;
}
if (j == 2097152) {
return 2131893378;
}
if (j == 4194304) {
return 2131891376;
}
if (j == 8388608) {
return 2131888041;
}
if (j == 16777216) {
return 2131891324;
}
if (j == 33554432) {
return 2131894264;
}
if (j == 256) {
return 2131892448;
}
if (j == 512) {
return 2131894591;
}
if (j == 2147483648L) {
return 2131894253;
}
return j == 4294967296L ? 2131892698 : 0;
}
private final CharSequence getStringForVideoQualityMode(MediaSinkWantsManager.VideoQualityMode videoQualityMode, Context context) {
int ordinal = videoQualityMode.ordinal();
if (ordinal == 0) {
return b.g(context, 2131894601, new Object[0], null, 4);
}
if (ordinal == 1) {
return b.g(context, 2131894602, new Object[0], null, 4);
}
throw new NoWhenBranchMatchedException();
}
private final int getTextColor(Context context, ModelAuditLogEntry modelAuditLogEntry) {
ModelAuditLogEntry.ActionType actionType = modelAuditLogEntry.getActionType();
if (actionType != null) {
int ordinal = actionType.ordinal();
if (ordinal == 1) {
return ColorCompat.getColor(context, 2131100243);
}
if (ordinal == 2) {
return ColorCompat.getColor(context, 2131100348);
}
if (ordinal == 3) {
return ColorCompat.getColor(context, 2131100321);
}
}
return ColorCompat.getColor(context, 2131100121);
}
@StringRes
private final int getUserChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1919744682:
if (key.equals("prune_delete_days")) {
return 2131889518;
}
break;
case -934964668:
if (key.equals("reason")) {
return 2131889441;
}
break;
case 1168893:
if (key.equals("$add")) {
return 2131889520;
}
break;
case 3079270:
if (key.equals("deaf")) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value).booleanValue();
if (booleanValue) {
return 2131889508;
}
if (!booleanValue) {
return 2131889507;
}
throw new NoWhenBranchMatchedException();
}
break;
case 3363353:
if (key.equals("mute")) {
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue2 = ((Boolean) value2).booleanValue();
if (booleanValue2) {
return 2131889513;
}
if (!booleanValue2) {
return 2131889512;
}
throw new NoWhenBranchMatchedException();
}
break;
case 3381091:
if (key.equals("nick")) {
return getNullableNewOrOldValueString$default(this, change, 2131889514, 2131889515, 2131889516, null, 8, null);
}
break;
case 950750632:
if (key.equals("$remove")) {
return 2131889521;
}
break;
}
}
return 0;
}
@StringRes
private final int getWebhookChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1930808873:
if (key.equals("channel_id")) {
return getNullableOldValueString(change, 2131889563, 2131889562);
}
break;
case -934964668:
if (key.equals("reason")) {
return 2131889441;
}
break;
case 3373707:
if (key.equals("name")) {
return getNullableOldValueString(change, 2131889567, 2131889566);
}
break;
case 396929076:
if (key.equals("avatar_hash")) {
return 2131889561;
}
break;
}
}
return 0;
}
private final boolean hasNewValue(ModelAuditLogEntry.Change change, String str) {
return change.getNewValue() != null && m.areEqual(change.getKey(), str);
}
private final String renderPermissionList(ModelAuditLogEntry.Change change, ModelAuditLogEntry modelAuditLogEntry, Context context) {
Object value = change.getValue();
if (!(value instanceof Set)) {
value = null;
}
Set set = (Set) value;
return set != null ? q.joinToString$default(q.filterNot(q.map(q.filter(q.mapNotNull(q.sorted(u.asSequence(set)), new AuditLogChangeUtils$renderPermissionList$1(modelAuditLogEntry)), AuditLogChangeUtils$renderPermissionList$2.INSTANCE), new AuditLogChangeUtils$renderPermissionList$3(context)), AuditLogChangeUtils$renderPermissionList$4.INSTANCE), null, null, null, 0, null, null, 63, null) : "";
}
private final String renderPermissions(ModelAuditLogEntry.Change change, ModelAuditLogEntry modelAuditLogEntry, Context context, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, ? extends CharSequence>> map) {
return getOverridesPluralString(context, change, modelAuditLogEntry, map) + "\n" + renderPermissionList(change, modelAuditLogEntry, context);
}
private final String renderRoles(Context context, ModelAuditLogEntry.Change change) {
String str = getPluralString(context, change).toString() + "\n";
Object newValue = change.getNewValue();
Objects.requireNonNull(newValue, "null cannot be cast to non-null type kotlin.collections.List<com.discord.models.domain.ModelAuditLogEntry.ChangeNameId>");
boolean z2 = false;
for (ModelAuditLogEntry.ChangeNameId changeNameId : (List) newValue) {
if (z2) {
str = a.u(str, ", ");
} else {
z2 = true;
}
StringBuilder L = a.L(str);
L.append(changeNameId.getName());
str = L.toString();
}
return str;
}
private final boolean shouldNotRenderChange(ModelAuditLogEntry modelAuditLogEntry, ModelAuditLogEntry.Change change) {
String key;
if (modelAuditLogEntry.getActionType() != ModelAuditLogEntry.ActionType.DELETE || RENDERABLE_DELETE_ACTION_TYPES.contains(Integer.valueOf(modelAuditLogEntry.getActionTypeId()))) {
if (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL) {
String key2 = change.getKey();
if (key2 == null) {
return false;
}
int hashCode = key2.hashCode();
if (hashCode != 3355) {
if (hashCode != 852040376 || !key2.equals("permission_overwrites")) {
return false;
}
} else if (!key2.equals("id")) {
return false;
}
} else if (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE) {
String key3 = change.getKey();
if (key3 == null) {
return false;
}
int hashCode2 = key3.hashCode();
if (hashCode2 != 3355) {
if (hashCode2 != 3575610) {
if (hashCode2 != 852040376 || !key3.equals("permission_overwrites")) {
return false;
}
} else if (!key3.equals("type")) {
return false;
}
} else if (!key3.equals("id")) {
return false;
}
} else if (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.INVITE) {
String key4 = change.getKey();
if (key4 == null) {
return false;
}
int hashCode3 = key4.hashCode();
if (hashCode3 != 3599308) {
if (hashCode3 != 1198966417 || !key4.equals("inviter_id")) {
return false;
}
} else if (!key4.equals("uses")) {
return false;
}
} else if (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.WEBHOOK) {
String key5 = change.getKey();
if (key5 == null) {
return false;
}
int hashCode4 = key5.hashCode();
if (hashCode4 != -1287148950) {
if (hashCode4 != 3575610 || !key5.equals("type")) {
return false;
}
} else if (!key5.equals("application_id")) {
return false;
}
} else if (modelAuditLogEntry.getTargetType() != ModelAuditLogEntry.TargetType.INTEGRATION || (key = change.getKey()) == null || key.hashCode() != 3575610 || !key.equals("type")) {
return false;
}
}
return true;
}
/* JADX WARNING: Removed duplicated region for block: B:45:0x0172 A[SYNTHETIC] */
/* JADX WARNING: Removed duplicated region for block: B:46:0x0096 A[SYNTHETIC] */
public final CharSequence getChangeSummary(Context context, ModelAuditLogEntry modelAuditLogEntry, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, ? extends CharSequence>> map) {
int i;
int ordinal;
int i2;
m.checkNotNullParameter(context, "context");
m.checkNotNullParameter(modelAuditLogEntry, "auditLogEntry");
m.checkNotNullParameter(map, "targets");
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
Typeface create = Typeface.create(FontUtils.INSTANCE.getThemedFont(context, 2130969323), 0);
List<ModelAuditLogEntry.Change> changes = modelAuditLogEntry.getChanges();
if (changes != null) {
int i3 = 0;
for (ModelAuditLogEntry.Change change : changes) {
AuditLogChangeUtils auditLogChangeUtils = INSTANCE;
m.checkNotNullExpressionValue(change, "change");
if (!auditLogChangeUtils.shouldNotRenderChange(modelAuditLogEntry, change)) {
ModelAuditLogEntry.TargetType targetType = modelAuditLogEntry.getTargetType();
if (!(targetType == null || (ordinal = targetType.ordinal()) == 0)) {
switch (ordinal) {
case 2:
i2 = auditLogChangeUtils.getGuildChangeString(change);
i = i2;
break;
case 3:
case 4:
i2 = auditLogChangeUtils.getChannelChangeString(change);
i = i2;
break;
case 5:
i2 = auditLogChangeUtils.getUserChangeString(change);
i = i2;
break;
case 6:
i2 = auditLogChangeUtils.getRoleChangeString(change);
i = i2;
break;
case 7:
i2 = auditLogChangeUtils.getInviteChangeString(change);
i = i2;
break;
case 8:
i2 = auditLogChangeUtils.getWebhookChangeString(change);
i = i2;
break;
case 9:
i2 = auditLogChangeUtils.getEmojiChangeString(change);
i = i2;
break;
case 10:
i2 = auditLogChangeUtils.getIntegrationChangeString(change);
i = i2;
break;
case 11:
i2 = auditLogChangeUtils.getStageInstanceChangeString(change);
i = i2;
break;
case 12:
i2 = auditLogChangeUtils.getGuildScheduledEventChangeString(change);
i = i2;
break;
}
if (i == 0) {
int i4 = i3 + 1;
if (i4 != 1) {
spannableStringBuilder.append((CharSequence) "\n");
}
int max = Math.max(spannableStringBuilder.length() - 1, 0);
spannableStringBuilder.append((CharSequence) (auditLogChangeUtils.getChangeNumberString(i4) + ""));
int length = spannableStringBuilder.length() - 1;
spannableStringBuilder.setSpan(new ForegroundColorSpan(auditLogChangeUtils.getTextColor(context, modelAuditLogEntry)), max, length, 33);
m.checkNotNullExpressionValue(create, "numberTypeface");
spannableStringBuilder.setSpan(new TypefaceSpanCompat(create), max, length, 33);
Long l = null;
spannableStringBuilder.append(b.k(auditLogChangeUtils.getChangeTextWithParams(context, modelAuditLogEntry, change, i, map), new Object[0], null, 2));
if (m.areEqual(change.getKey(), "color") && change.getValue() != null) {
Object value = change.getValue();
if (value instanceof Long) {
l = value;
}
Long l2 = l;
if (l2 == null || l2.longValue() != 0) {
spannableStringBuilder.append((CharSequence) "");
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Long");
String format = String.format("#%06X", Arrays.copyOf(new Object[]{Integer.valueOf(16777215 & ((int) ((Long) value2).longValue()))}, 1));
m.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(format)), w.getLastIndex(spannableStringBuilder), w.getLastIndex(spannableStringBuilder) + 1, 33);
}
}
i3 = i4;
} else {
AppLog appLog = AppLog.g;
StringBuilder L = a.L("No change text for actiontype: ");
L.append(modelAuditLogEntry.getActionTypeId());
L.append(" key:");
L.append(change.getKey());
Logger.w$default(appLog, "Audit Logs", L.toString(), null, 4, null);
}
}
i = 0;
if (i == 0) {
}
}
}
}
return spannableStringBuilder;
}
public final boolean hasChangesToRender(ModelAuditLogEntry modelAuditLogEntry) {
boolean z2;
m.checkNotNullParameter(modelAuditLogEntry, "log");
List<ModelAuditLogEntry.Change> changes = modelAuditLogEntry.getChanges();
if (changes == null) {
return false;
}
if (!changes.isEmpty()) {
Iterator<T> it = changes.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ModelAuditLogEntry.Change change = (ModelAuditLogEntry.Change) it.next();
AuditLogChangeUtils auditLogChangeUtils = INSTANCE;
m.checkNotNullExpressionValue(change, "it");
if (!auditLogChangeUtils.shouldNotRenderChange(modelAuditLogEntry, change)) {
z2 = true;
break;
}
}
}
z2 = false;
return z2;
}
public final List<ModelAuditLogEntry.Change> transformPermissionChange(ModelAuditLogEntry.Change change) {
m.checkNotNullParameter(change, "change");
Pair<HashSet<Long>, HashSet<Long>> calculatePermissionChange = calculatePermissionChange(change);
ArrayList arrayList = new ArrayList();
if (!calculatePermissionChange.getFirst().isEmpty()) {
arrayList.add(new ModelAuditLogEntry.Change("allow", null, calculatePermissionChange.getFirst()));
}
if (!calculatePermissionChange.getSecond().isEmpty()) {
arrayList.add(new ModelAuditLogEntry.Change("deny", null, calculatePermissionChange.getSecond()));
}
return arrayList;
}
public final List<ModelAuditLogEntry.Change> transformPermissionOverride(ModelAuditLogEntry.Change change) {
m.checkNotNullParameter(change, "change");
Pair<HashSet<Long>, HashSet<Long>> calculatePermissionChange = calculatePermissionChange(change);
ArrayList arrayList = new ArrayList();
if (!calculatePermissionChange.getFirst().isEmpty()) {
arrayList.add(new ModelAuditLogEntry.Change(change.getKey(), null, calculatePermissionChange.getFirst()));
}
if (!calculatePermissionChange.getSecond().isEmpty()) {
arrayList.add(new ModelAuditLogEntry.Change("reset", null, calculatePermissionChange.getSecond()));
}
return arrayList;
}
}