package X0;

import android.content.Context;
import android.graphics.Typeface;
import android.os.Build;

/* JADX INFO: renamed from: X0.h, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0795h implements InterfaceC0790c, N, O {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final C0795h f8486b = new C0795h(0);

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final C0795h f8487c = new C0795h(1);

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f8488a;

    public /* synthetic */ C0795h(int i6) {
        this.f8488a = i6;
    }

    public static Typeface f(String str, I i6, int i7) {
        if (i7 == 0 && kotlin.jvm.internal.o.c(i6, I.f8446k) && (str == null || str.length() == 0)) {
            return Typeface.DEFAULT;
        }
        return Typeface.create(str == null ? Typeface.DEFAULT : Typeface.create(str, 0), i6.f8452a, i7 == 1);
    }

    public static Typeface g(String str, I i6, int i7) {
        if (i7 == 0 && kotlin.jvm.internal.o.c(i6, I.f8446k) && (str == null || str.length() == 0)) {
            return Typeface.DEFAULT;
        }
        int iR = W0.e.r(i6, i7);
        return (str == null || str.length() == 0) ? Typeface.defaultFromStyle(iR) : Typeface.create(str, iR);
    }

    public static Typeface h(String str, I i6, int i7) {
        if (str.length() != 0) {
            Typeface typefaceG = g(str, i6, i7);
            if (!kotlin.jvm.internal.o.c(typefaceG, Typeface.create(Typeface.DEFAULT, W0.e.r(i6, i7))) && !kotlin.jvm.internal.o.c(typefaceG, g(null, i6, i7))) {
                return typefaceG;
            }
        }
        return null;
    }

    /* JADX WARN: Removed duplicated region for block: B:33:0x0085  */
    @Override // X0.O
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public Typeface a(String str, I i6, int i7, H h5, Context context) {
        Typeface typefaceF;
        switch (this.f8488a) {
            case 3:
                if (str.equals(androidx.media3.common.C.SANS_SERIF_NAME)) {
                    typefaceF = f(androidx.media3.common.C.SANS_SERIF_NAME, i6, i7);
                } else if (str.equals(androidx.media3.common.C.SERIF_NAME)) {
                    typefaceF = f(androidx.media3.common.C.SERIF_NAME, i6, i7);
                } else if (str.equals("monospace")) {
                    typefaceF = f("monospace", i6, i7);
                } else if (str.equals("cursive")) {
                    typefaceF = f("cursive", i6, i7);
                } else if (str.length() == 0) {
                    typefaceF = null;
                } else {
                    typefaceF = f(str, i6, i7);
                    if (kotlin.jvm.internal.o.c(typefaceF, Typeface.create(Typeface.DEFAULT, i6.f8452a, i7 == 1)) || kotlin.jvm.internal.o.c(typefaceF, f(null, i6, i7))) {
                    }
                }
                return W.c.U(typefaceF, h5, context);
            default:
                return W.c.U(str.equals(androidx.media3.common.C.SANS_SERIF_NAME) ? e(AbstractC0808v.f8523b, i6, i7) : str.equals(androidx.media3.common.C.SERIF_NAME) ? e(AbstractC0808v.f8524c, i6, i7) : str.equals("monospace") ? e(AbstractC0808v.f8525d, i6, i7) : str.equals("cursive") ? e(AbstractC0808v.f8526e, i6, i7) : h(str, i6, i7), h5, context);
        }
    }

    @Override // X0.InterfaceC0790c
    public Object b(Context context, AbstractC0791d abstractC0791d, C0792e c0792e) {
        switch (this.f8488a) {
            case 0:
                throw new UnsupportedOperationException("All preloaded fonts are blocking.");
            default:
                throw new UnsupportedOperationException("All preloaded fonts are optional local.");
        }
    }

    @Override // X0.O
    public Typeface c(I i6, int i7) {
        switch (this.f8488a) {
            case 3:
                return f(null, i6, i7);
            default:
                return g(null, i6, i7);
        }
    }

    @Override // X0.InterfaceC0790c
    public Typeface d(Context context, AbstractC0791d abstractC0791d) {
        switch (this.f8488a) {
            case 0:
                AbstractC0794g abstractC0794g = abstractC0791d instanceof AbstractC0794g ? (AbstractC0794g) abstractC0791d : null;
                if (abstractC0794g == null) {
                    return null;
                }
                if (!abstractC0794g.f8484f && abstractC0794g.f8485g == null) {
                    abstractC0794g.f8485g = abstractC0794g.d(context);
                }
                abstractC0794g.f8484f = true;
                return abstractC0794g.f8485g;
            default:
                r rVar = abstractC0791d instanceof r ? (r) abstractC0791d : null;
                if (rVar != null) {
                    return (Build.VERSION.SDK_INT >= 28 ? new C0795h(3) : new C0795h(4)).a(rVar.f8519d, rVar.f8520e, rVar.f8521f, rVar.f8476c, context);
                }
                return null;
        }
    }

    @Override // X0.O
    public Typeface e(K k6, I i6, int i7) {
        switch (this.f8488a) {
            case 3:
                return f(k6.f8454f, i6, i7);
            default:
                String strConcat = k6.f8454f;
                int i8 = i6.f8452a / 100;
                if (i8 >= 0 && i8 < 2) {
                    strConcat = strConcat.concat("-thin");
                } else if (2 <= i8 && i8 < 4) {
                    strConcat = strConcat.concat("-light");
                } else if (i8 != 4) {
                    if (i8 == 5) {
                        strConcat = strConcat.concat("-medium");
                    } else if ((6 > i8 || i8 >= 8) && 8 <= i8 && i8 < 11) {
                        strConcat = strConcat.concat("-black");
                    }
                }
                Typeface typefaceH = h(strConcat, i6, i7);
                return typefaceH == null ? g(k6.f8454f, i6, i7) : typefaceH;
        }
    }
}
