package g;

import com.ifpdos.sdk.httpd.binder.aidl.RequestLine;
import g.r;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Nullable;

/* JADX INFO: loaded from: classes.dex */
public final class z {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final s f6518a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final r f6520c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    @Nullable
    public final c0 f6521d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final Map<Class<?>, Object> f6522e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    @Nullable
    public volatile c f6523f;

    public static class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        @Nullable
        public s f6524a;

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

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public r.a f6526c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        @Nullable
        public c0 f6527d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public Map<Class<?>, Object> f6528e;

        public a() {
            this.f6528e = Collections.emptyMap();
            this.f6525b = RequestLine.METHOD_GET;
            this.f6526c = new r.a();
        }

        public a(z zVar) {
            this.f6528e = Collections.emptyMap();
            this.f6524a = zVar.f6518a;
            this.f6525b = zVar.f6519b;
            this.f6527d = zVar.f6521d;
            this.f6528e = zVar.f6522e.isEmpty() ? Collections.emptyMap() : new LinkedHashMap<>(zVar.f6522e);
            this.f6526c = zVar.f6520c.e();
        }

        public z a() {
            if (this.f6524a != null) {
                return new z(this);
            }
            throw new IllegalStateException("url == null");
        }

        public a b(String str, String str2) {
            r.a aVar = this.f6526c;
            Objects.requireNonNull(aVar);
            r.a(str);
            r.b(str2, str);
            aVar.c(str);
            aVar.f6452a.add(str);
            aVar.f6452a.add(str2.trim());
            return this;
        }

        public a c(String str, @Nullable c0 c0Var) {
            Objects.requireNonNull(str, "method == null");
            if (str.length() == 0) {
                throw new IllegalArgumentException("method.length() == 0");
            }
            if (c0Var != null && !d.a.u.a.x(str)) {
                throw new IllegalArgumentException(a.b.c.a.a.q("method ", str, " must not have a request body."));
            }
            if (c0Var == null) {
                if (str.equals(RequestLine.METHOD_POST) || str.equals("PUT") || str.equals("PATCH") || str.equals("PROPPATCH") || str.equals("REPORT")) {
                    throw new IllegalArgumentException(a.b.c.a.a.q("method ", str, " must have a request body."));
                }
            }
            this.f6525b = str;
            this.f6527d = c0Var;
            return this;
        }

        public <T> a d(Class<? super T> cls, @Nullable T t) {
            Objects.requireNonNull(cls, "type == null");
            if (t == null) {
                this.f6528e.remove(cls);
            } else {
                if (this.f6528e.isEmpty()) {
                    this.f6528e = new LinkedHashMap();
                }
                this.f6528e.put(cls, cls.cast(t));
            }
            return this;
        }

        public a e(s sVar) {
            Objects.requireNonNull(sVar, "url == null");
            this.f6524a = sVar;
            return this;
        }
    }

    public z(a aVar) {
        this.f6518a = aVar.f6524a;
        this.f6519b = aVar.f6525b;
        this.f6520c = new r(aVar.f6526c);
        this.f6521d = aVar.f6527d;
        Map<Class<?>, Object> map = aVar.f6528e;
        byte[] bArr = g.i0.c.f6154a;
        this.f6522e = map.isEmpty() ? Collections.emptyMap() : Collections.unmodifiableMap(new LinkedHashMap(map));
    }

    public c a() {
        c cVar = this.f6523f;
        if (cVar != null) {
            return cVar;
        }
        c cVarA = c.a(this.f6520c);
        this.f6523f = cVarA;
        return cVarA;
    }

    public String toString() {
        StringBuilder sbC = a.b.c.a.a.C("Request{method=");
        sbC.append(this.f6519b);
        sbC.append(", url=");
        sbC.append(this.f6518a);
        sbC.append(", tags=");
        sbC.append(this.f6522e);
        sbC.append('}');
        return sbC.toString();
    }
}
