///|
/// Render a self-contained offline playground for importing, validating,
/// analyzing, replaying, and exporting schema-v1 trace documents.
pub fn render_trace_playground() -> String raise TraceError {
  let example = insertion_sort_trace([5, 2, 4, 1, 3])
  let safe_example = example.encode_json().replace_all(old="<", new="\\u003c")
  let out = StringBuilder()
  out.write_string(
    (
      #|
      #|
      #|
      #|FrontierLab Semantic Time-Travel Debugger
      #|
#|← FrontierLab demos

Semantic Time-Travel Debugger

Debug instrumented algorithms and AI-generated traces with semantic breakpoints, frame diffs, contracts, and first-divergence analysis. Everything stays in this browser.

#|
Drop a JSON file here or choose one

#|

No trace loaded

#|

Frame diff

Changes from the previous frame.

Semantic breakpoints

Trace contract

#|

First divergence

Paste an expected/reference trace and compare it with the loaded actual trace.

Quality diagnostics

    Timeline

    #|
    ), ) out.to_string() }