9055彩票.apk(点击下载) / d.java


package com.opensource.svgaplayer;

import android.content.Context;
import android.net.http.HttpResponseCache;
import android.os.Handler;
import android.util.Log;
import com.opensource.svgaplayer.proto.MovieEntity;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.zip.Inflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import kotlin.Deprecated;
import kotlin.Metadata;
import kotlin.h.n;
import kotlin.jvm.b.aa;
import kotlin.jvm.b.j;
import kotlin.jvm.b.k;
import kotlin.jvm.b.w;
import kotlin.v;
import kotlin.y;
import org.eclipse.paho.client.mqttv3.MqttTopic;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;
import org.litepal.util.Const;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000j\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\u0018\u0000 .2\u00020\u0001:\u0003./0B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0010\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000eH\u0002J\u0010\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0010\u001a\u00020\u0011H\u0002J\u0010\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0012\u001a\u00020\u000eH\u0002J\u0016\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u000e2\u0006\u0010\u0016\u001a\u00020\u0017J\u0018\u0010\u0018\u001a\u00020\u00142\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u0016\u001a\u00020\u0017H\u0002J(\u0010\u0019\u001a\u00020\u00142\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u0016\u001a\u00020\u00172\b\b\u0002\u0010\u001c\u001a\u00020\u001dJ\u001e\u0010\u001e\u001a\n\u0012\u0004\u0012\u00020\u0014\u0018\u00010\u001f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0016\u001a\u00020\u0017J\u0012\u0010 \u001a\u0004\u0018\u00010!2\u0006\u0010\"\u001a\u00020!H\u0002J\u0018\u0010#\u001a\u00020\u00142\u0006\u0010$\u001a\u00020%2\u0006\u0010\u0016\u001a\u00020\u0017H\u0002J\u0018\u0010&\u001a\u00020\u00142\u0006\u0010'\u001a\u00020(2\u0006\u0010\u0016\u001a\u00020\u0017H\u0002J\u0010\u0010)\u001a\u00020\u001d2\u0006\u0010\r\u001a\u00020\u000eH\u0002J*\u0010*\u001a\u00020\u00142\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u0016\u001a\u00020\u00172\b\b\u0002\u0010\u001c\u001a\u00020\u001dH\u0007J\u0018\u0010*\u001a\u00020\u00142\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0016\u001a\u00020\u0017H\u0007J\u0018\u0010*\u001a\u00020\u00142\u0006\u0010+\u001a\u00020\u000e2\u0006\u0010\u0016\u001a\u00020\u0017H\u0007J\u0012\u0010,\u001a\u0004\u0018\u00010!2\u0006\u0010\u001a\u001a\u00020\u001bH\u0002J\u0018\u0010-\u001a\u00020\u00142\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\r\u001a\u00020\u000eH\u0002R\u000e\u0010\u0002\u001a\u00020\u0003X‚\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u0005\u001a\u00020\u0006X†\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0004\b\t\u0010\n¨\u00061"}, d2 = {"Lcom/opensource/svgaplayer/SVGAParser;", "", com.umeng.analytics.pro.b.M, "Landroid/content/Context;", "(Landroid/content/Context;)V", "fileDownloader", "Lcom/opensource/svgaplayer/SVGAParser$FileDownloader;", "getFileDownloader", "()Lcom/opensource/svgaplayer/SVGAParser$FileDownloader;", "setFileDownloader", "(Lcom/opensource/svgaplayer/SVGAParser$FileDownloader;)V", "buildCacheDir", "Ljava/io/File;", "cacheKey", "", "buildCacheKey", "url", "Ljava/net/URL;", "str", "decodeFromAssets", "", Const.TableSchema.COLUMN_NAME, "callback", "Lcom/opensource/svgaplayer/SVGAParser$ParseCompletion;", "decodeFromCacheKey", "decodeFromInputStream", "inputStream", "Ljava/io/InputStream;", "closeInputStream", "", "decodeFromURL", "Lkotlin/Function0;", "inflate", "", "byteArray", "invokeCompleteCallback", "videoItem", "Lcom/opensource/svgaplayer/SVGAVideoEntity;", "invokeErrorCallback", "e", "Ljava/lang/Exception;", "isCached", "parse", "assetsName", "readAsBytes", "unzip", "Companion", "FileDownloader", "ParseCompletion", "library_release"}, k = 1, mv = {1, 1, 13})
/* compiled from: SVGAParser.kt */
public final class d {

    /* renamed from: a  reason: collision with root package name */
    public static final a f4866a = new a(null);
    private static final LinkedBlockingQueue<Runnable> d = new LinkedBlockingQueue<>();
    @NotNull
    private static ThreadPoolExecutor e = new ThreadPoolExecutor(3, 10, 60000, TimeUnit.MILLISECONDS, d);
    @NotNull

    /* renamed from: b  reason: collision with root package name */
    private b f4867b = new b();
    private final Context c;

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\bf\u0018\u00002\u00020\u0001J\u0010\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&J\b\u0010\u0006\u001a\u00020\u0003H&¨\u0006\u0007"}, d2 = {"Lcom/opensource/svgaplayer/SVGAParser$ParseCompletion;", "", "onComplete", "", "videoItem", "Lcom/opensource/svgaplayer/SVGAVideoEntity;", "onError", "library_release"}, k = 1, mv = {1, 1, 13})
    /* compiled from: SVGAParser.kt */
    public interface c {
        void a();

        void a(@NotNull f fVar);
    }

    /* access modifiers changed from: package-private */
    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 13})
    /* renamed from: com.opensource.svgaplayer.d$d  reason: collision with other inner class name */
    /* compiled from: SVGAParser.kt */
    public static final class RunnableC0121d implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ d f4872a;

        /* renamed from: b  reason: collision with root package name */
        final /* synthetic */ InputStream f4873b;
        final /* synthetic */ String c;
        final /* synthetic */ c d;
        final /* synthetic */ boolean e;

        RunnableC0121d(d dVar, InputStream inputStream, String str, c cVar, boolean z) {
            this.f4872a = dVar;
            this.f4873b = inputStream;
            this.c = str;
            this.d = cVar;
            this.e = z;
        }

        @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\b\u0003\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002¨\u0006\u0004"}, d2 = {"<anonymous>", "", "invoke", "com/opensource/svgaplayer/SVGAParser$decodeFromInputStream$1$1$2$1", "com/opensource/svgaplayer/SVGAParser$decodeFromInputStream$1$$special$$inlined$let$lambda$1"}, k = 3, mv = {1, 1, 13})
        /* renamed from: com.opensource.svgaplayer.d$d$a */
        /* compiled from: SVGAParser.kt */
        static final class a extends k implements kotlin.jvm.a.a<y> {

            /* renamed from: a  reason: collision with root package name */
            final /* synthetic */ f f4874a;

            /* renamed from: b  reason: collision with root package name */
            final /* synthetic */ RunnableC0121d f4875b;

            /* JADX INFO: super call moved to the top of the method (can break code semantics) */
            a(f fVar, RunnableC0121d dVar) {
                super(0);
                this.f4874a = fVar;
                this.f4875b = dVar;
            }

            /* Return type fixed from 'java.lang.Object' to match base method */
            @Override // kotlin.jvm.a.a
            public /* synthetic */ y invoke() {
                a();
                return y.f13349a;
            }

            public final void a() {
                this.f4875b.f4872a.a((d) this.f4874a, (f) this.f4875b.d);
            }
        }

        /* JADX WARNING: Code restructure failed: missing block: B:20:0x0050, code lost:
            r2 = move-exception;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:24:0x0054, code lost:
            kotlin.d.a.a(r1, r0);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:25:0x0057, code lost:
            throw r2;
         */
        public final void run() {
            try {
                byte[] a2 = this.f4872a.a((d) this.f4873b);
                if (a2 != null) {
                    if (a2.length > 4 && a2[0] == 80 && a2[1] == 75 && a2[2] == 3 && a2[3] == 4) {
                        if (!this.f4872a.c(this.c).exists()) {
                            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(a2);
                            Throwable th = null;
                            this.f4872a.a((d) byteArrayInputStream, (InputStream) this.c);
                            y yVar = y.f13349a;
                            kotlin.d.a.a(byteArrayInputStream, th);
                        }
                        this.f4872a.c(this.c, this.d);
                    } else {
                        byte[] a3 = this.f4872a.a((d) a2);
                        if (a3 != null) {
                            MovieEntity decode = MovieEntity.ADAPTER.decode(a3);
                            j.a((Object) decode, "MovieEntity.ADAPTER.decode(it)");
                            f fVar = new f(decode, new File(this.c));
                            fVar.a(new a(fVar, this));
                        }
                    }
                }
                if (!this.e) {
                    return;
                }
            } catch (Exception e2) {
                this.f4872a.a((d) e2, (Exception) this.d);
                if (!this.e) {
                    return;
                }
            } catch (Throwable th2) {
                if (this.e) {
                    this.f4873b.close();
                }
                throw th2;
            }
            this.f4873b.close();
        }
    }

    /* access modifiers changed from: package-private */
    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", "it", "Ljava/io/InputStream;", "invoke"}, k = 3, mv = {1, 1, 13})
    /* compiled from: SVGAParser.kt */
    public static final class f extends k implements kotlin.jvm.a.b<InputStream, y> {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ d f4878a;

        /* renamed from: b  reason: collision with root package name */
        final /* synthetic */ URL f4879b;
        final /* synthetic */ c c;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        f(d dVar, URL url, c cVar) {
            super(1);
            this.f4878a = dVar;
            this.f4879b = url;
            this.c = cVar;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.a.b
        public /* synthetic */ y invoke(InputStream inputStream) {
            a(inputStream);
            return y.f13349a;
        }

        public final void a(@NotNull InputStream inputStream) {
            j.b(inputStream, "it");
            d dVar = this.f4878a;
            d.a(dVar, inputStream, dVar.a((d) this.f4879b), this.c, false, 8, null);
        }
    }

    /* access modifiers changed from: package-private */
    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0012\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u00012\n\u0010\u0002\u001a\u00060\u0003j\u0002`\u0004H\n¢\u0006\u0002\b\u0005"}, d2 = {"<anonymous>", "", "it", "Ljava/lang/Exception;", "Lkotlin/Exception;", "invoke"}, k = 3, mv = {1, 1, 13})
    /* compiled from: SVGAParser.kt */
    public static final class g extends k implements kotlin.jvm.a.b<Exception, y> {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ d f4880a;

        /* renamed from: b  reason: collision with root package name */
        final /* synthetic */ c f4881b;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        g(d dVar, c cVar) {
            super(1);
            this.f4880a = dVar;
            this.f4881b = cVar;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.a.b
        public /* synthetic */ y invoke(Exception exc) {
            a(exc);
            return y.f13349a;
        }

        public final void a(@NotNull Exception exc) {
            j.b(exc, "it");
            this.f4880a.a((d) exc, (Exception) this.f4881b);
        }
    }

    public d(@NotNull Context context) {
        j.b(context, com.umeng.analytics.pro.b.M);
        this.c = context;
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000@\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0016\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J`\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u000b0\n2\u0006\u0010\f\u001a\u00020\r2!\u0010\u000e\u001a\u001d\u0012\u0013\u0012\u00110\u0010¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u0013\u0012\u0004\u0012\u00020\u000b0\u000f2%\u0010\u0014\u001a!\u0012\u0017\u0012\u00150\u0015j\u0002`\u0016¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u0017\u0012\u0004\u0012\u00020\u000b0\u000fH\u0016R\u001a\u0010\u0003\u001a\u00020\u0004X†\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\b¨\u0006\u0018"}, d2 = {"Lcom/opensource/svgaplayer/SVGAParser$FileDownloader;", "", "()V", "noCache", "", "getNoCache", "()Z", "setNoCache", "(Z)V", "resume", "Lkotlin/Function0;", "", "url", "Ljava/net/URL;", "complete", "Lkotlin/Function1;", "Ljava/io/InputStream;", "Lkotlin/ParameterName;", Const.TableSchema.COLUMN_NAME, "inputStream", "failure", "Ljava/lang/Exception;", "Lkotlin/Exception;", "e", "library_release"}, k = 1, mv = {1, 1, 13})
    /* compiled from: SVGAParser.kt */
    public static class b {

        /* renamed from: a  reason: collision with root package name */
        private boolean f4868a;

        /* access modifiers changed from: package-private */
        @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "invoke"}, k = 3, mv = {1, 1, 13})
        /* renamed from: com.opensource.svgaplayer.d$b$b  reason: collision with other inner class name */
        /* compiled from: SVGAParser.kt */
        public static final class C0120b extends k implements kotlin.jvm.a.a<y> {

            /* renamed from: a  reason: collision with root package name */
            final /* synthetic */ w.a f4871a;

            /* JADX INFO: super call moved to the top of the method (can break code semantics) */
            C0120b(w.a aVar) {
                super(0);
                this.f4871a = aVar;
            }

            /* Return type fixed from 'java.lang.Object' to match base method */
            @Override // kotlin.jvm.a.a
            public /* synthetic */ y invoke() {
                a();
                return y.f13349a;
            }

            public final void a() {
                this.f4871a.f13313a = true;
            }
        }

        public final boolean a() {
            return this.f4868a;
        }

        @NotNull
        public kotlin.jvm.a.a<y> a(@NotNull URL url, @NotNull kotlin.jvm.a.b<? super InputStream, y> bVar, @NotNull kotlin.jvm.a.b<? super Exception, y> bVar2) {
            j.b(url, "url");
            j.b(bVar, "complete");
            j.b(bVar2, "failure");
            w.a aVar = new w.a();
            aVar.f13313a = false;
            C0120b bVar3 = new C0120b(aVar);
            d.f4866a.a().execute(new a(this, url, aVar, bVar, bVar2));
            return bVar3;
        }

        /* access modifiers changed from: package-private */
        @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 13})
        /* compiled from: SVGAParser.kt */
        public static final class a implements Runnable {

            /* renamed from: a  reason: collision with root package name */
            final /* synthetic */ b f4869a;

            /* renamed from: b  reason: collision with root package name */
            final /* synthetic */ URL f4870b;
            final /* synthetic */ w.a c;
            final /* synthetic */ kotlin.jvm.a.b d;
            final /* synthetic */ kotlin.jvm.a.b e;

            a(b bVar, URL url, w.a aVar, kotlin.jvm.a.b bVar2, kotlin.jvm.a.b bVar3) {
                this.f4869a = bVar;
                this.f4870b = url;
                this.c = aVar;
                this.d = bVar2;
                this.e = bVar3;
            }

            /* JADX WARNING: Code restructure failed: missing block: B:32:0x0095, code lost:
                r6 = move-exception;
             */
            /* JADX WARNING: Code restructure failed: missing block: B:36:0x0099, code lost:
                kotlin.d.a.a(r3, r2);
             */
            /* JADX WARNING: Code restructure failed: missing block: B:37:0x009c, code lost:
                throw r6;
             */
            /* JADX WARNING: Code restructure failed: missing block: B:39:0x00a1, code lost:
                r2 = move-exception;
             */
            /* JADX WARNING: Code restructure failed: missing block: B:44:0x00a6, code lost:
                kotlin.d.a.a(r4, r2);
             */
            /* JADX WARNING: Code restructure failed: missing block: B:45:0x00a9, code lost:
                throw r2;
             */
            /* JADX WARNING: Code restructure failed: missing block: B:46:0x00aa, code lost:
                r2 = move-exception;
             */
            /* JADX WARNING: Code restructure failed: missing block: B:50:0x00ae, code lost:
                kotlin.d.a.a(r0, r1);
             */
            /* JADX WARNING: Code restructure failed: missing block: B:51:0x00b1, code lost:
                throw r2;
             */
            public final void run() {
                try {
                    if (HttpResponseCache.getInstalled() == null && !this.f4869a.a()) {
                        Log.e("SVGAParser", "SVGAParser can not handle cache before install HttpResponseCache. see https://github.com/yyued/SVGAPlayer-Android#cache");
                        Log.e("SVGAParser", "在配置 HttpResponseCache 前 SVGAParser 无法缓存. 查看 https://github.com/yyued/SVGAPlayer-Android#cache ");
                    }
                    URLConnection openConnection = this.f4870b.openConnection();
                    if (!(openConnection instanceof HttpURLConnection)) {
                        openConnection = null;
                    }
                    HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
                    if (httpURLConnection != null) {
                        httpURLConnection.setConnectTimeout(20000);
                        httpURLConnection.setRequestMethod("GET");
                        httpURLConnection.connect();
                        InputStream inputStream = httpURLConnection.getInputStream();
                        Throwable th = null;
                        InputStream inputStream2 = inputStream;
                        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                        Throwable th2 = null;
                        ByteArrayOutputStream byteArrayOutputStream2 = byteArrayOutputStream;
                        byte[] bArr = new byte[4096];
                        while (true) {
                            if (this.c.f13313a) {
                                break;
                            }
                            int read = inputStream2.read(bArr, 0, 4096);
                            if (read == -1) {
                                break;
                            }
                            byteArrayOutputStream2.write(bArr, 0, read);
                        }
                        if (this.c.f13313a) {
                            kotlin.d.a.a(byteArrayOutputStream, th2);
                            kotlin.d.a.a(inputStream, th);
                            return;
                        }
                        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream2.toByteArray());
                        Throwable th3 = null;
                        this.d.invoke(byteArrayInputStream);
                        y yVar = y.f13349a;
                        kotlin.d.a.a(byteArrayInputStream, th3);
                        y yVar2 = y.f13349a;
                        kotlin.d.a.a(byteArrayOutputStream, th2);
                        y yVar3 = y.f13349a;
                        kotlin.d.a.a(inputStream, th);
                    }
                } catch (Exception e2) {
                    e2.printStackTrace();
                    this.e.invoke(e2);
                }
            }
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0002\b†\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u0007R\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X‚\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u0006\u001a\u00020\u0007X€\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\b\u0010\t\"\u0004\b\n\u0010\u000b¨\u0006\u000f"}, d2 = {"Lcom/opensource/svgaplayer/SVGAParser$Companion;", "", "()V", "threadPoolBlockingQueue", "Ljava/util/concurrent/LinkedBlockingQueue;", "Ljava/lang/Runnable;", "threadPoolExecutor", "Ljava/util/concurrent/ThreadPoolExecutor;", "getThreadPoolExecutor$library_release", "()Ljava/util/concurrent/ThreadPoolExecutor;", "setThreadPoolExecutor$library_release", "(Ljava/util/concurrent/ThreadPoolExecutor;)V", "setThreadPoolExecutor", "", "executor", "library_release"}, k = 1, mv = {1, 1, 13})
    /* compiled from: SVGAParser.kt */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(kotlin.jvm.b.g gVar) {
            this();
        }

        @NotNull
        public final ThreadPoolExecutor a() {
            return d.e;
        }
    }

    public final void a(@NotNull String str, @NotNull c cVar) {
        j.b(str, Const.TableSchema.COLUMN_NAME);
        j.b(cVar, "callback");
        try {
            InputStream open = this.c.getAssets().open(str);
            if (open != null) {
                a(open, b("file:///assets/" + str), cVar, true);
            }
        } catch (Exception e2) {
            a(e2, cVar);
        }
    }

    @Nullable
    public final kotlin.jvm.a.a<y> a(@NotNull URL url, @NotNull c cVar) {
        j.b(url, "url");
        j.b(cVar, "callback");
        if (!a(a(url))) {
            return this.f4867b.a(url, new f(this, url, cVar), new g(this, cVar));
        }
        e.execute(new e(this, url, cVar));
        return null;
    }

    /* access modifiers changed from: package-private */
    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 13})
    /* compiled from: SVGAParser.kt */
    public static final class e implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ d f4876a;

        /* renamed from: b  reason: collision with root package name */
        final /* synthetic */ URL f4877b;
        final /* synthetic */ c c;

        e(d dVar, URL url, c cVar) {
            this.f4876a = dVar;
            this.f4877b = url;
            this.c = cVar;
        }

        public final void run() {
            d dVar = this.f4876a;
            dVar.c(dVar.a((d) this.f4877b), this.c);
        }
    }

    public static /* synthetic */ void a(d dVar, InputStream inputStream, String str, c cVar, boolean z, int i2, Object obj) {
        if ((i2 & 8) != 0) {
            z = false;
        }
        dVar.a(inputStream, str, cVar, z);
    }

    public final void a(@NotNull InputStream inputStream, @NotNull String str, @NotNull c cVar, boolean z) {
        j.b(inputStream, "inputStream");
        j.b(str, "cacheKey");
        j.b(cVar, "callback");
        e.execute(new RunnableC0121d(this, inputStream, str, cVar, z));
    }

    @Deprecated
    public final void b(@NotNull String str, @NotNull c cVar) {
        j.b(str, "assetsName");
        j.b(cVar, "callback");
        a(str, cVar);
    }

    @Deprecated
    public final void b(@NotNull URL url, @NotNull c cVar) {
        j.b(url, "url");
        j.b(cVar, "callback");
        a(url, cVar);
    }

    /* access modifiers changed from: package-private */
    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 13})
    /* compiled from: SVGAParser.kt */
    public static final class h implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ c f4882a;

        /* renamed from: b  reason: collision with root package name */
        final /* synthetic */ f f4883b;

        h(c cVar, f fVar) {
            this.f4882a = cVar;
            this.f4883b = fVar;
        }

        public final void run() {
            this.f4882a.a(this.f4883b);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private final void a(f fVar, c cVar) {
        new Handler(this.c.getMainLooper()).post(new h(cVar, fVar));
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private final void a(Exception exc, c cVar) {
        exc.printStackTrace();
        new Handler(this.c.getMainLooper()).post(new i(cVar));
    }

    /* access modifiers changed from: package-private */
    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 13})
    /* compiled from: SVGAParser.kt */
    public static final class i implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ c f4884a;

        i(c cVar) {
            this.f4884a = cVar;
        }

        public final void run() {
            this.f4884a.a();
        }
    }

    private final boolean a(String str) {
        return c(str).exists();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Code restructure failed: missing block: B:13:0x0067, code lost:
        r2 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:18:0x006c, code lost:
        kotlin.d.a.a(r0, r2);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:19:0x006f, code lost:
        throw r2;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:40:0x00d1, code lost:
        r4 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:44:0x00d5, code lost:
        kotlin.d.a.a(r5, r2);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:45:0x00d8, code lost:
        throw r4;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:46:0x00d9, code lost:
        r2 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:51:0x00de, code lost:
        kotlin.d.a.a(r0, r2);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:52:0x00e1, code lost:
        throw r2;
     */
    private final void c(String str, c cVar) {
        try {
            StringBuilder sb = new StringBuilder();
            File cacheDir = this.c.getCacheDir();
            j.a((Object) cacheDir, "context.cacheDir");
            sb.append(cacheDir.getAbsolutePath());
            sb.append(MqttTopic.TOPIC_LEVEL_SEPARATOR);
            sb.append(str);
            sb.append(MqttTopic.TOPIC_LEVEL_SEPARATOR);
            File file = new File(sb.toString());
            File file2 = new File(file, "movie.binary");
            if (!file2.isFile()) {
                file2 = null;
            }
            if (file2 != null) {
                try {
                    FileInputStream fileInputStream = new FileInputStream(file2);
                    Throwable th = null;
                    MovieEntity decode = MovieEntity.ADAPTER.decode(fileInputStream);
                    j.a((Object) decode, "MovieEntity.ADAPTER.decode(it)");
                    a(new f(decode, file), cVar);
                    y yVar = y.f13349a;
                    kotlin.d.a.a(fileInputStream, th);
                } catch (Exception e2) {
                    file.delete();
                    file2.delete();
                    throw e2;
                }
            }
            File file3 = new File(file, "movie.spec");
            if (!file3.isFile()) {
                file3 = null;
            }
            if (file3 != null) {
                try {
                    FileInputStream fileInputStream2 = new FileInputStream(file3);
                    Throwable th2 = null;
                    FileInputStream fileInputStream3 = fileInputStream2;
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                    Throwable th3 = null;
                    ByteArrayOutputStream byteArrayOutputStream2 = byteArrayOutputStream;
                    byte[] bArr = new byte[2048];
                    while (true) {
                        int read = fileInputStream3.read(bArr, 0, bArr.length);
                        if (read == -1) {
                            a(new f(new JSONObject(byteArrayOutputStream2.toString()), file), cVar);
                            y yVar2 = y.f13349a;
                            kotlin.d.a.a(byteArrayOutputStream, th3);
                            y yVar3 = y.f13349a;
                            kotlin.d.a.a(fileInputStream2, th2);
                            return;
                        }
                        byteArrayOutputStream2.write(bArr, 0, read);
                    }
                } catch (Exception e3) {
                    file.delete();
                    file3.delete();
                    throw e3;
                }
            }
        } catch (Exception e4) {
            a(e4, cVar);
        }
    }

    private final String b(String str) {
        MessageDigest instance = MessageDigest.getInstance("MD5");
        Charset forName = Charset.forName("UTF-8");
        j.a((Object) forName, "Charset.forName(charsetName)");
        if (str != null) {
            byte[] bytes = str.getBytes(forName);
            j.a((Object) bytes, "(this as java.lang.String).getBytes(charset)");
            instance.update(bytes);
            byte[] digest = instance.digest();
            String str2 = "";
            for (byte b2 : digest) {
                StringBuilder sb = new StringBuilder();
                sb.append(str2);
                aa aaVar = aa.f13298a;
                Object[] objArr = {Byte.valueOf(b2)};
                String format = String.format("%02x", Arrays.copyOf(objArr, objArr.length));
                j.a((Object) format, "java.lang.String.format(format, *args)");
                sb.append(format);
                str2 = sb.toString();
            }
            return str2;
        }
        throw new v("null cannot be cast to non-null type java.lang.String");
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private final String a(URL url) {
        String url2 = url.toString();
        j.a((Object) url2, "url.toString()");
        return b(url2);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private final File c(String str) {
        StringBuilder sb = new StringBuilder();
        File cacheDir = this.c.getCacheDir();
        j.a((Object) cacheDir, "context.cacheDir");
        sb.append(cacheDir.getAbsolutePath());
        sb.append(MqttTopic.TOPIC_LEVEL_SEPARATOR);
        sb.append(str);
        sb.append(MqttTopic.TOPIC_LEVEL_SEPARATOR);
        return new File(sb.toString());
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0029, code lost:
        kotlin.d.a.a(r0, r8);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:15:0x002c, code lost:
        throw r8;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:9:0x0024, code lost:
        r8 = move-exception;
     */
    private final byte[] a(InputStream inputStream) {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        Throwable th = null;
        ByteArrayOutputStream byteArrayOutputStream2 = byteArrayOutputStream;
        byte[] bArr = new byte[2048];
        while (true) {
            int read = inputStream.read(bArr, 0, 2048);
            if (read <= 0) {
                byte[] byteArray = byteArrayOutputStream2.toByteArray();
                kotlin.d.a.a(byteArrayOutputStream, th);
                return byteArray;
            }
            byteArrayOutputStream2.write(bArr, 0, read);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0035, code lost:
        kotlin.d.a.a(r3, r8);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:15:0x0038, code lost:
        throw r8;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:9:0x0030, code lost:
        r8 = move-exception;
     */
    private final byte[] a(byte[] bArr) {
        Inflater inflater = new Inflater();
        inflater.setInput(bArr, 0, bArr.length);
        byte[] bArr2 = new byte[2048];
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        Throwable th = null;
        ByteArrayOutputStream byteArrayOutputStream2 = byteArrayOutputStream;
        while (true) {
            int inflate = inflater.inflate(bArr2, 0, 2048);
            if (inflate <= 0) {
                inflater.end();
                byte[] byteArray = byteArrayOutputStream2.toByteArray();
                kotlin.d.a.a(byteArrayOutputStream, th);
                return byteArray;
            }
            byteArrayOutputStream2.write(bArr2, 0, inflate);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Code restructure failed: missing block: B:26:0x0078, code lost:
        r13 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:31:0x007d, code lost:
        kotlin.d.a.a(r6, r13);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:32:0x0080, code lost:
        throw r13;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:36:0x008f, code lost:
        r13 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:41:0x0094, code lost:
        kotlin.d.a.a(r4, r13);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:42:0x0097, code lost:
        throw r13;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:43:0x0098, code lost:
        r13 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:48:0x009d, code lost:
        kotlin.d.a.a(r1, r13);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:49:0x00a0, code lost:
        throw r13;
     */
    private final void a(InputStream inputStream, String str) {
        synchronized (Integer.valueOf(e.a())) {
            File c2 = c(str);
            c2.mkdirs();
            try {
                BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
                Throwable th = null;
                ZipInputStream zipInputStream = new ZipInputStream(bufferedInputStream);
                Throwable th2 = null;
                ZipInputStream zipInputStream2 = zipInputStream;
                while (true) {
                    ZipEntry nextEntry = zipInputStream2.getNextEntry();
                    if (nextEntry != null) {
                        String name = nextEntry.getName();
                        j.a((Object) name, "zipItem.name");
                        if (!n.c((CharSequence) name, (CharSequence) MqttTopic.TOPIC_LEVEL_SEPARATOR, false, 2, (Object) null)) {
                            FileOutputStream fileOutputStream = new FileOutputStream(new File(c2, nextEntry.getName()));
                            Throwable th3 = null;
                            FileOutputStream fileOutputStream2 = fileOutputStream;
                            byte[] bArr = new byte[2048];
                            while (true) {
                                int read = zipInputStream2.read(bArr);
                                if (read <= 0) {
                                    break;
                                }
                                fileOutputStream2.write(bArr, 0, read);
                            }
                            y yVar = y.f13349a;
                            kotlin.d.a.a(fileOutputStream, th3);
                            zipInputStream2.closeEntry();
                        }
                    } else {
                        y yVar2 = y.f13349a;
                        kotlin.d.a.a(zipInputStream, th2);
                        y yVar3 = y.f13349a;
                        kotlin.d.a.a(bufferedInputStream, th);
                        y yVar4 = y.f13349a;
                    }
                }
            } catch (Exception e2) {
                c2.delete();
                throw e2;
            }
        }
    }
}