+
    ‚°ñj  ã                  óž   € ^ RI Ht ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RI	t	 ! R R4      t
 ! R R]4      t ! R	 R
]4      t ! R R4      tR# )é    )Úannotations)Ú	TypedDictN)Úwebc                  ó   € ] tR t^tRtRtRtR# )ÚSourceÚcustom_nodeÚ	templates© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r	   Ú__static_attributes__r
   ó    Ú8C:\Ai_Coding\apps\studio\ComfyUI\app\subgraph_manager.pyr   r      s   † Ø€KØ„Ir   r   c                  óR   € ] tR t^t$ R]R&    R]R&    R]R&    R]R&    R]R&   RtR	# )
ÚSubgraphEntryÚstrÚsourceÚpathÚnameÚCustomNodeSubgraphEntryInfoÚinfoÚdatar
   N©r   r   r   r   Ú__annotations__r   r
   r   r   r   r      s8   ‡ ØƒKðð ƒIðð ƒIðð &Ó%ðð ‡Ir   r   c                  ó"   € ] tR t^#t$ R]R&   RtR# )r   r   Ú	node_packr
   Nr   r
   r   r   r   r   #   s
   ‡ ØƒNÛr   r   c                  ó„   € ] tR t^'tR tR R ltR R ltRR R lltRR R	 lltRR
 lt	RR lt
RR ltR R ltR tRtR# )ÚSubgraphManagerc                	ó"   € R V n         R V n        R # ©N)Úcached_custom_node_subgraphsÚcached_blueprint_subgraphs)Úselfs   &r   Ú__init__ÚSubgraphManager.__init__(   s   € ØHLˆÔ)ØFJˆÖ'r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )é   Úfiler   r   r   Úreturnztuple[str, SubgraphEntry]r
   )Úformats   "r   Ú__annotate__ÚSubgraphManager.__annotate__,   s)   € ÷ 	ñ 	 #ð 	¨sð 	¸sð 	ÐG`ñ 	r   c           	     ó  € \         P                  ! V V 2P                  4       4      P                  4       pRVR\        P
                  P                  \        P
                  P                  V4      4      ^ ,          RVRRV//pWE3# )zTCreate a subgraph entry from a file path. Expects normalized path (forward slashes).r   r   r   r   r   )ÚhashlibÚsha256ÚencodeÚ	hexdigestÚosr   ÚsplitextÚbasename)r%   r*   r   r   Úentry_idÚentrys   &&&&  r   Ú_create_entryÚSubgraphManager._create_entry,   sx   € ä—>’> V H¨T¨FÐ"3×":Ñ":Ó"<Ó=×GÑGÓIˆà�fØ”B—G‘G×$Ñ$¤R§W¡W×%5Ñ%5°dÓ%;Ó<¸QÕ?Ø�DØ�[ )Ð,ð	 
ˆð ˆÐr   c               ó   € V ^8„  d   QhRR/# )r)   r8   r   r
   )r,   s   "r   r-   r.   7   s   € ÷ ñ ¨=ñ r   c              ƒ  	ó¨   "  € \        VR ,          RRR7      ;_uu_ 4       pVP                  4       VR&   RRR4       V#   + '       g   i     T# ; i5i)r   Úrzutf-8)Úencodingr   N)ÚopenÚread)r%   r8   Úfs   && r   Úload_entry_dataÚSubgraphManager.load_entry_data7   s@   é € Ü�%˜•- ¨w×7Õ7¸1ØŸF™F›HˆE�&‰M÷ 8àˆ÷ 8Ö7àˆüs   ‚A >´
A¾A	Á		Ac               ó    € V ^8„  d   QhRRRR/# )r)   r8   zSubgraphEntry | Noner+   r
   )r,   s   "r   r-   r.   <   s   € ÷ ñ Ð*>ð ÐVjñ r   c              ƒ  	ó’   "  € Vf   R # VP                  4       pVP                  RR 4       V'       d   VP                  RR 4       V# 5i)Nr   r   )ÚcopyÚpop)r%   r8   Úremove_datas   &&&r   Úsanitize_entryÚSubgraphManager.sanitize_entry<   s<   é € ØŠ=ÙØ—
‘
“ˆØ�	‰	�&˜$ÔßØ�I‰I�f˜dÔ#Øˆùs
   ‚0A³Ac               ó    € V ^8„  d   QhRRRR/# )r)   Úentrieszdict[str, SubgraphEntry]r+   r
   )r,   s   "r   r-   r.   E   s   € ÷ ñ Ð.Fð Ð^vñ r   c              ƒ  	ó¶   "  € VP                  4       p\        VP                  4       4       F%  pV P                  W,          V4      G R j  x€L
 W&   K'  	  V#  L5ir"   )rF   ÚlistÚkeysrI   )r%   rL   rH   Úkeys   &&& r   Úsanitize_entriesÚ SubgraphManager.sanitize_entriesE   sI   é € Ø—,‘,“.ˆÜ˜Ÿ™›Ö'ˆCØ!%×!4Ñ!4°Wµ\À;Ó!O×OˆG‹Lñ (àˆñ Pùs   ‚AAÁ
AÁAc              ƒ  óÆ  "  € V'       g   V P                   e   V P                   # / p\        P                  ! R4       F˜  p\        P                  P                  VR4      p\        P                  ! V4       F[  pVP                  RR4      pRVP                  R4      R,          ,           pV P                  V\        P                  V4      w  r‰W“V&   K]  	  Kš  	  W0n         V# 5i)z!Load subgraphs from custom nodes.Úcustom_nodesz*/subgraphs/*.jsonÚ\Ú/zcustom_nodes.éýÿÿÿ)r#   Úfolder_pathsÚget_folder_pathsr4   r   ÚjoinÚglobÚreplaceÚsplitr9   r   r   )
r%   ÚloadedModulesÚforce_reloadÚsubgraphs_dictÚfolderÚpatternr*   r   r7   r8   s
   &&&       r   Úget_custom_node_subgraphsÚ)SubgraphManager.get_custom_node_subgraphsK   s»   é € ç × AÑ AÒ MØ×4Ñ4Ð4à.0ˆÜ"×3Ò3°NÖCˆFÜ—g‘g—l‘l 6Ð+?Ó@ˆGÜŸ	š	 'Ö*�Ø—|‘| D¨#Ó.�Ø+¨d¯j©j¸«o¸bÕ.AÕA�	Ø"&×"4Ñ"4°T¼6×;MÑ;MÈyÓ"Y‘�Ø+0˜xÓ(ó	 +ñ Dð -;Ô)ØÐùs   ‚CC!c              ƒ  óP  "  € V'       g   V P                   e   V P                   # / p\        P                  P                  \        P                  P	                  \        P                  P	                  \
        4      4      R4      p\        P                  P                  V4      '       du   \        P                  ! \        P                  P                  VR4      4       F<  pVP                  RR4      pV P                  V\        P                  R4      w  rVWbV&   K>  	  W n         V# 5i)z-Load subgraphs from the blueprints directory.Ú
blueprintsz*.jsonrU   rV   Úcomfyui)r$   r4   r   rZ   ÚdirnameÚ__file__Úexistsr[   r\   r9   r   r	   )r%   r_   r`   Úblueprints_dirr*   r7   r8   s   &&     r   Úget_blueprint_subgraphsÚ'SubgraphManager.get_blueprint_subgraphs\   sË   é € ç × ?Ñ ?Ò KØ×2Ñ2Ð2à.0ˆÜŸ™Ÿ™¤b§g¡g§o¡o´b·g±g·o±oÄhÓ6OÓ&PÐR^Ó_ˆä�7‰7�>‰>˜.×)Ò)ÜŸ	š	¤"§'¡'§,¡,¨~¸xÓ"HÖI�Ø—|‘| D¨#Ó.�Ø"&×"4Ñ"4°T¼6×;KÑ;KÈYÓ"W‘�Ø+0˜xÓ(ñ Jð
 +9Ô'ØÐùs   ‚B'D&Â*A<D&c              ƒ  ó‚   "  € V P                  W4      G Rj  x€L
 pV P                  V4      G Rj  x€L
 p/ VCVC#  L# L5i)zAGet all subgraphs from all sources (custom nodes and blueprints).N)rc   rl   )r%   r^   r_   Úcustom_node_subgraphsÚblueprint_subgraphss   &&&  r   Úget_all_subgraphsÚ!SubgraphManager.get_all_subgraphsm   sH   é € à&*×&DÑ&DÀ]Ó&a× aÐØ$(×$@Ñ$@ÀÓ$N×NÐØ?Ð'Ð?Ð+>Ð?Ð?ñ !bÙNùs   ‚?—;˜?°=±?½?c               ó   € V ^8„  d   QhRR/# )r)   Úidr   r
   )r,   s   "r   r-   r.   s   s   € ÷ ñ  Sñ r   c              ƒ  óÆ   "  € V P                  V4      G Rj  x€L
 P                  V4      pVe-   VP                  R4      f   V P                  V4      G Rj  x€L
  V#  LE L5i)z.Get a specific subgraph by ID from any source.Nr   )rq   ÚgetrB   )r%   rt   r^   r8   s   &&& r   Úget_subgraphÚSubgraphManager.get_subgraphs   sX   é € à×-Ñ-¨mÓ<×<×AÑAÀ"ÓEˆØÒ §¡¨6Ó!2Ò!:Ø×&Ñ& uÓ-×-Ð-Øˆñ =á-ùs!   ‚A!—A˜>A!ÁAÁA!ÁA!c                	óv   a a€ VP                  R 4      VV 3R l4       pVP                  R4      VV 3R l4       pR# )z/global_subgraphsc              “  ó¤   <"  € SP                  S4      G R j  x€L
 p\        P                  ! SP                  VRR7      G R j  x€L
 4      #  L3 L
5i)NT)rH   )rq   r   Újson_responserQ   )Úrequestr`   r^   r%   s   & €€r   Úget_global_subgraphsÚ8SubgraphManager.add_routes.<locals>.get_global_subgraphs{   sG   øé € à#'×#9Ñ#9¸-Ó#H×HˆNÜ×$Ò$¨4×+@Ñ+@ÀÐ]aÐ+@Ó+b×%bÓcÐcñ IÙ%bùs!   ƒA˜A™*AÁAÁ	AÁAz/global_subgraphs/{id}c              “  óÚ   <"  € V P                   P                  R R4      pSP                  VS4      G Rj  x€L
 p\        P                  ! SP                  V4      G Rj  x€L
 4      #  L1 L
5i)rt   N)Ú
match_inforv   rw   r   r{   rI   )r|   rt   Úsubgraphr^   r%   s   &  €€r   Úget_global_subgraphÚ7SubgraphManager.add_routes.<locals>.get_global_subgraph€   s[   øé € à×#Ñ#×'Ñ'¨¨dÓ3ˆBØ!×.Ñ.¨r°=ÓA×AˆHÜ×$Ò$¨4×+>Ñ+>¸xÓ+H×%HÓIÐIñ BÙ%Hùs!   ƒ2A+µA'¶(A+ÁA)Á	A+Á)A+N)rv   )r%   Úroutesr^   r}   r‚   s   f&f  r   Ú
add_routesÚSubgraphManager.add_routesz   sA   ù€ Ø	�‰Ð'Ó	(õ	dó 
)ð	dð 
�‰Ð,Ó	-õ	Jó 
.ò	Jr   )r$   r#   N)F)r   r   r   r   r&   r9   rB   rI   rQ   rc   rl   rq   rw   r…   r   r
   r   r   r    r    '   s7   † òKõ	õ÷
÷ôô"ô"@õö
Jr   r    )Ú
__future__r   Útypingr   r4   rX   r[   Úaiohttpr   r0   r   r   r   r    r
   r   r   Ú<module>rŠ      sJ   ðÝ "å Û 	Û Û Ý Û ÷ñ ô�Iô ô( )ô ÷]Jó ]Jr   