package ῲ.䀟.K;

import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import ඓ.K.K.K.C1293;

/* renamed from: ῲ.䀟.K.ῲ  reason: contains not printable characters */
/* compiled from: ChildHelper */
public class C2316 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final List<View> f7999 = new ArrayList();

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C2318 f8000 = new C2318();

    /* renamed from: K  reason: contains not printable characters */
    public final AbstractC2317 f8001;

    /* renamed from: ῲ.䀟.K.ῲ$ῲ  reason: contains not printable characters */
    /* compiled from: ChildHelper */
    public interface AbstractC2317 {
    }

    public C2316(AbstractC2317 r1) {
        this.f8001 = r1;
    }

    public String toString() {
        return this.f8000.toString() + ", hidden list:" + this.f7999.size();
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public final boolean m6047(View view) {
        if (!this.f7999.remove(view)) {
            return false;
        }
        ((RecyclerView.C0237) this.f8001).m812(view);
        return true;
    }

    /* renamed from: ඓ  reason: contains not printable characters */
    public void m6048(int i) {
        int r3 = m6046(i);
        View r0 = ((RecyclerView.C0237) this.f8001).m816(r3);
        if (r0 != null) {
            if (this.f8000.m6065(r3)) {
                m6047(r0);
            }
            ((RecyclerView.C0237) this.f8001).m813(r3);
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public View m6050(int i) {
        return ((RecyclerView.C0237) this.f8001).m816(m6046(i));
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m6056(View view, int i, boolean z) {
        int i2;
        if (i < 0) {
            i2 = ((RecyclerView.C0237) this.f8001).m815();
        } else {
            i2 = m6046(i);
        }
        this.f8000.m6064(i2, z);
        if (z) {
            this.f7999.add(view);
            ((RecyclerView.C0237) this.f8001).m814(view);
        }
        RecyclerView.C0237 r4 = (RecyclerView.C0237) this.f8001;
        RecyclerView.this.addView(view, i2);
        RecyclerView.this.dispatchChildAttached(view);
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public View m6057(int i) {
        return RecyclerView.this.getChildAt(i);
    }

    /* renamed from: ῲ.䀟.K.ῲ$K  reason: contains not printable characters */
    /* compiled from: ChildHelper */
    public static class C2318 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public C2318 f8002;

        /* renamed from: K  reason: contains not printable characters */
        public long f8003 = 0;

        public String toString() {
            if (this.f8002 == null) {
                return Long.toBinaryString(this.f8003);
            }
            return this.f8002.toString() + "xx" + Long.toBinaryString(this.f8003);
        }

        /* renamed from: ʬ  reason: contains not printable characters */
        public boolean m6058(int i) {
            if (i < 64) {
                return (this.f8003 & (1 << i)) != 0;
            }
            m6062();
            return this.f8002.m6058(i - 64);
        }

        /* renamed from: ඓ  reason: contains not printable characters */
        public void m6059(int i) {
            if (i >= 64) {
                m6062();
                this.f8002.m6059(i - 64);
                return;
            }
            this.f8003 |= 1 << i;
        }

        /* renamed from: ῲ  reason: contains not printable characters */
        public void m6061() {
            this.f8003 = 0;
            C2318 k = this.f8002;
            if (k != null) {
                k.m6061();
            }
        }

        /* renamed from: K  reason: contains not printable characters */
        public final void m6062() {
            if (this.f8002 == null) {
                this.f8002 = new C2318();
            }
        }

        /* renamed from: 㸾  reason: contains not printable characters */
        public boolean m6065(int i) {
            if (i >= 64) {
                m6062();
                return this.f8002.m6065(i - 64);
            }
            long j = 1 << i;
            boolean z = (this.f8003 & j) != 0;
            this.f8003 &= ~j;
            long j2 = j - 1;
            long j3 = this.f8003;
            this.f8003 = Long.rotateRight(j3 & (~j2), 1) | (j3 & j2);
            C2318 k = this.f8002;
            if (k != null) {
                if (k.m6058(0)) {
                    m6059(63);
                }
                this.f8002.m6065(0);
            }
            return z;
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m6063(int i) {
            if (i >= 64) {
                C2318 k = this.f8002;
                if (k != null) {
                    k.m6063(i - 64);
                    return;
                }
                return;
            }
            this.f8003 &= ~(1 << i);
        }

        /* renamed from: ῲ  reason: contains not printable characters */
        public int m6060(int i) {
            C2318 k = this.f8002;
            if (k == null) {
                if (i >= 64) {
                    return Long.bitCount(this.f8003);
                }
                return Long.bitCount(this.f8003 & ((1 << i) - 1));
            } else if (i < 64) {
                return Long.bitCount(this.f8003 & ((1 << i) - 1));
            } else {
                return Long.bitCount(this.f8003) + k.m6060(i - 64);
            }
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m6064(int i, boolean z) {
            if (i >= 64) {
                m6062();
                this.f8002.m6064(i - 64, z);
                return;
            }
            boolean z2 = (this.f8003 & Long.MIN_VALUE) != 0;
            long j = (1 << i) - 1;
            long j2 = this.f8003;
            this.f8003 = ((j2 & (~j)) << 1) | (j2 & j);
            if (z) {
                m6059(i);
            } else {
                m6063(i);
            }
            if (z2 || this.f8002 != null) {
                m6062();
                this.f8002.m6064(0, z2);
            }
        }
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public final int m6046(int i) {
        if (i < 0) {
            return -1;
        }
        int r1 = ((RecyclerView.C0237) this.f8001).m815();
        int i2 = i;
        while (i2 < r1) {
            int r3 = i - (i2 - this.f8000.m6060(i2));
            if (r3 == 0) {
                while (this.f8000.m6058(i2)) {
                    i2++;
                }
                return i2;
            }
            i2 += r3;
        }
        return -1;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public int m6049() {
        return ((RecyclerView.C0237) this.f8001).m815();
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public boolean m6051(View view) {
        return this.f7999.contains(view);
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m6055(View view, int i, ViewGroup.LayoutParams layoutParams, boolean z) {
        int i2;
        if (i < 0) {
            i2 = ((RecyclerView.C0237) this.f8001).m815();
        } else {
            i2 = m6046(i);
        }
        this.f8000.m6064(i2, z);
        if (z) {
            this.f7999.add(view);
            ((RecyclerView.C0237) this.f8001).m814(view);
        }
        ((RecyclerView.C0237) this.f8001).m818(view, i2, layoutParams);
    }

    /* renamed from: K  reason: contains not printable characters */
    public int m6052() {
        return ((RecyclerView.C0237) this.f8001).m815() - this.f7999.size();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m6054(int i) {
        RecyclerView.AbstractC0269 childViewHolderInt;
        int r5 = m6046(i);
        this.f8000.m6065(r5);
        RecyclerView.C0237 r0 = (RecyclerView.C0237) this.f8001;
        View childAt = RecyclerView.this.getChildAt(r5);
        if (!(childAt == null || (childViewHolderInt = RecyclerView.getChildViewHolderInt(childAt)) == null)) {
            if (!childViewHolderInt.isTmpDetached() || childViewHolderInt.shouldIgnore()) {
                childViewHolderInt.addFlags(256);
            } else {
                StringBuilder sb = new StringBuilder();
                sb.append("called detach on an already detached child ");
                sb.append(childViewHolderInt);
                throw new IllegalArgumentException(C1293.m3407(RecyclerView.this, sb));
            }
        }
        RecyclerView.this.detachViewFromParent((RecyclerView) r5);
    }

    /* renamed from: K  reason: contains not printable characters */
    public int m6053(View view) {
        int indexOfChild = RecyclerView.this.indexOfChild(view);
        if (indexOfChild != -1 && !this.f8000.m6058(indexOfChild)) {
            return indexOfChild - this.f8000.m6060(indexOfChild);
        }
        return -1;
    }
}
