
    q"h'                        S r SSKJr  SSKrSSKrSSKJr  SSKJr  SSK	J
r
  \(       a  SSKJr   " S	 S
\
5      rSS jrSS jrSS jrSS jrSS jr\" SS9" \" 5       5      rS
/rg)zWindows.    )annotationsN)	lru_cache)TYPE_CHECKING   )PlatformDirsABC)Callablec                  j   \ rS rSrSr\SS j5       rSS.SS jjr\SS j5       r\SS j5       r	\SS	 j5       r
\SS
 j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       rSrg)Windows   a  
`MSDN on where to store app data files <https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid>`_.

Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`, `appauthor
<platformdirs.api.PlatformDirsABC.appauthor>`, `version <platformdirs.api.PlatformDirsABC.version>`, `roaming
<platformdirs.api.PlatformDirsABC.roaming>`, `opinion <platformdirs.api.PlatformDirsABC.opinion>`, `ensure_exists
<platformdirs.api.PlatformDirsABC.ensure_exists>`.

c                    U R                   (       a  SOSn[        R                  R                  [	        U5      5      nU R                  U5      $ )z
:return: data directory tied to the user, e.g.
 ``%USERPROFILE%\AppData\Local\$appauthor\$appname`` (not roaming) or
 ``%USERPROFILE%\AppData\Roaming\$appauthor\$appname`` (roaming)
CSIDL_APPDATACSIDL_LOCAL_APPDATA)roamingospathnormpathget_win_folder_append_parts)selfconstr   s      R/var/www/html/env/lib/python3.13/site-packages/pip/_vendor/platformdirs/windows.pyuser_data_dirWindows.user_data_dir   s<     $(<<5Jwwu 56!!$''    Nopinion_valuec                  / nU R                   (       a  U R                  SLa0  U R                  =(       d    U R                   nUR                  U5        UR                  U R                   5        Ub"  U R                  (       a  UR                  U5        U R                  (       a  UR                  U R                  5        [
        R                  R                  " U/UQ76 nU R                  U5        U$ )NF)	appname	appauthorappendopinionversionr   r   join_optionally_create_directory)r   r   r   paramsauthors        r   r   Windows._append_parts&   s    <<~~U*74<<f%MM$,,'(T\\m,||dll+ww||D*6*))$/r   c                t    [         R                  R                  [        S5      5      nU R	                  U5      $ )zT:return: data directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname``CSIDL_COMMON_APPDATAr   r   r   r   r   r   r   s     r   site_data_dirWindows.site_data_dir5   s/     ww/E FG!!$''r   c                    U R                   $ )zC:return: config directory tied to the user, same as `user_data_dir`r   r   s    r   user_config_dirWindows.user_config_dir;        !!!r   c                    U R                   $ )zF:return: config directory shared by the users, same as `site_data_dir`)r,   r0   s    r   site_config_dirWindows.site_config_dir@   r3   r   c                r    [         R                  R                  [        S5      5      nU R	                  USS9$ )z
:return: cache directory tied to the user (if opinionated with ``Cache`` folder within ``$appname``) e.g.
 ``%USERPROFILE%\AppData\Local\$appauthor\$appname\Cache\$version``
r   Cacher   r*   r+   s     r   user_cache_dirWindows.user_cache_dirE   s4     ww/D EF!!$g!>>r   c                r    [         R                  R                  [        S5      5      nU R	                  USS9$ )zd:return: cache directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname\Cache\$version``r)   r8   r   r*   r+   s     r   site_cache_dirWindows.site_cache_dirN   s4     ww/E FG!!$g!>>r   c                    U R                   $ )zB:return: state directory tied to the user, same as `user_data_dir`r/   r0   s    r   user_state_dirWindows.user_state_dirT   r3   r   c                    U R                   nU R                  (       a1  [        R                  R	                  US5      nU R                  U5        U$ )zg:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in itLogs)r   r!   r   r   r#   r$   r+   s     r   user_log_dirWindows.user_log_dirY   s=     !!<<77<<f-D--d3r   c                R    [         R                  R                  [        S5      5      $ )zN:return: documents directory tied to the user e.g. ``%USERPROFILE%\Documents``CSIDL_PERSONALr   r   r   r   r0   s    r   user_documents_dirWindows.user_documents_dirb   s     ww/? @AAr   c                R    [         R                  R                  [        S5      5      $ )zN:return: downloads directory tied to the user e.g. ``%USERPROFILE%\Downloads``CSIDL_DOWNLOADSrG   r0   s    r   user_downloads_dirWindows.user_downloads_dirg   s     ww/@ ABBr   c                R    [         R                  R                  [        S5      5      $ )zL:return: pictures directory tied to the user e.g. ``%USERPROFILE%\Pictures``CSIDL_MYPICTURESrG   r0   s    r   user_pictures_dirWindows.user_pictures_dirl   s     ww/A BCCr   c                R    [         R                  R                  [        S5      5      $ )zH:return: videos directory tied to the user e.g. ``%USERPROFILE%\Videos``CSIDL_MYVIDEOrG   r0   s    r   user_videos_dirWindows.user_videos_dirq        ww ?@@r   c                R    [         R                  R                  [        S5      5      $ )zF:return: music directory tied to the user e.g. ``%USERPROFILE%\Music``CSIDL_MYMUSICrG   r0   s    r   user_music_dirWindows.user_music_dirv   rV   r   c                R    [         R                  R                  [        S5      5      $ )zK:return: desktop directory tied to the user, e.g. ``%USERPROFILE%\Desktop``CSIDL_DESKTOPDIRECTORYrG   r0   s    r   user_desktop_dirWindows.user_desktop_dir{   s     ww/G HIIr   c                    [         R                  R                  [         R                  R                  [	        S5      S5      5      nU R                  U5      $ )zm
:return: runtime directory tied to the user, e.g.
 ``%USERPROFILE%\AppData\Local\Temp\$appauthor\$appname``
r   Temp)r   r   r   r#   r   r   r+   s     r   user_runtime_dirWindows.user_runtime_dir   s?     ww^<Q-RTZ [\!!$''r   c                    U R                   $ )zF:return: runtime directory shared by users, same as `user_runtime_dir`)ra   r0   s    r   site_runtime_dirWindows.site_runtime_dir   s     $$$r    )returnstr)r   rh   r   
str | Nonerg   rh   )__name__
__module____qualname____firstlineno____doc__propertyr   r   r,   r1   r5   r9   r<   r?   rC   rH   rL   rP   rT   rY   r]   ra   rd   __static_attributes__rf   r   r   r
   r
      s_    ( ( GK  ( (
 " " " " ? ? ? ?
 " "   B B C C D D A A A A J J ( ( % %r   r
   c                    [        U 5      nUb  U$ SSSS.R                  U 5      nUc  SU  3n[        U5      e[        R                  R                  U5      nUc  SU 3n[        U5      eU$ )z&Get folder from environment variables.APPDATAALLUSERSPROFILELOCALAPPDATA)r   r)   r   Unknown CSIDL name: zUnset environment variable: )(get_win_folder_if_csidl_name_not_env_varget
ValueErrorr   environ)
csidl_nameresultenv_var_namemsgs       r   get_win_folder_from_env_varsr~      s    5jAF # 1- 
c*o	 
 $ZL1oZZ^^L)F~,\N;oMr   c                L   U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S	5      $ U S
:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ g)zMGet a folder for a CSIDL name that does not exist as an environment variable.rF   USERPROFILE	DocumentsrK   	DownloadsrO   PicturesrS   VideosrX   MusicN)r   r   r#   r   ry   )rz   s    r   rv   rv      s   %%ww||BGG,,RZZ-FGUU&&ww||BGG,,RZZ-FGUU''ww||BGG,,RZZ-FGTT_$ww||BGG,,RZZ-FGRR_$ww||BGG,,RZZ-FGQQr   c           	        SSSSSSSSS	.R                  U 5      nUc  SU  3n[        U5      e[        R                  S:w  a  [        eSS
KnUR                  UR                  S5      nUR                  XA5      u  pV[        U5      $ )z
Get folder from the registry.

This is a fallback technique at best. I'm not sure if using the registry for these guarantees us the correct answer
for all CSIDL_* names.

AppDatazCommon AppDatazLocal AppDataPersonalz&{374DE290-123F-4565-9164-39C4925E467B}zMy PictureszMy VideozMy Music)r   r)   r   rF   rK   rO   rS   rX   Nru   win32r   z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)
rw   rx   sysplatformNotImplementedErrorwinregOpenKeyHKEY_CURRENT_USERQueryValueExrh   )rz   shell_folder_namer}   r   key	directory_s          r   get_win_folder_from_registryr      s     # 0.$C)##	 
c*o   $ZL1o
||w!!
..113v
wC&&s>LIy>r   c           
        SSK nSSSSSSS	S
SS.	R                  U 5      nUc  SU  3n[        U5      eUR                  S5      n[	        US5      nUR
                  R                  SUSSU5        [        S U 5       5      (       a?  UR                  S5      nUR                  R                  UR                  US5      (       a  UnU S:X  a*  [        R                  R                  UR                  S5      $ UR                  $ )zGet folder with ctypes.r   N   #         '         (   r   )	r   r)   r   rF   rO   rS   rX   rK   r\   ru   i   windllc              3  >   #    U  H  n[        U5      S :  v   M     g7f)   N)ord).0cs     r   	<genexpr>,get_win_folder_via_ctypes.<locals>.<genexpr>   s     
%A3q6C<s   rK   r   )ctypesrw   rx   create_unicode_buffergetattrshell32SHGetFolderPathWanykernel32GetShortPathNameWvaluer   r   r#   )rz   r   csidl_constr}   bufr   buf2s          r   get_win_folder_via_ctypesr      s       "!"$
 
c*o  $ZL1o

&
&t
,CVX&F
NN##D+tQD 
%
%%%++D1??,,SYYdCCC&&ww||CII{3399r   c                      SS K n [        U S5      (       a  [        $   SS Kn[
        $ ! [         a     Nf = f! [         a	    [        s $ f = f)Nr   r   )r   hasattrr   ImportErrorr   r   r~   )r   r   s     r   _pick_get_win_folderr      s^    - 68$$,, %, ,+    ,++,s   ) 9 
66AA)maxsize)rz   rh   rg   rh   )rz   rh   rg   ri   )rg   zCallable[[str], str])rn   
__future__r   r   r   	functoolsr   typingr   apir   collections.abcr   r
   r~   rv   r   r   r   r   __all__rf   r   r   <module>r      sj     " 	 
     (|%o |%~*&<$N,  4()=)?@ r   