package ka; import ai.clova.cic.clientlib.exoplayer2.C; import ai.clova.cic.clientlib.exoplayer2.text.ttml.TtmlNode; import android.text.Layout; import android.text.TextUtils; import com.android.billingclient.api.a0; import com.google.common.collect.a1; import com.google.common.collect.i2; import com.google.common.collect.j2; import com.google.common.collect.v0; import da.e; import da.f; import da.h; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.cordova.networkinformation.NetworkManager; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; import q9.j; import ra.d; import ra.k0; import ra.l0; import ra.q; public final class c extends e { /* renamed from: o reason: collision with root package name */ public static final Pattern f101573o = Pattern.compile("^([0-9][0-9]+):([0-9][0-9]):([0-9][0-9])(?:(\\.[0-9]+)|:([0-9][0-9])(?:\\.([0-9]+))?)?$"); /* renamed from: p reason: collision with root package name */ public static final Pattern f101574p = Pattern.compile("^([0-9]+(?:\\.[0-9]+)?)(h|m|s|ms|f|t)$"); /* renamed from: q reason: collision with root package name */ public static final Pattern f101575q = Pattern.compile("^(([0-9]*.)?[0-9]+)(px|em|%)$"); /* renamed from: r reason: collision with root package name */ public static final Pattern f101576r = Pattern.compile("^([-+]?\\d+\\.?\\d*?)%$"); /* renamed from: s reason: collision with root package name */ public static final Pattern f101577s = Pattern.compile("^(\\d+\\.?\\d*?)% (\\d+\\.?\\d*?)%$"); /* renamed from: t reason: collision with root package name */ public static final Pattern f101578t = Pattern.compile("^(\\d+\\.?\\d*?)px (\\d+\\.?\\d*?)px$"); /* renamed from: u reason: collision with root package name */ public static final Pattern f101579u = Pattern.compile("^(\\d+) (\\d+)$"); /* renamed from: v reason: collision with root package name */ public static final b f101580v = new b(30.0f, 1, 1); /* renamed from: w reason: collision with root package name */ public static final a f101581w = new a(32, 15); /* renamed from: n reason: collision with root package name */ public final XmlPullParserFactory f101582n; public static final class a { /* renamed from: a reason: collision with root package name */ public final int f101583a; public a(int i14, int i15) { this.f101583a = i15; } } public static final class b { /* renamed from: a reason: collision with root package name */ public final float f101584a; /* renamed from: b reason: collision with root package name */ public final int f101585b; /* renamed from: c reason: collision with root package name */ public final int f101586c; public b(float f14, int i14, int i15) { this.f101584a = f14; this.f101585b = i14; this.f101586c = i15; } } /* renamed from: ka.c$c reason: collision with other inner class name */ public static final class C1587c { /* renamed from: a reason: collision with root package name */ public final int f101587a; /* renamed from: b reason: collision with root package name */ public final int f101588b; public C1587c(int i14, int i15) { this.f101587a = i14; this.f101588b = i15; } } public c() { super("TtmlDecoder"); try { XmlPullParserFactory newInstance = XmlPullParserFactory.newInstance(); this.f101582n = newInstance; newInstance.setNamespaceAware(true); } catch (XmlPullParserException e14) { throw new RuntimeException("Couldn't create XmlPullParserFactory instance", e14); } } public static f g(f fVar) { return fVar == null ? new f() : fVar; } public static boolean h(String str) { return str.equals("tt") || str.equals("head") || str.equals("body") || str.equals("div") || str.equals("p") || str.equals("span") || str.equals("br") || str.equals("style") || str.equals("styling") || str.equals("layout") || str.equals("region") || str.equals("metadata") || str.equals(TtmlNode.TAG_IMAGE) || str.equals("data") || str.equals(TtmlNode.TAG_INFORMATION); } public static Layout.Alignment i(String str) { String r8 = s3.a.r(str); Objects.requireNonNull(r8); char c14 = 65535; switch (r8.hashCode()) { case -1364013995: if (r8.equals(TtmlNode.CENTER)) { c14 = 0; break; } break; case 100571: if (r8.equals(TtmlNode.END)) { c14 = 1; break; } break; case 3317767: if (r8.equals(TtmlNode.LEFT)) { c14 = 2; break; } break; case 108511772: if (r8.equals(TtmlNode.RIGHT)) { c14 = 3; break; } break; case 109757538: if (r8.equals(TtmlNode.START)) { c14 = 4; break; } break; } switch (c14) { 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; } } public static a j(XmlPullParser xmlPullParser, a aVar) throws h { String attributeValue = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "cellResolution"); if (attributeValue == null) { return aVar; } Matcher matcher = f101579u.matcher(attributeValue); if (!matcher.matches()) { if (attributeValue.length() != 0) { "Ignoring malformed cell resolution: ".concat(attributeValue); } return aVar; } try { String group = matcher.group(1); Objects.requireNonNull(group); int parseInt = Integer.parseInt(group); String group2 = matcher.group(2); Objects.requireNonNull(group2); int parseInt2 = Integer.parseInt(group2); if (parseInt != 0 && parseInt2 != 0) { return new a(parseInt, parseInt2); } StringBuilder sb4 = new StringBuilder(47); sb4.append("Invalid cell resolution "); sb4.append(parseInt); sb4.append(" "); sb4.append(parseInt2); throw new h(sb4.toString()); } catch (NumberFormatException unused) { if (attributeValue.length() != 0) { "Ignoring malformed cell resolution: ".concat(attributeValue); } return aVar; } } public static void k(String str, f fVar) throws h { Matcher matcher; int i14 = k0.f136472a; String[] split = str.split("\\s+", -1); if (split.length == 1) { matcher = f101575q.matcher(str); } else if (split.length == 2) { matcher = f101575q.matcher(split[1]); } else { throw new h(j.a(52, "Invalid number of entries for fontSize: ", split.length, ".")); } if (matcher.matches()) { String group = matcher.group(3); Objects.requireNonNull(group); group.hashCode(); char c14 = 65535; switch (group.hashCode()) { case 37: if (group.equals("%")) { c14 = 0; break; } break; case 3240: if (group.equals("em")) { c14 = 1; break; } break; case 3592: if (group.equals("px")) { c14 = 2; break; } break; } switch (c14) { case 0: fVar.f101621j = 3; break; case 1: fVar.f101621j = 2; break; case 2: fVar.f101621j = 1; break; default: throw new h(a0.b(group.length() + 30, "Invalid unit for fontSize: '", group, "'.")); } String group2 = matcher.group(1); Objects.requireNonNull(group2); fVar.f101622k = Float.parseFloat(group2); return; } throw new h(a0.b(str.length() + 36, "Invalid expression for fontSize: '", str, "'.")); } public static b l(XmlPullParser xmlPullParser) throws h { String attributeValue = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "frameRate"); int parseInt = attributeValue != null ? Integer.parseInt(attributeValue) : 30; float f14 = 1.0f; String attributeValue2 = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "frameRateMultiplier"); if (attributeValue2 != null) { int i14 = k0.f136472a; String[] split = attributeValue2.split(" ", -1); if (split.length == 2) { f14 = ((float) Integer.parseInt(split[0])) / ((float) Integer.parseInt(split[1])); } else { throw new h("frameRateMultiplier doesn't have 2 parts"); } } b bVar = f101580v; int i15 = bVar.f101585b; String attributeValue3 = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "subFrameRate"); if (attributeValue3 != null) { i15 = Integer.parseInt(attributeValue3); } int i16 = bVar.f101586c; String attributeValue4 = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "tickRate"); if (attributeValue4 != null) { i16 = Integer.parseInt(attributeValue4); } return new b(((float) parseInt) * f14, i15, i16); } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARNING: Code restructure failed: missing block: B:16:0x0053, code lost: r3 = ra.l0.a(r19, ai.clova.cic.clientlib.exoplayer2.text.ttml.TtmlNode.ATTR_TTS_ORIGIN); */ /* JADX WARNING: Removed duplicated region for block: B:100:0x01fe */ /* JADX WARNING: Removed duplicated region for block: B:67:0x0183 */ public static Map<String, f> m(XmlPullParser xmlPullParser, Map<String, f> map, a aVar, C1587c cVar, Map<String, e> map2, Map<String, String> map3) throws IOException, XmlPullParserException { String a14; e eVar; String a15; float f14; float f15; float f16; float f17; int i14; float f18; String a16; int i15; boolean z14; do { xmlPullParser.next(); if (l0.c(xmlPullParser, "style")) { String a17 = l0.a(xmlPullParser, "style"); f o14 = o(xmlPullParser, new f()); if (a17 != null) { for (String str : p(a17)) { o14.a(map.get(str)); } } String str2 = o14.f101623l; if (str2 != null) { map.put(str2, o14); } } else if (l0.c(xmlPullParser, "region")) { String a18 = l0.a(xmlPullParser, TtmlNode.ATTR_ID); if (!(a18 == null || a15 == null)) { Pattern pattern = f101577s; Matcher matcher = pattern.matcher(a15); Pattern pattern2 = f101578t; Matcher matcher2 = pattern2.matcher(a15); if (matcher.matches()) { try { String group = matcher.group(1); Objects.requireNonNull(group); f14 = Float.parseFloat(group) / 100.0f; String group2 = matcher.group(2); Objects.requireNonNull(group2); f15 = Float.parseFloat(group2) / 100.0f; } catch (NumberFormatException unused) { if (a15.length() != 0) { "Ignoring region with malformed origin: ".concat(a15); } } } else if (matcher2.matches()) { if (cVar != null) { try { String group3 = matcher2.group(1); Objects.requireNonNull(group3); int parseInt = Integer.parseInt(group3); String group4 = matcher2.group(2); Objects.requireNonNull(group4); int parseInt2 = Integer.parseInt(group4); float f19 = ((float) parseInt) / ((float) cVar.f101587a); float f24 = ((float) parseInt2) / ((float) cVar.f101588b); f14 = f19; f15 = f24; } catch (NumberFormatException unused2) { if (a15.length() != 0) { "Ignoring region with malformed origin: ".concat(a15); } } } else if (a15.length() != 0) { "Ignoring region with missing tts:extent: ".concat(a15); } } else if (a15.length() != 0) { "Ignoring region with unsupported origin: ".concat(a15); } String a19 = l0.a(xmlPullParser, TtmlNode.ATTR_TTS_EXTENT); if (a19 != null) { Matcher matcher3 = pattern.matcher(a19); Matcher matcher4 = pattern2.matcher(a19); if (matcher3.matches()) { try { String group5 = matcher3.group(1); Objects.requireNonNull(group5); float parseFloat = Float.parseFloat(group5) / 100.0f; String group6 = matcher3.group(2); Objects.requireNonNull(group6); f16 = Float.parseFloat(group6) / 100.0f; f17 = parseFloat; } catch (NumberFormatException unused3) { if (a15.length() != 0) { "Ignoring region with malformed extent: ".concat(a15); } } } else if (matcher4.matches()) { if (cVar != null) { try { String group7 = matcher4.group(1); Objects.requireNonNull(group7); int parseInt3 = Integer.parseInt(group7); String group8 = matcher4.group(2); Objects.requireNonNull(group8); float parseInt4 = (float) Integer.parseInt(group8); f17 = ((float) parseInt3) / ((float) cVar.f101587a); f16 = parseInt4 / ((float) cVar.f101588b); } catch (NumberFormatException unused4) { if (a15.length() != 0) { "Ignoring region with malformed extent: ".concat(a15); } } } else if (a15.length() != 0) { "Ignoring region with missing tts:extent: ".concat(a15); } } else if (a15.length() != 0) { "Ignoring region with unsupported extent: ".concat(a15); } String a24 = l0.a(xmlPullParser, TtmlNode.ATTR_TTS_DISPLAY_ALIGN); if (a24 != null) { String r8 = s3.a.r(a24); Objects.requireNonNull(r8); if (r8.equals(TtmlNode.CENTER)) { f18 = (f16 / 2.0f) + f15; i14 = 1; } else if (r8.equals("after")) { f18 = f15 + f16; i14 = 2; } float f25 = 1.0f / ((float) aVar.f101583a); a16 = l0.a(xmlPullParser, "writingMode"); if (a16 != null) { String r14 = s3.a.r(a16); Objects.requireNonNull(r14); switch (r14.hashCode()) { case 3694: if (r14.equals("tb")) { z14 = false; break; } z14 = true; break; case 3553396: if (r14.equals("tblr")) { z14 = true; break; } z14 = true; break; case 3553576: if (r14.equals("tbrl")) { z14 = true; break; } z14 = true; break; default: z14 = true; break; } switch (z14) { case false: case true: i15 = 2; break; case true: i15 = 1; break; } eVar = new e(a18, f14, f18, 0, i14, f17, f16, 1, f25, i15); if (eVar != null) { map2.put(eVar.f101602a, eVar); } } i15 = Integer.MIN_VALUE; eVar = new e(a18, f14, f18, 0, i14, f17, f16, 1, f25, i15); if (eVar != null) { } } f18 = f15; i14 = 0; float f252 = 1.0f / ((float) aVar.f101583a); a16 = l0.a(xmlPullParser, "writingMode"); if (a16 != null) { } i15 = Integer.MIN_VALUE; eVar = new e(a18, f14, f18, 0, i14, f17, f16, 1, f252, i15); if (eVar != null) { } } } eVar = null; if (eVar != null) { } } else if (l0.c(xmlPullParser, "metadata")) { do { xmlPullParser.next(); if (l0.c(xmlPullParser, TtmlNode.TAG_IMAGE) && (a14 = l0.a(xmlPullParser, TtmlNode.ATTR_ID)) != null) { map3.put(a14, xmlPullParser.nextText()); } } while (!l0.b(xmlPullParser, "metadata")); } } while (!l0.b(xmlPullParser, "head")); return map; } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ public static d n(XmlPullParser xmlPullParser, d dVar, Map<String, e> map, b bVar) throws h { long j14; long j15; char c14; XmlPullParser xmlPullParser2 = xmlPullParser; int attributeCount = xmlPullParser.getAttributeCount(); f o14 = o(xmlPullParser2, null); String str = null; String str2 = ""; long j16 = C.TIME_UNSET; long j17 = C.TIME_UNSET; long j18 = C.TIME_UNSET; String[] strArr = null; int i14 = 0; while (i14 < attributeCount) { String attributeName = xmlPullParser2.getAttributeName(i14); String attributeValue = xmlPullParser2.getAttributeValue(i14); Objects.requireNonNull(attributeName); switch (attributeName.hashCode()) { case -934795532: if (attributeName.equals("region")) { c14 = 0; break; } c14 = 65535; break; case 99841: if (attributeName.equals("dur")) { c14 = 1; break; } c14 = 65535; break; case 100571: if (attributeName.equals(TtmlNode.END)) { c14 = 2; break; } c14 = 65535; break; case 93616297: if (attributeName.equals("begin")) { c14 = 3; break; } c14 = 65535; break; case 109780401: if (attributeName.equals("style")) { c14 = 4; break; } c14 = 65535; break; case 1292595405: if (attributeName.equals("backgroundImage")) { c14 = 5; break; } c14 = 65535; break; default: c14 = 65535; break; } if (c14 != 0) { if (c14 == 1) { j18 = q(attributeValue, bVar); } else if (c14 == 2) { j17 = q(attributeValue, bVar); } else if (c14 == 3) { j16 = q(attributeValue, bVar); } else if (c14 == 4) { String[] p14 = p(attributeValue); if (p14.length > 0) { strArr = p14; } } else if (c14 == 5 && attributeValue.startsWith("#")) { str = attributeValue.substring(1); } } else if (map.containsKey(attributeValue)) { str2 = attributeValue; } i14++; xmlPullParser2 = xmlPullParser; } if (dVar != null) { long j19 = dVar.f101592d; j14 = C.TIME_UNSET; if (j19 != C.TIME_UNSET) { if (j16 != C.TIME_UNSET) { j16 += j19; } if (j17 != C.TIME_UNSET) { j17 += j19; } } } else { j14 = C.TIME_UNSET; } if (j17 == j14) { if (j18 != j14) { j15 = j16 + j18; } else if (dVar != null) { long j24 = dVar.f101593e; if (j24 != j14) { j15 = j24; } } return new d(xmlPullParser.getName(), null, j16, j15, o14, strArr, str2, str, dVar); } j15 = j17; return new d(xmlPullParser.getName(), null, j16, j15, o14, 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:101:0x01dd, code lost: if (r5.equals("auto") != false) goto L_0x01e1; */ /* JADX WARNING: Code restructure failed: missing block: B:184:0x0358, code lost: if (r5.equals("text") == false) goto L_0x0350; */ /* JADX WARNING: Code restructure failed: missing block: B:213:0x03f0, code lost: if (r5.equals(ai.clova.cic.clientlib.exoplayer2.text.ttml.TtmlNode.LINETHROUGH) == false) goto L_0x03e8; */ /* JADX WARNING: Removed duplicated region for block: B:104:0x01e4 */ /* JADX WARNING: Removed duplicated region for block: B:106:0x01eb */ /* JADX WARNING: Removed duplicated region for block: B:124:0x023d */ /* JADX WARNING: Removed duplicated region for block: B:125:0x023f */ /* JADX WARNING: Removed duplicated region for block: B:128:0x0251 */ /* JADX WARNING: Removed duplicated region for block: B:138:0x0270 */ /* JADX WARNING: Removed duplicated region for block: B:142:0x0279 */ /* JADX WARNING: Removed duplicated region for block: B:144:0x027d */ /* JADX WARNING: Removed duplicated region for block: B:87:0x01a0 */ /* JADX WARNING: Removed duplicated region for block: B:90:0x01a6 */ /* JADX WARNING: Removed duplicated region for block: B:93:0x01b5 */ public static f o(XmlPullParser xmlPullParser, f fVar) { char c14; char c15; j2.a aVar; b bVar; Object[] objArr; int hashCode; int attributeCount = xmlPullParser.getAttributeCount(); f fVar2 = fVar; for (int i14 = 0; i14 < attributeCount; i14++) { String attributeValue = xmlPullParser.getAttributeValue(i14); String attributeName = xmlPullParser.getAttributeName(i14); Objects.requireNonNull(attributeName); char c16 = 5; int i15 = 3; int i16 = -1; boolean z14 = true; switch (attributeName.hashCode()) { case -1550943582: if (attributeName.equals(TtmlNode.ATTR_TTS_FONT_STYLE)) { c14 = 0; break; } c14 = 65535; break; case -1224696685: if (attributeName.equals(TtmlNode.ATTR_TTS_FONT_FAMILY)) { c14 = 1; break; } c14 = 65535; break; case -1065511464: if (attributeName.equals(TtmlNode.ATTR_TTS_TEXT_ALIGN)) { c14 = 2; break; } c14 = 65535; break; case -879295043: if (attributeName.equals(TtmlNode.ATTR_TTS_TEXT_DECORATION)) { c14 = 3; break; } c14 = 65535; break; case -734428249: if (attributeName.equals(TtmlNode.ATTR_TTS_FONT_WEIGHT)) { c14 = 4; break; } c14 = 65535; break; case 3355: if (attributeName.equals(TtmlNode.ATTR_ID)) { c14 = 5; break; } c14 = 65535; break; case 3511770: if (attributeName.equals("ruby")) { c14 = 6; break; } c14 = 65535; break; case 94842723: if (attributeName.equals(TtmlNode.ATTR_TTS_COLOR)) { c14 = 7; break; } c14 = 65535; break; case 109403361: if (attributeName.equals("shear")) { c14 = '\b'; break; } c14 = 65535; break; case 110138194: if (attributeName.equals("textCombine")) { c14 = '\t'; break; } c14 = 65535; break; case 365601008: if (attributeName.equals(TtmlNode.ATTR_TTS_FONT_SIZE)) { c14 = '\n'; break; } c14 = 65535; break; case 921125321: if (attributeName.equals("textEmphasis")) { c14 = 11; break; } c14 = 65535; break; case 1115953443: if (attributeName.equals("rubyPosition")) { c14 = '\f'; break; } c14 = 65535; break; case 1287124693: if (attributeName.equals(TtmlNode.ATTR_TTS_BACKGROUND_COLOR)) { c14 = '\r'; break; } c14 = 65535; break; case 1754920356: if (attributeName.equals("multiRowAlign")) { c14 = 14; break; } c14 = 65535; break; default: c14 = 65535; break; } switch (c14) { case 0: fVar2 = g(fVar2); fVar2.f101620i = TtmlNode.ITALIC.equalsIgnoreCase(attributeValue) ? 1 : 0; break; case 1: fVar2 = g(fVar2); fVar2.f101612a = attributeValue; break; case 2: fVar2 = g(fVar2); fVar2.f101626o = i(attributeValue); break; case 3: String r8 = s3.a.r(attributeValue); Objects.requireNonNull(r8); switch (r8.hashCode()) { case -1461280213: if (r8.equals(TtmlNode.NO_UNDERLINE)) { i15 = 0; break; } i15 = -1; break; case -1026963764: if (r8.equals(TtmlNode.UNDERLINE)) { i15 = 1; break; } i15 = -1; break; case 913457136: if (r8.equals(TtmlNode.NO_LINETHROUGH)) { i15 = 2; break; } i15 = -1; break; case 1679736913: break; default: i15 = -1; break; } switch (i15) { case 0: fVar2 = g(fVar2); fVar2.f101618g = 0; continue; case 1: fVar2 = g(fVar2); fVar2.f101618g = 1; continue; case 2: fVar2 = g(fVar2); fVar2.f101617f = 0; continue; case 3: fVar2 = g(fVar2); fVar2.f101617f = 1; continue; } case 4: fVar2 = g(fVar2); fVar2.f101619h = TtmlNode.BOLD.equalsIgnoreCase(attributeValue) ? 1 : 0; break; case 5: if ("style".equals(xmlPullParser.getName())) { fVar2 = g(fVar2); fVar2.f101623l = attributeValue; break; } else { break; } case 6: String r14 = s3.a.r(attributeValue); Objects.requireNonNull(r14); switch (r14.hashCode()) { case -618561360: if (r14.equals("baseContainer")) { c16 = 0; break; } c16 = 65535; break; case -410956671: if (r14.equals("container")) { c16 = 1; break; } c16 = 65535; break; case -250518009: if (r14.equals("delimiter")) { c16 = 2; break; } c16 = 65535; break; case -136074796: if (r14.equals("textContainer")) { c16 = 3; break; } c16 = 65535; break; case 3016401: if (r14.equals("base")) { c16 = 4; break; } c16 = 65535; break; case 3556653: break; default: c16 = 65535; break; } switch (c16) { case 0: case 4: fVar2 = g(fVar2); fVar2.f101624m = 2; continue; case 1: fVar2 = g(fVar2); fVar2.f101624m = 1; continue; case 2: fVar2 = g(fVar2); fVar2.f101624m = 4; continue; case 3: case 5: fVar2 = g(fVar2); fVar2.f101624m = 3; continue; } case 7: fVar2 = g(fVar2); try { fVar2.f101613b = d.a(attributeValue, false); fVar2.f101614c = true; break; } catch (IllegalArgumentException unused) { String valueOf = String.valueOf(attributeValue); if (valueOf.length() != 0) { "Failed parsing color value: ".concat(valueOf); break; } else { break; } } case '\b': f g14 = g(fVar2); Matcher matcher = f101576r.matcher(attributeValue); float f14 = Float.MAX_VALUE; if (!matcher.matches()) { String valueOf2 = String.valueOf(attributeValue); if (valueOf2.length() != 0) { "Invalid value for shear: ".concat(valueOf2); } } else { try { String group = matcher.group(1); Objects.requireNonNull(group); f14 = Math.min(100.0f, Math.max(-100.0f, Float.parseFloat(group))); } catch (NumberFormatException e14) { String valueOf3 = String.valueOf(attributeValue); q.a(valueOf3.length() != 0 ? "Failed to parse shear: ".concat(valueOf3) : new String("Failed to parse shear: "), e14); } } g14.f101630s = f14; fVar2 = g14; break; case '\t': String r15 = s3.a.r(attributeValue); Objects.requireNonNull(r15); if (!r15.equals("all")) { if (!r15.equals(NetworkManager.TYPE_NONE)) { break; } else { fVar2 = g(fVar2); fVar2.f101628q = 0; break; } } else { fVar2 = g(fVar2); fVar2.f101628q = 1; break; } case '\n': try { fVar2 = g(fVar2); k(attributeValue, fVar2); break; } catch (h unused2) { String valueOf4 = String.valueOf(attributeValue); if (valueOf4.length() != 0) { "Failed parsing fontSize value: ".concat(valueOf4); break; } else { break; } } case 11: fVar2 = g(fVar2); Pattern pattern = b.f101565d; b bVar2 = null; if (attributeValue != null) { String r16 = s3.a.r(attributeValue.trim()); if (!r16.isEmpty()) { v0 E = v0.E(TextUtils.split(r16, b.f101565d)); String str = (String) a1.b(j2.d(b.f101569h, E), "outside"); int hashCode2 = str.hashCode(); if (hashCode2 != -1392885889) { if (hashCode2 != -1106037339) { if (hashCode2 == 92734940 && str.equals("after")) { c15 = 0; int i17 = c15 == 0 ? c15 != 1 ? 1 : -2 : 2; aVar = (j2.a) j2.d(b.f101566e, E); if (aVar.isEmpty()) { String str2 = (String) new i2(aVar).next(); int hashCode3 = str2.hashCode(); if (hashCode3 == 3005871) { break; } else if (hashCode3 == 3387192 && str2.equals(NetworkManager.TYPE_NONE)) { z14 = false; if (!z14) { i16 = 0; } bVar = new b(i16, 0, i17); } z14 = true; if (!z14) { } bVar = new b(i16, 0, i17); } else { j2.e d14 = j2.d(b.f101568g, E); j2.e d15 = j2.d(b.f101567f, E); if (!((j2.a) d14).isEmpty() || !((j2.a) d15).isEmpty()) { String str3 = (String) a1.b(d14, "filled"); int hashCode4 = str3.hashCode(); if (hashCode4 != -1274499742) { if (hashCode4 == 3417674 && str3.equals("open")) { objArr = null; int i18 = objArr != null ? 1 : 2; String str4 = (String) a1.b(d15, "circle"); hashCode = str4.hashCode(); if (hashCode != -1360216880) { if (hashCode != -905816648) { if (hashCode == 99657 && str4.equals("dot")) { i16 = 0; } } else if (str4.equals("sesame")) { i16 = 1; } } else if (str4.equals("circle")) { i16 = 2; } if (i16 == 0) { i15 = 2; } else if (i16 != 1) { i15 = 1; } bVar = new b(i15, i18, i17); } } else if (str3.equals("filled")) { objArr = 1; if (objArr != null) { } String str42 = (String) a1.b(d15, "circle"); hashCode = str42.hashCode(); if (hashCode != -1360216880) { } if (i16 == 0) { } bVar = new b(i15, i18, i17); } objArr = -1; if (objArr != null) { } String str422 = (String) a1.b(d15, "circle"); hashCode = str422.hashCode(); if (hashCode != -1360216880) { } if (i16 == 0) { } bVar = new b(i15, i18, i17); } else { bVar = new b(-1, 0, i17); } } bVar2 = bVar; } } else if (str.equals("outside")) { c15 = 1; if (c15 == 0) { } aVar = (j2.a) j2.d(b.f101566e, E); if (aVar.isEmpty()) { } bVar2 = bVar; } } else if (str.equals("before")) { c15 = 2; if (c15 == 0) { } aVar = (j2.a) j2.d(b.f101566e, E); if (aVar.isEmpty()) { } bVar2 = bVar; } c15 = 65535; if (c15 == 0) { } aVar = (j2.a) j2.d(b.f101566e, E); if (aVar.isEmpty()) { } bVar2 = bVar; } } fVar2.f101629r = bVar2; break; case '\f': String r17 = s3.a.r(attributeValue); Objects.requireNonNull(r17); if (!r17.equals("before")) { if (!r17.equals("after")) { break; } else { fVar2 = g(fVar2); fVar2.f101625n = 2; break; } } else { fVar2 = g(fVar2); fVar2.f101625n = 1; break; } case '\r': fVar2 = g(fVar2); try { fVar2.f101615d = d.a(attributeValue, false); fVar2.f101616e = true; break; } catch (IllegalArgumentException unused3) { String valueOf5 = String.valueOf(attributeValue); if (valueOf5.length() != 0) { "Failed parsing background value: ".concat(valueOf5); break; } else { break; } } case 14: fVar2 = g(fVar2); fVar2.f101627p = i(attributeValue); break; } } return fVar2; } public static String[] p(String str) { String trim = str.trim(); if (trim.isEmpty()) { return new String[0]; } int i14 = k0.f136472a; return trim.split("\\s+", -1); } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARNING: Code restructure failed: missing block: B:21:0x00aa, code lost: if (r13.equals("ms") == false) goto L_0x00a2; */ public static long q(String str, b bVar) throws h { double d14; double d15; Matcher matcher = f101573o.matcher(str); char c14 = 4; if (matcher.matches()) { String group = matcher.group(1); Objects.requireNonNull(group); String group2 = matcher.group(2); Objects.requireNonNull(group2); String group3 = matcher.group(3); Objects.requireNonNull(group3); double parseLong = ((double) (Long.parseLong(group) * 3600)) + ((double) (Long.parseLong(group2) * 60)) + ((double) Long.parseLong(group3)); String group4 = matcher.group(4); double d16 = 0.0d; double parseDouble = parseLong + (group4 != null ? Double.parseDouble(group4) : 0.0d); String group5 = matcher.group(5); double parseLong2 = parseDouble + (group5 != null ? (double) (((float) Long.parseLong(group5)) / bVar.f101584a) : 0.0d); String group6 = matcher.group(6); if (group6 != null) { d16 = (((double) Long.parseLong(group6)) / ((double) bVar.f101585b)) / ((double) bVar.f101584a); } return (long) ((parseLong2 + d16) * 1000000.0d); } Matcher matcher2 = f101574p.matcher(str); if (matcher2.matches()) { String group7 = matcher2.group(1); Objects.requireNonNull(group7); double parseDouble2 = Double.parseDouble(group7); String group8 = matcher2.group(2); Objects.requireNonNull(group8); switch (group8.hashCode()) { case 102: if (group8.equals("f")) { c14 = 0; break; } c14 = 65535; break; case 104: if (group8.equals("h")) { c14 = 1; break; } c14 = 65535; break; case 109: if (group8.equals("m")) { c14 = 2; break; } c14 = 65535; break; case 116: if (group8.equals("t")) { c14 = 3; break; } c14 = 65535; break; case 3494: break; default: c14 = 65535; break; } switch (c14) { case 0: d14 = (double) bVar.f101584a; parseDouble2 /= d14; return (long) (parseDouble2 * 1000000.0d); case 1: d15 = 3600.0d; parseDouble2 *= d15; return (long) (parseDouble2 * 1000000.0d); case 2: d15 = 60.0d; parseDouble2 *= d15; return (long) (parseDouble2 * 1000000.0d); case 3: d14 = (double) bVar.f101586c; parseDouble2 /= d14; return (long) (parseDouble2 * 1000000.0d); case 4: d14 = 1000.0d; parseDouble2 /= d14; return (long) (parseDouble2 * 1000000.0d); default: return (long) (parseDouble2 * 1000000.0d); } } else { String valueOf = String.valueOf(str); throw new h(valueOf.length() != 0 ? "Malformed time expression: ".concat(valueOf) : new String("Malformed time expression: ")); } } public static C1587c r(XmlPullParser xmlPullParser) { String a14 = l0.a(xmlPullParser, TtmlNode.ATTR_TTS_EXTENT); if (a14 == null) { return null; } Matcher matcher = f101578t.matcher(a14); if (!matcher.matches()) { if (a14.length() != 0) { "Ignoring non-pixel tts extent: ".concat(a14); } return null; } try { String group = matcher.group(1); Objects.requireNonNull(group); int parseInt = Integer.parseInt(group); String group2 = matcher.group(2); Objects.requireNonNull(group2); return new C1587c(parseInt, Integer.parseInt(group2)); } catch (NumberFormatException unused) { if (a14.length() != 0) { "Ignoring malformed tts extent: ".concat(a14); } return null; } } @Override // da.e public f f(byte[] bArr, int i14, boolean z14) throws h { b bVar; try { XmlPullParser newPullParser = this.f101582n.newPullParser(); HashMap hashMap = new HashMap(); HashMap hashMap2 = new HashMap(); HashMap hashMap3 = new HashMap(); hashMap2.put("", new e("", -3.4028235E38f, -3.4028235E38f, Integer.MIN_VALUE, Integer.MIN_VALUE, -3.4028235E38f, -3.4028235E38f, Integer.MIN_VALUE, -3.4028235E38f, Integer.MIN_VALUE)); C1587c cVar = null; newPullParser.setInput(new ByteArrayInputStream(bArr, 0, i14), null); ArrayDeque arrayDeque = new ArrayDeque(); b bVar2 = f101580v; a aVar = f101581w; int i15 = 0; g gVar = null; for (int eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.getEventType()) { d dVar = (d) arrayDeque.peek(); if (i15 == 0) { String name = newPullParser.getName(); if (eventType == 2) { if ("tt".equals(name)) { bVar2 = l(newPullParser); aVar = j(newPullParser, f101581w); cVar = r(newPullParser); } if (!h(name)) { String valueOf = String.valueOf(newPullParser.getName()); if (valueOf.length() != 0) { "Ignoring unsupported tag: ".concat(valueOf); } i15++; bVar = bVar2; } else if ("head".equals(name)) { bVar = bVar2; m(newPullParser, hashMap, aVar, cVar, hashMap2, hashMap3); } else { bVar = bVar2; try { d n14 = n(newPullParser, dVar, hashMap2, bVar); arrayDeque.push(n14); if (dVar != null) { dVar.a(n14); } } catch (h e14) { q.a("Suppressing parser error", e14); i15++; } } bVar2 = bVar; cVar = cVar; aVar = aVar; } else if (eventType == 4) { Objects.requireNonNull(dVar); d b14 = d.b(newPullParser.getText()); if (dVar.f101601m == null) { dVar.f101601m = new ArrayList(); } dVar.f101601m.add(b14); } else if (eventType == 3) { if (newPullParser.getName().equals("tt")) { d dVar2 = (d) arrayDeque.peek(); Objects.requireNonNull(dVar2); gVar = new g(dVar2, hashMap, hashMap2, hashMap3); } arrayDeque.pop(); } } else if (eventType == 2) { i15++; } else if (eventType == 3) { i15--; } newPullParser.next(); } if (gVar != null) { return gVar; } throw new h("No TTML subtitles found"); } catch (XmlPullParserException e15) { throw new h("Unable to decode source", e15); } catch (IOException e16) { throw new IllegalStateException("Unexpected error when reading input.", e16); } } }