%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/PIL/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/PIL/__pycache__/PdfParser.cpython-312.pyc

�

��e���	�\�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	d�Z
idd�dd�dd	�d
d�dd
�dd�dd�dd�dd�dd�dd�dd�dd�dd�d d!�d"d#�d$d%�id&d'�d(d)�d*d+�d,d-�d.d/�d0d1�d2d3�d4d5�d6d7�d8d9�d:d;�d<d=�d>d?�d@dA�dBdC�dDdE�dFdG��dHdIdJdKdLdMdNdO��ZdP�ZGdQ�dRe
�ZdS�ZGdT�dUej dVdWdXg��ZGdY�dZe�ZGd[�d\�ZGd]�d^�ZGd_�d`e�ZGda�dbej.�ZGdc�dd�ZGde�df�Zdg�ZGdh�di�Zy)j�)�annotationsNc�F�tj|jd�zS)N�	utf_16_be)�codecs�BOM_UTF16_BE�encode)�ss �//usr/lib/python3/dist-packages/PIL/PdfParser.py�encode_textrs��������+�!6�6�6����u˘�uˇ�uˆ�u˙�u˝�u˛�u˚�u˜�u•�u†�u‡�u…�u—�u–�uƒ�u⁄�u‹�u›�u−�u‰�u„�u“�u”�u‘�u’�u‚�u™�ufi�ufl�uŁ�uŒ�uŠ�uŸuŽuıułuœušužu€)�������c���|dttj�tjk(r+|ttj�djd�Sdj	d�|D��S)Nr�c3�ZK�|]#}tj|t|�����%y�w�N)�PDFDocEncoding�get�chr)�.0�bytes  r
�	<genexpr>zdecode_text.<locals>.<genexpr>Ds!����I�t�~�)�)�$��D�	�:�I�s�)+)�lenrr�decode�join)�bs r
�decode_textrE@s\���	#�3�v�"�"�#�$��(;�(;�;���V�(�(�)�+�,�3�3�K�@�@��w�w�I�q�I�I�Irc��eZdZdZy)�PdfFormatErrorz\An error that probably indicates a syntactic or semantic error in the
    PDF file structureN)�__name__�
__module__�__qualname__�__doc__�rr
rGrGGs���	rrGc��|st|��yr:)rG)�	condition�
error_messages  r
�check_format_conditionrPNs����]�+�+�rc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�IndirectReferencec�:�|j�d|j�d�S)N� z R��	object_id�
generation��selfs r
�__str__zIndirectReference.__str__Vs���.�.�!��4�?�?�"3�2�6�6rc�@�|j�jd�S�N�us-ascii)rZrrXs r
�	__bytes__zIndirectReference.__bytes__Ys���|�|�~�$�$�Z�0�0rc��|j|juxr4|j|jk(xr|j|jk(Sr:)�	__class__rVrW�rY�others  r
�__eq__zIndirectReference.__eq__\sC���O�O�t�~�~�-�
4����4�>�>�1�
4�� � �D�O�O�3�	
rc��||k(Sr:rLras  r
�__ne__zIndirectReference.__ne__cs���E�M�"�"rc�D�t|j|jf�Sr:)�hashrVrWrXs r
�__hash__zIndirectReference.__hash__fs���T�^�^�T�_�_�5�6�6rN)rHrIrJrZr^rcrerhrLrr
rRrRSs��7�1�
�#�7rrR�IndirectReferenceTuplerVrWc��eZdZd�Zy)�IndirectObjectDefc�:�|j�d|j�d�S)NrTz objrUrXs r
rZzIndirectObjectDef.__str__ks���.�.�!��4�?�?�"3�4�8�8rN)rHrIrJrZrLrr
rkrkjs��9rrkc�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�	XrefTablec�@�i|_i|_ddi|_d|_y)NriF)�existing_entries�new_entries�deleted_entries�reading_finishedrXs r
�__init__zXrefTable.__init__ps&�� "������ !�5�z��� %��rc��|jr||j|<n||j|<||jvr|j|=yyr:)rsrqrprr�rY�key�values   r
�__setitem__zXrefTable.__setitem__vsL��� � �$)�D���S�!�).�D�!�!�#�&��$�&�&�&��$�$�S�)�'rc�^�	|j|S#t$r|j|cYSwxYwr:)rq�KeyErrorrp�rYrws  r
�__getitem__zXrefTable.__getitem__~s8��	.��#�#�C�(�(���	.��(�(��-�-�	.�s��,�,c�\�||jvr2|j|ddz}|j|=||j|<y||jvr%|j|ddz}||j|<y||jvr|j|}ydt|�zdz}t	|��)N�z
object ID z+ cannot be deleted because it doesn't exist)rqrrrp�str�
IndexError)rYrwrW�msgs    r
�__delitem__zXrefTable.__delitem__�s����$�"�"�"��)�)�#�.�q�1�A�5�J�� � ��%�(2�D� � ��%�
�D�)�)�
)��.�.�s�3�A�6��:�J�(2�D� � ��%�
�D�(�(�
(��-�-�c�2�J��s�3�x�'�*W�W�
��S�/�!rc�>�||jvxs||jvSr:)rprqr|s  r
�__contains__zXrefTable.__contains__�s#���d�+�+�+�F�s�d�6F�6F�/F�Frc���tt|jj��t|jj��zt|j
j��z�Sr:)rA�setrp�keysrqrrrXs r
�__len__zXrefTable.__len__�s^�����%�%�*�*�,�-��$�"�"�'�'�)�*�
+��$�&�&�+�+�-�.�
/�
�	
rc���t|jj��t|jj��z
t|jj��zSr:)r�rpr�rrrqrXs r
r�zXrefTable.keys�sS����%�%�*�*�,�-��D�4H�4H�4M�4M�4O�0P�P��� � �%�%�'�(�)�	)rc��tt|jj��t|jj��z�}tt|jj���}|j�}|j
d�|r�d}t|�D]\}}|�|dz|k(r|}�|d|}||d}n|}d}|j
d|dt|�fz�|D]�}	|	|jvr"|j
d|j|	z��3|jd�}
t|	|
k(d|	�d|
���	|d}|j
d||j|	fz���|r��|S#t$rd}Y�7wxYw)	Nsxref
rs%d %d
rs%010d %05d n 
z*expected the next deleted object ID to be z, instead found s%010d %05d f 
)�sortedr�rqr�rr�tell�write�	enumeraterA�poprPr�)rY�fr��deleted_keys�	startxref�prev�indexrw�contiguous_keysrV�this_deleted_object_id�next_in_linked_lists            r
r�zXrefTable.write�s����c�$�*�*�/�/�1�2�S��9M�9M�9R�9R�9T�5U�U�V���c�$�"6�"6�";�";�"=�>�?���F�F�H�	�	���	����D�'��o�	
�
��s��<�4�!�8�s�?��D�&*�6�E�l�O����<�D��
	
�#'����
�G�G�J�/�!�"4�c�/�6J�!K�K�L�,�
�	��� 0� 0�0��G�G�.��1A�1A�)�1L�L�M�-9�-=�-=�a�-@�*�*�!�%;�;�D�Y�K�P)�)?�(@�B��
0�.:�1�o�+��G�G�*�.��0D�0D�Y�0O�P�Q��
��@���
&�0�./�+�0�s�E>�>F�FN)rHrIrJrtryr}r�r�r�r�r�rLrr
rnrnos+��&�*�.�"� G�
�)�
%rrnc	��eZdZd�Zd�Zd�Zd�Zd�Zed��Z	e
edd��d	D���chc]
}t|���c}}}z
Z
d
�Zycc}}}w)�PdfNamec��t|t�r|j|_yt|t�r||_y|j	d�|_yr\)�
isinstancer��name�bytesr)rYr�s  r
rtzPdfName.__init__�s8���d�G�$��	�	�D�I�
��e�
$��D�I����J�/�D�Irc�8�|jjd�Sr\)r�rBrXs r
�name_as_strzPdfName.name_as_str�s���y�y���
�+�+rc�z�t|t�xr|j|jk(xs||jk(Sr:)r�r�r�ras  r
rczPdfName.__eq__�s4���u�g�&�B�5�:�:����+B� �
�d�i�i�
�	 rc�,�t|j�Sr:)rgr�rXs r
rhzPdfName.__hash__�s���D�I�I��rc�4�dt|j��d�S)NzPdfName(�))�reprr�rXs r
�__repr__zPdfName.__repr__�s���$�t�y�y�/�*�!�,�,rc�8�|tj|��Sr:)�	PdfParser�interpret_name)�cls�datas  r
�from_pdf_streamzPdfName.from_pdf_stream�s���9�+�+�D�1�2�2r�!�z#%/()<>[]{}c��td�}|jD]6}||jvr|j|��#|j	d|z��8t|�S)N�/s#%02X)�	bytearrayr��
allowed_chars�append�extendr�)rY�resultrDs   r
r^zPdfName.__bytes__�sT���4������	,�A��D�&�&�&��
�
�a� ��
�
�h��l�+�		,�
�V�}�rN)rHrIrJrtr�rcrhr��classmethodr�r��range�ordr�r^)r>�cr�s000r
r�r��sc��0�,� �
�-��3��3���b�#��'�=�*I�*I�a�3�q�6�*I�I�M���+Js�A
r�c��eZdZd�Zy)�PdfArrayc�>�ddjd�|D��zdzS)Ns[ � c3�2K�|]}t|����y�wr:)�pdf_repr)r>�xs  r
r@z%PdfArray.__bytes__.<locals>.<genexpr>�s���� ;���!�� ;�s�s ])rCrXs r
r^zPdfArray.__bytes__�s!���t�y�y� ;�d� ;�;�;�e�C�CrN)rHrIrJr^rLrr
r�r��s��Drr�c��eZdZd�Zd�Zd�Zy)�PdfDictc�z�|dk(r"tjj|||�y|||jd�<y)Nr�r])�collections�UserDict�__setattr__rrvs   r
r�zPdfDict.__setattr__�s4���&�=�� � �,�,�T�3��>�+0�D����J�'�(rc�`�	||jd�}t|t�rt|�}|j
d�r�|jd�r|dd}d}t|�dkDr5|d}t|dd�d	z}t|�d
kDr|t|dd
�z
}ddt|�dz
}tj|dt|�dz|�}|d
vr:d	z}|dk(r|dz}tjtj|�|z�}|S#t$r}t|�|�d}~wwxYw)Nr]�DatezD:��Z����<��z%Y%m%d%H%M%S)�+�-r����)rr{�AttributeErrorr�r�rE�endswith�
startswithrA�int�time�strptime�gmtime�calendar�timegm)rYrwrx�e�relationship�offset�formats       r
�__getattr__zPdfDict.__getattr__�s:��	-�����J�/�0�E��e�U�#���&�E��<�<�������%��a�b�	���L��5�z�B��$�R�y���U�2�b�\�*�R�/���u�:��?��c�%��2�,�/�/�F�#�$4�c�%�j�1�n�5�F��M�M�%�(9�#�f�+��/�":�F�C�E��z�)��"����3�&��b�L�F����H�O�O�E�$:�V�$C�D�����-�	-� ��%�1�,��	-�s�D�	D-�D(�(D-c�H�td�}|j�D]i\}}|��	t|�}|jd�|jt	t|���|jd�|j|��k|jd�t	|�S)N�<<�
r�s
>>)r��itemsr�r�r�r�)rY�outrwrxs    r
r^zPdfDict.__bytes__s��������*�*�,�	�J�C���}���U�O�E��J�J�u���J�J�u�W�S�\�*�+��J�J�t���J�J�u��	�	�
�
�7���S�z�rN)rHrIrJr�r�r^rLrr
r�r��s��1��6rr�c��eZdZd�Zd�Zy)�	PdfBinaryc��||_yr:)r�)rYr�s  r
rtzPdfBinary.__init__(s	����	rc�L�ddjd�|jD��zS)Ns<%s>rc3�&K�|]	}d|z���y�w)s%02XNrL�r>rDs  r
r@z&PdfBinary.__bytes__.<locals>.<genexpr>,s����!A�!�'�A�+�!A�s�)rCr�rXs r
r^zPdfBinary.__bytes__+s ������!A�t�y�y�!A�A�A�ArN)rHrIrJrtr^rLrr
r�r�'s
���Brr�c��eZdZd�Zd�Zy)�	PdfStreamc� �||_||_yr:)�
dictionary�buf)rYr�r�s   r
rtzPdfStream.__init__0s��$�����rc��	|jj}|dk(rA	|jj}t
j|jt|���Sdt|jj��d�}t|��#t$r|jcYSwxYw#t$r|jj
}Y��wxYw)NsFlateDecode)�bufsizezstream filter z unknown/unsupported)r��Filterr�r��DL�Length�zlib�
decompressr�r��NotImplementedError)rY�filter�expected_lengthr�s    r
rBzPdfStream.decode4s���	��_�_�+�+�F��^�#�
9�"&�/�/�"4�"4���?�?�4�8�8�S��5I�J�J�"�4����(>�(>�#?�"@�@T�U�C�%�c�*�*���	��8�8�O�	��
"�
9�"&�/�/�"8�"8��
9�s"�B�B'�B$�#B$�'C	�C	N)rHrIrJrtrBrLrr
r�r�/s���
+rr�c���|dury|dury|�yt|ttttf�rt|�St|ttf�rt|�jd�St|tj�r+dtjd|�jd�zd	zSt|t�rtt|��St|t�rtt|��St|t�rtt!|��St|t
�r>|j#d
d�}|j#dd
�}|j#d	d�}d|zd	zSt|�S)NTstrueFsfalsesnullr]s(D:z
%Y%m%d%H%M%SZ�)�\s\\�(�\(s\))r�r�r�r�r�r�r��floatr�rr��struct_time�strftime�dict�listr�r�replace)r�s r
r�r�Ds-���D�y��	
�e���	
���	�A���(�I�>�	?��Q�x��	�A��U�|�	$��1�v�}�}�Z�(�(�	�A�t�'�'�	(���
�
�o�q�9�@�@��L�L�t�S�S�	�A�t�	��W�Q�Z� � �	�A�t�	��X�a�[�!�!�	�A�s�	���A��'�'�	�A�u�	�
�I�I�e�W�%��
�I�I�d�F�#��
�I�I�d�F�#���a�x�$����Q�x�rc��eZdZdZdSd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�ZdTd�Zd�Zd�Zd�Zed��Zd�ZdTd�ZdZdZdZdZedzZedzZdZdZeezezZe jBedzezdzezdzezd zezd!zezd"ze jD�Z#e jBedzezd#zezdzezd zezd!zeze jD�Z$d$�Z%d%�Z&e jBe�Z'e jBed&zezd'z�Z(e jBed(z�Z)e jBed)zez�Z*e+d*��Z,e jBd+�Z-e+dUd,��Z.e jBed-zezd'z�Z/e jBed.zezd'z�Z0e jBed/zezd'z�Z1e jBed0zezd'z�Z2e jBed1zezd'z�Z3e jBed2z�Z4e jBed3z�Z5e jBed4zezd5z�Z6e jBed6z�Z7e jBed7zezd7zezd8zezd'z�Z8e jBed7zezd7zezd9zezd'z�Z9e jBed:zezd'z�Z:e jBd;ezd<zezd=z�Z;e jBed>z�Z<e jBed?zezd'z�Z=e+dVd@��Z>e jBdA�Z?idBdC�dDdE�dFdG�dHdI�dJdK�d;d;�d'd'�dLdL�e@dB�dC�e@dD�dE�e@dF�dG�e@dH�dI�e@dJ�dK�e@d;�d;�e@d'�d'�e@dL�dL�ZAe+dM��ZBe jBedNzez�ZCe jBed zezd zezez�ZDe jBdO�ZEdP�ZFdWdQ�ZGdTdR�ZHy)Xr�z|Based on
    https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf
    Supports PDF up to 1.4
    Nc��|r|r
d}t|��||_||_||_||_d|_d|_|�|�t||�x|_}d|_|�>|j|�x|_}d|_|st|d�r|j|_i|_|r|j�nsdx|_
|_t�|_d|_t�|_d|_i|_g|_g|_d|_d|_i|_t5�|_d|j6_|r|j;�yy)Nz4specify buf or f or filename, but not both buf and fFTr�r)�RuntimeError�filenamer�r��start_offset�should_close_buf�should_close_file�open�get_buf_from_file�hasattrr��cached_objects�
read_pdf_info�file_size_total�file_size_thisr��root�root_ref�info�info_ref�page_tree_root�pages�
orig_pages�	pages_ref�last_xref_section_offset�trailer_dictrn�
xref_tablers�seek_end)rYr
r�r�r�moder�s       r
rtzPdfParser.__init__gs>���1�H�C��s�#�#� ��
�������(��� %���!&�����A�I��h��-�-�D�F�Q�%)�D�"��=�!�3�3�A�6�6�D�H�s�$(�D�!����6� 2� !����
� ������� �9:�:�D� �4�#6��	�D�I� �D�M��	�D�I� �D�M�"$�D���D�J� �D�O�!�D�N�,0�D�)� "�D��'�k�D�O�+/����(���M�M�O�
rc��|Sr:rLrXs r
�	__enter__zPdfParser.__enter__�s���rc�$�|j�y)NF)�close)rY�exc_type�	exc_value�	tracebacks    r
�__exit__zPdfParser.__exit__�s���
�
��rc�D�|j�|j�yr:)�	close_bufr rXs r
�
start_writingzPdfParser.start_writing�s�������
�
�rc�t�	|jj�d|_y#t$r
Yd|_ywxYwr:)r�r%r�rXs r
r+zPdfParser.close_buf�s9��	��H�H�N�N�������	�����	�s�$�	7�7c��|jr|j�|j�/|jr"|jj	�d|_yyyr:)rr+r�r
r%rXs r
r%zPdfParser.close�sC��� � ��N�N���6�6��$�"8�"8��F�F�L�L�N��D�F�#9�rc�X�|jjdtj�y)Nr)r��seek�os�SEEK_ENDrXs r
r zPdfParser.seek_end�s�������A�r�{�{�#rc�:�|jjd�y)Ns	%PDF-1.4
)r�r�rXs r
�write_headerzPdfParser.write_header�s�������]�#rc�^�|jjd|�d�j��y)Nz% �
)r�r�r)rYr	s  r
�
write_commentzPdfParser.write_comment�s#�������r�!��B�Z�&�&�(�)rc���|j�|j|jj��|_|jd�|_|j
�|j|jtd�|j
��|j|j
td�t|j�|j��|jS)Nr�Catalog)�Type�Pages�Pages)r:�Count�Kids)�del_root�next_object_idr�r�rr�
rewrite_pages�	write_objr�rArrXs r
�
write_catalogzPdfParser.write_catalog�s����
�
���+�+�D�F�F�K�K�M�:��
��,�,�Q�/����������t�}�}�7�:�+>�d�n�n��U�����N�N���"��d�j�j�/����		�	
��}�}�rc��g}t|j�D]�\}}|j|}|j|j=|j|t
d��||jvr�Xi}|j�D]\}}|||j�<�|j|d<|jdi|��}t|j�D]\}	}
|
|k(s�||j|	<���|D]X}|s�|j|}|j|jvr|j|j=|jdd�}|r�S�Zg|_y)NsParent�Parentr:)
r�rrrrVr�r�rr�r�r�
write_pager<)
rY�pages_tree_nodes_to_delete�i�page_ref�	page_info�stringified_page_inforwrx�new_page_ref�j�cur_page_ref�pages_tree_node_ref�pages_tree_nodes
             r
rAzPdfParser.rewrite_pages�se��%'�"�$�T�_�_�5�	1�K�A�x��+�+�H�5�I����� 2� 2�3�&�-�-�i��	�8J�.K�L��t�z�z�)��$&�!�'�o�o�/�
A�
��U�;@�%�c�o�o�&7�8�
A�/3�n�n�!�(�+�*�4�?�?�I�3H�I�L�#,�T�Z�Z�#8�
1���<��8�+�$0�D�J�J�q�M�
1�	1�&$>�	K��%�"&�"5�"5�6I�"J��&�0�0�D�O�O�C����(;�(E�(E�F�&5�&9�&9�)�T�&J�#�	&�	K���rc��|r|j�||_|jr!|jd|j�|_|j
j
|j�}t|j
�}|j|d�}|j�|j|d<|jr|j|d<||_	|jj
dtt|��zd|zz�y)N)�Root�Size�Prev�Infostrailer
s
startxref
%d
%%%%EOF)r?rrrBrrr�r�rArr�r�)rY�new_root_ref�
start_xref�num_entriesrs     r
�write_xref_and_trailerz PdfParser.write_xref_and_trailer�s�����M�M�O�(�D�M��9�9� �N�N�4����;�D�M��_�_�*�*�4�6�6�2�
��$�/�/�*��!%����E���(�(�4�$(�$A�$A�L��!��9�9�$(�M�M�L��!�(2��%��������G�L�)�*�
+�)�J�6�
7�	
rc��t|t�r|j|}d|vrtd�|d<d|vr|j|d<|j
|g|��i|��S)Nr:�PagerE)r�r�rr�rrB)rY�ref�objs�dict_objs    r
rFzPdfParser.write_page�sa���c�3���*�*�S�/�C���!�&�w�/�H�V���8�#�!%���H�X���t�~�~�c�5�D�5�H�5�5rc�R�|j}|� |j|j��}n3|j�|jf|j|j
<|j
tt|���|jdd�}|�t|�|d<|r|j
t|��|D]}|j
t|���|�3|j
d�|j
|�|j
d�|j
d�|S)N�streamr�sstream
s
endstream
sendobj
)r�r@r�rWrrVr�r�rkr�rAr�)rYr\r]r^r�r`�objs       r
rBzPdfParser.write_obj�s����F�F���;��%�%�a�f�f�h�/�C�./�f�f�h����-G�D�O�O�C�M�M�*�	����'��-�.�/����h��-����!$�V��H�X���
�G�G�H�X�&�'��	#�C�
�G�G�H�S�M�"�	#���
�G�G�K� �
�G�G�F�O�
�G�G�$�%�	������
rc��|j�y|j|jj=|j|jdj=y)Nr<)rrrVrrXs r
r?zPdfParser.del_roots@���=�=� ���O�O�D�M�M�3�3�4��O�O�D�I�I�h�/�9�9�:rc��t|d�r|j�St|d�r|j�S	tj|j	�dtj
��S#t$rYywxYw)N�	getbuffer�getvaluer)�accessr)rrdre�mmap�fileno�ACCESS_READ�
ValueError)r�s r
rzPdfParser.get_buf_from_filesd���1�k�"��;�;�=� �
�Q�
�
#��:�:�<��
��y�y�����Q�t�7G�7G�H�H���
��
�s�3A.�.	A:�9A:c��t|j�|_|j|jz
|_|j�|jd|_|jjdd�|_	t|j|j��|_|j�t�|_
n)t|j|j��|_
td|jvd�t|jddk(d�td|jvd�tt|jdt �d	�|jd|_|j|j"�|_|j'|j$�|_|j(dd|_y)
NrRrU�Typez/Type missing in Rootr9z/Type in Root is not /Catalogr<z/Pages missing in Rootz+/Pages in Root is not an indirect reference)rAr�rrr�read_trailerrrr<rr��
read_indirectrrrPr�rRrr�linearize_page_treerrrXs r
rzPdfParser.read_pdf_infosc��"�4�8�8�}���"�2�2�T�5F�5F�F��������)�)�'�2��
��)�)�-�-�g�t�<��
��D�.�.�t�}�}�=�>��	��=�=� ��	�D�I��� 2� 2�4�=�=� A�B�D�I��w�$�)�)�3�5L�M���I�I�g��*�,�.M�	
�	�x�4�9�9�4�6N�O���t�y�y��*�,=�>�9�	
����8�,���"�0�0����@����-�-�d�.A�.A�B��
��*�*�Q�-��rc���	tt|jj��dzd�}|�|df|j|j
<|S#t$rtdd�}Y�6wxYw)Nrr)rR�maxrr�rjrV)rYr��	references   r
r@zPdfParser.next_object_id:sm��	0�)�#�d�o�o�.B�.B�.D�*E��*I�1�M�I���4:�A�;�D�O�O�I�/�/�0����	�	0�)�!�Q�/�I�	0�s�0A�A)�(A)s[][()<>{}/%]s$[][()<>{}/%\000\011\012\014\015\040]s[\000\011\012\014\015\040]s#[\000\011\012\014\015\0400-9a-fA-F]�*�+s[\000\011\014\040]*s[\r\n]+strailers<<(.*>>)s	startxrefs([0-9]+)s%%EOF�$s	<<(.*?>>)c��t|j�dz
}||jkr|j}|jj	|j|�}t|d�|}|r<|}|jj	|j|j
�dz�}|r�<|s|}|jd�}t|jd��|_	|j|�|_t�|_
|j|j��d|jvr|j|jd�yy)N�@ztrailer end not found�rr���xref_section_offsetrT)rAr�r�re_trailer_end�searchrP�start�groupr�r�interpret_trailerrrnr�read_xref_table�read_prev_trailer)rY�search_start_offset�m�
last_match�trailer_datas     r
rmzPdfParser.read_trailerls��!�$�(�(�m�e�3����!2�!2�2�"&�"3�"3�����&�&�t�x�x�1D�E���q�"9�:��
���J��#�#�*�*�4�8�8�Q�W�W�Y��^�D�A����A��w�w�q�z��(+�A�G�G�A�J���%� �2�2�<�@���#�+�������1N�1N��O��d�'�'�'��"�"�4�#4�#4�W�#=�>�(rc�Z�|j|��}|jj|j||dz�}t	|d�|jd�}t	t
|jd��|k(d�|j|�}d|vr|j|d�yy)Nryrwzprevious trailer not foundrr�zGxref section offset in previous trailer doesn't match what was expectedrT)	r��re_trailer_prevr|r�rPr~r�rr�)rYrz�trailer_offsetr�r�rs      r
r�zPdfParser.read_prev_trailer�s����-�-�BU�-�V��� � �'�'��H�H�^�n�u�&<�=�
��	�q�">�?��w�w�q�z��������
�O�2�2�U�	
��-�-�l�;���l�"��"�"�<��#8�9�#rs/([!-$&'*-.0-;=?-Z\\^-z|~]+)(?=r�r�s>>c	��i}d}	|jj||�}|sV|jj||�}t|xr|j	�t|�k(dt
||d�z�nI|j|jd��}|j||j	��\}}|||<��td|vxrt|dt�d�td|vxrt|dt�d�|S)Nrz+name not found in trailer, remaining data: rrSz&/Size not in trailer or not an integerrRz1/Root not in trailer or not an indirect reference)
�re_name�match�re_dict_endrP�endrAr�r�r~�	get_valuer�r�rR)r�r��trailerr�r�rwrxs       r
rzPdfParser.interpret_trailer�s����������!�!�,��7�A���O�O�)�)�,��?��&��6�!�%�%�'�S��%6�6�A��<���0�1�2��
��$�$�Q�W�W�Q�Z�0�C��M�M�,�����@�M�E�6� �G�C�L��	��w��D�:�g�g�.>��#D�4�	
�	��w��R�:�g�g�.>�@Q�#R�?�	
��rs([^#]*)(#([0-9a-fA-F]{2}))?c�^�d}|jj|�D]p}|jd�rI||jd�tj	|jd�jd��zz
}�]||jd�z
}�r|r|jd�St
|�S)Nr�rr]zutf-8)�re_hashes_in_name�finditerr~r��fromhexrBr�)r��raw�as_textr�r�s     r
r�zPdfParser.interpret_name�s������&�&�/�/��4�	#�A��w�w�q�z������
�Y�%6�%6�q�w�w�q�z�7H�7H��7T�%U�U�U�������
�"��		#�
��;�;�w�'�'���;�rsnull(?=strue(?=sfalse(?=s([-+]?[0-9]+)(?=s)([-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+))(?=s\[�]s<(s*)>rs
([-+]?[0-9]+)sR(?=sobj(?=s	endobj(?=r�s	%[^\r\n]*s)*sstream\r?\nsendstream(?=c��|dk(ry|jj||�}|r|j�}|jj||�}|�rt	t|j
d��dkDd�t	t|j
d��dk\d�t	|duxs?|tt|j
d��t|j
d���k(d�|j||j�|dz
��\}}|�|dfS|jj||�}t	|d	�||j�fSt	|d
�|jj||�}|r�t	t|j
d��dkDd�t	t|j
d��dk\d�tt|j
d��t|j
d���|j�fS|jj||�}|�rf|j�}i}|jj||�}|sd|j|||dz
��\}}|�|dfS|j|||dz
��\}	}|	||<|�|dfS|jj||�}|s�d|j�}|jj||�}|r�	t|d
�}
||j�|j�|
z}
|j&j||j�|
z�}t	|d�|j�}t)t+|�|
�}||fSt+|�}||fS|j,j||�}|r�|j�}g}|j.j||�}|sP|j|||dz
��\}	}|j1|	�|�|dfS|j.j||�}|s�P||j�fS|j2j||�}|rd|j�fS|j4j||�}|rd|j�fS|j6j||�}|rd|j�fS|j8j||�}|r9t;|j=|j
d���|j�fS|j>j||�}|r*t|j
d��|j�fS|j@j||�}|r*tC|j
d��|j�fS|jDj||�}|r�tGd�|j
d�D��}tI|�dzdk(r|j1tKd��tFjM|jOd��|j�fS|jPj||�}|r |jS||j��SdtU|||dz�z}t%|��#ttt f$r&}d|j#d
d�z}t%|�|�d}~wwxYw)Nr)NNrz<indirect object definition: object ID must be greater than 0r�z;indirect object definition: generation must be non-negativez2indirect object definition different than expected)�max_nestingz(indirect object definition end not foundz$indirect object definition not foundz;indirect object reference: object ID must be greater than 0z:indirect object reference: generation must be non-negativesLengthz)bad or missing Length in stream dict (%r)zstream end not foundTFc3�*K�|]}|dvs�|���
y�w)s0123456789abcdefABCDEFNrLr�s  r
r@z&PdfParser.get_value.<locals>.<genexpr>bs����#���.G�)G��#�s�	��0r]zunrecognized object: � )+�
re_commentr�r��re_indirect_def_startrPr�r~rRr��re_indirect_def_end�re_indirect_reference�
re_dict_startr��re_stream_start�	TypeErrorr{rjr<rG�
re_stream_endr�r��re_array_start�re_array_endr��re_null�re_true�re_falser�r�r��re_int�re_realr�
re_string_hexr�rAr�r�rB�
re_string_lit�get_literal_stringr�)r�r�r��expect_indirectr�r��objectr�rwrx�
stream_lenr�r��stream_data�
hex_strings               r
r�zPdfParser.get_value�sX���!����N�N� � ��v�.����U�U�W�F��%�%�+�+�D�&�9���"��A�G�G�A�J��!�#�N�
�
#��A�G�G�A�J��1�$�M�
�
#��4�'�G�"�$�S������_�c�!�'�'�!�*�o�F�G�D�	
�!�]�]�4�����k�TU�o�]�V�N�F�F��~��t�|�#��'�'�-�-�d�F�;�A�"�1�&P�Q��1�5�5�7�?�"����!G�	
�
�%�%�+�+�D�&�9���"��A�G�G�A�J��!�#�M�
�
#��A�G�G�A�J��1�$�L�
�%�S������_�c�!�'�'�!�*�o�F�����O�O����#�#�D�&�1����U�U�W�F��F����%�%�d�F�3�A��!�m�m�D�&�k�TU�o�m�V���V��>�!�4�<�'� #�
�
�d�F��VW��
� X�
��v�#��s���>�!�4�<�'��O�O�)�)�$��7����U�U�W�F��#�#�)�)�$��7�A��5�!$�V�I�%6�!7�J�#�1�5�5�7�Q�U�U�W�z�-A�B���%�%�+�+�D�!�%�%�'�J�2F�G��&�q�*@�A������"�7�6�?�K�@���6�>�!�!�����6�>�!����$�$�T�6�2����U�U�W�F��F�� � �&�&�t�V�4�A�� #�
�
�d�F��VW��
� X�
��v��
�
�e�$��>�!�4�<�'��$�$�*�*�4��8����1�5�5�7�?�"��K�K���d�F�+��������=� ��K�K���d�F�+��������=� ��L�L���t�V�,����!�%�%�'�>�!��K�K���d�F�+����3�-�-�a�g�g�a�j�9�:�A�E�E�G�C�C��J�J���T�6�*����q�w�w�q�z�?�A�E�E�G�+�+��K�K���d�F�+���������$�a�e�e�g�-�-����#�#�D�&�1���"�#��7�7�1�:�#��J��:���"�a�'��!�!�#�d�)�,��$�$�Z�%6�%6�z�%B�C�Q�U�U�W�L�L����#�#�D�&�1����)�)�$�����8�8�%��T�&�6�B�;�-G�(H�H���S�!�!��w"�8�Z�8�5�E��
�
�!�4�I��C�)��-�1�4��	5�s�[�[?�![:�:[?sF(\\[nrtbf()\\])|(\\[0-9]{1,3})|(\\(\r\n|\r|\n))|(\r\n|\r|\n)|(\()|(\))�nr��r�
�t�	�b��f�r�c�,�d}t�}|jj||�D�]\}|j|||j	��|jd�r1|j|j|jd�d�n�|jd�r.|jt|jd�ddd��n�|jd�rn�|jd�r|jd�nq|jd�r|jd	�|dz
}nI|jd
�r8|dk(rt|�|j�fcS|jd�|dz}|j�}��_d}t|��)
Nrrr��r��r��r��r�zunfinished literal string)r��re_lit_str_tokenr�r�r}r~�
escaped_charsr�r�r�r�rG)r�r�r��
nesting_depthr�r�r�s       r
r�zPdfParser.get_literal_string�sD���
�����%�%�.�.�t�V�<�	�A��M�M�$�v����	�2�3��w�w�q�z��
�
�c�/�/�����
�1�
�>�?�������
�
�c�!�'�'�!�*�Q�R�.�!�4�5�������������
�
�e�$�������
�
�d�#���"�
������ �A�%� ��=�!�%�%�'�1�1��
�
�d�#���"�
��U�U�W�F�%	�&*���S�!�!rsxrefs+([0-9]{10}) ([0-9]{5}) ([fn])( \r| \n|\r\n)c�&�d}|jj|j||jz�}t	|d�|j�}	|jj|j|�}|st	|d�	|Sd}|j�}t|jd��}t|jd��}t|||z�D]�}|jj|j|�}t	|d�|j�}|jd�d	k(}|r�\t|jd��}	t|jd��|	f}
||jvs��|
|j|<����@)
NFzxref section start not foundTzxref subsection start not foundrr�zxref entry not foundr�r�)�re_xref_section_startr�r�rrPr��re_xref_subsection_startr�r~r��
re_xref_entryr)rYrz�subsection_foundr�r��first_object�num_objectsrH�is_freerW�	new_entrys           r
r�zPdfParser.read_xref_table�sd�� ���&�&�,�,��H�H�)�D�,=�,=�=�
��	�q�"@�A��������-�-�3�3�D�H�H�f�E�A��&�$�&G����
� $���U�U�W�F��q�w�w�q�z�?�L��a�g�g�a�j�/�K��<���)C�D�	
7���&�&�,�,�T�X�X�v�>��&�q�*@�A�������'�'�!�*��,���!$�Q�W�W�Q�Z��J�!$�Q�W�W�Q�Z��*� =�I�����/�-6�����*�	
7�rc��|j|d\}}t||dk(d|d�d|d�d|�d|���|j|j||jzt|�|��d}||j|<|S)Nrrzexpected to find generation z for object ID z) in xref table, instead found generation z at offset )r�r�)rrPr�r�rrRr)rYr\r�r�rWrxs      r
rnzPdfParser.read_indirect�s���!�_�_�S��V�4���
���#�a�&� �*�3�q�6�(�/�#�a�&��J/�/9�l�+�f�X�
O�	
�
����H�H��T�&�&�&�-�s�3�#�	�
�
�
��$)����C� ��rc��|�|j}t|ddk(d�g}|dD]N}|j|�}|ddk(r|j|��.|j	|j|����P|S)Nrlr<z%/Type of page tree node is not /PagessKidsr[)�node)rrPrnr�r�ro)rYr�r�kid�
kid_objects     r
rozPdfParser.linearize_page_tree�s����<��&�&�D����M�X�%�'N�	
�����=�	H�C��+�+�C�0�J��'�"�g�-����S�!����T�5�5�:�5�F�G�	H��r)NNNr�rbr:)F)Nr�)r�)IrHrIrJrKrtr#r)r,r+r%r r4r7rCrArYrFrBr?�staticmethodrrr@�	delimiter�delimiter_or_ws�
whitespace�whitespace_or_hex�whitespace_optional�whitespace_mandatory�whitespace_optional_no_nl�newline_only�newline�re�compile�DOTALLr{r�rmr��re_whitespace_optionalr�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rnrorLrr
r�r�asp���
$�L�����$�$�*���:
�(6��*;��	��	�(�8�!�I�>�O�/�J�?��$�t�+��%��,�� 7���L�'�,�6�9R�R�G��R�Z�Z��
�	�
�	��	��		�
�	��
	��	��	��		��
	��	�	�	�	��N�!�b�j�j��
�	�
�	��	��		�
�	��
	��	��	��		��
	�	�	�	�
�O�?�*
:�(�R�Z�Z�(;�<���b�j�j��
-�	.�
�	��	��G��B�J�J�2�V�;�<�M��"�*�*�0�6�9�<O�O�P�K�����4#��
�
�#B�C���
��
��b�j�j�,�{�:�_�L�u�T�U�G��b�j�j�,�{�:�_�L�u�T�U�G��r�z�z�-��<��N�QV�V�W�H�
�R�Z�Z��2�2�_�D�u�L��F��b�j�j��
7�	8�
�	��	��G� �R�Z�Z� 3�f� <�=�N��2�:�:�1�E�9�:�L��B�J�J��f�$�'8�8�7�B��M��B�J�J�2�V�;�<�M�&�B�J�J��
�	�
�	��	��		�
�	��
	��	�	��'�B�J�J��
�	�
�	��	��		�
�	��
	��	�	��%�"�*�*��m�+�o�=��E�������
�#�#�m�3�g�=��F��J�!�b�j�j�!4��!F�G�O��B�J�J��.�.��@�5�H��M��x"��x"�t"�r�z�z�R�����e���e��	
�e��	
�e�	�
	
�e��	
�d�
�	
�d��	�u��	�D�	�5��	�D�	�5��	�D�	�5��	�D�	�5��	�D�	�5��	�D�	�4��	�D�	�4�� 	�E�
�E�!�M�&�"��"�2'�B�J�J�':�X�'E��'O�P��)�r�z�z��
�	�
�	��	��		�
�	� ���B�J�J�N�O�M��<� 
rr�)�
__future__rr�rr�rgr1r�r�r�rr;rEr	rGrP�
namedtuplerRrkrnr�rr�r�r�r�r�r�r�rLrr
�<module>r�s���"��
���	�	���
7�*��(�*��(�*�	�(�*�	�(�	*�
	�(�*�	�(�
*�	�(�*�	�(�*�	�(�*�	�(�*�	�(�*�	�(�*�	�(�*�	�(�*�	�(�*� 	�(�!*�"	�(�#*�$	�(�%*�&	�(�'*�(	�(�)*�*	�(�+*�,	�(�-*�.	�(�/*�0	�(�1*�2	�(�3*�4	�(�5*�6	�(�7*�8	�(�9*�:	�(�;*�<	�(�=*�>	�(�?*�@	�(�A*�B	�(�C*�D	�(�E*�F�
�
�
�
�
�
�S*��ZJ�	�\�	�,�
7��K���3�k�<�5P�Q�7�.9�)�9�
Y�Y�x$�$�ND�t�D�
-�k�"�"�-�`B�B�+�+�*�:E
�E
r

Zerion Mini Shell 1.0