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AI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;SACrC;IACH,CAAC;IACH,iBAAC;AAAD,CAAC,AA3CD,CAAgC,gBAAgB,GA2C/C","sourcesContent":["import { DocNode, DocNodeKind } from './DocNode';\r\nimport { DocParagraph } from './DocParagraph';\r\nimport {\r\n DocNodeContainer,\r\n IDocNodeContainerParameters,\r\n IDocNodeContainerParsedParameters\r\n} from './DocNodeContainer';\r\n\r\n/**\r\n * Constructor parameters for {@link DocSection}.\r\n */\r\nexport interface IDocSectionParameters extends IDocNodeContainerParameters {}\r\n\r\n/**\r\n * Constructor parameters for {@link DocSection}.\r\n */\r\nexport interface IDocSectionParsedParameters extends IDocNodeContainerParsedParameters {}\r\n\r\n/**\r\n * Represents a general block of rich text.\r\n */\r\nexport class DocSection extends DocNodeContainer {\r\n /**\r\n * Don't call this directly. Instead use {@link TSDocParser}\r\n * @internal\r\n */\r\n public constructor(\r\n parameters: IDocSectionParameters | IDocSectionParsedParameters,\r\n childNodes?: ReadonlyArray<DocNode>\r\n ) {\r\n super(parameters, childNodes);\r\n }\r\n\r\n /** @override */\r\n public get kind(): DocNodeKind | string {\r\n return DocNodeKind.Section;\r\n }\r\n\r\n /**\r\n * If the last item in DocSection.nodes is not a DocParagraph, a new paragraph\r\n * is started. Either way, the provided docNode will be appended to the paragraph.\r\n */\r\n public appendNodeInParagraph(docNode: DocNode): void {\r\n let paragraphNode: DocParagraph | undefined = undefined;\r\n\r\n if (this.nodes.length > 0) {\r\n const lastNode: DocNode = this.nodes[this.nodes.length - 1];\r\n if (lastNode.kind === DocNodeKind.Paragraph) {\r\n paragraphNode = lastNode as DocParagraph;\r\n }\r\n }\r\n if (!paragraphNode) {\r\n paragraphNode = new DocParagraph({ configuration: this.configuration });\r\n this.appendNode(paragraphNode);\r\n }\r\n\r\n paragraphNode.appendNode(docNode);\r\n }\r\n\r\n public appendNodesInParagraph(docNodes: ReadonlyArray<DocNode>): void {\r\n for (const docNode of docNodes) {\r\n this.appendNodeInParagraph(docNode);\r\n }\r\n }\r\n}\r\n"]}
\No newline at end of file