package o; import java.util.Objects; /* loaded from: classes6.dex */ public final class fWK extends AbstractC13159fSg { private InterfaceC13169fSq b; private fSL d; public fWK(InterfaceC13169fSq interfaceC13169fSq, fSL fsl) { this.b = interfaceC13169fSq; this.d = fsl; } @Override // o.AbstractC13159fSg public final void a(InterfaceC13161fSi interfaceC13161fSi) { this.b.subscribe(new Sts(interfaceC13161fSi, this.d)); } /* loaded from: classes6.dex */ static final class Sts implements InterfaceC13174fSv, fSJ { private T a; private fSL b; private boolean c; private fSJ d; private InterfaceC13161fSi e; Sts(InterfaceC13161fSi interfaceC13161fSi, fSL fsl) { this.e = interfaceC13161fSi; this.b = fsl; } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { if (EnumC13192fTf.d(this.d, fsj)) { this.d = fsj; this.e.onSubscribe(this); } } @Override // o.InterfaceC13174fSv public final void onNext(T t) { if (this.c) { return; } T t2 = this.a; if (t2 == null) { this.a = t; return; } try { this.a = (T) Objects.requireNonNull(this.b.e(t2, t), "The reducer returned a null value"); } catch (Throwable th) { C13147fSI.c(th); this.d.dispose(); onError(th); } } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { if (this.c) { C13418fZu.c(th); return; } this.c = true; this.a = null; this.e.onError(th); } @Override // o.InterfaceC13174fSv public final void onComplete() { if (this.c) { return; } this.c = true; T t = this.a; this.a = null; if (t != null) { this.e.e(t); } else { this.e.onComplete(); } } @Override // o.fSJ public final void dispose() { this.d.dispose(); } @Override // o.fSJ public final boolean isDisposed() { return this.d.isDisposed(); } } }