mouseUp (opts) {
        // Get necessary data and initial setups
        const dataStorage = svgCanvas.getDataStorage()
        const svgContent = svgCanvas.getSvgContent()
        const { event: e } = opts
        let mouseTarget = e.target

        // Early exit if not in connector mode
        if (svgCanvas.getMode() !== 'connector') return undefined

        // Check for a foreignObject parent and update mouseTarget if found
        const fo = svgCanvas.getClosest(mouseTarget.parentNode, 'foreignObject')
        if (fo) mouseTarget = fo

        // Check if the target is a child of the main SVG content
        const parents = svgCanvas.getParents(mouseTarget.parentNode)
        const isInSvgContent = parents.includes(svgContent)

        if (mouseTarget === startElem) {
          // Case: Started drawing line via click
          started = true
          return {
            keep: true,
            element: null,
            started
          }
        }

        if (!isInSvgContent) {
          // Case: Invalid target element; remove the line
          curLine?.remove()
          started = false
          return {
            keep: false,
            element: null,
            started
          }
        }

        // Valid target element for the end of the line
        endElem = mouseTarget

        const startId = startElem?.id || ''
        const endId = endElem?.id || ''
        const connStr = `${startId} ${endId}`
        const altStr = `${endId} ${startId}`

        // Prevent duplicate connectors
        const dupe = Array.from(
          document.querySelectorAll('[id^="conn_"]')
        ).filter(
          conn =>
            conn.getAttributeNS(seNs, 'connector') === connStr ||
            conn.getAttributeNS(seNs, 'connector') === altStr
        )

        if (dupe.length) {
          curLine.remove()
          return {
            keep: false,
            element: null,
            started: false
          }
        }

        // Update the end point of the connector
        const bb = svgCanvas.getStrokedBBox([endElem])
        const pt = getBBintersect(
          startX,
          startY,
          bb,
          getOffset('start', curLine)
        )
        setPoint(curLine, 'end', pt.x, pt.y, true)

        // Save metadata to the connector
        dataStorage.put(curLine, 'c_start', startId)
        dataStorage.put(curLine, 'c_end', endId)
        dataStorage.put(curLine, 'end_bb', bb)
        curLine.setAttributeNS(seNs, 'se:connector', connStr)
        curLine.setAttribute('opacity', 1)

        // Finalize the connector
        svgCanvas.addToSelection([curLine])
        svgCanvas.moveToBottomSelectedElement()
        selectorManager.requestSelector(curLine).showGrips(false)

        started = false
        return {
          keep: true,
          element: curLine,
          started
        }
      }
@todo  We have a concern if startX or startY are undefined