package defpackage;

import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;

/* JADX INFO: loaded from: classes.dex */
public abstract class gla extends pn9 {

    public static class a extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setAlpha(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public static class b extends gla {
        public String k;
        public SparseArray l;
        public SparseArray m;
        public float[] n;
        public float[] o;

        @Override // defpackage.pn9
        public final void b(float f, float f2, float f3, int i, int i2) {
            throw new RuntimeException("don't call for custom attribute call setPoint(pos, ConstraintAttribute,...)");
        }

        @Override // defpackage.pn9
        public final void c(int i) {
            SparseArray sparseArray = this.l;
            int size = sparseArray.size();
            int iC = ((androidx.constraintlayout.widget.a) sparseArray.valueAt(0)).c();
            double[] dArr = new double[size];
            int i2 = iC + 2;
            this.n = new float[i2];
            this.o = new float[iC];
            double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, size, i2);
            for (int i3 = 0; i3 < size; i3++) {
                int iKeyAt = sparseArray.keyAt(i3);
                androidx.constraintlayout.widget.a aVar = (androidx.constraintlayout.widget.a) sparseArray.valueAt(i3);
                float[] fArr = (float[]) this.m.valueAt(i3);
                dArr[i3] = ((double) iKeyAt) * 0.01d;
                aVar.b(this.n);
                int i4 = 0;
                while (true) {
                    if (i4 < this.n.length) {
                        dArr2[i3][i4] = r10[i4];
                        i4++;
                    }
                }
                double[] dArr3 = dArr2[i3];
                dArr3[iC] = fArr[0];
                dArr3[iC + 1] = fArr[1];
            }
            this.a = ao1.a(i, dArr, dArr2);
        }

        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            this.a.d(f, this.n);
            float[] fArr = this.n;
            float f2 = fArr[fArr.length - 2];
            float f3 = fArr[fArr.length - 1];
            long j2 = j - this.i;
            if (Float.isNaN(this.j)) {
                float fA = y25Var.a(view, this.k);
                this.j = fA;
                if (Float.isNaN(fA)) {
                    this.j = 0.0f;
                }
            }
            float f4 = (float) ((((j2 * 1.0E-9d) * ((double) f2)) + ((double) this.j)) % 1.0d);
            this.j = f4;
            this.i = j;
            float fA2 = a(f4);
            this.h = false;
            int i = 0;
            while (true) {
                float[] fArr2 = this.o;
                if (i >= fArr2.length) {
                    break;
                }
                boolean z = this.h;
                float f5 = this.n[i];
                this.h = z | (((double) f5) != 0.0d);
                fArr2[i] = (f5 * fA2) + f3;
                i++;
            }
            ko1.b((androidx.constraintlayout.widget.a) this.l.valueAt(0), view, this.o);
            if (f2 != 0.0f) {
                this.h = true;
            }
            return this.h;
        }
    }

    public static class c extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setElevation(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public static class d extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            return this.h;
        }
    }

    public static class e extends gla {
        public boolean k;

        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            Method method;
            e eVar;
            float fD;
            if (view instanceof oa6) {
                float fD2 = d(f, j, y25Var, view);
                eVar = this;
                ((oa6) view).setProgress(fD2);
            } else {
                if (this.k) {
                    return false;
                }
                try {
                    method = view.getClass().getMethod("setProgress", Float.TYPE);
                } catch (NoSuchMethodException unused) {
                    this.k = true;
                    method = null;
                }
                if (method != null) {
                    try {
                        fD = d(f, j, y25Var, view);
                        eVar = this;
                    } catch (IllegalAccessException e) {
                        e = e;
                        eVar = this;
                    } catch (InvocationTargetException e2) {
                        e = e2;
                        eVar = this;
                    }
                    try {
                        method.invoke(view, Float.valueOf(fD));
                    } catch (IllegalAccessException e3) {
                        e = e3;
                        Log.e("ViewTimeCycle", "unable to setProgress", e);
                    } catch (InvocationTargetException e4) {
                        e = e4;
                        Log.e("ViewTimeCycle", "unable to setProgress", e);
                    }
                } else {
                    eVar = this;
                }
            }
            return eVar.h;
        }
    }

    public static class f extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setRotation(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public static class g extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setRotationX(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public static class h extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setRotationY(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public static class i extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setScaleX(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public static class j extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setScaleY(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public static class k extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setTranslationX(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public static class l extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setTranslationY(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public static class m extends gla {
        @Override // defpackage.gla
        public final boolean e(float f, long j, y25 y25Var, View view) {
            view.setTranslationZ(d(f, j, y25Var, view));
            return this.h;
        }
    }

    public gla() {
        this.b = 0;
        this.c = new int[10];
        this.d = (float[][]) Array.newInstance((Class<?>) Float.TYPE, 10, 3);
        this.g = new float[3];
        this.h = false;
        this.j = Float.NaN;
    }

    public final float d(float f2, long j2, y25 y25Var, View view) {
        float[] fArr = this.g;
        this.a.d(f2, fArr);
        boolean z = true;
        float f3 = fArr[1];
        if (f3 == 0.0f) {
            this.h = false;
            return fArr[2];
        }
        if (Float.isNaN(this.j)) {
            float fA = y25Var.a(view, this.f);
            this.j = fA;
            if (Float.isNaN(fA)) {
                this.j = 0.0f;
            }
        }
        float f4 = (float) (((((j2 - this.i) * 1.0E-9d) * ((double) f3)) + ((double) this.j)) % 1.0d);
        this.j = f4;
        String str = this.f;
        HashMap map = y25Var.a;
        if (map.containsKey(view)) {
            HashMap map2 = (HashMap) map.get(view);
            if (map2 == null) {
                map2 = new HashMap();
            }
            if (map2.containsKey(str)) {
                float[] fArrCopyOf = (float[]) map2.get(str);
                if (fArrCopyOf == null) {
                    fArrCopyOf = new float[0];
                }
                if (fArrCopyOf.length <= 0) {
                    fArrCopyOf = Arrays.copyOf(fArrCopyOf, 1);
                }
                fArrCopyOf[0] = f4;
                map2.put(str, fArrCopyOf);
            } else {
                map2.put(str, new float[]{f4});
                map.put(view, map2);
            }
        } else {
            HashMap map3 = new HashMap();
            map3.put(str, new float[]{f4});
            map.put(view, map3);
        }
        this.i = j2;
        float f5 = fArr[0];
        float fA2 = (a(this.j) * f5) + fArr[2];
        if (f5 == 0.0f && f3 == 0.0f) {
            z = false;
        }
        this.h = z;
        return fA2;
    }

    public abstract boolean e(float f2, long j2, y25 y25Var, View view);
}
