package com.sistemasolton.itranvias.home.presentation.nearby; import androidx.compose.runtime.MutableState; import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt; import androidx.core.view.MotionEventCompat; import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModelKt; import com.sistemasolton.itranvias.home.data.remote.dto.infodto.InfoDto; import com.sistemasolton.itranvias.home.data.remote.dto.nearbystopdto.NearbyStopsDto; import com.sistemasolton.itranvias.home.domain.usecase.GetInfoLocalUseCase; import com.sistemasolton.itranvias.home.domain.usecase.GetInfoUseCase; import com.sistemasolton.itranvias.home.domain.usecase.GetNearbyStopsUseCase; 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.Function2; import kotlin.jvm.internal.Intrinsics; import kotlinx.coroutines.BuildersKt__Builders_commonKt; import kotlinx.coroutines.CoroutineScope; import kotlinx.coroutines.flow.FlowKt; /* JADX INFO: compiled from: NearbyViewModel.kt */ /* JADX INFO: loaded from: classes2.dex */ @Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0006\n\u0002\b\u0002\b\u0007\u0018\u00002\u00020\u0001B\u001f\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0004\b\b\u0010\tJ\u001a\u0010\u0013\u001a\u00020\u00142\b\b\u0002\u0010\u0015\u001a\u00020\u00162\b\b\u0002\u0010\u0017\u001a\u00020\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R+\u0010\f\u001a\u00020\u000b2\u0006\u0010\n\u001a\u00020\u000b8F@BX\u0086\u008e\u0002¢\u0006\u0012\n\u0004\b\u0011\u0010\u0012\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0010¨\u0006\u0018"}, d2 = {"Lcom/sistemasolton/itranvias/home/presentation/nearby/NearbyViewModel;", "Landroidx/lifecycle/ViewModel;", "getInfoUseCase", "Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoUseCase;", "getLocalInfoUseCase", "Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoLocalUseCase;", "getNearbyStopsUseCase", "Lcom/sistemasolton/itranvias/home/domain/usecase/GetNearbyStopsUseCase;", "", "(Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoUseCase;Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoLocalUseCase;Lcom/sistemasolton/itranvias/home/domain/usecase/GetNearbyStopsUseCase;)V", "", "Lcom/sistemasolton/itranvias/home/presentation/nearby/NearbyState;", "state", "getState", "()Lcom/sistemasolton/itranvias/home/presentation/nearby/NearbyState;", "setState", "(Lcom/sistemasolton/itranvias/home/presentation/nearby/NearbyState;)V", "state$delegate", "Landroidx/compose/runtime/MutableState;", "loadInfoAndNearbyStops", "", "lat", "", "lon", "composeApp_release"}, k = 1, mv = {2, 1, 0}, xi = 48) public final class NearbyViewModel extends ViewModel { public static final int $stable = 8; private final GetInfoUseCase getInfoUseCase; private final GetInfoLocalUseCase getLocalInfoUseCase; private final GetNearbyStopsUseCase getNearbyStopsUseCase; /* JADX INFO: renamed from: state$delegate, reason: from kotlin metadata */ private final MutableState state; public NearbyViewModel(GetInfoUseCase getInfoUseCase, GetInfoLocalUseCase getLocalInfoUseCase, GetNearbyStopsUseCase getNearbyStopsUseCase) { Intrinsics.checkNotNullParameter(getInfoUseCase, "getInfoUseCase"); Intrinsics.checkNotNullParameter(getLocalInfoUseCase, "getLocalInfoUseCase"); Intrinsics.checkNotNullParameter(getNearbyStopsUseCase, "getNearbyStopsUseCase"); this.getInfoUseCase = getInfoUseCase; this.getLocalInfoUseCase = getLocalInfoUseCase; this.getNearbyStopsUseCase = getNearbyStopsUseCase; this.state = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(new NearbyState(false, false, null, null, null, 31, null), null, 2, null); } /* JADX INFO: Access modifiers changed from: private */ public final void setState(NearbyState nearbyState) { this.state.setValue(nearbyState); } /* JADX WARN: Multi-variable type inference failed */ public final NearbyState getState() { return (NearbyState) this.state.getValue(); } /* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.nearby.NearbyViewModel$loadInfoAndNearbyStops$1, reason: invalid class name */ /* JADX INFO: compiled from: NearbyViewModel.kt */ @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\n"}, d2 = {"", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 1, 0}, xi = 48) @DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.nearby.NearbyViewModel$loadInfoAndNearbyStops$1", f = "NearbyViewModel.kt", i = {}, l = {36}, m = "invokeSuspend", n = {}, s = {}) static final class AnonymousClass1 extends SuspendLambda implements Function2, Object> { final /* synthetic */ double $lat; final /* synthetic */ double $lon; int label; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ AnonymousClass1(double d, double d2, Continuation continuation) { super(2, continuation); this.$lat = d; this.$lon = d2; } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Continuation create(Object obj, Continuation continuation) { return NearbyViewModel.this.new AnonymousClass1(this.$lat, this.$lon, continuation); } @Override // kotlin.jvm.functions.Function2 public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) { return ((AnonymousClass1) create(coroutineScope, 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; try { if (i == 0) { ResultKt.throwOnFailure(obj); NearbyViewModel nearbyViewModel = NearbyViewModel.this; nearbyViewModel.setState(nearbyViewModel.getState().copy(true, false, null, null, null)); this.label = 1; if (FlowKt.collectLatest(NearbyViewModel.this.getLocalInfoUseCase.invoke(), new C01191(NearbyViewModel.this, this.$lat, this.$lon, null), this) == coroutine_suspended) { return coroutine_suspended; } } else { if (i != 1) { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } ResultKt.throwOnFailure(obj); } } catch (Exception e) { NearbyViewModel nearbyViewModel2 = NearbyViewModel.this; NearbyState state = nearbyViewModel2.getState(); String message = e.getMessage(); if (message == null) { message = "Error desconocido"; } nearbyViewModel2.setState(NearbyState.copy$default(state, false, true, null, message, null, 20, null)); } return Unit.INSTANCE; } /* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.nearby.NearbyViewModel$loadInfoAndNearbyStops$1$1, reason: invalid class name and collision with other inner class name */ /* JADX INFO: compiled from: NearbyViewModel.kt */ @Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u00012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003H\n"}, d2 = {"", "", "infoDto", "Lcom/sistemasolton/itranvias/home/data/remote/dto/infodto/InfoDto;"}, k = 3, mv = {2, 1, 0}, xi = 48) @DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.nearby.NearbyViewModel$loadInfoAndNearbyStops$1$1", f = "NearbyViewModel.kt", i = {0}, l = {MotionEventCompat.AXIS_GENERIC_7}, m = "invokeSuspend", n = {"infoDto"}, s = {"L$0"}) static final class C01191 extends SuspendLambda implements Function2, Object> { final /* synthetic */ double $lat; final /* synthetic */ double $lon; /* synthetic */ Object L$0; int label; final /* synthetic */ NearbyViewModel this$0; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ C01191(NearbyViewModel nearbyViewModel, double d, double d2, Continuation continuation) { super(2, continuation); this.this$0 = nearbyViewModel; this.$lat = d; this.$lon = d2; } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Continuation create(Object obj, Continuation continuation) { C01191 c01191 = new C01191(this.this$0, this.$lat, this.$lon, continuation); c01191.L$0 = obj; return c01191; } @Override // kotlin.jvm.functions.Function2 public final Object invoke(InfoDto infoDto, Continuation continuation) { return ((C01191) create(infoDto, continuation)).invokeSuspend(Unit.INSTANCE); } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Object invokeSuspend(Object obj) throws Throwable { InfoDto infoDto; Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED(); int i = this.label; if (i == 0) { ResultKt.throwOnFailure(obj); InfoDto infoDto2 = (InfoDto) this.L$0; this.L$0 = infoDto2; this.label = 1; Object objInvoke = this.this$0.getNearbyStopsUseCase.invoke(this.$lat, this.$lon, this); if (objInvoke == coroutine_suspended) { return coroutine_suspended; } infoDto = infoDto2; obj = objInvoke; } else { if (i != 1) { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } InfoDto infoDto3 = (InfoDto) this.L$0; ResultKt.throwOnFailure(obj); infoDto = infoDto3; } NearbyStopsDto nearbyStopsDto = (NearbyStopsDto) obj; NearbyViewModel nearbyViewModel = this.this$0; nearbyViewModel.setState(NearbyState.copy$default(nearbyViewModel.getState(), false, false, infoDto, null, nearbyStopsDto, 10, null)); return Unit.INSTANCE; } } } public static /* synthetic */ void loadInfoAndNearbyStops$default(NearbyViewModel nearbyViewModel, double d, double d2, int i, Object obj) { if ((i & 1) != 0) { d = 0.0d; } if ((i & 2) != 0) { d2 = 0.0d; } nearbyViewModel.loadInfoAndNearbyStops(d, d2); } public final void loadInfoAndNearbyStops(double lat, double lon) { BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new AnonymousClass1(lat, lon, null), 3, null); } }