package androidx.emoji2.text;

import android.os.Build;
import android.text.PrecomputedText;
import android.text.Spannable;
import android.text.SpannableString;
import java.util.stream.IntStream;
import p017f0.C0710w;

/* renamed from: androidx.emoji2.text.u */
/* loaded from: classes.dex */
public class C0262u implements Spannable {

    /* renamed from: d */
    public boolean f1149d = false;

    /* renamed from: e */
    public Spannable f1150e;

    /* renamed from: androidx.emoji2.text.u$a */
    /* loaded from: classes.dex */
    public static class C0263a {
        /* renamed from: a */
        public static IntStream m4293a(CharSequence charSequence) {
            IntStream chars;
            chars = charSequence.chars();
            return chars;
        }

        /* renamed from: b */
        public static IntStream m4292b(CharSequence charSequence) {
            IntStream codePoints;
            codePoints = charSequence.codePoints();
            return codePoints;
        }
    }

    /* renamed from: androidx.emoji2.text.u$b */
    /* loaded from: classes.dex */
    public static class C0264b {
        /* renamed from: a */
        public boolean mo4291a(CharSequence charSequence) {
            return charSequence instanceof C0710w;
        }
    }

    /* renamed from: androidx.emoji2.text.u$c */
    /* loaded from: classes.dex */
    public static class C0265c extends C0264b {
        @Override // androidx.emoji2.text.C0262u.C0264b
        /* renamed from: a */
        public boolean mo4291a(CharSequence charSequence) {
            return (charSequence instanceof PrecomputedText) || (charSequence instanceof C0710w);
        }
    }

    public C0262u(Spannable spannable) {
        this.f1150e = spannable;
    }

    public C0262u(CharSequence charSequence) {
        this.f1150e = new SpannableString(charSequence);
    }

    /* renamed from: c */
    public static C0264b m4294c() {
        return Build.VERSION.SDK_INT < 28 ? new C0264b() : new C0265c();
    }

    /* renamed from: a */
    public final void m4296a() {
        Spannable spannable = this.f1150e;
        if (!this.f1149d && m4294c().mo4291a(spannable)) {
            this.f1150e = new SpannableString(spannable);
        }
        this.f1149d = true;
    }

    /* renamed from: b */
    public Spannable m4295b() {
        return this.f1150e;
    }

    @Override // java.lang.CharSequence
    public char charAt(int i) {
        return this.f1150e.charAt(i);
    }

    @Override // java.lang.CharSequence
    public IntStream chars() {
        return C0263a.m4293a(this.f1150e);
    }

    @Override // java.lang.CharSequence
    public IntStream codePoints() {
        return C0263a.m4292b(this.f1150e);
    }

    @Override // android.text.Spanned
    public int getSpanEnd(Object obj) {
        return this.f1150e.getSpanEnd(obj);
    }

    @Override // android.text.Spanned
    public int getSpanFlags(Object obj) {
        return this.f1150e.getSpanFlags(obj);
    }

    @Override // android.text.Spanned
    public int getSpanStart(Object obj) {
        return this.f1150e.getSpanStart(obj);
    }

    @Override // android.text.Spanned
    public <T> T[] getSpans(int i, int i2, Class<T> cls) {
        return (T[]) this.f1150e.getSpans(i, i2, cls);
    }

    @Override // java.lang.CharSequence
    public int length() {
        return this.f1150e.length();
    }

    @Override // android.text.Spanned
    public int nextSpanTransition(int i, int i2, Class cls) {
        return this.f1150e.nextSpanTransition(i, i2, cls);
    }

    @Override // android.text.Spannable
    public void removeSpan(Object obj) {
        m4296a();
        this.f1150e.removeSpan(obj);
    }

    @Override // android.text.Spannable
    public void setSpan(Object obj, int i, int i2, int i3) {
        m4296a();
        this.f1150e.setSpan(obj, i, i2, i3);
    }

    @Override // java.lang.CharSequence
    public CharSequence subSequence(int i, int i2) {
        return this.f1150e.subSequence(i, i2);
    }

    @Override // java.lang.CharSequence
    public String toString() {
        return this.f1150e.toString();
    }
}