+
    Q(i[?                     <   R t ^ RIt^ RIt^ RIt^ RIt^ RIHtHtHtH	t	 ^ RI
Ht ^ RIHt ^ RIHtHtHtHt ^ RIHtHt ]! R4      t]'       d   ^ RIHt ^ R	IHt ^ R
IHt M^ RIHt ]P8                  ! ]RR7      t^ RIHt  ! R R]4      t  ! R R] R7      t! ! R R]!4      t"R R lt#R R lt$R R lt%R R lt&R R lt'R  R! lt(R" R# lt)R$ R% lt*R& R' lt+R( R) lt,R* R+ lt-R,R-/R. R/ llt.R0 R1 lt/R2 t0] ! R3 R44      4       t1R;R5 R6 llt2R7 R8 lt3R9 R: lt4R# )<z^To prevent circular dependencies, this module should never import anything else from Cyclopts.N)CallableIterableIteratorSequence)suppress)
itemgetter)TYPE_CHECKINGAnyLiteralTypeVar)fieldfrozenT)JSONDecodeError)r   Console)defineT)unsafe_hash)stdlib_module_namesc                   D   a  ] tR t^t o V 3R lR ltV 3R lR ltRtV tR# )SentinelMetac                    < V ^8  d   QhRS[ /#    returnstr)format__classdict__s   "T/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/cyclopts/utils.py__annotate__SentinelMeta.__annotate__   s     # # #    c                "    R V P                    R2# )<>)__name__clss   &r   __repr__SentinelMeta.__repr__   s    3<<.""r"   c                .   < V ^8  d   QhRS[ R,          /# )r   r   F)r
   )r   r   s   "r   r    r!   "   s       r"   c                    R # )F r'   s   &r   __bool__SentinelMeta.__bool__"   s    r"   r-   N)r&   
__module____qualname____firstlineno__r)   r.   __static_attributes____classdictcell__r   s   @r   r   r      s     # # r"   r   c                   &   a  ] tR t^&t o R tRtV tR# )Sentinelc                    \        R 4      h)zGSentinel objects are not intended to be instantiated. Subclass instead.)
ValueErrorr'   s   &r   __new__Sentinel.__new__'   s    bccr"   r-   N)r&   r0   r1   r2   r:   r3   r4   r5   s   @r   r7   r7   &   s     d dr"   r7   )	metaclassc                       ] tR t^+tRtRtR# )UNSETzTSpecial sentinel value indicating that no data was provided. **Do not instantiate**.r-   N)r&   r0   r1   r2   __doc__r3   r-   r"   r   r>   r>   +   s    ^r"   r>   c                    V ^8  d   QhR\         R\        \        \        ,          .\        \        ,          3,          /# )r   targetr   )r   r   typer   )r   s   "r   r    r    /   s.       $q'DG); < r"   c                   a  R V 3R llpV# )zJClass decorator that records init argument names as a tuple to ``target``.c                \    V ^8  d   QhR\         \        ,          R\         \        ,          /# )r   r(   r   )rB   r   )r   s   "r   r    !record_init.<locals>.__annotate__2   s"      tAw 47 r"   c                   <aa V P                   o\        P                  ! S4      p\        ;QJ d    . R  VP                   4       F  NK  	  5M! R  VP                   4       4      o\
        P                  ! S4      VVV3R l4       pW n         V # )c              3   6   "   T F  qR 8w  g   K  Vx  K  	  R# 5i)selfNr-   ).0names   & r   	<genexpr>1record_init.<locals>.decorator.<locals>.<genexpr>5   s     ]-JTV\nDD-Js   
c                   < S! V .VO5/ VB  \         P                  T S\        ;QJ d)    . V3R  l\        \	        V4      4       4       F  NK  	  5M"! V3R  l\        \	        V4      4       4       4      \        V4      ,           4       R# )c              3   6   <"   T F  pSV,          x  K  	  R # 5iNr-   )rI   iparam_namess   & r   rK   Crecord_init.<locals>.decorator.<locals>.new_init.<locals>.<genexpr>;   s     2\K[a;q>>K[s   N)object__setattr__tuplerangelen)rH   argskwargsoriginal_initrQ   rA   s   &*,r   new_init0record_init.<locals>.decorator.<locals>.new_init7   sd    $000tVUU2\5QTUYQZK[2\UU2\5QTUYQZK[2\-\_dek_l-lmr"   )__init__inspect	signaturerU   
parameters	functoolswraps)r(   function_signaturer[   rZ   rQ   rA   s   &  @@r   	decoratorrecord_init.<locals>.decorator2   sr    $..}=e]-?-J-J]ee]-?-J-J]]		'	n 
(	n
  
r"   r-   )rA   rd   s   f r   record_initrf   /   s      r"   c                $    V ^8  d   QhR\         /# r   bool)r   s   "r   r    r    C   s     B B Br"   c                     \        V \        \        ,          \        ,          \        ,          4      '       d   R # \        V \
        4      '       * ;'       d    \        V \        4      # )T)
isinstancelistrU   setdictr   r   objs   &r   is_iterablerq   C   s?    #te|c)D011#s##AA
3(AAr"   c                $    V ^8  d   QhR\         /# r   rh   )r   s   "r   r    r    I   s       r"   c                z     \         P                  ! V 4      ;'       d    \        W4      #   \         d     R# i ; i)a7  Safely check if a type is both a class and a subclass of target_class.

Parameters
----------
hint : Any
    The type to check.
target_class : type
    The target class to check subclass relationship against.

Returns
-------
bool
    True if hint is a class and is a subclass of target_class, False otherwise.
F)r^   isclass
issubclass	TypeError)hinttarget_classs   &&r   is_class_and_subclassry   I   s5    t$GGD)GG s   + + ::c                    V ^8  d   QhRR\         ,          \        \         ,          ,          R\        \         R3,          /# r   valueNr   .r	   r   rU   )r   s   "r   r    r    _   s/      dSj8C=8 U38_ r"   c                L    V f   R# \        V 4      '       d   \        V 4      # V 3# )a  Convert a single element or an iterable of elements into a tuple.

Intended to be used in an ``attrs.Field``. If :obj:`None` is provided, returns an empty tuple.
If a single element is provided, returns a tuple containing just that element.
If an iterable is provided, converts it into a tuple.

Parameters
----------
value: Any | Iterable[Any] | None
    An element, an iterable of elements, or None.

Returns
-------
tuple[Any, ...]: A tuple containing the elements.
r-   )rq   rU   r|   s   &r   to_tuple_converterr   _   s*      }		U		U|xr"   c                    V ^8  d   QhRR\         ,          \        \         ,          ,          R\        \         ,          /# )r   r|   Nr   )r	   r   rl   )r   s   "r   r    r    w   s+     + +TCZ(3-7 +DI +r"   c                 *    \        \        V 4      4      # rO   )rl   r   r   s   &r   to_list_converterr   w   s    "5)**r"   c                    V ^8  d   QhRR\         ,          \        \         ,          ,          R\        \         R3,          R,          /# r{   r}   )r   s   "r   r    r    {   s6     % %tczHSM'A %eCQTHoX\F\ %r"   c                8    V f   R# V '       g   R# \        V 4      # )zkConvert a string or Iterable or None into an Iterable or None.

Intended to be used in an ``attrs.Field``.
Nr-   )r   r   s   &r   optional_to_tuple_converterr   {   s    
 }	e$$r"   c                0    V ^8  d   QhR\         R\         /# )r   r|   r   r	   )r   s   "r   r    r       s      c c r"   c                h    V f   \         # \        P                  ! V 4      '       d   \        V 4      # V # )a  Convert sort_key value, consuming generators with :func:`next`.

Parameters
----------
value : Any
    The sort_key value to convert. Can be None, a generator, or any other value.

Returns
-------
Any
    UNSET if value is None, ``next(value)`` if generator, otherwise value unchanged.
)r>   r^   isgeneratornextr   s   &r   sort_key_converterr      s.     }			U	#	#E{r"   c                p    V ^8  d   QhRR\         R,          ,          \        ,          R\        R,          /# )r   input_valueNr   )defaultplain)r
   r	   )r   s   "r   r    r       s0     " " 233c9"4Z"r"   c                    V f   R# \        V \        4      '       d9   V R8X  d   ^ RIHp V! 4       # V R8X  d   ^ RIHp V! 4       # \        RV : R24      hV # )ax  Convert string literals to help formatter instances.

Parameters
----------
input_value : None | Literal["default", "plain"] | Any
    The input value to convert. Can be None, "default", "plain", or a formatter instance.

Returns
-------
Any | None
    None, or a HelpFormatter instance.

Notes
-----
Lazily imports formatters to avoid importing Rich during normal execution.
Nr   )DefaultFormatterr   )PlainFormatterzUnknown formatter: z. Must be 'default' or 'plain')rk   r   cyclopts.help.formattersr   r   r9   )r   r   r   s   &  r   help_formatter_converterr      s`    & 	K	%	%)#A#%%G#?!##2;/A_`aa r"   c                0    V ^8  d   QhR\         R\         /# r   sr   r   )r   s   "r   r    r       s        r"   c                     \         P                  ! R R V 4      p\         P                  ! RR V4      p\         P                  ! RR V4      pVP                  4       # )z([A-Z]+)([A-Z][a-z])c                 L    V P                  ^4       RV P                  ^4       2#    _groupms   &r   <lambda>"_pascal_to_snake.<locals>.<lambda>   s    Aaggaj\6Rr"   z([a-z])([A-Z])c                 L    V P                  ^4       RV P                  ^4       2# r   r   r   s   &r   r   r          1771:,a
|0Lr"   z([0-9])([A-Z])c                 L    V P                  ^4       RV P                  ^4       2# r   r   r   s   &r   r   r      r   r"   )resublower)r   snakes   & r   _pascal_to_snaker      sM     FF*,RTUVEFF$&LeTEFF$&LeTE;;=r"   c                0    V ^8  d   QhR\         R\         /# r   r   )r   s   "r   r    r       s     D Dc Dc Dr"   c                r    \        V 4      P                  4       P                  RR4      P                  R4      # )a  Converts a python identifier into a CLI token.

Performs the following operations (in order):

1. Convert PascalCase to snake_case.
2. Convert the string to all lowercase.
3. Replace ``_`` with ``-``.
4. Strip any leading/trailing ``-`` (also stripping ``_``, due to point 3).

Intended to be used with :attr:`App.name_transform` and :attr:`Parameter.name_transform`.

Parameters
----------
s: str
    Input python identifier string.

Returns
-------
str
    Transformed name.
r   -)r   r   replacestrip)r   s   &r   default_name_transformr      s0    , A$$&..sC8>>sCCr"   c          	          V ^8  d   QhR\         \        ,          R\        R\        \        \        R3,          ,          /# )r   iterablenr   .)r   r	   intr   rU   )r   s   "r   r    r       s2     ) )hsm ) )sCx0I )r"   c                    \        V 4      V,          '       d   \        V : RV R24      h\        V 4      .V,          p\        VRR/ # )a  Collect data into non-overlapping fixed-length chunks or blocks.

https://docs.python.org/3/library/itertools.html#itertools-recipes

Parameters
----------
iterable: Sequence[Any]
    Some iterable sequence to group.
n: int
    Number of elements to put in each group.
z is not divisible by .strictF)rW   r9   iterzip)r   r   	iteratorss   && r   grouperr      sM     8}qH<'<QCqABBh 1$I	(%((r"   allow_numbersFc                0    V ^8  d   QhR\         R\        /# )r   tokenr   )r   ri   )r   s   "r   r    r       s     ! !# !$ !r"   c                   V'       gO   \        \        4      ;_uu_ 4        \        V 4       V P                  4       R8X  d    RRR4       R#  RRR4       R# V P	                  R4      #   + '       g   i     L!; i)a   Checks if a token looks like an option.

Namely, negative numbers are not options, but a token like ``--foo`` is.

Parameters
----------
token: str
    String to interpret.
allow_numbers: bool
    If :obj:`True`, then negative numbers (e.g. ``"-2"``) will return :obj:`True`.
    Otherwise, numbers will be interpreted as non-option-like (:obj:`False`).
    Note: ``-j`` **is option-like**, even though it can represent an imaginary number.

Returns
-------
bool
    Whether or not the ``token`` is option-like.
z-jNTFr   )r   r9   complexr   
startswith)r   r   s   &$r   is_option_liker      s]    & j!!EN{{}$  "!  "! C   "!s   "A(A((A8	c                0    V ^8  d   QhR\         R\        /# )r   rp   r   )r	   ri   )r   s   "r   r    r      s     O OC OD Or"   c                 V    \        V R R4      P                  R4      ^ ,          \        9   # )r0    r   )getattrsplitr   ro   s   &r   
is_builtinr     s'    3b)//4Q7;NNNr"   c                   \        V \        \        4      4      '       d   V # \        V 4      '       d	   V ! V/ VB # \	        V 4      '       d   . pV  F  p\        V\        \        4      4      '       d   VP                  V4       K5  \        V4      '       d   VP                  V! V/ VB 4       K_  \	        V4      '       d!   VP                  \        V.VO5/ VB 4       K  VP                  V4       K  	  \        V4      # V # )zRecursively resolves callable elements in a tuple.

Returns an object that "looks like" the input, but with all callable's invoked
and replaced with their return values. Positional and keyword elements will be
passed along to each invocation.
)rk   rB   r7   callablerq   appendresolve_callablesrU   )trX   rY   resolvedelements   &*,  r   r   r     s     !T(^$${{$!&!!	QG'4>22('"" 8 89W%% 1' KD KF KL(  Xr"   c                   d   a  ] tR tRt o Rt ]! ]R7      t  ]V 3R lR l4       t	V 3R lt
RtV tR# )	
SortHelperi8  zLSort a list of objects by an external key and retrieve the objects in-order.)	converterc                B   < V ^8  d   QhRS[ R,          RS[R,          /# )r   entriesr   r   )r   rl   )r   r   s   "r   r    SortHelper.__annotate__J  s%     ,( ,(h|, ,(l1C ,(r"   c                   ^ RI HpHpHp . p. p. p. p. p. p	V  EFC  p
V
P                  VJ d   VP                  RV
34       K)  V
P                  VJ d   VP                  RV
34       KN  V
P                  VJ d   VP                  RV
34       Ks  V
P                  \        R39   d    V	P                  V
P                  V
34       K  \        V
P                  4      '       dW   V
P                  ^ ,          \        R39   d9   VP                  V
P                  R,          V
P                  ,           V
34       EK  VP                  V
P                  V
P                  3V
34       EKF  	  VP                  \        ^ 4      R7       VP                  \        ^ 4      R7       V	P                  \        ^ 4      R7       VV,           V,           V,           V,           V	,           pV Uu. uF  q^,          NK  	  up# u upi )z(Sorts a sequence of :class:`SortHelper`.)#DEFAULT_ARGUMENTS_GROUP_SORT_MARKER"DEFAULT_COMMANDS_GROUP_SORT_MARKER$DEFAULT_PARAMETERS_GROUP_SORT_MARKERN:r   NN)key)cyclopts.groupr   r   r   r   r   r>   fallback_keyrq   sortr   )r   r   r   r   default_commands_groupdefault_arguments_groupdefault_parameters_groupuser_sort_keyordered_no_user_sort_keyno_user_sort_keyentrycombinedxs   &            r   r   SortHelper.sortI  s   	
 	
 "$"$#% #% Eyy>>&--tUm<AA'..e}=BB(//u>udm+ ''););U(CDUYY''EIIaLUDM,I )//2ASAS1SUZ0[\$$uyy%2D2D&Eu%MN   	z!}- %%*Q-%8*Q-0 #%&&'  '	'
  	 ''h!h'''s   G/c                >   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   # )r   r   r   r|   r   )r   r   s   "r   r    r   8  s*      
H	  ;  J r"   r-   N)r&   r0   r1   r2   r?   r   r   r   staticmethodr   __annotate_func__r3   r4   r5   s   @r   r   r   8  s>     V
 (:;L K,( ,(%  r"   r   c                4    V ^8  d   QhRRR\         R\        /# )r   decode_errorr   contextr   )r   r   )r   s   "r   r    r    y  s#     " "0A "C "Y\ "r"   c           
        V P                   P                  4       pW P                  ^,
          ,          pV P                  ^,
          pWA,
          pV^ 8:  d   ^ pRpTpM
RpWE,
          pWA,           pV\	        V4      8  d   \	        V4      ^,           pRp	MRp	W5V p
R\	        V4      V,           ,          R,           pRV V
 V	 RV R\        V 4       2pV# )	zNot intended to be a super robust implementation, but robust enough to be helpful.

Parameters
----------
context: int
    Number of surrounding-character context
r   z... z ... ^zJSONDecodeError:
    z
    
)doc
splitlineslinenocolnorW   r   )r   r   lineslineerror_indexstartprefix_ellipsissegment_error_indexendsuffix_ellipsissegmentcarat_pointerresponses   &&           r   json_decode_error_verbosifierr  y  s     '')E$$q()D$$q(K!Ez) )1

C
c$i$i!m oG3/2EEFLM ! 1'?:K6R_Q``bcfgsctbuv  Or"   c                     V ^8  d   QhRRRR/# )r   consoler   r   r-   )r   s   "r   r    r      s     % %y %Y %r"   c           
     F   ^ RI Hp V P                  ;'       g    RpT! R/ RRbRVbR\        V RR4      bR	V P                  ;'       g    RbR
V P
                  ;'       g    RbRV P                  bRV P                  bR\        V RR4      bRV P                  bR\        V RR4      bR\        V RR4      bR\        V RR4      bR\        V RR4      bRV P                  bRV P                  bRV P                  bR\        V RR4      bR\        V RR4      bR\        V RR4      b # )a  Create an error console (stderr=True) that inherits settings from a source console.

Parameters
----------
console : Console
    Source Rich Console to copy settings from.

Returns
-------
Console
    New Rich Console with stderr=True and inherited settings.
r   autostderrTcolor_systemforce_terminal_force_terminalNforce_jupyterforce_interactive	soft_wrapwidthheight_heighttab_sizemarkup_markupemoji_emojiemoji_variant_emoji_variant	highlight
_highlightno_colorlegacy_windowssafe_box_environget_datetimeget_timer-   )rich.consoler   r  r   
is_jupyteris_interactiver  _widthr  r  r  r  )r  r   r  s   &  r   !create_error_console_from_consoler$    st    %''116L ! w(94@ ((00D	
 "0088D ## nn w	40 !! w	40 gx. g'7> '<6 !! --  !!!" *d3#$ Wnd;%& *d3' r"   c                $    V ^8  d   QhR\         /# )r   module_pathr   )r   s   "r   r    r      s     9t 9tC 9tr"   c                   ^ RI Hp RV 9   d   V P                  R^4      w  r#MT Rr2 \        P                  ! V4      pT'       dQ   \        YC4      '       g   \        RT RT R24      h\        YC4      p\        Ya4      '       g   \        RT R	24      hT# R F$  p\        YGR4      p\        Y4      '       g   K"  Tu # 	  \        T4       F<  pTP                  R
4      '       d   K  \        YG4      p\        Y4      '       g   K:  Tu # 	  \        RT RT R24      h  \
         d   p\        RT RT 24      ThRp?ii ; i)a)  Import a Cyclopts App from a module path.

Parameters
----------
module_path : str
    Module path in format "module.name" or "module.name:app_name".
    If ":app_name" is omitted, auto-discovers by searching for common
    names (app, cli, main) or any public App instance.

Returns
-------
App
    The imported Cyclopts App instance.

Raises
------
ImportError
    If the module cannot be imported.
AttributeError
    If the specified app name doesn't exist or no App is found.
TypeError
    If the specified attribute is not a Cyclopts App instance.
)App:NzCannot import module 'z': zModule 'z' has no attribute ''z ' is not a Cyclopts App instancer   zNo Cyclopts App found in 'z'. Specify explicitly: 'z
:app_name')appclimain)cycloptsr(  rsplit	importlibimport_moduleImportErrorhasattrAttributeErrorr   rk   rv   dirr   )	r&  r(  module_nameapp_namemoduleer+  rJ   rp   s	   &        r   
import_appr:    sO   0 
k + 2 23 :X +TXO((5 v(( 8K=8LXJVW!XYYf'###az)IJKK
 'fD)cJ ' Fs##&'C###
	  5k]BZ[fZggqr
ss1  O2;-s1#FGQNOs   D D>'D99D>)   )5r?   ra   r0  r^   r   collections.abcr   r   r   r   
contextlibr   operatorr   typingr   r	   r
   r   attrsr   r   r   jsonr   r   r   r   partialsysr   rB   r   r7   r>   rf   rq   ry   r   r   r   r   r   r   r   r   r   r   r   r   r  r$  r:  r-   r"   r   <module>rD     s    d    	 B B   7 7 CL $$v48F #4 d d
_H _(B,0+%*"JD2)$! !>O8 =( =( =(@"J%P9tr"   