boltdocs 2.5.6 → 2.6.1

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 (114) hide show
  1. package/bin/boltdocs.js +2 -2
  2. package/dist/client/index.cjs +6 -0
  3. package/dist/client/{index.d.mts → index.d.cts} +135 -265
  4. package/dist/client/index.d.ts +136 -266
  5. package/dist/client/index.js +1 -1
  6. package/dist/client/theme/neutral.css +90 -50
  7. package/dist/node/cli-entry.cjs +2 -2
  8. package/dist/node/cli-entry.mjs +2 -2
  9. package/dist/node/index.cjs +1 -1
  10. package/dist/node/index.d.cts +168 -205
  11. package/dist/node/index.d.mts +168 -205
  12. package/dist/node/index.mjs +1 -1
  13. package/dist/node-CWN8U_p8.mjs +88 -0
  14. package/dist/node-D5iosYXv.cjs +88 -0
  15. package/dist/{package-OFZf0s2j.mjs → package-DukYeKmD.mjs} +1 -1
  16. package/dist/{package-BY8Jd2j4.cjs → package-c99Cs7mD.cjs} +1 -1
  17. package/dist/search-dialog-3lvKsbVG.js +6 -0
  18. package/dist/search-dialog-DMK5OpgH.cjs +6 -0
  19. package/dist/use-search-C9bxCqfF.js +6 -0
  20. package/dist/use-search-DcfZSunO.cjs +6 -0
  21. package/package.json +21 -23
  22. package/src/client/app/config-context.tsx +38 -5
  23. package/src/client/app/doc-page.tsx +34 -0
  24. package/src/client/app/mdx-component.tsx +2 -3
  25. package/src/client/app/mdx-components-context.tsx +27 -2
  26. package/src/client/app/routes-context.tsx +34 -0
  27. package/src/client/app/scroll-handler.tsx +7 -4
  28. package/src/client/app/theme-context.tsx +71 -67
  29. package/src/client/components/docs-layout.tsx +1 -2
  30. package/src/client/components/icons-dev.tsx +36 -5
  31. package/src/client/components/mdx/admonition.tsx +11 -27
  32. package/src/client/components/mdx/badge.tsx +1 -1
  33. package/src/client/components/mdx/button.tsx +3 -3
  34. package/src/client/components/mdx/card.tsx +1 -1
  35. package/src/client/components/mdx/code-block.tsx +90 -80
  36. package/src/client/components/mdx/component-preview.tsx +1 -5
  37. package/src/client/components/mdx/component-props.tsx +1 -1
  38. package/src/client/components/mdx/field.tsx +4 -5
  39. package/src/client/components/mdx/file-tree.tsx +6 -3
  40. package/src/client/components/mdx/hooks/use-code-block.ts +2 -2
  41. package/src/client/components/mdx/image.tsx +1 -1
  42. package/src/client/components/mdx/link.tsx +2 -2
  43. package/src/client/components/mdx/list.tsx +1 -1
  44. package/src/client/components/mdx/table.tsx +1 -1
  45. package/src/client/components/mdx/tabs.tsx +1 -1
  46. package/src/client/components/primitives/breadcrumbs.tsx +1 -7
  47. package/src/client/components/primitives/button-group.tsx +1 -1
  48. package/src/client/components/primitives/button.tsx +1 -1
  49. package/src/client/components/primitives/code-block.tsx +113 -0
  50. package/src/client/components/primitives/link.tsx +23 -41
  51. package/src/client/components/primitives/menu.tsx +5 -6
  52. package/src/client/components/primitives/navbar.tsx +6 -18
  53. package/src/client/components/primitives/navigation-menu.tsx +4 -4
  54. package/src/client/components/primitives/on-this-page.tsx +6 -10
  55. package/src/client/components/primitives/page-nav.tsx +4 -9
  56. package/src/client/components/primitives/popover.tsx +1 -1
  57. package/src/client/components/primitives/search-dialog.tsx +3 -6
  58. package/src/client/components/primitives/sidebar.tsx +80 -22
  59. package/src/client/components/primitives/skeleton.tsx +1 -1
  60. package/src/client/components/primitives/tabs.tsx +4 -11
  61. package/src/client/components/primitives/tooltip.tsx +3 -3
  62. package/src/client/components/ui-base/breadcrumbs.tsx +4 -6
  63. package/src/client/components/ui-base/copy-markdown.tsx +2 -7
  64. package/src/client/components/ui-base/github-stars.tsx +2 -2
  65. package/src/client/components/ui-base/head.tsx +58 -51
  66. package/src/client/components/ui-base/loading.tsx +2 -2
  67. package/src/client/components/ui-base/navbar.tsx +12 -14
  68. package/src/client/components/ui-base/not-found.tsx +1 -1
  69. package/src/client/components/ui-base/on-this-page.tsx +6 -6
  70. package/src/client/components/ui-base/page-nav.tsx +4 -8
  71. package/src/client/components/ui-base/search-dialog.tsx +10 -8
  72. package/src/client/components/ui-base/sidebar.tsx +76 -23
  73. package/src/client/components/ui-base/tabs.tsx +9 -8
  74. package/src/client/components/ui-base/theme-toggle.tsx +2 -2
  75. package/src/client/hooks/use-i18n.ts +3 -3
  76. package/src/client/hooks/use-localized-to.ts +1 -1
  77. package/src/client/hooks/use-navbar.ts +8 -6
  78. package/src/client/hooks/use-routes.ts +19 -11
  79. package/src/client/hooks/use-search.ts +1 -1
  80. package/src/client/hooks/use-sidebar.ts +48 -2
  81. package/src/client/hooks/use-tabs.ts +6 -2
  82. package/src/client/hooks/use-version.ts +3 -3
  83. package/src/client/index.ts +20 -22
  84. package/src/client/ssg/boltdocs-shell.tsx +127 -0
  85. package/src/client/ssg/create-routes.tsx +179 -0
  86. package/src/client/ssg/index.ts +3 -0
  87. package/src/client/ssg/mdx-page.tsx +37 -0
  88. package/src/client/store/boltdocs-context.tsx +46 -99
  89. package/src/client/theme/neutral.css +90 -50
  90. package/src/client/types.ts +5 -33
  91. package/src/client/utils/react-to-text.ts +34 -0
  92. package/src/shared/config-utils.ts +12 -0
  93. package/src/shared/types.ts +171 -0
  94. package/dist/cache-Cr8W2zgZ.cjs +0 -6
  95. package/dist/cache-DFdakSmR.mjs +0 -6
  96. package/dist/client/index.mjs +0 -6
  97. package/dist/client/ssr.cjs +0 -6
  98. package/dist/client/ssr.d.cts +0 -80
  99. package/dist/client/ssr.d.mts +0 -80
  100. package/dist/client/ssr.mjs +0 -6
  101. package/dist/node-CWXme96p.mjs +0 -73
  102. package/dist/node-VYfhzGrh.cjs +0 -73
  103. package/dist/search-dialog-BeNyI_KQ.mjs +0 -6
  104. package/dist/search-dialog-dYsCAk5S.js +0 -6
  105. package/dist/use-search-D25n0PrV.mjs +0 -6
  106. package/dist/use-search-WuzdH1cJ.js +0 -6
  107. package/src/client/app/index.tsx +0 -348
  108. package/src/client/app/mdx-page.tsx +0 -15
  109. package/src/client/app/preload.tsx +0 -66
  110. package/src/client/app/router.tsx +0 -30
  111. package/src/client/components/default-layout.tsx +0 -90
  112. package/src/client/integrations/codesandbox.ts +0 -179
  113. package/src/client/integrations/index.ts +0 -1
  114. package/src/client/ssr.tsx +0 -65
@@ -1,80 +0,0 @@
1
-
2
- import React from "react";
3
- //#region src/client/types.d.ts
4
- /**
5
- * Metadata provided by the server for a specific route.
6
- * Maps closely to the `RouteMeta` type in the Node environment.
7
- */
8
- interface ComponentRoute {
9
- /** The final URL path */
10
- path: string;
11
- /** The absolute filesystem path of the source file */
12
- componentPath: string;
13
- /** The page title */
14
- title: string;
15
- /** Explicit order in the sidebar */
16
- sidebarPosition?: number;
17
- /** The relative path from the docs directory */
18
- filePath: string;
19
- /** The group directory name */
20
- group?: string;
21
- /** The display title of the group */
22
- groupTitle?: string;
23
- /** Explicit order of the group in the sidebar */
24
- groupPosition?: number;
25
- /** Extracted markdown headings for search indexing */
26
- headings?: {
27
- level: number;
28
- text: string;
29
- id: string;
30
- }[];
31
- /** The page summary or description */
32
- description?: string;
33
- /** The locale this route belongs to, if i18n is configured */
34
- locale?: string;
35
- /** The version this route belongs to, if versioning is configured */
36
- version?: string;
37
- /** Optional icon to display (Lucide icon name or raw SVG) */
38
- icon?: string;
39
- /** The tab this route belongs to, if tabs are configured */
40
- tab?: string;
41
- /** Optional badge to display next to the sidebar item */
42
- badge?: string | {
43
- text: 'updated' | 'new' | 'deprecated';
44
- expires?: string;
45
- };
46
- /** Optional icon for the route's group */
47
- groupIcon?: string;
48
- /** The extracted plain-text content of the page for search indexing */
49
- _content?: string;
50
- /** The raw markdown content of the page */
51
- _rawContent?: string;
52
- }
53
- //#endregion
54
- //#region src/client/ssr.d.ts
55
- /**
56
- * Options for rendering the Boltdocs application on the server (SSG).
57
- */
58
- interface RenderOptions {
59
- /** The URL path currently being rendered */
60
- path: string;
61
- /** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
62
- routes: ComponentRoute[];
63
- /** Site configuration (`virtual:boltdocs-config`) */
64
- config: any;
65
- /** The name of the documentation directory (e.g. 'docs') */
66
- docsDirName: string;
67
- /** Optional custom React component to render when visiting the root path ('/') */
68
- homePage?: React.ComponentType;
69
- /** Custom external pages mapped by their route path */
70
- externalPages?: Record<string, React.ComponentType<any>>;
71
- /** Preloaded modules (since SSR cannot use dynamic imports easily) */
72
- modules: Record<string, any>;
73
- }
74
- /**
75
- * Renders the full React application into an HTML string for a specific route.
76
- * This is called by the Node SSG script during the Vite build process.
77
- */
78
- declare function render(options: RenderOptions): Promise<string>;
79
- //#endregion
80
- export { RenderOptions, render };
@@ -1,80 +0,0 @@
1
-
2
- import React from "react";
3
- //#region src/client/types.d.ts
4
- /**
5
- * Metadata provided by the server for a specific route.
6
- * Maps closely to the `RouteMeta` type in the Node environment.
7
- */
8
- interface ComponentRoute {
9
- /** The final URL path */
10
- path: string;
11
- /** The absolute filesystem path of the source file */
12
- componentPath: string;
13
- /** The page title */
14
- title: string;
15
- /** Explicit order in the sidebar */
16
- sidebarPosition?: number;
17
- /** The relative path from the docs directory */
18
- filePath: string;
19
- /** The group directory name */
20
- group?: string;
21
- /** The display title of the group */
22
- groupTitle?: string;
23
- /** Explicit order of the group in the sidebar */
24
- groupPosition?: number;
25
- /** Extracted markdown headings for search indexing */
26
- headings?: {
27
- level: number;
28
- text: string;
29
- id: string;
30
- }[];
31
- /** The page summary or description */
32
- description?: string;
33
- /** The locale this route belongs to, if i18n is configured */
34
- locale?: string;
35
- /** The version this route belongs to, if versioning is configured */
36
- version?: string;
37
- /** Optional icon to display (Lucide icon name or raw SVG) */
38
- icon?: string;
39
- /** The tab this route belongs to, if tabs are configured */
40
- tab?: string;
41
- /** Optional badge to display next to the sidebar item */
42
- badge?: string | {
43
- text: 'updated' | 'new' | 'deprecated';
44
- expires?: string;
45
- };
46
- /** Optional icon for the route's group */
47
- groupIcon?: string;
48
- /** The extracted plain-text content of the page for search indexing */
49
- _content?: string;
50
- /** The raw markdown content of the page */
51
- _rawContent?: string;
52
- }
53
- //#endregion
54
- //#region src/client/ssr.d.ts
55
- /**
56
- * Options for rendering the Boltdocs application on the server (SSG).
57
- */
58
- interface RenderOptions {
59
- /** The URL path currently being rendered */
60
- path: string;
61
- /** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
62
- routes: ComponentRoute[];
63
- /** Site configuration (`virtual:boltdocs-config`) */
64
- config: any;
65
- /** The name of the documentation directory (e.g. 'docs') */
66
- docsDirName: string;
67
- /** Optional custom React component to render when visiting the root path ('/') */
68
- homePage?: React.ComponentType;
69
- /** Custom external pages mapped by their route path */
70
- externalPages?: Record<string, React.ComponentType<any>>;
71
- /** Preloaded modules (since SSR cannot use dynamic imports easily) */
72
- modules: Record<string, any>;
73
- }
74
- /**
75
- * Renders the full React application into an HTML string for a specific route.
76
- * This is called by the Node SSG script during the Vite build process.
77
- */
78
- declare function render(options: RenderOptions): Promise<string>;
79
- //#endregion
80
- export { RenderOptions, render };
@@ -1,6 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- import e,{Children as t,createContext as n,isValidElement as r,startTransition as i,use as a,useCallback as o,useContext as s,useEffect as c,useLayoutEffect as l,useMemo as u,useRef as d,useState as f}from"react";import p from"react-dom/server";import{StaticRouter as m}from"react-router-dom/server.js";import"react-dom/client";import{Outlet as h,Route as g,Routes as _,useHref as v,useLocation as y,useNavigate as b}from"react-router-dom";import{AlertTriangle as ee,ArrowLeft as x,Bookmark as te,Check as S,ChevronDown as C,ChevronLeft as ne,ChevronRight as w,ChevronUp as re,ChevronsLeft as ie,ChevronsRight as ae,Circle as oe,Copy as T,Dot as se,ExternalLink as ce,File as le,FileCode as ue,FileImage as de,FileText as fe,Flame as pe,Folder as me,Info as he,Lightbulb as ge,Link as _e,ShieldAlert as ve,Zap as ye}from"lucide-react";import*as E from"react-aria-components";import{Link as be,RouterProvider as xe}from"react-aria-components";import{Fragment as D,jsx as O,jsxs as k}from"react/jsx-runtime";import{clsx as Se}from"clsx";import{twMerge as Ce}from"tailwind-merge";import A from"virtual:boltdocs-layout";import{cva as j}from"class-variance-authority";import we from"virtual:boltdocs-mdx-components";var Te=Object.defineProperty,Ee=(e,t)=>{let n={};for(var r in e)Te(n,r,{get:e[r],enumerable:!0});return t||Te(n,Symbol.toStringTag,{value:`Module`}),n};const De=n(null);function M(){let e=a(De);if(!e)throw Error(`useConfig must be used within a ConfigProvider`);return e}const Oe=n({preload:()=>{},routes:[]});function ke(){return a(Oe)}function Ae({routes:e,modules:t,children:n}){let r=d(null),i=o(n=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{let r=n.split(`#`)[0].split(`?`)[0],i=e.find(e=>e.path===r||r===`/`&&e.path===``);if(i?.filePath){let e=Object.keys(t).find(e=>e.endsWith(`/`+i.filePath));e&&t[e]().catch(e=>{console.error(`[boltdocs] Failed to preload route ${n}:`,e)})}},100)},[e,t]);return O(Oe.Provider,{value:{preload:i,routes:e},children:n})}const je=n(void 0),Me=`boltdocs-storage`;function Ne(){try{let e=localStorage.getItem(Me);if(e){let t=JSON.parse(e);return t?.state||t}}catch{}return{}}function Pe({children:e}){let t=Ne(),[n,r]=f(t.currentLocale),[i,a]=f(t.currentVersion),[s,l]=f(!1);c(()=>{l(!0)},[]),c(()=>{if(s){let e={currentLocale:n,currentVersion:i};try{localStorage.setItem(Me,JSON.stringify({state:e}))}catch{}}},[n,i,s]);let u={currentLocale:n,currentVersion:i,hasHydrated:s,setLocale:o(e=>{r(e)},[]),setVersion:o(e=>{a(e)},[]),setHasHydrated:o(e=>{l(e)},[])};return O(je.Provider,{value:u,children:e})}function Fe(){let e=s(je);if(!e)throw Error(`useBoltdocsContext must be used within a BoltdocsProvider`);return e}function N(e){return e(Fe())}function P(){let{routes:e}=ke(),t=M(),n=y(),r=N(e=>e.currentLocale),i=N(e=>e.currentVersion),a=N(e=>e.hasHydrated),o=e.find(e=>e.path===n.pathname),s=t.i18n?o?.locale||(a?r:void 0)||t.i18n.defaultLocale:void 0,c=t.versions?o?.version||(a?i:void 0)||t.versions.defaultVersion:void 0,l=e.filter(n=>{let r=t.i18n?(n.locale||t.i18n.defaultLocale)===s:!0,i=t.versions?(n.version||t.versions.defaultVersion)===c:!0;if(!(r&&i))return!1;let a=t.i18n;if(a){let t=!!o?.locale,r=!!n.locale;if(e.some(e=>e!==n&&e.filePath===n.filePath&&e.version===n.version&&(e.locale||a.defaultLocale)===(n.locale||a.defaultLocale))&&t!==r)return!1}return!0}),u=t.i18n?.localeConfigs?.[s]?.label||t.i18n?.locales[s]||s,d=t.versions?.versions.find(e=>e.path===c)?.label||c;return{routes:l,allRoutes:e,currentRoute:o,currentLocale:s,currentLocaleLabel:u,availableLocales:t.i18n?Object.entries(t.i18n.locales).map(([e,n])=>({key:e,label:t.i18n?.localeConfigs?.[e]?.label||n,isCurrent:e===s})):[],currentVersion:c,currentVersionLabel:d,availableVersions:t.versions?t.versions.versions.map(e=>({key:e.path,label:e.label,isCurrent:e.path===c})):[],config:t}}function Ie(e){let t=M(),{currentLocale:n,currentVersion:r}=P();if(!t||typeof e!=`string`||e.startsWith(`http`)||e.startsWith(`//`))return e;let i=t.i18n,a=t.versions;if(!i&&!a)return e;let o=e.startsWith(`/docs`),s=e.split(`/`).filter(Boolean),c=0;s[c]===`docs`&&c++,a&&s.length>c&&a.versions.find(e=>e.path===s[c])&&c++,i&&s.length>c&&i.locales[s[c]]&&c++;let l=s.slice(c),u=[];o&&(u.push(`docs`),a&&r&&u.push(r)),i&&n&&n!==i.defaultLocale&&u.push(n),u.push(...l);let d=`/${u.join(`/`)}`;return d.length>1&&d.endsWith(`/`)?d.slice(0,-1):d||`/`}function F(...e){return Ce(Se(e))}const I=e.forwardRef((e,t)=>{let{href:n,prefetch:r=`hover`,onMouseEnter:i,onFocus:a,...o}=e,s=Ie(n??``),{preload:c}=ke(),l=e=>{i?.(e),r===`hover`&&typeof s==`string`&&s.startsWith(`/`)&&c(s)},u=e=>{a?.(e),r===`hover`&&typeof s==`string`&&s.startsWith(`/`)&&c(s)};return O(be,{...o,ref:t,href:s,onMouseEnter:l,onFocus:u})});I.displayName=`Link`;const Le=e.forwardRef((e,t)=>{let{href:n,end:r=!1,className:i,children:a,...o}=e,s=y(),c=Ie(n??``),l=r?s.pathname===c:s.pathname.startsWith(c),u=typeof i==`function`?i({isActive:l}):F(i,l&&`active`),d=typeof a==`function`?a({isActive:l}):a;return O(I,{...o,ref:t,href:n,className:u,children:d})});Le.displayName=`NavLink`;function Re(){return O(`div`,{className:`flex items-center justify-center min-h-[60vh] text-center`,children:k(`div`,{className:`space-y-4`,children:[O(`span`,{className:`text-8xl font-black tracking-tighter text-primary-500/20`,children:`404`}),O(`h1`,{className:`text-2xl font-bold text-text-main`,children:`Page Not Found`}),O(`p`,{className:`text-sm text-text-muted max-w-sm mx-auto`,children:`The page you're looking for doesn't exist or has been moved.`}),k(I,{href:`/`,className:`inline-flex items-center gap-2 rounded-lg bg-primary-500 px-5 py-2.5 text-sm font-semibold text-white outline-none transition-all hover:brightness-110 hover:shadow-lg focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[O(x,{size:16}),` Go to Home`]})]})})}const ze=n(void 0);function Be({children:e}){let[t,n]=f(`system`),[r,i]=f(`dark`),[a,o]=f(!1);return c(()=>{o(!0);let e=localStorage.getItem(`boltdocs-theme`),t=e===`light`||e===`dark`||e===`system`?e:`system`;n(t);let r=window.matchMedia(`(prefers-color-scheme: dark)`);((e,t)=>{i(e===`system`?t?`dark`:`light`:e)})(t,r.matches);let a=e=>{i(t=>(localStorage.getItem(`boltdocs-theme`)||`system`)===`system`?e.matches?`dark`:`light`:t)};return r.addEventListener(`change`,a),()=>r.removeEventListener(`change`,a)},[]),c(()=>{if(!a)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`).matches,n=t===`system`?e?`dark`:`light`:t;i(n);let r=document.documentElement;n===`light`?(r.classList.add(`theme-light`),r.dataset.theme=`light`):(r.classList.remove(`theme-light`),r.dataset.theme=`dark`)},[t,a]),O(ze.Provider,{value:{theme:t,resolvedTheme:r,setTheme:e=>{n(e),localStorage.setItem(`boltdocs-theme`,e)}},children:e})}function Ve(){let e=a(ze);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e}function He({children:e}){let t=b();return O(xe,{navigate:(e,n)=>{i(()=>{t(e,n)})},useHref:v,children:e})}function Ue(){let{pathname:e,hash:t}=y();return l(()=>{let e=document.querySelector(`.boltdocs-content`)||window,n=()=>e===window?window.scrollY:e.scrollTop,r=(t,n=`auto`)=>{e===window?window.scrollTo({top:t,behavior:n}):e.scrollTo({top:t,behavior:n})};if(t){let i=t.replace(`#`,``),a=document.getElementById(i);if(a){let t=e===window?0:e.getBoundingClientRect().top;r(a.getBoundingClientRect().top-t-80+n(),`smooth`);return}}r(0)},[e,t]),null}function We(){return O(A,{children:O(h,{})})}const Ge=n({});function Ke(){return a(Ge)}function qe({components:e,children:t}){return O(Ge.Provider,{value:e,children:t})}function Je({Component:e}){return O(e,{components:Ke()})}const L=j(`flex flex-row items-center justify-center w-auto font-semibold tracking-tight no-underline whitespace-nowrap select-none outline-none transition-all duration-200 cursor-pointer pressed:scale-[0.97] hover:-translate-y-px leading-none`,{variants:{variant:{primary:`bg-primary-500 text-white shadow-md hover:brightness-110 hover:shadow-lg`,secondary:`bg-bg-surface text-text-main border border-border-subtle hover:bg-bg-muted hover:border-border-strong`,outline:`bg-transparent text-text-main border border-border-strong hover:bg-bg-surface hover:border-primary-500`,ghost:`bg-transparent text-text-muted hover:bg-bg-surface hover:text-text-main`,danger:`bg-[var(--color-danger-500)]/10 text-[var(--color-danger-500)] border border-[var(--color-danger-500)]/20 hover:bg-[var(--color-danger-500)]/15`,success:`bg-[var(--color-success-500)]/10 text-[var(--color-success-500)] border border-[var(--color-success-500)]/20 hover:bg-[var(--color-success-500)]/15`,warning:`bg-[var(--color-warning-500)]/10 text-[var(--color-warning-500)] border border-[var(--color-warning-500)]/20 hover:bg-[var(--color-warning-500)]/15`,info:`bg-[var(--color-info-500)]/10 text-[var(--color-info-500)] border border-[var(--color-info-500)]/20 hover:bg-[var(--color-info-500)]/15`,subtle:`bg-primary-500/10 text-primary-500 hover:bg-primary-500/20`,link:`bg-transparent text-primary-500 !p-0 !min-h-0 hover:underline`},size:{sm:`min-h-8 px-3.5 text-[0.8125rem] gap-1.5`,md:`min-h-10 px-5 text-[0.9375rem] gap-2`,lg:`min-h-12 px-7 text-[1.05rem] gap-2.5`},rounded:{none:`rounded-none`,sm:`rounded-sm`,md:`rounded-md`,lg:`rounded-lg`,full:`rounded-full`},iconSize:{sm:`w-8 h-8 p-0`,md:`w-10 h-10 p-0`,lg:`w-12 h-12 p-0`},disabled:{true:`opacity-50 cursor-not-allowed pointer-events-none`,false:null}},defaultVariants:{variant:`primary`,size:`md`,rounded:`md`}}),R=({href:e,icon:t,iconPosition:n=`left`,isIconOnly:r,children:i,className:a,variant:o,size:s,rounded:c,iconSize:l,disabled:u,...d})=>{let f=r||!i&&!!t,p=f?O(`span`,{className:`inline-flex items-center justify-center [&>svg]:w-[1.2rem] [&>svg]:h-[1.2rem]`,children:t}):k(D,{children:[t&&n===`left`&&O(`span`,{className:`inline-flex items-center shrink-0 [&>svg]:w-[1.1rem] [&>svg]:h-[1.1rem]`,children:t}),O(`span`,{className:`flex items-center`,children:i}),t&&n===`right`&&O(`span`,{className:`inline-flex items-center shrink-0 [&>svg]:w-[1.1rem] [&>svg]:h-[1.1rem]`,children:t})]});return e?O(E.Link,{href:e,className:F(L({variant:o,size:s,rounded:c,iconSize:f?l:void 0,disabled:u}),a),...d,children:p}):O(E.Button,{className:F(L({variant:o,size:s,rounded:c,iconSize:f?l:void 0,disabled:u}),a),...d,children:p})},Ye=({className:e,variant:t,size:n,rounded:r,iconSize:i,disabled:a,...o})=>O(R,{className:F(`group`,L({variant:t,size:n,rounded:r,iconSize:i,disabled:a,className:e})),...o}),Xe=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);return t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),!0}};function Ze(e){let{title:t}=e,[n,r]=f(!1),[i,a]=f(!1),[s,l]=f(!1),u=d(null);M();let p=o(async()=>{Xe(u.current?.textContent??``),r(!0),setTimeout(()=>r(!1),2e3)},[]);return c(()=>{l((u.current?.textContent?.length??0)>120)},[e.children,e.highlightedHtml]),{copied:n,isExpanded:i,setIsExpanded:a,isExpandable:s,preRef:u,handleCopy:p,shouldTruncate:s&&!i}}function z(e){let{size:t=20,...n}=e;return{...n,width:t,height:t}}const Qe=e=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...z(e),children:[O(`title`,{children:`TypeScript`}),O(`path`,{fill:`#2563EB`,d:`M3.234 9.093V7.318h8.363v1.775H8.479V17.5H6.352V9.093H3.234zm15.263 1.153c-.04-.4-.21-.712-.512-.934-.301-.222-.71-.333-1.228-.333-.351 0-.648.05-.89.149-.242.096-.427.23-.557.403a.969.969 0 0 0-.189.586.838.838 0 0 0 .115.477c.086.136.204.254.353.353.149.097.321.181.517.254.195.07.404.13.626.179l.915.219c.444.1.852.232 1.223.397.371.166.693.37.965.612.271.242.482.527.631.855.152.328.23.704.234 1.129-.004.623-.163 1.163-.478 1.62-.311.454-.762.807-1.352 1.06-.587.248-1.294.372-2.123.372-.822 0-1.538-.126-2.147-.378-.607-.252-1.081-.624-1.422-1.118-.338-.497-.516-1.112-.532-1.845h2.083c.023.342.12.627.293.855.176.226.41.397.701.513a2.8 2.8 0 0 0 1 .168c.364 0 .68-.053.949-.159a1.45 1.45 0 0 0 .631-.442c.15-.189.224-.406.224-.651a.846.846 0 0 0-.204-.577c-.132-.156-.328-.288-.586-.398a5.964 5.964 0 0 0-.94-.298l-1.109-.278c-.858-.21-1.536-.536-2.033-.98-.497-.444-.744-1.042-.74-1.795-.004-.616.16-1.155.491-1.615.335-.461.794-.82 1.377-1.08.584-.258 1.247-.387 1.99-.387.755 0 1.414.13 1.978.388.567.258 1.007.618 1.322 1.079.315.46.477.994.488 1.6h-2.064z`})]}),$e=e=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...z(e),children:[O(`title`,{children:`JavaScript`}),O(`path`,{fill:`#F59E0B`,d:`M8.383 7.318h2.127v7.1c0 .656-.147 1.226-.442 1.71a2.924 2.924 0 01-1.218 1.118c-.52.262-1.125.393-1.815.393-.613 0-1.17-.107-1.67-.323a2.67 2.67 0 01-1.183-.994c-.292-.448-.436-1.01-.433-1.686h2.143c.006.269.061.5.164.691.106.19.25.335.432.438.186.1.405.15.657.15.265 0 .488-.057.67-.17.186-.116.327-.285.423-.507.096-.222.145-.496.145-.82v-7.1zm9.43 2.928c-.04-.4-.21-.712-.511-.934-.302-.222-.711-.333-1.228-.333-.352 0-.648.05-.89.149-.242.096-.428.23-.557.403a.969.969 0 00-.19.586.838.838 0 00.115.477c.087.136.204.254.353.353.15.097.322.181.517.254.196.07.405.13.627.179l.915.219c.444.1.851.232 1.223.397.37.166.692.37.964.612s.482.527.631.855a2.7 2.7 0 01.234 1.129c-.003.623-.162 1.163-.477 1.62-.312.454-.763.807-1.353 1.06-.586.248-1.294.372-2.122.372-.822 0-1.538-.126-2.148-.378-.607-.252-1.08-.624-1.422-1.118-.338-.497-.515-1.112-.532-1.845h2.083c.023.342.121.627.293.855.176.226.41.397.702.513.295.112.628.168.999.168.364 0 .68-.053.95-.159.271-.106.482-.253.63-.442.15-.189.224-.406.224-.651a.846.846 0 00-.203-.577c-.133-.156-.329-.288-.587-.398a5.964 5.964 0 00-.94-.298l-1.108-.278c-.859-.21-1.537-.536-2.034-.98-.497-.444-.744-1.042-.74-1.795-.004-.616.16-1.155.492-1.615.334-.461.793-.82 1.377-1.08.583-.258 1.246-.387 1.989-.387.755 0 1.415.13 1.978.388.567.258 1.008.618 1.323 1.079.314.46.477.994.487 1.6h-2.063z`})]}),et=e=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...z(e),children:[O(`title`,{children:`JSON`}),O(`path`,{fill:`#F59E0B`,d:`M4.778 6.667A2.667 2.667 0 017.444 4a.889.889 0 010 1.778.889.889 0 00-.888.889v3.5c0 .701-.273 1.35-.73 1.833.457.483.73 1.132.73 1.832v3.501c0 .491.398.89.888.89a.889.889 0 010 1.777 2.667 2.667 0 01-2.666-2.667v-3.5a.889.889 0 00-.674-.863l-.43-.108a.889.889 0 010-1.724l.43-.108a.889.889 0 00.674-.862V6.667zm14.222 0A2.667 2.667 0 0016.333 4a.889.889 0 000 1.778c.491 0 .89.398.89.889v3.5c0 .701.272 1.35.729 1.833a2.664 2.664 0 00-.73 1.832v3.501a.889.889 0 01-.889.89.889.889 0 000 1.777A2.667 2.667 0 0019 17.333v-3.5c0-.408.278-.764.673-.863l.431-.108a.889.889 0 000-1.724l-.43-.108a.889.889 0 01-.674-.862V6.667z`})]}),tt=e=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...z(e),children:[O(`title`,{children:`CSS`}),O(`path`,{fill:`#0EA5E9`,d:`M4.778 6.667A2.667 2.667 0 017.444 4a.889.889 0 010 1.778.889.889 0 00-.888.889v3.5c0 .701-.273 1.35-.73 1.833.457.483.73 1.132.73 1.832v3.501c0 .491.398.89.888.89a.889.889 0 010 1.777 2.667 2.667 0 01-2.666-2.667v-3.5a.889.889 0 00-.674-.863l-.43-.108a.889.889 0 010-1.724l.43-.108a.889.889 0 00.674-.862V6.667zm14.222 0A2.667 2.667 0 0016.333 4a.889.889 0 000 1.778c.491 0 .89.398.89.889v3.5c0 .701.272 1.35.729 1.833a2.664 2.664 0 00-.73 1.832v3.501a.889.889 0 01-.889.89.889.889 0 000 1.777A2.667 2.667 0 0019 17.333v-3.5c0-.408.278-.764.673-.863l.431-.108a.889.889 0 000-1.724l-.43-.108a.889.889 0 01-.674-.862V6.667z`})]}),nt=e=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...z(e),children:[O(`title`,{children:`HTML`}),O(`path`,{fill:`#EA580C`,d:`M4.778 6.667A2.667 2.667 0 017.444 4a.889.889 0 010 1.778.889.889 0 00-.888.889v3.5c0 .701-.273 1.35-.73 1.833.457.483.73 1.132.73 1.832v3.501c0 .491.398.89.888.89a.889.889 0 010 1.777 2.667 2.667 0 01-2.666-2.667v-3.5a.889.889 0 00-.674-.863l-.43-.108a.889.889 0 010-1.724l.43-.108a.889.889 0 00.674-.862V6.667zm14.222 0A2.667 2.667 0 0016.333 4a.889.889 0 000 1.778c.491 0 .89.398.89.889v3.5c0 .701.272 1.35.729 1.833a2.664 2.664 0 00-.73 1.832v3.501a.889.889 0 01-.889.89.889.889 0 000 1.777A2.667 2.667 0 0019 17.333v-3.5c0-.408.278-.764.673-.863l.431-.108a.889.889 0 000-1.724l-.43-.108a.889.889 0 01-.674-.862V6.667z`})]}),B=e=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...z(e),children:[O(`title`,{children:`React`}),O(`path`,{fill:`#0E8ADC`,d:`M12 13.677a1.677 1.677 0 100-3.354 1.677 1.677 0 000 3.354z`}),O(`path`,{stroke:`#0E8ADC`,d:`M12 15.436c4.97 0 9-1.538 9-3.436s-4.03-3.436-9-3.436S3 10.102 3 12s4.03 3.436 9 3.436z`}),O(`path`,{stroke:`#0E8ADC`,d:`M9.024 13.718c2.485 4.305 5.832 7.025 7.476 6.076 1.644-.949.961-5.208-1.524-9.512C12.491 5.977 9.144 3.257 7.5 4.206c-1.644.949-.961 5.208 1.524 9.512z`}),O(`path`,{stroke:`#0E8ADC`,d:`M9.024 10.282c-2.485 4.304-3.168 8.563-1.524 9.512 1.644.95 4.99-1.771 7.476-6.076 2.485-4.304 3.168-8.563 1.524-9.512-1.644-.95-4.99 1.771-7.476 6.076z`})]}),V=e=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...z(e),children:[O(`title`,{children:`Markdown`}),O(`path`,{fill:`#60A5FA`,d:`M3 15.714V8h2.323l2.322 2.836L9.968 8h2.322v7.714H9.968V11.29l-2.323 2.836-2.322-2.836v4.424H3zm14.516 0l-3.484-3.743h2.323V8h2.322v3.97H21l-3.484 3.744z`})]}),H=e=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 25 24`,...z(e),children:[O(`title`,{children:`Shell`}),O(`path`,{stroke:`#14B8A6`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M4.336 17l6-6-6-6M12.336 19h8`})]}),U=e=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...z(e),children:[O(`title`,{children:`YAML`}),O(`path`,{fill:`#A78BFA`,d:`M6.533 5.864h2.755l2.654 5.011h.113l2.654-5.011h2.756l-4.245 7.522V17.5h-2.443v-4.114L6.533 5.864z`})]}),rt=({className:e,children:t,...n})=>O(E.Tooltip,{...n,offset:8,className:t=>F(`group z-50 overflow-visible rounded-md bg-bg-surface/90 px-2.5 py-1.5 text-xs font-medium text-text-main shadow-lg backdrop-blur-md ring-1 ring-border-subtle outline-hidden select-none`,`data-entering:animate-in data-entering:fade-in data-entering:zoom-in-95 data-entering:duration-100`,`data-exiting:animate-out data-exiting:fade-out data-exiting:zoom-out-95 data-exiting:duration-75`,`data-[placement=top]:slide-in-from-bottom-1`,`data-[placement=bottom]:slide-in-from-top-1`,`data-[placement=left]:slide-in-from-right-1`,`data-[placement=right]:slide-in-from-left-1`,typeof e==`function`?e(t):e),children:e=>k(D,{children:[O(E.OverlayArrow,{children:k(`svg`,{width:8,height:8,viewBox:`0 0 8 8`,className:`fill-bg-surface/90 stroke-border-subtle group-data-[placement=bottom]:rotate-180 group-data-[placement=left]:-rotate-90 group-data-[placement=right]:rotate-90`,children:[O(`title`,{children:`Arrow`}),O(`path`,{d:`M0 0 L4 4 L8 0`})]})}),typeof t==`function`?t(e):t]})}),W=({content:e,children:t,delay:n=500,closeDelay:r=0,...i})=>k(E.TooltipTrigger,{delay:n,closeDelay:r,children:[t,O(rt,{...i,children:e})]});W.Root=W,W.Content=rt;const it={ts:Qe,tsx:B,js:$e,jsx:B,json:et,css:tt,html:nt,md:V,mdx:V,bash:H,sh:H,yaml:U,yml:U};function G(e){let{children:t,hideCopy:n=!1,highlightedHtml:r,"data-highlighted-html":i,title:a,"data-lang":o,plain:s=!1,...c}=e,l=r||i;M();let u=e.lang||o||``,{copied:d,isExpanded:f,setIsExpanded:p,isExpandable:m,preRef:h,handleCopy:g,shouldTruncate:_}=Ze(e),v=it[u];return k(`div`,{className:F(`group relative overflow-hidden bg-(--color-code-bg)`,`contain-layout contain-paint`,{"my-6 rounded-lg border border-border-subtle":!s,"[&>pre]:max-h-62.5 [&>pre]:overflow-hidden":_},e.className),children:[a&&k(`div`,{className:`flex items-center gap-2 border-b border-border-subtle bg-bg-surface/50 px-4 py-2 text-[13px] font-medium text-text-muted`,children:[v?O(v,{size:14}):O(le,{size:14,className:`opacity-60`}),O(`span`,{children:a})]}),O(`div`,{className:`absolute top-3 right-4 z-50 flex items-center gap-2 transition-all duration-300 opacity-0 group-hover:opacity-100`,children:!n&&O(W,{content:d?`Copied!`:`Copy code`,children:O(E.Button,{onPress:g,className:F(`grid place-items-center size-8 bg-transparent outline-none cursor-pointer transition-all duration-200 hover:scale-110 active:scale-95 [&>svg]:size-4 [&>svg]:stroke-2`,d?`text-emerald-400`:`text-text-muted hover:text-text-main`),"aria-label":`Copy code`,children:O(d?S:T,{size:20})})})}),l?O(`div`,{ref:h,className:`shiki-wrapper [&>pre]:m-0! [&>pre]:rounded-none! [&>pre]:border-none! [&>pre]:bg-inherit! [&>pre>code]:grid! [&>pre>code]:p-5! [&>.shiki.shiki-themes]:bg-transparent!`,dangerouslySetInnerHTML:{__html:l}}):O(`pre`,{ref:h,className:`m-0! rounded-none! border-none! bg-inherit! font-mono text-[0.8125rem] leading-[1.7]`,...c,children:t}),m&&O(`div`,{className:F(_?`absolute bottom-0 inset-x-0 h-24 bg-linear-to-t from-(--color-code-bg) to-transparent flex items-end justify-center pb-4 z-10`:`relative flex justify-center py-4`),children:O(E.Button,{onPress:()=>p(!f),className:`rounded-full bg-bg-surface border border-border-subtle px-5 py-2 text-[0.8125rem] font-medium text-text-main outline-none cursor-pointer transition-all hover:bg-border-subtle hover:-translate-y-px backdrop-blur-md`,children:f?`Show less`:`Expand code`})})]})}function at({initialIndex:e=0,tabs:t}){let n=t[e]?.props.disabled?t.findIndex(e=>!e.props.disabled):e,[r,i]=f(n===-1?0:n),a=d([]),[s,l]=f({opacity:0,transform:`translateX(0)`,width:0});return c(()=>{let e=a.current[r];e&&l({opacity:1,width:e.offsetWidth,transform:`translateX(${e.offsetLeft}px)`})},[r,t]),{active:r,setActive:i,tabRefs:a,indicatorStyle:s,handleKeyDown:o(e=>{let n=0;if(e.key===`ArrowRight`?n=1:e.key===`ArrowLeft`&&(n=-1),n!==0){let e=(r+n+t.length)%t.length;for(;t[e].props.disabled&&e!==r;)e=(e+n+t.length)%t.length;e!==r&&!t[e].props.disabled&&(i(e),a.current[e]?.focus())}},[r,t])}}const ot=j(`relative flex items-center border-b border-border-subtle gap-1 overflow-x-auto no-scrollbar`,{variants:{size:{default:`px-0`,compact:`px-2`}},defaultVariants:{size:`default`}}),st=j(`flex items-center gap-2 px-4 py-2.5 text-sm font-medium outline-none transition-all duration-200 cursor-pointer bg-transparent border-none select-none whitespace-nowrap`,{variants:{isActive:{true:`text-primary-500`,false:`text-text-muted hover:text-text-main`},isDisabled:{true:`opacity-40 pointer-events-none`,false:``}},defaultVariants:{isActive:!1,isDisabled:!1}});function ct({children:e}){return O(`div`,{className:`py-4`,children:typeof e==`string`?O(G,{className:`language-bash`,children:O(`code`,{children:e.trim()})}):e})}function lt({defaultIndex:e=0,children:n}){let i=u(()=>t.toArray(n).filter(e=>r(e)&&e.props?.label),[n]),{active:a,setActive:o,tabRefs:s,indicatorStyle:c}=at({initialIndex:e,tabs:i});return O(`div`,{className:`my-8 w-full group/tabs`,children:k(E.Tabs,{selectedKey:a.toString(),onSelectionChange:e=>o(Number(e)),className:`w-full`,children:[k(E.TabList,{"aria-label":`Content Tabs`,className:F(ot()),children:[i.map((e,t)=>{let{label:n,icon:r,disabled:i}=e.props,a=t.toString();return k(E.Tab,{id:a,isDisabled:i,ref:e=>{s.current[t]=e},className:({isSelected:e,isDisabled:t})=>F(st({isActive:e,isDisabled:t})),children:[!!r&&O(`span`,{className:`shrink-0 [&>svg]:w-4 [&>svg]:h-4`,children:r}),O(`span`,{children:n})]},a)}),O(`div`,{className:`absolute bottom-0 h-0.5 bg-primary-500 transition-all duration-300 ease-in-out pointer-events-none`,style:c,"aria-hidden":`true`})]}),i.map((e,t)=>O(E.TabPanel,{id:t.toString(),children:i[t]},t))]})})}function ut({src:e,poster:t,alt:n,children:r,controls:i,preload:a=`metadata`,...o}){let s=d(null),[l,u]=f(!1);return c(()=>{let e=s.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e.isIntersecting&&(u(!0),t.disconnect())},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[]),O(`div`,{ref:s,className:`my-6 overflow-hidden rounded-lg border border-border-subtle`,children:l?k(`video`,{className:`block w-full h-auto`,src:e,poster:t,controls:!0,preload:a,playsInline:!0,...o,children:[r,`Your browser does not support the video tag.`]}):O(`div`,{className:`aspect-video bg-bg-surface animate-pulse`,role:`img`,"aria-label":n||`Video`})})}const dt=j(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold tracking-tight`,{variants:{variant:{default:`bg-bg-surface text-text-muted border-border-subtle`,primary:`bg-primary-500/15 text-primary-400 border-primary-500/20`,success:`bg-emerald-500/15 text-emerald-400 border-emerald-500/20`,warning:`bg-amber-500/15 text-amber-400 border-amber-500/20`,danger:`bg-red-500/15 text-red-400 border-red-500/20`,info:`bg-sky-500/15 text-sky-400 border-sky-500/20`}},defaultVariants:{variant:`default`}});function ft({variant:e=`default`,children:t,className:n=``,...r}){return O(`span`,{className:F(dt({variant:e}),n),...r,children:t})}const pt=j(`grid gap-4 my-6`,{variants:{cols:{1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-4`}},defaultVariants:{cols:3}});function mt({cols:e=3,children:t,className:n=``,...r}){return O(`div`,{className:F(pt({cols:e}),n),...r,children:t})}function ht({title:e,icon:t,href:n,children:r,className:i=``,...a}){let s=d(null),c=d(null),l=o(e=>{let t=s.current||c.current;if(!t)return;let{left:n,top:r}=t.getBoundingClientRect();t.style.setProperty(`--x`,`${e.clientX-n}px`),t.style.setProperty(`--y`,`${e.clientY-r}px`)},[]),u=k(D,{children:[O(`div`,{className:`pointer-events-none absolute -inset-px rounded-xl opacity-0 transition-opacity duration-300 group-hover:opacity-100`,style:{background:`radial-gradient(400px circle at var(--x) var(--y), color-mix(in oklch, var(--color-primary-500), transparent 90%), transparent 80%)`}}),t&&O(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-primary-500/10 text-primary-400 text-lg transition-transform duration-300 group-hover:scale-105 group-hover:-rotate-3`,children:t}),k(`div`,{className:`space-y-1.5`,children:[e&&O(`h3`,{className:`text-sm font-bold text-text-main`,children:e}),r&&O(`div`,{className:`text-sm text-text-muted leading-relaxed`,children:r})]})]}),f=F(`group relative block rounded-xl border border-border-subtle bg-bg-surface p-5 outline-none overflow-hidden`,`transition-all duration-200 hover:border-primary-500/40 hover:shadow-lg hover:shadow-primary-500/5`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,i);return n?O(E.Link,{ref:c,href:n,className:F(f,`no-underline cursor-pointer`),onMouseMove:l,...a,children:u}):O(`div`,{ref:s,role:`presentation`,className:f,onMouseMove:l,...a,children:u})}const gt={note:O(te,{size:18}),tip:O(ge,{size:18}),info:O(he,{size:18}),warning:O(ee,{size:18}),danger:O(ve,{size:18}),important:O(pe,{size:18}),caution:O(ye,{size:18})},_t={note:`Note`,tip:`Tip`,info:`Info`,warning:`Warning`,danger:`Danger`,important:`Important`,caution:`Caution`},vt=j(`py-4 px-4 rounded-lg`,{variants:{type:{note:`border-primary-400 bg-primary-500/5 text-primary-400`,tip:`border-emerald-500 bg-emerald-500/5 text-emerald-500`,info:`border-sky-500 bg-sky-500/5 text-sky-500`,warning:`border-amber-500 bg-amber-500/5 text-amber-500`,danger:`border-red-500 bg-red-500/5 text-red-500`,important:`border-orange-500 bg-orange-500/5 text-orange-500`,caution:`border-yellow-500 bg-yellow-500/5 text-yellow-500`}},defaultVariants:{type:`note`}});function K({type:e=`note`,title:t,children:n,className:r=``,...i}){return k(`div`,{className:F(vt({type:e}),r),role:e===`warning`||e===`danger`?`alert`:`note`,...i,children:[k(`div`,{className:`flex items-center flex-row gap-2 mb-2`,children:[O(`span`,{className:F(`shrink-0`,vt({type:e})),children:gt[e]}),O(`span`,{className:`text-sm font-bold tracking-tight text-text-main`,children:t||_t[e]})]}),O(`div`,{className:`text-sm text-text-muted leading-relaxed [&>p]:m-0 [&>p]:mb-2 [&>p:last-child]:mb-0`,children:n})]})}const yt=e=>O(K,{type:`note`,...e}),bt=e=>O(K,{type:`tip`,...e}),xt=e=>O(K,{type:`warning`,...e}),St=e=>O(K,{type:`danger`,...e}),Ct=e=>O(K,{type:`info`,...e}),wt=e=>O(K,{type:`important`,...e}),Tt=e=>O(K,{type:`caution`,...e}),Et=j(`my-6 transition-all duration-200`,{variants:{variant:{default:`list-disc pl-5 text-text-muted marker:text-primary-500/50`,number:`list-decimal pl-5 text-text-muted marker:text-primary-500/50 marker:font-bold`,checked:`list-none p-0`,arrow:`list-none p-0`,bubble:`list-none p-0`},cols:{1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-4`},isGrid:{true:`grid gap-x-8 gap-y-3`,false:`space-y-2`},dense:{true:`space-y-1`,false:`space-y-2`}},compoundVariants:[{variant:`default`,dense:!0,className:`space-y-0.5`}],defaultVariants:{variant:`default`,cols:1,isGrid:!1,dense:!1}}),Dt=j(`group flex items-start gap-3 text-sm leading-relaxed transition-all duration-200`,{variants:{variant:{default:``,number:``,checked:`hover:translate-x-0.5`,arrow:`hover:translate-x-0.5`,bubble:`hover:translate-x-0.5`},dense:{true:`py-0`,false:`py-0.5`}},defaultVariants:{variant:`default`,dense:!1}}),Ot=j(`mt-1 shrink-0 flex items-center justify-center transition-transform group-hover:scale-110`,{variants:{variant:{bubble:`h-5 w-5 rounded-full bg-primary-500/10 text-primary-500 text-[10px] font-bold`,default:``}},defaultVariants:{variant:`default`}});function kt({icon:e,children:t,variant:n,dense:r}){return k(`li`,{className:F(Dt({variant:n,dense:r})),children:[e&&O(`span`,{className:F(Ot({variant:n===`bubble`?`bubble`:`default`})),children:e}),O(`div`,{className:`flex-1 text-text-muted group-hover:text-text-main transition-colors`,children:t})]})}const At={checked:e=>O(S,{size:14,className:F(`text-emerald-500 shrink-0`,e)}),arrow:e=>O(w,{size:14,className:F(`text-primary-400 shrink-0`,e)}),bubble:e=>O(oe,{size:6,fill:`currentColor`,className:F(`text-primary-500 shrink-0`,e)}),default:()=>null,number:()=>null};function jt({variant:e=`default`,cols:n=1,dense:i=!1,children:a,className:o,...s}){let c=n!==void 0&&Number(n)>1,l=At[e],u=Et({variant:e,cols:n,dense:i,isGrid:c,className:o});return e===`default`||e===`number`?O(e===`number`?`ol`:`ul`,{className:u,...s,children:a}):O(`ul`,{className:u,...s,children:t.map(a,t=>{if(!r(t))return t;let n=t,a=n.type===`li`?n.props.children:n.props.children||t;return O(kt,{icon:l(),variant:e,dense:i,children:a})})})}const Mt={ts:Qe,tsx:B,js:$e,jsx:B,json:et,css:tt,html:nt,md:V,mdx:V,bash:H,sh:H,yaml:U,yml:U},q={CODE:/\.(ts|tsx|js|jsx|json|mjs|cjs|astro|vue|svelte)$/i,TEXT:/\.(md|mdx|txt)$/i,IMAGE:/\.(png|jpg|jpeg|svg|gif)$/i};function J(e){return typeof e==`string`?e:typeof e==`number`?e.toString():Array.isArray(e)?e.map(J).join(``):r(e)&&e.props&&typeof e.props==`object`&&`children`in e.props?J(e.props.children):``}function Nt(e,t){let n=e.toLowerCase(),r=`shrink-0 transition-colors duration-200`;if(t)return O(me,{size:16,strokeWidth:2,className:F(r,`text-primary-400`),fill:`currentColor`,fillOpacity:.15});let i=Mt[n.split(`.`).pop()||``];if(i)return O(i,{size:16});let a=F(r,`text-text-dim group-hover:text-text-main`);return q.CODE.test(n)?O(ue,{size:16,strokeWidth:2,className:a}):q.TEXT.test(n)?O(fe,{size:16,strokeWidth:2,className:a}):q.IMAGE.test(n)?O(de,{size:16,strokeWidth:2,className:a}):O(le,{size:16,strokeWidth:2,className:a})}function Y(e,t){if(!r(e))return!1;let n=e.type;if(typeof n==`string`)return n===t;if(typeof n==`function`)return n.name===t||n.name?.toLowerCase()===t;let i=e.props;return i?.originalType===t||i?.mdxType===t}function Pt(e){let t=e.match(/\s+(\/\/|#)\s+(.*)$/);return t?{name:e.slice(0,t.index).trim(),comment:t[2]}:{name:e.trim()}}function X(e,n=`root`){if(!r(e))return[];let i=[];if(Y(e,`ul`))return t.forEach(e.props.children,(e,t)=>{i.push(...X(e,`${n}-${t}`))}),i;if(Y(e,`li`)){let r=t.toArray(e.props.children),a=r.findIndex(e=>Y(e,`ul`)),o=a!==-1,s=o?r.slice(0,a):r,c=o?r.slice(a):[],{name:l,comment:u}=Pt(J(s)),d=l.endsWith(`/`),f=d?l.slice(0,-1):l,p=o||d;return i.push({id:`${n}-${f}`,name:f,comment:u,isFolder:p,children:o?X(c[0],`${n}-${f}`):void 0}),i}return e.props&&typeof e.props==`object`&&`children`in e.props&&t.forEach(e.props.children,(e,t)=>{i.push(...X(e,`${n}-${t}`))}),i}function Ft({item:e}){return k(E.TreeItem,{id:e.id,textValue:e.name,className:`outline-none group focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-md`,children:[O(E.TreeItemContent,{children:({isExpanded:t,hasChildItems:n})=>k(`div`,{className:`flex items-center gap-2 py-1 px-1.5 rounded-md transition-colors hover:bg-primary-500/5 cursor-pointer`,children:[O(`div`,{style:{width:`calc((var(--tree-item-level) - 1) * 1rem)`},className:`shrink-0`}),n?O(E.Button,{slot:`chevron`,className:`outline-none text-text-dim hover:text-primary-400 p-0.5 rounded transition-colors`,children:O(w,{size:14,strokeWidth:3,className:F(`transition-transform duration-200`,t&&`rotate-90`)})}):O(`div`,{className:`w-[18px]`}),Nt(e.name,e.isFolder),O(`span`,{className:F(`text-sm transition-colors truncate select-none`,e.isFolder?`font-semibold text-text-main`:`text-text-muted group-hover:text-text-main`),children:e.name}),e.comment&&k(`span`,{className:`ml-2 text-xs italic text-text-dim opacity-70 group-hover:opacity-100 transition-opacity whitespace-nowrap overflow-hidden text-ellipsis font-sans`,children:[`//`,` `,e.comment]})]})}),e.children&&O(E.Collection,{items:e.children,children:e=>O(Ft,{item:e})})]})}function It({children:e}){let t=u(()=>X(e),[e]);return O(`div`,{className:`my-8`,children:O(E.Tree,{items:t,"aria-label":`File Tree`,className:F(`rounded-xl border border-border-subtle bg-bg-surface/50 p-4 font-mono text-sm shadow-sm backdrop-blur-sm outline-none`,`max-h-[500px] overflow-y-auto scrollbar-thin scrollbar-thumb-border-subtle`,`focus-visible:ring-2 focus-visible:ring-primary-500/20`),children:e=>O(Ft,{item:e})})})}function Lt({data:e,sortable:t=!1,paginated:n=!1,pageSize:r=10}){let[i,a]=f(null),[o,s]=f(1),c=u(()=>{if(!e)return[];let n=[...e];return t&&i!==null&&n.sort((e,t)=>{let n=e[i.key],r=t[i.key],a=typeof n==`string`?n:``,o=typeof r==`string`?r:``;return a<o?i.direction===`asc`?-1:1:a>o?i.direction===`asc`?1:-1:0}),n},[e,i,t]);return{sortConfig:i,currentPage:o,setCurrentPage:s,totalPages:Math.ceil(c.length/r),paginatedData:u(()=>{if(!n)return c;let e=(o-1)*r;return c.slice(e,e+r)},[c,n,o,r]),requestSort:e=>{if(!t)return;let n=`asc`;i&&i.key===e&&i.direction===`asc`&&(n=`desc`),a({key:e,direction:n})}}}function Rt({headers:e,data:t,children:n,className:r=``,sortable:i=!1,paginated:a=!1,pageSize:o=10}){let{sortConfig:s,currentPage:c,setCurrentPage:l,totalPages:u,paginatedData:d,requestSort:f}=Lt({data:t,sortable:i,paginated:a,pageSize:o}),p=e=>i?s?.key===e?s.direction===`asc`?O(re,{size:14,className:`ml-1 text-primary-400`}):O(C,{size:14,className:`ml-1 text-primary-400`}):O(C,{size:14,className:`ml-1 opacity-30`}):null,m=n||k(D,{children:[e&&O(`thead`,{children:O(`tr`,{children:e.map((e,t)=>O(`th`,{onClick:()=>f(t),className:F(`text-left px-3 py-2.5 border-b-2 border-border-subtle text-text-main font-semibold text-sm`,i&&`cursor-pointer select-none hover:text-primary-400 transition-colors`),children:k(`div`,{className:`flex items-center`,children:[e,p(t)]})},t))})}),d&&O(`tbody`,{children:d.map((e,t)=>O(`tr`,{className:`transition-colors hover:bg-bg-surface`,children:e.map((e,t)=>O(`td`,{className:`px-3 py-2 border-b border-border-subtle text-sm text-text-muted`,children:e},t))},t))})]});return k(`div`,{className:F(`my-6 rounded-lg border border-border-subtle overflow-hidden`,r),children:[O(`div`,{className:`overflow-x-auto`,children:O(`table`,{className:`w-full border-collapse text-sm`,children:m})}),a&&u>1&&k(`div`,{className:`flex items-center justify-between border-t border-border-subtle px-4 py-3`,children:[k(`span`,{className:`text-xs text-text-muted`,children:[`Page `,c,` of `,u]}),k(`div`,{className:`flex items-center gap-1`,children:[O(E.Button,{onPress:()=>l(1),isDisabled:c===1,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:O(ie,{size:16})}),O(E.Button,{onPress:()=>l(e=>Math.max(e-1,1)),isDisabled:c===1,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:O(ne,{size:16})}),O(E.Button,{onPress:()=>l(e=>Math.min(e+1,u)),isDisabled:c===u,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:O(w,{size:16})}),O(E.Button,{onPress:()=>l(u),isDisabled:c===u,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:O(ae,{size:16})})]})]})]})}function zt({name:e,type:t,defaultValue:n,required:r=!1,children:i,id:a,className:o=``}){return k(`article`,{className:F(`group relative my-6 rounded-xl border border-border-subtle bg-bg-surface p-5 transition-all duration-300`,`hover:border-primary-500/30 hover:shadow-lg hover:shadow-primary-500/5`,o),id:a,children:[k(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4`,children:[k(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[O(`code`,{className:`inline-flex items-center rounded-md bg-primary-500/10 px-2.5 py-1 font-mono text-sm font-bold text-primary-400 border border-primary-500/20 shadow-sm transition-colors group-hover:bg-primary-500/15`,children:e}),t&&O(`span`,{className:`rounded-md bg-bg-muted/80 border border-border-subtle px-2 py-0.5 text-[11px] font-semibold text-text-muted uppercase tracking-wider shadow-sm`,children:t}),r&&k(`div`,{className:`flex items-center gap-1.5 rounded-full bg-red-500/10 px-2.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-red-400 border border-red-500/20 shadow-sm`,children:[O(`span`,{className:`h-1 w-1 rounded-full bg-red-400 animate-pulse`}),`Required`]})]}),n&&k(`div`,{className:`flex items-center gap-2 text-[11px] text-text-muted bg-bg-muted/30 px-2.5 py-1 rounded-md border border-border-subtle/50`,children:[O(`span`,{className:`font-semibold opacity-60 uppercase tracking-tighter`,children:`Default`}),O(`code`,{className:`font-mono text-text-main font-medium`,children:n})]})]}),O(`div`,{className:`text-sm text-text-muted leading-relaxed [&>p]:m-0 selection:bg-primary-500/30`,children:i})]})}function Bt({to:e,children:t,className:n=``,...r}){let i=e&&(e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`//`));return O(I,{href:e,className:F(`text-blue-600 hover:text-blue-800 hover:underline cursor-pointer`,n),target:i?`_blank`:void 0,rel:i?`noopener noreferrer`:void 0,...r,children:t})}function Vt({src:e,alt:t,theme:n,...r}){let{theme:i}=Ve();return n&&n!==i?null:O(`img`,{src:e,alt:t||``,...r})}function Ht({title:e,props:t,className:n=``}){return k(`div`,{className:F(`my-6`,n),children:[e&&O(`h3`,{className:`text-base font-bold text-text-main mb-3`,children:e}),O(`div`,{className:`overflow-x-auto rounded-lg border border-border-subtle`,children:k(`table`,{className:`w-full border-collapse text-sm`,children:[O(`thead`,{children:k(`tr`,{children:[O(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Property`}),O(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Type`}),O(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Default`}),O(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Description`})]})}),O(`tbody`,{children:t.map((e,t)=>k(`tr`,{className:`transition-colors hover:bg-bg-surface`,children:[k(`td`,{className:`px-4 py-2.5 border-b border-border-subtle`,children:[O(`code`,{className:`rounded bg-bg-surface px-1.5 py-0.5 font-mono text-xs font-bold text-primary-400`,children:e.name}),e.required&&O(`span`,{className:`ml-1 text-red-400 font-bold`,children:`*`})]}),O(`td`,{className:`px-4 py-2.5 border-b border-border-subtle`,children:O(`code`,{className:`rounded bg-bg-muted px-1.5 py-0.5 font-mono text-xs text-text-muted`,children:e.type})}),O(`td`,{className:`px-4 py-2.5 border-b border-border-subtle`,children:e.defaultValue?O(`code`,{className:`rounded bg-bg-muted px-1.5 py-0.5 font-mono text-xs text-primary-400`,children:e.defaultValue}):O(`span`,{className:`text-text-dim`,children:`—`})}),O(`td`,{className:`px-4 py-2.5 border-b border-border-subtle text-text-muted`,children:e.description})]},`${e.name}-${t}`))})]})})]})}function Ut(e){let{code:t,children:n,preview:r}=e;return{initialCode:u(()=>(t??(typeof n==`string`?n:``)).trim(),[t,n]),previewElement:u(()=>r??(typeof n==`string`?null:n),[r,n])}}function Wt(e){let{highlightedHtml:t,hideCode:n=!1,hideCopy:r=!1}=e,{initialCode:i,previewElement:a}=Ut(e);return k(`div`,{className:`my-6 overflow-hidden rounded-xl border border-border-subtle`,children:[O(`div`,{className:`flex items-center justify-center p-8 bg-bg-surface`,children:a}),!n&&O(`div`,{className:`border-t border-border-subtle`,children:O(G,{hideCopy:r,lang:`tsx`,highlightedHtml:t,plain:!0,children:i})})]})}const Gt=({children:e,className:t,vertical:n=!1})=>O(`div`,{className:F(`inline-flex`,n?`flex-col`:`flex-row`,!n&&[`[&>*:not(:first-child)]:-ml-px`,`[&>*:first-child]:rounded-r-none`,`[&>*:last-child]:rounded-l-none`,`[&>*:not(:first-child):not(:last-child)]:rounded-none`,t?.includes(`rounded-full`)&&[`[&>*:first-child]:rounded-l-full`,`[&>*:last-child]:rounded-r-full`],t?.includes(`rounded-xl`)&&[`[&>*:first-child]:rounded-l-xl`,`[&>*:last-child]:rounded-r-xl`],t?.includes(`rounded-lg`)&&[`[&>*:first-child]:rounded-l-lg`,`[&>*:last-child]:rounded-r-lg`]],n&&[`[&>*:not(:first-child)]:-mt-px`,`[&>*:first-child]:rounded-b-none`,`[&>*:last-child]:rounded-t-none`,`[&>*:not(:first-child):not(:last-child)]:rounded-none`,t?.includes(`rounded-full`)&&[`[&>*:first-child]:rounded-t-full`,`[&>*:last-child]:rounded-b-full`]],t),children:e}),Kt=({children:e,className:t,showArrow:n,...r})=>k(E.Popover,{offset:8,...r,className:E.composeRenderProps(t,e=>F(`z-50 overflow-auto rounded-xl border border-border-subtle bg-bg-surface/80 shadow-xl backdrop-blur-md outline-none transition-none`,e)),children:[n&&O(E.OverlayArrow,{className:`group`,children:O(`svg`,{viewBox:`0 0 12 12`,className:`block h-3 w-3 fill-bg-surface/80 stroke-border-subtle group-placement-bottom:rotate-180 group-placement-left:-rotate-90 group-placement-right:rotate-90`,"aria-hidden":`true`,children:O(`path`,{d:`M0 0 L6 6 L12 0`})})}),e]});function qt(t){let[n,r]=e.Children.toArray(t.children).slice(0,2);return k(E.MenuTrigger,{...t,children:[n,O(Kt,{placement:t.placement,className:`min-w-35`,children:r})]})}function Jt(t){let[n,r]=e.Children.toArray(t.children).slice(0,2);return k(E.SubmenuTrigger,{...t,children:[n,O(Kt,{offset:-4,crossOffset:-4,children:r})]})}function Z(e){return O(E.Menu,{...e,className:E.composeRenderProps(e.className,e=>F(`p-1.5 outline-none max-h-[inherit] overflow-auto max-w-75`,e))})}function Yt(e){let t=e.textValue||(typeof e.children==`string`?e.children:void 0);return O(E.MenuItem,{...e,textValue:t,className:E.composeRenderProps(e.className,(e,{isFocused:t,isPressed:n,isDisabled:r})=>F(`group relative flex flex-row items-center gap-2 px-2 py-1 rounded-lg outline-none cursor-default hover:cursor-pointer transition-none`,`text-text-main text-[12px]`,{"bg-bg-surface-elevated text-primary-600 ring-1 ring-border-strong/5":t,"bg-bg-surface-elevanted":n,"opacity-40 grayscale pointer-events-none":r},e)),children:E.composeRenderProps(e.children,(e,{selectionMode:t,isSelected:n,hasSubmenu:r})=>k(D,{children:[t!==`none`&&k(`span`,{className:`flex items-center size-4 shrink-0 justify-center`,children:[n&&t===`multiple`&&O(S,{className:`size-3.5 stroke-[2.5px] text-primary-500 animate-in zoom-in-50 duration-200`}),n&&t===`single`&&O(se,{className:`size-5 text-primary-500 animate-in zoom-in-50 duration-200`})]}),O(`div`,{className:`flex flex-row w-full transition-colors items-center gap-2 py-1 px-1`,children:e}),r&&O(w,{className:`size-4 ml-auto text-text-muted group-focused:text-primary-500/70 transition-colors`})]}))})}function Xt({title:e,...t}){return k(E.MenuSection,{...t,className:F(`flex flex-col gap-0.5`,t.className),children:[e&&O(E.Header,{className:`px-3 py-2 text-[10px] font-bold uppercase tracking-[0.075em] text-text-muted/50 select-none`,children:e}),O(E.Collection,{items:t.items,children:t.children})]})}function Zt(e){return O(E.Separator,{...e,className:`mx-2 my-1.5 border-t border-border-subtle/50`})}Z.Root=Z,Z.Item=Yt,Z.Trigger=qt,Z.SubTrigger=Jt,Z.Section=Xt,Z.Separator=Zt;function Q({className:e,variant:t=`rect`,...n}){return O(`div`,{className:F(`animate-pulse bg-bg-muted`,t===`circle`?`rounded-full`:`rounded-md`,e),...n})}const Qt=e=>{let[t,n]=f(!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 $t({content:e,mdxRaw:t,config:n}){let r=t||e||``,{copied:i,handleCopy:a,handleOpenRaw:o}=Qt(r),s=n!==!1,c=typeof n==`object`&&n.text||`Copy Markdown`;return!s||!r?null:O(`div`,{className:`relative inline-flex z-100 flex-shrink-0 w-max translate-y-0 active:translate-y-px transition-transform duration-200`,children:k(Gt,{className:`rounded-xl border border-border-subtle bg-bg-surface/40 backdrop-blur-md transition-all duration-300 hover:border-primary-500/50 hover:shadow-lg hover:shadow-primary-500/5 group overflow-hidden`,children:[O(R,{variant:`ghost`,onPress:a,icon:O(i?S:T,{size:16}),iconPosition:`left`,className:F(`px-5 py-2 bg-transparent text-[0.8125rem] font-semibold h-9 border-none shrink-0`,`text-text-main transition-all duration-300 hover:bg-primary-500/5`,i&&`text-emerald-500 hover:bg-emerald-500/5`),children:i?`Copied!`:c}),k(Z.Trigger,{placement:`bottom end`,children:[O(R,{variant:`ghost`,isIconOnly:!0,icon:O(C,{size:14}),className:F(`px-3.5 h-9 border-l border-border-subtle/50 text-text-muted rounded-none bg-transparent shrink-0`,`transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500`)}),k(Z.Root,{className:`w-52`,children:[k(Z.Item,{onAction:a,children:[O(T,{size:16,className:`size-4 mt-0.5 text-text-muted group-hover:text-primary-500`}),O(`span`,{className:`font-medium text-[0.8125rem]`,children:`Copy Markdown`})]}),k(Z.Item,{onAction:o,children:[O(ce,{size:16,className:`size-4 mt-0.5 text-text-muted group-hover:text-primary-500`}),O(`span`,{className:`font-medium text-[0.8125rem]`,children:`View as Markdown`})]})]})]})]})})}var en=Ee({Admonition:()=>K,Badge:()=>ft,Button:()=>Ye,Card:()=>ht,Cards:()=>mt,Caution:()=>Tt,CodeBlock:()=>G,ComponentPreview:()=>Wt,ComponentProps:()=>Ht,CopyMarkdown:()=>$t,Danger:()=>St,Field:()=>zt,FileTree:()=>It,Image:()=>Vt,Important:()=>wt,InfoBox:()=>Ct,Link:()=>Bt,List:()=>jt,Note:()=>yt,Tab:()=>ct,Table:()=>Rt,Tabs:()=>lt,Tip:()=>bt,Video:()=>ut,Warning:()=>xt});function tn(){return O(`div`,{className:F(`w-full h-full relative overflow-y-auto transition-opacity duration-300 animate-fade-in`),children:k(`div`,{className:`mx-auto max-w-(--spacing-content-max) px-4 py-8 space-y-10`,children:[k(`div`,{className:`flex gap-2`,children:[O(Q,{className:`h-3 w-16`}),O(Q,{className:`h-3 w-24`})]}),O(Q,{className:`h-10 w-[60%] sm:h-12`}),k(`div`,{className:`space-y-3`,children:[O(Q,{className:`h-4 w-full`}),O(Q,{className:`h-4 w-[95%]`}),O(Q,{className:`h-4 w-[40%]`})]}),k(`div`,{className:`space-y-6 pt-4`,children:[O(Q,{className:`h-7 w-32`}),k(`div`,{className:`space-y-3`,children:[O(Q,{className:`h-4 w-full`}),O(Q,{className:`h-4 w-[98%]`}),O(Q,{className:`h-4 w-[92%]`}),O(Q,{className:`h-4 w-[60%]`})]})]}),O(Q,{className:`h-32 w-full rounded-lg bg-bg-muted/50`}),k(`div`,{className:`space-y-6 pt-4`,children:[O(Q,{className:`h-7 w-48`}),k(`div`,{className:`space-y-3`,children:[O(Q,{className:`h-4 w-full`}),O(Q,{className:`h-4 w-[85%]`})]})]})]})})}const $=({level:e,id:t,children:n,...r})=>k(`h${e}`,{id:t,...r,className:`boltdocs-heading`,children:[n,t&&O(`a`,{href:`#${t}`,className:`header-anchor`,"aria-label":`Anchor`,children:O(_e,{size:16})})]}),nn={...en,Loading:tn,h1:e=>O($,{level:1,...e}),h2:e=>O($,{level:2,...e}),h3:e=>O($,{level:3,...e}),h4:e=>O($,{level:4,...e}),h5:e=>O($,{level:5,...e}),h6:e=>O($,{level:6,...e}),pre:e=>O(G,{...e,children:e.children})};function rn(){let{currentLocale:e,config:t}=P();return c(()=>{if(!t.i18n)return;let n=t.i18n.localeConfigs?.[e];document.documentElement.lang=n?.htmlLang||e||`en`,document.documentElement.dir=n?.direction||`ltr`},[e,t.i18n]),null}function an(){let e=y(),{config:t}=P(),n=N(e=>e.setLocale),r=N(e=>e.setVersion),i=N(e=>e.currentLocale),a=N(e=>e.currentVersion);return c(()=>{let o=e.pathname.split(`/`).filter(Boolean),s=0,c=t.versions?.defaultVersion,l=t.i18n?.defaultLocale;if(o[s]===`docs`&&s++,t.versions&&o.length>s){let e=t.versions.versions.find(e=>e.path===o[s]);e&&(c=e.path,s++)}t.i18n&&o.length>s&&t.i18n.locales[o[s]]?l=o[s]:t.i18n&&o.length===0&&(l=i||t.i18n.defaultLocale),l!==i&&n(l),c!==a&&r(c)},[e.pathname,t,n,r,i,a]),null}function on({initialRoutes:t,initialConfig:n,docsDirName:r,modules:i,hot:a,homePage:o,externalPages:s,externalLayout:l,components:d={}}){let[p,m]=f(t),[h,v]=f(n),y=s||{},b=l||A,ee=u(()=>p.filter(e=>!(o&&(e.path===`/`||e.path===``))&&!y[e.path===``?`/`:e.path]).map(t=>{let n=Object.keys(i).find(e=>e===`/${r}/${t.filePath}`||e.endsWith(`/${r}/${t.filePath}`)||e.endsWith(`/${r}\\${t.filePath.replace(/\\/g,`/`)}`)),a=n?i[n]:null;return{...t,Component:e.lazy(async()=>a?await a():{default:Re})}}),[p,i,r,o,y]);c(()=>{a&&(a.on(`boltdocs:routes-update`,e=>{m(e)}),a.on(`boltdocs:config-update`,e=>{v(e)}))},[a]);let x=u(()=>({...nn,...we,...d}),[d]),te=x.Loading;return O(Pe,{children:O(Be,{children:O(qe,{components:x,children:O(De.Provider,{value:h,children:O(He,{children:k(Ae,{routes:p,modules:i,children:[O(Ue,{}),O(an,{}),O(rn,{}),k(_,{children:[O(g,{element:O(We,{}),children:ee.map(t=>O(g,{path:t.path===``?`/`:t.path,element:O(e.Suspense,{fallback:O(te,{}),children:O(Je,{Component:t.Component})})},t.path))},`docs-layout`),o&&k(D,{children:[O(g,{path:`/`,element:O(b,{children:O(o,{})})}),h.i18n&&Object.keys(h.i18n.locales).map(e=>O(g,{path:`/${e}`,element:O(b,{children:O(o,{})})},`home-${e}`))]}),Object.entries(y).map(([t,n])=>{let r=t===`/`?``:t;return k(e.Fragment,{children:[O(g,{path:t,element:O(b,{children:O(n,{})})}),h.i18n&&Object.keys(h.i18n.locales).map(e=>O(g,{path:`/${e}${r}`,element:O(b,{children:O(n,{})})},`${t}-${e}`))]},t)}),O(g,{path:`*`,element:O(A,{children:O(Re,{})})})]})]})})})})})})}async function sn(t){let{path:n,routes:r,config:i,modules:a,homePage:o,externalPages:s,docsDirName:c}=t,l={};for(let[e,t]of Object.entries(a))l[e]=()=>Promise.resolve(t);return p.renderToString(O(e.StrictMode,{children:O(m,{location:n,children:O(on,{initialRoutes:r,initialConfig:i,docsDirName:c,modules:l,homePage:o,externalPages:s})})}))}export{sn as render};
@@ -1,73 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- import{C as e,E as t,S as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,s as _,t as v,u as y,v as b,w as x,x as S,y as ee}from"./cache-DFdakSmR.mjs";import C from"@vitejs/plugin-react";import w from"@tailwindcss/vite";import{loadConfigFromFile as te,loadEnv as T}from"vite";import E from"fast-glob";import D from"fs";import{z as O}from"zod";import k from"path";import ne from"crypto";import re from"github-slugger";import{ViteImageOptimizer as ie}from"vite-plugin-image-optimizer";import{fileURLToPath as A}from"url";import{createRequire as j}from"module";import ae from"semver";import oe from"@mdx-js/rollup";import se from"remark-gfm";import ce from"remark-frontmatter";import M from"rehype-slug";import{visit as N}from"unist-util-visit";import{createHighlighter as P}from"shiki";function le(){F.invalidateAll()}function ue(e){F.invalidate(e)}var F,de=t((()=>{d(),F=new v({name:`routes`})}));function fe(t,n,s,c){let d;try{d=decodeURIComponent(t)}catch{let e=k.basename(t);throw g(`ENCODING_ERROR`,`Invalid character encoding`,{file:e}),new ee(`Security breach: Invalid characters or encoding in path: ${e}`)}if(d.length>260){let e=k.basename(d);throw g(`PATH_TOO_LONG`,`Path length exceeds limit`,{length:d.length,file:e}),new a(`Security breach: Path length exceeds limit of 260 characters: ${e}`)}let m=k.resolve(d),h=k.resolve(n),_=p(k.relative(h,m));if(_.startsWith(`../`)||_===`..`||m.includes(`\0`)||!e.test(_)){let e=k.basename(t);throw g(`PATH_TRAVERSAL_ATTEMPT`,`Path traversal or invalid characters detected`,{path:_}),new a(`Security breach: File is outside of docs directory, contains null bytes, or invalid characters: ${e}`)}let{data:v,content:y}=u(t),x=_.split(`/`),S,C;if(c?.versions&&x.length>0){let e=x[0],t=c.versions.prefix||``,n=c.versions.versions.find(n=>e===t+n.path||e===n.path);n&&(C=n.path,x=x.slice(1))}if(c?.i18n&&x.length>0){let e=x[0];c.i18n.locales[e]&&(S=e,x=x.slice(1))}let w;if(x.length>0){let e=x[0].match(/^\((.+)\)$/);e&&(w=e[1].toLowerCase(),x=x.slice(1))}let te=x.join(`/`),T;T=v.permalink?v.permalink.startsWith(`/`)?v.permalink:`/${v.permalink}`:f(te||`index.md`);let E=s;C&&(E+=`/`+C),S&&(E+=`/`+S),w&&(E+=`/`+w),E+=T===`/`?``:T,(!E||E===``)&&(E=`/`);let D=x[x.length-1],O=b(D),ne=b(k.basename(t,k.extname(t))),ie=v.sidebarPosition??o(D),A=x.length>=2?x[0]:void 0,j=A?b(A):void 0,ae=x.length>=2&&/^index\.mdx?$/.test(O),oe=new re,se=[];for(let e of y.matchAll(/^(#{2,4})\s+(.+)$/gm)){let t=e[1].length,n=l(e[2].replace(/\[([^\]]+)\]\([^\)]+\)/g,`$1`).replace(/[_*`]/g,``).trim()).trim(),r=oe.slug(n);se.push({level:t,text:n,id:r})}let ce=v.title?l(String(v.title)):ne,M=v.description?l(String(v.description)):``;!M&&y&&(M=r(y.replace(/^#+.*$/gm,``).replace(/\[([^\]]+)\]\([^\)]+\)/g,`$1`).replace(/[_*`]/g,``).replace(/\s+/g,` `)).trim().slice(0,160));let N=v.badge?l(String(v.badge)):void 0,P=v.icon?String(v.icon):void 0,le=pe(y);return{route:{path:E,componentPath:t,filePath:_,title:ce,description:M,sidebarPosition:ie,headings:se,locale:S,version:C,badge:N,icon:P,tab:w,_content:le,_rawContent:y},relativeDir:j,isGroupIndex:ae,inferredTab:w,groupMeta:ae?{title:v.groupTitle||v.title||(j?i(j):``),position:v.groupPosition??v.sidebarPosition??(A?o(A):void 0),icon:P}:void 0,inferredGroupPosition:A?o(A):void 0}}function pe(e){return r(e.replace(/^#+.*$/gm,``).replace(/\[([^\]]+)\]\([^\)]+\)/g,`$1`).replace(/\{[^\}]+\}/g,``).replace(/[_*`]/g,``).replace(/\s+/g,` `)).trim()}var me=t((()=>{s(),x(),n()}));function he(e){return e.sort((e,t)=>!e.group&&!t.group?ge(e,t):e.group?t.group?e.group===t.group?ge(e,t):_e(e,t):1:-1)}function ge(e,t){return e.sidebarPosition!==void 0&&t.sidebarPosition!==void 0?e.sidebarPosition-t.sidebarPosition:e.sidebarPosition===void 0?t.sidebarPosition===void 0?e.title.localeCompare(t.title):1:-1}function _e(e,t){return e.groupPosition!==void 0&&t.groupPosition!==void 0?e.groupPosition-t.groupPosition:e.groupPosition===void 0?t.groupPosition===void 0?(e.groupTitle||e.group).localeCompare(t.groupTitle||t.group):1:-1}var ve=t((()=>{}));async function I(e,t,n=`/docs`,r=!0){let a=performance.now();F.load(),R.clear(),(process.env.BOLTDOCS_FORCE_REPARSE===`true`||t?.i18n)&&F.invalidateAll();let o;!r&&L?o=L:(o=await E([`**/*.md`,`**/*.mdx`],{cwd:e,absolute:!0,suppressErrors:!0,followSymbolicLinks:!1}),L=o),F.pruneStale(new Set(o));let s=[],c=0;for(let r=0;r<o.length;r+=50){let i=o.slice(r,r+50),a=await Promise.all(i.map(async r=>{let i=F.get(r);if(i)return c++,i;let a=fe(r,e,n,t);return F.set(r,a),a}));s.push(...a),r+50<o.length&&await new Promise(e=>setImmediate(e))}F.save();let l=new Map,u=[];for(let e of s)if(e.isGroupIndex&&e.relativeDir&&u.push(e),e.relativeDir){let t=l.get(e.relativeDir);t?(t.position===void 0&&e.inferredGroupPosition!==void 0&&(t.position=e.inferredGroupPosition),!t.icon&&e.route.icon&&(t.icon=e.route.icon)):(t={title:i(e.relativeDir),position:e.inferredGroupPosition,icon:e.route.icon},l.set(e.relativeDir,t))}for(let e of u){let t=l.get(e.relativeDir);e.groupMeta&&(t.title=e.groupMeta.title,e.groupMeta.position!==void 0&&(t.position=e.groupMeta.position),e.groupMeta.icon&&(t.icon=e.groupMeta.icon))}let d=Array(s.length);for(let e=0;e<s.length;e++){let t=s[e],n=t.relativeDir,r=n?l.get(n):void 0;d[e]={...t.route,group:n,groupTitle:r?.title||(n?i(n):void 0),groupPosition:r?.position,groupIcon:r?.icon}}let f=d;if(t?.i18n){let e=ye(d,t,n);f=[...d,...e]}let p=he(f),m=performance.now()-a;return console.log(`[boltdocs] Route generation: ${m.toFixed(2)}ms (${o.length} files, ${c} cache hits)`),p}function ye(e,t,n){let r=t.i18n.defaultLocale,i=Object.keys(t.i18n.locales),a=[],o=new Map,s=[];for(let t of e){let e=t.locale||r;o.has(e)||o.set(e,new Set),o.get(e).add(t.path),e===r&&s.push(t)}for(let e of i){let i=o.get(e)||new Set;for(let o of s){let s=be(o.path,r,e,n,t);s!==o.path&&(i.has(s)||a.push({...o,path:s,locale:e}))}}return a}function be(e,t,n,r,i){let a=`${e}:${n}`,o=R.get(a);if(o)return o;let s=r;if(i?.versions){let t=i.versions.prefix||``;for(let n of i.versions.versions){let i=t+n.path;if(e.startsWith(`${r}/${i}`)){s+=`/`+i;break}if(e.startsWith(`${r}/${n.path}`)){s+=`/`+n.path;break}}}let c=e.substring(s.length),l=`/${t}`;if(c.startsWith(l+`/`))c=`/`+n+`/`+c.substring(l.length+1);else if(c===l)c=`/`+n;else if(c===`/`||c===``)c=`/`+n;else{let e=c.startsWith(`/`)?``:`/`;c=`/`+n+e+c}let u=s+c;return R.size>2e3&&R.clear(),R.set(a,u),u}var L,R,xe=t((()=>{s(),de(),me(),ve(),L=null,R=new Map})),Se,Ce,we,z,Te,Ee,De,Oe,ke,Ae,je=t((()=>{Se=O.object({icon:O.string().max(50),link:O.string().url()}),Ce=O.object({text:O.string().max(2e3).optional()}),we=O.enum([`fs:read`,`fs:write`,`vite:config`,`mdx:remark`,`mdx:rehype`,`components`,`hooks:build`,`hooks:dev`]),z=O.object({name:O.string(),enforce:O.enum([`pre`,`post`]).optional(),version:O.string().optional(),boltdocsVersion:O.string().optional(),permissions:O.array(we).optional(),remarkPlugins:O.array(O.any()).optional(),rehypePlugins:O.array(O.any()).optional(),vitePlugins:O.array(O.any()).optional(),components:O.record(O.string(),O.string()).optional(),hooks:O.record(O.string(),O.any()).optional()}),Te=O.object({title:O.union([O.string(),O.record(O.string(),O.string())]).optional(),description:O.union([O.string(),O.record(O.string(),O.string())]).optional(),logo:O.union([O.string(),O.object({dark:O.string(),light:O.string(),alt:O.string().optional(),width:O.number().optional(),height:O.number().optional()})]).optional(),navbar:O.array(O.object({label:O.union([O.string(),O.record(O.string(),O.string())]),href:O.string()})).optional(),sidebar:O.record(O.string(),O.array(O.object({text:O.string(),link:O.string()}))).optional(),socialLinks:O.array(Se).optional(),footer:Ce.optional(),breadcrumbs:O.boolean().optional(),editLink:O.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:O.string().url().optional(),version:O.string().max(50).optional(),githubRepo:O.string().max(100).optional(),favicon:O.string().optional(),ogImage:O.string().optional(),poweredBy:O.boolean().optional(),tabs:O.array(O.object({id:O.string(),text:O.union([O.string(),O.record(O.string(),O.string())]),icon:O.string().optional()})).optional(),codeTheme:O.union([O.string(),O.object({light:O.string(),dark:O.string()})]).optional(),copyMarkdown:O.union([O.boolean(),O.object({text:O.string().optional(),icon:O.string().optional()})]).optional()}),Ee=O.union([O.string(),O.object({rules:O.array(O.object({userAgent:O.string(),allow:O.union([O.string(),O.array(O.string())]).optional(),disallow:O.union([O.string(),O.array(O.string())]).optional()})).optional(),sitemaps:O.array(O.string().url()).optional()})]),De=O.object({defaultLocale:O.string(),locales:O.record(O.string(),O.string()),localeConfigs:O.record(O.string(),O.object({label:O.string().optional(),direction:O.enum([`ltr`,`rtl`]).optional(),htmlLang:O.string().optional(),calendar:O.string().optional()})).optional()}),Oe=O.object({defaultVersion:O.string(),prefix:O.string().optional(),versions:O.array(O.object({label:O.string(),path:O.string()}))}),ke=O.object({headers:O.record(O.string(),O.string()).optional(),enableCSP:O.boolean().optional(),customHeaders:O.record(O.string(),O.string()).optional()}),Ae=O.object({siteUrl:O.string().url().optional(),docsDir:O.string().optional(),homePage:O.string().optional(),theme:Te.optional(),i18n:De.optional(),versions:Oe.optional(),plugins:O.array(z).optional(),robots:Ee.optional(),security:ke.optional(),vite:O.record(O.string(),O.unknown()).optional()})}));function Me(e){return e}async function B(e,t=process.cwd()){let n=t,r={docsDir:k.resolve(e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`},poweredBy:!0,breadcrumbs:!0}},i={};for(let e of V){let t=k.resolve(n,e);if(D.existsSync(t))try{let e=await te({command:`serve`,mode:`development`},t,n);if(e){i=e.config;break}}catch(t){console.warn(`[boltdocs] Failed to load config from ${e}:`,t)}}let a={title:i.title,description:i.description,logo:i.logo,favicon:i.favicon,ogImage:i.ogImage,navbar:i.navbar,sidebar:i.sidebar,socialLinks:i.socialLinks,footer:i.footer,githubRepo:i.githubRepo,tabs:i.tabs,codeTheme:i.codeTheme,copyMarkdown:i.copyMarkdown,breadcrumbs:i.breadcrumbs,poweredBy:i.poweredBy,communityHelp:i.communityHelp,version:i.version,editLink:i.editLink,...i.theme||{}},o=Object.fromEntries(Object.entries(a).filter(([e,t])=>t!==void 0));o.navbar&&=o.navbar.map(e=>({label:e.label||e.text||``,href:e.href||e.link||e.to||``}));let s={docsDir:k.resolve(e),homePage:i.homePage,theme:{...r.theme,...o},i18n:i.i18n,versions:i.versions,siteUrl:i.siteUrl,plugins:i.plugins||[],robots:i.robots,security:i.security,vite:i.vite},c=Ae.safeParse(s);if(!c.success)throw new S(`Invalid Boltdocs configuration:\n${c.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
7
- `)}`);return c.data}var V,H=t((()=>{je(),n(),V=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`]}));function Ne(e,t){let n=h(t.title),r=h(t.description);return e.replace(/<title>.*?<\/title>/,`<title>${n}</title>`).replace(/(<meta name="description" content=")[^"]*(")/,`$1${r}$2`).replace(/(<meta property="og:title" content=")[^"]*(")/,`$1${n}$2`).replace(/(<meta property="og:description" content=")[^"]*(")/,`$1${r}$2`).replace(/(<meta name="twitter:title" content=")[^"]*(")/,`$1${n}$2`).replace(/(<meta name="twitter:description" content=")[^"]*(")/,`$1${r}$2`)}var Pe=t((()=>{s()}));function Fe(e,t){let n=t?.siteUrl?.replace(/\/$/,``)||`https://example.com`,r=new Date().toISOString().split(`T`)[0],i=[{url:`/`,priority:`1.0`,changefreq:`daily`}];if(t?.i18n){let e=t.i18n.defaultLocale;for(let n of Object.keys(t.i18n.locales))n!==e&&i.push({url:`/${n}/`,priority:`1.0`,changefreq:`daily`})}return`<?xml version="1.0" encoding="UTF-8"?>
8
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
9
- ${[...i,...e.map(e=>({url:e,priority:`0.8`,changefreq:`weekly`}))].map(e=>` <url>
10
- <loc>${_(n)}${_(e.url)}</loc>
11
- <lastmod>${r}</lastmod>
12
- <changefreq>${e.changefreq}</changefreq>
13
- <priority>${e.priority}</priority>
14
- </url>`).join(`
15
- `)}
16
- </urlset>`}var Ie=t((()=>{s()}));function Le(e){if(typeof e.robots==`string`)return e.robots;let t=e.siteUrl?.replace(/\/$/,``)||``,n=e.robots||{},r=n.rules||[{userAgent:`*`,allow:`/`}],i=n.sitemaps||(t?[`${t}/sitemap.xml`]:[]),a=``;for(let e of r){if(a+=`User-agent: ${e.userAgent}\n`,e.disallow){let t=Array.isArray(e.disallow)?e.disallow:[e.disallow];for(let e of t)a+=`Disallow: ${e}\n`}if(e.allow){let t=Array.isArray(e.allow)?e.allow:[e.allow];for(let e of t)a+=`Allow: ${e}\n`}a+=`
17
- `}for(let e of i)a+=`Sitemap: ${e}\n`;return a.trim()}var Re=t((()=>{}));async function ze(e){let{docsDir:t,docsDirName:n,outDir:r,config:i}=e,a=await I(t,i),o=[`tsx`,`ts`,`jsx`,`js`].map(e=>k.resolve(t,`pages-external/index.${e}`)).find(e=>D.existsSync(e));if(o)try{let e=D.readFileSync(o,`utf-8`),t=e.match(/pages\s*:\s*{([^}]+)}/s);if(t){let e=t[1].split(`,`).map(e=>e.split(`:`)[0].trim().replace(/['"]/g,``)).filter(e=>e&&e.startsWith(`/`));for(let t of e)a.some(e=>e.path===t)||a.push({path:t,title:t.slice(1).charAt(0).toUpperCase()+t.slice(2),filePath:``,componentPath:``,_content:``})}e.includes(`homePage`)&&!a.some(e=>e.path===`/`)&&a.push({path:`/`,title:`Home`,filePath:``,componentPath:``,_content:``})}catch(e){console.warn(`[boltdocs] Failed to parse external routes for SSG:`,e)}let s=k.resolve(U,`../client/ssr.js`);if(!D.existsSync(s)){console.error(`[boltdocs] SSR module not found at`,s,`- Did you build the core package?`);return}let c=Ve(`module`),l=c.prototype.require;c.prototype.require=function(e,...t){return e.startsWith(`virtual:boltdocs-`)?e===`virtual:boltdocs-layout`?{__esModule:!0,default:function(e){try{let t=l.apply(this,[k.resolve(U,`../client/index.js`)]).DefaultLayout||(({children:e})=>e);return l.apply(this,[`react`]).createElement(t,e)}catch{return e.children}}}:e===`virtual:boltdocs-mdx-components`?{__esModule:!0,default:{}}:e===`virtual:boltdocs-config`?{__esModule:!0,default:i}:{__esModule:!0,default:e.includes(`routes`)?[]:{}}:l.apply(this,[e,...t])};let{render:u}=Ve(s);c.prototype.require=l;let d=k.join(r,`index.html`);if(!D.existsSync(d)){console.warn(`[boltdocs] No index.html found in outDir, skipping SSG.`);return}let f=D.readFileSync(d,`utf-8`);await Promise.all(a.map(async e=>{let t=y(i?.theme?.title,e.locale)||`Boltdocs`,o=y(i?.theme?.description,e.locale)||``,s=`${e.title} | ${t}`,c=e.description||o,l={};l[`/${n}/${e.filePath}`]={default:()=>null};try{let t=await u({path:e.path,routes:a,config:i||{},docsDirName:n,modules:l,homePage:void 0}),o=Ne(f,{title:h(s),description:h(c)}).replace(`<!--app-html-->`,t).replace(`<div id="root"></div>`,`<div id="root">${t}</div>`),d=k.join(r,e.path);await D.promises.mkdir(d,{recursive:!0}),await D.promises.writeFile(k.join(d,`index.html`),o,`utf-8`)}catch(t){console.error(`[boltdocs] Error SSR rendering route ${e.path}:`,t&&(t.stack||t))}}));let p=Fe(a.map(e=>e.path),i);D.writeFileSync(k.join(r,`sitemap.xml`),p,`utf-8`);let m=Le(i);D.writeFileSync(k.join(r,`robots.txt`),m,`utf-8`),console.log(`[boltdocs] Generated ${a.length} static pages + sitemap.xml + robots.txt`);let{flushCache:g}=await import(`./cache-DFdakSmR.mjs`).then(e=>(e.i(),e.r));await g()}var Be,U,Ve,He=t((()=>{xe(),s(),Pe(),Ie(),Re(),Be=A(import.meta.url),U=k.dirname(Be),Ve=j(import.meta.url)}));function Ue(e,t){let n=e.homePage?`import HomePage from '${p(e.homePage)}';`:``,r=k.resolve(process.cwd(),`index.css`),i=D.existsSync(r)?`import './index.css';`:``,a=e.homePage?`homePage: HomePage,`:``,o=t?.plugins?.flatMap(e=>Object.entries(e.components||{}))||[],s=o.map(([e,t])=>`import * as _comp_${e} from '${p(t)}';
18
- const ${e} = _comp_${e}.default || _comp_${e}['${e}'] || _comp_${e};`).join(`
19
- `),c=o.map(([e])=>e).join(`, `),l=k.basename(e.docsDir||`docs`),u=k.resolve(process.cwd(),e.docsDir||`docs`),d=[`tsx`,`ts`,`jsx`,`js`].map(e=>k.resolve(u,`pages-external/index.${e}`)).find(e=>D.existsSync(e)),f=d?`import * as _external_module from '${p(d)}';`:``;return a=d?`homePage: _external_module.homePage || HomePage,`:e.homePage?`homePage: HomePage,`:``,`
20
- import { createBoltdocsApp as _createApp } from 'boltdocs/client';
21
- import _routes from 'virtual:boltdocs-routes';
22
- import _config from 'virtual:boltdocs-config';
23
- import _user_mdx_components from 'virtual:boltdocs-mdx-components';
24
- ${i}
25
- ${n}
26
- ${s}
27
- ${f}
28
-
29
- _createApp({
30
- target: '#root',
31
- routes: _routes,
32
- docsDirName: '${l}',
33
- config: _config,
34
- modules: import.meta.glob('/${l}/**/*.{md,mdx}'),
35
- hot: import.meta.hot,
36
- ${a}
37
- ${d?`externalPages: _external_module.pages, externalLayout: _external_module.layout,`:``}
38
- components: { ${c}${c?`, `:``} ...(_user_mdx_components || {}) },
39
- });
40
- `}var We=t((()=>{s()}));function Ge(e){return`<!doctype html>
41
- <html lang="en">
42
- <head>
43
- <meta charset="UTF-8" />
44
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
45
- <title>${e.theme?.title||`Boltdocs`}</title>
46
- </head>
47
- <body>
48
- <div id="root"></div>
49
- </body>
50
- </html>`}function Ke(e,t){let n=t.theme,r=n?.title||`Boltdocs`,i=n?.description||``,a=n?.favicon;!a&&n?.logo&&(a=typeof n.logo==`string`?n.logo:n.logo.light||n.logo.dark);let o=[a?`<link rel="icon" href="${a}">`:``,`<meta name="description" content="${i}">`,`<meta property="og:title" content="${r}">`,`<meta property="og:description" content="${i}">`,n?.ogImage?`<meta property="og:image" content="${n.ogImage}">`:``,`<meta property="og:type" content="website">`,`<meta name="twitter:card" content="summary_large_image">`,`<meta name="twitter:title" content="${r}">`,`<meta name="twitter:description" content="${i}">`,n?.ogImage?`<meta name="twitter:image" content="${n.ogImage}">`:``,`<meta name="generator" content="Boltdocs">`].filter(Boolean).join(`
51
- `);return e=e.includes(`<title>`)?e.replace(/<title>.*?<\/title>/,`<title>${r}</title>`):e.replace(`</head>`,` <title>${r}</title>\n </head>`),e=e.replace(`</head>`,` ${o}\n
52
- <script>
53
- (function() {
54
- try {
55
- var stored = localStorage.getItem("boltdocs-theme");
56
- var theme = stored || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
57
- if (theme === "light") {
58
- document.documentElement.classList.add("theme-light");
59
- document.documentElement.dataset.theme = "light";
60
- } else {
61
- document.documentElement.classList.remove("theme-light");
62
- document.documentElement.dataset.theme = "dark";
63
- }
64
- } catch (e) {}
65
- })();
66
- <\/script>
67
- </head>`),!e.includes(`src/main`)&&!e.includes(`virtual:boltdocs-entry`)&&(e=e.replace(`</body>`,` <script type="module">import "virtual:boltdocs-entry";<\/script>
68
- </body>`)),e}var qe=t((()=>{}));function Je(e){let t=[];for(let n of e)if(t.push({id:n.path,title:n.title,content:n._content||``,url:n.path,display:n.groupTitle?`${n.groupTitle} > ${n.title}`:n.title,locale:n.locale,version:n.version}),n.headings)for(let e of n.headings)t.push({id:`${n.path}#${e.id}`,title:e.text,content:`${e.text} in ${n.title}`,url:`${n.path}#${e.id}`,display:`${n.title} > ${e.text}`,locale:n.locale,version:n.version});return t}var Ye=t((()=>{})),Xe,Ze=t((()=>{Xe={"X-Content-Type-Options":`nosniff`,"X-Frame-Options":`DENY`,"X-XSS-Protection":`1; mode=block`,"Referrer-Policy":`strict-origin-when-cross-origin`,"Permissions-Policy":`camera=(), microphone=(), geolocation=()`,"Strict-Transport-Security":`max-age=31536000; includeSubDomains`}}));function Qe(e){let t=process.env.NODE_ENV===`development`,n={"default-src":[`'self'`],"script-src":[`'self'`,`'unsafe-inline'`],"style-src":[`'self'`,`'unsafe-inline'`],"img-src":[`'self'`,`data:`,`https:`],"font-src":[`'self'`],"connect-src":[`'self'`]};return t&&(n[`script-src`]=[`'self'`,`'unsafe-eval'`,`'unsafe-inline'`],n[`style-src`]=[`'self'`,`'unsafe-inline'`]),Object.entries(n).map(([e,t])=>`${e} ${t.join(` `)}`).join(`; `)}var $e=t((()=>{})),et=t((()=>{})),W,G,tt,K,nt,q=t((()=>{W=class e extends Error{pluginName;constructor(t,n){super(`[plugin:${t}] ${n}`),this.name=`PluginError`,this.pluginName=t,Object.setPrototypeOf(this,e.prototype)}},G=class e extends W{constructor(t,n){super(t,`Validation failed: ${n}`),this.name=`PluginValidationError`,Object.setPrototypeOf(this,e.prototype)}},tt=class e extends W{constructor(t,n){super(t,`Compatibility error: ${n}`),this.name=`PluginCompatibilityError`,Object.setPrototypeOf(this,e.prototype)}},K=class e extends W{constructor(t,n){super(t,`Missing required permission: '${n}'`),this.name=`PluginPermissionError`,Object.setPrototypeOf(this,e.prototype)}},nt=class e extends W{hookName;constructor(t,n,r){super(t,`Error in hook '${n}': ${r.message}`),this.name=`PluginHookError`,this.hookName=n,this.stack=r.stack,Object.setPrototypeOf(this,e.prototype)}}})),rt,it=t((()=>{rt=class{data=new Map;getNamespaceKey(e,t){return`${e}:${t}`}get(e,t){let n=this.getNamespaceKey(e,t),r=this.data.get(n);if(r!==void 0)return typeof r==`object`&&r?JSON.parse(JSON.stringify(r)):r}set(e,t,n){let r=this.getNamespaceKey(e,t),i=typeof n==`object`&&n?JSON.parse(JSON.stringify(n)):n;this.data.set(r,i)}has(e,t){let n=this.getNamespaceKey(e,t);return this.data.has(n)}}}));function at(e,t){let n=[],r=new Set;for(let i of e){let e=ot.safeParse(i);if(!e.success)throw new G(i.name||`unknown`,e.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`, `));let a=e.data;if(r.has(a.name))throw new G(a.name,`Duplicate plugin name detected`);if(r.add(a.name),a.boltdocsVersion&&!ae.satisfies(t,a.boltdocsVersion))throw new tt(a.name,`Plugin expects Boltdocs version ${a.boltdocsVersion}, but current is ${t}`);if(a.components){for(let[e,t]of Object.entries(a.components))if((t.includes(`..`)||k.isAbsolute(t))&&t.includes(`..`))throw new G(a.name,`Component '${e}' has an invalid path: traversal sequences are not allowed.`)}n.push(a)}return n}function J(e,t){return e.permissions?e.permissions.includes(t):!1}var ot,st=t((()=>{je(),q(),ot=z.extend({version:O.string().optional(),boltdocsVersion:O.string().optional(),permissions:O.array(O.string()).optional(),hooks:O.object({beforeBuild:O.function().optional(),afterBuild:O.function().optional(),beforeDev:O.function().optional(),afterDev:O.function().optional(),configResolved:O.function().optional(),buildEnd:O.function().optional()}).optional()})})),Y,ct=t((()=>{q(),st(),Y=class{static checkPermission(e,t){if(!J(e,t))throw new K(e.name,t)}static getSanitizedCapabilities(e){return{remarkPlugins:J(e,`mdx:remark`)?e.remarkPlugins:[],rehypePlugins:J(e,`mdx:rehype`)?e.rehypePlugins:[],vitePlugins:J(e,`vite:config`)?e.vitePlugins:[],components:J(e,`components`)?e.components:{}}}static async executeWithIsolation(e,t,n,r){try{return this.checkPermission(e,t),await r()}catch(t){if(t instanceof K){console.warn(`[boltdocs] Skipping hook '${n}' for plugin '${e.name}': ${t.message}`);return}throw t}}}})),lt,ut=t((()=>{q(),it(),ct(),lt=class{plugins;config;store;constructor(e,t){this.plugins=e,this.config=t,this.store=new rt}async runHook(e,...t){let n=this.getSortedPlugins();for(let r of n){if(!r.hooks?.[e])continue;let n=this.createContext(r),i=e.toLowerCase().includes(`build`),a=e.toLowerCase().includes(`dev`),o=i?`hooks:build`:a?`hooks:dev`:void 0;try{o?await Y.executeWithIsolation(r,o,e,()=>r.hooks[e](n,...t)):await r.hooks[e](n,...t)}catch(t){let i=new nt(r.name,e,t instanceof Error?t:Error(String(t)));n.logger.error(i)}}}getSortedPlugins(){let e=this.plugins.filter(e=>e.enforce===`pre`),t=this.plugins.filter(e=>!e.enforce),n=this.plugins.filter(e=>e.enforce===`post`);return[...e,...t,...n]}createContext(e){return{config:Object.freeze({...this.config}),meta:{name:e.name,version:e.version,boltdocsVersion:e.boltdocsVersion},store:{get:(e,t)=>this.store.get(e,t),set:(e,t,n)=>this.store.set(e,t,n),has:(e,t)=>this.store.has(e,t)},logger:this.createLogger(e.name)}}createLogger(e){let t=`[plugin:${e}]`;return{info:e=>console.log(`${t} INFO: ${e}`),warn:e=>console.warn(`${t} WARN: ${e}`),error:e=>{let n=e instanceof Error?e.message:e;console.error(`${t} ERROR: ${n}`)},debug:e=>console.debug(`${t} DEBUG: ${e}`)}}}}));function dt(e){return e}var ft=t((()=>{et(),q(),it(),st(),ct(),ut()})),pt=t((()=>{}));function mt(e={},t){let n=k.resolve(process.cwd(),e.docsDir||`docs`),r=p(n),i=t,a,o=!1,s,l=[];return[{name:`vite-plugin-boltdocs`,enforce:`pre`,async config(e,t){o=t.command===`build`;let r=e.envDir||process.cwd(),a=T(t.mode,r,``);Object.assign(process.env,a),i||=await B(n);let c=(await import(`./package-OFZf0s2j.mjs`)).version,u=at(i.plugins||[],c);return i.plugins=u,s=new lt(u,i),l=u.flatMap(e=>Y.getSanitizedCapabilities(e).vitePlugins||[]),o&&await s.runHook(`beforeBuild`),{optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`],exclude:[`boltdocs`,`boltdocs/client`]},resolve:{dedupe:[`react`,`react-dom`]}}},configResolved(e){a=e,s?.runHook(`configResolved`,i)},async configureServer(e){await s?.runHook(`beforeDev`),e.middlewares.use((e,t,n)=>{process.env.NODE_ENV===`production`&&Object.entries(Xe).forEach(([e,n])=>{t.setHeader(e,n)}),i.security?.enableCSP&&t.setHeader(`Content-Security-Policy`,Qe(i)),n()}),e.middlewares.use((e,t,n)=>{if(e.url===`/robots.txt`){let e=Le(i);t.statusCode=200,t.setHeader(`Content-Type`,`text/plain`),t.end(e);return}n()}),e.middlewares.use(async(t,n,r)=>{let a=t.url?.split(`?`)[0]||`/`,o=t.headers.accept||``,s=a===`/`||a.startsWith(`/docs`)||i.i18n&&Object.keys(i.i18n.locales).some(e=>a.startsWith(`/${e}/docs`)||a===`/${e}`)||!0,c=/\.(js|css|png|jpe?g|gif|svg|ico|webp|woff2?|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac|pdf|zip|gz|map|json)$/i.test(a);if(o.includes(`text/html`)&&!c&&s){let r=Ge(i);r=Ke(r,i),r=await e.transformIndexHtml(t.url||`/`,r),n.statusCode=200,n.setHeader(`Content-Type`,`text/html`),n.end(r);return}r()});let t=V.map(e=>k.resolve(process.cwd(),e)),a=[`tsx`,`jsx`],o=a.map(e=>k.resolve(n,`layout.${e}`)),l=[`tsx`,`ts`,`jsx`,`js`],u=l.map(e=>k.resolve(n,`mdx-components.${e}`)),d=l.map(e=>k.resolve(n,`pages-external/index.${e}`));e.watcher.add([...t,...u,...o,...d]);let f=async(t,o)=>{try{let s=p(t);if(V.some(e=>s.endsWith(e))){e.restart();return}if(l.some(e=>s.endsWith(`mdx-components.${e}`))){let t=e.moduleGraph.getModuleById(`\0virtual:boltdocs-mdx-components`);t&&e.moduleGraph.invalidateModule(t),e.ws.send({type:`full-reload`});return}if(a.some(e=>s.endsWith(`layout.${e}`))){let t=e.moduleGraph.getModuleById(`\0virtual:boltdocs-layout`);t&&e.moduleGraph.invalidateModule(t),e.ws.send({type:`full-reload`});return}if(s.includes(`/pages-external/`)||s.includes(`\\pages-external\\`)){let t=e.moduleGraph.getModuleById(`\0virtual:boltdocs-entry`);t&&e.moduleGraph.invalidateModule(t),e.ws.send({type:`full-reload`});return}if(!s.startsWith(r)||!c(s))return;if(o===`add`||o===`unlink`){le(),i=await B(n);let t=e.moduleGraph.getModuleById(`\0virtual:boltdocs-config`);t&&e.moduleGraph.invalidateModule(t),e.ws.send({type:`custom`,event:`boltdocs:config-update`,data:{theme:i?.theme,i18n:i?.i18n,versions:i?.versions,siteUrl:i?.siteUrl}})}else ue(t);let u=await I(n,i,`/docs`,o!==`change`),d=e.moduleGraph.getModuleById(`\0virtual:boltdocs-routes`);d&&e.moduleGraph.invalidateModule(d),e.ws.send({type:`custom`,event:`boltdocs:routes-update`,data:u})}catch(e){console.error(`[boltdocs] HMR error during ${o} event:`,e)}};e.watcher.on(`add`,e=>f(e,`add`)),e.watcher.on(`unlink`,e=>f(e,`unlink`)),e.watcher.on(`change`,e=>f(e,`change`)),await s?.runHook(`afterDev`)},resolveId(e){if(e===`virtual:boltdocs-routes`||e===`virtual:boltdocs-config`||e===`virtual:boltdocs-entry`||e===`virtual:boltdocs-mdx-components`||e===`virtual:boltdocs-layout`||e===`virtual:boltdocs-search`)return`\0`+e},async load(t){if(t===`\0virtual:boltdocs-routes`){let e=await I(n,i);return`export default ${JSON.stringify(e,null,2)};`}if(t===`\0virtual:boltdocs-config`){let e={theme:i?.theme,i18n:i?.i18n,versions:i?.versions,siteUrl:i?.siteUrl,plugins:i?.plugins?.map(e=>({name:e.name}))};return`export default ${JSON.stringify(e,null,2)};`}if(t===`\0virtual:boltdocs-entry`)return Ue(e,i);if(t===`\0virtual:boltdocs-mdx-components`){let e=[`tsx`,`ts`,`jsx`,`js`],t=null;for(let r of e){let e=k.resolve(n,`mdx-components.${r}`);if(D.existsSync(e)){t=e;break}}if(t){let e=p(t);return`import * as components from '${e}';
69
- const mdxComponents = components.default || components;
70
- export default mdxComponents;
71
- export * from '${e}';`}return`export default {};`}if(t===`\0virtual:boltdocs-layout`){let e=[`tsx`,`jsx`],t=null;for(let r of e){let e=k.resolve(n,`layout.${r}`);if(D.existsSync(e)){t=e;break}}return t?`import UserLayout from '${p(t)}';
72
- export default UserLayout;`:`import { DefaultLayout } from 'boltdocs/client';
73
- export default DefaultLayout;`}if(t===`\0virtual:boltdocs-search`){let e=Je(await I(n,i));return`export default ${JSON.stringify(e,null,2)};`}},transformIndexHtml:{order:`pre`,handler(e){return Ke(e,i)}},async closeBundle(){if(!o)return;let e=a?.build?.outDir?k.resolve(a.root,a.build.outDir):k.resolve(process.cwd(),`dist`);await ze({docsDir:n,docsDirName:k.basename(n||`docs`),outDir:e,config:i});let{flushCache:t}=await import(`./cache-DFdakSmR.mjs`).then(e=>(e.i(),e.r));await t(),await s?.runHook(`afterBuild`),await s?.runHook(`buildEnd`)}},ie({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:`preset-default`}]}}),{name:`vite-plugin-boltdocs-extra-plugins`,async configResolved(){}},...l]}var ht=t((()=>{xe(),H(),He(),s(),We(),qe(),Re(),Ye(),Ze(),$e(),ft(),pt()})),X,gt=t((()=>{d(),X=new m(`mdx`)}));async function _t(e){if(Z)return Z;let t=typeof e==`object`?[e.light,e.dark]:[e??`github-dark`];return[`github-light`,`github-dark`].forEach(e=>{t.includes(e)||t.push(e)}),Z=await P({themes:t,langs:[`tsx`,`jsx`,`ts`,`js`,`json`,`md`,`mdx`,`css`,`html`,`bash`,`sh`,`yaml`,`yml`]}),Z}var Z,vt=t((()=>{Z=null}));function yt(e){return async t=>{let n=e?.theme?.codeTheme??{light:`github-light`,dark:`github-dark`},r=await _t(n);N(t,[`mdxJsxFlowElement`,`mdxJsxTextElement`],e=>{if(e.name!==`ComponentPreview`)return;let t=e.attributes?.find(e=>e.name===`code`),i=``;if(t){if(typeof t.value==`string`)i=t.value;else if(t.value?.type===`mdxJsxAttributeValueExpression`){let e=t.value.value??``;i=e.match(/^[`'"]([\s\S]+)[`'"]$/)?.[1]??e}}if(!i)return;let a=typeof n==`object`?{themes:{light:n.light,dark:n.dark},lang:`tsx`}:{theme:n,lang:`tsx`},o=r.codeToHtml(i,a);e.attributes=(e.attributes??[]).filter(e=>e.name!==`highlightedHtml`),e.attributes.push({type:`mdxJsxAttribute`,name:`highlightedHtml`,value:o})})}}var bt=t((()=>{vt()}));function xt(e){return async t=>{let n=e?.theme?.codeTheme||{light:`github-light`,dark:`github-dark`},r=await _t(n);N(t,`element`,e=>{if(e.tagName===`pre`&&e.children?.[0]?.tagName===`code`){let t=e.children[0],i=(t.properties?.className||[]).find(e=>e.startsWith(`language-`)),a=i?i.slice(9):`text`,o=t.children[0]?.value||``,s=(t.data?.meta||t.properties?.metastring||``).match(/title\s*=\s*"([^"]*)"/),c=s?s[1]:void 0,l={lang:a};typeof n==`object`?l.themes={light:n.light,dark:n.dark}:l.theme=n;let u=r.codeToHtml(o,l);e.properties[`data-highlighted`]=`true`,e.properties[`data-highlighted-html`]=u,e.properties[`data-lang`]=a,c&&(e.properties.title=c),e.children=[]}})}}var St=t((()=>{vt()}));function Ct(){return e=>{N(e,`code`,e=>{if(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.lang&&(e.data.hProperties[`data-lang`]=e.lang),!e.meta)return;let t=e.meta,n=t.match(/title\s*=\s*"([^"]*)"/);n&&(e.data.hProperties.title=n[1]),e.data.hProperties.metastring=t})}}var wt=t((()=>{}));function Tt(e,t=oe){let n=e?.plugins?.flatMap(e=>Y.getSanitizedCapabilities(e).remarkPlugins||[])||[],r=e?.plugins?.flatMap(e=>Y.getSanitizedCapabilities(e).rehypePlugins||[])||[],i=t({remarkPlugins:[se,ce,Ct,[yt,e],...n],rehypePlugins:[M,[xt,e],...r],jsxRuntime:`automatic`});return{...i,name:`vite-plugin-boltdocs-mdx`,async buildStart(){Q=0,$=0,Et||=(X.load(),!0),i.buildStart&&await i.buildStart.call(this)},async transform(e,t,n){if(!t.endsWith(`.md`)&&!t.endsWith(`.mdx`))return i.transform?.call(this,e,t,n);console.log(`[boltdocs] Transforming MDX: ${t}`),$++;let r=`${t}:${ne.createHash(`md5`).update(e).digest(`hex`)}:v4`,a=X.get(r);if(a)return Q++,{code:a,map:null};let o=await i.transform.call(this,e,t,n);return o&&typeof o==`object`&&o.code&&X.set(r,o.code),o},async buildEnd(){$>0&&console.log(`[boltdocs] MDX Cache Performance: ${Q}/${$} hits (${Math.round(Q/$*100)||0}%)`),X.save(),await X.flush(),i.buildEnd&&await i.buildEnd.call(this)}}}var Et,Q,$,Dt=t((()=>{gt(),bt(),St(),wt(),ft(),Et=!1,Q=0,$=0}));async function Ot(e){let t=await B(e?.docsDir||`docs`);return[...mt({...e,homePage:e?.homePage||t.homePage},t),Tt(t)]}async function kt(e,t=`development`){let n=await B(`docs`,e),r=t===`production`?{...Xe}:{};return n.security?.enableCSP&&(r[`Content-Security-Policy`]=Qe(n)),{root:e,mode:t,plugins:[C(),w(),await Ot({docsDir:n.docsDir,homePage:n.homePage})],resolve:{alias:{"use-sync-external-store/shim/index.js":`react`,"use-sync-external-store/shim":`react`,"use-sync-external-store":`react`}},server:{headers:{...r,...n.vite?.server?.headers},...n.vite?.server},preview:{headers:{...r,...n.vite?.preview?.headers},...n.vite?.preview},...n.vite}}var At=t((()=>{ht(),Dt(),Ze(),$e(),H(),He(),ft()}));export{qe as _,lt as a,H as b,J as c,tt as d,W as f,Ge as g,G as h,dt as i,at as l,K as m,kt as n,Y as o,nt as p,At as r,ot as s,Ot as t,rt as u,ze as v,B as x,Me as y};
@@ -1,73 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- const e=require(`./cache-Cr8W2zgZ.cjs`);let t=require(`@vitejs/plugin-react`);t=e.S(t);let n=require(`@tailwindcss/vite`);n=e.S(n);let r=require(`vite`),i=require(`fast-glob`);i=e.S(i);let a=require(`fs`);a=e.S(a);let o=require(`zod`),s=require(`path`);s=e.S(s);let c=require(`crypto`);c=e.S(c);let l=require(`github-slugger`);l=e.S(l);let u=require(`vite-plugin-image-optimizer`),d=require(`url`),f=require(`module`),p=require(`semver`);p=e.S(p);let m=require(`@mdx-js/rollup`);m=e.S(m);let h=require(`remark-gfm`);h=e.S(h);let g=require(`remark-frontmatter`);g=e.S(g);let _=require(`rehype-slug`);_=e.S(_);let v=require(`unist-util-visit`),y=require(`shiki`);const b=new e.t({name:`routes`});function x(){b.invalidateAll()}function S(e){b.invalidate(e)}function C(t,n,r,i){let a;try{a=decodeURIComponent(t)}catch{let n=s.default.basename(t);throw e.d(`ENCODING_ERROR`,`Invalid character encoding`,{file:n}),new e._(`Security breach: Invalid characters or encoding in path: ${n}`)}if(a.length>260){let t=s.default.basename(a);throw e.d(`PATH_TOO_LONG`,`Path length exceeds limit`,{length:a.length,file:t}),new e.v(`Security breach: Path length exceeds limit of 260 characters: ${t}`)}let o=s.default.resolve(a),c=s.default.resolve(n),u=e.f(s.default.relative(c,o));if(u.startsWith(`../`)||u===`..`||o.includes(`\0`)||!e.b.test(u)){let n=s.default.basename(t);throw e.d(`PATH_TRAVERSAL_ATTEMPT`,`Path traversal or invalid characters detected`,{path:u}),new e.v(`Security breach: File is outside of docs directory, contains null bytes, or invalid characters: ${n}`)}let{data:d,content:f}=e.p(t),p=u.split(`/`),m,h;if(i?.versions&&p.length>0){let e=p[0],t=i.versions.prefix||``,n=i.versions.versions.find(n=>e===t+n.path||e===n.path);n&&(h=n.path,p=p.slice(1))}if(i?.i18n&&p.length>0){let e=p[0];i.i18n.locales[e]&&(m=e,p=p.slice(1))}let g;if(p.length>0){let e=p[0].match(/^\((.+)\)$/);e&&(g=e[1].toLowerCase(),p=p.slice(1))}let _=p.join(`/`),v;v=d.permalink?d.permalink.startsWith(`/`)?d.permalink:`/${d.permalink}`:e.c(_||`index.md`);let y=r;h&&(y+=`/`+h),m&&(y+=`/`+m),g&&(y+=`/`+g),y+=v===`/`?``:v,(!y||y===``)&&(y=`/`);let b=p[p.length-1],x=e.g(b),S=e.g(s.default.basename(t,s.default.extname(t))),C=d.sidebarPosition??e.s(b),w=p.length>=2?p[0]:void 0,T=w?e.g(w):void 0,E=p.length>=2&&/^index\.mdx?$/.test(x),D=new l.default,O=[];for(let t of f.matchAll(/^(#{2,4})\s+(.+)$/gm)){let n=t[1].length,r=e.m(t[2].replace(/\[([^\]]+)\]\([^\)]+\)/g,`$1`).replace(/[_*`]/g,``).trim()).trim(),i=D.slug(r);O.push({level:n,text:r,id:i})}let k=d.title?e.m(String(d.title)):S,A=d.description?e.m(String(d.description)):``;!A&&f&&(A=e.h(f.replace(/^#+.*$/gm,``).replace(/\[([^\]]+)\]\([^\)]+\)/g,`$1`).replace(/[_*`]/g,``).replace(/\s+/g,` `)).trim().slice(0,160));let j=d.badge?e.m(String(d.badge)):void 0,M=d.icon?String(d.icon):void 0,N=ee(f);return{route:{path:y,componentPath:t,filePath:u,title:k,description:A,sidebarPosition:C,headings:O,locale:m,version:h,badge:j,icon:M,tab:g,_content:N,_rawContent:f},relativeDir:T,isGroupIndex:E,inferredTab:g,groupMeta:E?{title:d.groupTitle||d.title||(T?e.i(T):``),position:d.groupPosition??d.sidebarPosition??(w?e.s(w):void 0),icon:M}:void 0,inferredGroupPosition:w?e.s(w):void 0}}function ee(t){return e.h(t.replace(/^#+.*$/gm,``).replace(/\[([^\]]+)\]\([^\)]+\)/g,`$1`).replace(/\{[^\}]+\}/g,``).replace(/[_*`]/g,``).replace(/\s+/g,` `)).trim()}function w(e){return e.sort((e,t)=>!e.group&&!t.group?T(e,t):e.group?t.group?e.group===t.group?T(e,t):E(e,t):1:-1)}function T(e,t){return e.sidebarPosition!==void 0&&t.sidebarPosition!==void 0?e.sidebarPosition-t.sidebarPosition:e.sidebarPosition===void 0?t.sidebarPosition===void 0?e.title.localeCompare(t.title):1:-1}function E(e,t){return e.groupPosition!==void 0&&t.groupPosition!==void 0?e.groupPosition-t.groupPosition:e.groupPosition===void 0?t.groupPosition===void 0?(e.groupTitle||e.group).localeCompare(t.groupTitle||t.group):1:-1}let D=null;const O=new Map;async function k(t,n,r=`/docs`,a=!0){let o=performance.now();b.load(),O.clear(),(process.env.BOLTDOCS_FORCE_REPARSE===`true`||n?.i18n)&&b.invalidateAll();let s;!a&&D?s=D:(s=await(0,i.default)([`**/*.md`,`**/*.mdx`],{cwd:t,absolute:!0,suppressErrors:!0,followSymbolicLinks:!1}),D=s),b.pruneStale(new Set(s));let c=[],l=0;for(let e=0;e<s.length;e+=50){let i=s.slice(e,e+50),a=await Promise.all(i.map(async e=>{let i=b.get(e);if(i)return l++,i;let a=C(e,t,r,n);return b.set(e,a),a}));c.push(...a),e+50<s.length&&await new Promise(e=>setImmediate(e))}b.save();let u=new Map,d=[];for(let t of c)if(t.isGroupIndex&&t.relativeDir&&d.push(t),t.relativeDir){let n=u.get(t.relativeDir);n?(n.position===void 0&&t.inferredGroupPosition!==void 0&&(n.position=t.inferredGroupPosition),!n.icon&&t.route.icon&&(n.icon=t.route.icon)):(n={title:e.i(t.relativeDir),position:t.inferredGroupPosition,icon:t.route.icon},u.set(t.relativeDir,n))}for(let e of d){let t=u.get(e.relativeDir);e.groupMeta&&(t.title=e.groupMeta.title,e.groupMeta.position!==void 0&&(t.position=e.groupMeta.position),e.groupMeta.icon&&(t.icon=e.groupMeta.icon))}let f=Array(c.length);for(let t=0;t<c.length;t++){let n=c[t],r=n.relativeDir,i=r?u.get(r):void 0;f[t]={...n.route,group:r,groupTitle:i?.title||(r?e.i(r):void 0),groupPosition:i?.position,groupIcon:i?.icon}}let p=f;if(n?.i18n){let e=A(f,n,r);p=[...f,...e]}let m=w(p),h=performance.now()-o;return console.log(`[boltdocs] Route generation: ${h.toFixed(2)}ms (${s.length} files, ${l} cache hits)`),m}function A(e,t,n){let r=t.i18n.defaultLocale,i=Object.keys(t.i18n.locales),a=[],o=new Map,s=[];for(let t of e){let e=t.locale||r;o.has(e)||o.set(e,new Set),o.get(e).add(t.path),e===r&&s.push(t)}for(let e of i){let i=o.get(e)||new Set;for(let o of s){let s=j(o.path,r,e,n,t);s!==o.path&&(i.has(s)||a.push({...o,path:s,locale:e}))}}return a}function j(e,t,n,r,i){let a=`${e}:${n}`,o=O.get(a);if(o)return o;let s=r;if(i?.versions){let t=i.versions.prefix||``;for(let n of i.versions.versions){let i=t+n.path;if(e.startsWith(`${r}/${i}`)){s+=`/`+i;break}if(e.startsWith(`${r}/${n.path}`)){s+=`/`+n.path;break}}}let c=e.substring(s.length),l=`/${t}`;if(c.startsWith(l+`/`))c=`/`+n+`/`+c.substring(l.length+1);else if(c===l)c=`/`+n;else if(c===`/`||c===``)c=`/`+n;else{let e=c.startsWith(`/`)?``:`/`;c=`/`+n+e+c}let u=s+c;return O.size>2e3&&O.clear(),O.set(a,u),u}const M=o.z.object({icon:o.z.string().max(50),link:o.z.string().url()}),N=o.z.object({text:o.z.string().max(2e3).optional()}),te=o.z.enum([`fs:read`,`fs:write`,`vite:config`,`mdx:remark`,`mdx:rehype`,`components`,`hooks:build`,`hooks:dev`]),P=o.z.object({name:o.z.string(),enforce:o.z.enum([`pre`,`post`]).optional(),version:o.z.string().optional(),boltdocsVersion:o.z.string().optional(),permissions:o.z.array(te).optional(),remarkPlugins:o.z.array(o.z.any()).optional(),rehypePlugins:o.z.array(o.z.any()).optional(),vitePlugins:o.z.array(o.z.any()).optional(),components:o.z.record(o.z.string(),o.z.string()).optional(),hooks:o.z.record(o.z.string(),o.z.any()).optional()}),ne=o.z.object({title:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]).optional(),description:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]).optional(),logo:o.z.union([o.z.string(),o.z.object({dark:o.z.string(),light:o.z.string(),alt:o.z.string().optional(),width:o.z.number().optional(),height:o.z.number().optional()})]).optional(),navbar:o.z.array(o.z.object({label:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]),href:o.z.string()})).optional(),sidebar:o.z.record(o.z.string(),o.z.array(o.z.object({text:o.z.string(),link:o.z.string()}))).optional(),socialLinks:o.z.array(M).optional(),footer:N.optional(),breadcrumbs:o.z.boolean().optional(),editLink:o.z.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:o.z.string().url().optional(),version:o.z.string().max(50).optional(),githubRepo:o.z.string().max(100).optional(),favicon:o.z.string().optional(),ogImage:o.z.string().optional(),poweredBy:o.z.boolean().optional(),tabs:o.z.array(o.z.object({id:o.z.string(),text:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]),icon:o.z.string().optional()})).optional(),codeTheme:o.z.union([o.z.string(),o.z.object({light:o.z.string(),dark:o.z.string()})]).optional(),copyMarkdown:o.z.union([o.z.boolean(),o.z.object({text:o.z.string().optional(),icon:o.z.string().optional()})]).optional()}),re=o.z.union([o.z.string(),o.z.object({rules:o.z.array(o.z.object({userAgent:o.z.string(),allow:o.z.union([o.z.string(),o.z.array(o.z.string())]).optional(),disallow:o.z.union([o.z.string(),o.z.array(o.z.string())]).optional()})).optional(),sitemaps:o.z.array(o.z.string().url()).optional()})]),ie=o.z.object({defaultLocale:o.z.string(),locales:o.z.record(o.z.string(),o.z.string()),localeConfigs:o.z.record(o.z.string(),o.z.object({label:o.z.string().optional(),direction:o.z.enum([`ltr`,`rtl`]).optional(),htmlLang:o.z.string().optional(),calendar:o.z.string().optional()})).optional()}),ae=o.z.object({defaultVersion:o.z.string(),prefix:o.z.string().optional(),versions:o.z.array(o.z.object({label:o.z.string(),path:o.z.string()}))}),oe=o.z.object({headers:o.z.record(o.z.string(),o.z.string()).optional(),enableCSP:o.z.boolean().optional(),customHeaders:o.z.record(o.z.string(),o.z.string()).optional()}),se=o.z.object({siteUrl:o.z.string().url().optional(),docsDir:o.z.string().optional(),homePage:o.z.string().optional(),theme:ne.optional(),i18n:ie.optional(),versions:ae.optional(),plugins:o.z.array(P).optional(),robots:re.optional(),security:oe.optional(),vite:o.z.record(o.z.string(),o.z.unknown()).optional()});function ce(e){return e}const F=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function I(t,n=process.cwd()){let i=n,o={docsDir:s.default.resolve(t),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`},poweredBy:!0,breadcrumbs:!0}},c={};for(let e of F){let t=s.default.resolve(i,e);if(a.default.existsSync(t))try{let e=await(0,r.loadConfigFromFile)({command:`serve`,mode:`development`},t,i);if(e){c=e.config;break}}catch(t){console.warn(`[boltdocs] Failed to load config from ${e}:`,t)}}let l={title:c.title,description:c.description,logo:c.logo,favicon:c.favicon,ogImage:c.ogImage,navbar:c.navbar,sidebar:c.sidebar,socialLinks:c.socialLinks,footer:c.footer,githubRepo:c.githubRepo,tabs:c.tabs,codeTheme:c.codeTheme,copyMarkdown:c.copyMarkdown,breadcrumbs:c.breadcrumbs,poweredBy:c.poweredBy,communityHelp:c.communityHelp,version:c.version,editLink:c.editLink,...c.theme||{}},u=Object.fromEntries(Object.entries(l).filter(([e,t])=>t!==void 0));u.navbar&&=u.navbar.map(e=>({label:e.label||e.text||``,href:e.href||e.link||e.to||``}));let d={docsDir:s.default.resolve(t),homePage:c.homePage,theme:{...o.theme,...u},i18n:c.i18n,versions:c.versions,siteUrl:c.siteUrl,plugins:c.plugins||[],robots:c.robots,security:c.security,vite:c.vite},f=se.safeParse(d);if(!f.success)throw new e.y(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
7
- `)}`);return f.data}function le(t,n){let r=e.a(n.title),i=e.a(n.description);return t.replace(/<title>.*?<\/title>/,`<title>${r}</title>`).replace(/(<meta name="description" content=")[^"]*(")/,`$1${i}$2`).replace(/(<meta property="og:title" content=")[^"]*(")/,`$1${r}$2`).replace(/(<meta property="og:description" content=")[^"]*(")/,`$1${i}$2`).replace(/(<meta name="twitter:title" content=")[^"]*(")/,`$1${r}$2`).replace(/(<meta name="twitter:description" content=")[^"]*(")/,`$1${i}$2`)}function ue(t,n){let r=n?.siteUrl?.replace(/\/$/,``)||`https://example.com`,i=new Date().toISOString().split(`T`)[0],a=[{url:`/`,priority:`1.0`,changefreq:`daily`}];if(n?.i18n){let e=n.i18n.defaultLocale;for(let t of Object.keys(n.i18n.locales))t!==e&&a.push({url:`/${t}/`,priority:`1.0`,changefreq:`daily`})}return`<?xml version="1.0" encoding="UTF-8"?>
8
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
9
- ${[...a,...t.map(e=>({url:e,priority:`0.8`,changefreq:`weekly`}))].map(t=>` <url>
10
- <loc>${e.o(r)}${e.o(t.url)}</loc>
11
- <lastmod>${i}</lastmod>
12
- <changefreq>${t.changefreq}</changefreq>
13
- <priority>${t.priority}</priority>
14
- </url>`).join(`
15
- `)}
16
- </urlset>`}function de(e){if(typeof e.robots==`string`)return e.robots;let t=e.siteUrl?.replace(/\/$/,``)||``,n=e.robots||{},r=n.rules||[{userAgent:`*`,allow:`/`}],i=n.sitemaps||(t?[`${t}/sitemap.xml`]:[]),a=``;for(let e of r){if(a+=`User-agent: ${e.userAgent}\n`,e.disallow){let t=Array.isArray(e.disallow)?e.disallow:[e.disallow];for(let e of t)a+=`Disallow: ${e}\n`}if(e.allow){let t=Array.isArray(e.allow)?e.allow:[e.allow];for(let e of t)a+=`Allow: ${e}\n`}a+=`
17
- `}for(let e of i)a+=`Sitemap: ${e}\n`;return a.trim()}const fe=(0,d.fileURLToPath)(require(`url`).pathToFileURL(__filename).href),pe=s.default.dirname(fe),me=(0,f.createRequire)(require(`url`).pathToFileURL(__filename).href);async function he(t){let{docsDir:n,docsDirName:r,outDir:i,config:o}=t,c=await k(n,o),l=[`tsx`,`ts`,`jsx`,`js`].map(e=>s.default.resolve(n,`pages-external/index.${e}`)).find(e=>a.default.existsSync(e));if(l)try{let e=a.default.readFileSync(l,`utf-8`),t=e.match(/pages\s*:\s*{([^}]+)}/s);if(t){let e=t[1].split(`,`).map(e=>e.split(`:`)[0].trim().replace(/['"]/g,``)).filter(e=>e&&e.startsWith(`/`));for(let t of e)c.some(e=>e.path===t)||c.push({path:t,title:t.slice(1).charAt(0).toUpperCase()+t.slice(2),filePath:``,componentPath:``,_content:``})}e.includes(`homePage`)&&!c.some(e=>e.path===`/`)&&c.push({path:`/`,title:`Home`,filePath:``,componentPath:``,_content:``})}catch(e){console.warn(`[boltdocs] Failed to parse external routes for SSG:`,e)}let u=s.default.resolve(pe,`../client/ssr.js`);if(!a.default.existsSync(u)){console.error(`[boltdocs] SSR module not found at`,u,`- Did you build the core package?`);return}let d=me(`module`),f=d.prototype.require;d.prototype.require=function(e,...t){return e.startsWith(`virtual:boltdocs-`)?e===`virtual:boltdocs-layout`?{__esModule:!0,default:function(e){try{let t=f.apply(this,[s.default.resolve(pe,`../client/index.js`)]).DefaultLayout||(({children:e})=>e);return f.apply(this,[`react`]).createElement(t,e)}catch{return e.children}}}:e===`virtual:boltdocs-mdx-components`?{__esModule:!0,default:{}}:e===`virtual:boltdocs-config`?{__esModule:!0,default:o}:{__esModule:!0,default:e.includes(`routes`)?[]:{}}:f.apply(this,[e,...t])};let{render:p}=me(u);d.prototype.require=f;let m=s.default.join(i,`index.html`);if(!a.default.existsSync(m)){console.warn(`[boltdocs] No index.html found in outDir, skipping SSG.`);return}let h=a.default.readFileSync(m,`utf-8`);await Promise.all(c.map(async t=>{let n=e.l(o?.theme?.title,t.locale)||`Boltdocs`,l=e.l(o?.theme?.description,t.locale)||``,u=`${t.title} | ${n}`,d=t.description||l,f={};f[`/${r}/${t.filePath}`]={default:()=>null};try{let n=await p({path:t.path,routes:c,config:o||{},docsDirName:r,modules:f,homePage:void 0}),l=le(h,{title:e.a(u),description:e.a(d)}).replace(`<!--app-html-->`,n).replace(`<div id="root"></div>`,`<div id="root">${n}</div>`),m=s.default.join(i,t.path);await a.default.promises.mkdir(m,{recursive:!0}),await a.default.promises.writeFile(s.default.join(m,`index.html`),l,`utf-8`)}catch(e){console.error(`[boltdocs] Error SSR rendering route ${t.path}:`,e&&(e.stack||e))}}));let g=ue(c.map(e=>e.path),o);a.default.writeFileSync(s.default.join(i,`sitemap.xml`),g,`utf-8`);let _=de(o);a.default.writeFileSync(s.default.join(i,`robots.txt`),_,`utf-8`),console.log(`[boltdocs] Generated ${c.length} static pages + sitemap.xml + robots.txt`);let{flushCache:v}=await Promise.resolve().then(()=>require(`./cache-Cr8W2zgZ.cjs`)).then(e=>e.r);await v()}function ge(t,n){let r=t.homePage?`import HomePage from '${e.f(t.homePage)}';`:``,i=s.default.resolve(process.cwd(),`index.css`),o=a.default.existsSync(i)?`import './index.css';`:``,c=t.homePage?`homePage: HomePage,`:``,l=n?.plugins?.flatMap(e=>Object.entries(e.components||{}))||[],u=l.map(([t,n])=>`import * as _comp_${t} from '${e.f(n)}';
18
- const ${t} = _comp_${t}.default || _comp_${t}['${t}'] || _comp_${t};`).join(`
19
- `),d=l.map(([e])=>e).join(`, `),f=s.default.basename(t.docsDir||`docs`),p=s.default.resolve(process.cwd(),t.docsDir||`docs`),m=[`tsx`,`ts`,`jsx`,`js`].map(e=>s.default.resolve(p,`pages-external/index.${e}`)).find(e=>a.default.existsSync(e)),h=m?`import * as _external_module from '${e.f(m)}';`:``;return c=m?`homePage: _external_module.homePage || HomePage,`:t.homePage?`homePage: HomePage,`:``,`
20
- import { createBoltdocsApp as _createApp } from 'boltdocs/client';
21
- import _routes from 'virtual:boltdocs-routes';
22
- import _config from 'virtual:boltdocs-config';
23
- import _user_mdx_components from 'virtual:boltdocs-mdx-components';
24
- ${o}
25
- ${r}
26
- ${u}
27
- ${h}
28
-
29
- _createApp({
30
- target: '#root',
31
- routes: _routes,
32
- docsDirName: '${f}',
33
- config: _config,
34
- modules: import.meta.glob('/${f}/**/*.{md,mdx}'),
35
- hot: import.meta.hot,
36
- ${c}
37
- ${m?`externalPages: _external_module.pages, externalLayout: _external_module.layout,`:``}
38
- components: { ${d}${d?`, `:``} ...(_user_mdx_components || {}) },
39
- });
40
- `}function _e(e){return`<!doctype html>
41
- <html lang="en">
42
- <head>
43
- <meta charset="UTF-8" />
44
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
45
- <title>${e.theme?.title||`Boltdocs`}</title>
46
- </head>
47
- <body>
48
- <div id="root"></div>
49
- </body>
50
- </html>`}function L(e,t){let n=t.theme,r=n?.title||`Boltdocs`,i=n?.description||``,a=n?.favicon;!a&&n?.logo&&(a=typeof n.logo==`string`?n.logo:n.logo.light||n.logo.dark);let o=[a?`<link rel="icon" href="${a}">`:``,`<meta name="description" content="${i}">`,`<meta property="og:title" content="${r}">`,`<meta property="og:description" content="${i}">`,n?.ogImage?`<meta property="og:image" content="${n.ogImage}">`:``,`<meta property="og:type" content="website">`,`<meta name="twitter:card" content="summary_large_image">`,`<meta name="twitter:title" content="${r}">`,`<meta name="twitter:description" content="${i}">`,n?.ogImage?`<meta name="twitter:image" content="${n.ogImage}">`:``,`<meta name="generator" content="Boltdocs">`].filter(Boolean).join(`
51
- `);return e=e.includes(`<title>`)?e.replace(/<title>.*?<\/title>/,`<title>${r}</title>`):e.replace(`</head>`,` <title>${r}</title>\n </head>`),e=e.replace(`</head>`,` ${o}\n
52
- <script>
53
- (function() {
54
- try {
55
- var stored = localStorage.getItem("boltdocs-theme");
56
- var theme = stored || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
57
- if (theme === "light") {
58
- document.documentElement.classList.add("theme-light");
59
- document.documentElement.dataset.theme = "light";
60
- } else {
61
- document.documentElement.classList.remove("theme-light");
62
- document.documentElement.dataset.theme = "dark";
63
- }
64
- } catch (e) {}
65
- })();
66
- <\/script>
67
- </head>`),!e.includes(`src/main`)&&!e.includes(`virtual:boltdocs-entry`)&&(e=e.replace(`</body>`,` <script type="module">import "virtual:boltdocs-entry";<\/script>
68
- </body>`)),e}function ve(e){let t=[];for(let n of e)if(t.push({id:n.path,title:n.title,content:n._content||``,url:n.path,display:n.groupTitle?`${n.groupTitle} > ${n.title}`:n.title,locale:n.locale,version:n.version}),n.headings)for(let e of n.headings)t.push({id:`${n.path}#${e.id}`,title:e.text,content:`${e.text} in ${n.title}`,url:`${n.path}#${e.id}`,display:`${n.title} > ${e.text}`,locale:n.locale,version:n.version});return t}const R={"X-Content-Type-Options":`nosniff`,"X-Frame-Options":`DENY`,"X-XSS-Protection":`1; mode=block`,"Referrer-Policy":`strict-origin-when-cross-origin`,"Permissions-Policy":`camera=(), microphone=(), geolocation=()`,"Strict-Transport-Security":`max-age=31536000; includeSubDomains`};function z(e){let t=process.env.NODE_ENV===`development`,n={"default-src":[`'self'`],"script-src":[`'self'`,`'unsafe-inline'`],"style-src":[`'self'`,`'unsafe-inline'`],"img-src":[`'self'`,`data:`,`https:`],"font-src":[`'self'`],"connect-src":[`'self'`]};return t&&(n[`script-src`]=[`'self'`,`'unsafe-eval'`,`'unsafe-inline'`],n[`style-src`]=[`'self'`,`'unsafe-inline'`]),Object.entries(n).map(([e,t])=>`${e} ${t.join(` `)}`).join(`; `)}var B=class e extends Error{pluginName;constructor(t,n){super(`[plugin:${t}] ${n}`),this.name=`PluginError`,this.pluginName=t,Object.setPrototypeOf(this,e.prototype)}},V=class e extends B{constructor(t,n){super(t,`Validation failed: ${n}`),this.name=`PluginValidationError`,Object.setPrototypeOf(this,e.prototype)}},H=class e extends B{constructor(t,n){super(t,`Compatibility error: ${n}`),this.name=`PluginCompatibilityError`,Object.setPrototypeOf(this,e.prototype)}},U=class e extends B{constructor(t,n){super(t,`Missing required permission: '${n}'`),this.name=`PluginPermissionError`,Object.setPrototypeOf(this,e.prototype)}},W=class e extends B{hookName;constructor(t,n,r){super(t,`Error in hook '${n}': ${r.message}`),this.name=`PluginHookError`,this.hookName=n,this.stack=r.stack,Object.setPrototypeOf(this,e.prototype)}},G=class{data=new Map;getNamespaceKey(e,t){return`${e}:${t}`}get(e,t){let n=this.getNamespaceKey(e,t),r=this.data.get(n);if(r!==void 0)return typeof r==`object`&&r?JSON.parse(JSON.stringify(r)):r}set(e,t,n){let r=this.getNamespaceKey(e,t),i=typeof n==`object`&&n?JSON.parse(JSON.stringify(n)):n;this.data.set(r,i)}has(e,t){let n=this.getNamespaceKey(e,t);return this.data.has(n)}};const K=P.extend({version:o.z.string().optional(),boltdocsVersion:o.z.string().optional(),permissions:o.z.array(o.z.string()).optional(),hooks:o.z.object({beforeBuild:o.z.function().optional(),afterBuild:o.z.function().optional(),beforeDev:o.z.function().optional(),afterDev:o.z.function().optional(),configResolved:o.z.function().optional(),buildEnd:o.z.function().optional()}).optional()});function q(e,t){let n=[],r=new Set;for(let i of e){let e=K.safeParse(i);if(!e.success)throw new V(i.name||`unknown`,e.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`, `));let a=e.data;if(r.has(a.name))throw new V(a.name,`Duplicate plugin name detected`);if(r.add(a.name),a.boltdocsVersion&&!p.default.satisfies(t,a.boltdocsVersion))throw new H(a.name,`Plugin expects Boltdocs version ${a.boltdocsVersion}, but current is ${t}`);if(a.components){for(let[e,t]of Object.entries(a.components))if((t.includes(`..`)||s.default.isAbsolute(t))&&t.includes(`..`))throw new V(a.name,`Component '${e}' has an invalid path: traversal sequences are not allowed.`)}n.push(a)}return n}function J(e,t){return e.permissions?e.permissions.includes(t):!1}var Y=class{static checkPermission(e,t){if(!J(e,t))throw new U(e.name,t)}static getSanitizedCapabilities(e){return{remarkPlugins:J(e,`mdx:remark`)?e.remarkPlugins:[],rehypePlugins:J(e,`mdx:rehype`)?e.rehypePlugins:[],vitePlugins:J(e,`vite:config`)?e.vitePlugins:[],components:J(e,`components`)?e.components:{}}}static async executeWithIsolation(e,t,n,r){try{return this.checkPermission(e,t),await r()}catch(t){if(t instanceof U){console.warn(`[boltdocs] Skipping hook '${n}' for plugin '${e.name}': ${t.message}`);return}throw t}}},ye=class{plugins;config;store;constructor(e,t){this.plugins=e,this.config=t,this.store=new G}async runHook(e,...t){let n=this.getSortedPlugins();for(let r of n){if(!r.hooks?.[e])continue;let n=this.createContext(r),i=e.toLowerCase().includes(`build`),a=e.toLowerCase().includes(`dev`),o=i?`hooks:build`:a?`hooks:dev`:void 0;try{o?await Y.executeWithIsolation(r,o,e,()=>r.hooks[e](n,...t)):await r.hooks[e](n,...t)}catch(t){let i=new W(r.name,e,t instanceof Error?t:Error(String(t)));n.logger.error(i)}}}getSortedPlugins(){let e=this.plugins.filter(e=>e.enforce===`pre`),t=this.plugins.filter(e=>!e.enforce),n=this.plugins.filter(e=>e.enforce===`post`);return[...e,...t,...n]}createContext(e){return{config:Object.freeze({...this.config}),meta:{name:e.name,version:e.version,boltdocsVersion:e.boltdocsVersion},store:{get:(e,t)=>this.store.get(e,t),set:(e,t,n)=>this.store.set(e,t,n),has:(e,t)=>this.store.has(e,t)},logger:this.createLogger(e.name)}}createLogger(e){let t=`[plugin:${e}]`;return{info:e=>console.log(`${t} INFO: ${e}`),warn:e=>console.warn(`${t} WARN: ${e}`),error:e=>{let n=e instanceof Error?e.message:e;console.error(`${t} ERROR: ${n}`)},debug:e=>console.debug(`${t} DEBUG: ${e}`)}}};function be(e){return e}function xe(t={},n){let i=s.default.resolve(process.cwd(),t.docsDir||`docs`),o=e.f(i),c=n,l,d=!1,f,p=[];return[{name:`vite-plugin-boltdocs`,enforce:`pre`,async config(e,t){d=t.command===`build`;let n=e.envDir||process.cwd(),a=(0,r.loadEnv)(t.mode,n,``);Object.assign(process.env,a),c||=await I(i);let o=(await Promise.resolve().then(()=>require(`./package-BY8Jd2j4.cjs`))).version,s=q(c.plugins||[],o);return c.plugins=s,f=new ye(s,c),p=s.flatMap(e=>Y.getSanitizedCapabilities(e).vitePlugins||[]),d&&await f.runHook(`beforeBuild`),{optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`],exclude:[`boltdocs`,`boltdocs/client`]},resolve:{dedupe:[`react`,`react-dom`]}}},configResolved(e){l=e,f?.runHook(`configResolved`,c)},async configureServer(t){await f?.runHook(`beforeDev`),t.middlewares.use((e,t,n)=>{process.env.NODE_ENV===`production`&&Object.entries(R).forEach(([e,n])=>{t.setHeader(e,n)}),c.security?.enableCSP&&t.setHeader(`Content-Security-Policy`,z(c)),n()}),t.middlewares.use((e,t,n)=>{if(e.url===`/robots.txt`){let e=de(c);t.statusCode=200,t.setHeader(`Content-Type`,`text/plain`),t.end(e);return}n()}),t.middlewares.use(async(e,n,r)=>{let i=e.url?.split(`?`)[0]||`/`,a=e.headers.accept||``,o=i===`/`||i.startsWith(`/docs`)||c.i18n&&Object.keys(c.i18n.locales).some(e=>i.startsWith(`/${e}/docs`)||i===`/${e}`)||!0,s=/\.(js|css|png|jpe?g|gif|svg|ico|webp|woff2?|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac|pdf|zip|gz|map|json)$/i.test(i);if(a.includes(`text/html`)&&!s&&o){let r=_e(c);r=L(r,c),r=await t.transformIndexHtml(e.url||`/`,r),n.statusCode=200,n.setHeader(`Content-Type`,`text/html`),n.end(r);return}r()});let n=F.map(e=>s.default.resolve(process.cwd(),e)),r=[`tsx`,`jsx`],a=r.map(e=>s.default.resolve(i,`layout.${e}`)),l=[`tsx`,`ts`,`jsx`,`js`],u=l.map(e=>s.default.resolve(i,`mdx-components.${e}`)),d=l.map(e=>s.default.resolve(i,`pages-external/index.${e}`));t.watcher.add([...n,...u,...a,...d]);let p=async(n,a)=>{try{let s=e.f(n);if(F.some(e=>s.endsWith(e))){t.restart();return}if(l.some(e=>s.endsWith(`mdx-components.${e}`))){let e=t.moduleGraph.getModuleById(`\0virtual:boltdocs-mdx-components`);e&&t.moduleGraph.invalidateModule(e),t.ws.send({type:`full-reload`});return}if(r.some(e=>s.endsWith(`layout.${e}`))){let e=t.moduleGraph.getModuleById(`\0virtual:boltdocs-layout`);e&&t.moduleGraph.invalidateModule(e),t.ws.send({type:`full-reload`});return}if(s.includes(`/pages-external/`)||s.includes(`\\pages-external\\`)){let e=t.moduleGraph.getModuleById(`\0virtual:boltdocs-entry`);e&&t.moduleGraph.invalidateModule(e),t.ws.send({type:`full-reload`});return}if(!s.startsWith(o)||!e.u(s))return;if(a===`add`||a===`unlink`){x(),c=await I(i);let e=t.moduleGraph.getModuleById(`\0virtual:boltdocs-config`);e&&t.moduleGraph.invalidateModule(e),t.ws.send({type:`custom`,event:`boltdocs:config-update`,data:{theme:c?.theme,i18n:c?.i18n,versions:c?.versions,siteUrl:c?.siteUrl}})}else S(n);let u=await k(i,c,`/docs`,a!==`change`),d=t.moduleGraph.getModuleById(`\0virtual:boltdocs-routes`);d&&t.moduleGraph.invalidateModule(d),t.ws.send({type:`custom`,event:`boltdocs:routes-update`,data:u})}catch(e){console.error(`[boltdocs] HMR error during ${a} event:`,e)}};t.watcher.on(`add`,e=>p(e,`add`)),t.watcher.on(`unlink`,e=>p(e,`unlink`)),t.watcher.on(`change`,e=>p(e,`change`)),await f?.runHook(`afterDev`)},resolveId(e){if(e===`virtual:boltdocs-routes`||e===`virtual:boltdocs-config`||e===`virtual:boltdocs-entry`||e===`virtual:boltdocs-mdx-components`||e===`virtual:boltdocs-layout`||e===`virtual:boltdocs-search`)return`\0`+e},async load(n){if(n===`\0virtual:boltdocs-routes`){let e=await k(i,c);return`export default ${JSON.stringify(e,null,2)};`}if(n===`\0virtual:boltdocs-config`){let e={theme:c?.theme,i18n:c?.i18n,versions:c?.versions,siteUrl:c?.siteUrl,plugins:c?.plugins?.map(e=>({name:e.name}))};return`export default ${JSON.stringify(e,null,2)};`}if(n===`\0virtual:boltdocs-entry`)return ge(t,c);if(n===`\0virtual:boltdocs-mdx-components`){let t=[`tsx`,`ts`,`jsx`,`js`],n=null;for(let e of t){let t=s.default.resolve(i,`mdx-components.${e}`);if(a.default.existsSync(t)){n=t;break}}if(n){let t=e.f(n);return`import * as components from '${t}';
69
- const mdxComponents = components.default || components;
70
- export default mdxComponents;
71
- export * from '${t}';`}return`export default {};`}if(n===`\0virtual:boltdocs-layout`){let t=[`tsx`,`jsx`],n=null;for(let e of t){let t=s.default.resolve(i,`layout.${e}`);if(a.default.existsSync(t)){n=t;break}}return n?`import UserLayout from '${e.f(n)}';
72
- export default UserLayout;`:`import { DefaultLayout } from 'boltdocs/client';
73
- export default DefaultLayout;`}if(n===`\0virtual:boltdocs-search`){let e=ve(await k(i,c));return`export default ${JSON.stringify(e,null,2)};`}},transformIndexHtml:{order:`pre`,handler(e){return L(e,c)}},async closeBundle(){if(!d)return;let e=l?.build?.outDir?s.default.resolve(l.root,l.build.outDir):s.default.resolve(process.cwd(),`dist`);await he({docsDir:i,docsDirName:s.default.basename(i||`docs`),outDir:e,config:c});let{flushCache:t}=await Promise.resolve().then(()=>require(`./cache-Cr8W2zgZ.cjs`)).then(e=>e.r);await t(),await f?.runHook(`afterBuild`),await f?.runHook(`buildEnd`)}},(0,u.ViteImageOptimizer)({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:`preset-default`}]}}),{name:`vite-plugin-boltdocs-extra-plugins`,async configResolved(){}},...p]}const X=new e.n(`mdx`);let Z=null;async function Se(e){if(Z)return Z;let t=typeof e==`object`?[e.light,e.dark]:[e??`github-dark`];return[`github-light`,`github-dark`].forEach(e=>{t.includes(e)||t.push(e)}),Z=await(0,y.createHighlighter)({themes:t,langs:[`tsx`,`jsx`,`ts`,`js`,`json`,`md`,`mdx`,`css`,`html`,`bash`,`sh`,`yaml`,`yml`]}),Z}function Ce(e){return async t=>{let n=e?.theme?.codeTheme??{light:`github-light`,dark:`github-dark`},r=await Se(n);(0,v.visit)(t,[`mdxJsxFlowElement`,`mdxJsxTextElement`],e=>{if(e.name!==`ComponentPreview`)return;let t=e.attributes?.find(e=>e.name===`code`),i=``;if(t){if(typeof t.value==`string`)i=t.value;else if(t.value?.type===`mdxJsxAttributeValueExpression`){let e=t.value.value??``;i=e.match(/^[`'"]([\s\S]+)[`'"]$/)?.[1]??e}}if(!i)return;let a=typeof n==`object`?{themes:{light:n.light,dark:n.dark},lang:`tsx`}:{theme:n,lang:`tsx`},o=r.codeToHtml(i,a);e.attributes=(e.attributes??[]).filter(e=>e.name!==`highlightedHtml`),e.attributes.push({type:`mdxJsxAttribute`,name:`highlightedHtml`,value:o})})}}function we(e){return async t=>{let n=e?.theme?.codeTheme||{light:`github-light`,dark:`github-dark`},r=await Se(n);(0,v.visit)(t,`element`,e=>{if(e.tagName===`pre`&&e.children?.[0]?.tagName===`code`){let t=e.children[0],i=(t.properties?.className||[]).find(e=>e.startsWith(`language-`)),a=i?i.slice(9):`text`,o=t.children[0]?.value||``,s=(t.data?.meta||t.properties?.metastring||``).match(/title\s*=\s*"([^"]*)"/),c=s?s[1]:void 0,l={lang:a};typeof n==`object`?l.themes={light:n.light,dark:n.dark}:l.theme=n;let u=r.codeToHtml(o,l);e.properties[`data-highlighted`]=`true`,e.properties[`data-highlighted-html`]=u,e.properties[`data-lang`]=a,c&&(e.properties.title=c),e.children=[]}})}}function Te(){return e=>{(0,v.visit)(e,`code`,e=>{if(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.lang&&(e.data.hProperties[`data-lang`]=e.lang),!e.meta)return;let t=e.meta,n=t.match(/title\s*=\s*"([^"]*)"/);n&&(e.data.hProperties.title=n[1]),e.data.hProperties.metastring=t})}}let Ee=!1,Q=0,$=0;function De(e,t=m.default){let n=e?.plugins?.flatMap(e=>Y.getSanitizedCapabilities(e).remarkPlugins||[])||[],r=e?.plugins?.flatMap(e=>Y.getSanitizedCapabilities(e).rehypePlugins||[])||[],i=t({remarkPlugins:[h.default,g.default,Te,[Ce,e],...n],rehypePlugins:[_.default,[we,e],...r],jsxRuntime:`automatic`});return{...i,name:`vite-plugin-boltdocs-mdx`,async buildStart(){Q=0,$=0,Ee||=(X.load(),!0),i.buildStart&&await i.buildStart.call(this)},async transform(e,t,n){if(!t.endsWith(`.md`)&&!t.endsWith(`.mdx`))return i.transform?.call(this,e,t,n);console.log(`[boltdocs] Transforming MDX: ${t}`),$++;let r=`${t}:${c.default.createHash(`md5`).update(e).digest(`hex`)}:v4`,a=X.get(r);if(a)return Q++,{code:a,map:null};let o=await i.transform.call(this,e,t,n);return o&&typeof o==`object`&&o.code&&X.set(r,o.code),o},async buildEnd(){$>0&&console.log(`[boltdocs] MDX Cache Performance: ${Q}/${$} hits (${Math.round(Q/$*100)||0}%)`),X.save(),await X.flush(),i.buildEnd&&await i.buildEnd.call(this)}}}async function Oe(e){let t=await I(e?.docsDir||`docs`);return[...xe({...e,homePage:e?.homePage||t.homePage},t),De(t)]}async function ke(e,r=`development`){let i=await I(`docs`,e),a=r===`production`?{...R}:{};return i.security?.enableCSP&&(a[`Content-Security-Policy`]=z(i)),{root:e,mode:r,plugins:[(0,t.default)(),(0,n.default)(),await Oe({docsDir:i.docsDir,homePage:i.homePage})],resolve:{alias:{"use-sync-external-store/shim/index.js":`react`,"use-sync-external-store/shim":`react`,"use-sync-external-store":`react`}},server:{headers:{...a,...i.vite?.server?.headers},...i.vite?.server},preview:{headers:{...a,...i.vite?.preview?.headers},...i.vite?.preview},...i.vite}}Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return I}});
@@ -1,6 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- import{g as e,t,v as n}from"./use-search-D25n0PrV.mjs";import{useCallback as r,useEffect as i}from"react";import{useNavigate as a}from"react-router-dom";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";function l({routes:l}){let{isOpen:u,setIsOpen:d,query:f,setQuery:p,list:m}=t(l),h=a();i(()=>{let e=e=>{(/Mac/.test(navigator.userAgent)?e.metaKey:e.ctrlKey)&&(e.key===`k`||e.key===`j`)&&(e.preventDefault(),d(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d]);let g=r(e=>{let t=String(e);if(d(!1),t.includes(`#`)){let[e,n]=t.split(`#`);h(e),setTimeout(()=>{let e=document.getElementById(n);e&&e.scrollIntoView({behavior:`smooth`})},100)}else h(t)},[h,d]);return c(o,{children:[s(n.SearchTrigger,{onPress:()=>d(!0)}),s(e.Root,{isOpen:u,onOpenChange:d,children:c(e.Autocomplete,{onSelectionChange:g,children:[s(e.Input,{value:f,onChange:e=>p(e.target.value)}),s(e.List,{items:m,children:t=>c(e.Item,{onPress:()=>g(t.id),textValue:t.title,children:[s(e.Item.Icon,{isHeading:t.isHeading}),c(`div`,{className:`flex flex-col justify-center gap-0.5`,children:[s(e.Item.Title,{children:t.title}),s(e.Item.Bio,{children:t.bio})]})]},t.id)})]})})]})}export{l as SearchDialog};
@@ -1,6 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- const e=require(`./use-search-WuzdH1cJ.js`);let t=require(`react`),n=require(`react-router-dom`),r=require(`react/jsx-runtime`);function i({routes:i}){let{isOpen:a,setIsOpen:o,query:s,setQuery:c,list:l}=e.t(i),u=(0,n.useNavigate)();(0,t.useEffect)(()=>{let e=e=>{(/Mac/.test(navigator.userAgent)?e.metaKey:e.ctrlKey)&&(e.key===`k`||e.key===`j`)&&(e.preventDefault(),o(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]);let d=(0,t.useCallback)(e=>{let t=String(e);if(o(!1),t.includes(`#`)){let[e,n]=t.split(`#`);u(e),setTimeout(()=>{let e=document.getElementById(n);e&&e.scrollIntoView({behavior:`smooth`})},100)}else u(t)},[u,o]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e.r.SearchTrigger,{onPress:()=>o(!0)}),(0,r.jsx)(e.n.Root,{isOpen:a,onOpenChange:o,children:(0,r.jsxs)(e.n.Autocomplete,{onSelectionChange:d,children:[(0,r.jsx)(e.n.Input,{value:s,onChange:e=>c(e.target.value)}),(0,r.jsx)(e.n.List,{items:l,children:t=>(0,r.jsxs)(e.n.Item,{onPress:()=>d(t.id),textValue:t.title,children:[(0,r.jsx)(e.n.Item.Icon,{isHeading:t.isHeading}),(0,r.jsxs)(`div`,{className:`flex flex-col justify-center gap-0.5`,children:[(0,r.jsx)(e.n.Item.Title,{children:t.title}),(0,r.jsx)(e.n.Item.Bio,{children:t.bio})]})]},t.id)})]})})]})}exports.SearchDialog=i;