///|
pub fn export_svg(
  grid : GridMap,
  start~ : Position,
  goal~ : Position,
  trace? : SearchTrace,
  cell_size? : Int = 32,
) -> String {
  let path = match trace {
    Some(t) => t.result.path
    None => []
  }
  let last_step = match trace {
    Some(t) => t.steps.last()
    None => None
  }
  let visited = match last_step {
    Some(step) => step.visited
    None => []
  }
  let frontier = match last_step {
    Some(step) => step.frontier
    None => []
  }
  let width = grid.width * cell_size
  let height = grid.height * cell_size
  let out = StringBuilder()
  out.write_string(
    "\n",
  )
  out.write_string("\n")
  for y in 0..\n")
  out.to_string()
}

///|
fn svg_cell_color(
  grid : GridMap,
  position : Position,
  path : Array[Position],
  visited : Array[Position],
  frontier : Array[Position],
) -> String {
  if grid.is_obstacle(position) {
    "#111827"
  } else if path.contains(position) {
    "#facc15"
  } else if frontier.contains(position) {
    "#38bdf8"
  } else if visited.contains(position) {
    "#bfdbfe"
  } else {
    "#ffffff"
  }
}

///|
fn svg_rect(
  out : StringBuilder,
  position : Position,
  cell_size : Int,
  fill : String,
) -> Unit {
  let x = position.x * cell_size
  let y = position.y * cell_size
  out.write_string(
    "\n",
  )
}

///|
fn svg_label(
  out : StringBuilder,
  position : Position,
  cell_size : Int,
  label : String,
) -> Unit {
  let x = position.x * cell_size + cell_size / 2
  let y = position.y * cell_size + cell_size / 2 + 5
  out.write_string(
    "\{label}\n",
  )
}