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

2564 lines
104 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.content.res.AssetManager;
import android.media.MediaDataSource;
import android.media.MediaMetadataRetriever;
import android.os.Build;
import android.system.OsConstants;
import android.util.Log;
import android.util.Pair;
import com.google.common.base.Ascii;
import com.kofax.kmc.ken.engines.service.ImageService;
import io.flutter.embedding.android.KeyboardMap;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
import net.sf.scuba.smartcards.ISO7816;
import o.gNH;
import okhttp3.internal.ws.WebSocketProtocol;
import org.jmrtd.lds.CVCAFile;
/* loaded from: classes.dex */
public class hvV {
private static final byte[] A;
private static final byte[] B;
private static final byte[] C;
private static final byte[] D;
private static final byte[] E;
private static final HashMap<Integer, Integer> F;
private static final byte[] G;
private static final byte[] H;
private static final byte[] I;
private static final HashMap<String, LWm>[] J;
private static final HashMap<Integer, LWm>[] L;
private static final HashSet<String> M;
static final byte[] a;
static final String[] b;
static final Charset c;
static final int[] d;
private static int[] e;
private static final Pattern f;
private static int[] g;
private static final boolean h = Log.isLoggable("ExifInterface", 3);
private static final Pattern i;
private static final LWm[] j;
private static final byte[] k;
private static final byte[] l;
private static LWm[][] m;
private static final Pattern n;
/* renamed from: o, reason: collision with root package name */
private static final byte[] f9166o;
private static byte[] p;
private static final byte[] q;
private static final byte[] r;
private static byte[] s;
private static final byte[] t;
private static final byte[] u;
private static final byte[] v;
private static final byte[] w;
private static final LWm x;
private static final byte[] y;
private static final byte[] z;
private AssetManager.AssetInputStream K;
private boolean N;
private final HashMap<String, Sts>[] O;
private Set<Integer> P;
private ByteOrder Q;
private String R;
private boolean S;
private boolean T;
private int U;
private boolean V;
private int W;
private boolean X;
private FileDescriptor Y;
private int Z;
private int aa;
private byte[] ab;
private int ac;
private boolean ad;
private int ae;
private int af;
private int ah;
static {
Arrays.asList(1, 6, 3, 8);
Arrays.asList(2, 7, 4, 5);
g = new int[]{8, 8, 8};
e = new int[]{8};
s = new byte[]{-1, ISO7816.INS_LOAD_KEY_FILE, -1};
f9166o = new byte[]{102, 116, 121, ISO7816.INS_MANAGE_CHANNEL};
k = new byte[]{109, 105, 102, 49};
l = new byte[]{104, 101, 105, 99};
r = new byte[]{79, 76, 89, 77, 80, 0};
q = new byte[]{79, 76, 89, 77, 80, 85, 83, 0, 73, 73};
u = new byte[]{-119, 80, 78, 71, 13, 10, Ascii.SUB, 10};
v = new byte[]{101, 88, 73, 102};
y = new byte[]{73, 72, ISO7816.INS_REHABILITATE_CHV, 82};
w = new byte[]{73, 69, 78, ISO7816.INS_REHABILITATE_CHV};
H = new byte[]{82, 73, 70, 70};
I = new byte[]{87, 69, CVCAFile.CAR_TAG, 80};
z = new byte[]{69, 88, 73, 70};
E = new byte[]{-99, 1, ISO7816.INS_PSO};
G = "VP8X".getBytes(Charset.defaultCharset());
B = "VP8L".getBytes(Charset.defaultCharset());
A = "VP8 ".getBytes(Charset.defaultCharset());
D = "ANIM".getBytes(Charset.defaultCharset());
C = "ANMF".getBytes(Charset.defaultCharset());
b = new String[]{"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};
d = new int[]{0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
a = new byte[]{65, 83, 67, 73, 73, 0, 0, 0};
LWm[] lWmArr = {new LWm("NewSubfileType", 254, 4), new LWm("SubfileType", 255, 4), new LWm("ImageWidth", 256, 3, 4), new LWm("ImageLength", 257, 3, 4), new LWm("BitsPerSample", 258, 3), new LWm("Compression", 259, 3), new LWm("PhotometricInterpretation", 262, 3), new LWm("ImageDescription", 270, 2), new LWm("Make", 271, 2), new LWm("Model", 272, 2), new LWm("StripOffsets", 273, 3, 4), new LWm("Orientation", 274, 3), new LWm("SamplesPerPixel", 277, 3), new LWm("RowsPerStrip", 278, 3, 4), new LWm("StripByteCounts", 279, 3, 4), new LWm("XResolution", 282, 5), new LWm("YResolution", 283, 5), new LWm("PlanarConfiguration", 284, 3), new LWm("ResolutionUnit", 296, 3), new LWm("TransferFunction", 301, 3), new LWm("Software", 305, 2), new LWm("DateTime", 306, 2), new LWm("Artist", 315, 2), new LWm("WhitePoint", 318, 5), new LWm("PrimaryChromaticities", 319, 5), new LWm("SubIFDPointer", 330, 4), new LWm("JPEGInterchangeFormat", 513, 4), new LWm("JPEGInterchangeFormatLength", 514, 4), new LWm("YCbCrCoefficients", 529, 5), new LWm("YCbCrSubSampling", 530, 3), new LWm("YCbCrPositioning", 531, 3), new LWm("ReferenceBlackWhite", 532, 5), new LWm("Copyright", 33432, 2), new LWm("ExifIFDPointer", 34665, 4), new LWm("GPSInfoIFDPointer", 34853, 4), new LWm("SensorTopBorder", 4, 4), new LWm("SensorLeftBorder", 5, 4), new LWm("SensorBottomBorder", 6, 4), new LWm("SensorRightBorder", 7, 4), new LWm("ISO", 23, 3), new LWm("JpgFromRaw", 46, 7), new LWm("Xmp", 700, 1)};
LWm[] lWmArr2 = {new LWm("ExposureTime", 33434, 5), new LWm("FNumber", 33437, 5), new LWm("ExposureProgram", 34850, 3), new LWm("SpectralSensitivity", 34852, 2), new LWm("PhotographicSensitivity", 34855, 3), new LWm("OECF", 34856, 7), new LWm("SensitivityType", 34864, 3), new LWm("StandardOutputSensitivity", 34865, 4), new LWm("RecommendedExposureIndex", 34866, 4), new LWm("ISOSpeed", 34867, 4), new LWm("ISOSpeedLatitudeyyy", 34868, 4), new LWm("ISOSpeedLatitudezzz", 34869, 4), new LWm("ExifVersion", 36864, 2), new LWm("DateTimeOriginal", 36867, 2), new LWm("DateTimeDigitized", 36868, 2), new LWm("OffsetTime", 36880, 2), new LWm("OffsetTimeOriginal", 36881, 2), new LWm("OffsetTimeDigitized", 36882, 2), new LWm("ComponentsConfiguration", 37121, 7), new LWm("CompressedBitsPerPixel", 37122, 5), new LWm("ShutterSpeedValue", 37377, 10), new LWm("ApertureValue", 37378, 5), new LWm("BrightnessValue", 37379, 10), new LWm("ExposureBiasValue", 37380, 10), new LWm("MaxApertureValue", 37381, 5), new LWm("SubjectDistance", 37382, 5), new LWm("MeteringMode", 37383, 3), new LWm("LightSource", 37384, 3), new LWm("Flash", 37385, 3), new LWm("FocalLength", 37386, 5), new LWm("SubjectArea", 37396, 3), new LWm("MakerNote", 37500, 7), new LWm("UserComment", 37510, 7), new LWm("SubSecTime", 37520, 2), new LWm("SubSecTimeOriginal", 37521, 2), new LWm("SubSecTimeDigitized", 37522, 2), new LWm("FlashpixVersion", 40960, 7), new LWm("ColorSpace", 40961, 3), new LWm("PixelXDimension", 40962, 3, 4), new LWm("PixelYDimension", 40963, 3, 4), new LWm("RelatedSoundFile", 40964, 2), new LWm("InteroperabilityIFDPointer", 40965, 4), new LWm("FlashEnergy", 41483, 5), new LWm("SpatialFrequencyResponse", 41484, 7), new LWm("FocalPlaneXResolution", 41486, 5), new LWm("FocalPlaneYResolution", 41487, 5), new LWm("FocalPlaneResolutionUnit", 41488, 3), new LWm("SubjectLocation", 41492, 3), new LWm("ExposureIndex", 41493, 5), new LWm("SensingMethod", 41495, 3), new LWm("FileSource", 41728, 7), new LWm("SceneType", 41729, 7), new LWm("CFAPattern", 41730, 7), new LWm("CustomRendered", 41985, 3), new LWm("ExposureMode", 41986, 3), new LWm("WhiteBalance", 41987, 3), new LWm("DigitalZoomRatio", 41988, 5), new LWm("FocalLengthIn35mmFilm", 41989, 3), new LWm("SceneCaptureType", 41990, 3), new LWm("GainControl", 41991, 3), new LWm("Contrast", 41992, 3), new LWm("Saturation", 41993, 3), new LWm("Sharpness", 41994, 3), new LWm("DeviceSettingDescription", 41995, 7), new LWm("SubjectDistanceRange", 41996, 3), new LWm("ImageUniqueID", 42016, 2), new LWm("CameraOwnerName", 42032, 2), new LWm("BodySerialNumber", 42033, 2), new LWm("LensSpecification", 42034, 5), new LWm("LensMake", 42035, 2), new LWm("LensModel", 42036, 2), new LWm("Gamma", 42240, 5), new LWm("DNGVersion", 50706, 1), new LWm("DefaultCropSize", 50720, 3, 4)};
LWm[] lWmArr3 = {new LWm("GPSVersionID", 0, 1), new LWm("GPSLatitudeRef", 1, 2), new LWm("GPSLatitude", 2, 5, 10), new LWm("GPSLongitudeRef", 3, 2), new LWm("GPSLongitude", 4, 5, 10), new LWm("GPSAltitudeRef", 5, 1), new LWm("GPSAltitude", 6, 5), new LWm("GPSTimeStamp", 7, 5), new LWm("GPSSatellites", 8, 2), new LWm("GPSStatus", 9, 2), new LWm("GPSMeasureMode", 10, 2), new LWm("GPSDOP", 11, 5), new LWm("GPSSpeedRef", 12, 2), new LWm("GPSSpeed", 13, 5), new LWm("GPSTrackRef", 14, 2), new LWm("GPSTrack", 15, 5), new LWm("GPSImgDirectionRef", 16, 2), new LWm("GPSImgDirection", 17, 5), new LWm("GPSMapDatum", 18, 2), new LWm("GPSDestLatitudeRef", 19, 2), new LWm("GPSDestLatitude", 20, 5), new LWm("GPSDestLongitudeRef", 21, 2), new LWm("GPSDestLongitude", 22, 5), new LWm("GPSDestBearingRef", 23, 2), new LWm("GPSDestBearing", 24, 5), new LWm("GPSDestDistanceRef", 25, 2), new LWm("GPSDestDistance", 26, 5), new LWm("GPSProcessingMethod", 27, 7), new LWm("GPSAreaInformation", 28, 7), new LWm("GPSDateStamp", 29, 2), new LWm("GPSDifferential", 30, 3), new LWm("GPSHPositioningError", 31, 5)};
LWm[] lWmArr4 = {new LWm("InteroperabilityIndex", 1, 2)};
LWm[] lWmArr5 = {new LWm("NewSubfileType", 254, 4), new LWm("SubfileType", 255, 4), new LWm("ThumbnailImageWidth", 256, 3, 4), new LWm("ThumbnailImageLength", 257, 3, 4), new LWm("BitsPerSample", 258, 3), new LWm("Compression", 259, 3), new LWm("PhotometricInterpretation", 262, 3), new LWm("ImageDescription", 270, 2), new LWm("Make", 271, 2), new LWm("Model", 272, 2), new LWm("StripOffsets", 273, 3, 4), new LWm("ThumbnailOrientation", 274, 3), new LWm("SamplesPerPixel", 277, 3), new LWm("RowsPerStrip", 278, 3, 4), new LWm("StripByteCounts", 279, 3, 4), new LWm("XResolution", 282, 5), new LWm("YResolution", 283, 5), new LWm("PlanarConfiguration", 284, 3), new LWm("ResolutionUnit", 296, 3), new LWm("TransferFunction", 301, 3), new LWm("Software", 305, 2), new LWm("DateTime", 306, 2), new LWm("Artist", 315, 2), new LWm("WhitePoint", 318, 5), new LWm("PrimaryChromaticities", 319, 5), new LWm("SubIFDPointer", 330, 4), new LWm("JPEGInterchangeFormat", 513, 4), new LWm("JPEGInterchangeFormatLength", 514, 4), new LWm("YCbCrCoefficients", 529, 5), new LWm("YCbCrSubSampling", 530, 3), new LWm("YCbCrPositioning", 531, 3), new LWm("ReferenceBlackWhite", 532, 5), new LWm("Xmp", 700, 1), new LWm("Copyright", 33432, 2), new LWm("ExifIFDPointer", 34665, 4), new LWm("GPSInfoIFDPointer", 34853, 4), new LWm("DNGVersion", 50706, 1), new LWm("DefaultCropSize", 50720, 3, 4)};
x = new LWm("StripOffsets", 273, 3);
m = new LWm[][]{lWmArr, lWmArr2, lWmArr3, lWmArr4, lWmArr5, lWmArr, new LWm[]{new LWm("ThumbnailImage", 256, 7), new LWm("CameraSettingsIFDPointer", 8224, 4), new LWm("ImageProcessingIFDPointer", 8256, 4)}, new LWm[]{new LWm("PreviewImageStart", 257, 4), new LWm("PreviewImageLength", 258, 4)}, new LWm[]{new LWm("AspectFrame", 4371, 3)}, new LWm[]{new LWm("ColorSpace", 55, 3)}};
j = new LWm[]{new LWm("SubIFDPointer", 330, 4), new LWm("ExifIFDPointer", 34665, 4), new LWm("GPSInfoIFDPointer", 34853, 4), new LWm("InteroperabilityIFDPointer", 40965, 4), new LWm("CameraSettingsIFDPointer", 8224, 1), new LWm("ImageProcessingIFDPointer", 8256, 1)};
L = new HashMap[10];
J = new HashMap[10];
M = new HashSet<>(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp"));
F = new HashMap<>();
Charset forName = Charset.forName("US-ASCII");
c = forName;
p = "Exif\u0000\u0000".getBytes(forName);
t = "http://ns.adobe.com/xap/1.0/\u0000".getBytes(forName);
new SimpleDateFormat(ImageService.EXIF_TIME_FORMAT, Locale.US).setTimeZone(TimeZone.getTimeZone("UTC"));
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).setTimeZone(TimeZone.getTimeZone("UTC"));
int i2 = 0;
while (true) {
LWm[][] lWmArr6 = m;
if (i2 >= lWmArr6.length) {
HashMap<Integer, Integer> hashMap = F;
LWm[] lWmArr7 = j;
hashMap.put(Integer.valueOf(lWmArr7[0].c), 5);
hashMap.put(Integer.valueOf(lWmArr7[1].c), 1);
hashMap.put(Integer.valueOf(lWmArr7[2].c), 2);
hashMap.put(Integer.valueOf(lWmArr7[3].c), 3);
hashMap.put(Integer.valueOf(lWmArr7[4].c), 7);
hashMap.put(Integer.valueOf(lWmArr7[5].c), 8);
Pattern.compile(".*[1-9].*");
n = Pattern.compile("^(\\d{2}):(\\d{2}):(\\d{2})$");
i = Pattern.compile("^(\\d{4}):(\\d{2}):(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
f = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
return;
}
L[i2] = new HashMap<>();
J[i2] = new HashMap<>();
for (LWm lWm : lWmArr6[i2]) {
L[i2].put(Integer.valueOf(lWm.c), lWm);
J[i2].put(lWm.a, lWm);
}
i2++;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class HBt {
public final long b;
public final long d;
HBt(double d) {
this((long) (d * 10000.0d), 10000L);
}
HBt(long j, long j2) {
if (j2 == 0) {
this.d = 0L;
this.b = 1L;
} else {
this.d = j;
this.b = j2;
}
}
public final String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.d);
sb.append("/");
sb.append(this.b);
return sb.toString();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class Sts {
public final int a;
public final long b;
public final int d;
public final byte[] e;
Sts(int i, int i2, byte[] bArr) {
this(i, i2, -1L, bArr);
}
Sts(int i, int i2, long j, byte[] bArr) {
this.a = i;
this.d = i2;
this.b = j;
this.e = bArr;
}
public static Sts d(int[] iArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[hvV.d[3] * iArr.length]);
wrap.order(byteOrder);
for (int i : iArr) {
wrap.putShort((short) i);
}
return new Sts(3, iArr.length, wrap.array());
}
public static Sts a(long[] jArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[hvV.d[4] * jArr.length]);
wrap.order(byteOrder);
for (long j : jArr) {
wrap.putInt((int) j);
}
return new Sts(4, jArr.length, wrap.array());
}
public static Sts d(String str) {
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append((char) 0);
byte[] bytes = sb.toString().getBytes(hvV.c);
return new Sts(2, bytes.length, bytes);
}
public static Sts d(HBt[] hBtArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[hvV.d[5] * hBtArr.length]);
wrap.order(byteOrder);
for (HBt hBt : hBtArr) {
wrap.putInt((int) hBt.d);
wrap.putInt((int) hBt.b);
}
return new Sts(5, hBtArr.length, wrap.array());
}
public final String toString() {
StringBuilder sb = new StringBuilder("(");
sb.append(hvV.b[this.a]);
sb.append(", data length:");
sb.append(this.e.length);
sb.append(")");
return sb.toString();
}
final Object e(ByteOrder byteOrder) {
RVV rvv;
byte b;
byte b2;
RVV rvv2 = null;
try {
rvv = new RVV(this.e);
} catch (IOException unused) {
rvv = null;
} catch (Throwable th) {
th = th;
}
try {
rvv.a = byteOrder;
int i = 0;
switch (this.a) {
case 1:
case 6:
byte[] bArr = this.e;
if (bArr.length != 1 || (b = bArr[0]) < 0 || b > 1) {
String str = new String(bArr, hvV.c);
try {
rvv.close();
} catch (IOException unused2) {
}
return str;
}
String str2 = new String(new char[]{(char) (b + ISO7816.INS_DECREASE)});
try {
rvv.close();
} catch (IOException unused3) {
}
return str2;
case 2:
case 7:
if (this.d >= hvV.a.length) {
int i2 = 0;
while (true) {
if (i2 >= hvV.a.length) {
i = hvV.a.length;
} else if (this.e[i2] == hvV.a[i2]) {
i2++;
}
}
}
StringBuilder sb = new StringBuilder();
while (i < this.d && (b2 = this.e[i]) != 0) {
if (b2 >= 32) {
sb.append((char) b2);
} else {
sb.append('?');
}
i++;
}
String obj = sb.toString();
try {
rvv.close();
} catch (IOException unused4) {
}
return obj;
case 3:
int[] iArr = new int[this.d];
while (i < this.d) {
iArr[i] = rvv.readUnsignedShort();
i++;
}
try {
rvv.close();
} catch (IOException unused5) {
}
return iArr;
case 4:
long[] jArr = new long[this.d];
while (i < this.d) {
jArr[i] = rvv.readInt() & KeyboardMap.kValueMask;
i++;
}
try {
rvv.close();
} catch (IOException unused6) {
}
return jArr;
case 5:
HBt[] hBtArr = new HBt[this.d];
while (i < this.d) {
hBtArr[i] = new HBt(rvv.readInt() & KeyboardMap.kValueMask, rvv.readInt() & KeyboardMap.kValueMask);
i++;
}
try {
rvv.close();
} catch (IOException unused7) {
}
return hBtArr;
case 8:
int[] iArr2 = new int[this.d];
while (i < this.d) {
iArr2[i] = rvv.readShort();
i++;
}
try {
rvv.close();
} catch (IOException unused8) {
}
return iArr2;
case 9:
int[] iArr3 = new int[this.d];
while (i < this.d) {
iArr3[i] = rvv.readInt();
i++;
}
try {
rvv.close();
} catch (IOException unused9) {
}
return iArr3;
case 10:
HBt[] hBtArr2 = new HBt[this.d];
while (i < this.d) {
hBtArr2[i] = new HBt(rvv.readInt(), rvv.readInt());
i++;
}
try {
rvv.close();
} catch (IOException unused10) {
}
return hBtArr2;
case 11:
double[] dArr = new double[this.d];
while (i < this.d) {
dArr[i] = rvv.readFloat();
i++;
}
try {
rvv.close();
} catch (IOException unused11) {
}
return dArr;
case 12:
double[] dArr2 = new double[this.d];
while (i < this.d) {
dArr2[i] = rvv.readDouble();
i++;
}
try {
rvv.close();
} catch (IOException unused12) {
}
return dArr2;
default:
try {
rvv.close();
} catch (IOException unused13) {
}
return null;
}
} catch (IOException unused14) {
if (rvv != null) {
try {
rvv.close();
} catch (IOException unused15) {
}
}
return null;
} catch (Throwable th2) {
th = th2;
rvv2 = rvv;
if (rvv2 != null) {
try {
rvv2.close();
} catch (IOException unused16) {
}
}
throw th;
}
}
public final int c(ByteOrder byteOrder) {
Object e = e(byteOrder);
if (e == null) {
throw new NumberFormatException("NULL can't be converted to a integer value");
}
if (e instanceof String) {
return Integer.parseInt((String) e);
}
if (e instanceof long[]) {
long[] jArr = (long[]) e;
if (jArr.length == 1) {
return (int) jArr[0];
}
throw new NumberFormatException("There are more than one component");
}
if (e instanceof int[]) {
int[] iArr = (int[]) e;
if (iArr.length == 1) {
return iArr[0];
}
throw new NumberFormatException("There are more than one component");
}
throw new NumberFormatException("Couldn't find a integer value");
}
public final String a(ByteOrder byteOrder) {
Object e = e(byteOrder);
if (e == null) {
return null;
}
if (e instanceof String) {
return (String) e;
}
StringBuilder sb = new StringBuilder();
int i = 0;
if (e instanceof long[]) {
long[] jArr = (long[]) e;
while (i < jArr.length) {
sb.append(jArr[i]);
i++;
if (i != jArr.length) {
sb.append(",");
}
}
return sb.toString();
}
if (e instanceof int[]) {
int[] iArr = (int[]) e;
while (i < iArr.length) {
sb.append(iArr[i]);
i++;
if (i != iArr.length) {
sb.append(",");
}
}
return sb.toString();
}
if (e instanceof double[]) {
double[] dArr = (double[]) e;
while (i < dArr.length) {
sb.append(dArr[i]);
i++;
if (i != dArr.length) {
sb.append(",");
}
}
return sb.toString();
}
if (!(e instanceof HBt[])) {
return null;
}
HBt[] hBtArr = (HBt[]) e;
while (i < hBtArr.length) {
sb.append(hBtArr[i].d);
sb.append('/');
sb.append(hBtArr[i].b);
i++;
if (i != hBtArr.length) {
sb.append(",");
}
}
return sb.toString();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class LWm {
public final String a;
public final int b;
public final int c;
public final int d;
LWm(String str, int i, int i2) {
this.a = str;
this.c = i;
this.d = i2;
this.b = -1;
}
LWm(String str, int i, int i2, int i3) {
this.a = str;
this.c = i;
this.d = i2;
this.b = i3;
}
final boolean c(int i) {
int i2;
int i3 = this.d;
if (i3 == 7 || i == 7 || i3 == i || (i2 = this.b) == i) {
return true;
}
if ((i3 == 4 || i2 == 4) && i == 3) {
return true;
}
if ((i3 == 9 || i2 == 9) && i == 8) {
return true;
}
return (i3 == 12 || i2 == 12) && i == 11;
}
}
public hvV(String str) throws IOException {
LWm[][] lWmArr = m;
this.O = new HashMap[lWmArr.length];
this.P = new HashSet(lWmArr.length);
this.Q = ByteOrder.BIG_ENDIAN;
if (str == null) {
throw new NullPointerException("filename cannot be null");
}
if (str != null) {
FileInputStream fileInputStream = null;
this.K = null;
this.R = str;
try {
FileInputStream fileInputStream2 = new FileInputStream(str);
try {
if (e(fileInputStream2.getFD())) {
this.Y = fileInputStream2.getFD();
} else {
this.Y = null;
}
b(fileInputStream2);
try {
fileInputStream2.close();
} catch (RuntimeException e2) {
throw e2;
} catch (Exception unused) {
}
} catch (Throwable th) {
th = th;
fileInputStream = fileInputStream2;
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (RuntimeException e3) {
throw e3;
} catch (Exception unused2) {
}
}
throw th;
}
} catch (Throwable th2) {
th = th2;
}
} else {
throw new NullPointerException("filename cannot be null");
}
}
public hvV(InputStream inputStream) throws IOException {
this(inputStream, (byte) 0);
}
private hvV(InputStream inputStream, byte b2) throws IOException {
LWm[][] lWmArr = m;
this.O = new HashMap[lWmArr.length];
this.P = new HashSet(lWmArr.length);
this.Q = ByteOrder.BIG_ENDIAN;
if (inputStream == null) {
throw new NullPointerException("inputStream cannot be null");
}
FileDescriptor fileDescriptor = null;
this.R = null;
if (inputStream instanceof AssetManager.AssetInputStream) {
this.K = (AssetManager.AssetInputStream) inputStream;
this.Y = null;
} else {
if (inputStream instanceof FileInputStream) {
FileInputStream fileInputStream = (FileInputStream) inputStream;
if (e(fileInputStream.getFD())) {
this.K = null;
fileDescriptor = fileInputStream.getFD();
this.Y = fileDescriptor;
}
}
this.K = null;
this.Y = fileDescriptor;
}
b(inputStream);
}
private Sts b(String str) {
if (str == null) {
throw new NullPointerException("tag shouldn't be null");
}
if ("ISOSpeedRatings".equals(str)) {
str = "PhotographicSensitivity";
}
for (int i2 = 0; i2 < m.length; i2++) {
Sts sts = this.O[i2].get(str);
if (sts != null) {
return sts;
}
}
return null;
}
public final String a(String str) {
double d2;
if (str == null) {
throw new NullPointerException("tag shouldn't be null");
}
Sts b2 = b(str);
if (b2 != null) {
if (!M.contains(str)) {
return b2.a(this.Q);
}
if (str.equals("GPSTimeStamp")) {
if (b2.a != 5 && b2.a != 10) {
int i2 = b2.a;
return null;
}
HBt[] hBtArr = (HBt[]) b2.e(this.Q);
if (hBtArr == null || hBtArr.length != 3) {
Arrays.toString(hBtArr);
return null;
}
return String.format("%02d:%02d:%02d", Integer.valueOf((int) (((float) hBtArr[0].d) / ((float) hBtArr[0].b))), Integer.valueOf((int) (((float) hBtArr[1].d) / ((float) hBtArr[1].b))), Integer.valueOf((int) (((float) hBtArr[2].d) / ((float) hBtArr[2].b))));
}
try {
Object e2 = b2.e(this.Q);
if (e2 == null) {
throw new NumberFormatException("NULL can't be converted to a double value");
}
if (e2 instanceof String) {
d2 = Double.parseDouble((String) e2);
} else if (e2 instanceof long[]) {
long[] jArr = (long[]) e2;
if (jArr.length == 1) {
d2 = jArr[0];
} else {
throw new NumberFormatException("There are more than one component");
}
} else if (e2 instanceof int[]) {
int[] iArr = (int[]) e2;
if (iArr.length == 1) {
d2 = iArr[0];
} else {
throw new NumberFormatException("There are more than one component");
}
} else if (e2 instanceof double[]) {
double[] dArr = (double[]) e2;
if (dArr.length == 1) {
d2 = dArr[0];
} else {
throw new NumberFormatException("There are more than one component");
}
} else if (e2 instanceof HBt[]) {
HBt[] hBtArr2 = (HBt[]) e2;
if (hBtArr2.length == 1) {
HBt hBt = hBtArr2[0];
d2 = hBt.d / hBt.b;
} else {
throw new NumberFormatException("There are more than one component");
}
} else {
throw new NumberFormatException("Couldn't find a double value");
}
return Double.toString(d2);
} catch (NumberFormatException unused) {
}
}
return null;
}
public final int a(String str, int i2) {
Sts b2 = b(str);
if (b2 == null) {
return 1;
}
try {
return b2.c(this.Q);
} catch (NumberFormatException unused) {
return 1;
}
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARN: Failed to find 'out' block for switch in B:53:0x016a. Please report as an issue. */
public final void d(String str, String str2) {
LWm lWm;
int i2;
int i3;
int i4;
Sts sts;
String str3 = str;
String str4 = str2;
if (str3 == null) {
throw new NullPointerException("tag shouldn't be null");
}
if (("DateTime".equals(str3) || "DateTimeOriginal".equals(str3) || "DateTimeDigitized".equals(str3)) && str4 != null) {
boolean find = i.matcher(str4).find();
boolean find2 = f.matcher(str4).find();
if (str2.length() != 19) {
return;
}
if (!find && !find2) {
return;
}
if (find2) {
str4 = str4.replaceAll("-", ":");
}
}
if ("ISOSpeedRatings".equals(str3)) {
str3 = "PhotographicSensitivity";
}
int i5 = 2;
int i6 = 1;
if (str4 != null && M.contains(str3)) {
if (str3.equals("GPSTimeStamp")) {
Matcher matcher = n.matcher(str4);
if (!matcher.find()) {
return;
}
StringBuilder sb = new StringBuilder();
sb.append(Integer.parseInt(matcher.group(1)));
sb.append("/1,");
sb.append(Integer.parseInt(matcher.group(2)));
sb.append("/1,");
sb.append(Integer.parseInt(matcher.group(3)));
sb.append("/1");
str4 = sb.toString();
} else {
try {
str4 = new HBt(Double.parseDouble(str4)).toString();
} catch (NumberFormatException unused) {
return;
}
}
}
int i7 = 0;
int i8 = 0;
while (i8 < m.length) {
if ((i8 != 4 || this.S) && (lWm = J[i8].get(str3)) != null) {
if (str4 == null) {
this.O[i8].remove(str3);
} else {
Pair<Integer, Integer> yg_ = yg_(str4);
if (lWm.d == ((Integer) yg_.first).intValue() || lWm.d == ((Integer) yg_.second).intValue()) {
i2 = lWm.d;
} else if (lWm.b != -1 && (lWm.b == ((Integer) yg_.first).intValue() || lWm.b == ((Integer) yg_.second).intValue())) {
i2 = lWm.b;
} else if (lWm.d == i6 || lWm.d == 7 || lWm.d == i5) {
i2 = lWm.d;
} else if (h) {
String[] strArr = b;
String str5 = strArr[lWm.d];
if (lWm.b != -1) {
String str6 = strArr[lWm.b];
}
String str7 = strArr[((Integer) yg_.first).intValue()];
if (((Integer) yg_.second).intValue() != -1) {
String str8 = strArr[((Integer) yg_.second).intValue()];
}
}
switch (i2) {
case 1:
HashMap<String, Sts> hashMap = this.O[i8];
i3 = 1;
if (str4.length() == 1) {
i4 = 0;
if (str4.charAt(0) >= '0' && str4.charAt(0) <= '1') {
sts = new Sts(1, 1, new byte[]{(byte) (str4.charAt(0) - '0')});
hashMap.put(str3, sts);
break;
}
} else {
i4 = 0;
}
byte[] bytes = str4.getBytes(c);
sts = new Sts(1, bytes.length, bytes);
hashMap.put(str3, sts);
break;
case 2:
case 7:
this.O[i8].put(str3, Sts.d(str4));
i4 = 0;
i3 = 1;
break;
case 3:
String[] split = str4.split(",", -1);
int[] iArr = new int[split.length];
for (int i9 = 0; i9 < split.length; i9++) {
iArr[i9] = Integer.parseInt(split[i9]);
}
this.O[i8].put(str3, Sts.d(iArr, this.Q));
i4 = 0;
i3 = 1;
break;
case 4:
String[] split2 = str4.split(",", -1);
long[] jArr = new long[split2.length];
for (int i10 = 0; i10 < split2.length; i10++) {
jArr[i10] = Long.parseLong(split2[i10]);
}
this.O[i8].put(str3, Sts.a(jArr, this.Q));
i4 = 0;
i3 = 1;
break;
case 5:
String[] split3 = str4.split(",", -1);
HBt[] hBtArr = new HBt[split3.length];
for (int i11 = 0; i11 < split3.length; i11++) {
String[] split4 = split3[i11].split("/", -1);
hBtArr[i11] = new HBt((long) Double.parseDouble(split4[0]), (long) Double.parseDouble(split4[1]));
}
this.O[i8].put(str3, Sts.d(hBtArr, this.Q));
i4 = 0;
i3 = 1;
break;
case 9:
String[] split5 = str4.split(",", -1);
int length = split5.length;
int[] iArr2 = new int[length];
for (int i12 = 0; i12 < split5.length; i12++) {
iArr2[i12] = Integer.parseInt(split5[i12]);
}
HashMap<String, Sts> hashMap2 = this.O[i8];
ByteOrder byteOrder = this.Q;
ByteBuffer wrap = ByteBuffer.wrap(new byte[d[9] * length]);
wrap.order(byteOrder);
for (int i13 = 0; i13 < length; i13++) {
wrap.putInt(iArr2[i13]);
}
hashMap2.put(str3, new Sts(9, length, wrap.array()));
i4 = 0;
i3 = 1;
break;
case 10:
String[] split6 = str4.split(",", -1);
int length2 = split6.length;
HBt[] hBtArr2 = new HBt[length2];
int i14 = i7;
while (i14 < split6.length) {
String[] split7 = split6[i14].split("/", -1);
hBtArr2[i14] = new HBt((long) Double.parseDouble(split7[i7]), (long) Double.parseDouble(split7[i6]));
i14++;
i6 = 1;
i7 = 0;
}
HashMap<String, Sts> hashMap3 = this.O[i8];
ByteOrder byteOrder2 = this.Q;
ByteBuffer wrap2 = ByteBuffer.wrap(new byte[d[10] * length2]);
wrap2.order(byteOrder2);
for (int i15 = 0; i15 < length2; i15++) {
HBt hBt = hBtArr2[i15];
wrap2.putInt((int) hBt.d);
wrap2.putInt((int) hBt.b);
}
hashMap3.put(str3, new Sts(10, length2, wrap2.array()));
i4 = 0;
i3 = 1;
break;
case 12:
String[] split8 = str4.split(",", -1);
int length3 = split8.length;
double[] dArr = new double[length3];
for (int i16 = i7; i16 < split8.length; i16++) {
dArr[i16] = Double.parseDouble(split8[i16]);
}
HashMap<String, Sts> hashMap4 = this.O[i8];
ByteOrder byteOrder3 = this.Q;
ByteBuffer wrap3 = ByteBuffer.wrap(new byte[d[12] * length3]);
wrap3.order(byteOrder3);
for (int i17 = i7; i17 < length3; i17++) {
wrap3.putDouble(dArr[i17]);
}
hashMap4.put(str3, new Sts(12, length3, wrap3.array()));
break;
}
i8++;
i5 = 2;
int i18 = i3;
i7 = i4;
i6 = i18;
}
}
int i19 = i7;
i3 = i6;
i4 = i19;
i8++;
i5 = 2;
int i182 = i3;
i7 = i4;
i6 = i182;
}
}
private void b(InputStream inputStream) {
if (inputStream == null) {
throw new NullPointerException("inputstream shouldn't be null");
}
for (int i2 = 0; i2 < m.length; i2++) {
try {
try {
this.O[i2] = new HashMap<>();
} catch (IOException | UnsupportedOperationException unused) {
boolean z2 = h;
b();
if (!z2) {
return;
}
}
} finally {
b();
if (h) {
a();
}
}
}
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
BufferedInputStream bufferedInputStream2 = bufferedInputStream;
int b2 = b(bufferedInputStream);
this.U = b2;
if (b2 != 4 && b2 != 9 && b2 != 13 && b2 != 14) {
tOB tob = new tOB(bufferedInputStream);
int i3 = this.U;
if (i3 == 12) {
d(tob);
} else if (i3 == 7) {
c(tob);
} else if (i3 == 10) {
e(tob);
} else {
a(tob);
}
tob.e(this.W);
g(tob);
} else {
RVV rvv = new RVV(bufferedInputStream);
int i4 = this.U;
if (i4 == 4) {
a(rvv, 0, 0);
} else if (i4 == 13) {
a(rvv);
} else if (i4 == 9) {
b(rvv);
} else if (i4 == 14) {
c(rvv);
}
}
}
private static boolean e(FileDescriptor fileDescriptor) {
try {
gNH.IeS.c(fileDescriptor, 0L, OsConstants.SEEK_CUR);
return true;
} catch (Exception unused) {
return false;
}
}
private void a() {
int i2 = 0;
while (true) {
HashMap<String, Sts>[] hashMapArr = this.O;
if (i2 >= hashMapArr.length) {
return;
}
hashMapArr[i2].size();
for (Map.Entry<String, Sts> entry : this.O[i2].entrySet()) {
Sts value = entry.getValue();
entry.getKey();
value.a(this.Q);
}
i2++;
}
}
/* JADX WARN: Can't wrap try/catch for region: R(12:57|58|59|60|(4:427|428|429|(2:431|(11:433|(3:516|517|(9:519|436|(1:438)|444|445|(4:448|449|(1:510)(3:453|(3:455|456|(5:(2:459|(1:461)(3:462|463|464))|466|467|468|469)(3:470|471|472))(3:477|478|(10:480|(3:482|483|(2:485|(5:500|501|499|468|469))(3:502|503|504))(1:505)|487|(1:489)|490|(2:492|(1:494)(3:495|496|497))|498|499|468|469)(3:506|507|508))|465)|446)|512|513|514))|435|436|(0)|444|445|(1:446)|512|513|514)(2:520|521))(2:522|523))(2:62|(9:64|(1:66)(1:113)|67|68|69|70|72|73|74)(8:(12:232|233|234|235|236|237|238|(1:240)(2:250|(2:252|(6:254|(1:256)(1:270)|257|(1:259)(1:269)|260|(3:262|(2:263|(1:266)(1:265))|267)(1:268))(2:271|(19:275|276|(1:278)(1:397)|279|280|281|(9:362|363|364|365|366|367|368|369|(2:374|375)(1:373))(4:283|284|285|(3:334|335|(2:337|338)(4:340|341|342|343))(1:287))|288|289|290|291|292|293|294|(1:296)(2:298|(1:300))|297|242|243|244)))(3:399|400|401))|241|242|243|244)(2:115|(11:119|120|121|122|123|76|77|78|79|80|81))|118|76|77|78|79|80|81))|75|76|77|78|79|80|81) */
/* JADX WARN: Code restructure failed: missing block: B:83:0x05e5, code lost:
r0 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:85:0x05e7, code lost:
throw r0;
*/
/* JADX WARN: Code restructure failed: missing block: B:88:0x05e8, code lost:
r0 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:90:0x05ea, code lost:
throw r0;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Not initialized variable reg: 25, insn: 0x058c: MOVE (r5 I:??[OBJECT, ARRAY]) = (r25 I:??[OBJECT, ARRAY]), block:B:419:0x058b */
/* JADX WARN: Not initialized variable reg: 26, insn: 0x058e: MOVE (r6 I:??[OBJECT, ARRAY]) = (r26 I:??[OBJECT, ARRAY]), block:B:419:0x058b */
/* JADX WARN: Not initialized variable reg: 29, insn: 0x0590: MOVE (r13 I:??[OBJECT, ARRAY]) = (r29 I:??[OBJECT, ARRAY]), block:B:419:0x058b */
/* JADX WARN: Removed duplicated region for block: B:137:0x0686 A[Catch: all -> 0x06c3, Exception -> 0x06c9, TryCatch #69 {Exception -> 0x06c9, all -> 0x06c3, blocks: (B:135:0x0682, B:137:0x0686, B:138:0x069e, B:181:0x0697), top: B:134:0x0682 }] */
/* JADX WARN: Removed duplicated region for block: B:159:0x0727 */
/* JADX WARN: Removed duplicated region for block: B:161:? A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:162:0x071e A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:169:0x0715 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:181:0x0697 A[Catch: all -> 0x06c3, Exception -> 0x06c9, TryCatch #69 {Exception -> 0x06c9, all -> 0x06c3, blocks: (B:135:0x0682, B:137:0x0686, B:138:0x069e, B:181:0x0697), top: B:134:0x0682 }] */
/* JADX WARN: Removed duplicated region for block: B:194:0x070e A[Catch: all -> 0x06ff, TRY_LEAVE, TryCatch #86 {all -> 0x06ff, blocks: (B:205:0x06fb, B:196:0x0707, B:194:0x070e, B:201:0x070d, B:209:0x0704), top: B:191:0x06f9, inners: #100, #78 }] */
/* JADX WARN: Removed duplicated region for block: B:195:0x0707 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:204:0x06fb A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:314:0x0597 A[Catch: all -> 0x058a, Exception -> 0x0598, TRY_LEAVE, TryCatch #42 {all -> 0x058a, blocks: (B:244:0x04f7, B:248:0x04fe, B:316:0x0586, B:314:0x0597, B:321:0x0596), top: B:232:0x02cc }] */
/* JADX WARN: Removed duplicated region for block: B:315:0x0586 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:438:0x0131 A[Catch: all -> 0x0107, Exception -> 0x010e, TRY_ENTER, TRY_LEAVE, TryCatch #91 {Exception -> 0x010e, all -> 0x0107, blocks: (B:517:0x00f8, B:519:0x00fc, B:438:0x0131), top: B:516:0x00f8 }] */
/* JADX WARN: Removed duplicated region for block: B:448:0x0142 A[Catch: all -> 0x0231, Exception -> 0x0238, TRY_LEAVE, TryCatch #3 {all -> 0x0231, blocks: (B:428:0x00cc, B:431:0x00e0, B:433:0x00ed, B:436:0x0120, B:445:0x013a, B:446:0x013c, B:448:0x0142, B:456:0x0152, B:459:0x016a, B:461:0x0175, B:471:0x0181, B:472:0x0186, B:478:0x0191, B:480:0x0199, B:483:0x01a0, B:485:0x01a6, B:501:0x01ae, B:487:0x01be, B:489:0x01d0, B:492:0x01d7, B:494:0x01e4, B:503:0x01b4, B:504:0x01bb, B:507:0x01fa, B:508:0x0201, B:510:0x0202, B:513:0x0219, B:514:0x0220, B:520:0x0221, B:521:0x0228, B:522:0x0229, B:523:0x0230, B:64:0x024f, B:66:0x0265, B:73:0x02ab, B:74:0x02ae, B:95:0x02b5, B:102:0x02bf, B:100:0x02c6, B:107:0x02c5, B:113:0x0271), top: B:60:0x00ca }] */
/* JADX WARN: Removed duplicated region for block: B:575:0x076b */
/* JADX WARN: Removed duplicated region for block: B:576:0x0764 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:585:0x075b A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Type inference failed for: r15v1, types: [java.io.OutputStream, java.io.Closeable, java.io.FileOutputStream] */
/* JADX WARN: Type inference failed for: r6v12, types: [java.io.BufferedInputStream, java.io.InputStream] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void e() throws java.io.IOException {
/*
Method dump skipped, instructions count: 1900
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: o.hvV.e():void");
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:17:0x0092 A[Catch: all -> 0x0022, Exception -> 0x00b0, TRY_ENTER, TryCatch #1 {Exception -> 0x00b0, blocks: (B:38:0x004f, B:41:0x0065, B:43:0x0071, B:57:0x0081, B:58:0x0086, B:59:0x0087, B:60:0x008c, B:17:0x0092, B:18:0x0097), top: B:15:0x004d }] */
/* JADX WARN: Removed duplicated region for block: B:24:0x00aa A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:30:? A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:31:0x00a2 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:37:0x004f A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:67:0x00ba A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:71:0x00b2 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private byte[] d() {
/*
Method dump skipped, instructions count: 190
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: o.hvV.d():byte[]");
}
private int b(BufferedInputStream bufferedInputStream) throws IOException {
bufferedInputStream.mark(5000);
byte[] bArr = new byte[5000];
bufferedInputStream.read(bArr);
bufferedInputStream.reset();
int i2 = 0;
while (true) {
byte[] bArr2 = s;
if (i2 >= bArr2.length) {
return 4;
}
if (bArr[i2] != bArr2[i2]) {
byte[] bytes = "FUJIFILMCCD-RAW".getBytes(Charset.defaultCharset());
for (int i3 = 0; i3 < bytes.length; i3++) {
if (bArr[i3] != bytes[i3]) {
if (c(bArr)) {
return 12;
}
if (a(bArr)) {
return 7;
}
if (b(bArr)) {
return 10;
}
int i4 = 0;
while (true) {
byte[] bArr3 = u;
if (i4 >= bArr3.length) {
return 13;
}
if (bArr[i4] != bArr3[i4]) {
int i5 = 0;
while (true) {
byte[] bArr4 = H;
if (i5 >= bArr4.length) {
int i6 = 0;
while (true) {
byte[] bArr5 = I;
if (i6 >= bArr5.length) {
return 14;
}
if (bArr[H.length + i6 + 4] != bArr5[i6]) {
break;
}
i6++;
}
} else {
if (bArr[i5] != bArr4[i5]) {
break;
}
i5++;
}
}
return 0;
}
i4++;
}
}
}
return 9;
}
i2++;
}
}
private static boolean c(byte[] bArr) throws IOException {
RVV rvv;
long readInt;
byte[] bArr2;
long j2;
RVV rvv2 = null;
try {
rvv = new RVV(bArr);
try {
readInt = rvv.readInt();
bArr2 = new byte[4];
rvv.read(bArr2);
} catch (Exception unused) {
rvv2 = rvv;
if (rvv2 != null) {
rvv2.close();
}
return false;
} catch (Throwable th) {
th = th;
rvv2 = rvv;
if (rvv2 != null) {
rvv2.close();
}
throw th;
}
} catch (Exception unused2) {
} catch (Throwable th2) {
th = th2;
}
if (!Arrays.equals(bArr2, f9166o)) {
rvv.close();
return false;
}
if (readInt == 1) {
readInt = rvv.readLong();
j2 = 16;
if (readInt < 16) {
rvv.close();
return false;
}
} else {
j2 = 8;
}
int length = bArr.length;
if (readInt > 5000) {
int length2 = bArr.length;
readInt = 5000;
}
long j3 = readInt - j2;
if (j3 < 8) {
rvv.close();
return false;
}
byte[] bArr3 = new byte[4];
boolean z2 = false;
boolean z3 = false;
for (long j4 = 0; j4 < j3 / 4; j4++) {
if (rvv.read(bArr3) != 4) {
rvv.close();
return false;
}
if (j4 != 1) {
if (Arrays.equals(bArr3, k)) {
z3 = true;
} else if (Arrays.equals(bArr3, l)) {
z2 = true;
}
if (z3 && z2) {
rvv.close();
return true;
}
}
}
rvv.close();
return false;
}
private boolean a(byte[] bArr) throws IOException {
RVV rvv = null;
try {
RVV rvv2 = new RVV(bArr);
try {
ByteOrder d2 = d(rvv2);
this.Q = d2;
rvv2.a = d2;
short readShort = rvv2.readShort();
boolean z2 = readShort == 20306 || readShort == 21330;
rvv2.close();
return z2;
} catch (Exception unused) {
rvv = rvv2;
if (rvv != null) {
rvv.close();
}
return false;
} catch (Throwable th) {
th = th;
rvv = rvv2;
if (rvv != null) {
rvv.close();
}
throw th;
}
} catch (Exception unused2) {
} catch (Throwable th2) {
th = th2;
}
}
private boolean b(byte[] bArr) throws IOException {
RVV rvv = null;
try {
RVV rvv2 = new RVV(bArr);
try {
ByteOrder d2 = d(rvv2);
this.Q = d2;
rvv2.a = d2;
boolean z2 = rvv2.readShort() == 85;
rvv2.close();
return z2;
} catch (Exception unused) {
rvv = rvv2;
if (rvv != null) {
rvv.close();
}
return false;
} catch (Throwable th) {
th = th;
rvv = rvv2;
if (rvv != null) {
rvv.close();
}
throw th;
}
} catch (Exception unused2) {
} catch (Throwable th2) {
th = th2;
}
}
/* JADX WARN: Code restructure failed: missing block: B:60:0x0131, code lost:
r20.a = r19.Q;
*/
/* JADX WARN: Code restructure failed: missing block: B:61:0x0135, code lost:
return;
*/
/* JADX WARN: Removed duplicated region for block: B:24:0x011e A[LOOP:0: B:6:0x001c->B:24:0x011e, LOOP_END] */
/* JADX WARN: Removed duplicated region for block: B:25:0x0125 A[SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void a(o.hvV.RVV r20, int r21, int r22) throws java.io.IOException {
/*
Method dump skipped, instructions count: 426
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: o.hvV.a(o.hvV$RVV, int, int):void");
}
private void a(tOB tob) throws IOException {
Sts sts;
e((RVV) tob);
b(tob, 0);
c(tob, 0);
c(tob, 5);
c(tob, 4);
c();
if (this.U != 8 || (sts = this.O[1].get("MakerNote")) == null) {
return;
}
tOB tob2 = new tOB(sts.e);
tob2.a = this.Q;
tob2.a(6);
b(tob2, 9);
Sts sts2 = this.O[9].get("ColorSpace");
if (sts2 != null) {
this.O[1].put("ColorSpace", sts2);
}
}
private void b(RVV rvv) throws IOException {
rvv.a(84);
byte[] bArr = new byte[4];
byte[] bArr2 = new byte[4];
byte[] bArr3 = new byte[4];
rvv.read(bArr);
rvv.read(bArr2);
rvv.read(bArr3);
int i2 = ByteBuffer.wrap(bArr).getInt();
int i3 = ByteBuffer.wrap(bArr2).getInt();
int i4 = ByteBuffer.wrap(bArr3).getInt();
byte[] bArr4 = new byte[i3];
rvv.a(i2 - rvv.d);
rvv.read(bArr4);
a(new RVV(bArr4), i2, 5);
rvv.a(i4 - rvv.d);
rvv.a = ByteOrder.BIG_ENDIAN;
int readInt = rvv.readInt();
for (int i5 = 0; i5 < readInt; i5++) {
int readUnsignedShort = rvv.readUnsignedShort();
int readUnsignedShort2 = rvv.readUnsignedShort();
if (readUnsignedShort == x.c) {
int readShort = rvv.readShort();
int readShort2 = rvv.readShort();
Sts d2 = Sts.d(new int[]{readShort}, this.Q);
Sts d3 = Sts.d(new int[]{readShort2}, this.Q);
this.O[0].put("ImageLength", d2);
this.O[0].put("ImageWidth", d3);
return;
}
rvv.a(readUnsignedShort2);
}
}
private void d(tOB tob) throws IOException {
String str;
String str2;
String str3;
if (Build.VERSION.SDK_INT >= 28) {
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
try {
try {
gNH.Sts.yh_(mediaMetadataRetriever, new MediaDataSource(this, tob) { // from class: o.hvV.3
final tOB b;
private long c;
final hvV d;
@Override // java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
}
@Override // android.media.MediaDataSource
public final long getSize() throws IOException {
return -1L;
}
{
this.d = this;
this.b = tob;
}
@Override // android.media.MediaDataSource
public final int readAt(long j2, byte[] bArr, int i2, int i3) throws IOException {
if (i3 == 0) {
return 0;
}
if (j2 < 0) {
return -1;
}
try {
long j3 = this.c;
if (j3 != j2) {
if (j3 >= 0 && j2 >= j3 + this.b.available()) {
return -1;
}
this.b.e(j2);
this.c = j2;
}
if (i3 > this.b.available()) {
i3 = this.b.available();
}
int read = this.b.read(bArr, i2, i3);
if (read >= 0) {
this.c += read;
return read;
}
} catch (IOException unused) {
}
this.c = -1L;
return -1;
}
});
String extractMetadata = mediaMetadataRetriever.extractMetadata(33);
String extractMetadata2 = mediaMetadataRetriever.extractMetadata(34);
String extractMetadata3 = mediaMetadataRetriever.extractMetadata(26);
String extractMetadata4 = mediaMetadataRetriever.extractMetadata(17);
if ("yes".equals(extractMetadata3)) {
str = mediaMetadataRetriever.extractMetadata(29);
str2 = mediaMetadataRetriever.extractMetadata(30);
str3 = mediaMetadataRetriever.extractMetadata(31);
} else if ("yes".equals(extractMetadata4)) {
str = mediaMetadataRetriever.extractMetadata(18);
str2 = mediaMetadataRetriever.extractMetadata(19);
str3 = mediaMetadataRetriever.extractMetadata(24);
} else {
str = null;
str2 = null;
str3 = null;
}
if (str != null) {
this.O[0].put("ImageWidth", Sts.d(new int[]{Integer.parseInt(str)}, this.Q));
}
if (str2 != null) {
this.O[0].put("ImageLength", Sts.d(new int[]{Integer.parseInt(str2)}, this.Q));
}
if (str3 != null) {
int parseInt = Integer.parseInt(str3);
this.O[0].put("Orientation", Sts.d(new int[]{parseInt != 90 ? parseInt != 180 ? parseInt != 270 ? 1 : 8 : 3 : 6}, this.Q));
}
if (extractMetadata != null && extractMetadata2 != null) {
int parseInt2 = Integer.parseInt(extractMetadata);
int parseInt3 = Integer.parseInt(extractMetadata2);
if (parseInt3 <= 6) {
throw new IOException("Invalid exif length");
}
tob.e(parseInt2);
byte[] bArr = new byte[6];
if (tob.read(bArr) != 6) {
throw new IOException("Can't read identifier");
}
int i2 = parseInt3 - 6;
if (!Arrays.equals(bArr, p)) {
throw new IOException("Invalid identifier");
}
byte[] bArr2 = new byte[i2];
if (tob.read(bArr2) != i2) {
throw new IOException("Can't read exif");
}
this.W = parseInt2 + 6;
tOB tob2 = new tOB(bArr2);
e((RVV) tob2);
b(tob2, 0);
}
return;
} catch (RuntimeException unused) {
throw new UnsupportedOperationException("Failed to read EXIF from HEIF file. Given stream is either malformed or unsupported.");
}
} finally {
mediaMetadataRetriever.release();
}
}
throw new UnsupportedOperationException("Reading EXIF from HEIF files is supported from SDK 28 and above");
}
private void c(tOB tob) throws IOException {
int i2;
int i3;
a(tob);
Sts sts = this.O[1].get("MakerNote");
if (sts != null) {
tOB tob2 = new tOB(sts.e);
tob2.a = this.Q;
byte[] bArr = r;
byte[] bArr2 = new byte[bArr.length];
tob2.readFully(bArr2);
tob2.e(0L);
byte[] bArr3 = q;
byte[] bArr4 = new byte[bArr3.length];
tob2.readFully(bArr4);
if (Arrays.equals(bArr2, bArr)) {
tob2.e(8L);
} else if (Arrays.equals(bArr4, bArr3)) {
tob2.e(12L);
}
b(tob2, 6);
Sts sts2 = this.O[7].get("PreviewImageStart");
Sts sts3 = this.O[7].get("PreviewImageLength");
if (sts2 != null && sts3 != null) {
this.O[5].put("JPEGInterchangeFormat", sts2);
this.O[5].put("JPEGInterchangeFormatLength", sts3);
}
Sts sts4 = this.O[8].get("AspectFrame");
if (sts4 != null) {
int[] iArr = (int[]) sts4.e(this.Q);
if (iArr == null || iArr.length != 4) {
Arrays.toString(iArr);
return;
}
int i4 = iArr[2];
int i5 = iArr[0];
if (i4 <= i5 || (i2 = iArr[3]) <= (i3 = iArr[1])) {
return;
}
int i6 = (i4 - i5) + 1;
int i7 = (i2 - i3) + 1;
if (i6 < i7) {
int i8 = i6 + i7;
i7 = i8 - i7;
i6 = i8 - i7;
}
Sts d2 = Sts.d(new int[]{i6}, this.Q);
Sts d3 = Sts.d(new int[]{i7}, this.Q);
this.O[0].put("ImageWidth", d2);
this.O[0].put("ImageLength", d3);
}
}
}
private void e(tOB tob) throws IOException {
a(tob);
Sts sts = this.O[0].get("JpgFromRaw");
if (sts != null) {
a(new RVV(sts.e), (int) sts.b, 5);
}
Sts sts2 = this.O[0].get("ISO");
Sts sts3 = this.O[1].get("PhotographicSensitivity");
if (sts2 == null || sts3 != null) {
return;
}
this.O[1].put("PhotographicSensitivity", sts2);
}
private void a(RVV rvv) throws IOException {
rvv.a = ByteOrder.BIG_ENDIAN;
byte[] bArr = u;
rvv.a(bArr.length);
int length = bArr.length;
while (true) {
try {
int readInt = rvv.readInt();
byte[] bArr2 = new byte[4];
if (rvv.read(bArr2) != 4) {
throw new IOException("Encountered invalid length while parsing PNG chunktype");
}
int i2 = length + 8;
if (i2 == 16 && !Arrays.equals(bArr2, y)) {
throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
}
if (Arrays.equals(bArr2, w)) {
return;
}
if (Arrays.equals(bArr2, v)) {
byte[] bArr3 = new byte[readInt];
if (rvv.read(bArr3) != readInt) {
StringBuilder sb = new StringBuilder();
sb.append("Failed to read given length for given PNG chunk type: ");
sb.append(gNH.b(bArr2));
throw new IOException(sb.toString());
}
int readInt2 = rvv.readInt();
CRC32 crc32 = new CRC32();
crc32.update(bArr2);
crc32.update(bArr3);
if (((int) crc32.getValue()) != readInt2) {
StringBuilder sb2 = new StringBuilder();
sb2.append("Encountered invalid CRC value for PNG-EXIF chunk.\n recorded CRC value: ");
sb2.append(readInt2);
sb2.append(", calculated CRC value: ");
sb2.append(crc32.getValue());
throw new IOException(sb2.toString());
}
this.W = i2;
tOB tob = new tOB(bArr3);
e((RVV) tob);
b(tob, 0);
c();
g(new RVV(bArr3));
return;
}
int i3 = readInt + 4;
rvv.a(i3);
length = i2 + i3;
} catch (EOFException unused) {
throw new IOException("Encountered corrupt PNG file.");
}
}
}
private void c(RVV rvv) throws IOException {
rvv.a = ByteOrder.LITTLE_ENDIAN;
rvv.a(H.length);
int readInt = rvv.readInt() + 8;
byte[] bArr = I;
rvv.a(bArr.length);
int length = bArr.length + 8;
while (true) {
try {
byte[] bArr2 = new byte[4];
if (rvv.read(bArr2) != 4) {
throw new IOException("Encountered invalid length while parsing WebP chunktype");
}
int readInt2 = rvv.readInt();
int i2 = length + 8;
if (Arrays.equals(z, bArr2)) {
byte[] bArr3 = new byte[readInt2];
if (rvv.read(bArr3) != readInt2) {
StringBuilder sb = new StringBuilder();
sb.append("Failed to read given length for given PNG chunk type: ");
sb.append(gNH.b(bArr2));
throw new IOException(sb.toString());
}
this.W = i2;
tOB tob = new tOB(bArr3);
e((RVV) tob);
b(tob, 0);
g(new RVV(bArr3));
return;
}
if (readInt2 % 2 == 1) {
readInt2++;
}
length = i2 + readInt2;
if (length == readInt) {
return;
}
if (length > readInt) {
throw new IOException("Encountered WebP file with invalid chunk size");
}
rvv.a(readInt2);
} catch (EOFException unused) {
throw new IOException("Encountered corrupt WebP file.");
}
}
}
private static void e(RVV rvv, IeS ieS, byte[] bArr, byte[] bArr2) throws IOException {
while (true) {
byte[] bArr3 = new byte[4];
if (rvv.read(bArr3) != 4) {
StringBuilder sb = new StringBuilder("Encountered invalid length while copying WebP chunks up tochunk type ");
Charset charset = c;
sb.append(new String(bArr, charset));
sb.append(bArr2 == null ? "" : " or ".concat(new String(bArr2, charset)));
throw new IOException(sb.toString());
}
e(rvv, ieS, bArr3);
if (Arrays.equals(bArr3, bArr)) {
return;
}
if (bArr2 != null && Arrays.equals(bArr3, bArr2)) {
return;
}
}
}
private static void e(RVV rvv, IeS ieS, byte[] bArr) throws IOException {
int readInt = rvv.readInt();
ieS.write(bArr);
ieS.e(readInt);
if (readInt % 2 == 1) {
readInt++;
}
gNH.e(rvv, ieS, readInt);
}
private void b() {
String a2 = a("DateTimeOriginal");
if (a2 != null && a("DateTime") == null) {
this.O[0].put("DateTime", Sts.d(a2));
}
if (a("ImageWidth") == null) {
this.O[0].put("ImageWidth", Sts.a(new long[]{0}, this.Q));
}
if (a("ImageLength") == null) {
this.O[0].put("ImageLength", Sts.a(new long[]{0}, this.Q));
}
if (a("Orientation") == null) {
this.O[0].put("Orientation", Sts.a(new long[]{0}, this.Q));
}
if (a("LightSource") == null) {
this.O[1].put("LightSource", Sts.a(new long[]{0}, this.Q));
}
}
private static ByteOrder d(RVV rvv) throws IOException {
short readShort = rvv.readShort();
if (readShort == 18761) {
return ByteOrder.LITTLE_ENDIAN;
}
if (readShort == 19789) {
return ByteOrder.BIG_ENDIAN;
}
StringBuilder sb = new StringBuilder("Invalid byte order: ");
sb.append(Integer.toHexString(readShort));
throw new IOException(sb.toString());
}
private void e(RVV rvv) throws IOException {
ByteOrder d2 = d(rvv);
this.Q = d2;
rvv.a = d2;
int readUnsignedShort = rvv.readUnsignedShort();
int i2 = this.U;
if (i2 != 7 && i2 != 10 && readUnsignedShort != 42) {
StringBuilder sb = new StringBuilder("Invalid start code: ");
sb.append(Integer.toHexString(readUnsignedShort));
throw new IOException(sb.toString());
}
int readInt = rvv.readInt();
if (readInt < 8) {
throw new IOException("Invalid first Ifd offset: ".concat(String.valueOf(readInt)));
}
int i3 = readInt - 8;
if (i3 > 0) {
rvv.a(i3);
}
}
/* JADX WARN: Removed duplicated region for block: B:29:0x0087 */
/* JADX WARN: Removed duplicated region for block: B:32:0x0094 */
/* JADX WARN: Removed duplicated region for block: B:57:0x0169 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void b(o.hvV.tOB r26, int r27) throws java.io.IOException {
/*
Method dump skipped, instructions count: 595
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: o.hvV.b(o.hvV$tOB, int):void");
}
private void e(tOB tob, int i2) throws IOException {
Sts sts = this.O[i2].get("ImageLength");
Sts sts2 = this.O[i2].get("ImageWidth");
if (sts == null || sts2 == null) {
Sts sts3 = this.O[i2].get("JPEGInterchangeFormat");
Sts sts4 = this.O[i2].get("JPEGInterchangeFormatLength");
if (sts3 == null || sts4 == null) {
return;
}
int c2 = sts3.c(this.Q);
int c3 = sts3.c(this.Q);
tob.e(c2);
byte[] bArr = new byte[c3];
tob.read(bArr);
a(new RVV(bArr), c2, i2);
}
}
private void g(RVV rvv) throws IOException {
HashMap<String, Sts> hashMap = this.O[4];
Sts sts = hashMap.get("Compression");
if (sts != null) {
int c2 = sts.c(this.Q);
this.ah = c2;
if (c2 != 1) {
if (c2 == 6) {
b(rvv, hashMap);
return;
} else if (c2 != 7) {
return;
}
}
if (a(hashMap)) {
c(rvv, hashMap);
return;
}
return;
}
this.ah = 6;
b(rvv, hashMap);
}
private void b(RVV rvv, HashMap hashMap) throws IOException {
Sts sts = (Sts) hashMap.get("JPEGInterchangeFormat");
Sts sts2 = (Sts) hashMap.get("JPEGInterchangeFormatLength");
if (sts == null || sts2 == null) {
return;
}
int c2 = sts.c(this.Q);
int c3 = sts2.c(this.Q);
if (this.U == 7) {
c2 += this.aa;
}
if (c2 <= 0 || c3 <= 0) {
return;
}
this.S = true;
if (this.R == null && this.K == null && this.Y == null) {
byte[] bArr = new byte[c3];
rvv.skip(c2);
rvv.read(bArr);
this.ab = bArr;
}
this.af = c2;
this.ae = c3;
}
private void c(RVV rvv, HashMap hashMap) throws IOException {
Sts sts = (Sts) hashMap.get("StripOffsets");
Sts sts2 = (Sts) hashMap.get("StripByteCounts");
if (sts == null || sts2 == null) {
return;
}
long[] c2 = gNH.c(sts.e(this.Q));
long[] c3 = gNH.c(sts2.e(this.Q));
if (c2 == null || c2.length == 0 || c3 == null || c3.length == 0 || c2.length != c3.length) {
return;
}
long j2 = 0;
for (long j3 : c3) {
j2 += j3;
}
int i2 = (int) j2;
byte[] bArr = new byte[i2];
this.N = true;
this.T = true;
this.S = true;
int i3 = 0;
int i4 = 0;
for (int i5 = 0; i5 < c2.length; i5++) {
int i6 = (int) c2[i5];
int i7 = (int) c3[i5];
if (i5 < c2.length - 1 && i6 + i7 != c2[i5 + 1]) {
this.N = false;
}
int i8 = i6 - i3;
if (i8 < 0) {
return;
}
long j4 = i8;
if (rvv.skip(j4) != j4) {
return;
}
byte[] bArr2 = new byte[i7];
if (rvv.read(bArr2) != i7) {
return;
}
i3 = i3 + i8 + i7;
System.arraycopy(bArr2, 0, bArr, i4, i7);
i4 += i7;
}
this.ab = bArr;
if (this.N) {
this.af = (int) c2[0];
this.ae = i2;
}
}
private boolean a(HashMap hashMap) throws IOException {
Sts sts;
Sts sts2 = (Sts) hashMap.get("BitsPerSample");
if (sts2 == null) {
return false;
}
int[] iArr = (int[]) sts2.e(this.Q);
int[] iArr2 = g;
if (Arrays.equals(iArr2, iArr)) {
return true;
}
if (this.U != 3 || (sts = (Sts) hashMap.get("PhotometricInterpretation")) == null) {
return false;
}
int c2 = sts.c(this.Q);
return (c2 == 1 && Arrays.equals(iArr, e)) || (c2 == 6 && Arrays.equals(iArr, iArr2));
}
private boolean b(HashMap hashMap) throws IOException {
Sts sts = (Sts) hashMap.get("ImageLength");
Sts sts2 = (Sts) hashMap.get("ImageWidth");
if (sts == null || sts2 == null) {
return false;
}
return sts.c(this.Q) <= 512 && sts2.c(this.Q) <= 512;
}
private void c() throws IOException {
a(0, 5);
a(0, 4);
a(5, 4);
Sts sts = this.O[1].get("PixelXDimension");
Sts sts2 = this.O[1].get("PixelYDimension");
if (sts != null && sts2 != null) {
this.O[0].put("ImageWidth", sts);
this.O[0].put("ImageLength", sts2);
}
if (this.O[4].isEmpty() && b(this.O[5])) {
HashMap<String, Sts>[] hashMapArr = this.O;
hashMapArr[4] = hashMapArr[5];
hashMapArr[5] = new HashMap<>();
}
b(this.O[4]);
e(0, "ThumbnailOrientation", "Orientation");
e(0, "ThumbnailImageLength", "ImageLength");
e(0, "ThumbnailImageWidth", "ImageWidth");
e(5, "ThumbnailOrientation", "Orientation");
e(5, "ThumbnailImageLength", "ImageLength");
e(5, "ThumbnailImageWidth", "ImageWidth");
e(4, "Orientation", "ThumbnailOrientation");
e(4, "ImageLength", "ThumbnailImageLength");
e(4, "ImageWidth", "ThumbnailImageWidth");
}
private void c(tOB tob, int i2) throws IOException {
Sts d2;
Sts d3;
Sts sts = this.O[i2].get("DefaultCropSize");
Sts sts2 = this.O[i2].get("SensorTopBorder");
Sts sts3 = this.O[i2].get("SensorLeftBorder");
Sts sts4 = this.O[i2].get("SensorBottomBorder");
Sts sts5 = this.O[i2].get("SensorRightBorder");
if (sts == null) {
if (sts2 != null && sts3 != null && sts4 != null && sts5 != null) {
int c2 = sts2.c(this.Q);
int c3 = sts4.c(this.Q);
int c4 = sts5.c(this.Q);
int c5 = sts3.c(this.Q);
if (c3 <= c2 || c4 <= c5) {
return;
}
Sts d4 = Sts.d(new int[]{c3 - c2}, this.Q);
Sts d5 = Sts.d(new int[]{c4 - c5}, this.Q);
this.O[i2].put("ImageLength", d4);
this.O[i2].put("ImageWidth", d5);
return;
}
e(tob, i2);
return;
}
if (sts.a == 5) {
HBt[] hBtArr = (HBt[]) sts.e(this.Q);
if (hBtArr == null || hBtArr.length != 2) {
Arrays.toString(hBtArr);
return;
}
d2 = Sts.d(new HBt[]{hBtArr[0]}, this.Q);
d3 = Sts.d(new HBt[]{hBtArr[1]}, this.Q);
} else {
int[] iArr = (int[]) sts.e(this.Q);
if (iArr == null || iArr.length != 2) {
Arrays.toString(iArr);
return;
}
d2 = Sts.d(new int[]{iArr[0]}, this.Q);
d3 = Sts.d(new int[]{iArr[1]}, this.Q);
}
this.O[i2].put("ImageWidth", d2);
this.O[i2].put("ImageLength", d3);
}
private int e(IeS ieS) throws IOException {
LWm[][] lWmArr = m;
int[] iArr = new int[lWmArr.length];
int[] iArr2 = new int[lWmArr.length];
for (LWm lWm : j) {
String str = lWm.a;
for (int i2 = 0; i2 < m.length; i2++) {
this.O[i2].remove(str);
}
}
if (this.S) {
if (this.T) {
for (int i3 = 0; i3 < m.length; i3++) {
this.O[i3].remove("StripOffsets");
}
for (int i4 = 0; i4 < m.length; i4++) {
this.O[i4].remove("StripByteCounts");
}
} else {
for (int i5 = 0; i5 < m.length; i5++) {
this.O[i5].remove("JPEGInterchangeFormat");
}
for (int i6 = 0; i6 < m.length; i6++) {
this.O[i6].remove("JPEGInterchangeFormatLength");
}
}
}
for (int i7 = 0; i7 < m.length; i7++) {
for (Object obj : this.O[i7].entrySet().toArray()) {
Map.Entry entry = (Map.Entry) obj;
if (entry.getValue() == null) {
this.O[i7].remove(entry.getKey());
}
}
}
if (!this.O[1].isEmpty()) {
this.O[0].put(j[1].a, Sts.a(new long[]{0}, this.Q));
}
if (!this.O[2].isEmpty()) {
this.O[0].put(j[2].a, Sts.a(new long[]{0}, this.Q));
}
if (!this.O[3].isEmpty()) {
this.O[1].put(j[3].a, Sts.a(new long[]{0}, this.Q));
}
if (this.S) {
if (this.T) {
this.O[4].put("StripOffsets", Sts.d(new int[]{0}, this.Q));
this.O[4].put("StripByteCounts", Sts.d(new int[]{this.ae}, this.Q));
} else {
this.O[4].put("JPEGInterchangeFormat", Sts.a(new long[]{0}, this.Q));
this.O[4].put("JPEGInterchangeFormatLength", Sts.a(new long[]{this.ae}, this.Q));
}
}
for (int i8 = 0; i8 < m.length; i8++) {
Iterator<Map.Entry<String, Sts>> it = this.O[i8].entrySet().iterator();
int i9 = 0;
while (it.hasNext()) {
Sts value = it.next().getValue();
int i10 = d[value.a] * value.d;
if (i10 > 4) {
i9 += i10;
}
}
iArr2[i8] = iArr2[i8] + i9;
}
int i11 = 8;
for (int i12 = 0; i12 < m.length; i12++) {
if (!this.O[i12].isEmpty()) {
iArr[i12] = i11;
i11 += (this.O[i12].size() * 12) + 6 + iArr2[i12];
}
}
if (this.S) {
if (this.T) {
this.O[4].put("StripOffsets", Sts.d(new int[]{i11}, this.Q));
} else {
this.O[4].put("JPEGInterchangeFormat", Sts.a(new long[]{i11}, this.Q));
}
this.af = i11;
i11 += this.ae;
}
if (this.U == 4) {
i11 += 8;
}
if (h) {
for (int i13 = 0; i13 < m.length; i13++) {
new Object[]{Integer.valueOf(i13), Integer.valueOf(iArr[i13]), Integer.valueOf(this.O[i13].size()), Integer.valueOf(iArr2[i13]), Integer.valueOf(i11)};
}
}
if (!this.O[1].isEmpty()) {
this.O[0].put(j[1].a, Sts.a(new long[]{iArr[1]}, this.Q));
}
if (!this.O[2].isEmpty()) {
this.O[0].put(j[2].a, Sts.a(new long[]{iArr[2]}, this.Q));
}
if (!this.O[3].isEmpty()) {
this.O[1].put(j[3].a, Sts.a(new long[]{iArr[3]}, this.Q));
}
int i14 = this.U;
if (i14 == 4) {
ieS.b((short) i11);
ieS.write(p);
} else if (i14 == 13) {
ieS.e(i11);
ieS.write(v);
} else if (i14 == 14) {
ieS.write(z);
ieS.e(i11);
}
ieS.b(this.Q == ByteOrder.BIG_ENDIAN ? (short) 19789 : (short) 18761);
ieS.c = this.Q;
ieS.b((short) 42);
ieS.e(8);
for (int i15 = 0; i15 < m.length; i15++) {
if (!this.O[i15].isEmpty()) {
ieS.b((short) this.O[i15].size());
int size = iArr[i15] + 2 + (this.O[i15].size() * 12) + 4;
for (Map.Entry<String, Sts> entry2 : this.O[i15].entrySet()) {
int i16 = J[i15].get(entry2.getKey()).c;
Sts value2 = entry2.getValue();
int i17 = d[value2.a] * value2.d;
ieS.b((short) i16);
ieS.b((short) value2.a);
ieS.e(value2.d);
if (i17 <= 4) {
ieS.write(value2.e);
if (i17 < 4) {
while (i17 < 4) {
ieS.e.write(0);
i17++;
}
}
} else {
ieS.e(size);
size += i17;
}
}
if (i15 == 0 && !this.O[4].isEmpty()) {
ieS.e(iArr[4]);
} else {
ieS.e(0);
}
Iterator<Map.Entry<String, Sts>> it2 = this.O[i15].entrySet().iterator();
while (it2.hasNext()) {
Sts value3 = it2.next().getValue();
if (value3.e.length > 4) {
ieS.write(value3.e, 0, value3.e.length);
}
}
}
}
if (this.S) {
ieS.write(d());
}
if (this.U == 14 && i11 % 2 == 1) {
ieS.e.write(0);
}
ieS.c = ByteOrder.BIG_ENDIAN;
return i11;
}
private static Pair<Integer, Integer> yg_(String str) {
if (str.contains(",")) {
String[] split = str.split(",", -1);
Pair<Integer, Integer> yg_ = yg_(split[0]);
if (((Integer) yg_.first).intValue() == 2) {
return yg_;
}
for (int i2 = 1; i2 < split.length; i2++) {
Pair<Integer, Integer> yg_2 = yg_(split[i2]);
int intValue = (((Integer) yg_2.first).equals(yg_.first) || ((Integer) yg_2.second).equals(yg_.first)) ? ((Integer) yg_.first).intValue() : -1;
int intValue2 = (((Integer) yg_.second).intValue() == -1 || !(((Integer) yg_2.first).equals(yg_.second) || ((Integer) yg_2.second).equals(yg_.second))) ? -1 : ((Integer) yg_.second).intValue();
if (intValue == -1 && intValue2 == -1) {
return new Pair<>(2, -1);
}
if (intValue == -1) {
yg_ = new Pair<>(Integer.valueOf(intValue2), -1);
} else if (intValue2 == -1) {
yg_ = new Pair<>(Integer.valueOf(intValue), -1);
}
}
return yg_;
}
if (str.contains("/")) {
String[] split2 = str.split("/", -1);
if (split2.length == 2) {
try {
long parseDouble = (long) Double.parseDouble(split2[0]);
long parseDouble2 = (long) Double.parseDouble(split2[1]);
if (parseDouble < 0 || parseDouble2 < 0) {
return new Pair<>(10, -1);
}
if (parseDouble > 2147483647L || parseDouble2 > 2147483647L) {
return new Pair<>(5, -1);
}
return new Pair<>(10, 5);
} catch (NumberFormatException unused) {
}
}
return new Pair<>(2, -1);
}
try {
try {
Long valueOf = Long.valueOf(Long.parseLong(str));
if (valueOf.longValue() >= 0 && valueOf.longValue() <= WebSocketProtocol.PAYLOAD_SHORT_MAX) {
return new Pair<>(3, 4);
}
if (valueOf.longValue() < 0) {
return new Pair<>(9, -1);
}
return new Pair<>(4, -1);
} catch (NumberFormatException unused2) {
return new Pair<>(2, -1);
}
} catch (NumberFormatException unused3) {
Double.parseDouble(str);
return new Pair<>(12, -1);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class tOB extends RVV {
tOB(byte[] bArr) throws IOException {
super(bArr);
this.e.mark(Integer.MAX_VALUE);
}
tOB(InputStream inputStream) throws IOException {
super(inputStream);
if (!inputStream.markSupported()) {
throw new IllegalArgumentException("Cannot create SeekableByteOrderedDataInputStream with stream that does not support mark/reset");
}
this.e.mark(Integer.MAX_VALUE);
}
public final void e(long j) throws IOException {
if (this.d > j) {
this.d = 0;
this.e.reset();
} else {
j -= this.d;
}
a((int) j);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class RVV extends InputStream implements DataInput {
private static final ByteOrder b = ByteOrder.LITTLE_ENDIAN;
private static final ByteOrder c = ByteOrder.BIG_ENDIAN;
ByteOrder a;
int d;
final DataInputStream e;
private byte[] g;
@Override // java.io.DataInput
public String readLine() throws IOException {
return null;
}
RVV(byte[] bArr) throws IOException {
this(new ByteArrayInputStream(bArr), ByteOrder.BIG_ENDIAN);
}
RVV(InputStream inputStream) throws IOException {
this(inputStream, ByteOrder.BIG_ENDIAN);
}
RVV(InputStream inputStream, ByteOrder byteOrder) throws IOException {
this.a = ByteOrder.BIG_ENDIAN;
DataInputStream dataInputStream = new DataInputStream(inputStream);
this.e = dataInputStream;
dataInputStream.mark(0);
this.d = 0;
this.a = byteOrder;
}
@Override // java.io.InputStream
public int available() throws IOException {
return this.e.available();
}
@Override // java.io.InputStream
public int read() throws IOException {
this.d++;
return this.e.read();
}
@Override // java.io.InputStream
public int read(byte[] bArr, int i, int i2) throws IOException {
int read = this.e.read(bArr, i, i2);
this.d += read;
return read;
}
@Override // java.io.DataInput
public int readUnsignedByte() throws IOException {
this.d++;
return this.e.readUnsignedByte();
}
@Override // java.io.DataInput
public boolean readBoolean() throws IOException {
this.d++;
return this.e.readBoolean();
}
@Override // java.io.DataInput
public char readChar() throws IOException {
this.d += 2;
return this.e.readChar();
}
@Override // java.io.DataInput
public String readUTF() throws IOException {
this.d += 2;
return this.e.readUTF();
}
@Override // java.io.DataInput
public void readFully(byte[] bArr, int i, int i2) throws IOException {
this.d += i2;
this.e.readFully(bArr, i, i2);
}
@Override // java.io.DataInput
public void readFully(byte[] bArr) throws IOException {
this.d += bArr.length;
this.e.readFully(bArr);
}
@Override // java.io.DataInput
public byte readByte() throws IOException {
this.d++;
int read = this.e.read();
if (read >= 0) {
return (byte) read;
}
throw new EOFException();
}
@Override // java.io.DataInput
public short readShort() throws IOException {
this.d += 2;
int read = this.e.read();
int read2 = this.e.read();
if ((read | read2) < 0) {
throw new EOFException();
}
ByteOrder byteOrder = this.a;
if (byteOrder == b) {
return (short) ((read2 << 8) + read);
}
if (byteOrder == c) {
return (short) ((read << 8) + read2);
}
StringBuilder sb = new StringBuilder("Invalid byte order: ");
sb.append(this.a);
throw new IOException(sb.toString());
}
@Override // java.io.DataInput
public int readInt() throws IOException {
this.d += 4;
int read = this.e.read();
int read2 = this.e.read();
int read3 = this.e.read();
int read4 = this.e.read();
if ((read | read2 | read3 | read4) < 0) {
throw new EOFException();
}
ByteOrder byteOrder = this.a;
if (byteOrder == b) {
return (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
}
if (byteOrder == c) {
return (read << 24) + (read2 << 16) + (read3 << 8) + read4;
}
StringBuilder sb = new StringBuilder("Invalid byte order: ");
sb.append(this.a);
throw new IOException(sb.toString());
}
@Override // java.io.DataInput
public int skipBytes(int i) throws IOException {
throw new UnsupportedOperationException("skipBytes is currently unsupported");
}
public final void a(int i) throws IOException {
int i2 = 0;
while (i2 < i) {
int i3 = i - i2;
int skip = (int) this.e.skip(i3);
if (skip <= 0) {
if (this.g == null) {
this.g = new byte[8192];
}
skip = this.e.read(this.g, 0, Math.min(8192, i3));
if (skip == -1) {
StringBuilder sb = new StringBuilder("Reached EOF while skipping ");
sb.append(i);
sb.append(" bytes.");
throw new EOFException(sb.toString());
}
}
i2 += skip;
}
this.d += i2;
}
@Override // java.io.DataInput
public int readUnsignedShort() throws IOException {
this.d += 2;
int read = this.e.read();
int read2 = this.e.read();
if ((read | read2) < 0) {
throw new EOFException();
}
ByteOrder byteOrder = this.a;
if (byteOrder == b) {
return (read2 << 8) + read;
}
if (byteOrder == c) {
return (read << 8) + read2;
}
StringBuilder sb = new StringBuilder("Invalid byte order: ");
sb.append(this.a);
throw new IOException(sb.toString());
}
@Override // java.io.DataInput
public long readLong() throws IOException {
this.d += 8;
int read = this.e.read();
int read2 = this.e.read();
int read3 = this.e.read();
int read4 = this.e.read();
int read5 = this.e.read();
int read6 = this.e.read();
int read7 = this.e.read();
int read8 = this.e.read();
if ((read | read2 | read3 | read4 | read5 | read6 | read7 | read8) < 0) {
throw new EOFException();
}
ByteOrder byteOrder = this.a;
if (byteOrder == b) {
return (read8 << 56) + (read7 << 48) + (read6 << 40) + (read5 << 32) + (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
}
if (byteOrder == c) {
return (read << 56) + (read2 << 48) + (read3 << 40) + (read4 << 32) + (read5 << 24) + (read6 << 16) + (read7 << 8) + read8;
}
StringBuilder sb = new StringBuilder("Invalid byte order: ");
sb.append(this.a);
throw new IOException(sb.toString());
}
@Override // java.io.DataInput
public float readFloat() throws IOException {
return Float.intBitsToFloat(readInt());
}
@Override // java.io.DataInput
public double readDouble() throws IOException {
return Double.longBitsToDouble(readLong());
}
@Override // java.io.InputStream
public void mark(int i) {
throw new UnsupportedOperationException("Mark is currently unsupported");
}
@Override // java.io.InputStream
public void reset() {
throw new UnsupportedOperationException("Reset is currently unsupported");
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class IeS extends FilterOutputStream {
ByteOrder c;
final OutputStream e;
public IeS(OutputStream outputStream, ByteOrder byteOrder) {
super(outputStream);
this.e = outputStream;
this.c = byteOrder;
}
@Override // java.io.FilterOutputStream, java.io.OutputStream
public final void write(byte[] bArr) throws IOException {
this.e.write(bArr);
}
@Override // java.io.FilterOutputStream, java.io.OutputStream
public final void write(byte[] bArr, int i, int i2) throws IOException {
this.e.write(bArr, i, i2);
}
public final void b(short s) throws IOException {
if (this.c == ByteOrder.LITTLE_ENDIAN) {
this.e.write(s & 255);
this.e.write((s >>> 8) & 255);
} else if (this.c == ByteOrder.BIG_ENDIAN) {
this.e.write((s >>> 8) & 255);
this.e.write(s & 255);
}
}
public final void e(int i) throws IOException {
if (this.c == ByteOrder.LITTLE_ENDIAN) {
this.e.write(i & 255);
this.e.write((i >>> 8) & 255);
this.e.write((i >>> 16) & 255);
this.e.write(i >>> 24);
return;
}
if (this.c == ByteOrder.BIG_ENDIAN) {
this.e.write(i >>> 24);
this.e.write((i >>> 16) & 255);
this.e.write((i >>> 8) & 255);
this.e.write(i & 255);
}
}
}
private void a(int i2, int i3) throws IOException {
if (this.O[i2].isEmpty() || this.O[i3].isEmpty()) {
return;
}
Sts sts = this.O[i2].get("ImageLength");
Sts sts2 = this.O[i2].get("ImageWidth");
Sts sts3 = this.O[i3].get("ImageLength");
Sts sts4 = this.O[i3].get("ImageWidth");
if (sts == null || sts2 == null || sts3 == null || sts4 == null) {
return;
}
int c2 = sts.c(this.Q);
int c3 = sts2.c(this.Q);
int c4 = sts3.c(this.Q);
int c5 = sts4.c(this.Q);
if (c2 >= c4 || c3 >= c5) {
return;
}
HashMap<String, Sts>[] hashMapArr = this.O;
HashMap<String, Sts> hashMap = hashMapArr[i2];
hashMapArr[i2] = hashMapArr[i3];
hashMapArr[i3] = hashMap;
}
private void e(int i2, String str, String str2) {
if (this.O[i2].isEmpty() || this.O[i2].get(str) == null) {
return;
}
HashMap<String, Sts> hashMap = this.O[i2];
hashMap.put(str2, hashMap.get(str));
this.O[i2].remove(str);
}
}