code: function handleDocumentMouseup(e) {
    let rects;
    if (_type !== 'area' && (rects = getSelectionRects())) {
      let svg = findSVGAtPoint(rects[0].left, rects[0].top);
      saveRect(_type, [...rects].map((r) => {
        return {
          top: r.top,
          left: r.left,
          width: r.width,
          height: r.height
        };
      }));
    } else if (_type === 'area' && overlay) {
      let svg = overlay.parentNode.querySelector('svg.annotationLayer');
      let rect = svg.getBoundingClientRect();
      saveRect(_type, [{
        top: parseInt(overlay.style.top, 10) + rect.top,
        left: parseInt(overlay.style.left, 10) + rect.left,
        width: parseInt(overlay.style.width, 10),
        height: parseInt(overlay.style.height, 10)
      }]);
  
      overlay.parentNode.removeChild(overlay);
      overlay = null;
  
      document.removeEventListener('mousemove', handleDocumentMousemove);
      enableUserSelect();
    }
  }
docs: Handle document.mouseup event
  
  @param {Event} e The DOM event to handle