package androidx.fragment.app;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.graphics.Rect;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import androidx.fragment.app.AbstractC0360q0;
import androidx.fragment.app.C0301e;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import p011d0.C0605h;
import p020g0.C0737f;
import p023h0.C0771a4;
import p023h0.C0829h1;
import p023h0.ViewTreeObserver$OnPreDrawListenerC0801d1;
import p037m.C1444a;

/* renamed from: androidx.fragment.app.c */
/* loaded from: classes.dex */
public class C0280c extends AbstractC0360q0 {

    /* renamed from: androidx.fragment.app.c$a */
    /* loaded from: classes.dex */
    public static /* synthetic */ class C0281a {

        /* renamed from: a */
        public static final /* synthetic */ int[] f1253a;

        static {
            int[] iArr = new int[AbstractC0360q0.C0365e.EnumC0368c.values().length];
            f1253a = iArr;
            try {
                iArr[AbstractC0360q0.C0365e.EnumC0368c.GONE.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f1253a[AbstractC0360q0.C0365e.EnumC0368c.INVISIBLE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f1253a[AbstractC0360q0.C0365e.EnumC0368c.REMOVED.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                f1253a[AbstractC0360q0.C0365e.EnumC0368c.VISIBLE.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
        }
    }

    /* renamed from: androidx.fragment.app.c$b */
    /* loaded from: classes.dex */
    public class RunnableC0282b implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ List f1254d;

        /* renamed from: e */
        public final /* synthetic */ AbstractC0360q0.C0365e f1255e;

        public RunnableC0282b(List list, AbstractC0360q0.C0365e c0365e) {
            this.f1254d = list;
            this.f1255e = c0365e;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (this.f1254d.contains(this.f1255e)) {
                this.f1254d.remove(this.f1255e);
                C0280c.this.m4146s(this.f1255e);
            }
        }
    }

    /* renamed from: androidx.fragment.app.c$c */
    /* loaded from: classes.dex */
    public class C0283c extends AnimatorListenerAdapter {

        /* renamed from: a */
        public final /* synthetic */ ViewGroup f1257a;

        /* renamed from: b */
        public final /* synthetic */ View f1258b;

        /* renamed from: c */
        public final /* synthetic */ boolean f1259c;

        /* renamed from: d */
        public final /* synthetic */ AbstractC0360q0.C0365e f1260d;

        /* renamed from: e */
        public final /* synthetic */ C0292k f1261e;

        public C0283c(ViewGroup viewGroup, View view, boolean z, AbstractC0360q0.C0365e c0365e, C0292k c0292k) {
            this.f1257a = viewGroup;
            this.f1258b = view;
            this.f1259c = z;
            this.f1260d = c0365e;
            this.f1261e = c0292k;
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationEnd(Animator animator) {
            this.f1257a.endViewTransition(this.f1258b);
            if (this.f1259c) {
                this.f1260d.m3853e().m3845a(this.f1258b);
            }
            this.f1261e.m4139a();
        }
    }

    /* renamed from: androidx.fragment.app.c$d */
    /* loaded from: classes.dex */
    public class C0284d implements C0605h.InterfaceC0607b {

        /* renamed from: a */
        public final /* synthetic */ Animator f1263a;

        public C0284d(Animator animator) {
            this.f1263a = animator;
        }

        @Override // p011d0.C0605h.InterfaceC0607b
        public void onCancel() {
            this.f1263a.end();
        }
    }

    /* renamed from: androidx.fragment.app.c$e  reason: invalid class name */
    /* loaded from: classes.dex */
    public class animationAnimation$AnimationListenerC0285e implements Animation.AnimationListener {

        /* renamed from: a */
        public final /* synthetic */ ViewGroup f1265a;

        /* renamed from: b */
        public final /* synthetic */ View f1266b;

        /* renamed from: c */
        public final /* synthetic */ C0292k f1267c;

        /* renamed from: androidx.fragment.app.c$e$a */
        /* loaded from: classes.dex */
        public class RunnableC0286a implements Runnable {
            public RunnableC0286a() {
            }

            @Override // java.lang.Runnable
            public void run() {
                animationAnimation$AnimationListenerC0285e animationanimation_animationlistenerc0285e = animationAnimation$AnimationListenerC0285e.this;
                animationanimation_animationlistenerc0285e.f1265a.endViewTransition(animationanimation_animationlistenerc0285e.f1266b);
                animationAnimation$AnimationListenerC0285e.this.f1267c.m4139a();
            }
        }

        public animationAnimation$AnimationListenerC0285e(ViewGroup viewGroup, View view, C0292k c0292k) {
            this.f1265a = viewGroup;
            this.f1266b = view;
            this.f1267c = c0292k;
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationEnd(Animation animation) {
            this.f1265a.post(new RunnableC0286a());
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationRepeat(Animation animation) {
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationStart(Animation animation) {
        }
    }

    /* renamed from: androidx.fragment.app.c$f */
    /* loaded from: classes.dex */
    public class C0287f implements C0605h.InterfaceC0607b {

        /* renamed from: a */
        public final /* synthetic */ View f1270a;

        /* renamed from: b */
        public final /* synthetic */ ViewGroup f1271b;

        /* renamed from: c */
        public final /* synthetic */ C0292k f1272c;

        public C0287f(View view, ViewGroup viewGroup, C0292k c0292k) {
            this.f1270a = view;
            this.f1271b = viewGroup;
            this.f1272c = c0292k;
        }

        @Override // p011d0.C0605h.InterfaceC0607b
        public void onCancel() {
            this.f1270a.clearAnimation();
            this.f1271b.endViewTransition(this.f1270a);
            this.f1272c.m4139a();
        }
    }

    /* renamed from: androidx.fragment.app.c$g */
    /* loaded from: classes.dex */
    public class RunnableC0288g implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ AbstractC0360q0.C0365e f1274d;

        /* renamed from: e */
        public final /* synthetic */ AbstractC0360q0.C0365e f1275e;

        /* renamed from: f */
        public final /* synthetic */ boolean f1276f;

        /* renamed from: g */
        public final /* synthetic */ C1444a f1277g;

        public RunnableC0288g(AbstractC0360q0.C0365e c0365e, AbstractC0360q0.C0365e c0365e2, boolean z, C1444a c1444a) {
            this.f1274d = c0365e;
            this.f1275e = c0365e2;
            this.f1276f = z;
            this.f1277g = c1444a;
        }

        @Override // java.lang.Runnable
        public void run() {
            C0379v.m3779f(this.f1274d.m3852f(), this.f1275e.m3852f(), this.f1276f, this.f1277g, false);
        }
    }

    /* renamed from: androidx.fragment.app.c$h */
    /* loaded from: classes.dex */
    public class RunnableC0289h implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ AbstractC0349n0 f1279d;

        /* renamed from: e */
        public final /* synthetic */ View f1280e;

        /* renamed from: f */
        public final /* synthetic */ Rect f1281f;

        public RunnableC0289h(AbstractC0349n0 abstractC0349n0, View view, Rect rect) {
            this.f1279d = abstractC0349n0;
            this.f1280e = view;
            this.f1281f = rect;
        }

        @Override // java.lang.Runnable
        public void run() {
            this.f1279d.m3912k(this.f1280e, this.f1281f);
        }
    }

    /* renamed from: androidx.fragment.app.c$i */
    /* loaded from: classes.dex */
    public class RunnableC0290i implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ ArrayList f1283d;

        public RunnableC0290i(ArrayList arrayList) {
            this.f1283d = arrayList;
        }

        @Override // java.lang.Runnable
        public void run() {
            C0379v.m3786A(this.f1283d, 4);
        }
    }

    /* renamed from: androidx.fragment.app.c$j */
    /* loaded from: classes.dex */
    public class RunnableC0291j implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ C0294m f1285d;

        public RunnableC0291j(C0294m c0294m) {
            this.f1285d = c0294m;
        }

        @Override // java.lang.Runnable
        public void run() {
            this.f1285d.m4139a();
        }
    }

    /* renamed from: androidx.fragment.app.c$k */
    /* loaded from: classes.dex */
    public static class C0292k extends C0293l {

        /* renamed from: c */
        public boolean f1287c;

        /* renamed from: d */
        public boolean f1288d;

        /* renamed from: e */
        public C0301e.C0306d f1289e;

        public C0292k(AbstractC0360q0.C0365e c0365e, C0605h c0605h, boolean z) {
            super(c0365e, c0605h);
            this.f1288d = false;
            this.f1287c = z;
        }

        /* renamed from: e */
        public C0301e.C0306d m4140e(Context context) {
            if (this.f1288d) {
                return this.f1289e;
            }
            C0301e.C0306d m4114c = C0301e.m4114c(context, m4138b().m3852f(), m4138b().m3853e() == AbstractC0360q0.C0365e.EnumC0368c.VISIBLE, this.f1287c);
            this.f1289e = m4114c;
            this.f1288d = true;
            return m4114c;
        }
    }

    /* renamed from: androidx.fragment.app.c$l */
    /* loaded from: classes.dex */
    public static class C0293l {

        /* renamed from: a */
        public final AbstractC0360q0.C0365e f1290a;

        /* renamed from: b */
        public final C0605h f1291b;

        public C0293l(AbstractC0360q0.C0365e c0365e, C0605h c0605h) {
            this.f1290a = c0365e;
            this.f1291b = c0605h;
        }

        /* renamed from: a */
        public void m4139a() {
            this.f1290a.m3854d(this.f1291b);
        }

        /* renamed from: b */
        public AbstractC0360q0.C0365e m4138b() {
            return this.f1290a;
        }

        /* renamed from: c */
        public C0605h m4137c() {
            return this.f1291b;
        }

        /* renamed from: d */
        public boolean m4136d() {
            AbstractC0360q0.C0365e.EnumC0368c enumC0368c;
            AbstractC0360q0.C0365e.EnumC0368c m3843c = AbstractC0360q0.C0365e.EnumC0368c.m3843c(this.f1290a.m3852f().f1162K);
            AbstractC0360q0.C0365e.EnumC0368c m3853e = this.f1290a.m3853e();
            return m3843c == m3853e || !(m3843c == (enumC0368c = AbstractC0360q0.C0365e.EnumC0368c.VISIBLE) || m3853e == enumC0368c);
        }
    }

    /* renamed from: androidx.fragment.app.c$m */
    /* loaded from: classes.dex */
    public static class C0294m extends C0293l {

        /* renamed from: c */
        public final Object f1292c;

        /* renamed from: d */
        public final boolean f1293d;

        /* renamed from: e */
        public final Object f1294e;

        public C0294m(AbstractC0360q0.C0365e c0365e, C0605h c0605h, boolean z, boolean z2) {
            super(c0365e, c0605h);
            boolean z3;
            Object obj;
            if (c0365e.m3853e() == AbstractC0360q0.C0365e.EnumC0368c.VISIBLE) {
                Fragment m3852f = c0365e.m3852f();
                this.f1292c = z ? m3852f.m4274I() : m3852f.m4189s();
                Fragment m3852f2 = c0365e.m3852f();
                z3 = z ? m3852f2.m4207m() : m3852f2.m4210l();
            } else {
                Fragment m3852f3 = c0365e.m3852f();
                this.f1292c = z ? m3852f3.m4270K() : m3852f3.m4180v();
                z3 = true;
            }
            this.f1293d = z3;
            if (z2) {
                Fragment m3852f4 = c0365e.m3852f();
                obj = z ? m3852f4.m4266M() : m3852f4.m4268L();
            } else {
                obj = null;
            }
            this.f1294e = obj;
        }

        /* renamed from: e */
        public AbstractC0349n0 m4135e() {
            AbstractC0349n0 m4134f = m4134f(this.f1292c);
            AbstractC0349n0 m4134f2 = m4134f(this.f1294e);
            if (m4134f == null || m4134f2 == null || m4134f == m4134f2) {
                return m4134f != null ? m4134f : m4134f2;
            }
            throw new IllegalArgumentException("Mixing framework transitions and AndroidX transitions is not allowed. Fragment " + m4138b().m3852f() + " returned Transition " + this.f1292c + " which uses a different Transition  type than its shared element transition " + this.f1294e);
        }

        /* renamed from: f */
        public final AbstractC0349n0 m4134f(Object obj) {
            if (obj == null) {
                return null;
            }
            AbstractC0349n0 abstractC0349n0 = C0379v.f1530b;
            if (abstractC0349n0 == null || !abstractC0349n0.mo3918e(obj)) {
                AbstractC0349n0 abstractC0349n02 = C0379v.f1531c;
                if (abstractC0349n02 == null || !abstractC0349n02.mo3918e(obj)) {
                    throw new IllegalArgumentException("Transition " + obj + " for fragment " + m4138b().m3852f() + " is not a valid framework Transition or AndroidX Transition");
                }
                return abstractC0349n02;
            }
            return abstractC0349n0;
        }

        /* renamed from: g */
        public Object m4133g() {
            return this.f1294e;
        }

        /* renamed from: h */
        public Object m4132h() {
            return this.f1292c;
        }

        /* renamed from: i */
        public boolean m4131i() {
            return this.f1294e != null;
        }

        /* renamed from: j */
        public boolean m4130j() {
            return this.f1293d;
        }
    }

    public C0280c(ViewGroup viewGroup) {
        super(viewGroup);
    }

    @Override // androidx.fragment.app.AbstractC0360q0
    /* renamed from: f */
    public void mo3870f(List<AbstractC0360q0.C0365e> list, boolean z) {
        AbstractC0360q0.C0365e c0365e = null;
        AbstractC0360q0.C0365e c0365e2 = null;
        for (AbstractC0360q0.C0365e c0365e3 : list) {
            AbstractC0360q0.C0365e.EnumC0368c m3843c = AbstractC0360q0.C0365e.EnumC0368c.m3843c(c0365e3.m3852f().f1162K);
            int i = C0281a.f1253a[c0365e3.m3853e().ordinal()];
            if (i == 1 || i == 2 || i == 3) {
                if (m3843c == AbstractC0360q0.C0365e.EnumC0368c.VISIBLE && c0365e == null) {
                    c0365e = c0365e3;
                }
            } else if (i == 4 && m3843c != AbstractC0360q0.C0365e.EnumC0368c.VISIBLE) {
                c0365e2 = c0365e3;
            }
        }
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        ArrayList<AbstractC0360q0.C0365e> arrayList3 = new ArrayList(list);
        for (AbstractC0360q0.C0365e c0365e4 : list) {
            C0605h c0605h = new C0605h();
            c0365e4.m3848j(c0605h);
            arrayList.add(new C0292k(c0365e4, c0605h, z));
            C0605h c0605h2 = new C0605h();
            c0365e4.m3848j(c0605h2);
            boolean z2 = false;
            if (z) {
                if (c0365e4 != c0365e) {
                    arrayList2.add(new C0294m(c0365e4, c0605h2, z, z2));
                    c0365e4.m3857a(new RunnableC0282b(arrayList3, c0365e4));
                }
                z2 = true;
                arrayList2.add(new C0294m(c0365e4, c0605h2, z, z2));
                c0365e4.m3857a(new RunnableC0282b(arrayList3, c0365e4));
            } else {
                if (c0365e4 != c0365e2) {
                    arrayList2.add(new C0294m(c0365e4, c0605h2, z, z2));
                    c0365e4.m3857a(new RunnableC0282b(arrayList3, c0365e4));
                }
                z2 = true;
                arrayList2.add(new C0294m(c0365e4, c0605h2, z, z2));
                c0365e4.m3857a(new RunnableC0282b(arrayList3, c0365e4));
            }
        }
        Map<AbstractC0360q0.C0365e, Boolean> m4141x = m4141x(arrayList2, arrayList3, z, c0365e, c0365e2);
        m4142w(arrayList, arrayList3, m4141x.containsValue(Boolean.TRUE), m4141x);
        for (AbstractC0360q0.C0365e c0365e5 : arrayList3) {
            m4146s(c0365e5);
        }
        arrayList3.clear();
    }

    /* renamed from: s */
    public void m4146s(AbstractC0360q0.C0365e c0365e) {
        c0365e.m3853e().m3845a(c0365e.m3852f().f1162K);
    }

    /* renamed from: t */
    public void m4145t(ArrayList<View> arrayList, View view) {
        if (!(view instanceof ViewGroup)) {
            if (arrayList.contains(view)) {
                return;
            }
            arrayList.add(view);
            return;
        }
        ViewGroup viewGroup = (ViewGroup) view;
        if (C0771a4.m2938a(viewGroup)) {
            if (arrayList.contains(view)) {
                return;
            }
            arrayList.add(viewGroup);
            return;
        }
        int childCount = viewGroup.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View childAt = viewGroup.getChildAt(i);
            if (childAt.getVisibility() == 0) {
                m4145t(arrayList, childAt);
            }
        }
    }

    /* renamed from: u */
    public void m4144u(Map<String, View> map, View view) {
        String m2811w = C0829h1.m2811w(view);
        if (m2811w != null) {
            map.put(m2811w, view);
        }
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            int childCount = viewGroup.getChildCount();
            for (int i = 0; i < childCount; i++) {
                View childAt = viewGroup.getChildAt(i);
                if (childAt.getVisibility() == 0) {
                    m4144u(map, childAt);
                }
            }
        }
    }

    /* renamed from: v */
    public void m4143v(C1444a<String, View> c1444a, Collection<String> collection) {
        Iterator<Map.Entry<String, View>> it = c1444a.entrySet().iterator();
        while (it.hasNext()) {
            if (!collection.contains(C0829h1.m2811w(it.next().getValue()))) {
                it.remove();
            }
        }
    }

    /* renamed from: w */
    public final void m4142w(List<C0292k> list, List<AbstractC0360q0.C0365e> list2, boolean z, Map<AbstractC0360q0.C0365e, Boolean> map) {
        StringBuilder sb;
        String str;
        C0301e.C0306d m4140e;
        ViewGroup m3863m = m3863m();
        Context context = m3863m.getContext();
        ArrayList arrayList = new ArrayList();
        boolean z2 = false;
        for (C0292k c0292k : list) {
            if (c0292k.m4136d() || (m4140e = c0292k.m4140e(context)) == null) {
                c0292k.m4139a();
            } else {
                Animator animator = m4140e.f1315b;
                if (animator == null) {
                    arrayList.add(c0292k);
                } else {
                    AbstractC0360q0.C0365e m4138b = c0292k.m4138b();
                    Fragment m3852f = m4138b.m3852f();
                    if (Boolean.TRUE.equals(map.get(m4138b))) {
                        if (AbstractC0330m.m4049B0(2)) {
                            Log.v("FragmentManager", "Ignoring Animator set on " + m3852f + " as this Fragment was involved in a Transition.");
                        }
                        c0292k.m4139a();
                    } else {
                        boolean z3 = m4138b.m3853e() == AbstractC0360q0.C0365e.EnumC0368c.GONE;
                        if (z3) {
                            list2.remove(m4138b);
                        }
                        View view = m3852f.f1162K;
                        m3863m.startViewTransition(view);
                        animator.addListener(new C0283c(m3863m, view, z3, m4138b, c0292k));
                        animator.setTarget(view);
                        animator.start();
                        c0292k.m4137c().m3279c(new C0284d(animator));
                        z2 = true;
                    }
                }
            }
        }
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            C0292k c0292k2 = (C0292k) it.next();
            AbstractC0360q0.C0365e m4138b2 = c0292k2.m4138b();
            Fragment m3852f2 = m4138b2.m3852f();
            if (z) {
                if (AbstractC0330m.m4049B0(2)) {
                    sb = new StringBuilder();
                    sb.append("Ignoring Animation set on ");
                    sb.append(m3852f2);
                    str = " as Animations cannot run alongside Transitions.";
                    sb.append(str);
                    Log.v("FragmentManager", sb.toString());
                }
                c0292k2.m4139a();
            } else if (z2) {
                if (AbstractC0330m.m4049B0(2)) {
                    sb = new StringBuilder();
                    sb.append("Ignoring Animation set on ");
                    sb.append(m3852f2);
                    str = " as Animations cannot run alongside Animators.";
                    sb.append(str);
                    Log.v("FragmentManager", sb.toString());
                }
                c0292k2.m4139a();
            } else {
                View view2 = m3852f2.f1162K;
                Animation animation = (Animation) C0737f.m3033f(((C0301e.C0306d) C0737f.m3033f(c0292k2.m4140e(context))).f1314a);
                if (m4138b2.m3853e() != AbstractC0360q0.C0365e.EnumC0368c.REMOVED) {
                    view2.startAnimation(animation);
                    c0292k2.m4139a();
                } else {
                    m3863m.startViewTransition(view2);
                    C0301e.RunnableC0307e runnableC0307e = new C0301e.RunnableC0307e(animation, m3863m, view2);
                    runnableC0307e.setAnimationListener(new animationAnimation$AnimationListenerC0285e(m3863m, view2, c0292k2));
                    view2.startAnimation(runnableC0307e);
                }
                c0292k2.m4137c().m3279c(new C0287f(view2, m3863m, c0292k2));
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* renamed from: x */
    public final Map<AbstractC0360q0.C0365e, Boolean> m4141x(List<C0294m> list, List<AbstractC0360q0.C0365e> list2, boolean z, AbstractC0360q0.C0365e c0365e, AbstractC0360q0.C0365e c0365e2) {
        View view;
        Object obj;
        ArrayList<View> arrayList;
        Object obj2;
        ArrayList<View> arrayList2;
        AbstractC0360q0.C0365e c0365e3;
        AbstractC0360q0.C0365e c0365e4;
        View view2;
        Object mo3909n;
        C1444a c1444a;
        ArrayList<View> arrayList3;
        AbstractC0360q0.C0365e c0365e5;
        ArrayList<View> arrayList4;
        Rect rect;
        View view3;
        AbstractC0349n0 abstractC0349n0;
        AbstractC0360q0.C0365e c0365e6;
        View view4;
        boolean z2 = z;
        AbstractC0360q0.C0365e c0365e7 = c0365e;
        AbstractC0360q0.C0365e c0365e8 = c0365e2;
        HashMap hashMap = new HashMap();
        AbstractC0349n0 abstractC0349n02 = null;
        for (C0294m c0294m : list) {
            if (!c0294m.m4136d()) {
                AbstractC0349n0 m4135e = c0294m.m4135e();
                if (abstractC0349n02 == null) {
                    abstractC0349n02 = m4135e;
                } else if (m4135e != null && abstractC0349n02 != m4135e) {
                    throw new IllegalArgumentException("Mixing framework transitions and AndroidX transitions is not allowed. Fragment " + c0294m.m4138b().m3852f() + " returned Transition " + c0294m.m4132h() + " which uses a different Transition  type than other Fragments.");
                }
            }
        }
        if (abstractC0349n02 == null) {
            for (C0294m c0294m2 : list) {
                hashMap.put(c0294m2.m4138b(), Boolean.FALSE);
                c0294m2.m4139a();
            }
            return hashMap;
        }
        View view5 = new View(m3863m().getContext());
        Rect rect2 = new Rect();
        ArrayList<View> arrayList5 = new ArrayList<>();
        ArrayList<View> arrayList6 = new ArrayList<>();
        C1444a c1444a2 = new C1444a();
        Object obj3 = null;
        View view6 = null;
        boolean z3 = false;
        for (C0294m c0294m3 : list) {
            if (!c0294m3.m4131i() || c0365e7 == null || c0365e8 == null) {
                c1444a = c1444a2;
                arrayList3 = arrayList6;
                c0365e5 = c0365e7;
                arrayList4 = arrayList5;
                rect = rect2;
                view3 = view5;
                abstractC0349n0 = abstractC0349n02;
                c0365e6 = c0365e8;
                view6 = view6;
            } else {
                Object mo3923B = abstractC0349n02.mo3923B(abstractC0349n02.mo3916g(c0294m3.m4133g()));
                ArrayList<String> m4264N = c0365e2.m3852f().m4264N();
                ArrayList<String> m4264N2 = c0365e.m3852f().m4264N();
                ArrayList<String> m4262O = c0365e.m3852f().m4262O();
                View view7 = view6;
                int i = 0;
                while (i < m4262O.size()) {
                    int indexOf = m4264N.indexOf(m4262O.get(i));
                    ArrayList<String> arrayList7 = m4262O;
                    if (indexOf != -1) {
                        m4264N.set(indexOf, m4264N2.get(i));
                    }
                    i++;
                    m4262O = arrayList7;
                }
                ArrayList<String> m4262O2 = c0365e2.m3852f().m4262O();
                Fragment m3852f = c0365e.m3852f();
                if (z2) {
                    m3852f.m4186t();
                    c0365e2.m3852f().m4177w();
                } else {
                    m3852f.m4177w();
                    c0365e2.m3852f().m4186t();
                }
                int i2 = 0;
                for (int size = m4264N.size(); i2 < size; size = size) {
                    c1444a2.put(m4264N.get(i2), m4262O2.get(i2));
                    i2++;
                }
                C1444a<String, View> c1444a3 = new C1444a<>();
                m4144u(c1444a3, c0365e.m3852f().f1162K);
                c1444a3.m1383n(m4264N);
                c1444a2.m1383n(c1444a3.keySet());
                C1444a<String, View> c1444a4 = new C1444a<>();
                m4144u(c1444a4, c0365e2.m3852f().f1162K);
                c1444a4.m1383n(m4262O2);
                c1444a4.m1383n(c1444a2.values());
                C0379v.m3761x(c1444a2, c1444a4);
                m4143v(c1444a3, c1444a2.keySet());
                m4143v(c1444a4, c1444a2.values());
                if (c1444a2.isEmpty()) {
                    arrayList5.clear();
                    arrayList6.clear();
                    c1444a = c1444a2;
                    arrayList3 = arrayList6;
                    c0365e5 = c0365e7;
                    arrayList4 = arrayList5;
                    rect = rect2;
                    view3 = view5;
                    abstractC0349n0 = abstractC0349n02;
                    view6 = view7;
                    obj3 = null;
                    c0365e6 = c0365e8;
                } else {
                    C0379v.m3779f(c0365e2.m3852f(), c0365e.m3852f(), z2, c1444a3, true);
                    c1444a = c1444a2;
                    ArrayList<View> arrayList8 = arrayList6;
                    ViewTreeObserver$OnPreDrawListenerC0801d1.m2889a(m3863m(), new RunnableC0288g(c0365e2, c0365e, z, c1444a4));
                    arrayList5.addAll(c1444a3.values());
                    if (m4264N.isEmpty()) {
                        view6 = view7;
                    } else {
                        View view8 = c1444a3.get(m4264N.get(0));
                        abstractC0349n02.mo3901v(mo3923B, view8);
                        view6 = view8;
                    }
                    arrayList3 = arrayList8;
                    arrayList3.addAll(c1444a4.values());
                    if (!m4262O2.isEmpty() && (view4 = c1444a4.get(m4262O2.get(0))) != null) {
                        ViewTreeObserver$OnPreDrawListenerC0801d1.m2889a(m3863m(), new RunnableC0289h(abstractC0349n02, view4, rect2));
                        z3 = true;
                    }
                    abstractC0349n02.mo3897z(mo3923B, view5, arrayList5);
                    arrayList4 = arrayList5;
                    rect = rect2;
                    view3 = view5;
                    abstractC0349n0 = abstractC0349n02;
                    abstractC0349n02.mo3903t(mo3923B, null, null, null, null, mo3923B, arrayList3);
                    Boolean bool = Boolean.TRUE;
                    c0365e5 = c0365e;
                    hashMap.put(c0365e5, bool);
                    c0365e6 = c0365e2;
                    hashMap.put(c0365e6, bool);
                    obj3 = mo3923B;
                }
            }
            c0365e7 = c0365e5;
            arrayList5 = arrayList4;
            rect2 = rect;
            view5 = view3;
            c0365e8 = c0365e6;
            c1444a2 = c1444a;
            z2 = z;
            arrayList6 = arrayList3;
            abstractC0349n02 = abstractC0349n0;
        }
        View view9 = view6;
        C1444a c1444a5 = c1444a2;
        Collection<?> collection = arrayList6;
        AbstractC0360q0.C0365e c0365e9 = c0365e7;
        Collection<?> collection2 = arrayList5;
        Rect rect3 = rect2;
        View view10 = view5;
        AbstractC0349n0 abstractC0349n03 = abstractC0349n02;
        AbstractC0360q0.C0365e c0365e10 = c0365e8;
        ArrayList arrayList9 = new ArrayList();
        Object obj4 = null;
        Object obj5 = null;
        for (C0294m c0294m4 : list) {
            if (c0294m4.m4136d()) {
                hashMap.put(c0294m4.m4138b(), Boolean.FALSE);
                c0294m4.m4139a();
            } else {
                Object mo3916g = abstractC0349n03.mo3916g(c0294m4.m4132h());
                AbstractC0360q0.C0365e m4138b = c0294m4.m4138b();
                boolean z4 = obj3 != null && (m4138b == c0365e9 || m4138b == c0365e10);
                if (mo3916g == null) {
                    if (!z4) {
                        hashMap.put(m4138b, Boolean.FALSE);
                        c0294m4.m4139a();
                    }
                    arrayList2 = collection;
                    arrayList = collection2;
                    view = view10;
                    mo3909n = obj4;
                    c0365e3 = c0365e10;
                    view2 = view9;
                } else {
                    ArrayList<View> arrayList10 = new ArrayList<>();
                    Object obj6 = obj4;
                    m4145t(arrayList10, m4138b.m3852f().f1162K);
                    if (z4) {
                        if (m4138b == c0365e9) {
                            arrayList10.removeAll(collection2);
                        } else {
                            arrayList10.removeAll(collection);
                        }
                    }
                    if (arrayList10.isEmpty()) {
                        abstractC0349n03.mo3922a(mo3916g, view10);
                        arrayList2 = collection;
                        arrayList = collection2;
                        view = view10;
                        c0365e4 = m4138b;
                        obj2 = obj5;
                        c0365e3 = c0365e10;
                        obj = obj6;
                    } else {
                        abstractC0349n03.mo3921b(mo3916g, arrayList10);
                        view = view10;
                        obj = obj6;
                        arrayList = collection2;
                        obj2 = obj5;
                        arrayList2 = collection;
                        c0365e3 = c0365e10;
                        abstractC0349n03.mo3903t(mo3916g, mo3916g, arrayList10, null, null, null, null);
                        if (m4138b.m3853e() == AbstractC0360q0.C0365e.EnumC0368c.GONE) {
                            c0365e4 = m4138b;
                            list2.remove(c0365e4);
                            ArrayList<View> arrayList11 = new ArrayList<>(arrayList10);
                            arrayList11.remove(c0365e4.m3852f().f1162K);
                            abstractC0349n03.mo3905r(mo3916g, c0365e4.m3852f().f1162K, arrayList11);
                            ViewTreeObserver$OnPreDrawListenerC0801d1.m2889a(m3863m(), new RunnableC0290i(arrayList10));
                        } else {
                            c0365e4 = m4138b;
                        }
                    }
                    if (c0365e4.m3853e() == AbstractC0360q0.C0365e.EnumC0368c.VISIBLE) {
                        arrayList9.addAll(arrayList10);
                        if (z3) {
                            abstractC0349n03.mo3902u(mo3916g, rect3);
                        }
                        view2 = view9;
                    } else {
                        view2 = view9;
                        abstractC0349n03.mo3901v(mo3916g, view2);
                    }
                    hashMap.put(c0365e4, Boolean.TRUE);
                    if (c0294m4.m4130j()) {
                        obj5 = abstractC0349n03.mo3909n(obj2, mo3916g, null);
                        mo3909n = obj;
                    } else {
                        mo3909n = abstractC0349n03.mo3909n(obj, mo3916g, null);
                        obj5 = obj2;
                    }
                }
                c0365e10 = c0365e3;
                obj4 = mo3909n;
                view9 = view2;
                view10 = view;
                collection2 = arrayList;
                collection = arrayList2;
            }
        }
        ArrayList<View> arrayList12 = collection;
        ArrayList<View> arrayList13 = collection2;
        AbstractC0360q0.C0365e c0365e11 = c0365e10;
        Object mo3910m = abstractC0349n03.mo3910m(obj5, obj4, obj3);
        for (C0294m c0294m5 : list) {
            if (!c0294m5.m4136d()) {
                Object m4132h = c0294m5.m4132h();
                AbstractC0360q0.C0365e m4138b2 = c0294m5.m4138b();
                boolean z5 = obj3 != null && (m4138b2 == c0365e9 || m4138b2 == c0365e11);
                if (m4132h != null || z5) {
                    if (C0829h1.m2861B(m3863m())) {
                        abstractC0349n03.mo3900w(c0294m5.m4138b().m3852f(), mo3910m, c0294m5.m4137c(), new RunnableC0291j(c0294m5));
                    } else {
                        if (AbstractC0330m.m4049B0(2)) {
                            Log.v("FragmentManager", "SpecialEffectsController: Container " + m3863m() + " has not been laid out. Completing operation " + m4138b2);
                        }
                        c0294m5.m4139a();
                    }
                }
            }
        }
        if (C0829h1.m2861B(m3863m())) {
            C0379v.m3786A(arrayList9, 4);
            ArrayList<String> m3908o = abstractC0349n03.m3908o(arrayList12);
            abstractC0349n03.mo3920c(m3863m(), mo3910m);
            abstractC0349n03.m3898y(m3863m(), arrayList13, arrayList12, m3908o, c1444a5);
            C0379v.m3786A(arrayList9, 0);
            abstractC0349n03.mo3924A(obj3, arrayList13, arrayList12);
            return hashMap;
        }
        return hashMap;
    }
}