what-the-bank/sources/com/kofax/mobile/sdk/i/c.java

110 lines
3.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.kofax.mobile.sdk.i;
import com.google.gson.Gson;
import com.kofax.kmc.kut.utilities.error.ErrorInfo;
import com.kofax.kmc.kut.utilities.error.KmcRuntimeException;
import java.io.File;
import java.io.FileFilter;
import java.nio.charset.Charset;
import o.C15175gjE;
import o.C15195gjp;
import o.InterfaceC13391fZD;
import o.gjD;
/* loaded from: classes3.dex */
public class c implements com.kofax.mobile.sdk.b.c {
private static final String MODEL = "Extractor.model";
private static final String yT = "EvrsOpString1.txt";
private static final String yU = "EvrsOpString2.txt";
private static final String yV = "Extractor.config";
private static final String yW = "cities.zip";
private static final String yX = "VariantsList.json";
private static final String yY = "OCR.config";
private static final String yZ = ".traineddata";
private final i yR;
@InterfaceC13391fZD
public c(com.kofax.mobile.sdk._internal.impl.extraction.onDevice.a aVar) {
if (aVar == null) {
throw new IllegalArgumentException("provider cannot be null");
}
this.yR = new i(aVar.get());
}
@Override // com.kofax.mobile.sdk.b.c
public boolean f(String str, String str2) {
try {
return gjD.e((String[]) new Gson().getAdapter(String[].class).fromJson(C15195gjp.a(s(str, yX).toURI())), str2);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override // com.kofax.mobile.sdk.b.c
public File g(String str, String str2) {
return b(str, str2, yV);
}
@Override // com.kofax.mobile.sdk.b.c
public File J(String str) {
File s = s(str, yW);
if (s.exists()) {
return s;
}
return null;
}
private File s(String str, String str2) {
return new File(W(str), str2);
}
private File W(String str) {
return this.yR.getProject(str, this.yR.X(str));
}
@Override // com.kofax.mobile.sdk.b.c
public File h(String str, String str2) {
return b(str, str2, MODEL);
}
@Override // com.kofax.mobile.sdk.b.c
public String i(String str, String str2) {
return c(str, str2, yT);
}
@Override // com.kofax.mobile.sdk.b.c
public String j(String str, String str2) {
return c(str, str2, yU);
}
@Override // com.kofax.mobile.sdk.b.c
public File k(String str, String str2) {
return b(str, str2, yY);
}
@Override // com.kofax.mobile.sdk.b.c
public String K(String str) {
File W = W(str);
return W.listFiles((FileFilter) new C15175gjE(yZ)).length > 0 ? W.getAbsolutePath() : "";
}
private File b(String str, String str2, String str3) {
return b(new File(this.yR.getVariant(str, str2, this.yR.X(str)), str3));
}
private File b(File file) {
if (file == null || !file.exists()) {
throw new KmcRuntimeException(ErrorInfo.KMC_GN_FILE_NOT_FOUND);
}
return file;
}
private String c(String str, String str2, String str3) {
try {
return C15195gjp.d(b(str, str2, str3).toURI(), Charset.defaultCharset()).replaceAll("\r\n", "");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}