what-the-bank/sources/com/facetec/sdk/lq.java

370 lines
13 KiB
Java

package com.facetec.sdk;
import com.google.common.primitives.SignedBytes;
import com.google.common.primitives.UnsignedBytes;
import io.beid.beidk.definitions.LivenessStatus;
import io.beid.beidk.definitions.SCBHeader;
import io.grpc.internal.GrpcUtil;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class lq {
static final ln[] a = {new ln(ln.i, ""), new ln(ln.a, "GET"), new ln(ln.a, GrpcUtil.HTTP_METHOD), new ln(ln.c, "/"), new ln(ln.c, "/index.html"), new ln(ln.b, "http"), new ln(ln.b, "https"), new ln(ln.e, "200"), new ln(ln.e, "204"), new ln(ln.e, "206"), new ln(ln.e, "304"), new ln(ln.e, "400"), new ln(ln.e, "404"), new ln(ln.e, LivenessStatus.ERROR_UNKNOW), new ln("accept-charset", ""), new ln(GrpcUtil.CONTENT_ACCEPT_ENCODING, "gzip, deflate"), new ln(SCBHeader.SCB_REQ_HEADER_ACCEPT_LANGUAGE, ""), new ln("accept-ranges", ""), new ln("accept", ""), new ln("access-control-allow-origin", ""), new ln("age", ""), new ln("allow", ""), new ln("authorization", ""), new ln("cache-control", ""), new ln("content-disposition", ""), new ln(GrpcUtil.CONTENT_ENCODING, ""), new ln("content-language", ""), new ln("content-length", ""), new ln("content-location", ""), new ln("content-range", ""), new ln("content-type", ""), new ln("cookie", ""), new ln("date", ""), new ln("etag", ""), new ln("expect", ""), new ln("expires", ""), new ln("from", ""), new ln("host", ""), new ln("if-match", ""), new ln("if-modified-since", ""), new ln("if-none-match", ""), new ln("if-range", ""), new ln("if-unmodified-since", ""), new ln("last-modified", ""), new ln("link", ""), new ln("location", ""), new ln("max-forwards", ""), new ln("proxy-authenticate", ""), new ln("proxy-authorization", ""), new ln("range", ""), new ln("referer", ""), new ln("refresh", ""), new ln("retry-after", ""), new ln("server", ""), new ln("set-cookie", ""), new ln("strict-transport-security", ""), new ln("transfer-encoding", ""), new ln("user-agent", ""), new ln("vary", ""), new ln("via", ""), new ln("www-authenticate", "")};
static final Map<mt, Integer> c;
static {
LinkedHashMap linkedHashMap = new LinkedHashMap(61);
int i = 0;
while (true) {
ln[] lnVarArr = a;
if (i < lnVarArr.length) {
if (!linkedHashMap.containsKey(lnVarArr[i].h)) {
linkedHashMap.put(lnVarArr[i].h, Integer.valueOf(i));
}
i++;
} else {
c = Collections.unmodifiableMap(linkedHashMap);
return;
}
}
}
/* loaded from: classes.dex */
static final class a {
private ln[] a;
private final int b;
private final mr c;
private final List<ln> d;
private int e;
private int f;
private int h;
private int j;
/* JADX INFO: Access modifiers changed from: package-private */
public a(nk nkVar, byte b) {
this(nkVar);
}
private a(nk nkVar) {
this.d = new ArrayList();
this.a = new ln[8];
this.f = 7;
this.j = 0;
this.h = 0;
this.b = 4096;
this.e = 4096;
this.c = nb.c(nkVar);
}
private void e() {
Arrays.fill(this.a, (Object) null);
this.f = this.a.length - 1;
this.j = 0;
this.h = 0;
}
private int e(int i) {
int i2;
int i3 = 0;
if (i > 0) {
int length = this.a.length;
while (true) {
length--;
i2 = this.f;
if (length < i2 || i <= 0) {
break;
}
i -= this.a[length].g;
this.h -= this.a[length].g;
this.j--;
i3++;
}
ln[] lnVarArr = this.a;
int i4 = i2 + 1;
System.arraycopy(lnVarArr, i4, lnVarArr, i4 + i3, this.j);
this.f += i3;
}
return i3;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void a() throws IOException {
while (!this.c.a()) {
byte g = this.c.g();
int i = g & UnsignedBytes.MAX_VALUE;
if (i == 128) {
throw new IOException("index == 0");
}
if ((g & 128) == 128) {
int b = b(i, 127);
int i2 = b - 1;
if (a(i2)) {
this.d.add(lq.a[i2]);
} else {
int c = c(i2 - lq.a.length);
if (c >= 0) {
ln[] lnVarArr = this.a;
if (c < lnVarArr.length) {
this.d.add(lnVarArr[c]);
}
}
throw new IOException("Header index too large ".concat(String.valueOf(b)));
}
} else if (i == 64) {
c(new ln(lq.b(d()), d()));
} else if ((g & SignedBytes.MAX_POWER_OF_TWO) == 64) {
c(new ln(d(b(i, 63) - 1), d()));
} else if ((g & 32) == 32) {
int b2 = b(i, 31);
this.e = b2;
if (b2 < 0 || b2 > this.b) {
StringBuilder sb = new StringBuilder("Invalid dynamic table size update ");
sb.append(this.e);
throw new IOException(sb.toString());
}
int i3 = this.h;
if (b2 < i3) {
if (b2 == 0) {
e();
} else {
e(i3 - b2);
}
}
} else if (i == 16 || i == 0) {
this.d.add(new ln(lq.b(d()), d()));
} else {
this.d.add(new ln(d(b(i, 15) - 1), d()));
}
}
}
public final List<ln> c() {
ArrayList arrayList = new ArrayList(this.d);
this.d.clear();
return arrayList;
}
private mt d(int i) throws IOException {
if (a(i)) {
return lq.a[i].h;
}
int c = c(i - lq.a.length);
if (c >= 0) {
ln[] lnVarArr = this.a;
if (c < lnVarArr.length) {
return lnVarArr[c].h;
}
}
StringBuilder sb = new StringBuilder("Header index too large ");
sb.append(i + 1);
throw new IOException(sb.toString());
}
private static boolean a(int i) {
return i >= 0 && i <= lq.a.length - 1;
}
private void c(ln lnVar) {
this.d.add(lnVar);
int i = lnVar.g;
int i2 = this.e;
if (i > i2) {
e();
return;
}
e((this.h + i) - i2);
int i3 = this.j;
ln[] lnVarArr = this.a;
if (i3 + 1 > lnVarArr.length) {
ln[] lnVarArr2 = new ln[lnVarArr.length << 1];
System.arraycopy(lnVarArr, 0, lnVarArr2, lnVarArr.length, lnVarArr.length);
this.f = this.a.length - 1;
this.a = lnVarArr2;
}
int i4 = this.f;
this.f = i4 - 1;
this.a[i4] = lnVar;
this.j++;
this.h += i;
}
private int b() throws IOException {
return this.c.g() & UnsignedBytes.MAX_VALUE;
}
private int b(int i, int i2) throws IOException {
int i3 = i & i2;
if (i3 < i2) {
return i3;
}
int i4 = 0;
while (true) {
int b = b();
if ((b & 128) == 0) {
return i2 + (b << i4);
}
i2 += (b & 127) << i4;
i4 += 7;
}
}
private mt d() throws IOException {
int b = b();
boolean z = (b & 128) == 128;
int b2 = b(b, 127);
if (z) {
return mt.d(ly.d().e(this.c.j(b2)));
}
return this.c.b(b2);
}
private int c(int i) {
return this.f + 1 + i;
}
}
/* loaded from: classes.dex */
static final class c {
final ms a;
int b;
int c;
boolean d;
int e;
ln[] f;
private final boolean g;
int h;
int i;
private int j;
/* JADX INFO: Access modifiers changed from: package-private */
public c(ms msVar) {
this(msVar, (byte) 0);
}
private c(ms msVar, byte b) {
this.b = Integer.MAX_VALUE;
this.f = new ln[8];
this.i = 7;
this.j = 0;
this.h = 0;
this.e = 4096;
this.c = 4096;
this.g = true;
this.a = msVar;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void d() {
Arrays.fill(this.f, (Object) null);
this.i = this.f.length - 1;
this.j = 0;
this.h = 0;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final int b(int i) {
int i2;
int i3 = 0;
if (i > 0) {
int length = this.f.length;
while (true) {
length--;
i2 = this.i;
if (length < i2 || i <= 0) {
break;
}
i -= this.f[length].g;
this.h -= this.f[length].g;
this.j--;
i3++;
}
ln[] lnVarArr = this.f;
int i4 = i2 + 1;
System.arraycopy(lnVarArr, i4, lnVarArr, i4 + i3, this.j);
ln[] lnVarArr2 = this.f;
int i5 = this.i + 1;
Arrays.fill(lnVarArr2, i5, i5 + i3, (Object) null);
this.i += i3;
}
return i3;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void c(ln lnVar) {
int i = lnVar.g;
int i2 = this.c;
if (i > i2) {
d();
return;
}
b((this.h + i) - i2);
int i3 = this.j;
ln[] lnVarArr = this.f;
if (i3 + 1 > lnVarArr.length) {
ln[] lnVarArr2 = new ln[lnVarArr.length << 1];
System.arraycopy(lnVarArr, 0, lnVarArr2, lnVarArr.length, lnVarArr.length);
this.i = this.f.length - 1;
this.f = lnVarArr2;
}
int i4 = this.i;
this.i = i4 - 1;
this.f[i4] = lnVar;
this.j++;
this.h += i;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void a(int i, int i2, int i3) {
if (i < i2) {
this.a.h(i | i3);
return;
}
this.a.h(i3 | i2);
int i4 = i - i2;
while (i4 >= 128) {
this.a.h(128 | (i4 & 127));
i4 >>>= 7;
}
this.a.h(i4);
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void d(mt mtVar) throws IOException {
if (this.g) {
ly.d();
if (ly.e(mtVar) < mtVar.i()) {
ms msVar = new ms();
ly.d();
ly.e(mtVar, msVar);
mt n = msVar.n();
a(n.i(), 127, 128);
this.a.c(n);
return;
}
}
a(mtVar.i(), 127, 0);
this.a.c(mtVar);
}
}
static mt b(mt mtVar) throws IOException {
int i = mtVar.i();
for (int i2 = 0; i2 < i; i2++) {
byte d = mtVar.d(i2);
if (d >= 65 && d <= 90) {
StringBuilder sb = new StringBuilder("PROTOCOL_ERROR response malformed: mixed case name: ");
sb.append(mtVar.b());
throw new IOException(sb.toString());
}
}
return mtVar;
}
}