"""
This type stub file was generated by pyright.
"""

from typing import Any, NamedTuple, TYPE_CHECKING
from docutils import nodes
from sphinx.builders.html import BuildInfo, StandaloneHTMLBuilder
from docutils.nodes import Node

"""Base class of epub2/epub3 builders."""
if TYPE_CHECKING:
    ...
logger = ...
COVERPAGE_NAME = ...
TOCTREE_TEMPLATE = ...
LINK_TARGET_TEMPLATE = ...
FOOTNOTE_LABEL_TEMPLATE = ...
FOOTNOTES_RUBRIC_NAME = ...
CSS_LINK_TARGET_CLASS = ...
GUIDE_TITLES = ...
MEDIA_TYPES = ...
VECTOR_GRAPHICS_EXTENSIONS = ...
REFURI_RE = ...
class ManifestItem(NamedTuple):
    href: str
    id: str
    media_type: str
    ...


class Spine(NamedTuple):
    idref: str
    linear: bool
    ...


class Guide(NamedTuple):
    type: str
    title: str
    uri: str
    ...


class NavPoint(NamedTuple):
    navpoint: str
    playorder: int
    text: str
    refuri: str
    children: list[NavPoint]
    ...


def sphinx_smarty_pants(t: str, language: str = ...) -> str:
    ...

ssp = ...
class EpubBuilder(StandaloneHTMLBuilder):
    """
    Builder that outputs epub files.

    It creates the metainfo files container.opf, toc.ncx, mimetype, and
    META-INF/container.xml.  Afterwards, all necessary files are zipped to an
    epub file.
    """
    copysource = ...
    supported_image_types = ...
    supported_remote_images = ...
    add_permalinks = ...
    allow_sharp_as_current_path = ...
    embedded = ...
    download_support = ...
    html_scaled_image_link = ...
    search = ...
    coverpage_name = ...
    toctree_template = ...
    link_target_template = ...
    css_link_target_class = ...
    guide_titles = ...
    media_types = ...
    refuri_re = ...
    template_dir = ...
    doctype = ...
    def init(self) -> None:
        ...
    
    def create_build_info(self) -> BuildInfo:
        ...
    
    def get_theme_config(self) -> tuple[str, dict]:
        ...
    
    def make_id(self, name: str) -> str:
        """Return a unique id for name."""
        ...
    
    def get_refnodes(self, doctree: Node, result: list[dict[str, Any]]) -> list[dict[str, Any]]:
        """Collect section titles, their depth in the toc and the refuri."""
        ...
    
    def check_refnodes(self, nodes: list[dict[str, Any]]) -> None:
        ...
    
    def get_toc(self) -> None:
        """Get the total table of contents, containing the root_doc
        and pre and post files not managed by sphinx.
        """
        ...
    
    def toc_add_files(self, refnodes: list[dict[str, Any]]) -> None:
        """Add the root_doc, pre and post files to a list of refnodes.
        """
        ...
    
    def fix_fragment(self, prefix: str, fragment: str) -> str:
        """Return a href/id attribute with colons replaced by hyphens."""
        ...
    
    def fix_ids(self, tree: nodes.document) -> None:
        """Replace colons with hyphens in href and id attributes.

        Some readers crash because they interpret the part as a
        transport protocol specification.
        """
        ...
    
    def add_visible_links(self, tree: nodes.document, show_urls: str = ...) -> None:
        """Add visible link targets for external links"""
        ...
    
    def write_doc(self, docname: str, doctree: nodes.document) -> None:
        """Write one document file.

        This method is overwritten in order to fix fragment identifiers
        and to add visible external links.
        """
        ...
    
    def fix_genindex(self, tree: list[tuple[str, list[tuple[str, Any]]]]) -> None:
        """Fix href attributes for genindex pages."""
        ...
    
    def is_vector_graphics(self, filename: str) -> bool:
        """Does the filename extension indicate a vector graphic format?"""
        ...
    
    def copy_image_files_pil(self) -> None:
        """Copy images using Pillow, the Python Imaging Library.
        The method tries to read and write the files with Pillow, converting
        the format and resizing the image if necessary/possible.
        """
        ...
    
    def copy_image_files(self) -> None:
        """Copy image files to destination directory.
        This overwritten method can use Pillow to convert image files.
        """
        ...
    
    def copy_download_files(self) -> None:
        ...
    
    def handle_page(self, pagename: str, addctx: dict, templatename: str = ..., outfilename: str | None = ..., event_arg: Any = ...) -> None:
        """Create a rendered page.

        This method is overwritten for genindex pages in order to fix href link
        attributes.
        """
        ...
    
    def build_mimetype(self) -> None:
        """Write the metainfo file mimetype."""
        ...
    
    def build_container(self, outname: str = ...) -> None:
        """Write the metainfo file META-INF/container.xml."""
        ...
    
    def content_metadata(self) -> dict[str, Any]:
        """Create a dictionary with all metadata for the content.opf
        file properly escaped.
        """
        ...
    
    def build_content(self) -> None:
        """Write the metainfo file content.opf It contains bibliographic data,
        a file list and the spine (the reading order).
        """
        ...
    
    def new_navpoint(self, node: dict[str, Any], level: int, incr: bool = ...) -> NavPoint:
        """Create a new entry in the toc from the node at given level."""
        ...
    
    def build_navpoints(self, nodes: list[dict[str, Any]]) -> list[NavPoint]:
        """Create the toc navigation structure.

        Subelements of a node are nested inside the navpoint.  For nested nodes
        the parent node is reinserted in the subnav.
        """
        ...
    
    def toc_metadata(self, level: int, navpoints: list[NavPoint]) -> dict[str, Any]:
        """Create a dictionary with all metadata for the toc.ncx file
        properly escaped.
        """
        ...
    
    def build_toc(self) -> None:
        """Write the metainfo file toc.ncx."""
        ...
    
    def build_epub(self) -> None:
        """Write the epub file.

        It is a zip file with the mimetype file stored uncompressed as the first
        entry.
        """
        ...
    


