ó
    T=Œj.-  ã                  ó  • S r SSKJr  SSKrSSKrSSKrSSKJr  SSKJ	r	J
r
  SSKJr   " S S	\5      r\" SS
9SS j5       r\" SS
9SS j5       r\" SS
9SS j5       r\" SS
9SS j5       r\" SS
9SS j5       r\" SS
9SS j5       rS	/rg)zAndroid.é    )ÚannotationsN)Ú	lru_cache)ÚTYPE_CHECKINGÚcasté   )ÚPlatformDirsABCc                  ó4  • \ rS rSrS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 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)!ÚAndroidé   aÖ  Platform directories for Android.

Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_. Directories are typically located
under the app's private storage (``/data/user/<userid>/<packagename>/``).

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

c                óJ   • U R                  [        S[        5       5      S5      $ )ze:returns: data directory tied to the user, e.g. ``/data/user/<userid>/<packagename>/files/<AppName>``ÚstrÚfiles©Ú_append_app_name_and_versionr   Ú_android_folder©Úselfs    Úd/Users/stevendouglas/BidBrain/.venv/lib/python3.13/site-packages/pip/_vendor/platformdirs/android.pyÚuser_data_dirÚAndroid.user_data_dir   ó"   € ð ×0Ñ0´°e¼_Ó=NÓ1OÐQXÓYÐYó    c                ó   • U R                   $ )zA:returns: data directory shared by users, same as `user_data_dir`©r   r   s    r   Úsite_data_dirÚAndroid.site_data_dir   ó   € ð ×!Ñ!Ð!r   c                óJ   • U R                  [        S[        5       5      S5      $ )zn:returns: config directory tied to the user, e.g. ``/data/user/<userid>/<packagename>/shared_prefs/<AppName>``r   Úshared_prefsr   r   s    r   Úuser_config_dirÚAndroid.user_config_dir$   s"   € ð ×0Ñ0´°e¼_Ó=NÓ1OÐQ_Ó`Ð`r   c                ó   • U R                   $ )zE:returns: config directory shared by users, same as `user_config_dir`©r    r   s    r   Úsite_config_dirÚAndroid.site_config_dir)   ó   € ð ×#Ñ#Ð#r   c                óJ   • U R                  [        S[        5       5      S5      $ )zf:returns: cache directory tied to the user, e.g.,``/data/user/<userid>/<packagename>/cache/<AppName>``r   Úcacher   r   s    r   Úuser_cache_dirÚAndroid.user_cache_dir.   r   r   c                ó   • U R                   $ )zC:returns: cache directory shared by users, same as `user_cache_dir`)r)   r   s    r   Úsite_cache_dirÚAndroid.site_cache_dir3   ó   € ð ×"Ñ"Ð"r   c                ó   • U R                   $ )zC:returns: state directory tied to the user, same as `user_data_dir`r   r   s    r   Úuser_state_dirÚAndroid.user_state_dir8   r   r   c                ó   • U R                   $ )zC:returns: state directory shared by users, same as `user_state_dir`)r0   r   s    r   Úsite_state_dirÚAndroid.site_state_dir=   r.   r   c                ó¢   • U R                   nU R                  (       a1  [        R                  R	                  US5      nU R                  U5        U$ )z¨:returns: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it, e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/log``Úlog©r)   ÚopinionÚosÚpathÚjoinÚ_optionally_create_directory©r   r:   s     r   Úuser_log_dirÚAndroid.user_log_dirB   ó=   € ð ×"Ñ"ˆØ�<�<Ü—7‘7—<‘<  eÓ,ˆDØ×-Ñ-¨dÔ3Øˆr   c                ó   • U R                   $ )z?:returns: log directory shared by users, same as `user_log_dir`)r>   r   s    r   Úsite_log_dirÚAndroid.site_log_dirK   ó   € ð × Ñ Ð r   c                ó   • [        5       $ )zU:returns: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``)Ú_android_documents_folderr   s    r   Úuser_documents_dirÚAndroid.user_documents_dirP   ó   € ô )Ó*Ð*r   c                ó   • [        5       $ )zU:returns: downloads directory tied to the user e.g. ``/storage/emulated/0/Downloads``)Ú_android_downloads_folderr   s    r   Úuser_downloads_dirÚAndroid.user_downloads_dirU   rI   r   c                ó   • [        5       $ )zS:returns: pictures directory tied to the user e.g. ``/storage/emulated/0/Pictures``)Ú_android_pictures_folderr   s    r   Úuser_pictures_dirÚAndroid.user_pictures_dirZ   s   € ô (Ó)Ð)r   c                ó   • [        5       $ )zT:returns: videos directory tied to the user e.g. ``/storage/emulated/0/DCIM/Camera``)Ú_android_videos_folderr   s    r   Úuser_videos_dirÚAndroid.user_videos_dir_   s   € ô &Ó'Ð'r   c                ó   • [        5       $ )zM:returns: music directory tied to the user e.g. ``/storage/emulated/0/Music``)Ú_android_music_folderr   s    r   Úuser_music_dirÚAndroid.user_music_dird   s   € ô %Ó&Ð&r   c                ó   • g)zQ:returns: desktop directory tied to the user e.g. ``/storage/emulated/0/Desktop``z/storage/emulated/0/Desktop© r   s    r   Úuser_desktop_dirÚAndroid.user_desktop_diri   s   € ð -r   c                ó   • g)zS:returns: projects directory tied to the user e.g. ``/storage/emulated/0/Projects``z/storage/emulated/0/Projectsr[   r   s    r   Úuser_projects_dirÚAndroid.user_projects_dirn   s   € ð .r   c                ó   • g)zU:returns: public share directory tied to the user e.g. ``/storage/emulated/0/Public``z/storage/emulated/0/Publicr[   r   s    r   Úuser_publicshare_dirÚAndroid.user_publicshare_dirs   s   € ð ,r   c                ó   • g)zU:returns: templates directory tied to the user e.g. ``/storage/emulated/0/Templates``z/storage/emulated/0/Templatesr[   r   s    r   Úuser_templates_dirÚAndroid.user_templates_dirx   s   € ð /r   c                ó   • g)zM:returns: fonts directory tied to the user e.g. ``/storage/emulated/0/fonts``z/storage/emulated/0/fontsr[   r   s    r   Úuser_fonts_dirÚAndroid.user_fonts_dir}   s   € ð +r   c                ó   • U R                   $ )zL:returns: preference directory tied to the user, same as ``user_config_dir``r#   r   s    r   Úuser_preference_dirÚAndroid.user_preference_dir‚   r&   r   c                óh   • [         R                  R                  [        S[	        5       5      SS5      $ )z^:returns: bin directory tied to the user, e.g. ``/data/user/<userid>/<packagename>/files/bin``r   r   Úbin)r9   r:   r;   r   r   r   s    r   Úuser_bin_dirÚAndroid.user_bin_dir‡   s%   € ô �w‰w�|‰|œD ¬Ó(9Ó:¸GÀUÓKÐKr   c                ó   • U R                   $ )z?:returns: bin directory shared by users, same as `user_bin_dir`)ro   r   s    r   Úsite_bin_dirÚAndroid.site_bin_dirŒ   rD   r   c                ó   • U R                   $ )zJ:returns: applications directory tied to the user, same as `user_data_dir`r   r   s    r   Úuser_applications_dirÚAndroid.user_applications_dir‘   r   r   c                ó   • U R                   $ )zQ:returns: applications directory shared by users, same as `user_applications_dir`)ru   r   s    r   Úsite_applications_dirÚAndroid.site_applications_dir–   s   € ð ×)Ñ)Ð)r   c                ó¢   • U R                   nU R                  (       a1  [        R                  R	                  US5      nU R                  U5        U$ )z¬:returns: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it, e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/tmp``Útmpr7   r=   s     r   Úuser_runtime_dirÚAndroid.user_runtime_dir›   r@   r   c                ó   • U R                   $ )zG:returns: runtime directory shared by users, same as `user_runtime_dir`)r|   r   s    r   Úsite_runtime_dirÚAndroid.site_runtime_dir¤   s   € ð ×$Ñ$Ð$r   r[   N©Úreturnr   )"Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úpropertyr   r   r    r$   r)   r,   r0   r3   r>   rB   rG   rL   rP   rT   rX   r\   r_   rb   re   rh   rk   ro   rr   ru   rx   r|   r   Ú__static_attributes__r[   r   r   r
   r
      s+  † ñ	ð óZó ðZð ó"ó ð"ð óaó ðað ó$ó ð$ð óZó ðZð ó#ó ð#ð ó"ó ð"ð ó#ó ð#ð óó ðð ó!ó ð!ð ó+ó ð+ð ó+ó ð+ð ó*ó ð*ð ó(ó ð(ð ó'ó ð'ð ó-ó ð-ð ó.ó ð.ð ó,ó ð,ð ó/ó ð/ð ó+ó ð+ð ó$ó ð$ð óLó ðLð ó!ó ð!ð ó"ó ð"ð ó*ó ð*ð óó ðð ó%ó ó%r   r
   )Úmaxsizec                 óú  • Sn [         (       dM   SSKJn  [        SUR	                  5       5      nUR                  5       R                  5       R                  5       n U c;   SSK	J
n  U" S5      nUR                  5       R                  5       R                  5       n U c[  [        R                  " S5      n[        R                   H/  nUR                  U5      (       d  M  UR!                  S5      S   n   O   Sn U c\  [        R                  " S5      n[        R                   H0  nUR                  U5      (       d  M  UR!                  S5      S   n   U $    Sn U $ ! [         a    Sn  GNf = f! [         a    Sn  Nàf = f)	zF:returns: base folder for the Android OS or None if it cannot be foundNr   )Ú	mActivityúandroid.content.Context©Ú	autoclassz /data/(data|user/\d+)/(.+)/filesz/filesz7/mnt/expand/[a-fA-F0-9-]{36}/(data|user/\d+)/(.+)/files)r   ÚandroidrŒ   r   ÚgetApplicationContextÚgetFilesDirÚgetParentFileÚgetAbsolutePathÚ	ExceptionÚjniusr�   ÚreÚcompileÚsysr:   ÚmatchÚsplit)ÚresultrŒ   Úcontextr�   Úpatternr:   s         r   r   r   ª   sd  € ð €F÷ Š=ð	å)äÐ4°i×6UÑ6UÓ6WÓXˆGØ×(Ñ(Ó*×8Ñ8Ó:×JÑJÓLˆFð �~ð	õ (áÐ 9Ó:ˆGØ×(Ñ(Ó*×8Ñ8Ó:×JÑJÓLˆFð �~ô —*’*Ð@ÓAˆÜ—H”HˆDØ�}‰}˜T×"Ó"ØŸ™ HÓ-¨aÑ0�Ùñ ð
 ˆFØ�~ô —*’*ÐWÓXˆÜ—H”HˆDØ�}‰}˜T×"Ó"ØŸ™ HÓ-¨aÑ0�Øð €Mñ ð
 ˆFØ€MøôA ó 	Ø‹Fð	ûô ó 	ØŠFð	ús$   �AE Á:E+ ÅE(Å'E(Å+E:Å9E:c                 ó¬   •  SSK Jn   U " S5      nU " S5      nUR                  UR                  5      R	                  5       nU$ ! [
         a    Sn U$ f = f)z-:returns: documents folder for the Android OSr   rŽ   r�   úandroid.os.Environmentz/storage/emulated/0/Documents)r–   r�   ÚgetExternalFilesDirÚDIRECTORY_DOCUMENTSr”   r•   )r�   r�   ÚenvironmentÚdocuments_dirs       r   rF   rF   Ú   óc   € ð8Ý#áÐ5Ó6ˆÙÐ 8Ó9ˆØ$×8Ñ8¸×9XÑ9XÓY×iÑiÓkˆð Ðøô ó 8Ø7‰àÐð8úó   ‚?A ÁAÁAc                 ó¬   •  SSK Jn   U " S5      nU " S5      nUR                  UR                  5      R	                  5       nU$ ! [
         a    Sn U$ f = f)z-:returns: downloads folder for the Android OSr   rŽ   r�   r    z/storage/emulated/0/Downloads)r–   r�   r¡   ÚDIRECTORY_DOWNLOADSr”   r•   )r�   r�   r£   Údownloads_dirs       r   rK   rK   ê   r¥   r¦   c                 ó¬   •  SSK Jn   U " S5      nU " S5      nUR                  UR                  5      R	                  5       nU$ ! [
         a    Sn U$ f = f)z,:returns: pictures folder for the Android OSr   rŽ   r�   r    z/storage/emulated/0/Pictures)r–   r�   r¡   ÚDIRECTORY_PICTURESr”   r•   )r�   r�   r£   Úpictures_dirs       r   rO   rO   ú   sc   € ð6Ý#áÐ5Ó6ˆÙÐ 8Ó9ˆØ#×7Ñ7¸×8VÑ8VÓW×gÑgÓiˆð Ðøô ó 6Ø5‰àÐð6úr¦   c                 ó¬   •  SSK Jn   U " S5      nU " S5      nUR                  UR                  5      R	                  5       nU$ ! [
         a    Sn U$ f = f)z*:returns: videos folder for the Android OSr   rŽ   r�   r    z/storage/emulated/0/DCIM/Camera)r–   r�   r¡   ÚDIRECTORY_DCIMr”   r•   )r�   r�   r£   Ú
videos_dirs       r   rS   rS   
  sc   € ð7Ý#áÐ5Ó6ˆÙÐ 8Ó9ˆØ!×5Ñ5°k×6PÑ6PÓQ×aÑaÓcˆ
ð Ðøô ó 7Ø6‰
àÐð7úr¦   c                 ó¬   •  SSK Jn   U " S5      nU " S5      nUR                  UR                  5      R	                  5       nU$ ! [
         a    Sn U$ f = f)z):returns: music folder for the Android OSr   rŽ   r�   r    z/storage/emulated/0/Music)r–   r�   r¡   ÚDIRECTORY_MUSICr”   r•   )r�   r�   r£   Ú	music_dirs       r   rW   rW     sc   € ð0Ý#áÐ5Ó6ˆÙÐ 8Ó9ˆØ ×4Ñ4°[×5PÑ5PÓQ×aÑaÓcˆ	ð Ðøô ó 0Ø/‰	àÐð0úr¦   )r‚   z
str | Noner�   )r‡   Ú
__future__r   r9   r—   r™   Ú	functoolsr   Útypingr   r   Úapir   r
   r   rF   rK   rO   rS   rW   Ú__all__r[   r   r   Ú<module>r¸      sÏ   ðÙ å "ã 	Û 	Û 
Ý ß &å  ôY%ˆoô Y%ñx �1Ñó,ó ð,ñ^ �1Ñóó ðñ �1Ñóó ðñ �1Ñóó ðñ �1Ñóó ðñ �1Ñóó ðð  ð�r   