package com.tencent.mm.plugin.appbrand.jsapi;

import android.text.TextUtils;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.ipc.AppBrandMainProcessService;
import com.tencent.mm.plugin.appbrand.q;
import com.tencent.mm.plugin.expt.d.b;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.ytcommon.BuildConfig;
import java.util.HashMap;
import org.json.JSONObject;

public final class JsApiGetABTestConfig extends u<q> {
    public static final int CTRL_INDEX = 527;
    public static final String NAME = "getABTestConfig";

    public final /* synthetic */ String b(c cVar, JSONObject jSONObject) {
        AppMethodBeat.i(138128);
        ab.i("MicroMsg.JsApiGetABTestConfig", "JSONObject = ".concat(String.valueOf(jSONObject)));
        String optString = jSONObject.optString("experimentId");
        boolean equals = "Expt".equals(jSONObject.optString("experimentType"));
        if (TextUtils.isEmpty(optString)) {
            optString = j("fail:experimentId is empty", null);
            AppMethodBeat.o(138128);
            return optString;
        } else if (equals) {
            HashMap hashMap = new HashMap();
            hashMap.put("testConfig", b.brr().b(optString, BuildConfig.FLAVOR, true, true));
            optString = j("ok", hashMap);
            AppMethodBeat.o(138128);
            return optString;
        } else {
            GetABTestConfigTask getABTestConfigTask = new GetABTestConfigTask(optString);
            if (AppBrandMainProcessService.b(getABTestConfigTask)) {
                ab.i("MicroMsg.JsApiGetABTestConfig", " configs = " + GetABTestConfigTask.a(getABTestConfigTask));
                HashMap hashMap2 = new HashMap();
                hashMap2.put("testConfig", GetABTestConfigTask.a(getABTestConfigTask));
                optString = j("ok", hashMap2);
                AppMethodBeat.o(138128);
                return optString;
            }
            optString = j("fail:fail:internal error", null);
            AppMethodBeat.o(138128);
            return optString;
        }
    }
}
