()
| 1546 | } |
| 1547 | |
| 1548 | _getMaxTarget() { |
| 1549 | if (this._maxTarget !== undefined) return this._maxTarget; |
| 1550 | if (/** @type {Target} */ (this._target).size <= 1) { |
| 1551 | return (this._maxTarget = this._target); |
| 1552 | } |
| 1553 | let maxPriority = -Infinity; |
| 1554 | let minPriority = Infinity; |
| 1555 | for (const { priority } of /** @type {Target} */ (this._target).values()) { |
| 1556 | if (maxPriority < priority) maxPriority = priority; |
| 1557 | if (minPriority > priority) minPriority = priority; |
| 1558 | } |
| 1559 | // This should be very common |
| 1560 | if (maxPriority === minPriority) return (this._maxTarget = this._target); |
| 1561 | |
| 1562 | // This is an edge case |
| 1563 | /** @type {Target} */ |
| 1564 | const map = new Map(); |
| 1565 | for (const [key, value] of /** @type {Target} */ (this._target)) { |
| 1566 | if (maxPriority === value.priority) { |
| 1567 | map.set(key, value); |
| 1568 | } |
| 1569 | } |
| 1570 | this._maxTarget = map; |
| 1571 | return map; |
| 1572 | } |
| 1573 | |
| 1574 | /** |
| 1575 | * Returns the target, undefined when there is no target, false when no target is valid. |
no test coverage detected