typedoc 0.28.19 → 0.28.20

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 (396) hide show
  1. package/bin/typedoc +1 -1
  2. package/dist/browser-utils.js +29 -2
  3. package/dist/cli.js +111 -0
  4. package/dist/index.js +17888 -44
  5. package/dist/models.js +3736 -0
  6. package/dist/node-utils.js +7018 -0
  7. package/dist/serialization.js +430 -0
  8. package/dist/{lib → types}/application-events.d.ts +2 -0
  9. package/dist/{lib → types}/application.d.ts +51 -8
  10. package/dist/{lib → types}/converter/comments/declarationReferenceResolver.d.ts +1 -1
  11. package/dist/{lib → types}/converter/comments/discovery.d.ts +3 -3
  12. package/dist/{lib → types}/converter/comments/index.d.ts +4 -4
  13. package/dist/{lib → types}/converter/comments/lexer.d.ts +1 -1
  14. package/dist/{lib → types}/converter/comments/linkResolver.d.ts +1 -1
  15. package/dist/{lib → types}/converter/comments/parser.d.ts +3 -4
  16. package/dist/{lib → types}/converter/comments/textParser.d.ts +8 -2
  17. package/dist/{lib → types}/converter/components.d.ts +1 -1
  18. package/dist/{lib → types}/converter/context.d.ts +2 -2
  19. package/dist/{lib → types}/converter/converter.d.ts +6 -8
  20. package/dist/{lib → types}/converter/factories/signature.d.ts +1 -1
  21. package/dist/{lib → types}/converter/index.d.ts +1 -0
  22. package/dist/{lib → types}/converter/plugins/CategoryPlugin.d.ts +2 -2
  23. package/dist/{lib → types}/converter/plugins/GroupPlugin.d.ts +2 -3
  24. package/dist/{lib → types}/converter/plugins/IncludePlugin.d.ts +1 -1
  25. package/dist/{lib → types}/converter/plugins/InheritDocPlugin.d.ts +1 -1
  26. package/dist/{lib → types}/converter/plugins/LinkResolverPlugin.d.ts +3 -3
  27. package/dist/{lib → types}/converter/plugins/SourcePlugin.d.ts +1 -2
  28. package/dist/{lib → types}/converter/plugins/TypePlugin.d.ts +1 -1
  29. package/dist/{lib → types}/converter/types.d.ts +1 -1
  30. package/dist/{lib/converter/utils → types/converter/utilities}/reflections.d.ts +1 -1
  31. package/dist/{lib/converter/utils → types/converter/utilities}/repository.d.ts +14 -13
  32. package/dist/{index.d.ts → types/index.d.ts} +15 -16
  33. package/dist/{lib → types}/internationalization/internationalization.d.ts +0 -8
  34. package/dist/types/internationalization/locale-utils.d.ts +3 -0
  35. package/dist/types/internationalization/locales/de.d.ts +368 -0
  36. package/dist/{lib/internationalization/locales/en.d.cts → types/internationalization/locales/en.d.ts} +2 -1
  37. package/dist/types/internationalization/locales/fr.d.ts +346 -0
  38. package/dist/types/internationalization/locales/ja.d.ts +307 -0
  39. package/dist/types/internationalization/locales/ko.d.ts +221 -0
  40. package/dist/types/internationalization/locales/zh.d.ts +452 -0
  41. package/dist/{lib → types}/internationalization/translatable.d.ts +1 -1
  42. package/dist/{lib → types}/models/FileRegistry.d.ts +5 -0
  43. package/dist/{lib → types}/models/ReflectionSymbolId.d.ts +9 -3
  44. package/dist/{lib → types}/models/SourceReference.d.ts +5 -3
  45. package/dist/types/models.d.ts +1 -0
  46. package/dist/types/node-utils.d.ts +1 -0
  47. package/dist/{lib → types}/output/components.d.ts +3 -3
  48. package/dist/{lib → types}/output/events.d.ts +1 -2
  49. package/dist/{lib → types}/output/formatter.d.ts +1 -2
  50. package/dist/{lib → types}/output/output.d.ts +2 -2
  51. package/dist/{lib → types}/output/renderer.d.ts +4 -5
  52. package/dist/{lib → types}/output/router.d.ts +2 -2
  53. package/dist/{lib → types}/output/themes/MarkedPlugin.d.ts +3 -3
  54. package/dist/{lib → types}/output/themes/default/DefaultTheme.d.ts +1 -1
  55. package/dist/{lib → types}/output/themes/default/DefaultThemeRenderContext.d.ts +25 -25
  56. package/dist/{lib → types}/output/themes/default/layouts/default.d.ts +1 -1
  57. package/dist/{lib → types}/output/themes/default/partials/anchor-icon.d.ts +1 -1
  58. package/dist/{lib → types}/output/themes/default/partials/breadcrumb.d.ts +1 -1
  59. package/dist/{lib → types}/output/themes/default/partials/comment.d.ts +1 -1
  60. package/dist/{lib → types}/output/themes/default/partials/header.d.ts +1 -1
  61. package/dist/{lib → types}/output/themes/default/partials/hierarchy.d.ts +1 -1
  62. package/dist/{lib → types}/output/themes/default/partials/icon.d.ts +1 -1
  63. package/dist/{lib → types}/output/themes/default/partials/index.d.ts +1 -1
  64. package/dist/{lib → types}/output/themes/default/partials/member.d.ts +1 -1
  65. package/dist/{lib → types}/output/themes/default/partials/member.getterSetter.d.ts +1 -1
  66. package/dist/{lib → types}/output/themes/default/partials/member.signature.body.d.ts +1 -1
  67. package/dist/{lib → types}/output/themes/default/partials/member.signature.title.d.ts +2 -2
  68. package/dist/{lib → types}/output/themes/default/partials/member.signatures.d.ts +1 -1
  69. package/dist/{lib → types}/output/themes/default/partials/member.sources.d.ts +1 -1
  70. package/dist/{lib → types}/output/themes/default/partials/members.d.ts +1 -1
  71. package/dist/{lib → types}/output/themes/default/partials/moduleReflection.d.ts +1 -1
  72. package/dist/{lib → types}/output/themes/default/partials/navigation.d.ts +1 -1
  73. package/dist/{lib → types}/output/themes/default/partials/reflectionPreview.d.ts +1 -1
  74. package/dist/{lib → types}/output/themes/default/partials/toolbar.d.ts +1 -1
  75. package/dist/{lib → types}/output/themes/default/partials/type.d.ts +2 -2
  76. package/dist/{lib → types}/output/themes/default/partials/typeDetails.d.ts +2 -2
  77. package/dist/{lib → types}/output/themes/default/partials/typeParameters.d.ts +1 -1
  78. package/dist/{lib → types}/output/themes/default/templates/document.d.ts +1 -1
  79. package/dist/{lib → types}/output/themes/default/templates/hierarchy.d.ts +1 -1
  80. package/dist/{lib → types}/output/themes/default/templates/index.d.ts +1 -1
  81. package/dist/{lib → types}/output/themes/default/templates/reflection.d.ts +1 -1
  82. package/dist/{lib → types}/output/themes/lib.d.ts +1 -1
  83. package/dist/types/serialization.d.ts +1 -0
  84. package/dist/types/tsconfig.tsbuildinfo +1 -0
  85. package/dist/{lib → types}/utils/ValidatingFileRegistry.d.ts +1 -1
  86. package/dist/{lib → types}/utils/entry-point.d.ts +2 -2
  87. package/dist/{lib → types}/utils/general.d.ts +3 -0
  88. package/dist/types/utils/index.d.ts +22 -0
  89. package/dist/{lib → types}/utils/options/declaration.d.ts +1 -1
  90. package/dist/{lib → types}/utils/options/defaults.d.ts +1 -1
  91. package/dist/{lib → types}/utils/options/index.d.ts +2 -1
  92. package/dist/{lib → types}/utils/options/options.d.ts +1 -1
  93. package/dist/{lib → types}/utils/options/tsdoc-defaults.d.ts +1 -1
  94. package/dist/{lib → types}/utils/reflections.d.ts +1 -1
  95. package/dist/{lib → types}/utils/sort.d.ts +1 -2
  96. package/dist/{lib → types}/utils-common/general.d.ts +4 -4
  97. package/dist/types/utils-common.d.ts +1 -0
  98. package/dist/{lib → types}/validation/documentation.d.ts +1 -1
  99. package/dist/{lib → types}/validation/exports.d.ts +1 -1
  100. package/dist/types/validation/filePaths.d.ts +3 -0
  101. package/dist/{lib → types}/validation/links.d.ts +1 -1
  102. package/dist/{lib → types}/validation/unusedMergeModuleWith.d.ts +1 -1
  103. package/dist/utils-common.js +1311 -0
  104. package/package.json +45 -36
  105. package/static/main.js +1 -1
  106. package/static/style.css +18 -3
  107. package/tsdoc.json +4 -0
  108. package/typedoc-config.schema.json +1 -0
  109. package/dist/lib/application-events.js +0 -5
  110. package/dist/lib/application.js +0 -716
  111. package/dist/lib/cli.js +0 -111
  112. package/dist/lib/converter/comments/blockLexer.js +0 -391
  113. package/dist/lib/converter/comments/declarationReferenceResolver.js +0 -218
  114. package/dist/lib/converter/comments/discovery.js +0 -567
  115. package/dist/lib/converter/comments/index.js +0 -241
  116. package/dist/lib/converter/comments/lexer.js +0 -10
  117. package/dist/lib/converter/comments/lineLexer.js +0 -279
  118. package/dist/lib/converter/comments/linkResolver.js +0 -186
  119. package/dist/lib/converter/comments/parser.js +0 -538
  120. package/dist/lib/converter/comments/rawLexer.js +0 -218
  121. package/dist/lib/converter/comments/tagName.js +0 -58
  122. package/dist/lib/converter/comments/textParser.js +0 -372
  123. package/dist/lib/converter/components.js +0 -3
  124. package/dist/lib/converter/context.js +0 -311
  125. package/dist/lib/converter/convert-expression.js +0 -58
  126. package/dist/lib/converter/converter-events.js +0 -13
  127. package/dist/lib/converter/converter.js +0 -705
  128. package/dist/lib/converter/factories/index-signature.js +0 -50
  129. package/dist/lib/converter/factories/signature.js +0 -353
  130. package/dist/lib/converter/factories/symbol-id.js +0 -50
  131. package/dist/lib/converter/index.js +0 -3
  132. package/dist/lib/converter/jsdoc.js +0 -135
  133. package/dist/lib/converter/plugins/CategoryPlugin.js +0 -278
  134. package/dist/lib/converter/plugins/CommentPlugin.js +0 -770
  135. package/dist/lib/converter/plugins/GroupPlugin.js +0 -281
  136. package/dist/lib/converter/plugins/ImplementsPlugin.js +0 -438
  137. package/dist/lib/converter/plugins/IncludePlugin.js +0 -254
  138. package/dist/lib/converter/plugins/InheritDocPlugin.js +0 -220
  139. package/dist/lib/converter/plugins/LinkResolverPlugin.js +0 -88
  140. package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +0 -50
  141. package/dist/lib/converter/plugins/PackagePlugin.js +0 -188
  142. package/dist/lib/converter/plugins/SourcePlugin.js +0 -215
  143. package/dist/lib/converter/plugins/TypePlugin.js +0 -108
  144. package/dist/lib/converter/plugins/index.js +0 -10
  145. package/dist/lib/converter/symbols.js +0 -861
  146. package/dist/lib/converter/types.js +0 -833
  147. package/dist/lib/converter/utils/nodes.js +0 -26
  148. package/dist/lib/converter/utils/reflections.js +0 -17
  149. package/dist/lib/converter/utils/repository.js +0 -295
  150. package/dist/lib/converter/utils/symbols.js +0 -12
  151. package/dist/lib/debug/index.js +0 -2
  152. package/dist/lib/debug/reflectionLifetimes.js +0 -27
  153. package/dist/lib/debug/rendererUrls.js +0 -68
  154. package/dist/lib/internationalization/index.js +0 -7
  155. package/dist/lib/internationalization/internationalization.js +0 -64
  156. package/dist/lib/internationalization/locale-utils.cjs +0 -8
  157. package/dist/lib/internationalization/locale-utils.d.cts +0 -8
  158. package/dist/lib/internationalization/locales/de.cjs +0 -401
  159. package/dist/lib/internationalization/locales/de.d.cts +0 -368
  160. package/dist/lib/internationalization/locales/en.cjs +0 -411
  161. package/dist/lib/internationalization/locales/fr.cjs +0 -347
  162. package/dist/lib/internationalization/locales/fr.d.cts +0 -346
  163. package/dist/lib/internationalization/locales/ja.cjs +0 -320
  164. package/dist/lib/internationalization/locales/ja.d.cts +0 -307
  165. package/dist/lib/internationalization/locales/ko.cjs +0 -233
  166. package/dist/lib/internationalization/locales/ko.d.cts +0 -221
  167. package/dist/lib/internationalization/locales/zh.cjs +0 -488
  168. package/dist/lib/internationalization/locales/zh.d.cts +0 -452
  169. package/dist/lib/internationalization/translatable.js +0 -8
  170. package/dist/lib/models/Comment.js +0 -534
  171. package/dist/lib/models/ContainerReflection.js +0 -159
  172. package/dist/lib/models/DeclarationReflection.js +0 -287
  173. package/dist/lib/models/DocumentReflection.js +0 -66
  174. package/dist/lib/models/FileRegistry.js +0 -133
  175. package/dist/lib/models/ParameterReflection.js +0 -39
  176. package/dist/lib/models/ProjectReflection.js +0 -417
  177. package/dist/lib/models/ReferenceReflection.js +0 -85
  178. package/dist/lib/models/Reflection.js +0 -495
  179. package/dist/lib/models/ReflectionCategory.js +0 -56
  180. package/dist/lib/models/ReflectionGroup.js +0 -72
  181. package/dist/lib/models/ReflectionSymbolId.js +0 -85
  182. package/dist/lib/models/SignatureReflection.js +0 -96
  183. package/dist/lib/models/SourceReference.js +0 -50
  184. package/dist/lib/models/TypeParameterReflection.js +0 -45
  185. package/dist/lib/models/index.js +0 -19
  186. package/dist/lib/models/kind.js +0 -231
  187. package/dist/lib/models/types.js +0 -1296
  188. package/dist/lib/models/utils.js +0 -26
  189. package/dist/lib/models/variant.js +0 -1
  190. package/dist/lib/output/components.js +0 -133
  191. package/dist/lib/output/events.js +0 -195
  192. package/dist/lib/output/formatter.js +0 -660
  193. package/dist/lib/output/index.js +0 -7
  194. package/dist/lib/output/output.js +0 -92
  195. package/dist/lib/output/plugins/AssetsPlugin.js +0 -160
  196. package/dist/lib/output/plugins/HierarchyPlugin.js +0 -65
  197. package/dist/lib/output/plugins/IconsPlugin.js +0 -58
  198. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +0 -222
  199. package/dist/lib/output/plugins/NavigationPlugin.js +0 -23
  200. package/dist/lib/output/plugins/SitemapPlugin.js +0 -82
  201. package/dist/lib/output/plugins/index.js +0 -7
  202. package/dist/lib/output/renderer.js +0 -387
  203. package/dist/lib/output/router.js +0 -522
  204. package/dist/lib/output/theme.js +0 -17
  205. package/dist/lib/output/themes/MarkedPlugin.js +0 -461
  206. package/dist/lib/output/themes/default/DefaultTheme.js +0 -367
  207. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +0 -151
  208. package/dist/lib/output/themes/default/Slugger.js +0 -60
  209. package/dist/lib/output/themes/default/layouts/default.js +0 -89
  210. package/dist/lib/output/themes/default/partials/anchor-icon.js +0 -9
  211. package/dist/lib/output/themes/default/partials/breadcrumb.js +0 -11
  212. package/dist/lib/output/themes/default/partials/comment.js +0 -80
  213. package/dist/lib/output/themes/default/partials/footer.js +0 -37
  214. package/dist/lib/output/themes/default/partials/header.js +0 -39
  215. package/dist/lib/output/themes/default/partials/hierarchy.js +0 -32
  216. package/dist/lib/output/themes/default/partials/icon.js +0 -101
  217. package/dist/lib/output/themes/default/partials/index.js +0 -24
  218. package/dist/lib/output/themes/default/partials/member.declaration.js +0 -35
  219. package/dist/lib/output/themes/default/partials/member.getterSetter.js +0 -12
  220. package/dist/lib/output/themes/default/partials/member.js +0 -36
  221. package/dist/lib/output/themes/default/partials/member.signature.body.js +0 -33
  222. package/dist/lib/output/themes/default/partials/member.signature.title.js +0 -9
  223. package/dist/lib/output/themes/default/partials/member.signatures.js +0 -9
  224. package/dist/lib/output/themes/default/partials/member.sources.js +0 -55
  225. package/dist/lib/output/themes/default/partials/members.js +0 -17
  226. package/dist/lib/output/themes/default/partials/moduleReflection.js +0 -68
  227. package/dist/lib/output/themes/default/partials/navigation.js +0 -144
  228. package/dist/lib/output/themes/default/partials/reflectionPreview.js +0 -26
  229. package/dist/lib/output/themes/default/partials/toolbar.js +0 -13
  230. package/dist/lib/output/themes/default/partials/type.js +0 -9
  231. package/dist/lib/output/themes/default/partials/typeAndParent.js +0 -28
  232. package/dist/lib/output/themes/default/partials/typeDetails.js +0 -284
  233. package/dist/lib/output/themes/default/partials/typeParameters.js +0 -26
  234. package/dist/lib/output/themes/default/templates/document.js +0 -3
  235. package/dist/lib/output/themes/default/templates/hierarchy.js +0 -31
  236. package/dist/lib/output/themes/default/templates/index.js +0 -3
  237. package/dist/lib/output/themes/default/templates/reflection.js +0 -53
  238. package/dist/lib/output/themes/lib.js +0 -218
  239. package/dist/lib/serialization/components.js +0 -1
  240. package/dist/lib/serialization/deserializer.js +0 -235
  241. package/dist/lib/serialization/events.js +0 -18
  242. package/dist/lib/serialization/index.js +0 -4
  243. package/dist/lib/serialization/schema.js +0 -32
  244. package/dist/lib/serialization/serializer.js +0 -65
  245. package/dist/lib/utils/ValidatingFileRegistry.js +0 -52
  246. package/dist/lib/utils/component.js +0 -41
  247. package/dist/lib/utils/compress.js +0 -13
  248. package/dist/lib/utils/declaration-maps.js +0 -51
  249. package/dist/lib/utils/entry-point.js +0 -330
  250. package/dist/lib/utils/fs.js +0 -372
  251. package/dist/lib/utils/general.js +0 -25
  252. package/dist/lib/utils/highlighter.js +0 -150
  253. package/dist/lib/utils/html-entities.js +0 -2329
  254. package/dist/lib/utils/html.js +0 -635
  255. package/dist/lib/utils/index.d.ts +0 -17
  256. package/dist/lib/utils/index.js +0 -15
  257. package/dist/lib/utils/loggers.js +0 -71
  258. package/dist/lib/utils/options/declaration.js +0 -444
  259. package/dist/lib/utils/options/defaults.js +0 -104
  260. package/dist/lib/utils/options/help.js +0 -63
  261. package/dist/lib/utils/options/index.js +0 -4
  262. package/dist/lib/utils/options/options.js +0 -273
  263. package/dist/lib/utils/options/readers/arguments.js +0 -109
  264. package/dist/lib/utils/options/readers/index.js +0 -4
  265. package/dist/lib/utils/options/readers/package-json.js +0 -40
  266. package/dist/lib/utils/options/readers/tsconfig.js +0 -172
  267. package/dist/lib/utils/options/readers/typedoc.js +0 -136
  268. package/dist/lib/utils/options/sources/index.js +0 -1
  269. package/dist/lib/utils/options/sources/typedoc.js +0 -876
  270. package/dist/lib/utils/options/tsdoc-defaults.js +0 -94
  271. package/dist/lib/utils/package-manifest.js +0 -84
  272. package/dist/lib/utils/paths.js +0 -127
  273. package/dist/lib/utils/perf.js +0 -86
  274. package/dist/lib/utils/plugins.js +0 -61
  275. package/dist/lib/utils/reflections.js +0 -64
  276. package/dist/lib/utils/sort.js +0 -153
  277. package/dist/lib/utils/tsconfig.js +0 -60
  278. package/dist/lib/utils/tsutils.js +0 -23
  279. package/dist/lib/utils-common/array.js +0 -152
  280. package/dist/lib/utils-common/declarationReference.js +0 -341
  281. package/dist/lib/utils-common/enum.js +0 -27
  282. package/dist/lib/utils-common/events.js +0 -49
  283. package/dist/lib/utils-common/general.js +0 -22
  284. package/dist/lib/utils-common/hooks.js +0 -90
  285. package/dist/lib/utils-common/i18n.js +0 -39
  286. package/dist/lib/utils-common/index.js +0 -17
  287. package/dist/lib/utils-common/jsx.elements.js +0 -3
  288. package/dist/lib/utils-common/jsx.js +0 -187
  289. package/dist/lib/utils-common/logger.js +0 -129
  290. package/dist/lib/utils-common/map.js +0 -63
  291. package/dist/lib/utils-common/minimalSourceFile.js +0 -43
  292. package/dist/lib/utils-common/path.js +0 -130
  293. package/dist/lib/utils-common/set.js +0 -23
  294. package/dist/lib/utils-common/string.js +0 -84
  295. package/dist/lib/utils-common/validation.js +0 -50
  296. package/dist/lib/validation/documentation.js +0 -91
  297. package/dist/lib/validation/exports.js +0 -65
  298. package/dist/lib/validation/links.js +0 -78
  299. package/dist/lib/validation/unusedMergeModuleWith.js +0 -12
  300. /package/dist/{browser-utils.d.ts → types/browser-utils.d.ts} +0 -0
  301. /package/dist/{lib → types}/cli.d.ts +0 -0
  302. /package/dist/{lib → types}/converter/comments/blockLexer.d.ts +0 -0
  303. /package/dist/{lib → types}/converter/comments/lineLexer.d.ts +0 -0
  304. /package/dist/{lib → types}/converter/comments/rawLexer.d.ts +0 -0
  305. /package/dist/{lib → types}/converter/comments/tagName.d.ts +0 -0
  306. /package/dist/{lib → types}/converter/convert-expression.d.ts +0 -0
  307. /package/dist/{lib → types}/converter/converter-events.d.ts +0 -0
  308. /package/dist/{lib → types}/converter/factories/index-signature.d.ts +0 -0
  309. /package/dist/{lib → types}/converter/factories/symbol-id.d.ts +0 -0
  310. /package/dist/{lib → types}/converter/jsdoc.d.ts +0 -0
  311. /package/dist/{lib → types}/converter/plugins/CommentPlugin.d.ts +0 -0
  312. /package/dist/{lib → types}/converter/plugins/ImplementsPlugin.d.ts +0 -0
  313. /package/dist/{lib → types}/converter/plugins/MergeModuleWithPlugin.d.ts +0 -0
  314. /package/dist/{lib → types}/converter/plugins/PackagePlugin.d.ts +0 -0
  315. /package/dist/{lib → types}/converter/plugins/index.d.ts +0 -0
  316. /package/dist/{lib → types}/converter/symbols.d.ts +0 -0
  317. /package/dist/{lib/converter/utils → types/converter/utilities}/nodes.d.ts +0 -0
  318. /package/dist/{lib/converter/utils → types/converter/utilities}/symbols.d.ts +0 -0
  319. /package/dist/{lib → types}/debug/index.d.ts +0 -0
  320. /package/dist/{lib → types}/debug/reflectionLifetimes.d.ts +0 -0
  321. /package/dist/{lib → types}/debug/rendererUrls.d.ts +0 -0
  322. /package/dist/{lib → types}/internationalization/index.d.ts +0 -0
  323. /package/dist/{lib → types}/models/Comment.d.ts +0 -0
  324. /package/dist/{lib → types}/models/ContainerReflection.d.ts +0 -0
  325. /package/dist/{lib → types}/models/DeclarationReflection.d.ts +0 -0
  326. /package/dist/{lib → types}/models/DocumentReflection.d.ts +0 -0
  327. /package/dist/{lib → types}/models/ParameterReflection.d.ts +0 -0
  328. /package/dist/{lib → types}/models/ProjectReflection.d.ts +0 -0
  329. /package/dist/{lib → types}/models/ReferenceReflection.d.ts +0 -0
  330. /package/dist/{lib → types}/models/Reflection.d.ts +0 -0
  331. /package/dist/{lib → types}/models/ReflectionCategory.d.ts +0 -0
  332. /package/dist/{lib → types}/models/ReflectionGroup.d.ts +0 -0
  333. /package/dist/{lib → types}/models/SignatureReflection.d.ts +0 -0
  334. /package/dist/{lib → types}/models/TypeParameterReflection.d.ts +0 -0
  335. /package/dist/{lib → types}/models/index.d.ts +0 -0
  336. /package/dist/{lib → types}/models/kind.d.ts +0 -0
  337. /package/dist/{lib → types}/models/types.d.ts +0 -0
  338. /package/dist/{lib → types}/models/utils.d.ts +0 -0
  339. /package/dist/{lib → types}/models/variant.d.ts +0 -0
  340. /package/dist/{lib → types}/output/index.d.ts +0 -0
  341. /package/dist/{lib → types}/output/plugins/AssetsPlugin.d.ts +0 -0
  342. /package/dist/{lib → types}/output/plugins/HierarchyPlugin.d.ts +0 -0
  343. /package/dist/{lib → types}/output/plugins/IconsPlugin.d.ts +0 -0
  344. /package/dist/{lib → types}/output/plugins/JavascriptIndexPlugin.d.ts +0 -0
  345. /package/dist/{lib → types}/output/plugins/NavigationPlugin.d.ts +0 -0
  346. /package/dist/{lib → types}/output/plugins/SitemapPlugin.d.ts +0 -0
  347. /package/dist/{lib → types}/output/plugins/index.d.ts +0 -0
  348. /package/dist/{lib → types}/output/theme.d.ts +0 -0
  349. /package/dist/{lib → types}/output/themes/default/Slugger.d.ts +0 -0
  350. /package/dist/{lib → types}/output/themes/default/partials/footer.d.ts +0 -0
  351. /package/dist/{lib → types}/output/themes/default/partials/member.declaration.d.ts +0 -0
  352. /package/dist/{lib → types}/output/themes/default/partials/typeAndParent.d.ts +0 -0
  353. /package/dist/{lib → types}/serialization/components.d.ts +0 -0
  354. /package/dist/{lib → types}/serialization/deserializer.d.ts +0 -0
  355. /package/dist/{lib → types}/serialization/events.d.ts +0 -0
  356. /package/dist/{lib → types}/serialization/index.d.ts +0 -0
  357. /package/dist/{lib → types}/serialization/schema.d.ts +0 -0
  358. /package/dist/{lib → types}/serialization/serializer.d.ts +0 -0
  359. /package/dist/{lib → types}/utils/component.d.ts +0 -0
  360. /package/dist/{lib → types}/utils/compress.d.ts +0 -0
  361. /package/dist/{lib → types}/utils/declaration-maps.d.ts +0 -0
  362. /package/dist/{lib → types}/utils/fs.d.ts +0 -0
  363. /package/dist/{lib → types}/utils/highlighter.d.ts +0 -0
  364. /package/dist/{lib → types}/utils/html-entities.d.ts +0 -0
  365. /package/dist/{lib → types}/utils/html.d.ts +0 -0
  366. /package/dist/{lib → types}/utils/loggers.d.ts +0 -0
  367. /package/dist/{lib → types}/utils/options/help.d.ts +0 -0
  368. /package/dist/{lib → types}/utils/options/readers/arguments.d.ts +0 -0
  369. /package/dist/{lib → types}/utils/options/readers/index.d.ts +0 -0
  370. /package/dist/{lib → types}/utils/options/readers/package-json.d.ts +0 -0
  371. /package/dist/{lib → types}/utils/options/readers/tsconfig.d.ts +0 -0
  372. /package/dist/{lib → types}/utils/options/readers/typedoc.d.ts +0 -0
  373. /package/dist/{lib → types}/utils/options/sources/index.d.ts +0 -0
  374. /package/dist/{lib → types}/utils/options/sources/typedoc.d.ts +0 -0
  375. /package/dist/{lib → types}/utils/package-manifest.d.ts +0 -0
  376. /package/dist/{lib → types}/utils/paths.d.ts +0 -0
  377. /package/dist/{lib → types}/utils/perf.d.ts +0 -0
  378. /package/dist/{lib → types}/utils/plugins.d.ts +0 -0
  379. /package/dist/{lib → types}/utils/tsconfig.d.ts +0 -0
  380. /package/dist/{lib → types}/utils/tsutils.d.ts +0 -0
  381. /package/dist/{lib → types}/utils-common/array.d.ts +0 -0
  382. /package/dist/{lib → types}/utils-common/declarationReference.d.ts +0 -0
  383. /package/dist/{lib → types}/utils-common/enum.d.ts +0 -0
  384. /package/dist/{lib → types}/utils-common/events.d.ts +0 -0
  385. /package/dist/{lib → types}/utils-common/hooks.d.ts +0 -0
  386. /package/dist/{lib → types}/utils-common/i18n.d.ts +0 -0
  387. /package/dist/{lib → types}/utils-common/index.d.ts +0 -0
  388. /package/dist/{lib → types}/utils-common/jsx.d.ts +0 -0
  389. /package/dist/{lib → types}/utils-common/jsx.elements.d.ts +0 -0
  390. /package/dist/{lib → types}/utils-common/logger.d.ts +0 -0
  391. /package/dist/{lib → types}/utils-common/map.d.ts +0 -0
  392. /package/dist/{lib → types}/utils-common/minimalSourceFile.d.ts +0 -0
  393. /package/dist/{lib → types}/utils-common/path.d.ts +0 -0
  394. /package/dist/{lib → types}/utils-common/set.d.ts +0 -0
  395. /package/dist/{lib → types}/utils-common/string.d.ts +0 -0
  396. /package/dist/{lib → types}/utils-common/validation.d.ts +0 -0
package/dist/models.js ADDED
@@ -0,0 +1,3736 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
5
+ var __typeError = (msg) => {
6
+ throw TypeError(msg);
7
+ };
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
11
+ var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
12
+ var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
13
+ var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
14
+ var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
15
+ var __runInitializers = (array, flags, self, value) => {
16
+ for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
17
+ return value;
18
+ };
19
+ var __decorateElement = (array, flags, name, decorators, target, extra) => {
20
+ var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
21
+ var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
22
+ var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
23
+ var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
24
+ return __privateGet(this, extra);
25
+ }, set [name](x) {
26
+ return __privateSet(this, extra, x);
27
+ } }, name));
28
+ k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
29
+ for (var i = decorators.length - 1; i >= 0; i--) {
30
+ ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
31
+ if (k) {
32
+ ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
33
+ if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
34
+ if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
35
+ }
36
+ it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
37
+ if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
38
+ else if (typeof it !== "object" || it === null) __typeError("Object expected");
39
+ else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
40
+ }
41
+ return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
42
+ };
43
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
44
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
45
+ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
46
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
47
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
48
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
49
+
50
+ // src/lib/models/Comment.ts
51
+ import { assertNever, i18n, NonEnumerable, removeIf } from "#utils";
52
+
53
+ // src/lib/models/ReflectionSymbolId.ts
54
+ import "#utils";
55
+
56
+ // src/lib/models/utils.ts
57
+ function splitUnquotedString(input, delimiter) {
58
+ if (input.startsWith(delimiter)) {
59
+ return splitUnquotedString(
60
+ input.substring(delimiter.length),
61
+ delimiter
62
+ );
63
+ }
64
+ if (input.startsWith('"')) {
65
+ const closingQuoteIndex = input.indexOf('"', 1);
66
+ if (closingQuoteIndex === -1) {
67
+ return input.split(delimiter);
68
+ }
69
+ if (closingQuoteIndex === input.length - 1) {
70
+ return [input];
71
+ } else {
72
+ const remainder = input.substring(closingQuoteIndex + 1);
73
+ return [
74
+ input.substring(0, closingQuoteIndex + 1),
75
+ ...splitUnquotedString(remainder, delimiter)
76
+ ];
77
+ }
78
+ } else {
79
+ return input.split(delimiter);
80
+ }
81
+ }
82
+
83
+ // src/lib/models/ReflectionSymbolId.ts
84
+ var ReflectionSymbolId = class {
85
+ /**
86
+ * This will only be used if we somehow cannot find a package.json file for
87
+ * source code. This is very unlikely, but if it occurs then the {@link packageName}
88
+ * will be set to this string, and {@link packagePath} will have the absolute path
89
+ * to the source file.
90
+ */
91
+ static UNKNOWN_PACKAGE = "<unknown>";
92
+ /**
93
+ * The name of the package which this symbol ID resides within.
94
+ */
95
+ packageName;
96
+ /**
97
+ * Path to the source file containing this symbol.
98
+ * Note that this is NOT an absolute path, but a package-relative path according
99
+ * to the directory containing package.json for the package name.
100
+ */
101
+ packagePath;
102
+ /**
103
+ * Qualified name of this symbol within the source file.
104
+ */
105
+ qualifiedName;
106
+ /**
107
+ * Note: This is **not** serialized. It exists for sorting by declaration order, but
108
+ * should not be needed when deserializing from JSON.
109
+ * Will be set to `Infinity` if the ID was deserialized from JSON.
110
+ */
111
+ pos;
112
+ /**
113
+ * Note: This is **not** serialized. It exists to support detection of the differences between
114
+ * symbols which share declarations, but are instantiated with different type parameters.
115
+ * This will be `NaN` if the symbol reference is not transient.
116
+ * Note: This can only be non-NaN if {@link pos} is finite.
117
+ */
118
+ transientId;
119
+ /**
120
+ * Note: This is **not** serialized, only {@link packageName} and {@link packagePath} path
121
+ * information is preserved when serializing. This is set so that it is available to plugins
122
+ * when initially converting a project.
123
+ *
124
+ * @privateRemarks
125
+ * This is used by typedoc-plugin-dt-links to determine the path to read to get the source
126
+ * code of a definitely typed package.
127
+ */
128
+ fileName;
129
+ constructor(json, pos, transientId, fileName) {
130
+ this.packageName = json.packageName;
131
+ this.packagePath = json.packagePath;
132
+ this.qualifiedName = json.qualifiedName;
133
+ this.pos = pos ?? Infinity;
134
+ this.transientId = transientId ?? NaN;
135
+ this.fileName = fileName;
136
+ }
137
+ getStableKey() {
138
+ if (Number.isFinite(this.pos)) {
139
+ return `${this.packageName}\0${this.packagePath}\0${this.qualifiedName}\0${this.pos}\0${this.transientId}`;
140
+ } else {
141
+ return `${this.packageName}\0${this.packagePath}\0${this.qualifiedName}`;
142
+ }
143
+ }
144
+ toDeclarationReference() {
145
+ return {
146
+ resolutionStart: "global",
147
+ moduleSource: this.packageName,
148
+ symbolReference: {
149
+ path: splitUnquotedString(this.qualifiedName, ".").map(
150
+ (path) => ({
151
+ navigation: ".",
152
+ path
153
+ })
154
+ )
155
+ }
156
+ };
157
+ }
158
+ toObject() {
159
+ return {
160
+ packageName: this.packageName,
161
+ packagePath: this.packagePath,
162
+ qualifiedName: this.qualifiedName
163
+ };
164
+ }
165
+ };
166
+
167
+ // src/lib/models/Comment.ts
168
+ var CommentTag = class _CommentTag {
169
+ /**
170
+ * The name of this tag, e.g. `@returns`, `@example`
171
+ */
172
+ tag;
173
+ /**
174
+ * Some tags, (`@typedef`, `@param`, `@property`, etc.) may have a user defined identifier associated with them.
175
+ * If this tag is one of those, it will be parsed out and included here.
176
+ */
177
+ name;
178
+ /**
179
+ * Optional type annotation associated with this tag. TypeDoc will remove type annotations unless explicitly
180
+ * requested by the user with the `preservedTypeAnnotationTags` option.
181
+ */
182
+ typeAnnotation;
183
+ /**
184
+ * The actual body text of this tag.
185
+ */
186
+ content;
187
+ /**
188
+ * A flag which may be set by plugins to prevent TypeDoc from rendering this tag, if the plugin provides
189
+ * custom rendering. Note: This flag is **not** serialized, it is expected to be set just before the comment
190
+ * is rendered.
191
+ */
192
+ skipRendering = false;
193
+ /**
194
+ * Create a new CommentTag instance.
195
+ */
196
+ constructor(tag, text) {
197
+ this.tag = tag;
198
+ this.content = text;
199
+ }
200
+ /**
201
+ * Checks if this block tag is roughly equal to the other tag.
202
+ * This isn't exactly equal, but just "roughly equal" by the tag
203
+ * text.
204
+ */
205
+ similarTo(other) {
206
+ return this.tag === other.tag && this.name === other.name && Comment.combineDisplayParts(this.content) === Comment.combineDisplayParts(other.content);
207
+ }
208
+ clone() {
209
+ const tag = new _CommentTag(
210
+ this.tag,
211
+ Comment.cloneDisplayParts(this.content)
212
+ );
213
+ if (this.name) {
214
+ tag.name = this.name;
215
+ }
216
+ if (this.typeAnnotation) {
217
+ tag.typeAnnotation = this.typeAnnotation;
218
+ }
219
+ return tag;
220
+ }
221
+ toObject() {
222
+ return {
223
+ tag: this.tag,
224
+ name: this.name,
225
+ content: Comment.serializeDisplayParts(this.content),
226
+ typeAnnotation: this.typeAnnotation
227
+ };
228
+ }
229
+ fromObject(de, obj) {
230
+ this.name = obj.name;
231
+ this.typeAnnotation = obj.typeAnnotation;
232
+ this.content = Comment.deserializeDisplayParts(de, obj.content);
233
+ }
234
+ };
235
+ var _inheritedFromParentDeclaration_dec, _discoveryId_dec, _sourcePath_dec, _init;
236
+ _sourcePath_dec = [NonEnumerable], _discoveryId_dec = [NonEnumerable], _inheritedFromParentDeclaration_dec = [NonEnumerable];
237
+ var _Comment = class _Comment {
238
+ /**
239
+ * Creates a new Comment instance.
240
+ */
241
+ constructor(summary = [], blockTags = [], modifierTags = /* @__PURE__ */ new Set()) {
242
+ /**
243
+ * The content of the comment which is not associated with a block tag.
244
+ */
245
+ __publicField(this, "summary");
246
+ /**
247
+ * All associated block level tags.
248
+ */
249
+ __publicField(this, "blockTags", []);
250
+ /**
251
+ * All modifier tags present on the comment, e.g. `@alpha`, `@beta`.
252
+ */
253
+ __publicField(this, "modifierTags", /* @__PURE__ */ new Set());
254
+ /**
255
+ * Label associated with this reflection, if any (https://tsdoc.org/pages/tags/label/)
256
+ */
257
+ __publicField(this, "label");
258
+ __publicField(this, "sourcePath", __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
259
+ __publicField(this, "discoveryId", __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
260
+ __publicField(this, "inheritedFromParentDeclaration", __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
261
+ this.summary = summary;
262
+ this.blockTags = blockTags;
263
+ this.modifierTags = modifierTags;
264
+ extractLabelTag(this);
265
+ }
266
+ /**
267
+ * Debugging utility for combining parts into a simple string. Not suitable for
268
+ * rendering, but can be useful in tests.
269
+ */
270
+ static combineDisplayParts(parts) {
271
+ let result = "";
272
+ for (const item of parts || []) {
273
+ switch (item.kind) {
274
+ case "text":
275
+ case "code":
276
+ case "relative-link":
277
+ result += item.text;
278
+ break;
279
+ case "inline-tag":
280
+ result += `{${item.tag} ${item.text}}`;
281
+ break;
282
+ default:
283
+ assertNever(item);
284
+ }
285
+ }
286
+ return result;
287
+ }
288
+ /**
289
+ * Helper utility to clone {@link Comment#summary} or {@link CommentTag#content}
290
+ */
291
+ static cloneDisplayParts(parts) {
292
+ return parts.map((p) => ({ ...p }));
293
+ }
294
+ static serializeDisplayParts(parts) {
295
+ return parts?.map((part) => {
296
+ switch (part.kind) {
297
+ case "text":
298
+ case "code":
299
+ return { ...part };
300
+ case "inline-tag": {
301
+ let target;
302
+ if (typeof part.target === "string") {
303
+ target = part.target;
304
+ } else if (part.target) {
305
+ if ("id" in part.target) {
306
+ target = part.target.id;
307
+ } else {
308
+ target = part.target.toObject();
309
+ }
310
+ }
311
+ return {
312
+ ...part,
313
+ target
314
+ };
315
+ }
316
+ case "relative-link": {
317
+ return {
318
+ ...part
319
+ };
320
+ }
321
+ }
322
+ });
323
+ }
324
+ // Since display parts are plain objects, this lives here
325
+ static deserializeDisplayParts(de, parts) {
326
+ const links = [];
327
+ const files = [];
328
+ const result = parts.map((part) => {
329
+ switch (part.kind) {
330
+ case "text":
331
+ case "code":
332
+ return { ...part };
333
+ case "inline-tag": {
334
+ if (typeof part.target === "number") {
335
+ const part2 = {
336
+ kind: part.kind,
337
+ tag: part.tag,
338
+ text: part.text,
339
+ target: void 0,
340
+ tsLinkText: part.tsLinkText
341
+ };
342
+ links.push([part.target, part2]);
343
+ return part2;
344
+ } else if (typeof part.target === "string" || part.target === void 0) {
345
+ return {
346
+ kind: "inline-tag",
347
+ tag: part.tag,
348
+ text: part.text,
349
+ target: part.target,
350
+ tsLinkText: part.tsLinkText
351
+ };
352
+ } else if (typeof part.target === "object") {
353
+ return {
354
+ kind: "inline-tag",
355
+ tag: part.tag,
356
+ text: part.text,
357
+ target: new ReflectionSymbolId(part.target),
358
+ tsLinkText: part.tsLinkText
359
+ };
360
+ } else {
361
+ assertNever(part.target);
362
+ }
363
+ break;
364
+ }
365
+ case "relative-link": {
366
+ if (part.target) {
367
+ const part2 = {
368
+ kind: "relative-link",
369
+ text: part.text,
370
+ target: null,
371
+ targetAnchor: part.targetAnchor
372
+ };
373
+ files.push([part.target, part2]);
374
+ return part2;
375
+ }
376
+ return {
377
+ ...part,
378
+ target: void 0,
379
+ targetAnchor: part.targetAnchor
380
+ };
381
+ }
382
+ }
383
+ });
384
+ if (links.length || files.length) {
385
+ de.defer((project) => {
386
+ for (const [oldFileId, part] of files) {
387
+ part.target = de.oldFileIdToNewFileId[oldFileId];
388
+ }
389
+ for (const [oldId, part] of links) {
390
+ part.target = project.getReflectionById(
391
+ de.oldIdToNewId[oldId] ?? -1
392
+ );
393
+ if (!part.target) {
394
+ de.logger.warn(
395
+ i18n.serialized_project_referenced_0_not_part_of_project(
396
+ oldId.toString()
397
+ )
398
+ );
399
+ }
400
+ }
401
+ });
402
+ }
403
+ return result;
404
+ }
405
+ /**
406
+ * Splits the provided parts into a header (first line, as a string)
407
+ * and body (remaining lines). If the header line contains inline tags
408
+ * they will be serialized to a string.
409
+ */
410
+ static splitPartsToHeaderAndBody(parts) {
411
+ let index = parts.findIndex((part) => {
412
+ switch (part.kind) {
413
+ case "text":
414
+ case "code":
415
+ return part.text.includes("\n");
416
+ case "inline-tag":
417
+ case "relative-link":
418
+ return false;
419
+ }
420
+ });
421
+ if (index === -1) {
422
+ return {
423
+ header: _Comment.combineDisplayParts(parts),
424
+ body: []
425
+ };
426
+ }
427
+ if (parts[index].kind === "code") {
428
+ --index;
429
+ }
430
+ if (index === -1) {
431
+ return { header: "", body: _Comment.cloneDisplayParts(parts) };
432
+ }
433
+ let header = _Comment.combineDisplayParts(parts.slice(0, index));
434
+ const split = parts[index].text.indexOf("\n");
435
+ let body;
436
+ if (split === -1) {
437
+ header += parts[index].text;
438
+ body = _Comment.cloneDisplayParts(parts.slice(index + 1));
439
+ } else {
440
+ header += parts[index].text.substring(0, split);
441
+ body = _Comment.cloneDisplayParts(parts.slice(index));
442
+ body[0].text = body[0].text.substring(split + 1);
443
+ }
444
+ if (!body[0].text) {
445
+ body.shift();
446
+ }
447
+ return { header: header.trim(), body };
448
+ }
449
+ /**
450
+ * Gets either the `@summary` tag, or a short version of the comment summary
451
+ * section for rendering in module/namespace pages.
452
+ */
453
+ getShortSummary(useFirstParagraph) {
454
+ const tag = this.getTag("@summary");
455
+ if (tag) return tag.content;
456
+ if (!useFirstParagraph) return [];
457
+ let partsEnd = this.summary.findIndex((part) => {
458
+ switch (part.kind) {
459
+ case "text":
460
+ return /\r?\n\r?\n/.test(part.text);
461
+ case "code":
462
+ return part.text.includes("\n");
463
+ case "inline-tag":
464
+ case "relative-link":
465
+ return false;
466
+ default:
467
+ assertNever(part);
468
+ }
469
+ });
470
+ const foundEnd = partsEnd !== -1;
471
+ if (partsEnd === -1) {
472
+ partsEnd = this.summary.length - 1;
473
+ }
474
+ const summaryParts = this.summary.slice(0, partsEnd);
475
+ if (partsEnd !== -1) {
476
+ const text = this.summary[partsEnd].text;
477
+ const paragraphEnd = text.match(/\r?\n\r?\n/);
478
+ if (paragraphEnd) {
479
+ summaryParts.push({
480
+ ...this.summary[partsEnd],
481
+ text: text.slice(0, paragraphEnd.index)
482
+ });
483
+ } else if (!foundEnd) {
484
+ summaryParts.push(this.summary[partsEnd]);
485
+ }
486
+ }
487
+ return summaryParts;
488
+ }
489
+ /**
490
+ * Checks if this comment is roughly equal to the other comment.
491
+ * This isn't exactly equal, but just "roughly equal" by the comment
492
+ * text.
493
+ */
494
+ similarTo(other) {
495
+ if (_Comment.combineDisplayParts(this.summary) !== _Comment.combineDisplayParts(other.summary)) {
496
+ return false;
497
+ }
498
+ if (this.blockTags.length !== other.blockTags.length) {
499
+ return false;
500
+ }
501
+ for (let i = 0; i < this.blockTags.length; ++i) {
502
+ if (!this.blockTags[i].similarTo(other.blockTags[i])) {
503
+ return false;
504
+ }
505
+ }
506
+ return true;
507
+ }
508
+ /**
509
+ * Create a deep clone of this comment.
510
+ */
511
+ clone() {
512
+ const comment = new _Comment(
513
+ _Comment.cloneDisplayParts(this.summary),
514
+ this.blockTags.map((tag) => tag.clone()),
515
+ new Set(this.modifierTags)
516
+ );
517
+ comment.discoveryId = this.discoveryId;
518
+ comment.sourcePath = this.sourcePath;
519
+ comment.inheritedFromParentDeclaration = this.inheritedFromParentDeclaration;
520
+ return comment;
521
+ }
522
+ /**
523
+ * Returns true if this comment is completely empty.
524
+ * @internal
525
+ */
526
+ isEmpty() {
527
+ return !this.hasVisibleComponent() && this.modifierTags.size === 0;
528
+ }
529
+ /**
530
+ * Checks if this comment contains any visible text.
531
+ *
532
+ * @returns TRUE when this reflection has a visible comment.
533
+ */
534
+ hasVisibleComponent(notRenderedTags) {
535
+ if (this.summary.some((x) => x.kind !== "text" || x.text !== "")) {
536
+ return true;
537
+ }
538
+ if (notRenderedTags) {
539
+ return this.blockTags.some((tag) => !notRenderedTags.includes(tag.tag));
540
+ } else {
541
+ return this.blockTags.length > 0;
542
+ }
543
+ }
544
+ /**
545
+ * Test whether this comment contains a tag with the given name.
546
+ *
547
+ * @param tagName The name of the tag to look for.
548
+ * @returns TRUE when this comment contains a tag with the given name, otherwise FALSE.
549
+ */
550
+ hasModifier(tagName) {
551
+ return this.modifierTags.has(tagName);
552
+ }
553
+ removeModifier(tagName) {
554
+ this.modifierTags.delete(tagName);
555
+ }
556
+ /**
557
+ * Return the first tag with the given name.
558
+ *
559
+ * @param tagName The name of the tag to look for.
560
+ * @returns The found tag or undefined.
561
+ */
562
+ getTag(tagName) {
563
+ return this.blockTags.find((tag) => tag.tag === tagName);
564
+ }
565
+ /**
566
+ * Get all tags with the given tag name.
567
+ */
568
+ getTags(tagName) {
569
+ return this.blockTags.filter((tag) => tag.tag === tagName);
570
+ }
571
+ getIdentifiedTag(identifier, tagName) {
572
+ return this.blockTags.find(
573
+ (tag) => tag.tag === tagName && tag.name === identifier
574
+ );
575
+ }
576
+ /**
577
+ * Removes all block tags with the given tag name from the comment.
578
+ * @param tagName
579
+ */
580
+ removeTags(tagName) {
581
+ removeIf(this.blockTags, (tag) => tag.tag === tagName);
582
+ }
583
+ toObject(serializer) {
584
+ return {
585
+ summary: _Comment.serializeDisplayParts(this.summary),
586
+ blockTags: serializer.toObjectsOptional(this.blockTags),
587
+ modifierTags: this.modifierTags.size > 0 ? Array.from(this.modifierTags) : void 0,
588
+ label: this.label
589
+ };
590
+ }
591
+ fromObject(de, obj) {
592
+ this.summary = _Comment.deserializeDisplayParts(de, obj.summary);
593
+ this.blockTags = obj.blockTags?.map((tagObj) => {
594
+ const tag = new CommentTag(tagObj.tag, []);
595
+ de.fromObject(tag, tagObj);
596
+ return tag;
597
+ }) || [];
598
+ this.modifierTags = new Set(obj.modifierTags);
599
+ this.label = obj.label;
600
+ }
601
+ };
602
+ _init = __decoratorStart(null);
603
+ __decorateElement(_init, 5, "sourcePath", _sourcePath_dec, _Comment);
604
+ __decorateElement(_init, 5, "discoveryId", _discoveryId_dec, _Comment);
605
+ __decorateElement(_init, 5, "inheritedFromParentDeclaration", _inheritedFromParentDeclaration_dec, _Comment);
606
+ __decoratorMetadata(_init, _Comment);
607
+ var Comment = _Comment;
608
+ function extractLabelTag(comment) {
609
+ const index = comment.summary.findIndex(
610
+ (part) => part.kind === "inline-tag" && part.tag === "@label"
611
+ );
612
+ if (index !== -1) {
613
+ comment.label = comment.summary.splice(index, 1)[0].text;
614
+ }
615
+ }
616
+
617
+ // src/lib/models/Reflection.ts
618
+ import { i18n as i18n3, NonEnumerable as NonEnumerable2 } from "#utils";
619
+
620
+ // src/lib/models/kind.ts
621
+ import { i18n as i18n2 } from "#utils";
622
+ var ReflectionKind = /* @__PURE__ */ ((ReflectionKind2) => {
623
+ ReflectionKind2[ReflectionKind2["Project"] = 1] = "Project";
624
+ ReflectionKind2[ReflectionKind2["Module"] = 2] = "Module";
625
+ ReflectionKind2[ReflectionKind2["Namespace"] = 4] = "Namespace";
626
+ ReflectionKind2[ReflectionKind2["Enum"] = 8] = "Enum";
627
+ ReflectionKind2[ReflectionKind2["EnumMember"] = 16] = "EnumMember";
628
+ ReflectionKind2[ReflectionKind2["Variable"] = 32] = "Variable";
629
+ ReflectionKind2[ReflectionKind2["Function"] = 64] = "Function";
630
+ ReflectionKind2[ReflectionKind2["Class"] = 128] = "Class";
631
+ ReflectionKind2[ReflectionKind2["Interface"] = 256] = "Interface";
632
+ ReflectionKind2[ReflectionKind2["Constructor"] = 512] = "Constructor";
633
+ ReflectionKind2[ReflectionKind2["Property"] = 1024] = "Property";
634
+ ReflectionKind2[ReflectionKind2["Method"] = 2048] = "Method";
635
+ ReflectionKind2[ReflectionKind2["CallSignature"] = 4096] = "CallSignature";
636
+ ReflectionKind2[ReflectionKind2["IndexSignature"] = 8192] = "IndexSignature";
637
+ ReflectionKind2[ReflectionKind2["ConstructorSignature"] = 16384] = "ConstructorSignature";
638
+ ReflectionKind2[ReflectionKind2["Parameter"] = 32768] = "Parameter";
639
+ ReflectionKind2[ReflectionKind2["TypeLiteral"] = 65536] = "TypeLiteral";
640
+ ReflectionKind2[ReflectionKind2["TypeParameter"] = 131072] = "TypeParameter";
641
+ ReflectionKind2[ReflectionKind2["Accessor"] = 262144] = "Accessor";
642
+ ReflectionKind2[ReflectionKind2["GetSignature"] = 524288] = "GetSignature";
643
+ ReflectionKind2[ReflectionKind2["SetSignature"] = 1048576] = "SetSignature";
644
+ ReflectionKind2[ReflectionKind2["TypeAlias"] = 2097152] = "TypeAlias";
645
+ ReflectionKind2[ReflectionKind2["Reference"] = 4194304] = "Reference";
646
+ ReflectionKind2[ReflectionKind2["Document"] = 8388608] = "Document";
647
+ return ReflectionKind2;
648
+ })(ReflectionKind || {});
649
+ ((ReflectionKind2) => {
650
+ ReflectionKind2.All = 4194304 /* Reference */ * 2 - 1;
651
+ ReflectionKind2.ClassOrInterface = 128 /* Class */ | 256 /* Interface */;
652
+ ReflectionKind2.VariableOrProperty = 32 /* Variable */ | 1024 /* Property */;
653
+ ReflectionKind2.FunctionOrMethod = 64 /* Function */ | 2048 /* Method */;
654
+ ReflectionKind2.ClassMember = 262144 /* Accessor */ | 512 /* Constructor */ | 2048 /* Method */ | 1024 /* Property */;
655
+ ReflectionKind2.SomeSignature = 4096 /* CallSignature */ | 8192 /* IndexSignature */ | 16384 /* ConstructorSignature */ | 524288 /* GetSignature */ | 1048576 /* SetSignature */;
656
+ ReflectionKind2.SomeModule = 4 /* Namespace */ | 2 /* Module */;
657
+ ReflectionKind2.SomeType = 256 /* Interface */ | 65536 /* TypeLiteral */ | 131072 /* TypeParameter */ | 2097152 /* TypeAlias */;
658
+ ReflectionKind2.SomeValue = 32 /* Variable */ | 64 /* Function */;
659
+ ReflectionKind2.SomeMember = 16 /* EnumMember */ | 1024 /* Property */ | 2048 /* Method */ | 262144 /* Accessor */;
660
+ ReflectionKind2.SomeExport = 2 /* Module */ | 4 /* Namespace */ | 8 /* Enum */ | 32 /* Variable */ | 64 /* Function */ | 128 /* Class */ | 256 /* Interface */ | 2097152 /* TypeAlias */ | 4194304 /* Reference */;
661
+ ReflectionKind2.MayContainDocuments = ReflectionKind2.SomeExport | 1 /* Project */ | 8388608 /* Document */;
662
+ ReflectionKind2.ExportContainer = ReflectionKind2.SomeModule | 1 /* Project */;
663
+ ReflectionKind2.Inheritable = 262144 /* Accessor */ | 8192 /* IndexSignature */ | 1024 /* Property */ | 2048 /* Method */ | 512 /* Constructor */;
664
+ ReflectionKind2.ContainsCallSignatures = 512 /* Constructor */ | 64 /* Function */ | 2048 /* Method */;
665
+ ReflectionKind2.TypeReferenceTarget = 256 /* Interface */ | 2097152 /* TypeAlias */ | 128 /* Class */ | 8 /* Enum */;
666
+ ReflectionKind2.ValueReferenceTarget = 2 /* Module */ | 4 /* Namespace */ | 32 /* Variable */ | 64 /* Function */;
667
+ ReflectionKind2.SignatureContainer = ReflectionKind2.ContainsCallSignatures | 262144 /* Accessor */;
668
+ ReflectionKind2.VariableContainer = ReflectionKind2.SomeModule | 1 /* Project */;
669
+ ReflectionKind2.MethodContainer = ReflectionKind2.ClassOrInterface | ReflectionKind2.VariableOrProperty | ReflectionKind2.FunctionOrMethod | 65536 /* TypeLiteral */;
670
+ function singularString(kind) {
671
+ switch (kind) {
672
+ case 1 /* Project */:
673
+ return i18n2.kind_project();
674
+ case 2 /* Module */:
675
+ return i18n2.kind_module();
676
+ case 4 /* Namespace */:
677
+ return i18n2.kind_namespace();
678
+ case 8 /* Enum */:
679
+ return i18n2.kind_enum();
680
+ case 16 /* EnumMember */:
681
+ return i18n2.kind_enum_member();
682
+ case 32 /* Variable */:
683
+ return i18n2.kind_variable();
684
+ case 64 /* Function */:
685
+ return i18n2.kind_function();
686
+ case 128 /* Class */:
687
+ return i18n2.kind_class();
688
+ case 256 /* Interface */:
689
+ return i18n2.kind_interface();
690
+ case 512 /* Constructor */:
691
+ return i18n2.kind_constructor();
692
+ case 1024 /* Property */:
693
+ return i18n2.kind_property();
694
+ case 2048 /* Method */:
695
+ return i18n2.kind_method();
696
+ case 4096 /* CallSignature */:
697
+ return i18n2.kind_call_signature();
698
+ case 8192 /* IndexSignature */:
699
+ return i18n2.kind_index_signature();
700
+ case 16384 /* ConstructorSignature */:
701
+ return i18n2.kind_constructor_signature();
702
+ case 32768 /* Parameter */:
703
+ return i18n2.kind_parameter();
704
+ case 65536 /* TypeLiteral */:
705
+ return i18n2.kind_type_literal();
706
+ case 131072 /* TypeParameter */:
707
+ return i18n2.kind_type_parameter();
708
+ case 262144 /* Accessor */:
709
+ return i18n2.kind_accessor();
710
+ case 524288 /* GetSignature */:
711
+ return i18n2.kind_get_signature();
712
+ case 1048576 /* SetSignature */:
713
+ return i18n2.kind_set_signature();
714
+ case 2097152 /* TypeAlias */:
715
+ return i18n2.kind_type_alias();
716
+ case 4194304 /* Reference */:
717
+ return i18n2.kind_reference();
718
+ case 8388608 /* Document */:
719
+ return i18n2.kind_document();
720
+ }
721
+ }
722
+ ReflectionKind2.singularString = singularString;
723
+ function pluralString(kind) {
724
+ switch (kind) {
725
+ case 1 /* Project */:
726
+ return i18n2.kind_plural_project();
727
+ case 2 /* Module */:
728
+ return i18n2.kind_plural_module();
729
+ case 4 /* Namespace */:
730
+ return i18n2.kind_plural_namespace();
731
+ case 8 /* Enum */:
732
+ return i18n2.kind_plural_enum();
733
+ case 16 /* EnumMember */:
734
+ return i18n2.kind_plural_enum_member();
735
+ case 32 /* Variable */:
736
+ return i18n2.kind_plural_variable();
737
+ case 64 /* Function */:
738
+ return i18n2.kind_plural_function();
739
+ case 128 /* Class */:
740
+ return i18n2.kind_plural_class();
741
+ case 256 /* Interface */:
742
+ return i18n2.kind_plural_interface();
743
+ case 512 /* Constructor */:
744
+ return i18n2.kind_plural_constructor();
745
+ case 1024 /* Property */:
746
+ return i18n2.kind_plural_property();
747
+ case 2048 /* Method */:
748
+ return i18n2.kind_plural_method();
749
+ case 4096 /* CallSignature */:
750
+ return i18n2.kind_plural_call_signature();
751
+ case 8192 /* IndexSignature */:
752
+ return i18n2.kind_plural_index_signature();
753
+ case 16384 /* ConstructorSignature */:
754
+ return i18n2.kind_plural_constructor_signature();
755
+ case 32768 /* Parameter */:
756
+ return i18n2.kind_plural_parameter();
757
+ case 65536 /* TypeLiteral */:
758
+ return i18n2.kind_plural_type_literal();
759
+ case 131072 /* TypeParameter */:
760
+ return i18n2.kind_plural_type_parameter();
761
+ case 262144 /* Accessor */:
762
+ return i18n2.kind_plural_accessor();
763
+ case 524288 /* GetSignature */:
764
+ return i18n2.kind_plural_get_signature();
765
+ case 1048576 /* SetSignature */:
766
+ return i18n2.kind_plural_set_signature();
767
+ case 2097152 /* TypeAlias */:
768
+ return i18n2.kind_plural_type_alias();
769
+ case 4194304 /* Reference */:
770
+ return i18n2.kind_plural_reference();
771
+ case 8388608 /* Document */:
772
+ return i18n2.kind_plural_document();
773
+ }
774
+ }
775
+ ReflectionKind2.pluralString = pluralString;
776
+ function classString(kind) {
777
+ return `tsd-kind-${ReflectionKind2[kind].replace(/(.)([A-Z])/g, (_m, a, b) => `${a}-${b}`).toLowerCase()}`;
778
+ }
779
+ ReflectionKind2.classString = classString;
780
+ })(ReflectionKind || (ReflectionKind = {}));
781
+
782
+ // src/lib/models/Reflection.ts
783
+ var REFLECTION_ID = 0;
784
+ function resetReflectionID() {
785
+ REFLECTION_ID = 0;
786
+ }
787
+ var ReflectionFlag = /* @__PURE__ */ ((ReflectionFlag2) => {
788
+ ReflectionFlag2[ReflectionFlag2["None"] = 0] = "None";
789
+ ReflectionFlag2[ReflectionFlag2["Private"] = 1] = "Private";
790
+ ReflectionFlag2[ReflectionFlag2["Protected"] = 2] = "Protected";
791
+ ReflectionFlag2[ReflectionFlag2["Public"] = 4] = "Public";
792
+ ReflectionFlag2[ReflectionFlag2["Static"] = 8] = "Static";
793
+ ReflectionFlag2[ReflectionFlag2["External"] = 16] = "External";
794
+ ReflectionFlag2[ReflectionFlag2["Optional"] = 32] = "Optional";
795
+ ReflectionFlag2[ReflectionFlag2["Rest"] = 64] = "Rest";
796
+ ReflectionFlag2[ReflectionFlag2["Abstract"] = 128] = "Abstract";
797
+ ReflectionFlag2[ReflectionFlag2["Const"] = 256] = "Const";
798
+ ReflectionFlag2[ReflectionFlag2["Readonly"] = 512] = "Readonly";
799
+ ReflectionFlag2[ReflectionFlag2["Inherited"] = 1024] = "Inherited";
800
+ return ReflectionFlag2;
801
+ })(ReflectionFlag || {});
802
+ var relevantFlags = [
803
+ 1 /* Private */,
804
+ 2 /* Protected */,
805
+ 8 /* Static */,
806
+ 32 /* Optional */,
807
+ 128 /* Abstract */,
808
+ 256 /* Const */,
809
+ 512 /* Readonly */
810
+ ];
811
+ var ReflectionFlags = class _ReflectionFlags {
812
+ flags = 0 /* None */;
813
+ hasFlag(flag) {
814
+ return (flag & this.flags) !== 0;
815
+ }
816
+ /**
817
+ * Is this a private member?
818
+ */
819
+ get isPrivate() {
820
+ return this.hasFlag(1 /* Private */);
821
+ }
822
+ /**
823
+ * Is this a protected member?
824
+ */
825
+ get isProtected() {
826
+ return this.hasFlag(2 /* Protected */);
827
+ }
828
+ /**
829
+ * Is this a public member?
830
+ */
831
+ get isPublic() {
832
+ return this.hasFlag(4 /* Public */);
833
+ }
834
+ /**
835
+ * Is this a static member?
836
+ */
837
+ get isStatic() {
838
+ return this.hasFlag(8 /* Static */);
839
+ }
840
+ /**
841
+ * Is this a declaration from an external document?
842
+ */
843
+ get isExternal() {
844
+ return this.hasFlag(16 /* External */);
845
+ }
846
+ /**
847
+ * Whether this reflection is an optional component or not.
848
+ *
849
+ * Applies to function parameters and object members.
850
+ */
851
+ get isOptional() {
852
+ return this.hasFlag(32 /* Optional */);
853
+ }
854
+ /**
855
+ * Whether it's a rest parameter, like `foo(...params);`.
856
+ */
857
+ get isRest() {
858
+ return this.hasFlag(64 /* Rest */);
859
+ }
860
+ get isAbstract() {
861
+ return this.hasFlag(128 /* Abstract */);
862
+ }
863
+ get isConst() {
864
+ return this.hasFlag(256 /* Const */);
865
+ }
866
+ get isReadonly() {
867
+ return this.hasFlag(512 /* Readonly */);
868
+ }
869
+ get isInherited() {
870
+ return this.hasFlag(1024 /* Inherited */);
871
+ }
872
+ setFlag(flag, set) {
873
+ switch (flag) {
874
+ case 1 /* Private */:
875
+ this.setSingleFlag(1 /* Private */, set);
876
+ if (set) {
877
+ this.setFlag(2 /* Protected */, false);
878
+ this.setFlag(4 /* Public */, false);
879
+ }
880
+ break;
881
+ case 2 /* Protected */:
882
+ this.setSingleFlag(2 /* Protected */, set);
883
+ if (set) {
884
+ this.setFlag(1 /* Private */, false);
885
+ this.setFlag(4 /* Public */, false);
886
+ }
887
+ break;
888
+ case 4 /* Public */:
889
+ this.setSingleFlag(4 /* Public */, set);
890
+ if (set) {
891
+ this.setFlag(1 /* Private */, false);
892
+ this.setFlag(2 /* Protected */, false);
893
+ }
894
+ break;
895
+ default:
896
+ this.setSingleFlag(flag, set);
897
+ }
898
+ }
899
+ static flagString(flag) {
900
+ switch (flag) {
901
+ case 0 /* None */:
902
+ throw new Error("Should be unreachable");
903
+ case 1 /* Private */:
904
+ return i18n3.flag_private();
905
+ case 2 /* Protected */:
906
+ return i18n3.flag_protected();
907
+ case 4 /* Public */:
908
+ return i18n3.flag_public();
909
+ case 8 /* Static */:
910
+ return i18n3.flag_static();
911
+ case 16 /* External */:
912
+ return i18n3.flag_external();
913
+ case 32 /* Optional */:
914
+ return i18n3.flag_optional();
915
+ case 64 /* Rest */:
916
+ return i18n3.flag_rest();
917
+ case 128 /* Abstract */:
918
+ return i18n3.flag_abstract();
919
+ case 256 /* Const */:
920
+ return i18n3.flag_const();
921
+ case 512 /* Readonly */:
922
+ return i18n3.flag_readonly();
923
+ case 1024 /* Inherited */:
924
+ return i18n3.flag_inherited();
925
+ }
926
+ }
927
+ getFlagStrings() {
928
+ const strings = [];
929
+ for (const flag of relevantFlags) {
930
+ if (this.hasFlag(flag)) {
931
+ strings.push(_ReflectionFlags.flagString(flag));
932
+ }
933
+ }
934
+ return strings;
935
+ }
936
+ setSingleFlag(flag, set) {
937
+ if (!set && this.hasFlag(flag)) {
938
+ this.flags ^= flag;
939
+ } else if (set && !this.hasFlag(flag)) {
940
+ this.flags |= flag;
941
+ }
942
+ }
943
+ static serializedFlags = [
944
+ "isPrivate",
945
+ "isProtected",
946
+ "isPublic",
947
+ "isStatic",
948
+ "isExternal",
949
+ "isOptional",
950
+ "isRest",
951
+ "isAbstract",
952
+ "isConst",
953
+ "isReadonly",
954
+ "isInherited"
955
+ ];
956
+ toObject() {
957
+ return Object.fromEntries(
958
+ _ReflectionFlags.serializedFlags.filter((flag) => this[flag]).map((flag) => [flag, true])
959
+ );
960
+ }
961
+ fromObject(obj) {
962
+ for (const key of Object.keys(obj)) {
963
+ const flagName = key.substring(2);
964
+ if (flagName in ReflectionFlag) {
965
+ this.setFlag(
966
+ ReflectionFlag[flagName],
967
+ true
968
+ );
969
+ }
970
+ }
971
+ }
972
+ };
973
+ var TraverseProperty = /* @__PURE__ */ ((TraverseProperty2) => {
974
+ TraverseProperty2[TraverseProperty2["Children"] = 0] = "Children";
975
+ TraverseProperty2[TraverseProperty2["Documents"] = 1] = "Documents";
976
+ TraverseProperty2[TraverseProperty2["Parameters"] = 2] = "Parameters";
977
+ TraverseProperty2[TraverseProperty2["TypeLiteral"] = 3] = "TypeLiteral";
978
+ TraverseProperty2[TraverseProperty2["TypeParameter"] = 4] = "TypeParameter";
979
+ TraverseProperty2[TraverseProperty2["Signatures"] = 5] = "Signatures";
980
+ TraverseProperty2[TraverseProperty2["IndexSignature"] = 6] = "IndexSignature";
981
+ TraverseProperty2[TraverseProperty2["GetSignature"] = 7] = "GetSignature";
982
+ TraverseProperty2[TraverseProperty2["SetSignature"] = 8] = "SetSignature";
983
+ return TraverseProperty2;
984
+ })(TraverseProperty || {});
985
+ var _project_dec, _parent_dec, _init2;
986
+ _parent_dec = [NonEnumerable2], _project_dec = [NonEnumerable2];
987
+ var Reflection = class {
988
+ constructor(name, kind, parent) {
989
+ /**
990
+ * Unique id of this reflection.
991
+ */
992
+ __publicField(this, "id");
993
+ /**
994
+ * The symbol name of this reflection.
995
+ */
996
+ __publicField(this, "name");
997
+ /**
998
+ * The kind of this reflection.
999
+ */
1000
+ __publicField(this, "kind");
1001
+ __publicField(this, "flags", new ReflectionFlags());
1002
+ // So that it doesn't show up in console.log
1003
+ __publicField(this, "parent", __runInitializers(_init2, 8, this)), __runInitializers(_init2, 11, this);
1004
+ __publicField(this, "project", __runInitializers(_init2, 12, this)), __runInitializers(_init2, 15, this);
1005
+ /**
1006
+ * The parsed documentation comment attached to this reflection.
1007
+ */
1008
+ __publicField(this, "comment");
1009
+ this.id = REFLECTION_ID++;
1010
+ this.parent = parent;
1011
+ this.project = parent?.project || this;
1012
+ this.name = name;
1013
+ this.kind = kind;
1014
+ if (parent?.flags.isExternal) {
1015
+ this.setFlag(16 /* External */);
1016
+ }
1017
+ }
1018
+ /**
1019
+ * Test whether this reflection is of the given kind.
1020
+ */
1021
+ kindOf(kind) {
1022
+ const kindFlags = Array.isArray(kind) ? kind.reduce((a, b) => a | b, 0) : kind;
1023
+ return (this.kind & kindFlags) !== 0;
1024
+ }
1025
+ /**
1026
+ * Return the full name of this reflection. Intended for use in debugging. For log messages
1027
+ * intended to be displayed to the user for them to fix, prefer {@link getFriendlyFullName} instead.
1028
+ *
1029
+ * The full name contains the name of this reflection and the names of all parent reflections.
1030
+ *
1031
+ * @param separator Separator used to join the names of the reflections.
1032
+ * @returns The full name of this reflection.
1033
+ */
1034
+ getFullName(separator = ".") {
1035
+ if (this.parent && !this.parent.isProject()) {
1036
+ return this.parent.getFullName(separator) + separator + this.name;
1037
+ } else {
1038
+ return this.name;
1039
+ }
1040
+ }
1041
+ /**
1042
+ * Return the full name of this reflection, with signature names dropped if possible without
1043
+ * introducing ambiguity in the name.
1044
+ */
1045
+ getFriendlyFullName() {
1046
+ if (this.parent && !this.parent.isProject()) {
1047
+ if (this.kindOf(
1048
+ 16384 /* ConstructorSignature */ | 4096 /* CallSignature */ | 524288 /* GetSignature */ | 1048576 /* SetSignature */
1049
+ )) {
1050
+ return this.parent.getFriendlyFullName();
1051
+ }
1052
+ return this.parent.getFriendlyFullName() + "." + this.name;
1053
+ } else {
1054
+ return this.name;
1055
+ }
1056
+ }
1057
+ /**
1058
+ * Set a flag on this reflection.
1059
+ */
1060
+ setFlag(flag, value = true) {
1061
+ this.flags.setFlag(flag, value);
1062
+ }
1063
+ /**
1064
+ * Checks if this reflection has a comment which contains any visible text.
1065
+ *
1066
+ * @returns TRUE when this reflection has a visible comment.
1067
+ */
1068
+ hasComment(notRenderedTags) {
1069
+ return this.comment ? this.comment.hasVisibleComponent(notRenderedTags) : false;
1070
+ }
1071
+ hasGetterOrSetter() {
1072
+ return false;
1073
+ }
1074
+ /**
1075
+ * Return a child by its name.
1076
+ *
1077
+ * @param arg The name hierarchy of the child to look for.
1078
+ * @returns The found child or undefined.
1079
+ */
1080
+ getChildByName(arg) {
1081
+ const names = Array.isArray(arg) ? arg : splitUnquotedString(arg, ".");
1082
+ const name = names[0];
1083
+ let result;
1084
+ this.traverse((child) => {
1085
+ if (child.name === name) {
1086
+ if (names.length <= 1) {
1087
+ result = child;
1088
+ } else {
1089
+ result = child.getChildByName(names.slice(1));
1090
+ }
1091
+ return false;
1092
+ }
1093
+ return true;
1094
+ });
1095
+ return result;
1096
+ }
1097
+ /**
1098
+ * Return whether this reflection is the root / project reflection.
1099
+ */
1100
+ isProject() {
1101
+ return false;
1102
+ }
1103
+ isDeclaration() {
1104
+ return false;
1105
+ }
1106
+ isSignature() {
1107
+ return false;
1108
+ }
1109
+ isTypeParameter() {
1110
+ return false;
1111
+ }
1112
+ isParameter() {
1113
+ return false;
1114
+ }
1115
+ isDocument() {
1116
+ return false;
1117
+ }
1118
+ isReference() {
1119
+ return this.variant === "reference";
1120
+ }
1121
+ isContainer() {
1122
+ return false;
1123
+ }
1124
+ /**
1125
+ * Check if this reflection or any of its parents have been marked with the `@deprecated` tag.
1126
+ */
1127
+ isDeprecated() {
1128
+ let signaturesDeprecated = false;
1129
+ this.visit({
1130
+ declaration(decl) {
1131
+ if (decl.signatures?.length && decl.signatures.every((sig) => sig.comment?.getTag("@deprecated"))) {
1132
+ signaturesDeprecated = true;
1133
+ }
1134
+ }
1135
+ });
1136
+ if (signaturesDeprecated || this.comment?.getTag("@deprecated")) {
1137
+ return true;
1138
+ }
1139
+ return this.parent?.isDeprecated() ?? false;
1140
+ }
1141
+ visit(visitor) {
1142
+ visitor[this.variant]?.(this);
1143
+ }
1144
+ /**
1145
+ * Return a string representation of this reflection.
1146
+ */
1147
+ toString() {
1148
+ return ReflectionKind[this.kind] + " " + this.name;
1149
+ }
1150
+ /**
1151
+ * Return a string representation of this reflection and all of its children.
1152
+ *
1153
+ * Note: This is intended as a debug tool only, output may change between patch versions.
1154
+ *
1155
+ * @param indent Used internally to indent child reflections.
1156
+ */
1157
+ toStringHierarchy(indent = "") {
1158
+ const lines = [indent + this.toString()];
1159
+ indent += " ";
1160
+ this.traverse((child) => {
1161
+ lines.push(child.toStringHierarchy(indent));
1162
+ return true;
1163
+ });
1164
+ return lines.join("\n");
1165
+ }
1166
+ toObject(serializer) {
1167
+ return {
1168
+ id: this.id,
1169
+ name: this.name,
1170
+ variant: this.variant,
1171
+ kind: this.kind,
1172
+ flags: this.flags.toObject(),
1173
+ comment: this.comment && !this.comment.isEmpty() ? serializer.toObject(this.comment) : void 0
1174
+ };
1175
+ }
1176
+ fromObject(de, obj) {
1177
+ this.name = obj.name;
1178
+ this.kind = obj.kind;
1179
+ this.flags.fromObject(obj.flags);
1180
+ this.comment = de.revive(obj.comment, () => new Comment());
1181
+ }
1182
+ };
1183
+ _init2 = __decoratorStart(null);
1184
+ __decorateElement(_init2, 5, "parent", _parent_dec, Reflection);
1185
+ __decorateElement(_init2, 5, "project", _project_dec, Reflection);
1186
+ __decoratorMetadata(_init2, Reflection);
1187
+
1188
+ // src/lib/models/ReflectionCategory.ts
1189
+ var ReflectionCategory = class {
1190
+ /**
1191
+ * The title, a string representation of this category.
1192
+ */
1193
+ title;
1194
+ /**
1195
+ * The user specified description, if any, set with `@categoryDescription`
1196
+ */
1197
+ description;
1198
+ /**
1199
+ * All reflections of this category.
1200
+ */
1201
+ children = [];
1202
+ /**
1203
+ * Create a new ReflectionCategory instance.
1204
+ *
1205
+ * @param title The title of this category.
1206
+ */
1207
+ constructor(title) {
1208
+ this.title = title;
1209
+ }
1210
+ toObject() {
1211
+ return {
1212
+ title: this.title,
1213
+ description: this.description ? Comment.serializeDisplayParts(this.description) : void 0,
1214
+ children: this.children.length > 0 ? this.children.map((child) => child.id) : void 0
1215
+ };
1216
+ }
1217
+ fromObject(de, obj) {
1218
+ if (obj.description) {
1219
+ this.description = Comment.deserializeDisplayParts(
1220
+ de,
1221
+ obj.description
1222
+ );
1223
+ }
1224
+ if (obj.children) {
1225
+ de.defer((project) => {
1226
+ for (const childId of obj.children || []) {
1227
+ const child = project.getReflectionById(
1228
+ de.oldIdToNewId[childId] ?? -1
1229
+ );
1230
+ if (child?.isDeclaration() || child?.isDocument()) {
1231
+ this.children.push(child);
1232
+ }
1233
+ }
1234
+ });
1235
+ }
1236
+ }
1237
+ };
1238
+
1239
+ // src/lib/models/ReflectionGroup.ts
1240
+ var ReflectionGroup = class {
1241
+ /**
1242
+ * Create a new ReflectionGroup instance.
1243
+ *
1244
+ * @param title The title of this group.
1245
+ * @param owningReflection The reflection containing this group, useful for changing rendering based on a comment on a reflection.
1246
+ */
1247
+ constructor(title, owningReflection) {
1248
+ this.owningReflection = owningReflection;
1249
+ this.title = title;
1250
+ }
1251
+ owningReflection;
1252
+ /**
1253
+ * The title, a string representation of the typescript kind, of this group.
1254
+ */
1255
+ title;
1256
+ /**
1257
+ * User specified description via `@groupDescription`, if specified.
1258
+ */
1259
+ description;
1260
+ /**
1261
+ * All reflections of this group.
1262
+ */
1263
+ children = [];
1264
+ /**
1265
+ * Categories contained within this group.
1266
+ */
1267
+ categories;
1268
+ toObject(serializer) {
1269
+ return {
1270
+ title: this.title,
1271
+ description: this.description ? Comment.serializeDisplayParts(this.description) : void 0,
1272
+ children: this.children.length > 0 ? this.children.map((child) => child.id) : void 0,
1273
+ categories: serializer.toObjectsOptional(this.categories)
1274
+ };
1275
+ }
1276
+ fromObject(de, obj) {
1277
+ if (obj.description) {
1278
+ this.description = Comment.deserializeDisplayParts(
1279
+ de,
1280
+ obj.description
1281
+ );
1282
+ }
1283
+ if (obj.categories) {
1284
+ this.categories = obj.categories.map((catObj) => {
1285
+ const cat = new ReflectionCategory(catObj.title);
1286
+ de.fromObject(cat, catObj);
1287
+ return cat;
1288
+ });
1289
+ }
1290
+ if (obj.children) {
1291
+ de.defer((project) => {
1292
+ for (const childId of obj.children || []) {
1293
+ const child = project.getReflectionById(
1294
+ de.oldIdToNewId[childId] ?? -1
1295
+ );
1296
+ if (child?.isDeclaration() || child?.isDocument()) {
1297
+ this.children.push(child);
1298
+ }
1299
+ }
1300
+ });
1301
+ }
1302
+ }
1303
+ };
1304
+
1305
+ // src/lib/models/ContainerReflection.ts
1306
+ import { assertNever as assertNever2, removeIfPresent } from "#utils";
1307
+ var ContainerReflection = class extends Reflection {
1308
+ /**
1309
+ * The children of this reflection. Do not add reflections to this array
1310
+ * manually. Instead call {@link addChild}.
1311
+ */
1312
+ children;
1313
+ /**
1314
+ * Documents associated with this reflection.
1315
+ *
1316
+ * These are not children as including them as children requires code handle both
1317
+ * types, despite being mostly unrelated and handled separately.
1318
+ *
1319
+ * Including them here in a separate array neatly handles that problem, but also
1320
+ * introduces another one for rendering. When rendering, documents should really
1321
+ * actually be considered part of the "children" of a reflection. For this reason,
1322
+ * we also maintain a list of child declarations with child documents which is used
1323
+ * when rendering.
1324
+ */
1325
+ documents;
1326
+ /**
1327
+ * Union of the {@link children} and {@link documents} arrays which dictates the
1328
+ * sort order for rendering.
1329
+ */
1330
+ childrenIncludingDocuments;
1331
+ /**
1332
+ * All children grouped by their kind.
1333
+ */
1334
+ groups;
1335
+ /**
1336
+ * All children grouped by their category.
1337
+ */
1338
+ categories;
1339
+ /**
1340
+ * Return a list of all children of a certain kind.
1341
+ *
1342
+ * @param kind The desired kind of children.
1343
+ * @returns An array containing all children with the desired kind.
1344
+ */
1345
+ getChildrenByKind(kind) {
1346
+ return (this.children || []).filter((child) => child.kindOf(kind));
1347
+ }
1348
+ addChild(child) {
1349
+ if (child.isDeclaration()) {
1350
+ this.children ||= [];
1351
+ this.children.push(child);
1352
+ this.childrenIncludingDocuments ||= [];
1353
+ this.childrenIncludingDocuments.push(child);
1354
+ } else if (child.isDocument()) {
1355
+ this.documents ||= [];
1356
+ this.documents.push(child);
1357
+ this.childrenIncludingDocuments ||= [];
1358
+ this.childrenIncludingDocuments.push(child);
1359
+ } else if (this.isDeclaration() && child.isSignature()) {
1360
+ switch (child.kind) {
1361
+ case 4096 /* CallSignature */:
1362
+ case 16384 /* ConstructorSignature */:
1363
+ this.signatures ||= [];
1364
+ this.signatures.push(child);
1365
+ break;
1366
+ case 8192 /* IndexSignature */:
1367
+ this.indexSignatures ||= [];
1368
+ this.indexSignatures.push(child);
1369
+ break;
1370
+ case 524288 /* GetSignature */:
1371
+ case 1048576 /* SetSignature */:
1372
+ throw new Error("Unsupported child type: " + ReflectionKind[child.kind]);
1373
+ default:
1374
+ assertNever2(child.kind);
1375
+ }
1376
+ } else {
1377
+ throw new Error("Unsupported child type: " + ReflectionKind[child.kind]);
1378
+ }
1379
+ }
1380
+ removeChild(child) {
1381
+ if (child.isDeclaration()) {
1382
+ removeIfPresent(this.children, child);
1383
+ if (this.children?.length === 0) {
1384
+ delete this.children;
1385
+ }
1386
+ } else {
1387
+ removeIfPresent(this.documents, child);
1388
+ if (this.documents?.length === 0) {
1389
+ delete this.documents;
1390
+ }
1391
+ }
1392
+ removeIfPresent(this.childrenIncludingDocuments, child);
1393
+ if (this.childrenIncludingDocuments?.length === 0) {
1394
+ delete this.childrenIncludingDocuments;
1395
+ }
1396
+ }
1397
+ isContainer() {
1398
+ return true;
1399
+ }
1400
+ traverse(callback) {
1401
+ for (const child of this.children?.slice() || []) {
1402
+ if (callback(child, 0 /* Children */) === false) {
1403
+ return;
1404
+ }
1405
+ }
1406
+ for (const child of this.documents?.slice() || []) {
1407
+ if (callback(child, 1 /* Documents */) === false) {
1408
+ return;
1409
+ }
1410
+ }
1411
+ }
1412
+ toObject(serializer) {
1413
+ return {
1414
+ ...super.toObject(serializer),
1415
+ children: serializer.toObjectsOptional(this.children),
1416
+ documents: serializer.toObjectsOptional(this.documents),
1417
+ // If we only have one type of child, don't bother writing the duplicate info about
1418
+ // ordering with documents to the serialized file.
1419
+ childrenIncludingDocuments: this.children?.length && this.documents?.length ? this.childrenIncludingDocuments?.map((refl) => refl.id) : void 0,
1420
+ groups: serializer.toObjectsOptional(this.groups),
1421
+ categories: serializer.toObjectsOptional(this.categories)
1422
+ };
1423
+ }
1424
+ fromObject(de, obj) {
1425
+ super.fromObject(de, obj);
1426
+ this.children = de.reviveMany(obj.children, (child) => de.constructReflection(child));
1427
+ this.documents = de.reviveMany(obj.documents, (child) => de.constructReflection(child));
1428
+ const byId = /* @__PURE__ */ new Map();
1429
+ for (const child of this.children || []) {
1430
+ byId.set(child.id, child);
1431
+ }
1432
+ for (const child of this.documents || []) {
1433
+ byId.set(child.id, child);
1434
+ }
1435
+ for (const id of obj.childrenIncludingDocuments || []) {
1436
+ const child = byId.get(de.oldIdToNewId[id] ?? -1);
1437
+ if (child) {
1438
+ this.childrenIncludingDocuments ||= [];
1439
+ this.childrenIncludingDocuments.push(child);
1440
+ byId.delete(de.oldIdToNewId[id] ?? -1);
1441
+ }
1442
+ }
1443
+ if (byId.size) {
1444
+ this.childrenIncludingDocuments ||= [];
1445
+ this.childrenIncludingDocuments.push(...byId.values());
1446
+ }
1447
+ this.groups = de.reviveMany(
1448
+ obj.groups,
1449
+ (group) => new ReflectionGroup(group.title, this)
1450
+ );
1451
+ this.categories = de.reviveMany(
1452
+ obj.categories,
1453
+ (cat) => new ReflectionCategory(cat.title)
1454
+ );
1455
+ }
1456
+ };
1457
+
1458
+ // src/lib/models/types.ts
1459
+ import { i18n as i18n4, joinArray, NonEnumerable as NonEnumerable3 } from "#utils";
1460
+ var Type = class {
1461
+ /**
1462
+ * Return a string representation of this type.
1463
+ */
1464
+ toString() {
1465
+ return this.stringify(TypeContext.none);
1466
+ }
1467
+ visit(visitor, ...args) {
1468
+ return visitor[this.type]?.(this, ...args);
1469
+ }
1470
+ stringify(context) {
1471
+ if (this.needsParenthesis(context)) {
1472
+ return `(${this.getTypeString()})`;
1473
+ }
1474
+ return this.getTypeString();
1475
+ }
1476
+ // Nothing to do for the majority of types.
1477
+ fromObject(_de, _obj) {
1478
+ }
1479
+ /**
1480
+ * Return the estimated size of the type if it was all printed on one line.
1481
+ */
1482
+ estimatePrintWidth() {
1483
+ return this.getTypeString().length;
1484
+ }
1485
+ };
1486
+ function makeRecursiveVisitor(visitor) {
1487
+ const recursiveVisitor = {
1488
+ namedTupleMember(type) {
1489
+ visitor.namedTupleMember?.(type);
1490
+ type.element.visit(recursiveVisitor);
1491
+ },
1492
+ templateLiteral(type) {
1493
+ visitor.templateLiteral?.(type);
1494
+ for (const [h] of type.tail) {
1495
+ h.visit(recursiveVisitor);
1496
+ }
1497
+ },
1498
+ array(type) {
1499
+ visitor.array?.(type);
1500
+ type.elementType.visit(recursiveVisitor);
1501
+ },
1502
+ conditional(type) {
1503
+ visitor.conditional?.(type);
1504
+ type.checkType.visit(recursiveVisitor);
1505
+ type.extendsType.visit(recursiveVisitor);
1506
+ type.trueType.visit(recursiveVisitor);
1507
+ type.falseType.visit(recursiveVisitor);
1508
+ },
1509
+ indexedAccess(type) {
1510
+ visitor.indexedAccess?.(type);
1511
+ type.indexType.visit(recursiveVisitor);
1512
+ type.objectType.visit(recursiveVisitor);
1513
+ },
1514
+ inferred(type) {
1515
+ visitor.inferred?.(type);
1516
+ type.constraint?.visit(recursiveVisitor);
1517
+ },
1518
+ intersection(type) {
1519
+ visitor.intersection?.(type);
1520
+ type.types.forEach((t) => t.visit(recursiveVisitor));
1521
+ },
1522
+ intrinsic(type) {
1523
+ visitor.intrinsic?.(type);
1524
+ },
1525
+ literal(type) {
1526
+ visitor.literal?.(type);
1527
+ },
1528
+ mapped(type) {
1529
+ visitor.mapped?.(type);
1530
+ type.nameType?.visit(recursiveVisitor);
1531
+ type.parameterType.visit(recursiveVisitor);
1532
+ type.templateType.visit(recursiveVisitor);
1533
+ },
1534
+ optional(type) {
1535
+ visitor.optional?.(type);
1536
+ type.elementType.visit(recursiveVisitor);
1537
+ },
1538
+ predicate(type) {
1539
+ visitor.predicate?.(type);
1540
+ type.targetType?.visit(recursiveVisitor);
1541
+ },
1542
+ query(type) {
1543
+ visitor.query?.(type);
1544
+ type.queryType.visit(recursiveVisitor);
1545
+ },
1546
+ reference(type) {
1547
+ visitor.reference?.(type);
1548
+ type.typeArguments?.forEach((t) => t.visit(recursiveVisitor));
1549
+ },
1550
+ reflection(type) {
1551
+ visitor.reflection?.(type);
1552
+ },
1553
+ rest(type) {
1554
+ visitor.rest?.(type);
1555
+ type.elementType.visit(recursiveVisitor);
1556
+ },
1557
+ tuple(type) {
1558
+ visitor.tuple?.(type);
1559
+ type.elements.forEach((t) => t.visit(recursiveVisitor));
1560
+ },
1561
+ typeOperator(type) {
1562
+ visitor.typeOperator?.(type);
1563
+ type.target.visit(recursiveVisitor);
1564
+ },
1565
+ union(type) {
1566
+ visitor.union?.(type);
1567
+ type.types.forEach((t) => t.visit(recursiveVisitor));
1568
+ },
1569
+ unknown(type) {
1570
+ visitor.unknown?.(type);
1571
+ }
1572
+ };
1573
+ return recursiveVisitor;
1574
+ }
1575
+ var TypeContext = {
1576
+ none: "none",
1577
+ templateLiteralElement: "templateLiteralElement",
1578
+ // `${here}`
1579
+ arrayElement: "arrayElement",
1580
+ // here[]
1581
+ indexedAccessElement: "indexedAccessElement",
1582
+ // {}[here]
1583
+ conditionalCheck: "conditionalCheck",
1584
+ // here extends 1 ? 2 : 3
1585
+ conditionalExtends: "conditionalExtends",
1586
+ // 1 extends here ? 2 : 3
1587
+ conditionalTrue: "conditionalTrue",
1588
+ // 1 extends 2 ? here : 3
1589
+ conditionalFalse: "conditionalFalse",
1590
+ // 1 extends 2 ? 3 : here
1591
+ indexedIndex: "indexedIndex",
1592
+ // {}[here]
1593
+ indexedObject: "indexedObject",
1594
+ // here[1]
1595
+ inferredConstraint: "inferredConstraint",
1596
+ // 1 extends infer X extends here ? 1 : 2
1597
+ intersectionElement: "intersectionElement",
1598
+ // here & 1
1599
+ mappedName: "mappedName",
1600
+ // { [k in string as here]: 1 }
1601
+ mappedParameter: "mappedParameter",
1602
+ // { [k in here]: 1 }
1603
+ mappedTemplate: "mappedTemplate",
1604
+ // { [k in string]: here }
1605
+ optionalElement: "optionalElement",
1606
+ // [here?]
1607
+ predicateTarget: "predicateTarget",
1608
+ // (): X is here
1609
+ queryTypeTarget: "queryTypeTarget",
1610
+ // typeof here, can only ever be a ReferenceType
1611
+ typeOperatorTarget: "typeOperatorTarget",
1612
+ // keyof here
1613
+ referenceTypeArgument: "referenceTypeArgument",
1614
+ // X<here>
1615
+ restElement: "restElement",
1616
+ // [...here]
1617
+ tupleElement: "tupleElement",
1618
+ // [here]
1619
+ unionElement: "unionElement"
1620
+ // here | 1
1621
+ };
1622
+ var ArrayType = class extends Type {
1623
+ /**
1624
+ * @param elementType The type of the elements in the array.
1625
+ */
1626
+ constructor(elementType) {
1627
+ super();
1628
+ this.elementType = elementType;
1629
+ }
1630
+ elementType;
1631
+ type = "array";
1632
+ getTypeString() {
1633
+ return this.elementType.stringify(TypeContext.arrayElement) + "[]";
1634
+ }
1635
+ needsParenthesis() {
1636
+ return false;
1637
+ }
1638
+ toObject(serializer) {
1639
+ return {
1640
+ type: this.type,
1641
+ elementType: serializer.toObject(this.elementType)
1642
+ };
1643
+ }
1644
+ };
1645
+ var ConditionalType = class extends Type {
1646
+ constructor(checkType, extendsType, trueType, falseType) {
1647
+ super();
1648
+ this.checkType = checkType;
1649
+ this.extendsType = extendsType;
1650
+ this.trueType = trueType;
1651
+ this.falseType = falseType;
1652
+ }
1653
+ checkType;
1654
+ extendsType;
1655
+ trueType;
1656
+ falseType;
1657
+ type = "conditional";
1658
+ getTypeString() {
1659
+ return [
1660
+ this.checkType.stringify(TypeContext.conditionalCheck),
1661
+ "extends",
1662
+ this.extendsType.stringify(TypeContext.conditionalExtends),
1663
+ "?",
1664
+ this.trueType.stringify(TypeContext.conditionalTrue),
1665
+ ":",
1666
+ this.falseType.stringify(TypeContext.conditionalFalse)
1667
+ ].join(" ");
1668
+ }
1669
+ needsParenthesis(context) {
1670
+ const map = {
1671
+ none: false,
1672
+ templateLiteralElement: false,
1673
+ arrayElement: true,
1674
+ indexedAccessElement: false,
1675
+ conditionalCheck: true,
1676
+ conditionalExtends: true,
1677
+ conditionalTrue: false,
1678
+ conditionalFalse: false,
1679
+ indexedIndex: false,
1680
+ indexedObject: true,
1681
+ inferredConstraint: true,
1682
+ intersectionElement: true,
1683
+ mappedName: false,
1684
+ mappedParameter: false,
1685
+ mappedTemplate: false,
1686
+ optionalElement: true,
1687
+ predicateTarget: false,
1688
+ queryTypeTarget: false,
1689
+ typeOperatorTarget: true,
1690
+ referenceTypeArgument: false,
1691
+ restElement: true,
1692
+ tupleElement: false,
1693
+ unionElement: true
1694
+ };
1695
+ return map[context];
1696
+ }
1697
+ toObject(serializer) {
1698
+ return {
1699
+ type: this.type,
1700
+ checkType: serializer.toObject(this.checkType),
1701
+ extendsType: serializer.toObject(this.extendsType),
1702
+ trueType: serializer.toObject(this.trueType),
1703
+ falseType: serializer.toObject(this.falseType)
1704
+ };
1705
+ }
1706
+ };
1707
+ var IndexedAccessType = class extends Type {
1708
+ constructor(objectType, indexType) {
1709
+ super();
1710
+ this.objectType = objectType;
1711
+ this.indexType = indexType;
1712
+ }
1713
+ objectType;
1714
+ indexType;
1715
+ type = "indexedAccess";
1716
+ getTypeString() {
1717
+ return [
1718
+ this.objectType.stringify(TypeContext.indexedObject),
1719
+ "[",
1720
+ this.indexType.stringify(TypeContext.indexedIndex),
1721
+ "]"
1722
+ ].join("");
1723
+ }
1724
+ needsParenthesis() {
1725
+ return false;
1726
+ }
1727
+ toObject(serializer) {
1728
+ return {
1729
+ type: this.type,
1730
+ indexType: serializer.toObject(this.indexType),
1731
+ objectType: serializer.toObject(this.objectType)
1732
+ };
1733
+ }
1734
+ };
1735
+ var InferredType = class extends Type {
1736
+ constructor(name, constraint) {
1737
+ super();
1738
+ this.name = name;
1739
+ this.constraint = constraint;
1740
+ }
1741
+ name;
1742
+ constraint;
1743
+ type = "inferred";
1744
+ getTypeString() {
1745
+ if (this.constraint) {
1746
+ return `infer ${this.name} extends ${this.constraint.stringify(
1747
+ TypeContext.inferredConstraint
1748
+ )}`;
1749
+ }
1750
+ return `infer ${this.name}`;
1751
+ }
1752
+ needsParenthesis(context) {
1753
+ const map = {
1754
+ none: false,
1755
+ templateLiteralElement: false,
1756
+ arrayElement: true,
1757
+ indexedAccessElement: false,
1758
+ conditionalCheck: false,
1759
+ conditionalExtends: false,
1760
+ conditionalTrue: false,
1761
+ conditionalFalse: false,
1762
+ indexedIndex: false,
1763
+ indexedObject: true,
1764
+ inferredConstraint: false,
1765
+ intersectionElement: false,
1766
+ mappedName: false,
1767
+ mappedParameter: false,
1768
+ mappedTemplate: false,
1769
+ optionalElement: true,
1770
+ predicateTarget: false,
1771
+ queryTypeTarget: false,
1772
+ typeOperatorTarget: false,
1773
+ referenceTypeArgument: false,
1774
+ restElement: true,
1775
+ tupleElement: false,
1776
+ unionElement: false
1777
+ };
1778
+ return map[context];
1779
+ }
1780
+ toObject(serializer) {
1781
+ return {
1782
+ type: this.type,
1783
+ name: this.name,
1784
+ constraint: serializer.toObject(this.constraint)
1785
+ };
1786
+ }
1787
+ };
1788
+ var IntersectionType = class extends Type {
1789
+ constructor(types) {
1790
+ super();
1791
+ this.types = types;
1792
+ }
1793
+ types;
1794
+ type = "intersection";
1795
+ getTypeString() {
1796
+ return this.types.map((t) => t.stringify(TypeContext.intersectionElement)).join(" & ");
1797
+ }
1798
+ needsParenthesis(context) {
1799
+ const map = {
1800
+ none: false,
1801
+ templateLiteralElement: false,
1802
+ arrayElement: true,
1803
+ indexedAccessElement: false,
1804
+ conditionalCheck: true,
1805
+ conditionalExtends: false,
1806
+ conditionalTrue: false,
1807
+ conditionalFalse: false,
1808
+ indexedIndex: false,
1809
+ indexedObject: true,
1810
+ inferredConstraint: false,
1811
+ intersectionElement: false,
1812
+ mappedName: false,
1813
+ mappedParameter: false,
1814
+ mappedTemplate: false,
1815
+ optionalElement: true,
1816
+ predicateTarget: false,
1817
+ queryTypeTarget: false,
1818
+ typeOperatorTarget: true,
1819
+ referenceTypeArgument: false,
1820
+ restElement: true,
1821
+ tupleElement: false,
1822
+ unionElement: false
1823
+ };
1824
+ return map[context];
1825
+ }
1826
+ toObject(serializer) {
1827
+ return {
1828
+ type: this.type,
1829
+ types: this.types.map((t) => serializer.toObject(t))
1830
+ };
1831
+ }
1832
+ };
1833
+ var IntrinsicType = class extends Type {
1834
+ constructor(name) {
1835
+ super();
1836
+ this.name = name;
1837
+ }
1838
+ name;
1839
+ type = "intrinsic";
1840
+ getTypeString() {
1841
+ return this.name;
1842
+ }
1843
+ toObject() {
1844
+ return {
1845
+ type: this.type,
1846
+ name: this.name
1847
+ };
1848
+ }
1849
+ needsParenthesis() {
1850
+ return false;
1851
+ }
1852
+ };
1853
+ var LiteralType = class extends Type {
1854
+ constructor(value) {
1855
+ super();
1856
+ this.value = value;
1857
+ }
1858
+ value;
1859
+ type = "literal";
1860
+ /**
1861
+ * Return a string representation of this type.
1862
+ */
1863
+ getTypeString() {
1864
+ if (typeof this.value === "bigint") {
1865
+ return this.value.toString() + "n";
1866
+ }
1867
+ return JSON.stringify(this.value);
1868
+ }
1869
+ needsParenthesis() {
1870
+ return false;
1871
+ }
1872
+ toObject() {
1873
+ if (typeof this.value === "bigint") {
1874
+ return {
1875
+ type: this.type,
1876
+ value: {
1877
+ value: this.value.toString().replace("-", ""),
1878
+ negative: this.value < BigInt("0")
1879
+ }
1880
+ };
1881
+ }
1882
+ return {
1883
+ type: this.type,
1884
+ value: this.value
1885
+ };
1886
+ }
1887
+ };
1888
+ var MappedType = class extends Type {
1889
+ constructor(parameter, parameterType, templateType, readonlyModifier, optionalModifier, nameType) {
1890
+ super();
1891
+ this.parameter = parameter;
1892
+ this.parameterType = parameterType;
1893
+ this.templateType = templateType;
1894
+ this.readonlyModifier = readonlyModifier;
1895
+ this.optionalModifier = optionalModifier;
1896
+ this.nameType = nameType;
1897
+ }
1898
+ parameter;
1899
+ parameterType;
1900
+ templateType;
1901
+ readonlyModifier;
1902
+ optionalModifier;
1903
+ nameType;
1904
+ type = "mapped";
1905
+ getTypeString() {
1906
+ const read = {
1907
+ "+": "readonly ",
1908
+ "-": "-readonly ",
1909
+ "": ""
1910
+ }[this.readonlyModifier ?? ""];
1911
+ const opt = {
1912
+ "+": "?",
1913
+ "-": "-?",
1914
+ "": ""
1915
+ }[this.optionalModifier ?? ""];
1916
+ const parts = [
1917
+ "{ ",
1918
+ read,
1919
+ "[",
1920
+ this.parameter,
1921
+ " in ",
1922
+ this.parameterType.stringify(TypeContext.mappedParameter)
1923
+ ];
1924
+ if (this.nameType) {
1925
+ parts.push(" as ", this.nameType.stringify(TypeContext.mappedName));
1926
+ }
1927
+ parts.push(
1928
+ "]",
1929
+ opt,
1930
+ ": ",
1931
+ this.templateType.stringify(TypeContext.mappedTemplate),
1932
+ " }"
1933
+ );
1934
+ return parts.join("");
1935
+ }
1936
+ needsParenthesis() {
1937
+ return false;
1938
+ }
1939
+ toObject(serializer) {
1940
+ return {
1941
+ type: this.type,
1942
+ parameter: this.parameter,
1943
+ parameterType: serializer.toObject(this.parameterType),
1944
+ templateType: serializer.toObject(this.templateType),
1945
+ readonlyModifier: this.readonlyModifier,
1946
+ optionalModifier: this.optionalModifier,
1947
+ nameType: serializer.toObject(this.nameType)
1948
+ };
1949
+ }
1950
+ };
1951
+ var OptionalType = class extends Type {
1952
+ constructor(elementType) {
1953
+ super();
1954
+ this.elementType = elementType;
1955
+ }
1956
+ elementType;
1957
+ type = "optional";
1958
+ getTypeString() {
1959
+ return this.elementType.stringify(TypeContext.optionalElement) + "?";
1960
+ }
1961
+ needsParenthesis() {
1962
+ return false;
1963
+ }
1964
+ toObject(serializer) {
1965
+ return {
1966
+ type: this.type,
1967
+ elementType: serializer.toObject(this.elementType)
1968
+ };
1969
+ }
1970
+ };
1971
+ var PredicateType = class extends Type {
1972
+ /**
1973
+ * Create a new PredicateType instance.
1974
+ *
1975
+ * @param name The identifier name which is tested by the predicate.
1976
+ * @param asserts True if the type is of the form `asserts val is string`,
1977
+ * false if the type is of the form `val is string`
1978
+ * @param targetType The type that the identifier is tested to be.
1979
+ * May be undefined if the type is of the form `asserts val`.
1980
+ * Will be defined if the type is of the form `asserts val is string` or `val is string`.
1981
+ */
1982
+ constructor(name, asserts, targetType) {
1983
+ super();
1984
+ this.name = name;
1985
+ this.asserts = asserts;
1986
+ this.targetType = targetType;
1987
+ }
1988
+ name;
1989
+ asserts;
1990
+ targetType;
1991
+ type = "predicate";
1992
+ /**
1993
+ * Return a string representation of this type.
1994
+ */
1995
+ getTypeString() {
1996
+ const out = this.asserts ? ["asserts", this.name] : [this.name];
1997
+ if (this.targetType) {
1998
+ out.push(
1999
+ "is",
2000
+ this.targetType.stringify(TypeContext.predicateTarget)
2001
+ );
2002
+ }
2003
+ return out.join(" ");
2004
+ }
2005
+ needsParenthesis() {
2006
+ return false;
2007
+ }
2008
+ toObject(serializer) {
2009
+ return {
2010
+ type: this.type,
2011
+ name: this.name,
2012
+ asserts: this.asserts,
2013
+ targetType: serializer.toObject(this.targetType)
2014
+ };
2015
+ }
2016
+ };
2017
+ var QueryType = class extends Type {
2018
+ constructor(queryType) {
2019
+ super();
2020
+ this.queryType = queryType;
2021
+ }
2022
+ queryType;
2023
+ type = "query";
2024
+ getTypeString() {
2025
+ return `typeof ${this.queryType.stringify(
2026
+ TypeContext.queryTypeTarget
2027
+ )}`;
2028
+ }
2029
+ /**
2030
+ * @privateRemarks
2031
+ * An argument could be made that this ought to return true for indexedObject
2032
+ * since precedence is different than on the value side... if someone really cares
2033
+ * they can easily use a custom theme to change this.
2034
+ */
2035
+ needsParenthesis() {
2036
+ return false;
2037
+ }
2038
+ toObject(serializer) {
2039
+ return {
2040
+ type: this.type,
2041
+ queryType: serializer.toObject(this.queryType)
2042
+ };
2043
+ }
2044
+ };
2045
+ var __project_dec, _a, _init3;
2046
+ var _ReferenceType = class _ReferenceType extends (_a = Type, __project_dec = [NonEnumerable3], _a) {
2047
+ constructor(name, target, project, qualifiedName) {
2048
+ super();
2049
+ __publicField(this, "type", "reference");
2050
+ /**
2051
+ * The name of the referenced type.
2052
+ *
2053
+ * If the symbol cannot be found because it's not part of the documentation this
2054
+ * can be used to represent the type.
2055
+ */
2056
+ __publicField(this, "name");
2057
+ /**
2058
+ * The type arguments of this reference.
2059
+ */
2060
+ __publicField(this, "typeArguments");
2061
+ /**
2062
+ * Sometimes a few properties are more important than the rest
2063
+ * of the properties within a type. This occurs most often with
2064
+ * object parameters, where users want to specify `@param foo.bar`
2065
+ * to highlight something about the `bar` property.
2066
+ *
2067
+ * Does NOT support nested properties.
2068
+ */
2069
+ __publicField(this, "highlightedProperties");
2070
+ /**
2071
+ * The fully qualified name of the referenced type, relative to the file it is defined in.
2072
+ * This will usually be the same as `name`, unless namespaces are used.
2073
+ */
2074
+ __publicField(this, "qualifiedName");
2075
+ /**
2076
+ * The package that this type is referencing.
2077
+ */
2078
+ __publicField(this, "package");
2079
+ /**
2080
+ * If this reference type refers to a reflection defined by a project not being rendered,
2081
+ * points to the url that this type should be linked to.
2082
+ */
2083
+ __publicField(this, "externalUrl");
2084
+ /**
2085
+ * If set, no warnings about something not being exported should be created
2086
+ * since this may be referring to a type created with `infer X` which will not
2087
+ * be registered on the project.
2088
+ */
2089
+ __publicField(this, "refersToTypeParameter", false);
2090
+ /**
2091
+ * If set, will prefer reflections with {@link ReflectionKind | ReflectionKinds} which represent
2092
+ * values rather than those which represent types.
2093
+ */
2094
+ __publicField(this, "preferValues", false);
2095
+ __publicField(this, "_target");
2096
+ __publicField(this, "_project", __runInitializers(_init3, 8, this)), __runInitializers(_init3, 11, this);
2097
+ this.name = name;
2098
+ if (typeof target === "number") {
2099
+ this._target = target;
2100
+ } else {
2101
+ this._target = "variant" in target ? target.id : target;
2102
+ }
2103
+ this._project = project;
2104
+ this.qualifiedName = qualifiedName;
2105
+ }
2106
+ /**
2107
+ * The resolved reflection.
2108
+ */
2109
+ get reflection() {
2110
+ if (typeof this._target === "number") {
2111
+ return this._project?.getReflectionById(this._target);
2112
+ }
2113
+ const resolvePotential = this._project?.getReflectionsFromSymbolId(
2114
+ this._target
2115
+ );
2116
+ if (!resolvePotential?.length) {
2117
+ return;
2118
+ }
2119
+ const kind = this.preferValues ? ReflectionKind.ValueReferenceTarget : ReflectionKind.TypeReferenceTarget;
2120
+ const resolved = resolvePotential.find((refl) => refl.kindOf(kind)) || resolvePotential.find((refl) => refl.kindOf(~kind));
2121
+ return resolved;
2122
+ }
2123
+ /**
2124
+ * If not resolved, the symbol id of the reflection, otherwise undefined.
2125
+ */
2126
+ get symbolId() {
2127
+ if (!this.reflection && typeof this._target === "object") {
2128
+ return this._target;
2129
+ }
2130
+ }
2131
+ /**
2132
+ * Checks if this type is a reference type because it uses a name, but is intentionally not pointing
2133
+ * to a reflection. This happens for type parameters and when representing a mapped type.
2134
+ */
2135
+ isIntentionallyBroken() {
2136
+ if (typeof this._target === "object" && this._project?.symbolIdHasBeenRemoved(this._target)) {
2137
+ return true;
2138
+ }
2139
+ return this._target === -1 || this.refersToTypeParameter;
2140
+ }
2141
+ /**
2142
+ * Convert this reference type to a declaration reference used for resolution of external types.
2143
+ */
2144
+ toDeclarationReference() {
2145
+ return {
2146
+ resolutionStart: "global",
2147
+ moduleSource: this.package,
2148
+ symbolReference: {
2149
+ path: this.qualifiedName.split(".").map((p) => ({ path: p, navigation: "." }))
2150
+ }
2151
+ };
2152
+ }
2153
+ static createUnresolvedReference(name, target, project, qualifiedName) {
2154
+ return new _ReferenceType(name, target, project, qualifiedName);
2155
+ }
2156
+ static createResolvedReference(name, target, project) {
2157
+ return new _ReferenceType(name, target, project, name);
2158
+ }
2159
+ /**
2160
+ * This is used for type parameters, which don't actually point to something,
2161
+ * and also for temporary references which will be cleaned up with real references
2162
+ * later during conversion.
2163
+ * @internal
2164
+ */
2165
+ static createBrokenReference(name, project, packageName) {
2166
+ const ref = new _ReferenceType(name, -1, project, name);
2167
+ ref.package = packageName;
2168
+ return ref;
2169
+ }
2170
+ getTypeString() {
2171
+ const name = this.reflection ? this.reflection.name : this.name;
2172
+ let typeArgs = "";
2173
+ if (this.typeArguments && this.typeArguments.length > 0) {
2174
+ typeArgs += "<";
2175
+ typeArgs += this.typeArguments.map((arg) => arg.stringify(TypeContext.referenceTypeArgument)).join(", ");
2176
+ typeArgs += ">";
2177
+ }
2178
+ return name + typeArgs;
2179
+ }
2180
+ needsParenthesis() {
2181
+ return false;
2182
+ }
2183
+ toObject(serializer) {
2184
+ let target;
2185
+ if (typeof this._target === "number") {
2186
+ target = this._target;
2187
+ } else if (this._project?.symbolIdHasBeenRemoved(this._target)) {
2188
+ target = -1;
2189
+ } else if (this.reflection) {
2190
+ target = this.reflection.id;
2191
+ } else {
2192
+ target = this._target.toObject();
2193
+ }
2194
+ const result = {
2195
+ type: this.type,
2196
+ target,
2197
+ typeArguments: serializer.toObjectsOptional(this.typeArguments),
2198
+ name: this.name,
2199
+ package: this.package,
2200
+ externalUrl: this.externalUrl
2201
+ };
2202
+ if (this.name !== this.qualifiedName) {
2203
+ result.qualifiedName = this.qualifiedName;
2204
+ }
2205
+ if (this.refersToTypeParameter) {
2206
+ result.refersToTypeParameter = true;
2207
+ }
2208
+ if (typeof target !== "number" && this.preferValues) {
2209
+ result.preferValues = true;
2210
+ }
2211
+ if (this.highlightedProperties) {
2212
+ result.highlightedProperties = Object.fromEntries(
2213
+ Array.from(
2214
+ this.highlightedProperties.entries(),
2215
+ ([key, parts]) => {
2216
+ return [
2217
+ key,
2218
+ Comment.serializeDisplayParts(parts)
2219
+ ];
2220
+ }
2221
+ )
2222
+ );
2223
+ }
2224
+ return result;
2225
+ }
2226
+ fromObject(de, obj) {
2227
+ this.typeArguments = de.reviveMany(obj.typeArguments, (t) => de.constructType(t));
2228
+ if (typeof obj.target === "number") {
2229
+ if (obj.target === -1) {
2230
+ this._target = -1;
2231
+ } else {
2232
+ de.defer((project) => {
2233
+ const target = project.getReflectionById(
2234
+ de.oldIdToNewId[obj.target] ?? -1
2235
+ );
2236
+ if (target) {
2237
+ this._project = project;
2238
+ this._target = target.id;
2239
+ } else {
2240
+ de.logger.warn(
2241
+ i18n4.serialized_project_referenced_0_not_part_of_project(
2242
+ JSON.stringify(obj.target)
2243
+ )
2244
+ );
2245
+ }
2246
+ });
2247
+ }
2248
+ } else {
2249
+ this._project = de.project;
2250
+ this._target = new ReflectionSymbolId(obj.target);
2251
+ }
2252
+ this.qualifiedName = obj.qualifiedName ?? obj.name;
2253
+ this.package = obj.package;
2254
+ this.refersToTypeParameter = !!obj.refersToTypeParameter;
2255
+ this.preferValues = !!obj.preferValues;
2256
+ if (obj.highlightedProperties) {
2257
+ this.highlightedProperties = /* @__PURE__ */ new Map();
2258
+ for (const [key, parts] of Object.entries(
2259
+ obj.highlightedProperties
2260
+ )) {
2261
+ this.highlightedProperties.set(
2262
+ key,
2263
+ Comment.deserializeDisplayParts(de, parts)
2264
+ );
2265
+ }
2266
+ }
2267
+ }
2268
+ };
2269
+ _init3 = __decoratorStart(_a);
2270
+ __decorateElement(_init3, 5, "_project", __project_dec, _ReferenceType);
2271
+ __decoratorMetadata(_init3, _ReferenceType);
2272
+ var ReferenceType = _ReferenceType;
2273
+ var ReflectionType = class extends Type {
2274
+ constructor(declaration) {
2275
+ super();
2276
+ this.declaration = declaration;
2277
+ }
2278
+ declaration;
2279
+ type = "reflection";
2280
+ getTypeString() {
2281
+ const parts = [];
2282
+ const sigs = this.declaration.getNonIndexSignatures();
2283
+ for (const sig of sigs) {
2284
+ parts.push(sigStr(sig, ": "));
2285
+ }
2286
+ for (const p of this.declaration.children || []) {
2287
+ parts.push(`${p.name}${propertySep(p)} ${typeStr(p.type)}`);
2288
+ }
2289
+ for (const s of this.declaration.indexSignatures || []) {
2290
+ parts.push(sigStr(s, ": ", "[]"));
2291
+ }
2292
+ if (sigs.length === 1 && parts.length === 1) {
2293
+ return sigStr(sigs[0], " => ");
2294
+ }
2295
+ if (parts.length === 0) {
2296
+ return "{}";
2297
+ }
2298
+ return `{ ${parts.join("; ")} }`;
2299
+ }
2300
+ needsParenthesis(where) {
2301
+ if (this.declaration.children || this.declaration.indexSignatures) {
2302
+ return false;
2303
+ }
2304
+ if (this.declaration.signatures?.length === 1) {
2305
+ return where === TypeContext.arrayElement || where === TypeContext.unionElement;
2306
+ }
2307
+ return false;
2308
+ }
2309
+ toObject(serializer) {
2310
+ return {
2311
+ type: this.type,
2312
+ declaration: serializer.toObject(this.declaration)
2313
+ };
2314
+ }
2315
+ };
2316
+ var RestType = class extends Type {
2317
+ constructor(elementType) {
2318
+ super();
2319
+ this.elementType = elementType;
2320
+ }
2321
+ elementType;
2322
+ type = "rest";
2323
+ getTypeString() {
2324
+ return `...${this.elementType.stringify(TypeContext.restElement)}`;
2325
+ }
2326
+ needsParenthesis() {
2327
+ return false;
2328
+ }
2329
+ toObject(serializer) {
2330
+ return {
2331
+ type: this.type,
2332
+ elementType: serializer.toObject(this.elementType)
2333
+ };
2334
+ }
2335
+ };
2336
+ var TemplateLiteralType = class extends Type {
2337
+ constructor(head, tail) {
2338
+ super();
2339
+ this.head = head;
2340
+ this.tail = tail;
2341
+ }
2342
+ head;
2343
+ tail;
2344
+ type = "templateLiteral";
2345
+ getTypeString() {
2346
+ return [
2347
+ "`",
2348
+ this.head,
2349
+ ...this.tail.map(([type, text]) => {
2350
+ return "${" + type.stringify(TypeContext.templateLiteralElement) + "}" + text;
2351
+ }),
2352
+ "`"
2353
+ ].join("");
2354
+ }
2355
+ needsParenthesis() {
2356
+ return false;
2357
+ }
2358
+ toObject(serializer) {
2359
+ return {
2360
+ type: this.type,
2361
+ head: this.head,
2362
+ tail: this.tail.map(([type, text]) => [
2363
+ serializer.toObject(type),
2364
+ text
2365
+ ])
2366
+ };
2367
+ }
2368
+ };
2369
+ var TupleType = class extends Type {
2370
+ /**
2371
+ * @param elements The ordered type elements of the tuple type.
2372
+ */
2373
+ constructor(elements) {
2374
+ super();
2375
+ this.elements = elements;
2376
+ }
2377
+ elements;
2378
+ type = "tuple";
2379
+ getTypeString() {
2380
+ return "[" + this.elements.map((t) => t.stringify(TypeContext.tupleElement)).join(", ") + "]";
2381
+ }
2382
+ needsParenthesis() {
2383
+ return false;
2384
+ }
2385
+ toObject(serializer) {
2386
+ return {
2387
+ type: this.type,
2388
+ elements: serializer.toObjectsOptional(this.elements)
2389
+ };
2390
+ }
2391
+ };
2392
+ var NamedTupleMember = class extends Type {
2393
+ constructor(name, isOptional, element) {
2394
+ super();
2395
+ this.name = name;
2396
+ this.isOptional = isOptional;
2397
+ this.element = element;
2398
+ }
2399
+ name;
2400
+ isOptional;
2401
+ element;
2402
+ type = "namedTupleMember";
2403
+ /**
2404
+ * Return a string representation of this type.
2405
+ */
2406
+ getTypeString() {
2407
+ return `${this.name}${this.isOptional ? "?" : ""}: ${this.element.stringify(TypeContext.tupleElement)}`;
2408
+ }
2409
+ needsParenthesis() {
2410
+ return false;
2411
+ }
2412
+ toObject(serializer) {
2413
+ return {
2414
+ type: this.type,
2415
+ name: this.name,
2416
+ isOptional: this.isOptional,
2417
+ element: serializer.toObject(this.element)
2418
+ };
2419
+ }
2420
+ };
2421
+ var TypeOperatorType = class extends Type {
2422
+ constructor(target, operator) {
2423
+ super();
2424
+ this.target = target;
2425
+ this.operator = operator;
2426
+ }
2427
+ target;
2428
+ operator;
2429
+ type = "typeOperator";
2430
+ getTypeString() {
2431
+ return `${this.operator} ${this.target.stringify(
2432
+ TypeContext.typeOperatorTarget
2433
+ )}`;
2434
+ }
2435
+ needsParenthesis(context) {
2436
+ const map = {
2437
+ none: false,
2438
+ templateLiteralElement: false,
2439
+ arrayElement: true,
2440
+ indexedAccessElement: false,
2441
+ conditionalCheck: false,
2442
+ conditionalExtends: false,
2443
+ conditionalTrue: false,
2444
+ conditionalFalse: false,
2445
+ indexedIndex: false,
2446
+ indexedObject: true,
2447
+ inferredConstraint: false,
2448
+ intersectionElement: false,
2449
+ mappedName: false,
2450
+ mappedParameter: false,
2451
+ mappedTemplate: false,
2452
+ optionalElement: true,
2453
+ predicateTarget: false,
2454
+ queryTypeTarget: false,
2455
+ typeOperatorTarget: false,
2456
+ referenceTypeArgument: false,
2457
+ restElement: false,
2458
+ tupleElement: false,
2459
+ unionElement: false
2460
+ };
2461
+ return map[context];
2462
+ }
2463
+ toObject(serializer) {
2464
+ return {
2465
+ type: this.type,
2466
+ operator: this.operator,
2467
+ target: serializer.toObject(this.target)
2468
+ };
2469
+ }
2470
+ };
2471
+ var UnionType = class extends Type {
2472
+ constructor(types) {
2473
+ super();
2474
+ this.types = types;
2475
+ }
2476
+ types;
2477
+ type = "union";
2478
+ /**
2479
+ * If present, there should be as many items in this array as there are items in the {@link types} array.
2480
+ *
2481
+ * This member is only valid on unions which are on {@link DeclarationReflection.type | DeclarationReflection.type} with a
2482
+ * {@link ReflectionKind} `kind` of `TypeAlias`. Specifying it on any other union is undefined behavior.
2483
+ */
2484
+ elementSummaries;
2485
+ getTypeString() {
2486
+ return this.types.map((t) => t.stringify(TypeContext.unionElement)).join(" | ");
2487
+ }
2488
+ needsParenthesis(context) {
2489
+ const map = {
2490
+ none: false,
2491
+ templateLiteralElement: false,
2492
+ arrayElement: true,
2493
+ indexedAccessElement: false,
2494
+ conditionalCheck: true,
2495
+ conditionalExtends: false,
2496
+ conditionalTrue: false,
2497
+ conditionalFalse: false,
2498
+ indexedIndex: false,
2499
+ indexedObject: true,
2500
+ inferredConstraint: false,
2501
+ intersectionElement: true,
2502
+ mappedName: false,
2503
+ mappedParameter: false,
2504
+ mappedTemplate: false,
2505
+ optionalElement: true,
2506
+ predicateTarget: false,
2507
+ queryTypeTarget: false,
2508
+ typeOperatorTarget: true,
2509
+ referenceTypeArgument: false,
2510
+ restElement: false,
2511
+ tupleElement: false,
2512
+ unionElement: false
2513
+ };
2514
+ return map[context];
2515
+ }
2516
+ fromObject(de, obj) {
2517
+ if (obj.elementSummaries) {
2518
+ this.elementSummaries = obj.elementSummaries.map((parts) => Comment.deserializeDisplayParts(de, parts));
2519
+ }
2520
+ }
2521
+ toObject(serializer) {
2522
+ return {
2523
+ type: this.type,
2524
+ types: this.types.map((t) => serializer.toObject(t)),
2525
+ elementSummaries: this.elementSummaries?.map((parts) => Comment.serializeDisplayParts(parts))
2526
+ };
2527
+ }
2528
+ };
2529
+ var UnknownType = class extends Type {
2530
+ type = "unknown";
2531
+ /**
2532
+ * A string representation of the type as returned from TypeScript compiler.
2533
+ */
2534
+ name;
2535
+ constructor(name) {
2536
+ super();
2537
+ this.name = name;
2538
+ }
2539
+ getTypeString() {
2540
+ return this.name;
2541
+ }
2542
+ /**
2543
+ * Always returns true if not at the root level, we have no idea what's in here, so wrap it in parenthesis
2544
+ * to be extra safe.
2545
+ */
2546
+ needsParenthesis(context) {
2547
+ return context !== TypeContext.none;
2548
+ }
2549
+ toObject() {
2550
+ return {
2551
+ type: this.type,
2552
+ name: this.name
2553
+ };
2554
+ }
2555
+ };
2556
+ function propertySep(refl) {
2557
+ return refl.flags.isOptional ? "?:" : ":";
2558
+ }
2559
+ function typeStr(type) {
2560
+ return type?.toString() ?? "any";
2561
+ }
2562
+ function sigStr(sig, sep, brackets = "()") {
2563
+ const params = joinArray(
2564
+ sig.parameters,
2565
+ ", ",
2566
+ (p) => `${p.name}${propertySep(p)} ${typeStr(p.type)}`
2567
+ );
2568
+ return `${brackets[0]}${params}${brackets[1]}${sep}${typeStr(sig.type)}`;
2569
+ }
2570
+
2571
+ // src/lib/models/SourceReference.ts
2572
+ var SourceReference = class {
2573
+ /**
2574
+ * The filename of the source file.
2575
+ * This will initially be absolute before being overwritten with a base path relative path during resolution.
2576
+ */
2577
+ fileName;
2578
+ /**
2579
+ * The absolute filename of the source file.
2580
+ * @internal
2581
+ */
2582
+ fullFileName;
2583
+ /**
2584
+ * The one based number of the line that emitted the declaration.
2585
+ */
2586
+ line;
2587
+ /**
2588
+ * The index of the character that emitted the declaration.
2589
+ */
2590
+ character;
2591
+ /**
2592
+ * URL for displaying the source file.
2593
+ */
2594
+ url;
2595
+ constructor(fileName, line, character) {
2596
+ this.fileName = fileName;
2597
+ this.fullFileName = fileName;
2598
+ this.line = line;
2599
+ this.character = character;
2600
+ }
2601
+ equals(other) {
2602
+ return this.fullFileName == other.fullFileName && this.line === other.line && this.character === other.character;
2603
+ }
2604
+ toObject() {
2605
+ return {
2606
+ fileName: this.fileName,
2607
+ line: this.line,
2608
+ character: this.character,
2609
+ url: this.url
2610
+ };
2611
+ }
2612
+ fromObject(_de, obj) {
2613
+ this.url = obj.url;
2614
+ }
2615
+ };
2616
+
2617
+ // src/lib/models/DeclarationReflection.ts
2618
+ import { i18n as i18n5 } from "#utils";
2619
+ var DeclarationReflection = class extends ContainerReflection {
2620
+ variant = "declaration";
2621
+ /**
2622
+ * A list of all source files that contributed to this reflection.
2623
+ */
2624
+ sources;
2625
+ /**
2626
+ * Precomputed boost for search results, may be less than 1 to de-emphasize this member in search results.
2627
+ * Does NOT include group/category values as they are computed when building the JS index.
2628
+ *
2629
+ * This is exposed purely for plugin use, see #3036 for details.
2630
+ */
2631
+ relevanceBoost;
2632
+ /**
2633
+ * The escaped name of this declaration assigned by the TS compiler if there is an associated symbol.
2634
+ * This is used to retrieve properties for analyzing inherited members.
2635
+ *
2636
+ * Not serialized, only useful during conversion. This is a `ts.__String`.
2637
+ * @internal
2638
+ */
2639
+ escapedName;
2640
+ /**
2641
+ * The type of the reflection.
2642
+ *
2643
+ * If the reflection represents a variable or a property, this is the value type.<br />
2644
+ * If the reflection represents a signature, this is the return type.
2645
+ */
2646
+ type;
2647
+ typeParameters;
2648
+ /**
2649
+ * A list of call signatures attached to this declaration.
2650
+ *
2651
+ * TypeDoc creates one declaration per function that may contain one or more
2652
+ * signature reflections.
2653
+ */
2654
+ signatures;
2655
+ /**
2656
+ * The index signature of this declaration.
2657
+ */
2658
+ indexSignatures;
2659
+ /**
2660
+ * The get signature of this declaration.
2661
+ */
2662
+ getSignature;
2663
+ /**
2664
+ * The set signature of this declaration.
2665
+ */
2666
+ setSignature;
2667
+ /**
2668
+ * The default value of this reflection.
2669
+ *
2670
+ * Applies to function parameters, variables, and properties.
2671
+ */
2672
+ defaultValue;
2673
+ /**
2674
+ * A type that points to the reflection that has been overwritten by this reflection.
2675
+ *
2676
+ * Applies to interface and class members.
2677
+ */
2678
+ overwrites;
2679
+ /**
2680
+ * A type that points to the reflection this reflection has been inherited from.
2681
+ *
2682
+ * Applies to interface and class members.
2683
+ */
2684
+ inheritedFrom;
2685
+ /**
2686
+ * A type that points to the reflection this reflection is the implementation of.
2687
+ *
2688
+ * Applies to class members.
2689
+ */
2690
+ implementationOf;
2691
+ /**
2692
+ * A list of all types this reflection extends (e.g. the parent classes).
2693
+ */
2694
+ extendedTypes;
2695
+ /**
2696
+ * A list of all types that extend this reflection (e.g. the subclasses).
2697
+ */
2698
+ extendedBy;
2699
+ /**
2700
+ * A list of all types this reflection implements.
2701
+ */
2702
+ implementedTypes;
2703
+ /**
2704
+ * A list of all types that implement this reflection.
2705
+ */
2706
+ implementedBy;
2707
+ /**
2708
+ * Contains a simplified representation of the type hierarchy suitable for being
2709
+ * rendered in templates.
2710
+ */
2711
+ typeHierarchy;
2712
+ /**
2713
+ * The contents of the readme file of the module when found.
2714
+ */
2715
+ readme;
2716
+ /**
2717
+ * The version of the module when found.
2718
+ */
2719
+ packageVersion;
2720
+ isDeclaration() {
2721
+ return true;
2722
+ }
2723
+ hasGetterOrSetter() {
2724
+ return !!this.getSignature || !!this.setSignature;
2725
+ }
2726
+ getAllSignatures() {
2727
+ let result = [];
2728
+ if (this.signatures) {
2729
+ result = result.concat(this.signatures);
2730
+ }
2731
+ if (this.indexSignatures) {
2732
+ result = result.concat(this.indexSignatures);
2733
+ }
2734
+ if (this.getSignature) {
2735
+ result.push(this.getSignature);
2736
+ }
2737
+ if (this.setSignature) {
2738
+ result.push(this.setSignature);
2739
+ }
2740
+ return result;
2741
+ }
2742
+ getNonIndexSignatures() {
2743
+ return [].concat(
2744
+ this.signatures ?? [],
2745
+ this.setSignature ?? [],
2746
+ this.getSignature ?? []
2747
+ );
2748
+ }
2749
+ getProperties() {
2750
+ if (this.children?.length) {
2751
+ return this.children;
2752
+ }
2753
+ if (this.type?.type === "reflection") {
2754
+ return this.type.declaration.children ?? [];
2755
+ }
2756
+ return [];
2757
+ }
2758
+ getChildOrTypePropertyByName(path) {
2759
+ if (this.type?.type === "reflection") {
2760
+ for (const child of this.type.declaration.children || []) {
2761
+ if (path[0] === child.name) {
2762
+ if (path.length === 1) {
2763
+ return child;
2764
+ }
2765
+ return child.getChildOrTypePropertyByName(path.slice(1));
2766
+ }
2767
+ }
2768
+ }
2769
+ for (const child of this.children || []) {
2770
+ if (path[0] === child.name) {
2771
+ if (path.length === 1) {
2772
+ return child;
2773
+ }
2774
+ return child.getChildOrTypePropertyByName(path.slice(1));
2775
+ }
2776
+ }
2777
+ return void 0;
2778
+ }
2779
+ traverse(callback) {
2780
+ for (const parameter of this.typeParameters?.slice() || []) {
2781
+ if (callback(parameter, 4 /* TypeParameter */) === false) {
2782
+ return;
2783
+ }
2784
+ }
2785
+ if (this.type instanceof ReflectionType) {
2786
+ if (callback(
2787
+ this.type.declaration,
2788
+ 3 /* TypeLiteral */
2789
+ ) === false) {
2790
+ return;
2791
+ }
2792
+ }
2793
+ for (const signature of this.signatures?.slice() || []) {
2794
+ if (callback(signature, 5 /* Signatures */) === false) {
2795
+ return;
2796
+ }
2797
+ }
2798
+ for (const signature of this.indexSignatures?.slice() || []) {
2799
+ if (callback(signature, 6 /* IndexSignature */) === false) {
2800
+ return;
2801
+ }
2802
+ }
2803
+ if (this.getSignature) {
2804
+ if (callback(this.getSignature, 7 /* GetSignature */) === false) {
2805
+ return;
2806
+ }
2807
+ }
2808
+ if (this.setSignature) {
2809
+ if (callback(this.setSignature, 8 /* SetSignature */) === false) {
2810
+ return;
2811
+ }
2812
+ }
2813
+ super.traverse(callback);
2814
+ }
2815
+ /**
2816
+ * Return a string representation of this reflection.
2817
+ */
2818
+ toString() {
2819
+ let result = super.toString();
2820
+ if (this.typeParameters) {
2821
+ const parameters = this.typeParameters.map(
2822
+ (parameter) => parameter.name
2823
+ );
2824
+ result += "<" + parameters.join(", ") + ">";
2825
+ }
2826
+ if (this.type) {
2827
+ result += ": " + this.type.toString();
2828
+ }
2829
+ return result;
2830
+ }
2831
+ toObject(serializer) {
2832
+ return {
2833
+ ...super.toObject(serializer),
2834
+ variant: this.variant,
2835
+ packageVersion: this.packageVersion,
2836
+ sources: serializer.toObjectsOptional(this.sources),
2837
+ relevanceBoost: this.relevanceBoost === 1 ? void 0 : this.relevanceBoost,
2838
+ typeParameters: serializer.toObjectsOptional(this.typeParameters),
2839
+ type: serializer.toObject(this.type),
2840
+ signatures: serializer.toObjectsOptional(this.signatures),
2841
+ indexSignatures: serializer.toObjectsOptional(this.indexSignatures),
2842
+ getSignature: serializer.toObject(this.getSignature),
2843
+ setSignature: serializer.toObject(this.setSignature),
2844
+ defaultValue: this.defaultValue,
2845
+ overwrites: serializer.toObject(this.overwrites),
2846
+ inheritedFrom: serializer.toObject(this.inheritedFrom),
2847
+ implementationOf: serializer.toObject(this.implementationOf),
2848
+ extendedTypes: serializer.toObjectsOptional(this.extendedTypes),
2849
+ extendedBy: serializer.toObjectsOptional(this.extendedBy),
2850
+ implementedTypes: serializer.toObjectsOptional(
2851
+ this.implementedTypes
2852
+ ),
2853
+ implementedBy: serializer.toObjectsOptional(this.implementedBy),
2854
+ readme: Comment.serializeDisplayParts(this.readme)
2855
+ };
2856
+ }
2857
+ fromObject(de, obj) {
2858
+ super.fromObject(de, obj);
2859
+ if (obj.readme) {
2860
+ this.readme = Comment.deserializeDisplayParts(de, obj.readme);
2861
+ }
2862
+ if (obj.variant === "project") {
2863
+ this.kind = 2 /* Module */;
2864
+ this.packageVersion = obj.packageVersion;
2865
+ this.project.files.fromObject(de, obj.files || {});
2866
+ de.defer(() => {
2867
+ for (const [id, sid] of Object.entries(obj.symbolIdMap || {})) {
2868
+ const refl = this.project.getReflectionById(
2869
+ de.oldIdToNewId[+id] ?? -1
2870
+ );
2871
+ if (refl) {
2872
+ this.project.registerSymbolId(
2873
+ refl,
2874
+ new ReflectionSymbolId(sid)
2875
+ );
2876
+ } else {
2877
+ de.logger.warn(i18n5.serialized_project_referenced_0_not_part_of_project(id));
2878
+ }
2879
+ }
2880
+ });
2881
+ return;
2882
+ }
2883
+ this.packageVersion = obj.packageVersion;
2884
+ this.sources = de.reviveMany(
2885
+ obj.sources,
2886
+ (src) => new SourceReference(src.fileName, src.line, src.character)
2887
+ );
2888
+ this.relevanceBoost = obj.relevanceBoost;
2889
+ this.typeParameters = de.reviveMany(obj.typeParameters, (tp) => de.constructReflection(tp));
2890
+ this.type = de.revive(obj.type, (t) => de.constructType(t));
2891
+ this.signatures = de.reviveMany(obj.signatures, (r) => de.constructReflection(r));
2892
+ this.indexSignatures = de.reviveMany(obj.indexSignatures, (r) => de.constructReflection(r));
2893
+ this.getSignature = de.revive(obj.getSignature, (r) => de.constructReflection(r));
2894
+ this.setSignature = de.revive(obj.setSignature, (r) => de.constructReflection(r));
2895
+ this.defaultValue = obj.defaultValue;
2896
+ this.overwrites = de.reviveType(obj.overwrites);
2897
+ this.inheritedFrom = de.reviveType(obj.inheritedFrom);
2898
+ this.implementationOf = de.reviveType(obj.implementationOf);
2899
+ this.extendedTypes = de.reviveMany(obj.extendedTypes, (t) => de.reviveType(t));
2900
+ this.extendedBy = de.reviveMany(obj.extendedBy, (t) => de.reviveType(t));
2901
+ this.implementedTypes = de.reviveMany(obj.implementedTypes, (t) => de.reviveType(t));
2902
+ this.implementedBy = de.reviveMany(obj.implementedBy, (t) => de.reviveType(t));
2903
+ }
2904
+ };
2905
+
2906
+ // src/lib/models/DocumentReflection.ts
2907
+ var DocumentReflection = class extends Reflection {
2908
+ variant = "document";
2909
+ /**
2910
+ * The content to be displayed on the page for this reflection.
2911
+ */
2912
+ content;
2913
+ /**
2914
+ * Frontmatter included in document
2915
+ */
2916
+ frontmatter;
2917
+ /**
2918
+ * A precomputed boost derived from the searchCategoryBoosts and searchGroupBoosts options, used when
2919
+ * boosting search relevance scores at runtime. May be modified by plugins.
2920
+ */
2921
+ relevanceBoost;
2922
+ /**
2923
+ * Child documents, if any are present.
2924
+ */
2925
+ children;
2926
+ constructor(name, parent, content, frontmatter) {
2927
+ super(name, 8388608 /* Document */, parent);
2928
+ this.content = content;
2929
+ this.frontmatter = frontmatter;
2930
+ if (typeof frontmatter["title"] === "string") {
2931
+ this.name = frontmatter["title"];
2932
+ delete frontmatter["title"];
2933
+ }
2934
+ }
2935
+ addChild(child) {
2936
+ this.children ||= [];
2937
+ this.children.push(child);
2938
+ }
2939
+ isDocument() {
2940
+ return true;
2941
+ }
2942
+ traverse(callback) {
2943
+ for (const child of this.children || []) {
2944
+ if (callback(child, 1 /* Documents */) === false) {
2945
+ return;
2946
+ }
2947
+ }
2948
+ }
2949
+ toObject(serializer) {
2950
+ return {
2951
+ ...super.toObject(serializer),
2952
+ variant: this.variant,
2953
+ content: Comment.serializeDisplayParts(this.content),
2954
+ frontmatter: this.frontmatter,
2955
+ relevanceBoost: this.relevanceBoost,
2956
+ children: serializer.toObjectsOptional(this.children)
2957
+ };
2958
+ }
2959
+ fromObject(de, obj) {
2960
+ super.fromObject(de, obj);
2961
+ this.content = Comment.deserializeDisplayParts(de, obj.content);
2962
+ this.frontmatter = obj.frontmatter;
2963
+ this.relevanceBoost = obj.relevanceBoost;
2964
+ this.children = de.reviveMany(obj.children, (obj2) => de.constructReflection(obj2));
2965
+ }
2966
+ };
2967
+
2968
+ // src/lib/models/FileRegistry.ts
2969
+ import { NormalizedPathUtils } from "#utils";
2970
+ var FileRegistry = class {
2971
+ nextId = 1;
2972
+ // The combination of these two make up the registry
2973
+ mediaToReflection = /* @__PURE__ */ new Map();
2974
+ mediaToPath = /* @__PURE__ */ new Map();
2975
+ reflectionToPath = /* @__PURE__ */ new Map();
2976
+ pathToMedia = /* @__PURE__ */ new Map();
2977
+ // Lazily created as we get names for rendering
2978
+ names = /* @__PURE__ */ new Map();
2979
+ nameUsage = /* @__PURE__ */ new Map();
2980
+ registerAbsolute(absolute) {
2981
+ const anchorIndex = absolute.indexOf("#");
2982
+ let anchor = void 0;
2983
+ if (anchorIndex !== -1) {
2984
+ anchor = absolute.substring(anchorIndex + 1);
2985
+ absolute = absolute.substring(0, anchorIndex);
2986
+ }
2987
+ const existing = this.pathToMedia.get(absolute);
2988
+ if (existing) {
2989
+ return { target: existing, anchor };
2990
+ }
2991
+ this.mediaToPath.set(this.nextId, absolute);
2992
+ this.pathToMedia.set(absolute, this.nextId);
2993
+ return { target: this.nextId++, anchor };
2994
+ }
2995
+ /**
2996
+ * Registers the specified path as the canonical file for this reflection
2997
+ */
2998
+ registerReflection(absolute, reflection) {
2999
+ const { target } = this.registerAbsolute(absolute);
3000
+ this.reflectionToPath.set(reflection.id, absolute);
3001
+ this.mediaToReflection.set(target, reflection.id);
3002
+ }
3003
+ /**
3004
+ * Registers the specified path as a path which should be resolved to the specified
3005
+ * reflection. A reflection *may* be associated with multiple paths.
3006
+ */
3007
+ registerReflectionPath(absolute, reflection) {
3008
+ const { target } = this.registerAbsolute(absolute);
3009
+ this.mediaToReflection.set(target, reflection.id);
3010
+ }
3011
+ getReflectionPath(reflection) {
3012
+ return this.reflectionToPath.get(reflection.id);
3013
+ }
3014
+ register(sourcePath, relativePath) {
3015
+ return this.registerAbsolute(
3016
+ NormalizedPathUtils.resolve(NormalizedPathUtils.dirname(sourcePath), relativePath)
3017
+ );
3018
+ }
3019
+ removeReflection(reflection) {
3020
+ const absolute = this.reflectionToPath.get(reflection.id);
3021
+ if (absolute) {
3022
+ const media = this.pathToMedia.get(absolute);
3023
+ this.mediaToReflection.delete(media);
3024
+ }
3025
+ }
3026
+ resolve(id, project) {
3027
+ const reflId = this.mediaToReflection.get(id);
3028
+ if (typeof reflId === "number") {
3029
+ return project.getReflectionById(reflId);
3030
+ }
3031
+ return this.mediaToPath.get(id);
3032
+ }
3033
+ resolvePath(id) {
3034
+ return this.mediaToPath.get(id);
3035
+ }
3036
+ getName(id) {
3037
+ const absolute = this.mediaToPath.get(id);
3038
+ if (!absolute) return;
3039
+ if (this.names.has(id)) {
3040
+ return this.names.get(id);
3041
+ }
3042
+ const file = NormalizedPathUtils.basename(absolute);
3043
+ if (!this.nameUsage.has(file)) {
3044
+ this.nameUsage.set(file, 1);
3045
+ this.names.set(id, file);
3046
+ } else {
3047
+ const { name, ext } = NormalizedPathUtils.splitFilename(file);
3048
+ let counter = this.nameUsage.get(file);
3049
+ while (this.nameUsage.has(`${name}-${counter}${ext}`)) {
3050
+ ++counter;
3051
+ }
3052
+ this.nameUsage.set(file, counter + 1);
3053
+ this.nameUsage.set(`${name}-${counter}${ext}`, counter + 1);
3054
+ this.names.set(id, `${name}-${counter}${ext}`);
3055
+ }
3056
+ return this.names.get(id);
3057
+ }
3058
+ /**
3059
+ * Iterate over all registered media file paths, yielding entries
3060
+ * that do NOT have an associated reflection.
3061
+ */
3062
+ getMediaPaths() {
3063
+ const result = [];
3064
+ for (const [id, path] of this.mediaToPath.entries()) {
3065
+ if (!this.mediaToReflection.has(id)) {
3066
+ result.push(path);
3067
+ }
3068
+ }
3069
+ return result;
3070
+ }
3071
+ getNameToAbsoluteMap() {
3072
+ const result = /* @__PURE__ */ new Map();
3073
+ for (const [id, name] of this.names.entries()) {
3074
+ result.set(name, this.mediaToPath.get(id));
3075
+ }
3076
+ return result;
3077
+ }
3078
+ toObject(ser) {
3079
+ const result = {
3080
+ entries: {},
3081
+ reflections: {}
3082
+ };
3083
+ for (const [key, val] of this.mediaToPath.entries()) {
3084
+ result.entries[key] = NormalizedPathUtils.relative(ser.projectRoot, val);
3085
+ }
3086
+ for (const [key, val] of this.mediaToReflection.entries()) {
3087
+ if (ser.project.getReflectionById(val)) {
3088
+ result.reflections[key] = val;
3089
+ }
3090
+ }
3091
+ return result;
3092
+ }
3093
+ /**
3094
+ * Revive a file registry from disc.
3095
+ * Note that in the packages context this may be called multiple times on
3096
+ * a single object, and should merge in files from the other registries.
3097
+ */
3098
+ fromObject(de, obj) {
3099
+ for (const [fileId, path] of Object.entries(obj.entries)) {
3100
+ const absolute = NormalizedPathUtils.resolve(de.projectRoot, path);
3101
+ de.oldFileIdToNewFileId[+fileId] = this.registerAbsolute(absolute).target;
3102
+ }
3103
+ de.defer((project) => {
3104
+ for (const [fileId, reflId] of Object.entries(obj.reflections)) {
3105
+ const refl = project.getReflectionById(
3106
+ de.oldIdToNewId[reflId]
3107
+ );
3108
+ if (refl) {
3109
+ this.mediaToReflection.set(
3110
+ de.oldFileIdToNewFileId[+fileId],
3111
+ refl.id
3112
+ );
3113
+ }
3114
+ }
3115
+ });
3116
+ }
3117
+ };
3118
+
3119
+ // src/lib/models/ParameterReflection.ts
3120
+ var ParameterReflection = class extends Reflection {
3121
+ variant = "param";
3122
+ defaultValue;
3123
+ type;
3124
+ traverse(callback) {
3125
+ if (this.type instanceof ReflectionType) {
3126
+ if (callback(
3127
+ this.type.declaration,
3128
+ 3 /* TypeLiteral */
3129
+ ) === false) {
3130
+ return;
3131
+ }
3132
+ }
3133
+ }
3134
+ isParameter() {
3135
+ return true;
3136
+ }
3137
+ /**
3138
+ * Return a string representation of this reflection.
3139
+ */
3140
+ toString() {
3141
+ return super.toString() + (this.type ? ": " + this.type.toString() : "");
3142
+ }
3143
+ toObject(serializer) {
3144
+ return {
3145
+ ...super.toObject(serializer),
3146
+ variant: this.variant,
3147
+ type: serializer.toObject(this.type),
3148
+ defaultValue: this.defaultValue
3149
+ };
3150
+ }
3151
+ fromObject(de, obj) {
3152
+ super.fromObject(de, obj);
3153
+ this.type = de.reviveType(obj.type);
3154
+ this.defaultValue = obj.defaultValue;
3155
+ }
3156
+ };
3157
+
3158
+ // src/lib/models/ReferenceReflection.ts
3159
+ var ReferenceReflection = class _ReferenceReflection extends DeclarationReflection {
3160
+ variant = "reference";
3161
+ _target;
3162
+ /**
3163
+ * Creates a reference reflection. Should only be used within the factory function.
3164
+ * @internal
3165
+ */
3166
+ constructor(name, reflection, parent) {
3167
+ super(name, 4194304 /* Reference */, parent);
3168
+ this._target = reflection.id;
3169
+ }
3170
+ /**
3171
+ * Tries to get the reflection that is referenced. This may be another reference reflection.
3172
+ * To fully resolve any references, use {@link tryGetTargetReflectionDeep}.
3173
+ */
3174
+ tryGetTargetReflection() {
3175
+ return this.project.getReflectionById(this._target);
3176
+ }
3177
+ /**
3178
+ * Tries to get the reflection that is referenced, this will fully resolve references.
3179
+ * To only resolve one reference, use {@link tryGetTargetReflection}.
3180
+ */
3181
+ tryGetTargetReflectionDeep() {
3182
+ let result = this.tryGetTargetReflection();
3183
+ while (result instanceof _ReferenceReflection) {
3184
+ result = result.tryGetTargetReflection();
3185
+ }
3186
+ return result;
3187
+ }
3188
+ /**
3189
+ * Gets the reflection that is referenced. This may be another reference reflection.
3190
+ * To fully resolve any references, use {@link getTargetReflectionDeep}.
3191
+ */
3192
+ getTargetReflection() {
3193
+ const target = this.tryGetTargetReflection();
3194
+ if (!target) {
3195
+ throw new Error("Reference was unresolved.");
3196
+ }
3197
+ return target;
3198
+ }
3199
+ /**
3200
+ * Gets the reflection that is referenced, this will fully resolve references.
3201
+ * To only resolve one reference, use {@link getTargetReflection}.
3202
+ */
3203
+ getTargetReflectionDeep() {
3204
+ let result = this.getTargetReflection();
3205
+ while (result instanceof _ReferenceReflection) {
3206
+ result = result.getTargetReflection();
3207
+ }
3208
+ return result;
3209
+ }
3210
+ getChildByName(arg) {
3211
+ return this.getTargetReflection().getChildByName(arg);
3212
+ }
3213
+ toObject(serializer) {
3214
+ return {
3215
+ ...super.toObject(serializer),
3216
+ variant: this.variant,
3217
+ target: this.tryGetTargetReflection()?.id ?? -1
3218
+ };
3219
+ }
3220
+ fromObject(de, obj) {
3221
+ super.fromObject(de, obj);
3222
+ de.defer((project) => {
3223
+ this._target = project.getReflectionById(de.oldIdToNewId[obj.target] ?? -1)?.id ?? -1;
3224
+ });
3225
+ }
3226
+ };
3227
+
3228
+ // src/lib/models/ProjectReflection.ts
3229
+ import {
3230
+ assertNever as assertNever3,
3231
+ DefaultMap,
3232
+ i18n as i18n6,
3233
+ NonEnumerable as NonEnumerable4,
3234
+ removeIfPresent as removeIfPresent2,
3235
+ StableKeyMap
3236
+ } from "#utils";
3237
+ var JSON_SCHEMA_VERSION = "2.0";
3238
+ var _reflections_dec, _reflectionChildren_dec, _referenceGraph_dec, _removedSymbolIds_dec, _reflectionIdToSymbolIdMap_dec, _symbolToReflectionIdMap_dec, _a2, _init4;
3239
+ var ProjectReflection = class extends (_a2 = ContainerReflection, _symbolToReflectionIdMap_dec = [NonEnumerable4], _reflectionIdToSymbolIdMap_dec = [NonEnumerable4], _removedSymbolIds_dec = [NonEnumerable4], _referenceGraph_dec = [NonEnumerable4], _reflectionChildren_dec = [NonEnumerable4], _reflections_dec = [NonEnumerable4], _a2) {
3240
+ constructor(name, registry) {
3241
+ super(name, 1 /* Project */);
3242
+ __publicField(this, "variant", "project");
3243
+ __publicField(this, "symbolToReflectionIdMap", __runInitializers(_init4, 8, this, new StableKeyMap())), __runInitializers(_init4, 11, this);
3244
+ __publicField(this, "reflectionIdToSymbolIdMap", __runInitializers(_init4, 12, this, /* @__PURE__ */ new Map())), __runInitializers(_init4, 15, this);
3245
+ __publicField(this, "removedSymbolIds", __runInitializers(_init4, 16, this, new StableKeyMap())), __runInitializers(_init4, 19, this);
3246
+ __publicField(this, "referenceGraph", __runInitializers(_init4, 20, this)), __runInitializers(_init4, 23, this);
3247
+ __publicField(this, "reflectionChildren", __runInitializers(_init4, 24, this, new DefaultMap(() => []))), __runInitializers(_init4, 27, this);
3248
+ __publicField(this, "reflections", __runInitializers(_init4, 28, this, {})), __runInitializers(_init4, 31, this);
3249
+ /**
3250
+ * The name of the package that this reflection documents according to package.json.
3251
+ */
3252
+ __publicField(this, "packageName");
3253
+ /**
3254
+ * The version of the package that this reflection documents according to package.json.
3255
+ */
3256
+ __publicField(this, "packageVersion");
3257
+ /**
3258
+ * The contents of the readme.md file of the project when found.
3259
+ */
3260
+ __publicField(this, "readme");
3261
+ /**
3262
+ * Object which describes where to find content for relative links.
3263
+ */
3264
+ __publicField(this, "files");
3265
+ this.reflections[this.id] = this;
3266
+ this.files = registry;
3267
+ }
3268
+ /**
3269
+ * Return whether this reflection is the root / project reflection.
3270
+ */
3271
+ isProject() {
3272
+ return true;
3273
+ }
3274
+ /**
3275
+ * Return a list of all reflections in this project of a certain kind.
3276
+ *
3277
+ * @param kind The desired kind of reflection.
3278
+ * @returns An array containing all reflections with the desired kind.
3279
+ */
3280
+ getReflectionsByKind(kind) {
3281
+ return Object.values(this.reflections).filter((reflection) => reflection.kindOf(kind));
3282
+ }
3283
+ /**
3284
+ * Registers the given reflection so that it can be quickly looked up by helper methods.
3285
+ * Should be called for *every* reflection added to the project.
3286
+ *
3287
+ * Note: During conversion, `Context.registerReflection` should be used instead so
3288
+ * that symbols can be saved for later use.
3289
+ */
3290
+ registerReflection(reflection, id, filePath) {
3291
+ this.referenceGraph = void 0;
3292
+ if (reflection.parent) {
3293
+ this.reflectionChildren.get(reflection.parent.id).push(reflection.id);
3294
+ }
3295
+ this.reflections[reflection.id] = reflection;
3296
+ if (id) {
3297
+ this.registerSymbolId(reflection, id);
3298
+ }
3299
+ if (filePath) {
3300
+ this.files.registerReflection(filePath, reflection);
3301
+ }
3302
+ }
3303
+ /**
3304
+ * Removes references to reflections contained within the provided type.
3305
+ * Plugins which overwrite types on reflections should pass the type to this
3306
+ * method before overwriting the property.
3307
+ * @since 0.26.6
3308
+ */
3309
+ removeTypeReflections(type) {
3310
+ type?.visit(
3311
+ makeRecursiveVisitor({
3312
+ reflection: (type2) => {
3313
+ this.removeReflection(type2.declaration);
3314
+ }
3315
+ })
3316
+ );
3317
+ }
3318
+ /**
3319
+ * Removes a reflection from the documentation. Can be used by plugins to filter reflections
3320
+ * out of the generated documentation. Has no effect if the reflection is not present in the
3321
+ * project.
3322
+ */
3323
+ removeReflection(reflection) {
3324
+ this._removeReflection(reflection);
3325
+ const parent = reflection.parent;
3326
+ parent?.traverse((child, property) => {
3327
+ if (child !== reflection) {
3328
+ return true;
3329
+ }
3330
+ switch (property) {
3331
+ case 0 /* Children */:
3332
+ case 1 /* Documents */:
3333
+ parent.removeChild(
3334
+ reflection
3335
+ );
3336
+ break;
3337
+ case 7 /* GetSignature */:
3338
+ delete parent.getSignature;
3339
+ break;
3340
+ case 6 /* IndexSignature */:
3341
+ removeIfPresent2(
3342
+ parent.indexSignatures,
3343
+ reflection
3344
+ );
3345
+ if (!parent.indexSignatures?.length) {
3346
+ delete parent.indexSignatures;
3347
+ }
3348
+ break;
3349
+ case 2 /* Parameters */:
3350
+ removeIfPresent2(
3351
+ reflection.parent.parameters,
3352
+ reflection
3353
+ );
3354
+ if (!reflection.parent.parameters?.length) {
3355
+ delete reflection.parent.parameters;
3356
+ }
3357
+ break;
3358
+ case 8 /* SetSignature */:
3359
+ delete parent.setSignature;
3360
+ break;
3361
+ case 5 /* Signatures */:
3362
+ removeIfPresent2(
3363
+ parent.signatures,
3364
+ reflection
3365
+ );
3366
+ if (!parent.signatures?.length) {
3367
+ delete parent.signatures;
3368
+ }
3369
+ break;
3370
+ case 3 /* TypeLiteral */:
3371
+ parent.type = new IntrinsicType("Object");
3372
+ break;
3373
+ case 4 /* TypeParameter */:
3374
+ removeIfPresent2(
3375
+ parent.typeParameters,
3376
+ reflection
3377
+ );
3378
+ if (!parent.typeParameters?.length) {
3379
+ delete parent.typeParameters;
3380
+ }
3381
+ break;
3382
+ default:
3383
+ assertNever3(property);
3384
+ }
3385
+ return false;
3386
+ });
3387
+ }
3388
+ /** @internal */
3389
+ mergeReflections(source, target) {
3390
+ delete this.referenceGraph;
3391
+ const oldChildrenIds = this.reflectionChildren.getNoInsert(source.id) || [];
3392
+ const newChildren = this.reflectionChildren.get(target.id);
3393
+ for (const childId of oldChildrenIds) {
3394
+ const childRefl = this.getReflectionById(childId);
3395
+ if (childRefl?.parent === source) {
3396
+ childRefl.parent = target;
3397
+ newChildren.push(childId);
3398
+ target.addChild(childRefl);
3399
+ }
3400
+ }
3401
+ this.reflectionChildren.delete(source.id);
3402
+ this.removeReflection(source);
3403
+ delete target.groups;
3404
+ delete target.categories;
3405
+ }
3406
+ /**
3407
+ * Remove a reflection without updating the parent reflection to remove references to the removed reflection.
3408
+ */
3409
+ _removeReflection(reflection) {
3410
+ this.files.removeReflection(reflection);
3411
+ const graph = this.getReferenceGraph();
3412
+ for (const id of graph.get(reflection.id) ?? []) {
3413
+ const ref = this.getReflectionById(id);
3414
+ if (ref) {
3415
+ this.removeReflection(ref);
3416
+ }
3417
+ }
3418
+ graph.delete(reflection.id);
3419
+ for (const childId of this.reflectionChildren.getNoInsert(
3420
+ reflection.id
3421
+ ) || []) {
3422
+ const child = this.getReflectionById(childId);
3423
+ if (child?.parent === reflection) {
3424
+ this._removeReflection(child);
3425
+ }
3426
+ }
3427
+ this.reflectionChildren.delete(reflection.id);
3428
+ const symbolId = this.reflectionIdToSymbolIdMap.get(reflection.id);
3429
+ if (symbolId) {
3430
+ const saved = this.symbolToReflectionIdMap.get(symbolId);
3431
+ if (saved === reflection.id) {
3432
+ this.symbolToReflectionIdMap.delete(symbolId);
3433
+ this.removedSymbolIds.set(symbolId, true);
3434
+ } else if (typeof saved === "object") {
3435
+ removeIfPresent2(saved, reflection.id);
3436
+ if (saved.length === 0) {
3437
+ this.removedSymbolIds.set(symbolId, true);
3438
+ }
3439
+ }
3440
+ }
3441
+ this.reflectionIdToSymbolIdMap.delete(reflection.id);
3442
+ delete this.reflections[reflection.id];
3443
+ }
3444
+ /**
3445
+ * Gets the reflection registered for the given reflection ID, or undefined if it is not present
3446
+ * in the project.
3447
+ */
3448
+ getReflectionById(id) {
3449
+ return this.reflections[id];
3450
+ }
3451
+ /**
3452
+ * Gets the reflection associated with the given symbol id, if it exists.
3453
+ * If there are multiple reflections associated with this symbol, gets the first one.
3454
+ * @internal
3455
+ */
3456
+ getReflectionFromSymbolId(symbolId) {
3457
+ return this.getReflectionsFromSymbolId(symbolId)[0];
3458
+ }
3459
+ /** @internal */
3460
+ getReflectionsFromSymbolId(symbolId) {
3461
+ const id = this.symbolToReflectionIdMap.get(symbolId);
3462
+ if (typeof id === "number") {
3463
+ return [this.getReflectionById(id)];
3464
+ } else if (typeof id === "object") {
3465
+ return id.map((id2) => this.getReflectionById(id2));
3466
+ }
3467
+ return [];
3468
+ }
3469
+ /** @internal */
3470
+ getSymbolIdFromReflection(reflection) {
3471
+ return this.reflectionIdToSymbolIdMap.get(reflection.id);
3472
+ }
3473
+ /** @internal */
3474
+ registerSymbolId(reflection, id) {
3475
+ this.removedSymbolIds.delete(id);
3476
+ this.reflectionIdToSymbolIdMap.set(reflection.id, id);
3477
+ const previous = this.symbolToReflectionIdMap.get(id);
3478
+ if (typeof previous !== "undefined") {
3479
+ if (typeof previous === "number") {
3480
+ this.symbolToReflectionIdMap.set(id, [previous, reflection.id]);
3481
+ } else {
3482
+ previous.push(reflection.id);
3483
+ }
3484
+ } else {
3485
+ this.symbolToReflectionIdMap.set(id, reflection.id);
3486
+ }
3487
+ }
3488
+ symbolIdHasBeenRemoved(id) {
3489
+ return this.removedSymbolIds.has(id);
3490
+ }
3491
+ getReferenceGraph() {
3492
+ if (!this.referenceGraph) {
3493
+ this.referenceGraph = /* @__PURE__ */ new Map();
3494
+ for (const id in this.reflections) {
3495
+ const ref = this.reflections[id];
3496
+ if (ref instanceof ReferenceReflection) {
3497
+ const target = ref.tryGetTargetReflection();
3498
+ if (target) {
3499
+ const refs = this.referenceGraph.get(target.id) ?? [];
3500
+ refs.push(ref.id);
3501
+ this.referenceGraph.set(target.id, refs);
3502
+ }
3503
+ }
3504
+ }
3505
+ }
3506
+ return this.referenceGraph;
3507
+ }
3508
+ toObject(serializer) {
3509
+ const symbolIdMap = {};
3510
+ this.reflectionIdToSymbolIdMap.forEach((sid, id) => {
3511
+ symbolIdMap[id] = sid.toObject();
3512
+ });
3513
+ return {
3514
+ schemaVersion: JSON_SCHEMA_VERSION,
3515
+ ...super.toObject(serializer),
3516
+ variant: this.variant,
3517
+ packageName: this.packageName,
3518
+ packageVersion: this.packageVersion,
3519
+ readme: Comment.serializeDisplayParts(this.readme),
3520
+ symbolIdMap,
3521
+ files: serializer.toObject(this.files)
3522
+ };
3523
+ }
3524
+ fromObject(de, obj) {
3525
+ super.fromObject(de, obj);
3526
+ this.packageName = obj.packageName;
3527
+ this.packageVersion = obj.packageVersion;
3528
+ if (obj.readme) {
3529
+ this.readme = Comment.deserializeDisplayParts(de, obj.readme);
3530
+ }
3531
+ this.files.fromObject(de, obj.files || {});
3532
+ de.defer(() => {
3533
+ for (const [id, sid] of Object.entries(obj.symbolIdMap || {})) {
3534
+ const refl = this.getReflectionById(de.oldIdToNewId[+id] ?? -1);
3535
+ if (refl) {
3536
+ this.registerSymbolId(refl, new ReflectionSymbolId(sid));
3537
+ } else {
3538
+ de.logger.warn(i18n6.serialized_project_referenced_0_not_part_of_project(id));
3539
+ }
3540
+ }
3541
+ });
3542
+ }
3543
+ };
3544
+ _init4 = __decoratorStart(_a2);
3545
+ __decorateElement(_init4, 5, "symbolToReflectionIdMap", _symbolToReflectionIdMap_dec, ProjectReflection);
3546
+ __decorateElement(_init4, 5, "reflectionIdToSymbolIdMap", _reflectionIdToSymbolIdMap_dec, ProjectReflection);
3547
+ __decorateElement(_init4, 5, "removedSymbolIds", _removedSymbolIds_dec, ProjectReflection);
3548
+ __decorateElement(_init4, 5, "referenceGraph", _referenceGraph_dec, ProjectReflection);
3549
+ __decorateElement(_init4, 5, "reflectionChildren", _reflectionChildren_dec, ProjectReflection);
3550
+ __decorateElement(_init4, 5, "reflections", _reflections_dec, ProjectReflection);
3551
+ __decoratorMetadata(_init4, ProjectReflection);
3552
+
3553
+ // src/lib/models/SignatureReflection.ts
3554
+ var SignatureReflection = class extends Reflection {
3555
+ variant = "signature";
3556
+ // ESLint is wrong, we're restricting types to be more narrow.
3557
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3558
+ constructor(name, kind, parent) {
3559
+ super(name, kind, parent);
3560
+ }
3561
+ /**
3562
+ * A list of all source files that contributed to this reflection.
3563
+ */
3564
+ sources;
3565
+ parameters;
3566
+ typeParameters;
3567
+ type;
3568
+ /**
3569
+ * A type that points to the reflection that has been overwritten by this reflection.
3570
+ *
3571
+ * Applies to interface and class members.
3572
+ */
3573
+ overwrites;
3574
+ /**
3575
+ * A type that points to the reflection this reflection has been inherited from.
3576
+ *
3577
+ * Applies to interface and class members.
3578
+ */
3579
+ inheritedFrom;
3580
+ /**
3581
+ * A type that points to the reflection this reflection is the implementation of.
3582
+ *
3583
+ * Applies to class members.
3584
+ */
3585
+ implementationOf;
3586
+ traverse(callback) {
3587
+ if (this.type instanceof ReflectionType) {
3588
+ if (callback(
3589
+ this.type.declaration,
3590
+ 3 /* TypeLiteral */
3591
+ ) === false) {
3592
+ return;
3593
+ }
3594
+ }
3595
+ for (const parameter of this.typeParameters?.slice() || []) {
3596
+ if (callback(parameter, 4 /* TypeParameter */) === false) {
3597
+ return;
3598
+ }
3599
+ }
3600
+ for (const parameter of this.parameters?.slice() || []) {
3601
+ if (callback(parameter, 2 /* Parameters */) === false) {
3602
+ return;
3603
+ }
3604
+ }
3605
+ }
3606
+ isSignature() {
3607
+ return true;
3608
+ }
3609
+ /**
3610
+ * Return a string representation of this reflection.
3611
+ */
3612
+ toString() {
3613
+ let result = super.toString();
3614
+ if (this.typeParameters) {
3615
+ const parameters = this.typeParameters.map(
3616
+ (parameter) => parameter.name
3617
+ );
3618
+ result += "<" + parameters.join(", ") + ">";
3619
+ }
3620
+ if (this.type) {
3621
+ result += ": " + this.type.toString();
3622
+ }
3623
+ return result;
3624
+ }
3625
+ toObject(serializer) {
3626
+ return {
3627
+ ...super.toObject(serializer),
3628
+ variant: this.variant,
3629
+ sources: serializer.toObjectsOptional(this.sources),
3630
+ typeParameters: serializer.toObjectsOptional(this.typeParameters),
3631
+ parameters: serializer.toObjectsOptional(this.parameters),
3632
+ type: serializer.toObject(this.type),
3633
+ overwrites: serializer.toObject(this.overwrites),
3634
+ inheritedFrom: serializer.toObject(this.inheritedFrom),
3635
+ implementationOf: serializer.toObject(this.implementationOf)
3636
+ };
3637
+ }
3638
+ fromObject(de, obj) {
3639
+ super.fromObject(de, obj);
3640
+ this.sources = de.reviveMany(
3641
+ obj.sources,
3642
+ (t) => new SourceReference(t.fileName, t.line, t.character)
3643
+ );
3644
+ this.typeParameters = de.reviveMany(obj.typeParameters, (t) => de.constructReflection(t));
3645
+ this.parameters = de.reviveMany(obj.parameters, (t) => de.constructReflection(t));
3646
+ this.type = de.reviveType(obj.type);
3647
+ this.overwrites = de.reviveType(obj.overwrites);
3648
+ this.inheritedFrom = de.reviveType(obj.inheritedFrom);
3649
+ this.implementationOf = de.reviveType(obj.implementationOf);
3650
+ }
3651
+ };
3652
+
3653
+ // src/lib/models/TypeParameterReflection.ts
3654
+ var VarianceModifier = {
3655
+ in: "in",
3656
+ out: "out",
3657
+ inOut: "in out"
3658
+ };
3659
+ var TypeParameterReflection = class extends Reflection {
3660
+ variant = "typeParam";
3661
+ type;
3662
+ default;
3663
+ varianceModifier;
3664
+ constructor(name, parent, varianceModifier) {
3665
+ super(name, 131072 /* TypeParameter */, parent);
3666
+ this.varianceModifier = varianceModifier;
3667
+ }
3668
+ isTypeParameter() {
3669
+ return true;
3670
+ }
3671
+ toObject(serializer) {
3672
+ return {
3673
+ ...super.toObject(serializer),
3674
+ variant: this.variant,
3675
+ type: serializer.toObject(this.type),
3676
+ default: serializer.toObject(this.default),
3677
+ varianceModifier: this.varianceModifier
3678
+ };
3679
+ }
3680
+ fromObject(de, obj) {
3681
+ super.fromObject(de, obj);
3682
+ this.type = de.reviveType(obj.type);
3683
+ this.default = de.reviveType(obj.default);
3684
+ this.varianceModifier = obj.varianceModifier;
3685
+ }
3686
+ traverse(_callback) {
3687
+ }
3688
+ };
3689
+ export {
3690
+ ArrayType,
3691
+ Comment,
3692
+ CommentTag,
3693
+ ConditionalType,
3694
+ ContainerReflection,
3695
+ DeclarationReflection,
3696
+ DocumentReflection,
3697
+ FileRegistry,
3698
+ IndexedAccessType,
3699
+ InferredType,
3700
+ IntersectionType,
3701
+ IntrinsicType,
3702
+ LiteralType,
3703
+ MappedType,
3704
+ NamedTupleMember,
3705
+ OptionalType,
3706
+ ParameterReflection,
3707
+ PredicateType,
3708
+ ProjectReflection,
3709
+ QueryType,
3710
+ ReferenceReflection,
3711
+ ReferenceType,
3712
+ Reflection,
3713
+ ReflectionCategory,
3714
+ ReflectionFlag,
3715
+ ReflectionFlags,
3716
+ ReflectionGroup,
3717
+ ReflectionKind,
3718
+ ReflectionSymbolId,
3719
+ ReflectionType,
3720
+ RestType,
3721
+ SignatureReflection,
3722
+ SourceReference,
3723
+ TemplateLiteralType,
3724
+ TraverseProperty,
3725
+ TupleType,
3726
+ Type,
3727
+ TypeContext,
3728
+ TypeOperatorType,
3729
+ TypeParameterReflection,
3730
+ UnionType,
3731
+ UnknownType,
3732
+ VarianceModifier,
3733
+ makeRecursiveVisitor,
3734
+ resetReflectionID,
3735
+ splitUnquotedString
3736
+ };