package b.e.a.j;

import b.e.a.j.l.n;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;

/* JADX INFO: loaded from: classes.dex */
public class c {

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

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public c f744f;
    public b.e.a.h i;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public HashSet<c> f739a = null;
    public int g = 0;
    public int h = Integer.MIN_VALUE;

    public enum a {
        NONE,
        LEFT,
        TOP,
        RIGHT,
        BOTTOM,
        BASELINE,
        CENTER,
        CENTER_X,
        CENTER_Y
    }

    public c(d dVar, a aVar) {
        this.f742d = dVar;
        this.f743e = aVar;
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0042  */
    /* JADX WARN: Removed duplicated region for block: B:51:0x0079 A[RETURN] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public boolean a(b.e.a.j.c r9, int r10, int r11, boolean r12) {
        /*
            r8 = this;
            r0 = 1
            if (r9 != 0) goto L7
            r8.h()
            return r0
        L7:
            if (r12 != 0) goto L7a
            b.e.a.j.c$a r12 = b.e.a.j.c.a.CENTER_Y
            b.e.a.j.c$a r1 = b.e.a.j.c.a.RIGHT
            b.e.a.j.c$a r2 = b.e.a.j.c.a.CENTER_X
            b.e.a.j.c$a r3 = b.e.a.j.c.a.LEFT
            b.e.a.j.c$a r4 = b.e.a.j.c.a.BASELINE
            b.e.a.j.c$a r5 = r9.f743e
            b.e.a.j.c$a r6 = r8.f743e
            r7 = 0
            if (r5 != r6) goto L29
            if (r6 != r4) goto L42
            b.e.a.j.d r12 = r9.f742d
            boolean r12 = r12.E
            if (r12 == 0) goto L44
            b.e.a.j.d r12 = r8.f742d
            boolean r12 = r12.E
            if (r12 != 0) goto L42
            goto L44
        L29:
            int r6 = r6.ordinal()
            switch(r6) {
                case 0: goto L44;
                case 1: goto L64;
                case 2: goto L4b;
                case 3: goto L64;
                case 4: goto L4b;
                case 5: goto L46;
                case 6: goto L3c;
                case 7: goto L44;
                case 8: goto L44;
                default: goto L30;
            }
        L30:
            java.lang.AssertionError r9 = new java.lang.AssertionError
            b.e.a.j.c$a r8 = r8.f743e
            java.lang.String r8 = r8.name()
            r9.<init>(r8)
            throw r9
        L3c:
            if (r5 == r4) goto L44
            if (r5 == r2) goto L44
            if (r5 == r12) goto L44
        L42:
            r12 = r0
            goto L77
        L44:
            r12 = r7
            goto L77
        L46:
            if (r5 == r3) goto L44
            if (r5 != r1) goto L42
            goto L44
        L4b:
            b.e.a.j.c$a r1 = b.e.a.j.c.a.TOP
            if (r5 == r1) goto L56
            b.e.a.j.c$a r1 = b.e.a.j.c.a.BOTTOM
            if (r5 != r1) goto L54
            goto L56
        L54:
            r1 = r7
            goto L57
        L56:
            r1 = r0
        L57:
            b.e.a.j.d r2 = r9.f742d
            boolean r2 = r2 instanceof b.e.a.j.f
            if (r2 == 0) goto L62
            if (r1 != 0) goto L42
            if (r5 != r12) goto L44
            goto L42
        L62:
            r12 = r1
            goto L77
        L64:
            if (r5 == r3) goto L6b
            if (r5 != r1) goto L69
            goto L6b
        L69:
            r12 = r7
            goto L6c
        L6b:
            r12 = r0
        L6c:
            b.e.a.j.d r1 = r9.f742d
            boolean r1 = r1 instanceof b.e.a.j.f
            if (r1 == 0) goto L77
            if (r12 != 0) goto L42
            if (r5 != r2) goto L44
            goto L42
        L77:
            if (r12 != 0) goto L7a
            return r7
        L7a:
            r8.f744f = r9
            java.util.HashSet<b.e.a.j.c> r12 = r9.f739a
            if (r12 != 0) goto L87
            java.util.HashSet r12 = new java.util.HashSet
            r12.<init>()
            r9.f739a = r12
        L87:
            b.e.a.j.c r9 = r8.f744f
            java.util.HashSet<b.e.a.j.c> r9 = r9.f739a
            if (r9 == 0) goto L90
            r9.add(r8)
        L90:
            r8.g = r10
            r8.h = r11
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: b.e.a.j.c.a(b.e.a.j.c, int, int, boolean):boolean");
    }

    public void b(int i, ArrayList<n> arrayList, n nVar) {
        HashSet<c> hashSet = this.f739a;
        if (hashSet != null) {
            Iterator<c> it = hashSet.iterator();
            while (it.hasNext()) {
                b.b.a.b(it.next().f742d, i, arrayList, nVar);
            }
        }
    }

    public int c() {
        if (this.f741c) {
            return this.f740b;
        }
        return 0;
    }

    public int d() {
        c cVar;
        if (this.f742d.i0 == 8) {
            return 0;
        }
        int i = this.h;
        return (i == Integer.MIN_VALUE || (cVar = this.f744f) == null || cVar.f742d.i0 != 8) ? this.g : i;
    }

    public boolean e() {
        c cVar;
        HashSet<c> hashSet = this.f739a;
        if (hashSet == null) {
            return false;
        }
        for (c cVar2 : hashSet) {
            switch (cVar2.f743e) {
                case NONE:
                case BASELINE:
                case CENTER:
                case CENTER_X:
                case CENTER_Y:
                    cVar = null;
                    break;
                case LEFT:
                    cVar = cVar2.f742d.L;
                    break;
                case TOP:
                    cVar = cVar2.f742d.M;
                    break;
                case RIGHT:
                    cVar = cVar2.f742d.J;
                    break;
                case BOTTOM:
                    cVar = cVar2.f742d.K;
                    break;
                default:
                    throw new AssertionError(cVar2.f743e.name());
            }
            if (cVar.g()) {
                return true;
            }
        }
        return false;
    }

    public boolean f() {
        HashSet<c> hashSet = this.f739a;
        return hashSet != null && hashSet.size() > 0;
    }

    public boolean g() {
        return this.f744f != null;
    }

    public void h() {
        HashSet<c> hashSet;
        c cVar = this.f744f;
        if (cVar != null && (hashSet = cVar.f739a) != null) {
            hashSet.remove(this);
            if (this.f744f.f739a.size() == 0) {
                this.f744f.f739a = null;
            }
        }
        this.f739a = null;
        this.f744f = null;
        this.g = 0;
        this.h = Integer.MIN_VALUE;
        this.f741c = false;
        this.f740b = 0;
    }

    public void i() {
        b.e.a.h hVar = this.i;
        if (hVar == null) {
            this.i = new b.e.a.h(1);
        } else {
            hVar.c();
        }
    }

    public void j(int i) {
        this.f740b = i;
        this.f741c = true;
    }

    public String toString() {
        return this.f742d.j0 + ":" + this.f743e.toString();
    }
}
