ó
    ˆ*£h'  ã                  ó   • S r SSKJr  SSKJrJrJr  SSKJr  SSK	J
r
  SSKJrJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJrJrJr  SSKJr  \(       a  SSKJr  SSKJ r   SSKJ!r!   " S S\5      r" " S S\5      r# " S S\5      r$g)z@lxml custom element classes for shape-tree-related XML elements.é    )Úannotations)ÚTYPE_CHECKINGÚCallableÚIterator)ÚMSO_CONNECTOR_TYPE)Ú	parse_xml)ÚnsdeclsÚqn)ÚCT_Shape)ÚCT_Connector)ÚCT_GraphicalObjectFrame)Ú
CT_Picture)ÚBaseShapeElement)ÚBaseOxmlElementÚOneAndOnlyOneÚ	ZeroOrOne)ÚEmu)ÚPP_PLACEHOLDER)ÚShapeElement)ÚCT_Transform2Dc                  óJ  • \ rS rSr% Sr\" S5      rS\S'   \" S5      rS\S'   \	" S	5      \	" S
5      \	" S5      \	" S5      \	" S5      \	" S5      4r
                S$S jr                    S%S jrS&S jrS'S jr                  S(S jr              S)S jr                  S*S jrS+S jr\S 5       r\S 5       rS,S jrS rS-S jr\S.S j5       r\S/S j5       rS0S jr\S1S j5       r\S2S  j5       r\S.S! j5       rS"r g#)3ÚCT_GroupShapeé   zQUsed for shape tree (`p:spTree`) as well as the group shape (`p:grpSp`) elements.zp:nvGrpSpPrÚCT_GroupShapeNonVisualÚ	nvGrpSpPrz	p:grpSpPrÚCT_GroupShapePropertiesÚgrpSpPrzp:spúp:grpSpzp:graphicFramezp:cxnSpzp:piczp:contentPartc           	     ó\   • [         R                  " XX4XVU5      nU R                  US5        U$ )zLReturn new `p:sp` appended to the group/shapetree with specified attributes.úp:extLst)r   Únew_autoshape_spÚinsert_element_before)	ÚselfÚid_ÚnameÚprstÚxÚyÚcxÚcyÚsps	            ÚX/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pptx/oxml/shapes/groupshape.pyÚadd_autoshapeÚCT_GroupShape.add_autoshape+   s/   € ô ×&Ò& s°$¸1À"ÓEˆØ×"Ñ" 2 zÔ2Øˆ	ó    c
                óŠ   • [         R                  " U5      n
[        R                  " XX¤XVXxU	5	      nU R	                  US5        U$ )zRReturn new `p:cxnSp` appended to the group/shapetree with the specified attribues.r    )r   Úto_xmlr   Ú	new_cxnSpr"   )r#   r$   r%   Útype_memberr'   r(   r)   r*   ÚflipHÚflipVr&   ÚcxnSps               r,   Ú	add_cxnSpÚCT_GroupShape.add_cxnSp3   sA   € ô "×(Ò(¨Ó5ˆÜ×&Ò& s°$¸1À"ÈUÓSˆØ×"Ñ" 5¨*Ô5Øˆr/   c                ó„   • U R                   nSUS-
  4-  n[        R                  " XVXX45      nU R                  US5        U$ )z>Append a new freeform `p:sp` with specified position and size.zFreeform %dé   r    )Ú_next_shape_idr   Únew_freeform_spr"   )r#   r'   r(   r)   r*   Úshape_idr%   r+   s           r,   Úadd_freeform_spÚCT_GroupShape.add_freeform_spE   sF   € à×&Ñ&ˆØ ¨1¡˜Ñ.ˆÜ×%Ò% h°a¸BÓCˆØ×"Ñ" 2 zÔ2Øˆ	r/   c                ó~   • U R                   nSUS-
  4-  n[        R                  X5      nU R                  US5        U$ )zœReturn `p:grpSp` element newly appended to this shape tree.

The element contains no sub-shapes, is positioned at (0, 0), and has
width and height of zero.
zGroup %dr:   r    )r;   r   Ú	new_grpSpr"   )r#   r=   r%   ÚgrpSps       r,   Ú	add_grpSpÚCT_GroupShape.add_grpSpM   sD   € ð ×&Ñ&ˆØ˜X¨™\˜OÑ+ˆÜ×'Ñ'¨Ó7ˆØ×"Ñ" 5¨*Ô5Øˆr/   c	           
     ó\   • [         R                  " XX4XVXx5      n	U R                  U	S5        U	$ )zUAppend a `p:pic` shape to the group/shapetree having properties as specified in call.r    )r   Únew_picr"   )
r#   r$   r%   ÚdescÚrIdr'   r(   r)   r*   Úpics
             r,   Úadd_picÚCT_GroupShape.add_picY   s/   € ô × Ò  ¨D°q¸RÓDˆØ×"Ñ" 3¨
Ô3Øˆ
r/   c                óZ   • [         R                  " XX4XV5      nU R                  US5        U$ )zPAppend a newly-created placeholder `p:sp` shape having the specified properties.r    )r   Únew_placeholder_spr"   )r#   r$   r%   Úph_typeÚorientÚszÚidxr+   s           r,   Úadd_placeholderÚCT_GroupShape.add_placeholdera   s-   € ô ×(Ò(¨°GÀRÓMˆØ×"Ñ" 2 zÔ2Øˆ	r/   c	           
     ó\   • [         R                  " XX4XVXx5      n	U R                  U	S5        U	$ )zHAppend a `p:graphicFrame` shape containing a table as specified in call.r    )r   Únew_table_graphicFramer"   )
r#   r$   r%   ÚrowsÚcolsr'   r(   r)   r*   ÚgraphicFrames
             r,   Ú	add_tableÚCT_GroupShape.add_tablei   s5   € ô /×EÒEØ�t 1¨ó
ˆð 	×"Ñ" <°Ô<ØÐr/   c                óZ   • [         R                  " XX4XV5      nU R                  US5        U$ )zSAppend a newly-created textbox `p:sp` shape having the specified position and size.r    )r   Únew_textbox_spr"   )r#   r$   r%   r'   r(   r)   r*   r+   s           r,   Úadd_textboxÚCT_GroupShape.add_textboxs   s+   € ä×$Ò$ S°°bÓ=ˆØ×"Ñ" 2 zÔ2Øˆ	r/   c                óR   • U R                   R                  5       R                  5       $ )z.Descendent `p:grpSpPr/a:xfrm/a:chExt` element.)r   Úget_or_add_xfrmÚget_or_add_chExt©r#   s    r,   ÚchExtÚCT_GroupShape.chExty   ó    € ð �|‰|×+Ñ+Ó-×>Ñ>Ó@Ð@r/   c                óR   • U R                   R                  5       R                  5       $ )z.Descendent `p:grpSpPr/a:xfrm/a:chOff` element.)r   r`   Úget_or_add_chOffrb   s    r,   ÚchOffÚCT_GroupShape.chOff~   re   r/   c                ó6   • U R                   R                  5       $ )zCReturn the `a:xfrm` grandchild element, newly-added if not present.)r   r`   rb   s    r,   r`   ÚCT_GroupShape.get_or_add_xfrmƒ   s   € à�|‰|×+Ñ+Ó-Ð-r/   c              #  óh   #   • U R                  5        H  nUR                  (       d  M  Uv •  M     g7f)z@Generate each placeholder shape child element in document order.N)Úiter_shape_elmsÚ
has_ph_elm)r#   Úes     r,   Úiter_ph_elmsÚCT_GroupShape.iter_ph_elms‡   s&   é € à×%Ñ%Ö'ˆAØ�|�|‰|Ø”ò (ùs   ‚#2©	2c              #  óz   #   • U R                  5        H#  nUR                  U R                  ;   d  M  Uv •  M%     g7f)zqGenerate each child of this `p:spTree` element that corresponds to a shape.

Items appear in XML document order.
N)ÚiterchildrenÚtagÚ_shape_tags)r#   Úelms     r,   rm   ÚCT_GroupShape.iter_shape_elms�   s1   é € ð
 ×$Ñ$Ö&ˆCØ�w‰w˜$×*Ñ*Õ*Ø”	ò 'ùs   ‚,;²	;c                ó¸   • U R                  S5      nU Vs/ s H$  o"R                  5       (       d  M  [        U5      PM&     nnU(       a  [        U5      $ S$ s  snf )a9  Maximum int value assigned as @id in this slide.

This is generally a shape-id, but ids can be assigned to other
objects so we just check all @id values anywhere in the document
(XML id-values have document scope).

In practice, its minimum value is 1 because the spTree element itself
is always assigned id="1".
ú//@idr   )ÚxpathÚisdigitÚintÚmax)r#   Ú
id_str_lstÚid_strÚused_idss       r,   Úmax_shape_idÚCT_GroupShape.max_shape_id–   sJ   € ð —Z‘Z Ó(ˆ
Ù.8ÓMªj F¿N¹N×<L“K”C˜–K©jˆÐMÞ (Œs�8‹}Ð/¨aÐ/ùò Ns
   –A²Ac                óD   • S[        SSS5      -  X4-  n[        U5      nU$ )z=Return new "loose" `p:grpSp` element having `id_` and `name`.a)  <p:grpSp %s>
  <p:nvGrpSpPr>
    <p:cNvPr id="%%d" name="%%s"/>
    <p:cNvGrpSpPr/>
    <p:nvPr/>
  </p:nvGrpSpPr>
  <p:grpSpPr>
    <a:xfrm>
      <a:off x="0" y="0"/>
      <a:ext cx="0" cy="0"/>
      <a:chOff x="0" y="0"/>
      <a:chExt cx="0" cy="0"/>
    </a:xfrm>
  </p:grpSpPr>
</p:grpSp>ÚaÚpÚr)r	   r   )Úclsr$   r%   ÚxmlrB   s        r,   rA   ÚCT_GroupShape.new_grpSp¥   s8   € ðô # 3¨¨SÓ1ñ2ð ˆKñ!ˆô" ˜#“ˆØˆr/   c                óR  • U R                   [        S5      :X  d  gU R                  u  pp4U=U R                  l        U l        U=U R                  l        U l        U=U R                  l        U l        U=U R                  l        U l        U R                  5       R                  5         g)a&  Adjust x, y, cx, and cy to incorporate all contained shapes.

This would typically be called when a contained shape is added,
removed, or its position or size updated.

This method is recursive "upwards" since a change in a group shape
can change the position and size of its containing group.
r   N)rt   r
   Ú_child_extentsrh   r'   r(   rc   r)   r*   Ú	getparentÚrecalculate_extents)r#   r'   r(   r)   r*   s        r,   r�   Ú!CT_GroupShape.recalculate_extents¼   s�   € ð �x‰xœ2˜i›=Ó(Øà×*Ñ*‰ˆˆbà !Ð!ˆ�
‰
Œ�t”vØ !Ð!ˆ�
‰
Œ�t”vØ"$Ð$ˆ�
‰
Œ˜œØ"$Ð$ˆ�
‰
Œ˜œØ�‰Ó×,Ñ,Õ.r/   c                ó.   • U R                   R                  $ )z7The `a:xfrm` grandchild element or |None| if not found.)r   Úxfrmrb   s    r,   r�   ÚCT_GroupShape.xfrmÐ   s   € ð �|‰|× Ñ Ð r/   c                ó:  • [        U R                  5       5      nU(       d*  [        S5      [        S5      [        S5      [        S5      4$ [        U Vs/ s H  o"R                  PM     sn5      n[        U Vs/ s H  o"R
                  PM     sn5      n[        U Vs/ s H  o"R                  UR                  -   PM     sn5      n[        U Vs/ s H  o"R
                  UR                  -   PM     sn5      nUnUnXS-
  n	Xd-
  n
XxXš4$ s  snf s  snf s  snf s  snf )z~(x, y, cx, cy) tuple representing net position and size.

The values are formed as a composite of the contained child shapes.
r   )	Úlistrm   r   Úminr'   r(   r}   r)   r*   )r#   Úchild_shape_elmsÚxSpÚmin_xÚmin_yÚmax_xÚmax_yr'   r(   r)   r*   s              r,   r‹   ÚCT_GroupShape._child_extentsÕ   sò   € ô   × 4Ñ 4Ó 6Ó7ÐæÜ�q“6œ3˜q›6¤3 q£6¬3¨q«6Ð1Ð1äÑ&6Ó7Ò&6˜s—U”UÑ&6Ñ7Ó8ˆÜÑ&6Ó7Ò&6˜s—U”UÑ&6Ñ7Ó8ˆÜÑ1AÓBÒ1A¨#—e‘e˜cŸf™f”nÑ1AÑBÓCˆÜÑ1AÓBÒ1A¨#—e‘e˜cŸf™f”nÑ1AÑBÓCˆàˆØˆØ‰]ˆØ‰]ˆà�Rˆ|Ðùò 8ùÚ7ùÚBùÚBs   ÁD	Á9DÂ"DÃ"Dc                óâ   • U R                  S5      nU Vs/ s H$  o"R                  5       (       d  M  [        U5      PM&     nn[        S[	        U5      S-   5       H  nXC;  d  M
  Us  $    gs  snf )a2  Return unique shape id suitable for use with a new shape element.

The returned id is the next available positive integer drawing object
id in shape tree, starting from 1 and making use of any gaps in
numbering. In practice, the minimum id is 2 because the spTree
element itself is always assigned id="1".
ry   r:   é   N)rz   r{   r|   ÚrangeÚlen)r#   r~   r   r€   Úns        r,   r;   ÚCT_GroupShape._next_shape_idì   s^   € ð —Z‘Z Ó(ˆ
Ù.8ÓMªj F¿N¹N×<L“K”C˜–K©jˆÐMÜ�qœ#˜h›-¨!Ñ+Ö,ˆAØÕ Ø’ò -ùò Ns
   –A,²A,)r)   r*   r'   r(   N)r$   r|   r%   Ústrr&   r¢   r'   r|   r(   r|   r)   r|   r*   r|   Úreturnr   )r$   r|   r%   r¢   r3   r   r'   r|   r(   r|   r)   r|   r*   r|   r4   Úboolr5   r¤   r£   r   )
r'   r|   r(   r|   r)   r|   r*   r|   r£   r   )r£   r   )r$   r|   r%   r¢   rG   r¢   rH   r¢   r'   r|   r(   r|   r)   r|   r*   r|   r£   r   )r$   r|   r%   r¢   rN   r   rO   r¢   rP   r¢   rQ   r|   r£   r   )r$   r|   r%   r¢   rV   r|   rW   r|   r'   r|   r(   r|   r)   r|   r*   r|   r£   r   )r$   r|   r%   r¢   r'   r|   r(   r|   r)   r|   r*   r|   r£   r   )r£   r   )r£   zIterator[ShapeElement])r£   r|   )r$   r|   r%   r¢   r£   r   )r£   ÚNone)r£   úCT_Transform2D | None)r£   ztuple[int, int, int, int])!Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__annotations__r   r
   ru   r-   r7   r>   rC   rJ   rR   rY   r]   Úpropertyrc   rh   r`   rp   rm   r�   ÚclassmethodrA   r�   r�   r‹   r;   Ú__static_attributes__© r/   r,   r   r      s�  ‡ Ù[á(5Øó)€IÐ%ó ñ (5Øó(€GÐ$ó ñ
 	ˆ6‹
Ù
ˆ9‹Ù
ÐÓÙ
ˆ9‹Ù
ˆ7‹Ù
ˆ?Óð€KðØðØ!ðØ),ðØ14ðØ9<ðØBEðØKNðà	ôðàðð ðð (ð	ð
 ðð ðð ðð ðð ðð ðð 
ôô$ô
ðØðØ!ðØ),ðØ36ðØ;>ðØCFðØLOðØUXðà	ôðØðØ!ðØ,:ðØDGðØMPðØWZðà	ôðØðØ!ðØ),ðØ47ðØ<?ðØDGðØMPðØVYðà	 ôôð ñAó ðAð ñAó ðAô.òôð ó0ó ð0ð óó ðô,/ð( ó!ó ð!ð óó ðð, óó ór/   r   c                  ó(   • \ rS rSrSr\" S5      rSrg)r   éü   z`p:nvGrpSpPr` element.zp:cNvPrr°   N)r§   r¨   r©   rª   r«   r   ÚcNvPrr¯   r°   r/   r,   r   r   ü   s   † Ù á˜)Ó$ƒEr/   r   c                  ó\   • \ rS rSr% SrS\S'   Sr\" S\SS S	9rS
\S'   \" S\SS S	9r	CSr
g)r   i  zp:grpSpPr elementzCallable[[], CT_Transform2D]r`   )úa:xfrmza:noFillza:solidFillz
a:gradFillz
a:blipFillz
a:pattFillz	a:grpFillúa:effectLstza:effectDagz	a:scene3dza:extLstrµ   r:   N)Ú
successorsr¦   r�   r¶   é   r°   )r§   r¨   r©   rª   r«   r¬   Ú_tag_seqr   r�   Ú	effectLstr¯   r°   r/   r,   r   r     sH   ‡ Ùà1Ó1ð€Hñ #,Ø˜X a b˜\ñ#€DÐ
ó ñ ˜-°H¸Q¸R°LÑA€IÛr/   r   N)%r«   Ú
__future__r   Útypingr   r   r   Úpptx.enum.shapesr   Ú	pptx.oxmlr   Úpptx.oxml.nsr	   r
   Úpptx.oxml.shapes.autoshaper   Úpptx.oxml.shapes.connectorr   Úpptx.oxml.shapes.graphfrmr   Úpptx.oxml.shapes.picturer   Úpptx.oxml.shapes.sharedr   Úpptx.oxml.xmlchemyr   r   r   Ú	pptx.utilr   r   Úpptx.oxml.shapesr   r   r   r   r   r°   r/   r,   Ú<module>rÈ      sg   ðÙ Få "ç 4Ñ 4å /Ý ß $Ý /Ý 3Ý =Ý /Ý 4ß HÑ HÝ æÝ/Ý-Ý6ôaÐ$ô aôH%Ð-ô %ô˜oõ r/   