remove (item) {
    for (let i = 0; i < this._items.length; i++) {
      const existing = this._items[i]
      // we only remove stream selections when the `isStreamSelection` flag match, cast to boolean using !
      if (!existing.isStreamSelection !== !item.isStreamSelection) continue

      if (existing.isStreamSelection) {
        // If both are stream selections and they match, then we remove the first matching item, then we break the loop
        if (existing.from === item.from && existing.to === item.to) {
          this._items.splice(i, 1)
          // for stream selections, we only remove one item at a time
          // ergo we break the loop after removing the first matching item
          break
        }
      } else {
        if (isLowerIntersecting(item, existing)) {
          existing.to = Math.max(item.from - 1, 0)
        } else if (isUpperIntersecting(item, existing)) {
          existing.from = item.to + 1
        } else if (isInsideExisting(item, existing)) {
          const replacingItems = []
          const existingStart = { ...existing, to: Math.max(item.from - 1, 0) }
          if (existingStart.to - existingStart.from >= 0 && item.from !== 0) replacingItems.push(existingStart)
          const existingEnd = { ...existing, from: item.to + 1 }
          if (existingEnd.to - existingEnd.from >= 0) replacingItems.push(existingEnd)
          this._items.splice(i, 1, ...replacingItems)
          i = i - 1 + replacingItems.length // decrement i to offset splice
        } else if (isCoveringExisting(item, existing)) {
          this._items.splice(i, 1)
          i--
        }
      }
    }
  }
@param {MinimalSelectionItem & {isStreamSelection?: boolean}} item Interval to be removed from the selection