package defpackage;

import android.util.SparseArray;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import j$.util.DesugarCollections;
import j$.util.Objects;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

/* renamed from: ᵯˑᵰ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4276 {

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

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public C4972 f16041;

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

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final ArrayList f16043;

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

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public ArrayList f16045;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final /* synthetic */ RecyclerView f16046;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final List f16047;

    public C4276(RecyclerView recyclerView) {
        this.f16046 = recyclerView;
        ArrayList arrayList = new ArrayList();
        this.f16044 = arrayList;
        this.f16045 = null;
        this.f16043 = new ArrayList();
        this.f16047 = DesugarCollections.unmodifiableList(arrayList);
        this.f16040 = 2;
        this.f16042 = 2;
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final void m9247() {
        RecyclerView recyclerView;
        AbstractC1307 abstractC1307;
        C4972 c4972 = this.f16041;
        if (c4972 == null || (abstractC1307 = (recyclerView = this.f16046).f898) == null || !recyclerView.f887) {
            return;
        }
        c4972.f18465.add(abstractC1307);
    }

    /* 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  */
    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final defpackage.AbstractC2313 m9248(long r29, int r31) {
        /*
            Method dump skipped, instructions count: 1539
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C4276.m9248(long, int):ᵕᵲᵝ");
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final void m9249() {
        ArrayList arrayList = this.f16043;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            m9259(size);
        }
        arrayList.clear();
        if (RecyclerView.f847) {
            C1943 c1943 = this.f16046.f914;
            int[] iArr = c1943.f7826;
            if (iArr != null) {
                Arrays.fill(iArr, -1);
            }
            c1943.f7829 = 0;
        }
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final void m9250(AbstractC1307 abstractC1307, boolean z) {
        C4972 c4972 = this.f16041;
        if (c4972 != null) {
            SparseArray sparseArray = c4972.f18466;
            Set set = c4972.f18465;
            set.remove(abstractC1307);
            if (set.size() != 0 || z) {
                return;
            }
            for (int i = 0; i < sparseArray.size(); i++) {
                ArrayList arrayList = ((C3003) sparseArray.get(sparseArray.keyAt(i))).f11583;
                for (int i2 = 0; i2 < arrayList.size(); i2++) {
                    ᵸᵡˋʧ.ᵴᵳ(((AbstractC2313) arrayList.get(i2)).f9071);
                }
            }
        }
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final C4972 m9251() {
        if (this.f16041 == null) {
            this.f16041 = new C4972();
            m9247();
        }
        return this.f16041;
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final void m9252(View view) {
        AbstractC2313 abstractC2313M535 = RecyclerView.m535(view);
        boolean zM6020 = abstractC2313M535.m6020();
        RecyclerView recyclerView = this.f16046;
        if (zM6020) {
            recyclerView.removeDetachedView(view, false);
        }
        if (abstractC2313M535.m6033()) {
            abstractC2313M535.f9063.m9255(abstractC2313M535);
        } else if (abstractC2313M535.m6032()) {
            abstractC2313M535.f9061 &= -33;
        }
        m9257(abstractC2313M535);
        if (recyclerView.f921 == null || abstractC2313M535.m6024()) {
            return;
        }
        recyclerView.f921.mo6339(abstractC2313M535);
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m9253(AbstractC2313 abstractC2313, boolean z) {
        RecyclerView.m540(abstractC2313);
        View view = abstractC2313.f9071;
        RecyclerView recyclerView = this.f16046;
        C2582 c2582 = recyclerView.f863;
        if (c2582 != null) {
            C3819 c3819Mo6173 = c2582.mo6173();
            AbstractC2873.m7026(view, c3819Mo6173 instanceof C5313 ? (C3819) ((C5313) c3819Mo6173).f19879.remove(view) : null);
        }
        if (z) {
            InterfaceC1911 interfaceC1911 = recyclerView.f877;
            ArrayList arrayList = recyclerView.f915;
            if (interfaceC1911 != null) {
                ((C1804) interfaceC1911).m5124(abstractC2313);
            }
            int size = arrayList.size();
            for (int i = 0; i < size; i++) {
                ((C1804) ((InterfaceC1911) arrayList.get(i))).m5124(abstractC2313);
            }
            AbstractC1307 abstractC1307 = recyclerView.f898;
            if (abstractC1307 != null) {
                abstractC1307.m4022(abstractC2313);
            }
            if (recyclerView.f901 != null) {
                recyclerView.f858.m2357(abstractC2313);
            }
            if (RecyclerView.f849) {
                Objects.toString(abstractC2313);
            }
        }
        abstractC2313.f9066 = null;
        abstractC2313.f9064 = null;
        C4972 c4972M9251 = m9251();
        c4972M9251.getClass();
        int i2 = abstractC2313.f9067;
        ArrayList arrayList2 = c4972M9251.m10407(i2).f11583;
        if (((C3003) c4972M9251.f18466.get(i2)).f11584 <= arrayList2.size()) {
            ᵸᵡˋʧ.ᵴᵳ(view);
        } else if (RecyclerView.f850 && arrayList2.contains(abstractC2313)) {
            ᵹˉᵞ.ˌᵜᵹᵩ("this scrap item already exists");
        } else {
            abstractC2313.m6029();
            arrayList2.add(abstractC2313);
        }
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final void m9254() {
        AbstractC1935 abstractC1935 = this.f16046.f919;
        this.f16042 = this.f16040 + (abstractC1935 != null ? abstractC1935.f7786 : 0);
        ArrayList arrayList = this.f16043;
        for (int size = arrayList.size() - 1; size >= 0 && arrayList.size() > this.f16042; size--) {
            m9259(size);
        }
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final void m9255(AbstractC2313 abstractC2313) {
        if (abstractC2313.f9073) {
            this.f16045.remove(abstractC2313);
        } else {
            this.f16044.remove(abstractC2313);
        }
        abstractC2313.f9063 = null;
        abstractC2313.f9073 = false;
        abstractC2313.f9061 &= -33;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final int m9256(int i) {
        RecyclerView recyclerView = this.f16046;
        C1529 c1529 = recyclerView.f901;
        if (i >= 0 && i < c1529.m4454()) {
            return !c1529.f6121 ? i : recyclerView.f893.m4623(i, 0);
        }
        StringBuilder sbM4097 = AbstractC1327.m4097(i, "invalid position ", ". State item count is ");
        sbM4097.append(c1529.m4454());
        sbM4097.append(recyclerView.m576());
        throw new IndexOutOfBoundsException(sbM4097.toString());
    }

    /* 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  */
    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void m9257(defpackage.AbstractC2313 r13) {
        /*
            Method dump skipped, instructions count: 300
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C4276.m9257(ᵕᵲᵝ):void");
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public final void m9258(View view) {
        AbstractC2495 abstractC2495;
        AbstractC2313 abstractC2313M535 = RecyclerView.m535(view);
        int i = abstractC2313M535.f9061 & 12;
        RecyclerView recyclerView = this.f16046;
        if (i == 0 && abstractC2313M535.m6028() && (abstractC2495 = recyclerView.f921) != null && !abstractC2495.mo6343(abstractC2313M535, abstractC2313M535.m6018())) {
            if (this.f16045 == null) {
                this.f16045 = new ArrayList();
            }
            abstractC2313M535.f9063 = this;
            abstractC2313M535.f9073 = true;
            this.f16045.add(abstractC2313M535);
            return;
        }
        if (abstractC2313M535.m6034() && !abstractC2313M535.m6031() && !recyclerView.f898.f5397) {
            ᵹˉᵞ.ˌᵜᵹᵩ("Called scrap view with an invalid view. Invalid views cannot be reused from scrap, they should rebound from recycler pool.".concat(recyclerView.m576()));
            return;
        }
        abstractC2313M535.f9063 = this;
        abstractC2313M535.f9073 = false;
        this.f16044.add(abstractC2313M535);
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final void m9259(int i) {
        boolean z = RecyclerView.f850;
        ArrayList arrayList = this.f16043;
        AbstractC2313 abstractC2313 = (AbstractC2313) arrayList.get(i);
        if (RecyclerView.f849) {
            Objects.toString(abstractC2313);
        }
        m9253(abstractC2313, true);
        arrayList.remove(i);
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final View m9260(int i) {
        return m9248(Long.MAX_VALUE, i).f9071;
    }
}
