package c.e.b.h;

import c.e.b.h.c;
import c.e.b.h.d;

/* JADX INFO: compiled from: Guideline.java */
/* JADX INFO: loaded from: classes.dex */
public class f extends d {
    public float l0 = -1.0f;
    public int m0 = -1;
    public int n0 = -1;
    public c o0 = this.E;
    public int p0 = 0;
    public boolean q0;

    public f() {
        this.M.clear();
        this.M.add(this.o0);
        int length = this.L.length;
        for (int i2 = 0; i2 < length; i2++) {
            this.L[i2] = this.o0;
        }
    }

    @Override // c.e.b.h.d
    public boolean A() {
        return this.q0;
    }

    @Override // c.e.b.h.d
    public boolean B() {
        return this.q0;
    }

    @Override // c.e.b.h.d
    public void P(c.e.b.d dVar, boolean z) {
        if (this.P == null) {
            return;
        }
        int iO = dVar.o(this.o0);
        if (this.p0 == 1) {
            this.U = iO;
            this.V = 0;
            I(this.P.l());
            N(0);
            return;
        }
        this.U = 0;
        this.V = iO;
        N(this.P.r());
        I(0);
    }

    public void Q(int i2) {
        c cVar = this.o0;
        cVar.f1119b = i2;
        cVar.f1120c = true;
        this.q0 = true;
    }

    public void R(int i2) {
        if (this.p0 == i2) {
            return;
        }
        this.p0 = i2;
        this.M.clear();
        if (this.p0 == 1) {
            this.o0 = this.D;
        } else {
            this.o0 = this.E;
        }
        this.M.add(this.o0);
        int length = this.L.length;
        for (int i3 = 0; i3 < length; i3++) {
            this.L[i3] = this.o0;
        }
    }

    @Override // c.e.b.h.d
    public void d(c.e.b.d dVar, boolean z) {
        e eVar = (e) this.P;
        if (eVar == null) {
            return;
        }
        Object objI = eVar.i(c.a.LEFT);
        Object objI2 = eVar.i(c.a.RIGHT);
        d dVar2 = this.P;
        boolean z2 = dVar2 != null && dVar2.O[0] == d.a.WRAP_CONTENT;
        if (this.p0 == 0) {
            objI = eVar.i(c.a.TOP);
            objI2 = eVar.i(c.a.BOTTOM);
            d dVar3 = this.P;
            z2 = dVar3 != null && dVar3.O[1] == d.a.WRAP_CONTENT;
        }
        if (this.q0) {
            c cVar = this.o0;
            if (cVar.f1120c) {
                c.e.b.g gVarL = dVar.l(cVar);
                dVar.e(gVarL, this.o0.c());
                if (this.m0 != -1) {
                    if (z2) {
                        dVar.f(dVar.l(objI2), gVarL, 0, 5);
                    }
                } else if (this.n0 != -1 && z2) {
                    c.e.b.g gVarL2 = dVar.l(objI2);
                    dVar.f(gVarL, dVar.l(objI), 0, 5);
                    dVar.f(gVarL2, gVarL, 0, 5);
                }
                this.q0 = false;
                return;
            }
        }
        if (this.m0 != -1) {
            c.e.b.g gVarL3 = dVar.l(this.o0);
            dVar.d(gVarL3, dVar.l(objI), this.m0, 8);
            if (z2) {
                dVar.f(dVar.l(objI2), gVarL3, 0, 5);
                return;
            }
            return;
        }
        if (this.n0 != -1) {
            c.e.b.g gVarL4 = dVar.l(this.o0);
            c.e.b.g gVarL5 = dVar.l(objI2);
            dVar.d(gVarL4, gVarL5, -this.n0, 8);
            if (z2) {
                dVar.f(gVarL4, dVar.l(objI), 0, 5);
                dVar.f(gVarL5, gVarL4, 0, 5);
                return;
            }
            return;
        }
        if (this.l0 != -1.0f) {
            c.e.b.g gVarL6 = dVar.l(this.o0);
            c.e.b.g gVarL7 = dVar.l(objI2);
            float f2 = this.l0;
            c.e.b.b bVarM = dVar.m();
            bVarM.f1073d.i(gVarL6, -1.0f);
            bVarM.f1073d.i(gVarL7, f2);
            dVar.c(bVarM);
        }
    }

    @Override // c.e.b.h.d
    public boolean e() {
        return true;
    }

    @Override // c.e.b.h.d
    public c i(c.a aVar) {
        switch (aVar) {
            case NONE:
            case BASELINE:
            case CENTER:
            case CENTER_X:
            case CENTER_Y:
                return null;
            case LEFT:
            case RIGHT:
                if (this.p0 == 1) {
                    return this.o0;
                }
                break;
            case TOP:
            case BOTTOM:
                if (this.p0 == 0) {
                    return this.o0;
                }
                break;
        }
        throw new AssertionError(aVar.name());
    }
}
