package androidx.leanback.widget;

import android.content.Context;
import android.graphics.Rect;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.view.FocusFinder;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator;
import android.widget.Scroller;
import androidx.recyclerview.widget.RecyclerView;
import defpackage.AbstractC0545;
import defpackage.AbstractC0614;
import defpackage.AbstractC0775;
import defpackage.AbstractC1307;
import defpackage.AbstractC1935;
import defpackage.AbstractC2030;
import defpackage.AbstractC2313;
import defpackage.AbstractC2873;
import defpackage.AbstractC2990;
import defpackage.AbstractC4624;
import defpackage.AbstractC4987;
import defpackage.C0030;
import defpackage.C0058;
import defpackage.C0398;
import defpackage.C1041;
import defpackage.C1390;
import defpackage.C1529;
import defpackage.C1809;
import defpackage.C1923;
import defpackage.C1943;
import defpackage.C2283;
import defpackage.C2487;
import defpackage.C2503;
import defpackage.C2658;
import defpackage.C2747;
import defpackage.C2931;
import defpackage.C2939;
import defpackage.C3234;
import defpackage.C3457;
import defpackage.C3513;
import defpackage.C3526;
import defpackage.C3839;
import defpackage.C4276;
import defpackage.C5209;
import defpackage.InterfaceC0231;
import defpackage.RunnableC2802;
import java.util.ArrayList;
import java.util.WeakHashMap;

/* loaded from: classes3.dex */
public final class GridLayoutManager extends AbstractC1935 {

    /* renamed from: ˆᵴᵜˏ, reason: contains not printable characters */
    public static final Rect f390 = new Rect();

    /* renamed from: ﹶـ, reason: contains not printable characters */
    public static final int[] f391 = new int[2];

    /* renamed from: ʾᵻᵭٴ, reason: contains not printable characters */
    public final RunnableC2802 f392;

    /* renamed from: ˀˁᵨ, reason: contains not printable characters */
    public final ᵧˉʙ f393;

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public C4276 f394;

    /* renamed from: ˀᵗᵩ, reason: contains not printable characters */
    public int f395;

    /* renamed from: ˁˑᵰ, reason: contains not printable characters */
    public int f396;

    /* renamed from: ˆᵼᵷˊ, reason: contains not printable characters */
    public int f397;

    /* renamed from: ˊʽˎ, reason: contains not printable characters */
    public int f398;

    /* renamed from: ˊʾˊ, reason: contains not printable characters */
    public int f399;

    /* renamed from: ˊᵸˊ, reason: contains not printable characters */
    public int f400;

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public float f401;

    /* renamed from: ˌᵪ, reason: contains not printable characters */
    public int f402;

    /* renamed from: ˌᵹᵨˑ, reason: contains not printable characters */
    public final int[] f403;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public ArrayList f404;

    /* renamed from: ˎᵬˀ, reason: contains not printable characters */
    public AbstractC2030 f405;

    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public int[] f406;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public InterfaceC0231 f407;

    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public int f408;

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public C2747 f409;

    /* renamed from: ᵙᵢᵨᵳ, reason: contains not printable characters */
    public int f410;

    /* renamed from: ᵛˈᵤ, reason: contains not printable characters */
    public int f411;

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public int f412;

    /* renamed from: ᵠᵿː, reason: contains not printable characters */
    public final C3513 f413;

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public int f414;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public int f415;

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public int f416;

    /* renamed from: ᵡᵶᵡ, reason: contains not printable characters */
    public int f417;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public AudioManager f418;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public int f419;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public int[] f420;

    /* renamed from: ᵤᵼˑʠ, reason: contains not printable characters */
    public C3526 f421;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public int f422;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public C1529 f423;

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public AbstractC4987 f424;

    /* renamed from: ᵫᵮʾ, reason: contains not printable characters */
    public int f425;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public int f426;

    /* renamed from: ᵳᵹᵺˋ, reason: contains not printable characters */
    public int f427;

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public int f428;

    /* renamed from: ᵷᵱ, reason: contains not printable characters */
    public int f429;

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public AbstractC0545 f430;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public AbstractC4624 f431;

    /* renamed from: ᵺᵠ, reason: contains not printable characters */
    public final C2931 f432;

    /* renamed from: ᵽʛ, reason: contains not printable characters */
    public final C0030 f433;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final SparseIntArray f434;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public int f435;

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public int f436;

    public GridLayoutManager() {
        this(null);
    }

    public GridLayoutManager(AbstractC0545 abstractC0545) {
        this.f401 = 1.0f;
        this.f414 = 10;
        this.f412 = 0;
        this.f424 = new C0058(this, 0);
        this.f434 = new SparseIntArray();
        this.f415 = 221696;
        this.f407 = null;
        this.f404 = null;
        this.f426 = -1;
        this.f422 = 0;
        this.f428 = 0;
        this.f427 = 8388659;
        this.f398 = 1;
        this.f425 = 0;
        this.f433 = new C0030(4);
        this.f393 = new ᵧˉʙ(24);
        this.f403 = new int[2];
        C3513 c3513 = new C3513();
        c3513.f13183 = 0;
        c3513.f13182 = 100;
        this.f413 = c3513;
        this.f392 = new RunnableC2802(13, this);
        this.f432 = new C2931(this);
        this.f430 = abstractC0545;
        this.f396 = -1;
        m5423(false);
    }

    /* renamed from: ʾᵵᵯ, reason: contains not printable characters */
    public static int m255(View view) {
        C5209 c5209 = (C5209) view.getLayoutParams();
        return AbstractC1935.m5413(view) + ((ViewGroup.MarginLayoutParams) c5209).leftMargin + ((ViewGroup.MarginLayoutParams) c5209).rightMargin;
    }

    /* renamed from: ˉʽʾ, reason: contains not printable characters */
    public static int m256(View view) {
        C5209 c5209;
        if (view == null || (c5209 = (C5209) view.getLayoutParams()) == null || c5209.f7733.m6031()) {
            return -1;
        }
        return c5209.f7733.m6030();
    }

    /* renamed from: ᐧʼ, reason: contains not printable characters */
    public static int m257(View view) {
        C5209 c5209 = (C5209) view.getLayoutParams();
        return AbstractC1935.m5414(view) + ((ViewGroup.MarginLayoutParams) c5209).topMargin + ((ViewGroup.MarginLayoutParams) c5209).bottomMargin;
    }

    /* renamed from: ᵤˉᵩ, reason: contains not printable characters */
    public static int m258(View view, View view2) {
        ᵿʤˑᵦ r0;
        if (view == null || view2 == null || (r0 = ((C5209) view.getLayoutParams()).f19439) == null) {
            return 0;
        }
        C1809[] c1809Arr = (C1809[]) r0.ᵢˇᵭ;
        if (c1809Arr.length <= 1) {
            return 0;
        }
        while (view2 != view) {
            int id = view2.getId();
            if (id != -1) {
                for (int i = 1; i < c1809Arr.length; i++) {
                    if (c1809Arr[i].f7286 == id) {
                        return i;
                    }
                }
            }
            view2 = (View) view2.getParent();
        }
        return 0;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ʾˋˊᵽ, reason: contains not printable characters */
    public final boolean mo259(RecyclerView recyclerView, View view, View view2) {
        if ((this.f415 & 32768) == 0 && m256(view) != -1 && (this.f415 & 35) == 0) {
            m280(view, view2, true, 0, 0);
        }
        return true;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ʾᵻᵭٴ, reason: contains not printable characters */
    public final void mo260(C4276 c4276, C1529 c1529, C2487 c2487) {
        AccessibilityNodeInfo accessibilityNodeInfo = c2487.f9712;
        m287(c4276, c1529);
        int iM4454 = c1529.m4454();
        int i = this.f415;
        boolean z = (262144 & i) != 0;
        if ((i & 2048) == 0 || (iM4454 > 1 && !m263(0))) {
            if (this.f412 == 0) {
                c2487.m6332(z ? C1390.f5709 : C1390.f5711);
            } else {
                c2487.m6332(C1390.f5706);
            }
            accessibilityNodeInfo.setScrollable(true);
        }
        if ((this.f415 & 4096) == 0 || (iM4454 > 1 && !m263(iM4454 - 1))) {
            if (this.f412 == 0) {
                c2487.m6332(z ? C1390.f5711 : C1390.f5709);
            } else {
                c2487.m6332(C1390.f5708);
            }
            accessibilityNodeInfo.setScrollable(true);
        }
        accessibilityNodeInfo.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(mo283(c4276, c1529), mo303(c4276, c1529), false, 0));
        accessibilityNodeInfo.setClassName("android.widget.GridView");
        m278();
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ʿᵘˆ, reason: contains not printable characters */
    public final void mo261(C1529 c1529) {
    }

    /* renamed from: ʿᵽˀᵧ, reason: contains not printable characters */
    public final void m262() {
        int i;
        int i2 = this.f415;
        if ((65600 & i2) == 65536) {
            AbstractC2030 abstractC2030 = this.f405;
            int i3 = this.f426;
            if ((i2 & 262144) != 0) {
                i = -this.f429;
            } else {
                i = this.f429 + this.f399;
            }
            while (true) {
                int i4 = abstractC2030.f8145;
                if (i4 >= abstractC2030.f8146 && i4 > i3) {
                    boolean z = abstractC2030.f8147;
                    C2931 c2931 = abstractC2030.f8150;
                    if (!z) {
                        if (c2931.m7145(i4) < i) {
                            break;
                        }
                        abstractC2030.f8150.m7140(abstractC2030.f8145);
                        abstractC2030.f8145--;
                    } else {
                        if (c2931.m7145(i4) > i) {
                            break;
                        }
                        abstractC2030.f8150.m7140(abstractC2030.f8145);
                        abstractC2030.f8145--;
                    }
                } else {
                    break;
                }
            }
            if (abstractC2030.f8145 < abstractC2030.f8146) {
                abstractC2030.m5618();
            }
        }
    }

    /* renamed from: ˀʾʽʤ, reason: contains not printable characters */
    public final boolean m263(int i) {
        AbstractC2313 abstractC2313M582 = this.f430.m582(i);
        if (abstractC2313M582 == null) {
            return false;
        }
        View view = abstractC2313M582.f9071;
        return view.getLeft() >= 0 && view.getRight() <= this.f430.getWidth() && view.getTop() >= 0 && view.getBottom() <= this.f430.getHeight();
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:26:0x0053  */
    /* JADX WARN: Removed duplicated region for block: B:27:0x0055  */
    /* JADX WARN: Removed duplicated region for block: B:29:0x005b  */
    /* JADX WARN: Removed duplicated region for block: B:43:0x007a A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:45:0x0083  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x0088  */
    /* JADX WARN: Removed duplicated region for block: B:54:0x0098  */
    /* JADX WARN: Removed duplicated region for block: B:56:0x009b  */
    /* JADX WARN: Removed duplicated region for block: B:57:0x00a4  */
    /* JADX WARN: Removed duplicated region for block: B:59:0x00a7  */
    /* JADX WARN: Removed duplicated region for block: B:62:0x00b1  */
    /* JADX WARN: Removed duplicated region for block: B:64:0x00b5  */
    /* JADX WARN: Removed duplicated region for block: B:66:0x00b8  */
    /* JADX WARN: Removed duplicated region for block: B:67:0x00ba  */
    /* JADX WARN: Type inference failed for: r16v11, types: [boolean] */
    /* JADX WARN: Type inference failed for: r16v2 */
    /* JADX WARN: Type inference failed for: r16v3 */
    /* JADX WARN: Type inference failed for: r16v6, types: [boolean] */
    /* JADX WARN: Type inference failed for: r16v7 */
    /* JADX WARN: Type inference failed for: r16v8 */
    @Override // defpackage.AbstractC1935
    /* 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 boolean mo264(androidx.recyclerview.widget.RecyclerView r18, java.util.ArrayList r19, int r20, int r21) {
        /*
            Method dump skipped, instructions count: 358
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.leanback.widget.GridLayoutManager.mo264(androidx.recyclerview.widget.RecyclerView, java.util.ArrayList, int, int):boolean");
    }

    /* renamed from: ˀˈᵕᵳ, reason: contains not printable characters */
    public final void m265() {
        C3234 c3234 = (C3234) this.f433.f1152;
        int i = c3234.f12171 - this.f436;
        int iM327 = m327() + i;
        c3234.m7574(i, iM327, i, iM327);
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final void mo266(View view, Rect rect) {
        super.mo266(view, rect);
        C5209 c5209 = (C5209) view.getLayoutParams();
        rect.left += c5209.f19437;
        rect.top += c5209.f19436;
        rect.right -= c5209.f19442;
        rect.bottom -= c5209.f19438;
    }

    /* renamed from: ˁˊᵞ, reason: contains not printable characters */
    public final boolean m267() {
        int iM5443 = m5443();
        return iM5443 == 0 || this.f430.m582(iM5443 - 1) != null;
    }

    /* renamed from: ˆʜٴᵿ, reason: contains not printable characters */
    public final int m268(int i) {
        int i2 = this.f416;
        if (i2 != 0) {
            return i2;
        }
        int[] iArr = this.f406;
        if (iArr == null) {
            return 0;
        }
        return iArr[i];
    }

    /* renamed from: ˆᵲᵧ, reason: contains not printable characters */
    public final void m269() {
        int i;
        int i2;
        int iM4454;
        int iM44542;
        int i3;
        int i4;
        int top;
        int i5;
        int top2;
        int i6;
        if (this.f423.m4454() == 0) {
            return;
        }
        int i7 = this.f415 & 262144;
        AbstractC2030 abstractC2030 = this.f405;
        if (i7 == 0) {
            i = abstractC2030.f8145;
            iM44542 = this.f423.m4454() - 1;
            i2 = this.f405.f8146;
            iM4454 = 0;
        } else {
            i = abstractC2030.f8146;
            i2 = abstractC2030.f8145;
            iM4454 = this.f423.m4454() - 1;
            iM44542 = 0;
        }
        if (i < 0 || i2 < 0) {
            return;
        }
        boolean z = i == iM44542;
        boolean z2 = i2 == iM4454;
        int iM5613 = Integer.MIN_VALUE;
        int iM5611 = Integer.MAX_VALUE;
        C0030 c0030 = this.f433;
        if (!z) {
            C3234 c3234 = (C3234) c0030.f1154;
            if (c3234.f12169 == Integer.MAX_VALUE && !z2 && c3234.f12170 == Integer.MIN_VALUE) {
                return;
            }
        }
        int[] iArr = f391;
        if (z) {
            iM5611 = this.f405.m5611(iArr);
            View viewMo518 = mo518(iArr[1]);
            if (this.f412 == 0) {
                C5209 c5209 = (C5209) viewMo518.getLayoutParams();
                c5209.getClass();
                top2 = viewMo518.getLeft() + c5209.f19437;
                i6 = c5209.f19440;
            } else {
                C5209 c52092 = (C5209) viewMo518.getLayoutParams();
                c52092.getClass();
                top2 = viewMo518.getTop() + c52092.f19436;
                i6 = c52092.f19441;
            }
            int i8 = top2 + i6;
            int[] iArr2 = ((C5209) viewMo518.getLayoutParams()).f19435;
            i3 = (iArr2 == null || iArr2.length <= 0) ? i8 : (iArr2[iArr2.length - 1] - iArr2[0]) + i8;
        } else {
            i3 = Integer.MAX_VALUE;
        }
        if (z2) {
            iM5613 = this.f405.m5613(iArr);
            View viewMo5182 = mo518(iArr[1]);
            if (this.f412 == 0) {
                C5209 c52093 = (C5209) viewMo5182.getLayoutParams();
                c52093.getClass();
                top = viewMo5182.getLeft() + c52093.f19437;
                i5 = c52093.f19440;
            } else {
                C5209 c52094 = (C5209) viewMo5182.getLayoutParams();
                c52094.getClass();
                top = viewMo5182.getTop() + c52094.f19436;
                i5 = c52094.f19441;
            }
            i4 = top + i5;
        } else {
            i4 = Integer.MIN_VALUE;
        }
        ((C3234) c0030.f1154).m7574(iM5613, iM5611, i4, i3);
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ˆᵴᵜˏ, reason: contains not printable characters */
    public final View mo270(View view, int i) {
        View viewFindNextFocus;
        View viewFindNextFocus2;
        if ((this.f415 & 32768) != 0) {
            return view;
        }
        FocusFinder focusFinder = FocusFinder.getInstance();
        if (i == 2 || i == 1) {
            if (mo282()) {
                viewFindNextFocus = focusFinder.findNextFocus(this.f430, view, i == 2 ? 130 : 33);
            } else {
                viewFindNextFocus = null;
            }
            if (mo271()) {
                viewFindNextFocus2 = focusFinder.findNextFocus(this.f430, view, (this.f7785.getLayoutDirection() == 1) ^ (i == 2) ? 66 : 17);
            } else {
                viewFindNextFocus2 = viewFindNextFocus;
            }
        } else {
            viewFindNextFocus2 = focusFinder.findNextFocus(this.f430, view, i);
        }
        if (viewFindNextFocus2 != null) {
            return viewFindNextFocus2;
        }
        int descendantFocusability = this.f430.getDescendantFocusability();
        AbstractC0545 abstractC0545 = this.f430;
        if (descendantFocusability == 393216) {
            return abstractC0545.getParent().focusSearch(view, i);
        }
        int iM275 = m275(i);
        boolean z = abstractC0545.getScrollState() != 0;
        if (iM275 == 1) {
            if (z || (this.f415 & 4096) == 0) {
                viewFindNextFocus2 = view;
            }
            if ((this.f415 & 131072) != 0 && !m267()) {
                m284(true);
                viewFindNextFocus2 = view;
            }
        } else if (iM275 == 0) {
            if (z || (this.f415 & 2048) == 0) {
                viewFindNextFocus2 = view;
            }
            if ((this.f415 & 131072) != 0 && m5443() != 0 && this.f430.m582(0) == null) {
                m284(false);
                viewFindNextFocus2 = view;
            }
        } else if (iM275 == 3) {
        }
        if (viewFindNextFocus2 != null) {
            return viewFindNextFocus2;
        }
        View viewFocusSearch = this.f430.getParent().focusSearch(view, i);
        return viewFocusSearch != null ? viewFocusSearch : view != null ? view : this.f430;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final boolean mo271() {
        return this.f412 == 0 || (!this.f430.isInTouchMode() && this.f417 > 1);
    }

    /* renamed from: ˇᵶᵰʟ, reason: contains not printable characters */
    public final void m272(View view) {
        int iMakeMeasureSpec;
        int childMeasureSpec;
        int childMeasureSpec2;
        C5209 c5209 = (C5209) view.getLayoutParams();
        Rect rect = f390;
        m5445(view, rect);
        int i = ((ViewGroup.MarginLayoutParams) c5209).leftMargin + ((ViewGroup.MarginLayoutParams) c5209).rightMargin + rect.left + rect.right;
        int i2 = ((ViewGroup.MarginLayoutParams) c5209).topMargin + ((ViewGroup.MarginLayoutParams) c5209).bottomMargin + rect.top + rect.bottom;
        int i3 = c5209.f19434;
        if (i3 == -1) {
            iMakeMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.f400, 1073741824);
        } else if (this.f410 == -2) {
            iMakeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
        } else {
            iMakeMeasureSpec = View.MeasureSpec.makeMeasureSpec(((i3 - 1) * this.f402) + (this.f416 * i3), 1073741824);
        }
        if (this.f412 == 0) {
            childMeasureSpec2 = ViewGroup.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(0, 0), i, ((ViewGroup.MarginLayoutParams) c5209).width);
            childMeasureSpec = ViewGroup.getChildMeasureSpec(iMakeMeasureSpec, i2, ((ViewGroup.MarginLayoutParams) c5209).height);
        } else {
            int childMeasureSpec3 = ViewGroup.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(0, 0), i2, ((ViewGroup.MarginLayoutParams) c5209).height);
            int childMeasureSpec4 = ViewGroup.getChildMeasureSpec(iMakeMeasureSpec, i, ((ViewGroup.MarginLayoutParams) c5209).width);
            childMeasureSpec = childMeasureSpec3;
            childMeasureSpec2 = childMeasureSpec4;
        }
        view.measure(childMeasureSpec2, childMeasureSpec);
    }

    /* renamed from: ˈᵕ, reason: contains not printable characters */
    public final View m273(int i) {
        ᵿʤˑᵦ r1;
        View viewM9260 = this.f394.m9260(i);
        C5209 c5209 = (C5209) viewM9260.getLayoutParams();
        if (this.f430.m567(viewM9260) instanceof C2503) {
            int i2 = C2503.f9759;
            r1 = C1041.f4523;
        } else {
            r1 = null;
        }
        c5209.f19439 = r1;
        return viewM9260;
    }

    /* renamed from: ˈᵫˊˉ, reason: contains not printable characters */
    public final void m274() {
        this.f405.mo5617((this.f415 & 262144) != 0 ? (-this.f429) - this.f435 : this.f399 + this.f429 + this.f435, false);
    }

    /* renamed from: ˉʾˈˊ, reason: contains not printable characters */
    public final int m275(int i) {
        int i2 = this.f412;
        if (i2 != 0) {
            if (i2 == 1) {
                if (i == 17) {
                    return (this.f415 & 524288) == 0 ? 2 : 3;
                }
                if (i == 33) {
                    return 0;
                }
                if (i == 66) {
                    return (this.f415 & 524288) == 0 ? 3 : 2;
                }
                if (i == 130) {
                    return 1;
                }
            }
        }
        if (i != 17) {
            if (i == 33) {
                return 2;
            }
            if (i != 66) {
                return i != 130 ? 17 : 3;
            }
            if ((this.f415 & 262144) != 0) {
                return 0;
            }
        } else if ((this.f415 & 262144) == 0) {
            return 0;
        }
        return 1;
    }

    /* renamed from: ˉˉᵕᵽ, reason: contains not printable characters */
    public final void m276(View view, int i, int i2, int i3, int i4) {
        int iM268;
        int i5;
        int iM257 = this.f412 == 0 ? m257(view) : m255(view);
        if (((C5209) view.getLayoutParams()).f19434 == -1) {
            iM257 = this.f400;
            i4 = 0;
        } else if (((C5209) view.getLayoutParams()).f19434 == 1) {
            int i6 = this.f416;
            if (i6 > 0) {
                iM257 = Math.min(iM257, i6);
            }
            int i7 = this.f427;
            int i8 = i7 & 112;
            int absoluteGravity = (this.f415 & 786432) != 0 ? Gravity.getAbsoluteGravity(i7 & 8388615, 1) : i7 & 7;
            int i9 = this.f412;
            if ((i9 != 0 || i8 != 48) && (i9 != 1 || absoluteGravity != 3)) {
                if ((i9 == 0 && i8 == 80) || (i9 == 1 && absoluteGravity == 5)) {
                    iM268 = m268(i) - iM257;
                } else if ((i9 == 0 && i8 == 16) || (i9 == 1 && absoluteGravity == 1)) {
                    iM268 = (m268(i) - iM257) / 2;
                }
                i4 += iM268;
            }
        }
        if (this.f412 == 0) {
            i5 = iM257 + i4;
        } else {
            int i10 = iM257 + i4;
            int i11 = i4;
            i4 = i2;
            i2 = i11;
            i5 = i3;
            i3 = i10;
        }
        C5209 c5209 = (C5209) view.getLayoutParams();
        AbstractC1935.m5411(view, i2, i4, i3, i5);
        Rect rect = f390;
        super.mo266(view, rect);
        int i12 = i2 - rect.left;
        int i13 = i4 - rect.top;
        int i14 = rect.right - i3;
        int i15 = rect.bottom - i5;
        c5209.f19437 = i12;
        c5209.f19436 = i13;
        c5209.f19442 = i14;
        c5209.f19438 = i15;
        m319(view);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:20:0x0035 A[PHI: r2
      0x0035: PHI (r2v23 int) = (r2v22 int), (r2v26 int) binds: [B:19:0x0033, B:12:0x0021] A[DONT_GENERATE, DONT_INLINE]] */
    /* 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 int m277(int r17) {
        /*
            Method dump skipped, instructions count: 297
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.leanback.widget.GridLayoutManager.m277(int):int");
    }

    /* renamed from: ˉᵚʓ, reason: contains not printable characters */
    public final void m278() {
        int i = this.f408 - 1;
        this.f408 = i;
        if (i == 0) {
            this.f394 = null;
            this.f423 = null;
            this.f419 = 0;
            this.f435 = 0;
        }
    }

    /* renamed from: ˊᵱᵵˏ, reason: contains not printable characters */
    public final void m279(int i, int i2, boolean z) {
        View viewMo518 = mo518(i);
        boolean zM5439 = m5439();
        if (!zM5439 && !this.f430.isLayoutRequested() && viewMo518 != null && m256(viewMo518) == i) {
            if (!this.f430.isInTouchMode() || this.f425 == 4) {
                this.f415 |= 32;
                m294(viewMo518, z);
                this.f415 &= -33;
                return;
            } else {
                this.f426 = i;
                this.f422 = i2;
                this.f428 = Integer.MIN_VALUE;
                m325();
                return;
            }
        }
        int i3 = this.f415;
        if ((i3 & 512) == 0 || (i3 & 64) != 0) {
            this.f426 = i;
            this.f422 = i2;
            this.f428 = Integer.MIN_VALUE;
            return;
        }
        if (z && !this.f430.isLayoutRequested()) {
            this.f426 = i;
            this.f422 = i2;
            this.f428 = Integer.MIN_VALUE;
            if (this.f405 == null) {
                this.f430.getId();
                return;
            }
            C0398 c0398 = new C0398(this);
            c0398.f14282 = i;
            mo322(c0398);
            int i4 = c0398.f14282;
            if (i4 != this.f426) {
                this.f426 = i4;
                this.f422 = 0;
                return;
            }
            return;
        }
        if (zM5439) {
            AbstractC4624 abstractC4624 = this.f431;
            if (abstractC4624 != null) {
                abstractC4624.f17106 = true;
            }
            this.f430.m598();
        }
        if (!this.f430.isLayoutRequested() && viewMo518 != null && m256(viewMo518) == i) {
            this.f415 |= 32;
            m294(viewMo518, z);
            this.f415 &= -33;
        } else {
            this.f426 = i;
            this.f422 = i2;
            this.f428 = Integer.MIN_VALUE;
            this.f415 |= 256;
            m5425();
        }
    }

    /* renamed from: ˎʠˌ, reason: contains not printable characters */
    public final void m280(View view, View view2, boolean z, int i, int i2) {
        if ((this.f415 & 64) != 0) {
            return;
        }
        int iM256 = m256(view);
        int iM258 = m258(view, view2);
        if (iM256 != this.f426 || iM258 != this.f422) {
            this.f426 = iM256;
            this.f422 = iM258;
            this.f428 = 0;
            if ((this.f415 & 3) != 1) {
                m325();
            }
            if (this.f430.m549()) {
                this.f430.invalidate();
            }
        }
        if (view == null) {
            return;
        }
        if (!view.hasFocus() && this.f430.hasFocus()) {
            view.requestFocus();
        }
        if ((this.f415 & 131072) == 0 && z) {
            return;
        }
        int[] iArr = f391;
        if (!m290(view, view2, iArr) && i == 0 && i2 == 0) {
            return;
        }
        int i3 = iArr[0] + i;
        int i4 = iArr[1] + i2;
        if ((this.f415 & 3) == 1) {
            m277(i3);
            m311(i4);
            return;
        }
        if (this.f412 != 0) {
            i4 = i3;
            i3 = i4;
        }
        AbstractC0545 abstractC0545 = this.f430;
        if (z) {
            abstractC0545.m589(i3, i4, false);
        } else {
            abstractC0545.scrollBy(i3, i4);
            m289();
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final boolean mo281(C1923 c1923) {
        return c1923 instanceof C5209;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final boolean mo282() {
        return this.f412 == 1 || (!this.f430.isInTouchMode() && this.f417 > 1);
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public final int mo283(C4276 c4276, C1529 c1529) {
        AbstractC2030 abstractC2030;
        return (this.f412 != 0 || (abstractC2030 = this.f405) == null) ? super.mo283(c4276, c1529) : abstractC2030.f8144;
    }

    /* renamed from: ˑᵩᵗ, reason: contains not printable characters */
    public final void m284(boolean z) {
        int i;
        if (z) {
            if (m267()) {
                return;
            }
        } else if (m5443() == 0 || this.f430.m582(0) != null) {
            return;
        }
        C2747 c2747 = this.f409;
        if (c2747 == null) {
            C2747 c27472 = new C2747(this, z ? 1 : -1, this.f417 > 1);
            this.f428 = 0;
            mo322(c27472);
        } else {
            GridLayoutManager gridLayoutManager = c2747.f10620;
            int i2 = c2747.f10619;
            if (z) {
                if (i2 < gridLayoutManager.f414) {
                    c2747.f10619 = i2 + 1;
                }
            } else if (i2 > (-gridLayoutManager.f414)) {
                c2747.f10619 = i2 - 1;
            }
        }
        if (this.f412 == 0) {
            i = 4;
            if (this.f7785.getLayoutDirection() != 1 ? !z : z) {
                i = 3;
            }
        } else {
            i = z ? 2 : 1;
        }
        if (this.f418 == null) {
            this.f418 = (AudioManager) this.f430.getContext().getSystemService("audio");
        }
        this.f418.playSoundEffect(i);
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public final C1923 mo285(Context context, AttributeSet attributeSet) {
        return new C5209(context, attributeSet);
    }

    /* JADX WARN: Removed duplicated region for block: B:17:0x0054  */
    @Override // defpackage.AbstractC1935
    /* 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 android.os.Parcelable mo286() {
        /*
            r8 = this;
            ᵝﹶ r0 = new ᵝﹶ
            r0.<init>()
            android.os.Bundle r1 = android.os.Bundle.EMPTY
            r0.f11398 = r1
            int r1 = r8.f426
            r0.f11399 = r1
            ᵥᵕᵢˌ r1 = r8.f413
            java.lang.Object r2 = r1.f13184
            ᵤᵩᵾ r2 = (defpackage.C3457) r2
            if (r2 == 0) goto L54
            java.lang.Object r3 = r2.f12975
            ᵼᵫᵧˀ r3 = (ᵼᵫᵧˀ) r3
            monitor-enter(r3)
            int r2 = r2.f12977     // Catch: java.lang.Throwable -> L51
            monitor-exit(r3)
            if (r2 != 0) goto L20
            goto L54
        L20:
            java.lang.Object r2 = r1.f13184
            ᵤᵩᵾ r2 = (defpackage.C3457) r2
            java.util.LinkedHashMap r2 = r2.m7854()
            android.os.Bundle r3 = new android.os.Bundle
            r3.<init>()
            java.util.Set r2 = r2.entrySet()
            java.util.Iterator r2 = r2.iterator()
        L35:
            boolean r4 = r2.hasNext()
            if (r4 == 0) goto L55
            java.lang.Object r4 = r2.next()
            java.util.Map$Entry r4 = (java.util.Map.Entry) r4
            java.lang.Object r5 = r4.getKey()
            java.lang.String r5 = (java.lang.String) r5
            java.lang.Object r4 = r4.getValue()
            android.util.SparseArray r4 = (android.util.SparseArray) r4
            r3.putSparseParcelableArray(r5, r4)
            goto L35
        L51:
            r8 = move-exception
            monitor-exit(r3)
            throw r8
        L54:
            r3 = 0
        L55:
            int r2 = r8.m5446()
            r4 = 0
        L5a:
            if (r4 >= r2) goto L84
            android.view.View r5 = r8.m5431(r4)
            int r6 = m256(r5)
            r7 = -1
            if (r6 == r7) goto L81
            int r7 = r1.f13183
            if (r7 == 0) goto L81
            java.lang.String r6 = java.lang.Integer.toString(r6)
            android.util.SparseArray r7 = new android.util.SparseArray
            r7.<init>()
            r5.saveHierarchyState(r7)
            if (r3 != 0) goto L7e
            android.os.Bundle r3 = new android.os.Bundle
            r3.<init>()
        L7e:
            r3.putSparseParcelableArray(r6, r7)
        L81:
            int r4 = r4 + 1
            goto L5a
        L84:
            r0.f11398 = r3
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.leanback.widget.GridLayoutManager.mo286():android.os.Parcelable");
    }

    /* renamed from: ᵔʜᵡʽ, reason: contains not printable characters */
    public final void m287(C4276 c4276, C1529 c1529) {
        int i = this.f408;
        if (i == 0) {
            this.f394 = c4276;
            this.f423 = c1529;
            this.f419 = 0;
            this.f435 = 0;
        }
        this.f408 = i + 1;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵔᵨ, reason: contains not printable characters */
    public final void mo288(int i) {
        m324(i, false);
    }

    /* renamed from: ᵖᵖˊ, reason: contains not printable characters */
    public final void m289() {
        ArrayList arrayList = this.f404;
        if (arrayList == null || arrayList.size() <= 0) {
            return;
        }
        int i = this.f426;
        View viewMo518 = i == -1 ? null : mo518(i);
        if (viewMo518 != null) {
            AbstractC2313 abstractC2313M567 = this.f430.m567(viewMo518);
            int i2 = this.f426;
            ArrayList arrayList2 = this.f404;
            if (arrayList2 == null) {
                return;
            }
            for (int size = arrayList2.size() - 1; size >= 0; size--) {
                ((AbstractC0775) this.f404.get(size)).mo2863(abstractC2313M567, i2);
            }
            return;
        }
        InterfaceC0231 interfaceC0231 = this.f407;
        if (interfaceC0231 != null) {
            interfaceC0231.m1535(null, -1);
        }
        ArrayList arrayList3 = this.f404;
        if (arrayList3 == null) {
            return;
        }
        for (int size2 = arrayList3.size() - 1; size2 >= 0; size2--) {
            ((AbstractC0775) this.f404.get(size2)).mo2863(null, -1);
        }
    }

    /* renamed from: ᵖⁱʣʘ, reason: contains not printable characters */
    public final boolean m290(View view, View view2, int[] iArr) {
        int top;
        int i;
        int left;
        int i2;
        int iM258;
        C0030 c0030 = this.f433;
        C3234 c3234 = (C3234) c0030.f1154;
        if (this.f412 == 0) {
            C5209 c5209 = (C5209) view.getLayoutParams();
            c5209.getClass();
            top = view.getLeft() + c5209.f19437;
            i = c5209.f19440;
        } else {
            C5209 c52092 = (C5209) view.getLayoutParams();
            c52092.getClass();
            top = view.getTop() + c52092.f19436;
            i = c52092.f19441;
        }
        int iM7576 = c3234.m7576(top + i);
        if (view2 != null && (iM258 = m258(view, view2)) != 0) {
            int[] iArr2 = ((C5209) view.getLayoutParams()).f19435;
            iM7576 += iArr2[iM258] - iArr2[0];
        }
        if (this.f412 == 0) {
            C5209 c52093 = (C5209) view.getLayoutParams();
            c52093.getClass();
            left = view.getTop() + c52093.f19436;
            i2 = c52093.f19441;
        } else {
            C5209 c52094 = (C5209) view.getLayoutParams();
            c52094.getClass();
            left = view.getLeft() + c52094.f19437;
            i2 = c52094.f19440;
        }
        int iM75762 = ((C3234) c0030.f1152).m7576(left + i2);
        if (iM7576 == 0 && iM75762 == 0) {
            iArr[0] = 0;
            iArr[1] = 0;
            return false;
        }
        iArr[0] = iM7576;
        iArr[1] = iM75762;
        return true;
    }

    /* renamed from: ᵗᵿ, reason: contains not printable characters */
    public final void m291() {
        int iM5446 = m5446();
        for (int i = 0; i < iM5446; i++) {
            m319(m5431(i));
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:87:0x016a  */
    /* JADX WARN: Removed duplicated region for block: B:89:0x016e  */
    /* 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 boolean m292(boolean r18) {
        /*
            Method dump skipped, instructions count: 391
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.leanback.widget.GridLayoutManager.m292(boolean):boolean");
    }

    /* renamed from: ᵙᵫ, reason: contains not printable characters */
    public final void m293(int i) {
        if (i == 0 || i == 1) {
            this.f412 = i;
            this.f424 = AbstractC4987.m10440(this, i);
            C0030 c0030 = this.f433;
            C3234 c3234 = (C3234) c0030.f1151;
            C3234 c32342 = (C3234) c0030.f1155;
            if (i == 0) {
                c0030.f1154 = c32342;
                c0030.f1152 = c3234;
            } else {
                c0030.f1154 = c3234;
                c0030.f1152 = c32342;
            }
            ᵧˉʙ r0 = this.f393;
            r0.getClass();
            if (i == 0) {
                r0.ᵾᵬ = (C2658) r0.ᵿʗᵝʽ;
            } else {
                r0.ᵾᵬ = (C2658) r0.ᵢˇᵭ;
            }
            this.f415 |= 256;
        }
    }

    /* renamed from: ᵛᵼᐧ, reason: contains not printable characters */
    public final void m294(View view, boolean z) {
        m280(view, view.findFocus(), z, 0, 0);
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final void mo295(int i, int i2, C1529 c1529, C1943 c1943) {
        try {
            m287(null, c1529);
            if (this.f412 != 0) {
                i = i2;
            }
            if (m5446() != 0 && i != 0) {
                this.f405.mo5625(i < 0 ? -this.f429 : this.f399 + this.f429, i, c1943);
                m278();
            }
        } finally {
            m278();
        }
    }

    /* renamed from: ᵞː, reason: contains not printable characters */
    public final int m296(View view) {
        Rect rect = f390;
        mo266(view, rect);
        return this.f412 == 0 ? rect.width() : rect.height();
    }

    /* JADX WARN: Removed duplicated region for block: B:129:0x02be A[LOOP:3: B:128:0x02bc->B:129:0x02be, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:132:0x02dc  */
    /* JADX WARN: Removed duplicated region for block: B:143:0x0300  */
    /* JADX WARN: Removed duplicated region for block: B:166:0x035e  */
    /* JADX WARN: Removed duplicated region for block: B:177:0x03fd  */
    /* JADX WARN: Removed duplicated region for block: B:178:0x0400  */
    /* JADX WARN: Removed duplicated region for block: B:188:0x0418 A[LOOP:13: B:188:0x0418->B:390:?, LOOP_START] */
    /* JADX WARN: Removed duplicated region for block: B:232:0x0496  */
    /* JADX WARN: Removed duplicated region for block: B:344:0x0676 A[PHI: r2
      0x0676: PHI (r2v31 int) = (r2v30 int), (r2v30 int), (r2v29 int), (r2v29 int) binds: [B:346:0x067e, B:348:0x0688, B:340:0x0668, B:342:0x0673] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:366:0x04c6 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:369:0x0430 A[ADDED_TO_REGION, REMOVE, SYNTHETIC] */
    @Override // defpackage.AbstractC1935
    /* 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 mo297(defpackage.C4276 r34, defpackage.C1529 r35) {
        /*
            Method dump skipped, instructions count: 1688
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.leanback.widget.GridLayoutManager.mo297(ᵯˑᵰ, ˋᵮ):void");
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public final int mo298(View view) {
        return super.mo298(view) + ((C5209) view.getLayoutParams()).f19437;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public final int mo299(View view) {
        return super.mo299(view) - ((C5209) view.getLayoutParams()).f19438;
    }

    /* renamed from: ᵢˌᵸⁱ, reason: contains not printable characters */
    public final void m300(int i) {
        if (i >= 0 || i == -2) {
            this.f410 = i;
        } else {
            ᵹˉᵞ.ˌᵜᵹᵩ(AbstractC2990.m7313(i, "Invalid row height: "));
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵣᵟᵔ, reason: contains not printable characters */
    public final void mo301() {
        this.f428 = 0;
        C3457 c3457 = (C3457) this.f413.f13184;
        if (c3457 != null) {
            c3457.m7861(-1);
        }
    }

    /* renamed from: ᵤʢ, reason: contains not printable characters */
    public final int m302(int i) {
        int iM268 = 0;
        if ((this.f415 & 524288) != 0) {
            for (int i2 = this.f417 - 1; i2 > i; i2--) {
                iM268 += m268(i2) + this.f402;
            }
            return iM268;
        }
        int iM2682 = 0;
        while (iM268 < i) {
            iM2682 += m268(iM268) + this.f402;
            iM268++;
        }
        return iM2682;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final int mo303(C4276 c4276, C1529 c1529) {
        AbstractC2030 abstractC2030;
        return (this.f412 != 1 || (abstractC2030 = this.f405) == null) ? super.mo303(c4276, c1529) : abstractC2030.f8144;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵥʩᵩˑ, reason: contains not printable characters */
    public final void mo304(int i, int i2) {
        int i3;
        int i4 = this.f426;
        if (i4 != -1 && (i3 = this.f428) != Integer.MIN_VALUE) {
            int i5 = i4 + i3;
            if (i <= i5 && i5 < i + 1) {
                this.f428 = (i2 - i) + i3;
            } else if (i < i5 && i2 > i5 - 1) {
                this.f428 = i3 - 1;
            } else if (i > i5 && i2 < i5) {
                this.f428 = i3 + 1;
            }
        }
        C3457 c3457 = (C3457) this.f413.f13184;
        if (c3457 != null) {
            c3457.m7861(-1);
        }
    }

    /* renamed from: ᵥᵮᵼᵫ, reason: contains not printable characters */
    public final void m305() {
        int i = (this.f415 & (-1025)) | (m292(false) ? 1024 : 0);
        this.f415 = i;
        if ((i & 1024) != 0) {
            AbstractC0545 abstractC0545 = this.f430;
            WeakHashMap weakHashMap = AbstractC2873.f11133;
            abstractC0545.postOnAnimation(this.f392);
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵦᵽᵢ, reason: contains not printable characters */
    public final int mo306(int i, C4276 c4276, C1529 c1529) {
        int i2 = this.f415;
        if ((i2 & 512) == 0 || this.f405 == null) {
            return 0;
        }
        this.f415 = (i2 & (-4)) | 2;
        m287(c4276, c1529);
        int iM277 = this.f412 == 1 ? m277(i) : m311(i);
        m278();
        this.f415 &= -4;
        return iM277;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public final int mo307(View view) {
        return super.mo307(view) + ((C5209) view.getLayoutParams()).f19436;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final C1923 mo308(ViewGroup.LayoutParams layoutParams) {
        return layoutParams instanceof C5209 ? new C5209((C5209) layoutParams) : layoutParams instanceof C1923 ? new C5209((C1923) layoutParams) : layoutParams instanceof ViewGroup.MarginLayoutParams ? new C5209((ViewGroup.MarginLayoutParams) layoutParams) : new C5209(layoutParams);
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵨٴ, reason: contains not printable characters */
    public final void mo309(int i, int i2) {
        int i3;
        int i4 = i2 + i;
        while (i < i4) {
            C3513 c3513 = this.f413;
            C3457 c3457 = (C3457) c3513.f13184;
            if (c3457 != null) {
                synchronized (((ᵼᵫᵧˀ) c3457.f12975)) {
                    i3 = c3457.f12977;
                }
                if (i3 != 0) {
                    ((C3457) c3513.f13184).m7848(Integer.toString(i));
                }
            }
            i++;
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public final C1923 mo310() {
        return new C5209(-2, -2);
    }

    /* renamed from: ᵩᵡˏ, reason: contains not printable characters */
    public final int m311(int i) {
        int i2 = 0;
        if (i == 0) {
            return 0;
        }
        int i3 = -i;
        int iM5446 = m5446();
        if (this.f412 == 0) {
            while (i2 < iM5446) {
                m5431(i2).offsetTopAndBottom(i3);
                i2++;
            }
        } else {
            while (i2 < iM5446) {
                m5431(i2).offsetLeftAndRight(i3);
                i2++;
            }
        }
        this.f436 += i;
        m265();
        this.f430.invalidate();
        return i;
    }

    /* renamed from: ᵪˑᵭ, reason: contains not printable characters */
    public final int m312(int i, boolean z) {
        ᵺˑʔˇ r0;
        AbstractC2030 abstractC2030 = this.f405;
        if (abstractC2030 == null) {
            return i;
        }
        int i2 = this.f426;
        int i3 = (i2 == -1 || (r0 = abstractC2030.mo5622(i2)) == null) ? -1 : r0.ᵢˇᵭ;
        int iM5446 = m5446();
        View view = null;
        for (int i4 = 0; i4 < iM5446 && i != 0; i4++) {
            int i5 = i > 0 ? i4 : (iM5446 - 1) - i4;
            View viewM5431 = m5431(i5);
            if (viewM5431.getVisibility() == 0 && (!m5421() || viewM5431.hasFocusable())) {
                int iM256 = m256(m5431(i5));
                ᵺˑʔˇ r9 = this.f405.mo5622(iM256);
                int i6 = r9 == null ? -1 : r9.ᵢˇᵭ;
                if (i3 == -1) {
                    i2 = iM256;
                    view = viewM5431;
                    i3 = i6;
                } else if (i6 == i3 && ((i > 0 && iM256 > i2) || (i < 0 && iM256 < i2))) {
                    i = i > 0 ? i - 1 : i + 1;
                    i2 = iM256;
                    view = viewM5431;
                }
            }
        }
        if (view != null) {
            if (z) {
                if (m5421()) {
                    this.f415 |= 32;
                    view.requestFocus();
                    this.f415 &= -33;
                }
                this.f426 = i2;
                this.f422 = 0;
                return i;
            }
            m294(view, true);
        }
        return i;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵪᵛʿ, reason: contains not printable characters */
    public final void mo313(C4276 c4276) {
        for (int iM5446 = m5446() - 1; iM5446 >= 0; iM5446--) {
            m5424(iM5446, c4276);
        }
    }

    /* renamed from: ᵫʽ, reason: contains not printable characters */
    public final void m314() {
        this.f405.mo5619((this.f415 & 262144) != 0 ? this.f399 + this.f429 + this.f435 : (-this.f429) - this.f435);
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public final int mo315(View view) {
        return super.mo315(view) - ((C5209) view.getLayoutParams()).f19442;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵯᵽ, reason: contains not printable characters */
    public final boolean mo316(RecyclerView recyclerView, View view, Rect rect, boolean z) {
        return false;
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵰʖʢ, reason: contains not printable characters */
    public final void mo317(C4276 c4276, C1529 c1529, int i, int i2) {
        int size;
        int size2;
        int mode;
        int iM5441;
        int iM5422;
        int iM327;
        m287(c4276, c1529);
        if (this.f412 == 0) {
            size2 = View.MeasureSpec.getSize(i);
            size = View.MeasureSpec.getSize(i2);
            mode = View.MeasureSpec.getMode(i2);
            iM5441 = m5447();
            iM5422 = m5428();
        } else {
            size = View.MeasureSpec.getSize(i);
            size2 = View.MeasureSpec.getSize(i2);
            mode = View.MeasureSpec.getMode(i);
            iM5441 = m5441();
            iM5422 = m5422();
        }
        int i3 = iM5422 + iM5441;
        this.f400 = size;
        int i4 = this.f410;
        if (i4 == -2) {
            int i5 = this.f398;
            if (i5 == 0) {
                i5 = 1;
            }
            this.f417 = i5;
            this.f416 = 0;
            int[] iArr = this.f406;
            if (iArr == null || iArr.length != i5) {
                this.f406 = new int[i5];
            }
            if (this.f423.f6121) {
                m329();
            }
            m292(true);
            if (mode == Integer.MIN_VALUE) {
                size = Math.min(m327() + i3, this.f400);
            } else if (mode == 0) {
                iM327 = m327();
                size = iM327 + i3;
            } else {
                if (mode != 1073741824) {
                    ᵹˉᵞ.ᵳٴᵶ("wrong spec");
                    return;
                }
                size = this.f400;
            }
        } else {
            if (mode != Integer.MIN_VALUE) {
                if (mode == 0) {
                    if (i4 == 0) {
                        i4 = size - i3;
                    }
                    this.f416 = i4;
                    int i6 = this.f398;
                    if (i6 == 0) {
                        i6 = 1;
                    }
                    this.f417 = i6;
                    iM327 = ((i6 - 1) * this.f402) + (i4 * i6);
                    size = iM327 + i3;
                } else if (mode != 1073741824) {
                    ᵹˉᵞ.ᵳٴᵶ("wrong spec");
                    return;
                }
            }
            int i7 = this.f398;
            if (i7 == 0 && i4 == 0) {
                this.f417 = 1;
                this.f416 = size - i3;
            } else if (i7 == 0) {
                this.f416 = i4;
                int i8 = this.f402;
                this.f417 = (size + i8) / (i4 + i8);
            } else if (i4 == 0) {
                this.f417 = i7;
                this.f416 = ((size - i3) - ((i7 - 1) * this.f402)) / i7;
            } else {
                this.f417 = i7;
                this.f416 = i4;
            }
            if (mode == Integer.MIN_VALUE) {
                int i9 = this.f416;
                int i10 = this.f417;
                int i11 = ((i10 - 1) * this.f402) + (i9 * i10) + i3;
                if (i11 < size) {
                    size = i11;
                }
            }
        }
        int i12 = this.f412;
        RecyclerView recyclerView = this.f7785;
        if (i12 == 0) {
            recyclerView.setMeasuredDimension(size2, size);
        } else {
            recyclerView.setMeasuredDimension(size, size2);
        }
        m278();
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵰᵷᵹˆ, reason: contains not printable characters */
    public final int mo318(int i, C4276 c4276, C1529 c1529) {
        if ((this.f415 & 512) == 0 || this.f405 == null) {
            return 0;
        }
        m287(c4276, c1529);
        this.f415 = (this.f415 & (-4)) | 2;
        int iM277 = this.f412 == 0 ? m277(i) : m311(i);
        m278();
        this.f415 &= -4;
        return iM277;
    }

    /* renamed from: ᵲˈˁ, reason: contains not printable characters */
    public final void m319(View view) {
        int[] iArr;
        C5209 c5209 = (C5209) view.getLayoutParams();
        ᵿʤˑᵦ r1 = c5209.f19439;
        ᵧˉʙ r2 = this.f393;
        if (r1 == null) {
            C2658 c2658 = (C2658) r2.ᵿʗᵝʽ;
            c5209.f19440 = AbstractC0614.m2501(view, c2658, c2658.f10325);
            C2658 c26582 = (C2658) r2.ᵢˇᵭ;
            c5209.f19441 = AbstractC0614.m2501(view, c26582, c26582.f10325);
            return;
        }
        int i = this.f412;
        C1809[] c1809Arr = (C1809[]) r1.ᵢˇᵭ;
        int[] iArr2 = c5209.f19435;
        if (iArr2 == null || iArr2.length != c1809Arr.length) {
            c5209.f19435 = new int[c1809Arr.length];
        }
        int i2 = 0;
        while (true) {
            int length = c1809Arr.length;
            iArr = c5209.f19435;
            if (i2 >= length) {
                break;
            }
            iArr[i2] = AbstractC0614.m2501(view, c1809Arr[i2], i);
            i2++;
        }
        if (i == 0) {
            c5209.f19440 = iArr[0];
        } else {
            c5209.f19441 = iArr[0];
        }
        if (this.f412 == 0) {
            C2658 c26583 = (C2658) r2.ᵢˇᵭ;
            c5209.f19441 = AbstractC0614.m2501(view, c26583, c26583.f10325);
        } else {
            C2658 c26584 = (C2658) r2.ᵿʗᵝʽ;
            c5209.f19440 = AbstractC0614.m2501(view, c26584, c26584.f10325);
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵲᵟ, reason: contains not printable characters */
    public final void mo320(int i, int i2) {
        AbstractC2030 abstractC2030;
        int i3;
        int i4;
        int i5 = this.f426;
        if (i5 != -1 && (abstractC2030 = this.f405) != null && abstractC2030.f8146 >= 0 && (i3 = this.f428) != Integer.MIN_VALUE && i <= (i4 = i5 + i3)) {
            if (i + i2 > i4) {
                this.f426 = (i - i4) + i3 + i5;
                this.f428 = Integer.MIN_VALUE;
            } else {
                this.f428 = i3 - i2;
            }
        }
        C3457 c3457 = (C3457) this.f413.f13184;
        if (c3457 != null) {
            c3457.m7861(-1);
        }
    }

    /* renamed from: ᵲᵢᵲˊ, reason: contains not printable characters */
    public final void m321() {
        int i = this.f415;
        if ((65600 & i) == 65536) {
            AbstractC2030 abstractC2030 = this.f405;
            int i2 = this.f426;
            int i3 = (i & 262144) != 0 ? this.f399 + this.f429 : -this.f429;
            while (true) {
                int i4 = abstractC2030.f8145;
                int i5 = abstractC2030.f8146;
                if (i4 >= i5 && i5 < i2) {
                    int iM7142 = abstractC2030.f8150.m7142(i5);
                    boolean z = abstractC2030.f8147;
                    C2931 c2931 = abstractC2030.f8150;
                    int i6 = abstractC2030.f8146;
                    if (!z) {
                        if (c2931.m7145(i6) + iM7142 > i3) {
                            break;
                        }
                        abstractC2030.f8150.m7140(abstractC2030.f8146);
                        abstractC2030.f8146++;
                    } else {
                        if (c2931.m7145(i6) - iM7142 < i3) {
                            break;
                        }
                        abstractC2030.f8150.m7140(abstractC2030.f8146);
                        abstractC2030.f8146++;
                    }
                } else {
                    break;
                }
            }
            if (abstractC2030.f8145 < abstractC2030.f8146) {
                abstractC2030.m5618();
            }
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵲᵰⁱ, reason: contains not printable characters */
    public final void mo322(C3839 c3839) {
        AbstractC4624 abstractC4624 = this.f431;
        if (abstractC4624 != null) {
            abstractC4624.f17106 = true;
        }
        super.mo322(c3839);
        if (!c3839.f14276) {
            this.f431 = null;
            this.f409 = null;
            return;
        }
        AbstractC4624 abstractC46242 = (AbstractC4624) c3839;
        this.f431 = abstractC46242;
        if (abstractC46242 instanceof C2747) {
            this.f409 = (C2747) abstractC46242;
        } else {
            this.f409 = null;
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵲᵳ, reason: contains not printable characters */
    public final void mo323(RecyclerView recyclerView, int i) {
        m324(i, true);
    }

    /* renamed from: ᵳᵧ, reason: contains not printable characters */
    public final void m324(int i, boolean z) {
        if ((this.f426 == i || i == -1) && this.f422 == 0) {
            return;
        }
        m279(i, 0, z);
    }

    /* renamed from: ᵳᵮ, reason: contains not printable characters */
    public final void m325() {
        ArrayList arrayList;
        if (this.f407 != null || ((arrayList = this.f404) != null && arrayList.size() > 0)) {
            int i = this.f426;
            View viewMo518 = i == -1 ? null : mo518(i);
            if (viewMo518 != null) {
                AbstractC2313 abstractC2313M567 = this.f430.m567(viewMo518);
                InterfaceC0231 interfaceC0231 = this.f407;
                if (interfaceC0231 != null) {
                    interfaceC0231.m1535(viewMo518, this.f426);
                }
                AbstractC0545 abstractC0545 = this.f430;
                int i2 = this.f426;
                ArrayList arrayList2 = this.f404;
                if (arrayList2 != null) {
                    for (int size = arrayList2.size() - 1; size >= 0; size--) {
                        ((AbstractC0775) this.f404.get(size)).mo2862(abstractC0545, abstractC2313M567, i2);
                    }
                }
            } else {
                InterfaceC0231 interfaceC02312 = this.f407;
                if (interfaceC02312 != null) {
                    interfaceC02312.m1535(null, -1);
                }
                AbstractC0545 abstractC05452 = this.f430;
                ArrayList arrayList3 = this.f404;
                if (arrayList3 != null) {
                    for (int size2 = arrayList3.size() - 1; size2 >= 0; size2--) {
                        ((AbstractC0775) this.f404.get(size2)).mo2862(abstractC05452, null, -1);
                    }
                }
            }
            if ((this.f415 & 3) == 1 || this.f430.isLayoutRequested()) {
                return;
            }
            int iM5446 = m5446();
            for (int i3 = 0; i3 < iM5446; i3++) {
                if (m5431(i3).isLayoutRequested()) {
                    AbstractC0545 abstractC05453 = this.f430;
                    WeakHashMap weakHashMap = AbstractC2873.f11133;
                    abstractC05453.postOnAnimation(this.f392);
                    return;
                }
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:20:0x003c  */
    /* JADX WARN: Removed duplicated region for block: B:23:0x0046  */
    /* JADX WARN: Removed duplicated region for block: B:28:0x004f  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x005b  */
    /* JADX WARN: Removed duplicated region for block: B:42:0x0075  */
    @Override // defpackage.AbstractC1935
    /* 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 boolean mo326(defpackage.C4276 r5, defpackage.C1529 r6, int r7, android.os.Bundle r8) {
        /*
            r4 = this;
            int r8 = r4.f415
            r0 = 131072(0x20000, float:1.83671E-40)
            r8 = r8 & r0
            r0 = 1
            if (r8 == 0) goto L86
            r4.m287(r5, r6)
            int r5 = r4.f415
            r8 = 262144(0x40000, float:3.67342E-40)
            r5 = r5 & r8
            r8 = 0
            if (r5 == 0) goto L15
            r5 = r0
            goto L16
        L15:
            r5 = r8
        L16:
            int r1 = r4.f412
            r2 = 8192(0x2000, float:1.14794E-41)
            r3 = 4096(0x1000, float:5.74E-42)
            if (r1 != 0) goto L34
            ˊᵱᵵˏ r1 = defpackage.C1390.f5711
            int r1 = r1.m4278()
            if (r7 != r1) goto L29
            if (r5 == 0) goto L3c
            goto L46
        L29:
            ˊᵱᵵˏ r1 = defpackage.C1390.f5709
            int r1 = r1.m4278()
            if (r7 != r1) goto L47
            if (r5 == 0) goto L46
            goto L3c
        L34:
            ˊᵱᵵˏ r5 = defpackage.C1390.f5706
            int r5 = r5.m4278()
            if (r7 != r5) goto L3e
        L3c:
            r7 = r2
            goto L47
        L3e:
            ˊᵱᵵˏ r5 = defpackage.C1390.f5708
            int r5 = r5.m4278()
            if (r7 != r5) goto L47
        L46:
            r7 = r3
        L47:
            int r5 = r4.f426
            if (r5 != 0) goto L4f
            if (r7 != r2) goto L4f
            r1 = r0
            goto L50
        L4f:
            r1 = r8
        L50:
            int r6 = r6.m4454()
            int r6 = r6 - r0
            if (r5 != r6) goto L5b
            if (r7 != r3) goto L5b
            r5 = r0
            goto L5c
        L5b:
            r5 = r8
        L5c:
            if (r1 != 0) goto L75
            if (r5 == 0) goto L61
            goto L75
        L61:
            if (r7 == r3) goto L6e
            if (r7 == r2) goto L66
            goto L83
        L66:
            r4.m284(r8)
            r5 = -1
            r4.m312(r5, r8)
            goto L83
        L6e:
            r4.m284(r0)
            r4.m312(r0, r8)
            goto L83
        L75:
            android.view.accessibility.AccessibilityEvent r5 = android.view.accessibility.AccessibilityEvent.obtain(r3)
            ˀˏʨ r6 = r4.f430
            r6.onInitializeAccessibilityEvent(r5)
            ˀˏʨ r6 = r4.f430
            r6.requestSendAccessibilityEvent(r6, r5)
        L83:
            r4.m278()
        L86:
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.leanback.widget.GridLayoutManager.mo326(ᵯˑᵰ, ˋᵮ, int, android.os.Bundle):boolean");
    }

    /* renamed from: ᵶᵘː, reason: contains not printable characters */
    public final int m327() {
        int i = (this.f415 & 524288) != 0 ? 0 : this.f417 - 1;
        return m268(i) + m302(i);
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final void mo328(int i, C1943 c1943) {
        int i2 = this.f430.f2843;
        if (i == 0 || i2 == 0) {
            return;
        }
        int iMax = Math.max(0, Math.min(this.f426 - ((i2 - 1) / 2), i - i2));
        for (int i3 = iMax; i3 < i && i3 < iMax + i2; i3++) {
            c1943.m5466(i3, 0);
        }
    }

    /* renamed from: ᵷˆˇ, reason: contains not printable characters */
    public final void m329() {
        if (m5446() <= 0) {
            this.f419 = 0;
        } else {
            this.f419 = this.f405.f8146 - ((C5209) m5431(0).getLayoutParams()).f7733.m6035();
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵷᵦﹳ, reason: contains not printable characters */
    public final void mo330(int i) {
        if (i == 1) {
            this.f415 |= 1048576;
            if (this.f425 == 4) {
                if (this.f421 == null) {
                    this.f421 = new C3526();
                }
                C3526 c3526 = this.f421;
                AbstractC0545 abstractC0545 = this.f430;
                AbstractC0545 abstractC05452 = c3526.f13243;
                if (abstractC05452 != abstractC0545) {
                    if (abstractC05452 != null) {
                        abstractC05452.setOnFlingListener(null);
                        c3526.f13243 = null;
                    }
                    if (abstractC0545.getOnFlingListener() == null) {
                        c3526.f13243 = abstractC0545;
                        abstractC0545.setOnFlingListener(c3526);
                        c3526.f13244 = new Scroller(c3526.f13243.getContext(), new DecelerateInterpolator());
                    }
                }
                this.f421.f13242 = false;
                return;
            }
            return;
        }
        if (i == 0) {
            int i2 = this.f415;
            if ((i2 & 1048576) == 1048576) {
                this.f415 = i2 & (-1048577);
                m325();
                m289();
                if (this.f425 == 4) {
                    C3526 c35262 = this.f421;
                    c35262.f13242 = false;
                    AbstractC0545 abstractC05453 = c35262.f13243;
                    if (abstractC05453 != null) {
                        abstractC05453.setOnFlingListener(null);
                        c35262.f13243 = null;
                    }
                    m279(this.f426, 0, true);
                }
            }
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵺᵜᵰ, reason: contains not printable characters */
    public final void mo331(Parcelable parcelable) {
        if (parcelable instanceof C2939) {
            C2939 c2939 = (C2939) parcelable;
            this.f426 = c2939.f11399;
            this.f428 = 0;
            Bundle bundle = c2939.f11398;
            C3513 c3513 = this.f413;
            C3457 c3457 = (C3457) c3513.f13184;
            if (c3457 != null && bundle != null) {
                c3457.m7861(-1);
                for (String str : bundle.keySet()) {
                    ((C3457) c3513.f13184).m7858(str, bundle.getSparseParcelableArray(str));
                }
            }
            this.f415 |= 256;
            m5425();
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵺᵠ, reason: contains not printable characters */
    public final void mo332(C4276 c4276, C1529 c1529, View view, C2487 c2487) {
        ᵺˑʔˇ r3;
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (this.f405 == null || !(layoutParams instanceof C5209)) {
            return;
        }
        int iM6030 = ((C5209) layoutParams).f7733.m6030();
        int i = -1;
        if (iM6030 >= 0 && (r3 = this.f405.mo5622(iM6030)) != null) {
            i = r3.ᵢˇᵭ;
        }
        if (i < 0) {
            return;
        }
        int i2 = iM6030 / this.f405.f8144;
        if (this.f412 == 0) {
            c2487.m6330(C2283.m5982(i, 1, i2, 1));
        } else {
            c2487.m6330(C2283.m5982(i2, 1, i, 1));
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ᵽʛ, reason: contains not printable characters */
    public final void mo333(AbstractC1307 abstractC1307, AbstractC1307 abstractC13072) {
        if (abstractC1307 != null) {
            this.f405 = null;
            this.f406 = null;
            this.f415 &= -1025;
            this.f426 = -1;
            this.f428 = 0;
            C3457 c3457 = (C3457) this.f413.f13184;
            if (c3457 != null) {
                c3457.m7861(-1);
            }
        }
    }

    @Override // defpackage.AbstractC1935
    /* renamed from: ﹶـ, reason: contains not printable characters */
    public final void mo334(int i, int i2) {
        AbstractC2030 abstractC2030;
        int i3;
        int i4 = this.f426;
        if (i4 != -1 && (abstractC2030 = this.f405) != null && abstractC2030.f8146 >= 0 && (i3 = this.f428) != Integer.MIN_VALUE && i <= i4 + i3) {
            this.f428 = i3 + i2;
        }
        C3457 c3457 = (C3457) this.f413.f13184;
        if (c3457 != null) {
            c3457.m7861(-1);
        }
    }
}
