package androidx.compose.foundation.gestures;

import androidx.compose.foundation.gestures.a;
import androidx.compose.ui.platform.c1;
import androidx.compose.ui.platform.y2;
import b0.j;
import b0.q;
import c3.z;
import com.google.android.gms.common.api.Api;
import d2.h0;
import d2.o;
import d2.q0;
import d2.s0;
import d2.y;
import dn.l;
import dn.p;
import j2.h;
import j2.i;
import j2.m;
import j2.p1;
import java.util.concurrent.CancellationException;
import kotlin.jvm.internal.o0;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import r1.g;
import tp.k;
import tp.m0;
import tp.n0;

/* loaded from: classes.dex */
public abstract class b extends m implements p1, h {
    private q E;
    private l F;
    private boolean G;
    private d0.l H;
    private final l I = new a();
    private vp.d J;
    private d0.b K;
    private boolean L;
    private s0 M;

    /* loaded from: classes.dex */
    static final class a extends v implements l {
        a() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Boolean invoke(y yVar) {
            return (Boolean) b.this.x2().invoke(yVar);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: androidx.compose.foundation.gestures.b$b, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static final class C0042b extends kotlin.coroutines.jvm.internal.l implements p {

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

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

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: androidx.compose.foundation.gestures.b$b$a */
        /* loaded from: classes.dex */
        public static final class a extends kotlin.coroutines.jvm.internal.l implements p {

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

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

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

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

            /* renamed from: t, reason: collision with root package name */
            final /* synthetic */ dn.q f1633t;

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

            /* renamed from: v, reason: collision with root package name */
            final /* synthetic */ dn.a f1635v;

            /* renamed from: w, reason: collision with root package name */
            final /* synthetic */ dn.a f1636w;

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            a(b bVar, h0 h0Var, dn.q qVar, l lVar, dn.a aVar, dn.a aVar2, p pVar, vm.d dVar) {
                super(2, dVar);
                this.f1631r = bVar;
                this.f1632s = h0Var;
                this.f1633t = qVar;
                this.f1634u = lVar;
                this.f1635v = aVar;
                this.f1636w = aVar2;
                this.f1637x = pVar;
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final vm.d create(Object obj, vm.d dVar) {
                a aVar = new a(this.f1631r, this.f1632s, this.f1633t, this.f1634u, this.f1635v, this.f1636w, this.f1637x, dVar);
                aVar.f1630q = obj;
                return aVar;
            }

            /* JADX WARN: Removed duplicated region for block: B:14:0x004e  */
            /* JADX WARN: Removed duplicated region for block: B:17:0x0060  */
            @Override // kotlin.coroutines.jvm.internal.a
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invokeSuspend(Object obj) {
                Object f10;
                m0 m0Var;
                CancellationException e10;
                vp.d dVar;
                f10 = wm.d.f();
                int i10 = this.f1629p;
                if (i10 == 0) {
                    rm.y.b(obj);
                    m0 m0Var2 = (m0) this.f1630q;
                    try {
                        q qVar = this.f1631r.E;
                        h0 h0Var = this.f1632s;
                        dn.q qVar2 = this.f1633t;
                        l lVar = this.f1634u;
                        dn.a aVar = this.f1635v;
                        dn.a aVar2 = this.f1636w;
                        p pVar = this.f1637x;
                        this.f1630q = m0Var2;
                        this.f1629p = 1;
                        if (j.e(h0Var, qVar2, lVar, aVar, aVar2, qVar, pVar, this) == f10) {
                            return f10;
                        }
                    } catch (CancellationException e11) {
                        m0Var = m0Var2;
                        e10 = e11;
                        dVar = this.f1631r.J;
                        if (dVar != null) {
                            vp.h.b(dVar.n(a.C0041a.f1621a));
                        }
                        if (!n0.h(m0Var)) {
                            throw e10;
                        }
                        return rm.n0.f34904a;
                    }
                } else {
                    if (i10 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    m0Var = (m0) this.f1630q;
                    try {
                        rm.y.b(obj);
                    } catch (CancellationException e12) {
                        e10 = e12;
                        dVar = this.f1631r.J;
                        if (dVar != null) {
                        }
                        if (!n0.h(m0Var)) {
                        }
                        return rm.n0.f34904a;
                    }
                }
                return rm.n0.f34904a;
            }

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

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: androidx.compose.foundation.gestures.b$b$b, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        public static final class C0043b extends v implements p {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ e2.d f1638p;

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0043b(e2.d dVar, b bVar) {
                super(2);
                this.f1638p = dVar;
                this.f1639q = bVar;
            }

            public final void a(y yVar, long j10) {
                e2.e.c(this.f1638p, yVar);
                vp.d dVar = this.f1639q.J;
                if (dVar != null) {
                    vp.h.b(dVar.n(new a.b(j10, null)));
                }
            }

            @Override // dn.p
            public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
                a((y) obj, ((g) obj2).v());
                return rm.n0.f34904a;
            }
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: androidx.compose.foundation.gestures.b$b$c */
        /* loaded from: classes.dex */
        public static final class c extends v implements dn.a {

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            c(b bVar) {
                super(0);
                this.f1640p = bVar;
            }

            @Override // dn.a
            public /* bridge */ /* synthetic */ Object invoke() {
                m8invoke();
                return rm.n0.f34904a;
            }

            /* renamed from: invoke, reason: collision with other method in class */
            public final void m8invoke() {
                vp.d dVar = this.f1640p.J;
                if (dVar != null) {
                    vp.h.b(dVar.n(a.C0041a.f1621a));
                }
            }
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: androidx.compose.foundation.gestures.b$b$d */
        /* loaded from: classes.dex */
        public static final class d extends v implements l {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ e2.d f1641p;

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            d(e2.d dVar, b bVar) {
                super(1);
                this.f1641p = dVar;
                this.f1642q = bVar;
            }

            public final void a(y yVar) {
                e2.e.c(this.f1641p, yVar);
                float f10 = ((y2) i.a(this.f1642q, c1.q())).f();
                long b10 = this.f1641p.b(z.a(f10, f10));
                this.f1641p.e();
                vp.d dVar = this.f1642q.J;
                if (dVar != null) {
                    vp.h.b(dVar.n(new a.d(b0.l.f(b10), null)));
                }
            }

            @Override // dn.l
            public /* bridge */ /* synthetic */ Object invoke(Object obj) {
                a((y) obj);
                return rm.n0.f34904a;
            }
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: androidx.compose.foundation.gestures.b$b$e */
        /* loaded from: classes.dex */
        public static final class e extends v implements dn.q {

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

            /* renamed from: q, reason: collision with root package name */
            final /* synthetic */ e2.d f1644q;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            e(b bVar, e2.d dVar) {
                super(3);
                this.f1643p = bVar;
                this.f1644q = dVar;
            }

            public final void a(y yVar, y yVar2, long j10) {
                if (((Boolean) this.f1643p.x2().invoke(yVar)).booleanValue()) {
                    if (!this.f1643p.L) {
                        if (this.f1643p.J == null) {
                            this.f1643p.J = vp.g.b(Api.BaseClientBuilder.API_PRIORITY_OTHER, null, null, 6, null);
                        }
                        this.f1643p.G2();
                    }
                    e2.e.c(this.f1644q, yVar);
                    long q10 = g.q(yVar2.h(), j10);
                    vp.d dVar = this.f1643p.J;
                    if (dVar != null) {
                        vp.h.b(dVar.n(new a.c(q10, null)));
                    }
                }
            }

            @Override // dn.q
            public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2, Object obj3) {
                a((y) obj, (y) obj2, ((g) obj3).v());
                return rm.n0.f34904a;
            }
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: androidx.compose.foundation.gestures.b$b$f */
        /* loaded from: classes.dex */
        public static final class f extends v implements dn.a {

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            f(b bVar) {
                super(0);
                this.f1645p = bVar;
            }

            @Override // dn.a
            public final Boolean invoke() {
                return Boolean.valueOf(!this.f1645p.F2());
            }
        }

        C0042b(vm.d dVar) {
            super(2, dVar);
        }

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

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            C0042b c0042b = new C0042b(dVar);
            c0042b.f1627q = obj;
            return c0042b;
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            f10 = wm.d.f();
            int i10 = this.f1626p;
            if (i10 == 0) {
                rm.y.b(obj);
                h0 h0Var = (h0) this.f1627q;
                e2.d dVar = new e2.d();
                a aVar = new a(b.this, h0Var, new e(b.this, dVar), new d(dVar, b.this), new c(b.this), new f(b.this), new C0043b(dVar, b.this), null);
                this.f1626p = 1;
                if (n0.f(aVar, this) == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                rm.y.b(obj);
            }
            return rm.n0.f34904a;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class c extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        Object f1646p;

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

        /* renamed from: s, reason: collision with root package name */
        int f1649s;

        c(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f1647q = obj;
            this.f1649s |= Integer.MIN_VALUE;
            return b.this.C2(this);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class d extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        Object f1650p;

        /* renamed from: q, reason: collision with root package name */
        Object f1651q;

        /* renamed from: r, reason: collision with root package name */
        Object f1652r;

        /* renamed from: s, reason: collision with root package name */
        /* synthetic */ Object f1653s;

        /* renamed from: u, reason: collision with root package name */
        int f1655u;

        d(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f1653s = obj;
            this.f1655u |= Integer.MIN_VALUE;
            return b.this.D2(null, this);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class e extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        Object f1656p;

        /* renamed from: q, reason: collision with root package name */
        Object f1657q;

        /* renamed from: r, reason: collision with root package name */
        /* synthetic */ Object f1658r;

        /* renamed from: t, reason: collision with root package name */
        int f1660t;

        e(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f1658r = obj;
            this.f1660t |= Integer.MIN_VALUE;
            return b.this.E2(null, this);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class f extends kotlin.coroutines.jvm.internal.l implements p {

        /* renamed from: p, reason: collision with root package name */
        Object f1661p;

        /* renamed from: q, reason: collision with root package name */
        Object f1662q;

        /* renamed from: r, reason: collision with root package name */
        int f1663r;

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

        /* JADX INFO: Access modifiers changed from: package-private */
        /* loaded from: classes.dex */
        public static final class a extends kotlin.coroutines.jvm.internal.l implements p {

            /* renamed from: p, reason: collision with root package name */
            Object f1666p;

            /* renamed from: q, reason: collision with root package name */
            int f1667q;

            /* renamed from: r, reason: collision with root package name */
            /* synthetic */ Object f1668r;

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

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            a(o0 o0Var, b bVar, vm.d dVar) {
                super(2, dVar);
                this.f1669s = o0Var;
                this.f1670t = bVar;
            }

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

            @Override // kotlin.coroutines.jvm.internal.a
            public final vm.d create(Object obj, vm.d dVar) {
                a aVar = new a(this.f1669s, this.f1670t, dVar);
                aVar.f1668r = obj;
                return aVar;
            }

            /* JADX WARN: Removed duplicated region for block: B:9:0x002f  */
            /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:17:0x0049 -> B:6:0x005b). Please report as a decompilation issue!!! */
            /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:19:0x0055 -> B:5:0x0058). Please report as a decompilation issue!!! */
            @Override // kotlin.coroutines.jvm.internal.a
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invokeSuspend(Object obj) {
                Object f10;
                l lVar;
                Object obj2;
                f10 = wm.d.f();
                int i10 = this.f1667q;
                if (i10 == 0) {
                    rm.y.b(obj);
                    lVar = (l) this.f1668r;
                    obj2 = this.f1669s.f26199p;
                    if (obj2 instanceof a.d) {
                    }
                    return rm.n0.f34904a;
                }
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                o0 o0Var = (o0) this.f1666p;
                lVar = (l) this.f1668r;
                rm.y.b(obj);
                androidx.compose.foundation.gestures.a aVar = (androidx.compose.foundation.gestures.a) obj;
                o0Var.f26199p = aVar;
                obj2 = this.f1669s.f26199p;
                if (!(obj2 instanceof a.d) || (obj2 instanceof a.C0041a)) {
                    return rm.n0.f34904a;
                }
                aVar = null;
                a.b bVar = obj2 instanceof a.b ? (a.b) obj2 : null;
                if (bVar != null) {
                    lVar.invoke(bVar);
                }
                o0Var = this.f1669s;
                vp.d dVar = this.f1670t.J;
                if (dVar != null) {
                    this.f1668r = lVar;
                    this.f1666p = o0Var;
                    this.f1667q = 1;
                    obj = dVar.e(this);
                    if (obj == f10) {
                        return f10;
                    }
                    androidx.compose.foundation.gestures.a aVar2 = (androidx.compose.foundation.gestures.a) obj;
                }
                o0Var.f26199p = aVar2;
                obj2 = this.f1669s.f26199p;
                if (obj2 instanceof a.d) {
                }
                return rm.n0.f34904a;
            }
        }

        f(vm.d dVar) {
            super(2, dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            f fVar = new f(dVar);
            fVar.f1664s = obj;
            return fVar;
        }

        /* JADX WARN: Can't wrap try/catch for region: R(7:22|23|(1:42)|25|26|27|(2:32|(2:34|(1:36)))(2:29|(1:31))) */
        /* JADX WARN: Code restructure failed: missing block: B:38:0x00eb, code lost:
        
            r1 = r4;
         */
        /* JADX WARN: Code restructure failed: missing block: B:41:0x00fb, code lost:
        
            return r0;
         */
        /* JADX WARN: Failed to find 'out' block for switch in B:2:0x0007. Please report as an issue. */
        /* JADX WARN: Removed duplicated region for block: B:10:0x0064  */
        /* JADX WARN: Removed duplicated region for block: B:19:0x008f  */
        /* JADX WARN: Removed duplicated region for block: B:29:0x00c0 A[Catch: CancellationException -> 0x00eb, TryCatch #0 {CancellationException -> 0x00eb, blocks: (B:27:0x00ba, B:29:0x00c0, B:32:0x00d7, B:34:0x00db), top: B:26:0x00ba }] */
        /* JADX WARN: Removed duplicated region for block: B:32:0x00d7 A[Catch: CancellationException -> 0x00eb, TryCatch #0 {CancellationException -> 0x00eb, blocks: (B:27:0x00ba, B:29:0x00c0, B:32:0x00d7, B:34:0x00db), top: B:26:0x00ba }] */
        /* JADX WARN: Removed duplicated region for block: B:41:0x00fb A[RETURN] */
        /* JADX WARN: Removed duplicated region for block: B:42:0x00b9 A[RETURN] */
        /* JADX WARN: Removed duplicated region for block: B:46:0x00fc  */
        /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:18:0x008d -> B:8:0x005e). Please report as a decompilation issue!!! */
        /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:30:0x00d4 -> B:8:0x005e). Please report as a decompilation issue!!! */
        /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:33:0x00d9 -> B:8:0x005e). Please report as a decompilation issue!!! */
        /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:35:0x00e8 -> B:8:0x005e). Please report as a decompilation issue!!! */
        /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:40:0x00f9 -> B:7:0x0027). Please report as a decompilation issue!!! */
        @Override // kotlin.coroutines.jvm.internal.a
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final Object invokeSuspend(Object obj) {
            Object f10;
            m0 m0Var;
            o0 o0Var;
            o0 o0Var2;
            o0 o0Var3;
            m0 m0Var2;
            m0 m0Var3;
            b bVar;
            Object obj2;
            b bVar2;
            a aVar;
            androidx.compose.foundation.gestures.a aVar2;
            Object obj3;
            f10 = wm.d.f();
            switch (this.f1663r) {
                case 0:
                    rm.y.b(obj);
                    m0Var = (m0) this.f1664s;
                    if (!n0.h(m0Var)) {
                        o0Var = new o0();
                        vp.d dVar = b.this.J;
                        if (dVar != null) {
                            this.f1664s = m0Var;
                            this.f1661p = o0Var;
                            this.f1662q = o0Var;
                            this.f1663r = 1;
                            obj = dVar.e(this);
                            if (obj == f10) {
                                return f10;
                            }
                            o0Var2 = o0Var;
                            aVar2 = (androidx.compose.foundation.gestures.a) obj;
                            o0Var.f26199p = aVar2;
                            obj3 = o0Var2.f26199p;
                            if (obj3 instanceof a.c) {
                                this.f1664s = m0Var;
                                this.f1661p = o0Var2;
                                this.f1662q = null;
                                this.f1663r = 2;
                                if (b.this.D2((a.c) obj3, this) == f10) {
                                    return f10;
                                }
                                o0Var3 = o0Var2;
                                m0Var2 = m0Var;
                                bVar2 = b.this;
                                aVar = new a(o0Var3, bVar2, null);
                                this.f1664s = m0Var2;
                                this.f1661p = o0Var3;
                                this.f1663r = 3;
                                if (bVar2.w2(aVar, this) == f10) {
                                    return f10;
                                }
                                m0Var = m0Var2;
                                obj2 = o0Var3.f26199p;
                                if (obj2 instanceof a.d) {
                                    b bVar3 = b.this;
                                    t.e(obj2, "null cannot be cast to non-null type androidx.compose.foundation.gestures.DragEvent.DragStopped");
                                    this.f1664s = m0Var;
                                    this.f1661p = null;
                                    this.f1663r = 4;
                                    if (bVar3.E2((a.d) obj2, this) == f10) {
                                        return f10;
                                    }
                                } else if (obj2 instanceof a.C0041a) {
                                    b bVar4 = b.this;
                                    this.f1664s = m0Var;
                                    this.f1661p = null;
                                    this.f1663r = 5;
                                    if (bVar4.C2(this) == f10) {
                                        return f10;
                                    }
                                }
                            }
                            if (!n0.h(m0Var)) {
                                return rm.n0.f34904a;
                            }
                        } else {
                            o0Var2 = o0Var;
                            aVar2 = null;
                            o0Var.f26199p = aVar2;
                            obj3 = o0Var2.f26199p;
                            if (obj3 instanceof a.c) {
                            }
                            if (!n0.h(m0Var)) {
                            }
                        }
                    }
                case 1:
                    o0Var = (o0) this.f1662q;
                    o0Var2 = (o0) this.f1661p;
                    m0Var = (m0) this.f1664s;
                    rm.y.b(obj);
                    aVar2 = (androidx.compose.foundation.gestures.a) obj;
                    o0Var.f26199p = aVar2;
                    obj3 = o0Var2.f26199p;
                    if (obj3 instanceof a.c) {
                    }
                    if (!n0.h(m0Var)) {
                    }
                    break;
                case 2:
                    o0Var3 = (o0) this.f1661p;
                    m0Var2 = (m0) this.f1664s;
                    rm.y.b(obj);
                    bVar2 = b.this;
                    aVar = new a(o0Var3, bVar2, null);
                    this.f1664s = m0Var2;
                    this.f1661p = o0Var3;
                    this.f1663r = 3;
                    if (bVar2.w2(aVar, this) == f10) {
                    }
                    m0Var = m0Var2;
                    obj2 = o0Var3.f26199p;
                    if (obj2 instanceof a.d) {
                    }
                    if (!n0.h(m0Var)) {
                    }
                    break;
                case 3:
                    o0Var3 = (o0) this.f1661p;
                    m0Var2 = (m0) this.f1664s;
                    try {
                        rm.y.b(obj);
                    } catch (CancellationException unused) {
                        m0Var3 = m0Var2;
                        bVar = b.this;
                        this.f1664s = m0Var3;
                        this.f1661p = null;
                        this.f1663r = 6;
                        if (bVar.C2(this) == f10) {
                        }
                        m0Var = m0Var3;
                        if (!n0.h(m0Var)) {
                        }
                    }
                    m0Var = m0Var2;
                    obj2 = o0Var3.f26199p;
                    if (obj2 instanceof a.d) {
                    }
                    if (!n0.h(m0Var)) {
                    }
                    break;
                case 4:
                    m0Var3 = (m0) this.f1664s;
                    try {
                        rm.y.b(obj);
                    } catch (CancellationException unused2) {
                        bVar = b.this;
                        this.f1664s = m0Var3;
                        this.f1661p = null;
                        this.f1663r = 6;
                        if (bVar.C2(this) == f10) {
                        }
                        m0Var = m0Var3;
                        if (!n0.h(m0Var)) {
                        }
                    }
                    m0Var = m0Var3;
                    if (!n0.h(m0Var)) {
                    }
                    break;
                case 5:
                    m0Var3 = (m0) this.f1664s;
                    rm.y.b(obj);
                    m0Var = m0Var3;
                    if (!n0.h(m0Var)) {
                    }
                    break;
                case 6:
                    m0Var3 = (m0) this.f1664s;
                    rm.y.b(obj);
                    m0Var = m0Var3;
                    if (!n0.h(m0Var)) {
                    }
                    break;
                default:
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
        }

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

    public b(l lVar, boolean z10, d0.l lVar2, q qVar) {
        this.E = qVar;
        this.F = lVar;
        this.G = z10;
        this.H = lVar2;
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Removed duplicated region for block: B:16:0x0035  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0023  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object C2(vm.d dVar) {
        c cVar;
        Object f10;
        int i10;
        if (dVar instanceof c) {
            cVar = (c) dVar;
            int i11 = cVar.f1649s;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                cVar.f1649s = i11 - Integer.MIN_VALUE;
                Object obj = cVar.f1647q;
                f10 = wm.d.f();
                i10 = cVar.f1649s;
                if (i10 != 0) {
                    rm.y.b(obj);
                    d0.b bVar = this.K;
                    if (bVar != null) {
                        d0.l lVar = this.H;
                        if (lVar != null) {
                            d0.a aVar = new d0.a(bVar);
                            cVar.f1646p = this;
                            cVar.f1649s = 1;
                            if (lVar.c(aVar, cVar) == f10) {
                                return f10;
                            }
                        }
                    }
                    this.B2(c3.y.f7445b.a());
                    return rm.n0.f34904a;
                }
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                this = (b) cVar.f1646p;
                rm.y.b(obj);
                this.K = null;
                this.B2(c3.y.f7445b.a());
                return rm.n0.f34904a;
            }
        }
        cVar = new c(dVar);
        Object obj2 = cVar.f1647q;
        f10 = wm.d.f();
        i10 = cVar.f1649s;
        if (i10 != 0) {
        }
        this.K = null;
        this.B2(c3.y.f7445b.a());
        return rm.n0.f34904a;
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Removed duplicated region for block: B:20:0x0075  */
    /* JADX WARN: Removed duplicated region for block: B:24:0x004f  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0024  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object D2(a.c cVar, vm.d dVar) {
        d dVar2;
        Object f10;
        int i10;
        d0.l lVar;
        d0.b bVar;
        d0.l lVar2;
        b bVar2;
        d0.b bVar3;
        if (dVar instanceof d) {
            dVar2 = (d) dVar;
            int i11 = dVar2.f1655u;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                dVar2.f1655u = i11 - Integer.MIN_VALUE;
                Object obj = dVar2.f1653s;
                f10 = wm.d.f();
                i10 = dVar2.f1655u;
                if (i10 != 0) {
                    rm.y.b(obj);
                    d0.b bVar4 = this.K;
                    if (bVar4 != null && (lVar = this.H) != null) {
                        d0.a aVar = new d0.a(bVar4);
                        dVar2.f1650p = this;
                        dVar2.f1651q = cVar;
                        dVar2.f1655u = 1;
                        if (lVar.c(aVar, dVar2) == f10) {
                            return f10;
                        }
                    }
                } else {
                    if (i10 != 1) {
                        if (i10 != 2) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        bVar3 = (d0.b) dVar2.f1652r;
                        cVar = (a.c) dVar2.f1651q;
                        bVar2 = (b) dVar2.f1650p;
                        rm.y.b(obj);
                        bVar = bVar3;
                        this = bVar2;
                        this.K = bVar;
                        this.A2(cVar.a());
                        return rm.n0.f34904a;
                    }
                    a.c cVar2 = (a.c) dVar2.f1651q;
                    b bVar5 = (b) dVar2.f1650p;
                    rm.y.b(obj);
                    cVar = cVar2;
                    this = bVar5;
                }
                bVar = new d0.b();
                lVar2 = this.H;
                if (lVar2 != null) {
                    dVar2.f1650p = this;
                    dVar2.f1651q = cVar;
                    dVar2.f1652r = bVar;
                    dVar2.f1655u = 2;
                    if (lVar2.c(bVar, dVar2) == f10) {
                        return f10;
                    }
                    bVar2 = this;
                    bVar3 = bVar;
                    bVar = bVar3;
                    this = bVar2;
                }
                this.K = bVar;
                this.A2(cVar.a());
                return rm.n0.f34904a;
            }
        }
        dVar2 = new d(dVar);
        Object obj2 = dVar2.f1653s;
        f10 = wm.d.f();
        i10 = dVar2.f1655u;
        if (i10 != 0) {
        }
        bVar = new d0.b();
        lVar2 = this.H;
        if (lVar2 != null) {
        }
        this.K = bVar;
        this.A2(cVar.a());
        return rm.n0.f34904a;
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Removed duplicated region for block: B:16:0x003c  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0023  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object E2(a.d dVar, vm.d dVar2) {
        e eVar;
        Object f10;
        int i10;
        if (dVar2 instanceof e) {
            eVar = (e) dVar2;
            int i11 = eVar.f1660t;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                eVar.f1660t = i11 - Integer.MIN_VALUE;
                Object obj = eVar.f1658r;
                f10 = wm.d.f();
                i10 = eVar.f1660t;
                if (i10 != 0) {
                    rm.y.b(obj);
                    d0.b bVar = this.K;
                    if (bVar != null) {
                        d0.l lVar = this.H;
                        if (lVar != null) {
                            d0.c cVar = new d0.c(bVar);
                            eVar.f1656p = this;
                            eVar.f1657q = dVar;
                            eVar.f1660t = 1;
                            if (lVar.c(cVar, eVar) == f10) {
                                return f10;
                            }
                        }
                    }
                    this.B2(dVar.a());
                    return rm.n0.f34904a;
                }
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                a.d dVar3 = (a.d) eVar.f1657q;
                b bVar2 = (b) eVar.f1656p;
                rm.y.b(obj);
                dVar = dVar3;
                this = bVar2;
                this.K = null;
                this.B2(dVar.a());
                return rm.n0.f34904a;
            }
        }
        eVar = new e(dVar2);
        Object obj2 = eVar.f1658r;
        f10 = wm.d.f();
        i10 = eVar.f1660t;
        if (i10 != 0) {
        }
        this.K = null;
        this.B2(dVar.a());
        return rm.n0.f34904a;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void G2() {
        this.L = true;
        k.d(H1(), null, null, new f(null), 3, null);
    }

    private final s0 z2() {
        return q0.a(new C0042b(null));
    }

    public abstract void A2(long j10);

    public abstract void B2(long j10);

    public abstract boolean F2();

    public final void H2(l lVar, boolean z10, d0.l lVar2, q qVar, boolean z11) {
        s0 s0Var;
        this.F = lVar;
        boolean z12 = true;
        if (this.G != z10) {
            this.G = z10;
            if (!z10) {
                v2();
                s0 s0Var2 = this.M;
                if (s0Var2 != null) {
                    k2(s0Var2);
                }
                this.M = null;
            }
            z11 = true;
        }
        if (!t.b(this.H, lVar2)) {
            v2();
            this.H = lVar2;
        }
        if (this.E != qVar) {
            this.E = qVar;
        } else {
            z12 = z11;
        }
        if (!z12 || (s0Var = this.M) == null) {
            return;
        }
        s0Var.D1();
    }

    @Override // l1.i.c
    public void S1() {
        this.L = false;
        v2();
    }

    @Override // j2.p1
    public void d0(d2.m mVar, o oVar, long j10) {
        if (this.G && this.M == null) {
            this.M = (s0) h2(z2());
        }
        s0 s0Var = this.M;
        if (s0Var != null) {
            s0Var.d0(mVar, oVar, j10);
        }
    }

    @Override // j2.p1
    public void q0() {
        s0 s0Var = this.M;
        if (s0Var != null) {
            s0Var.q0();
        }
    }

    public final void v2() {
        d0.b bVar = this.K;
        if (bVar != null) {
            d0.l lVar = this.H;
            if (lVar != null) {
                lVar.b(new d0.a(bVar));
            }
            this.K = null;
        }
    }

    public abstract Object w2(p pVar, vm.d dVar);

    /* JADX INFO: Access modifiers changed from: protected */
    public final l x2() {
        return this.F;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public final boolean y2() {
        return this.G;
    }
}
