package o; import android.graphics.Typeface; import android.util.SparseArray; import java.io.IOException; import java.nio.ByteBuffer; /* loaded from: classes.dex */ public final class kem { final char[] a; final Typeface b; final LWm c = new LWm(1024); final C15166giu d; private kem(Typeface typeface, C15166giu c15166giu) { this.b = typeface; this.d = c15166giu; this.a = new char[c15166giu.b() << 1]; int b = c15166giu.b(); for (int i = 0; i < b; i++) { C2650aic c2650aic = new C2650aic(this, i); Character.toChars(c2650aic.a().a(), this.a, i << 1); if (c2650aic.a().e() > 0) { LWm lWm = this.c; int e = c2650aic.a().e() - 1; int i2 = 0; while (true) { int c = c2650aic.a().c(i2); SparseArray sparseArray = lWm.e; LWm lWm2 = sparseArray == null ? null : sparseArray.get(c); if (lWm2 == null) { lWm2 = new LWm(); lWm.e.put(c2650aic.a().c(i2), lWm2); } lWm = lWm2; i2 = e > i2 ? i2 + 1 : i2; } lWm.d = c2650aic; } else { throw new IllegalArgumentException("invalid metadata codepoint length"); } } } public static kem xK_(Typeface typeface, ByteBuffer byteBuffer) throws IOException { try { Lfp.b("EmojiCompat.MetadataRepo.create"); return new kem(typeface, C17213upH.e(byteBuffer)); } finally { Lfp.c(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class LWm { C2650aic d; final SparseArray e; LWm() { this(1); } LWm(int i) { this.e = new SparseArray<>(i); } } }