package androidx.compose.foundation.text.selection; import androidx.compose.animation.core.Animatable; import androidx.compose.animation.core.AnimationVector2D; import androidx.compose.runtime.SnapshotStateKt; import androidx.compose.runtime.State; import androidx.compose.ui.geometry.Offset; import androidx.compose.ui.geometry.OffsetKt; import kotlin.Metadata; import kotlin.ResultKt; import kotlin.Unit; import kotlin.coroutines.Continuation; import kotlin.coroutines.intrinsics.IntrinsicsKt; import kotlin.coroutines.jvm.internal.DebugMetadata; import kotlin.coroutines.jvm.internal.SuspendLambda; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function2; import kotlinx.coroutines.BuildersKt__Builders_commonKt; import kotlinx.coroutines.CoroutineScope; import kotlinx.coroutines.flow.Flow; import kotlinx.coroutines.flow.FlowCollector; /* JADX INFO: Access modifiers changed from: package-private */ /* compiled from: SelectionMagnifier.kt */ @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 8, 0}, xi = 48) @DebugMetadata(c = "androidx.compose.foundation.text.selection.SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1", f = "SelectionMagnifier.kt", i = {}, l = {87}, m = "invokeSuspend", n = {}, s = {}) /* loaded from: classes.dex */ public final class SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1 extends SuspendLambda implements Function2, Object> { final /* synthetic */ Animatable $animatable; final /* synthetic */ State $targetValue$delegate; private /* synthetic */ Object L$0; int label; /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1(State state, Animatable animatable, Continuation continuation) { super(2, continuation); this.$targetValue$delegate = state; this.$animatable = animatable; } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Continuation create(Object obj, Continuation continuation) { SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1 selectionMagnifierKt$rememberAnimatedMagnifierPosition$1 = new SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1(this.$targetValue$delegate, this.$animatable, continuation); selectionMagnifierKt$rememberAnimatedMagnifierPosition$1.L$0 = obj; return selectionMagnifierKt$rememberAnimatedMagnifierPosition$1; } @Override // kotlin.jvm.functions.Function2 public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) { return ((SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE); } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Object invokeSuspend(Object obj) { Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED(); int i = this.label; if (i == 0) { ResultKt.throwOnFailure(obj); final CoroutineScope coroutineScope = (CoroutineScope) this.L$0; final State state = this.$targetValue$delegate; Flow snapshotFlow = SnapshotStateKt.snapshotFlow(new Function0() { // from class: androidx.compose.foundation.text.selection.SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1.1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Offset invoke() { return Offset.m2389boximpl(m908invokeF1C5BW0()); } /* renamed from: invoke-F1C5BW0, reason: not valid java name */ public final long m908invokeF1C5BW0() { return SelectionMagnifierKt.rememberAnimatedMagnifierPosition$lambda$1(state); } }); final Animatable animatable = this.$animatable; this.label = 1; if (snapshotFlow.collect(new FlowCollector() { // from class: androidx.compose.foundation.text.selection.SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1.2 @Override // kotlinx.coroutines.flow.FlowCollector public /* bridge */ /* synthetic */ Object emit(Offset offset, Continuation continuation) { return m909emit3MmeM6k(offset.getPackedValue(), continuation); } /* renamed from: emit-3MmeM6k, reason: not valid java name */ public final Object m909emit3MmeM6k(long j, Continuation continuation) { if (OffsetKt.m2419isSpecifiedk4lQ0M(animatable.getValue().getPackedValue()) && OffsetKt.m2419isSpecifiedk4lQ0M(j) && Offset.m2401getYimpl(animatable.getValue().getPackedValue()) != Offset.m2401getYimpl(j)) { BuildersKt__Builders_commonKt.launch$default(coroutineScope, null, null, new SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1$2$emit$2(animatable, j, null), 3, null); return Unit.INSTANCE; } Object snapTo = animatable.snapTo(Offset.m2389boximpl(j), continuation); return snapTo == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? snapTo : Unit.INSTANCE; } }, 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; } }