LINE.apk(点击下载) / a.java


package c00;

import com.android.billingclient.api.i0;
import com.google.android.play.core.assetpacks.k0;
import dm3.p;
import em3.q;
import java.io.File;
import java.io.IOException;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import sm3.n;
import ul3.d;
import um3.h0;
import um3.r;
import um3.s;
import wl3.e;
import wl3.i;

@e(c = "com.linecorp.line.avatar.v2.face.AvatarSuggestionApiCaller$call$2", f = "AvatarSuggestionApiCaller.kt", l = {113}, m = "invokeSuspend")
public final class a extends i implements p<h0, d<? super Response>, Object> {

    /* renamed from: b  reason: collision with root package name */
    public int f15947b;

    /* renamed from: c  reason: collision with root package name */
    public final /* synthetic */ String f15948c;

    /* renamed from: d  reason: collision with root package name */
    public final /* synthetic */ File f15949d;

    /* renamed from: e  reason: collision with root package name */
    public final /* synthetic */ boolean f15950e;

    /* renamed from: f  reason: collision with root package name */
    public final /* synthetic */ String f15951f;

    /* renamed from: g  reason: collision with root package name */
    public final /* synthetic */ String f15952g;

    /* renamed from: c00.a$a  reason: collision with other inner class name */
    public static final class C0302a implements Callback {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ r<Result<Response>> f15953b;

        public C0302a(r<Result<Response>> rVar) {
            this.f15953b = rVar;
        }

        @Override // okhttp3.Callback
        public void onFailure(Call call, IOException iOException) {
            q.f(call, "call");
            q.f(iOException, "e");
            q.f("app<--suggestion: onFailure: e:" + iOException, "msg");
            r<Result<Response>> rVar = this.f15953b;
            Result.Companion companion = Result.Companion;
            rVar.l(Result.m363boximpl(Result.m364constructorimpl(ResultKt.createFailure(iOException))));
        }

        @Override // okhttp3.Callback
        public void onResponse(Call call, Response response) {
            q.f(call, "call");
            q.f(response, "response");
            q.f("app<--suggestion: onResponse: response:" + response.code(), "msg");
            r<Result<Response>> rVar = this.f15953b;
            Result.Companion companion = Result.Companion;
            rVar.l(Result.m363boximpl(Result.m364constructorimpl(response)));
        }
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public a(String str, File file, boolean z14, String str2, String str3, d<? super a> dVar) {
        super(2, dVar);
        this.f15948c = str;
        this.f15949d = file;
        this.f15950e = z14;
        this.f15951f = str2;
        this.f15952g = str3;
    }

    @Override // wl3.a
    public final d<Unit> create(Object obj, d<?> dVar) {
        return new a(this.f15948c, this.f15949d, this.f15950e, this.f15951f, this.f15952g, dVar);
    }

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
    @Override // dm3.p
    public Object invoke(h0 h0Var, d<? super Response> dVar) {
        return new a(this.f15948c, this.f15949d, this.f15950e, this.f15951f, this.f15952g, dVar).invokeSuspend(Unit.INSTANCE);
    }

    @Override // wl3.a
    public final Object invokeSuspend(Object obj) {
        Request request;
        vl3.a aVar = vl3.a.COROUTINE_SUSPENDED;
        int i14 = this.f15947b;
        Response response = null;
        if (i14 == 0) {
            ResultKt.throwOnFailure(obj);
            OkHttpClient okHttpClient = new OkHttpClient();
            MultipartBody.Builder builder = new MultipartBody.Builder(null, 1, null);
            MediaType mediaType = MultipartBody.FORM;
            MultipartBody.Builder type = builder.setType(mediaType);
            StringBuilder a14 = b.d.a("\n                    {\n                        \"faceAvatar\":\n                        {\n                            \"params\":\n                            {\n                                \"predict_type\":\"face_avatar\",\n                                \"major_version\":\"1\",\n                                \"country_code\":\"");
            a14.append(this.f15948c);
            a14.append("\"\n                            },\n                            \"contexts\":\n                            {\n                                \"nation\": \"");
            a14.append(this.f15948c);
            a14.append("\"\n                            }\n                        }\n                    }\n                ");
            MultipartBody build = type.addFormDataPart("filters", n.e(a14.toString())).addFormDataPart("input", "image.jpg", RequestBody.Companion.create(this.f15949d, mediaType)).addFormDataPart("useAsTrainingData", String.valueOf(this.f15950e)).build();
            if (!sm3.r.u(this.f15951f)) {
                request = new Request.Builder().url(this.f15951f).addHeader("x-recognition-input-type", "binary").addHeader("Content-Type", "multipart/form-data").addHeader("X-Line-ChannelToken", this.f15952g).addHeader("x-obs-params", k0.d("{\"ver\":\"2.0\",\"type\":\"image\",\"name\":\"image.jpg\"}", "UTF-8")).tag("AvatarSuggestionApiCaller").post(build).build();
            } else {
                request = new Request.Builder().url("http://obs-beta-internal.line-apps.com:10080/px/playground/_u/test/recognition.obs").addHeader("x-recognition-input-type", "binary").addHeader("Content-Type", "multipart/form-data").tag("AvatarSuggestionApiCaller").post(build).build();
            }
            r a15 = i0.a(null, 1);
            StringBuilder a16 = b.d.a("app->suggestion: request(regionCode:");
            a16.append(this.f15948c);
            a16.append(", mlAgreement:");
            a16.append(this.f15950e);
            a16.append(')');
            q.f(a16.toString(), "msg");
            okHttpClient.newCall(request).enqueue(new C0302a(a15));
            this.f15947b = 1;
            obj = ((s) a15).S(this);
            if (obj == aVar) {
                return aVar;
            }
        } else if (i14 == 1) {
            ResultKt.throwOnFailure(obj);
        } else {
            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
        Object r122 = ((Result) obj).m373unboximpl();
        if (Result.m371isSuccessimpl(r122)) {
            if (!Result.m370isFailureimpl(r122)) {
                response = r122;
            }
            q.d(response);
            return response;
        }
        Throwable r123 = Result.m367exceptionOrNullimpl(r122);
        if (r123 == null) {
            throw new RuntimeException();
        }
        throw r123;
    }
}