
    Og                         d dl mZmZ d dlZd dlmZ d dlmZ ddl ddl	m
Z
 ddlmZ dd	lmZ dd
edefdZ G d de      Z G d de      Zy)    )IterableTupleN)	BitStream)DXFClass   )*)crc8)
FileHeader)DwgSectionLoaderspecsdatac                 \    | j                   t        k  rt        | ||      S t        | ||      S N)version	ACAD_2000DwgClassesSectionR2000DwgClassesSectionR2004)r   r   	crc_checks      e/var/www/html/public_html/myphp/venv/lib/python3.12/site-packages/ezdxf/addons/dwg/classes_section.pyload_classes_sectionr      s,    }}	!%eT9==%eT9==    c                   8    e Zd ZdedefdZdeeeef      fdZ	y)r   r   returnc                     | j                   j                  t        kD  rt        | j                   j                        | j                   j                  t
           \  }}||||z    S r   )r   r   r   DwgVersionErrorsections
CLASSES_ID)selfr   seekersection_sizes       r   load_data_sectionz(DwgClassesSectionR2000.load_data_section   sT    ::	)!$**"4"455#zz22:>FVl233r   c           	   #      K   | j                   d t         }|dk7  rt        d      t        }t        | j                   |d  | j                  j
                  | j                  j                        }|j                         }t        dz   |z   }|dz
  }d|z   dz  }|j                  |k  r|j                         }|j                         |j                         |j                         |j                         |j                         t        |j                         dk(        d}	|t        j                  |		      f |j                  |k  r| j                  r	 | j                   ||t        z    }|d
k7  rt        d      y w)Ns   ĸĩ_϶z0Sentinel for start of CLASSES section not found.)
dxfversionencoding         i  )flagsapp_namecpp_class_namenamewas_a_proxyis_an_entity)
dxfattribss   r^;G;V:?#0Iuz.Sentinel for end of CLASSES section not found.)r   SENTINEL_SIZEDwgCorruptedClassesSectionr   r   r   r$   read_unsigned_long	bit_indexread_bit_short	read_textread_bitintr   newr   structunpack_fromr	   CRCError)r   sentinelstart_indexbsclass_data_sizeend_sentinel_index	end_indexend_bit_index	class_numr.   checkcrcs               r   load_classesz#DwgClassesSectionR2000.load_classes   s}    99^m,RS -B  $IIkl#zz))ZZ((

 //1*Q.@&*	_,2ll]*))+I**,LLN"$,,.!{{} #B$5$5$75$@ AJ X\\Z@@@ ll]* >>e 99!3m!C
 RS -@ Ss   EE>
4E>N)
__name__
__module____qualname__Bytesr!   r   r   r6   r   rE    r   r   r   r      s/    4e 4 40huS(]';< 0r   r   c                       e Zd ZdedefdZy)r   r   r   c                     t               r   )NotImplementedError)r   r   s     r   	load_dataz DwgClassesSectionR2004.load_dataQ   s    !##r   N)rF   rG   rH   rI   rN   rJ   r   r   r   r   P   s    $e $ $r   r   )F)typingr   r   r8   ezdxf.tools.binarydatar   ezdxf.entitiesr   constrD   r	   
fileheaderr
   header_sectionr   rI   r   r   r   rJ   r   r   <module>rU      sM    #  , #   " ,>
 >% >7- 7t$3 $r   