小红书.apk(点击下载) / s.java


package retrofit2;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import okhttp3.Call;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.a;
import retrofit2.c;
import retrofit2.f;

/* compiled from: Retrofit */
public final class s {

    /* renamed from: a  reason: collision with root package name */
    public final Map<Method, t<?>> f125989a = new ConcurrentHashMap();

    /* renamed from: b  reason: collision with root package name */
    public final Call.Factory f125990b;

    /* renamed from: c  reason: collision with root package name */
    public final HttpUrl f125991c;

    /* renamed from: d  reason: collision with root package name */
    public final List<f.a> f125992d;

    /* renamed from: e  reason: collision with root package name */
    public final List<c.a> f125993e;

    /* renamed from: f  reason: collision with root package name */
    public final Executor f125994f;

    /* renamed from: g  reason: collision with root package name */
    public final boolean f125995g;

    /* compiled from: Retrofit */
    public class a implements InvocationHandler {

        /* renamed from: a  reason: collision with root package name */
        public final o f125996a = o.f();

        /* renamed from: b  reason: collision with root package name */
        public final Object[] f125997b = new Object[0];

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ Class f125998c;

        /* JADX WARN: Incorrect args count in method signature: ()V */
        public a(Class cls) {
            this.f125998c = cls;
        }

        @Override // java.lang.reflect.InvocationHandler
        public Object invoke(Object obj, Method method, Object[] objArr) throws Throwable {
            if (method.getDeclaringClass() == Object.class) {
                return method.invoke(this, objArr);
            }
            if (objArr == null) {
                objArr = this.f125997b;
            }
            if (this.f125996a.h(method)) {
                return this.f125996a.g(method, this.f125998c, obj, objArr);
            }
            return s.this.c(method).a(objArr);
        }
    }

    public s(Call.Factory factory, HttpUrl httpUrl, List<f.a> list, List<c.a> list2, Executor executor, boolean z14) {
        this.f125990b = factory;
        this.f125991c = httpUrl;
        this.f125992d = list;
        this.f125993e = list2;
        this.f125994f = executor;
        this.f125995g = z14;
    }

    public c<?, ?> a(Type type, Annotation[] annotationArr) {
        return d(null, type, annotationArr);
    }

    public <T> T b(Class<T> cls) {
        j(cls);
        return (T) Proxy.newProxyInstance(cls.getClassLoader(), new Class[]{cls}, new a(cls));
    }

    public t<?> c(Method method) {
        t<?> tVar;
        t<?> tVar2 = this.f125989a.get(method);
        if (tVar2 != null) {
            return tVar2;
        }
        synchronized (this.f125989a) {
            tVar = this.f125989a.get(method);
            if (tVar == null) {
                tVar = t.b(this, method);
                this.f125989a.put(method, tVar);
            }
        }
        return tVar;
    }

    public c<?, ?> d(c.a aVar, Type type, Annotation[] annotationArr) {
        Objects.requireNonNull(type, "returnType == null");
        Objects.requireNonNull(annotationArr, "annotations == null");
        int indexOf = this.f125993e.indexOf(aVar) + 1;
        int size = this.f125993e.size();
        for (int i10 = indexOf; i10 < size; i10++) {
            c<?, ?> a14 = this.f125993e.get(i10).a(type, annotationArr, this);
            if (a14 != null) {
                return a14;
            }
        }
        StringBuilder sb3 = new StringBuilder("Could not locate call adapter for ");
        sb3.append(type);
        sb3.append(".\n");
        if (aVar != null) {
            sb3.append("  Skipped:");
            for (int i14 = 0; i14 < indexOf; i14++) {
                sb3.append("\n   * ");
                sb3.append(this.f125993e.get(i14).getClass().getName());
            }
            sb3.append('\n');
        }
        sb3.append("  Tried:");
        int size2 = this.f125993e.size();
        while (indexOf < size2) {
            sb3.append("\n   * ");
            sb3.append(this.f125993e.get(indexOf).getClass().getName());
            indexOf++;
        }
        throw new IllegalArgumentException(sb3.toString());
    }

    public <T> f<T, RequestBody> e(f.a aVar, Type type, Annotation[] annotationArr, Annotation[] annotationArr2) {
        Objects.requireNonNull(type, "type == null");
        Objects.requireNonNull(annotationArr, "parameterAnnotations == null");
        Objects.requireNonNull(annotationArr2, "methodAnnotations == null");
        int indexOf = this.f125992d.indexOf(aVar) + 1;
        int size = this.f125992d.size();
        for (int i10 = indexOf; i10 < size; i10++) {
            f<T, RequestBody> fVar = (f<T, RequestBody>) this.f125992d.get(i10).requestBodyConverter(type, annotationArr, annotationArr2, this);
            if (fVar != null) {
                return fVar;
            }
        }
        StringBuilder sb3 = new StringBuilder("Could not locate RequestBody converter for ");
        sb3.append(type);
        sb3.append(".\n");
        if (aVar != null) {
            sb3.append("  Skipped:");
            for (int i14 = 0; i14 < indexOf; i14++) {
                sb3.append("\n   * ");
                sb3.append(this.f125992d.get(i14).getClass().getName());
            }
            sb3.append('\n');
        }
        sb3.append("  Tried:");
        int size2 = this.f125992d.size();
        while (indexOf < size2) {
            sb3.append("\n   * ");
            sb3.append(this.f125992d.get(indexOf).getClass().getName());
            indexOf++;
        }
        throw new IllegalArgumentException(sb3.toString());
    }

    public <T> f<ResponseBody, T> f(f.a aVar, Type type, Annotation[] annotationArr) {
        Objects.requireNonNull(type, "type == null");
        Objects.requireNonNull(annotationArr, "annotations == null");
        int indexOf = this.f125992d.indexOf(aVar) + 1;
        int size = this.f125992d.size();
        for (int i10 = indexOf; i10 < size; i10++) {
            f<ResponseBody, T> fVar = (f<ResponseBody, T>) this.f125992d.get(i10).responseBodyConverter(type, annotationArr, this);
            if (fVar != null) {
                return fVar;
            }
        }
        StringBuilder sb3 = new StringBuilder("Could not locate ResponseBody converter for ");
        sb3.append(type);
        sb3.append(".\n");
        if (aVar != null) {
            sb3.append("  Skipped:");
            for (int i14 = 0; i14 < indexOf; i14++) {
                sb3.append("\n   * ");
                sb3.append(this.f125992d.get(i14).getClass().getName());
            }
            sb3.append('\n');
        }
        sb3.append("  Tried:");
        int size2 = this.f125992d.size();
        while (indexOf < size2) {
            sb3.append("\n   * ");
            sb3.append(this.f125992d.get(indexOf).getClass().getName());
            indexOf++;
        }
        throw new IllegalArgumentException(sb3.toString());
    }

    public <T> f<T, RequestBody> g(Type type, Annotation[] annotationArr, Annotation[] annotationArr2) {
        return e(null, type, annotationArr, annotationArr2);
    }

    public <T> f<ResponseBody, T> h(Type type, Annotation[] annotationArr) {
        return f(null, type, annotationArr);
    }

    public <T> f<T, String> i(Type type, Annotation[] annotationArr) {
        Objects.requireNonNull(type, "type == null");
        Objects.requireNonNull(annotationArr, "annotations == null");
        int size = this.f125992d.size();
        for (int i10 = 0; i10 < size; i10++) {
            f<T, String> fVar = (f<T, String>) this.f125992d.get(i10).stringConverter(type, annotationArr, this);
            if (fVar != null) {
                return fVar;
            }
        }
        return a.d.f125839a;
    }

    public final void j(Class<?> cls) {
        if (cls.isInterface()) {
            ArrayDeque arrayDeque = new ArrayDeque(1);
            arrayDeque.add(cls);
            while (!arrayDeque.isEmpty()) {
                Class<?> cls2 = (Class) arrayDeque.removeFirst();
                if (cls2.getTypeParameters().length != 0) {
                    StringBuilder sb3 = new StringBuilder("Type parameters are unsupported on ");
                    sb3.append(cls2.getName());
                    if (cls2 != cls) {
                        sb3.append(" which is an interface of ");
                        sb3.append(cls.getName());
                    }
                    throw new IllegalArgumentException(sb3.toString());
                }
                Collections.addAll(arrayDeque, cls2.getInterfaces());
            }
            if (this.f125995g) {
                o f14 = o.f();
                Method[] declaredMethods = cls.getDeclaredMethods();
                for (Method method : declaredMethods) {
                    if (!f14.h(method) && !Modifier.isStatic(method.getModifiers())) {
                        c(method);
                    }
                }
                return;
            }
            return;
        }
        throw new IllegalArgumentException("API declarations must be interfaces.");
    }

    /* compiled from: Retrofit */
    public static final class b {

        /* renamed from: a  reason: collision with root package name */
        public final o f126000a;

        /* renamed from: b  reason: collision with root package name */
        public Call.Factory f126001b;

        /* renamed from: c  reason: collision with root package name */
        public HttpUrl f126002c;

        /* renamed from: d  reason: collision with root package name */
        public final List<f.a> f126003d;

        /* renamed from: e  reason: collision with root package name */
        public final List<c.a> f126004e;

        /* renamed from: f  reason: collision with root package name */
        public Executor f126005f;

        /* renamed from: g  reason: collision with root package name */
        public boolean f126006g;

        public b(o oVar) {
            this.f126003d = new ArrayList();
            this.f126004e = new ArrayList();
            this.f126000a = oVar;
        }

        public b a(c.a aVar) {
            List<c.a> list = this.f126004e;
            Objects.requireNonNull(aVar, "factory == null");
            list.add(aVar);
            return this;
        }

        public b b(f.a aVar) {
            List<f.a> list = this.f126003d;
            Objects.requireNonNull(aVar, "factory == null");
            list.add(aVar);
            return this;
        }

        public b c(String str) {
            Objects.requireNonNull(str, "baseUrl == null");
            return d(HttpUrl.get(str));
        }

        public b d(HttpUrl httpUrl) {
            Objects.requireNonNull(httpUrl, "baseUrl == null");
            List<String> pathSegments = httpUrl.pathSegments();
            if ("".equals(pathSegments.get(pathSegments.size() - 1))) {
                this.f126002c = httpUrl;
                return this;
            }
            throw new IllegalArgumentException("baseUrl must end in /: " + httpUrl);
        }

        public s e() {
            if (this.f126002c != null) {
                Call.Factory factory = this.f126001b;
                if (factory == null) {
                    factory = new OkHttpClient();
                }
                Executor executor = this.f126005f;
                if (executor == null) {
                    executor = this.f126000a.b();
                }
                ArrayList arrayList = new ArrayList(this.f126004e);
                arrayList.addAll(this.f126000a.a(executor));
                ArrayList arrayList2 = new ArrayList(this.f126003d.size() + 1 + this.f126000a.d());
                arrayList2.add(new a());
                arrayList2.addAll(this.f126003d);
                arrayList2.addAll(this.f126000a.c());
                return new s(factory, this.f126002c, Collections.unmodifiableList(arrayList2), Collections.unmodifiableList(arrayList), executor, this.f126006g);
            }
            throw new IllegalStateException("Base URL required.");
        }

        public b f(Call.Factory factory) {
            Objects.requireNonNull(factory, "factory == null");
            this.f126001b = factory;
            return this;
        }

        public b() {
            this(o.f());
        }
    }
}