package com.bytedance.android.livesdk.newvideogift;

import X.0CB;
import X.0CH;
import X.0Uu;
import X.0c0;
import X.6Is;
import X.C1059Fv2;
import X.C1064Fv7;
import X.C1832GHx;
import X.C2312Ga9;
import X.C2402Gbb;
import X.C2675Gg0;
import X.C2680Gg5;
import X.C3304Gq9;
import X.C3491GtA;
import X.C3502GtL;
import X.C4100H7d;
import X.C4900Han;
import X.C4901Hao;
import X.C4907Hau;
import X.C4908Hav;
import X.C4914Hb1;
import X.C4917Hb4;
import X.C4929HbG;
import X.C4931HbI;
import X.C4932HbJ;
import X.C4943HbU;
import X.C4945HbW;
import X.C4946HbX;
import X.C6013Hsk;
import X.C6039HtA;
import X.C6040HtB;
import X.C6106HuF;
import X.C6228HwD;
import X.GMS;
import X.H7O;
import X.HEP;
import X.HO5;
import X.HT6;
import X.HTG;
import X.HUG;
import X.HUH;
import X.HUL;
import X.HUN;
import X.Mjy;
import X.Qkx;
import X.ToV;
import android.content.Context;
import com.bytedance.android.livesdk.gift.assets.AssetsModel;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.android.livesdkapi.session.EnterRoomConfig;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannelGlobal;
import com.bytedance.ies.sdk.widgets.LiveWidget;
import java.util.HashMap;
import java.util.Map;

public class LiveNewVideoGiftWidget extends LiveWidget implements 6Is {
    public C4932HbJ LIZ;
    public C4917Hb4 LIZIZ;
    public C4914Hb1 LIZJ;
    public C4908Hav LIZLLL;
    public AssetsModel LJ;
    public Room LJFF;
    public boolean LJI;
    public long LJII;
    public long LJIIIIZZ;
    public long LJIIIZ;
    public boolean LJIIJ = true;
    public C6040HtB LJIIJJI;
    public C4929HbG LJIIL;
    public Mjy LJIILIIL = new Mjy();
    public C6228HwD LJIILJJIL;
    public final C6039HtA LJIILL = new C6039HtA() {
        static {
            Covode.recordClassIndex(19727);
        }

        public final void LIZIZ() {
            LIZ(false, true);
            if (LiveNewVideoGiftWidget.this.LIZ != null) {
                LiveNewVideoGiftWidget liveNewVideoGiftWidget = LiveNewVideoGiftWidget.this;
                liveNewVideoGiftWidget.LIZ(liveNewVideoGiftWidget.LIZLLL, LiveNewVideoGiftWidget.this.LJ, false, true, "");
                LiveNewVideoGiftWidget.this.LIZ.LIZ();
            }
            HUL.LIZ.LJ.LIZ();
            0Uu.LIZLLL.LIZ();
            ToV.LJ.LJII();
        }

        public final void LIZ() {
            LiveNewVideoGiftWidget.this.LJIIIIZZ = GMS.LIZ() - LiveNewVideoGiftWidget.this.LJII;
            LiveNewVideoGiftWidget.this.LJIIIZ = GMS.LIZ();
            if (LiveNewVideoGiftWidget.this.LIZIZ != null) {
                C2675Gg0.LIZ().LIZ((Object) new HUN(false));
                LiveNewVideoGiftWidget.this.LIZIZ.setVisibility(0);
                LIZ(true, false);
                HUG.LIZ.LIZ(LiveNewVideoGiftWidget.this.LJFF, LiveNewVideoGiftWidget.this.LJI, Long.valueOf(LiveNewVideoGiftWidget.this.LIZLLL.LIZJ));
                ToV.LJ.LIZ(LiveNewVideoGiftWidget.this.LIZLLL.LIZJ);
            }
        }

        private void LIZ(boolean z, boolean z2) {
            if (LiveNewVideoGiftWidget.this.LIZLLL != null && LiveNewVideoGiftWidget.this.LIZLLL.LJII != null && LiveNewVideoGiftWidget.this.LIZLLL.LJII.getId() == C4100H7d.LIZ().LIZIZ().LIZJ()) {
                H7O.INSTANCE.setBigGiftPlayStateEvent(z, z2, LiveNewVideoGiftWidget.this.LIZLLL);
            }
        }
    };
    public final C4943HbU LJIILLIIL = C4945HbW.LIZ;
    public final Qkx LJIIZILJ = new C4900Han(this);
    public C4931HbI LJIJ = new C4931HbI() {
        static {
            Covode.recordClassIndex(19728);
        }

        public final EnterRoomConfig LIZJ() {
            return LiveNewVideoGiftWidget.this.LIZ.LIZIZ();
        }

        public final void LIZIZ() {
            if (LiveNewVideoGiftWidget.this.LIZJ != null) {
                C2675Gg0.LIZ().LIZ((Object) new HUN(false));
                LiveNewVideoGiftWidget.this.LJIIIIZZ = -1;
                LiveNewVideoGiftWidget.this.LJIIIZ = GMS.LIZ();
            }
        }

        public final void LIZ() {
            if (LiveNewVideoGiftWidget.this.LIZJ != null) {
                C2675Gg0.LIZ().LIZ((Object) new HUN(false));
                LiveNewVideoGiftWidget.this.LIZJ.setVisibility(0);
                LiveNewVideoGiftWidget.this.LIZ(true, false);
                HUG.LIZ.LIZ(LiveNewVideoGiftWidget.this.LJFF, LiveNewVideoGiftWidget.this.LJI, Long.valueOf(LiveNewVideoGiftWidget.this.LIZLLL.LIZJ));
                ToV.LJ.LIZ(LiveNewVideoGiftWidget.this.LIZLLL.LIZJ);
                LiveNewVideoGiftWidget.this.LJIIIIZZ = GMS.LIZ() - LiveNewVideoGiftWidget.this.LJII;
                LiveNewVideoGiftWidget.this.LJIIIZ = GMS.LIZ();
            }
        }

        public final void LIZ(int i) {
            Long l;
            boolean z;
            int i2 = i;
            LiveNewVideoGiftWidget.this.LIZ(false, true);
            if (LiveNewVideoGiftWidget.this.LIZ != null) {
                LiveNewVideoGiftWidget liveNewVideoGiftWidget = LiveNewVideoGiftWidget.this;
                C4908Hav hav = liveNewVideoGiftWidget.LIZLLL;
                AssetsModel assetsModel = LiveNewVideoGiftWidget.this.LJ;
                if (i2 == 0) {
                    z = true;
                } else {
                    z = false;
                }
                liveNewVideoGiftWidget.LIZ(hav, assetsModel, false, z, "effect on end : ".concat(String.valueOf(i2)));
                LiveNewVideoGiftWidget.this.LIZ.LIZ();
            }
            HUL.LIZ.LJ.LIZ();
            0Uu.LIZLLL.LIZ();
            ToV.LJ.LJII();
            if (LiveNewVideoGiftWidget.this.LIZJ.getMsg() != null) {
                if (i2 == 200) {
                    long j = LiveNewVideoGiftWidget.this.LIZJ.getMsg().LJIIIZ;
                    Room room = (Room) DataChannelGlobal.LIZLLL.LIZIZ(HEP.class);
                    if (room != null) {
                        room.getOwnerUserId();
                        l = Long.valueOf(room.getOwnerUserId());
                    } else {
                        l = null;
                    }
                    C3491GtA LIZ2 = C3491GtA.LJFF.LIZ("livesdk_element_gift_effect_show");
                    LIZ2.LIZ("room_id", C2402Gbb.LIZ.LJIIIIZZ());
                    LIZ2.LIZ("anchor_id", (Number) l);
                    LIZ2.LIZ("enter_from_merge", C2402Gbb.LIZ.LIZ());
                    LIZ2.LIZ("enter_method", C2402Gbb.LIZ.LIZLLL());
                    LIZ2.LIZ("gift_id", j);
                    LIZ2.LIZ("special_gift", "anchor_element_gift");
                    LIZ2.LIZLLL();
                } else {
                    HO5.LJIIIIZZ.LIZ(LiveNewVideoGiftWidget.this.LIZJ.getMsg().LJIIIZ, i2, 0);
                }
            }
            HUG hug = HUG.LIZ;
            long j2 = LiveNewVideoGiftWidget.this.LIZLLL.LJIIIZ;
            Long valueOf = Long.valueOf(LiveNewVideoGiftWidget.this.LJIIIIZZ);
            Long valueOf2 = Long.valueOf(LiveNewVideoGiftWidget.this.LIZLLL.LIZIZ);
            String str = LiveNewVideoGiftWidget.this.LIZLLL.LJIILJJIL;
            if (i2 == 200) {
                i2 = 0;
            }
            hug.LIZ(j2, valueOf, valueOf2, str, Integer.valueOf(i2), "", LiveNewVideoGiftWidget.this.LIZLLL.LIZJ, "BEFView", Long.valueOf(GMS.LIZ() - LiveNewVideoGiftWidget.this.LJIIIZ), Long.valueOf(LiveNewVideoGiftWidget.this.LJIIIZ));
        }
    };

    static {
        Covode.recordClassIndex(19725);
    }

    public int getLayoutId() {
        return 2131562126;
    }

    public void onStateChanged(0CH r1, 0CB r2) {
        super.onStateChanged(r1, r2);
    }

    public final void LIZ() {
        C4917Hb4 hb4 = this.LIZIZ;
        if (hb4 != null) {
            hb4.LIZ();
        }
    }

    public void onResume() {
        super.onResume();
        this.LJIIJ = true;
    }

    public void onDestroy() {
        super.onDestroy();
        C4929HbG hbG = this.LJIIL;
        if (hbG != null) {
            hbG.LIZ();
        }
        this.LJIILIIL.LIZ();
    }

    public void onPause() {
        super.onPause();
        C4914Hb1 hb1 = this.LIZJ;
        if (!(hb1 == null || hb1.LIZ == null)) {
            hb1.LIZ(301);
        }
        this.LJIIJ = false;
    }

    public void onCreate() {
        boolean z;
        super.onCreate();
        this.LJFF = (Room) this.dataChannel.LIZIZ(C1064Fv7.class);
        Boolean bool = (Boolean) this.dataChannel.LIZIZ(C1059Fv2.class);
        this.LJIILIIL.LIZ(C2675Gg0.LIZ().LIZ(HTG.class).LIZ(new C4901Hao(this), C4946HbX.LIZ));
        if (bool == null || !bool.booleanValue()) {
            z = false;
        } else {
            z = true;
        }
        this.LJI = z;
        this.LIZIZ = (C4917Hb4) this.contentView.findViewById(2131370511);
        this.LJIIJJI = (C6040HtB) this.contentView.findViewById(2131369452);
        C4917Hb4 hb4 = this.LIZIZ;
        Context context = this.context;
        C6039HtA htA = this.LJIILL;
        C4943HbU hbU = this.LJIILLIIL;
        Qkx qkx = this.LJIIZILJ;
        hb4.setLayoutDirection(0);
        hb4.LIZ = new C6013Hsk(context, hb4, htA, hbU, qkx);
        C4914Hb1 hb1 = (C4914Hb1) this.contentView.findViewById(2131370508);
        this.LIZJ = hb1;
        hb1.setAnchor(this.LJI);
        this.LIZJ.setPlayListener(this.LJIJ);
        this.LJIILJJIL = new C6106HuF().LIZJ();
    }

    public final void LIZ(final C4908Hav hav) {
        long j;
        this.LIZLLL = hav;
        boolean LIZ2 = HT6.LIZ(Long.valueOf(hav.LIZJ));
        HUH huh = HUL.LIZ;
        huh.LIZJ = hav.LIZJ;
        huh.LIZIZ = hav.LJIILIIL;
        Long valueOf = Long.valueOf(hav.LIZIZ);
        String str = hav.LJIILJJIL;
        if (valueOf != null) {
            j = valueOf.longValue();
        } else {
            j = 0;
        }
        huh.LJFF = j;
        if (str == null) {
            str = "";
        }
        huh.LJI = str;
        huh.LIZLLL = GMS.LIZ();
        huh.LIZ = LIZ2;
        final AssetsModel LIZIZ2 = HT6.LIZIZ(hav.LIZJ);
        LIZ(hav, LIZIZ2, false);
        AnonymousClass1 r3 = new C2312Ga9() {
            static {
                Covode.recordClassIndex(19726);
            }

            public final void LIZ(Throwable th) {
                C2680Gg5.LIZ("fail to get local path of effect resource", String.valueOf(hav.LJIIIZ), String.valueOf(hav.LIZIZ), String.valueOf(LiveNewVideoGiftWidget.this.LIZLLL.LIZJ));
                HUL.LIZ.LIZ(C4907Hau.FOUNDATION_ERROR, th.getMessage());
                LiveNewVideoGiftWidget.this.LIZLLL.LJ = "";
                C2675Gg0.LIZ().LIZ((Object) new HUN(true));
            }

            public final void LIZ(long j) {
                C2680Gg5.LIZ("effect resource download has been canceled", String.valueOf(hav.LJIIIZ), String.valueOf(hav.LIZIZ), String.valueOf(LiveNewVideoGiftWidget.this.LIZLLL.LIZJ));
                HUL.LIZ.LIZ(C4907Hau.DOWNLOAD_CANCELED, "Request has been cancelled");
                if (LiveNewVideoGiftWidget.this.LIZ != null) {
                    LiveNewVideoGiftWidget.this.LIZ(hav, LIZIZ2, false, false, "download onCancel");
                    LiveNewVideoGiftWidget.this.LIZ.LIZ();
                }
            }

            /* JADX WARNING: Code restructure failed: missing block: B:124:0x02b7, code lost:
                if (r0 == null) goto L_0x01ea;
             */
            /* JADX WARNING: Removed duplicated region for block: B:100:0x024f  */
            /* JADX WARNING: Removed duplicated region for block: B:103:0x0263  */
            /* JADX WARNING: Removed duplicated region for block: B:108:0x027c  */
            /* JADX WARNING: Removed duplicated region for block: B:117:0x029a  */
            /* JADX WARNING: Removed duplicated region for block: B:118:0x02a3  */
            /* JADX WARNING: Removed duplicated region for block: B:119:0x02a6  */
            /* JADX WARNING: Removed duplicated region for block: B:120:0x02a9  */
            /* JADX WARNING: Removed duplicated region for block: B:121:0x02ad  */
            /* JADX WARNING: Removed duplicated region for block: B:76:0x020a  */
            /* JADX WARNING: Removed duplicated region for block: B:83:0x021e  */
            /* JADX WARNING: Removed duplicated region for block: B:95:0x023f  */
            /* Code decompiled incorrectly, please refer to instructions dump. */
            public final void LIZ(long r18, java.lang.String r20) {
                /*
                    r17 = this;
                    r1 = r17
                    com.bytedance.android.livesdk.newvideogift.LiveNewVideoGiftWidget r0 = com.bytedance.android.livesdk.newvideogift.LiveNewVideoGiftWidget.this
                    X.Hav r0 = r0.LIZLLL
                    r2 = r20
                    r0.LJ = r2
                    com.bytedance.android.livesdk.newvideogift.LiveNewVideoGiftWidget r11 = com.bytedance.android.livesdk.newvideogift.LiveNewVideoGiftWidget.this
                    java.lang.StringBuilder r1 = new java.lang.StringBuilder
                    java.lang.String r0 = "playVideo "
                    r1.<init>(r0)
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r11.LJ
                    r1.append(r0)
                    java.lang.String r2 = r1.toString()
                    r1 = 4
                    java.lang.String r0 = "VideoGiftWidget"
                    X.0aP.LIZ(r1, r0, r2)
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r11.LJ
                    if (r0 == 0) goto L_0x0311
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r11.LJ
                    int r1 = r0.getResourceType()
                    int r0 = com.bytedance.android.livesdk.gift.assets.AssetsModel.RESOURCE_TYPE_MP4
                    r5 = 0
                    r2 = 1
                    if (r1 == r0) goto L_0x003c
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r11.LJ
                    int r1 = r0.getDowngradeResType()
                    int r0 = com.bytedance.android.livesdk.gift.assets.AssetsModel.RESOURCE_TYPE_MP4
                    if (r1 != r0) goto L_0x00fc
                L_0x003c:
                    X.HO5 r5 = X.HO5.LJIIIIZZ
                    X.Hav r0 = r11.LIZLLL
                    X.M12.LIZ(r0)
                    com.bytedance.android.livesdk.service.assets.GiftManager r3 = com.bytedance.android.livesdk.service.assets.GiftManager.inst()
                    long r0 = r0.LJIIIZ
                    com.bytedance.android.livesdk.model.Gift r1 = r3.findGiftById(r0)
                    if (r1 == 0) goto L_0x005a
                    boolean r0 = r1.LJIILLIIL
                    if (r0 == 0) goto L_0x005a
                    long r3 = r1.LIZLLL
                    r0 = 405(0x195, float:5.68E-43)
                    r5.LIZ((long) r3, (int) r0, (int) r2)
                L_0x005a:
                    X.Hav r0 = r11.LIZLLL
                    java.lang.String r0 = r0.LJ
                    boolean r0 = android.text.TextUtils.isEmpty(r0)
                    if (r0 != 0) goto L_0x02fc
                    X.Hav r12 = r11.LIZLLL
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r13 = r11.LJ
                    X.Hb4 r0 = r11.LIZIZ
                    if (r0 != 0) goto L_0x007e
                    X.HbJ r0 = r11.LIZ
                    if (r0 == 0) goto L_0x007d
                    r14 = 0
                    r0 = 0
                    java.lang.String r16 = "videoGiftView is null"
                    r15 = 0
                    r11.LIZ(r12, r13, r14, r15, r16)
                    X.HbJ r0 = r11.LIZ
                    r0.LIZ()
                L_0x007d:
                    return
                L_0x007e:
                    X.Hb4 r0 = r11.LIZIZ
                    X.Hsk r0 = r0.LIZ
                    if (r0 == 0) goto L_0x00e1
                    long r0 = X.GMS.LIZ()
                    r11.LJII = r0
                    X.HUH r1 = X.HUL.LIZ
                    boolean r0 = r11.LJI
                    r1.LIZ((boolean) r0)
                    X.Hb4 r4 = r11.LIZIZ
                    X.Hav r2 = r11.LIZLLL
                    boolean r0 = r2.LIZ
                    if (r0 == 0) goto L_0x00d2
                    java.util.ArrayList r5 = new java.util.ArrayList
                    r5.<init>()
                    com.bytedance.android.live.base.model.user.User r0 = r2.LJI
                    com.bytedance.android.live.base.model.ImageModel r1 = r0.getAvatarThumb()
                    java.lang.String r0 = "mask1"
                    X.PgU r3 = r4.LIZ(r1, r0)
                    com.bytedance.android.live.base.model.user.User r0 = r2.LJII
                    com.bytedance.android.live.base.model.ImageModel r1 = r0.getAvatarThumb()
                    java.lang.String r0 = "mask2"
                    X.PgU r0 = r4.LIZ(r1, r0)
                    X.PgU r1 = X.PgU.LIZ(r3, r0)
                    X.PlG r0 = X.Mk3.LIZ
                    X.PlG r0 = X.Mk2.LIZ(r0)
                    X.PgU r1 = r1.LIZ(r0)
                    com.bytedance.android.livesdk.newvideogift.VideoGiftView$1 r0 = new com.bytedance.android.livesdk.newvideogift.VideoGiftView$1
                    r0.<init>(r4, r5, r2)
                    r1.LIZIZ(r0)
                L_0x00cc:
                    X.HUH r0 = X.HUL.LIZ
                    r0.LIZ()
                    return
                L_0x00d2:
                    X.Hsk r3 = r4.LIZ
                    java.lang.String r4 = r2.LJ
                    long r5 = r2.LIZIZ
                    long r7 = r2.LJIIIZ
                    long r9 = r2.LIZJ
                    r11 = 0
                    r3.LIZ(r4, r5, r7, r9, r11)
                    goto L_0x00cc
                L_0x00e1:
                    X.HUH r2 = X.HUL.LIZ
                    X.Hau r1 = X.C4907Hau.PLAYER_NOT_READY
                    java.lang.String r0 = "Player not ready"
                    r2.LIZ((X.C4907Hau) r1, (java.lang.String) r0)
                    X.HbJ r0 = r11.LIZ
                    if (r0 == 0) goto L_0x00fb
                    r14 = 0
                    r0 = 0
                    java.lang.String r16 = "Player not ready"
                    r15 = 0
                    r11.LIZ(r12, r13, r14, r15, r16)
                    X.HbJ r0 = r11.LIZ
                    r0.LIZ()
                L_0x00fb:
                    return
                L_0x00fc:
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r11.LJ
                    int r1 = r0.getResourceType()
                    int r0 = com.bytedance.android.livesdk.gift.assets.AssetsModel.RESOURCE_TYPE_EFFECT_LOKI
                    if (r1 == r0) goto L_0x0110
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r11.LJ
                    int r1 = r0.getDowngradeResType()
                    int r0 = com.bytedance.android.livesdk.gift.assets.AssetsModel.RESOURCE_TYPE_EFFECT_LOKI
                    if (r1 != r0) goto L_0x02e6
                L_0x0110:
                    java.lang.Class<com.bytedance.android.live.liveinteract.api.IInteractService> r0 = com.bytedance.android.live.liveinteract.api.IInteractService.class
                    X.0UT r1 = X.0cm.LIZ(r0)
                    com.bytedance.android.live.liveinteract.api.IInteractService r1 = (com.bytedance.android.live.liveinteract.api.IInteractService) r1
                    if (r1 == 0) goto L_0x013c
                    boolean r0 = r1.isMultiLiveLayout()
                    if (r0 != 0) goto L_0x0126
                    int r0 = r1.getMultiGuestOnlineGuestsViews()
                    if (r0 <= 0) goto L_0x013c
                L_0x0126:
                    X.Gg0 r1 = X.C2675Gg0.LIZ()
                    X.HUN r0 = new X.HUN
                    r0.<init>(r2)
                    r1.LIZ((java.lang.Object) r0)
                    X.HUH r2 = X.HUL.LIZ
                    X.Hau r1 = X.C4907Hau.LOCAL_PATH_ERROR
                    java.lang.String r0 = "multi live or multi guest"
                    r2.LIZ((X.C4907Hau) r1, (java.lang.String) r0)
                    return
                L_0x013c:
                    X.Hav r0 = r11.LIZLLL
                    java.lang.String r0 = r0.LJ
                    boolean r0 = android.text.TextUtils.isEmpty(r0)
                    r3 = 0
                    if (r0 != 0) goto L_0x02bb
                    X.Hav r12 = r11.LIZLLL
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r13 = r11.LJ
                    X.Hb1 r0 = r11.LIZJ
                    if (r0 != 0) goto L_0x0161
                    X.HbJ r0 = r11.LIZ
                    if (r0 == 0) goto L_0x0160
                    r14 = 0
                    r0 = 0
                    java.lang.String r16 = "mEffectGiftView is null"
                    r15 = 0
                    r11.LIZ(r12, r13, r14, r15, r16)
                    X.HbJ r0 = r11.LIZ
                    r0.LIZ()
                L_0x0160:
                    return
                L_0x0161:
                    X.HUH r0 = X.HUL.LIZ
                    r0.LIZ()
                    boolean r0 = r11.LJIIJ
                    if (r0 != 0) goto L_0x01b5
                    X.Hav r0 = r11.LIZLLL
                    if (r0 == 0) goto L_0x01b5
                    X.Gg0 r1 = X.C2675Gg0.LIZ()
                    X.HUN r0 = new X.HUN
                    r0.<init>(r2)
                    r1.LIZ((java.lang.Object) r0)
                    X.HUG r4 = X.HUG.LIZ
                    X.Hav r0 = r11.LIZLLL
                    long r5 = r0.LJIIIZ
                    long r0 = r11.LJIIIIZZ
                    java.lang.Long r7 = java.lang.Long.valueOf(r0)
                    X.Hav r0 = r11.LIZLLL
                    long r0 = r0.LIZIZ
                    java.lang.Long r8 = java.lang.Long.valueOf(r0)
                    X.Hav r0 = r11.LIZLLL
                    java.lang.String r9 = r0.LJIILJJIL
                    r0 = -100
                    java.lang.Integer r10 = java.lang.Integer.valueOf(r0)
                    X.Hav r0 = r11.LIZLLL
                    long r12 = r0.LIZJ
                    long r2 = X.GMS.LIZ()
                    long r0 = r11.LJIIIZ
                    long r2 = r2 - r0
                    java.lang.Long r15 = java.lang.Long.valueOf(r2)
                    long r0 = r11.LJIIIZ
                    java.lang.Long r16 = java.lang.Long.valueOf(r0)
                    java.lang.String r11 = "The BEFView video can not be played in the background."
                    java.lang.String r14 = "BEFView"
                    r4.LIZ(r5, r7, r8, r9, r10, r11, r12, r14, r15, r16)
                    return
                L_0x01b5:
                    X.HUH r1 = X.HUL.LIZ
                    boolean r0 = r11.LJI
                    r1.LIZ((boolean) r0)
                    X.Hb1 r4 = r11.LIZJ
                    X.M12.LIZ(r12, r13)
                    r6 = 3
                    java.lang.String r1 = "EffectGiftView"
                    java.lang.String r0 = "play effect gift"
                    X.0aP.LIZ(r6, r1, r0)
                    r4.LIZJ = r12
                    r4.LIZLLL = r13
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r4.LIZLLL
                    if (r0 == 0) goto L_0x01ea
                    com.bytedance.android.livesdk.gift.model.LokiExtraContent r1 = r0.lokiExtraContent
                    if (r1 == 0) goto L_0x01ea
                    java.lang.Long r0 = r1.LIZIZ
                    if (r0 == 0) goto L_0x01ea
                    java.lang.Long r0 = r1.LIZIZ
                    if (r0 != 0) goto L_0x01e0
                    kotlin.h.b.n.LIZIZ()
                L_0x01e0:
                    long r8 = r0.longValue()
                    r6 = 0
                    int r0 = (r8 > r6 ? 1 : (r8 == r6 ? 0 : -1))
                    if (r0 > 0) goto L_0x02b5
                L_0x01ea:
                    X.Hav r0 = r4.LIZJ
                    if (r0 == 0) goto L_0x02b1
                    long r0 = r0.LIZ()
                    java.lang.Long r0 = java.lang.Long.valueOf(r0)
                    if (r0 == 0) goto L_0x02b1
                L_0x01f8:
                    long r0 = r0.longValue()
                L_0x01fc:
                    r4.LJIIIIZZ = r0
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r4.LIZLLL
                    if (r0 == 0) goto L_0x02ad
                    com.bytedance.android.livesdk.gift.model.LokiExtraContent r0 = r0.lokiExtraContent
                    if (r0 == 0) goto L_0x02ad
                    com.bytedance.android.livesdk.gift.model.BEFViewRenderSize r0 = r0.LJFF
                    if (r0 == 0) goto L_0x02ad
                    int r0 = r0.LIZ
                L_0x020c:
                    java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
                    r4.LJIIJ = r0
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r4.LIZLLL
                    if (r0 == 0) goto L_0x02a9
                    com.bytedance.android.livesdk.gift.model.LokiExtraContent r0 = r0.lokiExtraContent
                    if (r0 == 0) goto L_0x02a9
                    com.bytedance.android.livesdk.gift.model.BEFViewRenderSize r0 = r0.LJFF
                    if (r0 == 0) goto L_0x02a9
                    int r0 = r0.LIZIZ
                L_0x0220:
                    java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
                    r4.LJIIJJI = r0
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r4.LIZLLL
                    if (r0 == 0) goto L_0x0230
                    com.bytedance.android.livesdk.gift.model.LokiExtraContent r0 = r0.lokiExtraContent
                    if (r0 == 0) goto L_0x0230
                    int r5 = r0.LJII
                L_0x0230:
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r4.LIZLLL
                    if (r0 == 0) goto L_0x02a6
                    com.bytedance.android.livesdk.gift.model.LokiExtraContent r0 = r0.lokiExtraContent
                    if (r0 == 0) goto L_0x02a6
                    com.bef.effectsdk.view.BEFView$FitMode[] r0 = com.bef.effectsdk.view.BEFView.FitMode.values()
                    int r0 = r0.length
                    if (r5 > r0) goto L_0x02a6
                    com.bef.effectsdk.view.BEFView$FitMode[] r0 = com.bef.effectsdk.view.BEFView.FitMode.values()
                    r0 = r0[r5]
                L_0x0245:
                    r4.LJIILIIL = r0
                    com.bytedance.android.livesdk.gift.assets.AssetsModel r0 = r4.LIZLLL
                    if (r0 == 0) goto L_0x02a3
                    com.bytedance.android.livesdk.gift.model.LokiExtraContent r0 = r0.lokiExtraContent
                    if (r0 == 0) goto L_0x02a3
                    int r0 = r0.LJI
                L_0x0251:
                    java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
                    r4.LJIIL = r0
                    java.lang.Class<com.bytedance.android.livesdkapi.host.IHostFrescoHelper> r0 = com.bytedance.android.livesdkapi.host.IHostFrescoHelper.class
                    X.0UT r6 = X.0cm.LIZ(r0)
                    com.bytedance.android.livesdkapi.host.IHostFrescoHelper r6 = (com.bytedance.android.livesdkapi.host.IHostFrescoHelper) r6
                    java.lang.String r5 = ""
                    if (r6 == 0) goto L_0x0274
                    com.bytedance.android.live.base.model.user.User r0 = r12.LJII
                    kotlin.h.b.n.LIZIZ(r0, r5)
                    com.bytedance.android.live.base.model.ImageModel r1 = r0.getAvatarThumb()
                    X.HbC r0 = new X.HbC
                    r0.<init>()
                    r6.LIZ(r1, r0)
                L_0x0274:
                    com.bytedance.android.livesdk.gift.model.LokiExtraContent r0 = r13.lokiExtraContent
                    if (r0 == 0) goto L_0x029a
                    boolean r0 = r0.LIZJ
                    if (r0 != r2) goto L_0x029a
                    boolean r0 = r4.LJ
                    if (r0 == 0) goto L_0x028c
                    X.HIY r0 = r4.LJIILJJIL
                    X.HIU.LIZ(r0)
                L_0x0285:
                    long r0 = X.GMS.LIZ()
                    r11.LJII = r0
                    return
                L_0x028c:
                    X.HbI r0 = r4.LIZIZ
                    if (r0 == 0) goto L_0x0294
                    com.bytedance.android.livesdkapi.session.EnterRoomConfig r3 = r0.LIZJ()
                L_0x0294:
                    X.HIY r0 = r4.LJIILJJIL
                    X.HIU.LIZ((com.bytedance.android.livesdkapi.session.EnterRoomConfig) r3, (X.HIY) r0)
                    goto L_0x0285
                L_0x029a:
                    java.lang.String r0 = r12.LJ
                    kotlin.h.b.n.LIZIZ(r0, r5)
                    r4.LIZ((java.lang.String) r0)
                    goto L_0x0285
                L_0x02a3:
                    r0 = 24
                    goto L_0x0251
                L_0x02a6:
                    com.bef.effectsdk.view.BEFView$FitMode r0 = com.bef.effectsdk.view.BEFView.FitMode.FIT_WIDTH_BOTTOM
                    goto L_0x0245
                L_0x02a9:
                    r0 = 1280(0x500, float:1.794E-42)
                    goto L_0x0220
                L_0x02ad:
                    r0 = 720(0x2d0, float:1.009E-42)
                    goto L_0x020c
                L_0x02b1:
                    r0 = 7100(0x1bbc, double:3.508E-320)
                    goto L_0x01fc
                L_0x02b5:
                    java.lang.Long r0 = r1.LIZIZ
                    if (r0 != 0) goto L_0x01f8
                    goto L_0x01ea
                L_0x02bb:
                    X.Gg0 r1 = X.C2675Gg0.LIZ()
                    X.HUN r0 = new X.HUN
                    r0.<init>(r2)
                    r1.LIZ((java.lang.Object) r0)
                    X.Hav r0 = r11.LIZLLL
                    long r0 = r0.LJIIIZ
                    java.lang.String r2 = java.lang.String.valueOf(r0)
                    X.Hav r0 = r11.LIZLLL
                    long r0 = r0.LIZIZ
                    java.lang.String r1 = java.lang.String.valueOf(r0)
                    java.lang.String r0 = "fail to download effect temporarily-effect"
                    X.C2680Gg5.LIZ(r0, r2, r1, r3)
                    X.HUH r2 = X.HUL.LIZ
                    X.Hau r1 = X.C4907Hau.LOCAL_PATH_ERROR
                    java.lang.String r0 = "effect loki Local path error"
                    r2.LIZ((X.C4907Hau) r1, (java.lang.String) r0)
                    return
                L_0x02e6:
                    X.Gg0 r1 = X.C2675Gg0.LIZ()
                    X.HUN r0 = new X.HUN
                    r0.<init>(r2)
                    r1.LIZ((java.lang.Object) r0)
                    X.HUH r2 = X.HUL.LIZ
                    X.Hau r1 = X.C4907Hau.RESOURCE_TYPE_ERROR
                    java.lang.String r0 = "Resource type error"
                    r2.LIZ((X.C4907Hau) r1, (java.lang.String) r0)
                    goto L_0x0311
                L_0x02fc:
                    X.Gg0 r1 = X.C2675Gg0.LIZ()
                    X.HUN r0 = new X.HUN
                    r0.<init>(r2)
                    r1.LIZ((java.lang.Object) r0)
                    X.HUH r2 = X.HUL.LIZ
                    X.Hau r1 = X.C4907Hau.LOCAL_PATH_ERROR
                    java.lang.String r0 = "Local path error"
                    r2.LIZ((X.C4907Hau) r1, (java.lang.String) r0)
                L_0x0311:
                    return
                */
                throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.newvideogift.LiveNewVideoGiftWidget.AnonymousClass1.LIZ(long, java.lang.String):void");
            }
        };
        this.LJ = LIZIZ2;
        if (this.LJIILJJIL.LIZLLL(LIZIZ2, 4) == null) {
            HUL.LIZ.LIZ(C4907Hau.ASSET_NOT_FOUND, "The asset is not available");
            C2675Gg0.LIZ().LIZ((Object) new HUN(true));
            long j2 = hav.LJIIIZ;
            long j3 = hav.LIZJ;
            HashMap hashMap = new HashMap();
            hashMap.put("gift_id", Long.valueOf(j2));
            hashMap.put("asset_id", Long.valueOf(j3));
            Room room = (Room) DataChannelGlobal.LIZLLL.LIZIZ(HEP.class);
            if (room != null) {
                hashMap.put("room_type", Integer.valueOf(room.getOrientation()));
                hashMap.put("room_id", Long.valueOf(room.getId()));
                hashMap.put("anchor_id", Long.valueOf(room.getOwnerUserId()));
            }
            0c0.LIZ(C1832GHx.LIZIZ("ttlive_asset_id_not_found"), 1, hashMap);
            C3502GtL.LIZ().LIZ(C3304Gq9.Gift.info, "ttlive_asset_id_not_found", (Map) hashMap);
            return;
        }
        HT6.LIZ(Long.valueOf(hav.LIZJ), r3, 4);
    }

    public final void LIZ(boolean z, boolean z2) {
        C4908Hav hav = this.LIZLLL;
        if (hav != null && hav.LJII != null && this.LIZLLL.LJII.getId() == C4100H7d.LIZ().LIZIZ().LIZJ()) {
            H7O.INSTANCE.setBigGiftPlayStateEvent(z, z2, this.LIZLLL);
        }
    }

    public final void LIZ(C4908Hav hav, AssetsModel assetsModel, boolean z) {
        int i;
        boolean LIZ2 = HT6.LIZ(Long.valueOf(hav.LIZJ));
        C3491GtA LIZ3 = C3491GtA.LJFF.LIZ("gift_render_msg_receive");
        LIZ3.LIZ("use_sdk", z ? 1 : 0);
        LIZ3.LIZ("asset_id", hav.LIZJ);
        LIZ3.LIZ("gift_id", hav.LJIIIZ);
        LIZ3.LIZ("msg_id", hav.LIZIZ);
        LIZ3.LIZ("log_id", hav.LJIILJJIL);
        if (assetsModel == null) {
            i = 0;
        } else {
            i = assetsModel.resourceType;
        }
        LIZ3.LIZ("res_type", i);
        LIZ3.LIZ("is_local", Boolean.valueOf(hav.LJIILIIL));
        LIZ3.LIZ("resource_downloaded", Boolean.valueOf(LIZ2));
        LIZ3.LIZ();
        LIZ3.LIZLLL();
    }

    public final void LIZ(C4908Hav hav, AssetsModel assetsModel, boolean z, boolean z2, String str) {
        int i = 0;
        if (hav == null) {
            C3491GtA LIZ2 = C3491GtA.LJFF.LIZ("gift_render_finished");
            LIZ2.LIZ("use_sdk", (int) z);
            if (assetsModel != null) {
                i = assetsModel.getResourceType();
            }
            LIZ2.LIZ("res_type", i);
            LIZ2.LIZ("is_success", Boolean.valueOf(z2));
            LIZ2.LIZ("reason", str);
            LIZ2.LIZ();
            LIZ2.LIZLLL();
            return;
        }
        C3491GtA LIZ3 = C3491GtA.LJFF.LIZ("gift_render_finished");
        LIZ3.LIZ("use_sdk", z ? 1 : 0);
        LIZ3.LIZ("effect_id", hav.LIZJ);
        LIZ3.LIZ("gift_id", hav.LJIIIZ);
        LIZ3.LIZ("msg_id", hav.LIZIZ);
        LIZ3.LIZ("log_id", hav.LJIILJJIL);
        if (assetsModel != null) {
            i = assetsModel.getResourceType();
        }
        LIZ3.LIZ("res_type", i);
        LIZ3.LIZ("is_local", Boolean.valueOf(hav.LJIILIIL));
        LIZ3.LIZ("is_success", Boolean.valueOf(z2));
        LIZ3.LIZ("reason", str);
        LIZ3.LIZ();
        LIZ3.LIZLLL();
    }
}
