package d2;

import androidx.compose.ui.platform.c1;
import d2.q;
import j2.p1;
import j2.w1;
import j2.x1;
import j2.y1;
import l1.i;

/* loaded from: classes.dex */
public final class s extends i.c implements x1, p1, j2.h {
    private final String C = "androidx.compose.ui.input.pointer.PointerHoverIcon";
    private t D;
    private boolean E;
    private boolean F;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class a extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ kotlin.jvm.internal.o0 f15849p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(kotlin.jvm.internal.o0 o0Var) {
            super(1);
            this.f15849p = o0Var;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Boolean invoke(s sVar) {
            if (this.f15849p.f26199p == null && sVar.F) {
                this.f15849p.f26199p = sVar;
            } else if (this.f15849p.f26199p != null && sVar.p2() && sVar.F) {
                this.f15849p.f26199p = sVar;
            }
            return Boolean.TRUE;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class b extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ kotlin.jvm.internal.k0 f15850p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(kotlin.jvm.internal.k0 k0Var) {
            super(1);
            this.f15850p = k0Var;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final w1 invoke(s sVar) {
            if (!sVar.F) {
                return w1.ContinueTraversal;
            }
            this.f15850p.f26193p = false;
            return w1.CancelTraversal;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class c extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ kotlin.jvm.internal.o0 f15851p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        c(kotlin.jvm.internal.o0 o0Var) {
            super(1);
            this.f15851p = o0Var;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final w1 invoke(s sVar) {
            w1 w1Var = w1.ContinueTraversal;
            if (!sVar.F) {
                return w1Var;
            }
            this.f15851p.f26199p = sVar;
            return sVar.p2() ? w1.SkipSubtreeAndContinueTraversal : w1Var;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class d extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ kotlin.jvm.internal.o0 f15852p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        d(kotlin.jvm.internal.o0 o0Var) {
            super(1);
            this.f15852p = o0Var;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Boolean invoke(s sVar) {
            if (sVar.p2() && sVar.F) {
                this.f15852p.f26199p = sVar;
            }
            return Boolean.TRUE;
        }
    }

    public s(t tVar, boolean z10) {
        this.D = tVar;
        this.E = z10;
    }

    private final void i2() {
        v q22 = q2();
        if (q22 != null) {
            q22.a(null);
        }
    }

    private final void j2() {
        t tVar;
        s o22 = o2();
        if (o22 == null || (tVar = o22.D) == null) {
            tVar = this.D;
        }
        v q22 = q2();
        if (q22 != null) {
            q22.a(tVar);
        }
    }

    private final void k2() {
        rm.n0 n0Var;
        kotlin.jvm.internal.o0 o0Var = new kotlin.jvm.internal.o0();
        y1.d(this, new a(o0Var));
        s sVar = (s) o0Var.f26199p;
        if (sVar != null) {
            sVar.j2();
            n0Var = rm.n0.f34904a;
        } else {
            n0Var = null;
        }
        if (n0Var == null) {
            i2();
        }
    }

    private final void l2() {
        s n22;
        if (this.F) {
            if (!this.E && (n22 = n2()) != null) {
                this = n22;
            }
            this.j2();
        }
    }

    private final void m2() {
        kotlin.jvm.internal.k0 k0Var = new kotlin.jvm.internal.k0();
        k0Var.f26193p = true;
        if (!this.E) {
            y1.f(this, new b(k0Var));
        }
        if (k0Var.f26193p) {
            j2();
        }
    }

    private final s n2() {
        kotlin.jvm.internal.o0 o0Var = new kotlin.jvm.internal.o0();
        y1.f(this, new c(o0Var));
        return (s) o0Var.f26199p;
    }

    private final s o2() {
        kotlin.jvm.internal.o0 o0Var = new kotlin.jvm.internal.o0();
        y1.d(this, new d(o0Var));
        return (s) o0Var.f26199p;
    }

    private final v q2() {
        return (v) j2.i.a(this, c1.k());
    }

    private final void s2() {
        this.F = true;
        m2();
    }

    private final void t2() {
        if (this.F) {
            this.F = false;
            if (O1()) {
                k2();
            }
        }
    }

    @Override // l1.i.c
    public void S1() {
        t2();
        super.S1();
    }

    @Override // j2.p1
    public void d0(m mVar, o oVar, long j10) {
        if (oVar == o.Main) {
            int f10 = mVar.f();
            q.a aVar = q.f15839a;
            if (q.i(f10, aVar.a())) {
                s2();
            } else if (q.i(mVar.f(), aVar.b())) {
                t2();
            }
        }
    }

    public final boolean p2() {
        return this.E;
    }

    @Override // j2.p1
    public void q0() {
        t2();
    }

    @Override // j2.x1
    /* renamed from: r2, reason: merged with bridge method [inline-methods] */
    public String N() {
        return this.C;
    }

    public final void u2(t tVar) {
        if (kotlin.jvm.internal.t.b(this.D, tVar)) {
            return;
        }
        this.D = tVar;
        if (this.F) {
            m2();
        }
    }

    public final void v2(boolean z10) {
        if (this.E != z10) {
            this.E = z10;
            if (z10) {
                if (this.F) {
                    j2();
                }
            } else if (this.F) {
                l2();
            }
        }
    }
}
