
    
3j                         S SK r S SKJr  S SKJrJrJr  0 r0 rSr	Sr
SrSrS\S	\S
\SS4S jrS\S\4S jrS\S\SS4S jr      SS\\   S	\\   S
\\   S\S\S\S\4S jjrS
\S\S\S\S\4
S jrS\S\4S jrg)    N)wraps)CallableOptionalTypeu   🅛🅣🅧u   (Experimental 🧪)u   (Deprecated 🚫)
Lightricks
node_classnamedescriptionreturnc                     [        U [        5      (       d  [        S5      e[        U[        5      (       d  [        S5      e[        U[        5      (       d  [        S5      eU [        U'   U[
        U'   g)ad  
Register a ComfyUI node class to ComfyUI's global nodes' registry.

Args:
    node_class (Type): The class of the node to be registered.
    name (str): The name of the node.
    description (str): The short user-friendly description of the node.

Raises:
    ValueError: If `node_class` is not a class, or `class_name` or `display_name` is not a string.
`node_class` must be a classz`name` must be a stringz`description` must be a stringN)
isinstancetype
ValueErrorstrNODE_CLASS_MAPPINGSNODE_DISPLAY_NAME_MAPPINGS)r   r	   r
   s      L/home/wildlama/comfy/ComfyUI/custom_nodes/ComfyUI-LTXVideo/nodes_registry.pyregister_noder      se     j$''788dC  233k3''9:: *'2t$    c                 R    [        U S5      =(       a    [        [        U S5      5      $ )z@Check if the node class is a v3 node (has define_schema method).define_schema)hasattrcallablegetattr)r   s    r   _is_v3_noder   (   s'    :/ H
O,5 r   display_namec                 |   ^^ U R                   m[        [        TR                  5      UU4S j5       5       nX l         g)zIWrap the define_schema method to inject the display_name into the schema.c                 R   > TR                  U 5      nUR                  c  TUl        U$ )N)__func__r   )clsschemar   original_define_schemas     r   wrapped_define_schema2_wrap_define_schema.<locals>.wrapped_define_schema3   s.     (005&".Fr   N)r   classmethodr   r    )r   r   r$   r#   s    ` @r   _wrap_define_schemar'   /   s=    '55
!**+ ,   5r   experimental
deprecatedskipc                 V   ^^^^^ S[         S[         4UUUUU4S jjnU c  U$ U" U 5      $ )a  
Decorator for registering a node class with optional name, description, and status flags.

Args:
    node_class (Type): The class of the node to be registered.
    name (str, optional): The name of the class. If not provided, the class name will be used.
    description (str, optional): The description of the class.
      If not provided, an auto-formatted description will be used based on the class name.
    experimental (bool): Flag indicating if the class is experimental. Defaults to False.
    deprecated (bool): Flag indicating if the class is deprecated. Defaults to False.
    skip (bool): Flag indicating if the node registration should be skipped. Defaults to False.
      This is useful for conditionally registering nodes based on certain conditions
      (e.g. unavailability of certain dependencies).

Returns:
    Callable: The decorator function.

Raises:
    ValueError: If `node_class` is not a class.
r   r   c                 "  > T(       a  U $ [        U [        5      (       d  [        S5      eTc*  U R                  mTb  TR	                  S5      (       a  TS S m[        TTTT5      m[        U 5      (       a  [        U T5        [        U TT5        U $ )Nr   Node)	r   r   r   __name__endswith_format_descriptionr   r'   r   )r   r)   r
   r(   r	   r*   s    r   	decoratorcomfy_node.<locals>.decorator\   s    *d++;<< <&&D DMM&$9$9CRy)+t\:V z""
K8j$4r   )r   )r   r	   r
   r(   r)   r*   r2   s    ````` r   
comfy_noder4   ?   s4    :d t  2 $$r   
class_namec                     U c  [        U5      n [        [        5      nU R                  [        5      (       a  XS R	                  5       n U(       a  [
         SU  3n OU(       a  [         SU  3n [         SU  3n U $ )z.Format nodes display name to a standard formatN )camel_case_to_spaceslenNODES_DISPLAY_NAME_PREFIX
startswithlstripDEPRECATED_DISPLAY_NAME_PREFIX EXPERIMENTAL_DISPLAY_NAME_PREFIX)r
   r5   r(   r)   
prefix_lens        r   r1   r1   {   s     *:6 ./J788!+.557 78+G	9:!K=I //q>Kr   textc                     [         R                  " SSU 5      n[         R                  " SSU5      n[         R                  " SSU5      nU$ )Nz(?<=[a-z])(?=[A-Z])r7   z(?<=[A-Z])(?=[A-Z][a-z])z(?<=[A-Z])(?=[A-Z][A-Z][a-z]))resub)r@   spaced_texts     r   r8   r8      sA    &&/d;K&&4c;GK&&93LKr   )NNNFFF)rB   	functoolsr   typingr   r   r   r   r   r:   r>   r=   DEFAULT_CATEGORY_NAMEr   r   boolr   r'   r4   r1   r8    r   r   <module>rJ      s+   	  + +  * #8  !4 $ 3d 3# 3C 3D 34D T 5D 5 5 5" "&!%9%9%
3-9% #9% 	9%
 9% 9% 9%x"%59GK4s s r   