boltdocs 3.3.6 → 3.4.0

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 (116) hide show
  1. package/dist/{adapters-BKzKe2mO.mjs → adapters-BXiBWAKs.mjs} +1 -1
  2. package/dist/{adapters-DwDTQoCG.cjs → adapters-Czl3WtQt.cjs} +1 -1
  3. package/dist/{build-CxT38vPv.cjs → build-CNkXRdk8.cjs} +1 -1
  4. package/dist/{build-BJnL-FHG.mjs → build-CqUBsXVC.mjs} +1 -1
  5. package/dist/client/index.cjs +223 -51
  6. package/dist/client/index.d.cts +3 -3
  7. package/dist/client/index.d.ts +3 -3
  8. package/dist/client/index.js +226 -56
  9. package/dist/client/mdx.cjs +1 -1
  10. package/dist/client/mdx.js +1 -1
  11. package/dist/client/primitives.cjs +5 -5
  12. package/dist/client/primitives.d.cts +53 -34
  13. package/dist/client/primitives.d.ts +62 -43
  14. package/dist/client/primitives.js +4 -4
  15. package/dist/client/router.cjs +1 -1
  16. package/dist/client/router.d.cts +1 -1
  17. package/dist/client/router.d.ts +1 -1
  18. package/dist/client/router.js +1 -1
  19. package/dist/client/theme/reset.css +41 -0
  20. package/dist/{config-BJp3lGzE.cjs → config-B3SEoVjG.cjs} +2 -2
  21. package/dist/{config-BC_qhXws.cjs → config-Bfakeadu.cjs} +1 -1
  22. package/dist/{config-B3_iVsbi.mjs → config-CTcfF-0c.mjs} +2 -2
  23. package/dist/dev-D1DmOSjn.mjs +6 -0
  24. package/dist/dev-DH6cSge8.cjs +6 -0
  25. package/dist/{docs-layout-D3Fmb0Wd.js → docs-layout-CmntYM6p.js} +33 -33
  26. package/dist/{docs-layout-SgphExoE.cjs → docs-layout-DIgxJ5c7.cjs} +9 -9
  27. package/dist/{doctor-BqxOFRt3.cjs → doctor-BLxm2alc.cjs} +1 -1
  28. package/dist/{doctor-TS3JGNEU.cjs → doctor-Dd-JMTRo.cjs} +1 -1
  29. package/dist/{doctor-Cv5lXnay.mjs → doctor-DogHujrP.mjs} +1 -1
  30. package/dist/{image-Bkx85rsq.cjs → image-Bke2ojW1.cjs} +3 -3
  31. package/dist/{image-BAiDReNd.js → image-CaY2w0ua.js} +2 -1
  32. package/dist/index--xbYbT8N.d.ts +343 -0
  33. package/dist/{index-B1Mx0dHl.d.ts → index-B_o5y34l.d.cts} +89 -10
  34. package/dist/{index-DLaHgD-i.d.cts → index-Bx0CUd7Q.d.ts} +89 -10
  35. package/dist/index-RK7W_Fxy.d.cts +343 -0
  36. package/dist/{link-q1qHNGK_.js → link-CSe_oD8Y.js} +86 -113
  37. package/dist/{link-hLWOsx0x.cjs → link-Xb69Oy2F.cjs} +87 -143
  38. package/dist/{mdx-Qi0DmaY8.cjs → mdx-BCOrMd-P.cjs} +68 -16
  39. package/dist/{mdx-CJGWzBGy.js → mdx-BijiEbkp.js} +62 -15
  40. package/dist/{native-nLA4Jr0T.cjs → native-BbtRkce5.cjs} +1 -1
  41. package/dist/node/cli-entry.cjs +1 -1
  42. package/dist/node/cli-entry.mjs +1 -1
  43. package/dist/node/highlight.d.cts +2 -2
  44. package/dist/node/highlight.d.mts +2 -2
  45. package/dist/node/index.cjs +1 -1
  46. package/dist/node/index.d.cts +18 -39
  47. package/dist/node/index.d.mts +19 -40
  48. package/dist/node/index.mjs +1 -1
  49. package/dist/node/mdx/shiki-adapter.d.cts +1 -1
  50. package/dist/node/mdx/shiki-adapter.d.mts +1 -1
  51. package/dist/node-BgiLCa0I.cjs +39 -0
  52. package/dist/node-Da3tYBHo.mjs +39 -0
  53. package/dist/{package-Bah2tHjK.cjs → package-D1gVs5gQ.cjs} +1 -1
  54. package/dist/{package-D6bf68FR.mjs → package-YgQJn3Yh.mjs} +1 -1
  55. package/dist/pages-external-B_r6gvqP.cjs +6 -0
  56. package/dist/pages-external-jmK7AHaO.mjs +6 -0
  57. package/dist/{parser-CD8Oo8qh.mjs → parser-CvNZc5s3.mjs} +1 -1
  58. package/dist/{parser-vPaKvzLp.cjs → parser-DJLWTiO-.cjs} +1 -1
  59. package/dist/plugin-DW9K2fW5.mjs +69 -0
  60. package/dist/plugin-NwGKyTJX.cjs +69 -0
  61. package/dist/{plugin-context-b5qVVQSU.mjs → plugin-context-COh-cbsW.mjs} +1 -1
  62. package/dist/{plugin-context-BZs5lvDu.cjs → plugin-context-FIHaWn6r.cjs} +1 -1
  63. package/dist/{plugin-lifecycle-s89gzTlh.cjs → plugin-lifecycle-D9fTRaWY.cjs} +1 -1
  64. package/dist/{registry-B8pt41zj.d.cts → registry-BFmzj1yg.d.mts} +1 -1
  65. package/dist/{registry-BrrH2X9c.d.mts → registry-BoswPzYV.d.cts} +1 -1
  66. package/dist/{resolve-C5rT6B21.mjs → resolve-5puUe7eS.mjs} +1 -1
  67. package/dist/{resolve-BelytNYR.cjs → resolve-CF4ZLfqx.cjs} +1 -1
  68. package/dist/route-paths-B6ocUfNY.cjs +6 -0
  69. package/dist/route-paths-DyDji4bX.mjs +6 -0
  70. package/dist/{router-CZBxMRAH.js → router-B5e8k4qK.js} +175 -10
  71. package/dist/{router-C3kygdRK.cjs → router-DKC0Lu0n.cjs} +204 -9
  72. package/dist/{routes-Dq_2EUIB.cjs → routes-D55M8UrH.cjs} +1 -1
  73. package/dist/{routes-CzhKOw67.cjs → routes-DdE6Lfcl.cjs} +1 -1
  74. package/dist/{routes-Dw6g0bfF.mjs → routes-_I_8PQYF.mjs} +1 -1
  75. package/dist/{search-dialog-CguKVtUu.cjs → search-dialog-BOQRHKTb.cjs} +53 -20
  76. package/dist/{search-dialog-mYnqU4v7.js → search-dialog-BXil4_7P.js} +57 -24
  77. package/dist/{search-dialog-BYZS9aeO.cjs → search-dialog-CwlBd-Mu.cjs} +5 -5
  78. package/dist/{search-dialog-DQwod5Xc.js → search-dialog-D3Obh3eA.js} +1 -1
  79. package/dist/{search-dialog-DzObE-Ar.js → search-dialog-DeplpVEB.js} +3 -3
  80. package/dist/{search-dialog-QgKRRbsI.cjs → search-dialog-cHXR5zhL.cjs} +1 -1
  81. package/dist/server/index.cjs +1 -1
  82. package/dist/server/index.d.mts +1 -1
  83. package/dist/server/index.mjs +1 -1
  84. package/dist/ssg-static-options-Br1_u9qp.mjs +6 -0
  85. package/dist/ssg-static-options-CVvGKM8i.cjs +6 -0
  86. package/dist/types-58Ac3UGI.d.cts +114 -0
  87. package/dist/types-BwnGf-1E.d.mts +114 -0
  88. package/dist/{virtual-modules-C3S3Nz8r.cjs → virtual-modules-C4-qxFlL.cjs} +1 -1
  89. package/dist/{virtual-modules-CaxqrFd6.mjs → virtual-modules-DiWUKJGP.mjs} +1 -1
  90. package/package.json +5 -3
  91. package/src/shared/types.ts +133 -987
  92. package/dist/dev-46NiL0MC.cjs +0 -6
  93. package/dist/dev-C4kjO5xs.mjs +0 -6
  94. package/dist/index-CgWkOCCn.d.cts +0 -1193
  95. package/dist/index-CuNSD3E2.d.ts +0 -1193
  96. package/dist/node-7Cfw6nMr.cjs +0 -23
  97. package/dist/node-CT2E84nY.mjs +0 -23
  98. package/dist/pages-external-BBw8ObVK.mjs +0 -6
  99. package/dist/pages-external-DPiPFxxP.cjs +0 -6
  100. package/dist/plugin-AgNI3ktz.cjs +0 -69
  101. package/dist/plugin-BAv_pYLt.mjs +0 -69
  102. package/dist/types-74i_xUe2.d.mts +0 -975
  103. package/dist/types-X_Pwk8Cg.d.cts +0 -975
  104. /package/dist/{audit-CMc_ydRr.mjs → audit-CYAkXXvP.mjs} +0 -0
  105. /package/dist/{audit-CHkGiV3c.cjs → audit-DxCZZTuX.cjs} +0 -0
  106. /package/dist/{csp-BiGAG8aF.cjs → csp-B-gc2Iha.cjs} +0 -0
  107. /package/dist/{csp-D0BOH8ae.mjs → csp-f8DOcI_7.mjs} +0 -0
  108. /package/dist/{generator-BCrZL53x.cjs → generator-CBAPKY6r.cjs} +0 -0
  109. /package/dist/{generator-CFukoGa0.mjs → generator-MRpn-yp6.mjs} +0 -0
  110. /package/dist/{handler-Lex5DbvG.mjs → handler-DBZqoWt2.mjs} +0 -0
  111. /package/dist/{handler-Ch-Q9NAB.cjs → handler-ryZR9Q41.cjs} +0 -0
  112. /package/dist/{index-HAwIo4nZ.d.mts → index-CPr34I2C.d.mts} +0 -0
  113. /package/dist/{native-BYKMke79.mjs → native-DZ6WMwjG.mjs} +0 -0
  114. /package/dist/{native-BOet8hpE.cjs → native-DeKxny_T.cjs} +0 -0
  115. /package/dist/{update-check-BXD1atVv.mjs → update-check-BXx8te9F.mjs} +0 -0
  116. /package/dist/{update-check-DFQZyoSU.cjs → update-check-CiIeC7CX.cjs} +0 -0
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import{n as e,t}from"./csp-D0BOH8ae.mjs";function n(n,r){let i=r?{...e}:{};return n.security?.enableCSP&&(i[`Content-Security-Policy`]=t(n)),Object.assign(i,n.security?.headers),Object.assign(i,n.security?.customHeaders),i}export{n as resolveSecurityHeaders};
6
+ import{n as e,t}from"./csp-f8DOcI_7.mjs";function n(n,r){let i=r?{...e}:{};return n.security?.enableCSP&&(i[`Content-Security-Policy`]=t(n)),Object.assign(i,n.security?.headers),Object.assign(i,n.security?.customHeaders),i}export{n as resolveSecurityHeaders};
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- const e=require(`./csp-BiGAG8aF.cjs`);function t(t,n){let r=n?{...e.n}:{};return t.security?.enableCSP&&(r[`Content-Security-Policy`]=e.t(t)),Object.assign(r,t.security?.headers),Object.assign(r,t.security?.customHeaders),r}exports.resolveSecurityHeaders=t;
6
+ const e=require(`./csp-B-gc2Iha.cjs`);function t(t,n){let r=n?{...e.n}:{};return t.security?.enableCSP&&(r[`Content-Security-Policy`]=e.t(t)),Object.assign(r,t.security?.headers),Object.assign(r,t.security?.customHeaders),r}exports.resolveSecurityHeaders=t;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ var e=require(`./chunk-D1Md3oWO.cjs`).t({buildTypeRoutePaths:()=>r,normalizeBasePath:()=>t,withBasePath:()=>n});function t(e){let t=(e??``).replace(/^\/+|\/+$/g,``);return t===``?`/`:`/${t}`}function n(e,t){if(t===`/`)return e;let n=e.startsWith(`/`)?e:`/${e}`;return n===t||n.startsWith(`${t}/`)?n:n===`/`?t:`${t}${n}`}function r(e,r,i=[]){let a=t(r),o=[],s=e=>{e&&!o.includes(e)&&o.push(e)};for(let t of e)s(n(t.path,a));s(a);for(let e of i)s(e);return o}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ import{t as e}from"./chunk-BFSpntXv.mjs";var t=e({buildTypeRoutePaths:()=>i,normalizeBasePath:()=>n,withBasePath:()=>r});function n(e){let t=(e??``).replace(/^\/+|\/+$/g,``);return t===``?`/`:`/${t}`}function r(e,t){if(t===`/`)return e;let n=e.startsWith(`/`)?e:`/${e}`;return n===t||n.startsWith(`${t}/`)?n:n===`/`?t:`${t}${n}`}function i(e,t,i=[]){let a=n(t),o=[],s=e=>{e&&!o.includes(e)&&o.push(e)};for(let t of e)s(r(t.path,a));s(a);for(let e of i)s(e);return o}export{n,t as r,i as t};
@@ -32,6 +32,143 @@ function addBasename(path, basename) {
32
32
  return `${normalized}/${path}`;
33
33
  }
34
34
 
35
+ //#endregion
36
+ //#region src/client/app/config-context.tsx
37
+ /**
38
+ * Context for the global documentation configuration.
39
+ * Using a global singleton pattern to survive dual-package or duplicated-code hazards.
40
+ */
41
+ const CONFIG_CONTEXT_SYMBOL = Symbol.for("__BDOCS_CONFIG_CONTEXT__");
42
+ const CONFIG_INSTANCE_SYMBOL = Symbol.for("__BDOCS_CONFIG_INSTANCE__");
43
+ const globalRegistry = globalThis;
44
+ const existingConfigContext = globalRegistry[CONFIG_CONTEXT_SYMBOL];
45
+ const ConfigContext = existingConfigContext || createContext(null);
46
+ if (!existingConfigContext) globalRegistry[CONFIG_CONTEXT_SYMBOL] = ConfigContext;
47
+ /**
48
+ * Hook to access the Boltdocs configuration when one is available.
49
+ *
50
+ * Low-level primitives such as icons can also be rendered standalone (for
51
+ * example in a component preview or a unit test), so they must not be forced
52
+ * to mount the full application provider just to render an inline SVG.
53
+ */
54
+ function useOptionalConfig() {
55
+ const context = use(ConfigContext);
56
+ if (context) return context;
57
+ const globalConfig = globalRegistry[CONFIG_INSTANCE_SYMBOL];
58
+ if (globalConfig) return globalConfig;
59
+ return null;
60
+ }
61
+ /**
62
+ * Hook to access the Boltdocs configuration.
63
+ */
64
+ function useConfig() {
65
+ const config = useOptionalConfig();
66
+ if (!config) throw new Error("useConfig must be used within a ConfigProvider");
67
+ return config;
68
+ }
69
+
70
+ //#endregion
71
+ //#region src/client/view-transitions.ts
72
+ function resolveOptions(options) {
73
+ if (options?.enabled === false) return void 0;
74
+ return {
75
+ enabled: true,
76
+ ...options?.types?.length ? { types: options.types } : {}
77
+ };
78
+ }
79
+ function isNativeViewTransitionSupported() {
80
+ return typeof document !== "undefined" && typeof document.startViewTransition === "function";
81
+ }
82
+ /**
83
+ * Honors the `prefers-reduced-motion` media query.
84
+ *
85
+ * View transitions animate the whole document, so ignoring this setting turns
86
+ * an accessibility preference into a motion-sensitivity regression. The check
87
+ * is live: a visitor can change the OS setting without reloading the page.
88
+ */
89
+ function prefersReducedMotion() {
90
+ if (typeof window === "undefined" || !window.matchMedia) return false;
91
+ try {
92
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
93
+ } catch {
94
+ return false;
95
+ }
96
+ }
97
+ /**
98
+ * Combines the configured transition types with a navigation direction.
99
+ *
100
+ * The direction is always appended as a type so themes can animate forward and
101
+ * backward navigation differently without writing router code.
102
+ */
103
+ function resolveTransitionTypes(configured, direction = "none") {
104
+ const types = [...configured ?? []];
105
+ if (direction !== "none" && !types.includes(direction)) types.push(direction);
106
+ return types.length > 0 ? types : void 0;
107
+ }
108
+ /**
109
+ * Starts a native document transition when the browser supports it and the
110
+ * visitor has not asked for reduced motion. Otherwise the update still runs
111
+ * normally and the function returns null.
112
+ */
113
+ function startViewTransition(update, options) {
114
+ const resolved = resolveOptions(options);
115
+ if (typeof document === "undefined" || resolved?.enabled !== true) {
116
+ update();
117
+ return null;
118
+ }
119
+ if (prefersReducedMotion()) {
120
+ update();
121
+ return null;
122
+ }
123
+ const start = document.startViewTransition;
124
+ if (!start) {
125
+ update();
126
+ return null;
127
+ }
128
+ const types = options?.types;
129
+ return start.call(document, {
130
+ update,
131
+ ...types?.length ? { types } : {}
132
+ });
133
+ }
134
+ /**
135
+ * Returns a transition-aware runner that follows the project's experimental
136
+ * configuration. It is safe to use in custom layouts and external pages.
137
+ *
138
+ * The returned value is callable for backwards compatibility:
139
+ * `transition(() => setState(...))`. It also exposes `run` and `start` aliases
140
+ * for discoverability in editor autocomplete.
141
+ */
142
+ function useViewTransition() {
143
+ const configured = useOptionalConfig()?.experimental?.viewTransitions;
144
+ const enabled = configured === true || typeof configured === "object" && configured.enabled === true;
145
+ const supported = isNativeViewTransitionSupported();
146
+ const reducedMotion = prefersReducedMotion();
147
+ const run = useCallback((update, options) => {
148
+ if (!enabled && options?.enabled !== true) {
149
+ update();
150
+ return null;
151
+ }
152
+ const configuredTypes = typeof configured === "object" ? configured.types : void 0;
153
+ return startViewTransition(update, {
154
+ ...options,
155
+ types: resolveTransitionTypes(options?.types ?? configuredTypes, "none")
156
+ });
157
+ }, [configured, enabled]);
158
+ return useMemo(() => Object.assign(run, {
159
+ run,
160
+ start: run,
161
+ enabled,
162
+ supported,
163
+ reducedMotion
164
+ }), [
165
+ enabled,
166
+ reducedMotion,
167
+ run,
168
+ supported
169
+ ]);
170
+ }
171
+
35
172
  //#endregion
36
173
  //#region src/client/router/context.tsx
37
174
  function getActiveLocale() {
@@ -75,12 +212,12 @@ function dispatchNavigationStart(location) {
75
212
  if (typeof window === "undefined") return;
76
213
  window.dispatchEvent(new CustomEvent("boltdocs:navigation-start", { detail: location }));
77
214
  }
78
- function scheduleLocationUpdate(setLocation, nextLocation, viewTransitions) {
215
+ function scheduleLocationUpdate(setLocation, nextLocation, viewTransitions, direction = "none") {
79
216
  setTimeout(() => {
80
217
  const enabled = typeof viewTransitions === "boolean" ? viewTransitions : viewTransitions?.enabled === true;
81
218
  const startViewTransition = document.startViewTransition;
82
- if (enabled && startViewTransition) {
83
- const types = typeof viewTransitions === "object" ? viewTransitions.types : void 0;
219
+ if (enabled && startViewTransition && !prefersReducedMotion()) {
220
+ const types = resolveTransitionTypes(typeof viewTransitions === "object" ? viewTransitions.types : void 0, direction);
84
221
  startViewTransition.call(document, {
85
222
  update: () => setLocation(nextLocation),
86
223
  ...types?.length ? { types } : {}
@@ -107,16 +244,44 @@ const LocationProvider = ({ pathname: propPathname, children, loaderData = null,
107
244
  hash: ""
108
245
  } : defaultLocation;
109
246
  });
247
+ const historyIndex = useRef(0);
248
+ useEffect(() => {
249
+ if (typeof window === "undefined") return;
250
+ const stored = window.history.state;
251
+ if (typeof stored?.__boltdocsIndex === "number") historyIndex.current = stored.__boltdocsIndex;
252
+ }, []);
253
+ const pushHistoryState = useCallback((state, url, replace) => {
254
+ if (typeof window === "undefined") return "none";
255
+ const nextIndex = replace ? historyIndex.current : historyIndex.current + 1;
256
+ const payload = {
257
+ ...typeof state === "object" && state !== null ? state : {},
258
+ __boltdocsIndex: nextIndex
259
+ };
260
+ if (replace) window.history.replaceState(payload, "", url);
261
+ else window.history.pushState(payload, "", url);
262
+ historyIndex.current = nextIndex;
263
+ return replace ? "none" : "forward";
264
+ }, []);
265
+ const readPopDirection = useCallback(() => {
266
+ if (typeof window === "undefined") return "none";
267
+ const stored = window.history.state;
268
+ const nextIndex = typeof stored?.__boltdocsIndex === "number" ? stored.__boltdocsIndex : historyIndex.current;
269
+ const previous = historyIndex.current;
270
+ historyIndex.current = nextIndex;
271
+ if (nextIndex > previous) return "forward";
272
+ if (nextIndex < previous) return "back";
273
+ return "none";
274
+ }, []);
110
275
  useEffect(() => {
111
276
  if (typeof window === "undefined") return;
112
277
  const handlePopState = () => {
113
278
  const nextLocation = getLocationFromWindow();
114
- scheduleLocationUpdate(setLocation, nextLocation, viewTransitions);
279
+ scheduleLocationUpdate(setLocation, nextLocation, viewTransitions, readPopDirection());
115
280
  dispatchNavigationStart(nextLocation);
116
281
  };
117
282
  window.addEventListener("popstate", handlePopState);
118
283
  return () => window.removeEventListener("popstate", handlePopState);
119
- }, [viewTransitions]);
284
+ }, [readPopDirection, viewTransitions]);
120
285
  const prefetched = useRef(/* @__PURE__ */ new Set());
121
286
  const fallbackPrefetch = useCallback(async (to) => {
122
287
  if (typeof window === "undefined" || !to || prefetched.current.has(to)) return;
@@ -145,7 +310,7 @@ const LocationProvider = ({ pathname: propPathname, children, loaderData = null,
145
310
  }
146
311
  if (options?.replace) window.history.replaceState(options.state ?? null, "", newUrl.href);
147
312
  else window.history.pushState(options?.state ?? null, "", newUrl.href);
148
- scheduleLocationUpdate(setLocation, nextLocation, options?.viewTransition === false ? false : viewTransitions);
313
+ scheduleLocationUpdate(setLocation, nextLocation, options?.viewTransition === false ? false : viewTransitions, "none");
149
314
  dispatchNavigationStart(nextLocation);
150
315
  return;
151
316
  }
@@ -165,18 +330,18 @@ const LocationProvider = ({ pathname: propPathname, children, loaderData = null,
165
330
  else window.history.pushState(options.state, "", finalPath);
166
331
  return;
167
332
  }
168
- if (options?.replace) window.history.replaceState(options?.state ?? null, "", finalPath);
169
- else window.history.pushState(options?.state ?? null, "", finalPath);
333
+ const direction = pushHistoryState(options?.state ?? null, finalPath, options?.replace === true);
170
334
  const nextLocation = {
171
335
  pathname: finalUrl.pathname,
172
336
  search: finalUrl.search,
173
337
  hash: finalUrl.hash
174
338
  };
175
- scheduleLocationUpdate(setLocation, nextLocation, options?.viewTransition === false ? false : viewTransitions);
339
+ scheduleLocationUpdate(setLocation, nextLocation, options?.viewTransition === false ? false : viewTransitions, direction);
176
340
  dispatchNavigationStart(nextLocation);
177
341
  }, [
178
342
  basename,
179
343
  defaultLocale,
344
+ pushHistoryState,
180
345
  viewTransitions
181
346
  ]);
182
347
  useEffect(() => {
@@ -984,4 +1149,4 @@ function resolveUrlReference(to, config, options = {}) {
984
1149
  }
985
1150
 
986
1151
  //#endregion
987
- export { useRouteData as A, normalizeBasename as B, Outlet as C, useMatches as D, useLocation as E, PrefetchContext as F, RouteDataContext as I, defaultNavigate as L, LocationProvider as M, MatchesContext as N, useNavigate as O, NavigateContext as P, addBasename as R, resolveRouteBranch as S, useLoaderData as T, stripBasename as V, stripSiteProtocol as _, getConfiguredVersions as a, matchRouteBranch as b, hasUriScheme as c, isConfiguredVersion as d, normalizeUrlBase as f, splitUrlReference as g, resolveUrlReference as h, getConfiguredLocales as i, LocationContext as j, usePrefetch as k, hasUrlBase as l, parseUrlReference as m, buildUrl as n, getVersionPrefixSegments as o, normalizeUrlPath as p, classifyUrlPath as r, getVersionSegments as s, addUrlBase as t, isConfiguredLocale as u, stripUrlBase as v, OutletContext as w, matchRouteBranchWithParams as x, RouteRenderer as y, hasBasename as z };
1152
+ export { useRouteData as A, ConfigContext as B, Outlet as C, useMatches as D, useLocation as E, PrefetchContext as F, normalizeBasename as G, useOptionalConfig as H, RouteDataContext as I, stripBasename as K, defaultNavigate as L, LocationProvider as M, MatchesContext as N, useNavigate as O, NavigateContext as P, startViewTransition as R, resolveRouteBranch as S, useLoaderData as T, addBasename as U, useConfig as V, hasBasename as W, stripSiteProtocol as _, getConfiguredVersions as a, matchRouteBranch as b, hasUriScheme as c, isConfiguredVersion as d, normalizeUrlBase as f, splitUrlReference as g, resolveUrlReference as h, getConfiguredLocales as i, LocationContext as j, usePrefetch as k, hasUrlBase as l, parseUrlReference as m, buildUrl as n, getVersionPrefixSegments as o, normalizeUrlPath as p, classifyUrlPath as r, getVersionSegments as s, addUrlBase as t, isConfiguredLocale as u, stripUrlBase as v, OutletContext as w, matchRouteBranchWithParams as x, RouteRenderer as y, useViewTransition as z };
@@ -73,6 +73,143 @@ function addBasename(path, basename) {
73
73
  return `${normalized}/${path}`;
74
74
  }
75
75
 
76
+ //#endregion
77
+ //#region src/client/app/config-context.tsx
78
+ /**
79
+ * Context for the global documentation configuration.
80
+ * Using a global singleton pattern to survive dual-package or duplicated-code hazards.
81
+ */
82
+ const CONFIG_CONTEXT_SYMBOL = Symbol.for("__BDOCS_CONFIG_CONTEXT__");
83
+ const CONFIG_INSTANCE_SYMBOL = Symbol.for("__BDOCS_CONFIG_INSTANCE__");
84
+ const globalRegistry = globalThis;
85
+ const existingConfigContext = globalRegistry[CONFIG_CONTEXT_SYMBOL];
86
+ const ConfigContext = existingConfigContext || (0, react.createContext)(null);
87
+ if (!existingConfigContext) globalRegistry[CONFIG_CONTEXT_SYMBOL] = ConfigContext;
88
+ /**
89
+ * Hook to access the Boltdocs configuration when one is available.
90
+ *
91
+ * Low-level primitives such as icons can also be rendered standalone (for
92
+ * example in a component preview or a unit test), so they must not be forced
93
+ * to mount the full application provider just to render an inline SVG.
94
+ */
95
+ function useOptionalConfig() {
96
+ const context = (0, react.use)(ConfigContext);
97
+ if (context) return context;
98
+ const globalConfig = globalRegistry[CONFIG_INSTANCE_SYMBOL];
99
+ if (globalConfig) return globalConfig;
100
+ return null;
101
+ }
102
+ /**
103
+ * Hook to access the Boltdocs configuration.
104
+ */
105
+ function useConfig() {
106
+ const config = useOptionalConfig();
107
+ if (!config) throw new Error("useConfig must be used within a ConfigProvider");
108
+ return config;
109
+ }
110
+
111
+ //#endregion
112
+ //#region src/client/view-transitions.ts
113
+ function resolveOptions(options) {
114
+ if (options?.enabled === false) return void 0;
115
+ return {
116
+ enabled: true,
117
+ ...options?.types?.length ? { types: options.types } : {}
118
+ };
119
+ }
120
+ function isNativeViewTransitionSupported() {
121
+ return typeof document !== "undefined" && typeof document.startViewTransition === "function";
122
+ }
123
+ /**
124
+ * Honors the `prefers-reduced-motion` media query.
125
+ *
126
+ * View transitions animate the whole document, so ignoring this setting turns
127
+ * an accessibility preference into a motion-sensitivity regression. The check
128
+ * is live: a visitor can change the OS setting without reloading the page.
129
+ */
130
+ function prefersReducedMotion() {
131
+ if (typeof window === "undefined" || !window.matchMedia) return false;
132
+ try {
133
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
134
+ } catch {
135
+ return false;
136
+ }
137
+ }
138
+ /**
139
+ * Combines the configured transition types with a navigation direction.
140
+ *
141
+ * The direction is always appended as a type so themes can animate forward and
142
+ * backward navigation differently without writing router code.
143
+ */
144
+ function resolveTransitionTypes(configured, direction = "none") {
145
+ const types = [...configured ?? []];
146
+ if (direction !== "none" && !types.includes(direction)) types.push(direction);
147
+ return types.length > 0 ? types : void 0;
148
+ }
149
+ /**
150
+ * Starts a native document transition when the browser supports it and the
151
+ * visitor has not asked for reduced motion. Otherwise the update still runs
152
+ * normally and the function returns null.
153
+ */
154
+ function startViewTransition(update, options) {
155
+ const resolved = resolveOptions(options);
156
+ if (typeof document === "undefined" || resolved?.enabled !== true) {
157
+ update();
158
+ return null;
159
+ }
160
+ if (prefersReducedMotion()) {
161
+ update();
162
+ return null;
163
+ }
164
+ const start = document.startViewTransition;
165
+ if (!start) {
166
+ update();
167
+ return null;
168
+ }
169
+ const types = options?.types;
170
+ return start.call(document, {
171
+ update,
172
+ ...types?.length ? { types } : {}
173
+ });
174
+ }
175
+ /**
176
+ * Returns a transition-aware runner that follows the project's experimental
177
+ * configuration. It is safe to use in custom layouts and external pages.
178
+ *
179
+ * The returned value is callable for backwards compatibility:
180
+ * `transition(() => setState(...))`. It also exposes `run` and `start` aliases
181
+ * for discoverability in editor autocomplete.
182
+ */
183
+ function useViewTransition() {
184
+ const configured = useOptionalConfig()?.experimental?.viewTransitions;
185
+ const enabled = configured === true || typeof configured === "object" && configured.enabled === true;
186
+ const supported = isNativeViewTransitionSupported();
187
+ const reducedMotion = prefersReducedMotion();
188
+ const run = (0, react.useCallback)((update, options) => {
189
+ if (!enabled && options?.enabled !== true) {
190
+ update();
191
+ return null;
192
+ }
193
+ const configuredTypes = typeof configured === "object" ? configured.types : void 0;
194
+ return startViewTransition(update, {
195
+ ...options,
196
+ types: resolveTransitionTypes(options?.types ?? configuredTypes, "none")
197
+ });
198
+ }, [configured, enabled]);
199
+ return (0, react.useMemo)(() => Object.assign(run, {
200
+ run,
201
+ start: run,
202
+ enabled,
203
+ supported,
204
+ reducedMotion
205
+ }), [
206
+ enabled,
207
+ reducedMotion,
208
+ run,
209
+ supported
210
+ ]);
211
+ }
212
+
76
213
  //#endregion
77
214
  //#region src/client/router/context.tsx
78
215
  function getActiveLocale() {
@@ -116,12 +253,12 @@ function dispatchNavigationStart(location) {
116
253
  if (typeof window === "undefined") return;
117
254
  window.dispatchEvent(new CustomEvent("boltdocs:navigation-start", { detail: location }));
118
255
  }
119
- function scheduleLocationUpdate(setLocation, nextLocation, viewTransitions) {
256
+ function scheduleLocationUpdate(setLocation, nextLocation, viewTransitions, direction = "none") {
120
257
  setTimeout(() => {
121
258
  const enabled = typeof viewTransitions === "boolean" ? viewTransitions : viewTransitions?.enabled === true;
122
259
  const startViewTransition = document.startViewTransition;
123
- if (enabled && startViewTransition) {
124
- const types = typeof viewTransitions === "object" ? viewTransitions.types : void 0;
260
+ if (enabled && startViewTransition && !prefersReducedMotion()) {
261
+ const types = resolveTransitionTypes(typeof viewTransitions === "object" ? viewTransitions.types : void 0, direction);
125
262
  startViewTransition.call(document, {
126
263
  update: () => setLocation(nextLocation),
127
264
  ...types?.length ? { types } : {}
@@ -148,16 +285,44 @@ const LocationProvider = ({ pathname: propPathname, children, loaderData = null,
148
285
  hash: ""
149
286
  } : defaultLocation;
150
287
  });
288
+ const historyIndex = (0, react.useRef)(0);
289
+ (0, react.useEffect)(() => {
290
+ if (typeof window === "undefined") return;
291
+ const stored = window.history.state;
292
+ if (typeof stored?.__boltdocsIndex === "number") historyIndex.current = stored.__boltdocsIndex;
293
+ }, []);
294
+ const pushHistoryState = (0, react.useCallback)((state, url, replace) => {
295
+ if (typeof window === "undefined") return "none";
296
+ const nextIndex = replace ? historyIndex.current : historyIndex.current + 1;
297
+ const payload = {
298
+ ...typeof state === "object" && state !== null ? state : {},
299
+ __boltdocsIndex: nextIndex
300
+ };
301
+ if (replace) window.history.replaceState(payload, "", url);
302
+ else window.history.pushState(payload, "", url);
303
+ historyIndex.current = nextIndex;
304
+ return replace ? "none" : "forward";
305
+ }, []);
306
+ const readPopDirection = (0, react.useCallback)(() => {
307
+ if (typeof window === "undefined") return "none";
308
+ const stored = window.history.state;
309
+ const nextIndex = typeof stored?.__boltdocsIndex === "number" ? stored.__boltdocsIndex : historyIndex.current;
310
+ const previous = historyIndex.current;
311
+ historyIndex.current = nextIndex;
312
+ if (nextIndex > previous) return "forward";
313
+ if (nextIndex < previous) return "back";
314
+ return "none";
315
+ }, []);
151
316
  (0, react.useEffect)(() => {
152
317
  if (typeof window === "undefined") return;
153
318
  const handlePopState = () => {
154
319
  const nextLocation = getLocationFromWindow();
155
- scheduleLocationUpdate(setLocation, nextLocation, viewTransitions);
320
+ scheduleLocationUpdate(setLocation, nextLocation, viewTransitions, readPopDirection());
156
321
  dispatchNavigationStart(nextLocation);
157
322
  };
158
323
  window.addEventListener("popstate", handlePopState);
159
324
  return () => window.removeEventListener("popstate", handlePopState);
160
- }, [viewTransitions]);
325
+ }, [readPopDirection, viewTransitions]);
161
326
  const prefetched = (0, react.useRef)(/* @__PURE__ */ new Set());
162
327
  const fallbackPrefetch = (0, react.useCallback)(async (to) => {
163
328
  if (typeof window === "undefined" || !to || prefetched.current.has(to)) return;
@@ -186,7 +351,7 @@ const LocationProvider = ({ pathname: propPathname, children, loaderData = null,
186
351
  }
187
352
  if (options?.replace) window.history.replaceState(options.state ?? null, "", newUrl.href);
188
353
  else window.history.pushState(options?.state ?? null, "", newUrl.href);
189
- scheduleLocationUpdate(setLocation, nextLocation, options?.viewTransition === false ? false : viewTransitions);
354
+ scheduleLocationUpdate(setLocation, nextLocation, options?.viewTransition === false ? false : viewTransitions, "none");
190
355
  dispatchNavigationStart(nextLocation);
191
356
  return;
192
357
  }
@@ -206,18 +371,18 @@ const LocationProvider = ({ pathname: propPathname, children, loaderData = null,
206
371
  else window.history.pushState(options.state, "", finalPath);
207
372
  return;
208
373
  }
209
- if (options?.replace) window.history.replaceState(options?.state ?? null, "", finalPath);
210
- else window.history.pushState(options?.state ?? null, "", finalPath);
374
+ const direction = pushHistoryState(options?.state ?? null, finalPath, options?.replace === true);
211
375
  const nextLocation = {
212
376
  pathname: finalUrl.pathname,
213
377
  search: finalUrl.search,
214
378
  hash: finalUrl.hash
215
379
  };
216
- scheduleLocationUpdate(setLocation, nextLocation, options?.viewTransition === false ? false : viewTransitions);
380
+ scheduleLocationUpdate(setLocation, nextLocation, options?.viewTransition === false ? false : viewTransitions, direction);
217
381
  dispatchNavigationStart(nextLocation);
218
382
  }, [
219
383
  basename,
220
384
  defaultLocale,
385
+ pushHistoryState,
221
386
  viewTransitions
222
387
  ]);
223
388
  (0, react.useEffect)(() => {
@@ -1025,6 +1190,12 @@ function resolveUrlReference(to, config, options = {}) {
1025
1190
  }
1026
1191
 
1027
1192
  //#endregion
1193
+ Object.defineProperty(exports, 'ConfigContext', {
1194
+ enumerable: true,
1195
+ get: function () {
1196
+ return ConfigContext;
1197
+ }
1198
+ });
1028
1199
  Object.defineProperty(exports, 'LocationContext', {
1029
1200
  enumerable: true,
1030
1201
  get: function () {
@@ -1229,6 +1400,12 @@ Object.defineProperty(exports, 'splitUrlReference', {
1229
1400
  return splitUrlReference;
1230
1401
  }
1231
1402
  });
1403
+ Object.defineProperty(exports, 'startViewTransition', {
1404
+ enumerable: true,
1405
+ get: function () {
1406
+ return startViewTransition;
1407
+ }
1408
+ });
1232
1409
  Object.defineProperty(exports, 'stripBasename', {
1233
1410
  enumerable: true,
1234
1411
  get: function () {
@@ -1247,6 +1424,12 @@ Object.defineProperty(exports, 'stripUrlBase', {
1247
1424
  return stripUrlBase;
1248
1425
  }
1249
1426
  });
1427
+ Object.defineProperty(exports, 'useConfig', {
1428
+ enumerable: true,
1429
+ get: function () {
1430
+ return useConfig;
1431
+ }
1432
+ });
1250
1433
  Object.defineProperty(exports, 'useLoaderData', {
1251
1434
  enumerable: true,
1252
1435
  get: function () {
@@ -1271,6 +1454,12 @@ Object.defineProperty(exports, 'useNavigate', {
1271
1454
  return useNavigate;
1272
1455
  }
1273
1456
  });
1457
+ Object.defineProperty(exports, 'useOptionalConfig', {
1458
+ enumerable: true,
1459
+ get: function () {
1460
+ return useOptionalConfig;
1461
+ }
1462
+ });
1274
1463
  Object.defineProperty(exports, 'usePrefetch', {
1275
1464
  enumerable: true,
1276
1465
  get: function () {
@@ -1282,4 +1471,10 @@ Object.defineProperty(exports, 'useRouteData', {
1282
1471
  get: function () {
1283
1472
  return useRouteData;
1284
1473
  }
1474
+ });
1475
+ Object.defineProperty(exports, 'useViewTransition', {
1476
+ enumerable: true,
1477
+ get: function () {
1478
+ return useViewTransition;
1479
+ }
1285
1480
  });
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- const e=require(`./pages-external-DPiPFxxP.cjs`),t=require(`./routes-CzhKOw67.cjs`);exports.generateRoutes=t.t,exports.getExternalRoutePaths=e.n,exports.invalidateDirectoryMetaFile=t.n,exports.invalidateFile=t.r,exports.invalidateRouteCache=t.i;
6
+ const e=require(`./pages-external-B_r6gvqP.cjs`),t=require(`./routes-DdE6Lfcl.cjs`);exports.generateRoutes=t.t,exports.getExternalRoutePaths=e.n,exports.invalidateDirectoryMetaFile=t.n,exports.invalidateFile=t.r,exports.invalidateRouteCache=t.i;
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- const e=require(`./chunk-D1Md3oWO.cjs`),t=require(`./utils-ej6_SjIZ.cjs`),n=require(`./node/cache.cjs`),r=require(`./cache-CJE9nWLE.cjs`);let i=require(`node:path`);i=e.r(i);let a=require(`node:fs`);a=e.r(a);let o=require(`node:crypto`);o=e.r(o);let s=require(`@bdocs/dui`),c=require(`node:fs/promises`);c=e.r(c);let l=require(`fdir`);function u(e){return i.default.resolve(e)}function d(e,t){return o.default.createHash(`sha1`).update(`${u(e)}:${t}`).digest(`hex`).slice(0,16)}function f(e,a,o){let s=d(e,o),c=t.o();return{fingerprint:o,docCache:new n.FileCache({name:`routes-${s}`,root:a}),parserCache:new r.t(a,s),cachedFileList:null,localizedPathCache:new Map,cachedNativeDocs:null,frontmatterHashes:new Map,directoryMeta:null,cachedDirectoryMetaFiles:null,directoryMetaEntries:new Map,discoverySnapshot:null,discoverySnapshotLoaded:!1,discoverySnapshotPath:i.default.resolve(a,c.dir,`route-discovery-${s}.json`)}}function p(e,t=i.default.dirname(i.default.resolve(e))){let n=u(e),r=i.default.resolve(t),a=f(n,r,`legacy`);return{docsDir:n,cacheRoot:r,docCache:a.docCache,parserCache:a.parserCache,cachedFileList:a.cachedFileList,localizedPathCache:a.localizedPathCache,cachedNativeDocs:a.cachedNativeDocs,frontmatterHashes:a.frontmatterHashes,directoryMeta:a.directoryMeta,cachedDirectoryMetaFiles:a.cachedDirectoryMetaFiles,variants:new Map([[`legacy`,a]]),activeVariant:a,activeGenerations:new Map,generationEpoch:0,disposed:!1}}const m=new Map;function h(e,t,n=!1){if(e.disposed)throw Error(`[boltdocs] Route cache context has been disposed.`);let r=e.variants.get(t);if(!r&&(r=f(e.docsDir,e.cacheRoot,t),e.variants.set(t,r),e.variants.size>8)){for(let[n,r]of e.variants)if(!(n===t||r===e.activeVariant)&&!e.activeGenerations.has(n)){e.variants.delete(n);break}}return n&&(e.activeVariant=r,e.docCache=r.docCache,e.parserCache=r.parserCache,e.cachedFileList=r.cachedFileList,e.localizedPathCache=r.localizedPathCache,e.cachedNativeDocs=r.cachedNativeDocs,e.frontmatterHashes=r.frontmatterHashes,e.directoryMeta=r.directoryMeta,e.cachedDirectoryMetaFiles=r.cachedDirectoryMetaFiles),r}function g(e,t){e.activeVariant===t&&(e.cachedFileList=t.cachedFileList,e.cachedNativeDocs=t.cachedNativeDocs,e.frontmatterHashes=t.frontmatterHashes,e.directoryMeta=t.directoryMeta,e.cachedDirectoryMetaFiles=t.cachedDirectoryMetaFiles)}function _(e,t){return o.default.createHash(`sha1`).update(JSON.stringify({basePath:t||e?.base||`/docs`,i18n:e?.i18n,versions:e?.versions,drafts:e?.drafts,featureFlags:e?.featureFlags,fileRouting:e?.experimental?.fileRouting,sidebarGroups:e?.theme?.sidebarGroups})).digest(`hex`)}function v(e,t){let n=u(e),r=m.get(n),i=t??r;(!i||r===i)&&m.delete(n),i&&(i.disposed=!0,i.generationEpoch++,i.activeGenerations.clear(),i.variants.clear(),i.activeVariant=null,i.cachedFileList=null,i.localizedPathCache.clear(),i.cachedNativeDocs=null,i.frontmatterHashes.clear(),i.directoryMeta=null,i.cachedDirectoryMetaFiles=null)}function y(e){let t=u(e),n=m.get(t);return n||(n=p(t),m.set(t,n)),n}const b=p(i.default.resolve(process.cwd(),`docs`)),x=b.docCache;function S(e){try{a.default.rmSync(e.discoverySnapshotPath,{force:!0})}catch{}}function C(e){let t=typeof e==`string`?y(e):e??b;for(let e of t.variants.values())e.cachedFileList=null,e.localizedPathCache.clear(),e.cachedNativeDocs=null,e.frontmatterHashes.clear(),e.directoryMeta=null,e.cachedDirectoryMetaFiles=null,e.discoverySnapshot=null,e.discoverySnapshotLoaded=!1,S(e),e.docCache.invalidateAll(),e.parserCache.clear();t.cachedFileList=null,t.localizedPathCache.clear(),t.cachedNativeDocs=null,t.frontmatterHashes.clear(),t.directoryMeta=null,t.cachedDirectoryMetaFiles=null,t.generationEpoch++}function w(e,t){let n=typeof t==`string`?y(t):t??b,r=i.default.resolve(e);for(let e of n.variants.values()){for(let t of e.directoryMetaEntries.keys())i.default.resolve(t)===r&&e.directoryMetaEntries.delete(t);e.directoryMeta=null,e.cachedDirectoryMetaFiles=null,e.discoverySnapshot=null,e.discoverySnapshotLoaded=!1,S(e)}n.directoryMeta=null,n.cachedDirectoryMetaFiles=null,n.generationEpoch++}function T(e,t){let n=typeof t==`string`?y(t):t??b;for(let t of n.variants.values())t.docCache.invalidate(e),t.parserCache.invalidate(e),t.cachedNativeDocs?.[e.replace(/\\/g,`/`)]&&delete t.cachedNativeDocs[e.replace(/\\/g,`/`)],t.frontmatterHashes.delete(e);n.cachedNativeDocs=n.activeVariant?.cachedNativeDocs??null,n.frontmatterHashes.delete(e),n.generationEpoch++}function E(e){return e.sort((e,t)=>{let n=e.group?e.groupPosition??999:e.sidebarPosition??999,r=t.group?t.groupPosition??999:t.sidebarPosition??999;return n===r?!e.group&&t.group?-1:e.group&&!t.group?1:e.group&&t.group&&e.group!==t.group?(e.groupTitle||e.group).localeCompare(t.groupTitle||t.group):D(e,t):n-r})}function D(e,t){if(e.sidebarPosition!==void 0&&t.sidebarPosition!==void 0){let n=e.sidebarPosition-t.sidebarPosition;if(n!==0)return n}else if(e.sidebarPosition!==void 0)return-1;else if(t.sidebarPosition!==void 0)return 1;let n=e.title.localeCompare(t.title);return n===0?e.path.localeCompare(t.path):n}const O=new Map;function k(e){let{lastUpdated:t,...n}=e;return o.default.createHash(`md5`).update(JSON.stringify(n)).digest(`hex`)}async function A(e){try{let{data:n}=await t.d(e);return k(n)}catch{return``}}function j(e,t,n){let r=n?.frontmatterHashes??t?.frontmatterHashes??O,i=r.get(e);if(i===void 0){let a=(n?.docCache??t?.docCache??x).getStale(e);a?.route?.frontmatter&&(i=k(a.route.frontmatter),r.set(e,i))}return i}function M(e,t,n,r){(r?.frontmatterHashes??n?.frontmatterHashes??O).set(e,t)}function N(e,t,n){(n?.frontmatterHashes??t?.frontmatterHashes??O).delete(e)}const P=Symbol(`route-generation-invalidated`);async function F(e,t,n){let r=[...t].sort((e,t)=>{if(i.default.dirname(e)===i.default.dirname(t)){let n=i.default.basename(e),r=i.default.basename(t);if(n===`_meta.json`&&r===`meta.json`)return-1;if(n===`meta.json`&&r===`_meta.json`)return 1}return e.localeCompare(t)}),a=new Set(r),o=n.directoryMetaEntries;for(let e of o.keys())a.has(e)||o.delete(e);await Promise.all(r.map(async e=>{let t;try{t=await c.default.stat(e)}catch(t){o.delete(e),(0,s.warn)(`Failed to stat meta.json: ${t instanceof Error?t.message:String(t)}`);return}let n=o.get(e);if(!(n&&n.mtimeMs===t.mtimeMs&&n.size===t.size))try{let n=await c.default.readFile(e,`utf8`);o.set(e,{mtimeMs:t.mtimeMs,size:t.size,content:JSON.parse(n)})}catch(t){o.delete(e),(0,s.warn)(`Failed to read meta.json: ${t instanceof Error?t.message:String(t)}`)}}));let l={};for(let t of r){let n=o.get(t);if(!n)continue;let r=i.default.relative(e,i.default.dirname(t)).replace(/\\/g,`/`);l[r||`.`]=n.content}return l}async function I(e,n){if(!n.discoverySnapshotPath||t.o().noCache)return null;if(n.discoverySnapshotLoaded)return n.discoverySnapshot;n.discoverySnapshotLoaded=!0;try{let t=await c.default.readFile(n.discoverySnapshotPath,`utf8`),r=JSON.parse(t),a=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),o=r.files,s=r.directoryMetaFiles,l=r.directories&&typeof r.directories==`object`?Object.entries(r.directories):[],u=i.default.resolve(e),d=await c.default.realpath(u),f=e=>{let t=i.default.resolve(e);return t===u||t.startsWith(`${u}${i.default.sep}`)},p=e=>/\.(?:md|mdx)$/i.test(e),m=e=>{let t=i.default.basename(e);return t===`meta.json`||t===`_meta.json`};if(r.version!==1||!a(o)||!a(s)||!r.directories||typeof r.directories!=`object`||Array.isArray(r.directories)||o.some(e=>!f(e)||!p(e))||s.some(e=>!f(e)||!m(e))||l.some(([e,t])=>!f(e)||typeof t!=`number`||!Number.isFinite(t)))return null;let h=e=>{let t=i.default.resolve(e);return t===d||t.startsWith(`${d}${i.default.sep}`)},g=await Promise.all([...o,...s].map(async e=>{try{return(await c.default.lstat(e)).isFile()?h(await c.default.realpath(e)):!1}catch{return!1}})),_=await Promise.all(l.map(async([e,t])=>{try{let n=await c.default.stat(e);return n.isDirectory()&&n.mtimeMs===t&&h(await c.default.realpath(e))}catch{return!1}}));if(g.every(Boolean)&&_.every(Boolean)){let e={version:1,files:o,directoryMetaFiles:s,directories:Object.fromEntries(l)};return n.discoverySnapshot=e,e}}catch{}return null}async function L(e,n){if(t.o().noCache){e.discoverySnapshot=null,e.discoverySnapshotLoaded=!1;return}e.discoverySnapshot=n,e.discoverySnapshotLoaded=!0;try{await c.default.mkdir(i.default.dirname(e.discoverySnapshotPath),{recursive:!0}),await c.default.writeFile(e.discoverySnapshotPath,JSON.stringify(n))}catch{}}async function R(e,t,n){if(!n){let n=await I(e,t);if(n)return n}let r=await new l.fdir({excludeSymlinks:!0}).withFullPaths().filter(t=>{let n=i.default.basename(t),r=n===`meta.json`||n===`_meta.json`;return!(t.endsWith(`.md`)||t.endsWith(`.mdx`))&&!r?!1:!i.default.relative(e,t).replace(/\\/g,`/`).split(`/`).some(e=>e.startsWith(`_`)&&e!==`_index.md`&&e!==`_index.mdx`&&e!==`_meta.json`)}).crawl(e).withPromise(),a=r.filter(e=>{let t=i.default.basename(e);return t===`meta.json`||t===`_meta.json`}).sort((e,t)=>e.localeCompare(t)),o=r.filter(e=>e.endsWith(`.md`)||e.endsWith(`.mdx`)),s=[/index\./i,/intro/i,/getting-started/i,/readme/i],u=o.map(e=>{let t=s.findIndex(t=>t.test(i.default.basename(e)));return{file:e,score:t===-1?2**53-1:t}});u.sort((e,t)=>e.score-t.score||e.file.localeCompare(t.file));let d=u.map(({file:e})=>e),f=[...d,...a],p=new Set([i.default.resolve(e)]);for(let t of f){let n=i.default.dirname(t);for(;n.startsWith(i.default.resolve(e))&&(p.add(n),n!==i.default.resolve(e));)n=i.default.dirname(n)}let m=await Promise.all([...p].sort().map(async e=>{try{return[e,(await c.default.stat(e)).mtimeMs]}catch{return null}})),h={version:1,files:d,directoryMetaFiles:a,directories:Object.fromEntries(m.filter(e=>e!==null))};return await L(t,h),h}async function z(e,t,n){let r=Array(e.length),i=0;async function a(){for(;i<e.length;){let t=i++;r[t]=await n(e[t])}}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>a())),r}function B(e,t){w(e,t)}function V(e,t){let n=typeof t==`string`?y(t):t;if(n){let t=e.replace(/\\/g,`/`);(i.default.basename(t)===`meta.json`||i.default.basename(t)===`_meta.json`)&&w(e,n),n.cachedNativeDocs?.[t]&&delete n.cachedNativeDocs[t],T(e,n);return}T(e)}function H(e){if(e){C(e);return}C()}async function U(e,n,r,a=!1,o,s){let c=o??y(e);if(c.disposed)throw Error(`[boltdocs] Route cache context has been disposed.`);let l=_(n,r);if(s&&s.fingerprint!==l)throw Error(`[boltdocs] Route cache variant does not match the requested route configuration fingerprint.`);if(s&&c.variants.get(l)!==s)throw Error(`[boltdocs] Route cache variant does not belong to the requested route cache context.`);let u=c.activeGenerations.get(l);if(u)return u;let d=s??h(c,l),f=c.generationEpoch,p=(async()=>{let o=r||n?.base||`/docs`;await d.docCache.load();let s,l=await R(e,d,a||t.o().noCache);s=l.files.filter(r=>n?.experimental?.fileRouting?!t.u(i.default.relative(e,r)).split(`/`).includes(`pages-external`):!0);let u=l.directoryMetaFiles;d.cachedFileList=s,d.cachedDirectoryMetaFiles=u,d.directoryMeta=await F(e,u,d),g(c,d),d.docCache.pruneStale(new Set(s));let p=process.env.NODE_ENV===`test`||process.env.VITEST===`true`,m,h=!0;for(let e of s)if(!d.docCache.get(e)){h=!1;break}if(h)m=s.map(e=>{let t=d.docCache.get(e);if(!t)throw Error(`[boltdocs] Route cache entry disappeared for ${e}`);return t});else{if(!p&&!d.cachedNativeDocs)try{let{runParser:t}=await import(`@bdocs/parser`);d.cachedNativeDocs=await t(e,!0)}catch{}if(!p&&d.cachedNativeDocs!==null&&d.cachedNativeDocs){let{parseDocFileWithNative:t}=await Promise.resolve().then(()=>require(`./native-nLA4Jr0T.cjs`)),r=s.filter(e=>!d.cachedNativeDocs?.[e.replace(/\\/g,`/`)]);if(r.length>0)try{let{runParserFiles:t}=await import(`@bdocs/parser`),n=await t(e,r,!0);d.cachedNativeDocs={...d.cachedNativeDocs,...n}}catch{}let i=s.some(e=>!d.cachedNativeDocs?.[e.replace(/\\/g,`/`)])?(await Promise.resolve().then(()=>require(`./parser-vPaKvzLp.cjs`))).parseDocFile:void 0;m=await z(s,32,async r=>{let a=d.docCache.get(r);if(a)return a;let s=r.replace(/\\/g,`/`),c=d.cachedNativeDocs[s];if(c){let i=await t(r,c,e,o,n,d.parserCache);return d.docCache.set(r,i),i}else{if(!i)throw Error(`[boltdocs] Native parser did not return a document for ${r}`);let t=await i(r,e,o,n,d.parserCache);return d.docCache.set(r,t),t}})}else{let{parseDocFile:t}=await Promise.resolve().then(()=>require(`./parser-vPaKvzLp.cjs`));m=await z(s,32,async r=>{let i=d.docCache.get(r);if(i)return i;let a=await t(r,e,o,n,d.parserCache);return d.docCache.set(r,a),a})}}if(c.generationEpoch!==f)throw P;for(let e of m)M(e.route.componentPath,k(e.route.frontmatter||{}),c,d);d.docCache.save();let _=[],v=new Map,y=process.env.NODE_ENV||`development`,b=n?.drafts?.visible||process.env.BOLTDOCS_DRAFTS===`true`||(n?.drafts?.environments?.includes(y)??!1);for(let e of m)if(!(e.route.draft&&!b)){if(e.route.featureFlags&&n?.featureFlags){if(!e.route.featureFlags.every(e=>{let t=n.featureFlags?.[e];return t===!0||t===y}))continue}else if(e.route.featureFlags&&!n?.featureFlags)continue;if(e.inferredCollection){let t=e.inferredCollection;v.has(t)||v.set(t,[]),v.get(t).push(e)}else _.push(e)}let x=new Map,S=[],C=n?.i18n?.defaultLocale||``;for(let e of _)if(e.isGroupIndex&&e.relativeDir&&S.push(e),e.relativeDir){let n=`${e.route.locale||C}:${e.relativeDir}`,r=x.get(n);r?r.position===void 0&&e.inferredGroupPosition!==void 0&&(r.position=e.inferredGroupPosition):(r={title:t.t(e.relativeDir),position:e.inferredGroupPosition},x.set(n,r))}for(let e of S){let t=`${e.route.locale||C}:${e.relativeDir}`,n=x.get(t);e.groupMeta&&(n.title=e.groupMeta.title,e.groupMeta.position!==void 0&&(n.position=e.groupMeta.position),e.groupMeta.icon&&(n.icon=e.groupMeta.icon))}if(n?.theme?.sidebarGroups){let e=n.i18n?Array.isArray(n.i18n.locales)?n.i18n.locales:Object.keys(n.i18n.locales):[C];for(let[r,i]of Object.entries(n.theme.sidebarGroups))for(let n of e){let e=`${n}:${r}`,a=x.get(e),o;typeof i.title==`string`?o=i.title:i.title&&(o=i.title[n]||i.title[C]),a?(o&&(a.title=o),i.icon&&(a.icon=i.icon)):x.set(e,{title:o||t.t(r),icon:i.icon})}}let w=Array(_.length);for(let e=0;e<_.length;e++){let n=_[e],r=n.relativeDir,i=n.route.locale||C,a=r?`${i}:${r}`:void 0,o=a?x.get(a):void 0,s;o&&(s=typeof o.title==`string`?o.title:o.title[i]||o.title[C]),w[e]={...n.route,group:r,groupTitle:s||(r?t.t(r):void 0),groupPosition:o?.position,groupIcon:o?.icon}}let T=[];for(let[,e]of v)for(let t of e)T.push({...t.route,collection:t.inferredCollection});T.sort((e,t)=>{let n=e=>{if(!e)return-1/0;let t=new Date(e).getTime();return Number.isFinite(t)?t:-1/0},r=n(e.date),i=n(t.date)-r;return i===0?e.path.localeCompare(t.path):i});let D=w;if(n?.i18n){let e=W(w,n,o,d.localizedPathCache);D=[...w,...e]}let O=[...E(D),...T];if(c.generationEpoch!==f)throw P;return O})();c.activeGenerations.set(l,p);try{return await p}catch(t){if(t!==P)throw t;if(c.disposed)throw Error(`[boltdocs] Route cache context was disposed during generation.`);d.docCache.invalidateAll(),d.parserCache.clear(),c.activeGenerations.get(l)===p&&c.activeGenerations.delete(l);let i=0;for(;i<10;)try{return await U(e,n,r,a,c)}catch(e){if(e!==P)throw e;if(c.disposed)throw Error(`[boltdocs] Route cache context was disposed during generation.`);i++}throw Error(`[boltdocs] Route generation was repeatedly invalidated by concurrent file changes.`)}finally{c.activeGenerations.get(l)===p&&c.activeGenerations.delete(l)}}function W(e,t,n,r){let i=t.i18n;if(!i)return[];let a=i.defaultLocale,o=Array.isArray(i.locales)?i.locales:Object.keys(i.locales),s=[],c=new Map,l=[];for(let t of e){let e=t.locale||a,n=c.get(e);n||(n=new Set,c.set(e,n)),n.add(t.path),e===a&&l.push(t)}for(let e of o){if(e===a)continue;let i=c.get(e)||new Set;for(let o of l){let c=G(o.path,a,e,n,t,r);c!==o.path&&(i.has(c)||s.push({...o,path:c,locale:e}))}}return s}function G(e,t,n,r,i,a){let o=`${e}:${n}`,s=a.get(o);if(s)return s;let c=r.startsWith(`/`)?r:`/`+r,l=c;if(i?.versions){let t=i.versions.prefix||``;for(let n of i.versions.versions){let r=`${c}/${t+n.path}`;if(e.startsWith(r)){l=r;break}let i=`${c}/${n.path}`;if(e.startsWith(i)){l=i;break}}}let u=e.substring(l.length),d=`/${t}`;if(u.startsWith(d+`/`))u=`/`+n+`/`+u.substring(d.length+1);else if(u===d)u=`/`+n;else if(u===`/`||u===``)u=`/`+n;else{let e=u.startsWith(`/`)?``:`/`;u=`/`+n+e+u}let f=l+u;return a.size>2e3&&a.clear(),a.set(o,f),f}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return x}});
6
+ const e=require(`./chunk-D1Md3oWO.cjs`),t=require(`./utils-ej6_SjIZ.cjs`),n=require(`./node/cache.cjs`),r=require(`./cache-CJE9nWLE.cjs`);let i=require(`node:path`);i=e.r(i);let a=require(`node:fs`);a=e.r(a);let o=require(`node:crypto`);o=e.r(o);let s=require(`@bdocs/dui`),c=require(`node:fs/promises`);c=e.r(c);let l=require(`fdir`);function u(e){return i.default.resolve(e)}function d(e,t){return o.default.createHash(`sha1`).update(`${u(e)}:${t}`).digest(`hex`).slice(0,16)}function f(e,a,o){let s=d(e,o),c=t.o();return{fingerprint:o,docCache:new n.FileCache({name:`routes-${s}`,root:a}),parserCache:new r.t(a,s),cachedFileList:null,localizedPathCache:new Map,cachedNativeDocs:null,frontmatterHashes:new Map,directoryMeta:null,cachedDirectoryMetaFiles:null,directoryMetaEntries:new Map,discoverySnapshot:null,discoverySnapshotLoaded:!1,discoverySnapshotPath:i.default.resolve(a,c.dir,`route-discovery-${s}.json`)}}function p(e,t=i.default.dirname(i.default.resolve(e))){let n=u(e),r=i.default.resolve(t),a=f(n,r,`legacy`);return{docsDir:n,cacheRoot:r,docCache:a.docCache,parserCache:a.parserCache,cachedFileList:a.cachedFileList,localizedPathCache:a.localizedPathCache,cachedNativeDocs:a.cachedNativeDocs,frontmatterHashes:a.frontmatterHashes,directoryMeta:a.directoryMeta,cachedDirectoryMetaFiles:a.cachedDirectoryMetaFiles,variants:new Map([[`legacy`,a]]),activeVariant:a,activeGenerations:new Map,generationEpoch:0,disposed:!1}}const m=new Map;function h(e,t,n=!1){if(e.disposed)throw Error(`[boltdocs] Route cache context has been disposed.`);let r=e.variants.get(t);if(!r&&(r=f(e.docsDir,e.cacheRoot,t),e.variants.set(t,r),e.variants.size>8)){for(let[n,r]of e.variants)if(!(n===t||r===e.activeVariant)&&!e.activeGenerations.has(n)){e.variants.delete(n);break}}return n&&(e.activeVariant=r,e.docCache=r.docCache,e.parserCache=r.parserCache,e.cachedFileList=r.cachedFileList,e.localizedPathCache=r.localizedPathCache,e.cachedNativeDocs=r.cachedNativeDocs,e.frontmatterHashes=r.frontmatterHashes,e.directoryMeta=r.directoryMeta,e.cachedDirectoryMetaFiles=r.cachedDirectoryMetaFiles),r}function g(e,t){e.activeVariant===t&&(e.cachedFileList=t.cachedFileList,e.cachedNativeDocs=t.cachedNativeDocs,e.frontmatterHashes=t.frontmatterHashes,e.directoryMeta=t.directoryMeta,e.cachedDirectoryMetaFiles=t.cachedDirectoryMetaFiles)}function _(e,t){return o.default.createHash(`sha1`).update(JSON.stringify({basePath:t||e?.base||`/docs`,i18n:e?.i18n,versions:e?.versions,drafts:e?.drafts,featureFlags:e?.featureFlags,fileRouting:e?.experimental?.fileRouting,sidebarGroups:e?.theme?.sidebarGroups})).digest(`hex`)}function v(e,t){let n=u(e),r=m.get(n),i=t??r;(!i||r===i)&&m.delete(n),i&&(i.disposed=!0,i.generationEpoch++,i.activeGenerations.clear(),i.variants.clear(),i.activeVariant=null,i.cachedFileList=null,i.localizedPathCache.clear(),i.cachedNativeDocs=null,i.frontmatterHashes.clear(),i.directoryMeta=null,i.cachedDirectoryMetaFiles=null)}function y(e){let t=u(e),n=m.get(t);return n||(n=p(t),m.set(t,n)),n}const b=p(i.default.resolve(process.cwd(),`docs`)),x=b.docCache;function S(e){try{a.default.rmSync(e.discoverySnapshotPath,{force:!0})}catch{}}function C(e){let t=typeof e==`string`?y(e):e??b;for(let e of t.variants.values())e.cachedFileList=null,e.localizedPathCache.clear(),e.cachedNativeDocs=null,e.frontmatterHashes.clear(),e.directoryMeta=null,e.cachedDirectoryMetaFiles=null,e.discoverySnapshot=null,e.discoverySnapshotLoaded=!1,S(e),e.docCache.invalidateAll(),e.parserCache.clear();t.cachedFileList=null,t.localizedPathCache.clear(),t.cachedNativeDocs=null,t.frontmatterHashes.clear(),t.directoryMeta=null,t.cachedDirectoryMetaFiles=null,t.generationEpoch++}function w(e,t){let n=typeof t==`string`?y(t):t??b,r=i.default.resolve(e);for(let e of n.variants.values()){for(let t of e.directoryMetaEntries.keys())i.default.resolve(t)===r&&e.directoryMetaEntries.delete(t);e.directoryMeta=null,e.cachedDirectoryMetaFiles=null,e.discoverySnapshot=null,e.discoverySnapshotLoaded=!1,S(e)}n.directoryMeta=null,n.cachedDirectoryMetaFiles=null,n.generationEpoch++}function T(e,t){let n=typeof t==`string`?y(t):t??b;for(let t of n.variants.values())t.docCache.invalidate(e),t.parserCache.invalidate(e),t.cachedNativeDocs?.[e.replace(/\\/g,`/`)]&&delete t.cachedNativeDocs[e.replace(/\\/g,`/`)],t.frontmatterHashes.delete(e);n.cachedNativeDocs=n.activeVariant?.cachedNativeDocs??null,n.frontmatterHashes.delete(e),n.generationEpoch++}function E(e){return e.sort((e,t)=>{let n=e.group?e.groupPosition??999:e.sidebarPosition??999,r=t.group?t.groupPosition??999:t.sidebarPosition??999;return n===r?!e.group&&t.group?-1:e.group&&!t.group?1:e.group&&t.group&&e.group!==t.group?(e.groupTitle||e.group).localeCompare(t.groupTitle||t.group):D(e,t):n-r})}function D(e,t){if(e.sidebarPosition!==void 0&&t.sidebarPosition!==void 0){let n=e.sidebarPosition-t.sidebarPosition;if(n!==0)return n}else if(e.sidebarPosition!==void 0)return-1;else if(t.sidebarPosition!==void 0)return 1;let n=e.title.localeCompare(t.title);return n===0?e.path.localeCompare(t.path):n}const O=new Map;function k(e){let{lastUpdated:t,...n}=e;return o.default.createHash(`md5`).update(JSON.stringify(n)).digest(`hex`)}async function A(e){try{let{data:n}=await t.d(e);return k(n)}catch{return``}}function j(e,t,n){let r=n?.frontmatterHashes??t?.frontmatterHashes??O,i=r.get(e);if(i===void 0){let a=(n?.docCache??t?.docCache??x).getStale(e);a?.route?.frontmatter&&(i=k(a.route.frontmatter),r.set(e,i))}return i}function M(e,t,n,r){(r?.frontmatterHashes??n?.frontmatterHashes??O).set(e,t)}function N(e,t,n){(n?.frontmatterHashes??t?.frontmatterHashes??O).delete(e)}const P=Symbol(`route-generation-invalidated`);async function F(e,t,n){let r=[...t].sort((e,t)=>{if(i.default.dirname(e)===i.default.dirname(t)){let n=i.default.basename(e),r=i.default.basename(t);if(n===`_meta.json`&&r===`meta.json`)return-1;if(n===`meta.json`&&r===`_meta.json`)return 1}return e.localeCompare(t)}),a=new Set(r),o=n.directoryMetaEntries;for(let e of o.keys())a.has(e)||o.delete(e);await Promise.all(r.map(async e=>{let t;try{t=await c.default.stat(e)}catch(t){o.delete(e),(0,s.warn)(`Failed to stat meta.json: ${t instanceof Error?t.message:String(t)}`);return}let n=o.get(e);if(!(n&&n.mtimeMs===t.mtimeMs&&n.size===t.size))try{let n=await c.default.readFile(e,`utf8`);o.set(e,{mtimeMs:t.mtimeMs,size:t.size,content:JSON.parse(n)})}catch(t){o.delete(e),(0,s.warn)(`Failed to read meta.json: ${t instanceof Error?t.message:String(t)}`)}}));let l={};for(let t of r){let n=o.get(t);if(!n)continue;let r=i.default.relative(e,i.default.dirname(t)).replace(/\\/g,`/`);l[r||`.`]=n.content}return l}async function I(e,n){if(!n.discoverySnapshotPath||t.o().noCache)return null;if(n.discoverySnapshotLoaded)return n.discoverySnapshot;n.discoverySnapshotLoaded=!0;try{let t=await c.default.readFile(n.discoverySnapshotPath,`utf8`),r=JSON.parse(t),a=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),o=r.files,s=r.directoryMetaFiles,l=r.directories&&typeof r.directories==`object`?Object.entries(r.directories):[],u=i.default.resolve(e),d=await c.default.realpath(u),f=e=>{let t=i.default.resolve(e);return t===u||t.startsWith(`${u}${i.default.sep}`)},p=e=>/\.(?:md|mdx)$/i.test(e),m=e=>{let t=i.default.basename(e);return t===`meta.json`||t===`_meta.json`};if(r.version!==1||!a(o)||!a(s)||!r.directories||typeof r.directories!=`object`||Array.isArray(r.directories)||o.some(e=>!f(e)||!p(e))||s.some(e=>!f(e)||!m(e))||l.some(([e,t])=>!f(e)||typeof t!=`number`||!Number.isFinite(t)))return null;let h=e=>{let t=i.default.resolve(e);return t===d||t.startsWith(`${d}${i.default.sep}`)},g=await Promise.all([...o,...s].map(async e=>{try{return(await c.default.lstat(e)).isFile()?h(await c.default.realpath(e)):!1}catch{return!1}})),_=await Promise.all(l.map(async([e,t])=>{try{let n=await c.default.stat(e);return n.isDirectory()&&n.mtimeMs===t&&h(await c.default.realpath(e))}catch{return!1}}));if(g.every(Boolean)&&_.every(Boolean)){let e={version:1,files:o,directoryMetaFiles:s,directories:Object.fromEntries(l)};return n.discoverySnapshot=e,e}}catch{}return null}async function L(e,n){if(t.o().noCache){e.discoverySnapshot=null,e.discoverySnapshotLoaded=!1;return}e.discoverySnapshot=n,e.discoverySnapshotLoaded=!0;try{await c.default.mkdir(i.default.dirname(e.discoverySnapshotPath),{recursive:!0}),await c.default.writeFile(e.discoverySnapshotPath,JSON.stringify(n))}catch{}}async function R(e,t,n){if(!n){let n=await I(e,t);if(n)return n}let r=await new l.fdir({excludeSymlinks:!0}).withFullPaths().filter(t=>{let n=i.default.basename(t),r=n===`meta.json`||n===`_meta.json`;return!(t.endsWith(`.md`)||t.endsWith(`.mdx`))&&!r?!1:!i.default.relative(e,t).replace(/\\/g,`/`).split(`/`).some(e=>e.startsWith(`_`)&&e!==`_index.md`&&e!==`_index.mdx`&&e!==`_meta.json`)}).crawl(e).withPromise(),a=r.filter(e=>{let t=i.default.basename(e);return t===`meta.json`||t===`_meta.json`}).sort((e,t)=>e.localeCompare(t)),o=r.filter(e=>e.endsWith(`.md`)||e.endsWith(`.mdx`)),s=[/index\./i,/intro/i,/getting-started/i,/readme/i],u=o.map(e=>{let t=s.findIndex(t=>t.test(i.default.basename(e)));return{file:e,score:t===-1?2**53-1:t}});u.sort((e,t)=>e.score-t.score||e.file.localeCompare(t.file));let d=u.map(({file:e})=>e),f=[...d,...a],p=new Set([i.default.resolve(e)]);for(let t of f){let n=i.default.dirname(t);for(;n.startsWith(i.default.resolve(e))&&(p.add(n),n!==i.default.resolve(e));)n=i.default.dirname(n)}let m=await Promise.all([...p].sort().map(async e=>{try{return[e,(await c.default.stat(e)).mtimeMs]}catch{return null}})),h={version:1,files:d,directoryMetaFiles:a,directories:Object.fromEntries(m.filter(e=>e!==null))};return await L(t,h),h}async function z(e,t,n){let r=Array(e.length),i=0;async function a(){for(;i<e.length;){let t=i++;r[t]=await n(e[t])}}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>a())),r}function B(e,t){w(e,t)}function V(e,t){let n=typeof t==`string`?y(t):t;if(n){let t=e.replace(/\\/g,`/`);(i.default.basename(t)===`meta.json`||i.default.basename(t)===`_meta.json`)&&w(e,n),n.cachedNativeDocs?.[t]&&delete n.cachedNativeDocs[t],T(e,n);return}T(e)}function H(e){if(e){C(e);return}C()}async function U(e,n,r,a=!1,o,s){let c=o??y(e);if(c.disposed)throw Error(`[boltdocs] Route cache context has been disposed.`);let l=_(n,r);if(s&&s.fingerprint!==l)throw Error(`[boltdocs] Route cache variant does not match the requested route configuration fingerprint.`);if(s&&c.variants.get(l)!==s)throw Error(`[boltdocs] Route cache variant does not belong to the requested route cache context.`);let u=c.activeGenerations.get(l);if(u)return u;let d=s??h(c,l),f=c.generationEpoch,p=(async()=>{let o=r||n?.base||`/docs`;await d.docCache.load();let s,l=await R(e,d,a||t.o().noCache);s=l.files.filter(r=>n?.experimental?.fileRouting?!t.u(i.default.relative(e,r)).split(`/`).includes(`pages-external`):!0);let u=l.directoryMetaFiles;d.cachedFileList=s,d.cachedDirectoryMetaFiles=u,d.directoryMeta=await F(e,u,d),g(c,d),d.docCache.pruneStale(new Set(s));let p=process.env.NODE_ENV===`test`||process.env.VITEST===`true`,m,h=!0;for(let e of s)if(!d.docCache.get(e)){h=!1;break}if(h)m=s.map(e=>{let t=d.docCache.get(e);if(!t)throw Error(`[boltdocs] Route cache entry disappeared for ${e}`);return t});else{if(!p&&!d.cachedNativeDocs)try{let{runParser:t}=await import(`@bdocs/parser`);d.cachedNativeDocs=await t(e,!0)}catch{}if(!p&&d.cachedNativeDocs!==null&&d.cachedNativeDocs){let{parseDocFileWithNative:t}=await Promise.resolve().then(()=>require(`./native-BbtRkce5.cjs`)),r=s.filter(e=>!d.cachedNativeDocs?.[e.replace(/\\/g,`/`)]);if(r.length>0)try{let{runParserFiles:t}=await import(`@bdocs/parser`),n=await t(e,r,!0);d.cachedNativeDocs={...d.cachedNativeDocs,...n}}catch{}let i=s.some(e=>!d.cachedNativeDocs?.[e.replace(/\\/g,`/`)])?(await Promise.resolve().then(()=>require(`./parser-DJLWTiO-.cjs`))).parseDocFile:void 0;m=await z(s,32,async r=>{let a=d.docCache.get(r);if(a)return a;let s=r.replace(/\\/g,`/`),c=d.cachedNativeDocs[s];if(c){let i=await t(r,c,e,o,n,d.parserCache);return d.docCache.set(r,i),i}else{if(!i)throw Error(`[boltdocs] Native parser did not return a document for ${r}`);let t=await i(r,e,o,n,d.parserCache);return d.docCache.set(r,t),t}})}else{let{parseDocFile:t}=await Promise.resolve().then(()=>require(`./parser-DJLWTiO-.cjs`));m=await z(s,32,async r=>{let i=d.docCache.get(r);if(i)return i;let a=await t(r,e,o,n,d.parserCache);return d.docCache.set(r,a),a})}}if(c.generationEpoch!==f)throw P;for(let e of m)M(e.route.componentPath,k(e.route.frontmatter||{}),c,d);d.docCache.save();let _=[],v=new Map,y=process.env.NODE_ENV||`development`,b=n?.drafts?.visible||process.env.BOLTDOCS_DRAFTS===`true`||(n?.drafts?.environments?.includes(y)??!1);for(let e of m)if(!(e.route.draft&&!b)){if(e.route.featureFlags&&n?.featureFlags){if(!e.route.featureFlags.every(e=>{let t=n.featureFlags?.[e];return t===!0||t===y}))continue}else if(e.route.featureFlags&&!n?.featureFlags)continue;if(e.inferredCollection){let t=e.inferredCollection;v.has(t)||v.set(t,[]),v.get(t).push(e)}else _.push(e)}let x=new Map,S=[],C=n?.i18n?.defaultLocale||``;for(let e of _)if(e.isGroupIndex&&e.relativeDir&&S.push(e),e.relativeDir){let n=`${e.route.locale||C}:${e.relativeDir}`,r=x.get(n);r?r.position===void 0&&e.inferredGroupPosition!==void 0&&(r.position=e.inferredGroupPosition):(r={title:t.t(e.relativeDir),position:e.inferredGroupPosition},x.set(n,r))}for(let e of S){let t=`${e.route.locale||C}:${e.relativeDir}`,n=x.get(t);e.groupMeta&&(n.title=e.groupMeta.title,e.groupMeta.position!==void 0&&(n.position=e.groupMeta.position),e.groupMeta.icon&&(n.icon=e.groupMeta.icon))}if(n?.theme?.sidebarGroups){let e=n.i18n?Array.isArray(n.i18n.locales)?n.i18n.locales:Object.keys(n.i18n.locales):[C];for(let[r,i]of Object.entries(n.theme.sidebarGroups))for(let n of e){let e=`${n}:${r}`,a=x.get(e),o;typeof i.title==`string`?o=i.title:i.title&&(o=i.title[n]||i.title[C]),a?(o&&(a.title=o),i.icon&&(a.icon=i.icon)):x.set(e,{title:o||t.t(r),icon:i.icon})}}let w=Array(_.length);for(let e=0;e<_.length;e++){let n=_[e],r=n.relativeDir,i=n.route.locale||C,a=r?`${i}:${r}`:void 0,o=a?x.get(a):void 0,s;o&&(s=typeof o.title==`string`?o.title:o.title[i]||o.title[C]),w[e]={...n.route,group:r,groupTitle:s||(r?t.t(r):void 0),groupPosition:o?.position,groupIcon:o?.icon}}let T=[];for(let[,e]of v)for(let t of e)T.push({...t.route,collection:t.inferredCollection});T.sort((e,t)=>{let n=e=>{if(!e)return-1/0;let t=new Date(e).getTime();return Number.isFinite(t)?t:-1/0},r=n(e.date),i=n(t.date)-r;return i===0?e.path.localeCompare(t.path):i});let D=w;if(n?.i18n){let e=W(w,n,o,d.localizedPathCache);D=[...w,...e]}let O=[...E(D),...T];if(c.generationEpoch!==f)throw P;return O})();c.activeGenerations.set(l,p);try{return await p}catch(t){if(t!==P)throw t;if(c.disposed)throw Error(`[boltdocs] Route cache context was disposed during generation.`);d.docCache.invalidateAll(),d.parserCache.clear(),c.activeGenerations.get(l)===p&&c.activeGenerations.delete(l);let i=0;for(;i<10;)try{return await U(e,n,r,a,c)}catch(e){if(e!==P)throw e;if(c.disposed)throw Error(`[boltdocs] Route cache context was disposed during generation.`);i++}throw Error(`[boltdocs] Route generation was repeatedly invalidated by concurrent file changes.`)}finally{c.activeGenerations.get(l)===p&&c.activeGenerations.delete(l)}}function W(e,t,n,r){let i=t.i18n;if(!i)return[];let a=i.defaultLocale,o=Array.isArray(i.locales)?i.locales:Object.keys(i.locales),s=[],c=new Map,l=[];for(let t of e){let e=t.locale||a,n=c.get(e);n||(n=new Set,c.set(e,n)),n.add(t.path),e===a&&l.push(t)}for(let e of o){if(e===a)continue;let i=c.get(e)||new Set;for(let o of l){let c=G(o.path,a,e,n,t,r);c!==o.path&&(i.has(c)||s.push({...o,path:c,locale:e}))}}return s}function G(e,t,n,r,i,a){let o=`${e}:${n}`,s=a.get(o);if(s)return s;let c=r.startsWith(`/`)?r:`/`+r,l=c;if(i?.versions){let t=i.versions.prefix||``;for(let n of i.versions.versions){let r=`${c}/${t+n.path}`;if(e.startsWith(r)){l=r;break}let i=`${c}/${n.path}`;if(e.startsWith(i)){l=i;break}}}let u=e.substring(l.length),d=`/${t}`;if(u.startsWith(d+`/`))u=`/`+n+`/`+u.substring(d.length+1);else if(u===d)u=`/`+n;else if(u===`/`||u===``)u=`/`+n;else{let e=u.startsWith(`/`)?``:`/`;u=`/`+n+e+u}let f=l+u;return a.size>2e3&&a.clear(),a.set(o,f),f}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return x}});