+
    ¿ÌjZû  ã                   óÈ  € R t Rt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt]P                  P                  ]P                  P                  ]P                  P                  ]4      4      4      t]P                  P                  ]P                  P                  ]R4      4      t]]P                  9   g   ]P                  P!                  ^ ]4       ^ RIt]P$                  ^,           3R lt]! R4      tR tRtRtR	],          t ! R
 R]4      tR tR tR tR t ! R R]4      t  ! R R]4      t! ! R R]!4      t" ! R R]!4      t# ! R R]!4      t$ ! R R]!4      t% ! R R]4      t& ! R R]!4      t' ! R  R!]!4      t( ! R" R#]!4      t) ! R$ R%]!4      t* ! R& R']!4      t+ ! R( R)]!4      t, ! R* R+],4      t- ! R, R-],4      t.R. t/R/ t0 ! R0 R1]4      t1R5R2 lt2]3R38X  d   ]4! R44       R# R# )6a'  Parse a ppt (MS PowerPoint 97-2003) file

Based on olefile, parse the ppt-specific info

Code much influenced by olevba._extract_vba but much more object-oriented
(possibly slightly excessively so)

Currently quite narrowly focused on extracting VBA from ppt files, no slides or
stuff, but built to be extended to parsing more/all of the file. For better
"understanding" of ppt files, see module ppt_record_parser, which will probably
replace this module some time soon.

References:
* https://msdn.microsoft.com/en-us/library/dd921564%28v=office.12%29.aspx
  and links there-in

WARNING!
Before thinking about understanding or even extending this module, please keep
in mind that module ppt_record_parser has a better "understanding" of the ppt
file structure and will replace this module some time soon!

z0.54Nz..c                ó@  € V \         P                  P                  P                  9   d*   \         P                  ! V 4      pVP                  V4       V# \         P                  ! V 4      pVP                  \         P                  ! 4       4       VP                  V4       V# )aR  
Create a suitable logger object for this module.
The goal is not to change settings of the root logger, to avoid getting
other modules' logs on the screen.
If a logger exists with same name, reuse it. (Else it would have duplicate
handlers and messages would be doubled.)
The level is set to CRITICAL+1 by default, to avoid any logging.
)ÚloggingÚLoggerÚmanagerÚ
loggerDictÚ	getLoggerÚsetLevelÚ
addHandlerÚNullHandler)ÚnameÚlevelÚloggers   && Úm/home/l0st/web/w4ttz.lol/public_html/toolz/MsgDoxxer/venv/lib/python3.14/site-packages/oletools/ppt_parser.pyÚ
get_loggerr   J   sy   € ð Œw�~‰~×%Ñ%×0Ñ0Ô0ô ×"Ò" 4Ó(ˆà�‰˜ÔØˆä×Ò˜tÓ$€Fð ×Ñ”g×)Ò)Ó+Ô,Ø
‡O�O�EÔØ€Mó    Úpptc                 óL   € \         P                  \        P                  4       R# )zµ
Enable logging for this module (disabled by default).
This will set the module-specific logger level to NOTSET, which
means the main application controls the actual logging level.
N)Úlogr   r   ÚNOTSET© r   r   Úenable_loggingr   k   s   € ô ‡L�L”—‘Ö r   úPowerPoint Documentz.https://bitbucket.org/decalage/oletools/issueszPlease report this issue on %sc                   ó6   a a€ ] tR t^�t oRtV 3R ltRtVtV ;t# )ÚPptUnexpectedDataz<raise by PptParser if some field's value is not as expected c                óp   <€ R P                  WW44      V n        \        \        V `  V P                  4       R# )zCIn stream "{0}" for field "{1}" found value "{2}" but expected {3}!N)ÚformatÚmsgÚsuperr   Ú__init__)ÚselfÚstreamÚ
field_nameÚfound_valueÚexpected_valueÚ	__class__s   &&&&&€r   r   ÚPptUnexpectedData.__init__ƒ   s/   ø€ àQß‰V�F¨ÓDð 	Œô 	Ô Ñ/°·±Ö9r   )r   )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r$   Ú__classdict__s   @@r   r   r   �   s   ù‡ € ÙG÷:õ :r   r   c                ó\   € \         P                  ! RV P                  ^4      4      ^ ,          # )zread 1 byte from stream ú<B©ÚstructÚunpackÚread©r    s   &r   Úread_1r7   Œ   ó    € ä�=Š=˜˜vŸ{™{¨1›~Ó.¨qÕ1Ð1r   c                ó\   € \         P                  ! RV P                  ^4      4      ^ ,          # )z read 2 byte (short) from stream ú<Hr2   r6   s   &r   Úread_2r;   ‘   r8   r   c                ó\   € \         P                  ! RV P                  ^4      4      ^ ,          # )zread 4 byte (long) from stream ú<Lr2   r6   s   &r   Úread_4r>   –   r8   r   c                ó8  € \        V\        \        34      '       dL   W9  dD   RRP                  R V 4       4      ,           R,           p\	        RV RP                  V4      V4      hR# W!8w  d-   \	        RV RP                  V4      RP                  V4      4      hR# )z0simplify verification of values in extract_from Ú[ú OR c              3   óD   "  € T F  pR P                  V4      x € K  	  R# 5i©ú{0:04X}N©r   ©Ú.0Úvals   & r   Ú	<genexpr>Úcheck_value.<locals>.<genexpr>Ÿ   s%   é € ð (=Ù3;¨Cð )2×(8Ñ(8¸×(=Ð(=Û3;ùó   ‚ Ú]úCurrent UserrD   N)Ú
isinstanceÚlistÚtupleÚjoinr   r   )r   ÚvalueÚexpectedÚexp_strs   &&& r   Úcheck_valuerU   ›   s§   € ä�(œT¤5˜M×*Ò*ØÔ Ø˜FŸK™Kñ (=Ù3;ó(=ó =õ =Ø?BõCˆGä#Ø Ø× Ñ  Ó'¨ó2ð 2ñ !ð 
Ô	ÜØ˜DØ×Ñ˜UÓ# Y×%5Ñ%5°hÓ%?óAð 	Añ 
r   c                   óN   a € ] tR t^¬t o RtR t]R 4       t]RR l4       tRt	V t
R# )ÚRecordHeaderzÌa record header, at start of many types found in ppt files

https://msdn.microsoft.com/en-us/library/dd926377%28v=office.12%29.aspx
https://msdn.microsoft.com/en-us/library/dd948895%28v=office.12%29.aspx
c                ó>   € R V n         R V n        R V n        R V n        R # ©N)Úrec_verÚrec_instanceÚrec_typeÚrec_len©r   s   &r   r   ÚRecordHeader.__init__³   s   € ØˆŒØ ˆÔØˆŒØˆŽr   c                óJ  € V ! 4       p\         P                  ! RVP                  ^4      4      w  p\        V^4      w  Vn        Vn        \         P                  ! RVP                  ^4      4      w  Vn        \         P                  ! RVP                  ^4      4      w  Vn        V# )zreads 8 byte from stream r:   r=   )r3   r4   r5   Údivmodr[   rZ   r\   r]   )Úclzr    ÚobjÚversion_instances   &&  r   Úextract_fromÚRecordHeader.extract_from¹   s}   € ñ ‹eˆä"ŸMšM¨$°·±¸A³Ó?ÑÐÜ(.Ð/?ÀÓ(FÑ%ˆÔ˜#œ+ÜŸš d¨F¯K©K¸«NÓ;‰ˆŒÜ—}’} T¨6¯;©;°q«>Ó:‰ˆŒð ˆ
r   Nc                ó¦   € Vf   \        R4      hV^V,          ,           pVf   \        P                  ! RWQ4      # \        P                  ! RWQV4      # )zegenerate a record header string given values

length of result depends on rec_len being given or not
zRECORD_TYPE not set!z<HHz<HHL)Ú
ValueErrorr3   Úpack)rb   r\   r]   r[   rZ   rd   s   &&&&& r   ÚgenerateÚRecordHeader.generateÈ   sQ   € ð ÒÜÐ3Ó4Ð4Ø" T¨LÕ%8Õ8ÐØŠ?Ü—;’;˜uÐ&6ÓAÐAä—;’;˜vÐ'7À7ÓKÐKr   )r[   r]   r\   rZ   )Né    rl   )r&   r'   r(   r)   r*   r   Úclassmethodre   rj   r+   r,   ©r/   s   @r   rW   rW   ¬   s9   ø‡ € ñòð ñó ðð óLó öLr   rW   c                   ó‚   a € ] tR t^×t o RtRt^ t^ t]R 4       t	]
3R ltR tR tR tR tRR	 lt]RR
 l4       tRtV tR# )ÚPptTypez|base class of data types found in ppt ole files

starts with a RecordHeader, has a extract_from and a check_validity method
Nc                ó   € \        R 4      h)úabstract base function!©ÚNotImplementedError)rb   r    s   &&r   re   ÚPptType.extract_fromá   s   € ä!Ð";Ó<Ð<r   c                ó    € Wn         R V n        R # rY   )Ústream_nameÚrec_head)r   rw   s   &&r   r   ÚPptType.__init__å   s   € Ø&ÔØˆŽr   c                ó:   € \         P                  V4      V n        R # rY   )rW   re   rx   ©r   r    s   &&r   Úread_rec_headÚPptType.read_rec_headé   s   € Ü$×1Ñ1°&Ó9ˆŽr   c                ó   € \        R4      h)zÌcheck validity of data

replaces 'raise PptUnexpectedData' so caller can get all the errors
(not just the first) whenever she wishes.

to be overwritten in subclasses

:returns: list of PptUnexpectedData
rr   rs   r^   s   &r   Úcheck_validityÚPptType.check_validityì   s   € ô "Ð";Ó<Ð<r   c                óö  € \        V\        \        34      '       d|   W#9  ds   V P                  P                  pRRP                  R V 4       4      ,           R,           p\        V P                  VR,           V,           RP                  V4      V4      .#  . # W28w  d\   V P                  P                  p\        V P                  VR,           V,           RP                  V4      RP                  V4      4      .# . # )zssimplify verification of values: check value equals/is in expected

:returns: list of PptUnexpectedData exceptions
r@   rA   c              3   óD   "  € T F  pR P                  V4      x € K  	  R# 5irC   rE   rF   s   & r   rI   Ú&PptType.check_value.<locals>.<genexpr>   s&   é € ð ,AÙ7?°ð -6×,<Ñ,<¸S×,AÐ,AÛ7?ùrK   rL   Ú.rD   )	rN   rO   rP   r$   r&   rQ   r   rw   r   )r   r   rR   rS   Úclz_namerT   s   &&&&  r   rU   ÚPptType.check_valueø   sý   € ô
 �h¤¤u ×.Ò.ØÔ$ØŸ>™>×2Ñ2�Ø §¡ñ ,AÙ7?ó,Aó !Aõ AØCFõG�ä)Ø×$Ñ$ h°¥n°tÕ&;Ø×$Ñ$ UÓ+¨Wó6ð 9ð 9ð	 %ð ˆ	ð ÔØ—~‘~×.Ñ.ˆHÜ%Ø× Ñ  (¨S¥.°4Õ"7Ø× Ñ  Ó'¨×)9Ñ)9¸(Ó)CóEð Hð Hð ˆ	r   c                ó„  € RpVf   Vf   \        R4      hVe	   W#8:  d   RpVe	   W$8¼  d   RpV'       d‹   V P                  P                  pVf   RP                  V4      pM(Vf   RP                  V4      pMRP                  VV4      p\	        V P
                  VR,           V,           RP                  V4      V4      .# . # )	a   simplify verification of values: check value is in given range

expect_lower or expected_upper can be given as None to check only one
boundary. If value equals one of the boundaries, that is also an error
(boundaries form an open interval)

:returns: list of PptUnexpectedData exceptions
Fz$need at least one non-None boundary!Tz	< {0:04X}z	> {0:04X}zwithin ({0:04X}, {1:04X})r„   rD   )rh   r$   r&   r   r   rw   )r   r   rR   Úexpect_lowerÚexpect_upperÚis_errr…   Ú
expect_strs   &&&&&   r   Úcheck_rangeÚPptType.check_range  sÕ   € ð ˆØÒ LÒ$8ÜÐCÓDÐDØÒ#ØÔ$Ø�ØÒ#ØÔ$Ø�çØ—~‘~×.Ñ.ˆHØÒ#Ø(×/Ñ/°Ó=‘
ØÒ%Ø(×/Ñ/°Ó=‘
à8×?Ñ?ÀØ@LóN�
ä% d×&6Ñ&6¸À3½ÈÕ8MØ&/×&6Ñ&6°uÓ&=¸zóKð Nð Nð ˆIr   c                ó0  € . pVP                  V P                  RV P                  P                  V P                  4      4       VP                  V P                  RV P                  P
                  V P                  4      4       V P                  f   \        R4      hVP                  V P                  RV P                  P                  V P                  4      4       Ve7   VP                  V P                  RV P                  P                  V4      4       V# )zƒto be called by check_validity to check the self.rec_head

uses self.RECORD_... constants, (not quite that constant for DummyType)
zrec_head.recVerzrec_head.recInstancezRECORD_TYPE not specified!zrec_head.recTypezrec_head.recLen)ÚextendrU   rx   rZ   ÚRECORD_VERSIONr[   ÚRECORD_INSTANCEÚRECORD_TYPErt   r\   r]   )r   ÚlengthÚerrss   && r   Úcheck_rec_headÚPptType.check_rec_head.  sò   € ð ˆØ�‰�D×$Ñ$Ð%6¸¿¹×8MÑ8MØ%)×%8Ñ%8ó:ô 	;à�‰�D×$Ñ$Ð%;Ø%)§]¡]×%?Ñ%?Ø%)×%9Ñ%9ó;ô 	<ð ×ÑÒ#Ü%Ð&BÓCÐCØ�‰�D×$Ñ$Ð%7Ø%)§]¡]×%;Ñ%;Ø%)×%5Ñ%5ó7ô 	8ð ÒØ�K‰K˜×(Ñ(Ð):Ø)-¯©×)>Ñ)>ÀóHô Iàˆr   c                ón   € \         P                  V P                  VV P                  V P                  4      # )z5call RecordHeader.generate with values for this type )rW   rj   r’   r‘   r�   )rb   r]   s   &&r   Úgenerate_patternÚPptType.generate_patternD  s2   € ô ×$Ñ$ S§_¡_°gØ%(×%8Ñ%8¸#×:LÑ:LóNð 	Nr   )rx   rw   rY   )r&   r'   r(   r)   r*   r’   r‘   r�   rm   re   ÚMAIN_STREAM_NAMEr   r|   r   rU   rŒ   r•   r˜   r+   r,   rn   s   @r   rp   rp   ×   sg   ø‡ € ñð
 €KØ€OØ€Nàñ=ó ð=ð $4ô ò:ò
=òò( ôDð, óNó öNr   rp   c                   óv   a a€ ] tR tRt oRtRtRt^t^	tRt	^t
Rt^t^ tV 3R ltR t]R	 4       tR
 tRtVtV ;t# )ÚCurrentUserAtomiK  a  An atom record that specifies information about the last user to modify
the file and where the most recent user edit is located. This is the only
record in the Current User Stream (section 2.1.1).

https://msdn.microsoft.com/en-us/library/dd948895%28v=office.12%29.aspx
l   ßD£g l   _@#G iö  iô  c                óÊ   <€ \         \        V `  R R7       RV n        RV n        RV n        RV n        RV n        RV n        RV n	        RV n
        RV n        RV n        RV n        R# )rM   )rw   N)r   rœ   r   rx   ÚsizeÚheader_tokenÚoffset_to_current_editÚlen_user_nameÚdoc_file_versionÚmajor_versionÚminor_versionÚansi_user_nameÚunicode_user_nameÚrel_version©r   r$   s   &€r   r   ÚCurrentUserAtom.__init__b  sk   ø€ ÜŒo˜tÑ-¸.Ð-ÔIØˆŒØˆŒ	Ø ˆÔØ&*ˆÔ#Ø!ˆÔØ $ˆÔØ!ˆÔØ!ˆÔØ"ˆÔØ!%ˆÔØˆÖr   c                ó4   € V P                   V P                  8H  # rY   )rŸ   ÚHEADER_TOKEN_ENCRYPTr^   s   &r   Úis_encryptedÚCurrentUserAtom.is_encryptedp  s   € Ø× Ñ  D×$=Ñ$=Ñ=Ð=r   c                óÈ  € V ! 4       p\         P                  V4      Vn        \        P                  ! RVP                  ^4      4      w  Vn        \        P                  ! RVP                  ^4      4      w  Vn        \        P                  ! RVP                  ^4      4      w  Vn        \        P                  ! RVP                  ^4      4      w  Vn	        \        P                  ! RVP                  ^4      4      w  Vn
        \        P                  ! RVP                  ^4      4      w  Vn        \        P                  ! RVP                  ^4      4      w  Vn        VP                  ^4       VP                  VP                  4      Vn        \        P                  ! RVP                  ^4      4      w  Vn        VP                  ^VP                  ,          4      Vn        V# )z&create instance with info from stream r=   r:   r1   )rW   re   rx   r3   r4   r5   rž   rŸ   r    r¡   r¢   r£   r¤   r¥   r§   r¦   ©rb   r    rc   s   && r   re   ÚCurrentUserAtom.extract_froms  sO  € ñ ‹eˆô $×0Ñ0°Ó8ˆŒä—M’M $¨¯©°A«Ó7‰	ˆŒÜ"ŸMšM¨$°·±¸A³Ó?ÑˆÔÜ&,§m¢m°D¸&¿+¹+Àa».Ó&IÑ#ˆÔ"Ü#Ÿ]š]¨4°·±¸Q³Ó@ÑˆÔÜ &§¢¨d°F·K±KÀ³NÓ CÑˆÔÜ#Ÿ]š]¨4°·±¸Q³Ó@ÑˆÔÜ#Ÿ]š]¨4°·±¸Q³Ó@ÑˆÔØ�‰�AŒØ#Ÿ[™[¨×):Ñ):Ó;ˆÔÜ!Ÿ=š=¨¨v¯{©{¸1«~Ó>ÑˆŒØ &§¡¨A°×0AÑ0AÕ,AÓ BˆÔàˆ
r   c                ó8  € V P                  4       pVP                  V P                  R V P                  V P                  4      4       VP                  V P                  RV P
                  V P                  V P                  .4      4       VP                  V P                  RV P                  RR4      4       VP                  V P                  RV P                  V P                  4      4       VP                  V P                  RV P                  V P                  4      4       VP                  V P                  RV P                  V P                  4      4       VP                  V P                  RV P                   V P"                  V P$                  .4      4       V# )	rž   ÚheaderTokenÚlenUserNameNé   ÚdocFileVersionÚmajorVersionÚminorVersionÚ
relVersion)r•   r�   rU   rž   ÚSIZErŸ   r«   ÚHEADER_TOKEN_NOCRYPTrŒ   r¡   r¢   ÚDOC_FILE_VERSIONr£   ÚMAJOR_VERSIONr¤   ÚMINOR_VERSIONr§   ÚREL_VERSION_CAN_USEÚREL_VERSION_NO_USE©r   r”   s   & r   r   ÚCurrentUserAtom.check_validityŠ  sb  € Ø×"Ñ"Ó$ˆØ�‰�D×$Ñ$ V¨T¯Y©Y¸¿	¹	ÓBÔCØ�‰�D×$Ñ$ ]°D×4EÑ4EØ&*×&?Ñ&?Ø&*×&?Ñ&?ð&AóBô 	Cð 	�‰�D×$Ñ$ ]°D×4FÑ4FÈØ%(ó*ô 	+à�‰�D×$Ñ$Ð%5°t×7LÑ7LØ%)×%:Ñ%:ó<ô 	=à�‰�D×$Ñ$ ^°T×5GÑ5GØ%)×%7Ñ%7ó9ô 	:à�‰�D×$Ñ$ ^°T×5GÑ5GØ%)×%7Ñ%7ó9ô 	:à�‰�D×$Ñ$ \°4×3CÑ3CØ&*×&>Ñ&>Ø&*×&=Ñ&=ð&?ó@ô 	Að ˆr   )r¥   r¢   rŸ   r¡   r£   r¤   r    rx   r§   rž   r¦   )r&   r'   r(   r)   r*   r«   rº   r¾   r¿   r’   r¹   r»   r¼   r½   r   r¬   rm   re   r   r+   r,   r-   r.   s   @@r   rœ   rœ   K  sj   ù‡ € ñð &ÐØ%Ðð %ÐØ#Ðð €KØ€DØÐØ€MØ€Mõ ò>ð ñó ð÷,ò r   rœ   c                   ó\   a a€ ] tR tRt oRtRt^ t^tV 3R lt]	R 4       t
RR ltRtVtV ;t# )	ÚUserEditAtomiž  z…An atom record that specifies information about a user edit

https://msdn.microsoft.com/en-us/library/dd945746%28v=office.12%29.aspx
iõ  c                óÆ   <€ \         \        V `  4        R V n        R V n        R V n        R V n        R V n        R V n        R V n	        R V n
        R V n        R V n        R V n        R # rY   )r   rÃ   r   rx   Úlast_slide_id_refÚversionr¤   r£   Úoffset_last_editÚoffset_persist_directoryÚdoc_persist_id_refÚpersist_id_seedÚ	last_viewÚencrypt_session_persist_id_refr¨   s   &€r   r   ÚUserEditAtom.__init__¨  se   ø€ ÜŒl˜DÑ*Ô,ØˆŒØ!%ˆÔØˆŒØ!ˆÔØ!ˆÔØ $ˆÔØ(,ˆÔ%Ø"&ˆÔØ#ˆÔØˆŒØ.2ˆÖ+r   c                ó:  € \         P                  R4       V ! 4       p\        P                  V4      Vn        \
        P                  ! RVP                  ^4      4      w  Vn        \
        P                  ! RVP                  ^4      4      w  Vn	        \
        P                  ! RVP                  ^4      4      w  Vn
        \
        P                  ! RVP                  ^4      4      w  Vn        \
        P                  ! RVP                  ^4      4      w  Vn        \
        P                  ! RVP                  ^4      4      w  Vn        \
        P                  ! RVP                  ^4      4      w  Vn        \
        P                  ! RVP                  ^4      4      w  Vn        \
        P                  ! RVP                  ^4      4      w  Vn        VP                  ^4       V'       d0   \
        P                  ! RVP                  ^4      4      w  Vn        V# RVn        V# )z?extract info from given stream (already positioned correctly!) z extract UserEditAtom from streamr=   r:   r1   N)r   ÚdebugrW   re   rx   r3   r4   r5   rÅ   rÆ   r¤   r£   rÇ   rÈ   rÉ   rÊ   rË   rÌ   )rb   r    r¬   rc   s   &&& r   re   ÚUserEditAtom.extract_from¶  sz  € ô 	�	‰	Ð4Ô5á‹eˆô $×0Ñ0°Ó8ˆŒä!'§¢¨t°V·[±[À³^Ó!DÑˆÔÜ—}’} T¨6¯;©;°q«>Ó:‰ˆŒÜ#Ÿ]š]¨4°·±¸Q³Ó@ÑˆÔÜ#Ÿ]š]¨4°·±¸Q³Ó@ÑˆÔÜ &§¢¨d°F·K±KÀ³NÓ CÑˆÔÜ(.¯ª°d¸F¿K¹KÈ»NÓ(KÑ%ˆÔ$Ü"(§-¢-°°f·k±kÀ!³nÓ"EÑˆÔÜ%Ÿ}š}¨T°6·;±;¸q³>ÓBÑˆÔäŸš t¨V¯[©[¸«^Ó<‰ˆŒØ�‰�AŒßä—’˜d F§K¡K°£NÓ3ñ 0ˆCÔ.ð
 ˆ
ð 26ˆCÔ.àˆ
r   c                óÆ  € V P                  4       pVP                  V P                  R V P                  V P                  4      4       VP                  V P                  RV P
                  V P                  4      4       Veµ   V P                  V8¼  d7   VP                  \        RRV P                  RP                  V4      4      4       V P                  V8¼  g   V P                  V P                  8:  dB   VP                  \        RRV P                  RP                  V P                  V4      4      4       VP                  V P                  RV P                  ^4      4       V# )r·   r¶   r   zUserEditAtom.offsetLastEditz< {0}z#UserEditAtom.offsetPersistDirectoryzin ({0}, {1})ÚdocPersistIdRef)r•   r�   rU   r¤   r½   r£   r¼   rÇ   Úappendr   r   rÈ   rÉ   )r   Úoffsetr”   s   && r   r   ÚUserEditAtom.check_validityÔ  s;  € Ø×"Ñ"Ó$ˆØ�‰�D×$Ñ$ ^°T×5GÑ5GØ%)×%7Ñ%7ó9ô 	:à�‰�D×$Ñ$ ^°T×5GÑ5GØ%)×%7Ñ%7ó9ô 	:àÒØ×$Ñ$¨Ô.Ø—‘Ô-Ø)Ð+HØ×)Ñ)¨7¯>©>¸&Ó+AóCô Dð ×,Ñ,°Ô6Ø×1Ñ1°T×5JÑ5JÔJØ—‘Ô-Ø)Ø9Ø×)Ñ)Ø#×*Ñ*¨4×+@Ñ+@À&ÓIó	Kô Lð
 	�‰�D×$Ñ$Ð%6Ø%)×%<Ñ%<¸aóAô 	Bàˆr   )rÉ   rÌ   rÅ   rË   r£   r¤   rÇ   rÈ   rÊ   rx   rÆ   rY   )r&   r'   r(   r)   r*   r’   r½   r¼   r   rm   re   r   r+   r,   r-   r.   s   @@r   rÃ   rÃ   ž  s>   ù‡ € ñð
 €KØ€MØ€Mõ3ð ñó ð÷:ô r   rÃ   c                   óF   a a€ ] tR tRt oRtRV 3R lltR tR tRtVt	V ;t
# )Ú	DummyTypeií  a  a type that is found in ppt documents we are not interested in

instead of parsing many uninteresting types, we just read their
RecordHeader and set the RECORD_... values on an instance- (instead of
class-) level

used to skip over uninteresting types in e.g. DocumentContainer
c                óh   <€ \         \        V `  4        Wn        W n        W0n        W@n        WPn        R # rY   )r   r×   r   Ú	type_namer’   r�   r‘   Úrecord_length)r   rÙ   Úrecord_typerZ   r[   r]   r$   s   &&&&&&€r   r   ÚDummyType.__init__÷  s-   ø€ äŒi˜Ñ'Ô)Ø"ŒØ&ÔØ%ÔØ+ÔØ$Ör   c                óÞ  € V P                  V4       \        P                  RP                  V P                  P
                  V P                  4      4       \        P                  RP                  VP                  4       4      4       VP                  V P                  P
                  \        P                  4       \        P                  RP                  VP                  4       4      4       V # )a  extract record header and just skip as many bytes as header says

Since this requires RECORD_... values set in constructor, this is NOT
a classmethod like all the other extract_from!

Otherwise this tries to be compatible with other extract_from methods
(e.g. returns self)
z#skipping over {0} Byte for type {1}ústart at pos {0}únow at pos {0})r|   r   rÏ   r   rx   r]   rÙ   ÚtellÚseekÚosÚSEEK_CURr{   s   &&r   re   ÚDummyType.extract_from   s™   € ð 	×Ñ˜6Ô"Ü�	‰	Ð7ß‘6˜$Ÿ-™-×/Ñ/°·±Ó@ô	Bä�	‰	Ð$×+Ñ+¨F¯K©K«MÓ:Ô;Ø�‰�D—M‘M×)Ñ)¬2¯;©;Ô7Ü�	‰	Ð"×)Ñ)¨&¯+©+«-Ó8Ô9Øˆr   c                ó8   € V P                  V P                  4      # rY   )r•   rÚ   r^   s   &r   r   ÚDummyType.check_validity  s   € Ø×"Ñ" 4×#5Ñ#5Ó6Ð6r   )r‘   r’   r�   rÚ   rÙ   )rl   rl   N)r&   r'   r(   r)   r*   r   re   r   r+   r,   r-   r.   s   @@r   r×   r×   í  s   ù‡ € ñ÷%ò÷"7ò 7r   r×   c                   óT   a a€ ] tR tRt oRtRtV 3R lt]R 4       tRR lt	Rt
VtV ;t# )	ÚPersistDirectoryAtomi  z¶one part of a persist object directory with unique persist object id

contains PersistDirectoryEntry objects

https://msdn.microsoft.com/en-us/library/dd952680%28v=office.12%29.aspx
ir  c                óH   <€ \         \        V `  4        R V n        R V n        R # rY   )r   rè   r   Úrg_persist_dir_entryÚstream_offsetr¨   s   &€r   r   ÚPersistDirectoryAtom.__init__  s!   ø€ ÜÔ" DÑ2Ô4Ø$(ˆÔ!Ø!ˆÖr   c                ó  € \         P                  R4       V ! 4       pVP                  4       Vn        VP	                  V4       VP                  4       pW2P
                  P                  ,           p\         P                  RP                  W44      4       . Vn        W48  dg   \        P                  V4      pVP                  P                  V4       VP                  4       p\         P                  RP                  V4      4       Kl  V# )z5create and return object with data from given stream z-Extracting a PersistDirectoryAtom from streamz(start reading at pos {0}, read until {1}z
at pos {0})r   rÏ   rà   rë   r|   rx   r]   r   rê   ÚPersistDirectoryEntryre   rÓ   )rb   r    rc   Úcurr_posÚstop_posÚ	new_entrys   &&    r   re   Ú!PersistDirectoryAtom.extract_from$  sÉ   € ô 	�	‰	ÐAÔBÙ‹eˆð #ŸK™K›MˆÔð 	×Ñ˜&Ô!ð —;‘;“=ˆØŸl™l×2Ñ2Õ2ˆÜ�	‰	Ð<ß‘6˜(Ó-ô	/à#%ˆÔ àÔ!Ü-×:Ñ:¸6ÓBˆIØ×$Ñ$×+Ñ+¨IÔ6Ø—{‘{“}ˆHÜ�I‰I�l×)Ñ)¨(Ó3Ö4Øˆ
r   c                ó¢   € V P                  4       pV P                   F.  pVP                  VP                  VV P                  4      4       K0  	  V# rY   )r•   rê   r�   r   rë   )r   Úuser_edit_last_offsetr”   Úentrys   &&  r   r   Ú#PersistDirectoryAtom.check_validity?  sN   € Ø×"Ñ"Ó$ˆØ×.Ô.ˆEØ�K‰K˜×,Ñ,Ð-BØ-1×-?Ñ-?óAö Bñ /ð ˆr   )rê   rë   rY   ©r&   r'   r(   r)   r*   r’   r   rm   re   r   r+   r,   r-   r.   s   @@r   rè   rè     s4   ù‡ € ñð €Kõ"ð
 ñó ð÷4ô r   rè   c                   óD   a € ] tR tRt o RtR t]R 4       tRR ltRt	V t
R# )	rî   iG  aL  an entry contained in a PersistDirectoryAtom.rg_persist_dir_entry

A structure that specifies a compressed table of sequential persist object
identifiers and stream offsets to associated persist objects.

NOT a subclass of PptType because has no RecordHeader

https://msdn.microsoft.com/en-us/library/dd947347%28v=office.12%29.aspx
c                ó0   € R V n         R V n        R V n        R # rY   )Ú
persist_idÚ	c_persistÚrg_persist_offsetr^   s   &r   r   ÚPersistDirectoryEntry.__init__R  s   € ØˆŒØˆŒØ!%ˆÖr   c           	     óB  € \         P                  R 4       V ! 4       p\        P                  ! RVP	                  ^4      4      w  p\        VR4      w  Vn        Vn        \         P                  RP                  W2P                  VP                  4      4       \        VP                  4       Uu. uF0  p\        P                  ! RVP	                  ^4      4      ^ ,          NK2  	  upVn
        \         P                  RP                  VP                  4      4       V# u upi )z.Extracting a PersistDirectoryEntry from streamr=   z4temp is 0x{0:04X} --> id is {1}, reading {2} offsetszoffsets are: {0}i   )r   rÏ   r3   r4   r5   ra   rû   rú   r   Úrangerü   )rb   r    rc   ÚtempÚ_s   &&   r   re   Ú"PersistDirectoryEntry.extract_fromW  sÞ   € ô 	�	‰	ÐBÔCÙ‹eˆô —’˜d F§K¡K°£NÓ3‰ˆÜ(.¨t°UÓ(;Ñ%ˆŒ�s”~Ü�	‰	ÐHß‘6˜$§¡°·±Ó>ô	@ô +0°·±Ô*>ó!@Ù*> Qô "(§¢¨t°V·[±[À³^Ó!DÀQ×!GÐ!GÙ*>ñ!@ˆÔä�	‰	Ð$×+Ñ+¨C×,AÑ,AÓBÔCØˆ
ùò!@s   Â.6DNc           
     óœ  € . pV P                   R 8”  d;   VP                  \        \        RV P                   RP	                  R 4      4      4       V P
                  ^ 8X  d,   VP                  \        \        RV P
                  R4      4       Ve^   \        V P                  4      V8  dD   VP                  \        \        R\        V P                  4      RP	                  V4      4      4       Ve^   \        V P                  4      V8”  dD   VP                  \        \        R\        V P                  4      RP	                  V4      4      4       V# )iþÿ z PersistDirectoryEntry.persist_idz< 0xFFFFE (dec: {0})zPersistDirectoryEntry.c_persistz> 0z'PersistDirectoryEntry.rg_persist_offsetz> UserEdit.offsetLastEdit ({0})z%> PersistObjectDirectory offset ({0}))	rú   rÓ   r   rš   r   rû   Úminrü   Úmax)r   rô   Úpersist_obj_dir_offsetr”   s   &&& r   r   Ú$PersistDirectoryEntry.check_validityz  s   € àˆØ�?‰?˜WÔ$Ø�K‰KÔ)Ü Ð"DØ—‘Ð!7×!>Ñ!>¸wÓ!GóIô Jð �>‰>˜QÔØ�K‰KÔ)Ü Ð"CØ—‘ ó'ô (ð !Ò,Ü˜×.Ñ.Ó/Ð2GÔGØ�K‰KÔ)Ü Ð"KÜ�D×*Ñ*Ó+Ø1ß‘Ð-Ó.ó	0ô 1ð
 "Ò-Ü˜×.Ñ.Ó/Ð2HÔHØ�K‰KÔ)Ü Ð"KÜ�D×*Ñ*Ó+Ø7ß‘Ð.Ó/ó	1ô 2ð
 ˆr   )rû   rú   rü   )NN)r&   r'   r(   r)   r*   r   rm   re   r   r+   r,   rn   s   @r   rî   rî   G  s.   ø‡ € ñò&ð
 ñ ó ð ÷Dò r   rî   c                   óT   a a€ ] tR tRt oRt. ROtV 3R lt]R 4       tR t	Rt
VtV ;t# )ÚDocInfoListSubContainerOrAtomi–  a"  one of various types found in a DocInfoListContainer

https://msdn.microsoft.com/en-us/library/dd921705%28v=office.12%29.aspx

actual type of this object is defined by the recVersion field in its Record
Head

Similar to DummyType, RECORD_TYPE varies from instance to instance for this
type
c                ó,   <€ \         \        V `  4        R # rY   )r   r	  r   r¨   s   &€r   r   Ú&DocInfoListSubContainerOrAtom.__init__ª  s   ø€ ÜÔ+¨TÑ;Ö=r   c                ó”  € \         P                  R4       V ! 4       pVP                  V4       VP                  P                  \
        P                  8X  d"   \
        P                  WP                  4      pV# \         P                  RP                  VP                  P                  4      4       \         P                  RP                  VP                  4       4      4       VP                  VP                  P                  \        P                  4       \         P                  RP                  VP                  4       4      4       V# )ú*build instance with info read from stream z1Parsing DocInfoListSubContainerOrAtom from streamz7skipping over {0} Byte in DocInfoListSubContainerOrAtomrÞ   rß   )r   rÏ   r|   rx   r\   ÚVBAInfoContainerr’   re   r   r]   rà   rá   râ   rã   r¯   s   && r   re   Ú*DocInfoListSubContainerOrAtom.extract_from­  sÜ   € ô 	�	‰	ÐEÔFá‹eˆØ×Ñ˜&Ô!Ø�<‰<× Ñ Ô$4×$@Ñ$@Ô@Ü"×/Ñ/°¿¹ÓEˆCð ˆ
ô �I‰IÐOß‘v˜cŸl™l×2Ñ2Ó3ô5ä�I‰IÐ(×/Ñ/°·±³Ó>Ô?Ø�K‰K˜Ÿ™×,Ñ,¬b¯k©kÔ:Ü�I‰IÐ&×-Ñ-¨f¯k©k«mÓ<Ô=Øˆ
r   c                óh   € V P                  RV P                  P                  V P                  4       R# )zcan be any of multiple types z
rh.recTypeN)rU   rx   r\   ÚVALID_RECORD_TYPESr^   s   &r   r   Ú,DocInfoListSubContainerOrAtom.check_validity¿  s'   € à×Ñ˜ t§}¡}×'=Ñ'=Ø×0Ñ0ö	2r   r   )iˆ  i  i  i  iú  i  )r&   r'   r(   r)   r*   r  r   rm   re   r   r+   r,   r-   r.   s   @@r   r	  r	  –  s5   ù‡ € ñ	ò"Ðõ>ð ñó ð÷"2ò 2r   r	  c                   óT   a a€ ] tR tRt oRt^tRtV 3R lt]R 4       t	R t
RtVtV ;t# )ÚDocInfoListContaineriÅ  z†information about the document and document display settings

https://msdn.microsoft.com/en-us/library/dd926767%28v=office.12%29.aspx
iÐ  c                ó:   <€ \         \        V `  4        R V n        R # rY   )r   r  r   Úrg_child_recr¨   s   &€r   r   ÚDocInfoListContainer.__init__Î  s   ø€ ÜÔ" DÑ2Ô4Ø ˆÖr   c                ó6  € \         P                  R4       V ! 4       pVP                  V4       VP                  4       pW2P                  P
                  ,           p\         P                  RP                  W44      4       . Vn        W48  dk   \        4       P                  V4      pVP                  P                  V4       VP                  4       p\         P                  RP                  V4      4       Kp  \         P                  RP                  WC4      4       R# )r  z(Parsing DocInfoListContainer from streamz-start reading at pos {0}, will read until {1}rß   z<reached end pos {0} ({1}). stop reading DocInfoListContainerN)r   rÏ   r|   rà   rx   r]   r   r  r	  re   rÓ   )rb   r    rc   rï   Úend_posÚnew_objs   &&    r   re   Ú!DocInfoListContainer.extract_fromÒ  sÏ   € ô 	�	‰	Ð<Ô=Ù‹eˆØ×Ñ˜&Ô!ð —;‘;“=ˆØŸ\™\×1Ñ1Õ1ˆÜ�	‰	ÐAß‘6˜(Ó,ô	.àˆÔàÔ Ü3Ó5×BÑBÀ6ÓJˆGØ×Ñ×#Ñ# GÔ,Ø—{‘{“}ˆHÜ�I‰IÐ&×-Ñ-¨hÓ7Ö8ä�	‰	ÐPß‘6˜'Ó,ö	.r   c                óŠ   € V P                  4       pV P                   F"  pVP                  VP                  4       4       K$  	  V# rY   )r•   r  r�   r   )r   r”   rc   s   &  r   r   Ú#DocInfoListContainer.check_validityí  s:   € Ø×"Ñ"Ó$ˆØ×$Ô$ˆCØ�K‰K˜×*Ñ*Ó,Ö-ñ %àˆr   )r  )r&   r'   r(   r)   r*   r�   r’   r   rm   re   r   r+   r,   r-   r.   s   @@r   r  r  Å  s9   ù‡ € ñð
 €NØ€Kõ!ð ñ.ó ð.÷4ò r   r  c                   óP   a a€ ] tR tRt oRtRtV 3R lt]R 4       tR t	Rt
VtV ;t# )ÚDocumentContaineriô  zda DocumentContainer record

https://msdn.microsoft.com/en-us/library/dd947357%28v=office.12%29.aspx
iè  c                ó6  <€ \         \        V `  4        R V n        R V n        R V n        R V n        R V n        R V n        R V n	        R V n
        R V n        R V n        R V n        R V n        R V n        R V n        R V n        R V n        R V n        R V n        R V n        R # rY   )r   r  r   Údocument_atomÚex_obj_listÚdocument_text_infoÚsound_collectionÚdrawing_groupÚmaster_listÚdoc_info_listÚslide_hfÚnotes_hfÚ
slide_listÚ
notes_listÚslide_show_doc_infoÚnamed_showsÚsummaryÚdoc_routing_slipÚprint_optionsÚrt_custom_table_styles_1Úend_documentÚrt_custom_table_styles_2r¨   s   &€r   r   ÚDocumentContainer.__init__ü  s¤   ø€ ÜÔ Ñ/Ô1Ø!ˆÔØˆÔØ"&ˆÔØ $ˆÔØ!ˆÔØˆÔØ!ˆÔØˆŒØˆŒØˆŒØˆŒØ#'ˆÔ ØˆÔØˆŒØ $ˆÔØ!ˆÔØ(,ˆÔ%Ø ˆÔØ(,ˆÖ%r   c                óâ  € \         P                  R4       V ! 4       pVP                  V4       \         P                  RP	                  \        VP                  4       4      4      4       \        RR^^(R7      P                  V4      Vn	        \         P                  RP	                  \        VP                  P                  4       4      4      4       \        RR^R7      P                  V4      Vn        \         P                  RP	                  \        VP                  P                  4       4      4      4       \        R	R
^R7      P                  V4      Vn        \         P                  RP	                  \        VP                  P                  4       4      4      4       \        RR^^R7      P                  V4      Vn        \         P                  RP	                  \        VP                  P                  4       4      4      4       \        RR^R7      P                  V4      Vn        \         P                  RP	                  \        VP                  P                  4       4      4      4       \        RR^R7      P                  V4      Vn        \         P                  RP	                  \        VP                  P                  4       4      4      4       \         P                  V4      Vn        V# )z›created object with values from given stream

stream is assumed to be positioned correctly

this container contains lots of data we are not interested in.
z%Parsing DocumentContainer from streamzvalidity: {0} errsÚDocumentAtomié  )rZ   r]   ÚExObjListContaineri	  )rZ   ÚDocumentTextInfoContaineriò  ÚSoundCollectionContaineriä  )rZ   r[   ÚDrawingGroupContaineri  ÚMasterListWithContainerið  )r   rÏ   r|   Úinfor   Úlenr•   r×   re   r!  r   r"  r#  r$  r%  r&  r  r'  r¯   s   && r   re   ÚDocumentContainer.extract_from  sT  € ô 	�	‰	Ð9Ô:Ù‹eˆð 	×Ñ˜&Ô!Ü�‰Ð%×,Ñ,¬S°×1CÑ1CÓ1EÓ-FÓGÔHô & n°fÀcØ.2ô4ß4@±LÀÓ4Hð 	Ôä�‰Ð%ß‘&œ˜S×.Ñ.×=Ñ=Ó?Ó@ÓAô	Cô
 $Ð$8¸&È#ÔNß'™<¨Ó/ð 	Œä�‰Ð%ß‘&œ˜SŸ_™_×;Ñ;Ó=Ó>Ó?ô	Aô "+Ð+FÈØ36ô"8ß8D¹ÀVÓ8Lð 	Ôä�‰Ð%ß‘&œ˜S×3Ñ3×BÑBÓDÓEÓFô	Hô  )Ð)CÀVØ14À5ô Jç ,¡¨VÓ 4ð 	Ôô 	�‰Ð%ß‘&œ˜S×1Ñ1×@Ñ@ÓBÓCÓDô	Fô
 &Ð&=¸vØ.1ô3ß3?±<ÀÓ3Gð 	Ôä�‰Ð%ß‘&œ˜S×.Ñ.×=Ñ=Ó?Ó@ÓAô	Cô $Ð$=¸vØ,/ô1ß1=±¸fÓ1Eð 	Œä�‰Ð%ß‘&œ˜SŸ_™_×;Ñ;Ó=Ó>Ó?ô	Aô 1×=Ñ=¸fÓEˆÔðp ˆ
r   c                ód  € V P                  4       pVP                  V P                  P                  4       4       VP                  V P                  P                  4       4       VP                  V P
                  P                  4       4       VP                  V P                  P                  4       4       VP                  V P                  P                  4       4       VP                  V P                  P                  4       4       VP                  V P                  P                  4       4       V# )z,check all values in object for valid values )
r•   r�   r!  r   r"  r#  r$  r%  r&  r'  rÀ   s   & r   r   Ú DocumentContainer.check_validityŽ  sÒ   € à×"Ñ"Ó$ˆØ�‰�D×&Ñ&×5Ñ5Ó7Ô8Ø�‰�D×$Ñ$×3Ñ3Ó5Ô6Ø�‰�D×+Ñ+×:Ñ:Ó<Ô=Ø�‰�D×)Ñ)×8Ñ8Ó:Ô;Ø�‰�D×&Ñ&×5Ñ5Ó7Ô8Ø�‰�D×$Ñ$×3Ñ3Ó5Ô6Ø�‰�D×&Ñ&×5Ñ5Ó7Ô8Øˆr   )r'  r/  r!  r#  r%  r2  r"  r&  r-  r)  r+  r0  r1  r3  r(  r*  r,  r$  r.  r÷   r.   s   @@r   r  r  ô  s7   ù‡ € ñð
 €Kõ-ð, ñxó ðx÷v
ò 
r   r  c                   ó`   a a€ ] tR tRt oRtRt^t^t^tV 3R lt	]
RR l4       tR tRtVtV ;t# )	r  i›  z�A container record that specifies VBA information for the document.

https://msdn.microsoft.com/en-us/library/dd952168%28v=office.12%29.aspx
iÿ  c                ó:   <€ \         \        V `  4        R V n        R # rY   )r   r  r   Úvba_info_atomr¨   s   &€r   r   ÚVBAInfoContainer.__init__¦  s   ø€ ÜÔ Ñ.Ô0Ø!ˆÖr   c                óÔ   € \         P                  R4       V ! 4       pVf   VP                  V4       M\         P                  R4       W#n        \        P                  V4      Vn        V# )zKsince can determine this type only after reading header, it is arg
        zparsing VBAInfoContainerzskip parsing of RecordHeader)r   rÏ   r|   rx   ÚVBAInfoAtomre   rC  )rb   r    rx   rc   s   &&& r   re   ÚVBAInfoContainer.extract_fromª  sV   € ô 	�	‰	Ð,Ô-Ù‹eˆØÒØ×Ñ˜fÕ%ä�I‰IÐ4Ô5Ø#ŒLÜ'×4Ñ4°VÓ<ˆÔØˆ
r   c                ó�   € V P                  V P                  R 7      pVP                  V P                  P	                  4       4       V# )©r“   )r•   ÚRECORD_LENGTHr�   rC  r   rÀ   s   & r   r   ÚVBAInfoContainer.check_validity¸  s;   € Ø×"Ñ"¨$×*<Ñ*<Ð"Ó=ˆØ�‰�D×&Ñ&×5Ñ5Ó7Ô8Øˆr   )rC  rY   )r&   r'   r(   r)   r*   r’   r�   r‘   rJ  r   rm   re   r   r+   r,   r-   r.   s   @@r   r  r  ›  sC   ù‡ € ñð
 €KØ€NØ€OØ€Mõ"ð óó ð÷ò r   r  c                   óX   a a€ ] tR tRt oRtRt^t^tV 3R lt]	R 4       t
R tRtVtV ;t# )rF  i¾  z�An atom record that specifies a reference to the VBA project storage.

https://msdn.microsoft.com/en-us/library/dd948874%28v=office.12%29.aspx
é   c                óV   <€ \         \        V `  4        R V n        R V n        R V n        R # rY   )r   rF  r   Úpersist_id_refÚf_has_macrosrÆ   r¨   s   &€r   r   ÚVBAInfoAtom.__init__È  s'   ø€ ÜŒk˜4Ñ)Ô+Ø"ˆÔØ ˆÔØˆŽr   c                óÀ   € \         P                  R 4       V ! 4       pVP                  V4       \        V4      Vn        \        V4      Vn        \        V4      Vn        V# )zparsing VBAInfoAtom)r   rÏ   r|   r>   rO  rP  rÆ   r¯   s   && r   re   ÚVBAInfoAtom.extract_fromÎ  sR   € ä�	‰	Ð'Ô(Ù‹eˆØ×Ñ˜&Ô!ô
 $ F›^ˆÔô
 " &›>ˆÔô
 ˜V“nˆŒàˆ
r   c                óð   € V P                  V P                  R 7      pVP                  V P                  RV P                  R^4      4       VP                  V P                  RV P                  ^4      4       V# )rI  Ú
fHasMacrosNrÆ   )r•   rJ  r�   rŒ   rP  rU   rÆ   rÀ   s   & r   r   ÚVBAInfoAtom.check_validityå  sd   € à×"Ñ"¨$×*<Ñ*<Ð"Ó=ˆð 	�‰�D×$Ñ$ \°4×3DÑ3DÀdÈAÓNÔOØ�‰�D×$Ñ$ Y°·±¸aÓ@ÔAØˆr   )rP  rO  rÆ   )r&   r'   r(   r)   r*   r’   r�   rJ  r   rm   re   r   r+   r,   r-   r.   s   @@r   rF  rF  ¾  s>   ù‡ € ñð
 €KØ€NØ€Mõð ñó ð÷,ò r   rF  c                   óR   a a€ ] tR tRt oRtRt^t^ tRV 3R lltR t	R t
RtVtV ;t# )	ÚExternalObjectStorageiï  a$  storage for compressed/uncompressed OLE/VBA/ActiveX control data

Matches types ExOleObjStgCompressedAtom, ExOleObjStgUncompressedAtom,
VbaProjectStgCompressedAtom, VbaProjectStgUncompressedAtom,
ExControlStgUncompressedAtom, ExControlStgCompressedAtom

Difference between compressed and uncompressed: RecordHeader.rec_instance
is 0 or 1, first variable after RecordHeader is decompressed_size

Data is not read at first, only its offset in the stream and size is saved

e.g.
https://msdn.microsoft.com/en-us/library/dd952169%28v=office.12%29.aspx
i  c                óà   <€ \         \        V `  4        Vf	   R V n        M9V'       d   V P                  V n        RV n        MV P                  V n        RV n        R V n        R V n        R V n	        R # )NTF)
r   rX  r   r‘   ÚRECORD_INSTANCE_COMPRESSEDÚis_compressedÚRECORD_INSTANCE_UNCOMPRESSEDÚuncompressed_sizeÚdata_offsetÚ	data_size)r   r[  r$   s   &&€r   r   ÚExternalObjectStorage.__init__  se   ø€ ÜÔ# TÑ3Ô5ØÒ Ø#'ˆDÕ ßØ#'×#BÑ#BˆDÔ Ø!%ˆDÕà#'×#DÑ#DˆDÔ Ø!&ˆDÔØ!%ˆÔØˆÔØˆŽr   c                óZ  € \         P                  RP                  V P                  4      4       V P	                  V4       V P
                  P                  V n        V P                  '       d*   \        V4      V n	        V ;P                  ^,          un        VP                  4       V n        R# )zGnot a classmethod because of is_compressed attrib

see also: DummyType
z:Parsing ExternalObjectStorage (compressed={0}) from streamN)r   rÏ   r   r[  r|   rx   r]   r_  r>   r]  rà   r^  r{   s   &&r   re   Ú"ExternalObjectStorage.extract_from  sv   € ô
 	�	‰	ÐNß‘6˜$×,Ñ,Ó-ô	/à×Ñ˜6Ô"ØŸ™×.Ñ.ˆŒØ××ÐÜ%+¨F£^ˆDÔ"Ø�NŠN˜aÕ�NØ!Ÿ;™;›=ˆÖr   c                ó"   € V P                  4       # rY   )r•   r^   s   &r   r   Ú$ExternalObjectStorage.check_validity  s   € Ø×"Ñ"Ó$Ð$r   )r‘   r^  r_  r[  r]  rY   )r&   r'   r(   r)   r*   r’   rZ  r\  r   re   r   r+   r,   r-   r.   s   @@r   rX  rX  ï  s1   ù‡ € ñð €KØ!"ÐØ#$Ð ÷ò)÷%ò %r   rX  c                   ód   a a€ ] tR tRt oRt]P                  tV 3R lt]	V 3R l4       t
RtVtV ;t# )Ú!ExternalObjectStorageUncompressedi#  z;subclass of ExternalObjectStorage for uncompressed objects c                ó.   <€ \         \        V `  R 4       R# )FN)r   rf  r   r¨   s   &€r   r   Ú*ExternalObjectStorageUncompressed.__init__'  s   ø€ ÜÔ/°Ñ?ÀÖFr   c                ó<   <€ V ! 4       p\         \        V`  V4       V# ©zKnote the usage of super here: call instance method of super class!
        )r   rf  re   ©rb   r    rc   r$   s   && €r   re   Ú.ExternalObjectStorageUncompressed.extract_from*  s!   ø€ ñ ‹eˆÜÔ/°ÑBÀ6ÔJØˆ
r   r   )r&   r'   r(   r)   r*   rX  r\  r‘   r   rm   re   r+   r,   r-   r.   s   @@r   rf  rf  #  s2   ù‡ € ÙFØ+×HÑH€OõGð ôó ÷ð r   rf  c                   ód   a a€ ] tR tRt oRt]P                  tV 3R lt]	V 3R l4       t
RtVtV ;t# )ÚExternalObjectStorageCompressedi3  z9subclass of ExternalObjectStorage for compressed objects c                ó.   <€ \         \        V `  R 4       R# )TN)r   rn  r   r¨   s   &€r   r   Ú(ExternalObjectStorageCompressed.__init__7  s   ø€ ÜÔ-¨tÑ=¸dÖCr   c                ó<   <€ V ! 4       p\         \        V`  V4       V# rj  )r   rn  re   rk  s   && €r   re   Ú,ExternalObjectStorageCompressed.extract_from:  s!   ø€ ñ ‹eˆÜÔ-¨sÑ@ÀÔHØˆ
r   r   )r&   r'   r(   r)   r*   rX  rZ  r‘   r   rm   re   r+   r,   r-   r.   s   @@r   rn  rn  3  s2   ù‡ € ÙDØ+×FÑF€OõDð ôó ÷ð r   rn  c                ó   a € V 3R lpV# )zça decorator that can open and close the default stream for func

to be applied only to functions in PptParser that read from default stream
(:py:data:`MAIN_STREAM_NAME`)

Decorated functions need to accept args (self, stream, ...)
c                 ó¬  <€ R p V P                   fZ   \        P                  RP                  \        SP
                  4      4       V P                  P                  \        4      V n         RpS! W P                   .VO5/ VB V'       dV   \        P                  RP                  \        SP
                  4      4       V P                   P                  4        RV n         # #   \         d'    T P                  '       d   h T P                  4         Mi ; i T'       dW   \        P                  RP                  \        SP
                  4      4       T P                   P                  4        RT n         R# R#   T'       dV   \        P                  RP                  \        SP
                  4      4       T P                   P                  4        RT n         i i ; i©FNzopening stream {0!r} for {1}Tzclosing stream {0!r} after {1})Ú_open_main_streamr   rÏ   r   rš   r&   ÚoleÚ
openstreamÚcloseÚ	ExceptionÚ	fast_failÚ_log_exception)r   ÚargsÚkwargsÚstream_opened_by_meÚfuncs   &*, €r   ÚwrappedÚ(with_opened_main_stream.<locals>.wrappedN  sp  ø€ à#Ðð	.à×%Ñ%Ò-Ü—	‘	Ð8ß!™6Ô"2°D·M±MÓBôDà)-¯©×)<Ñ)<Ô=MÓ)N�Ô&Ø&*Ð#ñ ˜×4Ñ4ÐF°tÒF¸vÑF÷ #Ü—	‘	Ð:ß!™6Ô"2°D·M±MÓBôDà×&Ñ&×,Ñ,Ô.Ø)-�Õ&ð	 #øô ô 	&Ø�~�~ˆ~Øà×#Ñ#Ö%ð		&úð &÷ #Ü—	‘	Ð:ß!™6Ô"2°D·M±MÓBôDà×&Ñ&×,Ñ,Ô.Ø)-�Ö&ñ	 #ø×"Ü—	‘	Ð:ß!™6Ô"2°D·M±MÓBôDà×&Ñ&×,Ñ,Ô.Ø)-�Õ&ð	 #ús+   …A<C ÃDÃ<DÄE4 ÄDÄE4 Å4AGr   ©r€  r�  s   f r   Úwith_opened_main_streamr„  E  s   ø€ õ.ð6 €Nr   c                ó   a € V 3R lpV# )zAsame as with_opened_main_stream but with yield instead of return c              ?   ó  <"  € R p V P                   fZ   \        P                  RP                  \        SP
                  4      4       V P                  P                  \        4      V n         RpS! W P                   .VO5/ VB  F  pVx € K	  	  T'       dW   \        P                  RP                  \        SP
                  4      4       T P                   P                  4        RT n         R# R#   \         d'    T P                  '       d   h T P                  4         L�i ; i  T'       dV   \        P                  RP                  \        SP
                  4      4       T P                   P                  4        RT n         i i ; i5iru  )rv  r   rÏ   r   rš   r&   rw  rx  rz  r{  r|  ry  )r   r}  r~  r  Úresultr€  s   &*,  €r   r�  Ú2generator_with_opened_main_stream.<locals>.wrappedo  s6  øé € à#Ðð	.à×%Ñ%Ò-Ü—	‘	Ð8ß!™6Ô"2°D·M±MÓBôDà)-¯©×)<Ñ)<Ô=MÓ)N�Ô&Ø&*Ð#ñ ˜t×%;Ñ%;ÐM¸dÒMÀfÔM�Ø”ñ N÷ #Ü—	‘	Ð:ß!™6Ô"2°D·M±MÓBôDà×&Ñ&×,Ñ,Ô.Ø)-�Ö&ñ	 #øô ô 	&Ø�~�~ˆ~Øà×#Ñ#Ö%ð		&û÷ #Ü—	‘	Ð:ß!™6Ô"2°D·M±MÓBôDà×&Ñ&×,Ñ,Ô.Ø)-�Õ&ð	 #üs=   ƒF‡BC/ ÂA FÃ/D ÄD ÄD# ÄD Ä D# Ä#AFÆFr   rƒ  s   f r   Ú!generator_with_opened_main_streamr‰  l  s   ø€ õ.ð8 €Nr   c                   óÄ   a € ] tR tRt o RtRR ltRR ltR tR t]	R 4       t
]	R	 4       t]R
 4       t]R 4       t]R 4       t]	R 4       t]	R 4       t]R 4       tRtV tR# )Ú	PptParseriŽ  zNParser for PowerPoint 97-2003 specific data structures

requires an OleFileIO
c                ó
  € \        V\        P                  4      '       d   \        P	                  R4       Wn        M?\        P	                  RP                  V4      4       \        P                  ! V4      V n        W n        RV n        RV n	        RV n
        RV n        V P
                  P                  4       p\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   V P                  RRVR	4       V Uu. uF  qD^ ,          P                  4       NK  	  ppR
V9   g   V P                  RRVR4       \         P                  4       V9   g   V P                  RRV\         4       RV n        R# u upi )zÚconstructor

:param ole: OleFileIO or anything that OleFileIO constructor accepts
:param bool fast_fail: if True, all unexpected data will raise a
                       PptUnexpectedData; if False will only log error
zusing open OleFileIOzOpening file {0}Nc              3   ó>   "  € T F  p\        V4      ^8g  x € K  	  R# 5i)é   N)r=  )rG   r    s   & r   rI   Ú%PptParser.__init__.<locals>.<genexpr>±  s   é € Ð;©l FŒs�6‹{˜aÖ«lùs   ‚TFÚrootÚlistdirzlen = 1zcurrent userrM   )rN   ÚolefileÚ	OleFileIOr   rÏ   rw  r   r{  Úcurrent_user_atomÚnewest_user_editÚdocument_persist_objÚpersist_object_directoryr‘  ÚanyÚ_failÚlowerrš   rv  )r   rw  r{  Úroot_streamsr    s   &&&  r   r   ÚPptParser.__init__”  s*  € ô �cœ7×,Ñ,×-Ò-Ü�I‰IÐ,Ô-Ø�Hä�I‰IÐ(×/Ñ/°Ó4Ô5Ü×(Ò(¨Ó-ˆDŒHà"Œà!%ˆÔØ $ˆÔØ$(ˆÔ!Ø(,ˆÔ%ð —x‘x×'Ñ'Ó)ˆ÷ ‹3Ñ;©lÓ;�3�3Š3Ñ;©lÓ;×;Ò;Ø�J‰J�v˜y¨,¸	ÔBÙ8DÓE¹¨f˜q�	Ÿ™Ö)¹ˆÐEØ Ô-Ø�J‰J�v˜y¨,¸ÔGÜ×%Ñ%Ó'¨<Ô7Ø�J‰J�v˜y¨,Ô8HÔIà!%ˆÖùò Fs   Ä
F Nc                ó¢  € Ve   \         P                  ! 4       RR pM9\        P                  ! 4       w  r4p\         P                  ! V4      p\        V4      p\        P                  V4       \        \         P                  ! V4      4       F@  w  rgVP                  4        F'  p\        P                  RP                  Wh4      4       K)  	  KB  	  R# )zßlog an exception instead of raising it

call in one of 2 ways:
    try:
        if fail():
            self._log_exception('this is the message')
    except:
        self._log_exception()   # only possible in except clause
Nztrace {0}: {1}éÿÿÿÿ)Ú	tracebackÚextract_stackÚsysÚexc_infoÚ
extract_tbÚstrr   ÚerrorÚ	enumerateÚformat_listÚ
splitlinesrÏ   r   )	r   r   Ústackr  ÚexcÚtraceÚi_entryrõ   Úlines	   &&       r   r|  ÚPptParser._log_exception»  s™   € ð Š?Ü×+Ò+Ó-¨c¨rÐ2‰EäŸLšL›N‰MˆA�EÜ×(Ò(¨Ó/ˆEÜ�c“(ˆCÜ�	‰	�#Œä'¬	×(=Ò(=¸eÓ(DÖE‰NˆGØ×(Ñ(Ö*�Ü—	‘	Ð*×1Ñ1°'Ó@ÖAó +ó Fr   c                ó€   € V P                   '       d
   \        V!  hV P                  \        V!  P                  4       R# )zcdepending on self.fast_fail raise PptUnexpectedData or just log err

args as for PptUnexpectedData
N)r{  r   r|  r   )r   r}  s   &*r   r™  ÚPptParser._failÑ  s2   € ð
 �>�>ˆ>Ü# TÑ*Ð*à×ÑÔ 1°4Ñ 8× <Ñ <Ö=r   c                ó,  € V P                   e   \        P                  R4       \        P                  R4       Rp \        P                  R4       V P                  P                  R4      p\        P                  V4      V n         Te(   \        P                  R4       TP                  4        R# R#   \         d'    T P                  '       d   h T P                  4         L]i ; i  Te'   \        P                  R4       TP                  4        i i ; i)zœparse the CurrentUserAtom record from stream 'Current User'

Structure described in
https://msdn.microsoft.com/en-us/library/dd948895%28v=office.12%29.aspx
Nz<re-reading and overwriting previously read current_user_atomzparsing "Current User"zopening stream "Current User"rM   zclosing stream "Current User")r”  r   ÚwarningrÏ   rw  rx  rœ   re   rz  r{  r|  ry  r{   s   & r   Úparse_current_userÚPptParser.parse_current_userÛ  sÞ   € ð ×!Ñ!Ò-Ü�K‰Kð <ô =ô 	�	‰	Ð*Ô+àˆð	Ü�I‰IÐ5Ô6Ø—X‘X×(Ñ(¨Ó8ˆFÜ%4×%AÑ%AÀ&Ó%IˆDÔ"ð Ò!Ü—	‘	Ð9Ô:Ø—‘–ñ "øô ô 	&Ø�~�~ˆ~Øà×#Ñ#Ö%ð		&ûð Ò!Ü—	‘	Ð9Ô:Ø—‘•ð "ús*   ¼A
B3 Â3C$ÃC$Ã!C' Ã#C$Ã$C' Ã',Dc                ó¸  € V P                   e   \        P                  R4       V P                  f   V P	                  4        V P                  P
                  pV P                  P                  4       p/ V n         RV n        V^ 8w  EdÓ   VP                  V\        P                  4       \        P                  W4      pV P                  f   W@n        \        P                  R4       VP                  4       pV'       d.   \        P                  RP                  \!        V4      4      4       V F'  p\        P                  RP                  V4      4       K)  	  V'       d   V P"                  '       d
   V^ ,          h\        P                  RP                  VP$                  4      4       VP                  VP$                  \        P                  4       \&        P                  V4      p\        P                  R4       VP                  V4      pV'       d.   \        P                  RP                  \!        V4      4      4       V F'  p\        P                  RP                  V4      4       K)  	  V'       d   V P"                  '       d
   V^ ,          hVP(                   F¨  pVP*                  \!        VP,                  4      ,           ^,
          p	\        P                  RP                  VP*                  V	VP,                  4      4       \/        VP,                  4       F%  w  r¢VV P                   VP*                  V
,           &   K'  	  Kª  	  VP0                  pEKÚ  R# )	z/Part 1: Construct the persist object directory NzCre-reading and overwriting previously read persist_object_directoryúchecking validityúcheck_validity found {0} issuesz UserEditAtom.check_validity: {0}zseeking to pos {0}z(PersistDirectoryAtom.check_validity: {0}z)for persist IDs {0}-{1}, save offsets {2})r—  r   r²  r”  r³  r    r¬   r•  rá   râ   ÚSEEK_SETrÃ   re   rÏ   r   r   r=  r{  rÈ   rè   rê   rú   rü   r¦  rÇ   )r   r    rÔ   r¬   Ú	user_editr”   ÚerrÚpersist_dir_atomrõ   Úlast_idÚcounts   &&         r   Úparse_persist_object_directoryÚ(PptParser.parse_persist_object_directory÷  s�  € ð ×(Ñ(Ò4Ü�K‰Kð Cô Dð ×!Ñ!Ò)Ø×#Ñ#Ô%à×'Ñ'×>Ñ>ˆØ×-Ñ-×:Ñ:Ó<ˆØ(*ˆÔ%Ø $ˆÔð ˜�kð
 �K‰K˜¤§¡Ô,ô %×1Ñ1°&ÓGˆIØ×$Ñ$Ò,Ø(1Ô%ä�I‰IÐ)Ô*Ø×+Ñ+Ó-ˆDßÜ—‘Ð=ß#™V¤C¨£IÓ.ô0ã�Ü—‘Ð>×EÑEÀcÓJÖKñ ç˜ŸŸ˜Ø˜1•g�ô
 �I‰IÐ*ß‘v˜i×@Ñ@ÓAôCà�K‰K˜	×:Ñ:¼B¿K¹KÔHô  4×@Ñ@ÀÓHÐä�I‰IÐ)Ô*Ø#×2Ñ2°6Ó:ˆDßÜ—‘Ð=ß#™V¤C¨£IÓ.ô0ã�Ü—‘ÐFß#™V C›[ö*ñ ÷ ˜ŸŸ˜Ø˜1•g�ð* *×>Ô>�Ø×*Ñ*¬3¨u×/FÑ/FÓ+GÕGÈÕI�Ü—	‘	ÐEß!™6 %×"2Ñ"2°GØ"'×"9Ñ"9ó;ô<ô &/¨u×/FÑ/FÖ%G‘M�Eà ð ×1Ñ1°%×2BÑ2BÀ5Õ2HÓIó &Hñ ?ð ×/Ñ/‹FñY r   c                óJ  € V P                   e   \        P                  R4       V P                  f   V P	                  4        V P
                  P                  pV P                  V,          p\        P                  RP                  W#4      4       \        P                  RP                  V4      4       VP                  V\        P                  4       \        P                  V4      V n         \        P                  R4       V P                   P                  4       pV'       d.   \        P                  RP                  \        V4      4      4       V F'  p\        P                  RP                  V4      4       K)  	  V'       d   V P                   '       d
   V^ ,          hR# R# )z-Part 2: Identify the document persist object NzBre-reading and overwriting previously read document_persist_objectz)newest user edit ID is {0}, offset is {1}zseek to {0}r¶  r·  z)check_validity(document_persist_obj): {0})r–  r   r²  r—  r¾  r•  rÉ   rÏ   r   rá   râ   r¸  r  re   r   r=  r{  )r   r    Ú
newest_refrÔ   r”   rº  s   &&    r   Úparse_document_persist_objectÚ'PptParser.parse_document_persist_objectY  s8  € ð ×$Ñ$Ò0Ü�K‰Kð Bô Cð ×(Ñ(Ò0Ø×/Ñ/Ô1ð
 ×*Ñ*×=Ñ=ˆ
Ø×.Ñ.¨zÕ:ˆÜ�	‰	Ð=ß‘6˜*Ó-ô	/ô 	�	‰	�-×&Ñ& vÓ.Ô/Ø�‰�FœBŸK™KÔ(ô %6×$BÑ$BÀ6Ó$JˆÔ!ä�	‰	Ð%Ô&Ø×(Ñ(×7Ñ7Ó9ˆßÜ�K‰KÐ9×@Ñ@ÄÀTÃÓKÔLÛˆCÜ�K‰KÐCß™ ›ö&ñ ÷ �D—N—N�NØ�q•'ˆMñ #‰4r   c              #  ó’  "  € Rp\        V4      p\        P                  RP                  V4      4       WC8”  d   \	        R4      h^ p VP                  4       pV^,          pVP                  V4      pVP                  V4      pVR8w  dO   \        P                  RP                  Wh,           4      4       Wh,           x € VP                  W(^,           4      pKU  \        V4      V8X  d0   VP                  Wc,           V,
          \        P                  4       KÐ  \        P                  RP                  \        V4      W54      4       R# 5i)z-search for pattern in stream, return indices rM  zpattern length is {0}zneed buf > pattern to search!zfound pattern at index {0}z1reached end of buf (read {0}<{1}) after {2} readsNrž  )r=  r   rÏ   r   rh   rà   r5   Úfindrá   râ   r¸  )	r   r    ÚpatternÚBUF_SIZEÚpattern_lenÚn_readsÚ	start_posÚbufÚidxs	   &&&      r   Úsearch_patternÚPptParser.search_pattern…  sý   é € ð ˆä˜'“lˆÜ�	‰	Ð)×0Ñ0°Ó=Ô>ØÔ!ÜÐ<Ó=Ð=àˆØØŸ™›ˆIØ�q�LˆGð —+‘+˜hÓ'ˆCØ—(‘(˜7Ó#ˆCØ˜”)Ü—	‘	Ð6×=Ñ=¸i½mÓLÔMØ•oÒ%Ø—h‘h˜w¨A­Ó.’ä�3‹x˜8Ô#à—‘˜IÕ0°;Õ>ÄÇÁÖLä—	‘	ÐMß!™6¤# c£(¨HÓ>ô@áùs   ‚EEc              #  óæ  "  € \         P                  R4       \        P                  \        P                  R7      \
        P                  \
        P                  R7      ,           pV P                  V4       EFQ  pVP                  V4       \         P                  RP                  V4      4        \        P                  V4      pTP                  4       pT'       d/   \         P                  RP                  \        T4      4      4       Mi\         P                  R4       TP                  p\         P                  RP                  TP                   TP"                  TP$                  4      4       Tx € T F'  p\         P                  RP                  T4      4       K)  	  T'       g   EK6  T P&                  '       g   EKK  T^ ,          h	  R#   \         d    T P                  4         EKw  i ; i5i)	a0  search through stream for VBAInfoContainer, alternative to parse...

quick-and-dirty: do not parse everything, just look for right bytes

"quick" here means quick to program. Runtime now is linear is document
size (--> for big documents the other method might be faster)

.. seealso:: search_vba_storage
zlooking for VBA info containers)r]   úextracting at idx {0}r·  zcontainer is okz2persist id ref is {0}, has_macros {1}, version {2}z%check_validity(VBAInfoContainer): {0}N)r   rÏ   r  r˜   rJ  rF  rÍ  rá   r   re   rz  r|  r   r²  r=  rC  rO  rP  rÆ   r{  )r   r    rÆ  rÌ  Ú	containerr”   Úatomrº  s   &&      r   Úsearch_vba_infoÚPptParser.search_vba_info¥  s€  é € ô 	�	‰	Ð3Ô4ä"×3Ñ3Ü(8×(FÑ(Fð 4ó Hä×.Ñ.Ü(3×(AÑ(Að /ó CõCˆð ×&Ñ& w×/ˆCà�K‰K˜ÔÜ�I‰IÐ-×4Ñ4°SÓ9Ô:ðÜ,×9Ñ9¸&ÓA�	ð
 ×+Ñ+Ó-ˆDßÜ—‘Ð=ß#™V¤C¨£IÓ.õ0ô —	‘	Ð+Ô,Ø ×.Ñ.�Ü—	‘	ÐNß!™6 $×"5Ñ"5°t×7HÑ7HØ"&§,¡,ó0ô1ð  ’Û�Ü—‘ÐCß#™V C›[ö*ñ ÷ Št˜ŸŸ›Ø˜1•g�ó3 0øô ô Ø×#Ñ#Ô%Ûðüs=   ‚B-G1Â0GÃG1ÃC	G1Æ,G1ÇG1ÇG.Ç)G1Ç-G.Ç.G1c           	   #  ó¶  "  € \         P                  R4       \        \        3 EF‹  pVP	                  ^ \
        P                  4       VP                  4       pV P                  V4       EFA  pVP	                  V4       \         P                  RP                  V4      4        VP                  V4      pTP                  4       pT'       d/   \         P                  RP                  \        T4      4      4       MR\         P                  RP                  TP                   TP"                  P$                  TP&                  4      4       Tx € T F2  p\         P                  RP                  TP(                  T4      4       K4  	  T'       g   EK&  T P*                  '       g   EK;  T^ ,          h	  EKŽ  	  R#   \         d    T P                  4         EKl  i ; i5i)aµ  search through stream for VBAProjectStg, alternative to parse...

quick-and-dirty: do not parse everything, just look for right bytes

"quick" here means quick to program. Runtime now is linear is document
size (--> for big documents the other method might be faster)

The storages found could also contain (instead of VBA data): ActiveX
data or general OLE data

yields results as it finds them

.. seealso:: :py:meth:`search_vba_info`
zlooking for VBA storage objectsrÐ  r·  z8storage is ok; compressed={0}, size={1}, size_decomp={2}zcheck_validity({0}): {1}N)r   rÏ   rf  rn  rá   râ   r¸  r˜   rÍ  r   re   rz  r|  r   r²  r=  r[  rx   r]   r]  r&   r{  )r   r    Úobj_typerÆ  rÌ  Ústorager”   rº  s   &&      r   Úsearch_vba_storageÚPptParser.search_vba_storageÔ  sq  é € ô" 	�	‰	Ð3Ô4Ü:Ü8ô:ˆHð �K‰K˜œ2Ÿ;™;Ô'à×/Ñ/Ó1ˆGð ×*Ñ*¨7×3�à—‘˜CÔ Ü—	‘	Ð1×8Ñ8¸Ó=Ô>ðØ&×3Ñ3°FÓ;�Gð
 ×-Ñ-Ó/�ßÜ—K‘KÐ Aß!'¡¬¨D«	Ó!2õ4ô —I‘Ið 0ç%™v g×&;Ñ&;Ø&-×&6Ñ&6×&>Ñ&>Ø&-×&?Ñ&?ó AôBð
 "’MÛ�CÜ—K‘KÐ :ß!'¡¨×(9Ñ(9¸3Ó!?öAñ  ÷ ’4˜DŸNŸN›NØ˜q�'�Mô3 4ó:øô !ô Ø×'Ñ'Ô)Ûðüs=   ‚B GÂ#F6Â4GÃB=GÆGÆ$GÆ6GÇGÇGÇGc                óJ  € \         P                  R4       VP                  VP                  \        P
                  4       \        WP                  4      w  r4p\         P                  RP                  V\        V4      V4      4       V'       d   V P                  '       d   VhV# )z1return decompressed data from search_vba_storage z.decompressing storage for VBA OLE data stream z-decompressed {0} to {1} bytes; found err: {2})r   rÏ   rá   r^  râ   r¸  Úiterative_decompressr_  r   r=  r{  )r   r    r×  ÚdecompÚn_readrº  s   &&&   r   Údecompress_vba_storageÚ PptParser.decompress_vba_storage	  sz   € ô 	�	‰	ÐBÔCð 	�‰�G×'Ñ'¬¯©Ô5ä  ×):Ñ):Ó;ñ 	ˆ˜ä�	‰	ÐAß‘6˜&¤# f£+¨sÓ3ô	5ç�4—>—>�>ØˆIð ˆr   c                ó  € \         P                  RP                  VP                  VP                  4      4       VP                  VP                  \        P                  4       VP                  VP                  4      pV# )z/return data pointed to by uncompressed storage zCreading uncompressed VBA OLE data stream: {0} bytes starting at {1})	r   rÏ   r   r_  r^  rá   râ   r¸  r5   )r   r    r×  Údatas   &&& r   Úread_vba_storage_dataÚPptParser.read_vba_storage_data'  sa   € ô 	�	‰	ð .ç‘6˜'×+Ñ+¨W×-@Ñ-@ÓAô	Cð 	�‰�G×'Ñ'¬¯©Ô5Ø�{‰{˜7×,Ñ,Ó-ˆØˆr   c              #  óº  "  € ^ p^ pV P                  4        F2  pV^,          pVP                  P                  ^ 8”  g   K)  V^,          pK4  	  ^ p^ pV P                  4        FO  pV^,          pVP                  '       d   V^,          pV P                  V4      x € K<  V P                  V4      x € KQ  	  \        P                  RP                  W#WV4      4       R# 5i)z?search vba infos and storages, yield uncompressed storage data zCfound {0} infos ({1} with macros) and {2} storages ({3} compressed)N)
rÓ  rC  rP  rØ  r[  rÞ  râ  r   r<  r   )r   r    Ún_infosÚn_macrosr<  Ú
n_storagesÚn_compressedr×  s   &&      r   Úiter_vba_dataÚPptParser.iter_vba_data2  sÊ   é € ð ˆØˆØ×(Ñ(Ö*ˆDØ�q�LˆGØ×!Ñ!×.Ñ.°Ö2Ø˜A•’ñ +ð ˆ
ØˆØ×.Ñ.Ö0ˆGØ˜!�OˆJØ×$×$Ð$Ø Õ!�Ø×1Ñ1°'Ó:Ô:à×0Ñ0°Ó9Ô9ñ 1ô 	�‰ð $ç‘&˜¨JÓEö	Gùs   ‚9CÁ BC)rv  r”  r–  r{  r•  rw  r—  )FrY   )r&   r'   r(   r)   r*   r   r|  r™  r³  r„  r¾  rÂ  r‰  rÍ  rÓ  rØ  rÞ  râ  ré  r+   r,   rn   s   @r   r‹  r‹  Ž  sÈ   ø‡ € ñô
%&ôNBò,>òð8 ñ_0ó ð_0ðB ñ$ó ð$ðV 'ñó 'ðð> 'ñ,ó 'ð,ð\ 'ñ2"ó 'ð2"ðh ñó ðð: ñó ðð 'ñGó 'öGr   r‹  c                ó  € \         P                  ! 4       p^ pRpRp WA8  dC   \        W,
          V4      pWSP                  V P	                  V4      4      ,          pWG,          pKH   WTV3#   \         P
                   d   pTp Rp?L Rp?ii ; i)z'decompress data from stream chunk-wise r   N)ÚzlibÚdecompressobjr  Ú
decompressr5   r¥  )	r    rž   Ú
chunk_sizeÚdecompressorrÝ  rÜ  Ú
return_errÚn_newrº  s	   &&&      r   rÛ  rÛ  M  s‰   € ô ×%Ò%Ó'€LØ€FØ€FØ€JðØŒmÜ˜� ZÓ0ˆEØ×-Ñ-¨f¯k©k¸%Ó.@ÓAÕAˆFØ�OŠFð ð ˜:Ð%Ð%øô �:‰:ô Ø�
ûðús   �AA* Á*BÁ?BÂBÚ__main__znothing here to run!)i   )5r*   Ú__version__r¡  r   r3   rŸ  râ   rì  ÚpathÚnormpathÚabspathÚdirnameÚ__file__Ú_thismodule_dirrQ   Ú_parent_dirÚinsertr’  ÚCRITICALr   r   r   rš   ÚURL_OLEVBA_ISSUESÚMSG_OLEVBA_ISSUESrz  r   r7   r;   r>   rU   ÚobjectrW   rp   rœ   rÃ   r×   rè   rî   r	  r  r  r  rF  rX  rf  rn  r„  r‰  r‹  rÛ  r&   Úprintr   r   r   Ú<module>r     s	  ðñðZ €ó
 Û Û Û Û 	Û ð —'‘'×"Ñ" 2§7¡7§?¡?°2·7±7·?±?À8Ó3LÓ#MÓN€à�g‰g×Ñ˜rŸw™wŸ|™|¨O¸TÓBÓC€à�c—h‘hÔØ‡H�H‡O�O�A�{Ô#ã ð #×+Ñ+¨AÕ-ô ñ< �Ó€ò!ð )Ð ð EÐ Ø4Ð7HÕHÐ ô:˜	ô :ò2ò
2ò
2ò
Aô"(L�6ô (LôVqNˆfô qNôhP�gô PôfJ�7ô Jô^%7�ô %7ôP/˜7ô /ôdL˜Fô Lô^,2 Gô ,2ô^,˜7ô ,ô^d˜ô dôN �wô  ôF.�'ô .ôb1%˜Gô 1%ôhÐ(=ô ô Ð&;ô ò$$òNôD|G�ô |Gô~&ð& ˆzÔÙ	Ð
 Ö!ñ r   