package androidx.datastore.preferences;

import android.content.Context;
import java.io.File;
import java.util.List;
import kotlinx.coroutines.x;
import sd.l;

/* JADX INFO: loaded from: classes.dex */
public final class b {

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final x f1980c;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public volatile androidx.datastore.preferences.core.b f1982e;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final String f1978a = "FlutterSharedPreferences";

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Object f1981d = new Object();

    public b(l lVar, x xVar) {
        this.f1979b = lVar;
        this.f1980c = xVar;
    }

    public final Object a(Object obj, yd.g gVar) {
        androidx.datastore.preferences.core.b bVar;
        Context context = (Context) obj;
        nb.g.i(gVar, "property");
        androidx.datastore.preferences.core.b bVar2 = this.f1982e;
        if (bVar2 != null) {
            return bVar2;
        }
        synchronized (this.f1981d) {
            try {
                if (this.f1982e == null) {
                    final Context applicationContext = context.getApplicationContext();
                    l lVar = this.f1979b;
                    nb.g.h(applicationContext, "applicationContext");
                    this.f1982e = androidx.datastore.preferences.core.c.c((List) lVar.invoke(applicationContext), this.f1980c, new sd.a() { // from class: androidx.datastore.preferences.PreferenceDataStoreSingletonDelegate$getValue$1$1
                        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
                        {
                            super(0);
                        }

                        @Override // sd.a
                        public final Object invoke() {
                            Context context2 = applicationContext;
                            nb.g.h(context2, "applicationContext");
                            String str = this.f1978a;
                            nb.g.i(str, "name");
                            String strConcat = str.concat(".preferences_pb");
                            nb.g.i(strConcat, "fileName");
                            return new File(context2.getApplicationContext().getFilesDir(), "datastore/".concat(strConcat));
                        }
                    });
                }
                bVar = this.f1982e;
                nb.g.f(bVar);
            } catch (Throwable th) {
                throw th;
            }
        }
        return bVar;
    }
}
