package com.vinfast.companion.mqttkit;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.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>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 2, 0}, xi = 48)
@kotlin.coroutines.jvm.internal.DebugMetadata(c = "com.vinfast.companion.mqttkit.MqttManagerImpl$onRemctrlArrived$1", f = "MQTTManager.kt", l = {490}, m = "invokeSuspend", v = 1)
final class MqttManagerImpl$onRemctrlArrived$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;
    int o;
    final /* synthetic */ java.lang.String p;
    final /* synthetic */ com.vinfast.companion.mqttkit.MqttManagerImpl q;

    /* JADX INFO: renamed from: com.vinfast.companion.mqttkit.MqttManagerImpl$onRemctrlArrived$1$1, reason: invalid class name */
    /* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
    @kotlin.Metadata(k = 3, mv = {2, 2, 0}, xi = 48)
    static final /* synthetic */ class AnonymousClass1 extends kotlin.jvm.internal.AdaptedFunctionReference implements kotlin.jvm.functions.Function1<java.lang.String, kotlin.Unit> {
        AnonymousClass1(java.lang.Object obj) {
            super(1, obj, timber.log.Timber.Tree.class, "w", "w(Ljava/lang/String;[Ljava/lang/Object;)V", 0);
        }

        public final void a(java.lang.String str) {
            ((timber.log.Timber.Tree) ((kotlin.jvm.internal.AdaptedFunctionReference) this).a).q(str, new java.lang.Object[0]);
        }

        public /* bridge */ /* synthetic */ java.lang.Object invoke(java.lang.Object obj) {
            a((java.lang.String) obj);
            return kotlin.Unit.a;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    MqttManagerImpl$onRemctrlArrived$1(java.lang.String str, com.vinfast.companion.mqttkit.MqttManagerImpl mqttManagerImpl, kotlin.coroutines.Continuation continuation) {
        super(2, continuation);
        this.p = str;
        this.q = mqttManagerImpl;
    }

    public final kotlin.coroutines.Continuation create(java.lang.Object obj, kotlin.coroutines.Continuation continuation) {
        return new com.vinfast.companion.mqttkit.MqttManagerImpl$onRemctrlArrived$1(this.p, this.q, continuation);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r4v0, types: [com.vinfast.companion.mqttkit.MqttManagerImpl$onRemctrlArrived$1, kotlin.coroutines.Continuation] */
    /* JADX WARN: Type inference failed for: r4v1, types: [com.vinfast.companion.mqttkit.MqttManagerImpl$onRemctrlArrived$1] */
    /* JADX WARN: Type inference failed for: r4v5 */
    /* JADX WARN: Type inference failed for: r4v7 */
    /* JADX WARN: Type inference failed for: r4v8 */
    /* JADX WARN: Type inference failed for: r4v9 */
    public final java.lang.Object invokeSuspend(java.lang.Object obj) {
        java.lang.Object objEmit;
        java.lang.Object objG = kotlin.coroutines.intrinsics.IntrinsicsKt.g();
        int i = this.o;
        try {
            if (i == 0) {
                kotlin.ResultKt.b(obj);
                int length = this.p.length();
                this = this;
                if (length > 0) {
                    com.vinfast.companion.mqttkit.domain.remotecontrol.RemoteControlModelMqttDto remoteControlModelMqttDto = (com.vinfast.companion.mqttkit.domain.remotecontrol.RemoteControlModelMqttDto) this.q.gson.fromJson(this.p, com.vinfast.companion.mqttkit.domain.remotecontrol.RemoteControlModelMqttDto.class);
                    kotlinx.coroutines.flow.MutableSharedFlow mutableSharedFlow = this.q._remoteControlCvcComponentsChanged;
                    kotlin.jvm.internal.Intrinsics.i(remoteControlModelMqttDto);
                    this.n = kotlin.coroutines.jvm.internal.SpillingKt.a(remoteControlModelMqttDto);
                    this.o = 1;
                    objEmit = mutableSharedFlow.emit(remoteControlModelMqttDto, (kotlin.coroutines.Continuation) this);
                    if (objEmit == objG) {
                        this = objEmit;
                        return objG;
                    }
                }
            } else {
                if (i != 1) {
                    throw new java.lang.IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                kotlin.ResultKt.b(obj);
                this = this;
            }
            this = objEmit;
        } catch (java.lang.Throwable th) {
            this.q.M("🆘 Parser payload from MQTT is failed -> " + th.getLocalizedMessage() + " 😤", new com.vinfast.companion.mqttkit.MqttManagerImpl$onRemctrlArrived$1.AnonymousClass1(timber.log.Timber.a.t("[MQTT]")));
        }
        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);
    }
}
