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AAU,GAAG,UAAU,CAAC;IACjC,CAAC;;AANM,mBAAK,GAAG,eAAe,CAAC;AAfnC,sCAsBC","sourcesContent":["import { TemplateDelegate } from 'handlebars';\nimport * as Path from 'path';\n\nimport { Event } from '../utils/events';\nimport { ProjectReflection } from '../models/reflections/project';\nimport { UrlMapping } from './models/UrlMapping';\nimport { NavigationItem } from './models/NavigationItem';\n\n/**\n * An event emitted by the [[Renderer]] class at the very beginning and\n * ending of the entire rendering process.\n *\n * @see [[Renderer.EVENT_BEGIN]]\n * @see [[Renderer.EVENT_END]]\n */\nexport class RendererEvent extends Event {\n /**\n * The project the renderer is currently processing.\n */\n readonly project: ProjectReflection;\n\n /**\n * The settings that have been passed to TypeDoc.\n */\n settings: any;\n\n /**\n * The path of the directory the documentation should be written to.\n */\n readonly outputDirectory: string;\n\n /**\n * A list of all pages that should be generated.\n *\n * This list can be altered during the [[Renderer.EVENT_BEGIN]] event.\n */\n urls?: UrlMapping[];\n\n /**\n * Triggered before the renderer starts rendering a project.\n * @event\n */\n static BEGIN = 'beginRender';\n\n /**\n * Triggered after the renderer has written all documents.\n * @event\n */\n static END = 'endRender';\n\n constructor(name: string, outputDirectory: string, project: ProjectReflection) {\n super(name);\n this.outputDirectory = outputDirectory;\n this.project = project;\n }\n\n /**\n * Create an [[PageEvent]] event based on this event and the given url mapping.\n *\n * @internal\n * @param mapping The mapping that defines the generated [[PageEvent]] state.\n * @returns A newly created [[PageEvent]] instance.\n */\n public createPageEvent(mapping: UrlMapping): PageEvent {\n const event = new PageEvent(PageEvent.BEGIN);\n event.project = this.project;\n event.settings = this.settings;\n event.url = mapping.url;\n event.model = mapping.model;\n event.templateName = mapping.template;\n event.filename = Path.join(this.outputDirectory, mapping.url);\n return event;\n }\n}\n\n/**\n * An event emitted by the [[Renderer]] class before and after the\n * markup of a page is rendered.\n *\n * This object will be passed as the rendering context to handlebars templates.\n *\n * @see [[Renderer.EVENT_BEGIN_PAGE]]\n * @see [[Renderer.EVENT_END_PAGE]]\n */\nexport class PageEvent extends Event {\n /**\n * The project the renderer is currently processing.\n */\n project!: ProjectReflection;\n\n /**\n * The settings that have been passed to TypeDoc.\n */\n settings: any;\n\n /**\n * The filename the page will be written to.\n */\n filename!: string;\n\n /**\n * The url this page will be located at.\n */\n url!: string;\n\n /**\n * The model that should be rendered on this page.\n */\n model: any;\n\n /**\n * The template that should be used to render this page.\n */\n template?: TemplateDelegate;\n\n /**\n * The name of the template that should be used to render this page.\n */\n templateName!: string;\n\n /**\n * The primary navigation structure of this page.\n */\n navigation?: NavigationItem;\n\n /**\n * The table of contents structure of this page.\n */\n toc?: NavigationItem;\n\n /**\n * The final html content of this page.\n *\n * Should be rendered by layout templates and can be modifies by plugins.\n */\n contents?: string;\n\n /**\n * Triggered before a document will be rendered.\n * @event\n */\n static BEGIN = 'beginPage';\n\n /**\n * Triggered after a document has been rendered, just before it is written to disc.\n * @event\n */\n static END = 'endPage';\n}\n\n/**\n * An event emitted by the [[MarkedPlugin]] on the [[Renderer]] after a chunk of\n * markdown has been processed. Allows other plugins to manipulate the result.\n *\n * @see [[MarkedPlugin.EVENT_PARSE_MARKDOWN]]\n */\nexport class MarkdownEvent extends Event {\n /**\n * The unparsed original text.\n */\n readonly originalText: string;\n\n /**\n * The parsed output.\n */\n parsedText: string;\n\n /**\n * Triggered on the renderer when this plugin parses a markdown string.\n * @event\n */\n static PARSE = 'parseMarkdown';\n\n constructor(name: string, originalText: string, parsedText: string) {\n super(name);\n this.originalText = originalText;\n this.parsedText = parsedText;\n }\n}\n"]}
\No newline at end of file