package l6; import b6.h; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import l6.m; /* loaded from: classes2.dex */ public class p { /* renamed from: e, reason: collision with root package name */ private static final c f11681e = new c(); /* renamed from: f, reason: collision with root package name */ private static final m f11682f = new a(); /* renamed from: a, reason: collision with root package name */ private final List f11683a; /* renamed from: b, reason: collision with root package name */ private final c f11684b; /* renamed from: c, reason: collision with root package name */ private final Set f11685c; /* renamed from: d, reason: collision with root package name */ private final y.e f11686d; private static class a implements m { a() { } @Override // l6.m public boolean a(Object obj) { return false; } @Override // l6.m public m.a b(Object obj, int i10, int i11, e6.j jVar) { return null; } } private static class b { /* renamed from: a, reason: collision with root package name */ private final Class f11687a; /* renamed from: b, reason: collision with root package name */ final Class f11688b; /* renamed from: c, reason: collision with root package name */ final n f11689c; public b(Class cls, Class cls2, n nVar) { this.f11687a = cls; this.f11688b = cls2; this.f11689c = nVar; } public boolean a(Class cls) { return this.f11687a.isAssignableFrom(cls); } public boolean b(Class cls, Class cls2) { return a(cls) && this.f11688b.isAssignableFrom(cls2); } } static class c { c() { } public w a(List list, y.e eVar) { return new w(list, eVar); } } public p(y.e eVar) { this(eVar, f11681e); } private static m b() { return f11682f; } private m c(b bVar) { return (m) b7.j.d(bVar.f11689c.b(this)); } private void e(Class cls, Class cls2, n nVar, boolean z10) { b bVar = new b(cls, cls2, nVar); List list = this.f11683a; list.add(z10 ? list.size() : 0, bVar); } synchronized List a(Class cls) { ArrayList arrayList; try { arrayList = new ArrayList(); for (b bVar : this.f11683a) { if (!this.f11685c.contains(bVar) && bVar.a(cls)) { this.f11685c.add(bVar); arrayList.add(c(bVar)); this.f11685c.remove(bVar); } } } catch (Throwable th) { this.f11685c.clear(); throw th; } return arrayList; } synchronized void d(Class cls, Class cls2, n nVar) { e(cls, cls2, nVar, true); } synchronized List f(Class cls) { ArrayList arrayList; arrayList = new ArrayList(); for (b bVar : this.f11683a) { if (!arrayList.contains(bVar.f11688b) && bVar.a(cls)) { arrayList.add(bVar.f11688b); } } return arrayList; } public synchronized m g(Class cls, Class cls2) { try { ArrayList arrayList = new ArrayList(); boolean z10 = false; for (b bVar : this.f11683a) { if (this.f11685c.contains(bVar)) { z10 = true; } else if (bVar.b(cls, cls2)) { this.f11685c.add(bVar); arrayList.add(c(bVar)); this.f11685c.remove(bVar); } } if (arrayList.size() > 1) { return this.f11684b.a(arrayList, this.f11686d); } if (arrayList.size() == 1) { return (m) arrayList.get(0); } if (!z10) { throw new h.c(cls, cls2); } return b(); } catch (Throwable th) { this.f11685c.clear(); throw th; } } p(y.e eVar, c cVar) { this.f11683a = new ArrayList(); this.f11685c = new HashSet(); this.f11686d = eVar; this.f11684b = cVar; } }