package A1;

import C3.AbstractC0055q;
import C3.W;
import D0.C0071h;
import E1.AbstractC0101h;
import E1.InterfaceC0100g;
import L0.T;
import L0.o0;
import N1.C0198b;
import T3.X;
import T3.Y;
import T3.Z;
import T3.f0;
import T3.g0;
import T3.r0;
import android.content.ClipDescription;
import android.content.Intent;
import android.media.AudioDeviceInfo;
import android.media.AudioRouting;
import android.media.AudioTrack;
import android.media.LoudnessCodecController;
import android.media.MediaCodec;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.Choreographer;
import androidx.lifecycle.C0518x;
import androidx.lifecycle.EnumC0509n;
import androidx.lifecycle.V;
import com.google.android.gms.internal.measurement.AbstractC0707u1;
import com.google.android.gms.internal.measurement.C0611b;
import com.google.android.gms.internal.measurement.X1;
import com.google.crypto.tink.shaded.protobuf.C0748n;
import com.martsnew.tv.service.MediaService;
import d3.R0;
import e3.C0867a;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicReference;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import n4.u0;
import u0.C1578n;
import u0.C1579o;
import v0.C1666e;
import v0.InterfaceC1668g;
import x0.AbstractC1709a;
import x4.C1717b;

/* JADX INFO: loaded from: classes.dex */
public final class y implements E, A6.e, O.g, S3.a {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final /* synthetic */ int f362q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public Object f363r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public Object f364s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public Object f365t;

    public /* synthetic */ y(int i, boolean z8) {
        this.f362q = i;
    }

    public static final y q(g0 g0Var) throws GeneralSecurityException {
        if (g0Var.z() <= 0) {
            throw new GeneralSecurityException("empty keyset");
        }
        ArrayList arrayList = new ArrayList(g0Var.z());
        for (f0 f0Var : g0Var.A()) {
            f0Var.getClass();
            try {
                try {
                    H3.b bVarA = O3.k.f5155b.a(O3.q.c(f0Var.A().B(), f0Var.A().C(), f0Var.A().A(), f0Var.C(), f0Var.C() == r0.f6589u ? null : Integer.valueOf(f0Var.B())));
                    int iOrdinal = f0Var.D().ordinal();
                    if (iOrdinal != 1 && iOrdinal != 2 && iOrdinal != 3) {
                        throw new GeneralSecurityException("Unknown key status");
                    }
                    arrayList.add(new H3.h(bVarA));
                } catch (GeneralSecurityException unused) {
                    arrayList.add(null);
                }
            } catch (GeneralSecurityException e8) {
                throw new A6.b("Creating a protokey serialization failed", e8);
            }
        }
        return new y(g0Var, Collections.unmodifiableList(arrayList));
    }

    public static final y y(H3.f fVar, N3.b bVar) throws GeneralSecurityException, IOException {
        byte[] bArr = new byte[0];
        ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) fVar.f3080b;
        try {
            T3.N nA = T3.N.A(byteArrayInputStream, C0748n.a());
            byteArrayInputStream.close();
            if (nA.y().size() == 0) {
                throw new GeneralSecurityException("empty keyset");
            }
            try {
                g0 g0VarE = g0.E(bVar.b(nA.y().g(), bArr), C0748n.a());
                if (g0VarE.z() > 0) {
                    return q(g0VarE);
                }
                throw new GeneralSecurityException("empty keyset");
            } catch (com.google.crypto.tink.shaded.protobuf.B unused) {
                throw new GeneralSecurityException("invalid keyset, corrupted key material");
            }
        } catch (Throwable th) {
            byteArrayInputStream.close();
            throw th;
        }
    }

    public void A(int i) throws InvalidAlgorithmParameterException {
        if (i != 16 && i != 32) {
            throw new InvalidAlgorithmParameterException(String.format("Invalid key size %d; only 128-bit and 256-bit AES keys are supported", Integer.valueOf(i * 8)));
        }
        this.f363r = Integer.valueOf(i);
    }

    @Override // A1.E
    public void b(x0.t tVar, T0.o oVar, M m8) {
        this.f364s = tVar;
        m8.a();
        m8.b();
        T0.F fJ = oVar.j(m8.f102d, 5);
        this.f365t = fJ;
        fJ.e((C1579o) this.f363r);
    }

    @Override // O.g
    public Uri c() {
        return (Uri) this.f365t;
    }

    public /* bridge */ /* synthetic */ Object clone() {
        switch (this.f362q) {
            case 29:
                y yVar = new y(((C0611b) this.f363r).clone());
                ArrayList arrayList = (ArrayList) this.f365t;
                int size = arrayList.size();
                int i = 0;
                while (i < size) {
                    Object obj = arrayList.get(i);
                    i++;
                    ((ArrayList) yVar.f365t).add(((C0611b) obj).clone());
                }
                return yVar;
            default:
                return super.clone();
        }
    }

    @Override // S3.a
    public byte[] d(int i, byte[] bArr) throws GeneralSecurityException {
        byte[] bArrQ;
        if (i > 16) {
            throw new InvalidAlgorithmParameterException("outputLength too large, max is 16 bytes");
        }
        if (!I1.a.b(1)) {
            throw new GeneralSecurityException("Can not use AES-CMAC in FIPS-mode.");
        }
        Cipher cipher = (Cipher) U3.i.f6713b.f6715a.a("AES/ECB/NoPadding");
        cipher.init(1, (SecretKeySpec) this.f363r);
        int iMax = Math.max(1, (int) Math.ceil(((double) bArr.length) / 16.0d));
        if (iMax * 16 == bArr.length) {
            bArrQ = AbstractC0707u1.p((iMax - 1) * 16, 0, 16, bArr, (byte[]) this.f364s);
        } else {
            byte[] bArrCopyOfRange = Arrays.copyOfRange(bArr, (iMax - 1) * 16, bArr.length);
            if (bArrCopyOfRange.length >= 16) {
                throw new IllegalArgumentException("x must be smaller than a block.");
            }
            byte[] bArrCopyOf = Arrays.copyOf(bArrCopyOfRange, 16);
            bArrCopyOf[bArrCopyOfRange.length] = -128;
            bArrQ = AbstractC0707u1.q(bArrCopyOf, (byte[]) this.f365t);
        }
        byte[] bArrDoFinal = new byte[16];
        for (int i5 = 0; i5 < iMax - 1; i5++) {
            bArrDoFinal = cipher.doFinal(AbstractC0707u1.p(0, i5 * 16, 16, bArrDoFinal, bArr));
        }
        return Arrays.copyOf(cipher.doFinal(AbstractC0707u1.q(bArrQ, bArrDoFinal)), i);
    }

    @Override // A1.E
    public void e(x0.o oVar) {
        long jD;
        AbstractC1709a.k((x0.t) this.f364s);
        int i = x0.v.f18553a;
        x0.t tVar = (x0.t) this.f364s;
        synchronized (tVar) {
            try {
                long j8 = tVar.f18551c;
                jD = j8 != -9223372036854775807L ? j8 + tVar.f18550b : tVar.d();
            } finally {
            }
        }
        long jE = ((x0.t) this.f364s).e();
        if (jD == -9223372036854775807L || jE == -9223372036854775807L) {
            return;
        }
        C1579o c1579o = (C1579o) this.f363r;
        if (jE != c1579o.f17363s) {
            C1578n c1578nA = c1579o.a();
            c1578nA.f17325r = jE;
            C1579o c1579o2 = new C1579o(c1578nA);
            this.f363r = c1579o2;
            ((T0.F) this.f365t).e(c1579o2);
        }
        int iA = oVar.a();
        ((T0.F) this.f365t).c(iA, oVar);
        ((T0.F) this.f365t).a(jD, 1, iA, 0, null);
    }

    @Override // O.g
    public ClipDescription f() {
        return (ClipDescription) this.f364s;
    }

    @Override // O.g
    public Object g() {
        return null;
    }

    /* JADX WARN: Type inference failed for: r1v3, types: [O6.a, P6.h] */
    @Override // A6.e
    public Object getValue() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        InterfaceC0100g interfaceC0100g = (InterfaceC0100g) this.f365t;
        if (interfaceC0100g != null) {
            return interfaceC0100g;
        }
        Bundle bundle = (Bundle) ((P6.h) this.f364s).a();
        q.e eVar = AbstractC0101h.f2079b;
        P6.d dVar = (P6.d) this.f363r;
        Method method = (Method) eVar.get(dVar);
        if (method == null) {
            method = X1.m(dVar).getMethod("fromBundle", (Class[]) Arrays.copyOf(AbstractC0101h.f2078a, 1));
            eVar.put(dVar, method);
            P6.g.d(method, "navArgsClass.java.getMet…hod\n                    }");
        }
        Object objInvoke = method.invoke(null, bundle);
        if (objInvoke == null) {
            throw new NullPointerException("null cannot be cast to non-null type Args of androidx.navigation.NavArgsLazy");
        }
        InterfaceC0100g interfaceC0100g2 = (InterfaceC0100g) objInvoke;
        this.f365t = interfaceC0100g2;
        return interfaceC0100g2;
    }

    @Override // O.g
    public Uri h() {
        return (Uri) this.f363r;
    }

    public I3.i i() throws GeneralSecurityException {
        P.g gVar;
        I3.k kVar = (I3.k) this.f363r;
        if (kVar == null || (gVar = (P.g) this.f364s) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (kVar.f3341b != ((V3.a) gVar.f5246r).f6860a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        I3.j jVar = I3.j.f3327e;
        I3.j jVar2 = kVar.f3344e;
        if (jVar2 != jVar && ((Integer) this.f365t) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (jVar2 == jVar && ((Integer) this.f365t) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (jVar2 == jVar) {
            V3.a.a(new byte[0]);
        } else if (jVar2 == I3.j.f3326d) {
            V3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f365t).intValue()).array());
        } else {
            if (jVar2 != I3.j.f3325c) {
                throw new IllegalStateException("Unknown AesEaxParameters.Variant: " + ((I3.k) this.f363r).f3344e);
            }
            V3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f365t).intValue()).array());
        }
        return new I3.i();
    }

    public I3.m j() throws GeneralSecurityException {
        P.g gVar;
        I3.n nVar = (I3.n) this.f363r;
        if (nVar == null || (gVar = (P.g) this.f364s) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (nVar.f3349b != ((V3.a) gVar.f5246r).f6860a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        I3.j jVar = I3.j.f3330h;
        I3.j jVar2 = nVar.f3352e;
        if (jVar2 != jVar && ((Integer) this.f365t) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (jVar2 == jVar && ((Integer) this.f365t) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (jVar2 == jVar) {
            V3.a.a(new byte[0]);
        } else if (jVar2 == I3.j.f3329g) {
            V3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f365t).intValue()).array());
        } else {
            if (jVar2 != I3.j.f3328f) {
                throw new IllegalStateException("Unknown AesGcmParameters.Variant: " + ((I3.n) this.f363r).f3352e);
            }
            V3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f365t).intValue()).array());
        }
        return new I3.m();
    }

    public I3.p k() throws GeneralSecurityException {
        P.g gVar;
        I3.q qVar = (I3.q) this.f363r;
        if (qVar == null || (gVar = (P.g) this.f364s) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (qVar.f3357b != ((V3.a) gVar.f5246r).f6860a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        I3.j jVar = I3.j.f3332k;
        I3.j jVar2 = qVar.f3358c;
        if (jVar2 != jVar && ((Integer) this.f365t) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (jVar2 == jVar && ((Integer) this.f365t) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (jVar2 == jVar) {
            V3.a.a(new byte[0]);
        } else if (jVar2 == I3.j.f3331j) {
            V3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f365t).intValue()).array());
        } else {
            if (jVar2 != I3.j.i) {
                throw new IllegalStateException("Unknown AesGcmSivParameters.Variant: " + ((I3.q) this.f363r).f3358c);
            }
            V3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f365t).intValue()).array());
        }
        return new I3.p();
    }

    public P3.a l() throws GeneralSecurityException {
        P.g gVar;
        V3.a aVarA;
        P3.e eVar = (P3.e) this.f363r;
        if (eVar == null || (gVar = (P.g) this.f364s) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (eVar.f5466b != ((V3.a) gVar.f5246r).f6860a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        P3.d dVar = P3.d.f5455f;
        P3.d dVar2 = eVar.f5468d;
        if (dVar2 != dVar && ((Integer) this.f365t) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (dVar2 == dVar && ((Integer) this.f365t) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (dVar2 == dVar) {
            aVarA = V3.a.a(new byte[0]);
        } else if (dVar2 == P3.d.f5454e || dVar2 == P3.d.f5453d) {
            aVarA = V3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f365t).intValue()).array());
        } else {
            if (dVar2 != P3.d.f5452c) {
                throw new IllegalStateException("Unknown AesCmacParametersParameters.Variant: " + ((P3.e) this.f363r).f5468d);
            }
            aVarA = V3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f365t).intValue()).array());
        }
        return new P3.a((P3.e) this.f363r, aVarA);
    }

    public P3.e m() throws GeneralSecurityException {
        Integer num = (Integer) this.f363r;
        if (num == null) {
            throw new GeneralSecurityException("key size not set");
        }
        if (((Integer) this.f364s) == null) {
            throw new GeneralSecurityException("tag size not set");
        }
        if (((P3.d) this.f365t) != null) {
            return new P3.e(num.intValue(), ((Integer) this.f364s).intValue(), (P3.d) this.f365t);
        }
        throw new GeneralSecurityException("variant not set");
    }

    public P3.j n() throws GeneralSecurityException {
        P.g gVar;
        V3.a aVarA;
        P3.k kVar = (P3.k) this.f363r;
        if (kVar == null || (gVar = (P.g) this.f364s) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (kVar.f5476b != ((V3.a) gVar.f5246r).f6860a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        P3.d dVar = P3.d.f5463o;
        P3.d dVar2 = kVar.f5478d;
        if (dVar2 != dVar && ((Integer) this.f365t) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (dVar2 == dVar && ((Integer) this.f365t) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (dVar2 == dVar) {
            aVarA = V3.a.a(new byte[0]);
        } else if (dVar2 == P3.d.f5462n || dVar2 == P3.d.f5461m) {
            aVarA = V3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f365t).intValue()).array());
        } else {
            if (dVar2 != P3.d.f5460l) {
                throw new IllegalStateException("Unknown HmacParameters.Variant: " + ((P3.k) this.f363r).f5478d);
            }
            aVarA = V3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f365t).intValue()).array());
        }
        return new P3.j((P3.k) this.f363r, aVarA);
    }

    public void o(T0.o oVar, M m8) {
        int i = 0;
        while (true) {
            T0.F[] fArr = (T0.F[]) this.f364s;
            if (i >= fArr.length) {
                return;
            }
            m8.a();
            m8.b();
            T0.F fJ = oVar.j(m8.f102d, 3);
            C1579o c1579o = (C1579o) ((List) this.f363r).get(i);
            String str = c1579o.f17358n;
            AbstractC1709a.c("Invalid closed caption MIME type provided: " + str, "application/cea-608".equals(str) || "application/cea-708".equals(str));
            String str2 = c1579o.f17346a;
            if (str2 == null) {
                m8.b();
                str2 = m8.f103e;
            }
            C1578n c1578n = new C1578n();
            c1578n.f17309a = str2;
            c1578n.f17319l = u0.E.m("video/mp2t");
            c1578n.f17320m = u0.E.m(str);
            c1578n.f17313e = c1579o.f17350e;
            c1578n.f17312d = c1579o.f17349d;
            c1578n.H = c1579o.f17340I;
            c1578n.f17323p = c1579o.f17361q;
            I1.a.w(c1578n, fJ);
            fArr[i] = fJ;
            i++;
        }
    }

    public void p(C2.b bVar, ByteArrayOutputStream byteArrayOutputStream) {
        HashMap map = (HashMap) this.f364s;
        HashMap map2 = (HashMap) this.f363r;
        A4.f fVar = new A4.f(byteArrayOutputStream, map2, map, (A4.e) this.f365t);
        x4.d dVar = (x4.d) map2.get(C2.b.class);
        if (dVar != null) {
            dVar.a(bVar, fVar);
        } else {
            throw new C1717b("No encoder for " + C2.b.class);
        }
    }

    public long r() {
        T0.j jVar = (T0.j) this.f365t;
        if (jVar != null) {
            return jVar.f6428t;
        }
        return -1L;
    }

    /* JADX WARN: Removed duplicated region for block: B:67:0x0140  */
    /* JADX WARN: Removed duplicated region for block: B:68:0x0144  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public Object s(Class cls) throws GeneralSecurityException {
        Class clsA;
        Object objC;
        Object objB;
        AtomicReference atomicReference = H3.n.f3093a;
        try {
            clsA = O3.j.f5153b.a(cls);
        } catch (GeneralSecurityException unused) {
            clsA = null;
        }
        if (clsA == null) {
            throw new GeneralSecurityException("No wrapper found for ".concat(cls.getName()));
        }
        int i = H3.o.f3097a;
        g0 g0Var = (g0) this.f363r;
        int iB = g0Var.B();
        Iterator it = g0Var.A().iterator();
        int i5 = 0;
        boolean z8 = false;
        boolean z9 = true;
        while (true) {
            boolean zHasNext = it.hasNext();
            Z z10 = Z.f6580s;
            if (!zHasNext) {
                if (i5 == 0) {
                    throw new GeneralSecurityException("keyset must contain at least one ENABLED key");
                }
                if (!z8 && !z9) {
                    throw new GeneralSecurityException("keyset doesn't contain a valid primary key");
                }
                C2.a aVar = new C2.a(clsA);
                if (((ConcurrentHashMap) aVar.f1157r) == null) {
                    throw new IllegalStateException("setAnnotations cannot be called after build");
                }
                aVar.f1160u = (R3.a) this.f365t;
                for (int i8 = 0; i8 < g0Var.z(); i8++) {
                    f0 f0VarY = g0Var.y(i8);
                    if (f0VarY.D().equals(z10)) {
                        try {
                            Y yA = f0VarY.A();
                            AtomicReference atomicReference2 = H3.n.f3093a;
                            objC = H3.n.c(yA.B(), yA.C(), clsA);
                        } catch (GeneralSecurityException e8) {
                            if (!e8.getMessage().contains("No key manager found for key type ") && !e8.getMessage().contains(" not supported by key manager of type ")) {
                                throw e8;
                            }
                            objC = null;
                        }
                        List list = (List) this.f364s;
                        if (list.get(i8) != null) {
                            try {
                                objB = H3.n.b(((H3.h) list.get(i8)).f3082a, clsA);
                            } catch (GeneralSecurityException unused2) {
                                objB = null;
                            }
                            if (f0VarY.B() != g0Var.B()) {
                                aVar.e(objB, objC, f0VarY, true);
                            } else {
                                aVar.e(objB, objC, f0VarY, false);
                            }
                        } else {
                            objB = null;
                            if (f0VarY.B() != g0Var.B()) {
                            }
                        }
                    }
                }
                ConcurrentHashMap concurrentHashMap = (ConcurrentHashMap) aVar.f1157r;
                if (concurrentHashMap == null) {
                    throw new IllegalStateException("build cannot be called twice");
                }
                H3.k kVar = (H3.k) aVar.f1159t;
                R3.a aVar2 = (R3.a) aVar.f1160u;
                Class cls2 = (Class) aVar.f1158s;
                y yVar = new y(concurrentHashMap, kVar, aVar2, cls2);
                aVar.f1157r = null;
                AtomicReference atomicReference3 = H3.n.f3093a;
                HashMap map = ((O3.p) O3.j.f5153b.f5154a.get()).f5164b;
                if (!map.containsKey(cls)) {
                    throw new GeneralSecurityException("No wrapper found for " + cls);
                }
                H3.m mVar = (H3.m) map.get(cls);
                if (cls2.equals(mVar.a()) && mVar.a().equals(cls2)) {
                    return mVar.b(yVar);
                }
                throw new GeneralSecurityException("Input primitive type of the wrapper doesn't match the type of primitives in the provided PrimitiveSet");
            }
            f0 f0Var = (f0) it.next();
            if (f0Var.D() == z10) {
                if (!f0Var.E()) {
                    throw new GeneralSecurityException(String.format("key %d has no key data", Integer.valueOf(f0Var.B())));
                }
                if (f0Var.C() == r0.f6586r) {
                    throw new GeneralSecurityException(String.format("key %d has unknown prefix", Integer.valueOf(f0Var.B())));
                }
                if (f0Var.D() == Z.f6579r) {
                    throw new GeneralSecurityException(String.format("key %d has unknown status", Integer.valueOf(f0Var.B())));
                }
                if (f0Var.B() == iB) {
                    if (z8) {
                        throw new GeneralSecurityException("keyset contains multiple primary keys");
                    }
                    z8 = true;
                }
                if (f0Var.A().A() != X.f6574u) {
                    z9 = false;
                }
                i5++;
            }
        }
    }

    public List t(byte[] bArr) {
        List list = (List) ((ConcurrentHashMap) this.f363r).get(new H3.l(bArr));
        return list != null ? list : Collections.EMPTY_LIST;
    }

    public String toString() {
        switch (this.f362q) {
            case 3:
                StringBuilder sb = new StringBuilder(32);
                sb.append((String) this.f363r);
                sb.append('{');
                R0 r02 = (R0) ((R0) this.f364s).f11693s;
                String str = "";
                while (r02 != null) {
                    R0 r03 = (R0) r02.f11692r;
                    sb.append(str);
                    if (r03 == null || !R0.class.isArray()) {
                        sb.append(r03);
                    } else {
                        String strDeepToString = Arrays.deepToString(new Object[]{r03});
                        sb.append((CharSequence) strDeepToString, 1, strDeepToString.length() - 1);
                    }
                    r02 = (R0) r02.f11693s;
                    str = ", ";
                }
                sb.append('}');
                return sb.toString();
            case Z.g.BYTES_FIELD_NUMBER /* 8 */:
                StringBuilder sb2 = new StringBuilder("NavDeepLinkRequest{");
                Uri uri = (Uri) this.f363r;
                if (uri != null) {
                    sb2.append(" uri=");
                    sb2.append(String.valueOf(uri));
                }
                String str2 = (String) this.f364s;
                if (str2 != null) {
                    sb2.append(" action=");
                    sb2.append(str2);
                }
                String str3 = (String) this.f365t;
                if (str3 != null) {
                    sb2.append(" mimetype=");
                    sb2.append(str3);
                }
                sb2.append(" }");
                String string = sb2.toString();
                P6.g.d(string, "sb.toString()");
                return string;
            case 10:
                return H3.o.a((g0) this.f363r).toString();
            default:
                return super.toString();
        }
    }

    public boolean u() throws IOException {
        String strTrim;
        if (((String) this.f365t) == null) {
            ArrayDeque arrayDeque = (ArrayDeque) this.f364s;
            if (!arrayDeque.isEmpty()) {
                String str = (String) arrayDeque.poll();
                str.getClass();
                this.f365t = str;
                return true;
            }
            do {
                String line = ((BufferedReader) this.f363r).readLine();
                this.f365t = line;
                if (line == null) {
                    return false;
                }
                strTrim = line.trim();
                this.f365t = strTrim;
            } while (strTrim.isEmpty());
        }
        return true;
    }

    public void v(z0.h hVar, Uri uri, Map map, long j8, long j9, T t6) throws o0 {
        boolean z8;
        boolean z9 = true;
        T0.j jVar = new T0.j(hVar, j8, j9);
        this.f365t = jVar;
        if (((T0.m) this.f364s) != null) {
            return;
        }
        T0.m[] mVarArrF = ((T0.p) this.f363r).f(uri, map);
        int length = mVarArrF.length;
        C3.E e8 = C3.G.f1197r;
        AbstractC0055q.c(length, "expectedSize");
        C3.D d8 = new C3.D(length);
        if (mVarArrF.length == 1) {
            this.f364s = mVarArrF[0];
        } else {
            int length2 = mVarArrF.length;
            int i = 0;
            while (true) {
                if (i >= length2) {
                    break;
                }
                T0.m mVar = mVarArrF[i];
                try {
                    if (mVar.f(jVar)) {
                        this.f364s = mVar;
                        jVar.f6430v = 0;
                        break;
                    } else {
                        d8.d(mVar.m());
                        z8 = ((T0.m) this.f364s) != null || jVar.f6428t == j8;
                    }
                } catch (EOFException unused) {
                    z8 = ((T0.m) this.f364s) != null || jVar.f6428t == j8;
                } catch (Throwable th) {
                    if (((T0.m) this.f364s) == null && jVar.f6428t != j8) {
                        z9 = false;
                    }
                    AbstractC1709a.j(z9);
                    jVar.f6430v = 0;
                    throw th;
                }
                AbstractC1709a.j(z8);
                jVar.f6430v = 0;
                i++;
            }
            if (((T0.m) this.f364s) == null) {
                StringBuilder sb = new StringBuilder("None of the available extractors (");
                B3.f fVar = new B3.f(", ");
                Iterator it = AbstractC0055q.r(C3.G.l(mVarArrF), new I3.y(2)).iterator();
                StringBuilder sb2 = new StringBuilder();
                fVar.a(sb2, it);
                sb.append(sb2.toString());
                sb.append(") could read the stream.");
                String string = sb.toString();
                uri.getClass();
                W wG = d8.g();
                o0 o0Var = new o0(string, null, false, 1);
                C3.G.k(wG);
                throw o0Var;
            }
        }
        ((T0.m) this.f364s).l(t6);
    }

    public String w() {
        if (!u()) {
            throw new NoSuchElementException();
        }
        String str = (String) this.f365t;
        this.f365t = null;
        return str;
    }

    public void x(EnumC0509n enumC0509n) {
        V v7 = (V) this.f365t;
        if (v7 != null) {
            v7.run();
        }
        V v8 = new V((C0518x) this.f363r, enumC0509n);
        this.f365t = v8;
        ((Handler) this.f364s).postAtFrontOfQueue(v8);
    }

    public void z(MediaCodec mediaCodec) {
        LoudnessCodecController loudnessCodecController;
        if (!((HashSet) this.f363r).remove(mediaCodec) || (loudnessCodecController = (LoudnessCodecController) this.f365t) == null) {
            return;
        }
        loudnessCodecController.removeMediaCodec(mediaCodec);
    }

    public /* synthetic */ y(Object obj, Object obj2, Object obj3, int i) {
        this.f362q = i;
        this.f363r = obj;
        this.f364s = obj2;
        this.f365t = obj3;
    }

    public y(Set set, String str, String str2) {
        this.f362q = 20;
        C0867a c0867a = C0867a.f12437a;
        Set setUnmodifiableSet = set == null ? Collections.EMPTY_SET : Collections.unmodifiableSet(set);
        Map map = Collections.EMPTY_MAP;
        this.f364s = str2;
        this.f365t = c0867a;
        HashSet hashSet = new HashSet(setUnmodifiableSet);
        Iterator it = map.values().iterator();
        if (!it.hasNext()) {
            this.f363r = Collections.unmodifiableSet(hashSet);
        } else {
            it.next().getClass();
            throw new ClassCastException();
        }
    }

    public y(C0611b c0611b) {
        this.f362q = 29;
        this.f363r = c0611b;
        this.f364s = c0611b.clone();
        this.f365t = new ArrayList();
    }

    public y(MediaService mediaService) {
        this.f362q = 27;
        this.f363r = new C0518x(mediaService);
        this.f364s = new Handler();
    }

    /* JADX WARN: Multi-variable type inference failed */
    public y(P6.d dVar, O6.a aVar) {
        this.f362q = 7;
        this.f363r = dVar;
        this.f364s = (P6.h) aVar;
    }

    public y(List list) {
        this.f362q = 1;
        this.f363r = list;
        this.f364s = new T0.F[list.size()];
        this.f365t = new C0198b(new G(0, this));
    }

    public y(int i, String str) {
        this.f362q = i;
        switch (i) {
            case 3:
                R0 r02 = new R0(8, false);
                this.f364s = r02;
                this.f365t = r02;
                this.f363r = str;
                break;
            default:
                C1578n c1578n = new C1578n();
                c1578n.f17319l = u0.E.m("video/mp2t");
                c1578n.f17320m = u0.E.m(str);
                this.f363r = new C1579o(c1578n);
                break;
        }
    }

    public y(byte[] bArr) throws GeneralSecurityException {
        this.f362q = 25;
        U3.o.a(bArr.length);
        SecretKeySpec secretKeySpec = new SecretKeySpec(bArr, "AES");
        this.f363r = secretKeySpec;
        if (I1.a.b(1)) {
            Cipher cipher = (Cipher) U3.i.f6713b.f6715a.a("AES/ECB/NoPadding");
            cipher.init(1, secretKeySpec);
            byte[] bArrL = u0.l(cipher.doFinal(new byte[16]));
            this.f364s = bArrL;
            this.f365t = u0.l(bArrL);
            return;
        }
        throw new GeneralSecurityException("Can not use AES-CMAC in FIPS-mode.");
    }

    @Override // O.g
    public void a() {
    }

    public y(int i) {
        this.f362q = i;
        switch (i) {
            case 24:
                this.f363r = new String[20][];
                this.f364s = new int[20][];
                this.f365t = new int[20][];
                break;
            case 26:
                this.f363r = new androidx.leanback.widget.C(1);
                androidx.leanback.widget.C c3 = new androidx.leanback.widget.C(0);
                this.f364s = c3;
                this.f365t = c3;
                break;
            case 29:
                this.f363r = new C0611b("", 0L, null);
                this.f364s = new C0611b("", 0L, null);
                this.f365t = new ArrayList();
                break;
            default:
                I0.l lVar = I0.l.f3231q;
                this.f363r = new HashSet();
                this.f364s = lVar;
                break;
        }
    }

    public y(T0.p pVar) {
        this.f362q = 16;
        this.f363r = pVar;
    }

    public y(Intent intent) {
        this.f362q = 8;
        Uri data = intent.getData();
        String action = intent.getAction();
        String type = intent.getType();
        this.f363r = data;
        this.f364s = action;
        this.f365t = type;
    }

    public y(Runnable runnable) {
        this.f362q = 17;
        this.f364s = new CopyOnWriteArrayList();
        this.f365t = new HashMap();
        this.f363r = runnable;
    }

    public y(InterfaceC1668g[] interfaceC1668gArr) {
        this.f362q = 4;
        D0.J j8 = new D0.J();
        v0.j jVar = new v0.j();
        jVar.f18051c = 1.0f;
        jVar.f18052d = 1.0f;
        C1666e c1666e = C1666e.f18015e;
        jVar.f18053e = c1666e;
        jVar.f18054f = c1666e;
        jVar.f18055g = c1666e;
        jVar.f18056h = c1666e;
        ByteBuffer byteBuffer = InterfaceC1668g.f18020a;
        jVar.f18058k = byteBuffer;
        jVar.f18059l = byteBuffer.asShortBuffer();
        jVar.f18060m = byteBuffer;
        jVar.f18050b = -1;
        InterfaceC1668g[] interfaceC1668gArr2 = new InterfaceC1668g[interfaceC1668gArr.length + 2];
        this.f363r = interfaceC1668gArr2;
        System.arraycopy(interfaceC1668gArr, 0, interfaceC1668gArr2, 0, interfaceC1668gArr.length);
        this.f364s = j8;
        this.f365t = jVar;
        interfaceC1668gArr2[interfaceC1668gArr.length] = j8;
        interfaceC1668gArr2[interfaceC1668gArr.length + 1] = jVar;
    }

    public y(P.g gVar) {
        this.f362q = 28;
        this.f362q = 28;
        this.f363r = gVar;
        this.f364s = Choreographer.getInstance();
        this.f365t = new U.e(1, this);
    }

    public y(ConcurrentHashMap concurrentHashMap, H3.k kVar, R3.a aVar, Class cls) {
        this.f362q = 11;
        this.f363r = concurrentHashMap;
        this.f364s = kVar;
        this.f365t = aVar;
    }

    public y(g0 g0Var, List list) {
        this.f362q = 10;
        this.f363r = g0Var;
        this.f364s = list;
        this.f365t = R3.a.f6057b;
    }

    public y(ArrayDeque arrayDeque, BufferedReader bufferedReader) {
        this.f362q = 9;
        this.f364s = arrayDeque;
        this.f363r = bufferedReader;
    }

    public y(AudioTrack audioTrack, C0071h c0071h) {
        this.f362q = 5;
        this.f363r = audioTrack;
        this.f364s = c0071h;
        this.f365t = new AudioRouting.OnRoutingChangedListener() { // from class: D0.B
            @Override // android.media.AudioRouting.OnRoutingChangedListener
            public final void onRoutingChanged(AudioRouting audioRouting) {
                AudioDeviceInfo routedDevice;
                A1.y yVar = this.f1429a;
                if (((B) yVar.f365t) == null || (routedDevice = audioRouting.getRoutedDevice()) == null) {
                    return;
                }
                ((C0071h) yVar.f364s).b(routedDevice);
            }
        };
        audioTrack.addOnRoutingChangedListener((D0.B) this.f365t, new Handler(Looper.myLooper()));
    }

    public y(D0.F f3) {
        this.f362q = 6;
        this.f365t = f3;
        this.f363r = new Handler(Looper.myLooper());
        this.f364s = new D0.E(this);
    }
}
