package o; import androidx.lifecycle.CompositeGeneratedAdaptersObserver; import androidx.lifecycle.FullLifecycleObserverAdapter; import androidx.lifecycle.ReflectiveGenericLifecycleObserver; import androidx.lifecycle.SingleGeneratedAdapterObserver; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.List; import java.util.Map; /* loaded from: classes.dex */ public final class QmX { private static Map, Integer> d = new HashMap(); private static Map, List>> e = new HashMap(); /* JADX INFO: Access modifiers changed from: package-private */ public static InterfaceC3451axm d(Object obj) { boolean z = obj instanceof InterfaceC3451axm; boolean z2 = obj instanceof InterfaceC15806ikR; if (z && z2) { return new FullLifecycleObserverAdapter((InterfaceC15806ikR) obj, (InterfaceC3451axm) obj); } if (z2) { return new FullLifecycleObserverAdapter((InterfaceC15806ikR) obj, null); } if (z) { return (InterfaceC3451axm) obj; } Class cls = obj.getClass(); if (a(cls) == 2) { List> list = e.get(cls); if (list.size() == 1) { return new SingleGeneratedAdapterObserver(d(list.get(0), obj)); } Mkc[] mkcArr = new Mkc[list.size()]; for (int i = 0; i < list.size(); i++) { mkcArr[i] = d(list.get(i), obj); } return new CompositeGeneratedAdaptersObserver(mkcArr); } return new ReflectiveGenericLifecycleObserver(obj); } private static Mkc d(Constructor constructor, Object obj) { try { return constructor.newInstance(obj); } catch (IllegalAccessException e2) { throw new RuntimeException(e2); } catch (InstantiationException e3) { throw new RuntimeException(e3); } catch (InvocationTargetException e4) { throw new RuntimeException(e4); } } private static Constructor b(Class cls) { try { Package r1 = cls.getPackage(); String canonicalName = cls.getCanonicalName(); String name = r1 != null ? r1.getName() : ""; if (!name.isEmpty()) { canonicalName = canonicalName.substring(name.length() + 1); } StringBuilder sb = new StringBuilder(); sb.append(canonicalName.replace(".", "_")); sb.append("_LifecycleAdapter"); String obj = sb.toString(); if (!name.isEmpty()) { StringBuilder sb2 = new StringBuilder(); sb2.append(name); sb2.append("."); sb2.append(obj); obj = sb2.toString(); } Constructor declaredConstructor = Class.forName(obj).getDeclaredConstructor(cls); if (!declaredConstructor.isAccessible()) { declaredConstructor.setAccessible(true); } return declaredConstructor; } catch (ClassNotFoundException unused) { return null; } catch (NoSuchMethodException e2) { throw new RuntimeException(e2); } } /* JADX WARN: Code restructure failed: missing block: B:15:0x003a, code lost: if (r3.booleanValue() == false) goto L24; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static int a(java.lang.Class r9) { /* java.util.Map, java.lang.Integer> r0 = o.QmX.d java.lang.Object r0 = r0.get(r9) java.lang.Integer r0 = (java.lang.Integer) r0 if (r0 == 0) goto Lf int r9 = r0.intValue() return r9 Lf: java.lang.String r0 = r9.getCanonicalName() r1 = 1 if (r0 == 0) goto Lb9 java.lang.reflect.Constructor r0 = b(r9) r2 = 2 if (r0 == 0) goto L29 java.util.Map, java.util.List>> r1 = o.QmX.e java.util.List r0 = java.util.Collections.singletonList(r0) r1.put(r9, r0) L26: r1 = r2 goto Lb9 L29: o.jBJ r0 = o.jBJ.d java.util.Map, java.lang.Boolean> r3 = r0.e java.lang.Object r3 = r3.get(r9) java.lang.Boolean r3 = (java.lang.Boolean) r3 r4 = 0 if (r3 == 0) goto L3d boolean r0 = r3.booleanValue() if (r0 != 0) goto Lb9 goto L5f L3d: java.lang.reflect.Method[] r3 = o.jBJ.c(r9) int r5 = r3.length r6 = r4 L43: if (r6 >= r5) goto L58 r7 = r3[r6] java.lang.Class r8 = o.RDs.class java.lang.annotation.Annotation r7 = r7.getAnnotation(r8) o.RDs r7 = (o.RDs) r7 if (r7 == 0) goto L55 r0.c(r9, r3) goto Lb9 L55: int r6 = r6 + 1 goto L43 L58: java.util.Map, java.lang.Boolean> r0 = r0.e java.lang.Boolean r3 = java.lang.Boolean.FALSE r0.put(r9, r3) L5f: java.lang.Class r0 = r9.getSuperclass() if (r0 == 0) goto L81 java.lang.Class r3 = o.InterfaceC16186lzC.class boolean r3 = r3.isAssignableFrom(r0) if (r3 == 0) goto L81 int r3 = a(r0) if (r3 == r1) goto Lb9 java.util.ArrayList r3 = new java.util.ArrayList java.util.Map, java.util.List>> r5 = o.QmX.e java.lang.Object r0 = r5.get(r0) java.util.Collection r0 = (java.util.Collection) r0 r3.(r0) goto L82 L81: r3 = 0 L82: java.lang.Class[] r0 = r9.getInterfaces() int r5 = r0.length L87: if (r4 >= r5) goto Lb0 r6 = r0[r4] if (r6 == 0) goto Lad java.lang.Class r7 = o.InterfaceC16186lzC.class boolean r7 = r7.isAssignableFrom(r6) if (r7 == 0) goto Lad int r7 = a(r6) if (r7 == r1) goto Lb9 if (r3 != 0) goto La2 java.util.ArrayList r3 = new java.util.ArrayList r3.() La2: java.util.Map, java.util.List>> r7 = o.QmX.e java.lang.Object r6 = r7.get(r6) java.util.Collection r6 = (java.util.Collection) r6 r3.addAll(r6) Lad: int r4 = r4 + 1 goto L87 Lb0: if (r3 == 0) goto Lb9 java.util.Map, java.util.List>> r0 = o.QmX.e r0.put(r9, r3) goto L26 Lb9: java.util.Map, java.lang.Integer> r0 = o.QmX.d java.lang.Integer r2 = java.lang.Integer.valueOf(r1) r0.put(r9, r2) return r1 */ throw new UnsupportedOperationException("Method not decompiled: o.QmX.a(java.lang.Class):int"); } }