package com.google.android.gms.internal.vision; import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.RandomAccess; /* loaded from: classes2.dex */ final class zzhy { private static final Class zzaaa = zzgs(); private static final zzio zzaab = zzk(false); private static final zzio zzaac = zzk(true); private static final zzio zzaad = new zziq(); public static void zzg(Class cls) { Class cls2; if (!zzfy.class.isAssignableFrom(cls) && (cls2 = zzaaa) != null && !cls2.isAssignableFrom(cls)) { throw new IllegalArgumentException("Message classes must extend GeneratedMessage or GeneratedMessageLite"); } } public static void zza(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzg(i, list, z); } public static void zzb(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzf(i, list, z); } public static void zzc(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzc(i, list, z); } public static void zzd(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzd(i, list, z); } public static void zze(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzn(i, list, z); } public static void zzf(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zze(i, list, z); } public static void zzg(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzl(i, list, z); } public static void zzh(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zza(i, list, z); } public static void zzi(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzj(i, list, z); } public static void zzj(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzm(i, list, z); } public static void zzk(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzb(i, list, z); } public static void zzl(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzk(i, list, z); } public static void zzm(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzh(i, list, z); } public static void zzn(int i, List list, zzjj zzjjVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzi(i, list, z); } public static void zza(int i, List list, zzjj zzjjVar) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zza(i, list); } public static void zzb(int i, List list, zzjj zzjjVar) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzb(i, list); } public static void zza(int i, List list, zzjj zzjjVar, zzhw zzhwVar) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zza(i, list, zzhwVar); } public static void zzb(int i, List list, zzjj zzjjVar, zzhw zzhwVar) throws IOException { if (list == null || list.isEmpty()) { return; } zzjjVar.zzb(i, list, zzhwVar); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzq(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzgt) { zzgt zzgtVar = (zzgt) list; for (int i2 = 0; i2 < size; i2++) { i += zzfe.zzh(zzgtVar.getLong(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zzfe.zzh(list.get(i3).longValue()); } } return i; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzo(int i, List list, boolean z) { if (list.size() == 0) { return 0; } return zzq(list) + (list.size() * zzfe.zzav(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzr(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzgt) { zzgt zzgtVar = (zzgt) list; for (int i2 = 0; i2 < size; i2++) { i += zzfe.zzi(zzgtVar.getLong(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zzfe.zzi(list.get(i3).longValue()); } } return i; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzp(int i, List list, boolean z) { int size = list.size(); if (size == 0) { return 0; } return zzr(list) + (size * zzfe.zzav(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzs(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzgt) { zzgt zzgtVar = (zzgt) list; for (int i2 = 0; i2 < size; i2++) { i += zzfe.zzj(zzgtVar.getLong(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zzfe.zzj(list.get(i3).longValue()); } } return i; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzq(int i, List list, boolean z) { int size = list.size(); if (size == 0) { return 0; } return zzs(list) + (size * zzfe.zzav(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzt(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzfz) { zzfz zzfzVar = (zzfz) list; for (int i2 = 0; i2 < size; i2++) { i += zzfe.zzbb(zzfzVar.getInt(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zzfe.zzbb(list.get(i3).intValue()); } } return i; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzr(int i, List list, boolean z) { int size = list.size(); if (size == 0) { return 0; } return zzt(list) + (size * zzfe.zzav(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzu(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzfz) { zzfz zzfzVar = (zzfz) list; for (int i2 = 0; i2 < size; i2++) { i += zzfe.zzaw(zzfzVar.getInt(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zzfe.zzaw(list.get(i3).intValue()); } } return i; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzs(int i, List list, boolean z) { int size = list.size(); if (size == 0) { return 0; } return zzu(list) + (size * zzfe.zzav(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzv(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzfz) { zzfz zzfzVar = (zzfz) list; for (int i2 = 0; i2 < size; i2++) { i += zzfe.zzax(zzfzVar.getInt(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zzfe.zzax(list.get(i3).intValue()); } } return i; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzt(int i, List list, boolean z) { int size = list.size(); if (size == 0) { return 0; } return zzv(list) + (size * zzfe.zzav(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzw(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzfz) { zzfz zzfzVar = (zzfz) list; for (int i2 = 0; i2 < size; i2++) { i += zzfe.zzay(zzfzVar.getInt(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zzfe.zzay(list.get(i3).intValue()); } } return i; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzu(int i, List list, boolean z) { int size = list.size(); if (size == 0) { return 0; } return zzw(list) + (size * zzfe.zzav(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzx(List list) { return list.size() << 2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzv(int i, List list, boolean z) { int size = list.size(); if (size == 0) { return 0; } return size * zzfe.zzl(i, 0); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzy(List list) { return list.size() << 3; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzw(int i, List list, boolean z) { int size = list.size(); if (size == 0) { return 0; } return size * zzfe.zzg(i, 0L); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzz(List list) { return list.size(); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzx(int i, List list, boolean z) { int size = list.size(); if (size == 0) { return 0; } return size * zzfe.zzc(i, true); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzc(int i, List list) { int zzn; int zzn2; int size = list.size(); int i2 = 0; if (size == 0) { return 0; } int zzav = zzfe.zzav(i) * size; if (list instanceof zzgo) { zzgo zzgoVar = (zzgo) list; while (i2 < size) { Object raw = zzgoVar.getRaw(i2); if (raw instanceof zzeo) { zzn2 = zzfe.zzb((zzeo) raw); } else { zzn2 = zzfe.zzn((String) raw); } zzav += zzn2; i2++; } } else { while (i2 < size) { Object obj = list.get(i2); if (obj instanceof zzeo) { zzn = zzfe.zzb((zzeo) obj); } else { zzn = zzfe.zzn((String) obj); } zzav += zzn; i2++; } } return zzav; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzc(int i, Object obj, zzhw zzhwVar) { if (obj instanceof zzgm) { return zzfe.zza(i, (zzgm) obj); } return zzfe.zzb(i, (zzhf) obj, zzhwVar); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzc(int i, List list, zzhw zzhwVar) { int zzb; int size = list.size(); if (size == 0) { return 0; } int zzav = zzfe.zzav(i) * size; for (int i2 = 0; i2 < size; i2++) { Object obj = list.get(i2); if (obj instanceof zzgm) { zzb = zzfe.zza((zzgm) obj); } else { zzb = zzfe.zzb((zzhf) obj, zzhwVar); } zzav += zzb; } return zzav; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzd(int i, List list) { int size = list.size(); if (size == 0) { return 0; } int zzav = size * zzfe.zzav(i); for (int i2 = 0; i2 < list.size(); i2++) { zzav += zzfe.zzb(list.get(i2)); } return zzav; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzd(int i, List list, zzhw zzhwVar) { int size = list.size(); if (size == 0) { return 0; } int i2 = 0; for (int i3 = 0; i3 < size; i3++) { i2 += zzfe.zzc(i, list.get(i3), zzhwVar); } return i2; } private static zzio zzk(boolean z) { try { Class zzgt = zzgt(); if (zzgt == null) { return null; } return (zzio) zzgt.getConstructor(Boolean.TYPE).newInstance(Boolean.valueOf(z)); } catch (Throwable unused) { return null; } } private static Class zzgs() { try { return Class.forName("com.google.protobuf.GeneratedMessage"); } catch (Throwable unused) { return null; } } private static Class zzgt() { try { return Class.forName("com.google.protobuf.UnknownFieldSetSchema"); } catch (Throwable unused) { return null; } } /* JADX INFO: Access modifiers changed from: package-private */ public static boolean zzd(Object obj, Object obj2) { if (obj != obj2) { return obj != null && obj.equals(obj2); } return true; } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(zzha zzhaVar, T t, T t2, long j) { zziu.zza(t, j, zzhaVar.zzb(zziu.zzp(t, j), zziu.zzp(t2, j))); } /* JADX INFO: Access modifiers changed from: package-private */ public static > void zza(zzfl zzflVar, T t, T t2) { zzfp zzc = zzflVar.zzc(t2); if (zzc.isEmpty()) { return; } zzflVar.zzd(t).zza(zzc); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(zzio zzioVar, T t, T t2) { zzioVar.zze(t, zzioVar.zzg(zzioVar.zzt(t), zzioVar.zzt(t2))); } /* JADX INFO: Access modifiers changed from: package-private */ public static UB zza(int i, List list, zzgc zzgcVar, UB ub, zzio zzioVar) { if (zzgcVar == null) { return ub; } int size = list.size(); int i2 = 0; for (int i3 = 0; i3 < size; i3++) { int intValue = list.get(i3).intValue(); if (zzgcVar.zzf(intValue) != null) { if (i3 != i2) { list.set(i2, Integer.valueOf(intValue)); } i2++; } else { ub = (UB) zza(i, intValue, ub, zzioVar); } } if (i2 != size) { list.subList(i2, size).clear(); } return ub; } /* JADX INFO: Access modifiers changed from: package-private */ public static UB zza(int i, List list, zzgd zzgdVar, UB ub, zzio zzioVar) { if (zzgdVar == null) { return ub; } if (list instanceof RandomAccess) { int size = list.size(); int i2 = 0; for (int i3 = 0; i3 < size; i3++) { int intValue = list.get(i3).intValue(); if (zzgdVar.zzh(intValue)) { if (i3 != i2) { list.set(i2, Integer.valueOf(intValue)); } i2++; } else { ub = (UB) zza(i, intValue, ub, zzioVar); } } if (i2 != size) { list.subList(i2, size).clear(); } } else { Iterator it = list.iterator(); while (it.hasNext()) { int intValue2 = it.next().intValue(); if (!zzgdVar.zzh(intValue2)) { ub = (UB) zza(i, intValue2, ub, zzioVar); it.remove(); } } } return ub; } /* JADX INFO: Access modifiers changed from: package-private */ public static UB zza(int i, int i2, UB ub, zzio zzioVar) { if (ub == null) { ub = zzioVar.zzhd(); } zzioVar.zza((zzio) ub, i, i2); return ub; } public static zzio zzgr() { return zzaad; } public static zzio zzgq() { return zzaac; } public static zzio zzgp() { return zzaab; } }