package o;

import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.RectF;
import java.util.ArrayList;
import java.util.BitSet;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class P70 {
    public final Y70[] a = new Y70[4];
    public final Matrix[] b = new Matrix[4];
    public final Matrix[] c = new Matrix[4];
    public final PointF d = new PointF();
    public final Path e = new Path();
    public final Path f = new Path();
    public final Y70 g = new Y70();
    public final float[] h = new float[2];
    public final float[] i = new float[2];
    public final Path j = new Path();
    public final Path k = new Path();
    public final boolean l = true;

    public P70() {
        for (int i = 0; i < 4; i++) {
            this.a[i] = new Y70();
            this.b[i] = new Matrix();
            this.c[i] = new Matrix();
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r16v0 */
    /* JADX WARN: Type inference failed for: r16v1 */
    /* JADX WARN: Type inference failed for: r16v5 */
    public final void a(N70 n70, float f, RectF rectF, C0247Jn c0247Jn, Path path) {
        Matrix[] matrixArr;
        float[] fArr;
        int i;
        Y70[] y70Arr;
        Matrix[] matrixArr2;
        boolean z;
        float f2;
        boolean z2;
        int i2;
        path.rewind();
        Path path2 = this.e;
        path2.rewind();
        Path path3 = this.f;
        path3.rewind();
        path3.addRect(rectF, Path.Direction.CW);
        int i3 = 0;
        while (true) {
            matrixArr = this.c;
            fArr = this.h;
            y70Arr = this.a;
            matrixArr2 = this.b;
            z = 0;
            if (i3 >= 4) {
                break;
            }
            InterfaceC2273qn interfaceC2273qn = i3 != 1 ? i3 != 2 ? i3 != 3 ? n70.f : n70.e : n70.h : n70.g;
            AbstractC0752ap abstractC0752ap = i3 != 1 ? i3 != 2 ? i3 != 3 ? n70.b : n70.a : n70.d : n70.c;
            Y70 y70 = y70Arr[i3];
            abstractC0752ap.getClass();
            abstractC0752ap.M(y70, f, interfaceC2273qn.a(rectF));
            int i4 = i3 + 1;
            float f3 = (i4 % 4) * 90;
            matrixArr2[i3].reset();
            PointF pointF = this.d;
            if (i3 == 1) {
                i2 = i3;
                pointF.set(rectF.right, rectF.bottom);
            } else if (i3 == 2) {
                i2 = i3;
                pointF.set(rectF.left, rectF.bottom);
            } else if (i3 != 3) {
                i2 = i3;
                pointF.set(rectF.right, rectF.top);
            } else {
                i2 = i3;
                pointF.set(rectF.left, rectF.top);
            }
            matrixArr2[i2].setTranslate(pointF.x, pointF.y);
            matrixArr2[i2].preRotate(f3);
            Y70 y702 = y70Arr[i2];
            fArr[0] = y702.b;
            fArr[1] = y702.c;
            matrixArr2[i2].mapPoints(fArr);
            matrixArr[i2].reset();
            matrixArr[i2].setTranslate(fArr[0], fArr[1]);
            matrixArr[i2].preRotate(f3);
            i3 = i4;
        }
        int i5 = 0;
        for (i = 4; i5 < i; i = 4) {
            Y70 y703 = y70Arr[i5];
            y703.getClass();
            fArr[z] = 0.0f;
            fArr[1] = y703.a;
            matrixArr2[i5].mapPoints(fArr);
            if (i5 == 0) {
                path.moveTo(fArr[z], fArr[1]);
            } else {
                path.lineTo(fArr[z], fArr[1]);
            }
            y70Arr[i5].b(matrixArr2[i5], path);
            if (c0247Jn != null) {
                Y70 y704 = y70Arr[i5];
                Matrix matrix = matrixArr2[i5];
                C1092eO c1092eO = (C1092eO) c0247Jn.m;
                f2 = 0.0f;
                BitSet bitSet = c1092eO.f508o;
                y704.getClass();
                bitSet.set(i5, z);
                X70[] x70Arr = c1092eO.m;
                y704.a(y704.e);
                x70Arr[i5] = new R70(new ArrayList(y704.g), new Matrix(matrix));
            } else {
                f2 = 0.0f;
            }
            int i6 = i5 + 1;
            int i7 = i6 % 4;
            Y70 y705 = y70Arr[i5];
            fArr[0] = y705.b;
            fArr[1] = y705.c;
            matrixArr2[i5].mapPoints(fArr);
            Y70 y706 = y70Arr[i7];
            y706.getClass();
            float[] fArr2 = this.i;
            fArr2[0] = f2;
            fArr2[1] = y706.a;
            matrixArr2[i7].mapPoints(fArr2);
            Matrix[] matrixArr3 = matrixArr;
            Y70[] y70Arr2 = y70Arr;
            float fMax = Math.max(((float) Math.hypot(fArr[0] - fArr2[0], fArr[1] - fArr2[1])) - 0.001f, f2);
            Y70 y707 = y70Arr2[i5];
            fArr[0] = y707.b;
            fArr[1] = y707.c;
            matrixArr2[i5].mapPoints(fArr);
            if (i5 == 1 || i5 == 3) {
                Math.abs(rectF.centerX() - fArr[0]);
            } else {
                Math.abs(rectF.centerY() - fArr[1]);
            }
            Y70 y708 = this.g;
            y708.d(0.0f, 270.0f, 0.0f);
            (i5 != 1 ? i5 != 2 ? i5 != 3 ? n70.j : n70.i : n70.l : n70.k).getClass();
            y708.c(fMax, 0.0f);
            Path path4 = this.j;
            path4.reset();
            y708.b(matrixArr3[i5], path4);
            if (this.l && (b(path4, i5) || b(path4, i7))) {
                path4.op(path4, path3, Path.Op.DIFFERENCE);
                fArr[0] = 0.0f;
                fArr[1] = y708.a;
                matrixArr3[i5].mapPoints(fArr);
                path2.moveTo(fArr[0], fArr[1]);
                y708.b(matrixArr3[i5], path2);
            } else {
                y708.b(matrixArr3[i5], path);
            }
            if (c0247Jn != null) {
                Matrix matrix2 = matrixArr3[i5];
                C1092eO c1092eO2 = (C1092eO) c0247Jn.m;
                z2 = false;
                c1092eO2.f508o.set(i5 + 4, false);
                X70[] x70Arr2 = c1092eO2.n;
                y708.a(y708.e);
                x70Arr2[i5] = new R70(new ArrayList(y708.g), new Matrix(matrix2));
            } else {
                z2 = false;
            }
            i5 = i6;
            z = z2;
            y70Arr = y70Arr2;
            matrixArr = matrixArr3;
        }
        path.close();
        path2.close();
        if (path2.isEmpty()) {
            return;
        }
        path.op(path2, Path.Op.UNION);
    }

    public final boolean b(Path path, int i) {
        Path path2 = this.k;
        path2.reset();
        this.a[i].b(this.b[i], path2);
        RectF rectF = new RectF();
        path.computeBounds(rectF, true);
        path2.computeBounds(rectF, true);
        path.op(path2, Path.Op.INTERSECT);
        path.computeBounds(rectF, true);
        return !rectF.isEmpty() || (rectF.width() > 1.0f && rectF.height() > 1.0f);
    }
}
