@qualcomm-ui/mdx-vite 3.8.3 → 3.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/angular-demo-plugin/index.d.ts +1 -1
  2. package/dist/angular-demo-plugin/index.d.ts.map +1 -1
  3. package/dist/cli.js +5 -5
  4. package/dist/cli.js.map +1 -1
  5. package/dist/docs-plugin/config/config-loader.d.ts +1 -1
  6. package/dist/docs-plugin/config/config-loader.d.ts.map +1 -1
  7. package/dist/docs-plugin/config/config-schema.d.ts +4 -48
  8. package/dist/docs-plugin/config/config-schema.d.ts.map +1 -1
  9. package/dist/docs-plugin/config/index.d.ts +2 -3
  10. package/dist/docs-plugin/config/index.d.ts.map +1 -1
  11. package/dist/docs-plugin/config/types.d.ts +1 -1
  12. package/dist/docs-plugin/config/types.d.ts.map +1 -1
  13. package/dist/docs-plugin/config/zod.d.ts +2 -6
  14. package/dist/docs-plugin/config/zod.d.ts.map +1 -1
  15. package/dist/docs-plugin/doc-props/doc-props-indexer.d.ts +1 -1
  16. package/dist/docs-plugin/doc-props/doc-props-indexer.d.ts.map +1 -1
  17. package/dist/docs-plugin/doc-props/index.d.ts +1 -1
  18. package/dist/docs-plugin/doc-props/index.d.ts.map +1 -1
  19. package/dist/docs-plugin/docs-plugin.d.ts +1 -1
  20. package/dist/docs-plugin/docs-plugin.d.ts.map +1 -1
  21. package/dist/docs-plugin/generate-page-map.d.ts.map +1 -1
  22. package/dist/docs-plugin/index.d.ts +7 -7
  23. package/dist/docs-plugin/index.d.ts.map +1 -1
  24. package/dist/docs-plugin/markdown/frontmatter-schema.d.ts.map +1 -1
  25. package/dist/docs-plugin/markdown/index.d.ts +5 -5
  26. package/dist/docs-plugin/markdown/index.d.ts.map +1 -1
  27. package/dist/docs-plugin/markdown/knowledge/filter-frontmatter.d.ts +1 -1
  28. package/dist/docs-plugin/markdown/knowledge/filter-frontmatter.d.ts.map +1 -1
  29. package/dist/docs-plugin/markdown/knowledge/index.d.ts +1 -1
  30. package/dist/docs-plugin/markdown/knowledge/index.d.ts.map +1 -1
  31. package/dist/docs-plugin/markdown/knowledge/knowledge-exporter.d.ts +3 -3
  32. package/dist/docs-plugin/markdown/knowledge/knowledge-exporter.d.ts.map +1 -1
  33. package/dist/docs-plugin/markdown/knowledge/plugins/doc-props-plugin.d.ts +1 -1
  34. package/dist/docs-plugin/markdown/knowledge/plugins/doc-props-plugin.d.ts.map +1 -1
  35. package/dist/docs-plugin/markdown/knowledge/plugins/filter-text-directives.d.ts.map +1 -1
  36. package/dist/docs-plugin/markdown/knowledge/plugins/index.d.ts +5 -5
  37. package/dist/docs-plugin/markdown/knowledge/plugins/index.d.ts.map +1 -1
  38. package/dist/docs-plugin/markdown/knowledge/utils.d.ts +1 -1
  39. package/dist/docs-plugin/markdown/knowledge/utils.d.ts.map +1 -1
  40. package/dist/docs-plugin/markdown/markdown-file-reader.d.ts +3 -3
  41. package/dist/docs-plugin/markdown/markdown-file-reader.d.ts.map +1 -1
  42. package/dist/docs-plugin/markdown/remark-pipeline.d.ts +3 -2
  43. package/dist/docs-plugin/markdown/remark-pipeline.d.ts.map +1 -1
  44. package/dist/docs-plugin/mdx-plugins.d.ts +1 -1
  45. package/dist/docs-plugin/mdx-plugins.d.ts.map +1 -1
  46. package/dist/docs-plugin/nav-builder/get-route-meta.d.ts +1 -1
  47. package/dist/docs-plugin/nav-builder/get-route-meta.d.ts.map +1 -1
  48. package/dist/docs-plugin/nav-builder/index.d.ts +5 -5
  49. package/dist/docs-plugin/nav-builder/index.d.ts.map +1 -1
  50. package/dist/docs-plugin/nav-builder/nav-builder.d.ts +1 -1
  51. package/dist/docs-plugin/nav-builder/nav-builder.d.ts.map +1 -1
  52. package/dist/docs-plugin/nav-builder/page-map.d.ts +2 -2
  53. package/dist/docs-plugin/nav-builder/page-map.d.ts.map +1 -1
  54. package/dist/docs-plugin/nav-builder/transform-route-meta-array.d.ts +1 -1
  55. package/dist/docs-plugin/nav-builder/transform-route-meta-array.d.ts.map +1 -1
  56. package/dist/docs-plugin/plugin-state.d.ts +4 -4
  57. package/dist/docs-plugin/plugin-state.d.ts.map +1 -1
  58. package/dist/docs-plugin/rehype/index.d.ts +2 -2
  59. package/dist/docs-plugin/rehype/index.d.ts.map +1 -1
  60. package/dist/docs-plugin/remark/index.d.ts +12 -12
  61. package/dist/docs-plugin/remark/index.d.ts.map +1 -1
  62. package/dist/docs-plugin/remark/remark-alerts.d.ts.map +1 -1
  63. package/dist/docs-plugin/remark/remark-serialize-jsx.d.ts.map +1 -1
  64. package/dist/docs-plugin/remark/remark-spoilers.d.ts.map +1 -1
  65. package/dist/docs-plugin/remark/remark-steps.d.ts.map +1 -1
  66. package/dist/docs-plugin/search-indexer.d.ts +5 -5
  67. package/dist/docs-plugin/search-indexer.d.ts.map +1 -1
  68. package/dist/docs-plugin/shiki/index.d.ts +4 -4
  69. package/dist/docs-plugin/shiki/index.d.ts.map +1 -1
  70. package/dist/docs-plugin/shiki/internal/index.d.ts +1 -1
  71. package/dist/docs-plugin/shiki/internal/index.d.ts.map +1 -1
  72. package/dist/docs-plugin/shiki/internal/shiki-transformer-tailwind.d.ts.map +1 -1
  73. package/dist/docs-plugin/shiki/utils.d.ts.map +1 -1
  74. package/dist/exports.d.ts +1 -1
  75. package/dist/exports.d.ts.map +1 -1
  76. package/dist/index.d.ts +4 -4
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +28 -28
  79. package/dist/index.js.map +1 -1
  80. package/dist/open-web-ui/common.d.ts +1 -1
  81. package/dist/open-web-ui/common.d.ts.map +1 -1
  82. package/dist/open-web-ui/download-knowledge.d.ts.map +1 -1
  83. package/dist/open-web-ui/env.d.ts.map +1 -1
  84. package/dist/open-web-ui/upload-knowledge.d.ts.map +1 -1
  85. package/dist/react-demo-plugin/demo-plugin-utils.d.ts.map +1 -1
  86. package/dist/react-demo-plugin/index.d.ts +4 -4
  87. package/dist/react-demo-plugin/index.d.ts.map +1 -1
  88. package/dist/react-demo-plugin/react-demo-plugin.d.ts +1 -1
  89. package/dist/react-demo-plugin/react-demo-plugin.d.ts.map +1 -1
  90. package/dist/search-indexer-C9iAWDL4.js +14 -0
  91. package/dist/search-indexer-C9iAWDL4.js.map +1 -0
  92. package/package.json +10 -10
  93. package/dist/open-web-ui/knowledge-cleaner.d.ts +0 -14
  94. package/dist/open-web-ui/knowledge-cleaner.d.ts.map +0 -1
  95. package/dist/search-indexer-Chr-z_vN.js +0 -14
  96. package/dist/search-indexer-Chr-z_vN.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-indexer-C9iAWDL4.js","names":[],"sources":["../src/docs-plugin/path-utils.ts","../src/docs-plugin/config/config-schema.ts","../src/docs-plugin/config/config-loader.ts","../src/docs-plugin/markdown/create-slug.ts","../src/docs-plugin/markdown/frontmatter-schema.ts","../src/docs-plugin/markdown/markdown-file-reader.ts","../src/docs-plugin/markdown/mdx-utils.ts","../src/docs-plugin/remark/remark-alerts.ts","../src/docs-plugin/remark/remark-code-tabs.ts","../src/docs-plugin/remark/remark-extract-meta.ts","../src/docs-plugin/remark/remark-frontmatter-description.ts","../src/docs-plugin/remark/remark-frontmatter-interpolation.ts","../src/docs-plugin/remark/remark-frontmatter-title.ts","../src/docs-plugin/remark/remark-remove-code-blocks.ts","../src/docs-plugin/remark/remark-remove-jsx.ts","../src/docs-plugin/remark/remark-self-link-headings.ts","../src/docs-plugin/remark/remark-serialize-jsx.ts","../src/docs-plugin/remark/remark-spoilers.ts","../src/docs-plugin/remark/remark-steps.ts","../src/docs-plugin/markdown/remark-pipeline.ts","../src/docs-plugin/doc-props/doc-props-indexer.ts","../src/docs-plugin/link-validator.ts","../src/docs-plugin/markdown/knowledge/utils.ts","../src/docs-plugin/markdown/knowledge/section-extractor.ts","../src/docs-plugin/nav-builder/get-route-meta.ts","../src/docs-plugin/nav-builder/nav-builder.ts","../src/docs-plugin/nav-builder/page-map.ts","../src/docs-plugin/nav-builder/transform-route-meta-array.ts","../src/docs-plugin/search-indexer.ts"],"sourcesContent":["// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\n/**\n * Winblows fix\n */\nexport function fixPath(str: string): string {\n return str.replaceAll(\"\\\\\", \"/\")\n}\n\n/**\n * Removes the trailing slash from a string.\n */\nexport function removeTrailingSlash(str: string): string {\n return str.endsWith(\"/\") ? str.substring(0, str.length - 1) : str\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {z, type ZodObject, type ZodSafeParseResult, type ZodSchema} from \"zod\"\n\nimport type {NavMeta, RouteMeta} from \"../nav-builder/types.js\"\n\nimport type {\n KnowledgeConfig,\n KnowledgeExtraFile,\n OpenWebUiIntegration,\n PagesExportConfig,\n QuiDocsConfig,\n QuiDocsTypeDocOptions,\n SectionExportConfig,\n} from \"./types.js\"\nimport type {Implements} from \"./zod.js\"\n\nfunction implement<Model = never>() {\n return {\n with: <\n Schema extends Implements<Model> & {\n [unknownKey in Exclude<keyof Schema, keyof Model>]: never\n },\n >(\n schema: Schema,\n ) => z.object(schema),\n }\n}\n\nexport const navMetaSchema: ZodObject<{}> = implement<NavMeta>().with({\n id: z.never().optional(),\n sectionTitle: z.string().optional(),\n separator: z.boolean().optional(),\n})\n\nexport const routeMetaSchema: ZodSchema<RouteMeta> =\n implement<RouteMeta>().with({\n children: z.array(z.lazy(() => routeMetaSchema)).optional(),\n expanded: z.boolean().optional(),\n group: z.string().optional(),\n groupOrder: z.string().array().optional(),\n hidden: z.boolean().optional(),\n hideBreadcrumbs: z.boolean().optional(),\n hideFromSearch: z.boolean().optional(),\n hidePageLinks: z.boolean().optional(),\n hideSideNav: z.boolean().optional(),\n hideToc: z.boolean().optional(),\n id: z.string(),\n ignoreRouteMetaOrder: z.boolean().optional(),\n restricted: z.boolean().optional(),\n sectionTitle: z.never().optional(),\n separator: z.never().optional(),\n sideNavTitle: z.string().optional(),\n title: z.string().optional(),\n })\n\nconst typeDocPropsSchema = implement<QuiDocsTypeDocOptions>().with({\n includeInSearchIndex: z.boolean().optional(),\n})\n\nconst knowledgeExtraFileSchema = implement<KnowledgeExtraFile>().with({\n contents: z.string(),\n id: z.string(),\n processAsMdx: z.boolean().optional(),\n title: z.string().optional(),\n})\n\nconst frontmatterConfigSchema = z\n .object({\n exclude: z.array(z.string()).optional(),\n include: z.array(z.string()).optional(),\n })\n .optional()\n\nconst pagesExportsSchema = implement<PagesExportConfig>().with({\n outputPath: z.string().optional(),\n})\n\nconst sectionsExportsSchema = implement<SectionExportConfig>().with({\n depths: z.array(z.number()).optional(),\n minContentLength: z.number().optional(),\n outputPath: z.string().optional(),\n})\n\nconst openWebUiIntegrationSchema = implement<OpenWebUiIntegration>().with({\n envFile: z.string().optional(),\n id: z.string(),\n})\n\nconst knowledgeConfigSchema = implement<KnowledgeConfig>().with({\n baseUrl: z.string().optional(),\n exclude: z.array(z.string()).optional(),\n extraFiles: z.array(knowledgeExtraFileSchema).optional(),\n frontmatter: frontmatterConfigSchema,\n integrations: z\n .object({\n openWebUi: z.array(openWebUiIntegrationSchema).optional(),\n })\n .optional(),\n outputPath: z.string().optional(),\n pageIdPrefix: z.string().optional(),\n pages: pagesExportsSchema.optional(),\n sections: sectionsExportsSchema.optional(),\n})\n\nconst configSchema = implement<QuiDocsConfig>().with({\n appDirectory: z.string().optional(),\n disableCache: z.boolean().optional(),\n headings: z\n .array(\n z.union([\n z.literal(\"h1\"),\n z.literal(\"h2\"),\n z.literal(\"h3\"),\n z.literal(\"h4\"),\n z.literal(\"h5\"),\n z.literal(\"h6\"),\n ]),\n )\n .optional(),\n hotUpdateIgnore: z.instanceof(RegExp).optional(),\n knowledge: knowledgeConfigSchema.optional(),\n navConfig: z.array(z.union([routeMetaSchema, navMetaSchema])).optional(),\n pageDirectory: z.string().optional(),\n pageTimestampMetadata: z\n .union([\n z.literal(\"off\"),\n z.literal(\"timestamp\"),\n z.literal(\"user-and-timestamp\"),\n ])\n .optional(),\n routingStrategy: z\n .union([\n z.literal(\"vite-generouted\"),\n z.literal(\"react-router-directory-groups\"),\n z.any(),\n ])\n .optional(),\n throwOnError: z.boolean().optional(),\n typeDocProps: z.string().optional(),\n typeDocPropsOptions: typeDocPropsSchema.optional(),\n validatePageLinks: z.boolean().optional(),\n})\n\nexport function parseSchema(data: unknown): ZodSafeParseResult<QuiDocsConfig> {\n return configSchema.safeParse(data)\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {type Config, type CosmiconfigResult, cosmiconfigSync} from \"cosmiconfig\"\n\nimport {removeTrailingSlash} from \"../path-utils.js\"\n\nimport {parseSchema} from \"./config-schema.js\"\nimport type {ResolvedQuiDocsConfig} from \"./types.js\"\n\ninterface LoadedCosmicConfig {\n config: Config\n filepath: string\n isEmpty?: boolean\n}\n\nexport interface ConfigLoaderOptions {\n /**\n * Path to the qui-docs config file. This is automatically detected if omitted.\n */\n configFile?: string\n}\n\nexport class ConfigLoader {\n private readonly options: ConfigLoaderOptions\n\n constructor(options: ConfigLoaderOptions) {\n this.options = options\n return this\n }\n\n private getCosmiconfig(): LoadedCosmicConfig {\n const explorer = cosmiconfigSync(\"qui-docs\")\n\n const result: CosmiconfigResult | null = this.options.configFile\n ? explorer.load(this.options.configFile)\n : explorer.search()\n\n if (!result) {\n throw new Error(\n \"Config file not found. Please consult the docs at https://docs.qui.qualcomm.com/guide/page-setup#config\",\n )\n }\n\n return result\n }\n\n private resolveConfigFromCosmiconfig(\n config: CosmiconfigResult,\n ): ResolvedQuiDocsConfig {\n const parsed = parseSchema(config!.config)\n if (!parsed.success) {\n console.dir(parsed.error.issues, {depth: 10})\n throw new Error(\"Failed to parse config file.\")\n }\n const conf = parsed.data\n return {\n ...conf,\n appDirectory: conf.appDirectory || \"app\",\n filePath: config!.filepath,\n pageDirectory: conf.pageDirectory\n ? removeTrailingSlash(conf.pageDirectory)\n : \"routes\",\n validatePageLinks: conf.validatePageLinks ?? true,\n }\n }\n\n loadConfig(): ResolvedQuiDocsConfig {\n const config = this.getCosmiconfig()\n return this.resolveConfigFromCosmiconfig(config)\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\n/**\n * Converts heading text to a URL-friendly slug. Handles multi-word text,\n * PascalCase identifiers, and single lowercase words. Does NOT deduplicate —\n * callers manage their own counter state via {@link SlugGenerator}.\n */\nexport function slugify(text: string): string {\n const cleaned = text\n .replace(/[<>]/g, \"\")\n .replace(/[^\\w\\s-]/g, \"\")\n .trim()\n\n if (cleaned.includes(\" \")) {\n return cleaned\n .toLowerCase()\n .replace(/\\s+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n }\n\n // PascalCase → kebab-case (e.g. \"MyComponent\" → \"my-component\")\n if ((cleaned.match(/[A-Z]/g) || []).length >= 2) {\n return cleaned\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/([A-Z]+)([A-Z][a-z])/g, \"$1-$2\")\n .toLowerCase()\n }\n\n return cleaned.toLowerCase()\n}\n\n/**\n * Stateful slug generator that appends `-1`, `-2`, etc. for duplicate slugs\n * within a single page/document scope.\n */\nexport class SlugGenerator {\n private seenIds = new Map<string, number>()\n\n reset(): void {\n this.seenIds.clear()\n }\n\n createSlug(text: string): string {\n const slug = slugify(text)\n const count = this.seenIds.get(slug) || 0\n this.seenIds.set(slug, count + 1)\n return count > 0 ? `${slug}-${count}` : slug\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {z, type ZodObject} from \"zod\"\n\nimport type {PageFrontmatter} from \"@qualcomm-ui/mdx-common\"\n\nimport type {Implements} from \"../config/zod.js\"\n\nfunction implement<Model = never>() {\n return {\n with: <\n Schema extends Implements<Model> & {\n [unknownKey in Exclude<keyof Schema, keyof Model>]: never\n },\n >(\n schema: Schema,\n ) => z.object(schema),\n }\n}\n\n/**\n * Used to validate the MDX frontmatter and emit warnings for pages that violate the\n * schema.\n */\nexport const frontmatterSchema: ZodObject<{}> =\n implement<PageFrontmatter>().with({\n categories: z.string().array().optional(),\n description: z.string().optional(),\n group: z.string().optional(),\n hidden: z.boolean().optional(),\n hideBreadcrumbs: z.boolean().optional(),\n hideFromSearch: z.boolean().optional(),\n hidePageLinks: z.boolean().optional(),\n hideSideNav: z.boolean().optional(),\n hideToc: z.boolean().optional(),\n id: z.string().optional(),\n restricted: z.boolean().optional(),\n sideNavTitle: z.string().optional(),\n title: z.string(),\n updatedBy: z.string().optional(),\n updatedOn: z.string().optional(),\n })\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport chalk from \"chalk\"\nimport {execSync} from \"node:child_process\"\nimport {createHash} from \"node:crypto\"\nimport {readFileSync} from \"node:fs\"\nimport {resolve} from \"node:path\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkParse from \"remark-parse\"\nimport remarkParseFrontmatter from \"remark-parse-frontmatter\"\nimport remarkStringify from \"remark-stringify\"\nimport {unified} from \"unified\"\n\nimport type {PageFrontmatter} from \"@qualcomm-ui/mdx-common\"\nimport type {QuiPropTypes} from \"@qualcomm-ui/typedoc-common\"\n\nimport type {PageTimestampMetadataMode} from \"../config/index.js\"\nimport type {CollectedLink} from \"../link-validator.js\"\n\nimport {frontmatterSchema} from \"./frontmatter-schema.js\"\nimport type {IndexedPage, IndexedSection} from \"./markdown.types.js\"\n\nexport interface GitMetadata {\n updatedBy?: string\n updatedOn?: string\n}\n\n/**\n * Runs a single git log command to collect the last commit metadata for all\n * MDX files under srcDir. Returns a map keyed by absolute file path.\n */\nexport function buildGitMetadataMap(\n srcDir: string,\n mode: PageTimestampMetadataMode,\n): Map<string, GitMetadata> {\n const map = new Map<string, GitMetadata>()\n if (mode === \"off\") {\n return map\n }\n\n try {\n const repoRoot = execSync(\"git rev-parse --show-toplevel\", {\n encoding: \"utf-8\",\n }).trim()\n\n const format = mode === \"user-and-timestamp\" ? \"%cI%x09%aN\" : \"%cI\"\n const output = execSync(\n `git log --format=\"COMMIT%x09${format}\" --name-only -- \"${srcDir}/**/*.mdx\"`,\n {encoding: \"utf-8\", stdio: [\"pipe\", \"pipe\", \"pipe\"]},\n )\n\n let currentMetadata: GitMetadata = {}\n\n for (const line of output.split(\"\\n\")) {\n if (line.startsWith(\"COMMIT\\t\")) {\n const parts = line.split(\"\\t\")\n currentMetadata =\n mode === \"user-and-timestamp\"\n ? {updatedBy: parts[2], updatedOn: parts[1]}\n : {updatedOn: parts[1]}\n } else if (line.trim()) {\n const absolutePath = resolve(repoRoot, line.trim())\n if (!map.has(absolutePath)) {\n map.set(absolutePath, currentMetadata)\n }\n }\n }\n } catch {\n // git unavailable — return empty map\n }\n\n return map\n}\n\ninterface PageCache {\n collectedLinks: CollectedLink[]\n frontmatter: PageFrontmatter\n md5: string\n page: IndexedPage\n pageDocProps: Record<string, QuiPropTypes>\n pageDocPropSections: IndexedSection[]\n}\n\nexport class MdxFileReader {\n cachedFileCount = 0\n gitMetadataMap: Map<string, GitMetadata> = new Map()\n logWarnings = true\n private mdxCache: Record<string, PageCache> = {}\n\n constructor(\n public enabled: boolean,\n public pageTimestampMetadata: PageTimestampMetadataMode = \"off\",\n ) {}\n\n private hash(input: string) {\n return createHash(\"md5\").update(input).digest(\"hex\")\n }\n\n reset(): void {\n this.cachedFileCount = 0\n }\n\n readCache(filePath: string): PageCache | null {\n return this.mdxCache[filePath] || null\n }\n\n private checkCache(\n filePath: string,\n fileContents: string,\n ): Omit<PageCache, \"md5\"> | undefined {\n if (!this.enabled) {\n return\n }\n\n const fileMd5 = this.hash(fileContents)\n const cached = this.mdxCache[filePath]\n\n if (cached?.md5 !== fileMd5) {\n return\n }\n\n this.cachedFileCount++\n\n return {\n collectedLinks: cached.collectedLinks,\n frontmatter: cached.frontmatter,\n page: cached.page,\n pageDocProps: cached.pageDocProps,\n pageDocPropSections: cached.pageDocPropSections,\n }\n }\n\n private parseFrontmatter(\n filepath: string,\n fileContents: string,\n cachedFrontmatter?: PageFrontmatter,\n ): PageFrontmatter {\n let file:\n | {data: {frontmatter: PageFrontmatter}}\n | ReturnType<typeof unified.processSync>\n if (cachedFrontmatter) {\n file = {data: {frontmatter: cachedFrontmatter}}\n } else {\n // Only parse the YAML section — we just need the frontmatter at this stage.\n const yamlSection = fileContents.substring(\n 0,\n fileContents.indexOf(\"\\n---\") + 4,\n )\n file = unified()\n .use(remarkParse)\n .use(remarkFrontmatter, [\"yaml\"])\n .use(remarkParseFrontmatter)\n .use(remarkStringify)\n .processSync(yamlSection)\n }\n\n const frontmatter: PageFrontmatter = (file.data\n .frontmatter as PageFrontmatter) ?? {title: \"\"}\n\n if (!frontmatter.title) {\n const lines = fileContents.split(\"\\n\")\n const fallbackTitle = lines.find((line) => line.startsWith(\"# \"))\n if (fallbackTitle) {\n frontmatter.title = fallbackTitle.substring(2).trim()\n }\n }\n // TODO: permit omitting title from frontmatter if provided in the navConfig\n if (!frontmatter.title && this.logWarnings) {\n console.debug(chalk.red.bold(\"Missing title:\"), filepath)\n }\n\n const parsedFrontmatter = frontmatterSchema.safeParse(frontmatter)\n\n if (!parsedFrontmatter.success) {\n console.debug(\n `${chalk.redBright.bold(\"Invalid frontmatter detected for file\")}: ${filepath}\\n`,\n )\n console.debug(chalk.redBright.bold(\"Please check the following fields:\"))\n parsedFrontmatter.error.issues.map((issue: any) => {\n console.debug(`- ${issue.path.join(\".\")}`)\n })\n }\n\n return frontmatter\n }\n\n private enrichWithGitMetadata(\n filepath: string,\n frontmatter: PageFrontmatter,\n cached: Omit<PageCache, \"md5\"> | undefined,\n ): void {\n // In dev mode, only fetch git metadata for new files (not in cache).\n // For file updates, reuse cached git metadata to avoid repeated git calls.\n // In production mode, always fetch fresh git metadata.\n const existingCache = this.mdxCache[filepath]\n const shouldFetchGitMetadata = !this.enabled || !existingCache\n\n if (shouldFetchGitMetadata) {\n const gitMetadata = this.gitMetadataMap.get(filepath) ?? {}\n if (!frontmatter.updatedOn && gitMetadata.updatedOn) {\n frontmatter.updatedOn = gitMetadata.updatedOn\n }\n if (!frontmatter.updatedBy && gitMetadata.updatedBy) {\n frontmatter.updatedBy = gitMetadata.updatedBy\n }\n } else if (!cached && existingCache) {\n if (!frontmatter.updatedOn && existingCache.frontmatter.updatedOn) {\n frontmatter.updatedOn = existingCache.frontmatter.updatedOn\n }\n if (!frontmatter.updatedBy && existingCache.frontmatter.updatedBy) {\n frontmatter.updatedBy = existingCache.frontmatter.updatedBy\n }\n }\n }\n\n /**\n * Synchronous file read with MD5 caching and git metadata enrichment.\n * Used by the search indexer on every HMR update.\n */\n readFileSync(filepath: string): {\n cached: Omit<PageCache, \"md5\"> | undefined\n fileContents: string\n frontmatter: PageFrontmatter\n } {\n const fileContents = readFileSync(filepath, \"utf-8\")\n const cached = this.checkCache(filepath, fileContents)\n const frontmatter = this.parseFrontmatter(\n filepath,\n fileContents,\n cached?.frontmatter,\n )\n this.enrichWithGitMetadata(filepath, frontmatter, cached)\n return {cached, fileContents, frontmatter}\n }\n\n updateCache(\n filepath: string,\n fileContents: string,\n cacheData: Omit<PageCache, \"md5\">,\n ): void {\n if (this.enabled) {\n this.mdxCache[filepath] = {...cacheData, md5: this.hash(fileContents)}\n }\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {MdxJsxAttribute} from \"mdast-util-mdx-jsx\"\n\nexport function extractNamesFromAttribute(attr: MdxJsxAttribute): string[] {\n if (!attr.value) {\n return []\n }\n\n if (typeof attr.value === \"string\") {\n return [attr.value]\n }\n\n if (attr.value.type === \"mdxJsxAttributeValueExpression\") {\n const estree = attr.value.data?.estree\n if (!estree?.body?.[0] || estree.body[0].type !== \"ExpressionStatement\") {\n return []\n }\n\n const expression = estree.body[0].expression\n\n if (expression.type === \"ArrayExpression\") {\n const names: string[] = []\n for (const element of expression.elements) {\n if (element?.type === \"Literal\" && typeof element.value === \"string\") {\n names.push(element.value)\n }\n }\n return names\n }\n\n // Handle single string expression\n if (expression.type === \"Literal\" && typeof expression.value === \"string\") {\n return [expression.value]\n }\n }\n\n return []\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {PhrasingContent, Root} from \"mdast\"\nimport type {Plugin} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\nconst alertLegacyRegex = /^\\[!(NOTE|TIP|SUCCESS|WARNING|CAUTION)(\\/.*)?\\]/i\n\n/**\n * Alerts are a Markdown extension based on the blockquote syntax that you can use\n * to emphasize critical information. On GitHub, they are displayed with distinctive\n * colors and icons to indicate the significance of the content.\n * https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts\n */\nexport const remarkAlerts: Plugin<[], Root> = () => {\n return (tree) => {\n visit(tree, \"blockquote\", (node) => {\n let alertType = \"\"\n let title = \"\"\n let isNext = true\n const child = node.children.map((item) => {\n if (isNext && item.type === \"paragraph\") {\n const firstNode = item.children[0]\n const text = firstNode.type === \"text\" ? firstNode.value : \"\"\n const reg = alertLegacyRegex\n const match = text.match(reg)\n if (match) {\n isNext = false\n alertType = match[1].toLocaleLowerCase()\n title = match[2] || alertType.toLocaleUpperCase()\n if (text.includes(\"\\n\")) {\n item.children[0] = {\n type: \"text\",\n value: text.replace(reg, \"\").replace(/^\\n+/, \"\"),\n }\n }\n\n if (!text.includes(\"\\n\")) {\n const itemChild: PhrasingContent[] = []\n for (let i = 0; i < item.children.length; i++) {\n const item1 = item.children[i]\n if (i === 0) {\n continue\n }\n if (i === 1 && item1.type === \"break\") {\n continue\n }\n itemChild.push(item1)\n }\n item.children = [...itemChild]\n }\n }\n }\n return item\n })\n\n title = title.replace(/^\\//, \"\")\n\n if (alertType) {\n node.data = {\n hName: \"div\",\n hProperties: {\n class: `qui-notification__root`,\n \"data-emphasis\":\n alertToEmphasis[alertType as IconType] || \"neutral\",\n \"data-orientation\": \"vertical\",\n dir: \"auto\",\n },\n }\n node.children = [\n {\n children: [getAlertIcon(alertType as IconType)],\n data: {\n hProperties: {\n class: \"qui-notification__icon\",\n \"data-inline-notification-part\": \"status-icon\",\n },\n },\n type: \"paragraph\",\n },\n {\n children: [\n {\n type: \"text\",\n value: title,\n },\n ],\n data: {\n hProperties: {\n class: \"qui-notification__label\",\n dir: \"auto\",\n },\n },\n type: \"paragraph\",\n },\n {\n children: child,\n data: {\n hName: \"div\",\n hProperties: {\n class: `qui-notification__description`,\n dir: \"auto\",\n },\n },\n type: \"blockquote\",\n },\n ]\n }\n })\n }\n}\n\nexport function getAlertIcon(type: IconType): PhrasingContent {\n const svgChildren = svgData[type] ?? []\n return {\n children: svgChildren,\n data: {\n hName: \"svg\",\n hProperties: {\n ariaHidden: \"true\",\n class: \"lucide\",\n fill: \"transparent\",\n height: \"20\",\n stroke: \"currentColor\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: \"2\",\n viewBox: \"0 0 24 24\",\n width: \"20\",\n },\n },\n type: \"emphasis\",\n }\n}\n\ntype IconType = \"note\" | \"tip\" | \"success\" | \"warning\" | \"caution\"\n\n/**\n * These SVG children correspond to the lucide icons matching our\n * {@link https://react.qui.qualcomm.com/components/inline-alert | Alert} component.\n */\nconst svgData: Record<IconType, PhrasingContent[]> = {\n caution: [\n {\n children: [],\n data: {\n hName: \"polygon\",\n hProperties: {\n points:\n \"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2\",\n },\n },\n type: \"emphasis\",\n },\n {\n children: [],\n data: {\n hName: \"line\",\n hProperties: {\n x1: \"12\",\n x2: \"12\",\n y1: \"8\",\n y2: \"12\",\n },\n },\n type: \"emphasis\",\n },\n {\n children: [],\n data: {\n hName: \"line\",\n hProperties: {\n x1: \"12\",\n x2: \"12.01\",\n y1: \"16\",\n y2: \"16\",\n },\n },\n type: \"emphasis\",\n },\n ],\n note: [\n {\n children: [],\n data: {\n hName: \"circle\",\n hProperties: {\n cx: \"12\",\n cy: \"12\",\n r: \"10\",\n },\n },\n type: \"emphasis\",\n },\n {\n children: [],\n data: {\n hName: \"path\",\n hProperties: {\n d: \"M12 16v-4\",\n },\n },\n type: \"emphasis\",\n },\n {\n children: [],\n data: {\n hName: \"path\",\n hProperties: {\n d: \"M12 8h.01\",\n },\n },\n type: \"emphasis\",\n },\n ],\n success: [\n {\n children: [],\n data: {\n hName: \"path\",\n hProperties: {\n d: \"M20 6 9 17l-5-5\",\n },\n },\n type: \"emphasis\",\n },\n ],\n tip: [\n {\n children: [],\n data: {\n hName: \"path\",\n hProperties: {\n d: \"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\",\n },\n },\n type: \"emphasis\",\n },\n {\n children: [],\n data: {\n hName: \"path\",\n hProperties: {\n d: \"M9 18h6\",\n },\n },\n type: \"emphasis\",\n },\n {\n children: [],\n data: {\n hName: \"path\",\n hProperties: {\n d: \"M10 22h4\",\n },\n },\n type: \"emphasis\",\n },\n ],\n warning: [\n {\n children: [],\n data: {\n hName: \"path\",\n hProperties: {\n d: \"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\",\n },\n },\n type: \"emphasis\",\n },\n {\n children: [],\n data: {\n hName: \"path\",\n hProperties: {\n d: \"M12 9v4\",\n },\n },\n type: \"emphasis\",\n },\n {\n children: [],\n data: {\n hName: \"path\",\n hProperties: {\n d: \"M12 17h.01\",\n },\n },\n type: \"emphasis\",\n },\n ],\n}\n\nconst alertToEmphasis: Record<IconType, string> = {\n caution: \"danger\",\n note: \"neutral\",\n success: \"success\",\n tip: \"info\",\n warning: \"warning\",\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Code, Parent, Root} from \"mdast\"\nimport type {Plugin} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\ninterface Tab {\n index: number\n label: string\n meta: string | undefined\n tabsGroup: string\n}\n\nfunction parseTabAttributes(meta: string): {\n label: string | null\n remainingMeta: string\n tabsGroup: string | null\n} {\n if (!meta) {\n return {label: null, remainingMeta: \"\", tabsGroup: null}\n }\n\n const tabsMatch = meta.match(/tabs=[\"']([^\"']+)[\"']|tabs=(\\S+)/)\n const labelMatch = meta.match(/label=[\"']([^\"']+)[\"']|label=(\\S+)/)\n\n const tabsGroup = tabsMatch ? tabsMatch[1] || tabsMatch[2] : null\n const label = labelMatch ? labelMatch[1] || labelMatch[2] : null\n\n // Remove both tabs and label attributes from meta\n const remainingMeta = meta\n .replace(/\\s*tabs=[\"']([^\"']+)[\"']/g, \"\")\n .replace(/\\s*tabs=(\\S+)/g, \"\")\n .replace(/\\s*label=[\"']([^\"']+)[\"']/g, \"\")\n .replace(/\\s*label=(\\S+)/g, \"\")\n .trim()\n\n return {label, remainingMeta, tabsGroup}\n}\n\nfunction findConsecutiveTabs(\n startIndex: number,\n parent: Parent,\n targetTabsGroup: string,\n): Tab[] {\n const tabs: Tab[] = []\n let currentIndex = startIndex\n\n while (currentIndex < parent.children.length) {\n const currentNode = parent.children[currentIndex]\n\n if (!currentNode || currentNode.type !== \"code\") {\n break\n }\n\n const codeNode = currentNode\n\n if (!codeNode.meta) {\n break\n }\n\n const {label, remainingMeta, tabsGroup} = parseTabAttributes(codeNode.meta)\n\n // Only include if it matches the target tabs group and has a label\n if (!tabsGroup || !label || tabsGroup !== targetTabsGroup) {\n break\n }\n\n // Clean the original node's meta NOW\n codeNode.meta = remainingMeta || undefined\n\n tabs.push({\n index: currentIndex,\n label,\n meta: remainingMeta || undefined,\n tabsGroup,\n })\n\n if (remainingMeta && remainingMeta.includes(\"end\")) {\n break\n }\n\n currentIndex++\n }\n\n return tabs\n}\n\nfunction renderTabs(tabs: Tab[], parent: Parent): any[] {\n const tabsContainer = {\n attributes: [],\n children: [] as any[],\n name: \"CodeTabs\",\n type: \"mdxJsxFlowElement\",\n }\n\n for (const tab of tabs) {\n const codeNode = parent.children[tab.index] as Code\n\n const tabAttributes = [\n {\n name: \"label\",\n type: \"mdxJsxAttribute\",\n value: tab.label,\n },\n ]\n\n // Add meta to JSX element if it exists\n if (tab.meta) {\n tabAttributes.push({\n name: \"meta\",\n type: \"mdxJsxAttribute\",\n value: tab.meta,\n })\n }\n\n const tabElement = {\n attributes: tabAttributes,\n children: [\n {\n lang: codeNode.lang,\n meta: codeNode.meta, // This is now clean\n type: \"code\",\n value: codeNode.value,\n },\n ],\n name: \"CodeTab\",\n type: \"mdxJsxFlowElement\",\n }\n\n tabsContainer.children.push(tabElement)\n }\n\n return [tabsContainer]\n}\n\n/**\n * Very cool. TODO: document this https://docs.qui.qualcomm.com/guide/markdown\n *\n * @example\n * ```angular-html tabs=\"demo\" label=\"HTML\"\n * <div class=\"w-72\" q-text-input [invalid]=\"!value()\" [(ngModel)]=\"value\">\n * <label q-text-input-label>Label</label>\n * <input placeholder=\"Enter a value\" q-text-input-input />\n * <div q-text-input-error-text>You must enter a value</div>\n * </div>\n * ```\n *\n * ```angular-ts tabs=\"demo\" label=\"TS\"\n * @Component()\n * export class DemoComponent {\n * readonly value = signal(\"\")\n * }\n * ```\n */\nexport const remarkCodeTabs: Plugin<[], Root> = () => {\n return (tree) => {\n const transformations: Array<{\n endIndex: number\n parent: Parent\n replacement: any[]\n startIndex: number\n }> = []\n\n visit(\n tree,\n \"code\",\n (node: Code, index: number | undefined, parent: Parent | undefined) => {\n if (!node.meta || !parent || index === undefined) {\n return\n }\n\n const {label, tabsGroup} = parseTabAttributes(node.meta)\n if (!tabsGroup || !label) {\n return\n }\n\n const alreadyProcessed = transformations.some(\n (t) =>\n t.parent === parent && index >= t.startIndex && index < t.endIndex,\n )\n\n if (alreadyProcessed) {\n return\n }\n\n const tabs = findConsecutiveTabs(index, parent, tabsGroup)\n\n if (tabs.length > 1) {\n const startIndex = tabs[0].index\n const endIndex = tabs[tabs.length - 1].index + 1\n const newChildren = renderTabs(tabs, parent)\n\n transformations.push({\n endIndex,\n parent,\n replacement: newChildren,\n startIndex,\n })\n }\n },\n )\n\n transformations\n .sort((a, b) => b.startIndex - a.startIndex)\n .forEach((transformation) => {\n transformation.parent.children.splice(\n transformation.startIndex,\n transformation.endIndex - transformation.startIndex,\n ...transformation.replacement,\n )\n })\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Parent, Root} from \"mdast\"\nimport type {Plugin} from \"unified\"\nimport {SKIP, visit} from \"unist-util-visit\"\n\nexport type MetadataValue = Record<string, string | string[]>\n\n/**\n * Parses a YAML-like value, handling arrays and strings.\n */\nfunction parseValue(value: string): string | string[] {\n const trimmed = value.trim()\n\n // Handle array syntax: [item1, item2, item3]\n if (trimmed.startsWith(\"[\") && trimmed.endsWith(\"]\")) {\n const inner = trimmed.slice(1, -1)\n return inner\n .split(\",\")\n .map((item) => item.trim())\n .filter(Boolean)\n }\n\n return trimmed\n}\n\n/**\n * Parses the content of a meta block into key-value pairs.\n */\nfunction parseMetaContent(content: string): MetadataValue {\n const result: MetadataValue = {}\n const lines = content.split(\"\\n\")\n\n for (const line of lines) {\n const trimmed = line.trim()\n if (!trimmed || trimmed === \":::\") {\n continue\n }\n\n const colonIndex = trimmed.indexOf(\":\")\n if (colonIndex === -1) {\n continue\n }\n\n const key = trimmed.slice(0, colonIndex).trim()\n const value = trimmed.slice(colonIndex + 1).trim()\n\n if (key && value) {\n result[key] = parseValue(value)\n }\n }\n\n return result\n}\n\n/**\n * Parses the content of a terms block into a terms array.\n * Terms are a flat list, one per line.\n */\nfunction parseTermsContent(content: string): string[] {\n return content\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line && line !== \":::\")\n}\n\n/**\n * Extracts metadata from MDX files and removes it from the MDX content.\n *\n * Supports two formats:\n *\n * @example `::: meta` - YAML-like key-value pairs\n * ```\n * ::: meta\n * component: NumberInput\n * :::\n *\n * result: {component: \"NumberInput\"}\n * ```\n *\n * @example `::: terms` - flat list of terms\n * ```\n * ::: terms\n * forms\n * input\n * data entry\n * :::\n *\n * result: {terms: [\"forms\", \"input\", \"data entry\"]}\n * ```\n */\nexport const remarkExtractMeta: Plugin<[MetadataValue], Root> = (\n metadata = {},\n) => {\n return (tree) => {\n const nodesToRemove: Array<{index: number; parent: Parent}> = []\n\n visit(tree, \"paragraph\", (node, index, parent) => {\n if (!parent || index === undefined) {\n return\n }\n\n const firstChild = node.children[0]\n if (firstChild?.type !== \"text\") {\n return\n }\n\n const text = firstChild.value\n const metaMatch = text.match(/^:::\\s*meta\\s*/)\n const termsMatch = text.match(/^:::\\s*terms\\s*/)\n\n if (!metaMatch && !termsMatch) {\n return\n }\n\n const openMatch = metaMatch || termsMatch\n const isTermsBlock = !!termsMatch\n\n // Check if the entire block is in this single paragraph\n // (common when markdown parser keeps it together)\n if (\n text.includes(\":::\") &&\n text.lastIndexOf(\":::\") > openMatch![0].length\n ) {\n // Extract content between opening ::: and closing :::\n const afterOpen = text.slice(openMatch![0].length)\n const closeIndex = afterOpen.lastIndexOf(\":::\")\n const content = afterOpen.slice(0, closeIndex)\n\n if (isTermsBlock) {\n const terms = parseTermsContent(content)\n if (terms.length > 0) {\n const existing = metadata.terms\n metadata.terms = Array.isArray(existing)\n ? [...existing, ...terms]\n : terms\n }\n } else {\n const parsed = parseMetaContent(content)\n Object.assign(metadata, parsed)\n }\n\n nodesToRemove.push({index, parent})\n return SKIP\n }\n\n // Multi-paragraph case: collect text from multiple nodes\n // The block might span multiple text children\n let fullText = text\n for (let i = 1; i < node.children.length; i++) {\n const child = node.children[i]\n if (child.type === \"text\") {\n fullText += child.value\n }\n }\n\n // Check for closing ::: in the combined text\n const afterOpenFull = fullText.slice(openMatch![0].length)\n const closeIndexFull = afterOpenFull.lastIndexOf(\":::\")\n\n if (closeIndexFull !== -1) {\n const content = afterOpenFull.slice(0, closeIndexFull)\n\n if (isTermsBlock) {\n const terms = parseTermsContent(content)\n if (terms.length > 0) {\n const existing = metadata.terms\n metadata.terms = Array.isArray(existing)\n ? [...existing, ...terms]\n : terms\n }\n } else {\n const parsed = parseMetaContent(content)\n Object.assign(metadata, parsed)\n }\n\n nodesToRemove.push({index, parent})\n return SKIP\n }\n })\n\n // Remove blocks from AST (in reverse order to preserve indices)\n for (let i = nodesToRemove.length - 1; i >= 0; i--) {\n const {index, parent} = nodesToRemove[i]\n parent.children.splice(index, 1)\n }\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Parent, Root} from \"mdast\"\nimport type {Plugin} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\ninterface MdxFlowExpression {\n type: \"mdxFlowExpression\"\n value: string\n}\n\n/**\n * Wraps standalone `{frontmatter.description}` expressions in a\n * `<p class=\"mdx\">` element for styling purposes.\n */\nexport const remarkFrontmatterDescription: Plugin<[], Root> = () => {\n return (tree) => {\n visit(\n tree,\n \"mdxFlowExpression\",\n (\n node: MdxFlowExpression,\n index: number | undefined,\n parent: Parent | undefined,\n ) => {\n if (\n node.value.trim() !== \"frontmatter.description\" ||\n index === undefined ||\n !parent\n ) {\n return\n }\n\n const wrappedNode = {\n attributes: [\n {\n name: \"className\",\n type: \"mdxJsxAttribute\",\n value: \"mdx qui-docs__page-description\",\n },\n ],\n children: [node],\n name: \"p\",\n type: \"mdxJsxFlowElement\",\n }\n\n parent.children[index] = wrappedNode as any\n },\n )\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Parent, Root, Text} from \"mdast\"\nimport type {Plugin} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\nimport type {PageFrontmatter} from \"@qualcomm-ui/mdx-common\"\n\ninterface MdxExpression {\n type: \"mdxFlowExpression\" | \"mdxTextExpression\"\n value: string\n}\n\nconst FRONTMATTER_PATTERN = /^\\s*frontmatter\\.(\\w+)\\s*$/\n\nfunction isMdxExpression(node: unknown): node is MdxExpression {\n const n = node as {type?: string; value?: unknown}\n return (\n (n.type === \"mdxFlowExpression\" || n.type === \"mdxTextExpression\") &&\n typeof n.value === \"string\"\n )\n}\n\n/**\n * Replaces `{frontmatter.*}` expressions with their actual values from the\n * frontmatter object. This is safer than string replacement as it operates\n * on the AST and won't accidentally match text in code blocks or examples.\n */\nexport const remarkFrontmatterInterpolation: Plugin<[PageFrontmatter], Root> = (\n frontmatter,\n) => {\n return (tree) => {\n visit(tree, (node, index, parent) => {\n if (!isMdxExpression(node) || index === undefined || !parent) {\n return\n }\n\n const match = node.value.match(FRONTMATTER_PATTERN)\n if (!match) {\n return\n }\n\n const key = match[1] as keyof PageFrontmatter\n const value = frontmatter[key]\n\n if (typeof value === \"string\" || typeof value === \"number\") {\n const textNode: Text = {\n type: \"text\",\n value: String(value),\n }\n ;(parent as Parent).children[index] = textNode\n }\n })\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Heading, Parent, Root} from \"mdast\"\nimport type {Plugin} from \"unified\"\nimport {EXIT, visit} from \"unist-util-visit\"\n\n/**\n * Replaces the first h1 heading in the document with a `PageHeader`\n * JSX element. This allows the page title to be enhanced with extra features\n * like a since tag or a copy markdown button.\n */\nexport const remarkFrontmatterTitle: Plugin<[], Root> = () => {\n return (tree) => {\n visit(\n tree,\n \"heading\",\n (node: Heading, index, parent: Parent | undefined) => {\n if (index === undefined || !parent || node.depth !== 1) {\n return\n }\n\n const wrappedNode = {\n attributes: [],\n children: node.children,\n name: \"PageHeader\",\n type: \"mdxJsxFlowElement\",\n }\n\n parent.children[index] = wrappedNode as (typeof parent.children)[number]\n\n return EXIT\n },\n )\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Plugin} from \"unified\"\nimport {remove} from \"unist-util-remove\"\n\nexport const remarkRemoveMermaidCodeBlocks: Plugin = () => {\n return (tree, _file, done) => {\n remove(tree, (node: any) => node.type === \"code\" && node.lang === \"mermaid\")\n done()\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Plugin} from \"unified\"\nimport {remove} from \"unist-util-remove\"\n\nexport const remarkRemoveJsx: Plugin = () => {\n return (tree, _file, done) => {\n remove(tree, \"mdxjsEsm\")\n remove(tree, \"mdxJsxFlowElement\")\n remove(tree, \"mdxJsxTextElement\")\n done()\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Heading, Link, Root} from \"mdast\"\nimport {toString} from \"mdast-util-to-string\"\nimport type {Plugin} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\nexport interface RemarkSelfLinkOptions {\n /**\n * @default [2, 3, 4]\n */\n allowedLevels?: number[]\n prefix?: string\n}\n\nconst emptyOptions: RemarkSelfLinkOptions = {}\n\nexport function remarkSelfLinkHeadings(\n baseUrl: string = \"\",\n options?: RemarkSelfLinkOptions | null,\n): Plugin<[], Root> {\n if (!baseUrl) {\n return () => {}\n }\n return () => {\n const settings = options || emptyOptions\n const prefix = settings.prefix || \"\"\n const allowedLevels = new Set<number>(settings.allowedLevels || [2, 3, 4])\n const seenIds = new Map<string, number>()\n\n function createSlug(text: string): string {\n const cleaned = text\n .replace(/[<>]/g, \"\")\n .replace(/[^\\w\\s-]/g, \"\")\n .trim()\n\n let slug: string\n if (cleaned.includes(\" \")) {\n slug = cleaned\n .toLowerCase()\n .replace(/\\s+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n } else if ((cleaned.match(/[A-Z]/g) || []).length >= 2) {\n slug = cleaned\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/([A-Z]+)([A-Z][a-z])/g, \"$1-$2\")\n .toLowerCase()\n } else {\n slug = cleaned.toLowerCase()\n }\n\n const count = seenIds.get(slug) || 0\n seenIds.set(slug, count + 1)\n return count > 0 ? `${slug}-${count}` : slug\n }\n\n return (tree) => {\n seenIds.clear()\n visit(tree, \"heading\", (node: Heading) => {\n if (allowedLevels.has(node.depth)) {\n const text = toString(node)\n const slug = prefix + createSlug(text)\n\n const linkNode: Link = {\n children: node.children,\n type: \"link\",\n url: `${baseUrl}#${slug}`,\n }\n\n node.children = [linkNode]\n }\n })\n }\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {BlockContent, Root} from \"mdast\"\nimport type {Plugin} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\nfunction getSerializeJsxStartMatch(text: string) {\n return text.match(/^:::\\s*serialize-jsx\\s*$/)\n}\n\nfunction getSerializeJsxEndMatch(text: string) {\n return text.trim() === \":::\"\n}\n\n/**\n * @since 3.8.0\n */\nexport function isSerializeJsxBlock(text: string): boolean {\n return !!getSerializeJsxStartMatch(text) || !!getSerializeJsxEndMatch(text)\n}\n\nconst isJsxNode = (node: {type: string}) =>\n node.type === \"mdxJsxFlowElement\" || node.type === \"mdxJsxTextElement\"\n\nfunction createSerializeJsxPlugin(\n filter: (node: BlockContent) => boolean,\n): Plugin<[], Root> {\n return () => (tree) => {\n visit(tree, \"paragraph\", (node, index, parent) => {\n if (!parent || index === undefined) {\n return\n }\n\n const firstChild = node.children[0]\n if (firstChild?.type !== \"text\") {\n return\n }\n\n if (!getSerializeJsxStartMatch(firstChild.value)) {\n return\n }\n\n let endIndex = index + 1\n const contentNodes: BlockContent[] = []\n\n while (endIndex < parent.children.length) {\n const child = parent.children[endIndex]\n\n if (child.type === \"paragraph\") {\n const firstText = child.children[0]\n if (\n firstText?.type === \"text\" &&\n getSerializeJsxEndMatch(firstText.value)\n ) {\n break\n }\n }\n\n contentNodes.push(child as BlockContent)\n endIndex++\n }\n\n // No closing ::: found — leave the block untouched\n if (endIndex >= parent.children.length) {\n return\n }\n\n parent.children.splice(\n index,\n endIndex - index + 1,\n ...contentNodes.filter(filter),\n )\n })\n }\n}\n\n/**\n * Render-pipeline variant. Keeps only the JSX children of a\n * `::: serialize-jsx` block; discards the prose and the markers.\n *\n * The prose is export-only metadata — it must not appear on the rendered site\n * where the interactive component already provides the content.\n *\n * @example\n * ```mdx\n * ::: serialize-jsx\n *\n * Reordering the `children` array reorders nested pages — \"Overview\" appears\n * before \"Troubleshooting\" because its entry comes first.\n *\n * <NestedRouteOrderDemo />\n *\n * :::\n * ```\n *\n * Result in the render pipeline:\n * ```mdx\n * <NestedRouteOrderDemo />\n * ```\n *\n * @since 3.8.0\n */\nexport const remarkSerializeJsxRender: Plugin<[], Root> =\n createSerializeJsxPlugin(isJsxNode)\n\n/**\n * Knowledge-export-pipeline variant. Keeps only the non-JSX children of a\n * `::: serialize-jsx` block; discards the JSX and the markers.\n *\n * The JSX element is already removed by `remarkRemoveJsx` in the knowledge\n * export pipeline — this plugin ensures the prose stand-in replaces it.\n *\n * @example\n * ```mdx\n * ::: serialize-jsx\n *\n * Reordering the `children` array reorders nested pages — \"Overview\" appears\n * before \"Troubleshooting\" because its entry comes first.\n *\n * <NestedRouteOrderDemo />\n *\n * :::\n * ```\n *\n * Result in the knowledge export pipeline:\n * ```md\n * Reordering the `children` array reorders nested pages — \"Overview\" appears\n * before \"Troubleshooting\" because its entry comes first.\n * ```\n *\n * @since 3.8.0\n */\nexport const remarkSerializeJsxKnowledge: Plugin<[], Root> =\n createSerializeJsxPlugin((n) => !isJsxNode(n))\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {BlockContent, Root} from \"mdast\"\nimport type {Plugin} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\ninterface SpoilerOptions {\n defaultSummary?: string\n detailsClassName?: string[]\n summaryClassName?: string[]\n}\n\nfunction getSpoilerStartMatch(text: string) {\n return text.match(/^:::\\s*spoiler\\s*(.*)$/)\n}\n\nfunction getSpoilerEndMatch(text: string) {\n return text.trim() === \":::\"\n}\n\nexport function isSpoilerBlock(text: string): boolean {\n return !!getSpoilerStartMatch(text) || getSpoilerEndMatch(text)\n}\n\n/**\n * Transforms spoiler blocks into MDX components.\n *\n * @example\n * ```\n * ::: spoiler Title\n *\n * Content\n *\n * :::\n * ```\n *\n * result:\n *\n * ```jsx\n * <SpoilerRoot>\n * <SpoilerTrigger><p>Title</p></SpoilerTrigger>\n * <SpoilerContent>Content</SpoilerContent>\n * </SpoilerRoot>\n * ```\n */\nexport const remarkSpoilers: Plugin<[SpoilerOptions?], Root> = (\n options = {},\n) => {\n const {\n defaultSummary = \"Open spoiler\",\n detailsClassName = [],\n summaryClassName = [],\n } = options\n\n return (tree) => {\n visit(tree, \"paragraph\", (node, index, parent) => {\n if (!parent || index === undefined) {\n return\n }\n\n const firstChild = node.children[0]\n if (firstChild?.type !== \"text\") {\n return\n }\n\n const match = getSpoilerStartMatch(firstChild.value)\n if (!match) {\n return\n }\n\n const summary = match[1].trim() || defaultSummary\n let endIndex = index + 1\n const contentNodes: BlockContent[] = []\n\n while (endIndex < parent.children.length) {\n const child = parent.children[endIndex]\n\n if (child.type === \"paragraph\") {\n const firstText = child.children[0]\n if (\n firstText?.type === \"text\" &&\n getSpoilerEndMatch(firstText.value.trim())\n ) {\n break\n }\n }\n\n contentNodes.push(child as BlockContent)\n endIndex++\n }\n\n if (endIndex >= parent.children.length) {\n return\n }\n\n const summaryNode: BlockContent = {\n attributes: summaryClassName.length\n ? [\n {\n name: \"className\",\n type: \"mdxJsxAttribute\",\n value: summaryClassName.join(\" \"),\n },\n ]\n : [],\n children: [\n {\n children: [{type: \"text\", value: summary}],\n type: \"paragraph\",\n },\n ],\n name: \"SpoilerSummary\",\n type: \"mdxJsxFlowElement\",\n }\n\n const contentNode: BlockContent = {\n attributes: [],\n children: contentNodes,\n name: \"SpoilerContent\",\n type: \"mdxJsxFlowElement\",\n }\n\n const detailsNode: BlockContent = {\n attributes: detailsClassName.length\n ? [\n {\n name: \"className\",\n type: \"mdxJsxAttribute\",\n value: detailsClassName.join(\" \"),\n },\n ]\n : [],\n children: [summaryNode, contentNode],\n name: \"SpoilerRoot\",\n type: \"mdxJsxFlowElement\",\n }\n\n parent.children.splice(index, endIndex - index + 1, detailsNode)\n })\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {BlockContent, Heading, Root} from \"mdast\"\nimport type {Plugin} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\nconst defaultAllowedHeadings = new Set([2, 3, 4])\n\n/**\n * Parses a heading specifier into a Set of depths.\n * Supports a single level (`h2`) or a range (`h2-h5`).\n * Returns `undefined` for invalid input.\n */\nfunction parseHeadingRange(value: string): Set<number> | undefined {\n const match = value.match(/^h([1-6])(?:-h([1-6]))?$/)\n if (!match) {\n return undefined\n }\n\n const start = Number(match[1])\n const end = match[2] ? Number(match[2]) : start\n if (start > end) {\n return undefined\n }\n\n const depths = new Set<number>()\n for (let i = start; i <= end; i++) {\n depths.add(i)\n }\n return depths\n}\n\nfunction isHeading(node: {type: string}): node is Heading {\n return node.type === \"heading\"\n}\n\nfunction getStepStartMatch(text: string) {\n return text.match(/^:::\\s*steps(?:\\s+(h[1-6](?:-h[1-6])?))?\\s*$/)\n}\n\nfunction getStepEndMatch(text: string) {\n return text.match(/^:::\\s*\\/steps\\s*$/)\n}\n\nexport function isStepBlock(text: string): boolean {\n return !!(getStepStartMatch(text) || getStepEndMatch(text))\n}\n\n/**\n * Transforms `:::steps` blocks into a styled `<div>` wrapper.\n *\n * Accepts an optional heading specifier to control which headings receive\n * step numbering. Supports a single level (`h3`) or a range (`h2-h5`).\n * Defaults to `h2-h4`.\n *\n * @example\n * ```\n * :::steps\n *\n * ## Step 1\n *\n * Content for step 1.\n *\n * ## Step 2\n *\n * Content for step 2.\n *\n * :::/steps\n * ```\n *\n * With a single heading level:\n *\n * ```\n * :::steps h3\n *\n * ### Step 1\n *\n * :::/steps\n * ```\n *\n * With a custom heading range:\n *\n * ```\n * :::steps h2-h5\n *\n * ## Step 1\n *\n * :::/steps\n * ```\n *\n * result:\n *\n * ```jsx\n * <div className=\"qui-docs__steps\">\n * <h2 data-step>Step 1</h2>\n * <p>Content for step 1.</p>\n * <h2 data-step>Step 2</h2>\n * <p>Content for step 2.</p>\n * </div>\n * ```\n */\nexport const remarkSteps: Plugin<[], Root> = () => {\n return (tree) => {\n visit(tree, \"paragraph\", (node, index, parent) => {\n if (!parent || index === undefined) {\n return\n }\n\n const firstChild = node.children[0]\n if (firstChild?.type !== \"text\") {\n return\n }\n\n const match = getStepStartMatch(firstChild.value)\n if (!match) {\n return\n }\n\n const allowedHeadings = match[1]\n ? (parseHeadingRange(match[1]) ?? defaultAllowedHeadings)\n : defaultAllowedHeadings\n\n let endIndex = index + 1\n const contentNodes: BlockContent[] = []\n\n while (endIndex < parent.children.length) {\n const child = parent.children[endIndex]\n\n if (child.type === \"paragraph\") {\n const firstText = child.children[0]\n if (firstText?.type === \"text\" && getStepEndMatch(firstText.value)) {\n break\n }\n }\n\n if (isHeading(child) && allowedHeadings.has(child.depth)) {\n child.data = {\n ...child.data,\n hProperties: {\n ...(child.data as {hProperties?: Record<string, unknown>})\n ?.hProperties,\n \"data-step\": \"\",\n },\n }\n }\n\n contentNodes.push(child as BlockContent)\n endIndex++\n }\n\n if (endIndex >= parent.children.length) {\n return\n }\n\n const stepsNode: BlockContent = {\n attributes: [],\n children: contentNodes,\n name: \"HeadingSteps\",\n type: \"mdxJsxFlowElement\",\n }\n\n parent.children.splice(index, endIndex - index + 1, stepsNode)\n })\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Root} from \"mdast\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkMdx from \"remark-mdx\"\nimport remarkParse from \"remark-parse\"\nimport remarkStringify from \"remark-stringify\"\nimport {type PluggableList, type Processor, unified} from \"unified\"\n\nimport type {PageFrontmatter} from \"@qualcomm-ui/mdx-common\"\n\nimport {\n remarkAlerts,\n remarkExtractMeta,\n remarkFrontmatterInterpolation,\n remarkRemoveJsx,\n remarkRemoveMermaidCodeBlocks,\n} from \"../remark/index.js\"\n\nexport interface RemarkPipelineOptions {\n /** GitHub-style alert blocks. */\n alerts?: boolean\n /**\n * Strip :::meta::: and :::terms::: blocks, storing extracted data in the provided\n * object.\n */\n extractMeta?: Record<string, string | string[]>\n /** Include remarkFrontmatter for YAML front matter. */\n frontmatter?: boolean\n /** Include remarkGfm for GitHub Flavored Markdown. */\n gfm?: boolean\n /** Interpolate {frontmatter.*} expressions in the content. */\n interpolateFrontmatter?: PageFrontmatter\n /** Include remarkMdx for MDX parsing. */\n mdx?: boolean\n /**\n * \"md\" appends remarkStringify; \"none\" (default) leaves serialization to the\n * caller.\n */\n output?: \"md\" | \"none\"\n /** Additional remark plugins appended after built-in transforms. */\n plugins?: PluggableList\n /** Strip JSX/MDX elements from the AST. */\n removeJsx?: boolean\n /** Remove mermaid code blocks. */\n removeMermaidCodeBlocks?: boolean\n}\n\n/**\n * Creates a configured unified remark processor. The caller can further extend\n * the returned processor with `.use()` (e.g. to add remarkRehype for HTML output).\n */\nexport function createRemarkProcessor(\n options: RemarkPipelineOptions = {},\n): Processor<Root, undefined, undefined, undefined, undefined> {\n const processor = unified().use(remarkParse)\n\n if (options.mdx) {\n processor.use(remarkMdx)\n }\n if (options.frontmatter) {\n processor.use(remarkFrontmatter, [\"yaml\"])\n }\n\n // Transform plugins — order matters\n if (options.removeJsx) {\n processor.use(remarkRemoveJsx)\n }\n if (options.removeMermaidCodeBlocks) {\n processor.use(remarkRemoveMermaidCodeBlocks)\n }\n if (options.gfm) {\n processor.use(remarkGfm)\n }\n if (options.alerts) {\n processor.use(remarkAlerts)\n }\n if (options.interpolateFrontmatter) {\n processor.use(\n remarkFrontmatterInterpolation,\n options.interpolateFrontmatter,\n )\n }\n if (options.extractMeta) {\n processor.use(remarkExtractMeta, options.extractMeta)\n }\n\n if (options.plugins) {\n for (const plugin of options.plugins) {\n if (Array.isArray(plugin)) {\n processor.use(...plugin)\n } else {\n // @ts-expect-error mdast types\n processor.use(plugin)\n }\n }\n }\n\n if (options.output === \"md\") {\n processor.use(remarkStringify)\n }\n\n return processor\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {MdxJsxAttribute} from \"mdast-util-mdx-jsx\"\nimport remarkMdx from \"remark-mdx\"\nimport remarkParse from \"remark-parse\"\nimport remarkStringify from \"remark-stringify\"\nimport {type Plugin, unified} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\nimport {\n type PageDocProps,\n type PageHeading,\n type PagePropType,\n UniqueIdService,\n} from \"@qualcomm-ui/mdx-common\"\nimport type {\n QuiPropDeclaration,\n QuiPropTypes,\n} from \"@qualcomm-ui/typedoc-common\"\n\nimport {\n extractNamesFromAttribute,\n type IndexedSection,\n} from \"../markdown/index.js\"\n\nfunction extractPickPropsRecord(\n node: MdxJsxAttribute,\n): Record<string, string[]> | null {\n if (\n node.name !== \"unionWithPick\" ||\n !node.value ||\n typeof node.value === \"string\"\n ) {\n return null\n }\n\n const estree = node.value.data?.estree\n if (!estree?.body?.[0] || estree.body[0].type !== \"ExpressionStatement\") {\n return null\n }\n\n const expression = estree.body[0].expression\n if (expression.type !== \"ObjectExpression\") {\n return null\n }\n\n const result: Record<string, string[]> = {}\n\n for (const property of expression.properties) {\n if (property.type !== \"Property\" || property.key.type !== \"Identifier\") {\n continue\n }\n\n if (property.value.type !== \"ArrayExpression\") {\n continue\n }\n\n const key = property.key.name\n const values: string[] = []\n\n for (const element of property.value.elements) {\n if (element?.type === \"Literal\" && typeof element.value === \"string\") {\n values.push(element.value)\n }\n }\n\n result[key] = values\n }\n\n return result\n}\n\nexport const docPropsJsxNodes: string[] = [\n \"TypeDocProps\",\n \"TypeDocAttributes\",\n \"TypeDocAngularAttributes\",\n \"TypeDocFunction\",\n]\n\ninterface DocPropEntry {\n name: string\n omitFrom?: string[]\n}\n\nexport class DocPropsIndexer {\n docPropsEntries: DocPropEntry[] = []\n idService: UniqueIdService = new UniqueIdService()\n private readonly props: Record<string, QuiPropTypes>\n private pageDocProps: PageDocProps = {}\n\n constructor(props: Record<string, QuiPropTypes>) {\n this.props = props\n }\n\n reset(): void {\n this.idService.reset()\n this.docPropsEntries = []\n }\n\n /**\n * Finds all JSX `<TypeDocProps />` nodes on the current page and adds their names\n * to an array. Once all nodes have been collected, we process them into\n * `PageSection` entries for the search index.\n */\n getTypeDocPropsNodes: Plugin = () => {\n return (tree, _file, done) => {\n visit(tree, \"mdxJsxFlowElement\", (node: any) => {\n if (node && \"name\" in node && docPropsJsxNodes.includes(node.name)) {\n const nameAttr = node.attributes?.find(\n (attr: MdxJsxAttribute) => attr.name === \"name\",\n )\n const omitFromAttr = node.attributes?.find(\n (attr: MdxJsxAttribute) => attr.name === \"omitFrom\",\n )\n const omitFrom = omitFromAttr\n ? extractNamesFromAttribute(omitFromAttr)\n : undefined\n\n if (nameAttr) {\n const names = extractNamesFromAttribute(nameAttr)\n for (const name of names) {\n this.docPropsEntries.push({name, omitFrom})\n if (name.endsWith(\"Props\")) {\n // also index the corresponding component for lookup on this page.\n this.docPropsEntries.push({name: name.slice(0, -5), omitFrom})\n }\n }\n }\n\n const unionWithPickAttr: MdxJsxAttribute = node.attributes?.find(\n (attr: MdxJsxAttribute) => attr.name === \"unionWithPick\",\n )\n if (unionWithPickAttr) {\n try {\n const unionWithPick = extractPickPropsRecord(unionWithPickAttr)\n if (unionWithPick) {\n this.docPropsEntries.push(\n ...Object.keys(unionWithPick).map((entry) => ({\n name: entry,\n omitFrom,\n })),\n )\n }\n } catch {}\n }\n }\n })\n done()\n }\n }\n\n build(fileContents: string, toc: PageHeading[]): IndexedSection[] | null {\n // parse the Markdown into an AST\n unified()\n .use(remarkMdx)\n // find the TypeDocProp nodes\n .use(this.getTypeDocPropsNodes)\n .use(remarkParse)\n .use(remarkStringify)\n .processSync(fileContents)\n\n if (!this.docPropsEntries.length) {\n return null\n }\n\n for (const item of toc) {\n this.idService.add(item.id)\n }\n\n return this.docPropsEntries\n .map((entry): IndexedSection[] => {\n const propTypes = this.props[entry.name]\n if (!propTypes) {\n return []\n }\n\n const omittedProps = new Set<string>(\n (entry.omitFrom ?? [])\n .map((entry) => {\n const propTypes = this.props[entry]\n if (!propTypes) {\n return []\n }\n return [\n propTypes.props,\n propTypes.input,\n propTypes.output,\n propTypes.publicMethods,\n ].reduce((acc: string[], current) => {\n if (current) {\n acc.push(...current.map((prop) => prop.name))\n }\n return acc\n }, [])\n })\n .flat(1)\n .filter(Boolean),\n )\n\n const sections: IndexedSection[] = []\n\n const assembleProps = (\n propsInput: QuiPropDeclaration[] | undefined,\n ): PagePropType[] | undefined => {\n if (!propsInput) {\n return undefined\n }\n const props: PagePropType[] = []\n for (const prop of propsInput) {\n if (omittedProps.has(prop.name)) {\n continue\n }\n const id = this.idService.add(prop.name)\n props.push({...prop, id})\n sections.push(this.assembleProp(prop, id))\n }\n return props\n }\n\n const resolvedType = propTypes.resolvedType\n const functionParameters =\n resolvedType?.type === \"signature\" &&\n resolvedType.functionParameters?.length\n ? this.assembleFunctionParams(\n resolvedType.functionParameters,\n sections,\n )\n : undefined\n\n this.pageDocProps[entry.name] = {\n ...this.props[entry.name],\n input: assembleProps(propTypes.input),\n output: assembleProps(propTypes.output),\n props: assembleProps(propTypes.props),\n publicMethods: assembleProps(propTypes.publicMethods),\n resolvedType: functionParameters\n ? {...resolvedType!, functionParameters}\n : resolvedType,\n }\n return sections\n })\n .flat()\n }\n\n getDocProps(): PageDocProps {\n return this.docPropsEntries.reduce((acc: PageDocProps, entry) => {\n const propTypes = this.pageDocProps[entry.name]\n // TODO: convert code comments to HTML using rehype. Remove markdown-to-jsx\n // in @qualcomm-ui/react-mdx library.\n if (propTypes) {\n acc[entry.name] = propTypes\n }\n return acc\n }, {})\n }\n\n private assembleFunctionParams(\n params: QuiPropDeclaration[],\n sections: IndexedSection[],\n ): PagePropType[] {\n return params.map((param) => {\n const id = this.idService.add(param.name)\n sections.push(this.assembleProp(param, id))\n\n const args = param.args?.length\n ? this.assembleFunctionParams(param.args, sections)\n : undefined\n\n return {...param, args, id}\n })\n }\n\n private assembleProp(prop: QuiPropDeclaration, id: string): IndexedSection {\n const name = prop.name\n\n const heading: PageHeading = {\n headingLevel: 4,\n id,\n tagName: \"a\",\n textContent: name,\n }\n\n const comment = prop.comment\n if (!comment) {\n return {content: [], heading}\n }\n\n const content = {\n tagName: \"p\",\n text: [\n comment.summary\n .map((entry) => entry.text.replaceAll(\"\\n\", \" \"))\n .join(\"\"),\n ],\n }\n return {content: [content], heading}\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport chalk from \"chalk\"\nimport type {Link, Root} from \"mdast\"\nimport type {\n MdxJsxAttribute,\n MdxJsxFlowElement,\n MdxJsxTextElement,\n} from \"mdast-util-mdx-jsx\"\nimport {posix} from \"node:path\"\nimport {visit} from \"unist-util-visit\"\n\nimport type {PageMap} from \"@qualcomm-ui/mdx-common\"\n\nexport interface CollectedLink {\n fragment?: string\n sourceFile: string\n sourcePathname: string\n targetPathname: string\n url: string\n}\n\nexport interface InvalidLink extends CollectedLink {\n reason: \"fragment-not-found\" | \"page-not-found\"\n}\n\nconst externalPrefixes = [\"https://\", \"http://\", \"mailto:\", \"tel:\"]\n\nfunction isExternal(url: string): boolean {\n return externalPrefixes.some((prefix) => url.startsWith(prefix))\n}\n\n/**\n * Resolves a raw markdown link URL into a pathname and optional fragment.\n * Returns null for external links that should be skipped.\n */\nexport function resolveLink(\n url: string,\n sourcePathname: string,\n): {fragment?: string; pathname: string} | null {\n if (isExternal(url)) {\n return null\n }\n\n const [rawPath, fragment] = url.split(\"#\", 2)\n\n let pathname: string\n if (!rawPath || rawPath === \"./\" || rawPath === \".\") {\n pathname = sourcePathname\n } else if (rawPath.startsWith(\"/\")) {\n pathname = rawPath\n } else {\n // Relative path — resolve against the source page's \"directory\"\n const sourceDir = sourcePathname.endsWith(\"/\")\n ? sourcePathname\n : posix.dirname(sourcePathname)\n pathname = posix.resolve(sourceDir, rawPath)\n }\n\n // Normalize trailing slashes\n if (pathname !== \"/\" && pathname.endsWith(\"/\")) {\n pathname = pathname.slice(0, -1)\n }\n\n return {fragment: fragment || undefined, pathname}\n}\n\n/**\n * Walks the AST and collects all internal links from a parsed MDX page.\n */\nexport function collectLinks(\n tree: Root,\n sourceFile: string,\n sourcePathname: string,\n): CollectedLink[] {\n const links: CollectedLink[] = []\n\n visit(tree, \"link\", (node: Link) => {\n const resolved = resolveLink(node.url, sourcePathname)\n if (!resolved) {\n return\n }\n\n links.push({\n fragment: resolved.fragment,\n sourceFile,\n sourcePathname,\n targetPathname: resolved.pathname,\n url: node.url,\n })\n })\n\n return links\n}\n\nfunction getLiteralAttributeValue(\n node: MdxJsxFlowElement | MdxJsxTextElement,\n name: string,\n): string | undefined {\n const attr = node.attributes.find(\n (attribute): attribute is MdxJsxAttribute =>\n attribute.type === \"mdxJsxAttribute\" && attribute.name === name,\n )\n\n return typeof attr?.value === \"string\" ? attr.value : undefined\n}\n\n/**\n * Walks the MDX AST and collects explicit HTML anchor IDs that can be used as\n * fragment targets but should not appear in the page ToC.\n */\nexport function collectAnchorIds(tree: Root): Set<string> {\n const anchorIds = new Set<string>()\n\n const collectAnchorId = (node: MdxJsxFlowElement | MdxJsxTextElement) => {\n if (node.name !== \"a\") {\n return\n }\n\n const id = getLiteralAttributeValue(node, \"id\")\n if (id) {\n anchorIds.add(id)\n }\n }\n\n visit(tree, \"mdxJsxFlowElement\", collectAnchorId)\n visit(tree, \"mdxJsxTextElement\", collectAnchorId)\n\n return anchorIds\n}\n\n/**\n * Validates collected links against the fully assembled page map.\n * The optional ID maps provide additional valid fragment targets generated by\n * TypeDocProps or explicit MDX anchor elements on each page.\n */\nexport function validateLinks(\n links: CollectedLink[],\n pageMap: PageMap,\n docPropIds?: Record<string, Set<string>>,\n anchorIds?: Record<string, Set<string>>,\n): InvalidLink[] {\n const invalid: InvalidLink[] = []\n\n for (const link of links) {\n const page = pageMap[link.targetPathname]\n\n if (!page) {\n invalid.push({...link, reason: \"page-not-found\"})\n continue\n }\n\n if (link.fragment) {\n const inToc = page.toc?.some((h) => h.id === link.fragment)\n const inDocProps = docPropIds?.[link.targetPathname]?.has(link.fragment)\n const inAnchorIds = anchorIds?.[link.targetPathname]?.has(link.fragment)\n if (!inToc && !inDocProps && !inAnchorIds) {\n invalid.push({...link, reason: \"fragment-not-found\"})\n }\n }\n }\n\n return invalid\n}\n\n/**\n * Logs invalid links to the console grouped by source page.\n */\nexport function reportInvalidLinks(invalidLinks: InvalidLink[]): void {\n if (invalidLinks.length === 0) {\n return\n }\n\n const grouped = new Map<string, InvalidLink[]>()\n for (const link of invalidLinks) {\n const existing = grouped.get(link.sourcePathname) ?? []\n existing.push(link)\n grouped.set(link.sourcePathname, existing)\n }\n\n console.debug(\n `\\n${chalk.yellowBright.bold(`Found ${invalidLinks.length} broken link${invalidLinks.length === 1 ? \"\" : \"s\"}:`)}`,\n )\n\n for (const [sourcePathname, links] of grouped) {\n console.debug(`\\n ${chalk.blueBright.bold(sourcePathname)}`)\n for (const link of links) {\n const reason =\n link.reason === \"page-not-found\"\n ? \"page not found\"\n : `fragment \"#${link.fragment}\" not found`\n console.debug(` ${chalk.red(\"x\")} ${link.url} — ${reason}`)\n }\n }\n\n console.debug(\"\")\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createHash} from \"node:crypto\"\nimport {access, readFile} from \"node:fs/promises\"\nimport {dirname, join, resolve} from \"node:path\"\nimport ts from \"typescript\"\n\nimport type {ImportedModule} from \"./types.js\"\n\nexport async function exists(dirPath: string): Promise<boolean> {\n return access(dirPath)\n .then(() => true)\n .catch(() => false)\n}\n\nexport function computeMd5(content: string): string {\n return createHash(\"md5\").update(content).digest(\"hex\")\n}\n\nexport function isPreviewLine(trimmedLine: string): boolean {\n return (\n trimmedLine === \"// preview\" ||\n /^\\{\\s*\\/\\*\\s*preview\\s*\\*\\/\\s*\\}$/.test(trimmedLine) ||\n /^<!--\\s*preview\\s*-->$/.test(trimmedLine)\n )\n}\n\nexport function removePreviewLines(code: string): string {\n return code\n .split(\"\\n\")\n .filter((line) => !isPreviewLine(line.trim()))\n .join(\"\\n\")\n}\n\nexport function getIntroLines(\n projectName?: string,\n description?: string,\n): string {\n const lines: string[] = []\n\n if (projectName) {\n lines.push(`# ${projectName}`)\n }\n\n if (description) {\n lines.push(\"\")\n lines.push(`> ${description}`)\n }\n\n return lines.join(\"\\n\")\n}\n\nexport function extractRelativeImports(content: string): string[] {\n const sourceFile = ts.createSourceFile(\n \"temp.ts\",\n content,\n ts.ScriptTarget.Latest,\n false,\n ts.ScriptKind.TSX,\n )\n\n const imports: string[] = []\n\n for (const statement of sourceFile.statements) {\n if (\n ts.isImportDeclaration(statement) &&\n ts.isStringLiteral(statement.moduleSpecifier)\n ) {\n const path = statement.moduleSpecifier.text\n if (path.startsWith(\".\")) {\n imports.push(path)\n }\n }\n }\n\n return imports\n}\n\nexport async function resolveModulePath(\n importPath: string,\n fromFile: string,\n): Promise<string | null> {\n const fromDir = dirname(fromFile)\n const baseResolved = resolve(fromDir, importPath)\n const extensions = [\".ts\", \".tsx\", \".js\", \".jsx\", \"\"]\n for (const ext of extensions) {\n const fullPath = baseResolved + ext\n if (await exists(fullPath)) {\n return fullPath\n }\n }\n if (await exists(baseResolved)) {\n const indexPath = join(baseResolved, \"index.ts\")\n if (await exists(indexPath)) {\n return indexPath\n }\n }\n return null\n}\n\nexport function extractMetadata(\n metadata: Record<string, string> | undefined,\n): [string, string][] {\n return Object.entries(metadata ?? {})\n}\n\nexport async function collectRelativeImports(\n filePath: string,\n visited: Set<string> = new Set(),\n verbose?: boolean,\n): Promise<ImportedModule[]> {\n const normalizedPath = resolve(filePath)\n if (visited.has(normalizedPath)) {\n return []\n }\n visited.add(normalizedPath)\n const modules: ImportedModule[] = []\n try {\n const content = await readFile(normalizedPath, \"utf-8\")\n const relativeImports = extractRelativeImports(content)\n for (const importPath of relativeImports) {\n const resolvedPath = await resolveModulePath(importPath, normalizedPath)\n if (!resolvedPath) {\n if (verbose) {\n console.log(\n ` Could not resolve import: ${importPath} from ${normalizedPath}`,\n )\n }\n continue\n }\n const importContent = await readFile(resolvedPath, \"utf-8\")\n modules.push({\n content: importContent,\n path: resolvedPath,\n })\n const nestedModules = await collectRelativeImports(\n resolvedPath,\n visited,\n verbose,\n )\n modules.push(...nestedModules)\n }\n } catch (error) {\n if (verbose) {\n console.log(`Error processing ${normalizedPath}`, error)\n }\n }\n return modules\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Code, Link, Parent, Root, RootContent, Text} from \"mdast\"\nimport {toString} from \"mdast-util-to-string\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkStringify from \"remark-stringify\"\nimport {type Plugin, unified} from \"unified\"\nimport {visit} from \"unist-util-visit\"\n\nimport type {\n CodeExample,\n PageEntry,\n PageHeading,\n SectionEntry,\n SectionTypes,\n SimplifiedProp,\n} from \"@qualcomm-ui/mdx-common\"\n\nimport {isSpoilerBlock, isStepBlock} from \"../../remark/index.js\"\nimport {SlugGenerator, slugify} from \"../create-slug.js\"\n\nimport {computeMd5} from \"./utils.js\"\n\nexport interface SectionExtractorOptions {\n /**\n * Header depths that define section boundaries.\n * @default [1, 2, 3, 4]\n */\n depths?: number[]\n\n /**\n * Minimum content length to create a section entry.\n * @default 0\n */\n minContentLength?: number\n\n /**\n * Prefix to use for page IDs.\n */\n pageIdPrefix?: string\n}\n\nexport interface PageInfo {\n frontmatter: Record<string, unknown>\n id: string\n pathname: string\n title: string\n url?: string\n}\n\ninterface HeaderInfo {\n depth: number\n text: string\n}\n\ninterface PendingSection {\n anchorId?: string\n headerPath: string[]\n headingLevel: number\n nodes: RootContent[]\n startIndex: number\n}\n\nexport interface ExtractionResult {\n sections: SectionEntry[]\n toc: PageHeading[]\n}\n\n/**\n * Convert links to inline code. URLs are not relevant for text embeddings\n * and will muddy the vector storage.\n */\nfunction transformLinks(): Plugin {\n return () => (tree) => {\n visit(tree, \"link\", (node: Link) => {\n let text = \"\"\n visit(node, \"text\", (textNode: Text) => {\n text += textNode.value\n })\n\n Object.assign(node, {\n children: undefined,\n type: \"inlineCode\",\n url: undefined,\n value: text,\n })\n })\n }\n}\n\nconst rawProcessor = unified().use(remarkGfm).use(remarkStringify)\n\nconst contentProcessor = unified()\n .use(remarkGfm)\n .use(transformLinks())\n .use(remarkStringify)\n\n/**\n * Extracts sections from processed markdown content, organized by headers.\n */\nexport class SectionExtractor {\n private readonly depths: Set<number>\n private readonly minContentLength: number\n private readonly pageIdPrefix: string\n\n constructor(options?: SectionExtractorOptions) {\n const defaultDepths = [1, 2, 3, 4]\n this.depths = new Set(options?.depths ?? defaultDepths)\n this.minContentLength = options?.minContentLength ?? 0\n this.pageIdPrefix = options?.pageIdPrefix ?? \"\"\n }\n\n /**\n * Extracts sections from a parsed AST and generates a table of contents.\n */\n extract(tree: Root, pageInfo: PageInfo): ExtractionResult {\n const sections: SectionEntry[] = []\n const toc: PageHeading[] = []\n const headerStack: HeaderInfo[] = [{depth: 1, text: pageInfo.title}]\n const slugGenerator = new SlugGenerator()\n\n let pendingSection: PendingSection | null = null\n\n const finalizeSection = () => {\n if (!pendingSection || pendingSection.nodes.length === 0) {\n return\n }\n\n const entry = this.buildSectionEntry(pendingSection, pageInfo)\n if (entry && entry.content.length >= this.minContentLength) {\n sections.push(entry)\n }\n }\n\n for (let i = 0; i < tree.children.length; i++) {\n const node = tree.children[i]\n\n if (node.type === \"yaml\") {\n continue\n }\n\n if (node.type === \"heading\") {\n const heading = node\n\n if (!this.depths.has(heading.depth)) {\n if (pendingSection) {\n pendingSection.nodes.push(node)\n } else {\n pendingSection = {\n headerPath: headerStack.map((h) => h.text),\n headingLevel: headerStack[headerStack.length - 1]?.depth ?? 1,\n nodes: [],\n startIndex: i,\n }\n }\n continue\n }\n\n finalizeSection()\n\n while (\n headerStack.length > 0 &&\n headerStack[headerStack.length - 1].depth >= heading.depth\n ) {\n headerStack.pop()\n }\n\n const headingText = toString(heading)\n headerStack.push({depth: heading.depth, text: headingText})\n\n let anchorId: string | undefined\n // h1 headings are page titles — don't include in ToC\n if (heading.depth > 1) {\n anchorId = slugGenerator.createSlug(headingText)\n toc.push({\n headingLevel: heading.depth,\n id: anchorId,\n tagName: `h${heading.depth}`,\n textContent: headingText,\n })\n }\n\n pendingSection = {\n anchorId,\n headerPath: headerStack.map((h) => h.text),\n headingLevel: heading.depth,\n nodes: [],\n startIndex: i,\n }\n } else if (pendingSection) {\n pendingSection.nodes.push(node)\n } else {\n pendingSection = {\n headerPath: headerStack.map((h) => h.text),\n headingLevel: headerStack[headerStack.length - 1]?.depth ?? 1,\n nodes: [node],\n startIndex: i,\n }\n }\n }\n\n finalizeSection()\n\n return {sections, toc}\n }\n\n /**\n * Extracts the entire page as a single entry with full raw markdown content.\n */\n extractPage(tree: Root, pageInfo: PageInfo): PageEntry | null {\n const nodes = tree.children.filter((node) => node.type !== \"yaml\")\n\n if (nodes.length === 0) {\n return null\n }\n\n const content = this.nodesToRawContent(nodes).trim()\n\n if (!content) {\n return null\n }\n\n const hashData = {\n content,\n pageId: `${this.pageIdPrefix}${pageInfo.id}`,\n pathname: pageInfo.pathname,\n }\n const hash = computeMd5(JSON.stringify(hashData))\n\n return {\n content,\n hash,\n pageId: `${this.pageIdPrefix}${pageInfo.id}`,\n pathname: pageInfo.pathname,\n title: pageInfo.title,\n }\n }\n\n private buildSectionEntry(\n section: PendingSection,\n pageInfo: PageInfo,\n ): SectionEntry | null {\n const {nodes, terms} = this.extractTerms(section.nodes)\n\n const contentNodes: RootContent[] = []\n const codeExamples: CodeExample[] = []\n\n const sectionTypes: SectionTypes[] = []\n for (const node of nodes) {\n if (node.type === \"code\") {\n const codeNode = node as Code & {\n data?: {\n typeDocProps?: {\n name: string\n props: SimplifiedProp[]\n since?: string\n }\n }\n }\n\n if (codeNode.data?.typeDocProps) {\n const {name, props, since} = codeNode.data.typeDocProps\n sectionTypes.push({\n props,\n since,\n type: name,\n })\n }\n\n codeExamples.push({\n code: codeNode.value,\n language: codeNode.lang ?? \"\",\n })\n } else if (\n node.type === \"text\" &&\n (isStepBlock(node.value.trim()) || isSpoilerBlock(node.value.trim()))\n ) {\n // continue\n } else {\n contentNodes.push(node)\n }\n }\n\n const rawContent = this.nodesToRawContent(nodes)\n const content = this.nodesToContent(contentNodes)\n\n const sectionId = this.generateSectionId(section.headerPath)\n const url =\n pageInfo.url && section.anchorId\n ? `${pageInfo.url}#${section.anchorId}`\n : undefined\n\n const hashData = {\n headerPath: section.headerPath,\n pageFrontmatter: Object.keys(pageInfo.frontmatter).length\n ? pageInfo.frontmatter\n : undefined,\n pageId: `${this.pageIdPrefix}${pageInfo.id}`,\n rawContent: rawContent.trim(),\n terms: terms.length ? terms : undefined,\n types: sectionTypes.length ? sectionTypes : undefined,\n url,\n }\n const sectionHash = computeMd5(JSON.stringify(hashData))\n\n return {\n ...hashData,\n codeExamples: codeExamples.length ? codeExamples : undefined,\n content: content.trim(),\n hash: sectionHash,\n headingLevel: section.headingLevel,\n sectionId,\n }\n }\n\n private extractTerms(nodes: RootContent[]): {\n nodes: RootContent[]\n terms: string[]\n } {\n const filteredNodes: RootContent[] = []\n const terms: string[] = []\n\n for (const node of nodes) {\n if (node.type === \"paragraph\") {\n const children = (node as Parent).children ?? []\n const firstChild = children[0]\n if (firstChild?.type === \"text\") {\n const firstText = firstChild.value\n const termsMatch = firstText.match(/^:::\\s*terms\\s*/)\n\n if (termsMatch) {\n // Collect text from all children (handles soft breaks in multiline\n // blocks)\n let fullText = firstText\n for (let i = 1; i < children.length; i++) {\n const child = children[i] as {type: string; value?: string}\n if (child.type === \"text\") {\n fullText += child.value\n } else if (child.type === \"softBreak\") {\n fullText += \"\\n\"\n }\n }\n\n const parsedTerms = this.parseTermsBlock(fullText)\n terms.push(...parsedTerms)\n continue\n }\n }\n }\n filteredNodes.push(node)\n }\n\n return {nodes: filteredNodes, terms}\n }\n\n private parseTermsBlock(text: string): string[] {\n const afterOpen = text.replace(/^:::\\s*terms\\s*/, \"\")\n const closeIndex = afterOpen.lastIndexOf(\":::\")\n const content =\n closeIndex !== -1 ? afterOpen.slice(0, closeIndex) : afterOpen\n\n return content\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line && line !== \":::\")\n }\n\n private nodesToRawContent(nodes: RootContent[]): string {\n const tree: Root = {children: nodes, type: \"root\"}\n return rawProcessor.stringify(tree)\n }\n\n private nodesToContent(nodes: RootContent[]): string {\n const tree: Root = {children: structuredClone(nodes), type: \"root\"}\n const transformed = contentProcessor.runSync(tree) as Root\n return contentProcessor.stringify(transformed)\n }\n\n private generateSectionId(headerPath: string[]): string {\n return headerPath.map((h) => slugify(h)).join(\"-\")\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {RouteMetaEntryInternal, RouteMetaInternal} from \"./types.js\"\n\n/**\n * Retrieves the route metadata for a given path based on its path segments.\n */\nexport function getRouteMeta(\n pathSegments: string[],\n metaJson: RouteMetaInternal,\n): RouteMetaEntryInternal | undefined | null {\n const routeMeta = metaJson[pathSegments[0]]\n if (!routeMeta) {\n // backup, fetch using id if provided\n return undefined\n }\n\n if (pathSegments.length === 1) {\n return routeMeta\n }\n\n return pathSegments\n .slice(1)\n .reduce((acc: RouteMetaEntryInternal | undefined | null, segment) => {\n return acc?.children?.[segment]\n }, routeMeta)\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {sortBy} from \"lodash-es\"\nimport {v4 as uuidv4} from \"uuid\"\n\nimport {\n isNavBadge,\n type NavBadge,\n type NavItem,\n type PageFrontmatter,\n type PageSection,\n} from \"@qualcomm-ui/mdx-common\"\nimport {capitalCase} from \"@qualcomm-ui/utils/change-case\"\nimport {defined} from \"@qualcomm-ui/utils/guard\"\n\nimport {getRouteMeta} from \"./get-route-meta.js\"\nimport type {\n NavMeta,\n RouteMetaEntryInternal,\n RouteMetaInternal,\n} from \"./types.js\"\n\ninterface InitialRoute {\n pageFrontmatter: Partial<PageFrontmatter>\n pageSection: PageSection\n routeMeta?: RouteMetaEntryInternal\n}\n\n/**\n * Given a flat remix route structure, computes nested navigation items for the QUI\n * side nav.\n */\nexport class NavBuilder {\n private initialRoutes: InitialRoute[] = []\n private flatNavItems: NavItem[] = []\n\n get navItems(): NavItem[] {\n return this._navItems\n }\n private _navItems: NavItem[] = []\n\n private readonly metaJson: RouteMetaInternal\n private readonly navMeta: Record<number, NavMeta>\n\n constructor(metaJson: RouteMetaInternal, navMeta: Record<number, NavMeta>) {\n this.navMeta = navMeta\n this.metaJson = metaJson\n }\n\n add(\n pageSection: PageSection,\n pageFrontmatter: Partial<PageFrontmatter>,\n routeMeta?: RouteMetaEntryInternal,\n ): void {\n this.initialRoutes.push({pageFrontmatter, pageSection, routeMeta})\n }\n\n reset(): void {\n this.initialRoutes = []\n this.flatNavItems = []\n this._navItems = []\n }\n\n /**\n * Sorts nav items. Nav items with an order defined take precedence over nav items\n * without an order. Nav items with the same order are sorted alphabetically by\n * title.\n */\n private navItemSort(a: NavItem, b: NavItem, groupOrder?: string[]) {\n if (a.depth !== b.depth) {\n return a.depth - b.depth\n }\n\n if (a.order && !b.order) {\n return -1\n }\n if (!a.order && b.order) {\n return 1\n } else if (a.order && b.order && a.order !== b.order) {\n return a.order - b.order\n }\n\n if (groupOrder && a.group && b.group) {\n const aIndex = a.group ? groupOrder.indexOf(a.group) : -1\n const bIndex = b.group ? groupOrder.indexOf(b.group) : -1\n\n if (aIndex === bIndex) {\n // continue\n } else if (aIndex !== -1 && bIndex !== -1) {\n return aIndex - bIndex\n } else if (aIndex !== -1) {\n return -1\n } else if (bIndex !== -1) {\n return 1\n }\n }\n\n // group items with the same group\n if (a.group !== b.group) {\n if (!a.group && b.group) {\n return -1\n }\n if (a.group && !b.group) {\n return 1\n }\n if (a.group && b.group) {\n return a.group.localeCompare(b.group)\n }\n }\n\n return a.title.localeCompare(b.title)\n }\n\n resolveSideNavTitle(\n frontmatter: Partial<PageFrontmatter>,\n routeMeta: Partial<RouteMetaEntryInternal>,\n fallback: string,\n ): string {\n return (\n (defined(routeMeta.sideNavTitle)\n ? routeMeta.sideNavTitle || \"\"\n : frontmatter.sideNavTitle || \"\") || fallback\n )\n }\n\n /**\n * Builds a flat list of nav items from the MDX pages and _meta.json. If a page\n * does not exist, it is not added to the side nav (even if it has an entry in\n * _meta.json).\n */\n private buildNavItem({\n pageFrontmatter,\n pageSection: {pathname, pathSegments, title},\n routeMeta: routeMetaParam,\n }: InitialRoute) {\n const id = pageFrontmatter?.id || \"\"\n\n // handle home page (this route does not have path segments)\n if (!pathSegments.length && pathname === \"/\") {\n const routeMeta =\n routeMetaParam || getRouteMeta(id ? [id] : [], this.metaJson)\n if (!routeMeta) {\n return\n }\n\n this.flatNavItems.push({\n depth: 1,\n expanded: routeMeta?.expanded || false,\n id: `/`,\n order: routeMeta?.order,\n pathname,\n pathSegments: [],\n title: this.resolveSideNavTitle(\n pageFrontmatter,\n routeMeta,\n routeMeta?.title || title,\n ),\n })\n }\n pathSegments.forEach((segment, index) => {\n const depth = index + 1\n\n // we only add an item if it doesn't already exist, which we determine by\n // comparing the path segments iteratively.\n const navItem = this.flatNavItems.find((item) =>\n pathSegments\n .slice(0, depth)\n .every((value, i) => value === item.pathSegments[i]),\n )\n\n if (!navItem) {\n const isPage = index === pathSegments.length - 1\n const adjustedSegments = pathSegments.slice(0, depth)\n\n const routeMeta =\n getRouteMeta(\n isPage ? pathSegments : adjustedSegments,\n this.metaJson,\n ) ?? {}\n\n this.flatNavItems.push({\n badges: isPage ? this.extractBadges(pageFrontmatter) : undefined,\n depth,\n expanded: routeMeta?.expanded || false,\n group: isPage\n ? routeMeta.group || pageFrontmatter.group\n : routeMeta.group,\n id: `/${adjustedSegments.join(\"/\")}`,\n items: [],\n order: routeMeta?.order,\n pathname: isPage ? pathname : undefined,\n pathSegments: adjustedSegments,\n title: this.resolveSideNavTitle(\n isPage ? pageFrontmatter : {},\n routeMeta,\n routeMeta?.title\n ? routeMeta.title\n : isPage\n ? title\n : capitalCase(segment),\n ),\n })\n }\n })\n }\n\n /**\n * Iterates through a nav item's path segments and ensures that all of its parent\n * elements exist in the recursive structure.\n */\n private ensureParent(navItem: NavItem) {\n const segments = navItem.pathSegments\n let items: NavItem[] = this.navItems\n let item: NavItem | undefined\n let prevItem: NavItem | undefined = undefined\n\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i]\n item = items?.find((entry) => entry.pathSegments[i] === segment)\n if (item) {\n // point to the found item's children and keep iterating\n items = item.items ?? []\n prevItem = item\n continue\n }\n if (prevItem) {\n const pathSegments = segments.slice(0, i + 1)\n const routeMeta = getRouteMeta(pathSegments, this.metaJson)\n\n items = []\n const base = {\n depth: pathSegments.length,\n id: `/routes/${pathSegments.join(\"/\")}`,\n items,\n pathSegments,\n title: segment,\n }\n const newItem = routeMeta\n ? {\n ...base,\n expanded: routeMeta.expanded,\n order: routeMeta.order,\n restricted: routeMeta.restricted,\n title: routeMeta.title ?? segment,\n }\n : base\n prevItem.items = prevItem.items\n ? [...prevItem.items, newItem]\n : [newItem]\n }\n prevItem = item\n }\n }\n\n /**\n * Deeply inserts a nav item into the array, iterating through parent routes\n * (based on the pathSegments) and adding them if they don't exist.\n *\n * For example, given a leaf node 4 path segments deep, this function will create\n * all parent nav items as nested children of the top-most nav item.\n */\n private nestedInsert(\n item: NavItem,\n pathSegments: string[],\n items: NavItem[],\n ) {\n const segment = pathSegments[0]\n const parentItem = items.find(\n (parent) => parent.pathSegments.at(-1) === segment,\n )\n if (parentItem) {\n this.nestedInsert(item, pathSegments.slice(1), parentItem.items ?? [])\n } else if (pathSegments.length === 1) {\n items.push(item)\n }\n }\n\n private buildNestedNavItems() {\n for (let i = 0; i < this.flatNavItems.length; i++) {\n const navItem = this.flatNavItems[i]\n if (navItem.depth === 1) {\n this.navItems.push(navItem)\n continue\n }\n\n this.ensureParent(navItem)\n this.nestedInsert(navItem, navItem.pathSegments, this.navItems)\n }\n }\n\n private sortNestedNavItems(items: NavItem[], groupOrder?: string[]) {\n items.sort((a, b) => this.navItemSort(a, b, groupOrder))\n for (const item of items) {\n if (item.items?.length) {\n const meta = getRouteMeta(item.pathSegments, this.metaJson)\n this.sortNestedNavItems(item.items, meta?.groupOrder)\n }\n }\n }\n\n /**\n * To be called after every mdx page route has been added through the {@link add}\n * function.\n */\n build(): NavItem[] {\n // We need to process parent items first, so we sort by path segment. Routes\n // with shorter path segments will be processed first.\n sortBy(\n this.initialRoutes,\n (item) => item.pageSection.pathSegments.length,\n ).map((r) => this.buildNavItem(r))\n\n this.buildNestedNavItems()\n\n const rootMeta = getRouteMeta([], this.metaJson)\n this.sortNestedNavItems(this.navItems, rootMeta?.groupOrder)\n\n if (this.navMeta) {\n for (const [index, value] of Object.entries(this.navMeta)) {\n this._navItems.splice(parseInt(index), 0, {\n depth: 1,\n id: uuidv4(),\n pathSegments: [],\n sectionTitle: value.sectionTitle,\n separator: value.separator,\n title: \"\",\n })\n }\n }\n\n this._navItems = this.groupNavItems(this.navItems)\n this._navItems = this.buildSearchMeta(this.navItems, [])\n return this.navItems\n }\n\n private groupNavItems(items: NavItem[]): NavItem[] {\n const result: NavItem[] = []\n const seenGroups = new Set<string>()\n\n for (const item of items) {\n if (item.group && !seenGroups.has(item.group)) {\n seenGroups.add(item.group)\n result.push({\n depth: item.depth,\n group: item.group,\n id: uuidv4(),\n pathSegments: [],\n sectionTitle: item.group,\n title: \"\",\n })\n }\n\n result.push({\n ...item,\n items: item.items ? this.groupNavItems(item.items) : undefined,\n })\n }\n\n return result\n }\n\n /**\n * Walks over the tree and builds search metadata using the nearest sectionTitle.\n */\n private buildSearchMeta(items: NavItem[], meta: string[]): NavItem[] {\n let sectionTitle = \"\"\n const results: NavItem[] = []\n\n for (const ogItem of items) {\n const item = {...ogItem}\n\n if (item.sectionTitle) {\n sectionTitle = item.sectionTitle\n } else if (item.separator) {\n sectionTitle = \"\"\n }\n\n if (!item.separator) {\n const currentMeta = sectionTitle ? [...meta, sectionTitle] : [...meta]\n const nextMeta = [...(item.searchMeta || []), ...currentMeta]\n if (nextMeta.length) {\n item.searchMeta = [...nextMeta]\n }\n\n if (item.items) {\n item.items = this.buildSearchMeta(item.items, currentMeta)\n }\n }\n\n results.push(item)\n }\n\n return results\n }\n\n private extractBadges(\n pageFrontmatter: Partial<PageFrontmatter>,\n ): NavBadge[] | undefined {\n const badges = (\n pageFrontmatter as Partial<PageFrontmatter> & Record<string, unknown>\n ).badges\n if (badges && typeof badges === \"object\" && Array.isArray(badges)) {\n return badges.filter((badge) => isNavBadge(badge) && !badge.hideFromNav)\n }\n return undefined\n }\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {join} from \"node:path\"\n\nimport {capitalCase} from \"@qualcomm-ui/utils/change-case\"\n\nimport type {RoutingStrategy} from \"../config/index.js\"\n\nimport {getRouteMeta} from \"./get-route-meta.js\"\nimport type {RouteMetaInternal} from \"./types.js\"\n\nexport function getPathnameFromPathSegments(segments: string[]) {\n return `/${segments.join(\"/\")}`\n}\n\nexport function getCategoriesFromPathSegments(\n segments: string[],\n metaJson: RouteMetaInternal,\n // the frontmatter title only applies to the last segment.\n frontmatterTitle: string,\n): string[] {\n return segments.reduce((acc: string[], segment, index) => {\n const pathSegments = segments.slice(0, index + 1)\n if (index === segments.length - 1) {\n acc.push(frontmatterTitle)\n return acc\n }\n const meta = getRouteMeta(pathSegments, metaJson)\n if (meta?.title) {\n acc.push(meta.title)\n } else {\n acc.push(pathSegmentToCategory(segment))\n }\n return acc\n }, [])\n}\n\n// fallback for unmatched path segments\nexport function pathSegmentToCategory(segment: string): string {\n // we don't transform words like `a`, `or`, and `and`\n return segment\n .split(\"-\")\n .map((segment) =>\n /\\b(a|an|and|but|or|in|on|at)\\b/.test(segment)\n ? segment\n : capitalCase(segment),\n )\n .join(\" \")\n}\n\nfunction getGeneroutedPathSegments(filePath: string): string[] {\n const extension = filePath.endsWith(\"mdx\") ? \"mdx\" : \"tsx\"\n\n const segments = filePath\n .substring(0, filePath.lastIndexOf(`.${extension}`))\n .split(\"/\")\n\n if (segments[segments.length - 1] === \"index\") {\n return segments.slice(0, segments.length - 1)\n }\n return segments\n}\n\nconst pathSeparatorRegex = /[\\/\\\\.]/\nfunction isPathSeparator(char: string) {\n return pathSeparatorRegex.test(char)\n}\n\nconst indexRouteRegex =\n /((^|[.]|[+]\\/)(index|_index))(\\/[^\\/]+)?$|(\\/_?index\\/)/\n\ninterface FlatRoutesSegmentsOptions {\n /**\n * When true, plain `/` folders are flattened the same way `+/` folders are.\n * Mirrors the `\"react-router-directory-groups\"` routing strategy.\n */\n directoryMode?: boolean\n paramPrefixChar?: string\n}\n\nfunction getRemixFlatRoutesSegments(\n name: string,\n index: boolean,\n paramPrefixCharOrOptions: FlatRoutesSegmentsOptions | string = \"$\",\n) {\n const options: FlatRoutesSegmentsOptions =\n typeof paramPrefixCharOrOptions === \"string\"\n ? {paramPrefixChar: paramPrefixCharOrOptions}\n : paramPrefixCharOrOptions\n const paramPrefixChar = options.paramPrefixChar ?? \"$\"\n const directoryMode = options.directoryMode ?? false\n\n let routeSegments: string[] = []\n let i = 0\n let routeSegment = \"\"\n let state = \"START\"\n let subState = \"NORMAL\"\n let hasPlus = false\n\n // ignore layout routes\n if (name.endsWith(\"_layout\")) {\n return []\n }\n\n /*\n * name has already been normalized to use / as path separator.\n * replace `+/_.` with `_+/`\n * this supports the ability to specify parent folder will not be a layout.\n * _public+/_.about.tsx => _public_.about.tsx\n */\n if (/\\+\\/_\\./.test(name)) {\n name = name.replace(/\\+\\/_\\./g, \"_+/\")\n }\n\n /*\n * replace `+/` with `.`\n * this supports folders for organizing flat-files convention.\n * _public+/about.tsx => _public.about.tsx\n */\n if (/\\+\\//.test(name)) {\n name = name.replace(/\\+\\//g, \".\")\n hasPlus = true\n }\n\n if (directoryMode && /\\//.test(name)) {\n /**\n * In directory mode, plain folders flatten the same way `+` folders do.\n * Preserve trailing `.route` so route-directory naming still works.\n */\n if (name.endsWith(\".route\")) {\n const lastSlash = name.lastIndexOf(\"/\")\n if (lastSlash >= 0) {\n const head = name.substring(0, lastSlash).replace(/\\//g, \".\")\n name = `${head}/${name.substring(lastSlash + 1)}`\n }\n } else {\n name = name.replace(/\\//g, \".\")\n }\n hasPlus = true\n }\n\n const hasFolder = /\\//.test(name)\n // if name has plus folder, but we still have regular folders\n // then treat ending route as flat-folders\n if (\n ((hasPlus && hasFolder) || !hasPlus) &&\n !(name.endsWith(\".route\") || name.endsWith(\".index\"))\n ) {\n // Do not remove segments ending in .route\n // since these would be part of the route directory name\n // docs/readme.route.tsx => docs/readme\n // Remove last segment since this should just be the route filename, and we only\n // want the directory name docs/_layout.tsx => docs\n const last = name.lastIndexOf(\"/\")\n if (last >= 0) {\n name = name.substring(0, last)\n }\n }\n\n const pushRouteSegment = (routeSegment: string) => {\n if (routeSegment) {\n routeSegments.push(routeSegment)\n }\n }\n\n while (i < name.length) {\n const char = name[i]\n switch (state) {\n case \"START\":\n // process existing segment\n if (\n routeSegment.includes(paramPrefixChar) &&\n !(\n routeSegment.startsWith(paramPrefixChar) ||\n routeSegment.startsWith(`(${paramPrefixChar}`)\n )\n ) {\n throw new Error(\n `Route params must start with prefix char ${paramPrefixChar}: ${routeSegment}`,\n )\n }\n if (\n routeSegment.includes(\"(\") &&\n !routeSegment.startsWith(\"(\") &&\n !routeSegment.endsWith(\")\")\n ) {\n throw new Error(\n `Optional routes must start and end with parentheses: ${routeSegment}`,\n )\n }\n pushRouteSegment(routeSegment)\n routeSegment = \"\"\n state = \"PATH\"\n continue // restart without advancing index\n case \"PATH\":\n if (isPathSeparator(char) && subState === \"NORMAL\") {\n state = \"START\"\n break\n } else if (char === \"[\") {\n subState = \"ESCAPE\"\n break\n } else if (char === \"]\") {\n subState = \"NORMAL\"\n break\n }\n routeSegment += char\n break\n }\n i++ // advance to next character\n }\n // process remaining segment\n pushRouteSegment(routeSegment)\n // strip trailing .route segment\n if (\n routeSegments.at(-1) === \"route\" ||\n routeSegments.at(-1) === \"index\" ||\n routeSegments.at(-1) === \"_index\" ||\n routeSegments.at(-1) === \"_route\"\n ) {\n routeSegments = routeSegments.slice(0, -1)\n }\n // if hasPlus, we need to strip the trailing segment if it starts with _\n // and route is not an index route\n // this is to handle layouts in flat-files\n // _public+/_layout.tsx => _public.tsx\n // _public+/index.tsx => _public.index.tsx\n if (!index && hasPlus && routeSegments.at(-1)?.startsWith(\"_\")) {\n routeSegments = routeSegments.slice(0, -1)\n }\n return routeSegments\n}\n\nfunction getRemixHybridRoutesPathSegments(filePath: string): string[] {\n const routeWithoutExtension = filePath.substring(0, filePath.lastIndexOf(\".\"))\n\n return getRemixFlatRoutesSegments(\n routeWithoutExtension,\n indexRouteRegex.test(routeWithoutExtension),\n )\n}\n\n/**\n * `\"react-router-directory-groups\"` routing strategy behavior: plain folders\n * flatten just like `+` folders, and any non-final folder segment starting\n * with `_` excludes the file from the page map entirely.\n */\nfunction getRemixHybridDirectoryRoutesPathSegments(filePath: string): string[] {\n const routeWithoutExtension = filePath.substring(0, filePath.lastIndexOf(\".\"))\n\n if (hasPrivateFolderSegment(routeWithoutExtension)) {\n return []\n }\n\n return getRemixFlatRoutesSegments(\n routeWithoutExtension,\n indexRouteRegex.test(routeWithoutExtension),\n {directoryMode: true},\n )\n}\n\n/**\n * Returns true when any non-final path segment (i.e. a folder) starts with\n * `_`. The filename itself is allowed to start with `_` because underscore\n * route files keep their pathless/layout meaning in directory mode.\n */\nfunction hasPrivateFolderSegment(routeWithoutExtension: string): boolean {\n const segments = routeWithoutExtension.split(\"/\")\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i]\n if (segment.startsWith(\"_\") && !segment.includes(\"+\")) {\n return true\n }\n }\n return false\n}\n\nexport function getPathSegmentsFromFileName(\n filePath: string,\n pageDirectory: string,\n strategy?: RoutingStrategy,\n): string[] {\n const filePathWithoutPageDirectory = filePath.substring(\n filePath.indexOf(pageDirectory) + pageDirectory.length + 1,\n )\n if (typeof strategy === \"function\") {\n return strategy(filePathWithoutPageDirectory)\n }\n switch (strategy) {\n case \"vite-generouted\":\n return getGeneroutedPathSegments(filePathWithoutPageDirectory)\n case \"react-router-directory-groups\":\n return getRemixHybridDirectoryRoutesPathSegments(\n filePathWithoutPageDirectory,\n )\n default:\n return getRemixHybridRoutesPathSegments(filePathWithoutPageDirectory)\n }\n}\n\nexport function filterFileGlob(\n fileGlob: string[],\n ext: string,\n srcDir: string,\n router?: RoutingStrategy,\n): string[] {\n if (typeof router === \"string\" && router === \"vite-generouted\") {\n // vite-generouted: filter routes\n const restrictedPattern = /(\\(.*\\))|(\\[.*\\])/\n // pull out the full path before filtering to avoid potential issues with\n // parent directories.\n const relativeGlobs = fileGlob.map((file) => file.replace(srcDir, \"\"))\n return (\n relativeGlobs\n .filter(\n (file) =>\n file.endsWith(`.${ext}`) &&\n !file.includes(\"/_\") &&\n !file.includes(\"/+\"),\n )\n // filter pathless segments\n .map((file) =>\n file\n .split(\"/\")\n .filter((segment) => !restrictedPattern.test(segment))\n .join(\"/\"),\n )\n // restore full path\n .map((file) => join(srcDir, file))\n )\n }\n if (\n typeof router === \"string\" &&\n router === \"react-router-directory-groups\"\n ) {\n return fileGlob.filter(\n (file) =>\n file.endsWith(ext) &&\n !file.includes(\"$\") &&\n !hasPrivateFolderInRelativePath(file, srcDir),\n )\n }\n return fileGlob.filter((file) => file.endsWith(ext) && !file.includes(\"$\"))\n}\n\n/**\n * Returns true when the file's path (relative to `srcDir`) contains a folder\n * segment starting with `_`. The filename itself is excluded from this check\n * — underscore route files keep their pathless/layout meaning.\n */\nfunction hasPrivateFolderInRelativePath(file: string, srcDir: string): boolean {\n const relative = file.startsWith(srcDir) ? file.slice(srcDir.length) : file\n const segments = relative.split(\"/\").filter(Boolean)\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i]\n if (segment.startsWith(\"_\") && !segment.includes(\"+\")) {\n return true\n }\n }\n return false\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {NavConfig, NavMeta, RouteMeta, RouteMetaInternal} from \"./types.js\"\n\nexport function transformRouteMetaArray(\n meta: NavConfig[],\n routeMetaNav: Record<string, NavMeta>,\n): RouteMetaInternal {\n let ignoringOrder = 0\n return meta.reduce((acc: RouteMetaInternal, item, index) => {\n // strip the nav meta and populate a separate record. This will be used for\n // lookup while building the nav items.\n if (!(\"id\" in item)) {\n if (\"separator\" in item || \"sectionTitle\" in item) {\n // offset the navMeta index by the number of items that will be sorted to\n // the back of the nav order.\n routeMetaNav[index - ignoringOrder] = item\n }\n return acc\n }\n const current = item as RouteMeta\n if (current.ignoreRouteMetaOrder || current.hidden) {\n // items with ignored order are always sorted to the back of the nav order. We\n // need to account for this when splicing in the navMeta entries.\n ignoringOrder++\n }\n acc[current.id] = {\n children: current.children\n ? transformRouteMetaArray(current.children, routeMetaNav)\n : undefined,\n expanded: current.expanded,\n group: current.group,\n groupOrder: current.groupOrder,\n hidden: current.hidden,\n hideBreadcrumbs: current.hideBreadcrumbs,\n hideFromSearch: current.hideFromSearch,\n hidePageLinks: current.hidePageLinks,\n hideSideNav: current.hideSideNav,\n hideToc: current.hideToc,\n order: current.ignoreRouteMetaOrder ? undefined : index + 1,\n restricted: current.restricted,\n title: current.title,\n }\n return acc\n }, {})\n}\n","// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport chalk from \"chalk\"\nimport type {Root} from \"mdast\"\n\nimport type {\n NavItem,\n PageFrontmatter,\n PageMap,\n PageSection,\n SectionEntry,\n} from \"@qualcomm-ui/mdx-common\"\nimport type {QuiPropTypes} from \"@qualcomm-ui/typedoc-common\"\nimport {defined} from \"@qualcomm-ui/utils/guard\"\n\nimport type {SearchIndexerOptions} from \"./config/index.js\"\nimport {DocPropsIndexer} from \"./doc-props/index.js\"\nimport {\n collectAnchorIds,\n type CollectedLink,\n collectLinks,\n reportInvalidLinks,\n validateLinks,\n} from \"./link-validator.js\"\nimport {\n buildGitMetadataMap,\n type CompiledMdxFile,\n type CompiledMdxFileMetadata,\n createRemarkProcessor,\n type IndexedPage,\n type IndexedSection,\n MdxFileReader,\n} from \"./markdown/index.js\"\nimport {\n type PageInfo,\n SectionExtractor,\n} from \"./markdown/knowledge/section-extractor.js\"\nimport {\n filterFileGlob,\n getCategoriesFromPathSegments,\n getPathnameFromPathSegments,\n getPathSegmentsFromFileName,\n getRouteMeta,\n NavBuilder,\n transformRouteMetaArray,\n} from \"./nav-builder/index.js\"\nimport type {\n RouteMetaInternal,\n RouteMetaNavInternal,\n} from \"./nav-builder/types.js\"\nimport {fixPath} from \"./path-utils.js\"\nimport {remarkSerializeJsxKnowledge} from \"./remark/index.js\"\n\nexport class SearchIndexer {\n private readonly docPropsIndexer: DocPropsIndexer\n private readonly sectionExtractor: SectionExtractor\n private readonly navBuilder: NavBuilder\n private readonly mdxFileReader: MdxFileReader\n private readonly allowedHeadings: Set<string>\n private readonly metaJson: RouteMetaInternal\n private _collectedLinks: CollectedLink[] = []\n private _anchorIds: Record<string, Set<string>> = {}\n private _docPropIds: Record<string, Set<string>> = {}\n private readonly routeMetaNav: Record<string, RouteMetaNavInternal> = {}\n readonly config: SearchIndexerOptions\n logWarnings: boolean\n\n get cachedFileCount(): number {\n return this.mdxFileReader.cachedFileCount\n }\n\n get pageDocProps(): Record<string, Record<string, QuiPropTypes>> {\n return this._pageDocProps\n }\n private _pageDocProps: Record<string, Record<string, QuiPropTypes>> = {}\n\n get mdxFileCount(): number {\n return this._mdxFileCount\n }\n private _mdxFileCount: number = 0\n\n get navItems(): NavItem[] {\n return this.navBuilder.navItems\n }\n\n get pageMap(): PageMap {\n return this._pageMap\n }\n private _pageMap: PageMap = {}\n\n get searchIndex(): PageSection[] {\n return this._searchIndex\n }\n private _searchIndex: PageSection[] = []\n\n reset(): void {\n this.mdxFileReader.reset()\n this._collectedLinks = []\n this._anchorIds = {}\n this._docPropIds = {}\n this._pageMap = {}\n this._searchIndex = []\n }\n\n constructor(\n config: SearchIndexerOptions,\n logWarnings = true,\n // enable composition by making these classes replaceable\n addons: {\n docPropsIndexer?: DocPropsIndexer\n mdxFileReader?: MdxFileReader\n navBuilder?: NavBuilder\n sectionExtractor?: SectionExtractor\n } = {},\n ) {\n this.config = config\n this.logWarnings = logWarnings\n this.allowedHeadings = new Set<string>(\n Array.from(config?.headings || [\"h2\", \"h3\", \"h4\"]),\n )\n this.metaJson = transformRouteMetaArray(\n this.config.navConfig ?? [],\n this.routeMetaNav,\n )\n\n const headingDepths = Array.from(this.allowedHeadings).map((h) =>\n parseInt(h.charAt(1)),\n )\n this.sectionExtractor =\n addons.sectionExtractor ||\n new SectionExtractor({depths: [1, ...headingDepths]})\n this.navBuilder =\n addons.navBuilder || new NavBuilder(this.metaJson, this.routeMetaNav)\n this.docPropsIndexer =\n addons.docPropsIndexer ||\n new DocPropsIndexer(this.config.typeDocProps ?? {})\n this.mdxFileReader =\n addons.mdxFileReader ||\n new MdxFileReader(\n process.env.NODE_ENV === \"development\" && !this.config.disableCache,\n this.config.pageTimestampMetadata,\n )\n }\n\n /**\n * Resolves a page's properties from the combined frontmatter and RouteMeta.\n * RouteMeta properties take precedence.\n */\n private getPageEntry(\n filepath: string,\n frontmatter: Partial<PageFrontmatter>,\n ): PageSection {\n const pagePath = filepath.replace(this.config.srcDir, \"\")\n\n const pathSegments = getPathSegmentsFromFileName(\n pagePath,\n this.config.pageDirectory,\n this.config.routingStrategy,\n )\n\n const pathname = getPathnameFromPathSegments(pathSegments)\n\n const routeMeta =\n getRouteMeta(\n pathSegments.length === 0\n ? frontmatter.id\n ? [frontmatter.id]\n : [\"_index\"]\n : pathSegments,\n this.metaJson,\n ) ?? {}\n\n return {\n categories:\n frontmatter.categories ??\n getCategoriesFromPathSegments(\n pathSegments,\n this.metaJson,\n routeMeta?.title || frontmatter.title || \"\",\n ),\n data: frontmatter,\n description: frontmatter.description,\n hidden: defined(routeMeta.hidden) ? routeMeta.hidden : frontmatter.hidden,\n hideBreadcrumbs: defined(routeMeta.hideBreadcrumbs)\n ? routeMeta.hideBreadcrumbs\n : frontmatter.hideBreadcrumbs,\n hideFromSearch: defined(routeMeta.hideFromSearch)\n ? routeMeta.hideFromSearch\n : frontmatter.hideFromSearch,\n hidePageLinks: defined(routeMeta.hidePageLinks)\n ? routeMeta.hidePageLinks\n : frontmatter.hidePageLinks,\n hideSideNav: defined(routeMeta.hideSideNav)\n ? routeMeta.hideSideNav\n : frontmatter.hideSideNav,\n hideToc: defined(routeMeta.hideToc)\n ? routeMeta.hideToc\n : frontmatter.hideToc,\n id: pagePath,\n pathname,\n pathSegments,\n restricted: defined(routeMeta.restricted)\n ? routeMeta.restricted\n : frontmatter.restricted,\n title: defined(routeMeta.title)\n ? routeMeta.title || \"\"\n : frontmatter.title || \"\",\n updatedBy: frontmatter.updatedBy,\n updatedOn: frontmatter.updatedOn,\n }\n }\n\n /**\n * Parses an MDX file to extract the site data for the nav items, doc props,\n * breadcrumbs, and search index.\n */\n private compileMdxFile(filePath: string): CompiledMdxFile {\n const {cached, fileContents, frontmatter} =\n this.mdxFileReader.readFileSync(filePath)\n\n const metadata: CompiledMdxFileMetadata = {\n changed: {},\n filePath,\n }\n\n let previousPage: IndexedPage | undefined = undefined\n\n if (!cached) {\n const previousData = this.mdxFileReader.readCache(filePath)\n if (previousData) {\n const cachedFm = JSON.stringify(previousData.frontmatter)\n const currentFm = JSON.stringify(frontmatter)\n previousPage = previousData.page\n if (cachedFm !== currentFm) {\n metadata.changed.frontmatter = true\n }\n }\n }\n\n this.docPropsIndexer.reset()\n\n const defaultSection: PageSection = this.getPageEntry(filePath, frontmatter)\n if (!defaultSection.categories.length && defaultSection.title) {\n defaultSection.categories = [defaultSection.title]\n }\n\n if (!defaultSection.hidden) {\n this.navBuilder.add(defaultSection, frontmatter)\n }\n\n this._pageMap[defaultSection.pathname] = defaultSection\n\n let indexedPage: IndexedPage\n let collectedLinks: CollectedLink[] = []\n\n try {\n if (this.config.validatePageLinks) {\n const anchorTree = createRemarkProcessor({\n frontmatter: true,\n mdx: true,\n }).parse(fileContents)\n const anchorIds = collectAnchorIds(anchorTree)\n if (anchorIds.size) {\n this._anchorIds[defaultSection.pathname] = anchorIds\n }\n }\n\n if (cached?.page) {\n indexedPage = cached.page\n collectedLinks = cached.collectedLinks\n this._collectedLinks.push(...collectedLinks)\n } else {\n const processor = createRemarkProcessor({\n alerts: true,\n extractMeta: {},\n frontmatter: true,\n gfm: true,\n interpolateFrontmatter: frontmatter,\n mdx: true,\n plugins: [remarkSerializeJsxKnowledge],\n removeJsx: true,\n removeMermaidCodeBlocks: true,\n })\n const tree = processor.runSync(processor.parse(fileContents)) as Root\n\n if (this.config.validatePageLinks) {\n collectedLinks = collectLinks(tree, filePath, defaultSection.pathname)\n this._collectedLinks.push(...collectedLinks)\n }\n\n const pageInfo: PageInfo = {\n frontmatter: frontmatter as unknown as Record<string, unknown>,\n id: defaultSection.id,\n pathname: defaultSection.pathname,\n title: defaultSection.title,\n url: defaultSection.pathname,\n }\n const {sections, toc} = this.sectionExtractor.extract(tree, pageInfo)\n indexedPage = {sections, toc}\n }\n } catch (error: any) {\n console.debug(\n `${chalk.yellowBright.bold(\n \"Failed to parse mdx page content.\",\n )} ${chalk.blueBright.bold(filePath)}`,\n )\n\n if (this.config.throwOnError) {\n throw new Error(error)\n }\n\n return {metadata, pageSections: [defaultSection]}\n }\n\n const {sections, toc} = indexedPage\n\n if (previousPage) {\n for (let i = 0; i < toc.length; i++) {\n const previousHeading = previousPage.toc[i]\n const currentHeading = toc[i]\n if (previousHeading?.id !== currentHeading.id) {\n metadata.changed.toc = true\n break\n }\n }\n }\n\n if (toc.length) {\n this._pageMap[defaultSection.pathname].toc = toc\n }\n\n let docPropSections: IndexedSection[] = []\n let docProps: Record<string, QuiPropTypes> = {}\n\n if (this.config.typeDocProps) {\n docPropSections =\n cached?.pageDocPropSections ||\n (this.docPropsIndexer.build(fileContents, toc) ?? [])\n docProps = cached?.pageDocProps || this.docPropsIndexer.getDocProps()\n }\n\n const hasDocProps = docPropSections.length || Object.keys(docProps).length\n\n if (hasDocProps) {\n this._pageDocProps[defaultSection.pathname] = docProps\n\n if (this.config.validatePageLinks) {\n const ids = new Set<string>()\n for (const section of docPropSections) {\n if (section.heading?.id) {\n ids.add(section.heading.id)\n }\n }\n if (ids.size) {\n this._docPropIds[defaultSection.pathname] = ids\n }\n }\n }\n\n if (!cached) {\n this.mdxFileReader.updateCache(filePath, fileContents, {\n collectedLinks,\n frontmatter,\n page: indexedPage,\n pageDocProps: docProps,\n pageDocPropSections: docPropSections,\n })\n }\n\n // omit entries from pages that are explicitly omitted from the index.\n if (frontmatter.hideFromSearch) {\n return {metadata, pageSections: [defaultSection]}\n }\n\n if (!sections.length && !docPropSections.length) {\n return {metadata, pageSections: [defaultSection]}\n }\n\n const sectionReturn: PageSection[] = [\n ...this.formatContentSections(sections, defaultSection),\n ]\n\n if (this.config.typeDocPropsOptions?.includeInSearchIndex) {\n sectionReturn.push(\n ...this.formatDocPropSections(docPropSections, defaultSection),\n )\n }\n\n return {metadata, pageSections: sectionReturn}\n }\n\n private formatContentSections(\n sections: SectionEntry[],\n {toc: _toc, ...defaultSection}: PageSection,\n ): PageSection[] {\n return sections.map((section, index): PageSection => {\n const heading = section.headerPath.at(-1) ?? defaultSection.title\n return {\n ...defaultSection,\n content: section.content || undefined,\n heading,\n headingLevel: section.headingLevel,\n href: section.url ?? defaultSection.pathname,\n id: `${defaultSection.id}-${index}`,\n }\n })\n }\n\n private formatDocPropSections(\n sections: IndexedSection[],\n {toc: _toc, ...defaultSection}: PageSection,\n ): PageSection[] {\n return sections.map((section, index): PageSection => {\n const content = section.content.map((c) => c.text.join(\" \")).join(\" \")\n return {\n ...defaultSection,\n content: content || undefined,\n heading: section.heading?.textContent ?? defaultSection.title,\n headingLevel: section.heading?.headingLevel,\n href: section.heading\n ? `${defaultSection.pathname}#${section.heading.id}`\n : defaultSection.pathname,\n id: `${defaultSection.id}-${index}-prop`,\n isDocProp: true,\n }\n })\n }\n\n private compileTsxFile(filepath: string) {\n const entry = this.getPageEntry(filepath, {})\n\n const routeMeta = getRouteMeta(\n entry.pathSegments.length === 0 ? [\"_index\"] : entry.pathSegments,\n this.metaJson,\n )\n\n if (!routeMeta) {\n return null\n }\n\n if (!entry.hidden) {\n this.navBuilder.add(entry, {}, routeMeta)\n }\n\n this._pageMap[entry.pathname] = entry\n\n return entry\n }\n\n buildIndex(\n inputFileGlob: string[],\n logWarnings: boolean = true,\n ): CompiledMdxFile[] {\n this.logWarnings = logWarnings\n this.mdxFileReader.logWarnings = logWarnings\n // Windows path fix\n const fileGlob = inputFileGlob.map(fixPath)\n this.navBuilder.reset()\n this.reset()\n\n const mdxFileGlob = filterFileGlob(\n fileGlob,\n \"mdx\",\n this.config.srcDir,\n this.config.routingStrategy,\n )\n\n this._mdxFileCount = mdxFileGlob.length\n if (\n !this.mdxFileReader.enabled ||\n this.mdxFileReader.gitMetadataMap.size === 0\n ) {\n this.mdxFileReader.gitMetadataMap = buildGitMetadataMap(\n this.config.srcDir,\n this.mdxFileReader.pageTimestampMetadata,\n )\n }\n\n const compiledFiles = mdxFileGlob.map((file) => this.compileMdxFile(file))\n\n const mdxIndex = compiledFiles\n .map((fileData) => fileData.pageSections)\n .flat()\n\n filterFileGlob(\n fileGlob,\n \"tsx\",\n this.config.srcDir,\n this.config.routingStrategy,\n ).map((file) => this.compileTsxFile(file))\n\n this._searchIndex.push(...mdxIndex.filter((entry) => !entry.hideFromSearch))\n\n this.navBuilder.build()\n\n if (this.config.validatePageLinks) {\n const invalidLinks = validateLinks(\n this._collectedLinks,\n this._pageMap,\n this._docPropIds,\n this._anchorIds,\n )\n reportInvalidLinks(invalidLinks)\n }\n\n return compiledFiles\n }\n}\n"],"mappings":"q9BAMA,SAAgB,EAAQ,EAAqB,CAC3C,OAAO,EAAI,WAAW,KAAM,GAAG,CACjC,CAKA,SAAgB,GAAoB,EAAqB,CACvD,OAAO,EAAI,SAAS,GAAG,EAAI,EAAI,UAAU,EAAG,EAAI,OAAS,CAAC,EAAI,CAChE,CCGA,SAAS,GAA2B,CAClC,MAAO,CACL,KAKE,GACG,EAAE,OAAO,CAAM,CACtB,CACF,CAEA,IAAa,GAA+B,EAAmB,EAAE,KAAK,CACpE,GAAI,EAAE,MAAM,EAAE,SAAS,EACvB,aAAc,EAAE,OAAO,EAAE,SAAS,EAClC,UAAW,EAAE,QAAQ,EAAE,SAAS,CAClC,CAAC,EAEY,EACX,EAAqB,EAAE,KAAK,CAC1B,SAAU,EAAE,MAAM,EAAE,SAAW,CAAe,CAAC,EAAE,SAAS,EAC1D,SAAU,EAAE,QAAQ,EAAE,SAAS,EAC/B,MAAO,EAAE,OAAO,EAAE,SAAS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O,SACP,KAAM,cACN,OAAQ,KACR,OAAQ,eACR,cAAe,QACf,eAAgB,QAChB,YAAa,IACb,QAAS,YACT,MAAO,IACT,CACF,EACA,KAAM,UACR,CACF,CAQA,IAAM,GAA+C,CACnD,QAAS,CACP,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,UACP,YAAa,CACX,OACE,wEACJ,CACF,EACA,KAAM,UACR,EACA,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,OACP,YAAa,CACX,GAAI,KACJ,GAAI,KACJ,GAAI,IACJ,GAAI,IACN,CACF,EACA,KAAM,UACR,EACA,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,OACP,YAAa,CACX,GAAI,KACJ,GAAI,QACJ,GAAI,KACJ,GAAI,IACN,CACF,EACA,KAAM,UACR,CACF,EACA,KAAM,CACJ,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,SACP,YAAa,CACX,GAAI,KACJ,GAAI,KACJ,EAAG,IACL,CACF,EACA,KAAM,UACR,EACA,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,OACP,YAAa,CACX,EAAG,WACL,CACF,EACA,KAAM,UACR,EACA,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,OACP,YAAa,CACX,EAAG,WACL,CACF,EACA,KAAM,UACR,CACF,EACA,QAAS,CACP,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,OACP,YAAa,CACX,EAAG,iBACL,CACF,EACA,KAAM,UACR,CACF,EACA,IAAK,CACH,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,OACP,YAAa,CACX,EAAG,sGACL,CACF,EACA,KAAM,UACR,EACA,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,OACP,YAAa,CACX,EAAG,SACL,CACF,EACA,KAAM,UACR,EACA,CACE,SAAU,CAAC,EACX,KAAM,CACJ,MAAO,OACP,YAAa,CACX,EAAG,UACL,CACF,EACA,KAAM,UACR,CACF,EACA,QAAS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,cAAc,eAAiB,GAClC,KAAK,OAAO,OACZ,KAAK,cAAc,qBACrB,GAGF,IAAM,EAAgB,EAAY,IAAK,GAAS,KAAK,eAAe,CAAI,CAAC,EAEnE,EAAW,EACd,IAAK,GAAa,EAAS,YAAY,EACvC,KAAK,EAuBR,OArBA,GACE,EACA,MACA,KAAK,OAAO,OACZ,KAAK,OAAO,eACd,EAAE,IAAK,GAAS,KAAK,eAAe,CAAI,CAAC,EAEzC,KAAK,aAAa,KAAK,GAAG,EAAS,OAAQ,GAAU,CAAC,EAAM,cAAc,CAAC,EAE3E,KAAK,WAAW,MAAM,EAElB,KAAK,OAAO,mBAOd,GANqB,GACnB,KAAK,gBACL,KAAK,SACL,KAAK,YACL,KAAK,UAEY,CAAY,EAG1B,CACT,CACF"}
package/package.json CHANGED
@@ -1,17 +1,13 @@
1
1
  {
2
2
  "name": "@qualcomm-ui/mdx-vite",
3
- "version": "3.8.3",
3
+ "version": "3.8.5",
4
4
  "description": "Vite documentation plugin for applications that use MDX",
5
- "author": "Ryan Bower",
6
5
  "license": "BSD-3-Clause-Clear",
6
+ "author": "Ryan Bower",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/qualcomm/qualcomm-ui"
10
10
  },
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "type": "module",
15
11
  "bin": {
16
12
  "qui-mdx-vite": "./lib/cli.js"
17
13
  },
@@ -19,6 +15,7 @@
19
15
  "dist",
20
16
  "lib"
21
17
  ],
18
+ "type": "module",
22
19
  "types": "./dist/index.d.ts",
23
20
  "exports": {
24
21
  ".": {
@@ -36,6 +33,9 @@
36
33
  "types": "./dist/react-demo-plugin/virtual.d.ts"
37
34
  }
38
35
  },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
39
  "dependencies": {
40
40
  "@shikijs/rehype": "^3.13.0",
41
41
  "@shikijs/transformers": "^3.13.0",
@@ -72,9 +72,9 @@
72
72
  "uuid": "^14.0.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@qualcomm-ui/mdx-common": "^2.4.1",
76
- "@qualcomm-ui/typedoc-common": "^1.0.7",
77
- "@qualcomm-ui/utils": "^1.3.1",
75
+ "@qualcomm-ui/mdx-common": "^2.4.2",
76
+ "@qualcomm-ui/typedoc-common": "^1.0.8",
77
+ "@qualcomm-ui/utils": "^1.3.2",
78
78
  "lodash-es": ">=4.17.21 <5",
79
79
  "minimatch": ">=10",
80
80
  "rehype-mdx-code-props": ">=3 <4",
@@ -87,7 +87,7 @@
87
87
  "zod": ">=4.1.0"
88
88
  },
89
89
  "optionalDependencies": {
90
- "@qualcomm-ui/tailwind-plugin": "^1.7.3",
90
+ "@qualcomm-ui/tailwind-plugin": "^1.7.4",
91
91
  "postcss": "^8.5.6",
92
92
  "postcss-selector-parser": "^7.1.1",
93
93
  "tailwindcss": "^4.1.17"
@@ -1,14 +0,0 @@
1
- import type { SharedConfig } from "./env";
2
- export interface KnowledgeCleanerConfig extends SharedConfig {
3
- }
4
- export declare class KnowledgeCleaner {
5
- private readonly filesApi;
6
- private readonly knowledgeApi;
7
- constructor(config: KnowledgeCleanerConfig);
8
- /**
9
- * TODO: fix. A recent OWUI update changed the KnowledgeApi.list command. We used
10
- * that to determine which files belonged to which Knowledge Base.
11
- */
12
- cleanUpOrphanedFiles(): Promise<void>;
13
- }
14
- //# sourceMappingURL=knowledge-cleaner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"knowledge-cleaner.d.ts","sourceRoot":"","sources":["../../src/open-web-ui/knowledge-cleaner.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,OAAO,CAAA;AAEvC,MAAM,WAAW,sBAAuB,SAAQ,YAAY;CAAG;AAE/D,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;gBAE/B,MAAM,EAAE,sBAAsB;IAS1C;;;OAGG;IACG,oBAAoB;CAC3B"}