package com.google.android.gms.internal.firebase_ml; import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.RandomAccess; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class zzwg { private static final Class zzbru = zzsv(); private static final zzww zzbrv = zzak(false); private static final zzww zzbrw = zzak(true); private static final zzww zzbrx = new zzwy(); public static void zzl(Class cls) { Class cls2; if (!zzue.class.isAssignableFrom(cls) && (cls2 = zzbru) != null && !cls2.isAssignableFrom(cls)) { throw new IllegalArgumentException("Message classes must extend GeneratedMessage or GeneratedMessageLite"); } } public static void zza(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzg(i, list, z); } public static void zzb(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzf(i, list, z); } public static void zzc(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzc(i, list, z); } public static void zzd(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzd(i, list, z); } public static void zze(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzn(i, list, z); } public static void zzf(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zze(i, list, z); } public static void zzg(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzl(i, list, z); } public static void zzh(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zza(i, list, z); } public static void zzi(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzj(i, list, z); } public static void zzj(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzm(i, list, z); } public static void zzk(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzb(i, list, z); } public static void zzl(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzk(i, list, z); } public static void zzm(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzh(i, list, z); } public static void zzn(int i, List list, zzxr zzxrVar, boolean z) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzi(i, list, z); } public static void zza(int i, List list, zzxr zzxrVar) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zza(i, list); } public static void zzb(int i, List list, zzxr zzxrVar) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzb(i, list); } public static void zza(int i, List list, zzxr zzxrVar, zzwe zzweVar) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zza(i, list, zzweVar); } public static void zzb(int i, List list, zzxr zzxrVar, zzwe zzweVar) throws IOException { if (list == null || list.isEmpty()) { return; } zzxrVar.zzb(i, list, zzweVar); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzi(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzvc) { zzvc zzvcVar = (zzvc) list; for (int i2 = 0; i2 < size; i2++) { i += zztl.zzt(zzvcVar.getLong(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zztl.zzt(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 zzi(list) + (list.size() * zztl.zzcu(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzj(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzvc) { zzvc zzvcVar = (zzvc) list; for (int i2 = 0; i2 < size; i2++) { i += zztl.zzu(zzvcVar.getLong(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zztl.zzu(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 zzj(list) + (size * zztl.zzcu(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzk(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzvc) { zzvc zzvcVar = (zzvc) list; for (int i2 = 0; i2 < size; i2++) { i += zztl.zzv(zzvcVar.getLong(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zztl.zzv(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 zzk(list) + (size * zztl.zzcu(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzl(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzuf) { zzuf zzufVar = (zzuf) list; for (int i2 = 0; i2 < size; i2++) { i += zztl.zzda(zzufVar.getInt(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zztl.zzda(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 zzl(list) + (size * zztl.zzcu(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzm(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzuf) { zzuf zzufVar = (zzuf) list; for (int i2 = 0; i2 < size; i2++) { i += zztl.zzcv(zzufVar.getInt(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zztl.zzcv(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 zzm(list) + (size * zztl.zzcu(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzn(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzuf) { zzuf zzufVar = (zzuf) list; for (int i2 = 0; i2 < size; i2++) { i += zztl.zzcw(zzufVar.getInt(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zztl.zzcw(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 zzn(list) + (size * zztl.zzcu(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzo(List list) { int size = list.size(); int i = 0; if (size == 0) { return 0; } if (list instanceof zzuf) { zzuf zzufVar = (zzuf) list; for (int i2 = 0; i2 < size; i2++) { i += zztl.zzcx(zzufVar.getInt(i2)); } } else { for (int i3 = 0; i3 < size; i3++) { i += zztl.zzcx(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 zzo(list) + (size * zztl.zzcu(i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzp(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 * zztl.zzo(i, 0); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzq(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 * zztl.zzg(i, 0L); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzr(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 * zztl.zzc(i, true); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzc(int i, List list) { int zzcp; int zzcp2; int size = list.size(); int i2 = 0; if (size == 0) { return 0; } int zzcu = zztl.zzcu(i) * size; if (list instanceof zzux) { zzux zzuxVar = (zzux) list; while (i2 < size) { Object raw = zzuxVar.getRaw(i2); if (raw instanceof zzsw) { zzcp2 = zztl.zzb((zzsw) raw); } else { zzcp2 = zztl.zzcp((String) raw); } zzcu += zzcp2; i2++; } } else { while (i2 < size) { Object obj = list.get(i2); if (obj instanceof zzsw) { zzcp = zztl.zzb((zzsw) obj); } else { zzcp = zztl.zzcp((String) obj); } zzcu += zzcp; i2++; } } return zzcu; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzc(int i, Object obj, zzwe zzweVar) { if (obj instanceof zzuv) { return zztl.zza(i, (zzuv) obj); } return zztl.zzb(i, (zzvo) obj, zzweVar); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzc(int i, List list, zzwe zzweVar) { int zza; int size = list.size(); if (size == 0) { return 0; } int zzcu = zztl.zzcu(i) * size; for (int i2 = 0; i2 < size; i2++) { Object obj = list.get(i2); if (obj instanceof zzuv) { zza = zztl.zza((zzuv) obj); } else { zza = zztl.zza((zzvo) obj, zzweVar); } zzcu += zza; } return zzcu; } /* 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 zzcu = size * zztl.zzcu(i); for (int i2 = 0; i2 < list.size(); i2++) { zzcu += zztl.zzb(list.get(i2)); } return zzcu; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzd(int i, List list, zzwe zzweVar) { int size = list.size(); if (size == 0) { return 0; } int i2 = 0; for (int i3 = 0; i3 < size; i3++) { i2 += zztl.zzc(i, list.get(i3), zzweVar); } return i2; } private static zzww zzak(boolean z) { try { Class zzsw = zzsw(); if (zzsw == null) { return null; } return (zzww) zzsw.getConstructor(Boolean.TYPE).newInstance(Boolean.valueOf(z)); } catch (Throwable unused) { return null; } } private static Class zzsv() { try { return Class.forName("com.google.protobuf.GeneratedMessage"); } catch (Throwable unused) { return null; } } private static Class zzsw() { try { return Class.forName("com.google.protobuf.UnknownFieldSetSchema"); } catch (Throwable unused) { return null; } } /* JADX INFO: Access modifiers changed from: package-private */ public static boolean zzh(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(zzvj zzvjVar, T t, T t2, long j) { zzxc.zza(t, j, zzvjVar.zzf(zzxc.zzp(t, j), zzxc.zzp(t2, j))); } /* JADX INFO: Access modifiers changed from: package-private */ public static > void zza(zztt zzttVar, T t, T t2) { zztw zzo = zzttVar.zzo(t2); if (zzo.zzblk.isEmpty()) { return; } zzttVar.zzp(t).zza(zzo); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(zzww zzwwVar, T t, T t2) { zzwwVar.zzi(t, zzwwVar.zzk(zzwwVar.zzae(t), zzwwVar.zzae(t2))); } /* JADX INFO: Access modifiers changed from: package-private */ public static UB zza(int i, List list, zzuj zzujVar, UB ub, zzww zzwwVar) { if (zzujVar == 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 (zzujVar.zze(intValue)) { if (i3 != i2) { list.set(i2, Integer.valueOf(intValue)); } i2++; } else { ub = (UB) zza(i, intValue, ub, zzwwVar); } } if (i2 != size) { list.subList(i2, size).clear(); } } else { Iterator it = list.iterator(); while (it.hasNext()) { int intValue2 = it.next().intValue(); if (!zzujVar.zze(intValue2)) { ub = (UB) zza(i, intValue2, ub, zzwwVar); it.remove(); } } } return ub; } private static UB zza(int i, int i2, UB ub, zzww zzwwVar) { if (ub == null) { ub = zzwwVar.zztf(); } zzwwVar.zza((zzww) ub, i, i2); return ub; } public static zzww zzsu() { return zzbrx; } public static zzww zzst() { return zzbrw; } public static zzww zzss() { return zzbrv; } }