ó
    �®žjõ  ã                  ó¼   • S r SSKJr  SSKrSSKJrJr  SSKJ	r	  SSK
JrJrJr  SSKJr  \R                    " S S	5      5       r\R                    " S
 S5      5       rg)aF  A "folder" in Microsoft Compound File Binary (CFB) format.

The CFB/OLE file format encloses a filesystem, to a first appoximation, much like a Zip
archive does. In this format, a "storage" corresponds to a directory and a "stream"
corresponds to a file. A storage can contain both streams and other storages.

Each MSG file has a "root" storage, represented in this package by `MessageStorage`.
Each attachment and recipient has their own storage in the root, with a pre-defined
name, and there are other top-level objects than can appear in a MSG file that get their
own storage.
é    )ÚannotationsN)ÚIteratorÚMapping)Ú	OleFileIO)ÚSTGTY_STORAGEÚSTGTY_STREAMÚOleDirectoryEntry)Úlazypropertyc                  óÄ   • \ rS rSr% SrS\S'   S\S'   S\S'   SS	 jr\ S       SS jj5       rSS jr	SS jr
\SS j5       r\SS j5       rSS jr\SS j5       rSrg
)ÚStorageé   z'Container for streams and sub-storages.ÚstrÚpathztuple[Stream, ...]Ústreamsztuple[Storage, ...]Ústoragesc                óŒ   • S[        U R                  5       S[        U R                  5       S[        U R                  5       S3$ )NzStorage(path=ú, z
 streams, z
 storages))Úreprr   Úlenr   r   ©Úselfs    ÚJ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/oxmsg/storage.pyÚ__repr__ÚStorage.__repr__    sC   € àœD §¡›OÐ,¨B¬s°4·<±<Ó/@Ð.Að BÜ�D—M‘MÓ"Ð# :ð/ð	
ó    Nc                ó²   ^ ^^• U(       a  UOTR                   nSS jn[        U" TUT5      5      n[        U UU4S jUR                   5       5      nT " TXVS9$ )zPReturn a Storage loaded from `node` and containing its streams and sub-storages.c              3  ó  #   • S UR                    5        H_  nU(       a  U SUR                   3OUR                  nU R                  U5       nUR                  5       nSSS5        [	        UW5      v •  Ma     g! , (       d  f       N!= f7f)z4Generate `Stream` object for each stream in `nodes`.c              3  óP   #   • U  H  oR                   [        :X  d  M  Uv •  M     g 7f)N)Ú
entry_typer   )Ú.0Úks     r   Ú	<genexpr>Ú:Storage.from_ole.<locals>._iter_streams.<locals>.<genexpr>0   s   é € ÐUª9 a¿¹ÌÑ8T§¡ª9ùs   ‚&�	&Ú/N)ÚkidsÚnameÚ
openstreamÚreadÚStream)ÚoleÚnodeÚprefixÚstream_noder   ÚfÚbytes_s          r   Ú_iter_streamsÚ'Storage.from_ole.<locals>._iter_streams.   sk   é € áU¨4¯9ª9ÖU�Þ9?˜&˜  ;×#3Ñ#3Ð"4Ñ5À[×EUÑEU�Ø—^‘^ DÔ)¨QØŸV™V›X�F÷ *ä˜T 6Ó*Ô*ò	  Vç)Õ)üs   ‚ABÁA:ÁBÁ:
B	ÂBc              3  óº   >#   • U  HP  nUR                   [        :X  d  M  TR                  TUT(       a  T S UR                   3OUR                  5      v •  MR     g7f)r$   N)r   r   Úfrom_oler&   )r    r!   Úclsr*   r,   s     €€€r   r"   Ú#Storage.from_ole.<locals>.<genexpr>7   sN   øé € ð 
â�Ø�|‰|œ}Ñ,ó MˆC�L‰L˜˜a¾ F 8¨1¨Q¯V©V¨HÑ!5ÀQÇVÁV×LÐLÚùs
   ƒAŸ<A)r   r   r   )r*   r   r+   r	   r,   r   ÚreturnzIterator[Stream])ÚrootÚtupler%   )r4   r*   r+   r,   r0   r   Úsub_storagess   `` `   r   r3   ÚStorage.from_ole&   sV   ú€ ö ‰t §¡ˆô	+ô ™ c¨4°Ó8Ó9ˆÜö 
à—Y’Yó
ó 
ˆñ
 ˜¨ÑGÐGr   c              #  ó~   #   • U R                    H)  nUR                  R                  S5      (       d  M%  Uv •  M+     g7f)zDGenerate storage object specific to each attachment in this message.z__attach_version1.0_#N©r   r&   Ú
startswith©r   Úss     r   Úiter_attachment_storagesÚ Storage.iter_attachment_storages>   s.   é € à—”ˆAØ�v‰v× Ñ Ð!8×9Ó9Ø”ò ùó   ‚.=´	=c              #  ó~   #   • U R                    H)  nUR                  R                  S5      (       d  M%  Uv •  M+     g7f)zBGenerate storage object specific to each recipent in this message.z__recip_version1.0_#Nr<   r>   s     r   Úiter_recipient_storagesÚStorage.iter_recipient_storagesD   s.   é € à—”ˆAØ�v‰v× Ñ Ð!7×8Ó8Ø”ò ùrB   c                ó>   • U R                   R                  S5      S   $ )z:The "directory-name" of this storage, with no path-prefix.r$   éÿÿÿÿ©r   Úsplitr   s    r   r&   ÚStorage.nameJ   ó   € ð �y‰y�‰˜sÓ# BÑ'Ð'r   c                ó4   • U R                   S   R                  $ )zDThe bytes of the one-and-only-one properties stream in this storage.z__properties_version1.0©Ú_streams_by_namer/   r   s    r   Úproperties_stream_bytesÚStorage.properties_stream_bytesO   s   € ð ×$Ñ$Ð%>Ñ?×FÑFÐFr   c                óB   • U R                   SUS US 3   R                  $ )zCRead variable-length property bytes from the stream it's stored in.z__substg1.0_Ú04XrM   )r   ÚpidÚptyps      r   Úproperty_stream_bytesÚStorage.property_stream_bytesU   s*   € ð
 ×$Ñ$ |°C¸°9¸TÀ#¸JÐ%GÑH×OÑOÐOr   c                óZ   • U R                    Vs0 s H  oR                  U_M     sn$ s  snf )z*dict semantics on streams of this storage.)r   r&   r>   s     r   rN   ÚStorage._streams_by_name\   s&   € ð $(§<¢<Ó0¢<˜a—‘˜’	¡<Ñ0Ð0ùÒ0s   �(© ©r6   r   )NÚ )r*   r   r+   zOleDirectoryEntry | Noner,   r   r6   r   )r6   zIterator[Storage])r6   Úbytes)rS   ÚintrT   r]   r6   r\   )r6   zMapping[str, Stream])Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r   Úclassmethodr3   r@   rD   r
   r&   rO   rU   rN   Ú__static_attributes__rY   r   r   r   r      s¦   ‡ á1à
ƒIØÓØ!Ó!ô
ð àRTðHØðHØ#;ðHØLOðHà	ôHó ðHô.ôð ó(ó ð(ð óGó ðGô
Pð ó1ó ó1r   r   c                  óL   • \ rS rSr% SrS\S'   S\S'   SS jr\SS j5       rS	r	g
)r)   éb   z;Bytes of a property of a top-level object in an OXMSG file.r   r   r\   r/   c                ób   • S[        U R                  5       S[        U R                  5      S S3$ )NzStream(path=r   Ú,z bytes))r   r   r   r/   r   s    r   r   ÚStream.__repr__i   s,   € Øœd 4§9¡9›oÐ.¨b´°T·[±[Ó1AÀ!Ð0DÀGÐLÐLr   c                ó>   • U R                   R                  S5      S   $ )z3The "filename" of this stream, with no path-prefix.r$   rG   rH   r   s    r   r&   ÚStream.namel   rK   r   rY   NrZ   )
r^   r_   r`   ra   rb   rc   r   r
   r&   re   rY   r   r   r)   r)   b   s)   ‡ áEà
ƒIØƒMôMð ó(ó ó(r   r)   )rb   Ú
__future__r   ÚdataclassesÚdcÚtypingr   r   Úolefiler   Úolefile.olefiler   r   r	   Ú
oxmsg.utilr
   Ú	dataclassr   r)   rY   r   r   Ú<module>ru      s_   ðñ
õ #ã ß $å ß JÑ Jå #ð ‡�÷F1ð F1ó ðF1ðR ‡�÷(ð (ó ñ(r   