package m2;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.util.TypedValue;
import androidx.compose.ui.platform.AndroidCompositionLocals_androidKt;
import kotlin.jvm.internal.t;
import kotlin.text.z;
import m2.d;
import s1.u0;
import x1.r;
import y0.m;
import y0.p;

/* loaded from: classes.dex */
public abstract class e {
    private static final u0 a(CharSequence charSequence, Resources resources, int i10) {
        try {
            return c.a(u0.f35359a, resources, i10);
        } catch (Exception e10) {
            throw new h("Error attempting to load resource: " + ((Object) charSequence), e10);
        }
    }

    private static final x1.d b(Resources.Theme theme, Resources resources, int i10, int i11, m mVar, int i12) {
        if (p.H()) {
            p.Q(21855625, i12, -1, "androidx.compose.ui.res.loadVectorResource (PainterResources.android.kt:91)");
        }
        d dVar = (d) mVar.t(AndroidCompositionLocals_androidKt.h());
        d.b bVar = new d.b(theme, i10);
        d.a b10 = dVar.b(bVar);
        if (b10 == null) {
            XmlResourceParser xml = resources.getXml(i10);
            if (!t.b(y1.c.j(xml).getName(), "vector")) {
                throw new IllegalArgumentException("Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG, WEBP");
            }
            b10 = k.a(theme, resources, xml, i11);
            dVar.d(bVar, b10);
        }
        x1.d b11 = b10.b();
        if (p.H()) {
            p.P();
        }
        return b11;
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x0047  */
    /* JADX WARN: Removed duplicated region for block: B:13:0x00ba  */
    /* JADX WARN: Removed duplicated region for block: B:16:0x0065  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final w1.b c(int i10, m mVar, int i11) {
        boolean z10;
        w1.b aVar;
        boolean Y;
        if (p.H()) {
            p.Q(473971343, i11, -1, "androidx.compose.ui.res.painterResource (PainterResources.android.kt:57)");
        }
        Context context = (Context) mVar.t(AndroidCompositionLocals_androidKt.g());
        mVar.t(AndroidCompositionLocals_androidKt.f());
        Resources resources = context.getResources();
        TypedValue b10 = ((g) mVar.t(AndroidCompositionLocals_androidKt.i())).b(resources, i10);
        CharSequence charSequence = b10.string;
        boolean z11 = true;
        if (charSequence != null) {
            Y = z.Y(charSequence, ".xml", false, 2, null);
            if (Y) {
                z10 = true;
                if (z10) {
                    mVar.S(-802884675);
                    Object theme = context.getTheme();
                    boolean R = mVar.R(charSequence);
                    if ((((i11 & 14) ^ 6) <= 4 || !mVar.i(i10)) && (i11 & 6) != 4) {
                        z11 = false;
                    }
                    boolean R2 = R | z11 | mVar.R(theme);
                    Object f10 = mVar.f();
                    if (R2 || f10 == m.f51621a.a()) {
                        f10 = a(charSequence, resources, i10);
                        mVar.I(f10);
                    }
                    aVar = new w1.a((u0) f10, 0L, 0L, 6, null);
                    mVar.H();
                } else {
                    mVar.S(-803040357);
                    aVar = r.g(b(context.getTheme(), resources, i10, b10.changingConfigurations, mVar, (i11 << 6) & 896), mVar, 0);
                    mVar.H();
                }
                if (p.H()) {
                    p.P();
                }
                return aVar;
            }
        }
        z10 = false;
        if (z10) {
        }
        if (p.H()) {
        }
        return aVar;
    }
}
