package e4;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.Layout;
import android.text.SpannableString;
import android.text.Spanned;
import android.util.Log;
import com.google.firebase.concurrent.ExecutorsRegistrar;
import com.google.firebase.datatransport.TransportRegistrar;
import java.io.ByteArrayOutputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import n1.C1263o;
import n4.O0;
import n4.u0;
import o4.C1350a;
import q1.C1444a;
import r4.C1494a;
import u0.C1580p;
import w2.InterfaceC1701d;
import w2.InterfaceC1703f;
import x0.AbstractC1709a;

/* JADX INFO: renamed from: e4.i, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class C0878i implements d4.d, g3.d, B3.e, InterfaceC1701d, InterfaceC1703f {

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

    public /* synthetic */ C0878i(int i) {
        this.f12462q = i;
    }

    @Override // w2.InterfaceC1703f
    public void a(Exception exc) {
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:76:0x02cb  */
    /* JADX WARN: Removed duplicated region for block: B:94:0x031f  */
    /* JADX WARN: Type inference failed for: r18v0 */
    /* JADX WARN: Type inference failed for: r18v1, types: [java.lang.CharSequence] */
    /* JADX WARN: Type inference failed for: r18v2 */
    /* JADX WARN: Type inference failed for: r1v1, types: [java.lang.CharSequence] */
    /* JADX WARN: Type inference failed for: r1v36 */
    /* JADX WARN: Type inference failed for: r1v37, types: [android.text.Spannable, android.text.SpannableString] */
    @Override // B3.e
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public Object apply(Object obj) {
        ?? r18;
        Bitmap bitmap;
        float f3;
        int i;
        float f7;
        int i5;
        int i8;
        boolean z8;
        int i9 = 3;
        int i10 = 2;
        int i11 = 1;
        switch (this.f12462q) {
            case 5:
                return (C1263o) obj;
            case 12:
                Bundle bundle = (Bundle) obj;
                ?? charSequence = bundle.getCharSequence(w0.b.f18188r);
                if (charSequence != 0) {
                    ArrayList parcelableArrayList = bundle.getParcelableArrayList(w0.b.f18189s);
                    if (parcelableArrayList != null) {
                        charSequence = SpannableString.valueOf(charSequence);
                        int size = parcelableArrayList.size();
                        int i12 = 0;
                        while (i12 < size) {
                            Object obj2 = parcelableArrayList.get(i12);
                            i12 += i11;
                            Bundle bundle2 = (Bundle) obj2;
                            int i13 = bundle2.getInt(w0.d.f18215a);
                            int i14 = bundle2.getInt(w0.d.f18216b);
                            int i15 = bundle2.getInt(w0.d.f18217c);
                            int i16 = bundle2.getInt(w0.d.f18218d, -1);
                            Bundle bundle3 = bundle2.getBundle(w0.d.f18219e);
                            if (i16 == i11) {
                                bundle3.getClass();
                                String string = bundle3.getString(w0.g.f18220c);
                                string.getClass();
                                charSequence.setSpan(new w0.g(bundle3.getInt(w0.g.f18221d), string), i13, i14, i15);
                            } else if (i16 == i10) {
                                bundle3.getClass();
                                charSequence.setSpan(new w0.h(bundle3.getInt(w0.h.f18224d), bundle3.getInt(w0.h.f18225e), bundle3.getInt(w0.h.f18226f)), i13, i14, i15);
                            } else if (i16 == i9) {
                                charSequence.setSpan(new w0.e(), i13, i14, i15);
                            } else if (i16 == 4) {
                                bundle3.getClass();
                                String string2 = bundle3.getString(w0.i.f18230b);
                                string2.getClass();
                                charSequence.setSpan(new w0.i(string2), i13, i14, i15);
                            }
                            i9 = 3;
                            i10 = 2;
                            i11 = 1;
                        }
                    }
                    r18 = charSequence;
                } else {
                    r18 = 0;
                }
                Layout.Alignment alignment = (Layout.Alignment) bundle.getSerializable(w0.b.f18190t);
                Layout.Alignment alignment2 = alignment != null ? alignment : null;
                Layout.Alignment alignment3 = (Layout.Alignment) bundle.getSerializable(w0.b.f18191u);
                Layout.Alignment alignment4 = alignment3 != null ? alignment3 : null;
                Bitmap bitmapDecodeByteArray = (Bitmap) bundle.getParcelable(w0.b.f18192v);
                if (bitmapDecodeByteArray == null) {
                    byte[] byteArray = bundle.getByteArray(w0.b.f18193w);
                    if (byteArray != null) {
                        bitmapDecodeByteArray = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
                        bitmap = bitmapDecodeByteArray;
                    } else {
                        bitmap = null;
                    }
                } else {
                    bitmap = bitmapDecodeByteArray;
                }
                String str = w0.b.f18194x;
                if (bundle.containsKey(str)) {
                    String str2 = w0.b.f18195y;
                    if (bundle.containsKey(str2)) {
                        f3 = bundle.getFloat(str);
                        i = bundle.getInt(str2);
                    } else {
                        f3 = -3.4028235E38f;
                        i = Integer.MIN_VALUE;
                    }
                }
                String str3 = w0.b.f18196z;
                int i17 = bundle.containsKey(str3) ? bundle.getInt(str3) : Integer.MIN_VALUE;
                String str4 = w0.b.f18180A;
                float f8 = bundle.containsKey(str4) ? bundle.getFloat(str4) : -3.4028235E38f;
                String str5 = w0.b.f18181B;
                int i18 = bundle.containsKey(str5) ? bundle.getInt(str5) : Integer.MIN_VALUE;
                String str6 = w0.b.D;
                if (bundle.containsKey(str6)) {
                    String str7 = w0.b.f18182C;
                    if (bundle.containsKey(str7)) {
                        f7 = bundle.getFloat(str6);
                        i5 = bundle.getInt(str7);
                    } else {
                        f7 = -3.4028235E38f;
                        i5 = Integer.MIN_VALUE;
                    }
                }
                String str8 = w0.b.f18183E;
                float f9 = bundle.containsKey(str8) ? bundle.getFloat(str8) : -3.4028235E38f;
                String str9 = w0.b.f18184F;
                float f10 = bundle.containsKey(str9) ? bundle.getFloat(str9) : -3.4028235E38f;
                String str10 = w0.b.f18185G;
                if (bundle.containsKey(str10)) {
                    i8 = bundle.getInt(str10);
                    z8 = true;
                } else {
                    i8 = -16777216;
                    z8 = false;
                }
                int i19 = i8;
                boolean z9 = !bundle.getBoolean(w0.b.H, false) ? false : z8;
                String str11 = w0.b.f18186I;
                int i20 = bundle.containsKey(str11) ? bundle.getInt(str11) : Integer.MIN_VALUE;
                String str12 = w0.b.f18187J;
                return new w0.b(r18, alignment2, alignment4, bitmap, f3, i, i17, f8, i18, i5, f7, f9, f10, z9, i19, i20, bundle.containsKey(str12) ? bundle.getFloat(str12) : 0.0f);
            case 13:
                w0.b bVar = (w0.b) obj;
                bVar.getClass();
                Bundle bundle4 = new Bundle();
                CharSequence charSequence2 = bVar.f18197a;
                if (charSequence2 != null) {
                    bundle4.putCharSequence(w0.b.f18188r, charSequence2);
                    if (charSequence2 instanceof Spanned) {
                        Spanned spanned = (Spanned) charSequence2;
                        String str13 = w0.d.f18215a;
                        ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
                        for (w0.g gVar : (w0.g[]) spanned.getSpans(0, spanned.length(), w0.g.class)) {
                            gVar.getClass();
                            Bundle bundle5 = new Bundle();
                            bundle5.putString(w0.g.f18220c, gVar.f18222a);
                            bundle5.putInt(w0.g.f18221d, gVar.f18223b);
                            arrayList.add(w0.d.a(spanned, gVar, 1, bundle5));
                        }
                        for (w0.h hVar : (w0.h[]) spanned.getSpans(0, spanned.length(), w0.h.class)) {
                            hVar.getClass();
                            Bundle bundle6 = new Bundle();
                            bundle6.putInt(w0.h.f18224d, hVar.f18227a);
                            bundle6.putInt(w0.h.f18225e, hVar.f18228b);
                            bundle6.putInt(w0.h.f18226f, hVar.f18229c);
                            arrayList.add(w0.d.a(spanned, hVar, 2, bundle6));
                        }
                        for (w0.e eVar : (w0.e[]) spanned.getSpans(0, spanned.length(), w0.e.class)) {
                            arrayList.add(w0.d.a(spanned, eVar, 3, null));
                        }
                        for (w0.i iVar : (w0.i[]) spanned.getSpans(0, spanned.length(), w0.i.class)) {
                            iVar.getClass();
                            Bundle bundle7 = new Bundle();
                            bundle7.putString(w0.i.f18230b, iVar.f18231a);
                            arrayList.add(w0.d.a(spanned, iVar, 4, bundle7));
                        }
                        if (!arrayList.isEmpty()) {
                            bundle4.putParcelableArrayList(w0.b.f18189s, arrayList);
                        }
                    }
                }
                bundle4.putSerializable(w0.b.f18190t, bVar.f18198b);
                bundle4.putSerializable(w0.b.f18191u, bVar.f18199c);
                bundle4.putFloat(w0.b.f18194x, bVar.f18201e);
                bundle4.putInt(w0.b.f18195y, bVar.f18202f);
                bundle4.putInt(w0.b.f18196z, bVar.f18203g);
                bundle4.putFloat(w0.b.f18180A, bVar.f18204h);
                bundle4.putInt(w0.b.f18181B, bVar.i);
                bundle4.putInt(w0.b.f18182C, bVar.f18209n);
                bundle4.putFloat(w0.b.D, bVar.f18210o);
                bundle4.putFloat(w0.b.f18183E, bVar.f18205j);
                bundle4.putFloat(w0.b.f18184F, bVar.f18206k);
                bundle4.putBoolean(w0.b.H, bVar.f18207l);
                bundle4.putInt(w0.b.f18185G, bVar.f18208m);
                bundle4.putInt(w0.b.f18186I, bVar.f18211p);
                bundle4.putFloat(w0.b.f18187J, bVar.f18212q);
                Bitmap bitmap2 = bVar.f18200d;
                if (bitmap2 != null) {
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                    AbstractC1709a.j(bitmap2.compress(Bitmap.CompressFormat.PNG, 0, byteArrayOutputStream));
                    bundle4.putByteArray(w0.b.f18193w, byteArrayOutputStream.toByteArray());
                }
                return bundle4;
            case 14:
                long j8 = ((C1444a) obj).f16196b;
                if (j8 == -9223372036854775807L) {
                    j8 = 0;
                }
                return Long.valueOf(j8);
            case 15:
                C1494a.f16439b.getClass();
                return C1350a.f15716a.o((O0) obj).getBytes(Charset.forName("UTF-8"));
            default:
                C1580p c1580p = (C1580p) obj;
                return c1580p.f17371a + ": " + c1580p.f17372b;
        }
    }

    @Override // g3.d
    public void l(Exception exc) {
        Log.e("FirebaseCrashlytics", "Error fetching settings.", exc);
    }

    @Override // d4.d
    public Object p(K2.e eVar) {
        switch (this.f12462q) {
            case u0.f15495q /* 0 */:
                d4.l lVar = ExecutorsRegistrar.f10548a;
                return m.f12473q;
            case 17:
                return TransportRegistrar.lambda$getComponents$0(eVar);
            case 18:
                return TransportRegistrar.lambda$getComponents$1(eVar);
            default:
                return TransportRegistrar.lambda$getComponents$2(eVar);
        }
    }
}
