what-the-bank/sources/o/fXA.java

300 lines
10 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.util.Objects;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import o.fXE;
/* loaded from: classes6.dex */
public final class fXA<T, U, V> extends fUX<T, T> {
private fSS<? super T, ? extends InterfaceC13169fSq<V>> b;
private InterfaceC13169fSq<U> d;
private InterfaceC13169fSq<? extends T> e;
/* loaded from: classes6.dex */
interface HBt extends fXE.Sts {
void d(long j, Throwable th);
}
public fXA(AbstractC13163fSk<T> abstractC13163fSk, InterfaceC13169fSq<U> interfaceC13169fSq, fSS<? super T, ? extends InterfaceC13169fSq<V>> fss, InterfaceC13169fSq<? extends T> interfaceC13169fSq2) {
super(abstractC13163fSk);
this.d = interfaceC13169fSq;
this.b = fss;
this.e = interfaceC13169fSq2;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
if (this.e == null) {
Sts sts = new Sts(interfaceC13174fSv, this.b);
interfaceC13174fSv.onSubscribe(sts);
InterfaceC13169fSq<U> interfaceC13169fSq = this.d;
if (interfaceC13169fSq != null) {
IeS ieS = new IeS(0L, sts);
if (EnumC13192fTf.c(sts.c, ieS)) {
interfaceC13169fSq.subscribe(ieS);
}
}
this.c.subscribe(sts);
return;
}
RVV rvv = new RVV(interfaceC13174fSv, this.b, this.e);
interfaceC13174fSv.onSubscribe(rvv);
InterfaceC13169fSq<U> interfaceC13169fSq2 = this.d;
if (interfaceC13169fSq2 != null) {
IeS ieS2 = new IeS(0L, rvv);
if (EnumC13192fTf.c(rvv.b, ieS2)) {
interfaceC13169fSq2.subscribe(ieS2);
}
}
this.c.subscribe(rvv);
}
/* loaded from: classes6.dex */
static final class Sts<T> extends AtomicLong implements InterfaceC13174fSv<T>, fSJ, HBt {
private fSS<? super T, ? extends InterfaceC13169fSq<?>> a;
private InterfaceC13174fSv<? super T> b;
final C13197fTk c = new C13197fTk();
private AtomicReference<fSJ> d = new AtomicReference<>();
Sts(InterfaceC13174fSv<? super T> interfaceC13174fSv, fSS<? super T, ? extends InterfaceC13169fSq<?>> fss) {
this.b = interfaceC13174fSv;
this.a = fss;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this.d, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
long j = get();
if (j != Long.MAX_VALUE) {
long j2 = 1 + j;
if (compareAndSet(j, j2)) {
fSJ fsj = this.c.get();
if (fsj != null) {
fsj.dispose();
}
this.b.onNext(t);
try {
InterfaceC13169fSq interfaceC13169fSq = (InterfaceC13169fSq) Objects.requireNonNull(this.a.a(t), "The itemTimeoutIndicator returned a null ObservableSource.");
IeS ieS = new IeS(j2, this);
if (EnumC13192fTf.c(this.c, ieS)) {
interfaceC13169fSq.subscribe(ieS);
}
} catch (Throwable th) {
C13147fSI.c(th);
this.d.get().dispose();
getAndSet(Long.MAX_VALUE);
this.b.onError(th);
}
}
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) {
this.c.dispose();
this.b.onError(th);
} else {
C13418fZu.c(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) {
this.c.dispose();
this.b.onComplete();
}
}
@Override // o.fXE.Sts
public final void b(long j) {
if (compareAndSet(j, Long.MAX_VALUE)) {
EnumC13192fTf.e(this.d);
this.b.onError(new TimeoutException());
}
}
@Override // o.fXA.HBt
public final void d(long j, Throwable th) {
if (compareAndSet(j, Long.MAX_VALUE)) {
EnumC13192fTf.e(this.d);
this.b.onError(th);
} else {
C13418fZu.c(th);
}
}
@Override // o.fSJ
public final void dispose() {
EnumC13192fTf.e(this.d);
this.c.dispose();
}
@Override // o.fSJ
public final boolean isDisposed() {
return EnumC13192fTf.c(this.d.get());
}
}
/* loaded from: classes6.dex */
static final class RVV<T> extends AtomicReference<fSJ> implements InterfaceC13174fSv<T>, fSJ, HBt {
private InterfaceC13169fSq<? extends T> a;
private InterfaceC13174fSv<? super T> c;
private fSS<? super T, ? extends InterfaceC13169fSq<?>> d;
final C13197fTk b = new C13197fTk();
private AtomicLong e = new AtomicLong();
private AtomicReference<fSJ> h = new AtomicReference<>();
RVV(InterfaceC13174fSv<? super T> interfaceC13174fSv, fSS<? super T, ? extends InterfaceC13169fSq<?>> fss, InterfaceC13169fSq<? extends T> interfaceC13169fSq) {
this.c = interfaceC13174fSv;
this.d = fss;
this.a = interfaceC13169fSq;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this.h, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
long j = this.e.get();
if (j != Long.MAX_VALUE) {
long j2 = 1 + j;
if (this.e.compareAndSet(j, j2)) {
fSJ fsj = this.b.get();
if (fsj != null) {
fsj.dispose();
}
this.c.onNext(t);
try {
InterfaceC13169fSq interfaceC13169fSq = (InterfaceC13169fSq) Objects.requireNonNull(this.d.a(t), "The itemTimeoutIndicator returned a null ObservableSource.");
IeS ieS = new IeS(j2, this);
if (EnumC13192fTf.c(this.b, ieS)) {
interfaceC13169fSq.subscribe(ieS);
}
} catch (Throwable th) {
C13147fSI.c(th);
this.h.get().dispose();
this.e.getAndSet(Long.MAX_VALUE);
this.c.onError(th);
}
}
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (this.e.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) {
this.b.dispose();
this.c.onError(th);
this.b.dispose();
return;
}
C13418fZu.c(th);
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (this.e.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) {
this.b.dispose();
this.c.onComplete();
this.b.dispose();
}
}
@Override // o.fXE.Sts
public final void b(long j) {
if (this.e.compareAndSet(j, Long.MAX_VALUE)) {
EnumC13192fTf.e(this.h);
InterfaceC13169fSq<? extends T> interfaceC13169fSq = this.a;
this.a = null;
interfaceC13169fSq.subscribe(new fXE.HBt(this.c, this));
}
}
@Override // o.fXA.HBt
public final void d(long j, Throwable th) {
if (this.e.compareAndSet(j, Long.MAX_VALUE)) {
EnumC13192fTf.e(this);
this.c.onError(th);
} else {
C13418fZu.c(th);
}
}
@Override // o.fSJ
public final void dispose() {
EnumC13192fTf.e(this.h);
EnumC13192fTf.e(this);
this.b.dispose();
}
@Override // o.fSJ
public final boolean isDisposed() {
return EnumC13192fTf.c(get());
}
}
/* loaded from: classes6.dex */
static final class IeS extends AtomicReference<fSJ> implements InterfaceC13174fSv<Object>, fSJ {
private long c;
private HBt d;
IeS(long j, HBt hBt) {
this.c = j;
this.d = hBt;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(Object obj) {
fSJ fsj = (fSJ) get();
if (fsj != EnumC13192fTf.DISPOSED) {
fsj.dispose();
lazySet(EnumC13192fTf.DISPOSED);
this.d.b(this.c);
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (get() != EnumC13192fTf.DISPOSED) {
lazySet(EnumC13192fTf.DISPOSED);
this.d.d(this.c, th);
} else {
C13418fZu.c(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (get() != EnumC13192fTf.DISPOSED) {
lazySet(EnumC13192fTf.DISPOSED);
this.d.b(this.c);
}
}
@Override // o.fSJ
public final void dispose() {
EnumC13192fTf.e(this);
}
@Override // o.fSJ
public final boolean isDisposed() {
return EnumC13192fTf.c(get());
}
}
}