package o;

import n.d;
import n.e;
import o.f;
import o.p;

/* JADX INFO: compiled from: HorizontalWidgetRun.java */
/* JADX INFO: loaded from: classes.dex */
public class l extends p {

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private static int[] f5722k = new int[2];

    /* JADX INFO: compiled from: HorizontalWidgetRun.java */
    static /* synthetic */ class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        static final /* synthetic */ int[] f5723a;

        static {
            int[] iArr = new int[p.b.values().length];
            f5723a = iArr;
            try {
                iArr[p.b.START.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f5723a[p.b.END.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f5723a[p.b.CENTER.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    public l(n.e eVar) {
        super(eVar);
        this.f5743h.f5710e = f.a.LEFT;
        this.f5744i.f5710e = f.a.RIGHT;
        this.f5741f = 0;
    }

    private void q(int[] iArr, int i3, int i4, int i5, int i6, float f3, int i7) {
        int i8 = i4 - i3;
        int i9 = i6 - i5;
        if (i7 != -1) {
            if (i7 == 0) {
                iArr[0] = (int) ((i9 * f3) + 0.5f);
                iArr[1] = i9;
                return;
            } else {
                if (i7 != 1) {
                    return;
                }
                iArr[0] = i8;
                iArr[1] = (int) ((i8 * f3) + 0.5f);
                return;
            }
        }
        int i10 = (int) ((i9 * f3) + 0.5f);
        int i11 = (int) ((i8 / f3) + 0.5f);
        if (i10 <= i8) {
            iArr[0] = i10;
            iArr[1] = i9;
        } else if (i11 <= i9) {
            iArr[0] = i8;
            iArr[1] = i11;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:125:0x02de  */
    @Override // o.p, o.d
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void a(o.d r17) {
        /*
            Method dump skipped, instruction units count: 1087
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.l.a(o.d):void");
    }

    @Override // o.p
    void d() {
        n.e eVarI;
        n.e eVarI2;
        n.e eVar = this.f5737b;
        if (eVar.f5609a) {
            this.f5740e.d(eVar.U());
        }
        if (this.f5740e.f5715j) {
            e.b bVar = this.f5739d;
            e.b bVar2 = e.b.MATCH_PARENT;
            if (bVar == bVar2 && (eVarI = this.f5737b.I()) != null && (eVarI.y() == e.b.FIXED || eVarI.y() == bVar2)) {
                b(this.f5743h, eVarI.f5615d.f5743h, this.f5737b.L.e());
                b(this.f5744i, eVarI.f5615d.f5744i, -this.f5737b.N.e());
                return;
            }
        } else {
            e.b bVarY = this.f5737b.y();
            this.f5739d = bVarY;
            if (bVarY != e.b.MATCH_CONSTRAINT) {
                e.b bVar3 = e.b.MATCH_PARENT;
                if (bVarY == bVar3 && (eVarI2 = this.f5737b.I()) != null && (eVarI2.y() == e.b.FIXED || eVarI2.y() == bVar3)) {
                    int iU = (eVarI2.U() - this.f5737b.L.e()) - this.f5737b.N.e();
                    b(this.f5743h, eVarI2.f5615d.f5743h, this.f5737b.L.e());
                    b(this.f5744i, eVarI2.f5615d.f5744i, -this.f5737b.N.e());
                    this.f5740e.d(iU);
                    return;
                }
                if (this.f5739d == e.b.FIXED) {
                    this.f5740e.d(this.f5737b.U());
                }
            }
        }
        g gVar = this.f5740e;
        if (gVar.f5715j) {
            n.e eVar2 = this.f5737b;
            if (eVar2.f5609a) {
                n.d[] dVarArr = eVar2.T;
                if (dVarArr[0].f5603f != null && dVarArr[1].f5603f != null) {
                    if (eVar2.g0()) {
                        this.f5743h.f5711f = this.f5737b.T[0].e();
                        this.f5744i.f5711f = -this.f5737b.T[1].e();
                        return;
                    }
                    f fVarH = h(this.f5737b.T[0]);
                    if (fVarH != null) {
                        b(this.f5743h, fVarH, this.f5737b.T[0].e());
                    }
                    f fVarH2 = h(this.f5737b.T[1]);
                    if (fVarH2 != null) {
                        b(this.f5744i, fVarH2, -this.f5737b.T[1].e());
                    }
                    this.f5743h.f5707b = true;
                    this.f5744i.f5707b = true;
                    return;
                }
                if (dVarArr[0].f5603f != null) {
                    f fVarH3 = h(dVarArr[0]);
                    if (fVarH3 != null) {
                        b(this.f5743h, fVarH3, this.f5737b.T[0].e());
                        b(this.f5744i, this.f5743h, this.f5740e.f5712g);
                        return;
                    }
                    return;
                }
                if (dVarArr[1].f5603f != null) {
                    f fVarH4 = h(dVarArr[1]);
                    if (fVarH4 != null) {
                        b(this.f5744i, fVarH4, -this.f5737b.T[1].e());
                        b(this.f5743h, this.f5744i, -this.f5740e.f5712g);
                        return;
                    }
                    return;
                }
                if ((eVar2 instanceof n.h) || eVar2.I() == null || this.f5737b.m(d.b.CENTER).f5603f != null) {
                    return;
                }
                b(this.f5743h, this.f5737b.I().f5615d.f5743h, this.f5737b.V());
                b(this.f5744i, this.f5743h, this.f5740e.f5712g);
                return;
            }
        }
        if (this.f5739d == e.b.MATCH_CONSTRAINT) {
            n.e eVar3 = this.f5737b;
            int i3 = eVar3.f5647t;
            if (i3 == 2) {
                n.e eVarI3 = eVar3.I();
                if (eVarI3 != null) {
                    g gVar2 = eVarI3.f5617e.f5740e;
                    this.f5740e.f5717l.add(gVar2);
                    gVar2.f5716k.add(this.f5740e);
                    g gVar3 = this.f5740e;
                    gVar3.f5707b = true;
                    gVar3.f5716k.add(this.f5743h);
                    this.f5740e.f5716k.add(this.f5744i);
                }
            } else if (i3 == 3) {
                if (eVar3.f5649u == 3) {
                    this.f5743h.f5706a = this;
                    this.f5744i.f5706a = this;
                    n nVar = eVar3.f5617e;
                    nVar.f5743h.f5706a = this;
                    nVar.f5744i.f5706a = this;
                    gVar.f5706a = this;
                    if (eVar3.i0()) {
                        this.f5740e.f5717l.add(this.f5737b.f5617e.f5740e);
                        this.f5737b.f5617e.f5740e.f5716k.add(this.f5740e);
                        n nVar2 = this.f5737b.f5617e;
                        nVar2.f5740e.f5706a = this;
                        this.f5740e.f5717l.add(nVar2.f5743h);
                        this.f5740e.f5717l.add(this.f5737b.f5617e.f5744i);
                        this.f5737b.f5617e.f5743h.f5716k.add(this.f5740e);
                        this.f5737b.f5617e.f5744i.f5716k.add(this.f5740e);
                    } else if (this.f5737b.g0()) {
                        this.f5737b.f5617e.f5740e.f5717l.add(this.f5740e);
                        this.f5740e.f5716k.add(this.f5737b.f5617e.f5740e);
                    } else {
                        this.f5737b.f5617e.f5740e.f5717l.add(this.f5740e);
                    }
                } else {
                    g gVar4 = eVar3.f5617e.f5740e;
                    gVar.f5717l.add(gVar4);
                    gVar4.f5716k.add(this.f5740e);
                    this.f5737b.f5617e.f5743h.f5716k.add(this.f5740e);
                    this.f5737b.f5617e.f5744i.f5716k.add(this.f5740e);
                    g gVar5 = this.f5740e;
                    gVar5.f5707b = true;
                    gVar5.f5716k.add(this.f5743h);
                    this.f5740e.f5716k.add(this.f5744i);
                    this.f5743h.f5717l.add(this.f5740e);
                    this.f5744i.f5717l.add(this.f5740e);
                }
            }
        }
        n.e eVar4 = this.f5737b;
        n.d[] dVarArr2 = eVar4.T;
        if (dVarArr2[0].f5603f != null && dVarArr2[1].f5603f != null) {
            if (eVar4.g0()) {
                this.f5743h.f5711f = this.f5737b.T[0].e();
                this.f5744i.f5711f = -this.f5737b.T[1].e();
                return;
            }
            f fVarH5 = h(this.f5737b.T[0]);
            f fVarH6 = h(this.f5737b.T[1]);
            if (fVarH5 != null) {
                fVarH5.b(this);
            }
            if (fVarH6 != null) {
                fVarH6.b(this);
            }
            this.f5745j = p.b.CENTER;
            return;
        }
        if (dVarArr2[0].f5603f != null) {
            f fVarH7 = h(dVarArr2[0]);
            if (fVarH7 != null) {
                b(this.f5743h, fVarH7, this.f5737b.T[0].e());
                c(this.f5744i, this.f5743h, 1, this.f5740e);
                return;
            }
            return;
        }
        if (dVarArr2[1].f5603f != null) {
            f fVarH8 = h(dVarArr2[1]);
            if (fVarH8 != null) {
                b(this.f5744i, fVarH8, -this.f5737b.T[1].e());
                c(this.f5743h, this.f5744i, -1, this.f5740e);
                return;
            }
            return;
        }
        if ((eVar4 instanceof n.h) || eVar4.I() == null) {
            return;
        }
        b(this.f5743h, this.f5737b.I().f5615d.f5743h, this.f5737b.V());
        c(this.f5744i, this.f5743h, 1, this.f5740e);
    }

    @Override // o.p
    public void e() {
        f fVar = this.f5743h;
        if (fVar.f5715j) {
            this.f5737b.j1(fVar.f5712g);
        }
    }

    @Override // o.p
    void f() {
        this.f5738c = null;
        this.f5743h.c();
        this.f5744i.c();
        this.f5740e.c();
        this.f5742g = false;
    }

    @Override // o.p
    boolean m() {
        return this.f5739d != e.b.MATCH_CONSTRAINT || this.f5737b.f5647t == 0;
    }

    void r() {
        this.f5742g = false;
        this.f5743h.c();
        this.f5743h.f5715j = false;
        this.f5744i.c();
        this.f5744i.f5715j = false;
        this.f5740e.f5715j = false;
    }

    public String toString() {
        return "HorizontalRun " + this.f5737b.r();
    }
}
