content: package okhttp3.internal.http2;
  
  import kotlin.Metadata;
  import kotlin.jvm.internal.Intrinsics;
  import kotlin.text.StringsKt;
  import mt.Log1F380D;
  import okhttp3.HttpUrl;
  import okhttp3.internal.Util;
  import okio.ByteString;
  
  @Metadata(bv = {1, 0, 3}, d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u001a\n\u0002\u0010\u000b\n\u0002\b\u0003\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u001f\u001a\u00020\u00052\u0006\u0010 \u001a\u00020\u000b2\u0006\u0010!\u001a\u00020\u000bJ\u0015\u0010\"\u001a\u00020\u00052\u0006\u0010 \u001a\u00020\u000bH\u0000¢\u0006\u0002\b#J.\u0010$\u001a\u00020\u00052\u0006\u0010%\u001a\u00020&2\u0006\u0010'\u001a\u00020\u000b2\u0006\u0010(\u001a\u00020\u000b2\u0006\u0010 \u001a\u00020\u000b2\u0006\u0010!\u001a\u00020\u000bR\u0016\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0004¢\u0006\u0004\n\u0002\u0010\u0006R\u0010\u0010\u0007\u001a\u00020\b8\u0006X\u0004¢\u0006\u0002\n\u0000R\u0018\u0010\t\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00050\u0004X\u0004¢\u0006\u0004\n\u0002\u0010\u0006R\u000e\u0010\n\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u0016\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0004¢\u0006\u0004\n\u0002\u0010\u0006R\u000e\u0010\u0014\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u0015\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u0018\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u0019\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u001a\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u001b\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u001c\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u001d\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000R\u000e\u0010\u001e\u001a\u00020\u000bXT¢\u0006\u0002\n\u0000¨\u0006)"}, d2 = {"Lokhttp3/internal/http2/Http2;", "", "()V", "BINARY", "", "", "[Ljava/lang/String;", "CONNECTION_PREFACE", "Lokio/ByteString;", "FLAGS", "FLAG_ACK", "", "FLAG_COMPRESSED", "FLAG_END_HEADERS", "FLAG_END_PUSH_PROMISE", "FLAG_END_STREAM", "FLAG_NONE", "FLAG_PADDED", "FLAG_PRIORITY", "FRAME_NAMES", "INITIAL_MAX_FRAME_SIZE", "TYPE_CONTINUATION", "TYPE_DATA", "TYPE_GOAWAY", "TYPE_HEADERS", "TYPE_PING", "TYPE_PRIORITY", "TYPE_PUSH_PROMISE", "TYPE_RST_STREAM", "TYPE_SETTINGS", "TYPE_WINDOW_UPDATE", "formatFlags", "type", "flags", "formattedType", "formattedType$okhttp", "frameLog", "inbound", "", "streamId", "length", "okhttp"}, k = 1, mv = {1, 4, 0})
  /* compiled from: 01D3 */
  public final class Http2 {
      private static final String[] BINARY;
      public static final ByteString CONNECTION_PREFACE = ByteString.Companion.encodeUtf8("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n");
      private static final String[] FLAGS = new String[64];
      public static final int FLAG_ACK = 1;
      public static final int FLAG_COMPRESSED = 32;
      public static final int FLAG_END_HEADERS = 4;
      public static final int FLAG_END_PUSH_PROMISE = 4;
      public static final int FLAG_END_STREAM = 1;
      public static final int FLAG_NONE = 0;
      public static final int FLAG_PADDED = 8;
      public static final int FLAG_PRIORITY = 32;
      private static final String[] FRAME_NAMES = {"DATA", "HEADERS", "PRIORITY", "RST_STREAM", "SETTINGS", "PUSH_PROMISE", "PING", "GOAWAY", "WINDOW_UPDATE", "CONTINUATION"};
      public static final int INITIAL_MAX_FRAME_SIZE = 16384;
      public static final Http2 INSTANCE = new Http2();
      public static final int TYPE_CONTINUATION = 9;
      public static final int TYPE_DATA = 0;
      public static final int TYPE_GOAWAY = 7;
      public static final int TYPE_HEADERS = 1;
      public static final int TYPE_PING = 6;
      public static final int TYPE_PRIORITY = 2;
      public static final int TYPE_PUSH_PROMISE = 5;
      public static final int TYPE_RST_STREAM = 3;
      public static final int TYPE_SETTINGS = 4;
      public static final int TYPE_WINDOW_UPDATE = 8;
  
      static {
          String[] strArr = new String[256];
          for (int i = 0; i < 256; i++) {
              String binaryString = Integer.toBinaryString(i);
              Log1F380D.a((Object) binaryString);
              Intrinsics.checkNotNullExpressionValue(binaryString, "Integer.toBinaryString(it)");
              String format = Util.format("%8s", binaryString);
              Log1F380D.a((Object) format);
              String replace$default = StringsKt.replace$default(format, ' ', '0', false, 4, (Object) null);
              Log1F380D.a((Object) replace$default);
              strArr[i] = replace$default;
          }
          BINARY = strArr;
          String[] strArr2 = FLAGS;
          strArr2[0] = HttpUrl.FRAGMENT_ENCODE_SET;
          strArr2[1] = "END_STREAM";
          int[] iArr = {1};
          strArr2[8] = "PADDED";
          for (int i2 : iArr) {
              String[] strArr3 = FLAGS;
              String stringPlus = Intrinsics.stringPlus(strArr3[i2], "|PADDED");
              Log1F380D.a((Object) stringPlus);
              strArr3[i2 | 8] = stringPlus;
          }
          String[] strArr4 = FLAGS;
          strArr4[4] = "END_HEADERS";
          strArr4[32] = "PRIORITY";
          strArr4[36] = "END_HEADERS|PRIORITY";
          for (int i3 : new int[]{4, 32, 36}) {
              for (int i4 : iArr) {
                  String[] strArr5 = FLAGS;
                  strArr5[i4 | i3] = strArr5[i4] + "|" + strArr5[i3];
                  strArr5[i4 | i3 | 8] = strArr5[i4] + "|" + strArr5[i3] + "|PADDED";
              }
          }
          int length = FLAGS.length;
          for (int i5 = 0; i5 < length; i5++) {
              String[] strArr6 = FLAGS;
              if (strArr6[i5] == null) {
                  strArr6[i5] = BINARY[i5];
              }
          }
      }
  
      private Http2() {
      }
  
      public final String formatFlags(int type, int flags) {
          String str;
          if (flags == 0) {
              return HttpUrl.FRAGMENT_ENCODE_SET;
          }
          switch (type) {
              case 2:
              case 3:
              case 7:
              case 8:
                  return BINARY[flags];
              case 4:
              case 6:
                  return flags == 1 ? "ACK" : BINARY[flags];
              default:
                  String[] strArr = FLAGS;
                  if (flags < strArr.length) {
                      str = strArr[flags];
                      Intrinsics.checkNotNull(str);
                  } else {
                      str = BINARY[flags];
                  }
                  String str2 = str;
                  if (type == 5 && (flags & 4) != 0) {
                      String replace$default = StringsKt.replace$default(str2, "HEADERS", "PUSH_PROMISE", false, 4, (Object) null);
                      Log1F380D.a((Object) replace$default);
                      return replace$default;
                  } else if (type != 0 || (flags & 32) == 0) {
                      return str2;
                  } else {
                      String replace$default2 = StringsKt.replace$default(str2, "PRIORITY", "COMPRESSED", false, 4, (Object) null);
                      Log1F380D.a((Object) replace$default2);
                      return replace$default2;
                  }
          }
      }
  
      public final String formattedType$okhttp(int type) {
          String[] strArr = FRAME_NAMES;
          if (type < strArr.length) {
              return strArr[type];
          }
          String format = Util.format("0x%02x", Integer.valueOf(type));
          Log1F380D.a((Object) format);
          return format;
      }
  
      public final String frameLog(boolean inbound, int streamId, int length, int type, int flags) {
          String format = Util.format("%s 0x%08x %5d %-13s %s", inbound ? "<<" : ">>", Integer.valueOf(streamId), Integer.valueOf(length), formattedType$okhttp(type), formatFlags(type, flags));
          Log1F380D.a((Object) format);
          return format;
      }
  }
  