package okio;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@kotlin.Metadata(d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0007\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0010\b\u0000\u0018\u0000 12\u00020\u0001:\u00019B7\b\u0000\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\u0006\u0010\u0004\u001a\u00020\u0001\u0012\u0012\u0010\u0007\u001a\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00060\u0005\u0012\b\u0010\t\u001a\u0004\u0018\u00010\b¢\u0006\u0004\b\n\u0010\u000bJ\u0017\u0010\r\u001a\u00020\u00022\u0006\u0010\f\u001a\u00020\u0002H\u0002¢\u0006\u0004\b\r\u0010\u000eJ'\u0010\u0013\u001a\n\u0012\u0004\u0012\u00020\u0002\u0018\u00010\u00122\u0006\u0010\u000f\u001a\u00020\u00022\u0006\u0010\u0011\u001a\u00020\u0010H\u0002¢\u0006\u0004\b\u0013\u0010\u0014J\u0019\u0010\u0016\u001a\u0004\u0018\u00010\u00152\u0006\u0010\f\u001a\u00020\u0002H\u0016¢\u0006\u0004\b\u0016\u0010\u0017J\u0017\u0010\u001a\u001a\u00020\u00192\u0006\u0010\u0018\u001a\u00020\u0002H\u0016¢\u0006\u0004\b\u001a\u0010\u001bJ'\u0010\u001e\u001a\u00020\u00192\u0006\u0010\u0018\u001a\u00020\u00022\u0006\u0010\u001c\u001a\u00020\u00102\u0006\u0010\u001d\u001a\u00020\u0010H\u0016¢\u0006\u0004\b\u001e\u0010\u001fJ\u001d\u0010 \u001a\b\u0012\u0004\u0012\u00020\u00020\u00122\u0006\u0010\u000f\u001a\u00020\u0002H\u0016¢\u0006\u0004\b \u0010!J\u001f\u0010\"\u001a\n\u0012\u0004\u0012\u00020\u0002\u0018\u00010\u00122\u0006\u0010\u000f\u001a\u00020\u0002H\u0016¢\u0006\u0004\b\"\u0010!J\u0017\u0010$\u001a\u00020#2\u0006\u0010\u0018\u001a\u00020\u0002H\u0016¢\u0006\u0004\b$\u0010%J\u001f\u0010'\u001a\u00020&2\u0006\u0010\u0018\u001a\u00020\u00022\u0006\u0010\u001c\u001a\u00020\u0010H\u0016¢\u0006\u0004\b'\u0010(J\u001f\u0010)\u001a\u00020&2\u0006\u0010\u0018\u001a\u00020\u00022\u0006\u0010\u001d\u001a\u00020\u0010H\u0016¢\u0006\u0004\b)\u0010(J\u001f\u0010+\u001a\u00020*2\u0006\u0010\u000f\u001a\u00020\u00022\u0006\u0010\u001c\u001a\u00020\u0010H\u0016¢\u0006\u0004\b+\u0010,J\u001f\u0010/\u001a\u00020*2\u0006\u0010-\u001a\u00020\u00022\u0006\u0010.\u001a\u00020\u0002H\u0016¢\u0006\u0004\b/\u00100J\u001f\u00101\u001a\u00020*2\u0006\u0010\f\u001a\u00020\u00022\u0006\u0010\u001d\u001a\u00020\u0010H\u0016¢\u0006\u0004\b1\u0010,R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b2\u00103R\u0014\u0010\u0004\u001a\u00020\u00018\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b4\u00105R \u0010\u0007\u001a\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00060\u00058\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b+\u00106R\u0016\u0010\t\u001a\u0004\u0018\u00010\b8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b7\u00108¨\u0006:"}, d2 = {"Lokio/ZipFileSystem;", "Lokio/FileSystem;", "Lokio/Path;", "zipPath", "fileSystem", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "Lokio/internal/ZipEntry;", "entries", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "comment", "<init>", "(Lokio/Path;Lokio/FileSystem;Ljava/util/Map;Ljava/lang/String;)V", "path", "u", "(Lokio/Path;)Lokio/Path;", "dir", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "throwOnFailure", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "v", "(Lokio/Path;Z)Ljava/util/List;", "Lokio/FileMetadata;", "n", "(Lokio/Path;)Lokio/FileMetadata;", "file", "Lokio/FileHandle;", "o", "(Lokio/Path;)Lokio/FileHandle;", "mustCreate", "mustExist", "q", "(Lokio/Path;ZZ)Lokio/FileHandle;", "k", "(Lokio/Path;)Ljava/util/List;", "l", "Lokio/Source;", "t", "(Lokio/Path;)Lokio/Source;", "Lokio/Sink;", "s", "(Lokio/Path;Z)Lokio/Sink;", "b", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "g", "(Lokio/Path;Z)V", "source", "target", "c", "(Lokio/Path;Lokio/Path;)V", "i", "e", "Lokio/Path;", "f", "Lokio/FileSystem;", "Ljava/util/Map;", "h", "Ljava/lang/String;", "Companion", "okio"}, k = 1, mv = {1, 9, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
public final class ZipFileSystem extends okio.FileSystem {
    private static final okio.ZipFileSystem.Companion i = new okio.ZipFileSystem.Companion(null);
    private static final okio.Path j = okio.Path.Companion.e(okio.Path.INSTANCE, "/", false, 1, null);

    /* JADX INFO: renamed from: e, reason: from kotlin metadata */
    private final okio.Path zipPath;

    /* JADX INFO: renamed from: f, reason: from kotlin metadata */
    private final okio.FileSystem fileSystem;

    /* JADX INFO: renamed from: g, reason: from kotlin metadata */
    private final java.util.Map entries;

    /* JADX INFO: renamed from: h, reason: from kotlin metadata */
    private final java.lang.String comment;

    /* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
    @kotlin.Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\b\u0082\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lokio/ZipFileSystem$Companion;", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "<init>", "()V", "okio"}, k = 1, mv = {1, 9, 0}, xi = 48)
    private static final class Companion {
        public /* synthetic */ Companion(kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }
    }

    public ZipFileSystem(okio.Path path, okio.FileSystem fileSystem, java.util.Map map, java.lang.String str) {
        kotlin.jvm.internal.Intrinsics.l(path, "zipPath");
        kotlin.jvm.internal.Intrinsics.l(fileSystem, "fileSystem");
        kotlin.jvm.internal.Intrinsics.l(map, "entries");
        this.zipPath = path;
        this.fileSystem = fileSystem;
        this.entries = map;
        this.comment = str;
    }

    private final okio.Path u(okio.Path path) {
        return j.l(path, true);
    }

    private final java.util.List v(okio.Path dir, boolean throwOnFailure) throws java.io.IOException {
        okio.internal.ZipEntry zipEntry = (okio.internal.ZipEntry) this.entries.get(u(dir));
        if (zipEntry != null) {
            return kotlin.collections.CollectionsKt.k1(zipEntry.getChildren());
        }
        if (!throwOnFailure) {
            return null;
        }
        throw new java.io.IOException("not a directory: " + dir);
    }

    @Override // okio.FileSystem
    public okio.Sink b(okio.Path file, boolean mustExist) throws java.io.IOException {
        kotlin.jvm.internal.Intrinsics.l(file, "file");
        throw new java.io.IOException("zip file systems are read-only");
    }

    @Override // okio.FileSystem
    public void c(okio.Path source, okio.Path target) throws java.io.IOException {
        kotlin.jvm.internal.Intrinsics.l(source, "source");
        kotlin.jvm.internal.Intrinsics.l(target, "target");
        throw new java.io.IOException("zip file systems are read-only");
    }

    @Override // okio.FileSystem
    public void g(okio.Path dir, boolean mustCreate) throws java.io.IOException {
        kotlin.jvm.internal.Intrinsics.l(dir, "dir");
        throw new java.io.IOException("zip file systems are read-only");
    }

    @Override // okio.FileSystem
    public void i(okio.Path path, boolean mustExist) throws java.io.IOException {
        kotlin.jvm.internal.Intrinsics.l(path, "path");
        throw new java.io.IOException("zip file systems are read-only");
    }

    @Override // okio.FileSystem
    public java.util.List k(okio.Path dir) throws java.io.IOException {
        kotlin.jvm.internal.Intrinsics.l(dir, "dir");
        java.util.List listV = v(dir, true);
        kotlin.jvm.internal.Intrinsics.i(listV);
        return listV;
    }

    @Override // okio.FileSystem
    public java.util.List l(okio.Path dir) {
        kotlin.jvm.internal.Intrinsics.l(dir, "dir");
        return v(dir, false);
    }

    @Override // okio.FileSystem
    public okio.FileMetadata n(okio.Path path) throws java.lang.Throwable {
        okio.FileMetadata fileMetadataH;
        java.lang.Throwable th;
        kotlin.jvm.internal.Intrinsics.l(path, "path");
        okio.internal.ZipEntry zipEntry = (okio.internal.ZipEntry) this.entries.get(u(path));
        java.lang.Throwable th2 = null;
        if (zipEntry == null) {
            return null;
        }
        okio.FileMetadata fileMetadata = new okio.FileMetadata(!zipEntry.getIsDirectory(), zipEntry.getIsDirectory(), null, zipEntry.getIsDirectory() ? null : java.lang.Long.valueOf(zipEntry.getSize()), null, zipEntry.getLastModifiedAtMillis(), null, null, 128, null);
        if (zipEntry.getOffset() == -1) {
            return fileMetadata;
        }
        okio.FileHandle fileHandleO = this.fileSystem.o(this.zipPath);
        try {
            okio.BufferedSource bufferedSourceD = okio.Okio.d(fileHandleO.X(zipEntry.getOffset()));
            try {
                fileMetadataH = okio.internal.ZipFilesKt.h(bufferedSourceD, fileMetadata);
                if (bufferedSourceD != null) {
                    try {
                        bufferedSourceD.close();
                    } catch (java.lang.Throwable th3) {
                        th = th3;
                    }
                }
                th = null;
            } catch (java.lang.Throwable th4) {
                if (bufferedSourceD != null) {
                    try {
                        bufferedSourceD.close();
                    } catch (java.lang.Throwable th5) {
                        kotlin.ExceptionsKt.a(th4, th5);
                    }
                }
                th = th4;
                fileMetadataH = null;
            }
            if (th != null) {
                throw th;
            }
            kotlin.jvm.internal.Intrinsics.i(fileMetadataH);
            if (fileHandleO != null) {
                try {
                    fileHandleO.close();
                } catch (java.lang.Throwable th6) {
                    th2 = th6;
                }
            }
            if (th2 != null) {
                throw th2;
            }
            kotlin.jvm.internal.Intrinsics.i(fileMetadataH);
            return fileMetadataH;
        } catch (java.lang.Throwable th7) {
            if (fileHandleO != null) {
                try {
                    fileHandleO.close();
                } catch (java.lang.Throwable th8) {
                    kotlin.ExceptionsKt.a(th7, th8);
                }
            }
            fileMetadataH = null;
            th2 = th7;
        }
    }

    @Override // okio.FileSystem
    public okio.FileHandle o(okio.Path file) {
        kotlin.jvm.internal.Intrinsics.l(file, "file");
        throw new java.lang.UnsupportedOperationException("not implemented yet!");
    }

    @Override // okio.FileSystem
    public okio.FileHandle q(okio.Path file, boolean mustCreate, boolean mustExist) throws java.io.IOException {
        kotlin.jvm.internal.Intrinsics.l(file, "file");
        throw new java.io.IOException("zip entries are not writable");
    }

    @Override // okio.FileSystem
    public okio.Sink s(okio.Path file, boolean mustCreate) throws java.io.IOException {
        kotlin.jvm.internal.Intrinsics.l(file, "file");
        throw new java.io.IOException("zip file systems are read-only");
    }

    @Override // okio.FileSystem
    public okio.Source t(okio.Path file) throws java.lang.Throwable {
        okio.BufferedSource bufferedSourceD;
        kotlin.jvm.internal.Intrinsics.l(file, "file");
        okio.internal.ZipEntry zipEntry = (okio.internal.ZipEntry) this.entries.get(u(file));
        if (zipEntry == null) {
            throw new java.io.FileNotFoundException("no such file: " + file);
        }
        okio.FileHandle fileHandleO = this.fileSystem.o(this.zipPath);
        java.lang.Throwable th = null;
        try {
            bufferedSourceD = okio.Okio.d(fileHandleO.X(zipEntry.getOffset()));
            if (fileHandleO != null) {
                try {
                    fileHandleO.close();
                } catch (java.lang.Throwable th2) {
                    th = th2;
                }
            }
        } catch (java.lang.Throwable th3) {
            if (fileHandleO != null) {
                try {
                    fileHandleO.close();
                } catch (java.lang.Throwable th4) {
                    kotlin.ExceptionsKt.a(th3, th4);
                }
            }
            bufferedSourceD = null;
            th = th3;
        }
        if (th != null) {
            throw th;
        }
        kotlin.jvm.internal.Intrinsics.i(bufferedSourceD);
        okio.internal.ZipFilesKt.k(bufferedSourceD);
        return zipEntry.getCompressionMethod() == 0 ? new okio.internal.FixedLengthSource(bufferedSourceD, zipEntry.getSize(), true) : new okio.internal.FixedLengthSource(new okio.InflaterSource(new okio.internal.FixedLengthSource(bufferedSourceD, zipEntry.getCompressedSize(), true), new java.util.zip.Inflater(true)), zipEntry.getSize(), false);
    }
}
