package n5;

import androidx.annotation.Nullable;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.WeakHashMap;

/* JADX INFO: loaded from: classes.dex */
public final class n {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Set f30865a = Collections.newSetFromMap(new WeakHashMap());

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final HashSet f30866b = new HashSet();

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f30867c;

    public final void a() {
        for (q5.c cVar : t5.p.c(this.f30865a)) {
            if (!cVar.j() && !cVar.g()) {
                cVar.clear();
                if (this.f30867c) {
                    this.f30866b.add(cVar);
                } else {
                    cVar.i();
                }
            }
        }
    }

    public boolean clearAndRemove(@Nullable q5.c cVar) {
        boolean z10 = true;
        if (cVar == null) {
            return true;
        }
        boolean zRemove = this.f30865a.remove(cVar);
        if (!this.f30866b.remove(cVar) && !zRemove) {
            z10 = false;
        }
        if (z10) {
            cVar.clear();
        }
        return z10;
    }

    public final String toString() {
        return super.toString() + "{numRequests=" + this.f30865a.size() + ", isPaused=" + this.f30867c + "}";
    }
}
