package com.google.android.material.internal;

import android.animation.TimeInterpolator;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.os.Build;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import androidx.core.view.s0;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.material.internal.k;
import ij.a;

/* loaded from: classes3.dex */
public final class b {

    /* renamed from: t0, reason: collision with root package name */
    private static final boolean f13300t0 = false;

    /* renamed from: u0, reason: collision with root package name */
    private static final Paint f13301u0 = null;
    private Typeface A;
    private Typeface B;
    private Typeface C;
    private Typeface D;
    private ij.a E;
    private ij.a F;
    private CharSequence G;
    private CharSequence H;
    private boolean I;
    private boolean K;
    private Bitmap L;
    private Paint M;
    private float N;
    private float O;
    private float P;
    private float Q;
    private float R;
    private int S;
    private int[] T;
    private boolean U;
    private final TextPaint V;
    private final TextPaint W;
    private TimeInterpolator X;
    private TimeInterpolator Y;
    private float Z;

    /* renamed from: a, reason: collision with root package name */
    private final View f13302a;

    /* renamed from: a0, reason: collision with root package name */
    private float f13303a0;

    /* renamed from: b, reason: collision with root package name */
    private boolean f13304b;

    /* renamed from: b0, reason: collision with root package name */
    private float f13305b0;

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

    /* renamed from: c0, reason: collision with root package name */
    private ColorStateList f13307c0;

    /* renamed from: d, reason: collision with root package name */
    private boolean f13308d;

    /* renamed from: d0, reason: collision with root package name */
    private float f13309d0;

    /* renamed from: e, reason: collision with root package name */
    private float f13310e;

    /* renamed from: e0, reason: collision with root package name */
    private float f13311e0;

    /* renamed from: f, reason: collision with root package name */
    private float f13312f;

    /* renamed from: f0, reason: collision with root package name */
    private float f13313f0;

    /* renamed from: g, reason: collision with root package name */
    private int f13314g;

    /* renamed from: g0, reason: collision with root package name */
    private ColorStateList f13315g0;

    /* renamed from: h, reason: collision with root package name */
    private final Rect f13316h;

    /* renamed from: h0, reason: collision with root package name */
    private float f13317h0;

    /* renamed from: i, reason: collision with root package name */
    private final Rect f13318i;

    /* renamed from: i0, reason: collision with root package name */
    private float f13319i0;

    /* renamed from: j, reason: collision with root package name */
    private final RectF f13320j;

    /* renamed from: j0, reason: collision with root package name */
    private float f13321j0;

    /* renamed from: k0, reason: collision with root package name */
    private StaticLayout f13323k0;

    /* renamed from: l0, reason: collision with root package name */
    private float f13325l0;

    /* renamed from: m0, reason: collision with root package name */
    private float f13327m0;

    /* renamed from: n0, reason: collision with root package name */
    private float f13329n0;

    /* renamed from: o, reason: collision with root package name */
    private ColorStateList f13330o;

    /* renamed from: o0, reason: collision with root package name */
    private CharSequence f13331o0;

    /* renamed from: p, reason: collision with root package name */
    private ColorStateList f13332p;

    /* renamed from: q, reason: collision with root package name */
    private int f13334q;

    /* renamed from: r, reason: collision with root package name */
    private float f13336r;

    /* renamed from: s, reason: collision with root package name */
    private float f13338s;

    /* renamed from: t, reason: collision with root package name */
    private float f13340t;

    /* renamed from: u, reason: collision with root package name */
    private float f13341u;

    /* renamed from: v, reason: collision with root package name */
    private float f13342v;

    /* renamed from: w, reason: collision with root package name */
    private float f13343w;

    /* renamed from: x, reason: collision with root package name */
    private Typeface f13344x;

    /* renamed from: y, reason: collision with root package name */
    private Typeface f13345y;

    /* renamed from: z, reason: collision with root package name */
    private Typeface f13346z;

    /* renamed from: k, reason: collision with root package name */
    private int f13322k = 16;

    /* renamed from: l, reason: collision with root package name */
    private int f13324l = 16;

    /* renamed from: m, reason: collision with root package name */
    private float f13326m = 15.0f;

    /* renamed from: n, reason: collision with root package name */
    private float f13328n = 15.0f;
    private boolean J = true;

    /* renamed from: p0, reason: collision with root package name */
    private int f13333p0 = 1;

    /* renamed from: q0, reason: collision with root package name */
    private float f13335q0 = BitmapDescriptorFactory.HUE_RED;

    /* renamed from: r0, reason: collision with root package name */
    private float f13337r0 = 1.0f;

    /* renamed from: s0, reason: collision with root package name */
    private int f13339s0 = k.f13362n;

    /* loaded from: classes3.dex */
    class a implements a.InterfaceC0494a {
        a() {
        }

        @Override // ij.a.InterfaceC0494a
        public void a(Typeface typeface) {
            b.this.h0(typeface);
        }
    }

    /* renamed from: com.google.android.material.internal.b$b, reason: collision with other inner class name */
    /* loaded from: classes3.dex */
    class C0310b implements a.InterfaceC0494a {
        C0310b() {
        }

        @Override // ij.a.InterfaceC0494a
        public void a(Typeface typeface) {
            b.this.s0(typeface);
        }
    }

    public b(View view) {
        this.f13302a = view;
        TextPaint textPaint = new TextPaint(129);
        this.V = textPaint;
        this.W = new TextPaint(textPaint);
        this.f13318i = new Rect();
        this.f13316h = new Rect();
        this.f13320j = new RectF();
        this.f13312f = e();
        V(view.getContext().getResources().getConfiguration());
    }

    private boolean I0() {
        return this.f13333p0 > 1 && (!this.I || this.f13308d) && !this.K;
    }

    private Layout.Alignment K() {
        int b10 = androidx.core.view.r.b(this.f13322k, this.I ? 1 : 0) & 7;
        return b10 != 1 ? b10 != 5 ? this.I ? Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_NORMAL : this.I ? Layout.Alignment.ALIGN_NORMAL : Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_CENTER;
    }

    private void N(TextPaint textPaint) {
        textPaint.setTextSize(this.f13328n);
        textPaint.setTypeface(this.f13344x);
        textPaint.setLetterSpacing(this.f13317h0);
    }

    private void O(TextPaint textPaint) {
        textPaint.setTextSize(this.f13326m);
        textPaint.setTypeface(this.A);
        textPaint.setLetterSpacing(this.f13319i0);
    }

    private void P(float f10) {
        if (this.f13308d) {
            this.f13320j.set(f10 < this.f13312f ? this.f13316h : this.f13318i);
            return;
        }
        this.f13320j.left = U(this.f13316h.left, this.f13318i.left, f10, this.X);
        this.f13320j.top = U(this.f13336r, this.f13338s, f10, this.X);
        this.f13320j.right = U(this.f13316h.right, this.f13318i.right, f10, this.X);
        this.f13320j.bottom = U(this.f13316h.bottom, this.f13318i.bottom, f10, this.X);
    }

    private static boolean Q(float f10, float f11) {
        return Math.abs(f10 - f11) < 1.0E-5f;
    }

    private boolean R() {
        return s0.z(this.f13302a) == 1;
    }

    private boolean T(CharSequence charSequence, boolean z10) {
        return (z10 ? androidx.core.text.f.f3795d : androidx.core.text.f.f3794c).a(charSequence, 0, charSequence.length());
    }

    private static float U(float f10, float f11, float f12, TimeInterpolator timeInterpolator) {
        if (timeInterpolator != null) {
            f12 = timeInterpolator.getInterpolation(f12);
        }
        return wi.a.a(f10, f11, f12);
    }

    private float W(TextPaint textPaint, CharSequence charSequence) {
        return textPaint.measureText(charSequence, 0, charSequence.length());
    }

    private static int a(int i10, int i11, float f10) {
        float f11 = 1.0f - f10;
        return Color.argb(Math.round((Color.alpha(i10) * f11) + (Color.alpha(i11) * f10)), Math.round((Color.red(i10) * f11) + (Color.red(i11) * f10)), Math.round((Color.green(i10) * f11) + (Color.green(i11) * f10)), Math.round((Color.blue(i10) * f11) + (Color.blue(i11) * f10)));
    }

    private static boolean a0(Rect rect, int i10, int i11, int i12, int i13) {
        return rect.left == i10 && rect.top == i11 && rect.right == i12 && rect.bottom == i13;
    }

    private void b(boolean z10) {
        StaticLayout staticLayout;
        i(1.0f, z10);
        CharSequence charSequence = this.H;
        if (charSequence != null && (staticLayout = this.f13323k0) != null) {
            this.f13331o0 = TextUtils.ellipsize(charSequence, this.V, staticLayout.getWidth(), TextUtils.TruncateAt.END);
        }
        CharSequence charSequence2 = this.f13331o0;
        float f10 = BitmapDescriptorFactory.HUE_RED;
        if (charSequence2 != null) {
            this.f13325l0 = W(this.V, charSequence2);
        } else {
            this.f13325l0 = BitmapDescriptorFactory.HUE_RED;
        }
        int b10 = androidx.core.view.r.b(this.f13324l, this.I ? 1 : 0);
        int i10 = b10 & 112;
        if (i10 == 48) {
            this.f13338s = this.f13318i.top;
        } else if (i10 != 80) {
            this.f13338s = this.f13318i.centerY() - ((this.V.descent() - this.V.ascent()) / 2.0f);
        } else {
            this.f13338s = this.f13318i.bottom + this.V.ascent();
        }
        int i11 = b10 & 8388615;
        if (i11 == 1) {
            this.f13341u = this.f13318i.centerX() - (this.f13325l0 / 2.0f);
        } else if (i11 != 5) {
            this.f13341u = this.f13318i.left;
        } else {
            this.f13341u = this.f13318i.right - this.f13325l0;
        }
        i(BitmapDescriptorFactory.HUE_RED, z10);
        float height = this.f13323k0 != null ? r10.getHeight() : 0.0f;
        StaticLayout staticLayout2 = this.f13323k0;
        if (staticLayout2 == null || this.f13333p0 <= 1) {
            CharSequence charSequence3 = this.H;
            if (charSequence3 != null) {
                f10 = W(this.V, charSequence3);
            }
        } else {
            f10 = staticLayout2.getWidth();
        }
        StaticLayout staticLayout3 = this.f13323k0;
        this.f13334q = staticLayout3 != null ? staticLayout3.getLineCount() : 0;
        int b11 = androidx.core.view.r.b(this.f13322k, this.I ? 1 : 0);
        int i12 = b11 & 112;
        if (i12 == 48) {
            this.f13336r = this.f13316h.top;
        } else if (i12 != 80) {
            this.f13336r = this.f13316h.centerY() - (height / 2.0f);
        } else {
            this.f13336r = (this.f13316h.bottom - height) + this.V.descent();
        }
        int i13 = b11 & 8388615;
        if (i13 == 1) {
            this.f13340t = this.f13316h.centerX() - (f10 / 2.0f);
        } else if (i13 != 5) {
            this.f13340t = this.f13316h.left;
        } else {
            this.f13340t = this.f13316h.right - f10;
        }
        j();
        y0(this.f13306c);
    }

    private void c() {
        g(this.f13306c);
    }

    private float d(float f10) {
        float f11 = this.f13312f;
        return f10 <= f11 ? wi.a.b(1.0f, BitmapDescriptorFactory.HUE_RED, this.f13310e, f11, f10) : wi.a.b(BitmapDescriptorFactory.HUE_RED, 1.0f, f11, 1.0f, f10);
    }

    private float e() {
        float f10 = this.f13310e;
        return f10 + ((1.0f - f10) * 0.5f);
    }

    private void e0(float f10) {
        this.f13327m0 = f10;
        s0.d0(this.f13302a);
    }

    private boolean f(CharSequence charSequence) {
        boolean R = R();
        return this.J ? T(charSequence, R) : R;
    }

    private void g(float f10) {
        float f11;
        P(f10);
        if (!this.f13308d) {
            this.f13342v = U(this.f13340t, this.f13341u, f10, this.X);
            this.f13343w = U(this.f13336r, this.f13338s, f10, this.X);
            y0(f10);
            f11 = f10;
        } else if (f10 < this.f13312f) {
            this.f13342v = this.f13340t;
            this.f13343w = this.f13336r;
            y0(BitmapDescriptorFactory.HUE_RED);
            f11 = 0.0f;
        } else {
            this.f13342v = this.f13341u;
            this.f13343w = this.f13338s - Math.max(0, this.f13314g);
            y0(1.0f);
            f11 = 1.0f;
        }
        TimeInterpolator timeInterpolator = wi.a.f49478b;
        e0(1.0f - U(BitmapDescriptorFactory.HUE_RED, 1.0f, 1.0f - f10, timeInterpolator));
        o0(U(1.0f, BitmapDescriptorFactory.HUE_RED, f10, timeInterpolator));
        if (this.f13332p != this.f13330o) {
            this.V.setColor(a(x(), v(), f11));
        } else {
            this.V.setColor(v());
        }
        float f12 = this.f13317h0;
        float f13 = this.f13319i0;
        if (f12 != f13) {
            this.V.setLetterSpacing(U(f13, f12, f10, timeInterpolator));
        } else {
            this.V.setLetterSpacing(f12);
        }
        this.P = U(this.f13309d0, this.Z, f10, null);
        this.Q = U(this.f13311e0, this.f13303a0, f10, null);
        this.R = U(this.f13313f0, this.f13305b0, f10, null);
        int a10 = a(w(this.f13315g0), w(this.f13307c0), f10);
        this.S = a10;
        this.V.setShadowLayer(this.P, this.Q, this.R, a10);
        if (this.f13308d) {
            this.V.setAlpha((int) (d(f10) * this.V.getAlpha()));
        }
        s0.d0(this.f13302a);
    }

    private void h(float f10) {
        i(f10, false);
    }

    private void i(float f10, boolean z10) {
        boolean z11;
        float f11;
        float f12;
        boolean z12;
        if (this.G == null) {
            return;
        }
        float width = this.f13318i.width();
        float width2 = this.f13316h.width();
        if (Q(f10, 1.0f)) {
            f11 = this.f13328n;
            f12 = this.f13317h0;
            this.N = 1.0f;
            Typeface typeface = this.D;
            Typeface typeface2 = this.f13344x;
            if (typeface != typeface2) {
                this.D = typeface2;
                z12 = true;
            } else {
                z12 = false;
            }
        } else {
            float f13 = this.f13326m;
            float f14 = this.f13319i0;
            Typeface typeface3 = this.D;
            Typeface typeface4 = this.A;
            if (typeface3 != typeface4) {
                this.D = typeface4;
                z11 = true;
            } else {
                z11 = false;
            }
            if (Q(f10, BitmapDescriptorFactory.HUE_RED)) {
                this.N = 1.0f;
            } else {
                this.N = U(this.f13326m, this.f13328n, f10, this.Y) / this.f13326m;
            }
            float f15 = this.f13328n / this.f13326m;
            width = (!z10 && width2 * f15 > width) ? Math.min(width / f15, width2) : width2;
            f11 = f13;
            f12 = f14;
            z12 = z11;
        }
        if (width > BitmapDescriptorFactory.HUE_RED) {
            z12 = ((this.O > f11 ? 1 : (this.O == f11 ? 0 : -1)) != 0) || ((this.f13321j0 > f12 ? 1 : (this.f13321j0 == f12 ? 0 : -1)) != 0) || this.U || z12;
            this.O = f11;
            this.f13321j0 = f12;
            this.U = false;
        }
        if (this.H == null || z12) {
            this.V.setTextSize(this.O);
            this.V.setTypeface(this.D);
            this.V.setLetterSpacing(this.f13321j0);
            this.V.setLinearText(this.N != 1.0f);
            this.I = f(this.G);
            StaticLayout k10 = k(I0() ? this.f13333p0 : 1, width, this.I);
            this.f13323k0 = k10;
            this.H = k10.getText();
        }
    }

    private boolean i0(Typeface typeface) {
        ij.a aVar = this.F;
        if (aVar != null) {
            aVar.c();
        }
        if (this.f13346z == typeface) {
            return false;
        }
        this.f13346z = typeface;
        Typeface b10 = ij.g.b(this.f13302a.getContext().getResources().getConfiguration(), typeface);
        this.f13345y = b10;
        if (b10 == null) {
            b10 = this.f13346z;
        }
        this.f13344x = b10;
        return true;
    }

    private void j() {
        Bitmap bitmap = this.L;
        if (bitmap != null) {
            bitmap.recycle();
            this.L = null;
        }
    }

    private StaticLayout k(int i10, float f10, boolean z10) {
        StaticLayout staticLayout;
        try {
            staticLayout = k.b(this.G, this.V, (int) f10).d(TextUtils.TruncateAt.END).g(z10).c(i10 == 1 ? Layout.Alignment.ALIGN_NORMAL : K()).f(false).i(i10).h(this.f13335q0, this.f13337r0).e(this.f13339s0).a();
        } catch (k.a e10) {
            Log.e("CollapsingTextHelper", e10.getCause().getMessage(), e10);
            staticLayout = null;
        }
        return (StaticLayout) s3.i.g(staticLayout);
    }

    private void m(Canvas canvas, float f10, float f11) {
        int alpha = this.V.getAlpha();
        canvas.translate(f10, f11);
        float f12 = alpha;
        this.V.setAlpha((int) (this.f13329n0 * f12));
        int i10 = Build.VERSION.SDK_INT;
        if (i10 >= 31) {
            TextPaint textPaint = this.V;
            textPaint.setShadowLayer(this.P, this.Q, this.R, aj.a.a(this.S, textPaint.getAlpha()));
        }
        this.f13323k0.draw(canvas);
        this.V.setAlpha((int) (this.f13327m0 * f12));
        if (i10 >= 31) {
            TextPaint textPaint2 = this.V;
            textPaint2.setShadowLayer(this.P, this.Q, this.R, aj.a.a(this.S, textPaint2.getAlpha()));
        }
        int lineBaseline = this.f13323k0.getLineBaseline(0);
        CharSequence charSequence = this.f13331o0;
        float f13 = lineBaseline;
        canvas.drawText(charSequence, 0, charSequence.length(), BitmapDescriptorFactory.HUE_RED, f13, this.V);
        if (i10 >= 31) {
            this.V.setShadowLayer(this.P, this.Q, this.R, this.S);
        }
        if (this.f13308d) {
            return;
        }
        String trim = this.f13331o0.toString().trim();
        if (trim.endsWith("…")) {
            trim = trim.substring(0, trim.length() - 1);
        }
        String str = trim;
        this.V.setAlpha(alpha);
        canvas.drawText(str, 0, Math.min(this.f13323k0.getLineEnd(0), str.length()), BitmapDescriptorFactory.HUE_RED, f13, (Paint) this.V);
    }

    private void n() {
        if (this.L != null || this.f13316h.isEmpty() || TextUtils.isEmpty(this.H)) {
            return;
        }
        g(BitmapDescriptorFactory.HUE_RED);
        int width = this.f13323k0.getWidth();
        int height = this.f13323k0.getHeight();
        if (width <= 0 || height <= 0) {
            return;
        }
        this.L = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        this.f13323k0.draw(new Canvas(this.L));
        if (this.M == null) {
            this.M = new Paint(3);
        }
    }

    private void o0(float f10) {
        this.f13329n0 = f10;
        s0.d0(this.f13302a);
    }

    private float s(int i10, int i11) {
        return (i11 == 17 || (i11 & 7) == 1) ? (i10 / 2.0f) - (this.f13325l0 / 2.0f) : ((i11 & 8388613) == 8388613 || (i11 & 5) == 5) ? this.I ? this.f13318i.left : this.f13318i.right - this.f13325l0 : this.I ? this.f13318i.right - this.f13325l0 : this.f13318i.left;
    }

    private float t(RectF rectF, int i10, int i11) {
        if (i11 == 17 || (i11 & 7) == 1) {
            return (i10 / 2.0f) + (this.f13325l0 / 2.0f);
        }
        if ((i11 & 8388613) == 8388613 || (i11 & 5) == 5) {
            return this.I ? rectF.left + this.f13325l0 : this.f13318i.right;
        }
        if (this.I) {
            return this.f13318i.right;
        }
        return this.f13325l0 + rectF.left;
    }

    private boolean t0(Typeface typeface) {
        ij.a aVar = this.E;
        if (aVar != null) {
            aVar.c();
        }
        if (this.C == typeface) {
            return false;
        }
        this.C = typeface;
        Typeface b10 = ij.g.b(this.f13302a.getContext().getResources().getConfiguration(), typeface);
        this.B = b10;
        if (b10 == null) {
            b10 = this.C;
        }
        this.A = b10;
        return true;
    }

    private int w(ColorStateList colorStateList) {
        if (colorStateList == null) {
            return 0;
        }
        int[] iArr = this.T;
        return iArr != null ? colorStateList.getColorForState(iArr, 0) : colorStateList.getDefaultColor();
    }

    private int x() {
        return w(this.f13330o);
    }

    private void y0(float f10) {
        h(f10);
        boolean z10 = f13300t0 && this.N != 1.0f;
        this.K = z10;
        if (z10) {
            n();
        }
        s0.d0(this.f13302a);
    }

    public int A() {
        return this.f13322k;
    }

    public void A0(float f10) {
        this.f13337r0 = f10;
    }

    public float B() {
        O(this.W);
        return -this.W.ascent();
    }

    public void B0(int i10) {
        if (i10 != this.f13333p0) {
            this.f13333p0 = i10;
            j();
            Y();
        }
    }

    public Typeface C() {
        Typeface typeface = this.A;
        return typeface != null ? typeface : Typeface.DEFAULT;
    }

    public void C0(TimeInterpolator timeInterpolator) {
        this.X = timeInterpolator;
        Y();
    }

    public float D() {
        return this.f13306c;
    }

    public void D0(boolean z10) {
        this.J = z10;
    }

    public float E() {
        return this.f13312f;
    }

    public final boolean E0(int[] iArr) {
        this.T = iArr;
        if (!S()) {
            return false;
        }
        Y();
        return true;
    }

    public int F() {
        return this.f13339s0;
    }

    public void F0(CharSequence charSequence) {
        if (charSequence == null || !TextUtils.equals(this.G, charSequence)) {
            this.G = charSequence;
            this.H = null;
            j();
            Y();
        }
    }

    public int G() {
        StaticLayout staticLayout = this.f13323k0;
        if (staticLayout != null) {
            return staticLayout.getLineCount();
        }
        return 0;
    }

    public void G0(TimeInterpolator timeInterpolator) {
        this.Y = timeInterpolator;
        Y();
    }

    public float H() {
        return this.f13323k0.getSpacingAdd();
    }

    public void H0(Typeface typeface) {
        boolean i02 = i0(typeface);
        boolean t02 = t0(typeface);
        if (i02 || t02) {
            Y();
        }
    }

    public float I() {
        return this.f13323k0.getSpacingMultiplier();
    }

    public int J() {
        return this.f13333p0;
    }

    public TimeInterpolator L() {
        return this.X;
    }

    public CharSequence M() {
        return this.G;
    }

    public final boolean S() {
        ColorStateList colorStateList;
        ColorStateList colorStateList2 = this.f13332p;
        return (colorStateList2 != null && colorStateList2.isStateful()) || ((colorStateList = this.f13330o) != null && colorStateList.isStateful());
    }

    public void V(Configuration configuration) {
        if (Build.VERSION.SDK_INT >= 31) {
            Typeface typeface = this.f13346z;
            if (typeface != null) {
                this.f13345y = ij.g.b(configuration, typeface);
            }
            Typeface typeface2 = this.C;
            if (typeface2 != null) {
                this.B = ij.g.b(configuration, typeface2);
            }
            Typeface typeface3 = this.f13345y;
            if (typeface3 == null) {
                typeface3 = this.f13346z;
            }
            this.f13344x = typeface3;
            Typeface typeface4 = this.B;
            if (typeface4 == null) {
                typeface4 = this.C;
            }
            this.A = typeface4;
            Z(true);
        }
    }

    void X() {
        this.f13304b = this.f13318i.width() > 0 && this.f13318i.height() > 0 && this.f13316h.width() > 0 && this.f13316h.height() > 0;
    }

    public void Y() {
        Z(false);
    }

    public void Z(boolean z10) {
        if ((this.f13302a.getHeight() <= 0 || this.f13302a.getWidth() <= 0) && !z10) {
            return;
        }
        b(z10);
        c();
    }

    public void b0(int i10, int i11, int i12, int i13) {
        if (a0(this.f13318i, i10, i11, i12, i13)) {
            return;
        }
        this.f13318i.set(i10, i11, i12, i13);
        this.U = true;
        X();
    }

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

    public void d0(int i10) {
        ij.d dVar = new ij.d(this.f13302a.getContext(), i10);
        if (dVar.i() != null) {
            this.f13332p = dVar.i();
        }
        if (dVar.j() != BitmapDescriptorFactory.HUE_RED) {
            this.f13328n = dVar.j();
        }
        ColorStateList colorStateList = dVar.f23323c;
        if (colorStateList != null) {
            this.f13307c0 = colorStateList;
        }
        this.f13303a0 = dVar.f23328h;
        this.f13305b0 = dVar.f23329i;
        this.Z = dVar.f23330j;
        this.f13317h0 = dVar.f23332l;
        ij.a aVar = this.F;
        if (aVar != null) {
            aVar.c();
        }
        this.F = new ij.a(new a(), dVar.e());
        dVar.h(this.f13302a.getContext(), this.F);
        Y();
    }

    public void f0(ColorStateList colorStateList) {
        if (this.f13332p != colorStateList) {
            this.f13332p = colorStateList;
            Y();
        }
    }

    public void g0(int i10) {
        if (this.f13324l != i10) {
            this.f13324l = i10;
            Y();
        }
    }

    public void h0(Typeface typeface) {
        if (i0(typeface)) {
            Y();
        }
    }

    public void j0(int i10) {
        this.f13314g = i10;
    }

    public void k0(int i10, int i11, int i12, int i13) {
        if (a0(this.f13316h, i10, i11, i12, i13)) {
            return;
        }
        this.f13316h.set(i10, i11, i12, i13);
        this.U = true;
        X();
    }

    public void l(Canvas canvas) {
        int save = canvas.save();
        if (this.H == null || !this.f13304b) {
            return;
        }
        this.V.setTextSize(this.O);
        float f10 = this.f13342v;
        float f11 = this.f13343w;
        boolean z10 = this.K && this.L != null;
        float f12 = this.N;
        if (f12 != 1.0f && !this.f13308d) {
            canvas.scale(f12, f12, f10, f11);
        }
        if (z10) {
            canvas.drawBitmap(this.L, f10, f11, this.M);
            canvas.restoreToCount(save);
            return;
        }
        if (!I0() || (this.f13308d && this.f13306c <= this.f13312f)) {
            canvas.translate(f10, f11);
            this.f13323k0.draw(canvas);
        } else {
            m(canvas, this.f13342v - this.f13323k0.getLineStart(0), f11);
        }
        canvas.restoreToCount(save);
    }

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

    public void m0(float f10) {
        if (this.f13319i0 != f10) {
            this.f13319i0 = f10;
            Y();
        }
    }

    public void n0(int i10) {
        ij.d dVar = new ij.d(this.f13302a.getContext(), i10);
        if (dVar.i() != null) {
            this.f13330o = dVar.i();
        }
        if (dVar.j() != BitmapDescriptorFactory.HUE_RED) {
            this.f13326m = dVar.j();
        }
        ColorStateList colorStateList = dVar.f23323c;
        if (colorStateList != null) {
            this.f13315g0 = colorStateList;
        }
        this.f13311e0 = dVar.f23328h;
        this.f13313f0 = dVar.f23329i;
        this.f13309d0 = dVar.f23330j;
        this.f13319i0 = dVar.f23332l;
        ij.a aVar = this.E;
        if (aVar != null) {
            aVar.c();
        }
        this.E = new ij.a(new C0310b(), dVar.e());
        dVar.h(this.f13302a.getContext(), this.E);
        Y();
    }

    public void o(RectF rectF, int i10, int i11) {
        this.I = f(this.G);
        rectF.left = s(i10, i11);
        rectF.top = this.f13318i.top;
        rectF.right = t(rectF, i10, i11);
        rectF.bottom = this.f13318i.top + r();
    }

    public ColorStateList p() {
        return this.f13332p;
    }

    public void p0(ColorStateList colorStateList) {
        if (this.f13330o != colorStateList) {
            this.f13330o = colorStateList;
            Y();
        }
    }

    public int q() {
        return this.f13324l;
    }

    public void q0(int i10) {
        if (this.f13322k != i10) {
            this.f13322k = i10;
            Y();
        }
    }

    public float r() {
        N(this.W);
        return -this.W.ascent();
    }

    public void r0(float f10) {
        if (this.f13326m != f10) {
            this.f13326m = f10;
            Y();
        }
    }

    public void s0(Typeface typeface) {
        if (t0(typeface)) {
            Y();
        }
    }

    public Typeface u() {
        Typeface typeface = this.f13344x;
        return typeface != null ? typeface : Typeface.DEFAULT;
    }

    public void u0(float f10) {
        float a10 = o3.a.a(f10, BitmapDescriptorFactory.HUE_RED, 1.0f);
        if (a10 != this.f13306c) {
            this.f13306c = a10;
            c();
        }
    }

    public int v() {
        return w(this.f13332p);
    }

    public void v0(boolean z10) {
        this.f13308d = z10;
    }

    public void w0(float f10) {
        this.f13310e = f10;
        this.f13312f = e();
    }

    public void x0(int i10) {
        this.f13339s0 = i10;
    }

    public int y() {
        return this.f13334q;
    }

    public float z() {
        O(this.W);
        return (-this.W.ascent()) + this.W.descent();
    }

    public void z0(float f10) {
        this.f13335q0 = f10;
    }
}
