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

347 lines
12 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
/* loaded from: classes6.dex */
public final class fXM<T, B, V> extends fUX<T, AbstractC13163fSk<T>> {
private InterfaceC13169fSq<B> a;
private fSS<? super B, ? extends InterfaceC13169fSq<V>> b;
private int e;
public fXM(InterfaceC13169fSq<T> interfaceC13169fSq, InterfaceC13169fSq<B> interfaceC13169fSq2, fSS<? super B, ? extends InterfaceC13169fSq<V>> fss, int i) {
super(interfaceC13169fSq);
this.a = interfaceC13169fSq2;
this.b = fss;
this.e = i;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super AbstractC13163fSk<T>> interfaceC13174fSv) {
this.c.subscribe(new HBt(interfaceC13174fSv, this.a, this.b, this.e));
}
/* loaded from: classes6.dex */
static final class HBt<T, B, V> extends AtomicInteger implements InterfaceC13174fSv<T>, fSJ, Runnable {
volatile boolean b;
private int f;
volatile boolean g;
private InterfaceC13174fSv<? super AbstractC13163fSk<T>> h;
fSJ i;
private fSS<? super B, ? extends InterfaceC13169fSq<V>> j;
private InterfaceC13169fSq<B> n;
/* renamed from: o, reason: collision with root package name */
private volatile boolean f9122o;
final InterfaceC13408fZk<Object> e = new C13378fYq();
final fSC c = new fSC();
private List<C13423fZz<T>> p = new ArrayList();
private AtomicLong l = new AtomicLong(1);
private AtomicBoolean k = new AtomicBoolean();
final C13355fYI d = new C13355fYI();
final LWm<B> a = new LWm<>(this);
private AtomicLong m = new AtomicLong();
HBt(InterfaceC13174fSv<? super AbstractC13163fSk<T>> interfaceC13174fSv, InterfaceC13169fSq<B> interfaceC13169fSq, fSS<? super B, ? extends InterfaceC13169fSq<V>> fss, int i) {
this.h = interfaceC13174fSv;
this.n = interfaceC13169fSq;
this.j = fss;
this.f = i;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
if (EnumC13192fTf.d(this.i, fsj)) {
this.i = fsj;
this.h.onSubscribe(this);
this.n.subscribe(this.a);
}
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
this.e.b(t);
e();
}
@Override // o.fSJ
public final void dispose() {
if (this.k.compareAndSet(false, true)) {
if (this.l.decrementAndGet() == 0) {
this.i.dispose();
EnumC13192fTf.e(this.a);
this.c.dispose();
Throwable b = fYR.b(this.d);
if (b != null && b != fYR.b) {
C13418fZu.c(b);
}
this.f9122o = true;
e();
return;
}
EnumC13192fTf.e(this.a);
}
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.k.get();
}
@Override // java.lang.Runnable
public final void run() {
if (this.l.decrementAndGet() == 0) {
this.i.dispose();
EnumC13192fTf.e(this.a);
this.c.dispose();
Throwable b = fYR.b(this.d);
if (b != null && b != fYR.b) {
C13418fZu.c(b);
}
this.f9122o = true;
e();
}
}
/* JADX WARN: Multi-variable type inference failed */
final void e() {
if (getAndIncrement() != 0) {
return;
}
InterfaceC13174fSv<? super AbstractC13163fSk<T>> interfaceC13174fSv = this.h;
InterfaceC13408fZk<Object> interfaceC13408fZk = this.e;
List<C13423fZz<T>> list = this.p;
int i = 1;
while (true) {
if (this.f9122o) {
interfaceC13408fZk.e();
list.clear();
} else {
boolean z = this.g;
Object b = interfaceC13408fZk.b();
boolean z2 = b == null;
if (z && (z2 || this.d.get() != null)) {
d(interfaceC13174fSv);
this.f9122o = true;
} else if (!z2) {
if (b instanceof IeS) {
if (!this.k.get()) {
try {
InterfaceC13169fSq interfaceC13169fSq = (InterfaceC13169fSq) Objects.requireNonNull(this.j.a(((IeS) b).e), "The closingIndicator returned a null ObservableSource");
this.l.getAndIncrement();
C13423fZz<T> b2 = C13423fZz.b(this.f, this);
Sts sts = new Sts(this, b2);
interfaceC13174fSv.onNext(sts);
if (!sts.b.get() && sts.b.compareAndSet(false, true)) {
b2.onComplete();
} else {
list.add(b2);
this.c.e(sts);
interfaceC13169fSq.subscribe(sts);
}
} catch (Throwable th) {
C13147fSI.c(th);
this.i.dispose();
EnumC13192fTf.e(this.a);
this.c.dispose();
C13147fSI.c(th);
if (!fYR.c(this.d, th)) {
C13418fZu.c(th);
}
this.g = true;
}
}
} else if (b instanceof Sts) {
C13423fZz<T> c13423fZz = ((Sts) b).d;
list.remove(c13423fZz);
this.c.b((fSJ) b);
c13423fZz.onComplete();
} else {
Iterator<C13423fZz<T>> it = list.iterator();
while (it.hasNext()) {
it.next().onNext(b);
}
}
} else if (this.b && list.size() == 0) {
this.i.dispose();
EnumC13192fTf.e(this.a);
this.c.dispose();
d(interfaceC13174fSv);
this.f9122o = true;
}
}
i = addAndGet(-i);
if (i == 0) {
return;
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public static final class IeS<B> {
final B e;
IeS(B b) {
this.e = b;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public static final class LWm<B> extends AtomicReference<fSJ> implements InterfaceC13174fSv<B> {
private HBt<?, B, ?> e;
LWm(HBt<?, B, ?> hBt) {
this.e = hBt;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(B b) {
HBt<?, B, ?> hBt = this.e;
hBt.e.b(new IeS(b));
hBt.e();
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
HBt<?, B, ?> hBt = this.e;
hBt.i.dispose();
hBt.c.dispose();
if (fYR.c(hBt.d, th)) {
hBt.g = true;
hBt.e();
} else {
C13418fZu.c(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
HBt<?, B, ?> hBt = this.e;
hBt.b = true;
hBt.e();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public static final class Sts<T, V> extends AbstractC13163fSk<T> implements InterfaceC13174fSv<V>, fSJ {
private AtomicReference<fSJ> a = new AtomicReference<>();
AtomicBoolean b = new AtomicBoolean();
private HBt<T, ?, V> c;
final C13423fZz<T> d;
Sts(HBt<T, ?, V> hBt, C13423fZz<T> c13423fZz) {
this.c = hBt;
this.d = c13423fZz;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this.a, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(V v) {
if (EnumC13192fTf.e(this.a)) {
HBt<T, ?, V> hBt = this.c;
hBt.e.b(this);
hBt.e();
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (isDisposed()) {
C13418fZu.c(th);
return;
}
HBt<T, ?, V> hBt = this.c;
hBt.i.dispose();
EnumC13192fTf.e(hBt.a);
hBt.c.dispose();
if (fYR.c(hBt.d, th)) {
hBt.g = true;
hBt.e();
} else {
C13418fZu.c(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
HBt<T, ?, V> hBt = this.c;
hBt.e.b(this);
hBt.e();
}
@Override // o.fSJ
public final void dispose() {
EnumC13192fTf.e(this.a);
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.a.get() == EnumC13192fTf.DISPOSED;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
this.d.subscribe(interfaceC13174fSv);
this.b.set(true);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
EnumC13192fTf.e(this.a);
this.c.dispose();
this.g = true;
e();
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
EnumC13192fTf.e(this.a);
this.c.dispose();
if (fYR.c(this.d, th)) {
this.g = true;
e();
} else {
C13418fZu.c(th);
}
}
private void d(InterfaceC13174fSv<?> interfaceC13174fSv) {
Throwable b = fYR.b(this.d);
if (b == null) {
Iterator<C13423fZz<T>> it = this.p.iterator();
while (it.hasNext()) {
it.next().onComplete();
}
interfaceC13174fSv.onComplete();
return;
}
if (b != fYR.b) {
Iterator<C13423fZz<T>> it2 = this.p.iterator();
while (it2.hasNext()) {
it2.next().onError(b);
}
interfaceC13174fSv.onError(b);
}
}
}
}