content: package okhttp3;
  
  import java.net.URL;
  import java.util.LinkedHashMap;
  import java.util.List;
  import java.util.Map;
  import kotlin.Deprecated;
  import kotlin.DeprecationLevel;
  import kotlin.Metadata;
  import kotlin.Pair;
  import kotlin.ReplaceWith;
  import kotlin.collections.CollectionsKt;
  import kotlin.collections.MapsKt;
  import kotlin.jvm.internal.Intrinsics;
  import kotlin.text.StringsKt;
  import okhttp3.Headers;
  import okhttp3.HttpUrl;
  import okhttp3.internal.Util;
  import okhttp3.internal.http.HttpMethod;
  
  @Metadata(bv = {1, 0, 3}, d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010$\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u000b\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u00020\u0001:\u0001*BA\b\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\b\u0010\b\u001a\u0004\u0018\u00010\t\u0012\u0016\u0010\n\u001a\u0012\u0012\b\u0012\u0006\u0012\u0002\b\u00030\f\u0012\u0004\u0012\u00020\u00010\u000b¢\u0006\u0002\u0010\rJ\u000f\u0010\b\u001a\u0004\u0018\u00010\tH\u0007¢\u0006\u0002\b\u001bJ\r\u0010\u000f\u001a\u00020\u0010H\u0007¢\u0006\u0002\b\u001cJ\u0010\u0010\u001d\u001a\u0004\u0018\u00010\u00052\u0006\u0010\u001e\u001a\u00020\u0005J\r\u0010\u0006\u001a\u00020\u0007H\u0007¢\u0006\u0002\b\u001fJ\u0014\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\u00050 2\u0006\u0010\u001e\u001a\u00020\u0005J\r\u0010\u0004\u001a\u00020\u0005H\u0007¢\u0006\u0002\b!J\u0006\u0010\"\u001a\u00020#J\b\u0010$\u001a\u0004\u0018\u00010\u0001J#\u0010$\u001a\u0004\u0018\u0001H%\"\u0004\b\u0000\u0010%2\u000e\u0010&\u001a\n\u0012\u0006\b\u0001\u0012\u0002H%0\f¢\u0006\u0002\u0010'J\b\u0010(\u001a\u00020\u0005H\u0016J\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b)R\u0015\u0010\b\u001a\u0004\u0018\u00010\t8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u000eR\u0011\u0010\u000f\u001a\u00020\u00108G¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0011R\u0013\u0010\u0006\u001a\u00020\u00078\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0012R\u0011\u0010\u0013\u001a\u00020\u00148F¢\u0006\u0006\u001a\u0004\b\u0013\u0010\u0015R\u0010\u0010\u0016\u001a\u0004\u0018\u00010\u0010X\u000e¢\u0006\u0002\n\u0000R\u0013\u0010\u0004\u001a\u00020\u00058\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u0017R$\u0010\n\u001a\u0012\u0012\b\u0012\u0006\u0012\u0002\b\u00030\f\u0012\u0004\u0012\u00020\u00010\u000bX\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0018\u0010\u0019R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u001a¨\u0006+"}, d2 = {"Lokhttp3/Request;", "", "url", "Lokhttp3/HttpUrl;", "method", "", "headers", "Lokhttp3/Headers;", "body", "Lokhttp3/RequestBody;", "tags", "", "Ljava/lang/Class;", "(Lokhttp3/HttpUrl;Ljava/lang/String;Lokhttp3/Headers;Lokhttp3/RequestBody;Ljava/util/Map;)V", "()Lokhttp3/RequestBody;", "cacheControl", "Lokhttp3/CacheControl;", "()Lokhttp3/CacheControl;", "()Lokhttp3/Headers;", "isHttps", "", "()Z", "lazyCacheControl", "()Ljava/lang/String;", "getTags$okhttp", "()Ljava/util/Map;", "()Lokhttp3/HttpUrl;", "-deprecated_body", "-deprecated_cacheControl", "header", "name", "-deprecated_headers", "", "-deprecated_method", "newBuilder", "Lokhttp3/Request$Builder;", "tag", "T", "type", "(Ljava/lang/Class;)Ljava/lang/Object;", "toString", "-deprecated_url", "Builder", "okhttp"}, k = 1, mv = {1, 4, 0})
  /* compiled from: Request.kt */
  public final class Request {
      private final RequestBody body;
      private final Headers headers;
      private CacheControl lazyCacheControl;
      private final String method;
      private final Map<Class<?>, Object> tags;
      private final HttpUrl url;
  
      @Metadata(bv = {1, 0, 3}, d1 = {"\u0000V\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0010%\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\b\u0016\u0018\u00002\u00020\u0001B\u0007\b\u0016¢\u0006\u0002\u0010\u0002B\u000f\b\u0010\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u0018\u0010%\u001a\u00020\u00002\u0006\u0010&\u001a\u00020\u00132\u0006\u0010'\u001a\u00020\u0013H\u0016J\b\u0010(\u001a\u00020\u0004H\u0016J\u0010\u0010)\u001a\u00020\u00002\u0006\u0010)\u001a\u00020*H\u0016J\u0014\u0010+\u001a\u00020\u00002\n\b\u0002\u0010\u0006\u001a\u0004\u0018\u00010\u0007H\u0017J\b\u0010,\u001a\u00020\u0000H\u0016J\b\u0010-\u001a\u00020\u0000H\u0016J\u0018\u0010.\u001a\u00020\u00002\u0006\u0010&\u001a\u00020\u00132\u0006\u0010'\u001a\u00020\u0013H\u0016J\u0010\u0010\f\u001a\u00020\u00002\u0006\u0010\f\u001a\u00020/H\u0016J\u001a\u0010\u0012\u001a\u00020\u00002\u0006\u0010\u0012\u001a\u00020\u00132\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007H\u0016J\u0010\u00100\u001a\u00020\u00002\u0006\u0010\u0006\u001a\u00020\u0007H\u0016J\u0010\u00101\u001a\u00020\u00002\u0006\u0010\u0006\u001a\u00020\u0007H\u0016J\u0010\u00102\u001a\u00020\u00002\u0006\u0010\u0006\u001a\u00020\u0007H\u0016J\u0010\u00103\u001a\u00020\u00002\u0006\u0010&\u001a\u00020\u0013H\u0016J-\u00104\u001a\u00020\u0000\"\u0004\b\u0000\u001052\u000e\u00106\u001a\n\u0012\u0006\b\u0000\u0012\u0002H50\u001a2\b\u00104\u001a\u0004\u0018\u0001H5H\u0016¢\u0006\u0002\u00107J\u0012\u00104\u001a\u00020\u00002\b\u00104\u001a\u0004\u0018\u00010\u0001H\u0016J\u0010\u0010\u001f\u001a\u00020\u00002\u0006\u0010\u001f\u001a\u000208H\u0016J\u0010\u0010\u001f\u001a\u00020\u00002\u0006\u0010\u001f\u001a\u00020\u0013H\u0016J\u0010\u0010\u001f\u001a\u00020\u00002\u0006\u0010\u001f\u001a\u00020 H\u0016R\u001c\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\b\u0010\t\"\u0004\b\n\u0010\u000bR\u001a\u0010\f\u001a\u00020\rX\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000e\u0010\u000f\"\u0004\b\u0010\u0010\u0011R\u001a\u0010\u0012\u001a\u00020\u0013X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0015\"\u0004\b\u0016\u0010\u0017R*\u0010\u0018\u001a\u0012\u0012\b\u0012\u0006\u0012\u0002\b\u00030\u001a\u0012\u0004\u0012\u00020\u00010\u0019X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001b\u0010\u001c\"\u0004\b\u001d\u0010\u001eR\u001c\u0010\u001f\u001a\u0004\u0018\u00010 X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b!\u0010\"\"\u0004\b#\u0010$¨\u00069"}, d2 = {"Lokhttp3/Request$Builder;", "", "()V", "request", "Lokhttp3/Request;", "(Lokhttp3/Request;)V", "body", "Lokhttp3/RequestBody;", "getBody$okhttp", "()Lokhttp3/RequestBody;", "setBody$okhttp", "(Lokhttp3/RequestBody;)V", "headers", "Lokhttp3/Headers$Builder;", "getHeaders$okhttp", "()Lokhttp3/Headers$Builder;", "setHeaders$okhttp", "(Lokhttp3/Headers$Builder;)V", "method", "", "getMethod$okhttp", "()Ljava/lang/String;", "setMethod$okhttp", "(Ljava/lang/String;)V", "tags", "", "Ljava/lang/Class;", "getTags$okhttp", "()Ljava/util/Map;", "setTags$okhttp", "(Ljava/util/Map;)V", "url", "Lokhttp3/HttpUrl;", "getUrl$okhttp", "()Lokhttp3/HttpUrl;", "setUrl$okhttp", "(Lokhttp3/HttpUrl;)V", "addHeader", "name", "value", "build", "cacheControl", "Lokhttp3/CacheControl;", "delete", "get", "head", "header", "Lokhttp3/Headers;", "patch", "post", "put", "removeHeader", "tag", "T", "type", "(Ljava/lang/Class;Ljava/lang/Object;)Lokhttp3/Request$Builder;", "Ljava/net/URL;", "okhttp"}, k = 1, mv = {1, 4, 0})
      /* compiled from: Request.kt */
      public static class Builder {
          private RequestBody body;
          private Headers.Builder headers;
          private String method;
          private Map<Class<?>, Object> tags;
          private HttpUrl url;
  
          public Builder() {
              this.tags = new LinkedHashMap();
              this.method = "GET";
              this.headers = new Headers.Builder();
          }
  
          public Builder(Request request) {
              Intrinsics.checkNotNullParameter(request, "request");
              this.tags = new LinkedHashMap();
              this.url = request.url();
              this.method = request.method();
              this.body = request.body();
              this.tags = request.getTags$okhttp().isEmpty() ? new LinkedHashMap<>() : MapsKt.toMutableMap(request.getTags$okhttp());
              this.headers = request.headers().newBuilder();
          }
  
          public static /* synthetic */ Builder delete$default(Builder builder, RequestBody requestBody, int i, Object obj) {
              if (obj == null) {
                  if ((i & 1) != 0) {
                      requestBody = Util.EMPTY_REQUEST;
                  }
                  return builder.delete(requestBody);
              }
              throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: delete");
          }
  
          public Builder addHeader(String name, String value) {
              Intrinsics.checkNotNullParameter(name, "name");
              Intrinsics.checkNotNullParameter(value, "value");
              this.headers.add(name, value);
              return this;
          }
  
          public Request build() {
              HttpUrl httpUrl = this.url;
              if (httpUrl != null) {
                  return new Request(httpUrl, this.method, this.headers.build(), this.body, Util.toImmutableMap(this.tags));
              }
              throw new IllegalStateException("url == null".toString());
          }
  
          public Builder cacheControl(CacheControl cacheControl) {
              Intrinsics.checkNotNullParameter(cacheControl, "cacheControl");
              String cacheControl2 = cacheControl.toString();
              return cacheControl2.length() == 0 ? removeHeader("Cache-Control") : header("Cache-Control", cacheControl2);
          }
  
          public final Builder delete() {
              return delete$default(this, (RequestBody) null, 1, (Object) null);
          }
  
          public Builder delete(RequestBody body2) {
              return method("DELETE", body2);
          }
  
          public Builder get() {
              return method("GET", (RequestBody) null);
          }
  
          public final RequestBody getBody$okhttp() {
              return this.body;
          }
  
          public final Headers.Builder getHeaders$okhttp() {
              return this.headers;
          }
  
          public final String getMethod$okhttp() {
              return this.method;
          }
  
          public final Map<Class<?>, Object> getTags$okhttp() {
              return this.tags;
          }
  
          public final HttpUrl getUrl$okhttp() {
              return this.url;
          }
  
          public Builder head() {
              return method("HEAD", (RequestBody) null);
          }
  
          public Builder header(String name, String value) {
              Intrinsics.checkNotNullParameter(name, "name");
              Intrinsics.checkNotNullParameter(value, "value");
              this.headers.set(name, value);
              return this;
          }
  
          public Builder headers(Headers headers2) {
              Intrinsics.checkNotNullParameter(headers2, "headers");
              this.headers = headers2.newBuilder();
              return this;
          }
  
          public Builder method(String method2, RequestBody body2) {
              Intrinsics.checkNotNullParameter(method2, "method");
              Builder builder = this;
              if (method2.length() > 0) {
                  if (body2 == null) {
                      if (!(true ^ HttpMethod.requiresRequestBody(method2))) {
                          throw new IllegalArgumentException(("method " + method2 + " must have a request body.").toString());
                      }
                  } else if (!HttpMethod.permitsRequestBody(method2)) {
                      throw new IllegalArgumentException(("method " + method2 + " must not have a request body.").toString());
                  }
                  builder.method = method2;
                  builder.body = body2;
                  return this;
              }
              throw new IllegalArgumentException("method.isEmpty() == true".toString());
          }
  
          public Builder patch(RequestBody body2) {
              Intrinsics.checkNotNullParameter(body2, "body");
              return method("PATCH", body2);
          }
  
          public Builder post(RequestBody body2) {
              Intrinsics.checkNotNullParameter(body2, "body");
              return method("POST", body2);
          }
  
          public Builder put(RequestBody body2) {
              Intrinsics.checkNotNullParameter(body2, "body");
              return method("PUT", body2);
          }
  
          public Builder removeHeader(String name) {
              Intrinsics.checkNotNullParameter(name, "name");
              this.headers.removeAll(name);
              return this;
          }
  
          public final void setBody$okhttp(RequestBody requestBody) {
              this.body = requestBody;
          }
  
          public final void setHeaders$okhttp(Headers.Builder builder) {
              Intrinsics.checkNotNullParameter(builder, "<set-?>");
              this.headers = builder;
          }
  
          public final void setMethod$okhttp(String str) {
              Intrinsics.checkNotNullParameter(str, "<set-?>");
              this.method = str;
          }
  
          public final void setTags$okhttp(Map<Class<?>, Object> map) {
              Intrinsics.checkNotNullParameter(map, "<set-?>");
              this.tags = map;
          }
  
          public final void setUrl$okhttp(HttpUrl httpUrl) {
              this.url = httpUrl;
          }
  
          public <T> Builder tag(Class<? super T> type, T tag) {
              Intrinsics.checkNotNullParameter(type, "type");
              Builder builder = this;
              if (tag == null) {
                  builder.tags.remove(type);
              } else {
                  if (builder.tags.isEmpty()) {
                      builder.tags = new LinkedHashMap();
                  }
                  Map<Class<?>, Object> map = builder.tags;
                  Object cast = type.cast(tag);
                  Intrinsics.checkNotNull(cast);
                  map.put(type, cast);
              }
              return this;
          }
  
          public Builder tag(Object tag) {
              return tag(Object.class, tag);
          }
  
          public Builder url(String url2) {
              String str;
              Intrinsics.checkNotNullParameter(url2, "url");
              if (StringsKt.startsWith(url2, "ws:", true)) {
                  StringBuilder append = new StringBuilder().append("http:");
                  String substring = url2.substring(3);
                  Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.String).substring(startIndex)");
                  str = append.append(substring).toString();
              } else if (StringsKt.startsWith(url2, "wss:", true)) {
                  StringBuilder append2 = new StringBuilder().append("https:");
                  String substring2 = url2.substring(4);
                  Intrinsics.checkNotNullExpressionValue(substring2, "(this as java.lang.String).substring(startIndex)");
                  str = append2.append(substring2).toString();
              } else {
                  str = url2;
              }
              return url(HttpUrl.Companion.get(str));
          }
  
          public Builder url(URL url2) {
              Intrinsics.checkNotNullParameter(url2, "url");
              HttpUrl.Companion companion = HttpUrl.Companion;
              String url3 = url2.toString();
              Intrinsics.checkNotNullExpressionValue(url3, "url.toString()");
              return url(companion.get(url3));
          }
  
          public Builder url(HttpUrl url2) {
              Intrinsics.checkNotNullParameter(url2, "url");
              this.url = url2;
              return this;
          }
      }
  
      public Request(HttpUrl url2, String method2, Headers headers2, RequestBody body2, Map<Class<?>, ? extends Object> tags2) {
          Intrinsics.checkNotNullParameter(url2, "url");
          Intrinsics.checkNotNullParameter(method2, "method");
          Intrinsics.checkNotNullParameter(headers2, "headers");
          Intrinsics.checkNotNullParameter(tags2, "tags");
          this.url = url2;
          this.method = method2;
          this.headers = headers2;
          this.body = body2;
          this.tags = tags2;
      }
  
      @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "body", imports = {}))
      /* renamed from: -deprecated_body  reason: not valid java name */
      public final RequestBody m1702deprecated_body() {
          return this.body;
      }
  
      @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "cacheControl", imports = {}))
      /* renamed from: -deprecated_cacheControl  reason: not valid java name */
      public final CacheControl m1703deprecated_cacheControl() {
          return cacheControl();
      }
  
      @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "headers", imports = {}))
      /* renamed from: -deprecated_headers  reason: not valid java name */
      public final Headers m1704deprecated_headers() {
          return this.headers;
      }
  
      @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "method", imports = {}))
      /* renamed from: -deprecated_method  reason: not valid java name */
      public final String m1705deprecated_method() {
          return this.method;
      }
  
      @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "url", imports = {}))
      /* renamed from: -deprecated_url  reason: not valid java name */
      public final HttpUrl m1706deprecated_url() {
          return this.url;
      }
  
      public final RequestBody body() {
          return this.body;
      }
  
      public final CacheControl cacheControl() {
          CacheControl cacheControl = this.lazyCacheControl;
          if (cacheControl != null) {
              return cacheControl;
          }
          CacheControl parse = CacheControl.Companion.parse(this.headers);
          this.lazyCacheControl = parse;
          return parse;
      }
  
      public final Map<Class<?>, Object> getTags$okhttp() {
          return this.tags;
      }
  
      public final String header(String name) {
          Intrinsics.checkNotNullParameter(name, "name");
          return this.headers.get(name);
      }
  
      public final List<String> headers(String name) {
          Intrinsics.checkNotNullParameter(name, "name");
          return this.headers.values(name);
      }
  
      public final Headers headers() {
          return this.headers;
      }
  
      public final boolean isHttps() {
          return this.url.isHttps();
      }
  
      public final String method() {
          return this.method;
      }
  
      public final Builder newBuilder() {
          return new Builder(this);
      }
  
      public final Object tag() {
          return tag(Object.class);
      }
  
      public final <T> T tag(Class<? extends T> type) {
          Intrinsics.checkNotNullParameter(type, "type");
          return type.cast(this.tags.get(type));
      }
  
      public String toString() {
          StringBuilder sb = new StringBuilder();
          StringBuilder sb2 = sb;
          sb2.append("Request{method=");
          sb2.append(this.method);
          sb2.append(", url=");
          sb2.append(this.url);
          if (this.headers.size() != 0) {
              sb2.append(", headers=[");
              int i = 0;
              for (Object next : this.headers) {
                  int i2 = i + 1;
                  if (i < 0) {
                      CollectionsKt.throwIndexOverflow();
                  }
                  Pair pair = (Pair) next;
                  String str = (String) pair.component1();
                  String str2 = (String) pair.component2();
                  if (i > 0) {
                      sb2.append(", ");
                  }
                  sb2.append(str);
                  sb2.append(':');
                  sb2.append(str2);
                  i = i2;
              }
              sb2.append(']');
          }
          if (!this.tags.isEmpty()) {
              sb2.append(", tags=");
              sb2.append(this.tags);
          }
          sb2.append('}');
          String sb3 = sb.toString();
          Intrinsics.checkNotNullExpressionValue(sb3, "StringBuilder().apply(builderAction).toString()");
          return sb3;
      }
  
      public final HttpUrl url() {
          return this.url;
      }
  }
  