package com.ss.android.ugc.aweme.discover.ui.search.jsbridge.bullet;

import X.0CB;
import X.0CH;
import X.4UQ;
import X.6Is;
import X.CqM;
import X.KT7;
import X.LbH;
import X.M12;
import X.SS8;
import X.SS9;
import X.SSC;
import com.bytedance.covode.number.Covode;
import com.google.gson.Gson;
import com.google.gson.e;
import com.ss.android.ugc.aweme.bullet.bridge.BaseBridgeMethod;
import com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig;
import com.ss.android.ugc.aweme.feed.model.LogPbBean;
import kotlin.h.b.n;
import org.json.JSONArray;
import org.json.JSONObject;

public final class SearchRequestSuccessMethod extends BaseBridgeMethod implements 6Is {
    public static final SSC LIZIZ = new SSC((byte) 0);
    public final String LIZJ = "searchRequestSuccess";

    static {
        Covode.recordClassIndex(65956);
    }

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

    public final String LIZLLL() {
        return this.LIZJ;
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public SearchRequestSuccessMethod(KT7 kt7) {
        super(kt7);
        M12.LIZ(kt7);
    }

    public final void LIZ(JSONObject jSONObject, 4UQ r12) {
        Long l;
        String str;
        String str2;
        M12.LIZ(jSONObject, r12);
        try {
            e eVar = new e();
            eVar.LIZLLL = true;
            eVar.LJFF = true;
            Gson LIZIZ2 = eVar.LIZIZ();
            GlobalDoodleConfig globalDoodleConfig = (GlobalDoodleConfig) LIZIZ2.LIZ(jSONObject.getString("global_doodle_config"), GlobalDoodleConfig.class);
            JSONObject optJSONObject = jSONObject.optJSONObject("extra");
            String str3 = null;
            if (optJSONObject != null) {
                l = Long.valueOf(optJSONObject.optLong("now"));
                optJSONObject.optString("logid");
                optJSONObject.optJSONArray("fatal_item_ids");
                optJSONObject.optString("search_request_id");
            } else {
                l = null;
            }
            LogPbBean logPbBean = (LogPbBean) LIZIZ2.LIZ(jSONObject.getString("log_pb"), LogPbBean.class);
            CqM.LIZ(new SS9(globalDoodleConfig, logPbBean));
            if (!jSONObject.optBoolean("is_load_more")) {
                SS8 LIZ = SS8.LIZIZ.LIZ();
                if (globalDoodleConfig != null) {
                    str = globalDoodleConfig.getRequestKeyword();
                } else {
                    str = null;
                }
                n.LIZIZ(logPbBean, "");
                String imprId = logPbBean.getImprId();
                if (globalDoodleConfig != null) {
                    str2 = globalDoodleConfig.getSearchChannel();
                    str3 = globalDoodleConfig.getNewSource();
                } else {
                    str2 = null;
                }
                LIZ.LIZ(new LbH(str, imprId, str2, str3, l));
            }
            r12.LIZ(new JSONArray());
        } catch (Exception e) {
            r12.LIZ(0, e.getMessage());
        }
    }
}
