Ë
    £èhég  ã                  ó,  — d dl mZ d dlmZmZmZmZmZmZm	Z	m
Z
mZ d dlmZ d dlZd dlmZmZ d dlmZmZ d dlmZ d dlmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z# erd d	l$m%Z% d d
l&m'Z' d dl(m)Z)  ejT                  d«      Z+ edd¬«      Z, G d„ dee,   «      Z- G d„ de-e   «      Z. G d„ de-e   «      Z/ G d„ de-e   «      Z0 G d„ de-e   «      Z1 G d„ de-e   «      Z2 G d„ de-e   «      Z3 G d„ de-e!   «      Z4 G d „ d!e-e"   «      Z5 G d"„ d#e-e    «      Z6y)$é    )Úannotations)	ÚGenericÚIteratorÚListÚOptionalÚTYPE_CHECKINGÚTypeVarÚUnionÚcastÚSequence)ÚOrderedDictN)ÚAuditorÚ
AuditError)ÚconstÚ	validator)Ú	TableHead)ÚfactoryÚ	DXFEntityÚLayerÚLinetypeÚ	TextstyleÚVPortÚViewÚAppIDÚUCSTableEntryÚBlockRecordÚDimStyleÚis_graphic_entity)ÚDrawing)ÚAbstractTagWriter)ÚEntityDBÚezdxfÚTr   )Úboundc                  ó&  — e Zd ZdZd d„Zd!d„Zd"d„Zd#d$d„Zed„ «       Z	ed%d„«       Z
ed&d	„«       Zd'd
„ZeZd(d„Zd)d„Zd#d*d„Zd*d„Zd+d„Zd&d„Zd,d„Zd-d„Zd,d„Zd.d„Zed/d„«       Zd0d„Zd1d„Zd1d„Zd2d„Zd2d„Zd d„Zd3d„Z d4d„Z!d4d„Z"d4d„Z#y)5ÚTableÚUNKNOWNc                óN   — d | _         t        «       | _        t        «       | _        y ©N)Údocr   Úentriesr   Ú_head©Úselfs    ú4lib/python3.12/site-packages/ezdxf/sections/table.pyÚ__init__zTable.__init__2   s   € Ø&*ˆŒÜ%0£]ˆŒÜ“[ˆ�
ó    c                óv  — || _         t        |«      }t        |t        «      r|| _        nt        j                  d«      ‚| j                  }|D ]i  }|j                  «       |k(  r | j                  t        t        |«      «       Œ6t        j                  d|j                  «       › d| j                  › d�«       Œk y)z!Loading interface. (internal API)z+Critical structure error in TABLES section.z!Ignored invalid DXF entity type 'z' in z table.N)r*   ÚnextÚ
isinstancer   r,   r   ÚDXFStructureErrorÚ
TABLE_TYPEÚdxftypeÚ_appendr   r#   ÚloggerÚwarning)r.   r*   ÚentitiesÚ
table_headÚexpected_entry_dxftypeÚtable_entrys         r/   Úloadz
Table.load7   s¢   € àˆŒÜ˜(“^ˆ
Ü�j¤)Ô,Ø#ˆD�Jä×)Ñ)Ð*WÓXÐXØ!%§¡ÐÛ#ˆKØ×"Ñ"Ó$Ð(>Ò>Ø—‘œT¤! [Ó1Õ2ä—‘Ø7¸×8KÑ8KÓ8MÐ7Nð OØŸ?™?Ð+¨7ð4õñ	 $r1   c                ó~   — || _         | j                  | j                  |«       | j                  j	                  «        y)zReset table. (internal API)N)r*   Ú	_set_headr6   r+   Úclear)r.   r*   Úhandles      r/   ÚresetzTable.resetI   s+   € àˆŒØ�‰�t—‘¨Ô/Ø�‰×ÑÕr1   Nc                óX   — t        j                  |dd|i| j                  ¬«      | _        y )NÚ0Úname)ÚownerÚ
dxfattribsr*   )r   Únewr*   r,   )r.   rG   rC   s      r/   rA   zTable._set_headO   s#   € Ü—]‘]Ø˜#¨6°4¨.¸d¿h¹hô
ˆ�
r1   c                ó   — | j                   S )zReturns table head entry.)r,   r-   s    r/   Úheadz
Table.headT   s   € ð �z‰zÐr1   c                ó   — | j                   S r)   )r6   r-   s    r/   rG   z
Table.nameY   s   € à�‰Ðr1   c                ó,   — t        j                  | «      S )zUnified table entry key.)r   Úmake_table_key)rG   s    r/   Úkeyz	Table.key]   s   € ô ×'Ñ'¨Ó-Ð-r1   c                ó<   — | j                  |«      | j                  v S )z/Returns ``True`` if a table entry `name` exist.)rP   r+   ©r.   rG   s     r/   Ú	has_entryzTable.has_entryb   s   € à�x‰x˜‹~ §¡Ð-Ð-r1   c                ó,   — t        | j                  «      S )zCount of table entries.)Úlenr+   r-   s    r/   Ú__len__zTable.__len__h   s   € ä�4—<‘<Ó Ð r1   c              #  ól   K  — | j                   j                  «       D ]  }|j                  sŒ|–— Œ y­w)zIterable of all table entries.N)r+   ÚvaluesÚis_alive)r.   Úes     r/   Ú__iter__zTable.__iter__l   s)   è ø€ à—‘×$Ñ$Ö&ˆAØ�z‹zØ“ñ 'ùs   ‚*4­4c                óì   — | j                  |«      r%t        j                  | j                  › d|› d�«      ‚|xs i }||d<   | j                  j
                  j                  |d<   | j                  |«      S )z¡Create a new table entry `name`.

        Args:
            name: name of table entry
            dxfattribs: additional DXF attributes for table entry

        z 'ú' already exists!rG   rH   )rS   r   ÚDXFTableEntryErrorr6   r,   ÚdxfrC   Ú	new_entry©r.   rG   rI   s      r/   rJ   z	Table.newr   sv   € ð �>‰>˜$ÔÜ×*Ñ*Ø—?‘?Ð# 2 d VÐ+<Ð=óð ð  Ò% 2ˆ
Ø!ˆ
�6ÑØ"Ÿj™jŸn™n×3Ñ3ˆ
�7ÑØ�~‰~˜jÓ)Ð)r1   c                óˆ   — | j                   j                  | j                  |«      «      }|r|S t        j                  |«      ‚)z¸Returns table entry `name`.

        Args:
            name: name of table entry, case-insensitive

        Raises:
            DXFTableEntryError: table entry does not exist

        )r+   ÚgetrP   r   r^   ©r.   rG   Úentrys      r/   rc   z	Table.getƒ   s9   € ð —‘× Ñ  §¡¨$£Ó0ˆÙØˆLä×*Ñ*¨4Ó0Ð0r1   c                ó�   — | j                   j                  j                  |«      }|r|j                  «       | j                  k(  r|S y)zcReturns table entry by handle or ``None`` if entry does not exist.

        (internal API)
        N)r*   Úentitydbrc   r7   r6   )r.   rC   re   s      r/   Úget_entry_by_handlezTable.get_entry_by_handle“   s:   € ð
 —‘×!Ñ!×%Ñ% fÓ-ˆÙ�U—]‘]“_¨¯©Ò7ØˆLØr1   c                óˆ   — | j                   j                  | j                  |«      «      }|�|j                  j                  S y)zÚReturns the handle of table entry by `name`, returns an empty string if no
        entry for the given name exist.

        Args:
            name: name of table entry, case-insensitive

        (internal API)
        Ú )r+   rc   rP   r_   rC   rd   s      r/   Úget_handle_of_entryzTable.get_handle_of_entry�   s9   € ð —‘× Ñ  §¡¨$£Ó0ˆØÐØ—9‘9×#Ñ#Ð#Ør1   c                ó    — | j                  |«      }| j                  |«      }| j                  j                  |«       | j	                  |«       y)z¸Removes table entry `name`.

        Args:
            name: name of table entry, case-insensitive

        Raises:
            DXFTableEntryError: table entry does not exist

        N)rP   rc   rg   Údelete_entityÚdiscard)r.   rG   rP   re   s       r/   ÚremovezTable.remove«   s<   € ð �h‰h�t‹nˆØ—‘˜“ˆØ�‰×#Ñ# EÔ*Ø�‰�SÕr1   c                óì   — | j                  |«      }| j                  }|r|j                  |«      }n|j                  «       }||j                  _        t        t        |«      }| j                  |«       |S )a=  Returns a new table entry `new_name` as copy of `name`,
        replaces entry `new_name` if already exist.

        Args:
            name: name of table entry, case-insensitive
            new_name: name of duplicated table entry

        Raises:
            DXFTableEntryError: table entry does not exist

        )	rc   rg   Úduplicate_entityÚcopyr_   rG   r   r#   r8   )r.   rG   Únew_namere   rg   r`   s         r/   Úduplicate_entryzTable.duplicate_entryº   sa   € ð —‘˜“ˆØ—=‘=ˆÙØ ×1Ñ1°%Ó8‰IàŸ
™
›ˆIØ%ˆ	�‰ÔÜ”Q˜	Ó"ˆØ�‰�UÔØˆr1   c                ó<   — | j                   | j                  |«      = y)z•Remove table entry without destroying object.

        Args:
            name: name of table entry, case-insensitive

        (internal API)
        N)r+   rP   rR   s     r/   rn   zTable.discardÑ   s   € ð �L‰L˜Ÿ™ $›Ñ(r1   c                óH   — | j                  |«       | j                  |«       y)z9Replace table entry `name` by new `entry`. (internal API)N)rn   r8   rd   s      r/   ÚreplacezTable.replaceÛ   s   € à�‰�TÔØ�‰�UÕr1   c                ó.   — | j                   j                  S r)   )r*   rg   r-   s    r/   rg   zTable.entitydbà   s   € à�x‰x× Ñ Ð r1   c                óÀ   — | j                   €J d«       ‚t        t        t        j                  | j
                  || j                   «      «      }| j                  |«       |S )úÂCreate and add new table-entry of type 'self.entry_dxftype'.

        Does not check if an entry dxfattribs['name'] already exists!
        Duplicate entries are possible for Viewports.
        zvalid DXF document required)r*   r   r#   r   Úcreate_db_entryr6   r8   ©r.   rI   re   s      r/   r`   zTable.new_entryä   sN   € ð �x‰xÐ#ÐBÐ%BÓBÐ#Ü”Qœ×/Ñ/°·±ÀÈTÏXÉXÓVÓWˆà�‰�UÔØˆr1   c                ó¦   — |j                  «       | j                  k(  sJ ‚|| j                  | j                  |j                  j
                  «      <   y)ú]Add a table entry, replaces existing entries with same name.
        (internal API).
        N)r7   r6   r+   rP   r_   rG   ©r.   re   s     r/   r8   zTable._appendð   s;   € ð �}‰}‹ $§/¡/Ò1Ð1Ð1Ø16ˆ�‰�T—X‘X˜eŸi™iŸn™nÓ-Ò.r1   c                ó<  — |j                  «       | j                  k7  r3t        j                  d|j                  «       › d| j                  › �«      ‚|j                  j
                  }| j                  |«      r9t        j                  | j                  j                  j
                  › d|› d�«      ‚| j                  r t        j                  || j                  «       | j                  j                  j                  |j                  _        | j                  |«       y)z]Add a table `entry`, created by other object than this table.
        (internal API)
        zInvalid table entry type z for table Ú z already exists!N)r7   r6   r   ÚDXFTypeErrorr_   rG   rS   r^   r,   r*   r   ÚbindrC   rH   r8   )r.   re   rG   s      r/   Ú	add_entryzTable.add_entry÷   sÙ   € ð �=‰=‹?˜dŸo™oÒ-Ü×$Ñ$Ø+¨E¯M©M«OÐ+<ð =Ø!Ÿ_™_Ð-ð/óð ð �y‰y�~‰~ˆØ�>‰>˜$ÔÜ×*Ñ*Ø—:‘:—>‘>×&Ñ&Ð' q¨¨Ð.>Ð?óð ð �8Š8Ü�L‰L˜ §¡Ô)ØŸ*™*Ÿ.™.×/Ñ/ˆ�	‰	ŒØ�‰�UÕr1   c                ó  — | j                  «        d| j                  j                  _        t	        | «      | j                  j                  _        | j                  j                  |«       | j                  |«       |j                  dd«       y)z)Export DXF representation. (internal API)rF   r   ÚENDTABN)	Úupdate_owner_handlesr,   r_   rH   rU   ÚcountÚ
export_dxfÚexport_table_entriesÚ
write_tag2)r.   Ú	tagwriters     r/   r‰   zTable.export_dxf
  sd   € ð 	×!Ñ!Ô#à"ˆ�
‰
�‰ÔÜ" 4›yˆ�
‰
�‰ÔØ�
‰
×Ñ˜iÔ(Ø×!Ñ! )Ô,Ø×Ñ˜Q Õ)r1   c                ód   — | j                   j                  «       D ]  }|j                  |«       Œ y r)   )r+   rX   r‰   )r.   rŒ   re   s      r/   rŠ   zTable.export_table_entries  s'   € Ø—\‘\×(Ñ(Ö*ˆEØ×Ñ˜YÕ'ñ +r1   c                ó¾   — | j                   j                  j                  }| j                  j	                  «       D ]   }|j
                  sŒ||j                  _        Œ" y r)   )r,   r_   rC   r+   rX   rY   rH   )r.   Úowner_handlere   s      r/   r‡   zTable.update_owner_handles  s>   € Ø—z‘z—~‘~×,Ñ,ˆØ—\‘\×(Ñ(Ö*ˆEØ�~‹~Ø".�—	‘	•ñ +r1   c                óœ   — | j                   j                  j                  €,|| j                   j                  _        | j                  «        yy)zlSet new `handle` for table, updates also :attr:`owner` tag of table
        entries. (internal API)
        N)r,   r_   rC   r‡   )r.   rC   s     r/   Ú
set_handlezTable.set_handle  s9   € ð �:‰:�>‰>× Ñ Ð(Ø$*ˆD�J‰J�N‰NÔ!Ø×%Ñ%Õ'ð )r1   c                óH   — | j                  |«       | j                  |«       y r)   )Ú_fix_table_headÚ_fix_entry_handles)r.   Úauditors     r/   ÚauditzTable.audit'  s    € ð 	×Ñ˜WÔ%Ø×Ñ Õ(r1   c                ó:  — | j                   }| D ]Š  }|j                  |j                  j                  «      }||usŒ-|j	                  «       |j                  _        | j                   j                  |«       |j                  t        j                  d|› �¬«       ŒŒ y )Nz$Fixed invalid table entry handle in ©ÚcodeÚmessage)	rg   rc   r_   rC   Únext_handleÚaddÚfixed_errorr   ÚINVALID_TABLE_HANDLE)r.   r•   rg   re   Úentitys        r/   r”   zTable._fix_entry_handles-  s„   € à—=‘=ˆÛˆEØ—\‘\ %§)¡)×"2Ñ"2Ó3ˆFØ˜UÒ"ð $,×#7Ñ#7Ó#9�—	‘	Ô Ø—‘×!Ñ! %Ô(Ø×#Ñ#Ü#×8Ñ8ØBÀ5À'ÐJð $õ ñ r1   c                óv  ‡ ‡‡‡‡— ˆˆˆˆˆ fd„}‰j                   j                  t        j                  kD  Š‰ j                  Šd‰j
                  _        ‰j
                  j                  }‰ j                  Š|�|dk(  r |«        n&‰ j                  j                  |«      }|‰ur |«        ‰ j                  «        y )Nc                 óÈ   •— ‰j                  «       ‰j                  _        ‰j                  ‰«       ‰r/‰ j	                  t
        j                  d‰j                  › �¬«       y y )Nz)Fixed invalid table head handle in table r˜   )r›   r_   rC   rœ   r�   r   rž   rG   )r•   rg   rL   Úlogr.   s   €€€€€r/   Úfix_headz'Table._fix_table_head.<locals>.fix_head=  sU   ø€ Ø&×2Ñ2Ó4ˆD�H‰HŒOØ�L‰L˜ÔÙØ×#Ñ#Ü#×8Ñ8ØGÈÏ	É	À{ÐSð $õ ð r1   rF   )r*   Ú
dxfversionr   ÚDXF12rL   r_   rH   rC   rg   rc   r‡   )r.   r•   r£   rC   re   rg   rL   r¢   s   ``   @@@r/   r“   zTable._fix_table_head<  s’   ü€ ÷	ð 	ð �k‰k×$Ñ$¤u§{¡{Ñ2ˆà�y‰yˆð ˆ�‰ŒØ—‘—‘ˆØ—=‘=ˆØˆ>˜V sš]á�Jð —M‘M×%Ñ% fÓ-ˆEØ˜DÑ Ù”
à×!Ñ!Õ#r1   ©ÚreturnÚNone)r*   r   r;   zIterator[DXFEntity]r§   r¨   )r*   r   rC   Ústrr§   r¨   r)   )rG   r©   rC   zOptional[str]r§   r¨   )r§   r©   )rG   r©   r§   r©   )rG   r©   r§   Úbool©r§   Úint)r§   zIterator[T])rG   r©   r§   r#   )rC   r©   r§   zOptional[T]©rG   r©   r§   r¨   )rG   r©   rs   r©   r§   r#   ©rG   r©   re   r#   r§   r¨   )r§   r!   )r§   r#   ©re   r#   r§   r¨   ©rŒ   r    r§   r¨   )rC   r©   )r•   r   )$Ú__name__Ú
__module__Ú__qualname__r6   r0   r?   rD   rA   ÚpropertyrL   rG   ÚstaticmethodrP   rS   Ú__contains__rV   r[   rJ   rc   rh   rk   ro   rt   rn   rw   rg   r`   r8   r„   r‰   rŠ   r‡   r‘   r–   r”   r“   © r1   r/   r&   r&   /   sÛ   „ Ø€Jó!ó
ó$ô
ð
 ñó ðð òó ðð ò.ó ð.ó.ð €Ló!óô*ó"1ó óóóó.)óð
 ò!ó ð!ó
ó7óó&	*ó(ó/ó(ó)óô$r1   r&   c                  óŒ   ‡ — e Zd ZdZd	ˆ fd„Zej                  ddej                  ddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d
d„Zdd„Z	ˆ xZ
S )Ú
LayerTableÚLAYERc                óz   •— t        t        t        ‰| �  |«      «      }| j                  r|j                  «        |S r)   )r   r   Úsuperr`   r*   Úset_required_attributes)r.   rI   ÚlayerÚ	__class__s      €r/   r`   zLayerTable.new_entry^  s1   ø€ Ü”UœE™GÑ-¨jÓ9Ó:ˆØ�8Š8Ø×)Ñ)Ô+Øˆr1   NÚ
ContinuousT)ÚcolorÚ
true_colorÚlinetypeÚ
lineweightÚplotÚtransparencyrI   c               ó€  — t        |xs i «      }t        j                  |«      r||d<   nt        j                  d|› �«      ‚||d<   t        j
                  |«      r||d<   nt        j                  d|› �«      ‚|�t        |«      |d<   t        |«      |d<   t        d| j                  ||«      «      }	|�||	_	        |	S )	a   Add a new :class:`~ezdxf.entities.Layer`.

        Args:
            name (str): layer name
            color (int): :ref:`ACI` value, default is BYLAYER
            true_color (int): true color value, use :func:`ezdxf.rgb2int` to
                create ``int`` values from RGB values
            linetype (str): line type name, default is "Continuous"
            lineweight (int): line weight, default is BYLAYER
            plot (bool): plot layer as bool, default is ``True``
            transparency: transparency value in the range [0, 1], where 1 is
                100% transparent and 0 is opaque
            dxfattribs (dict): additional DXF attributes

        rÁ   zinvalid color: rÃ   rÄ   zinvalid lineweight: rÂ   rÅ   r   )
Údictr   Úis_valid_aci_colorr   ÚDXFValueErrorÚis_valid_lineweightr¬   r   rJ   rÆ   )
r.   rG   rÁ   rÂ   rÃ   rÄ   rÅ   rÆ   rI   r¾   s
             r/   rœ   zLayerTable.addd  sÊ   € ô6 ˜*Ò*¨Ó+ˆ
Ü×'Ñ'¨Ô.Ø"'ˆJ�wÒä×%Ñ%¨¸°wÐ&?Ó@Ð@Ø!)ˆ
�:ÑÜ×(Ñ(¨Ô4Ø'1ˆJ�|Ò$ä×%Ñ%Ð(<¸Z¸LÐ&IÓJÐJØÐ!Ü'*¨:£ˆJ�|Ñ$Ü  ›Yˆ
�6ÑÜ�W˜dŸh™h t¨ZÓ8Ó9ˆØÐ#Ø!-ˆEÔØˆr1   c                ó  — | j                   €y| j                   j                  j                  «       D ]P  }t        |«      sŒ|j                  j                  dd«      }|sŒ.| j                  |«      rŒ@| j                  |«       ŒR y)z<Create for all referenced layers table entries if not exist.Nr¾   rj   )r*   rg   rX   r   r_   rc   rS   rœ   )r.   rZ   Ú
layer_names      r/   Úcreate_referenced_layersz#LayerTable.create_referenced_layers‘  se   € à�8‰8ÐØØ—‘×"Ñ"×)Ñ)Ö+ˆAÜ$ QÔ'ØØŸ™Ÿ™ 7¨BÓ/ˆJÚ $§.¡.°Õ"<à—‘˜Õ$ñ ,r1   )r§   r   )rG   r©   rÁ   r¬   rÂ   zOptional[int]rÃ   r©   rÄ   r¬   rÅ   rª   rÆ   zOptional[float]r§   r   r¦   )r±   r²   r³   r6   r`   r   ÚBYLAYERÚLINEWEIGHT_BYLAYERrœ   rÎ   Ú__classcell__©r¿   s   @r/   r¹   r¹   [  s‡   ø„ Ø€Jõð —]‘]Ø$(Ø$Ø×2Ñ2ØØ(,Øñ+àð+ð ð	+ð
 "ð+ð ð+ð ð+ð ð+ð &ð+ð 
ó+÷Z
%r1   r¹   c                  óH   ‡ — e Zd ZdZdˆ fd„Zddddœ	 	 	 	 	 	 	 	 	 d	d„Zˆ xZS )
ÚLinetypeTableÚLTYPEc                ó°   •— |j                  ddg«      }|j                  dd«      }t        t        t        ‰| �  |«      «      }|j                  ||«       |S )NÚpatternç        Úlengthr   )Úpopr   r   r¼   r`   Úsetup_pattern)r.   rI   r×   rÙ   Últyper¿   s        €r/   r`   zLinetypeTable.new_entry¡  sP   ø€ Ø—.‘. ¨S¨EÓ2ˆØ—‘ ¨!Ó,ˆÜ”Xœu™wÑ0°Ó<Ó=ˆØ×Ñ˜G VÔ,Øˆr1   rj   rØ   N)ÚdescriptionrÙ   rI   c               ó’   — t        |xs i «      }|j                  |t        |«      |t        |«      dœ«       | j	                  |«      S )aÐ  Add a new line type entry. The simple line type pattern is a list of
        floats :code:`[total_pattern_length, elem1, elem2, ...]`
        where an element > 0 is a line, an element < 0 is a gap and  an
        element == 0.0 is a dot. The definition for complex line types are
        strings, like: ``'A,.5,-.2,["GAS",STANDARD,S=.1,U=0.0,X=-0.1,Y=-.05],-.25'``
        similar to the line type definitions stored in the line definition
        `.lin` files, for more information see the tutorial about complex line
        types. Be aware that not many CAD applications and DXF viewers support
        complex linetypes.

        .. seealso::

            - `Tutorial for simple line types <https://ezdxf.mozman.at/docs/tutorials/linetypes.html>`_
            - `Tutorial for complex line types <https://ezdxf.mozman.at/docs/tutorials/linetypes.html#tutorial-for-complex-linetypes>`_

        Args:
            name (str): line type  name
            pattern: line type pattern as list of floats or as a string
            description (str): line type description, optional
            length (float): total pattern length, only for complex line types required
            dxfattribs (dict): additional DXF attributes

        )rG   rÝ   r×   rÙ   )rÈ   Úupdater©   Úfloatr`   )r.   rG   r×   rÝ   rÙ   rI   s         r/   rœ   zLinetypeTable.add¨  sM   € ô@ ˜*Ò*¨Ó+ˆ
Ø×ÑàÜ" ;Ó/Ø"Ü ›-ñ	ô	
ð �~‰~˜jÓ)Ð)r1   )r§   r   )
rG   r©   r×   zUnion[Sequence[float], str]rÝ   r©   rÙ   rà   r§   r   )r±   r²   r³   r6   r`   rœ   rÑ   rÒ   s   @r/   rÔ   rÔ   ž  sM   ø„ Ø€Jõð ØØñ)*àð)*ð -ð)*ð
 ð)*ð ð)*ð 
÷)*r1   rÔ   c                  óx   ‡ — e Zd ZdZdˆ fd„Zdˆ fd„Zdd„Zdˆ fd„Zddœdd„Zddœdd	„Z	dd
„Z
dd„Zdd„Zˆ xZS )ÚTextstyleTableÚSTYLEc                ó@   •— t         ‰| �  «        t        «       | _        y r)   )r¼   r0   rÈ   Ú	shx_files)r.   r¿   s    €r/   r0   zTextstyleTable.__init__×  s   ø€ Ü‰ÑÔÜ/3«vˆ�r1   c                ó„   •— t         ‰| �  |«       | j                  j                  «       D ]  }|j	                  |«       Œ y r)   )r¼   rŠ   rå   rX   r‰   )r.   rŒ   Úshx_filer¿   s      €r/   rŠ   z#TextstyleTable.export_table_entriesÛ  s5   ø€ Ü‰Ñ$ YÔ/ØŸ™×-Ñ-Ö/ˆHØ×Ñ 	Õ*ñ 0r1   c                ó2  — |j                   j                  dk(  rL|j                   j                  dz  r3|| j                  | j	                  |j                   j
                  «      <   y|| j                  | j	                  |j                   j                  «      <   y)r~   rj   é   N)r_   rG   Úflagsrå   rP   Úfontr+   r   s     r/   r8   zTextstyleTable._appendà  sa   € ð �9‰9�>‰>˜RÒ U§Y¡Y§_¡_°qÒ%8Ø7<ˆD�N‰N˜4Ÿ8™8 E§I¡I§N¡NÓ3Ò4à5:ˆD�L‰L˜Ÿ™ %§)¡)§.¡.Ó1Ò2r1   c                óÂ   •— t         ‰| �  «        | j                  j                  j                  }| j
                  j                  «       D ]  }||j                  _        Œ y r)   )r¼   r‡   r,   r_   rC   rå   rX   rH   )r.   r�   re   r¿   s      €r/   r‡   z#TextstyleTable.update_owner_handlesé  sC   ø€ Ü‰Ñ$Ô&Ø—z‘z—~‘~×,Ñ,ˆØ—^‘^×*Ñ*Ö,ˆEØ*ˆE�I‰I�Oñ -r1   N©rI   c               ó~   — t        |xs i «      }|j                  |t        |«      ddœ«       | j                  |«      S )a]  Add a new text style entry for TTF fonts. The entry must not yet
        exist, otherwise an :class:`DXFTableEntryError` exception will be
        raised.

        Finding the TTF font files is the task of the DXF viewer and each
        viewer is different (hint: support files).

        Args:
            name (str): text style name
            font (str): TTF font file name like "Arial.ttf", the real font file
                name from the file system is required and only the Windows filesystem
                is case-insensitive.
            dxfattribs (dict): additional DXF attributes

        ç      @)rG   rë   Úlast_height)rÈ   rß   r©   r`   )r.   rG   rë   rI   s       r/   rœ   zTextstyleTable.addï  sD   € ô  ˜*Ò*¨Ó+ˆ
Ø×ÑàÜ˜D›	Ø"ñô	
ð �~‰~˜jÓ)Ð)r1   c               ó  — | j                  |«      �9t        j                  | j                  j                  j
                  › d|› d�«      ‚t        |xs i «      }|j                  dd|ddœ«       | j                  |«      S )aì  Add a new shape font (SHX file) entry. These are special text style
        entries and have no name. The entry must not yet exist, otherwise an
        :class:`DXFTableEntryError` exception will be raised.

        Locating the SHX files in the filesystem is the task of the DXF viewer and each
        viewer is different (hint: support files).

        Args:
            shx_file_name (str): shape file name like "gdt.shx"
            dxfattribs (dict): additional DXF attributes

        z shape file entry for 'r]   rj   ré   rï   )rG   rê   rë   rð   )	Úfind_shxr   r^   r,   r_   rG   rÈ   rß   r`   )r.   Úshx_file_namerI   s      r/   Úadd_shxzTextstyleTable.add_shx	  s�   € ð �=‰=˜Ó'Ð3Ü×*Ñ*Ø—:‘:—>‘>×&Ñ&Ð'ð (Ø!�?Ð"3ð5óð ô
 ˜*Ò*¨Ó+ˆ
Ø×ÑàØØ%Ø"ñ	ô	
ð �~‰~˜jÓ)Ð)r1   c                óN   — | j                  |«      }|€| j                  |«      S |S )a3  Get existing entry for a shape file (SHX file), or create a new
        entry.

        Locating the SHX files in the filesystem is the task of the DXF viewer and each
        viewer is different (hint: support files).

        Args:
            shx_file_name (str): shape file name like "gdt.shx"

        )rò   rô   )r.   ró   Ú
shape_files      r/   Úget_shxzTextstyleTable.get_shx'  s-   € ð —]‘] =Ó1ˆ
ØÐØ—<‘< Ó.Ð.ØÐr1   c                óV   — | j                   j                  | j                  |«      «      S )a  Find the shape file (SHX file) text style table entry, by a
        case-insensitive search.

        A shape file table entry has no name, so you have to search by the
        font attribute.

        Args:
            shx_file_name (str): shape file name like "gdt.shx"

        )rå   rc   rP   ©r.   ró   s     r/   rò   zTextstyleTable.find_shx7  s"   € ð �~‰~×!Ñ! $§(¡(¨=Ó"9Ó:Ð:r1   c                ó\   — 	 | j                   | j                  |«      = y# t        $ r Y yw xY w)zÓDiscard the shape file (SHX file) text style table entry. Does not raise an
        exception if the entry does not exist.

        Args:
            shx_file_name (str): shape file name like "gdt.shx"

        N)rå   rP   ÚKeyErrorrù   s     r/   Údiscard_shxzTextstyleTable.discard_shxD  s.   € ð	Ø—‘˜tŸx™x¨Ó6Ñ7øÜò 	Ùð	ús   ‚ Ÿ	+ª+r¦   r°   )re   r   r§   r¨   )rG   r©   rë   r©   r§   r   )ró   r©   r§   r   )ró   r©   r§   zOptional[Textstyle])ró   r©   r§   r¨   )r±   r²   r³   r6   r0   rŠ   r8   r‡   rœ   rô   r÷   rò   rü   rÑ   rÒ   s   @r/   râ   râ   Ô  s?   ø„ Ø€Jõ6õ+ó
;õ+ð 7;õ *ð4 9=õ *ó<ó ;÷r1   râ   c                  óˆ   — e Zd ZdZdd„Zddd„Zddœdd„Zdd„Zdd„Zdd	„Z	dd
„Z
dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zy)ÚViewportTableÚVPORTc                ó–   — | j                   j                  «       D ],  }t        |t        «      sJ ‚|D ]  }|j	                  |«       Œ Œ. y r)   )r+   rX   r4   Úlistr‰   )r.   rŒ   re   rZ   s       r/   rŠ   z"ViewportTable.export_table_entriesW  s?   € Ø—\‘\×(Ñ(Ö*ˆEÜ˜e¤TÔ*Ð*Ð*Û�Ø—‘˜YÕ'ñ ñ +r1   Nc                ó:   — |xs i }||d<   | j                  |«      S )zCreate a new table entry.rG   )r`   ra   s      r/   rJ   zViewportTable.new]  s%   € àÒ% 2ˆ
Ø!ˆ
�6ÑØ�~‰~˜jÓ)Ð)r1   rí   c               óL   — t        |xs i «      }||d<   | j                  |«      S )a(  Add a new modelspace viewport entry. A modelspace viewport
        configuration can consist of multiple viewport entries with the same
        name.

        Args:
            name (str): viewport name, multiple entries possible
            dxfattribs (dict): additional DXF attributes

        rG   ©rÈ   r`   ra   s      r/   rœ   zViewportTable.addc  s,   € ô ˜*Ò*¨Ó+ˆ
Ø!ˆ
�6ÑØ�~‰~˜jÓ)Ð)r1   c                óÐ   — | j                  |«      }t        t        t           | j	                  |«      «      }|D ]  }| j
                  j                  |«       Œ | j                  |= y)z3Remove table-entry from table and entitydb by name.N)rP   r   r   r   rc   rg   rm   r+   )r.   rG   rP   r+   re   s        r/   ro   zViewportTable.removeq  sO   € à�h‰h�t‹nˆÜ”tœI‘¨¯©°«Ó7ˆÛˆEØ�M‰M×'Ñ'¨Õ.ð à�L‰L˜Ñr1   c              #  ót   K  — | j                   j                  «       D ]  }t        |«      E d {  –—†  Œ y 7 Œ­wr)   ©r+   rX   Úiter©r.   r+   s     r/   r[   zViewportTable.__iter__y  ó-   è ø€ Ø—|‘|×*Ñ*Ö,ˆGÜ˜G“}×$Ñ$ñ -Ø$úó   ‚,8®6¯8c              #  ót   K  — | j                   j                  «       D ]  }t        |«      E d {  –—†  Œ y 7 Œ­wr)   r  r	  s     r/   Ú_flattenzViewportTable._flatten}  r
  r  c                óF   — t        t        | j                  «       «      «      S r)   )rU   r  r  r-   s    r/   rV   zViewportTable.__len__�  s   € ä”4˜Ÿ™›Ó(Ó)Ð)r1   c                óÀ   — | j                   €J d«       ‚t        t        t        j                  | j
                  || j                   «      «      }| j                  |«       |S )rz   zvalid DXF document expected)r*   r   r   r   r{   r6   r8   r|   s      r/   r`   zViewportTable.new_entry…  sT   € ð �x‰xÐ#ÐBÐ%BÓBÐ#ÜÜÜ×#Ñ# D§O¡O°ZÀÇÁÓJó
ˆð 	�‰�UÔØˆr1   c                ó   — t        «       ‚r)   )ÚNotImplementedError)r.   rG   rs   s      r/   rt   zViewportTable.duplicate_entry“  s   € Ü!Ó#Ð#r1   c                óÈ   — | j                  |j                  j                  «      }|| j                  v r| j                  |   j	                  |«       y |g| j                  |<   y r)   )rP   r_   rG   r+   Úappend)r.   re   rP   s      r/   r8   zViewportTable._append–  sK   € Ø�h‰h�u—y‘y—~‘~Ó&ˆØ�$—,‘,ÑØ�L‰L˜Ñ×$Ñ$ UÕ+à!& ˆD�L‰L˜Òr1   c                óÆ   — | j                  |«       t        |t        «      r|}n|g}|sy | j                  |d   j                  j
                  «      }|| j                  |<   y )Nr   )rn   r4   r  rP   r_   rG   r+   )r.   rG   re   ÚconfigrP   s        r/   rw   zViewportTable.replace�  sT   € Ø�‰�TÔä�eœTÔ"Ø‰Fà�WˆFÙØØ�h‰h�v˜a‘y—}‘}×)Ñ)Ó*ˆØ"ˆ�‰�SÒr1   c                ó²   — | j                   j                  j                  }| j                  j	                  «       D ]  }|D ]  }||j                  _        Œ Œ y r)   )r,   r_   rC   r+   rX   rH   )r.   r�   r+   re   s       r/   r‡   z"ViewportTable.update_owner_handles©  sA   € Ø—z‘z—~‘~×,Ñ,ˆØ—|‘|×*Ñ*Ö,ˆGÛ �Ø".�—	‘	•ñ !ñ -r1   c                ó„   — 	 | j                   | j                  |«         S # t        $ r t        j                  |«      ‚w xY w)zwReturns a list of :class:`~ezdxf.entities.VPort` objects, for
        the multi-viewport configuration `name`.
        )r+   rP   rû   r   r^   rR   s     r/   Ú
get_configzViewportTable.get_config¯  s>   € ð	1Ø—<‘< §¡¨£Ñ/Ð/øÜò 	1Ü×*Ñ*¨4Ó0Ð0ð	1ús   ‚   ?c                ó&   — | j                  |«       y)znDelete all :class:`~ezdxf.entities.VPort` objects of the
        multi-viewport configuration `name`.
        N)ro   rR   s     r/   Údelete_configzViewportTable.delete_config¸  s   € ð 	�‰�DÕr1   r°   r)   )rG   r©   r§   r   r­   )r§   zIterator[VPort]r«   )r§   r   )rG   r©   rs   r©   r§   r   r¯   r®   r¦   )rG   r©   r§   zlist[VPort])r±   r²   r³   r6   rŠ   rJ   rœ   ro   r[   r  rV   r`   rt   r8   rw   r‡   r  r  r·   r1   r/   rþ   rþ   R  sR   „ Ø€Jó(ô*ð ,0õ *óó%ó%ó*óó$ó(ó
#ó/ó1ôr1   rþ   c                  ó   — e Zd ZdZddœdd„Zy)Ú
AppIDTableÚAPPIDNrí   c               óL   — t        |xs i «      }||d<   | j                  |«      S )z†Add a new appid table entry.

        Args:
            name (str): appid name
            dxfattribs (dict): DXF attributes

        rG   r  ra   s      r/   rœ   zAppIDTable.addÂ  ó,   € ô ˜*Ò*¨Ó+ˆ
Ø!ˆ
�6ÑØ�~‰~˜jÓ)Ð)r1   )rG   r©   r§   r   ©r±   r²   r³   r6   rœ   r·   r1   r/   r  r  ¿  s   „ Ø€Jà+/ö 
*r1   r  c                  ó   — e Zd ZdZddœdd„Zy)Ú	ViewTableÚVIEWNrí   c               óL   — t        |xs i «      }||d<   | j                  |«      S )z„Add a new view table entry.

        Args:
            name (str): view name
            dxfattribs (dict): DXF attributes

        rG   r  ra   s      r/   rœ   zViewTable.addÒ  r  r1   )rG   r©   r§   r   r   r·   r1   r/   r"  r"  Ï  s   „ Ø€Jà+/ö 
*r1   r"  c                  ó   — e Zd ZdZddœdd„Zy)ÚBlockRecordTableÚBLOCK_RECORDNrí   c               óL   — t        |xs i «      }||d<   | j                  |«      S )z”Add a new block record table entry.

        Args:
            name (str): block record name
            dxfattribs (dict): DXF attributes

        rG   r  ra   s      r/   rœ   zBlockRecordTable.addâ  r  r1   )rG   r©   r§   r   r   r·   r1   r/   r&  r&  ß  s   „ Ø€Jà+/ö 
*r1   r&  c                  ó   — e Zd ZdZddœdd„Zy)ÚDimStyleTableÚDIMSTYLENrí   c               óL   — t        |xs i «      }||d<   | j                  |«      S )zšAdd a new dimension style table entry.

        Args:
            name (str): dimension style name
            dxfattribs (dict): DXF attributes

        rG   r  ra   s      r/   rœ   zDimStyleTable.addò  r  r1   )rG   r©   r§   r   r   r·   r1   r/   r*  r*  ï  s   „ Ø€Jà+/ö 
*r1   r*  c                  ó   — e Zd ZdZddœdd„Zy)ÚUCSTableÚUCSNrí   c               óL   — t        |xs i «      }||d<   | j                  |«      S )z‚Add a new UCS table entry.

        Args:
            name (str): UCS name
            dxfattribs (dict): DXF attributes

        rG   r  ra   s      r/   rœ   zUCSTable.add  r  r1   )rG   r©   r§   r   r   r·   r1   r/   r.  r.  ÿ  s   „ Ø€Jà+/ö 
*r1   r.  )7Ú
__future__r   Útypingr   r   r   r   r   r	   r
   r   r   Úcollectionsr   ÚloggingÚezdxf.auditr   r   Úezdxf.lldxfr   r   Úezdxf.entities.tabler   Úezdxf.entitiesr   r   r   r   r   r   r   r   r   r   r   r   Úezdxf.documentr   Úezdxf.lldxf.tagwriterr    Úezdxf.entitydbr!   Ú	getLoggerr9   r#   r&   r¹   rÔ   râ   rþ   r  r"  r&  r*  r.  r·   r1   r/   Ú<module>r=     s  ðõ #÷
÷ 
õ 
õ $Û ç +ß (Ý *÷÷ ÷ ó ñ Ý&Ý7Ý'ð 
ˆ×	Ñ	˜7Ó	#€áˆC�{Ô#€ôi$ˆG�A‰Jô i$ôX	@%��u‘ô @%ôF3*�E˜(‘Oô 3*ôl{�U˜9Ñ%ô {ô|j�E˜%‘Lô jôZ*��u‘ô *ô *��d‘ô *ô *�u˜[Ñ)ô *ô *�E˜(‘Oô *ô *ˆu�]Ñ#õ *r1   