boltdocs 2.7.10 → 2.8.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 (193) hide show
  1. package/README.md +2 -2
  2. package/dist/banner-3N4Jd_L9.d.ts +100 -0
  3. package/dist/banner-MynZD_Ox.d.cts +100 -0
  4. package/dist/cache-BMUyNiiA.mjs +6 -0
  5. package/dist/cache-CKm45d2w.cjs +6 -0
  6. package/dist/client/index.cjs +2268 -1
  7. package/dist/client/index.d.cts +86 -110
  8. package/dist/client/index.d.ts +87 -111
  9. package/dist/client/index.js +2214 -1
  10. package/dist/client/mdx.cjs +12 -1
  11. package/dist/client/mdx.d.cts +39 -93
  12. package/dist/client/mdx.d.ts +38 -93
  13. package/dist/client/mdx.js +7 -1
  14. package/dist/client/primitives.cjs +60 -1
  15. package/dist/client/primitives.d.cts +411 -347
  16. package/dist/client/primitives.d.ts +411 -347
  17. package/dist/client/primitives.js +20 -1
  18. package/dist/docs-layout-CwCq42Zt.cjs +1348 -0
  19. package/dist/docs-layout-Dn6S5g59.js +1167 -0
  20. package/dist/doctor-BArviV8X.cjs +28 -0
  21. package/dist/doctor-CgLA7_Uv.mjs +28 -0
  22. package/dist/{doctor-CrytFkqW.cjs → doctor-DyNUVe96.cjs} +1 -1
  23. package/dist/{routes-DP1vmWRj.cjs → doctor-aN_leTbh.mjs} +1 -1
  24. package/dist/{generator-ClVanhvi.mjs → generator-BHCrLU6h.mjs} +2 -2
  25. package/dist/{generator-CHqxiQhF.cjs → generator-CC2yHzhZ.cjs} +2 -2
  26. package/dist/icons-dev-DvJ-hh9x.cjs +1209 -0
  27. package/dist/icons-dev-Oju24Wjp.js +845 -0
  28. package/dist/image-Ch4-GxdO.cjs +268 -0
  29. package/dist/image-Do8V9PCW.js +214 -0
  30. package/dist/mdx-D3A2_l7P.js +520 -0
  31. package/dist/mdx-PLhhPJRS.cjs +531 -0
  32. package/dist/node/cli-entry.cjs +3 -1
  33. package/dist/node/cli-entry.mjs +3 -1
  34. package/dist/node/index.cjs +1 -1
  35. package/dist/node/index.d.cts +258 -152
  36. package/dist/node/index.d.mts +258 -150
  37. package/dist/node/index.mjs +1 -1
  38. package/dist/node/routes/worker.cjs +1 -1
  39. package/dist/node/routes/worker.mjs +1 -1
  40. package/dist/node-BmlP0eBP.cjs +159 -0
  41. package/dist/node-Y8_4ayje.mjs +159 -0
  42. package/dist/package-2nFy_NsW.cjs +6 -0
  43. package/dist/{package--0Yf0t1N.mjs → package-DAbtltXX.mjs} +1 -1
  44. package/dist/parser-B7-6PyQz.cjs +6 -0
  45. package/dist/{parser-Aq8LoH-0.cjs → parser-BzB-zCkF.cjs} +1 -1
  46. package/dist/parser-WGZdWs0X.mjs +6 -0
  47. package/dist/routes-BDDSxAl0.mjs +6 -0
  48. package/dist/routes-DJNJ-rTt.cjs +6 -0
  49. package/dist/routes-DiYC4nD2.cjs +6 -0
  50. package/dist/routes-_Bb2f4eI.mjs +6 -0
  51. package/dist/search-dialog-BXVoecTx.cjs +483 -0
  52. package/dist/search-dialog-BYhOov4S.cjs +331 -0
  53. package/dist/search-dialog-C09riYmx.js +313 -0
  54. package/dist/search-dialog-CUeAfy-8.cjs +8 -0
  55. package/dist/search-dialog-D8gLkhUV.js +453 -0
  56. package/dist/search-dialog-DHc_8FFX.js +8 -0
  57. package/dist/{sidebar-CcBkrm06.d.cts → sidebar-DNq4_ZAa.d.ts} +118 -52
  58. package/dist/{sidebar-CyZS9YOm.d.ts → sidebar-Dlkgbxs6.d.cts} +118 -52
  59. package/dist/utils-BYITg7T5.mjs +7 -0
  60. package/dist/utils-Cjmx1hhk.cjs +7 -0
  61. package/dist/worker-pool-CtqklOXq.cjs +6 -0
  62. package/dist/worker-pool-k0DY6k8T.mjs +6 -0
  63. package/package.json +5 -6
  64. package/src/shared/config-utils.ts +4 -0
  65. package/src/shared/types.ts +52 -6
  66. package/dist/cache-Ba-DZQNH.cjs +0 -6
  67. package/dist/cache-BuMZ58L5.mjs +0 -6
  68. package/dist/cards-BakZPTz9.d.ts +0 -30
  69. package/dist/cards-CQn9mXZS.d.cts +0 -30
  70. package/dist/docs-layout-KoWNZc8_.js +0 -6
  71. package/dist/docs-layout-x2yKt2cL.cjs +0 -6
  72. package/dist/doctor-Be7Ly1oM.mjs +0 -21
  73. package/dist/doctor-jMxWZyLJ.cjs +0 -21
  74. package/dist/icons-dev-B_RZIyxu.js +0 -6
  75. package/dist/icons-dev-BlV3wWFT.cjs +0 -6
  76. package/dist/image-BHhTvQzr.cjs +0 -6
  77. package/dist/image-CqKzYD8f.js +0 -6
  78. package/dist/mdx-DudBEac0.js +0 -7
  79. package/dist/mdx-r4cDQxWu.cjs +0 -7
  80. package/dist/node-DtEDyN1u.cjs +0 -111
  81. package/dist/node-_1jhMGYx.mjs +0 -111
  82. package/dist/package-DrwtlXfk.cjs +0 -6
  83. package/dist/parser-CdNbqN5y.cjs +0 -6
  84. package/dist/parser-nE792MLO.mjs +0 -6
  85. package/dist/rolldown-runtime-fkIsjY3S.mjs +0 -6
  86. package/dist/routes-2k3tbUmC.cjs +0 -6
  87. package/dist/routes-CpxZIsMM.mjs +0 -6
  88. package/dist/search-dialog-B584t9ZF.js +0 -6
  89. package/dist/search-dialog-BvBopRsZ.cjs +0 -6
  90. package/dist/search-dialog-ByvGScjt.js +0 -6
  91. package/dist/search-dialog-Cyko6TJm.cjs +0 -6
  92. package/dist/search-dialog-D6BNohIJ.js +0 -6
  93. package/dist/search-dialog-DuYTIefy.cjs +0 -6
  94. package/dist/utils-CG65J0Sc.mjs +0 -7
  95. package/dist/utils-CKunkU96.cjs +0 -7
  96. package/dist/worker-pool-CGn7DrLb.mjs +0 -6
  97. package/dist/worker-pool-Crbqgw5R.cjs +0 -6
  98. package/src/client/app/config-context.tsx +0 -51
  99. package/src/client/app/doc-page.tsx +0 -38
  100. package/src/client/app/docs-layout.tsx +0 -28
  101. package/src/client/app/head.tsx +0 -122
  102. package/src/client/app/helmet-compat.tsx +0 -36
  103. package/src/client/app/mdx-component.tsx +0 -8
  104. package/src/client/app/mdx-components-context.tsx +0 -72
  105. package/src/client/app/routes-context.tsx +0 -34
  106. package/src/client/app/scroll-handler.tsx +0 -74
  107. package/src/client/app/theme-context.tsx +0 -103
  108. package/src/client/app/ui-context.tsx +0 -42
  109. package/src/client/components/docs-layout-default.tsx +0 -85
  110. package/src/client/components/icons-dev.tsx +0 -282
  111. package/src/client/components/mdx/callout.tsx +0 -97
  112. package/src/client/components/mdx/card.tsx +0 -99
  113. package/src/client/components/mdx/cards.tsx +0 -27
  114. package/src/client/components/mdx/code-block.tsx +0 -184
  115. package/src/client/components/mdx/field.tsx +0 -33
  116. package/src/client/components/mdx/image.tsx +0 -44
  117. package/src/client/components/mdx/index.ts +0 -19
  118. package/src/client/components/mdx/table.tsx +0 -54
  119. package/src/client/components/mdx/typographics.tsx +0 -120
  120. package/src/client/components/mdx/use-code-block.ts +0 -34
  121. package/src/client/components/primitives/breadcrumbs.tsx +0 -54
  122. package/src/client/components/primitives/button-group.tsx +0 -54
  123. package/src/client/components/primitives/button.tsx +0 -6
  124. package/src/client/components/primitives/code-block.tsx +0 -120
  125. package/src/client/components/primitives/docs-layout.tsx +0 -125
  126. package/src/client/components/primitives/error-boundary.tsx +0 -107
  127. package/src/client/components/primitives/heading.tsx +0 -128
  128. package/src/client/components/primitives/helpers/observer.ts +0 -141
  129. package/src/client/components/primitives/image.tsx +0 -26
  130. package/src/client/components/primitives/link.tsx +0 -102
  131. package/src/client/components/primitives/menu.tsx +0 -137
  132. package/src/client/components/primitives/navbar.tsx +0 -466
  133. package/src/client/components/primitives/on-this-page.tsx +0 -430
  134. package/src/client/components/primitives/page-nav.tsx +0 -51
  135. package/src/client/components/primitives/popover.tsx +0 -28
  136. package/src/client/components/primitives/search-dialog.tsx +0 -193
  137. package/src/client/components/primitives/sidebar.tsx +0 -423
  138. package/src/client/components/primitives/skeleton.tsx +0 -26
  139. package/src/client/components/primitives/tabs.tsx +0 -70
  140. package/src/client/components/primitives/tooltip.tsx +0 -81
  141. package/src/client/components/primitives/types.ts +0 -11
  142. package/src/client/components/ui-base/banner.tsx +0 -66
  143. package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
  144. package/src/client/components/ui-base/copy-markdown.tsx +0 -107
  145. package/src/client/components/ui-base/error-boundary.tsx +0 -15
  146. package/src/client/components/ui-base/github-stars.tsx +0 -29
  147. package/src/client/components/ui-base/icons.tsx +0 -240
  148. package/src/client/components/ui-base/index.ts +0 -16
  149. package/src/client/components/ui-base/last-updated.tsx +0 -27
  150. package/src/client/components/ui-base/navbar.tsx +0 -266
  151. package/src/client/components/ui-base/not-found.tsx +0 -26
  152. package/src/client/components/ui-base/on-this-page.tsx +0 -57
  153. package/src/client/components/ui-base/page-nav.tsx +0 -50
  154. package/src/client/components/ui-base/search-dialog.tsx +0 -163
  155. package/src/client/components/ui-base/search-highlight.tsx +0 -10
  156. package/src/client/components/ui-base/sidebar.tsx +0 -92
  157. package/src/client/components/ui-base/tabs.tsx +0 -83
  158. package/src/client/components/ui-base/theme-toggle.tsx +0 -130
  159. package/src/client/components/ui-base/version-i18n.tsx +0 -80
  160. package/src/client/hooks/index.ts +0 -13
  161. package/src/client/hooks/use-analytics.ts +0 -272
  162. package/src/client/hooks/use-breadcrumbs.ts +0 -22
  163. package/src/client/hooks/use-i18n.ts +0 -182
  164. package/src/client/hooks/use-localized-to.ts +0 -113
  165. package/src/client/hooks/use-location.ts +0 -5
  166. package/src/client/hooks/use-navbar.ts +0 -130
  167. package/src/client/hooks/use-page-nav.ts +0 -46
  168. package/src/client/hooks/use-routes.ts +0 -108
  169. package/src/client/hooks/use-search-highlight.ts +0 -185
  170. package/src/client/hooks/use-search.ts +0 -118
  171. package/src/client/hooks/use-sidebar.ts +0 -205
  172. package/src/client/hooks/use-tabs.ts +0 -46
  173. package/src/client/hooks/use-version.ts +0 -111
  174. package/src/client/index.ts +0 -31
  175. package/src/client/mdx.ts +0 -2
  176. package/src/client/primitives.ts +0 -19
  177. package/src/client/ssg/boltdocs-shell.tsx +0 -148
  178. package/src/client/ssg/create-routes.tsx +0 -473
  179. package/src/client/ssg/index.ts +0 -4
  180. package/src/client/ssg/mdx-page.tsx +0 -38
  181. package/src/client/store/boltdocs-context.tsx +0 -137
  182. package/src/client/theme/neutral.css +0 -141
  183. package/src/client/theme/reset.css +0 -189
  184. package/src/client/types.ts +0 -116
  185. package/src/client/utils/cn.ts +0 -6
  186. package/src/client/utils/copy-clipboard.ts +0 -22
  187. package/src/client/utils/get-base-file-path.ts +0 -21
  188. package/src/client/utils/github.ts +0 -121
  189. package/src/client/utils/i18n.ts +0 -23
  190. package/src/client/utils/path.ts +0 -9
  191. package/src/client/utils/react-to-text.ts +0 -34
  192. package/src/client/virtual.d.ts +0 -24
  193. /package/dist/{meta-loader-CWg2gnbY.mjs → meta-loader-DzwDFtdT.mjs} +0 -0
@@ -3,4 +3,2217 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import{$ as e,B as t,C as n,F as r,H as i,J as a,K as o,L as s,O as c,Q as l,T as u,V as d,W as f,X as p,Y as m,Z as h,_ as g,b as _,et as v,j as y,k as b,nt as x,q as S,s as C,tt as w,w as ee,y as T}from"../icons-dev-B_RZIyxu.js";import{D as te,E as ne,M as E,N as D,T as O,_ as k,h as A,i as j,j as re,k as M,m as ie,n as ae,r as oe,t as N,w as se}from"../docs-layout-KoWNZc8_.js";import{c as ce,l as P}from"../image-CqKzYD8f.js";import{n as F}from"../search-dialog-D6BNohIJ.js";import{n as le,t as ue}from"../search-dialog-B584t9ZF.js";import{a as de,i as fe,n as pe,r as me,t as he}from"../mdx-DudBEac0.js";import{ViteReactSSG as ge}from"@bdocs/ssg";import{Outlet as _e,useLoaderData as ve,useLocation as I,useNavigate as ye}from"react-router-dom";import{Suspense as be,createContext as xe,lazy as Se,use as Ce,useCallback as we,useEffect as L,useLayoutEffect as Te,useMemo as R,useRef as Ee,useState as z}from"react";import{Fragment as B,jsx as V,jsxs as H}from"react/jsx-runtime";import{Button as De}from"react-aria-components";import Oe from"virtual:boltdocs-icons";import*as ke from"react-helmet-async";import Ae from"virtual:boltdocs-mdx-components";import je from"virtual:boltdocs-layout";const Me=Symbol.for(`__BDOCS_MDX_COMPONENTS_CONTEXT__`),U=Symbol.for(`__BDOCS_MDX_COMPONENTS_INSTANCE__`),Ne=globalThis[Me]||(globalThis[Me]=xe({}));function W(){let e=Ce(Ne);return(!e||Object.keys(e).length===0)&&globalThis[U]?globalThis[U]:e}function Pe({components:e,children:t}){let n=R(()=>{let t={},n={};return Object.entries(e).forEach(([e,r])=>{if(e.startsWith(`Frontmatter_`)){let t=e.slice(12);n[t]=r}else t[e]=r}),t.Frontmatter=n,t},[e]);return typeof globalThis<`u`&&(globalThis[U]=n),V(Ne.Provider,{value:n,children:t})}function Fe(){let{currentRoute:e}=p(),t=[];return e&&(e.groupTitle&&t.push({label:e.groupTitle}),t.push({label:e.title,href:e.path})),{crumbs:t,activeRoute:e}}function Ie(){let{crumbs:e,activeRoute:t}=Fe();return e.length===0?null:H(D.Root,{className:`gap-2 text-xs sm:text-sm font-medium`,children:[V(D.Item,{children:V(D.Link,{href:`/`,className:`text-muted hover:text-body transition-colors flex items-center`,children:V(r,{size:14})})}),e.map((e,n)=>{let r=e.href===t?.path;return H(D.Item,{className:`gap-2`,children:[V(D.Separator,{className:`text-muted/40`}),V(D.Link,{href:e.href,className:T(`transition-colors`,r?`text-body font-semibold cursor-default pointer-events-none`:`text-muted hover:text-body`),children:e.label})]},`crumb-${e.href}-${e.label}-${n}`)})]})}const Le=e=>{let[t,n]=z(!1);return{copied:t,handleCopy:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)},handleOpenRaw:()=>{let t=new Blob([e],{type:`text/plain;charset=utf-8`}),n=URL.createObjectURL(t);window.open(n,`_blank`)}}};function Re({content:e,mdxRaw:t}){let n=t||e||``,{copied:r,handleCopy:i,handleOpenRaw:a}=Le(n);return n?V(`div`,{className:`relative inline-flex z-100 shrink-0 w-max`,children:H(re,{className:`rounded-xl border border-subtle bg-surface transition-all duration-300 hover:border-primary-500/50 group overflow-hidden`,children:[V(E,{onPress:i,className:T(`md:hidden flex items-center justify-center w-8 h-8 bg-transparent outline-none select-none cursor-pointer border-none`,`text-muted transition-all duration-300 hover:bg-primary-500/5 hover:text-body`,r&&`text-emerald-500 hover:bg-emerald-500/5`),"aria-label":r?`Copied!`:`Copy Markdown`,children:V(r?ee:b,{size:14})}),H(E,{onPress:i,className:T(`hidden md:flex items-center gap-2 px-5 py-2 bg-transparent text-[0.8125rem] font-semibold h-9 shrink-0 outline-none select-none cursor-pointer border-none`,`text-body transition-all duration-300 hover:bg-primary-500/5`,r&&`text-emerald-500 hover:bg-emerald-500/5`),children:[V(r?ee:b,{size:16}),r?`Copied!`:`Copy Markdown`]}),H(M.Trigger,{placement:`bottom end`,children:[V(E,{className:T(`flex items-center justify-center px-2.5 md:px-3.5 h-8 md:h-9 border-none border-l border-subtle/50 text-muted rounded-none bg-transparent shrink-0 outline-none select-none cursor-pointer`,`transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500`),children:V(u,{size:14})}),H(M.Root,{className:`w-52 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:[H(M.Item,{onAction:i,className:`flex items-center px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group`,children:[V(b,{size:16,className:`size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400`}),V(`span`,{className:`ml-2`,children:`Copy Markdown`})]}),H(M.Item,{onAction:a,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group`,children:[V(y,{size:16,className:`size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400`}),V(`span`,{className:`ml-2`,children:`View as Markdown`})]})]})]})]})}):null}function ze({children:e,fallback:t}){return V(te,{fallback:t,children:e})}async function Be(e,t,n=`https://api.github.com`){let r=new Headers;t&&r.append(`authorization`,t);let i=await(await fetch(`${n}/repos/${e}`,{headers:r})).json();return i.stargazers_count===void 0?`0`:Ve(i.stargazers_count)}const Ve=e=>Intl.NumberFormat(`en`,{notation:`compact`,compactDisplay:`short`}).format(e);function He({repo:e}){let[t,n]=z(null);return L(()=>{e&&Be(e).then(e=>n(e)).catch(()=>n(`0`))},[e]),H(`a`,{href:`https://github.com/${e}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-2 rounded-xl border border-subtle bg-surface px-3 py-1.5 text-xs font-semibold text-muted dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 hover:border-primary-500/50 hover:text-body select-none outline-none`,children:[V(C,{className:`h-4 w-4 text-body`}),t!==null&&H(`span`,{className:`tabular-nums font-medium`,children:[t,` stars`]})]})}function G(e,t){return e?typeof e==`string`?e:t&&e[t]?e[t]:Object.values(e)[0]||``:``}function K(){let e=x(),{theme:t,resolvedTheme:n}=P(),r=I(),{currentLocale:i}=p(),a=e.theme||{},o=G(a.title,i)||`Boltdocs`,s=a.navbar||[],c=a.socialLinks||[],l=a.githubRepo,u=R(()=>s.map(t=>{let n=t.href||t.to||t.link||``,a=t=>{let n=r.pathname;if(n===t)return!0;if(!t||t===`/`)return n===`/`;let i=t=>{let n=t.split(`/`).filter(Boolean),r=0;return e.i18n?.locales&&n[r]&&e.i18n.locales[n[r]]&&r++,e.versions?.versions&&n[r]&&e.versions.versions.some(e=>e.path===n[r])&&r++,n.slice(r)},a=i(t),o=i(n);return a.length===0?o.length===0:o.length<a.length?!1:a.every((e,t)=>o[t]===e)},o=(e=>{if(!(!e||e.length===0))return e.map(e=>{let t=e.href||e.to||e.link||``;return{label:G(e.label||e.text,i),href:t,active:a(t),to:t.startsWith(`http`)||t.startsWith(`//`)?`external`:void 0}})})(t.items);return{label:G(t.label||t.text,i),href:n,active:a(n),to:n.startsWith(`http`)||n.startsWith(`//`)?`external`:void 0,items:o}}),[s,r.pathname,i,e]),d=a.logo;return{links:u,title:o,logo:d?typeof d==`string`?d:n===`dark`?d.dark:d.light:null,logoProps:{alt:(d&&typeof d==`object`?d.alt:void 0)||o,width:d&&typeof d==`object`?d.width:void 0,height:d&&typeof d==`object`?d.height:void 0},github:l?`https://github.com/${l}`:null,social:c,config:e,theme:t}}function Ue(){let{theme:e,setTheme:t}=P(),[n,r]=z(!1);if(L(()=>{r(!0)},[]),!n)return V(`div`,{className:`h-9 w-9`});let a=e===`system`?d:e===`dark`?i:o;return H(M.Trigger,{placement:`bottom right`,children:[V(De,{className:`flex h-9 w-9 items-center justify-center rounded-xl text-muted transition-colors hover:bg-surface hover:text-body outline-none border-none bg-transparent cursor-pointer`,"aria-label":`Selection theme`,children:V(a,{size:20,className:`animate-in fade-in zoom-in duration-300`})}),H(M.Root,{selectionMode:`single`,selectedKeys:[e],onSelectionChange:e=>{let n=Array.from(e)[0];t(n)},className:`w-36 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:[H(M.Item,{id:`light`,className:`group flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[V(o,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),V(`span`,{className:`ml-2`,children:`Light`})]}),H(M.Item,{id:`dark`,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[V(i,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),V(`span`,{className:`ml-2`,children:`Dark`})]}),H(M.Item,{id:`system`,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[V(d,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),V(`span`,{className:`ml-2`,children:`System`})]})]})]})}function We({className:e}){let{theme:t,setTheme:n}=P(),[r,a]=z(!1);if(L(()=>{a(!0)},[]),!r)return V(`div`,{className:T(`h-10 w-full bg-surface rounded-xl animate-pulse`,e)});let s=t===`dark`;return H(`div`,{className:T(`flex p-1 bg-surface border border-subtle rounded-xl relative w-full h-11`,e),children:[V(`div`,{className:T(`absolute inset-y-1 w-[calc(50%-4px)] bg-main border border-subtle rounded-lg transition-all duration-300 ease-out shadow-xs`,s?`translate-x-full`:`translate-x-0`)}),V(`button`,{onClick:()=>n(`light`),className:T(`flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent`,s?`text-muted hover:text-body`:`text-body font-semibold`),"aria-label":`Light mode`,children:V(o,{size:18})}),V(`button`,{onClick:()=>n(`dark`),className:T(`flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent`,s?`text-body font-semibold`:`text-muted hover:text-body`),"aria-label":`Dark mode`,children:V(i,{size:18})})]})}function Ge(e=[],t=[]){let n=I(),r=Ee([]),[i,a]=z({opacity:0,transform:`translateX(0) scaleX(0)`,width:0}),o=h(n.pathname),s=t.find(e=>h(e.path)===o)?.tab?.toLowerCase(),c=e.findIndex(e=>e.id.toLowerCase()===s),l=c===-1?0:c;return L(()=>{let e=r.current[l];e&&a({opacity:1,width:e.offsetWidth,transform:`translateX(${e.offsetLeft}px)`})},[l,e.length,n.pathname]),{tabs:e,activeIndex:l,indicatorStyle:i,tabRefs:r,activeTabId:s}}function Ke({tabs:e,routes:t}){let{currentLocale:n}=p(),{indicatorStyle:r,tabRefs:i,activeIndex:a}=Ge(e,t);L(()=>{let e=i.current[a];e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},[a]);let o=e=>{if(!e)return null;if(e.trim().startsWith(`<svg`))return V(`span`,{className:`h-4 w-4`,dangerouslySetInnerHTML:{__html:e}});let t={...m,...Oe},n=t[e]||t[e+`Icon`];return n?V(n,{size:16}):V(`img`,{src:e,alt:``,className:`h-4 w-4 object-contain`})};return V(`div`,{className:`mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6 select-none`,children:H(ne.List,{className:`border-none py-0 scrollbar-hide relative flex flex-row items-center`,children:[e.map((e,r)=>{let s=r===a,c=t.find(t=>t.tab&&t.tab.toLowerCase()===e.id.toLowerCase());return H(g,{href:c?c.path:`#`,ref:e=>{i.current[r]=e},className:`relative flex items-center gap-2 px-4 py-3.5 text-sm font-semibold transition-colors duration-300 outline-none whitespace-nowrap ${s?`text-primary-500`:`text-muted hover:text-body`}`,children:[o(e.icon),V(`span`,{children:G(e.text,n)})]},e.id)}),V(ne.Indicator,{style:r,className:`h-0.5 bg-primary-500 rounded-full transition-all duration-300`})]})})}function q(e,t,n){let r=e;return t&&(r===t||r.startsWith(t+`/`))&&(r=r===t?`index.md`:r.slice(t.length+1)),n&&(r===n||r.startsWith(n+`/`))&&(r=r===n?`index.md`:r.slice(n.length+1)),r}function qe(){let t=ye(),n=x(),{allRoutes:r,currentRoute:i,currentVersion:a,currentLocale:o}=p(),s=n.versions,{setVersion:c}=e();return{currentVersion:a,currentVersionLabel:s?.versions?.find?.(e=>e.path===a)?.label||a,availableVersions:R(()=>s?s.versions.map(e=>({key:e.path,label:e.label,value:e.path,isCurrent:e.path===a})):[],[s,a]),handleVersionChange:e=>{if(!s||e===a)return;c(e);let l=`${(n.base||`/docs`).replace(/\/$/,``)}/${e}${o?`/${o}`:``}`;if(i){let t=q(i.filePath,i.version,i.locale),a=r.find(r=>q(r.filePath,r.version,r.locale)===t&&(r.version||s.defaultVersion)===e&&(!n.i18n||(r.locale||n.i18n.defaultLocale)===o));if(a)l=a.path;else{let t=r.find(t=>q(t.filePath,t.version,t.locale)===`index.md`&&(t.version||s.defaultVersion)===e&&(!n.i18n||(t.locale||n.i18n.defaultLocale)===o));t&&(l=t.path)}}else{let t=r.find(t=>(t.version||s.defaultVersion)===e&&(!n.i18n||(t.locale||n.i18n.defaultLocale)===o));t&&(l=t.path)}t(l)}}}function Je(){let t=ye(),n=x(),{allRoutes:r,currentRoute:i,currentLocale:a,currentVersion:o}=p(),s=n.i18n,{setLocale:c}=e(),l=e=>{if(!s||e===a)return;c(e);let l=n.base||`/`,u=l===`/`?``:l.replace(/\/$/,``),d=!!i?.filePath,f=``;if(i)if(d){let t=q(i.filePath,i.version,i.locale),n=r.find(n=>q(n.filePath,n.version,n.locale)===t&&(n.locale||s.defaultLocale)===e&&n.version===i.version);if(n)f=n.path;else{let t=r.find(t=>q(t.filePath,t.version,t.locale)===`index.md`&&(t.locale||s.defaultLocale)===e&&t.version===i.version);f=t?t.path:`${u}${i.version?`/${i.version}`:``}${e===s.defaultLocale?``:`/${e}`}`||`/`}}else{let t=i.path,n=t.split(`/`).filter(Boolean);if(n.length>0&&(Array.isArray(s.locales)?s.locales.includes(n[0]):s.locales[n[0]])&&(n.shift(),t=`/`+n.join(`/`)),e===s.defaultLocale)f=t===``?`/`:t;else{let n=t.startsWith(`/`)?t:`/${t}`;f=`/${e}${n===`/`?``:n}`}}else{let t=r.find(t=>(t.locale||s.defaultLocale)===e&&(t.version||n.versions?.defaultVersion)===(o||n.versions?.defaultVersion));if(t)f=t.path;else{let t=o&&o!==n.versions?.defaultVersion?`/${o}`:``;f=e===s.defaultLocale?`${u}${t}`:`${u}${t}/${e}`}}(!f||f===``)&&(f=`/`),f=f.replace(/\/+/g,`/`),t(f)},u=s?.locales,d=u?Array.isArray(u)?a:u[a]:void 0;return{currentLocale:a,currentLocaleLabel:s?.localeConfigs?.[a]?.label||d||a,availableLocales:R(()=>s?Array.isArray(s.locales)?s.locales.map(e=>({key:e,label:s?.localeConfigs?.[e]?.label||e,value:e,isCurrent:e===a})):Object.entries(s.locales).map(([e,t])=>({key:e,label:s?.localeConfigs?.[e]?.label||t,value:e,isCurrent:e===a})):[],[s,a]),handleLocaleChange:l}}function J({className:e}){let{currentVersionLabel:t,availableVersions:n,handleVersionChange:r}=qe();return n.length===0?null:H(M.Trigger,{children:[H(E,{className:T(`flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer`,e),children:[V(`span`,{className:`font-semibold text-[0.8125rem]`,children:t}),V(u,{className:`w-3.5 h-3.5 text-muted/60`})]}),V(M.Root,{className:`w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:V(M.Section,{items:n,children:e=>V(M.Item,{onPress:()=>r(e.value),className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body hover:bg-primary-50/50 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:e.label},`${e.value??``}`)})})]})}function Ye({className:e}){let{currentLocale:t,availableLocales:n,handleLocaleChange:r}=Je();return n.length===0?null:H(M.Trigger,{children:[H(E,{className:T(`flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer`,e),children:[H(`div`,{className:`flex items-center gap-1.5`,children:[V(s,{className:`w-3.5 h-3.5 text-primary-500`}),V(`span`,{className:`font-bold text-[0.75rem] uppercase opacity-90`,children:t||`en`})]}),V(u,{className:`w-3.5 h-3.5 text-muted/60`})]}),V(M.Root,{className:`w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:V(M.Section,{items:n,children:e=>V(M.Item,{onPress:()=>r(e.value),className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:V(`span`,{children:e.label})},`${e.value??``}`)})})]})}const Xe=Se(()=>import(`../search-dialog-ByvGScjt.js`).then(e=>({default:e.SearchDialog})));function Ze(){let{links:e,title:n,logo:r,logoProps:i,github:o,social:s,config:c}=K(),{routes:l,allRoutes:u,currentRoute:d,currentVersion:f,currentLocale:m}=p(),{pathname:h}=I(),{isSidebarOpen:g,toggleSidebar:_}=O(),[v,y]=z(!1),b=c.theme||{},x=!!d?.filePath,S=b?.tabs&&b.tabs.length>0;return H(F.Root,{className:T(`border-b border-subtle bg-main/80 backdrop-blur-md`,S&&`border-b-0`),children:[H(F.Content,{children:[H(F.Left,{children:[x&&V(E,{onPress:_,className:`mr-2 lg:hidden p-1.5 h-8 w-8 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 transition-colors`,"aria-label":g?`Close sidebar`:`Open sidebar`,children:V(g?a:t,{className:`w-5 h-5 text-body`})}),r&&V(F.Logo,{src:r,alt:i?.alt||n,width:i?.width??24,height:i?.height??24,href:`site:/`}),V(F.Title,{href:`site:/`,children:n}),V(`div`,{className:`hidden sm:block`,children:c.versions&&f&&V(J,{})})]}),V(F.Center,{children:V(be,{fallback:V(`div`,{className:`h-9 w-32 animate-pulse rounded-md bg-surface`}),children:V(Xe,{routes:l||[]})})}),H(F.Right,{children:[V(be,{fallback:null,children:V(`div`,{className:`lg:hidden`,children:V(Xe,{routes:l||[]})})}),V(F.Links,{children:e.map(e=>V(Qe,{link:e},e.href))}),H(`div`,{className:`hidden sm:flex items-center gap-2`,children:[c.i18n&&m&&V(Ye,{}),V(F.Split,{className:`bg-subtle`})]}),V(`div`,{className:`hidden md:block`,children:V(Ue,{})}),o&&V(`div`,{className:`hidden md:block`,children:V(He,{repo:b?.githubRepo??``})}),s.length>0&&V(`div`,{className:`hidden md:block`,children:V(F.Split,{className:`bg-subtle`})}),V(`div`,{className:`hidden md:flex items-center gap-1`,children:s.map(({icon:e,link:t})=>V(F.Socials,{icon:e,link:t,className:`p-1.5 text-muted hover:text-body hover:bg-surface rounded-md transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30`},t))}),V(F.More,{onPress:()=>y(!0),className:`text-muted hover:text-body active:scale-90 transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30`})]})]}),H(F.MobileMenu,{isOpen:v,onClose:()=>y(!1),className:`bg-main/98 backdrop-blur-2xl`,children:[V(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>V($e,{link:e,onClose:()=>y(!1)},e.href))}),s.length>0&&H(`div`,{className:`mt-6`,children:[V(`div`,{className:`px-4 mb-4 text-xs font-bold uppercase tracking-widest text-muted/50`,children:`Connect`}),V(`div`,{className:`flex flex-wrap gap-2 px-2`,children:s.map(({icon:e,link:t})=>V(F.Socials,{icon:e,link:t,className:`p-3 bg-surface border border-subtle rounded-xl flex-1 justify-center`},t))})]})]}),x&&S&&b?.tabs&&V(`div`,{className:`w-full border-b border-subtle bg-main`,children:V(Ke,{tabs:b.tabs,routes:u||l||[]})})]})}function Qe({link:e}){let t=_(e.href||``),{pathname:n}=I(),r=n===t||n.startsWith(t+`/`);return e.items&&e.items.length>0?V(F.Dropdown,{label:V(`span`,{className:T(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm px-2 py-1`,r?`text-primary-500`:`text-muted hover:text-body`),children:e.label}),children:e.items?.map(e=>V(F.DropdownItem,{href:_(e.href||``),label:e.label},e.href))}):V(F.Link,{...e,href:t,active:r,className:T(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm`,r?`text-primary-500`:`text-muted hover:text-body`)})}function $e({link:e,onClose:t}){let n=_(e.href||``),{pathname:r}=I(),i=r===n;return e.items&&e.items.length>0?H(`div`,{className:`flex flex-col gap-1`,children:[V(`div`,{className:T(`px-3 py-2 text-sm transition-all`,i?`text-body`:`text-muted/80 hover:text-body`),children:e.label}),V(`div`,{className:`flex flex-col gap-1 pl-4`,children:e.items?.map(e=>V($e,{link:e,onClose:t},e.href))})]}):V(F.MobileLink,{...e,href:n,active:i,onPress:t,className:T(`transition-all`,i?`text-body`:`text-muted/80 hover:text-body`)})}function Y(){return V(`div`,{className:`flex items-center justify-center min-h-[65vh] text-center px-4`,children:H(`div`,{className:`space-y-6 max-w-md mx-auto p-8 border border-subtle bg-surface rounded-2xl shadow-xs`,children:[V(`span`,{className:`block text-7xl font-extrabold tracking-tight text-primary-500`,children:`404`}),H(`div`,{className:`space-y-2`,children:[V(`h1`,{className:`text-xl font-bold text-body`,children:`Page Not Found`}),V(`p`,{className:`text-sm text-muted leading-relaxed`,children:`The page you're looking for doesn't exist or has been moved.`})]}),H(g,{href:`/`,className:`inline-flex items-center gap-2 rounded-xl border border-subtle bg-main px-6 py-2.5 text-xs font-semibold text-body hover:bg-primary-50/50 hover:border-primary-500/50 transition-all duration-300 outline-none select-none`,children:[V(n,{size:14}),` Go to Home`]})]})})}function et({headings:e=[],editLink:t,communityHelp:n,filePath:r}){return e.length===0?null:H(k.Root,{children:[H(k.Header,{className:`flex flex-row gap-x-2`,children:[V(S,{size:16}),`On this page`]}),V(k.Tree,{headings:e}),(t||n)&&H(`div`,{className:`mt-8 pt-8 border-t border-subtle space-y-4`,children:[V(`p`,{className:`text-xs font-bold text-body`,children:`Need help?`}),H(`ul`,{className:`space-y-3`,children:[t&&r&&V(`li`,{children:H(`a`,{href:t.replace(`:path`,r),target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-muted hover:text-body transition-colors`,children:[V(f,{size:16}),`Edit this page`]})}),n&&V(`li`,{children:H(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-muted hover:text-body transition-colors`,children:[V(c,{size:16}),`Community help`]})})]})]})]})}function tt(){let{routes:e,currentRoute:t}=p(),n=I();return R(()=>{if(!t)return{prevPage:null,nextPage:null,currentRoute:null};let r=t.tab?.toLowerCase(),i=r?e.filter(e=>e.tab?.toLowerCase()===r):e.filter(e=>!e.tab),a=i.findIndex(e=>e.path===n.pathname);return{prevPage:a>0?i[a-1]:null,nextPage:a!==-1&&a<i.length-1?i[a+1]:null,currentRoute:t}},[e,t,n.pathname])}function nt(){let{prevPage:e,nextPage:t}=tt();return!e&&!t?null:H(A.Root,{className:`pt-8 border-t border-subtle grid sm:grid-cols-2 gap-4 animate-in fade-in slide-in-from-bottom-4 duration-700 select-none`,children:[e?H(A.Link,{to:e.path,direction:`prev`,className:`group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20`,children:[V(A.Title,{className:`text-xs font-bold uppercase tracking-wider text-muted/60 mb-1`,children:`Previous`}),V(A.Description,{className:`text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors`,children:e.title})]}):V(`div`,{}),t?H(A.Link,{to:t.path,direction:`next`,className:`group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20`,children:[V(A.Title,{className:`text-xs font-bold uppercase tracking-wider text-muted/60 mb-1`,children:`Next`}),V(A.Description,{className:`text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors`,children:t.title})]}):V(`div`,{})]})}function rt({routes:e,config:t}){let{logo:n,title:r,logoProps:i}=K(),{closeSidebar:o}=O(),s=n?V(`img`,{src:n,alt:i?.alt||r,width:24,height:24,className:`rounded-xl`}):null,c=t.versions||t.i18n;return H(B,{children:[V(j.Root,{children:V(j.Content,{children:V(j.Items,{routes:e})})}),H(j.Mobile,{children:[H(j.Header,{children:[H(`div`,{className:`flex items-center gap-3`,children:[s,V(`span`,{className:`font-bold text-lg tracking-tight text-body truncate max-w-[120px]`,children:r})]}),H(`div`,{className:`flex items-center gap-2`,children:[V(We,{className:`w-24 h-9 rounded-xl`}),V(E,{onPress:o,className:`h-9 w-9 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 text-muted hover:text-body transition-colors`,"aria-label":`Close sidebar`,children:V(a,{size:20})})]})]}),H(j.Content,{children:[c&&H(`div`,{className:`flex flex-col gap-4 mb-10`,children:[H(`div`,{className:`flex gap-3`,children:[t.versions&&V(J,{className:`flex-1 justify-between h-10 bg-surface border-subtle rounded-xl`}),t.i18n&&V(Ye,{className:`flex-1 justify-between h-10 bg-surface border-subtle rounded-xl`})]}),V(`div`,{className:`mt-2 border-b border-subtle`})]}),V(j.Items,{routes:e})]})]})]})}const it=Object.assign(rt,{Root:j.Root,Mobile:j.Mobile,Header:j.Header,Content:j.Content,Group:j.Group,Link:j.Link,SubGroup:j.SubGroup,Item:j.Item,Items:j.Items});function at({date:e}){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let n=t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`});return H(`div`,{className:`mt-16 pt-6 border-t border-subtle flex items-center justify-between text-xs text-muted select-none`,children:[V(`span`,{}),H(`span`,{className:`italic`,children:[`Last updated on `,n]})]})}function ot({route:e,content:t,mdxComponents:n}){let r=W(),i=R(()=>({LastUpdated:at,...r,...n}),[r,n]),a=i.LastUpdated||at;return t?H(B,{children:[V(t,{components:i}),e?.lastUpdated&&V(a,{date:e.lastUpdated})]}):null}function st({MDXComponent:e,mdxComponents:t}){let n=ve(),r=e||n?.MDXComponent,i=t||n?.mdxComponents;return r?V(ot,{route:{path:n.path,filePath:n.filePath,title:n.frontmatter.title,description:n.frontmatter.description,headings:n.headings,locale:n.locale,version:n.version,group:n.group,groupTitle:n.groupTitle,lastUpdated:n.lastUpdated,frontmatter:n.frontmatter},content:r,mdxComponents:i}):null}const X=ke,ct=X.Helmet||X.default?.Helmet||(({children:e})=>V(B,{children:e})),lt=X.HelmetProvider||X.default?.HelmetProvider||(({children:e})=>V(B,{children:e}));function ut(){let{pathname:e,hash:t}=I(),n=(e=`auto`)=>{let n=document.querySelector(`.boltdocs-content`)||window,r=()=>n===window?window.scrollY:n.scrollTop,i=(e,t)=>{n===window?window.scrollTo({top:e,behavior:t}):n.scrollTo({top:e,behavior:t})};if(t){let a=t.replace(`#`,``),o=document.getElementById(a);if(o){let t=n===window?0:n.getBoundingClientRect().top;return i(o.getBoundingClientRect().top-t-80+r(),e),!0}}return i(0,e),!1};return Te(()=>{n(`auto`)},[e,t]),L(()=>{n(`auto`);let e=requestAnimationFrame(()=>{n(`auto`),window.dispatchEvent(new Event(`resize`))});return()=>cancelAnimationFrame(e)},[e,t]),null}const dt={...he,NotFound:Y,404:Y};function Z(e){return e.endsWith(`/`)&&e.length>1?e.slice(0,-1):e}function ft({config:t}){let{currentLocale:n}=e();return L(()=>{if(!t.i18n||typeof document>`u`)return;let e=n||t.i18n.defaultLocale,r=t.i18n.localeConfigs?.[e];document.documentElement.lang=r?.htmlLang||e||`en`,document.documentElement.dir=r?.direction||`ltr`},[n,t.i18n]),null}function pt({config:t,routeMap:n}){let r=I(),{setLocale:i,setVersion:a}=e();return L(()=>{let e=Z(r.pathname),o=n.get(e);o&&(t.i18n&&i(o.locale||t.i18n.defaultLocale),t.versions&&a(o.version||t.versions.defaultVersion))},[r.pathname,t,n,i,a]),null}function mt({config:e,routes:t,components:n={}}){let r=R(()=>({...dt,...Ae,...n}),[n]),{pathname:i}=I(),a=R(()=>Z(i||`/`),[i]),o=R(()=>{let e=new Map;for(let n of t){let t=Z(n.path===``?`/`:n.path);e.set(t,n)}return e},[t]),s=R(()=>{let t=o.get(a),n,r;return t&&(e.i18n&&(n=t.locale||e.i18n.defaultLocale),e.versions&&(r=t.version||e.versions.defaultVersion)),{initLocale:n,initVersion:r}},[a,e,o]);return V(lt,{children:V(v,{routes:t,children:V(ce,{children:V(se,{children:V(Pe,{components:r,children:H(w.Provider,{value:e,children:[V(ut,{}),H(l,{initialLocale:s.initLocale,initialVersion:s.initVersion,children:[V(pt,{config:e,routeMap:o}),V(ft,{config:e}),V(_e,{})]})]})})})})})})}function ht({siteTitle:e,siteDescription:t,routes:n}){let r=I(),i=x(),{currentLocale:a}=p(),o=R(()=>n?.find?.(e=>e.path===r.pathname),[n,r.pathname]),s=o?.title,c=G(t,a),l=o?.description||c||``,u=G(e,a),d=s?`${s} | ${u}`:u,f=o?.seo||{},m=i?.seo?.metatags||{},h=i?.seo?.thumbnails?.background,g=f[`og:image`]||h;return H(ct,{children:[V(`title`,{children:d}),V(`meta`,{name:`description`,content:l}),V(`meta`,{property:`og:title`,content:d}),V(`meta`,{property:`og:description`,content:l}),V(`meta`,{property:`og:type`,content:`article`}),typeof window<`u`&&V(`meta`,{property:`og:url`,content:window.location.href}),typeof window<`u`&&V(`link`,{rel:`canonical`,href:window.location.origin+r.pathname}),V(`meta`,{name:`twitter:card`,content:`summary`}),V(`meta`,{name:`twitter:title`,content:d}),V(`meta`,{name:`twitter:description`,content:l}),g&&V(`meta`,{name:`twitter:image`,content:g}),g&&V(`meta`,{property:`og:image`,content:g}),V(`meta`,{name:`generator`,content:`Boltdocs`}),Object.entries(m).map(([e,t])=>e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?V(`meta`,{property:e,content:t},e):V(`meta`,{name:e,content:t},e)),Object.entries(f).map(([e,t])=>e===`noindex`&&t===!0?V(`meta`,{name:`robots`,content:`noindex`},`noindex`):e===`robots`?V(`meta`,{name:`robots`,content:t},`robots`):e===`canonical`?V(`link`,{rel:`canonical`,href:t},`canonical`):e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?V(`meta`,{property:e,content:t},e):V(`meta`,{name:e,content:t},e))]})}function gt(){let e=x(),{currentRoute:t,allRoutes:n}=p();return H(B,{children:[V(ht,{siteTitle:e.theme?.title,siteDescription:e.theme?.description,routes:n||[]}),V(je,{route:t,children:V(_e,{})})]})}const _t=()=>V(`div`,{className:`text-muted text-sm py-4`,children:`Loading...`}),vt=({moduleLoader:e,moduleKey:t,route:n,components:r})=>{let i=e?.default??e??null;return L(()=>{if(!import.meta.hot||!t)return;let e=e=>{e.relPath.replace(/\\/g,`/`).replace(/^\//,``)===n.filePath.replace(/\\/g,`/`).replace(/^\//,``)&&import(t+`?t=`+Date.now()).then(e=>{})};return import.meta.hot.on(`boltdocs:mdx-update`,e),()=>import.meta.hot?.off(`boltdocs:mdx-update`,e)},[t,n.filePath]),i?V(st,{MDXComponent:i,mdxComponents:r}):V(_t,{})},yt=()=>{let e=W();return V(e.NotFound||e[404]||Y,{})};function bt(e){let{routesData:t,config:n,mdxModules:r,externalPages:i,externalLayout:a,components:o}=e,s=a||(({children:e})=>V(B,{children:e})),c=e=>{let t=n.base||`/`;return e.startsWith(t)?e:`${t===`/`?``:t.replace(/\/$/,``)}${e.startsWith(`/`)?e:`/${e}`}`||`/`},l=[],u=n.versions?.defaultVersion,d=(n.base||`/docs`).replace(/\/$/,``),f=(n.base||`/docs`).replace(/\/$/,``);f||=`/`,u&&t.forEach(e=>{if(e.version)return;let t=e.path||``,n=t.startsWith(d)?t.substring(d.length).replace(/^\//,``):t.replace(/^\//,``);if(!(n===u||n.startsWith(`${u}/`))){let t=`${d}/${u}/${n}`.replace(/\/+/g,`/`).replace(/\/$/,``)||`/`;l.push({...e,path:t,version:u})}});let p=[...t,...l],m=new Map,h=Object.keys(r);if(h.length>0){let e=h[0].replace(/\\/g,`/`).split(`/`).filter(Boolean)[0]||`docs`,t=`/${e}/`,n=`./${e}/`;for(let e of h){let r=e.replace(/\\/g,`/`),i=``;r.indexOf(t)===-1?r.startsWith(n)&&(i=r.substring(n.length)):i=r.substring(r.indexOf(t)+t.length),i?m.set(i,e):m.set(r,e)}}let g=p.map(e=>{let t=e.filePath.replace(/\\/g,`/`),n=m.get(t),i=n?r[n]:null,a=c(e.path===``?`/`:e.path),s=a===f?`.`:a.startsWith(f+`/`)?a.slice(f.length+1):a;return{path:s,element:V(vt,{moduleKey:n,moduleLoader:i,route:e,components:o},n||s),loader:async()=>({path:s,frontmatter:{title:e.title,description:e.description||``,...e.frontmatter||{}},headings:e.headings||[],filePath:e.filePath,locale:e.locale,version:e.version,group:e.group,groupTitle:e.groupTitle,date:e.date,lastUpdated:e.lastUpdated}),getStaticPaths:()=>[s]}}),_=n.i18n?.locales?Array.isArray(n.i18n.locales)?n.i18n.locales:Object.keys(n.i18n.locales):[],v=n.versions?.versions?.map(e=>e.path)||[],y=[];y.push({path:f,filter:()=>!0});let b=[];v.length>0&&v.forEach(e=>b.push(`/${e}`)),_.length>0&&_.forEach(e=>b.push(`/${e}`)),v.length>0&&_.length>0&&v.forEach(e=>{_.forEach(t=>{b.push(`/${e}/${t}`)})}),b.forEach(e=>{let t=f===`/`?e:`${f}${e}`;y.push({path:t,filter:e=>e.startsWith(t.replace(/\/$/,``)+`/`)})});let x=new Set(g.map(e=>(e.path||``).replace(/\/$/,``))),S=new Set;i&&Object.keys(i).forEach(e=>{let t=e.startsWith(`/`)?e:`/${e}`;S.add(t.replace(/\/$/,``)),n.i18n&&Object.keys(n.i18n.locales).forEach(e=>{S.add(`/${e}${t===`/`?``:t}`.replace(/\/$/,``))})}),y.forEach(({path:e,filter:t})=>{if(e===`/`)return;let r=e.replace(/\/$/,``);if(!(x.has(r)||S.has(r))){let i=n.theme?.tabs?.[0]?.id,a=i?`${r}/${i}`.replace(/\/+/g,`/`):null,o=a&&x.has(a.replace(/\/$/,``))?g.find(e=>e.path.replace(/\/$/,``)===a.replace(/\/$/,``)):g.find(e=>t(e.path)&&e.path!==r);if(!o&&g.length>0&&(o=g[0]),o){let t=e===f?`.`:e.startsWith(f+`/`)?e.slice(f.length+1):e,r=t===`.`;g.push({...r?{index:!0}:{path:t},element:o.element,loader:o.loader,getStaticPaths:()=>[]});let i=p.find(e=>{let t=c(e.path===``?`/`:e.path);return(t===f?`.`:t.startsWith(f+`/`)?t.slice(f.length+1):t)===o.path});if(i){let t=c(i.path),r=n.siteUrl?`${n.siteUrl.replace(/\/$/,``)}${t}`:t;p.push({...i,path:e,filePath:``,slugParts:[],seo:{...i.seo,canonical:r}})}}}});let C=[{path:f,element:V(gt,{}),children:g}],w=[];return i&&Object.entries(i).forEach(([e,t])=>{let r=e.startsWith(`/`)?e:`/${e}`;C.find(e=>e.path===r)||(w.push({path:r,locale:n.i18n?.defaultLocale,title:e===`/`?`Home`:e.replace(/^\//,``).split(`/`).pop()||`Page`,filePath:``,headings:[]}),C.push({path:r,element:V(s,{children:V(t,{})}),loader:async()=>({path:r,locale:n.i18n?.defaultLocale}),getStaticPaths:()=>[r]}),n.i18n&&Object.keys(n.i18n.locales).forEach(n=>{let r=`/${n}${e===`/`?``:e}`;C.find(e=>e.path===r)||(w.push({path:r,locale:n,title:e,filePath:``,headings:[]}),C.push({path:r,element:V(s,{children:V(t,{})}),loader:async()=>({path:r,locale:n}),getStaticPaths:()=>[r]}))}))}),C.push({path:`*`,element:V(s,{children:V(yt,{})})}),[{element:V(mt,{config:n,routes:[...p,...w],components:o}),children:C}]}function Q(e){return typeof window>`u`?$():typeof window.gtag==`function`?xt(e):window.dataLayer?St(e):$()}function xt(e){return{trackPageView:(t,n)=>{window.gtag?.(`event`,`page_view`,{page_path:t,page_title:n||document.title,send_to:e?.ga4?.measurementId})},trackEvent:({action:t,category:n,label:r,value:i,params:a})=>{window.gtag?.(`event`,t,{event_category:n,event_label:r,value:i,send_to:e?.ga4?.measurementId,...a})},trackSearch:(t,n)=>{window.gtag?.(`event`,`search`,{search_term:t,results_count:n,send_to:e?.ga4?.measurementId})},trackDownload:(t,n)=>{window.gtag?.(`event`,`file_download`,{file_name:t,file_type:n||t.split(`.`).pop(),send_to:e?.ga4?.measurementId})},trackExternalLink:t=>{window.gtag?.(`event`,`external_link`,{link_url:t,send_to:e?.ga4?.measurementId})},isEnabled:!0}}function St(e){return{trackPageView:(t,n)=>{window.dataLayer?.push({event:`page_view`,page_path:t,page_title:n||document.title,send_to:e?.gtm?.tagId})},trackEvent:({action:t,category:n,label:r,value:i,params:a})=>{window.dataLayer?.push({event:t,event_category:n,event_label:r,value:i,send_to:e?.gtm?.tagId,...a})},trackSearch:(t,n)=>{window.dataLayer?.push({event:`search`,search_term:t,results_count:n,send_to:e?.gtm?.tagId})},trackDownload:(t,n)=>{window.dataLayer?.push({event:`file_download`,file_name:t,file_type:n||t.split(`.`).pop(),send_to:e?.gtm?.tagId})},trackExternalLink:t=>{window.dataLayer?.push({event:`external_link`,link_url:t,send_to:e?.gtm?.tagId})},isEnabled:!0}}function $(){return{trackPageView:()=>{},trackEvent:()=>{},trackSearch:()=>{},trackDownload:()=>{},trackExternalLink:()=>{},isEnabled:!1}}const Ct=Symbol.for(`__BDOCS_CONFIG_INSTANCE__`);function wt(e={}){let{config:t,autoTrackPageViews:n=!0,autoTrackDownloads:r=!0,autoTrackExternalLinks:i=!0,excludePatterns:a=[]}=e,o=typeof globalThis<`u`?globalThis[Ct]:void 0,s=t??o?.integrations,c=R(()=>Q(s),[s]),l=Ee(``),u=oe();return L(()=>{if(!n||!c.isEnabled)return;let e=u.pathname+u.search;e!==l.current&&(l.current=e,c.trackPageView(e,document.title))},[u.pathname,n,c]),L(()=>{if(!r||!c.isEnabled)return;let e=e=>{let t=e.target?.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);if(n&&!a.some(e=>e.test(n))&&(t.hasAttribute(`download`)||/\.(pdf|doc|docx|xls|xlsx|ppt|pptx|zip|rar|7z|tar|gz|mp3|mp4|avi|mov|png|jpg|jpeg|gif|svg|webp)$/i.test(n))){let e=n.split(`/`).pop()||n;c.trackDownload(e,e.split(`.`).pop())}};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[r,i,c,a]),L(()=>{if(!i||!c.isEnabled)return;let e=e=>{let t=e.target?.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);n&&(a.some(e=>e.test(n))||(n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`//`))&&!n.includes(window.location.hostname)&&c.trackExternalLink(n))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[i,c,a]),c}function Tt(){let e=R(()=>Q(),[]);return we((t,n)=>{e.trackPageView(t,n)},[e])}function Et(){let e=R(()=>Q(),[]);return we(t=>{e.trackEvent(t)},[e])}function Dt({children:e}){let{routes:t,currentRoute:n}=p(),r=x();return H(N,{className:`selection:bg-primary-500/10 selection:text-primary-500`,children:[V(Ze,{}),H(N.Body,{className:`bg-main`,children:[V(it,{routes:t||[],config:r}),V(N.Content,{className:`animate-in fade-in duration-500 scroll-smooth`,children:H(N.ContentMdx,{className:`max-w-3xl sm:max-w-4xl lg:max-w-4xl px-2 pt-8 pb-24`,children:[H(N.Header,{children:[H(`div`,{className:`mb-4 border-b border-subtle pb-4 flex flex-wrap items-center justify-between gap-3`,children:[V(Ie,{}),V(Re,{mdxRaw:n?._rawContent,route:n})]}),n?.title&&V(`h1`,{className:`text-4xl font-bold tracking-tight text-default mb-3`,children:n.title}),n?.description&&V(`p`,{className:`text-lg text-muted-foreground mb-6 leading-relaxed`,children:n.description})]}),V(ze,{children:V(`div`,{className:`prose prose-neutral dark:prose-invert max-w-none`,children:e})}),V(N.Footer,{children:V(nt,{})})]})}),V(et,{headings:n?.headings,editLink:r.theme?.editLink,communityHelp:r.theme?.communityHelp,filePath:n?.filePath})]})]})}const Ot=Object.assign(Dt,{Body:N.Body,Content:N.Content,ContentMdx:N.ContentMdx,Header:N.Header,Footer:N.Footer});export{mt as BoltdocsShell,Ie as Breadcrumbs,me as Card,pe as Cards,Re as CopyMarkdown,Ot as DocsLayout,ze as ErrorBoundary,st as MdxPage,Ze as Navbar,Y as NotFound,et as OnThisPage,nt as PageNav,ue as SearchDialog,it as Sidebar,ge as ViteReactSSG,T as cn,fe as copyToClipboard,bt as createRoutes,Be as getStarsRepo,G as getTranslated,de as reactToText,wt as useAnalytics,Fe as useBreadcrumbs,x as useConfig,Je as useI18n,_ as useLocalizedTo,oe as useLocation,W as useMdxComponents,K as useNavbar,tt as usePageNav,p as useRoutes,le as useSearch,ae as useSearchHighlight,ie as useSidebar,Ge as useTabs,P as useTheme,Et as useTrackEvent,Tt as useTrackPageView,O as useUI,qe as useVersion};
6
+ import { $ as ConfigContext, B as Languages, C as RoutesProvider, D as Check, E as ArrowLeft, G as Moon, M as Copy, O as ChevronDown, P as ExternalLink, Q as icons_exports, R as Home, S as normalizePath, U as Menu, W as Monitor, X as TextAlignStart, Y as Sun, Z as X, _ as Link$1, b as useLocalizedTo, et as useConfig, j as CircleHelp, nt as useBoltdocsContext, q as Pencil, s as Github, tt as BoltdocsProvider, x as useRoutes, y as cn } from "../icons-dev-Oju24Wjp.js";
7
+ import { c as ThemeProvider, l as useTheme } from "../image-Do8V9PCW.js";
8
+ import { n as copyToClipboard, t as mdx_components_default } from "../mdx-D3A2_l7P.js";
9
+ import { A as useUI, D as ButtonGroup, O as Breadcrumbs$2, T as Menu$1, _ as OnThisPage$1, h as PageNav$1, i as Sidebar$1, k as UIProvider, m as useSidebar, n as useSearchHighlight, r as useLocation, t as DocsLayout$1, w as Tabs$1 } from "../docs-layout-Dn6S5g59.js";
10
+ import { a as Button$1, n as Navbar$1, r as ErrorBoundary$1 } from "../search-dialog-D8gLkhUV.js";
11
+ import { n as useSearch, r as InternalErrorBoundary, t as SearchDialog } from "../search-dialog-C09riYmx.js";
12
+ import { ViteReactSSG } from "@bdocs/ssg";
13
+ import { Suspense, createContext, isValidElement, lazy, use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
14
+ import { Link, Outlet, useLoaderData, useLocation as useLocation$1, useMatches, useNavigate } from "react-router-dom";
15
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
+ import * as ReactHelmetAsync from "react-helmet-async";
17
+ import { Button } from "react-aria-components";
18
+ import virtualCustomComponents from "virtual:boltdocs-mdx-components";
19
+ import virtualIcons from "virtual:boltdocs-icons";
20
+ import UserLayout from "virtual:boltdocs-layout";
21
+
22
+ //#region src/client/app/mdx-components-context.tsx
23
+ const MDX_COMPONENTS_CONTEXT_SYMBOL = Symbol.for("__BDOCS_MDX_COMPONENTS_CONTEXT__");
24
+ const registry = globalThis;
25
+ if (!registry[MDX_COMPONENTS_CONTEXT_SYMBOL]) registry[MDX_COMPONENTS_CONTEXT_SYMBOL] = createContext({});
26
+ const MdxComponentsContext = registry[MDX_COMPONENTS_CONTEXT_SYMBOL];
27
+ function useMdxComponents() {
28
+ return use(MdxComponentsContext);
29
+ }
30
+ function MdxComponentsProvider({ components, children }) {
31
+ const processedComponents = useMemo(() => {
32
+ const processed = {};
33
+ const frontmatter = {};
34
+ let hasFrontmatter = false;
35
+ Object.entries(components).forEach(([key, value]) => {
36
+ if (key.startsWith("Frontmatter_")) {
37
+ const cleanKey = key.slice(12);
38
+ frontmatter[cleanKey] = value;
39
+ hasFrontmatter = true;
40
+ } else processed[key] = value;
41
+ });
42
+ if (hasFrontmatter) processed.Frontmatter = frontmatter;
43
+ return processed;
44
+ }, [components]);
45
+ return /* @__PURE__ */ jsx(MdxComponentsContext.Provider, {
46
+ value: processedComponents,
47
+ children
48
+ });
49
+ }
50
+
51
+ //#endregion
52
+ //#region src/client/app/helmet-compat.tsx
53
+ const mod = ReactHelmetAsync;
54
+ /**
55
+ * The `<Helmet>` component, resolved across CJS/ESM module shapes.
56
+ * Falls back to a transparent fragment wrapper if the module cannot be resolved.
57
+ */
58
+ const Helmet = mod.Helmet || mod.default?.Helmet || (({ children }) => /* @__PURE__ */ jsx(Fragment, { children }));
59
+ /**
60
+ * The `<HelmetProvider>` component, resolved across CJS/ESM module shapes.
61
+ * Falls back to a transparent fragment wrapper if the module cannot be resolved.
62
+ */
63
+ const HelmetProvider = mod.HelmetProvider || mod.default?.HelmetProvider || (({ children }) => /* @__PURE__ */ jsx(Fragment, { children }));
64
+
65
+ //#endregion
66
+ //#region src/client/app/scroll-handler.tsx
67
+ /**
68
+ * Handles scroll restoration and hash scrolling on navigation.
69
+ * It ensures the page scrolls to top on pathname changes,
70
+ * or specifically to an anchor element if a hash is present.
71
+ */
72
+ function ScrollHandler() {
73
+ const { pathname, hash } = useLocation$1();
74
+ const handleScroll = (behavior = "auto") => {
75
+ const container = document.querySelector(".boltdocs-content") || window;
76
+ const getScrollTop = () => {
77
+ if (container === window) return window.scrollY;
78
+ return container.scrollTop;
79
+ };
80
+ const scrollTo = (top, scrollBehavior) => {
81
+ if (container === window) window.scrollTo({
82
+ top,
83
+ behavior: scrollBehavior
84
+ });
85
+ else container.scrollTo({
86
+ top,
87
+ behavior: scrollBehavior
88
+ });
89
+ };
90
+ if (hash) {
91
+ const id = hash.replace("#", "");
92
+ const element = document.getElementById(id);
93
+ if (element) {
94
+ const offset = 80;
95
+ const containerTop = container === window ? 0 : container.getBoundingClientRect().top;
96
+ scrollTo(element.getBoundingClientRect().top - containerTop - offset + getScrollTop(), behavior);
97
+ return true;
98
+ }
99
+ }
100
+ scrollTo(0, behavior);
101
+ return false;
102
+ };
103
+ useLayoutEffect(() => {
104
+ handleScroll("auto");
105
+ }, [pathname, hash]);
106
+ useEffect(() => {
107
+ handleScroll("auto");
108
+ const rafId = requestAnimationFrame(() => {
109
+ handleScroll("auto");
110
+ window.dispatchEvent(new Event("resize"));
111
+ });
112
+ return () => cancelAnimationFrame(rafId);
113
+ }, [pathname, hash]);
114
+ return null;
115
+ }
116
+
117
+ //#endregion
118
+ //#region src/client/components/ui-base/not-found.tsx
119
+ function NotFound() {
120
+ return /* @__PURE__ */ jsx("div", {
121
+ className: "flex items-center justify-center min-h-[65vh] text-center px-4",
122
+ children: /* @__PURE__ */ jsxs("div", {
123
+ className: "space-y-6 max-w-md mx-auto p-8 border border-subtle bg-surface rounded-2xl shadow-xs",
124
+ children: [
125
+ /* @__PURE__ */ jsx("span", {
126
+ className: "block text-7xl font-extrabold tracking-tight text-primary-500",
127
+ children: "404"
128
+ }),
129
+ /* @__PURE__ */ jsxs("div", {
130
+ className: "space-y-2",
131
+ children: [/* @__PURE__ */ jsx("h1", {
132
+ className: "text-xl font-bold text-body",
133
+ children: "Page Not Found"
134
+ }), /* @__PURE__ */ jsx("p", {
135
+ className: "text-sm text-muted leading-relaxed",
136
+ children: "The page you're looking for doesn't exist or has been moved."
137
+ })]
138
+ }),
139
+ /* @__PURE__ */ jsxs(Link$1, {
140
+ href: "/",
141
+ className: "inline-flex items-center gap-2 rounded-xl border border-subtle bg-main px-6 py-2.5 text-xs font-semibold text-body hover:bg-primary-50/50 hover:border-primary-500/50 transition-all duration-300 outline-none select-none",
142
+ children: [/* @__PURE__ */ jsx(ArrowLeft, { size: 14 }), " Go to Home"]
143
+ })
144
+ ]
145
+ })
146
+ });
147
+ }
148
+
149
+ //#endregion
150
+ //#region src/client/app/mdx-component.tsx
151
+ const mdxComponentsDefault = {
152
+ ...mdx_components_default,
153
+ NotFound,
154
+ "404": NotFound
155
+ };
156
+
157
+ //#endregion
158
+ //#region src/client/ssg/boltdocs-shell.tsx
159
+ /**
160
+ * Updates the HTML lang and dir attributes based on the current locale configuration.
161
+ */
162
+ function I18nUpdater({ config }) {
163
+ const { currentLocale } = useBoltdocsContext();
164
+ useEffect(() => {
165
+ if (!config.i18n || typeof document === "undefined") return;
166
+ const locale = currentLocale || config.i18n.defaultLocale;
167
+ const localeConfig = config.i18n.localeConfigs?.[locale];
168
+ document.documentElement.lang = localeConfig?.htmlLang || locale || "en";
169
+ document.documentElement.dir = localeConfig?.direction || "ltr";
170
+ }, [currentLocale, config.i18n]);
171
+ return null;
172
+ }
173
+ function StoreSync({ config, routeMap }) {
174
+ const location = useLocation$1();
175
+ const { setLocale, setVersion } = useBoltdocsContext();
176
+ useEffect(() => {
177
+ const currentPath = normalizePath(location.pathname);
178
+ const matchedRoute = routeMap.get(currentPath);
179
+ if (matchedRoute) {
180
+ if (config.i18n) setLocale(matchedRoute.locale || config.i18n.defaultLocale);
181
+ if (config.versions) setVersion(matchedRoute.version || config.versions.defaultVersion);
182
+ }
183
+ }, [
184
+ location.pathname,
185
+ config,
186
+ routeMap,
187
+ setLocale,
188
+ setVersion
189
+ ]);
190
+ return null;
191
+ }
192
+ function BoltdocsShell({ config, routes, components = {} }) {
193
+ const allComponents = useMemo(() => ({
194
+ ...mdxComponentsDefault,
195
+ ...virtualCustomComponents,
196
+ ...components
197
+ }), [components]);
198
+ const { pathname } = useLocation$1();
199
+ const currentPath = useMemo(() => normalizePath(pathname || "/"), [pathname]);
200
+ const routeMap = useMemo(() => {
201
+ const map = /* @__PURE__ */ new Map();
202
+ for (const r of routes) {
203
+ const key = normalizePath(r.path === "" ? "/" : r.path);
204
+ map.set(key, r);
205
+ }
206
+ return map;
207
+ }, [routes]);
208
+ const initialData = useMemo(() => {
209
+ const matched = routeMap.get(currentPath);
210
+ let initLocale;
211
+ let initVersion;
212
+ if (matched) {
213
+ if (config.i18n) initLocale = matched.locale || config.i18n.defaultLocale;
214
+ if (config.versions) initVersion = matched.version || config.versions.defaultVersion;
215
+ }
216
+ return {
217
+ initLocale,
218
+ initVersion
219
+ };
220
+ }, [
221
+ currentPath,
222
+ config,
223
+ routeMap
224
+ ]);
225
+ return /* @__PURE__ */ jsx(HelmetProvider, { children: /* @__PURE__ */ jsx(RoutesProvider, {
226
+ routes,
227
+ children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(UIProvider, { children: /* @__PURE__ */ jsx(MdxComponentsProvider, {
228
+ components: allComponents,
229
+ children: /* @__PURE__ */ jsxs(ConfigContext.Provider, {
230
+ value: config,
231
+ children: [/* @__PURE__ */ jsx(ScrollHandler, {}), /* @__PURE__ */ jsxs(BoltdocsProvider, {
232
+ initialLocale: initialData.initLocale,
233
+ initialVersion: initialData.initVersion,
234
+ children: [
235
+ /* @__PURE__ */ jsx(StoreSync, {
236
+ config,
237
+ routeMap
238
+ }),
239
+ /* @__PURE__ */ jsx(I18nUpdater, { config }),
240
+ /* @__PURE__ */ jsx(InternalErrorBoundary, { children: /* @__PURE__ */ jsx(Outlet, {}) })
241
+ ]
242
+ })]
243
+ })
244
+ }) }) })
245
+ }) });
246
+ }
247
+
248
+ //#endregion
249
+ //#region src/client/hooks/use-merged-components.ts
250
+ function useMergedComponents(propComponents) {
251
+ const contextComponents = useMdxComponents();
252
+ return useMemo(() => {
253
+ if (!propComponents) return contextComponents;
254
+ const merged = { ...contextComponents };
255
+ const mergedFrontmatter = { ...contextComponents.Frontmatter || {} };
256
+ let hasPropFrontmatter = false;
257
+ Object.entries(propComponents).forEach(([key, value]) => {
258
+ if (key.startsWith("Frontmatter_")) {
259
+ const cleanKey = key.slice(12);
260
+ mergedFrontmatter[cleanKey] = value;
261
+ hasPropFrontmatter = true;
262
+ } else if (key === "Frontmatter" && value && typeof value === "object") {
263
+ Object.assign(mergedFrontmatter, value);
264
+ hasPropFrontmatter = true;
265
+ } else merged[key] = value;
266
+ });
267
+ if (hasPropFrontmatter || contextComponents.Frontmatter) merged.Frontmatter = mergedFrontmatter;
268
+ return merged;
269
+ }, [contextComponents, propComponents]);
270
+ }
271
+
272
+ //#endregion
273
+ //#region src/client/app/doc-page.tsx
274
+ /**
275
+ * DocPage renders the MDX content and page-specific metadata.
276
+ * It is rendered inside the Outlet of DocsLayout.
277
+ */
278
+ function DocPage({ route, content: Content, mdxComponents: propComponents }) {
279
+ const allComponents = useMergedComponents(propComponents);
280
+ const { LastUpdated } = allComponents;
281
+ if (!Content) return null;
282
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Content, { components: allComponents }), route?.lastUpdated && /* @__PURE__ */ jsx(LastUpdated, { date: route.lastUpdated })] });
283
+ }
284
+
285
+ //#endregion
286
+ //#region src/client/ssg/mdx-page.tsx
287
+ /**
288
+ * Renders an MDX page by consuming pre-loaded route data.
289
+ *
290
+ * - If the route belongs to a collection (`data.collection` is set), renders
291
+ * the custom post component if provided, else falls back to the standard DocPage.
292
+ * - Otherwise, renders the standard `DocPage` layout.
293
+ */
294
+ function MdxPage({ MDXComponent, mdxComponents: propComponents, collectionPostComponent: CollectionPost }) {
295
+ const data = useLoaderData();
296
+ if (!MDXComponent) return null;
297
+ if (!!data?.collection && CollectionPost) return /* @__PURE__ */ jsx(CollectionPost, {
298
+ MDXComponent,
299
+ mdxComponents: propComponents
300
+ });
301
+ const docData = data;
302
+ return /* @__PURE__ */ jsx(DocPage, {
303
+ route: {
304
+ path: docData.path,
305
+ filePath: docData.filePath,
306
+ title: docData.frontmatter?.title,
307
+ description: docData.frontmatter?.description,
308
+ headings: docData.headings,
309
+ locale: docData.locale,
310
+ version: docData.version,
311
+ group: docData.group,
312
+ groupTitle: docData.groupTitle,
313
+ lastUpdated: docData.lastUpdated,
314
+ frontmatter: docData.frontmatter
315
+ },
316
+ content: MDXComponent,
317
+ mdxComponents: propComponents
318
+ });
319
+ }
320
+
321
+ //#endregion
322
+ //#region src/client/hooks/use-breadcrumbs.ts
323
+ /**
324
+ * Hook to generate breadcrumbs based on the current active route.
325
+ */
326
+ function useBreadcrumbs() {
327
+ const { currentRoute: activeRoute } = useRoutes();
328
+ const crumbs = [];
329
+ if (activeRoute) {
330
+ if (activeRoute.groupTitle) crumbs.push({ label: activeRoute.groupTitle });
331
+ crumbs.push({
332
+ label: activeRoute.title,
333
+ href: activeRoute.path
334
+ });
335
+ }
336
+ return {
337
+ crumbs,
338
+ activeRoute
339
+ };
340
+ }
341
+
342
+ //#endregion
343
+ //#region src/client/components/ui-base/breadcrumbs.tsx
344
+ function Breadcrumbs() {
345
+ const { crumbs, activeRoute } = useBreadcrumbs();
346
+ if (crumbs.length === 0) return null;
347
+ return /* @__PURE__ */ jsxs(Breadcrumbs$2.Root, {
348
+ className: "gap-2 text-xs sm:text-sm font-medium",
349
+ children: [/* @__PURE__ */ jsx(Breadcrumbs$2.Item, { children: /* @__PURE__ */ jsx(Breadcrumbs$2.Link, {
350
+ href: "/",
351
+ className: "text-muted hover:text-body transition-colors flex items-center",
352
+ children: /* @__PURE__ */ jsx(Home, { size: 14 })
353
+ }) }), crumbs.map((crumb, i) => {
354
+ const isActive = crumb.href === activeRoute?.path;
355
+ return /* @__PURE__ */ jsxs(Breadcrumbs$2.Item, {
356
+ className: "gap-2",
357
+ children: [/* @__PURE__ */ jsx(Breadcrumbs$2.Separator, { className: "text-muted/40" }), /* @__PURE__ */ jsx(Breadcrumbs$2.Link, {
358
+ href: crumb.href,
359
+ className: cn("transition-colors", isActive ? "text-body font-semibold cursor-default pointer-events-none" : "text-muted hover:text-body"),
360
+ children: crumb.label
361
+ })]
362
+ }, `crumb-${crumb.href}-${crumb.label}-${i}`);
363
+ })]
364
+ });
365
+ }
366
+
367
+ //#endregion
368
+ //#region src/client/components/ui-base/copy-markdown.tsx
369
+ const useCopyMarkdown = (content) => {
370
+ const [copied, setCopied] = useState(false);
371
+ const timerRef = useRef(null);
372
+ useEffect(() => {
373
+ return () => {
374
+ if (timerRef.current) clearTimeout(timerRef.current);
375
+ };
376
+ }, []);
377
+ const handleCopy = () => {
378
+ navigator.clipboard.writeText(content);
379
+ setCopied(true);
380
+ if (timerRef.current) clearTimeout(timerRef.current);
381
+ timerRef.current = setTimeout(() => {
382
+ setCopied(false);
383
+ timerRef.current = null;
384
+ }, 2e3);
385
+ };
386
+ const handleOpenRaw = () => {
387
+ const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
388
+ const url = URL.createObjectURL(blob);
389
+ window.open(url, "_blank");
390
+ };
391
+ return {
392
+ copied,
393
+ handleCopy,
394
+ handleOpenRaw
395
+ };
396
+ };
397
+ function CopyMarkdown({ content, mdxRaw }) {
398
+ const displayContent = mdxRaw || content || "";
399
+ const { copied, handleCopy, handleOpenRaw } = useCopyMarkdown(displayContent);
400
+ if (!displayContent) return null;
401
+ return /* @__PURE__ */ jsx("div", {
402
+ className: "relative inline-flex z-100 shrink-0 w-max",
403
+ children: /* @__PURE__ */ jsxs(ButtonGroup, {
404
+ className: "rounded-xl border border-subtle bg-surface transition-all duration-300 hover:border-primary-500/50 group overflow-hidden",
405
+ children: [
406
+ /* @__PURE__ */ jsx(Button$1, {
407
+ onPress: handleCopy,
408
+ className: cn("md:hidden flex items-center justify-center w-8 h-8 bg-transparent outline-none select-none cursor-pointer border-none", "text-muted transition-all duration-300 hover:bg-primary-500/5 hover:text-body", copied && "text-emerald-500 hover:bg-emerald-500/5"),
409
+ "aria-label": copied ? "Copied!" : "Copy Markdown",
410
+ children: copied ? /* @__PURE__ */ jsx(Check, { size: 14 }) : /* @__PURE__ */ jsx(Copy, { size: 14 })
411
+ }),
412
+ /* @__PURE__ */ jsxs(Button$1, {
413
+ onPress: handleCopy,
414
+ className: cn("hidden md:flex items-center gap-2 px-5 py-2 bg-transparent text-[0.8125rem] font-semibold h-9 shrink-0 outline-none select-none cursor-pointer border-none", "text-body transition-all duration-300 hover:bg-primary-500/5", copied && "text-emerald-500 hover:bg-emerald-500/5"),
415
+ children: [copied ? /* @__PURE__ */ jsx(Check, { size: 16 }) : /* @__PURE__ */ jsx(Copy, { size: 16 }), copied ? "Copied!" : "Copy Markdown"]
416
+ }),
417
+ /* @__PURE__ */ jsxs(Menu$1.Trigger, {
418
+ placement: "bottom end",
419
+ children: [/* @__PURE__ */ jsx(Button$1, {
420
+ className: cn("flex items-center justify-center px-2.5 md:px-3.5 h-8 md:h-9 border-none border-l border-subtle/50 text-muted rounded-none bg-transparent shrink-0 outline-none select-none cursor-pointer", "transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500"),
421
+ children: /* @__PURE__ */ jsx(ChevronDown, { size: 14 })
422
+ }), /* @__PURE__ */ jsxs(Menu$1.Root, {
423
+ className: "w-52 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100",
424
+ children: [/* @__PURE__ */ jsxs(Menu$1.Item, {
425
+ onAction: handleCopy,
426
+ className: "flex items-center px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group",
427
+ children: [/* @__PURE__ */ jsx(Copy, {
428
+ size: 16,
429
+ className: "size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400"
430
+ }), /* @__PURE__ */ jsx("span", {
431
+ className: "ml-2",
432
+ children: "Copy Markdown"
433
+ })]
434
+ }), /* @__PURE__ */ jsxs(Menu$1.Item, {
435
+ onAction: handleOpenRaw,
436
+ className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group",
437
+ children: [/* @__PURE__ */ jsx(ExternalLink, {
438
+ size: 16,
439
+ className: "size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400"
440
+ }), /* @__PURE__ */ jsx("span", {
441
+ className: "ml-2",
442
+ children: "View as Markdown"
443
+ })]
444
+ })]
445
+ })]
446
+ })
447
+ ]
448
+ })
449
+ });
450
+ }
451
+
452
+ //#endregion
453
+ //#region src/client/components/ui-base/error-boundary.tsx
454
+ function ErrorBoundary({ children, fallback }) {
455
+ return /* @__PURE__ */ jsx(ErrorBoundary$1, {
456
+ fallback,
457
+ children
458
+ });
459
+ }
460
+
461
+ //#endregion
462
+ //#region src/client/utils/github.ts
463
+ const BASE_URL = "https://api.github.com";
464
+ /**
465
+ * Get the number of stars for a GitHub repository.
466
+ * @param repo - owner/repo
467
+ * @param token - The GitHub token.
468
+ * @param baseUrl - The GitHub API base URL.
469
+ * @returns The number of stars for the repository.
470
+ * @example
471
+ * getStarsRepo('owner/repo') // 100k
472
+ */
473
+ async function getStarsRepo(repo, token, baseUrl = BASE_URL) {
474
+ const headers = new Headers();
475
+ if (token) headers.append("authorization", token);
476
+ const data = await (await fetch(`${baseUrl}/repos/${repo}`, { headers })).json();
477
+ if (data.stargazers_count !== void 0) return formatStars(data.stargazers_count);
478
+ else return "0";
479
+ }
480
+ /**
481
+ * Format a number of stars in a compact form.
482
+ * @param count - The number of stars to format.
483
+ * @returns The formatted number of stars.
484
+ */
485
+ const formatStars = (count) => {
486
+ return Intl.NumberFormat("en", {
487
+ notation: "compact",
488
+ compactDisplay: "short"
489
+ }).format(count);
490
+ };
491
+
492
+ //#endregion
493
+ //#region src/client/components/ui-base/github-stars.tsx
494
+ function GithubStars({ repo }) {
495
+ const [stars, setStars] = useState(null);
496
+ useEffect(() => {
497
+ if (repo) getStarsRepo(repo).then((stars) => setStars(stars)).catch(() => setStars("0"));
498
+ }, [repo]);
499
+ return /* @__PURE__ */ jsxs("a", {
500
+ href: `https://github.com/${repo}`,
501
+ target: "_blank",
502
+ rel: "noopener noreferrer",
503
+ className: "inline-flex items-center gap-2 rounded-xl border border-subtle bg-surface px-3 py-1.5 text-xs font-semibold text-muted dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 hover:border-primary-500/50 hover:text-body select-none outline-none",
504
+ children: [/* @__PURE__ */ jsx(Github, { className: "h-4 w-4 text-body" }), stars !== null && /* @__PURE__ */ jsxs("span", {
505
+ className: "tabular-nums font-medium",
506
+ children: [stars, " stars"]
507
+ })]
508
+ });
509
+ }
510
+
511
+ //#endregion
512
+ //#region src/client/utils/i18n.ts
513
+ /**
514
+ * Retrieves the correct translation from a value that can be either
515
+ * a simple string or a map of locale-specific strings.
516
+ *
517
+ * @param value - The text to translate
518
+ * @param locale - The current active locale (e.g., 'en', 'es')
519
+ * @returns The translated string
520
+ */
521
+ function getTranslated(value, locale) {
522
+ if (!value) return "";
523
+ if (typeof value === "string") return value;
524
+ if (locale && value[locale]) return value[locale];
525
+ return Object.values(value)[0] || "";
526
+ }
527
+
528
+ //#endregion
529
+ //#region src/client/hooks/use-navbar.ts
530
+ function useNavbar() {
531
+ const config = useConfig();
532
+ const { theme, resolvedTheme } = useTheme();
533
+ const location = useLocation$1();
534
+ const { currentLocale } = useRoutes();
535
+ const themeConfig = config.theme || {};
536
+ const title = getTranslated(themeConfig.title, currentLocale) || "Boltdocs";
537
+ const rawLinks = themeConfig.navbar || [];
538
+ const socialLinks = themeConfig.socialLinks || [];
539
+ const githubRepo = themeConfig.githubRepo;
540
+ const links = useMemo(() => {
541
+ return rawLinks.map((item) => {
542
+ const href = item.href || item.to || item.link || "";
543
+ const getIsActive = (h) => {
544
+ const activePath = location.pathname;
545
+ if (activePath === h) return true;
546
+ if (!h || h === "/") return activePath === "/";
547
+ const cleanPathParts = (p) => {
548
+ const parts = p.split("/").filter(Boolean);
549
+ let i = 0;
550
+ if (config.i18n?.locales && parts[i] && config.i18n.locales[parts[i]]) i++;
551
+ if (config.versions?.versions && parts[i]) {
552
+ if (config.versions.versions.some((v) => v.path === parts[i])) i++;
553
+ }
554
+ return parts.slice(i);
555
+ };
556
+ const hParts = cleanPathParts(h);
557
+ const pParts = cleanPathParts(activePath);
558
+ if (hParts.length === 0) return pParts.length === 0;
559
+ if (pParts.length < hParts.length) return false;
560
+ return hParts.every((part, i) => pParts[i] === part);
561
+ };
562
+ const processItems = (items) => {
563
+ if (!items || items.length === 0) return void 0;
564
+ return items.map((subItem) => {
565
+ const subHref = subItem.href || subItem.to || subItem.link || "";
566
+ return {
567
+ label: getTranslated(subItem.label || subItem.text, currentLocale),
568
+ href: subHref,
569
+ active: getIsActive(subHref),
570
+ to: subHref.startsWith("http") || subHref.startsWith("//") ? "external" : void 0
571
+ };
572
+ });
573
+ };
574
+ const linkItems = processItems(item.items);
575
+ return {
576
+ label: getTranslated(item.label || item.text, currentLocale),
577
+ href,
578
+ active: getIsActive(href),
579
+ to: href.startsWith("http") || href.startsWith("//") ? "external" : void 0,
580
+ items: linkItems
581
+ };
582
+ });
583
+ }, [
584
+ rawLinks,
585
+ location.pathname,
586
+ currentLocale,
587
+ config
588
+ ]);
589
+ const logo = themeConfig.logo;
590
+ return {
591
+ links,
592
+ title,
593
+ logo: !logo ? null : typeof logo === "string" ? logo : resolvedTheme === "dark" ? logo.dark : logo.light,
594
+ logoProps: {
595
+ alt: (logo && typeof logo === "object" ? logo.alt : void 0) || title,
596
+ width: logo && typeof logo === "object" ? logo.width : void 0,
597
+ height: logo && typeof logo === "object" ? logo.height : void 0
598
+ },
599
+ github: githubRepo ? `https://github.com/${githubRepo}` : null,
600
+ social: socialLinks,
601
+ config,
602
+ theme
603
+ };
604
+ }
605
+
606
+ //#endregion
607
+ //#region src/client/components/ui-base/theme-toggle.tsx
608
+ function ThemeToggle() {
609
+ const { theme, setTheme } = useTheme();
610
+ const [mounted, setMounted] = useState(false);
611
+ useEffect(() => {
612
+ setMounted(true);
613
+ }, []);
614
+ if (!mounted) return /* @__PURE__ */ jsx("div", { className: "h-9 w-9" });
615
+ const Icon = theme === "system" ? Monitor : theme === "dark" ? Moon : Sun;
616
+ return /* @__PURE__ */ jsxs(Menu$1.Trigger, {
617
+ placement: "bottom right",
618
+ children: [/* @__PURE__ */ jsx(Button, {
619
+ className: "flex h-9 w-9 items-center justify-center rounded-xl text-muted transition-colors hover:bg-surface hover:text-body outline-none border-none bg-transparent cursor-pointer",
620
+ "aria-label": "Selection theme",
621
+ children: /* @__PURE__ */ jsx(Icon, {
622
+ size: 20,
623
+ className: "animate-in fade-in zoom-in duration-300"
624
+ })
625
+ }), /* @__PURE__ */ jsxs(Menu$1.Root, {
626
+ selectionMode: "single",
627
+ selectedKeys: [theme],
628
+ onSelectionChange: (keys) => {
629
+ const newTheme = Array.from(keys)[0];
630
+ setTheme(newTheme);
631
+ },
632
+ className: "w-36 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100",
633
+ children: [
634
+ /* @__PURE__ */ jsxs(Menu$1.Item, {
635
+ id: "light",
636
+ className: "group flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
637
+ children: [/* @__PURE__ */ jsx(Sun, {
638
+ className: "group-hover:text-primary-500 dark:group-hover:text-primary-200",
639
+ size: 16
640
+ }), /* @__PURE__ */ jsx("span", {
641
+ className: "ml-2",
642
+ children: "Light"
643
+ })]
644
+ }),
645
+ /* @__PURE__ */ jsxs(Menu$1.Item, {
646
+ id: "dark",
647
+ className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
648
+ children: [/* @__PURE__ */ jsx(Moon, {
649
+ className: "group-hover:text-primary-500 dark:group-hover:text-primary-200",
650
+ size: 16
651
+ }), /* @__PURE__ */ jsx("span", {
652
+ className: "ml-2",
653
+ children: "Dark"
654
+ })]
655
+ }),
656
+ /* @__PURE__ */ jsxs(Menu$1.Item, {
657
+ id: "system",
658
+ className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
659
+ children: [/* @__PURE__ */ jsx(Monitor, {
660
+ className: "group-hover:text-primary-500 dark:group-hover:text-primary-200",
661
+ size: 16
662
+ }), /* @__PURE__ */ jsx("span", {
663
+ className: "ml-2",
664
+ children: "System"
665
+ })]
666
+ })
667
+ ]
668
+ })]
669
+ });
670
+ }
671
+ function ThemeSwitcher({ className }) {
672
+ const { theme, setTheme } = useTheme();
673
+ const [mounted, setMounted] = useState(false);
674
+ useEffect(() => {
675
+ setMounted(true);
676
+ }, []);
677
+ if (!mounted) return /* @__PURE__ */ jsx("div", { className: cn("h-10 w-full bg-surface rounded-xl animate-pulse", className) });
678
+ const isDark = theme === "dark";
679
+ return /* @__PURE__ */ jsxs("div", {
680
+ className: cn("flex p-1 bg-surface border border-subtle rounded-xl relative w-full h-11", className),
681
+ children: [
682
+ /* @__PURE__ */ jsx("div", { className: cn("absolute inset-y-1 w-[calc(50%-4px)] bg-main border border-subtle rounded-lg transition-all duration-300 ease-out shadow-xs", isDark ? "translate-x-full" : "translate-x-0") }),
683
+ /* @__PURE__ */ jsx("button", {
684
+ onClick: () => setTheme("light"),
685
+ className: cn("flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent", !isDark ? "text-body font-semibold" : "text-muted hover:text-body"),
686
+ "aria-label": "Light mode",
687
+ children: /* @__PURE__ */ jsx(Sun, { size: 18 })
688
+ }),
689
+ /* @__PURE__ */ jsx("button", {
690
+ onClick: () => setTheme("dark"),
691
+ className: cn("flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent", isDark ? "text-body font-semibold" : "text-muted hover:text-body"),
692
+ "aria-label": "Dark mode",
693
+ children: /* @__PURE__ */ jsx(Moon, { size: 18 })
694
+ })
695
+ ]
696
+ });
697
+ }
698
+
699
+ //#endregion
700
+ //#region src/client/hooks/use-tabs.ts
701
+ function useTabs(tabs = [], routes = []) {
702
+ const location = useLocation$1();
703
+ const tabRefs = useRef([]);
704
+ const [indicatorStyle, setIndicatorStyle] = useState({
705
+ opacity: 0,
706
+ transform: "translateX(0) scaleX(0)",
707
+ width: 0
708
+ });
709
+ const currentPath = normalizePath(location.pathname);
710
+ const activeTabId = routes.find((r) => normalizePath(r.path) === currentPath)?.tab?.toLowerCase();
711
+ const activeIndex = tabs.findIndex((tab) => tab.id.toLowerCase() === activeTabId);
712
+ const finalActiveIndex = activeIndex === -1 ? 0 : activeIndex;
713
+ useEffect(() => {
714
+ const activeTab = tabRefs.current[finalActiveIndex];
715
+ if (activeTab) setIndicatorStyle({
716
+ opacity: 1,
717
+ width: activeTab.offsetWidth,
718
+ transform: `translateX(${activeTab.offsetLeft}px)`
719
+ });
720
+ }, [
721
+ finalActiveIndex,
722
+ tabs.length,
723
+ location.pathname
724
+ ]);
725
+ return {
726
+ tabs,
727
+ activeIndex: finalActiveIndex,
728
+ indicatorStyle,
729
+ tabRefs,
730
+ activeTabId
731
+ };
732
+ }
733
+
734
+ //#endregion
735
+ //#region src/client/components/ui-base/tabs.tsx
736
+ function Tabs({ tabs, routes }) {
737
+ const { currentLocale } = useRoutes();
738
+ const { indicatorStyle, tabRefs, activeIndex } = useTabs(tabs, routes);
739
+ useEffect(() => {
740
+ const activeTab = tabRefs.current[activeIndex];
741
+ if (activeTab) activeTab.scrollIntoView({
742
+ behavior: "smooth",
743
+ block: "nearest",
744
+ inline: "center"
745
+ });
746
+ }, [activeIndex]);
747
+ const renderTabIcon = (iconName) => {
748
+ if (!iconName) return null;
749
+ if (iconName.trim().startsWith("<svg")) return /* @__PURE__ */ jsx("span", {
750
+ className: "h-4 w-4",
751
+ dangerouslySetInnerHTML: { __html: iconName }
752
+ });
753
+ const icons = {
754
+ ...icons_exports,
755
+ ...virtualIcons
756
+ };
757
+ const TabIcon = icons[iconName] || icons[iconName + "Icon"];
758
+ if (TabIcon) return /* @__PURE__ */ jsx(TabIcon, { size: 16 });
759
+ return /* @__PURE__ */ jsx("img", {
760
+ src: iconName,
761
+ alt: "",
762
+ className: "h-4 w-4 object-contain"
763
+ });
764
+ };
765
+ return /* @__PURE__ */ jsx("div", {
766
+ className: "mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6 select-none",
767
+ children: /* @__PURE__ */ jsxs(Tabs$1.List, {
768
+ className: "border-none py-0 scrollbar-hide relative flex flex-row items-center overflow-x-auto",
769
+ children: [tabs.map((tab, index) => {
770
+ const isActive = index === activeIndex;
771
+ const firstRoute = routes.find((r) => r.tab && r.tab.toLowerCase() === tab.id.toLowerCase());
772
+ return /* @__PURE__ */ jsxs(Link$1, {
773
+ href: firstRoute ? firstRoute.path : "#",
774
+ ref: (el) => {
775
+ tabRefs.current[index] = el;
776
+ },
777
+ className: `relative flex items-center gap-2 px-4 py-3.5 text-sm font-semibold transition-colors duration-300 outline-none whitespace-nowrap ${isActive ? "text-primary-500" : "text-muted hover:text-body"}`,
778
+ children: [renderTabIcon(tab.icon), /* @__PURE__ */ jsx("span", { children: getTranslated(tab.text, currentLocale) })]
779
+ }, tab.id);
780
+ }), /* @__PURE__ */ jsx(Tabs$1.Indicator, {
781
+ style: indicatorStyle,
782
+ className: "h-0.5 bg-primary-500 rounded-full transition-all duration-300"
783
+ })]
784
+ })
785
+ });
786
+ }
787
+
788
+ //#endregion
789
+ //#region src/client/utils/get-base-file-path.ts
790
+ /**
791
+ * Get the base file path by removing version and locale prefixes.
792
+ * @param filePath - The full file path.
793
+ * @param version - The version to remove from the path.
794
+ * @param locale - The locale to remove from the path.
795
+ * @returns The base file path.
796
+ */
797
+ function getBaseFilePath(filePath, version, locale) {
798
+ let path = filePath;
799
+ if (version && (path === version || path.startsWith(version + "/"))) path = path === version ? "index.md" : path.slice(version.length + 1);
800
+ if (locale && (path === locale || path.startsWith(locale + "/"))) path = path === locale ? "index.md" : path.slice(locale.length + 1);
801
+ return path;
802
+ }
803
+
804
+ //#endregion
805
+ //#region src/client/hooks/use-version.ts
806
+ /**
807
+ * Hook to manage and switch between different versions of the documentation.
808
+ */
809
+ function useVersion() {
810
+ const navigate = useNavigate();
811
+ const config = useConfig();
812
+ const { allRoutes, currentRoute, currentVersion, currentLocale } = useRoutes();
813
+ const versions = config.versions;
814
+ const { setVersion } = useBoltdocsContext();
815
+ const handleVersionChange = (version) => {
816
+ if (!versions || version === currentVersion) return;
817
+ setVersion(version);
818
+ let targetPath = `${(config.base || "/docs").replace(/\/$/, "")}/${version}${currentLocale ? `/${currentLocale}` : ""}`;
819
+ if (currentRoute) {
820
+ const baseFile = getBaseFilePath(currentRoute.filePath, currentRoute.version, currentRoute.locale);
821
+ const targetRoute = allRoutes.find((r) => getBaseFilePath(r.filePath, r.version, r.locale) === baseFile && (r.version || versions.defaultVersion) === version && (!config.i18n || (r.locale || config.i18n.defaultLocale) === currentLocale));
822
+ if (targetRoute) targetPath = targetRoute.path;
823
+ else {
824
+ const versionIndexRoute = allRoutes.find((r) => getBaseFilePath(r.filePath, r.version, r.locale) === "index.md" && (r.version || versions.defaultVersion) === version && (!config.i18n || (r.locale || config.i18n.defaultLocale) === currentLocale));
825
+ if (versionIndexRoute) targetPath = versionIndexRoute.path;
826
+ }
827
+ } else {
828
+ const fallbackRoute = allRoutes.find((r) => (r.version || versions.defaultVersion) === version && (!config.i18n || (r.locale || config.i18n.defaultLocale) === currentLocale));
829
+ if (fallbackRoute) targetPath = fallbackRoute.path;
830
+ }
831
+ navigate(targetPath);
832
+ };
833
+ return {
834
+ currentVersion,
835
+ currentVersionLabel: (versions?.versions?.find?.((v) => v.path === currentVersion))?.label || currentVersion,
836
+ availableVersions: useMemo(() => {
837
+ return versions?.versions ? versions.versions.map((v) => ({
838
+ key: v.path,
839
+ label: v.label,
840
+ value: v.path,
841
+ isCurrent: v.path === currentVersion
842
+ })) : [];
843
+ }, [versions, currentVersion]),
844
+ handleVersionChange
845
+ };
846
+ }
847
+
848
+ //#endregion
849
+ //#region src/client/hooks/use-i18n.ts
850
+ /**
851
+ * Hook to manage and switch between different locales (languages) of the documentation.
852
+ */
853
+ function useI18n() {
854
+ const navigate = useNavigate();
855
+ const config = useConfig();
856
+ const { allRoutes, currentRoute, currentLocale, currentVersion } = useRoutes();
857
+ const i18n = config.i18n;
858
+ const { setLocale } = useBoltdocsContext();
859
+ const handleLocaleChange = (locale) => {
860
+ if (!i18n || locale === currentLocale) return;
861
+ setLocale(locale);
862
+ const base = config.base || "/";
863
+ const safeBase = base === "/" ? "" : base.replace(/\/$/, "");
864
+ const isDocRoute = !!currentRoute?.filePath;
865
+ let targetPath = "";
866
+ if (currentRoute) if (isDocRoute) {
867
+ const baseFile = getBaseFilePath(currentRoute.filePath, currentRoute.version, currentRoute.locale);
868
+ const targetRoute = allRoutes.find((r) => getBaseFilePath(r.filePath, r.version, r.locale) === baseFile && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version);
869
+ if (targetRoute) targetPath = targetRoute.path;
870
+ else {
871
+ const defaultIndexRoute = allRoutes.find((r) => getBaseFilePath(r.filePath, r.version, r.locale) === "index.md" && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version);
872
+ if (defaultIndexRoute) targetPath = defaultIndexRoute.path;
873
+ else targetPath = `${safeBase}${currentRoute.version ? `/${currentRoute.version}` : ""}${locale === i18n.defaultLocale ? "" : `/${locale}`}` || "/";
874
+ }
875
+ } else {
876
+ let rawExternal = currentRoute.path;
877
+ const parts = rawExternal.split("/").filter(Boolean);
878
+ if (parts.length > 0 && (Array.isArray(i18n.locales) ? i18n.locales.includes(parts[0]) : !!i18n.locales[parts[0]])) {
879
+ parts.shift();
880
+ rawExternal = "/" + parts.join("/");
881
+ }
882
+ if (locale === i18n.defaultLocale) targetPath = rawExternal === "" ? "/" : rawExternal;
883
+ else {
884
+ const cleanExt = rawExternal.startsWith("/") ? rawExternal : `/${rawExternal}`;
885
+ targetPath = `/${locale}${cleanExt === "/" ? "" : cleanExt}`;
886
+ }
887
+ }
888
+ else {
889
+ const targetRoute = allRoutes.find((r) => (r.locale || i18n.defaultLocale) === locale && (r.version || config.versions?.defaultVersion) === (currentVersion || config.versions?.defaultVersion));
890
+ if (targetRoute) targetPath = targetRoute.path;
891
+ else {
892
+ const vPath = currentVersion && currentVersion !== config.versions?.defaultVersion ? `/${currentVersion}` : "";
893
+ targetPath = locale === i18n.defaultLocale ? `${safeBase}${vPath}` : `${safeBase}${vPath}/${locale}`;
894
+ }
895
+ }
896
+ if (!targetPath || targetPath === "") targetPath = "/";
897
+ targetPath = targetPath.replace(/\/+/g, "/");
898
+ navigate(targetPath);
899
+ };
900
+ const locales = i18n?.locales;
901
+ const defaultLabel = locales ? Array.isArray(locales) ? currentLocale : locales[currentLocale] : void 0;
902
+ return {
903
+ currentLocale,
904
+ currentLocaleLabel: (i18n?.localeConfigs?.[currentLocale])?.label || defaultLabel || currentLocale,
905
+ availableLocales: useMemo(() => {
906
+ return i18n ? Array.isArray(i18n.locales) ? i18n.locales.map((key) => {
907
+ return {
908
+ key,
909
+ label: (i18n?.localeConfigs?.[key])?.label || key,
910
+ value: key,
911
+ isCurrent: key === currentLocale
912
+ };
913
+ }) : Object.entries(i18n.locales).map(([key, label]) => {
914
+ return {
915
+ key,
916
+ label: (i18n?.localeConfigs?.[key])?.label || label,
917
+ value: key,
918
+ isCurrent: key === currentLocale
919
+ };
920
+ }) : [];
921
+ }, [i18n, currentLocale]),
922
+ handleLocaleChange
923
+ };
924
+ }
925
+
926
+ //#endregion
927
+ //#region src/client/components/ui-base/version-i18n.tsx
928
+ function VersionSelector({ className }) {
929
+ const { currentVersionLabel, availableVersions, handleVersionChange } = useVersion();
930
+ if (availableVersions.length === 0) return null;
931
+ return /* @__PURE__ */ jsxs(Menu$1.Trigger, { children: [/* @__PURE__ */ jsxs(Button$1, {
932
+ className: cn("flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer", className),
933
+ children: [/* @__PURE__ */ jsx("span", {
934
+ className: "font-semibold text-[0.8125rem]",
935
+ children: currentVersionLabel
936
+ }), /* @__PURE__ */ jsx(ChevronDown, { className: "w-3.5 h-3.5 text-muted/60" })]
937
+ }), /* @__PURE__ */ jsx(Menu$1.Root, {
938
+ className: "w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100",
939
+ children: /* @__PURE__ */ jsx(Menu$1.Section, {
940
+ items: availableVersions,
941
+ children: (version) => /* @__PURE__ */ jsx(Menu$1.Item, {
942
+ onPress: () => handleVersionChange(version.value),
943
+ className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body hover:bg-primary-50/50 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
944
+ children: version.label
945
+ }, `${version.value ?? ""}`)
946
+ })
947
+ })] });
948
+ }
949
+ function I18nSelector({ className }) {
950
+ const { currentLocale, availableLocales, handleLocaleChange } = useI18n();
951
+ if (availableLocales.length === 0) return null;
952
+ return /* @__PURE__ */ jsxs(Menu$1.Trigger, { children: [/* @__PURE__ */ jsxs(Button$1, {
953
+ className: cn("flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer", className),
954
+ children: [/* @__PURE__ */ jsxs("div", {
955
+ className: "flex items-center gap-1.5",
956
+ children: [/* @__PURE__ */ jsx(Languages, { className: "w-3.5 h-3.5 text-primary-500" }), /* @__PURE__ */ jsx("span", {
957
+ className: "font-bold text-[0.75rem] uppercase opacity-90",
958
+ children: currentLocale || "en"
959
+ })]
960
+ }), /* @__PURE__ */ jsx(ChevronDown, { className: "w-3.5 h-3.5 text-muted/60" })]
961
+ }), /* @__PURE__ */ jsx(Menu$1.Root, {
962
+ className: "w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100",
963
+ children: /* @__PURE__ */ jsx(Menu$1.Section, {
964
+ items: availableLocales,
965
+ children: (locale) => /* @__PURE__ */ jsx(Menu$1.Item, {
966
+ onPress: () => handleLocaleChange(locale.value),
967
+ className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
968
+ children: /* @__PURE__ */ jsx("span", { children: locale.label })
969
+ }, `${locale.value ?? ""}`)
970
+ })
971
+ })] });
972
+ }
973
+
974
+ //#endregion
975
+ //#region src/client/components/ui-base/navbar.tsx
976
+ const SearchDialog$1 = lazy(() => import("../search-dialog-DHc_8FFX.js").then((m) => ({ default: m.SearchDialog })));
977
+ function Navbar() {
978
+ const { links, title, logo, logoProps, github, social, config } = useNavbar();
979
+ const { routes, currentRoute, isCollectionPage, currentVersion, currentLocale } = useRoutes();
980
+ const { isSidebarOpen, toggleSidebar } = useUI();
981
+ const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
982
+ const themeConfig = config.theme || {};
983
+ const isDocs = !!currentRoute?.filePath && !isCollectionPage;
984
+ const hasTabs = themeConfig?.tabs && themeConfig.tabs.length > 0;
985
+ return /* @__PURE__ */ jsxs(Navbar$1.Root, {
986
+ className: cn("border-b border-subtle bg-main/80 backdrop-blur-md", hasTabs && "border-b-0"),
987
+ children: [
988
+ /* @__PURE__ */ jsxs(Navbar$1.Content, { children: [
989
+ /* @__PURE__ */ jsxs(Navbar$1.Left, { children: [
990
+ isDocs && /* @__PURE__ */ jsx(Button$1, {
991
+ onPress: toggleSidebar,
992
+ className: "mr-2 lg:hidden p-1.5 h-8 w-8 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 transition-colors",
993
+ "aria-label": isSidebarOpen ? "Close sidebar" : "Open sidebar",
994
+ children: isSidebarOpen ? /* @__PURE__ */ jsx(X, { className: "w-5 h-5 text-body" }) : /* @__PURE__ */ jsx(Menu, { className: "w-5 h-5 text-body" })
995
+ }),
996
+ logo && /* @__PURE__ */ jsx(Navbar$1.Logo, {
997
+ src: logo,
998
+ alt: logoProps?.alt || title,
999
+ width: logoProps?.width ?? 24,
1000
+ height: logoProps?.height ?? 24,
1001
+ href: "site:/"
1002
+ }),
1003
+ /* @__PURE__ */ jsx(Navbar$1.Title, {
1004
+ href: "site:/",
1005
+ children: title
1006
+ }),
1007
+ /* @__PURE__ */ jsx("div", {
1008
+ className: "hidden sm:block",
1009
+ children: config.versions && currentVersion && /* @__PURE__ */ jsx(VersionSelector, {})
1010
+ })
1011
+ ] }),
1012
+ /* @__PURE__ */ jsx(Navbar$1.Center, { children: /* @__PURE__ */ jsx(Suspense, {
1013
+ fallback: /* @__PURE__ */ jsx("div", { className: "h-9 w-32 animate-pulse rounded-md bg-surface" }),
1014
+ children: /* @__PURE__ */ jsx(SearchDialog$1, { routes: routes || [] })
1015
+ }) }),
1016
+ /* @__PURE__ */ jsxs(Navbar$1.Right, { children: [
1017
+ /* @__PURE__ */ jsx(Suspense, {
1018
+ fallback: null,
1019
+ children: /* @__PURE__ */ jsx("div", {
1020
+ className: "lg:hidden",
1021
+ children: /* @__PURE__ */ jsx(SearchDialog$1, { routes: routes || [] })
1022
+ })
1023
+ }),
1024
+ /* @__PURE__ */ jsx(Navbar$1.Links, { children: links.map((link) => /* @__PURE__ */ jsx(NavbarLinkItem, { link }, link.href)) }),
1025
+ /* @__PURE__ */ jsxs("div", {
1026
+ className: "hidden sm:flex items-center gap-2",
1027
+ children: [config.i18n && currentLocale && /* @__PURE__ */ jsx(I18nSelector, {}), /* @__PURE__ */ jsx(Navbar$1.Split, { className: "bg-subtle" })]
1028
+ }),
1029
+ /* @__PURE__ */ jsx("div", {
1030
+ className: "hidden md:block",
1031
+ children: /* @__PURE__ */ jsx(ThemeToggle, {})
1032
+ }),
1033
+ github && /* @__PURE__ */ jsx("div", {
1034
+ className: "hidden md:block",
1035
+ children: /* @__PURE__ */ jsx(GithubStars, { repo: themeConfig?.githubRepo ?? "" })
1036
+ }),
1037
+ social.length > 0 && /* @__PURE__ */ jsx("div", {
1038
+ className: "hidden md:block",
1039
+ children: /* @__PURE__ */ jsx(Navbar$1.Split, { className: "bg-subtle" })
1040
+ }),
1041
+ /* @__PURE__ */ jsx("div", {
1042
+ className: "hidden md:flex items-center gap-1",
1043
+ children: social.map(({ icon, link }) => /* @__PURE__ */ jsx(Navbar$1.Socials, {
1044
+ icon,
1045
+ link,
1046
+ className: "p-1.5 text-muted hover:text-body hover:bg-surface rounded-md transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30"
1047
+ }, link))
1048
+ }),
1049
+ /* @__PURE__ */ jsx(Navbar$1.More, {
1050
+ onPress: () => setIsMobileMenuOpen(true),
1051
+ className: "text-muted hover:text-body active:scale-90 transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30"
1052
+ })
1053
+ ] })
1054
+ ] }),
1055
+ /* @__PURE__ */ jsxs(Navbar$1.MobileMenu, {
1056
+ isOpen: isMobileMenuOpen,
1057
+ onClose: () => setIsMobileMenuOpen(false),
1058
+ className: "bg-main/98 backdrop-blur-2xl",
1059
+ children: [/* @__PURE__ */ jsx("div", {
1060
+ className: "flex flex-col gap-1",
1061
+ children: links.map((link) => /* @__PURE__ */ jsx(NavbarMobileLinkItem, {
1062
+ link,
1063
+ onClose: () => setIsMobileMenuOpen(false)
1064
+ }, link.href))
1065
+ }), social.length > 0 && /* @__PURE__ */ jsxs("div", {
1066
+ className: "mt-6",
1067
+ children: [/* @__PURE__ */ jsx("div", {
1068
+ className: "px-4 mb-4 text-xs font-bold uppercase tracking-widest text-muted/50",
1069
+ children: "Connect"
1070
+ }), /* @__PURE__ */ jsx("div", {
1071
+ className: "flex flex-wrap gap-2 px-2",
1072
+ children: social.map(({ icon, link }) => /* @__PURE__ */ jsx(Navbar$1.Socials, {
1073
+ icon,
1074
+ link,
1075
+ className: "p-3 bg-surface border border-subtle rounded-xl flex-1 justify-center"
1076
+ }, link))
1077
+ })]
1078
+ })]
1079
+ }),
1080
+ isDocs && hasTabs && themeConfig?.tabs && /* @__PURE__ */ jsx("div", {
1081
+ className: "w-full border-b border-subtle bg-main",
1082
+ children: /* @__PURE__ */ jsx(Tabs, {
1083
+ tabs: themeConfig.tabs,
1084
+ routes: routes || []
1085
+ })
1086
+ })
1087
+ ]
1088
+ });
1089
+ }
1090
+ function NavbarLinkItem({ link }) {
1091
+ const localizedHref = useLocalizedTo(link.href || "");
1092
+ const { pathname } = useLocation$1();
1093
+ const active = pathname === localizedHref || pathname.startsWith(localizedHref + "/");
1094
+ if (link.items && link.items.length > 0) return /* @__PURE__ */ jsx(Navbar$1.Dropdown, {
1095
+ label: /* @__PURE__ */ jsx("span", {
1096
+ className: cn("transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm px-2 py-1", active ? "text-primary-500" : "text-muted hover:text-body"),
1097
+ children: link.label
1098
+ }),
1099
+ children: link.items?.map((item) => /* @__PURE__ */ jsx(Navbar$1.DropdownItem, {
1100
+ href: useLocalizedTo(item.href || ""),
1101
+ label: item.label
1102
+ }, item.href))
1103
+ });
1104
+ return /* @__PURE__ */ jsx(Navbar$1.Link, {
1105
+ ...link,
1106
+ href: localizedHref,
1107
+ active,
1108
+ className: cn("transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm", active ? "text-primary-500" : "text-muted hover:text-body")
1109
+ });
1110
+ }
1111
+ function NavbarMobileLinkItem({ link, onClose }) {
1112
+ const localizedHref = useLocalizedTo(link.href || "");
1113
+ const { pathname } = useLocation$1();
1114
+ const active = pathname === localizedHref;
1115
+ if (link.items && link.items.length > 0) return /* @__PURE__ */ jsxs("div", {
1116
+ className: "flex flex-col gap-1",
1117
+ children: [/* @__PURE__ */ jsx("div", {
1118
+ className: cn("px-3 py-2 text-sm transition-all", active ? "text-body" : "text-muted/80 hover:text-body"),
1119
+ children: link.label
1120
+ }), /* @__PURE__ */ jsx("div", {
1121
+ className: "flex flex-col gap-1 pl-4",
1122
+ children: link.items?.map((item) => /* @__PURE__ */ jsx(NavbarMobileLinkItem, {
1123
+ link: item,
1124
+ onClose
1125
+ }, item.href))
1126
+ })]
1127
+ });
1128
+ return /* @__PURE__ */ jsx(Navbar$1.MobileLink, {
1129
+ ...link,
1130
+ href: localizedHref,
1131
+ active,
1132
+ onPress: onClose,
1133
+ className: cn("transition-all", active ? "text-body" : "text-muted/80 hover:text-body")
1134
+ });
1135
+ }
1136
+
1137
+ //#endregion
1138
+ //#region src/client/components/ui-base/on-this-page.tsx
1139
+ function OnThisPage({ headings = [], editLink, communityHelp, filePath }) {
1140
+ if (headings.length === 0) return null;
1141
+ return /* @__PURE__ */ jsxs(OnThisPage$1.Root, { children: [
1142
+ /* @__PURE__ */ jsxs(OnThisPage$1.Header, {
1143
+ className: "flex flex-row gap-x-2",
1144
+ children: [/* @__PURE__ */ jsx(TextAlignStart, { size: 16 }), "On this page"]
1145
+ }),
1146
+ /* @__PURE__ */ jsx(OnThisPage$1.Tree, { headings }),
1147
+ (editLink || communityHelp) && /* @__PURE__ */ jsxs("div", {
1148
+ className: "mt-8 pt-8 border-t border-subtle space-y-4",
1149
+ children: [/* @__PURE__ */ jsx("p", {
1150
+ className: "text-xs font-bold text-body",
1151
+ children: "Need help?"
1152
+ }), /* @__PURE__ */ jsxs("ul", {
1153
+ className: "space-y-3",
1154
+ children: [editLink && filePath && /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("a", {
1155
+ href: editLink.replace(":path", filePath),
1156
+ target: "_blank",
1157
+ rel: "noopener noreferrer",
1158
+ className: "flex items-center gap-2 text-sm text-muted hover:text-body transition-colors",
1159
+ children: [/* @__PURE__ */ jsx(Pencil, { size: 16 }), "Edit this page"]
1160
+ }) }), communityHelp && /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("a", {
1161
+ href: communityHelp,
1162
+ target: "_blank",
1163
+ rel: "noopener noreferrer",
1164
+ className: "flex items-center gap-2 text-sm text-muted hover:text-body transition-colors",
1165
+ children: [/* @__PURE__ */ jsx(CircleHelp, { size: 16 }), "Community help"]
1166
+ }) })]
1167
+ })]
1168
+ })
1169
+ ] });
1170
+ }
1171
+
1172
+ //#endregion
1173
+ //#region src/client/hooks/use-page-nav.ts
1174
+ /**
1175
+ * Hook to manage the previous and next button functionality for documentation pages.
1176
+ * Intelligent: respects current locale, version, and tab to keep navigation logical.
1177
+ */
1178
+ function usePageNav() {
1179
+ const { routes, currentRoute } = useRoutes();
1180
+ const location = useLocation$1();
1181
+ return useMemo(() => {
1182
+ if (!currentRoute) return {
1183
+ prevPage: null,
1184
+ nextPage: null,
1185
+ currentRoute: null
1186
+ };
1187
+ const activeTabId = currentRoute.tab?.toLowerCase();
1188
+ const contextRoutes = activeTabId ? routes.filter((r) => r.tab?.toLowerCase() === activeTabId) : routes.filter((r) => !r.tab);
1189
+ const currentIndex = contextRoutes.findIndex((r) => r.path === location.pathname);
1190
+ return {
1191
+ prevPage: currentIndex > 0 ? contextRoutes[currentIndex - 1] : null,
1192
+ nextPage: currentIndex !== -1 && currentIndex < contextRoutes.length - 1 ? contextRoutes[currentIndex + 1] : null,
1193
+ currentRoute
1194
+ };
1195
+ }, [
1196
+ routes,
1197
+ currentRoute,
1198
+ location.pathname
1199
+ ]);
1200
+ }
1201
+
1202
+ //#endregion
1203
+ //#region src/client/components/ui-base/page-nav.tsx
1204
+ /**
1205
+ * Component to display the previous and next page navigation buttons.
1206
+ * Enhanced with subtle entrance animations, modern card layout, and hover highlights.
1207
+ */
1208
+ function PageNav() {
1209
+ const { prevPage, nextPage } = usePageNav();
1210
+ if (!prevPage && !nextPage) return null;
1211
+ return /* @__PURE__ */ jsxs(PageNav$1.Root, {
1212
+ className: "pt-8 border-t border-subtle grid sm:grid-cols-2 gap-4 animate-in fade-in slide-in-from-bottom-4 duration-700 select-none",
1213
+ children: [prevPage ? /* @__PURE__ */ jsxs(PageNav$1.Link, {
1214
+ to: prevPage.path,
1215
+ direction: "prev",
1216
+ className: "group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20",
1217
+ children: [/* @__PURE__ */ jsx(PageNav$1.Title, {
1218
+ className: "text-xs font-bold uppercase tracking-wider text-muted/60 mb-1",
1219
+ children: "Previous"
1220
+ }), /* @__PURE__ */ jsx(PageNav$1.Description, {
1221
+ className: "text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors",
1222
+ children: prevPage.title
1223
+ })]
1224
+ }) : /* @__PURE__ */ jsx("div", {}), nextPage ? /* @__PURE__ */ jsxs(PageNav$1.Link, {
1225
+ to: nextPage.path,
1226
+ direction: "next",
1227
+ className: "group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20",
1228
+ children: [/* @__PURE__ */ jsx(PageNav$1.Title, {
1229
+ className: "text-xs font-bold uppercase tracking-wider text-muted/60 mb-1",
1230
+ children: "Next"
1231
+ }), /* @__PURE__ */ jsx(PageNav$1.Description, {
1232
+ className: "text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors",
1233
+ children: nextPage.title
1234
+ })]
1235
+ }) : /* @__PURE__ */ jsx("div", {})]
1236
+ });
1237
+ }
1238
+
1239
+ //#endregion
1240
+ //#region src/client/components/ui-base/sidebar.tsx
1241
+ function SidebarMain({ routes, config }) {
1242
+ const { logo, title, logoProps } = useNavbar();
1243
+ const { closeSidebar } = useUI();
1244
+ const SidebarLogo = logo ? /* @__PURE__ */ jsx("img", {
1245
+ src: logo,
1246
+ alt: logoProps?.alt || title,
1247
+ width: 24,
1248
+ height: 24,
1249
+ className: "rounded-xl"
1250
+ }) : null;
1251
+ const hasUtilities = config.versions || config.i18n;
1252
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Sidebar$1.Root, { children: /* @__PURE__ */ jsx(Sidebar$1.Content, { children: /* @__PURE__ */ jsx(Sidebar$1.Items, { routes }) }) }), /* @__PURE__ */ jsxs(Sidebar$1.Mobile, { children: [/* @__PURE__ */ jsxs(Sidebar$1.Header, { children: [/* @__PURE__ */ jsxs("div", {
1253
+ className: "flex items-center gap-3",
1254
+ children: [SidebarLogo, /* @__PURE__ */ jsx("span", {
1255
+ className: "font-bold text-lg tracking-tight text-body truncate max-w-[120px]",
1256
+ children: title
1257
+ })]
1258
+ }), /* @__PURE__ */ jsxs("div", {
1259
+ className: "flex items-center gap-2",
1260
+ children: [/* @__PURE__ */ jsx(ThemeSwitcher, { className: "w-24 h-9 rounded-xl" }), /* @__PURE__ */ jsx(Button$1, {
1261
+ onPress: closeSidebar,
1262
+ className: "h-9 w-9 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 text-muted hover:text-body transition-colors",
1263
+ "aria-label": "Close sidebar",
1264
+ children: /* @__PURE__ */ jsx(X, { size: 20 })
1265
+ })]
1266
+ })] }), /* @__PURE__ */ jsxs(Sidebar$1.Content, { children: [hasUtilities && /* @__PURE__ */ jsxs("div", {
1267
+ className: "flex flex-col gap-4 mb-10",
1268
+ children: [/* @__PURE__ */ jsxs("div", {
1269
+ className: "flex gap-3",
1270
+ children: [config.versions && /* @__PURE__ */ jsx(VersionSelector, { className: "flex-1 justify-between h-10 bg-surface border-subtle rounded-xl" }), config.i18n && /* @__PURE__ */ jsx(I18nSelector, { className: "flex-1 justify-between h-10 bg-surface border-subtle rounded-xl" })]
1271
+ }), /* @__PURE__ */ jsx("div", { className: "mt-2 border-b border-subtle" })]
1272
+ }), /* @__PURE__ */ jsx(Sidebar$1.Items, { routes })] })] })] });
1273
+ }
1274
+ const Sidebar = Object.assign(SidebarMain, {
1275
+ Root: Sidebar$1.Root,
1276
+ Mobile: Sidebar$1.Mobile,
1277
+ Header: Sidebar$1.Header,
1278
+ Content: Sidebar$1.Content,
1279
+ Group: Sidebar$1.Group,
1280
+ Link: Sidebar$1.Link,
1281
+ SubGroup: Sidebar$1.SubGroup,
1282
+ Item: Sidebar$1.Item,
1283
+ Items: Sidebar$1.Items
1284
+ });
1285
+
1286
+ //#endregion
1287
+ //#region src/client/components/ui-base/banner.tsx
1288
+ function Banner({ children, className = "", dismissible = false, id = "boltdocs-banner", ...props }) {
1289
+ const [isVisible, setIsVisible] = useState(true);
1290
+ useEffect(() => {
1291
+ if (dismissible && id) {
1292
+ if (localStorage.getItem(`boltdocs-banner-dismissed-${id}`) === "true") setIsVisible(false);
1293
+ }
1294
+ }, [dismissible, id]);
1295
+ const handleDismiss = () => {
1296
+ setIsVisible(false);
1297
+ if (dismissible && id) localStorage.setItem(`boltdocs-banner-dismissed-${id}`, "true");
1298
+ };
1299
+ if (!isVisible) return null;
1300
+ return /* @__PURE__ */ jsxs("div", {
1301
+ className: cn("relative flex items-center justify-center px-4 py-2.5 text-xs font-semibold tracking-wide bg-primary-500/10 dark:bg-primary-500/15 text-primary-700 dark:text-primary-300 border-b border-primary-500/20 select-none animate-in fade-in duration-300", className),
1302
+ ...props,
1303
+ children: [/* @__PURE__ */ jsx("div", {
1304
+ className: "flex-1 text-center flex items-center justify-center gap-2",
1305
+ children
1306
+ }), dismissible && /* @__PURE__ */ jsx("button", {
1307
+ onClick: handleDismiss,
1308
+ className: "absolute right-3 top-1/2 -translate-y-1/2 p-1.5 opacity-70 hover:opacity-100 transition-all duration-300 rounded-xl hover:bg-primary-500/10 cursor-pointer border-none bg-transparent flex items-center justify-center outline-none",
1309
+ "aria-label": "Dismiss banner",
1310
+ children: /* @__PURE__ */ jsx(X, { className: "w-3.5 h-3.5" })
1311
+ })]
1312
+ });
1313
+ }
1314
+
1315
+ //#endregion
1316
+ //#region src/client/ssg/mdx-elements.tsx
1317
+ const Loading = () => /* @__PURE__ */ jsx("div", {
1318
+ className: "text-muted text-sm py-4",
1319
+ children: "Loading..."
1320
+ });
1321
+ function resolveModuleLoader(loader) {
1322
+ return typeof loader === "function" ? loader() : Promise.resolve(loader);
1323
+ }
1324
+ const EagerMdxElement = ({ moduleLoader, moduleKey, route, components, collectionPostComponent }) => {
1325
+ const [mod, setMod] = useState(moduleLoader);
1326
+ useEffect(() => {
1327
+ setMod(moduleLoader);
1328
+ }, [moduleLoader]);
1329
+ useEffect(() => {
1330
+ if (!import.meta.hot || !moduleKey) return;
1331
+ const handler = (data) => {
1332
+ if (data.relPath.replace(/\\/g, "/").replace(/^\//, "") !== route.filePath.replace(/\\/g, "/").replace(/^\//, "")) return;
1333
+ import(moduleKey + "?t=" + Date.now()).then((m) => {
1334
+ setMod(m);
1335
+ });
1336
+ };
1337
+ import.meta.hot.on("boltdocs:mdx-update", handler);
1338
+ return () => import.meta.hot?.off("boltdocs:mdx-update", handler);
1339
+ }, [moduleKey, route.filePath]);
1340
+ const MDXComponent = mod?.default ?? mod ?? null;
1341
+ if (!MDXComponent) return /* @__PURE__ */ jsx(Loading, {});
1342
+ return /* @__PURE__ */ jsx(MdxPage, {
1343
+ MDXComponent,
1344
+ mdxComponents: components,
1345
+ collectionPostComponent
1346
+ });
1347
+ };
1348
+ const NotFoundWrapper = () => {
1349
+ const components = useMdxComponents();
1350
+ return /* @__PURE__ */ jsx(components.NotFound || components["404"] || NotFound, {});
1351
+ };
1352
+
1353
+ //#endregion
1354
+ //#region src/client/app/head.tsx
1355
+ function Head({ siteTitle, siteDescription, routes }) {
1356
+ const location = useLocation$1();
1357
+ const config = useConfig();
1358
+ const { currentLocale } = useRoutes();
1359
+ const currentRoute = useMemo(() => routes?.find?.((r) => r.path === location.pathname), [routes, location.pathname]);
1360
+ const pageTitle = currentRoute?.title;
1361
+ const translatedSiteDescription = getTranslated(siteDescription, currentLocale);
1362
+ const pageDescription = currentRoute?.description || translatedSiteDescription || "";
1363
+ const translatedSiteTitle = getTranslated(siteTitle, currentLocale);
1364
+ const finalTitle = pageTitle ? `${pageTitle} | ${translatedSiteTitle}` : translatedSiteTitle;
1365
+ const seo = currentRoute?.seo || {};
1366
+ const canonicalUrl = seo.canonical || (config?.siteUrl && currentRoute?.path ? `${config.siteUrl.replace(/\/$/, "")}${currentRoute.path}` : void 0);
1367
+ const ogUrl = seo["og:url"] || canonicalUrl || (typeof window !== "undefined" ? window.location.href : void 0);
1368
+ const globalMetatags = config?.seo?.metatags || {};
1369
+ const defaultOgImage = config?.seo?.thumbnails?.background;
1370
+ const ogImage = seo["og:image"] || defaultOgImage;
1371
+ return /* @__PURE__ */ jsxs(Helmet, { children: [
1372
+ /* @__PURE__ */ jsx("title", { children: finalTitle }),
1373
+ /* @__PURE__ */ jsx("meta", {
1374
+ name: "description",
1375
+ content: pageDescription
1376
+ }),
1377
+ /* @__PURE__ */ jsx("meta", {
1378
+ property: "og:title",
1379
+ content: finalTitle
1380
+ }),
1381
+ /* @__PURE__ */ jsx("meta", {
1382
+ property: "og:description",
1383
+ content: pageDescription
1384
+ }),
1385
+ /* @__PURE__ */ jsx("meta", {
1386
+ property: "og:type",
1387
+ content: "article"
1388
+ }),
1389
+ canonicalUrl && /* @__PURE__ */ jsx("link", {
1390
+ rel: "canonical",
1391
+ href: canonicalUrl
1392
+ }),
1393
+ ogUrl && /* @__PURE__ */ jsx("meta", {
1394
+ property: "og:url",
1395
+ content: ogUrl
1396
+ }),
1397
+ /* @__PURE__ */ jsx("meta", {
1398
+ name: "twitter:card",
1399
+ content: "summary"
1400
+ }),
1401
+ /* @__PURE__ */ jsx("meta", {
1402
+ name: "twitter:title",
1403
+ content: finalTitle
1404
+ }),
1405
+ /* @__PURE__ */ jsx("meta", {
1406
+ name: "twitter:description",
1407
+ content: pageDescription
1408
+ }),
1409
+ ogImage && /* @__PURE__ */ jsx("meta", {
1410
+ name: "twitter:image",
1411
+ content: ogImage
1412
+ }),
1413
+ ogImage && /* @__PURE__ */ jsx("meta", {
1414
+ property: "og:image",
1415
+ content: ogImage
1416
+ }),
1417
+ /* @__PURE__ */ jsx("meta", {
1418
+ name: "generator",
1419
+ content: "Boltdocs"
1420
+ }),
1421
+ Object.entries(globalMetatags).map(([key, value]) => {
1422
+ return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ jsx("meta", {
1423
+ property: key,
1424
+ content: value
1425
+ }, key) : /* @__PURE__ */ jsx("meta", {
1426
+ name: key,
1427
+ content: value
1428
+ }, key);
1429
+ }),
1430
+ Object.entries(seo).map(([key, value]) => {
1431
+ if (key === "noindex" && value === true) return /* @__PURE__ */ jsx("meta", {
1432
+ name: "robots",
1433
+ content: "noindex"
1434
+ }, "noindex");
1435
+ if (key === "robots") return /* @__PURE__ */ jsx("meta", {
1436
+ name: "robots",
1437
+ content: value
1438
+ }, "robots");
1439
+ if (key === "canonical" || key === "og:url") return null;
1440
+ return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ jsx("meta", {
1441
+ property: key,
1442
+ content: value
1443
+ }, key) : /* @__PURE__ */ jsx("meta", {
1444
+ name: key,
1445
+ content: value
1446
+ }, key);
1447
+ })
1448
+ ] });
1449
+ }
1450
+
1451
+ //#endregion
1452
+ //#region src/client/collections/collections-context.tsx
1453
+ const CollectionsContext = createContext({});
1454
+ function useCollectionsData() {
1455
+ return use(CollectionsContext);
1456
+ }
1457
+
1458
+ //#endregion
1459
+ //#region src/client/app/docs-layout.tsx
1460
+ function DocsLayout({ collectionsData }) {
1461
+ const config = useConfig();
1462
+ const { currentRoute, allRoutes } = useRoutes();
1463
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Head, {
1464
+ siteTitle: config.theme?.title,
1465
+ siteDescription: config.theme?.description,
1466
+ routes: allRoutes || []
1467
+ }), /* @__PURE__ */ jsx(InternalErrorBoundary, { children: /* @__PURE__ */ jsx(UserLayout, {
1468
+ route: currentRoute,
1469
+ children: /* @__PURE__ */ jsx(Outlet, {})
1470
+ }) })] });
1471
+ if (collectionsData) return /* @__PURE__ */ jsx(CollectionsContext.Provider, {
1472
+ value: collectionsData,
1473
+ children: content
1474
+ });
1475
+ return content;
1476
+ }
1477
+
1478
+ //#endregion
1479
+ //#region src/client/ssg/create-routes.utils.ts
1480
+ function withBase(path, config) {
1481
+ const base = config.base || "/";
1482
+ if (path.startsWith(base)) return path;
1483
+ return `${base === "/" ? "" : base.replace(/\/$/, "")}${path.startsWith("/") ? path : `/${path}`}` || "/";
1484
+ }
1485
+ function buildModuleMap(mdxModules) {
1486
+ const moduleMap = /* @__PURE__ */ new Map();
1487
+ const mdxModuleKeys = Object.keys(mdxModules);
1488
+ if (mdxModuleKeys.length > 0) {
1489
+ const docsDirName = mdxModuleKeys[0].replace(/\\/g, "/").split("/").filter(Boolean)[0] || "docs";
1490
+ const primaryPrefix = `/${docsDirName}/`;
1491
+ const altPrefix = `./${docsDirName}/`;
1492
+ for (const rawKey of mdxModuleKeys) {
1493
+ const k = rawKey.replace(/\\/g, "/");
1494
+ let relativePath = "";
1495
+ if (k.indexOf(primaryPrefix) !== -1) relativePath = k.substring(k.indexOf(primaryPrefix) + primaryPrefix.length);
1496
+ else if (k.startsWith(altPrefix)) relativePath = k.substring(altPrefix.length);
1497
+ if (relativePath) moduleMap.set(relativePath, rawKey);
1498
+ else moduleMap.set(k, rawKey);
1499
+ }
1500
+ }
1501
+ return moduleMap;
1502
+ }
1503
+
1504
+ //#endregion
1505
+ //#region src/client/ssg/create-routes.doc.tsx
1506
+ function buildDocRoutes(options) {
1507
+ const { routesData, config, mdxModules, components, externalPages } = options;
1508
+ const baseDocsPath = (config.base || "/docs").replace(/\/$/, "") || "/";
1509
+ const defaultVersionMetadata = [];
1510
+ const defaultVersion = config.versions?.defaultVersion;
1511
+ const docsBase = (config.base || "/docs").replace(/\/$/, "");
1512
+ if (defaultVersion) routesData.filter((r) => !r.collection).forEach((route) => {
1513
+ if (route.version) return;
1514
+ const p = route.path || "";
1515
+ const subPath = p.startsWith(docsBase) ? p.substring(docsBase.length).replace(/^\//, "") : p.replace(/^\//, "");
1516
+ if (!(subPath === defaultVersion || subPath.startsWith(`${defaultVersion}/`))) {
1517
+ const explicitPath = `${docsBase}/${defaultVersion}/${subPath}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
1518
+ defaultVersionMetadata.push({
1519
+ ...route,
1520
+ path: explicitPath,
1521
+ version: defaultVersion
1522
+ });
1523
+ }
1524
+ });
1525
+ const docMetadata = [...routesData.filter((r) => !r.collection), ...defaultVersionMetadata];
1526
+ const moduleMap = buildModuleMap(mdxModules);
1527
+ const mdxModuleKeys = Object.keys(mdxModules);
1528
+ const isLazy = mdxModuleKeys.length > 0 && typeof mdxModules[mdxModuleKeys[0]] === "function";
1529
+ const docRoutes = docMetadata.map((route) => {
1530
+ const normalizedFilePath = route.filePath.replace(/\\/g, "/");
1531
+ const moduleKey = moduleMap.get(normalizedFilePath);
1532
+ const moduleLoader = moduleKey ? mdxModules[moduleKey] : null;
1533
+ const fullPath = withBase(route.path === "" ? "/" : route.path, config);
1534
+ const path = fullPath === baseDocsPath ? "." : fullPath.startsWith(baseDocsPath + "/") ? fullPath.slice(baseDocsPath.length + 1) : fullPath;
1535
+ const routeRecord = {
1536
+ path,
1537
+ loader: async () => ({
1538
+ path,
1539
+ frontmatter: {
1540
+ title: route.title,
1541
+ description: route.description || "",
1542
+ ...route.frontmatter || {}
1543
+ },
1544
+ seo: route.seo,
1545
+ headings: route.headings || [],
1546
+ filePath: route.filePath,
1547
+ locale: route.locale,
1548
+ version: route.version,
1549
+ group: route.group,
1550
+ groupTitle: route.groupTitle,
1551
+ date: route.date,
1552
+ lastUpdated: route.lastUpdated
1553
+ }),
1554
+ getStaticPaths: () => [path]
1555
+ };
1556
+ if (isLazy && moduleLoader) routeRecord.lazy = async () => {
1557
+ const mod = await resolveModuleLoader(moduleLoader);
1558
+ return { Component: function LoadedMdxRoute() {
1559
+ return /* @__PURE__ */ jsx(EagerMdxElement, {
1560
+ moduleKey,
1561
+ moduleLoader: mod,
1562
+ route,
1563
+ components
1564
+ }, moduleKey || path);
1565
+ } };
1566
+ };
1567
+ else routeRecord.element = /* @__PURE__ */ jsx(EagerMdxElement, {
1568
+ moduleKey,
1569
+ moduleLoader,
1570
+ route,
1571
+ components
1572
+ }, moduleKey || path);
1573
+ return routeRecord;
1574
+ });
1575
+ const locales = config.i18n?.locales ? Array.isArray(config.i18n.locales) ? config.i18n.locales : Object.keys(config.i18n.locales) : [];
1576
+ const allVersions = config.versions?.versions?.map((v) => v.path) || [];
1577
+ const targetBasePaths = [];
1578
+ targetBasePaths.push({
1579
+ path: baseDocsPath,
1580
+ filter: () => true
1581
+ });
1582
+ const subPaths = [];
1583
+ if (allVersions.length > 0) allVersions.forEach((v) => subPaths.push(`/${v}`));
1584
+ if (locales.length > 0) locales.forEach((l) => subPaths.push(`/${l}`));
1585
+ if (allVersions.length > 0 && locales.length > 0) allVersions.forEach((v) => {
1586
+ locales.forEach((l) => {
1587
+ subPaths.push(`/${v}/${l}`);
1588
+ });
1589
+ });
1590
+ subPaths.forEach((sp) => {
1591
+ const fullP = baseDocsPath === "/" ? sp : `${baseDocsPath}${sp}`;
1592
+ targetBasePaths.push({
1593
+ path: fullP,
1594
+ filter: (rp) => rp.startsWith(fullP.replace(/\/$/, "") + "/")
1595
+ });
1596
+ });
1597
+ const docPathRegistry = new Set(docRoutes.map((r) => (r.path || "").replace(/\/$/, "")));
1598
+ const externalPaths = /* @__PURE__ */ new Set();
1599
+ if (externalPages) Object.keys(externalPages).forEach((rawPath) => {
1600
+ const p = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
1601
+ externalPaths.add(p.replace(/\/$/, ""));
1602
+ if (config.i18n) Object.keys(config.i18n.locales).forEach((locale) => {
1603
+ externalPaths.add(`/${locale}${p === "/" ? "" : p}`.replace(/\/$/, ""));
1604
+ });
1605
+ });
1606
+ targetBasePaths.forEach(({ path: bPath, filter }) => {
1607
+ if (bPath === "/") return;
1608
+ const normalizedPath = bPath.replace(/\/$/, "");
1609
+ if (!(docPathRegistry.has(normalizedPath) || externalPaths.has(normalizedPath))) {
1610
+ const defaultTab = config.theme?.tabs?.[0]?.id;
1611
+ const defaultTabPath = defaultTab ? `${normalizedPath}/${defaultTab}`.replace(/\/+/g, "/") : null;
1612
+ let matchedRouteObj = defaultTabPath && docPathRegistry.has(defaultTabPath.replace(/\/$/, "")) ? docRoutes.find((r) => r.path.replace(/\/$/, "") === defaultTabPath.replace(/\/$/, "")) : docRoutes.find((r) => filter(r.path) && r.path !== normalizedPath);
1613
+ if (!matchedRouteObj && docRoutes.length > 0) matchedRouteObj = docRoutes[0];
1614
+ if (matchedRouteObj) {
1615
+ const redirectPath = bPath === baseDocsPath ? "." : bPath.startsWith(baseDocsPath + "/") ? bPath.slice(baseDocsPath.length + 1) : bPath;
1616
+ const isBasePathFallback = redirectPath === ".";
1617
+ docRoutes.push({
1618
+ ...isBasePathFallback ? { index: true } : { path: redirectPath },
1619
+ element: matchedRouteObj.element,
1620
+ loader: matchedRouteObj.loader,
1621
+ getStaticPaths: () => []
1622
+ });
1623
+ const matchedMetaObj = docMetadata.find((m) => {
1624
+ const fullPath = withBase(m.path === "" ? "/" : m.path, config);
1625
+ return (fullPath === baseDocsPath ? "." : fullPath.startsWith(baseDocsPath + "/") ? fullPath.slice(baseDocsPath.length + 1) : fullPath) === matchedRouteObj.path;
1626
+ });
1627
+ if (matchedMetaObj) {
1628
+ const canonicalPath = withBase(matchedMetaObj.path, config);
1629
+ const canonicalUrl = config.siteUrl ? `${config.siteUrl.replace(/\/$/, "")}${canonicalPath}` : canonicalPath;
1630
+ docMetadata.push({
1631
+ ...matchedMetaObj,
1632
+ path: bPath,
1633
+ filePath: "",
1634
+ slugParts: [],
1635
+ seo: {
1636
+ ...matchedMetaObj.seo,
1637
+ canonical: canonicalUrl
1638
+ }
1639
+ });
1640
+ }
1641
+ }
1642
+ }
1643
+ });
1644
+ return {
1645
+ routes: docRoutes,
1646
+ metadata: docMetadata
1647
+ };
1648
+ }
1649
+
1650
+ //#endregion
1651
+ //#region src/client/ssg/create-routes.external.tsx
1652
+ function buildExternalRoutes(options) {
1653
+ const { externalPages, externalLayout, config } = options;
1654
+ const children = [];
1655
+ const metadata = [];
1656
+ if (!externalPages) return {
1657
+ children,
1658
+ metadata
1659
+ };
1660
+ const EffectiveExternalLayout = externalLayout || (({ children }) => /* @__PURE__ */ jsx(Fragment, { children }));
1661
+ Object.entries(externalPages).forEach(([rawPath, ExtComponent]) => {
1662
+ const path = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
1663
+ metadata.push({
1664
+ path,
1665
+ locale: config.i18n?.defaultLocale,
1666
+ title: rawPath === "/" ? "Home" : rawPath.replace(/^\//, "").split("/").pop() || "Page",
1667
+ filePath: "",
1668
+ headings: []
1669
+ });
1670
+ children.push({
1671
+ path,
1672
+ element: /* @__PURE__ */ jsx(EffectiveExternalLayout, { children: /* @__PURE__ */ jsx(ExtComponent, {}) }),
1673
+ loader: async () => ({
1674
+ path,
1675
+ locale: config.i18n?.defaultLocale
1676
+ }),
1677
+ getStaticPaths: () => [path]
1678
+ });
1679
+ if (config.i18n) Object.keys(config.i18n.locales).forEach((locale) => {
1680
+ const localePath = `/${locale}${rawPath === "/" ? "" : rawPath}`;
1681
+ metadata.push({
1682
+ path: localePath,
1683
+ locale,
1684
+ title: rawPath,
1685
+ filePath: "",
1686
+ headings: []
1687
+ });
1688
+ children.push({
1689
+ path: localePath,
1690
+ element: /* @__PURE__ */ jsx(EffectiveExternalLayout, { children: /* @__PURE__ */ jsx(ExtComponent, {}) }),
1691
+ loader: async () => ({
1692
+ path: localePath,
1693
+ locale
1694
+ }),
1695
+ getStaticPaths: () => [localePath]
1696
+ });
1697
+ });
1698
+ });
1699
+ return {
1700
+ children,
1701
+ metadata
1702
+ };
1703
+ }
1704
+
1705
+ //#endregion
1706
+ //#region src/client/ssg/create-routes.collection.tsx
1707
+ function DefaultCollectionList() {
1708
+ const data = useLoaderData();
1709
+ if (!data || !data.posts) return null;
1710
+ return /* @__PURE__ */ jsxs("div", {
1711
+ className: "py-8 max-w-2xl mx-auto px-4",
1712
+ children: [
1713
+ /* @__PURE__ */ jsx("h1", {
1714
+ className: "text-3xl font-bold mb-6 capitalize",
1715
+ children: data.collection
1716
+ }),
1717
+ /* @__PURE__ */ jsx("div", {
1718
+ className: "space-y-6",
1719
+ children: data.posts.map((post) => /* @__PURE__ */ jsxs("article", {
1720
+ className: "border-b border-subtle pb-4",
1721
+ children: [
1722
+ /* @__PURE__ */ jsx("h2", {
1723
+ className: "text-xl font-semibold mb-2",
1724
+ children: /* @__PURE__ */ jsx(Link, {
1725
+ to: post.path,
1726
+ className: "text-primary-600 hover:underline",
1727
+ children: post.title
1728
+ })
1729
+ }),
1730
+ post.date && /* @__PURE__ */ jsx("time", {
1731
+ className: "text-xs text-muted block mb-2",
1732
+ children: new Date(post.date).toLocaleDateString()
1733
+ }),
1734
+ post.excerpt && /* @__PURE__ */ jsx("p", {
1735
+ className: "text-sm text-body",
1736
+ children: post.excerpt
1737
+ })
1738
+ ]
1739
+ }, post.path))
1740
+ }),
1741
+ data.totalPages > 1 && /* @__PURE__ */ jsxs("div", {
1742
+ className: "mt-8 flex gap-4 text-sm",
1743
+ children: [
1744
+ data.currentPage > 1 && /* @__PURE__ */ jsx(Link, {
1745
+ to: data.currentPage === 2 ? `/${data.collection}` : `/${data.collection}/page/${data.currentPage - 1}`,
1746
+ className: "text-primary-600 hover:underline",
1747
+ children: "Previous"
1748
+ }),
1749
+ /* @__PURE__ */ jsxs("span", { children: [
1750
+ "Page ",
1751
+ data.currentPage,
1752
+ " of ",
1753
+ data.totalPages
1754
+ ] }),
1755
+ data.currentPage < data.totalPages && /* @__PURE__ */ jsx(Link, {
1756
+ to: `/${data.collection}/page/${data.currentPage + 1}`,
1757
+ className: "text-primary-600 hover:underline",
1758
+ children: "Next"
1759
+ })
1760
+ ]
1761
+ })
1762
+ ]
1763
+ });
1764
+ }
1765
+ function buildCollectionRoutes(options) {
1766
+ const { routesData, collectionsData, collectionLayouts, collectionLists, collectionPosts, config, mdxModules, components } = options;
1767
+ const postsPerPage = options.postsPerPage ?? config.collections?.postsPerPage ?? 10;
1768
+ const children = [];
1769
+ const metadata = [];
1770
+ const collectionsMap = /* @__PURE__ */ new Map();
1771
+ for (const r of routesData) if (r.collection) {
1772
+ if (!collectionsMap.has(r.collection)) collectionsMap.set(r.collection, []);
1773
+ collectionsMap.get(r.collection).push(r);
1774
+ }
1775
+ const moduleMap = buildModuleMap(mdxModules);
1776
+ const mdxModuleKeys = Object.keys(mdxModules);
1777
+ const isLazy = mdxModuleKeys.length > 0 && typeof mdxModules[mdxModuleKeys[0]] === "function";
1778
+ for (const [colName, colRoutes] of collectionsMap) {
1779
+ const colBase = `/${colName}`;
1780
+ colRoutes.sort((a, b) => {
1781
+ const da = a.date ? new Date(a.date).getTime() : 0;
1782
+ return (b.date ? new Date(b.date).getTime() : 0) - da;
1783
+ });
1784
+ const colChildren = [];
1785
+ for (const route of colRoutes) {
1786
+ const normalizedFilePath = route.filePath.replace(/\\/g, "/");
1787
+ const moduleKey = moduleMap.get(normalizedFilePath);
1788
+ const moduleLoader = moduleKey ? mdxModules[moduleKey] : null;
1789
+ const subPath = route.path.startsWith(colBase + "/") ? route.path.slice(colBase.length + 1) : route.path.replace(colBase, "") || "";
1790
+ const routeWithCollection = {
1791
+ ...route,
1792
+ collection: colName
1793
+ };
1794
+ const postComponent = collectionPosts?.[colName];
1795
+ const routeRecord = {
1796
+ path: subPath,
1797
+ loader: async () => ({
1798
+ route: routeWithCollection,
1799
+ headings: route.headings || [],
1800
+ collection: colName,
1801
+ path: subPath,
1802
+ frontmatter: {
1803
+ title: route.title,
1804
+ description: route.description || "",
1805
+ ...route.frontmatter || {}
1806
+ },
1807
+ filePath: route.filePath,
1808
+ locale: route.locale,
1809
+ version: route.version,
1810
+ date: route.date,
1811
+ lastUpdated: route.lastUpdated
1812
+ }),
1813
+ getStaticPaths: () => [subPath || "."]
1814
+ };
1815
+ if (isLazy && moduleLoader) routeRecord.lazy = async () => {
1816
+ const mod = await resolveModuleLoader(moduleLoader);
1817
+ return { Component: function LoadedCollectionMdxRoute() {
1818
+ return /* @__PURE__ */ jsx(EagerMdxElement, {
1819
+ moduleKey,
1820
+ moduleLoader: mod,
1821
+ route,
1822
+ components,
1823
+ collectionPostComponent: postComponent
1824
+ }, moduleKey || subPath);
1825
+ } };
1826
+ };
1827
+ else routeRecord.element = /* @__PURE__ */ jsx(EagerMdxElement, {
1828
+ moduleKey,
1829
+ moduleLoader,
1830
+ route,
1831
+ components,
1832
+ collectionPostComponent: postComponent
1833
+ }, moduleKey || subPath);
1834
+ colChildren.push(routeRecord);
1835
+ metadata.push(route);
1836
+ }
1837
+ const totalPages = Math.ceil(colRoutes.length / postsPerPage);
1838
+ const paginatedPosts = colRoutes.map((r) => ({
1839
+ path: r.path,
1840
+ title: r.title,
1841
+ date: r.date,
1842
+ excerpt: r.excerpt,
1843
+ tags: r.tags,
1844
+ author: r.author,
1845
+ coverImage: r.coverImage,
1846
+ filePath: r.filePath,
1847
+ frontmatter: r.frontmatter
1848
+ }));
1849
+ const ListElement = collectionLists?.[colName] || DefaultCollectionList;
1850
+ colChildren.unshift({
1851
+ index: true,
1852
+ element: /* @__PURE__ */ jsx(ListElement, {}),
1853
+ loader: async () => ({
1854
+ posts: paginatedPosts.slice(0, postsPerPage),
1855
+ totalPages,
1856
+ currentPage: 1,
1857
+ collection: colName
1858
+ }),
1859
+ getStaticPaths: () => []
1860
+ });
1861
+ for (let p = 2; p <= totalPages; p++) colChildren.push({
1862
+ path: `page/${p}`,
1863
+ element: /* @__PURE__ */ jsx(ListElement, {}),
1864
+ loader: async () => ({
1865
+ posts: paginatedPosts.slice((p - 1) * postsPerPage, p * postsPerPage),
1866
+ totalPages,
1867
+ currentPage: p,
1868
+ collection: colName
1869
+ }),
1870
+ getStaticPaths: () => [`page/${p}`]
1871
+ });
1872
+ const blogLayoutRoute = {
1873
+ path: colBase,
1874
+ element: /* @__PURE__ */ jsx(collectionLayouts?.[colName] || DocsLayout, { collectionsData: collectionsData || {} }),
1875
+ children: colChildren
1876
+ };
1877
+ children.push(blogLayoutRoute);
1878
+ }
1879
+ return {
1880
+ children,
1881
+ metadata
1882
+ };
1883
+ }
1884
+
1885
+ //#endregion
1886
+ //#region src/client/ssg/create-routes.tsx
1887
+ function createRoutes(options) {
1888
+ const { config, components, externalLayout } = options;
1889
+ const EffectiveExternalLayout = externalLayout || (({ children }) => /* @__PURE__ */ jsx(Fragment, { children }));
1890
+ const baseDocsPath = (config.base || "/docs").replace(/\/$/, "") || "/";
1891
+ const { routes: docRoutes, metadata: docMetadata } = buildDocRoutes(options);
1892
+ const externalRoutes = buildExternalRoutes(options);
1893
+ const collectionRoutes = buildCollectionRoutes(options);
1894
+ const children = [
1895
+ {
1896
+ path: baseDocsPath,
1897
+ element: /* @__PURE__ */ jsx(DocsLayout, {}),
1898
+ children: docRoutes
1899
+ },
1900
+ ...externalRoutes.children,
1901
+ ...collectionRoutes.children,
1902
+ {
1903
+ path: "*",
1904
+ element: /* @__PURE__ */ jsx(EffectiveExternalLayout, { children: /* @__PURE__ */ jsx(NotFoundWrapper, {}) })
1905
+ }
1906
+ ];
1907
+ return [{
1908
+ element: /* @__PURE__ */ jsx(BoltdocsShell, {
1909
+ config,
1910
+ routes: [
1911
+ ...docMetadata,
1912
+ ...externalRoutes.metadata,
1913
+ ...collectionRoutes.metadata
1914
+ ],
1915
+ components
1916
+ }),
1917
+ children
1918
+ }];
1919
+ }
1920
+
1921
+ //#endregion
1922
+ //#region src/client/hooks/use-analytics.ts
1923
+ function createAnalyticsInstance(config) {
1924
+ if (typeof window === "undefined") return createDisabledAnalytics();
1925
+ if (typeof window.gtag === "function") return createGtagAnalytics(config);
1926
+ if (window.dataLayer) return createDataLayerAnalytics(config);
1927
+ return createDisabledAnalytics();
1928
+ }
1929
+ function createGtagAnalytics(config) {
1930
+ return {
1931
+ trackPageView: (path, title) => {
1932
+ window.gtag?.("event", "page_view", {
1933
+ page_path: path,
1934
+ page_title: title || document.title,
1935
+ send_to: config?.ga4?.measurementId
1936
+ });
1937
+ },
1938
+ trackEvent: ({ action, category, label, value, params }) => {
1939
+ window.gtag?.("event", action, {
1940
+ event_category: category,
1941
+ event_label: label,
1942
+ value,
1943
+ send_to: config?.ga4?.measurementId,
1944
+ ...params
1945
+ });
1946
+ },
1947
+ trackSearch: (query, resultsCount) => {
1948
+ window.gtag?.("event", "search", {
1949
+ search_term: query,
1950
+ results_count: resultsCount,
1951
+ send_to: config?.ga4?.measurementId
1952
+ });
1953
+ },
1954
+ trackDownload: (file, type) => {
1955
+ window.gtag?.("event", "file_download", {
1956
+ file_name: file,
1957
+ file_type: type || file.split(".").pop(),
1958
+ send_to: config?.ga4?.measurementId
1959
+ });
1960
+ },
1961
+ trackExternalLink: (url) => {
1962
+ window.gtag?.("event", "external_link", {
1963
+ link_url: url,
1964
+ send_to: config?.ga4?.measurementId
1965
+ });
1966
+ },
1967
+ isEnabled: true
1968
+ };
1969
+ }
1970
+ function createDataLayerAnalytics(config) {
1971
+ return {
1972
+ trackPageView: (path, title) => {
1973
+ window.dataLayer?.push({
1974
+ event: "page_view",
1975
+ page_path: path,
1976
+ page_title: title || document.title,
1977
+ send_to: config?.gtm?.tagId
1978
+ });
1979
+ },
1980
+ trackEvent: ({ action, category, label, value, params }) => {
1981
+ window.dataLayer?.push({
1982
+ event: action,
1983
+ event_category: category,
1984
+ event_label: label,
1985
+ value,
1986
+ send_to: config?.gtm?.tagId,
1987
+ ...params
1988
+ });
1989
+ },
1990
+ trackSearch: (query, resultsCount) => {
1991
+ window.dataLayer?.push({
1992
+ event: "search",
1993
+ search_term: query,
1994
+ results_count: resultsCount,
1995
+ send_to: config?.gtm?.tagId
1996
+ });
1997
+ },
1998
+ trackDownload: (file, type) => {
1999
+ window.dataLayer?.push({
2000
+ event: "file_download",
2001
+ file_name: file,
2002
+ file_type: type || file.split(".").pop(),
2003
+ send_to: config?.gtm?.tagId
2004
+ });
2005
+ },
2006
+ trackExternalLink: (url) => {
2007
+ window.dataLayer?.push({
2008
+ event: "external_link",
2009
+ link_url: url,
2010
+ send_to: config?.gtm?.tagId
2011
+ });
2012
+ },
2013
+ isEnabled: true
2014
+ };
2015
+ }
2016
+ function createDisabledAnalytics() {
2017
+ return {
2018
+ trackPageView: () => {},
2019
+ trackEvent: () => {},
2020
+ trackSearch: () => {},
2021
+ trackDownload: () => {},
2022
+ trackExternalLink: () => {},
2023
+ isEnabled: false
2024
+ };
2025
+ }
2026
+ const CONFIG_INSTANCE_SYMBOL = Symbol.for("__BDOCS_CONFIG_INSTANCE__");
2027
+ function useAnalytics(options = {}) {
2028
+ const { config: optionsConfig, autoTrackPageViews = true, autoTrackDownloads = true, autoTrackExternalLinks = true, excludePatterns = [] } = options;
2029
+ const globalConfig = typeof globalThis !== "undefined" ? globalThis[CONFIG_INSTANCE_SYMBOL] : void 0;
2030
+ const config = optionsConfig ?? globalConfig?.integrations;
2031
+ const analytics = useMemo(() => createAnalyticsInstance(config), [config]);
2032
+ const previousPath = useRef("");
2033
+ const location = useLocation();
2034
+ useEffect(() => {
2035
+ if (!autoTrackPageViews || !analytics.isEnabled) return;
2036
+ const path = location.pathname + location.search;
2037
+ if (path !== previousPath.current) {
2038
+ previousPath.current = path;
2039
+ analytics.trackPageView(path, document.title);
2040
+ }
2041
+ }, [
2042
+ location.pathname,
2043
+ autoTrackPageViews,
2044
+ analytics
2045
+ ]);
2046
+ useEffect(() => {
2047
+ if (!autoTrackDownloads || !analytics.isEnabled) return;
2048
+ const handleClick = (event) => {
2049
+ const target = event.target?.closest("a");
2050
+ if (!target) return;
2051
+ const href = target.getAttribute("href");
2052
+ if (!href) return;
2053
+ if (excludePatterns.some((pattern) => pattern.test(href))) return;
2054
+ if (target.hasAttribute("download") || /\.(pdf|doc|docx|xls|xlsx|ppt|pptx|zip|rar|7z|tar|gz|mp3|mp4|avi|mov|png|jpg|jpeg|gif|svg|webp)$/i.test(href)) {
2055
+ const fileName = href.split("/").pop() || href;
2056
+ analytics.trackDownload(fileName, fileName.split(".").pop());
2057
+ }
2058
+ };
2059
+ document.addEventListener("click", handleClick);
2060
+ return () => document.removeEventListener("click", handleClick);
2061
+ }, [
2062
+ autoTrackDownloads,
2063
+ autoTrackExternalLinks,
2064
+ analytics,
2065
+ excludePatterns
2066
+ ]);
2067
+ useEffect(() => {
2068
+ if (!autoTrackExternalLinks || !analytics.isEnabled) return;
2069
+ const handleClick = (event) => {
2070
+ const target = event.target?.closest("a");
2071
+ if (!target) return;
2072
+ const href = target.getAttribute("href");
2073
+ if (!href) return;
2074
+ if (excludePatterns.some((pattern) => pattern.test(href))) return;
2075
+ if ((href.startsWith("http://") || href.startsWith("https://") || href.startsWith("//")) && !href.includes(window.location.hostname)) analytics.trackExternalLink(href);
2076
+ };
2077
+ document.addEventListener("click", handleClick);
2078
+ return () => document.removeEventListener("click", handleClick);
2079
+ }, [
2080
+ autoTrackExternalLinks,
2081
+ analytics,
2082
+ excludePatterns
2083
+ ]);
2084
+ return analytics;
2085
+ }
2086
+ function useTrackPageView() {
2087
+ const analytics = useMemo(() => createAnalyticsInstance(), []);
2088
+ return useCallback((path, title) => {
2089
+ analytics.trackPageView(path, title);
2090
+ }, [analytics]);
2091
+ }
2092
+ function useTrackEvent() {
2093
+ const analytics = useMemo(() => createAnalyticsInstance(), []);
2094
+ return useCallback((event) => {
2095
+ analytics.trackEvent(event);
2096
+ }, [analytics]);
2097
+ }
2098
+
2099
+ //#endregion
2100
+ //#region src/client/hooks/use-headings.ts
2101
+ /**
2102
+ * Returns the headings of the current page, extracted from the route loader data.
2103
+ * Useful for building custom Tables of Contents or jumping to sections.
2104
+ *
2105
+ * @returns An array of heading objects with level, text, and id.
2106
+ */
2107
+ function useHeadings() {
2108
+ const matches = useMatches();
2109
+ return useMemo(() => {
2110
+ return (matches[matches.length - 1]?.data)?.headings || [];
2111
+ }, [matches]);
2112
+ }
2113
+
2114
+ //#endregion
2115
+ //#region src/client/components/docs-layout-default.tsx
2116
+ function DocsLayoutComponent({ children }) {
2117
+ const { routes: filteredRoutes, currentRoute, isCollectionPage } = useRoutes();
2118
+ const config = useConfig();
2119
+ return /* @__PURE__ */ jsxs(DocsLayout$1, {
2120
+ className: "selection:bg-primary-500/10 selection:text-primary-500",
2121
+ children: [/* @__PURE__ */ jsx(Navbar, {}), /* @__PURE__ */ jsxs(DocsLayout$1.Body, {
2122
+ className: "bg-main",
2123
+ children: [
2124
+ !isCollectionPage && /* @__PURE__ */ jsx(Sidebar, {
2125
+ routes: filteredRoutes || [],
2126
+ config
2127
+ }),
2128
+ /* @__PURE__ */ jsx(DocsLayout$1.Content, {
2129
+ className: "animate-in fade-in duration-500 scroll-smooth",
2130
+ children: /* @__PURE__ */ jsxs(DocsLayout$1.ContentMdx, {
2131
+ className: "max-w-3xl sm:max-w-4xl lg:max-w-5xl px-4 sm:px-6 pt-8 pb-24",
2132
+ children: [
2133
+ !isCollectionPage && /* @__PURE__ */ jsxs(DocsLayout$1.Header, { children: [
2134
+ /* @__PURE__ */ jsxs("div", {
2135
+ className: "mb-4 border-b border-subtle pb-4 flex flex-wrap items-center justify-between gap-3",
2136
+ children: [/* @__PURE__ */ jsx(Breadcrumbs, {}), /* @__PURE__ */ jsx(CopyMarkdown, {
2137
+ mdxRaw: currentRoute?._rawContent,
2138
+ route: currentRoute
2139
+ })]
2140
+ }),
2141
+ currentRoute?.title && /* @__PURE__ */ jsx("h1", {
2142
+ className: "text-4xl font-bold tracking-tight text-default mb-3",
2143
+ children: currentRoute.title
2144
+ }),
2145
+ currentRoute?.description && /* @__PURE__ */ jsx("p", {
2146
+ className: "text-lg text-muted-foreground mb-6 leading-relaxed",
2147
+ children: currentRoute.description
2148
+ })
2149
+ ] }),
2150
+ /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx("div", {
2151
+ className: "prose prose-neutral dark:prose-invert max-w-none",
2152
+ children
2153
+ }) }),
2154
+ /* @__PURE__ */ jsx(DocsLayout$1.Footer, { children: !isCollectionPage && /* @__PURE__ */ jsx(PageNav, {}) })
2155
+ ]
2156
+ })
2157
+ }),
2158
+ /* @__PURE__ */ jsx(OnThisPage, {
2159
+ headings: currentRoute?.headings,
2160
+ editLink: config.theme?.editLink,
2161
+ communityHelp: config.theme?.communityHelp,
2162
+ filePath: currentRoute?.filePath
2163
+ })
2164
+ ]
2165
+ })]
2166
+ });
2167
+ }
2168
+
2169
+ //#endregion
2170
+ //#region src/client/collections/hooks.ts
2171
+ /**
2172
+ * Returns the posts of a collection.
2173
+ * @param collection - The name of the collection.
2174
+ * @returns The posts of the collection.
2175
+ */
2176
+ function usePosts(collection) {
2177
+ return useCollectionsData()[collection] || [];
2178
+ }
2179
+ /**
2180
+ * Returns a post by its slug.
2181
+ * @param collection - The name of the collection.
2182
+ * @param slug - The slug of the post.
2183
+ * @returns The post with the given slug.
2184
+ */
2185
+ function usePost(collection, slug) {
2186
+ const posts = usePosts(collection);
2187
+ return useMemo(() => posts.find((p) => p.path === `/${collection}/${slug}` || p.path.endsWith(`/${slug}`) || p.path === slug), [
2188
+ posts,
2189
+ collection,
2190
+ slug
2191
+ ]);
2192
+ }
2193
+ /**
2194
+ * Returns the recent posts of a collection.
2195
+ * @param collection - The name of the collection.
2196
+ * @param count - The number of recent posts to return.
2197
+ * @returns The recent posts of the collection.
2198
+ */
2199
+ function useRecentPosts(collection, count = 5) {
2200
+ const posts = usePosts(collection);
2201
+ return useMemo(() => posts.slice(0, count), [posts, count]);
2202
+ }
2203
+
2204
+ //#endregion
2205
+ //#region src/client/utils/react-to-text.ts
2206
+ const reactToText = (node, resolvers) => {
2207
+ if (node == null || typeof node === "boolean") return "";
2208
+ if (typeof node === "string" || typeof node === "number") return String(node);
2209
+ if (Array.isArray(node)) return node.map((n) => reactToText(n, resolvers)).join("");
2210
+ if (isValidElement(node)) {
2211
+ const resolver = resolvers?.get(node.type);
2212
+ if (resolver) return resolver(node.props);
2213
+ return reactToText(node.props.children, resolvers);
2214
+ }
2215
+ return "";
2216
+ };
2217
+
2218
+ //#endregion
2219
+ export { Banner, BoltdocsShell, Breadcrumbs, CollectionsContext, CopyMarkdown, DocsLayoutComponent as DocsLayout, ErrorBoundary, MdxPage, Navbar, NotFound, OnThisPage, PageNav, SearchDialog, Sidebar, ViteReactSSG, cn, copyToClipboard, createRoutes, getStarsRepo, getTranslated, reactToText, useAnalytics, useBreadcrumbs, useConfig, useHeadings, useI18n, useLocalizedTo, useLocation, useMdxComponents, useMergedComponents, useNavbar, usePageNav, usePost, usePosts, useRecentPosts, useRoutes, useSearch, useSearchHighlight, useSidebar, useTabs, useTheme, useTrackEvent, useTrackPageView, useUI, useVersion };