package com.appsflyer.internal;

import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerProperties;
import com.bytedance.covode.number.Covode;
import org.json.JSONObject;

public final class as {
    static {
        Covode.recordClassIndex(2623);
    }

    public static JSONObject valueOf(String str) {
        JSONObject jSONObject = null;
        try {
            JSONObject jSONObject2 = new JSONObject(str);
            try {
                boolean z = AppsFlyerProperties.getInstance().getBoolean("disableProxy", false);
                if (!jSONObject2.optBoolean("monitor", false) || z) {
                    aj.AFInAppEventParameterName().valueOf();
                    aj.AFInAppEventParameterName().values();
                } else {
                    aj.AFInAppEventParameterName().AFInAppEventType();
                }
                if (!jSONObject2.has("ol_id")) {
                    return jSONObject2;
                }
                String optString = jSONObject2.optString("ol_scheme", (String) null);
                String optString2 = jSONObject2.optString("ol_domain", (String) null);
                String optString3 = jSONObject2.optString("ol_ver", (String) null);
                if (optString != null) {
                    AppsFlyerProperties.getInstance().set("onelinkScheme", optString);
                }
                if (optString2 != null) {
                    AppsFlyerProperties.getInstance().set("onelinkDomain", optString2);
                }
                if (optString3 == null) {
                    return jSONObject2;
                }
                AppsFlyerProperties.getInstance().set("onelinkVersion", optString3);
                return jSONObject2;
            } catch (Throwable th) {
                th = th;
                jSONObject = jSONObject2;
                AFLogger.valueOf(th.getMessage(), th);
                aj.AFInAppEventParameterName().valueOf();
                aj.AFInAppEventParameterName().values();
                return jSONObject;
            }
        } catch (Throwable th2) {
            th = th2;
            AFLogger.valueOf(th.getMessage(), th);
            aj.AFInAppEventParameterName().valueOf();
            aj.AFInAppEventParameterName().values();
            return jSONObject;
        }
    }
}
