+
    & iB  c                   s   ^ RI t ^ RIHt ^ RIHtHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHtHt ^ R	IHt ^ R
IHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtH t H!t! ^ RI"H#t# ^ RI$H%t%H&t&H't'H(t(H)t)H*t*H+t+ ],]-]-]-3,          t.],]]3,          t/R R lt0R R lt1R R lt2R R lt3R R lt4R R lt5R R lt6R  R! lt7R# )"i    N)Callable)FutureThreadPoolExecutor)sha256)
HTTPStatusPath)token_urlsafe)movermtree)run)TemporaryDirectorymkdtemp)	HTTPError)TimeoutError)PoolManager)BaseHTTPResponse)	UMU_CACHEFileLock
HTTPMethod)log)extract_tarfilefile_digestget_tempdirhas_umu_setup
run_zenity
unix_flockwrite_file_chunksc                s$    V ^8  d   QhR\         /# )   	file_pathr   Zformat   "4/usr/lib/python3.14/site-packages/umu/umu_runtime.py__annotate__r!   "   s     ! !4 !    c                s    RpV P                  R4      ;_uu_ 4       pVP                  V4       RRR4       V P                  R4       R#   + '       g   i     L#; i)a  Create a shell script shim at the specified file path.

This script sets the DISPLAY environment variable if certain conditions
are met and executes the passed command.

Args:
    file_path (Path, optional): The path where the shim script will be created.

a  #!/bin/sh

if [ "${XDG_CURRENT_DESKTOP}" = "gamescope" ] || [ "${XDG_SESSION_DESKTOP}" = "gamescope" ]; then
    # Check if STEAM_MULTIPLE_XWAYLANDS is set to 1
    if [ "${STEAM_MULTIPLE_XWAYLANDS}" = "1" ]; then
        # Check if DISPLAY is set, if not, set it to ":1"
        if [ -z "${DISPLAY}" ]; then
            export DISPLAY=":1"
        fi
    fi
fi

# Execute the passed command
exec "$@"
ZwNi  )openZwriteZchmod)r   Zscript_contentfiles   &  r    create_shimr%   "   sG    	 $ 
		

>" 
 OOE	 
	s   A		A	c                @    V ^8  d   QhR\         R\        R\        RR/# )r   runtime_versession_poolslocalreturnN)RuntimeVersionSessionPoolsr   r   r   r    r!   r!   F   s6     C& C&C&C& C& 
	C&r"   c                 s(   \         P                  ! R R R7       \        4       p^ pVw  rVV w  rxp	RV R2p
RV R2pR\        ^4       2pRpVP	                  V
 R24      p\
        P                  ! R	V4       \        P                  P                  R
4      R8X  d(   RpRRRV RV
 2R\        V4      .pRp\        VVV4      pV'       d8   VP	                  V
4      P                  R R7       \
        P                  ! R4       \        P                  P                  R
4      '       d
   V'       Ed   RpRpRV R2p\        4       pRpVP                  \         P"                  P$                  V V RV 2RR7      pVP&                  \(        P*                  8w  d,   VP-                  R4       RVP&                   2p\/        V4      hV
P1                  4       pVP3                  4       ;p'       d]   VP5                  4       P7                  V4      '       g   K?  VP9                  R4      ^ ,          P5                  4       P;                  4       p VP=                  4        VP                  \         P"                  P$                  V V RV 24      pVP&                  \(        P*                  8w  d,   VP-                  R4       RVP&                   2p\/        V4      hVP>                  P;                  RR 7      PA                  4       p\
        P                  ! R!V4       \
        P                  ! R"WPC                  R#V R24      4       VPC                  R#V R24      p\         P                  ! V
 R#V R24      pVPE                  4       '       d   \
        P                  ! R$VPF                  4       R%R&VPI                  4       PJ                   R'2/pVPM                  \O        \         R(7       RVPF                   24      pVPQ                  R)4      ;_uu_ 4       p\S        VVPF                  4      pRRR4       M\
        P                  ! R*V4       VP                  \         P"                  P$                  V V RV
 V 2RVR+7      pVP&                  \(        P*                  \(        PT                  \(        PV                  09  d,   VP-                  R4       RVP&                   2p\/        V4      hVP&                  \(        PV                  8w  d&    \
        P                  ! R,V4       \Y        VVV4      pVP=                  4        \
        P                  ! R/V4       VPa                  4       V8w  d+   VP                  R R7       R0V
 R1V V RV
 2p\c        V4      h\
        P                  ! R2V
4       VPM                  VPd                  VPF                  Pg                  R#V R24      ,          4      p\
        P                  ! R3V4       \i        \         R(7      ;_uu_ 4       p. pVP	                  R44      p\
        P                  ! R5V4       \
        P                  ! R6VV4       \_        VV4       VP                  R R R7       \
        P                  ! R7V RV
 2V4       \k        \m        VV
4      \m        V4      4       \m        VRV 24      p VP	                  R44      p\
        P                  ! R8V 4       \
        P                  ! R9V4       TPo                  V Pq                  R:4       U!u. uF  p!VPs                  \t        V!V V4      NK  	  up!4       VPw                  4       '       d7   \
        P                  ! R;V4       VPs                  \x        \        V4      4       V F  p"V"P{                  4        K  	  RRR4       \
        P                  ! R<4       VP	                  R=4      PM                  VP	                  R>4      4       \}        VR?,          4       \        W 4       R#   + '       g   i     EL; i  \Z         dJ    \
        P\                  ! R-4       \
        P                  ! R.TPF                  4       \_        T\         4       h i ; iu up!i   + '       g   i     L; i)@TZparentsZexist_okZSteamLinuxRuntime_z.tar.xzz-https://repo.steampowered.com/steamrt-images-//snapshots/latest-container-runtime-public-betaz
?versions=repo.steampowered.comz.partsz Using endpoint '%s' for requestsZ
UMU_ZENITYZ1curlz-LJz--silentz-O/z--output-dirz'Downloading umu runtime, please wait...)Z
missing_okzRetrying from Python...Z /steamrt-images-Nz/SHA256SUMSF)preload_contentHostz returned the status: s    z/BUILD_ID.txtzutf-8)ZencodingzBUILD_ID: %szRenaming: %s -> %sZ.z Found '%s' in cache, resuming...ZRangezbytes=Z-)ZdirZrbz'Downloading %s (latest), please wait...)r3   headerszWriting: %sz-Aborting steamrt install due to network errorz*Moving '%s' to cache for future resumptionz
Digest: %szDigest mismatched: zS
Possible reason: cached file corrupted or failed to acquire upstream digest
Link: z%s: SHA256 is OKzOpening: %svarzCreated: %sMoving: %s -> %szExtracting: %s -> %sz
Source: %szDestination: %s*Removing: %sz Renaming: _v2-entry-point -> umuz_v2-entry-pointumuumu-shim)@r   mkdirr   r   joinpathr   debugosenvirongetstrr   Zunlinkinfor   requestr   GETvaluestatusr   OK	getheaderr   ZencodeZreadlineZrstripZendswithZsplitZdecodeZrelease_conndatastripZwith_suffixis_filenameZstatZst_sizeZrenamer   r#   r   ZPARTIAL_CONTENTZREQUESTED_RANGE_NOT_SATISFIABLEr   TimeoutErrorUrllib3errorr   Z	hexdigest
ValueErrorparentZremovesuffixr   r   r   ZextendglobZsubmit_moveis_dirr	   Zresultr%   check_runtime)#r'   r(   r)   ZtmpretZthread_pool	http_poolcodenamevariant_ZarchiveZbase_urltokenhostZpartsr0   ZoptsZmsgZdigestZbuildidendpointZhashsumr5   respZerrZtargetZlineZcached_partsZfpZtmpcacheZfuturesr6   Z
source_dirr$   Zfutures#   &&&                                r    _install_umur_   F   sY    OOD40CC*K&Hq'z9G
7z9	:  mB/01E'D,,'&12EII0(; 
zz~~l#s*j'#H
 =tS) W$$$5*+::>>,''33xj(WX 	 ()-   NN  fXJk%1! ! 

 ;;*--'..011G}UCC.   (mmo%d%{{}%%f--D)!,335<<>   NN  TF8*M%"I
 ;;*--'..011G}UCC. ))""G"4::<		.'* 			&/@/@1WIVAT/UV!!AgYf"56 ))WIQwiv*FG !!HH79J9JK&):):)<)D)D(EQ GHG ''7y+A*B!EJJ<(PQED!!R%b',,7 "! HH>H  NN  fXJay0!	 ! 
 ;;MM&&66
 

 ..011G}UCC.  ;;*DDD		-/+E4A 			,'&( 40%gY /xj'4 
 S/!#W- LL5::22Qwiv3FGG

 IImU#			*	*h "NN5)		-*		$eX6UH 	D40		(XJay*A8LXw/h@  ,>xj*IJ
NN5)		,
+		#U+ 	 'OOC00D ""5$
EB0	
 ::<<IInc*
 vs3x0FMMO E 
+L II01	NN$%,,U^^E-BC
"# %%M "!!4 ' 		IJEuzzRUI&	h) 
+	*s?   	`?$`% D
b!a<9bAb`"	%Aa9<bb	c                r&   r   r)   r'   r(   r*   Nr   r+   r,   r   r   r    r!   r!     s,     3 33,3=I3	3r"   c                s  a  \         P                  ! RS 4       \        S 4      '       gr   \         P                  ! R4       \         P                  ! R4       S P	                  RRR7       \        S VVV 3R l4       \         P                  ! RV^,          4       R# \        P                  P                  R	4      R
8X  d!   \         P                  ! RV^,          4       R# \        S W4       R# )z3Install or update the runtime for the current user.z	Local: %szNew install detectedz9Setting up Unified Launcher for Windows Games on Linux...Tr-   c                  B   < S P                  R 4      P                  4       # )r:   r=   rL   r)      r    <lambda>Zsetup_umu.<locals>.<lambda>  s    ENN5)113r"   zUsing %s (latest)NZUMU_RUNTIME_UPDATEZ0z%s updates disabled, skipping)
r   r>   r   rC   r<   _restore_umur?   r@   rA   _update_umu)r)   r'   r(   s   f&&r    	setup_umuri     s     IIk5! 		()LMD403		
 	$k!n5	zz~~*+s20+a.A{2r"   c                r&   r`   ra   r   r   r    r!   r!   '  s6     Q* Q*Q*Q*  Q* 
	Q*r"   c                sF  a a Vw  r4Vw  orSRS R2pR\        ^4       2pRp\        P                  ! R4       \        P                  ! RVS4       \        P                  ! RV4        \        R S P	                  S R	24       4       4      p	S P                  R4      P                  4       '       gB   \        P                  ! RS 4       \        P                  ! R4       \        S TTT 3R l4       R# S P                  R4      P                  4       '       gB   \        P                  ! RS 4       \        P                  ! R4       \        S TTT 3R l4       R# T T RT 2p
\        P                  ! RT
4       TP                  \        P                  P                  T
4      pTP                   \"        P$                  8w  d4   \        P&                  ! RTP)                  R4      TP                   4       R# \+        S YY+4       S P                  R4      P                  4       '       g   \-        S R,          4       \        P                  ! RT4       R#   \
         dE    \        P                  ! R
S 4       \        P                  ! R4       \        S TTTT 3R l4        R# i ; i)zFor existing installations, check for updates to the runtime.

The runtime platform will be updated to the latest public beta by
confirming if the latest platform ID exists in the local VERSIONS.txt
r2   r.   z	?version=r/   zExisting install detectedz%Using container runtime '%s' aka '%s'zChecking updates for '%s'...c              3   T   "   T F  qP                  4       '       g   K  Vx  K   	  R # 5iNrT   Z.0r$      & r    	<genexpr>Z_update_umu.<locals>.<genexpr>D  s     S'At[[]dd'A   (
(r8   z&*_platform_* directory missing in '%s'zRestoring Runtime Platform...c                  s   < \        SP                  S R 24       U u. uF  q P                  4       '       g   K  V NK  	  up 4      ^ 8  # u up i )r8   )ZlenrR   rT   )r$   rX   r)   s    r    rf   _update_umu.<locals>.<lambda>L  s=    C%**z^*DV*D$*DVWVs
   A	A	Npressure-vesselz)pressure-vessel directory missing in '%s'c                  rb   )rr   )r=   rT   rd   re   r    rf   rq   Y  s    ENN#45<<>r"   VERSIONS.txtz!VERSIONS.txt file missing in '%s'c                  rb   )rs   rc   rd   re   r    rf   rq   e  s    ENN>2::<r"   z/VERSION.txtz,Sending request to '%s' for 'VERSION.txt'...z%s returned the status: %sr4   r;   z%s is up to date)r   r   r>   maxrR   rP   criticalrC   rg   r=   rT   rL   rD   r   rE   rF   rG   r   rH   rO   rI   _update_umu_platformr%   )r)   r'   r(   rZ   rW   rY   r]   r[   r\   runtimeZurlr^   rX   s   f&&         @r    rh   rh   '  s0    !LA&Hg
8*$ST  ]2./0E'DII)*II5wIII,g6SuzzXJa.'ASS >>+,3355@%H01>		
 	 >>.)11338%@01<		
 	 zeW5CII<cBZ^^1137D{{jmm#		.v0FT mJ >>*%--//EJ&'HH)g  
=uE01		
 	
s   ($I AJ J c                s@    V ^8  d   QhR\         R\         R\         RR/# )r   r$   srcdstr*   Nr   r   r   r    r!   r!   {  s(     " " "4 "d "t "r"   c                s   VP                  V P                  4      pVP                  V P                  4      pVP                  4       '       d,   \        P                  ! RV4       \        \        V4      4       VP                  4       '       g   VP                  4       '       d%   \        P                  ! RW44       \        W44       R# R# )zMove a file or directory to a destination.

In order for the source and destination directory to be identical, when
moving a directory, the contents of that same directory at the destination
will be removed.
zRemoving directory: %sr7   N)	r=   rM   rT   r   r>   r	   rB   rL   r   )r$   rx   ry   Zsrc_fileZ	dest_files   &&&  r    rS   rS   {  s     \\$)),Hll499-I		*I6s9~
{{}}

		$h:X! %r"   c                s<    V ^8  d   QhR\         R\        R\        /# )r   rx   r'   r*   )r   r+   Zintr   r   r    r!   r!     s!     * *t *. *S *r"   c                s   Vw  r#pV P                  RRR4      p^p \        R V P                  V R24       4       4      pTP                  4       '       g1   \        P                  ! RT4       \        P                  ! RT4       T# \        P                  ! R	TP                  4       \        TR
RTP                  R4      .RR7      P                  pT'       d<   \        P                  ! RT4       \        P                  ! RTP                  T4       T# \        P                  ! RTP                  4       T#   \         d4    \        P
                  ! RT4       \        P
                  ! RT 4       Tu # i ; i)zValidate the file hierarchy of the runtime platform.

The mtree file included in the Steam runtime platform will be used to
validate the integrity of the runtime's metadata after its moved to the
home directory and used to run games.
rr   Zbinz	pv-verifyc              3   rj   rk   rl   rm   rn   r    ro   Z check_runtime.<locals>.<genexpr>  s     Q'?t;;=dd'?rp   r8   z%s validation failedz#Could not find *_platform_* in '%s'zFile does not exist: '%s'zVerifying integrity of %s...z--quietz--minimized-runtimeZfilesF)Zcheckz"%s exited with the status code: %sz%s: mtree is OK)r=   rt   rR   rP   r   ru   rL   ZwarningrC   rM   r
   Z
returncoder>   )rx   r'   rX   rY   rZ   Z	pv_verifyrV   rw   s   &&      r    rU   rU     s@    'Hqll#4e[IICQsxx8*A'?QQ *G4/;
HH+W\\:
!W%		
  j  *G4		6	L
HH-J7  +W5:C@
s   $D7 7;E54E5c          
      sf    V ^8  d   QhR\         R\        R\        R\        . \        3,          RR/# )r   r)   r'   r(   callback_fnr*   N)r   r+   r,   r    Zboolr   r   r    r!   r!     sC     3 333  3 "d(#	3
 
3r"   c                 s   V P                    R \        P                  P                   2p\	        V4      ;_uu_ 4        \
        P                  ! RV4       V! 4       '       dA   \
        P                  ! RV4       \
        P                  ! RV^,          4        RRR4       R# \        WV 4       \
        P                  ! RV4       RRR4       R#   + '       g   i     R# ; i)r1   zAcquired file lock '%s'...Released file lock '%s'z%s was restoredN)	rQ   r   RuntimerF   r   r   r>   rC   r_   )r)   r'   r(   rz   locks   &&&& r    rg   rg     s     <<.("2"2"8"8!9:D	D				.5==II/6HH&A7 
	 	[7		+T2 
			s   AC"#CC 	c                sX    V ^8  d   QhR\         R\         R\        R\        R\        RR/# )r   r)   rw   r'   r(   r^   r*   N)r   r+   r,   r   r   r   r    r!   r!     sD     3 333  3  	3
 3 
3r"   c                 s   Vw  rVpVP                   P                  4       pV P                   R \        P                  P
                   2p\        P                  ! RV4       \        V4      ;_uu_ 4        \        P                  ! RV4       V P                  R4      P                  4       p	Wy9   d#   \        P                  ! RV4        RRR4       R# \        P                  ! RV4       \        W#V 4       \        P                  ! RV4       \        \        V4      4       \        P                  ! RV4       RRR4       R#   + '       g   i     R# ; i)r1   zAcquiring file lock '%s'...zAcquired file lock '%s'rs   r{   NzUpdating %s to latest...r9   )rJ   rK   rQ   r   r|   rF   r   r>   r   r=   Z
read_bytesrC   r_   r	   rB   )
r)   rw   r'   r(   r^   rZ   rY   Zversionr}   Zversionss
   &&&&&     r    rv   rv     s      MAYY__&G<<.("2"2"8"8!9:D
 II+T2	D				+T2 >>.1<<>II/6 
	 	+W5[7		.'*s7|		+T2 
			s   3AEA%EE	)8r?   Zcollections.abcr    Zconcurrent.futuresr   r   Zhashlibr   Zhttpr   Zpathlibr   Zsecretsr   Zshutilr   r	   Z
subprocessr
   Ztempfiler   r   Zurllib3.exceptionsr   r   rN   Zurllib3.poolmanagerr   Zurllib3.responser   Zumu.umu_constsr   r   r   Zumu.umu_logr   Zumu.umu_utilr   r   r   r   r   r   r   ZtuplerB   r+   r,   r%   r_   ri   rh   rS   rU   rg   rv   ) r"   r    <module>r~      s    	 $ 9    !   0 ( B + - : :    sC}%'45!HC&L36Q*h"&*Z3"3r"   