package o;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.wK, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2800wK {
    public final C2420sK a;
    public boolean b;
    public boolean d;
    public boolean e;
    public boolean f;
    public int g;
    public int h;
    public boolean i;
    public boolean j;
    public int k;
    public boolean l;
    public boolean m;
    public int n;
    public C1091eN p;
    public int c = 5;

    /* renamed from: o, reason: collision with root package name */
    public final C2140pO f773o = new C2140pO(this);

    public C2800wK(C2420sK c2420sK) {
        this.a = c2420sK;
    }

    public final AbstractC2239qS a() {
        return (AbstractC2239qS) this.a.N.e;
    }

    public final void b() {
        int i = this.a.O.c;
        if (i == 3 || i == 4) {
            if (this.f773o.J) {
                g(true);
            } else {
                f(true);
            }
        }
        if (i == 4) {
            C1091eN c1091eN = this.p;
            if (c1091eN == null || !c1091eN.E) {
                h(true);
            } else {
                i(true);
            }
        }
    }

    public final void c(long j) {
        C1091eN c1091eN = this.p;
        if (c1091eN != null) {
            C2800wK c2800wK = c1091eN.q;
            c2800wK.c = 2;
            C2140pO c2140pO = c2800wK.f773o;
            C2420sK c2420sK = c2800wK.a;
            c2800wK.d = false;
            C1767lV snapshotObserver = ((C2207q3) AbstractC2705vK.a(c2420sK)).getSnapshotObserver();
            C0900cN c0900cN = new C0900cN(c1091eN, j);
            snapshotObserver.getClass();
            if (c2420sK.r != null) {
                snapshotObserver.a(c2420sK, snapshotObserver.b, c0900cN);
            } else {
                snapshotObserver.a(c2420sK, snapshotObserver.c, c0900cN);
            }
            c2800wK.e = true;
            c2800wK.f = true;
            if (AbstractC1904ms0.q(c2420sK)) {
                c2140pO.E = true;
                c2140pO.F = true;
            } else {
                c2140pO.D = true;
            }
            c2800wK.c = 5;
        }
    }

    public final void d(int i) {
        int i2 = this.k;
        this.k = i;
        if ((i2 == 0) != (i == 0)) {
            C2420sK c2420sKS = this.a.s();
            C2800wK c2800wK = c2420sKS != null ? c2420sKS.O : null;
            if (c2800wK != null) {
                if (i == 0) {
                    c2800wK.d(c2800wK.k - 1);
                } else {
                    c2800wK.d(c2800wK.k + 1);
                }
            }
        }
    }

    public final void e(int i) {
        int i2 = this.n;
        this.n = i;
        if ((i2 == 0) != (i == 0)) {
            C2420sK c2420sKS = this.a.s();
            C2800wK c2800wK = c2420sKS != null ? c2420sKS.O : null;
            if (c2800wK != null) {
                if (i == 0) {
                    c2800wK.e(c2800wK.n - 1);
                } else {
                    c2800wK.e(c2800wK.n + 1);
                }
            }
        }
    }

    public final void f(boolean z) {
        if (this.j != z) {
            this.j = z;
            if (z && !this.i) {
                d(this.k + 1);
            } else {
                if (z || this.i) {
                    return;
                }
                d(this.k - 1);
            }
        }
    }

    public final void g(boolean z) {
        if (this.i != z) {
            this.i = z;
            if (z && !this.j) {
                d(this.k + 1);
            } else {
                if (z || this.j) {
                    return;
                }
                d(this.k - 1);
            }
        }
    }

    public final void h(boolean z) {
        if (this.m != z) {
            this.m = z;
            if (z && !this.l) {
                e(this.n + 1);
            } else {
                if (z || this.l) {
                    return;
                }
                e(this.n - 1);
            }
        }
    }

    public final void i(boolean z) {
        if (this.l != z) {
            this.l = z;
            if (z && !this.m) {
                e(this.n + 1);
            } else {
                if (z || this.m) {
                    return;
                }
                e(this.n - 1);
            }
        }
    }

    public final void j() {
        C2140pO c2140pO = this.f773o;
        C2800wK c2800wK = c2140pO.q;
        Object obj = c2140pO.A;
        C2420sK c2420sK = this.a;
        if ((obj != null || c2800wK.a().k() != null) && c2140pO.z) {
            c2140pO.z = false;
            c2140pO.A = c2800wK.a().k();
            C2420sK c2420sKS = c2420sK.s();
            if (c2420sKS != null) {
                C2420sK.Q(c2420sKS, false, 7);
            }
        }
        C1091eN c1091eN = this.p;
        if (c1091eN != null) {
            C2800wK c2800wK2 = c1091eN.q;
            if (!(c1091eN.G == null && c2800wK2.a().N0().z.k() == null) && c1091eN.F) {
                c1091eN.F = false;
                c1091eN.G = c2800wK2.a().N0().z.k();
                if (AbstractC1904ms0.q(c2420sK)) {
                    C2420sK c2420sKS2 = c2420sK.s();
                    if (c2420sKS2 != null) {
                        C2420sK.Q(c2420sKS2, false, 7);
                        return;
                    }
                    return;
                }
                C2420sK c2420sKS3 = c2420sK.s();
                if (c2420sKS3 != null) {
                    C2420sK.O(c2420sKS3, false, 7);
                }
            }
        }
    }
}
