+
    	i                        R t ^ RIt^ RIHt ^RIHt ^RIHt ^RIH	t	H
t
 ^RIHtHt ^RIHt ^RIHtHt ^R	IHt ^R
IHt ^RIHt ^RIHtHtHt ^RIHtHtH t  ^RI!H"t" ^RI#H$t$H%t% ^RI&H't'H(t(H)t)H*t*H+t+ R t,R t-R t.R t/R t0R t1R t2R t3]R 4       t4R t5R t6R t7R t8R t9R*R lt:R  t;R! t<R" t=R# t>R$ t?R% t@R& tAR' tBR( tCR) tDR# )+zLayout for inline-level boxes.N)inf)Pending)	INHERITED)boxesbuild)AbsolutePlaceholderabsolute_layout)flex_layout)avoid_collisionsfloat_layout)grid_layout)handle_leader)handle_min_max_width)
percentageresolve_one_percentageresolve_percentages)inline_min_content_widthshrink_to_fittrailing_whitespace_size)inline_replaced_box_layout)find_in_flow_baselinetable_wrapper_width)can_break_textcharacter_ratiocreate_layoutsplit_first_linestrutc
              #  ,  "   \        W4       Vf   \        VRVP                  4       M^ Vn         \	        WW#WEWgW4
      w  rRp	V
'       d*   \        W
V4       V
P                  V
P                  ,           pV
f   R# W3x  Vf   R# Tp^ Vn        RpKc  5i)zReturn an iterator of ``(line, resume_at)``.

``line`` is a laid-out LineBox with as much content as possible that
fits in the available width.

Ntext_indent)r   r   widthr   get_next_lineboxr   
position_yheight)contextboxr!   bottom_space
skip_stackcontaining_blockabsolute_boxesfixed_boxesfirst_letter_stylefirst_line_styleline	resume_ats   &&&&&&&&&&  ^/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/weasyprint/layout/inline.pyiter_line_boxesr/      s      .sM3C3I3IJ
**J);O  ')9:4;;6J<o
!s   BBc
                j	   \        W4      pVR8X  d   R# \        WV4      pW!n        V P                  '       d2   \	        WVRR7      Vn        \        VP                  4      w  Vn        p
M^ ;Vn        Vn        \        WVRR7      w  rpVP                  pV P                  P                  4       p T;qn        T;pVn        VP
                  pW,           pWP                  ,          p. p. p. p. p. p\        WVVW4VVVVVVW4      w  ppppppVP
                  VP                  uVn        Vn        \        V4      '       d   V'       g
   ^ Vn        EM\        V V4       \        WVRR7      w  pp
p\!        T TTVRJ ;'       g    TR7      p VP                  R,          R	8X  d   V R,          p V VP
                  ,          p \#        V4      w  p!p"V"f   Q hV!f   Q hV") Vn        V"Vn        V!V",
          Vn        VV",
          p#^ Vn        ^ Vn        VP+                  V V#4       VVn        VP                  V8:  d   EMVP                  pV P                  p$Wn        \        V VVRR7      w  rpV	'       d   VP-                  VP.                  4      p%V%;P0                  R
,          un        V%P                  P                  4       V%n        V	P3                  4        F  w  p&p'V'V%P                  V&&   K  	  V%.Vn        \5        V%4       VP                  R,          R8X  d
   W3VV38H  p(M!VVP
                  ,           V3VV,           V38H  p(V('       g   EK  V$V n         VP7                  V4       VP7                  V4       V F  p)RV)P                  P8                  R,          9   d&   V)P+                  ^ VV)P                  ,
          4       KJ  V)P+                  VP                  V)P                  ,
          VVP                  ,           V)P                  ,
          4       K  	  . p*VP                  VP                  ,           p+V FL  p,V+V,n        \;        V V,WVWsRR7      w  p-p.V*P=                  V-4       V.'       g   K8  V P?                  V-V,VV.4       KN  	  V*'       d#   V;P.                  \A        V*4      ,          un        VV3# )zReturn next line from given linebox.

Return ``(line, resume_at)``, where ``line`` is a new linebox copied from the
original one, with replaced children.

This function takes care of excluded floating shapes to avoid collisions.

continueNT)r&   
first_lineF)outerlast	directionrtlz::first-lineltrinlinedisplayr&   NN)!skip_first_whitespacefirst_letter_to_boxr!   excluded_shapesr   r   r   styler"   r
   copy
position_xr   split_inline_boxis_phantom_lineboxremove_last_whitespace
text_alignline_box_verticalitybaseline
margin_topmargin_bottom	translatecopy_with_childrenchildrenelement_tagitems_adjust_line_heightextend	specifiedr   appendadd_broken_out_of_flowtuple)/r#   lineboxr!   r%   r&   r'   r(   r)   r*   r+   _rC   available_widthcandidate_heightr@   original_position_xoriginal_position_yoriginal_widthmax_xline_placeholdersline_absolutes
line_fixedwaiting_floatsline_childrenr,   r-   preserved_line_breakfirst_letterlast_letterfloat_widthnew_position_xnew_available_widthoffset_xbottomtopoffset_ynew_excluded_shapesfirst_line_boxkeyvalue	conditionplaceholderfloat_childrenwaiting_floats_ywaiting_floatnew_waiting_floatwaiting_float_resume_ats/   &&&&&&&&&&                                     r.   r    r    9   s    'w;JZ$W:LMJ#0F!'--0 *+*.>*%/9+JO ~~--224O
3==03==g0 ,)))

 &6z5,~z;L],>&R	#y.	k )-

DKK%w~d##,@DKw-1A.e2=..T.t#;;';> !!+.%7NH

"H*40!!!sl#x* %;;**;;%55"12BT+53:/
 !44T]]CN&&.8&#1#7#7#<#<#>N .446
U,1$$S) 7+,DM/!!+.%7#0#%85: :I $djj0*=#n46IBK KI9&9G#.)z"({((229==!!!Z+2H2H%HI !!+"8"88T[[(;+A+AAC ) N4'#3 5A]$4$6822 	/0""**!=2B') ( ~..?    c                J   Vf   ^ pRpMVP                  4       w  w  r#\        V \        P                  4      '       d   Ve   Q hV P                  R,          pV P
                  P                  4       pV\        V4      8X  d   R# VR9   d8   WRR pV'       d,   VP                  R4      '       d   V^,          pVR,          pK3  V'       d   VR/# R# \        V \        P                  \        P                  34      '       d   V^ 8X  d   V P                  '       g   R# \        V P                  V,          V4      pVR8X  dC   V^,          pV\        V P                  4      8  d   R# \        V P                  V,          R4      pV'       g	   V'       d   W&/# R# Ve   Q RV  24       hR# )zReturn ``skip_stack`` to start just after removable leading spaces.

See https://www.w3.org/TR/CSS21/text.html#white-space-model

Nwhite_spacer1          NNzunexpected skip inside normalnowrappre-line)rP   
isinstancer   TextBoxrA   textencodelen
startswithLineBox	InlineBoxrN   r>   )r$   r&   indexnext_skip_stackr{   r   results   &&     r.   r>   r>      s`    $.$4$4$6! #u}}%%&&&ii.xx CI::<D4??400
Bx %t}/4/#u788A:clll&s||E':OLZQJECLL))!*3<<+>EF#(F==>!8>>ry   c                   . pTp\        V\        P                  \        P                  34      '       d;   VP	                  V4       VP
                  '       g   R# VP
                  R,          pKj  \        V\        P                  4      '       d   VP                  R,          R9   g   R# VP                  P                  R4      pV'       dw   \        V4      \        VP                  4      8X  d   R# WCn        \        WR^ 4      w  rVpVf   Q hVe   Q hVP                  VP                  ,
          pVP                  Vn        MVP                  p^ Vn        RVn        VP                  P                  ^,          '       d(   VP
                   F  p	V	P                  V) RR7       K  	  V F  p
V
;P                  V,          un        K  	  R# )	zRemove in place space characters at the end of a line.

This also reduces the width and position of the inline parents of the
modified text.

Nr{     Tdxignore_floatsr=   r   )r   r   r   r   rT   rN   r   rA   r   rstripr   split_text_boxr   pango_layoutfirst_line_directionrL   )r#   r,   	ancestorsr$   new_textnew_boxresumerX   space_widthchildancestors   &&         r.   rF   rF      sW    I
C
S5==%//:
;
;|||ll2sEMM**IIm$(HHxxs#Hx=CM)+G$B"""~~ii'--/MM	ii	 ,,q00]]EOO|4O@ # +% ry   c                |   V'       Ed   V P                   '       Ed   RVR&   RpV P                   ^ ,          p\        V\        P                  4      '       Ed   V P                  P                  4       pVP                  4        F	  w  rgWuV&   K  	  VP                  P                  R4      '       dP   \        P                  ! V P                   R2VV P                  V.4      pV.V P                   R,          O5V n         V# VP                  '       EdQ   Rp	V'       d5   VP                  4       w  p
V
'       d   V
w  pVP                  VR Vn        RpVP                  '       d^   VP                  ^ ,          p\        P                  ! V4      pVR9  d   V	'       d   M$Rp	W<,          pVP                  R,          Vn        Ko  VP                  R	4      '       Ed   VR
,          R8X  d~   \        P                  ! V P                   R2WPP                  . 4      p\        P                  ! V P                   R2VV P                  V4      pV3Vn         V.V P                   O5V n         M\        P                   ! V P                   R2WPP                  . 4      p\        P"                  ! V P                   R2VV P                  . 4      pV3Vn         \        P                  ! V P                   R2VV P                  V4      pV3Vn         V.V P                   O5V n         \$        P&                  ! V4       V'       d/   X
'       d'   Vw  pV
P                  4       w  w  ppVV^,           V//pV# \        V\        P(                  4      '       d9   V'       d   VP                  4       w  p
MRp
\+        WJV4      p
V'       d   Vw  pW/pV# )z-Create a box for the ::first-letter selector.staticpositionr   z::first-letterr}   FNT
floatnone)PsPePiPfPo)rN   r   r   r   rA   rB   rP   rO   endswithr   elementr   valuesunicodedatacategorylstripBlockBoxr   r   process_text_transform	ParentBoxr?   )r$   r&   r*   re   r   letter_stylerp   rq   
letter_boxcharacter_foundchild_skip_stackr   next_letterr   text_boxline_boxchild_indexgrandchild_skip_stacks   &&&               r.   r?   r?   &  sA   clll *2:&QeU]]++99>>+L0668
$)S! 9  ))*:;;"__'~6KK%*
 ", ?cll2.> ?v u "'(2(9(9(;%$'!1%*ZZ%7
%)
jjj"'**Q-K*33K@H'EE*!*. /L!&BEJ&&t,, $G,6%*__"/~>(++r&;
 $)=="/~>KK$7 08k
+(2'BS\\'B%*^^"/~>(++r&;
 $)=="/~>KK$- 08k
+#(=="/~>KK$7 .6K)(2'BS\\'B00:!&6!+@P@V@V@X=<&;&+kAo?T-U%V
  u//$.$5$5$7! #' 2); =##6
ry   c           	     L   \        V\        P                  4      '       d3   VP                  4       p\	        W4       VP                  4       Vn        V# \        V\        P                  4      '       d   VP                  '       dH   VP                  VP                  3p\        WV4       VP                  VP                  VP                  rp\        WW#VWV4      pVP                  '       d   XX	X
uVn	        Vn        Vn        V# \        R\!        V4      P"                   R24      h)z7Compute the width and the height of the atomic ``box``.Layout for  not handled yet)r   r   ReplacedBoxrB   r   margin_heightrI   InlineBlockBoxis_table_wrapperr   r"   r   	min_width	max_widthinline_block_box_layout	TypeErrortype__name__)r#   r$   rC   r&   r'   r(   r)   containing_sizer   r   r   s   &&&&&&&    r.   
atomic_boxr   v  s     #u(())hhj"39((* J 
C--	.	./557G7N7NOOo>*-))S]]CMMiE%*2B) 6;Y	3CIs}cm J +d3i&8&8%99IJKKry   c                 v   ^RI Hp \        W4       VP                  R8X  d   ^ Vn        VP                  R8X  d   ^ Vn        VP
                  R8X  d   ^ Vn        VP                  R8X  d   ^ Vn        \        WV4       W!n        ^ Vn	        V! W\        ) VRWVRRRRRR7      w  p    p\        V4      Vn        V# )r~   )block_container_layoutautoTNF)
r%   r&   page_is_emptyr(   r)   adjoining_marginsr*   r+   discard	max_lines)blockr   r   margin_leftmargin_rightrJ   rK   inline_block_widthrC   r!   r   inline_block_baselinerI   )	r#   r$   rC   r&   r'   r(   r)   r   rX   s	   &&&&&&&  r.   r   r     s    -. & 
6!
~~
F"s%56NCN/C4Jd%RV$QUWCAq!Q )-CLJry   c                   V P                   '       d   V P                   F  p\        V\        P                  4      '       g   K%  VP                  '       g   K9  VP                  ^ ,          P                  '       g   K^  VP                  ^ ,          P                  ^ ,          pVP
                  u # 	  M/V P                  R,          R8X  d   \        V RR7      pV'       d   V# V P                  V P                  4       ,           # )zReturn the y position of the baseline for an inline block.

Position is taken from the top of its margin box.

https://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align

overflowvisibleTr4   )
r   rN   r   r   TableBoxrI   rA   r   r!   r   )r$   r   	first_rowr   s   &   r.   r   r     s     \\E%00>>>ennQ&7&@&@&@ %q 1 : :1 =I$---	 "
 
:	)	+&s6M>>C--///ry   c                 2   VP                   V P                  V P                  ,           V P                  ,           V P                  ,           V P
                  ,           V P                  ,           ,
          pV P                   R 8X  d   \        WV4      V n         R# R# )r   N)r   r   r   border_left_widthborder_right_widthpadding_leftpadding_rightr   )r$   r#   r'   available_content_widths   &&& r.   r   r     s    .44#***	 # 6 6	7	,,	-. yyF!'0GH	 ry   c                   V'       dz   VP                  4       pVP                  P                  4       Vn        VP                  4        F   w  rV\        9   g   K  WP                  V&   K"  	  \        P
                  ! V4       \        W4       R^ R^ /p\        V\        P                  4      '       d   W!n
        Vf   ^ pM'VP                  4       w  w  ppT;'       g    ^ pVe   Q h\        V4      ^ 8H  p\        WW2,
          VVR7      w  pppVf   RpMVR/pVP                  '       da   VP                  ^ ,          pVf   VP                  R,          pEM VP                  P                  4       RV P                  4       R,          pEMR;ppEM\        V\        P                   4      '       dK   VP"                  R8X  d   ^ Vn        VP$                  R8X  d   ^ Vn        \'        WW#WEWgWWW4      w  ppppppEM\\        V\        P(                  4      '       d    \+        WW%VWx4      pVVn
        RpRpRpRpEM\        V\        P,                  4      '       d_   W!n
        ^ Vn        R F)  p\1        VRV 24      R8X  g   K  \3        VRV 2^ 4       K+  	  \5        W\6        ) WVRWxR4	      w  pp  pRpRpRpM\        V\        P8                  4      '       d^   W!n
        ^ Vn        R F)  p\1        VRV 24      R8X  g   K  \3        VRV 2^ 4       K+  	  \;        W\6        ) WVRWx4      w  pp  pRpRpRpM"\=        R	\?        V4      P@                   R
24      hVVVVVV3# )a  Fit as much content as possible from an inline-level box in a width.

Return ``(new_box, resume_at, preserved_line_break, first_letter, last_letter)``.
``resume_at`` is ``None`` if all of the content fits. Otherwise it can be passed as
a ``skip_stack`` parameter to resume where we left off.

``new_box`` is non-empty (unless the box is empty) and as big as possible
while respecting ``max_x``, if possible (may overflow is no split is possible.)

leftrightNis_line_startr   Fu   ⺀margin_r   r   r=   rl   r   rk   r   )!rB   rA   rP   r   r   r   r   r   r   r   rC   r   r   r   r   decoder   r   r   rD   AtomicInlineLevelBoxr   InlineFlexBoxr!   getattrsetattrr	   r   InlineGridBoxr   r   r   r   )r#   r$   rC   r^   r%   r&   r'   r(   r)   r_   rb   rc   r*   r+   rp   rq   float_widthsskipr   r   rd   r-   re   rf   siderX   s   &&&&&&&&&&&&&&            r.   split_inline_levelr     sZ    hhjIINN$	*002JCi!&		# 3 	$$S).Aw*L#u}}%%#D","2"2"4T:991D%%%M*a/.<%,d'/)++ <ItI88888A;L|!hhrl!hhoo/6==?C)--L;	C	)	)??f$COv% C&6:l{,>'R	$)1<	l 
C33	4	4*2B) (	$  	C,,	-	-#6DsgdV,-7wtf-q1 7 '23$
e'0#Aq!  %	C,,	-	-#6DsgdV,-7wtf-q1 7 '23$
e')#Aq!  %+d3i&8&8%99IJKK0, ry   c           
      \   VP                  4       '       du   Wn        \        V4      pVP                  V4       VP                  VVV34       VP                  R ,          R8X  d   V	P                  V4       R# V
P                  V4       R# VP                  4       '       Ed   Wn        \        WVP                  4      pWW,            UUu. uF!  w  pppVP                  4       '       d   K  VNK#  	  pppV'       d   V\        V VR,          4      ,          pVW,
          8  g	   V'       d   VP                  V4       R# \        WW)V
VRR7      w  ppV'       d   V P                  WDVV4       VP                  VVV34       Tp\        VP                  4       ^ 4      pWP                  R,          ;;,          V,          uu&   VP                  R,          R8X  d+   \        V\        P                  4      '       d
   VV,          pM!VP                  R,          R8X  d
   VV,          pV F  w  ppVP!                  4       '       g   K  VP                  R,          R8X  d   VP                  R,          R8X  g5   VP                  R,          R8X  g   Kh  VP                  R,          R	8X  g   K  VP#                  VR
7       K  	  R# VP%                  4       '       dR   VP                  R ,          ^,          pV P&                  pV P(                  V,          V,          P                  V4       R# R# u uppi )r   absoluteNr;   r   r   r   r6   r8   r7   r   r=   )is_absolutely_positionedrC   r   rT   rA   
is_floatedr   r   r   r   rU   maxmargin_widthr   r   r   is_in_normal_flowrL   
is_runningcurrent_pagerunning_elements)r#   r$   r'   r   r   rN   rc   waiting_childrenrb   r(   r)   r_   r   r^   rC   r%   rs   rg   rX   child_non_floating_children	new_childfloat_resume_atr   	old_childrunning_namepages   &&&&&&&&&&&&&&&&           r.   _out_of_flow_layoutr  .  s   
 %%''%)%0  -U ;<;;z"j0!!+.{+					%#G4D4J4JK
 )1(C!((C|q&!$$& F(C 	 !( !3.r24 4K ++~ !!%()5 0+*/&I .."2OE##UIu$=>E U'')1-BW-."4.{{7#v-c5==11 "$JW%0 -9 2244[[)V3		+.%7[[)W4		+.%7''2'. !. 
				{{:.q1##  .t4;;EB 
Y!(s   	L(*L(c                    V'       Ed9   VP                  4       pV'       Ed    VP                  4       w  pppVP                  4       '       d   \        V4      '       g   KF  V'       d   W9   d
   WO,          pMR pVP                  VP                  4       ,           ^,
          pVVP                  8  d;   \        V VVP                  VVVWWgVWV4      w  pp   pV'       d   MV^,          pKK  K  V
P                  V4       Vf(   \        V\        P                  4      '       g   Q h VV/# V
P                  VVV34       VV/# V
'       d   V
R,          ^ ,          ^,           R /# R # )Nr=   )rB   popr   can_break_insiderC   r   r   rR   r   r   r   rT   )r#   r$   r^   r%   initial_skip_stackr(   r)   r_   rb   rc   rN   r   r*   r+   waiting_children_copyr   r   original_childr   r  child_resume_atrX   s   &&&&&&&&&&&&&&        r.   _break_waiting_childrenr  u  sa     !1 5 5 7##1F1J1J1L.K**,,4DU4K4K!k&G#5#B #'  $$u'9'9';;a?E%***9K^U-=-=u "2CN!7G	:I6	?Aq!Q
 #
 OO12 !%7777  11 i ?@11 Q!#T** ry   c                @   \        V P                  4      w  qn        V P                  R,          V n        WP                  ,
          ^,          pW P                  ,
          V P
                  ,
          V n        W P                  ,
          V P                  ,
          V n	        R# )zSet margins to the half leading to respect line height.

Also compensate for borders and padding, we want margin_height() == line_height.

	font_sizeN)
r   rA   rI   r"   border_top_widthpadding_toprJ   border_bottom_widthpadding_bottomrK   )r$   line_heighthalf_leadings   &  r.   rQ   rQ     sm     !&cii 0K;'CJ**,1L!$8$883??JCN$'>'>>ASASSCry   c                   VR,          pVRJ pTpTp\        V\        P                  \        P                  34      '       g   Q hVP                  VP
                  ,           VP                  ,           pVP                  VP                  ,           VP                  ,           pTp. p. pRpR;ppR^ R^ /p^ pVP                  R,          R8X  d   . pV'       d   ^ pMVP                  4       w  w  pp\        VP                  VR 4       EF!  w  ppVV,           pVP                  Vn        VP                  4       '       gW   \!        WVVVVVVV
WxV	VW2V4       VP#                  4       '       d(   V^,           pVV
9  d   VVP%                  4       ,          pK  V\'        VP                  4      ^,
          8H  pTp . p!\)        V VVV VWVWxV	V!VW4      w  p"p#p$p%p&p'VP                  R,          R8X  d   Tp(VV'R,          ,          pMTp(VV'R,          ,          pV'       d2   V('       d*   V#f&   V V(,          p \)        V VVV VWVWxV	V!VW4      w  p"p#p$p%p&p'\+        VR,          V'R,          4      VR&   \+        VR,          V'R,          4      VR&   RpV$'       d   R	pRp)VR	J d   R
pM#VRJ d   RpMVP                  R,          R9   d   Rp)V)f;   RVV%39   d   Rp)M.V%R9   d   T%p)M$\-        VV%,           VP                  R,          4      p)V)'       d   VP/                  V4       . pVf   T%pVP0                  '       d   R	pMT&pV"f$   \        V\        P2                  4      '       g   Q hM\        V\        P                  4      '       d   VP5                  VV"34       V"P6                  V"P%                  4       ,           p*V*\9        V V"4      ,
          V8  d!   \;        WW4VWxWVVVVV4      p+V+'       d   T+p# MZT*pVP5                  VV"V34       V
P/                  V!4       V#f   EK  VP/                  V4       VV#/p# M	  VP/                  V4       Rp#VP                  R,          R8X  d   \'        V4      ^8  d   V U,U-u. uF!  w  p,p-p,V-P                  4       '       g   K  V-NK#  	  p.p,p-V.^ ,          P6                  pV.RRR1,           F>  pVP=                  VVP6                  ,
          R	R7       VVP%                  4       ,          pK@  	  V#RJ p/TP?                  V UU-U,u. uF	  w  pp-p,V-NK  	  up,p-p4      p0V0PA                  V'       * V/'       * R7       \        V\        P                  4      '       d   ^ V0n!        V0P                  pV0P                  R,          R8X  d   VRRR1,          pV FR  pVP                  4       '       g   K  VP6                  VP%                  4       ,           V0P6                  ,
          V0n!         M	  MVV0n        VP                  R,          R8X  d   R	p1MVP                  R,          R8X  d   TMT/p1V1'       d&   V0P                   F  pVP=                  VR7       K  	  VV,
          V0n!        V0P=                  VR,          R	R7       \E        V04       V0P                  R,          R8X  d   V F  p2\G        V V2V0WRR7       K  	  V#e    \I        \K        V#4      4      pVV8  d   VR/p#VPL                  '       d   R	pRpV0V#VVVV3# u up-p,i u up,p-pi )av  Fit as much content as possible from an inline box in a width.

Return ``(new_box, resume_at, preserved_line_break, first_letter, last_letter)``.
``resume_at`` is ``None`` if all of the content fits. Otherwise it can be passed as
a ``skip_stack`` parameter to resume where we left off.

``new_box`` is non-empty (unless the box is empty) and as big as possible while
respecting ``max_x``, if possible (may overflow is no split is possible.)

This is the recursive step that loops over the children of the box; base steps of
recursion are handled by ``split_inline_level()``.

In this phase, excluded floating shapes are ignored.

NFr   r   r   relativer6   r7   Tr       r{   langr   )startendr8   box_decoration_breakcloner   r;   g0D   ?)prer   )TFr=   )'r   r   r   r   r   r   r   r   r   r   rA   rP   	enumeraterN   r!   r   r  r   r   r   r   r   r   rR   trailing_collapsible_spacer   rT   rC   r   r  rL   rM   remove_decorationr   rQ   r   nextiter	is_leader)3r#   r$   rC   r^   r%   r&   r'   r(   r)   r_   rb   rc   r*   r+   is_startinitial_position_xr
  left_spacingright_spacingcontent_box_leftrN   r   rd   re   rf   r   float_resume_indexr   ir   r   is_last_childrY   child_waiting_floatsr  r-   	preservedfirstr5   new_float_widthsend_spacing	can_breakrh   previous_resume_atrX   	box_childin_flow_childrenis_endr   translation_neededabsolute_boxs3   &&&&&&&&&&&&&&                                     r.   rD   rD     s   4 
XET!H##cEMM5??;<<<<3??*S-B-BB  	C,,,s/E/EE !H !%%L;Aw*L
yy
*(..0zcll45125D>>&&((.uh/-><	1
 !!%*QY".U//11E#cll"3a"77!
O\n!#7"	6 	G	9i6F 99[!U*&K%f--E'K%g..E[Y-> {*O"UJ.%';]&	: KIy)UD:J  #<#79I&9QRV #L$9;KG;T UW
#' 	$KE!KYY}%)::IU++!	-'!	*%'V)<>	 OO,-! L+++KKeU]]3333 #u}}--$$eY%78 '11I4J4J4LLN 8) LLuT%<uDV"1B!8-=?Q$	&&"
 & 2I'J##UIu$=>23 OO,-	*IQ 3T 	()	 yy&3x=1+<-5.-5/!Y**, IX 	 . &a(33
%dd++EOO!1!11$  H%,,..J ,
 $F$$.67h*uih79GL&jA#u}}%%##==%."~HE&&(($$u'9'9';;&&'    099+,7!%  IIk2e;  ))<0 *"%55\&1F }}Z J.*Lw! +
 T)_%%%+T2I
}}} 	0, o. 	8s   ,\\\c           	     (   \        V\        P                  4      '       g   Q hVP                  R,          pVP                  P                  4       VR pV^ 8X  g	   V'       g   R# \        VP                  4       VP                  WVP                  VR7      w  rxrrV	^ 8w  g   Q hV^ 8  d   VP                  VP                  4      pWn
        Wqn        Wn        \        VP                  4      w  rW,
          ^,          pWn        Wn        Wn        V;P                   VP                  ,          un        MRpV	f   RpMTWhV	 P                  4       pW8g  ;'       d    VP#                  R4      pV'       d   R	pVV9   g   Q RV: R24       hW,          p	WV3# )
a^  Keep as much text as possible from a TextBox in a limited width.

Try not to overflow but always have some text in ``new_box``.

Return ``(new_box, skip, preserved_line_break)``. ``skip`` is the number of
UTF-8 bytes to skip form the start of the TextBox for the next line, or
``None`` if all of the text fits.

Also break on preserved line breaks.

r  NFr   r   zGot z> between two lines. Expected nothing or a preserved line break)NNF)r   	   u    u    )r   r   r   rA   r   r   r   r   justification_spacingcopy_with_textr   r   r"   r   rJ   rK   rI   strip)r#   r$   rY   r   r   r  r   layoutlengthresume_indexr   r"   rI   r  rX   r  rd   betweenline_breakss   &&&&&              r.   r   r     s|    c5==))))		+&I88??TU#DA~T  <Lsyy'!!=@9FL 1z  -	!
 
 syy)#,1%(&$l+224#;;s); 	 KKk) K@GJK) 	222ry   c                   . p\        W^ R7      w  r#V UUUu. uF.  pVP                  4       '       d   RM\        WA^ R7      w  rVWEV3NK0  	  ppppV'       d\   V UUUu. uF&  w  rEpVP                  4       '       d   K  WV,
          NK(  	  ppppV'       d   \        V4      p	\        W#V	,           4      pV F}  w  rEpVP                  4       '       d   W4P                  ,
          p
MCVP                  R,          R8X  d
   W6,
          p
M"VP                  R,          R8X  g   Q hW%,
          p
\        WJ4       K  	  W#3# u upppi u upppi )zHandle ``vertical-align`` within a :class:`LineBox`.

Place all boxes vertically assuming that the baseline of ``box``
is at `y = 0`.

Return ``(max_y, min_y)``, the maximum and minimum vertical position
of margin boxes.

)
baseline_yvertical_alignrl   rk   r<   )aligned_subtree_verticalityr   r   r!   rA   translate_subtree)r$   top_bottom_subtreesmax_ymin_ysubtree	sub_max_y	sub_min_ysubtrees_with_min_maxsub_positionshighest_subdys   &          r.   rH   rH     sH    .Q0LE +>*G#..00L,< !I 
Y'*  >  2G)1F-I%%' "I!!1F 	 ) m,K{23E)>%I+++B]]+,5"B==!12h>>>"B'& *? <5>)s   D9D9E >E c                    \        V \        P                  4      '       dT   V ;P                  V,          un        V P                  R ,          R9   d!   V P
                   F  p\        W!4       K  	  R# R# V P                  VR7       R# )rH  rT  Nrl   rk   )r   r   r   r!   rA   rN   rJ  rL   )r$   rT  r   s   && r.   rJ  rJ    s_    #u''"99%&*;;!%, & <
 	ry   c                     \        WV4      w  r4W P                  ,
          pWPP                  4       ,           pVe   WT8  d   TpVe   Wc8  d   TpW43# N)inline_box_verticalityrI   r   )r$   rK  rG  rL  rM  rl   rk   s   &&&    r.   rI  rI  
  sQ    )#JOLE
||
#C$$&&F}}<ry   c                   RpRp\        V \        P                  \        P                  34      '       g   W43# V P                   EF"  pVP                  4       '       g*   VP                  4       '       d   VP                  V4       KC  VP                  R,          pVR8X  d   TpEMVR8X  dg   V P                  R,          \        V P                  R4      ,          pW(VP                  4       ,           ^,          ,
          p	WP                  ,           pEMAVR8X  dY   W P                  ,
          V P                  ,           V P                  ,           V P                  ,           p	WP                  ,           pMVR8X  d   W P                  ,
          V P                  ,           V P                  ,           V P                  ,           V P                  ,           p
WP                  4       ,
          VP                  ,           pM]VR
9   d   ^ pMS\        V\         4      '       d6   \#        V P                  4      w  rV\%        W`P                  V4      ,
          pMW&,
          pWuP                  ,
          p	\        P&                  \        P(                  \        P*                  3p\        W]4      '       d$   VP-                  WP.                  ,
          R	7       MWn        VR
9   d   VP                  V4       EK  WP                  4       ,           p
Ve   W8  d   T	pVe   W8  d   T
p\        V\        P                  4      '       g   EK  \1        WQV4      w  rVe	   W8  d   TpVf   EK  W8  g   EK   TpEK%  	  W43# )zHandle ``vertical-align`` within an :class:`InlineBox`.

Place all boxes vertically assuming that the baseline of ``box``
is at `y = baseline_y`.

Return ``(max_y, min_y)``, the maximum and minimum vertical position
of margin boxes.

NrH  rI   middler  exztext-topztext-bottomrV  rW  )r   r   r   r   rN   r   r   rT   rA   r   r   rI   rJ   r  r  r"   r   r   r   r   r   r   rL   r!   rZ  )r$   rK  rG  rL  rM  r   rH  child_baseline_yone_exrl   rk   r"   rX   	box_typeschildren_max_ychildren_min_ys   &&&             r.   rZ  rZ    s    EEcEMM5??;<<|&&((!!#**51%56Z')x'YY{+ocii.NNF)<)<)> >!CCC"^^3z),s~~=''(*-//:C"^^3}, <</#..@**+-0__=?BzzJF%(;(;(==N00  !00cii(IF)J		6-3  3
  *: /))5+>+>@S@ST	e''OOs%5%55O6" ..  &&u-**,,=CKE=FNEeU__---C,<.>*N)n.D&)n.D& @ <ry   c                   VP                   V8  d   ^ # VP                  R,          pV'       d   VP                  R,          pVR8X  d   TMTpVP                  R,          R9   pVR9   d,   VR8H  VP                  R,          R8H  ,          '       d   RpMR	pVR8X  d   ^ # W!P                   ,
          pVR
8X  d   V'       d   \        WV4       ^ # VR8X  d
   V^,          # VR	8X  g   Q hV# )z>Return the line horizontal offset according to ``text-align``.text_align_alltext_align_lastr   r{   r   r6   r7   r  r  justifycenterr   )r   r   )r   rA   justify_line)r#   r,   rY   r5   align
align_lastspace_collapseoffsets   &&&&    r.   rG   rG   i  s     zz_$JJ'(EZZ 12
#v-:ZZ. 3( (N!!VO

; 75 @AAEEzz)F	 /z~~ry   c                 V    \        V4      ;p'       d   \        WW#,          ^ 4       R# R# )    N)count_expandable_spacesadd_word_spacing)r#   r,   extra_width	nb_spacess   &&& r.   rh  rh    s(     -T22	2(?C 	3ry   c                T   \        V \        P                  4      '       d<   V P                  P	                  R4      V P                  P	                  R4      ,           # \        V \        P
                  \        P                  34      '       d   \        R V P                   4       4      # ^ # )z;Count expandable spaces (space and nbsp) for justification.r   r  c              3   8   "   T F  p\        V4      x  K  	  R # 5irY  )ro  .0r   s   & r.   	<genexpr>*count_expandable_spaces.<locals>.<genexpr>  s     L|e*511|   )	r   r   r   r   countr   r   sumrN   )r$   s   &r.   ro  ro    sj    #u}}%%xx~~c"SXX^^H%===	C%--9	:	:Ls||LLLry   c                 <   \        V\        P                  4      '       d   W!n        V;P                  V,          un        \        V4      pV^ 8  dn   \        VP                  VP                  V RVP                  R7      pVP                  4        W$,          pW6,          pV;P                  V,          un
        WQn        V# \        V\        P                  \        P                  34      '       d   V;P                  V,          un        TpVP                  pVP                  R,          R8X  d   VRRR1,          pV F'  p	V	P                  4       '       g   K  \!        W	W#4      pK)  	  V;P                  W7,
          ,          un
        V# VP#                  V^ 4       V# )rn  N)r   r>  r6   r7   r=   )r   r   r   r>  rC   ro  r   r   rA   
deactivater   r   r   r   rN   r   rp  rL   )
r#   r$   r>  	x_advancerr  rA  extra_spaceprevious_x_advancerN   r   s
   &&&&      r.   rp  rp    sI   #u}}%%$9!)#+C0	q="#))W&)&?&?AF /;K$III$I%  
C%--9	:	:)#&<<99[!U*"~HE&&((,$9F	  			Y33	  	i#ry   c                    V P                    F  p\        V\        P                  4      '       d   \	        V4      '       g    R # R Fq  p\        VP                  RV 2,          RR4      '       gF   VP                  RV R2,          '       g)   VP                  RV 2,          P                  '       g   Ko    R # 	  K  VP                  4       '       g   K   R # 	  R# )	Fr   rq   Nborder__widthpadding_Tr   )	rN   r   r   r   rE   r   rA   rq   r   )rW   r   r   s   &  r.   rE   rE     s    !!eU__--%e,,:EKK'$(897DIIgdV6$:;;htf$56<<< 	 ;
 $$&& " ry   c                    V P                   R ,          R9   p\        V \        P                  4      '       d   R# V'       dH   \        V \        P                  4      '       d(   \        V P                  V P                   R,          4      # V'       di   \        V \        P                  4      '       dI   \        ;QJ d&    R V P                   4       F  '       g   K   R# 	  R# ! R V P                   4       4      # R# )r{   Fr  c              3   8   "   T F  p\        V4      x  K  	  R # 5irY  )r	  ru  s   & r.   rw  #can_break_inside.<locals>.<genexpr>  s     Eu#E**ry  T)r   zpre-wrapr   )
rA   r   r   r   r   r   r   r   anyrN   )r$   	text_wraps   & r.   r	  r	    s    		-(,NNI#u1122	z#u}}55chh		&(9::	z#u77sEEssEsEsEEEEry   )T)E__doc__r   mathr   cssr   css.propertiesr   formatting_structurer   r   r   r   r   flexr	   r   r
   r   gridr   leaderr   min_maxr   percentr   r   r   	preferredr   r   r   replacedr   tabler   r   text.line_breakr   r   r   r   r   r/   r    r>   rF   r?   r   r   r   r   r   r  r  rQ   rD   r   rH   rJ  rI  rZ  rG   rh  ro  rp  rE   r	   ry   r.   <module>r     s    $    & / :  1  ! ) L L X X 0 =M M"BNb&R'&fM`,:0, I IbJDCN1+h
T]@<3~'T
Od"JD> 	ry   