Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b

以下内容为反编译后的 f.java 源代码,内容仅作参考


package in.swiggy.android.dash.web.kyc;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.webkit.WebView;
import co.hyperverge.hypersnapsdk.activities.HVDocsActivity;
import co.hyperverge.hypersnapsdk.activities.HVFaceActivity;
import co.hyperverge.hypersnapsdk.objects.HVDocConfig;
import co.hyperverge.hypersnapsdk.objects.HVError;
import co.hyperverge.hypersnapsdk.objects.HVFaceConfig;
import co.hyperverge.hypersnapsdk.objects.HyperSnapParams$Region;
import com.google.gson.Gson;
import com.newrelic.agent.android.NewRelic;
import com.newrelic.agent.android.analytics.AnalyticsAttribute;
import com.newrelic.agent.android.instrumentation.GsonInstrumentation;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.payu.threedsbase.constants.APIConstants;
import com.swiggy.lynx.webinterface.b;
import com.xiaomi.mipush.sdk.Constants;
import com.xiaomi.mipush.sdk.PushMessageHelper;
import in.swiggy.android.commons.utils.i0;
import in.swiggy.android.commons.utils.x;
import in.swiggy.android.dash.l;
import in.swiggy.android.dash.web.kyc.model.g;
import in.swiggy.android.dash.web.kyc.model.h;
import in.swiggy.android.dash.web.kyc.model.i;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.j0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.v;
import kotlinx.serialization.KSerializer;
import org.json.JSONException;
import org.json.JSONObject;
@Instrumented
public final class f {
    public static final a s0 = new a(null);
    private final String A;
    private final int B;
    private final int C;
    private final String D;
    private final String E;
    private final String F;
    private final String G;
    private final String H;
    private final String I;
    private final String J;
    private final String K;
    private final String L;
    private final String M;
    private final String N;
    private final String O;
    private final String P;
    private final String Q;
    private final String R;
    private final String S;
    private final String T;
    private final String U;
    private final String V;
    private final String W;
    private final String X;
    private final String Y;
    private final String Z;
    private final Context a;
    private final String a0;
    private final String b;
    private HashMap<String, in.swiggy.android.dash.web.kyc.model.c> b0;
    private final String c;
    private String c0;
    private final WebView d;
    private String d0;
    private final String e;
    private String e0;
    private final SharedPreferences f;
    private h f0;
    private final in.swiggy.android.repositories.interfaces.d g;
    private h g0;
    private final String h;
    private h h0;
    private final String i;
    private h i0;
    private final String j;
    private in.swiggy.android.dash.web.kyc.model.c j0;
    private final String k;
    private final HVDocConfig k0;
    private final String l;
    private final HVFaceConfig l0;
    private final String m;
    private in.swiggy.android.dash.web.kyc.model.b m0;
    private final String n;
    public in.swiggy.android.dash.web.kyc.model.e n0;
    private final String o;
    public in.swiggy.android.dash.web.kyc.model.e o0;
    private final String p;
    public in.swiggy.android.dash.web.kyc.model.e p0;
    private final String q;
    private String q0;
    private final String r;
    private com.swiggy.lynx.webinterface.b r0;
    private final String s;
    private final String t;
    private final String u;
    private final String v;
    private final String w;
    private final String x;
    private final String y;
    private final String z;

    public static final class a {
        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private a() {
        }
    }

    public f(Context context, String onSuccessFunction, String onFailureFunction, WebView webView, String documentType, SharedPreferences sharedPreference, in.swiggy.android.repositories.interfaces.d user) {
        HashMap<String, in.swiggy.android.dash.web.kyc.model.c> k;
        HashMap k2;
        Object fromJson;
        Object fromJson2;
        o.k(context, "context");
        o.k(onSuccessFunction, "onSuccessFunction");
        o.k(onFailureFunction, "onFailureFunction");
        o.k(documentType, "documentType");
        o.k(sharedPreference, "sharedPreference");
        o.k(user, "user");
        this.a = context;
        this.b = onSuccessFunction;
        this.c = onFailureFunction;
        this.d = webView;
        this.e = documentType;
        this.f = sharedPreference;
        this.g = user;
        this.h = "a9f31b";
        this.i = "3e8b9a0c3d507bb68c1a";
        this.j = "aadhar";
        this.k = "pan";
        this.l = "passport";
        this.m = "voter";
        this.n = "license";
        this.o = APIConstants.PAYMENT_API_RESULT;
        this.p = "live";
        this.q = "match";
        this.r = "liveness-score";
        this.s = "conf";
        this.t = "X-HV-Raw-Response";
        this.u = "X-HV-Response-Signature";
        this.v = "X-HV-Request-Id";
        this.w = "yes";
        this.x = AnalyticsAttribute.UUID_ATTRIBUTE;
        this.y = "transactionId";
        this.z = "referenceId";
        this.A = "https://ind-faceid.hyperverge.co/v1/photo/verifyPair";
        this.B = 1;
        this.C = 2;
        this.D = "Swiggy-Android";
        this.E = "HYPERVERGE";
        this.F = "swiggy_status_codes";
        this.G = "kyc_launch";
        this.H = "kyc_success";
        this.I = "kyc_failure";
        this.J = "kyc_null_required_fields";
        this.K = "document_type";
        this.L = "kyc_category";
        this.M = "error_code";
        this.N = PushMessageHelper.ERROR_MESSAGE;
        this.O = "conf_live";
        this.P = "conf_face_match";
        this.Q = "ocr";
        this.R = "face_match";
        this.S = "photo_capture";
        this.T = "document_capture";
        this.U = "initialisation";
        this.V = "null-raw-response";
        this.W = "null-signature";
        this.X = "null-request-id";
        this.Y = "errorPhotoNotLive";
        this.Z = "errorPhotoAndDocumentUnmatched";
        this.a0 = "errorCrashSdk";
        in.swiggy.android.dash.web.kyc.a aVar = in.swiggy.android.dash.web.kyc.a.a;
        k = j0.k(kotlin.o.a("aadhar", aVar.a()), kotlin.o.a("pan", aVar.f()), kotlin.o.a("passport", aVar.g()), kotlin.o.a("voter", aVar.h()), kotlin.o.a("license", aVar.b()));
        this.b0 = k;
        this.k0 = new HVDocConfig();
        this.l0 = new HVFaceConfig();
        String string = this.f.getString("kyc_values", "");
        if (string != null && string.length() != 0) {
            try {
                Gson g = i0.g();
                if (!(g instanceof Gson)) {
                    fromJson2 = g.fromJson(string, (Class<Object>) in.swiggy.android.dash.web.kyc.model.b.class);
                } else {
                    fromJson2 = GsonInstrumentation.fromJson(g, string, (Class<Object>) in.swiggy.android.dash.web.kyc.model.b.class);
                }
                this.m0 = (in.swiggy.android.dash.web.kyc.model.b) fromJson2;
            } catch (Throwable th) {
                x.e("KYCFlowHelper", th.getMessage());
            }
        }
        u();
        in.swiggy.android.dash.web.kyc.model.c cVar = this.b0.get(this.e);
        this.j0 = cVar == null ? in.swiggy.android.dash.web.kyc.a.a.f() : cVar;
        v();
        w();
        try {
            co.hyperverge.hypersnapsdk.a.v(this.a, this.h, this.i, HyperSnapParams$Region.India);
            String string2 = this.f.getString("hyperverge_config", "{\n        \"hyperverge_analytics_enable\":\"false\",\n        \"hyperverge_api_connect_timeout\": 120,\n        \"hyperverge_api_read_timeout\":120,\n        \"hyperverge_api_write_timeout\":120\n    }");
            Gson g2 = i0.g();
            if (!(g2 instanceof Gson)) {
                fromJson = g2.fromJson(string2, (Class<Object>) in.swiggy.android.dash.web.kyc.model.a.class);
            } else {
                fromJson = GsonInstrumentation.fromJson(g2, string2, (Class<Object>) in.swiggy.android.dash.web.kyc.model.a.class);
            }
            o.h(fromJson);
            in.swiggy.android.dash.web.kyc.model.a aVar2 = (in.swiggy.android.dash.web.kyc.model.a) fromJson;
            co.hyperverge.hypersnapsdk.a.A(Boolean.valueOf(!aVar2.a()));
            co.hyperverge.hypersnapsdk.a.z(aVar2.b(), aVar2.c(), aVar2.d());
            co.hyperverge.hypersnapsdk.a.B(true);
        } catch (Throwable th2) {
            x.e("KYCFlowHelper", th2.getMessage());
            p(h());
            String str = this.I;
            k2 = j0.k(kotlin.o.a(this.K, this.e), kotlin.o.a(this.L, this.U), kotlin.o.a(this.M, Integer.valueOf(h().a())), kotlin.o.a(this.N, h().b()));
            o(str, k2);
        }
    }

    public static final void A(f this$0, HVError hVError, co.hyperverge.hypersnapsdk.objects.c cVar) {
        double d;
        HashMap k;
        HashMap k2;
        o.k(this$0, "this$0");
        if (hVError != null) {
            int errorCode = hVError.getErrorCode();
            String errorMessage = hVError.getErrorMessage();
            o.j(errorMessage, "getErrorMessage(...)");
            this$0.p(new in.swiggy.android.dash.web.kyc.model.e(errorCode, errorMessage));
            String str = this$0.I;
            k2 = j0.k(kotlin.o.a(this$0.K, this$0.e), kotlin.o.a(this$0.L, this$0.S), kotlin.o.a(this$0.M, Integer.valueOf(hVError.getErrorCode())), kotlin.o.a(this$0.N, hVError.getErrorMessage()));
            this$0.o(str, k2);
        } else if (cVar.getApiResult().has(this$0.o)) {
            JSONObject jSONObject = cVar.getApiResult().getJSONObject(this$0.o);
            if (jSONObject.has(this$0.p) && o.f(jSONObject.getString(this$0.p), this$0.w)) {
                JSONObject apiHeaders = cVar.getApiHeaders();
                o.j(apiHeaders, "getApiHeaders(...)");
                this$0.i0 = this$0.k(apiHeaders, this$0.S);
                this$0.e0 = cVar.getImageURI();
                this$0.B(this$0.B);
                return;
            }
            if (jSONObject.has(this$0.r)) {
                d = jSONObject.getDouble(this$0.r);
            } else {
                d = 0.0d;
            }
            this$0.p(this$0.j());
            String str2 = this$0.I;
            k = j0.k(kotlin.o.a(this$0.K, this$0.e), kotlin.o.a(this$0.L, this$0.S), kotlin.o.a(this$0.M, Integer.valueOf(this$0.j().a())), kotlin.o.a(this$0.N, this$0.j().b()), kotlin.o.a(this$0.O, Double.valueOf(d)));
            this$0.o(str2, k);
        }
    }

    private final void B(final int i) {
        HashMap k;
        String str;
        try {
            JSONObject jSONObject = new JSONObject();
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put(this.x, m(this, false, 1, null));
            jSONObject2.put(this.y, m(this, false, 1, null));
            jSONObject2.put(this.z, m(this, false, 1, null));
            if (i == this.B) {
                str = this.c0;
            } else if (i == this.C) {
                str = this.d0;
            } else {
                str = this.c0;
            }
            co.hyperverge.hypersnapsdk.network.a.b(this.a, this.j0.b(), str, jSONObject, jSONObject2, new co.hyperverge.hypersnapsdk.listeners.a() {
                @Override
                public final void c(HVError hVError, co.hyperverge.hypersnapsdk.objects.c cVar) {
                    f.C(f.this, i, hVError, cVar);
                }
            });
        } catch (Throwable th) {
            x.e("KYCFlowHelper", th.getMessage());
            p(h());
            String str2 = this.I;
            k = j0.k(kotlin.o.a(this.K, this.e), kotlin.o.a(this.L, this.Q), kotlin.o.a(this.M, Integer.valueOf(h().a())), kotlin.o.a(this.N, h().b()));
            o(str2, k);
        }
    }

    public static final void C(f this$0, int i, HVError hVError, co.hyperverge.hypersnapsdk.objects.c cVar) {
        HashMap k;
        o.k(this$0, "this$0");
        if (hVError != null) {
            int errorCode = hVError.getErrorCode();
            String errorMessage = hVError.getErrorMessage();
            o.j(errorMessage, "getErrorMessage(...)");
            this$0.p(new in.swiggy.android.dash.web.kyc.model.e(errorCode, errorMessage));
            String str = this$0.I;
            k = j0.k(kotlin.o.a(this$0.K, this$0.e), kotlin.o.a(this$0.L, this$0.Q), kotlin.o.a(this$0.M, Integer.valueOf(hVError.getErrorCode())), kotlin.o.a(this$0.N, hVError.getErrorMessage()));
            this$0.o(str, k);
            return;
        }
        if (i == this$0.B) {
            JSONObject apiHeaders = cVar.getApiHeaders();
            o.j(apiHeaders, "getApiHeaders(...)");
            this$0.f0 = this$0.k(apiHeaders, this$0.Q);
        } else if (i == this$0.C) {
            JSONObject apiHeaders2 = cVar.getApiHeaders();
            o.j(apiHeaders2, "getApiHeaders(...)");
            this$0.g0 = this$0.k(apiHeaders2, this$0.Q);
        }
        int d = this$0.j0.d();
        if (d != 1) {
            if (d == 2) {
                if (i == this$0.B) {
                    this$0.B(this$0.C);
                    return;
                } else if (i == this$0.C) {
                    this$0.f();
                    return;
                } else {
                    return;
                }
            }
            return;
        }
        this$0.f();
    }

    private final String e(String str) {
        char[] cArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
        byte[] bytes = str.getBytes(kotlin.text.d.b);
        o.j(bytes, "getBytes(...)");
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
        messageDigest.update(bytes);
        byte[] digest = messageDigest.digest();
        char[] cArr2 = new char[digest.length << 1];
        int i = 0;
        for (byte b : digest) {
            int i2 = i + 1;
            cArr2[i] = cArr[(b & 240) >>> 4];
            i += 2;
            cArr2[i2] = cArr[b & 15];
        }
        return new String(cArr2);
    }

    private final void f() {
        HashMap k;
        try {
            JSONObject jSONObject = new JSONObject();
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put(this.x, m(this, false, 1, null));
            jSONObject2.put(this.y, m(this, false, 1, null));
            jSONObject2.put(this.z, m(this, false, 1, null));
            co.hyperverge.hypersnapsdk.network.a.a(this.a, this.A, this.e0, this.c0, jSONObject, jSONObject2, new co.hyperverge.hypersnapsdk.listeners.a() {
                @Override
                public final void c(HVError hVError, co.hyperverge.hypersnapsdk.objects.c cVar) {
                    f.g(f.this, hVError, cVar);
                }
            });
        } catch (Throwable th) {
            x.e("KYCFlowHelper", th.getMessage());
            p(h());
            String str = this.I;
            k = j0.k(kotlin.o.a(this.K, this.e), kotlin.o.a(this.L, this.R), kotlin.o.a(this.M, Integer.valueOf(h().a())), kotlin.o.a(this.N, h().b()));
            o(str, k);
        }
    }

    public static final void g(f this$0, HVError hVError, co.hyperverge.hypersnapsdk.objects.c cVar) {
        boolean z;
        int i;
        HashMap k;
        HashMap k2;
        HashMap k3;
        o.k(this$0, "this$0");
        if (hVError != null) {
            int errorCode = hVError.getErrorCode();
            String errorMessage = hVError.getErrorMessage();
            o.j(errorMessage, "getErrorMessage(...)");
            this$0.p(new in.swiggy.android.dash.web.kyc.model.e(errorCode, errorMessage));
            String str = this$0.I;
            k3 = j0.k(kotlin.o.a(this$0.K, this$0.e), kotlin.o.a(this$0.L, this$0.R), kotlin.o.a(this$0.M, Integer.valueOf(hVError.getErrorCode())), kotlin.o.a(this$0.N, hVError.getErrorMessage()));
            this$0.o(str, k3);
        } else if (cVar.getApiResult().has(this$0.o)) {
            JSONObject jSONObject = cVar.getApiResult().getJSONObject(this$0.o);
            if (jSONObject.has(this$0.q)) {
                z = o.f(jSONObject.getString(this$0.q), this$0.w);
            } else {
                z = false;
            }
            if (jSONObject.has(this$0.s)) {
                i = jSONObject.getInt(this$0.s);
            } else {
                i = 0;
            }
            if (z) {
                JSONObject apiHeaders = cVar.getApiHeaders();
                o.j(apiHeaders, "getApiHeaders(...)");
                this$0.h0 = this$0.k(apiHeaders, this$0.R);
                this$0.q(new g(this$0.f0, this$0.g0, this$0.h0, this$0.i0, new i(this$0.E, m(this$0, false, 1, null))));
                String str2 = this$0.H;
                k2 = j0.k(kotlin.o.a(this$0.K, this$0.e), kotlin.o.a(this$0.L, this$0.R), kotlin.o.a(this$0.P, Integer.valueOf(i)));
                this$0.o(str2, k2);
                return;
            }
            this$0.p(this$0.i());
            String str3 = this$0.I;
            k = j0.k(kotlin.o.a(this$0.K, this$0.e), kotlin.o.a(this$0.L, this$0.R), kotlin.o.a(this$0.M, Integer.valueOf(this$0.i().a())), kotlin.o.a(this$0.N, this$0.i().b()), kotlin.o.a(this$0.P, Integer.valueOf(i)));
            this$0.o(str3, k);
        }
    }

    private final h k(JSONObject jSONObject, String str) {
        String str2;
        String str3;
        String str4;
        String str5;
        HashMap k;
        try {
            if (jSONObject.has(this.t)) {
                str3 = jSONObject.getString(this.t);
                str2 = null;
            } else {
                str2 = this.V;
                str3 = null;
            }
            if (jSONObject.has(this.u)) {
                str4 = jSONObject.getString(this.u);
            } else {
                str2 = this.W;
                str4 = null;
            }
            if (jSONObject.has(this.v)) {
                str5 = jSONObject.getString(this.v);
            } else {
                str2 = this.X;
                str5 = null;
            }
            if (str3 != null && str4 != null && str5 != null) {
                return new h(str3, str4, str5);
            }
            String str6 = this.J;
            k = j0.k(kotlin.o.a(this.K, this.e), kotlin.o.a(this.L, str), kotlin.o.a(this.N, str2));
            o(str6, k);
            return null;
        } catch (JSONException e) {
            x.e("KYCFlowHelper", e.getMessage());
            return null;
        }
    }

    private final String l(boolean z) {
        String str = this.g.getCustomerId() + Constants.WAVE_SEPARATOR + this.D;
        if (z) {
            return e(str);
        }
        return str;
    }

    static String m(f fVar, boolean z, int i, Object obj) {
        if ((i & 1) != 0) {
            z = true;
        }
        return fVar.l(z);
    }

    private final void n(String str, Map<String, ? extends Object> map) {
        List list;
        Set<String> Y0;
        Set<String> stringSet = this.f.getStringSet("liquor_kyc_logging", new LinkedHashSet());
        String str2 = str + " -";
        if (map != null) {
            for (Map.Entry<String, ? extends Object> entry : map.entrySet()) {
                String key = entry.getKey();
                str2 = ((Object) str2) + " " + ((Object) key) + " : " + entry.getValue() + " \n\n";
            }
        }
        if (stringSet != null) {
            list = CollectionsKt___CollectionsKt.W0(stringSet);
        } else {
            list = null;
        }
        if (list != null) {
            list.add(str2);
            SharedPreferences.Editor edit = this.f.edit();
            Y0 = CollectionsKt___CollectionsKt.Y0(list);
            edit.putStringSet("liquor_kyc_logging", Y0).commit();
        }
    }

    private final void o(String str, Map<String, ? extends Object> map) {
        try {
            if (in.swiggy.android.analytics.newrelic.d.a.b()) {
                NewRelic.recordCustomEvent(this.F, str, map);
            }
            if (str.equals(this.I)) {
                n(str, map);
            }
        } catch (Throwable th) {
            x.e("KYCFlowHelper", th.getMessage());
        }
    }

    private final void p(in.swiggy.android.dash.web.kyc.model.e eVar) {
        String json;
        com.swiggy.lynx.webinterface.b bVar;
        Gson g = i0.g();
        if (!(g instanceof Gson)) {
            json = g.toJson(eVar);
        } else {
            json = GsonInstrumentation.toJson(g, eVar);
        }
        String str = json;
        WebView webView = this.d;
        if (webView != null) {
            String str2 = this.c;
            webView.evaluateJavascript("javascript: " + str2 + "(" + str + ")", null);
        }
        String str3 = this.q0;
        if (str3 != null && (bVar = this.r0) != null) {
            KSerializer<String> I = kotlinx.serialization.builtins.a.I(v.a);
            o.h(str);
            bVar.c(str3, 1, null, str, I);
        }
    }

    private final void q(g gVar) {
        String json;
        com.swiggy.lynx.webinterface.b bVar;
        Gson g = i0.g();
        if (!(g instanceof Gson)) {
            json = g.toJson(gVar);
        } else {
            json = GsonInstrumentation.toJson(g, gVar);
        }
        String str = json;
        WebView webView = this.d;
        if (webView != null) {
            String str2 = this.b;
            webView.evaluateJavascript("javascript: " + str2 + "(" + str + ")", null);
        }
        String str3 = this.q0;
        if (str3 != null && (bVar = this.r0) != null) {
            o.h(str);
            b.a.a(bVar, str3, 0, null, str, kotlinx.serialization.builtins.a.I(v.a), 2, null);
        }
    }

    private final void u() {
        ArrayList<in.swiggy.android.dash.web.kyc.model.f> arrayList;
        in.swiggy.android.dash.web.kyc.model.e e;
        in.swiggy.android.dash.web.kyc.model.e d;
        in.swiggy.android.dash.web.kyc.model.e c;
        ArrayList<in.swiggy.android.dash.web.kyc.model.d> a2;
        ArrayList<in.swiggy.android.dash.web.kyc.model.d> a3;
        Object obj;
        Object obj2;
        in.swiggy.android.dash.web.kyc.model.b bVar = this.m0;
        Object obj3 = null;
        if (bVar != null) {
            arrayList = bVar.b();
        } else {
            arrayList = null;
        }
        if (arrayList != null) {
            Iterator<T> it = arrayList.iterator();
            while (true) {
                if (it.hasNext()) {
                    obj2 = it.next();
                    if (o.f(((in.swiggy.android.dash.web.kyc.model.f) obj2).b(), this.Y)) {
                        break;
                    }
                } else {
                    obj2 = null;
                    break;
                }
            }
            in.swiggy.android.dash.web.kyc.model.f fVar = (in.swiggy.android.dash.web.kyc.model.f) obj2;
            if (fVar != null) {
                e = fVar.a();
            }
        }
        e = in.swiggy.android.dash.web.kyc.a.a.e();
        t(e);
        if (arrayList != null) {
            Iterator<T> it2 = arrayList.iterator();
            while (true) {
                if (it2.hasNext()) {
                    obj = it2.next();
                    if (o.f(((in.swiggy.android.dash.web.kyc.model.f) obj).b(), this.Z)) {
                        break;
                    }
                } else {
                    obj = null;
                    break;
                }
            }
            in.swiggy.android.dash.web.kyc.model.f fVar2 = (in.swiggy.android.dash.web.kyc.model.f) obj;
            if (fVar2 != null) {
                d = fVar2.a();
            }
        }
        d = in.swiggy.android.dash.web.kyc.a.a.d();
        s(d);
        if (arrayList != null) {
            Iterator<T> it3 = arrayList.iterator();
            while (true) {
                if (!it3.hasNext()) {
                    break;
                }
                Object next = it3.next();
                if (o.f(((in.swiggy.android.dash.web.kyc.model.f) next).b(), this.a0)) {
                    obj3 = next;
                    break;
                }
            }
            in.swiggy.android.dash.web.kyc.model.f fVar3 = (in.swiggy.android.dash.web.kyc.model.f) obj3;
            if (fVar3 != null) {
                c = fVar3.a();
            }
        }
        c = in.swiggy.android.dash.web.kyc.a.a.c();
        r(c);
        in.swiggy.android.dash.web.kyc.model.b bVar2 = this.m0;
        if (bVar2 != null && (a2 = bVar2.a()) != null && a2.size() > 0) {
            this.b0.clear();
            in.swiggy.android.dash.web.kyc.model.b bVar3 = this.m0;
            if (bVar3 != null && (a3 = bVar3.a()) != null) {
                for (in.swiggy.android.dash.web.kyc.model.d dVar : a3) {
                    this.b0.put(dVar.b(), dVar.a());
                }
            }
        }
    }

    private final void v() {
        this.k0.setShouldShowFlashIcon(false);
        this.k0.setShouldShowReviewScreen(true);
        this.k0.setShowTrustLogos(true);
        this.k0.setShouldShowCloseAlert(true);
        HVDocConfig hVDocConfig = this.k0;
        Resources resources = this.a.getResources();
        int i = l.step_2_of_3;
        hVDocConfig.setDocCaptureSubtitle(resources.getString(i));
        this.k0.setDocCaptureTitle(this.a.getResources().getString(l.document_capture_title, this.j0.a()));
        HVDocConfig hVDocConfig2 = this.k0;
        int i2 = in.swiggy.android.commonsui.ui.i.proxima_nova_bold;
        hVDocConfig2.setTitleTypeFace(i2);
        HVDocConfig hVDocConfig3 = this.k0;
        int i3 = in.swiggy.android.commonsui.ui.i.proxima_nova_medium;
        hVDocConfig3.setDescTypeFace(i3);
        this.k0.setReviewScreenTitleTypeface(i2);
        this.k0.setDocReviewTitle(this.a.getResources().getString(l.docReviewTitle, this.j0.a()));
        this.k0.setDocReviewSubtitle(this.a.getResources().getString(i));
        this.k0.setReviewScreenDescTypeface(i3);
        this.k0.setReviewScreenRetakeButtonTypeface(i2);
        this.k0.setReviewScreenConfirmButtonTypeface(i2);
        HVDocConfig.Document document = HVDocConfig.Document.OTHER;
        document.setAspectRatio(this.j0.c());
        this.k0.setDocumentType(document);
    }

    private final void w() {
        this.l0.setTitleTypeface(in.swiggy.android.commonsui.ui.i.proxima_nova_bold);
        this.l0.setStatusTypeFace(in.swiggy.android.commonsui.ui.i.proxima_nova_medium);
        this.l0.setFaceCaptureSubtitle(this.a.getResources().getString(l.step_3_of_3));
        this.l0.setShowTrustLogos(true);
        this.l0.setShouldShowCloseAlert(true);
    }

    private final void x(int i) {
        HashMap k;
        try {
            if (i == this.B) {
                this.k0.setShouldShowInstructionPage(false);
                if (this.j0.d() == 1) {
                    this.k0.setDocCaptureSubText(" ");
                } else {
                    this.k0.setDocCaptureSubText(this.a.getResources().getString(l.document_hint_front));
                }
            } else if (i == this.C) {
                this.k0.setShouldShowInstructionPage(false);
                this.k0.setDocCaptureSubText(this.a.getResources().getString(l.document_hint_back));
            }
            HVDocsActivity.c3(this.a, this.k0, new b(this, i));
        } catch (Throwable th) {
            x.e("KYCFlowHelper", th.getMessage());
            p(h());
            String str = this.I;
            k = j0.k(kotlin.o.a(this.K, this.e), kotlin.o.a(this.L, this.T), kotlin.o.a(this.M, Integer.valueOf(h().a())), kotlin.o.a(this.N, h().b()));
            o(str, k);
        }
    }

    public static final void y(f this$0, int i, HVError hVError, co.hyperverge.hypersnapsdk.objects.c cVar) {
        HashMap k;
        o.k(this$0, "this$0");
        if (hVError != null) {
            int errorCode = hVError.getErrorCode();
            String errorMessage = hVError.getErrorMessage();
            o.j(errorMessage, "getErrorMessage(...)");
            this$0.p(new in.swiggy.android.dash.web.kyc.model.e(errorCode, errorMessage));
            String str = this$0.I;
            k = j0.k(kotlin.o.a(this$0.K, this$0.e), kotlin.o.a(this$0.L, this$0.T), kotlin.o.a(this$0.M, Integer.valueOf(hVError.getErrorCode())), kotlin.o.a(this$0.N, hVError.getErrorMessage()));
            this$0.o(str, k);
            return;
        }
        if (i == this$0.B) {
            this$0.c0 = cVar.getImageURI();
        } else if (i == this$0.C) {
            this$0.d0 = cVar.getImageURI();
        }
        int d = this$0.j0.d();
        if (d != 1) {
            if (d == 2) {
                if (i == this$0.B) {
                    this$0.x(this$0.C);
                    return;
                } else if (i == this$0.C) {
                    this$0.z();
                    return;
                } else {
                    return;
                }
            }
            return;
        }
        this$0.z();
    }

    private final void z() {
        HashMap k;
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put(this.x, m(this, false, 1, null));
            jSONObject.put(this.y, m(this, false, 1, null));
            jSONObject.put(this.z, m(this, false, 1, null));
            this.l0.setLivenessAPIHeaders(jSONObject);
            HVFaceActivity.L1(this.a, this.l0, new c(this));
        } catch (Throwable th) {
            x.e("KYCFlowHelper", th.getMessage());
            p(h());
            String str = this.I;
            k = j0.k(kotlin.o.a(this.K, this.e), kotlin.o.a(this.L, this.S), kotlin.o.a(this.M, Integer.valueOf(h().a())), kotlin.o.a(this.N, h().b()));
            o(str, k);
        }
    }

    public final void D() {
        HashMap k;
        String str = this.G;
        k = j0.k(kotlin.o.a(this.K, this.e));
        o(str, k);
        x(this.B);
    }

    public final void E(String str, com.swiggy.lynx.webinterface.b bVar) {
        this.q0 = str;
        this.r0 = bVar;
        D();
    }

    public final in.swiggy.android.dash.web.kyc.model.e h() {
        in.swiggy.android.dash.web.kyc.model.e eVar = this.p0;
        if (eVar != null) {
            return eVar;
        }
        o.C("errorCrashSdk");
        return null;
    }

    public final in.swiggy.android.dash.web.kyc.model.e i() {
        in.swiggy.android.dash.web.kyc.model.e eVar = this.o0;
        if (eVar != null) {
            return eVar;
        }
        o.C("errorPhotoAndDocumentUnmatched");
        return null;
    }

    public final in.swiggy.android.dash.web.kyc.model.e j() {
        in.swiggy.android.dash.web.kyc.model.e eVar = this.n0;
        if (eVar != null) {
            return eVar;
        }
        o.C("errorPhotoNotLive");
        return null;
    }

    public final void r(in.swiggy.android.dash.web.kyc.model.e eVar) {
        o.k(eVar, "<set-?>");
        this.p0 = eVar;
    }

    public final void s(in.swiggy.android.dash.web.kyc.model.e eVar) {
        o.k(eVar, "<set-?>");
        this.o0 = eVar;
    }

    public final void t(in.swiggy.android.dash.web.kyc.model.e eVar) {
        o.k(eVar, "<set-?>");
        this.n0 = eVar;
    }
}