```python
def end_grab(cards: list) -> dict:
    """Simulate the end-grab game and return player totals and taken sequence."""
    if not cards:
        return {"first": 0, "second": 0, "taken": []}

    # Work on a copy to avoid mutating the input
    row = list(cards)
    first_total = 0
    second_total = 0
    taken = []
    
    # Track whose turn it is: 0 for first player, 1 for second player
    turn = 0
    
    while row:
        # Get the two ends
        left = row[0]
        right = row[-1]
        
        # Determine which card to take
        # Always take the larger of the two ends
        # If equal, take the left one
        if left >= right:
            card_to_take = left
            row.pop(0)
        else:
            card_to_take = right
            row.pop()
            
        taken.append(card_to_take)
        
        # Add to the current player's total
        if turn == 0:
            first_total += card_to_take
        else:
            second_total += card_to_take
            
        # Switch turns
        turn = 1 - turn
        
    return {
        "first": first_total,
        "second": second_total,
        "taken": taken
    }
```