package defpackage;

import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.VectorDrawable;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import defpackage.j47;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

/* JADX INFO: loaded from: classes.dex */
public class hfa extends gfa {
    public static final PorterDuff.Mode l = PorterDuff.Mode.SRC_IN;
    public h b;
    public PorterDuffColorFilter c;
    public ColorFilter d;
    public boolean e;
    public boolean f;
    public final float[] i;
    public final Matrix j;
    public final Rect k;

    public static class b extends f {
    }

    public static class c extends f {
        public a91 d;
        public float e;
        public a91 f;
        public float g;
        public float h;
        public float i;
        public float j;
        public float k;
        public Paint.Cap l;
        public Paint.Join m;
        public float n;

        @Override // hfa.e
        public final boolean a() {
            return this.f.b() || this.d.b();
        }

        /* JADX WARN: Removed duplicated region for block: B:13:0x0036  */
        /* JADX WARN: Removed duplicated region for block: B:7:0x001c  */
        @Override // hfa.e
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final boolean b(int[] iArr) {
            boolean z;
            a91 a91Var = this.f;
            boolean z2 = true;
            if (a91Var.b()) {
                ColorStateList colorStateList = a91Var.b;
                int colorForState = colorStateList.getColorForState(iArr, colorStateList.getDefaultColor());
                if (colorForState != a91Var.c) {
                    a91Var.c = colorForState;
                    z = true;
                } else {
                    z = false;
                }
            }
            a91 a91Var2 = this.d;
            if (a91Var2.b()) {
                ColorStateList colorStateList2 = a91Var2.b;
                int colorForState2 = colorStateList2.getColorForState(iArr, colorStateList2.getDefaultColor());
                if (colorForState2 != a91Var2.c) {
                    a91Var2.c = colorForState2;
                } else {
                    z2 = false;
                }
            }
            return z | z2;
        }

        public float getFillAlpha() {
            return this.h;
        }

        @w51
        public int getFillColor() {
            return this.f.c;
        }

        public float getStrokeAlpha() {
            return this.g;
        }

        @w51
        public int getStrokeColor() {
            return this.d.c;
        }

        public float getStrokeWidth() {
            return this.e;
        }

        public float getTrimPathEnd() {
            return this.j;
        }

        public float getTrimPathOffset() {
            return this.k;
        }

        public float getTrimPathStart() {
            return this.i;
        }

        public void setFillAlpha(float f) {
            this.h = f;
        }

        public void setFillColor(int i) {
            this.f.c = i;
        }

        public void setStrokeAlpha(float f) {
            this.g = f;
        }

        public void setStrokeColor(int i) {
            this.d.c = i;
        }

        public void setStrokeWidth(float f) {
            this.e = f;
        }

        public void setTrimPathEnd(float f) {
            this.j = f;
        }

        public void setTrimPathOffset(float f) {
            this.k = f;
        }

        public void setTrimPathStart(float f) {
            this.i = f;
        }
    }

    public static abstract class e {
        public boolean a() {
            return false;
        }

        public boolean b(int[] iArr) {
            return false;
        }
    }

    public static class h extends Drawable.ConstantState {
        public int a;
        public g b;
        public ColorStateList c;
        public PorterDuff.Mode d;
        public boolean e;
        public Bitmap f;
        public ColorStateList g;
        public PorterDuff.Mode h;
        public int i;
        public boolean j;
        public boolean k;
        public Paint l;

        @Override // android.graphics.drawable.Drawable.ConstantState
        public int getChangingConfigurations() {
            return this.a;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public final Drawable newDrawable() {
            return new hfa(this);
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public final Drawable newDrawable(Resources resources) {
            return new hfa(this);
        }
    }

    public hfa() {
        this.f = true;
        this.i = new float[9];
        this.j = new Matrix();
        this.k = new Rect();
        h hVar = new h();
        hVar.c = null;
        hVar.d = l;
        hVar.b = new g();
        this.b = hVar;
    }

    public final PorterDuffColorFilter a(ColorStateList colorStateList, PorterDuff.Mode mode) {
        if (colorStateList == null || mode == null) {
            return null;
        }
        return new PorterDuffColorFilter(colorStateList.getColorForState(super.getState(), 0), mode);
    }

    @Override // android.graphics.drawable.Drawable
    public final boolean canApplyTheme() {
        Drawable drawable = this.a;
        if (drawable == null) {
            return false;
        }
        drawable.canApplyTheme();
        return false;
    }

    @Override // android.graphics.drawable.Drawable
    public final void draw(Canvas canvas) {
        Paint paint;
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.draw(canvas);
            return;
        }
        Rect rect = this.k;
        copyBounds(rect);
        if (rect.width() <= 0 || rect.height() <= 0) {
            return;
        }
        ColorFilter colorFilter = this.d;
        if (colorFilter == null) {
            colorFilter = this.c;
        }
        Matrix matrix = this.j;
        canvas.getMatrix(matrix);
        float[] fArr = this.i;
        matrix.getValues(fArr);
        float fAbs = Math.abs(fArr[0]);
        float fAbs2 = Math.abs(fArr[4]);
        float fAbs3 = Math.abs(fArr[1]);
        float fAbs4 = Math.abs(fArr[3]);
        if (fAbs3 != 0.0f || fAbs4 != 0.0f) {
            fAbs = 1.0f;
            fAbs2 = 1.0f;
        }
        int iWidth = (int) (rect.width() * fAbs);
        int iMin = Math.min(2048, iWidth);
        int iMin2 = Math.min(2048, (int) (rect.height() * fAbs2));
        if (iMin <= 0 || iMin2 <= 0) {
            return;
        }
        int iSave = canvas.save();
        canvas.translate(rect.left, rect.top);
        if (isAutoMirrored() && getLayoutDirection() == 1) {
            canvas.translate(rect.width(), 0.0f);
            canvas.scale(-1.0f, 1.0f);
        }
        rect.offsetTo(0, 0);
        h hVar = this.b;
        Bitmap bitmap = hVar.f;
        if (bitmap == null || iMin != bitmap.getWidth() || iMin2 != hVar.f.getHeight()) {
            hVar.f = Bitmap.createBitmap(iMin, iMin2, Bitmap.Config.ARGB_8888);
            hVar.k = true;
        }
        if (this.f) {
            h hVar2 = this.b;
            if (hVar2.k || hVar2.g != hVar2.c || hVar2.h != hVar2.d || hVar2.j != hVar2.e || hVar2.i != hVar2.b.getRootAlpha()) {
                h hVar3 = this.b;
                hVar3.f.eraseColor(0);
                Canvas canvas2 = new Canvas(hVar3.f);
                g gVar = hVar3.b;
                gVar.a(gVar.g, g.p, canvas2, iMin, iMin2);
                h hVar4 = this.b;
                hVar4.g = hVar4.c;
                hVar4.h = hVar4.d;
                hVar4.i = hVar4.b.getRootAlpha();
                hVar4.j = hVar4.e;
                hVar4.k = false;
            }
        } else {
            h hVar5 = this.b;
            hVar5.f.eraseColor(0);
            Canvas canvas3 = new Canvas(hVar5.f);
            g gVar2 = hVar5.b;
            gVar2.a(gVar2.g, g.p, canvas3, iMin, iMin2);
        }
        h hVar6 = this.b;
        if (hVar6.b.getRootAlpha() >= 255 && colorFilter == null) {
            paint = null;
        } else {
            if (hVar6.l == null) {
                Paint paint2 = new Paint();
                hVar6.l = paint2;
                paint2.setFilterBitmap(true);
            }
            hVar6.l.setAlpha(hVar6.b.getRootAlpha());
            hVar6.l.setColorFilter(colorFilter);
            paint = hVar6.l;
        }
        canvas.drawBitmap(hVar6.f, (Rect) null, rect, paint);
        canvas.restoreToCount(iSave);
    }

    @Override // android.graphics.drawable.Drawable
    public final int getAlpha() {
        Drawable drawable = this.a;
        return drawable != null ? drawable.getAlpha() : this.b.b.getRootAlpha();
    }

    @Override // android.graphics.drawable.Drawable
    public final int getChangingConfigurations() {
        Drawable drawable = this.a;
        return drawable != null ? drawable.getChangingConfigurations() : super.getChangingConfigurations() | this.b.getChangingConfigurations();
    }

    @Override // android.graphics.drawable.Drawable
    public final ColorFilter getColorFilter() {
        Drawable drawable = this.a;
        return drawable != null ? drawable.getColorFilter() : this.d;
    }

    @Override // android.graphics.drawable.Drawable
    public final Drawable.ConstantState getConstantState() {
        if (this.a != null) {
            return new i(this.a.getConstantState());
        }
        this.b.a = getChangingConfigurations();
        return this.b;
    }

    @Override // android.graphics.drawable.Drawable
    public final int getIntrinsicHeight() {
        Drawable drawable = this.a;
        return drawable != null ? drawable.getIntrinsicHeight() : (int) this.b.b.i;
    }

    @Override // android.graphics.drawable.Drawable
    public final int getIntrinsicWidth() {
        Drawable drawable = this.a;
        return drawable != null ? drawable.getIntrinsicWidth() : (int) this.b.b.h;
    }

    @Override // android.graphics.drawable.Drawable
    public final int getOpacity() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.getOpacity();
        }
        return -3;
    }

    @Override // android.graphics.drawable.Drawable
    public final void inflate(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet) throws XmlPullParserException, IOException {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.inflate(resources, xmlPullParser, attributeSet);
        } else {
            inflate(resources, xmlPullParser, attributeSet, null);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final void invalidateSelf() {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.invalidateSelf();
        } else {
            super.invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final boolean isAutoMirrored() {
        Drawable drawable = this.a;
        return drawable != null ? drawable.isAutoMirrored() : this.b.e;
    }

    @Override // android.graphics.drawable.Drawable
    public final boolean isStateful() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.isStateful();
        }
        if (super.isStateful()) {
            return true;
        }
        h hVar = this.b;
        if (hVar == null) {
            return false;
        }
        g gVar = hVar.b;
        if (gVar.n == null) {
            gVar.n = Boolean.valueOf(gVar.g.a());
        }
        if (gVar.n.booleanValue()) {
            return true;
        }
        ColorStateList colorStateList = this.b.c;
        return colorStateList != null && colorStateList.isStateful();
    }

    @Override // android.graphics.drawable.Drawable
    public final Drawable mutate() {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.mutate();
            return this;
        }
        if (!this.e && super.mutate() == this) {
            h hVar = this.b;
            h hVar2 = new h();
            hVar2.c = null;
            hVar2.d = l;
            if (hVar != null) {
                hVar2.a = hVar.a;
                g gVar = new g(hVar.b);
                hVar2.b = gVar;
                if (hVar.b.e != null) {
                    gVar.e = new Paint(hVar.b.e);
                }
                if (hVar.b.d != null) {
                    hVar2.b.d = new Paint(hVar.b.d);
                }
                hVar2.c = hVar.c;
                hVar2.d = hVar.d;
                hVar2.e = hVar.e;
            }
            this.b = hVar2;
            this.e = true;
        }
        return this;
    }

    @Override // defpackage.gfa, android.graphics.drawable.Drawable
    public final void onBoundsChange(Rect rect) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setBounds(rect);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final boolean onStateChange(int[] iArr) {
        boolean z;
        PorterDuff.Mode mode;
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.setState(iArr);
        }
        h hVar = this.b;
        ColorStateList colorStateList = hVar.c;
        if (colorStateList == null || (mode = hVar.d) == null) {
            z = false;
        } else {
            this.c = a(colorStateList, mode);
            invalidateSelf();
            z = true;
        }
        g gVar = hVar.b;
        if (gVar.n == null) {
            gVar.n = Boolean.valueOf(gVar.g.a());
        }
        if (gVar.n.booleanValue()) {
            boolean zB = hVar.b.g.b(iArr);
            hVar.k |= zB;
            if (zB) {
                invalidateSelf();
                return true;
            }
        }
        return z;
    }

    @Override // android.graphics.drawable.Drawable
    public final void scheduleSelf(Runnable runnable, long j) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.scheduleSelf(runnable, j);
        } else {
            super.scheduleSelf(runnable, j);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final void setAlpha(int i2) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setAlpha(i2);
        } else if (this.b.b.getRootAlpha() != i2) {
            this.b.b.setRootAlpha(i2);
            invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final void setAutoMirrored(boolean z) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setAutoMirrored(z);
        } else {
            this.b.e = z;
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final void setColorFilter(ColorFilter colorFilter) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setColorFilter(colorFilter);
        } else {
            this.d = colorFilter;
            invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final void setTint(int i2) {
        Drawable drawable = this.a;
        if (drawable != null) {
            gf2.a(drawable, i2);
        } else {
            setTintList(ColorStateList.valueOf(i2));
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final void setTintList(ColorStateList colorStateList) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setTintList(colorStateList);
            return;
        }
        h hVar = this.b;
        if (hVar.c != colorStateList) {
            hVar.c = colorStateList;
            this.c = a(colorStateList, hVar.d);
            invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final void setTintMode(PorterDuff.Mode mode) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setTintMode(mode);
            return;
        }
        h hVar = this.b;
        if (hVar.d != mode) {
            hVar.d = mode;
            this.c = a(hVar.c, mode);
            invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final boolean setVisible(boolean z, boolean z2) {
        Drawable drawable = this.a;
        return drawable != null ? drawable.setVisible(z, z2) : super.setVisible(z, z2);
    }

    @Override // android.graphics.drawable.Drawable
    public final void unscheduleSelf(Runnable runnable) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.unscheduleSelf(runnable);
        } else {
            super.unscheduleSelf(runnable);
        }
    }

    @l18
    public static class i extends Drawable.ConstantState {
        public final Drawable.ConstantState a;

        public i(Drawable.ConstantState constantState) {
            this.a = constantState;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public final boolean canApplyTheme() {
            return this.a.canApplyTheme();
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public int getChangingConfigurations() {
            return this.a.getChangingConfigurations();
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public final Drawable newDrawable() {
            hfa hfaVar = new hfa();
            hfaVar.a = (VectorDrawable) this.a.newDrawable();
            return hfaVar;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public final Drawable newDrawable(Resources resources) {
            hfa hfaVar = new hfa();
            hfaVar.a = (VectorDrawable) this.a.newDrawable(resources);
            return hfaVar;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public final Drawable newDrawable(Resources resources, Resources.Theme theme) {
            hfa hfaVar = new hfa();
            hfaVar.a = (VectorDrawable) this.a.newDrawable(resources, theme);
            return hfaVar;
        }
    }

    public static abstract class f extends e {
        public j47.b[] a;
        public String b;
        public int c;

        public f() {
            this.a = null;
            this.c = 0;
        }

        public j47.b[] getPathData() {
            return this.a;
        }

        public String getPathName() {
            return this.b;
        }

        public void setPathData(j47.b[] bVarArr) {
            if (!j47.a(this.a, bVarArr)) {
                this.a = j47.e(bVarArr);
                return;
            }
            j47.b[] bVarArr2 = this.a;
            for (int i = 0; i < bVarArr.length; i++) {
                bVarArr2[i].a = bVarArr[i].a;
                int i2 = 0;
                while (true) {
                    float[] fArr = bVarArr[i].b;
                    if (i2 < fArr.length) {
                        bVarArr2[i].b[i2] = fArr[i2];
                        i2++;
                    }
                }
            }
        }

        public f(f fVar) {
            this.a = null;
            this.c = 0;
            this.b = fVar.b;
            this.a = j47.e(fVar.a);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final void inflate(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
        int i2;
        char c2;
        int i3;
        Paint.Cap cap;
        Paint.Join join;
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.inflate(resources, xmlPullParser, attributeSet, theme);
            return;
        }
        h hVar = this.b;
        hVar.b = new g();
        TypedArray typedArrayC = l0a.c(resources, theme, attributeSet, sj.a);
        h hVar2 = this.b;
        g gVar = hVar2.b;
        int i4 = !l0a.b(xmlPullParser, "tintMode") ? -1 : typedArrayC.getInt(6, -1);
        PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
        if (i4 == 3) {
            mode = PorterDuff.Mode.SRC_OVER;
        } else if (i4 != 5) {
            if (i4 != 9) {
                switch (i4) {
                    case 14:
                        mode = PorterDuff.Mode.MULTIPLY;
                        break;
                    case 15:
                        mode = PorterDuff.Mode.SCREEN;
                        break;
                    case 16:
                        mode = PorterDuff.Mode.ADD;
                        break;
                }
            } else {
                mode = PorterDuff.Mode.SRC_ATOP;
            }
        }
        hVar2.d = mode;
        ColorStateList colorStateListA = null;
        int i5 = 1;
        if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "tint") != null) {
            TypedValue typedValue = new TypedValue();
            typedArrayC.getValue(1, typedValue);
            int i6 = typedValue.type;
            if (i6 == 2) {
                throw new UnsupportedOperationException("Failed to resolve attribute at index 1: " + typedValue);
            }
            if (i6 >= 28 && i6 <= 31) {
                colorStateListA = ColorStateList.valueOf(typedValue.data);
            } else {
                Resources resources2 = typedArrayC.getResources();
                int resourceId = typedArrayC.getResourceId(1, 0);
                ThreadLocal threadLocal = f61.a;
                try {
                    colorStateListA = f61.a(resources2, resources2.getXml(resourceId), theme);
                } catch (Exception e2) {
                    Log.e("CSLCompat", "Failed to inflate ColorStateList.", e2);
                }
            }
        }
        ColorStateList colorStateList = colorStateListA;
        if (colorStateList != null) {
            hVar2.c = colorStateList;
        }
        boolean z = hVar2.e;
        if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "autoMirrored") != null) {
            z = typedArrayC.getBoolean(5, z);
        }
        hVar2.e = z;
        float f2 = gVar.j;
        if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "viewportWidth") != null) {
            f2 = typedArrayC.getFloat(7, f2);
        }
        gVar.j = f2;
        float f3 = gVar.k;
        if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "viewportHeight") != null) {
            f3 = typedArrayC.getFloat(8, f3);
        }
        gVar.k = f3;
        if (gVar.j <= 0.0f) {
            throw new XmlPullParserException(typedArrayC.getPositionDescription() + "<vector> tag requires viewportWidth > 0");
        }
        if (f3 > 0.0f) {
            gVar.h = typedArrayC.getDimension(3, gVar.h);
            float dimension = typedArrayC.getDimension(2, gVar.i);
            gVar.i = dimension;
            if (gVar.h <= 0.0f) {
                throw new XmlPullParserException(typedArrayC.getPositionDescription() + "<vector> tag requires width > 0");
            }
            if (dimension > 0.0f) {
                float alpha = gVar.getAlpha();
                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "alpha") != null) {
                    alpha = typedArrayC.getFloat(4, alpha);
                }
                gVar.setAlpha(alpha);
                String string = typedArrayC.getString(0);
                if (string != null) {
                    gVar.m = string;
                    gVar.o.put(string, gVar);
                }
                typedArrayC.recycle();
                hVar.a = getChangingConfigurations();
                hVar.k = true;
                h hVar3 = this.b;
                g gVar2 = hVar3.b;
                ArrayDeque arrayDeque = new ArrayDeque();
                d dVar = gVar2.g;
                ts tsVar = gVar2.o;
                arrayDeque.push(dVar);
                int eventType = xmlPullParser.getEventType();
                int depth = xmlPullParser.getDepth() + 1;
                boolean z2 = true;
                while (eventType != i5 && (xmlPullParser.getDepth() >= depth || eventType != 3)) {
                    if (eventType == 2) {
                        String name = xmlPullParser.getName();
                        d dVar2 = (d) arrayDeque.peek();
                        i2 = depth;
                        if ("path".equals(name)) {
                            c cVar = new c();
                            cVar.e = 0.0f;
                            cVar.g = 1.0f;
                            cVar.h = 1.0f;
                            cVar.i = 0.0f;
                            cVar.j = 1.0f;
                            cVar.k = 0.0f;
                            Paint.Cap cap2 = Paint.Cap.BUTT;
                            cVar.l = cap2;
                            Paint.Join join2 = Paint.Join.MITER;
                            cVar.m = join2;
                            cVar.n = 4.0f;
                            TypedArray typedArrayC2 = l0a.c(resources, theme, attributeSet, sj.c);
                            if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "pathData") != null) {
                                String string2 = typedArrayC2.getString(0);
                                if (string2 != null) {
                                    cVar.b = string2;
                                }
                                String string3 = typedArrayC2.getString(2);
                                if (string3 != null) {
                                    cVar.a = j47.c(string3);
                                }
                                cVar.f = l0a.a(typedArrayC2, xmlPullParser, theme, "fillColor", 1);
                                float f4 = cVar.h;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "fillAlpha") != null) {
                                    f4 = typedArrayC2.getFloat(12, f4);
                                }
                                cVar.h = f4;
                                int i7 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "strokeLineCap") != null ? typedArrayC2.getInt(8, -1) : -1;
                                Paint.Cap cap3 = cVar.l;
                                if (i7 == 0) {
                                    cap = cap2;
                                } else if (i7 != 1) {
                                    cap = i7 != 2 ? cap3 : Paint.Cap.SQUARE;
                                } else {
                                    cap = Paint.Cap.ROUND;
                                }
                                cVar.l = cap;
                                int i8 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "strokeLineJoin") != null ? typedArrayC2.getInt(9, -1) : -1;
                                Paint.Join join3 = cVar.m;
                                if (i8 == 0) {
                                    join = join2;
                                } else if (i8 != 1) {
                                    join = i8 != 2 ? join3 : Paint.Join.BEVEL;
                                } else {
                                    join = Paint.Join.ROUND;
                                }
                                cVar.m = join;
                                float f5 = cVar.n;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "strokeMiterLimit") != null) {
                                    f5 = typedArrayC2.getFloat(10, f5);
                                }
                                cVar.n = f5;
                                cVar.d = l0a.a(typedArrayC2, xmlPullParser, theme, "strokeColor", 3);
                                float f6 = cVar.g;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "strokeAlpha") != null) {
                                    f6 = typedArrayC2.getFloat(11, f6);
                                }
                                cVar.g = f6;
                                float f7 = cVar.e;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "strokeWidth") != null) {
                                    f7 = typedArrayC2.getFloat(4, f7);
                                }
                                cVar.e = f7;
                                float f8 = cVar.j;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "trimPathEnd") != null) {
                                    f8 = typedArrayC2.getFloat(6, f8);
                                }
                                cVar.j = f8;
                                float f9 = cVar.k;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "trimPathOffset") != null) {
                                    f9 = typedArrayC2.getFloat(7, f9);
                                }
                                cVar.k = f9;
                                float f10 = cVar.i;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "trimPathStart") != null) {
                                    f10 = typedArrayC2.getFloat(5, f10);
                                }
                                cVar.i = f10;
                                int i9 = cVar.c;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "fillType") != null) {
                                    i9 = typedArrayC2.getInt(13, i9);
                                }
                                cVar.c = i9;
                            }
                            typedArrayC2.recycle();
                            dVar2.b.add(cVar);
                            if (cVar.getPathName() != null) {
                                tsVar.put(cVar.getPathName(), cVar);
                            }
                            hVar3.a = hVar3.a;
                            z2 = false;
                            c2 = '\b';
                        } else {
                            c2 = '\b';
                            if ("clip-path".equals(name)) {
                                b bVar = new b();
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "pathData") != null) {
                                    TypedArray typedArrayC3 = l0a.c(resources, theme, attributeSet, sj.d);
                                    String string4 = typedArrayC3.getString(0);
                                    if (string4 != null) {
                                        bVar.b = string4;
                                    }
                                    String string5 = typedArrayC3.getString(1);
                                    if (string5 != null) {
                                        bVar.a = j47.c(string5);
                                    }
                                    bVar.c = !l0a.b(xmlPullParser, "fillType") ? 0 : typedArrayC3.getInt(2, 0);
                                    typedArrayC3.recycle();
                                }
                                dVar2.b.add(bVar);
                                if (bVar.getPathName() != null) {
                                    tsVar.put(bVar.getPathName(), bVar);
                                }
                                hVar3.a = hVar3.a;
                            } else if ("group".equals(name)) {
                                d dVar3 = new d();
                                TypedArray typedArrayC4 = l0a.c(resources, theme, attributeSet, sj.b);
                                float f11 = dVar3.c;
                                if (l0a.b(xmlPullParser, "rotation")) {
                                    f11 = typedArrayC4.getFloat(5, f11);
                                }
                                dVar3.c = f11;
                                dVar3.d = typedArrayC4.getFloat(1, dVar3.d);
                                dVar3.e = typedArrayC4.getFloat(2, dVar3.e);
                                float f12 = dVar3.f;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "scaleX") != null) {
                                    f12 = typedArrayC4.getFloat(3, f12);
                                }
                                dVar3.f = f12;
                                float f13 = dVar3.g;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "scaleY") != null) {
                                    f13 = typedArrayC4.getFloat(4, f13);
                                }
                                dVar3.g = f13;
                                float f14 = dVar3.h;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "translateX") != null) {
                                    f14 = typedArrayC4.getFloat(6, f14);
                                }
                                dVar3.h = f14;
                                float f15 = dVar3.i;
                                if (xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "translateY") != null) {
                                    f15 = typedArrayC4.getFloat(7, f15);
                                }
                                dVar3.i = f15;
                                String string6 = typedArrayC4.getString(0);
                                if (string6 != null) {
                                    dVar3.k = string6;
                                }
                                dVar3.c();
                                typedArrayC4.recycle();
                                dVar2.b.add(dVar3);
                                arrayDeque.push(dVar3);
                                if (dVar3.getGroupName() != null) {
                                    tsVar.put(dVar3.getGroupName(), dVar3);
                                }
                                hVar3.a = hVar3.a;
                            }
                        }
                        i3 = 1;
                    } else {
                        i2 = depth;
                        c2 = '\b';
                        i3 = 1;
                        if (eventType == 3 && "group".equals(xmlPullParser.getName())) {
                            arrayDeque.pop();
                        }
                    }
                    eventType = xmlPullParser.next();
                    i5 = i3;
                    depth = i2;
                }
                if (!z2) {
                    this.c = a(hVar.c, hVar.d);
                    return;
                }
                throw new XmlPullParserException("no path defined");
            }
            throw new XmlPullParserException(typedArrayC.getPositionDescription() + "<vector> tag requires height > 0");
        }
        throw new XmlPullParserException(typedArrayC.getPositionDescription() + "<vector> tag requires viewportHeight > 0");
    }

    public static class d extends e {
        public final Matrix a;
        public final ArrayList b;
        public float c;
        public float d;
        public float e;
        public float f;
        public float g;
        public float h;
        public float i;
        public final Matrix j;
        public String k;

        public d() {
            this.a = new Matrix();
            this.b = new ArrayList();
            this.c = 0.0f;
            this.d = 0.0f;
            this.e = 0.0f;
            this.f = 1.0f;
            this.g = 1.0f;
            this.h = 0.0f;
            this.i = 0.0f;
            this.j = new Matrix();
            this.k = null;
        }

        @Override // hfa.e
        public final boolean a() {
            int i = 0;
            while (true) {
                ArrayList arrayList = this.b;
                if (i >= arrayList.size()) {
                    return false;
                }
                if (((e) arrayList.get(i)).a()) {
                    return true;
                }
                i++;
            }
        }

        @Override // hfa.e
        public final boolean b(int[] iArr) {
            int i = 0;
            boolean zB = false;
            while (true) {
                ArrayList arrayList = this.b;
                if (i >= arrayList.size()) {
                    return zB;
                }
                zB |= ((e) arrayList.get(i)).b(iArr);
                i++;
            }
        }

        public final void c() {
            Matrix matrix = this.j;
            matrix.reset();
            matrix.postTranslate(-this.d, -this.e);
            matrix.postScale(this.f, this.g);
            matrix.postRotate(this.c, 0.0f, 0.0f);
            matrix.postTranslate(this.h + this.d, this.i + this.e);
        }

        public String getGroupName() {
            return this.k;
        }

        public Matrix getLocalMatrix() {
            return this.j;
        }

        public float getPivotX() {
            return this.d;
        }

        public float getPivotY() {
            return this.e;
        }

        public float getRotation() {
            return this.c;
        }

        public float getScaleX() {
            return this.f;
        }

        public float getScaleY() {
            return this.g;
        }

        public float getTranslateX() {
            return this.h;
        }

        public float getTranslateY() {
            return this.i;
        }

        public void setPivotX(float f) {
            if (f != this.d) {
                this.d = f;
                c();
            }
        }

        public void setPivotY(float f) {
            if (f != this.e) {
                this.e = f;
                c();
            }
        }

        public void setRotation(float f) {
            if (f != this.c) {
                this.c = f;
                c();
            }
        }

        public void setScaleX(float f) {
            if (f != this.f) {
                this.f = f;
                c();
            }
        }

        public void setScaleY(float f) {
            if (f != this.g) {
                this.g = f;
                c();
            }
        }

        public void setTranslateX(float f) {
            if (f != this.h) {
                this.h = f;
                c();
            }
        }

        public void setTranslateY(float f) {
            if (f != this.i) {
                this.i = f;
                c();
            }
        }

        public d(d dVar, ts tsVar) {
            f bVar;
            this.a = new Matrix();
            this.b = new ArrayList();
            this.c = 0.0f;
            this.d = 0.0f;
            this.e = 0.0f;
            this.f = 1.0f;
            this.g = 1.0f;
            this.h = 0.0f;
            this.i = 0.0f;
            Matrix matrix = new Matrix();
            this.j = matrix;
            this.k = null;
            this.c = dVar.c;
            this.d = dVar.d;
            this.e = dVar.e;
            this.f = dVar.f;
            this.g = dVar.g;
            this.h = dVar.h;
            this.i = dVar.i;
            String str = dVar.k;
            this.k = str;
            if (str != null) {
                tsVar.put(str, this);
            }
            matrix.set(dVar.j);
            ArrayList arrayList = dVar.b;
            for (int i = 0; i < arrayList.size(); i++) {
                Object obj = arrayList.get(i);
                if (obj instanceof d) {
                    this.b.add(new d((d) obj, tsVar));
                } else {
                    if (obj instanceof c) {
                        c cVar = (c) obj;
                        c cVar2 = new c(cVar);
                        cVar2.e = 0.0f;
                        cVar2.g = 1.0f;
                        cVar2.h = 1.0f;
                        cVar2.i = 0.0f;
                        cVar2.j = 1.0f;
                        cVar2.k = 0.0f;
                        cVar2.l = Paint.Cap.BUTT;
                        cVar2.m = Paint.Join.MITER;
                        cVar2.n = 4.0f;
                        cVar2.d = cVar.d;
                        cVar2.e = cVar.e;
                        cVar2.g = cVar.g;
                        cVar2.f = cVar.f;
                        cVar2.c = cVar.c;
                        cVar2.h = cVar.h;
                        cVar2.i = cVar.i;
                        cVar2.j = cVar.j;
                        cVar2.k = cVar.k;
                        cVar2.l = cVar.l;
                        cVar2.m = cVar.m;
                        cVar2.n = cVar.n;
                        bVar = cVar2;
                    } else if (obj instanceof b) {
                        bVar = new b((b) obj);
                    } else {
                        throw new IllegalStateException("Unknown object in the tree!");
                    }
                    this.b.add(bVar);
                    Object obj2 = bVar.b;
                    if (obj2 != null) {
                        tsVar.put(obj2, bVar);
                    }
                }
            }
        }
    }

    public hfa(h hVar) {
        this.f = true;
        this.i = new float[9];
        this.j = new Matrix();
        this.k = new Rect();
        this.b = hVar;
        this.c = a(hVar.c, hVar.d);
    }

    public static class g {
        public static final Matrix p = new Matrix();
        public final Path a;
        public final Path b;
        public final Matrix c;
        public Paint d;
        public Paint e;
        public PathMeasure f;
        public final d g;
        public float h;
        public float i;
        public float j;
        public float k;
        public int l;
        public String m;
        public Boolean n;
        public final ts o;

        public g() {
            this.c = new Matrix();
            this.h = 0.0f;
            this.i = 0.0f;
            this.j = 0.0f;
            this.k = 0.0f;
            this.l = 255;
            this.m = null;
            this.n = null;
            this.o = new ts(0);
            this.g = new d();
            this.a = new Path();
            this.b = new Path();
        }

        /* JADX WARN: Multi-variable type inference failed */
        public final void a(d dVar, Matrix matrix, Canvas canvas, int i, int i2) {
            int i3;
            float f;
            int i4;
            float f2;
            Matrix matrix2 = dVar.a;
            ArrayList arrayList = dVar.b;
            matrix2.set(matrix);
            Matrix matrix3 = dVar.a;
            matrix3.preConcat(dVar.j);
            canvas.save();
            char c = 0;
            int i5 = 0;
            while (i5 < arrayList.size()) {
                e eVar = (e) arrayList.get(i5);
                if (eVar instanceof d) {
                    a((d) eVar, matrix3, canvas, i, i2);
                } else if (eVar instanceof f) {
                    f fVar = (f) eVar;
                    float f3 = i / this.j;
                    float f4 = i2 / this.k;
                    float fMin = Math.min(f3, f4);
                    Matrix matrix4 = this.c;
                    matrix4.set(matrix3);
                    matrix4.postScale(f3, f4);
                    float[] fArr = {0.0f, 1.0f, 1.0f, 0.0f};
                    matrix3.mapVectors(fArr);
                    float fHypot = (float) Math.hypot(fArr[c], fArr[1]);
                    boolean z = c;
                    i3 = i5;
                    float fHypot2 = (float) Math.hypot(fArr[2], fArr[3]);
                    float f5 = (fArr[z ? 1 : 0] * fArr[3]) - (fArr[1] * fArr[2]);
                    float fMax = Math.max(fHypot, fHypot2);
                    float fAbs = fMax > 0.0f ? Math.abs(f5) / fMax : 0.0f;
                    if (fAbs != 0.0f) {
                        Path path = this.a;
                        path.reset();
                        j47.b[] bVarArr = fVar.a;
                        if (bVarArr != null) {
                            j47.b.b(bVarArr, path);
                        }
                        Path path2 = this.b;
                        path2.reset();
                        if (fVar instanceof b) {
                            path2.setFillType(fVar.c == 0 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD);
                            path2.addPath(path, matrix4);
                            canvas.clipPath(path2);
                        } else {
                            c cVar = (c) fVar;
                            float f6 = cVar.i;
                            if (f6 != 0.0f || cVar.j != 1.0f) {
                                float f7 = cVar.k;
                                float f8 = (f6 + f7) % 1.0f;
                                float f9 = (cVar.j + f7) % 1.0f;
                                if (this.f == null) {
                                    this.f = new PathMeasure();
                                }
                                this.f.setPath(path, z);
                                float length = this.f.getLength();
                                float f10 = f8 * length;
                                float f11 = f9 * length;
                                path.reset();
                                if (f10 > f11) {
                                    this.f.getSegment(f10, length, path, true);
                                    f = 0.0f;
                                    this.f.getSegment(0.0f, f11, path, true);
                                } else {
                                    f = 0.0f;
                                    this.f.getSegment(f10, f11, path, true);
                                }
                                path.rLineTo(f, f);
                            }
                            path2.addPath(path, matrix4);
                            a91 a91Var = cVar.f;
                            if (a91Var.a == null && a91Var.c == 0) {
                                f2 = 255.0f;
                                i4 = 16777215;
                            } else {
                                if (this.e == null) {
                                    i4 = 16777215;
                                    Paint paint = new Paint(1);
                                    this.e = paint;
                                    paint.setStyle(Paint.Style.FILL);
                                } else {
                                    i4 = 16777215;
                                }
                                Paint paint2 = this.e;
                                Shader shader = a91Var.a;
                                if (shader != null) {
                                    shader.setLocalMatrix(matrix4);
                                    paint2.setShader(shader);
                                    paint2.setAlpha(Math.round(cVar.h * 255.0f));
                                    f2 = 255.0f;
                                } else {
                                    paint2.setShader(null);
                                    paint2.setAlpha(255);
                                    int i6 = a91Var.c;
                                    float f12 = cVar.h;
                                    PorterDuff.Mode mode = hfa.l;
                                    f2 = 255.0f;
                                    paint2.setColor((i6 & i4) | (((int) (Color.alpha(i6) * f12)) << 24));
                                }
                                paint2.setColorFilter(null);
                                path2.setFillType(cVar.c == 0 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD);
                                canvas.drawPath(path2, paint2);
                            }
                            a91 a91Var2 = cVar.d;
                            if (a91Var2.a != null || a91Var2.c != 0) {
                                if (this.d == null) {
                                    Paint paint3 = new Paint(1);
                                    this.d = paint3;
                                    paint3.setStyle(Paint.Style.STROKE);
                                }
                                Paint paint4 = this.d;
                                Paint.Join join = cVar.m;
                                if (join != null) {
                                    paint4.setStrokeJoin(join);
                                }
                                Paint.Cap cap = cVar.l;
                                if (cap != null) {
                                    paint4.setStrokeCap(cap);
                                }
                                paint4.setStrokeMiter(cVar.n);
                                Shader shader2 = a91Var2.a;
                                if (shader2 != null) {
                                    shader2.setLocalMatrix(matrix4);
                                    paint4.setShader(shader2);
                                    paint4.setAlpha(Math.round(cVar.g * f2));
                                } else {
                                    paint4.setShader(null);
                                    paint4.setAlpha(255);
                                    int i7 = a91Var2.c;
                                    float f13 = cVar.g;
                                    PorterDuff.Mode mode2 = hfa.l;
                                    paint4.setColor((i7 & i4) | (((int) (Color.alpha(i7) * f13)) << 24));
                                }
                                paint4.setColorFilter(null);
                                paint4.setStrokeWidth(cVar.e * fMin * fAbs);
                                canvas.drawPath(path2, paint4);
                            }
                        }
                    }
                    i5 = i3 + 1;
                    c = 0;
                }
                i3 = i5;
                i5 = i3 + 1;
                c = 0;
            }
            canvas.restore();
        }

        public float getAlpha() {
            return getRootAlpha() / 255.0f;
        }

        public int getRootAlpha() {
            return this.l;
        }

        public void setAlpha(float f) {
            setRootAlpha((int) (f * 255.0f));
        }

        public void setRootAlpha(int i) {
            this.l = i;
        }

        public g(g gVar) {
            this.c = new Matrix();
            this.h = 0.0f;
            this.i = 0.0f;
            this.j = 0.0f;
            this.k = 0.0f;
            this.l = 255;
            this.m = null;
            this.n = null;
            ts tsVar = new ts(0);
            this.o = tsVar;
            this.g = new d(gVar.g, tsVar);
            this.a = new Path(gVar.a);
            this.b = new Path(gVar.b);
            this.h = gVar.h;
            this.i = gVar.i;
            this.j = gVar.j;
            this.k = gVar.k;
            this.l = gVar.l;
            this.m = gVar.m;
            String str = gVar.m;
            if (str != null) {
                tsVar.put(str, this);
            }
            this.n = gVar.n;
        }
    }
}
