code: def bbox_diag_distance(box: ArrayLike) -> float:
      """Calculate the diagonal length of a bounding box (distance between the
      top-left and bottom-right).
  
      Args:
          box (ArrayLike): The bounding box represented in
          [x1, y1, x2, y2, x3, y3, x4, y4] or [x1, y1, x2, y2].
  
      Returns:
          float: The diagonal length of the bounding box.
      """
      box = np.array(box, dtype=np.float32)
      assert box.size == 8 or box.size == 4
  
      if box.size == 8:
          diag = point_distance(box[0:2], box[4:6])
      elif box.size == 4:
          diag = point_distance(box[0:2], box[2:4])
  
      return diag
  
file_path: mmocr/mmocr/utils/bbox_utils.py
imports: from typing import List, Tuple
  import numpy
  from shapely.geometry import LineString, Point
  from mmocr.utils.check_argument import is_type_list
  from mmocr.utils.point_utils import point_distance, points_center
  from mmocr.utils.typing_utils import ArrayLike
label_desc: Use image node_id 11 for calling a global function with example usage: bbox_diag_distance(box) and returns: diag