Ë
    œ…j'  ã                  ó^   — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZ  G d„ de«      Zy	)
zÝConnector (line) shape and related objects.

A connector is a line shape having end-points that can be connected to other
objects (but not to other connectors). A connector can be straight, have
elbows, or can be curved.
é    )Úannotations©Ú
LineFormat)ÚMSO_SHAPE_TYPE)Ú	BaseShape)ÚEmuÚlazypropertyc                  ó:  — e Zd ZdZd„ Zed„ «       Zej                  d„ «       Zed„ «       Zej                  d„ «       Zd„ Z	ed„ «       Z
e
j                  d	„ «       Z
ed
„ «       Zej                  d„ «       Zd„ Zed„ «       Zed„ «       Zed„ «       Zd„ Zd„ Zd„ Zd„ Zy)Ú	ConnectorzÛConnector (line) shape.

    A connector is a linear shape having end-points that can be connected to
    other objects (but not to other connectors). A connector can be straight,
    have elbows, or can be curved.
    c                óL   — | j                  ||«       | j                  ||«       y)aÕ  
        **EXPERIMENTAL** - *The current implementation only works properly
        with rectangular shapes, such as pictures and rectangles. Use with
        other shape types may cause unexpected visual alignment of the
        connected end-point and could lead to a load error if cxn_pt_idx
        exceeds the connection point count available on the connected shape.
        That said, a quick test should reveal what to expect when using this
        method with other shape types.*

        Connect the beginning of this connector to *shape* at the connection
        point specified by *cxn_pt_idx*. Each shape has zero or more
        connection points and they are identified by index, starting with 0.
        Generally, the first connection point of a shape is at the top center
        of its bounding box and numbering proceeds counter-clockwise from
        there. However this is only a convention and may vary, especially
        with non built-in shapes.
        N)Ú_connect_begin_toÚ_move_begin_to_cxn©ÚselfÚshapeÚ
cxn_pt_idxs      úV/root/aria/tools/markitdown-venv/lib/python3.12/site-packages/pptx/shapes/connector.pyÚbegin_connectzConnector.begin_connect   s$   € ð$ 	×Ñ˜u jÔ1Ø×Ñ  zÕ2ó    c                óŠ   — | j                   }|j                  |j                  |j                  }}}|r||z   n|}t	        |«      S )z…
        Return the X-position of the begin point of this connector, in
        English Metric Units (as a |Length| object).
        ©Ú_elementÚxÚcxÚflipHr   )r   ÚcxnSpr   r   r   Úbegin_xs         r   r   zConnector.begin_x-   ó=   € ð —‘ˆØ—w‘w §¡¨%¯+©+ˆuˆ2ˆÙ!�!�b’& qˆÜ�7‹|Ðr   c                óÊ  — | j                   }|j                  |j                  |j                  t	        |«      f\  }}}}|rL||z   }t        ||z
  «      }||k\  r||z   |_        y ||k  r||z
  |_        y d|_        ||_        ||z
  |_        y t        ||z
  «      }||k  r||_        ||z   |_        y ||k  r||_        ||z
  |_        y d|_        ||z   |_        ||z
  |_        y ©NFT©r   r   r   r   ÚintÚabs)	r   Úvaluer   r   r   r   Únew_xÚold_xÚdxs	            r   r   zConnector.begin_x8   óå   € à—‘ˆØ#Ÿg™g u§x¡x°·±¼cÀ%»jÐHÑˆˆ2ˆu�eáØ˜‘FˆEÜ�U˜U‘]Ó#ˆBØ˜Š~Ø ™7�•Ø�r’Ø ™7�•à#�”Ø�”Ø ™7�•ä�U˜Q‘Y“ˆBØ˜ŠzØ�”Ø ™7�•Ø�r’Ø�”Ø ™7�•à"�”Ø˜b™&�”Ø ™7�•r   c                óŠ   — | j                   }|j                  |j                  |j                  }}}|r||z   n|}t	        |«      S )z…
        Return the Y-position of the begin point of this connector, in
        English Metric Units (as a |Length| object).
        ©r   ÚyÚcyÚflipVr   )r   r   r+   r,   r-   Úbegin_ys         r   r.   zConnector.begin_yU   r   r   c                óÊ  — | j                   }|j                  |j                  |j                  t	        |«      f\  }}}}|rL||z   }t        ||z
  «      }||k\  r||z   |_        y ||k  r||z
  |_        y d|_        ||_        ||z
  |_        y t        ||z
  «      }||k  r||_        ||z   |_        y ||k  r||_        ||z
  |_        y d|_        ||z   |_        ||z
  |_        y r    ©r   r+   r,   r-   r"   r#   )	r   r$   r   r+   r,   r-   Únew_yÚold_yÚdys	            r   r.   zConnector.begin_y`   r(   r   c                óL   — | j                  ||«       | j                  ||«       y)ae  
        **EXPERIMENTAL** - *The current implementation only works properly
        with rectangular shapes, such as pictures and rectangles. Use with
        other shape types may cause unexpected visual alignment of the
        connected end-point and could lead to a load error if cxn_pt_idx
        exceeds the connection point count available on the connected shape.
        That said, a quick test should reveal what to expect when using this
        method with other shape types.*

        Connect the ending of this connector to *shape* at the connection
        point specified by *cxn_pt_idx*.
        N)Ú_connect_end_toÚ_move_end_to_cxnr   s      r   Úend_connectzConnector.end_connect}   s$   € ð 	×Ñ˜U JÔ/Ø×Ñ˜e ZÕ0r   c                óŠ   — | j                   }|j                  |j                  |j                  }}}|r|n||z   }t	        |«      S )zƒ
        Return the X-position of the end point of this connector, in English
        Metric Units (as a |Length| object).
        r   )r   r   r   r   r   Úend_xs         r   r9   zConnector.end_x�   ó=   € ð —‘ˆØ—w‘w §¡¨%¯+©+ˆuˆ2ˆÙ‘  B¡ˆÜ�5‹zÐr   c                óÊ  — | j                   }|j                  |j                  |j                  t	        |«      f\  }}}}|rXt        ||z
  «      }||k  r||_        ||z   |_        y ||k  r||_        ||z
  |_        y d|_        ||z   |_        ||z
  |_        y ||z   }t        ||z
  «      }||k\  r||z   |_        y ||k  r||z
  |_        y d|_        ||_        ||z
  |_        y r    r!   )	r   r$   r   r   r   r   r%   r'   r&   s	            r   r9   zConnector.end_x˜   óå   € à—‘ˆØ#Ÿg™g u§x¡x°·±¼cÀ%»jÐHÑˆˆ2ˆu�eáÜ�U˜Q‘Y“ˆBØ˜ŠzØ�”Ø ™7�•Ø�r’Ø�”Ø ™7�•à#�”Ø˜b™&�”Ø ™7�•à˜‘FˆEÜ�U˜U‘]Ó#ˆBØ˜Š~Ø ™7�•Ø�r’Ø ™7�•à"�”Ø�”Ø ™7�•r   c                óŠ   — | j                   }|j                  |j                  |j                  }}}|r|n||z   }t	        |«      S )zƒ
        Return the Y-position of the end point of this connector, in English
        Metric Units (as a |Length| object).
        r*   )r   r   r+   r,   r-   Úend_ys         r   r>   zConnector.end_yµ   r:   r   c                óÊ  — | j                   }|j                  |j                  |j                  t	        |«      f\  }}}}|rXt        ||z
  «      }||k  r||_        ||z   |_        y ||k  r||_        ||z
  |_        y d|_        ||z   |_        ||z
  |_        y ||z   }t        ||z
  «      }||k\  r||z   |_        y ||k  r||z
  |_        y d|_        ||_        ||z
  |_        y r    r0   )	r   r$   r   r+   r,   r-   r1   r3   r2   s	            r   r>   zConnector.end_yÀ   r<   r   c                óJ   — | j                   j                  j                  «       S )z'Helper method required by |LineFormat|.)r   ÚspPrÚget_or_add_ln©r   s    r   rB   zConnector.get_or_add_lnÝ   s   € à�}‰}×!Ñ!×/Ñ/Ó1Ð1r   c                ó   — t        | «      S )z‘|LineFormat| instance for this connector.

        Provides access to line properties such as line color, width, and
        line style.
        r   rC   s    r   ÚlinezConnector.lineá   s   € ô ˜$ÓÐr   c                óB   — | j                   j                  j                  S )zÆHelper method required by |LineFormat|.

        The ``<a:ln>`` element containing the line format properties such as
        line color and width. |None| if no `<a:ln>` element is present.
        )r   rA   ÚlnrC   s    r   rG   zConnector.lnê   s   € ð �}‰}×!Ñ!×$Ñ$Ð$r   c                ó"   — t         j                  S )z�Member of `MSO_SHAPE_TYPE` identifying the type of this shape.

        Unconditionally `MSO_SHAPE_TYPE.LINE` for a `Connector` object.
        )r   ÚLINErC   s    r   Ú
shape_typezConnector.shape_typeó   s   € ô ×"Ñ"Ð"r   c                ó”   — | j                   j                  j                  }|j                  «       }|j                  |_        ||_        y)z®
        Add or update a stCxn element for this connector that connects its
        begin point to the connection point of *shape* specified by
        *cxn_pt_idx*.
        N)r   Ú	nvCxnSpPrÚ
cNvCxnSpPrÚget_or_add_stCxnÚshape_idÚidÚidx)r   r   r   rM   ÚstCxns        r   r   zConnector._connect_begin_toû   s9   € ð —]‘]×,Ñ,×7Ñ7ˆ
Ø×+Ñ+Ó-ˆØ—>‘>ˆŒØˆ�	r   c                ó”   — | j                   j                  j                  }|j                  «       }|j                  |_        ||_        y)z®
        Add or update an endCxn element for this connector that connects its
        end point to the connection point of *shape* specified by
        *cxn_pt_idx*.
        N)r   rL   rM   Úget_or_add_endCxnrO   rP   rQ   )r   r   r   rM   ÚendCxns        r   r5   zConnector._connect_end_to  s9   € ð —]‘]×,Ñ,×7Ñ7ˆ
Ø×-Ñ-Ó/ˆØ—N‘NˆŒ	Øˆ�
r   c           	     ó,  — |j                   |j                  |j                  |j                  f\  }}}}t	        ||dz  z   «      |f|t	        ||dz  z   «      ft	        ||dz  z   «      ||z   f||z   t	        ||dz  z   «      fdœ|   \  | _        | _        y)z�
        Move the begin point of this connector to coordinates of the
        connection point of *shape* specified by *cxn_pt_idx*.
        é   ©r   é   rW   é   N)ÚleftÚtopÚwidthÚheightr"   r   r.   ©r   r   r   r   r+   r   r,   s          r   r   zConnector._move_begin_to_cxn  sœ   € ð
 —z‘z 5§9¡9¨e¯k©k¸5¿<¹<ÐG‰ˆˆ1ˆb�"ä�A˜˜Q™‘J“ Ð#Ø”3�q˜2 ™6‘z“?Ð#Ü�A˜˜Q™‘J“  R¡Ð(Ø�B‘œ˜A  Q¡™J›Ð(ñ	&
ð
 ñ&Ñ"ˆŒ�d•lr   c           	     ó,  — |j                   |j                  |j                  |j                  f\  }}}}t	        ||dz  z   «      |f|t	        ||dz  z   «      ft	        ||dz  z   «      ||z   f||z   t	        ||dz  z   «      fdœ|   \  | _        | _        y)z�
        Move the end point of this connector to the coordinates of the
        connection point of *shape* specified by *cxn_pt_idx*.
        rW   rX   N)r[   r\   r]   r^   r"   r9   r>   r_   s          r   r6   zConnector._move_end_to_cxn  sœ   € ð
 —z‘z 5§9¡9¨e¯k©k¸5¿<¹<ÐG‰ˆˆ1ˆb�"ä�A˜˜Q™‘J“ Ð#Ø”3�q˜2 ™6‘z“?Ð#Ü�A˜˜Q™‘J“  R¡Ð(Ø�B‘œ˜A  Q¡™J›Ð(ñ	"
ð
 ñ"ÑˆŒ
�D•Jr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   Úsetterr.   r7   r9   r>   rB   r	   rE   rG   rJ   r   r5   r   r6   © r   r   r   r      s  „ ñò3ð* ñó ðð ‡^�^ñ#ó ð#ð8 ñó ðð ‡^�^ñ#ó ð#ò81ð  ñó ðð ‡\�\ñ#ó ð#ð8 ñó ðð ‡\�\ñ#ó ð#ò82ð ñ ó ð ð ñ%ó ð%ð ñ#ó ð#ò	ò	 òór   r   N)rd   Ú
__future__r   Úpptx.dml.liner   Úpptx.enum.shapesr   Úpptx.shapes.baser   Ú	pptx.utilr   r	   r   rg   r   r   ú<module>rm      s)   ðñõ #å $Ý +Ý &ß 'ôY�	õ Yr   