package a0;

import android.graphics.Rect;
import android.view.animation.Interpolator;
import androidx.constraintlayout.motion.widget.MotionLayout;
import java.util.ArrayList;
import xyz.stream.utils.f0;

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

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

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final l.b0 f35f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final Interpolator f36g;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public float f38i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public float f39j;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final boolean f42m;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final f0 f34e = new f0(4);

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public boolean f37h = false;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final Rect f41l = new Rect();

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public long f40k = System.nanoTime();

    public c0(l.b0 b0Var, q qVar, int i10, int i11, int i12, Interpolator interpolator, int i13, int i14) {
        this.f42m = false;
        this.f35f = b0Var;
        this.f32c = qVar;
        this.f33d = i11;
        if (((ArrayList) b0Var.f29643e) == null) {
            b0Var.f29643e = new ArrayList();
        }
        ((ArrayList) b0Var.f29643e).add(this);
        this.f36g = interpolator;
        this.f30a = i13;
        this.f31b = i14;
        if (i12 == 3) {
            this.f42m = true;
        }
        this.f39j = i10 == 0 ? Float.MAX_VALUE : 1.0f / i10;
        a();
    }

    public final void a() {
        boolean z10 = this.f37h;
        l.b0 b0Var = this.f35f;
        Interpolator interpolator = this.f36g;
        q qVar = this.f32c;
        int i10 = this.f31b;
        int i11 = this.f30a;
        if (z10) {
            long jNanoTime = System.nanoTime();
            long j10 = jNanoTime - this.f40k;
            this.f40k = jNanoTime;
            float f10 = this.f38i - (((float) (j10 * 1.0E-6d)) * this.f39j);
            this.f38i = f10;
            if (f10 < 0.0f) {
                this.f38i = 0.0f;
            }
            boolean zF = qVar.f(interpolator == null ? this.f38i : interpolator.getInterpolation(this.f38i), jNanoTime, qVar.f167b, this.f34e);
            if (this.f38i <= 0.0f) {
                if (i11 != -1) {
                    qVar.f167b.setTag(i11, Long.valueOf(System.nanoTime()));
                }
                if (i10 != -1) {
                    qVar.f167b.setTag(i10, null);
                }
                ((ArrayList) b0Var.f29644f).add(this);
            }
            if (this.f38i > 0.0f || zF) {
                ((MotionLayout) b0Var.f29639a).invalidate();
                return;
            }
            return;
        }
        long jNanoTime2 = System.nanoTime();
        long j11 = jNanoTime2 - this.f40k;
        this.f40k = jNanoTime2;
        float f11 = (((float) (j11 * 1.0E-6d)) * this.f39j) + this.f38i;
        this.f38i = f11;
        if (f11 >= 1.0f) {
            this.f38i = 1.0f;
        }
        boolean zF2 = qVar.f(interpolator == null ? this.f38i : interpolator.getInterpolation(this.f38i), jNanoTime2, qVar.f167b, this.f34e);
        if (this.f38i >= 1.0f) {
            if (i11 != -1) {
                qVar.f167b.setTag(i11, Long.valueOf(System.nanoTime()));
            }
            if (i10 != -1) {
                qVar.f167b.setTag(i10, null);
            }
            if (!this.f42m) {
                ((ArrayList) b0Var.f29644f).add(this);
            }
        }
        if (this.f38i < 1.0f || zF2) {
            ((MotionLayout) b0Var.f29639a).invalidate();
        }
    }

    public final void b() {
        this.f37h = true;
        int i10 = this.f33d;
        if (i10 != -1) {
            this.f39j = i10 == 0 ? Float.MAX_VALUE : 1.0f / i10;
        }
        ((MotionLayout) this.f35f.f29639a).invalidate();
        this.f40k = System.nanoTime();
    }
}
