discord-jadx/app/src/main/java/c/i/a/c/a2/a.java

221 lines
6.1 KiB
Java

package c.i.a.c.a2;
import androidx.annotation.Nullable;
import c.i.a.c.a2.t;
import c.i.a.c.i2.f0;
import com.airbnb.lottie.parser.AnimatableValueParser;
import java.io.IOException;
/* compiled from: BinarySearchSeeker */
public abstract class a {
public final C0081a a;
public final f b;
@Nullable
/* renamed from: c reason: collision with root package name */
public c f641c;
public final int d;
/* compiled from: BinarySearchSeeker */
/* renamed from: c.i.a.c.a2.a$a reason: collision with other inner class name */
public static class C0081a implements t {
public final d a;
public final long b;
/* renamed from: c reason: collision with root package name */
public final long f642c;
public final long d;
public final long e;
public final long f;
public final long g;
public C0081a(d dVar, long j, long j2, long j3, long j4, long j5, long j6) {
this.a = dVar;
this.b = j;
this.f642c = j2;
this.d = j3;
this.e = j4;
this.f = j5;
this.g = j6;
}
@Override // c.i.a.c.a2.t
public boolean c() {
return true;
}
@Override // c.i.a.c.a2.t
public t.a h(long j) {
return new t.a(new u(j, c.a(this.a.a(j), this.f642c, this.d, this.e, this.f, this.g)));
}
@Override // c.i.a.c.a2.t
public long i() {
return this.b;
}
}
/* compiled from: BinarySearchSeeker */
public static final class b implements d {
@Override // c.i.a.c.a2.a.d
public long a(long j) {
return j;
}
}
/* compiled from: BinarySearchSeeker */
public static class c {
public final long a;
public final long b;
/* renamed from: c reason: collision with root package name */
public final long f643c;
public long d;
public long e;
public long f;
public long g;
public long h;
public c(long j, long j2, long j3, long j4, long j5, long j6, long j7) {
this.a = j;
this.b = j2;
this.d = j3;
this.e = j4;
this.f = j5;
this.g = j6;
this.f643c = j7;
this.h = a(j2, j3, j4, j5, j6, j7);
}
public static long a(long j, long j2, long j3, long j4, long j5, long j6) {
if (j4 + 1 >= j5 || j2 + 1 >= j3) {
return j4;
}
long j7 = (long) (((float) (j - j2)) * (((float) (j5 - j4)) / ((float) (j3 - j2))));
return f0.i(((j7 + j4) - j6) - (j7 / 20), j4, j5 - 1);
}
}
/* compiled from: BinarySearchSeeker */
public interface d {
long a(long j);
}
/* compiled from: BinarySearchSeeker */
public static final class e {
public static final e a = new e(-3, -9223372036854775807L, -1);
public final int b;
/* renamed from: c reason: collision with root package name */
public final long f644c;
public final long d;
public e(int i, long j, long j2) {
this.b = i;
this.f644c = j;
this.d = j2;
}
public static e a(long j, long j2) {
return new e(-1, j, j2);
}
public static e b(long j) {
return new e(0, -9223372036854775807L, j);
}
public static e c(long j, long j2) {
return new e(-2, j, j2);
}
}
/* compiled from: BinarySearchSeeker */
public interface f {
void a();
e b(i iVar, long j) throws IOException;
}
public a(d dVar, f fVar, long j, long j2, long j3, long j4, long j5, long j6, int i) {
this.b = fVar;
this.d = i;
this.a = new C0081a(dVar, j, j2, j3, j4, j5, j6);
}
public int a(i iVar, s sVar) throws IOException {
while (true) {
c cVar = this.f641c;
AnimatableValueParser.H(cVar);
long j = cVar.f;
long j2 = cVar.g;
long j3 = cVar.h;
if (j2 - j <= ((long) this.d)) {
c(false, j);
return d(iVar, j, sVar);
} else if (!f(iVar, j3)) {
return d(iVar, j3, sVar);
} else {
iVar.k();
e b2 = this.b.b(iVar, cVar.b);
int i = b2.b;
if (i == -3) {
c(false, j3);
return d(iVar, j3, sVar);
} else if (i == -2) {
long j4 = b2.f644c;
long j5 = b2.d;
cVar.d = j4;
cVar.f = j5;
cVar.h = c.a(cVar.b, j4, cVar.e, j5, cVar.g, cVar.f643c);
} else if (i == -1) {
long j6 = b2.f644c;
long j7 = b2.d;
cVar.e = j6;
cVar.g = j7;
cVar.h = c.a(cVar.b, cVar.d, j6, cVar.f, j7, cVar.f643c);
} else if (i == 0) {
f(iVar, b2.d);
c(true, b2.d);
return d(iVar, b2.d, sVar);
} else {
throw new IllegalStateException("Invalid case");
}
}
}
}
public final boolean b() {
return this.f641c != null;
}
public final void c(boolean z2, long j) {
this.f641c = null;
this.b.a();
}
public final int d(i iVar, long j, s sVar) {
if (j == iVar.getPosition()) {
return 0;
}
sVar.a = j;
return 1;
}
public final void e(long j) {
c cVar = this.f641c;
if (cVar == null || cVar.a != j) {
long a = this.a.a.a(j);
C0081a aVar = this.a;
this.f641c = new c(j, a, aVar.f642c, aVar.d, aVar.e, aVar.f, aVar.g);
}
}
public final boolean f(i iVar, long j) throws IOException {
long position = j - iVar.getPosition();
if (position < 0 || position > 262144) {
return false;
}
iVar.l((int) position);
return true;
}
}