mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 16:42:30 -06:00
507 lines
26 KiB
Java
507 lines
26 KiB
Java
|
package okhttp3;
|
||
|
|
||
|
import io.sentry.protocol.OperatingSystem;
|
||
|
import java.time.Instant;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Arrays;
|
||
|
import java.util.Collections;
|
||
|
import java.util.Date;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
import java.util.Locale;
|
||
|
import java.util.Map;
|
||
|
import java.util.Set;
|
||
|
import java.util.TreeMap;
|
||
|
import java.util.TreeSet;
|
||
|
import kotlin.Deprecated;
|
||
|
import kotlin.DeprecationLevel;
|
||
|
import kotlin.Metadata;
|
||
|
import kotlin.Pair;
|
||
|
import kotlin.ReplaceWith;
|
||
|
import kotlin.TuplesKt;
|
||
|
import kotlin.collections.CollectionsKt;
|
||
|
import kotlin.jvm.JvmStatic;
|
||
|
import kotlin.jvm.internal.ArrayIteratorKt;
|
||
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||
|
import kotlin.jvm.internal.Intrinsics;
|
||
|
import kotlin.jvm.internal.StringCompanionObject;
|
||
|
import kotlin.jvm.internal.markers.KMappedMarker;
|
||
|
import kotlin.ranges.IntProgression;
|
||
|
import kotlin.ranges.RangesKt;
|
||
|
import kotlin.text.StringsKt;
|
||
|
import okhttp3.internal.Util;
|
||
|
import okhttp3.internal.http.DatesKt;
|
||
|
|
||
|
/* compiled from: Headers.kt */
|
||
|
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000f\n\u0002\u0018\u0002\n\u0002\u0010\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010(\n\u0002\b\u0002\n\u0002\u0010\"\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\u0010 \n\u0002\b\u0006\u0018\u0000 '2\u0014\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u00020\u00030\u00020\u0001:\u0002&'B\u0015\b\u0002\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00030\u0005¢\u0006\u0002\u0010\u0006J\u0006\u0010\u000b\u001a\u00020\fJ\u0013\u0010\r\u001a\u00020\u000e2\b\u0010\u000f\u001a\u0004\u0018\u00010\u0010H\u0096\u0002J\u0013\u0010\u0011\u001a\u0004\u0018\u00010\u00032\u0006\u0010\u0012\u001a\u00020\u0003H\u0086\u0002J\u0010\u0010\u0013\u001a\u0004\u0018\u00010\u00142\u0006\u0010\u0012\u001a\u00020\u0003J\u0012\u0010\u0015\u001a\u0004\u0018\u00010\u00162\u0006\u0010\u0012\u001a\u00020\u0003H\u0007J\b\u0010\u0017\u001a\u00020\tH\u0016J\u001b\u0010\u0018\u001a\u0014\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u00020\u00030\u00020\u0019H\u0096\u0002J\u000e\u0010\u0012\u001a\u00020\u00032\u0006\u0010\u001a\u001a\u00020\tJ\f\u0010\u001b\u001a\b\u0012\u0004\u0012\u00020\u00030\u001cJ\u0006\u0010\u001d\u001a\u00020\u001eJ\r\u0010\b\u001a\u00020\tH\u0007¢\u0006\u0002\b\u001fJ\u0018\u0010 \u001a\u0014\u0012\u0004\u0012\u00020\u0003\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\"0!J\b\u0010#\u001a\u00020\u0003H\u0016J\u000e\u0010$\u001a\u00020\u00032\u0006\u0010\u001a\u001a\u00020\tJ\u0014\u0010%\u001a\b\u0012\u0004\u0012\u00020\u00030\"2\u0006\u0010\u0012\u001a\u00020\u0003R\u0016\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00030\u0005X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u0007R\u0011\u0010\b\u001a\u00020\t8G¢\u0006\u0006\u001a\u0004\b\b\u0010\n¨\u0006("}, d2 = {"Lokhttp3/Headers;", "", "Lkotlin/Pair;", "", "namesAndValues", "", "([Ljava/lang/String;)V", "[Ljava/lang/String;", "size", "", "()I", "byteCount", "", "equals", "", "other", "", "get", "name", "getDate", "Ljava/util/Date;", "getInstant", "Ljava/time/Instant;", "hashCode", "iterator", "", "index", "names", "", "newBuilder", "Lokhttp3/Headers$Builder;", "-deprecated_size", "toMultimap", "", "", "toString", "value", "values", "Builder", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0})
|
||
|
/* loaded from: classes3.dex */
|
||
|
public final class Headers implements Iterable<Pair<? extends String, ? extends String>>, KMappedMarker {
|
||
|
|
||
|
/* renamed from: Companion, reason: from kotlin metadata */
|
||
|
public static final Companion INSTANCE = new Companion(null);
|
||
|
private final String[] namesAndValues;
|
||
|
|
||
|
@JvmStatic
|
||
|
public static final Headers of(Map<String, String> map) {
|
||
|
return INSTANCE.of(map);
|
||
|
}
|
||
|
|
||
|
@JvmStatic
|
||
|
public static final Headers of(String... strArr) {
|
||
|
return INSTANCE.of(strArr);
|
||
|
}
|
||
|
|
||
|
private Headers(String[] strArr) {
|
||
|
this.namesAndValues = strArr;
|
||
|
}
|
||
|
|
||
|
public /* synthetic */ Headers(String[] strArr, DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this(strArr);
|
||
|
}
|
||
|
|
||
|
public final String get(String name) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
return INSTANCE.get(this.namesAndValues, name);
|
||
|
}
|
||
|
|
||
|
public final Date getDate(String name) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
String str = get(name);
|
||
|
if (str != null) {
|
||
|
return DatesKt.toHttpDateOrNull(str);
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public final Instant getInstant(String name) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
Date date = getDate(name);
|
||
|
if (date != null) {
|
||
|
return date.toInstant();
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public final int size() {
|
||
|
return this.namesAndValues.length / 2;
|
||
|
}
|
||
|
|
||
|
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "size", imports = {}))
|
||
|
/* renamed from: -deprecated_size, reason: not valid java name */
|
||
|
public final int m7318deprecated_size() {
|
||
|
return size();
|
||
|
}
|
||
|
|
||
|
public final String name(int index) {
|
||
|
return this.namesAndValues[index * 2];
|
||
|
}
|
||
|
|
||
|
public final String value(int index) {
|
||
|
return this.namesAndValues[(index * 2) + 1];
|
||
|
}
|
||
|
|
||
|
public final Set<String> names() {
|
||
|
TreeSet treeSet = new TreeSet(StringsKt.getCASE_INSENSITIVE_ORDER(StringCompanionObject.INSTANCE));
|
||
|
int size = size();
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
treeSet.add(name(i));
|
||
|
}
|
||
|
Set<String> unmodifiableSet = Collections.unmodifiableSet(treeSet);
|
||
|
Intrinsics.checkNotNullExpressionValue(unmodifiableSet, "Collections.unmodifiableSet(result)");
|
||
|
return unmodifiableSet;
|
||
|
}
|
||
|
|
||
|
public final List<String> values(String name) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
ArrayList arrayList = null;
|
||
|
int size = size();
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
if (StringsKt.equals(name, name(i), true)) {
|
||
|
if (arrayList == null) {
|
||
|
arrayList = new ArrayList(2);
|
||
|
}
|
||
|
arrayList.add(value(i));
|
||
|
}
|
||
|
}
|
||
|
if (arrayList != null) {
|
||
|
List<String> unmodifiableList = Collections.unmodifiableList(arrayList);
|
||
|
Intrinsics.checkNotNullExpressionValue(unmodifiableList, "Collections.unmodifiableList(result)");
|
||
|
return unmodifiableList;
|
||
|
}
|
||
|
return CollectionsKt.emptyList();
|
||
|
}
|
||
|
|
||
|
public final long byteCount() {
|
||
|
String[] strArr = this.namesAndValues;
|
||
|
long length = strArr.length * 2;
|
||
|
for (int i = 0; i < strArr.length; i++) {
|
||
|
length += this.namesAndValues[i].length();
|
||
|
}
|
||
|
return length;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Iterable
|
||
|
public Iterator<Pair<? extends String, ? extends String>> iterator() {
|
||
|
int size = size();
|
||
|
Pair[] pairArr = new Pair[size];
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
pairArr[i] = TuplesKt.to(name(i), value(i));
|
||
|
}
|
||
|
return ArrayIteratorKt.iterator(pairArr);
|
||
|
}
|
||
|
|
||
|
public final Builder newBuilder() {
|
||
|
Builder builder = new Builder();
|
||
|
CollectionsKt.addAll(builder.getNamesAndValues$okhttp(), this.namesAndValues);
|
||
|
return builder;
|
||
|
}
|
||
|
|
||
|
public boolean equals(Object other) {
|
||
|
return (other instanceof Headers) && Arrays.equals(this.namesAndValues, ((Headers) other).namesAndValues);
|
||
|
}
|
||
|
|
||
|
public int hashCode() {
|
||
|
return Arrays.hashCode(this.namesAndValues);
|
||
|
}
|
||
|
|
||
|
public String toString() {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
int size = size();
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
sb.append(name(i));
|
||
|
sb.append(": ");
|
||
|
sb.append(value(i));
|
||
|
sb.append("\n");
|
||
|
}
|
||
|
String sb2 = sb.toString();
|
||
|
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder().apply(builderAction).toString()");
|
||
|
return sb2;
|
||
|
}
|
||
|
|
||
|
public final Map<String, List<String>> toMultimap() {
|
||
|
TreeMap treeMap = new TreeMap(StringsKt.getCASE_INSENSITIVE_ORDER(StringCompanionObject.INSTANCE));
|
||
|
int size = size();
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
String name = name(i);
|
||
|
Locale locale = Locale.US;
|
||
|
Intrinsics.checkNotNullExpressionValue(locale, "Locale.US");
|
||
|
if (name == null) {
|
||
|
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
|
||
|
}
|
||
|
String lowerCase = name.toLowerCase(locale);
|
||
|
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase(locale)");
|
||
|
ArrayList arrayList = (List) treeMap.get(lowerCase);
|
||
|
if (arrayList == null) {
|
||
|
arrayList = new ArrayList(2);
|
||
|
treeMap.put(lowerCase, arrayList);
|
||
|
}
|
||
|
arrayList.add(value(i));
|
||
|
}
|
||
|
return treeMap;
|
||
|
}
|
||
|
|
||
|
/* compiled from: Headers.kt */
|
||
|
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010!\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u000e\u0010\b\u001a\u00020\u00002\u0006\u0010\t\u001a\u00020\u0005J\u0018\u0010\b\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\fH\u0007J\u0016\u0010\b\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\rJ\u0016\u0010\b\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\u0005J\u000e\u0010\u000e\u001a\u00020\u00002\u0006\u0010\u000f\u001a\u00020\u0010J\u0015\u0010\u0011\u001a\u00020\u00002\u0006\u0010\t\u001a\u00020\u0005H\u0000¢\u0006\u0002\b\u0012J\u001d\u0010\u0011\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\u0005H\u0000¢\u0006\u0002\b\u0012J\u0016\u0010\u0013\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\u0005J\u0006\u0010\u0014\u001a\u00020\u0010J\u0013\u0010\u0015\u001a\u0004\u0018\u00010\u00052\u0006\u0010\n\u001a\u00020\u0005H\u0086\u0002J\u000e\u0010\u0016\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u0005J\u0019\u0010\u0017\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\fH\u0087\u0002J\u0019\u0010\u0017\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\rH\u0086\u0002J\u0019\u0010\u0017\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\u0005H\u0086\u0002R\u001a\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007¨\u0006\u0018"}, d2 = {"Lokhttp3/Headers$Builder;", "", "()V", "namesAndValues", "", "", "getNamesAndValues$okhttp", "()Ljava/util/List;", "add", "line", "name", "value", "Ljava/time/Instant;", "Ljava/util/Date;", "addAll", "headers", "Lokhttp3/Headers;", "addLenient", "addLenient$okhttp", "addUnsafeNonAscii", OperatingSystem.JsonKeys.BUILD, "get", "removeAll", "set", "okhttp"}, k = 1, mv = {1, 4, 0})
|
||
|
/* loaded from: classes3.dex */
|
||
|
public static final class Builder {
|
||
|
private final List<String> namesAndValues = new ArrayList(20);
|
||
|
|
||
|
public final List<String> getNamesAndValues$okhttp() {
|
||
|
return this.namesAndValues;
|
||
|
}
|
||
|
|
||
|
public final Builder addLenient$okhttp(String line) {
|
||
|
Intrinsics.checkNotNullParameter(line, "line");
|
||
|
int indexOf$default = StringsKt.indexOf$default((CharSequence) line, ':', 1, false, 4, (Object) null);
|
||
|
if (indexOf$default != -1) {
|
||
|
String substring = line.substring(0, indexOf$default);
|
||
|
Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
|
||
|
String substring2 = line.substring(indexOf$default + 1);
|
||
|
Intrinsics.checkNotNullExpressionValue(substring2, "(this as java.lang.String).substring(startIndex)");
|
||
|
addLenient$okhttp(substring, substring2);
|
||
|
} else if (line.charAt(0) == ':') {
|
||
|
String substring3 = line.substring(1);
|
||
|
Intrinsics.checkNotNullExpressionValue(substring3, "(this as java.lang.String).substring(startIndex)");
|
||
|
addLenient$okhttp("", substring3);
|
||
|
} else {
|
||
|
addLenient$okhttp("", line);
|
||
|
}
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder add(String line) {
|
||
|
Intrinsics.checkNotNullParameter(line, "line");
|
||
|
int indexOf$default = StringsKt.indexOf$default((CharSequence) line, ':', 0, false, 6, (Object) null);
|
||
|
if (!(indexOf$default != -1)) {
|
||
|
throw new IllegalArgumentException(("Unexpected header: " + line).toString());
|
||
|
}
|
||
|
String substring = line.substring(0, indexOf$default);
|
||
|
Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
|
||
|
if (substring == null) {
|
||
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
|
||
|
}
|
||
|
String obj = StringsKt.trim((CharSequence) substring).toString();
|
||
|
String substring2 = line.substring(indexOf$default + 1);
|
||
|
Intrinsics.checkNotNullExpressionValue(substring2, "(this as java.lang.String).substring(startIndex)");
|
||
|
add(obj, substring2);
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder add(String name, String value) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
Intrinsics.checkNotNullParameter(value, "value");
|
||
|
Headers.INSTANCE.checkName(name);
|
||
|
Headers.INSTANCE.checkValue(value, name);
|
||
|
addLenient$okhttp(name, value);
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder addUnsafeNonAscii(String name, String value) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
Intrinsics.checkNotNullParameter(value, "value");
|
||
|
Headers.INSTANCE.checkName(name);
|
||
|
addLenient$okhttp(name, value);
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder addAll(Headers headers) {
|
||
|
Intrinsics.checkNotNullParameter(headers, "headers");
|
||
|
int size = headers.size();
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
addLenient$okhttp(headers.name(i), headers.value(i));
|
||
|
}
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder add(String name, Date value) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
Intrinsics.checkNotNullParameter(value, "value");
|
||
|
add(name, DatesKt.toHttpDateString(value));
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder add(String name, Instant value) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
Intrinsics.checkNotNullParameter(value, "value");
|
||
|
add(name, new Date(value.toEpochMilli()));
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder set(String name, Date value) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
Intrinsics.checkNotNullParameter(value, "value");
|
||
|
set(name, DatesKt.toHttpDateString(value));
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder set(String name, Instant value) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
Intrinsics.checkNotNullParameter(value, "value");
|
||
|
return set(name, new Date(value.toEpochMilli()));
|
||
|
}
|
||
|
|
||
|
public final Builder addLenient$okhttp(String name, String value) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
Intrinsics.checkNotNullParameter(value, "value");
|
||
|
this.namesAndValues.add(name);
|
||
|
this.namesAndValues.add(StringsKt.trim((CharSequence) value).toString());
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder removeAll(String name) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
int i = 0;
|
||
|
while (i < this.namesAndValues.size()) {
|
||
|
if (StringsKt.equals(name, this.namesAndValues.get(i), true)) {
|
||
|
this.namesAndValues.remove(i);
|
||
|
this.namesAndValues.remove(i);
|
||
|
i -= 2;
|
||
|
}
|
||
|
i += 2;
|
||
|
}
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder set(String name, String value) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
Intrinsics.checkNotNullParameter(value, "value");
|
||
|
Headers.INSTANCE.checkName(name);
|
||
|
Headers.INSTANCE.checkValue(value, name);
|
||
|
removeAll(name);
|
||
|
addLenient$okhttp(name, value);
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final String get(String name) {
|
||
|
Intrinsics.checkNotNullParameter(name, "name");
|
||
|
IntProgression step = RangesKt.step(RangesKt.downTo(this.namesAndValues.size() - 2, 0), 2);
|
||
|
int first = step.getFirst();
|
||
|
int last = step.getLast();
|
||
|
int step2 = step.getStep();
|
||
|
if (step2 >= 0) {
|
||
|
if (first > last) {
|
||
|
return null;
|
||
|
}
|
||
|
} else if (first < last) {
|
||
|
return null;
|
||
|
}
|
||
|
while (!StringsKt.equals(name, this.namesAndValues.get(first), true)) {
|
||
|
if (first == last) {
|
||
|
return null;
|
||
|
}
|
||
|
first += step2;
|
||
|
}
|
||
|
return this.namesAndValues.get(first + 1);
|
||
|
}
|
||
|
|
||
|
public final Headers build() {
|
||
|
Object[] array = this.namesAndValues.toArray(new String[0]);
|
||
|
if (array != null) {
|
||
|
return new Headers((String[]) array, null);
|
||
|
}
|
||
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: Headers.kt */
|
||
|
@Metadata(bv = {1, 0, 3}, d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010\u0011\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010$\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0002J\u0018\u0010\u0007\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\u00062\u0006\u0010\u0005\u001a\u00020\u0006H\u0002J%\u0010\t\u001a\u0004\u0018\u00010\u00062\f\u0010\n\u001a\b\u0012\u0004\u0012\u00020\u00060\u000b2\u0006\u0010\u0005\u001a\u00020\u0006H\u0002¢\u0006\u0002\u0010\fJ#\u0010\r\u001a\u00020\u000e2\u0012\u0010\n\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u000b\"\u00020\u0006H\u0007¢\u0006\u0004\b\u000f\u0010\u0010J#\u0010\u000f\u001a\u00020\u000e2\u0012\u0010\n\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u000b\"\u00020\u0006H\u0007¢\u0006\u0004\b\u0011\u0010\u0010J!\u0010\u000f\u001a\u00020\u000e2\u0012\u0010\u0012\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00060\u0013H\u0007¢\u0006\u0002\b\u0011J\u001d\u0010\u0014\u001a\u00020\u000e*\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00060\u0013H\u0007¢\u0006\u0002\b\u000f¨\u0006\u0015"}, d2 = {"Lokhttp3/Headers$Companion;", "", "()V", "checkName", "", "name", "", "checkValue", "value", "get", "namesAndValues", "", "([Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", "headersOf", "Lokhttp3/Headers;", "of", "([Ljava/lang/String;)Lokhttp3/Headers;", "-deprecated_of", "headers", "", "toHeaders", "okhttp"}, k = 1, mv = {1, 4, 0})
|
||
|
/* loaded from: classes3.dex */
|
||
|
public static final class Companion {
|
||
|
private Companion() {
|
||
|
}
|
||
|
|
||
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public final String get(String[] namesAndValues, String name) {
|
||
|
IntProgression step = RangesKt.step(RangesKt.downTo(namesAndValues.length - 2, 0), 2);
|
||
|
int first = step.getFirst();
|
||
|
int last = step.getLast();
|
||
|
int step2 = step.getStep();
|
||
|
if (step2 >= 0) {
|
||
|
if (first > last) {
|
||
|
return null;
|
||
|
}
|
||
|
} else if (first < last) {
|
||
|
return null;
|
||
|
}
|
||
|
while (!StringsKt.equals(name, namesAndValues[first], true)) {
|
||
|
if (first == last) {
|
||
|
return null;
|
||
|
}
|
||
|
first += step2;
|
||
|
}
|
||
|
return namesAndValues[first + 1];
|
||
|
}
|
||
|
|
||
|
@JvmStatic
|
||
|
public final Headers of(String... namesAndValues) {
|
||
|
Intrinsics.checkNotNullParameter(namesAndValues, "namesAndValues");
|
||
|
if (!(namesAndValues.length % 2 == 0)) {
|
||
|
throw new IllegalArgumentException("Expected alternating header names and values".toString());
|
||
|
}
|
||
|
Object clone = namesAndValues.clone();
|
||
|
if (clone == null) {
|
||
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<kotlin.String>");
|
||
|
}
|
||
|
String[] strArr = (String[]) clone;
|
||
|
int length = strArr.length;
|
||
|
for (int i = 0; i < length; i++) {
|
||
|
String str = strArr[i];
|
||
|
if (!(str != null)) {
|
||
|
throw new IllegalArgumentException("Headers cannot be null".toString());
|
||
|
}
|
||
|
if (str == null) {
|
||
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
|
||
|
}
|
||
|
strArr[i] = StringsKt.trim((CharSequence) str).toString();
|
||
|
}
|
||
|
IntProgression step = RangesKt.step(RangesKt.until(0, strArr.length), 2);
|
||
|
int first = step.getFirst();
|
||
|
int last = step.getLast();
|
||
|
int step2 = step.getStep();
|
||
|
if (step2 < 0 ? first >= last : first <= last) {
|
||
|
while (true) {
|
||
|
String str2 = strArr[first];
|
||
|
String str3 = strArr[first + 1];
|
||
|
checkName(str2);
|
||
|
checkValue(str3, str2);
|
||
|
if (first == last) {
|
||
|
break;
|
||
|
}
|
||
|
first += step2;
|
||
|
}
|
||
|
}
|
||
|
return new Headers(strArr, null);
|
||
|
}
|
||
|
|
||
|
@Deprecated(level = DeprecationLevel.ERROR, message = "function name changed", replaceWith = @ReplaceWith(expression = "headersOf(*namesAndValues)", imports = {}))
|
||
|
/* renamed from: -deprecated_of, reason: not valid java name */
|
||
|
public final Headers m7320deprecated_of(String... namesAndValues) {
|
||
|
Intrinsics.checkNotNullParameter(namesAndValues, "namesAndValues");
|
||
|
return of((String[]) Arrays.copyOf(namesAndValues, namesAndValues.length));
|
||
|
}
|
||
|
|
||
|
@JvmStatic
|
||
|
public final Headers of(Map<String, String> toHeaders) {
|
||
|
Intrinsics.checkNotNullParameter(toHeaders, "$this$toHeaders");
|
||
|
String[] strArr = new String[toHeaders.size() * 2];
|
||
|
int i = 0;
|
||
|
for (Map.Entry<String, String> entry : toHeaders.entrySet()) {
|
||
|
String key = entry.getKey();
|
||
|
String value = entry.getValue();
|
||
|
if (key != null) {
|
||
|
String obj = StringsKt.trim((CharSequence) key).toString();
|
||
|
if (value != null) {
|
||
|
String obj2 = StringsKt.trim((CharSequence) value).toString();
|
||
|
checkName(obj);
|
||
|
checkValue(obj2, obj);
|
||
|
strArr[i] = obj;
|
||
|
strArr[i + 1] = obj2;
|
||
|
i += 2;
|
||
|
} else {
|
||
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
|
||
|
}
|
||
|
} else {
|
||
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
|
||
|
}
|
||
|
}
|
||
|
return new Headers(strArr, null);
|
||
|
}
|
||
|
|
||
|
@Deprecated(level = DeprecationLevel.ERROR, message = "function moved to extension", replaceWith = @ReplaceWith(expression = "headers.toHeaders()", imports = {}))
|
||
|
/* renamed from: -deprecated_of, reason: not valid java name */
|
||
|
public final Headers m7319deprecated_of(Map<String, String> headers) {
|
||
|
Intrinsics.checkNotNullParameter(headers, "headers");
|
||
|
return of(headers);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public final void checkName(String name) {
|
||
|
if (!(name.length() > 0)) {
|
||
|
throw new IllegalArgumentException("name is empty".toString());
|
||
|
}
|
||
|
int length = name.length();
|
||
|
for (int i = 0; i < length; i++) {
|
||
|
char charAt = name.charAt(i);
|
||
|
if (!('!' <= charAt && '~' >= charAt)) {
|
||
|
throw new IllegalArgumentException(Util.format("Unexpected char %#04x at %d in header name: %s", Integer.valueOf(charAt), Integer.valueOf(i), name).toString());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public final void checkValue(String value, String name) {
|
||
|
int length = value.length();
|
||
|
for (int i = 0; i < length; i++) {
|
||
|
char charAt = value.charAt(i);
|
||
|
if (!(charAt == '\t' || (' ' <= charAt && '~' >= charAt))) {
|
||
|
throw new IllegalArgumentException(Util.format("Unexpected char %#04x at %d in %s value: %s", Integer.valueOf(charAt), Integer.valueOf(i), name, value).toString());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|