package androidx.compose.runtime.tooling;

import J4.c;
import androidx.compose.runtime.internal.StabilityInferred;
import java.util.List;
import kotlin.jvm.internal.o;

/* JADX INFO: loaded from: classes.dex */
@StabilityInferred(parameters = 0)
public final class DiagnosticComposeException extends RuntimeException {
    public static final int $stable = 8;
    private final ComposeStackTrace trace;

    public DiagnosticComposeException(ComposeStackTrace composeStackTrace) {
        this.trace = composeStackTrace;
        if (composeStackTrace.getHasSourceInformation()) {
            return;
        }
        List<ComposeStackTraceFrame> listFilterInternalFramesByGroupKey = ComposeStackTraceKt.filterInternalFramesByGroupKey(composeStackTrace);
        int size = listFilterInternalFramesByGroupKey.size();
        StackTraceElement[] stackTraceElementArr = new StackTraceElement[size];
        for (int i6 = 0; i6 < size; i6++) {
            stackTraceElementArr[i6] = new StackTraceElement("$$compose", "m$" + listFilterInternalFramesByGroupKey.get(i6).getGroupKey(), "SourceFile", 1);
        }
        setStackTrace(stackTraceElementArr);
    }

    private final <T, R> R[] mapToArray(List<? extends T> list, c cVar) {
        list.size();
        o.m();
        throw null;
    }

    @Override // java.lang.Throwable
    public Throwable fillInStackTrace() {
        setStackTrace(new StackTraceElement[0]);
        return this;
    }

    @Override // java.lang.Throwable
    public String getMessage() {
        if (!this.trace.getHasSourceInformation()) {
            return "Composition stack when thrown:";
        }
        StringBuilder sbT = Z0.o.t("Composition stack when thrown:\n");
        ComposeStackTraceKt.appendStackTrace(sbT, this.trace);
        String string = sbT.toString();
        o.g(string, "toString(...)");
        return string;
    }
}
