+
    	iI3                         R t ^ RIHtHtHtHtHtHtHtH	t	H
t
Ht ^RIHt ^RIHtHt ]]^ ^ 3tR tR tR tR tR tR	 tR
 tR tR tR tR tR tR tR]R]R]R]R]R]R]R]R]R]R]R]R]/tR# )z%Calculate bounding boxes of SVG tags.)
atanatan2cosinfisinfpiradianssinsqrttan)PATH_LETTERS)	normalizepointc                   VP                   \        9  d   \        # \        VP                   ,          ! WV4      p\        V4      '       g   \        # V'       d   VP                   R8w  d   \	        V P                  VP                  R4      4      4      '       do   V P                  VP                  RR4      V4      pV^ ,          V^,          ,
          V^,          V^,          ,
          V^,          V,           V^,          V,           3pV# )zBounding box for any node.gstrokezstroke-width1px)tagBOUNDING_BOX_METHODSEMPTY_BOUNDING_BOXis_valid_bounding_boxany	get_paintgetlength)svgnode	font_sizer   boxstroke_widths   &&&&  a/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/weasyprint/svg/bounding_box.pybounding_boxr!      s    xx++!!
txx
(I
>C %%!!$((c/c#--8J*K&L&Lzz$((>5"A9MF\A%%s1vq0@'@F\!3q6L#8: J    c                    V P                  VP                  R4      VP                  R4      V4      w  r4V P                  VP                  R4      VP                  R4      V4      w  rVW4WV3# )zBounding box for rect node.xywidthheightr   r   )r   r   r   r$   r%   r&   r'   s   &&&    r    bounding_box_rectr)      sZ    99TXXc]DHHSM9=DAII488H-y:MEr"   c                    V P                  VP                  R4      VP                  R4      V4      w  r4V P                  VP                  R4      V4      pW5,
          WE,
          ^V,          ^V,          3# )zBounding box for circle node.cxcyr)r   r   r   )r   r   r   r+   r,   r-   s   &&&   r    bounding_box_circler.   "   sY    YYtxx~txx~yAFB

488C=),A6261q5!a%''r"   c                   V P                  VP                  R4      VP                  R4      V4      w  r4V P                  VP                  R4      VP                  R4      V4      w  rVWS,
          Wd,
          ^V,          ^V,          3# )zBounding box for ellipse node.rxryr+   r,   r(   )r   r   r   r0   r1   r+   r,   s   &&&    r    bounding_box_ellipser2   )   se    YYtxx~txx~yAFBYYtxx~txx~yAFB7BGQVQV++r"   c                F   V P                  VP                  R4      VP                  R4      V4      w  r4V P                  VP                  R4      VP                  R4      V4      w  rV\        W54      \        WF4      r\        W54      V,
          \        WF4      V,
          rWxW3# )zBounding box for line node.x1y1x2y2)r   r   minmax)r   r   r   r4   r5   r6   r7   r$   r%   r&   r'   s   &&&        r    bounding_box_liner:   0   s{    YYtxx~txx~yAFBYYtxx~txx~yAFBr;BqK!OS[1_6r"   c                    \         p. p\        VP                  RR4      4      pV'       d$   \        WV4      w  rgpVP	                  Wg34       K+  \        W44      # )zBounding box for polyline node.points )r   r   r   r   appendextend_bounding_box)r   r   r   r!   r<   normalized_pointsr$   r%   s   &&&     r    bounding_box_polylinerA   9   sP    %LF!$((8R"89
"'	"Jqf|44r"   c                <   VP                  RR4      p\         F  pVP                  VRV R24      pK  	  \        V4      p\        p^ p^ pRpV'       Ed   VP                  4       pVP                  R^4      ^ ,          \        9   d   V R2P                  R^4      w  rCVR9   Ed   \        WV4      w  rpVP                  R^4      w  r\        \        V
4      4      p
V^ ,          VR,          P                  4       r;VR,          P                  4       '       g(   W^ ,          ,           VR,          P                  4       r;KD  V^ ,          VR,          P                  4       r<VR,          P                  4       '       g(   W^ ,          ,           VR,          P                  4       r<KD  \        \        V4      4      \        \        V4      4      r\        WV4      w  rpVR8X  d   W,          pW,          p\        WgWWWV4	      pVw  ppppVV,           pVV,           pVV3VV33p\        VV4      pTpTpEMVR9   d   \        WV4      w  ppp\        WV4      w  ppp\        WV4      w  rpVR	8X  d5   VV,          pVV,          pVV,          pVV,          pW,          pW,          p\        VVV3VV3W334      pTpTpEMKVR
9   dN   V R2P                  R^4      w  rV P                  V^ V4      w  ppVR8X  d	   W,          p\        W]V334      pTpMVR9   d:   \        WV4      w  rpVR9   d   W,          pW,          p\        W]V334      pTpTpMVR9   d_   \        WV4      w  ppp\        WV4      w  rpVR9   d#   VV,          pVV,          pW,          pW,          p\        VVV3W334      pTpTpMRVR9   dL   V R2P                  R^4      w  rV P                  ^ W4      w  ppVR8X  d	   W,          p\        WVV334      pTpVP                  4       pEK  V# )zBounding box for path node.dr=    MaA:   NNacCchHhlLmMtTlmtqQsSqsvVv)r   r   replacer   r   stripsplitr   r   floatisdigitboolint_bounding_box_elliptical_arcr?   )r   r   r   	path_dataletterr!   
previous_x
previous_yr0   r1   rotationlargesweepr$   r%   arc_bounding_boxr4   r5   r&   r'   r6   r7   r<   _s   &&&                     r    bounding_box_pathre   D   sE   b!I %%f&m<	 )$I%LJJF
)OO%	??3"1%5$-;a 7 7Q ?FT> %ci @BI"+//#q"9HuX/H  )|Yr]-@-@-B9Bi''))#(Q<#729L9L9Ny(|Yr]-@-@-B9Bi''))#(Q<#729L9L9NyE
+T#e*-=5#CI>OA) }  <1 N$4!BE6eBfB"XBx'F.|VDLJJt^ %ci @BI %ci @BI#CI>OA) }j j j j  /Bx"bA6:<LJJt^(kO223:LA99Q9-DAq } /:02LJx#CI>OA)  /|!fYGLJJv %ci @BI#CI>OA) ~j j  /Bx!02LJJt^(kO223:LA99Q-DAq } /A02LJOO%	r"   c                    \        VRR4      # )zBounding box for text node.text_bounding_boxN)getattr)r   r   r   s   &&&r    bounding_box_textri      s    4,d33r"   c                    \         pV FK  pV P                  WB4      p\        V4      '       g   K'  Vw  rgrWh,           Wy,           r\        W6V3W334      pKM  	  V# )zBounding box for g node.)r   calculate_bounding_boxr   r?   )r   r   r   r!   childchild_bounding_boxminxminyr&   r'   maxxmaxys   &&&         r    bounding_box_grr      sc    %L 77I !344(:%Dt}$.d|d\:<L  r"   c                   ^RI Hp V! WV4      ;pf   \        # V P                  VP	                  R4      VP	                  R4      V4      w  rV\        WVR4      pV^ ,          V,           V^,          V,           V^,          V^,          3# )zBounding box for use node.)get_use_treer$   r%   T)defsrt   r   r   r   r!   )r   r   r   rt   treer$   r%   r   s   &&&     r    bounding_box_userw      sv    "S	22;!!yy#yA3i61vz3q6A:s1vs1v55r"   c	                   \        V4      \        V4      r2^ W#39   d7   \        Wp4      \        W4      \        Wp,
          4      \        W,
          4      3# \        V4      W,
          ,          ^,          \        V4      W,
          ,          ^,          ,           p	\        V4      ) W,
          ,          ^,          \        V4      W,
          ,          ^,          ,           p
V^,          V^,          ,          V^,          V
^,          ,          ,
          V^,          V	^,          ,          ,
          pW^,          V
^,          ,          V^,          V	^,          ,          ,           ,          p^ ;rV^ 8  d   W#,          pV
^,          V	^,          V^,          ,          ,           pV^ 8  d7   \        Wp4      \        W4      \        Wp,
          4      \        W,
          4      3# \	        V4      pW,          pMHWV8X  d   RM^\	        V4      ,          pW,          V
,          V,          pV) V,          V	,          V,          pV\        V4      ,          V\        V4      ,          ,
          W,           ^,          ,           pV\        V4      ,          V\        V4      ,          ,           W,           ^,          ,           pV^ \
        39   dY   VV,
          p\        ^ V) 4      pVV,           p\        ^ V4      pVV,
          p\        V) ^ 4      pVV,           p\        V^ 4      pEM#V\
        ^,          ^\
        ,          ^,          39   dY   VV,
          p\        ^ V) 4      pVV,           p\        ^ V4      pVV,
          p\        V) ^ 4      pVV,           p\        V^ 4      pEM\        V\        V4      ,          V,          4      ) p\
        \        V\        V4      ,          V,          4      ,
          pVV\        V4      ,          \        V4      ,          ,           V\        V4      ,          \        V4      ,          ,
          pVV\        V4      ,          \        V4      ,          ,           V\        V4      ,          \        V4      ,          ,
          pVV8  d	   TTppTTppVV\        V4      ,          \        V4      ,          ,           V\        V4      ,          \        V4      ,          ,           p\        VV,
          VV,
          4      pVV\        V4      ,          \        V4      ,          ,           V\        V4      ,          \        V4      ,          ,           p\        VV,
          VV,
          4      p\        V\        V4      V,          ,          4      p\        V\        V4      V,          ,          4      \
        ,           pVV\        V4      ,          \        V4      ,          ,           V\        V4      ,          \        V4      ,          ,           pVV\        V4      ,          \        V4      ,          ,           V\        V4      ,          \        V4      ,          ,           pVV8  d	   TTppTTppVV\        V4      ,          \        V4      ,          ,           V\        V4      ,          \        V4      ,          ,
          p\        VV,
          VV,
          4      pVV\        V4      ,          \        V4      ,          ,           V\        V4      ,          \        V4      ,          ,
          p\        VV,
          VV,
          4      p\        VV,
          V V,
          4      p\        VV,
          VV,
          4      pV'       g   TTppRpVV8  d   TTppRpV'       g   VV8  g   VV8  g   V'       d   VV8  g   VV8  g   \        Wp4      pV'       g   VV8  g   VV8  g   V'       d   VV8  g   VV8  g   \        Wp4      pV'       g   VV8  g   VV8  g   V'       d   VV8  g   VV8  g   \        W4      pV'       g   VV8  g   VV8  g   V'       d   VV8  g   VV8  g   \        W4      pVVVV,
          VV,
          3# )z/Bounding box of an elliptical arc in path node.FTrS   )
absr8   r   r	   r
   r   r   r   r   r9   )r4   r5   r0   r1   phira   rb   r$   r%   x1primey1primeradicantcxprimecyprimeratiofactorr+   r,   rn   tminxrp   tmaxxro   tminyrq   tmaxytmp_ytmp_xangle1angle2	other_arcs   &&&&&&&&&                      r    r[   r[      s(   Wc"gRH}1z3q:s16{CK??#h"&!A%CBF(;a(??G3xi26"Q&SRV)<q)@@G 	a"'B!Ggl22R1Ww!|5KK a'Q,&q7a<)???HG!|a<'Q,!";;a<q:s1z3qv;AFCC(^Z"Ah?+'",'B,(2-	3s8	gC0	0BFa<	?B	3s8	gC0	0BFa<	?B
q"g~Bwa"BwaBwrc1Bwb!	aR!$	$Bwa"BwaBwrc1Bwb!b3s8mb())T"s3x-",--BUOc#h..c%j3s81KKBUOc#h..c%j3s81KK$;t$D %5ER#e*_s3x//"s5z/CH2LLdRi,R#e*_s3x//"s5z/CH2LLdRi,R3s8b=)*R3s8b=)*R/BUOc#h..c%j3s81KKBUOc#h..c%j3s81KK$;t$D %5ER#e*_s3x//"s5z/CH2LLebj$),R#e*_s3x//"s5z/CH2LLdRi,27BG$F1r61r6"FI	FUNfun&5.1zFUNfun&5.1zFUNfun&5.1zFUNfun&5.1ztd{D4K//r"   c                ,   V w  r#rE\        V4      '       d   \        ) MW$,           \        V4      '       d   \        ) MW5,           rv\        V!  w  r\        V.VO5!  \        V.V	O5!  \	        V.VO5!  \	        V.V	O5!  3w  r#rgW#Wb,
          Ws,
          3# )z.Extend a bounding box to include given points.)r   r   zipr8   r9   )
r!   r<   rn   ro   r&   r'   rp   rq   x_listy_lists
   &&        r    r?   r?   Q  s     ,Ddd  &\NFD6C.v.D6C.v.0D t{DK//r"   c                `    T ;'       d&    \        V ^ ,          V ^,          ,           4      '       * # )u=   Check that a bounding box doesn’t have infinite boundaries.)r   )r!   s   &r    r   r   ^  s%    HHl1oQ&G HHHr"   rectcircleellipselinepolylinepolygonpathr   usemarkertexttspantextPathN) __doc__mathr   r   r   r   r   r   r   r	   r
   r   r   r   utilsr   r   r   r!   r)   r.   r2   r:   rA   re   ri   rr   rw   r[   r?   r   r    r"   r    <module>r      s    + J J J  ##q!^ (,5HV4

	6a0H
0I !#
%$
	n
! r"   