Ë
    o]j6k  ã                   óà  — d Z ddlZddlZddlmZ  G d„ d«      Z G d„ de«      Z G d	„ d
e«      Z G d„ de«      Z G d„ dee«      Z	 G d„ de«      Z
 G d„ de«      Z G d„ dee«      Z G d„ de«      Z G d„ de«      Z G d„ dee«      Z G d„ de«      Z G d„ dee«      Z G d„ d ee«      Z G d!„ d"ee«      Z G d#„ d$e«      Z G d%„ d&e«      Z G d'„ d(e«      Z G d)„ d*e«      Z G d+„ d,e«      Z G d-„ d.e«      Z G d/„ d0e	«      Z G d1„ d2e«      Z G d3„ d4e«      Z G d5„ d6e	«      Z G d7„ d8e«      Z G d9„ d:ee«      Z G d;„ d<ee«      Z  G d=„ d>e«      Z! G d?„ d@e!e«      Z" G dA„ dBe!e«      Z#y)CuÓ  Classes for all types of boxes in the CSS formatting structure / box model.

See https://www.w3.org/TR/CSS21/visuren.html

Names are the same as in CSS 2.1 with the exception of ``TextBox``. In
WeasyPrint, any text is in a ``TextBox``. What CSS calls anonymous inline boxes
are text boxes but not all text boxes are anonymous inline boxes.

See https://www.w3.org/TR/CSS21/visuren.html#anonymous

Abstract classes, should not be instantiated:

* Box
* BlockLevelBox
* InlineLevelBox
* BlockContainerBox
* ReplacedBox
* ParentBox
* AtomicInlineLevelBox

Concrete classes:

* PageBox
* BlockBox
* InlineBox
* InlineBlockBox
* BlockReplacedBox
* InlineReplacedBox
* TextBox
* LineBox
* Various table-related Box subclasses

All concrete box classes whose name contains "Inline" or "Block" have one of
the following "outside" behavior:

* Block-level (inherits from :class:`BlockLevelBox`)
* Inline-level (inherits from :class:`InlineLevelBox`)

and one of the following "inside" behavior:

* Block container (inherits from :class:`BlockContainerBox`)
* Inline content (InlineBox and :class:`TextBox`)
* Replaced content (inherits from :class:`ReplacedBox`)

â€¦ with various combinasions of both.

See respective docstrings for details.

é    Né   )ÚAnonymousStylec                   óL  — e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZdZdZdZdZdZdZdZdZdZdZdZd„ Zd)d„Zd„ Zd„ Zed„ «       Zd	„ Zd
„ Zd*d„Z d„ Z!d„ Z"d„ Z#d„ Z$d„ Z%d„ Z&d„ Z'd„ Z(d„ Z)d„ Z*d„ Z+d„ Z,d„ Z-d„ Z.d„ Z/d„ Z0d„ Z1d„ Z2d„ Z3d„ Z4d „ Z5d!„ Z6d"„ Z7d#„ Z8d$„ Z9d%„ Z:d&„ Z;d'„ Z<d(„ Z=y)+ÚBoxz"Abstract base class for all boxes.FNc                 ó   — | j                   S ©N)Úchildren©Úselfs    ú\/var/www/zogu/zoguvenv/lib/python3.12/site-packages/weasyprint/formatting_structure/boxes.pyÚall_childrenzBox.all_childrenY   s   € Ø�}‰}Ðó    c              #   óš   K  — | –— | j                   D ]2  }|st        |t        «      r|j                  |«      E d{  –—†  Œ/|–— Œ4 y7 Œ­w)z9A flat generator for a box, its children and descendants.N)r	   Ú
isinstancer   Údescendants)r   ÚplaceholdersÚchilds      r   r   zBox.descendants\   sF   è ø€ àŠ
Ø—]‘]ò 	ˆEÙœz¨%´Ô5Ø ×,Ñ,¨\Ó:×:Ñ:à“ñ		à:ús   ‚:A¼A	½Ac                 óv   — || _         || _        || _        t        «       | _        g | _        d | _        d | _        y r   )Úelement_tagÚelementÚstyleÚsetÚremove_decoration_sidesr	   Úfirst_letter_styleÚfirst_line_style)r   r   r   r   s       r   Ú__init__zBox.__init__e   s9   € Ø&ˆÔØˆŒØˆŒ
Ü'*£uˆÔ$ØˆŒØ"&ˆÔØ $ˆÕr   c                 óN   — dt        | «      j                  › d| j                  › d�S ©Nú<ú ú>)ÚtypeÚ__name__r   r
   s    r   Ú__repr__zBox.__repr__n   s)   € Ø”4˜“:×&Ñ&Ð' q¨×)9Ñ)9Ð(:¸!Ð<Ð<r   c                 óp   — t        |j                  «      } | |j                  ||j                  g|¢­i |¤ŽS )z6Return an anonymous box that inherits from ``parent``.)r   r   r   r   )ÚclsÚparentÚargsÚkwargsr   s        r   Úanonymous_fromzBox.anonymous_fromq   s5   € ô ˜vŸ|™|Ó,ˆÙ�6×%Ñ% u¨f¯n©nÐN¸tÒNÀvÑNÐNr   c                 óˆ   — t        | «      }|j                  |«      }|j                  j                  | j                  «       |S )zReturn shallow copy of the box.)r"   Ú__new__Ú__dict__Úupdate)r   r&   Únew_boxs      r   ÚcopyzBox.copyw   s8   € ä�4‹jˆð —+‘+˜cÓ"ˆà×Ñ×Ñ §¡Ô.Øˆr   c                 ó"   — | j                  «       S )z?Return a copy of the box with recursive copies of its children.)r0   r
   s    r   ÚdeepcopyzBox.deepcopy�   s   € à�y‰y‹{Ðr   c                 óè   — ||cxk(  rdk(  ry | xj                   |z  c_         | xj                  |z  c_        | j                  «       D ](  }|r|j                  «       rŒ|j	                  |||«       Œ* y)uc   Change the boxâ€™s position.

        Also update the childrenâ€™s positions accordingly.

        r   N)Ú
position_xÚ
position_yr   Ú
is_floatedÚ	translate)r   ÚdxÚdyÚignore_floatsr   s        r   r7   zBox.translate…   si   € ð �Œ=�qŠ=Øð à�Š˜2Ñ�Ø�Š˜2Ñ�Ø×&Ñ&Ó(ò 	7ˆEÙ! e×&6Ñ&6Õ&8Ø—‘  B¨Õ6ñ	7r   c                 óN   — | j                   | j                  z   | j                  z   S )zWidth of the padding box.)ÚwidthÚpadding_leftÚpadding_rightr
   s    r   Úpadding_widthzBox.padding_width–   s"   € à�z‰z˜D×-Ñ-Ñ-°×0BÑ0BÑBÐBr   c                 óN   — | j                   | j                  z   | j                  z   S )zHeight of the padding box.)ÚheightÚpadding_topÚpadding_bottomr
   s    r   Úpadding_heightzBox.padding_heightš   s"   € à�{‰{˜T×-Ñ-Ñ-°×0CÑ0CÑCÐCr   c                 óV   — | j                  «       | j                  z   | j                  z   S )zWidth of the border box.)r?   Úborder_left_widthÚborder_right_widthr
   s    r   Úborder_widthzBox.border_widthž   s,   € à×!Ñ!Ó# d×&<Ñ&<Ñ<Ø×#Ñ#ñ$ð 	$r   c                 óV   — | j                  «       | j                  z   | j                  z   S )zHeight of the border box.)rD   Úborder_top_widthÚborder_bottom_widthr
   s    r   Úborder_heightzBox.border_height£   s,   € à×"Ñ"Ó$ t×'<Ñ'<Ñ<Ø×$Ñ$ñ%ð 	%r   c                 óV   — | j                  «       | j                  z   | j                  z   S )z)Width of the margin box (aka. outer box).)rH   Úmargin_leftÚmargin_rightr
   s    r   Úmargin_widthzBox.margin_width¨   s'   € à× Ñ Ó" T×%5Ñ%5Ñ5¸×8IÑ8IÑIÐIr   c                 óV   — | j                  «       | j                  z   | j                  z   S )z*Height of the margin box (aka. outer box).)rL   Ú
margin_topÚmargin_bottomr
   s    r   Úmargin_heightzBox.margin_height¬   s%   € à×!Ñ!Ó# d§o¡oÑ5¸×8JÑ8JÑJÐJr   c                 óh   — | j                   | j                  z   | j                  z   | j                  z   S )z0Absolute horizontal position of the content box.)r4   rN   r=   rF   r
   s    r   Úcontent_box_xzBox.content_box_x²   s2   € à�‰ ×!1Ñ!1Ñ1°D×4EÑ4EÑEØ×"Ñ"ñ#ð 	#r   c                 óh   — | j                   | j                  z   | j                  z   | j                  z   S )z.Absolute vertical position of the content box.)r5   rR   rB   rJ   r
   s    r   Úcontent_box_yzBox.content_box_y·   s0   € à�‰ §¡Ñ0°4×3CÑ3CÑCØ×!Ñ!ñ"ð 	"r   c                 óN   — | j                   | j                  z   | j                  z   S )z0Absolute horizontal position of the padding box.)r4   rN   rF   r
   s    r   Úpadding_box_xzBox.padding_box_x¼   s"   € à�‰ ×!1Ñ!1Ñ1°D×4JÑ4JÑJÐJr   c                 óN   — | j                   | j                  z   | j                  z   S )z.Absolute vertical position of the padding box.)r5   rR   rJ   r
   s    r   Úpadding_box_yzBox.padding_box_yÀ   s    € à�‰ §¡Ñ0°4×3HÑ3HÑHÐHr   c                 ó4   — | j                   | j                  z   S )z/Absolute horizontal position of the border box.)r4   rN   r
   s    r   Úborder_box_xzBox.border_box_xÄ   s   € à�‰ ×!1Ñ!1Ñ1Ð1r   c                 ó4   — | j                   | j                  z   S )z-Absolute vertical position of the border box.)r5   rR   r
   s    r   Úborder_box_yzBox.border_box_yÈ   s   € à�‰ §¡Ñ0Ð0r   c                 ó~   — | j                  «       | j                  «       | j                  «       | j                  «       fS ©z=Return the (x, y, w, h) rectangle where the box is clickable.)r^   r`   rH   rL   r
   s    r   Úhit_areazBox.hit_areaÌ   s<   € ð
 ×!Ñ!Ó# T×%6Ñ%6Ó%8Ø×!Ñ!Ó# T×%7Ñ%7Ó%9ð;ð 	;r   c           
      ór  — | j                   \  }}| j                  \  }}| j                  \  }	}
| j                  \  }}t	        t        d||z
  «      t        j                  «      }t	        t        d||z
  «      t        j                  «      }t	        t        d||z
  «      t        j                  «      }t	        t        d||z
  «      t        j                  «      }t	        t        d|	|z
  «      t        j                  «      }	t	        t        d|
|z
  «      t        j                  «      }
t	        t        d||z
  «      t        j                  «      }t	        t        d||z
  «      t        j                  «      }| j                  «       |z   }| j                  «       |z   }| j                  «       |z
  |z
  }| j                  «       |z
  |z
  }t	        dg|||z   f|||	z   f|||z   f|||
z   ffD ��cg c]  \  }}|dkD  r||z  ‘Œ c}}z   «      }||||||z  ||z  f||z  ||z  f|	|z  |
|z  f||z  ||z  ffS c c}}w )z¹Position, size and radii of a box inside the outer border box.

        bt, br, bb, and bl are distances from the outer border box,
        defining a rectangle to be rounded.

        r   é   )Úborder_top_left_radiusÚborder_top_right_radiusÚborder_bottom_right_radiusÚborder_bottom_left_radiusÚminÚmaxÚsysÚmaxsizer^   r`   rH   rL   )r   ÚbtÚbrÚbbÚblÚtlrxÚtlryÚtrrxÚtrryÚbrrxÚbrryÚblrxÚblryÚxÚyr<   rA   ÚextentÚ	sum_radiiÚratios                       r   Úrounded_boxzBox.rounded_boxÔ   s;  € ð ×0Ñ0‰
ˆˆdØ×1Ñ1‰
ˆˆdØ×4Ñ4‰
ˆˆdØ×3Ñ3‰
ˆˆdô ”3�q˜$ ™)Ó$¤c§k¡kÓ2ˆÜ”3�q˜$ ™)Ó$¤c§k¡kÓ2ˆÜ”3�q˜$ ™)Ó$¤c§k¡kÓ2ˆÜ”3�q˜$ ™)Ó$¤c§k¡kÓ2ˆÜ”3�q˜$ ™)Ó$¤c§k¡kÓ2ˆÜ”3�q˜$ ™)Ó$¤c§k¡kÓ2ˆÜ”3�q˜$ ™)Ó$¤c§k¡kÓ2ˆÜ”3�q˜$ ™)Ó$¤c§k¡kÓ2ˆà×ÑÓ "Ñ$ˆØ×ÑÓ "Ñ$ˆØ×!Ñ!Ó# bÑ(¨2Ñ-ˆØ×#Ñ#Ó%¨Ñ*¨RÑ/ˆô �Q�Cð ˜˜t™Ð$Ø˜˜t™Ð$Ø˜ ™Ð%Ø˜ ™Ð%ð	&÷	
á!�˜	ð ˜1Š}ð �YÓó	
ñ 	
ó 	ˆð ˆq�%˜Ø�E‰\˜4 %™<Ð(Ø�E‰\˜4 %™<Ð(Ø�E‰\˜4 %™<Ð(Ø�E‰\˜4 %™<Ð(ð*ð 	*ùó	
s   Ç+H3c                 ó’   — | j                  | j                  |z  | j                  |z  | j                  |z  | j                  |z  «      S r   ©r   rJ   rG   rK   rF   )r   r~   s     r   Úrounded_box_ratiozBox.rounded_box_ratio  sM   € Ø×ÑØ×!Ñ! EÑ)Ø×#Ñ# eÑ+Ø×$Ñ$ uÑ,Ø×"Ñ" UÑ*ó	,ð 	,r   c                 óz   — | j                  | j                  | j                  | j                  | j                  «      S )z?Return the position, size and radii of the rounded padding box.r�   r
   s    r   Úrounded_padding_boxzBox.rounded_padding_box	  s9   € à×ÑØ×!Ñ!Ø×#Ñ#Ø×$Ñ$Ø×"Ñ"ó	$ð 	$r   c                 ó*   — | j                  dddd«      S )z>Return the position, size and radii of the rounded border box.r   )r   r
   s    r   Úrounded_border_boxzBox.rounded_border_box  s   € à×Ñ  1 a¨Ó+Ð+r   c                 óâ   — | j                  | j                  | j                  z   | j                  | j                  z   | j
                  | j                  z   | j                  | j                  z   «      S )z?Return the position, size and radii of the rounded content box.)	r   rJ   rB   rG   r>   rK   rC   rF   r=   r
   s    r   Úrounded_content_boxzBox.rounded_content_box  se   € à×ÑØ×!Ñ! D×$4Ñ$4Ñ4Ø×#Ñ# d×&8Ñ&8Ñ8Ø×$Ñ$ t×':Ñ':Ñ:Ø×"Ñ" T×%6Ñ%6Ñ6ó	8ð 	8r   c                 ó$   — | j                   d   dv S )z#Return whether this box is floated.Úfloat)ÚleftÚrightzinline-startz
inline-end©r   r
   s    r   r6   zBox.is_floated  s   € à�z‰z˜'Ñ"Ð&UÐUÐUr   c                 ó&   — | j                   d   dk(  S )z&Return whether this box is a footnote.rŠ   Úfootnoter�   r
   s    r   Úis_footnotezBox.is_footnote#  s   € à�z‰z˜'Ñ" jÑ0Ð0r   c                 ó$   — | j                   d   dv S )z>Return whether this box is in the absolute positioning scheme.Úposition)ÚabsoluteÚfixedr�   r
   s    r   Úis_absolutely_positionedzBox.is_absolutely_positioned'  s   € à�z‰z˜*Ñ%Ð)>Ð>Ð>r   c                 ó,   — | j                   d   d   dk(  S )z-Return whether this box is a running element.r’   r   z	running()r�   r
   s    r   Ú
is_runningzBox.is_running+  s   € à�z‰z˜*Ñ% aÑ(¨KÑ7Ð7r   c                 ó�   — | j                  «       xs4 | j                  «       xs" | j                  «       xs | j                  «        S )z*Return whether this box is in normal flow.)r6   r•   r—   r�   r
   s    r   Úis_in_normal_flowzBox.is_in_normal_flow/  sH   € ð �O‰OÓò 4 ×!>Ñ!>Ó!@ò 4Ø�O‰OÓò4Ø!%×!1Ñ!1Ó!3ð5ð 	5r   c                 ó¼   — t        | t        «      xsK t        | t        «      xs9 | j                  d   dv xs& | j                  d   dk(  xr | j                  d   dk7  S )z&Return whether this box is monolithic.Úoverflow)ÚautoÚscrollÚhiddenrA   rœ   )r   ÚAtomicInlineLevelBoxÚReplacedBoxr   r
   s    r   Úis_monolithiczBox.is_monolithic5  sh   € ô �tÔ1Ó2ò -Ü�tœ[Ó)ò-à�J‰J�zÑ"Ð&8Ð8ò-ð �Z‰Z˜
Ñ# xÑ/ò ,Ø�Z‰Z˜Ñ! VÑ+ð	.r   c                 ó  — | j                  «       xs| | j                  «       xsj | j                  xs\ t        | t        «      xr t        | t
        «       xs7 t        | t
        «      xr | j                  d   dk7  xs d| j                  d   v S )z?Return whether this box establishes a block formatting context.r›   Úvisiblez	flow-rootÚdisplay)r6   r•   Ú	is_columnr   ÚBlockContainerBoxÚBlockBoxr   r
   s    r   Úestablishes_formatting_contextz"Box.establishes_formatting_context?  s�   € ð �O‰OÓò 1Ø×)Ñ)Ó+ò1à�N‰Nò1ô ˜Ô/Ó0ÒS¼ÀDÌ(Ó9SÐ5Sò1ô ˜œhÓ'ÒO¨D¯J©J°zÑ,BÀiÑ,Oò	1ð
 ˜4Ÿ:™: iÑ0Ð0ð	2r   c                 ó>   — | j                   d   | j                   d   fS )z!Return start and end page values.Úpager�   r
   s    r   Úpage_valueszBox.page_valuesL  s   € à—
‘
˜6Ñ" D§J¡J¨vÑ$6Ð7Ð7r   c                 ó€   — ddl m} | j                  �,| j                  j                  dk(  r || j                  d«      S y)z>Return whether this link should be stored as a PDF attachment.r   )Úelement_has_link_typeÚaÚ
attachmentF)Úhtmlr­   r   Útag)r   r­   s     r   Úis_attachmentzBox.is_attachmentR  s4   € å0à�<‰<Ð#¨¯©×(8Ñ(8¸CÒ(?Ù(¨¯©°|ÓDÐDØr   c                 óž   — | j                   d   dk(  r;| j                  �/| j                  j                  dv rt        | t        t
        f«       S y)z(Return whether this box is a form input.Ú
appearancerœ   )ÚbuttonÚinputÚselectÚtextareaF)r   r   r±   r   ÚLineBoxÚTextBoxr
   s    r   Úis_inputzBox.is_input\  sI   € ð �:‰:�lÑ# vÒ-°$·,±,Ð2JØ�|‰|×ÑÐ#LÑLÜ% d¬W´gÐ,>Ó?Ð?Ð?Ør   c                 óN   — | j                   €y| j                   j                  dk(  S )z*Return whether this box is a form element.FÚform)r   r±   r
   s    r   Úis_formzBox.is_formd  s$   € à�<‰<ÐØØ�|‰|×Ñ 6Ñ)Ð)r   )F©r   r   F)>r#   Ú
__module__Ú__qualname__Ú__doc__Úproper_table_childÚinternal_table_or_captionÚtabular_containerÚleading_collapsible_spaceÚtrailing_collapsible_spaceÚis_table_wrapperÚis_flex_itemÚis_grid_itemÚis_for_root_elementr¥   Ú	is_leaderÚis_outside_markerÚtransformation_matrixÚbookmark_labelÚ
string_setr�   Úcached_counter_valuesÚmissing_linkÚlink_annotationÚforce_fragmentationr   r   r   r$   Úclassmethodr*   r0   r2   r7   r?   rD   rH   rL   rP   rT   rV   rX   rZ   r\   r^   r`   rc   r   r‚   r„   r†   rˆ   r6   r�   r•   r—   r™   r¡   r¨   r«   r²   r»   r¾   © r   r   r   r   9   sN  „ Ù,ð ÐØ %ÐØÐð !&ÐØ!&Ðð ÐØ€LØ€LØÐØ€IØ€IØÐð !ÐØ€NØ€JØ€HØ ÐØ€LØ€OØÐòóò%ò=ð ñOó ðOò
òó7ò"CòDò$ò
%ò
JòKò#ò
"ò
KòIò2ò1ò;ò,*ò\,ò$ò,ò8òVò1ò?ò8ò5ò.ò	2ò8òòó*r   r   c                   óV   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	ˆ fd„Z
d	„ Zd
„ Zˆ xZS )Ú	ParentBoxzA box that has children.c                 óH   •— t         ‰| �  |||«       t        |«      | _        y r   )Úsuperr   Útupler	   ©r   r   r   r   r	   Ú	__class__s        €r   r   zParentBox.__init__m  s   ø€ Ü‰Ñ˜ e¨WÔ5Ü˜h›ˆ�r   c                 óœ   — | j                   j                  |«       t        | d|› �d«       t        | d|› �d«       t        | d|› d�d«       y)z4Set to 0 the margin, padding and border of ``side``.Úmargin_r   Úpadding_Úborder_Ú_widthN)r   ÚaddÚsetattr©r   Úsides     r   Ú_reset_spacingzParentBox._reset_spacingq  sQ   € à×$Ñ$×(Ñ(¨Ô.Ü�˜ ˜vÐ&¨Ô*Ü�˜  Ð'¨Ô+Ü�˜ ˜v VÐ,¨aÕ0r   c                 óx   — | j                   d   dk(  ry |r| j                  d«       |r| j                  d«       y y )NÚbox_decoration_breakÚcloneÚtopÚbottom©r   rç   )r   ÚstartÚends      r   Úremove_decorationzParentBox.remove_decorationx  s>   € Ø�:‰:Ð,Ñ-°Ò8ØÙØ×Ñ Ô&ÙØ×Ñ Õ)ð r   c                 óR   — | j                  «       }||_        t        «       | _        |S )z8Create a new equivalent box with given ``new_children``.)r0   r	   r   r   )r   Únew_childrenr/   s      r   Úcopy_with_childrenzParentBox.copy_with_children€  s&   € à—)‘)“+ˆØ'ˆÔô (+£uˆÔ$àˆr   c                 óh   — | j                  «       }t        d„ | j                  D «       «      |_        |S )Nc              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   )r2   )Ú.0r   s     r   ú	<genexpr>z%ParentBox.deepcopy.<locals>.<genexpr>�  s   è ø€ ÒK°E˜uŸ~™~×/ÑKùs   ‚)r0   Úlistr	   )r   Úresults     r   r2   zParentBox.deepcopy‹  s(   € Ø—‘“ˆÜÑK¸T¿]¹]ÔKÓKˆŒØˆr   c                 ó~   — | j                   sJ ‚| j                  D ]  }t        |t        «      sŒ|c S  t	        d«      ‚)z!Get the table wrapped by the box.zTable wrapper without a table)rÈ   r	   r   ÚTableBoxÚ
ValueError)r   r   s     r   Úget_wrapped_tablezParentBox.get_wrapped_table�  sA   € à×$Ò$Ð$Ð$Ø—]‘]ò 	>ˆEÜ˜%¤Õ*Ø’ð	>ô Ð<Ó=Ð=r   c                 ón  •— t         ‰| �  «       \  }}| j                  D �cg c]  }|j                  «       sŒ|‘Œ }}|rot	        |«      dk(  r)|d   j                  «       }|d   xs |}|d   xs |}||fS |d   |d   }}|j                  «       d   xs |}|j                  «       d   xs |}||fS c c}w )Nre   r   éÿÿÿÿ)rÚ   r«   r	   r™   Úlen)	r   Ústart_valueÚ	end_valuer   r	   r«   Ú	start_boxÚend_boxrÝ   s	           €r   r«   zParentBox.page_values™  sá   ø€ Ü!&¡Ñ!4Ó!6Ñˆ�Yð
  $Ÿ}™}öKØ°×0GÑ0GÕ0IŠEðKˆð KáÜ�8‹} Ò!Ø& q™k×5Ñ5Ó7�Ø)¨!™nÒ;°�Ø'¨™NÒ7¨i�	ð
 ˜IÐ%Ð%ð &.¨a¡[°(¸2±,˜7�	Ø'×3Ñ3Ó5°aÑ8ÒG¸K�Ø#×/Ñ/Ó1°!Ñ4ÒA¸	�	Ø˜IÐ%Ð%ùòKs
   ¡B2·B2c                 óÌ   — | j                   xsV | j                  xsH | j                  xs: | j                  xs, | j	                  «       xs | j
                  xs | j                   S r   )rJ   rB   rÉ   rÊ   r¨   rÈ   rË   r
   s    r   Útop_margin_collapseszParentBox.top_margin_collapses«  so   € à×!Ñ!ò % T×%5Ñ%5ò %Ø×Ñò%Ø!%×!2Ñ!2ò%à×/Ñ/Ó1ò%ð ×!Ñ!ò%ð ×$Ñ$ð&ð 	&r   c                 óÌ   — | j                   xsV | j                  xsH | j                  xs: | j                  xs, | j	                  «       xs | j
                  xs | j                   S r   )rK   rC   rÉ   rÊ   r¨   rÈ   rË   r
   s    r   Úbottom_margin_collapsesz!ParentBox.bottom_margin_collapses³  so   € à×$Ñ$ò %¨×(;Ñ(;ò %Ø×Ñò%Ø!%×!2Ñ!2ò%à×/Ñ/Ó1ò%ð ×!Ñ!ò%ð ×$Ñ$ð&ð 	&r   )r#   rÀ   rÁ   rÂ   r   rç   rð   ró   r2   rý   r«   r  r  Ú__classcell__©rÝ   s   @r   rØ   rØ   k  s3   ø„ Ù"ô(ò1ò*ò	òò
>ô&ò$&ö&r   rØ   c                   ó   — e Zd ZdZdZy)ÚBlockLevelBoxz°A box that participates in an block formatting context.

    An element with a ``display`` value of ``block``, ``list-item`` or
    ``table`` generates a block-level box.

    N)r#   rÀ   rÁ   rÂ   Ú	clearancerÖ   r   r   r  r  ¼  s   „ ñð �Ir   r  c                   ó   — e Zd ZdZy)r¦   aj  A box that contains only block-level boxes or only line boxes.

    A box that either contains only block-level boxes or establishes an inline
    formatting context and thus contains only line boxes.

    A non-replaced element with a ``display`` value of ``block``,
    ``list-item``, ``inline-block`` or 'table-cell' generates a block container
    box.

    N©r#   rÀ   rÁ   rÂ   rÖ   r   r   r¦   r¦   Æ  s   „ ò	r   r¦   c                   ó   — e Zd ZdZy)r§   z£A block-level box that is also a block container.

    A non-replaced element with a ``display`` value of ``block``, ``list-item``
    generates a block box.

    Nr  rÖ   r   r   r§   r§   Ó  ó   „ òr   r§   c                   ó4   ‡ — e Zd ZdZdZdZeˆ fd„«       Zˆ xZS )r¹   aK  A box that represents a line in an inline formatting context.

    Can only contain inline-level boxes.

    In early stages of building the box tree a single line box contains many
    consecutive inline boxes. Later, during layout phase, each line boxes will
    be split into multiple line boxes, one for each actual line.

    ÚclipÚnonec                 óz   •— t        ‰| �  |g|¢­i |¤Ž}|j                  d   dk7  r|j                  d   |_        |S )Nr›   r£   Útext_overflow)rÚ   r*   r   r  )r&   r'   r(   r)   ÚboxrÝ   s        €r   r*   zLineBox.anonymous_fromé  sC   ø€ ä‰gÑ$ VÐ=¨dÒ=°fÑ=ˆØ�<‰<˜
Ñ# yÒ0Ø &§¡¨_Ñ =ˆCÔØˆ
r   )	r#   rÀ   rÁ   rÂ   r  Úblock_ellipsisrÕ   r*   r	  r
  s   @r   r¹   r¹   Ü  s&   ø„ ñð €MØ€Nàóó ôr   r¹   c                   ó   — e Zd ZdZd„ Zy)ÚInlineLevelBoxaQ  A box that participates in an inline formatting context.

    An inline-level box that is not an inline box is said to be "atomic". Such
    boxes are inline blocks, replaced elements and inline tables.

    An element with a ``display`` value of ``inline``, ``inline-table``, or
    ``inline-block`` generates an inline-level box.

    c                 ó¬   — | j                   d   dk(  ry | j                   d   dk(  }|r| j                  |rdnd«       |r| j                  |rdnd«       y y )Nré   rê   Ú	directionÚltrr‹   rŒ   rí   )r   rî   rï   r  s       r   rð   z InlineLevelBox.remove_decorationû  sY   € Ø�:‰:Ð,Ñ-°Ò8ØØ�j‰j˜Ñ%¨Ñ.ˆÙØ×Ñ©#¡°7Ô;ÙØ×Ñ©3¡°FÕ;ð r   N)r#   rÀ   rÁ   rÂ   rð   rÖ   r   r   r  r  ñ  s   „ ñó<r   r  c                   ó   — e Zd ZdZd„ Zy)Ú	InlineBoxa  An inline box with inline children.

    A box that participates in an inline formatting context and whose content
    also participates in that inline formatting context.

    A non-replaced element with a ``display`` value of ``inline`` generates an
    inline box.

    c                 óv   — | j                  «       | j                  | j                  «       | j                  «       fS rb   )r^   r5   rH   rT   r
   s    r   rc   zInlineBox.hit_area  s7   € ð ×!Ñ!Ó# T§_¡_Ø×!Ñ!Ó# T×%7Ñ%7Ó%9ð;ð 	;r   N)r#   rÀ   rÁ   rÂ   rc   rÖ   r   r   r  r    s   „ ñó;r   r  c                   ó,   ‡ — e Zd ZdZdZˆ fd„Zd„ Zˆ xZS )rº   z²A box that contains only text and has no box children.

    Any text in the document ends up in a text box. What CSS calls "anonymous
    inline boxes" are also text boxes.

    r   c                 ó>   •— |sJ ‚t         ‰| �  |||«       || _        y r   )rÚ   r   Útext)r   r   r   r   r#  rÝ   s        €r   r   zTextBox.__init__  s"   ø€ ÙˆˆtÜ‰Ñ˜ e¨WÔ5Øˆ�	r   c                 ó<   — |sJ ‚| j                  «       }||_        |S )z?Return a new TextBox identical to this one except for the text.)r0   r#  )r   r#  r/   s      r   Úcopy_with_textzTextBox.copy_with_text$  s    € áˆˆtØ—)‘)“+ˆØˆŒØˆr   )r#   rÀ   rÁ   rÂ   Újustification_spacingr   r%  r	  r
  s   @r   rº   rº     s   ø„ ñð Ðôö
r   rº   c                   ó   — e Zd ZdZy)rŸ   zpAn atomic box in an inline formatting context.

    This inline-level box cannot be split for line breaks.

    Nr  rÖ   r   r   rŸ   rŸ   ,  ó   „ òr   rŸ   c                   ó   — e Zd ZdZy)ÚInlineBlockBoxzëA box that is both inline-level and a block container.

    It behaves as inline on the outside and as a block on the inside.

    A non-replaced element with a 'display' value of 'inline-block' generates
    an inline-block box.

    Nr  rÖ   r   r   r*  r*  4  s   „ òr   r*  c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )r    u£   A box whose content is replaced.

    For example, ``<img>`` are replaced: their content is rendered externally
    and is opaque from CSSâ€™s point of view.

    c                 ó6   •— t         ‰| �  |||«       || _        y r   )rÚ   r   Úreplacement)r   r   r   r   r-  rÝ   s        €r   r   zReplacedBox.__init__F  s   ø€ Ü‰Ñ˜ e¨WÔ5Ø&ˆÕr   ©r#   rÀ   rÁ   rÂ   r   r	  r
  s   @r   r    r    ?  s   ø„ ñ÷'ð 'r   r    c                   ó   — e Zd ZdZy)ÚBlockReplacedBoxz·A box that is both replaced and block-level.

    A replaced element with a ``display`` value of ``block``, ``liste-item`` or
    ``table`` generates a block-level replaced box.

    Nr  rÖ   r   r   r0  r0  K  r  r   r0  c                   ó   — e Zd ZdZy)ÚInlineReplacedBoxzÉA box that is both replaced and inline-level.

    A replaced element with a ``display`` value of ``inline``,
    ``inline-table``, or ``inline-block`` generates an inline-level replaced
    box.

    Nr  rÖ   r   r   r2  r2  T  s   „ òr   r2  c                   ó4   ‡ — e Zd ZdZdZd„ Zdˆ fd„	Zd„ Zˆ xZS )rû   z(Box for elements with ``display: table``Tc                 óV   — t        j                  | j                  | j                  «      S r   )Ú	itertoolsÚchainr	   Úcolumn_groupsr
   s    r   r   zTableBox.all_childrend  s   € Ü�‰˜tŸ}™}¨d×.@Ñ.@ÓAÐAr   c                 ót   •— | j                   D �cg c]  }||z   ‘Œ	 c}| _         t        ‰| �	  |||«      S c c}w r   )Úcolumn_positionsrÚ   r7   )r   r8   r9   r:   r’   rÝ   s        €r   r7   zTableBox.translateg  sA   ø€ à*.×*?Ñ*?ö!AØ&ˆH�r‹Mò!AˆÔä‰wÑ   R¨Ó7Ð7ùò!As   �5c                 ó>   — | j                   d   | j                   d   fS )Nrª   r�   r
   s    r   r«   zTableBox.page_valuesl  s   € Ø—
‘
˜6Ñ" D§J¡J¨vÑ$6Ð7Ð7r   r¿   )	r#   rÀ   rÁ   rÂ   rÅ   r   r7   r«   r	  r
  s   @r   rû   rû   ^  s   ø„ Ù2ð ÐòBõ8ö
8r   rû   c                   ó   — e Zd ZdZy)ÚInlineTableBoxz/Box for elements with ``display: inline-table``Nr  rÖ   r   r   r<  r<  p  s   „ Ú9r   r<  c                   ó,   — e Zd ZdZdZdZdZeefZ	dZ
dZy)ÚTableRowGroupBoxz2Box for elements with ``display: table-row-group``TFN)r#   rÀ   rÁ   rÂ   rÃ   rÄ   rÅ   rû   r<  Úproper_parentsÚ	is_headerÚ	is_footerrÖ   r   r   r>  r>  t  s-   „ Ù<ØÐØ $ÐØÐØ Ð/€Nð €IØ�Ir   r>  c                   ó&   — e Zd ZdZdZdZdZeee	fZ
y)ÚTableRowBoxz,Box for elements with ``display: table-row``TN)r#   rÀ   rÁ   rÂ   rÃ   rÄ   rÅ   rû   r<  r>  r?  rÖ   r   r   rC  rC  €  s$   „ Ù6ØÐØ $ÐØÐØ Ð0@ÐA�Nr   rC  c                   óV   — e Zd ZdZdZdZeefZdZ	dZ
dZdZdZdZdZdZd„ Zed„ «       Zy)ÚTableColumnGroupBoxz5Box for elements with ``display: table-column-group``Tr   c                 óp   — | j                   D ��cg c]  }|j                  «       D ]  }|‘Œ Œ c}}S c c}}w )z3Return cells that originate in the group's columns.)r	   Ú	get_cells)r   ÚcolumnÚcells      r   rG  zTableColumnGroupBox.get_cells™  sF   € ð  $Ÿ}™}÷MØ¸×9IÑ9IÓ9KòMØ15ŠDðMØóMð 	Mùó Ms   �2c                 ó²   — | j                   rt        | j                   «      S ddlm}  || j                  j                  d«      «      }|�t        |d«      S dS ©Nr   ©Úparse_integerÚspanre   )r	   r   r°   rM  r   Úgetrk   ©r   rM  rN  s      r   rN  zTableColumnGroupBox.spanž  sJ   € à�=Š=Ü�t—}‘}Ó%Ð%å,á  §¡×!1Ñ!1°&Ó!9Ó:ˆDØ#'Ð#3”3�t˜Q“<Ð:¸Ð:r   N)r#   rÀ   rÁ   rÂ   rÃ   rÄ   rû   r<  r?  rR   rS   rN   rO   rB   rC   r=   r>   rG  ÚpropertyrN  rÖ   r   r   rE  rE  ˆ  s_   „ Ù?ØÐØ $ÐØ Ð/€Nð €JØ€MØ€KØ€Là€KØ€NØ€LØ€MòMð
 ñ;ó ñ;r   rE  c                   óX   — e Zd ZdZdZdZeeefZ	dZ
dZdZdZdZdZdZdZd„ Zed„ «       Zy)ÚTableColumnBoxz/Box for elements with ``display: table-column``Tr   c                 ó   — t         ‚)zRReturn cells that originate in the column.

        Is set on instances.

        )ÚNotImplementedErrorr
   s    r   rG  zTableColumnBox.get_cells»  s
   € ô "Ð!r   c                 óp   — ddl m}  || j                  j                  d«      «      }|�t	        |d«      S dS rK  )r°   rM  r   rO  rk   rP  s      r   rN  zTableColumnBox.spanÃ  s4   € å(á˜TŸ\™\×-Ñ-¨fÓ5Ó6ˆØ#Ð/Œs�4˜‹|Ð6°QÐ6r   N)r#   rÀ   rÁ   rÂ   rÃ   rÄ   rû   r<  rE  r?  rR   rS   rN   rO   rB   rC   r=   r>   rG  rQ  rN  rÖ   r   r   rS  rS  ª  sa   „ Ù9ØÐØ $ÐØ Ð0CÐD€Nð €JØ€MØ€KØ€Là€KØ€NØ€LØ€Mò"ð ñ7ó ñ7r   rS  c                   ó&   ‡ — e Zd ZdZdZˆ fd„Zˆ xZS )ÚTableCellBoxz-Box for elements with ``display: table-cell``Tc                 ó  •— t        ‰| �  |i |¤Ž ddlm}  || j                  j                  d«      «      }|�t        |d«      nd| _         || j                  j                  d«      «      }|�t        |d«      | _        y d| _        y )Nr   rL  Úcolspanre   Úrowspanr   )	rÚ   r   r°   rM  r   rO  rk   rZ  r[  )r   r(   r)   rM  rZ  r[  rÝ   s         €r   r   zTableCellBox.__init__Ï  sx   ø€ Ü‰Ñ˜$Ð) &Ò)õ 	)á §¡× 0Ñ 0°Ó ;Ó<ˆØ*1Ð*=”s˜7 A”À1ˆŒÙ §¡× 0Ñ 0°Ó ;Ó<ˆØ*1Ð*=”s˜7 A“ˆ�À1ˆ�r   )r#   rÀ   rÁ   rÂ   rÄ   r   r	  r
  s   @r   rX  rX  Ë  s   ø„ Ù7Ø $Ð÷Eð Er   rX  c                   ó    — e Zd ZdZdZdZeefZy)ÚTableCaptionBoxz0Box for elements with ``display: table-caption``TN)	r#   rÀ   rÁ   rÂ   rÃ   rÄ   rû   r<  r?  rÖ   r   r   r]  r]  ß  s   „ Ù:ØÐØ $ÐØ Ð/�Nr   r]  c                   óH   ‡ — e Zd ZdZˆ fd„Zd„ Zed„ «       Zed„ «       Zˆ xZ	S )ÚPageBoxz¤Box for a page.

    Initially the whole document will be in the box for the root element.
    During layout a new page box is created after every page break.

    c                 ó:   •— || _         t        ‰| �	  d |d g ¬«       y ©N)r   r   r   r	   )Ú	page_typerÚ   r   )r   rb  r   rÝ   s      €r   r   zPageBox.__init__í  s&   ø€ Ø"ˆŒä‰ÑØ E°4À"ð 	õ 	Fr   c                 óN   — dt        | «      j                  › d| j                  › d�S r   )r"   r#   rb  r
   s    r   r$   zPageBox.__repr__ó  s'   € Ø”4˜“:×&Ñ&Ð' q¨¯©Ð(8¸Ð:Ð:r   c                 ób   — dD �ci c]  }|| j                   d|› �   j                  “Œ! c}S c c}w )N)rë   rŒ   rì   r‹   Úbleed_)r   Úvaluerå   s     r   ÚbleedzPageBox.bleedö  s>   € ð ;ö<àð �$—*‘*˜v d V˜_Ñ-×3Ñ3Ñ3ò<ð 	<ùò <s   …$,c                 óþ   — | j                   d    | j                   d    | j                  «       | j                   d   z   | j                   d   z   | j                  «       | j                   d   z   | j                   d   z   fS )Nr‹   rë   rŒ   rì   )rg  rP   rT   r
   s    r   Ú
bleed_areazPageBox.bleed_areaü  s}   € ð �Z‰Z˜ÑÐ $§*¡*¨UÑ"3Ð!3Ø×ÑÓ $§*¡*¨VÑ"4Ñ4°t·z±zÀ'Ñ7JÑJØ×ÑÓ  4§:¡:¨eÑ#4Ñ4°t·z±zÀ(Ñ7KÑKðMð 	Mr   )
r#   rÀ   rÁ   rÂ   r   r$   rQ  rg  ri  r	  r
  s   @r   r_  r_  æ  s=   ø„ ñôFò;ð ñ<ó ð<ð
 ñMó ôMr   r_  c                   ó(   ‡ — e Zd ZdZˆ fd„Zd„ Zˆ xZS )Ú	MarginBoxz3Box in page margins, as defined in CSS3 Paged Mediac                 ó:   •— || _         t        ‰| �	  d |d g ¬«       y ra  )Ú
at_keywordrÚ   r   )r   rm  r   rÝ   s      €r   r   zMarginBox.__init__  s&   ø€ Ø$ˆŒä‰ÑØ E°4À"ð 	õ 	Fr   c                 óN   — dt        | «      j                  › d| j                  › d�S r   )r"   r#   rm  r
   s    r   r$   zMarginBox.__repr__  s'   € Ø”4˜“:×&Ñ&Ð' q¨¯©Ð(9¸Ð;Ð;r   ©r#   rÀ   rÁ   rÂ   r   r$   r	  r
  s   @r   rk  rk    s   ø„ Ù=ôFö<r   rk  c                   ó(   ‡ — e Zd ZdZˆ fd„Zd„ Zˆ xZS )ÚFootnoteAreaBoxz-Box displaying footnotes, as defined in GCPM.c                 ó:   •— || _         t        ‰| �	  d |d g ¬«       y ra  )rª   rÚ   r   )r   rª   r   rÝ   s      €r   r   zFootnoteAreaBox.__init__  s&   ø€ ØˆŒ	ä‰ÑØ E°4À"ð 	õ 	Fr   c                 ó4   — dt        | «      j                  › d�S )Nr   z @footnote>)r"   r#   r
   s    r   r$   zFootnoteAreaBox.__repr__  s   € Ø”4˜“:×&Ñ&Ð' {Ð3Ð3r   ro  r
  s   @r   rq  rq    s   ø„ Ù7ôFö4r   rq  c                   ó   — e Zd ZdZy)ÚFlexContainerBoxz$A box that contains only flex-items.Nr  rÖ   r   r   ru  ru    s   „ Ú.r   ru  c                   ó   — e Zd ZdZy)ÚFlexBoxz‰A box that is both block-level and a flex container.

    It behaves as block on the outside and as a flex container on the inside.

    Nr  rÖ   r   r   rw  rw     r(  r   rw  c                   ó   — e Zd ZdZy)ÚInlineFlexBoxz‹A box that is both inline-level and a flex container.

    It behaves as inline on the outside and as a flex container on the inside.

    Nr  rÖ   r   r   ry  ry  (  r(  r   ry  c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚGridContainerBoxz$A box that contains only grid-items.c                 ó8   •— t         ‰| �  ||||«       i | _        y r   )rÚ   r   ÚadvancementsrÜ   s        €r   r   zGridContainerBox.__init__2  s   ø€ Ü‰Ñ˜ e¨W°hÔ?àˆÕr   r.  r
  s   @r   r{  r{  0  s   ø„ Ù.÷ð r   r{  c                   ó   — e Zd ZdZy)ÚGridBoxz‰A box that is both block-level and a grid container.

    It behaves as block on the outside and as a grid container on the inside.

    Nr  rÖ   r   r   r  r  8  r(  r   r  c                   ó   — e Zd ZdZy)ÚInlineGridBoxz‹A box that is both inline-level and a grid container.

    It behaves as inline on the outside and as a grid container on the inside.

    Nr  rÖ   r   r   r�  r�  @  r(  r   r�  )$rÂ   r5  rl   Úcssr   r   rØ   r  r¦   r§   r¹   r  r  rº   rŸ   r*  r    r0  r2  rû   r<  r>  rC  rE  rS  rX  r]  r_  rk  rq  ru  rw  ry  r{  r  r�  rÖ   r   r   ú<module>rƒ     s´  ðñ0ód Û 
å  ÷o*ñ o*ôd	N&�ô N&ôb�Cô ô
˜	ô 
ôÐ  -ô ôˆiô ô*<�Sô <ô(;� 	ô ;ô"ˆnô ô,˜>ô ôÐ)Ð+<ô ô	'�#ô 	'ô�{ Mô ô˜Ð%9ô ô8ˆ}˜iô 8ô$:�Xô :ô	�yô 	ôB�)ô Bô;˜)ô ;ôD7�Yô 7ôBEÐ$ô Eô(0�hô 0ôMˆiô Mô<	<Ð!ô 	<ô	4�hô 	4ô/�yô /ôÐ ô ôÐ$ nô ô�yô ôÐ ô ôÐ$ nõ r   