what-the-bank/sources/com/google/android/gms/internal/firebase_ml/zzig.java

109 lines
3.8 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.gms.internal.firebase_ml;
/* loaded from: classes2.dex */
public final class zzig extends zzij {
private static final char[] zzaam = {'+'};
private static final char[] zzaan = "0123456789ABCDEF".toCharArray();
private final boolean zzaao;
private final boolean[] zzaap;
public zzig(String str, boolean z) {
if (str.matches(".*[0-9A-Za-z].*")) {
throw new IllegalArgumentException("Alphanumeric characters are always 'safe' and should not be explicitly specified");
}
if (z && str.contains(" ")) {
throw new IllegalArgumentException("plusForSpace cannot be specified when space is a 'safe' character");
}
if (str.contains("%")) {
throw new IllegalArgumentException("The '%' character cannot be specified as 'safe'");
}
this.zzaao = z;
char[] charArray = str.toCharArray();
int i = 122;
for (char c : charArray) {
i = Math.max((int) c, i);
}
boolean[] zArr = new boolean[i + 1];
for (int i2 = 48; i2 <= 57; i2++) {
zArr[i2] = true;
}
for (int i3 = 65; i3 <= 90; i3++) {
zArr[i3] = true;
}
for (int i4 = 97; i4 <= 122; i4++) {
zArr[i4] = true;
}
for (char c2 : charArray) {
zArr[c2] = true;
}
this.zzaap = zArr;
}
@Override // com.google.android.gms.internal.firebase_ml.zzij
protected final int zza(CharSequence charSequence, int i, int i2) {
while (i < i2) {
char charAt = charSequence.charAt(i);
boolean[] zArr = this.zzaap;
if (charAt >= zArr.length || !zArr[charAt]) {
break;
}
i++;
}
return i;
}
@Override // com.google.android.gms.internal.firebase_ml.zzif
public final String zzaw(String str) {
int length = str.length();
for (int i = 0; i < length; i++) {
char charAt = str.charAt(i);
boolean[] zArr = this.zzaap;
if (charAt >= zArr.length || !zArr[charAt]) {
return zza(str, i);
}
}
return str;
}
@Override // com.google.android.gms.internal.firebase_ml.zzij
protected final char[] zzai(int i) {
boolean[] zArr = this.zzaap;
if (i < zArr.length && zArr[i]) {
return null;
}
if (i == 32 && this.zzaao) {
return zzaam;
}
if (i <= 127) {
char[] cArr = zzaan;
return new char[]{'%', cArr[i >>> 4], cArr[i & 15]};
}
if (i <= 2047) {
char[] cArr2 = zzaan;
char c = cArr2[i & 15];
char c2 = cArr2[8 | ((i >>> 4) & 3)];
return new char[]{'%', cArr2[(i >>> 10) | 12], cArr2[(i >>> 6) & 15], '%', c2, c};
}
if (i <= 65535) {
char[] cArr3 = zzaan;
char c3 = cArr3[i & 15];
char c4 = cArr3[((i >>> 4) & 3) | 8];
char c5 = cArr3[(i >>> 6) & 15];
return new char[]{'%', 'E', cArr3[i >>> 12], '%', cArr3[((i >>> 10) & 3) | 8], c5, '%', c4, c3};
}
if (i <= 1114111) {
char[] cArr4 = zzaan;
char c6 = cArr4[i & 15];
char c7 = cArr4[((i >>> 4) & 3) | 8];
char c8 = cArr4[(i >>> 6) & 15];
char c9 = cArr4[((i >>> 10) & 3) | 8];
char c10 = cArr4[(i >>> 12) & 15];
return new char[]{'%', 'F', cArr4[(i >>> 18) & 7], '%', cArr4[((i >>> 16) & 3) | 8], c10, '%', c9, c8, '%', c7, c6};
}
StringBuilder sb = new StringBuilder(43);
sb.append("Invalid unicode character value ");
sb.append(i);
throw new IllegalArgumentException(sb.toString());
}
}