
    %pj
                         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  S SKJr  S r " S S5      r\R"                  S:  a  \R$                  R&                  rOS	 rS
 rg)    N)	add_inputadd_n_digits	get_input
round_list)BooleanOptionalAction)PDFIUM_INFOc                     [        U SS9  [        U 5        U R                  S[        SSS9  U R                  S[        SS	S
9  g )NF)pagesz--max-depth   zFMaximum recursion depth to consider when parsing the table of contents)typedefaulthelpz--color-indicatorTzWhether to add a color indicator to bookmarks that declare a color. The indicator is a Unicode symbol wrapped in an ANSI escape sequence. Default is enabled.)actionr   r   )r   r   add_argumentintr   )parsers    M/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/pypdfium2_cli/toc.pyattachr      sW    fE"
W	   & o	      c                   0    \ rS rSrS rS r\S 5       rSrg)ColorIndicator   c                     Xl         X l        g N	indicatorsep)selfr   r   s      r   __init__ColorIndicator.__init__!   s    "r   c                 ~    [        S U 5       5      u  p#nSU SU SU S3U R                  -   S-   U R                  -   $ )Nc              3   >   #    U  H  n[        US -  5      v   M     g7f)   N)round).0cs     r   	<genexpr>*ColorIndicator.__call__.<locals>.<genexpr>&   s     4eaees   z[38;2;;mz[0m)tupler   r   )r   colorrgbs        r   __call__ColorIndicator.__call__%   sH    4e44aA3as!A3a(4>>9IEPPr   c                     g)N  )r,   s    r   noopColorIndicator.noop)   s    r   r   N)	__name__
__module____qualname____firstlineno__r   r0   staticmethodr5   __static_attributes__r4   r   r   r   r      s!    Q  r   r   i  c                     g r   r4   )bms    r   	get_colorr?   1   s    r   c           
         [        U 5      nU R                  (       a  [        SSS9nO[        R                  nUR	                  U R
                  S9 GH  nUR                  5       nUR                  5       nUS:w  a  US OSnSUR                  -  nUS	U< S
U< S3-  nUR                  5       nU(       an  UR                  5       n	UR                  5       u  pUU	S :w  a  U	S-   OS< S[        R                  R                  U
5      < S[        XR                   5      < 3-  nOUS-  n[#        U5      nU(       a'  USU" U5      -   S[        XR                   5       3-   -  n[%        U5        GM     g )Nu   ⬤ )r   )	max_depthr   +*z    [z] z ->    ?z  # _z | RGB)r   color_indicatorr   r5   get_tocrB   	get_title	get_countlevelget_dest	get_indexget_viewpdfium_iViewmodeToStrgetr   n_digitsr?   print)argspdficolr>   titlecount	count_stroutdestindex	view_modeview_posr,   s                r   mainrb   5   s8   
D/Ce-""kkDNNk3$)QJuQiC	rxx	511{{}NN$E"&--/I D=ac1&&**958]]3 C 3JC"54;&3z%/O.P)QQQCc
3 4r   )pypdfium2._helpers_helperspdfiumpypdfium2.internalinternalrR   pypdfium2_cli._parsersr   r   r   r   pypdfium2_cfg.stlr   pypdfium2.versionr   r   r   buildPdfBookmarkr?   rb   r4   r   r   <module>rm      sY    $ %  4 )"  t"",,I!r   