package p138.p176.p177.p190.p210.p213;

import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p190.p210.C3710;
import p138.p176.p177.p190.p210.C3717;
import p138.p176.p177.p190.p210.InterfaceC3714;
import p138.p176.p177.p190.p239.C4150;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ഺ.އ.֏, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C3728 implements InterfaceC3714 {

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public static final Pattern f11474 = Pattern.compile("(.+?)='(.*?)';", 32);

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final CharsetDecoder f11475 = Charset.forName("UTF-8").newDecoder();

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final CharsetDecoder f11476 = Charset.forName("ISO-8859-1").newDecoder();

    @Override // p138.p176.p177.p190.p210.InterfaceC3714
    /* JADX INFO: renamed from: ֏ */
    public C3710 mo6059(C3717 c3717) {
        String string;
        ByteBuffer byteBuffer = c3717.f10461;
        C0567.m1856(byteBuffer);
        String str = null;
        try {
            string = this.f11475.decode(byteBuffer).toString();
        } catch (CharacterCodingException unused) {
            try {
                string = this.f11476.decode(byteBuffer).toString();
                this.f11476.reset();
                byteBuffer.rewind();
            } catch (CharacterCodingException unused2) {
                this.f11476.reset();
                byteBuffer.rewind();
                string = null;
            } catch (Throwable th) {
                this.f11476.reset();
                byteBuffer.rewind();
                throw th;
            }
        } finally {
            this.f11475.reset();
            byteBuffer.rewind();
        }
        byte[] bArr = new byte[byteBuffer.limit()];
        byteBuffer.get(bArr);
        if (string == null) {
            return new C3710(new C3731(bArr, null, null));
        }
        Matcher matcher = f11474.matcher(string);
        String str2 = null;
        for (int iEnd = 0; matcher.find(iEnd); iEnd = matcher.end()) {
            String strM6809 = C4150.m6809(matcher.group(1));
            String strGroup = matcher.group(2);
            byte b = -1;
            int iHashCode = strM6809.hashCode();
            if (iHashCode != -315603473) {
                if (iHashCode == 1646559960 && strM6809.equals("streamtitle")) {
                    b = 0;
                }
            } else if (strM6809.equals("streamurl")) {
                b = 1;
            }
            if (b == 0) {
                str = strGroup;
            } else if (b == 1) {
                str2 = strGroup;
            }
        }
        return new C3710(new C3731(bArr, str, str2));
    }
}
