_idt() {
    local i cur prev opts cmd
    COMPREPLY=()
    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
        cur="$2"
    else
        cur="${COMP_WORDS[COMP_CWORD]}"
    fi
    prev="$3"
    cmd=""
    opts=""

    for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
    do
        case "${cmd},${i}" in
            ",$1")
                cmd="idt"
                ;;
            idt,c)
                cmd="idt__convert"
                ;;
            idt,compare)
                cmd="idt__compare"
                ;;
            idt,completions)
                cmd="idt__completions"
                ;;
            idt,convert)
                cmd="idt__convert"
                ;;
            idt,g)
                cmd="idt__gen"
                ;;
            idt,gen)
                cmd="idt__gen"
                ;;
            idt,help)
                cmd="idt__help"
                ;;
            idt,i)
                cmd="idt__inspect"
                ;;
            idt,info)
                cmd="idt__info"
                ;;
            idt,inspect)
                cmd="idt__inspect"
                ;;
            idt,manpage)
                cmd="idt__manpage"
                ;;
            idt,s)
                cmd="idt__sort"
                ;;
            idt,sort)
                cmd="idt__sort"
                ;;
            idt,v)
                cmd="idt__validate"
                ;;
            idt,validate)
                cmd="idt__validate"
                ;;
            idt__help,compare)
                cmd="idt__help__compare"
                ;;
            idt__help,completions)
                cmd="idt__help__completions"
                ;;
            idt__help,convert)
                cmd="idt__help__convert"
                ;;
            idt__help,gen)
                cmd="idt__help__gen"
                ;;
            idt__help,help)
                cmd="idt__help__help"
                ;;
            idt__help,info)
                cmd="idt__help__info"
                ;;
            idt__help,inspect)
                cmd="idt__help__inspect"
                ;;
            idt__help,manpage)
                cmd="idt__help__manpage"
                ;;
            idt__help,sort)
                cmd="idt__help__sort"
                ;;
            idt__help,validate)
                cmd="idt__help__validate"
                ;;
            *)
                ;;
        esac
    done

    case "${cmd}" in
        idt)
            opts="-j -o -p -h -V --json --output --pretty --no-color --help --version gen g inspect i convert c validate v compare sort s info completions manpage help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__compare)
            opts="-t -j -o -p -h --id-type --json --output --pretty --no-color --help <ID1> <ID2>"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --id-type)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                -t)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__completions)
            opts="-j -o -p -h --json --output --pretty --no-color --help bash elvish fish powershell zsh"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__convert)
            opts="-t -f -U -L -j -o -p -h --id-type --format --to --uppercase --lowercase --json --output --pretty --no-color --help [ID]..."
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --id-type)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                -t)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                --format)
                    COMPREPLY=("${cur}")
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o nospace
                    fi
                    return 0
                    ;;
                -f)
                    COMPREPLY=("${cur}")
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o nospace
                    fi
                    return 0
                    ;;
                --to)
                    COMPREPLY=("${cur}")
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o nospace
                    fi
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__gen)
            opts="-n -f -T -j -o -p -h --count --format --no-newline --template --uuid-version --alphabet --length --epoch --preset --field --machine-id --datacenter-id --prefix --json --output --pretty --no-color --help uuid uuidv1 uuidv4 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --count)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -n)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --format)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -f)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --template)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -T)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --uuid-version)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --alphabet)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --length)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --epoch)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --preset)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --field)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --machine-id)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --datacenter-id)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --prefix)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help)
            opts="gen inspect convert validate compare sort info completions manpage help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__compare)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__completions)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__convert)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__gen)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__help)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__info)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__inspect)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__manpage)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__sort)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__help__validate)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__info)
            opts="-j -o -p -h --json --output --pretty --no-color --help uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__inspect)
            opts="-t -q -j -o -p -h --id-type --epoch --preset --quiet --json --output --pretty --no-color --help [ID]..."
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --id-type)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                -t)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                --epoch)
                    COMPREPLY=("${cur}")
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o nospace
                    fi
                    return 0
                    ;;
                --preset)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__manpage)
            opts="-j -o -p -h --json --output --pretty --no-color --help [DIR]"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__sort)
            opts="-t -r -j -o -p -h --id-type --reverse --show-time --epoch --preset --on-unsortable --json --output --pretty --no-color --help [ID]..."
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --id-type)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                -t)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                --epoch)
                    COMPREPLY=("${cur}")
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o nospace
                    fi
                    return 0
                    ;;
                --preset)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --on-unsortable)
                    COMPREPLY=($(compgen -W "skip error end" -- "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        idt__validate)
            opts="-t -q -j -o -p -h --id-type --quiet --strict --json --output --pretty --no-color --help [ID]..."
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --id-type)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                -t)
                    COMPREPLY=($(compgen -W "uuid uuidv1 uuidv3 uuidv4 uuidv5 uuidv6 uuidv7 uuid-nil uuid-max ulid nanoid ksuid snowflake objectid typeid xid cuid cuid2 tsid shortuuid ean13 isbn13 isbn10 isin ean8 upca issn ismn isni gtin14 asin" -- "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                -o)
                    COMPREPLY=($(compgen -W "json yaml toml" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
    esac
}

if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then
    complete -F _idt -o nosort -o bashdefault -o default idt
else
    complete -F _idt -o bashdefault -o default idt
fi
