
    ,hH                        U d dl Z d dlZd dlZd dlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ dedej$                  eej(                  f   dedededefdZ G d d      ZdZdZdZ G d d      Z G d de      Z G d de      Z G d d e      Z ej>                  d!ej@                  e   "      Z!eeed#Z"ejF                  eej@                  e   f   e$d$<   	 d4d%e!d&ejJ                  e   de!fd'Z&d(edejJ                  ej@                  e      fd)Z'd*e	d+ede(fd,Z)d*e	d-ede(fd.Z*d*e	d/ejV                  e   d+ede(fd0Z,dedej$                  eej(                  f   ded/ejV                  e   de	f
d1Z-d*e	d/ejV                  e   d2edej\                  ej^                  eef   ef   fd3Z0y)5    N)gettext   )Argument)BaseCommand)Context)MultiCommand)Option)	Parameter)ParameterSource)split_arg_string)echoclictx_args	prog_namecomplete_varinstructionreturnc                     |j                  d      \  }}}t        |      }|y || |||      }|dk(  rt        |j                                y|dk(  rt        |j	                                yy)a   Perform shell completion for the given CLI program.

    :param cli: Command being called.
    :param ctx_args: Extra arguments to pass to
        ``cli.make_context``.
    :param prog_name: Name of the executable in the shell.
    :param complete_var: Name of the environment variable that holds
        the completion instruction.
    :param instruction: Value of ``complete_var`` with the completion
        instruction and shell, in the form ``instruction_shell``.
    :return: Status code to exit with.
    _r   sourcer   complete)	partitionget_completion_classr   r   r   )	r   r   r   r   r   shellr   comp_clscomps	            X/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/click/shell_completion.pyshell_completer      ss    & (11#6E1k#E*HC9l;DhT[[]j T]]_    c                       e Zd ZdZdZ	 	 ddej                  dedej                  e   dej                  ddf
d	Z	d
edej                  fdZ
y)CompletionItema)  Represents a completion value and metadata about the value. The
    default metadata is ``type`` to indicate special shell handling,
    and ``help`` if a shell supports showing a help string next to the
    value.

    Arbitrary parameters can be passed when creating the object, and
    accessed using ``item.attr``. If an attribute wasn't passed,
    accessing it returns ``None``.

    :param value: The completion suggestion.
    :param type: Tells the shell script to provide special completion
        support for the type. Click uses ``"dir"`` and ``"file"``.
    :param help: String shown next to the value if supported.
    :param kwargs: Arbitrary metadata. The built-in implementations
        don't use this, but custom type completions paired with custom
        shell support could use it.
    valuetypehelp_infoNr#   r$   r%   kwargsr   c                 <    || _         || _        || _        || _        y Nr"   )selfr#   r$   r%   r'   s        r   __init__zCompletionItem.__init__L   s      "
	%)	
r   namec                 8    | j                   j                  |      S r)   )r&   get)r*   r,   s     r   __getattr__zCompletionItem.__getattr__X   s    zz~~d##r   )plainN)__name__
__module____qualname____doc__	__slots__tAnystrOptionalr+   r/    r   r   r!   r!   7   sr    $ 3I
  $	
uu
 
 jjo	

 %%
 

$ $ $r   r!   a  %(complete_func)s() {
    local IFS=$'\n'
    local response

    response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD %(complete_var)s=bash_complete $1)

    for completion in $response; do
        IFS=',' read type value <<< "$completion"

        if [[ $type == 'dir' ]]; then
            COMPREPLY=()
            compopt -o dirnames
        elif [[ $type == 'file' ]]; then
            COMPREPLY=()
            compopt -o default
        elif [[ $type == 'plain' ]]; then
            COMPREPLY+=($value)
        fi
    done

    return 0
}

%(complete_func)s_setup() {
    complete -o nosort -F %(complete_func)s %(prog_name)s
}

%(complete_func)s_setup;
a  #compdef %(prog_name)s

%(complete_func)s() {
    local -a completions
    local -a completions_with_descriptions
    local -a response
    (( ! $+commands[%(prog_name)s] )) && return 1

    response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) %(complete_var)s=zsh_complete %(prog_name)s)}")

    for type key descr in ${response}; do
        if [[ "$type" == "plain" ]]; then
            if [[ "$descr" == "_" ]]; then
                completions+=("$key")
            else
                completions_with_descriptions+=("$key":"$descr")
            fi
        elif [[ "$type" == "dir" ]]; then
            _path_files -/
        elif [[ "$type" == "file" ]]; then
            _path_files -f
        fi
    done

    if [ -n "$completions_with_descriptions" ]; then
        _describe -V unsorted completions_with_descriptions -U
    fi

    if [ -n "$completions" ]; then
        compadd -U -V unsorted -a completions
    fi
}

if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
    # autoload from fpath, call function directly
    %(complete_func)s "$@"
else
    # eval/source/. command, register function for later
    compdef %(complete_func)s %(prog_name)s
fi
af  function %(complete_func)s;
    set -l response (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) %(prog_name)s);

    for completion in $response;
        set -l metadata (string split "," $completion);

        if test $metadata[1] = "dir";
            __fish_complete_directories $metadata[2];
        else if test $metadata[1] = "file";
            __fish_complete_path $metadata[2];
        else if test $metadata[1] = "plain";
            echo $metadata[2];
        end;
    end;
end;

complete --no-files --command %(prog_name)s --arguments "(%(complete_func)s)";
c            
          e Zd ZU dZej
                  e   ed<   	 ej
                  e   ed<   	 dedej                  eej                  f   dededd	f
d
Zedefd       Zdej                  eej                  f   fdZdefdZdej"                  ej$                  e   ef   fdZdej$                  e   dedej$                  e   fdZdedefdZdefdZy	)ShellCompletea  Base class for providing shell completion support. A subclass for
    a given shell will override attributes and methods to implement the
    completion instructions (``source`` and ``complete``).

    :param cli: Command being called.
    :param prog_name: Name of the executable in the shell.
    :param complete_var: Name of the environment variable that holds
        the completion instruction.

    .. versionadded:: 8.0
    r,   source_templater   r   r   r   r   Nc                 <    || _         || _        || _        || _        y r)   )r   r   r   r   )r*   r   r   r   r   s        r   r+   zShellComplete.__init__   s!      "(r   c                     t        j                  dd| j                  j                  dd      t         j                        }d| dS )zQThe name of the shell function defined by the completion
        script.
        z\W* -r   )flags_completion)resubr   replaceASCII)r*   	safe_names     r   	func_namezShellComplete.func_name   s<    
 FF62t~~'='=c3'GrxxX	9+[))r   c                 J    | j                   | j                  | j                  dS )zVars for formatting :attr:`source_template`.

        By default this provides ``complete_func``, ``complete_var``,
        and ``prog_name``.
        )complete_funcr   r   )rI   r   r   r*   s    r   source_varszShellComplete.source_vars   s%     "^^ --
 	
r   c                 <    | j                   | j                         z  S )zProduce the shell script that defines the completion
        function. By default this ``%``-style formats
        :attr:`source_template` with the dict returned by
        :meth:`source_vars`.
        )r=   rM   rL   s    r   r   zShellComplete.source   s     ##d&6&6&888r   c                     t         )zUse the env vars defined by the shell script to return a
        tuple of ``args, incomplete``. This must be implemented by
        subclasses.
        NotImplementedErrorrL   s    r   get_completion_argsz!ShellComplete.get_completion_args   s
    
 "!r   args
incompletec                     t        | j                  | j                  | j                  |      }t	        |||      \  }}|j                  ||      S )aT  Determine the context and last complete command or parameter
        from the complete args. Call that object's ``shell_complete``
        method to get the completions for the incomplete value.

        :param args: List of complete args before the incomplete value.
        :param incomplete: Value being completed. May be empty.
        )_resolve_contextr   r   r   _resolve_incompleter   )r*   rS   rT   ctxobjs        r   get_completionszShellComplete.get_completions  sE     txxM-c4DZ!!#z22r   itemc                     t         )zFormat a completion item into the form recognized by the
        shell script. This must be implemented by subclasses.

        :param item: Completion item to format.
        rP   r*   r[   s     r   format_completionzShellComplete.format_completion  s
     "!r   c                     | j                         \  }}| j                  ||      }|D cg c]  }| j                  |       }}dj                  |      S c c}w )zProduce the completion data to send back to the shell.

        By default this calls :meth:`get_completion_args`, gets the
        completions, then calls :meth:`format_completion` for each
        completion.
        
)rR   rZ   r^   join)r*   rS   rT   completionsr[   outs         r   r   zShellComplete.complete  s[      335j**4<8CDt%%d+DDyy~ Es   A)r1   r2   r3   r4   r6   ClassVarr8   __annotations__r   MutableMappingr7   r+   propertyrI   DictrM   r   TupleListrR   r!   rZ   r^   r   r:   r   r   r<   r<      s,   
 **S/
 ZZ_$
)
) ""3:.
) 	
)
 
) 

) *3 * *

QVVCJ/ 

9 9"QWWQVVC[#-=%> "3FF3K3-03	
	3"n " "
# 
r   r<   c                        e Zd ZdZdZeZed	d       Zde	f fdZ
dej                  ej                  e	   e	f   fdZdede	fdZ xZS )
BashCompletezShell completion for Bash.bashr   c                     dd l } dd l}| j                  d      }|d }nO|j                  |dddg|j                        }t        j                  d|j                  j                               }|;|j                         \  }}|dk  s
|dk(  r|dk  rt        t        d	      d
       y y y t        t        d      d
       y )Nr   rm   z--norcz-czecho "${BASH_VERSION}")stdoutz^(\d+)\.(\d+)\.\d+4zCShell completion is not supported for Bash versions older than 4.4.T)errz@Couldn't detect Bash version, shell completion is not supported.)shutil
subprocesswhichrunPIPErD   searchro   decodegroupsr   r   )rr   rs   bash_exematchoutputmajorminors          r   _check_versionzBashComplete._check_version0  s    <<'E^^8T+CD! $ F II3V]]5I5I5KLE <<>LE5s{eslus{4  0;l TUr   c                 @    | j                          t        | 	         S r)   )r   superr   )r*   	__class__s    r   r   zBashComplete.sourceQ  s    w~r   c                     t        t        j                  d         }t        t        j                  d         }|d| }	 ||   }||fS # t        $ r d}Y ||fS w xY wN
COMP_WORDS
COMP_CWORDr   r@   r   osenvironint
IndexErrorr*   cwordscwordrS   rT   s        r   rR   z BashComplete.get_completion_argsU  o    !"**\":;BJJ|,-a	J Z  	JZ	   A AAr[   c                 8    |j                    d|j                   S )N,)r$   r#   r]   s     r   r^   zBashComplete.format_completiona  s    ))Adjj\**r   )r   N)r1   r2   r3   r4   r,   _SOURCE_BASHr=   staticmethodr   r8   r   r6   ri   rj   rR   r!   r^   __classcell__)r   s   @r   rl   rl   *  sd    $D"O @   
 QWWQVVC[#-=%> 
 +n + +r   rl   c                   l    e Zd ZdZdZeZdej                  ej                  e
   e
f   fdZdede
fdZy)ZshCompletezShell completion for Zsh.zshr   c                     t        t        j                  d         }t        t        j                  d         }|d| }	 ||   }||fS # t        $ r d}Y ||fS w xY wr   r   r   s        r   rR   zZshComplete.get_completion_argsk  r   r   r[   c                 r    |j                    d|j                   d|j                  r|j                   S d S )Nr`   r   )r$   r#   r%   r]   s     r   r^   zZshComplete.format_completionw  s7    ))Btzzl"$))TYY,MNN,MNNr   N)r1   r2   r3   r4   r,   _SOURCE_ZSHr=   r6   ri   rj   r8   rR   r!   r^   r:   r   r   r   r   e  sG    #D!O
 QWWQVVC[#-=%> 
 On O Or   r   c                   l    e Zd ZdZdZeZdej                  ej                  e
   e
f   fdZdede
fdZy)FishCompletezShell completion for Fish.fishr   c                     t        t        j                  d         }t        j                  d   }|dd  }|r|r|d   |k(  r|j                          ||fS )Nr   r   r   )r   r   r   pop)r*   r   rT   rS   s       r   rR   z FishComplete.get_completion_args  sT    !"**\":;ZZ-
abz $48z#9HHJZr   r[   c                     |j                   r(|j                   d|j                   d|j                    S |j                   d|j                   S )Nr   	)r%   r$   r#   r]   s     r   r^   zFishComplete.format_completion  sE    99ii[$**R		{;;))Adjj\**r   N)r1   r2   r3   r4   r,   _SOURCE_FISHr=   r6   ri   rj   r8   rR   r!   r^   r:   r   r   r   r   {  sD    $D"O
 QWWQVVC[#-=%> 
 +n + +r   r   ShellCompleteType)bound)rm   r   r   _available_shellsclsr,   c                 4    || j                   }| t        |<   | S )am  Register a :class:`ShellComplete` subclass under the given name.
    The name will be provided by the completion instruction environment
    variable during completion.

    :param cls: The completion class that will handle completion for the
        shell.
    :param name: Name to register the class under. Defaults to the
        class's ``name`` attribute.
    )r,   r   )r   r,   s     r   add_completion_classr     s"     |xx!dJr   r   c                 ,    t         j                  |       S )zLook up a registered :class:`ShellComplete` subclass by the name
    provided by the completion instruction environment variable. If the
    name isn't registered, returns ``None``.

    :param shell: Name the class is registered under.
    )r   r.   )r   s    r   r   r     s       ''r   rX   paramc                    t        |t              sy|j                  J | j                  j	                  |j                        }|j
                  dk(  xsn | j                  |j                        t        j                  uxsA |j
                  dkD  xr0 t        |t        t        f      xr t        |      |j
                  k  S )zDetermine if the given parameter is an argument that can still
    accept values.

    :param ctx: Invocation context for the command represented by the
        parsed complete args.
    :param param: Argument object being checked.
    Fr   r   )
isinstancer   r,   paramsr.   nargsget_parameter_sourcer   COMMANDLINEtuplelistlen)rX   r   r#   s      r   _is_incomplete_argumentr     s     eX&::!!JJNN5::&Er 	
##EJJ/7R7RR	
 KK!O )55$-0)E
U[[(r   r#   c                 .    |sy|d   }|| j                   v S )z5Check if the value looks like the start of an option.Fr   )_opt_prefixes)rX   r#   cs      r   _start_of_optionr     s"    aA!!!!r   rS   c                     t        |t              sy|j                  s|j                  ryd}t	        t        |            D ](  \  }}|dz   |j                  kD  r nt        | |      s'|}* |duxr ||j                  v S )zDetermine if the given parameter is an option that needs a value.

    :param args: List of complete args before the incomplete value.
    :param param: Option object being checked.
    FNr   )	r   r	   is_flagcount	enumeratereversedr   r   opts)rX   rS   r   last_optionindexargs         r   _is_incomplete_optionr     s     eV$}}K/ 
s19u{{"C%K d"@{ejj'@@r   c                 :   d|d<    | j                   ||j                         fi |}|j                  |j                  z   }|r|j                  }t        |t              r|j                  sI|j                  ||      \  }}}||S |j                  |||d      }|j                  |j                  z   }nd|}|r@|j                  ||      \  }}}||S |j                  |||ddd      }|j                  }|r@|}g |j                  |j                  }n	 |S |r|S )a`  Produce the context hierarchy starting with the command and
    traversing the complete arguments. This only follows the commands,
    it doesn't trigger input prompts or callbacks.

    :param cli: Command being called.
    :param prog_name: Name of the executable in the shell.
    :param args: List of complete args before the incomplete value.
    Tresilient_parsing)parentr   F)r   allow_extra_argsallow_interspersed_argsr   )	make_contextcopyprotected_argsrS   commandr   r   chainresolve_command)	r   r   r   rS   rX   r   r,   cmdsub_ctxs	            r   rV   rV     sF    %)H !
#

9diik
>X
>C(D
++g|,==")"9"9#t"Dc4;J&&tT#QU&V))CHH4&-&=&=c4&HOD#t{"
!..")-05*. / G #<<D   ?//?',,?JI H Jr   rT   c                 r   |dk(  rd}n6d|v r2t        | |      r&|j                  d      \  }}}|j                  |       d|vrt        | |      r| j                  |fS | j                  j	                  |       }|D ]  }t        | ||      s||fc S  |D ]  }t        | |      s||fc S  | j                  |fS )ah  Find the Click object that will handle the completion of the
    incomplete value. Return the object and the incomplete value.

    :param ctx: Invocation context for the command represented by
        the parsed complete args.
    :param args: List of complete args before the incomplete value.
    :param incomplete: Value being completed. May be empty.
    =r@   z--)r   r   appendr   
get_paramsr   r   )rX   rS   rT   r,   r   r   r   s          r   rW   rW   /  s     S
	
	/Z@(2237aD 4,S*={{J&&[[##C(F  % dE2*$$%  %"3.*$$% ;;
""r   r)   )1r   rD   typingr6   r   r   corer   r   r   r   r	   r
   r   parserr   utilsr   rf   r8   r7   r   r   r!   r   r   r   r<   rl   r   r   TypeVarTyper   r   rh   re   r9   r   r   boolr   r   rj   r   rV   ri   UnionrW   r:   r   r   <module>r      sm   	 	          ! $ #	#sAEEz*# # 	#
 # 	#L"$ "$L@*X.g gT8+= 8+vO- O,+= +2 AII19NO  9 166#qvvm445  59	"#**S/(( (

166-3H(I (  t 2"' "# "$ "Aw AaffSk A) APT A06	6sAEEz*6 6 &&+	6
 6r,#	,#s,#14,#WWQWW[)+,c12,#r   