package l7; import android.text.Layout; import com.meizu.cloud.pushsdk.constants.PushConstants; import com.meizu.cloud.pushsdk.notification.model.BrightRemindSetting; import com.tencent.thumbplayer.tplayer.plugins.report.TPReportParams; import e7.g; import e7.h; import e7.j; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayDeque; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; import q7.f; import q7.n0; import q7.o0; import q7.r; public final class c extends g { /* renamed from: p reason: collision with root package name */ private static final Pattern f20311p = Pattern.compile("^([0-9][0-9]+):([0-9][0-9]):([0-9][0-9])(?:(\\.[0-9]+)|:([0-9][0-9])(?:\\.([0-9]+))?)?$"); /* renamed from: q reason: collision with root package name */ private static final Pattern f20312q = Pattern.compile("^([0-9]+(?:\\.[0-9]+)?)(h|m|s|ms|f|t)$"); /* renamed from: r reason: collision with root package name */ private static final Pattern f20313r = Pattern.compile("^(([0-9]*.)?[0-9]+)(px|em|%)$"); /* renamed from: s reason: collision with root package name */ static final Pattern f20314s = Pattern.compile("^([-+]?\\d+\\.?\\d*?)%$"); /* renamed from: t reason: collision with root package name */ static final Pattern f20315t = Pattern.compile("^(\\d+\\.?\\d*?)% (\\d+\\.?\\d*?)%$"); /* renamed from: u reason: collision with root package name */ private static final Pattern f20316u = Pattern.compile("^(\\d+\\.?\\d*?)px (\\d+\\.?\\d*?)px$"); /* renamed from: v reason: collision with root package name */ private static final Pattern f20317v = Pattern.compile("^(\\d+) (\\d+)$"); /* renamed from: w reason: collision with root package name */ private static final b f20318w = new b(30.0f, 1, 1); /* renamed from: x reason: collision with root package name */ private static final a f20319x = new a(32, 15); /* renamed from: o reason: collision with root package name */ private final XmlPullParserFactory f20320o; /* access modifiers changed from: private */ public static final class a { /* renamed from: a reason: collision with root package name */ final int f20321a; /* renamed from: b reason: collision with root package name */ final int f20322b; a(int i10, int i11) { this.f20321a = i10; this.f20322b = i11; } } /* access modifiers changed from: private */ public static final class b { /* renamed from: a reason: collision with root package name */ final float f20323a; /* renamed from: b reason: collision with root package name */ final int f20324b; /* renamed from: c reason: collision with root package name */ final int f20325c; b(float f10, int i10, int i11) { this.f20323a = f10; this.f20324b = i10; this.f20325c = i11; } } /* access modifiers changed from: private */ /* renamed from: l7.c$c reason: collision with other inner class name */ public static final class C0283c { /* renamed from: a reason: collision with root package name */ final int f20326a; /* renamed from: b reason: collision with root package name */ final int f20327b; C0283c(int i10, int i11) { this.f20326a = i10; this.f20327b = i11; } } public c() { super("TtmlDecoder"); try { XmlPullParserFactory newInstance = XmlPullParserFactory.newInstance(); this.f20320o = newInstance; newInstance.setNamespaceAware(true); } catch (XmlPullParserException e10) { throw new RuntimeException("Couldn't create XmlPullParserFactory instance", e10); } } private static g A(g gVar) { return gVar == null ? new g() : gVar; } private static boolean B(String str) { return str.equals(PushConstants.PUSH_NOTIFICATION_CREATE_TIMES_TAMP) || str.equals("head") || str.equals("body") || str.equals("div") || str.equals("p") || str.equals("span") || str.equals(BrightRemindSetting.BRIGHT_REMIND) || str.equals("style") || str.equals("styling") || str.equals("layout") || str.equals("region") || str.equals("metadata") || str.equals("image") || str.equals(TPReportParams.PROP_KEY_DATA) || str.equals("information"); } private static Layout.Alignment C(String str) { String e10 = e9.b.e(str); e10.hashCode(); char c10 = 65535; switch (e10.hashCode()) { case -1364013995: if (e10.equals("center")) { c10 = 0; break; } break; case 100571: if (e10.equals("end")) { c10 = 1; break; } break; case 3317767: if (e10.equals("left")) { c10 = 2; break; } break; case 108511772: if (e10.equals("right")) { c10 = 3; break; } break; case 109757538: if (e10.equals("start")) { c10 = 4; break; } break; } switch (c10) { case 0: return Layout.Alignment.ALIGN_CENTER; case 1: case 3: return Layout.Alignment.ALIGN_OPPOSITE; case 2: case 4: return Layout.Alignment.ALIGN_NORMAL; default: return null; } } private static a D(XmlPullParser xmlPullParser, a aVar) throws j { StringBuilder sb2; String attributeValue = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "cellResolution"); if (attributeValue == null) { return aVar; } Matcher matcher = f20317v.matcher(attributeValue); if (!matcher.matches()) { sb2 = new StringBuilder(); } else { try { int parseInt = Integer.parseInt((String) q7.a.e(matcher.group(1))); int parseInt2 = Integer.parseInt((String) q7.a.e(matcher.group(2))); if (parseInt != 0 && parseInt2 != 0) { return new a(parseInt, parseInt2); } throw new j("Invalid cell resolution " + parseInt + " " + parseInt2); } catch (NumberFormatException unused) { sb2 = new StringBuilder(); } } sb2.append("Ignoring malformed cell resolution: "); sb2.append(attributeValue); r.i("TtmlDecoder", sb2.toString()); return aVar; } private static void E(String str, g gVar) throws j { Matcher matcher; String[] P0 = n0.P0(str, "\\s+"); if (P0.length == 1) { matcher = f20313r.matcher(str); } else if (P0.length == 2) { matcher = f20313r.matcher(P0[1]); r.i("TtmlDecoder", "Multiple values in fontSize attribute. Picking the second value for vertical font size and ignoring the first."); } else { throw new j("Invalid number of entries for fontSize: " + P0.length + "."); } if (matcher.matches()) { String str2 = (String) q7.a.e(matcher.group(3)); str2.hashCode(); char c10 = 65535; switch (str2.hashCode()) { case 37: if (str2.equals("%")) { c10 = 0; break; } break; case 3240: if (str2.equals("em")) { c10 = 1; break; } break; case 3592: if (str2.equals("px")) { c10 = 2; break; } break; } switch (c10) { case 0: gVar.z(3); break; case 1: gVar.z(2); break; case 2: gVar.z(1); break; default: throw new j("Invalid unit for fontSize: '" + str2 + "'."); } gVar.y(Float.parseFloat((String) q7.a.e(matcher.group(1)))); return; } throw new j("Invalid expression for fontSize: '" + str + "'."); } private static b F(XmlPullParser xmlPullParser) throws j { String attributeValue = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "frameRate"); int parseInt = attributeValue != null ? Integer.parseInt(attributeValue) : 30; float f10 = 1.0f; String attributeValue2 = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "frameRateMultiplier"); if (attributeValue2 != null) { String[] P0 = n0.P0(attributeValue2, " "); if (P0.length == 2) { f10 = ((float) Integer.parseInt(P0[0])) / ((float) Integer.parseInt(P0[1])); } else { throw new j("frameRateMultiplier doesn't have 2 parts"); } } b bVar = f20318w; int i10 = bVar.f20324b; String attributeValue3 = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "subFrameRate"); if (attributeValue3 != null) { i10 = Integer.parseInt(attributeValue3); } int i11 = bVar.f20325c; String attributeValue4 = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "tickRate"); if (attributeValue4 != null) { i11 = Integer.parseInt(attributeValue4); } return new b(((float) parseInt) * f10, i10, i11); } private static Map<String, g> G(XmlPullParser xmlPullParser, Map<String, g> map, a aVar, C0283c cVar, Map<String, e> map2, Map<String, String> map3) throws IOException, XmlPullParserException { do { xmlPullParser.next(); if (o0.f(xmlPullParser, "style")) { String a10 = o0.a(xmlPullParser, "style"); g L = L(xmlPullParser, new g()); if (a10 != null) { for (String str : M(a10)) { L.a(map.get(str)); } } String g10 = L.g(); if (g10 != null) { map.put(g10, L); } } else if (o0.f(xmlPullParser, "region")) { e J = J(xmlPullParser, aVar, cVar); if (J != null) { map2.put(J.f20341a, J); } } else if (o0.f(xmlPullParser, "metadata")) { H(xmlPullParser, map3); } } while (!o0.d(xmlPullParser, "head")); return map; } private static void H(XmlPullParser xmlPullParser, Map<String, String> map) throws IOException, XmlPullParserException { String a10; do { xmlPullParser.next(); if (o0.f(xmlPullParser, "image") && (a10 = o0.a(xmlPullParser, "id")) != null) { map.put(a10, xmlPullParser.nextText()); } } while (!o0.d(xmlPullParser, "metadata")); } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ private static d I(XmlPullParser xmlPullParser, d dVar, Map<String, e> map, b bVar) throws j { long j10; long j11; char c10; int attributeCount = xmlPullParser.getAttributeCount(); g L = L(xmlPullParser, null); String str = null; String str2 = ""; long j12 = -9223372036854775807L; long j13 = -9223372036854775807L; long j14 = -9223372036854775807L; String[] strArr = null; for (int i10 = 0; i10 < attributeCount; i10++) { String attributeName = xmlPullParser.getAttributeName(i10); String attributeValue = xmlPullParser.getAttributeValue(i10); attributeName.hashCode(); switch (attributeName.hashCode()) { case -934795532: if (attributeName.equals("region")) { c10 = 0; break; } c10 = 65535; break; case 99841: if (attributeName.equals("dur")) { c10 = 1; break; } c10 = 65535; break; case 100571: if (attributeName.equals("end")) { c10 = 2; break; } c10 = 65535; break; case 93616297: if (attributeName.equals("begin")) { c10 = 3; break; } c10 = 65535; break; case 109780401: if (attributeName.equals("style")) { c10 = 4; break; } c10 = 65535; break; case 1292595405: if (attributeName.equals("backgroundImage")) { c10 = 5; break; } c10 = 65535; break; default: c10 = 65535; break; } switch (c10) { case 0: if (map.containsKey(attributeValue)) { str2 = attributeValue; continue; } case 1: j14 = N(attributeValue, bVar); break; case 2: j13 = N(attributeValue, bVar); break; case 3: j12 = N(attributeValue, bVar); break; case 4: String[] M = M(attributeValue); if (M.length > 0) { strArr = M; break; } break; case 5: if (attributeValue.startsWith("#")) { str = attributeValue.substring(1); break; } break; } } if (dVar != null) { long j15 = dVar.f20331d; j10 = -9223372036854775807L; if (j15 != -9223372036854775807L) { if (j12 != -9223372036854775807L) { j12 += j15; } if (j13 != -9223372036854775807L) { j13 += j15; } } } else { j10 = -9223372036854775807L; } if (j13 == j10) { if (j14 != j10) { j11 = j12 + j14; } else if (dVar != null) { long j16 = dVar.f20332e; if (j16 != j10) { j11 = j16; } } return d.c(xmlPullParser.getName(), j12, j11, L, strArr, str2, str, dVar); } j11 = j13; return d.c(xmlPullParser.getName(), j12, j11, L, strArr, str2, str, dVar); } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARNING: Code restructure failed: missing block: B:61:0x0184, code lost: if (r0.equals("tb") == false) goto L_0x0166; */ /* JADX WARNING: Removed duplicated region for block: B:26:0x00a8 */ /* JADX WARNING: Removed duplicated region for block: B:51:0x0157 */ /* JADX WARNING: Removed duplicated region for block: B:72:0x01af */ private static e J(XmlPullParser xmlPullParser, a aVar, C0283c cVar) { String str; String str2; StringBuilder sb2; float f10; float f11; String a10; float f12; float f13; int i10; float f14; String a11; int i11; String a12 = o0.a(xmlPullParser, "id"); if (a12 == null) { return null; } String a13 = o0.a(xmlPullParser, "origin"); if (a13 != null) { Pattern pattern = f20315t; Matcher matcher = pattern.matcher(a13); Pattern pattern2 = f20316u; Matcher matcher2 = pattern2.matcher(a13); String str3 = "Ignoring region with malformed origin: "; if (matcher.matches()) { try { float parseFloat = Float.parseFloat((String) q7.a.e(matcher.group(1))) / 100.0f; f10 = Float.parseFloat((String) q7.a.e(matcher.group(2))) / 100.0f; f11 = parseFloat; a10 = o0.a(xmlPullParser, "extent"); if (a10 == null) { Matcher matcher3 = pattern.matcher(a10); Matcher matcher4 = pattern2.matcher(a10); str3 = "Ignoring region with malformed extent: "; if (matcher3.matches()) { try { f13 = Float.parseFloat((String) q7.a.e(matcher3.group(1))) / 100.0f; f12 = Float.parseFloat((String) q7.a.e(matcher3.group(2))) / 100.0f; } catch (NumberFormatException unused) { sb2 = new StringBuilder(); sb2.append(str3); sb2.append(a13); str = sb2.toString(); r.i("TtmlDecoder", str); return null; } } else if (!matcher4.matches()) { sb2 = new StringBuilder(); str2 = "Ignoring region with unsupported extent: "; sb2.append(str2); } else if (cVar == null) { sb2 = new StringBuilder(); sb2.append("Ignoring region with missing tts:extent: "); } else { try { int parseInt = Integer.parseInt((String) q7.a.e(matcher4.group(1))); int parseInt2 = Integer.parseInt((String) q7.a.e(matcher4.group(2))); f13 = ((float) parseInt) / ((float) cVar.f20326a); f12 = ((float) parseInt2) / ((float) cVar.f20327b); } catch (NumberFormatException unused2) { sb2 = new StringBuilder(); sb2.append(str3); sb2.append(a13); str = sb2.toString(); r.i("TtmlDecoder", str); return null; } } String a14 = o0.a(xmlPullParser, "displayAlign"); boolean z10 = false; if (a14 != null) { String e10 = e9.b.e(a14); e10.hashCode(); if (e10.equals("center")) { f14 = f10 + (f12 / 2.0f); i10 = 1; } else if (e10.equals("after")) { f14 = f10 + f12; i10 = 2; } float f15 = 1.0f / ((float) aVar.f20322b); a11 = o0.a(xmlPullParser, "writingMode"); if (a11 != null) { String e11 = e9.b.e(a11); e11.hashCode(); switch (e11.hashCode()) { case 3694: break; case 3553396: if (e11.equals("tblr")) { z10 = true; break; } z10 = true; break; case 3553576: if (e11.equals("tbrl")) { z10 = true; break; } z10 = true; break; default: z10 = true; break; } switch (z10) { case false: case true: i11 = 2; break; case true: i11 = 1; break; } return new e(a12, f11, f14, 0, i10, f13, f12, 1, f15, i11); } i11 = Integer.MIN_VALUE; return new e(a12, f11, f14, 0, i10, f13, f12, 1, f15, i11); } i10 = 0; f14 = f10; float f152 = 1.0f / ((float) aVar.f20322b); a11 = o0.a(xmlPullParser, "writingMode"); if (a11 != null) { } i11 = Integer.MIN_VALUE; return new e(a12, f11, f14, 0, i10, f13, f12, 1, f152, i11); } str = "Ignoring region without an extent"; } catch (NumberFormatException unused3) { sb2 = new StringBuilder(); sb2.append(str3); sb2.append(a13); str = sb2.toString(); r.i("TtmlDecoder", str); return null; } } else if (!matcher2.matches()) { sb2 = new StringBuilder(); str2 = "Ignoring region with unsupported origin: "; sb2.append(str2); } else if (cVar == null) { sb2 = new StringBuilder(); sb2.append("Ignoring region with missing tts:extent: "); } else { try { int parseInt3 = Integer.parseInt((String) q7.a.e(matcher2.group(1))); int parseInt4 = Integer.parseInt((String) q7.a.e(matcher2.group(2))); f11 = ((float) parseInt3) / ((float) cVar.f20326a); f10 = ((float) parseInt4) / ((float) cVar.f20327b); a10 = o0.a(xmlPullParser, "extent"); if (a10 == null) { } } catch (NumberFormatException unused4) { sb2 = new StringBuilder(); sb2.append(str3); sb2.append(a13); str = sb2.toString(); r.i("TtmlDecoder", str); return null; } } sb2.append(a13); str = sb2.toString(); } else { str = "Ignoring region without an origin"; } r.i("TtmlDecoder", str); return null; } private static float K(String str) { Matcher matcher = f20314s.matcher(str); if (!matcher.matches()) { r.i("TtmlDecoder", "Invalid value for shear: " + str); return Float.MAX_VALUE; } try { return Math.min(100.0f, Math.max(-100.0f, Float.parseFloat((String) q7.a.e(matcher.group(1))))); } catch (NumberFormatException e10) { r.j("TtmlDecoder", "Failed to parse shear: " + str, e10); return Float.MAX_VALUE; } } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARNING: Code restructure failed: missing block: B:86:0x01c4, code lost: if (r3.equals("text") == false) goto L_0x01bc; */ private static g L(XmlPullParser xmlPullParser, g gVar) { char c10; StringBuilder sb2; String str; int attributeCount = xmlPullParser.getAttributeCount(); for (int i10 = 0; i10 < attributeCount; i10++) { String attributeValue = xmlPullParser.getAttributeValue(i10); String attributeName = xmlPullParser.getAttributeName(i10); attributeName.hashCode(); char c11 = 5; char c12 = 65535; switch (attributeName.hashCode()) { case -1550943582: if (attributeName.equals("fontStyle")) { c10 = 0; break; } c10 = 65535; break; case -1224696685: if (attributeName.equals("fontFamily")) { c10 = 1; break; } c10 = 65535; break; case -1065511464: if (attributeName.equals("textAlign")) { c10 = 2; break; } c10 = 65535; break; case -879295043: if (attributeName.equals("textDecoration")) { c10 = 3; break; } c10 = 65535; break; case -734428249: if (attributeName.equals("fontWeight")) { c10 = 4; break; } c10 = 65535; break; case 3355: if (attributeName.equals("id")) { c10 = 5; break; } c10 = 65535; break; case 3511770: if (attributeName.equals("ruby")) { c10 = 6; break; } c10 = 65535; break; case 94842723: if (attributeName.equals("color")) { c10 = 7; break; } c10 = 65535; break; case 109403361: if (attributeName.equals("shear")) { c10 = '\b'; break; } c10 = 65535; break; case 110138194: if (attributeName.equals("textCombine")) { c10 = '\t'; break; } c10 = 65535; break; case 365601008: if (attributeName.equals("fontSize")) { c10 = '\n'; break; } c10 = 65535; break; case 921125321: if (attributeName.equals("textEmphasis")) { c10 = 11; break; } c10 = 65535; break; case 1115953443: if (attributeName.equals("rubyPosition")) { c10 = '\f'; break; } c10 = 65535; break; case 1287124693: if (attributeName.equals("backgroundColor")) { c10 = '\r'; break; } c10 = 65535; break; case 1754920356: if (attributeName.equals("multiRowAlign")) { c10 = 14; break; } c10 = 65535; break; default: c10 = 65535; break; } switch (c10) { case 0: gVar = A(gVar).B("italic".equalsIgnoreCase(attributeValue)); continue; case 1: gVar = A(gVar).x(attributeValue); continue; case 2: gVar = A(gVar).H(C(attributeValue)); continue; case 3: String e10 = e9.b.e(attributeValue); e10.hashCode(); switch (e10.hashCode()) { case -1461280213: if (e10.equals("nounderline")) { c12 = 0; break; } break; case -1026963764: if (e10.equals("underline")) { c12 = 1; break; } break; case 913457136: if (e10.equals("nolinethrough")) { c12 = 2; break; } break; case 1679736913: if (e10.equals("linethrough")) { c12 = 3; break; } break; } switch (c12) { case 0: gVar = A(gVar).K(false); continue; case 1: gVar = A(gVar).K(true); continue; case 2: gVar = A(gVar).C(false); continue; case 3: gVar = A(gVar).C(true); continue; continue; } break; case 4: gVar = A(gVar).v("bold".equalsIgnoreCase(attributeValue)); continue; case 5: if ("style".equals(xmlPullParser.getName())) { gVar = A(gVar).A(attributeValue); } else { continue; } case 6: String e11 = e9.b.e(attributeValue); e11.hashCode(); switch (e11.hashCode()) { case -618561360: if (e11.equals("baseContainer")) { c11 = 0; break; } c11 = 65535; break; case -410956671: if (e11.equals("container")) { c11 = 1; break; } c11 = 65535; break; case -250518009: if (e11.equals("delimiter")) { c11 = 2; break; } c11 = 65535; break; case -136074796: if (e11.equals("textContainer")) { c11 = 3; break; } c11 = 65535; break; case 3016401: if (e11.equals("base")) { c11 = 4; break; } c11 = 65535; break; case 3556653: break; default: c11 = 65535; break; } switch (c11) { case 0: case 4: gVar = A(gVar).F(2); continue; case 1: gVar = A(gVar).F(1); continue; case 2: gVar = A(gVar).F(4); continue; case 3: case 5: gVar = A(gVar).F(3); continue; continue; } break; case 7: gVar = A(gVar); try { gVar.w(f.c(attributeValue)); continue; } catch (IllegalArgumentException unused) { sb2 = new StringBuilder(); str = "Failed parsing color value: "; break; } case '\b': gVar = A(gVar).G(K(attributeValue)); continue; case '\t': String e12 = e9.b.e(attributeValue); e12.hashCode(); if (e12.equals("all")) { gVar = A(gVar).I(true); } else if (e12.equals("none")) { gVar = A(gVar).I(false); continue; } case '\n': try { gVar = A(gVar); E(attributeValue, gVar); continue; } catch (j unused2) { sb2 = new StringBuilder(); str = "Failed parsing fontSize value: "; break; } case 11: gVar = A(gVar).J(b.a(attributeValue)); continue; case '\f': String e13 = e9.b.e(attributeValue); e13.hashCode(); if (e13.equals("before")) { gVar = A(gVar).E(1); } else if (e13.equals("after")) { gVar = A(gVar).E(2); continue; } case '\r': gVar = A(gVar); try { gVar.u(f.c(attributeValue)); continue; } catch (IllegalArgumentException unused3) { sb2 = new StringBuilder(); str = "Failed parsing background value: "; break; } case 14: gVar = A(gVar).D(C(attributeValue)); continue; default: } sb2.append(str); sb2.append(attributeValue); r.i("TtmlDecoder", sb2.toString()); } return gVar; } private static String[] M(String str) { String trim = str.trim(); return trim.isEmpty() ? new String[0] : n0.P0(trim, "\\s+"); } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARNING: Code restructure failed: missing block: B:21:0x00bc, code lost: if (r13.equals("ms") == false) goto L_0x00b4; */ private static long N(String str, b bVar) throws j { double d10; double d11; Matcher matcher = f20311p.matcher(str); char c10 = 4; if (matcher.matches()) { double parseLong = ((double) (Long.parseLong((String) q7.a.e(matcher.group(1))) * 3600)) + ((double) (Long.parseLong((String) q7.a.e(matcher.group(2))) * 60)) + ((double) Long.parseLong((String) q7.a.e(matcher.group(3)))); String group = matcher.group(4); double d12 = 0.0d; double parseDouble = parseLong + (group != null ? Double.parseDouble(group) : 0.0d); String group2 = matcher.group(5); double parseLong2 = parseDouble + (group2 != null ? (double) (((float) Long.parseLong(group2)) / bVar.f20323a) : 0.0d); String group3 = matcher.group(6); if (group3 != null) { d12 = (((double) Long.parseLong(group3)) / ((double) bVar.f20324b)) / ((double) bVar.f20323a); } return (long) ((parseLong2 + d12) * 1000000.0d); } Matcher matcher2 = f20312q.matcher(str); if (matcher2.matches()) { double parseDouble2 = Double.parseDouble((String) q7.a.e(matcher2.group(1))); String str2 = (String) q7.a.e(matcher2.group(2)); str2.hashCode(); switch (str2.hashCode()) { case 102: if (str2.equals("f")) { c10 = 0; break; } c10 = 65535; break; case 104: if (str2.equals("h")) { c10 = 1; break; } c10 = 65535; break; case 109: if (str2.equals("m")) { c10 = 2; break; } c10 = 65535; break; case 116: if (str2.equals("t")) { c10 = 3; break; } c10 = 65535; break; case 3494: break; default: c10 = 65535; break; } switch (c10) { case 0: d10 = (double) bVar.f20323a; parseDouble2 /= d10; return (long) (parseDouble2 * 1000000.0d); case 1: d11 = 3600.0d; parseDouble2 *= d11; return (long) (parseDouble2 * 1000000.0d); case 2: d11 = 60.0d; parseDouble2 *= d11; return (long) (parseDouble2 * 1000000.0d); case 3: d10 = (double) bVar.f20325c; parseDouble2 /= d10; return (long) (parseDouble2 * 1000000.0d); case 4: d10 = 1000.0d; parseDouble2 /= d10; return (long) (parseDouble2 * 1000000.0d); default: return (long) (parseDouble2 * 1000000.0d); } } else { throw new j("Malformed time expression: " + str); } } private static C0283c O(XmlPullParser xmlPullParser) { StringBuilder sb2; String str; String a10 = o0.a(xmlPullParser, "extent"); if (a10 == null) { return null; } Matcher matcher = f20316u.matcher(a10); if (!matcher.matches()) { sb2 = new StringBuilder(); str = "Ignoring non-pixel tts extent: "; } else { try { return new C0283c(Integer.parseInt((String) q7.a.e(matcher.group(1))), Integer.parseInt((String) q7.a.e(matcher.group(2)))); } catch (NumberFormatException unused) { sb2 = new StringBuilder(); str = "Ignoring malformed tts extent: "; } } sb2.append(str); sb2.append(a10); r.i("TtmlDecoder", sb2.toString()); return null; } /* access modifiers changed from: protected */ @Override // e7.g public h y(byte[] bArr, int i10, boolean z10) throws j { b bVar; try { XmlPullParser newPullParser = this.f20320o.newPullParser(); HashMap hashMap = new HashMap(); HashMap hashMap2 = new HashMap(); HashMap hashMap3 = new HashMap(); hashMap2.put("", new e("")); C0283c cVar = null; newPullParser.setInput(new ByteArrayInputStream(bArr, 0, i10), null); ArrayDeque arrayDeque = new ArrayDeque(); b bVar2 = f20318w; a aVar = f20319x; int i11 = 0; h hVar = null; for (int eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.getEventType()) { d dVar = (d) arrayDeque.peek(); if (i11 == 0) { String name = newPullParser.getName(); if (eventType == 2) { if (PushConstants.PUSH_NOTIFICATION_CREATE_TIMES_TAMP.equals(name)) { bVar2 = F(newPullParser); aVar = D(newPullParser, f20319x); cVar = O(newPullParser); } if (!B(name)) { r.f("TtmlDecoder", "Ignoring unsupported tag: " + newPullParser.getName()); i11++; bVar2 = bVar2; } else { if ("head".equals(name)) { bVar = bVar2; G(newPullParser, hashMap, aVar, cVar, hashMap2, hashMap3); } else { bVar = bVar2; try { d I = I(newPullParser, dVar, hashMap2, bVar); arrayDeque.push(I); if (dVar != null) { dVar.a(I); } } catch (j e10) { r.j("TtmlDecoder", "Suppressing parser error", e10); i11++; } } bVar2 = bVar; } cVar = cVar; aVar = aVar; } else if (eventType == 4) { ((d) q7.a.e(dVar)).a(d.d(newPullParser.getText())); } else if (eventType == 3) { if (newPullParser.getName().equals(PushConstants.PUSH_NOTIFICATION_CREATE_TIMES_TAMP)) { hVar = new h((d) q7.a.e((d) arrayDeque.peek()), hashMap, hashMap2, hashMap3); } arrayDeque.pop(); } } else if (eventType == 2) { i11++; } else if (eventType == 3) { i11--; } newPullParser.next(); } if (hVar != null) { return hVar; } throw new j("No TTML subtitles found"); } catch (XmlPullParserException e11) { throw new j("Unable to decode source", e11); } catch (IOException e12) { throw new IllegalStateException("Unexpected error when reading input.", e12); } } }