
    h                        S SK Jr  S SKJrJr  \(       a  S SKJr  S SKJr  S SK	J
r
  / SQr0 rSqS rS	 rS
 r S     SS jjrSS jrSSS jjrSS jrSS jrSS jrSS jrg)    )annotations)TYPE_CHECKINGOptional)Drawing)	DXFEntity)ExtendedTags)	register_entityENTITY_CLASSESreplace_entitynewclsis_boundcreate_db_entryloadbindNc                
    U q U $ N)DEFAULT_CLASS)r   s    H/var/www/html/env/lib/python3.13/site-packages/ezdxf/entities/factory.pyset_default_classr      s    MJ    c                0    U R                   nU [        U'   U $ r   )DXFTYPEr
   r   names     r   r   r   #   s    ;;DN4Jr   c                b    U R                   nU[        ;   a  [        SU S35      eU [        U'   U $ )Nz!Double registration for DXF type .)r   r
   	TypeErrorr   s     r   r	   r	   )   s7    ;;D~;D6CDDN4Jr   c                ~    [        U 5      R                  SSUUS9n[        US5      (       a  UR                  5       $ U$ )zCCreate a new entity, does not require an instantiated DXF document.N)handleowner
dxfattribsdoccast)r   r   hasattrr$   dxftyper"   r#   entitys       r   r   r   1   sH     \	  F $FF336;;=??r   c                .    [        XS9n[        X25        U$ )N)r'   r"   )r   r   r&   s       r   r   r   >   s    8FMr   c                    [        U R                  5       5      R                  X5      n[        US5      (       a  UR	                  5       $ U$ )Nr$   )r   r'   r   r%   r$   )tagsr#   r(   s      r   r   r   D   s:     %%d0F#FF336;;=??r   c                6    [         R                  U [        5      $ )z'Returns registered class for `dxftype`.)r
   getr   )r'   s    r   r   r   I   s    g}55r   c                   U R                   (       d   S5       eUR                  c   S5       eXl        UR                  R                  U 5        UR                  (       d  U R
                  b  U R
                  nUR                  (       ag  UR                  U R                  R                  5        UR                  n[        X15      (       d&  [        X15        UR                  R                  U5        U R                  5         gg)zBind `entity` to the DXF document `doc`.

The bind process stores the DXF `entity` in the entity database of the DXF
document.

zCan not bind destroyed entity.NMissing entity database.)is_aliveentitydbr#   add
is_loadingextension_dicthas_valid_dictionaryupdate_ownerdxfr    
dictionaryr   r   objects
add_objectpost_bind_hook)r(   r#   xdictr8   s       r   r   r   N   s     ??<<<?<<#?%??#JLLV >>  ,))E))""6::#4#45"--

00)KK**:6 r   c                   U R                   (       a  U R                  (       d  U R                  nU R                  R                  b-   UR
                  R                  U 5      nUR                  U 5        [        U SS5      nU(       a	  U" S 5        UR                  R                  U 5        SU l        ggg! [         a     NNf = f)zUnbind `entity` from document and layout, but does not destroy the
entity.

Turns `entity` into a virtual entity: no handle, no owner, no document.
Nprocess_sub_entitiesc                    [        U 5      $ r   )unbind)es    r   <lambda>unbind.<locals>.<lambda>{   s    6!9r   )r0   
is_virtualr#   r7   r!   layoutsget_layout_for_entityunlink_entityKeyErrorgetattrr1   discard)r(   r#   layoutr>   s       r   r@   r@   i   s     v00jj::'-::6B $$V,&v/EtL !45V$
  1
  s   B5 5
CCc                    U R                   (       d  gU R                  (       d  U R                  ULa  gUR                  (       d   S5       eU R                  R
                  UR                  ;   $ )z;Returns ``True`` if `entity`is bound to DXF document `doc`.Fr/   )r0   rD   r#   r1   r7   r    )r(   r#   s     r   r   r      sN    ??FJJc1<<333<::,,r   )NN)r'   strr#   Optional[Drawing]returnr   )r#   r   rO   r   r   )r+   r   r#   rN   rO   r   )r'   rM   rO   r   )r(   r   r#   r   rO   None)r(   r   )r(   r   r#   r   rO   bool)
__future__r   typingr   r   ezdxf.documentr   ezdxf.entitiesr   ezdxf.lldxf.extendedtagsr   __all__r
   r   r   r   r	   r   r   r   r   r   r@   r    r   r   <module>rY      s    # *&(5
  =A
@
@(9
@
@@
6
 60-r   