package x;

import I0.AbstractC0303l;
import androidx.recyclerview.widget.C1152b;
import java.util.ArrayList;
import o0.C2631b;
import x4.AbstractC3251q;
import z0.C3291a;
import z0.C3292b;

/* JADX INFO: renamed from: x.h0, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C3166h0 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final O f25798a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public C3151c0 f25799b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public C3160f0 f25800c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public C3157e0 f25801d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public C3154d0 f25802e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public I1 f25803f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public C0.B f25804g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public long f25805h = 9205357640488583168L;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public C1152b f25806i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final C3169i0 f25807j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final C3169i0 f25808k;
    public long l;

    public C3166h0(O o6) {
        this.f25798a = o6;
        C3169i0 c3169i0 = new C3169i0();
        c3169i0.f25828b = new ArrayList();
        this.f25807j = c3169i0;
        C3169i0 c3169i02 = new C3169i0();
        c3169i02.f25828b = new ArrayList();
        this.f25808k = c3169i02;
        this.l = 0L;
    }

    public static void c(C3166h0 c3166h0, C3292b c3292b, long j4, long j6, int i6) {
        if ((i6 & 4) != 0) {
            j6 = 0;
        }
        C3157e0 c3157e0 = c3166h0.f25801d;
        if (c3157e0 == null) {
            c3157e0 = new C3157e0();
            c3157e0.f25773b = null;
            c3157e0.f25774c = Long.MAX_VALUE;
            c3157e0.f25775d = false;
            c3166h0.f25801d = c3157e0;
        }
        c3157e0.f25773b = c3292b;
        c3157e0.f25774c = j4;
        C1152b c1152b = c3166h0.f25806i;
        O o6 = c3166h0.f25798a;
        if (c1152b == null) {
            c3166h0.f25806i = new C1152b(o6.f25647c);
        } else {
            c1152b.f13027c = o6.f25647c;
            c1152b.f13026b = j6;
        }
        c3157e0.f25775d = false;
        c3166h0.f25803f = c3157e0;
    }

    public final void a() {
        C3151c0 c3151c0 = this.f25799b;
        if (c3151c0 == null) {
            EnumC3148b0 enumC3148b0 = EnumC3148b0.f25749c;
            c3151c0 = new C3151c0();
            c3151c0.f25758b = enumC3148b0;
            c3151c0.f25759c = false;
            this.f25799b = c3151c0;
        }
        c3151c0.f25758b = EnumC3148b0.f25749c;
        c3151c0.f25759c = false;
        this.f25803f = c3151c0;
    }

    public final void b(C3292b c3292b, long j4, C1152b c1152b) {
        C3154d0 c3154d0 = this.f25802e;
        if (c3154d0 == null) {
            c3154d0 = new C3154d0();
            c3154d0.f25763b = null;
            c3154d0.f25764c = Long.MAX_VALUE;
            this.f25802e = c3154d0;
        }
        c3154d0.f25763b = c3292b;
        c3154d0.f25764c = j4;
        c1152b.f13026b = 0L;
        this.f25803f = c3154d0;
    }

    public final C0.B d() {
        C0.B b5 = this.f25804g;
        if (b5 != null) {
            return b5;
        }
        throw new IllegalArgumentException("Velocity Tracker not initialized.");
    }

    public final void e(C3292b c3292b, C3291a c3291a, long j4) {
        O o6 = this.f25798a;
        long jM = AbstractC0303l.s(o6).M(0L);
        if (!C2631b.b(this.f25805h, 9205357640488583168L) && !C2631b.b(jM, this.f25805h)) {
            this.l = C2631b.e(this.l, C2631b.d(jM, this.f25805h));
        }
        this.f25805h = jM;
        EnumC3207z0 enumC3207z0 = o6.f25647c;
        kotlin.jvm.internal.o.e(enumC3207z0);
        Q q6 = S.f25688a;
        if (Math.abs(Float.intBitsToFloat((int) (enumC3207z0 == EnumC3207z0.f25984a ? j4 & 4294967295L : j4 >> 32))) > 2.0f) {
            I1.a(d(), c3292b, o6.f25647c, c3291a, this.f25807j, this.l);
            C3169i0 c3169i0 = this.f25808k;
            ArrayList arrayList = c3169i0.f25828b;
            if (arrayList.size() == 3) {
                int i6 = c3169i0.f25827a;
                c3169i0.f25827a = i6 + 1;
                arrayList.set(i6, new C2631b(j4));
            } else {
                arrayList.add(new C2631b(j4));
            }
            if (c3169i0.f25827a == 3) {
                c3169i0.f25827a = 0;
            }
            ArrayList arrayList2 = new ArrayList(arrayList.size());
            int size = arrayList.size();
            for (int i7 = 0; i7 < size; i7++) {
                arrayList2.add(Float.valueOf(Float.intBitsToFloat((int) (((C2631b) arrayList.get(i7)).f21785a >> 32))));
            }
            float fX = (float) AbstractC3251q.X(arrayList2);
            ArrayList arrayList3 = new ArrayList(arrayList.size());
            int size2 = arrayList.size();
            for (int i8 = 0; i8 < size2; i8++) {
                arrayList3.add(Float.valueOf(Float.intBitsToFloat((int) (((C2631b) arrayList.get(i8)).f21785a & 4294967295L))));
            }
            o6.E0(new C3202x((((long) Float.floatToRawIntBits((float) AbstractC3251q.X(arrayList3))) & 4294967295L) | (((long) Float.floatToRawIntBits(fX)) << 32), true));
        }
    }

    public final void f(C3292b c3292b, C3292b c3292b2, C3291a c3291a, long j4) {
        if (this.f25804g == null) {
            this.f25804g = new C0.B(1);
        }
        this.l = 0L;
        C0.B bD = d();
        O o6 = this.f25798a;
        I1.a(bD, c3292b, o6.f25647c, c3291a, this.f25807j, this.l);
        long jD = C2631b.d(I1.g(c3292b2, o6.f25647c, c3291a), j4);
        if (((Boolean) o6.f25648d.invoke(new C0.N(1))).booleanValue()) {
            this.f25805h = AbstractC0303l.s(o6).M(0L);
            o6.E0(new C3204y(jD));
        }
        C3169i0 c3169i0 = this.f25808k;
        c3169i0.f25827a = 0;
        c3169i0.f25828b.clear();
    }
}
