package q2;

import T0.C0606q;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
import android.util.SparseArray;
import e4.C;
import i5.h;
import i5.k;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import kotlin.jvm.internal.o;
import m3.AbstractC2467b;
import n2.AbstractC2613d;
import r2.AbstractC2876a;
import r2.AbstractC2881f;
import r2.AbstractC2883h;
import r2.C2877b;
import r2.C2878c;
import r2.C2879d;
import r2.C2880e;
import r2.i;
import r2.q;

/* JADX INFO: renamed from: q2.g, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2844g extends W.b {

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final Bundle f23622j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final C2841d f23623k;
    public String l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final C0606q f23624m;

    public C2844g(Bundle bundle, C2841d c2841d) {
        super(28);
        this.f23622j = bundle;
        this.f23623k = c2841d;
        this.l = "";
        this.f23624m = c2841d.f23614a;
    }

    public static void z0(C2841d c2841d, i5.g gVar, Bundle bundle) {
        if (c2841d.f23615b == 1 && !bundle.containsKey("type")) {
            if (o.c(gVar.e(), k.f19100j) || o.c(gVar.e(), k.f19102m)) {
                String value = gVar.a();
                o.h(value, "value");
                bundle.putString("type", value);
            }
        }
    }

    @Override // W.b, j5.d
    public final void D(long j4) {
        Bundle source = this.f23622j;
        o.h(source, "source");
        String key = this.l;
        o.h(key, "key");
        source.putLong(key, j4);
    }

    @Override // W.b, j5.d
    public final void F(String value) {
        o.h(value, "value");
        Bundle bundle = this.f23622j;
        String key = this.l;
        o.h(key, "key");
        bundle.putString(key, value);
    }

    @Override // W.b
    public final void X(i5.g descriptor, int i6) {
        o.h(descriptor, "descriptor");
        String strG = descriptor.g(i6);
        this.l = strG;
        if (this.f23623k.f23615b == 1) {
            Bundle bundle = this.f23622j;
            boolean zContainsKey = bundle.containsKey("type");
            boolean zC = o.c(strG, "type");
            if (zContainsKey && zC) {
                String string = bundle.getString("type");
                if (string != null) {
                    throw new IllegalArgumentException(Z0.o.p("SavedStateEncoder for ", string, " has property '", strG, "' that conflicts with the class discriminator. You can rename a property with @SerialName annotation."));
                }
                AbstractC2613d.i("type");
                throw null;
            }
        }
    }

    @Override // j5.d
    public final C0606q a() {
        return this.f23624m;
    }

    @Override // W.b, j5.d
    public final j5.b b(i5.g descriptor) {
        o.h(descriptor, "descriptor");
        boolean zC = o.c(this.l, "");
        Bundle bundle = this.f23622j;
        C2841d c2841d = this.f23623k;
        if (zC) {
            z0(c2841d, descriptor, bundle);
            return this;
        }
        Bundle bundleM = C.m((w4.k[]) Arrays.copyOf(new w4.k[0], 0));
        m1.g.m(bundle, this.l, bundleM);
        z0(c2841d, descriptor, bundleM);
        return new C2844g(bundleM, c2841d);
    }

    @Override // W.b, j5.d
    public final void f() {
        Bundle source = this.f23622j;
        o.h(source, "source");
        String key = this.l;
        o.h(key, "key");
        source.putString(key, null);
    }

    @Override // W.b, j5.b
    public final boolean g(i5.g descriptor) {
        o.h(descriptor, "descriptor");
        return false;
    }

    @Override // W.b, j5.d
    public final void h(double d6) {
        Bundle source = this.f23622j;
        o.h(source, "source");
        String key = this.l;
        o.h(key, "key");
        source.putDouble(key, d6);
    }

    @Override // W.b, j5.d
    public final void i(short s6) {
        Bundle bundle = this.f23622j;
        String key = this.l;
        o.h(key, "key");
        bundle.putInt(key, s6);
    }

    @Override // W.b, j5.d
    public final void j(byte b5) {
        Bundle bundle = this.f23622j;
        String key = this.l;
        o.h(key, "key");
        bundle.putInt(key, b5);
    }

    @Override // W.b, j5.d
    public final void k(boolean z6) {
        Bundle source = this.f23622j;
        o.h(source, "source");
        String key = this.l;
        o.h(key, "key");
        source.putBoolean(key, z6);
    }

    @Override // W.b, j5.d
    public final void n(float f6) {
        Bundle source = this.f23622j;
        o.h(source, "source");
        String key = this.l;
        o.h(key, "key");
        source.putFloat(key, f6);
    }

    @Override // W.b, j5.d
    public final void q(char c6) {
        Bundle source = this.f23622j;
        o.h(source, "source");
        String key = this.l;
        o.h(key, "key");
        source.putChar(key, c6);
    }

    @Override // W.b, j5.d
    public final void s(g5.a serializer, Object obj) {
        o.h(serializer, "serializer");
        i5.g descriptor = serializer.getDescriptor();
        if (o.c(descriptor, AbstractC2840c.f23599a)) {
            C2878c c2878c = C2878c.f23916a;
            o.f(obj, "null cannot be cast to non-null type kotlin.CharSequence");
            C2878c.b(this, (CharSequence) obj);
            return;
        }
        if (o.c(descriptor, AbstractC2840c.f23600b)) {
            C2880e c2880e = C2880e.f23919c;
            o.f(obj, "null cannot be cast to non-null type android.os.Parcelable");
            c2880e.c(this, (Parcelable) obj);
            return;
        }
        if (o.c(descriptor, AbstractC2840c.f23601c)) {
            C2879d c2879d = C2879d.f23918c;
            o.f(obj, "null cannot be cast to non-null type java.io.Serializable");
            c2879d.d(this, (Serializable) obj);
            return;
        }
        if (o.c(descriptor, AbstractC2840c.f23602d)) {
            h hVar = AbstractC2881f.f23920a;
            o.f(obj, "null cannot be cast to non-null type android.os.IBinder");
            IBinder value = (IBinder) obj;
            o.h(this, "encoder");
            o.h(value, "value");
            if (!(this instanceof C2844g)) {
                throw new IllegalArgumentException(m1.g.g(this, AbstractC2881f.f23920a.f19087a).toString());
            }
            Bundle bundle = this.f23622j;
            String key = this.l;
            o.h(key, "key");
            bundle.putBinder(key, value);
            return;
        }
        if (o.c(descriptor, AbstractC2840c.f23607i) || o.c(descriptor, AbstractC2840c.f23608j)) {
            h hVar2 = AbstractC2876a.f23913a;
            o.f(obj, "null cannot be cast to non-null type kotlin.Array<kotlin.CharSequence>");
            CharSequence[] value2 = (CharSequence[]) obj;
            o.h(this, "encoder");
            o.h(value2, "value");
            if (!(this instanceof C2844g)) {
                throw new IllegalArgumentException(m1.g.g(this, AbstractC2876a.f23913a.f19087a).toString());
            }
            Bundle bundle2 = this.f23622j;
            String key2 = this.l;
            o.h(key2, "key");
            bundle2.putCharSequenceArray(key2, value2);
            return;
        }
        if (o.c(descriptor, AbstractC2840c.f23609k) || o.c(descriptor, AbstractC2840c.l)) {
            C2877b c2877b = C2877b.f23914a;
            o.f(obj, "null cannot be cast to non-null type kotlin.collections.List<kotlin.CharSequence>");
            c2877b.serialize(this, (List) obj);
            return;
        }
        if (o.c(descriptor, AbstractC2840c.f23603e) || o.c(descriptor, AbstractC2840c.f23604f)) {
            h hVar3 = AbstractC2883h.f23923a;
            o.f(obj, "null cannot be cast to non-null type kotlin.Array<android.os.Parcelable>");
            Parcelable[] value3 = (Parcelable[]) obj;
            o.h(this, "encoder");
            o.h(value3, "value");
            if (!(this instanceof C2844g)) {
                throw new IllegalArgumentException(m1.g.g(this, AbstractC2883h.f23923a.f19087a).toString());
            }
            Bundle bundle3 = this.f23622j;
            String key3 = this.l;
            o.h(key3, "key");
            bundle3.putParcelableArray(key3, value3);
            return;
        }
        if (o.c(descriptor, AbstractC2840c.f23605g) || o.c(descriptor, AbstractC2840c.f23606h)) {
            i iVar = i.f23924a;
            o.f(obj, "null cannot be cast to non-null type kotlin.collections.List<android.os.Parcelable>");
            iVar.serialize(this, (List) obj);
            return;
        }
        if (o.c(descriptor, AbstractC2840c.f23610m) || o.c(descriptor, AbstractC2840c.f23611n) || o.c(descriptor, AbstractC2840c.f23612o)) {
            q qVar = q.f23939a;
            o.f(obj, "null cannot be cast to non-null type android.util.SparseArray<android.os.Parcelable>");
            qVar.serialize(this, (SparseArray) obj);
            return;
        }
        i5.g descriptor2 = serializer.getDescriptor();
        boolean zC = o.c(descriptor2, AbstractC2839b.f23590a);
        Bundle bundle4 = this.f23622j;
        if (zC) {
            o.f(obj, "null cannot be cast to non-null type kotlin.collections.List<kotlin.Int>");
            String key4 = this.l;
            o.h(key4, "key");
            bundle4.putIntegerArrayList(key4, AbstractC2467b.m((List) obj));
            return;
        }
        if (o.c(descriptor2, AbstractC2839b.f23591b)) {
            o.f(obj, "null cannot be cast to non-null type kotlin.collections.List<kotlin.String>");
            String key5 = this.l;
            o.h(key5, "key");
            bundle4.putStringArrayList(key5, AbstractC2467b.m((List) obj));
            return;
        }
        if (o.c(descriptor2, AbstractC2839b.f23592c)) {
            o.f(obj, "null cannot be cast to non-null type kotlin.BooleanArray");
            String key6 = this.l;
            o.h(key6, "key");
            bundle4.putBooleanArray(key6, (boolean[]) obj);
            return;
        }
        if (o.c(descriptor2, AbstractC2839b.f23593d)) {
            o.f(obj, "null cannot be cast to non-null type kotlin.CharArray");
            String key7 = this.l;
            o.h(key7, "key");
            bundle4.putCharArray(key7, (char[]) obj);
            return;
        }
        if (o.c(descriptor2, AbstractC2839b.f23594e)) {
            o.f(obj, "null cannot be cast to non-null type kotlin.DoubleArray");
            String key8 = this.l;
            o.h(key8, "key");
            bundle4.putDoubleArray(key8, (double[]) obj);
            return;
        }
        if (o.c(descriptor2, AbstractC2839b.f23595f)) {
            o.f(obj, "null cannot be cast to non-null type kotlin.FloatArray");
            String key9 = this.l;
            o.h(key9, "key");
            bundle4.putFloatArray(key9, (float[]) obj);
            return;
        }
        if (o.c(descriptor2, AbstractC2839b.f23596g)) {
            o.f(obj, "null cannot be cast to non-null type kotlin.IntArray");
            String key10 = this.l;
            o.h(key10, "key");
            bundle4.putIntArray(key10, (int[]) obj);
            return;
        }
        if (o.c(descriptor2, AbstractC2839b.f23597h)) {
            o.f(obj, "null cannot be cast to non-null type kotlin.LongArray");
            String key11 = this.l;
            o.h(key11, "key");
            bundle4.putLongArray(key11, (long[]) obj);
            return;
        }
        if (!o.c(descriptor2, AbstractC2839b.f23598i)) {
            serializer.serialize(this, obj);
            return;
        }
        o.f(obj, "null cannot be cast to non-null type kotlin.Array<kotlin.String>");
        String key12 = this.l;
        o.h(key12, "key");
        bundle4.putStringArray(key12, (String[]) obj);
    }

    @Override // W.b, j5.d
    public final void x(i5.g enumDescriptor, int i6) {
        o.h(enumDescriptor, "enumDescriptor");
        Bundle bundle = this.f23622j;
        String key = this.l;
        o.h(key, "key");
        bundle.putInt(key, i6);
    }

    @Override // W.b, j5.d
    public final void y(int i6) {
        Bundle bundle = this.f23622j;
        String key = this.l;
        o.h(key, "key");
        bundle.putInt(key, i6);
    }
}
