package w;

import java.util.ArrayList;
import z.C1121e;

/* JADX INFO: renamed from: w.g, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1086g extends AbstractC1088i {

    /* JADX INFO: renamed from: A0, reason: collision with root package name */
    public int f10566A0;

    /* JADX INFO: renamed from: B0, reason: collision with root package name */
    public x.b f10567B0;

    /* JADX INFO: renamed from: C0, reason: collision with root package name */
    public C1121e f10568C0;

    /* JADX INFO: renamed from: D0, reason: collision with root package name */
    public int f10569D0;

    /* JADX INFO: renamed from: E0, reason: collision with root package name */
    public int f10570E0;

    /* JADX INFO: renamed from: F0, reason: collision with root package name */
    public int f10571F0;

    /* JADX INFO: renamed from: G0, reason: collision with root package name */
    public int f10572G0;

    /* JADX INFO: renamed from: H0, reason: collision with root package name */
    public int f10573H0;

    /* JADX INFO: renamed from: I0, reason: collision with root package name */
    public int f10574I0;

    /* JADX INFO: renamed from: J0, reason: collision with root package name */
    public float f10575J0;

    /* JADX INFO: renamed from: K0, reason: collision with root package name */
    public float f10576K0;

    /* JADX INFO: renamed from: L0, reason: collision with root package name */
    public float f10577L0;

    /* JADX INFO: renamed from: M0, reason: collision with root package name */
    public float f10578M0;
    public float N0;

    /* JADX INFO: renamed from: O0, reason: collision with root package name */
    public float f10579O0;

    /* JADX INFO: renamed from: P0, reason: collision with root package name */
    public int f10580P0;
    public int Q0;

    /* JADX INFO: renamed from: R0, reason: collision with root package name */
    public int f10581R0;
    public int S0;

    /* JADX INFO: renamed from: T0, reason: collision with root package name */
    public int f10582T0;

    /* JADX INFO: renamed from: U0, reason: collision with root package name */
    public int f10583U0;

    /* JADX INFO: renamed from: V0, reason: collision with root package name */
    public int f10584V0;

    /* JADX INFO: renamed from: W0, reason: collision with root package name */
    public ArrayList f10585W0;

    /* JADX INFO: renamed from: X0, reason: collision with root package name */
    public C1083d[] f10586X0;

    /* JADX INFO: renamed from: Y0, reason: collision with root package name */
    public C1083d[] f10587Y0;

    /* JADX INFO: renamed from: Z0, reason: collision with root package name */
    public int[] f10588Z0;

    /* JADX INFO: renamed from: a1, reason: collision with root package name */
    public C1083d[] f10589a1;

    /* JADX INFO: renamed from: b1, reason: collision with root package name */
    public int f10590b1;

    /* JADX INFO: renamed from: s0, reason: collision with root package name */
    public int f10591s0;

    /* JADX INFO: renamed from: t0, reason: collision with root package name */
    public int f10592t0;

    /* JADX INFO: renamed from: u0, reason: collision with root package name */
    public int f10593u0;

    /* JADX INFO: renamed from: v0, reason: collision with root package name */
    public int f10594v0;

    /* JADX INFO: renamed from: w0, reason: collision with root package name */
    public int f10595w0;

    /* JADX INFO: renamed from: x0, reason: collision with root package name */
    public int f10596x0;

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

    /* JADX INFO: renamed from: z0, reason: collision with root package name */
    public int f10598z0;

    @Override // w.AbstractC1088i
    public final void S() {
        for (int i = 0; i < this.f10606r0; i++) {
            C1083d c1083d = this.f10605q0[i];
            if (c1083d != null) {
                c1083d.f10474F = true;
            }
        }
    }

    public final int T(C1083d c1083d, int i) {
        C1083d c1083d2;
        if (c1083d != null) {
            int[] iArr = c1083d.f10519p0;
            if (iArr[1] == 3) {
                int i5 = c1083d.f10521s;
                if (i5 != 0) {
                    if (i5 == 2) {
                        int i6 = (int) (c1083d.f10528z * i);
                        if (i6 != c1083d.k()) {
                            c1083d.f10503g = true;
                            V(iArr[0], c1083d.q(), 1, i6, c1083d);
                        }
                        return i6;
                    }
                    c1083d2 = c1083d;
                    if (i5 == 1) {
                        return c1083d2.k();
                    }
                    if (i5 == 3) {
                        return (int) ((c1083d2.q() * c1083d2.f10488W) + 0.5f);
                    }
                }
            } else {
                c1083d2 = c1083d;
            }
            return c1083d2.k();
        }
        return 0;
    }

    public final int U(C1083d c1083d, int i) {
        C1083d c1083d2;
        if (c1083d != null) {
            int[] iArr = c1083d.f10519p0;
            if (iArr[0] == 3) {
                int i5 = c1083d.f10520r;
                if (i5 != 0) {
                    if (i5 == 2) {
                        int i6 = (int) (c1083d.f10525w * i);
                        if (i6 != c1083d.q()) {
                            c1083d.f10503g = true;
                            V(1, i6, iArr[1], c1083d.k(), c1083d);
                        }
                        return i6;
                    }
                    c1083d2 = c1083d;
                    if (i5 == 1) {
                        return c1083d2.q();
                    }
                    if (i5 == 3) {
                        return (int) ((c1083d2.k() * c1083d2.f10488W) + 0.5f);
                    }
                }
            } else {
                c1083d2 = c1083d;
            }
            return c1083d2.q();
        }
        return 0;
    }

    public final void V(int i, int i5, int i6, int i7, C1083d c1083d) {
        C1121e c1121e;
        C1083d c1083d2;
        while (true) {
            c1121e = this.f10568C0;
            if (c1121e != null || (c1083d2 = this.f10485T) == null) {
                break;
            } else {
                this.f10568C0 = ((C1084e) c1083d2).f10545u0;
            }
        }
        x.b bVar = this.f10567B0;
        bVar.f10638a = i;
        bVar.f10639b = i6;
        bVar.f10640c = i5;
        bVar.f10641d = i7;
        c1121e.b(c1083d, bVar);
        c1083d.O(bVar.f10642e);
        c1083d.L(bVar.f10643f);
        c1083d.f10473E = bVar.f10645h;
        c1083d.I(bVar.f10644g);
    }

    @Override // w.C1083d
    public final void b(u.c cVar, boolean z5) {
        C1083d c1083d;
        float f6;
        int i;
        super.b(cVar, z5);
        C1083d c1083d2 = this.f10485T;
        boolean z6 = c1083d2 != null && ((C1084e) c1083d2).f10546v0;
        int i5 = this.f10582T0;
        ArrayList arrayList = this.f10585W0;
        if (i5 != 0) {
            if (i5 == 1) {
                int size = arrayList.size();
                int i6 = 0;
                while (i6 < size) {
                    ((C1085f) arrayList.get(i6)).b(i6, z6, i6 == size + (-1));
                    i6++;
                }
            } else if (i5 != 2) {
                if (i5 == 3) {
                    int size2 = arrayList.size();
                    int i7 = 0;
                    while (i7 < size2) {
                        ((C1085f) arrayList.get(i7)).b(i7, z6, i7 == size2 + (-1));
                        i7++;
                    }
                }
            } else if (this.f10588Z0 != null && this.f10587Y0 != null && this.f10586X0 != null) {
                for (int i8 = 0; i8 < this.f10590b1; i8++) {
                    this.f10589a1[i8].D();
                }
                int[] iArr = this.f10588Z0;
                int i9 = iArr[0];
                int i10 = iArr[1];
                float f7 = this.f10575J0;
                C1083d c1083d3 = null;
                int i11 = 0;
                while (i11 < i9) {
                    if (z6) {
                        i = (i9 - i11) - 1;
                        f6 = 1.0f - this.f10575J0;
                    } else {
                        f6 = f7;
                        i = i11;
                    }
                    C1083d c1083d4 = this.f10587Y0[i];
                    if (c1083d4 != null && c1083d4.f10504g0 != 8) {
                        C1082c c1082c = c1083d4.I;
                        if (i11 == 0) {
                            c1083d4.f(c1082c, this.I, this.f10595w0);
                            c1083d4.f10507i0 = this.f10569D0;
                            c1083d4.f10498d0 = f6;
                        }
                        if (i11 == i9 - 1) {
                            c1083d4.f(c1083d4.K, this.K, this.f10596x0);
                        }
                        if (i11 > 0 && c1083d3 != null) {
                            int i12 = this.f10580P0;
                            C1082c c1082c2 = c1083d3.K;
                            c1083d4.f(c1082c, c1082c2, i12);
                            c1083d3.f(c1082c2, c1082c, 0);
                        }
                        c1083d3 = c1083d4;
                    }
                    i11++;
                    f7 = f6;
                }
                for (int i13 = 0; i13 < i10; i13++) {
                    C1083d c1083d5 = this.f10586X0[i13];
                    if (c1083d5 != null && c1083d5.f10504g0 != 8) {
                        C1082c c1082c3 = c1083d5.J;
                        if (i13 == 0) {
                            c1083d5.f(c1082c3, this.J, this.f10591s0);
                            c1083d5.f10509j0 = this.f10570E0;
                            c1083d5.f10500e0 = this.f10576K0;
                        }
                        if (i13 == i10 - 1) {
                            c1083d5.f(c1083d5.f10477L, this.f10477L, this.f10592t0);
                        }
                        if (i13 > 0 && c1083d3 != null) {
                            int i14 = this.Q0;
                            C1082c c1082c4 = c1083d3.f10477L;
                            c1083d5.f(c1082c3, c1082c4, i14);
                            c1083d3.f(c1082c4, c1082c3, 0);
                        }
                        c1083d3 = c1083d5;
                    }
                }
                for (int i15 = 0; i15 < i9; i15++) {
                    for (int i16 = 0; i16 < i10; i16++) {
                        int i17 = (i16 * i9) + i15;
                        if (this.f10584V0 == 1) {
                            i17 = (i15 * i10) + i16;
                        }
                        C1083d[] c1083dArr = this.f10589a1;
                        if (i17 < c1083dArr.length && (c1083d = c1083dArr[i17]) != null && c1083d.f10504g0 != 8) {
                            C1083d c1083d6 = this.f10587Y0[i15];
                            C1083d c1083d7 = this.f10586X0[i16];
                            if (c1083d != c1083d6) {
                                c1083d.f(c1083d.I, c1083d6.I, 0);
                                c1083d.f(c1083d.K, c1083d6.K, 0);
                            }
                            if (c1083d != c1083d7) {
                                c1083d.f(c1083d.J, c1083d7.J, 0);
                                c1083d.f(c1083d.f10477L, c1083d7.f10477L, 0);
                            }
                        }
                    }
                }
            }
        } else if (arrayList.size() > 0) {
            ((C1085f) arrayList.get(0)).b(0, z6, true);
        }
        this.f10597y0 = false;
    }
}
