Ë
    ð�©jÅ9  ã                  óö  — d Z ddlmZ ddlZddlZddlZddlZ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mZmZmZ ddlmZ  ej,                  e«      Zeez   Z	 ddlZeez  Z	 ddlZeez  Zdd„Zdd„Zdd„Z ddœ	 	 	 	 	 	 	 dd„Z!dd„Z"dd„Z#dd„Z$dd d„Z%d!d„Z&d"d„Z'	 	 	 	 	 	 	 	 	 	 d#d„Z(	 d$	 	 	 	 	 	 	 d%d„Z)y# e$ r ej9                  d	«       Y Œqw xY w# e$ r ej9                  d
«       Y Œƒw xY w)&zUtilities related archives.é    )ÚannotationsN)ÚIterable)ÚZipInfo)ÚInstallationError)ÚBZ2_EXTENSIONSÚTAR_EXTENSIONSÚXZ_EXTENSIONSÚZIP_EXTENSIONS)Ú
ensure_dirzbz2 module is not availablezlzma module is not availablec                 óZ   — t        j                  d«      } t        j                  | «       | S )zBGet the current umask which involves having to set it temporarily.r   )ÚosÚumask)Úmasks    úd/var/www/html/streamforge-license/venv/lib/python3.12/site-packages/pip/_internal/utils/unpacking.pyÚcurrent_umaskr   -   s   € ä�8‰8�A‹;€DÜ‡H�HˆT„NØ€Kó    c                óø   — | j                  d«      j                  d«      } d| v r=d| v r#| j                  d«      | j                  d«      k  sd| vr| j                  dd«      S d| v r| j                  dd«      S | dgS )Nú/ú\é   Ú )ÚlstripÚfindÚsplit©Úpaths    r   Úsplit_leading_dirr   4   sz   € Ø�;‰;�sÓ×"Ñ" 4Ó(€DØ
ˆd�{Ø	�‰˜$Ÿ)™) C›.¨4¯9©9°T«?Ò:¸tÈ4Ñ?Oà�z‰z˜#˜qÓ!Ð!Ø	�‰Ø�z‰z˜$ Ó"Ð"à�bˆzÐr   c                óR   — d}| D ]   }t        |«      \  }}|s y|€|}Œ||k7  sŒ  y y)zyReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)NFT)r   )ÚpathsÚcommon_prefixr   ÚprefixÚrests        r   Úhas_leading_dirr#   @   sG   € ð €MØò ˆÜ(¨Ó.‰ˆ�ÙÙØÐ"Ø"‰MØ�}Ó$Ùðð r   F©Úresolve_symlinksc               óR  — |r?t         j                  j                  | «      }t         j                  j                  |«      }n>t         j                  j                  | «      }t         j                  j                  |«      }||k(  xs" |j	                  |t         j
                  z   «      S )a  
    Return true if the absolute path of target is within the directory
    (including when target is equal to the directory).

    When ``resolve_symlinks`` is true, resolve symlinks before comparing so
    traversal through a symlink (e.g. "link/../file") is also caught.
    )r   r   ÚrealpathÚabspathÚ
startswithÚsep)Ú	directoryÚtargetr%   Úabs_directoryÚ
abs_targets        r   Úis_within_directoryr/   O   sz   € ñ ÜŸ™×(Ñ(¨Ó3ˆÜ—W‘W×%Ñ% fÓ-‰
äŸ™Ÿ™¨	Ó2ˆÜ—W‘W—_‘_ VÓ,ˆ
à˜Ñ&ÒW¨*×*?Ñ*?ÀÔPR×PVÑPVÑ@VÓ*WÐWr   c                 ó$   — dt        «        z  dz  S )Niÿ  éI   )r   © r   r   Ú!_get_default_mode_plus_executabler3   c   s   € Ø”M“OÐ#Ñ# eÑ+Ð+r   c                ó@   — t        j                  | t        «       «       y)zx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    N)r   Úchmodr3   r   s    r   Ú2set_extracted_file_to_default_mode_plus_executabler6   g   s   € ô
 ‡H�HˆTÔ4Ó6Õ7r   c                ór   — | j                   dz	  }t        |xr t        j                  |«      xr |dz  «      S )Né   r1   )Úexternal_attrÚboolÚstatÚS_ISREG)ÚinfoÚmodes     r   Úzip_item_is_executabler?   o   s6   € Ø×Ñ Ñ#€Dô �Ò<œŸ™ dÓ+Ò<°°u±Ó=Ð=r   c                ó®  — t        |«       t        | d«      }	 t        j                  |d¬«      }t	        |j                  «       «      xr |}|j                  «       D �]  }|j                  }|}|rt        |«      d   }t        j                  j                  ||«      }t        j                  j                  |«      }	t        ||«      sd}
t        |
j                  | ||«      «      ‚|j!                  d«      rt        |«       Œ¨t        |	«       |j                  |«      }	 t        |d«      5 }t#        j$                  ||«       ddd«       |j'                  «        t)        |«      s�Œt+        |«       �Œ 	 |j'                  «        y# 1 sw Y   ŒFxY w# |j'                  «        t)        |«      rt+        |«       w w xY w# |j'                  «        w xY w)	aŸ  
    Unzip the file (with path `filename`) to the destination `location`.  All
    files are written based on system defaults and umask (i.e. permissions are
    not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written. Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    ÚrbT)Ú
allowZip64r   zQThe zip file ({}) has a file ({}) trying to install outside target directory ({}))r   r   ÚwbN)r   ÚopenÚzipfileÚZipFiler#   ÚnamelistÚinfolistÚfilenamer   r   r   ÚjoinÚdirnamer/   r   ÚformatÚendswithÚshutilÚcopyfileobjÚcloser?   r6   )rI   ÚlocationÚflattenÚzipfpÚzipÚleadingr=   ÚnameÚfnÚdirÚmessageÚfpÚdestfps                r   Ú
unzip_filer\   v   s  € ô ˆxÔÜ�˜4Ó €Eð Ü�o‰o˜e°Ô5ˆÜ! #§,¡,£.Ó1Ò=°gˆØ—L‘L“Nó 	OˆDØ—=‘=ˆDØˆBÙÜ& tÓ,¨QÑ/�Ü—‘—‘˜h¨Ó+ˆBÜ—'‘'—/‘/ "Ó%ˆCÜ& x°Ô4ð4ð ô (¨¯©°xÀÀXÓ(NÓOÐOØ�{‰{˜;Ô'ä˜2•ä˜3”ð —X‘X˜d“^�ðOÜ˜b $›ð 7¨6Ü×*Ñ*¨2¨vÔ6÷7ð —H‘H”JÜ-¨dÖ3ÜJÈ2ÖNñ7	Oð: 	�‰�÷7ð 7ûð —H‘H”JÜ-¨dÔ3ÜJÈ2ÕNð 4ûð 	�‰�úsB   ™DG Ä"FÄ.F
ÅFÅG Å*G Æ
F	ÆFÆ)F?Æ?G ÇGc                ó  ‡ ‡‡‡— t        ‰«       ‰ j                  «       j                  d«      s‰ j                  «       j                  d«      rd}n†‰ j                  «       j                  t        «      rd}n`‰ j                  «       j                  t        «      rd}n:‰ j                  «       j                  d«      rd}nt
        j                  d‰ «       d	}t        j                  ‰ |d
¬«      }	 t        |j                  «       D �cg c]  }|j                  ‘Œ c}«      }	 t        j                  Št        «       Š|rj|j                  «       D ]W  }t        |j                  «      \  }}||_        |j                  «       sŒ3t        |j                   «      \  }}	||k(  sŒQ|	|_        ŒY dˆˆˆ ˆfd„}
|j#                  ‰|
¬«       |j)                  «        yc c}w # t$        $ r t'        ‰ ‰||«       Y Œ/w xY w# |j)                  «        w xY w)a¡  
    Untar the file (with path `filename`) to the destination `location`.
    All files are written based on system defaults and umask (i.e. permissions
    are not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied on top of the
    default.  Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    z.gzz.tgzzr:gzzr:bz2zr:xzz.tarÚrz-Cannot determine compression type for file %szr:*zutf-8)Úencodingc                ó|  •— | j                   }	 	  ‰| ‰«      } | j                  «       r|dz  r	‰| _         | S d | _         | S # t        j                  $ r0 t        j                  d d dv rt        j
                  | ‰«      } n‚ Y Œiw xY w# t        j                  $ r"}d}t        |j                  ‰|«      «      ‚d }~ww xY w)Né   >   ©ra   é	   é   ©ra   é
   é   ©ra   é   é   z%Invalid member in the tar file {}: {}r1   )
r>   ÚtarfileÚLinkOutsideDestinationErrorÚsysÚversion_infoÚ
tar_filterÚTarErrorr   rL   Úisfile)	Úmemberr   Ú	orig_modeÚexcrY   Údata_filterÚdefault_mode_plus_executablerI   rQ   s	        €€€€r   Ú
pip_filterzuntar_file.<locals>.pip_filter×   sÛ   ø€ Ø"ŸK™K�	ðð"Ù!,¨V°XÓ!>˜ð2 —=‘=”? y°5Ò'8Ø">�F”Kð �ð #'�F”KØ�øôA #×>Ñ>ò "Ü×+Ñ+¨B¨QÐ/ð 4ñ ô &-×%7Ñ%7¸ÀÓ%I™Fà!ñ #ð"ûô ×'Ñ'ò 	ØE�Gô ,ØŸ™Ø$Øóóð ûð		ús0   �	A  Á A BÂ B ÂBÂB ÂB;ÂB6Â6B;)ÚfilterN)rr   útarfile.TarInfor   ÚstrÚreturnry   )r   ÚlowerrM   r   r	   ÚloggerÚwarningrk   rD   r#   Ú
getmembersrV   ru   r3   r   ÚislnkÚlinknameÚ
extractallÚAttributeErrorÚ_untar_without_filterrP   )rI   rQ   r>   Útarrr   rU   Ú	name_leadÚ	name_restÚlnk_leadÚlnk_restrw   ru   rv   s   ``         @@r   Ú
untar_filerŠ   ¤   s³  û€ ô ˆxÔØ‡~�~Ó× Ñ  Ô'¨8¯>©>Ó+;×+DÑ+DÀVÔ+LØ‰Ø	�‰Ó	×	"Ñ	"¤>Ô	2Ø‰Ø	�‰Ó	×	"Ñ	"¤=Ô	1Ø‰Ø	�‰Ó	×	"Ñ	" 6Ô	*Ø‰ä�‰Ø;Øô	
ð ˆä
�,‰,�x °Ô
8€CðCÜ!¸S¿^¹^Ó=MÖ"N°6 6§;£;Ò"NÓOˆð
:	8Ü!×-Ñ-ˆKô ,MÓ+NÐ(áð "Ÿn™nÓ.ò 7�FÜ+<¸V¿[¹[Ó+IÑ(�I˜yØ"+�F”KØ—|‘|•~Ü->¸v¿¹Ó-OÑ*˜ (Ø# yÓ0Ø.6˜F�Oð7÷%ð %ðN �N‰N˜8¨JˆNÔ7ð 	�	‰	�ùòE #Oøô ò 	DÜ! (¨H°c¸7ÖCð	Dûðv 	�	‰	�úsO   Ã0G7 ÄGÄG7 Ä"G Ä2AG7 ÆG7 Æ%G7 ÇG7 ÇG4Ç1G7 Ç3G4Ç4G7 Ç7H	c                óJ  — t         j                  j                  t         j                  j                  |j                  «      |j
                  «      }t         j                  j                  |«      }|j                  dd«      }	 | j                  |«       y# t        $ r Y yw xY w)zGCheck if the file pointed to by the symbolic link is in the tar archiver   r   TF)
r   r   rJ   rK   rV   r�   ÚnormpathÚreplaceÚ	getmemberÚKeyError)r…   Útarinfor�   s      r   Úis_symlink_target_in_tarr‘     sy   € ä�w‰w�|‰|œBŸG™GŸO™O¨G¯L©LÓ9¸7×;KÑ;KÓL€Hä�w‰w×Ñ Ó)€HØ×Ñ  cÓ*€HðØ�‰�hÔØøÜò Ùðús   ÂB Â	B"Â!B"c                ó|  — |j                  «       D �]$  }|j                  }|rt        |«      d   }t        j                  j                  ||«      }t        ||«      rt        ||d¬«      sd}t        |j                  | ||«      «      ‚|j                  «       rt        |«       Œ”|j                  «       rÚt        j                  j                  t        j                  j                  |«      |j                  «      }t        ||d¬«      s2d}t        |j                  | |j                  |j                  «      «      ‚t        ||«      s2d}t        |j                  | |j                  |j                  «      «      ‚	 |j                  ||«       �Œ~	 |j'                  |«      }
t        t        j                  j                  |«      «       |
€J ‚t-        |d«      5 }t/        j0                  |
|«       ddd«       |
j3                  «        |j5                  ||«       |j6                  dz  s�Œt9        |«       �Œ' y# t         $ r-}	t"        j%                  d| |j                  |	«       Y d}	~	�ŒZd}	~	ww xY w# t(        t*        f$ r-}	t"        j%                  d| |j                  |	«       Y d}	~	�Œ™d}	~	ww xY w# 1 sw Y   ŒÃxY w)	z/Fallback for Python without tarfile.data_filterr   Tr$   zQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNrC   r1   )r   rV   r   r   r   rJ   r/   r   rL   Úisdirr   ÚissymrK   r�   r‘   Ú_extract_memberÚ	Exceptionr}   r~   Úextractfiler�   rƒ   rD   rN   rO   rP   Úutimer>   r6   )rI   rQ   r…   rU   rr   rW   r   rY   r,   rt   rZ   r[   s               r   r„   r„     s\  € ð —.‘.Ó"ó IIˆØ�[‰[ˆÙÜ" 2Ó& qÑ)ˆBÜ�w‰w�|‰|˜H bÓ)ˆô
 # 8¨TÔ2Ô:MØ�d¨Tõ;
ð0ð ô $ G§N¡N°8¸TÀ8Ó$LÓMÐMØ�<‰<Œ>Ü�tÕØ�\‰\Œ^ô —W‘W—\‘\¤"§'¡'§/¡/°$Ó"7¸¿¹ÓIˆFÜ& x°È$ÕOð4ð ô (Ø—N‘N 8¨V¯[©[¸&¿/¹/ÓJóð ô ,¨C°Ô8ð4ð ô (Ø—N‘N 8¨V¯[©[¸&¿/¹/ÓJóð ðØ×#Ñ# F¨DÖ1ðØ—_‘_ VÓ,�ô ”r—w‘w—‘ tÓ,Ô-Ø�>Ð!�>Ü�d˜DÓ!ð / VÜ×"Ñ" 2 vÔ.÷/à�H‰HŒJà�I‰I�f˜dÔ#à�{‰{˜UÔ"ÜBÀ4ÖHñSIIøôR ò 	ô —‘ØEØØ—K‘KØô	õ ûð	ûô œnÐ-ò 	ô —‘ØEØØ—K‘KØô	õ ûð	ú÷/ð /ús<   Å;H:ÆI3ÇJ2È:	I0É"I+É+I0É3J/Ê"J*Ê*J/Ê2J;	c                ó|  ‡ ‡‡— t         j                  j                  ‰ «      Š ‰ j                  d«       Šd	ˆ ˆˆfd„}d	ˆ ˆfd„}|dk(  r |«       S |dk(  r |«       S ‰ j	                  «       j                  t
        «      r |«       S ‰ j	                  «       j                  t        t        z   t        z   «      r |«       S t        j                  ‰ «      }t        j                  ‰ «      }|r	|s |«       S |r	|s |«       S |r|rt        j                  d‰ «       t        j                  d‰ ‰|«       t!        d‰› �«      ‚)
zÑUnpack ``filename`` into ``location``.

    Archive format is chosen in order of decreasing reliability:
    ``content_type``, then filename extension, then magic signature
    (unambiguous matches only).
    z.whlc                 ó"   •— t        ‰ ‰‰¬«       y )N)rR   )r\   )rI   rQ   Úzip_flattens   €€€r   Ú_unzipzunpack_file.<locals>._unzipv  s   ø€ Ü�8˜X¨{Ö;r   c                 ó   •— t        ‰ ‰«       y ©N)rŠ   )rI   rQ   s   €€r   Ú_untarzunpack_file.<locals>._untary  s   ø€ Ü�8˜XÕ&r   zapplication/zipzapplication/x-gzipzAmbiguous file signature in %s.zZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz#Cannot determine archive format of )r{   ÚNone)r   r   r'   rM   r|   r
   r   r   r	   rE   Ú
is_zipfilerk   Ú
is_tarfiler}   ÚerrorÚcriticalr   )rI   rQ   Úcontent_typerœ   rŸ   r¡   r¢   r›   s   ``     @r   Úunpack_filer¦   h  s  ú€ ô �w‰w×Ñ Ó)€HØ×'Ñ'¨Ó/Ð/€K÷<ö'ð Ð(Ò(Ù‹xˆØÐ+Ò+Ù‹xˆà‡~�~Ó× Ñ ¤Ô0Ù‹xˆØ‡~�~Ó× Ñ ¤´.Ñ!@Ä=Ñ!PÔQÙ‹xˆô ×#Ñ# HÓ-€JÜ×#Ñ# HÓ-€JÙ™*Ù‹xˆÙ™*Ù‹xˆÙ‘jÜ�‰Ð6¸ÔAä
‡O�Oð	'àØØôô ÐAÀ(ÀÐLÓ
MÐMr   )r{   Úint)r   rz   r{   z	list[str])r   zIterable[str]r{   r:   )r+   rz   r,   rz   r%   r:   r{   r:   )r   rz   r{   r    )r=   r   r{   r:   )T)rI   rz   rQ   rz   rR   r:   r{   r    )rI   rz   rQ   rz   r{   r    )r…   útarfile.TarFiler�   ry   r{   r:   )
rI   rz   rQ   rz   r…   r¨   rU   r:   r{   r    rž   )rI   rz   rQ   rz   r¥   z
str | Noner{   r    )*Ú__doc__Ú
__future__r   Úloggingr   rN   r;   rm   rk   rE   Úcollections.abcr   r   Úpip._internal.exceptionsr   Úpip._internal.utils.filetypesr   r   r	   r
   Úpip._internal.utils.miscr   Ú	getLoggerÚ__name__r}   ÚSUPPORTED_EXTENSIONSÚbz2ÚImportErrorÚdebugÚlzmar   r   r#   r/   r3   r6   r?   r\   rŠ   r‘   r„   r¦   r2   r   r   ú<module>r·      sŒ  ðÙ !å "ã Û 	Û Û Û 
Û Û Ý $Ý å 6÷ó õ 0à	ˆ×	Ñ	˜8Ó	$€ð &¨Ñ6Ð ð0Ûà˜NÑ*Ðð1ãà˜MÑ)Ðó
ó	óð  >CñXØðXØðXØ6:ðXà	óXó(,ó8ó>ô+ó\]ó@ðSIØðSIàðSIð 
ðSIð ð	SIð
 
óSIðr  $ð/NØð/Nàð/Nð ð/Nð 
ô	/NøðO
 ò 0Ø
‡L�LÐ.Ö/ð0ûð ò 1Ø
‡L�LÐ/Ö0ð1ús$   Á!	C Á+	C ÃCÃCÃC8Ã7C8