package f5;

import androidx.sqlite.db.SupportSQLiteStatement;
import java.util.concurrent.atomic.AtomicBoolean;

/* loaded from: classes.dex */
public abstract class z {

    /* renamed from: a, reason: collision with root package name */
    private final r f17910a;

    /* renamed from: b, reason: collision with root package name */
    private final AtomicBoolean f17911b;

    /* renamed from: c, reason: collision with root package name */
    private final rm.o f17912c;

    /* loaded from: classes.dex */
    static final class a extends kotlin.jvm.internal.v implements dn.a {
        a() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final SupportSQLiteStatement invoke() {
            return z.this.d();
        }
    }

    public z(r database) {
        rm.o a10;
        kotlin.jvm.internal.t.g(database, "database");
        this.f17910a = database;
        this.f17911b = new AtomicBoolean(false);
        a10 = rm.q.a(new a());
        this.f17912c = a10;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final SupportSQLiteStatement d() {
        return this.f17910a.f(e());
    }

    private final SupportSQLiteStatement f() {
        return (SupportSQLiteStatement) this.f17912c.getValue();
    }

    private final SupportSQLiteStatement g(boolean z10) {
        return z10 ? f() : d();
    }

    public SupportSQLiteStatement b() {
        c();
        return g(this.f17911b.compareAndSet(false, true));
    }

    protected void c() {
        this.f17910a.c();
    }

    protected abstract String e();

    public void h(SupportSQLiteStatement statement) {
        kotlin.jvm.internal.t.g(statement, "statement");
        if (statement == f()) {
            this.f17911b.set(false);
        }
    }
}
