+
    yaÒjã  ã            	       óÔ   € R t ^ RIt^ RIHtHtHt ^RIHt RtR] R] R] R] R2	t	 ! R	 R
4      t
]
! R4      tR R lt]]]
]]]3,          ]]]]3,          ]],          3,          tR# )zö
Representation and utils for ranges of PDF file pages.

Copyright (c) 2014, Steve Witham <switham_github@mac-guyver.com>.
All rights reserved. This software is available under a BSD license;
see https://github.com/py-pdf/pypdf/blob/main/LICENSE
N)ÚAnyÚOptionalÚUnion)Ú
ParseErrorz(0|-?[1-9]\d*)z^(z|(z?(:z?)?)))$c                   óÐ   a € ] tR t^t o RtV 3R lR lt]V 3R lR l4       tV 3R lR ltV 3R lR	 lt	V 3R
 lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )Ú	PageRangea  
A slice-like representation of a range of page indices.

For example, page numbers, only starting at zero.

The syntax is like what you would put between brackets [ ].
The slice is one of the few Python types that can't be subclassed,
but this class converts to and from slices, and allows similar use.

  -  PageRange(str) parses a string representing a page range.
  -  PageRange(slice) directly "imports" a slice.
  -  to_slice() gives the equivalent slice.
  -  str() and repr() allow printing.
  -  indices(n) is like slice.indices(n).
c                ó<   <€ V ^8„  d   QhRS[ S[RS[3,          RR/# )é   Úargr   ÚreturnN)r   ÚsliceÚstr)ÚformatÚ__classdict__s   "€ÚE/opt/data/home/.local/lib/python3.14/site-packages/pypdf/pagerange.pyÚ__annotate__ÚPageRange.__annotate__$   s'   ø€ ÷ /)ñ /)™E¡%¨±cÐ"9Õ:ð /)¸tñ /)ó    c                ó–  € \        V\        4      '       d	   Wn        R# \        V\        4      '       d   VP	                  4       V n        R# \        V\
        4      ;'       d    \        P                  ! \        V4      pV'       g   \        V4      hVP                  ^4      '       d?   \        VP                  ^4      4      pVR8w  d
   V^,           MRp\        W44      V n        R# VP                  ^^^4       Uu. uF  qU'       d   \        V4      MRNK  	  ppV^,          pV^ 8X  d   \        V4      h\        V!  V n        R# u upi )a+  
Initialize with either a slice -- giving the equivalent page range,
or a PageRange object -- making a copy,
or a string like
    "int", "[int]:[int]" or "[int]:[int]:[int]",
    where the brackets indicate optional ints.
Remember, page indices start with zero.
Page range expression examples:

    :     all pages.                   -1    last page.
    22    just the 23rd page.          :-1   all but the last page.
    0:3   the first three pages.       -2    second-to-last page.
    :3    the first three pages.       -2:   last two pages.
    5:    from the sixth page onward.  -3:-1 third & second to last.
The third, "stride" or "step" number is also recognized.
    ::2       0 2 4 ... to the end.    3:0:-1    3 2 1 but not 0.
    1:10:2    1 3 5 7 9                2::-1     2 1 0.
    ::-1      all pages in reverse order.
Note the difference between this notation and arguments to slice():
    slice(3) means the first three pages;
    PageRange("3") means the range of only the fourth page.
    However PageRange(slice(3)) means the first three pages.
Néÿÿÿÿ)Ú
isinstancer   Ú_slicer   Úto_slicer   ÚreÚmatchÚPAGE_RANGE_REr   ÚgroupÚint)Úselfr
   ÚmÚstartÚstopÚgÚboundsÚsteps   &&      r   Ú__init__ÚPageRange.__init__$   sø   € ô0 �cœ5×!Ò!ØŒKÙä�cœ9×%Ò%ØŸ,™,›.ˆDŒKÙä�sœCÓ ×AÐA¤R§X¢X¬m¸SÓ%AˆßÜ˜S“/Ð!Ø�7‰7�1�:Š:ä˜Ÿ™ ›
“OˆEØ %¨¤�5˜1–9°ˆDÜ Ó,ˆDŽKà56·W±W¸QÀÀ1Ô5EÓFÑ5E°¦”c˜!”f tÒ+Ñ5EˆFÐFØ˜!•9ˆDØ�qŒyô ! “oÐ%Ü ™.ˆDŽKùò Gs   Ã<Ec                ó&   <€ V ^8„  d   QhRS[ RS[/# )r	   Úinputr   )r   Úbool)r   r   s   "€r   r   r   V   s   ø€ ÷ ñ ‘Sð ™Tñ r   c                ó®   € \        V \        \        34      '       d   R# \        V \        4      '       g   R#  \        V 4       R#   \         d     R# i ; i)z¸
True if input is a valid initializer for a PageRange.

Args:
    input: A possible PageRange string or a PageRange object.

Returns:
    True, if the ``input`` is a valid PageRange.

TF)r   r   r   r   r   )r(   s   &r   ÚvalidÚPageRange.validU   sO   € ô �eœe¤YÐ/×0Ò0ÙÜ˜%¤×%Ò%Ùð	Ü�eÔñ øô ô 	Úð	ús   ¸A ÁAÁAc                ó    <€ V ^8„  d   QhRS[ /# ©r	   r   )r   )r   r   s   "€r   r   r   k   s   ø€ ÷ ñ ™%ñ r   c                ó   € V P                   # )z/Return the slice equivalent of this page range.©r   ©r   s   &r   r   ÚPageRange.to_slicek   s   € à�{‰{Ðr   c                ó    <€ V ^8„  d   QhRS[ /# r.   ©r   )r   r   s   "€r   r   r   o   s   ø€ ÷ Fñ F™ñ Fr   c                óh  € V P                   pVP                  f_   VP                  e8   VP                  VP                  ^,           8X  d   \	        VP                  4      # VP                  VP                  3pM#VP                  VP                  VP                  3pRP                  R V 4       4      # )zA string like "1:2:3".Ú:c              3   óB   "  € T F  qf   RM
\        V4      x € K  	  R # 5i)NÚ r4   )Ú.0Úis   & r   Ú	<genexpr>Ú$PageRange.__str__.<locals>.<genexpr>z   s   é € ÐE¹W¸ši™¬S°«VÔ3»Wùs   ‚)r   r$   r    r!   r   Újoin)r   ÚsÚindicess   &  r   Ú__str__ÚPageRange.__str__o   s}   € à�K‰Kˆà�6‰6Š>Ø�w‰wÒ" q§v¡v°·±¸1µÔ'<Ü˜1Ÿ7™7“|Ð#à—g‘g˜qŸv™v�o‰Gà—g‘g˜qŸv™v q§v¡vÐ-ˆGØ�x‰xÑE¹WÓEÓEÐEr   c                ó    <€ V ^8„  d   QhRS[ /# r.   r4   )r   r   s   "€r   r   r   |   s   ø€ ÷ 4ñ 4™#ñ 4r   c                óF   € R\        \        V 4      4      ,           R,           # )z#A string like "PageRange('1:2:3')".z
PageRange(Ú))Úreprr   r1   s   &r   Ú__repr__ÚPageRange.__repr__|   s   € àœd¤3 t£9›oÕ-°Õ3Ð3r   c                ó@   <€ V ^8„  d   QhRS[ RS[S[ S[ S[ 3,          /# )r	   Únr   )r   Útuple)r   r   s   "€r   r   r   €   s&   ø€ ÷ &ñ &™ð &¡¡s©C± }Õ!5ñ &r   c                ó8   € V P                   P                  V4      # )zï
Assuming a sequence of length n, calculate the start and stop indices,
and the stride length of the PageRange.

See help(slice.indices).

Args:
    n:  the length of the list of pages to choose from.

Returns:
    Arguments for range().

)r   r?   )r   rI   s   &&r   r?   ÚPageRange.indices€   s   € ð �{‰{×"Ñ" 1Ó%Ð%r   c                ó&   <€ V ^8„  d   QhRS[ RS[/# )r	   Úotherr   )Úobjectr)   )r   r   s   "€r   r   r   �   s   ø€ ÷ +ñ +™Fð +¡tñ +r   c                ód   € \        V\        4      '       g   R # V P                  VP                  8H  # )F)r   r   r   )r   rN   s   &&r   Ú__eq__ÚPageRange.__eq__�   s%   € Ü˜%¤×+Ò+ÙØ�{‰{˜eŸl™lÑ*Ð*r   c                ó    <€ V ^8„  d   QhRS[ /# r.   )r   )r   r   s   "€r   r   r   •   s   ø€ ÷ _ñ _™#ñ _r   c                ó®   € \        V P                  V P                  P                  V P                  P                  V P                  P
                  334      # )N)ÚhashÚ	__class__r   r    r!   r$   r1   s   &r   Ú__hash__ÚPageRange.__hash__•   s;   € Ü�T—^‘^ d§k¡k×&7Ñ&7¸¿¹×9IÑ9IÈ4Ï;É;×K[ÑK[Ð%\Ð]Ó^Ð^r   c                ó"   <€ V ^8„  d   QhRRRR/# )r	   rN   r   r   © )r   r   s   "€r   r   r   ˜   s   ø€ ÷ ,ñ ,˜[ð ,¨[ñ ,r   c                óÖ  € \        V\        4      '       g   \        R \        V4       24      hV P                  P
                  f   VP                  P
                  e   \        R4      hV P                  P                  V P                  P                  3pVP                  P                  VP                  P                  3pR R lpR R lpV! V^ ,          4      V! V^ ,          4      8”  d   Y2r2V! V^ ,          4      V! V^,          4      8”  d   \        R4      hV! V^,          4      V! V^,          4      8”  d
   V^,          MV^,          p\        \        V^ ,          V4      4      # )zCan't add PageRange and zCan't add PageRange with stridec                óF   € V ^8„  d   QhR\         \        ,          R\        /# ©r	   Úvr   ©r   r   Úfloat)r   s   "r   r   Ú'PageRange.__add__.<locals>.__annotate__¡   s   € ÷ 	5ñ 	5œ(¤3�-ð 	5¬Eñ 	5r   c                 ó$   € V f   \        R4      # T # )Nz-inf©r`   ©r^   s   &r   Ú
_start_keyÚ%PageRange.__add__.<locals>._start_key¡   s   € Ø$%¢I”5˜“=Ð4°1Ð4r   c                óF   € V ^8„  d   QhR\         \        ,          R\        /# r]   r_   )r   s   "r   r   ra   ¤   s   € ÷ 	4ñ 	4œ¤#�ð 	4¬5ñ 	4r   c                 ó$   € V f   \        R4      # T # )NÚinfrc   rd   s   &r   Ú	_stop_keyÚ$PageRange.__add__.<locals>._stop_key¤   s   € Ø#$¢9”5˜“<Ð3°!Ð3r   zCan't add PageRanges with gap)
r   r   Ú	TypeErrorÚtyper   r$   Ú
ValueErrorr    r!   r   )r   rN   ÚaÚbre   rj   r!   s   &&     r   Ú__add__ÚPageRange.__add__˜   s  € Ü˜%¤×+Ò+ÜÐ6´t¸E³{°mÐDÓEÐEØ�;‰;×ÑÒ'¨5¯<©<×+<Ñ+<Ò+HÜÐ>Ó?Ð?Ø�K‰K×Ñ˜tŸ{™{×/Ñ/Ð/ˆØ�L‰L×Ñ §¡× 1Ñ 1Ð1ˆõ	5õ	4ñ �a˜•dÓ™j¨¨1­Ó.Ô.Øˆqñ �a˜•dÓ™i¨¨!­›oÔ-äÐ<Ó=Ð=Ù   1¥“©°1°Qµ4«Ô8ˆq�Žt¸aÀ½dˆÜœ˜q �t TÓ*Ó+Ð+r   r0   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r%   Ústaticmethodr+   r   r@   rF   r?   rQ   rW   rq   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      ss   ø‡ € ñ÷ /)ð /)ðb ÷ó ð÷*ð ÷Fð F÷4ð 4÷&ð &÷ +ð +÷
_ð _÷,ö ,r   r   r6   c                ó¢   € V ^8„  d   QhR\         \        \        \        R3,          ,          R\         \        \        \        3,          ,          /# )r	   ÚargsNr   )Úlistr   r   r   rJ   )r   s   "r   r   r   µ   s;   € ÷ $ñ $Ü
Œu”Sœ) TÐ)Õ*Õ
+ð$ä	Œ%””Y�Õ
Õ ñ$r   c                ód  € . pRpRp. V ORN FŸ  p\         P                  V4      '       d:   V'       g   \        R4      hVf   Q hVP                  V\        V4      34       RpKW  V'       d    V'       g   VP                  V\        34       \        V\         4      '       d   Q V4       hTpRpK¡  	  V# )a‰  
Given a list of filenames and page ranges, return a list of (filename, page_range) pairs.

Args:
    args: A list where the first element is a filename. The other elements are
        filenames, page-range expressions, slice objects, or PageRange objects.
        A filename not followed by a page range indicates all pages of the file.

Returns:
    A list of (filename, page_range) pairs.

NFz8The first argument must be a filename, not a page range.T)r   r+   rn   ÚappendÚPAGE_RANGE_ALLr   )r|   ÚpairsÚpdf_filenameÚdid_page_ranger
   s   &    r   Úparse_filename_page_rangesr„   µ   s®   € ð *,€EØ%)€LØ€NØ�ˆ}�t‹}ˆÜ�?‰?˜3×ÒßÜ ØNóð ð ’?Ð"�?Ø�L‰L˜,¬	°#«Ð7Ô8Ø!ŠN÷ §NØ—‘˜l¬NÐ;Ô<ä! #¤y×1Ò1Ð6°3Ó6Ð1ØˆLØ"ŠNñ# ð$ €Lr   )rw   r   Útypingr   r   r   Úerrorsr   Ú_INT_REr   r   r€   r„   r   rJ   r   r}   ÚPageRangeSpecrZ   r   r   Ú<module>r‰      sŠ   ðñó 
ß 'Ñ 'å à
€Ø�W�I˜R ˜y¨¨G¨9°C¸°yÀÐH€÷\,ñ \,ñ~ ˜3“€õ$ðN �c˜9 e¨C°¨H¥o°u¸SÀ#Às¸]Õ7KÈTÐRUÍYÐVÕW‚r   