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

232 lines
7.9 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.util.Arrays;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
/* renamed from: o.fXU, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13323fXU<T, R> extends AbstractC13163fSk<R> {
private InterfaceC13169fSq<? extends T>[] a;
private int b;
private boolean c;
private Iterable<? extends InterfaceC13169fSq<? extends T>> d;
private fSS<? super Object[], ? extends R> e;
public C13323fXU(InterfaceC13169fSq<? extends T>[] interfaceC13169fSqArr, Iterable<? extends InterfaceC13169fSq<? extends T>> iterable, fSS<? super Object[], ? extends R> fss, int i, boolean z) {
this.a = interfaceC13169fSqArr;
this.d = iterable;
this.e = fss;
this.b = i;
this.c = z;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super R> interfaceC13174fSv) {
int length;
InterfaceC13169fSq<? extends T>[] interfaceC13169fSqArr = this.a;
if (interfaceC13169fSqArr == null) {
interfaceC13169fSqArr = new InterfaceC13169fSq[8];
length = 0;
for (InterfaceC13169fSq<? extends T> interfaceC13169fSq : this.d) {
if (length == interfaceC13169fSqArr.length) {
InterfaceC13169fSq<? extends T>[] interfaceC13169fSqArr2 = new InterfaceC13169fSq[(length >> 2) + length];
System.arraycopy(interfaceC13169fSqArr, 0, interfaceC13169fSqArr2, 0, length);
interfaceC13169fSqArr = interfaceC13169fSqArr2;
}
interfaceC13169fSqArr[length] = interfaceC13169fSq;
length++;
}
} else {
length = interfaceC13169fSqArr.length;
}
if (length == 0) {
EnumC13195fTi.e(interfaceC13174fSv);
return;
}
Sts sts = new Sts(interfaceC13174fSv, this.e, length, this.c);
int i = this.b;
IeS<T, R>[] ieSArr = sts.d;
int length2 = ieSArr.length;
for (int i2 = 0; i2 < length2; i2++) {
ieSArr[i2] = new IeS<>(sts, i);
}
sts.lazySet(0);
sts.c.onSubscribe(sts);
for (int i3 = 0; i3 < length2 && !sts.e; i3++) {
interfaceC13169fSqArr[i3].subscribe(ieSArr[i3]);
}
}
/* renamed from: o.fXU$Sts */
/* loaded from: classes6.dex */
static final class Sts<T, R> extends AtomicInteger implements fSJ {
private boolean a;
private T[] b;
final InterfaceC13174fSv<? super R> c;
final IeS<T, R>[] d;
volatile boolean e;
private fSS<? super Object[], ? extends R> g;
Sts(InterfaceC13174fSv<? super R> interfaceC13174fSv, fSS<? super Object[], ? extends R> fss, int i, boolean z) {
this.c = interfaceC13174fSv;
this.g = fss;
this.d = new IeS[i];
this.b = (T[]) new Object[i];
this.a = z;
}
@Override // o.fSJ
public final void dispose() {
if (this.e) {
return;
}
this.e = true;
for (IeS<T, R> ieS : this.d) {
EnumC13192fTf.e(ieS.b);
}
if (getAndIncrement() == 0) {
for (IeS<T, R> ieS2 : this.d) {
ieS2.a.e();
}
}
}
private void a() {
for (IeS<T, R> ieS : this.d) {
ieS.a.e();
}
for (IeS<T, R> ieS2 : this.d) {
EnumC13192fTf.e(ieS2.b);
}
}
public final void c() {
Throwable th;
if (getAndIncrement() != 0) {
return;
}
IeS<T, R>[] ieSArr = this.d;
InterfaceC13174fSv<? super R> interfaceC13174fSv = this.c;
T[] tArr = this.b;
boolean z = this.a;
int i = 1;
while (true) {
int i2 = 0;
int i3 = 0;
for (IeS<T, R> ieS : ieSArr) {
if (tArr[i3] == null) {
boolean z2 = ieS.c;
T b = ieS.a.b();
boolean z3 = b == null;
if (this.e) {
a();
return;
}
if (z2) {
if (!z) {
Throwable th2 = ieS.d;
if (th2 != null) {
this.e = true;
a();
interfaceC13174fSv.onError(th2);
return;
} else if (z3) {
this.e = true;
a();
interfaceC13174fSv.onComplete();
return;
}
} else if (z3) {
Throwable th3 = ieS.d;
this.e = true;
a();
if (th3 != null) {
interfaceC13174fSv.onError(th3);
return;
} else {
interfaceC13174fSv.onComplete();
return;
}
}
}
if (z3) {
i2++;
} else {
tArr[i3] = b;
}
} else if (ieS.c && !z && (th = ieS.d) != null) {
this.e = true;
a();
interfaceC13174fSv.onError(th);
return;
}
i3++;
}
if (i2 == 0) {
try {
interfaceC13174fSv.onNext((Object) Objects.requireNonNull(this.g.a(tArr.clone()), "The zipper returned a null value"));
Arrays.fill(tArr, (Object) null);
} catch (Throwable th4) {
C13147fSI.c(th4);
a();
interfaceC13174fSv.onError(th4);
return;
}
} else {
i = addAndGet(-i);
if (i == 0) {
return;
}
}
}
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.e;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.fXU$IeS */
/* loaded from: classes6.dex */
public static final class IeS<T, R> implements InterfaceC13174fSv<T> {
final C13416fZs<T> a;
final AtomicReference<fSJ> b = new AtomicReference<>();
volatile boolean c;
Throwable d;
private Sts<T, R> e;
IeS(Sts<T, R> sts, int i) {
this.e = sts;
this.a = new C13416fZs<>(i);
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this.b, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
this.a.b(t);
this.e.c();
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
this.d = th;
this.c = true;
this.e.c();
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
this.c = true;
this.e.c();
}
}
}