
    lj,              	         d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZmZmZ ddlmZ ddlmZmZmZmZ ddlZddlmZ ddlmZ dd	lmZ dd
lmZ erddl m!Z! ddlm"Z" ddl#m$Z$m%Z% g dZ& ej'        d          Z(d dZ)	 d!d"dZ*d#dZ+ G d de          Z, G d de          Z- e.e-j/                   e.e-j0                  z   D ]Z1 e2e-e1 e3e1fd                     dS )$a  Utilities to create and set the config.

The main class exported by this module is :class:`ManimConfig`.  This class
contains all configuration options, including frame geometry (e.g. frame
height/width, frame rate), output (e.g. directories, logging), styling
(e.g. background color, transparency), and general behavior (e.g. writing a
movie vs writing a single frame).

See :doc:`/guides/configuration` for an introduction to Manim's configuration system.

    )annotationsN)IteratorMappingMutableMapping)Path)TYPE_CHECKINGAnyClassVarNoReturn)	constants)RendererType)
ManimColor)TexTemplate)EnumMeta)Self)StrPathVector3D)config_file_pathsmake_config_parserManimConfig
ManimFramemanimreturn
list[Path]c                 <   t          j        t          t                    j        dz            } t          j                            d          r t          j                    dz  dz  dz  dz  }nt          j                    dz  dz  dz  }t          d          }| ||gS )	a  The paths where ``.cfg`` files will be searched for.

    When manim is first imported, it processes any ``.cfg`` files it finds.  This
    function returns the locations in which these files are searched for.  In
    ascending order of precedence, these are: the library-wide config file, the
    user-wide config file, and the folder-wide config file.

    The library-wide config file determines manim's default behavior.  The
    user-wide config file is stored in the user's home folder, and determines
    the behavior of manim whenever the user invokes it from anywhere in the
    system.  The folder-wide config file only affects scenes that are in the
    same folder.  The latter two files are optional.

    These files, if they exist, are meant to loaded into a single
    :class:`configparser.ConfigParser` object, and then processed by
    :class:`ManimConfig`.

    Returns
    -------
    List[:class:`Path`]
        List of paths which may contain ``.cfg`` files, in ascending order of
        precedence.

    See Also
    --------
    :func:`make_config_parser`, :meth:`ManimConfig.digest_file`,
    :meth:`ManimConfig.digest_parser`

    Notes
    -----
    The location of the user-wide config file is OS-specific.

    zdefault.cfgwin32AppDataRoamingManimz	manim.cfgz.configr   )r   resolve__file__parentsysplatform
startswithhome)library_wide	user_widefolder_wides      N/home/agentuser/manim-venv/lib/python3.11/site-packages/manim/_config/utils.pyr   r   -   s    D <X 5 EFFL
|w'' DIKK)+i7'AKO		IKK)+g5C	{##K)[11    custom_fileStrPath | Noneconfigparser.ConfigParserc                   t                      \  }}}t          j                    }t                              d|            |                                5 }|                    |           ddd           n# 1 swxY w Y   || rt          |           n|g}|D ]3}|                                rt                              d|            4|	                    |           |S )a  Make a :class:`ConfigParser` object and load any ``.cfg`` files.

    The user-wide file, if it exists, overrides the library-wide file.  The
    folder-wide file, if it exists, overrides the other two.

    The folder-wide file can be ignored by passing ``custom_file``.  However,
    the user-wide and library-wide config files cannot be ignored.

    Parameters
    ----------
    custom_file
        Path to a custom config file.  If used, the folder-wide file in the
        relevant directory will be ignored, if it exists.  If None, the
        folder-wide file will be used, if it exists.

    Returns
    -------
    :class:`ConfigParser`
        A parser containing the config options found in the .cfg files that
        were found.  It is guaranteed to contain at least the config options
        found in the library-wide file.

    See Also
    --------
    :func:`config_file_paths`

    zReading config file: N)
r   configparserConfigParserloggerinfoopen	read_filer   existsread)r,   r'   r(   r)   parserfileother_filespaths           r*   r   r   X   s)   < ,=+>+>(L)[
 &((F
KK666777					                ;Od;///KPK 8 8;;== 	8KK666777
KKMs   A99A= A=qual
str | Nonestrc                ~    t           j                                        D ]\  }}|d         |d         | k    r|c S | S )Nflag)r   	QUALITIESitems)r<   qualityvaluess      r*   _determine_qualityrE      sK    $.4466  &>%&.D*@*@NNNKr+   c                     e Zd ZdZh dZddZddZdd	ZddZddZ	ddZ
ddZddZddZddZddZddZdd!Zdd%Zdd&Zdd(Zdd)Zdd-Zdd.Zdd0Zdd1Zdd4Zdd7Zdd:Zedd;            Zej        dd=            Zedd>            Z e j        dd?            Z edd@            Z!e!j        ddA            Z!eddB            Z"e"j        ddC            Z"eddD            Z#e#j        ddE            Z#eddF            Z$e$j        ddG            Z$eddH            Z%e%j        ddI            Z%eddJ            Z&e&j        ddK            Z&eddL            Z'e'j        ddM            Z'eddN            Z(e(j        ddO            Z(eddP            Z)e)j        ddQ            Z)eddR            Z*e*j        ddS            Z*eddT            Z+e+j        ddU            Z+eddV            Z,e,j        ddW            Z,eddX            Z-e-j        ddY            Z-eddZ            Z.e.j        dd[            Z.edd]            Z/e/j        dd^            Z/edd_            Z0e0j        dd`            Z0eddb            Z1e1j        ddc            Z1eddd            Z2e2j        dde            Z2eddf            Z3e3j        ddg            Z3eddh            Z4e4j        ddi            Z4eddj            Z5eddk            Z6e6j        ddl            Z6eddm            Z7e7j        ddn            Z7eddo            Z8e8j        ddp            Z8eddq            Z9e9j        ddr            Z9eddt            Z:eddu            Z;eddv            Z<eddw            Z=eddx            Z>e>j        ddy            Z>edd{            Z?e?j        dd|            Z?edd}            Z@e@j        dd~            Z@edd            ZAeAj        dd            ZAedd            ZBeBj        dd            ZBedd            ZCeCj        dd            ZCedd            ZDeDj        dd            ZDedd            ZEeEj        dd            ZEedd            ZFeFj        dd            ZFedd            ZGeGj        dd            ZGedd            ZHeHj        dd            ZHedd            ZIeIj        dd            ZIedd            ZJeJj        dd            ZJedd            ZKeKj        dd            ZKedd            ZLeLj        dd            ZLedd            ZMeMj        d d            ZMedd            ZNeNj        dd            ZNedd            ZOeOj        dd            ZOedd            ZPePj        dd            ZPddZQedd            ZReRj        dd            ZRedd            ZSeSj        dd            ZSedd            ZTeTj        dd            ZTedd            ZUeUj        dd            ZUedd            ZVeVj        dd            ZVedd            ZWeWj        dd            ZWddZXddZYedd            ZZeZj        dd            ZZedd            Z[e[j        dd            Z[edd            Z\e\j        dd            Z\edd            Z]e]j        dd            Z]edd            Z^e^j        dd            Z^edd            Z_e_j        dd            Z_eddÄ            Z`e`j        ddĄ            Z`eddń            Zaeaj        ddƄ            ZaeddǄ            Zbebj        ddȄ            Zbed	dɄ            Zcecj        ddʄ            Zcedd˄            Zdedj        dd̄            Zded
d΄            Zeeej        ddτ            Zeeddф            Zfefj        dd҄            Zfeddӄ            Zgegj        ddԄ            Zged
dՄ            Zhehj        ddք            Zhedd؄            Zieij        ddل            ZidS (  r   u8  Dict-like class storing all config options.

    The global ``config`` object is an instance of this class, and acts as a
    single source of truth for all of the library's customizable behavior.

    The global ``config`` object is capable of digesting different types of
    sources and converting them into a uniform interface.  These sources are
    (in ascending order of precedence): configuration files, command line
    arguments, and programmatic changes.  Regardless of how the user chooses to
    set a config option, she can access its current value using
    :class:`ManimConfig`'s attributes and properties.

    Notes
    -----
    Each config option is implemented as a property of this class.

    Each config option can be set via a config file, using the full name of the
    property.  If a config option has an associated CLI flag, then the flag is
    equal to the full name of the property.  Those that admit an alternative
    flag or no flag at all are documented in the individual property's
    docstring.

    Examples
    --------
    We use a copy of the global configuration object in the following
    examples for the sake of demonstration; you can skip these lines
    and just import ``config`` directly if you actually want to modify
    the configuration:

    .. code-block:: pycon

        >>> from manim import config as global_config
        >>> config = global_config.copy()

    Each config option allows for dict syntax and attribute syntax.  For
    example, the following two lines are equivalent,

    .. code-block:: pycon

        >>> from manim import WHITE
        >>> config.background_color = WHITE
        >>> config["background_color"] = WHITE

    The former is preferred; the latter is provided mostly for backwards
    compatibility.

    The config options are designed to keep internal consistency.  For example,
    setting ``frame_y_radius`` will affect ``frame_height``:

    .. code-block:: pycon

        >>> config.frame_height
        8.0
        >>> config.frame_y_radius = 5.0
        >>> config.frame_height
        10.0

    There are many ways of interacting with config options.  Take for example
    the config option ``background_color``.  There are three ways to change it:
    via a config file, via CLI flags, or programmatically.

    To set the background color via a config file, save the following
    ``manim.cfg`` file with the following contents.

    .. code-block::

       [CLI]
       background_color = WHITE

    In order to have this ``.cfg`` file apply to a manim scene, it needs to be
    placed in the same directory as the script,

    .. code-block:: bash

          project/
          ├─scene.py
          └─manim.cfg

    Now, when the user executes

    .. code-block:: bash

        manim scene.py

    the background of the scene will be set to ``WHITE``.  This applies regardless
    of where the manim command is invoked from.

    Command line arguments override ``.cfg`` files.  In the previous example,
    executing

    .. code-block:: bash

        manim scene.py -c BLUE

    will set the background color to BLUE, regardless of the contents of
    ``manim.cfg``.

    Finally, any programmatic changes made within the scene script itself will
    override the command line arguments.  For example, if ``scene.py`` contains
    the following

    .. code-block:: python

        from manim import *

        config.background_color = RED


        class MyScene(Scene): ...

    the background color will be set to RED, regardless of the contents of
    ``manim.cfg`` or the CLI arguments used when invoking manim.

    >A   seedformatdry_runlog_dirpluginspreviewrC   tex_dirrenderertext_dirzero_pad	media_dir	save_pngs	verbosity	video_dir	write_all
assets_dir
enable_gui
frame_rate
fullscreen
images_dir
input_fileflush_cacheframe_widthlog_to_filemedia_embedmedia_widthoutput_filepixel_widthsave_as_gifscene_nameswindow_sizeforce_windowframe_heightgui_locationpixel_heightprogress_barsections_dirtex_templatesave_sectionscustom_foldersframe_x_radiusframe_y_radiuswindow_monitorwrite_to_moviedisable_cachingffmpeg_loglevelpreview_commandsave_last_framewindow_positionbackground_colorenable_wireframemax_files_cachedno_latex_cleanuppartial_movie_dirtex_template_filebackground_opacitymovie_file_extensionshow_in_file_browserfrom_animation_numberupto_animation_numberdisable_caching_warningnotify_outdated_versionuse_projection_fill_shadersuse_projection_stroke_shadersr   Nonec                N    t                               | j                  | _        d S N)dictfromkeys_OPTS_dselfs    r*   __init__zManimConfig.__init__I  s    )-tz)B)Br+   Iterator[str]c                *    t          | j                  S r   )iterr   r   s    r*   __iter__zManimConfig.__iter__M  s    DG}}r+   intc                *    t          | j                  S r   )lenr   r   s    r*   __len__zManimConfig.__len__P  s    47||r+   keyobjectboolc                    	 t          |t                    sJ |                     |           dS # t          $ r Y dS w xY w)NTF)
isinstancer>   __getitem__AttributeErrorr   r   s     r*   __contains__zManimConfig.__contains__S  sX    	c3'''''S!!!4 	 	 	55	s   ,0 
>>r>   r	   c                "    t          | |          S r   )getattrr   s     r*   r   zManimConfig.__getitem__[  s    tS!!!r+   valc                X    t          t          |                              | |           d S r   )r   r   fsetr   r   r   s      r*   __setitem__zManimConfig.__setitem__^  s(    S!!&&tS11111r+   objManimConfig | dict[str, Any]c                    t          |t                    r6 j                            |j                   |j        r|j         _        dS dS t          |t
                    r~ fd|                                D             }|                                D ]
\  }}| |<    fd|                                D             }|                                D ]\  }}| |<   dS dS )a  Digest the options found in another :class:`ManimConfig` or in a dict.

        Similar to :meth:`dict.update`, replaces the values of this object with
        those of ``obj``.

        Parameters
        ----------
        obj
            The object to copy values from.

        Returns
        -------
        None

        Raises
        -----
        :class:`AttributeError`
            If ``obj`` is a dict but contains keys that do not belong to any
            config options.

        See Also
        --------
        :meth:`~ManimConfig.digest_file`, :meth:`~ManimConfig.digest_args`,
        :meth:`~ManimConfig.digest_parser`

        c                .    i | ]\  }}|j         v ||S  r   .0kvr   s      r*   
<dictcomp>z&ManimConfig.update.<locals>.<dictcomp>  s&    BBBdaQ$'\\Q\\\r+   c                .    i | ]\  }}|j         v||S r   r   r   s      r*   r   z&ManimConfig.update.<locals>.<dictcomp>  s+    FFFdaQdg5E5EQ5E5E5Er+   N)r   r   r   updaterl   r   rB   )r   r   _dictr   r   s   `    r*   r   zManimConfig.updatea  s	   6 c;'' 	GNN36""" 5$'$4!!!5 5 T"" 	BBBBciikkBBBE  1QFFFFciikkFFFE  1Q	 	 r+   r   c                     t          d          Nz3'ManimConfig' object does not support item deletionr   r   s     r*   __delitem__zManimConfig.__delitem__      RSSSr+   c                     t          d          r   r   r   s     r*   __delattr__zManimConfig.__delattr__  r   r+   r   c                *    t          j        |           S )aN  Deepcopy the contents of this ManimConfig.

        Returns
        -------
        :class:`ManimConfig`
            A copy of this object containing no shared references.

        See Also
        --------
        :func:`tempconfig`

        Notes
        -----
        This is the main mechanism behind :func:`tempconfig`.

        copydeepcopyr   s    r*   r   zManimConfig.copy  s    " }T"""r+   c                *    t          j        |           S zSee ManimConfig.copy().r   r   s    r*   __copy__zManimConfig.__copy__  s    }T"""r+   memodict[str, Any]c                r     t          |                       }t          j        | j        |          |_        |S r   )typer   r   r   )r   r   cs      r*   __deepcopy__zManimConfig.__deepcopy__  s/    DJJLL }TWd++r+   rD   	list[Any]c                R    ||v r|| j         |<   dS t          d| d| d|           )z=Set ``key`` to ``val`` if ``val`` is contained in ``values``.zattempted to set z to z; must be in Nr   
ValueError)r   r   r   rD   s       r*   _set_from_listzManimConfig._set_from_list  sA    &==DGCLLLTTT#TTFTTUUUr+   
enum_value
enum_classr   c                ,     ||          | j         |<   dS )a  Set ``key`` to the enum object with value ``enum_value`` in the given
        ``enum_class``.

        Tests::

            >>> from enum import Enum
            >>> class Fruit(Enum):
            ...     APPLE = 1
            ...     BANANA = 2
            ...     CANTALOUPE = 3
            >>> test_config = ManimConfig()
            >>> test_config._set_from_enum("fruit", 1, Fruit)
            >>> test_config._d['fruit']
            <Fruit.APPLE: 1>
            >>> test_config._set_from_enum("fruit", Fruit.BANANA, Fruit)
            >>> test_config._d['fruit']
            <Fruit.BANANA: 2>
            >>> test_config._set_from_enum("fruit", 42, Fruit)
            Traceback (most recent call last):
            ...
            ValueError: 42 is not a valid Fruit
        Nr   )r   r   r   r   s       r*   _set_from_enumzManimConfig._set_from_enum  s    . "z*--r+   c                F    |dv r|| j         |<   dS t          | d          )z-Set ``key`` to ``val`` if ``val`` is Boolean.)TFz must be booleanNr   r   s      r*   _set_booleanzManimConfig._set_boolean  s3    -DGCLLL555666r+   
tuple[Any]c                h    t          |t                    r|| j        |<   d S t          | d          )Nz must be tuple)r   tupler   r   r   s      r*   
_set_tuplezManimConfig._set_tuple  s:    c5!! 	5DGCLLL333444r+   c                    t          |t                    r|| j        |<   dS |sd| j        |<   dS t          | d          )z.Set ``key`` to ``val`` if ``val`` is a string. z must be str or falsy valueN)r   r>   r   r   r   s      r*   _set_strzManimConfig._set_str  sS    c3 	BDGCLLL 	BDGCLLL@@@AAAr+   floatlohic           	     n    ||cxk    r|k    rn n|| j         |<   dS t          | d| d| d|           )*Set ``key`` to ``val`` if lo <= val <= hi.z	 must be  <= Nr   r   r   r   r   r   s        r*   _set_betweenzManimConfig._set_between  sV    ?????????DGCLLLCCbCCcCCrCCDDDr+   c           	     n    ||cxk    r|k    rn n|| j         |<   dS t          | d| d| d|           )r   z must be an integer such that r   Nr   r   s        r*   _set_int_betweenzManimConfig._set_int_between  s]    ?????????DGCLLLKKbKKcKKrKK  r+   	allow_infc                    t          |t                    r|dk    r|| j        |<   dS |r,|dt          d          fv rt          d          | j        |<   dS t	          | d          )z8Set ``key`` to ``val`` if ``val`` is a positive integer.infz5 must be a non-negative integer (use -1 for infinity)N)r   r   r   r   r   )r   r   r   r   s       r*   _set_pos_numberzManimConfig._set_pos_number  s{    c3 	C"HHDGCLLL 	32uU||"444 <<DGCLLLMMM  r+   c                ~    d}t          | j                                        d           D ]\  }}|| d| dz  }|S )Nr   c                    | d         S )Nr   r   )xs    r*   <lambda>z&ManimConfig.__repr__.<locals>.<lambda>  s
    !A$ r+   )r   z: z, )sortedr   rB   )r   repr   r   s       r*   __repr__zManimConfig.__repr__  sP    47==????? 	! 	!DAqa==1=== CC
r+   r8   r.   c           
        || _         dD ].}t          | ||d                             |d                     /dD ],}t          | ||d                             |                     -dD ]/}t          | ||d                             |dd	                     0d
D ],}t          | ||d                             |                     -t          t          t          t          j
        d|d         d                                       }|| _        |d         d         }|dk    r=t          t          t          t          j
        d|                              }|| _        n|| _        |d                             ddd	          }||dk    rg n|
                    d          }|| _        |d                             dd          | d<   |d                             dd          }|| d         | d         z  | d<   n|| d<   |d                             d          }	|	rt          |	          | _        |d                             d          }
|
r|
| _        |d                             d          }|r|| _        	 |d                             d          }n# t$          $ r d}Y nw xY w|| _        |d                             d          }|r|| _        |d                             ddd	          }|rt+          |          | _        | S )a  Process the config options present in a :class:`ConfigParser` object.

        This method processes arbitrary parsers, not only those read from a
        single file, whereas :meth:`~ManimConfig.digest_file` can only process one
        file at a time.

        Parameters
        ----------
        parser
            An object reflecting the contents of one or many ``.cfg`` files.  In
            particular, it may reflect the contents of multiple files that have
            been parsed in a cascading fashion.

        Returns
        -------
        self : :class:`ManimConfig`
            This object, after processing the contents of ``parser``.

        See Also
        --------
        :func:`make_config_parser`, :meth:`~.ManimConfig.digest_file`,
        :meth:`~.ManimConfig.digest_args`,

        Notes
        -----
        If there are multiple ``.cfg`` files to process, it is always more
        efficient to parse them into a single :class:`ConfigParser` object
        first, and then call this function once (instead of calling
        :meth:`~.ManimConfig.digest_file` multiple times).

        Examples
        --------
        To digest the config options set in two files, first create a
        ConfigParser and parse both files and then digest the parser:

        .. code-block:: python

            parser = configparser.ConfigParser()
            parser.read([file1, file2])
            config = ManimConfig().digest_parser(parser)

        In fact, the global ``config`` object is initialized like so:

        .. code-block:: python

            parser = make_config_parser()
            config = ManimConfig().digest_parser(parser)

        )r   rr   rv   rU   rR   rc   rm   rL   r   r^   rs   r   r\   rn   rW   rY   r   r   ry   rf   r{   rI   CLIF)fallback)r   r   rz   ri   rb   rG   rq   rP   )rV   rS   rQ   rJ   rT   rk   rZ   rO   rM   r|   r[   ra   r   rx   rN   rw   ru   r   T)r   raw)r~   rX   z[;,\-]rh   re   defaultrK   N,rg   g       @r]   aspect_ratior}   rj   ffmpeglogleveljupyterr_   r`   rC   )_parsersetattr
getbooleangetintgetgetfloatr   mapr   resplitrh   re   rK   r   r}   rj   rt   r   r_   r`   rE   rC   )r   r8   r   rh   re   window_size_numbersrK   plugin_listwidthr}   rj   rt   r_   r`   rC   s                  r*   digest_parserzManimConfig.digest_parser  sq   d 
 	N 	NC0 D#ve}77e7LLMMMM

 	: 	:C D#ve}33C889999
 	N 	NC& D#ve}00rt0LLMMMM
 	< 	<C D#ve}55c::;;;; RXi~)FGGHH
 
 )Um
 )##"'C)[1Q1Q(R(R"S"S2D*D -##I#EE#Ow"}}bb'--PSBTBT"%e}55ncJJ^u&&}d;;="&~"6n9M"MD"'D #5M--.ABB 	=%)*;%<%<D"e}((88 	- ,D *..z:: 	3#2D 	 +66}EEKK 	 	 	KKK	&Y'++M:: 	+*D-##I#EE 	7-g66DLs   >J J)(J)argsargparse.Namespacec                >   |j         j        dk    r|j         |_        t          |j                   dk    r|j         | _        |j        r|                     |j                   | j        s+t          |j                                                   | _        |j        |j        ng | _        |j	        | _	        dD ])}t          ||          rt          ||          }||| |<   *dD ])}t          ||          rt          ||          }||| |<   *| d         rd| d<   |j        }|rP|d	         | _        	 |d
         | _        n4# t          $ r' t                              d|d	          d           Y nw xY wt#          t          |dd                    | _        |j        }|r4t)          |d	                   | _        t)          |d
                   | _        |j        }|rt1          |          | _        |j        rMdD ]'}| j        d                             |d          | |<   (t          |d          r|j        r|j        | _        |j        rt=          j        |j                  | _        | j         tB          j"        k    r|j#        d| d<   |j$        |j$        | _$        | S )a  Process the config options present in CLI arguments.

        Parameters
        ----------
        args
            An object returned by :func:`.main_utils.parse_args()`.

        Returns
        -------
        self : :class:`ManimConfig`
            This object, after processing the contents of ``parser``.

        See Also
        --------
        :func:`.main_utils.parse_args()`, :meth:`~.ManimConfig.digest_parser`,
        :meth:`~.ManimConfig.digest_file`

        Notes
        -----
        If ``args.config_file`` is a non-empty string, ``ManimConfig`` tries to digest the
        contents of said file with :meth:`~ManimConfig.digest_file` before
        digesting any other CLI arguments.

        z.cfg-N)r   rL   r   rr   rv   rR   rc   rm   rU   rs   rH   r\   rj   transparentrd   rS   rN   rx   rW   rY   r   r   rP   ry   rf   rI   r{   ru   rG   )rQ   rJ   r^   rv   Frr   r      z;No end scene number specified in -n option. Rendering from z onwards...rC   )rQ   rT   rk   rZ   rO   rM   rJ   r|   rn   T)r   rQ   )%r9   suffixconfig_filer>   r[   digest_filer   absoluterd   ra   hasattrr   r   r   	Exceptionr2   r3   rE   rC   
resolutionr   rb   ri   rX   r   rn   r   r  rQ   rl   r   	from_filerN   r   OPENGLrr   rh   )r   r
  r   attrnflagrflagfpsopts           r*   digest_argszManimConfig.digest_args  s   4 9v%%#yD ty>>S  "iDO  	/T-...  	9"49oo6688DO/3/?/K4++QS+
 $	% $	%C> tS!! %tS)) # $DI
 
	% 
	%C
 tS!! %tS)) # $DI!" 	+%*D!" * 	).qD&-21X**   gRWXYRZggg     *'$	4*H*HII  	."58}}D #E!HDo 	)#CjjDO  	0	 
N 
N !L)9:>>s>MMS		t[)) 0dn 0!%  	I + 5d6G H HD=L///D4G4O%*D!" ( $ 1Ds   1D? ?.E0/E0filenamer   c                    t          |                                          s(t          t          j        dt          |                    |                     t          |                    S )a  Process the config options present in a ``.cfg`` file.

        This method processes a single ``.cfg`` file, whereas
        :meth:`~ManimConfig.digest_parser` can process arbitrary parsers, built
        perhaps from multiple ``.cfg`` files.

        Parameters
        ----------
        filename
            Path to the ``.cfg`` file.

        Returns
        -------
        self : :class:`ManimConfig`
            This object, after processing the contents of ``filename``.

        See Also
        --------
        :meth:`~ManimConfig.digest_file`, :meth:`~ManimConfig.digest_args`,
        :func:`make_config_parser`

        Notes
        -----
        If there are multiple ``.cfg`` files to process, it is always more
        efficient to parse them into a single :class:`ConfigParser` object
        first and digesting them with one call to
        :meth:`~ManimConfig.digest_parser`, instead of calling this method
        multiple times.

        z8Error: --config_file could not find a valid config file.)r   is_fileFileNotFoundErrorerrnoENOENTr>   r	  r   )r   r  s     r*   r  zManimConfig.digest_file[  s`    > H~~%%'' 	#JH   !!"4X">">???r+   c                6    | j         d         p| j         d         S )z(Whether to play the rendered movie (-p).rL   rW   r   r   s    r*   rL   zManimConfig.preview  s     wy!:TW\%::r+   valuec                2    |                      d|           d S )NrL   r   r   r&  s     r*   rL   zManimConfig.preview  s    )U+++++r+   c                    | j         d         S )z9Whether to show the output file in the file browser (-f).r   r   r   s    r*   r   z ManimConfig.show_in_file_browser       w-..r+   c                2    |                      d|           d S )Nr   r(  r)  s     r*   r   z ManimConfig.show_in_file_browser  s    0%88888r+   c                    | j         d         S )z9Whether to show progress bars while rendering animations.rj   r   r   s    r*   rj   zManimConfig.progress_bar       w~&&r+   c                8    |                      d|g d           d S )Nrj   )nonedisplayleaver   r)  s     r*   rj   zManimConfig.progress_bar  s'    NE3O3O3OPPPPPr+   c                    | j         d         S )zWhether to save logs to a file.r^   r   r   s    r*   r^   zManimConfig.log_to_file       w}%%r+   c                2    |                      d|           d S )Nr^   r(  r)  s     r*   r^   zManimConfig.log_to_file      -/////r+   c                    | j         d         S )z9Whether to notify if there is a version update available.r   r   r   s    r*   r   z#ManimConfig.notify_outdated_version       w011r+   c                2    |                      d|           d S )Nr   r(  r)  s     r*   r   z#ManimConfig.notify_outdated_version      3U;;;;;r+   c                    | j         d         S )z1Whether to render the scene to a movie file (-w).rr   r   r   s    r*   rr   zManimConfig.write_to_movie       w'((r+   c                2    |                      d|           d S )Nrr   r(  r)  s     r*   rr   zManimConfig.write_to_movie  s    *E22222r+   c                    | j         d         S )zBWhether to save the last frame of the scene as an image file (-s).rv   r   r   s    r*   rv   zManimConfig.save_last_frame       w())r+   c                2    |                      d|           d S )Nrv   r(  r)  s     r*   rv   zManimConfig.save_last_frame      +U33333r+   c                    | j         d         S )z4Whether to render all scenes in the input file (-a).rU   r   r   s    r*   rU   zManimConfig.write_all       w{##r+   c                2    |                      d|           d S )NrU   r(  r)  s     r*   rU   zManimConfig.write_all      +u-----r+   c                    | j         d         S )z=Whether to save all frames in the scene as images files (-g).rR   r   r   s    r*   rR   zManimConfig.save_pngs  rD  r+   c                2    |                      d|           d S )NrR   r(  r)  s     r*   rR   zManimConfig.save_pngs  rF  r+   c                    | j         d         S )z7Whether to save the rendered scene in .gif format (-i).rc   r   r   s    r*   rc   zManimConfig.save_as_gif  r5  r+   c                2    |                      d|           d S )Nrc   r(  r)  s     r*   rc   zManimConfig.save_as_gif  r7  r+   c                    | j         d         S )zMWhether to save single videos for each section in addition to the movie file.rm   r   r   s    r*   rm   zManimConfig.save_sections  s     w''r+   c                2    |                      d|           d S )Nrm   r(  r)  s     r*   rm   zManimConfig.save_sections  s    /511111r+   c                    | j         d         S )z5Whether to enable wireframe debugging mode in opengl.ry   r   r   s    r*   ry   zManimConfig.enable_wireframe       w)**r+   c                2    |                      d|           d S )Nry   r(  r)  s     r*   ry   zManimConfig.enable_wireframe      ,e44444r+   c                    | j         d         S )z7Whether to force window when using the opengl renderer.rf   r   r   s    r*   rf   zManimConfig.force_window  r.  r+   c                2    |                      d|           d S )Nrf   r(  r)  s     r*   rf   zManimConfig.force_window  s    .%00000r+   c                    | j         d         S )zLPrevents deletion of .aux, .dvi, and .log files produced by Tex and MathTex.r{   r   r   s    r*   r{   zManimConfig.no_latex_cleanup  rN  r+   c                2    |                      d|           d S )Nr{   r(  r)  s     r*   r{   zManimConfig.no_latex_cleanup  rP  r+   c                    | j         d         S Nru   r   r   s    r*   ru   zManimConfig.preview_command  s    w())r+   c                2    |                      d|           d S rV  r   r)  s     r*   ru   zManimConfig.preview_command  s    '/////r+   c                    | j         d         S )zJLogger verbosity; "DEBUG", "INFO", "WARNING", "ERROR", or "CRITICAL" (-v).rS   r   r   s    r*   rS   zManimConfig.verbosity  rD  r+   c                l    |                      d|g d           t                              |           d S )NrS   DEBUGINFOWARNINGERRORCRITICAL)r   r2   setLevelr   r   s     r*   rS   zManimConfig.verbosity  sC    ===	
 	
 	

 	r+   r=   c                    | j         d         S )z2File format; "png", "gif", "mp4", "webm" or "mov".rH   r   r   s    r*   rH   zManimConfig.format  s     wx  r+   c                    |                      d|g d           |                     | j                   | j        dk    rt                              d           d S d S )NrH   )Npnggifmp4movwebmri  z@Output format set as webm, this can be slower than other formats)r   resolve_movie_file_extensionr  rH   r2   warningrb  s     r*   rH   zManimConfig.format  sz    666	
 	
 	

 	))$*:;;;;&  NNR     ! r+   c                    | j         d         S )z$Verbosity level of ffmpeg (no flag).rt   r   r   s    r*   rt   zManimConfig.ffmpeg_loglevel+  r@  r+   c                    |                      d|g d           t          j        d                              | j                   d S )Nrt   r[  libav)r   logging	getLoggerra  rt   rb  s     r*   rt   zManimConfig.ffmpeg_loglevel0  sS    ===	
 	
 	

 	'""++D,@AAAAAr+   bool | Nonec                    | j         d         S )z,Whether to embed videos in Jupyter notebook.r_   r   r   s    r*   r_   zManimConfig.media_embed9  r5  r+   c                2    |                      d|           d S )Nr_   r(  r)  s     r*   r_   zManimConfig.media_embed>  r7  r+   c                    | j         d         S )z Media width in Jupyter notebook.r`   r   r   s    r*   r`   zManimConfig.media_widthB  r5  r+   c                2    |                      d|           d S )Nr`   rX  r)  s     r*   r`   zManimConfig.media_widthG      mU+++++r+   c                    | j         d         S )z)Frame width in pixels (--resolution, -r).rb   r   r   s    r*   rb   zManimConfig.pixel_widthK  r5  r+   c                4    |                      d|d           d S )Nrb   Fr   r)  s     r*   rb   zManimConfig.pixel_widthP  s     ]E599999r+   c                    | j         d         S )z*Frame height in pixels (--resolution, -r).ri   r   r   s    r*   ri   zManimConfig.pixel_heightT  r.  r+   c                4    |                      d|d           d S )Nri   Fry  r)  s     r*   ri   zManimConfig.pixel_heightY  s     ^UE:::::r+   c                    t          | j        d         t                    sJ t          | j        d         t                    sJ | j        d         | j        d         z  S )z;Aspect ratio (width / height) in pixels (--resolution, -r).rb   ri   )r   r   r   r   s    r*   r   zManimConfig.aspect_ratio]  sW     $'-0#66666$'.1377777w}%(???r+   c                    | j         d         S )z(Frame height in logical units (no flag).rg   r   r   s    r*   rg   zManimConfig.frame_heightd  r.  r+   c                <    | j                             d|           d S )Nrg   r   r   r)  s     r*   rg   zManimConfig.frame_heighti  s     NE22222r+   c                    | j         d         S )z'Frame width in logical units (no flag).r]   r   r   s    r*   r]   zManimConfig.frame_widthm  r5  r+   c                <    | j                             d|           d S )Nr]   r  r)  s     r*   r]   zManimConfig.frame_widthr       M511111r+   c                "    | j         d         dz  S )z Half the frame height (no flag).rg      r   r   s    r*   rp   zManimConfig.frame_y_radiusv  s     w~&**r+   c                ~    | j                             d|          p | j                             dd|z             d S  d S )Nrp   rg   r  r  r)  s     r*   rp   zManimConfig.frame_y_radius{  sX    ,e44 	
8K8KAI9
 9
 9
 9
 9
 	
 	
 	
r+   c                "    | j         d         dz  S )zHalf the frame width (no flag).r]   r  r   r   s    r*   ro   zManimConfig.frame_x_radius  s     w}%))r+   c                ~    | j                             d|          p | j                             dd|z             d S  d S )Nro   r]   r  r  r)  s     r*   ro   zManimConfig.frame_x_radius  sX    ,e44 	
8K8K1u99
 9
 9
 9
 9
 	
 	
 	
r+   r   c                *    | j         t          j        z  S )z*Coordinate at the center top of the frame.)rp   r   UPr   s    r*   topzManimConfig.top  s     "Y\11r+   c                *    | j         t          j        z  S )z-Coordinate at the center bottom of the frame.)rp   r   DOWNr   s    r*   bottomzManimConfig.bottom       "Y^33r+   c                *    | j         t          j        z  S )z+Coordinate at the middle left of the frame.)ro   r   LEFTr   s    r*   	left_sidezManimConfig.left_side  r  r+   c                *    | j         t          j        z  S )z,Coordinate at the middle right of the frame.)ro   r   RIGHTr   s    r*   
right_sidezManimConfig.right_side  s     "Y_44r+   c                    | j         d         S )z Frame rate in frames per second.rX   r   r   s    r*   rX   zManimConfig.frame_rate       w|$$r+   c                <    | j                             d|           d S )NrX   r  r)  s     r*   rX   zManimConfig.frame_rate  s     L%00000r+   r   c                    | j         d         S )z#Background color of the scene (-c).rx   r   r   s    r*   rx   zManimConfig.background_color  rN  r+   c                V    | j                             dt          |                     d S )Nrx   )r   r   r   r)  s     r*   rx   zManimConfig.background_color  s)    .
50A0ABBBBBr+   c                    | j         d         S )z/Start rendering animations at this number (-n).r   r   r   s    r*   r   z!ManimConfig.from_animation_number       w.//r+   c                <    | j                             d|           d S )Nr   r  r)  s     r*   r   z!ManimConfig.from_animation_number  s!    3U;;;;;r+   c                    | j         d         S )zHStop rendering animations at this number. Use -1 to avoid skipping (-n).r   r   r   s    r*   r   z!ManimConfig.upto_animation_number  r  r+   c                4    |                      d|d           d S )Nr   Try  r)  s     r*   r   z!ManimConfig.upto_animation_number  s!    4eTBBBBBr+   c                    | j         d         S )z?Maximum number of files cached.  Use -1 for infinity (no flag).rz   r   r   s    r*   rz   zManimConfig.max_files_cached  rN  r+   c                4    |                      d|d           d S )Nrz   Try  r)  s     r*   rz   zManimConfig.max_files_cached  s!    /=====r+   c                    | j         d         S )z0The monitor on which the scene will be rendered.rq   r   r   s    r*   rq   zManimConfig.window_monitor  r=  r+   c                4    |                      d|d           d S )Nrq   Try  r)  s     r*   rq   zManimConfig.window_monitor  s!    -ud;;;;;r+   c                    | j         d         S )z5Whether to delete all the cached partial movie files.r\   r   r   s    r*   r\   zManimConfig.flush_cache  r5  r+   c                2    |                      d|           d S )Nr\   r(  r)  s     r*   r\   zManimConfig.flush_cache  r7  r+   c                    | j         d         S )zWhether to use scene caching.rs   r   r   s    r*   rs   zManimConfig.disable_caching  r@  r+   c                2    |                      d|           d S )Nrs   r(  r)  s     r*   rs   zManimConfig.disable_caching  rB  r+   c                    | j         d         S )zFWhether a warning is raised if there are too much submobjects to hash.r   r   r   s    r*   r   z#ManimConfig.disable_caching_warning  r9  r+   c                2    |                      d|           d S )Nr   r(  r)  s     r*   r   z#ManimConfig.disable_caching_warning  r;  r+   c                    | j         d         S )zEither .mp4, .webm or .mov.r   r   r   s    r*   r   z ManimConfig.movie_file_extension  r+  r+   c                8    |                      d|g d           d S )Nr   ).mp4.mov.webmr3  r)  s     r*   r   z ManimConfig.movie_file_extension  s(    2E;T;T;TUUUUUr+   c                    | j         d         S )z@A number between 0.0 (fully transparent) and 1.0 (fully opaque).r~   r   r   s    r*   r~   zManimConfig.background_opacity  s     w+,,r+   c                |    |                      d|dd           | j        dk     r|                     d           d S d S )Nr~   r   r  T)is_transparent)r   r~   rj  r)  s     r*   r~   zManimConfig.background_opacity   sP    .q!<<<"Q&&--T-BBBBB '&r+   tuple[int, int]c                6    | j         d         | j         d         fS )z1Tuple with (pixel width, pixel height) (no flag).rb   ri   r   r   s    r*   
frame_sizezManimConfig.frame_size  s     &(?@@r+   c                    | j                             d|d                   p#| j                             d|d                    d S  d S )Nrb   r   ri   r  r  r)  s     r*   r  zManimConfig.frame_size  s[    M5844 	
8K8KE!H9
 9
 9
 9
 9
 	
 	
 	
r+   c                     g d} fd|D             t           j        D ]"t          fd|D                       rc S #dS )zVideo quality (-q).)rb   ri   rX   c                "    i | ]}||         S r   r   r   r   r   s     r*   r   z'ManimConfig.quality.<locals>.<dictcomp>  s    &&&AQQ&&&r+   c              3  \   K   | ]&}|         t           j                 |         k    V  'd S r   )r   rA   )r   r   qr<   s     r*   	<genexpr>z&ManimConfig.quality.<locals>.<genexpr>  s9      FFA1Q49.t4Q77FFFFFFr+   N)r   rA   all)r   keysr  r<   s   ` @@r*   rC   zManimConfig.quality  sx     =<<&&&&&&&' 	 	DFFFFFFFFFF tr+   c                   |d S |t           j        vr;t          dt          t           j                                                             t           j        |         }|d         |d         f| _        |d         | _        d S )Nzquality must be one of rb   ri   rX   )r   rA   KeyErrorlistr  r  rX   )r   r&  r  s      r*   rC   zManimConfig.quality  sz    =F	+++WT):M:R:R:T:T5U5UWWXXX&M*An,==L/r+   c                h    t          | j        d         t                    sJ | j        d         dk     S )z5Whether the background opacity is less than 1.0 (-t).r~         ?)r   r   r   r   s    r*   r  zManimConfig.transparent%  s5     $'"67?????w+,s22r+   c                `    t          |           | j        d<   |                     |           d S )Nr~   )r   r   rj  r)  s     r*   r  zManimConfig.transparent+  s3    (-%i(8(8$%))%00000r+   c                    | j         d         S )zWhether dry run is enabled.rI   r   r   s    r*   rI   zManimConfig.dry_run0       wy!!r+   c                Z    || j         d<   |rd| _        d| _        d| _        d | _        d S d S )NrI   F)r   rr   rU   rv   rH   rb  s     r*   rI   zManimConfig.dry_run5  sB     	 	"'D"DN#(D DKKK		 	r+   r   c                    | j         d         S )a  The currently active renderer.

        Populated with one of the available renderers in :class:`.RendererType`.

        Tests::

            >>> test_config = ManimConfig()
            >>> test_config.renderer is None  # a new ManimConfig is unpopulated
            True
            >>> test_config.renderer = 'opengl'
            >>> test_config.renderer
            <RendererType.OPENGL: 'opengl'>
            >>> test_config.renderer = 42
            Traceback (most recent call last):
            ...
            ValueError: 42 is not a valid RendererType

        Check that capitalization of renderer types is irrelevant::

            >>> test_config.renderer = 'OpenGL'
            >>> test_config.renderer = 'cAirO'
        rN   r   r   s    r*   rN   zManimConfig.renderer>  s    0 wz""r+   str | RendererTypec                  	 t          |t                    r|                                }t          |          }	 ddlm} ddlm} ddlm	} ddl
m} ddlm} |j        D ]D}|t          j        k    r||||i	n||||i	t!          	fd|j        D                       |_        En# t$          $ r Y nw xY w|                     d	|t                     d
S )zThe setter of the renderer property.

        Takes care of switching inheritance bases using the
        :class:`.ConvertToOpenGL` metaclass.
        r   )ConvertToOpenGL)OpenGLMobject)OpenGLVMobjectr  )Mobject)VMobjectc              3  D   K   | ]}                     ||          V  d S r   )r  )r   baseconversion_dicts     r*   r  z'ManimConfig.renderer.<locals>.<genexpr>v  sD       & &8<O''d33& & & & & &r+   rN   N)r   r>   lowerr   )manim.mobject.opengl.opengl_compatibilityr  #manim.mobject.opengl.opengl_mobjectr  .manim.mobject.opengl.opengl_vectorized_mobjectr  mobject.mobjectr   mobject.types.vectorized_mobjectr  _converted_classesr  r   	__bases__ImportErrorr   )
r   r&  rN   r  r  r  r  r  clsr  s
            @r*   rN   zManimConfig.rendererX  s\    eS!! 	"KKMME&&	QQQQQQIIIIIIUUUUUU111111CCCCCC&9  |222 .'OO &w&'O
 !& & & & &@C& & & ! !  	 	 	 D	 	J,?????s   A*B& &
B32B3c                    | j         d         S )z8Main output directory.  See :meth:`ManimConfig.get_dir`.rQ   r   r   s    r*   rQ   zManimConfig.media_dir  rD  r+   
str | Pathc                2    |                      d|           d S )NrQ   _set_dirr)  s     r*   rQ   zManimConfig.media_dir      k5)))))r+   c                    | j         d         S )zSet the position of preview window. You can use directions, e.g. UL/DR/ORIGIN/LEFT...or the position(pixel) of the upper left corner of the window, e.g. '960,540'.rw   r   r   s    r*   rw   zManimConfig.window_position  r@  r+   c                <    | j                             d|           d S )Nrw   r  r)  s     r*   rw   zManimConfig.window_position  s!    -u55555r+   str | tuple[int, ...]c                    | j         d         S )zhThe size of the opengl window. 'default' to automatically scale the window based on the display monitor.re   r   r   s    r*   re   zManimConfig.window_size  r5  r+   c                <    | j                             d|           d S )Nre   r  r)  s     r*   re   zManimConfig.window_size  r  r+   r  c                    | j         }|r| j        dk    rdnd| _         n-| j        dk    rd| _         n| j        dk    rd| _         nd| _         | j         |k    r%t                              d| j          d           d S d S )Nri  r  r  rh  r  zOutput format changed to 'z' to support transparency)r   rH   r2   rk  )r   r  prev_file_extensions      r*   rj  z(ManimConfig.resolve_movie_file_extension  s    "7 	/37;&3H3HfD%%[F""(/D%%[E!!(.D%%(.D%$(;;;NN*T-F * * *     <;r+   c                    | j         d         S )zEnable GUI interaction.rW   r   r   s    r*   rW   zManimConfig.enable_gui  r  r+   c                2    |                      d|           d S )NrW   r(  r)  s     r*   rW   zManimConfig.enable_gui      ,.....r+   tuple[int, ...]c                    | j         d         S )zULocation parameters for the GUI window (e.g., screen coordinates or layout settings).rh   r   r   s    r*   rh   zManimConfig.gui_location  r.  r+   c                2    |                      d|           d S )Nrh   )r   r)  s     r*   rh   zManimConfig.gui_location  s    .....r+   c                    | j         d         S )z/Expand the window to its maximum possible size.rY   r   r   s    r*   rY   zManimConfig.fullscreen  r  r+   c                2    |                      d|           d S )NrY   r(  r)  s     r*   rY   zManimConfig.fullscreen  r  r+   c                    | j         d         S )zVUse shaders for OpenGLVMobject fill which are compatible with transformation matrices.r   r   r   s    r*   r   z'ManimConfig.use_projection_fill_shaders  s     w455r+   c                2    |                      d|           d S )Nr   r(  r)  s     r*   r   z'ManimConfig.use_projection_fill_shaders  s    7?????r+   c                    | j         d         S )zXUse shaders for OpenGLVMobject stroke which are compatible with transformation matrices.r   r   r   s    r*   r   z)ManimConfig.use_projection_stroke_shaders  s     w677r+   c                2    |                      d|           d S )Nr   r(  r)  s     r*   r   z)ManimConfig.use_projection_stroke_shaders  s    95AAAAAr+   c                    | j         d         S )zQPNG zero padding. A number between 0 (no zero padding) and 9 (9 columns minimum).rP   r   r   s    r*   rP   zManimConfig.zero_pad       wz""r+   c                6    |                      d|dd           d S )NrP   r   	   )r   r)  s     r*   rP   zManimConfig.zero_pad  s"    j%A66666r+   kwargsr   c                
    g d}||vrt          d          |                    |            fd|D             }|                    |            j         d j        d|d<    j        |         }t          |t                    sJ d|v rd	  |j        di |}nQ# t           $ rD}t          | d j        |          d	d
z   d	                    |j
                  z             |d}~ww xY wd|v d|rt          |          ndS )a  Resolve a config option that stores a directory.

        Config options that store directories may depend on one another.  This
        method is used to provide the actual directory to the end user.

        Parameters
        ----------
        key
            The config option to be resolved.  Must be an option ending in
            ``'_dir'``, for example ``'media_dir'`` or ``'video_dir'``.

        kwargs
            Any strings to be used when resolving the directory.

        Returns
        -------
        :class:`pathlib.Path`
            Path to the requested directory.  If the path resolves to the empty
            string, return ``None`` instead.

        Raises
        ------
        :class:`KeyError`
            When ``key`` is not a config option that stores a directory and
            thus :meth:`~ManimConfig.get_dir` is not appropriate; or when
            ``key`` is appropriate but there is not enough information to
            resolve the directory.

        Notes
        -----
        Standard :meth:`str.format` syntax is used to resolve the paths so the
        paths may contain arbitrary placeholders using f-string notation.
        However, these will require ``kwargs`` to contain the required values.

        Examples
        --------

        The value of ``config.tex_dir`` is ``'{media_dir}/Tex'`` by default,
        i.e. it is a subfolder of wherever ``config.media_dir`` is located.  In
        order to get the *actual* directory, use :meth:`~ManimConfig.get_dir`.

        .. code-block:: pycon

            >>> from manim import config as globalconfig
            >>> config = globalconfig.copy()
            >>> config.tex_dir
            '{media_dir}/Tex'
            >>> config.media_dir
            './media'
            >>> config.get_dir("tex_dir").as_posix()
            'media/Tex'

        Resolving directories is done in a lazy way, at the last possible
        moment, to reflect any changes in other config options:

        .. code-block:: pycon

            >>> config.media_dir = "my_media_dir"
            >>> config.get_dir("tex_dir").as_posix()
            'my_media_dir/Tex'

        Some directories depend on information that is not available to
        :class:`ManimConfig`. For example, the default value of `video_dir`
        includes the name of the input file and the video quality
        (e.g. 480p15). This informamtion has to be supplied via ``kwargs``:

        .. code-block:: pycon

            >>> config.video_dir
            '{media_dir}/videos/{module_name}/{quality}'
            >>> config.get_dir("video_dir")
            Traceback (most recent call last):
            KeyError: 'video_dir {media_dir}/videos/{module_name}/{quality} requires the following keyword arguments: module_name'
            >>> config.get_dir("video_dir", module_name="myfile").as_posix()
            'my_media_dir/videos/myfile/1080p60'

        Note the quality does not need to be passed as keyword argument since
        :class:`ManimConfig` does store information about quality.

        Directories may be recursively defined.  For example, the config option
        ``partial_movie_dir`` depends on ``video_dir``, which in turn depends
        on ``media_dir``:

        .. code-block:: pycon

            >>> config.partial_movie_dir
            '{video_dir}/partial_movie_files/{scene_name}'
            >>> config.get_dir("partial_movie_dir")
            Traceback (most recent call last):
            KeyError: 'partial_movie_dir {video_dir}/partial_movie_files/{scene_name} requires the following keyword arguments: scene_name'
            >>> config.get_dir(
            ...     "partial_movie_dir", module_name="myfile", scene_name="myscene"
            ... ).as_posix()
            'my_media_dir/videos/myfile/1080p60/partial_movie_files/myscene'

        Standard f-string syntax is used.  Arbitrary names can be used when
        defining directories, as long as the corresponding values are passed to
        :meth:`ManimConfig.get_dir` via ``kwargs``.

        .. code-block:: pycon

            >>> config.media_dir = "{dir1}/{dir2}"
            >>> config.get_dir("media_dir")
            Traceback (most recent call last):
            KeyError: 'media_dir {dir1}/{dir2} requires the following keyword arguments: dir1'
            >>> config.get_dir("media_dir", dir1="foo", dir2="bar").as_posix()
            'foo/bar'
            >>> config.media_dir = "./media"
            >>> config.get_dir("media_dir").as_posix()
            'media'

        )rV   rQ   rT   rk   rZ   rO   rM   rJ   r[   ra   r|   zMmust pass one of {media,video,images,text,tex,log}_dir or {input,output}_filec                ,    i | ]}|j         |         S r   r   r  s     r*   r   z'ManimConfig.get_dir.<locals>.<dictcomp>k  s!    000aAtwqz000r+   pgrC   { z requires the following zkeyword arguments: Nr   )r  remover   ri   rX   r   r   r>   rH   joinr
  r   )r   r   r  dirsall_argsr;   excs   `      r*   get_dirzManimConfig.get_dir  sn   b
 
 
 d??)   	C00004000!%!2HHT_HHHws|$$$$$$Tkk"t{..X..   CCTWS\CCC+,hhsx(()  	 Tkk "+tDzzzt+s   B 
C+'?C&&C+c                    t          |t                    r*| j                            |t	          |                     d S | j                            ||           d S r   )r   r   r   r   r>   r   s      r*   r  zManimConfig._set_dir|  sV    c4   	*GSXX.....GS)))))r+   c                    | j         d         S )z+Directory to locate video assets (no flag).rV   r   r   s    r*   rV   zManimConfig.assets_dir  r  r+   c                2    |                      d|           d S )NrV   r  r)  s     r*   rV   zManimConfig.assets_dir      lE*****r+   c                    | j         d         S )z9Directory to place logs. See :meth:`ManimConfig.get_dir`.rJ   r   r   s    r*   rJ   zManimConfig.log_dir  r  r+   c                2    |                      d|           d S )NrJ   r  r)  s     r*   rJ   zManimConfig.log_dir      i'''''r+   c                    | j         d         S )zEDirectory to place videos (no flag). See :meth:`ManimConfig.get_dir`.rT   r   r   s    r*   rT   zManimConfig.video_dir  rD  r+   c                2    |                      d|           d S )NrT   r  r)  s     r*   rT   zManimConfig.video_dir  r  r+   c                    | j         d         S )zMDirectory to place section videos (no flag). See :meth:`ManimConfig.get_dir`.rk   r   r   s    r*   rk   zManimConfig.sections_dir  r.  r+   c                2    |                      d|           d S )Nrk   r  r)  s     r*   rk   zManimConfig.sections_dir  s    ne,,,,,r+   c                    | j         d         S )zFDirectory to place images (no flag).  See :meth:`ManimConfig.get_dir`.rZ   r   r   s    r*   rZ   zManimConfig.images_dir  r  r+   c                2    |                      d|           d S )NrZ   r  r)  s     r*   rZ   zManimConfig.images_dir  r  r+   c                    | j         d         S )zDDirectory to place text (no flag).  See :meth:`ManimConfig.get_dir`.rO   r   r   s    r*   rO   zManimConfig.text_dir  r  r+   c                2    |                      d|           d S )NrO   r  r)  s     r*   rO   zManimConfig.text_dir  s    j%(((((r+   c                    | j         d         S )zCDirectory to place tex (no flag).  See :meth:`ManimConfig.get_dir`.rM   r   r   s    r*   rM   zManimConfig.tex_dir  r  r+   c                2    |                      d|           d S )NrM   r  r)  s     r*   rM   zManimConfig.tex_dir  r  r+   c                    | j         d         S )zSDirectory to place partial movie files (no flag).  See :meth:`ManimConfig.get_dir`.r|   r   r   s    r*   r|   zManimConfig.partial_movie_dir       w*++r+   c                2    |                      d|           d S )Nr|   r  r)  s     r*   r|   zManimConfig.partial_movie_dir  s    )511111r+   c                    | j         d         S )z$Whether to use custom folder output.rn   r   r   s    r*   rn   zManimConfig.custom_folders  r=  r+   c                2    |                      d|           d S )Nrn   r  r)  s     r*   rn   zManimConfig.custom_folders  s    &.....r+   c                    | j         d         S )zInput file name.r[   r   r   s    r*   r[   zManimConfig.input_file  r  r+   c                2    |                      d|           d S )Nr[   r  r)  s     r*   r[   zManimConfig.input_file  r  r+   c                    | j         d         S )zOutput file name (-o).ra   r   r   s    r*   ra   zManimConfig.output_file  r5  r+   c                2    |                      d|           d S )Nra   r  r)  s     r*   ra   zManimConfig.output_file  rv  r+   	list[str]c                    | j         d         S )zScenes to play from file.rd   r   r   s    r*   rd   zManimConfig.scene_names  r5  r+   c                <    | j                             d|           d S )Nrd   r  r)  s     r*   rd   zManimConfig.scene_names  r  r+   r   c                    t          | d          r| j        s<| j        d         }|rt          j        |          | _        nt                      | _        | j        S )z=Template used when rendering Tex.  See :class:`.TexTemplate`._tex_templater}   )r  r#  r   r   r  )r   fns     r*   rl   zManimConfig.tex_template  s`     t_-- 	3T5G 	3,-B 3%0%:2%>%>""%0]]"!!r+   c                B    t          |t                    r	|| _        d S d S r   )r   r   r#  rb  s     r*   rl   zManimConfig.tex_template  s,    c;'' 	%!$D	% 	%r+   c                    | j         d         S )zEFile to read Tex template from (no flag).  See :class:`.TexTemplate`.r}   r   r   s    r*   r}   zManimConfig.tex_template_file  r  r+   c                    |rXt          j        |t           j                  s t                              d| d           d S t          |          | j        d<   d S || j        d<   d S )NzCustom TeX template z not found or not readable.r}   )osaccessR_OKr2   rk  r   r   rb  s     r*   r}   zManimConfig.tex_template_file  s|     	/9S"'** 9K3KKK     04Cyy+,,,+.DG'(((r+   c                    | j         d         S )zList of plugins to enable.rK   r   r   s    r*   rK   zManimConfig.plugins  r  r+   c                    || j         d<   d S )NrK   r   r)  s     r*   rK   zManimConfig.plugins  s    "	r+   
int | Nonec                    | j         d         S )z;Random seed for reproducibility. None means no seed is set.rG   r   r   s    r*   rG   zManimConfig.seed  s     wvr+   c                <    |d S |                      d|d           d S )NrG   Fry  r)  s     r*   rG   zManimConfig.seed  s*    =FVUE22222r+   N)r   r   )r   r   r   r   )r   r   r   r   r   r>   r   r	   )r   r>   r   r	   r   r   )r   r   r   r   )r   r>   r   r   )r   r   )r   r   r   r   )r   r>   r   r	   rD   r   r   r   )r   r>   r   r	   r   r   r   r   )r   r>   r   r   r   r   )
r   r>   r   r   r   r   r   r   r   r   )
r   r>   r   r   r   r   r   r   r   r   )r   r>   r   r   r   r   r   r   )r   r>   )r8   r.   r   r   )r
  r  r   r   )r  r   r   r   )r   r   )r&  r   r   r   )r&  r>   r   r   )r   r>   r   r   )r   r=   )r   rq  )r&  r   r   r   )r   r   )r&  r   r   r   )r   r   )r   r   )r&  r	   r   r   )r   r  )r&  r  r   r   )r&  r=   r   r   )r   r   r   r   )r   r   )r&  r  r   r   )r&  r  r   r   )r   r  )r&  r  r   r   )r  r   r   r   )r   r  )r&  r   r   r   )r   r>   r  r	   r   r   )r   r>   r   r  r   r   )r   r  )r   r  )r&  r  r   r   )r   r   )r   r   r   r   )r   r   )r   r-  )r&  r-  r   r   )j__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r	  r  r  propertyrL   setterr   rj   r^   r   rr   rv   rU   rR   rc   rm   ry   rf   r{   ru   rS   rH   rt   r_   r`   rb   ri   r   rg   r]   rp   ro   r  r  r  r  rX   rx   r   r   rz   rq   r\   rs   r   r   r~   r  rC   r  rI   rN   rQ   rw   re   rj  rW   rh   rY   r   r   rP   r  r  rV   rJ   rT   rk   rZ   rO   rM   r|   rn   r[   ra   rd   rl   r}   rK   rG   r   r+   r*   r   r      s       q qfB B BEHC C C C         " " " "2 2 2 2( ( ( (VT T T TT T T T# # # #&# # # #   V V V V. . . .27 7 7 75 5 5 5B B B BE E E E   	 	 	 	   s s s sjX X X Xt&@ &@ &@ &@T ; ; ; X; ^, , , ^, / / / X/  9 9 9 ! 9 ' ' ' X' Q Q Q Q & & & X& 0 0 0 0 2 2 2 X2 #< < < $#< ) ) ) X) 3 3 3 3 * * * X* 4 4 4 4 $ $ $ X$ . . . . $ $ $ X$ . . . . & & & X& 0 0 0 0 ( ( ( X( 2 2 2 2 + + + X+ 5 5 5 5 ' ' ' X' 1 1 1 1 + + + X+ 5 5 5 5 * * * X* 0 0 0 0 $ $ $ X$     ! ! ! X! ]
 
 
 ]
 * * * X* B B B B & & & X& 0 0 0 0 & & & X& , , , , & & & X& : : : : ' ' ' X' ; ; ; ; @ @ @ X@ ' ' ' X' 3 3 3 3 & & & X& 2 2 2 2 + + + X+ 
 
 
 

 * * * X* 
 
 
 

 2 2 2 X2 4 4 4 X4 4 4 4 X4 5 5 5 X5 % % % X% 1 1 1 1 + + + X+ C C C C 0 0 0 X0 !< < < "!< 0 0 0 X0 !C C C "!C + + + X+ > > > > ) ) ) X) < < < < & & & X& 0 0 0 0 * * * X* 4 4 4 4 2 2 2 X2 #< < < $#< / / / X/  V V V ! V - - - X- C C C C
 A A A XA 
 
 
 

    X ^* * * ^* 3 3 3 X3
 1 1 1 1 " " " X" ^   ^ # # # X#2 _(@ (@ (@ _(@T $ $ $ X$ * * * * * * * X* 6 6 6 6 & & & X& 2 2 2 2     % % % X% / / / / ' ' ' X' / / / / % % % X% / / / / 6 6 6 X6 !'@ @ @ ('@ 8 8 8 X8 #)B B B *)B # # # X# _7 7 7 _7V, V, V, V,p* * * * % % % X% + + + + " " " X" ^( ( ( ^( $ $ $ X$ * * * * ' ' ' X' - - - - % % % X% + + + + # # # X# _) ) ) _) " " " X" ^( ( ( ^( , , , X, 2 2 2 2 ) ) ) X) / / / / % % % X% + + + + & & & X& , , , , & & & X& 2 2 2 2 " " " X" % % % % , , , X, 	/ 	/ 	/ 	/ " " " X" ^# # # ^#    X 
[3 3 3 [3 3 3r+   r   c                     e Zd ZU h dZded<    ej        d           ej        d           ej        d           ej        d           ej        d           ej        d	           ej        d
           ej        d           ej        d           ej        d	           ej        d           ej        d           ej        d           ej        d          dZded<   ded<   d'dZd(dZ	d)dZ
d*dZd+d#Zd,d$Zd-d%Zd&S ).r   >   r  r  r  r  r]   rb   r   rg   ri   ro   rp   zClassVar[set[str]]r   )        r  r9  )r9        r9  )r  r9  r9  )r:  r9  r9  )r9  r9  r:  )r9  r9  r  )r9  r9  r9  )r:  r  r9  )r  r  r9  )r:  r:  r9  )r  r:  r9  )r  r  r  r  INOUTORIGINX_AXISY_AXISZ_AXISULURDLDRzClassVar[dict[str, Vector3D]]
_CONSTANTSr   _cr   r   r   c                b    t          |t                    st          d          || j        d<   d S )Nz*argument must be instance of 'ManimConfig'rF  )r   r   	TypeError__dict__)r   r   s     r*   r   zManimFrame.__init__G  s8    ![)) 	JHIII  dr+   r   r>   r	   c                x    || j         v r| j        |         S || j        v r| j        |         S t          |          r   )r   rF  rE  r  r   s     r*   r   zManimFrame.__getitem__O  sA    $*73<DO##?3''3--r+   Iterator[Any]c                n    t          t          | j                  t          | j                  z             S r   )r   r  r   rE  r   s    r*   r   zManimFrame.__iter__W  s)    D$$tDO'<'<<===r+   r   c                *    t          | j                  S r   )r   r   r   s    r*   r   zManimFrame.__len__Z  s    4:r+   r  r   r   c                     t          d          Nz4'ManimFrame' object does not support item assignmentrH  )r   r  r   s      r*   __setattr__zManimFrame.__setattr__^      NOOOr+   c                     t          d          rO  rP  r   s      r*   r   zManimFrame.__setitem__a  rR  r+   c                     t          d          )Nz2'ManimFrame' object does not support item deletionrP  r   s     r*   r   zManimFrame.__delitem__d  s    LMMMr+   N)r   r   r   r   r1  )r   rK  r0  )r  r	   r   r	   r   r   )r   r	   r   r	   r   r   )r   r	   r   r   )r2  r3  r4  r   __annotations__nparrayrE  r   r   r   r   rQ  r   r   r   r+   r*   r   r   &  s        ! ! !E     bh'')**/**)**bh'((rx(("(?++"(?++"(?++"(?++bh'((bh''bh())bh'((1 1J    " OOO              > > > >   P P P PP P P PN N N N N Nr+   r   c                    | |         S r   r   )r   os     r*   r   r   i  s
    $q' r+   )r   r   r   )r,   r-   r   r.   )r<   r=   r   r>   )4r5  
__future__r   argparser0   r   r#  ro  r(  r  r#   collections.abcr   r   r   pathlibr   typingr   r	   r
   r   numpyrV  r   r   manim.constantsr   manim.utils.colorr   manim.utils.texr   enumr   r   manim.typingr   r   __all__rp  r2   r   r   rE   r   r   r  r   rE  r  r   r6  r   r+   r*   <module>rf     s  
 
 # " " " " "         				 				 



 = = = = = = = = = =       9 9 9 9 9 9 9 9 9 9 9 9           ( ( ( ( ( ( ( ( ( ( ( ( ' ' ' ' ' ' /........
R
R
R		7	#	#(2 (2 (2 (2X #'. . . . .b   P3 P3 P3 P3 P3. P3 P3 P3j4?N ?N ?N ?N ?N ?N ?N ?ND 4
 !!DD)>$?$?? D DCGJXXS&A&A&ABBCCCCD Dr+   