package v;

import I0.AbstractC0300j0;
import I0.AbstractC0303l;
import I0.InterfaceC0305n;
import I0.InterfaceC0306o;
import android.view.View;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.SnapshotStateKt;
import androidx.compose.runtime.State;
import i0.AbstractC2254r;
import o0.C2631b;
import r0.InterfaceC2864c;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class x0 extends AbstractC2254r implements InterfaceC0306o, InterfaceC0305n, I0.D0, I0.n0 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public M2.D0 f24971a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public V.l0 f24972b;

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public h1.c f24975e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public InterfaceC2983I0 f24976f;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public State f24978k;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public h1.l f24979m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public X4.e f24980n;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final MutableState f24977j = SnapshotStateKt.mutableStateOf(null, SnapshotStateKt.neverEqualPolicy());
    public long l = 9205357640488583168L;

    public x0(M2.D0 d02, V.l0 l0Var, InterfaceC2985J0 interfaceC2985J0) {
        this.f24971a = d02;
        this.f24972b = l0Var;
        this.f24973c = interfaceC2985J0;
    }

    @Override // I0.InterfaceC0306o
    public final void B(AbstractC0300j0 abstractC0300j0) {
        this.f24977j.setValue(abstractC0300j0);
    }

    @Override // I0.D0
    public final void R(Q0.A a6) {
        a6.g(y0.f24986a, new C3054v0(this, 1));
    }

    @Override // I0.n0
    public final void c0() throws Throwable {
        AbstractC0303l.p(this, new C3054v0(this, 0));
    }

    @Override // I0.InterfaceC0305n
    public final void draw(InterfaceC2864c interfaceC2864c) {
        ((I0.J) interfaceC2864c).b();
        X4.e eVar = this.f24980n;
        if (eVar != null) {
            eVar.f(C3137A.f25453a);
        }
    }

    @Override // i0.AbstractC2254r
    public final void onAttach() throws Throwable {
        c0();
        this.f24980n = W.a.I(0, 7, null);
        V4.E.y(getCoroutineScope(), null, V4.D.f8228d, new w0(this, null), 1);
    }

    @Override // i0.AbstractC2254r
    public final void onDetach() {
        InterfaceC2983I0 interfaceC2983I0 = this.f24976f;
        if (interfaceC2983I0 != null) {
            ((C2987K0) interfaceC2983I0).b();
        }
        this.f24976f = null;
    }

    public final long t0() {
        if (this.f24978k == null) {
            this.f24978k = SnapshotStateKt.derivedStateOf(new C3054v0(this, 2));
        }
        State state = this.f24978k;
        if (state != null) {
            return ((C2631b) state.getValue()).f21785a;
        }
        return 9205357640488583168L;
    }

    public final void u0() {
        InterfaceC2983I0 interfaceC2983I0 = this.f24976f;
        if (interfaceC2983I0 != null) {
            ((C2987K0) interfaceC2983I0).b();
        }
        View viewV = this.f24974d;
        if (viewV == null) {
            viewV = AbstractC0303l.v(this);
        }
        this.f24974d = viewV;
        h1.c cVar = this.f24975e;
        if (cVar == null) {
            cVar = AbstractC0303l.t(this).f2155C;
        }
        this.f24975e = cVar;
        this.f24976f = this.f24973c.b(viewV, cVar);
        w0();
    }

    public final void v0() {
        h1.c cVar = this.f24975e;
        if (cVar == null) {
            cVar = AbstractC0303l.t(this).f2155C;
            this.f24975e = cVar;
        }
        long j4 = ((C2631b) this.f24971a.invoke(cVar)).f21785a;
        if ((j4 & 9223372034707292159L) == 9205357640488583168L || (9223372034707292159L & t0()) == 9205357640488583168L) {
            this.l = 9205357640488583168L;
            InterfaceC2983I0 interfaceC2983I0 = this.f24976f;
            if (interfaceC2983I0 != null) {
                ((C2987K0) interfaceC2983I0).b();
                return;
            }
            return;
        }
        this.l = C2631b.e(t0(), j4);
        if (this.f24976f == null) {
            u0();
        }
        InterfaceC2983I0 interfaceC2983I02 = this.f24976f;
        if (interfaceC2983I02 != null) {
            interfaceC2983I02.a(this.l, 9205357640488583168L);
        }
        w0();
    }

    public final void w0() {
        h1.c cVar;
        InterfaceC2983I0 interfaceC2983I0 = this.f24976f;
        if (interfaceC2983I0 == null || (cVar = this.f24975e) == null) {
            return;
        }
        C2987K0 c2987k0 = (C2987K0) interfaceC2983I0;
        long jC = c2987k0.c();
        h1.l lVar = this.f24979m;
        if (lVar != null && jC == lVar.f16627a) {
            return;
        }
        this.f24972b.invoke(new h1.h(cVar.o(W0.e.K(c2987k0.c()))));
        this.f24979m = new h1.l(c2987k0.c());
    }
}
