package com.ss.android.ugc.aweme.discover.ui;

import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.0Gp;
import X.0HH;
import X.1hK;
import X.2GD;
import X.2GO;
import X.2HZ;
import X.2K7;
import X.2ce;
import X.7vm;
import X.8gI;
import X.9oY;
import X.AVG;
import X.AgT;
import X.Agy;
import X.Ah9;
import X.AhT;
import X.Ahh;
import X.B0a;
import X.B7g;
import X.C0043R1r;
import X.C1069Rc9;
import X.C3328SUa;
import X.C3345SUr;
import X.C3405SWz;
import X.C3411SXf;
import X.C3439SYh;
import X.C3440SYi;
import X.C3589Sbh;
import X.C3610Sc2;
import X.C3612Sc4;
import X.C3670Sd0;
import X.C3671Sd1;
import X.Crj;
import X.ISm;
import X.JK9;
import X.JKC;
import X.KDg;
import X.LYF;
import X.LaL;
import X.LbH;
import X.Ldo;
import X.LeC;
import X.Lun;
import X.Lv5;
import X.LvM;
import X.M12;
import X.MJs;
import X.OFc;
import X.OeP;
import X.PT5;
import X.SS8;
import X.SS9;
import X.SUD;
import X.SUY;
import X.SV0;
import X.SV5;
import X.SXD;
import X.SXK;
import X.SYD;
import X.SYI;
import X.SYW;
import X.SZP;
import X.T9P;
import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.widgets.NextLiveData;
import com.ss.android.ugc.aweme.base.api.BaseResponse;
import com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig;
import com.ss.android.ugc.aweme.discover.model.QueryCorrectInfo;
import com.ss.android.ugc.aweme.discover.model.SearchApiResult;
import com.ss.android.ugc.aweme.discover.model.SearchIntermediateViewModel;
import com.ss.android.ugc.aweme.discover.model.SearchStateViewModel;
import com.ss.android.ugc.aweme.discover.model.SearchSurveyConfig;
import com.ss.android.ugc.aweme.discover.viewmodel.SearchEnterViewModel;
import com.ss.android.ugc.aweme.discover.viewmodel.SearchResultViewModel;
import com.ss.android.ugc.aweme.feed.model.LogPbBean;
import com.ss.android.ugc.aweme.search.model.SearchResultParamProvider;
import com.ss.android.ugc.aweme.search.survey.SurveyViewModel;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

public abstract class DynamicSearchFragment extends SearchBaseFragment implements C3612Sc4, SUD, 2HZ, 2GO {
    public T9P LIZ;
    public OFc LIZIZ;
    public SearchIntermediateViewModel LIZJ;
    public SV0 LIZLLL;
    public boolean LJ = true;
    public SearchStateViewModel LJIIIZ;
    public boolean LJIIJ = true;
    public SearchEnterViewModel LJIIJJI;
    public SYD LJIIL;
    public ViewGroup LJIILIIL;
    public boolean LJIILJJIL;
    public long LJIILL;
    public SurveyViewModel LJIIZILJ;
    public final Crj LJIJ = 7vm.LIZ(new AhT(this));
    public SparseArray LJIJI;

    static {
        Covode.recordClassIndex(65441);
    }

    private final B0a LJIIL() {
        return (B0a) this.LJIJ.getValue();
    }

    public final void LIZ(LeC leC, String str) {
    }

    public final void LIZ(GlobalDoodleConfig globalDoodleConfig) {
    }

    public final void LIZ(QueryCorrectInfo queryCorrectInfo) {
    }

    public final void LIZ(SearchApiResult searchApiResult) {
    }

    public final void LIZIZ(SearchApiResult searchApiResult) {
    }

    public void LIZJ() {
        SparseArray sparseArray = this.LJIJI;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final void LIZJ(SearchApiResult searchApiResult) {
    }

    public final void LIZLLL(boolean z) {
    }

    public abstract boolean LJI();

    public boolean LJIIJJI() {
        return true;
    }

    public Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(387, new C1069Rc9(DynamicSearchFragment.class, "onFeedbackSubmitSuccess", LaL.class, ThreadMode.POSTING, 0, false));
        hashMap.put(490, new C1069Rc9(DynamicSearchFragment.class, "hideLoadingBall", JKC.class, ThreadMode.MAIN, 0, false));
        hashMap.put(491, new C1069Rc9(DynamicSearchFragment.class, "recordViewDrawEnd", JK9.class, ThreadMode.MAIN, 0, false));
        hashMap.put(492, new C1069Rc9(DynamicSearchFragment.class, "setRequestSuccessConfig", SS9.class, ThreadMode.MAIN, 0, false));
        hashMap.put(389, new C1069Rc9(DynamicSearchFragment.class, "onWebViewActivityCloseEvent", KDg.class, ThreadMode.POSTING, 0, false));
        return hashMap;
    }

    @ISm
    public final void onWebViewActivityCloseEvent(KDg kDg) {
        M12.LIZ(kDg);
    }

    public final SV0 bx_() {
        return this.LJJI;
    }

    public final void LIZ(SearchApiResult searchApiResult, String str, int i) {
        String imprId;
        M12.LIZ(searchApiResult, str);
        C3345SUr.LIZJ.LIZIZ(this.LJJIFFI);
        SYD syd = this.LJIIL;
        String str2 = "";
        if (syd == null) {
            n.LIZ(str2);
        }
        syd.LIZ(str);
        LJFF();
        SS8 LIZ2 = SS8.LIZIZ.LIZ();
        String LJJII = LJJII();
        LogPbBean logPbBean = searchApiResult.logPb;
        if (!(logPbBean == null || (imprId = logPbBean.getImprId()) == null)) {
            str2 = imprId;
        }
        GlobalDoodleConfig globalDoodleConfig = searchApiResult.globalDoodleConfig;
        Long l = null;
        String searchChannel = globalDoodleConfig != null ? globalDoodleConfig.getSearchChannel() : null;
        GlobalDoodleConfig globalDoodleConfig2 = searchApiResult.globalDoodleConfig;
        String newSource = globalDoodleConfig2 != null ? globalDoodleConfig2.getNewSource() : null;
        BaseResponse.ServerTimeExtra serverTimeExtra = searchApiResult.extra;
        if (serverTimeExtra != null) {
            l = Long.valueOf(serverTimeExtra.now);
        }
        LIZ2.LIZ(new LbH(LJJII, str2, searchChannel, newSource, l));
        LIZIZ(searchApiResult.globalDoodleConfig);
        LIZ(searchApiResult.logPb);
        LJIJ();
        M12.LIZ(searchApiResult);
        SUY LIZ3 = C3328SUa.LIZJ.LIZ(this.LJJI);
        LIZ3.LIZJ(i);
        LIZ3.LJ();
        LIZ3.LIZ(searchApiResult.getRequestId());
        LIZ3.LIZ((PT5) searchApiResult);
        LIZ3.LIZIZ(0);
        LIZ3.LJI();
    }

    public final void LIZ(Throwable th) {
        M12.LIZ(th);
        SUY LIZ2 = C3328SUa.LIZJ.LIZ(this.LJJI);
        LIZ2.LJ();
        LIZ2.LIZIZ(1);
        LIZ2.LIZIZ(th.getMessage());
        LIZ2.LJI();
    }

    public final B0a LJ() {
        return LJIIL();
    }

    public final OeP bz_() {
        return LJJIII();
    }

    public static boolean LJIILIIL() {
        try {
            return 2K7.LIZ.LIZJ();
        } catch (Exception unused) {
            return false;
        }
    }

    public final SYD LIZIZ() {
        SYD syd = this.LJIIL;
        if (syd == null) {
            n.LIZ("");
        }
        return syd;
    }

    public final WeakReference<1hK> by_() {
        return new WeakReference<>(getActivity());
    }

    public void onPause() {
        DynamicSearchFragment.super.onPause();
        if (this.LJIILJJIL) {
            LJIILJJIL();
        }
    }

    public void onResume() {
        DynamicSearchFragment.super.onResume();
        this.LJIILL = SystemClock.uptimeMillis();
    }

    private void LJIIZILJ() {
        if (!TextUtils.isEmpty(LJJII())) {
            0Gp.LIZ(new C3405SWz(this));
        }
    }

    public void onDestroyView() {
        View view = getView();
        if (view != null) {
            C3670Sd0 sd0 = C3671Sd1.LIZIZ;
            n.LIZIZ(view, "");
            sd0.LIZIZ(view);
        }
        super.onDestroyView();
        EventBus.LIZ().LIZIZ((Object) this);
        LIZJ();
    }

    private void LJIJ() {
        SearchStateViewModel searchStateViewModel = this.LJIIIZ;
        if (searchStateViewModel == null) {
            n.LIZ("");
        }
        searchStateViewModel.setIsRefreshingData(false);
        new C3589Sbh("query_sign").LJFF();
        C3411SXf.LIZIZ = false;
        SYI LIZLLL2 = SXD.Companion.LIZLLL(getActivity());
        if (LIZLLL2 != null) {
            LIZLLL2.setLastShowingPageIndex(this.LJJIJ);
        }
        this.LJJIJL = false;
    }

    public final SearchStateViewModel LIZ() {
        SearchStateViewModel searchStateViewModel = this.LJIIIZ;
        if (searchStateViewModel == null) {
            n.LIZ("");
        }
        return searchStateViewModel;
    }

    public final void LJFF() {
        OFc oFc = this.LIZIZ;
        if (oFc == null) {
            n.LIZ("");
        }
        if (oFc.LIZLLL) {
            OFc oFc2 = this.LIZIZ;
            if (oFc2 == null) {
                n.LIZ("");
            }
            oFc2.LIZJ();
        }
        T9P t9p = this.LIZ;
        if (t9p == null) {
            n.LIZ("");
        }
        t9p.setRefreshing(false);
    }

    public final void LJII() {
        if (!this.LJJIJL) {
            T9P t9p = this.LIZ;
            if (t9p == null) {
                n.LIZ("");
            }
            t9p.setRefreshing(true);
        } else if (MJs.LIZ.LIZ()) {
            OFc oFc = this.LIZIZ;
            if (oFc == null) {
                n.LIZ("");
            }
            oFc.LIZIZ();
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:14:0x005e  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private final void LJIILJJIL() {
        /*
            r6 = this;
            long r4 = android.os.SystemClock.uptimeMillis()
            long r0 = r6.LJIILL
            long r4 = r4 - r0
            X.SV0 r0 = r6.LJJ
            if (r0 == 0) goto L_0x0069
            int r0 = r0.getIndex()
            java.lang.Integer r2 = java.lang.Integer.valueOf(r0)
        L_0x0013:
            java.lang.String r3 = ""
            if (r2 == 0) goto L_0x0023
            int r1 = r6.LJJIJ
            X.SV0 r0 = r6.LJJ
            if (r0 == 0) goto L_0x0060
            int r0 = r0.getIndex()
            if (r1 != r0) goto L_0x0060
        L_0x0023:
            r2 = r3
        L_0x0024:
            X.SXK r0 = r6.LJIL
            java.lang.String r0 = r0.getSearchId()
            if (r0 != 0) goto L_0x005e
        L_0x002c:
            X.SYf r1 = new X.SYf
            r1.<init>()
            java.lang.String r0 = java.lang.String.valueOf(r4)
            r1.LJIJJ(r0)
            int r0 = r6.LJJIJ
            java.lang.String r0 = X.C3320STs.LIZ((int) r0)
            r1.LJFF(r0)
            r1.LIZ((java.lang.String) r3)
            r1.LIZLLL(r3)
            X.B8V r0 = X.9oY.LIZ
            java.lang.String r0 = r0.LIZ(r3)
            r1.LIZJ(r0)
            r1.LJIJJLI(r2)
            java.lang.String r0 = r6.LJJII()
            r1.LIZIZ((java.lang.String) r0)
            r1.LJFF()
            return
        L_0x005e:
            r3 = r0
            goto L_0x002c
        L_0x0060:
            int r0 = r2.intValue()
            java.lang.String r2 = X.C3320STs.LIZ((int) r0)
            goto L_0x0024
        L_0x0069:
            r2 = 0
            goto L_0x0013
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.DynamicSearchFragment.LJIILJJIL():void");
    }

    private final String LJIILL() {
        String str;
        String enterMethod;
        SV5 sv5;
        SearchEnterViewModel searchEnterViewModel = this.LJIIJJI;
        String str2 = null;
        if (searchEnterViewModel == null || (sv5 = searchEnterViewModel.LIZ) == null) {
            str = null;
        } else {
            str = sv5.getEnterSearchFrom();
        }
        if (n.LIZ("mall", str)) {
            return LJIILLIIL();
        }
        if (C3411SXf.LIZIZ) {
            str2 = "click_more_general_list";
        } else if (C3411SXf.LJIIIZ) {
            str2 = "swipe_more_general_list";
        } else {
            SYI LIZLLL2 = SXD.Companion.LIZLLL(getActivity());
            if (LIZLLL2 == null || LIZLLL2.getLastShowingPageIndex() != this.LJJIJ) {
                str2 = "switch_tab";
            } else {
                SV0 sv0 = this.LJJI;
                if (sv0 == null || (enterMethod = sv0.getEnterMethod()) == null || enterMethod.length() == 0) {
                    str2 = LJIILLIIL();
                } else {
                    SV0 sv02 = this.LJJI;
                    if (sv02 == null || (str2 = sv02.getEnterMethod()) == null) {
                        n.LIZIZ();
                    }
                }
            }
        }
        if (n.LIZ(this.LJJII, "tab_search")) {
            return this.LJJII;
        }
        return str2;
    }

    /* JADX WARNING: Can't fix incorrect switch cases order */
    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0030, code lost:
        if (r4.equals(r3) != false) goto L_0x0011;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private final java.lang.String LJIILLIIL() {
        /*
            r5 = this;
            java.lang.String r4 = r5.LJJII
            int r0 = r4.hashCode()
            java.lang.String r3 = "search_sug"
            java.lang.String r2 = "related_search_keyword"
            java.lang.String r1 = "recom_search"
            switch(r0) {
                case -1816950631: goto L_0x001c;
                case -1191929626: goto L_0x0024;
                case -710131922: goto L_0x002c;
                case 3452698: goto L_0x0033;
                default: goto L_0x000f;
            }
        L_0x000f:
            java.lang.String r3 = r5.LJJII
        L_0x0011:
            if (r3 == 0) goto L_0x0019
            int r0 = r3.length()
            if (r0 != 0) goto L_0x001b
        L_0x0019:
            java.lang.String r3 = "normal_search"
        L_0x001b:
            return r3
        L_0x001c:
            boolean r0 = r4.equals(r1)
            if (r0 == 0) goto L_0x000f
            r3 = r1
            goto L_0x0011
        L_0x0024:
            boolean r0 = r4.equals(r2)
            if (r0 == 0) goto L_0x000f
            r3 = r2
            goto L_0x0011
        L_0x002c:
            boolean r0 = r4.equals(r3)
            if (r0 == 0) goto L_0x000f
            goto L_0x0011
        L_0x0033:
            java.lang.String r0 = "push"
            boolean r0 = r4.equals(r0)
            if (r0 == 0) goto L_0x000f
            java.lang.String r3 = r5.LJJIII
            goto L_0x0011
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.DynamicSearchFragment.LJIILLIIL():java.lang.String");
    }

    public final void d_(boolean z) {
        this.LJJIJL = z;
    }

    public static 0Bx LIZ(1hK r2) {
        0Bx LIZ2 = 0By.LIZ(r2, (0Bv) null);
        if (2GD.LIZ) {
            0Bs.LIZ(LIZ2, r2);
        }
        return LIZ2;
    }

    private void LIZ(LogPbBean logPbBean) {
        String imprId;
        if (logPbBean != null && (imprId = logPbBean.getImprId()) != null) {
            LIZ(imprId);
            9oY.LIZ.LIZ(imprId, logPbBean);
        }
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void setRequestSuccessConfig(SS9 ss9) {
        M12.LIZ(ss9);
        LIZIZ(ss9.LIZ);
        LIZ(ss9.LIZIZ);
        LJIJ();
    }

    private void LIZIZ(GlobalDoodleConfig globalDoodleConfig) {
        SurveyViewModel surveyViewModel;
        NextLiveData<SearchSurveyConfig> nextLiveData;
        if (globalDoodleConfig != null) {
            SearchSurveyConfig surveyConfig = globalDoodleConfig.getSurveyConfig();
            if (!(surveyConfig == null || (surveyViewModel = this.LJIIZILJ) == null || (nextLiveData = surveyViewModel.LIZIZ) == null)) {
                nextLiveData.postValue(surveyConfig);
            }
            boolean z = true;
            if (globalDoodleConfig.getDisplayFilterBar() != 1) {
                z = false;
            }
            e_(z);
            this.LJIL.setFeedbackSurvey(globalDoodleConfig.getFeedbackSurvey());
        }
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void hideLoadingBall(JKC jkc) {
        M12.LIZ(jkc);
        if ((n.LIZ(jkc.LIZ, "vertical-sounds") || n.LIZ(jkc.LIZ, "vertical-shopping")) && aq_()) {
            LJFF();
        }
    }

    @ISm
    public final void onFeedbackSubmitSuccess(LaL laL) {
        NextLiveData<Boolean> nextLiveData;
        NextLiveData<Boolean> nextLiveData2;
        M12.LIZ(laL);
        SurveyViewModel surveyViewModel = this.LJIIZILJ;
        if (!(surveyViewModel == null || (nextLiveData2 = surveyViewModel.LIZ) == null)) {
            Boolean.valueOf(nextLiveData2.hasObservers());
        }
        SurveyViewModel surveyViewModel2 = this.LJIIZILJ;
        if (surveyViewModel2 != null && (nextLiveData = surveyViewModel2.LIZ) != null) {
            nextLiveData.postValue(true);
        }
    }

    public void setUserVisibleHint(boolean z) {
        DynamicSearchFragment.super.setUserVisibleHint(z);
        LIZJ(true);
        if (z) {
            SYI LIZLLL2 = SXD.Companion.LIZLLL(this);
            if (LIZLLL2 != null) {
                LIZLLL2.setSearchLastShowPageIndex(this.LJJIJ);
            }
            C3411SXf.LIZLLL = false;
            C3411SXf.LJIIIZ = false;
            SV0 sv0 = this.LJJ;
            if (sv0 != null) {
                sv0.setIndex(this.LJJIJ);
            }
            this.LJIILL = SystemClock.uptimeMillis();
        }
        if (this.LJIILJJIL && !z) {
            LJIILJJIL();
        }
        this.LJIILJJIL = z;
    }

    private void LIZ(String str) {
        int i;
        String str2;
        8gI r1 = 8gI.LIZIZ;
        1hK activity = getActivity();
        int i2 = 0;
        if (activity != null) {
            i = activity.hashCode();
        } else {
            i = 0;
        }
        C3439SYh LIZ2 = r1.LIZ(i);
        if (LIZ2 == null) {
            LIZ2 = new C0043R1r();
            8gI r12 = 8gI.LIZIZ;
            1hK activity2 = getActivity();
            if (activity2 != null) {
                i2 = activity2.hashCode();
            }
            r12.LIZ(i2, LIZ2);
        }
        int i3 = this.LJJIJ;
        SYW syw = new SYW();
        if (str == null) {
            str2 = "";
        } else {
            str2 = str;
        }
        syw.LIZ(str2);
        syw.LIZIZ(LJJII());
        LIZ2.LIZ(i3, syw);
        SXK sxk = this.LJIL;
        if (str == null) {
            str = "";
        }
        sxk.setSearchId(str);
        sxk.setSearchKeyword(LJJII());
        C3610Sc2.LIZIZ = this.LJIL.getSearchId();
    }

    private void LIZIZ(SV0 sv0) {
        boolean z;
        String str;
        M12.LIZ(sv0);
        this.LJJ = sv0;
        String keyword = sv0.getKeyword();
        n.LIZIZ(keyword, "");
        LIZIZ(keyword);
        String searchFrom = sv0.getSearchFrom();
        n.LIZIZ(searchFrom, "");
        LIZJ(searchFrom);
        this.LJJIJIIJI = sv0.getNeedCorrect();
        String enterMethod = sv0.getEnterMethod();
        if (enterMethod == null || enterMethod.length() == 0) {
            z = true;
        } else {
            z = false;
        }
        if (!z) {
            str = sv0.getEnterMethod();
            n.LIZIZ(str, "");
        } else {
            str = "channel_unknown";
        }
        LIZLLL(str);
        if (n.LIZ(this.LJJIII, "channel_unknown")) {
            this.LJIL.setRecentRequestSearchSourceUnknown(true);
        }
        if (n.LIZ(this.LJJII, "search_sug")) {
            this.LJJIIZI = sv0.getSugType();
        }
        1hK activity = getActivity();
        if (activity != null) {
            LIZ(activity).LIZ(SearchResultViewModel.class).LIZ.postValue(sv0);
        }
    }

    public void onCreate(Bundle bundle) {
        DynamicSearchFragment.super.onCreate(bundle);
        Bundle arguments = getArguments();
        if (arguments != null) {
            Serializable serializable = arguments.getSerializable(SearchBaseFragment.LJJIL);
            Objects.requireNonNull(serializable, "null cannot be cast to non-null type com.ss.android.ugc.aweme.search.model.SearchResultParam");
            LIZIZ((SV0) serializable);
        }
        1hK activity = getActivity();
        if (activity == null) {
            n.LIZIZ();
        }
        SearchStateViewModel LIZ2 = LIZ(activity).LIZ(SearchStateViewModel.class);
        n.LIZIZ(LIZ2, "");
        SearchStateViewModel searchStateViewModel = LIZ2;
        this.LJIIIZ = searchStateViewModel;
        if (searchStateViewModel == null) {
            n.LIZ("");
        }
        searchStateViewModel.searchState.observe(this, new C3440SYi(this));
        1hK activity2 = getActivity();
        if (activity2 != null) {
            this.LIZJ = LIZ(activity2).LIZ(SearchIntermediateViewModel.class);
        }
        if (this.LJJIJIIJIL == null) {
            LJIIL().LIZ();
        }
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void recordViewDrawEnd(JK9 jk9) {
        String str;
        SYW LIZIZ2;
        M12.LIZ(jk9);
        C3439SYh LIZ2 = 8gI.LIZIZ.LIZ();
        if (LIZ2 == null || (LIZIZ2 = LIZ2.LIZIZ(this.LJJIJ)) == null || (str = LIZIZ2.LIZ) == null) {
            str = "";
        }
        SUY LIZ3 = C3328SUa.LIZJ.LIZ(this.LJJ);
        LIZ3.LIZIZ(jk9.LIZLLL);
        LIZ3.LIZIZ(jk9.LIZIZ);
        LIZ3.LIZJ(jk9.LIZJ);
        LIZ3.LIZ(str);
        LIZ3.LIZJ = jk9.LIZ;
        LIZ3.LJI = jk9.LJ;
        LIZ3.LJJIIJ = true;
        View view = getView();
        if (view != null) {
            view.post(new SZP(LIZ3));
        }
    }

    public final void LIZ(SV0 sv0) {
        M12.LIZ(sv0);
        this.LIZLLL = sv0;
        super.LIZ(sv0);
        this.LJ = true;
        if (!aq_()) {
            Bundle arguments = getArguments();
            if (arguments != null) {
                arguments.putSerializable(SearchBaseFragment.LJJIL, sv0);
                return;
            }
            return;
        }
        LIZIZ(sv0);
        Ldo ldo = SearchResultParamProvider.LIZIZ;
        Context context = getContext();
        if (context == null) {
            n.LIZIZ();
        }
        n.LIZIZ(context, "");
        ldo.LIZ(context, sv0);
        LIZJ(false);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:22:0x004c, code lost:
        if (kotlin.h.b.n.LIZ(r1, "guide_search_cancel") != false) goto L_0x004e;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZJ(boolean r4) {
        /*
            r3 = this;
            boolean r0 = r3.aq_()
            if (r0 == 0) goto L_0x007a
            boolean r0 = r3.getUserVisibleHint()
            if (r0 == 0) goto L_0x007a
            boolean r0 = r3.LJIIJ
            if (r0 == 0) goto L_0x007a
            boolean r0 = r3.LJ
            if (r0 == 0) goto L_0x009d
            X.SUa r2 = X.C3328SUa.LIZJ
            int r1 = r3.LJJIJ
            X.SV0 r0 = r3.LJJ
            r2.LIZIZ(r1, r0)
            boolean r0 = X.C3411SXf.LIZLLL
            if (r0 == 0) goto L_0x007f
            java.lang.String r1 = "click_more_general_list"
            r3.LIZLLL(r1)
            X.SV0 r0 = r3.LJJ
            if (r0 == 0) goto L_0x002d
            r0.setEnterMethod(r1)
        L_0x002d:
            X.SV0 r0 = r3.LJJ
            r2 = 0
            if (r0 == 0) goto L_0x007d
            java.lang.String r1 = r0.getSearchFrom()
        L_0x0036:
            java.lang.String r0 = "guide_search"
            boolean r0 = kotlin.h.b.n.LIZ(r1, r0)
            if (r0 != 0) goto L_0x004e
            X.SV0 r0 = r3.LJJ
            if (r0 == 0) goto L_0x007b
            java.lang.String r1 = r0.getSearchFrom()
        L_0x0046:
            java.lang.String r0 = "guide_search_cancel"
            boolean r0 = kotlin.h.b.n.LIZ(r1, r0)
            if (r0 == 0) goto L_0x0056
        L_0x004e:
            X.SV0 r0 = r3.LJJ
            if (r0 == 0) goto L_0x0056
            X.AVG r2 = r0.getFilterOption()
        L_0x0056:
            r3.LIZ((int) r4, (X.AVG) r2)
            r1 = 0
            r3.LJ = r1
            boolean r0 = X.C3411SXf.LIZJ
            if (r0 == 0) goto L_0x0062
            X.C3411SXf.LIZJ = r1
        L_0x0062:
            int r1 = r3.LJJIFFI
            int r0 = X.C3320STs.LIZ()
            if (r1 == r0) goto L_0x0077
            boolean r0 = r3.LJI()
            if (r0 == 0) goto L_0x0077
            X.SUr r1 = X.C3345SUr.LIZJ
            int r0 = r3.LJJIFFI
            r1.LIZ(r0)
        L_0x0077:
            r3.LJIIZILJ()
        L_0x007a:
            return
        L_0x007b:
            r1 = r2
            goto L_0x0046
        L_0x007d:
            r1 = r2
            goto L_0x0036
        L_0x007f:
            X.SXF r1 = X.SXD.Companion
            r0 = r3
            X.SYI r0 = r1.LIZLLL(r0)
            if (r0 == 0) goto L_0x0090
            int r1 = r0.getSearchLastShowPageIndex()
            int r0 = r3.LJJIJ
            if (r1 == r0) goto L_0x002d
        L_0x0090:
            java.lang.String r1 = "switch_tab"
            r3.LIZLLL(r1)
            X.SV0 r0 = r3.LJJ
            if (r0 == 0) goto L_0x002d
            r0.setEnterMethod(r1)
            goto L_0x002d
        L_0x009d:
            X.SXF r1 = X.SXD.Companion
            X.1hK r0 = r3.getActivity()
            X.SYI r1 = r1.LIZLLL(r0)
            if (r1 == 0) goto L_0x0077
            int r0 = r3.LJJIJ
            r1.setLastShowingPageIndex(r0)
            goto L_0x0077
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.DynamicSearchFragment.LIZJ(boolean):void");
    }

    public final void e_(boolean z) {
        AVG avg;
        2ce<Boolean> enableSearchFilter;
        2ce<Boolean> enableSearchFilter2;
        2ce<Boolean> enableSearchFilter3;
        SearchIntermediateViewModel searchIntermediateViewModel;
        2ce<Boolean> showSearchFilterDot;
        boolean z2 = z;
        if (!Ahh.LIZ.LIZ()) {
            Agy LJIIL2 = LJIIL();
            Objects.requireNonNull(LJIIL2, "null cannot be cast to non-null type com.ss.android.ugc.aweme.discover.ui.SearchBottomDialogHelper");
            LJIIL2.LIZ(z2, getActivity(), this.LJJIJ, this.LJJ, this.LJJIJIL);
        }
        if (Ah9.LIZ && LJIJI()) {
            SV0 sv0 = this.LJJ;
            if (sv0 != null) {
                avg = sv0.getFilterOption();
            } else {
                avg = null;
            }
            if (!(avg != null || (searchIntermediateViewModel = this.LIZJ) == null || (showSearchFilterDot = searchIntermediateViewModel.getShowSearchFilterDot()) == null)) {
                showSearchFilterDot.setValue(false);
            }
            if (!z2) {
                SearchIntermediateViewModel searchIntermediateViewModel2 = this.LIZJ;
                if (!(searchIntermediateViewModel2 == null || (enableSearchFilter = searchIntermediateViewModel2.getEnableSearchFilter()) == null)) {
                    enableSearchFilter.setValue(false);
                }
                this.LJJIJIL = false;
            } else if (AgT.LIZJ.LIZ(LJIIL().LIZIZ())) {
                SearchIntermediateViewModel searchIntermediateViewModel3 = this.LIZJ;
                if (!(searchIntermediateViewModel3 == null || (enableSearchFilter3 = searchIntermediateViewModel3.getEnableSearchFilter()) == null)) {
                    enableSearchFilter3.setValue(true);
                }
                this.LJJIJIL = true;
            } else {
                SearchIntermediateViewModel searchIntermediateViewModel4 = this.LIZJ;
                if (!(searchIntermediateViewModel4 == null || (enableSearchFilter2 = searchIntermediateViewModel4.getEnableSearchFilter()) == null)) {
                    enableSearchFilter2.setValue(false);
                }
                this.LJJIJIL = false;
            }
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:29:0x0064, code lost:
        if (kotlin.o.y.LIZ(r6) == false) goto L_0x0081;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void LIZ(int r11, X.AVG r12) {
        /*
            r10 = this;
            X.SV0 r0 = r10.LJJ
            r10.LJJI = r0
            r5 = 0
            if (r12 != 0) goto L_0x0010
            r10.LJJIJIIJIL = r5
            X.B0a r0 = r10.LJIIL()
            r0.LIZ()
        L_0x0010:
            X.SV0 r0 = r10.LJJ
            r8 = 1
            r2 = 0
            if (r0 == 0) goto L_0x0034
            boolean r0 = r0.getIsFilterFromSchema()
            if (r0 != r8) goto L_0x0034
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x01c4
            X.AVG r0 = r0.getFilterOption()
        L_0x0024:
            r10.LJJIJIIJIL = r0
            X.AVG r0 = r10.LJJIJIIJIL
            if (r0 == 0) goto L_0x002d
            r0.setFromSchema(r8)
        L_0x002d:
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x0034
            r0.setIsFilterFromSchema(r2)
        L_0x0034:
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x003b
            r0.setFilterOption(r12)
        L_0x003b:
            com.ss.android.ugc.aweme.discover.model.SearchStateViewModel r0 = r10.LJIIIZ
            java.lang.String r4 = ""
            if (r0 != 0) goto L_0x0044
            kotlin.h.b.n.LIZ(r4)
        L_0x0044:
            r0.setIsRefreshingData(r8)
            java.lang.String r0 = r10.LJIILL()
            r10.LIZLLL(r0)
            java.lang.String r0 = X.C3610Sc2.LIZIZ
            X.C3610Sc2.LIZ = r0
            com.ss.android.ugc.aweme.discover.viewmodel.SearchEnterViewModel r0 = r10.LJIIJJI
            if (r0 == 0) goto L_0x01c1
            X.SV5 r7 = r0.LIZ
            if (r7 == 0) goto L_0x0066
            java.lang.String r6 = r7.getGroupId()
            if (r6 == 0) goto L_0x0066
            boolean r0 = kotlin.o.y.LIZ(r6)
            if (r0 == 0) goto L_0x0081
        L_0x0066:
            X.SXF r0 = X.SXD.Companion
            X.SV6 r0 = r0.LIZJ()
            if (r0 == 0) goto L_0x0080
            X.MWv r0 = r0.getSearchVideoModel()
            if (r0 == 0) goto L_0x0080
            java.lang.String r6 = r0.getGroupId()
            if (r6 == 0) goto L_0x0080
            int r0 = r6.length()
            if (r0 != 0) goto L_0x0081
        L_0x0080:
            r6 = r4
        L_0x0081:
            org.json.JSONObject r3 = new org.json.JSONObject
            r3.<init>()
            java.lang.String r1 = r10.LJJII()
            java.lang.String r0 = "keyword"
            r3.put(r0, r1)
            java.lang.String r1 = r10.LJJIII
            java.lang.String r0 = "search_source"
            r3.put(r0, r1)
            long r0 = java.lang.System.currentTimeMillis()
            java.lang.String r9 = "search_time"
            r3.put(r9, r0)
            int r1 = r10.LJJIJIIJI
            java.lang.String r0 = "query_correct_type"
            r3.put(r0, r1)
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x01be
            X.AVG r0 = r0.getFilterOption()
            if (r0 == 0) goto L_0x01be
            boolean r0 = r0.isDefaultOption()
            if (r0 != 0) goto L_0x01be
        L_0x00b6:
            java.lang.String r0 = "is_filter_search"
            r3.put(r0, r8)
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x01bb
            X.AVG r0 = r0.getFilterOption()
            if (r0 == 0) goto L_0x01bb
            int r1 = r0.getFilterBy()
        L_0x00c9:
            java.lang.String r0 = "filter_by"
            r3.put(r0, r1)
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x01b8
            X.AVG r0 = r0.getFilterOption()
            if (r0 == 0) goto L_0x01b8
            int r1 = r0.getSortType()
        L_0x00dc:
            java.lang.String r0 = "sort_type"
            r3.put(r0, r1)
            X.SSA r0 = X.SS8.LIZIZ
            X.SS8 r0 = r0.LIZ()
            java.lang.String r1 = r0.LIZ()
            java.lang.String r0 = "search_context"
            r3.put(r0, r1)
            if (r7 == 0) goto L_0x01b5
            java.lang.String r1 = r7.getEnterSearchFrom()
        L_0x00f6:
            java.lang.String r0 = "enter_from"
            r3.put(r0, r1)
            java.lang.String r0 = "group_id"
            r3.put(r0, r6)
            com.ss.android.ugc.aweme.IAccountUserService r0 = X.46i.LJFF()
            kotlin.h.b.n.LIZIZ(r0, r4)
            java.lang.String r1 = r0.getCurUserId()
            java.lang.String r0 = "current_uid"
            r3.put(r0, r1)
            X.SXF r1 = X.SXD.Companion
            X.1hK r0 = r10.getActivity()
            X.SYI r1 = r1.LIZLLL(r0)
            r0 = -1
            if (r1 == 0) goto L_0x0130
            int r1 = r1.getLastShowingPageIndex()
            if (r1 == r0) goto L_0x0130
            int r0 = r10.LJJIJ
            if (r1 == r0) goto L_0x0130
            java.lang.String r1 = X.C3352SUy.LIZJ(r1)
            java.lang.String r0 = "from_search_subtab"
            r3.put(r0, r1)
        L_0x0130:
            java.lang.String r1 = r10.LJJIII
            java.lang.String r0 = "enter_method"
            r3.put(r0, r1)
            java.lang.String r1 = X.C3610Sc2.LIZIZ
            java.lang.String r0 = "last_search_id"
            r3.put(r0, r1)
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x01b3
            java.lang.String r1 = r0.getSugType()
        L_0x0146:
            java.lang.String r0 = "sug_type"
            r3.put(r0, r1)
            java.lang.String r1 = X.SX8.LIZ
            java.lang.String r0 = "sug_session_id"
            r3.put(r0, r1)
            boolean r1 = X.C3345SUr.LIZ
            java.lang.String r0 = "is_first_search"
            r3.put(r0, r1)
            X.7im r0 = X.2HX.LIZ
            long r0 = r0.LJFF
            java.lang.String r6 = "launch_time"
            r3.put(r6, r0)
            X.SXF r0 = X.SXD.Companion
            X.SV6 r0 = r0.LIZJ()
            if (r0 == 0) goto L_0x0176
            X.SW6 r0 = r0.getSearchCommonModel()
            if (r0 == 0) goto L_0x0176
            java.lang.String r1 = r0.isFromComment()
            if (r1 != 0) goto L_0x0177
        L_0x0176:
            r1 = r4
        L_0x0177:
            java.lang.String r0 = "is_from_comment"
            r3.put(r0, r1)
            X.SXF r0 = X.SXD.Companion
            X.SV6 r0 = r0.LIZJ()
            if (r0 == 0) goto L_0x018e
            X.MWv r0 = r0.getSearchVideoModel()
            if (r0 == 0) goto L_0x018e
            java.lang.String r5 = r0.getGroupId()
        L_0x018e:
            java.lang.String r0 = "lastFromGroupId"
            r3.put(r0, r5)
            X.SYD r1 = r10.LJIIL
            if (r1 != 0) goto L_0x019a
            kotlin.h.b.n.LIZ(r4)
        L_0x019a:
            java.lang.String r0 = "changeSearchParams"
            r1.LIZ((java.lang.String) r0, (org.json.JSONObject) r3)
            boolean r0 = r10.LJI()
            if (r0 == 0) goto L_0x01b0
            X.SUa r1 = X.C3328SUa.LIZJ
            X.SV0 r0 = r10.LJJI
            X.SUY r0 = r1.LIZ((X.SV0) r0)
            r0.LIZIZ()
        L_0x01b0:
            X.C3345SUr.LIZ = r2
            return
        L_0x01b3:
            r1 = r5
            goto L_0x0146
        L_0x01b5:
            r1 = r5
            goto L_0x00f6
        L_0x01b8:
            r1 = 0
            goto L_0x00dc
        L_0x01bb:
            r1 = 0
            goto L_0x00c9
        L_0x01be:
            r8 = 0
            goto L_0x00b6
        L_0x01c1:
            r7 = r5
            goto L_0x0066
        L_0x01c4:
            r0 = r5
            goto L_0x0024
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.DynamicSearchFragment.LIZ(int, X.AVG):void");
    }

    public void onViewCreated(View view, Bundle bundle) {
        LYF lv5;
        M12.LIZ(view);
        DynamicSearchFragment.super.onViewCreated(view, bundle);
        M12.LIZ(view);
        View findViewById = view.findViewById(2131369416);
        n.LIZIZ(findViewById, "");
        T9P t9p = (T9P) findViewById;
        this.LIZ = t9p;
        if (t9p == null) {
            n.LIZ("");
        }
        t9p.setEnabled(false);
        OFc findViewById2 = view.findViewById(2131369894);
        n.LIZIZ(findViewById2, "");
        this.LIZIZ = findViewById2;
        if (LJIIJJI()) {
            Context requireContext = requireContext();
            n.LIZIZ(requireContext, "");
            lv5 = new LYF(requireContext, this);
        } else {
            Context context = getContext();
            if (context == null) {
                n.LIZIZ();
            }
            n.LIZIZ(context, "");
            lv5 = new Lv5(context);
            Lun containerAdapter = lv5.getContainerAdapter();
            if (containerAdapter != null) {
                containerAdapter.LIZJ = LJJII();
            }
        }
        this.LJIIL = lv5;
        ViewGroup viewGroup = this.LJIILIIL;
        if (viewGroup == null) {
            n.LIZ("");
        }
        lv5.LIZ(viewGroup, new ViewGroup.LayoutParams(-1, -1));
        ViewGroup viewGroup2 = this.LJIILIIL;
        if (viewGroup2 == null) {
            n.LIZ("");
        }
        viewGroup2.setVisibility(0);
        if (this.LJJ != null) {
            SV0 sv0 = this.LJJ;
            if (sv0 == null) {
                n.LIZIZ();
            }
            LIZ(sv0);
        }
        EventBus.LIZ(EventBus.LIZ(), (Object) this);
        1hK activity = getActivity();
        if (activity != null) {
            this.LJIIJJI = LIZ(activity).LIZ(SearchEnterViewModel.class);
            this.LJIIZILJ = LIZ(activity).LIZ(SurveyViewModel.class);
        }
        B7g.LIZJ.LIZ(getActivity());
        LIZLLL(LJIILL());
        SYD syd = this.LJIIL;
        if (syd == null) {
            n.LIZ("");
        }
        LIZ(syd);
        if (!LJIIJJI()) {
            Lv5 lv52 = this.LJIIL;
            if (lv52 == null) {
                n.LIZ("");
            }
            Objects.requireNonNull(lv52, "null cannot be cast to non-null type com.ss.android.ugc.aweme.discover.lynx.container.DynamicViewsContainer");
            Lv5 lv53 = lv52;
            RecyclerView recyclerView = lv53.getRecyclerView();
            getContext();
            recyclerView.setLayoutManager(new DynamicSearchFragment$handleTouchActionForBullet$1(this));
            lv53.post(new LvM(lv53));
        }
        getActivity();
        if (LJIILIIL()) {
            LJII();
        }
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        if (viewGroup == null) {
            n.LIZIZ();
        }
        View LIZ2 = 0HH.LIZ(layoutInflater.cloneInContext(viewGroup.getContext()), 2131561106, viewGroup, false);
        View findViewById = LIZ2.findViewById(2131364328);
        n.LIZIZ(findViewById, "");
        this.LJIILIIL = (ViewGroup) findViewById;
        return LIZ2;
    }
}
