package androidx.fragment.app;

import android.util.Log;
import android.view.View;
import com.google.android.gms.tasks.TaskCompletionSource;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.google.firebase.firestore.SetOptions;
import com.google.firebase.firestore.Transaction;
import com.google.firebase.firestore.auth.User;
import com.google.firebase.firestore.core.FirestoreClient;
import com.google.firebase.firestore.util.AsyncQueue;
import com.google.firebase.firestore.util.Listener;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import x4.AbstractC3229F;
import y4.C3277e;

/* JADX INFO: renamed from: androidx.fragment.app.g, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class C1049g implements B1.c, Listener, Transaction.Function {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f11587b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f11588c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ Object f11589d;

    public /* synthetic */ C1049g(Object obj, Object obj2, Object obj3, Object obj4) {
        this.f11586a = obj;
        this.f11587b = obj2;
        this.f11588c = obj3;
        this.f11589d = obj4;
    }

    @Override // com.google.firebase.firestore.Transaction.Function
    public Object apply(Transaction transaction) throws FirebaseFirestoreException {
        DocumentReference documentReference = (DocumentReference) this.f11586a;
        DocumentSnapshot documentSnapshot = transaction.get(documentReference);
        kotlin.jvm.internal.o.g(documentSnapshot, "get(...)");
        Map<String, Object> data = documentSnapshot.getData();
        LinkedHashMap linkedHashMapI = data != null ? AbstractC3229F.I(data) : null;
        if (!kotlin.jvm.internal.F.e(linkedHashMapI)) {
            linkedHashMapI = null;
        }
        if (linkedHashMapI == null) {
            linkedHashMapI = new LinkedHashMap();
        }
        String str = (String) this.f11587b;
        Object obj = linkedHashMapI.get(str);
        Map map = obj instanceof Map ? (Map) obj : null;
        LinkedHashMap linkedHashMapI2 = map != null ? AbstractC3229F.I(map) : new LinkedHashMap();
        Object obj2 = linkedHashMapI2.get("progress");
        Map map2 = obj2 instanceof Map ? (Map) obj2 : null;
        LinkedHashMap linkedHashMapI3 = map2 != null ? AbstractC3229F.I(map2) : new LinkedHashMap();
        linkedHashMapI3.put((String) this.f11588c, (C3277e) this.f11589d);
        linkedHashMapI2.put("progress", linkedHashMapI3);
        linkedHashMapI.put(str, linkedHashMapI2);
        return transaction.set(documentReference, linkedHashMapI, SetOptions.merge());
    }

    @Override // B1.c
    public void onCancel() {
        C1058o this$0 = (C1058o) this.f11587b;
        kotlin.jvm.internal.o.h(this$0, "this$0");
        C1053j animationInfo = (C1053j) this.f11588c;
        kotlin.jvm.internal.o.h(animationInfo, "$animationInfo");
        D0 operation = (D0) this.f11589d;
        kotlin.jvm.internal.o.h(operation, "$operation");
        View view = (View) this.f11586a;
        view.clearAnimation();
        this$0.f11677a.endViewTransition(view);
        animationInfo.a();
        if (AbstractC1050g0.H(2)) {
            Log.v("FragmentManager", "Animation from operation " + operation + " has been cancelled.");
        }
    }

    @Override // com.google.firebase.firestore.util.Listener
    public void onValue(Object obj) {
        ((FirestoreClient) this.f11586a).lambda$new$2((AtomicBoolean) this.f11587b, (TaskCompletionSource) this.f11588c, (AsyncQueue) this.f11589d, (User) obj);
    }
}
