package com.discord.utilities.debug; import d0.z.d.m; import kotlin.jvm.internal.DefaultConstructorMarker; /* compiled from: DebugPrintable.kt */ public final class DebugPrintBuilder { public static final Companion Companion = new Companion(null); private static final int maxDepth = 10; private int indentation; private final StringBuilder sb; /* compiled from: DebugPrintable.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } } public DebugPrintBuilder(StringBuilder sb) { m.checkNotNullParameter(sb, "sb"); this.sb = sb; } public final void append(int i) { this.sb.append(i); } public final void append(Object obj) { m.checkNotNullParameter(obj, "s"); this.sb.append(obj); } public final void append(String str) { m.checkNotNullParameter(str, "s"); this.sb.append(str); } public final void appendKeyValue(String str, DebugPrintable debugPrintable) { m.checkNotNullParameter(str, "key"); int i = this.indentation; if (i >= 10) { this.sb.append(" + Reached maxDepth 10"); return; } int i2 = 0; if (i >= 0) { while (true) { this.sb.append(" "); if (i2 == i) { break; } i2++; } } this.sb.append(" + "); this.sb.append(str); if (debugPrintable == null) { this.sb.append(": {null}\n"); return; } this.sb.append(":\n"); this.indentation++; debugPrintable.debugPrint(this); this.indentation--; } public final void appendKeyValue(String str, Object obj) { String str2; m.checkNotNullParameter(str, "key"); int i = this.indentation; if (i >= 0) { int i2 = 0; while (true) { this.sb.append(" "); if (i2 == i) { break; } i2++; } } this.sb.append(" - "); this.sb.append(str); this.sb.append(": "); StringBuilder sb = this.sb; if (obj == null || (str2 = obj.toString()) == null) { str2 = "{null}"; } sb.append(str2); this.sb.append("\n"); } public final void appendLine(String str) { m.checkNotNullParameter(str, "s"); StringBuilder sb = this.sb; sb.append(str); m.checkNotNullExpressionValue(sb, "append(value)"); sb.append('\n'); m.checkNotNullExpressionValue(sb, "append('\\n')"); } public final StringBuilder getSb() { return this.sb; } }