package o; import com.airbnb.deeplinkdispatch.UrlTreeKt; import com.google.android.gms.measurement.api.AppMeasurementSdk; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeSet; import o.AbstractC16345ndh; import o.Xkw; /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.cox, reason: case insensitive filesystem */ /* loaded from: classes2.dex */ public final class C7474cox { C7474cox() { } /* JADX INFO: Access modifiers changed from: package-private */ public static void b(vAr var, StringBuilder sb, int i) { HashMap hashMap = new HashMap(); HashMap hashMap2 = new HashMap(); TreeSet treeSet = new TreeSet(); for (Method method : var.getClass().getDeclaredMethods()) { hashMap2.put(method.getName(), method); if (method.getParameterTypes().length == 0) { hashMap.put(method.getName(), method); if (method.getName().startsWith("get")) { treeSet.add(method.getName()); } } } for (String str : treeSet) { String substring = str.startsWith("get") ? str.substring(3) : str; if (substring.endsWith("List") && !substring.endsWith("OrBuilderList") && !substring.equals("List")) { StringBuilder sb2 = new StringBuilder(); sb2.append(substring.substring(0, 1).toLowerCase()); sb2.append(substring.substring(1, substring.length() - 4)); String obj = sb2.toString(); Method method2 = (Method) hashMap.get(str); if (method2 != null && method2.getReturnType().equals(List.class)) { c(sb, i, b(obj), AbstractC16345ndh.a(method2, var, new Object[0])); } } if (substring.endsWith("Map") && !substring.equals("Map")) { StringBuilder sb3 = new StringBuilder(); sb3.append(substring.substring(0, 1).toLowerCase()); sb3.append(substring.substring(1, substring.length() - 3)); String obj2 = sb3.toString(); Method method3 = (Method) hashMap.get(str); if (method3 != null && method3.getReturnType().equals(Map.class) && !method3.isAnnotationPresent(Deprecated.class) && Modifier.isPublic(method3.getModifiers())) { c(sb, i, b(obj2), AbstractC16345ndh.a(method3, var, new Object[0])); } } if (((Method) hashMap2.get("set".concat(String.valueOf(substring)))) != null) { if (substring.endsWith("Bytes")) { StringBuilder sb4 = new StringBuilder("get"); sb4.append(substring.substring(0, substring.length() - 5)); if (!hashMap.containsKey(sb4.toString())) { } } StringBuilder sb5 = new StringBuilder(); sb5.append(substring.substring(0, 1).toLowerCase()); sb5.append(substring.substring(1)); String obj3 = sb5.toString(); Method method4 = (Method) hashMap.get("get".concat(String.valueOf(substring))); Method method5 = (Method) hashMap.get("has".concat(String.valueOf(substring))); if (method4 != null) { Object a = AbstractC16345ndh.a(method4, var, new Object[0]); if (method5 == null) { if (!a(a)) { c(sb, i, b(obj3), a); } } else if (((Boolean) AbstractC16345ndh.a(method5, var, new Object[0])).booleanValue()) { c(sb, i, b(obj3), a); } } } } if (var instanceof AbstractC16345ndh.Sts) { Iterator> c = ((AbstractC16345ndh.Sts) var).extensions.c(); while (c.hasNext()) { Map.Entry next = c.next(); StringBuilder sb6 = new StringBuilder("["); sb6.append(next.getKey().e); sb6.append("]"); c(sb, i, sb6.toString(), next.getValue()); } } AbstractC16345ndh abstractC16345ndh = (AbstractC16345ndh) var; if (abstractC16345ndh.unknownFields != null) { abstractC16345ndh.unknownFields.e(sb, i); } } private static boolean a(Object obj) { if (obj instanceof Boolean) { return !((Boolean) obj).booleanValue(); } if (obj instanceof Integer) { return ((Integer) obj).intValue() == 0; } if (obj instanceof Float) { return Float.floatToRawIntBits(((Float) obj).floatValue()) == 0; } if (obj instanceof Double) { return Double.doubleToRawLongBits(((Double) obj).doubleValue()) == 0; } if (obj instanceof String) { return obj.equals(""); } if (obj instanceof jra) { return obj.equals(jra.d); } return obj instanceof vAr ? obj == ((vAr) obj).o() : (obj instanceof Enum) && ((Enum) obj).ordinal() == 0; } /* JADX INFO: Access modifiers changed from: package-private */ public static final void c(StringBuilder sb, int i, String str, Object obj) { if (obj instanceof List) { Iterator it = ((List) obj).iterator(); while (it.hasNext()) { c(sb, i, str, it.next()); } return; } if (obj instanceof Map) { Iterator it2 = ((Map) obj).entrySet().iterator(); while (it2.hasNext()) { c(sb, i, str, (Map.Entry) it2.next()); } return; } sb.append('\n'); int i2 = 0; for (int i3 = 0; i3 < i; i3++) { sb.append(' '); } sb.append(str); if (obj instanceof String) { sb.append(": \""); sb.append(Xkw.b(new Xkw.AnonymousClass1(jra.e((String) obj)))); sb.append('\"'); return; } if (obj instanceof jra) { sb.append(": \""); sb.append(Xkw.b(new Xkw.AnonymousClass1((jra) obj))); sb.append('\"'); return; } if (obj instanceof AbstractC16345ndh) { sb.append(" {"); b((AbstractC16345ndh) obj, sb, i + 2); sb.append("\n"); while (i2 < i) { sb.append(' '); i2++; } sb.append(UrlTreeKt.componentParamSuffix); return; } if (obj instanceof Map.Entry) { sb.append(" {"); Map.Entry entry = (Map.Entry) obj; int i4 = i + 2; c(sb, i4, "key", entry.getKey()); c(sb, i4, AppMeasurementSdk.ConditionalUserProperty.VALUE, entry.getValue()); sb.append("\n"); while (i2 < i) { sb.append(' '); i2++; } sb.append(UrlTreeKt.componentParamSuffix); return; } sb.append(": "); sb.append(obj.toString()); } private static final String b(String str) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < str.length(); i++) { char charAt = str.charAt(i); if (Character.isUpperCase(charAt)) { sb.append("_"); } sb.append(Character.toLowerCase(charAt)); } return sb.toString(); } }