package F;

import G0.InterfaceC0267l0;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;

/* JADX INFO: loaded from: classes.dex */
public final class L implements G0.m0, InterfaceC0267l0, M {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final N f1209b;

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public InterfaceC0267l0 f1212e;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f1210c = -1;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final MutableState f1214g = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(null, null, 2, null);

    public L(Object obj, N n6) {
        this.f1208a = obj;
        this.f1209b = n6;
    }

    public final L a() {
        L l;
        if (this.f1213f) {
            A.b.c("Pin should not be called on an already disposed item ");
        }
        if (this.f1211d == 0) {
            this.f1209b.f1215a.add(this);
            G0.m0 m0Var = (G0.m0) this.f1214g.getValue();
            if (m0Var != null) {
                l = (L) m0Var;
                l.a();
            } else {
                l = null;
            }
            this.f1212e = l;
        }
        this.f1211d++;
        return this;
    }

    public final void b() {
        if (this.f1213f) {
            return;
        }
        if (this.f1211d <= 0) {
            A.b.c("Release should only be called once");
        }
        int i6 = this.f1211d - 1;
        this.f1211d = i6;
        if (i6 == 0) {
            this.f1209b.f1215a.remove(this);
            InterfaceC0267l0 interfaceC0267l0 = this.f1212e;
            if (interfaceC0267l0 != null) {
                ((L) interfaceC0267l0).b();
            }
            this.f1212e = null;
        }
    }
}
