package C0;

import B.f1;
import G0.p0;
import G0.q0;
import I0.K0;
import J0.B1;
import J0.C0349c0;
import J0.C0355e0;
import J0.C0375o;
import J0.C1;
import J0.ChoreographerFrameCallbackC0352d0;
import J0.J0;
import android.content.Context;
import android.view.MotionEvent;
import androidx.compose.runtime.State;
import androidx.compose.runtime.collection.MutableVector;
import androidx.compose.runtime.internal.ComposableLambdaKt;
import androidx.lifecycle.C1104m;
import androidx.lifecycle.EnumC1108q;
import androidx.lifecycle.InterfaceC1113w;
import androidx.navigation.AbstractC1131f;
import androidx.navigation.C1127b;
import i0.C2260x;
import i0.InterfaceC2255s;
import j2.C2330h;
import j2.C2342t;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.concurrent.CancellationException;
import p.C2644F;
import p0.C2708n;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class H extends kotlin.jvm.internal.p implements J4.c {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f527a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f528b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f529c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ H(int i6, Object obj, Object obj2) {
        super(1);
        this.f527a = i6;
        this.f528b = obj;
        this.f529c = obj2;
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // J4.c
    public final Object invoke(Object obj) throws Throwable {
        T.y yVar;
        C3137A c3137a;
        C3137A c3137a2;
        androidx.lifecycle.r lifecycle;
        int i6 = 1;
        switch (this.f527a) {
            case 0:
                MotionEvent motionEvent = (MotionEvent) obj;
                int actionMasked = motionEvent.getActionMasked();
                K k6 = (K) this.f529c;
                if (actionMasked == 0) {
                    L l = k6.f537a;
                    if (l == null) {
                        kotlin.jvm.internal.o.n("onTouchEvent");
                        throw null;
                    }
                    ((J) this.f528b).f534c = ((Boolean) l.invoke(motionEvent)).booleanValue() ? G.f524b : G.f525c;
                } else {
                    L l6 = k6.f537a;
                    if (l6 == null) {
                        kotlin.jvm.internal.o.n("onTouchEvent");
                        throw null;
                    }
                    l6.invoke(motionEvent);
                }
                return C3137A.f25453a;
            case 1:
                Context context = (Context) this.f528b;
                Context applicationContext = context.getApplicationContext();
                J0.T t6 = (J0.T) this.f529c;
                applicationContext.registerComponentCallbacks(t6);
                return new f1(2, context, t6);
            case 2:
                Context context2 = (Context) this.f528b;
                Context applicationContext2 = context2.getApplicationContext();
                J0.U u6 = (J0.U) this.f529c;
                applicationContext2.registerComponentCallbacks(u6);
                return new f1(3, context2, u6);
            case 3:
                return new J0((T.x) this.f528b, new B0.b((J0.X) this.f529c, 5));
            case 4:
                J0 j02 = (J0) this.f528b;
                synchronized (j02.f2888c) {
                    try {
                        j02.f2890e = true;
                        MutableVector mutableVector = j02.f2889d;
                        Object[] objArr = mutableVector.content;
                        int size = mutableVector.getSize();
                        for (int i7 = 0; i7 < size; i7++) {
                            Z0.m mVar = (Z0.m) ((K0) objArr[i7]).get();
                            if (mVar != null && (yVar = mVar.f9119b) != null) {
                                mVar.a(yVar);
                                mVar.f9119b = null;
                            }
                        }
                        j02.f2889d.clear();
                    } catch (Throwable th) {
                        throw th;
                    }
                }
                Z0.z zVar = ((J0.X) this.f529c).f2965b;
                zVar.f9140b.set(null);
                zVar.f9139a.f();
                return C3137A.f25453a;
            case 5:
                C0349c0 c0349c0 = (C0349c0) this.f528b;
                ChoreographerFrameCallbackC0352d0 choreographerFrameCallbackC0352d0 = (ChoreographerFrameCallbackC0352d0) this.f529c;
                synchronized (c0349c0.f2990d) {
                    c0349c0.f2992f.remove(choreographerFrameCallbackC0352d0);
                }
                return C3137A.f25453a;
            case 6:
                ((C0355e0) this.f528b).f3009a.removeFrameCallback((ChoreographerFrameCallbackC0352d0) this.f529c);
                return C3137A.f25453a;
            case 7:
                C0375o c0375o = (C0375o) obj;
                C1 c12 = (C1) this.f528b;
                if (!c12.f2799c) {
                    androidx.lifecycle.r lifecycle2 = c0375o.f3040a.getLifecycle();
                    J4.e eVar = (J4.e) this.f529c;
                    c12.f2801e = eVar;
                    if (c12.f2800d == null) {
                        c12.f2800d = lifecycle2;
                        lifecycle2.addObserver(c12);
                    } else if (lifecycle2.getCurrentState().compareTo(EnumC1108q.f12182c) >= 0) {
                        c12.f2798b.setContent(ComposableLambdaKt.composableLambdaInstance(1330788943, true, new B1(c12, eVar, i6)));
                    }
                }
                return C3137A.f25453a;
            case 8:
                Throwable th2 = (Throwable) obj;
                ((Z) this.f528b).invoke(th2);
                J j4 = (J) this.f529c;
                ((X4.e) j4.f535d).j(th2, false);
                do {
                    Object objA = X4.l.a(((X4.e) j4.f535d).c());
                    c3137a = C3137A.f25453a;
                    if (objA != null) {
                        ((O1.Q) objA).f5367b.U(th2 == null ? new CancellationException("DataStore scope was cancelled before updateData could complete") : th2);
                        c3137a2 = c3137a;
                    } else {
                        c3137a2 = null;
                    }
                } while (c3137a2 != null);
                return c3137a;
            case 9:
                androidx.navigation.L navOptions = (androidx.navigation.L) obj;
                kotlin.jvm.internal.o.h(navOptions, "$this$navOptions");
                androidx.navigation.J j6 = navOptions.f12707a;
                j6.f12697e = 0;
                j6.f12698f = 0;
                androidx.navigation.B b5 = (androidx.navigation.B) this.f528b;
                if (b5 instanceof androidx.navigation.E) {
                    int i8 = androidx.navigation.B.l;
                    Iterator it = AbstractC1131f.b(b5).iterator();
                    while (true) {
                        boolean zHasNext = it.hasNext();
                        androidx.navigation.H h5 = (androidx.navigation.H) this.f529c;
                        if (zHasNext) {
                            androidx.navigation.B b6 = (androidx.navigation.B) it.next();
                            androidx.navigation.B bG = h5.g();
                            if (kotlin.jvm.internal.o.c(b6, bG != null ? bG.f12640b : null)) {
                            }
                        } else {
                            int i9 = androidx.navigation.E.f12655q;
                            Iterator it2 = R4.n.a0(C1127b.l, h5.h()).iterator();
                            if (!it2.hasNext()) {
                                throw new NoSuchElementException("Sequence is empty.");
                            }
                            Object next = it2.next();
                            while (it2.hasNext()) {
                                next = it2.next();
                            }
                            navOptions.f12710d = ((androidx.navigation.B) next).f12644f;
                            navOptions.f12712f = false;
                            androidx.navigation.Z z6 = new androidx.navigation.Z();
                            z6.f12735b = true;
                            navOptions.f12712f = z6.f12734a;
                            navOptions.f12713g = z6.f12735b;
                        }
                    }
                }
                return C3137A.f25453a;
            case 10:
                ((p0) obj).l((q0) this.f528b, 0, 0, ((C2260x) this.f529c).f18829a);
                return C3137A.f25453a;
            case 11:
                androidx.navigation.H h6 = (androidx.navigation.H) this.f528b;
                h6.getClass();
                InterfaceC1113w owner = (InterfaceC1113w) this.f529c;
                kotlin.jvm.internal.o.h(owner, "owner");
                if (!owner.equals(h6.f12681o)) {
                    InterfaceC1113w interfaceC1113w = h6.f12681o;
                    C1104m c1104m = h6.f12685s;
                    if (interfaceC1113w != null && (lifecycle = interfaceC1113w.getLifecycle()) != null) {
                        lifecycle.removeObserver(c1104m);
                    }
                    h6.f12681o = owner;
                    owner.getLifecycle().addObserver(c1104m);
                }
                return new C2342t(0);
            case 12:
                return new f1(11, (State) this.f528b, (C2330h) this.f529c);
            case 13:
                ((I0.H) this.f528b).d0(((InterfaceC2255s) obj).then((InterfaceC2255s) this.f529c));
                return C3137A.f25453a;
            case 14:
                l1.y yVar2 = (l1.y) this.f528b;
                yVar2.setPositionProvider((l1.B) this.f529c);
                yVar2.j();
                return new l1.i();
            case 15:
                ((p0) obj).l((q0) this.f528b, 0, 0, ((C2644F) this.f529c).f22623c.getFloatValue());
                return C3137A.f25453a;
            case 16:
                ((p0) obj).B((q0) this.f528b, 0, 0, 0.0f, ((C2708n) this.f529c).f22928a);
                return C3137A.f25453a;
            default:
                ((p0) obj).B((q0) this.f528b, 0, 0, 0.0f, ((p0.Y) this.f529c).f22897o);
                return C3137A.f25453a;
        }
    }
}
