package d.k.b;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Looper;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import androidx.activity.OnBackPressedDispatcher;
import com.ifpdos.udi.service.core.pc.R;
import d.k.b.i0;
import d.k.b.m;
import d.k.b.p0;
import d.m.e;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;

/* JADX INFO: loaded from: classes.dex */
public abstract class a0 {
    public boolean A;
    public boolean B;
    public boolean C;
    public boolean D;
    public boolean E;
    public ArrayList<d.k.b.a> F;
    public ArrayList<Boolean> G;
    public ArrayList<d.k.b.m> H;
    public ArrayList<n> I;
    public d0 J;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f2891b;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public ArrayList<d.k.b.a> f2893d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public ArrayList<d.k.b.m> f2894e;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public OnBackPressedDispatcher f2896g;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public x<?> f2906q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public t f2907r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public d.k.b.m f2908s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public d.k.b.m f2909t;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public d.a.e.c<Intent> f2912w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public d.a.e.c<d.a.e.g> f2913x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public d.a.e.c<String[]> f2914y;
    public final ArrayList<l> a = new ArrayList<>();

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final h0 f2892c = new h0();

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final y f2895f = new y(this);

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final d.a.b f2897h = new c(false);

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final AtomicInteger f2898i = new AtomicInteger();

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final Map<String, Bundle> f2899j = Collections.synchronizedMap(new HashMap());

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final Map<String, ?> f2900k = Collections.synchronizedMap(new HashMap());

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public Map<d.k.b.m, HashSet<d.h.f.a>> f2901l = Collections.synchronizedMap(new HashMap());

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final p0.a f2902m = new d();

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final z f2903n = new z(this);

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final CopyOnWriteArrayList<e0> f2904o = new CopyOnWriteArrayList<>();

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public int f2905p = -1;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public w f2910u = new e();

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public x0 f2911v = new f(this);

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public ArrayDeque<k> f2915z = new ArrayDeque<>();
    public Runnable K = new g();

    public class a implements d.a.e.b<d.a.e.a> {
        public a() {
        }

        @Override // d.a.e.b
        public void a(d.a.e.a aVar) {
            StringBuilder sbJ;
            d.a.e.a aVar2 = aVar;
            k kVarPollFirst = a0.this.f2915z.pollFirst();
            if (kVarPollFirst == null) {
                sbJ = new StringBuilder();
                sbJ.append("No IntentSenders were started for ");
                sbJ.append(this);
            } else {
                String str = kVarPollFirst.f2920f;
                int i2 = kVarPollFirst.f2921m;
                d.k.b.m mVarE = a0.this.f2892c.e(str);
                if (mVarE != null) {
                    mVarE.C(i2, aVar2.f1508f, aVar2.f1509m);
                    return;
                }
                sbJ = g.a.a.a.a.J("Intent Sender result delivered for unknown Fragment ", str);
            }
            Log.w("FragmentManager", sbJ.toString());
        }
    }

    public class b implements d.a.e.b<Map<String, Boolean>> {
        public b() {
        }

        @Override // d.a.e.b
        @SuppressLint({"SyntheticAccessor"})
        public void a(Map<String, Boolean> map) {
            String strT;
            Map<String, Boolean> map2 = map;
            ArrayList arrayList = new ArrayList(map2.values());
            int[] iArr = new int[arrayList.size()];
            for (int i2 = 0; i2 < arrayList.size(); i2++) {
                iArr[i2] = ((Boolean) arrayList.get(i2)).booleanValue() ? 0 : -1;
            }
            k kVarPollFirst = a0.this.f2915z.pollFirst();
            if (kVarPollFirst == null) {
                strT = "No permissions were requested for " + this;
            } else {
                String str = kVarPollFirst.f2920f;
                d.k.b.m mVarE = a0.this.f2892c.e(str);
                if (mVarE != null) {
                    mVarE.U();
                    return;
                }
                strT = g.a.a.a.a.t("Permission request result delivered for unknown Fragment ", str);
            }
            Log.w("FragmentManager", strT);
        }
    }

    public class c extends d.a.b {
        public c(boolean z2) {
            super(z2);
        }

        @Override // d.a.b
        public void a() {
            a0 a0Var = a0.this;
            a0Var.C(true);
            if (a0Var.f2897h.a) {
                a0Var.U();
            } else {
                a0Var.f2896g.a();
            }
        }
    }

    public class d implements p0.a {
        public d() {
        }

        public void a(d.k.b.m mVar, d.h.f.a aVar) {
            boolean z2;
            synchronized (aVar) {
                z2 = aVar.a;
            }
            if (z2) {
                return;
            }
            a0 a0Var = a0.this;
            HashSet<d.h.f.a> hashSet = a0Var.f2901l.get(mVar);
            if (hashSet != null && hashSet.remove(aVar) && hashSet.isEmpty()) {
                a0Var.f2901l.remove(mVar);
                if (mVar.f3040m < 5) {
                    a0Var.i(mVar);
                    a0Var.S(mVar, a0Var.f2905p);
                }
            }
        }

        public void b(d.k.b.m mVar, d.h.f.a aVar) {
            a0 a0Var = a0.this;
            if (a0Var.f2901l.get(mVar) == null) {
                a0Var.f2901l.put(mVar, new HashSet<>());
            }
            a0Var.f2901l.get(mVar).add(aVar);
        }
    }

    public class e extends w {
        public e() {
        }

        @Override // d.k.b.w
        public d.k.b.m a(ClassLoader classLoader, String str) {
            x<?> xVar = a0.this.f2906q;
            Context context = xVar.f3169m;
            Objects.requireNonNull(xVar);
            Object obj = d.k.b.m.f3035f;
            try {
                return w.c(context.getClassLoader(), str).getConstructor(new Class[0]).newInstance(new Object[0]);
            } catch (IllegalAccessException e2) {
                throw new m.c(g.a.a.a.a.u("Unable to instantiate fragment ", str, ": make sure class name exists, is public, and has an empty constructor that is public"), e2);
            } catch (InstantiationException e3) {
                throw new m.c(g.a.a.a.a.u("Unable to instantiate fragment ", str, ": make sure class name exists, is public, and has an empty constructor that is public"), e3);
            } catch (NoSuchMethodException e4) {
                throw new m.c(g.a.a.a.a.u("Unable to instantiate fragment ", str, ": could not find Fragment constructor"), e4);
            } catch (InvocationTargetException e5) {
                throw new m.c(g.a.a.a.a.u("Unable to instantiate fragment ", str, ": calling Fragment constructor caused an exception"), e5);
            }
        }
    }

    public class f implements x0 {
        public f(a0 a0Var) {
        }
    }

    public class g implements Runnable {
        public g() {
        }

        @Override // java.lang.Runnable
        public void run() {
            a0.this.C(true);
        }
    }

    public class h implements e0 {

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public final /* synthetic */ d.k.b.m f2919f;

        public h(a0 a0Var, d.k.b.m mVar) {
            this.f2919f = mVar;
        }

        @Override // d.k.b.e0
        public void a(a0 a0Var, d.k.b.m mVar) {
            this.f2919f.F();
        }
    }

    public class i implements d.a.e.b<d.a.e.a> {
        public i() {
        }

        @Override // d.a.e.b
        public void a(d.a.e.a aVar) {
            StringBuilder sbJ;
            d.a.e.a aVar2 = aVar;
            k kVarPollFirst = a0.this.f2915z.pollFirst();
            if (kVarPollFirst == null) {
                sbJ = new StringBuilder();
                sbJ.append("No Activities were started for result for ");
                sbJ.append(this);
            } else {
                String str = kVarPollFirst.f2920f;
                int i2 = kVarPollFirst.f2921m;
                d.k.b.m mVarE = a0.this.f2892c.e(str);
                if (mVarE != null) {
                    mVarE.C(i2, aVar2.f1508f, aVar2.f1509m);
                    return;
                }
                sbJ = g.a.a.a.a.J("Activity result delivered for unknown Fragment ", str);
            }
            Log.w("FragmentManager", sbJ.toString());
        }
    }

    public static class j extends d.a.e.h.a<d.a.e.g, d.a.e.a> {
        @Override // d.a.e.h.a
        public Intent a(Context context, d.a.e.g gVar) {
            Bundle bundleExtra;
            d.a.e.g gVar2 = gVar;
            Intent intent = new Intent("androidx.activity.result.contract.action.INTENT_SENDER_REQUEST");
            Intent intent2 = gVar2.f1526m;
            if (intent2 != null && (bundleExtra = intent2.getBundleExtra("androidx.activity.result.contract.extra.ACTIVITY_OPTIONS_BUNDLE")) != null) {
                intent.putExtra("androidx.activity.result.contract.extra.ACTIVITY_OPTIONS_BUNDLE", bundleExtra);
                intent2.removeExtra("androidx.activity.result.contract.extra.ACTIVITY_OPTIONS_BUNDLE");
                if (intent2.getBooleanExtra("androidx.fragment.extra.ACTIVITY_OPTIONS_BUNDLE", false)) {
                    gVar2 = new d.a.e.g(gVar2.f1525f, null, gVar2.f1527n, gVar2.f1528o);
                }
            }
            intent.putExtra("androidx.activity.result.contract.extra.INTENT_SENDER_REQUEST", gVar2);
            if (a0.M(2)) {
                Log.v("FragmentManager", "CreateIntent created the following intent: " + intent);
            }
            return intent;
        }

        @Override // d.a.e.h.a
        public d.a.e.a c(int i2, Intent intent) {
            return new d.a.e.a(i2, intent);
        }
    }

    @SuppressLint({"BanParcelableUsage"})
    public static class k implements Parcelable {
        public static final Parcelable.Creator<k> CREATOR = new a();

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public String f2920f;

        /* JADX INFO: renamed from: m, reason: collision with root package name */
        public int f2921m;

        public class a implements Parcelable.Creator<k> {
            @Override // android.os.Parcelable.Creator
            public k createFromParcel(Parcel parcel) {
                return new k(parcel);
            }

            @Override // android.os.Parcelable.Creator
            public k[] newArray(int i2) {
                return new k[i2];
            }
        }

        public k(Parcel parcel) {
            this.f2920f = parcel.readString();
            this.f2921m = parcel.readInt();
        }

        public k(String str, int i2) {
            this.f2920f = str;
            this.f2921m = i2;
        }

        @Override // android.os.Parcelable
        public int describeContents() {
            return 0;
        }

        @Override // android.os.Parcelable
        public void writeToParcel(Parcel parcel, int i2) {
            parcel.writeString(this.f2920f);
            parcel.writeInt(this.f2921m);
        }
    }

    public interface l {
        boolean a(ArrayList<d.k.b.a> arrayList, ArrayList<Boolean> arrayList2);
    }

    public class m implements l {
        public final int a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final int f2922b;

        public m(String str, int i2, int i3) {
            this.a = i2;
            this.f2922b = i3;
        }

        @Override // d.k.b.a0.l
        public boolean a(ArrayList<d.k.b.a> arrayList, ArrayList<Boolean> arrayList2) {
            d.k.b.m mVar = a0.this.f2909t;
            if (mVar == null || this.a >= 0 || !mVar.e().U()) {
                return a0.this.V(arrayList, arrayList2, null, this.a, this.f2922b);
            }
            return false;
        }
    }

    public static class n implements m.e {
        public final boolean a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final d.k.b.a f2924b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public int f2925c;

        public void a() {
            boolean z2 = this.f2925c > 0;
            for (d.k.b.m mVar : this.f2924b.f2888p.f2892c.i()) {
                mVar.o0(null);
                if (z2 && mVar.z()) {
                    mVar.q0();
                }
            }
            d.k.b.a aVar = this.f2924b;
            aVar.f2888p.g(aVar, this.a, !z2, true);
        }
    }

    public static boolean M(int i2) {
        return Log.isLoggable("FragmentManager", i2);
    }

    public void A(l lVar, boolean z2) {
        if (!z2) {
            if (this.f2906q == null) {
                if (!this.D) {
                    throw new IllegalStateException("FragmentManager has not been attached to a host.");
                }
                throw new IllegalStateException("FragmentManager has been destroyed");
            }
            if (Q()) {
                throw new IllegalStateException("Can not perform this action after onSaveInstanceState");
            }
        }
        synchronized (this.a) {
            if (this.f2906q == null) {
                if (!z2) {
                    throw new IllegalStateException("Activity has been destroyed");
                }
            } else {
                this.a.add(lVar);
                a0();
            }
        }
    }

    public final void B(boolean z2) {
        if (this.f2891b) {
            throw new IllegalStateException("FragmentManager is already executing transactions");
        }
        if (this.f2906q == null) {
            if (!this.D) {
                throw new IllegalStateException("FragmentManager has not been attached to a host.");
            }
            throw new IllegalStateException("FragmentManager has been destroyed");
        }
        if (Looper.myLooper() != this.f2906q.f3170n.getLooper()) {
            throw new IllegalStateException("Must be called from main thread of fragment host");
        }
        if (!z2 && Q()) {
            throw new IllegalStateException("Can not perform this action after onSaveInstanceState");
        }
        if (this.F == null) {
            this.F = new ArrayList<>();
            this.G = new ArrayList<>();
        }
        this.f2891b = true;
        try {
            F(null, null);
        } finally {
            this.f2891b = false;
        }
    }

    public boolean C(boolean z2) {
        boolean zA;
        B(z2);
        boolean z3 = false;
        while (true) {
            ArrayList<d.k.b.a> arrayList = this.F;
            ArrayList<Boolean> arrayList2 = this.G;
            synchronized (this.a) {
                if (this.a.isEmpty()) {
                    zA = false;
                } else {
                    int size = this.a.size();
                    zA = false;
                    for (int i2 = 0; i2 < size; i2++) {
                        zA |= this.a.get(i2).a(arrayList, arrayList2);
                    }
                    this.a.clear();
                    this.f2906q.f3170n.removeCallbacks(this.K);
                }
            }
            if (!zA) {
                h0();
                x();
                this.f2892c.b();
                return z3;
            }
            this.f2891b = true;
            try {
                X(this.F, this.G);
                e();
                z3 = true;
            } catch (Throwable th) {
                e();
                throw th;
            }
        }
    }

    public void D(l lVar, boolean z2) {
        if (z2 && (this.f2906q == null || this.D)) {
            return;
        }
        B(z2);
        ((d.k.b.a) lVar).a(this.F, this.G);
        this.f2891b = true;
        try {
            X(this.F, this.G);
            e();
            h0();
            x();
            this.f2892c.b();
        } catch (Throwable th) {
            e();
            throw th;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:61:0x014f  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void E(java.util.ArrayList<d.k.b.a> r20, java.util.ArrayList<java.lang.Boolean> r21, int r22, int r23) {
        /*
            Method dump skipped, instruction units count: 710
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.k.b.a0.E(java.util.ArrayList, java.util.ArrayList, int, int):void");
    }

    public final void F(ArrayList<d.k.b.a> arrayList, ArrayList<Boolean> arrayList2) {
        int iIndexOf;
        int iIndexOf2;
        ArrayList<n> arrayList3 = this.I;
        int size = arrayList3 == null ? 0 : arrayList3.size();
        int i2 = 0;
        while (i2 < size) {
            n nVar = this.I.get(i2);
            if (arrayList == null || nVar.a || (iIndexOf2 = arrayList.indexOf(nVar.f2924b)) == -1 || arrayList2 == null || !arrayList2.get(iIndexOf2).booleanValue()) {
                if ((nVar.f2925c == 0) || (arrayList != null && nVar.f2924b.j(arrayList, 0, arrayList.size()))) {
                    this.I.remove(i2);
                    i2--;
                    size--;
                    if (arrayList == null || nVar.a || (iIndexOf = arrayList.indexOf(nVar.f2924b)) == -1 || arrayList2 == null || !arrayList2.get(iIndexOf).booleanValue()) {
                        nVar.a();
                    }
                }
                i2++;
            } else {
                this.I.remove(i2);
                i2--;
                size--;
            }
            d.k.b.a aVar = nVar.f2924b;
            aVar.f2888p.g(aVar, nVar.a, false, false);
            i2++;
        }
    }

    public d.k.b.m G(String str) {
        return this.f2892c.d(str);
    }

    public d.k.b.m H(int i2) {
        h0 h0Var = this.f2892c;
        int size = h0Var.a.size();
        while (true) {
            size--;
            if (size < 0) {
                for (g0 g0Var : h0Var.f2996b.values()) {
                    if (g0Var != null) {
                        d.k.b.m mVar = g0Var.f2988c;
                        if (mVar.H == i2) {
                            return mVar;
                        }
                    }
                }
                return null;
            }
            d.k.b.m mVar2 = h0Var.a.get(size);
            if (mVar2 != null && mVar2.H == i2) {
                return mVar2;
            }
        }
    }

    public final ViewGroup I(d.k.b.m mVar) {
        ViewGroup viewGroup = mVar.P;
        if (viewGroup != null) {
            return viewGroup;
        }
        if (mVar.I > 0 && this.f2907r.c()) {
            View viewB = this.f2907r.b(mVar.I);
            if (viewB instanceof ViewGroup) {
                return (ViewGroup) viewB;
            }
        }
        return null;
    }

    public w J() {
        d.k.b.m mVar = this.f2908s;
        return mVar != null ? mVar.D.J() : this.f2910u;
    }

    public x0 K() {
        d.k.b.m mVar = this.f2908s;
        return mVar != null ? mVar.D.K() : this.f2911v;
    }

    public void L(d.k.b.m mVar) {
        if (M(2)) {
            Log.v("FragmentManager", "hide: " + mVar);
        }
        if (mVar.K) {
            return;
        }
        mVar.K = true;
        mVar.U = true ^ mVar.U;
        e0(mVar);
    }

    public final boolean N(d.k.b.m mVar) {
        a0 a0Var = mVar.F;
        boolean zN = false;
        for (d.k.b.m mVar2 : (ArrayList) a0Var.f2892c.g()) {
            if (mVar2 != null) {
                zN = a0Var.N(mVar2);
            }
            if (zN) {
                return true;
            }
        }
        return false;
    }

    public boolean O(d.k.b.m mVar) {
        a0 a0Var;
        if (mVar == null) {
            return true;
        }
        return mVar.N && ((a0Var = mVar.D) == null || a0Var.O(mVar.G));
    }

    public boolean P(d.k.b.m mVar) {
        if (mVar == null) {
            return true;
        }
        a0 a0Var = mVar.D;
        return mVar.equals(a0Var.f2909t) && P(a0Var.f2908s);
    }

    public boolean Q() {
        return this.B || this.C;
    }

    public void R(int i2, boolean z2) {
        x<?> xVar;
        if (this.f2906q == null && i2 != -1) {
            throw new IllegalStateException("No activity");
        }
        if (z2 || i2 != this.f2905p) {
            this.f2905p = i2;
            h0 h0Var = this.f2892c;
            Iterator<d.k.b.m> it = h0Var.a.iterator();
            while (it.hasNext()) {
                g0 g0Var = h0Var.f2996b.get(it.next().f3044q);
                if (g0Var != null) {
                    g0Var.k();
                }
            }
            Iterator<g0> it2 = h0Var.f2996b.values().iterator();
            while (true) {
                boolean z3 = false;
                if (!it2.hasNext()) {
                    break;
                }
                g0 next = it2.next();
                if (next != null) {
                    next.k();
                    d.k.b.m mVar = next.f2988c;
                    if (mVar.f3051x && !mVar.y()) {
                        z3 = true;
                    }
                    if (z3) {
                        h0Var.k(next);
                    }
                }
            }
            g0();
            if (this.A && (xVar = this.f2906q) != null && this.f2905p == 7) {
                xVar.g();
                this.A = false;
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:102:0x01a8  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x0062  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x0067  */
    /* JADX WARN: Removed duplicated region for block: B:35:0x006c  */
    /* JADX WARN: Removed duplicated region for block: B:37:0x0071  */
    /* JADX WARN: Removed duplicated region for block: B:39:0x0076  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void S(d.k.b.m r14, int r15) {
        /*
            Method dump skipped, instruction units count: 472
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.k.b.a0.S(d.k.b.m, int):void");
    }

    public void T() {
        if (this.f2906q == null) {
            return;
        }
        this.B = false;
        this.C = false;
        this.J.f2968i = false;
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null) {
                mVar.F.T();
            }
        }
    }

    public boolean U() {
        C(false);
        B(true);
        d.k.b.m mVar = this.f2909t;
        if (mVar != null && mVar.e().U()) {
            return true;
        }
        boolean zV = V(this.F, this.G, null, -1, 0);
        if (zV) {
            this.f2891b = true;
            try {
                X(this.F, this.G);
            } finally {
                e();
            }
        }
        h0();
        x();
        this.f2892c.b();
        return zV;
    }

    public boolean V(ArrayList<d.k.b.a> arrayList, ArrayList<Boolean> arrayList2, String str, int i2, int i3) {
        ArrayList<d.k.b.a> arrayList3 = this.f2893d;
        if (arrayList3 == null) {
            return false;
        }
        if (str == null && i2 < 0 && (i3 & 1) == 0) {
            int size = arrayList3.size() - 1;
            if (size < 0) {
                return false;
            }
            arrayList.add(this.f2893d.remove(size));
            arrayList2.add(Boolean.TRUE);
        } else {
            int i4 = -1;
            if (str != null || i2 >= 0) {
                int size2 = arrayList3.size() - 1;
                while (size2 >= 0) {
                    d.k.b.a aVar = this.f2893d.get(size2);
                    if ((str != null && str.equals(aVar.f3007h)) || (i2 >= 0 && i2 == aVar.f2890r)) {
                        break;
                    }
                    size2--;
                }
                if (size2 < 0) {
                    return false;
                }
                if ((i3 & 1) != 0) {
                    while (true) {
                        size2--;
                        if (size2 < 0) {
                            break;
                        }
                        d.k.b.a aVar2 = this.f2893d.get(size2);
                        if (str == null || !str.equals(aVar2.f3007h)) {
                            if (i2 < 0 || i2 != aVar2.f2890r) {
                                break;
                            }
                        }
                    }
                }
                i4 = size2;
            }
            if (i4 == this.f2893d.size() - 1) {
                return false;
            }
            for (int size3 = this.f2893d.size() - 1; size3 > i4; size3--) {
                arrayList.add(this.f2893d.remove(size3));
                arrayList2.add(Boolean.TRUE);
            }
        }
        return true;
    }

    public void W(d.k.b.m mVar) {
        if (M(2)) {
            Log.v("FragmentManager", "remove: " + mVar + " nesting=" + mVar.C);
        }
        boolean z2 = !mVar.y();
        if (!mVar.L || z2) {
            this.f2892c.l(mVar);
            if (N(mVar)) {
                this.A = true;
            }
            mVar.f3051x = true;
            e0(mVar);
        }
    }

    public final void X(ArrayList<d.k.b.a> arrayList, ArrayList<Boolean> arrayList2) {
        if (arrayList.isEmpty()) {
            return;
        }
        if (arrayList.size() != arrayList2.size()) {
            throw new IllegalStateException("Internal error with the back stack records");
        }
        F(arrayList, arrayList2);
        int size = arrayList.size();
        int i2 = 0;
        int i3 = 0;
        while (i2 < size) {
            if (!arrayList.get(i2).f3014o) {
                if (i3 != i2) {
                    E(arrayList, arrayList2, i3, i2);
                }
                i3 = i2 + 1;
                if (arrayList2.get(i2).booleanValue()) {
                    while (i3 < size && arrayList2.get(i3).booleanValue() && !arrayList.get(i3).f3014o) {
                        i3++;
                    }
                }
                E(arrayList, arrayList2, i2, i3);
                i2 = i3 - 1;
            }
            i2++;
        }
        if (i3 != size) {
            E(arrayList, arrayList2, i3, size);
        }
    }

    public void Y(Parcelable parcelable) {
        g0 g0Var;
        if (parcelable == null) {
            return;
        }
        c0 c0Var = (c0) parcelable;
        if (c0Var.f2950f == null) {
            return;
        }
        this.f2892c.f2996b.clear();
        for (f0 f0Var : c0Var.f2950f) {
            if (f0Var != null) {
                d.k.b.m mVar = this.J.f2963d.get(f0Var.f2973m);
                if (mVar != null) {
                    if (M(2)) {
                        Log.v("FragmentManager", "restoreSaveState: re-attaching retained " + mVar);
                    }
                    g0Var = new g0(this.f2903n, this.f2892c, mVar, f0Var);
                } else {
                    g0Var = new g0(this.f2903n, this.f2892c, this.f2906q.f3169m.getClassLoader(), J(), f0Var);
                }
                d.k.b.m mVar2 = g0Var.f2988c;
                mVar2.D = this;
                if (M(2)) {
                    StringBuilder sbF = g.a.a.a.a.F("restoreSaveState: active (");
                    sbF.append(mVar2.f3044q);
                    sbF.append("): ");
                    sbF.append(mVar2);
                    Log.v("FragmentManager", sbF.toString());
                }
                g0Var.m(this.f2906q.f3169m.getClassLoader());
                this.f2892c.j(g0Var);
                g0Var.f2990e = this.f2905p;
            }
        }
        d0 d0Var = this.J;
        Objects.requireNonNull(d0Var);
        for (d.k.b.m mVar3 : new ArrayList(d0Var.f2963d.values())) {
            if (!this.f2892c.c(mVar3.f3044q)) {
                if (M(2)) {
                    Log.v("FragmentManager", "Discarding retained Fragment " + mVar3 + " that was not found in the set of active Fragments " + c0Var.f2950f);
                }
                this.J.c(mVar3);
                mVar3.D = this;
                g0 g0Var2 = new g0(this.f2903n, this.f2892c, mVar3);
                g0Var2.f2990e = 1;
                g0Var2.k();
                mVar3.f3051x = true;
                g0Var2.k();
            }
        }
        h0 h0Var = this.f2892c;
        ArrayList<String> arrayList = c0Var.f2951m;
        h0Var.a.clear();
        if (arrayList != null) {
            for (String str : arrayList) {
                d.k.b.m mVarD = h0Var.d(str);
                if (mVarD == null) {
                    throw new IllegalStateException(g.a.a.a.a.u("No instantiated fragment for (", str, ")"));
                }
                if (M(2)) {
                    Log.v("FragmentManager", "restoreSaveState: added (" + str + "): " + mVarD);
                }
                h0Var.a(mVarD);
            }
        }
        if (c0Var.f2952n != null) {
            this.f2893d = new ArrayList<>(c0Var.f2952n.length);
            int i2 = 0;
            while (true) {
                d.k.b.b[] bVarArr = c0Var.f2952n;
                if (i2 >= bVarArr.length) {
                    break;
                }
                d.k.b.b bVar = bVarArr[i2];
                Objects.requireNonNull(bVar);
                d.k.b.a aVar = new d.k.b.a(this);
                int i3 = 0;
                int i4 = 0;
                while (true) {
                    int[] iArr = bVar.f2926f;
                    if (i3 >= iArr.length) {
                        break;
                    }
                    i0.a aVar2 = new i0.a();
                    int i5 = i3 + 1;
                    aVar2.a = iArr[i3];
                    if (M(2)) {
                        Log.v("FragmentManager", "Instantiate " + aVar + " op #" + i4 + " base fragment #" + bVar.f2926f[i5]);
                    }
                    String str2 = bVar.f2927m.get(i4);
                    aVar2.f3015b = str2 != null ? this.f2892c.d(str2) : null;
                    aVar2.f3020g = e.b.values()[bVar.f2928n[i4]];
                    aVar2.f3021h = e.b.values()[bVar.f2929o[i4]];
                    int[] iArr2 = bVar.f2926f;
                    int i6 = i5 + 1;
                    int i7 = iArr2[i5];
                    aVar2.f3016c = i7;
                    int i8 = i6 + 1;
                    int i9 = iArr2[i6];
                    aVar2.f3017d = i9;
                    int i10 = i8 + 1;
                    int i11 = iArr2[i8];
                    aVar2.f3018e = i11;
                    int i12 = iArr2[i10];
                    aVar2.f3019f = i12;
                    aVar.f3001b = i7;
                    aVar.f3002c = i9;
                    aVar.f3003d = i11;
                    aVar.f3004e = i12;
                    aVar.b(aVar2);
                    i4++;
                    i3 = i10 + 1;
                }
                aVar.f3005f = bVar.f2930p;
                aVar.f3007h = bVar.f2931q;
                aVar.f2890r = bVar.f2932r;
                aVar.f3006g = true;
                aVar.f3008i = bVar.f2933s;
                aVar.f3009j = bVar.f2934t;
                aVar.f3010k = bVar.f2935u;
                aVar.f3011l = bVar.f2936v;
                aVar.f3012m = bVar.f2937w;
                aVar.f3013n = bVar.f2938x;
                aVar.f3014o = bVar.f2939y;
                aVar.c(1);
                if (M(2)) {
                    StringBuilder sbG = g.a.a.a.a.G("restoreAllState: back stack #", i2, " (index ");
                    sbG.append(aVar.f2890r);
                    sbG.append("): ");
                    sbG.append(aVar);
                    Log.v("FragmentManager", sbG.toString());
                    PrintWriter printWriter = new PrintWriter(new v0("FragmentManager"));
                    aVar.f("  ", printWriter, false);
                    printWriter.close();
                }
                this.f2893d.add(aVar);
                i2++;
            }
        } else {
            this.f2893d = null;
        }
        this.f2898i.set(c0Var.f2953o);
        String str3 = c0Var.f2954p;
        if (str3 != null) {
            d.k.b.m mVarG = G(str3);
            this.f2909t = mVarG;
            t(mVarG);
        }
        ArrayList<String> arrayList2 = c0Var.f2955q;
        if (arrayList2 != null) {
            for (int i13 = 0; i13 < arrayList2.size(); i13++) {
                Bundle bundle = c0Var.f2956r.get(i13);
                bundle.setClassLoader(this.f2906q.f3169m.getClassLoader());
                this.f2899j.put(arrayList2.get(i13), bundle);
            }
        }
        this.f2915z = new ArrayDeque<>(c0Var.f2957s);
    }

    public Parcelable Z() {
        int i2;
        d.k.b.b[] bVarArr;
        ArrayList<String> arrayList;
        int size;
        Iterator it = ((HashSet) f()).iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            w0 w0Var = (w0) it.next();
            if (w0Var.f3147e) {
                w0Var.f3147e = false;
                w0Var.c();
            }
        }
        z();
        C(true);
        this.B = true;
        this.J.f2968i = true;
        h0 h0Var = this.f2892c;
        Objects.requireNonNull(h0Var);
        ArrayList<f0> arrayList2 = new ArrayList<>(h0Var.f2996b.size());
        Iterator<g0> it2 = h0Var.f2996b.values().iterator();
        while (true) {
            bVarArr = null;
            bVarArr = null;
            if (!it2.hasNext()) {
                break;
            }
            g0 next = it2.next();
            if (next != null) {
                d.k.b.m mVar = next.f2988c;
                f0 f0Var = new f0(mVar);
                d.k.b.m mVar2 = next.f2988c;
                if (mVar2.f3040m <= -1 || f0Var.f2984x != null) {
                    f0Var.f2984x = mVar2.f3041n;
                } else {
                    Bundle bundle = new Bundle();
                    d.k.b.m mVar3 = next.f2988c;
                    mVar3.V(bundle);
                    mVar3.f3038c0.b(bundle);
                    Parcelable parcelableZ = mVar3.F.Z();
                    if (parcelableZ != null) {
                        bundle.putParcelable(d.k.b.n.FRAGMENTS_TAG, parcelableZ);
                    }
                    next.a.j(next.f2988c, bundle, false);
                    Bundle bundle2 = bundle.isEmpty() ? null : bundle;
                    if (next.f2988c.Q != null) {
                        next.o();
                    }
                    if (next.f2988c.f3042o != null) {
                        if (bundle2 == null) {
                            bundle2 = new Bundle();
                        }
                        bundle2.putSparseParcelableArray("android:view_state", next.f2988c.f3042o);
                    }
                    if (next.f2988c.f3043p != null) {
                        if (bundle2 == null) {
                            bundle2 = new Bundle();
                        }
                        bundle2.putBundle("android:view_registry_state", next.f2988c.f3043p);
                    }
                    if (!next.f2988c.S) {
                        if (bundle2 == null) {
                            bundle2 = new Bundle();
                        }
                        bundle2.putBoolean("android:user_visible_hint", next.f2988c.S);
                    }
                    f0Var.f2984x = bundle2;
                    if (next.f2988c.f3047t != null) {
                        if (bundle2 == null) {
                            f0Var.f2984x = new Bundle();
                        }
                        f0Var.f2984x.putString("android:target_state", next.f2988c.f3047t);
                        int i3 = next.f2988c.f3048u;
                        if (i3 != 0) {
                            f0Var.f2984x.putInt("android:target_req_state", i3);
                        }
                    }
                }
                arrayList2.add(f0Var);
                if (M(2)) {
                    Log.v("FragmentManager", "Saved state of " + mVar + ": " + f0Var.f2984x);
                }
            }
        }
        if (arrayList2.isEmpty()) {
            if (M(2)) {
                Log.v("FragmentManager", "saveAllState: no fragments!");
            }
            return null;
        }
        h0 h0Var2 = this.f2892c;
        synchronized (h0Var2.a) {
            if (h0Var2.a.isEmpty()) {
                arrayList = null;
            } else {
                arrayList = new ArrayList<>(h0Var2.a.size());
                for (d.k.b.m mVar4 : h0Var2.a) {
                    arrayList.add(mVar4.f3044q);
                    if (M(2)) {
                        Log.v("FragmentManager", "saveAllState: adding fragment (" + mVar4.f3044q + "): " + mVar4);
                    }
                }
            }
        }
        ArrayList<d.k.b.a> arrayList3 = this.f2893d;
        if (arrayList3 != null && (size = arrayList3.size()) > 0) {
            bVarArr = new d.k.b.b[size];
            for (i2 = 0; i2 < size; i2++) {
                bVarArr[i2] = new d.k.b.b(this.f2893d.get(i2));
                if (M(2)) {
                    StringBuilder sbG = g.a.a.a.a.G("saveAllState: adding back stack #", i2, ": ");
                    sbG.append(this.f2893d.get(i2));
                    Log.v("FragmentManager", sbG.toString());
                }
            }
        }
        c0 c0Var = new c0();
        c0Var.f2950f = arrayList2;
        c0Var.f2951m = arrayList;
        c0Var.f2952n = bVarArr;
        c0Var.f2953o = this.f2898i.get();
        d.k.b.m mVar5 = this.f2909t;
        if (mVar5 != null) {
            c0Var.f2954p = mVar5.f3044q;
        }
        c0Var.f2955q.addAll(this.f2899j.keySet());
        c0Var.f2956r.addAll(this.f2899j.values());
        c0Var.f2957s = new ArrayList<>(this.f2915z);
        return c0Var;
    }

    public g0 a(d.k.b.m mVar) {
        if (M(2)) {
            Log.v("FragmentManager", "add: " + mVar);
        }
        g0 g0VarH = h(mVar);
        mVar.D = this;
        this.f2892c.j(g0VarH);
        if (!mVar.L) {
            this.f2892c.a(mVar);
            mVar.f3051x = false;
            if (mVar.Q == null) {
                mVar.U = false;
            }
            if (N(mVar)) {
                this.A = true;
            }
        }
        return g0VarH;
    }

    public void a0() {
        synchronized (this.a) {
            ArrayList<n> arrayList = this.I;
            boolean z2 = (arrayList == null || arrayList.isEmpty()) ? false : true;
            boolean z3 = this.a.size() == 1;
            if (z2 || z3) {
                this.f2906q.f3170n.removeCallbacks(this.K);
                this.f2906q.f3170n.post(this.K);
                h0();
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:13:0x0022  */
    /* JADX WARN: Removed duplicated region for block: B:16:0x0029  */
    /* JADX WARN: Removed duplicated region for block: B:24:0x0054  */
    /* JADX WARN: Removed duplicated region for block: B:28:0x0075  */
    /* JADX WARN: Removed duplicated region for block: B:50:0x00ef  */
    /* JADX WARN: Removed duplicated region for block: B:58:? A[RETURN, SYNTHETIC] */
    @android.annotation.SuppressLint({"SyntheticAccessor"})
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void b(d.k.b.x<?> r5, d.k.b.t r6, d.k.b.m r7) {
        /*
            Method dump skipped, instruction units count: 344
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.k.b.a0.b(d.k.b.x, d.k.b.t, d.k.b.m):void");
    }

    public void b0(d.k.b.m mVar, boolean z2) {
        ViewGroup viewGroupI = I(mVar);
        if (viewGroupI == null || !(viewGroupI instanceof u)) {
            return;
        }
        ((u) viewGroupI).setDrawDisappearingViewsLast(!z2);
    }

    public void c(d.k.b.m mVar) {
        if (M(2)) {
            Log.v("FragmentManager", "attach: " + mVar);
        }
        if (mVar.L) {
            mVar.L = false;
            if (mVar.f3050w) {
                return;
            }
            this.f2892c.a(mVar);
            if (M(2)) {
                Log.v("FragmentManager", "add from attach: " + mVar);
            }
            if (N(mVar)) {
                this.A = true;
            }
        }
    }

    public void c0(d.k.b.m mVar, e.b bVar) {
        if (mVar.equals(G(mVar.f3044q)) && (mVar.E == null || mVar.D == this)) {
            mVar.Y = bVar;
            return;
        }
        throw new IllegalArgumentException("Fragment " + mVar + " is not an active fragment of FragmentManager " + this);
    }

    public final void d(d.k.b.m mVar) {
        HashSet<d.h.f.a> hashSet = this.f2901l.get(mVar);
        if (hashSet != null) {
            Iterator<d.h.f.a> it = hashSet.iterator();
            while (it.hasNext()) {
                it.next().a();
            }
            hashSet.clear();
            i(mVar);
            this.f2901l.remove(mVar);
        }
    }

    public void d0(d.k.b.m mVar) {
        if (mVar == null || (mVar.equals(G(mVar.f3044q)) && (mVar.E == null || mVar.D == this))) {
            d.k.b.m mVar2 = this.f2909t;
            this.f2909t = mVar;
            t(mVar2);
            t(this.f2909t);
            return;
        }
        throw new IllegalArgumentException("Fragment " + mVar + " is not an active fragment of FragmentManager " + this);
    }

    public final void e() {
        this.f2891b = false;
        this.G.clear();
        this.F.clear();
    }

    public final void e0(d.k.b.m mVar) {
        ViewGroup viewGroupI = I(mVar);
        if (viewGroupI != null) {
            if (mVar.r() + mVar.q() + mVar.j() + mVar.g() > 0) {
                if (viewGroupI.getTag(R.id.visible_removing_fragment_view_tag) == null) {
                    viewGroupI.setTag(R.id.visible_removing_fragment_view_tag, mVar);
                }
                ((d.k.b.m) viewGroupI.getTag(R.id.visible_removing_fragment_view_tag)).p0(mVar.p());
            }
        }
    }

    public final Set<w0> f() {
        HashSet hashSet = new HashSet();
        Iterator it = ((ArrayList) this.f2892c.f()).iterator();
        while (it.hasNext()) {
            ViewGroup viewGroup = ((g0) it.next()).f2988c.P;
            if (viewGroup != null) {
                hashSet.add(w0.g(viewGroup, K()));
            }
        }
        return hashSet;
    }

    public void f0(d.k.b.m mVar) {
        if (M(2)) {
            Log.v("FragmentManager", "show: " + mVar);
        }
        if (mVar.K) {
            mVar.K = false;
            mVar.U = !mVar.U;
        }
    }

    public void g(d.k.b.a aVar, boolean z2, boolean z3, boolean z4) {
        if (z2) {
            aVar.h(z4);
        } else {
            aVar.g();
        }
        ArrayList arrayList = new ArrayList(1);
        ArrayList arrayList2 = new ArrayList(1);
        arrayList.add(aVar);
        arrayList2.add(Boolean.valueOf(z2));
        if (z3 && this.f2905p >= 1) {
            p0.p(this.f2906q.f3169m, this.f2907r, arrayList, arrayList2, 0, 1, true, this.f2902m);
        }
        if (z4) {
            R(this.f2905p, true);
        }
        for (d.k.b.m mVar : (ArrayList) this.f2892c.g()) {
            if (mVar != null) {
                View view = mVar.Q;
            }
        }
    }

    public final void g0() {
        for (g0 g0Var : (ArrayList) this.f2892c.f()) {
            d.k.b.m mVar = g0Var.f2988c;
            if (mVar.R) {
                if (this.f2891b) {
                    this.E = true;
                } else {
                    mVar.R = false;
                    g0Var.k();
                }
            }
        }
    }

    public g0 h(d.k.b.m mVar) {
        g0 g0VarH = this.f2892c.h(mVar.f3044q);
        if (g0VarH != null) {
            return g0VarH;
        }
        g0 g0Var = new g0(this.f2903n, this.f2892c, mVar);
        g0Var.m(this.f2906q.f3169m.getClassLoader());
        g0Var.f2990e = this.f2905p;
        return g0Var;
    }

    public final void h0() {
        synchronized (this.a) {
            if (!this.a.isEmpty()) {
                this.f2897h.a = true;
                return;
            }
            d.a.b bVar = this.f2897h;
            ArrayList<d.k.b.a> arrayList = this.f2893d;
            bVar.a = (arrayList != null ? arrayList.size() : 0) > 0 && P(this.f2908s);
        }
    }

    public final void i(d.k.b.m mVar) {
        mVar.c0();
        this.f2903n.n(mVar, false);
        mVar.P = null;
        mVar.Q = null;
        mVar.f3036a0 = null;
        mVar.f3037b0.g(null);
        mVar.f3053z = false;
    }

    public void j(d.k.b.m mVar) {
        if (M(2)) {
            Log.v("FragmentManager", "detach: " + mVar);
        }
        if (mVar.L) {
            return;
        }
        mVar.L = true;
        if (mVar.f3050w) {
            if (M(2)) {
                Log.v("FragmentManager", "remove from detach: " + mVar);
            }
            this.f2892c.l(mVar);
            if (N(mVar)) {
                this.A = true;
            }
            e0(mVar);
        }
    }

    public void k(Configuration configuration) {
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null) {
                mVar.onConfigurationChanged(configuration);
                mVar.F.k(configuration);
            }
        }
    }

    public boolean l(MenuItem menuItem) {
        if (this.f2905p < 1) {
            return false;
        }
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null && mVar.a0(menuItem)) {
                return true;
            }
        }
        return false;
    }

    public void m() {
        this.B = false;
        this.C = false;
        this.J.f2968i = false;
        w(1);
    }

    public boolean n(Menu menu, MenuInflater menuInflater) {
        if (this.f2905p < 1) {
            return false;
        }
        ArrayList<d.k.b.m> arrayList = null;
        boolean z2 = false;
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null && O(mVar)) {
                if (!mVar.K ? mVar.F.n(menu, menuInflater) | false : false) {
                    if (arrayList == null) {
                        arrayList = new ArrayList<>();
                    }
                    arrayList.add(mVar);
                    z2 = true;
                }
            }
        }
        if (this.f2894e != null) {
            for (int i2 = 0; i2 < this.f2894e.size(); i2++) {
                d.k.b.m mVar2 = this.f2894e.get(i2);
                if (arrayList == null || !arrayList.contains(mVar2)) {
                    Objects.requireNonNull(mVar2);
                }
            }
        }
        this.f2894e = arrayList;
        return z2;
    }

    public void o() {
        this.D = true;
        C(true);
        z();
        w(-1);
        this.f2906q = null;
        this.f2907r = null;
        this.f2908s = null;
        if (this.f2896g != null) {
            Iterator<d.a.a> it = this.f2897h.f1506b.iterator();
            while (it.hasNext()) {
                it.next().cancel();
            }
            this.f2896g = null;
        }
        d.a.e.c<Intent> cVar = this.f2912w;
        if (cVar != null) {
            cVar.b();
            this.f2913x.b();
            this.f2914y.b();
        }
    }

    public void p() {
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null) {
                mVar.d0();
            }
        }
    }

    public void q(boolean z2) {
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null) {
                mVar.R();
                mVar.F.q(z2);
            }
        }
    }

    public boolean r(MenuItem menuItem) {
        if (this.f2905p < 1) {
            return false;
        }
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null && mVar.e0(menuItem)) {
                return true;
            }
        }
        return false;
    }

    public void s(Menu menu) {
        if (this.f2905p < 1) {
            return;
        }
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null && !mVar.K) {
                mVar.F.s(menu);
            }
        }
    }

    public final void t(d.k.b.m mVar) {
        if (mVar == null || !mVar.equals(G(mVar.f3044q))) {
            return;
        }
        boolean zP = mVar.D.P(mVar);
        Boolean bool = mVar.f3049v;
        if (bool == null || bool.booleanValue() != zP) {
            mVar.f3049v = Boolean.valueOf(zP);
            mVar.T();
            a0 a0Var = mVar.F;
            a0Var.h0();
            a0Var.t(a0Var.f2909t);
        }
    }

    public String toString() {
        Object obj;
        StringBuilder sb = new StringBuilder(128);
        sb.append("FragmentManager{");
        sb.append(Integer.toHexString(System.identityHashCode(this)));
        sb.append(" in ");
        d.k.b.m mVar = this.f2908s;
        if (mVar != null) {
            sb.append(mVar.getClass().getSimpleName());
            sb.append("{");
            obj = this.f2908s;
        } else {
            x<?> xVar = this.f2906q;
            if (xVar == null) {
                sb.append(AbstractJsonLexerKt.NULL);
                sb.append("}}");
                return sb.toString();
            }
            sb.append(xVar.getClass().getSimpleName());
            sb.append("{");
            obj = this.f2906q;
        }
        sb.append(Integer.toHexString(System.identityHashCode(obj)));
        sb.append("}");
        sb.append("}}");
        return sb.toString();
    }

    public void u(boolean z2) {
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null) {
                mVar.S();
                mVar.F.u(z2);
            }
        }
    }

    public boolean v(Menu menu) {
        boolean z2 = false;
        if (this.f2905p < 1) {
            return false;
        }
        for (d.k.b.m mVar : this.f2892c.i()) {
            if (mVar != null && O(mVar) && mVar.f0(menu)) {
                z2 = true;
            }
        }
        return z2;
    }

    public final void w(int i2) {
        try {
            this.f2891b = true;
            for (g0 g0Var : this.f2892c.f2996b.values()) {
                if (g0Var != null) {
                    g0Var.f2990e = i2;
                }
            }
            R(i2, false);
            Iterator it = ((HashSet) f()).iterator();
            while (it.hasNext()) {
                ((w0) it.next()).e();
            }
            this.f2891b = false;
            C(true);
        } catch (Throwable th) {
            this.f2891b = false;
            throw th;
        }
    }

    public final void x() {
        if (this.E) {
            this.E = false;
            g0();
        }
    }

    public void y(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
        int size;
        int size2;
        String strT = g.a.a.a.a.t(str, "    ");
        h0 h0Var = this.f2892c;
        Objects.requireNonNull(h0Var);
        String str2 = str + "    ";
        if (!h0Var.f2996b.isEmpty()) {
            printWriter.print(str);
            printWriter.println("Active Fragments:");
            for (g0 g0Var : h0Var.f2996b.values()) {
                printWriter.print(str);
                if (g0Var != null) {
                    d.k.b.m mVar = g0Var.f2988c;
                    printWriter.println(mVar);
                    mVar.b(str2, fileDescriptor, printWriter, strArr);
                } else {
                    printWriter.println(AbstractJsonLexerKt.NULL);
                }
            }
        }
        int size3 = h0Var.a.size();
        if (size3 > 0) {
            printWriter.print(str);
            printWriter.println("Added Fragments:");
            for (int i2 = 0; i2 < size3; i2++) {
                d.k.b.m mVar2 = h0Var.a.get(i2);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i2);
                printWriter.print(": ");
                printWriter.println(mVar2.toString());
            }
        }
        ArrayList<d.k.b.m> arrayList = this.f2894e;
        if (arrayList != null && (size2 = arrayList.size()) > 0) {
            printWriter.print(str);
            printWriter.println("Fragments Created Menus:");
            for (int i3 = 0; i3 < size2; i3++) {
                d.k.b.m mVar3 = this.f2894e.get(i3);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i3);
                printWriter.print(": ");
                printWriter.println(mVar3.toString());
            }
        }
        ArrayList<d.k.b.a> arrayList2 = this.f2893d;
        if (arrayList2 != null && (size = arrayList2.size()) > 0) {
            printWriter.print(str);
            printWriter.println("Back Stack:");
            for (int i4 = 0; i4 < size; i4++) {
                d.k.b.a aVar = this.f2893d.get(i4);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i4);
                printWriter.print(": ");
                printWriter.println(aVar.toString());
                aVar.f(strT, printWriter, true);
            }
        }
        printWriter.print(str);
        printWriter.println("Back Stack Index: " + this.f2898i.get());
        synchronized (this.a) {
            int size4 = this.a.size();
            if (size4 > 0) {
                printWriter.print(str);
                printWriter.println("Pending Actions:");
                for (int i5 = 0; i5 < size4; i5++) {
                    Object obj = (l) this.a.get(i5);
                    printWriter.print(str);
                    printWriter.print("  #");
                    printWriter.print(i5);
                    printWriter.print(": ");
                    printWriter.println(obj);
                }
            }
        }
        printWriter.print(str);
        printWriter.println("FragmentManager misc state:");
        printWriter.print(str);
        printWriter.print("  mHost=");
        printWriter.println(this.f2906q);
        printWriter.print(str);
        printWriter.print("  mContainer=");
        printWriter.println(this.f2907r);
        if (this.f2908s != null) {
            printWriter.print(str);
            printWriter.print("  mParent=");
            printWriter.println(this.f2908s);
        }
        printWriter.print(str);
        printWriter.print("  mCurState=");
        printWriter.print(this.f2905p);
        printWriter.print(" mStateSaved=");
        printWriter.print(this.B);
        printWriter.print(" mStopped=");
        printWriter.print(this.C);
        printWriter.print(" mDestroyed=");
        printWriter.println(this.D);
        if (this.A) {
            printWriter.print(str);
            printWriter.print("  mNeedMenuInvalidate=");
            printWriter.println(this.A);
        }
    }

    public final void z() {
        Iterator it = ((HashSet) f()).iterator();
        while (it.hasNext()) {
            ((w0) it.next()).e();
        }
    }
}
