package com.google.android.gms.internal.measurement; import java.io.IOException; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /* loaded from: classes.dex */ final class zzyf implements Cloneable { private zzyd a; private Object b; private List c = new ArrayList(); zzyf() { } private final byte[] b() throws IOException { byte[] bArr = new byte[a()]; a(zzya.b(bArr)); return bArr; } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: h, reason: merged with bridge method [inline-methods] */ public final zzyf clone() { zzyf zzyfVar = new zzyf(); try { zzyfVar.a = this.a; if (this.c == null) { zzyfVar.c = null; } else { zzyfVar.c.addAll(this.c); } if (this.b != null) { if (this.b instanceof zzyi) { zzyfVar.b = (zzyi) ((zzyi) this.b).clone(); } else if (this.b instanceof byte[]) { zzyfVar.b = ((byte[]) this.b).clone(); } else { int i = 0; if (this.b instanceof byte[][]) { byte[][] bArr = (byte[][]) this.b; byte[][] bArr2 = new byte[bArr.length][]; zzyfVar.b = bArr2; while (i < bArr.length) { bArr2[i] = (byte[]) bArr[i].clone(); i++; } } else if (this.b instanceof boolean[]) { zzyfVar.b = ((boolean[]) this.b).clone(); } else if (this.b instanceof int[]) { zzyfVar.b = ((int[]) this.b).clone(); } else if (this.b instanceof long[]) { zzyfVar.b = ((long[]) this.b).clone(); } else if (this.b instanceof float[]) { zzyfVar.b = ((float[]) this.b).clone(); } else if (this.b instanceof double[]) { zzyfVar.b = ((double[]) this.b).clone(); } else if (this.b instanceof zzyi[]) { zzyi[] zzyiVarArr = (zzyi[]) this.b; zzyi[] zzyiVarArr2 = new zzyi[zzyiVarArr.length]; zzyfVar.b = zzyiVarArr2; while (i < zzyiVarArr.length) { zzyiVarArr2[i] = (zzyi) zzyiVarArr[i].clone(); i++; } } } } return zzyfVar; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } } final void a(zzyk zzykVar) throws IOException { List list = this.c; if (list != null) { list.add(zzykVar); return; } Object obj = this.b; if (obj instanceof zzyi) { byte[] bArr = zzykVar.b; zzxz a = zzxz.a(bArr, 0, bArr.length); int e = a.e(); if (e != bArr.length - zzya.c(e)) { throw zzyh.zzzd(); } zzyi a2 = ((zzyi) this.b).a(a); this.a = this.a; this.b = a2; this.c = null; return; } if (obj instanceof zzyi[]) { this.a.a(Collections.singletonList(zzykVar)); throw null; } if (obj instanceof zzvv) { this.a.a(Collections.singletonList(zzykVar)); throw null; } if (obj instanceof zzvv[]) { this.a.a(Collections.singletonList(zzykVar)); throw null; } this.a.a(Collections.singletonList(zzykVar)); throw null; } public final boolean equals(Object obj) { List list; if (obj == this) { return true; } if (!(obj instanceof zzyf)) { return false; } zzyf zzyfVar = (zzyf) obj; if (this.b == null || zzyfVar.b == null) { List list2 = this.c; if (list2 != null && (list = zzyfVar.c) != null) { return list2.equals(list); } try { return Arrays.equals(b(), zzyfVar.b()); } catch (IOException e) { throw new IllegalStateException(e); } } zzyd zzydVar = this.a; if (zzydVar != zzyfVar.a) { return false; } if (!zzydVar.a.isArray()) { return this.b.equals(zzyfVar.b); } Object obj2 = this.b; return obj2 instanceof byte[] ? Arrays.equals((byte[]) obj2, (byte[]) zzyfVar.b) : obj2 instanceof int[] ? Arrays.equals((int[]) obj2, (int[]) zzyfVar.b) : obj2 instanceof long[] ? Arrays.equals((long[]) obj2, (long[]) zzyfVar.b) : obj2 instanceof float[] ? Arrays.equals((float[]) obj2, (float[]) zzyfVar.b) : obj2 instanceof double[] ? Arrays.equals((double[]) obj2, (double[]) zzyfVar.b) : obj2 instanceof boolean[] ? Arrays.equals((boolean[]) obj2, (boolean[]) zzyfVar.b) : Arrays.deepEquals((Object[]) obj2, (Object[]) zzyfVar.b); } public final int hashCode() { try { return Arrays.hashCode(b()) + 527; } catch (IOException e) { throw new IllegalStateException(e); } } final int a() { Object obj = this.b; if (obj != null) { zzyd zzydVar = this.a; if (zzydVar.b) { int length = Array.getLength(obj); for (int i = 0; i < length; i++) { Object obj2 = Array.get(obj, i); if (obj2 != null) { zzydVar.a(obj2); throw null; } } return 0; } zzydVar.a(obj); throw null; } int i2 = 0; for (zzyk zzykVar : this.c) { i2 += zzya.d(zzykVar.a) + 0 + zzykVar.b.length; } return i2; } final void a(zzya zzyaVar) throws IOException { Object obj = this.b; if (obj != null) { zzyd zzydVar = this.a; if (zzydVar.b) { int length = Array.getLength(obj); for (int i = 0; i < length; i++) { Object obj2 = Array.get(obj, i); if (obj2 != null) { zzydVar.a(obj2, zzyaVar); throw null; } } return; } zzydVar.a(obj, zzyaVar); throw null; } for (zzyk zzykVar : this.c) { zzyaVar.a(zzykVar.a); zzyaVar.a(zzykVar.b); } } }