package com.bytedance.ies.xelement.bytedlottie;

import X.0HH;
import X.0Ib;
import X.0Ih;
import X.0JT;
import X.0Jt;
import X.0KE;
import X.0KO;
import X.0KP;
import X.1Fq;
import X.1GK;
import X.2Pr;
import X.3DL;
import X.4Ms;
import X.7lW;
import X.7tl;
import X.7xU;
import X.86q;
import X.C1114Pah;
import X.C3243QLo;
import X.C3244QLp;
import X.C3245QLq;
import X.C4208QjV;
import X.C4210QjX;
import X.C4211QjY;
import X.C4212QjZ;
import X.C4213Qja;
import X.C4217Qje;
import X.C4218Qjf;
import X.C4220Qjh;
import X.C4221Qji;
import X.C4222Qjj;
import X.C4225Qjm;
import X.C4398QmZ;
import X.C4502QoF;
import X.C4513QoQ;
import X.L8o;
import X.L8s;
import X.L9N;
import X.LC0;
import X.LVf;
import X.LVh;
import X.LY9;
import X.LYB;
import X.Lgy;
import X.LhC;
import X.M12;
import X.OAt;
import X.PZN;
import X.Q39;
import X.QCT;
import X.QD4;
import X.QD9;
import X.QDF;
import X.QHV;
import X.QIL;
import X.QJW;
import X.QNL;
import X.QWU;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.view.View;
import android.widget.ImageView;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.lynx.react.bridge.Callback;
import com.lynx.react.bridge.JavaOnlyMap;
import com.lynx.react.bridge.ReadableMap;
import com.lynx.tasm.base.LLog;
import com.lynx.tasm.behavior.ui.LynxUI;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import kotlin.h.b.n;
import kotlin.o.y;
import kotlin.o.z;

public final class LynxBytedLottieView extends LynxUI<1Fq> implements 1GK {
    public static final C4222Qjj LJJI = new C4222Qjj((byte) 0);
    public boolean LIZ;
    public boolean LIZIZ;
    public int LIZJ;
    public int LIZLLL;
    public int LJ;
    public String LJFF;
    public String LJI;
    public L8s LJII;
    public boolean LJIIIIZZ;
    public boolean LJIIIZ;
    public boolean LJIIJ;
    public boolean LJIIJJI;
    public String LJIIL;
    public ReadableMap LJIILIIL;
    public final List<Integer> LJIILJJIL;
    public final List<Integer> LJIILL;
    public final LVf LJIILLIIL;
    public 0Jt LJIIZILJ;
    public C4220Qjh LJIJ;
    public String LJIJI;
    public ArrayList<C1114Pah<?>> LJIJJ;
    public boolean LJIJJLI;
    public volatile boolean LJIL;
    public 0Ib LJJ;
    public boolean LJJIFFI;
    public Set<String> LJJII;
    public boolean LJJIII;
    public 3DL<L8o> LJJIIJ;
    public int LJJIIJZLJL;
    public int LJJIIZ;

    static {
        Covode.recordClassIndex(32143);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:20:0x0050, code lost:
        r0 = r2.getLastPathSegment();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:21:0x0054, code lost:
        if (r0 == null) goto L_0x005f;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:23:0x005a, code lost:
        if (kotlin.o.y.LIZJ(r0, ".json", false) == false) goto L_0x005f;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:24:0x005c, code lost:
        LIZIZ(r7);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:25:0x005f, code lost:
        r3 = X.QZZ.with(r9.mContext);
        r3.url(r7);
        r3.name(r2.getLastPathSegment());
        r0 = r9.mContext;
        kotlin.h.b.n.LIZ(r0, X.Q39.LIZJ);
        r0 = LIZ(r0);
        kotlin.h.b.n.LIZ(r0, X.Q39.LIZJ);
        r0 = LIZ(r0);
        kotlin.h.b.n.LIZ(r0, X.Q39.LIZJ);
        r3.savePath(r0.getAbsolutePath());
        r3.autoSetHashCodeForSameTask(true);
        r3.mainThreadListener(new X.LYA(r9, r2));
        r3.download();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:31:0x00c5, code lost:
        r6 = r2.getPath();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:32:0x00c9, code lost:
        if (r6 != null) goto L_0x00cc;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:35:0x00d2, code lost:
        if (kotlin.o.y.LIZIZ(r6, "/", false) != true) goto L_0x00db;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:36:0x00d4, code lost:
        r6 = r6.substring(1);
        kotlin.h.b.n.LIZ(r6, X.Q39.LIZJ);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:38:0x00df, code lost:
        if (kotlin.o.y.LIZJ(r7, ".json", false) == false) goto L_0x00e4;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:39:0x00e1, code lost:
        LIZIZ(r7);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:40:0x00e4, code lost:
        r9.LJIIJJI = true;
        r3 = r9.mContext;
        X.0KE.LIZ(r3, r6, toString() + r2.getPath(), r9, r9.LJJ);
        r0 = java.util.UUID.randomUUID().toString();
        kotlin.h.b.n.LIZ(r0, X.Q39.LIZJ);
        r9.LJIIL = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:41:0x0114, code lost:
        return;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:43:0x0116, code lost:
        return;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:52:?, code lost:
        return;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(java.lang.String r10) {
        /*
            r9 = this;
            java.lang.String r4 = "byted-lottie"
            java.lang.String r5 = ""
            r3 = 0
            r9.LJIIIIZZ = r3     // Catch:{ Exception -> 0x0117 }
            X.QmZ r0 = r9.mContext     // Catch:{ Exception -> 0x0117 }
            java.lang.String r7 = X.LVh.LIZ(r0, r10)     // Catch:{ Exception -> 0x0117 }
            java.lang.String r1 = "loadLottie from legacy with url: "
            java.lang.String r0 = java.lang.String.valueOf(r7)     // Catch:{ Exception -> 0x0117 }
            java.lang.String r0 = r1.concat(r0)     // Catch:{ Exception -> 0x0117 }
            com.lynx.tasm.base.LLog.LIZIZ(r4, r0)     // Catch:{ Exception -> 0x0117 }
            if (r7 == 0) goto L_0x0128
            android.net.Uri r2 = android.net.Uri.parse(r7)     // Catch:{ Exception -> 0x0117 }
            kotlin.h.b.n.LIZ(r2, r5)     // Catch:{ Exception -> 0x0117 }
            java.lang.String r6 = r2.getScheme()     // Catch:{ Exception -> 0x0117 }
            if (r6 != 0) goto L_0x002a
            return
        L_0x002a:
            int r0 = r6.hashCode()     // Catch:{ Exception -> 0x0117 }
            java.lang.String r8 = ".json"
            r1 = 1
            switch(r0) {
                case -1408207997: goto L_0x00bd;
                case 3143036: goto L_0x0098;
                case 3213448: goto L_0x0048;
                case 93121264: goto L_0x0035;
                case 99617003: goto L_0x003f;
                default: goto L_0x0034;
            }
        L_0x0034:
            return
        L_0x0035:
            java.lang.String r0 = "asset"
            boolean r0 = r6.equals(r0)     // Catch:{ Exception -> 0x0117 }
            if (r0 == 0) goto L_0x0034
            goto L_0x00c5
        L_0x003f:
            java.lang.String r0 = "https"
            boolean r0 = r6.equals(r0)     // Catch:{ Exception -> 0x0117 }
            if (r0 == 0) goto L_0x0034
            goto L_0x0050
        L_0x0048:
            java.lang.String r0 = "http"
            boolean r0 = r6.equals(r0)     // Catch:{ Exception -> 0x0117 }
            if (r0 == 0) goto L_0x0034
        L_0x0050:
            java.lang.String r0 = r2.getLastPathSegment()     // Catch:{ Exception -> 0x0117 }
            if (r0 == 0) goto L_0x005f
            boolean r0 = kotlin.o.y.LIZJ(r0, r8, r3)     // Catch:{ Exception -> 0x0117 }
            if (r0 == 0) goto L_0x005f
            r9.LIZIZ(r7)     // Catch:{ Exception -> 0x0117 }
        L_0x005f:
            X.QmZ r0 = r9.mContext     // Catch:{ Exception -> 0x0117 }
            com.ss.android.socialbase.downloader.model.DownloadTask r3 = X.QZZ.with(r0)     // Catch:{ Exception -> 0x0117 }
            r3.url(r7)     // Catch:{ Exception -> 0x0117 }
            java.lang.String r0 = r2.getLastPathSegment()     // Catch:{ Exception -> 0x0117 }
            r3.name(r0)     // Catch:{ Exception -> 0x0117 }
            X.QmZ r0 = r9.mContext     // Catch:{ Exception -> 0x0117 }
            kotlin.h.b.n.LIZ(r0, r5)     // Catch:{ Exception -> 0x0117 }
            android.content.Context r0 = LIZ((X.C4398QmZ) r0)     // Catch:{ Exception -> 0x0117 }
            kotlin.h.b.n.LIZ(r0, r5)     // Catch:{ Exception -> 0x0117 }
            java.io.File r0 = LIZ((android.content.Context) r0)     // Catch:{ Exception -> 0x0117 }
            kotlin.h.b.n.LIZ(r0, r5)     // Catch:{ Exception -> 0x0117 }
            java.lang.String r0 = r0.getAbsolutePath()     // Catch:{ Exception -> 0x0117 }
            r3.savePath(r0)     // Catch:{ Exception -> 0x0117 }
            r3.autoSetHashCodeForSameTask(r1)     // Catch:{ Exception -> 0x0117 }
            X.LYA r0 = new X.LYA     // Catch:{ Exception -> 0x0117 }
            r0.<init>(r9, r2)     // Catch:{ Exception -> 0x0117 }
            r3.mainThreadListener(r0)     // Catch:{ Exception -> 0x0117 }
            r3.download()     // Catch:{ Exception -> 0x0117 }
            goto L_0x0114
        L_0x0098:
            java.lang.String r0 = "file"
            boolean r0 = r6.equals(r0)     // Catch:{ Exception -> 0x0117 }
            if (r0 == 0) goto L_0x0034
            r9.LIZIZ(r7)     // Catch:{ Exception -> 0x0117 }
            r9.LJIIJJI = r1     // Catch:{ Exception -> 0x0117 }
            java.util.UUID r0 = java.util.UUID.randomUUID()     // Catch:{ Exception -> 0x0117 }
            java.lang.String r0 = r0.toString()     // Catch:{ Exception -> 0x0117 }
            kotlin.h.b.n.LIZ(r0, r5)     // Catch:{ Exception -> 0x0117 }
            r9.LJIIL = r0     // Catch:{ Exception -> 0x0117 }
            java.lang.String r2 = r2.getPath()     // Catch:{ Exception -> 0x0117 }
            r1 = r9
            X.0Ib r0 = r9.LJJ     // Catch:{ Exception -> 0x0117 }
            X.0KE.LIZ(r2, r1, r0)     // Catch:{ Exception -> 0x0117 }
            goto L_0x0115
        L_0x00bd:
            java.lang.String r0 = "assets"
            boolean r0 = r6.equals(r0)     // Catch:{ Exception -> 0x0117 }
            if (r0 == 0) goto L_0x0034
        L_0x00c5:
            java.lang.String r6 = r2.getPath()     // Catch:{ Exception -> 0x0117 }
            if (r6 != 0) goto L_0x00cc
            goto L_0x0116
        L_0x00cc:
            java.lang.String r0 = "/"
            boolean r0 = kotlin.o.y.LIZIZ(r6, r0, r3)     // Catch:{ Exception -> 0x0117 }
            if (r0 != r1) goto L_0x00db
            java.lang.String r6 = r6.substring(r1)     // Catch:{ Exception -> 0x0117 }
            kotlin.h.b.n.LIZ(r6, r5)     // Catch:{ Exception -> 0x0117 }
        L_0x00db:
            boolean r0 = kotlin.o.y.LIZJ(r7, r8, r3)     // Catch:{ Exception -> 0x0117 }
            if (r0 == 0) goto L_0x00e4
            r9.LIZIZ(r7)     // Catch:{ Exception -> 0x0117 }
        L_0x00e4:
            r9.LJIIJJI = r1     // Catch:{ Exception -> 0x0117 }
            X.QmZ r3 = r9.mContext     // Catch:{ Exception -> 0x0117 }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ Exception -> 0x0117 }
            r1.<init>()     // Catch:{ Exception -> 0x0117 }
            java.lang.String r0 = r9.toString()     // Catch:{ Exception -> 0x0117 }
            r1.append(r0)     // Catch:{ Exception -> 0x0117 }
            java.lang.String r0 = r2.getPath()     // Catch:{ Exception -> 0x0117 }
            r1.append(r0)     // Catch:{ Exception -> 0x0117 }
            java.lang.String r2 = r1.toString()     // Catch:{ Exception -> 0x0117 }
            r1 = r9
            X.0Ib r0 = r9.LJJ     // Catch:{ Exception -> 0x0117 }
            X.0KE.LIZ(r3, r6, r2, r1, r0)     // Catch:{ Exception -> 0x0117 }
            java.util.UUID r0 = java.util.UUID.randomUUID()     // Catch:{ Exception -> 0x0117 }
            java.lang.String r0 = r0.toString()     // Catch:{ Exception -> 0x0117 }
            kotlin.h.b.n.LIZ(r0, r5)     // Catch:{ Exception -> 0x0117 }
            r9.LJIIL = r0     // Catch:{ Exception -> 0x0117 }
            goto L_0x0034
        L_0x0114:
            return
        L_0x0115:
            return
        L_0x0116:
            return
        L_0x0117:
            r0 = move-exception
            X.0HH.LIZ(r0)
            java.lang.String r1 = java.lang.String.valueOf(r0)
            java.lang.String r0 = "legacySetSrc fail: "
            java.lang.String r0 = r0.concat(r1)
            com.lynx.tasm.base.LLog.LIZLLL(r4, r0)
        L_0x0128:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.ies.xelement.bytedlottie.LynxBytedLottieView.LIZ(java.lang.String):void");
    }

    public final void LIZ(String str, Map<String, Object> map) {
        Set<String> set = this.LJJII;
        if (set != null && set.contains(str)) {
            if (LhC.LIZ()) {
                LIZIZ(str, map);
            } else {
                LhC.LIZ(new C4221Qji(this, str, map));
            }
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:32:0x00d6, code lost:
        if (r0 == null) goto L_0x00d8;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(X.0KP r9, X.0JT<android.graphics.Bitmap> r10) {
        /*
            r8 = this;
            X.M12.LIZ(r10)
            java.lang.String r0 = r8.LJFF
            boolean r0 = android.text.TextUtils.isEmpty(r0)
            java.lang.String r2 = "byted-lottie"
            if (r0 != 0) goto L_0x000f
            if (r9 != 0) goto L_0x0028
        L_0x000f:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "fetchBitmap error mSrcUrl=`"
            r1.<init>(r0)
            java.lang.String r0 = r8.LJFF
            r1.append(r0)
            java.lang.String r0 = "`, or asset is null"
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            com.lynx.tasm.base.LLog.LIZLLL(r2, r0)
            return
        L_0x0028:
            boolean r0 = r8.LJIIJ
            if (r0 != 0) goto L_0x0045
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "fetchBitmapAsync error, one bitmap is already fetch fail before this, and mSrcUrl=`"
            r1.<init>(r0)
            java.lang.String r0 = r8.LJFF
            r1.append(r0)
            java.lang.String r0 = "`,"
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            com.lynx.tasm.base.LLog.LIZLLL(r2, r0)
            return
        L_0x0045:
            java.lang.String r1 = r9.LIZLLL
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZ(r1, r0)
            java.lang.String r0 = "data:"
            r5 = 0
            boolean r0 = kotlin.o.y.LIZIZ(r1, r0, r5)
            if (r0 == 0) goto L_0x0066
            java.lang.String r0 = "fetchBitmapAsync with base64"
            com.lynx.tasm.base.LLog.LIZIZ(r2, r0)
            X.ILi r1 = X.ILi.LIZ
            java.lang.String r0 = r9.LIZLLL
            android.graphics.Bitmap r0 = r1.LIZ(r0)
            r10.LIZ(r0)
            return
        L_0x0066:
            boolean r0 = r8.LJIIIIZZ
            if (r0 == 0) goto L_0x008a
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            r1.<init>()
            java.lang.String r0 = r9.LJ
            r1.append(r0)
            java.lang.String r0 = r9.LIZLLL
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            java.lang.String r1 = r8.LIZJ(r0)
            X.Qjb r0 = new X.Qjb
            r0.<init>(r8, r10, r1)
            r8.LIZ((java.lang.String) r1, (X.0KP) r9, (X.C3245QLq) r0)
            return
        L_0x008a:
            java.lang.String r4 = r8.LJFF
            if (r4 == 0) goto L_0x0111
            java.lang.String r6 = "http://"
            boolean r0 = kotlin.o.y.LIZIZ(r4, r6, r5)
            java.lang.String r3 = "https://"
            if (r0 != 0) goto L_0x00ae
            boolean r0 = kotlin.o.y.LIZIZ(r4, r3, r5)
            if (r0 != 0) goto L_0x00ae
            java.lang.String r0 = "file:/"
            boolean r0 = kotlin.o.y.LIZIZ(r4, r0, r5)
            if (r0 != 0) goto L_0x00ae
            java.lang.String r0 = "asset://"
            boolean r0 = kotlin.o.y.LIZIZ(r4, r0, r5)
            if (r0 == 0) goto L_0x012b
        L_0x00ae:
            X.2sG r2 = new X.2sG
            r2.<init>()
            com.lynx.react.bridge.ReadableMap r7 = r8.LJIILIIL
            if (r7 == 0) goto L_0x00d8
            java.lang.String r0 = r9.LIZJ
            boolean r0 = r7.hasKey(r0)
            if (r0 == 0) goto L_0x00d8
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            r1.<init>()
            java.lang.String r0 = r9.LJ
            r1.append(r0)
            java.lang.String r0 = r9.LIZJ
            java.lang.String r0 = r7.getString(r0)
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            if (r0 != 0) goto L_0x00eb
        L_0x00d8:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            r1.<init>()
            java.lang.String r0 = r9.LJ
            r1.append(r0)
            java.lang.String r0 = r9.LIZLLL
            r1.append(r0)
            java.lang.String r0 = r1.toString()
        L_0x00eb:
            r2.element = r0
            java.lang.Object r0 = r2.element
            java.lang.String r0 = (java.lang.String) r0
            boolean r0 = kotlin.o.y.LIZIZ(r0, r6, r5)
            if (r0 != 0) goto L_0x0101
            java.lang.Object r0 = r2.element
            java.lang.String r0 = (java.lang.String) r0
            boolean r0 = kotlin.o.y.LIZIZ(r0, r3, r5)
            if (r0 == 0) goto L_0x0112
        L_0x0101:
            java.lang.Object r0 = r2.element
        L_0x0103:
            r2.element = r0
            java.lang.Object r1 = r2.element
            java.lang.String r1 = (java.lang.String) r1
            X.QjW r0 = new X.QjW
            r0.<init>(r2, r8, r9, r10)
            r8.LIZ((java.lang.String) r1, (X.0KP) r9, (X.C3245QLq) r0)
        L_0x0111:
            return
        L_0x0112:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            r1.<init>()
            r1.append(r4)
            r0 = 47
            r1.append(r0)
            java.lang.Object r0 = r2.element
            java.lang.String r0 = (java.lang.String) r0
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            goto L_0x0103
        L_0x012b:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "use mSrcDir, the schema of mSrcDir is not supported, mSrcDir: "
            r1.<init>(r0)
            java.lang.String r0 = r8.LJFF
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            r3 = 1
            r8.LIZ((java.lang.String) r0, (java.lang.String) r4, (int) r3)
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "request resource from "
            r1.<init>(r0)
            java.lang.String r0 = r8.LJFF
            r1.append(r0)
            java.lang.String r0 = " failed"
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            java.util.Map r1 = r8.LIZ((int) r3, (java.lang.String) r0)
            java.lang.String r0 = "error"
            r8.LIZ((java.lang.String) r0, (java.util.Map<java.lang.String, java.lang.Object>) r1)
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "fetchBitmap mSrcUrl=`"
            r1.<init>(r0)
            java.lang.String r0 = r8.LJFF
            r1.append(r0)
            java.lang.String r0 = "`, url=`"
            r1.append(r0)
            java.lang.String r0 = r8.LJFF
            r1.append(r0)
            java.lang.String r0 = "` not exists. lottieUrl is "
            r1.append(r0)
            java.lang.String r0 = r8.LJI
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            com.lynx.tasm.base.LLog.LIZLLL(r2, r0)
            r10.LIZ()
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.ies.xelement.bytedlottie.LynxBytedLottieView.LIZ(X.0KP, X.0JT):void");
    }

    /* JADX WARNING: type inference failed for: r2v1, types: [X.QLp, X.QGu] */
    public final void LIZ(String str, String str2, 0KP r12, C3245QLq qLq) {
        0KP r6 = r12;
        C3245QLq qLq2 = qLq;
        String str3 = str2;
        M12.LIZ(str, str3, r6, qLq2);
        String LIZ2 = LVh.LIZ(this.mContext, str);
        LLog.LIZIZ("byted-lottie", "requestBitmap: ".concat(String.valueOf(LIZ2)));
        Uri parse = Uri.parse(LIZ2);
        if (parse == null || parse.getPath() == null) {
            this.LJIIJ = false;
            qLq2.LIZ("uri.path is null and uri is ".concat(String.valueOf(parse)));
            return;
        }
        QDF LIZ3 = QDF.LIZ(parse);
        LIZ3.LIZ(QD4.HIGH);
        QJW.LIZ(LIZ3);
        String path = parse.getPath();
        if (path != null && !r6.LJFF) {
            n.LIZ(LIZ3, Q39.LIZJ);
            LIZ3.LIZ((QCT) new C3243QLo(path, this, r6, LIZ3));
        }
        QIL<C1114Pah<QD9>> LIZIZ2 = QHV.LIZJ().LIZIZ(LIZ3.LIZ(), "byted-lottie");
        if (LIZIZ2 == null) {
            qLq2.LIZ(str);
        } else {
            LIZIZ2.LIZ(new C3244QLp(this, LIZ2, qLq2, r6, str3, LIZIZ2), PZN.LIZ());
        }
    }

    public final void LIZ(3DL<L8o> r1) {
        M12.LIZ(r1);
        this.LJJIIJ = r1;
    }

    public final void LIZ(String str, String str2, int i) {
        LIZ("error", LIZ(i, str));
        this.LJIILLIIL.LIZ(this.LJI, str2, str);
        LLog.LIZLLL("byted-lottie", str);
    }

    private final void LIZIZ() {
        if (this.LJFF != null) {
            this.LJFF = null;
            this.LJIIJ = true;
            ((1Fq) this.mView).setImageDrawable((Drawable) null);
            1Fq r0 = (1Fq) this.mView;
            if (r0 != null) {
                r0.setImageAssetDelegate((0Ih) null);
                r0.LJII();
            }
        }
    }

    private final void LIZJ() {
        Iterator<C1114Pah<?>> it = this.LJIJJ.iterator();
        while (it.hasNext()) {
            C1114Pah.LIZJ(it.next());
        }
        this.LJIJJ.clear();
    }

    public final void onPropsUpdated() {
        super.onPropsUpdated();
        if (this.LIZIZ && !this.LJJIFFI && !this.LJJIII && this.LJIIJ) {
            ((1Fq) this.mView).LIZJ();
        }
        this.LJJIII = false;
    }

    public final void destroy() {
        MethodCollector.i(851);
        super.destroy();
        ((1Fq) this.mView).LJFF();
        ((1Fq) this.mView).LJ();
        ((1Fq) this.mView).LJIIJ();
        ((1Fq) this.mView).LJII();
        synchronized (this) {
            try {
                LIZJ();
                T t = this.mView;
                if (!(t instanceof C4217Qje)) {
                    t = null;
                }
                C4217Qje qje = (C4217Qje) t;
                if (qje != null) {
                    qje.setDestroyed(true);
                }
                this.LJIL = true;
            } finally {
                MethodCollector.o(851);
            }
        }
    }

    public final void LIZ() {
        ReadableMap readableMap;
        0Jt r2 = this.LJIIZILJ;
        if (r2 != null && (readableMap = this.LJIILIIL) != null) {
            LIZ(r2, readableMap, (0JT<String>) new C4210QjX(r2, this));
        }
    }

    @QNL(LIZ = "end-frame", LJ = -1)
    public final void setEndFrame2(int i) {
        setEndFrame(i);
    }

    @QNL(LIZ = "keeplastframe", LJFF = true)
    public final void setKeepLastFrame(boolean z) {
        this.LIZ = z;
    }

    @QNL(LIZ = "only-local", LJFF = false)
    public final void setOnlyLocal(boolean z) {
        this.LJIJJLI = z;
    }

    @QNL(LIZ = "start-frame", LJ = 0)
    public final void setStartFrame2(int i) {
        setStartFrame(i);
    }

    public /* synthetic */ LynxBytedLottieView(C4398QmZ qmZ) {
        this(qmZ, Q39.LIZJ);
    }

    @QNL(LIZ = "bid")
    public final void setBID(String str) {
        M12.LIZ(str);
        this.LJIJI = str;
    }

    public static Context LIZ(C4398QmZ qmZ) {
        Context applicationContext = qmZ.getApplicationContext();
        if (7lW.LIZJ && applicationContext == null) {
            return 7lW.LIZ;
        }
        return applicationContext;
    }

    public final void setEvents(Map<String, LC0> map) {
        Set<String> set;
        super.setEvents(map);
        if (map != null) {
            set = map.keySet();
        } else {
            set = null;
        }
        this.LJJII = set;
    }

    @QNL(LIZ = "ignore-attach-status", LJFF = false)
    public final void setIgnoreAttachStatus(boolean z) {
        T t = this.mView;
        if (!(t instanceof C4217Qje)) {
            t = null;
        }
        C4217Qje qje = (C4217Qje) t;
        if (qje != null) {
            qje.setIgnoreAttachStatus(z);
        }
    }

    @QNL(LIZ = "repetcount", LJ = -1)
    public final void setRepeat(int i) {
        if (i < 0) {
            i = -1;
        }
        T t = this.mView;
        n.LIZ(t, Q39.LIZJ);
        ((1Fq) t).setRepeatCount(i);
    }

    @QNL(LIZ = "src-format")
    public final void setSrcFormat(String str) {
        if (str != null && !y.LIZ(str)) {
            LIZIZ();
            LIZLLL(str);
        }
    }

    @QNL(LIZ = "src-polyfill")
    public final void setSrcPolyfill(ReadableMap readableMap) {
        M12.LIZ(readableMap);
        this.LJIILIIL = readableMap;
        LIZ();
    }

    @QNL(LIZ = "startframe", LJ = 0)
    public final void setStartFrame(int i) {
        this.LJJIIJZLJL = i;
        ((1Fq) this.mView).setMinFrame(i);
    }

    public static File LIZ(Context context) {
        if (4Ms.LIZIZ != null && 4Ms.LJ) {
            return 4Ms.LIZIZ;
        }
        File cacheDir = context.getCacheDir();
        4Ms.LIZIZ = cacheDir;
        return cacheDir;
    }

    @QNL(LIZ = "autoplay", LJFF = true)
    public final void setAutoPlay(boolean z) {
        this.LIZIZ = z;
        T t = this.mView;
        if (t != null) {
            ((C4217Qje) t).setMAutoPlay(z);
            return;
        }
        throw new 7xU("null cannot be cast to non-null type com.bytedance.ies.xelement.bytedlottie.LynxBytedLottieAnimationView");
    }

    @QNL(LIZ = "endframe", LJ = -1)
    public final void setEndFrame(int i) {
        if (i < 0) {
            this.LJJIIZ = Integer.MAX_VALUE;
            ((1Fq) this.mView).setMaxFrame(Integer.MAX_VALUE);
            return;
        }
        this.LJJIIZ = i;
        ((1Fq) this.mView).setMaxFrame(i);
    }

    @QNL(LIZ = "json")
    public final void setJson(String str) {
        if (str != null && str.length() != 0) {
            this.LJI = str;
            ((1Fq) this.mView).setImageAssetDelegate(this);
            Lgy lgy = new Lgy(this, str);
            this.LJJ = lgy;
            0KE.LIZIZ(str, this, lgy);
        }
    }

    @QNL(LIZ = "loop", LJFF = false)
    public final void setLoop(boolean z) {
        if (z) {
            T t = this.mView;
            n.LIZ(t, Q39.LIZJ);
            ((1Fq) t).setRepeatCount(-1);
            return;
        }
        T t2 = this.mView;
        n.LIZ(t2, Q39.LIZJ);
        ((1Fq) t2).setRepeatCount(0);
    }

    @QNL(LIZ = "loop-count", LJ = 1)
    public final void setLoopCount(int i) {
        if (i <= 0) {
            T t = this.mView;
            n.LIZ(t, Q39.LIZJ);
            ((1Fq) t).setRepeatCount(-1);
            return;
        }
        T t2 = this.mView;
        n.LIZ(t2, Q39.LIZJ);
        ((1Fq) t2).setRepeatCount(i - 1);
    }

    @QNL(LIZ = "progress")
    public final void setProgress(float f) {
        if (f >= 0.0f || f <= 1.0f) {
            T t = this.mView;
            n.LIZ(t, Q39.LIZJ);
            ((1Fq) t).setProgress(f);
        }
    }

    @QNL(LIZ = "auto-reverse")
    public final void setReverseMode(boolean z) {
        if (z) {
            T t = this.mView;
            n.LIZ(t, Q39.LIZJ);
            ((1Fq) t).setRepeatMode(2);
            return;
        }
        T t2 = this.mView;
        n.LIZ(t2, Q39.LIZJ);
        ((1Fq) t2).setRepeatMode(1);
    }

    @QNL(LIZ = "speed")
    public final void setSpeed(float f) {
        boolean z;
        T t = this.mView;
        n.LIZ(t, Q39.LIZJ);
        ((1Fq) t).setSpeed(f);
        if (f >= 0.0f) {
            z = true;
        } else {
            z = false;
        }
        this.LIZ = z;
    }

    public final void LIZIZ(String str) {
        int LIZIZ2 = z.LIZIZ(str, '/');
        if (LIZIZ2 <= 0) {
            LLog.LIZLLL("byted-lottie", "uri is error:".concat(String.valueOf(str)));
        } else if (str != null) {
            String substring = str.substring(0, LIZIZ2);
            n.LIZ(substring, Q39.LIZJ);
            this.LJFF = substring;
            ((1Fq) this.mView).setImageAssetDelegate(this);
        } else {
            throw new 7xU("null cannot be cast to non-null type java.lang.String");
        }
    }

    public final /* synthetic */ View createView(Context context) {
        1Fq qje = new C4217Qje(context);
        qje.LIZIZ();
        qje.LIZ(true);
        qje.LIZ();
        qje.LIZ(new C4213Qja(this));
        qje.LIZ(new C4212QjZ(this, qje));
        qje.LIZ(new C4208QjV(this));
        return qje;
    }

    @QNL(LIZ = "objectfit")
    public final void setObjectFit(String str) {
        ImageView.ScaleType scaleType;
        M12.LIZ(str);
        int hashCode = str.hashCode();
        if (hashCode != 94852023) {
            if (hashCode == 951526612 && str.equals("contain")) {
                scaleType = ImageView.ScaleType.FIT_CENTER;
                T t = this.mView;
                n.LIZ(t, Q39.LIZJ);
                ((1Fq) t).setScaleType(scaleType);
            }
        } else if (str.equals("cover")) {
            scaleType = ImageView.ScaleType.CENTER_CROP;
            T t2 = this.mView;
            n.LIZ(t2, Q39.LIZJ);
            ((1Fq) t2).setScaleType(scaleType);
        }
        scaleType = ImageView.ScaleType.CENTER;
        T t22 = this.mView;
        n.LIZ(t22, Q39.LIZJ);
        ((1Fq) t22).setScaleType(scaleType);
    }

    @QNL(LIZ = "playstatus")
    public final void setPlayStatus(String str) {
        M12.LIZ(str);
        if (n.LIZ("play", str)) {
            ((1Fq) this.mView).LIZJ();
            this.LJJIII = true;
            this.LJJIFFI = false;
        } else if (n.LIZ("pause", str)) {
            ((1Fq) this.mView).LJII();
            this.LJJIFFI = true;
        }
    }

    @QNL(LIZ = "src")
    public final void setSrc(String str) {
        MethodCollector.i(1783);
        if (str == null || y.LIZ(str)) {
            MethodCollector.o(1783);
            return;
        }
        LIZIZ();
        ((1Fq) this.mView).setImageDrawable((Drawable) null);
        synchronized (this) {
            try {
                LIZJ();
            } catch (Throwable th) {
                MethodCollector.o(1783);
                throw th;
            }
        }
        ((1Fq) this.mView).setMinFrame(this.LJJIIJZLJL);
        ((1Fq) this.mView).setMaxFrame(this.LJJIIZ);
        LIZLLL(str);
        MethodCollector.o(1783);
    }

    private final void LIZLLL(String str) {
        String str2;
        String str3;
        String str4;
        if (y.LIZIZ(str, "./", false)) {
            str2 = LVh.LIZ(this.mContext, str);
        } else {
            str2 = str;
        }
        if (!n.LIZ(this.LJI, str2)) {
            LLog.LIZIZ("byted-lottie", "start load lottie: ".concat(String.valueOf(str2)));
            this.LJI = str2;
            this.LJIILLIIL.LIZ(str2);
            this.LJJ = new Lgy(this, this.LJI);
            T t = this.mView;
            if (!(t instanceof C4217Qje)) {
                t = null;
            }
            C4217Qje qje = (C4217Qje) t;
            if (qje != null) {
                qje.setSrcUrl(this.LJI);
            }
            3DL<L8o> r3 = this.LJJIIJ;
            if (!(r3 == null || (str3 = this.LJI) == null)) {
                this.LJII = null;
                boolean LIZ2 = n.LIZ(getProps().get("only-local"), true);
                this.LJIJJLI = LIZ2;
                if (LIZ2) {
                    str4 = Uri.parse(str3).buildUpon().appendQueryParameter("onlyLocal", "1").build().toString();
                } else {
                    str4 = str3;
                }
                n.LIZ(str4, Q39.LIZJ);
                r3.LIZ(str4, new LY9(str3, r3, this, str), new LYB(r3, this, str));
                if (2Pr.LIZ != null) {
                    return;
                }
            }
            LIZ(str);
        }
    }

    public final Bitmap LIZ(0KP r3) {
        LLog.LIZLLL("byted-lottie", "fetch bitmap should not be called!!!");
        return null;
    }

    public final String LIZJ(String str) {
        String str2;
        L8s l8s = this.LJII;
        if (l8s != null) {
            int i = L9N.LIZIZ[l8s.ordinal()];
            if (i != 1) {
                if (i == 2) {
                    if (y.LIZIZ(str, "http://", false) || y.LIZIZ(str, "https://", false)) {
                        str2 = LVh.LIZ(this.mContext, str);
                    } else {
                        str2 = this.LJFF + '/' + str;
                    }
                    n.LIZ(str2, Q39.LIZJ);
                    if (!y.LIZIZ(str2, "file:", false)) {
                        str2 = "file:".concat(String.valueOf(str2));
                    }
                    n.LIZ(str2, Q39.LIZJ);
                    return str2;
                } else if (i != 3 || y.LIZIZ(str, "http://", false) || y.LIZIZ(str, "https://", false)) {
                    return str;
                } else {
                    return this.LJFF + '/' + str;
                }
            } else if (y.LIZIZ(str, "http://", false) || y.LIZIZ(str, "https://", false)) {
                return str;
            } else {
                return this.LJFF + '/' + str;
            }
        }
        return str;
    }

    @7tl
    public final void listenAnimationUpdate(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap, callback);
        JavaOnlyMap javaOnlyMap = new JavaOnlyMap();
        if (this.mView != null) {
            javaOnlyMap.putBoolean("data", true);
            this.LJIIIZ = readableMap.getBoolean("isListen");
            callback.invoke(new Object[]{0, javaOnlyMap});
            return;
        }
        javaOnlyMap.putString("message", "view is not exist");
        callback.invoke(new Object[]{1, javaOnlyMap});
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public LynxBytedLottieView(C4398QmZ qmZ, String str) {
        super(qmZ);
        M12.LIZ(qmZ, str);
        this.LIZ = true;
        this.LIZIZ = true;
        this.LIZLLL = -1;
        this.LJIIIZ = true;
        this.LJIIJ = true;
        this.LJIIL = Q39.LIZJ;
        this.LJIILJJIL = new ArrayList();
        this.LJIILL = new ArrayList();
        this.LJIILLIIL = new LVf(str);
        this.LJIJ = new C4220Qjh();
        this.LJIJI = Q39.LIZJ;
        this.LJIJJ = new ArrayList<>();
        this.LJJIIZ = Integer.MAX_VALUE;
    }

    public final void LIZIZ(String str, Map<String, Object> map) {
        C4513QoQ qoQ;
        C4398QmZ qmZ = this.mContext;
        if (qmZ != null && (qoQ = qmZ.LJFF) != null) {
            String str2 = str;
            qoQ.LIZ((C4502QoF) new QWU(this, map, str2, getSign(), str2));
        }
    }

    @7tl
    public final void getDuration(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap, callback);
        JavaOnlyMap javaOnlyMap = new JavaOnlyMap();
        if (this.mView != null) {
            T t = this.mView;
            if (t == null) {
                n.LIZ();
            }
            javaOnlyMap.putInt("data", (int) ((1Fq) t).getDuration());
            callback.invoke(new Object[]{0, javaOnlyMap});
            return;
        }
        javaOnlyMap.putString("message", "view is not exist");
        callback.invoke(new Object[]{1, javaOnlyMap});
    }

    @7tl
    public final void isAnimating(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap, callback);
        JavaOnlyMap javaOnlyMap = new JavaOnlyMap();
        if (this.mView != null) {
            T t = this.mView;
            n.LIZ(t, Q39.LIZJ);
            javaOnlyMap.putBoolean("data", ((1Fq) t).LJI());
            callback.invoke(new Object[]{0, javaOnlyMap});
            return;
        }
        javaOnlyMap.putString("message", "view is not exist");
        callback.invoke(new Object[]{1, javaOnlyMap});
    }

    @7tl
    public final void pause(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap, callback);
        JavaOnlyMap javaOnlyMap = new JavaOnlyMap();
        if (this.mView != null) {
            try {
                ((1Fq) this.mView).LJIIIIZZ();
                callback.invoke(new Object[]{0, javaOnlyMap});
            } catch (Exception e) {
                javaOnlyMap.putString("message:", e.getMessage());
                callback.invoke(new Object[]{1, javaOnlyMap});
            }
        } else {
            javaOnlyMap.putString("message", "view is not exist");
            callback.invoke(new Object[]{1, javaOnlyMap});
        }
    }

    @7tl
    public final void play(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap, callback);
        String uuid = UUID.randomUUID().toString();
        n.LIZ(uuid, Q39.LIZJ);
        this.LJIIL = uuid;
        JavaOnlyMap javaOnlyMap = new JavaOnlyMap();
        if (this.mView != null) {
            try {
                ((1Fq) this.mView).LIZJ();
                callback.invoke(new Object[]{0, javaOnlyMap});
            } catch (Exception e) {
                javaOnlyMap.putString("message:", e.getMessage());
                callback.invoke(new Object[]{1, javaOnlyMap});
            }
        } else {
            javaOnlyMap.putString("message", "view is not exist");
            callback.invoke(new Object[]{1, javaOnlyMap});
        }
    }

    @7tl
    public final void resume(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap, callback);
        String uuid = UUID.randomUUID().toString();
        n.LIZ(uuid, Q39.LIZJ);
        this.LJIIL = uuid;
        JavaOnlyMap javaOnlyMap = new JavaOnlyMap();
        if (this.mView != null) {
            try {
                ((1Fq) this.mView).LIZLLL();
                callback.invoke(new Object[]{0, javaOnlyMap});
            } catch (Exception e) {
                javaOnlyMap.putString("message:", e.getMessage());
                callback.invoke(new Object[]{1, javaOnlyMap});
            }
        } else {
            javaOnlyMap.putString("message", "view is not exist");
            callback.invoke(new Object[]{1, javaOnlyMap});
        }
        if (this.mView == null) {
            javaOnlyMap.putString("message", "view is not exist");
            callback.invoke(new Object[]{1, javaOnlyMap});
        }
    }

    @7tl
    public final void seek(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap, callback);
        JavaOnlyMap javaOnlyMap = new JavaOnlyMap();
        if (this.mView != null) {
            int i = readableMap.getInt("frame");
            T t = this.mView;
            n.LIZ(t, Q39.LIZJ);
            ((1Fq) t).setFrame(i);
            callback.invoke(new Object[]{0, javaOnlyMap});
            return;
        }
        javaOnlyMap.putString("message", "view is not exist");
        callback.invoke(new Object[]{1, javaOnlyMap});
    }

    @7tl
    public final void stop(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap, callback);
        JavaOnlyMap javaOnlyMap = new JavaOnlyMap();
        if (this.mView != null) {
            try {
                1Fq r0 = (1Fq) this.mView;
                if (r0 != null) {
                    r0.LJII();
                    Drawable drawable = r0.getDrawable();
                    if (!(drawable instanceof 0KO)) {
                        drawable = null;
                    }
                    0KO r1 = (0KO) drawable;
                    if (r1 != null) {
                        r1.stop();
                    }
                }
                callback.invoke(new Object[]{0, javaOnlyMap});
            } catch (Exception e) {
                javaOnlyMap.putString("message:", e.getMessage());
                callback.invoke(new Object[]{1, javaOnlyMap});
            }
        } else {
            javaOnlyMap.putString("message", "view is not exist");
            callback.invoke(new Object[]{1, javaOnlyMap});
        }
    }

    @7tl
    public final void subscribeUpdateEvent(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap);
        int i = readableMap.getInt("frame");
        if (!this.LJIILJJIL.contains(Integer.valueOf(i))) {
            this.LJIILJJIL.add(Integer.valueOf(i));
            List<Integer> list = this.LJIILJJIL;
            if (list.size() > 1) {
                86q.LIZ(list, new C4218Qjf());
            }
            if (callback != null) {
                callback.invoke(new Object[]{0});
            }
        } else if (callback != null) {
            callback.invoke(new Object[]{1, "already subscribeUpdateEvent with " + i + " frame"});
        }
    }

    @7tl
    public final void unsubscribeUpdateEvent(ReadableMap readableMap, Callback callback) {
        M12.LIZ(readableMap);
        int i = readableMap.getInt("frame");
        if (this.LJIILJJIL.contains(Integer.valueOf(i))) {
            this.LJIILJJIL.remove(Integer.valueOf(i));
            if (callback != null) {
                callback.invoke(new Object[]{0});
            }
        } else if (callback != null) {
            callback.invoke(new Object[]{1, i + " frame is not subscribed"});
        }
    }

    public final Map<String, Object> LIZ(int i, String str) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("code", Integer.valueOf(i));
        linkedHashMap.put("msg", str);
        return linkedHashMap;
    }

    private void LIZ(String str, 0KP r2, C3245QLq qLq) {
        M12.LIZ(str, r2, qLq);
        LIZ(str, str, r2, qLq);
    }

    private final void LIZ(0Jt r3, ReadableMap readableMap, 0JT<String> r5) {
        new C4225Qjm(new C4211QjY(this, readableMap, r5, r3));
    }

    public final C1114Pah<Bitmap> LIZ(C1114Pah<Bitmap> pah, int i, int i2, String str) {
        C1114Pah<Bitmap> pah2;
        MethodCollector.i(2204);
        Bitmap LIZ2 = pah.LIZ();
        try {
            n.LIZ(LIZ2, Q39.LIZJ);
            if (LIZ2.getWidth() == i && LIZ2.getHeight() == i2) {
                pah2 = pah.LIZJ();
            } else {
                pah2 = C1114Pah.LIZ(Bitmap.createScaledBitmap(LIZ2, i, i2, false), OAt.LIZ());
            }
        } catch (Exception e) {
            0HH.LIZ(e);
            LIZ("scale image failed, and detail is ".concat(String.valueOf(e)), str, 2);
            pah2 = null;
        }
        MethodCollector.o(2204);
        return pah2;
    }

    public final Map<String, Object> LIZ(int i, int i2, int i3, String str) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("current", Integer.valueOf(i));
        linkedHashMap.put("total", Integer.valueOf(i2));
        linkedHashMap.put("loopIndex", Integer.valueOf(i3));
        linkedHashMap.put("animationID", str);
        return linkedHashMap;
    }
}
