Proxy Master v3.4.9版本的 MD5 值为:14d0aa2468d13530c8f6e96bcc114bf5

以下内容为反编译后的 a.java 源代码,内容仅作参考


package s0;

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 com.chad.library.adapter.base.BaseQuickAdapter;
import com.google.common.base.Ascii;
import io.appmetrica.analytics.coreutils.internal.StringUtils;
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.IOException;
import java.io.InputStream;
import java.io.Serializable;
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.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.TimeZone;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
import org.apache.commons.net.bsd.RCommandClient;
import org.apache.commons.net.bsd.RLoginClient;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.commons.net.telnet.TelnetCommand;
import s0.b;
public final class a {
    public static final String[] E;
    public static final int[] F;
    public static final byte[] G;
    public static final d H;
    public static final d[][] I;
    public static final d[] J;
    public static final HashMap<Integer, d>[] K;
    public static final HashMap<String, d>[] L;
    public static final HashSet<String> M;
    public static final HashMap<Integer, Integer> N;
    public static final Charset O;
    public static final byte[] P;
    public static final byte[] Q;
    public String f30878a;
    public FileDescriptor f30879b;
    public AssetManager.AssetInputStream f30880c;
    public int f30881d;
    public final HashMap<String, c>[] f30882e;
    public final HashSet f30883f;
    public ByteOrder f30884g;
    public boolean f30885h;
    public int f30886i;
    public int f30887j;
    public int f30888k;
    public int f30889l;
    public static final boolean f30864m = Log.isLoggable("ExifInterface", 3);
    public static final List<Integer> f30865n = Arrays.asList(1, 6, 3, 8);
    public static final List<Integer> f30866o = Arrays.asList(2, 7, 4, 5);
    public static final int[] f30867p = {8, 8, 8};
    public static final int[] f30868q = {8};
    public static final byte[] f30869r = {-1, -40, -1};
    public static final byte[] f30870s = {102, 116, 121, 112};
    public static final byte[] f30871t = {109, 105, 102, 49};
    public static final byte[] f30872u = {104, 101, 105, 99};
    public static final byte[] f30873v = {79, 76, 89, 77, 80, 0};
    public static final byte[] f30874w = {79, 76, 89, 77, 80, 85, 83, 0, 73, 73};
    public static final byte[] f30875x = {-119, 80, 78, 71, Ascii.CR, 10, Ascii.SUB, 10};
    public static final byte[] f30876y = {101, 88, 73, 102};
    public static final byte[] f30877z = {73, 72, 68, 82};
    public static final byte[] A = {73, 69, 78, 68};
    public static final byte[] B = {82, 73, 70, 70};
    public static final byte[] C = {87, 69, 66, 80};
    public static final byte[] D = {69, 88, 73, 70};

    public class C0308a extends MediaDataSource {
        public long f30890b;
        public final f f30891c;

        public C0308a(f fVar) {
            this.f30891c = fVar;
        }

        @Override
        public final void close() {
        }

        @Override
        public final long getSize() {
            return -1L;
        }

        @Override
        public final int readAt(long j10, byte[] bArr, int i10, int i11) {
            if (i11 == 0) {
                return 0;
            }
            if (j10 < 0) {
                return -1;
            }
            try {
                long j11 = this.f30890b;
                int i12 = (j11 > j10 ? 1 : (j11 == j10 ? 0 : -1));
                f fVar = this.f30891c;
                if (i12 != 0) {
                    if (j11 >= 0 && j10 >= j11 + fVar.available()) {
                        return -1;
                    }
                    fVar.b(j10);
                    this.f30890b = j10;
                }
                if (i11 > fVar.available()) {
                    i11 = fVar.available();
                }
                int read = fVar.read(bArr, i10, i11);
                if (read >= 0) {
                    this.f30890b += read;
                    return read;
                }
            } catch (IOException unused) {
            }
            this.f30890b = -1L;
            return -1;
        }
    }

    public static class b extends InputStream implements DataInput {
        public static final ByteOrder f30892f = ByteOrder.LITTLE_ENDIAN;
        public static final ByteOrder f30893g = ByteOrder.BIG_ENDIAN;
        public final DataInputStream f30894b;
        public ByteOrder f30895c;
        public int f30896d;
        public byte[] f30897e;

        public b(InputStream inputStream) {
            this(inputStream, ByteOrder.BIG_ENDIAN);
        }

        public b(InputStream inputStream, ByteOrder byteOrder) {
            this.f30895c = ByteOrder.BIG_ENDIAN;
            DataInputStream dataInputStream = new DataInputStream(inputStream);
            this.f30894b = dataInputStream;
            dataInputStream.mark(0);
            this.f30896d = 0;
            this.f30895c = byteOrder;
        }

        public b(byte[] bArr) {
            this(new ByteArrayInputStream(bArr), ByteOrder.BIG_ENDIAN);
        }

        public final void a(int i10) {
            int i11 = 0;
            while (i11 < i10) {
                DataInputStream dataInputStream = this.f30894b;
                int i12 = i10 - i11;
                int skip = (int) dataInputStream.skip(i12);
                if (skip <= 0) {
                    if (this.f30897e == null) {
                        this.f30897e = new byte[8192];
                    }
                    skip = dataInputStream.read(this.f30897e, 0, Math.min(8192, i12));
                    if (skip == -1) {
                        throw new EOFException(android.support.v4.media.b.j("Reached EOF while skipping ", i10, " bytes."));
                    }
                }
                i11 += skip;
            }
            this.f30896d += i11;
        }

        @Override
        public final int available() {
            return this.f30894b.available();
        }

        @Override
        public final void mark(int i10) {
            throw new UnsupportedOperationException("Mark is currently unsupported");
        }

        @Override
        public final int read() {
            this.f30896d++;
            return this.f30894b.read();
        }

        @Override
        public final int read(byte[] bArr, int i10, int i11) {
            int read = this.f30894b.read(bArr, i10, i11);
            this.f30896d += read;
            return read;
        }

        @Override
        public final boolean readBoolean() {
            this.f30896d++;
            return this.f30894b.readBoolean();
        }

        @Override
        public final byte readByte() {
            this.f30896d++;
            int read = this.f30894b.read();
            if (read >= 0) {
                return (byte) read;
            }
            throw new EOFException();
        }

        @Override
        public final char readChar() {
            this.f30896d += 2;
            return this.f30894b.readChar();
        }

        @Override
        public final double readDouble() {
            return Double.longBitsToDouble(readLong());
        }

        @Override
        public final float readFloat() {
            return Float.intBitsToFloat(readInt());
        }

        @Override
        public final void readFully(byte[] bArr) {
            this.f30896d += bArr.length;
            this.f30894b.readFully(bArr);
        }

        @Override
        public final void readFully(byte[] bArr, int i10, int i11) {
            this.f30896d += i11;
            this.f30894b.readFully(bArr, i10, i11);
        }

        @Override
        public final int readInt() {
            this.f30896d += 4;
            DataInputStream dataInputStream = this.f30894b;
            int read = dataInputStream.read();
            int read2 = dataInputStream.read();
            int read3 = dataInputStream.read();
            int read4 = dataInputStream.read();
            if ((read | read2 | read3 | read4) >= 0) {
                ByteOrder byteOrder = this.f30895c;
                if (byteOrder == f30892f) {
                    return (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
                }
                if (byteOrder == f30893g) {
                    return (read << 24) + (read2 << 16) + (read3 << 8) + read4;
                }
                throw new IOException("Invalid byte order: " + this.f30895c);
            }
            throw new EOFException();
        }

        @Override
        public final String readLine() {
            return null;
        }

        @Override
        public final long readLong() {
            this.f30896d += 8;
            DataInputStream dataInputStream = this.f30894b;
            int read = dataInputStream.read();
            int read2 = dataInputStream.read();
            int read3 = dataInputStream.read();
            int read4 = dataInputStream.read();
            int read5 = dataInputStream.read();
            int read6 = dataInputStream.read();
            int read7 = dataInputStream.read();
            int read8 = dataInputStream.read();
            if ((read | read2 | read3 | read4 | read5 | read6 | read7 | read8) >= 0) {
                ByteOrder byteOrder = this.f30895c;
                if (byteOrder == f30892f) {
                    return (read8 << 56) + (read7 << 48) + (read6 << 40) + (read5 << 32) + (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
                }
                if (byteOrder == f30893g) {
                    return (read << 56) + (read2 << 48) + (read3 << 40) + (read4 << 32) + (read5 << 24) + (read6 << 16) + (read7 << 8) + read8;
                }
                throw new IOException("Invalid byte order: " + this.f30895c);
            }
            throw new EOFException();
        }

        @Override
        public final short readShort() {
            this.f30896d += 2;
            DataInputStream dataInputStream = this.f30894b;
            int read = dataInputStream.read();
            int read2 = dataInputStream.read();
            if ((read | read2) >= 0) {
                ByteOrder byteOrder = this.f30895c;
                if (byteOrder == f30892f) {
                    return (short) ((read2 << 8) + read);
                }
                if (byteOrder == f30893g) {
                    return (short) ((read << 8) + read2);
                }
                throw new IOException("Invalid byte order: " + this.f30895c);
            }
            throw new EOFException();
        }

        @Override
        public final String readUTF() {
            this.f30896d += 2;
            return this.f30894b.readUTF();
        }

        @Override
        public final int readUnsignedByte() {
            this.f30896d++;
            return this.f30894b.readUnsignedByte();
        }

        @Override
        public final int readUnsignedShort() {
            this.f30896d += 2;
            DataInputStream dataInputStream = this.f30894b;
            int read = dataInputStream.read();
            int read2 = dataInputStream.read();
            if ((read | read2) >= 0) {
                ByteOrder byteOrder = this.f30895c;
                if (byteOrder == f30892f) {
                    return (read2 << 8) + read;
                }
                if (byteOrder == f30893g) {
                    return (read << 8) + read2;
                }
                throw new IOException("Invalid byte order: " + this.f30895c);
            }
            throw new EOFException();
        }

        @Override
        public final void reset() {
            throw new UnsupportedOperationException("Reset is currently unsupported");
        }

        @Override
        public final int skipBytes(int i10) {
            throw new UnsupportedOperationException("skipBytes is currently unsupported");
        }
    }

    public static class c {
        public final int f30898a;
        public final int f30899b;
        public final long f30900c;
        public final byte[] f30901d;

        public c(int i10, int i11, byte[] bArr) {
            this(-1L, bArr, i10, i11);
        }

        public c(long j10, byte[] bArr, int i10, int i11) {
            this.f30898a = i10;
            this.f30899b = i11;
            this.f30900c = j10;
            this.f30901d = bArr;
        }

        public static c a(String str) {
            byte[] bytes = str.concat("\u0000").getBytes(a.O);
            return new c(2, bytes.length, bytes);
        }

        public static c b(long j10, ByteOrder byteOrder) {
            long[] jArr = {j10};
            ByteBuffer wrap = ByteBuffer.wrap(new byte[a.F[4] * 1]);
            wrap.order(byteOrder);
            wrap.putInt((int) jArr[0]);
            return new c(4, 1, wrap.array());
        }

        public static c c(e eVar, ByteOrder byteOrder) {
            e[] eVarArr = {eVar};
            ByteBuffer wrap = ByteBuffer.wrap(new byte[a.F[5] * 1]);
            wrap.order(byteOrder);
            e eVar2 = eVarArr[0];
            wrap.putInt((int) eVar2.f30906a);
            wrap.putInt((int) eVar2.f30907b);
            return new c(5, 1, wrap.array());
        }

        public static c d(int i10, ByteOrder byteOrder) {
            int[] iArr = {i10};
            ByteBuffer wrap = ByteBuffer.wrap(new byte[a.F[3] * 1]);
            wrap.order(byteOrder);
            wrap.putShort((short) iArr[0]);
            return new c(3, 1, wrap.array());
        }

        public final double e(ByteOrder byteOrder) {
            Serializable h10 = h(byteOrder);
            if (h10 != null) {
                if (h10 instanceof String) {
                    return Double.parseDouble((String) h10);
                }
                if (h10 instanceof long[]) {
                    long[] jArr = (long[]) h10;
                    if (jArr.length == 1) {
                        return jArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else if (h10 instanceof int[]) {
                    int[] iArr = (int[]) h10;
                    if (iArr.length == 1) {
                        return iArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else if (h10 instanceof double[]) {
                    double[] dArr = (double[]) h10;
                    if (dArr.length == 1) {
                        return dArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else if (h10 instanceof e[]) {
                    e[] eVarArr = (e[]) h10;
                    if (eVarArr.length == 1) {
                        e eVar = eVarArr[0];
                        return eVar.f30906a / eVar.f30907b;
                    }
                    throw new NumberFormatException("There are more than one component");
                } else {
                    throw new NumberFormatException("Couldn't find a double value");
                }
            }
            throw new NumberFormatException("NULL can't be converted to a double value");
        }

        public final int f(ByteOrder byteOrder) {
            Serializable h10 = h(byteOrder);
            if (h10 != null) {
                if (h10 instanceof String) {
                    return Integer.parseInt((String) h10);
                }
                if (h10 instanceof long[]) {
                    long[] jArr = (long[]) h10;
                    if (jArr.length == 1) {
                        return (int) jArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else if (h10 instanceof int[]) {
                    int[] iArr = (int[]) h10;
                    if (iArr.length == 1) {
                        return iArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else {
                    throw new NumberFormatException("Couldn't find a integer value");
                }
            }
            throw new NumberFormatException("NULL can't be converted to a integer value");
        }

        public final String g(ByteOrder byteOrder) {
            Serializable h10 = h(byteOrder);
            if (h10 == null) {
                return null;
            }
            if (h10 instanceof String) {
                return (String) h10;
            }
            StringBuilder sb2 = new StringBuilder();
            int i10 = 0;
            if (h10 instanceof long[]) {
                long[] jArr = (long[]) h10;
                while (i10 < jArr.length) {
                    sb2.append(jArr[i10]);
                    i10++;
                    if (i10 != jArr.length) {
                        sb2.append(StringUtils.COMMA);
                    }
                }
                return sb2.toString();
            } else if (h10 instanceof int[]) {
                int[] iArr = (int[]) h10;
                while (i10 < iArr.length) {
                    sb2.append(iArr[i10]);
                    i10++;
                    if (i10 != iArr.length) {
                        sb2.append(StringUtils.COMMA);
                    }
                }
                return sb2.toString();
            } else if (h10 instanceof double[]) {
                double[] dArr = (double[]) h10;
                while (i10 < dArr.length) {
                    sb2.append(dArr[i10]);
                    i10++;
                    if (i10 != dArr.length) {
                        sb2.append(StringUtils.COMMA);
                    }
                }
                return sb2.toString();
            } else if (h10 instanceof e[]) {
                e[] eVarArr = (e[]) h10;
                while (i10 < eVarArr.length) {
                    sb2.append(eVarArr[i10].f30906a);
                    sb2.append('/');
                    sb2.append(eVarArr[i10].f30907b);
                    i10++;
                    if (i10 != eVarArr.length) {
                        sb2.append(StringUtils.COMMA);
                    }
                }
                return sb2.toString();
            } else {
                return null;
            }
        }

        public final Serializable h(ByteOrder byteOrder) {
            b bVar;
            byte b6;
            byte[] bArr;
            byte[] bArr2 = this.f30901d;
            b bVar2 = null;
            try {
                bVar = new b(bArr2);
                try {
                    bVar.f30895c = byteOrder;
                    int i10 = this.f30898a;
                    boolean z6 = true;
                    int i11 = 0;
                    int i12 = this.f30899b;
                    switch (i10) {
                        case 1:
                        case 6:
                            if (bArr2.length != 1 || (b6 = bArr2[0]) < 0 || b6 > 1) {
                                String str = new String(bArr2, a.O);
                                try {
                                    bVar.close();
                                } catch (IOException unused) {
                                }
                                return str;
                            }
                            String str2 = new String(new char[]{(char) (b6 + 48)});
                            try {
                                bVar.close();
                            } catch (IOException unused2) {
                            }
                            return str2;
                        case 2:
                        case 7:
                            if (i12 >= a.G.length) {
                                int i13 = 0;
                                while (true) {
                                    bArr = a.G;
                                    if (i13 < bArr.length) {
                                        if (bArr2[i13] != bArr[i13]) {
                                            z6 = false;
                                        } else {
                                            i13++;
                                        }
                                    }
                                }
                                if (z6) {
                                    i11 = bArr.length;
                                }
                            }
                            StringBuilder sb2 = new StringBuilder();
                            while (i11 < i12) {
                                byte b10 = bArr2[i11];
                                if (b10 == 0) {
                                    String sb3 = sb2.toString();
                                    bVar.close();
                                    return sb3;
                                }
                                if (b10 >= 32) {
                                    sb2.append((char) b10);
                                } else {
                                    sb2.append('?');
                                }
                                i11++;
                            }
                            String sb32 = sb2.toString();
                            bVar.close();
                            return sb32;
                        case 3:
                            ?? r13 = new int[i12];
                            while (i11 < i12) {
                                r13[i11] = bVar.readUnsignedShort();
                                i11++;
                            }
                            try {
                                bVar.close();
                            } catch (IOException unused3) {
                            }
                            return r13;
                        case 4:
                            ?? r132 = new long[i12];
                            while (i11 < i12) {
                                r132[i11] = bVar.readInt() & 4294967295L;
                                i11++;
                            }
                            try {
                                bVar.close();
                            } catch (IOException unused4) {
                            }
                            return r132;
                        case 5:
                            ?? r133 = new e[i12];
                            while (i11 < i12) {
                                r133[i11] = new e(bVar.readInt() & 4294967295L, bVar.readInt() & 4294967295L);
                                i11++;
                            }
                            try {
                                bVar.close();
                            } catch (IOException unused5) {
                            }
                            return r133;
                        case 8:
                            ?? r134 = new int[i12];
                            while (i11 < i12) {
                                r134[i11] = bVar.readShort();
                                i11++;
                            }
                            try {
                                bVar.close();
                            } catch (IOException unused6) {
                            }
                            return r134;
                        case 9:
                            ?? r135 = new int[i12];
                            while (i11 < i12) {
                                r135[i11] = bVar.readInt();
                                i11++;
                            }
                            try {
                                bVar.close();
                            } catch (IOException unused7) {
                            }
                            return r135;
                        case 10:
                            ?? r136 = new e[i12];
                            while (i11 < i12) {
                                r136[i11] = new e(bVar.readInt(), bVar.readInt());
                                i11++;
                            }
                            try {
                                bVar.close();
                            } catch (IOException unused8) {
                            }
                            return r136;
                        case 11:
                            ?? r137 = new double[i12];
                            while (i11 < i12) {
                                r137[i11] = bVar.readFloat();
                                i11++;
                            }
                            try {
                                bVar.close();
                            } catch (IOException unused9) {
                            }
                            return r137;
                        case 12:
                            ?? r138 = new double[i12];
                            while (i11 < i12) {
                                r138[i11] = bVar.readDouble();
                                i11++;
                            }
                            try {
                                bVar.close();
                            } catch (IOException unused10) {
                            }
                            return r138;
                        default:
                            try {
                                bVar.close();
                            } catch (IOException unused11) {
                            }
                            return null;
                    }
                } catch (IOException unused12) {
                    if (bVar != null) {
                        try {
                            bVar.close();
                        } catch (IOException unused13) {
                        }
                    }
                    return null;
                } catch (Throwable th) {
                    th = th;
                    bVar2 = bVar;
                    if (bVar2 != null) {
                        try {
                            bVar2.close();
                        } catch (IOException unused14) {
                        }
                    }
                    throw th;
                }
            } catch (IOException unused15) {
                bVar = null;
            } catch (Throwable th2) {
                th = th2;
            }
        }

        public final String toString() {
            StringBuilder sb2 = new StringBuilder("(");
            sb2.append(a.E[this.f30898a]);
            sb2.append(", data length:");
            return a.a.q(sb2, this.f30901d.length, ")");
        }
    }

    public static class d {
        public final int f30902a;
        public final String f30903b;
        public final int f30904c;
        public final int f30905d;

        public d(String str, int i10, int i11) {
            this.f30903b = str;
            this.f30902a = i10;
            this.f30904c = i11;
            this.f30905d = -1;
        }

        public d(String str, int i10, int i11, int i12) {
            this.f30903b = str;
            this.f30902a = i10;
            this.f30904c = i11;
            this.f30905d = i12;
        }
    }

    public static class e {
        public final long f30906a;
        public final long f30907b;

        public e(long j10, long j11) {
            if (j11 == 0) {
                this.f30906a = 0L;
                this.f30907b = 1L;
                return;
            }
            this.f30906a = j10;
            this.f30907b = j11;
        }

        public final String toString() {
            return this.f30906a + "/" + this.f30907b;
        }
    }

    public static class f extends b {
        public f(InputStream inputStream) {
            super(inputStream);
            if (!inputStream.markSupported()) {
                throw new IllegalArgumentException("Cannot create SeekableByteOrderedDataInputStream with stream that does not support mark/reset");
            }
            this.f30894b.mark(Integer.MAX_VALUE);
        }

        public f(byte[] bArr) {
            super(bArr);
            this.f30894b.mark(Integer.MAX_VALUE);
        }

        public final void b(long j10) {
            int i10 = this.f30896d;
            if (i10 > j10) {
                this.f30896d = 0;
                this.f30894b.reset();
            } else {
                j10 -= i10;
            }
            a((int) j10);
        }
    }

    static {
        d[] dVarArr;
        "VP8X".getBytes(Charset.defaultCharset());
        "VP8L".getBytes(Charset.defaultCharset());
        "VP8 ".getBytes(Charset.defaultCharset());
        "ANIM".getBytes(Charset.defaultCharset());
        "ANMF".getBytes(Charset.defaultCharset());
        E = new String[]{"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};
        F = new int[]{0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
        G = new byte[]{65, 83, 67, 73, 73, 0, 0, 0};
        d[] dVarArr2 = {new d("NewSubfileType", TelnetCommand.DONT, 4), new d("SubfileType", 255, 4), new d("ImageWidth", 256, 3, 4), new d("ImageLength", 257, 3, 4), new d("BitsPerSample", 258, 3), new d("Compression", 259, 3), new d("PhotometricInterpretation", 262, 3), new d("ImageDescription", 270, 2), new d("Make", 271, 2), new d("Model", 272, 2), new d("StripOffsets", BaseQuickAdapter.HEADER_VIEW, 3, 4), new d("Orientation", 274, 3), new d("SamplesPerPixel", 277, 3), new d("RowsPerStrip", 278, 3, 4), new d("StripByteCounts", 279, 3, 4), new d("XResolution", 282, 5), new d("YResolution", 283, 5), new d("PlanarConfiguration", 284, 3), new d("ResolutionUnit", 296, 3), new d("TransferFunction", 301, 3), new d("Software", 305, 2), new d("DateTime", 306, 2), new d("Artist", 315, 2), new d("WhitePoint", 318, 5), new d("PrimaryChromaticities", 319, 5), new d("SubIFDPointer", 330, 4), new d("JPEGInterchangeFormat", RLoginClient.DEFAULT_PORT, 4), new d("JPEGInterchangeFormatLength", RCommandClient.DEFAULT_PORT, 4), new d("YCbCrCoefficients", 529, 5), new d("YCbCrSubSampling", FTPReply.NOT_LOGGED_IN, 3), new d("YCbCrPositioning", 531, 3), new d("ReferenceBlackWhite", FTPReply.NEED_ACCOUNT_FOR_STORING_FILES, 5), new d("Copyright", 33432, 2), new d("ExifIFDPointer", 34665, 4), new d("GPSInfoIFDPointer", 34853, 4), new d("SensorTopBorder", 4, 4), new d("SensorLeftBorder", 5, 4), new d("SensorBottomBorder", 6, 4), new d("SensorRightBorder", 7, 4), new d("ISO", 23, 3), new d("JpgFromRaw", 46, 7), new d("Xmp", 700, 1)};
        d[] dVarArr3 = {new d("ExposureTime", 33434, 5), new d("FNumber", 33437, 5), new d("ExposureProgram", 34850, 3), new d("SpectralSensitivity", 34852, 2), new d("PhotographicSensitivity", 34855, 3), new d("OECF", 34856, 7), new d("SensitivityType", 34864, 3), new d("StandardOutputSensitivity", 34865, 4), new d("RecommendedExposureIndex", 34866, 4), new d("ISOSpeed", 34867, 4), new d("ISOSpeedLatitudeyyy", 34868, 4), new d("ISOSpeedLatitudezzz", 34869, 4), new d("ExifVersion", 36864, 2), new d("DateTimeOriginal", 36867, 2), new d("DateTimeDigitized", 36868, 2), new d("OffsetTime", 36880, 2), new d("OffsetTimeOriginal", 36881, 2), new d("OffsetTimeDigitized", 36882, 2), new d("ComponentsConfiguration", 37121, 7), new d("CompressedBitsPerPixel", 37122, 5), new d("ShutterSpeedValue", 37377, 10), new d("ApertureValue", 37378, 5), new d("BrightnessValue", 37379, 10), new d("ExposureBiasValue", 37380, 10), new d("MaxApertureValue", 37381, 5), new d("SubjectDistance", 37382, 5), new d("MeteringMode", 37383, 3), new d("LightSource", 37384, 3), new d("Flash", 37385, 3), new d("FocalLength", 37386, 5), new d("SubjectArea", 37396, 3), new d("MakerNote", 37500, 7), new d("UserComment", 37510, 7), new d("SubSecTime", 37520, 2), new d("SubSecTimeOriginal", 37521, 2), new d("SubSecTimeDigitized", 37522, 2), new d("FlashpixVersion", 40960, 7), new d("ColorSpace", 40961, 3), new d("PixelXDimension", 40962, 3, 4), new d("PixelYDimension", 40963, 3, 4), new d("RelatedSoundFile", 40964, 2), new d("InteroperabilityIFDPointer", 40965, 4), new d("FlashEnergy", 41483, 5), new d("SpatialFrequencyResponse", 41484, 7), new d("FocalPlaneXResolution", 41486, 5), new d("FocalPlaneYResolution", 41487, 5), new d("FocalPlaneResolutionUnit", 41488, 3), new d("SubjectLocation", 41492, 3), new d("ExposureIndex", 41493, 5), new d("SensingMethod", 41495, 3), new d("FileSource", 41728, 7), new d("SceneType", 41729, 7), new d("CFAPattern", 41730, 7), new d("CustomRendered", 41985, 3), new d("ExposureMode", 41986, 3), new d("WhiteBalance", 41987, 3), new d("DigitalZoomRatio", 41988, 5), new d("FocalLengthIn35mmFilm", 41989, 3), new d("SceneCaptureType", 41990, 3), new d("GainControl", 41991, 3), new d("Contrast", 41992, 3), new d("Saturation", 41993, 3), new d("Sharpness", 41994, 3), new d("DeviceSettingDescription", 41995, 7), new d("SubjectDistanceRange", 41996, 3), new d("ImageUniqueID", 42016, 2), new d("CameraOwnerName", 42032, 2), new d("BodySerialNumber", 42033, 2), new d("LensSpecification", 42034, 5), new d("LensMake", 42035, 2), new d("LensModel", 42036, 2), new d("Gamma", 42240, 5), new d("DNGVersion", 50706, 1), new d("DefaultCropSize", 50720, 3, 4)};
        d[] dVarArr4 = {new d("GPSVersionID", 0, 1), new d("GPSLatitudeRef", 1, 2), new d("GPSLatitude", 2, 5, 10), new d("GPSLongitudeRef", 3, 2), new d("GPSLongitude", 4, 5, 10), new d("GPSAltitudeRef", 5, 1), new d("GPSAltitude", 6, 5), new d("GPSTimeStamp", 7, 5), new d("GPSSatellites", 8, 2), new d("GPSStatus", 9, 2), new d("GPSMeasureMode", 10, 2), new d("GPSDOP", 11, 5), new d("GPSSpeedRef", 12, 2), new d("GPSSpeed", 13, 5), new d("GPSTrackRef", 14, 2), new d("GPSTrack", 15, 5), new d("GPSImgDirectionRef", 16, 2), new d("GPSImgDirection", 17, 5), new d("GPSMapDatum", 18, 2), new d("GPSDestLatitudeRef", 19, 2), new d("GPSDestLatitude", 20, 5), new d("GPSDestLongitudeRef", 21, 2), new d("GPSDestLongitude", 22, 5), new d("GPSDestBearingRef", 23, 2), new d("GPSDestBearing", 24, 5), new d("GPSDestDistanceRef", 25, 2), new d("GPSDestDistance", 26, 5), new d("GPSProcessingMethod", 27, 7), new d("GPSAreaInformation", 28, 7), new d("GPSDateStamp", 29, 2), new d("GPSDifferential", 30, 3), new d("GPSHPositioningError", 31, 5)};
        d[] dVarArr5 = {new d("InteroperabilityIndex", 1, 2)};
        d[] dVarArr6 = {new d("NewSubfileType", TelnetCommand.DONT, 4), new d("SubfileType", 255, 4), new d("ThumbnailImageWidth", 256, 3, 4), new d("ThumbnailImageLength", 257, 3, 4), new d("BitsPerSample", 258, 3), new d("Compression", 259, 3), new d("PhotometricInterpretation", 262, 3), new d("ImageDescription", 270, 2), new d("Make", 271, 2), new d("Model", 272, 2), new d("StripOffsets", BaseQuickAdapter.HEADER_VIEW, 3, 4), new d("ThumbnailOrientation", 274, 3), new d("SamplesPerPixel", 277, 3), new d("RowsPerStrip", 278, 3, 4), new d("StripByteCounts", 279, 3, 4), new d("XResolution", 282, 5), new d("YResolution", 283, 5), new d("PlanarConfiguration", 284, 3), new d("ResolutionUnit", 296, 3), new d("TransferFunction", 301, 3), new d("Software", 305, 2), new d("DateTime", 306, 2), new d("Artist", 315, 2), new d("WhitePoint", 318, 5), new d("PrimaryChromaticities", 319, 5), new d("SubIFDPointer", 330, 4), new d("JPEGInterchangeFormat", RLoginClient.DEFAULT_PORT, 4), new d("JPEGInterchangeFormatLength", RCommandClient.DEFAULT_PORT, 4), new d("YCbCrCoefficients", 529, 5), new d("YCbCrSubSampling", FTPReply.NOT_LOGGED_IN, 3), new d("YCbCrPositioning", 531, 3), new d("ReferenceBlackWhite", FTPReply.NEED_ACCOUNT_FOR_STORING_FILES, 5), new d("Xmp", 700, 1), new d("Copyright", 33432, 2), new d("ExifIFDPointer", 34665, 4), new d("GPSInfoIFDPointer", 34853, 4), new d("DNGVersion", 50706, 1), new d("DefaultCropSize", 50720, 3, 4)};
        H = new d("StripOffsets", BaseQuickAdapter.HEADER_VIEW, 3);
        I = new d[][]{dVarArr2, dVarArr3, dVarArr4, dVarArr5, dVarArr6, dVarArr2, new d[]{new d("ThumbnailImage", 256, 7), new d("CameraSettingsIFDPointer", 8224, 4), new d("ImageProcessingIFDPointer", 8256, 4)}, new d[]{new d("PreviewImageStart", 257, 4), new d("PreviewImageLength", 258, 4)}, new d[]{new d("AspectFrame", 4371, 3)}, new d[]{new d("ColorSpace", 55, 3)}};
        J = new d[]{new d("SubIFDPointer", 330, 4), new d("ExifIFDPointer", 34665, 4), new d("GPSInfoIFDPointer", 34853, 4), new d("InteroperabilityIFDPointer", 40965, 4), new d("CameraSettingsIFDPointer", 8224, 1), new d("ImageProcessingIFDPointer", 8256, 1)};
        K = new HashMap[10];
        L = new HashMap[10];
        M = new HashSet<>(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp"));
        N = new HashMap<>();
        Charset forName = Charset.forName("US-ASCII");
        O = forName;
        P = "Exif\u0000\u0000".getBytes(forName);
        Q = "http://ns.adobe.com/xap/1.0/\u0000".getBytes(forName);
        Locale locale = Locale.US;
        new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", locale).setTimeZone(TimeZone.getTimeZone("UTC"));
        new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", locale).setTimeZone(TimeZone.getTimeZone("UTC"));
        int i10 = 0;
        while (true) {
            d[][] dVarArr7 = I;
            if (i10 >= dVarArr7.length) {
                HashMap<Integer, Integer> hashMap = N;
                d[] dVarArr8 = J;
                hashMap.put(Integer.valueOf(dVarArr8[0].f30902a), 5);
                hashMap.put(Integer.valueOf(dVarArr8[1].f30902a), 1);
                hashMap.put(Integer.valueOf(dVarArr8[2].f30902a), 2);
                hashMap.put(Integer.valueOf(dVarArr8[3].f30902a), 3);
                hashMap.put(Integer.valueOf(dVarArr8[4].f30902a), 7);
                hashMap.put(Integer.valueOf(dVarArr8[5].f30902a), 8);
                Pattern.compile(".*[1-9].*");
                Pattern.compile("^(\\d{2}):(\\d{2}):(\\d{2})$");
                Pattern.compile("^(\\d{4}):(\\d{2}):(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
                Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
                return;
            }
            K[i10] = new HashMap<>();
            L[i10] = new HashMap<>();
            for (d dVar : dVarArr7[i10]) {
                K[i10].put(Integer.valueOf(dVar.f30902a), dVar);
                L[i10].put(dVar.f30903b, dVar);
            }
            i10++;
        }
    }

    public a(InputStream inputStream) {
        boolean z6;
        d[][] dVarArr = I;
        this.f30882e = new HashMap[dVarArr.length];
        this.f30883f = new HashSet(dVarArr.length);
        this.f30884g = ByteOrder.BIG_ENDIAN;
        if (inputStream == null) {
            throw new NullPointerException("inputStream cannot be null");
        }
        this.f30878a = null;
        if (inputStream instanceof AssetManager.AssetInputStream) {
            this.f30880c = (AssetManager.AssetInputStream) inputStream;
            this.f30879b = null;
        } else {
            if (inputStream instanceof FileInputStream) {
                FileInputStream fileInputStream = (FileInputStream) inputStream;
                try {
                    b.a.c(fileInputStream.getFD(), 0L, OsConstants.SEEK_CUR);
                    z6 = true;
                } catch (Exception unused) {
                    z6 = false;
                }
                if (z6) {
                    this.f30880c = null;
                    this.f30879b = fileInputStream.getFD();
                }
            }
            this.f30880c = null;
            this.f30879b = null;
        }
        o(inputStream);
    }

    public a(String str) {
        boolean z6;
        d[][] dVarArr = I;
        this.f30882e = new HashMap[dVarArr.length];
        this.f30883f = new HashSet(dVarArr.length);
        this.f30884g = ByteOrder.BIG_ENDIAN;
        if (str == null) {
            throw new NullPointerException("filename cannot be null");
        }
        FileInputStream fileInputStream = null;
        this.f30880c = null;
        this.f30878a = str;
        try {
            FileInputStream fileInputStream2 = new FileInputStream(str);
            try {
                try {
                    b.a.c(fileInputStream2.getFD(), 0L, OsConstants.SEEK_CUR);
                    z6 = true;
                } catch (Exception unused) {
                    z6 = false;
                }
                if (z6) {
                    this.f30879b = fileInputStream2.getFD();
                } else {
                    this.f30879b = null;
                }
                o(fileInputStream2);
                try {
                    fileInputStream2.close();
                } catch (RuntimeException e10) {
                    throw e10;
                } catch (Exception unused2) {
                }
            } catch (Throwable th) {
                th = th;
                fileInputStream = fileInputStream2;
                if (fileInputStream != null) {
                    try {
                        fileInputStream.close();
                    } catch (RuntimeException e11) {
                        throw e11;
                    } catch (Exception unused3) {
                    }
                }
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    public static ByteOrder r(b bVar) {
        short readShort = bVar.readShort();
        if (readShort != 18761) {
            if (readShort == 19789) {
                return ByteOrder.BIG_ENDIAN;
            }
            throw new IOException(android.support.v4.media.a.e(readShort, new StringBuilder("Invalid byte order: ")));
        }
        return ByteOrder.LITTLE_ENDIAN;
    }

    public final void a() {
        String b6 = b("DateTimeOriginal");
        HashMap<String, c>[] hashMapArr = this.f30882e;
        if (b6 != null && b("DateTime") == null) {
            hashMapArr[0].put("DateTime", c.a(b6));
        }
        if (b("ImageWidth") == null) {
            hashMapArr[0].put("ImageWidth", c.b(0L, this.f30884g));
        }
        if (b("ImageLength") == null) {
            hashMapArr[0].put("ImageLength", c.b(0L, this.f30884g));
        }
        if (b("Orientation") == null) {
            hashMapArr[0].put("Orientation", c.b(0L, this.f30884g));
        }
        if (b("LightSource") == null) {
            hashMapArr[1].put("LightSource", c.b(0L, this.f30884g));
        }
    }

    public final String b(String str) {
        c c10 = c(str);
        if (c10 != null) {
            if (!M.contains(str)) {
                return c10.g(this.f30884g);
            }
            if (str.equals("GPSTimeStamp")) {
                int i10 = c10.f30898a;
                if (i10 == 5 || i10 == 10) {
                    e[] eVarArr = (e[]) c10.h(this.f30884g);
                    if (eVarArr == null || eVarArr.length != 3) {
                        Arrays.toString(eVarArr);
                        return null;
                    }
                    e eVar = eVarArr[0];
                    e eVar2 = eVarArr[1];
                    e eVar3 = eVarArr[2];
                    return String.format("%02d:%02d:%02d", Integer.valueOf((int) (((float) eVar.f30906a) / ((float) eVar.f30907b))), Integer.valueOf((int) (((float) eVar2.f30906a) / ((float) eVar2.f30907b))), Integer.valueOf((int) (((float) eVar3.f30906a) / ((float) eVar3.f30907b))));
                }
                return null;
            }
            try {
                return Double.toString(c10.e(this.f30884g));
            } catch (NumberFormatException unused) {
            }
        }
        return null;
    }

    public final c c(String str) {
        if ("ISOSpeedRatings".equals(str)) {
            str = "PhotographicSensitivity";
        }
        for (int i10 = 0; i10 < I.length; i10++) {
            c cVar = this.f30882e[i10].get(str);
            if (cVar != null) {
                return cVar;
            }
        }
        return null;
    }

    public final void d(f fVar) {
        String str;
        String str2;
        String str3;
        if (Build.VERSION.SDK_INT < 28) {
            throw new UnsupportedOperationException("Reading EXIF from HEIF files is supported from SDK 28 and above");
        }
        MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
        try {
            try {
                b.C0309b.a(mediaMetadataRetriever, new C0308a(fVar));
                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;
                }
                HashMap<String, c>[] hashMapArr = this.f30882e;
                if (str != null) {
                    hashMapArr[0].put("ImageWidth", c.d(Integer.parseInt(str), this.f30884g));
                }
                if (str2 != null) {
                    hashMapArr[0].put("ImageLength", c.d(Integer.parseInt(str2), this.f30884g));
                }
                if (str3 != null) {
                    int parseInt = Integer.parseInt(str3);
                    hashMapArr[0].put("Orientation", c.d(parseInt != 90 ? parseInt != 180 ? parseInt != 270 ? 1 : 8 : 3 : 6, this.f30884g));
                }
                if (extractMetadata != null && extractMetadata2 != null) {
                    int parseInt2 = Integer.parseInt(extractMetadata);
                    int parseInt3 = Integer.parseInt(extractMetadata2);
                    if (parseInt3 <= 6) {
                        throw new IOException("Invalid exif length");
                    }
                    fVar.b(parseInt2);
                    byte[] bArr = new byte[6];
                    if (fVar.read(bArr) != 6) {
                        throw new IOException("Can't read identifier");
                    }
                    int i10 = parseInt2 + 6;
                    int i11 = parseInt3 - 6;
                    if (!Arrays.equals(bArr, P)) {
                        throw new IOException("Invalid identifier");
                    }
                    byte[] bArr2 = new byte[i11];
                    if (fVar.read(bArr2) != i11) {
                        throw new IOException("Can't read exif");
                    }
                    this.f30886i = i10;
                    s(0, bArr2);
                }
            } catch (RuntimeException unused) {
                throw new UnsupportedOperationException("Failed to read EXIF from HEIF file. Given stream is either malformed or unsupported.");
            }
        } finally {
            mediaMetadataRetriever.release();
        }
    }

    public final void e(b bVar, int i10, int i11) {
        boolean z6;
        boolean z9 = f30864m;
        if (z9) {
            Objects.toString(bVar);
        }
        bVar.f30895c = ByteOrder.BIG_ENDIAN;
        byte readByte = bVar.readByte();
        byte b6 = -1;
        if (readByte != -1) {
            throw new IOException(android.support.v4.media.a.e(readByte & 255, new StringBuilder("Invalid marker: ")));
        } else if (bVar.readByte() != -40) {
            throw new IOException(android.support.v4.media.a.e(readByte & 255, new StringBuilder("Invalid marker: ")));
        } else {
            int i12 = 2;
            int i13 = 2;
            while (true) {
                byte readByte2 = bVar.readByte();
                if (readByte2 != b6) {
                    throw new IOException(android.support.v4.media.a.e(readByte2 & 255, new StringBuilder("Invalid marker:")));
                }
                boolean z10 = true;
                int i14 = i12 + 1;
                byte readByte3 = bVar.readByte();
                if (z9) {
                    Integer.toHexString(readByte3 & 255);
                }
                int i15 = i14 + 1;
                if (readByte3 != -39 && readByte3 != -38) {
                    int readUnsignedShort = bVar.readUnsignedShort() - i13;
                    int i16 = i15 + i13;
                    if (z9) {
                        Integer.toHexString(readByte3 & 255);
                    }
                    if (readUnsignedShort < 0) {
                        throw new IOException("Invalid length");
                    }
                    HashMap<String, c>[] hashMapArr = this.f30882e;
                    if (readByte3 == -31) {
                        byte[] bArr = new byte[readUnsignedShort];
                        bVar.readFully(bArr);
                        int i17 = i16 + readUnsignedShort;
                        byte[] bArr2 = P;
                        if (bArr2 != null && readUnsignedShort >= bArr2.length) {
                            for (int i18 = 0; i18 < bArr2.length; i18++) {
                                if (bArr[i18] == bArr2[i18]) {
                                }
                            }
                            z6 = true;
                            if (z6) {
                                byte[] bArr3 = Q;
                                if (bArr3 != null && readUnsignedShort >= bArr3.length) {
                                    for (int i19 = 0; i19 < bArr3.length; i19++) {
                                        if (bArr[i19] == bArr3[i19]) {
                                        }
                                    }
                                    if (z10) {
                                        int length = i16 + bArr3.length;
                                        byte[] copyOfRange = Arrays.copyOfRange(bArr, bArr3.length, readUnsignedShort);
                                        if (b("Xmp") == null) {
                                            hashMapArr[0].put("Xmp", new c(length, copyOfRange, 1, copyOfRange.length));
                                        }
                                    }
                                }
                                z10 = false;
                                if (z10) {
                                }
                            } else {
                                byte[] copyOfRange2 = Arrays.copyOfRange(bArr, bArr2.length, readUnsignedShort);
                                this.f30886i = i10 + i16 + bArr2.length;
                                s(i11, copyOfRange2);
                                v(new b(copyOfRange2));
                            }
                            i16 = i17;
                        }
                        z6 = false;
                        if (z6) {
                        }
                        i16 = i17;
                    } else if (readByte3 != -2) {
                        switch (readByte3) {
                            default:
                                switch (readByte3) {
                                    default:
                                        switch (readByte3) {
                                            default:
                                                switch (readByte3) {
                                                }
                                            case -55:
                                            case -54:
                                            case -53:
                                                bVar.a(1);
                                                hashMapArr[i11].put(i11 != 4 ? "ImageLength" : "ThumbnailImageLength", c.b(bVar.readUnsignedShort(), this.f30884g));
                                                hashMapArr[i11].put(i11 != 4 ? "ImageWidth" : "ThumbnailImageWidth", c.b(bVar.readUnsignedShort(), this.f30884g));
                                                readUnsignedShort -= 5;
                                                break;
                                        }
                                    case -59:
                                    case -58:
                                    case -57:
                                        break;
                                }
                            case -64:
                            case -63:
                            case -62:
                            case -61:
                                break;
                        }
                        if (readUnsignedShort >= 0) {
                            throw new IOException("Invalid length");
                        }
                        bVar.a(readUnsignedShort);
                        i12 = i16 + readUnsignedShort;
                        i13 = 2;
                        b6 = -1;
                    } else {
                        byte[] bArr4 = new byte[readUnsignedShort];
                        if (bVar.read(bArr4) != readUnsignedShort) {
                            throw new IOException("Invalid exif");
                        }
                        if (b("UserComment") == null) {
                            hashMapArr[1].put("UserComment", c.a(new String(bArr4, O)));
                        }
                    }
                    readUnsignedShort = 0;
                    if (readUnsignedShort >= 0) {
                    }
                }
            }
        }
    }

    public final int f(BufferedInputStream bufferedInputStream) {
        boolean z6;
        boolean z9;
        boolean z10;
        b bVar;
        boolean z11;
        a aVar;
        b bVar2;
        boolean z12;
        boolean z13;
        boolean z14;
        long j10;
        bufferedInputStream.mark(5000);
        byte[] bArr = new byte[5000];
        bufferedInputStream.read(bArr);
        bufferedInputStream.reset();
        int i10 = 0;
        while (true) {
            byte[] bArr2 = f30869r;
            z6 = true;
            if (i10 >= bArr2.length) {
                z9 = true;
                break;
            } else if (bArr[i10] != bArr2[i10]) {
                z9 = false;
                break;
            } else {
                i10++;
            }
        }
        if (z9) {
            return 4;
        }
        byte[] bytes = "FUJIFILMCCD-RAW".getBytes(Charset.defaultCharset());
        int i11 = 0;
        while (true) {
            if (i11 >= bytes.length) {
                z10 = true;
                break;
            } else if (bArr[i11] != bytes[i11]) {
                z10 = false;
                break;
            } else {
                i11++;
            }
        }
        if (z10) {
            return 9;
        }
        b bVar3 = null;
        try {
            bVar = new b(bArr);
            try {
                long readInt = bVar.readInt();
                byte[] bArr3 = new byte[4];
                bVar.read(bArr3);
                if (Arrays.equals(bArr3, f30870s)) {
                    if (readInt == 1) {
                        readInt = bVar.readLong();
                        j10 = 16;
                        if (readInt < 16) {
                        }
                    } else {
                        j10 = 8;
                    }
                    long j11 = 5000;
                    if (readInt > j11) {
                        readInt = j11;
                    }
                    long j12 = readInt - j10;
                    if (j12 >= 8) {
                        byte[] bArr4 = new byte[4];
                        boolean z15 = false;
                        boolean z16 = false;
                        for (long j13 = 0; j13 < j12 / 4 && bVar.read(bArr4) == 4; j13++) {
                            if (j13 != 1) {
                                if (Arrays.equals(bArr4, f30871t)) {
                                    z15 = true;
                                } else if (Arrays.equals(bArr4, f30872u)) {
                                    z16 = true;
                                }
                                if (z15 && z16) {
                                    bVar.close();
                                    z11 = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            } catch (Exception unused) {
            } catch (Throwable th) {
                th = th;
                bVar3 = bVar;
                if (bVar3 != null) {
                    bVar3.close();
                }
                throw th;
            }
        } catch (Exception unused2) {
            bVar = null;
        } catch (Throwable th2) {
            th = th2;
        }
        bVar.close();
        z11 = false;
        if (z11) {
            return 12;
        }
        try {
            bVar2 = new b(bArr);
            try {
                ByteOrder r10 = r(bVar2);
                aVar = this;
                try {
                    aVar.f30884g = r10;
                    bVar2.f30895c = r10;
                    short readShort = bVar2.readShort();
                    z12 = readShort == 20306 || readShort == 21330;
                    bVar2.close();
                } catch (Exception unused3) {
                    if (bVar2 != null) {
                        bVar2.close();
                    }
                    z12 = false;
                    if (z12) {
                    }
                } catch (Throwable th3) {
                    th = th3;
                    bVar3 = bVar2;
                    if (bVar3 != null) {
                        bVar3.close();
                    }
                    throw th;
                }
            } catch (Exception unused4) {
                aVar = this;
            } catch (Throwable th4) {
                th = th4;
            }
        } catch (Exception unused5) {
            aVar = this;
            bVar2 = null;
        } catch (Throwable th5) {
            th = th5;
        }
        if (z12) {
            try {
                b bVar4 = new b(bArr);
                try {
                    ByteOrder r11 = r(bVar4);
                    aVar.f30884g = r11;
                    bVar4.f30895c = r11;
                    z13 = bVar4.readShort() == 85;
                    bVar4.close();
                } catch (Exception unused6) {
                    bVar3 = bVar4;
                    if (bVar3 != null) {
                        bVar3.close();
                    }
                    z13 = false;
                    if (z13) {
                    }
                } catch (Throwable th6) {
                    th = th6;
                    bVar3 = bVar4;
                    if (bVar3 != null) {
                        bVar3.close();
                    }
                    throw th;
                }
            } catch (Exception unused7) {
            } catch (Throwable th7) {
                th = th7;
            }
            if (z13) {
                int i12 = 0;
                while (true) {
                    byte[] bArr5 = f30875x;
                    if (i12 >= bArr5.length) {
                        z14 = true;
                        break;
                    } else if (bArr[i12] != bArr5[i12]) {
                        z14 = false;
                        break;
                    } else {
                        i12++;
                    }
                }
                if (z14) {
                    return 13;
                }
                int i13 = 0;
                while (true) {
                    byte[] bArr6 = B;
                    if (i13 >= bArr6.length) {
                        int i14 = 0;
                        while (true) {
                            byte[] bArr7 = C;
                            if (i14 >= bArr7.length) {
                                break;
                            } else if (bArr[bArr6.length + i14 + 4] != bArr7[i14]) {
                                break;
                            } else {
                                i14++;
                            }
                        }
                    } else if (bArr[i13] != bArr6[i13]) {
                        break;
                    } else {
                        i13++;
                    }
                }
                z6 = false;
                return z6 ? 14 : 0;
            }
            return 10;
        }
        return 7;
    }

    public final void g(f fVar) {
        int i10;
        int i11;
        j(fVar);
        HashMap<String, c>[] hashMapArr = this.f30882e;
        c cVar = hashMapArr[1].get("MakerNote");
        if (cVar != null) {
            f fVar2 = new f(cVar.f30901d);
            fVar2.f30895c = this.f30884g;
            byte[] bArr = f30873v;
            byte[] bArr2 = new byte[bArr.length];
            fVar2.readFully(bArr2);
            fVar2.b(0L);
            byte[] bArr3 = f30874w;
            byte[] bArr4 = new byte[bArr3.length];
            fVar2.readFully(bArr4);
            if (Arrays.equals(bArr2, bArr)) {
                fVar2.b(8L);
            } else if (Arrays.equals(bArr4, bArr3)) {
                fVar2.b(12L);
            }
            t(fVar2, 6);
            c cVar2 = hashMapArr[7].get("PreviewImageStart");
            c cVar3 = hashMapArr[7].get("PreviewImageLength");
            if (cVar2 != null && cVar3 != null) {
                hashMapArr[5].put("JPEGInterchangeFormat", cVar2);
                hashMapArr[5].put("JPEGInterchangeFormatLength", cVar3);
            }
            c cVar4 = hashMapArr[8].get("AspectFrame");
            if (cVar4 != null) {
                int[] iArr = (int[]) cVar4.h(this.f30884g);
                if (iArr == null || iArr.length != 4) {
                    Arrays.toString(iArr);
                    return;
                }
                int i12 = iArr[2];
                int i13 = iArr[0];
                if (i12 <= i13 || (i10 = iArr[3]) <= (i11 = iArr[1])) {
                    return;
                }
                int i14 = (i12 - i13) + 1;
                int i15 = (i10 - i11) + 1;
                if (i14 < i15) {
                    int i16 = i14 + i15;
                    i15 = i16 - i15;
                    i14 = i16 - i15;
                }
                c d10 = c.d(i14, this.f30884g);
                c d11 = c.d(i15, this.f30884g);
                hashMapArr[0].put("ImageWidth", d10);
                hashMapArr[0].put("ImageLength", d11);
            }
        }
    }

    public final void h(b bVar) {
        if (f30864m) {
            Objects.toString(bVar);
        }
        bVar.f30895c = ByteOrder.BIG_ENDIAN;
        byte[] bArr = f30875x;
        bVar.a(bArr.length);
        int length = bArr.length + 0;
        while (true) {
            try {
                int readInt = bVar.readInt();
                int i10 = length + 4;
                byte[] bArr2 = new byte[4];
                if (bVar.read(bArr2) != 4) {
                    throw new IOException("Encountered invalid length while parsing PNG chunktype");
                }
                int i11 = i10 + 4;
                if (i11 == 16 && !Arrays.equals(bArr2, f30877z)) {
                    throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
                }
                if (Arrays.equals(bArr2, A)) {
                    return;
                }
                if (Arrays.equals(bArr2, f30876y)) {
                    byte[] bArr3 = new byte[readInt];
                    if (bVar.read(bArr3) != readInt) {
                        throw new IOException("Failed to read given length for given PNG chunk type: " + s0.b.a(bArr2));
                    }
                    int readInt2 = bVar.readInt();
                    CRC32 crc32 = new CRC32();
                    crc32.update(bArr2);
                    crc32.update(bArr3);
                    if (((int) crc32.getValue()) == readInt2) {
                        this.f30886i = i11;
                        s(0, bArr3);
                        y();
                        v(new b(bArr3));
                        return;
                    }
                    throw new IOException("Encountered invalid CRC value for PNG-EXIF chunk.\n recorded CRC value: " + readInt2 + ", calculated CRC value: " + crc32.getValue());
                }
                int i12 = readInt + 4;
                bVar.a(i12);
                length = i11 + i12;
            } catch (EOFException unused) {
                throw new IOException("Encountered corrupt PNG file.");
            }
        }
    }

    public final void i(b bVar) {
        if (f30864m) {
            Objects.toString(bVar);
        }
        bVar.a(84);
        byte[] bArr = new byte[4];
        byte[] bArr2 = new byte[4];
        byte[] bArr3 = new byte[4];
        bVar.read(bArr);
        bVar.read(bArr2);
        bVar.read(bArr3);
        int i10 = ByteBuffer.wrap(bArr).getInt();
        int i11 = ByteBuffer.wrap(bArr2).getInt();
        int i12 = ByteBuffer.wrap(bArr3).getInt();
        byte[] bArr4 = new byte[i11];
        bVar.a(i10 - bVar.f30896d);
        bVar.read(bArr4);
        e(new b(bArr4), i10, 5);
        bVar.a(i12 - bVar.f30896d);
        bVar.f30895c = ByteOrder.BIG_ENDIAN;
        int readInt = bVar.readInt();
        for (int i13 = 0; i13 < readInt; i13++) {
            int readUnsignedShort = bVar.readUnsignedShort();
            int readUnsignedShort2 = bVar.readUnsignedShort();
            if (readUnsignedShort == H.f30902a) {
                short readShort = bVar.readShort();
                short readShort2 = bVar.readShort();
                c d10 = c.d(readShort, this.f30884g);
                c d11 = c.d(readShort2, this.f30884g);
                HashMap<String, c>[] hashMapArr = this.f30882e;
                hashMapArr[0].put("ImageLength", d10);
                hashMapArr[0].put("ImageWidth", d11);
                return;
            }
            bVar.a(readUnsignedShort2);
        }
    }

    public final void j(f fVar) {
        p(fVar);
        t(fVar, 0);
        x(fVar, 0);
        x(fVar, 5);
        x(fVar, 4);
        y();
        if (this.f30881d == 8) {
            HashMap<String, c>[] hashMapArr = this.f30882e;
            c cVar = hashMapArr[1].get("MakerNote");
            if (cVar != null) {
                f fVar2 = new f(cVar.f30901d);
                fVar2.f30895c = this.f30884g;
                fVar2.a(6);
                t(fVar2, 9);
                c cVar2 = hashMapArr[9].get("ColorSpace");
                if (cVar2 != null) {
                    hashMapArr[1].put("ColorSpace", cVar2);
                }
            }
        }
    }

    public final void k(f fVar) {
        if (f30864m) {
            Objects.toString(fVar);
        }
        j(fVar);
        HashMap<String, c>[] hashMapArr = this.f30882e;
        c cVar = hashMapArr[0].get("JpgFromRaw");
        if (cVar != null) {
            e(new b(cVar.f30901d), (int) cVar.f30900c, 5);
        }
        c cVar2 = hashMapArr[0].get("ISO");
        c cVar3 = hashMapArr[1].get("PhotographicSensitivity");
        if (cVar2 == null || cVar3 != null) {
            return;
        }
        hashMapArr[1].put("PhotographicSensitivity", cVar2);
    }

    public final void l(b bVar) {
        if (f30864m) {
            Objects.toString(bVar);
        }
        bVar.f30895c = ByteOrder.LITTLE_ENDIAN;
        bVar.a(B.length);
        int readInt = bVar.readInt() + 8;
        byte[] bArr = C;
        bVar.a(bArr.length);
        int length = bArr.length + 8;
        while (true) {
            try {
                byte[] bArr2 = new byte[4];
                if (bVar.read(bArr2) != 4) {
                    throw new IOException("Encountered invalid length while parsing WebP chunktype");
                }
                int readInt2 = bVar.readInt();
                int i10 = length + 4 + 4;
                if (Arrays.equals(D, bArr2)) {
                    byte[] bArr3 = new byte[readInt2];
                    if (bVar.read(bArr3) == readInt2) {
                        this.f30886i = i10;
                        s(0, bArr3);
                        v(new b(bArr3));
                        return;
                    }
                    throw new IOException("Failed to read given length for given PNG chunk type: " + s0.b.a(bArr2));
                }
                if (readInt2 % 2 == 1) {
                    readInt2++;
                }
                length = i10 + readInt2;
                if (length == readInt) {
                    return;
                }
                if (length > readInt) {
                    throw new IOException("Encountered WebP file with invalid chunk size");
                }
                bVar.a(readInt2);
            } catch (EOFException unused) {
                throw new IOException("Encountered corrupt WebP file.");
            }
        }
    }

    public final void m(b bVar, HashMap hashMap) {
        c cVar = (c) hashMap.get("JPEGInterchangeFormat");
        c cVar2 = (c) hashMap.get("JPEGInterchangeFormatLength");
        if (cVar == null || cVar2 == null) {
            return;
        }
        int f10 = cVar.f(this.f30884g);
        int f11 = cVar2.f(this.f30884g);
        if (this.f30881d == 7) {
            f10 += this.f30887j;
        }
        if (f10 > 0 && f11 > 0 && this.f30878a == null && this.f30880c == null && this.f30879b == null) {
            bVar.skip(f10);
            bVar.read(new byte[f11]);
        }
    }

    public final boolean n(HashMap hashMap) {
        c cVar = (c) hashMap.get("ImageLength");
        c cVar2 = (c) hashMap.get("ImageWidth");
        if (cVar == null || cVar2 == null) {
            return false;
        }
        return cVar.f(this.f30884g) <= 512 && cVar2.f(this.f30884g) <= 512;
    }

    public final void o(InputStream inputStream) {
        boolean z6;
        boolean z9 = f30864m;
        if (inputStream == null) {
            throw new NullPointerException("inputstream shouldn't be null");
        }
        for (int i10 = 0; i10 < I.length; i10++) {
            try {
                this.f30882e[i10] = new HashMap<>();
            } catch (IOException | UnsupportedOperationException unused) {
                a();
                if (!z9) {
                    return;
                }
            } catch (Throwable th) {
                a();
                if (z9) {
                    q();
                }
                throw th;
            }
        }
        BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
        int f10 = f(bufferedInputStream);
        this.f30881d = f10;
        if (f10 != 4 && f10 != 9 && f10 != 13 && f10 != 14) {
            z6 = true;
            if (z6) {
                b bVar = new b(bufferedInputStream);
                int i11 = this.f30881d;
                if (i11 == 4) {
                    e(bVar, 0, 0);
                } else if (i11 == 13) {
                    h(bVar);
                } else if (i11 == 9) {
                    i(bVar);
                } else if (i11 == 14) {
                    l(bVar);
                }
            } else {
                f fVar = new f(bufferedInputStream);
                int i12 = this.f30881d;
                if (i12 == 12) {
                    d(fVar);
                } else if (i12 == 7) {
                    g(fVar);
                } else if (i12 == 10) {
                    k(fVar);
                } else {
                    j(fVar);
                }
                fVar.b(this.f30886i);
                v(fVar);
            }
            a();
            if (!z9) {
                return;
            }
            q();
        }
        z6 = false;
        if (z6) {
        }
        a();
        if (!z9) {
        }
        q();
    }

    public final void p(b bVar) {
        ByteOrder r10 = r(bVar);
        this.f30884g = r10;
        bVar.f30895c = r10;
        int readUnsignedShort = bVar.readUnsignedShort();
        int i10 = this.f30881d;
        if (i10 != 7 && i10 != 10 && readUnsignedShort != 42) {
            throw new IOException(android.support.v4.media.a.e(readUnsignedShort, new StringBuilder("Invalid start code: ")));
        }
        int readInt = bVar.readInt();
        if (readInt < 8) {
            throw new IOException(android.support.v4.media.a.f("Invalid first Ifd offset: ", readInt));
        }
        int i11 = readInt - 8;
        if (i11 > 0) {
            bVar.a(i11);
        }
    }

    public final void q() {
        int i10 = 0;
        while (true) {
            HashMap<String, c>[] hashMapArr = this.f30882e;
            if (i10 >= hashMapArr.length) {
                return;
            }
            hashMapArr[i10].size();
            for (Map.Entry<String, c> entry : hashMapArr[i10].entrySet()) {
                c value = entry.getValue();
                entry.getKey();
                value.toString();
                value.g(this.f30884g);
            }
            i10++;
        }
    }

    public final void s(int i10, byte[] bArr) {
        f fVar = new f(bArr);
        p(fVar);
        t(fVar, i10);
    }

    public final void t(f fVar, int i10) {
        boolean z6;
        HashMap<String, c>[] hashMapArr;
        int[] iArr;
        short s10;
        short s11;
        boolean z9;
        HashSet hashSet;
        boolean z10;
        long j10;
        boolean z11;
        int i11;
        long j11;
        long j12;
        int readUnsignedShort;
        long j13;
        Integer valueOf = Integer.valueOf(fVar.f30896d);
        HashSet hashSet2 = this.f30883f;
        hashSet2.add(valueOf);
        short readShort = fVar.readShort();
        if (readShort <= 0) {
            return;
        }
        short s12 = 0;
        while (true) {
            z6 = f30864m;
            hashMapArr = this.f30882e;
            if (s12 >= readShort) {
                break;
            }
            int readUnsignedShort2 = fVar.readUnsignedShort();
            int readUnsignedShort3 = fVar.readUnsignedShort();
            int readInt = fVar.readInt();
            long j14 = fVar.f30896d + 4;
            d dVar = K[i10].get(Integer.valueOf(readUnsignedShort2));
            if (z6) {
                Object[] objArr = new Object[5];
                objArr[0] = Integer.valueOf(i10);
                objArr[1] = Integer.valueOf(readUnsignedShort2);
                objArr[2] = dVar != null ? dVar.f30903b : null;
                objArr[3] = Integer.valueOf(readUnsignedShort3);
                objArr[4] = Integer.valueOf(readInt);
                String.format("ifdType: %d, tagNumber: %d, tagName: %s, dataFormat: %d, numberOfComponents: %d", objArr);
            }
            if (dVar != null && readUnsignedShort3 > 0) {
                if (readUnsignedShort3 < F.length) {
                    int i12 = dVar.f30904c;
                    s10 = readShort;
                    if (i12 == 7 || readUnsignedShort3 == 7 || i12 == readUnsignedShort3 || (i11 = dVar.f30905d) == readUnsignedShort3) {
                        s11 = s12;
                    } else {
                        s11 = s12;
                        if (((i12 != 4 && i11 != 4) || readUnsignedShort3 != 3) && (((i12 != 9 && i11 != 9) || readUnsignedShort3 != 8) && ((i12 != 12 && i11 != 12) || readUnsignedShort3 != 11))) {
                            z9 = false;
                            if (z9) {
                                if (z6) {
                                    String str = E[readUnsignedShort3];
                                }
                                hashSet = hashSet2;
                                z10 = z6;
                                j10 = 0;
                                z11 = false;
                                if (z11) {
                                    fVar.b(j14);
                                } else {
                                    if (j10 > 4) {
                                        int readInt2 = fVar.readInt();
                                        j11 = j10;
                                        if (this.f30881d == 7) {
                                            if ("MakerNote".equals(dVar.f30903b)) {
                                                this.f30887j = readInt2;
                                            } else if (i10 == 6 && "ThumbnailImage".equals(dVar.f30903b)) {
                                                this.f30888k = readInt2;
                                                this.f30889l = readInt;
                                                c d10 = c.d(6, this.f30884g);
                                                j12 = j14;
                                                c b6 = c.b(this.f30888k, this.f30884g);
                                                c b10 = c.b(this.f30889l, this.f30884g);
                                                hashMapArr[4].put("Compression", d10);
                                                hashMapArr[4].put("JPEGInterchangeFormat", b6);
                                                hashMapArr[4].put("JPEGInterchangeFormatLength", b10);
                                                fVar.b(readInt2);
                                            }
                                        }
                                        j12 = j14;
                                        fVar.b(readInt2);
                                    } else {
                                        j11 = j10;
                                        j12 = j14;
                                    }
                                    Integer num = N.get(Integer.valueOf(readUnsignedShort2));
                                    if (num != null) {
                                        if (readUnsignedShort3 != 3) {
                                            if (readUnsignedShort3 == 4) {
                                                j13 = fVar.readInt() & 4294967295L;
                                            } else if (readUnsignedShort3 == 8) {
                                                readUnsignedShort = fVar.readShort();
                                            } else if (readUnsignedShort3 == 9 || readUnsignedShort3 == 13) {
                                                readUnsignedShort = fVar.readInt();
                                            } else {
                                                j13 = -1;
                                            }
                                            if (z10) {
                                                String.format("Offset: %d, tagName: %s", Long.valueOf(j13), dVar.f30903b);
                                            }
                                            if (j13 > 0 && !hashSet.contains(Integer.valueOf((int) j13))) {
                                                fVar.b(j13);
                                                t(fVar, num.intValue());
                                            }
                                            fVar.b(j12);
                                        } else {
                                            readUnsignedShort = fVar.readUnsignedShort();
                                        }
                                        j13 = readUnsignedShort;
                                        if (z10) {
                                        }
                                        if (j13 > 0) {
                                            fVar.b(j13);
                                            t(fVar, num.intValue());
                                        }
                                        fVar.b(j12);
                                    } else {
                                        int i13 = fVar.f30896d + this.f30886i;
                                        byte[] bArr = new byte[(int) j11];
                                        fVar.readFully(bArr);
                                        c cVar = new c(i13, bArr, readUnsignedShort3, readInt);
                                        hashMapArr[i10].put(dVar.f30903b, cVar);
                                        String str2 = dVar.f30903b;
                                        if ("DNGVersion".equals(str2)) {
                                            this.f30881d = 3;
                                        }
                                        if ((("Make".equals(str2) || "Model".equals(str2)) && cVar.g(this.f30884g).contains("PENTAX")) || ("Compression".equals(str2) && cVar.f(this.f30884g) == 65535)) {
                                            this.f30881d = 8;
                                        }
                                        if (fVar.f30896d != j12) {
                                            fVar.b(j12);
                                        }
                                    }
                                }
                                hashSet2 = hashSet;
                                s12 = (short) (s11 + 1);
                                readShort = s10;
                            } else {
                                hashSet = hashSet2;
                                if (readUnsignedShort3 == 7) {
                                    readUnsignedShort3 = i12;
                                }
                                z10 = z6;
                                j10 = readInt * iArr[readUnsignedShort3];
                                if (j10 >= 0 && j10 <= 2147483647L) {
                                    z11 = true;
                                    if (z11) {
                                    }
                                    hashSet2 = hashSet;
                                    s12 = (short) (s11 + 1);
                                    readShort = s10;
                                }
                                z11 = false;
                                if (z11) {
                                }
                                hashSet2 = hashSet;
                                s12 = (short) (s11 + 1);
                                readShort = s10;
                            }
                        }
                    }
                    z9 = true;
                    if (z9) {
                    }
                }
            }
            s10 = readShort;
            s11 = s12;
            z10 = z6;
            hashSet = hashSet2;
            j10 = 0;
            z11 = false;
            if (z11) {
            }
            hashSet2 = hashSet;
            s12 = (short) (s11 + 1);
            readShort = s10;
        }
        HashSet hashSet3 = hashSet2;
        int readInt3 = fVar.readInt();
        if (z6) {
            String.format("nextIfdOffset: %d", Integer.valueOf(readInt3));
        }
        long j15 = readInt3;
        if (j15 <= 0 || hashSet3.contains(Integer.valueOf(readInt3))) {
            return;
        }
        fVar.b(j15);
        if (hashMapArr[4].isEmpty()) {
            t(fVar, 4);
        } else if (hashMapArr[5].isEmpty()) {
            t(fVar, 5);
        }
    }

    public final void u(int i10, String str, String str2) {
        HashMap<String, c>[] hashMapArr = this.f30882e;
        if (hashMapArr[i10].isEmpty() || hashMapArr[i10].get(str) == null) {
            return;
        }
        HashMap<String, c> hashMap = hashMapArr[i10];
        hashMap.put(str2, hashMap.get(str));
        hashMapArr[i10].remove(str);
    }

    public final void v(b bVar) {
        boolean z6;
        c cVar;
        int f10;
        HashMap<String, c> hashMap = this.f30882e[4];
        c cVar2 = hashMap.get("Compression");
        if (cVar2 == null) {
            m(bVar, hashMap);
            return;
        }
        int f11 = cVar2.f(this.f30884g);
        if (f11 != 1) {
            if (f11 == 6) {
                m(bVar, hashMap);
                return;
            } else if (f11 != 7) {
                return;
            }
        }
        c cVar3 = hashMap.get("BitsPerSample");
        if (cVar3 != null) {
            int[] iArr = (int[]) cVar3.h(this.f30884g);
            int[] iArr2 = f30867p;
            if (Arrays.equals(iArr2, iArr) || (this.f30881d == 3 && (cVar = hashMap.get("PhotometricInterpretation")) != null && (((f10 = cVar.f(this.f30884g)) == 1 && Arrays.equals(iArr, f30868q)) || (f10 == 6 && Arrays.equals(iArr, iArr2))))) {
                z6 = true;
                if (z6) {
                    return;
                }
                c cVar4 = hashMap.get("StripOffsets");
                c cVar5 = hashMap.get("StripByteCounts");
                if (cVar4 == null || cVar5 == null) {
                    return;
                }
                long[] b6 = s0.b.b(cVar4.h(this.f30884g));
                long[] b10 = s0.b.b(cVar5.h(this.f30884g));
                if (b6 == null || b6.length == 0 || b10 == null || b10.length == 0 || b6.length != b10.length) {
                    return;
                }
                long j10 = 0;
                for (long j11 : b10) {
                    j10 += j11;
                }
                byte[] bArr = new byte[(int) j10];
                this.f30885h = true;
                int i10 = 0;
                int i11 = 0;
                for (int i12 = 0; i12 < b6.length; i12++) {
                    int i13 = (int) b6[i12];
                    int i14 = (int) b10[i12];
                    if (i12 < b6.length - 1 && i13 + i14 != b6[i12 + 1]) {
                        this.f30885h = false;
                    }
                    int i15 = i13 - i10;
                    if (i15 < 0) {
                        return;
                    }
                    long j12 = i15;
                    if (bVar.skip(j12) != j12) {
                        return;
                    }
                    int i16 = i10 + i15;
                    byte[] bArr2 = new byte[i14];
                    if (bVar.read(bArr2) != i14) {
                        return;
                    }
                    i10 = i16 + i14;
                    System.arraycopy(bArr2, 0, bArr, i11, i14);
                    i11 += i14;
                }
                if (this.f30885h) {
                    long j13 = b6[0];
                    return;
                }
                return;
            }
        }
        z6 = false;
        if (z6) {
        }
    }

    public final void w(int i10, int i11) {
        HashMap<String, c>[] hashMapArr = this.f30882e;
        if (hashMapArr[i10].isEmpty() || hashMapArr[i11].isEmpty()) {
            return;
        }
        c cVar = hashMapArr[i10].get("ImageLength");
        c cVar2 = hashMapArr[i10].get("ImageWidth");
        c cVar3 = hashMapArr[i11].get("ImageLength");
        c cVar4 = hashMapArr[i11].get("ImageWidth");
        if (cVar == null || cVar2 == null || cVar3 == null || cVar4 == null) {
            return;
        }
        int f10 = cVar.f(this.f30884g);
        int f11 = cVar2.f(this.f30884g);
        int f12 = cVar3.f(this.f30884g);
        int f13 = cVar4.f(this.f30884g);
        if (f10 >= f12 || f11 >= f13) {
            return;
        }
        HashMap<String, c> hashMap = hashMapArr[i10];
        hashMapArr[i10] = hashMapArr[i11];
        hashMapArr[i11] = hashMap;
    }

    public final void x(f fVar, int i10) {
        c d10;
        c d11;
        HashMap<String, c>[] hashMapArr = this.f30882e;
        c cVar = hashMapArr[i10].get("DefaultCropSize");
        c cVar2 = hashMapArr[i10].get("SensorTopBorder");
        c cVar3 = hashMapArr[i10].get("SensorLeftBorder");
        c cVar4 = hashMapArr[i10].get("SensorBottomBorder");
        c cVar5 = hashMapArr[i10].get("SensorRightBorder");
        if (cVar != null) {
            if (cVar.f30898a == 5) {
                e[] eVarArr = (e[]) cVar.h(this.f30884g);
                if (eVarArr == null || eVarArr.length != 2) {
                    Arrays.toString(eVarArr);
                    return;
                } else {
                    d10 = c.c(eVarArr[0], this.f30884g);
                    d11 = c.c(eVarArr[1], this.f30884g);
                }
            } else {
                int[] iArr = (int[]) cVar.h(this.f30884g);
                if (iArr == null || iArr.length != 2) {
                    Arrays.toString(iArr);
                    return;
                } else {
                    d10 = c.d(iArr[0], this.f30884g);
                    d11 = c.d(iArr[1], this.f30884g);
                }
            }
            hashMapArr[i10].put("ImageWidth", d10);
            hashMapArr[i10].put("ImageLength", d11);
        } else if (cVar2 != null && cVar3 != null && cVar4 != null && cVar5 != null) {
            int f10 = cVar2.f(this.f30884g);
            int f11 = cVar4.f(this.f30884g);
            int f12 = cVar5.f(this.f30884g);
            int f13 = cVar3.f(this.f30884g);
            if (f11 <= f10 || f12 <= f13) {
                return;
            }
            c d12 = c.d(f11 - f10, this.f30884g);
            c d13 = c.d(f12 - f13, this.f30884g);
            hashMapArr[i10].put("ImageLength", d12);
            hashMapArr[i10].put("ImageWidth", d13);
        } else {
            c cVar6 = hashMapArr[i10].get("ImageLength");
            c cVar7 = hashMapArr[i10].get("ImageWidth");
            if (cVar6 == null || cVar7 == null) {
                c cVar8 = hashMapArr[i10].get("JPEGInterchangeFormat");
                c cVar9 = hashMapArr[i10].get("JPEGInterchangeFormatLength");
                if (cVar8 == null || cVar9 == null) {
                    return;
                }
                int f14 = cVar8.f(this.f30884g);
                int f15 = cVar8.f(this.f30884g);
                fVar.b(f14);
                byte[] bArr = new byte[f15];
                fVar.read(bArr);
                e(new b(bArr), f14, i10);
            }
        }
    }

    public final void y() {
        w(0, 5);
        w(0, 4);
        w(5, 4);
        HashMap<String, c>[] hashMapArr = this.f30882e;
        c cVar = hashMapArr[1].get("PixelXDimension");
        c cVar2 = hashMapArr[1].get("PixelYDimension");
        if (cVar != null && cVar2 != null) {
            hashMapArr[0].put("ImageWidth", cVar);
            hashMapArr[0].put("ImageLength", cVar2);
        }
        if (hashMapArr[4].isEmpty() && n(hashMapArr[5])) {
            hashMapArr[4] = hashMapArr[5];
            hashMapArr[5] = new HashMap<>();
        }
        n(hashMapArr[4]);
        u(0, "ThumbnailOrientation", "Orientation");
        u(0, "ThumbnailImageLength", "ImageLength");
        u(0, "ThumbnailImageWidth", "ImageWidth");
        u(5, "ThumbnailOrientation", "Orientation");
        u(5, "ThumbnailImageLength", "ImageLength");
        u(5, "ThumbnailImageWidth", "ImageWidth");
        u(4, "Orientation", "ThumbnailOrientation");
        u(4, "ImageLength", "ThumbnailImageLength");
        u(4, "ImageWidth", "ThumbnailImageWidth");
    }
}