package D;

import F.C0167v;
import G0.p0;
import G0.q0;
import i0.C2245i;
import i0.C2246j;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public final class x implements F.H {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final List f908b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final boolean f909c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final C2245i f910d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final C2246j f911e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final h1.m f912f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final int f913g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final long f914h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final Object f915i;

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final C0167v f917k;
    public int l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final int f918m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final int f919n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final int f920o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public boolean f921p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public int f922q = Integer.MIN_VALUE;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final int[] f923r;

    public x(int i6, List list, boolean z6, C2245i c2245i, C2246j c2246j, h1.m mVar, int i7, int i8, int i9, long j4, Object obj, Object obj2, C0167v c0167v, long j6) {
        this.f907a = i6;
        this.f908b = list;
        this.f909c = z6;
        this.f910d = c2245i;
        this.f911e = c2246j;
        this.f912f = mVar;
        this.f913g = i9;
        this.f914h = j4;
        this.f915i = obj;
        this.f916j = obj2;
        this.f917k = c0167v;
        int size = list.size();
        int i10 = 0;
        int iMax = 0;
        for (int i11 = 0; i11 < size; i11++) {
            q0 q0Var = (q0) list.get(i11);
            boolean z7 = this.f909c;
            i10 += z7 ? q0Var.f1999b : q0Var.f1998a;
            iMax = Math.max(iMax, !z7 ? q0Var.f1999b : q0Var.f1998a);
        }
        this.f918m = i10;
        int i12 = i10 + this.f913g;
        this.f919n = i12 >= 0 ? i12 : 0;
        this.f920o = iMax;
        this.f923r = new int[this.f908b.size() * 2];
    }

    @Override // F.H
    public final int a() {
        return this.f908b.size();
    }

    @Override // F.H
    public final int b() {
        return this.f919n;
    }

    @Override // F.H
    public final int c() {
        return 1;
    }

    @Override // F.H
    public final Object d(int i6) {
        return ((q0) this.f908b.get(i6)).S();
    }

    @Override // F.H
    public final boolean e() {
        return this.f909c;
    }

    @Override // F.H
    public final void f() {
        this.f921p = true;
    }

    @Override // F.H
    public final void g(int i6, int i7, int i8) {
        k(i6, i7, i8);
    }

    @Override // F.H
    public final int getIndex() {
        return this.f907a;
    }

    @Override // F.H
    public final Object getKey() {
        return this.f915i;
    }

    @Override // F.H
    public final long h(int i6) {
        if (i6 == 0 && this.f908b.size() == 0) {
            if (this.f909c) {
                return (4294967295L & ((long) this.l)) | (((long) 0) << 32);
            }
            return (4294967295L & ((long) 0)) | (((long) this.l) << 32);
        }
        int i7 = i6 * 2;
        int[] iArr = this.f923r;
        int i8 = iArr[i7];
        return (4294967295L & ((long) iArr[i7 + 1])) | (((long) i8) << 32);
    }

    @Override // F.H
    public final int i() {
        return 0;
    }

    public final void j(p0 p0Var) {
        if (this.f922q == Integer.MIN_VALUE) {
            A.b.a("position() should be called first");
        }
        List list = this.f908b;
        int size = list.size();
        for (int i6 = 0; i6 < size; i6++) {
            q0 q0Var = (q0) list.get(i6);
            boolean z6 = this.f909c;
            if (z6) {
                int i7 = q0Var.f1999b;
            } else {
                int i8 = q0Var.f1998a;
            }
            long jH = h(i6);
            this.f917k.a(i6, this.f915i);
            long jC = h1.j.c(jH, this.f914h);
            if (z6) {
                p0.G(p0Var, q0Var, jC);
            } else {
                p0.z(p0Var, q0Var, jC);
            }
        }
    }

    public final void k(int i6, int i7, int i8) {
        int i9;
        this.l = i6;
        boolean z6 = this.f909c;
        this.f922q = z6 ? i8 : i7;
        List list = this.f908b;
        int size = list.size();
        for (int i10 = 0; i10 < size; i10++) {
            q0 q0Var = (q0) list.get(i10);
            int i11 = i10 * 2;
            int[] iArr = this.f923r;
            if (z6) {
                C2245i c2245i = this.f910d;
                if (c2245i == null) {
                    A.b.b("null horizontalAlignment when isVertical == true");
                    throw new E3.v();
                }
                iArr[i11] = c2245i.a(q0Var.f1998a, i7, this.f912f);
                iArr[i11 + 1] = i6;
                i9 = q0Var.f1999b;
            } else {
                iArr[i11] = i6;
                int i12 = i11 + 1;
                C2246j c2246j = this.f911e;
                if (c2246j == null) {
                    A.b.b("null verticalAlignment when isVertical == false");
                    throw new E3.v();
                }
                iArr[i12] = c2246j.a(q0Var.f1999b, i8);
                i9 = q0Var.f1998a;
            }
            i6 += i9;
        }
    }
}
