package com.ss.android.ugc.aweme.ecommerce.pdp.widget;

import X.0AA;
import X.0CB;
import X.0CH;
import X.2GO;
import X.2HZ;
import X.3Ok;
import X.3SM;
import X.3tL;
import X.4ZZ;
import X.6Is;
import X.7he;
import X.C2975B2l;
import X.C3088B6u;
import X.C5965CJl;
import X.C6058CNa;
import X.C6059CNb;
import X.C6060CNc;
import X.C6061CNd;
import X.C6065CNh;
import X.C6067CNj;
import X.C6068CNk;
import X.C6072CNo;
import X.C6103COt;
import X.C6104COu;
import X.C6105COv;
import X.C6176CRo;
import X.CG9;
import X.CK0;
import X.CK8;
import X.CK9;
import X.CNY;
import X.CNZ;
import X.COF;
import X.CPA;
import X.CPC;
import X.CPD;
import X.CPH;
import X.Crj;
import X.D1G;
import X.DV0;
import X.KEM;
import X.M12;
import X.Rc9;
import android.view.View;
import android.widget.LinearLayout;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.base.arch.JediBaseWidget;
import com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel;
import java.util.HashMap;
import java.util.Map;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

public final class PdpHeadNavBarWidget extends JediBaseWidget implements 6Is, 2HZ, 2GO {
    public static final int LJIILJJIL = 3SM.LIZ;
    public static final C6176CRo LJIILL = new C6176CRo((byte) 0);
    public C5965CJl LJII;
    public int LJIIIIZZ = -1;
    public boolean LJIIIZ = true;
    public float LJIIJ;
    public boolean LJIIJJI;
    public final Fragment LJIIL;
    public final 0AA LJIILIIL;
    public final Crj LJIILLIIL;

    public final String LIZ(int i) {
        return i != 1 ? i != 2 ? i != 3 ? i != 4 ? "" : "recommendation" : "description" : "review" : "overview";
    }

    public final int LIZJ() {
        return 2131559124;
    }

    public final PdpViewModel LJIIJJI() {
        return (PdpViewModel) this.LJIILLIIL.getValue();
    }

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(36, new Rc9(PdpHeadNavBarWidget.class, "onEvent", C3088B6u.class, ThreadMode.POSTING, 0, false));
        return hashMap;
    }

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

    public final void LJIIIIZZ() {
        PdpHeadNavBarWidget.super.LJIIIIZZ();
        EventBus.LIZ().LIZIZ(this);
    }

    static {
        Covode.recordClassIndex(71902);
    }

    public final void LJIIL() {
        View view;
        4ZZ findViewById;
        View view2;
        LinearLayout linearLayout;
        int i;
        3tL findViewById2;
        if (!LJIIJJI().LJIJJLI && (view = this.LJ) != null && (findViewById = view.findViewById(2131370303)) != null && findViewById.getVisibility() == 0 && (view2 = this.LJ) != null && (linearLayout = (LinearLayout) view2.findViewById(2131368398)) != null && linearLayout.getVisibility() == 0) {
            LJIIJJI().LJIJJLI = true;
            View view3 = this.LJ;
            if (view3 == null || (findViewById2 = view3.findViewById(2131370307)) == null) {
                i = 0;
            } else {
                i = findViewById2.getCount();
            }
            CG9 cg9 = LJIIJJI().LJJ;
            if (cg9 != null) {
                cg9.LIZ(LJIIJJI().LIZIZ, i);
            }
        }
    }

    /* JADX WARNING: type inference failed for: r0v10, types: [X.CNo, android.view.View$OnClickListener] */
    /* JADX WARNING: type inference failed for: r0v14, types: [android.view.View$OnClickListener, X.CNd] */
    /* JADX WARNING: type inference failed for: r0v19, types: [android.view.View$OnClickListener, X.COF] */
    public final void LIZLLL() {
        PdpHeadNavBarWidget.super.LIZLLL();
        View view = this.LJ;
        if (view != null) {
            LinearLayout linearLayout = (LinearLayout) view.findViewById(2131368398);
            if (linearLayout != null) {
                linearLayout.setPadding(linearLayout.getPaddingLeft(), LJIIJJI().LIZJ(), linearLayout.getPaddingRight(), linearLayout.getPaddingBottom());
            }
            ConstraintLayout findViewById = view.findViewById(2131367425);
            if (findViewById != null) {
                findViewById.setPadding(findViewById.getPaddingLeft(), LJIIJJI().LIZJ(), findViewById.getPaddingRight(), findViewById.getPaddingBottom());
            }
            DV0.LIZ(this, LJIIJJI(), C6105COv.LIZ, new C6059CNb(view, this));
            AppCompatImageView findViewById2 = view.findViewById(2131363384);
            n.LIZIZ(findViewById2, "");
            findViewById2.setOnClickListener(new C6072CNo(this));
            if (LJIIJJI().LJIJJ) {
                4ZZ findViewById3 = view.findViewById(2131362778);
                n.LIZIZ(findViewById3, "");
                findViewById3.setVisibility(8);
                4ZZ findViewById4 = view.findViewById(2131362778);
                n.LIZIZ(findViewById4, "");
                findViewById4.setOnClickListener(new COF(this));
            }
            4ZZ findViewById5 = view.findViewById(2131367705);
            n.LIZIZ(findViewById5, "");
            findViewById5.setOnClickListener(new C6061CNd(this));
            DV0.LIZ(this, LJIIJJI(), CPA.LIZ, new C6058CNa(view, this));
            DV0.LIZ(this, LJIIJJI(), CPH.LIZ, C6104COu.LIZ, new CNZ(view, this));
            DV0.LIZ(this, LJIIJJI(), CPD.LIZ, new C6065CNh(view, this));
        }
        DV0.LIZ(this, LJIIJJI(), CK8.LIZ, new C6068CNk(this));
        DV0.LIZ(this, LJIIJJI(), CK0.LIZ, CK9.LIZ, new C6067CNj(this));
        3Ok r3 = new 3Ok();
        r3.element = false;
        DV0.LIZ(this, LJIIJJI(), C6103COt.LIZ, new CNY(this, r3));
        DV0.LIZ(this, LJIIJJI(), CPC.LIZ, new C6060CNc(this));
        EventBus.LIZ(EventBus.LIZ(), this);
    }

    public final void LIZ(C5965CJl cJl) {
        M12.LIZ(cJl);
        this.LJII = cJl;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:12:0x002b, code lost:
        if (r1 == null) goto L_0x002d;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:13:0x002d, code lost:
        kotlin.h.b.n.LIZIZ();
     */
    @X.ISm
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onEvent(X.C3088B6u r6) {
        /*
            r5 = this;
            X.M12.LIZ(r6)
            java.lang.String r1 = "product"
            java.lang.String r0 = r6.LIZLLL
            boolean r0 = android.text.TextUtils.equals(r1, r0)
            if (r0 == 0) goto L_0x004e
            android.view.View r4 = r5.LJ
            if (r4 == 0) goto L_0x0033
            r0 = 0
            com.ss.android.ugc.aweme.im.service.IIMService r3 = com.ss.android.ugc.aweme.im.sdk.common.controller.providedservices.IMService.createIIMServicebyMonsterPlugin(r0)
            if (r3 == 0) goto L_0x0033
            android.content.Context r2 = r4.getContext()
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZIZ(r2, r0)
        L_0x0021:
            r1 = 0
            if (r2 == 0) goto L_0x002d
            boolean r0 = r2 instanceof android.app.Activity
            if (r0 == 0) goto L_0x004f
            r1 = r2
            android.app.Activity r1 = (android.app.Activity) r1
            if (r1 != 0) goto L_0x0030
        L_0x002d:
            kotlin.h.b.n.LIZIZ()
        L_0x0030:
            r3.showIMSnackbar(r1, r4, r6)
        L_0x0033:
            com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel r0 = r5.LJIIJJI()
            X.CG9 r3 = r0.LJJ
            if (r3 == 0) goto L_0x004e
            com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel r0 = r5.LJIIJJI()
            X.M12.LIZ(r6, r0)
            X.2k0 r2 = X.2k0.LIZ
            X.4uM r1 = new X.4uM
            r1.<init>(r3, r0, r6)
            java.lang.String r0 = "tiktokec_tips_show"
            r2.LIZ(r0, r1)
        L_0x004e:
            return
        L_0x004f:
            boolean r0 = r2 instanceof android.content.ContextWrapper
            if (r0 == 0) goto L_0x002d
            android.content.ContextWrapper r2 = (android.content.ContextWrapper) r2
            android.content.Context r2 = r2.getBaseContext()
            goto L_0x0021
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ecommerce.pdp.widget.PdpHeadNavBarWidget.onEvent(X.B6u):void");
    }

    public PdpHeadNavBarWidget(Fragment fragment, 0AA r4) {
        M12.LIZ(fragment);
        this.LJIIL = fragment;
        this.LJIILIIL = r4;
        D1G LIZ = KEM.LIZ.LIZ(PdpViewModel.class);
        this.LJIILLIIL = 7he.LIZ(new C2975B2l(this, LIZ, LIZ));
    }
}
