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AAC,YAAY,CAAC,GAAG,UAAU,CAAC;aACrC;SACJ;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,MAAM,OAAO,GAAU,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC5B,OAAO,CAAC,IAAI,CAAC;oBACX,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,SAAS,EAAE,MAAM,CAAC,SAAS;iBAC5B,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;SAC7B;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AApFD,kDAoFC","sourcesContent":["import { Reflection, ReflectionKind, TraverseCallback, TraverseProperty } from './abstract';\nimport { ReflectionCategory } from '../ReflectionCategory';\nimport { ReflectionGroup } from '../ReflectionGroup';\nimport { DeclarationReflection } from './declaration';\nimport { toArray } from 'lodash';\n\nexport class ContainerReflection extends Reflection {\n /**\n * The children of this reflection.\n */\n children?: DeclarationReflection[];\n\n /**\n * All children grouped by their kind.\n */\n groups?: ReflectionGroup[];\n\n /**\n * All children grouped by their category.\n */\n categories?: ReflectionCategory[];\n\n /**\n * Return a list of all children of a certain kind.\n *\n * @param kind The desired kind of children.\n * @returns An array containing all children with the desired kind.\n */\n getChildrenByKind(kind: ReflectionKind): DeclarationReflection[] {\n return (this.children || []).filter(child => child.kindOf(kind));\n }\n\n /**\n * Traverse all potential child reflections of this reflection.\n *\n * The given callback will be invoked for all children, signatures and type parameters\n * attached to this reflection.\n *\n * @param callback The callback function that should be applied for each child reflection.\n */\n traverse(callback: TraverseCallback) {\n for (const child of toArray(this.children)) {\n if (callback(child, TraverseProperty.Children) === false) {\n return;\n }\n }\n }\n\n /**\n * Return a raw object representation of this reflection.\n * @deprecated Use serializers instead\n */\n toObject(): any {\n const result = super.toObject();\n\n if (this.groups) {\n const groups: any[] = [];\n this.groups.forEach((group) => {\n groups.push(group.toObject());\n });\n\n result['groups'] = groups;\n }\n\n if (this.categories) {\n const categories: any[] = [];\n this.categories.forEach((category) => {\n categories.push(category.toObject());\n });\n\n if (categories.length > 0) {\n result['categories'] = categories;\n }\n }\n\n if (this.sources) {\n const sources: any[] = [];\n this.sources.forEach((source) => {\n sources.push({\n fileName: source.fileName,\n line: source.line,\n character: source.character\n });\n });\n\n result['sources'] = sources;\n }\n\n return result;\n }\n}\n"]}
\No newline at end of file