package c.c.a.w.c; import androidx.annotation.FloatRange; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.android.material.shadow.ShadowDrawableWrapper; import java.util.ArrayList; import java.util.List; /* compiled from: BaseKeyframeAnimation */ public abstract class a { public final List a = new ArrayList(1); public boolean b = false; /* renamed from: c reason: collision with root package name */ public final d f300c; public float d = 0.0f; @Nullable public c.c.a.c0.c e; @Nullable public A f = null; public float g = -1.0f; public float h = -1.0f; /* compiled from: BaseKeyframeAnimation */ public interface b { void a(); } /* compiled from: BaseKeyframeAnimation */ public static final class c implements d { public c(C0056a aVar) { } @Override // c.c.a.w.c.a.d public boolean a(float f) { throw new IllegalStateException("not implemented"); } @Override // c.c.a.w.c.a.d public c.c.a.c0.a b() { throw new IllegalStateException("not implemented"); } @Override // c.c.a.w.c.a.d public boolean c(float f) { return false; } @Override // c.c.a.w.c.a.d public float d() { return 1.0f; } @Override // c.c.a.w.c.a.d public float e() { return 0.0f; } @Override // c.c.a.w.c.a.d public boolean isEmpty() { return true; } } /* compiled from: BaseKeyframeAnimation */ public interface d { boolean a(float f); c.c.a.c0.a b(); boolean c(float f); @FloatRange(from = ShadowDrawableWrapper.COS_45, to = 1.0d) float d(); @FloatRange(from = ShadowDrawableWrapper.COS_45, to = 1.0d) float e(); boolean isEmpty(); } /* compiled from: BaseKeyframeAnimation */ public static final class e implements d { public final List> a; @NonNull public c.c.a.c0.a b; /* renamed from: c reason: collision with root package name */ public c.c.a.c0.a f301c = null; public float d = -1.0f; public e(List> list) { this.a = list; this.b = f(0.0f); } @Override // c.c.a.w.c.a.d public boolean a(float f) { c.c.a.c0.a aVar = this.f301c; c.c.a.c0.a aVar2 = this.b; if (aVar == aVar2 && this.d == f) { return true; } this.f301c = aVar2; this.d = f; return false; } @Override // c.c.a.w.c.a.d @NonNull public c.c.a.c0.a b() { return this.b; } @Override // c.c.a.w.c.a.d public boolean c(float f) { if (this.b.a(f)) { return !this.b.d(); } this.b = f(f); return true; } @Override // c.c.a.w.c.a.d public float d() { List> list = this.a; return ((c.c.a.c0.a) list.get(list.size() - 1)).b(); } @Override // c.c.a.w.c.a.d public float e() { return ((c.c.a.c0.a) this.a.get(0)).c(); } public final c.c.a.c0.a f(float f) { List> list = this.a; c.c.a.c0.a aVar = (c.c.a.c0.a) list.get(list.size() - 1); if (f >= aVar.c()) { return aVar; } for (int size = this.a.size() - 2; size >= 1; size--) { c.c.a.c0.a aVar2 = (c.c.a.c0.a) this.a.get(size); if (this.b != aVar2 && aVar2.a(f)) { return aVar2; } } return (c.c.a.c0.a) this.a.get(0); } @Override // c.c.a.w.c.a.d public boolean isEmpty() { return false; } } /* compiled from: BaseKeyframeAnimation */ public static final class f implements d { @NonNull public final c.c.a.c0.a a; public float b = -1.0f; public f(List> list) { this.a = (c.c.a.c0.a) list.get(0); } @Override // c.c.a.w.c.a.d public boolean a(float f) { if (this.b == f) { return true; } this.b = f; return false; } @Override // c.c.a.w.c.a.d public c.c.a.c0.a b() { return this.a; } @Override // c.c.a.w.c.a.d public boolean c(float f) { return !this.a.d(); } @Override // c.c.a.w.c.a.d public float d() { return this.a.b(); } @Override // c.c.a.w.c.a.d public float e() { return this.a.c(); } @Override // c.c.a.w.c.a.d public boolean isEmpty() { return false; } } public a(List> list) { d dVar; if (list.isEmpty()) { dVar = new c<>(null); } else { dVar = list.size() == 1 ? new f<>(list) : new e<>(list); } this.f300c = dVar; } public c.c.a.c0.a a() { c.c.a.c0.a b2 = this.f300c.b(); c.c.a.c.a("BaseKeyframeAnimation#getCurrentKeyframe"); return b2; } @FloatRange(from = ShadowDrawableWrapper.COS_45, to = 1.0d) public float b() { if (this.h == -1.0f) { this.h = this.f300c.d(); } return this.h; } public float c() { c.c.a.c0.a a = a(); if (a.d()) { return 0.0f; } return a.d.getInterpolation(d()); } public float d() { if (this.b) { return 0.0f; } c.c.a.c0.a a = a(); if (a.d()) { return 0.0f; } return (this.d - a.c()) / (a.b() - a.c()); } public A e() { float c2 = c(); if (this.e == null && this.f300c.a(c2)) { return this.f; } A f2 = f(a(), c2); this.f = f2; return f2; } public abstract A f(c.c.a.c0.a aVar, float f2); public void g() { for (int i = 0; i < this.a.size(); i++) { this.a.get(i).a(); } } public void h(@FloatRange(from = 0.0d, to = 1.0d) float f2) { if (!this.f300c.isEmpty()) { if (this.g == -1.0f) { this.g = this.f300c.e(); } float f3 = this.g; if (f2 < f3) { if (f3 == -1.0f) { this.g = this.f300c.e(); } f2 = this.g; } else if (f2 > b()) { f2 = b(); } if (f2 != this.d) { this.d = f2; if (this.f300c.c(f2)) { g(); } } } } public void i(@Nullable c.c.a.c0.c cVar) { c.c.a.c0.c cVar2 = this.e; this.e = null; } }