package com.sistemasolton.itranvias.home.data.remote;

import com.sistemasolton.itranvias.home.data.remote.GooglePlacesApi;
import io.ktor.client.HttpClient;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.jvm.internal.Intrinsics;

/* JADX INFO: compiled from: GooglePlacesApi.kt */
/* JADX INFO: loaded from: classes2.dex */
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u00002\u00020\u0001B\u000f\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0004\b\u0004\u0010\u0005J\u0016\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u0007H\u0096@¢\u0006\u0002\u0010\u000bJ\u0016\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u0007H\u0096@¢\u0006\u0002\u0010\u000bR\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000f"}, d2 = {"Lcom/sistemasolton/itranvias/home/data/remote/GooglePlacesApiImpl;", "Lcom/sistemasolton/itranvias/home/data/remote/GooglePlacesApi;", "client", "Lio/ktor/client/HttpClient;", "<init>", "(Lio/ktor/client/HttpClient;)V", "apiKey", "", "autocomplete", "Lcom/sistemasolton/itranvias/home/data/remote/AutocompleteResponse;", "input", "(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "placeDetails", "Lcom/sistemasolton/itranvias/home/data/remote/PlaceDetailsResponse;", "placeId", "composeApp_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
public final class GooglePlacesApiImpl implements GooglePlacesApi {
    public static final int $stable = 8;
    private final String apiKey;
    private final HttpClient client;

    /* JADX INFO: renamed from: com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl$autocomplete$1, reason: invalid class name */
    /* JADX INFO: compiled from: GooglePlacesApi.kt */
    @Metadata(k = 3, mv = {2, 1, 0}, xi = 48)
    @DebugMetadata(c = "com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl", f = "GooglePlacesApi.kt", i = {}, l = {89, 90}, m = "autocomplete", n = {}, s = {})
    static final class AnonymousClass1 extends ContinuationImpl {
        int label;
        /* synthetic */ Object result;

        AnonymousClass1(Continuation<? super AnonymousClass1> continuation) {
            super(continuation);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            this.result = obj;
            this.label |= Integer.MIN_VALUE;
            return GooglePlacesApiImpl.this.autocomplete(null, this);
        }
    }

    /* JADX INFO: renamed from: com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl$placeDetails$1, reason: invalid class name and case insensitive filesystem */
    /* JADX INFO: compiled from: GooglePlacesApi.kt */
    @Metadata(k = 3, mv = {2, 1, 0}, xi = 48)
    @DebugMetadata(c = "com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl", f = "GooglePlacesApi.kt", i = {}, l = {89, 90}, m = "placeDetails", n = {}, s = {})
    static final class C06301 extends ContinuationImpl {
        int label;
        /* synthetic */ Object result;

        C06301(Continuation<? super C06301> continuation) {
            super(continuation);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            this.result = obj;
            this.label |= Integer.MIN_VALUE;
            return GooglePlacesApiImpl.this.placeDetails(null, this);
        }
    }

    public GooglePlacesApiImpl(HttpClient client) {
        Intrinsics.checkNotNullParameter(client, "client");
        this.client = client;
        this.apiKey = getGooglePlacesApiKey();
    }

    @Override // com.sistemasolton.itranvias.home.data.remote.GooglePlacesApi
    public String getGooglePlacesApiKey() {
        return GooglePlacesApi.DefaultImpls.getGooglePlacesApiKey(this);
    }

    /* JADX WARN: Removed duplicated region for block: B:23:0x00a2  */
    /* JADX WARN: Removed duplicated region for block: B:25:0x00a5  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0014  */
    @Override // com.sistemasolton.itranvias.home.data.remote.GooglePlacesApi
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public java.lang.Object autocomplete(java.lang.String r7, kotlin.coroutines.Continuation<? super com.sistemasolton.itranvias.home.data.remote.AutocompleteResponse> r8) throws java.lang.Throwable {
        /*
            r6 = this;
            boolean r0 = r8 instanceof com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl.AnonymousClass1
            if (r0 == 0) goto L14
            r0 = r8
            com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl$autocomplete$1 r0 = (com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl.AnonymousClass1) r0
            int r1 = r0.label
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r1 = r1 & r2
            if (r1 == 0) goto L14
            int r8 = r0.label
            int r8 = r8 - r2
            r0.label = r8
            goto L19
        L14:
            com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl$autocomplete$1 r0 = new com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl$autocomplete$1
            r0.<init>(r8)
        L19:
            java.lang.Object r8 = r0.result
            java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
            int r2 = r0.label
            r3 = 2
            r4 = 1
            if (r2 == 0) goto L39
            if (r2 == r4) goto L35
            if (r2 != r3) goto L2d
            kotlin.ResultKt.throwOnFailure(r8)
            goto La0
        L2d:
            java.lang.IllegalStateException r7 = new java.lang.IllegalStateException
            java.lang.String r8 = "call to 'resume' before 'invoke' with coroutine"
            r7.<init>(r8)
            throw r7
        L35:
            kotlin.ResultKt.throwOnFailure(r8)
            goto L7d
        L39:
            kotlin.ResultKt.throwOnFailure(r8)
            io.ktor.client.HttpClient r8 = r6.client
            io.ktor.client.request.HttpRequestBuilder r2 = new io.ktor.client.request.HttpRequestBuilder
            r2.<init>()
            java.lang.String r5 = "https://maps.googleapis.com/maps/api/place/autocomplete/json"
            io.ktor.client.request.HttpRequestKt.url(r2, r5)
            java.lang.String r5 = "input"
            io.ktor.client.request.UtilsKt.parameter(r2, r5, r7)
            java.lang.String r7 = "key"
            java.lang.String r5 = r6.apiKey
            io.ktor.client.request.UtilsKt.parameter(r2, r7, r5)
            java.lang.String r7 = "location"
            java.lang.String r5 = "43.3623,-8.4115"
            io.ktor.client.request.UtilsKt.parameter(r2, r7, r5)
            r7 = 7000(0x1b58, float:9.809E-42)
            java.lang.Integer r7 = kotlin.coroutines.jvm.internal.Boxing.boxInt(r7)
            java.lang.String r5 = "radius"
            io.ktor.client.request.UtilsKt.parameter(r2, r5, r7)
            io.ktor.http.HttpMethod$Companion r7 = io.ktor.http.HttpMethod.INSTANCE
            io.ktor.http.HttpMethod r7 = r7.getGet()
            r2.setMethod(r7)
            io.ktor.client.statement.HttpStatement r7 = new io.ktor.client.statement.HttpStatement
            r7.<init>(r2, r8)
            r0.label = r4
            java.lang.Object r8 = r7.execute(r0)
            if (r8 != r1) goto L7d
            return r1
        L7d:
            io.ktor.client.statement.HttpResponse r8 = (io.ktor.client.statement.HttpResponse) r8
            io.ktor.client.call.HttpClientCall r7 = r8.getCall()
            java.lang.Class<com.sistemasolton.itranvias.home.data.remote.AutocompleteResponse> r8 = com.sistemasolton.itranvias.home.data.remote.AutocompleteResponse.class
            kotlin.reflect.KType r8 = kotlin.jvm.internal.Reflection.typeOf(r8)
            java.lang.reflect.Type r2 = kotlin.reflect.TypesJVMKt.getJavaType(r8)
            java.lang.Class<com.sistemasolton.itranvias.home.data.remote.AutocompleteResponse> r4 = com.sistemasolton.itranvias.home.data.remote.AutocompleteResponse.class
            kotlin.reflect.KClass r4 = kotlin.jvm.internal.Reflection.getOrCreateKotlinClass(r4)
            io.ktor.util.reflect.TypeInfo r8 = io.ktor.util.reflect.TypeInfoJvmKt.typeInfoImpl(r2, r4, r8)
            r0.label = r3
            java.lang.Object r8 = r7.bodyNullable(r8, r0)
            if (r8 != r1) goto La0
            return r1
        La0:
            if (r8 == 0) goto La5
            com.sistemasolton.itranvias.home.data.remote.AutocompleteResponse r8 = (com.sistemasolton.itranvias.home.data.remote.AutocompleteResponse) r8
            return r8
        La5:
            java.lang.NullPointerException r7 = new java.lang.NullPointerException
            java.lang.String r8 = "null cannot be cast to non-null type com.sistemasolton.itranvias.home.data.remote.AutocompleteResponse"
            r7.<init>(r8)
            throw r7
        */
        throw new UnsupportedOperationException("Method not decompiled: com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl.autocomplete(java.lang.String, kotlin.coroutines.Continuation):java.lang.Object");
    }

    /* JADX WARN: Removed duplicated region for block: B:23:0x0090  */
    /* JADX WARN: Removed duplicated region for block: B:25:0x0093  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0014  */
    @Override // com.sistemasolton.itranvias.home.data.remote.GooglePlacesApi
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public java.lang.Object placeDetails(java.lang.String r7, kotlin.coroutines.Continuation<? super com.sistemasolton.itranvias.home.data.remote.PlaceDetailsResponse> r8) throws java.lang.Throwable {
        /*
            r6 = this;
            boolean r0 = r8 instanceof com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl.C06301
            if (r0 == 0) goto L14
            r0 = r8
            com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl$placeDetails$1 r0 = (com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl.C06301) r0
            int r1 = r0.label
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r1 = r1 & r2
            if (r1 == 0) goto L14
            int r8 = r0.label
            int r8 = r8 - r2
            r0.label = r8
            goto L19
        L14:
            com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl$placeDetails$1 r0 = new com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl$placeDetails$1
            r0.<init>(r8)
        L19:
            java.lang.Object r8 = r0.result
            java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
            int r2 = r0.label
            r3 = 2
            r4 = 1
            if (r2 == 0) goto L39
            if (r2 == r4) goto L35
            if (r2 != r3) goto L2d
            kotlin.ResultKt.throwOnFailure(r8)
            goto L8e
        L2d:
            java.lang.IllegalStateException r7 = new java.lang.IllegalStateException
            java.lang.String r8 = "call to 'resume' before 'invoke' with coroutine"
            r7.<init>(r8)
            throw r7
        L35:
            kotlin.ResultKt.throwOnFailure(r8)
            goto L6b
        L39:
            kotlin.ResultKt.throwOnFailure(r8)
            io.ktor.client.HttpClient r8 = r6.client
            io.ktor.client.request.HttpRequestBuilder r2 = new io.ktor.client.request.HttpRequestBuilder
            r2.<init>()
            java.lang.String r5 = "https://maps.googleapis.com/maps/api/place/details/json"
            io.ktor.client.request.HttpRequestKt.url(r2, r5)
            java.lang.String r5 = "place_id"
            io.ktor.client.request.UtilsKt.parameter(r2, r5, r7)
            java.lang.String r7 = "key"
            java.lang.String r5 = r6.apiKey
            io.ktor.client.request.UtilsKt.parameter(r2, r7, r5)
            io.ktor.http.HttpMethod$Companion r7 = io.ktor.http.HttpMethod.INSTANCE
            io.ktor.http.HttpMethod r7 = r7.getGet()
            r2.setMethod(r7)
            io.ktor.client.statement.HttpStatement r7 = new io.ktor.client.statement.HttpStatement
            r7.<init>(r2, r8)
            r0.label = r4
            java.lang.Object r8 = r7.execute(r0)
            if (r8 != r1) goto L6b
            return r1
        L6b:
            io.ktor.client.statement.HttpResponse r8 = (io.ktor.client.statement.HttpResponse) r8
            io.ktor.client.call.HttpClientCall r7 = r8.getCall()
            java.lang.Class<com.sistemasolton.itranvias.home.data.remote.PlaceDetailsResponse> r8 = com.sistemasolton.itranvias.home.data.remote.PlaceDetailsResponse.class
            kotlin.reflect.KType r8 = kotlin.jvm.internal.Reflection.typeOf(r8)
            java.lang.reflect.Type r2 = kotlin.reflect.TypesJVMKt.getJavaType(r8)
            java.lang.Class<com.sistemasolton.itranvias.home.data.remote.PlaceDetailsResponse> r4 = com.sistemasolton.itranvias.home.data.remote.PlaceDetailsResponse.class
            kotlin.reflect.KClass r4 = kotlin.jvm.internal.Reflection.getOrCreateKotlinClass(r4)
            io.ktor.util.reflect.TypeInfo r8 = io.ktor.util.reflect.TypeInfoJvmKt.typeInfoImpl(r2, r4, r8)
            r0.label = r3
            java.lang.Object r8 = r7.bodyNullable(r8, r0)
            if (r8 != r1) goto L8e
            return r1
        L8e:
            if (r8 == 0) goto L93
            com.sistemasolton.itranvias.home.data.remote.PlaceDetailsResponse r8 = (com.sistemasolton.itranvias.home.data.remote.PlaceDetailsResponse) r8
            return r8
        L93:
            java.lang.NullPointerException r7 = new java.lang.NullPointerException
            java.lang.String r8 = "null cannot be cast to non-null type com.sistemasolton.itranvias.home.data.remote.PlaceDetailsResponse"
            r7.<init>(r8)
            throw r7
        */
        throw new UnsupportedOperationException("Method not decompiled: com.sistemasolton.itranvias.home.data.remote.GooglePlacesApiImpl.placeDetails(java.lang.String, kotlin.coroutines.Continuation):java.lang.Object");
    }
}