///|
fn panel_svg(rect : Rect, slot : Slot, rotation : Int32) -> String {
  let cx = rect.x + rect.width / 2
  let cy = rect.y + rect.height / 2
  let label = slot_number(slot, "BLANK")
  "\{label}"
}

///|
/// A proof contains page labels and a fold line, not source PDF artwork.
pub fn svg_proof(
  plan : Plan,
  paper : Paper,
  sheet_index : Int32,
  back : Bool,
) -> Result[String, PlanError] {
  match verify(plan) {
    Err(e) => return Err(e)
    Ok(_) => ()
  }
  if sheet_index < 0 || sheet_index >= plan.sheets.length() {
    return Err(CorruptPlan("proof sheet index"))
  }
  let sheet = plan.sheets[sheet_index]
  let positions = match layout(paper, sheet.depth) {
    Err(e) => return Err(e)
    Ok(p) => p
  }
  let face = if back { sheet.back } else { sheet.front }
  let side = if back { "BACK" } else { "FRONT" }
  let left = panel_svg(positions.left, face.left, face.rotation)
  let right = panel_svg(positions.right, face.right, face.rotation)
  let center = paper.width / 2
  Ok(
    "QuireLoom gathering \{sheet.signature + 1} depth \{sheet.depth} \{side}\{left}\{right}Gathering \{sheet.signature + 1} / depth \{sheet.depth} / \{side}",
  )
}