
    +j                        % S SK JrJr  S SKJr  S SKJr  S SKJr  S SK	J
r
  SSKJrJrJrJrJr  SSKJrJr  SS	KJrJrJrJrJrJrJr  SS
KJr  SSKJr   S SK!J"r"  S SK#J$r$J%r%  S SK&J'r'  S SK(J)r)  S SK*r+ " S S\5      r, " S S\5      r- " S S5      r. " S S5      r/ " S S5      r0\,Rb                  r1\,r2\(       a4  S SK3r4\5\4Rl                  Rn                  Rp                  Rp                     \9S'   \
" \,5      r:\r;\ r</ SQr=g)    )ABCabstractmethod)TYPE_CHECKING)ComfyAPIBase)ProxiedSingleton)create_sync_class   )
ImageInput
AudioInput	MaskInputLatentInput
VideoInput)VideoFromFileVideoFromComponents)
VideoCodecVideoContainerVideoComponentsMESHVOXELSPLATFile3D)
_io_public)
_ui_public)get_executing_context)get_progress_statePreviewImageTuple)Image)argsNc                   r   ^  \ rS rSrSrSrU 4S jr " S S\5      r " S S\5      r	 " S	 S
\5      r
SrU =r$ )ComfyAPI_latest   latestFc                    > [         TU ]  5         U R                  5       U l        U R	                  5       U l        U R                  5       U l        g )N)super__init__NodeReplacementnode_replacement	Execution	executionCachingcaching)self	__class__s    9/home/wildlama/comfy/ComfyUI/comfy_api/latest/__init__.pyr%   ComfyAPI_latest.__init__   s:     $ 4 4 6)||~    c                   :    \ rS rSrS\R
                  SS4S jrSrg)ComfyAPI_latest.NodeReplacement   node_replacereturnNc                 b   #    SSK Jn  UR                  R                  R	                  U5        g7f)z$Register a node replacement mapping.r   )PromptServerN)serverr7   instancenode_replace_managerregister)r,   r4   r7   s      r.   r;   (ComfyAPI_latest.NodeReplacement.register   s"     +!!66??Ms   -/ )__name__
__module____qualname____firstlineno__ioNodeReplacer;   __static_attributes__r=   r0   r.   r&   r2      s    	Nr~~ 	N$ 	Nr0   r&   c                   f    \ rS rSr   SS\S\S\S-  S\R                  \-  S-  S\SS4S	 jjr	S
r
g)ComfyAPI_latest.Execution"   Nvalue	max_valuenode_idpreview_imageignore_size_limitr5   c                 f  #    [        5       nUc  Ub  UR                  nUc  [        S5      eUnUb  [        U[        5      (       at  Un[        UR                  5      S:X  a  US   nUR                  5       R                  5       S-  R                  [        R                  5      n	[        R                  " U	5      n[        U[        R                  5      (       a<  UR                  (       a  UR                  OSn
U(       a  SO[        R                   nXU4n[#        5       R%                  UUUUS9  g7f)a  
Update the progress bar displayed in the ComfyUI interface.

This function allows custom nodes and API calls to report their progress
back to the user interface, providing visual feedback during long operations.

Migration from previous API: comfy.utils.PROGRESS_BAR_HOOK
Nz4node_id must be provided if not in executing context   r      JPEG)rJ   rH   rI   image)r   rJ   
ValueError
isinstancer
   lenshapecpunumpyastypenpuint8r   	fromarrayformatr   preview_sizer   update_progress)r,   rH   rI   rJ   rK   rL   executing_context
to_displaytensorimage_npimage_formatr]   s               r.   set_progress&ComfyAPI_latest.Execution.set_progress#   s      !6 7#4#@+33 !WXX O\J%j*55 (F6<<(A-!' !'

 2 2 4s :BB288LH!&!:Jj%++668B8I8I:#4#4vL+<4$BSBSL".L!IJ 00# 	 1 s   D/D1r=   )NNF)r>   r?   r@   rA   floatstrr   r
   boolrd   rD   r=   r0   r.   r(   rF   "   sc    
 #'=A&+1	1	 1	 4Z	1	
 !;;3d:1	  $1	 1	 1	r0   r(   c                   @    \ rS rSrSrSSKJrJrJr  S	S jr	S	S jr
Srg)
ComfyAPI_latest.CachingV   a  
External cache provider API for sharing cached node outputs
across ComfyUI instances.

Example::

    from comfy_api.latest import Caching

    class MyCacheProvider(Caching.CacheProvider):
        async def on_lookup(self, context):
            ...  # check external storage

        async def on_store(self, context, value):
            ...  # store to external storage

    Caching.register_provider(MyCacheProvider())
r	   )CacheProviderCacheContext
CacheValueNc                 (   #    SSK Jn  U" U5        g7f)zPRegister an external cache provider. Providers are called in registration order.r   )register_cache_providerN)comfy_execution.cache_providerrp   )r,   providerrp   s      r.   register_provider)ComfyAPI_latest.Caching.register_providerj   s     N#H-   c                 (   #    SSK Jn  U" U5        g7f)z2Unregister a previously registered cache provider.r   )unregister_cache_providerN)rq   rw   )r,   rr   rw   s      r.   unregister_provider+ComfyAPI_latest.Caching.unregister_providero   s     P%h/ru   r=   )rr   z%ComfyAPI_latest.Caching.CacheProviderr5   N)r>   r?   r@   rA   __doc___cachingrl   rm   rn   rs   rx   rD   r=   r0   r.   r*   rj   V   s    	" 	FE	.
	0r0   r*   )r+   r)   r'   )r>   r?   r@   rA   VERSIONSTABLEr%   r   r&   r(   r*   rD   __classcell__)r-   s   @r.   r    r       sA    GF&N* N2$ 2h0" 0 0r0   r    c                   V    \ rS rSrSS jr\S\\\R                        4S j5       r
Srg)ComfyExtensiont   r5   Nc                    #    g7f)zu
Called when an extension is loaded.
This should be used to initialize any global resources needed by the extension.
Nr=   r,   s    r.   on_loadComfyExtension.on_loadu           c                    #    g7f)z7
Returns a list of nodes that this extension provides.
Nr=   r   s    r.   get_node_listComfyExtension.get_node_list{   r   r   r=   )r5   N)r>   r?   r@   rA   r   r   listtyperB   	ComfyNoder   rD   r=   r0   r.   r   r   t   s0     T$r||*<%=  r0   r   c                   (    \ rS rSr\r\r\r	\
r\rSrg)Input   r=   N)r>   r?   r@   rA   r
   r   r   Audior   Maskr   Latentr   VideorD   r=   r0   r.   r   r      s    EEDFEr0   r   c                       \ rS rSr\r\rSrg)	InputImpl   r=   N)r>   r?   r@   rA   r   r   rD   r=   r0   r.   r   r      s    !M-r0   r   c                   0    \ rS rSr\r\r\r\r\r\	r	\
r
Srg)Types   r=   N)r>   r?   r@   rA   r   r   r   r   r   r   r   rD   r=   r0   r.   r   r      s%    J#N%ODEEFr0   r   ComfyAPISync)ComfyAPIr   r   r   r   r*   r   rB   IOuiUI)>abcr   r   typingr   comfy_api.internalr   comfy_api.internal.singletonr    comfy_api.internal.async_to_syncr   _inputr
   r   r   r   r   _input_implr   r   _utilr   r   r   r   r   r   r    r   rB   r   r   comfy_execution.utilsr   comfy_execution.progressr   r   PILr   comfy.cli_argsr   rW   rY   r    r   r   r   r   r*   r   +comfy_api.latest.generated.ComfyAPISyncStub	comfy_apir   r"   	generatedComfyAPISyncStub__annotations__r   r   r   __all__r=   r0   r.   <module>r      s    # #   + 9 > N N ; Z Z Z   7 J   `0l `0DS  . .  
!
! 6y''11BBSSTT 1 r0   