package defpackage;

import android.view.View;
import android.view.ViewGroup;
import ar.tvplayer.tv.R;
import j$.util.Objects;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.WeakHashMap;

/* renamed from: ˇᵧᵭᵚ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0970 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public boolean f4322;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public boolean f4323;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final ViewGroup f4325;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public boolean f4327;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final ArrayList f4326 = new ArrayList();

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final ArrayList f4324 = new ArrayList();

    public C0970(ViewGroup viewGroup) {
        this.f4325 = viewGroup;
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public static void m3305(C1200 c1200, View view) {
        WeakHashMap weakHashMap = AbstractC2873.f11133;
        String transitionName = view.getTransitionName();
        if (transitionName != null) {
            c1200.put(transitionName, 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) {
                    m3305(c1200, childAt);
                }
            }
        }
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public static final C0970 m3306(ViewGroup viewGroup, AbstractC4731 abstractC4731) {
        abstractC4731.m9950();
        Object tag = viewGroup.getTag(R.id._11_res_0x7f0b0375);
        if (tag instanceof C0970) {
            return (C0970) tag;
        }
        C0970 c0970 = new C0970(viewGroup);
        viewGroup.setTag(R.id._11_res_0x7f0b0375, c0970);
        return c0970;
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public static boolean m3307(ArrayList arrayList) {
        boolean z;
        int size = arrayList.size();
        int i = 0;
        loop0: while (true) {
            z = true;
            while (i < size) {
                Object obj = arrayList.get(i);
                i++;
                C0423 c0423 = (C0423) obj;
                if (!c0423.f2350.isEmpty()) {
                    ArrayList arrayList2 = c0423.f2350;
                    if (arrayList2 == null || !arrayList2.isEmpty()) {
                        int size2 = arrayList2.size();
                        int i2 = 0;
                        while (i2 < size2) {
                            Object obj2 = arrayList2.get(i2);
                            i2++;
                            if (!((AbstractC0243) obj2).mo1549()) {
                                break;
                            }
                        }
                    }
                }
                z = false;
            }
            break loop0;
        }
        if (z) {
            ArrayList arrayList3 = new ArrayList();
            int size3 = arrayList.size();
            int i3 = 0;
            while (i3 < size3) {
                Object obj3 = arrayList.get(i3);
                i3++;
                AbstractC2767.m6826(((C0423) obj3).f2350, arrayList3);
            }
            if (!arrayList3.isEmpty()) {
                return true;
            }
        }
        return false;
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final void m3308() {
        boolean z;
        if (this.f4323) {
            return;
        }
        if (!this.f4325.isAttachedToWindow()) {
            m3312();
            this.f4322 = false;
            return;
        }
        synchronized (this.f4326) {
            try {
                ArrayList arrayList = new ArrayList(this.f4324);
                this.f4324.clear();
                int size = arrayList.size();
                int i = 0;
                while (true) {
                    z = true;
                    if (i >= size) {
                        break;
                    }
                    Object obj = arrayList.get(i);
                    i++;
                    C0423 c0423 = (C0423) obj;
                    if (this.f4326.isEmpty() || !c0423.f2345.f13785) {
                        z = false;
                    }
                    c0423.f2343 = z;
                }
                int size2 = arrayList.size();
                int i2 = 0;
                while (i2 < size2) {
                    Object obj2 = arrayList.get(i2);
                    i2++;
                    C0423 c04232 = (C0423) obj2;
                    if (this.f4327) {
                        if (AbstractC4731.m9918(2)) {
                            Objects.toString(c04232);
                        }
                        c04232.m1970();
                    } else {
                        if (AbstractC4731.m9918(2)) {
                            Objects.toString(c04232);
                        }
                        c04232.m1969(this.f4325);
                    }
                    this.f4327 = false;
                    if (!c04232.f2344) {
                        this.f4324.add(c04232);
                    }
                }
                if (!this.f4326.isEmpty()) {
                    m3314();
                    ArrayList arrayList2 = new ArrayList(this.f4326);
                    if (arrayList2.isEmpty()) {
                        return;
                    }
                    this.f4326.clear();
                    this.f4324.addAll(arrayList2);
                    AbstractC4731.m9918(2);
                    m3316(arrayList2, this.f4322);
                    boolean zM3307 = m3307(arrayList2);
                    int size3 = arrayList2.size();
                    int i3 = 0;
                    boolean z2 = true;
                    while (i3 < size3) {
                        Object obj3 = arrayList2.get(i3);
                        i3++;
                        if (!((C0423) obj3).f2345.f13785) {
                            z2 = false;
                        }
                    }
                    if (!z2 || zM3307) {
                        z = false;
                    }
                    this.f4327 = z;
                    AbstractC4731.m9918(2);
                    if (!z2) {
                        m3315(arrayList2);
                        m3311(arrayList2);
                    } else if (zM3307) {
                        m3315(arrayList2);
                        int size4 = arrayList2.size();
                        for (int i4 = 0; i4 < size4; i4++) {
                            m3313((C0423) arrayList2.get(i4));
                        }
                    }
                    this.f4322 = false;
                    AbstractC4731.m9918(2);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public final void m3309() {
        Object objPrevious;
        C3371 c3371;
        synchronized (this.f4326) {
            try {
                m3314();
                ArrayList arrayList = this.f4326;
                ListIterator listIterator = arrayList.listIterator(arrayList.size());
                while (true) {
                    if (!listIterator.hasPrevious()) {
                        objPrevious = null;
                        break;
                    }
                    objPrevious = listIterator.previous();
                    C0423 c0423 = (C0423) objPrevious;
                    View view = c0423.f2345.f13752;
                    char c = 4;
                    if (view.getAlpha() != 0.0f || view.getVisibility() != 0) {
                        int visibility = view.getVisibility();
                        if (visibility == 0) {
                            c = 2;
                        } else if (visibility != 4) {
                            if (visibility != 8) {
                                throw new IllegalArgumentException("Unknown visibility " + visibility);
                            }
                            c = 3;
                        }
                    }
                    if (c0423.f2347 == 2 && c != 2) {
                        break;
                    }
                }
                C0423 c04232 = (C0423) objPrevious;
                AbstractComponentCallbacksC3693 abstractComponentCallbacksC3693 = c04232 != null ? c04232.f2345 : null;
                boolean z = false;
                if (abstractComponentCallbacksC3693 != null && (c3371 = abstractComponentCallbacksC3693.f13765) != null) {
                    z = c3371.f12603;
                }
                this.f4323 = z;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final C0423 m3310(AbstractComponentCallbacksC3693 abstractComponentCallbacksC3693) {
        Object obj;
        ArrayList arrayList = this.f4326;
        int size = arrayList.size();
        int i = 0;
        while (true) {
            if (i >= size) {
                obj = null;
                break;
            }
            obj = arrayList.get(i);
            i++;
            C0423 c0423 = (C0423) obj;
            if (ᵲᵝᵪ.ᵹᵝᵶ(c0423.f2345, abstractComponentCallbacksC3693) && !c0423.f2341) {
                break;
            }
        }
        return (C0423) obj;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void m3311(List list) {
        ArrayList arrayList = new ArrayList();
        Iterator it = list.iterator();
        while (it.hasNext()) {
            AbstractC2767.m6826(((C0423) it.next()).f2350, arrayList);
        }
        List listM6825 = AbstractC2767.m6825(AbstractC2767.m6812(arrayList));
        int size = listM6825.size();
        for (int i = 0; i < size; i++) {
            ((AbstractC0243) listM6825.get(i)).mo1548(this.f4325);
        }
        int size2 = list.size();
        for (int i2 = 0; i2 < size2; i2++) {
            m3313((C0423) list.get(i2));
        }
        List listM68252 = AbstractC2767.m6825(list);
        int size3 = listM68252.size();
        for (int i3 = 0; i3 < size3; i3++) {
            C0423 c0423 = (C0423) listM68252.get(i3);
            if (c0423.f2350.isEmpty()) {
                c0423.m1970();
            }
        }
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final void m3312() {
        AbstractC4731.m9918(2);
        boolean zIsAttachedToWindow = this.f4325.isAttachedToWindow();
        synchronized (this.f4326) {
            try {
                m3314();
                m3315(this.f4326);
                ArrayList arrayList = new ArrayList(this.f4324);
                int size = arrayList.size();
                int i = 0;
                int i2 = 0;
                while (i2 < size) {
                    Object obj = arrayList.get(i2);
                    i2++;
                    ((C0423) obj).f2343 = false;
                }
                int size2 = arrayList.size();
                int i3 = 0;
                while (i3 < size2) {
                    Object obj2 = arrayList.get(i3);
                    i3++;
                    C0423 c0423 = (C0423) obj2;
                    if (AbstractC4731.m9918(2)) {
                        if (!zIsAttachedToWindow) {
                            Objects.toString(this.f4325);
                        }
                        Objects.toString(c0423);
                    }
                    c0423.m1969(this.f4325);
                }
                ArrayList arrayList2 = new ArrayList(this.f4326);
                int size3 = arrayList2.size();
                int i4 = 0;
                while (i4 < size3) {
                    Object obj3 = arrayList2.get(i4);
                    i4++;
                    ((C0423) obj3).f2343 = false;
                }
                int size4 = arrayList2.size();
                while (i < size4) {
                    Object obj4 = arrayList2.get(i);
                    i++;
                    C0423 c04232 = (C0423) obj4;
                    if (AbstractC4731.m9918(2)) {
                        if (!zIsAttachedToWindow) {
                            Objects.toString(this.f4325);
                        }
                        Objects.toString(c04232);
                    }
                    c04232.m1969(this.f4325);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m3313(C0423 c0423) {
        if (c0423.f2346) {
            AbstractC2990.m7328(c0423.f2347, c0423.f2345.m8328(), this.f4325);
            c0423.f2346 = false;
        }
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final void m3314() {
        ArrayList arrayList = this.f4326;
        int size = arrayList.size();
        int i = 0;
        while (i < size) {
            Object obj = arrayList.get(i);
            i++;
            C0423 c0423 = (C0423) obj;
            int i2 = 2;
            if (c0423.f2348 == 2) {
                int visibility = c0423.f2345.m8328().getVisibility();
                if (visibility != 0) {
                    i2 = 4;
                    if (visibility != 4) {
                        if (visibility != 8) {
                            ᵹˉᵞ.ˌᵜᵹᵩ(AbstractC2990.m7313(visibility, "Unknown visibility "));
                            return;
                        }
                        i2 = 3;
                    }
                }
                c0423.m1971(i2, 1);
            }
        }
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final void m3315(List list) {
        int size = list.size();
        for (int i = 0; i < size; i++) {
            C0423 c0423 = (C0423) list.get(i);
            C4534 c4534 = c0423.f2342;
            if (!c0423.f2351) {
                c0423.f2351 = true;
                int i2 = c0423.f2348;
                if (i2 == 2) {
                    AbstractComponentCallbacksC3693 abstractComponentCallbacksC3693 = c4534.f16864;
                    View viewFindFocus = abstractComponentCallbacksC3693.f13752.findFocus();
                    if (viewFindFocus != null) {
                        abstractComponentCallbacksC3693.m8304().f12597 = viewFindFocus;
                        if (AbstractC4731.m9918(2)) {
                            viewFindFocus.toString();
                            abstractComponentCallbacksC3693.toString();
                        }
                    }
                    View viewM8328 = c0423.f2345.m8328();
                    if (viewM8328.getParent() == null) {
                        if (AbstractC4731.m9918(2)) {
                            abstractComponentCallbacksC3693.toString();
                            viewM8328.toString();
                        }
                        c4534.m9633();
                        viewM8328.setAlpha(0.0f);
                    }
                    if (viewM8328.getAlpha() == 0.0f && viewM8328.getVisibility() == 0) {
                        if (AbstractC4731.m9918(2)) {
                            viewM8328.toString();
                        }
                        viewM8328.setVisibility(4);
                    }
                    C3371 c3371 = abstractComponentCallbacksC3693.f13765;
                    viewM8328.setAlpha(c3371 == null ? 1.0f : c3371.f12607);
                    AbstractC4731.m9918(2);
                } else if (i2 == 3) {
                    AbstractComponentCallbacksC3693 abstractComponentCallbacksC36932 = c4534.f16864;
                    View viewM83282 = abstractComponentCallbacksC36932.m8328();
                    if (AbstractC4731.m9918(2)) {
                        Objects.toString(viewM83282.findFocus());
                        viewM83282.toString();
                        abstractComponentCallbacksC36932.toString();
                    }
                    viewM83282.clearFocus();
                }
            }
        }
        ArrayList arrayList = new ArrayList();
        Iterator it = list.iterator();
        while (it.hasNext()) {
            AbstractC2767.m6826(((C0423) it.next()).f2350, arrayList);
        }
        List listM6825 = AbstractC2767.m6825(AbstractC2767.m6812(arrayList));
        int size2 = listM6825.size();
        for (int i3 = 0; i3 < size2; i3++) {
            AbstractC0243 abstractC0243 = (AbstractC0243) listM6825.get(i3);
            if (!abstractC0243.f1786) {
                abstractC0243.mo1547(this.f4325);
            }
            abstractC0243.f1786 = true;
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:178:0x03e5 A[LOOP:19: B:177:0x03e3->B:178:0x03e5, LOOP_END] */
    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void m3316(java.util.ArrayList r26, boolean r27) throws android.content.res.Resources.NotFoundException {
        /*
            Method dump skipped, instructions count: 1198
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C0970.m3316(java.util.ArrayList, boolean):void");
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final C0423 m3317(AbstractComponentCallbacksC3693 abstractComponentCallbacksC3693) {
        Object obj;
        ArrayList arrayList = this.f4324;
        int size = arrayList.size();
        int i = 0;
        while (true) {
            if (i >= size) {
                obj = null;
                break;
            }
            obj = arrayList.get(i);
            i++;
            C0423 c0423 = (C0423) obj;
            if (ᵲᵝᵪ.ᵹᵝᵶ(c0423.f2345, abstractComponentCallbacksC3693) && !c0423.f2341) {
                break;
            }
        }
        return (C0423) obj;
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final void m3318(int i, int i2, C4534 c4534) {
        synchronized (this.f4326) {
            try {
                C0423 c0423M3310 = m3310(c4534.f16864);
                if (c0423M3310 == null) {
                    AbstractComponentCallbacksC3693 abstractComponentCallbacksC3693 = c4534.f16864;
                    c0423M3310 = (abstractComponentCallbacksC3693.f13785 || abstractComponentCallbacksC3693.f13775) ? m3317(abstractComponentCallbacksC3693) : null;
                }
                if (c0423M3310 != null) {
                    c0423M3310.m1971(i, i2);
                    return;
                }
                C0423 c0423 = new C0423(i, i2, c4534);
                this.f4326.add(c0423);
                c0423.f2352.add(new RunnableC0632(this, c0423, 1));
                c0423.f2352.add(new RunnableC0632(this, c0423, 2));
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}
