package com.google.android.gms.measurement.internal; import android.os.Bundle; import com.google.android.gms.common.internal.Preconditions; import com.huawei.hms.framework.common.ContainerUtils; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicReference; import okhttp3.HttpUrl; /* loaded from: classes.dex */ public final class zzeg { protected static final AtomicReference zza = new AtomicReference<>(); protected static final AtomicReference zzb = new AtomicReference<>(); protected static final AtomicReference zzc = new AtomicReference<>(); private final zzef zzd; private static final String zzg(String str, String[] strArr, String[] strArr2, AtomicReference atomicReference) { String str2; Preconditions.checkNotNull(strArr); Preconditions.checkNotNull(strArr2); Preconditions.checkNotNull(atomicReference); Preconditions.checkArgument(strArr.length == strArr2.length); for (int i = 0; i < strArr.length; i++) { if (zzkz.zzak(str, strArr[i])) { synchronized (atomicReference) { String[] strArr3 = atomicReference.get(); if (strArr3 == null) { strArr3 = new String[strArr2.length]; atomicReference.set(strArr3); } str2 = strArr3[i]; if (str2 == null) { str2 = strArr2[i] + "(" + strArr[i] + ")"; strArr3[i] = str2; } } return str2; } } return str; } protected final String zza(Object[] objArr) { String valueOf; if (objArr == null) { return HttpUrl.PATH_SEGMENT_ENCODE_SET_URI; } StringBuilder sb = new StringBuilder(); sb.append("["); for (Object obj : objArr) { if (obj instanceof Bundle) { valueOf = zzb((Bundle) obj); } else { valueOf = String.valueOf(obj); } if (valueOf != null) { if (sb.length() != 1) { sb.append(", "); } sb.append(valueOf); } } sb.append("]"); return sb.toString(); } /* JADX INFO: Access modifiers changed from: protected */ public final String zzb(Bundle bundle) { String valueOf; if (bundle == null) { return null; } if (!this.zzd.zza()) { return bundle.toString(); } StringBuilder sb = new StringBuilder(); sb.append("Bundle[{"); for (String str : bundle.keySet()) { if (sb.length() != 8) { sb.append(", "); } sb.append(zze(str)); sb.append(ContainerUtils.KEY_VALUE_DELIMITER); Object obj = bundle.get(str); if (obj instanceof Bundle) { valueOf = zza(new Object[]{obj}); } else if (obj instanceof Object[]) { valueOf = zza((Object[]) obj); } else if (obj instanceof ArrayList) { valueOf = zza(((ArrayList) obj).toArray()); } else { valueOf = String.valueOf(obj); } sb.append(valueOf); } sb.append("}]"); return sb.toString(); } /* JADX INFO: Access modifiers changed from: protected */ public final String zzc(zzat zzatVar) { String zzb2; if (!this.zzd.zza()) { return zzatVar.toString(); } StringBuilder sb = new StringBuilder("origin="); sb.append(zzatVar.zzc); sb.append(",name="); sb.append(zzd(zzatVar.zza)); sb.append(",params="); zzar zzarVar = zzatVar.zzb; if (zzarVar == null) { zzb2 = null; } else if (!this.zzd.zza()) { zzb2 = zzarVar.toString(); } else { zzb2 = zzb(zzarVar.zzc()); } sb.append(zzb2); return sb.toString(); } /* JADX INFO: Access modifiers changed from: protected */ public final String zzd(String str) { if (str == null) { return null; } return !this.zzd.zza() ? str : zzg(str, zzgs.zzc, zzgs.zza, zza); } /* JADX INFO: Access modifiers changed from: protected */ public final String zze(String str) { if (str == null) { return null; } return !this.zzd.zza() ? str : zzg(str, zzgt.zzb, zzgt.zza, zzb); } /* JADX INFO: Access modifiers changed from: protected */ public final String zzf(String str) { if (str == null) { return null; } if (!this.zzd.zza()) { return str; } if (str.startsWith("_exp_")) { return "experiment_id(" + str + ")"; } return zzg(str, zzgu.zzb, zzgu.zza, zzc); } public zzeg(zzef zzefVar) { this.zzd = zzefVar; } }