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

165 lines
5.1 KiB
Java

package o;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
/* renamed from: o.fVv, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13278fVv<T, U> extends fUX<T, T> {
private fSS<? super T, ? extends InterfaceC13169fSq<U>> d;
public C13278fVv(InterfaceC13169fSq<T> interfaceC13169fSq, fSS<? super T, ? extends InterfaceC13169fSq<U>> fss) {
super(interfaceC13169fSq);
this.d = fss;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
this.c.subscribe(new Sts(new C13406fZi(interfaceC13174fSv), this.d));
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.fVv$Sts */
/* loaded from: classes6.dex */
public static final class Sts<T, U> implements InterfaceC13174fSv<T>, fSJ {
private boolean a;
final InterfaceC13174fSv<? super T> b;
volatile long c;
private AtomicReference<fSJ> d = new AtomicReference<>();
private fSS<? super T, ? extends InterfaceC13169fSq<U>> e;
private fSJ g;
Sts(InterfaceC13174fSv<? super T> interfaceC13174fSv, fSS<? super T, ? extends InterfaceC13169fSq<U>> fss) {
this.b = interfaceC13174fSv;
this.e = fss;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
if (EnumC13192fTf.d(this.g, fsj)) {
this.g = fsj;
this.b.onSubscribe(this);
}
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
if (this.a) {
return;
}
long j = this.c + 1;
this.c = j;
fSJ fsj = this.d.get();
if (fsj != null) {
fsj.dispose();
}
try {
InterfaceC13169fSq interfaceC13169fSq = (InterfaceC13169fSq) Objects.requireNonNull(this.e.a(t), "The ObservableSource supplied is null");
LWm lWm = new LWm(this, j, t);
AtomicReference<fSJ> atomicReference = this.d;
while (!atomicReference.compareAndSet(fsj, lWm)) {
if (atomicReference.get() != fsj) {
return;
}
}
interfaceC13169fSq.subscribe(lWm);
} catch (Throwable th) {
C13147fSI.c(th);
dispose();
this.b.onError(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
EnumC13192fTf.e(this.d);
this.b.onError(th);
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (this.a) {
return;
}
this.a = true;
fSJ fsj = this.d.get();
if (fsj != EnumC13192fTf.DISPOSED) {
LWm lWm = (LWm) fsj;
if (lWm != null) {
lWm.b();
}
EnumC13192fTf.e(this.d);
this.b.onComplete();
}
}
@Override // o.fSJ
public final void dispose() {
this.g.dispose();
EnumC13192fTf.e(this.d);
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.g.isDisposed();
}
/* renamed from: o.fVv$Sts$LWm */
/* loaded from: classes6.dex */
static final class LWm<T, U> extends AbstractC13403fZf<U> {
private T a;
private long b;
private Sts<T, U> c;
private boolean d;
private AtomicBoolean e = new AtomicBoolean();
LWm(Sts<T, U> sts, long j, T t) {
this.c = sts;
this.b = j;
this.a = t;
}
@Override // o.InterfaceC13174fSv
public final void onNext(U u) {
if (this.d) {
return;
}
this.d = true;
dispose();
b();
}
final void b() {
if (this.e.compareAndSet(false, true)) {
Sts<T, U> sts = this.c;
long j = this.b;
T t = this.a;
if (j == sts.c) {
sts.b.onNext(t);
}
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (this.d) {
C13418fZu.c(th);
} else {
this.d = true;
this.c.onError(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (this.d) {
return;
}
this.d = true;
b();
}
}
}
}