mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-15 10:27:17 +01:00
532 lines
25 KiB
Java
532 lines
25 KiB
Java
package okhttp3;
|
|
|
|
import androidx.room.util.TableInfo$$ExternalSyntheticOutline0;
|
|
import com.amazon.alexa.redesign.view.container.CardStudioAgentSpaceMetrics;
|
|
import com.amazon.clouddrive.extended.model.BulkOperationType;
|
|
import com.dee.app.metrics.MetricsConstants;
|
|
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
|
|
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.collections.CollectionsKt__MutableCollectionsKt;
|
|
import kotlin.internal.ProgressionUtilKt;
|
|
import kotlin.jvm.JvmName;
|
|
import kotlin.jvm.JvmStatic;
|
|
import kotlin.jvm.internal.ArrayIteratorKt;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
import kotlin.jvm.internal.StringCompanionObject;
|
|
import kotlin.jvm.internal.markers.KMappedMarker;
|
|
import kotlin.text.StringsKt;
|
|
import kotlin.text.StringsKt__StringsKt;
|
|
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;
|
|
import okhttp3.internal.Util;
|
|
import okhttp3.internal.http.DatesKt;
|
|
import okio.Buffer$$ExternalSyntheticBUOutline0;
|
|
import okio.Path$$ExternalSyntheticBUOutline0;
|
|
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(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", "", CardStudioAgentSpaceMetrics.DimensionValue.SCHEME_OTHER, "", MetricsConstants.Method.CACHE_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, 8, 0}, xi = 48)
|
|
/* loaded from: classes10.dex */
|
|
public final class Headers implements Iterable<Pair<? extends String, ? extends String>>, KMappedMarker {
|
|
|
|
/* renamed from: Companion, reason: from kotlin metadata */
|
|
@NotNull
|
|
public static final Companion INSTANCE = new Companion(null);
|
|
|
|
@NotNull
|
|
private final String[] namesAndValues;
|
|
|
|
private Headers(String[] strArr) {
|
|
this.namesAndValues = strArr;
|
|
}
|
|
|
|
@JvmStatic
|
|
@JvmName(name = "of")
|
|
@NotNull
|
|
public static final Headers of(@NotNull Map<String, String> map) {
|
|
return INSTANCE.of(map);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "size", imports = {}))
|
|
@JvmName(name = "-deprecated_size")
|
|
/* renamed from: -deprecated_size, reason: not valid java name */
|
|
public final int m27076deprecated_size() {
|
|
return size();
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
public boolean equals(@Nullable Object other) {
|
|
return (other instanceof Headers) && Arrays.equals(this.namesAndValues, ((Headers) other).namesAndValues);
|
|
}
|
|
|
|
@Nullable
|
|
public final String get(@NotNull String name) {
|
|
name.getClass();
|
|
return INSTANCE.get(this.namesAndValues, name);
|
|
}
|
|
|
|
@Nullable
|
|
public final Date getDate(@NotNull String name) {
|
|
name.getClass();
|
|
String str = get(name);
|
|
if (str != null) {
|
|
return DatesKt.toHttpDateOrNull(str);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@IgnoreJRERequirement
|
|
@Nullable
|
|
public final Instant getInstant(@NotNull String name) {
|
|
name.getClass();
|
|
Date date = getDate(name);
|
|
if (date != null) {
|
|
return date.toInstant();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return Arrays.hashCode(this.namesAndValues);
|
|
}
|
|
|
|
@Override // java.lang.Iterable
|
|
@NotNull
|
|
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);
|
|
}
|
|
|
|
@NotNull
|
|
public final String name(int index) {
|
|
return this.namesAndValues[index * 2];
|
|
}
|
|
|
|
@NotNull
|
|
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);
|
|
unmodifiableSet.getClass();
|
|
return unmodifiableSet;
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder newBuilder() {
|
|
Builder builder = new Builder();
|
|
CollectionsKt__MutableCollectionsKt.addAll(builder.getNamesAndValues$okhttp(), this.namesAndValues);
|
|
return builder;
|
|
}
|
|
|
|
@JvmName(name = "size")
|
|
public final int size() {
|
|
return this.namesAndValues.length / 2;
|
|
}
|
|
|
|
@NotNull
|
|
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;
|
|
String m = TableInfo$$ExternalSyntheticOutline0.m(locale, name, locale);
|
|
List list = (List) treeMap.get(m);
|
|
if (list == null) {
|
|
list = new ArrayList(2);
|
|
treeMap.put(m, list);
|
|
}
|
|
list.add(value(i));
|
|
}
|
|
return treeMap;
|
|
}
|
|
|
|
@NotNull
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
int size = size();
|
|
for (int i = 0; i < size; i++) {
|
|
String name = name(i);
|
|
String value = value(i);
|
|
sb.append(name);
|
|
sb.append(": ");
|
|
if (Util.isSensitiveHeader(name)) {
|
|
value = "██";
|
|
}
|
|
sb.append(value);
|
|
sb.append("\n");
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
@NotNull
|
|
public final String value(int index) {
|
|
return this.namesAndValues[(index * 2) + 1];
|
|
}
|
|
|
|
@NotNull
|
|
public final List<String> values(@NotNull String name) {
|
|
name.getClass();
|
|
int size = size();
|
|
ArrayList arrayList = null;
|
|
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) {
|
|
return CollectionsKt.emptyList();
|
|
}
|
|
List<String> unmodifiableList = Collections.unmodifiableList(arrayList);
|
|
unmodifiableList.getClass();
|
|
return unmodifiableList;
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(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", MetricsConstants.Method.CACHE_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, 8, 0}, xi = 48)
|
|
@SourceDebugExtension({"SMAP\nHeaders.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Headers.kt\nokhttp3/Headers$Companion\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,458:1\n1#2:459\n*E\n"})
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final void checkName(String name) {
|
|
if (name.length() <= 0) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3("name is empty");
|
|
return;
|
|
}
|
|
int length = name.length();
|
|
for (int i = 0; i < length; i++) {
|
|
char charAt = name.charAt(i);
|
|
if ('!' > charAt || charAt >= 127) {
|
|
Path$$ExternalSyntheticBUOutline0.m((Object) Util.format("Unexpected char %#04x at %d in header name: %s", Integer.valueOf(charAt), Integer.valueOf(i), name));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* 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 >= 127)) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(Util.format("Unexpected char %#04x at %d in %s value", Integer.valueOf(charAt), Integer.valueOf(i), name));
|
|
Buffer$$ExternalSyntheticBUOutline0.m(Util.isSensitiveHeader(name) ? "" : ": ".concat(value), sb);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final String get(String[] namesAndValues, String name) {
|
|
int length = namesAndValues.length - 2;
|
|
int progressionLastElement = ProgressionUtilKt.getProgressionLastElement(length, 0, -2);
|
|
if (progressionLastElement > length) {
|
|
return null;
|
|
}
|
|
while (!StringsKt.equals(name, namesAndValues[length], true)) {
|
|
if (length == progressionLastElement) {
|
|
return null;
|
|
}
|
|
length -= 2;
|
|
}
|
|
return namesAndValues[length + 1];
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.ERROR, message = "function name changed", replaceWith = @ReplaceWith(expression = "headersOf(*namesAndValues)", imports = {}))
|
|
@JvmName(name = "-deprecated_of")
|
|
@NotNull
|
|
/* renamed from: -deprecated_of, reason: not valid java name */
|
|
public final Headers m27078deprecated_of(@NotNull String... namesAndValues) {
|
|
namesAndValues.getClass();
|
|
return of((String[]) Arrays.copyOf(namesAndValues, namesAndValues.length));
|
|
}
|
|
|
|
@JvmStatic
|
|
@JvmName(name = "of")
|
|
@NotNull
|
|
public final Headers of(@NotNull String... namesAndValues) {
|
|
namesAndValues.getClass();
|
|
if (namesAndValues.length % 2 != 0) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3("Expected alternating header names and values");
|
|
return null;
|
|
}
|
|
String[] strArr = (String[]) namesAndValues.clone();
|
|
int length = strArr.length;
|
|
int i = 0;
|
|
for (int i2 = 0; i2 < length; i2++) {
|
|
String str = strArr[i2];
|
|
if (str == null) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3("Headers cannot be null");
|
|
return null;
|
|
}
|
|
strArr[i2] = StringsKt.trim((CharSequence) str).toString();
|
|
}
|
|
int progressionLastElement = ProgressionUtilKt.getProgressionLastElement(0, strArr.length - 1, 2);
|
|
if (progressionLastElement >= 0) {
|
|
while (true) {
|
|
String str2 = strArr[i];
|
|
String str3 = strArr[i + 1];
|
|
checkName(str2);
|
|
checkValue(str3, str2);
|
|
if (i == progressionLastElement) {
|
|
break;
|
|
}
|
|
i += 2;
|
|
}
|
|
}
|
|
return new Headers(strArr, null);
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.ERROR, message = "function moved to extension", replaceWith = @ReplaceWith(expression = "headers.toHeaders()", imports = {}))
|
|
@JvmName(name = "-deprecated_of")
|
|
@NotNull
|
|
/* renamed from: -deprecated_of, reason: not valid java name */
|
|
public final Headers m27077deprecated_of(@NotNull Map<String, String> headers) {
|
|
headers.getClass();
|
|
return of(headers);
|
|
}
|
|
|
|
@JvmStatic
|
|
@JvmName(name = "of")
|
|
@NotNull
|
|
public final Headers of(@NotNull Map<String, String> map) {
|
|
map.getClass();
|
|
String[] strArr = new String[map.size() * 2];
|
|
int i = 0;
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
String key = entry.getKey();
|
|
String value = entry.getValue();
|
|
String obj = StringsKt.trim((CharSequence) key).toString();
|
|
String obj2 = StringsKt.trim((CharSequence) value).toString();
|
|
checkName(obj);
|
|
checkValue(obj2, obj);
|
|
strArr[i] = obj;
|
|
strArr[i + 1] = obj2;
|
|
i += 2;
|
|
}
|
|
return new Headers(strArr, null);
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ Headers(String[] strArr, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(strArr);
|
|
}
|
|
|
|
@JvmStatic
|
|
@JvmName(name = "of")
|
|
@NotNull
|
|
public static final Headers of(@NotNull String... strArr) {
|
|
return INSTANCE.of(strArr);
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(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;", BulkOperationType.add, "line", "name", "value", "Ljava/time/Instant;", "Ljava/util/Date;", "addAll", "headers", "Lokhttp3/Headers;", "addLenient", "addLenient$okhttp", "addUnsafeNonAscii", JsonPOJOBuilder.DEFAULT_BUILD_METHOD, MetricsConstants.Method.CACHE_GET, "removeAll", "set", "okhttp"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
@SourceDebugExtension({"SMAP\nHeaders.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Headers.kt\nokhttp3/Headers$Builder\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 ArraysJVM.kt\nkotlin/collections/ArraysKt__ArraysJVMKt\n*L\n1#1,458:1\n1#2:459\n37#3,2:460\n*S KotlinDebug\n*F\n+ 1 Headers.kt\nokhttp3/Headers$Builder\n*L\n359#1:460,2\n*E\n"})
|
|
public static final class Builder {
|
|
|
|
@NotNull
|
|
private final List<String> namesAndValues = new ArrayList(20);
|
|
|
|
@NotNull
|
|
public final Builder add(@NotNull String line) {
|
|
int indexOf$default;
|
|
line.getClass();
|
|
indexOf$default = StringsKt__StringsKt.indexOf$default(line, AbstractJsonLexerKt.COLON, 0, false, 6, (Object) null);
|
|
if (indexOf$default != -1) {
|
|
add(StringsKt.trim((CharSequence) line.substring(0, indexOf$default)).toString(), line.substring(indexOf$default + 1));
|
|
return this;
|
|
}
|
|
Path$$ExternalSyntheticBUOutline0.m((Object) "Unexpected header: ".concat(line));
|
|
return null;
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder addAll(@NotNull Headers headers) {
|
|
headers.getClass();
|
|
int size = headers.size();
|
|
for (int i = 0; i < size; i++) {
|
|
addLenient$okhttp(headers.name(i), headers.value(i));
|
|
}
|
|
return this;
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder addLenient$okhttp(@NotNull String line) {
|
|
int indexOf$default;
|
|
line.getClass();
|
|
indexOf$default = StringsKt__StringsKt.indexOf$default(line, AbstractJsonLexerKt.COLON, 1, false, 4, (Object) null);
|
|
if (indexOf$default != -1) {
|
|
addLenient$okhttp(line.substring(0, indexOf$default), line.substring(indexOf$default + 1));
|
|
return this;
|
|
}
|
|
if (line.charAt(0) == ':') {
|
|
addLenient$okhttp("", line.substring(1));
|
|
return this;
|
|
}
|
|
addLenient$okhttp("", line);
|
|
return this;
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder addUnsafeNonAscii(@NotNull String name, @NotNull String value) {
|
|
name.getClass();
|
|
value.getClass();
|
|
Headers.INSTANCE.checkName(name);
|
|
addLenient$okhttp(name, value);
|
|
return this;
|
|
}
|
|
|
|
@NotNull
|
|
public final Headers build() {
|
|
return new Headers((String[]) this.namesAndValues.toArray(new String[0]), null);
|
|
}
|
|
|
|
@Nullable
|
|
public final String get(@NotNull String name) {
|
|
name.getClass();
|
|
int size = this.namesAndValues.size() - 2;
|
|
int progressionLastElement = ProgressionUtilKt.getProgressionLastElement(size, 0, -2);
|
|
if (progressionLastElement > size) {
|
|
return null;
|
|
}
|
|
while (!StringsKt.equals(name, this.namesAndValues.get(size), true)) {
|
|
if (size == progressionLastElement) {
|
|
return null;
|
|
}
|
|
size -= 2;
|
|
}
|
|
return this.namesAndValues.get(size + 1);
|
|
}
|
|
|
|
@NotNull
|
|
public final List<String> getNamesAndValues$okhttp() {
|
|
return this.namesAndValues;
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder removeAll(@NotNull String name) {
|
|
name.getClass();
|
|
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;
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder set(@NotNull String name, @NotNull String value) {
|
|
name.getClass();
|
|
value.getClass();
|
|
Companion companion = Headers.INSTANCE;
|
|
companion.checkName(name);
|
|
companion.checkValue(value, name);
|
|
removeAll(name);
|
|
addLenient$okhttp(name, value);
|
|
return this;
|
|
}
|
|
|
|
@IgnoreJRERequirement
|
|
@NotNull
|
|
public final Builder set(@NotNull String name, @NotNull Instant value) {
|
|
name.getClass();
|
|
value.getClass();
|
|
return set(name, new Date(value.toEpochMilli()));
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder set(@NotNull String name, @NotNull Date value) {
|
|
name.getClass();
|
|
value.getClass();
|
|
set(name, DatesKt.toHttpDateString(value));
|
|
return this;
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder add(@NotNull String name, @NotNull String value) {
|
|
name.getClass();
|
|
value.getClass();
|
|
Companion companion = Headers.INSTANCE;
|
|
companion.checkName(name);
|
|
companion.checkValue(value, name);
|
|
addLenient$okhttp(name, value);
|
|
return this;
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder addLenient$okhttp(@NotNull String name, @NotNull String value) {
|
|
name.getClass();
|
|
value.getClass();
|
|
this.namesAndValues.add(name);
|
|
this.namesAndValues.add(StringsKt.trim((CharSequence) value).toString());
|
|
return this;
|
|
}
|
|
|
|
@NotNull
|
|
public final Builder add(@NotNull String name, @NotNull Date value) {
|
|
name.getClass();
|
|
value.getClass();
|
|
add(name, DatesKt.toHttpDateString(value));
|
|
return this;
|
|
}
|
|
|
|
@IgnoreJRERequirement
|
|
@NotNull
|
|
public final Builder add(@NotNull String name, @NotNull Instant value) {
|
|
name.getClass();
|
|
value.getClass();
|
|
add(name, new Date(value.toEpochMilli()));
|
|
return this;
|
|
}
|
|
}
|
|
}
|