package o; import java.util.concurrent.atomic.AtomicInteger; /* loaded from: classes6.dex */ public abstract class fUJ extends AtomicInteger implements InterfaceC13174fSv, fSJ { volatile boolean a; final C13355fYI b = new C13355fYI(); volatile boolean c; InterfaceC13414fZq d; final EnumC13357fYN e; fSJ f; private int h; abstract void a(); void b() { } abstract void c(); abstract void e(); public fUJ(int i, EnumC13357fYN enumC13357fYN) { this.e = enumC13357fYN; this.h = i; } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { if (EnumC13192fTf.d(this.f, fsj)) { this.f = fsj; if (fsj instanceof InterfaceC13412fZo) { InterfaceC13412fZo interfaceC13412fZo = (InterfaceC13412fZo) fsj; int b = interfaceC13412fZo.b(7); if (b == 1) { this.d = interfaceC13412fZo; this.a = true; c(); e(); return; } if (b == 2) { this.d = interfaceC13412fZo; c(); return; } } this.d = new C13416fZs(this.h); c(); } } @Override // o.InterfaceC13174fSv public final void onNext(T t) { if (t != null) { this.d.b(t); } e(); } @Override // o.InterfaceC13174fSv public final void onComplete() { this.a = true; e(); } @Override // o.fSJ public final void dispose() { this.c = true; this.f.dispose(); a(); Throwable b = fYR.b(this.b); if (b != null && b != fYR.b) { C13418fZu.c(b); } if (getAndIncrement() == 0) { this.d.e(); b(); } } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { if (fYR.c(this.b, th)) { if (this.e == EnumC13357fYN.IMMEDIATE) { a(); } this.a = true; e(); return; } C13418fZu.c(th); } @Override // o.fSJ public final boolean isDisposed() { return this.c; } }