package com.google.maps.android.ktx;

import androidx.core.view.MotionEventCompat;
import com.google.android.gms.maps.StreetViewPanorama;
import com.google.android.gms.maps.StreetViewPanoramaView;
import com.google.android.gms.maps.model.StreetViewPanoramaCamera;
import com.google.android.gms.maps.model.StreetViewPanoramaLocation;
import com.google.android.gms.maps.model.StreetViewPanoramaOrientation;
import com.google.maps.android.ktx.StreetViewPanoramaViewKt;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.SafeContinuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.channels.ProduceKt;
import kotlinx.coroutines.channels.ProducerScope;
import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.FlowKt;

/* JADX INFO: compiled from: StreetViewPanoramaView.kt */
/* JADX INFO: loaded from: classes2.dex */
@Metadata(d1 = {"\u0000&\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0086Hø\u0001\u0000¢\u0006\u0002\u0010\u0003\u001a\u0010\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005*\u00020\u0001\u001a\u0010\u0010\u0007\u001a\b\u0012\u0004\u0012\u00020\b0\u0005*\u00020\u0001\u001a\u0010\u0010\t\u001a\b\u0012\u0004\u0012\u00020\n0\u0005*\u00020\u0001\u001a\u0010\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\n0\u0005*\u00020\u0001\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\f"}, d2 = {"awaitStreetViewPanorama", "Lcom/google/android/gms/maps/StreetViewPanorama;", "Lcom/google/android/gms/maps/StreetViewPanoramaView;", "(Lcom/google/android/gms/maps/StreetViewPanoramaView;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "cameraChangeEvents", "Lkotlinx/coroutines/flow/Flow;", "Lcom/google/android/gms/maps/model/StreetViewPanoramaCamera;", "changeEvents", "Lcom/google/android/gms/maps/model/StreetViewPanoramaLocation;", "clickEvents", "Lcom/google/android/gms/maps/model/StreetViewPanoramaOrientation;", "longClickEvents", "maps-ktx_release"}, k = 2, mv = {1, 8, 0}, xi = 48)
public final class StreetViewPanoramaViewKt {
    public static final Object awaitStreetViewPanorama(StreetViewPanoramaView streetViewPanoramaView, Continuation<? super StreetViewPanorama> continuation) throws Throwable {
        SafeContinuation safeContinuation = new SafeContinuation(IntrinsicsKt.intercepted(continuation));
        streetViewPanoramaView.getStreetViewPanoramaAsync(new StreetViewPanoramaViewKt$awaitStreetViewPanorama$2$1(safeContinuation));
        Object orThrow = safeContinuation.getOrThrow();
        if (orThrow == IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
            DebugProbesKt.probeCoroutineSuspended(continuation);
        }
        return orThrow;
    }

    private static final Object awaitStreetViewPanorama$$forInline(StreetViewPanoramaView streetViewPanoramaView, Continuation<? super StreetViewPanorama> continuation) throws Throwable {
        InlineMarker.mark(0);
        SafeContinuation safeContinuation = new SafeContinuation(IntrinsicsKt.intercepted(continuation));
        streetViewPanoramaView.getStreetViewPanoramaAsync(new StreetViewPanoramaViewKt$awaitStreetViewPanorama$2$1(safeContinuation));
        Unit unit = Unit.INSTANCE;
        Object orThrow = safeContinuation.getOrThrow();
        if (orThrow == IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
            DebugProbesKt.probeCoroutineSuspended(continuation);
        }
        InlineMarker.mark(1);
        return orThrow;
    }

    /* JADX INFO: renamed from: com.google.maps.android.ktx.StreetViewPanoramaViewKt$cameraChangeEvents$1, reason: invalid class name */
    /* JADX INFO: compiled from: StreetViewPanoramaView.kt */
    @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\b\u0012\u0004\u0012\u00020\u00030\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/channels/ProducerScope;", "Lcom/google/android/gms/maps/model/StreetViewPanoramaCamera;"}, k = 3, mv = {1, 8, 0}, xi = 48)
    @DebugMetadata(c = "com.google.maps.android.ktx.StreetViewPanoramaViewKt$cameraChangeEvents$1", f = "StreetViewPanoramaView.kt", i = {}, l = {MotionEventCompat.AXIS_GENERIC_8}, m = "invokeSuspend", n = {}, s = {})
    static final class AnonymousClass1 extends SuspendLambda implements Function2<ProducerScope<? super StreetViewPanoramaCamera>, Continuation<? super Unit>, Object> {
        final /* synthetic */ StreetViewPanorama $this_cameraChangeEvents;
        private /* synthetic */ Object L$0;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        AnonymousClass1(StreetViewPanorama streetViewPanorama, Continuation<? super AnonymousClass1> continuation) {
            super(2, continuation);
            this.$this_cameraChangeEvents = streetViewPanorama;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
            AnonymousClass1 anonymousClass1 = new AnonymousClass1(this.$this_cameraChangeEvents, continuation);
            anonymousClass1.L$0 = obj;
            return anonymousClass1;
        }

        @Override // kotlin.jvm.functions.Function2
        public final Object invoke(ProducerScope<? super StreetViewPanoramaCamera> producerScope, Continuation<? super Unit> continuation) {
            return ((AnonymousClass1) create(producerScope, continuation)).invokeSuspend(Unit.INSTANCE);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) throws Throwable {
            Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
            int i = this.label;
            if (i == 0) {
                ResultKt.throwOnFailure(obj);
                final ProducerScope producerScope = (ProducerScope) this.L$0;
                this.$this_cameraChangeEvents.setOnStreetViewPanoramaCameraChangeListener(new StreetViewPanorama.OnStreetViewPanoramaCameraChangeListener() { // from class: com.google.maps.android.ktx.StreetViewPanoramaViewKt$cameraChangeEvents$1$$ExternalSyntheticLambda0
                    @Override // com.google.android.gms.maps.StreetViewPanorama.OnStreetViewPanoramaCameraChangeListener
                    public final void onStreetViewPanoramaCameraChange(StreetViewPanoramaCamera streetViewPanoramaCamera) {
                        StreetViewPanoramaViewKt.AnonymousClass1.invokeSuspend$lambda$0(producerScope, streetViewPanoramaCamera);
                    }
                });
                final StreetViewPanorama streetViewPanorama = this.$this_cameraChangeEvents;
                this.label = 1;
                if (ProduceKt.awaitClose(producerScope, new Function0<Unit>() { // from class: com.google.maps.android.ktx.StreetViewPanoramaViewKt.cameraChangeEvents.1.2
                    {
                        super(0);
                    }

                    @Override // kotlin.jvm.functions.Function0
                    public /* bridge */ /* synthetic */ Unit invoke() {
                        invoke2();
                        return Unit.INSTANCE;
                    }

                    /* JADX INFO: renamed from: invoke, reason: avoid collision after fix types in other method */
                    public final void invoke2() {
                        streetViewPanorama.setOnStreetViewPanoramaCameraChangeListener(null);
                    }
                }, this) == coroutine_suspended) {
                    return coroutine_suspended;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ResultKt.throwOnFailure(obj);
            }
            return Unit.INSTANCE;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public static final void invokeSuspend$lambda$0(ProducerScope producerScope, StreetViewPanoramaCamera it) {
            Intrinsics.checkNotNullExpressionValue(it, "it");
            producerScope.mo9890trySendJP2dKIU(it);
        }
    }

    public static final Flow<StreetViewPanoramaCamera> cameraChangeEvents(StreetViewPanorama streetViewPanorama) {
        Intrinsics.checkNotNullParameter(streetViewPanorama, "<this>");
        return FlowKt.callbackFlow(new AnonymousClass1(streetViewPanorama, null));
    }

    /* JADX INFO: renamed from: com.google.maps.android.ktx.StreetViewPanoramaViewKt$changeEvents$1, reason: invalid class name and case insensitive filesystem */
    /* JADX INFO: compiled from: StreetViewPanoramaView.kt */
    @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\b\u0012\u0004\u0012\u00020\u00030\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/channels/ProducerScope;", "Lcom/google/android/gms/maps/model/StreetViewPanoramaLocation;"}, k = 3, mv = {1, 8, 0}, xi = 48)
    @DebugMetadata(c = "com.google.maps.android.ktx.StreetViewPanoramaViewKt$changeEvents$1", f = "StreetViewPanoramaView.kt", i = {}, l = {54}, m = "invokeSuspend", n = {}, s = {})
    static final class C06221 extends SuspendLambda implements Function2<ProducerScope<? super StreetViewPanoramaLocation>, Continuation<? super Unit>, Object> {
        final /* synthetic */ StreetViewPanorama $this_changeEvents;
        private /* synthetic */ Object L$0;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C06221(StreetViewPanorama streetViewPanorama, Continuation<? super C06221> continuation) {
            super(2, continuation);
            this.$this_changeEvents = streetViewPanorama;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
            C06221 c06221 = new C06221(this.$this_changeEvents, continuation);
            c06221.L$0 = obj;
            return c06221;
        }

        @Override // kotlin.jvm.functions.Function2
        public final Object invoke(ProducerScope<? super StreetViewPanoramaLocation> producerScope, Continuation<? super Unit> continuation) {
            return ((C06221) create(producerScope, continuation)).invokeSuspend(Unit.INSTANCE);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) throws Throwable {
            Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
            int i = this.label;
            if (i == 0) {
                ResultKt.throwOnFailure(obj);
                final ProducerScope producerScope = (ProducerScope) this.L$0;
                this.$this_changeEvents.setOnStreetViewPanoramaChangeListener(new StreetViewPanorama.OnStreetViewPanoramaChangeListener() { // from class: com.google.maps.android.ktx.StreetViewPanoramaViewKt$changeEvents$1$$ExternalSyntheticLambda0
                    @Override // com.google.android.gms.maps.StreetViewPanorama.OnStreetViewPanoramaChangeListener
                    public final void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation) {
                        StreetViewPanoramaViewKt.C06221.invokeSuspend$lambda$0(producerScope, streetViewPanoramaLocation);
                    }
                });
                final StreetViewPanorama streetViewPanorama = this.$this_changeEvents;
                this.label = 1;
                if (ProduceKt.awaitClose(producerScope, new Function0<Unit>() { // from class: com.google.maps.android.ktx.StreetViewPanoramaViewKt.changeEvents.1.2
                    {
                        super(0);
                    }

                    @Override // kotlin.jvm.functions.Function0
                    public /* bridge */ /* synthetic */ Unit invoke() {
                        invoke2();
                        return Unit.INSTANCE;
                    }

                    /* JADX INFO: renamed from: invoke, reason: avoid collision after fix types in other method */
                    public final void invoke2() {
                        streetViewPanorama.setOnStreetViewPanoramaChangeListener(null);
                    }
                }, this) == coroutine_suspended) {
                    return coroutine_suspended;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ResultKt.throwOnFailure(obj);
            }
            return Unit.INSTANCE;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public static final void invokeSuspend$lambda$0(ProducerScope producerScope, StreetViewPanoramaLocation it) {
            Intrinsics.checkNotNullExpressionValue(it, "it");
            producerScope.mo9890trySendJP2dKIU(it);
        }
    }

    public static final Flow<StreetViewPanoramaLocation> changeEvents(StreetViewPanorama streetViewPanorama) {
        Intrinsics.checkNotNullParameter(streetViewPanorama, "<this>");
        return FlowKt.callbackFlow(new C06221(streetViewPanorama, null));
    }

    /* JADX INFO: renamed from: com.google.maps.android.ktx.StreetViewPanoramaViewKt$clickEvents$1, reason: invalid class name and case insensitive filesystem */
    /* JADX INFO: compiled from: StreetViewPanoramaView.kt */
    @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\b\u0012\u0004\u0012\u00020\u00030\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/channels/ProducerScope;", "Lcom/google/android/gms/maps/model/StreetViewPanoramaOrientation;"}, k = 3, mv = {1, 8, 0}, xi = 48)
    @DebugMetadata(c = "com.google.maps.android.ktx.StreetViewPanoramaViewKt$clickEvents$1", f = "StreetViewPanoramaView.kt", i = {}, l = {69}, m = "invokeSuspend", n = {}, s = {})
    static final class C06231 extends SuspendLambda implements Function2<ProducerScope<? super StreetViewPanoramaOrientation>, Continuation<? super Unit>, Object> {
        final /* synthetic */ StreetViewPanorama $this_clickEvents;
        private /* synthetic */ Object L$0;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C06231(StreetViewPanorama streetViewPanorama, Continuation<? super C06231> continuation) {
            super(2, continuation);
            this.$this_clickEvents = streetViewPanorama;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
            C06231 c06231 = new C06231(this.$this_clickEvents, continuation);
            c06231.L$0 = obj;
            return c06231;
        }

        @Override // kotlin.jvm.functions.Function2
        public final Object invoke(ProducerScope<? super StreetViewPanoramaOrientation> producerScope, Continuation<? super Unit> continuation) {
            return ((C06231) create(producerScope, continuation)).invokeSuspend(Unit.INSTANCE);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) throws Throwable {
            Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
            int i = this.label;
            if (i == 0) {
                ResultKt.throwOnFailure(obj);
                final ProducerScope producerScope = (ProducerScope) this.L$0;
                this.$this_clickEvents.setOnStreetViewPanoramaClickListener(new StreetViewPanorama.OnStreetViewPanoramaClickListener() { // from class: com.google.maps.android.ktx.StreetViewPanoramaViewKt$clickEvents$1$$ExternalSyntheticLambda0
                    @Override // com.google.android.gms.maps.StreetViewPanorama.OnStreetViewPanoramaClickListener
                    public final void onStreetViewPanoramaClick(StreetViewPanoramaOrientation streetViewPanoramaOrientation) {
                        StreetViewPanoramaViewKt.C06231.invokeSuspend$lambda$0(producerScope, streetViewPanoramaOrientation);
                    }
                });
                final StreetViewPanorama streetViewPanorama = this.$this_clickEvents;
                this.label = 1;
                if (ProduceKt.awaitClose(producerScope, new Function0<Unit>() { // from class: com.google.maps.android.ktx.StreetViewPanoramaViewKt.clickEvents.1.2
                    {
                        super(0);
                    }

                    @Override // kotlin.jvm.functions.Function0
                    public /* bridge */ /* synthetic */ Unit invoke() {
                        invoke2();
                        return Unit.INSTANCE;
                    }

                    /* JADX INFO: renamed from: invoke, reason: avoid collision after fix types in other method */
                    public final void invoke2() {
                        streetViewPanorama.setOnStreetViewPanoramaClickListener(null);
                    }
                }, this) == coroutine_suspended) {
                    return coroutine_suspended;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ResultKt.throwOnFailure(obj);
            }
            return Unit.INSTANCE;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public static final void invokeSuspend$lambda$0(ProducerScope producerScope, StreetViewPanoramaOrientation it) {
            Intrinsics.checkNotNullExpressionValue(it, "it");
            producerScope.mo9890trySendJP2dKIU(it);
        }
    }

    public static final Flow<StreetViewPanoramaOrientation> clickEvents(StreetViewPanorama streetViewPanorama) {
        Intrinsics.checkNotNullParameter(streetViewPanorama, "<this>");
        return FlowKt.callbackFlow(new C06231(streetViewPanorama, null));
    }

    /* JADX INFO: renamed from: com.google.maps.android.ktx.StreetViewPanoramaViewKt$longClickEvents$1, reason: invalid class name and case insensitive filesystem */
    /* JADX INFO: compiled from: StreetViewPanoramaView.kt */
    @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\b\u0012\u0004\u0012\u00020\u00030\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/channels/ProducerScope;", "Lcom/google/android/gms/maps/model/StreetViewPanoramaOrientation;"}, k = 3, mv = {1, 8, 0}, xi = 48)
    @DebugMetadata(c = "com.google.maps.android.ktx.StreetViewPanoramaViewKt$longClickEvents$1", f = "StreetViewPanoramaView.kt", i = {}, l = {84}, m = "invokeSuspend", n = {}, s = {})
    static final class C06241 extends SuspendLambda implements Function2<ProducerScope<? super StreetViewPanoramaOrientation>, Continuation<? super Unit>, Object> {
        final /* synthetic */ StreetViewPanorama $this_longClickEvents;
        private /* synthetic */ Object L$0;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C06241(StreetViewPanorama streetViewPanorama, Continuation<? super C06241> continuation) {
            super(2, continuation);
            this.$this_longClickEvents = streetViewPanorama;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
            C06241 c06241 = new C06241(this.$this_longClickEvents, continuation);
            c06241.L$0 = obj;
            return c06241;
        }

        @Override // kotlin.jvm.functions.Function2
        public final Object invoke(ProducerScope<? super StreetViewPanoramaOrientation> producerScope, Continuation<? super Unit> continuation) {
            return ((C06241) create(producerScope, continuation)).invokeSuspend(Unit.INSTANCE);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) throws Throwable {
            Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
            int i = this.label;
            if (i == 0) {
                ResultKt.throwOnFailure(obj);
                final ProducerScope producerScope = (ProducerScope) this.L$0;
                this.$this_longClickEvents.setOnStreetViewPanoramaLongClickListener(new StreetViewPanorama.OnStreetViewPanoramaLongClickListener() { // from class: com.google.maps.android.ktx.StreetViewPanoramaViewKt$longClickEvents$1$$ExternalSyntheticLambda0
                    @Override // com.google.android.gms.maps.StreetViewPanorama.OnStreetViewPanoramaLongClickListener
                    public final void onStreetViewPanoramaLongClick(StreetViewPanoramaOrientation streetViewPanoramaOrientation) {
                        StreetViewPanoramaViewKt.C06241.invokeSuspend$lambda$0(producerScope, streetViewPanoramaOrientation);
                    }
                });
                final StreetViewPanorama streetViewPanorama = this.$this_longClickEvents;
                this.label = 1;
                if (ProduceKt.awaitClose(producerScope, new Function0<Unit>() { // from class: com.google.maps.android.ktx.StreetViewPanoramaViewKt.longClickEvents.1.2
                    {
                        super(0);
                    }

                    @Override // kotlin.jvm.functions.Function0
                    public /* bridge */ /* synthetic */ Unit invoke() {
                        invoke2();
                        return Unit.INSTANCE;
                    }

                    /* JADX INFO: renamed from: invoke, reason: avoid collision after fix types in other method */
                    public final void invoke2() {
                        streetViewPanorama.setOnStreetViewPanoramaLongClickListener(null);
                    }
                }, this) == coroutine_suspended) {
                    return coroutine_suspended;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ResultKt.throwOnFailure(obj);
            }
            return Unit.INSTANCE;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public static final void invokeSuspend$lambda$0(ProducerScope producerScope, StreetViewPanoramaOrientation it) {
            Intrinsics.checkNotNullExpressionValue(it, "it");
            producerScope.mo9890trySendJP2dKIU(it);
        }
    }

    public static final Flow<StreetViewPanoramaOrientation> longClickEvents(StreetViewPanorama streetViewPanorama) {
        Intrinsics.checkNotNullParameter(streetViewPanorama, "<this>");
        return FlowKt.callbackFlow(new C06241(streetViewPanorama, null));
    }
}