Picsart v24.6版本的 MD5 值为:21a61631d94e54da68d2ad9268b8b9d9

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


package myobfuscated.vi2;

import android.net.Uri;
import com.amazon.device.ads.DtbConstants;
import com.applovin.exoplayer2.common.base.Ascii;
import com.fyber.inneractive.sdk.external.InneractiveMediationDefs;
import com.vk.api.sdk.VKApiManager;
import com.vk.api.sdk.exceptions.VKApiException;
import com.vk.api.sdk.exceptions.VKApiExecutionException;
import com.vk.api.sdk.exceptions.VKApiIllegalResponseException;
import com.vk.api.sdk.exceptions.VKInternalServerErrorException;
import com.vk.api.sdk.exceptions.VKLargeEntityException;
import com.vk.api.sdk.internal.QueryStringGenerator;
import com.vk.api.sdk.okhttp.OkHttpExecutor;
import com.vk.api.sdk.utils.VKUtils;
import com.vungle.ads.internal.presenter.MRAIDPresenter;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Pattern;
import kotlin.jvm.internal.Intrinsics;
import myobfuscated.mn2.k;
import myobfuscated.yi2.f;
import okhttp3.i;
import okhttp3.k;
import okhttp3.n;
import okhttp3.o;
import okhttp3.p;
import okhttp3.q;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class e<T> extends b<T> {
    @NotNull
    public final OkHttpExecutor b;
    @NotNull
    public final f.a c;
    @NotNull
    public final String d;
    @NotNull
    public final String e;
    public final myobfuscated.ti2.b<T> f;
    public final myobfuscated.ik2.h<myobfuscated.ti2.c> g;

    public e(@NotNull VKApiManager manager, @NotNull OkHttpExecutor okHttpExecutor, @NotNull f.a callBuilder, @NotNull String defaultDeviceId, @NotNull String defaultLang, myobfuscated.ti2.b<T> bVar) {
        super(manager);
        Intrinsics.checkNotNullParameter(manager, "manager");
        Intrinsics.checkNotNullParameter(okHttpExecutor, "okHttpExecutor");
        Intrinsics.checkNotNullParameter(callBuilder, "callBuilder");
        Intrinsics.checkNotNullParameter(defaultDeviceId, "defaultDeviceId");
        Intrinsics.checkNotNullParameter(defaultLang, "defaultLang");
        this.b = okHttpExecutor;
        this.c = callBuilder;
        this.d = defaultDeviceId;
        this.e = defaultLang;
        this.f = bVar;
        this.g = manager.a.w;
    }

    @Override
    public final T a(@NotNull a args) throws Exception {
        String encodedQuery;
        String paramsString;
        InputStream byteStream;
        T t;
        JSONObject response;
        VKApiException vKApiIllegalResponseException;
        VKApiException vKApiException;
        int code;
        myobfuscated.ti2.c value;
        List<String> queryParameters;
        String str;
        Intrinsics.checkNotNullParameter(args, "args");
        if (args.a.length() > 0 && args.b.length() > 0) {
            f.a aVar = this.c;
            aVar.a("captcha_sid", args.a);
            aVar.a("captcha_key", args.b);
        }
        if (args.c) {
            this.c.a("confirm", "1");
        }
        f.a aVar2 = this.c;
        aVar2.getClass();
        Intrinsics.checkNotNullParameter("device_id", "key");
        String str2 = (String) aVar2.d.get("device_id");
        if (str2 == null) {
            str2 = "";
        }
        if (k.o(str2)) {
            str2 = this.d;
        }
        f.a aVar3 = this.c;
        Locale locale = Locale.getDefault();
        Intrinsics.checkNotNullExpressionValue(locale, "getDefault()");
        String lowerCase = str2.toLowerCase(locale);
        Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(locale)");
        aVar3.a("device_id", lowerCase);
        f.a aVar4 = this.c;
        aVar4.getClass();
        Intrinsics.checkNotNullParameter("lang", "key");
        String str3 = (String) aVar4.d.get("lang");
        if (str3 == null) {
            str3 = "";
        }
        if (k.o(str3)) {
            str3 = this.e;
        }
        f.a aVar5 = this.c;
        Locale locale2 = Locale.getDefault();
        Intrinsics.checkNotNullExpressionValue(locale2, "getDefault()");
        String lowerCase2 = str3.toLowerCase(locale2);
        Intrinsics.checkNotNullExpressionValue(lowerCase2, "this as java.lang.String).toLowerCase(locale)");
        aVar5.a("lang", lowerCase2);
        f.a aVar6 = this.c;
        aVar6.getClass();
        myobfuscated.yi2.f call = new myobfuscated.yi2.f(aVar6);
        Intrinsics.checkNotNullParameter(call, "mc");
        OkHttpExecutor okHttpExecutor = this.b;
        okHttpExecutor.getClass();
        Intrinsics.checkNotNullParameter(call, "call");
        Intrinsics.checkNotNullParameter(call, "call");
        String str4 = okHttpExecutor.c.getValue().a;
        Intrinsics.checkNotNullParameter(call.b, "method");
        Intrinsics.checkNotNullParameter(call, "call");
        String str5 = okHttpExecutor.c.getValue().b;
        Intrinsics.checkNotNullParameter(call, "call");
        QueryStringGenerator queryStringGenerator = QueryStringGenerator.a;
        String methodName = call.b;
        HashMap args2 = call.d;
        String version = call.c;
        int i = okHttpExecutor.a.a.b;
        queryStringGenerator.getClass();
        Intrinsics.checkNotNullParameter(methodName, "methodName");
        Intrinsics.checkNotNullParameter(args2, "methodArgs");
        Intrinsics.checkNotNullParameter(version, "methodVersion");
        String path = Intrinsics.l(methodName, "/method/");
        Map arrayArgs = kotlin.collections.d.f();
        Intrinsics.checkNotNullParameter(path, "path");
        Intrinsics.checkNotNullParameter(args2, "args");
        Intrinsics.checkNotNullParameter(version, "version");
        Intrinsics.checkNotNullParameter(arrayArgs, "arrayArgs");
        LinkedHashMap args3 = kotlin.collections.d.q(args2);
        args3.put("v", version);
        args3.put("https", "1");
        if (str4 != null && str4.length() != 0) {
            args3.put("access_token", str4);
        } else if (i != 0) {
            args3.put("api_id", String.valueOf(i));
        }
        Intrinsics.checkNotNullParameter(path, "path");
        Intrinsics.checkNotNullParameter(args3, "args");
        Intrinsics.checkNotNullParameter(arrayArgs, "arrayArgs");
        Uri.Builder builder = new Uri.Builder();
        for (Map.Entry entry : args3.entrySet()) {
            if (!Intrinsics.c(entry.getKey(), "sig")) {
                builder.appendQueryParameter((String) entry.getKey(), (String) entry.getValue());
            }
        }
        for (Map.Entry entry2 : arrayArgs.entrySet()) {
            String str6 = (String) entry2.getKey();
            for (String str7 : (List) entry2.getValue()) {
                builder.appendQueryParameter(Intrinsics.l("[]", str6), str7);
            }
        }
        Uri build = builder.build();
        int i2 = 0;
        if (str5 == null || str5.length() == 0) {
            encodedQuery = build.getEncodedQuery();
        } else {
            String query = build.getQuery();
            queryStringGenerator.a().setLength(0);
            StringBuilder a = queryStringGenerator.a();
            a.append(path);
            a.append('?');
            if (query != null && !k.o(query)) {
                queryStringGenerator.a().append(query);
            }
            queryStringGenerator.a().append(str5);
            String h = queryStringGenerator.a().toString();
            Intrinsics.checkNotNullExpressionValue(h, "strBuilder.toString()");
            VKUtils.MD5 md5 = VKUtils.MD5.a;
            Intrinsics.checkNotNullParameter(h, "h");
            try {
                MessageDigest messageDigest = MessageDigest.getInstance("MD5");
                Charset forName = Charset.forName("UTF-8");
                Intrinsics.checkNotNullExpressionValue(forName, "forName(charsetName)");
                byte[] bytes = h.getBytes(forName);
                Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
                byte[] md52 = messageDigest.digest(bytes);
                md5.a().setLength(0);
                Intrinsics.checkNotNullExpressionValue(md52, "md5");
                int length = md52.length;
                int i3 = 0;
                while (i3 < length) {
                    byte b = md52[i3];
                    i3++;
                    StringBuilder a2 = md5.a();
                    char[] cArr = VKUtils.MD5.c;
                    a2.append(cArr[(b & 240) >> 4]);
                    md5.a().append(cArr[b & Ascii.SI]);
                }
                str = md5.a().toString();
                Intrinsics.checkNotNullExpressionValue(str, "tmpBuilder.toString()");
            } catch (Exception unused) {
                str = "";
            }
            encodedQuery = build.buildUpon().appendQueryParameter("sig", str).build().getEncodedQuery();
        }
        o.a aVar7 = o.Companion;
        Intrinsics.checkNotNullParameter(call, "call");
        Intrinsics.checkNotNullParameter(paramsString, "paramsString");
        if (k.v(call.b, "execute.", false)) {
            Uri parse = Uri.parse("https://vk.com/?".concat(paramsString));
            if (parse.getQueryParameters("method").contains("execute") && (queryParameters = parse.getQueryParameters("code")) != null && !queryParameters.isEmpty()) {
                throw new VKApiExecutionException(15, call.b, false, "Hey dude don't execute your hacky code ;)", null, null, null, null, 0, 496, null);
            }
        }
        Pattern pattern = i.d;
        i b2 = i.a.b("application/x-www-form-urlencoded; charset=utf-8");
        aVar7.getClass();
        n b3 = o.a.b(paramsString, b2);
        String str8 = call.a;
        if (str8 == null) {
            str8 = okHttpExecutor.a.a.o.invoke();
        }
        k.a aVar8 = new k.a();
        aVar8.g(b3);
        StringBuilder sb = new StringBuilder();
        String str9 = okHttpExecutor.d;
        if (str9.length() == 0 || Intrinsics.c(str9, "https://vk.com/method")) {
            str9 = myobfuscated.b0.b.s(DtbConstants.HTTPS, str8, "/method");
        }
        sb.append(str9);
        sb.append('/');
        sb.append(call.b);
        aVar8.j(sb.toString());
        aVar8.c(okhttp3.c.n);
        aVar8.i(Map.class, null);
        okhttp3.k request = aVar8.b();
        String str10 = okHttpExecutor.c.getValue().a;
        Intrinsics.checkNotNullParameter(request, "request");
        p response2 = ((myobfuscated.ti2.h) okHttpExecutor.b.getValue()).a().a(request).execute();
        Intrinsics.checkNotNullParameter(response2, "response");
        int i4 = response2.d;
        if (i4 != 413) {
            q qVar = response2.g;
            if (500 <= i4 && i4 < 600) {
                String str11 = "null";
                if (qVar != null) {
                    try {
                        String string = qVar.string();
                        myobfuscated.sr.e.s(qVar, null);
                        if (string != null) {
                            str11 = string;
                        }
                    } catch (Throwable th) {
                        try {
                            throw th;
                        } catch (Throwable th2) {
                            myobfuscated.sr.e.s(qVar, th);
                            throw th2;
                        }
                    }
                }
                throw new VKInternalServerErrorException(i4, str11);
            }
            if (qVar == null || (byteStream = qVar.byteStream()) == null) {
                response = null;
            } else {
                myobfuscated.aj2.c cVar = (myobfuscated.aj2.c) okHttpExecutor.a.a.y.getValue();
                String a3 = response2.f.a("content-type");
                String b4 = response2.a.a.b();
                cVar.getClass();
                if (a3 != null) {
                    try {
                        Iterator<T> it = cVar.a.iterator();
                        while (true) {
                            if (!it.hasNext()) {
                                t = null;
                                break;
                            }
                            t = it.next();
                            if (((myobfuscated.aj2.b) t).a(a3)) {
                                break;
                            }
                        }
                        myobfuscated.aj2.b bVar = (myobfuscated.aj2.b) t;
                        if (bVar != null) {
                            response = bVar.b(byteStream);
                            if (response == null) {
                                response = new JSONObject();
                                response.put("root_response", myobfuscated.ul.n.S(byteStream));
                            }
                        }
                    } catch (JSONException e) {
                        throw new VKApiExecutionException(-2, b4 == null ? "no_path" : b4, true, "[" + ((Object) b4) + "] " + ((Object) e.getLocalizedMessage()), null, null, null, null, 0, 496, null);
                    }
                }
                response = null;
                if (response == null) {
                }
            }
            OkHttpExecutor.a methodResponse = new OkHttpExecutor.a(response, response2.f, str10);
            String method = call.b;
            HashMap hashMap = call.d;
            if (!Intrinsics.c(hashMap.get("extended"), InneractiveMediationDefs.SHOW_HOUSE_AD_YES)) {
                Intrinsics.c(hashMap.get("extended"), "1");
            }
            Intrinsics.checkNotNullParameter(methodResponse, "methodResponse");
            Intrinsics.checkNotNullParameter(method, "methodName");
            if (response != null) {
                Intrinsics.checkNotNullParameter(response, "<this>");
                Intrinsics.checkNotNullParameter(response, "response");
                if (response.has(MRAIDPresenter.ERROR)) {
                    Intrinsics.checkNotNullParameter(response, "<this>");
                    JSONObject optJSONObject = response.optJSONObject(MRAIDPresenter.ERROR);
                    if (optJSONObject == null) {
                        optJSONObject = response;
                    }
                    vKApiException = myobfuscated.xi2.b.a(optJSONObject, method, str10);
                } else {
                    Intrinsics.checkNotNullParameter(response, "<this>");
                    Intrinsics.checkNotNullParameter(response, "response");
                    if (response.has("execute_errors")) {
                        Intrinsics.checkNotNullParameter(response, "<this>");
                        Intrinsics.checkNotNullParameter(method, "method");
                        Intrinsics.checkNotNullParameter(response, "response");
                        Intrinsics.checkNotNullParameter(method, "method");
                        JSONArray jSONArray = response.getJSONArray("execute_errors");
                        Intrinsics.checkNotNullExpressionValue(jSONArray, "response.getJSONArray(VK…des.PARAM_EXECUTE_ERRORS)");
                        try {
                            ArrayList arrayList = new ArrayList();
                            int length2 = jSONArray.length();
                            while (true) {
                                if (i2 >= length2) {
                                    break;
                                }
                                int i5 = i2 + 1;
                                JSONObject jSONObject = jSONArray.getJSONObject(i2);
                                Intrinsics.checkNotNullExpressionValue(jSONObject, "errorsJson.getJSONObject(i)");
                                vKApiIllegalResponseException = myobfuscated.xi2.b.a(jSONObject, null, null);
                                if (!(vKApiIllegalResponseException instanceof VKApiExecutionException) || (code = ((VKApiExecutionException) vKApiIllegalResponseException).getCode()) == 1 || code == 14 || code == 17 || code == 4 || code == 5 || code == 6 || code == 9 || code == 10 || code == 24 || code == 25) {
                                    break;
                                }
                                arrayList.add(vKApiIllegalResponseException);
                                i2 = i5;
                            }
                        } catch (JSONException e2) {
                            vKApiIllegalResponseException = new VKApiIllegalResponseException(e2);
                        }
                        vKApiException = vKApiIllegalResponseException;
                    } else {
                        vKApiException = null;
                    }
                }
                if (vKApiException == null) {
                    try {
                        myobfuscated.ik2.h<myobfuscated.ti2.c> hVar = this.g;
                        if (hVar != null && (value = hVar.getValue()) != null) {
                            Intrinsics.checkNotNullExpressionValue(response.toString(), "jsonBody.toString()");
                            value.a();
                        }
                    } catch (Throwable unused2) {
                    }
                    myobfuscated.ti2.b<T> bVar2 = this.f;
                    if (bVar2 == null) {
                        return null;
                    }
                    return bVar2.a(response);
                }
                throw vKApiException;
            }
            throw new VKApiException("Response returned null instead of valid string response");
        }
        throw new VKLargeEntityException(response2.c);
    }
}