ó
    �®žjÀV  ã                   óv  • S r SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJrJrJrJr  SSKJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#  SSK$J%r%  \RL                  " \'5      r(\" S	5      r)S
r*Sr+S\+ S3r,S\+ S3r-S\+ S3r.Sr/S\+ S3r0S\+ S3r1S\+ S3r2S\+ S3r3S\+ S3r4S\+ S3r5S\/ S3r6S\+ S3r7S\+ S3r8S\+ S3r9S\+ S3r:S\+ S3r;Sr<S\+ S3r=S\+ S3r>S\+ S 3r?S!r@\A" \=\>15      rB S\+ S"3rCS\+ S#3rDS\+ S$3rES\+ S%3rFS\+ S&3rGS\+ S'3rHS\+ S(3rI S)rJ \A" 1 S*k5      rK S\+ S+3rL S\+ S,3rMS-rN S\+ S.3S/S\+ S03S1S\+ S23S3S\+ S43S50rO S\+ S63rPS\+ S73rQS\+ S83rRS\+ S93rS\A" \P\Q\R\S15      rT S\+ S:3rUS\+ S;3rVS\+ S<3rWS\/ S=3rX S>\R²                  S?\ZS@\[SA\ZSB\	4
SC jr\S>\R²                  S?\ZS@\[SA\ZSB\4
SD jr]SE\	SB\S-  4SF jr^SG\	S>\R²                  SB\S-  4SH jr_SI\	SJ\ZSB\ZS-  4SK jr`SI\	SJ\ZSB\[S-  4SL jraSM\	SB\b\	   4SN jrcSO\	SP\d\ZS-  \S-  4   SB\e\SQ4   4SR jrfSM\	SS\ZST\d\ZS-  \ZS-  4   SP\d\ZS-  \S-  4   SB\b\   4
SU jrgSM\	SB\b\   4SV jrhSM\	SS\ZSW\\	/\)4   SB\d\ZS-  \)4   4SX jriSM\	SB\d\Z\4   4SY jrjSO\	SZ\d\Z\4   SB\S-  4S[ jrkS\\	SB\S-  4S] jrlS^\ZSB\[4S_ jrmg)`ax  Reader for the ``index.xml`` of an iWork '09 (and earlier) document.

Pages wrote a plain XML tree before 2013, in the ``sf`` namespace, and the
content the modern container keeps in an object graph is spelled out in elements
and attributes instead. Page furniture and comments each carry their own
``sf:text-body``, so the body walk prunes them and they are read separately.
é    N)ÚCallable)ÚTypeVar)ÚElement)Ú
FormattingÚScriptÚ	TableCellÚ	TableData)ÚLABEL_TYPE_NONEÚLABEL_TYPE_NUMBERÚLABEL_TYPE_STRINGÚSCRIPTSÚBlockÚCommentÚContentÚ	ListLabelÚ	ListStyleÚ	ParagraphÚPictureÚRunÚbuild_formattingÚcleanÚlabel_for_styleÚtrimÚunique_paragraphs)ÚDocumentLoadErrorÚ_Ti  @z(http://developer.apple.com/namespaces/sfÚ{z}pz}ghost-textz}paragraphstylez)http://developer.apple.com/namespaces/sfaz}identz}namez}stylez}numcolsz}numrowsz}num-header-rowsz}sz}tabular-modelz}gridz}ctz}spanz}characterstylez1{http://developer.apple.com/namespaces/sfa}numberz}mediaz}imagez}dataÚpathz
}liststylez}list-label-typeinfoz}text-labelz}typez}formatz}list-levelz}list-styleÚnone>   ÚtextÚimageÚbulletÚstringz}superscriptz}linkÚhrefz}boldÚboldz}italicÚitalicz
}underlineÚ	underlinez}strikethruÚstrikethroughz}headerz}footerz
}footnotesz}annotationsz}annotationz}annotation-fieldz}targetz}IDÚarchiveÚmemberÚmax_total_bytesÚdocument_hashÚreturnc           	      óà  • U R                  U5      nUR                  S5      (       a]  [        [        U5      n [        R
                  " SS9nUR                  XE5      nUR                  (       a  [        SU SU SU S35      e  [        R                  " U5      $ ! [        R                   a  n[        SU SU S	35      UeS
nAff = f! [         a  n[        SU SU S	35      UeS
nAff = f)aš  Decompress and parse the ``index.xml`` of an iWork '09 document.

Args:
    archive: The open ``.pages`` container.
    member: The name of its index member.
    max_total_bytes: The largest index this is willing to decompress to.
    document_hash: The document's hash, for error messages.

Returns:
    The parsed root element.

Raises:
    DocumentLoadError: If the member cannot be decompressed or parsed.
z.gzé   )ÚwbitsÚ'z' in Pages document with hash z expands beyond the z byte limit.zCould not decompress 'Ú.NzCould not parse ')ÚreadÚendswithÚminÚMAX_LEGACY_XML_BYTESÚzlibÚdecompressobjÚ
decompressÚunconsumed_tailr   ÚerrorÚETÚ
fromstringÚ	Exception)r)   r*   r+   r,   ÚrawÚlimitÚdecompressorÚexcs           Ú\/home/mande/repo/quber/.venv/lib/python3.13/site-packages/docling/backend/iwork/pages_xml.pyÚ_parse_indexrD   ¿   s  € ð" �,‰,�vÓ
€CØ‡��u×Ñô Ô(¨/Ó:ˆð	Ü×-Ò-°BÑ7ˆLØ×)Ñ)¨#Ó5ˆCØ×+×+Ü'Ø˜�xÐ=¸m¸_ð M*Ø*/¨°ð>óð ð ,ðÜ�}Š}˜SÓ!Ð!øô �z‰zó 	Ü#Ø(¨¨Ð0NØ �/ ð$óð ðûð	ûô ó ÜØ ˜xÐ'EÀmÀ_ÐTUÐVó
àð	ûðús0   ¹AB ÂC ÂCÂ0CÃCÃ
C-ÃC(Ã(C-c                 ój  ^^^• [        XX#5      m[        T[        S 5      m[        T[        [        5      m[        T5      n/ n[        T5       GH  nUR                  [        :X  a!  [        U5      nUb  UR                  U5        M9  UR                  [        ;   a!  [        X`5      nUb  UR                  U5        Mn  [        UT5      n	U	(       d  Mƒ  UR                  [        5      n
[!        TR                  U
5      5      u  p¼[#        S UR%                  [&        5       5       5      nUR                  [)        U	UU[+        Xd5      [#        S U 5       5      5      5        GM     S[,        S[.        [(           4UUU4S jjn[1        UU" [2        5      U" [4        5      U" [6        5      [9        T5      S9$ )aÃ  Read the content of an iWork '09 document out of its ``index.xml``.

Args:
    archive: The open ``.pages`` container, which also holds any image data.
    member: The name of its index member.
    max_total_bytes: The largest index this is willing to decompress to.
    document_hash: The document's hash, for error messages.

Returns:
    Everything the document holds.

Raises:
    DocumentLoadError: If the index cannot be decompressed or parsed.
c                 ó,   • U R                  [        5      $ ©N)ÚgetÚSF_ATTR_NAME)Úelements    rC   Ú<lambda>Úread_content.<locals>.<lambda>  s   € °'·+±+¼lÔ2Kó    c              3   ó\   #   • U  H"  oR                  [        5      =(       d    S v •  M$     g7f)Ú N)rH   ÚSFA_ATTR_ID)Ú.0Úfields     rC   Ú	<genexpr>Úread_content.<locals>.<genexpr>  s#   é € ð 
Ú6W¨U�I‰I”kÓ"×( bÔ(Ò6Wùs   ‚*,c              3   ó6   #   • U  H  o(       d  M  Uv •  M     g 7frG   © )rQ   Úanchors     rC   rS   rT   #  s   é € Ð=ª7 ³f—f‘fª7ùs   ‚
�	Útagr-   c                 ó    >• [        TU TT5      $ rG   )Úlegacy_furniture)rX   Úcharacter_stylesÚrootÚstyle_namess    €€€rC   Ú	furnitureÚread_content.<locals>.furniture'  s   ø€ Ü  c¨;Ð8HÓIÐIrM   )ÚblocksÚheadersÚfootersÚ	footnotesÚcomments)rD   Úlegacy_stylesÚSF_PARAGRAPH_STYLEÚSF_CHARACTER_STYLEÚlegacy_formattingÚlegacy_list_stylesÚiter_body_elementsrX   ÚSF_TABULAR_MODELÚlegacy_tableÚappendÚSF_MEDIA_ELEMENTSÚlegacy_pictureÚlegacy_runsrH   ÚSF_ATTR_STYLEr   ÚtupleÚiterÚSF_ANNOTATION_FIELDr   Úlegacy_list_labelÚstrÚlistr   Ú	SF_HEADERÚ	SF_FOOTERÚSF_FOOTNOTESÚlegacy_comments)r)   r*   r+   r,   Úlist_stylesr`   rJ   ÚtableÚpictureÚrunsÚstyleÚlabelÚlevelÚanchorsr^   r[   r\   r]   s                  @@@rC   Úread_contentr„   ì   s‹  ú€ ô( ˜¨ÓH€DÜØÔ Ñ"Kó€Kô % TÔ+=Ô?PÓQÐä$ TÓ*€Kà€FÜ% d×+ˆØ�;‰;Ô*Ó*Ü  Ó)ˆEØÑ Ø—‘˜eÔ$ÙØ�;‰;Ô+Ó+Ü$ WÓ6ˆGØÑ"Ø—‘˜gÔ&Ùä˜7Ð$4Ó5ˆÞÙØ—‘œMÓ*ˆÜ& {§¡°uÓ'=Ó>‰ˆÜñ 
Ø6=·l±lÔCVÔ6Wó
ó 
ˆð 	�‰ÜØØØÜ! 'Ó7ÜÑ=©7Ó=Ó=ó÷	
ñ) ,ð<J”sð Jœt¤I™÷ Jñ Jô ØÙœ)Ó$Ùœ)Ó$ÙœLÓ)Ü  Ó&ñð rM   Úmodelc                 óœ  • [        [        U R                  [        5      5      S5      nUc  g[        U[        5      n[        U[
        5      n[        U [        5      =(       d    SnU(       a  U(       d  gU R                  [        5       Vs/ s HU  n[        UR                  [        5      =(       d    SR                  UR                  5       5      5      R                  5       PMW     nnU(       d  g/ n[        USX#-   5       H7  u  p‰[        X‚5      u  p«UR!                  [#        U	U
U
S-   UUS-   X¤:  S95        M9     [%        X2US9$ s  snf )aJ  Build table data from one ``sf:tabular-model`` of an '09 document.

Cells are stored flat in ``sf:datasource``, in row-major order, so the grid
dimensions on ``sf:grid`` are what give them their positions.

Args:
    model: An ``sf:tabular-model`` element.

Returns:
    The table, or None when its grid or its cells are missing.
Nr   rO   é   )r    Ústart_row_offset_idxÚend_row_offset_idxÚstart_col_offset_idxÚend_col_offset_idxÚcolumn_header)Únum_rowsÚnum_colsÚtable_cells)Únextrs   ÚSF_GRIDÚint_attrÚSF_ATTR_NUMCOLSÚSF_ATTR_NUMROWSÚSF_ATTR_HEADER_ROWSÚSF_CELL_TEXTr   rH   ÚSFA_ATTR_STRINGÚjoinÚitertextÚstripÚ	enumerateÚdivmodrm   r   r	   )r…   ÚgridrŽ   r�   Úheader_rowsÚcellÚvaluesÚcellsÚindexr    ÚrowÚcols               rC   rl   rl   3  s)  € ô ”�U—Z‘Z¤Ó(Ó)¨4Ó0€DØ�|Øä˜œoÓ.€HÜ˜œoÓ.€HÜ˜5Ô"5Ó6×;¸!€KÞž8Øð —J‘Jœ|Ô,óâ,ˆDô 	ˆd�h‰h”Ó'×C¨2¯7©7°4·=±=³?Ó+CÓD×JÑJÖLÙ,ð ð ö Øà€EÜ  Ð(=¨(Ñ*=Ð!>Ö?‰ˆÜ˜%Ó*‰ˆØ�‰ÜØØ%(Ø#&¨¡7Ø%(Ø#&¨¡7Ø!Ñ/ñö		
ñ @ô ˜hÀuÑMÐMùò+s   ÂAE	Úmediac                 ó  • U R                  [        5       H8  n[        U[        5      nU(       d  M   [	        UR                  U5      U5      s  $    g! [         a'    [        R                  SU5        [	        SU5      s s  $ f = f)zïRead an '09 image, whose bytes are a member of the container.

Args:
    media: An ``sf:media`` or ``sf:image`` element.
    archive: The open ``.pages`` container.

Returns:
    The picture, or None when the element names no stored data.
z%Pages image data member %s is missingN)	rs   ÚSF_DATAÚsf_attrÚSF_ATTR_PATHr   r3   ÚKeyErrorÚ_logÚdebug)r¥   r)   Údatar   s       rC   ro   ro   a  sv   € ð —
‘
œ7Ö#ˆÜ�tœ\Ó*ˆÞÙð	'Ü˜7Ÿ<™<¨Ó-¨tÓ4Ò4ñ $ð øô ó 	'Ü�J‰JÐ>ÀÔEÜ˜4 Ó&Ô&ð	'ús   ³AÁ,BÂBrJ   Únamec                 óh   • U R                  S[         SU 35      =(       d    U R                  U5      $ )u˜  Read an attribute iWork '09 may or may not have qualified.

Most attributes carry the ``sf`` namespace, but a few â€” ``href`` on
``sf:link`` among them â€” are written unqualified, and which spelling a
document uses varies with the release that wrote it.

Args:
    element: The element to read.
    name: The local name of the attribute.

Returns:
    The attribute's value under either spelling, or None.
r   Ú})rH   ÚSF_NAMESPACE)rJ   r®   s     rC   r¨   r¨   w  s.   € ð �;‰;˜œL˜>¨¨D¨6Ð2Ó3×H°w·{±{À4Ó7HÐHrM   c                 ód   • U R                  U5      nUc  g [        U5      $ ! [         a     gf = f)zARead an integer attribute, tolerating absent or malformed values.N)rH   ÚintÚ
ValueError)rJ   r®   r?   s      rC   r’   r’   ˆ  s8   € à
�+‰+�dÓ
€CØ
�{ØðÜ�3‹xˆøÜó Ùðús   —
" ¢
/®/r\   c                 ó˜  • / nU /nU(       a½  UR                  5       nUR                  [        :X  d  UR                  [        :X  a  UR	                  U5        MR  UR                  [
        ;   a  UR	                  U5        My  [        [        U5      5       H*  nUR                  [        ;  d  M  UR	                  U5        M,     U(       a  M½  U$ )a~  Collect the body content of an '09 document, skipping page furniture.

Headers, footers and footnotes each hold their own ``sf:text-body``, so a
plain ``root.iter()`` would pull their paragraphs into the body flow. They
are pruned instead, which matches the IWA reader: it follows
``TP.DocumentArchive`` to the body storage and never sees them.

A table and an image are not descended into once found, so the paragraphs
inside a table cell stay in the table rather than reappearing as body text.

Args:
    root: The parsed ``index.xml`` root element.

Returns:
    The paragraph, table and image elements of the body, in document order.
)	ÚpoprX   ÚSF_PARAGRAPHrk   rm   rn   Úreversedrw   ÚSF_FURNITURE)r\   ÚelementsÚstackÚnodeÚchilds        rC   rj   rj   “  sœ   € ð" !€Hð !˜6€Eæ
Ø�y‰y‹{ˆØ�8‰8”|Ó# t§x¡xÔ3CÓ'CØ�O‰O˜DÔ!ÙØ�8‰8Ô(Ó(Ø�O‰O˜DÔ!ÙÜœd 4›jÖ)ˆEØ�y‰y¤Õ,Ø—‘˜UÖ#ñ *÷ ˆ%ð €OrM   Ú	paragraphr[   .c                 ó  • / nU SSS4/nU(       Gag  UR                  5       u  pEpgU(       aA  UR                  (       a.  UR                  [        [	        UR                  5      XV5      5        Mc  UR
                  (       a.  UR                  [        [	        UR
                  5      XV5      5        [        [        U5      5       H«  nUR                  X…US45        UR                  [        :X  a  M-  Un	UR                  [        :X  a%  UR                  UR                  [        5      U5      n	Un
UR                  [        :X  a  [        U[        5      =(       d    Un
UR                  X‰U
S45        M­     U(       a  GMg  [!        U5      $ )am  Build the runs of an iWork '09 paragraph.

``sf:span`` carries the character style, so the paragraph is walked span by
span rather than flattened. Template placeholder text is skipped, as
``itertext()`` would otherwise emit what the template displays before the
author types anything.

Walked with an explicit stack: nesting depth is attacker-controlled, and a
recursive walk exhausts the interpreter stack on a deeply nested document.

Args:
    paragraph: An ``sf:p`` element.
    character_styles: Character style formatting, keyed by style identifier.

Returns:
    The paragraph's non-empty runs, in document order.
NFT)r¶   Útailrm   r   r   r    r¸   rw   rX   ÚSF_GHOST_TEXTÚSF_SPANrH   rq   ÚSF_LINKr¨   ÚSF_ATTR_HREFr   )r¾   r[   r   r»   rJ   Ú
formattingÚlinkÚ	want_tailr½   Ú	inheritedÚnesteds              rC   rp   rp   ¸  s+  € ð( €Dð 
�D˜$ Ð&ðH€E÷ Ø/4¯y©y«{Ñ,ˆ˜TæØ�|�|Ø—‘œC¤ g§l¡lÓ 3°ZÓFÔGÙà�<�<Ø�K‰KœœE '§,¡,Ó/°ÓBÔCô œd 7›mÖ,ˆEØ�L‰L˜%¨T°4Ð8Ô9Ø�y‰yœMÓ)ÙØ"ˆIØ�y‰yœGÓ#Ø,×0Ñ0°·±¼=Ó1IÈ:ÓV�	ØˆFØ�y‰yœGÓ#Ü  ¬Ó5×=¸�Ø�L‰L˜%¨F°EÐ:Ö;ñ -÷ ‰%ô2 �‹:ÐrM   rX   r]   c           	      ó@  • / nU R                  U5       H}  nUR                  [        5       Ha  n[        Xc5      nU(       d  M  [        UR	                  UR	                  [
        5      5      5      u  p‰UR                  [        XxU	5      5        Mc     M     [        U5      $ )a7  Read the paragraphs of one kind of '09 page furniture.

Pages writes a first-page, an even-page and an odd-page variant of every
header and footer whether or not the author filled them in, so identical
text is emitted once.

Args:
    root: The parsed ``index.xml`` root element.
    tag: The furniture element to collect, one of :data:`SF_FURNITURE`.
    style_names: Paragraph style names, keyed by style identifier.
    character_styles: Character style formatting, keyed by style identifier.

Returns:
    The furniture's non-empty paragraphs, in document order.
)	rs   r·   rp   r   rH   rq   rm   r   r   )
r\   rX   r]   r[   Ú
paragraphsrJ   Úparar   r�   r‚   s
             rC   rZ   rZ   î  s~   € ð* #%€JØ—9‘9˜S–>ˆØ—L‘L¤Ö.ˆDÜ˜tÓ6ˆDÞÙÜ*¨;¯?©?¸4¿8¹8ÄMÓ;RÓ+SÓT‰LˆEØ×Ñœi¨°UÓ;Ö<ó /ñ "ô ˜ZÓ(Ð(rM   c           	      ó2  • / nU R                  [        5       H{  nSR                  S UR                  [        5       5       5      R	                  5       nU(       d  ME  UR                  [        X2R                  [        5      =(       d    S5      5        M}     U$ )a=  Read the comments of an '09 document, with the text each one annotates.

An ``sf:annotation`` holds its text in a storage of its own and names the
``sf:annotation-field`` in the body that it targets.

Args:
    root: The parsed ``index.xml`` root element.

Returns:
    One comment per annotation, in document order.
Ú c              3   óf   #   • U  H'  nS R                  S [        U0 5       5       5      v •  M)     g7f)rO   c              3   ó8   #   • U  H  oR                   v •  M     g 7frG   )r    )rQ   Úruns     rC   rS   Ú,legacy_comments.<locals>.<genexpr>.<genexpr>  s   é € Ð>Ò(= —H–HÒ(=ùs   ‚N)r˜   rp   )rQ   rÌ   s     rC   rS   Ú"legacy_comments.<locals>.<genexpr>  s0   é € ð 
â5�ð �G‰GÑ>¬°D¸"Ô(=Ó>×>Ð>Ú5ùs   ‚/1rO   )	rs   ÚSF_ANNOTATIONr˜   r·   rš   rm   r   rH   ÚSF_ATTR_TARGET)r\   rd   Ú
annotationr    s       rC   r{   r{     sy   € ð !€HØ—i‘i¤Ö.ˆ
Ø�x‰xñ 
à"Ÿ™¬Ô5ó
ó 
÷ ‰%‹'ð 	÷ ˆ4Ø�O‰OœG D¯.©.¼Ó*H×*NÈBÓOÖPñ /ð €OrM   Údecodec                 ó  • 0 nU R                  U5       Hj  nUR                  [        5      UR                  [        5      /n[	        U5      (       d  M?  U" U5      nU H  nU(       d  M  UR                  Xv5        M     Ml     U$ )a,  Read one kind of iWork '09 style, keyed by every name it answers to.

A paragraph or a span names its style through ``sf:style``, and what it puts
there is sometimes the style's ``sf:ident`` and sometimes its ``sfa:ID``.
Both are indexed so a reference resolves either way; a style that carries
neither cannot be referenced at all and is skipped.

Args:
    root: The parsed ``index.xml`` root element.
    tag: The style element to collect.
    decode: Reads one style element into the value to key.

Returns:
    The decoded styles, keyed by identifier.
)rs   rH   ÚSF_ATTR_IDENTrP   ÚanyÚ
setdefault)r\   rX   r×   ÚstylesrJ   ÚkeysÚvalueÚkeys           rC   re   re   %  sp   € ð$ $&€FØ—9‘9˜S–>ˆØ—‘œMÓ*¨G¯K©K¼Ó,DÐEˆÜ�4�y‰yÙÙ�w“ˆÛˆCßˆsØ×!Ñ! #Ö-ó ñ "ð €MrM   c           	      ó   ^
• 0 m
U R                  [        5       GH°  nUR                  [        5      UR                  [        5      /n[        U
4S jU 5       5      (       d  MJ  / n/ nUR                  [        5       GH  nUR                  [        5      [        :X  a(  UR                  [        5        UR                  S5        MI  [        [        UR                  [        5      5      S5      nUb  UR                  [        5      OSnUb2  U[        ;  a(  UR                  [        5        UR                  S5        MÀ  UR                  [        5        UR                  Ub  UR                  [         5      =(       d    SOS5        GM
     [#        [%        U5      [%        U5      5      nU H  n	U	(       d  M  T
R'                  X˜5        M     GM³     T
$ )zÓRead the ``sf:liststyle`` definitions of an '09 document by identifier.

Args:
    root: The parsed ``index.xml`` root element.

Returns:
    The label ladder of every named list style, keyed by its identifier.
c              3   ó>   >#   • U  H  o=(       a    UT;  v •  M     g 7frG   rV   )rQ   rß   rÜ   s     €rC   rS   Ú%legacy_list_styles.<locals>.<genexpr>P  s   øé € Ð=º°×,˜3 fÑ,Ô,ºùs   ƒrO   N)rs   ÚSF_LIST_STYLErH   rÙ   rP   rÚ   ÚSF_LIST_LABEL_TYPEÚSF_ATTR_TYPEÚSF_LABEL_TYPE_NONErm   r
   r�   ÚSF_TEXT_LABELÚSF_BULLET_LABEL_TYPESr   r   ÚSF_ATTR_FORMATr   rr   rÛ   )r\   rJ   rÝ   Úlabel_typesÚstringsr‚   Ú
text_labelÚkindr€   rß   rÜ   s             @rC   ri   ri   C  sg  ø€ ð $&€Fà—9‘9œ]×+ˆØ—‘œMÓ*¨G¯K©K¼Ó,DÐEˆÜÔ=¹Ó=×=Ñ=Ùà!#ˆØˆØ—\‘\Ô"4×5ˆEØ�y‰yœÓ&Ô*<Ó<Ø×"Ñ"¤?Ô3Ø—‘˜rÔ"ÙÜœd 5§:¡:¬mÓ#<Ó=¸tÓDˆJØ3=Ñ3I�:—>‘>¤,Ô/ÈtˆDØÑ DÔ0EÓ$Eð ×"Ñ"Ô#4Ô5Ø—‘˜rÔ"ÙØ×ÑÔ0Ô1Ø�N‰NØ:DÑ:P�—‘¤Ó/×5°2øÐVX÷ñ 6ô$ œ% Ó,¬e°G«nÓ=ˆÛˆCßˆsØ×!Ñ! #Ö-ô ñ5 ,ð< €MrM   r|   c                 óÒ   • UR                  U R                  [        5      =(       d    S5      nUc  g[        U [        5      =(       d    SnUR	                  [        US-
  S5      5      $ )a)  Return how an '09 paragraph is labelled as a list item, if it is one.

Args:
    paragraph: An ``sf:p`` element.
    list_styles: The document's list styles, keyed by identifier.

Returns:
    The label, or None when the paragraph names no list style or the style
    leaves its level unlabelled.
rO   Nr‡   r   )rH   ÚSF_ATTR_LIST_STYLEr’   ÚSF_ATTR_LIST_LEVELr�   Úmax)r¾   r|   r€   r‚   s       rC   ru   ru   o  sU   € ð �O‰O˜IŸM™MÔ*<Ó=×CÀÓD€EØ�}Øä�YÔ 2Ó3×8°q€EØ�;‰;”s˜5 1™9 aÓ(Ó)Ð)rM   r€   c                 ór  • [        5       nSnU R                  5        H�  n[        S U 5       S5      nUS;   a  M  [        R	                  UR
                  5      nUb  UR                  U5        MS  UR
                  [        :X  d  Mi  Uc  Mn  [        R                  " [        U5      5      nM�     [        X5      $ )zERead an iWork '09 character style's property map as a ``Formatting``.Nc              3   ó|   #   • U  H2  nUR                  [        5      c  M  UR                  [        5      v •  M4     g 7frG   )rH   ÚSFA_ATTR_NUMBER)rQ   r½   s     rC   rS   Ú$legacy_formatting.<locals>.<genexpr>‹  s1   é € ð â$�EØ—9‘9œ_Ó-ó +�—	‘	œ/×*Ð*Ú$ùs   ‚< <)NÚ0)Úsetrs   r�   ÚSF_PROPERTY_LABELSrH   rX   ÚaddÚSF_SUPERSCRIPTr   Úas_intr   )r€   ÚactiveÚscriptrJ   Únumberr�   s         rC   rh   rh   „  s�   € ä“u€FØ €Fà—:‘:–<ˆÜñá$óð
 ó
ˆð �[Ó Ùä"×&Ñ& w§{¡{Ó3ˆØÑØ�J‰J�uÖØ�[‰[œNÕ*¨vÓ/AÜ—[’[¤¨£Ó0ŠFñ!  ô$ ˜FÓ+Ð+rM   rþ   c                 óL   •  [        [        U 5      5      $ ! [         a     gf = f)z?Read an iWork property number, which may be written as a float.r   )r³   Úfloatr´   )rþ   s    rC   rû   rû   ž  s(   € ðÜ”5˜“=Ó!Ð!øÜó Ùðús   ‚ –
#¢#)nÚ__doc__ÚloggingÚzipfiler7   Úcollections.abcr   Útypingr   Úxml.etree.ElementTreer   Údefusedxml.ElementTreeÚElementTreer<   Údocling_core.types.docr   r   r   r	   Údocling.backend.iwork.contentr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Údocling.exceptionsr   Ú	getLoggerÚ__name__r«   r   r6   r±   r·   rÁ   rf   ÚSFA_NAMESPACErÙ   rI   rq   r“   r”   r•   r—   rk   r‘   r–   rÂ   rg   rô   ÚSF_MEDIAÚSF_IMAGEr§   r©   Ú	frozensetrn   rã   rä   rç   rå   ré   rð   rï   ræ   rè   rú   rÃ   rÄ   rø   rx   ry   rz   ÚSF_ANNOTATIONSr¹   rÔ   rt   rÕ   rP   ÚZipFilerv   r³   rD   r„   rl   ro   r¨   r’   rw   rj   Údictrr   rp   rZ   r{   re   ri   ru   rh   rû   rV   rM   rC   Ú<module>r     sˆ  ðñó Û Û Ý $Ý Ý )å #÷ó ÷÷ ÷ ÷ õ õ& 1à×Ò˜Ó"€áˆTƒ]€ð
 )Ð à9€à�L�> Ð%€ð �\�N ,Ð/€à˜,˜Ð'7Ð8Ð à;€à�\�N 'Ð*€à�L�> Ð(€à�\�N 'Ð*€à�|�n IÐ.€à�|�n IÐ.€à˜<˜.Ð(9Ð:Ð à�}�o SÐ)€à˜�~ _Ð5Ð àˆ|ˆn˜FÐ
#€à�L�> Ð&€àˆ|ˆn˜FÐ
#€à˜,˜Ð'7Ð8Ð àE€à�ˆ~˜WÐ%€à�ˆ~˜WÐ%€àˆ|ˆn˜FÐ
#€à€á˜x¨Ð2Ó3Ð ðð �\�N +Ð.€à˜,˜Ð'<Ð=Ð à�\�N ,Ð/€à�L�> Ð(€à�l�^ 8Ð,€à˜,˜ |Ð4Ð à˜,˜ |Ð4Ð ðð Ð Ø Eá!Ò"GÓHÐ Ø Là�l�^ =Ð1€ðð ˆ|ˆn˜FÐ
#€à€ðð 	ˆˆ�fÐ˜vØˆˆ�hÐ Øˆˆ�kÐ" KØˆˆ�lÐ# _ð	Ð ð Uà��˜hÐ'€	à��˜hÐ'€	à�L�> Ð-€à�l�^ =Ð1€á˜) Y°¸nÐMÓN€ðð �\�N ,Ð/€à˜<˜.Ð(:Ð;Ð à�l�^ 8Ð,€à�=�/ Ð&€ðð*Ø�_‰_ð*Ø&)ð*Ø<?ð*ØPSð*àô*ðZDØ�_‰_ðDàðDð ðDð ð	Dð
 ôDðN+N˜ð +N I°Ñ$4ô +Nð\˜'ð ¨G¯O©Oð ÀÈ$Áô ð,I�Wð I Cð I¨C°$©Jô Ið"�gð  Sð ¨S°4©Zô ð"˜Wð "¨¨g©ô "ðJ3Øð3Ø*.¨s°T©z¸:ÈÑ;LÐ/LÑ*Mð3à
ˆ3�ˆ8�_ô3ðl)Ø
ð)à	ð)ð �c˜D‘j #¨¡*Ð,Ñ-ð)ð ˜3 ™: z°DÑ'8Ð8Ñ9ð	)ð
 
ˆ)�_ô)ð@˜'ð  d¨7¡mô ð.Ø
ðØðØ%-¨w¨i¸¨mÑ%<ðà	ˆ#�‰*�bˆ.Ñôð<)˜Wð )¨¨c°9¨nÑ)=ô )ðX*Øð*Ø%)¨#¨y¨.Ñ%9ð*à�Ñô*ð*,˜Wð ,¨°dÑ):ô ,ð4�3ð ˜3õ rM   