Live Football Updates v1.0.1版本的 MD5 值为:636649089335ebb37514551724606ad0

以下内容为反编译后的 d.java 源代码,内容仅作参考


package a2;

import a2.k;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Pair;
import com.google.android.gms.ads.AdRequest;
import com.google.common.collect.u;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.ironsource.q2;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import k3.i;
import n2.m;
import org.xml.sax.helpers.DefaultHandler;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import p1.n;
import p1.r;
import p1.y;
import s1.a0;
import s1.e0;
import s1.f0;
public final class d extends DefaultHandler implements m.a<c> {
    public static final Pattern f128b = Pattern.compile("(\\d+)(?:/(\\d+))?");
    public static final Pattern f129c = Pattern.compile("CC([1-4])=.*");
    public static final Pattern f130d = Pattern.compile("([1-9]|[1-5][0-9]|6[0-3])=.*");
    public static final int[] f131e = {-1, 1, 2, 3, 4, 5, 6, 8, 2, 3, 4, 7, 8, 24, 8, 12, 10, 12, 14, 12, 14};
    public final XmlPullParserFactory f132a;

    public static final class a {
        public final r f133a;
        public final u<b> f134b;
        public final k f135c;
        public final String f136d;
        public final ArrayList<n.b> f137e;
        public final ArrayList<e> f138f;
        public final long f139g = -1;
        public final List<e> f140h;
        public final List<e> i;

        public a(r rVar, List list, k kVar, String str, ArrayList arrayList, ArrayList arrayList2, ArrayList arrayList3, ArrayList arrayList4) {
            this.f133a = rVar;
            this.f134b = u.n(list);
            this.f135c = kVar;
            this.f136d = str;
            this.f137e = arrayList;
            this.f138f = arrayList2;
            this.f140h = arrayList3;
            this.i = arrayList4;
        }
    }

    public d() {
        try {
            this.f132a = XmlPullParserFactory.newInstance();
        } catch (XmlPullParserException e10) {
            throw new RuntimeException("Couldn't create XmlPullParserFactory instance", e10);
        }
    }

    public static long b(ArrayList arrayList, long j4, long j10, int i, long j11) {
        int i10;
        if (i >= 0) {
            i10 = i + 1;
        } else {
            int i11 = e0.f30451a;
            i10 = (int) ((((j11 - j4) + j10) - 1) / j10);
        }
        for (int i12 = 0; i12 < i10; i12++) {
            arrayList.add(new k.d(j4, j10));
            j4 += j10;
        }
        return j4;
    }

    public static void c(XmlPullParser xmlPullParser) throws IOException, XmlPullParserException {
        boolean z10;
        if (!f0.k(xmlPullParser)) {
            return;
        }
        int i = 1;
        while (i != 0) {
            xmlPullParser.next();
            if (f0.k(xmlPullParser)) {
                i++;
            } else {
                if (xmlPullParser.getEventType() == 3) {
                    z10 = true;
                } else {
                    z10 = false;
                }
                if (z10) {
                    i--;
                }
            }
        }
    }

    public static int d(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        boolean z10;
        int l10;
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue == null) {
            attributeValue = null;
        }
        attributeValue.getClass();
        int i = -1;
        boolean z11 = false;
        switch (attributeValue.hashCode()) {
            case -2128649360:
                if (attributeValue.equals("urn:dts:dash:audio_channel_configuration:2012")) {
                    z10 = false;
                    break;
                }
                z10 = true;
                break;
            case -1352850286:
                if (attributeValue.equals("urn:mpeg:dash:23003:3:audio_channel_configuration:2011")) {
                    z10 = true;
                    break;
                }
                z10 = true;
                break;
            case -1138141449:
                if (attributeValue.equals("tag:dolby.com,2014:dash:audio_channel_configuration:2011")) {
                    z10 = true;
                    break;
                }
                z10 = true;
                break;
            case -986633423:
                if (attributeValue.equals("urn:mpeg:mpegB:cicp:ChannelConfiguration")) {
                    z10 = true;
                    break;
                }
                z10 = true;
                break;
            case -79006963:
                if (attributeValue.equals("tag:dts.com,2014:dash:audio_channel_configuration:2012")) {
                    z10 = true;
                    break;
                }
                z10 = true;
                break;
            case 312179081:
                if (attributeValue.equals("tag:dts.com,2018:uhd:audio_channel_configuration")) {
                    z10 = true;
                    break;
                }
                z10 = true;
                break;
            case 2036691300:
                if (attributeValue.equals("urn:dolby:dash:audio_channel_configuration:2011")) {
                    z10 = true;
                    break;
                }
                z10 = true;
                break;
            default:
                z10 = true;
                break;
        }
        switch (z10) {
            case false:
            case true:
                l10 = l(xmlPullParser, q2.h.X, -1);
                if (l10 > 0) {
                    break;
                }
                break;
            case true:
                i = l(xmlPullParser, q2.h.X, -1);
                break;
            case true:
            case true:
                String attributeValue2 = xmlPullParser.getAttributeValue(null, q2.h.X);
                if (attributeValue2 != null) {
                    String y10 = androidx.lifecycle.r.y(attributeValue2);
                    y10.getClass();
                    switch (y10.hashCode()) {
                        case 1596796:
                            break;
                        case 2937391:
                            if (y10.equals("a000")) {
                                z11 = true;
                                break;
                            }
                            z11 = true;
                            break;
                        case 3094034:
                            if (y10.equals("f800")) {
                                z11 = true;
                                break;
                            }
                            z11 = true;
                            break;
                        case 3094035:
                            if (y10.equals("f801")) {
                                z11 = true;
                                break;
                            }
                            z11 = true;
                            break;
                        case 3133436:
                            if (y10.equals("fa01")) {
                                z11 = true;
                                break;
                            }
                            z11 = true;
                            break;
                        default:
                            z11 = true;
                            break;
                    }
                    switch (z11) {
                        case false:
                            i = 1;
                            break;
                        case true:
                            i = 2;
                            break;
                        case true:
                            i = 5;
                            break;
                        case true:
                            i = 6;
                            break;
                        case true:
                            l10 = 8;
                            i = l10;
                            break;
                    }
                }
                break;
            case true:
                int l11 = l(xmlPullParser, q2.h.X, -1);
                if (l11 >= 0) {
                    int[] iArr = f131e;
                    if (l11 < iArr.length) {
                        i = iArr[l11];
                        break;
                    }
                }
                break;
            case true:
                String attributeValue3 = xmlPullParser.getAttributeValue(null, q2.h.X);
                if (attributeValue3 != null) {
                    l10 = Integer.bitCount(Integer.parseInt(attributeValue3, 16));
                    break;
                }
                break;
        }
        do {
            xmlPullParser.next();
        } while (!f0.j(xmlPullParser, "AudioChannelConfiguration"));
        return i;
    }

    public static long e(XmlPullParser xmlPullParser, long j4) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "availabilityTimeOffset");
        if (attributeValue == null) {
            return j4;
        }
        if ("INF".equals(attributeValue)) {
            return Long.MAX_VALUE;
        }
        return Float.parseFloat(attributeValue) * 1000000.0f;
    }

    public static ArrayList f(XmlPullParser xmlPullParser, List list, boolean z10) throws XmlPullParserException, IOException {
        int i;
        int i10;
        boolean z11;
        String str;
        String attributeValue = xmlPullParser.getAttributeValue(null, "dvb:priority");
        if (attributeValue != null) {
            i = Integer.parseInt(attributeValue);
        } else if (z10) {
            i = 1;
        } else {
            i = Integer.MIN_VALUE;
        }
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "dvb:weight");
        if (attributeValue2 != null) {
            i10 = Integer.parseInt(attributeValue2);
        } else {
            i10 = 1;
        }
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "serviceLocation");
        String str2 = "";
        do {
            xmlPullParser.next();
            if (xmlPullParser.getEventType() == 4) {
                str2 = xmlPullParser.getText();
            } else {
                c(xmlPullParser);
            }
        } while (!f0.j(xmlPullParser, "BaseURL"));
        if (str2 != null && a0.a(str2)[0] != -1) {
            z11 = true;
        } else {
            z11 = false;
        }
        if (z11) {
            if (attributeValue3 == null) {
                attributeValue3 = str2;
            }
            return com.google.common.collect.a0.a(new b(i, str2, i10, attributeValue3));
        }
        ArrayList arrayList = new ArrayList();
        for (int i11 = 0; i11 < list.size(); i11++) {
            b bVar = (b) list.get(i11);
            String c10 = a0.c(bVar.f112a, str2);
            if (attributeValue3 == null) {
                str = c10;
            } else {
                str = attributeValue3;
            }
            if (z10) {
                i = bVar.f114c;
                i10 = bVar.f115d;
                str = bVar.f113b;
            }
            arrayList.add(new b(i, c10, i10, str));
        }
        return arrayList;
    }

    public static Pair g(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        String str;
        UUID uuid;
        byte[] bArr;
        String str2;
        boolean z10;
        i.a b10;
        UUID uuid2;
        char c10;
        UUID uuid3;
        String str3;
        n.b bVar = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue != null) {
            String y10 = androidx.lifecycle.r.y(attributeValue);
            y10.getClass();
            switch (y10.hashCode()) {
                case -1980789791:
                    if (y10.equals("urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e")) {
                        c10 = 0;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 489446379:
                    if (y10.equals("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95")) {
                        c10 = 1;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 755418770:
                    if (y10.equals("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed")) {
                        c10 = 2;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 1812765994:
                    if (y10.equals("urn:mpeg:dash:mp4protection:2011")) {
                        c10 = 3;
                        break;
                    }
                    c10 = 65535;
                    break;
                default:
                    c10 = 65535;
                    break;
            }
            switch (c10) {
                case 0:
                    uuid3 = p1.h.f27945c;
                    uuid = uuid3;
                    str = null;
                    bArr = null;
                    str2 = null;
                    break;
                case 1:
                    uuid3 = p1.h.f27947e;
                    uuid = uuid3;
                    str = null;
                    bArr = null;
                    str2 = null;
                    break;
                case 2:
                    uuid3 = p1.h.f27946d;
                    uuid = uuid3;
                    str = null;
                    bArr = null;
                    str2 = null;
                    break;
                case 3:
                    str = xmlPullParser.getAttributeValue(null, q2.h.X);
                    int attributeCount = xmlPullParser.getAttributeCount();
                    int i = 0;
                    while (true) {
                        if (i < attributeCount) {
                            String attributeName = xmlPullParser.getAttributeName(i);
                            int indexOf = attributeName.indexOf(58);
                            if (indexOf != -1) {
                                attributeName = attributeName.substring(indexOf + 1);
                            }
                            if (attributeName.equals("default_KID")) {
                                str3 = xmlPullParser.getAttributeValue(i);
                            } else {
                                i++;
                            }
                        } else {
                            str3 = null;
                        }
                    }
                    if (!TextUtils.isEmpty(str3) && !"00000000-0000-0000-0000-000000000000".equals(str3)) {
                        String[] split = str3.split("\\s+");
                        UUID[] uuidArr = new UUID[split.length];
                        for (int i10 = 0; i10 < split.length; i10++) {
                            uuidArr[i10] = UUID.fromString(split[i10]);
                        }
                        uuid = p1.h.f27944b;
                        bArr = k3.i.a(uuid, uuidArr, null);
                        str2 = null;
                        break;
                    } else {
                        s1.n.g("MpdParser", "Ignoring <ContentProtection> with schemeIdUri=\"urn:mpeg:dash:mp4protection:2011\" (ClearKey) due to missing required default_KID attribute.");
                        uuid = null;
                        bArr = null;
                        str2 = null;
                        break;
                    }
                    break;
            }
            do {
                xmlPullParser.next();
                if (!f0.l(xmlPullParser, "clearkey:Laurl") && xmlPullParser.next() == 4) {
                    str2 = xmlPullParser.getText();
                } else if (!f0.l(xmlPullParser, "ms:laurl")) {
                    str2 = xmlPullParser.getAttributeValue(null, "licenseUrl");
                } else {
                    if (bArr == null) {
                        if (f0.k(xmlPullParser)) {
                            String name = xmlPullParser.getName();
                            int indexOf2 = name.indexOf(58);
                            if (indexOf2 != -1) {
                                name = name.substring(indexOf2 + 1);
                            }
                            if (name.equals("pssh")) {
                                z10 = true;
                                if (z10 && xmlPullParser.next() == 4) {
                                    byte[] decode = Base64.decode(xmlPullParser.getText(), 0);
                                    b10 = k3.i.b(decode);
                                    if (b10 != null) {
                                        uuid2 = null;
                                    } else {
                                        uuid2 = b10.f25494a;
                                    }
                                    if (uuid2 != null) {
                                        s1.n.g("MpdParser", "Skipping malformed cenc:pssh data");
                                        uuid = uuid2;
                                        bArr = null;
                                    } else {
                                        UUID uuid4 = uuid2;
                                        bArr = decode;
                                        uuid = uuid4;
                                    }
                                }
                            }
                        }
                        z10 = false;
                        if (z10) {
                            byte[] decode2 = Base64.decode(xmlPullParser.getText(), 0);
                            b10 = k3.i.b(decode2);
                            if (b10 != null) {
                            }
                            if (uuid2 != null) {
                            }
                        }
                    }
                    if (bArr == null) {
                        UUID uuid5 = p1.h.f27947e;
                        if (uuid5.equals(uuid) && f0.l(xmlPullParser, "mspr:pro") && xmlPullParser.next() == 4) {
                            bArr = k3.i.a(uuid5, null, Base64.decode(xmlPullParser.getText(), 0));
                        }
                    }
                    c(xmlPullParser);
                }
            } while (!f0.j(xmlPullParser, "ContentProtection"));
            if (uuid != null) {
                bVar = new n.b(uuid, str2, "video/mp4", bArr);
            }
            return Pair.create(str, bVar);
        }
        str = null;
        uuid = null;
        bArr = null;
        str2 = null;
        do {
            xmlPullParser.next();
            if (!f0.l(xmlPullParser, "clearkey:Laurl")) {
            }
            if (!f0.l(xmlPullParser, "ms:laurl")) {
            }
        } while (!f0.j(xmlPullParser, "ContentProtection"));
        if (uuid != null) {
        }
        return Pair.create(str, bVar);
    }

    public static int h(XmlPullParser xmlPullParser) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "contentType");
        if (!TextUtils.isEmpty(attributeValue)) {
            if ("audio".equals(attributeValue)) {
                return 1;
            }
            if ("video".equals(attributeValue)) {
                return 2;
            }
            if (q2.h.K0.equals(attributeValue)) {
                return 3;
            }
            if ("image".equals(attributeValue)) {
                return 4;
            }
        }
        return -1;
    }

    public static e i(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String str2 = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue == null) {
            attributeValue = "";
        }
        String attributeValue2 = xmlPullParser.getAttributeValue(null, q2.h.X);
        if (attributeValue2 == null) {
            attributeValue2 = null;
        }
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "id");
        if (attributeValue3 != null) {
            str2 = attributeValue3;
        }
        do {
            xmlPullParser.next();
        } while (!f0.j(xmlPullParser, str));
        return new e(attributeValue, attributeValue2, str2);
    }

    public static long j(XmlPullParser xmlPullParser, String str, long j4) {
        double d10;
        double d11;
        double d12;
        double d13;
        double d14;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue == null) {
            return j4;
        }
        Matcher matcher = e0.i.matcher(attributeValue);
        if (matcher.matches()) {
            boolean isEmpty = true ^ TextUtils.isEmpty(matcher.group(1));
            String group = matcher.group(3);
            double d15 = 0.0d;
            if (group != null) {
                d10 = Double.parseDouble(group) * 3.1556908E7d;
            } else {
                d10 = 0.0d;
            }
            String group2 = matcher.group(5);
            if (group2 != null) {
                d11 = Double.parseDouble(group2) * 2629739.0d;
            } else {
                d11 = 0.0d;
            }
            double d16 = d10 + d11;
            String group3 = matcher.group(7);
            if (group3 != null) {
                d12 = Double.parseDouble(group3) * 86400.0d;
            } else {
                d12 = 0.0d;
            }
            double d17 = d16 + d12;
            String group4 = matcher.group(10);
            if (group4 != null) {
                d13 = Double.parseDouble(group4) * 3600.0d;
            } else {
                d13 = 0.0d;
            }
            double d18 = d17 + d13;
            String group5 = matcher.group(12);
            if (group5 != null) {
                d14 = Double.parseDouble(group5) * 60.0d;
            } else {
                d14 = 0.0d;
            }
            double d19 = d18 + d14;
            String group6 = matcher.group(14);
            if (group6 != null) {
                d15 = Double.parseDouble(group6);
            }
            long j10 = (long) ((d19 + d15) * 1000.0d);
            if (isEmpty) {
                return -j10;
            }
            return j10;
        }
        return (long) (Double.parseDouble(attributeValue) * 3600.0d * 1000.0d);
    }

    public static float k(XmlPullParser xmlPullParser, float f10) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "frameRate");
        if (attributeValue != null) {
            Matcher matcher = f128b.matcher(attributeValue);
            if (matcher.matches()) {
                int parseInt = Integer.parseInt(matcher.group(1));
                String group = matcher.group(2);
                if (!TextUtils.isEmpty(group)) {
                    return parseInt / Integer.parseInt(group);
                }
                return parseInt;
            }
            return f10;
        }
        return f10;
    }

    public static int l(XmlPullParser xmlPullParser, String str, int i) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue != null) {
            return Integer.parseInt(attributeValue);
        }
        return i;
    }

    public static long m(XmlPullParser xmlPullParser, String str, long j4) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue != null) {
            return Long.parseLong(attributeValue);
        }
        return j4;
    }

    public static a2.c n(org.xmlpull.v1.XmlPullParser r149, android.net.Uri r150) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException {
        throw new UnsupportedOperationException("Method not decompiled: a2.d.n(org.xmlpull.v1.XmlPullParser, android.net.Uri):a2.c");
    }

    public static i o(XmlPullParser xmlPullParser, String str, String str2) {
        long j4;
        long j10;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        String attributeValue2 = xmlPullParser.getAttributeValue(null, str2);
        if (attributeValue2 != null) {
            String[] split = attributeValue2.split("-");
            j4 = Long.parseLong(split[0]);
            if (split.length == 2) {
                j10 = (Long.parseLong(split[1]) - j4) + 1;
                return new i(j4, j10, attributeValue);
            }
        } else {
            j4 = 0;
        }
        j10 = -1;
        return new i(j4, j10, attributeValue);
    }

    public static int p(String str) {
        if (str == null) {
            return 0;
        }
        char c10 = 65535;
        switch (str.hashCode()) {
            case -2060497896:
                if (str.equals("subtitle")) {
                    c10 = 0;
                    break;
                }
                break;
            case -1724546052:
                if (str.equals("description")) {
                    c10 = 1;
                    break;
                }
                break;
            case -1580883024:
                if (str.equals("enhanced-audio-intelligibility")) {
                    c10 = 2;
                    break;
                }
                break;
            case -1574842690:
                if (str.equals("forced_subtitle")) {
                    c10 = 3;
                    break;
                }
                break;
            case -1408024454:
                if (str.equals("alternate")) {
                    c10 = 4;
                    break;
                }
                break;
            case -1396432756:
                if (str.equals("forced-subtitle")) {
                    c10 = 5;
                    break;
                }
                break;
            case 99825:
                if (str.equals("dub")) {
                    c10 = 6;
                    break;
                }
                break;
            case 3343801:
                if (str.equals(q2.h.Z)) {
                    c10 = 7;
                    break;
                }
                break;
            case 3530173:
                if (str.equals("sign")) {
                    c10 = '\b';
                    break;
                }
                break;
            case 552573414:
                if (str.equals("caption")) {
                    c10 = '\t';
                    break;
                }
                break;
            case 899152809:
                if (str.equals("commentary")) {
                    c10 = '\n';
                    break;
                }
                break;
            case 1629013393:
                if (str.equals("emergency")) {
                    c10 = 11;
                    break;
                }
                break;
            case 1855372047:
                if (str.equals("supplementary")) {
                    c10 = '\f';
                    break;
                }
                break;
        }
        switch (c10) {
            case 0:
            case 3:
            case 5:
                return 128;
            case 1:
                return AdRequest.MAX_CONTENT_URL_LENGTH;
            case 2:
                return com.ironsource.mediationsdk.metadata.a.f19349m;
            case 4:
                return 2;
            case 6:
                return 16;
            case 7:
                return 1;
            case '\b':
                return 256;
            case '\t':
                return 64;
            case '\n':
                return 8;
            case 11:
                return 32;
            case '\f':
                return 4;
            default:
                return 0;
        }
    }

    public static int q(ArrayList arrayList) {
        int i = 0;
        for (int i10 = 0; i10 < arrayList.size(); i10++) {
            if (androidx.lifecycle.r.i("http://dashif.org/guidelines/trickmode", ((e) arrayList.get(i10)).f141a)) {
                i |= 16384;
            }
        }
        return i;
    }

    public static k.e r(XmlPullParser xmlPullParser, k.e eVar) throws XmlPullParserException, IOException {
        long j4;
        long j10;
        long j11;
        long j12;
        long j13;
        if (eVar != null) {
            j4 = eVar.f172b;
        } else {
            j4 = 1;
        }
        long m10 = m(xmlPullParser, "timescale", j4);
        long j14 = 0;
        if (eVar != null) {
            j10 = eVar.f173c;
        } else {
            j10 = 0;
        }
        long m11 = m(xmlPullParser, "presentationTimeOffset", j10);
        if (eVar != null) {
            j11 = eVar.f185d;
        } else {
            j11 = 0;
        }
        if (eVar != null) {
            j14 = eVar.f186e;
        }
        i iVar = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "indexRange");
        if (attributeValue != null) {
            String[] split = attributeValue.split("-");
            long parseLong = Long.parseLong(split[0]);
            j12 = (Long.parseLong(split[1]) - parseLong) + 1;
            j13 = parseLong;
        } else {
            j12 = j14;
            j13 = j11;
        }
        if (eVar != null) {
            iVar = eVar.f171a;
        }
        do {
            xmlPullParser.next();
            if (f0.l(xmlPullParser, "Initialization")) {
                iVar = o(xmlPullParser, "sourceURL", "range");
            } else {
                c(xmlPullParser);
            }
        } while (!f0.j(xmlPullParser, "SegmentBase"));
        return new k.e(iVar, m10, m11, j13, j12);
    }

    public static k.b s(XmlPullParser xmlPullParser, k.b bVar, long j4, long j10, long j11, long j12, long j13) throws XmlPullParserException, IOException {
        long j14;
        long j15;
        long j16;
        long j17;
        long j18;
        List list;
        long j19 = 1;
        if (bVar != null) {
            j14 = bVar.f172b;
        } else {
            j14 = 1;
        }
        long m10 = m(xmlPullParser, "timescale", j14);
        if (bVar != null) {
            j15 = bVar.f173c;
        } else {
            j15 = 0;
        }
        long m11 = m(xmlPullParser, "presentationTimeOffset", j15);
        if (bVar != null) {
            j16 = bVar.f175e;
        } else {
            j16 = -9223372036854775807L;
        }
        long m12 = m(xmlPullParser, IronSourceConstants.EVENTS_DURATION, j16);
        if (bVar != null) {
            j19 = bVar.f174d;
        }
        long m13 = m(xmlPullParser, "startNumber", j19);
        if (j12 == -9223372036854775807L) {
            j17 = j11;
        } else {
            j17 = j12;
        }
        if (j17 == Long.MAX_VALUE) {
            j18 = -9223372036854775807L;
        } else {
            j18 = j17;
        }
        List list2 = null;
        i iVar = null;
        List list3 = null;
        do {
            xmlPullParser.next();
            if (f0.l(xmlPullParser, "Initialization")) {
                iVar = o(xmlPullParser, "sourceURL", "range");
            } else if (f0.l(xmlPullParser, "SegmentTimeline")) {
                list3 = u(xmlPullParser, m10, j10);
            } else if (f0.l(xmlPullParser, "SegmentURL")) {
                if (list2 == null) {
                    list2 = new ArrayList();
                }
                list2.add(o(xmlPullParser, q2.h.I0, "mediaRange"));
            } else {
                c(xmlPullParser);
            }
        } while (!f0.j(xmlPullParser, "SegmentList"));
        if (bVar != null) {
            if (iVar == null) {
                iVar = bVar.f171a;
            }
            if (list3 == null) {
                list3 = bVar.f176f;
            }
            if (list2 == null) {
                list = bVar.f179j;
                return new k.b(iVar, m10, m11, m13, m12, list3, j18, list, e0.Q(j13), e0.Q(j4));
            }
        }
        list = list2;
        return new k.b(iVar, m10, m11, m13, m12, list3, j18, list, e0.Q(j13), e0.Q(j4));
    }

    public static k.c t(XmlPullParser xmlPullParser, k.c cVar, List list, long j4, long j10, long j11, long j12, long j13) throws XmlPullParserException, IOException {
        long j14;
        long j15;
        long j16;
        long j17;
        long j18;
        long j19;
        n nVar;
        n nVar2;
        i iVar;
        List list2;
        long j20 = 1;
        if (cVar != null) {
            j14 = cVar.f172b;
        } else {
            j14 = 1;
        }
        long m10 = m(xmlPullParser, "timescale", j14);
        if (cVar != null) {
            j15 = cVar.f173c;
        } else {
            j15 = 0;
        }
        long m11 = m(xmlPullParser, "presentationTimeOffset", j15);
        if (cVar != null) {
            j16 = cVar.f175e;
        } else {
            j16 = -9223372036854775807L;
        }
        long m12 = m(xmlPullParser, IronSourceConstants.EVENTS_DURATION, j16);
        if (cVar != null) {
            j20 = cVar.f174d;
        }
        long m13 = m(xmlPullParser, "startNumber", j20);
        int i = 0;
        while (true) {
            if (i < list.size()) {
                e eVar = (e) list.get(i);
                if (androidx.lifecycle.r.i("http://dashif.org/guidelines/last-segment-number", eVar.f141a)) {
                    j17 = Long.parseLong(eVar.f142b);
                    break;
                }
                i++;
            } else {
                j17 = -1;
                break;
            }
        }
        long j21 = j17;
        if (j12 == -9223372036854775807L) {
            j18 = j11;
        } else {
            j18 = j12;
        }
        if (j18 == Long.MAX_VALUE) {
            j19 = -9223372036854775807L;
        } else {
            j19 = j18;
        }
        i iVar2 = null;
        if (cVar != null) {
            nVar = cVar.f181k;
        } else {
            nVar = null;
        }
        n v6 = v(xmlPullParser, q2.h.I0, nVar);
        if (cVar != null) {
            nVar2 = cVar.f180j;
        } else {
            nVar2 = null;
        }
        n v10 = v(xmlPullParser, "initialization", nVar2);
        List list3 = null;
        do {
            xmlPullParser.next();
            if (f0.l(xmlPullParser, "Initialization")) {
                iVar2 = o(xmlPullParser, "sourceURL", "range");
            } else if (f0.l(xmlPullParser, "SegmentTimeline")) {
                list3 = u(xmlPullParser, m10, j10);
            } else {
                c(xmlPullParser);
            }
        } while (!f0.j(xmlPullParser, "SegmentTemplate"));
        if (cVar != null) {
            if (iVar2 == null) {
                iVar2 = cVar.f171a;
            }
            if (list3 == null) {
                list2 = cVar.f176f;
                iVar = iVar2;
                return new k.c(iVar, m10, m11, m13, j21, m12, list2, j19, v10, v6, e0.Q(j13), e0.Q(j4));
            }
        }
        iVar = iVar2;
        list2 = list3;
        return new k.c(iVar, m10, m11, m13, j21, m12, list2, j19, v10, v6, e0.Q(j13), e0.Q(j4));
    }

    public static ArrayList u(XmlPullParser xmlPullParser, long j4, long j10) throws XmlPullParserException, IOException {
        ArrayList arrayList = new ArrayList();
        long j11 = 0;
        long j12 = -9223372036854775807L;
        boolean z10 = false;
        int i = 0;
        do {
            xmlPullParser.next();
            if (f0.l(xmlPullParser, "S")) {
                long m10 = m(xmlPullParser, "t", -9223372036854775807L);
                if (z10) {
                    j11 = b(arrayList, j11, j12, i, m10);
                }
                if (m10 == -9223372036854775807L) {
                    m10 = j11;
                }
                long m11 = m(xmlPullParser, "d", -9223372036854775807L);
                i = l(xmlPullParser, "r", 0);
                z10 = true;
                j12 = m11;
                j11 = m10;
            } else {
                c(xmlPullParser);
            }
        } while (!f0.j(xmlPullParser, "SegmentTimeline"));
        if (z10) {
            b(arrayList, j11, j12, i, e0.X(j10, j4, 1000L));
        }
        return arrayList;
    }

    public static n v(XmlPullParser xmlPullParser, String str, n nVar) {
        String str2;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue != null) {
            ArrayList arrayList = new ArrayList();
            ArrayList arrayList2 = new ArrayList();
            ArrayList arrayList3 = new ArrayList();
            arrayList.add("");
            int i = 0;
            while (i < attributeValue.length()) {
                int indexOf = attributeValue.indexOf("$", i);
                char c10 = 65535;
                if (indexOf == -1) {
                    arrayList.set(arrayList2.size(), ((String) arrayList.get(arrayList2.size())) + attributeValue.substring(i));
                    i = attributeValue.length();
                } else if (indexOf != i) {
                    arrayList.set(arrayList2.size(), ((String) arrayList.get(arrayList2.size())) + attributeValue.substring(i, indexOf));
                    i = indexOf;
                } else if (attributeValue.startsWith("$$", i)) {
                    arrayList.set(arrayList2.size(), ((String) arrayList.get(arrayList2.size())) + "$");
                    i += 2;
                } else {
                    arrayList3.add("");
                    int i10 = i + 1;
                    int indexOf2 = attributeValue.indexOf("$", i10);
                    String substring = attributeValue.substring(i10, indexOf2);
                    if (substring.equals("RepresentationID")) {
                        arrayList2.add(1);
                    } else {
                        int indexOf3 = substring.indexOf("%0");
                        if (indexOf3 != -1) {
                            str2 = substring.substring(indexOf3);
                            if (!str2.endsWith("d") && !str2.endsWith("x") && !str2.endsWith("X")) {
                                str2 = str2.concat("d");
                            }
                            substring = substring.substring(0, indexOf3);
                        } else {
                            str2 = "%01d";
                        }
                        substring.getClass();
                        switch (substring.hashCode()) {
                            case -1950496919:
                                if (substring.equals("Number")) {
                                    c10 = 0;
                                    break;
                                }
                                break;
                            case 2606829:
                                if (substring.equals("Time")) {
                                    c10 = 1;
                                    break;
                                }
                                break;
                            case 38199441:
                                if (substring.equals("Bandwidth")) {
                                    c10 = 2;
                                    break;
                                }
                                break;
                        }
                        switch (c10) {
                            case 0:
                                arrayList2.add(2);
                                break;
                            case 1:
                                arrayList2.add(4);
                                break;
                            case 2:
                                arrayList2.add(3);
                                break;
                            default:
                                throw new IllegalArgumentException("Invalid template: ".concat(attributeValue));
                        }
                        arrayList3.set(arrayList2.size() - 1, str2);
                    }
                    arrayList.add("");
                    i = indexOf2 + 1;
                }
            }
            return new n(arrayList, arrayList2, arrayList3);
        }
        return nVar;
    }

    @Override
    public final Object a(Uri uri, u1.g gVar) throws IOException {
        try {
            XmlPullParser newPullParser = this.f132a.newPullParser();
            newPullParser.setInput(gVar, null);
            if (newPullParser.next() == 2 && "MPD".equals(newPullParser.getName())) {
                return n(newPullParser, uri);
            }
            throw y.b("inputStream does not contain a valid media presentation description", null);
        } catch (XmlPullParserException e10) {
            throw y.b(null, e10);
        }
    }
}