package p5;

import androidx.navigation.C1134i;
import com.google.firebase.sessions.settings.RemoteSettings;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.GregorianCalendar;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.zip.Inflater;
import n2.AbstractC2613d;
import x4.AbstractC3251q;

/* JADX INFO: loaded from: classes3.dex */
public final class T extends AbstractC2749t {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final G f23078d;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final G f23079a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final AbstractC2749t f23080b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final LinkedHashMap f23081c;

    static {
        String str = G.f23047b;
        f23078d = C1134i.o(RemoteSettings.FORWARD_SLASH_STRING, false);
    }

    public T(G g6, AbstractC2749t abstractC2749t, LinkedHashMap linkedHashMap) {
        this.f23079a = g6;
        this.f23080b = abstractC2749t;
        this.f23081c = linkedHashMap;
    }

    public final List a(G g6, boolean z6) throws IOException {
        q5.j jVar = (q5.j) this.f23081c.get(f23078d.f(g6, true));
        if (jVar != null) {
            return AbstractC3251q.C0(jVar.f23783q);
        }
        if (z6) {
            throw new IOException(com.google.android.recaptcha.internal.a.p(g6, "not a directory: "));
        }
        return null;
    }

    @Override // p5.AbstractC2749t
    public final N appendingSink(G file, boolean z6) throws IOException {
        kotlin.jvm.internal.o.h(file, "file");
        throw new IOException("zip file systems are read-only");
    }

    @Override // p5.AbstractC2749t
    public final void atomicMove(G source, G target) throws IOException {
        kotlin.jvm.internal.o.h(source, "source");
        kotlin.jvm.internal.o.h(target, "target");
        throw new IOException("zip file systems are read-only");
    }

    @Override // p5.AbstractC2749t
    public final G canonicalize(G path) throws FileNotFoundException {
        kotlin.jvm.internal.o.h(path, "path");
        G g6 = f23078d;
        g6.getClass();
        G gB = q5.f.b(g6, path, true);
        if (this.f23081c.containsKey(gB)) {
            return gB;
        }
        throw new FileNotFoundException(String.valueOf(path));
    }

    @Override // p5.AbstractC2749t
    public final void createDirectory(G dir, boolean z6) throws IOException {
        kotlin.jvm.internal.o.h(dir, "dir");
        throw new IOException("zip file systems are read-only");
    }

    @Override // p5.AbstractC2749t
    public final void createSymlink(G source, G target) throws IOException {
        kotlin.jvm.internal.o.h(source, "source");
        kotlin.jvm.internal.o.h(target, "target");
        throw new IOException("zip file systems are read-only");
    }

    @Override // p5.AbstractC2749t
    public final void delete(G path, boolean z6) throws IOException {
        kotlin.jvm.internal.o.h(path, "path");
        throw new IOException("zip file systems are read-only");
    }

    @Override // p5.AbstractC2749t
    public final List list(G dir) throws IOException {
        kotlin.jvm.internal.o.h(dir, "dir");
        List listA = a(dir, true);
        kotlin.jvm.internal.o.e(listA);
        return listA;
    }

    @Override // p5.AbstractC2749t
    public final List listOrNull(G dir) {
        kotlin.jvm.internal.o.h(dir, "dir");
        return a(dir, false);
    }

    /* JADX WARN: Removed duplicated region for block: B:63:0x0117  */
    /* JADX WARN: Removed duplicated region for block: B:65:0x0125  */
    @Override // p5.AbstractC2749t
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final r metadataOrNull(G path) throws Throwable {
        Long lValueOf;
        long j4;
        Long l;
        Long lValueOf2;
        Long l6;
        Long l7;
        Long lValueOf3;
        Throwable th;
        Throwable th2;
        q5.j jVarG;
        kotlin.jvm.internal.o.h(path, "path");
        G g6 = f23078d;
        g6.getClass();
        q5.j jVar = (q5.j) this.f23081c.get(q5.f.b(g6, path, true));
        if (jVar == null) {
            return null;
        }
        long j6 = jVar.f23775h;
        if (j6 != -1) {
            AbstractC2747q abstractC2747qOpenReadOnly = this.f23080b.openReadOnly(this.f23079a);
            try {
                J jC = AbstractC2732b.c(abstractC2747qOpenReadOnly.t(j6));
                try {
                    jVarG = q5.b.g(jC, jVar);
                    kotlin.jvm.internal.o.e(jVarG);
                    try {
                        jC.close();
                        th2 = null;
                    } catch (Throwable th3) {
                        th2 = th3;
                    }
                } catch (Throwable th4) {
                    try {
                        jC.close();
                    } catch (Throwable th5) {
                        AbstractC2613d.b(th4, th5);
                    }
                    th2 = th4;
                    jVarG = null;
                }
                if (th2 != null) {
                    throw th2;
                }
                try {
                    abstractC2747qOpenReadOnly.close();
                    th = null;
                } catch (Throwable th6) {
                    th = th6;
                }
                th = th;
                jVar = jVarG;
            } catch (Throwable th7) {
                th = th7;
                if (abstractC2747qOpenReadOnly != null) {
                    try {
                        abstractC2747qOpenReadOnly.close();
                    } catch (Throwable th8) {
                        AbstractC2613d.b(th, th8);
                    }
                }
                jVar = null;
            }
            if (th != null) {
                throw th;
            }
        }
        boolean z6 = jVar.f23769b;
        boolean z7 = !z6;
        Long lValueOf4 = z6 ? null : Long.valueOf(jVar.f23773f);
        Long l8 = jVar.f23779m;
        if (l8 != null) {
            lValueOf = Long.valueOf((l8.longValue() / ((long) 10000)) - 11644473600000L);
        } else {
            Integer num = jVar.f23782p;
            lValueOf = num != null ? Long.valueOf(((long) num.intValue()) * 1000) : null;
        }
        Long l9 = jVar.f23778k;
        if (l9 != null) {
            j4 = 11644473600000L;
            lValueOf2 = Long.valueOf((l9.longValue() / ((long) 10000)) - 11644473600000L);
        } else {
            j4 = 11644473600000L;
            Integer num2 = jVar.f23780n;
            if (num2 != null) {
                lValueOf2 = Long.valueOf(((long) num2.intValue()) * 1000);
            } else {
                int i6 = jVar.f23777j;
                if (i6 == -1 || i6 == -1) {
                    l = null;
                    l6 = jVar.l;
                    if (l6 == null) {
                        lValueOf3 = Long.valueOf((l6.longValue() / ((long) 10000)) - j4);
                    } else {
                        Integer num3 = jVar.f23781o;
                        if (num3 == null) {
                            l7 = null;
                            return new r(z7, z6, null, lValueOf4, lValueOf, l, l7);
                        }
                        lValueOf3 = Long.valueOf(((long) num3.intValue()) * 1000);
                    }
                    l7 = lValueOf3;
                    return new r(z7, z6, null, lValueOf4, lValueOf, l, l7);
                }
                int i7 = jVar.f23776i;
                int i8 = (i7 >> 5) & 15;
                GregorianCalendar gregorianCalendar = new GregorianCalendar();
                gregorianCalendar.set(14, 0);
                gregorianCalendar.set(((i7 >> 9) & 127) + 1980, i8 - 1, i7 & 31, (i6 >> 11) & 31, (i6 >> 5) & 63, (i6 & 31) << 1);
                lValueOf2 = Long.valueOf(gregorianCalendar.getTime().getTime());
            }
        }
        l = lValueOf2;
        l6 = jVar.l;
        if (l6 == null) {
        }
        l7 = lValueOf3;
        return new r(z7, z6, null, lValueOf4, lValueOf, l, l7);
    }

    @Override // p5.AbstractC2749t
    public final AbstractC2747q openReadOnly(G file) {
        kotlin.jvm.internal.o.h(file, "file");
        throw new UnsupportedOperationException("not implemented yet!");
    }

    @Override // p5.AbstractC2749t
    public final AbstractC2747q openReadWrite(G file, boolean z6, boolean z7) throws IOException {
        kotlin.jvm.internal.o.h(file, "file");
        throw new IOException("zip entries are not writable");
    }

    @Override // p5.AbstractC2749t
    public final N sink(G file, boolean z6) throws IOException {
        kotlin.jvm.internal.o.h(file, "file");
        throw new IOException("zip file systems are read-only");
    }

    @Override // p5.AbstractC2749t
    public final P source(G file) throws Throwable {
        Throwable th;
        J jC;
        kotlin.jvm.internal.o.h(file, "file");
        G g6 = f23078d;
        g6.getClass();
        q5.j jVar = (q5.j) this.f23081c.get(q5.f.b(g6, file, true));
        if (jVar == null) {
            throw new FileNotFoundException(com.google.android.recaptcha.internal.a.p(file, "no such file: "));
        }
        AbstractC2747q abstractC2747qOpenReadOnly = this.f23080b.openReadOnly(this.f23079a);
        try {
            jC = AbstractC2732b.c(abstractC2747qOpenReadOnly.t(jVar.f23775h));
            try {
                abstractC2747qOpenReadOnly.close();
                th = null;
            } catch (Throwable th2) {
                th = th2;
            }
        } catch (Throwable th3) {
            if (abstractC2747qOpenReadOnly != null) {
                try {
                    abstractC2747qOpenReadOnly.close();
                } catch (Throwable th4) {
                    AbstractC2613d.b(th3, th4);
                }
            }
            th = th3;
            jC = null;
        }
        if (th != null) {
            throw th;
        }
        kotlin.jvm.internal.o.h(jC, "<this>");
        q5.b.g(jC, null);
        int i6 = jVar.f23774g;
        long j4 = jVar.f23773f;
        if (i6 == 0) {
            return new q5.h(jC, j4, true);
        }
        return new q5.h(new z(AbstractC2732b.c(new q5.h(jC, jVar.f23772e, true)), new Inflater(true)), j4, false);
    }
}
