package androidx.recyclerview.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.List;
import p037.p041.p042.LayoutInflaterFactory2C1494;
import p037.p065.p078.p079.C1947;
import p037.p107.p108.AbstractC2365;
import p037.p107.p108.C2356;
import p037.p107.p108.RunnableC2352;
import p138.p139.p143.p144.C2803;

/* JADX INFO: loaded from: classes.dex */
public class StaggeredGridLayoutManager extends RecyclerView.AbstractC0202 implements RecyclerView.AbstractC0218.InterfaceC0220 {

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public int f1344;

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public C0233[] f1345;

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public AbstractC2365 f1346;

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public AbstractC2365 f1347;

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public int f1348;

    /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
    public int f1349;

    /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
    public final C2356 f1350;

    /* JADX INFO: renamed from: ޗ, reason: contains not printable characters */
    public boolean f1351;

    /* JADX INFO: renamed from: ޙ, reason: contains not printable characters */
    public BitSet f1353;

    /* JADX INFO: renamed from: ޞ, reason: contains not printable characters */
    public boolean f1358;

    /* JADX INFO: renamed from: ޟ, reason: contains not printable characters */
    public boolean f1359;

    /* JADX INFO: renamed from: ޠ, reason: contains not printable characters */
    public C0231 f1360;

    /* JADX INFO: renamed from: ޡ, reason: contains not printable characters */
    public int f1361;

    /* JADX INFO: renamed from: ޱ, reason: contains not printable characters */
    public int[] f1366;

    /* JADX INFO: renamed from: ޘ, reason: contains not printable characters */
    public boolean f1352 = false;

    /* JADX INFO: renamed from: ޚ, reason: contains not printable characters */
    public int f1354 = -1;

    /* JADX INFO: renamed from: ޛ, reason: contains not printable characters */
    public int f1355 = Integer.MIN_VALUE;

    /* JADX INFO: renamed from: ޜ, reason: contains not printable characters */
    public C0228 f1356 = new C0228();

    /* JADX INFO: renamed from: ޝ, reason: contains not printable characters */
    public int f1357 = 2;

    /* JADX INFO: renamed from: ޢ, reason: contains not printable characters */
    public final Rect f1362 = new Rect();

    /* JADX INFO: renamed from: ޣ, reason: contains not printable characters */
    public final C0226 f1363 = new C0226();

    /* JADX INFO: renamed from: ޤ, reason: contains not printable characters */
    public boolean f1364 = false;

    /* JADX INFO: renamed from: ޥ, reason: contains not printable characters */
    public boolean f1365 = true;

    /* JADX INFO: renamed from: ࢠ, reason: contains not printable characters */
    public final Runnable f1367 = new RunnableC0225();

    /* JADX INFO: renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$֏, reason: contains not printable characters */
    public class RunnableC0225 implements Runnable {
        public RunnableC0225() {
        }

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

    /* JADX INFO: renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$ؠ, reason: contains not printable characters */
    public class C0226 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int f1369;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public int f1370;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public boolean f1371;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public boolean f1372;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public boolean f1373;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public int[] f1374;

        public C0226() {
            m788();
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m787() {
            this.f1370 = this.f1371 ? StaggeredGridLayoutManager.this.f1346.mo4409() : StaggeredGridLayoutManager.this.f1346.mo4417();
        }

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public void m788() {
            this.f1369 = -1;
            this.f1370 = Integer.MIN_VALUE;
            this.f1371 = false;
            this.f1372 = false;
            this.f1373 = false;
            int[] iArr = this.f1374;
            if (iArr != null) {
                Arrays.fill(iArr, -1);
            }
        }
    }

    /* JADX INFO: renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$ހ, reason: contains not printable characters */
    public static class C0227 extends RecyclerView.C0207 {

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public C0233 f1376;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public boolean f1377;

        public C0227(int i, int i2) {
            super(i, i2);
        }

        public C0227(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
        }

        public C0227(ViewGroup.LayoutParams layoutParams) {
            super(layoutParams);
        }

        public C0227(ViewGroup.MarginLayoutParams marginLayoutParams) {
            super(marginLayoutParams);
        }
    }

    /* JADX INFO: renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$ށ, reason: contains not printable characters */
    public static class C0228 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int[] f1378;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public List<C0229> f1379;

        /* JADX INFO: renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$ށ$֏, reason: contains not printable characters */
        @SuppressLint({"BanParcelableUsage"})
        public static class C0229 implements Parcelable {
            public static final Parcelable.Creator<C0229> CREATOR = new C0230();

            /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
            public int f1380;

            /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
            public int f1381;

            /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
            public int[] f1382;

            /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
            public boolean f1383;

            /* JADX INFO: renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$ށ$֏$֏, reason: contains not printable characters */
            public static class C0230 implements Parcelable.Creator<C0229> {
                @Override // android.os.Parcelable.Creator
                public C0229 createFromParcel(Parcel parcel) {
                    return new C0229(parcel);
                }

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

            public C0229() {
            }

            public C0229(Parcel parcel) {
                this.f1380 = parcel.readInt();
                this.f1381 = parcel.readInt();
                this.f1383 = parcel.readInt() == 1;
                int i = parcel.readInt();
                if (i > 0) {
                    int[] iArr = new int[i];
                    this.f1382 = iArr;
                    parcel.readIntArray(iArr);
                }
            }

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

            public String toString() {
                StringBuilder sbM4889 = C2803.m4889("FullSpanItem{mPosition=");
                sbM4889.append(this.f1380);
                sbM4889.append(", mGapDir=");
                sbM4889.append(this.f1381);
                sbM4889.append(", mHasUnwantedGapAfter=");
                sbM4889.append(this.f1383);
                sbM4889.append(", mGapPerSpan=");
                sbM4889.append(Arrays.toString(this.f1382));
                sbM4889.append('}');
                return sbM4889.toString();
            }

            @Override // android.os.Parcelable
            public void writeToParcel(Parcel parcel, int i) {
                parcel.writeInt(this.f1380);
                parcel.writeInt(this.f1381);
                parcel.writeInt(this.f1383 ? 1 : 0);
                int[] iArr = this.f1382;
                if (iArr == null || iArr.length <= 0) {
                    parcel.writeInt(0);
                } else {
                    parcel.writeInt(iArr.length);
                    parcel.writeIntArray(this.f1382);
                }
            }
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public C0229 m789(int i, int i2, int i3, boolean z) {
            List<C0229> list = this.f1379;
            if (list == null) {
                return null;
            }
            int size = list.size();
            for (int i4 = 0; i4 < size; i4++) {
                C0229 c0229 = this.f1379.get(i4);
                int i5 = c0229.f1380;
                if (i5 >= i2) {
                    return null;
                }
                if (i5 >= i && (i3 == 0 || c0229.f1381 == i3 || (z && c0229.f1383))) {
                    return c0229;
                }
            }
            return null;
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m790() {
            int[] iArr = this.f1378;
            if (iArr != null) {
                Arrays.fill(iArr, -1);
            }
            this.f1379 = null;
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m791(int i) {
            int[] iArr = this.f1378;
            if (iArr == null) {
                int[] iArr2 = new int[Math.max(i, 10) + 1];
                this.f1378 = iArr2;
                Arrays.fill(iArr2, -1);
            } else if (i >= iArr.length) {
                int length = iArr.length;
                while (length <= i) {
                    length *= 2;
                }
                int[] iArr3 = new int[length];
                this.f1378 = iArr3;
                System.arraycopy(iArr, 0, iArr3, 0, iArr.length);
                int[] iArr4 = this.f1378;
                Arrays.fill(iArr4, iArr.length, iArr4.length, -1);
            }
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m792(int i, int i2) {
            int[] iArr = this.f1378;
            if (iArr == null || i >= iArr.length) {
                return;
            }
            int i3 = i + i2;
            m791(i3);
            int[] iArr2 = this.f1378;
            System.arraycopy(iArr2, i, iArr2, i3, (iArr2.length - i) - i2);
            Arrays.fill(this.f1378, i, i3, -1);
            List<C0229> list = this.f1379;
            if (list == null) {
                return;
            }
            for (int size = list.size() - 1; size >= 0; size--) {
                C0229 c0229 = this.f1379.get(size);
                int i4 = c0229.f1380;
                if (i4 >= i) {
                    c0229.f1380 = i4 + i2;
                }
            }
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m793(C0229 c0229) {
            if (this.f1379 == null) {
                this.f1379 = new ArrayList();
            }
            int size = this.f1379.size();
            for (int i = 0; i < size; i++) {
                C0229 c02292 = this.f1379.get(i);
                if (c02292.f1380 == c0229.f1380) {
                    this.f1379.remove(i);
                }
                if (c02292.f1380 >= c0229.f1380) {
                    this.f1379.add(i, c0229);
                    return;
                }
            }
            this.f1379.add(c0229);
        }

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public int m794(int i) {
            List<C0229> list = this.f1379;
            if (list != null) {
                for (int size = list.size() - 1; size >= 0; size--) {
                    if (this.f1379.get(size).f1380 >= i) {
                        this.f1379.remove(size);
                    }
                }
            }
            return m797(i);
        }

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public void m795(int i, int i2) {
            int[] iArr = this.f1378;
            if (iArr == null || i >= iArr.length) {
                return;
            }
            int i3 = i + i2;
            m791(i3);
            int[] iArr2 = this.f1378;
            System.arraycopy(iArr2, i3, iArr2, i, (iArr2.length - i) - i2);
            int[] iArr3 = this.f1378;
            Arrays.fill(iArr3, iArr3.length - i2, iArr3.length, -1);
            List<C0229> list = this.f1379;
            if (list == null) {
                return;
            }
            for (int size = list.size() - 1; size >= 0; size--) {
                C0229 c0229 = this.f1379.get(size);
                int i4 = c0229.f1380;
                if (i4 >= i) {
                    if (i4 < i3) {
                        this.f1379.remove(size);
                    } else {
                        c0229.f1380 = i4 - i2;
                    }
                }
            }
        }

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public C0229 m796(int i) {
            List<C0229> list = this.f1379;
            if (list == null) {
                return null;
            }
            for (int size = list.size() - 1; size >= 0; size--) {
                C0229 c0229 = this.f1379.get(size);
                if (c0229.f1380 == i) {
                    return c0229;
                }
            }
            return null;
        }

        /* JADX WARN: Removed duplicated region for block: B:10:0x000e  */
        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public int m797(int i) {
            int i2;
            int[] iArr = this.f1378;
            if (iArr == null || i >= iArr.length) {
                return -1;
            }
            if (this.f1379 != null) {
                C0229 c0229M796 = m796(i);
                if (c0229M796 != null) {
                    this.f1379.remove(c0229M796);
                }
                int size = this.f1379.size();
                int i3 = 0;
                while (true) {
                    if (i3 >= size) {
                        i3 = -1;
                        break;
                    }
                    if (this.f1379.get(i3).f1380 >= i) {
                        break;
                    }
                    i3++;
                }
                if (i3 != -1) {
                    C0229 c0229 = this.f1379.get(i3);
                    this.f1379.remove(i3);
                    i2 = c0229.f1380;
                } else {
                    i2 = -1;
                }
            }
            if (i2 == -1) {
                int[] iArr2 = this.f1378;
                Arrays.fill(iArr2, i, iArr2.length, -1);
                return this.f1378.length;
            }
            int i4 = i2 + 1;
            Arrays.fill(this.f1378, i, i4, -1);
            return i4;
        }
    }

    /* JADX INFO: renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$ނ, reason: contains not printable characters */
    @SuppressLint({"BanParcelableUsage"})
    public static class C0231 implements Parcelable {
        public static final Parcelable.Creator<C0231> CREATOR = new C0232();

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public int f1384;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public int f1385;

        /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
        public int f1386;

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public int[] f1387;

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public int f1388;

        /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
        public int[] f1389;

        /* JADX INFO: renamed from: މ, reason: contains not printable characters */
        public List<C0228.C0229> f1390;

        /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
        public boolean f1391;

        /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
        public boolean f1392;

        /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
        public boolean f1393;

        /* JADX INFO: renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$ނ$֏, reason: contains not printable characters */
        public static class C0232 implements Parcelable.Creator<C0231> {
            @Override // android.os.Parcelable.Creator
            public C0231 createFromParcel(Parcel parcel) {
                return new C0231(parcel);
            }

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

        public C0231() {
        }

        public C0231(Parcel parcel) {
            this.f1384 = parcel.readInt();
            this.f1385 = parcel.readInt();
            int i = parcel.readInt();
            this.f1386 = i;
            if (i > 0) {
                int[] iArr = new int[i];
                this.f1387 = iArr;
                parcel.readIntArray(iArr);
            }
            int i2 = parcel.readInt();
            this.f1388 = i2;
            if (i2 > 0) {
                int[] iArr2 = new int[i2];
                this.f1389 = iArr2;
                parcel.readIntArray(iArr2);
            }
            this.f1391 = parcel.readInt() == 1;
            this.f1392 = parcel.readInt() == 1;
            this.f1393 = parcel.readInt() == 1;
            this.f1390 = parcel.readArrayList(C0228.C0229.class.getClassLoader());
        }

        public C0231(C0231 c0231) {
            this.f1386 = c0231.f1386;
            this.f1384 = c0231.f1384;
            this.f1385 = c0231.f1385;
            this.f1387 = c0231.f1387;
            this.f1388 = c0231.f1388;
            this.f1389 = c0231.f1389;
            this.f1391 = c0231.f1391;
            this.f1392 = c0231.f1392;
            this.f1393 = c0231.f1393;
            this.f1390 = c0231.f1390;
        }

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

        @Override // android.os.Parcelable
        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeInt(this.f1384);
            parcel.writeInt(this.f1385);
            parcel.writeInt(this.f1386);
            if (this.f1386 > 0) {
                parcel.writeIntArray(this.f1387);
            }
            parcel.writeInt(this.f1388);
            if (this.f1388 > 0) {
                parcel.writeIntArray(this.f1389);
            }
            parcel.writeInt(this.f1391 ? 1 : 0);
            parcel.writeInt(this.f1392 ? 1 : 0);
            parcel.writeInt(this.f1393 ? 1 : 0);
            parcel.writeList(this.f1390);
        }
    }

    /* JADX INFO: renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$ރ, reason: contains not printable characters */
    public class C0233 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public ArrayList<View> f1394 = new ArrayList<>();

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public int f1395 = Integer.MIN_VALUE;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public int f1396 = Integer.MIN_VALUE;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public int f1397 = 0;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public final int f1398;

        public C0233(int i) {
            this.f1398 = i;
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int m798(int i) {
            int i2 = this.f1396;
            if (i2 != Integer.MIN_VALUE) {
                return i2;
            }
            if (this.f1394.size() == 0) {
                return i;
            }
            m801();
            return this.f1396;
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int m799(int i, int i2, boolean z) {
            int iMo4417 = StaggeredGridLayoutManager.this.f1346.mo4417();
            int iMo4409 = StaggeredGridLayoutManager.this.f1346.mo4409();
            int i3 = i2 > i ? 1 : -1;
            while (i != i2) {
                View view = this.f1394.get(i);
                int iMo4414 = StaggeredGridLayoutManager.this.f1346.mo4414(view);
                int iMo4407 = StaggeredGridLayoutManager.this.f1346.mo4407(view);
                boolean z2 = false;
                boolean z3 = !z ? iMo4414 >= iMo4409 : iMo4414 > iMo4409;
                if (!z ? iMo4407 > iMo4417 : iMo4407 >= iMo4417) {
                    z2 = true;
                }
                if (z3 && z2 && (iMo4414 < iMo4417 || iMo4407 > iMo4409)) {
                    return StaggeredGridLayoutManager.this.m681(view);
                }
                i += i3;
            }
            return -1;
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public View m800(int i, int i2) {
            View view = null;
            if (i2 != -1) {
                int size = this.f1394.size() - 1;
                while (size >= 0) {
                    View view2 = this.f1394.get(size);
                    StaggeredGridLayoutManager staggeredGridLayoutManager = StaggeredGridLayoutManager.this;
                    if (staggeredGridLayoutManager.f1351 && staggeredGridLayoutManager.m681(view2) >= i) {
                        break;
                    }
                    StaggeredGridLayoutManager staggeredGridLayoutManager2 = StaggeredGridLayoutManager.this;
                    if ((!staggeredGridLayoutManager2.f1351 && staggeredGridLayoutManager2.m681(view2) <= i) || !view2.hasFocusable()) {
                        break;
                    }
                    size--;
                    view = view2;
                }
            } else {
                int size2 = this.f1394.size();
                int i3 = 0;
                while (i3 < size2) {
                    View view3 = this.f1394.get(i3);
                    StaggeredGridLayoutManager staggeredGridLayoutManager3 = StaggeredGridLayoutManager.this;
                    if (staggeredGridLayoutManager3.f1351 && staggeredGridLayoutManager3.m681(view3) <= i) {
                        break;
                    }
                    StaggeredGridLayoutManager staggeredGridLayoutManager4 = StaggeredGridLayoutManager.this;
                    if ((!staggeredGridLayoutManager4.f1351 && staggeredGridLayoutManager4.m681(view3) >= i) || !view3.hasFocusable()) {
                        break;
                    }
                    i3++;
                    view = view3;
                }
            }
            return view;
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m801() {
            C0228.C0229 c0229M796;
            ArrayList<View> arrayList = this.f1394;
            View view = arrayList.get(arrayList.size() - 1);
            C0227 c0227M804 = m804(view);
            this.f1396 = StaggeredGridLayoutManager.this.f1346.mo4407(view);
            if (c0227M804.f1377 && (c0229M796 = StaggeredGridLayoutManager.this.f1356.m796(c0227M804.m694())) != null && c0229M796.f1381 == 1) {
                int i = this.f1396;
                int i2 = this.f1398;
                int[] iArr = c0229M796.f1382;
                this.f1396 = i + (iArr == null ? 0 : iArr[i2]);
            }
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m802(View view) {
            C0227 c0227M804 = m804(view);
            c0227M804.f1376 = this;
            this.f1394.add(view);
            this.f1396 = Integer.MIN_VALUE;
            if (this.f1394.size() == 1) {
                this.f1395 = Integer.MIN_VALUE;
            }
            if (c0227M804.m696() || c0227M804.m695()) {
                this.f1397 = StaggeredGridLayoutManager.this.f1346.mo4410(view) + this.f1397;
            }
        }

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public int m803(int i) {
            int i2 = this.f1395;
            if (i2 != Integer.MIN_VALUE) {
                return i2;
            }
            if (this.f1394.size() == 0) {
                return i;
            }
            m805();
            return this.f1395;
        }

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public C0227 m804(View view) {
            return (C0227) view.getLayoutParams();
        }

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public void m805() {
            C0228.C0229 c0229M796;
            View view = this.f1394.get(0);
            C0227 c0227M804 = m804(view);
            this.f1395 = StaggeredGridLayoutManager.this.f1346.mo4414(view);
            if (c0227M804.f1377 && (c0229M796 = StaggeredGridLayoutManager.this.f1356.m796(c0227M804.m694())) != null && c0229M796.f1381 == -1) {
                int i = this.f1395;
                int i2 = this.f1398;
                int[] iArr = c0229M796.f1382;
                this.f1395 = i - (iArr != null ? iArr[i2] : 0);
            }
        }

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public void m806() {
            this.f1394.clear();
            this.f1395 = Integer.MIN_VALUE;
            this.f1396 = Integer.MIN_VALUE;
            this.f1397 = 0;
        }

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public void m807(View view) {
            C0227 c0227M804 = m804(view);
            c0227M804.f1376 = this;
            this.f1394.add(0, view);
            this.f1395 = Integer.MIN_VALUE;
            if (this.f1394.size() == 1) {
                this.f1396 = Integer.MIN_VALUE;
            }
            if (c0227M804.m696() || c0227M804.m695()) {
                this.f1397 = StaggeredGridLayoutManager.this.f1346.mo4410(view) + this.f1397;
            }
        }

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public int m808() {
            return StaggeredGridLayoutManager.this.f1351 ? m799(this.f1394.size() - 1, -1, true) : m799(0, this.f1394.size(), true);
        }

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public int m809() {
            return StaggeredGridLayoutManager.this.f1351 ? m799(0, this.f1394.size(), true) : m799(this.f1394.size() - 1, -1, true);
        }

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public void m810() {
            int size = this.f1394.size();
            View viewRemove = this.f1394.remove(size - 1);
            C0227 c0227M804 = m804(viewRemove);
            c0227M804.f1376 = null;
            if (c0227M804.m696() || c0227M804.m695()) {
                this.f1397 -= StaggeredGridLayoutManager.this.f1346.mo4410(viewRemove);
            }
            if (size == 1) {
                this.f1395 = Integer.MIN_VALUE;
            }
            this.f1396 = Integer.MIN_VALUE;
        }

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public void m811() {
            View viewRemove = this.f1394.remove(0);
            C0227 c0227M804 = m804(viewRemove);
            c0227M804.f1376 = null;
            if (this.f1394.size() == 0) {
                this.f1396 = Integer.MIN_VALUE;
            }
            if (c0227M804.m696() || c0227M804.m695()) {
                this.f1397 -= StaggeredGridLayoutManager.this.f1346.mo4410(viewRemove);
            }
            this.f1395 = Integer.MIN_VALUE;
        }
    }

    public StaggeredGridLayoutManager(Context context, AttributeSet attributeSet, int i, int i2) {
        this.f1344 = -1;
        this.f1351 = false;
        RecyclerView.AbstractC0202.C0206 c0206M628 = RecyclerView.AbstractC0202.m628(context, attributeSet, i, i2);
        int i3 = c0206M628.f1263;
        if (i3 != 0 && i3 != 1) {
            throw new IllegalArgumentException("invalid orientation.");
        }
        mo482((String) null);
        if (i3 != this.f1348) {
            this.f1348 = i3;
            AbstractC2365 abstractC2365 = this.f1346;
            this.f1346 = this.f1347;
            this.f1347 = abstractC2365;
            m687();
        }
        int i4 = c0206M628.f1264;
        mo482((String) null);
        if (i4 != this.f1344) {
            this.f1356.m790();
            m687();
            this.f1344 = i4;
            this.f1353 = new BitSet(this.f1344);
            this.f1345 = new C0233[this.f1344];
            for (int i5 = 0; i5 < this.f1344; i5++) {
                this.f1345[i5] = new C0233(i5);
            }
            m687();
        }
        boolean z = c0206M628.f1265;
        mo482((String) null);
        C0231 c0231 = this.f1360;
        if (c0231 != null && c0231.f1391 != z) {
            c0231.f1391 = z;
        }
        this.f1351 = z;
        m687();
        this.f1350 = new C2356();
        this.f1346 = AbstractC2365.m4420(this, this.f1348);
        this.f1347 = AbstractC2365.m4420(this, 1 - this.f1348);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public int mo427(int i, RecyclerView.C0213 c0213, RecyclerView.C0221 c0221) {
        return m767(i, c0213, c0221);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public int mo428(RecyclerView.C0213 c0213, RecyclerView.C0221 c0221) {
        return this.f1348 == 1 ? this.f1344 : super.mo428(c0213, c0221);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final int m756(RecyclerView.C0213 c0213, C2356 c2356, RecyclerView.C0221 c0221) {
        C0233 c0233;
        int i;
        int i2;
        int iMo4410;
        int iMo44102;
        C0227 c0227;
        boolean z;
        boolean z2;
        boolean z3;
        int i3;
        int i4;
        int i5;
        RecyclerView.C0213 c02132 = c0213;
        char c = 0;
        this.f1353.set(0, this.f1344, true);
        int i6 = this.f1350.f7496 ? c2356.f7492 == 1 ? Integer.MAX_VALUE : Integer.MIN_VALUE : c2356.f7492 == 1 ? c2356.f7494 + c2356.f7489 : c2356.f7493 - c2356.f7489;
        m769(c2356.f7492, i6);
        int iMo4409 = this.f1352 ? this.f1346.mo4409() : this.f1346.mo4417();
        boolean z4 = false;
        while (true) {
            int i7 = c2356.f7490;
            if (!(i7 >= 0 && i7 < c0221.m728()) || (!this.f1350.f7496 && this.f1353.isEmpty())) {
                break;
            }
            View viewM712 = c02132.m712(c2356.f7490);
            c2356.f7490 += c2356.f7491;
            C0227 c02272 = (C0227) viewM712.getLayoutParams();
            int iM694 = c02272.m694();
            int[] iArr = this.f1356.f1378;
            int i8 = (iArr == null || iM694 >= iArr.length) ? -1 : iArr[iM694];
            boolean z5 = i8 == -1;
            if (z5) {
                if (c02272.f1377) {
                    c0233 = this.f1345[c];
                } else {
                    if (m779(c2356.f7492)) {
                        i4 = this.f1344 - 1;
                        i3 = -1;
                        i5 = -1;
                    } else {
                        i3 = this.f1344;
                        i4 = 0;
                        i5 = 1;
                    }
                    C0233 c02332 = null;
                    if (c2356.f7492 == 1) {
                        int iMo4417 = this.f1346.mo4417();
                        int i9 = Integer.MAX_VALUE;
                        while (i4 != i3) {
                            C0233 c02333 = this.f1345[i4];
                            int iM798 = c02333.m798(iMo4417);
                            if (iM798 < i9) {
                                c02332 = c02333;
                                i9 = iM798;
                            }
                            i4 += i5;
                        }
                    } else {
                        int iMo44092 = this.f1346.mo4409();
                        int i10 = Integer.MIN_VALUE;
                        while (i4 != i3) {
                            C0233 c02334 = this.f1345[i4];
                            int iM803 = c02334.m803(iMo44092);
                            if (iM803 > i10) {
                                c02332 = c02334;
                                i10 = iM803;
                            }
                            i4 += i5;
                        }
                    }
                    c0233 = c02332;
                }
                C0228 c0228 = this.f1356;
                c0228.m791(iM694);
                c0228.f1378[iM694] = c0233.f1398;
            } else {
                c0233 = this.f1345[i8];
            }
            C0233 c02335 = c0233;
            c02272.f1376 = c02335;
            if (c2356.f7492 == 1) {
                m635(viewM712, -1, false);
            } else {
                m635(viewM712, 0, false);
            }
            if (c02272.f1377) {
                if (this.f1348 == 1) {
                    m758(viewM712, this.f1361, RecyclerView.AbstractC0202.m627(this.f1260, this.f1258, m680() + m684(), ((ViewGroup.MarginLayoutParams) c02272).height, true), false);
                } else {
                    m758(viewM712, RecyclerView.AbstractC0202.m627(this.f1259, this.f1257, m683() + m682(), ((ViewGroup.MarginLayoutParams) c02272).width, true), this.f1361, false);
                }
            } else if (this.f1348 == 1) {
                m758(viewM712, RecyclerView.AbstractC0202.m627(this.f1349, this.f1257, 0, ((ViewGroup.MarginLayoutParams) c02272).width, false), RecyclerView.AbstractC0202.m627(this.f1260, this.f1258, m680() + m684(), ((ViewGroup.MarginLayoutParams) c02272).height, true), false);
            } else {
                m758(viewM712, RecyclerView.AbstractC0202.m627(this.f1259, this.f1257, m683() + m682(), ((ViewGroup.MarginLayoutParams) c02272).width, true), RecyclerView.AbstractC0202.m627(this.f1349, this.f1258, 0, ((ViewGroup.MarginLayoutParams) c02272).height, false), false);
            }
            if (c2356.f7492 == 1) {
                int iM776 = c02272.f1377 ? m776(iMo4409) : c02335.m798(iMo4409);
                int iMo44103 = this.f1346.mo4410(viewM712) + iM776;
                if (z5 && c02272.f1377) {
                    C0228.C0229 c0229 = new C0228.C0229();
                    c0229.f1382 = new int[this.f1344];
                    for (int i11 = 0; i11 < this.f1344; i11++) {
                        c0229.f1382[i11] = iM776 - this.f1345[i11].m798(iM776);
                    }
                    c0229.f1381 = -1;
                    c0229.f1380 = iM694;
                    this.f1356.m793(c0229);
                }
                i2 = iM776;
                i = iMo44103;
            } else {
                int iM778 = c02272.f1377 ? m778(iMo4409) : c02335.m803(iMo4409);
                int iMo44104 = iM778 - this.f1346.mo4410(viewM712);
                if (z5 && c02272.f1377) {
                    C0228.C0229 c02292 = new C0228.C0229();
                    c02292.f1382 = new int[this.f1344];
                    for (int i12 = 0; i12 < this.f1344; i12++) {
                        c02292.f1382[i12] = this.f1345[i12].m803(iM778) - iM778;
                    }
                    c02292.f1381 = 1;
                    c02292.f1380 = iM694;
                    this.f1356.m793(c02292);
                }
                i = iM778;
                i2 = iMo44104;
            }
            if (c02272.f1377 && c2356.f7491 == -1) {
                if (z5) {
                    this.f1364 = true;
                } else {
                    if (c2356.f7492 == 1) {
                        int iM7982 = this.f1345[0].m798(Integer.MIN_VALUE);
                        int i13 = 1;
                        while (true) {
                            if (i13 >= this.f1344) {
                                z3 = true;
                                break;
                            }
                            if (this.f1345[i13].m798(Integer.MIN_VALUE) != iM7982) {
                                z3 = false;
                                break;
                            }
                            i13++;
                        }
                        z2 = !z3;
                    } else {
                        int iM8032 = this.f1345[0].m803(Integer.MIN_VALUE);
                        int i14 = 1;
                        while (true) {
                            if (i14 >= this.f1344) {
                                z = true;
                                break;
                            }
                            if (this.f1345[i14].m803(Integer.MIN_VALUE) != iM8032) {
                                z = false;
                                break;
                            }
                            i14++;
                        }
                        z2 = !z;
                    }
                    if (z2) {
                        C0228.C0229 c0229M796 = this.f1356.m796(iM694);
                        if (c0229M796 != null) {
                            c0229M796.f1383 = true;
                        }
                        this.f1364 = true;
                    }
                }
            }
            if (c2356.f7492 == 1) {
                if (c02272.f1377) {
                    int i15 = this.f1344;
                    while (true) {
                        i15--;
                        if (i15 < 0) {
                            break;
                        }
                        this.f1345[i15].m802(viewM712);
                    }
                } else {
                    c02272.f1376.m802(viewM712);
                }
            } else if (c02272.f1377) {
                int i16 = this.f1344;
                while (true) {
                    i16--;
                    if (i16 < 0) {
                        break;
                    }
                    this.f1345[i16].m807(viewM712);
                }
            } else {
                c02272.f1376.m807(viewM712);
            }
            if (m785() && this.f1348 == 1) {
                int iMo44093 = c02272.f1377 ? this.f1347.mo4409() : this.f1347.mo4409() - (((this.f1344 - 1) - c02335.f1398) * this.f1349);
                iMo44102 = iMo44093;
                iMo4410 = iMo44093 - this.f1347.mo4410(viewM712);
            } else {
                int iMo44172 = c02272.f1377 ? this.f1347.mo4417() : (c02335.f1398 * this.f1349) + this.f1347.mo4417();
                iMo4410 = iMo44172;
                iMo44102 = this.f1347.mo4410(viewM712) + iMo44172;
            }
            if (this.f1348 == 1) {
                m634(viewM712, iMo4410, i2, iMo44102, i);
                c0227 = c02272;
            } else {
                int i17 = i2;
                int i18 = i;
                c0227 = c02272;
                m634(viewM712, i17, iMo4410, i18, iMo44102);
            }
            if (c0227.f1377) {
                m769(this.f1350.f7492, i6);
            } else {
                m762(c02335, this.f1350.f7492, i6);
            }
            m761(c0213, this.f1350);
            if (this.f1350.f7495 && viewM712.hasFocusable()) {
                if (c0227.f1377) {
                    this.f1353.clear();
                } else {
                    this.f1353.set(c02335.f1398, false);
                }
            }
            c02132 = c0213;
            z4 = true;
            c = 0;
        }
        RecyclerView.C0213 c02133 = c02132;
        if (!z4) {
            m761(c02133, this.f1350);
        }
        int iMo44173 = this.f1350.f7492 == -1 ? this.f1346.mo4417() - m778(this.f1346.mo4417()) : m776(this.f1346.mo4409()) - this.f1346.mo4409();
        if (iMo44173 > 0) {
            return Math.min(c2356.f7489, iMo44173);
        }
        return 0;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public int mo469(RecyclerView.C0221 c0221) {
        return m773(c0221);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0218.InterfaceC0220
    /* JADX INFO: renamed from: ֏ */
    public PointF mo470(int i) {
        int iM774 = m774(i);
        PointF pointF = new PointF();
        if (iM774 == 0) {
            return null;
        }
        if (this.f1348 == 0) {
            pointF.x = iM774;
            pointF.y = 0.0f;
        } else {
            pointF.x = 0.0f;
            pointF.y = iM774;
        }
        return pointF;
    }

    /* JADX WARN: Removed duplicated region for block: B:23:0x0030  */
    /* JADX WARN: Removed duplicated region for block: B:30:0x003e  */
    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public View mo430(View view, int i, RecyclerView.C0213 c0213, RecyclerView.C0221 c0221) {
        View viewM660;
        int i2;
        View viewM800;
        if (m664() == 0 || (viewM660 = m660(view)) == null) {
            return null;
        }
        m786();
        if (i != 1) {
            if (i != 2) {
                if (i != 17) {
                    if (i != 33) {
                        if (i == 66 ? this.f1348 == 0 : !(i != 130 || this.f1348 != 1)) {
                            i2 = 1;
                        }
                    } else if (this.f1348 == 1) {
                        i2 = -1;
                    }
                    i2 = Integer.MIN_VALUE;
                } else if (this.f1348 != 0) {
                    i2 = Integer.MIN_VALUE;
                }
            } else if (this.f1348 != 1 && m785()) {
            }
        } else if (this.f1348 != 1 && m785()) {
        }
        if (i2 == Integer.MIN_VALUE) {
            return null;
        }
        C0227 c0227 = (C0227) viewM660.getLayoutParams();
        boolean z = c0227.f1377;
        C0233 c0233 = c0227.f1376;
        int iM783 = i2 == 1 ? m783() : m782();
        m764(iM783, c0221);
        m780(i2);
        C2356 c2356 = this.f1350;
        c2356.f7490 = c2356.f7491 + iM783;
        c2356.f7489 = (int) (this.f1346.mo4419() * 0.33333334f);
        C2356 c23562 = this.f1350;
        c23562.f7495 = true;
        c23562.f7488 = false;
        m756(c0213, c23562, c0221);
        this.f1358 = this.f1352;
        if (!z && (viewM800 = c0233.m800(iM783, i2)) != null && viewM800 != viewM660) {
            return viewM800;
        }
        if (m779(i2)) {
            for (int i3 = this.f1344 - 1; i3 >= 0; i3--) {
                View viewM8002 = this.f1345[i3].m800(iM783, i2);
                if (viewM8002 != null && viewM8002 != viewM660) {
                    return viewM8002;
                }
            }
        } else {
            for (int i4 = 0; i4 < this.f1344; i4++) {
                View viewM8003 = this.f1345[i4].m800(iM783, i2);
                if (viewM8003 != null && viewM8003 != viewM660) {
                    return viewM8003;
                }
            }
        }
        boolean z2 = (this.f1351 ^ true) == (i2 == -1);
        if (!z) {
            View viewMo485 = mo485(z2 ? c0233.m808() : c0233.m809());
            if (viewMo485 != null && viewMo485 != viewM660) {
                return viewMo485;
            }
        }
        if (m779(i2)) {
            for (int i5 = this.f1344 - 1; i5 >= 0; i5--) {
                if (i5 != c0233.f1398) {
                    View viewMo4852 = mo485(z2 ? this.f1345[i5].m808() : this.f1345[i5].m809());
                    if (viewMo4852 != null && viewMo4852 != viewM660) {
                        return viewMo4852;
                    }
                }
            }
        } else {
            for (int i6 = 0; i6 < this.f1344; i6++) {
                View viewMo4853 = mo485(z2 ? this.f1345[i6].m808() : this.f1345[i6].m809());
                if (viewMo4853 != null && viewMo4853 != viewM660) {
                    return viewMo4853;
                }
            }
        }
        return null;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public RecyclerView.C0207 mo432(Context context, AttributeSet attributeSet) {
        return new C0227(context, attributeSet);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public RecyclerView.C0207 mo433(ViewGroup.LayoutParams layoutParams) {
        return layoutParams instanceof ViewGroup.MarginLayoutParams ? new C0227((ViewGroup.MarginLayoutParams) layoutParams) : new C0227(layoutParams);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo473(int i, int i2, RecyclerView.C0221 c0221, RecyclerView.AbstractC0202.InterfaceC0205 interfaceC0205) {
        int iM798;
        int iM803;
        if (this.f1348 != 0) {
            i = i2;
        }
        if (m664() == 0 || i == 0) {
            return;
        }
        m757(i, c0221);
        int[] iArr = this.f1366;
        if (iArr == null || iArr.length < this.f1344) {
            this.f1366 = new int[this.f1344];
        }
        int i3 = 0;
        for (int i4 = 0; i4 < this.f1344; i4++) {
            C2356 c2356 = this.f1350;
            if (c2356.f7491 == -1) {
                iM798 = c2356.f7493;
                iM803 = this.f1345[i4].m803(iM798);
            } else {
                iM798 = this.f1345[i4].m798(c2356.f7494);
                iM803 = this.f1350.f7494;
            }
            int i5 = iM798 - iM803;
            if (i5 >= 0) {
                this.f1366[i3] = i5;
                i3++;
            }
        }
        Arrays.sort(this.f1366, 0, i3);
        for (int i6 = 0; i6 < i3; i6++) {
            int i7 = this.f1350.f7490;
            if (!(i7 >= 0 && i7 < c0221.m728())) {
                return;
            }
            ((RunnableC2352.C2354) interfaceC0205).m4402(this.f1350.f7490, this.f1366[i6]);
            C2356 c23562 = this.f1350;
            c23562.f7490 += c23562.f7491;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m757(int i, RecyclerView.C0221 c0221) {
        int iM782;
        int i2;
        if (i > 0) {
            iM782 = m783();
            i2 = 1;
        } else {
            iM782 = m782();
            i2 = -1;
        }
        this.f1350.f7488 = true;
        m764(iM782, c0221);
        m780(i2);
        C2356 c2356 = this.f1350;
        c2356.f7490 = iM782 + c2356.f7491;
        c2356.f7489 = Math.abs(i);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo434(Rect rect, int i, int i2) {
        int iM626;
        int iM6262;
        int iM683 = m683() + m682();
        int iM680 = m680() + m684();
        if (this.f1348 == 1) {
            iM6262 = RecyclerView.AbstractC0202.m626(i2, rect.height() + iM680, m676());
            iM626 = RecyclerView.AbstractC0202.m626(i, (this.f1349 * this.f1344) + iM683, m678());
        } else {
            iM626 = RecyclerView.AbstractC0202.m626(i, rect.width() + iM683, m678());
            iM6262 = RecyclerView.AbstractC0202.m626(i2, (this.f1349 * this.f1344) + iM680, m676());
        }
        this.f1244.setMeasuredDimension(iM626, iM6262);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo476(Parcelable parcelable) {
        if (parcelable instanceof C0231) {
            this.f1360 = (C0231) parcelable;
            m687();
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m758(View view, int i, int i2, boolean z) {
        m636(view, this.f1362);
        C0227 c0227 = (C0227) view.getLayoutParams();
        int i3 = ((ViewGroup.MarginLayoutParams) c0227).leftMargin;
        Rect rect = this.f1362;
        int iM772 = m772(i, i3 + rect.left, ((ViewGroup.MarginLayoutParams) c0227).rightMargin + rect.right);
        int i4 = ((ViewGroup.MarginLayoutParams) c0227).topMargin;
        Rect rect2 = this.f1362;
        int iM7722 = m772(i2, i4 + rect2.top, ((ViewGroup.MarginLayoutParams) c0227).bottomMargin + rect2.bottom);
        if (z ? m658(view, iM772, iM7722, c0227) : m646(view, iM772, iM7722, c0227)) {
            view.measure(iM772, iM7722);
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo477(AccessibilityEvent accessibilityEvent) {
        super.mo477(accessibilityEvent);
        if (m664() > 0) {
            View viewM768 = m768(false);
            View viewM763 = m763(false);
            if (viewM768 == null || viewM763 == null) {
                return;
            }
            int iM681 = m681(viewM768);
            int iM6812 = m681(viewM763);
            if (iM681 < iM6812) {
                accessibilityEvent.setFromIndex(iM681);
                accessibilityEvent.setToIndex(iM6812);
            } else {
                accessibilityEvent.setFromIndex(iM6812);
                accessibilityEvent.setToIndex(iM681);
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m759(RecyclerView.C0213 c0213, int i) {
        for (int iM664 = m664() - 1; iM664 >= 0; iM664--) {
            View viewM659 = m659(iM664);
            if (this.f1346.mo4414(viewM659) < i || this.f1346.mo4418(viewM659) < i) {
                return;
            }
            C0227 c0227 = (C0227) viewM659.getLayoutParams();
            if (c0227.f1377) {
                for (int i2 = 0; i2 < this.f1344; i2++) {
                    if (this.f1345[i2].f1394.size() == 1) {
                        return;
                    }
                }
                for (int i3 = 0; i3 < this.f1344; i3++) {
                    this.f1345[i3].m810();
                }
            } else if (c0227.f1376.f1394.size() == 1) {
                return;
            } else {
                c0227.f1376.m810();
            }
            m655(viewM659, c0213);
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo436(RecyclerView.C0213 c0213, RecyclerView.C0221 c0221, View view, C1947 c1947) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (!(layoutParams instanceof C0227)) {
            super.m638(view, c1947);
            return;
        }
        C0227 c0227 = (C0227) layoutParams;
        if (this.f1348 == 0) {
            C0233 c0233 = c0227.f1376;
            c1947.m3818(C1947.C1949.m3821(c0233 == null ? -1 : c0233.f1398, c0227.f1377 ? this.f1344 : 1, -1, -1, false, false));
        } else {
            C0233 c02332 = c0227.f1376;
            c1947.m3818(C1947.C1949.m3821(-1, -1, c02332 == null ? -1 : c02332.f1398, c0227.f1377 ? this.f1344 : 1, false, false));
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m760(RecyclerView.C0213 c0213, RecyclerView.C0221 c0221, boolean z) {
        int iMo4409;
        int iM776 = m776(Integer.MIN_VALUE);
        if (iM776 != Integer.MIN_VALUE && (iMo4409 = this.f1346.mo4409() - iM776) > 0) {
            int i = iMo4409 - (-m767(-iMo4409, c0213, c0221));
            if (!z || i <= 0) {
                return;
            }
            this.f1346.mo4408(i);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m761(RecyclerView.C0213 c0213, C2356 c2356) {
        if (!c2356.f7488 || c2356.f7496) {
            return;
        }
        if (c2356.f7489 == 0) {
            if (c2356.f7492 == -1) {
                m759(c0213, c2356.f7494);
                return;
            } else {
                m765(c0213, c2356.f7493);
                return;
            }
        }
        int i = 1;
        if (c2356.f7492 == -1) {
            int i2 = c2356.f7493;
            int iM803 = this.f1345[0].m803(i2);
            while (i < this.f1344) {
                int iM8032 = this.f1345[i].m803(i2);
                if (iM8032 > iM803) {
                    iM803 = iM8032;
                }
                i++;
            }
            int i3 = i2 - iM803;
            m759(c0213, i3 < 0 ? c2356.f7494 : c2356.f7494 - Math.min(i3, c2356.f7489));
            return;
        }
        int i4 = c2356.f7494;
        int iM798 = this.f1345[0].m798(i4);
        while (i < this.f1344) {
            int iM7982 = this.f1345[i].m798(i4);
            if (iM7982 < iM798) {
                iM798 = iM7982;
            }
            i++;
        }
        int i5 = iM798 - c2356.f7494;
        m765(c0213, i5 < 0 ? c2356.f7493 : Math.min(i5, c2356.f7489) + c2356.f7493);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo440(RecyclerView recyclerView) {
        this.f1356.m790();
        m687();
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo441(RecyclerView recyclerView, int i, int i2) {
        m770(i, i2, 1);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo442(RecyclerView recyclerView, int i, int i2, int i3) {
        m770(i, i2, 8);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo443(RecyclerView recyclerView, int i, int i2, Object obj) {
        m770(i, i2, 4);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo481(RecyclerView recyclerView, RecyclerView.C0213 c0213) {
        Runnable runnable = this.f1367;
        RecyclerView recyclerView2 = this.f1244;
        if (recyclerView2 != null) {
            recyclerView2.removeCallbacks(runnable);
        }
        for (int i = 0; i < this.f1344; i++) {
            this.f1345[i].m806();
        }
        recyclerView.requestLayout();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m762(C0233 c0233, int i, int i2) {
        int i3 = c0233.f1397;
        if (i == -1) {
            int i4 = c0233.f1395;
            if (i4 == Integer.MIN_VALUE) {
                c0233.m805();
                i4 = c0233.f1395;
            }
            if (i4 + i3 <= i2) {
                this.f1353.set(c0233.f1398, false);
                return;
            }
            return;
        }
        int i5 = c0233.f1396;
        if (i5 == Integer.MIN_VALUE) {
            c0233.m801();
            i5 = c0233.f1396;
        }
        if (i5 - i3 >= i2) {
            this.f1353.set(c0233.f1398, false);
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public void mo482(String str) {
        RecyclerView recyclerView;
        if (this.f1360 != null || (recyclerView = this.f1244) == null) {
            return;
        }
        recyclerView.m544(str);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public boolean mo483() {
        return this.f1348 == 0;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ֏ */
    public boolean mo444(RecyclerView.C0207 c0207) {
        return c0207 instanceof C0227;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ؠ */
    public int mo445(int i, RecyclerView.C0213 c0213, RecyclerView.C0221 c0221) {
        return m767(i, c0213, c0221);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ؠ */
    public int mo446(RecyclerView.C0213 c0213, RecyclerView.C0221 c0221) {
        return this.f1348 == 0 ? this.f1344 : super.mo446(c0213, c0221);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ؠ */
    public int mo448(RecyclerView.C0221 c0221) {
        return m775(c0221);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public View m763(boolean z) {
        int iMo4417 = this.f1346.mo4417();
        int iMo4409 = this.f1346.mo4409();
        View view = null;
        for (int iM664 = m664() - 1; iM664 >= 0; iM664--) {
            View viewM659 = m659(iM664);
            int iMo4414 = this.f1346.mo4414(viewM659);
            int iMo4407 = this.f1346.mo4407(viewM659);
            if (iMo4407 > iMo4417 && iMo4414 < iMo4409) {
                if (iMo4407 <= iMo4409 || !z) {
                    return viewM659;
                }
                if (view == null) {
                    view = viewM659;
                }
            }
        }
        return view;
    }

    /* JADX WARN: Removed duplicated region for block: B:20:0x0038  */
    /* JADX WARN: Removed duplicated region for block: B:22:0x003b  */
    /* JADX WARN: Removed duplicated region for block: B:23:0x0052  */
    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m764(int i, RecyclerView.C0221 c0221) {
        int iMo4419;
        int iMo44192;
        RecyclerView recyclerView;
        int i2;
        C2356 c2356 = this.f1350;
        boolean z = false;
        c2356.f7489 = 0;
        c2356.f7490 = i;
        if (!m686() || (i2 = c0221.f1302) == -1) {
            iMo4419 = 0;
        } else {
            if (this.f1352 != (i2 < i)) {
                iMo44192 = this.f1346.mo4419();
                iMo4419 = 0;
                recyclerView = this.f1244;
                if (recyclerView == null && recyclerView.f1163) {
                    this.f1350.f7494 = this.f1346.mo4406() + iMo4419;
                    this.f1350.f7493 = -iMo44192;
                } else {
                    this.f1350.f7493 = this.f1346.mo4417() - iMo44192;
                    this.f1350.f7494 = this.f1346.mo4409() + iMo4419;
                }
                C2356 c23562 = this.f1350;
                c23562.f7495 = false;
                c23562.f7488 = true;
                if (this.f1346.mo4413() == 0 && this.f1346.mo4406() == 0) {
                    z = true;
                }
                c23562.f7496 = z;
            }
            iMo4419 = this.f1346.mo4419();
        }
        iMo44192 = 0;
        recyclerView = this.f1244;
        if (recyclerView == null && recyclerView.f1163) {
        }
        C2356 c235622 = this.f1350;
        c235622.f7495 = false;
        c235622.f7488 = true;
        if (this.f1346.mo4413() == 0) {
            z = true;
        }
        c235622.f7496 = z;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m765(RecyclerView.C0213 c0213, int i) {
        while (m664() > 0) {
            View viewM659 = m659(0);
            if (this.f1346.mo4407(viewM659) > i || this.f1346.mo4416(viewM659) > i) {
                return;
            }
            C0227 c0227 = (C0227) viewM659.getLayoutParams();
            if (c0227.f1377) {
                for (int i2 = 0; i2 < this.f1344; i2++) {
                    if (this.f1345[i2].f1394.size() == 1) {
                        return;
                    }
                }
                for (int i3 = 0; i3 < this.f1344; i3++) {
                    this.f1345[i3].m811();
                }
            } else if (c0227.f1376.f1394.size() == 1) {
                return;
            } else {
                c0227.f1376.m811();
            }
            m655(viewM659, c0213);
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m766(RecyclerView.C0213 c0213, RecyclerView.C0221 c0221, boolean z) {
        int iMo4417;
        int iM778 = m778(Integer.MAX_VALUE);
        if (iM778 != Integer.MAX_VALUE && (iMo4417 = iM778 - this.f1346.mo4417()) > 0) {
            int iM767 = iMo4417 - m767(iMo4417, c0213, c0221);
            if (!z || iM767 <= 0) {
                return;
            }
            this.f1346.mo4408(-iM767);
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ؠ */
    public void mo450(RecyclerView recyclerView, int i, int i2) {
        m770(i, i2, 2);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ؠ */
    public boolean mo487() {
        return this.f1348 == 1;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public int m767(int i, RecyclerView.C0213 c0213, RecyclerView.C0221 c0221) {
        if (m664() == 0 || i == 0) {
            return 0;
        }
        m757(i, c0221);
        int iM756 = m756(c0213, this.f1350, c0221);
        if (this.f1350.f7489 >= iM756) {
            i = i < 0 ? -iM756 : iM756;
        }
        this.f1346.mo4408(-i);
        this.f1358 = this.f1352;
        C2356 c2356 = this.f1350;
        c2356.f7489 = 0;
        m761(c0213, c2356);
        return i;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ހ */
    public int mo453(RecyclerView.C0221 c0221) {
        return m777(c0221);
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public View m768(boolean z) {
        int iMo4417 = this.f1346.mo4417();
        int iMo4409 = this.f1346.mo4409();
        int iM664 = m664();
        View view = null;
        for (int i = 0; i < iM664; i++) {
            View viewM659 = m659(i);
            int iMo4414 = this.f1346.mo4414(viewM659);
            if (this.f1346.mo4407(viewM659) > iMo4417 && iMo4414 < iMo4409) {
                if (iMo4414 >= iMo4417 || !z) {
                    return viewM659;
                }
                if (view == null) {
                    view = viewM659;
                }
            }
        }
        return view;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ހ */
    public RecyclerView.C0207 mo454() {
        return this.f1348 == 0 ? new C0227(-2, -1) : new C0227(-1, -2);
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final void m769(int i, int i2) {
        for (int i3 = 0; i3 < this.f1344; i3++) {
            if (!this.f1345[i3].f1394.isEmpty()) {
                m762(this.f1345[i3], i, i2);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x0025  */
    /* JADX WARN: Removed duplicated region for block: B:21:0x003c  */
    /* JADX WARN: Removed duplicated region for block: B:23:0x0043 A[RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:24:0x0044  */
    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m770(int i, int i2, int i3) {
        int i4;
        int i5;
        int iM783 = this.f1352 ? m783() : m782();
        if (i3 != 8) {
            i4 = i + i2;
        } else {
            if (i >= i2) {
                i4 = i + 1;
                i5 = i2;
                this.f1356.m797(i5);
                if (i3 != 1) {
                    this.f1356.m792(i, i2);
                } else if (i3 == 2) {
                    this.f1356.m795(i, i2);
                } else if (i3 == 8) {
                    this.f1356.m795(i, 1);
                    this.f1356.m792(i2, 1);
                }
                if (i4 > iM783) {
                    return;
                }
                if (i5 <= (this.f1352 ? m782() : m783())) {
                    m687();
                    return;
                }
                return;
            }
            i4 = i2 + 1;
        }
        i5 = i;
        this.f1356.m797(i5);
        if (i3 != 1) {
        }
        if (i4 > iM783) {
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ހ */
    public void mo455(RecyclerView.C0213 c0213, RecyclerView.C0221 c0221) {
        m771(c0213, c0221, true);
    }

    /* JADX WARN: Removed duplicated region for block: B:112:0x01bb  */
    /* JADX WARN: Removed duplicated region for block: B:259:0x0424  */
    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m771(RecyclerView.C0213 c0213, RecyclerView.C0221 c0221, boolean z) {
        C0231 c0231;
        boolean z2;
        int iM681;
        int i;
        C0226 c0226 = this.f1363;
        if (!(this.f1360 == null && this.f1354 == -1) && c0221.m728() == 0) {
            mo656(c0213);
            c0226.m788();
            return;
        }
        boolean z3 = true;
        boolean z4 = (c0226.f1373 && this.f1354 == -1 && this.f1360 == null) ? false : true;
        if (z4) {
            c0226.m788();
            C0231 c02312 = this.f1360;
            if (c02312 != null) {
                int i2 = c02312.f1386;
                if (i2 > 0) {
                    if (i2 == this.f1344) {
                        for (int i3 = 0; i3 < this.f1344; i3++) {
                            this.f1345[i3].m806();
                            C0231 c02313 = this.f1360;
                            int iMo4409 = c02313.f1387[i3];
                            if (iMo4409 != Integer.MIN_VALUE) {
                                iMo4409 += c02313.f1392 ? this.f1346.mo4409() : this.f1346.mo4417();
                            }
                            C0233 c0233 = this.f1345[i3];
                            c0233.f1395 = iMo4409;
                            c0233.f1396 = iMo4409;
                        }
                    } else {
                        c02312.f1387 = null;
                        c02312.f1386 = 0;
                        c02312.f1388 = 0;
                        c02312.f1389 = null;
                        c02312.f1390 = null;
                        c02312.f1384 = c02312.f1385;
                    }
                }
                C0231 c02314 = this.f1360;
                this.f1359 = c02314.f1393;
                boolean z5 = c02314.f1391;
                mo482((String) null);
                C0231 c02315 = this.f1360;
                if (c02315 != null && c02315.f1391 != z5) {
                    c02315.f1391 = z5;
                }
                this.f1351 = z5;
                m687();
                m786();
                C0231 c02316 = this.f1360;
                int i4 = c02316.f1384;
                if (i4 != -1) {
                    this.f1354 = i4;
                    c0226.f1371 = c02316.f1392;
                } else {
                    c0226.f1371 = this.f1352;
                }
                C0231 c02317 = this.f1360;
                if (c02317.f1388 > 1) {
                    C0228 c0228 = this.f1356;
                    c0228.f1378 = c02317.f1389;
                    c0228.f1379 = c02317.f1390;
                }
            } else {
                m786();
                c0226.f1371 = this.f1352;
            }
            if (c0221.f1308 || (i = this.f1354) == -1) {
                z2 = false;
                if (!z2) {
                    if (this.f1358) {
                        int iM728 = c0221.m728();
                        int iM664 = m664();
                        while (true) {
                            iM664--;
                            if (iM664 < 0) {
                                break;
                            }
                            iM681 = m681(m659(iM664));
                            if (iM681 >= 0 && iM681 < iM728) {
                                break;
                            }
                        }
                        c0226.f1369 = iM681;
                        c0226.f1370 = Integer.MIN_VALUE;
                    } else {
                        int iM7282 = c0221.m728();
                        int iM6642 = m664();
                        for (int i5 = 0; i5 < iM6642; i5++) {
                            int iM6812 = m681(m659(i5));
                            if (iM6812 >= 0 && iM6812 < iM7282) {
                                iM681 = iM6812;
                                break;
                            }
                        }
                        iM681 = 0;
                        c0226.f1369 = iM681;
                        c0226.f1370 = Integer.MIN_VALUE;
                    }
                }
                c0226.f1373 = true;
            } else if (i < 0 || i >= c0221.m728()) {
                this.f1354 = -1;
                this.f1355 = Integer.MIN_VALUE;
                z2 = false;
                if (!z2) {
                }
                c0226.f1373 = true;
            } else {
                C0231 c02318 = this.f1360;
                if (c02318 == null || c02318.f1384 == -1 || c02318.f1386 < 1) {
                    View viewMo485 = mo485(this.f1354);
                    if (viewMo485 != null) {
                        c0226.f1369 = this.f1352 ? m783() : m782();
                        if (this.f1355 != Integer.MIN_VALUE) {
                            if (c0226.f1371) {
                                c0226.f1370 = (this.f1346.mo4409() - this.f1355) - this.f1346.mo4407(viewMo485);
                            } else {
                                c0226.f1370 = (this.f1346.mo4417() + this.f1355) - this.f1346.mo4414(viewMo485);
                            }
                        } else if (this.f1346.mo4410(viewMo485) > this.f1346.mo4419()) {
                            c0226.f1370 = c0226.f1371 ? this.f1346.mo4409() : this.f1346.mo4417();
                        } else {
                            int iMo4414 = this.f1346.mo4414(viewMo485) - this.f1346.mo4417();
                            if (iMo4414 < 0) {
                                c0226.f1370 = -iMo4414;
                            } else {
                                int iMo44092 = this.f1346.mo4409() - this.f1346.mo4407(viewMo485);
                                if (iMo44092 < 0) {
                                    c0226.f1370 = iMo44092;
                                } else {
                                    c0226.f1370 = Integer.MIN_VALUE;
                                }
                            }
                        }
                    } else {
                        int i6 = this.f1354;
                        c0226.f1369 = i6;
                        int i7 = this.f1355;
                        if (i7 == Integer.MIN_VALUE) {
                            c0226.f1371 = m774(i6) == 1;
                            c0226.m787();
                        } else if (c0226.f1371) {
                            c0226.f1370 = StaggeredGridLayoutManager.this.f1346.mo4409() - i7;
                        } else {
                            c0226.f1370 = StaggeredGridLayoutManager.this.f1346.mo4417() + i7;
                        }
                        c0226.f1372 = true;
                    }
                } else {
                    c0226.f1370 = Integer.MIN_VALUE;
                    c0226.f1369 = this.f1354;
                }
                z2 = true;
                if (!z2) {
                }
                c0226.f1373 = true;
            }
        }
        if (this.f1360 == null && this.f1354 == -1 && (c0226.f1371 != this.f1358 || m785() != this.f1359)) {
            this.f1356.m790();
            c0226.f1372 = true;
        }
        if (m664() > 0 && ((c0231 = this.f1360) == null || c0231.f1386 < 1)) {
            if (c0226.f1372) {
                for (int i8 = 0; i8 < this.f1344; i8++) {
                    this.f1345[i8].m806();
                    int i9 = c0226.f1370;
                    if (i9 != Integer.MIN_VALUE) {
                        C0233 c02332 = this.f1345[i8];
                        c02332.f1395 = i9;
                        c02332.f1396 = i9;
                    }
                }
            } else if (z4 || this.f1363.f1374 == null) {
                for (int i10 = 0; i10 < this.f1344; i10++) {
                    C0233 c02333 = this.f1345[i10];
                    boolean z6 = this.f1352;
                    int i11 = c0226.f1370;
                    int iM798 = z6 ? c02333.m798(Integer.MIN_VALUE) : c02333.m803(Integer.MIN_VALUE);
                    c02333.m806();
                    if (iM798 != Integer.MIN_VALUE && ((!z6 || iM798 >= StaggeredGridLayoutManager.this.f1346.mo4409()) && (z6 || iM798 <= StaggeredGridLayoutManager.this.f1346.mo4417()))) {
                        if (i11 != Integer.MIN_VALUE) {
                            iM798 += i11;
                        }
                        c02333.f1396 = iM798;
                        c02333.f1395 = iM798;
                    }
                }
                C0226 c02262 = this.f1363;
                C0233[] c0233Arr = this.f1345;
                if (c02262 == null) {
                    throw null;
                }
                int length = c0233Arr.length;
                int[] iArr = c02262.f1374;
                if (iArr == null || iArr.length < length) {
                    c02262.f1374 = new int[StaggeredGridLayoutManager.this.f1345.length];
                }
                for (int i12 = 0; i12 < length; i12++) {
                    c02262.f1374[i12] = c0233Arr[i12].m803(Integer.MIN_VALUE);
                }
            } else {
                for (int i13 = 0; i13 < this.f1344; i13++) {
                    C0233 c02334 = this.f1345[i13];
                    c02334.m806();
                    int i14 = this.f1363.f1374[i13];
                    c02334.f1395 = i14;
                    c02334.f1396 = i14;
                }
            }
        }
        m641(c0213);
        this.f1350.f7488 = false;
        this.f1364 = false;
        int iMo4419 = this.f1347.mo4419();
        this.f1349 = iMo4419 / this.f1344;
        this.f1361 = View.MeasureSpec.makeMeasureSpec(iMo4419, this.f1347.mo4413());
        m764(c0226.f1369, c0221);
        if (c0226.f1371) {
            m780(-1);
            m756(c0213, this.f1350, c0221);
            m780(1);
            C2356 c2356 = this.f1350;
            c2356.f7490 = c0226.f1369 + c2356.f7491;
            m756(c0213, c2356, c0221);
        } else {
            m780(1);
            m756(c0213, this.f1350, c0221);
            m780(-1);
            C2356 c23562 = this.f1350;
            c23562.f7490 = c0226.f1369 + c23562.f7491;
            m756(c0213, c23562, c0221);
        }
        if (this.f1347.mo4413() != 1073741824) {
            float fMax = 0.0f;
            int iM6643 = m664();
            for (int i15 = 0; i15 < iM6643; i15++) {
                View viewM659 = m659(i15);
                float fMo4410 = this.f1347.mo4410(viewM659);
                if (fMo4410 >= fMax) {
                    if (((C0227) viewM659.getLayoutParams()) == null) {
                        throw null;
                    }
                    fMax = Math.max(fMax, fMo4410);
                }
            }
            int i16 = this.f1349;
            int iRound = Math.round(fMax * this.f1344);
            if (this.f1347.mo4413() == Integer.MIN_VALUE) {
                iRound = Math.min(iRound, this.f1347.mo4419());
            }
            this.f1349 = iRound / this.f1344;
            this.f1361 = View.MeasureSpec.makeMeasureSpec(iRound, this.f1347.mo4413());
            if (this.f1349 != i16) {
                for (int i17 = 0; i17 < iM6643; i17++) {
                    View viewM6592 = m659(i17);
                    C0227 c0227 = (C0227) viewM6592.getLayoutParams();
                    if (!c0227.f1377) {
                        if (m785() && this.f1348 == 1) {
                            int i18 = this.f1344;
                            int i19 = c0227.f1376.f1398;
                            viewM6592.offsetLeftAndRight(((-((i18 - 1) - i19)) * this.f1349) - ((-((i18 - 1) - i19)) * i16));
                        } else {
                            int i20 = c0227.f1376.f1398;
                            int i21 = this.f1349 * i20;
                            int i22 = i20 * i16;
                            if (this.f1348 == 1) {
                                viewM6592.offsetLeftAndRight(i21 - i22);
                            } else {
                                viewM6592.offsetTopAndBottom(i21 - i22);
                            }
                        }
                    }
                }
            }
        }
        if (m664() > 0) {
            if (this.f1352) {
                m760(c0213, c0221, true);
                m766(c0213, c0221, false);
            } else {
                m766(c0213, c0221, true);
                m760(c0213, c0221, false);
            }
        }
        if (!z || c0221.f1308) {
            z3 = false;
        } else if (this.f1357 != 0 && m664() > 0 && (this.f1364 || m784() != null)) {
            Runnable runnable = this.f1367;
            RecyclerView recyclerView = this.f1244;
            if (recyclerView != null) {
                recyclerView.removeCallbacks(runnable);
            }
            if (!m781()) {
            }
        }
        if (c0221.f1308) {
            this.f1363.m788();
        }
        this.f1358 = c0226.f1371;
        this.f1359 = m785();
        if (z3) {
            this.f1363.m788();
            m771(c0213, c0221, false);
        }
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final int m772(int i, int i2, int i3) {
        if (i2 == 0 && i3 == 0) {
            return i;
        }
        int mode = View.MeasureSpec.getMode(i);
        return (mode == Integer.MIN_VALUE || mode == 1073741824) ? View.MeasureSpec.makeMeasureSpec(Math.max(0, (View.MeasureSpec.getSize(i) - i2) - i3), mode) : i;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ށ */
    public int mo490(RecyclerView.C0221 c0221) {
        return m773(c0221);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ށ */
    public void mo666(int i) {
        super.mo666(i);
        for (int i2 = 0; i2 < this.f1344; i2++) {
            C0233 c0233 = this.f1345[i2];
            int i3 = c0233.f1395;
            if (i3 != Integer.MIN_VALUE) {
                c0233.f1395 = i3 + i;
            }
            int i4 = c0233.f1396;
            if (i4 != Integer.MIN_VALUE) {
                c0233.f1396 = i4 + i;
            }
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ނ */
    public int mo456(RecyclerView.C0221 c0221) {
        return m775(c0221);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ނ */
    public void mo669(int i) {
        super.mo669(i);
        for (int i2 = 0; i2 < this.f1344; i2++) {
            C0233 c0233 = this.f1345[i2];
            int i3 = c0233.f1395;
            if (i3 != Integer.MIN_VALUE) {
                c0233.f1395 = i3 + i;
            }
            int i4 = c0233.f1396;
            if (i4 != Integer.MIN_VALUE) {
                c0233.f1396 = i4 + i;
            }
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ރ */
    public int mo458(RecyclerView.C0221 c0221) {
        return m777(c0221);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ރ */
    public void mo672(int i) {
        if (i == 0) {
            m781();
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ބ */
    public void mo459(RecyclerView.C0221 c0221) {
        this.f1354 = -1;
        this.f1355 = Integer.MIN_VALUE;
        this.f1360 = null;
        this.f1363.m788();
    }

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final int m773(RecyclerView.C0221 c0221) {
        if (m664() == 0) {
            return 0;
        }
        return LayoutInflaterFactory2C1494.C1505.m2877(c0221, this.f1346, m768(!this.f1365), m763(!this.f1365), this, this.f1365);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ޅ */
    public void mo496(int i) {
        C0231 c0231 = this.f1360;
        if (c0231 != null && c0231.f1384 != i) {
            c0231.f1387 = null;
            c0231.f1386 = 0;
            c0231.f1384 = -1;
            c0231.f1385 = -1;
        }
        this.f1354 = i;
        this.f1355 = Integer.MIN_VALUE;
        m687();
    }

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final int m774(int i) {
        if (m664() == 0) {
            return this.f1352 ? 1 : -1;
        }
        return (i < m782()) != this.f1352 ? -1 : 1;
    }

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final int m775(RecyclerView.C0221 c0221) {
        if (m664() == 0) {
            return 0;
        }
        return LayoutInflaterFactory2C1494.C1505.m2878(c0221, this.f1346, m768(!this.f1365), m763(!this.f1365), this, this.f1365, this.f1352);
    }

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final int m776(int i) {
        int iM798 = this.f1345[0].m798(i);
        for (int i2 = 1; i2 < this.f1344; i2++) {
            int iM7982 = this.f1345[i2].m798(i);
            if (iM7982 > iM798) {
                iM798 = iM7982;
            }
        }
        return iM798;
    }

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final int m777(RecyclerView.C0221 c0221) {
        if (m664() == 0) {
            return 0;
        }
        return LayoutInflaterFactory2C1494.C1505.m2970(c0221, this.f1346, m768(!this.f1365), m763(!this.f1365), this, this.f1365);
    }

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final int m778(int i) {
        int iM803 = this.f1345[0].m803(i);
        for (int i2 = 1; i2 < this.f1344; i2++) {
            int iM8032 = this.f1345[i2].m803(i);
            if (iM8032 < iM803) {
                iM803 = iM8032;
            }
        }
        return iM803;
    }

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final boolean m779(int i) {
        if (this.f1348 == 0) {
            return (i == -1) != this.f1352;
        }
        return ((i == -1) == this.f1352) == m785();
    }

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public final void m780(int i) {
        C2356 c2356 = this.f1350;
        c2356.f7492 = i;
        c2356.f7491 = this.f1352 != (i == -1) ? -1 : 1;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ތ */
    public boolean mo501() {
        return this.f1357 != 0;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ގ */
    public Parcelable mo502() {
        int iM803;
        int iMo4417;
        int[] iArr;
        if (this.f1360 != null) {
            return new C0231(this.f1360);
        }
        C0231 c0231 = new C0231();
        c0231.f1391 = this.f1351;
        c0231.f1392 = this.f1358;
        c0231.f1393 = this.f1359;
        C0228 c0228 = this.f1356;
        if (c0228 == null || (iArr = c0228.f1378) == null) {
            c0231.f1388 = 0;
        } else {
            c0231.f1389 = iArr;
            c0231.f1388 = iArr.length;
            c0231.f1390 = c0228.f1379;
        }
        if (m664() > 0) {
            c0231.f1384 = this.f1358 ? m783() : m782();
            View viewM763 = this.f1352 ? m763(true) : m768(true);
            c0231.f1385 = viewM763 != null ? m681(viewM763) : -1;
            int i = this.f1344;
            c0231.f1386 = i;
            c0231.f1387 = new int[i];
            for (int i2 = 0; i2 < this.f1344; i2++) {
                if (this.f1358) {
                    iM803 = this.f1345[i2].m798(Integer.MIN_VALUE);
                    if (iM803 != Integer.MIN_VALUE) {
                        iMo4417 = this.f1346.mo4409();
                        iM803 -= iMo4417;
                    }
                } else {
                    iM803 = this.f1345[i2].m803(Integer.MIN_VALUE);
                    if (iM803 != Integer.MIN_VALUE) {
                        iMo4417 = this.f1346.mo4417();
                        iM803 -= iMo4417;
                    }
                }
                c0231.f1387[i2] = iM803;
            }
        } else {
            c0231.f1384 = -1;
            c0231.f1385 = -1;
            c0231.f1386 = 0;
        }
        return c0231;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0202
    /* JADX INFO: renamed from: ޑ */
    public boolean mo461() {
        return this.f1360 == null;
    }

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public boolean m781() {
        int iM782;
        int iM783;
        if (m664() == 0 || this.f1357 == 0 || !this.f1251) {
            return false;
        }
        if (this.f1352) {
            iM782 = m783();
            iM783 = m782();
        } else {
            iM782 = m782();
            iM783 = m783();
        }
        if (iM782 == 0 && m784() != null) {
            this.f1356.m790();
            this.f1250 = true;
            m687();
            return true;
        }
        if (!this.f1364) {
            return false;
        }
        int i = this.f1352 ? -1 : 1;
        int i2 = iM783 + 1;
        C0228.C0229 c0229M789 = this.f1356.m789(iM782, i2, i, true);
        if (c0229M789 == null) {
            this.f1364 = false;
            this.f1356.m794(i2);
            return false;
        }
        C0228.C0229 c0229M7892 = this.f1356.m789(iM782, c0229M789.f1380, i * (-1), true);
        if (c0229M7892 == null) {
            this.f1356.m794(c0229M789.f1380);
        } else {
            this.f1356.m794(c0229M7892.f1380 + 1);
        }
        this.f1250 = true;
        m687();
        return true;
    }

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public int m782() {
        if (m664() == 0) {
            return 0;
        }
        return m681(m659(0));
    }

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public int m783() {
        int iM664 = m664();
        if (iM664 == 0) {
            return 0;
        }
        return m681(m659(iM664 - 1));
    }

    /* JADX WARN: Removed duplicated region for block: B:55:0x00d5  */
    /* JADX WARN: Removed duplicated region for block: B:56:0x00d7  */
    /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public View m784() {
        int i;
        int i2;
        boolean z;
        boolean z2;
        boolean z3;
        int iM664 = m664() - 1;
        BitSet bitSet = new BitSet(this.f1344);
        bitSet.set(0, this.f1344, true);
        byte b = (this.f1348 == 1 && m785()) ? (byte) 1 : (byte) -1;
        if (this.f1352) {
            i = -1;
        } else {
            i = iM664 + 1;
            iM664 = 0;
        }
        int i3 = iM664 < i ? 1 : -1;
        while (iM664 != i) {
            View viewM659 = m659(iM664);
            C0227 c0227 = (C0227) viewM659.getLayoutParams();
            if (bitSet.get(c0227.f1376.f1398)) {
                C0233 c0233 = c0227.f1376;
                if (this.f1352) {
                    int i4 = c0233.f1396;
                    if (i4 == Integer.MIN_VALUE) {
                        c0233.m801();
                        i4 = c0233.f1396;
                    }
                    if (i4 < this.f1346.mo4409()) {
                        z2 = c0233.m804(c0233.f1394.get(r11.size() - 1)).f1377;
                        z3 = !z2;
                    }
                    z3 = false;
                } else {
                    int i5 = c0233.f1395;
                    if (i5 == Integer.MIN_VALUE) {
                        c0233.m805();
                        i5 = c0233.f1395;
                    }
                    if (i5 > this.f1346.mo4417()) {
                        z2 = c0233.m804(c0233.f1394.get(0)).f1377;
                        z3 = !z2;
                    }
                    z3 = false;
                }
                if (z3) {
                    return viewM659;
                }
                bitSet.clear(c0227.f1376.f1398);
            }
            if (!c0227.f1377 && (i2 = iM664 + i3) != i) {
                View viewM6592 = m659(i2);
                if (this.f1352) {
                    int iMo4407 = this.f1346.mo4407(viewM659);
                    int iMo44072 = this.f1346.mo4407(viewM6592);
                    if (iMo4407 < iMo44072) {
                        return viewM659;
                    }
                    z = iMo4407 == iMo44072;
                } else {
                    int iMo4414 = this.f1346.mo4414(viewM659);
                    int iMo44142 = this.f1346.mo4414(viewM6592);
                    if (iMo4414 > iMo44142) {
                        return viewM659;
                    }
                    if (iMo4414 == iMo44142) {
                    }
                }
                if (z) {
                    if ((c0227.f1376.f1398 - ((C0227) viewM6592.getLayoutParams()).f1376.f1398 < 0) != (b < 0)) {
                        return viewM659;
                    }
                } else {
                    continue;
                }
            }
            iM664 += i3;
        }
        return null;
    }

    /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
    public boolean m785() {
        return m673() == 1;
    }

    /* JADX INFO: renamed from: ޗ, reason: contains not printable characters */
    public final void m786() {
        if (this.f1348 == 1 || !m785()) {
            this.f1352 = this.f1351;
        } else {
            this.f1352 = !this.f1351;
        }
    }
}
