package ඓ.㳳.K.K.㸾;

import java.io.UnsupportedEncodingException;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import ඓ.K.K.K.C1293;
import ඓ.㳳.K.K.ʬ.AbstractC1295;
import ඓ.㳳.K.K.ῲ.C1300;
import 㿎.AbstractC2651;
import 㿎.C2531;
import 㿎.C2628;
import 㿎.C2644;
import 㿎.C2649;
import 㿎.C2657;
import 㿎.C2667;

/* renamed from: ඓ.㳳.K.K.㸾.ῲ  reason: contains not printable characters */
/* compiled from: OkHttpRequest */
public abstract class AbstractC1311 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public Map<String, String> f5087;

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f5088;

    /* renamed from: ῲ  reason: contains not printable characters */
    public Object f5089;

    /* renamed from: K  reason: contains not printable characters */
    public String f5090;

    /* renamed from: 㴹  reason: contains not printable characters */
    public C2644.C2645 f5091 = new C2644.C2645();

    /* renamed from: 㸾  reason: contains not printable characters */
    public Map<String, String> f5092;

    public AbstractC1311(String str, Object obj, Map<String, String> map, Map<String, String> map2, int i) {
        this.f5090 = str;
        this.f5089 = obj;
        this.f5087 = map;
        this.f5092 = map2;
        this.f5088 = i;
        if (str != null) {
            C2644.C2645 k = this.f5091;
            k.m6965(this.f5090);
            k.m6964(this.f5089);
            C2667.C2668 k2 = new C2667.C2668();
            Map<String, String> map3 = this.f5092;
            if (!(map3 == null || map3.isEmpty())) {
                for (String str2 : this.f5092.keySet()) {
                    k2.m7002(str2, this.f5092.get(str2));
                }
                this.f5091.m6969(new C2667(k2));
                return;
            }
            return;
        }
        throw new IllegalArgumentException(String.format("url can not be null.", new Object[0]));
    }

    /* renamed from: K  reason: contains not printable characters */
    public C2644 m3439(AbstractC1295 k) {
        C2657 r0;
        String str;
        C1315 r2 = (C1315) this;
        List<C1300.C1301> list = r2.f5098;
        if (list == null || list.isEmpty()) {
            ArrayList arrayList = new ArrayList();
            ArrayList arrayList2 = new ArrayList();
            Map<String, String> map = r2.f5087;
            if (map != null) {
                for (String str2 : map.keySet()) {
                    String str3 = r2.f5087.get(str2);
                    if (str2 == null) {
                        throw new NullPointerException("name == null");
                    } else if (str3 != null) {
                        arrayList.add(C2531.m6588(str2, " \"':;<=>@[]^`{}|/\\?#&!$(),~", false, false, true, true, null));
                        arrayList2.add(C2531.m6588(str3, " \"':;<=>@[]^`{}|/\\?#&!$(),~", false, false, true, true, null));
                    } else {
                        throw new NullPointerException("value == null");
                    }
                }
            }
            r0 = new C2649(arrayList, arrayList2);
        } else {
            C2657.C2659 k2 = new C2657.C2659();
            k2.m6985(C2657.f9032);
            Map<String, String> map2 = r2.f5087;
            if (map2 != null && !map2.isEmpty()) {
                for (String str4 : r2.f5087.keySet()) {
                    k2.m6986(C2657.C2658.m6984(C2667.m6992("Content-Disposition", C1293.m3413("form-data; name=\"", str4, "\"")), AbstractC2651.create((C2628) null, r2.f5087.get(str4))));
                }
            }
            for (int i = 0; i < r2.f5098.size(); i++) {
                C1300.C1301 k3 = r2.f5098.get(i);
                try {
                    str = URLConnection.getFileNameMap().getContentTypeFor(URLEncoder.encode(k3.f5055, "UTF-8"));
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                    str = null;
                }
                if (str == null) {
                    str = "application/octet-stream";
                }
                AbstractC2651 create = AbstractC2651.create(C2628.m6936(str), k3.f5054);
                String str5 = k3.f5056;
                String str6 = k3.f5055;
                if (str5 != null) {
                    StringBuilder sb = new StringBuilder("form-data; name=");
                    C2657.m6982(sb, str5);
                    if (str6 != null) {
                        sb.append("; filename=");
                        C2657.m6982(sb, str6);
                    }
                    k2.m6986(C2657.C2658.m6984(C2667.m6992("Content-Disposition", sb.toString()), create));
                } else {
                    throw new NullPointerException("name == null");
                }
            }
            r0 = k2.m6988();
        }
        if (k != null) {
            r0 = new C1312(r0, new C1308(r2, k));
        }
        C2644.C2645 k4 = r2.f5091;
        k4.m6967("POST", r0);
        return k4.m6970();
    }
}
