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 f6504a;

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

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

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

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

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

    public static class a {

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

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

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

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

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

        public a() {
            this.f6514e = Collections.emptyMap();
            this.f6511b = RequestLine.METHOD_GET;
            this.f6512c = new r.a();
        }

        public a(z zVar) {
            this.f6514e = Collections.emptyMap();
            this.f6510a = zVar.f6504a;
            this.f6511b = zVar.f6505b;
            this.f6513d = zVar.f6507d;
            this.f6514e = zVar.f6508e.isEmpty() ? Collections.emptyMap() : new LinkedHashMap<>(zVar.f6508e);
            this.f6512c = zVar.f6506c.e();
        }

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

        public a b(String str, String str2) {
            r.a aVar = this.f6512c;
            Objects.requireNonNull(aVar);
            r.a(str);
            r.b(str2, str);
            aVar.c(str);
            aVar.f6438a.add(str);
            aVar.f6438a.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.w(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.f6511b = str;
            this.f6513d = c0Var;
            return this;
        }

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

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

    public z(a aVar) {
        this.f6504a = aVar.f6510a;
        this.f6505b = aVar.f6511b;
        this.f6506c = new r(aVar.f6512c);
        this.f6507d = aVar.f6513d;
        Map<Class<?>, Object> map = aVar.f6514e;
        byte[] bArr = g.i0.c.f6140a;
        this.f6508e = map.isEmpty() ? Collections.emptyMap() : Collections.unmodifiableMap(new LinkedHashMap(map));
    }

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

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