@redocly/framework 1.0.0-next.12 → 1.0.0-next.14

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 (244) hide show
  1. package/README.md +0 -1
  2. package/dist/bundler/build/dependency-pack.js +1 -1
  3. package/dist/bundler/build/output-metadata.js +1 -1
  4. package/dist/bundler/build/run.js +1 -1
  5. package/dist/bundler/build/theme-global-stylesheets.js +1 -1
  6. package/dist/bundler/build/vite-config.js +2 -2
  7. package/dist/bundler/dev/dev-content-build.js +1 -1
  8. package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
  9. package/dist/bundler/dev/routes/source-sync-route.js +1 -1
  10. package/dist/bundler/dev/run.js +1 -1
  11. package/dist/bundler/dev/runtime-app.js +1 -1
  12. package/dist/bundler/dev/vite-chunk-url.js +1 -1
  13. package/dist/bundler/user-markdoc-schema.js +1 -1
  14. package/dist/bundler/vite-config.base.js +5 -5
  15. package/dist/cli/api-docs-build-event.js +1 -1
  16. package/dist/cli/args.js +1 -1
  17. package/dist/cli/commands/build.js +1 -1
  18. package/dist/cli/commands/dev.js +1 -1
  19. package/dist/cli/commands/ingest.js +1 -1
  20. package/dist/cli/commands/translate.js +1 -1
  21. package/dist/cli/problems-output.js +3 -3
  22. package/dist/cli/validate-react-pages.js +1 -1
  23. package/dist/client/UnversionedVersionButton.js +1 -1
  24. package/dist/client/VersionPicker.js +343 -0
  25. package/dist/client/ai-search/use-ai-search.js +1 -1
  26. package/dist/client/analytics-page-view.js +1 -1
  27. package/dist/client/app.js +2 -2
  28. package/dist/client/classic-webview-sync.js +1 -1
  29. package/dist/client/client-entry.js +1 -1
  30. package/dist/client/contexts.js +1 -1
  31. package/dist/client/feedback.js +1 -1
  32. package/dist/client/history-mount.js +6 -5
  33. package/dist/client/l10n/ssr-l10n.js +1 -1
  34. package/dist/client/l10n/use-l10n-config.js +1 -1
  35. package/dist/client/products.js +1 -1
  36. package/dist/client/review/ReviewBar.js +31 -31
  37. package/dist/client/review/login-url.js +1 -1
  38. package/dist/client/review/use-review.js +1 -1
  39. package/dist/client/revisions-history.js +1 -1
  40. package/dist/client/sidebar/SidebarDataProvider.js +1 -1
  41. package/dist/client/sidebar/drilldown.js +1 -1
  42. package/dist/client/ssr.js +1 -1
  43. package/dist/client/telemetry/config.js +1 -1
  44. package/dist/client/theme-logo.js +1 -1
  45. package/dist/client/use-entity-revisions.js +1 -1
  46. package/dist/client/use-page-versions.js +1 -1
  47. package/dist/client/use-search.js +1 -1
  48. package/dist/client/webmcp/tools/shared.js +1 -1
  49. package/dist/client/webmcp/tools/site-tools.js +1 -1
  50. package/dist/client/webmcp/use-webmcp-tools.js +1 -1
  51. package/dist/content-layer/config-schema.js +1 -1
  52. package/dist/content-layer/config.d.ts +8 -0
  53. package/dist/content-layer/config.js +1 -1
  54. package/dist/content-layer/context-state.js +1 -1
  55. package/dist/content-layer/context.d.ts +6 -0
  56. package/dist/content-layer/context.js +1 -1
  57. package/dist/content-layer/database/assets.js +1 -1
  58. package/dist/content-layer/database/blobs.js +1 -1
  59. package/dist/content-layer/database/entities.d.ts +2 -0
  60. package/dist/content-layer/database/entities.js +1 -1
  61. package/dist/content-layer/database/entity-store.js +1 -1
  62. package/dist/content-layer/database/files.js +1 -1
  63. package/dist/content-layer/database/finalize.js +1 -1
  64. package/dist/content-layer/database/invalidation.js +26 -26
  65. package/dist/content-layer/database/link-refs.js +1 -1
  66. package/dist/content-layer/database/origins.d.ts +2 -1
  67. package/dist/content-layer/database/origins.js +1 -1
  68. package/dist/content-layer/database/problems.js +1 -1
  69. package/dist/content-layer/database/reset.js +1 -1
  70. package/dist/content-layer/database/route-query-deps.d.ts +19 -3
  71. package/dist/content-layer/database/route-query-deps.js +1 -1
  72. package/dist/content-layer/database/search-vocab.js +2 -2
  73. package/dist/content-layer/database/static-files.js +1 -1
  74. package/dist/content-layer/ingest/extract-all-phase.js +1 -1
  75. package/dist/content-layer/ingest/finalize-phase.js +1 -1
  76. package/dist/content-layer/ingest/git-last-modified.d.ts +20 -0
  77. package/dist/content-layer/ingest/git-last-modified.js +5 -4
  78. package/dist/content-layer/ingest/hash.js +1 -1
  79. package/dist/content-layer/ingest/hook-inputs.js +1 -1
  80. package/dist/content-layer/ingest/l10n-warnings.js +1 -1
  81. package/dist/content-layer/ingest/markdoc-schema-problem.js +1 -1
  82. package/dist/content-layer/ingest/normalize-artifacts.js +1 -1
  83. package/dist/content-layer/ingest/run.js +1 -1
  84. package/dist/content-layer/ingest/scan.js +1 -1
  85. package/dist/content-layer/ingest/search-sync.js +1 -1
  86. package/dist/content-layer/ingest/sync.js +1 -1
  87. package/dist/content-layer/link-checker/config-links.js +1 -1
  88. package/dist/content-layer/link-checker/delta.js +1 -1
  89. package/dist/content-layer/link-checker/fingerprint.js +1 -1
  90. package/dist/content-layer/link-checker/load-view.js +1 -1
  91. package/dist/content-layer/link-checker/node-ref.js +1 -1
  92. package/dist/content-layer/link-checker/run-build.js +1 -1
  93. package/dist/content-layer/link-checker/validate.js +1 -1
  94. package/dist/content-layer/loaders/context.js +1 -1
  95. package/dist/content-layer/markdown/client/JsonSchemaTag.js +1 -1
  96. package/dist/content-layer/markdown/client/markdown-text.js +1 -1
  97. package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
  98. package/dist/content-layer/markdown/nodes/fence.js +1 -1
  99. package/dist/content-layer/markdown/nodes/heading.js +1 -1
  100. package/dist/content-layer/markdown/nodes/table.js +1 -1
  101. package/dist/content-layer/markdown/resolve/ast.d.ts +2 -0
  102. package/dist/content-layer/markdown/resolve/ast.js +1 -1
  103. package/dist/content-layer/markdown/resolve/markdoc-resolvers/file-reference.js +1 -1
  104. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
  105. package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
  106. package/dist/content-layer/markdown/resolve/markdoc-resolvers/svg-content.js +1 -1
  107. package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
  108. package/dist/content-layer/markdown/resolve/references.js +1 -1
  109. package/dist/content-layer/markdown/search/to-markdown.js +3 -3
  110. package/dist/content-layer/markdown/search/to-sections.js +1 -1
  111. package/dist/content-layer/markdown/search/to-text.js +5 -5
  112. package/dist/content-layer/markdown/server/render.js +1 -1
  113. package/dist/content-layer/markdown/service.js +1 -1
  114. package/dist/content-layer/markdown/tags/variant.js +1 -1
  115. package/dist/content-layer/markdown/utils/collect-anchors.js +1 -1
  116. package/dist/content-layer/markdown/utils/first-heading.js +1 -1
  117. package/dist/content-layer/markdown/utils/parse-cache.d.ts +5 -1
  118. package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
  119. package/dist/content-layer/materialization/asset-reconcile.js +1 -1
  120. package/dist/content-layer/materialization/entity.js +1 -1
  121. package/dist/content-layer/materialization/materializer.js +1 -1
  122. package/dist/content-layer/materialization/static-files.js +1 -1
  123. package/dist/content-layer/plugins/execute.js +1 -1
  124. package/dist/content-layer/plugins/index.js +1 -1
  125. package/dist/content-layer/plugins/internal/api-docs/client/template.js +2 -2
  126. package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
  127. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.d.ts +4 -1
  128. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
  129. package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.js +12 -10
  130. package/dist/content-layer/plugins/internal/api-docs/server/options.d.ts +1 -1
  131. package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
  132. package/dist/content-layer/plugins/internal/api-docs/server/search-documents.js +1 -1
  133. package/dist/content-layer/plugins/internal/api-docs/server/spec-download.js +1 -1
  134. package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
  135. package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
  136. package/dist/content-layer/plugins/internal/app-data/logo.js +1 -1
  137. package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
  138. package/dist/content-layer/plugins/internal/assets/index.js +1 -1
  139. package/dist/content-layer/plugins/internal/catalog-classic/client/use-catalog-classic.js +1 -1
  140. package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
  141. package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.js +1 -1
  142. package/dist/content-layer/plugins/internal/index.js +1 -1
  143. package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
  144. package/dist/content-layer/plugins/internal/l10n/translations-loader.js +1 -1
  145. package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
  146. package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
  147. package/dist/content-layer/plugins/internal/mcp/app-data.js +1 -1
  148. package/dist/content-layer/plugins/internal/mcp/constants.d.ts +4 -3
  149. package/dist/content-layer/plugins/internal/mcp/constants.js +1 -1
  150. package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
  151. package/dist/content-layer/plugins/internal/mcp/ignored-routes.js +1 -1
  152. package/dist/content-layer/plugins/internal/mcp/index.js +1 -1
  153. package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
  154. package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
  155. package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
  156. package/dist/content-layer/plugins/internal/mcp/server/codemode/constants.js +1 -1
  157. package/dist/content-layer/plugins/internal/mcp/server/codemode/execute-schema.js +1 -1
  158. package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
  159. package/dist/content-layer/plugins/internal/mcp/server/config-gate.js +1 -1
  160. package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
  161. package/dist/content-layer/plugins/internal/mcp/server/gateway/call-api.js +2 -2
  162. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-handler.js +1 -1
  163. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +1 -1
  164. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/site-branding.js +1 -1
  165. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
  166. package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +6 -6
  167. package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
  168. package/dist/content-layer/plugins/internal/mcp/server/gateway/subject.js +1 -1
  169. package/dist/content-layer/plugins/internal/mcp/server/gateway/tool-list.js +1 -1
  170. package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
  171. package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
  172. package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
  173. package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
  174. package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
  175. package/dist/content-layer/plugins/internal/mcp/server/oauth/callback.js +1 -1
  176. package/dist/content-layer/plugins/internal/mcp/server/oauth/client-metadata.js +1 -1
  177. package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
  178. package/dist/content-layer/plugins/internal/mcp/server/oauth/register.js +1 -1
  179. package/dist/content-layer/plugins/internal/mcp/server/oauth/token.js +1 -1
  180. package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
  181. package/dist/content-layer/plugins/internal/mcp/server/server-info.js +1 -1
  182. package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
  183. package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
  184. package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +2 -2
  185. package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -1
  186. package/dist/content-layer/plugins/internal/mcp/server/tools/search.js +2 -2
  187. package/dist/content-layer/plugins/internal/mcp/server/workflows/resolve-workflows.js +1 -1
  188. package/dist/content-layer/plugins/internal/mcp/server/workflows/schemas.js +2 -1
  189. package/dist/content-layer/plugins/internal/mcp/server/workflows/tools.js +1 -1
  190. package/dist/content-layer/plugins/internal/mcp/setup-page.js +1 -1
  191. package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
  192. package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
  193. package/dist/content-layer/plugins/internal/scorecard-classic/client/template.js +1 -1
  194. package/dist/content-layer/plugins/internal/scorecard-classic/index.js +1 -1
  195. package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
  196. package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
  197. package/dist/content-layer/plugins/internal/skills/index.js +1 -1
  198. package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
  199. package/dist/content-layer/plugins/io.js +1 -1
  200. package/dist/content-layer/plugins/project/load.js +2 -2
  201. package/dist/content-layer/plugins/source-file.js +1 -1
  202. package/dist/content-layer/plugins/utils/link-access.js +1 -1
  203. package/dist/content-layer/plugins/utils/route-index.js +1 -1
  204. package/dist/content-layer/revisions/delete.js +1 -1
  205. package/dist/content-layer/revisions/read.js +1 -1
  206. package/dist/content-layer/search/engine/core/search-engine.js +1 -1
  207. package/dist/content-layer/search/postings/postings-store.js +1 -1
  208. package/dist/content-layer/server/database.js +1 -1
  209. package/dist/content-layer/static/registry.js +1 -1
  210. package/dist/content-layer/templates/template-set.js +1 -1
  211. package/dist/content-layer/versions/redirect.js +1 -1
  212. package/dist/content-layer/versions/resolve.js +1 -1
  213. package/dist/server/app.js +3 -3
  214. package/dist/server/ask-ai/feature-gate.js +1 -1
  215. package/dist/server/ask-ai/route.js +1 -1
  216. package/dist/server/auth/middleware.js +1 -1
  217. package/dist/server/auth/request.js +1 -1
  218. package/dist/server/auth/routes.js +1 -1
  219. package/dist/server/content.js +12 -12
  220. package/dist/server/cors-proxy/handler.js +1 -1
  221. package/dist/server/feedback/route.js +1 -1
  222. package/dist/server/lambda-entry.js +1 -1
  223. package/dist/server/manifest-assets.js +4 -4
  224. package/dist/server/node-entry.js +1 -1
  225. package/dist/server/page-handlers.js +2 -2
  226. package/dist/server/plugin-context.js +1 -1
  227. package/dist/server/rbac/content-asset-access.js +1 -1
  228. package/dist/server/runtime-config.js +1 -1
  229. package/dist/server/search/route.js +1 -1
  230. package/dist/server/seo-tags.js +2 -2
  231. package/dist/server/sitemap.js +1 -1
  232. package/dist/server/static-files/serve.js +1 -1
  233. package/dist/server/subprocess/child-entry.js +1 -1
  234. package/dist/server/subprocess/host.js +1 -1
  235. package/dist/server/template-ids.js +1 -1
  236. package/dist/shared/constants/system-routes.js +1 -1
  237. package/dist/shared/rbac/engine.js +0 -0
  238. package/dist/shared/rbac/l10n-rules.js +1 -1
  239. package/dist/shared/rbac/route-scope.js +1 -1
  240. package/dist/shared/rbac/team-templates.js +1 -1
  241. package/dist/shared/types/config.d.ts +2 -1
  242. package/dist/shared/utils/l10n.js +1 -1
  243. package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
  244. package/package.json +4 -5
@@ -1 +1 @@
1
- import{EXAMPLE_CONTENT_ATTRIBUTE as e}from"@redocly/theme/core/constants";import t from"@redocly/markdoc";const n=/* @__PURE__ */ new Set([`mermaid`,`excalidraw`,`plantuml`]),r={...t.nodes.fence,attributes:{...t.nodes.fence.attributes,label:{type:String,render:`data-label`},title:{type:String,render:`data-title`},highlight:{type:String,render:`data-highlight`},align:{type:String,matches:[`left`,`center`,`right`]},width:{type:String},[e]:{type:Object,render:!1}},transform(e,r){let i=e.transformAttributes(r),a=e.transformChildren(r),o=i[`data-language`],s=i[`data-title`];if(e.attributes.process===!1&&(a=[e.attributes.content]),typeof a[0]!=`string`)return new t.Tag(e.tag,i,a);if(typeof o==`string`&&n.has(o)){let{diagramHtml:n,diagramHtmlDark:r,diagramError:s}=e.attributes;if(typeof n==`string`||typeof s==`string`)return new t.Tag(`Diagram`,{...i,diagramType:o,diagramSource:a[0],diagramHtml:n,diagramHtmlDark:r,diagramError:s},[])}let c=a.map(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e.toString():t.Tag.isTag(e)?String(e.attributes?.rawtag??``):``).join(``);return new t.Tag(`CodeBlock`,{...i,header:{title:s,controls:{copy:{}}},source:c,lang:o},[])}};export{n as DIAGRAM_LANGUAGES,r as fence};
1
+ import e from"@redocly/markdoc";import{EXAMPLE_CONTENT_ATTRIBUTE as t}from"@redocly/theme/core/constants";const n=/* @__PURE__ */ new Set([`mermaid`,`excalidraw`,`plantuml`]),r={...e.nodes.fence,attributes:{...e.nodes.fence.attributes,label:{type:String,render:`data-label`},title:{type:String,render:`data-title`},highlight:{type:String,render:`data-highlight`},align:{type:String,matches:[`left`,`center`,`right`]},width:{type:String},[t]:{type:Object,render:!1}},transform(t,r){let i=t.transformAttributes(r),a=t.transformChildren(r),o=i[`data-language`],s=i[`data-title`];if(t.attributes.process===!1&&(a=[t.attributes.content]),typeof a[0]!=`string`)return new e.Tag(t.tag,i,a);if(typeof o==`string`&&n.has(o)){let{diagramHtml:n,diagramHtmlDark:r,diagramError:s}=t.attributes;if(typeof n==`string`||typeof s==`string`)return new e.Tag(`Diagram`,{...i,diagramType:o,diagramSource:a[0],diagramHtml:n,diagramHtmlDark:r,diagramError:s},[])}let c=a.map(t=>typeof t==`string`||typeof t==`number`||typeof t==`boolean`?t.toString():e.Tag.isTag(t)?String(t.attributes?.rawtag??``):``).join(``);return new e.Tag(`CodeBlock`,{...i,header:{title:s,controls:{copy:{}}},source:c,lang:o},[])}};export{n as DIAGRAM_LANGUAGES,r as fence};
@@ -1 +1 @@
1
- import{getInnerText as e}from"../utils/get-inner-text.js";import{headingSlugger as t}from"../utils/heading-slugger.js";import n from"@redocly/markdoc";const r={children:[`inline`],attributes:{id:{type:String},level:{type:Number,required:!0,default:1}},transform(r,i){let a=r.transformAttributes(i),o=r.transformChildren(i),s=typeof a.id==`string`?t.explicit(a.id):t.slug(e(o));return new n.Tag(`Heading`,{...a,id:s,level:r.attributes.level},o)}};export{r as heading};
1
+ import{headingSlugger as e}from"../utils/heading-slugger.js";import{getInnerText as t}from"../utils/get-inner-text.js";import n from"@redocly/markdoc";const r={children:[`inline`],attributes:{id:{type:String},level:{type:Number,required:!0,default:1}},transform(r,i){let a=r.transformAttributes(i),o=r.transformChildren(i),s=typeof a.id==`string`?e.explicit(a.id):e.slug(t(o));return new n.Tag(`Heading`,{...a,id:s,level:r.attributes.level},o)}};export{r as heading};
@@ -1 +1 @@
1
- import{MARKDOWN_CLASS_NAME as e}from"@redocly/theme/core/constants";import t from"@redocly/markdoc";const n={transform(n,r){let{class:i,...a}=n.transformAttributes(r),s=n.transformChildren(r);return o(s),new t.Tag(`div`,{className:`md-table-wrapper`},[new t.Tag(`table`,{...a,className:[e,i].filter(Boolean).join(` `)},s)])}},r={type:String,matches:[`top`,`middle`,`bottom`],render:`vAlign`},i={...t.nodes.td,attributes:{...t.nodes.td.attributes,valign:r}},a={...t.nodes.th,attributes:{...t.nodes.th.attributes,valign:r}};function o([e]){if(t.Tag.isTag(e)&&e.name===`thead`){for(let n of e.children)if(t.Tag.isTag(n))for(let e of n.children)t.Tag.isTag(e)&&e.name===`th`&&(e.attributes[`data-label`]=s(e.children))}}function s(e){return e.map(e=>typeof e==`string`||typeof e==`number`?String(e):t.Tag.isTag(e)?s(e.children):``).join(``).trim()}export{n as table,i as td,a as th};
1
+ import e from"@redocly/markdoc";import{MARKDOWN_CLASS_NAME as t}from"@redocly/theme/core/constants";const n={transform(n,r){let{class:i,...a}=n.transformAttributes(r),s=n.transformChildren(r);return o(s),new e.Tag(`div`,{className:`md-table-wrapper`},[new e.Tag(`table`,{...a,className:[t,i].filter(Boolean).join(` `)},s)])}},r={type:String,matches:[`top`,`middle`,`bottom`],render:`vAlign`},i={...e.nodes.td,attributes:{...e.nodes.td.attributes,valign:r}},a={...e.nodes.th,attributes:{...e.nodes.th.attributes,valign:r}};function o([t]){if(e.Tag.isTag(t)&&t.name===`thead`){for(let n of t.children)if(e.Tag.isTag(n))for(let t of n.children)e.Tag.isTag(t)&&t.name===`th`&&(t.attributes[`data-label`]=s(t.children))}}function s(t){return t.map(t=>typeof t==`string`||typeof t==`number`?String(t):e.Tag.isTag(t)?s(t.children):``).join(``).trim()}export{n as table,i as td,a as th};
@@ -1,4 +1,5 @@
1
1
  import { type Config as MarkdocConfig, type Node as MarkdocNode, type Schema as MarkdocSchema } from '@redocly/markdoc';
2
+ import { type MarkdownParseMode } from '../utils/parse-cache.js';
2
3
  import type { AssetUsage } from '../types/asset-usage.js';
3
4
  import type { EntityInvalidationDep } from '../../plugins/types/plugin.js';
4
5
  import type { ProblemDraft } from '../../problems/types.js';
@@ -13,6 +14,7 @@ export type ResolveMarkdownAstContext = {
13
14
  transform?: (ast: MarkdocNode) => ProblemDraft[];
14
15
  /** The schema the parsed AST is validated against; without it, only parse errors are reported. */
15
16
  validation?: MarkdocConfig;
17
+ parseMode?: MarkdownParseMode;
16
18
  };
17
19
  export type ResolveMarkdownAstResult = {
18
20
  /** The resolved AST, compacted for storage: no source locations or `inline` wrapper nodes. */
@@ -1 +1 @@
1
- import{isObject as e}from"../../../shared/utils/is-object.js";import{markdocNodeRange as t}from"../utils/node-source-range.js";import{PARTIAL_L10N_ATTRIBUTE as n}from"../tags/partial.js";import{builtInMarkdocTags as r}from"../constants/builtin-tags.js";import{walkMarkdocAst as i}from"../utils/walk-markdoc-ast.js";import{getExampleContent as a,walkWithExampleContent as o}from"../utils/reparse-example-fences.js";import{parseMarkdownDocument as s}from"../utils/parse-cache.js";import{substituteStaticVariables as c}from"../utils/substitute-variables.js";import{collectMarkdocTagNames as l,isPromptTag as u,resolveMarkdocBuildTimeAttributes as d}from"./markdoc.js";import{inlineRawPartials as f}from"./raw-partials.js";import{renderMarkdocDiagrams as p}from"./render-diagrams.js";import m from"@redocly/markdoc";const h=/* @__PURE__ */ new Set([`parse-error`,`missing-opening`,`missing-closing`,`fence-tag-error`,`no-inline-annotations`]);async function g(e,t,n){let i=await f(e,t,n.resolverContext),a=s(i.source),o=n.validation?x(a,t,v(n.validation)):[],{entityDeps:u,assetUsages:h,linkRefs:g,problems:_}=await d(a,{tags:n.tags??r,sourceFilePath:t,resolverContext:n.resolverContext,source:i.source});n.variables&&c(a,n.variables);let y=await p(a,t,n.resolverContext.logger),b=w(a,t),S=n.transform?.(a)??[];return C(a),{ast:m.compact(a),entityDeps:[...i.entityDeps,...u],assetUsages:h,linkRefs:g,tagList:l(a),problems:[...i.problems,..._,...b,...o,...S,...y]}}const _=/* @__PURE__ */ new WeakMap;function v(e){let t=_.get(e);return t===void 0&&(t=m.prepareConfig({...e,tags:y(e.tags),nodes:y(e.nodes)}),_.set(e,t)),t}function y(e){if(e!==void 0)return Object.fromEntries(Object.entries(e).map(([e,t])=>{let{validate:n}=t;return n===void 0?[e,t]:[e,{...t,validate(e,t){try{return n.call(this,e,t)}catch(t){return[{id:`validate-failed`,level:`error`,message:`The validate() of '${e.tag??e.type}' failed: ${b(t)}`}]}}}]}))}const b=e=>e instanceof Error?e.message:String(e);function x(e,t,n){let r=[e],i=/* @__PURE__ */ new Set,s=[];for(let t of o(e,u)){for(let e of t.errors??[])i.add(e);let e=a(t);e&&r.push(e),u(t)&&s.push({node:t,children:t.children})}for(let e of s)e.node.children=[];try{return r.flatMap(e=>m.validate(e,n)).filter(e=>!i.has(e.error)).map(e=>S(e,t))}catch(e){return[{code:`markdoc/validation-error`,message:`Markdoc validation failed: ${b(e)}`,location:{filePath:t,range:{start:{line:1},end:{line:1}}}}]}finally{for(let e of s)e.node.children=e.children}}function S(e,n){let{level:r,message:i}=e.error,a={code:`markdoc/validation-error`,message:i,location:{filePath:n,range:t(e)??{start:{line:1},end:{line:1}}}};return r!==`error`&&r!==`critical`&&(a.severity=`warning`),a}function C(t){for(let r of i(t)){let t=r.tag===`partial`?r.attributes[n]:void 0;e(t)&&(r.attributes[n]=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,m.compact(t)])))}}function w(e,n){let r=[];for(let i of o(e))for(let e of i.errors){let a=h.has(e.id)?`markdoc/parse-error`:`markdoc/validation-error`;r.push({code:a,message:e.message,location:{filePath:n,range:t(i)??{start:{line:1},end:{line:1}}}})}return r}export{g as resolveMarkdownAst};
1
+ import{isObject as e}from"../../../shared/utils/is-object.js";import{markdocNodeRange as t}from"../utils/node-source-range.js";import{PARTIAL_L10N_ATTRIBUTE as n}from"../tags/partial.js";import{builtInMarkdocTags as r}from"../constants/builtin-tags.js";import{walkMarkdocAst as i}from"../utils/walk-markdoc-ast.js";import{getExampleContent as a,walkWithExampleContent as o}from"../utils/reparse-example-fences.js";import{parseMarkdownDocument as s}from"../utils/parse-cache.js";import{substituteStaticVariables as c}from"../utils/substitute-variables.js";import{collectMarkdocTagNames as l,isPromptTag as u,resolveMarkdocBuildTimeAttributes as d}from"./markdoc.js";import{inlineRawPartials as f}from"./raw-partials.js";import{renderMarkdocDiagrams as p}from"./render-diagrams.js";import m from"@redocly/markdoc";const h=/* @__PURE__ */ new Set([`parse-error`,`missing-opening`,`missing-closing`,`fence-tag-error`,`no-inline-annotations`]);async function g(e,t,n){let i=await f(e,t,n.resolverContext),a=s(i.source,n.parseMode),o=n.validation?x(a,t,v(n.validation)):[],{entityDeps:u,assetUsages:h,linkRefs:g,problems:_}=await d(a,{tags:n.tags??r,sourceFilePath:t,resolverContext:n.resolverContext,source:i.source});n.variables&&c(a,n.variables);let y=await p(a,t,n.resolverContext.logger),b=w(a,t),S=n.transform?.(a)??[];return C(a),{ast:m.compact(a),entityDeps:[...i.entityDeps,...u],assetUsages:h,linkRefs:g,tagList:l(a),problems:[...i.problems,..._,...b,...o,...S,...y]}}const _=/* @__PURE__ */ new WeakMap;function v(e){let t=_.get(e);return t===void 0&&(t=m.prepareConfig({...e,tags:y(e.tags),nodes:y(e.nodes)}),_.set(e,t)),t}function y(e){if(e!==void 0)return Object.fromEntries(Object.entries(e).map(([e,t])=>{let{validate:n}=t;return n===void 0?[e,t]:[e,{...t,validate(e,t){try{return n.call(this,e,t)}catch(t){return[{id:`validate-failed`,level:`error`,message:`The validate() of '${e.tag??e.type}' failed: ${b(t)}`}]}}}]}))}const b=e=>e instanceof Error?e.message:String(e);function x(e,t,n){let r=[e],i=/* @__PURE__ */ new Set,s=[];for(let t of o(e,u)){for(let e of t.errors??[])i.add(e);let e=a(t);e&&r.push(e),u(t)&&s.push({node:t,children:t.children})}for(let e of s)e.node.children=[];try{return r.flatMap(e=>m.validate(e,n)).filter(e=>!i.has(e.error)).map(e=>S(e,t))}catch(e){return[{code:`markdoc/validation-error`,message:`Markdoc validation failed: ${b(e)}`,location:{filePath:t,range:{start:{line:1},end:{line:1}}}}]}finally{for(let e of s)e.node.children=e.children}}function S(e,n){let{level:r,message:i}=e.error,a={code:`markdoc/validation-error`,message:i,location:{filePath:n,range:t(e)??{start:{line:1},end:{line:1}}}};return r!==`error`&&r!==`critical`&&(a.severity=`warning`),a}function C(t){for(let r of i(t)){let t=r.tag===`partial`?r.attributes[n]:void 0;e(t)&&(r.attributes[n]=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,m.compact(t)])))}}function w(e,n){let r=[];for(let i of o(e))for(let e of i.errors){let a=h.has(e.id)?`markdoc/parse-error`:`markdoc/validation-error`;r.push({code:a,message:e.message,location:{filePath:n,range:t(i)??{start:{line:1},end:{line:1}}}})}return r}export{g as resolveMarkdownAst};
@@ -1 +1 @@
1
- import{L10N_DIR as e}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as r}from"../../tags/markdoc-error.js";import{resolveResolverTarget as i}from"./context-paths.js";import a from"js-yaml";function o(e){return l(e,`RawContent`,e=>e)}function s(e){return l(e,`Resolved`,e=>a.load(e))}function c(t){let{node:r,attributeName:a,sourceFilePath:o}=t,s=r.attributes[a];if(typeof s!=`string`||s===``)return null;let c=n(o),l=c!==void 0&&s.startsWith(`/`)&&n(s.slice(1))===void 0?`/${e}/${c}${s}`:s,u=i(t,l)?.contentPath;return u!==void 0&&(r.attributes[a]=u),null}async function l(e,n,a){let o=e.node.attributes[e.attributeName];if(typeof o!=`string`||o===``||e.io===void 0)return null;let s=i(e,o);if(s===null)return null;let c=[{kind:`file`,path:s.contentPath}],l=s;if(!await e.io.exists(s.absolutePath)){let n=t(e.sourceFilePath);if(l=n===void 0?null:i({...e,sourceFilePath:n},o),l!==null&&c.push({kind:`file`,path:l.contentPath}),l===null||!await e.io.exists(l.absolutePath)){let t=`File ${s.contentPath} does not exist`;return r(e.node,t,e.sourceFilePath,c)}}let u=await e.io.readFile(l.absolutePath),d;try{d=a(u)}catch(t){let n=t instanceof Error?t.message:String(t),i=`File ${l.contentPath} is not valid: ${n}`;return r(e.node,i,e.sourceFilePath,c)}return e.node.attributes[`${e.attributeName}${n}`]=d,{entityDeps:c}}export{s as resolveParsedYamlAttribute,o as resolveRawContentAttribute,c as resolveRelativePathAttribute};
1
+ import{markdocErrorResult as e}from"../../tags/markdoc-error.js";import{L10N_DIR as t}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as n,l10nDirOf as r}from"../../../../shared/utils/l10n.js";import{resolveResolverTarget as i}from"./context-paths.js";import a from"js-yaml";function o(e){return l(e,`RawContent`,e=>e)}function s(e){return l(e,`Resolved`,e=>a.load(e))}function c(e){let{node:n,attributeName:a,sourceFilePath:o}=e,s=n.attributes[a];if(typeof s!=`string`||s===``)return null;let c=r(o),l=c!==void 0&&s.startsWith(`/`)&&r(s.slice(1))===void 0?`/${t}/${c}${s}`:s,u=i(e,l)?.contentPath;return u!==void 0&&(n.attributes[a]=u),null}async function l(t,r,a){let o=t.node.attributes[t.attributeName];if(typeof o!=`string`||o===``||t.io===void 0)return null;let s=i(t,o);if(s===null)return null;let c=[{kind:`file`,path:s.contentPath}],l=s;if(!await t.io.exists(s.absolutePath)){let r=n(t.sourceFilePath);if(l=r===void 0?null:i({...t,sourceFilePath:r},o),l!==null&&c.push({kind:`file`,path:l.contentPath}),l===null||!await t.io.exists(l.absolutePath)){let n=`File ${s.contentPath} does not exist`;return e(t.node,n,t.sourceFilePath,c)}}let u=await t.io.readFile(l.absolutePath),d;try{d=a(u)}catch(n){let r=n instanceof Error?n.message:String(n),i=`File ${l.contentPath} is not valid: ${r}`;return e(t.node,i,t.sourceFilePath,c)}return t.node.attributes[`${t.attributeName}${r}`]=d,{entityDeps:c}}export{s as resolveParsedYamlAttribute,o as resolveRawContentAttribute,c as resolveRelativePathAttribute};
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../shared/utils/is-object.js";import{markdocNodeProblem as t}from"../../utils/node-source-range.js";import{createLruCache as n}from"../../../../shared/utils/lru-cache.js";import{compileRouteAccessMatcher as r,matchContentScope as i}from"../../../../shared/rbac/engine.js";import{parseMarkdownCached as a}from"../../utils/parse-cache.js";import{resolveResolverTarget as o}from"./context-paths.js";import{SPEC_KIND_OPENAPI as s}from"../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as c}from"../../../plugins/utils/api-entity-key.js";import{withMockServerOption as l}from"../../../plugins/internal/api-docs/server/options.js";import{annotateApiDocsRbac as u}from"../../../../shared/rbac/api-docs.js";import{REDOCLY_TEAMS_RBAC as d}from"@redocly/config";const f={curl:`shell`,JavaScript:`javascript`,"Node.js":`javascript`,Python:`python`,Java:`java`,"Java8+Apache":`java`,"C#":`csharp`,"C#+Newtonsoft":`csharp`,PHP:`php`,Go:`go`,Ruby:`ruby`,R:`r`},p=/* @__PURE__ */ new WeakMap;async function m(e){let t=p.get(e.node);t===void 0&&(t=h(e),p.set(e.node,t));let n=await t;return{definition:n.definition,problems:n.problems.splice(0)}}async function h(e){let t=e.node.attributes.descriptionFile;if(typeof t!=`string`||t===``||e.entities===void 0)return{definition:null,problems:[]};let n=o(e,t);if(n===null)return g(e,`descriptionFile "${t}" must stay inside the content directory`);let r=c(n.contentPath),i=await e.entities.get(r);return i===null||i.type!==`api`?g(e,`no API description found at ${n.contentPath}`):i.metadata?.specType===`openapi`?{definition:{contentPath:n.contentPath,document:await e.entities.load(r),metadata:i.metadata??{},dataHash:i.status===`ready`?i.dataHash??null:null},problems:[]}:g(e,`${n.contentPath} is not an OpenAPI description`)}function g(e,n){return e.logger?.warn(`${e.node.tag} in ${e.sourceFilePath}: ${n}`),e.node.attributes.descriptionFileInvalid=!0,{definition:null,problems:[t(e.node,n,e.sourceFilePath)]}}const _=(e,t)=>e.node.attributes[t]??void 0;function v(t){let n=e(t.options)?t.options:{};return e(n.mockServer)?{...n,mockServer:{...n.mockServer,position:`off`}}:n}function y(t,n){let r=_(t,`language`),i=_(t,`options`);return{...n,...i,codeSamples:{...e(n.codeSamples)?n.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function b(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let{buildCodeSamples:r,getRequestBodySamples:i,normalizeOptions:o,resolveOperationSampleContext:s}=await import(`@redocly/api-docs/server`),c=o({specType:`openapi`,...y(e,v(t.metadata)),markdownParser:a}),l=s(t.document,c,{operationId:_(e,`operationId`),pointer:_(e,`pointer`)});if(!l)return null;let u={exampleKey:_(e,`exampleKey`),mimeType:_(e,`mimeType`),parameters:_(e,`parameters`),requestBody:_(e,`requestBody`),environments:_(e,`environments`),environment:_(e,`environment`)},d=r(l,u).map(e=>({lang:f[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),p=c.codeSamples?.languages??[],h=p.findIndex(({lang:e})=>e===`Payload`);if(h!==-1){let e=i(l,{exampleKey:u.exampleKey,mimeType:u.mimeType,titlePrefix:p[h].label});d.splice(h,0,...e)}return d.length>0&&(e.node.attributes[e.attributeName]=d),null}async function x(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let{getResponseSamples:r,normalizeOptions:i,resolveOperationSampleContext:o}=await import(`@redocly/api-docs/server`),s=o(t.document,i({specType:`openapi`,...v(t.metadata),markdownParser:a}),{operationId:_(e,`operationId`),pointer:_(e,`pointer`)});if(!s)return null;let c=r(s,{exampleKey:_(e,`exampleKey`)});return c.length>0&&(e.node.attributes[e.attributeName]=c),null}const S=n({budget:4});function C(e,t,n){let r=async()=>{let{buildItems:r}=await import(`@redocly/api-docs/server`),i=u(t.document,s,{warn:t=>e.logger?.warn(t)}),{items:o,store:c}=await r({type:s,document:i,options:{...n,specType:s,markdownParser:a},basePath:`/`,markdownParser:a});return{items:o,store:c}};if(t.dataHash===null)return r();let i=JSON.stringify([t.contentPath,t.dataHash,n]),o=S.get(i);return o===void 0&&(o=r(),S.set(i,o)),o}function w(e){return e.startsWith(`#`)?e.slice(1):e}function T(e,t){let n=_(t,`pointer`),r=_(t,`operationId`);if(n!==void 0||r!==void 0)for(let i of e){let e=i.content?.meta;if(n!==void 0&&e?.pointer!==void 0&&w(e.pointer)===w(n)||r!==void 0&&e?.sourceId===r)return i;let a=T(i.items??[],t);if(a!==void 0)return a}}function E(e){return e[d]}function D(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=E(r)??n;for(let n of r.panels??[]){let r=`children`in n?n.children.find(t):void 0;if(r!==void 0){let t=E(n)??e;return{entry:r,scope:t===void 0?{}:{[d]:t}}}}let i=D(r.children,t,e);if(i!==void 0)return i}}async function O(e,t){return N(e,t,e.markdown.pageRouteSlug(t))}async function k(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let r=v(t.metadata),{items:i,store:a}=await C(e,t,r),o=T(i,e),s=o?.content?D(o.content.children,e=>e.kind===`code-sample`,E(o)):void 0;if(s===void 0)return null;let c=s.entry,{appendUndeclaredConfigureParameters:l}=await import(`@redocly/api-docs/server`),u=_(e,`parameters`),d={apiStore:a,options:y(e,r),panel:{...c,source:l(c.source,{...u?.path&&{path:u.path},...u?.query&&{query:u.query},...u?.header&&{headers:u.header},...u?.cookie&&{cookie:u.cookie}}),...s.scope},...await O(e,t.contentPath)};return e.node.attributes[e.attributeName]=d,null}async function A(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let r=v(t.metadata),{items:i,store:a}=await C(e,t,r),o=T(i,e),s=o?.content?D(o.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,E(o)):void 0;if(s?.entry.responseCodes===void 0)return null;let c={apiStore:a,options:r,panel:{responseCodes:s.entry.responseCodes,...s.entry.schemaId!==void 0&&{schemaId:s.entry.schemaId},...s.scope},...await O(e,t.contentPath)};return e.node.attributes[e.attributeName]=c,null}async function j(e){let t=_(e,`pointer`);if(t===void 0)return null;let{definition:n,problems:r}=await m(e);if(n===null)return{problems:r};let i=v(n.metadata),{items:a,store:o}=await C(e,n,i),s=w(t).replace(/^\//,``),c=Object.fromEntries([s,s.replace(/\/value$/,``)].filter(e=>o.exampleStore[e]!==void 0).map(e=>[e,o.exampleStore[e]]));if(Object.keys(c).length===0)return null;let l=(await import(`@redocly/api-docs/server`)).findExampleEncoding(a,t),u={apiStore:{schemaStore:{},exampleStore:c,securitySchemeStore:{}},options:{...i,..._(e,`options`)},...l!==void 0&&{encoding:l},...await O(e,n.contentPath)};return e.node.attributes[e.attributeName]=u,null}function M(e,t,n,r,i){if(!e.requestBody||!t&&!n)return e;let a={...e.requestBody};if(t&&(a=a[t]?{[t]:a[t]}:{}),n)for(let[e,t]of Object.entries(a)){let o=t.exampleIds?.filter(e=>r[e]?.key!==void 0);if(!o?.length)continue;let s=i(o,n,e=>r[e]);a[e]={...t,exampleIds:s?[s]:[]}}return{...e,requestBody:a}}function N(e,t,n){let a=r(e.config);if(a===null)return{};let o=i(a,{filePath:t,slug:n??null});return{[d]:o}}async function P(t){let{definition:n,problems:r}=await m(t);if(n===null)return{problems:r};let{findExampleIdByKey:i,JsonPointer:o,normalizeOptions:c,resolveOperationSampleContext:d}=await import(`@redocly/api-docs/server`),f=n.metadata,p=e(f.options)?f.options:{},h=t.markdown.pageRouteSlug(n.contentPath),g=l(p,t.config,h),v=_(t,`options`),y={...g,...v??{}},b=c({specType:`openapi`,...y,markdownParser:a}),x=u(n.document,s,{warn:e=>t.logger?.warn(e)}),S=d(x,b,{operationId:_(t,`operationId`),pointer:_(t,`pointer`)});if(!S)return null;let C=M(S.source,_(t,`mimeType`),_(t,`exampleKey`),S.storeCtx.exampleStore,i),w={apiStore:{schemaStore:S.storeCtx.schemaStore,exampleStore:S.storeCtx.exampleStore,securitySchemeStore:S.storeCtx.securitySchemeStore,specVersion:x.openapi},definition:x,operationId:S.operation.operationId??``,operationSource:C,options:y,pointer:o.compile([`paths`,S.pathName,S.method.toLowerCase()]),...N(t,n.contentPath,h)};return t.node.attributes[t.attributeName]=w,null}export{k as resolveOpenapiCodeSamplePanelAttribute,b as resolveOpenapiCodeSamplesAttribute,j as resolveOpenapiExampleAttribute,P as resolveOpenapiReplayAttribute,A as resolveOpenapiResponsePanelAttribute,x as resolveOpenapiResponseSamplesAttribute};
1
+ import{isObject as e}from"../../../../shared/utils/is-object.js";import{markdocNodeProblem as t}from"../../utils/node-source-range.js";import{compileRouteAccessMatcher as n,matchContentScope as r}from"../../../../shared/rbac/engine.js";import{SPEC_KIND_OPENAPI as i}from"../../../../shared/constants/api-spec-kinds.js";import{createLruCache as a}from"../../../../shared/utils/lru-cache.js";import{parseMarkdownCached as o}from"../../utils/parse-cache.js";import{resolveResolverTarget as s}from"./context-paths.js";import{createApiEntityKey as c}from"../../../plugins/utils/api-entity-key.js";import{withMockServerOption as l}from"../../../plugins/internal/api-docs/server/options.js";import{annotateApiDocsRbac as u}from"../../../../shared/rbac/api-docs.js";import{REDOCLY_TEAMS_RBAC as d}from"@redocly/config";const f={curl:`shell`,JavaScript:`javascript`,"Node.js":`javascript`,Python:`python`,Java:`java`,"Java8+Apache":`java`,"C#":`csharp`,"C#+Newtonsoft":`csharp`,PHP:`php`,Go:`go`,Ruby:`ruby`,R:`r`},p=/* @__PURE__ */ new WeakMap;async function m(e){let t=p.get(e.node);t===void 0&&(t=h(e),p.set(e.node,t));let n=await t;return{definition:n.definition,problems:n.problems.splice(0)}}async function h(e){let t=e.node.attributes.descriptionFile;if(typeof t!=`string`||t===``||e.entities===void 0)return{definition:null,problems:[]};let n=s(e,t);if(n===null)return g(e,`descriptionFile "${t}" must stay inside the content directory`);let r=c(n.contentPath),i=await e.entities.get(r);return i===null||i.type!==`api`?g(e,`no API description found at ${n.contentPath}`):i.metadata?.specType===`openapi`?{definition:{contentPath:n.contentPath,document:await e.entities.load(r),metadata:i.metadata??{},dataHash:i.status===`ready`?i.dataHash??null:null},problems:[]}:g(e,`${n.contentPath} is not an OpenAPI description`)}function g(e,n){return e.logger?.warn(`${e.node.tag} in ${e.sourceFilePath}: ${n}`),e.node.attributes.descriptionFileInvalid=!0,{definition:null,problems:[t(e.node,n,e.sourceFilePath)]}}const _=(e,t)=>e.node.attributes[t]??void 0;function v(t){let n=e(t.options)?t.options:{};return e(n.mockServer)?{...n,mockServer:{...n.mockServer,position:`off`}}:n}function y(t,n){let r=_(t,`language`),i=_(t,`options`);return{...n,...i,codeSamples:{...e(n.codeSamples)?n.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function b(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let{buildCodeSamples:r,getRequestBodySamples:i,normalizeOptions:a,resolveOperationSampleContext:s}=await import(`@redocly/api-docs/server`),c=a({specType:`openapi`,...y(e,v(t.metadata)),markdownParser:o}),l=s(t.document,c,{operationId:_(e,`operationId`),pointer:_(e,`pointer`)});if(!l)return null;let u={exampleKey:_(e,`exampleKey`),mimeType:_(e,`mimeType`),parameters:_(e,`parameters`),requestBody:_(e,`requestBody`),environments:_(e,`environments`),environment:_(e,`environment`)},d=r(l,u).map(e=>({lang:f[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),p=c.codeSamples?.languages??[],h=p.findIndex(({lang:e})=>e===`Payload`);if(h!==-1){let e=i(l,{exampleKey:u.exampleKey,mimeType:u.mimeType,titlePrefix:p[h].label});d.splice(h,0,...e)}return d.length>0&&(e.node.attributes[e.attributeName]=d),null}async function x(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let{getResponseSamples:r,normalizeOptions:i,resolveOperationSampleContext:a}=await import(`@redocly/api-docs/server`),s=a(t.document,i({specType:`openapi`,...v(t.metadata),markdownParser:o}),{operationId:_(e,`operationId`),pointer:_(e,`pointer`)});if(!s)return null;let c=r(s,{exampleKey:_(e,`exampleKey`)});return c.length>0&&(e.node.attributes[e.attributeName]=c),null}const S=a({budget:4});function C(e,t,n){let r=async()=>{let{buildItems:r}=await import(`@redocly/api-docs/server`),a=u(t.document,i,{warn:t=>e.logger?.warn(t)}),{items:s,store:c}=await r({type:i,document:a,options:{...n,specType:i,markdownParser:o},basePath:`/`,markdownParser:o});return{items:s,store:c}};if(t.dataHash===null)return r();let a=JSON.stringify([t.contentPath,t.dataHash,n]),s=S.get(a);return s===void 0&&(s=r(),S.set(a,s)),s}function w(e){return e.startsWith(`#`)?e.slice(1):e}function T(e,t){let n=_(t,`pointer`),r=_(t,`operationId`);if(n!==void 0||r!==void 0)for(let i of e){let e=i.content?.meta;if(n!==void 0&&e?.pointer!==void 0&&w(e.pointer)===w(n)||r!==void 0&&e?.sourceId===r)return i;let a=T(i.items??[],t);if(a!==void 0)return a}}function E(e){return e[d]}function D(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=E(r)??n;for(let n of r.panels??[]){let r=`children`in n?n.children.find(t):void 0;if(r!==void 0){let t=E(n)??e;return{entry:r,scope:t===void 0?{}:{[d]:t}}}}let i=D(r.children,t,e);if(i!==void 0)return i}}async function O(e,t){return N(e,t,e.markdown.pageRouteSlug(t))}async function k(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let r=v(t.metadata),{items:i,store:a}=await C(e,t,r),o=T(i,e),s=o?.content?D(o.content.children,e=>e.kind===`code-sample`,E(o)):void 0;if(s===void 0)return null;let c=s.entry,{appendUndeclaredConfigureParameters:l}=await import(`@redocly/api-docs/server`),u=_(e,`parameters`),d={apiStore:a,options:y(e,r),panel:{...c,source:l(c.source,{...u?.path&&{path:u.path},...u?.query&&{query:u.query},...u?.header&&{headers:u.header},...u?.cookie&&{cookie:u.cookie}}),...s.scope},...await O(e,t.contentPath)};return e.node.attributes[e.attributeName]=d,null}async function A(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let r=v(t.metadata),{items:i,store:a}=await C(e,t,r),o=T(i,e),s=o?.content?D(o.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,E(o)):void 0;if(s?.entry.responseCodes===void 0)return null;let c={apiStore:a,options:r,panel:{responseCodes:s.entry.responseCodes,...s.entry.schemaId!==void 0&&{schemaId:s.entry.schemaId},...s.scope},...await O(e,t.contentPath)};return e.node.attributes[e.attributeName]=c,null}async function j(e){let t=_(e,`pointer`);if(t===void 0)return null;let{definition:n,problems:r}=await m(e);if(n===null)return{problems:r};let i=v(n.metadata),{items:a,store:o}=await C(e,n,i),s=w(t).replace(/^\//,``),c=Object.fromEntries([s,s.replace(/\/value$/,``)].filter(e=>o.exampleStore[e]!==void 0).map(e=>[e,o.exampleStore[e]]));if(Object.keys(c).length===0)return null;let l=(await import(`@redocly/api-docs/server`)).findExampleEncoding(a,t),u={apiStore:{schemaStore:{},exampleStore:c,securitySchemeStore:{}},options:{...i,..._(e,`options`)},...l!==void 0&&{encoding:l},...await O(e,n.contentPath)};return e.node.attributes[e.attributeName]=u,null}function M(e,t,n,r,i){if(!e.requestBody||!t&&!n)return e;let a={...e.requestBody};if(t&&(a=a[t]?{[t]:a[t]}:{}),n)for(let[e,t]of Object.entries(a)){let o=t.exampleIds?.filter(e=>r[e]?.key!==void 0);if(!o?.length)continue;let s=i(o,n,e=>r[e]);a[e]={...t,exampleIds:s?[s]:[]}}return{...e,requestBody:a}}function N(e,t,i){let a=n(e.config);if(a===null)return{};let o=r(a,{filePath:t,slug:i??null});return{[d]:o}}async function P(t){let{definition:n,problems:r}=await m(t);if(n===null)return{problems:r};let{findExampleIdByKey:a,JsonPointer:s,normalizeOptions:c,resolveOperationSampleContext:d}=await import(`@redocly/api-docs/server`),f=n.metadata,p=e(f.options)?f.options:{},h=t.markdown.pageRouteSlug(n.contentPath),g=l(p,t.config,h),v=_(t,`options`),y={...g,...v??{}},b=c({specType:`openapi`,...y,markdownParser:o}),x=u(n.document,i,{warn:e=>t.logger?.warn(e)}),S=d(x,b,{operationId:_(t,`operationId`),pointer:_(t,`pointer`)});if(!S)return null;let C=M(S.source,_(t,`mimeType`),_(t,`exampleKey`),S.storeCtx.exampleStore,a),w={apiStore:{schemaStore:S.storeCtx.schemaStore,exampleStore:S.storeCtx.exampleStore,securitySchemeStore:S.storeCtx.securitySchemeStore,specVersion:x.openapi},definition:x,operationId:S.operation.operationId??``,operationSource:C,options:y,pointer:s.compile([`paths`,S.pathName,S.method.toLowerCase()]),...N(t,n.contentPath,h)};return t.node.attributes[t.attributeName]=w,null}export{k as resolveOpenapiCodeSamplePanelAttribute,b as resolveOpenapiCodeSamplesAttribute,j as resolveOpenapiExampleAttribute,P as resolveOpenapiReplayAttribute,A as resolveOpenapiResponsePanelAttribute,x as resolveOpenapiResponseSamplesAttribute};
@@ -1 +1 @@
1
- import{L10N_DIR as e}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as r,replaceWithMarkdocError as i}from"../../tags/markdoc-error.js";import{PARTIAL_L10N_ATTRIBUTE as a}from"../../tags/partial.js";import{shiftRange as o}from"../../../../shared/utils/shift-range.js";import{inlinedLinkRefs as s}from"../../../link-checker/node-ref.js";import{resolveResolverTarget as c}from"./context-paths.js";import{getPartialsFolders as l,isPartialPath as u}from"../../utils/partials.js";import{FRONTMATTER_BLOCK_RE as d,computeFrontmatterLineOffset as f}from"../../utils/frontmatter-offset.js";import{substituteStaticVariables as p}from"../../utils/substitute-variables.js";import{resolveMarkdocBuildTimeAttributes as m}from"../markdoc.js";import{join as h}from"node:path";async function g(o){let{node:s,attributeName:d}=o,f=s.attributes[d];if(typeof f!=`string`||f===``||o.io===void 0)return null;let p=c(o,f);if(p===null)return null;if(!u(p.contentPath,o.config)){let e=`Partial ${p.contentPath} must live in a partials folder (markdown.partialsFolders: ${l(o.config).join(`, `)})`;return r(s,e,o.sourceFilePath)}let m=n(o.sourceFilePath),g=[],v=m!==void 0&&n(p.contentPath)===void 0?`${e}/${m}/${p.contentPath}`:p.contentPath;if(!await o.io.exists(h(o.contentDir,v))){g.push({kind:`file`,path:v});let e=t(v);if(e!==void 0&&g.push({kind:`file`,path:e}),e===void 0||!await o.io.exists(h(o.contentDir,e))){let e=`Partial file ${p.contentPath} does not exist`;return r(s,e,o.sourceFilePath,g)}v=e}let y=o.partialChain??[o.sourceFilePath];if(y.includes(v))return i(s,`Circular partial inclusion: ${[...y,v].join(` -> `)}`),{entityDeps:[{kind:`file`,path:v}]};let b=await o.io.readFile(h(o.contentDir,v)),x=await _(o,v,b,y);s.children=x.ast.children;let S=[{entityDeps:g},x.result];if(m===void 0&&n(p.contentPath)===void 0){let t={},r=n(o.file.path);for(let n of o.markdown.contentLocales){let i=`${e}/${n}/${o.file.path}`;if(r===void 0&&S.push({entityDeps:[{kind:`file`,path:i}]}),r===void 0?o.markdown.hasPageRoute(i):n!==r)continue;let a=`${e}/${n}/${p.contentPath}`,s=h(o.contentDir,a);if(!await o.io.exists(s)){S.push({entityDeps:[{kind:`file`,path:a}]});continue}let c=await _(o,a,await o.io.readFile(s),y);t[n]=c.ast,S.push(c.result)}Object.keys(t).length>0&&(s.attributes[a]=t)}return{entityDeps:S.flatMap(e=>e.entityDeps??[]),assetUsages:S.flatMap(e=>e.assetUsages??[]),linkRefs:S.flatMap(e=>e.linkRefs??[]),problems:S.flatMap(e=>e.problems??[])}}async function _(e,t,n,r){let i=n.replace(d,``),a=structuredClone(e.markdown.parseCached(i)),o=await m(a,{tags:e.tags,sourceFilePath:t,resolverContext:{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin},partialChain:[...r,t],source:i}),c=e.node.attributes.variables;typeof c==`object`&&c&&!Array.isArray(c)&&p(a,c);let l=f(n);return{ast:a,result:{entityDeps:[{kind:`file`,path:t},...o.entityDeps],assetUsages:o.assetUsages,linkRefs:s(o.linkRefs,t,l),problems:o.problems.map(e=>v(e,l))}}}function v(e,t){if(t===0||e.location?.range===void 0)return e;let n={...e.location,range:o(e.location.range,t)};return{...e,location:n}}export{g as resolvePartialFileAttribute};
1
+ import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../../tags/markdoc-error.js";import{PARTIAL_L10N_ATTRIBUTE as n}from"../../tags/partial.js";import{L10N_DIR as r}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as i,l10nDirOf as a}from"../../../../shared/utils/l10n.js";import{shiftRange as o}from"../../../../shared/utils/shift-range.js";import{inlinedLinkRefs as s}from"../../../link-checker/node-ref.js";import{resolveResolverTarget as c}from"./context-paths.js";import{getPartialsFolders as l,isPartialPath as u}from"../../utils/partials.js";import{FRONTMATTER_BLOCK_RE as d,computeFrontmatterLineOffset as f}from"../../utils/frontmatter-offset.js";import{substituteStaticVariables as p}from"../../utils/substitute-variables.js";import{resolveMarkdocBuildTimeAttributes as m}from"../markdoc.js";import{join as h}from"node:path";async function g(o){let{node:s,attributeName:d}=o,f=s.attributes[d];if(typeof f!=`string`||f===``||o.io===void 0)return null;let p=c(o,f);if(p===null)return null;if(!u(p.contentPath,o.config)){let t=`Partial ${p.contentPath} must live in a partials folder (markdown.partialsFolders: ${l(o.config).join(`, `)})`;return e(s,t,o.sourceFilePath)}let m=a(o.sourceFilePath),g=[],v=m!==void 0&&a(p.contentPath)===void 0?`${r}/${m}/${p.contentPath}`:p.contentPath;if(!await o.io.exists(h(o.contentDir,v))){g.push({kind:`file`,path:v});let t=i(v);if(t!==void 0&&g.push({kind:`file`,path:t}),t===void 0||!await o.io.exists(h(o.contentDir,t))){let t=`Partial file ${p.contentPath} does not exist`;return e(s,t,o.sourceFilePath,g)}v=t}let y=o.partialChain??[o.sourceFilePath];if(y.includes(v))return t(s,`Circular partial inclusion: ${[...y,v].join(` -> `)}`),{entityDeps:[{kind:`file`,path:v}]};let b=await o.io.readFile(h(o.contentDir,v)),x=await _(o,v,b,y);s.children=x.ast.children;let S=[{entityDeps:g},x.result];if(m===void 0&&a(p.contentPath)===void 0){let e={},t=a(o.file.path);for(let n of o.markdown.contentLocales){let i=`${r}/${n}/${o.file.path}`;if(t===void 0&&S.push({entityDeps:[{kind:`file`,path:i}]}),t===void 0?o.markdown.hasPageRoute(i):n!==t)continue;let a=`${r}/${n}/${p.contentPath}`,s=h(o.contentDir,a);if(!await o.io.exists(s)){S.push({entityDeps:[{kind:`file`,path:a}]});continue}let c=await _(o,a,await o.io.readFile(s),y);e[n]=c.ast,S.push(c.result)}Object.keys(e).length>0&&(s.attributes[n]=e)}return{entityDeps:S.flatMap(e=>e.entityDeps??[]),assetUsages:S.flatMap(e=>e.assetUsages??[]),linkRefs:S.flatMap(e=>e.linkRefs??[]),problems:S.flatMap(e=>e.problems??[])}}async function _(e,t,n,r){let i=n.replace(d,``),a=structuredClone(e.markdown.parseCached(i)),o=await m(a,{tags:e.tags,sourceFilePath:t,resolverContext:{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin},partialChain:[...r,t],source:i}),c=e.node.attributes.variables;typeof c==`object`&&c&&!Array.isArray(c)&&p(a,c);let l=f(n);return{ast:a,result:{entityDeps:[{kind:`file`,path:t},...o.entityDeps],assetUsages:o.assetUsages,linkRefs:s(o.linkRefs,t,l),problems:o.problems.map(e=>v(e,l))}}}function v(e,t){if(t===0||e.location?.range===void 0)return e;let n={...e.location,range:o(e.location.range,t)};return{...e,location:n}}export{g as resolvePartialFileAttribute};
@@ -1 +1 @@
1
- import{delocalizeL10nPath as e}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as t}from"../../tags/markdoc-error.js";import{resolveResolverTarget as n}from"./context-paths.js";import{prefixSvgIds as r}from"../../utils/prefix-svg-ids.js";async function i(i,a={}){let{node:o,attributeName:s}=i,c=o.attributes[s];if(typeof c!=`string`||c===``||i.io===void 0)return null;let l=n(i,c);if(l===null)return null;let u=[{kind:`file`,path:l.contentPath}],d=l;if(!await i.io.exists(l.absolutePath)){let r=e(i.sourceFilePath);if(d=r===void 0?null:n({...i,sourceFilePath:r},c),d===null||!await i.io.exists(d.absolutePath)){if(a.optional)return null;let e=`SVG file ${l.contentPath} does not exist`;return t(o,e,i.sourceFilePath,u)}u.push({kind:`file`,path:d.contentPath})}let f=await i.io.readFile(d.absolutePath),p=d.contentPath.replace(/[^a-zA-Z0-9_-]/g,`-`);return o.attributes[`${s}RawContent`]=r(f,p),{entityDeps:u}}export{i as resolveSvgContentAttribute};
1
+ import{markdocErrorResult as e}from"../../tags/markdoc-error.js";import{delocalizeL10nPath as t}from"../../../../shared/utils/l10n.js";import{resolveResolverTarget as n}from"./context-paths.js";import{prefixSvgIds as r}from"../../utils/prefix-svg-ids.js";async function i(i,a={}){let{node:o,attributeName:s}=i,c=o.attributes[s];if(typeof c!=`string`||c===``||i.io===void 0)return null;let l=n(i,c);if(l===null)return null;let u=[{kind:`file`,path:l.contentPath}],d=l;if(!await i.io.exists(l.absolutePath)){let r=t(i.sourceFilePath);if(d=r===void 0?null:n({...i,sourceFilePath:r},c),d===null||!await i.io.exists(d.absolutePath)){if(a.optional)return null;let t=`SVG file ${l.contentPath} does not exist`;return e(o,t,i.sourceFilePath,u)}u.push({kind:`file`,path:d.contentPath})}let f=await i.io.readFile(d.absolutePath),p=d.contentPath.replace(/[^a-zA-Z0-9_-]/g,`-`);return o.attributes[`${s}RawContent`]=r(f,p),{entityDeps:u}}export{i as resolveSvgContentAttribute};
@@ -1 +1 @@
1
- import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../tags/markdoc-error.js";import{getAttributeBuildTimeResolver as n}from"./attribute-resolver-key.js";import{isLocalReference as r}from"./references.js";import{walkMarkdocAst as i}from"../utils/walk-markdoc-ast.js";import{getExampleContent as a,walkWithExampleContent as o}from"../utils/reparse-example-fences.js";import{resolveLinkAttribute as s}from"./markdoc-resolvers/link.js";import{resolveIconAttribute as c,resolveImageAttribute as l,resolveImageSrcSetAttribute as u}from"./markdoc-resolvers/image.js";import{resolveCodeSnippetFileAttribute as d}from"./markdoc-resolvers/code-snippet.js";import{resolveSvgContentAttribute as f}from"./markdoc-resolvers/svg-content.js";import{resolveTagRawContentAttribute as p}from"./markdoc-resolvers/tag-raw-content.js";import{resolveHtmlAttrsAttribute as m}from"./markdoc-resolvers/html-attrs.js";import{resolveImageGalleryAttribute as h}from"./markdoc-resolvers/image-gallery.js";import{resolveCodeWalkthroughFilesetsAttribute as g}from"./markdoc-resolvers/code-walkthrough/filesets.js";import{resolvePartialFileAttribute as _}from"./markdoc-resolvers/partial.js";import{resolveDiagramFileAttribute as v}from"./markdoc-resolvers/diagram-file.js";import{resolveParsedYamlAttribute as y,resolveRawContentAttribute as b,resolveRelativePathAttribute as x}from"./markdoc-resolvers/file-reference.js";import{resolveJsonExampleRefAttribute as S,resolveJsonSchemaRefAttribute as C,resolveSampleFromJsonSchemaAttribute as w}from"./markdoc-resolvers/json-schema.js";import{resolveOpenapiCodeSamplePanelAttribute as T,resolveOpenapiCodeSamplesAttribute as E,resolveOpenapiExampleAttribute as D,resolveOpenapiReplayAttribute as O,resolveOpenapiResponsePanelAttribute as k,resolveOpenapiResponseSamplesAttribute as A}from"./markdoc-resolvers/operation-samples.js";import{PROMPT_TAG as j}from"@redocly/theme/core/constants";import{convertGithubAlertToAdmonition as M}from"@redocly/theme/markdoc/tags/admonition";async function N(e,r){let s=r.tags??{},c=F,l={entityDeps:[],assetUsages:[],linkRefs:[],problems:[]},u=r.resolverContext?.markdown?.disabledTags,d=R(r.source),f=[...i(e,{skipChildren:z})],p=f.flatMap(e=>{let t=a(e);return t?[...o(t,z)]:[]});for(let e of[...f,...p])M(e);let m=p.filter(e=>e.type===`tag`);for(let e of[...f,...m])if(e.type===`link`)await L(c.nativeMdLink,e,`href`,r,l,d);else if(e.type===`image`)await L(c.imageSrc,e,`src`,r,l,d);else if(e.type===`tag`){if(typeof e.tag==`string`&&u?.has(e.tag)){t(e,`The "${e.tag}" tag is not available here.`);continue}let i=typeof e.tag==`string`?s[e.tag]:void 0;for(let[t,a]of Object.entries(i?.attributes??{})){let i=n(a);i&&Object.hasOwn(c,i)&&await L(c[i],e,t,r,l,d)}}return l}const P=({attributeName:e,markdown:t,node:n,partialChain:r,sourceFilePath:i})=>s(n,e,i,t,r?.[0]),F={imageSrc({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return l(n,e,r,t)},imageSrcSet({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return u(n,e,r,t)},link:P,nativeMdLink:P,async relativeOrCdnIcon(e){let{attributeName:t,markdown:n,node:r,sourceFilePath:i}=e,a=r.attributes[t];return typeof a==`string`&&B(a)&&await f(e,{optional:!0}),c(r,t,i,n)},codeSnippetFile:d,diagramFile:v,svgContent:f,tagRawContent:p,htmlAttrs:m,imageGallery:h,codeWalkthroughFilesets:g,partialFile:_,jsonSchemaRef:C,sampleFromJsonSchema:w,jsonExampleRef:S,openapiCodeSamples:E,openapiCodeSamplePanel:T,openapiReplay:O,openapiResponseSamples:A,openapiResponsePanel:k,openapiExample:D,rawContent:b,parsedYaml:y,relativePath:x};function I(e){let t=/* @__PURE__ */ new Set;for(let n of o(e))n.type===`tag`&&typeof n.tag==`string`&&t.add(n.tag);return[...t].sort()}async function L(t,n,r,i,a,o){let s;try{s=await t({...i.resolverContext,attributeName:r,node:n,sourceFilePath:i.sourceFilePath,tags:i.tags,partialChain:i.partialChain,readSourceLines:o})}catch(t){let r=t instanceof Error?t.message:String(t);s=e(n,r,i.sourceFilePath)}s&&(s.entityDeps&&a.entityDeps.push(...s.entityDeps),s.assetUsages&&a.assetUsages.push(...s.assetUsages),s.linkRefs&&a.linkRefs.push(...s.linkRefs),s.problems&&a.problems.push(...s.problems))}function R(e){let t;return()=>(t??=e.split(/\r?\n/),t)}function z(e){return e.type===`tag`&&e.tag===j}function B(e){let t=(e.split(`#`,1)[0]??e).split(`?`,1)[0]??e;return/\.svg$/i.test(t)&&r(e)}export{F as builtInMarkdocAttributeResolvers,I as collectMarkdocTagNames,z as isPromptTag,N as resolveMarkdocBuildTimeAttributes};
1
+ import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../tags/markdoc-error.js";import{walkMarkdocAst as n}from"../utils/walk-markdoc-ast.js";import{getExampleContent as r,walkWithExampleContent as i}from"../utils/reparse-example-fences.js";import{isLocalReference as a}from"./references.js";import{resolveLinkAttribute as o}from"./markdoc-resolvers/link.js";import{resolveIconAttribute as s,resolveImageAttribute as c,resolveImageSrcSetAttribute as l}from"./markdoc-resolvers/image.js";import{resolveCodeSnippetFileAttribute as u}from"./markdoc-resolvers/code-snippet.js";import{resolveSvgContentAttribute as d}from"./markdoc-resolvers/svg-content.js";import{resolveTagRawContentAttribute as f}from"./markdoc-resolvers/tag-raw-content.js";import{resolveHtmlAttrsAttribute as p}from"./markdoc-resolvers/html-attrs.js";import{resolveImageGalleryAttribute as m}from"./markdoc-resolvers/image-gallery.js";import{resolveCodeWalkthroughFilesetsAttribute as h}from"./markdoc-resolvers/code-walkthrough/filesets.js";import{resolvePartialFileAttribute as g}from"./markdoc-resolvers/partial.js";import{resolveDiagramFileAttribute as _}from"./markdoc-resolvers/diagram-file.js";import{resolveParsedYamlAttribute as v,resolveRawContentAttribute as y,resolveRelativePathAttribute as b}from"./markdoc-resolvers/file-reference.js";import{resolveJsonExampleRefAttribute as x,resolveJsonSchemaRefAttribute as S,resolveSampleFromJsonSchemaAttribute as C}from"./markdoc-resolvers/json-schema.js";import{resolveOpenapiCodeSamplePanelAttribute as w,resolveOpenapiCodeSamplesAttribute as T,resolveOpenapiExampleAttribute as E,resolveOpenapiReplayAttribute as D,resolveOpenapiResponsePanelAttribute as O,resolveOpenapiResponseSamplesAttribute as k}from"./markdoc-resolvers/operation-samples.js";import{getAttributeBuildTimeResolver as A}from"./attribute-resolver-key.js";import{convertGithubAlertToAdmonition as j}from"@redocly/theme/markdoc/tags/admonition";import{PROMPT_TAG as M}from"@redocly/theme/core/constants";async function N(e,a){let o=a.tags??{},s=F,c={entityDeps:[],assetUsages:[],linkRefs:[],problems:[]},l=a.resolverContext?.markdown?.disabledTags,u=R(a.source),d=[...n(e,{skipChildren:z})],f=d.flatMap(e=>{let t=r(e);return t?[...i(t,z)]:[]});for(let e of[...d,...f])j(e);let p=f.filter(e=>e.type===`tag`);for(let e of[...d,...p])if(e.type===`link`)await L(s.nativeMdLink,e,`href`,a,c,u);else if(e.type===`image`)await L(s.imageSrc,e,`src`,a,c,u);else if(e.type===`tag`){if(typeof e.tag==`string`&&l?.has(e.tag)){t(e,`The "${e.tag}" tag is not available here.`);continue}let n=typeof e.tag==`string`?o[e.tag]:void 0;for(let[t,r]of Object.entries(n?.attributes??{})){let n=A(r);n&&Object.hasOwn(s,n)&&await L(s[n],e,t,a,c,u)}}return c}const P=({attributeName:e,markdown:t,node:n,partialChain:r,sourceFilePath:i})=>o(n,e,i,t,r?.[0]),F={imageSrc({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return c(n,e,r,t)},imageSrcSet({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return l(n,e,r,t)},link:P,nativeMdLink:P,async relativeOrCdnIcon(e){let{attributeName:t,markdown:n,node:r,sourceFilePath:i}=e,a=r.attributes[t];return typeof a==`string`&&B(a)&&await d(e,{optional:!0}),s(r,t,i,n)},codeSnippetFile:u,diagramFile:_,svgContent:d,tagRawContent:f,htmlAttrs:p,imageGallery:m,codeWalkthroughFilesets:h,partialFile:g,jsonSchemaRef:S,sampleFromJsonSchema:C,jsonExampleRef:x,openapiCodeSamples:T,openapiCodeSamplePanel:w,openapiReplay:D,openapiResponseSamples:k,openapiResponsePanel:O,openapiExample:E,rawContent:y,parsedYaml:v,relativePath:b};function I(e){let t=/* @__PURE__ */ new Set;for(let n of i(e))n.type===`tag`&&typeof n.tag==`string`&&t.add(n.tag);return[...t].sort()}async function L(t,n,r,i,a,o){let s;try{s=await t({...i.resolverContext,attributeName:r,node:n,sourceFilePath:i.sourceFilePath,tags:i.tags,partialChain:i.partialChain,readSourceLines:o})}catch(t){let r=t instanceof Error?t.message:String(t);s=e(n,r,i.sourceFilePath)}s&&(s.entityDeps&&a.entityDeps.push(...s.entityDeps),s.assetUsages&&a.assetUsages.push(...s.assetUsages),s.linkRefs&&a.linkRefs.push(...s.linkRefs),s.problems&&a.problems.push(...s.problems))}function R(e){let t;return()=>(t??=e.split(/\r?\n/),t)}function z(e){return e.type===`tag`&&e.tag===M}function B(e){let t=(e.split(`#`,1)[0]??e).split(`?`,1)[0]??e;return/\.svg$/i.test(t)&&a(e)}export{F as builtInMarkdocAttributeResolvers,I as collectMarkdocTagNames,z as isPromptTag,N as resolveMarkdocBuildTimeAttributes};
@@ -1 +1 @@
1
- import{L10N_DIR as e}from"../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n,toLocaleSlug as r}from"../../../shared/utils/l10n.js";import{computePathPrefixes as i}from"../../../shared/utils/routes/compute-path-prefixes.js";import{joinSrcSet as a,parseSrcSet as o}from"../../plugins/internal/assets/srcset.js";import{resolveContentPath as s}from"../../../shared/utils/resolve-content-path.js";import{isRouteSlugTarget as c}from"../../../shared/utils/routes/is-route-slug-target.js";import{buildContentAssetUrl as l}from"../../plugins/internal/assets/url.js";import{IMAGE_EXTENSIONS as u}from"../../plugins/internal/assets/extensions.js";import{safeDecodeURI as d}from"../../../shared/utils/safe-decode-uri.js";import{isIndexPagePath as f,resolveRelativeSlug as p}from"../../../shared/utils/routes/resolve-relative-slug.js";import{posix as m}from"node:path";const h=/[[\]()*_`#!|<>~]|\{%|\n[ \t\r]*\n|^\s{0,3}([-+*]\s|\d+\.\s|>|-{3,}|={2,})/m;function g(e){return h.test(e)}function _(e){return e.startsWith(`#`)||e.startsWith(`//`)||/^[a-z][a-z0-9+.-]*:/i.test(e)?!1:!e.startsWith(`/`)||!c(y(e).path)}function v(e){let t=e.indexOf(`?`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function y(e){let t=e.indexOf(`#`);return t===-1?{path:e,hash:``}:{path:e.slice(0,t),hash:e.slice(t)}}async function b(e,n){let r=await n(e);if(r)return r;let i=t(e);if(i!==void 0){let t=await n(i);if(t){let n=e.slice(0,e.length-i.length),r=t.entityDeps.filter(e=>e.kind===`file`).map(e=>({kind:`file`,path:`${n}${e.path}`}));return{...t,entityDeps:[...r,...t.entityDeps]}}}return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]}}async function x(e,r){let i=t(e),a=n(e);if(i===void 0||a===void 0)return null;let o=await r(i,a);return o===null?null:{...o,entityDeps:[{kind:`file`,path:e},...o.entityDeps]}}async function S(t,n,r,i,a){let[o]=t.assetUsages;if(!o||!i?.length||t.result.kind!==`assetRef`||n.startsWith(`@l10n/`))return t;let s=l(o.path,o.hash,o.tag),c=[];for(let t of i){let n=`${e}/${t}/${o.path}`,i=r.filesByPath.get(n);if(!i)continue;let l=await a?.(n)??null;c.push({path:n,hash:i.hash,kind:o.kind,tag:l,l10n:{locale:t,canonicalUrl:s}})}return c.length===0?t:{...t,assetUsages:[o,...c]}}function C(e,t){let n=e.routeBySlug.get(t);return n===void 0?i(t).reverse().map(t=>e.routeBySlug.get(t)).find(e=>e?.wildcardPrefix===!0):n}async function w(e,t,n,i,a,o){if(!_(e))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:c,hash:h}=y(e),g=async(e,t)=>{let a=n.primaryRouteByFilePath.get(e);if(a!==void 0)return{result:{kind:`pageUrl`,url:`${t===void 0?a:r(a,t)}${h}`},entityDeps:[{kind:`file`,path:e}],assetUsages:[]};let o=n.filesByPath.get(e);if(o){let t=m.extname(e).toLowerCase(),n=u.has(t)?`image`:`file`,r=await i?.(e)??null;return{result:{kind:`assetRef`,url:`${l(e,o.hash,r)}${h}`,path:e,hash:o.hash},entityDeps:[{kind:`file`,path:e}],assetUsages:[{path:e,hash:o.hash,kind:n,tag:r}]}}return null};return S(await b(t,async e=>{let t=s(d(c),e);if(t===null)return null;let r=await g(t)??await x(t,g);if(r!==null)return r;let[i=``,a=``]=v(c);if(!c.startsWith(`/`)&&m.extname(i)===``){let t=o??e,r=n.primaryRouteByFilePath.get(t),s=r===void 0?m.extname(t).toLowerCase()===`.md`?void 0:p(i,`/${t}`,!1):p(i,r,f(t)),c=s===void 0?void 0:C(n,s);if(s!==void 0&&c!==void 0)return{result:{kind:`pageUrl`,url:`${s}${a}${h}`},entityDeps:c.originFilePath===null?[]:[{kind:`file`,path:c.originFilePath}],assetUsages:[]}}return null}),t,n,a,i)}async function T(e,t,n,r,i){if(!_(e))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:a}=y(e),o=async e=>{let t=n.filesByPath.get(e);if(!t)return null;let i=await r?.(e)??null;return{result:{kind:`assetRef`,url:l(e,t.hash,i),path:e,hash:t.hash},entityDeps:[{kind:`file`,path:e}],assetUsages:[{path:e,hash:t.hash,kind:`image`,tag:i}]}};return S(await b(t,async e=>{let t=s(d(a),e);return t===null?null:await o(t)??await x(t,o)}),t,n,i,r)}async function E(e,t,n,r,i){let s=[],c=[],l=o(e);if(!l||l.length===0)return{value:e,entityDeps:s,assetUsages:c};let u=await Promise.all(l.map(async e=>{let a=await T(e.src,t,n,r,i);return a.result.kind===`assetRef`&&(s.push(...a.entityDeps),c.push(...a.assetUsages),e.src=a.result.url),e}));return{value:a(u),entityDeps:s,assetUsages:c}}export{C as findServingRoute,_ as isLocalReference,g as looksLikeMarkdown,T as resolveImageReference,E as resolveImageSrcSet,w as resolveLocalReference,y as splitHash};
1
+ import{buildContentAssetUrl as e}from"../../plugins/internal/assets/url.js";import{L10N_DIR as t}from"../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as n,l10nDirOf as r,toLocaleSlug as i}from"../../../shared/utils/l10n.js";import{resolveContentPath as a}from"../../../shared/utils/resolve-content-path.js";import{computePathPrefixes as o}from"../../../shared/utils/routes/compute-path-prefixes.js";import{IMAGE_EXTENSIONS as s}from"../../plugins/internal/assets/extensions.js";import{isRouteSlugTarget as c}from"../../../shared/utils/routes/is-route-slug-target.js";import{safeDecodeURI as l}from"../../../shared/utils/safe-decode-uri.js";import{joinSrcSet as u,parseSrcSet as d}from"../../plugins/internal/assets/srcset.js";import{isIndexPagePath as f,resolveRelativeSlug as p}from"../../../shared/utils/routes/resolve-relative-slug.js";import{posix as m}from"node:path";const h=/[[\]()*_`#!|<>~]|\{%|\n[ \t\r]*\n|^\s{0,3}([-+*]\s|\d+\.\s|>|-{3,}|={2,})/m;function g(e){return h.test(e)}function _(e){return e.startsWith(`#`)||e.startsWith(`//`)||/^[a-z][a-z0-9+.-]*:/i.test(e)?!1:!e.startsWith(`/`)||!c(y(e).path)}function v(e){let t=e.indexOf(`?`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function y(e){let t=e.indexOf(`#`);return t===-1?{path:e,hash:``}:{path:e.slice(0,t),hash:e.slice(t)}}async function b(e,t){let r=await t(e);if(r)return r;let i=n(e);if(i!==void 0){let n=await t(i);if(n){let t=e.slice(0,e.length-i.length),r=n.entityDeps.filter(e=>e.kind===`file`).map(e=>({kind:`file`,path:`${t}${e.path}`}));return{...n,entityDeps:[...r,...n.entityDeps]}}}return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]}}async function x(e,t){let i=n(e),a=r(e);if(i===void 0||a===void 0)return null;let o=await t(i,a);return o===null?null:{...o,entityDeps:[{kind:`file`,path:e},...o.entityDeps]}}async function S(n,r,i,a,o){let[s]=n.assetUsages;if(!s||!a?.length||n.result.kind!==`assetRef`||r.startsWith(`@l10n/`))return n;let c=e(s.path,s.hash,s.tag),l=[];for(let e of a){let n=`${t}/${e}/${s.path}`,r=i.filesByPath.get(n);if(!r)continue;let a=await o?.(n)??null;l.push({path:n,hash:r.hash,kind:s.kind,tag:a,l10n:{locale:e,canonicalUrl:c}})}return l.length===0?n:{...n,assetUsages:[s,...l]}}function C(e,t){let n=e.routeBySlug.get(t);return n===void 0?o(t).reverse().map(t=>e.routeBySlug.get(t)).find(e=>e?.wildcardPrefix===!0):n}async function w(t,n,r,o,c,u){if(!_(t))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:d,hash:h}=y(t),g=async(t,n)=>{let a=r.primaryRouteByFilePath.get(t);if(a!==void 0)return{result:{kind:`pageUrl`,url:`${n===void 0?a:i(a,n)}${h}`},entityDeps:[{kind:`file`,path:t}],assetUsages:[]};let c=r.filesByPath.get(t);if(c){let n=m.extname(t).toLowerCase(),r=s.has(n)?`image`:`file`,i=await o?.(t)??null;return{result:{kind:`assetRef`,url:`${e(t,c.hash,i)}${h}`,path:t,hash:c.hash},entityDeps:[{kind:`file`,path:t}],assetUsages:[{path:t,hash:c.hash,kind:r,tag:i}]}}return null};return S(await b(n,async e=>{let t=a(l(d),e);if(t===null)return null;let n=await g(t)??await x(t,g);if(n!==null)return n;let[i=``,o=``]=v(d);if(!d.startsWith(`/`)&&m.extname(i)===``){let t=u??e,n=r.primaryRouteByFilePath.get(t),a=n===void 0?m.extname(t).toLowerCase()===`.md`?void 0:p(i,`/${t}`,!1):p(i,n,f(t)),s=a===void 0?void 0:C(r,a);if(a!==void 0&&s!==void 0)return{result:{kind:`pageUrl`,url:`${a}${o}${h}`},entityDeps:s.originFilePath===null?[]:[{kind:`file`,path:s.originFilePath}],assetUsages:[]}}return null}),n,r,c,o)}async function T(t,n,r,i,o){if(!_(t))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:s}=y(t),c=async t=>{let n=r.filesByPath.get(t);if(!n)return null;let a=await i?.(t)??null;return{result:{kind:`assetRef`,url:e(t,n.hash,a),path:t,hash:n.hash},entityDeps:[{kind:`file`,path:t}],assetUsages:[{path:t,hash:n.hash,kind:`image`,tag:a}]}};return S(await b(n,async e=>{let t=a(l(s),e);return t===null?null:await c(t)??await x(t,c)}),n,r,o,i)}async function E(e,t,n,r,i){let a=[],o=[],s=d(e);if(!s||s.length===0)return{value:e,entityDeps:a,assetUsages:o};let c=await Promise.all(s.map(async e=>{let s=await T(e.src,t,n,r,i);return s.result.kind===`assetRef`&&(a.push(...s.entityDeps),o.push(...s.assetUsages),e.src=s.result.url),e}));return{value:u(c),entityDeps:a,assetUsages:o}}export{C as findServingRoute,_ as isLocalReference,g as looksLikeMarkdown,T as resolveImageReference,E as resolveImageSrcSet,w as resolveLocalReference,y as splitHash};
@@ -1,7 +1,7 @@
1
- import{getInnerText as e}from"../utils/get-inner-text.js";import{headingSlugger as t}from"../utils/heading-slugger.js";import{builtInMarkdocNodes as n,builtInMarkdocTags as r}from"../constants/builtin-tags.js";import{PROMPT_TAG as i}from"@redocly/theme/core/constants";import a from"@redocly/markdoc";const o=/* @__PURE__ */ new Set([`if`,`else`,i]),s=[`title`,`name`,`label`],c=((e,t)=>typeof t==`string`?t:e??``);function l(e,t={}){return f(e).map(e=>p({type:`document`,children:e},t)).filter(e=>e!==``)}function u(e,n={}){t.reset();let r=[],i=[];for(let t of f(e)){let e=p({type:`document`,children:t},n);e!==``&&(r.push(e),i.push(d(t[0],n.variables)))}return{chunks:r,headings:i}}function d(t,i){if(!v(t)||t.type!==`heading`)return null;let o=a.transform(a.Ast.fromJSON(JSON.stringify(t)),{nodes:n,tags:r,variables:i});if(!a.Tag.isTag(o))return null;let s=typeof o.attributes.id==`string`?o.attributes.id:``;return{heading:e(o.children),anchor:s}}function f(e){let t=v(e)&&Array.isArray(e.children)?e.children:[e],n=[],r=[];for(let e of t)(v(e)&&e.type===`heading`||n.length===0)&&(r=[],n.push(r)),r.push(e);return n}function p(e,t){let n=[];return g(e,n,{listDepth:0,ordered:!1,index:0,options:t}),n.join(``).replace(/(?<![ \t])[ \t]+\n/g,`
1
+ import{headingSlugger as e}from"../utils/heading-slugger.js";import{getInnerText as t}from"../utils/get-inner-text.js";import{builtInMarkdocNodes as n,builtInMarkdocTags as r}from"../constants/builtin-tags.js";import i from"@redocly/markdoc";import{PROMPT_TAG as a}from"@redocly/theme/core/constants";const o=/* @__PURE__ */ new Set([`if`,`else`,a]),s=[`title`,`name`,`label`],c=((e,t)=>typeof t==`string`?t:e??``);function l(e,t={}){return f(e).map(e=>p({type:`document`,children:e},t)).filter(e=>e!==``)}function u(t,n={}){e.reset();let r=[],i=[];for(let e of f(t)){let t=p({type:`document`,children:e},n);t!==``&&(r.push(t),i.push(d(e[0],n.variables)))}return{chunks:r,headings:i}}function d(e,a){if(!v(e)||e.type!==`heading`)return null;let o=i.transform(i.Ast.fromJSON(JSON.stringify(e)),{nodes:n,tags:r,variables:a});if(!i.Tag.isTag(o))return null;let s=typeof o.attributes.id==`string`?o.attributes.id:``;return{heading:t(o.children),anchor:s}}function f(e){let t=v(e)&&Array.isArray(e.children)?e.children:[e],n=[],r=[];for(let e of t)(v(e)&&e.type===`heading`||n.length===0)&&(r=[],n.push(r)),r.push(e);return n}function p(e,t){let n=[];return g(e,n,{listDepth:0,ordered:!1,index:0,options:t}),n.join(``).replace(/(?<![ \t])[ \t]+\n/g,`
2
2
  `).replace(/\n{3,}/g,`
3
3
 
4
- `).trim()}function m(e,t={}){if(a.Ast.isVariable(e))return Object.hasOwn(t,String(e.path[0]))?new a.Ast.Variable(e.path).resolve({variables:t}):e;if(Array.isArray(e)){let n;for(let r=0;r<e.length;r++){let i=m(e[r],t);i!==e[r]&&((n??=e.slice())[r]=i)}return n??e}if(!v(e)||a.Ast.isAst(e))return e;let n;for(let[r,i]of Object.entries(e)){let a=m(i,t);a!==i&&((n??={...e})[r]=a)}return n??e}function h(e,t){let n=[];for(let r of e??[])g(r,n,t);return n.join(``).trim()}function g(e,t,n){if(!v(e)||e.type===`tag`&&e.tag!==void 0&&o.has(e.tag))return;let r=e.attributes??{},i=r.content;switch(e.type){case`text`:{let e=a.Ast.isVariable(i)?new a.Ast.Variable(i.path).resolve({variables:n.options.variables}):i;typeof e==`string`&&t.push(e);return}case`code`:typeof i==`string`&&t.push(`\`${i}\``);return;case`fence`:{let a=typeof r.language==`string`?r.language:``,o=[];for(let t of e.children??[])g(t,o,n);let s=e.children?.length?o.join(``):i,c=typeof s==`string`?s.replace(/\n$/,``):``;t.push(`\n\`\`\`${a}\n${c}\n\`\`\`\n\n`);return}case`softbreak`:t.push(`
4
+ `).trim()}function m(e,t={}){if(i.Ast.isVariable(e))return Object.hasOwn(t,String(e.path[0]))?new i.Ast.Variable(e.path).resolve({variables:t}):e;if(Array.isArray(e)){let n;for(let r=0;r<e.length;r++){let i=m(e[r],t);i!==e[r]&&((n??=e.slice())[r]=i)}return n??e}if(!v(e)||i.Ast.isAst(e))return e;let n;for(let[r,i]of Object.entries(e)){let a=m(i,t);a!==i&&((n??={...e})[r]=a)}return n??e}function h(e,t){let n=[];for(let r of e??[])g(r,n,t);return n.join(``).trim()}function g(e,t,n){if(!v(e)||e.type===`tag`&&e.tag!==void 0&&o.has(e.tag))return;let r=e.attributes??{},a=r.content;switch(e.type){case`text`:{let e=i.Ast.isVariable(a)?new i.Ast.Variable(a.path).resolve({variables:n.options.variables}):a;typeof e==`string`&&t.push(e);return}case`code`:typeof a==`string`&&t.push(`\`${a}\``);return;case`fence`:{let i=typeof r.language==`string`?r.language:``,o=[];for(let t of e.children??[])g(t,o,n);let s=e.children?.length?o.join(``):a,c=typeof s==`string`?s.replace(/\n$/,``):``;t.push(`\n\`\`\`${i}\n${c}\n\`\`\`\n\n`);return}case`softbreak`:t.push(`
5
5
  `);return;case`hardbreak`:t.push(`
6
6
  `);return;case`hr`:t.push(`
7
7
  ---
@@ -11,5 +11,5 @@ import{getInnerText as e}from"../utils/get-inner-text.js";import{headingSlugger
11
11
  `)}\n\n`);return;case`strong`:t.push(`**${h(e.children,n)}**`);return;case`em`:t.push(`_${h(e.children,n)}_`);return;case`s`:t.push(`~~${h(e.children,n)}~~`);return;case`link`:{let i=typeof r.href==`string`?r.href:``;t.push(`[${h(e.children,n)}](${i})`);return}case`image`:{let e=typeof r.src==`string`?r.src:``,n=typeof r.alt==`string`?r.alt:``;t.push(`![${n}](${e})`);return}case`list`:{let i=r.ordered===!0,a={...n,listDepth:n.listDepth+1,ordered:i,index:0};n.listDepth>0&&t.push(`
12
12
  `);for(let n of e.children??[])g(n,t,a);n.listDepth===0&&t.push(`
13
13
  `);return}case`item`:{n.index+=1;let r=n.ordered?`${n.index}.`:`-`,i=` `.repeat(Math.max(n.listDepth-1,0)),a=h(e.children,{...n,listDepth:n.listDepth,index:0});t.push(`${i}${r} ${a.split(`
14
- `).join(`\n${i} `)}\n`);return}case`table`:t.push(`\n${_(e,n)}\n`);return;case`tag`:{let i=(e.tag===void 0?void 0:n.options.tags?.[e.tag]?.renderForLlms)?.(Object.assign(Object.create(Object.getPrototypeOf(e)),e,{attributes:m(r,n.options.variables)}),{getBody:()=>h(e.children,n),locale:n.options.locale??`en`,translate:n.options.translate??c}),a=e.inline!==!0;if(i!==void 0){i!==``&&t.push(a?`${i}\n\n`:i);return}let o=s.map(e=>r[e]).find(e=>typeof e==`string`);o!==void 0&&t.push(a?`**${o}**\n\n`:`**${o}**${e.children?.length?` `:``}`);break}}for(let r of Object.values(e.slots??{}))g(r,t,n);for(let r of e.children??[])g(r,t,n)}function _(e,t){let n=[],r=(e,i)=>{if(v(e)){if(e.type===`tr`){let r=(e.children??[]).filter(v).map(e=>h(e.children,t).replace(/\|/g,`\\|`).replace(/\n/g,` `));n.push({cells:r,header:i});return}for(let t of e.children??[])r(t,i||e.type===`thead`)}};r(e,!1);let i=[];for(let[e,t]of n.entries())i.push(`| ${t.cells.join(` | `)} |`),e===0&&t.header&&i.push(`| ${t.cells.map(()=>`---`).join(` | `)} |`);return`${i.join(`
14
+ `).join(`\n${i} `)}\n`);return}case`table`:t.push(`\n${_(e,n)}\n`);return;case`tag`:{let i=(e.tag===void 0?void 0:n.options.tags?.[e.tag]?.renderForLlms)?.(Object.assign(Object.create(Object.getPrototypeOf(e)),e,{attributes:m(r,n.options.variables)}),{getBody:()=>h(e.children,n),locale:n.options.locale??`en`,translate:n.options.translate??c}),a=e.inline!==!0;if(i!==void 0){i!==``&&t.push(a?`${i}\n\n`:i);return}let o=s.map(e=>r[e]).find(e=>typeof e==`string`);o!==void 0&&e.tag!==`html`&&t.push(a?`**${o}**\n\n`:`**${o}**${e.children?.length?` `:``}`);break}}for(let r of Object.values(e.slots??{}))g(r,t,n);for(let r of e.children??[])g(r,t,n)}function _(e,t){let n=[],r=(e,i)=>{if(v(e)){if(e.type===`tr`){let r=(e.children??[]).filter(v).map(e=>h(e.children,t).replace(/\|/g,`\\|`).replace(/\n/g,` `));n.push({cells:r,header:i});return}for(let t of e.children??[])r(t,i||e.type===`thead`)}};r(e,!1);let i=[];for(let[e,t]of n.entries())i.push(`| ${t.cells.join(` | `)} |`),e===0&&t.header&&i.push(`| ${t.cells.map(()=>`---`).join(` | `)} |`);return`${i.join(`
15
15
  `)}\n`}function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{l as markdocAstToMarkdownChunks,u as markdocAstToMarkdownDoc};
@@ -1 +1 @@
1
- import{HeadingSlugger as e}from"../utils/heading-slugger.js";import{renderedHeadingText as t}from"../utils/heading-text.js";import{hidesBodyFromSearch as n,markdocAstToText as r}from"./to-text.js";import{isNonControlVariant as i}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as a}from"@redocly/theme/markdoc/tags/visibility";const o=`-team-`,s=RegExp(`^(page|section-\\d+)${o}\\d+$`);function c(e){return s.test(e)}function l(n,i,a={}){let s=y(n)&&Array.isArray(n.children)?n.children:[],c=new e,l={title:i,body:[]},d=[],f=l,p=!1,m=[],_=e=>{let n=e.attributes?.id;return typeof n==`string`?n:c.slug(t(e,a))};for(let e of g(s)){if(!y(e)||e.type!==`heading`){f.body.push(e);for(let t of v(e))_(t);continue}let n=t(e,a),r=_(e),o=h(e);if(o===1){!p&&n!==``&&(l.title=n,p=!0),f=l,m.length=0;continue}let s=n||i,c=m.slice(0,o).filter(e=>e!==void 0);m.length=o,m[o]=s;let u={anchor:r,title:s,ancestors:c,body:[]};d.push(u),f=u}let b=e=>r({type:`document`,children:e}),x=(e,t)=>[e,...u(t).map(({teams:t,children:n},r)=>({...e,docKey:`${e.docKey}${o}${r+1}`,text:b(n),rbacTeams:t})).filter(e=>e.text!==``)];return[...x({docKey:`page`,title:l.title,text:b(l.body)},l.body),...d.flatMap((e,t)=>x({docKey:`section-${t+1}`,anchor:e.anchor,title:e.title,text:b(e.body),path:[l.title,...e.ancestors,e.title]},e.body))]}function u(e){let t=[],r=(e,i)=>{if(y(e)&&!n(e)){if(e.type===`tag`&&e.tag===`if`){let n=d(e.attributes?.primary);if(n===void 0)return;let a=i===void 0?n:n.filter(e=>i.includes(e));if(a.length===0)return;let o=e.children??[],s=o.findIndex(e=>y(e)&&e.type===`tag`&&e.tag===`else`),c=s===-1?o:o.slice(0,s);t.push({teams:a,children:c});for(let e of c)r(e,a);return}for(let t of Object.values(e.slots??{}))r(t,i);for(let t of e.children??[])r(t,i)}};for(let t of e)r(t,void 0);return t}function d(e){if(!p(e))return;let t=Object.values(e.parameters??{});if(e.name===`includes`){let e=f(t);return e===void 0?void 0:[e]}if(e.name!==`or`)return;let n=t.map(e=>p(e)&&e.name===`includes`?f(Object.values(e.parameters??{})):void 0).filter(e=>e!==void 0);return n.length===0?void 0:n}function f([e,t]){let n=m(e,`Variable`)?e.path:void 0;return Array.isArray(n)&&n.length===2&&n[0]===`rbac`&&n[1]===`teams`&&typeof t==`string`&&t!==`*`?t:void 0}function p(e){return m(e,`Function`)}function m(e,t){return typeof e==`object`&&!!e&&e.$$mdtype===t}function h(e){let t=e.attributes?.level;return typeof t==`number`?t:2}function*g(e){for(let t of e)y(t)&&t.type===`tag`&&t.tag===`html`&&_(t)?yield*g(t.children??[]):yield t}function _(e){return!v(e).next().done}function*v(e){if(!(!y(e)||a(e)||i(e))){for(let t of e.children??[])y(t)&&t.type===`heading`&&(yield t),yield*v(t);for(let t of Object.values(e.slots??{}))yield*v(t)}}function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{o as TEAM_BLOCK_KEY_MARKER,c as isTeamBlockKey,l as markdocAstToSearchSections};
1
+ import{HeadingSlugger as e}from"../utils/heading-slugger.js";import{hidesBodyFromSearch as t,markdocAstToText as n}from"./to-text.js";import{renderedHeadingText as r}from"../utils/heading-text.js";import{isNonControlVariant as i}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as a}from"@redocly/theme/markdoc/tags/visibility";const o=`-team-`,s=RegExp(`^(page|section-\\d+)${o}\\d+$`);function c(e){return s.test(e)}function l(t,i,a={}){let s=y(t)&&Array.isArray(t.children)?t.children:[],c=new e,l={title:i,body:[]},d=[],f=l,p=!1,m=[],_=e=>{let t=e.attributes?.id;return typeof t==`string`?t:c.slug(r(e,a))};for(let e of g(s)){if(!y(e)||e.type!==`heading`){f.body.push(e);for(let t of v(e))_(t);continue}let t=r(e,a),n=_(e),o=h(e);if(o===1){!p&&t!==``&&(l.title=t,p=!0),f=l,m.length=0;continue}let s=t||i,c=m.slice(0,o).filter(e=>e!==void 0);m.length=o,m[o]=s;let u={anchor:n,title:s,ancestors:c,body:[]};d.push(u),f=u}let b=e=>n({type:`document`,children:e}),x=(e,t)=>[e,...u(t).map(({teams:t,children:n},r)=>({...e,docKey:`${e.docKey}${o}${r+1}`,text:b(n),rbacTeams:t})).filter(e=>e.text!==``)];return[...x({docKey:`page`,title:l.title,text:b(l.body)},l.body),...d.flatMap((e,t)=>x({docKey:`section-${t+1}`,anchor:e.anchor,title:e.title,text:b(e.body),path:[l.title,...e.ancestors,e.title]},e.body))]}function u(e){let n=[],r=(e,i)=>{if(y(e)&&!t(e)){if(e.type===`tag`&&e.tag===`if`){let t=d(e.attributes?.primary);if(t===void 0)return;let a=i===void 0?t:t.filter(e=>i.includes(e));if(a.length===0)return;let o=e.children??[],s=o.findIndex(e=>y(e)&&e.type===`tag`&&e.tag===`else`),c=s===-1?o:o.slice(0,s);n.push({teams:a,children:c});for(let e of c)r(e,a);return}for(let t of Object.values(e.slots??{}))r(t,i);for(let t of e.children??[])r(t,i)}};for(let t of e)r(t,void 0);return n}function d(e){if(!p(e))return;let t=Object.values(e.parameters??{});if(e.name===`includes`){let e=f(t);return e===void 0?void 0:[e]}if(e.name!==`or`)return;let n=t.map(e=>p(e)&&e.name===`includes`?f(Object.values(e.parameters??{})):void 0).filter(e=>e!==void 0);return n.length===0?void 0:n}function f([e,t]){let n=m(e,`Variable`)?e.path:void 0;return Array.isArray(n)&&n.length===2&&n[0]===`rbac`&&n[1]===`teams`&&typeof t==`string`&&t!==`*`?t:void 0}function p(e){return m(e,`Function`)}function m(e,t){return typeof e==`object`&&!!e&&e.$$mdtype===t}function h(e){let t=e.attributes?.level;return typeof t==`number`?t:2}function*g(e){for(let t of e)y(t)&&t.type===`tag`&&t.tag===`html`&&_(t)?yield*g(t.children??[]):yield t}function _(e){return!v(e).next().done}function*v(e){if(!(!y(e)||a(e)||i(e))){for(let t of e.children??[])y(t)&&t.type===`heading`&&(yield t),yield*v(t);for(let t of Object.values(e.slots??{}))yield*v(t)}}function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{o as TEAM_BLOCK_KEY_MARKER,c as isTeamBlockKey,l as markdocAstToSearchSections};
@@ -1,5 +1,5 @@
1
- import{PROMPT_TAG as e}from"@redocly/theme/core/constants";import{VARIANT_TAG as t,isNonControlVariant as n}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as r}from"@redocly/theme/markdoc/tags/visibility";const i=/* @__PURE__ */ new Set([`document`,`paragraph`,`heading`,`blockquote`,`fence`,`list`,`item`,`table`,`thead`,`tbody`,`tr`,`hr`,`tag`]),a=/* @__PURE__ */ new Set([`if`,`else`]),o=[`title`,`name`,`label`],s=[...o,`text`];function c(e){return l(e,s)}function l(e,t){let n=[];return f(e,n,t),n.join(``).replace(/[ \t]+/g,` `).replace(/(?<!\s)\s*\n\s*/g,`
2
- `).trim()}function u(e){let t=[e];for(;t.length>0;){let e=t.pop();if(m(e)&&!d(e)){if(e.type===`heading`){let t=l({type:`paragraph`,children:e.children??[]},o);return t===``?null:t}t.push(...[...e.children??[]].reverse())}}return null}function d(t){return r(t)||n(t)||t.type===`tag`&&t.tag===e}function f(n,r,o){if(!m(n)||n.type===`tag`&&n.tag!==void 0&&a.has(n.tag))return;if(d(n)){n.tag===e&&p(n,r);return}let s=n.attributes?.content;if(n.type===`text`||n.type===`code`||n.type===`fence`){typeof s==`string`&&r.push(s),n.type===`fence`&&r.push(`
3
- `);return}if(n.type===`softbreak`||n.type===`hardbreak`){r.push(`
4
- `);return}if(n.type===`image`){let e=n.attributes?.alt;typeof e==`string`&&r.push(e);return}if(n.type===`tag`&&n.tag!==`html`&&n.tag!==t){let e=o.find(e=>typeof n.attributes?.[e]==`string`);e!==void 0&&r.push(`${n.attributes?.[e]}\n`)}for(let e of Object.values(n.slots??{}))f(e,r,o);for(let e of n.children??[])f(e,r,o);n.type!==void 0&&i.has(n.type)?r.push(`
5
- `):(n.type===`td`||n.type===`th`)&&r.push(` `)}function p(e,t){let n=e.attributes?.title;typeof n==`string`&&n!==``&&t.push(`${n}\n`)}function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{d as hidesBodyFromSearch,c as markdocAstToText,u as markdocFirstHeading};
1
+ import{VARIANT_TAG as e,isNonControlVariant as t}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as n}from"@redocly/theme/markdoc/tags/visibility";import{PROMPT_TAG as r}from"@redocly/theme/core/constants";const i=/* @__PURE__ */ new Set([`document`,`paragraph`,`heading`,`blockquote`,`fence`,`list`,`item`,`table`,`thead`,`tbody`,`tr`,`hr`,`tag`]),a=/* @__PURE__ */ new Set([`if`,`else`]),o=[`title`,`name`,`label`],s=[...o,`text`];function c(e){return l(e,s)}function l(e,t){let n=[];return f(e,n,t),n.join(``).replace(/[ \t]+/g,` `).replace(/(?<!\s)\s*\n\s*/g,`
2
+ `).trim()}function u(e){let t=[e];for(;t.length>0;){let e=t.pop();if(m(e)&&!d(e)){if(e.type===`heading`){let t=l({type:`paragraph`,children:e.children??[]},o);return t===``?null:t}t.push(...[...e.children??[]].reverse())}}return null}function d(e){return n(e)||t(e)||e.type===`tag`&&e.tag===r}function f(t,n,o){if(!m(t)||t.type===`tag`&&t.tag!==void 0&&a.has(t.tag))return;if(d(t)){t.tag===r&&p(t,n);return}let s=t.attributes?.content;if(t.type===`text`||t.type===`code`||t.type===`fence`){typeof s==`string`&&n.push(s),t.type===`fence`&&n.push(`
3
+ `);return}if(t.type===`softbreak`||t.type===`hardbreak`){n.push(`
4
+ `);return}if(t.type===`image`){let e=t.attributes?.alt;typeof e==`string`&&n.push(e);return}if(t.type===`tag`&&t.tag!==`html`&&t.tag!==e){let e=o.find(e=>typeof t.attributes?.[e]==`string`);e!==void 0&&n.push(`${t.attributes?.[e]}\n`)}for(let e of Object.values(t.slots??{}))f(e,n,o);for(let e of t.children??[])f(e,n,o);t.type!==void 0&&i.has(t.type)?n.push(`
5
+ `):(t.type===`td`||t.type===`th`)&&n.push(` `)}function p(e,t){let n=e.attributes?.title;typeof n==`string`&&n!==``&&t.push(`${n}\n`)}function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{d as hidesBodyFromSearch,c as markdocAstToText,u as markdocFirstHeading};
@@ -1 +1 @@
1
- import{isObject as e}from"../../../shared/utils/is-object.js";import"../../../shared/constants/content-assets.js";import{stampHeadingIndexes as t}from"../utils/collect-headings.js";import{builtInMarkdocFunctions as n,rbacTeamList as r}from"../constants/builtin-functions.js";import{headingSlugger as i}from"../utils/heading-slugger.js";import{resolveMarkdocTagSet as a}from"../constants/tag-sets.js";import{joinSrcSet as o,parseSrcSet as s}from"../../plugins/internal/assets/srcset.js";import{isPackedMarkdocAst as c,unpackMarkdocAst as l}from"../../../shared/utils/packed-ast.js";import{getPublicEnv as u}from"../../../shared/public-env.js";import{frontmatterVariable as d}from"../utils/frontmatter-variable.js";import f from"@redocly/markdoc";function p(e){let t=e.viewer,n=t?.isAuthenticated===!0;return{userAgent:n?e.userAgent:null,userIp:n?e.ip:null,remoteAddr:{ipAddress:n?e.ip:null},rbac:{teams:r(e.teams)},user:t?.isAuthenticated?{isAuthenticated:!0,name:t.name??null,email:t.email??null,teams:t.teams}:{isAuthenticated:!1,name:null,email:null,teams:[]}}}function m(e){let t=e=>{Array.isArray(e)?e.forEach(t):f.Tag.isTag(e)&&(e.children=e.children.map(e=>typeof e==`object`&&e&&!f.Tag.isTag(e)?JSON.stringify(e,null,2):(t(e),e)))};return t(e),e}function h(e){return!!e&&typeof e==`object`&&e.$$mdtype===`Node`}function g(e){return f.Ast.fromJSON(e)}function _(e){return e.includes(`"$$mdtype":"Node"`)||e.includes(`"$$mdpack":`)?{}:null}async function v(r,i,o,s,c){let{tags:l,nodes:d,functions:f}=await a(i.tagSet,c),m=x(r,{functions:f??n,tags:l,nodes:d,variables:{...p(o),env:u(),frontmatter:b(r),lang:s}});e(m)&&m.ast&&t(m.ast);let h=i.l10nAssets?.[s];return h?y(m,h):m}function y(e,t){let n=e=>{if(!e.includes(`/content-assets`))return e;let n=s(e);if(!n||n.length===0)return e;let r=!1,i=n.map(e=>{let n=e.src.search(/[?#]/),i=t[n===-1?e.src:e.src.slice(0,n)];return i===void 0?e:(r=!0,e.src=n===-1?i:`${i}${e.src.slice(n)}`,e)});return r?o(i):e},r=e=>{if(typeof e==`string`)return n(e);if(Array.isArray(e)){let t=!1,n=e.map(e=>{let n=r(e);return t||=n!==e,n});return t?n:e}if(e&&typeof e==`object`){let t=!1,n=Object.entries(e).map(([e,n])=>{let i=r(n);return t||=i!==n,[e,i]});return t?Object.fromEntries(n):e}return e},i=e=>{f.Tag.isTag(e)?(e.attributes=r(e.attributes),e.children.forEach(i)):Array.isArray(e)?e.forEach(i):e&&typeof e==`object`&&Object.values(e).forEach(i)};return i(e),e}function b(t){return e(t)?d(e(t.frontmatter)?t.frontmatter:{},t.title):{}}function x(e,t){i.reset();let n=e=>e instanceof f.Ast.Node,r=e=>{if(n(e))return m(f.transform(e,t));if(c(e)){let n=l(e);return m(f.transform(n,t))}if(h(e))return m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t));if(Array.isArray(e))return e.length>0&&e.every(n)?m(f.transform(e,t)):e.length>0&&e.every(h)?m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t)):e.map(r);if(e&&typeof e==`object`){let t={};for(let[n,i]of Object.entries(e))t[n]=r(i);return t}return e};return r(e)}export{p as buildMarkdownRuntimeVariables,_ as detectMarkdocPayloadFlag,h as isMarkdocAstNode,y as localizeMarkdocAssetUrls,g as parseMarkdocPayloadDeep,x as transformMarkdocDeep,v as transformMarkdocPayload};
1
+ import"../../../shared/constants/content-assets.js";import{getPublicEnv as e}from"../../../shared/public-env.js";import{builtInMarkdocFunctions as t,rbacTeamList as n}from"../constants/builtin-functions.js";import{isObject as r}from"../../../shared/utils/is-object.js";import{headingSlugger as i}from"../utils/heading-slugger.js";import{resolveMarkdocTagSet as a}from"../constants/tag-sets.js";import{isPackedMarkdocAst as o,unpackMarkdocAst as s}from"../../../shared/utils/packed-ast.js";import{joinSrcSet as c,parseSrcSet as l}from"../../plugins/internal/assets/srcset.js";import{frontmatterVariable as u}from"../utils/frontmatter-variable.js";import{stampHeadingIndexes as d}from"../utils/collect-headings.js";import f from"@redocly/markdoc";function p(e){let t=e.viewer,r=t?.isAuthenticated===!0;return{userAgent:r?e.userAgent:null,userIp:r?e.ip:null,remoteAddr:{ipAddress:r?e.ip:null},rbac:{teams:n(e.teams)},user:t?.isAuthenticated?{isAuthenticated:!0,name:t.name??null,email:t.email??null,teams:t.teams}:{isAuthenticated:!1,name:null,email:null,teams:[]}}}function m(e){let t=e=>{Array.isArray(e)?e.forEach(t):f.Tag.isTag(e)&&(e.children=e.children.map(e=>typeof e==`object`&&e&&!f.Tag.isTag(e)?JSON.stringify(e,null,2):(t(e),e)))};return t(e),e}function h(e){return!!e&&typeof e==`object`&&e.$$mdtype===`Node`}function g(e){return f.Ast.fromJSON(e)}function _(e){return e.includes(`"$$mdtype":"Node"`)||e.includes(`"$$mdpack":`)?{}:null}async function v(n,i,o,s,c){let{tags:l,nodes:u,functions:f}=await a(i.tagSet,c),m=x(n,{functions:f??t,tags:l,nodes:u,variables:{...p(o),env:e(),frontmatter:b(n),lang:s}});r(m)&&m.ast&&d(m.ast);let h=i.l10nAssets?.[s];return h?y(m,h):m}function y(e,t){let n=e=>{if(!e.includes(`/content-assets`))return e;let n=l(e);if(!n||n.length===0)return e;let r=!1,i=n.map(e=>{let n=e.src.search(/[?#]/),i=t[n===-1?e.src:e.src.slice(0,n)];return i===void 0?e:(r=!0,e.src=n===-1?i:`${i}${e.src.slice(n)}`,e)});return r?c(i):e},r=e=>{if(typeof e==`string`)return n(e);if(Array.isArray(e)){let t=!1,n=e.map(e=>{let n=r(e);return t||=n!==e,n});return t?n:e}if(e&&typeof e==`object`){let t=!1,n=Object.entries(e).map(([e,n])=>{let i=r(n);return t||=i!==n,[e,i]});return t?Object.fromEntries(n):e}return e},i=e=>{f.Tag.isTag(e)?(e.attributes=r(e.attributes),e.children.forEach(i)):Array.isArray(e)?e.forEach(i):e&&typeof e==`object`&&Object.values(e).forEach(i)};return i(e),e}function b(e){return r(e)?u(r(e.frontmatter)?e.frontmatter:{},e.title):{}}function x(e,t){i.reset();let n=e=>e instanceof f.Ast.Node,r=e=>{if(n(e))return m(f.transform(e,t));if(o(e)){let n=s(e);return m(f.transform(n,t))}if(h(e))return m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t));if(Array.isArray(e))return e.length>0&&e.every(n)?m(f.transform(e,t)):e.length>0&&e.every(h)?m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t)):e.map(r);if(e&&typeof e==`object`){let t={};for(let[n,i]of Object.entries(e))t[n]=r(i);return t}return e};return r(e)}export{p as buildMarkdownRuntimeVariables,_ as detectMarkdocPayloadFlag,h as isMarkdocAstNode,y as localizeMarkdocAssetUrls,g as parseMarkdocPayloadDeep,x as transformMarkdocDeep,v as transformMarkdocPayload};
@@ -1 +1 @@
1
- import{splitUrlSuffix as e}from"../../shared/utils/routes/split-url-suffix.js";import{findServingRoute as t,looksLikeMarkdown as n,resolveImageReference as r,resolveImageSrcSet as i,resolveLocalReference as a}from"./resolve/references.js";import{toVersionlessSlug as o}from"../versions/redirect.js";import{parseMarkdownCached as s}from"./utils/parse-cache.js";function c(e){return{disabledTags:e.disabledTags??/* @__PURE__ */ new Set,contentLocales:e.contentLocales??[],hasPageRoute:t=>e.state.primaryRouteByFilePath.has(t),pageRouteSlug:t=>e.state.primaryRouteByFilePath.get(t),looksLikeMarkdown:n,parseCached:s,resolveLocalReference:async(t,n,r)=>l(await a(t,n,e.state,e.resolveAudienceTag,e.contentLocales,r),e.state,e.defaultVersion),resolveImageReference:(t,n)=>r(t,n,e.state,e.resolveAudienceTag,e.contentLocales),resolveImageSrcSet:(t,n)=>i(t,n,e.state,e.resolveAudienceTag,e.contentLocales)}}async function l(n,r,i){if(n.result.kind!==`pageUrl`||i===void 0)return n;let{path:a,suffix:s}=e(n.result.url),c=t(r,a);if(!c?.versionGroup||!c.version)return n;let{versionGroup:l,version:u,locale:d}=c;if(await i(l)!==u)return n;let f=o(a,l,u,d);return f===a||r.routeBySlug.has(f)?n:{...n,result:{kind:`pageUrl`,url:`${f}${s}`}}}export{c as createMarkdownService};
1
+ import{splitUrlSuffix as e}from"../../shared/utils/routes/split-url-suffix.js";import{parseMarkdownCached as t}from"./utils/parse-cache.js";import{findServingRoute as n,looksLikeMarkdown as r,resolveImageReference as i,resolveImageSrcSet as a,resolveLocalReference as o}from"./resolve/references.js";import{toVersionlessSlug as s}from"../versions/redirect.js";function c(e){return{disabledTags:e.disabledTags??/* @__PURE__ */ new Set,contentLocales:e.contentLocales??[],hasPageRoute:t=>e.state.primaryRouteByFilePath.has(t),pageRouteSlug:t=>e.state.primaryRouteByFilePath.get(t),looksLikeMarkdown:r,parseCached:t,resolveLocalReference:async(t,n,r)=>l(await o(t,n,e.state,e.resolveAudienceTag,e.contentLocales,r),e.state,e.defaultVersion),resolveImageReference:(t,n)=>i(t,n,e.state,e.resolveAudienceTag,e.contentLocales),resolveImageSrcSet:(t,n)=>a(t,n,e.state,e.resolveAudienceTag,e.contentLocales)}}async function l(t,r,i){if(t.result.kind!==`pageUrl`||i===void 0)return t;let{path:a,suffix:o}=e(t.result.url),c=n(r,a);if(!c?.versionGroup||!c.version)return t;let{versionGroup:l,version:u,locale:d}=c;if(await i(l)!==u)return t;let f=s(a,l,u,d);return f===a||r.routeBySlug.has(f)?t:{...t,result:{kind:`pageUrl`,url:`${f}${o}`}}}export{c as createMarkdownService};
@@ -1 +1 @@
1
- import{headingSlugger as e}from"../utils/heading-slugger.js";import{variant as t}from"@redocly/theme/markdoc/tags/variant";import n from"@redocly/markdoc";import{CONTROL as r}from"@redocly/theme/core/constants/experiments";const i={...t.schema,transform(i,a){let o=()=>new n.Tag(t.schema.render,i.transformAttributes(a),i.transformChildren(a)),{name:s}=i.attributes;return typeof s==`string`&&s!==r?e.withScope(s,o):o()}};export{i as variant};
1
+ import{headingSlugger as e}from"../utils/heading-slugger.js";import t from"@redocly/markdoc";import{variant as n}from"@redocly/theme/markdoc/tags/variant";import{CONTROL as r}from"@redocly/theme/core/constants/experiments";const i={...n.schema,transform(i,a){let o=()=>new t.Tag(n.schema.render,i.transformAttributes(a),i.transformChildren(a)),{name:s}=i.attributes;return typeof s==`string`&&s!==r?e.withScope(s,o):o()}};export{i as variant};
@@ -1 +1 @@
1
- import{headingSlugger as e}from"./heading-slugger.js";import{builtInMarkdocTags as t}from"../constants/builtin-tags.js";import{renderedHeadingText as n}from"./heading-text.js";import{walkMarkdocAst as r}from"./walk-markdoc-ast.js";import{isNonControlVariant as i}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as a}from"@redocly/theme/markdoc/tags/visibility";import{detailsAnchorId as o}from"@redocly/theme/core/utils/details";function s(t,o={}){e.reset();let s=[],f=!0,m=e=>a(e)||i(e);for(let i of r(t,{skipChildren:m})){let t=(i.type===`tag`&&i.tag===`html`?u(i):[i.attributes.id]).filter(e=>typeof e==`string`);if(t.length>0){s.push(...t);continue}if(i.type===`tag`&&i.tag===`accordion`){let{title:e}=i.attributes;typeof e==`string`&&l(s,e);continue}if(c(i,`details`)){let e=i.children.find(e=>c(e,`summary`));e!==void 0&&!d(e,o)&&(p(e)&&(f=!1),l(s,n(e,o)));continue}i.type!==`heading`||d(i,o)||(p(i)&&(f=!1),s.push(e.slug(n(i,o))))}return{ids:[...new Set(s)],exhaustive:f}}function c(e,t){return e.type===`tag`&&e.tag===`html`&&String(e.attributes.name).toLowerCase()===t}function l(e,t){t.trim()!==``&&e.push(o(t))}function u(e){let t=e.attributes.attrs;if(typeof t!=`object`||!t)return[];let{id:n,name:r}=t;return String(e.attributes.name).toLowerCase()===`a`?[n,r]:[n]}function d(e,t){for(let n of r(e))if(f(n.attributes,t))return!0;return!1}function f(e,t){if(Array.isArray(e))return e.some(e=>f(e,t));if(typeof e!=`object`||!e)return!1;let n=e.$$mdtype;if(n===`Variable`){let[n]=e.path??[];return typeof n!=`string`||!(n in t)}return n===`Function`||n===void 0&&Object.values(e).some(e=>f(e,t))}function p(e){for(let n of r(e))if(n.type===`tag`&&typeof n.tag==`string`&&!(n.tag in t))return!0;return!1}export{s as collectAnchors};
1
+ import{headingSlugger as e}from"./heading-slugger.js";import{builtInMarkdocTags as t}from"../constants/builtin-tags.js";import{walkMarkdocAst as n}from"./walk-markdoc-ast.js";import{renderedHeadingText as r}from"./heading-text.js";import{isNonControlVariant as i}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as a}from"@redocly/theme/markdoc/tags/visibility";import{detailsAnchorId as o}from"@redocly/theme/core/utils/details";function s(t,o={}){e.reset();let s=[],f=!0,m=e=>a(e)||i(e);for(let i of n(t,{skipChildren:m})){let t=(i.type===`tag`&&i.tag===`html`?u(i):[i.attributes.id]).filter(e=>typeof e==`string`);if(t.length>0){s.push(...t);continue}if(i.type===`tag`&&i.tag===`accordion`){let{title:e}=i.attributes;typeof e==`string`&&l(s,e);continue}if(c(i,`details`)){let e=i.children.find(e=>c(e,`summary`));e!==void 0&&!d(e,o)&&(p(e)&&(f=!1),l(s,r(e,o)));continue}i.type!==`heading`||d(i,o)||(p(i)&&(f=!1),s.push(e.slug(r(i,o))))}return{ids:[...new Set(s)],exhaustive:f}}function c(e,t){return e.type===`tag`&&e.tag===`html`&&String(e.attributes.name).toLowerCase()===t}function l(e,t){t.trim()!==``&&e.push(o(t))}function u(e){let t=e.attributes.attrs;if(typeof t!=`object`||!t)return[];let{id:n,name:r}=t;return String(e.attributes.name).toLowerCase()===`a`?[n,r]:[n]}function d(e,t){for(let r of n(e))if(f(r.attributes,t))return!0;return!1}function f(e,t){if(Array.isArray(e))return e.some(e=>f(e,t));if(typeof e!=`object`||!e)return!1;let n=e.$$mdtype;if(n===`Variable`){let[n]=e.path??[];return typeof n!=`string`||!(n in t)}return n===`Function`||n===void 0&&Object.values(e).some(e=>f(e,t))}function p(e){for(let r of n(e))if(r.type===`tag`&&typeof r.tag==`string`&&!(r.tag in t))return!0;return!1}export{s as collectAnchors};
@@ -1 +1 @@
1
- import{markdocFirstHeading as e}from"../search/to-text.js";import{parseMarkdownFirstHeading as t}from"./parse-cache.js";import{PROMPT_TAG as n}from"@redocly/theme/core/constants";import{isNonControlVariant as r}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as i}from"@redocly/theme/markdoc/tags/visibility";function a(a){return e(t(a,e=>e.tag===n||i(e)||r(e)))}export{a as markdownFirstHeading};
1
+ import{parseMarkdownFirstHeading as e}from"./parse-cache.js";import{markdocFirstHeading as t}from"../search/to-text.js";import{isNonControlVariant as n}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as r}from"@redocly/theme/markdoc/tags/visibility";import{PROMPT_TAG as i}from"@redocly/theme/core/constants";function a(a){return t(e(a,e=>e.tag===i||r(e)||n(e)))}export{a as markdownFirstHeading};
@@ -1,8 +1,12 @@
1
1
  import Markdoc, { type Node as MarkdocNode } from '@redocly/markdoc';
2
2
  export type ParsedMarkdown = ReturnType<typeof Markdoc.parse>;
3
+ export type MarkdownParseMode = {
4
+ /** `false` keeps raw HTML as literal text instead of `html` tags. Default `true`. */
5
+ html?: boolean;
6
+ };
3
7
  export declare function parseMarkdown(rawSource: string): ParsedMarkdown;
4
8
  /** A page's own AST, `{% markdoc-example %}` bodies included; the caller may change it. */
5
- export declare function parseMarkdownDocument(rawSource: string): ParsedMarkdown;
9
+ export declare function parseMarkdownDocument(rawSource: string, mode?: MarkdownParseMode): ParsedMarkdown;
6
10
  /** A parser with its own LRU cache. Default cost of 1 per entry → the budget is a max entry count. */
7
11
  export declare function createCachedMarkdownParser(options: {
8
12
  budget: number;
@@ -1 +1 @@
1
- import{MARKDOC_ERROR_TAG as e}from"../tags/markdoc-error.js";import{createLruCache as t}from"../../../shared/utils/lru-cache.js";import{hashBlobContent as n}from"../../materialization/data-ref.js";import{reparseExampleFences as r}from"./reparse-example-fences.js";import i from"@redocly/markdoc";import{htmlTags as a}from"@redocly/markdoc/html";const o={html:a({errorTag:e,headings:!0}),allowIndentation:!0,allowComments:!0,slots:!0};function s(e){return i.parse(e,o)}function c(e){let t=s(e);return r(t,e,s),t}function l(e){let r=t(e);return e=>{let t=n(e),i=r.get(t);if(i!==void 0)return i;let a=c(e);return r.set(t,a),a}}function u(e,t){return i.parseFirstHeading(e,{...o,skip:t})}const d=l({budget:100});export{l as createCachedMarkdownParser,s as parseMarkdown,d as parseMarkdownCached,c as parseMarkdownDocument,u as parseMarkdownFirstHeading};
1
+ import{MARKDOC_ERROR_TAG as e}from"../tags/markdoc-error.js";import{hashBlobContent as t}from"../../materialization/data-ref.js";import{createLruCache as n}from"../../../shared/utils/lru-cache.js";import{reparseExampleFences as r}from"./reparse-example-fences.js";import i from"@redocly/markdoc";import{htmlTags as a}from"@redocly/markdoc/html";const o={html:a({errorTag:e,headings:!0}),allowIndentation:!0,allowComments:!0,slots:!0},s={...o,html:void 0};function c(e){return i.parse(e,o)}function l(e,t){let n=t?.html===!1?s:o,a=e=>i.parse(e,n),c=a(e);return r(c,e,a),c}function u(e){let r=n(e);return e=>{let n=t(e),i=r.get(n);if(i!==void 0)return i;let a=l(e);return r.set(n,a),a}}function d(e,t){return i.parseFirstHeading(e,{...o,skip:t})}const f=u({budget:100});export{u as createCachedMarkdownParser,c as parseMarkdown,f as parseMarkdownCached,l as parseMarkdownDocument,d as parseMarkdownFirstHeading};
@@ -1 +1 @@
1
- import{getContentAssetsOutputDir as e}from"../../shared/constants/runtime-layout.js";import{garbageCollectOrphanAssets as t}from"../database/assets.js";import{buildContentAssetUrl as n,deriveContentAssetFilename as r}from"../plugins/internal/assets/url.js";import{dirname as i,join as a}from"node:path";async function o(e,t,n){await e.mkdir(i(t),{recursive:!0});let r=`${t}.tmp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;await n(r),await e.rename(r,t)}async function s(t,n){let{usage:i}=n,s=n.filename??r(i.path,i.hash,i.tag),c=a(n.contentDir,i.path),l=a(e(n.contentDir),s);if(!await t.exists(c))return null;let u={path:i.path,hash:i.hash,kind:i.kind,filename:s};try{if(await t.exists(l))return u;await o(t,l,e=>t.copyFile(c,e))}catch(e){if(e instanceof Error&&/EACCES|EPERM/.test(e.message))return u;throw e}return u}async function c(e,n){let{removed:r,orphanedFilenames:i}=await t(n.database,{logger:n.logger});return await u(e,{...n,filenames:i}),{removedRows:r.length,sweptFilenames:i}}async function l(e,t){await u(e,t)}async function u(t,n){let r=e(n.contentDir);await Promise.all(n.filenames.map(e=>t.unlink(a(r,e)).catch(t=>{d(t)||n.logger?.warn(`Could not remove a published content asset`,{filename:e,error:t instanceof Error?t.message:String(t)})})))}function d(e){return e instanceof Error&&/ENOENT|NotFoundError/.test(`${e.name} ${e.message}`)}async function f(t,n){let r=[],i=[],a=[];if(n.registered.length===0)return{restored:r,missingSources:i,failed:a};let o=/* @__PURE__ */ new Set;try{for(let r of await t.readdir(e(n.contentDir)))o.add(r.name)}catch{}let c=/* @__PURE__ */ new Map;for(let e of n.registered)o.has(e.filename)||c.set(e.filename,e);let l=[...c];for(let e=0;e<l.length;e+=16)await Promise.all(l.slice(e,e+16).map(async([e,o])=>{try{let a=await s(t,{contentDir:n.contentDir,filename:e,usage:{path:o.path,hash:o.hash,kind:o.kind===`image`?`image`:`file`}});a?r.push(a.filename):i.push(o.path)}catch{a.push(o.path)}}));return{restored:r,missingSources:i,failed:a}}function p(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(`${n.path}|${n.hash}`,n);return[...t.values()]}function m(e){let t;for(let r of e)r.l10n&&(t??={},(t[r.l10n.locale]??={})[r.l10n.canonicalUrl]=n(r.path,r.hash,r.tag));return t}export{m as buildL10nAssetMap,p as dedupeAssetUsages,c as garbageCollectOrphanAssetFiles,s as reconcileAsset,l as removeReplacedAssetFiles,f as restoreMissingAssetFiles,o as writeFileAtomically};
1
+ import{buildContentAssetUrl as e,deriveContentAssetFilename as t}from"../plugins/internal/assets/url.js";import{getContentAssetsOutputDir as n}from"../../shared/constants/runtime-layout.js";import{garbageCollectOrphanAssets as r}from"../database/assets.js";import{dirname as i,join as a}from"node:path";async function o(e,t,n){await e.mkdir(i(t),{recursive:!0});let r=`${t}.tmp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;await n(r),await e.rename(r,t)}async function s(e,r){let{usage:i}=r,s=r.filename??t(i.path,i.hash,i.tag),c=a(r.contentDir,i.path),l=a(n(r.contentDir),s);if(!await e.exists(c))return null;let u={path:i.path,hash:i.hash,kind:i.kind,filename:s};try{if(await e.exists(l))return u;await o(e,l,t=>e.copyFile(c,t))}catch(e){if(e instanceof Error&&/EACCES|EPERM/.test(e.message))return u;throw e}return u}async function c(e,t){let{removed:n,orphanedFilenames:i}=await r(t.database,{logger:t.logger});return await u(e,{...t,filenames:i}),{removedRows:n.length,sweptFilenames:i}}async function l(e,t){await u(e,t)}async function u(e,t){let r=n(t.contentDir);await Promise.all(t.filenames.map(n=>e.unlink(a(r,n)).catch(e=>{d(e)||t.logger?.warn(`Could not remove a published content asset`,{filename:n,error:e instanceof Error?e.message:String(e)})})))}function d(e){return e instanceof Error&&/ENOENT|NotFoundError/.test(`${e.name} ${e.message}`)}async function f(e,t){let r=[],i=[],a=[];if(t.registered.length===0)return{restored:r,missingSources:i,failed:a};let o=/* @__PURE__ */ new Set;try{for(let r of await e.readdir(n(t.contentDir)))o.add(r.name)}catch{}let c=/* @__PURE__ */ new Map;for(let e of t.registered)o.has(e.filename)||c.set(e.filename,e);let l=[...c];for(let n=0;n<l.length;n+=16)await Promise.all(l.slice(n,n+16).map(async([n,o])=>{try{let a=await s(e,{contentDir:t.contentDir,filename:n,usage:{path:o.path,hash:o.hash,kind:o.kind===`image`?`image`:`file`}});a?r.push(a.filename):i.push(o.path)}catch{a.push(o.path)}}));return{restored:r,missingSources:i,failed:a}}function p(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(`${n.path}|${n.hash}`,n);return[...t.values()]}function m(t){let n;for(let r of t)r.l10n&&(n??={},(n[r.l10n.locale]??={})[r.l10n.canonicalUrl]=e(r.path,r.hash,r.tag));return n}export{m as buildL10nAssetMap,p as dedupeAssetUsages,c as garbageCollectOrphanAssetFiles,s as reconcileAsset,l as removeReplacedAssetFiles,f as restoreMissingAssetFiles,o as writeFileAtomically};
@@ -1 +1 @@
1
- import{hashJsonValue as e}from"../database/utils/json.js";import{MaterializationError as t,ProblemError as n}from"../problems/problem-error.js";import{entities as r,entityDeps as i,files as a,loaderConfigDeps as o}from"../database/schema.js";import{replaceBlobRefsForEntityTx as s}from"../database/blobs.js";import{replaceAssetRefsForEntityTx as c,upsertAssetsTx as l}from"../database/assets.js";import{createProblem as u}from"../problems/codes.js";import{collectDataRefMarkers as d}from"./data-ref.js";import{dedupeRouteQueryDependencies as f}from"../plugins/utils/route-index.js";import{problemRow as p,replaceEntityProblemsExceptCodesTx as m}from"../database/problems.js";import{replaceLinkRefsForEntityTx as h,upsertTargetInventoryTx as g}from"../database/link-refs.js";import{detectMarkdocPayloadFlag as _}from"../markdown/server/render.js";import{timePluginWork as v}from"../plugins/work-time.js";import{cutEntityRevisionTx as y}from"../revisions/cut.js";import{replaceRouteQueryDepsTx as b}from"../database/route-query-deps.js";import{replaceEntityRuntimeDeps as x}from"../database/origins.js";import{SEARCH_PROBLEM_CODES as S}from"../problems/producers.js";import{buildL10nAssetMap as C,dedupeAssetUsages as w,reconcileAsset as T,removeReplacedAssetFiles as E}from"./asset-reconcile.js";import{and as D,eq as O}from"drizzle-orm";const k=/* @__PURE__ */ new WeakMap;async function A(e){let t=await j(e.database,e.key);if(!t)throw Error(`Entity "${e.key}" is not registered.`);if(t.kind===`inline`){if(t.data===null)throw Error(`Inline entity "${e.key}" is missing its stored data.`);return t.data}if(t.status===`ready`&&t.data!==null)return t.data;let n=k.get(e.database);n===void 0&&(n=/* @__PURE__ */ new Map,k.set(e.database,n));let r=n.get(e.key);if(r!==void 0)return r;let i=M(e,t);n.set(e.key,i);try{return await i}finally{n.delete(e.key)}}async function j(e,t){let[n]=await e.db.select({id:r.id,key:r.key,kind:r.kind,pluginId:r.pluginId,loaderId:r.loaderId,loaderArgs:r.loaderArgs,type:r.type,metadata:r.metadata,status:r.status,data:r.data,markdoc:r.markdoc,dataHash:r.dataHash,version:r.version,revisionCreatedAt:r.revisionCreatedAt,isSystem:r.isSystem,invalidationSeq:r.invalidationSeq}).from(r).where(D(O(r.key,t),O(r.isCurrent,1))).limit(1);return n}async function M(n,o){if(!o.loaderId)throw Error(`Entity "${n.key}" is missing its loader id.`);let k=n.loaderRegistry.getEntityLoaderById(o.loaderId);if(!k)throw Error(`Entity loader "${o.loaderId}" is not registered.`);let[A]=await n.database.db.select({path:a.path,fileId:a.id}).from(i).leftJoin(a,O(i.originFileId,a.id)).where(O(i.entityId,o.id)).limit(1);if(!A&&!o.isSystem)throw Error(`Entity "${n.key}" has no origin dependency.`);let j=n.loaderContextFactory(k,o.loaderArgs,A?.path??``),M;try{M=await v(k.pluginId,`load`,async()=>k.definition.handler(j))}catch(e){throw await N(n,o.id,e),new t(`Entity "${n.key}" failed to load.`,{cause:e})}let F=JSON.stringify(M.value??null),I=JSON.parse(F),L=M.markdoc??_(F),R=L?C(M.assetUsages??[]):void 0,z=R?{...L,l10nAssets:R}:L,B=d(I),V=Array.from(new Set(B.map(e=>e.blobKey))),H=w(M.assetUsages??[]),{contentDir:U}=n,W=U?(await Promise.all(H.map(e=>T(j.io,{contentDir:U,usage:e})))).filter(e=>e!==null):[],G=[];return await n.database.db.transaction(async t=>{let i=Date.now(),a=e(I),d=(o.dataHash??null)!==a,_=o.revisionCreatedAt;if(d&&(_=Math.max(i,o.revisionCreatedAt+1)),(await t.update(r).set({status:`ready`,data:I,markdoc:z,type:M.type??o.type,metadata:M.metadata??o.metadata,dataHash:a,revisionCreatedAt:_}).where(D(O(r.id,o.id),O(r.invalidationSeq,o.invalidationSeq))).returning({id:r.id})).length===0)return;d&&o.data!==null&&n.revisions?.isTracked(A?.path??``)&&await y(t,{current:o,max:n.revisions.max});let v=j._trackedConfig;await P(t,o.id,v?.collectDependencies()??[]);let C=j._loadedEntityKeys,w=j._globPatterns;if((M.entityDeps!==void 0||C.length>0||w.length>0)&&await x(t,{entityId:o.id,originPluginId:k.pluginId,isSystem:!!o.isSystem,deps:[...M.entityDeps??[],...C.map(e=>({kind:`entity`,key:e})),...w.map(e=>({kind:`glob`,pattern:e}))]}),await b(t,{originPluginId:k.pluginId,hook:`loader`,entityId:o.id,dependencies:f(j._routeQueries)}),await m(t,o.id,S,(M.problems??[]).map(e=>p(u(e),{scope:`entity`,entityId:o.id}))),await s(t,{entityId:o.id,blobKeys:V}),G=await l(t,W),await c(t,{entityId:o.id,refs:H.map(({path:e,hash:t})=>({path:e,hash:t}))}),(M.linkRefs!==void 0||M.targetInventories!==void 0)&&A?.path&&(await h(t,{entityId:o.id,originFileId:A.fileId,originPluginId:k.pluginId,filePath:A.path,drafts:M.linkRefs??[]}),A.fileId!==null))for(let e of M.targetInventories??[])await g(t,{fileId:A.fileId,originPluginId:k.pluginId,draft:e})}),U&&G.length>0&&await E(j.io,{contentDir:U,filenames:G,logger:n.logger}),I}async function N(e,t,r){let i=r instanceof n?r.draft:{code:`plugin/loader-failed`,message:`Loader failed for entity "${e.key}": ${r instanceof Error?r.message:String(r)}`,data:{entityKey:e.key}};try{let n=p(u(i),{scope:`entity`,entityId:t});await e.database.db.transaction(async e=>{await m(e,t,S,[n])})}catch{}}async function P(e,t,n){await e.delete(o).where(O(o.entityId,t)),n.length!==0&&await e.insert(o).values(n.map(e=>({...e,entityId:t})))}export{A as materializeEntityByKey};
1
+ import{hashJsonValue as e}from"../database/utils/json.js";import{entities as t,entityDeps as n,files as r,loaderConfigDeps as i}from"../database/schema.js";import{timePluginWork as a}from"../plugins/work-time.js";import{collectDataRefMarkers as o}from"./data-ref.js";import{MaterializationError as s,ProblemError as c}from"../problems/problem-error.js";import{replaceBlobRefsForEntityTx as l}from"../database/blobs.js";import{dedupeRouteQueryDependencies as u}from"../plugins/utils/route-index.js";import{problemRow as d,replaceEntityProblemsExceptCodesTx as f}from"../database/problems.js";import{replaceAssetRefsForEntityTx as p,upsertAssetsTx as m}from"../database/assets.js";import{createProblem as h}from"../problems/codes.js";import{replaceLinkRefsForEntityTx as g,upsertTargetInventoryTx as _}from"../database/link-refs.js";import{buildL10nAssetMap as v,dedupeAssetUsages as y,reconcileAsset as b,removeReplacedAssetFiles as x}from"./asset-reconcile.js";import{cutEntityRevisionTx as S}from"../revisions/cut.js";import{detectMarkdocPayloadFlag as C}from"../markdown/server/render.js";import{replaceRouteQueryDepsTx as w}from"../database/route-query-deps.js";import{replaceEntityRuntimeDeps as T}from"../database/origins.js";import{SEARCH_PROBLEM_CODES as E}from"../problems/producers.js";import{and as D,eq as O}from"drizzle-orm";const k=/* @__PURE__ */ new WeakMap;async function A(e){let t=await j(e.database,e.key);if(!t)throw Error(`Entity "${e.key}" is not registered.`);if(t.kind===`inline`){if(t.data===null)throw Error(`Inline entity "${e.key}" is missing its stored data.`);return t.data}if(t.status===`ready`&&t.data!==null)return t.data;let n=k.get(e.database);n===void 0&&(n=/* @__PURE__ */ new Map,k.set(e.database,n));let r=n.get(e.key);if(r!==void 0)return r;let i=M(e,t);n.set(e.key,i);try{return await i}finally{n.delete(e.key)}}async function j(e,n){let[r]=await e.db.select({id:t.id,key:t.key,kind:t.kind,pluginId:t.pluginId,loaderId:t.loaderId,loaderArgs:t.loaderArgs,type:t.type,metadata:t.metadata,status:t.status,data:t.data,markdoc:t.markdoc,dataHash:t.dataHash,version:t.version,revisionCreatedAt:t.revisionCreatedAt,isSystem:t.isSystem,invalidationSeq:t.invalidationSeq}).from(t).where(D(O(t.key,n),O(t.isCurrent,1))).limit(1);return r}async function M(i,c){if(!c.loaderId)throw Error(`Entity "${i.key}" is missing its loader id.`);let k=i.loaderRegistry.getEntityLoaderById(c.loaderId);if(!k)throw Error(`Entity loader "${c.loaderId}" is not registered.`);let[A]=await i.database.db.select({path:r.path,fileId:r.id}).from(n).leftJoin(r,O(n.originFileId,r.id)).where(O(n.entityId,c.id)).limit(1);if(!A&&!c.isSystem)throw Error(`Entity "${i.key}" has no origin dependency.`);let j=i.loaderContextFactory(k,c.loaderArgs,A?.path??``),M;try{M=await a(k.pluginId,`load`,async()=>k.definition.handler(j))}catch(e){throw await N(i,c.id,e),new s(`Entity "${i.key}" failed to load.`,{cause:e})}let F=JSON.stringify(M.value??null),I=JSON.parse(F),L=M.markdoc??C(F),R=L?v(M.assetUsages??[]):void 0,z=R?{...L,l10nAssets:R}:L,B=o(I),V=Array.from(new Set(B.map(e=>e.blobKey))),H=y(M.assetUsages??[]),{contentDir:U}=i,W=U?(await Promise.all(H.map(e=>b(j.io,{contentDir:U,usage:e})))).filter(e=>e!==null):[],G=[];return await i.database.db.transaction(async n=>{let r=Date.now(),a=e(I),o=(c.dataHash??null)!==a,s=c.revisionCreatedAt;if(o&&(s=Math.max(r,c.revisionCreatedAt+1)),(await n.update(t).set({status:`ready`,data:I,markdoc:z,type:M.type??c.type,metadata:M.metadata??c.metadata,dataHash:a,revisionCreatedAt:s}).where(D(O(t.id,c.id),O(t.invalidationSeq,c.invalidationSeq))).returning({id:t.id})).length===0)return;o&&c.data!==null&&i.revisions?.isTracked(A?.path??``)&&await S(n,{current:c,max:i.revisions.max});let v=j._trackedConfig;await P(n,c.id,v?.collectDependencies()??[]);let y=j._loadedEntityKeys,b=j._globPatterns;if((M.entityDeps!==void 0||y.length>0||b.length>0)&&await T(n,{entityId:c.id,originPluginId:k.pluginId,isSystem:!!c.isSystem,deps:[...M.entityDeps??[],...y.map(e=>({kind:`entity`,key:e})),...b.map(e=>({kind:`glob`,pattern:e}))]}),await w(n,{originPluginId:k.pluginId,hook:`loader`,entityId:c.id,dependencies:u(j._routeQueries)}),await f(n,c.id,E,(M.problems??[]).map(e=>d(h(e),{scope:`entity`,entityId:c.id}))),await l(n,{entityId:c.id,blobKeys:V}),G=await m(n,W),await p(n,{entityId:c.id,refs:H.map(({path:e,hash:t})=>({path:e,hash:t}))}),(M.linkRefs!==void 0||M.targetInventories!==void 0)&&A?.path&&(await g(n,{entityId:c.id,originFileId:A.fileId,originPluginId:k.pluginId,filePath:A.path,drafts:M.linkRefs??[]}),A.fileId!==null))for(let e of M.targetInventories??[])await _(n,{fileId:A.fileId,originPluginId:k.pluginId,draft:e})}),U&&G.length>0&&await x(j.io,{contentDir:U,filenames:G,logger:i.logger}),I}async function N(e,t,n){let r=n instanceof c?n.draft:{code:`plugin/loader-failed`,message:`Loader failed for entity "${e.key}": ${n instanceof Error?n.message:String(n)}`,data:{entityKey:e.key}};try{let n=d(h(r),{scope:`entity`,entityId:t});await e.database.db.transaction(async e=>{await f(e,t,E,[n])})}catch{}}async function P(e,t,n){await e.delete(i).where(O(i.entityId,t)),n.length!==0&&await e.insert(i).values(n.map(e=>({...e,entityId:t})))}export{A as materializeEntityByKey};
@@ -1 +1 @@
1
- import{refreshStateEntity as e}from"../database/entity-store.js";import{loadContentLayerConfig as t}from"../config.js";import{loadContentLayerState as n}from"../context-state.js";import{createBuildTimeEntityLoaderContextFactory as r}from"../loaders/context.js";import{resolveRevisionCapture as i}from"../revisions/config.js";import{materializeEntityByKey as a}from"./entity.js";function o(t){let{deps:n,database:i,revisions:o}=t,s=async t=>{let r=await a({database:i,key:t,loaderRegistry:n.pluginRegistry,loaderContextFactory:c,contentDir:n.contentDir,revisions:o,logger:n.logger});return await e(i,n.state,t),r},c=r(n,i,s);return{state:n.state,materialize:s}}async function s(e){let{context:r,database:a}=e;await t({context:r});let s=await n({context:r,database:a});return o({deps:{...r,state:s},database:a,revisions:i(r.config,e.captureRevisions)})}export{o as createEntityMaterializer,s as loadEntityMaterializer};
1
+ import{loadContentLayerConfig as e}from"../config.js";import{refreshStateEntity as t}from"../database/entity-store.js";import{loadContentLayerState as n}from"../context-state.js";import{createBuildTimeEntityLoaderContextFactory as r}from"../loaders/context.js";import{resolveRevisionCapture as i}from"../revisions/config.js";import{materializeEntityByKey as a}from"./entity.js";function o(e){let{deps:n,database:i,revisions:o}=e,s=async e=>{let r=await a({database:i,key:e,loaderRegistry:n.pluginRegistry,loaderContextFactory:c,contentDir:n.contentDir,revisions:o,logger:n.logger});return await t(i,n.state,e),r},c=r(n,i,s);return{state:n.state,materialize:s}}async function s(t){let{context:r,database:a}=t;await e({context:r});let s=await n({context:r,database:a});return o({deps:{...r,state:s},database:a,revisions:i(r.config,t.captureRevisions)})}export{o as createEntityMaterializer,s as loadEntityMaterializer};
@@ -1 +1 @@
1
- import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{isObject as t}from"../../shared/utils/is-object.js";import{getStaticFilesOutputDir as n,getStaticManifestPath as r}from"../../shared/constants/runtime-layout.js";import{MaterializationError as i}from"../problems/problem-error.js";import{resolveDataRef as a}from"../database/blobs.js";import{loadEntityRecordByKey as o}from"../database/entities.js";import{isDataRefMarker as s}from"./data-ref.js";import{updateStaticFileBodies as c}from"../database/static-files.js";import{producerContentType as l,toStaticBodyBytes as u}from"../static/producer-value.js";import{writeFileAtomically as d}from"./asset-reconcile.js";import{join as f}from"node:path";function p(e){return new Set(e.flatMap(e=>e.kind===`producer`&&e.entityKey?[e.entityKey]:[]))}async function m(e){let t=/* @__PURE__ */ new Set;for(let n of e.staleProducers)try{await e.materializeEntity(n)}catch(r){if(!(r instanceof i))throw r;t.add(n.key),e.logger.debug(`Could not materialize the static producer ${n.key}; recorded the problem and moved on`)}let n=[];for(let r of e.rows){let i=e.resolveAudience(r);if(r.kind===`copy`){n.push(h(e.io,e.contentDir,r,i));continue}let a=await g(e.io,e.database,r,i,r.entityKey!==null&&t.has(r.entityKey));a&&n.push(a)}let r=await _(e.io,{contentDir:e.contentDir,entries:n}),a=new Map(e.rows.map(e=>[e.path,e]));return await c(e.database,r.manifest.files.filter(e=>{let t=a.get(e.path);return t?.hash!==e.hash||t.size!==e.size}).map(e=>({path:e.path,hash:e.hash,size:e.size}))),e.logger.info(`Static files: ${r.manifest.files.length} registered, ${r.written.length} written, ${r.removed.length} removed`),r.manifest}function h(e,t,n,r){if(!n.sourcePath||!n.hash)throw Error(`Static file "${n.path}" has no copy source.`);let i=f(t,n.sourcePath);return{path:n.path,hash:n.hash,contentType:n.contentType,audience:r,write:t=>e.copyFile(i,t)}}async function g(e,n,r,i,c){let d=r.entityKey?await o(n,r.entityKey):null;if(!d||d.status!==`ready`&&!c)throw Error(`Static file "${r.path}": producer entity "${r.entityKey}" is not ready.`);let f=d.data;if(!t(f)||!s(f.body)){if(c)return null;throw Error(`Static file "${r.path}": producer "${r.entityKey}" must return { body: BlobReference }.`)}let p=f.body;return{path:r.path,hash:p.blobKey,contentType:l(f,r),audience:i,write:async t=>e.writeFile(t,u(await a(n,p)))}}async function _(t,i){let a=n(i.contentDir),o=r(i.contentDir),s=new Map((await v(t,o))?.files.map(e=>[e.path,e])??[]),c=new Set(await y(t,a)),l=[],u=[];for(let e=0;e<i.entries.length;e+=16)await Promise.all(i.entries.slice(e,e+16).map(async e=>{let n=f(a,...e.path.split(`/`)),r=s.get(e.path),i=r?.hash===e.hash&&c.has(e.path)?r.size:null;i===null&&(await d(t,n,e.write),i=(await t.stat(n))?.size??0,l.push(e.path)),u.push({path:e.path,hash:e.hash,contentType:e.contentType,size:i,audience:e.audience})}));let p=new Set(i.entries.map(e=>e.path)),m=[...c].filter(e=>!p.has(e));await Promise.all(m.map(e=>t.unlink(f(a,...e.split(`/`))))),u.sort((t,n)=>e(t.path,n.path));let h={formatVersion:1,files:u};return await t.writeFile(o,JSON.stringify(h,null,2),{recursive:!0}),{manifest:h,written:l,removed:m}}async function v(e,t){try{let n=JSON.parse(await e.readFile(t));return Array.isArray(n.files)?n:null}catch{return null}}async function y(e,t,n=``){let r=[],i;try{i=await e.readdir(t)}catch{return r}for(let a of i){let i=`${n}${a.name}`;a.type===`directory`?r.push(...await y(e,f(t,a.name),`${i}/`)):a.type===`file`&&r.push(i)}return r}export{p as collectStaticProducerKeys,m as materializeStaticProducers,_ as reconcileStaticFiles};
1
+ import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{getStaticFilesOutputDir as t,getStaticManifestPath as n}from"../../shared/constants/runtime-layout.js";import{isObject as r}from"../../shared/utils/is-object.js";import{isDataRefMarker as i}from"./data-ref.js";import{MaterializationError as a}from"../problems/problem-error.js";import{resolveDataRef as o}from"../database/blobs.js";import{loadEntityRecordByKey as s}from"../database/entities.js";import{updateStaticFileBodies as c}from"../database/static-files.js";import{writeFileAtomically as l}from"./asset-reconcile.js";import{producerContentType as u,toStaticBodyBytes as d}from"../static/producer-value.js";import{join as f}from"node:path";function p(e){return new Set(e.flatMap(e=>e.kind===`producer`&&e.entityKey?[e.entityKey]:[]))}async function m(e){let t=/* @__PURE__ */ new Set;for(let n of e.staleProducers)try{await e.materializeEntity(n)}catch(r){if(!(r instanceof a))throw r;t.add(n.key),e.logger.debug(`Could not materialize the static producer ${n.key}; recorded the problem and moved on`)}let n=[];for(let r of e.rows){let i=e.resolveAudience(r);if(r.kind===`copy`){n.push(h(e.io,e.contentDir,r,i));continue}let a=await g(e.io,e.database,r,i,r.entityKey!==null&&t.has(r.entityKey));a&&n.push(a)}let r=await _(e.io,{contentDir:e.contentDir,entries:n}),i=new Map(e.rows.map(e=>[e.path,e]));return await c(e.database,r.manifest.files.filter(e=>{let t=i.get(e.path);return t?.hash!==e.hash||t.size!==e.size}).map(e=>({path:e.path,hash:e.hash,size:e.size}))),e.logger.info(`Static files: ${r.manifest.files.length} registered, ${r.written.length} written, ${r.removed.length} removed`),r.manifest}function h(e,t,n,r){if(!n.sourcePath||!n.hash)throw Error(`Static file "${n.path}" has no copy source.`);let i=f(t,n.sourcePath);return{path:n.path,hash:n.hash,contentType:n.contentType,audience:r,write:t=>e.copyFile(i,t)}}async function g(e,t,n,a,c){let l=n.entityKey?await s(t,n.entityKey):null;if(!l||l.status!==`ready`&&!c)throw Error(`Static file "${n.path}": producer entity "${n.entityKey}" is not ready.`);let f=l.data;if(!r(f)||!i(f.body)){if(c)return null;throw Error(`Static file "${n.path}": producer "${n.entityKey}" must return { body: BlobReference }.`)}let p=f.body;return{path:n.path,hash:p.blobKey,contentType:u(f,n),audience:a,write:async n=>e.writeFile(n,d(await o(t,p)))}}async function _(r,i){let a=t(i.contentDir),o=n(i.contentDir),s=new Map((await v(r,o))?.files.map(e=>[e.path,e])??[]),c=new Set(await y(r,a)),u=[],d=[];for(let e=0;e<i.entries.length;e+=16)await Promise.all(i.entries.slice(e,e+16).map(async e=>{let t=f(a,...e.path.split(`/`)),n=s.get(e.path),i=n?.hash===e.hash&&c.has(e.path)?n.size:null;i===null&&(await l(r,t,e.write),i=(await r.stat(t))?.size??0,u.push(e.path)),d.push({path:e.path,hash:e.hash,contentType:e.contentType,size:i,audience:e.audience})}));let p=new Set(i.entries.map(e=>e.path)),m=[...c].filter(e=>!p.has(e));await Promise.all(m.map(e=>r.unlink(f(a,...e.split(`/`))))),d.sort((t,n)=>e(t.path,n.path));let h={formatVersion:1,files:d};return await r.writeFile(o,JSON.stringify(h,null,2),{recursive:!0}),{manifest:h,written:u,removed:m}}async function v(e,t){try{let n=JSON.parse(await e.readFile(t));return Array.isArray(n.files)?n:null}catch{return null}}async function y(e,t,n=``){let r=[],i;try{i=await e.readdir(t)}catch{return r}for(let a of i){let i=`${n}${a.name}`;a.type===`directory`?r.push(...await y(e,f(t,a.name),`${i}/`)):a.type===`file`&&r.push(i)}return r}export{p as collectStaticProducerKeys,m as materializeStaticProducers,_ as reconcileStaticFiles};
@@ -1 +1 @@
1
- import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{createTrackedRedoclyConfig as t}from"../config-deps.js";import{createRecordingPluginIO as n}from"./io.js";import{timePluginWork as r}from"./work-time.js";async function i(e,i,o){let s=[];for(let c of e){let e=c.content?.extractFile;if(!e)continue;let l=o.logger.child(`content-layer:plugin:${c.id}`),u=t(o.config),d=[],f=n(o.fs,o.contentDir,o.scannedPaths,e=>d.push(e),i.path),p;try{p={ok:!0,value:await r(c.id,`extract`,async()=>e(i,{io:f,config:u.config,contentDir:o.contentDir,logger:l}))}}catch(e){let t=e instanceof Error?e:Error(String(e));l.warn(`Content plugin extract failed`,{plugin:c.id,path:i.path,error:t.message}),p={ok:!1,error:t}}s.push({plugin:c,result:p,configDependencies:u.collectDependencies(),fileDependencies:a(d)})}return s}function a(t){let n=/* @__PURE__ */ new Map;for(let e of t)n.set(`${e.source}:${e.accessType}:${e.path}`,e);return[...n.values()].sort((t,n)=>e(t.source,n.source)||e(t.path,n.path)||e(t.accessType,n.accessType))}async function o(e,t){let n=e.finalize;if(!n)return{ok:!0,value:null};try{return{ok:!0,value:await n(t)??{}}}catch(n){let r=n instanceof Error?n:Error(String(n));return t.logger.warn(`Content plugin finalize failed`,{plugin:e.id,error:r.message}),{ok:!1,error:r}}}export{a as dedupeFileDependencies,i as extractFileContributions,o as runContentPluginFinalize};
1
+ import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{createRecordingPluginIO as t}from"./io.js";import{createTrackedRedoclyConfig as n}from"../config-deps.js";import{timePluginWork as r}from"./work-time.js";async function i(e,i,o){let s=[];for(let c of e){let e=c.content?.extractFile;if(!e)continue;let l=o.logger.child(`content-layer:plugin:${c.id}`),u=n(o.config),d=[],f=t(o.fs,o.contentDir,o.scannedPaths,e=>d.push(e),i.path),p;try{p={ok:!0,value:await r(c.id,`extract`,async()=>e(i,{io:f,config:u.config,contentDir:o.contentDir,logger:l}))}}catch(e){let t=e instanceof Error?e:Error(String(e));l.warn(`Content plugin extract failed`,{plugin:c.id,path:i.path,error:t.message}),p={ok:!1,error:t}}s.push({plugin:c,result:p,configDependencies:u.collectDependencies(),fileDependencies:a(d)})}return s}function a(t){let n=/* @__PURE__ */ new Map;for(let e of t)n.set(`${e.source}:${e.accessType}:${e.path}`,e);return[...n.values()].sort((t,n)=>e(t.source,n.source)||e(t.path,n.path)||e(t.accessType,n.accessType))}async function o(e,t){let n=e.finalize;if(!n)return{ok:!0,value:null};try{return{ok:!0,value:await n(t)??{}}}catch(n){let r=n instanceof Error?n:Error(String(n));return t.logger.warn(`Content plugin finalize failed`,{plugin:e.id,error:r.message}),{ok:!1,error:r}}}export{a as dedupeFileDependencies,i as extractFileContributions,o as runContentPluginFinalize};
@@ -1 +1 @@
1
- import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import{APP_DATA_STATIC_DATA_SLUG as x}from"../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as S}from"../../shared/constants/route-deps.js";import{createRouteIndex as C,createRouteQueryEvaluator as w,dedupeRouteQueryDependencies as T,isRouteQueryStale as E}from"./utils/route-index.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as D,SIDEBAR_AGGREGATOR_LOADER_ID as O,SIDEBAR_FILENAME_REGEX as k,SIDEBAR_PLUGIN_ID as A,isTabbedSidebar as j,resolveAutoSidebar as M,sidebarContentPlugin as N}from"./internal/sidebar/index.js";import"./internal/api-functions/constants.js";import{createContentPluginIO as P,createPluginIO as F,createRecordingPluginIO as I}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as L,STATIC_FOLDER_PREFIX as R,isStaticFolderPath as z,staticFolderContentPlugin as B}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as V,createContentPluginRegistry as H,matchesContentPluginFilter as U,resolveContentPluginsForFile as W}from"./registry.js";import{ASSETS_PLUGIN_ID as G,ASSET_ENTITY_KEY_PREFIX as K,assetsContentPlugin as q}from"./internal/assets/index.js";import{SPEC_KIND_ARAZZO as J,SPEC_KIND_ASYNCAPI as Y,SPEC_KIND_GRAPHQL as X,SPEC_KIND_GRPC as Z,SPEC_KIND_OPENAPI as Q}from"../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as $,mockPathPrefix as ee}from"./types/api-entity.js";import{APP_DATA_PLUGIN_ID as te,APP_DATA_PLUGIN_VERSION as ne,APP_DATA_STATIC_DATA_LOADER_ID as re,appDataContentPlugin as ie,appDataSystemEntityDescriptor as ae,buildConfigAppData as oe,isAppDataFragment as se}from"./internal/app-data/index.js";import{BUILT_IN_CLASSIC_PLUGINS as ce,DEFAULT_PROJECT_PLUGIN_FILES as le,INTERNAL_PLUGIN_ID_PREFIX as ue,PLAN_GATED_PLUGINS as de}from"./project/constants.js";import{getLoadedProjectPlugins as fe,setLoadedProjectPlugins as pe,warnWhenProjectPluginsAreNotLoaded as me}from"./project/loaded-set.js";import{apiDocsContentPlugin as he}from"./internal/api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as ge,apiFunctionsContentPlugin as _e}from"./internal/api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as ve,CATALOG_CLASSIC_PLUGIN_ID as ye,CATALOG_CLASSIC_SERVER_FN_ID as be,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as xe,CATALOG_CLASSIC_TEMPLATE_ID as Se,catalogClassicContentPlugin as Ce}from"./internal/catalog-classic/index.js";import{L10N_PLUGIN_ID as we}from"./internal/l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as Te,l10nContentPlugin as Ee}from"./internal/l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as De,MARKDOC_SEARCH_GROUP as Oe,MARKDOC_SIDEBAR_ITEM_LOADER_ID as ke,MARKDOC_TEMPLATE_ID as Ae,markdocContentPlugin as je}from"./internal/markdoc/index.js";import{mcpContentPlugin as Me}from"./internal/mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as Ne,MOCK_SERVER_ROUTE_PATH as Pe,mockServerContentPlugin as Fe}from"./internal/mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as Ie,reactPageContentPlugin as Le}from"./internal/react-page/index.js";import{REVISIONS_PLUGIN_ID as Re,revisionsContentPlugin as ze}from"./internal/revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as Be,SCORECARD_CLASSIC_TEMPLATE_ID as Ve,scorecardClassicContentPlugin as He}from"./internal/scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as Ue,SKILL_MARKDOWN_ROUTE_PATH as We,skillsContentPlugin as Ge}from"./internal/skills/index.js";import{VERSIONS_PLUGIN_ID as Ke,versionsContentPlugin as qe}from"./internal/versions/index.js";import{createInternalContentPlugins as Je}from"./internal/index.js";import{createContentPlugins as Ye}from"./create-content-plugins.js";import{dedupeFileDependencies as Xe,extractFileContributions as Ze,runContentPluginFinalize as Qe}from"./execute.js";import{createSourceFile as $e}from"./source-file.js";import{createContentOriginKey as et}from"./utils/origin-key.js";import{createProjectPluginLoadError as tt,formatProjectPluginDiagnostics as nt,loadAndRegisterProjectPlugins as rt,loadProjectPlugins as it,readPluginEntries as at,resolveProjectPluginPath as ot}from"./project/load.js";import{reloadProjectPluginsIfChanged as st}from"./project/reload.js";export{ge as API_FUNCTIONS_PLUGIN_ID,te as APP_DATA_PLUGIN_ID,ne as APP_DATA_PLUGIN_VERSION,re as APP_DATA_STATIC_DATA_LOADER_ID,x as APP_DATA_STATIC_DATA_SLUG,G as ASSETS_PLUGIN_ID,K as ASSET_ENTITY_KEY_PREFIX,ce as BUILT_IN_CLASSIC_PLUGINS,ve as CATALOG_CLASSIC_LOADER_ID,ye as CATALOG_CLASSIC_PLUGIN_ID,be as CATALOG_CLASSIC_SERVER_FN_ID,xe as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,Se as CATALOG_CLASSIC_TEMPLATE_ID,le as DEFAULT_PROJECT_PLUGIN_FILES,t as ENTITY_LOADER_REFERENCE_KIND,D as FOLDER_SIDEBAR_FILENAME_REGEX,n as INLINE_ENTITY_REFERENCE_KIND,ue as INTERNAL_PLUGIN_ID_PREFIX,we as L10N_PLUGIN_ID,Te as L10N_PLUGIN_VERSION,De as MARKDOC_DOCUMENT_LOADER_ID,Oe as MARKDOC_SEARCH_GROUP,ke as MARKDOC_SIDEBAR_ITEM_LOADER_ID,Ae as MARKDOC_TEMPLATE_ID,V as MCP_TOOL_NAME_PATTERN,Ne as MOCK_SERVER_PLUGIN_ID,Pe as MOCK_SERVER_ROUTE_PATH,$ as MOCK_SERVER_ROUTE_PREFIX,de as PLAN_GATED_PLUGINS,Ie as REACT_PAGE_SEARCH_LOADER_KEY,Re as REVISIONS_PLUGIN_ID,Be as SCORECARD_CLASSIC_PLUGIN_ID,Ve as SCORECARD_CLASSIC_TEMPLATE_ID,d as SERVER_FN_REFERENCE_KIND,O as SIDEBAR_AGGREGATOR_LOADER_ID,k as SIDEBAR_FILENAME_REGEX,A as SIDEBAR_PLUGIN_ID,S as SIDEBAR_ROUTE_DEP_KEY,Ue as SKILLS_PLUGIN_ID,We as SKILL_MARKDOWN_ROUTE_PATH,J as SPEC_KIND_ARAZZO,Y as SPEC_KIND_ASYNCAPI,X as SPEC_KIND_GRAPHQL,Z as SPEC_KIND_GRPC,Q as SPEC_KIND_OPENAPI,L as STATIC_FOLDER_PLUGIN_ID,R as STATIC_FOLDER_PREFIX,f as STORED_ENTITY_REFERENCE_KIND,Ke as VERSIONS_PLUGIN_ID,he as apiDocsContentPlugin,_e as apiFunctionsContentPlugin,ie as appDataContentPlugin,ae as appDataSystemEntityDescriptor,q as assetsContentPlugin,oe as buildConfigAppData,Ce as catalogClassicContentPlugin,et as createContentOriginKey,P as createContentPluginIO,H as createContentPluginRegistry,Ye as createContentPlugins,r as createEntityLoader,i as createInlineEntity,a as createInlineEntityReference,Je as createInternalContentPlugins,F as createPluginIO,y as createPluginScopedId,tt as createProjectPluginLoadError,I as createRecordingPluginIO,C as createRouteIndex,w as createRouteQueryEvaluator,p as createServerFn,$e as createSourceFile,m as createStoredEntityReference,Xe as dedupeFileDependencies,T as dedupeRouteQueryDependencies,e as defineContentPlugin,Ze as extractFileContributions,nt as formatProjectPluginDiagnostics,fe as getLoadedProjectPlugins,h as getRegisteredServerFnLoader,se as isAppDataFragment,o as isEntityLoaderReference,s as isInlineEntityReference,c as isRawEntityReference,E as isRouteQueryStale,g as isServerFnReference,z as isStaticFolderPath,j as isTabbedSidebar,Ee as l10nContentPlugin,rt as loadAndRegisterProjectPlugins,it as loadProjectPlugins,je as markdocContentPlugin,U as matchesContentPluginFilter,Me as mcpContentPlugin,ee as mockPathPrefix,Fe as mockServerContentPlugin,_ as normalizeServerFnId,Le as reactPageContentPlugin,at as readPluginEntries,st as reloadProjectPluginsIfChanged,M as resolveAutoSidebar,W as resolveContentPluginsForFile,ot as resolveProjectPluginPath,l as resolveRuntimeFilePath,v as resolveServerModuleReference,ze as revisionsContentPlugin,Qe as runContentPluginFinalize,u as runtimeFile,b as runtimeTemplate,He as scorecardClassicContentPlugin,pe as setLoadedProjectPlugins,N as sidebarContentPlugin,Ge as skillsContentPlugin,B as staticFolderContentPlugin,qe as versionsContentPlugin,me as warnWhenProjectPluginsAreNotLoaded};
1
+ import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import"./internal/api-functions/constants.js";import{createContentPluginIO as x,createPluginIO as S,createRecordingPluginIO as C}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as w,STATIC_FOLDER_PREFIX as T,isStaticFolderPath as E,staticFolderContentPlugin as D}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as O,createContentPluginRegistry as k,matchesContentPluginFilter as A,resolveContentPluginsForFile as j}from"./registry.js";import{dedupeFileDependencies as M,extractFileContributions as N,runContentPluginFinalize as P}from"./execute.js";import{createSourceFile as F}from"./source-file.js";import{createRouteIndex as I,createRouteQueryEvaluator as L,dedupeRouteQueryDependencies as R,isRouteQueryStale as z}from"./utils/route-index.js";import{SPEC_KIND_ARAZZO as B,SPEC_KIND_ASYNCAPI as V,SPEC_KIND_GRAPHQL as H,SPEC_KIND_GRPC as U,SPEC_KIND_OPENAPI as W}from"../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as G,mockPathPrefix as K}from"./types/api-entity.js";import{createContentOriginKey as q}from"./utils/origin-key.js";import{ASSETS_PLUGIN_ID as J,ASSET_ENTITY_KEY_PREFIX as Y,assetsContentPlugin as X}from"./internal/assets/index.js";import{APP_DATA_STATIC_DATA_SLUG as Z}from"../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as Q}from"../../shared/constants/route-deps.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as $,SIDEBAR_AGGREGATOR_LOADER_ID as ee,SIDEBAR_FILENAME_REGEX as te,SIDEBAR_PLUGIN_ID as ne,isTabbedSidebar as re,resolveAutoSidebar as ie,sidebarContentPlugin as ae}from"./internal/sidebar/index.js";import{APP_DATA_PLUGIN_ID as oe,APP_DATA_PLUGIN_VERSION as se,APP_DATA_STATIC_DATA_LOADER_ID as ce,appDataContentPlugin as le,appDataSystemEntityDescriptor as ue,buildConfigAppData as de,isAppDataFragment as fe}from"./internal/app-data/index.js";import{BUILT_IN_CLASSIC_PLUGINS as pe,DEFAULT_PROJECT_PLUGIN_FILES as me,INTERNAL_PLUGIN_ID_PREFIX as he,PLAN_GATED_PLUGINS as ge}from"./project/constants.js";import{getLoadedProjectPlugins as _e,setLoadedProjectPlugins as ve,warnWhenProjectPluginsAreNotLoaded as ye}from"./project/loaded-set.js";import{apiDocsContentPlugin as be}from"./internal/api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as xe,apiFunctionsContentPlugin as Se}from"./internal/api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as Ce,CATALOG_CLASSIC_PLUGIN_ID as we,CATALOG_CLASSIC_SERVER_FN_ID as Te,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as Ee,CATALOG_CLASSIC_TEMPLATE_ID as De,catalogClassicContentPlugin as Oe}from"./internal/catalog-classic/index.js";import{L10N_PLUGIN_ID as ke}from"./internal/l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as Ae,l10nContentPlugin as je}from"./internal/l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as Me,MARKDOC_SEARCH_GROUP as Ne,MARKDOC_SIDEBAR_ITEM_LOADER_ID as Pe,MARKDOC_TEMPLATE_ID as Fe,markdocContentPlugin as Ie}from"./internal/markdoc/index.js";import{mcpContentPlugin as Le}from"./internal/mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as Re,MOCK_SERVER_ROUTE_PATH as ze,mockServerContentPlugin as Be}from"./internal/mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as Ve,reactPageContentPlugin as He}from"./internal/react-page/index.js";import{REVISIONS_PLUGIN_ID as Ue,revisionsContentPlugin as We}from"./internal/revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as Ge,SCORECARD_CLASSIC_TEMPLATE_ID as Ke,scorecardClassicContentPlugin as qe}from"./internal/scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as Je,SKILL_MARKDOWN_ROUTE_PATH as Ye,skillsContentPlugin as Xe}from"./internal/skills/index.js";import{VERSIONS_PLUGIN_ID as Ze,versionsContentPlugin as Qe}from"./internal/versions/index.js";import{createInternalContentPlugins as $e}from"./internal/index.js";import{createContentPlugins as et}from"./create-content-plugins.js";import{createProjectPluginLoadError as tt,formatProjectPluginDiagnostics as nt,loadAndRegisterProjectPlugins as rt,loadProjectPlugins as it,readPluginEntries as at,resolveProjectPluginPath as ot}from"./project/load.js";import{reloadProjectPluginsIfChanged as st}from"./project/reload.js";export{xe as API_FUNCTIONS_PLUGIN_ID,oe as APP_DATA_PLUGIN_ID,se as APP_DATA_PLUGIN_VERSION,ce as APP_DATA_STATIC_DATA_LOADER_ID,Z as APP_DATA_STATIC_DATA_SLUG,J as ASSETS_PLUGIN_ID,Y as ASSET_ENTITY_KEY_PREFIX,pe as BUILT_IN_CLASSIC_PLUGINS,Ce as CATALOG_CLASSIC_LOADER_ID,we as CATALOG_CLASSIC_PLUGIN_ID,Te as CATALOG_CLASSIC_SERVER_FN_ID,Ee as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,De as CATALOG_CLASSIC_TEMPLATE_ID,me as DEFAULT_PROJECT_PLUGIN_FILES,t as ENTITY_LOADER_REFERENCE_KIND,$ as FOLDER_SIDEBAR_FILENAME_REGEX,n as INLINE_ENTITY_REFERENCE_KIND,he as INTERNAL_PLUGIN_ID_PREFIX,ke as L10N_PLUGIN_ID,Ae as L10N_PLUGIN_VERSION,Me as MARKDOC_DOCUMENT_LOADER_ID,Ne as MARKDOC_SEARCH_GROUP,Pe as MARKDOC_SIDEBAR_ITEM_LOADER_ID,Fe as MARKDOC_TEMPLATE_ID,O as MCP_TOOL_NAME_PATTERN,Re as MOCK_SERVER_PLUGIN_ID,ze as MOCK_SERVER_ROUTE_PATH,G as MOCK_SERVER_ROUTE_PREFIX,ge as PLAN_GATED_PLUGINS,Ve as REACT_PAGE_SEARCH_LOADER_KEY,Ue as REVISIONS_PLUGIN_ID,Ge as SCORECARD_CLASSIC_PLUGIN_ID,Ke as SCORECARD_CLASSIC_TEMPLATE_ID,d as SERVER_FN_REFERENCE_KIND,ee as SIDEBAR_AGGREGATOR_LOADER_ID,te as SIDEBAR_FILENAME_REGEX,ne as SIDEBAR_PLUGIN_ID,Q as SIDEBAR_ROUTE_DEP_KEY,Je as SKILLS_PLUGIN_ID,Ye as SKILL_MARKDOWN_ROUTE_PATH,B as SPEC_KIND_ARAZZO,V as SPEC_KIND_ASYNCAPI,H as SPEC_KIND_GRAPHQL,U as SPEC_KIND_GRPC,W as SPEC_KIND_OPENAPI,w as STATIC_FOLDER_PLUGIN_ID,T as STATIC_FOLDER_PREFIX,f as STORED_ENTITY_REFERENCE_KIND,Ze as VERSIONS_PLUGIN_ID,be as apiDocsContentPlugin,Se as apiFunctionsContentPlugin,le as appDataContentPlugin,ue as appDataSystemEntityDescriptor,X as assetsContentPlugin,de as buildConfigAppData,Oe as catalogClassicContentPlugin,q as createContentOriginKey,x as createContentPluginIO,k as createContentPluginRegistry,et as createContentPlugins,r as createEntityLoader,i as createInlineEntity,a as createInlineEntityReference,$e as createInternalContentPlugins,S as createPluginIO,y as createPluginScopedId,tt as createProjectPluginLoadError,C as createRecordingPluginIO,I as createRouteIndex,L as createRouteQueryEvaluator,p as createServerFn,F as createSourceFile,m as createStoredEntityReference,M as dedupeFileDependencies,R as dedupeRouteQueryDependencies,e as defineContentPlugin,N as extractFileContributions,nt as formatProjectPluginDiagnostics,_e as getLoadedProjectPlugins,h as getRegisteredServerFnLoader,fe as isAppDataFragment,o as isEntityLoaderReference,s as isInlineEntityReference,c as isRawEntityReference,z as isRouteQueryStale,g as isServerFnReference,E as isStaticFolderPath,re as isTabbedSidebar,je as l10nContentPlugin,rt as loadAndRegisterProjectPlugins,it as loadProjectPlugins,Ie as markdocContentPlugin,A as matchesContentPluginFilter,Le as mcpContentPlugin,K as mockPathPrefix,Be as mockServerContentPlugin,_ as normalizeServerFnId,He as reactPageContentPlugin,at as readPluginEntries,st as reloadProjectPluginsIfChanged,ie as resolveAutoSidebar,j as resolveContentPluginsForFile,ot as resolveProjectPluginPath,l as resolveRuntimeFilePath,v as resolveServerModuleReference,We as revisionsContentPlugin,P as runContentPluginFinalize,u as runtimeFile,b as runtimeTemplate,qe as scorecardClassicContentPlugin,ve as setLoadedProjectPlugins,ae as sidebarContentPlugin,Xe as skillsContentPlugin,D as staticFolderContentPlugin,Qe as versionsContentPlugin,ye as warnWhenProjectPluginsAreNotLoaded};
@@ -1,4 +1,4 @@
1
- import{withPathPrefix as e}from"../../../../../shared/path-prefix.js";import{ApiDocsLayoutContext as t,PageContext as n}from"../../../../../client/contexts.js";import{expandSecurityRequestValues as r,useDynamicRequestValues as i}from"../../../../../client/ApiAccess.js";import{MarkdocBlocks as a,markdocComponents as o}from"../../../../markdown/client/markdoc-components.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as s,API_DOCS_RENDER_DEP_KEY as c,apiPageTitle as l}from"../server/shared.js";import{rebaseItemLinks as u}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as d}from"../../../../../client/telemetry/config.js";import{withReplayOptions as f}from"../../../../../client/replay-options.js";import{REPLAY_OAUTH2_ROUTE_PATH as p}from"../../../../../shared/constants/replay.js";import{JsonSchemaTag as m}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as h}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as g}from"./event-handlers.js";import{useContext as _,useEffect as v,useMemo as y}from"react";import b from"styled-components";import{useLocation as x}from"react-router";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{useThemeConfig as T}from"@redocly/theme/core/hooks";import{LayoutVariant as E}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as D}from"virtual:realm-runtime";import{userMarkdocComponents as O}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as k,apiDocsMarkdocComponents as A}from"@redocly/api-docs";import{Breadcrumbs as j}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as M}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as N}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as P}from"@redocly/theme/layouts/ThreePanelLayout";const F={...o,JsonSchema:O.JsonSchema??m,JsonExample:O.JsonExample??h,...A},I={parse:e=>e,render:e=>/* @__PURE__ */ C(a,{ast:e,components:F})},L={MiddlePanelHeader:R};function R(){return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(j,{}),/* @__PURE__ */ C(W,{})]})}function z(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function B({page:e}){let n=D(c),a=D(s),{layout:o}=_(t),l=V(),p=i(),m=y(()=>{if(!n)return n;let e=r(p,Object.values(n.store.securitySchemeStore??{}));return{...g(f(n.options)),oAuth2RedirectURI:H(),userClaims:l,unstable_hooks:L,dynamicRequestValues:e}},[n,l,p]),h=e.slug.toLowerCase(),v=y(()=>n&&n.basePath!==h?u(n.items,n.basePath,h):n?.items,[n,h]);if(K(e.metadata,v,n?.title),!n)return null;let b=d();return/* @__PURE__ */ w(U,{children:[a&&/* @__PURE__ */ C(G,{layout:o,children:/* @__PURE__ */ C(M,{metadata:a})}),/* @__PURE__ */ C(k,{items:v,store:n.store,options:m,basePath:h,layout:o,markdownAdapter:I,telemetryConfig:b})]})}function V(){let e=_(n)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,r=e?.isAuthenticated?e.name:void 0;return y(()=>({email:t,name:r}),[t,r])}function H(){if(typeof window<`u`)return new URL(e(p),window.location.origin).toString()}const U=b.main`
1
+ import{REPLAY_OAUTH2_ROUTE_PATH as e}from"../../../../../shared/constants/replay.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as n,API_DOCS_RENDER_DEP_KEY as r,apiPageTitle as i}from"../server/shared.js";import{ApiDocsLayoutContext as a,PageContext as o}from"../../../../../client/contexts.js";import{expandSecurityRequestValues as s,useDynamicRequestValues as c}from"../../../../../client/ApiAccess.js";import{MarkdocBlocks as l,markdocComponents as u}from"../../../../markdown/client/markdoc-components.js";import{rebaseItemLinks as d}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as f}from"../../../../../client/telemetry/config.js";import{withReplayOptions as p}from"../../../../../client/replay-options.js";import{JsonSchemaTag as m}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as h}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as g}from"./event-handlers.js";import{useContext as _,useEffect as v,useMemo as y}from"react";import b from"styled-components";import{useLocation as x}from"react-router";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{useThemeConfig as T}from"@redocly/theme/core/hooks";import{LayoutVariant as E}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as D}from"virtual:realm-runtime";import{userMarkdocComponents as O}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as k,apiDocsMarkdocComponents as A}from"@redocly/api-docs";import{Breadcrumbs as j}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as M}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as N}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as P}from"@redocly/theme/layouts/ThreePanelLayout";const F={...u,JsonSchema:O.JsonSchema??m,JsonExample:O.JsonExample??h,...A},I={parse:e=>e,render:e=>/* @__PURE__ */ C(l,{ast:e,components:F})},L={MiddlePanelHeader:R};function R(){return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(j,{}),/* @__PURE__ */ C(W,{})]})}function z(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function B({page:e}){let t=D(r),i=D(n),{layout:o}=_(a),l=V(),u=c(),m=y(()=>{if(!t)return t;let e=s(u,Object.values(t.store.securitySchemeStore??{}));return{...g(p(t.options)),oAuth2RedirectURI:H(),userClaims:l,unstable_hooks:L,dynamicRequestValues:e}},[t,l,u]),h=e.slug.toLowerCase(),v=y(()=>t&&t.basePath!==h?d(t.items,t.basePath,h):t?.items,[t,h]);if(K(e.metadata,v,t?.title),!t)return null;let b=f();return/* @__PURE__ */ w(U,{children:[i&&/* @__PURE__ */ C(G,{layout:o,children:/* @__PURE__ */ C(M,{metadata:i})}),/* @__PURE__ */ C(k,{items:v,store:t.store,options:m,basePath:h,layout:o,markdownAdapter:I,telemetryConfig:b})]})}function V(){let e=_(o)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,n=e?.isAuthenticated?e.name:void 0;return y(()=>({email:t,name:n}),[t,n])}function H(){if(typeof window<`u`)return new URL(t(e),window.location.origin).toString()}const U=b.main`
2
2
  [data-section-id] {
3
3
  scroll-margin-top: var(--navbar-offset);
4
4
  }
@@ -12,4 +12,4 @@ import{withPathPrefix as e}from"../../../../../shared/path-prefix.js";import{Api
12
12
  && {
13
13
  padding-right: ${({layout:e})=>e===E.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
14
14
  }
15
- `;function K(e,t,n){let{pathname:r}=x(),{seo:i}=T(),a=i?.projectTitle,o=t?l(e,t,z(r),n):void 0;v(()=>{o&&(document.title=a?`${o} | ${a}`:o)},[o,a])}export{B as default};
15
+ `;function K(e,t,n){let{pathname:r}=x(),{seo:a}=T(),o=a?.projectTitle,s=t?i(e,t,z(r),n):void 0;v(()=>{s&&(document.title=o?`${s} | ${o}`:s)},[s,o])}export{B as default};