package q4;

import androidx.lifecycle.l0;
import androidx.lifecycle.n;
import androidx.lifecycle.u;
import dn.p;
import kotlin.coroutines.jvm.internal.l;
import kotlin.jvm.internal.t;
import rm.n0;
import rm.y;
import tp.i;
import tp.m0;
import vm.d;
import vm.g;
import vm.h;
import wp.e;
import wp.f;
import wp.h0;
import y0.f2;
import y0.m;
import y0.n3;
import y0.y3;

/* loaded from: classes.dex */
public abstract class a {

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: q4.a$a, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static final class C0769a extends l implements p {

        /* renamed from: p, reason: collision with root package name */
        int f33435p;

        /* renamed from: q, reason: collision with root package name */
        private /* synthetic */ Object f33436q;

        /* renamed from: r, reason: collision with root package name */
        final /* synthetic */ n f33437r;

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ n.b f33438s;

        /* renamed from: t, reason: collision with root package name */
        final /* synthetic */ g f33439t;

        /* renamed from: u, reason: collision with root package name */
        final /* synthetic */ e f33440u;

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: q4.a$a$a, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        public static final class C0770a extends l implements p {

            /* renamed from: p, reason: collision with root package name */
            int f33441p;

            /* renamed from: q, reason: collision with root package name */
            final /* synthetic */ g f33442q;

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ e f33443r;

            /* renamed from: s, reason: collision with root package name */
            final /* synthetic */ f2 f33444s;

            /* JADX INFO: Access modifiers changed from: package-private */
            /* renamed from: q4.a$a$a$a, reason: collision with other inner class name */
            /* loaded from: classes.dex */
            public static final class C0771a implements f {

                /* renamed from: p, reason: collision with root package name */
                final /* synthetic */ f2 f33445p;

                C0771a(f2 f2Var) {
                    this.f33445p = f2Var;
                }

                @Override // wp.f
                public final Object emit(Object obj, d dVar) {
                    this.f33445p.setValue(obj);
                    return n0.f34904a;
                }
            }

            /* JADX INFO: Access modifiers changed from: package-private */
            /* renamed from: q4.a$a$a$b */
            /* loaded from: classes.dex */
            public static final class b extends l implements p {

                /* renamed from: p, reason: collision with root package name */
                int f33446p;

                /* renamed from: q, reason: collision with root package name */
                final /* synthetic */ e f33447q;

                /* renamed from: r, reason: collision with root package name */
                final /* synthetic */ f2 f33448r;

                /* JADX INFO: Access modifiers changed from: package-private */
                /* renamed from: q4.a$a$a$b$a, reason: collision with other inner class name */
                /* loaded from: classes.dex */
                public static final class C0772a implements f {

                    /* renamed from: p, reason: collision with root package name */
                    final /* synthetic */ f2 f33449p;

                    C0772a(f2 f2Var) {
                        this.f33449p = f2Var;
                    }

                    @Override // wp.f
                    public final Object emit(Object obj, d dVar) {
                        this.f33449p.setValue(obj);
                        return n0.f34904a;
                    }
                }

                /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
                b(e eVar, f2 f2Var, d dVar) {
                    super(2, dVar);
                    this.f33447q = eVar;
                    this.f33448r = f2Var;
                }

                @Override // kotlin.coroutines.jvm.internal.a
                public final d create(Object obj, d dVar) {
                    return new b(this.f33447q, this.f33448r, dVar);
                }

                @Override // kotlin.coroutines.jvm.internal.a
                public final Object invokeSuspend(Object obj) {
                    Object f10;
                    f10 = wm.d.f();
                    int i10 = this.f33446p;
                    if (i10 == 0) {
                        y.b(obj);
                        e eVar = this.f33447q;
                        C0772a c0772a = new C0772a(this.f33448r);
                        this.f33446p = 1;
                        if (eVar.collect(c0772a, this) == f10) {
                            return f10;
                        }
                    } else {
                        if (i10 != 1) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        y.b(obj);
                    }
                    return n0.f34904a;
                }

                @Override // dn.p
                public final Object invoke(m0 m0Var, d dVar) {
                    return ((b) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
                }
            }

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0770a(g gVar, e eVar, f2 f2Var, d dVar) {
                super(2, dVar);
                this.f33442q = gVar;
                this.f33443r = eVar;
                this.f33444s = f2Var;
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final d create(Object obj, d dVar) {
                return new C0770a(this.f33442q, this.f33443r, this.f33444s, dVar);
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final Object invokeSuspend(Object obj) {
                Object f10;
                f10 = wm.d.f();
                int i10 = this.f33441p;
                if (i10 == 0) {
                    y.b(obj);
                    if (t.b(this.f33442q, h.f40193p)) {
                        e eVar = this.f33443r;
                        C0771a c0771a = new C0771a(this.f33444s);
                        this.f33441p = 1;
                        if (eVar.collect(c0771a, this) == f10) {
                            return f10;
                        }
                    } else {
                        g gVar = this.f33442q;
                        b bVar = new b(this.f33443r, this.f33444s, null);
                        this.f33441p = 2;
                        if (i.g(gVar, bVar, this) == f10) {
                            return f10;
                        }
                    }
                } else {
                    if (i10 != 1 && i10 != 2) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    y.b(obj);
                }
                return n0.f34904a;
            }

            @Override // dn.p
            public final Object invoke(m0 m0Var, d dVar) {
                return ((C0770a) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C0769a(n nVar, n.b bVar, g gVar, e eVar, d dVar) {
            super(2, dVar);
            this.f33437r = nVar;
            this.f33438s = bVar;
            this.f33439t = gVar;
            this.f33440u = eVar;
        }

        @Override // dn.p
        /* renamed from: b, reason: merged with bridge method [inline-methods] */
        public final Object invoke(f2 f2Var, d dVar) {
            return ((C0769a) create(f2Var, dVar)).invokeSuspend(n0.f34904a);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final d create(Object obj, d dVar) {
            C0769a c0769a = new C0769a(this.f33437r, this.f33438s, this.f33439t, this.f33440u, dVar);
            c0769a.f33436q = obj;
            return c0769a;
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            f10 = wm.d.f();
            int i10 = this.f33435p;
            if (i10 == 0) {
                y.b(obj);
                f2 f2Var = (f2) this.f33436q;
                n nVar = this.f33437r;
                n.b bVar = this.f33438s;
                C0770a c0770a = new C0770a(this.f33439t, this.f33440u, f2Var, null);
                this.f33435p = 1;
                if (l0.a(nVar, bVar, c0770a, this) == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                y.b(obj);
            }
            return n0.f34904a;
        }
    }

    public static final y3 a(e eVar, Object obj, n nVar, n.b bVar, g gVar, m mVar, int i10, int i11) {
        mVar.e(1977777920);
        if ((i11 & 4) != 0) {
            bVar = n.b.STARTED;
        }
        n.b bVar2 = bVar;
        if ((i11 & 8) != 0) {
            gVar = h.f40193p;
        }
        g gVar2 = gVar;
        if (y0.p.H()) {
            y0.p.Q(1977777920, i10, -1, "androidx.lifecycle.compose.collectAsStateWithLifecycle (FlowExt.kt:169)");
        }
        Object[] objArr = {eVar, nVar, bVar2, gVar2};
        mVar.e(710004817);
        boolean m10 = mVar.m(nVar) | ((((i10 & 7168) ^ 3072) > 2048 && mVar.R(bVar2)) || (i10 & 3072) == 2048) | mVar.m(gVar2) | mVar.m(eVar);
        Object f10 = mVar.f();
        if (m10 || f10 == m.f51621a.a()) {
            f10 = new C0769a(nVar, bVar2, gVar2, eVar, null);
            mVar.I(f10);
        }
        mVar.N();
        int i12 = i10 >> 3;
        y3 m11 = n3.m(obj, objArr, (p) f10, mVar, (i12 & 14) | (i12 & 8));
        if (y0.p.H()) {
            y0.p.P();
        }
        mVar.N();
        return m11;
    }

    public static final y3 b(h0 h0Var, u uVar, n.b bVar, g gVar, m mVar, int i10, int i11) {
        mVar.e(743249048);
        if ((i11 & 1) != 0) {
            uVar = (u) mVar.t(b.a());
        }
        if ((i11 & 2) != 0) {
            bVar = n.b.STARTED;
        }
        n.b bVar2 = bVar;
        if ((i11 & 4) != 0) {
            gVar = h.f40193p;
        }
        g gVar2 = gVar;
        if (y0.p.H()) {
            y0.p.Q(743249048, i10, -1, "androidx.lifecycle.compose.collectAsStateWithLifecycle (FlowExt.kt:60)");
        }
        int i12 = i10 << 3;
        y3 a10 = a(h0Var, h0Var.getValue(), uVar.getLifecycle(), bVar2, gVar2, mVar, (i10 & 14) | (i12 & 7168) | (i12 & 57344), 0);
        if (y0.p.H()) {
            y0.p.P();
        }
        mVar.N();
        return a10;
    }
}
