package com.google.android.gms.internal.firebase_ml; import com.google.android.gms.internal.firebase_ml.zzty; 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 zztw> { private static final zztw zzbln = new zztw(true); private boolean zzbll; private boolean zzblm = false; final zzwh zzblk = zzwh.zzdo(16); private zztw() { } private zztw(boolean z) { zzpt(); } public final void zzpt() { if (this.zzbll) { return; } this.zzblk.zzpt(); this.zzbll = true; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof zztw) { return this.zzblk.equals(((zztw) obj).zzblk); } return false; } public final int hashCode() { return this.zzblk.hashCode(); } public final Iterator> iterator() { if (this.zzblm) { return new zzuu(this.zzblk.entrySet().iterator()); } return this.zzblk.entrySet().iterator(); } /* JADX INFO: Access modifiers changed from: package-private */ public final Iterator> descendingIterator() { if (this.zzblm) { return new zzuu(this.zzblk.zzsz().iterator()); } return this.zzblk.zzsz().iterator(); } private final Object zza(FieldDescriptorType fielddescriptortype) { Object obj = this.zzblk.get(fielddescriptortype); return obj instanceof zzur ? zzur.zzrt() : obj; } private final void zza(FieldDescriptorType fielddescriptortype, Object obj) { if (fielddescriptortype.zzqt()) { 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.zzqr(), obj2); } obj = arrayList; } else { zza(fielddescriptortype.zzqr(), obj); } if (obj instanceof zzur) { this.zzblm = true; } this.zzblk.zza((zzwh) fielddescriptortype, (FieldDescriptorType) obj); } /* 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.firebase_ml.zzxl r1, java.lang.Object r2) { /* com.google.android.gms.internal.firebase_ml.zzug.checkNotNull(r2) int[] r0 = com.google.android.gms.internal.firebase_ml.zztx.zzblo com.google.android.gms.internal.firebase_ml.zzxq r1 = r1.zztp() 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.firebase_ml.zzvo if (r1 != 0) goto L41 boolean r1 = r2 instanceof com.google.android.gms.internal.firebase_ml.zzur 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.firebase_ml.zzuh if (r1 == 0) goto L42 goto L41 L25: boolean r1 = r2 instanceof com.google.android.gms.internal.firebase_ml.zzsw 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.firebase_ml.zztw.zza(com.google.android.gms.internal.firebase_ml.zzxl, java.lang.Object):void"); } public final boolean isInitialized() { for (int i = 0; i < this.zzblk.zzsx(); i++) { if (!zzb(this.zzblk.zzdp(i))) { return false; } } Iterator> it = this.zzblk.zzsy().iterator(); while (it.hasNext()) { if (!zzb(it.next())) { return false; } } return true; } private static boolean zzb(Map.Entry entry) { FieldDescriptorType key = entry.getKey(); if (key.zzqs() == zzxq.MESSAGE) { if (key.zzqt()) { Iterator it = ((List) entry.getValue()).iterator(); while (it.hasNext()) { if (!((zzvo) it.next()).isInitialized()) { return false; } } } else { Object value = entry.getValue(); if (value instanceof zzvo) { if (!((zzvo) value).isInitialized()) { return false; } } else { if (value instanceof zzur) { return true; } throw new IllegalArgumentException("Wrong object type used with protocol message reflection."); } } } return true; } public final void zza(zztw zztwVar) { for (int i = 0; i < zztwVar.zzblk.zzsx(); i++) { zzc(zztwVar.zzblk.zzdp(i)); } Iterator> it = zztwVar.zzblk.zzsy().iterator(); while (it.hasNext()) { zzc(it.next()); } } private static Object zzr(Object obj) { if (obj instanceof zzvv) { return ((zzvv) obj).zzsk(); } 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 final void zzc(Map.Entry entry) { zzvo zzrj; FieldDescriptorType key = entry.getKey(); Object value = entry.getValue(); if (value instanceof zzur) { value = zzur.zzrt(); } if (key.zzqt()) { Object zza = zza((zztw) key); if (zza == null) { zza = new ArrayList(); } Iterator it = ((List) value).iterator(); while (it.hasNext()) { ((List) zza).add(zzr(it.next())); } this.zzblk.zza((zzwh) key, (FieldDescriptorType) zza); return; } if (key.zzqs() == zzxq.MESSAGE) { Object zza2 = zza((zztw) key); if (zza2 == null) { this.zzblk.zza((zzwh) key, (FieldDescriptorType) zzr(value)); return; } if (zza2 instanceof zzvv) { zzrj = key.zza((zzvv) zza2, (zzvv) value); } else { zzrj = key.zza(((zzvo) zza2).zzrc(), (zzvo) value).zzrj(); } this.zzblk.zza((zzwh) key, (FieldDescriptorType) zzrj); return; } this.zzblk.zza((zzwh) key, (FieldDescriptorType) zzr(value)); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(zztl zztlVar, zzxl zzxlVar, int i, Object obj) throws IOException { if (zzxlVar == zzxl.zzbtx) { zzvo zzvoVar = (zzvo) obj; zzug.zzf(zzvoVar); zztlVar.zzg(i, 3); zzvoVar.zzb(zztlVar); zztlVar.zzg(i, 4); return; } zztlVar.zzg(i, zzxlVar.zztq()); switch (zztx.zzblp[zzxlVar.ordinal()]) { case 1: zztlVar.zzc(((Double) obj).doubleValue()); return; case 2: zztlVar.zzt(((Float) obj).floatValue()); return; case 3: zztlVar.zzq(((Long) obj).longValue()); return; case 4: zztlVar.zzq(((Long) obj).longValue()); return; case 5: zztlVar.zzcq(((Integer) obj).intValue()); return; case 6: zztlVar.zzs(((Long) obj).longValue()); return; case 7: zztlVar.zzct(((Integer) obj).intValue()); return; case 8: zztlVar.zzah(((Boolean) obj).booleanValue()); return; case 9: ((zzvo) obj).zzb(zztlVar); return; case 10: zztlVar.zzb((zzvo) obj); return; case 11: if (obj instanceof zzsw) { zztlVar.zza((zzsw) obj); return; } else { zztlVar.zzco((String) obj); return; } case 12: if (obj instanceof zzsw) { zztlVar.zza((zzsw) obj); return; } else { byte[] bArr = (byte[]) obj; zztlVar.zze(bArr, 0, bArr.length); return; } case 13: zztlVar.zzcr(((Integer) obj).intValue()); return; case 14: zztlVar.zzct(((Integer) obj).intValue()); return; case 15: zztlVar.zzs(((Long) obj).longValue()); return; case 16: zztlVar.zzcs(((Integer) obj).intValue()); return; case 17: zztlVar.zzr(((Long) obj).longValue()); return; case 18: if (obj instanceof zzuh) { zztlVar.zzcq(((zzuh) obj).zzo()); return; } else { zztlVar.zzcq(((Integer) obj).intValue()); return; } default: return; } } public final int zzqq() { int i = 0; for (int i2 = 0; i2 < this.zzblk.zzsx(); i2++) { i += zzd(this.zzblk.zzdp(i2)); } Iterator> it = this.zzblk.zzsy().iterator(); while (it.hasNext()) { i += zzd(it.next()); } return i; } private static int zzd(Map.Entry entry) { FieldDescriptorType key = entry.getKey(); Object value = entry.getValue(); if (key.zzqs() == zzxq.MESSAGE && !key.zzqt() && !key.zzqu()) { if (value instanceof zzur) { return zztl.zzb(entry.getKey().zzo(), (zzur) value); } return zztl.zzb(entry.getKey().zzo(), (zzvo) value); } return zzb((zzty) key, value); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(zzxl zzxlVar, int i, Object obj) { int zzcu = zztl.zzcu(i); if (zzxlVar == zzxl.zzbtx) { zzug.zzf((zzvo) obj); zzcu <<= 1; } return zzcu + zzb(zzxlVar, obj); } private static int zzb(zzxl zzxlVar, Object obj) { switch (zztx.zzblp[zzxlVar.ordinal()]) { case 1: return zztl.zzd(((Double) obj).doubleValue()); case 2: return zztl.zzu(((Float) obj).floatValue()); case 3: return zztl.zzt(((Long) obj).longValue()); case 4: return zztl.zzu(((Long) obj).longValue()); case 5: return zztl.zzcv(((Integer) obj).intValue()); case 6: return zztl.zzw(((Long) obj).longValue()); case 7: return zztl.zzcy(((Integer) obj).intValue()); case 8: return zztl.zzai(((Boolean) obj).booleanValue()); case 9: return zztl.zzd((zzvo) obj); case 10: if (obj instanceof zzur) { return zztl.zza((zzur) obj); } return zztl.zzc((zzvo) obj); case 11: if (obj instanceof zzsw) { return zztl.zzb((zzsw) obj); } return zztl.zzcp((String) obj); case 12: if (obj instanceof zzsw) { return zztl.zzb((zzsw) obj); } return zztl.zzh((byte[]) obj); case 13: return zztl.zzcw(((Integer) obj).intValue()); case 14: return zztl.zzcz(((Integer) obj).intValue()); case 15: return zztl.zzx(((Long) obj).longValue()); case 16: return zztl.zzcx(((Integer) obj).intValue()); case 17: return zztl.zzv(((Long) obj).longValue()); case 18: if (obj instanceof zzuh) { return zztl.zzda(((zzuh) obj).zzo()); } return zztl.zzda(((Integer) obj).intValue()); default: throw new RuntimeException("There is no way to get here, but the compiler thinks otherwise."); } } public static int zzb(zzty zztyVar, Object obj) { zzxl zzqr = zztyVar.zzqr(); int zzo = zztyVar.zzo(); if (zztyVar.zzqt()) { int i = 0; if (zztyVar.zzqu()) { Iterator it = ((List) obj).iterator(); while (it.hasNext()) { i += zzb(zzqr, it.next()); } return zztl.zzcu(zzo) + i + zztl.zzdd(i); } Iterator it2 = ((List) obj).iterator(); while (it2.hasNext()) { i += zza(zzqr, zzo, it2.next()); } return i; } return zza(zzqr, zzo, obj); } public final /* synthetic */ Object clone() throws CloneNotSupportedException { zztw zztwVar = new zztw(); for (int i = 0; i < this.zzblk.zzsx(); i++) { Map.Entry zzdp = this.zzblk.zzdp(i); zztwVar.zza((zztw) zzdp.getKey(), zzdp.getValue()); } for (Map.Entry entry : this.zzblk.zzsy()) { zztwVar.zza((zztw) entry.getKey(), entry.getValue()); } zztwVar.zzblm = this.zzblm; return zztwVar; } public final boolean isImmutable() { return this.zzbll; } public static > zztw zzqp() { return zzbln; } }