package androidx.core.view;

import android.os.Build;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowInsetsAnimation;
import android.view.WindowInsetsAnimation$Callback;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public final class i2 extends WindowInsetsAnimation$Callback {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public List f1768b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public ArrayList f1769c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final HashMap f1770d;

    public i2(d2 d2Var) {
        super(d2Var.f1726b);
        this.f1770d = new HashMap();
        this.f1767a = d2Var;
    }

    public final l2 a(WindowInsetsAnimation windowInsetsAnimation) {
        l2 l2Var = (l2) this.f1770d.get(windowInsetsAnimation);
        if (l2Var == null) {
            l2Var = new l2(0, null, 0L);
            if (Build.VERSION.SDK_INT >= 30) {
                l2Var.f1784a = new j2(windowInsetsAnimation);
            }
            this.f1770d.put(windowInsetsAnimation, l2Var);
        }
        return l2Var;
    }

    public final void onEnd(WindowInsetsAnimation windowInsetsAnimation) {
        d2 d2Var = this.f1767a;
        a(windowInsetsAnimation);
        ((com.google.android.material.bottomsheet.q) d2Var).f22335c.setTranslationY(0.0f);
        this.f1770d.remove(windowInsetsAnimation);
    }

    public final void onPrepare(WindowInsetsAnimation windowInsetsAnimation) {
        d2 d2Var = this.f1767a;
        a(windowInsetsAnimation);
        com.google.android.material.bottomsheet.q qVar = (com.google.android.material.bottomsheet.q) d2Var;
        View view = qVar.f22335c;
        int[] iArr = qVar.f22338f;
        view.getLocationOnScreen(iArr);
        qVar.f22336d = iArr[1];
    }

    public final WindowInsets onProgress(WindowInsets windowInsets, List list) {
        ArrayList arrayList = this.f1769c;
        if (arrayList == null) {
            ArrayList arrayList2 = new ArrayList(list.size());
            this.f1769c = arrayList2;
            this.f1768b = Collections.unmodifiableList(arrayList2);
        } else {
            arrayList.clear();
        }
        for (int size = list.size() - 1; size >= 0; size--) {
            WindowInsetsAnimation windowInsetsAnimationJ = t0.j(list.get(size));
            l2 l2VarA = a(windowInsetsAnimationJ);
            l2VarA.f1784a.d(windowInsetsAnimationJ.getFraction());
            this.f1769c.add(l2VarA);
        }
        d2 d2Var = this.f1767a;
        f3 windowInsetsCompat = f3.toWindowInsetsCompat(windowInsets, null);
        d2Var.a(windowInsetsCompat, this.f1768b);
        return windowInsetsCompat.toWindowInsets();
    }

    public final WindowInsetsAnimation.Bounds onStart(WindowInsetsAnimation windowInsetsAnimation, WindowInsetsAnimation.Bounds bounds) {
        d2 d2Var = this.f1767a;
        a(windowInsetsAnimation);
        fe.h hVar = new fe.h(bounds);
        com.google.android.material.bottomsheet.q qVar = (com.google.android.material.bottomsheet.q) d2Var;
        View view = qVar.f22335c;
        int[] iArr = qVar.f22338f;
        view.getLocationOnScreen(iArr);
        int i10 = qVar.f22336d - iArr[1];
        qVar.f22337e = i10;
        view.setTranslationY(i10);
        t0.m();
        return t0.h(((j0.d) hVar.f26080b).d(), ((j0.d) hVar.f26081c).d());
    }
}
