class_docstr: 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.
class_docstr_tok: ["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","."]
docstr: 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.
code: 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.
      """
      navstack: list[NavPoint] = []
      navstack.append(NavPoint("dummy", 0, "", "", []))
      level = 0
      lastnode = None
      for node in nodes:
          if not node["text"]:
              continue
          file = node["refuri"].split("#")[0]
          if file in self.ignored_files:
              continue
          if node["level"] > self.config.epub_tocdepth:
              continue
          if node["level"] == level:
              navpoint = self.new_navpoint(node, level)
              navstack.pop()
              navstack[-1].children.append(navpoint)
              navstack.append(navpoint)
          elif node["level"] == level + 1:
              level += 1
              if lastnode and self.config.epub_tocdup:
                  # Insert starting point in subtoc with same playOrder
                  navstack[-1].children.append(
                      self.new_navpoint(lastnode, level, False)
                  )
              navpoint = self.new_navpoint(node, level)
              navstack[-1].children.append(navpoint)
              navstack.append(navpoint)
          elif node["level"] < level:
              while node["level"] < len(navstack):
                  navstack.pop()
              level = node["level"]
              navpoint = self.new_navpoint(node, level)
              navstack[-1].children.append(navpoint)
              navstack.append(navpoint)
          else:
              raise
          lastnode = node
  
      return navstack[0].children
  
imports: from __future__ import annotations
  import html
  import os
  import re
  import time
  from os import path
  from typing import TYPE_CHECKING, Any, NamedTuple
  from urllib.parse import quote
  from zipfile import ZIP_DEFLATED, ZIP_STORED, ZipFile
  from docutils import nodes
  from docutils.utils import smartquotes
  from sphinx import addnodes
  from sphinx.builders.html import BuildInfo, StandaloneHTMLBuilder
  from sphinx.locale import __
  from sphinx.util import logging
  from sphinx.util.display import status_iterator
  from sphinx.util.fileutil import copy_asset_file
  from sphinx.util.osutil import copyfile, ensuredir, relpath
label_desc: Use image node_id 24 for calling the EpubBuilder obj's underlying member method code with example usage: obj.build_navpoints(nodes) and returns: navstack