package defpackage;

import android.content.Context;
import androidx.media3.container.NalUnitUtil;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import java.util.List;
import kotlin.Metadata;
import kotlin.reflect.KProperty;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0000\u0018\u00002\u0014\u0012\u0004\u0012\u00020\u0002\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00040\u00030\u0001¨\u0006\u0005"}, d2 = {"Lig7;", "Lst7;", "Landroid/content/Context;", "Lbr1;", "Lkg7;", "datastore-preferences_release"}, k = 1, mv = {1, 5, 1}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class ig7 implements st7<Context, br1<kg7>> {
    public final String a;
    public final cz7 b;
    public final sq3 c;
    public final ak1 d;
    public final Object e;
    public volatile bg7 f;

    public ig7(String str, cz7 cz7Var, sq3 sq3Var, ak1 ak1Var) {
        cr4.g(str, AppMeasurementSdk.ConditionalUserProperty.NAME);
        this.a = str;
        this.b = cz7Var;
        this.c = sq3Var;
        this.d = ak1Var;
        this.e = new Object();
    }

    @Override // defpackage.st7
    public final Object getValue(Object obj, KProperty kProperty) {
        bg7 bg7Var;
        Context context = (Context) obj;
        cr4.g(context, "thisRef");
        cr4.g(kProperty, "property");
        bg7 bg7Var2 = this.f;
        if (bg7Var2 != null) {
            return bg7Var2;
        }
        synchronized (this.e) {
            try {
                if (this.f == null) {
                    Context applicationContext = context.getApplicationContext();
                    cz7 cz7Var = this.b;
                    sq3 sq3Var = this.c;
                    cr4.f(applicationContext, "applicationContext");
                    List list = (List) sq3Var.invoke(applicationContext);
                    ak1 ak1Var = this.d;
                    hg7 hg7Var = new hg7(applicationContext, this);
                    cr4.g(list, "migrations");
                    eg7 eg7Var = new eg7(hg7Var);
                    cr4.g(list, "migrations");
                    this.f = new bg7(new gu8(eg7Var, y41.am(new C0709uq1(list, null)), cz7Var, ak1Var));
                }
                bg7Var = this.f;
                cr4.d(bg7Var);
            } catch (Throwable th) {
                throw th;
            }
        }
        return bg7Var;
    }
}
