package defpackage;

import android.os.Trace;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
import androidx.recyclerview.widget.RecyclerView;
import j$.util.DesugarCollections;
import j$.util.Objects;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.WeakHashMap;

/* JADX INFO: renamed from: ᵛˆ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C2772 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public ArrayList f10656;

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final /* synthetic */ RecyclerView f10657;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final ArrayList f10658;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public int f10659;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final ArrayList f10660;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public C4747 f10661;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final List f10662;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public int f10663;

    public C2772(RecyclerView recyclerView) {
        this.f10657 = recyclerView;
        ArrayList arrayList = new ArrayList();
        this.f10660 = arrayList;
        this.f10656 = null;
        this.f10658 = new ArrayList();
        this.f10662 = DesugarCollections.unmodifiableList(arrayList);
        this.f10659 = 2;
        this.f10663 = 2;
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final int m6682(int i) {
        RecyclerView recyclerView = this.f10657;
        C1499 c1499 = recyclerView.f899;
        if (i >= 0 && i < c1499.m4296()) {
            return !c1499.f6055 ? i : recyclerView.f918.m9040(i, 0);
        }
        StringBuilder sbM8237 = AbstractC3653.m8237(i, "invalid position ", ". State item count is ");
        sbM8237.append(c1499.m4296());
        sbM8237.append(recyclerView.m600());
        throw new IndexOutOfBoundsException(sbM8237.toString());
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final void m6683(int i) {
        boolean z = RecyclerView.f848;
        ArrayList arrayList = this.f10658;
        AbstractC4793 abstractC4793 = (AbstractC4793) arrayList.get(i);
        if (RecyclerView.f843) {
            Objects.toString(abstractC4793);
        }
        m6690(abstractC4793, true);
        arrayList.remove(i);
    }

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public final void m6684() {
        AbstractC0421 abstractC0421 = this.f10657.f869;
        this.f10663 = this.f10659 + (abstractC0421 != null ? abstractC0421.f2355 : 0);
        ArrayList arrayList = this.f10658;
        for (int size = arrayList.size() - 1; size >= 0 && arrayList.size() > this.f10663; size--) {
            m6683(size);
        }
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final C4747 m6685() {
        if (this.f10661 == null) {
            this.f10661 = new C4747();
            m6687();
        }
        return this.f10661;
    }

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final void m6686(AbstractC4793 abstractC4793) {
        if (abstractC4793.f18230) {
            this.f10656.remove(abstractC4793);
        } else {
            this.f10660.remove(abstractC4793);
        }
        abstractC4793.f18231 = null;
        abstractC4793.f18230 = false;
        abstractC4793.f18238 &= -33;
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final void m6687() {
        RecyclerView recyclerView;
        AbstractC2416 abstractC2416;
        C4747 c4747 = this.f10661;
        if (c4747 == null || (abstractC2416 = (recyclerView = this.f10657).f900) == null || !recyclerView.f922) {
            return;
        }
        c4747.f18053.add(abstractC2416);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:114:0x01c6  */
    /* JADX WARN: Removed duplicated region for block: B:131:0x0222  */
    /* JADX WARN: Removed duplicated region for block: B:134:0x022d  */
    /* JADX WARN: Removed duplicated region for block: B:181:0x0317  */
    /* JADX WARN: Removed duplicated region for block: B:183:0x031a  */
    /* JADX WARN: Removed duplicated region for block: B:219:0x03cd  */
    /* JADX WARN: Removed duplicated region for block: B:226:0x03df  */
    /* JADX WARN: Removed duplicated region for block: B:234:0x040c  */
    /* JADX WARN: Removed duplicated region for block: B:243:0x0426  */
    /* JADX WARN: Removed duplicated region for block: B:252:0x045a  */
    /* JADX WARN: Removed duplicated region for block: B:258:0x0471  */
    /* JADX WARN: Removed duplicated region for block: B:259:0x047e  */
    /* JADX WARN: Removed duplicated region for block: B:262:0x0488  */
    /* JADX WARN: Removed duplicated region for block: B:263:0x048a  */
    /* JADX WARN: Removed duplicated region for block: B:265:0x048d  */
    /* JADX WARN: Removed duplicated region for block: B:271:0x04bd  */
    /* JADX WARN: Removed duplicated region for block: B:333:0x05b8  */
    /* JADX WARN: Removed duplicated region for block: B:334:0x05c2  */
    /* JADX WARN: Removed duplicated region for block: B:340:0x05d8 A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:342:0x05dc  */
    /* JADX WARN: Removed duplicated region for block: B:37:0x007f  */
    /* JADX WARN: Removed duplicated region for block: B:42:0x0089  */
    /* JADX WARN: Type inference failed for: r7v58 */
    /* JADX WARN: Type inference failed for: r7v60 */
    /* JADX WARN: Type inference failed for: r7v63 */
    /* JADX WARN: Type inference failed for: r7v74 */
    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final AbstractC4793 m6688(long j, int i) {
        AbstractC4793 abstractC4793Mo4257;
        int i2;
        int i3;
        long j2;
        long j3;
        boolean z;
        boolean z2;
        boolean z3;
        boolean z4;
        boolean z5;
        ViewGroup.LayoutParams layoutParams;
        C5319 c5319;
        int i4;
        RecyclerView recyclerViewM533;
        AbstractC4793 abstractC4793;
        int i5;
        View view;
        ?? r7;
        int size;
        int iM9040;
        RecyclerView recyclerView = this.f10657;
        C1499 c1499 = recyclerView.f899;
        if (i < 0 || i >= c1499.m4296()) {
            StringBuilder sbM8103 = AbstractC3589.m8103("Invalid item position ", i, "(", i, "). Item count:");
            sbM8103.append(c1499.m4296());
            sbM8103.append(recyclerView.m600());
            throw new IndexOutOfBoundsException(sbM8103.toString());
        }
        if (c1499.f6055) {
            ArrayList arrayList = this.f10656;
            if (arrayList == null || (size = arrayList.size()) == 0) {
                abstractC4793Mo4257 = null;
                i2 = abstractC4793Mo4257 == null ? 1 : 0;
            } else {
                int i6 = 0;
                while (true) {
                    if (i6 < size) {
                        abstractC4793Mo4257 = (AbstractC4793) this.f10656.get(i6);
                        if (!abstractC4793Mo4257.m9985() && abstractC4793Mo4257.m9999() == i) {
                            abstractC4793Mo4257.m9996(32);
                            break;
                        }
                        i6++;
                    } else if (recyclerView.f900.f9414 && (iM9040 = recyclerView.f918.m9040(i, 0)) > 0 && iM9040 < recyclerView.f900.mo4258()) {
                        long jMo6133 = recyclerView.f900.mo6133(iM9040);
                        for (int i7 = 0; i7 < size; i7++) {
                            AbstractC4793 abstractC47932 = (AbstractC4793) this.f10656.get(i7);
                            if (!abstractC47932.m9985() && abstractC47932.f18244 == jMo6133) {
                                abstractC47932.m9996(32);
                                abstractC4793Mo4257 = abstractC47932;
                                break;
                            }
                        }
                    }
                }
                abstractC4793Mo4257 = null;
                if (abstractC4793Mo4257 == null) {
                }
            }
            ArrayList arrayList2 = this.f10660;
            ArrayList arrayList3 = this.f10658;
            if (abstractC4793Mo4257 != null) {
                int size2 = arrayList2.size();
                for (int i8 = 0; i8 < size2; i8++) {
                    AbstractC4793 abstractC47933 = (AbstractC4793) arrayList2.get(i8);
                    if (!abstractC47933.m9985() && abstractC47933.m9999() == i && !abstractC47933.m9986() && (c1499.f6055 || !abstractC47933.m9995())) {
                        abstractC47933.m9996(32);
                        abstractC4793Mo4257 = abstractC47933;
                        i3 = 1;
                        break;
                    }
                }
                ArrayList arrayList4 = (ArrayList) recyclerView.f924.f8726;
                int size3 = arrayList4.size();
                int i9 = 0;
                while (true) {
                    if (i9 >= size3) {
                        i3 = 1;
                        view = null;
                        break;
                    }
                    view = (View) arrayList4.get(i9);
                    AbstractC4793 abstractC4793M539 = RecyclerView.m539(view);
                    i3 = 1;
                    if (abstractC4793M539.m9999() == i && !abstractC4793M539.m9986() && !abstractC4793M539.m9995()) {
                        break;
                    }
                    i9++;
                }
                if (view == null) {
                    int size4 = arrayList3.size();
                    int i10 = 0;
                    while (true) {
                        if (i10 >= size4) {
                            abstractC4793Mo4257 = null;
                            break;
                        }
                        AbstractC4793 abstractC47934 = (AbstractC4793) arrayList3.get(i10);
                        if (abstractC47934.m9986() || abstractC47934.m9999() != i || abstractC47934.m10001()) {
                            i10++;
                        } else {
                            arrayList3.remove(i10);
                            if (RecyclerView.f843) {
                                abstractC47934.toString();
                            }
                            abstractC4793Mo4257 = abstractC47934;
                        }
                    }
                } else {
                    AbstractC4793 abstractC4793M5392 = RecyclerView.m539(view);
                    C2196 c2196 = recyclerView.f924;
                    C1705 c1705 = (C1705) c2196.f8725;
                    int iIndexOfChild = ((RecyclerView) ((ᵢʒʡᵟ) c2196.f8723).ᵜᵪʾ).indexOfChild(view);
                    if (iIndexOfChild < 0) {
                        ᵷᵝˎ.ˉᵲ(view, "view is not a child, cannot hide ");
                        return null;
                    }
                    if (!c1705.m4694(iIndexOfChild)) {
                        throw new RuntimeException("trying to unhide a view that was not hidden" + view);
                    }
                    c1705.m4693(iIndexOfChild);
                    c2196.m5717(view);
                    int iM5729 = recyclerView.f924.m5729(view);
                    if (iM5729 == -1) {
                        StringBuilder sb = new StringBuilder("layout index should not be -1 after unhiding a view:");
                        sb.append(abstractC4793M5392);
                        ᵷᵝˎ.ᵟᵹᵙ(sb, recyclerView.m600());
                        return null;
                    }
                    recyclerView.f924.m5740(iM5729);
                    m6692(view);
                    abstractC4793M5392.m9996(8224);
                    abstractC4793Mo4257 = abstractC4793M5392;
                }
                if (abstractC4793Mo4257 != null) {
                    if (!abstractC4793Mo4257.m9995()) {
                        int i11 = abstractC4793Mo4257.f18239;
                        if (i11 < 0 || i11 >= recyclerView.f900.mo4258()) {
                            throw new IndexOutOfBoundsException("Inconsistency detected. Invalid view holder adapter position" + abstractC4793Mo4257 + recyclerView.m600());
                        }
                        if (c1499.f6055 || recyclerView.f900.mo6135(abstractC4793Mo4257.f18239) == abstractC4793Mo4257.f18246) {
                            AbstractC2416 abstractC2416 = recyclerView.f900;
                            r7 = (!abstractC2416.f9414 || abstractC4793Mo4257.f18244 == abstractC2416.mo6133(abstractC4793Mo4257.f18239)) ? i3 : 0;
                        }
                    } else {
                        if (RecyclerView.f848 && !c1499.f6055) {
                            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("should not receive a removed view unless it is pre layout".concat(recyclerView.m600()));
                            return null;
                        }
                        r7 = c1499.f6055;
                    }
                    if (r7 == 0) {
                        abstractC4793Mo4257.m9996(4);
                        if (abstractC4793Mo4257.m9998()) {
                            recyclerView.removeDetachedView(abstractC4793Mo4257.f18236, false);
                            abstractC4793Mo4257.f18231.m6686(abstractC4793Mo4257);
                        } else if (abstractC4793Mo4257.m9985()) {
                            abstractC4793Mo4257.f18238 &= -33;
                        }
                        m6689(abstractC4793Mo4257);
                        abstractC4793Mo4257 = null;
                    } else {
                        i2 = i3;
                    }
                }
            } else {
                i3 = 1;
            }
            if (abstractC4793Mo4257 != null) {
                int iM90402 = recyclerView.f918.m9040(i, 0);
                if (iM90402 >= 0) {
                    j2 = 3;
                    if (iM90402 < recyclerView.f900.mo4258()) {
                        int iMo6135 = recyclerView.f900.mo6135(iM90402);
                        AbstractC2416 abstractC24162 = recyclerView.f900;
                        j3 = 4;
                        if (abstractC24162.f9414) {
                            long jMo61332 = abstractC24162.mo6133(iM90402);
                            int size5 = arrayList2.size() - 1;
                            while (true) {
                                if (size5 >= 0) {
                                    AbstractC4793 abstractC47935 = (AbstractC4793) arrayList2.get(size5);
                                    i5 = iM90402;
                                    long j4 = abstractC47935.f18244;
                                    View view2 = abstractC47935.f18236;
                                    if (j4 == jMo61332 && !abstractC47935.m9985()) {
                                        if (iMo6135 == abstractC47935.f18246) {
                                            abstractC47935.m9996(32);
                                            if (abstractC47935.m9995() && !c1499.f6055) {
                                                abstractC47935.f18238 = (abstractC47935.f18238 & (-15)) | 2;
                                            }
                                            abstractC4793Mo4257 = abstractC47935;
                                        } else {
                                            arrayList2.remove(size5);
                                            recyclerView.removeDetachedView(view2, false);
                                            AbstractC4793 abstractC4793M5393 = RecyclerView.m539(view2);
                                            abstractC4793M5393.f18231 = null;
                                            abstractC4793M5393.f18230 = false;
                                            abstractC4793M5393.f18238 &= -33;
                                            m6689(abstractC4793M5393);
                                        }
                                    }
                                    size5--;
                                    iM90402 = i5;
                                } else {
                                    i5 = iM90402;
                                    int size6 = arrayList3.size() - 1;
                                    while (true) {
                                        if (size6 < 0) {
                                            break;
                                        }
                                        AbstractC4793 abstractC47936 = (AbstractC4793) arrayList3.get(size6);
                                        if (abstractC47936.f18244 != jMo61332 || abstractC47936.m10001()) {
                                            size6--;
                                        } else if (iMo6135 == abstractC47936.f18246) {
                                            arrayList3.remove(size6);
                                            abstractC4793Mo4257 = abstractC47936;
                                        } else {
                                            m6683(size6);
                                        }
                                    }
                                    abstractC4793Mo4257 = null;
                                }
                            }
                            if (abstractC4793Mo4257 != null) {
                                abstractC4793Mo4257.f18239 = i5;
                                i2 = i3;
                            }
                        }
                        if (abstractC4793Mo4257 == null) {
                            boolean z6 = RecyclerView.f848;
                            C5236 c5236 = (C5236) m6685().f18054.get(iMo6135);
                            if (c5236 != null) {
                                ArrayList arrayList5 = c5236.f19745;
                                if (arrayList5.isEmpty()) {
                                    abstractC4793 = null;
                                    if (abstractC4793 != null) {
                                    }
                                    abstractC4793Mo4257 = abstractC4793;
                                } else {
                                    for (int size7 = arrayList5.size() - 1; size7 >= 0; size7--) {
                                        if (!((AbstractC4793) arrayList5.get(size7)).m10001()) {
                                            abstractC4793 = (AbstractC4793) arrayList5.remove(size7);
                                            break;
                                        }
                                    }
                                    abstractC4793 = null;
                                    if (abstractC4793 != null) {
                                        abstractC4793.m9992();
                                        boolean z7 = RecyclerView.f848;
                                    }
                                    abstractC4793Mo4257 = abstractC4793;
                                }
                            }
                        }
                        if (abstractC4793Mo4257 == null) {
                            long nanoTime = recyclerView.getNanoTime();
                            if (j != Long.MAX_VALUE) {
                                long j5 = this.f10661.m9922(iMo6135).f19744;
                                if (j5 != 0 && j5 + nanoTime >= j) {
                                    return null;
                                }
                            }
                            AbstractC2416 abstractC24163 = recyclerView.f900;
                            abstractC24163.getClass();
                            try {
                                if (AbstractC0383.m1705()) {
                                    Object[] objArr = new Object[i3];
                                    objArr[0] = Integer.valueOf(iMo6135);
                                    Trace.beginSection(String.format("RV onCreateViewHolder type=0x%X", objArr));
                                }
                                abstractC4793Mo4257 = abstractC24163.mo4257(recyclerView, iMo6135);
                                View view3 = abstractC4793Mo4257.f18236;
                                if (view3.getParent() != null) {
                                    throw new IllegalStateException("ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)");
                                }
                                abstractC4793Mo4257.f18246 = iMo6135;
                                Trace.endSection();
                                if (RecyclerView.f847 && (recyclerViewM533 = RecyclerView.m533(view3)) != null) {
                                    abstractC4793Mo4257.f18241 = new WeakReference(recyclerViewM533);
                                }
                                long nanoTime2 = recyclerView.getNanoTime() - nanoTime;
                                C5236 c5236M9922 = this.f10661.m9922(iMo6135);
                                long j6 = c5236M9922.f19744;
                                if (j6 != 0) {
                                    nanoTime2 = (nanoTime2 / 4) + ((j6 / 4) * 3);
                                }
                                c5236M9922.f19744 = nanoTime2;
                            } finally {
                                Trace.endSection();
                            }
                        }
                    }
                }
                StringBuilder sbM81032 = AbstractC3589.m8103("Inconsistency detected. Invalid item position ", i, "(offset:", iM90402, ").state:");
                sbM81032.append(c1499.m4296());
                sbM81032.append(recyclerView.m600());
                throw new IndexOutOfBoundsException(sbM81032.toString());
            }
            j2 = 3;
            j3 = 4;
            View view4 = abstractC4793Mo4257.f18236;
            if (i2 != 0 && !c1499.f6055) {
                i4 = abstractC4793Mo4257.f18238;
                if ((i4 & 8192) != 0) {
                    abstractC4793Mo4257.f18238 = i4 & (-8193);
                    if (c1499.f6053) {
                        AbstractC0090.m1145(abstractC4793Mo4257);
                        AbstractC0090 abstractC0090 = recyclerView.f884;
                        abstractC4793Mo4257.m9991();
                        abstractC0090.getClass();
                        C4240 c4240 = new C4240((byte) 0, 5);
                        c4240.m9211(abstractC4793Mo4257);
                        recyclerView.m554(abstractC4793Mo4257, c4240);
                    }
                }
            }
            if (c1499.f6055 || !abstractC4793Mo4257.m9997()) {
                if (abstractC4793Mo4257.m9997() || (abstractC4793Mo4257.f18238 & 2) != 0 || abstractC4793Mo4257.m9986()) {
                    if (!RecyclerView.f848 && abstractC4793Mo4257.m9995()) {
                        StringBuilder sb2 = new StringBuilder("Removed holder should be bound and it should come here only in pre-layout. Holder: ");
                        sb2.append(abstractC4793Mo4257);
                        ᵷᵝˎ.ᵟᵹᵙ(sb2, recyclerView.m600());
                        return null;
                    }
                    int iM90403 = recyclerView.f918.m9040(i, 0);
                    abstractC4793Mo4257.f18245 = null;
                    abstractC4793Mo4257.f18240 = recyclerView;
                    int i12 = abstractC4793Mo4257.f18246;
                    long nanoTime3 = recyclerView.getNanoTime();
                    if (j != Long.MAX_VALUE) {
                        long j7 = this.f10661.m9922(i12).f19746;
                        if (j7 == 0 || j7 + nanoTime3 < j) {
                        }
                    }
                    if (abstractC4793Mo4257.m9993()) {
                        z = false;
                    } else {
                        recyclerView.attachViewToParent(view4, recyclerView.getChildCount(), view4.getLayoutParams());
                        z = true;
                    }
                    AbstractC2416 abstractC24164 = recyclerView.f900;
                    abstractC24164.getClass();
                    z2 = abstractC4793Mo4257.f18245 != null;
                    if (!z2) {
                        abstractC4793Mo4257.f18239 = iM90403;
                        if (abstractC24164.f9414) {
                            abstractC4793Mo4257.f18244 = abstractC24164.mo6133(iM90403);
                        }
                        abstractC4793Mo4257.f18238 = (abstractC4793Mo4257.f18238 & (-520)) | 1;
                        if (AbstractC0383.m1705()) {
                            z3 = false;
                            Trace.beginSection(String.format("RV onBindViewHolder type=0x%X", Integer.valueOf(abstractC4793Mo4257.f18246)));
                        } else {
                            z3 = false;
                        }
                        abstractC4793Mo4257.f18245 = abstractC24164;
                        if (RecyclerView.f848) {
                            if (view4.getParent() == null && view4.isAttachedToWindow() != abstractC4793Mo4257.m9993()) {
                                throw new IllegalStateException("Temp-detached state out of sync with reality. holder.isTmpDetached(): " + abstractC4793Mo4257.m9993() + ", attached to window: " + view4.isAttachedToWindow() + ", holder: " + abstractC4793Mo4257);
                            }
                            if (view4.getParent() == null && view4.isAttachedToWindow()) {
                                C1685.m4566(abstractC4793Mo4257, "Attempting to bind attached holder with no parent (AKA temp detached): ");
                                return null;
                            }
                        }
                        abstractC24164.m6144(abstractC4793Mo4257, iM90403, abstractC4793Mo4257.m9991());
                        if (z2) {
                            ArrayList arrayList6 = abstractC4793Mo4257.f18229;
                            if (arrayList6 != null) {
                                arrayList6.clear();
                            }
                            abstractC4793Mo4257.f18238 &= -1025;
                            ViewGroup.LayoutParams layoutParams2 = view4.getLayoutParams();
                            if (layoutParams2 instanceof C5319) {
                                ((C5319) layoutParams2).f20073 = true;
                            }
                        }
                        if (z) {
                            recyclerView.detachViewFromParent(view4);
                        }
                        long nanoTime4 = recyclerView.getNanoTime() - nanoTime3;
                        C5236 c5236M99222 = this.f10661.m9922(abstractC4793Mo4257.f18246);
                        long j8 = c5236M99222.f19746;
                        if (j8 != 0) {
                            nanoTime4 = (nanoTime4 / j3) + ((j8 / j3) * j2);
                        }
                        c5236M99222.f19746 = nanoTime4;
                        AccessibilityManager accessibilityManager = recyclerView.f883;
                        if (accessibilityManager == null || !accessibilityManager.isEnabled()) {
                            z4 = true;
                        } else {
                            z4 = true;
                            if (view4.getImportantForAccessibility() == 0) {
                                view4.setImportantForAccessibility(1);
                            }
                            C1407 c1407 = recyclerView.f870;
                            if (c1407 != null) {
                                C2246 c2246Mo4062 = c1407.mo4062();
                                if (c2246Mo4062 instanceof C2393) {
                                    C2393 c2393 = (C2393) c2246Mo4062;
                                    View.AccessibilityDelegate accessibilityDelegateM6644 = AbstractC2746.m6644(view4);
                                    C2246 c2246 = accessibilityDelegateM6644 == null ? null : accessibilityDelegateM6644 instanceof C3540 ? ((C3540) accessibilityDelegateM6644).f13597 : new C2246(accessibilityDelegateM6644);
                                    if (c2246 != null && c2246 != c2393) {
                                        c2393.f9354.put(view4, c2246);
                                    }
                                }
                                AbstractC2746.m6649(view4, c2246Mo4062);
                            }
                        }
                        if (c1499.f6055) {
                            abstractC4793Mo4257.f18232 = i;
                        }
                        z5 = z4;
                    }
                }
                layoutParams = view4.getLayoutParams();
                if (layoutParams == null) {
                    c5319 = (C5319) recyclerView.generateDefaultLayoutParams();
                    view4.setLayoutParams(c5319);
                } else if (recyclerView.checkLayoutParams(layoutParams)) {
                    c5319 = (C5319) layoutParams;
                } else {
                    c5319 = (C5319) recyclerView.generateLayoutParams(layoutParams);
                    view4.setLayoutParams(c5319);
                }
                c5319.f20074 = abstractC4793Mo4257;
                c5319.f20075 = (i2 == 0 || !z5) ? z3 : z4;
                return abstractC4793Mo4257;
            }
            abstractC4793Mo4257.f18232 = i;
            z5 = false;
            z4 = true;
            z3 = false;
            layoutParams = view4.getLayoutParams();
            if (layoutParams == null) {
            }
            c5319.f20074 = abstractC4793Mo4257;
            c5319.f20075 = (i2 == 0 || !z5) ? z3 : z4;
            return abstractC4793Mo4257;
        }
        abstractC4793Mo4257 = null;
        ArrayList arrayList22 = this.f10660;
        ArrayList arrayList32 = this.f10658;
        if (abstractC4793Mo4257 != null) {
        }
        if (abstractC4793Mo4257 != null) {
        }
        View view42 = abstractC4793Mo4257.f18236;
        if (i2 != 0) {
            i4 = abstractC4793Mo4257.f18238;
            if ((i4 & 8192) != 0) {
            }
        }
        if (c1499.f6055) {
            if (abstractC4793Mo4257.m9997()) {
                if (!RecyclerView.f848) {
                }
                int iM904032 = recyclerView.f918.m9040(i, 0);
                abstractC4793Mo4257.f18245 = null;
                abstractC4793Mo4257.f18240 = recyclerView;
                int i122 = abstractC4793Mo4257.f18246;
                long nanoTime32 = recyclerView.getNanoTime();
                if (j != Long.MAX_VALUE) {
                }
                if (abstractC4793Mo4257.m9993()) {
                }
                AbstractC2416 abstractC241642 = recyclerView.f900;
                abstractC241642.getClass();
                if (abstractC4793Mo4257.f18245 != null) {
                }
                if (!z2) {
                }
            }
        }
        layoutParams = view42.getLayoutParams();
        if (layoutParams == null) {
        }
        c5319.f20074 = abstractC4793Mo4257;
        c5319.f20075 = (i2 == 0 || !z5) ? z3 : z4;
        return abstractC4793Mo4257;
    }

    /* JADX WARN: Code restructure failed: missing block: B:54:0x00ac, code lost:
    
        r6 = r6 - 1;
     */
    /* JADX WARN: Removed duplicated region for block: B:16:0x0032  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x0093  */
    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m6689(AbstractC4793 abstractC4793) {
        boolean z;
        boolean z2;
        int i;
        RecyclerView recyclerView = this.f10657;
        C0807 c0807 = recyclerView.f889;
        boolean zM9998 = abstractC4793.m9998();
        View view = abstractC4793.f18236;
        boolean z3 = true;
        if (zM9998 || view.getParent() != null) {
            StringBuilder sb = new StringBuilder("Scrapped or attached views may not be recycled. isScrap:");
            sb.append(abstractC4793.m9998());
            sb.append(" isAttached:");
            sb.append(view.getParent() != null);
            sb.append(recyclerView.m600());
            throw new IllegalArgumentException(sb.toString());
        }
        if (abstractC4793.m9993()) {
            StringBuilder sb2 = new StringBuilder("Tmp detached view should be removed from RecyclerView before it can be recycled: ");
            sb2.append(abstractC4793);
            ᵕᵩʽᵲ.ˋˈ(sb2, recyclerView.m600());
            return;
        }
        if (abstractC4793.m9994()) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("Trying to recycle an ignored view holder. You should first call stopIgnoringView(view) before calling recycle.".concat(recyclerView.m600()));
            return;
        }
        if ((abstractC4793.f18238 & 16) == 0) {
            WeakHashMap weakHashMap = AbstractC2746.f10556;
            z = view.hasTransientState();
        }
        boolean z4 = RecyclerView.f848;
        ArrayList arrayList = this.f10658;
        if (z4 && arrayList.contains(abstractC4793)) {
            StringBuilder sb3 = new StringBuilder("cached view received recycle internal? ");
            sb3.append(abstractC4793);
            ᵕᵩʽᵲ.ˋˈ(sb3, recyclerView.m600());
            return;
        }
        if (abstractC4793.m10000()) {
            if (this.f10663 <= 0 || (abstractC4793.f18238 & 526) != 0) {
                z2 = false;
            } else {
                int size = arrayList.size();
                if (size >= this.f10663 && size > 0) {
                    m6683(0);
                    size--;
                }
                if (RecyclerView.f847 && size > 0) {
                    int i2 = abstractC4793.f18239;
                    if (c0807.f3608 != null) {
                        int i3 = c0807.f3610 * 2;
                        for (int i4 = 0; i4 < i3; i4 += 2) {
                            if (c0807.f3608[i4] == i2) {
                                break;
                            }
                        }
                        i = size - 1;
                        loop1: while (i >= 0) {
                            int i5 = ((AbstractC4793) arrayList.get(i)).f18239;
                            if (c0807.f3608 == null) {
                                break;
                            }
                            int i6 = c0807.f3610 * 2;
                            for (int i7 = 0; i7 < i6; i7 += 2) {
                                if (c0807.f3608[i7] == i5) {
                                    break;
                                }
                            }
                            break loop1;
                        }
                        size = i + 1;
                    } else {
                        i = size - 1;
                        loop1: while (i >= 0) {
                        }
                        size = i + 1;
                    }
                }
                arrayList.add(size, abstractC4793);
                z2 = true;
            }
            if (z2) {
                z3 = false;
            } else {
                m6690(abstractC4793, true);
            }
            z = z2;
        } else {
            if (RecyclerView.f843) {
                recyclerView.m600();
            }
            z3 = false;
        }
        recyclerView.f866.ᵱʡˏ(abstractC4793);
        if (z || z3 || !z) {
            return;
        }
        ᵹˊᵫˋ.ːˏᵟᵯ(view);
        abstractC4793.f18245 = null;
        abstractC4793.f18240 = null;
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final void m6690(AbstractC4793 abstractC4793, boolean z) {
        RecyclerView.m540(abstractC4793);
        View view = abstractC4793.f18236;
        RecyclerView recyclerView = this.f10657;
        C1407 c1407 = recyclerView.f870;
        if (c1407 != null) {
            C2246 c2246Mo4062 = c1407.mo4062();
            AbstractC2746.m6649(view, c2246Mo4062 instanceof C2393 ? (C2246) ((C2393) c2246Mo4062).f9354.remove(view) : null);
        }
        if (z) {
            InterfaceC2496 interfaceC2496 = recyclerView.f861;
            ArrayList arrayList = recyclerView.f859;
            if (interfaceC2496 != null) {
                ((C3108) interfaceC2496).m7202(abstractC4793);
            }
            int size = arrayList.size();
            for (int i = 0; i < size; i++) {
                ((C3108) ((InterfaceC2496) arrayList.get(i))).m7202(abstractC4793);
            }
            AbstractC2416 abstractC2416 = recyclerView.f900;
            if (abstractC2416 != null) {
                abstractC2416.m6134(abstractC4793);
            }
            if (recyclerView.f899 != null) {
                recyclerView.f866.ᵱʡˏ(abstractC4793);
            }
            if (RecyclerView.f843) {
                Objects.toString(abstractC4793);
            }
        }
        abstractC4793.f18245 = null;
        abstractC4793.f18240 = null;
        C4747 c4747M6685 = m6685();
        c4747M6685.getClass();
        int i2 = abstractC4793.f18246;
        ArrayList arrayList2 = c4747M6685.m9922(i2).f19745;
        if (((C5236) c4747M6685.f18054.get(i2)).f19743 <= arrayList2.size()) {
            ᵹˊᵫˋ.ːˏᵟᵯ(view);
        } else if (RecyclerView.f848 && arrayList2.contains(abstractC4793)) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("this scrap item already exists");
        } else {
            abstractC4793.m9992();
            arrayList2.add(abstractC4793);
        }
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final void m6691() {
        ArrayList arrayList = this.f10658;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            m6683(size);
        }
        arrayList.clear();
        if (RecyclerView.f847) {
            C0807 c0807 = this.f10657.f889;
            int[] iArr = c0807.f3608;
            if (iArr != null) {
                Arrays.fill(iArr, -1);
            }
            c0807.f3610 = 0;
        }
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final void m6692(View view) {
        AbstractC0090 abstractC0090;
        AbstractC4793 abstractC4793M539 = RecyclerView.m539(view);
        int i = abstractC4793M539.f18238 & 12;
        RecyclerView recyclerView = this.f10657;
        if (i == 0 && abstractC4793M539.m9989() && (abstractC0090 = recyclerView.f884) != null && !abstractC0090.mo1146(abstractC4793M539, abstractC4793M539.m9991())) {
            if (this.f10656 == null) {
                this.f10656 = new ArrayList();
            }
            abstractC4793M539.f18231 = this;
            abstractC4793M539.f18230 = true;
            this.f10656.add(abstractC4793M539);
            return;
        }
        if (abstractC4793M539.m9986() && !abstractC4793M539.m9995() && !recyclerView.f900.f9414) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("Called scrap view with an invalid view. Invalid views cannot be reused from scrap, they should rebound from recycler pool.".concat(recyclerView.m600()));
            return;
        }
        abstractC4793M539.f18231 = this;
        abstractC4793M539.f18230 = false;
        this.f10660.add(abstractC4793M539);
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final View m6693(int i) {
        return m6688(Long.MAX_VALUE, i).f18236;
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final void m6694(View view) {
        AbstractC4793 abstractC4793M539 = RecyclerView.m539(view);
        boolean zM9993 = abstractC4793M539.m9993();
        RecyclerView recyclerView = this.f10657;
        if (zM9993) {
            recyclerView.removeDetachedView(view, false);
        }
        if (abstractC4793M539.m9998()) {
            abstractC4793M539.f18231.m6686(abstractC4793M539);
        } else if (abstractC4793M539.m9985()) {
            abstractC4793M539.f18238 &= -33;
        }
        m6689(abstractC4793M539);
        if (recyclerView.f884 == null || abstractC4793M539.m10000()) {
            return;
        }
        recyclerView.f884.mo1149(abstractC4793M539);
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final void m6695(AbstractC2416 abstractC2416, boolean z) {
        C4747 c4747 = this.f10661;
        if (c4747 != null) {
            SparseArray sparseArray = c4747.f18054;
            Set set = c4747.f18053;
            set.remove(abstractC2416);
            if (set.size() != 0 || z) {
                return;
            }
            for (int i = 0; i < sparseArray.size(); i++) {
                ArrayList arrayList = ((C5236) sparseArray.get(sparseArray.keyAt(i))).f19745;
                for (int i2 = 0; i2 < arrayList.size(); i2++) {
                    ᵹˊᵫˋ.ːˏᵟᵯ(((AbstractC4793) arrayList.get(i2)).f18236);
                }
            }
        }
    }
}
