package com.google.android.gms.internal.clearcut; import com.google.android.gms.internal.clearcut.zzca; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class zzby> { private static final zzby zzgw = new zzby(true); private boolean zzgu; private boolean zzgv = false; private final zzei zzgt = zzei.zzaj(16); public final void zzv() { if (this.zzgu) { return; } this.zzgt.zzv(); this.zzgu = true; } public final int zzat() { int i = 0; for (int i2 = 0; i2 < this.zzgt.zzdr(); i2++) { i += zzd((Map.Entry) this.zzgt.zzak(i2)); } Iterator> it = this.zzgt.zzds().iterator(); while (it.hasNext()) { i += zzd((Map.Entry) it.next()); } return i; } public final int zzas() { int i = 0; for (int i2 = 0; i2 < this.zzgt.zzdr(); i2++) { Map.Entry zzak = this.zzgt.zzak(i2); i += zzb((zzca) zzak.getKey(), zzak.getValue()); } for (Map.Entry entry : this.zzgt.zzds()) { i += zzb((zzca) entry.getKey(), entry.getValue()); } return i; } public final void zza(zzby zzbyVar) { for (int i = 0; i < zzbyVar.zzgt.zzdr(); i++) { zzc(zzbyVar.zzgt.zzak(i)); } Iterator> it = zzbyVar.zzgt.zzds().iterator(); while (it.hasNext()) { zzc(it.next()); } } public final Iterator> iterator() { return this.zzgv ? new zzcu(this.zzgt.entrySet().iterator()) : this.zzgt.entrySet().iterator(); } public final boolean isInitialized() { for (int i = 0; i < this.zzgt.zzdr(); i++) { if (!zzb(this.zzgt.zzak(i))) { return false; } } Iterator> it = this.zzgt.zzds().iterator(); while (it.hasNext()) { if (!zzb(it.next())) { return false; } } return true; } public final boolean isImmutable() { return this.zzgu; } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean isEmpty() { return this.zzgt.isEmpty(); } public final int hashCode() { return this.zzgt.hashCode(); } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof zzby) { return this.zzgt.equals(((zzby) obj).zzgt); } return false; } /* JADX INFO: Access modifiers changed from: package-private */ public final Iterator> descendingIterator() { return this.zzgv ? new zzcu(this.zzgt.zzdt().iterator()) : this.zzgt.zzdt().iterator(); } public final /* synthetic */ Object clone() throws CloneNotSupportedException { zzby zzbyVar = new zzby(); for (int i = 0; i < this.zzgt.zzdr(); i++) { Map.Entry zzak = this.zzgt.zzak(i); zzbyVar.zza((zzby) zzak.getKey(), zzak.getValue()); } for (Map.Entry entry : this.zzgt.zzds()) { zzbyVar.zza((zzby) entry.getKey(), entry.getValue()); } zzbyVar.zzgv = this.zzgv; return zzbyVar; } private static Object zzd(Object obj) { if (obj instanceof zzdv) { return ((zzdv) obj).zzci(); } if (!(obj instanceof byte[])) { return obj; } byte[] bArr = (byte[]) obj; byte[] bArr2 = new byte[bArr.length]; System.arraycopy(bArr, 0, bArr2, 0, bArr.length); return bArr2; } private static int zzd(Map.Entry entry) { FieldDescriptorType key = entry.getKey(); Object value = entry.getValue(); if (key.zzav() != zzfq.MESSAGE || key.zzaw() || key.zzax()) { return zzb((zzca) key, value); } boolean z = value instanceof zzcr; int zzc = entry.getKey().zzc(); return z ? zzbn.zzb(zzc, (zzcr) value) : zzbn.zzd(zzc, (zzdo) value); } private final void zzc(Map.Entry entry) { FieldDescriptorType key = entry.getKey(); Object value = entry.getValue(); if (value instanceof zzcr) { value = zzcr.zzbr(); } if (key.zzaw()) { Object zza = zza((zzby) key); if (zza == null) { zza = new ArrayList(); } Iterator it = ((List) value).iterator(); while (it.hasNext()) { ((List) zza).add(zzd(it.next())); } this.zzgt.zza((zzei) key, (FieldDescriptorType) zza); return; } if (key.zzav() != zzfq.MESSAGE) { this.zzgt.zza((zzei) key, (FieldDescriptorType) zzd(value)); return; } Object zza2 = zza((zzby) key); if (zza2 == null) { this.zzgt.zza((zzei) key, (FieldDescriptorType) zzd(value)); } else { this.zzgt.zza((zzei) key, (FieldDescriptorType) (zza2 instanceof zzdv ? key.zza((zzdv) zza2, (zzdv) value) : key.zza(((zzdo) zza2).zzbc(), (zzdo) value).zzbj())); } } private static boolean zzb(Map.Entry entry) { FieldDescriptorType key = entry.getKey(); if (key.zzav() == zzfq.MESSAGE) { boolean zzaw = key.zzaw(); Object value = entry.getValue(); if (zzaw) { Iterator it = ((List) value).iterator(); while (it.hasNext()) { if (!((zzdo) it.next()).isInitialized()) { return false; } } } else { if (!(value instanceof zzdo)) { if (value instanceof zzcr) { return true; } throw new IllegalArgumentException("Wrong object type used with protocol message reflection."); } if (!((zzdo) value).isInitialized()) { return false; } } } return true; } private static int zzb(zzfl zzflVar, Object obj) { switch (zzbz.zzgq[zzflVar.ordinal()]) { case 1: return zzbn.zzb(((Double) obj).doubleValue()); case 2: return zzbn.zzb(((Float) obj).floatValue()); case 3: return zzbn.zze(((Long) obj).longValue()); case 4: return zzbn.zzf(((Long) obj).longValue()); case 5: return zzbn.zzs(((Integer) obj).intValue()); case 6: return zzbn.zzh(((Long) obj).longValue()); case 7: return zzbn.zzv(((Integer) obj).intValue()); case 8: return zzbn.zzb(((Boolean) obj).booleanValue()); case 9: return zzbn.zzd((zzdo) obj); case 10: return obj instanceof zzcr ? zzbn.zza((zzcr) obj) : zzbn.zzc((zzdo) obj); case 11: return obj instanceof zzbb ? zzbn.zzb((zzbb) obj) : zzbn.zzh((String) obj); case 12: return obj instanceof zzbb ? zzbn.zzb((zzbb) obj) : zzbn.zzd((byte[]) obj); case 13: return zzbn.zzt(((Integer) obj).intValue()); case 14: return zzbn.zzw(((Integer) obj).intValue()); case 15: return zzbn.zzi(((Long) obj).longValue()); case 16: return zzbn.zzu(((Integer) obj).intValue()); case 17: return zzbn.zzg(((Long) obj).longValue()); case 18: return obj instanceof zzcj ? zzbn.zzx(((zzcj) obj).zzc()) : zzbn.zzx(((Integer) obj).intValue()); default: throw new RuntimeException("There is no way to get here, but the compiler thinks otherwise."); } } private static int zzb(zzca zzcaVar, Object obj) { zzfl zzau = zzcaVar.zzau(); int zzc = zzcaVar.zzc(); if (!zzcaVar.zzaw()) { return zza(zzau, zzc, obj); } List list = (List) obj; int i = 0; if (zzcaVar.zzax()) { Iterator it = list.iterator(); while (it.hasNext()) { i += zzb(zzau, it.next()); } return zzbn.zzr(zzc) + i + zzbn.zzz(i); } Iterator it2 = list.iterator(); while (it2.hasNext()) { i += zza(zzau, zzc, it2.next()); } return i; } public static > zzby zzar() { return zzgw; } /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARN: Failed to find 'out' block for switch in B:2:0x000f. Please report as an issue. */ /* JADX WARN: Removed duplicated region for block: B:24:? A[RETURN, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void zza(com.google.android.gms.internal.clearcut.zzfl r1, java.lang.Object r2) { /* com.google.android.gms.internal.clearcut.zzci.checkNotNull(r2) int[] r0 = com.google.android.gms.internal.clearcut.zzbz.zzgx com.google.android.gms.internal.clearcut.zzfq r1 = r1.zzek() int r1 = r1.ordinal() r1 = r0[r1] switch(r1) { case 1: goto L3d; case 2: goto L3a; case 3: goto L37; case 4: goto L34; case 5: goto L31; case 6: goto L2e; case 7: goto L25; case 8: goto L1c; case 9: goto L13; default: goto L12; } L12: goto L42 L13: boolean r1 = r2 instanceof com.google.android.gms.internal.clearcut.zzdo if (r1 != 0) goto L41 boolean r1 = r2 instanceof com.google.android.gms.internal.clearcut.zzcr if (r1 == 0) goto L42 goto L41 L1c: boolean r1 = r2 instanceof java.lang.Integer if (r1 != 0) goto L41 boolean r1 = r2 instanceof com.google.android.gms.internal.clearcut.zzcj if (r1 == 0) goto L42 goto L41 L25: boolean r1 = r2 instanceof com.google.android.gms.internal.clearcut.zzbb if (r1 != 0) goto L41 boolean r1 = r2 instanceof byte[] if (r1 == 0) goto L42 goto L41 L2e: boolean r1 = r2 instanceof java.lang.String goto L3f L31: boolean r1 = r2 instanceof java.lang.Boolean goto L3f L34: boolean r1 = r2 instanceof java.lang.Double goto L3f L37: boolean r1 = r2 instanceof java.lang.Float goto L3f L3a: boolean r1 = r2 instanceof java.lang.Long goto L3f L3d: boolean r1 = r2 instanceof java.lang.Integer L3f: if (r1 == 0) goto L42 L41: return L42: java.lang.IllegalArgumentException r1 = new java.lang.IllegalArgumentException java.lang.String r2 = "Wrong object type used with protocol message reflection." r1.(r2) throw r1 */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.clearcut.zzby.zza(com.google.android.gms.internal.clearcut.zzfl, java.lang.Object):void"); } private final void zza(FieldDescriptorType fielddescriptortype, Object obj) { if (!fielddescriptortype.zzaw()) { zza(fielddescriptortype.zzau(), obj); } else { if (!(obj instanceof List)) { throw new IllegalArgumentException("Wrong object type used with protocol message reflection."); } ArrayList arrayList = new ArrayList(); arrayList.addAll((List) obj); int size = arrayList.size(); int i = 0; while (i < size) { Object obj2 = arrayList.get(i); i++; zza(fielddescriptortype.zzau(), obj2); } obj = arrayList; } if (obj instanceof zzcr) { this.zzgv = true; } this.zzgt.zza((zzei) fielddescriptortype, (FieldDescriptorType) obj); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(zzbn zzbnVar, zzfl zzflVar, int i, Object obj) throws IOException { if (zzflVar == zzfl.zzql) { zzdo zzdoVar = (zzdo) obj; zzci.zzf(zzdoVar); zzbnVar.zzb(i, 3); zzdoVar.zzb(zzbnVar); zzbnVar.zzb(i, 4); return; } zzbnVar.zzb(i, zzflVar.zzel()); switch (zzbz.zzgq[zzflVar.ordinal()]) { case 1: zzbnVar.zza(((Double) obj).doubleValue()); return; case 2: zzbnVar.zza(((Float) obj).floatValue()); return; case 3: zzbnVar.zzb(((Long) obj).longValue()); return; case 4: zzbnVar.zzb(((Long) obj).longValue()); return; case 5: zzbnVar.zzn(((Integer) obj).intValue()); return; case 6: zzbnVar.zzd(((Long) obj).longValue()); return; case 7: zzbnVar.zzq(((Integer) obj).intValue()); return; case 8: zzbnVar.zza(((Boolean) obj).booleanValue()); return; case 9: ((zzdo) obj).zzb(zzbnVar); return; case 10: zzbnVar.zzb((zzdo) obj); return; case 11: if (obj instanceof zzbb) { zzbnVar.zza((zzbb) obj); return; } else { zzbnVar.zzg((String) obj); return; } case 12: if (obj instanceof zzbb) { zzbnVar.zza((zzbb) obj); return; } else { byte[] bArr = (byte[]) obj; zzbnVar.zzd(bArr, 0, bArr.length); return; } case 13: zzbnVar.zzo(((Integer) obj).intValue()); return; case 14: zzbnVar.zzq(((Integer) obj).intValue()); return; case 15: zzbnVar.zzd(((Long) obj).longValue()); return; case 16: zzbnVar.zzp(((Integer) obj).intValue()); return; case 17: zzbnVar.zzc(((Long) obj).longValue()); return; case 18: if (obj instanceof zzcj) { zzbnVar.zzn(((zzcj) obj).zzc()); return; } else { zzbnVar.zzn(((Integer) obj).intValue()); return; } default: return; } } private final Object zza(FieldDescriptorType fielddescriptortype) { Object obj = this.zzgt.get(fielddescriptortype); return obj instanceof zzcr ? zzcr.zzbr() : obj; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(zzfl zzflVar, int i, Object obj) { int zzr = zzbn.zzr(i); if (zzflVar == zzfl.zzql) { zzci.zzf((zzdo) obj); zzr <<= 1; } return zzr + zzb(zzflVar, obj); } private zzby(boolean z) { zzv(); } private zzby() { } }