package ඓ.㿎.K.ῲ.㗽.ʬ;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import com.google.android.material.progressindicator.BaseProgressIndicator;
import java.util.ArrayList;
import java.util.List;
import ඓ.ⁱ.K.ඓ.C1252;
import ඓ.K.K.K.C1293;

/* renamed from: ඓ.㿎.K.ῲ.㗽.ʬ.ῲ  reason: contains not printable characters */
/* compiled from: PathsDrawable */
public class C1428 extends Drawable {

    /* renamed from: Ԕ  reason: contains not printable characters */
    public static final Region f5368 = new Region(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);

    /* renamed from: 䁗  reason: contains not printable characters */
    public static final Region f5369 = new Region();

    /* renamed from: ʬ  reason: contains not printable characters */
    public List<Integer> f5370;

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f5371 = 1;

    /* renamed from: ᕣ  reason: contains not printable characters */
    public Bitmap f5372;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public int f5373;

    /* renamed from: ῲ  reason: contains not printable characters */
    public List<Path> f5374;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public int f5375 = 0;

    /* renamed from: K  reason: contains not printable characters */
    public Paint f5376 = new Paint();

    /* renamed from: 㑃  reason: contains not printable characters */
    public boolean f5377;

    /* renamed from: 㳳  reason: contains not printable characters */
    public List<Path> f5378;

    /* renamed from: 㴹  reason: contains not printable characters */
    public int f5379 = 0;

    /* renamed from: 㸾  reason: contains not printable characters */
    public int f5380 = 1;

    /* renamed from: 㿎  reason: contains not printable characters */
    public int f5381;

    public C1428() {
        this.f5376.setColor(-15614977);
        this.f5376.setStyle(Paint.Style.FILL);
        this.f5376.setAntiAlias(true);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:22:0x0080, code lost:
        if ((r1 == r3.getWidth() && r2 == r6.f5372.getHeight()) == false) goto L_0x0082;
     */
    public void draw(Canvas canvas) {
        Rect bounds = getBounds();
        int width = bounds.width();
        int height = bounds.height();
        if (this.f5376.getAlpha() == 255) {
            canvas.save();
            canvas.translate((float) (bounds.left - this.f5379), (float) (bounds.top - this.f5375));
            if (this.f5374 != null) {
                for (int i = 0; i < this.f5374.size(); i++) {
                    List<Integer> list = this.f5370;
                    if (list != null && i < list.size()) {
                        this.f5376.setColor(this.f5370.get(i).intValue());
                    }
                    canvas.drawPath(this.f5374.get(i), this.f5376);
                }
                this.f5376.setAlpha(BaseProgressIndicator.MAX_ALPHA);
            }
            canvas.restore();
            return;
        }
        Bitmap bitmap = this.f5372;
        if (bitmap != null) {
        }
        this.f5372 = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        this.f5377 = true;
        if (!(!this.f5377)) {
            this.f5372.eraseColor(0);
            Canvas canvas2 = new Canvas(this.f5372);
            canvas2.translate((float) (-this.f5379), (float) (-this.f5375));
            if (this.f5374 != null) {
                for (int i2 = 0; i2 < this.f5374.size(); i2++) {
                    List<Integer> list2 = this.f5370;
                    if (list2 != null && i2 < list2.size()) {
                        this.f5376.setColor(this.f5370.get(i2).intValue());
                    }
                    canvas2.drawPath(this.f5374.get(i2), this.f5376);
                }
            }
            this.f5377 = false;
        }
        canvas.drawBitmap(this.f5372, (float) bounds.left, (float) bounds.top, this.f5376);
    }

    public int getOpacity() {
        return -3;
    }

    public void setAlpha(int i) {
        this.f5376.setAlpha(i);
    }

    public void setBounds(int i, int i2, int i3, int i4) {
        int i5 = i3 - i;
        int i6 = i4 - i2;
        List<Path> list = this.f5378;
        if (list == null || list.size() <= 0 || (i5 == this.f5380 && i6 == this.f5371)) {
            super.setBounds(i, i2, i3, i4);
            return;
        }
        float f = (((float) i5) * 1.0f) / ((float) this.f5381);
        float f2 = (((float) i6) * 1.0f) / ((float) this.f5373);
        Matrix matrix = new Matrix();
        matrix.setScale(f, f2);
        this.f5374 = new ArrayList();
        for (Path path : this.f5378) {
            Path path2 = new Path();
            path.transform(matrix, path2);
            this.f5374.add(path2);
        }
        m3640();
    }

    public void setColorFilter(ColorFilter colorFilter) {
        this.f5376.setColorFilter(colorFilter);
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public int m3639() {
        return getBounds().width();
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m3640() {
        Integer num;
        Integer num2;
        Integer num3;
        int i;
        int i2;
        int i3;
        List<Path> list = this.f5374;
        Integer num4 = null;
        if (list != null) {
            Integer num5 = null;
            num2 = null;
            num = null;
            for (Path path : list) {
                f5369.setPath(path, f5368);
                Rect bounds = f5369.getBounds();
                num4 = Integer.valueOf(Math.min(num4 == null ? bounds.top : num4.intValue(), bounds.top));
                num5 = Integer.valueOf(Math.min(num5 == null ? bounds.left : num5.intValue(), bounds.left));
                num2 = Integer.valueOf(Math.max(num2 == null ? bounds.right : num2.intValue(), bounds.right));
                num = Integer.valueOf(Math.max(num == null ? bounds.bottom : num.intValue(), bounds.bottom));
            }
            num3 = num4;
            num4 = num5;
        } else {
            num3 = null;
            num2 = null;
            num = null;
        }
        int i4 = 0;
        if (num4 == null) {
            i = 0;
        } else {
            i = num4.intValue();
        }
        this.f5379 = i;
        if (num3 == null) {
            i2 = 0;
        } else {
            i2 = num3.intValue();
        }
        this.f5375 = i2;
        if (num2 == null) {
            i3 = 0;
        } else {
            i3 = num2.intValue() - this.f5379;
        }
        this.f5380 = i3;
        if (num != null) {
            i4 = num.intValue() - this.f5375;
        }
        this.f5371 = i4;
        if (this.f5381 == 0) {
            this.f5381 = this.f5380;
        }
        if (this.f5373 == 0) {
            this.f5373 = this.f5371;
        }
        Rect bounds2 = getBounds();
        int i5 = bounds2.left;
        int i6 = bounds2.top;
        super.setBounds(i5, i6, this.f5380 + i5, this.f5371 + i6);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:46:0x00c3, code lost:
        if (r19 == false) goto L_0x00c5;
     */
    /* JADX WARNING: Removed duplicated region for block: B:109:0x00d5 A[SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x0065  */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x00d6 A[Catch:{ NumberFormatException -> 0x0122 }, LOOP:4: B:34:0x00a2->B:54:0x00d6, LOOP_END] */
    /* JADX WARNING: Removed duplicated region for block: B:98:0x0131 A[SYNTHETIC] */
    /* renamed from: K  reason: contains not printable characters */
    public void m3644(String... strArr) {
        C1429[] kArr;
        int i;
        String trim;
        int i2;
        float[] fArr;
        int i3;
        C1428 r1 = this;
        String[] strArr2 = strArr;
        int i4 = 0;
        r1.f5373 = 0;
        r1.f5381 = 0;
        ArrayList arrayList = new ArrayList();
        r1.f5378 = arrayList;
        r1.f5374 = arrayList;
        int length = strArr2.length;
        int i5 = 0;
        while (i5 < length) {
            String str = strArr2[i5];
            List<Path> list = r1.f5378;
            Path path = new Path();
            if (str == null) {
                kArr = null;
            } else {
                ArrayList arrayList2 = new ArrayList();
                int i6 = 1;
                int i7 = 0;
                while (i6 < str.length()) {
                    while (i6 < str.length()) {
                        char charAt = str.charAt(i6);
                        if ((charAt - 'Z') * (charAt - 'A') > 0) {
                            if ((charAt - 'z') * (charAt - 'a') > 0) {
                                continue;
                                i6++;
                            }
                        }
                        if (!(charAt == 'e' || charAt == 'E')) {
                            trim = str.substring(i7, i6).trim();
                            if (trim.length() > 0) {
                                if ((trim.charAt(i4) == 'z') || (trim.charAt(i4) == 'Z')) {
                                    i2 = 0;
                                    fArr = new float[i4];
                                } else {
                                    try {
                                        float[] fArr2 = new float[trim.length()];
                                        int length2 = trim.length();
                                        int i8 = 0;
                                        for (int i9 = 1; i9 < length2; i9 = i3) {
                                            i3 = i9;
                                            boolean z = false;
                                            boolean z2 = false;
                                            boolean z3 = false;
                                            boolean z4 = false;
                                            while (true) {
                                                if (i3 < trim.length()) {
                                                    char charAt2 = trim.charAt(i3);
                                                    if (charAt2 != ' ') {
                                                        if (charAt2 == 'E' || charAt2 == 'e') {
                                                            z4 = true;
                                                            if (!z) {
                                                                i3++;
                                                            }
                                                        } else {
                                                            switch (charAt2) {
                                                                case '-':
                                                                    if (i3 != i9) {
                                                                    }
                                                                    break;
                                                                case '.':
                                                                    if (!z3) {
                                                                        z3 = true;
                                                                        break;
                                                                    }
                                                                    z2 = true;
                                                                    break;
                                                            }
                                                            z4 = false;
                                                            if (!z) {
                                                            }
                                                        }
                                                    }
                                                    z = true;
                                                    z4 = false;
                                                    if (!z) {
                                                    }
                                                }
                                            }
                                            if (i9 < i3) {
                                                fArr2[i8] = Float.parseFloat(trim.substring(i9, i3));
                                                i8++;
                                            }
                                            if (!z2) {
                                                i3++;
                                            }
                                        }
                                        if (i8 >= 0) {
                                            int length3 = fArr2.length;
                                            if (length3 >= 0) {
                                                int i10 = i8 + 0;
                                                fArr = new float[i10];
                                                i2 = 0;
                                                System.arraycopy(fArr2, 0, fArr, 0, Math.min(i10, length3 + 0));
                                            } else {
                                                throw new ArrayIndexOutOfBoundsException();
                                            }
                                        } else {
                                            throw new IllegalArgumentException();
                                        }
                                    } catch (NumberFormatException e) {
                                        throw new RuntimeException(C1293.m3413("error in parsing \"", trim, "\""), e);
                                    }
                                }
                                C1252.m3350(arrayList2, trim.charAt(i2), fArr);
                            }
                            i4 = 0;
                            i7 = i6;
                            i6++;
                        }
                        i6++;
                    }
                    trim = str.substring(i7, i6).trim();
                    if (trim.length() > 0) {
                    }
                    i4 = 0;
                    i7 = i6;
                    i6++;
                }
                if (i6 - i7 != 1 || i7 >= str.length()) {
                    i = 0;
                } else {
                    i = 0;
                    C1252.m3350(arrayList2, str.charAt(i7), new float[0]);
                }
                kArr = (C1429[]) arrayList2.toArray(new C1429[arrayList2.size()]);
                i4 = i;
            }
            if (kArr != null) {
                try {
                    C1429.m3646(kArr, path);
                } catch (RuntimeException e2) {
                    throw new RuntimeException(C1293.m3412("Error in parsing ", str), e2);
                }
            } else {
                path = null;
            }
            list.add(path);
            i5++;
            r1 = this;
            strArr2 = strArr;
        }
        m3640();
    }

    public void setBounds(Rect rect) {
        setBounds(rect.left, rect.top, rect.right, rect.bottom);
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3643(int... iArr) {
        this.f5370 = new ArrayList();
        for (int i : iArr) {
            this.f5370.add(Integer.valueOf(i));
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public int m3641() {
        return getBounds().height();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3642(int i) {
        Rect bounds = getBounds();
        float width = (((float) i) * 1.0f) / ((float) bounds.width());
        setBounds((int) (((float) bounds.left) * width), (int) (((float) bounds.top) * width), (int) (((float) bounds.right) * width), (int) (((float) bounds.bottom) * width));
    }
}
