
    he	                        S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  \(       a  SSK
Jr  SSKJr  SSKJr  S	rS
r S     SS jjrSS jrSS jrg)z
This module provides helper tools to work with dynamic blocks.

The current state supports only reading information from dynamic blocks, it does not
support the creation of new dynamic blocks nor the modification of them.

    )annotations)TYPE_CHECKINGOptional)Insert)const)Drawing)BlockLayout)BlockRecordAcDbDynamicBlockGUIDAcDbBlockRepBTagNc                   Uc  U R                   nUc  gUR                  R                  U R                  R                  5      nUc  gUR
                  n[        U5      (       a  U$ [        U5      nU(       d  gUR                  R                  U5      nU(       a/  UR                  R                  UR                  R                  5      $ g)zReturns the dynamic block definition if the given block reference is
referencing a dynamic block direct or indirect via an anonymous block.
Returns ``None`` otherwise.
N)	docblocksgetdxfnameblock_recordis_dynamic_block_definitionget_dynamic_block_record_handleentitydb)insertr   blockr   handledyn_block_records         D/var/www/html/env/lib/python3.13/site-packages/ezdxf/dynblkhelper.pyget_dynamic_block_definitionr      s     {jj;JJNN6::??+E}%%L"<00 -\:F||''/zz~~.227788    c                ,    U R                  [        5      $ )zHReturn ``True`` if the given block record is a dynamic block definition.)	has_xdatar   )r   s    r   r   r   6   s    !!"677r   c                     U R                  [        5      nUR	                  SS5      $ ! [        R                   a     gf = f)zReturns handle of the dynamic block record for an indirect dynamic block
reference. Returns an empty string if the block record do not reference a dynamic
block or the handle was not found.

 i  )	get_xdatar   r   DXFValueErrorget_first_value)r   xdatas     r   r   r   ;   sG    &&'78   r**  s   ) A A )N)r   r   r   zOptional[Drawing]returnzOptional[BlockLayout])r   r
   r&   bool)r   r
   r&   str)__doc__
__future__r   typingr   r   ezdxf.entitiesr   ezdxf.lldxfr   ezdxf.documentr   ezdxf.layoutsr	   r
   r   r   r   r   r    r   r   <module>r1      s\    # * ! &)*- %  .2*<8
+r   