package c1;

import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.RectF;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/* JADX INFO: compiled from: ShapePath.java */
/* JADX INFO: loaded from: classes.dex */
public class m {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    @Deprecated
    public float f3472a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    @Deprecated
    public float f3473b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    @Deprecated
    public float f3474c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    @Deprecated
    public float f3475d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    @Deprecated
    public float f3476e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    @Deprecated
    public float f3477f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private final List<f> f3478g = new ArrayList();

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private final List<g> f3479h = new ArrayList();

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    private boolean f3480i;

    /* JADX INFO: compiled from: ShapePath.java */
    class a extends g {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ List f3481b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        final /* synthetic */ Matrix f3482c;

        a(m mVar, List list, Matrix matrix) {
            this.f3481b = list;
            this.f3482c = matrix;
        }

        @Override // c1.m.g
        public void a(Matrix matrix, b1.a aVar, int i3, Canvas canvas) {
            Iterator it = this.f3481b.iterator();
            while (it.hasNext()) {
                ((g) it.next()).a(this.f3482c, aVar, i3, canvas);
            }
        }
    }

    /* JADX INFO: compiled from: ShapePath.java */
    static class b extends g {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private final d f3483b;

        public b(d dVar) {
            this.f3483b = dVar;
        }

        @Override // c1.m.g
        public void a(Matrix matrix, b1.a aVar, int i3, Canvas canvas) {
            aVar.a(canvas, matrix, new RectF(this.f3483b.k(), this.f3483b.o(), this.f3483b.l(), this.f3483b.j()), i3, this.f3483b.m(), this.f3483b.n());
        }
    }

    /* JADX INFO: compiled from: ShapePath.java */
    static class c extends g {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private final e f3484b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        private final float f3485c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        private final float f3486d;

        public c(e eVar, float f3, float f4) {
            this.f3484b = eVar;
            this.f3485c = f3;
            this.f3486d = f4;
        }

        @Override // c1.m.g
        public void a(Matrix matrix, b1.a aVar, int i3, Canvas canvas) {
            RectF rectF = new RectF(0.0f, 0.0f, (float) Math.hypot(this.f3484b.f3495c - this.f3486d, this.f3484b.f3494b - this.f3485c), 0.0f);
            Matrix matrix2 = new Matrix(matrix);
            matrix2.preTranslate(this.f3485c, this.f3486d);
            matrix2.preRotate(c());
            aVar.b(canvas, matrix2, rectF, i3);
        }

        float c() {
            return (float) Math.toDegrees(Math.atan((this.f3484b.f3495c - this.f3486d) / (this.f3484b.f3494b - this.f3485c)));
        }
    }

    /* JADX INFO: compiled from: ShapePath.java */
    public static class d extends f {

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        private static final RectF f3487h = new RectF();

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        @Deprecated
        public float f3488b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        @Deprecated
        public float f3489c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        @Deprecated
        public float f3490d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        @Deprecated
        public float f3491e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        @Deprecated
        public float f3492f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        @Deprecated
        public float f3493g;

        public d(float f3, float f4, float f5, float f6) {
            q(f3);
            u(f4);
            r(f5);
            p(f6);
        }

        /* JADX INFO: Access modifiers changed from: private */
        public float j() {
            return this.f3491e;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public float k() {
            return this.f3488b;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public float l() {
            return this.f3490d;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public float m() {
            return this.f3492f;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public float n() {
            return this.f3493g;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public float o() {
            return this.f3489c;
        }

        private void p(float f3) {
            this.f3491e = f3;
        }

        private void q(float f3) {
            this.f3488b = f3;
        }

        private void r(float f3) {
            this.f3490d = f3;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public void s(float f3) {
            this.f3492f = f3;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public void t(float f3) {
            this.f3493g = f3;
        }

        private void u(float f3) {
            this.f3489c = f3;
        }

        @Override // c1.m.f
        public void a(Matrix matrix, Path path) {
            Matrix matrix2 = this.f3496a;
            matrix.invert(matrix2);
            path.transform(matrix2);
            RectF rectF = f3487h;
            rectF.set(k(), o(), l(), j());
            path.arcTo(rectF, m(), n(), false);
            path.transform(matrix);
        }
    }

    /* JADX INFO: compiled from: ShapePath.java */
    public static class e extends f {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private float f3494b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        private float f3495c;

        @Override // c1.m.f
        public void a(Matrix matrix, Path path) {
            Matrix matrix2 = this.f3496a;
            matrix.invert(matrix2);
            path.transform(matrix2);
            path.lineTo(this.f3494b, this.f3495c);
            path.transform(matrix);
        }
    }

    /* JADX INFO: compiled from: ShapePath.java */
    public static abstract class f {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        protected final Matrix f3496a = new Matrix();

        public abstract void a(Matrix matrix, Path path);
    }

    /* JADX INFO: compiled from: ShapePath.java */
    static abstract class g {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        static final Matrix f3497a = new Matrix();

        g() {
        }

        public abstract void a(Matrix matrix, b1.a aVar, int i3, Canvas canvas);

        public final void b(b1.a aVar, int i3, Canvas canvas) {
            a(f3497a, aVar, i3, canvas);
        }
    }

    public m() {
        n(0.0f, 0.0f);
    }

    private void b(float f3) {
        if (g() == f3) {
            return;
        }
        float fG = ((f3 - g()) + 360.0f) % 360.0f;
        if (fG > 180.0f) {
            return;
        }
        d dVar = new d(i(), j(), i(), j());
        dVar.s(g());
        dVar.t(fG);
        this.f3479h.add(new b(dVar));
        p(f3);
    }

    private void c(g gVar, float f3, float f4) {
        b(f3);
        this.f3479h.add(gVar);
        p(f4);
    }

    private float g() {
        return this.f3476e;
    }

    private float h() {
        return this.f3477f;
    }

    private void p(float f3) {
        this.f3476e = f3;
    }

    private void q(float f3) {
        this.f3477f = f3;
    }

    private void r(float f3) {
        this.f3474c = f3;
    }

    private void s(float f3) {
        this.f3475d = f3;
    }

    private void t(float f3) {
        this.f3472a = f3;
    }

    private void u(float f3) {
        this.f3473b = f3;
    }

    public void a(float f3, float f4, float f5, float f6, float f7, float f8) {
        d dVar = new d(f3, f4, f5, f6);
        dVar.s(f7);
        dVar.t(f8);
        this.f3478g.add(dVar);
        b bVar = new b(dVar);
        float f9 = f7 + f8;
        boolean z2 = f8 < 0.0f;
        if (z2) {
            f7 = (f7 + 180.0f) % 360.0f;
        }
        c(bVar, f7, z2 ? (180.0f + f9) % 360.0f : f9);
        double d3 = f9;
        r(((f3 + f5) * 0.5f) + (((f5 - f3) / 2.0f) * ((float) Math.cos(Math.toRadians(d3)))));
        s(((f4 + f6) * 0.5f) + (((f6 - f4) / 2.0f) * ((float) Math.sin(Math.toRadians(d3)))));
    }

    public void d(Matrix matrix, Path path) {
        int size = this.f3478g.size();
        for (int i3 = 0; i3 < size; i3++) {
            this.f3478g.get(i3).a(matrix, path);
        }
    }

    boolean e() {
        return this.f3480i;
    }

    g f(Matrix matrix) {
        b(h());
        return new a(this, new ArrayList(this.f3479h), new Matrix(matrix));
    }

    float i() {
        return this.f3474c;
    }

    float j() {
        return this.f3475d;
    }

    float k() {
        return this.f3472a;
    }

    float l() {
        return this.f3473b;
    }

    public void m(float f3, float f4) {
        e eVar = new e();
        eVar.f3494b = f3;
        eVar.f3495c = f4;
        this.f3478g.add(eVar);
        c cVar = new c(eVar, i(), j());
        c(cVar, cVar.c() + 270.0f, cVar.c() + 270.0f);
        r(f3);
        s(f4);
    }

    public void n(float f3, float f4) {
        o(f3, f4, 270.0f, 0.0f);
    }

    public void o(float f3, float f4, float f5, float f6) {
        t(f3);
        u(f4);
        r(f3);
        s(f4);
        p(f5);
        q((f5 + f6) % 360.0f);
        this.f3478g.clear();
        this.f3479h.clear();
        this.f3480i = false;
    }
}
