package s0;

import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.ViewParent;
import h1.m;
import p.C2646H;
import p0.AbstractC2686D;
import p0.AbstractC2697c;
import p0.AbstractC2715v;
import p0.C2696b;
import p0.C2709o;
import p0.C2713t;
import p0.C2714u;
import p0.InterfaceC2712s;
import r0.C2863b;
import t0.AbstractC2943a;

/* JADX INFO: loaded from: classes.dex */
public final class i implements d {

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public static final h f24097C = new h();

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public float f24098A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public C2709o f24099B;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final AbstractC2943a f24100b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final C2713t f24101c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final l f24102d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final Resources f24103e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final Rect f24104f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public Paint f24105g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public int f24106h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public int f24107i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public long f24108j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public boolean f24109k;
    public boolean l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public boolean f24110m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public int f24111n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public int f24112o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public float f24113p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public boolean f24114q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public float f24115r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public float f24116s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public float f24117t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public float f24118u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public float f24119v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public long f24120w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public long f24121x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public float f24122y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public float f24123z;

    public i(AbstractC2943a abstractC2943a) {
        C2713t c2713t = new C2713t();
        C2863b c2863b = new C2863b();
        this.f24100b = abstractC2943a;
        this.f24101c = c2713t;
        l lVar = new l(abstractC2943a, c2713t, c2863b);
        this.f24102d = lVar;
        this.f24103e = abstractC2943a.getResources();
        this.f24104f = new Rect();
        abstractC2943a.addView(lVar);
        lVar.setClipBounds(null);
        this.f24108j = 0L;
        View.generateViewId();
        this.f24111n = 3;
        this.f24112o = 0;
        this.f24113p = 1.0f;
        this.f24115r = 1.0f;
        this.f24116s = 1.0f;
        long j4 = C2714u.f22935b;
        this.f24120w = j4;
        this.f24121x = j4;
    }

    @Override // s0.d
    public final float A() {
        return this.f24117t;
    }

    @Override // s0.d
    public final void B(boolean z6) {
        boolean z7 = false;
        this.f24110m = z6 && !this.l;
        this.f24109k = true;
        if (z6 && this.l) {
            z7 = true;
        }
        this.f24102d.setClipToOutline(z7);
    }

    @Override // s0.d
    public final float C() {
        return this.f24122y;
    }

    @Override // s0.d
    public final void D(int i6) {
        this.f24112o = i6;
        O();
    }

    @Override // s0.d
    public final void E(float f6) {
        this.f24117t = f6;
        this.f24102d.setTranslationX(f6);
    }

    @Override // s0.d
    public final void F(long j4) {
        if (Build.VERSION.SDK_INT >= 28) {
            this.f24121x = j4;
            this.f24102d.setOutlineSpotShadowColor(AbstractC2686D.I(j4));
        }
    }

    @Override // s0.d
    public final Matrix G() {
        return this.f24102d.getMatrix();
    }

    @Override // s0.d
    public final void H(C2709o c2709o) {
        this.f24099B = c2709o;
        if (Build.VERSION.SDK_INT >= 31) {
            this.f24102d.setRenderEffect(c2709o != null ? c2709o.a() : null);
        }
    }

    @Override // s0.d
    public final void I(float f6) {
        this.f24102d.setCameraDistance(f6 * this.f24103e.getDisplayMetrics().densityDpi);
    }

    @Override // s0.d
    public final float J() {
        return this.f24119v;
    }

    @Override // s0.d
    public final float K() {
        return this.f24116s;
    }

    @Override // s0.d
    public final void L(float f6) {
        this.f24122y = f6;
        this.f24102d.setRotationX(f6);
    }

    @Override // s0.d
    public final int M() {
        return this.f24111n;
    }

    public final void N(int i6) {
        l lVar = this.f24102d;
        boolean z6 = true;
        if (i6 == 1) {
            lVar.setLayerType(2, this.f24105g);
        } else if (i6 == 2) {
            lVar.setLayerType(0, this.f24105g);
            z6 = false;
        } else {
            lVar.setLayerType(0, this.f24105g);
        }
        lVar.setCanUseCompositingLayer$ui_graphics(z6);
    }

    public final void O() {
        int i6 = this.f24112o;
        if (i6 != 1 && this.f24111n == 3) {
            N(i6);
        } else {
            N(1);
        }
    }

    @Override // s0.d
    public final void a(float f6) {
        this.f24123z = f6;
        this.f24102d.setRotationY(f6);
    }

    @Override // s0.d
    public final float b() {
        return this.f24115r;
    }

    @Override // s0.d
    public final void c(float f6) {
        this.f24119v = f6;
        this.f24102d.setElevation(f6);
    }

    @Override // s0.d
    public final C2709o d() {
        return this.f24099B;
    }

    @Override // s0.d
    public final void e(float f6) {
        this.f24098A = f6;
        this.f24102d.setRotation(f6);
    }

    @Override // s0.d
    public final void f(float f6) {
        this.f24118u = f6;
        this.f24102d.setTranslationY(f6);
    }

    @Override // s0.d
    public final void g(Outline outline, long j4) {
        l lVar = this.f24102d;
        lVar.f24129e = outline;
        lVar.invalidateOutline();
        if ((this.f24110m || lVar.getClipToOutline()) && outline != null) {
            lVar.setClipToOutline(true);
            if (this.f24110m) {
                this.f24110m = false;
                this.f24109k = true;
            }
        }
        this.l = outline != null;
    }

    @Override // s0.d
    public final float getAlpha() {
        return this.f24113p;
    }

    @Override // s0.d
    public final AbstractC2715v getColorFilter() {
        return null;
    }

    @Override // s0.d
    public final void h(InterfaceC2712s interfaceC2712s) {
        Rect rect;
        boolean z6 = this.f24109k;
        l lVar = this.f24102d;
        if (z6) {
            if ((this.f24110m || lVar.getClipToOutline()) && !this.l) {
                rect = this.f24104f;
                rect.left = 0;
                rect.top = 0;
                rect.right = lVar.getWidth();
                rect.bottom = lVar.getHeight();
            } else {
                rect = null;
            }
            lVar.setClipBounds(rect);
        }
        if (AbstractC2697c.a(interfaceC2712s).isHardwareAccelerated()) {
            this.f24100b.a(interfaceC2712s, lVar, lVar.getDrawingTime());
        }
    }

    @Override // s0.d
    public final void i(int i6) {
        this.f24111n = i6;
        Paint paint = this.f24105g;
        if (paint == null) {
            paint = new Paint();
            this.f24105g = paint;
        }
        paint.setXfermode(new PorterDuffXfermode(AbstractC2686D.M(i6)));
        O();
    }

    @Override // s0.d
    public final void j() {
        this.f24100b.removeViewInLayout(this.f24102d);
    }

    @Override // s0.d
    public final int k() {
        return this.f24112o;
    }

    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$PrimitiveArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    @Override // s0.d
    public final void l(h1.c cVar, m mVar, b bVar, C2646H c2646h) {
        l lVar = this.f24102d;
        ViewParent parent = lVar.getParent();
        AbstractC2943a abstractC2943a = this.f24100b;
        if (parent == null) {
            abstractC2943a.addView(lVar);
        }
        lVar.f24131j = cVar;
        lVar.f24132k = mVar;
        lVar.l = c2646h;
        lVar.f24133m = bVar;
        if (lVar.isAttachedToWindow()) {
            lVar.setVisibility(4);
            lVar.setVisibility(0);
            try {
                C2713t c2713t = this.f24101c;
                h hVar = f24097C;
                C2696b c2696b = c2713t.f22934a;
                Canvas canvas = c2696b.f22900a;
                c2696b.f22900a = hVar;
                abstractC2943a.a(c2696b, lVar, lVar.getDrawingTime());
                c2713t.f22934a.f22900a = canvas;
            } catch (ClassCastException unused) {
            }
        }
    }

    @Override // s0.d
    public final void m(float f6) {
        this.f24116s = f6;
        this.f24102d.setScaleY(f6);
    }

    @Override // s0.d
    public final void n(int i6, int i7, long j4) {
        boolean zA = h1.l.a(this.f24108j, j4);
        l lVar = this.f24102d;
        if (zA) {
            int i8 = this.f24106h;
            if (i8 != i6) {
                lVar.offsetLeftAndRight(i6 - i8);
            }
            int i9 = this.f24107i;
            if (i9 != i7) {
                lVar.offsetTopAndBottom(i7 - i9);
            }
        } else {
            if (this.f24110m || lVar.getClipToOutline()) {
                this.f24109k = true;
            }
            int i10 = (int) (j4 >> 32);
            int i11 = (int) (4294967295L & j4);
            lVar.layout(i6, i7, i6 + i10, i7 + i11);
            this.f24108j = j4;
            if (this.f24114q) {
                lVar.setPivotX(i10 / 2.0f);
                lVar.setPivotY(i11 / 2.0f);
            }
        }
        this.f24106h = i6;
        this.f24107i = i7;
    }

    @Override // s0.d
    public final float o() {
        return this.f24123z;
    }

    @Override // s0.d
    public final float q() {
        return this.f24098A;
    }

    @Override // s0.d
    public final void r(long j4) {
        long j6 = 9223372034707292159L & j4;
        l lVar = this.f24102d;
        if (j6 != 9205357640488583168L) {
            this.f24114q = false;
            lVar.setPivotX(Float.intBitsToFloat((int) (j4 >> 32)));
            lVar.setPivotY(Float.intBitsToFloat((int) (j4 & 4294967295L)));
        } else {
            if (Build.VERSION.SDK_INT >= 28) {
                lVar.resetPivot();
                return;
            }
            this.f24114q = true;
            lVar.setPivotX(((int) (this.f24108j >> 32)) / 2.0f);
            lVar.setPivotY(((int) (this.f24108j & 4294967295L)) / 2.0f);
        }
    }

    @Override // s0.d
    public final long s() {
        return this.f24120w;
    }

    @Override // s0.d
    public final void t(float f6) {
        this.f24113p = f6;
        this.f24102d.setAlpha(f6);
    }

    @Override // s0.d
    public final float u() {
        return this.f24118u;
    }

    @Override // s0.d
    public final long v() {
        return this.f24121x;
    }

    @Override // s0.d
    public final void w(long j4) {
        if (Build.VERSION.SDK_INT >= 28) {
            this.f24120w = j4;
            this.f24102d.setOutlineAmbientShadowColor(AbstractC2686D.I(j4));
        }
    }

    @Override // s0.d
    public final void x() {
        Paint paint = this.f24105g;
        if (paint == null) {
            paint = new Paint();
            this.f24105g = paint;
        }
        paint.setColorFilter(null);
        O();
    }

    @Override // s0.d
    public final void y(float f6) {
        this.f24115r = f6;
        this.f24102d.setScaleX(f6);
    }

    @Override // s0.d
    public final float z() {
        return this.f24102d.getCameraDistance() / this.f24103e.getDisplayMetrics().densityDpi;
    }
}
