# Path: src/click/_compat.py
# def term_len(x: str) -> int:
#     return len(strip_ansi(x))
# 
# Path: src/click/parser.py
# def split_opt(opt: str) -> t.Tuple[str, str]:
#     first = opt[:1]
#     if first.isalnum():
#         return "", opt
#     if opt[1:2] == first:
#         return opt[:2], opt[2:]
#     return first, opt[1:]


import typing as t
        import shutil
from contextlib import contextmanager
from gettext import gettext as _
from ._compat import term_len
from .parser import split_opt
    from ._textwrap import TextWrapper


# Can force a width.  This is used by the test system
FORCED_WIDTH: t.Optional[int] = None


def measure_table(rows: t.Iterable[t.Tuple[str, str]]) -> t.Tuple[int, ...]:
    widths: t.Dict[int, int] = {}

    for row in rows:
        for idx, col in enumerate(row):

# Path: src/click/_compat.py
# def term_len(x: str) -> int:
#     return len(strip_ansi(x))
# 
# Path: src/click/parser.py
# def split_opt(opt: str) -> t.Tuple[str, str]:
#     first = opt[:1]
#     if first.isalnum():
#         return "", opt
#     if opt[1:2] == first:
#         return opt[:2], opt[2:]
#     return first, opt[1:]


# Path: src/click/formatting.py
import typing as t
        import shutil
from contextlib import contextmanager
from gettext import gettext as _
from ._compat import term_len
from .parser import split_opt
    from ._textwrap import TextWrapper



# Can force a width.  This is used by the test system
FORCED_WIDTH: t.Optional[int] = None


def measure_table(rows: t.Iterable[t.Tuple[str, str]]) -> t.Tuple[int, ...]:
    widths: t.Dict[int, int] = {}

    for row in rows:
        for idx, col in enumerate(row):

            widths[idx] = max(widths.get(idx, 0), term_len(col))