package t;

import I.m;
import a0.k;
import a0.l;
import android.content.Context;
import android.os.Handler;
import androidx.media3.session.MediaController;
import b0.D;
import b0.j;
import java.io.IOException;
import n.C0641g;
import n.G;
import n.InterfaceC0634B;
import n.q;
import n.s;
import n.w;
import o.C0648b;
import p.k;
import t.c;
import u.h;
import u.i;

/* JADX INFO: loaded from: classes.dex */
public class f implements c.InterfaceC0095c {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final Context f6463a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final String f6464b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final String f6465c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final h f6466d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private a f6467e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private k.a f6468f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public String f6469g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public String f6470h;

    private static final class a implements j.b {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        private final Context f6471a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private final String f6472b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        private final h f6473c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        private final c f6474d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        private final j f6475e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        private boolean f6476f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        private k.a f6477g;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        public String f6478h;

        /* JADX INFO: renamed from: i, reason: collision with root package name */
        public String f6479i;

        public a(Context context, String str, String str2, h hVar, c cVar, String str3, String str4) {
            this.f6471a = context;
            this.f6472b = str;
            this.f6473c = hVar;
            this.f6474d = cVar;
            this.f6478h = str3;
            this.f6479i = str4;
            this.f6475e = new j(str2, new k(str, null, null, 8000, 8000, false, this.f6477g), new H.d(str3));
        }

        public void a() {
            this.f6476f = true;
        }

        public void b() {
            this.f6475e.o(this.f6474d.x().getLooper(), this);
        }

        @Override // b0.j.b
        public void c(IOException iOException) {
            if (this.f6476f) {
                return;
            }
            this.f6474d.M(iOException);
        }

        @Override // b0.j.b
        /* JADX INFO: renamed from: e, reason: merged with bridge method [inline-methods] */
        public void d(H.c cVar) {
            i iVarV;
            if (this.f6476f) {
                return;
            }
            Handler handlerX = this.f6474d.x();
            C0641g c0641g = new C0641g(new a0.i(65536));
            a0.j jVar = new a0.j(handlerX, this.f6474d);
            if (cVar.f862e == null) {
                iVarV = null;
            } else {
                if (D.f2965a < 18) {
                    this.f6474d.M(new u.k(1));
                    return;
                }
                try {
                    iVarV = i.v(this.f6474d.A(), this.f6473c, this.f6479i, this.f6474d.x(), this.f6474d);
                } catch (u.k e2) {
                    this.f6474d.M(e2);
                    return;
                }
            }
            i iVar = iVarV;
            p.f fVar = new p.f(new H.b(this.f6475e, H.a.d(this.f6471a, true, false), new k(this.f6472b, null, jVar, 8000, 8000, false, this.f6477g), new k.a(jVar), MediaController.RELEASE_UNBIND_TIMEOUT_MS), c0641g, 13107200, handlerX, this.f6474d, 0);
            Context context = this.f6471a;
            s sVar = s.f5653a;
            w wVar = new w(context, fVar, sVar, 1, 5000L, iVar, true, handlerX, this.f6474d, 50, new String[0]);
            q qVar = new q((InterfaceC0634B) new p.f(new H.b(this.f6475e, H.a.b(), new l(this.f6471a, jVar, this.f6472b), null, MediaController.RELEASE_UNBIND_TIMEOUT_MS), c0641g, 3538944, handlerX, this.f6474d, 1), sVar, (u.b) iVar, true, handlerX, (q.f) this.f6474d, C0648b.b(this.f6471a), 3, new String[0]);
            m mVar = new m(new p.f(new H.b(this.f6475e, H.a.c(), new l(this.f6471a, jVar, this.f6472b), null, MediaController.RELEASE_UNBIND_TIMEOUT_MS), c0641g, 131072, handlerX, this.f6474d, 2), this.f6474d.y(), handlerX.getLooper(), new I.i[0]);
            G[] gArr = new G[6];
            gArr[0] = wVar;
            gArr[1] = qVar;
            gArr[2] = mVar;
            this.f6474d.K(gArr, jVar);
        }

        public void f(k.a aVar) {
            this.f6477g = aVar;
        }
    }

    public f(Context context, String str, String str2, h hVar) {
        this.f6463a = context;
        this.f6464b = str;
        if (!D.M(str2).endsWith("/manifest")) {
            str2 = str2 + "/Manifest";
        }
        this.f6465c = str2;
        this.f6466d = hVar;
    }

    @Override // t.c.InterfaceC0095c
    public void a(c cVar) {
        a aVar = new a(this.f6463a, this.f6464b, this.f6465c, this.f6466d, cVar, this.f6469g, this.f6470h);
        this.f6467e = aVar;
        aVar.f(this.f6468f);
        this.f6467e.b();
    }

    @Override // t.c.InterfaceC0095c
    public void b(k.a aVar) {
        this.f6468f = aVar;
    }

    @Override // t.c.InterfaceC0095c
    public boolean c() {
        return false;
    }

    @Override // t.c.InterfaceC0095c
    public void cancel() {
        a aVar = this.f6467e;
        if (aVar != null) {
            aVar.a();
            this.f6467e = null;
        }
    }

    public f(Context context, String str, String str2, h hVar, String str3, String str4) {
        this(context, str, str2, hVar);
        this.f6469g = str3;
        this.f6470h = str4;
    }
}
