package androidx.compose.ui.platform;

import android.graphics.Outline;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import s1.b1;

/* loaded from: classes.dex */
public final class c2 {

    /* renamed from: a, reason: collision with root package name */
    private boolean f2390a = true;

    /* renamed from: b, reason: collision with root package name */
    private final Outline f2391b;

    /* renamed from: c, reason: collision with root package name */
    private s1.b1 f2392c;

    /* renamed from: d, reason: collision with root package name */
    private s1.f1 f2393d;

    /* renamed from: e, reason: collision with root package name */
    private s1.f1 f2394e;

    /* renamed from: f, reason: collision with root package name */
    private boolean f2395f;

    /* renamed from: g, reason: collision with root package name */
    private boolean f2396g;

    /* renamed from: h, reason: collision with root package name */
    private s1.f1 f2397h;

    /* renamed from: i, reason: collision with root package name */
    private r1.k f2398i;

    /* renamed from: j, reason: collision with root package name */
    private float f2399j;

    /* renamed from: k, reason: collision with root package name */
    private long f2400k;

    /* renamed from: l, reason: collision with root package name */
    private long f2401l;

    /* renamed from: m, reason: collision with root package name */
    private boolean f2402m;

    /* renamed from: n, reason: collision with root package name */
    private s1.f1 f2403n;

    /* renamed from: o, reason: collision with root package name */
    private s1.f1 f2404o;

    public c2() {
        Outline outline = new Outline();
        outline.setAlpha(1.0f);
        this.f2391b = outline;
        this.f2400k = r1.g.f34318b.c();
        this.f2401l = r1.m.f34339b.b();
    }

    private final boolean g(r1.k kVar, long j10, long j11, float f10) {
        if (kVar == null || !r1.l.e(kVar)) {
            return false;
        }
        if (!(kVar.e() == r1.g.m(j10))) {
            return false;
        }
        if (!(kVar.g() == r1.g.n(j10))) {
            return false;
        }
        if (!(kVar.f() == r1.g.m(j10) + r1.m.i(j11))) {
            return false;
        }
        if (kVar.a() == r1.g.n(j10) + r1.m.g(j11)) {
            return (r1.a.d(kVar.h()) > f10 ? 1 : (r1.a.d(kVar.h()) == f10 ? 0 : -1)) == 0;
        }
        return false;
    }

    private final void i() {
        if (this.f2395f) {
            this.f2400k = r1.g.f34318b.c();
            this.f2399j = BitmapDescriptorFactory.HUE_RED;
            this.f2394e = null;
            this.f2395f = false;
            this.f2396g = false;
            s1.b1 b1Var = this.f2392c;
            if (b1Var == null || !this.f2402m || r1.m.i(this.f2401l) <= BitmapDescriptorFactory.HUE_RED || r1.m.g(this.f2401l) <= BitmapDescriptorFactory.HUE_RED) {
                this.f2391b.setEmpty();
                return;
            }
            this.f2390a = true;
            if (b1Var instanceof b1.b) {
                k(((b1.b) b1Var).b());
            } else if (b1Var instanceof b1.c) {
                l(((b1.c) b1Var).b());
            } else if (b1Var instanceof b1.a) {
                j(((b1.a) b1Var).b());
            }
        }
    }

    private final void j(s1.f1 f1Var) {
        Outline outline = this.f2391b;
        if (!(f1Var instanceof s1.m)) {
            throw new UnsupportedOperationException("Unable to obtain android.graphics.Path");
        }
        outline.setConvexPath(((s1.m) f1Var).t());
        this.f2396g = !this.f2391b.canClip();
        this.f2394e = f1Var;
    }

    private final void k(r1.i iVar) {
        this.f2400k = r1.h.a(iVar.i(), iVar.l());
        this.f2401l = r1.n.a(iVar.n(), iVar.h());
        this.f2391b.setRect(Math.round(iVar.i()), Math.round(iVar.l()), Math.round(iVar.j()), Math.round(iVar.e()));
    }

    private final void l(r1.k kVar) {
        float d10 = r1.a.d(kVar.h());
        this.f2400k = r1.h.a(kVar.e(), kVar.g());
        this.f2401l = r1.n.a(kVar.j(), kVar.d());
        if (r1.l.e(kVar)) {
            this.f2391b.setRoundRect(Math.round(kVar.e()), Math.round(kVar.g()), Math.round(kVar.f()), Math.round(kVar.a()), d10);
            this.f2399j = d10;
            return;
        }
        s1.f1 f1Var = this.f2393d;
        if (f1Var == null) {
            f1Var = s1.p.a();
            this.f2393d = f1Var;
        }
        f1Var.reset();
        s1.f1.g(f1Var, kVar, null, 2, null);
        j(f1Var);
    }

    public final void a(s1.a0 a0Var) {
        s1.f1 d10 = d();
        if (d10 != null) {
            s1.a0.w(a0Var, d10, 0, 2, null);
            return;
        }
        float f10 = this.f2399j;
        if (f10 <= BitmapDescriptorFactory.HUE_RED) {
            s1.a0.t(a0Var, r1.g.m(this.f2400k), r1.g.n(this.f2400k), r1.m.i(this.f2401l) + r1.g.m(this.f2400k), r1.m.g(this.f2401l) + r1.g.n(this.f2400k), 0, 16, null);
            return;
        }
        s1.f1 f1Var = this.f2397h;
        r1.k kVar = this.f2398i;
        if (f1Var == null || !g(kVar, this.f2400k, this.f2401l, f10)) {
            r1.k c10 = r1.l.c(r1.g.m(this.f2400k), r1.g.n(this.f2400k), r1.g.m(this.f2400k) + r1.m.i(this.f2401l), r1.g.n(this.f2400k) + r1.m.g(this.f2401l), r1.b.b(this.f2399j, BitmapDescriptorFactory.HUE_RED, 2, null));
            if (f1Var == null) {
                f1Var = s1.p.a();
            } else {
                f1Var.reset();
            }
            s1.f1.g(f1Var, c10, null, 2, null);
            this.f2398i = c10;
            this.f2397h = f1Var;
        }
        s1.a0.w(a0Var, f1Var, 0, 2, null);
    }

    public final Outline b() {
        i();
        if (this.f2402m && this.f2390a) {
            return this.f2391b;
        }
        return null;
    }

    public final boolean c() {
        return this.f2395f;
    }

    public final s1.f1 d() {
        i();
        return this.f2394e;
    }

    public final boolean e() {
        return !this.f2396g;
    }

    public final boolean f(long j10) {
        s1.b1 b1Var;
        if (this.f2402m && (b1Var = this.f2392c) != null) {
            return o2.b(b1Var, r1.g.m(j10), r1.g.n(j10), this.f2403n, this.f2404o);
        }
        return true;
    }

    public final boolean h(s1.b1 b1Var, float f10, boolean z10, float f11, long j10) {
        this.f2391b.setAlpha(f10);
        boolean z11 = !kotlin.jvm.internal.t.b(this.f2392c, b1Var);
        if (z11) {
            this.f2392c = b1Var;
            this.f2395f = true;
        }
        this.f2401l = j10;
        boolean z12 = b1Var != null && (z10 || f11 > BitmapDescriptorFactory.HUE_RED);
        if (this.f2402m != z12) {
            this.f2402m = z12;
            this.f2395f = true;
        }
        return z11;
    }
}
