package o; /* loaded from: classes6.dex */ public final class fVI extends fUX { private fSS d; private fSN e; public fVI(InterfaceC13169fSq interfaceC13169fSq, fSS fss, fSN fsn) { super(interfaceC13169fSq); this.d = fss; this.e = fsn; } @Override // o.AbstractC13163fSk public final void subscribeActual(InterfaceC13174fSv interfaceC13174fSv) { this.c.subscribe(new Sts(interfaceC13174fSv, this.d, this.e)); } /* loaded from: classes6.dex */ static final class Sts extends fTA { private fSN a; private boolean g; private fSS i; private K j; Sts(InterfaceC13174fSv interfaceC13174fSv, fSS fss, fSN fsn) { super(interfaceC13174fSv); this.i = fss; this.a = fsn; } @Override // o.InterfaceC13174fSv public final void onNext(T t) { if (this.c) { return; } if (this.b != 0) { this.d.onNext(t); return; } try { K a = this.i.a(t); if (this.g) { boolean d = this.a.d(this.j, a); this.j = a; if (d) { return; } } else { this.g = true; this.j = a; } this.d.onNext(t); } catch (Throwable th) { b(th); } } @Override // o.InterfaceC13413fZp public final int b(int i) { return e(i); } @Override // o.InterfaceC13414fZq public final T b() throws Throwable { T b; boolean d; do { b = this.e.b(); if (b == null) { return null; } K a = this.i.a(b); if (!this.g) { this.g = true; this.j = a; return b; } d = this.a.d(this.j, a); this.j = a; } while (d); return b; } } }