package com.vinfast.companion.main.ui.rsa.servicehistory;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@kotlin.Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\n"}, d2 = {"<anonymous>", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 2, 0}, xi = 48)
@kotlin.coroutines.jvm.internal.DebugMetadata(c = "com.vinfast.companion.main.ui.rsa.servicehistory.RsaServiceHistoryViewModel$getServiceHistory$1", f = "RsaServiceHistoryViewModel.kt", l = {99}, m = "invokeSuspend", v = 1)
final class RsaServiceHistoryViewModel$getServiceHistory$1 extends kotlin.coroutines.jvm.internal.SuspendLambda implements kotlin.jvm.functions.Function2<kotlinx.coroutines.CoroutineScope, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> {
    java.lang.Object n;
    java.lang.Object o;
    int p;
    int q;
    final /* synthetic */ com.vinfast.companion.main.ui.rsa.servicehistory.RsaServiceHistoryViewModel r;
    final /* synthetic */ boolean s;
    final /* synthetic */ boolean t;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    RsaServiceHistoryViewModel$getServiceHistory$1(com.vinfast.companion.main.ui.rsa.servicehistory.RsaServiceHistoryViewModel rsaServiceHistoryViewModel, boolean z, boolean z4, kotlin.coroutines.Continuation continuation) {
        super(2, continuation);
        this.r = rsaServiceHistoryViewModel;
        this.s = z;
        this.t = z4;
    }

    public final kotlin.coroutines.Continuation create(java.lang.Object obj, kotlin.coroutines.Continuation continuation) {
        return new com.vinfast.companion.main.ui.rsa.servicehistory.RsaServiceHistoryViewModel$getServiceHistory$1(this.r, this.s, this.t, continuation);
    }

    public final java.lang.Object invokeSuspend(java.lang.Object obj) {
        java.lang.Object objG = kotlin.coroutines.intrinsics.IntrinsicsKt.g();
        int i = this.q;
        if (i == 0) {
            kotlin.ResultKt.b(obj);
            com.vinfast.companion.vehiclekit.data.persistent.model.Vehicle vehicle = (com.vinfast.companion.vehiclekit.data.persistent.model.Vehicle) com.vinfast.companion.core.extensions.validity.ValidityExtensionKt.d(this.r.vehicleManager.o1());
            java.lang.String strJ = vehicle != null ? vehicle.J() : null;
            if (strJ != null) {
                final com.vinfast.companion.main.ui.rsa.servicehistory.RsaServiceHistoryViewModel rsaServiceHistoryViewModel = this.r;
                final boolean z = this.s;
                kotlinx.coroutines.flow.Flow flowI = kotlinx.coroutines.flow.FlowKt.i(kotlinx.coroutines.flow.FlowKt.d0(rsaServiceHistoryViewModel.rsaRepository.f(rsaServiceHistoryViewModel.mServiceHistoryListState.b(), rsaServiceHistoryViewModel.mServiceHistoryListState.c(), strJ), new com.vinfast.companion.main.ui.rsa.servicehistory.RsaServiceHistoryViewModel$getServiceHistory$1$1$1(rsaServiceHistoryViewModel, z, this.t, null)), new com.vinfast.companion.main.ui.rsa.servicehistory.RsaServiceHistoryViewModel$getServiceHistory$1$1$2(rsaServiceHistoryViewModel, z, null));
                kotlinx.coroutines.flow.FlowCollector flowCollector = new kotlinx.coroutines.flow.FlowCollector() { // from class: com.vinfast.companion.main.ui.rsa.servicehistory.RsaServiceHistoryViewModel$getServiceHistory$1$1$3
                    @Override // kotlinx.coroutines.flow.FlowCollector
                    /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
                    public final java.lang.Object emit(java.util.List list, kotlin.coroutines.Continuation continuation) {
                        com.vinfast.companion.main.ui.rsa.servicehistory.RsaServiceHistoryViewModel rsaServiceHistoryViewModel2 = rsaServiceHistoryViewModel;
                        rsaServiceHistoryViewModel2.mOldListItemAppointment = rsaServiceHistoryViewModel2.R(list);
                        rsaServiceHistoryViewModel.mServiceHistoryListState.d(list.size() == rsaServiceHistoryViewModel.mServiceHistoryListState.c());
                        rsaServiceHistoryViewModel._serviceListLiveData.n(new com.vinfast.companion.core.base.ui.model.UiState.Success(kotlin.collections.CollectionsKt.n1(rsaServiceHistoryViewModel.mOldListItemAppointment), kotlin.coroutines.jvm.internal.Boxing.a(z)));
                        return kotlin.Unit.a;
                    }
                };
                this.n = kotlin.coroutines.jvm.internal.SpillingKt.a(strJ);
                this.o = kotlin.coroutines.jvm.internal.SpillingKt.a(strJ);
                this.p = 0;
                this.q = 1;
                if (flowI.a(flowCollector, this) == objG) {
                    return objG;
                }
            }
        } else {
            if (i != 1) {
                throw new java.lang.IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            kotlin.ResultKt.b(obj);
        }
        return kotlin.Unit.a;
    }

    public final java.lang.Object invoke(kotlinx.coroutines.CoroutineScope coroutineScope, kotlin.coroutines.Continuation continuation) {
        return create(coroutineScope, continuation).invokeSuspend(kotlin.Unit.a);
    }
}
