Ë
    ‹`g«  ã                   óP   — d Z ddlZddlmZmZ ddlmZ ddlmZ  G d„ dee«      Z	y)aï  
The *Drawing* object is the overall container for all SVG
elements. It provides the methods to store the drawing into a file or a
file-like object. If you want to use stylesheets, the reference links
to this stylesheets were also stored (`add_stylesheet`)
in the *Drawing* object.

set/get SVG attributes::

    element['attribute'] = value
    value = element['attribute']

The Drawing object also includes a defs section, add elements to the defs
section by::

    drawing.defs.add(element)

é    N)ÚSVGÚDefs)ÚElementFactory)Ú
pretty_xmlc                   óT   ‡ — e Zd ZdZd	ˆ fd„	Zˆ fd„Zd
d„Zdd„Zdd„Zdd„Z	d„ Z
ˆ xZS )ÚDrawingaÍ   This is the SVG drawing represented by the top level *svg* element.

    A drawing consists of any number of SVG elements contained within the drawing
    element, stored in the *elements* attribute.

    A drawing can range from an empty drawing (i.e., no content inside of the drawing),
    to a very simple drawing containing a single SVG element such as a *rect*,
    to a complex, deeply nested collection of container elements and graphics elements.
    c                 óL   •— t        t        | �
  dd|i|¤Ž || _        g | _        y)a“  
        :param string filename: filesystem filename valid for :func:`open`
        :param 2-tuple size: width, height
        :param keywords extra: additional svg-attributes for the *SVG* object

        Important (and not SVG Attributes) **extra** parameters:

        :param string profile: ``'tiny | full'`` - define the SVG baseProfile
        :param bool debug: switch validation on/off

        ÚsizeN© )Úsuperr   Ú__init__ÚfilenameÚ_stylesheets)Úselfr   r
   ÚextraÚ	__class__s       €úa/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/svgwrite/drawing.pyr   zDrawing.__init__+   s+   ø€ ô 	Œg�tÑ%Ñ9¨4Ð9°5Ò9Ø ˆŒØˆÕó    c                 óî   •— | j                   }| j                  }d| j                  d<   d| j                  d<   d| j                  d<   || j                  d<   || j                  d<   t        t        | �  «       S )	z‰ Get the XML representation as `ElementTree` object.

        :return: XML `ElementTree` of this object and all its subelements

        zhttp://www.w3.org/2000/svgÚxmlnszhttp://www.w3.org/1999/xlinkzxmlns:xlinkz!http://www.w3.org/2001/xml-eventszxmlns:evÚbaseProfileÚversion)Úprofiler   Úattribsr   r   Úget_xml)r   r   r   r   s      €r   r   zDrawing.get_xml;   sm   ø€ ð —,‘,ˆØ—,‘,ˆØ <ˆ�‰�WÑØ&Dˆ�‰�]Ñ#Ø#Fˆ�‰�ZÑ à&-ˆ�‰�]Ñ#Ø")ˆ�‰�YÑÜ”W˜dÑ+Ó-Ð-r   c                 óB   — | j                   j                  ||||f«       y)a5   Add a stylesheet reference.

        :param string href: link to stylesheet <URI>
        :param string title: name of stylesheet
        :param string alternate: ``'yes'|'no'``
        :param string media: ``'all | aureal | braille | embossed | handheld | print | projection | screen | tty | tv'``

        N)r   Úappend)r   ÚhrefÚtitleÚ	alternateÚmedias        r   Úadd_stylesheetzDrawing.add_stylesheetK   s!   € ð 	×Ñ× Ñ  $¨¨y¸%Ð!@ÕAr   c                 óÔ   — |j                  d«       d}| j                  D ]  }|j                  ||z  «       Œ | j                  «       }|rt        ||¬«      }|j                  |«       y)aK   Write XML string to `fileobj`.

        :param fileobj: a file-like object
        :param pretty: True for easy readable output
        :param indent: how much to indent if pretty is enabled, by default 2 spaces

        Python 3.x - set encoding at the open command::

            open('filename', 'w', encoding='utf-8')
        z(<?xml version="1.0" encoding="utf-8" ?>
zR<?xml-stylesheet href="%s" type="text/css" title="%s" alternate="%s" media="%s"?>
)ÚindentN)Úwriter   Útostringr   )r   ÚfileobjÚprettyr$   Ústylesheet_templateÚ
stylesheetÚ
xml_strings          r   r%   zDrawing.writeV   se   € ð 	�‰ÐAÔBð
7Ðð ×+Ô+ˆJØ�M‰MÐ-°
Ñ:Õ;ð ,ð —]‘]“_ˆ
ÙÜ# J°vÔ>ˆJØ�‰�jÕ!r   c                 ó�   — t        j                  | j                  dd¬«      }| j                  |||¬«       |j	                  «        y)z¼ Write the XML string to `self.filename`.

        :param pretty: True for easy readable output
        :param indent: how much to indent if pretty is enabled, by default 2 spaces
        Úwzutf-8)ÚmodeÚencoding©r(   r$   N)ÚioÚopenr   r%   Úclose)r   r(   r$   r'   s       r   ÚsavezDrawing.saver   s5   € ô —'‘'˜$Ÿ-™-¨c¸GÔDˆØ�
‰
�7 6°&ˆ
Ô9Ø�‰�r   c                 ó8   — || _         | j                  ||¬«       y)a   Write the XML string to `filename`.

        :param string filename: filesystem filename valid for :func:`open`
        :param pretty: True for easy readable output
        :param indent: how much to indent if pretty is enabled, by default 2 spaces
        r0   N)r   r4   )r   r   r(   r$   s       r   ÚsaveaszDrawing.saveas|   s   € ð !ˆŒØ�	‰	˜¨ˆ	Õ/r   c                 ó"   — | j                  «       S )z� Show SVG in IPython, Jupyter Notebook, and Jupyter Lab

        :return: unicode XML string of this object and all its subelements

        )r&   )r   s    r   Ú
_repr_svg_zDrawing._repr_svg_†   s   € ð �}‰}‹Ðr   )z
noname.svg)ú100%r9   )ÚnoÚscreen)Fé   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r"   r%   r4   r6   r8   Ú__classcell__)r   s   @r   r   r   !   s,   ø„ ñõô .ó 	Bó"ó8ó0ör   r   )
r@   r1   Úsvgwrite.containerr   r   Úsvgwrite.elementfactoryr   Úsvgwrite.utilsr   r   r   r   r   Ú<module>rE      s(   ðñó$ 
ç (Ý 2Ý %ôkˆc�>õ kr   