package o; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; import java.util.Comparator; import o.C13395fZS; /* loaded from: classes.dex */ public final class ggQ { private static final AbstractC15071ggL a; private static final int e = d(Throwable.class, -1); static { C15129ghr c15129ghr; try { c15129ghr = C15072ggP.d() ? C15129ghr.a : ggH.a; } catch (Throwable unused) { c15129ghr = C15129ghr.a; } a = c15129ghr; } /* JADX WARN: Multi-variable type inference failed */ public static final E a(E e2) { Object a2; if (e2 instanceof InterfaceC15002geR) { try { C13395fZS.IeS ieS = C13395fZS.b; a2 = C13395fZS.a(((InterfaceC15002geR) e2).a()); } catch (Throwable th) { C13395fZS.IeS ieS2 = C13395fZS.b; C14957gcv.e(th, ""); a2 = C13395fZS.a(new C13395fZS.LWm(th)); } if (C13395fZS.e(a2)) { a2 = null; } return (E) a2; } return (E) a.e(e2.getClass()).invoke(e2); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class HBt extends AbstractC14961gcz implements InterfaceC14894gbR { public static final HBt a = new HBt(); @Override // o.InterfaceC14894gbR public final /* bridge */ /* synthetic */ Object invoke(Object obj) { return null; } HBt() { super(1); } } /* loaded from: classes.dex */ public static final class IeS extends AbstractC14961gcz implements InterfaceC14894gbR { private Constructor c; /* JADX INFO: Access modifiers changed from: private */ @Override // o.InterfaceC14894gbR /* renamed from: e, reason: merged with bridge method [inline-methods] */ public Throwable invoke(Throwable th) { Object a; Object newInstance; try { C13395fZS.IeS ieS = C13395fZS.b; newInstance = this.c.newInstance(th.getMessage(), th); } catch (Throwable th2) { C13395fZS.IeS ieS2 = C13395fZS.b; C14957gcv.e(th2, ""); a = C13395fZS.a(new C13395fZS.LWm(th2)); } if (newInstance == null) { throw new NullPointerException("null cannot be cast to non-null type kotlin.Throwable"); } a = C13395fZS.a((Throwable) newInstance); if (C13395fZS.e(a)) { a = null; } return (Throwable) a; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public IeS(Constructor constructor) { super(1); this.c = constructor; } } /* loaded from: classes.dex */ public static final class LWm extends AbstractC14961gcz implements InterfaceC14894gbR { private Constructor b; /* JADX INFO: Access modifiers changed from: private */ @Override // o.InterfaceC14894gbR /* renamed from: e, reason: merged with bridge method [inline-methods] */ public Throwable invoke(Throwable th) { Object a; Object newInstance; try { C13395fZS.IeS ieS = C13395fZS.b; newInstance = this.b.newInstance(th.getMessage()); } catch (Throwable th2) { C13395fZS.IeS ieS2 = C13395fZS.b; C14957gcv.e(th2, ""); a = C13395fZS.a(new C13395fZS.LWm(th2)); } if (newInstance == null) { throw new NullPointerException("null cannot be cast to non-null type kotlin.Throwable"); } Throwable th3 = (Throwable) newInstance; th3.initCause(th); a = C13395fZS.a(th3); if (C13395fZS.e(a)) { a = null; } return (Throwable) a; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public LWm(Constructor constructor) { super(1); this.b = constructor; } } /* loaded from: classes.dex */ public static final class RVV extends AbstractC14961gcz implements InterfaceC14894gbR { private Constructor d; /* JADX INFO: Access modifiers changed from: private */ @Override // o.InterfaceC14894gbR /* renamed from: b, reason: merged with bridge method [inline-methods] */ public Throwable invoke(Throwable th) { Object a; Object newInstance; try { C13395fZS.IeS ieS = C13395fZS.b; newInstance = this.d.newInstance(th); } catch (Throwable th2) { C13395fZS.IeS ieS2 = C13395fZS.b; C14957gcv.e(th2, ""); a = C13395fZS.a(new C13395fZS.LWm(th2)); } if (newInstance == null) { throw new NullPointerException("null cannot be cast to non-null type kotlin.Throwable"); } a = C13395fZS.a((Throwable) newInstance); if (C13395fZS.e(a)) { a = null; } return (Throwable) a; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public RVV(Constructor constructor) { super(1); this.d = constructor; } } /* loaded from: classes.dex */ public static final class tOB extends AbstractC14961gcz implements InterfaceC14894gbR { private Constructor d; /* JADX INFO: Access modifiers changed from: private */ @Override // o.InterfaceC14894gbR /* renamed from: d, reason: merged with bridge method [inline-methods] */ public Throwable invoke(Throwable th) { Object a; Object newInstance; try { C13395fZS.IeS ieS = C13395fZS.b; newInstance = this.d.newInstance(new Object[0]); } catch (Throwable th2) { C13395fZS.IeS ieS2 = C13395fZS.b; C14957gcv.e(th2, ""); a = C13395fZS.a(new C13395fZS.LWm(th2)); } if (newInstance == null) { throw new NullPointerException("null cannot be cast to non-null type kotlin.Throwable"); } Throwable th3 = (Throwable) newInstance; th3.initCause(th); a = C13395fZS.a(th3); if (C13395fZS.e(a)) { a = null; } return (Throwable) a; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public tOB(Constructor constructor) { super(1); this.d = constructor; } } private static final int d(Class cls, int i) { Object a2; C14957gcv.e(cls, ""); C14929gcJ.c(cls); try { C13395fZS.IeS ieS = C13395fZS.b; int i2 = 0; do { int length = cls.getDeclaredFields().length; int i3 = 0; for (int i4 = 0; i4 < length; i4++) { if (!Modifier.isStatic(r3[i4].getModifiers())) { i3++; } } i2 += i3; cls = cls.getSuperclass(); } while (cls != null); a2 = C13395fZS.a(Integer.valueOf(i2)); } catch (Throwable th) { C13395fZS.IeS ieS2 = C13395fZS.b; C14957gcv.e(th, ""); a2 = C13395fZS.a(new C13395fZS.LWm(th)); } if (C13395fZS.e(a2)) { a2 = Integer.valueOf(i); } return ((Number) a2).intValue(); } /* loaded from: classes.dex */ public static final class Sts implements Comparator { /* JADX WARN: Multi-variable type inference failed */ @Override // java.util.Comparator public final int compare(T t, T t2) { Integer valueOf = Integer.valueOf(((Constructor) t2).getParameterTypes().length); Integer valueOf2 = Integer.valueOf(((Constructor) t).getParameterTypes().length); if (valueOf == valueOf2) { return 0; } if (valueOf == null) { return -1; } if (valueOf2 == null) { return 1; } return valueOf.compareTo(valueOf2); } } /* JADX WARN: Code restructure failed: missing block: B:25:0x00b1, code lost: return r6; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static final /* synthetic */ o.InterfaceC14894gbR d(java.lang.Class r8) { /* o.ggQ$HBt r0 = o.ggQ.HBt.a o.gbR r0 = (o.InterfaceC14894gbR) r0 int r1 = o.ggQ.e r2 = 0 int r3 = d(r8, r2) if (r1 != r3) goto Lb2 java.lang.reflect.Constructor[] r8 = r8.getConstructors() o.ggQ$Sts r1 = new o.ggQ$Sts r1.() java.util.Comparator r1 = (java.util.Comparator) r1 java.lang.String r3 = "" o.C14957gcv.e(r8, r3) o.C14957gcv.e(r1, r3) o.C14957gcv.e(r8, r3) o.C14957gcv.e(r1, r3) int r4 = r8.length r5 = 1 if (r4 == 0) goto L3e int r4 = r8.length java.lang.Object[] r8 = java.util.Arrays.copyOf(r8, r4) o.C14957gcv.c(r8, r3) o.C14957gcv.e(r8, r3) o.C14957gcv.e(r1, r3) int r4 = r8.length if (r4 <= r5) goto L3e java.util.Arrays.sort(r8, r1) L3e: o.C14957gcv.e(r8, r3) java.util.List r8 = java.util.Arrays.asList(r8) o.C14957gcv.c(r8, r3) java.util.Iterator r8 = r8.iterator() L4c: boolean r1 = r8.hasNext() if (r1 == 0) goto Lb2 java.lang.Object r1 = r8.next() java.lang.reflect.Constructor r1 = (java.lang.reflect.Constructor) r1 java.lang.Class[] r3 = r1.getParameterTypes() int r4 = r3.length if (r4 == 0) goto La7 r6 = 0 if (r4 == r5) goto L83 r7 = 2 if (r4 == r7) goto L66 goto Laf L66: r4 = r3[r2] java.lang.Class r7 = java.lang.String.class boolean r4 = o.C14957gcv.b(r4, r7) if (r4 == 0) goto Laf r3 = r3[r5] java.lang.Class r4 = java.lang.Throwable.class boolean r3 = o.C14957gcv.b(r3, r4) if (r3 == 0) goto Laf o.ggQ$IeS r3 = new o.ggQ$IeS r3.(r1) r6 = r3 o.gbR r6 = (o.InterfaceC14894gbR) r6 goto Laf L83: r3 = r3[r2] java.lang.Class r4 = java.lang.Throwable.class boolean r4 = o.C14957gcv.b(r3, r4) if (r4 == 0) goto L96 o.ggQ$RVV r3 = new o.ggQ$RVV r3.(r1) r6 = r3 o.gbR r6 = (o.InterfaceC14894gbR) r6 goto Laf L96: java.lang.Class r4 = java.lang.String.class boolean r3 = o.C14957gcv.b(r3, r4) if (r3 == 0) goto Laf o.ggQ$LWm r3 = new o.ggQ$LWm r3.(r1) r6 = r3 o.gbR r6 = (o.InterfaceC14894gbR) r6 goto Laf La7: o.ggQ$tOB r3 = new o.ggQ$tOB r3.(r1) r6 = r3 o.gbR r6 = (o.InterfaceC14894gbR) r6 Laf: if (r6 == 0) goto L4c return r6 Lb2: return r0 */ throw new UnsupportedOperationException("Method not decompiled: o.ggQ.d(java.lang.Class):o.gbR"); } }