package o;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Vq, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractC0561Vq extends LP {
    public LP A;
    public final int z = AbstractC2333rS.e(this);

    @Override // o.LP
    public final void C0() {
        super.C0();
        for (LP lp = this.A; lp != null; lp = lp.q) {
            lp.C0();
        }
    }

    @Override // o.LP
    public final void D0() {
        for (LP lp = this.A; lp != null; lp = lp.q) {
            lp.D0();
        }
        super.D0();
    }

    @Override // o.LP
    public final void E0() {
        super.E0();
        for (LP lp = this.A; lp != null; lp = lp.q) {
            lp.E0();
        }
    }

    @Override // o.LP
    public final void F0(LP lp) {
        this.l = lp;
        for (LP lp2 = this.A; lp2 != null; lp2 = lp2.q) {
            lp2.F0(lp);
        }
    }

    @Override // o.LP
    public final void G0(AbstractC2239qS abstractC2239qS) {
        this.s = abstractC2239qS;
        for (LP lp = this.A; lp != null; lp = lp.q) {
            lp.G0(abstractC2239qS);
        }
    }

    public final InterfaceC0535Uq H0(InterfaceC0535Uq interfaceC0535Uq) {
        LP lp = ((LP) interfaceC0535Uq).l;
        if (lp != interfaceC0535Uq) {
            LP lp2 = interfaceC0535Uq instanceof LP ? (LP) interfaceC0535Uq : null;
            LP lp3 = lp2 != null ? lp2.p : null;
            if (lp != this.l || !F3.c(lp3, this)) {
                throw new IllegalStateException("Cannot delegate to an already delegated node");
            }
        } else {
            if (lp.y) {
                AbstractC2133pH.b("Cannot delegate to an already attached node");
            }
            lp.F0(this.l);
            int i = this.n;
            int iF = AbstractC2333rS.f(lp);
            lp.n = iF;
            int i2 = this.n;
            int i3 = iF & 2;
            if (i3 != 0 && (i2 & 2) != 0 && !(this instanceof InterfaceC1851mK)) {
                AbstractC2133pH.b("Delegating to multiple LayoutModifierNodes without the delegating node implementing LayoutModifierNode itself is not allowed.\nDelegating Node: " + this + "\nDelegate Node: " + lp);
            }
            lp.q = this.A;
            this.A = lp;
            lp.p = this;
            J0(iF | this.n, false);
            if (this.y) {
                if (i3 == 0 || (i & 2) != 0) {
                    G0(this.s);
                } else {
                    C0312Mb c0312Mb = AbstractC2539te.S(this).N;
                    this.l.G0(null);
                    c0312Mb.n();
                }
                lp.x0();
                lp.D0();
                if (!lp.y) {
                    AbstractC2133pH.b("autoInvalidateInsertedNode called on unattached node");
                }
                AbstractC2333rS.a(lp, -1, 1);
            }
        }
        return interfaceC0535Uq;
    }

    public final void I0(InterfaceC0535Uq interfaceC0535Uq) {
        LP lp = null;
        for (LP lp2 = this.A; lp2 != null; lp2 = lp2.q) {
            if (lp2 == interfaceC0535Uq) {
                boolean z = lp2.y;
                if (z) {
                    QQ qq = AbstractC2333rS.a;
                    if (!z) {
                        AbstractC2133pH.b("autoInvalidateRemovedNode called on unattached node");
                    }
                    AbstractC2333rS.a(lp2, -1, 2);
                    lp2.E0();
                    lp2.y0();
                }
                lp2.F0(lp2);
                lp2.f209o = 0;
                if (lp == null) {
                    this.A = lp2.q;
                } else {
                    lp.q = lp2.q;
                }
                lp2.q = null;
                lp2.p = null;
                int i = this.n;
                int iF = AbstractC2333rS.f(this);
                J0(iF, true);
                if (this.y && (i & 2) != 0 && (iF & 2) == 0) {
                    C0312Mb c0312Mb = AbstractC2539te.S(this).N;
                    this.l.G0(null);
                    c0312Mb.n();
                    return;
                }
                return;
            }
            lp = lp2;
        }
        throw new IllegalStateException(("Could not find delegate: " + interfaceC0535Uq).toString());
    }

    public final void J0(int i, boolean z) {
        LP lp;
        int i2 = this.n;
        this.n = i;
        if (i2 != i) {
            LP lp2 = this.l;
            if (lp2 == this) {
                this.f209o = i;
            }
            if (this.y) {
                LP lp3 = this;
                while (lp3 != null) {
                    i |= lp3.n;
                    lp3.n = i;
                    if (lp3 == lp2) {
                        break;
                    } else {
                        lp3 = lp3.p;
                    }
                }
                if (z && lp3 == lp2) {
                    i = AbstractC2333rS.f(lp2);
                    lp2.n = i;
                }
                int i3 = i | ((lp3 == null || (lp = lp3.q) == null) ? 0 : lp.f209o);
                while (lp3 != null) {
                    i3 |= lp3.n;
                    lp3.f209o = i3;
                    lp3 = lp3.p;
                }
            }
        }
    }

    @Override // o.LP
    public final void x0() {
        super.x0();
        for (LP lp = this.A; lp != null; lp = lp.q) {
            lp.G0(this.s);
            if (!lp.y) {
                lp.x0();
            }
        }
    }

    @Override // o.LP
    public final void y0() {
        for (LP lp = this.A; lp != null; lp = lp.q) {
            lp.y0();
        }
        super.y0();
    }
}
