ó
    Í>j  ã                  óN   • S r SSKJr  SSKJr  SSKJr  SSKrSSKJ	r	  Sr
S	S jrg)
aö  Annotated PDF: the source pages with each table's final boundary drawn on.

Each table's ``content_region`` (the corrected end of the table at its last data
row) is drawn onto its page with a small ordinal+title label, so a reviewer can
see at a glance which regions were located and how they map onto the source.
Falls back to ``som_region`` when ``content_region`` is absent (engines without
the Set-of-Mark locator). The tables are supplied already-extracted, so this
does no extraction of its own.
é    )Úannotations)ÚPath)ÚSequenceN)ÚExtractedTable)g        g{®GázÔ?gq=
×£pí?c           
     ób  • [         R                  " [        U5      5      nSnU  GHR  nUR                  =(       d    UR                  nU(       d  M,  X5R
                  S-
     nUR                  R                  UR                  R                  p˜Uu  p«pÍ[         R                  " [        X¬5      U-  [        X½5      U	-  [        X¬5      U-  [        X½5      U	-  5      nUR                  U[        SS9  UR                  (       a!  UR
                   SUS-    SUR                   3OUR
                   SUS-    3nUR                  UR                   S-   [        SUR"                  S	-
  5      4US
[        S9  US-  nGMU     UR$                  R'                  SSS9  UR)                  [        U5      5        U$ )a  Draw each table's final boundary (``content_region``, else ``som_region``)
onto a copy of ``pdf``.

One box per located table; pages with no tables are left untouched. Tables
with neither region (engines that do not run the locator) are skipped.
Returns ``out_path``.
r   é   gffffffö?)ÚcolorÚwidthÚ.z: é   g       @é   é   )Úfontsizer	   T)ÚparentsÚexist_ok)ÚfitzÚopenÚstrÚcontent_regionÚ
som_regionÚpageÚrectr
   ÚheightÚRectÚminÚmaxÚ	draw_rectÚBOX_RGBÚtitleÚinsert_textÚx0Úy0ÚparentÚmkdirÚsave)ÚtablesÚpdfÚout_pathÚdocÚdrawnÚtÚregionr   ÚwÚhr!   r"   Úx1Úy1r   Úlabels                   Ú4/home/mande/repo/quber/src/quber/review/annotated.pyÚrender_annotated_pdfr3      sa  € ô �)Š)”C˜“HÓ
€CØ€EÜˆØ×!Ñ!×1 Q§\¡\ˆÞÙØ—6‘6˜A‘:‰ˆØ�y‰y�‰ §	¡	× 0Ñ 0ˆ1Ø‰ˆ�Ü�yŠyœ˜R› q™¬#¨b«+¸©/¼3¸r»;È¹?ÌCÐPRËKÐZ[ÉOÓ\ˆØ�‰�t¤7°#ˆÑ6Ø67·g·g�1—6‘6�(˜!˜E A™I˜; b¨¯©¨	Ñ2ÀaÇfÁfÀXÈQÈuÐWXÉyÈkÐCZˆØ×Ñ˜$Ÿ'™' A™+¤s¨3°·±¸!±Ó'<Ð=¸uÈqÔX_ÐÑ`Ø�‰
‹ñ ð ‡O�O×Ñ $°ÐÑ6Ø‡H�HŒS�‹]ÔØ€Oó    )r&   zSequence[ExtractedTable]r'   r   r(   r   Úreturnr   )Ú__doc__Ú
__future__r   Úpathlibr   Útypingr   r   Úquber.core.extractorsr   r   r3   © r4   r2   Ú<module>r<      s%   ðñõ #å Ý ã å 0à
€õr4   