package b4; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; /* loaded from: classes2.dex */ abstract class q { private static class b { /* renamed from: a, reason: collision with root package name */ private final b4.c f3129a; /* renamed from: b, reason: collision with root package name */ private final Set f3130b = new HashSet(); /* renamed from: c, reason: collision with root package name */ private final Set f3131c = new HashSet(); b(b4.c cVar) { this.f3129a = cVar; } void a(b bVar) { this.f3130b.add(bVar); } void b(b bVar) { this.f3131c.add(bVar); } b4.c c() { return this.f3129a; } Set d() { return this.f3130b; } boolean e() { return this.f3130b.isEmpty(); } boolean f() { return this.f3131c.isEmpty(); } void g(b bVar) { this.f3131c.remove(bVar); } } private static class c { /* renamed from: a, reason: collision with root package name */ private final e0 f3132a; /* renamed from: b, reason: collision with root package name */ private final boolean f3133b; public boolean equals(Object obj) { if (!(obj instanceof c)) { return false; } c cVar = (c) obj; return cVar.f3132a.equals(this.f3132a) && cVar.f3133b == this.f3133b; } public int hashCode() { return ((this.f3132a.hashCode() ^ 1000003) * 1000003) ^ Boolean.valueOf(this.f3133b).hashCode(); } private c(e0 e0Var, boolean z10) { this.f3132a = e0Var; this.f3133b = z10; } } static void a(List list) { Set c10 = c(list); Set b10 = b(c10); int i10 = 0; while (!b10.isEmpty()) { b bVar = (b) b10.iterator().next(); b10.remove(bVar); i10++; for (b bVar2 : bVar.d()) { bVar2.g(bVar); if (bVar2.f()) { b10.add(bVar2); } } } if (i10 == list.size()) { return; } ArrayList arrayList = new ArrayList(); for (b bVar3 : c10) { if (!bVar3.f() && !bVar3.e()) { arrayList.add(bVar3.c()); } } throw new s(arrayList); } private static Set b(Set set) { HashSet hashSet = new HashSet(); Iterator it = set.iterator(); while (it.hasNext()) { b bVar = (b) it.next(); if (bVar.f()) { hashSet.add(bVar); } } return hashSet; } private static Set c(List list) { Set set; HashMap hashMap = new HashMap(list.size()); Iterator it = list.iterator(); while (true) { if (!it.hasNext()) { Iterator it2 = hashMap.values().iterator(); while (it2.hasNext()) { for (b bVar : (Set) it2.next()) { for (r rVar : bVar.c().g()) { if (rVar.d() && (set = (Set) hashMap.get(new c(rVar.b(), rVar.f()))) != null) { for (b bVar2 : set) { bVar.a(bVar2); bVar2.b(bVar); } } } } } HashSet hashSet = new HashSet(); Iterator it3 = hashMap.values().iterator(); while (it3.hasNext()) { hashSet.addAll((Set) it3.next()); } return hashSet; } b4.c cVar = (b4.c) it.next(); b bVar3 = new b(cVar); for (e0 e0Var : cVar.j()) { c cVar2 = new c(e0Var, !cVar.p()); if (!hashMap.containsKey(cVar2)) { hashMap.put(cVar2, new HashSet()); } Set set2 = (Set) hashMap.get(cVar2); if (!set2.isEmpty() && !cVar2.f3133b) { throw new IllegalArgumentException(String.format("Multiple components provide %s.", e0Var)); } set2.add(bVar3); } } } }