package o; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; /* loaded from: classes6.dex */ public final class fVU extends fUX { private fSS a; private boolean e; public fVU(InterfaceC13169fSq interfaceC13169fSq, fSS fss, boolean z) { super(interfaceC13169fSq); this.a = fss; this.e = z; } @Override // o.AbstractC13163fSk public final void subscribeActual(InterfaceC13174fSv interfaceC13174fSv) { this.c.subscribe(new RVV(interfaceC13174fSv, this.a, this.e)); } /* loaded from: classes6.dex */ static final class RVV extends AbstractC13183fTH implements InterfaceC13174fSv { private InterfaceC13174fSv a; private volatile boolean b; private boolean c; private C13355fYI d = new C13355fYI(); final fSC e = new fSC(); private fSS f; private fSJ i; @Override // o.InterfaceC13413fZp public final int b(int i) { return i & 2; } @Override // o.InterfaceC13414fZq public final T b() { return null; } @Override // o.InterfaceC13414fZq public final boolean c() { return true; } @Override // o.InterfaceC13414fZq public final void e() { } RVV(InterfaceC13174fSv interfaceC13174fSv, fSS fss, boolean z) { this.a = interfaceC13174fSv; this.f = fss; this.c = z; lazySet(1); } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { if (EnumC13192fTf.d(this.i, fsj)) { this.i = fsj; this.a.onSubscribe(this); } } @Override // o.InterfaceC13174fSv public final void onNext(T t) { try { fRZ frz = (fRZ) Objects.requireNonNull(this.f.a(t), "The mapper returned a null CompletableSource"); getAndIncrement(); HBt hBt = new HBt(this); if (this.b || !this.e.e(hBt)) { return; } frz.e(hBt); } catch (Throwable th) { C13147fSI.c(th); this.i.dispose(); onError(th); } } @Override // o.InterfaceC13174fSv public final void onComplete() { if (decrementAndGet() == 0) { C13355fYI c13355fYI = this.d; InterfaceC13174fSv interfaceC13174fSv = this.a; Throwable b = fYR.b(c13355fYI); if (b == null) { interfaceC13174fSv.onComplete(); } else if (b != fYR.b) { interfaceC13174fSv.onError(b); } } } @Override // o.fSJ public final void dispose() { this.b = true; this.i.dispose(); this.e.dispose(); Throwable b = fYR.b(this.d); if (b == null || b == fYR.b) { return; } C13418fZu.c(b); } @Override // o.fSJ public final boolean isDisposed() { return this.i.isDisposed(); } /* loaded from: classes6.dex */ final class HBt extends AtomicReference implements InterfaceC13154fSb, fSJ { private RVV b; HBt(RVV rvv) { this.b = rvv; } @Override // o.InterfaceC13154fSb public final void onSubscribe(fSJ fsj) { EnumC13192fTf.a(this, fsj); } @Override // o.InterfaceC13154fSb public final void onComplete() { RVV rvv = this.b; rvv.e.b(this); rvv.onComplete(); } @Override // o.InterfaceC13154fSb public final void onError(Throwable th) { RVV rvv = this.b; rvv.e.b(this); rvv.onError(th); } @Override // o.fSJ public final void dispose() { EnumC13192fTf.e(this); } @Override // o.fSJ public final boolean isDisposed() { return EnumC13192fTf.c(get()); } } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { if (fYR.c(this.d, th)) { if (this.c) { if (decrementAndGet() == 0) { C13355fYI c13355fYI = this.d; InterfaceC13174fSv interfaceC13174fSv = this.a; Throwable b = fYR.b(c13355fYI); if (b == null) { interfaceC13174fSv.onComplete(); return; } else { if (b != fYR.b) { interfaceC13174fSv.onError(b); return; } return; } } return; } this.b = true; this.i.dispose(); this.e.dispose(); C13355fYI c13355fYI2 = this.d; InterfaceC13174fSv interfaceC13174fSv2 = this.a; Throwable b2 = fYR.b(c13355fYI2); if (b2 == null) { interfaceC13174fSv2.onComplete(); return; } else { if (b2 != fYR.b) { interfaceC13174fSv2.onError(b2); return; } return; } } C13418fZu.c(th); } } }