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

239 lines
8.3 KiB
Java

package o;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
/* renamed from: o.fUR, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13218fUR<T> extends fRY {
private fSS<? super T, ? extends fRZ> b;
private AbstractC13163fSk<T> c;
private boolean d;
public C13218fUR(AbstractC13163fSk<T> abstractC13163fSk, fSS<? super T, ? extends fRZ> fss, boolean z) {
this.c = abstractC13163fSk;
this.b = fss;
this.d = z;
}
@Override // o.fRY
public final void c(InterfaceC13154fSb interfaceC13154fSb) {
if (fUP.d(this.c, this.b, interfaceC13154fSb)) {
return;
}
this.c.subscribe(new HBt(interfaceC13154fSb, this.b, this.d));
}
/* renamed from: o.fUR$HBt */
/* loaded from: classes6.dex */
static final class HBt<T> implements InterfaceC13174fSv<T>, fSJ {
private static C0112HBt j = new C0112HBt(null);
final InterfaceC13154fSb a;
volatile boolean c;
final boolean e;
fSJ g;
private fSS<? super T, ? extends fRZ> i;
final C13355fYI b = new C13355fYI();
final AtomicReference<C0112HBt> d = new AtomicReference<>();
HBt(InterfaceC13154fSb interfaceC13154fSb, fSS<? super T, ? extends fRZ> fss, boolean z) {
this.a = interfaceC13154fSb;
this.i = fss;
this.e = z;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
if (EnumC13192fTf.d(this.g, fsj)) {
this.g = fsj;
this.a.onSubscribe(this);
}
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
try {
fRZ frz = (fRZ) Objects.requireNonNull(this.i.a(t), "The mapper returned a null CompletableSource");
C0112HBt c0112HBt = new C0112HBt(this);
while (true) {
C0112HBt c0112HBt2 = this.d.get();
if (c0112HBt2 != j) {
AtomicReference<C0112HBt> atomicReference = this.d;
while (!atomicReference.compareAndSet(c0112HBt2, c0112HBt)) {
if (atomicReference.get() != c0112HBt2) {
break;
}
}
if (c0112HBt2 != null) {
EnumC13192fTf.e(c0112HBt2);
}
frz.e(c0112HBt);
return;
}
return;
}
} catch (Throwable th) {
C13147fSI.c(th);
this.g.dispose();
onError(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
this.c = true;
if (this.d.get() == null) {
C13355fYI c13355fYI = this.b;
InterfaceC13154fSb interfaceC13154fSb = this.a;
Throwable b = fYR.b(c13355fYI);
if (b == null) {
interfaceC13154fSb.onComplete();
} else if (b != fYR.b) {
interfaceC13154fSb.onError(b);
}
}
}
final void c() {
AtomicReference<C0112HBt> atomicReference = this.d;
C0112HBt c0112HBt = j;
C0112HBt andSet = atomicReference.getAndSet(c0112HBt);
if (andSet == null || andSet == c0112HBt) {
return;
}
EnumC13192fTf.e(andSet);
}
@Override // o.fSJ
public final void dispose() {
this.g.dispose();
AtomicReference<C0112HBt> atomicReference = this.d;
C0112HBt c0112HBt = j;
C0112HBt andSet = atomicReference.getAndSet(c0112HBt);
if (andSet != null && andSet != c0112HBt) {
EnumC13192fTf.e(andSet);
}
Throwable b = fYR.b(this.b);
if (b == null || b == fYR.b) {
return;
}
C13418fZu.c(b);
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.d.get() == j;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.fUR$HBt$HBt, reason: collision with other inner class name */
/* loaded from: classes6.dex */
public static final class C0112HBt extends AtomicReference<fSJ> implements InterfaceC13154fSb {
private HBt<?> a;
C0112HBt(HBt<?> hBt) {
this.a = hBt;
}
@Override // o.InterfaceC13154fSb
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this, fsj);
}
@Override // o.InterfaceC13154fSb
public final void onError(Throwable th) {
HBt<?> hBt = this.a;
AtomicReference<C0112HBt> atomicReference = hBt.d;
while (!atomicReference.compareAndSet(this, null)) {
if (atomicReference.get() != this) {
C13418fZu.c(th);
return;
}
}
if (fYR.c(hBt.b, th)) {
if (hBt.e) {
if (hBt.c) {
C13355fYI c13355fYI = hBt.b;
InterfaceC13154fSb interfaceC13154fSb = hBt.a;
Throwable b = fYR.b(c13355fYI);
if (b == null) {
interfaceC13154fSb.onComplete();
return;
} else {
if (b != fYR.b) {
interfaceC13154fSb.onError(b);
return;
}
return;
}
}
return;
}
hBt.g.dispose();
hBt.c();
C13355fYI c13355fYI2 = hBt.b;
InterfaceC13154fSb interfaceC13154fSb2 = hBt.a;
Throwable b2 = fYR.b(c13355fYI2);
if (b2 == null) {
interfaceC13154fSb2.onComplete();
return;
} else {
if (b2 != fYR.b) {
interfaceC13154fSb2.onError(b2);
return;
}
return;
}
}
C13418fZu.c(th);
}
@Override // o.InterfaceC13154fSb
public final void onComplete() {
HBt<?> hBt = this.a;
AtomicReference<C0112HBt> atomicReference = hBt.d;
while (!atomicReference.compareAndSet(this, null)) {
if (atomicReference.get() != this) {
return;
}
}
if (hBt.c) {
C13355fYI c13355fYI = hBt.b;
InterfaceC13154fSb interfaceC13154fSb = hBt.a;
Throwable b = fYR.b(c13355fYI);
if (b == null) {
interfaceC13154fSb.onComplete();
} else if (b != fYR.b) {
interfaceC13154fSb.onError(b);
}
}
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (fYR.c(this.b, th)) {
if (this.e) {
onComplete();
return;
}
c();
C13355fYI c13355fYI = this.b;
InterfaceC13154fSb interfaceC13154fSb = this.a;
Throwable b = fYR.b(c13355fYI);
if (b == null) {
interfaceC13154fSb.onComplete();
return;
} else {
if (b != fYR.b) {
interfaceC13154fSb.onError(b);
return;
}
return;
}
}
C13418fZu.c(th);
}
}
}