package E1;

import B0.RunnableC0014a;
import android.util.Log;
import h0.C1001a;
import h0.C1013m;
import h0.ComponentCallbacksC1023x;
import h0.X;
import h0.a0;
import h0.b0;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import n4.u0;

/* JADX INFO: renamed from: E1.q, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0110q extends d.o {

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ C0110q(int i, Object obj) {
        super(false);
        this.f2118d = i;
        this.f2119e = obj;
    }

    @Override // d.o
    public void a() {
        switch (this.f2118d) {
            case 1:
                boolean zL = h0.P.L(3);
                h0.P p3 = (h0.P) this.f2119e;
                if (zL) {
                    Log.d("FragmentManager", "handleOnBackCancelled. PREDICTIVE_BACK = true fragment manager " + p3);
                }
                p3.getClass();
                if (h0.P.L(3)) {
                    Log.d("FragmentManager", "cancelBackStackTransition for transition " + p3.f13074h);
                }
                C1001a c1001a = p3.f13074h;
                if (c1001a != null) {
                    c1001a.f13161s = false;
                    c1001a.e();
                    C1001a c1001a2 = p3.f13074h;
                    RunnableC0014a runnableC0014a = new RunnableC0014a(23, p3);
                    if (c1001a2.f13159q == null) {
                        c1001a2.f13159q = new ArrayList();
                    }
                    c1001a2.f13159q.add(runnableC0014a);
                    p3.f13074h.f();
                    p3.i = true;
                    p3.z(true);
                    p3.E();
                    p3.i = false;
                    p3.f13074h = null;
                }
                break;
        }
    }

    @Override // d.o
    public final void b() {
        switch (this.f2118d) {
            case u0.f15495q /* 0 */:
                ((F) this.f2119e).k();
                break;
            default:
                boolean zL = h0.P.L(3);
                h0.P p3 = (h0.P) this.f2119e;
                if (zL) {
                    Log.d("FragmentManager", "handleOnBackPressed. PREDICTIVE_BACK = true fragment manager " + p3);
                }
                p3.i = true;
                p3.z(true);
                int i = 0;
                p3.i = false;
                C1001a c1001a = p3.f13074h;
                C0110q c0110q = p3.f13075j;
                if (c1001a != null) {
                    ArrayList arrayList = p3.f13079n;
                    if (!arrayList.isEmpty()) {
                        LinkedHashSet<ComponentCallbacksC1023x> linkedHashSet = new LinkedHashSet(h0.P.F(p3.f13074h));
                        int size = arrayList.size();
                        int i5 = 0;
                        while (i5 < size) {
                            Object obj = arrayList.get(i5);
                            i5++;
                            h0.K k8 = (h0.K) obj;
                            for (ComponentCallbacksC1023x componentCallbacksC1023x : linkedHashSet) {
                                k8.getClass();
                            }
                        }
                    }
                    ArrayList arrayList2 = p3.f13074h.f13144a;
                    int size2 = arrayList2.size();
                    int i8 = 0;
                    while (i8 < size2) {
                        Object obj2 = arrayList2.get(i8);
                        i8++;
                        ComponentCallbacksC1023x componentCallbacksC1023x2 = ((X) obj2).f13129b;
                        if (componentCallbacksC1023x2 != null) {
                            componentCallbacksC1023x2.f13259C = false;
                        }
                    }
                    for (C1013m c1013m : p3.f(new ArrayList(Collections.singletonList(p3.f13074h)), 0, 1)) {
                        c1013m.getClass();
                        if (h0.P.L(3)) {
                            Log.d("FragmentManager", "SpecialEffectsController: Completing Back ");
                        }
                        ArrayList arrayList3 = c1013m.f13215c;
                        c1013m.k(arrayList3);
                        c1013m.c(arrayList3);
                    }
                    ArrayList arrayList4 = p3.f13074h.f13144a;
                    int size3 = arrayList4.size();
                    while (i < size3) {
                        Object obj3 = arrayList4.get(i);
                        i++;
                        ComponentCallbacksC1023x componentCallbacksC1023x3 = ((X) obj3).f13129b;
                        if (componentCallbacksC1023x3 != null && componentCallbacksC1023x3.f13277W == null) {
                            p3.g(componentCallbacksC1023x3).k();
                        }
                    }
                    p3.f13074h = null;
                    p3.i0();
                    if (h0.P.L(3)) {
                        Log.d("FragmentManager", "Op is being set to null");
                        Log.d("FragmentManager", "OnBackPressedCallback enabled=" + c0110q.f11307a + " for  FragmentManager " + p3);
                    }
                } else if (c0110q.f11307a) {
                    if (h0.P.L(3)) {
                        Log.d("FragmentManager", "Calling popBackStackImmediate via onBackPressed callback");
                    }
                    p3.T();
                } else {
                    if (h0.P.L(3)) {
                        Log.d("FragmentManager", "Calling onBackPressed via onBackPressed callback");
                    }
                    p3.f13073g.c();
                }
                break;
        }
    }

    @Override // d.o
    public void c(d.b bVar) {
        switch (this.f2118d) {
            case 1:
                boolean zL = h0.P.L(2);
                h0.P p3 = (h0.P) this.f2119e;
                if (zL) {
                    Log.v("FragmentManager", "handleOnBackProgressed. PREDICTIVE_BACK = true fragment manager " + p3);
                }
                if (p3.f13074h != null) {
                    int i = 0;
                    for (C1013m c1013m : p3.f(new ArrayList(Collections.singletonList(p3.f13074h)), 0, 1)) {
                        c1013m.getClass();
                        P6.g.e(bVar, "backEvent");
                        if (h0.P.L(2)) {
                            Log.v("FragmentManager", "SpecialEffectsController: Processing Progress " + bVar.f11258c);
                        }
                        ArrayList arrayList = c1013m.f13215c;
                        ArrayList arrayList2 = new ArrayList();
                        int size = arrayList.size();
                        int i5 = 0;
                        while (i5 < size) {
                            Object obj = arrayList.get(i5);
                            i5++;
                            B6.q.d0(((b0) obj).f13188k, arrayList2);
                        }
                        List listX0 = B6.k.x0(B6.k.A0(arrayList2));
                        int size2 = listX0.size();
                        for (int i8 = 0; i8 < size2; i8++) {
                            ((a0) listX0.get(i8)).c(bVar, c1013m.f13213a);
                        }
                    }
                    ArrayList arrayList3 = p3.f13079n;
                    int size3 = arrayList3.size();
                    while (i < size3) {
                        Object obj2 = arrayList3.get(i);
                        i++;
                        ((h0.K) obj2).getClass();
                    }
                }
                break;
            default:
                super.c(bVar);
                break;
        }
    }

    @Override // d.o
    public void d(d.b bVar) {
        switch (this.f2118d) {
            case 1:
                boolean zL = h0.P.L(3);
                h0.P p3 = (h0.P) this.f2119e;
                if (zL) {
                    Log.d("FragmentManager", "handleOnBackStarted. PREDICTIVE_BACK = true fragment manager " + p3);
                }
                p3.w();
                p3.x(new h0.N(p3), false);
                break;
            default:
                super.d(bVar);
                break;
        }
    }
}
