Ë
    ��h�'  ã                  óÄ   — d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl	m
Z
 erddlmZ  G d	„ d
e
«      Zdd„Zdd„Zdd„Zdd„Zdd„Z  ed¬«       e«       «      Zd
gZy)zWindows.é    )ÚannotationsN)Ú	lru_cache)ÚTYPE_CHECKINGé   )ÚPlatformDirsABC)ÚCallablec                  ó>  — e Zd ZdZedd„«       Zddœdd„Zedd„«       Zedd„«       Zedd„«       Z	edd	„«       Z
edd
„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zy)ÚWindowsað  
    `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                ó”   — | j                   rdnd}t        j                  j                  t	        |«      «      }| j                  |«      S )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      ú^/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/pip/_vendor/platformdirs/windows.pyÚuser_data_dirzWindows.user_data_dir   s<   € ð $(§<¢<‘Ð5JˆÜ�w‰w×Ñ¤¨uÓ 5Ó6ˆØ×!Ñ! $Ó'Ð'ó    N©Úopinion_valuec               ó¸  — g }| j                   rš| j                  dur+| j                  xs | j                   }|j                  |«       |j                  | j                   «       |�| j                  r|j                  |«       | j                  r|j                  | j                  «       t        j                  j                  |g|¢­Ž }| j                  |«       |S )NF)	ÚappnameÚ	appauthorÚappendÚopinionÚversionr   r   ÚjoinÚ_optionally_create_directory)r   r   r   ÚparamsÚauthors        r   r   zWindows._append_parts&   s¡   € ØˆØ�<Š<Ø�~‰~ UÑ*ØŸ™Ò7¨4¯<©<�Ø—‘˜fÔ%Ø�M‰M˜$Ÿ,™,Ô'ØÐ(¨T¯\ª\Ø—‘˜mÔ,Ø�|Š|Ø—‘˜dŸl™lÔ+Ü�w‰w�|‰|˜DÐ* 6Ò*ˆØ×)Ñ)¨$Ô/Øˆr   c                ót   — t         j                  j                  t        d«      «      }| j	                  |«      S )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_dirzWindows.site_data_dir5   s/   € ô �w‰w×Ñ¤Ð/EÓ FÓGˆØ×!Ñ! $Ó'Ð'r   c                ó   — | j                   S )zC:return: config directory tied to the user, same as `user_data_dir`©r   ©r   s    r   Úuser_config_dirzWindows.user_config_dir;   ó   € ð ×!Ñ!Ð!r   c                ó   — | j                   S )zF:return: config directory shared by the users, same as `site_data_dir`)r)   r,   s    r   Úsite_config_dirzWindows.site_config_dir@   r.   r   c                óx   — t         j                  j                  t        d«      «      }| j	                  |d¬«      S )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_dirzWindows.user_cache_dirE   s4   € ô �w‰w×Ñ¤Ð/DÓ EÓFˆØ×!Ñ! $°gÐ!Ó>Ð>r   c                óx   — t         j                  j                  t        d«      «      }| j	                  |d¬«      S )zd:return: cache directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname\Cache\$version``r&   r2   r   r'   r(   s     r   Úsite_cache_dirzWindows.site_cache_dirN   s4   € ô �w‰w×Ñ¤Ð/EÓ FÓGˆØ×!Ñ! $°gÐ!Ó>Ð>r   c                ó   — | j                   S )zB:return: state directory tied to the user, same as `user_data_dir`r+   r,   s    r   Úuser_state_dirzWindows.user_state_dirT   r.   r   c                ó˜   — | j                   }| j                  r1t        j                  j	                  |d«      }| j                  |«       |S )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_dirzWindows.user_log_dirY   s=   € ð ×!Ñ!ˆØ�<Š<Ü—7‘7—<‘<  fÓ-ˆDØ×-Ñ-¨dÔ3Øˆr   c                óR   — t         j                  j                  t        d«      «      S )zN:return: documents directory tied to the user e.g. ``%USERPROFILE%\Documents``ÚCSIDL_PERSONAL©r   r   r   r   r,   s    r   Úuser_documents_dirzWindows.user_documents_dirb   s   € ô �w‰w×Ñ¤Ð/?Ó @ÓAÐAr   c                óR   — t         j                  j                  t        d«      «      S )zN:return: downloads directory tied to the user e.g. ``%USERPROFILE%\Downloads``ÚCSIDL_DOWNLOADSr=   r,   s    r   Úuser_downloads_dirzWindows.user_downloads_dirg   s   € ô �w‰w×Ñ¤Ð/@Ó AÓBÐBr   c                óR   — t         j                  j                  t        d«      «      S )zL:return: pictures directory tied to the user e.g. ``%USERPROFILE%\Pictures``ÚCSIDL_MYPICTURESr=   r,   s    r   Úuser_pictures_dirzWindows.user_pictures_dirl   s   € ô �w‰w×Ñ¤Ð/AÓ BÓCÐCr   c                óR   — t         j                  j                  t        d«      «      S )zH:return: videos directory tied to the user e.g. ``%USERPROFILE%\Videos``ÚCSIDL_MYVIDEOr=   r,   s    r   Úuser_videos_dirzWindows.user_videos_dirq   ó   € ô �w‰w×Ñ¤¨Ó ?Ó@Ð@r   c                óR   — t         j                  j                  t        d«      «      S )zF:return: music directory tied to the user e.g. ``%USERPROFILE%\Music``ÚCSIDL_MYMUSICr=   r,   s    r   Úuser_music_dirzWindows.user_music_dirv   rH   r   c                óR   — t         j                  j                  t        d«      «      S )zK:return: desktop directory tied to the user, e.g. ``%USERPROFILE%\Desktop``ÚCSIDL_DESKTOPDIRECTORYr=   r,   s    r   Úuser_desktop_dirzWindows.user_desktop_dir{   s   € ô �w‰w×Ñ¤Ð/GÓ HÓIÐIr   c                ó°   — t         j                  j                  t         j                  j                  t	        d«      d«      «      }| j                  |«      S )z…
        :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_dirzWindows.user_runtime_dir€   s?   € ô �w‰w×Ñ¤§¡§¡¬^Ð<QÓ-RÐTZÓ [Ó\ˆØ×!Ñ! $Ó'Ð'r   c                ó   — | j                   S )zF:return: runtime directory shared by users, same as `user_runtime_dir`)rQ   r,   s    r   Úsite_runtime_dirzWindows.site_runtime_dir‰   s   € ð ×$Ñ$Ð$r   )ÚreturnÚstr)r   rU   r   ú
str | NonerT   rU   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r   r)   r-   r0   r3   r5   r7   r:   r>   rA   rD   rG   rK   rN   rQ   rS   © r   r   r
   r
      s_  „ ñð ò(ó ð(ð GKõ ð ò(ó ð(ð
 ò"ó ð"ð ò"ó ð"ð ò?ó ð?ð ò?ó ð?ð
 ò"ó ð"ð òó ðð òBó ðBð òCó ðCð òDó ðDð òAó ðAð òAó ðAð òJó ðJð ò(ó ð(ð ò%ó ñ%r   r
   c                óÔ   — t        | «      }|�|S ddddœj                  | «      }|€d| › �}t        |«      ‚t        j                  j                  |«      }|€d|› �}t        |«      ‚|S )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_varsrj   �   s‡   € ä5°jÓA€FØÐØˆð #Ø 1Ø-ñ÷ 
�cˆ*ƒoð	 ð
 ÐØ$ Z LÐ1ˆÜ˜‹oÐÜ�Z‰Z�^‰^˜LÓ)€FØ€~Ø,¨\¨NÐ;ˆÜ˜‹oÐØ€Mr   c                óB  — | dk(  rNt         j                  j                  t         j                  j                  t         j                  d   «      d«      S | dk(  rNt         j                  j                  t         j                  j                  t         j                  d   «      d«      S | dk(  rNt         j                  j                  t         j                  j                  t         j                  d   «      d«      S | dk(  rNt         j                  j                  t         j                  j                  t         j                  d   «      d	«      S | d
k(  rNt         j                  j                  t         j                  j                  t         j                  d   «      d«      S y)zMGet a folder for a CSIDL name that does not exist as an environment variable.r<   ÚUSERPROFILEÚ	Documentsr@   Ú	DownloadsrC   ÚPicturesrF   ÚVideosrJ   ÚMusicN)r   r   r!   r   re   )rf   s    r   rb   rb   ¤   s  € àÐ%Ò%Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓUÐUàÐ&Ò&Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓUÐUàÐ'Ò'Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓTÐTà�_Ò$Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓRÐRà�_Ò$Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓQÐQØr   c           	     ó  — ddddddddd	œj                  | «      }|€d| › �}t        |«      ‚t        j                  dk7  rt        ‚dd
l}|j                  |j                  d«      }|j                  ||«      \  }}t        |«      S )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   r<   r@   rC   rF   rJ   Nra   Úwin32r   z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)
rc   rd   ÚsysÚplatformÚNotImplementedErrorÚwinregÚOpenKeyÚHKEY_CURRENT_USERÚQueryValueExrU   )rf   Úshell_folder_nameri   ry   ÚkeyÚ	directoryÚ_s          r   Úget_win_folder_from_registryr�   ·   sœ   € ð #Ø 0Ø.Ø$ØCØ)Ø#Ø#ñ	÷ 
�cˆ*ƒoð ð Ð Ø$ Z LÐ1ˆÜ˜‹oÐÜ
‡|�|�wÒÜ!Ð!Ûà
�.‰.˜×1Ñ1Ð3vÓ
w€CØ×&Ñ& sÐ,=Ó>�L€IˆqÜˆy‹>Ðr   c           
     óê  — ddl }ddddddd	d
ddœ	j                  | «      }|€d| › �}t        |«      ‚|j                  d«      }t	        |d«      }|j
                  j                  d|dd|«       t        d„ |D «       «      r:|j                  d«      }|j                  j                  |j                  |d«      r|}| dk(  r*t        j                  j                  |j                  d«      S |j                  S )zGet folder with ctypes.r   Né   é#   é   é   é'   é   é   é(   é   )	r   r&   r   r<   rC   rF   rJ   r@   rM   ra   i   Úwindllc              3  ó8   K  — | ]  }t        |«      d kD  –— Œ y­w)éÿ   N)Úord)Ú.0Úcs     r   ú	<genexpr>z,get_win_folder_via_ctypes.<locals>.<genexpr>ñ   s   è ø€ Ò
%˜AŒ3ˆq‹6�C�<Ñ
%ùs   ‚r@   rn   )Úctypesrc   rd   Úcreate_unicode_bufferÚgetattrÚshell32ÚSHGetFolderPathWÚanyÚkernel32ÚGetShortPathNameWÚvaluer   r   r!   )rf   r“   Úcsidl_constri   ÚbufrŒ   Úbuf2s          r   Úget_win_folder_via_ctypesrŸ   Õ   sø   € ó ð Ø "Ø!ØØØØØØ"$ñ
÷ 
�cˆ*ƒoð ð ÐØ$ Z LÐ1ˆÜ˜‹oÐà
×
&Ñ
& tÓ
,€CÜ�V˜XÓ&€FØ
‡N�N×#Ñ# D¨+°t¸QÀÔDô Ñ
% Ô
%Ô%Ø×+Ñ+¨DÓ1ˆØ�?‰?×,Ñ,¨S¯Y©Y¸¸dÔCØˆCàÐ&Ò&Ü�w‰w�|‰|˜CŸI™I {Ó3Ð3à�9‰9Ðr   c                 óŽ   — 	 dd l } t        | d«      rt        S 	 dd l}t
        S # t        $ r Y Œw xY w# t        $ r	 t        cY S w xY w)Nr   rŒ   )r“   ÚhasattrrŸ   ÚImportErrorry   r�   rj   )r“   ry   s     r   Ú_pick_get_win_folderr£   ü   sV   € ð-Ûô �6˜8Ô$Ü,Ð,ð,Ûô ,Ð+øô ò Ùðûô ò ,Ü+Ò+ð,ús   ‚# ™2 £	/®/²AÁA)Úmaxsize)rf   rU   rT   rU   )rf   rU   rT   rV   )rT   zCallable[[str], str])rZ   Ú
__future__r   r   rv   Ú	functoolsr   Útypingr   Úapir   Úcollections.abcr   r
   rj   rb   r�   rŸ   r£   r   Ú__all__r\   r   r   ú<module>r«      sl   ðÙ å "ã 	Û 
Ý Ý  å  áÝ(ô|%ˆoô |%ó~ó*ó&ó<$óN,ð  )‘ 4Ô(Ñ)=Ó)?Ó@€ð ð�r   