package androidx.slice;

import android.app.PendingIntent;
import android.app.RemoteInput;
import android.graphics.Color;
import android.text.format.DateUtils;
import androidx.core.graphics.drawable.IconCompat;
import androidx.versionedparcelable.CustomVersionedParcelable;
import com.fasterxml.jackson.core.JsonFactory;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import s3.e;

/* loaded from: classes.dex */
public final class SliceItem extends CustomVersionedParcelable {

    /* renamed from: a, reason: collision with root package name */
    protected String[] f5602a;

    /* renamed from: b, reason: collision with root package name */
    String f5603b;

    /* renamed from: c, reason: collision with root package name */
    String f5604c;

    /* renamed from: d, reason: collision with root package name */
    Object f5605d;

    /* renamed from: e, reason: collision with root package name */
    SliceItemHolder f5606e;

    public SliceItem(Object obj, String str, String str2, String[] strArr) {
        this.f5602a = strArr;
        this.f5603b = str;
        this.f5604c = str2;
        this.f5605d = obj;
    }

    private static String l(int i10) {
        return i10 != 0 ? i10 != 1 ? i10 != 2 ? i10 != 3 ? Integer.toString(i10) : "LOCALE" : "INHERIT" : "RTL" : "LTR";
    }

    public static String p(String str) {
        str.hashCode();
        char c10 = 65535;
        switch (str.hashCode()) {
            case -1422950858:
                if (str.equals("action")) {
                    c10 = 0;
                    break;
                }
                break;
            case 104431:
                if (str.equals("int")) {
                    c10 = 1;
                    break;
                }
                break;
            case 3327612:
                if (str.equals("long")) {
                    c10 = 2;
                    break;
                }
                break;
            case 3556653:
                if (str.equals("text")) {
                    c10 = 3;
                    break;
                }
                break;
            case 100313435:
                if (str.equals("image")) {
                    c10 = 4;
                    break;
                }
                break;
            case 100358090:
                if (str.equals("input")) {
                    c10 = 5;
                    break;
                }
                break;
            case 109526418:
                if (str.equals("slice")) {
                    c10 = 6;
                    break;
                }
                break;
        }
        switch (c10) {
            case 0:
                return "Action";
            case 1:
                return "Int";
            case 2:
                return "Long";
            case 3:
                return "Text";
            case 4:
                return "Image";
            case 5:
                return "RemoteInput";
            case 6:
                return "Slice";
            default:
                return "Unrecognized format: " + str;
        }
    }

    public void a(String str) {
        this.f5602a = (String[]) a.a(String.class, this.f5602a, str);
    }

    public PendingIntent b() {
        Object obj = ((e) this.f5605d).f35408a;
        if (obj instanceof PendingIntent) {
            return (PendingIntent) obj;
        }
        return null;
    }

    public String c() {
        return this.f5603b;
    }

    public List d() {
        return Arrays.asList(this.f5602a);
    }

    public IconCompat e() {
        return (IconCompat) this.f5605d;
    }

    public int f() {
        return ((Integer) this.f5605d).intValue();
    }

    public long g() {
        return ((Long) this.f5605d).longValue();
    }

    public RemoteInput h() {
        return (RemoteInput) this.f5605d;
    }

    public Slice i() {
        return "action".equals(c()) ? (Slice) ((e) this.f5605d).f35409b : (Slice) this.f5605d;
    }

    public String j() {
        return this.f5604c;
    }

    public CharSequence k() {
        return (CharSequence) this.f5605d;
    }

    public void m() {
        this.f5605d = this.f5606e.a(this.f5603b);
        this.f5606e = null;
    }

    public void n(boolean z10) {
        this.f5606e = new SliceItemHolder(this.f5603b, this.f5605d, z10);
    }

    public String o(String str) {
        StringBuilder sb2 = new StringBuilder();
        sb2.append(str);
        sb2.append(c());
        if (j() != null) {
            sb2.append('<');
            sb2.append(j());
            sb2.append('>');
        }
        sb2.append(' ');
        String[] strArr = this.f5602a;
        if (strArr.length > 0) {
            Slice.a(sb2, strArr);
            sb2.append(' ');
        }
        String str2 = str + "  ";
        String c10 = c();
        c10.hashCode();
        char c11 = 65535;
        switch (c10.hashCode()) {
            case -1422950858:
                if (c10.equals("action")) {
                    c11 = 0;
                    break;
                }
                break;
            case 104431:
                if (c10.equals("int")) {
                    c11 = 1;
                    break;
                }
                break;
            case 3327612:
                if (c10.equals("long")) {
                    c11 = 2;
                    break;
                }
                break;
            case 3556653:
                if (c10.equals("text")) {
                    c11 = 3;
                    break;
                }
                break;
            case 100313435:
                if (c10.equals("image")) {
                    c11 = 4;
                    break;
                }
                break;
            case 109526418:
                if (c10.equals("slice")) {
                    c11 = 5;
                    break;
                }
                break;
        }
        switch (c11) {
            case 0:
                Object obj = ((e) this.f5605d).f35408a;
                sb2.append('[');
                sb2.append(obj);
                sb2.append("] ");
                sb2.append("{\n");
                sb2.append(i().g(str2));
                sb2.append('\n');
                sb2.append(str);
                sb2.append('}');
                break;
            case 1:
                if (!"color".equals(j())) {
                    if (!"layout_direction".equals(j())) {
                        sb2.append(f());
                        break;
                    } else {
                        sb2.append(l(f()));
                        break;
                    }
                } else {
                    int f10 = f();
                    sb2.append(String.format("a=0x%02x r=0x%02x g=0x%02x b=0x%02x", Integer.valueOf(Color.alpha(f10)), Integer.valueOf(Color.red(f10)), Integer.valueOf(Color.green(f10)), Integer.valueOf(Color.blue(f10))));
                    break;
                }
            case 2:
                if (!"millis".equals(j())) {
                    sb2.append(g());
                    sb2.append('L');
                    break;
                } else if (g() != -1) {
                    sb2.append(DateUtils.getRelativeTimeSpanString(g(), Calendar.getInstance().getTimeInMillis(), 1000L, 262144));
                    break;
                } else {
                    sb2.append("INFINITY");
                    break;
                }
            case 3:
                sb2.append(JsonFactory.DEFAULT_QUOTE_CHAR);
                sb2.append(k());
                sb2.append(JsonFactory.DEFAULT_QUOTE_CHAR);
                break;
            case 4:
                sb2.append(e());
                break;
            case 5:
                sb2.append("{\n");
                sb2.append(i().g(str2));
                sb2.append('\n');
                sb2.append(str);
                sb2.append('}');
                break;
            default:
                sb2.append(p(c()));
                break;
        }
        sb2.append("\n");
        return sb2.toString();
    }

    public String toString() {
        return o("");
    }

    public SliceItem() {
        this.f5602a = new String[0];
    }

    public SliceItem(PendingIntent pendingIntent, Slice slice, String str, String str2, String[] strArr) {
        this(new e(pendingIntent, slice), str, str2, strArr);
    }
}
