boltdocs 2.7.7 → 2.7.9
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.
- package/README.md +263 -0
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.js +1 -1
- package/dist/doctor-BD1BSB03.mjs +23 -0
- package/dist/doctor-BHc9ua6r.cjs +23 -0
- package/dist/{doctor-BQiQhCTl.cjs → doctor-D4_Y7M4p.cjs} +1 -1
- package/dist/node/cli-entry.cjs +1 -1
- package/dist/node/cli-entry.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/node/routes/worker.mjs +1 -1
- package/dist/{node-CsY-eLEP.mjs → node-DBaH7kat.mjs} +4 -4
- package/dist/{node-PfSXEt5t.cjs → node-t5C3Q85p.cjs} +4 -4
- package/dist/{package-D-7aOtPv.mjs → package-B4MD00N3.mjs} +1 -1
- package/dist/{package-BBsNSOR-.cjs → package-VfQM94VL.cjs} +1 -1
- package/dist/{parser-DiHXWckn.mjs → parser-9cVdK7w9.mjs} +1 -1
- package/dist/{routes-D0KpEheM.mjs → routes-DwrMa5-z.mjs} +1 -1
- package/package.json +2 -2
- package/src/client/ssg/create-routes.tsx +15 -1
- package/dist/doctor-COpf35L2.cjs +0 -20
- package/dist/doctor-COxqQQQ8.mjs +0 -20
package/dist/client/index.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import{$ as e,B as t,C as n,F as r,H as i,J as a,K as o,L as s,O as c,Q as l,T as u,V as d,W as f,X as p,Y as m,Z as h,_ as g,b as _,et as v,j as y,k as b,nt as x,q as S,s as C,tt as w,w as ee,y as T}from"../icons-dev-B_RZIyxu.js";import{D as te,E as ne,M as E,N as D,T as O,_ as k,h as A,i as j,j as re,k as M,m as ie,n as ae,r as oe,t as N,w as se}from"../docs-layout-KoWNZc8_.js";import{c as ce,l as P}from"../image-CqKzYD8f.js";import{n as F}from"../search-dialog-D6BNohIJ.js";import{n as le,t as ue}from"../search-dialog-B584t9ZF.js";import{a as de,i as fe,n as pe,r as me,t as he}from"../mdx-DudBEac0.js";import{ViteReactSSG as ge}from"@bdocs/ssg";import{Outlet as _e,useLoaderData as ve,useLocation as I,useNavigate as ye}from"react-router-dom";import{Suspense as be,createContext as xe,lazy as Se,use as Ce,useCallback as we,useEffect as L,useLayoutEffect as Te,useMemo as R,useRef as Ee,useState as z}from"react";import{Fragment as B,jsx as V,jsxs as H}from"react/jsx-runtime";import{Button as De}from"react-aria-components";import Oe from"virtual:boltdocs-icons";import*as ke from"react-helmet-async";import Ae from"virtual:boltdocs-mdx-components";import je from"virtual:boltdocs-layout";const Me=Symbol.for(`__BDOCS_MDX_COMPONENTS_CONTEXT__`),U=Symbol.for(`__BDOCS_MDX_COMPONENTS_INSTANCE__`),Ne=globalThis[Me]||(globalThis[Me]=xe({}));function W(){let e=Ce(Ne);return(!e||Object.keys(e).length===0)&&globalThis[U]?globalThis[U]:e}function Pe({components:e,children:t}){let n=R(()=>{let t={},n={};return Object.entries(e).forEach(([e,r])=>{if(e.startsWith(`Frontmatter_`)){let t=e.slice(12);n[t]=r}else t[e]=r}),t.Frontmatter=n,t},[e]);return typeof globalThis<`u`&&(globalThis[U]=n),V(Ne.Provider,{value:n,children:t})}function Fe(){let{currentRoute:e}=p(),t=[];return e&&(e.groupTitle&&t.push({label:e.groupTitle}),t.push({label:e.title,href:e.path})),{crumbs:t,activeRoute:e}}function Ie(){let{crumbs:e,activeRoute:t}=Fe();return e.length===0?null:H(D.Root,{className:`gap-2 text-xs sm:text-sm font-medium`,children:[V(D.Item,{children:V(D.Link,{href:`/`,className:`text-muted hover:text-body transition-colors flex items-center`,children:V(r,{size:14})})}),e.map((e,n)=>{let r=e.href===t?.path;return H(D.Item,{className:`gap-2`,children:[V(D.Separator,{className:`text-muted/40`}),V(D.Link,{href:e.href,className:T(`transition-colors`,r?`text-body font-semibold cursor-default pointer-events-none`:`text-muted hover:text-body`),children:e.label})]},`crumb-${e.href}-${e.label}-${n}`)})]})}const Le=e=>{let[t,n]=z(!1);return{copied:t,handleCopy:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)},handleOpenRaw:()=>{let t=new Blob([e],{type:`text/plain;charset=utf-8`}),n=URL.createObjectURL(t);window.open(n,`_blank`)}}};function Re({content:e,mdxRaw:t}){let n=t||e||``,{copied:r,handleCopy:i,handleOpenRaw:a}=Le(n);return n?V(`div`,{className:`relative inline-flex z-100 shrink-0 w-max`,children:H(re,{className:`rounded-xl border border-subtle bg-surface transition-all duration-300 hover:border-primary-500/50 group overflow-hidden`,children:[V(E,{onPress:i,className:T(`md:hidden flex items-center justify-center w-8 h-8 bg-transparent outline-none select-none cursor-pointer border-none`,`text-muted transition-all duration-300 hover:bg-primary-500/5 hover:text-body`,r&&`text-emerald-500 hover:bg-emerald-500/5`),"aria-label":r?`Copied!`:`Copy Markdown`,children:V(r?ee:b,{size:14})}),H(E,{onPress:i,className:T(`hidden md:flex items-center gap-2 px-5 py-2 bg-transparent text-[0.8125rem] font-semibold h-9 shrink-0 outline-none select-none cursor-pointer border-none`,`text-body transition-all duration-300 hover:bg-primary-500/5`,r&&`text-emerald-500 hover:bg-emerald-500/5`),children:[V(r?ee:b,{size:16}),r?`Copied!`:`Copy Markdown`]}),H(M.Trigger,{placement:`bottom end`,children:[V(E,{className:T(`flex items-center justify-center px-2.5 md:px-3.5 h-8 md:h-9 border-none border-l border-subtle/50 text-muted rounded-none bg-transparent shrink-0 outline-none select-none cursor-pointer`,`transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500`),children:V(u,{size:14})}),H(M.Root,{className:`w-52 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:[H(M.Item,{onAction:i,className:`flex items-center px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group`,children:[V(b,{size:16,className:`size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400`}),V(`span`,{className:`ml-2`,children:`Copy Markdown`})]}),H(M.Item,{onAction:a,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group`,children:[V(y,{size:16,className:`size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400`}),V(`span`,{className:`ml-2`,children:`View as Markdown`})]})]})]})]})}):null}function ze({children:e,fallback:t}){return V(te,{fallback:t,children:e})}async function Be(e,t,n=`https://api.github.com`){let r=new Headers;t&&r.append(`authorization`,t);let i=await(await fetch(`${n}/repos/${e}`,{headers:r})).json();return i.stargazers_count===void 0?`0`:Ve(i.stargazers_count)}const Ve=e=>Intl.NumberFormat(`en`,{notation:`compact`,compactDisplay:`short`}).format(e);function He({repo:e}){let[t,n]=z(null);return L(()=>{e&&Be(e).then(e=>n(e)).catch(()=>n(`0`))},[e]),H(`a`,{href:`https://github.com/${e}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-2 rounded-xl border border-subtle bg-surface px-3 py-1.5 text-xs font-semibold text-muted dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 hover:border-primary-500/50 hover:text-body select-none outline-none`,children:[V(C,{className:`h-4 w-4 text-body`}),t!==null&&H(`span`,{className:`tabular-nums font-medium`,children:[t,` stars`]})]})}function G(e,t){return e?typeof e==`string`?e:t&&e[t]?e[t]:Object.values(e)[0]||``:``}function K(){let e=x(),{theme:t,resolvedTheme:n}=P(),r=I(),{currentLocale:i}=p(),a=e.theme||{},o=G(a.title,i)||`Boltdocs`,s=a.navbar||[],c=a.socialLinks||[],l=a.githubRepo,u=R(()=>s.map(t=>{let n=t.href||t.to||t.link||``,a=t=>{let n=r.pathname;if(n===t)return!0;if(!t||t===`/`)return n===`/`;let i=t=>{let n=t.split(`/`).filter(Boolean),r=0;return e.i18n?.locales&&n[r]&&e.i18n.locales[n[r]]&&r++,e.versions?.versions&&n[r]&&e.versions.versions.some(e=>e.path===n[r])&&r++,n.slice(r)},a=i(t),o=i(n);return a.length===0?o.length===0:o.length<a.length?!1:a.every((e,t)=>o[t]===e)},o=(e=>{if(!(!e||e.length===0))return e.map(e=>{let t=e.href||e.to||e.link||``;return{label:G(e.label||e.text,i),href:t,active:a(t),to:t.startsWith(`http`)||t.startsWith(`//`)?`external`:void 0}})})(t.items);return{label:G(t.label||t.text,i),href:n,active:a(n),to:n.startsWith(`http`)||n.startsWith(`//`)?`external`:void 0,items:o}}),[s,r.pathname,i,e]),d=a.logo;return{links:u,title:o,logo:d?typeof d==`string`?d:n===`dark`?d.dark:d.light:null,logoProps:{alt:(d&&typeof d==`object`?d.alt:void 0)||o,width:d&&typeof d==`object`?d.width:void 0,height:d&&typeof d==`object`?d.height:void 0},github:l?`https://github.com/${l}`:null,social:c,config:e,theme:t}}function Ue(){let{theme:e,setTheme:t}=P(),[n,r]=z(!1);if(L(()=>{r(!0)},[]),!n)return V(`div`,{className:`h-9 w-9`});let a=e===`system`?d:e===`dark`?i:o;return H(M.Trigger,{placement:`bottom right`,children:[V(De,{className:`flex h-9 w-9 items-center justify-center rounded-xl text-muted transition-colors hover:bg-surface hover:text-body outline-none border-none bg-transparent cursor-pointer`,"aria-label":`Selection theme`,children:V(a,{size:20,className:`animate-in fade-in zoom-in duration-300`})}),H(M.Root,{selectionMode:`single`,selectedKeys:[e],onSelectionChange:e=>{let n=Array.from(e)[0];t(n)},className:`w-36 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:[H(M.Item,{id:`light`,className:`group flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[V(o,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),V(`span`,{className:`ml-2`,children:`Light`})]}),H(M.Item,{id:`dark`,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[V(i,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),V(`span`,{className:`ml-2`,children:`Dark`})]}),H(M.Item,{id:`system`,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[V(d,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),V(`span`,{className:`ml-2`,children:`System`})]})]})]})}function We({className:e}){let{theme:t,setTheme:n}=P(),[r,a]=z(!1);if(L(()=>{a(!0)},[]),!r)return V(`div`,{className:T(`h-10 w-full bg-surface rounded-xl animate-pulse`,e)});let s=t===`dark`;return H(`div`,{className:T(`flex p-1 bg-surface border border-subtle rounded-xl relative w-full h-11`,e),children:[V(`div`,{className:T(`absolute inset-y-1 w-[calc(50%-4px)] bg-main border border-subtle rounded-lg transition-all duration-300 ease-out shadow-xs`,s?`translate-x-full`:`translate-x-0`)}),V(`button`,{onClick:()=>n(`light`),className:T(`flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent`,s?`text-muted hover:text-body`:`text-body font-semibold`),"aria-label":`Light mode`,children:V(o,{size:18})}),V(`button`,{onClick:()=>n(`dark`),className:T(`flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent`,s?`text-body font-semibold`:`text-muted hover:text-body`),"aria-label":`Dark mode`,children:V(i,{size:18})})]})}function Ge(e=[],t=[]){let n=I(),r=Ee([]),[i,a]=z({opacity:0,transform:`translateX(0) scaleX(0)`,width:0}),o=h(n.pathname),s=t.find(e=>h(e.path)===o)?.tab?.toLowerCase(),c=e.findIndex(e=>e.id.toLowerCase()===s),l=c===-1?0:c;return L(()=>{let e=r.current[l];e&&a({opacity:1,width:e.offsetWidth,transform:`translateX(${e.offsetLeft}px)`})},[l,e.length,n.pathname]),{tabs:e,activeIndex:l,indicatorStyle:i,tabRefs:r,activeTabId:s}}function Ke({tabs:e,routes:t}){let{currentLocale:n}=p(),{indicatorStyle:r,tabRefs:i,activeIndex:a}=Ge(e,t);L(()=>{let e=i.current[a];e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},[a]);let o=e=>{if(!e)return null;if(e.trim().startsWith(`<svg`))return V(`span`,{className:`h-4 w-4`,dangerouslySetInnerHTML:{__html:e}});let t={...m,...Oe},n=t[e]||t[e+`Icon`];return n?V(n,{size:16}):V(`img`,{src:e,alt:``,className:`h-4 w-4 object-contain`})};return V(`div`,{className:`mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6 select-none`,children:H(ne.List,{className:`border-none py-0 scrollbar-hide relative flex flex-row items-center`,children:[e.map((e,r)=>{let s=r===a,c=t.find(t=>t.tab&&t.tab.toLowerCase()===e.id.toLowerCase());return H(g,{href:c?c.path:`#`,ref:e=>{i.current[r]=e},className:`relative flex items-center gap-2 px-4 py-3.5 text-sm font-semibold transition-colors duration-300 outline-none whitespace-nowrap ${s?`text-primary-500`:`text-muted hover:text-body`}`,children:[o(e.icon),V(`span`,{children:G(e.text,n)})]},e.id)}),V(ne.Indicator,{style:r,className:`h-0.5 bg-primary-500 rounded-full transition-all duration-300`})]})})}function q(e,t,n){let r=e;return t&&(r===t||r.startsWith(t+`/`))&&(r=r===t?`index.md`:r.slice(t.length+1)),n&&(r===n||r.startsWith(n+`/`))&&(r=r===n?`index.md`:r.slice(n.length+1)),r}function qe(){let t=ye(),n=x(),{allRoutes:r,currentRoute:i,currentVersion:a,currentLocale:o}=p(),s=n.versions,{setVersion:c}=e();return{currentVersion:a,currentVersionLabel:s?.versions?.find?.(e=>e.path===a)?.label||a,availableVersions:R(()=>s?s.versions.map(e=>({key:e.path,label:e.label,value:e.path,isCurrent:e.path===a})):[],[s,a]),handleVersionChange:e=>{if(!s||e===a)return;c(e);let l=`${(n.base||`/docs`).replace(/\/$/,``)}/${e}${o?`/${o}`:``}`;if(i){let t=q(i.filePath,i.version,i.locale),a=r.find(r=>q(r.filePath,r.version,r.locale)===t&&(r.version||s.defaultVersion)===e&&(!n.i18n||(r.locale||n.i18n.defaultLocale)===o));if(a)l=a.path;else{let t=r.find(t=>q(t.filePath,t.version,t.locale)===`index.md`&&(t.version||s.defaultVersion)===e&&(!n.i18n||(t.locale||n.i18n.defaultLocale)===o));t&&(l=t.path)}}else{let t=r.find(t=>(t.version||s.defaultVersion)===e&&(!n.i18n||(t.locale||n.i18n.defaultLocale)===o));t&&(l=t.path)}t(l)}}}function Je(){let t=ye(),n=x(),{allRoutes:r,currentRoute:i,currentLocale:a,currentVersion:o}=p(),s=n.i18n,{setLocale:c}=e(),l=e=>{if(!s||e===a)return;c(e);let l=n.base||`/`,u=l===`/`?``:l.replace(/\/$/,``),d=!!i?.filePath,f=``;if(i)if(d){let t=q(i.filePath,i.version,i.locale),n=r.find(n=>q(n.filePath,n.version,n.locale)===t&&(n.locale||s.defaultLocale)===e&&n.version===i.version);if(n)f=n.path;else{let t=r.find(t=>q(t.filePath,t.version,t.locale)===`index.md`&&(t.locale||s.defaultLocale)===e&&t.version===i.version);f=t?t.path:`${u}${i.version?`/${i.version}`:``}${e===s.defaultLocale?``:`/${e}`}`||`/`}}else{let t=i.path,n=t.split(`/`).filter(Boolean);if(n.length>0&&(Array.isArray(s.locales)?s.locales.includes(n[0]):s.locales[n[0]])&&(n.shift(),t=`/`+n.join(`/`)),e===s.defaultLocale)f=t===``?`/`:t;else{let n=t.startsWith(`/`)?t:`/${t}`;f=`/${e}${n===`/`?``:n}`}}else{let t=r.find(t=>(t.locale||s.defaultLocale)===e&&(t.version||n.versions?.defaultVersion)===(o||n.versions?.defaultVersion));if(t)f=t.path;else{let t=o&&o!==n.versions?.defaultVersion?`/${o}`:``;f=e===s.defaultLocale?`${u}${t}`:`${u}${t}/${e}`}}(!f||f===``)&&(f=`/`),f=f.replace(/\/+/g,`/`),t(f)},u=s?.locales,d=u?Array.isArray(u)?a:u[a]:void 0;return{currentLocale:a,currentLocaleLabel:s?.localeConfigs?.[a]?.label||d||a,availableLocales:R(()=>s?Array.isArray(s.locales)?s.locales.map(e=>({key:e,label:s?.localeConfigs?.[e]?.label||e,value:e,isCurrent:e===a})):Object.entries(s.locales).map(([e,t])=>({key:e,label:s?.localeConfigs?.[e]?.label||t,value:e,isCurrent:e===a})):[],[s,a]),handleLocaleChange:l}}function J({className:e}){let{currentVersionLabel:t,availableVersions:n,handleVersionChange:r}=qe();return n.length===0?null:H(M.Trigger,{children:[H(E,{className:T(`flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer`,e),children:[V(`span`,{className:`font-semibold text-[0.8125rem]`,children:t}),V(u,{className:`w-3.5 h-3.5 text-muted/60`})]}),V(M.Root,{className:`w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:V(M.Section,{items:n,children:e=>V(M.Item,{onPress:()=>r(e.value),className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body hover:bg-primary-50/50 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:e.label},`${e.value??``}`)})})]})}function Ye({className:e}){let{currentLocale:t,availableLocales:n,handleLocaleChange:r}=Je();return n.length===0?null:H(M.Trigger,{children:[H(E,{className:T(`flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer`,e),children:[H(`div`,{className:`flex items-center gap-1.5`,children:[V(s,{className:`w-3.5 h-3.5 text-primary-500`}),V(`span`,{className:`font-bold text-[0.75rem] uppercase opacity-90`,children:t||`en`})]}),V(u,{className:`w-3.5 h-3.5 text-muted/60`})]}),V(M.Root,{className:`w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:V(M.Section,{items:n,children:e=>V(M.Item,{onPress:()=>r(e.value),className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:V(`span`,{children:e.label})},`${e.value??``}`)})})]})}const Xe=Se(()=>import(`../search-dialog-ByvGScjt.js`).then(e=>({default:e.SearchDialog})));function Ze(){let{links:e,title:n,logo:r,logoProps:i,github:o,social:s,config:c}=K(),{routes:l,allRoutes:u,currentRoute:d,currentVersion:f,currentLocale:m}=p(),{pathname:h}=I(),{isSidebarOpen:g,toggleSidebar:_}=O(),[v,y]=z(!1),b=c.theme||{},x=!!d?.filePath,S=b?.tabs&&b.tabs.length>0;return H(F.Root,{className:T(`border-b border-subtle bg-main/80 backdrop-blur-md`,S&&`border-b-0`),children:[H(F.Content,{children:[H(F.Left,{children:[x&&V(E,{onPress:_,className:`mr-2 lg:hidden p-1.5 h-8 w-8 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 transition-colors`,"aria-label":g?`Close sidebar`:`Open sidebar`,children:V(g?a:t,{className:`w-5 h-5 text-body`})}),r&&V(F.Logo,{src:r,alt:i?.alt||n,width:i?.width??24,height:i?.height??24,href:`site:/`}),V(F.Title,{href:`site:/`,children:n}),V(`div`,{className:`hidden sm:block`,children:c.versions&&f&&V(J,{})})]}),V(F.Center,{children:V(be,{fallback:V(`div`,{className:`h-9 w-32 animate-pulse rounded-md bg-surface`}),children:V(Xe,{routes:l||[]})})}),H(F.Right,{children:[V(be,{fallback:null,children:V(`div`,{className:`lg:hidden`,children:V(Xe,{routes:l||[]})})}),V(F.Links,{children:e.map(e=>V(Qe,{link:e},e.href))}),H(`div`,{className:`hidden sm:flex items-center gap-2`,children:[c.i18n&&m&&V(Ye,{}),V(F.Split,{className:`bg-subtle`})]}),V(`div`,{className:`hidden md:block`,children:V(Ue,{})}),o&&V(`div`,{className:`hidden md:block`,children:V(He,{repo:b?.githubRepo??``})}),s.length>0&&V(`div`,{className:`hidden md:block`,children:V(F.Split,{className:`bg-subtle`})}),V(`div`,{className:`hidden md:flex items-center gap-1`,children:s.map(({icon:e,link:t})=>V(F.Socials,{icon:e,link:t,className:`p-1.5 text-muted hover:text-body hover:bg-surface rounded-md transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30`},t))}),V(F.More,{onPress:()=>y(!0),className:`text-muted hover:text-body active:scale-90 transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30`})]})]}),H(F.MobileMenu,{isOpen:v,onClose:()=>y(!1),className:`bg-main/98 backdrop-blur-2xl`,children:[V(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>V($e,{link:e,onClose:()=>y(!1)},e.href))}),s.length>0&&H(`div`,{className:`mt-6`,children:[V(`div`,{className:`px-4 mb-4 text-xs font-bold uppercase tracking-widest text-muted/50`,children:`Connect`}),V(`div`,{className:`flex flex-wrap gap-2 px-2`,children:s.map(({icon:e,link:t})=>V(F.Socials,{icon:e,link:t,className:`p-3 bg-surface border border-subtle rounded-xl flex-1 justify-center`},t))})]})]}),x&&S&&b?.tabs&&V(`div`,{className:`w-full border-b border-subtle bg-main`,children:V(Ke,{tabs:b.tabs,routes:u||l||[]})})]})}function Qe({link:e}){let t=_(e.href||``),{pathname:n}=I(),r=n===t||n.startsWith(t+`/`);return e.items&&e.items.length>0?V(F.Dropdown,{label:V(`span`,{className:T(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm px-2 py-1`,r?`text-primary-500`:`text-muted hover:text-body`),children:e.label}),children:e.items?.map(e=>V(F.DropdownItem,{href:_(e.href||``),label:e.label},e.href))}):V(F.Link,{...e,href:t,active:r,className:T(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm`,r?`text-primary-500`:`text-muted hover:text-body`)})}function $e({link:e,onClose:t}){let n=_(e.href||``),{pathname:r}=I(),i=r===n;return e.items&&e.items.length>0?H(`div`,{className:`flex flex-col gap-1`,children:[V(`div`,{className:T(`px-3 py-2 text-sm transition-all`,i?`text-body`:`text-muted/80 hover:text-body`),children:e.label}),V(`div`,{className:`flex flex-col gap-1 pl-4`,children:e.items?.map(e=>V($e,{link:e,onClose:t},e.href))})]}):V(F.MobileLink,{...e,href:n,active:i,onPress:t,className:T(`transition-all`,i?`text-body`:`text-muted/80 hover:text-body`)})}function Y(){return V(`div`,{className:`flex items-center justify-center min-h-[65vh] text-center px-4`,children:H(`div`,{className:`space-y-6 max-w-md mx-auto p-8 border border-subtle bg-surface rounded-2xl shadow-xs`,children:[V(`span`,{className:`block text-7xl font-extrabold tracking-tight text-primary-500`,children:`404`}),H(`div`,{className:`space-y-2`,children:[V(`h1`,{className:`text-xl font-bold text-body`,children:`Page Not Found`}),V(`p`,{className:`text-sm text-muted leading-relaxed`,children:`The page you're looking for doesn't exist or has been moved.`})]}),H(g,{href:`/`,className:`inline-flex items-center gap-2 rounded-xl border border-subtle bg-main px-6 py-2.5 text-xs font-semibold text-body hover:bg-primary-50/50 hover:border-primary-500/50 transition-all duration-300 outline-none select-none`,children:[V(n,{size:14}),` Go to Home`]})]})})}function et({headings:e=[],editLink:t,communityHelp:n,filePath:r}){return e.length===0?null:H(k.Root,{children:[H(k.Header,{className:`flex flex-row gap-x-2`,children:[V(S,{size:16}),`On this page`]}),V(k.Tree,{headings:e}),(t||n)&&H(`div`,{className:`mt-8 pt-8 border-t border-subtle space-y-4`,children:[V(`p`,{className:`text-xs font-bold text-body`,children:`Need help?`}),H(`ul`,{className:`space-y-3`,children:[t&&r&&V(`li`,{children:H(`a`,{href:t.replace(`:path`,r),target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-muted hover:text-body transition-colors`,children:[V(f,{size:16}),`Edit this page`]})}),n&&V(`li`,{children:H(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-muted hover:text-body transition-colors`,children:[V(c,{size:16}),`Community help`]})})]})]})]})}function tt(){let{routes:e,currentRoute:t}=p(),n=I();return R(()=>{if(!t)return{prevPage:null,nextPage:null,currentRoute:null};let r=t.tab?.toLowerCase(),i=r?e.filter(e=>e.tab?.toLowerCase()===r):e.filter(e=>!e.tab),a=i.findIndex(e=>e.path===n.pathname);return{prevPage:a>0?i[a-1]:null,nextPage:a!==-1&&a<i.length-1?i[a+1]:null,currentRoute:t}},[e,t,n.pathname])}function nt(){let{prevPage:e,nextPage:t}=tt();return!e&&!t?null:H(A.Root,{className:`pt-8 border-t border-subtle grid sm:grid-cols-2 gap-4 animate-in fade-in slide-in-from-bottom-4 duration-700 select-none`,children:[e?H(A.Link,{to:e.path,direction:`prev`,className:`group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20`,children:[V(A.Title,{className:`text-xs font-bold uppercase tracking-wider text-muted/60 mb-1`,children:`Previous`}),V(A.Description,{className:`text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors`,children:e.title})]}):V(`div`,{}),t?H(A.Link,{to:t.path,direction:`next`,className:`group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20`,children:[V(A.Title,{className:`text-xs font-bold uppercase tracking-wider text-muted/60 mb-1`,children:`Next`}),V(A.Description,{className:`text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors`,children:t.title})]}):V(`div`,{})]})}function rt({routes:e,config:t}){let{logo:n,title:r,logoProps:i}=K(),{closeSidebar:o}=O(),s=n?V(`img`,{src:n,alt:i?.alt||r,width:24,height:24,className:`rounded-xl`}):null,c=t.versions||t.i18n;return H(B,{children:[V(j.Root,{children:V(j.Content,{children:V(j.Items,{routes:e})})}),H(j.Mobile,{children:[H(j.Header,{children:[H(`div`,{className:`flex items-center gap-3`,children:[s,V(`span`,{className:`font-bold text-lg tracking-tight text-body truncate max-w-[120px]`,children:r})]}),H(`div`,{className:`flex items-center gap-2`,children:[V(We,{className:`w-24 h-9 rounded-xl`}),V(E,{onPress:o,className:`h-9 w-9 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 text-muted hover:text-body transition-colors`,"aria-label":`Close sidebar`,children:V(a,{size:20})})]})]}),H(j.Content,{children:[c&&H(`div`,{className:`flex flex-col gap-4 mb-10`,children:[H(`div`,{className:`flex gap-3`,children:[t.versions&&V(J,{className:`flex-1 justify-between h-10 bg-surface border-subtle rounded-xl`}),t.i18n&&V(Ye,{className:`flex-1 justify-between h-10 bg-surface border-subtle rounded-xl`})]}),V(`div`,{className:`mt-2 border-b border-subtle`})]}),V(j.Items,{routes:e})]})]})]})}const it=Object.assign(rt,{Root:j.Root,Mobile:j.Mobile,Header:j.Header,Content:j.Content,Group:j.Group,Link:j.Link,SubGroup:j.SubGroup,Item:j.Item,Items:j.Items});function at({date:e}){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let n=t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`});return H(`div`,{className:`mt-16 pt-6 border-t border-subtle flex items-center justify-between text-xs text-muted select-none`,children:[V(`span`,{}),H(`span`,{className:`italic`,children:[`Last updated on `,n]})]})}function ot({route:e,content:t,mdxComponents:n}){let r=W(),i=R(()=>({LastUpdated:at,...r,...n}),[r,n]),a=i.LastUpdated||at;return t?H(B,{children:[V(t,{components:i}),e?.lastUpdated&&V(a,{date:e.lastUpdated})]}):null}function st({MDXComponent:e,mdxComponents:t}){let n=ve(),r=e||n?.MDXComponent,i=t||n?.mdxComponents;return r?V(ot,{route:{path:n.path,filePath:n.filePath,title:n.frontmatter.title,description:n.frontmatter.description,headings:n.headings,locale:n.locale,version:n.version,group:n.group,groupTitle:n.groupTitle,lastUpdated:n.lastUpdated,frontmatter:n.frontmatter},content:r,mdxComponents:i}):null}const X=ke,ct=X.Helmet||X.default?.Helmet||(({children:e})=>V(B,{children:e})),lt=X.HelmetProvider||X.default?.HelmetProvider||(({children:e})=>V(B,{children:e}));function ut(){let{pathname:e,hash:t}=I(),n=(e=`auto`)=>{let n=document.querySelector(`.boltdocs-content`)||window,r=()=>n===window?window.scrollY:n.scrollTop,i=(e,t)=>{n===window?window.scrollTo({top:e,behavior:t}):n.scrollTo({top:e,behavior:t})};if(t){let a=t.replace(`#`,``),o=document.getElementById(a);if(o){let t=n===window?0:n.getBoundingClientRect().top;return i(o.getBoundingClientRect().top-t-80+r(),e),!0}}return i(0,e),!1};return Te(()=>{n(`auto`)},[e,t]),L(()=>{n(`auto`);let e=requestAnimationFrame(()=>{n(`auto`),window.dispatchEvent(new Event(`resize`))});return()=>cancelAnimationFrame(e)},[e,t]),null}const dt={...he,NotFound:Y,404:Y};function Z(e){return e.endsWith(`/`)&&e.length>1?e.slice(0,-1):e}function ft({config:t}){let{currentLocale:n}=e();return L(()=>{if(!t.i18n||typeof document>`u`)return;let e=n||t.i18n.defaultLocale,r=t.i18n.localeConfigs?.[e];document.documentElement.lang=r?.htmlLang||e||`en`,document.documentElement.dir=r?.direction||`ltr`},[n,t.i18n]),null}function pt({config:t,routeMap:n}){let r=I(),{setLocale:i,setVersion:a}=e();return L(()=>{let e=Z(r.pathname),o=n.get(e);o&&(t.i18n&&i(o.locale||t.i18n.defaultLocale),t.versions&&a(o.version||t.versions.defaultVersion))},[r.pathname,t,n,i,a]),null}function mt({config:e,routes:t,components:n={}}){let r=R(()=>({...dt,...Ae,...n}),[n]),{pathname:i}=I(),a=R(()=>Z(i||`/`),[i]),o=R(()=>{let e=new Map;for(let n of t){let t=Z(n.path===``?`/`:n.path);e.set(t,n)}return e},[t]),s=R(()=>{let t=o.get(a),n,r;return t&&(e.i18n&&(n=t.locale||e.i18n.defaultLocale),e.versions&&(r=t.version||e.versions.defaultVersion)),{initLocale:n,initVersion:r}},[a,e,o]);return V(lt,{children:V(v,{routes:t,children:V(ce,{children:V(se,{children:V(Pe,{components:r,children:H(w.Provider,{value:e,children:[V(ut,{}),H(l,{initialLocale:s.initLocale,initialVersion:s.initVersion,children:[V(pt,{config:e,routeMap:o}),V(ft,{config:e}),V(_e,{})]})]})})})})})})}function ht({siteTitle:e,siteDescription:t,routes:n}){let r=I(),i=x(),{currentLocale:a}=p(),o=R(()=>n?.find?.(e=>e.path===r.pathname),[n,r.pathname]),s=o?.title,c=G(t,a),l=o?.description||c||``,u=G(e,a),d=s?`${s} | ${u}`:u,f=o?.seo||{},m=i?.seo?.metatags||{},h=i?.seo?.thumbnails?.background,g=f[`og:image`]||h;return H(ct,{children:[V(`title`,{children:d}),V(`meta`,{name:`description`,content:l}),V(`meta`,{property:`og:title`,content:d}),V(`meta`,{property:`og:description`,content:l}),V(`meta`,{property:`og:type`,content:`article`}),typeof window<`u`&&V(`meta`,{property:`og:url`,content:window.location.href}),typeof window<`u`&&V(`link`,{rel:`canonical`,href:window.location.origin+r.pathname}),V(`meta`,{name:`twitter:card`,content:`summary`}),V(`meta`,{name:`twitter:title`,content:d}),V(`meta`,{name:`twitter:description`,content:l}),g&&V(`meta`,{name:`twitter:image`,content:g}),g&&V(`meta`,{property:`og:image`,content:g}),V(`meta`,{name:`generator`,content:`Boltdocs`}),Object.entries(m).map(([e,t])=>e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?V(`meta`,{property:e,content:t},e):V(`meta`,{name:e,content:t},e)),Object.entries(f).map(([e,t])=>e===`noindex`&&t===!0?V(`meta`,{name:`robots`,content:`noindex`},`noindex`):e===`robots`?V(`meta`,{name:`robots`,content:t},`robots`):e===`canonical`?V(`link`,{rel:`canonical`,href:t},`canonical`):e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?V(`meta`,{property:e,content:t},e):V(`meta`,{name:e,content:t},e))]})}function gt(){let e=x(),{currentRoute:t,allRoutes:n}=p();return H(B,{children:[V(ht,{siteTitle:e.theme?.title,siteDescription:e.theme?.description,routes:n||[]}),V(je,{route:t,children:V(_e,{})})]})}const _t=()=>V(`div`,{className:`text-muted text-sm py-4`,children:`Loading...`}),vt=({moduleLoader:e,moduleKey:t,route:n,components:r})=>{let i=e?.default??e??null;return L(()=>{if(!import.meta.hot||!t)return;let e=e=>{e.relPath.replace(/\\/g,`/`).replace(/^\//,``)===n.filePath.replace(/\\/g,`/`).replace(/^\//,``)&&import(t+`?t=`+Date.now()).then(e=>{})};return import.meta.hot.on(`boltdocs:mdx-update`,e),()=>import.meta.hot?.off(`boltdocs:mdx-update`,e)},[t,n.filePath]),i?V(st,{MDXComponent:i,mdxComponents:r}):V(_t,{})},yt=()=>{let e=W();return V(e.NotFound||e[404]||Y,{})};function bt(e){let{routesData:t,config:n,mdxModules:r,externalPages:i,externalLayout:a,components:o}=e,s=a||(({children:e})=>V(B,{children:e})),c=e=>{let t=n.base||`/`;return e.startsWith(t)?e:`${t===`/`?``:t.replace(/\/$/,``)}${e.startsWith(`/`)?e:`/${e}`}`||`/`},l=[],u=n.versions?.defaultVersion,d=(n.base||`/docs`).replace(/\/$/,``),f=(n.base||`/docs`).replace(/\/$/,``);f||=`/`,u&&t.forEach(e=>{if(e.version)return;let t=e.path||``,n=t.startsWith(d)?t.substring(d.length).replace(/^\//,``):t.replace(/^\//,``);if(!(n===u||n.startsWith(`${u}/`))){let t=`${d}/${u}/${n}`.replace(/\/+/g,`/`).replace(/\/$/,``)||`/`;l.push({...e,path:t,version:u})}});let p=[...t,...l],m=new Map,h=Object.keys(r);if(h.length>0){let e=h[0].replace(/\\/g,`/`).split(`/`).filter(Boolean)[0]||`docs`,t=`/${e}/`,n=`./${e}/`;for(let e of h){let r=e.replace(/\\/g,`/`),i=``;r.indexOf(t)===-1?r.startsWith(n)&&(i=r.substring(n.length)):i=r.substring(r.indexOf(t)+t.length),i?m.set(i,e):m.set(r,e)}}let g=p.map(e=>{let t=e.filePath.replace(/\\/g,`/`),n=m.get(t),i=n?r[n]:null,a=c(e.path===``?`/`:e.path),s=a===f?`.`:a.startsWith(f+`/`)?a.slice(f.length+1):a;return{path:s,element:V(vt,{moduleKey:n,moduleLoader:i,route:e,components:o},n||s),loader:async()=>({path:s,frontmatter:{title:e.title,description:e.description||``,...e.frontmatter||{}},headings:e.headings||[],filePath:e.filePath,locale:e.locale,version:e.version,group:e.group,groupTitle:e.groupTitle,date:e.date,lastUpdated:e.lastUpdated}),getStaticPaths:()=>[s]}}),_=n.i18n?.locales?Array.isArray(n.i18n.locales)?n.i18n.locales:Object.keys(n.i18n.locales):[],v=n.versions?.versions?.map(e=>e.path)||[],y=[];y.push({path:f,filter:()=>!0});let b=[];v.length>0&&v.forEach(e=>b.push(`/${e}`)),_.length>0&&_.forEach(e=>b.push(`/${e}`)),v.length>0&&_.length>0&&v.forEach(e=>{_.forEach(t=>{b.push(`/${e}/${t}`)})}),b.forEach(e=>{let t=f===`/`?e:`${f}${e}`;y.push({path:t,filter:e=>e.startsWith(t.replace(/\/$/,``)+`/`)})});let x=new Set(g.map(e=>(e.path||``).replace(/\/$/,``))),S=new Set;i&&Object.keys(i).forEach(e=>{let t=e.startsWith(`/`)?e:`/${e}`;S.add(t.replace(/\/$/,``)),n.i18n&&Object.keys(n.i18n.locales).forEach(e=>{S.add(`/${e}${t===`/`?``:t}`.replace(/\/$/,``))})}),y.forEach(({path:e,filter:t})=>{if(e===`/`)return;let r=e.replace(/\/$/,``);if(!(x.has(r)||S.has(r))){let i=n.theme?.tabs?.[0]?.id,a=i?`${r}/${i}`.replace(/\/+/g,`/`):null,o=a&&x.has(a.replace(/\/$/,``))?g.find(e=>e.path.replace(/\/$/,``)===a.replace(/\/$/,``)):g.find(e=>t(e.path)&&e.path!==r);if(!o&&g.length>0&&(o=g[0]),o){let t=e===f?`.`:e.startsWith(f+`/`)?e.slice(f.length+1):e;g.push({path:t,element:o.element,loader:o.loader,getStaticPaths:()=>[]});let r=p.find(e=>{let t=c(e.path===``?`/`:e.path);return(t===f?`.`:t.startsWith(f+`/`)?t.slice(f.length+1):t)===o.path});if(r){let t=c(r.path),i=n.siteUrl?`${n.siteUrl.replace(/\/$/,``)}${t}`:t;p.push({...r,path:e,seo:{...r.seo,canonical:i}})}}}});let C=[{path:f,element:V(gt,{}),children:g}],w=[];return i&&Object.entries(i).forEach(([e,t])=>{let r=e.startsWith(`/`)?e:`/${e}`;C.find(e=>e.path===r)||(w.push({path:r,locale:n.i18n?.defaultLocale,title:e===`/`?`Home`:e.replace(/^\//,``).split(`/`).pop()||`Page`,filePath:``,headings:[]}),C.push({path:r,element:V(s,{children:V(t,{})}),loader:async()=>({path:r,locale:n.i18n?.defaultLocale}),getStaticPaths:()=>[r]}),n.i18n&&Object.keys(n.i18n.locales).forEach(n=>{let r=`/${n}${e===`/`?``:e}`;C.find(e=>e.path===r)||(w.push({path:r,locale:n,title:e,filePath:``,headings:[]}),C.push({path:r,element:V(s,{children:V(t,{})}),loader:async()=>({path:r,locale:n}),getStaticPaths:()=>[r]}))}))}),C.push({path:`*`,element:V(s,{children:V(yt,{})})}),[{element:V(mt,{config:n,routes:[...p,...w],components:o}),children:C}]}function Q(e){return typeof window>`u`?$():typeof window.gtag==`function`?xt(e):window.dataLayer?St(e):$()}function xt(e){return{trackPageView:(t,n)=>{window.gtag?.(`event`,`page_view`,{page_path:t,page_title:n||document.title,send_to:e?.ga4?.measurementId})},trackEvent:({action:t,category:n,label:r,value:i,params:a})=>{window.gtag?.(`event`,t,{event_category:n,event_label:r,value:i,send_to:e?.ga4?.measurementId,...a})},trackSearch:(t,n)=>{window.gtag?.(`event`,`search`,{search_term:t,results_count:n,send_to:e?.ga4?.measurementId})},trackDownload:(t,n)=>{window.gtag?.(`event`,`file_download`,{file_name:t,file_type:n||t.split(`.`).pop(),send_to:e?.ga4?.measurementId})},trackExternalLink:t=>{window.gtag?.(`event`,`external_link`,{link_url:t,send_to:e?.ga4?.measurementId})},isEnabled:!0}}function St(e){return{trackPageView:(t,n)=>{window.dataLayer?.push({event:`page_view`,page_path:t,page_title:n||document.title,send_to:e?.gtm?.tagId})},trackEvent:({action:t,category:n,label:r,value:i,params:a})=>{window.dataLayer?.push({event:t,event_category:n,event_label:r,value:i,send_to:e?.gtm?.tagId,...a})},trackSearch:(t,n)=>{window.dataLayer?.push({event:`search`,search_term:t,results_count:n,send_to:e?.gtm?.tagId})},trackDownload:(t,n)=>{window.dataLayer?.push({event:`file_download`,file_name:t,file_type:n||t.split(`.`).pop(),send_to:e?.gtm?.tagId})},trackExternalLink:t=>{window.dataLayer?.push({event:`external_link`,link_url:t,send_to:e?.gtm?.tagId})},isEnabled:!0}}function $(){return{trackPageView:()=>{},trackEvent:()=>{},trackSearch:()=>{},trackDownload:()=>{},trackExternalLink:()=>{},isEnabled:!1}}const Ct=Symbol.for(`__BDOCS_CONFIG_INSTANCE__`);function wt(e={}){let{config:t,autoTrackPageViews:n=!0,autoTrackDownloads:r=!0,autoTrackExternalLinks:i=!0,excludePatterns:a=[]}=e,o=typeof globalThis<`u`?globalThis[Ct]:void 0,s=t??o?.integrations,c=R(()=>Q(s),[s]),l=Ee(``),u=oe();return L(()=>{if(!n||!c.isEnabled)return;let e=u.pathname+u.search;e!==l.current&&(l.current=e,c.trackPageView(e,document.title))},[u.pathname,n,c]),L(()=>{if(!r||!c.isEnabled)return;let e=e=>{let t=e.target?.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);if(n&&!a.some(e=>e.test(n))&&(t.hasAttribute(`download`)||/\.(pdf|doc|docx|xls|xlsx|ppt|pptx|zip|rar|7z|tar|gz|mp3|mp4|avi|mov|png|jpg|jpeg|gif|svg|webp)$/i.test(n))){let e=n.split(`/`).pop()||n;c.trackDownload(e,e.split(`.`).pop())}};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[r,i,c,a]),L(()=>{if(!i||!c.isEnabled)return;let e=e=>{let t=e.target?.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);n&&(a.some(e=>e.test(n))||(n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`//`))&&!n.includes(window.location.hostname)&&c.trackExternalLink(n))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[i,c,a]),c}function Tt(){let e=R(()=>Q(),[]);return we((t,n)=>{e.trackPageView(t,n)},[e])}function Et(){let e=R(()=>Q(),[]);return we(t=>{e.trackEvent(t)},[e])}function Dt({children:e}){let{routes:t,currentRoute:n}=p(),r=x();return H(N,{className:`selection:bg-primary-500/10 selection:text-primary-500`,children:[V(Ze,{}),H(N.Body,{className:`bg-main`,children:[V(it,{routes:t||[],config:r}),V(N.Content,{className:`animate-in fade-in duration-500 scroll-smooth`,children:H(N.ContentMdx,{className:`max-w-3xl sm:max-w-4xl lg:max-w-4xl px-2 pt-8 pb-24`,children:[H(N.Header,{children:[H(`div`,{className:`mb-4 border-b border-subtle pb-4 flex flex-wrap items-center justify-between gap-3`,children:[V(Ie,{}),V(Re,{mdxRaw:n?._rawContent,route:n})]}),n?.title&&V(`h1`,{className:`text-4xl font-bold tracking-tight text-default mb-3`,children:n.title}),n?.description&&V(`p`,{className:`text-lg text-muted-foreground mb-6 leading-relaxed`,children:n.description})]}),V(ze,{children:V(`div`,{className:`prose prose-neutral dark:prose-invert max-w-none`,children:e})}),V(N.Footer,{children:V(nt,{})})]})}),V(et,{headings:n?.headings,editLink:r.theme?.editLink,communityHelp:r.theme?.communityHelp,filePath:n?.filePath})]})]})}const Ot=Object.assign(Dt,{Body:N.Body,Content:N.Content,ContentMdx:N.ContentMdx,Header:N.Header,Footer:N.Footer});export{mt as BoltdocsShell,Ie as Breadcrumbs,me as Card,pe as Cards,Re as CopyMarkdown,Ot as DocsLayout,ze as ErrorBoundary,st as MdxPage,Ze as Navbar,Y as NotFound,et as OnThisPage,nt as PageNav,ue as SearchDialog,it as Sidebar,ge as ViteReactSSG,T as cn,fe as copyToClipboard,bt as createRoutes,Be as getStarsRepo,G as getTranslated,de as reactToText,wt as useAnalytics,Fe as useBreadcrumbs,x as useConfig,Je as useI18n,_ as useLocalizedTo,oe as useLocation,W as useMdxComponents,K as useNavbar,tt as usePageNav,p as useRoutes,le as useSearch,ae as useSearchHighlight,ie as useSidebar,Ge as useTabs,P as useTheme,Et as useTrackEvent,Tt as useTrackPageView,O as useUI,qe as useVersion};
|
|
6
|
+
import{$ as e,B as t,C as n,F as r,H as i,J as a,K as o,L as s,O as c,Q as l,T as u,V as d,W as f,X as p,Y as m,Z as h,_ as g,b as _,et as v,j as y,k as b,nt as x,q as S,s as C,tt as w,w as ee,y as T}from"../icons-dev-B_RZIyxu.js";import{D as te,E as ne,M as E,N as D,T as O,_ as k,h as A,i as j,j as re,k as M,m as ie,n as ae,r as oe,t as N,w as se}from"../docs-layout-KoWNZc8_.js";import{c as ce,l as P}from"../image-CqKzYD8f.js";import{n as F}from"../search-dialog-D6BNohIJ.js";import{n as le,t as ue}from"../search-dialog-B584t9ZF.js";import{a as de,i as fe,n as pe,r as me,t as he}from"../mdx-DudBEac0.js";import{ViteReactSSG as ge}from"@bdocs/ssg";import{Outlet as _e,useLoaderData as ve,useLocation as I,useNavigate as ye}from"react-router-dom";import{Suspense as be,createContext as xe,lazy as Se,use as Ce,useCallback as we,useEffect as L,useLayoutEffect as Te,useMemo as R,useRef as Ee,useState as z}from"react";import{Fragment as B,jsx as V,jsxs as H}from"react/jsx-runtime";import{Button as De}from"react-aria-components";import Oe from"virtual:boltdocs-icons";import*as ke from"react-helmet-async";import Ae from"virtual:boltdocs-mdx-components";import je from"virtual:boltdocs-layout";const Me=Symbol.for(`__BDOCS_MDX_COMPONENTS_CONTEXT__`),U=Symbol.for(`__BDOCS_MDX_COMPONENTS_INSTANCE__`),Ne=globalThis[Me]||(globalThis[Me]=xe({}));function W(){let e=Ce(Ne);return(!e||Object.keys(e).length===0)&&globalThis[U]?globalThis[U]:e}function Pe({components:e,children:t}){let n=R(()=>{let t={},n={};return Object.entries(e).forEach(([e,r])=>{if(e.startsWith(`Frontmatter_`)){let t=e.slice(12);n[t]=r}else t[e]=r}),t.Frontmatter=n,t},[e]);return typeof globalThis<`u`&&(globalThis[U]=n),V(Ne.Provider,{value:n,children:t})}function Fe(){let{currentRoute:e}=p(),t=[];return e&&(e.groupTitle&&t.push({label:e.groupTitle}),t.push({label:e.title,href:e.path})),{crumbs:t,activeRoute:e}}function Ie(){let{crumbs:e,activeRoute:t}=Fe();return e.length===0?null:H(D.Root,{className:`gap-2 text-xs sm:text-sm font-medium`,children:[V(D.Item,{children:V(D.Link,{href:`/`,className:`text-muted hover:text-body transition-colors flex items-center`,children:V(r,{size:14})})}),e.map((e,n)=>{let r=e.href===t?.path;return H(D.Item,{className:`gap-2`,children:[V(D.Separator,{className:`text-muted/40`}),V(D.Link,{href:e.href,className:T(`transition-colors`,r?`text-body font-semibold cursor-default pointer-events-none`:`text-muted hover:text-body`),children:e.label})]},`crumb-${e.href}-${e.label}-${n}`)})]})}const Le=e=>{let[t,n]=z(!1);return{copied:t,handleCopy:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)},handleOpenRaw:()=>{let t=new Blob([e],{type:`text/plain;charset=utf-8`}),n=URL.createObjectURL(t);window.open(n,`_blank`)}}};function Re({content:e,mdxRaw:t}){let n=t||e||``,{copied:r,handleCopy:i,handleOpenRaw:a}=Le(n);return n?V(`div`,{className:`relative inline-flex z-100 shrink-0 w-max`,children:H(re,{className:`rounded-xl border border-subtle bg-surface transition-all duration-300 hover:border-primary-500/50 group overflow-hidden`,children:[V(E,{onPress:i,className:T(`md:hidden flex items-center justify-center w-8 h-8 bg-transparent outline-none select-none cursor-pointer border-none`,`text-muted transition-all duration-300 hover:bg-primary-500/5 hover:text-body`,r&&`text-emerald-500 hover:bg-emerald-500/5`),"aria-label":r?`Copied!`:`Copy Markdown`,children:V(r?ee:b,{size:14})}),H(E,{onPress:i,className:T(`hidden md:flex items-center gap-2 px-5 py-2 bg-transparent text-[0.8125rem] font-semibold h-9 shrink-0 outline-none select-none cursor-pointer border-none`,`text-body transition-all duration-300 hover:bg-primary-500/5`,r&&`text-emerald-500 hover:bg-emerald-500/5`),children:[V(r?ee:b,{size:16}),r?`Copied!`:`Copy Markdown`]}),H(M.Trigger,{placement:`bottom end`,children:[V(E,{className:T(`flex items-center justify-center px-2.5 md:px-3.5 h-8 md:h-9 border-none border-l border-subtle/50 text-muted rounded-none bg-transparent shrink-0 outline-none select-none cursor-pointer`,`transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500`),children:V(u,{size:14})}),H(M.Root,{className:`w-52 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:[H(M.Item,{onAction:i,className:`flex items-center px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group`,children:[V(b,{size:16,className:`size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400`}),V(`span`,{className:`ml-2`,children:`Copy Markdown`})]}),H(M.Item,{onAction:a,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group`,children:[V(y,{size:16,className:`size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400`}),V(`span`,{className:`ml-2`,children:`View as Markdown`})]})]})]})]})}):null}function ze({children:e,fallback:t}){return V(te,{fallback:t,children:e})}async function Be(e,t,n=`https://api.github.com`){let r=new Headers;t&&r.append(`authorization`,t);let i=await(await fetch(`${n}/repos/${e}`,{headers:r})).json();return i.stargazers_count===void 0?`0`:Ve(i.stargazers_count)}const Ve=e=>Intl.NumberFormat(`en`,{notation:`compact`,compactDisplay:`short`}).format(e);function He({repo:e}){let[t,n]=z(null);return L(()=>{e&&Be(e).then(e=>n(e)).catch(()=>n(`0`))},[e]),H(`a`,{href:`https://github.com/${e}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-2 rounded-xl border border-subtle bg-surface px-3 py-1.5 text-xs font-semibold text-muted dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 hover:border-primary-500/50 hover:text-body select-none outline-none`,children:[V(C,{className:`h-4 w-4 text-body`}),t!==null&&H(`span`,{className:`tabular-nums font-medium`,children:[t,` stars`]})]})}function G(e,t){return e?typeof e==`string`?e:t&&e[t]?e[t]:Object.values(e)[0]||``:``}function K(){let e=x(),{theme:t,resolvedTheme:n}=P(),r=I(),{currentLocale:i}=p(),a=e.theme||{},o=G(a.title,i)||`Boltdocs`,s=a.navbar||[],c=a.socialLinks||[],l=a.githubRepo,u=R(()=>s.map(t=>{let n=t.href||t.to||t.link||``,a=t=>{let n=r.pathname;if(n===t)return!0;if(!t||t===`/`)return n===`/`;let i=t=>{let n=t.split(`/`).filter(Boolean),r=0;return e.i18n?.locales&&n[r]&&e.i18n.locales[n[r]]&&r++,e.versions?.versions&&n[r]&&e.versions.versions.some(e=>e.path===n[r])&&r++,n.slice(r)},a=i(t),o=i(n);return a.length===0?o.length===0:o.length<a.length?!1:a.every((e,t)=>o[t]===e)},o=(e=>{if(!(!e||e.length===0))return e.map(e=>{let t=e.href||e.to||e.link||``;return{label:G(e.label||e.text,i),href:t,active:a(t),to:t.startsWith(`http`)||t.startsWith(`//`)?`external`:void 0}})})(t.items);return{label:G(t.label||t.text,i),href:n,active:a(n),to:n.startsWith(`http`)||n.startsWith(`//`)?`external`:void 0,items:o}}),[s,r.pathname,i,e]),d=a.logo;return{links:u,title:o,logo:d?typeof d==`string`?d:n===`dark`?d.dark:d.light:null,logoProps:{alt:(d&&typeof d==`object`?d.alt:void 0)||o,width:d&&typeof d==`object`?d.width:void 0,height:d&&typeof d==`object`?d.height:void 0},github:l?`https://github.com/${l}`:null,social:c,config:e,theme:t}}function Ue(){let{theme:e,setTheme:t}=P(),[n,r]=z(!1);if(L(()=>{r(!0)},[]),!n)return V(`div`,{className:`h-9 w-9`});let a=e===`system`?d:e===`dark`?i:o;return H(M.Trigger,{placement:`bottom right`,children:[V(De,{className:`flex h-9 w-9 items-center justify-center rounded-xl text-muted transition-colors hover:bg-surface hover:text-body outline-none border-none bg-transparent cursor-pointer`,"aria-label":`Selection theme`,children:V(a,{size:20,className:`animate-in fade-in zoom-in duration-300`})}),H(M.Root,{selectionMode:`single`,selectedKeys:[e],onSelectionChange:e=>{let n=Array.from(e)[0];t(n)},className:`w-36 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:[H(M.Item,{id:`light`,className:`group flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[V(o,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),V(`span`,{className:`ml-2`,children:`Light`})]}),H(M.Item,{id:`dark`,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[V(i,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),V(`span`,{className:`ml-2`,children:`Dark`})]}),H(M.Item,{id:`system`,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[V(d,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),V(`span`,{className:`ml-2`,children:`System`})]})]})]})}function We({className:e}){let{theme:t,setTheme:n}=P(),[r,a]=z(!1);if(L(()=>{a(!0)},[]),!r)return V(`div`,{className:T(`h-10 w-full bg-surface rounded-xl animate-pulse`,e)});let s=t===`dark`;return H(`div`,{className:T(`flex p-1 bg-surface border border-subtle rounded-xl relative w-full h-11`,e),children:[V(`div`,{className:T(`absolute inset-y-1 w-[calc(50%-4px)] bg-main border border-subtle rounded-lg transition-all duration-300 ease-out shadow-xs`,s?`translate-x-full`:`translate-x-0`)}),V(`button`,{onClick:()=>n(`light`),className:T(`flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent`,s?`text-muted hover:text-body`:`text-body font-semibold`),"aria-label":`Light mode`,children:V(o,{size:18})}),V(`button`,{onClick:()=>n(`dark`),className:T(`flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent`,s?`text-body font-semibold`:`text-muted hover:text-body`),"aria-label":`Dark mode`,children:V(i,{size:18})})]})}function Ge(e=[],t=[]){let n=I(),r=Ee([]),[i,a]=z({opacity:0,transform:`translateX(0) scaleX(0)`,width:0}),o=h(n.pathname),s=t.find(e=>h(e.path)===o)?.tab?.toLowerCase(),c=e.findIndex(e=>e.id.toLowerCase()===s),l=c===-1?0:c;return L(()=>{let e=r.current[l];e&&a({opacity:1,width:e.offsetWidth,transform:`translateX(${e.offsetLeft}px)`})},[l,e.length,n.pathname]),{tabs:e,activeIndex:l,indicatorStyle:i,tabRefs:r,activeTabId:s}}function Ke({tabs:e,routes:t}){let{currentLocale:n}=p(),{indicatorStyle:r,tabRefs:i,activeIndex:a}=Ge(e,t);L(()=>{let e=i.current[a];e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},[a]);let o=e=>{if(!e)return null;if(e.trim().startsWith(`<svg`))return V(`span`,{className:`h-4 w-4`,dangerouslySetInnerHTML:{__html:e}});let t={...m,...Oe},n=t[e]||t[e+`Icon`];return n?V(n,{size:16}):V(`img`,{src:e,alt:``,className:`h-4 w-4 object-contain`})};return V(`div`,{className:`mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6 select-none`,children:H(ne.List,{className:`border-none py-0 scrollbar-hide relative flex flex-row items-center`,children:[e.map((e,r)=>{let s=r===a,c=t.find(t=>t.tab&&t.tab.toLowerCase()===e.id.toLowerCase());return H(g,{href:c?c.path:`#`,ref:e=>{i.current[r]=e},className:`relative flex items-center gap-2 px-4 py-3.5 text-sm font-semibold transition-colors duration-300 outline-none whitespace-nowrap ${s?`text-primary-500`:`text-muted hover:text-body`}`,children:[o(e.icon),V(`span`,{children:G(e.text,n)})]},e.id)}),V(ne.Indicator,{style:r,className:`h-0.5 bg-primary-500 rounded-full transition-all duration-300`})]})})}function q(e,t,n){let r=e;return t&&(r===t||r.startsWith(t+`/`))&&(r=r===t?`index.md`:r.slice(t.length+1)),n&&(r===n||r.startsWith(n+`/`))&&(r=r===n?`index.md`:r.slice(n.length+1)),r}function qe(){let t=ye(),n=x(),{allRoutes:r,currentRoute:i,currentVersion:a,currentLocale:o}=p(),s=n.versions,{setVersion:c}=e();return{currentVersion:a,currentVersionLabel:s?.versions?.find?.(e=>e.path===a)?.label||a,availableVersions:R(()=>s?s.versions.map(e=>({key:e.path,label:e.label,value:e.path,isCurrent:e.path===a})):[],[s,a]),handleVersionChange:e=>{if(!s||e===a)return;c(e);let l=`${(n.base||`/docs`).replace(/\/$/,``)}/${e}${o?`/${o}`:``}`;if(i){let t=q(i.filePath,i.version,i.locale),a=r.find(r=>q(r.filePath,r.version,r.locale)===t&&(r.version||s.defaultVersion)===e&&(!n.i18n||(r.locale||n.i18n.defaultLocale)===o));if(a)l=a.path;else{let t=r.find(t=>q(t.filePath,t.version,t.locale)===`index.md`&&(t.version||s.defaultVersion)===e&&(!n.i18n||(t.locale||n.i18n.defaultLocale)===o));t&&(l=t.path)}}else{let t=r.find(t=>(t.version||s.defaultVersion)===e&&(!n.i18n||(t.locale||n.i18n.defaultLocale)===o));t&&(l=t.path)}t(l)}}}function Je(){let t=ye(),n=x(),{allRoutes:r,currentRoute:i,currentLocale:a,currentVersion:o}=p(),s=n.i18n,{setLocale:c}=e(),l=e=>{if(!s||e===a)return;c(e);let l=n.base||`/`,u=l===`/`?``:l.replace(/\/$/,``),d=!!i?.filePath,f=``;if(i)if(d){let t=q(i.filePath,i.version,i.locale),n=r.find(n=>q(n.filePath,n.version,n.locale)===t&&(n.locale||s.defaultLocale)===e&&n.version===i.version);if(n)f=n.path;else{let t=r.find(t=>q(t.filePath,t.version,t.locale)===`index.md`&&(t.locale||s.defaultLocale)===e&&t.version===i.version);f=t?t.path:`${u}${i.version?`/${i.version}`:``}${e===s.defaultLocale?``:`/${e}`}`||`/`}}else{let t=i.path,n=t.split(`/`).filter(Boolean);if(n.length>0&&(Array.isArray(s.locales)?s.locales.includes(n[0]):s.locales[n[0]])&&(n.shift(),t=`/`+n.join(`/`)),e===s.defaultLocale)f=t===``?`/`:t;else{let n=t.startsWith(`/`)?t:`/${t}`;f=`/${e}${n===`/`?``:n}`}}else{let t=r.find(t=>(t.locale||s.defaultLocale)===e&&(t.version||n.versions?.defaultVersion)===(o||n.versions?.defaultVersion));if(t)f=t.path;else{let t=o&&o!==n.versions?.defaultVersion?`/${o}`:``;f=e===s.defaultLocale?`${u}${t}`:`${u}${t}/${e}`}}(!f||f===``)&&(f=`/`),f=f.replace(/\/+/g,`/`),t(f)},u=s?.locales,d=u?Array.isArray(u)?a:u[a]:void 0;return{currentLocale:a,currentLocaleLabel:s?.localeConfigs?.[a]?.label||d||a,availableLocales:R(()=>s?Array.isArray(s.locales)?s.locales.map(e=>({key:e,label:s?.localeConfigs?.[e]?.label||e,value:e,isCurrent:e===a})):Object.entries(s.locales).map(([e,t])=>({key:e,label:s?.localeConfigs?.[e]?.label||t,value:e,isCurrent:e===a})):[],[s,a]),handleLocaleChange:l}}function J({className:e}){let{currentVersionLabel:t,availableVersions:n,handleVersionChange:r}=qe();return n.length===0?null:H(M.Trigger,{children:[H(E,{className:T(`flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer`,e),children:[V(`span`,{className:`font-semibold text-[0.8125rem]`,children:t}),V(u,{className:`w-3.5 h-3.5 text-muted/60`})]}),V(M.Root,{className:`w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:V(M.Section,{items:n,children:e=>V(M.Item,{onPress:()=>r(e.value),className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body hover:bg-primary-50/50 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:e.label},`${e.value??``}`)})})]})}function Ye({className:e}){let{currentLocale:t,availableLocales:n,handleLocaleChange:r}=Je();return n.length===0?null:H(M.Trigger,{children:[H(E,{className:T(`flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer`,e),children:[H(`div`,{className:`flex items-center gap-1.5`,children:[V(s,{className:`w-3.5 h-3.5 text-primary-500`}),V(`span`,{className:`font-bold text-[0.75rem] uppercase opacity-90`,children:t||`en`})]}),V(u,{className:`w-3.5 h-3.5 text-muted/60`})]}),V(M.Root,{className:`w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:V(M.Section,{items:n,children:e=>V(M.Item,{onPress:()=>r(e.value),className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:V(`span`,{children:e.label})},`${e.value??``}`)})})]})}const Xe=Se(()=>import(`../search-dialog-ByvGScjt.js`).then(e=>({default:e.SearchDialog})));function Ze(){let{links:e,title:n,logo:r,logoProps:i,github:o,social:s,config:c}=K(),{routes:l,allRoutes:u,currentRoute:d,currentVersion:f,currentLocale:m}=p(),{pathname:h}=I(),{isSidebarOpen:g,toggleSidebar:_}=O(),[v,y]=z(!1),b=c.theme||{},x=!!d?.filePath,S=b?.tabs&&b.tabs.length>0;return H(F.Root,{className:T(`border-b border-subtle bg-main/80 backdrop-blur-md`,S&&`border-b-0`),children:[H(F.Content,{children:[H(F.Left,{children:[x&&V(E,{onPress:_,className:`mr-2 lg:hidden p-1.5 h-8 w-8 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 transition-colors`,"aria-label":g?`Close sidebar`:`Open sidebar`,children:V(g?a:t,{className:`w-5 h-5 text-body`})}),r&&V(F.Logo,{src:r,alt:i?.alt||n,width:i?.width??24,height:i?.height??24,href:`site:/`}),V(F.Title,{href:`site:/`,children:n}),V(`div`,{className:`hidden sm:block`,children:c.versions&&f&&V(J,{})})]}),V(F.Center,{children:V(be,{fallback:V(`div`,{className:`h-9 w-32 animate-pulse rounded-md bg-surface`}),children:V(Xe,{routes:l||[]})})}),H(F.Right,{children:[V(be,{fallback:null,children:V(`div`,{className:`lg:hidden`,children:V(Xe,{routes:l||[]})})}),V(F.Links,{children:e.map(e=>V(Qe,{link:e},e.href))}),H(`div`,{className:`hidden sm:flex items-center gap-2`,children:[c.i18n&&m&&V(Ye,{}),V(F.Split,{className:`bg-subtle`})]}),V(`div`,{className:`hidden md:block`,children:V(Ue,{})}),o&&V(`div`,{className:`hidden md:block`,children:V(He,{repo:b?.githubRepo??``})}),s.length>0&&V(`div`,{className:`hidden md:block`,children:V(F.Split,{className:`bg-subtle`})}),V(`div`,{className:`hidden md:flex items-center gap-1`,children:s.map(({icon:e,link:t})=>V(F.Socials,{icon:e,link:t,className:`p-1.5 text-muted hover:text-body hover:bg-surface rounded-md transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30`},t))}),V(F.More,{onPress:()=>y(!0),className:`text-muted hover:text-body active:scale-90 transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30`})]})]}),H(F.MobileMenu,{isOpen:v,onClose:()=>y(!1),className:`bg-main/98 backdrop-blur-2xl`,children:[V(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>V($e,{link:e,onClose:()=>y(!1)},e.href))}),s.length>0&&H(`div`,{className:`mt-6`,children:[V(`div`,{className:`px-4 mb-4 text-xs font-bold uppercase tracking-widest text-muted/50`,children:`Connect`}),V(`div`,{className:`flex flex-wrap gap-2 px-2`,children:s.map(({icon:e,link:t})=>V(F.Socials,{icon:e,link:t,className:`p-3 bg-surface border border-subtle rounded-xl flex-1 justify-center`},t))})]})]}),x&&S&&b?.tabs&&V(`div`,{className:`w-full border-b border-subtle bg-main`,children:V(Ke,{tabs:b.tabs,routes:u||l||[]})})]})}function Qe({link:e}){let t=_(e.href||``),{pathname:n}=I(),r=n===t||n.startsWith(t+`/`);return e.items&&e.items.length>0?V(F.Dropdown,{label:V(`span`,{className:T(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm px-2 py-1`,r?`text-primary-500`:`text-muted hover:text-body`),children:e.label}),children:e.items?.map(e=>V(F.DropdownItem,{href:_(e.href||``),label:e.label},e.href))}):V(F.Link,{...e,href:t,active:r,className:T(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm`,r?`text-primary-500`:`text-muted hover:text-body`)})}function $e({link:e,onClose:t}){let n=_(e.href||``),{pathname:r}=I(),i=r===n;return e.items&&e.items.length>0?H(`div`,{className:`flex flex-col gap-1`,children:[V(`div`,{className:T(`px-3 py-2 text-sm transition-all`,i?`text-body`:`text-muted/80 hover:text-body`),children:e.label}),V(`div`,{className:`flex flex-col gap-1 pl-4`,children:e.items?.map(e=>V($e,{link:e,onClose:t},e.href))})]}):V(F.MobileLink,{...e,href:n,active:i,onPress:t,className:T(`transition-all`,i?`text-body`:`text-muted/80 hover:text-body`)})}function Y(){return V(`div`,{className:`flex items-center justify-center min-h-[65vh] text-center px-4`,children:H(`div`,{className:`space-y-6 max-w-md mx-auto p-8 border border-subtle bg-surface rounded-2xl shadow-xs`,children:[V(`span`,{className:`block text-7xl font-extrabold tracking-tight text-primary-500`,children:`404`}),H(`div`,{className:`space-y-2`,children:[V(`h1`,{className:`text-xl font-bold text-body`,children:`Page Not Found`}),V(`p`,{className:`text-sm text-muted leading-relaxed`,children:`The page you're looking for doesn't exist or has been moved.`})]}),H(g,{href:`/`,className:`inline-flex items-center gap-2 rounded-xl border border-subtle bg-main px-6 py-2.5 text-xs font-semibold text-body hover:bg-primary-50/50 hover:border-primary-500/50 transition-all duration-300 outline-none select-none`,children:[V(n,{size:14}),` Go to Home`]})]})})}function et({headings:e=[],editLink:t,communityHelp:n,filePath:r}){return e.length===0?null:H(k.Root,{children:[H(k.Header,{className:`flex flex-row gap-x-2`,children:[V(S,{size:16}),`On this page`]}),V(k.Tree,{headings:e}),(t||n)&&H(`div`,{className:`mt-8 pt-8 border-t border-subtle space-y-4`,children:[V(`p`,{className:`text-xs font-bold text-body`,children:`Need help?`}),H(`ul`,{className:`space-y-3`,children:[t&&r&&V(`li`,{children:H(`a`,{href:t.replace(`:path`,r),target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-muted hover:text-body transition-colors`,children:[V(f,{size:16}),`Edit this page`]})}),n&&V(`li`,{children:H(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-muted hover:text-body transition-colors`,children:[V(c,{size:16}),`Community help`]})})]})]})]})}function tt(){let{routes:e,currentRoute:t}=p(),n=I();return R(()=>{if(!t)return{prevPage:null,nextPage:null,currentRoute:null};let r=t.tab?.toLowerCase(),i=r?e.filter(e=>e.tab?.toLowerCase()===r):e.filter(e=>!e.tab),a=i.findIndex(e=>e.path===n.pathname);return{prevPage:a>0?i[a-1]:null,nextPage:a!==-1&&a<i.length-1?i[a+1]:null,currentRoute:t}},[e,t,n.pathname])}function nt(){let{prevPage:e,nextPage:t}=tt();return!e&&!t?null:H(A.Root,{className:`pt-8 border-t border-subtle grid sm:grid-cols-2 gap-4 animate-in fade-in slide-in-from-bottom-4 duration-700 select-none`,children:[e?H(A.Link,{to:e.path,direction:`prev`,className:`group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20`,children:[V(A.Title,{className:`text-xs font-bold uppercase tracking-wider text-muted/60 mb-1`,children:`Previous`}),V(A.Description,{className:`text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors`,children:e.title})]}):V(`div`,{}),t?H(A.Link,{to:t.path,direction:`next`,className:`group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20`,children:[V(A.Title,{className:`text-xs font-bold uppercase tracking-wider text-muted/60 mb-1`,children:`Next`}),V(A.Description,{className:`text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors`,children:t.title})]}):V(`div`,{})]})}function rt({routes:e,config:t}){let{logo:n,title:r,logoProps:i}=K(),{closeSidebar:o}=O(),s=n?V(`img`,{src:n,alt:i?.alt||r,width:24,height:24,className:`rounded-xl`}):null,c=t.versions||t.i18n;return H(B,{children:[V(j.Root,{children:V(j.Content,{children:V(j.Items,{routes:e})})}),H(j.Mobile,{children:[H(j.Header,{children:[H(`div`,{className:`flex items-center gap-3`,children:[s,V(`span`,{className:`font-bold text-lg tracking-tight text-body truncate max-w-[120px]`,children:r})]}),H(`div`,{className:`flex items-center gap-2`,children:[V(We,{className:`w-24 h-9 rounded-xl`}),V(E,{onPress:o,className:`h-9 w-9 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 text-muted hover:text-body transition-colors`,"aria-label":`Close sidebar`,children:V(a,{size:20})})]})]}),H(j.Content,{children:[c&&H(`div`,{className:`flex flex-col gap-4 mb-10`,children:[H(`div`,{className:`flex gap-3`,children:[t.versions&&V(J,{className:`flex-1 justify-between h-10 bg-surface border-subtle rounded-xl`}),t.i18n&&V(Ye,{className:`flex-1 justify-between h-10 bg-surface border-subtle rounded-xl`})]}),V(`div`,{className:`mt-2 border-b border-subtle`})]}),V(j.Items,{routes:e})]})]})]})}const it=Object.assign(rt,{Root:j.Root,Mobile:j.Mobile,Header:j.Header,Content:j.Content,Group:j.Group,Link:j.Link,SubGroup:j.SubGroup,Item:j.Item,Items:j.Items});function at({date:e}){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let n=t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`});return H(`div`,{className:`mt-16 pt-6 border-t border-subtle flex items-center justify-between text-xs text-muted select-none`,children:[V(`span`,{}),H(`span`,{className:`italic`,children:[`Last updated on `,n]})]})}function ot({route:e,content:t,mdxComponents:n}){let r=W(),i=R(()=>({LastUpdated:at,...r,...n}),[r,n]),a=i.LastUpdated||at;return t?H(B,{children:[V(t,{components:i}),e?.lastUpdated&&V(a,{date:e.lastUpdated})]}):null}function st({MDXComponent:e,mdxComponents:t}){let n=ve(),r=e||n?.MDXComponent,i=t||n?.mdxComponents;return r?V(ot,{route:{path:n.path,filePath:n.filePath,title:n.frontmatter.title,description:n.frontmatter.description,headings:n.headings,locale:n.locale,version:n.version,group:n.group,groupTitle:n.groupTitle,lastUpdated:n.lastUpdated,frontmatter:n.frontmatter},content:r,mdxComponents:i}):null}const X=ke,ct=X.Helmet||X.default?.Helmet||(({children:e})=>V(B,{children:e})),lt=X.HelmetProvider||X.default?.HelmetProvider||(({children:e})=>V(B,{children:e}));function ut(){let{pathname:e,hash:t}=I(),n=(e=`auto`)=>{let n=document.querySelector(`.boltdocs-content`)||window,r=()=>n===window?window.scrollY:n.scrollTop,i=(e,t)=>{n===window?window.scrollTo({top:e,behavior:t}):n.scrollTo({top:e,behavior:t})};if(t){let a=t.replace(`#`,``),o=document.getElementById(a);if(o){let t=n===window?0:n.getBoundingClientRect().top;return i(o.getBoundingClientRect().top-t-80+r(),e),!0}}return i(0,e),!1};return Te(()=>{n(`auto`)},[e,t]),L(()=>{n(`auto`);let e=requestAnimationFrame(()=>{n(`auto`),window.dispatchEvent(new Event(`resize`))});return()=>cancelAnimationFrame(e)},[e,t]),null}const dt={...he,NotFound:Y,404:Y};function Z(e){return e.endsWith(`/`)&&e.length>1?e.slice(0,-1):e}function ft({config:t}){let{currentLocale:n}=e();return L(()=>{if(!t.i18n||typeof document>`u`)return;let e=n||t.i18n.defaultLocale,r=t.i18n.localeConfigs?.[e];document.documentElement.lang=r?.htmlLang||e||`en`,document.documentElement.dir=r?.direction||`ltr`},[n,t.i18n]),null}function pt({config:t,routeMap:n}){let r=I(),{setLocale:i,setVersion:a}=e();return L(()=>{let e=Z(r.pathname),o=n.get(e);o&&(t.i18n&&i(o.locale||t.i18n.defaultLocale),t.versions&&a(o.version||t.versions.defaultVersion))},[r.pathname,t,n,i,a]),null}function mt({config:e,routes:t,components:n={}}){let r=R(()=>({...dt,...Ae,...n}),[n]),{pathname:i}=I(),a=R(()=>Z(i||`/`),[i]),o=R(()=>{let e=new Map;for(let n of t){let t=Z(n.path===``?`/`:n.path);e.set(t,n)}return e},[t]),s=R(()=>{let t=o.get(a),n,r;return t&&(e.i18n&&(n=t.locale||e.i18n.defaultLocale),e.versions&&(r=t.version||e.versions.defaultVersion)),{initLocale:n,initVersion:r}},[a,e,o]);return V(lt,{children:V(v,{routes:t,children:V(ce,{children:V(se,{children:V(Pe,{components:r,children:H(w.Provider,{value:e,children:[V(ut,{}),H(l,{initialLocale:s.initLocale,initialVersion:s.initVersion,children:[V(pt,{config:e,routeMap:o}),V(ft,{config:e}),V(_e,{})]})]})})})})})})}function ht({siteTitle:e,siteDescription:t,routes:n}){let r=I(),i=x(),{currentLocale:a}=p(),o=R(()=>n?.find?.(e=>e.path===r.pathname),[n,r.pathname]),s=o?.title,c=G(t,a),l=o?.description||c||``,u=G(e,a),d=s?`${s} | ${u}`:u,f=o?.seo||{},m=i?.seo?.metatags||{},h=i?.seo?.thumbnails?.background,g=f[`og:image`]||h;return H(ct,{children:[V(`title`,{children:d}),V(`meta`,{name:`description`,content:l}),V(`meta`,{property:`og:title`,content:d}),V(`meta`,{property:`og:description`,content:l}),V(`meta`,{property:`og:type`,content:`article`}),typeof window<`u`&&V(`meta`,{property:`og:url`,content:window.location.href}),typeof window<`u`&&V(`link`,{rel:`canonical`,href:window.location.origin+r.pathname}),V(`meta`,{name:`twitter:card`,content:`summary`}),V(`meta`,{name:`twitter:title`,content:d}),V(`meta`,{name:`twitter:description`,content:l}),g&&V(`meta`,{name:`twitter:image`,content:g}),g&&V(`meta`,{property:`og:image`,content:g}),V(`meta`,{name:`generator`,content:`Boltdocs`}),Object.entries(m).map(([e,t])=>e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?V(`meta`,{property:e,content:t},e):V(`meta`,{name:e,content:t},e)),Object.entries(f).map(([e,t])=>e===`noindex`&&t===!0?V(`meta`,{name:`robots`,content:`noindex`},`noindex`):e===`robots`?V(`meta`,{name:`robots`,content:t},`robots`):e===`canonical`?V(`link`,{rel:`canonical`,href:t},`canonical`):e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?V(`meta`,{property:e,content:t},e):V(`meta`,{name:e,content:t},e))]})}function gt(){let e=x(),{currentRoute:t,allRoutes:n}=p();return H(B,{children:[V(ht,{siteTitle:e.theme?.title,siteDescription:e.theme?.description,routes:n||[]}),V(je,{route:t,children:V(_e,{})})]})}const _t=()=>V(`div`,{className:`text-muted text-sm py-4`,children:`Loading...`}),vt=({moduleLoader:e,moduleKey:t,route:n,components:r})=>{let i=e?.default??e??null;return L(()=>{if(!import.meta.hot||!t)return;let e=e=>{e.relPath.replace(/\\/g,`/`).replace(/^\//,``)===n.filePath.replace(/\\/g,`/`).replace(/^\//,``)&&import(t+`?t=`+Date.now()).then(e=>{})};return import.meta.hot.on(`boltdocs:mdx-update`,e),()=>import.meta.hot?.off(`boltdocs:mdx-update`,e)},[t,n.filePath]),i?V(st,{MDXComponent:i,mdxComponents:r}):V(_t,{})},yt=()=>{let e=W();return V(e.NotFound||e[404]||Y,{})};function bt(e){let{routesData:t,config:n,mdxModules:r,externalPages:i,externalLayout:a,components:o}=e,s=a||(({children:e})=>V(B,{children:e})),c=e=>{let t=n.base||`/`;return e.startsWith(t)?e:`${t===`/`?``:t.replace(/\/$/,``)}${e.startsWith(`/`)?e:`/${e}`}`||`/`},l=[],u=n.versions?.defaultVersion,d=(n.base||`/docs`).replace(/\/$/,``),f=(n.base||`/docs`).replace(/\/$/,``);f||=`/`,u&&t.forEach(e=>{if(e.version)return;let t=e.path||``,n=t.startsWith(d)?t.substring(d.length).replace(/^\//,``):t.replace(/^\//,``);if(!(n===u||n.startsWith(`${u}/`))){let t=`${d}/${u}/${n}`.replace(/\/+/g,`/`).replace(/\/$/,``)||`/`;l.push({...e,path:t,version:u})}});let p=[...t,...l],m=new Map,h=Object.keys(r);if(h.length>0){let e=h[0].replace(/\\/g,`/`).split(`/`).filter(Boolean)[0]||`docs`,t=`/${e}/`,n=`./${e}/`;for(let e of h){let r=e.replace(/\\/g,`/`),i=``;r.indexOf(t)===-1?r.startsWith(n)&&(i=r.substring(n.length)):i=r.substring(r.indexOf(t)+t.length),i?m.set(i,e):m.set(r,e)}}let g=p.map(e=>{let t=e.filePath.replace(/\\/g,`/`),n=m.get(t),i=n?r[n]:null,a=c(e.path===``?`/`:e.path),s=a===f?`.`:a.startsWith(f+`/`)?a.slice(f.length+1):a;return{path:s,element:V(vt,{moduleKey:n,moduleLoader:i,route:e,components:o},n||s),loader:async()=>({path:s,frontmatter:{title:e.title,description:e.description||``,...e.frontmatter||{}},headings:e.headings||[],filePath:e.filePath,locale:e.locale,version:e.version,group:e.group,groupTitle:e.groupTitle,date:e.date,lastUpdated:e.lastUpdated}),getStaticPaths:()=>[s]}}),_=n.i18n?.locales?Array.isArray(n.i18n.locales)?n.i18n.locales:Object.keys(n.i18n.locales):[],v=n.versions?.versions?.map(e=>e.path)||[],y=[];y.push({path:f,filter:()=>!0});let b=[];v.length>0&&v.forEach(e=>b.push(`/${e}`)),_.length>0&&_.forEach(e=>b.push(`/${e}`)),v.length>0&&_.length>0&&v.forEach(e=>{_.forEach(t=>{b.push(`/${e}/${t}`)})}),b.forEach(e=>{let t=f===`/`?e:`${f}${e}`;y.push({path:t,filter:e=>e.startsWith(t.replace(/\/$/,``)+`/`)})});let x=new Set(g.map(e=>(e.path||``).replace(/\/$/,``))),S=new Set;i&&Object.keys(i).forEach(e=>{let t=e.startsWith(`/`)?e:`/${e}`;S.add(t.replace(/\/$/,``)),n.i18n&&Object.keys(n.i18n.locales).forEach(e=>{S.add(`/${e}${t===`/`?``:t}`.replace(/\/$/,``))})}),y.forEach(({path:e,filter:t})=>{if(e===`/`)return;let r=e.replace(/\/$/,``);if(!(x.has(r)||S.has(r))){let i=n.theme?.tabs?.[0]?.id,a=i?`${r}/${i}`.replace(/\/+/g,`/`):null,o=a&&x.has(a.replace(/\/$/,``))?g.find(e=>e.path.replace(/\/$/,``)===a.replace(/\/$/,``)):g.find(e=>t(e.path)&&e.path!==r);if(!o&&g.length>0&&(o=g[0]),o){let t=e===f?`.`:e.startsWith(f+`/`)?e.slice(f.length+1):e,r=t===`.`;g.push({...r?{index:!0}:{path:t},element:o.element,loader:o.loader,getStaticPaths:()=>[]});let i=p.find(e=>{let t=c(e.path===``?`/`:e.path);return(t===f?`.`:t.startsWith(f+`/`)?t.slice(f.length+1):t)===o.path});if(i){let t=c(i.path),r=n.siteUrl?`${n.siteUrl.replace(/\/$/,``)}${t}`:t;p.push({...i,path:e,filePath:``,slugParts:[],seo:{...i.seo,canonical:r}})}}}});let C=[{path:f,element:V(gt,{}),children:g}],w=[];return i&&Object.entries(i).forEach(([e,t])=>{let r=e.startsWith(`/`)?e:`/${e}`;C.find(e=>e.path===r)||(w.push({path:r,locale:n.i18n?.defaultLocale,title:e===`/`?`Home`:e.replace(/^\//,``).split(`/`).pop()||`Page`,filePath:``,headings:[]}),C.push({path:r,element:V(s,{children:V(t,{})}),loader:async()=>({path:r,locale:n.i18n?.defaultLocale}),getStaticPaths:()=>[r]}),n.i18n&&Object.keys(n.i18n.locales).forEach(n=>{let r=`/${n}${e===`/`?``:e}`;C.find(e=>e.path===r)||(w.push({path:r,locale:n,title:e,filePath:``,headings:[]}),C.push({path:r,element:V(s,{children:V(t,{})}),loader:async()=>({path:r,locale:n}),getStaticPaths:()=>[r]}))}))}),C.push({path:`*`,element:V(s,{children:V(yt,{})})}),[{element:V(mt,{config:n,routes:[...p,...w],components:o}),children:C}]}function Q(e){return typeof window>`u`?$():typeof window.gtag==`function`?xt(e):window.dataLayer?St(e):$()}function xt(e){return{trackPageView:(t,n)=>{window.gtag?.(`event`,`page_view`,{page_path:t,page_title:n||document.title,send_to:e?.ga4?.measurementId})},trackEvent:({action:t,category:n,label:r,value:i,params:a})=>{window.gtag?.(`event`,t,{event_category:n,event_label:r,value:i,send_to:e?.ga4?.measurementId,...a})},trackSearch:(t,n)=>{window.gtag?.(`event`,`search`,{search_term:t,results_count:n,send_to:e?.ga4?.measurementId})},trackDownload:(t,n)=>{window.gtag?.(`event`,`file_download`,{file_name:t,file_type:n||t.split(`.`).pop(),send_to:e?.ga4?.measurementId})},trackExternalLink:t=>{window.gtag?.(`event`,`external_link`,{link_url:t,send_to:e?.ga4?.measurementId})},isEnabled:!0}}function St(e){return{trackPageView:(t,n)=>{window.dataLayer?.push({event:`page_view`,page_path:t,page_title:n||document.title,send_to:e?.gtm?.tagId})},trackEvent:({action:t,category:n,label:r,value:i,params:a})=>{window.dataLayer?.push({event:t,event_category:n,event_label:r,value:i,send_to:e?.gtm?.tagId,...a})},trackSearch:(t,n)=>{window.dataLayer?.push({event:`search`,search_term:t,results_count:n,send_to:e?.gtm?.tagId})},trackDownload:(t,n)=>{window.dataLayer?.push({event:`file_download`,file_name:t,file_type:n||t.split(`.`).pop(),send_to:e?.gtm?.tagId})},trackExternalLink:t=>{window.dataLayer?.push({event:`external_link`,link_url:t,send_to:e?.gtm?.tagId})},isEnabled:!0}}function $(){return{trackPageView:()=>{},trackEvent:()=>{},trackSearch:()=>{},trackDownload:()=>{},trackExternalLink:()=>{},isEnabled:!1}}const Ct=Symbol.for(`__BDOCS_CONFIG_INSTANCE__`);function wt(e={}){let{config:t,autoTrackPageViews:n=!0,autoTrackDownloads:r=!0,autoTrackExternalLinks:i=!0,excludePatterns:a=[]}=e,o=typeof globalThis<`u`?globalThis[Ct]:void 0,s=t??o?.integrations,c=R(()=>Q(s),[s]),l=Ee(``),u=oe();return L(()=>{if(!n||!c.isEnabled)return;let e=u.pathname+u.search;e!==l.current&&(l.current=e,c.trackPageView(e,document.title))},[u.pathname,n,c]),L(()=>{if(!r||!c.isEnabled)return;let e=e=>{let t=e.target?.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);if(n&&!a.some(e=>e.test(n))&&(t.hasAttribute(`download`)||/\.(pdf|doc|docx|xls|xlsx|ppt|pptx|zip|rar|7z|tar|gz|mp3|mp4|avi|mov|png|jpg|jpeg|gif|svg|webp)$/i.test(n))){let e=n.split(`/`).pop()||n;c.trackDownload(e,e.split(`.`).pop())}};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[r,i,c,a]),L(()=>{if(!i||!c.isEnabled)return;let e=e=>{let t=e.target?.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);n&&(a.some(e=>e.test(n))||(n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`//`))&&!n.includes(window.location.hostname)&&c.trackExternalLink(n))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[i,c,a]),c}function Tt(){let e=R(()=>Q(),[]);return we((t,n)=>{e.trackPageView(t,n)},[e])}function Et(){let e=R(()=>Q(),[]);return we(t=>{e.trackEvent(t)},[e])}function Dt({children:e}){let{routes:t,currentRoute:n}=p(),r=x();return H(N,{className:`selection:bg-primary-500/10 selection:text-primary-500`,children:[V(Ze,{}),H(N.Body,{className:`bg-main`,children:[V(it,{routes:t||[],config:r}),V(N.Content,{className:`animate-in fade-in duration-500 scroll-smooth`,children:H(N.ContentMdx,{className:`max-w-3xl sm:max-w-4xl lg:max-w-4xl px-2 pt-8 pb-24`,children:[H(N.Header,{children:[H(`div`,{className:`mb-4 border-b border-subtle pb-4 flex flex-wrap items-center justify-between gap-3`,children:[V(Ie,{}),V(Re,{mdxRaw:n?._rawContent,route:n})]}),n?.title&&V(`h1`,{className:`text-4xl font-bold tracking-tight text-default mb-3`,children:n.title}),n?.description&&V(`p`,{className:`text-lg text-muted-foreground mb-6 leading-relaxed`,children:n.description})]}),V(ze,{children:V(`div`,{className:`prose prose-neutral dark:prose-invert max-w-none`,children:e})}),V(N.Footer,{children:V(nt,{})})]})}),V(et,{headings:n?.headings,editLink:r.theme?.editLink,communityHelp:r.theme?.communityHelp,filePath:n?.filePath})]})]})}const Ot=Object.assign(Dt,{Body:N.Body,Content:N.Content,ContentMdx:N.ContentMdx,Header:N.Header,Footer:N.Footer});export{mt as BoltdocsShell,Ie as Breadcrumbs,me as Card,pe as Cards,Re as CopyMarkdown,Ot as DocsLayout,ze as ErrorBoundary,st as MdxPage,Ze as Navbar,Y as NotFound,et as OnThisPage,nt as PageNav,ue as SearchDialog,it as Sidebar,ge as ViteReactSSG,T as cn,fe as copyToClipboard,bt as createRoutes,Be as getStarsRepo,G as getTranslated,de as reactToText,wt as useAnalytics,Fe as useBreadcrumbs,x as useConfig,Je as useI18n,_ as useLocalizedTo,oe as useLocation,W as useMdxComponents,K as useNavbar,tt as usePageNav,p as useRoutes,le as useSearch,ae as useSearchHighlight,ie as useSidebar,Ge as useTabs,P as useTheme,Et as useTrackEvent,Tt as useTrackPageView,O as useUI,qe as useVersion};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import{_ as e,i as t,l as n,u as r,v as i}from"./utils-BxNAXhZZ.mjs";import{createRequire as a}from"node:module";import{loadConfigFromFile as o}from"vite";import s from"node:path";import{fdir as c}from"fdir";import l from"fs";import{z as u}from"zod";import d from"node:fs";import f from"path";import p from"picomatch";import m from"node:readline";import{distance as h}from"fastest-levenshtein";var g=Object.defineProperty,_=(e,t)=>{let n={};for(var r in e)g(n,r,{get:e[r],enumerable:!0});return t||g(n,Symbol.toStringTag,{value:`Module`}),n};const v=u.object({icon:u.string().max(50),link:u.string().url()});u.object({text:u.string().max(2e3).optional()});const y=u.enum([`fs:read`,`fs:write`,`vite:config`,`mdx:remark`,`mdx:rehype`,`components`,`hooks:build`,`hooks:dev`]),b=u.object({name:u.string(),enforce:u.enum([`pre`,`post`]).optional(),version:u.string().optional(),boltdocsVersion:u.string().optional(),permissions:u.array(y).optional(),remarkPlugins:u.array(u.any()).optional(),rehypePlugins:u.array(u.any()).optional(),vitePlugins:u.array(u.any()).optional(),components:u.record(u.string(),u.string()).optional(),hooks:u.record(u.string(),u.any()).optional()}),x=u.object({title:u.union([u.string(),u.record(u.string(),u.string())]).optional(),description:u.union([u.string(),u.record(u.string(),u.string())]).optional(),logo:u.union([u.string(),u.object({dark:u.string(),light:u.string(),alt:u.string().optional(),width:u.number().optional(),height:u.number().optional()})]).optional(),navbar:u.array(u.object({label:u.union([u.string(),u.record(u.string(),u.string())]),href:u.string(),items:u.array(u.object({label:u.union([u.string(),u.record(u.string(),u.string())]),href:u.string()})).optional()})).optional(),sidebar:u.record(u.string(),u.array(u.object({text:u.string(),link:u.string()}))).optional(),sidebarGroups:u.record(u.string(),u.object({title:u.union([u.string(),u.record(u.string(),u.string())]).optional(),icon:u.string().optional()})).optional(),socialLinks:u.array(v).optional(),editLink:u.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:u.string().url().optional(),version:u.string().max(50).optional(),githubRepo:u.string().max(100).optional(),favicon:u.string().optional(),tabs:u.array(u.object({id:u.string(),text:u.union([u.string(),u.record(u.string(),u.string())]),icon:u.string().optional()})).optional(),codeTheme:u.union([u.string(),u.object({light:u.string(),dark:u.string()})]).optional()}),S=u.union([u.string(),u.object({rules:u.array(u.object({userAgent:u.string(),allow:u.union([u.string(),u.array(u.string())]).optional(),disallow:u.union([u.string(),u.array(u.string())]).optional()})).optional(),sitemaps:u.array(u.string().url()).optional()})]),C=u.object({defaultLocale:u.string(),locales:u.union([u.record(u.string(),u.string()),u.array(u.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:u.record(u.string(),u.object({label:u.string().optional(),direction:u.enum([`ltr`,`rtl`]).optional(),htmlLang:u.string().optional(),calendar:u.string().optional()})).optional()}),w=u.object({defaultVersion:u.string(),prefix:u.string().optional(),versions:u.array(u.object({label:u.string(),path:u.string()}))}),T=u.object({headers:u.record(u.string(),u.string()).optional(),enableCSP:u.boolean().optional(),customHeaders:u.record(u.string(),u.string()).optional()}),E=u.object({metatags:u.record(u.string(),u.string()).optional(),indexing:u.enum([`all`,`public`]).optional(),thumbnails:u.object({background:u.string().optional()}).optional()}),D=u.object({measurementId:u.string().min(1,`Measurement ID is required for GA4`),debug:u.boolean().optional(),anonymizeIp:u.boolean().optional(),sendPageView:u.boolean().optional(),cookieFlags:u.string().optional(),autoTrack:u.object({pageViews:u.boolean().optional(),downloads:u.boolean().optional(),externalLinks:u.boolean().optional(),search:u.boolean().optional()}).optional()}),O=u.object({tagId:u.string().min(1,`Tag ID is required for GTM`),dataLayerName:u.string().optional(),preview:u.string().optional()}),ee=u.object({ga4:D.optional(),gtm:O.optional()}),te=u.object({siteUrl:u.string().url().optional(),docsDir:u.string().optional(),base:u.string().optional(),theme:x.optional(),i18n:C.optional(),versions:w.optional(),plugins:u.array(b).optional(),robots:S.optional(),security:T.optional(),seo:E.optional(),integrations:ee.optional(),vite:u.record(u.string(),u.unknown()).optional()});function k(e,t,n=process.cwd()){let r=s.resolve(n,`.boltdocs`);d.existsSync(r)||d.mkdirSync(r,{recursive:!0});let i=e.i18n?Object.keys(e.i18n.locales):[],a=e.versions?e.versions.versions.map(e=>e.path):[],o=i.length>0?i.map(e=>`'${e}'`).join(` | `):`string`,c=a.length>0?a.map(e=>`'${e}'`).join(` | `):`string`,l=[`tsx`,`ts`,`jsx`,`js`],u=``,f=``;for(let e of l){let i=s.resolve(n,t,`mdx-components.${e}`);if(d.existsSync(i)){let e=s.join(n,t,`mdx-components`),i=s.relative(r,e).replace(/\\/g,`/`);u=`import type * as MdxComponentsModule from '${i.startsWith(`.`)?i:`./${i}`}'\n`,f=` MdxComponents: typeof MdxComponentsModule`;break}}let p=`// This file is automatically generated by Boltdocs.
|
|
7
|
+
// Do not edit this file manually.
|
|
8
|
+
|
|
9
|
+
${u}declare global {
|
|
10
|
+
namespace Boltdocs {
|
|
11
|
+
interface Types {
|
|
12
|
+
Locale: ${o}
|
|
13
|
+
Version: ${c}${f?`\n${f}`:``}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {}
|
|
19
|
+
`;d.writeFileSync(s.resolve(r,`types.d.ts`),p)}function ne(e){return e}const A=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function j(t,n=process.cwd()){let r=n,i={docsDir:s.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`}}},a={};for(let e of A){let t=s.resolve(r,e);if(d.existsSync(t))try{let e=await o({command:`serve`,mode:`development`},t,r);if(e){a=e.config;break}}catch(t){console.warn(`[boltdocs] Failed to load config from ${e}:`,t)}}let c={title:a.title,description:a.description,logo:a.logo,favicon:a.favicon,navbar:a.navbar,sidebar:a.sidebar,sidebarGroups:a.theme?.sidebarGroups,socialLinks:a.socialLinks,githubRepo:a.githubRepo,tabs:a.tabs,codeTheme:a.codeTheme,communityHelp:a.communityHelp,version:a.version,editLink:a.editLink,...a.theme||{}},l=Object.fromEntries(Object.entries(c).filter(([e,t])=>t!==void 0));l.navbar&&=l.navbar.map(e=>({label:e.label||e.text||``,href:e.href||e.link||e.to||``,items:e.items}));let u={docsDir:s.resolve(t),theme:{...i.theme,...l},i18n:a.i18n?{...a.i18n,locales:Array.isArray(a.i18n.locales)?Object.fromEntries(a.i18n.locales.map(e=>[e,e])):a.i18n.locales}:void 0,versions:a.versions,siteUrl:a.siteUrl,base:a.base,seo:a.seo,plugins:a.plugins||[],robots:a.robots,security:a.security,integrations:a.integrations,vite:a.vite},f=te.safeParse(u);if(!f.success)throw new e(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
|
|
20
|
+
`)}`);return f.data}async function re(e,t=process.cwd()){let n=await j(e,t);return k(n,e,t),n}var ie=_({box:()=>B,colors:()=>M,confirm:()=>N,divider:()=>z,error:()=>L,formatLog:()=>P,info:()=>F,success:()=>R,warn:()=>I});const M={reset:`\x1B[0m`,bold:`\x1B[1m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,cyan:`\x1B[36m`,gray:`\x1B[90m`,dim:`\x1B[2m`,magenta:`\x1B[35m`};function N(e){let t=m.createInterface({input:process.stdin,output:process.stdout});return new Promise(n=>{t.question(`${P(e,M.yellow)} (y/N): `,e=>{t.close(),n(e.toLowerCase()===`y`||e.toLowerCase()===`yes`)})})}function P(e,t=``){return`${t}${M.bold}[boltdocs]${M.reset} ${e}${M.reset}`}function F(e){console.log(P(e))}function I(e){console.log(P(e,M.yellow))}function L(e,t){console.error(P(e,M.red)),t&&console.error(t)}function R(e){console.log(P(e,M.green))}function z(){console.log(M.gray+`─`.repeat(50)+M.reset)}function B(e){let t=`━`.repeat(e.length+4);console.log(`\n${M.cyan}┏${t}┓`),console.log(`┃ ${M.bold}${e}${M.reset}${M.cyan} ┃`),console.log(`┗${t}┛${M.reset}\n`)}const ae=a(import.meta.url);let V=0;function oe(e,t){let n=e.split(`-`)[0].split(`.`).map(Number),r=t.split(`-`)[0].split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]??0,i=r[e]??0;if(Number.isNaN(t)||Number.isNaN(i))return!1;if(t!==i)return t>i}return!1}async function se(){try{let e=new AbortController,t=setTimeout(()=>e.abort(),2e3),n=await fetch(`https://registry.npmjs.org/boltdocs/latest`,{signal:e.signal,headers:{Accept:`application/vnd.npm.install-v1+json`}});return clearTimeout(t),n.ok?(await n.json()).version??null:null}catch{return null}}async function ce(){try{return ae(`boltdocs/package.json`).version}catch{return`0.0.0`}}function le(e,t){let n=Math.max(0,t-e.length);return` `.repeat(Math.floor(n/2))+e+` `.repeat(Math.ceil(n/2))}function H(e,t){return e+` `.repeat(Math.max(0,t-e.length))}function ue(e,t){let n=`═`.repeat(54),r=[];r.push(`${M.cyan}╔${n}╗${M.reset}`),r.push(`${M.cyan}║${M.reset}${le(`🚀 Update available!`,54)}${M.cyan}║${M.reset}`),r.push(`${M.cyan}║${M.reset}${` `.repeat(54)}${M.cyan}║${M.reset}`);let i=`Current: ${e} → ${t}`,a=`${M.dim}Current:${M.reset} ${M.red}${e}${M.reset} ${M.gray}→${M.reset} ${M.green}${t}${M.reset}`;r.push(`${M.cyan}║${M.reset} ${a}${H(``,52-i.length)}${M.cyan}║${M.reset}`),r.push(`${M.cyan}║${M.reset}${` `.repeat(54)}${M.cyan}║${M.reset}`);let o=`${M.dim}Run:${M.reset} ${M.bold}npm install boltdocs@latest${M.reset}`;return r.push(`${M.cyan}║${M.reset} ${o}${H(``,19)}${M.cyan}║${M.reset}`),r.push(`${M.cyan}╚${n}╝${M.reset}`),`
|
|
21
|
+
`+r.join(`
|
|
22
|
+
`)+`
|
|
23
|
+
`}async function U(){let e=Date.now();if(e-V<864e5)return;V=e;let t=await ce();if(t===`0.0.0`)return;let n=await se();n&&oe(n,t)&&console.log(ue(t,n))}const W={$schema:`https://boltdocs.vercel.app/schemas/doctor-config.schema.json`,checks:{metadata:{enabled:!0,titleMin:10,titleMax:60,descriptionMin:50,required:[`title`,`description`],optional:[],validateDates:!1},links:{internal:!0,external:!1,timeout:1e4,concurrency:10,ignore:[]},i18n:{enabled:!0}},fix:{confirmChanges:!1,backupFiles:!1,backupPath:`.boltdocs/backups`},reporting:{format:`pretty`,outputFile:`.boltdocs/doctor-report.json`,failOnError:!1,maxWarnings:-1},severity:{missingTranslation:`warning`,brokenLink:`high`,brokenAnchor:`warning`,largeFile:`warning`,orphanedPage:`low`,duplicateTitle:`low`,shortMetadata:`low`,missingMetadata:`warning`,malformedFrontmatter:`high`,invalidFrontmatter:`high`},exclude:[]};function G(e,t,n){return e.doctorConfig.severity[t]||n}async function de(e,t){d.existsSync(t)||d.mkdirSync(t,{recursive:!0});let n=s.basename(e),r=new Date().toISOString().replace(/[:.]/g,`-`),i=s.join(t,`${n}.${r}.bak`);d.copyFileSync(e,i)}const K=new Map;function q(e){let t=K.get(e);if(t)return t;let n=(async()=>{let t=await r(e,!1);return{raw:t.raw,data:t.data,content:t.content}})();return K.set(e,n),n}const J=new Map;function Y(e){if(J.has(e))return J.get(e);let t=!1;try{t=d.existsSync(e)&&d.statSync(e).isFile()}catch{t=!1}return J.set(e,t),t}async function X(e){let t=s.resolve(e,`doctor.json`);if(d.existsSync(t))try{let e=JSON.parse(d.readFileSync(t,`utf-8`));return{...W,...e,checks:{...W.checks,...e.checks,metadata:{...W.checks.metadata,...e.checks?.metadata},links:{...W.checks.links,...e.checks?.links},i18n:{...W.checks.i18n,...e.checks?.i18n}},fix:{...W.fix,...e.fix},reporting:{...W.reporting,...e.reporting},severity:{...W.severity,...e.severity},exclude:[...W.exclude,...e.exclude||[]]}}catch(e){I(`Failed to parse doctor.json: ${e}`)}return W}async function Z(e,n=process.cwd(),r,i){let a=s.resolve(n,`.boltdocs`);d.existsSync(a)||d.mkdirSync(a,{recursive:!0});let o=i;o||=await new c().withFullPaths().filter(e=>e.endsWith(`.md`)||e.endsWith(`.mdx`)).crawl(e).withPromise();let l=r?.base||`/docs`,u=[];for(let n=0;n<o.length;n+=100){let r=o.slice(n,n+100),i=await Promise.all(r.map(async n=>{let r=s.isAbsolute(n)?n:s.resolve(e,n),i=s.relative(e,r),{data:a}=await q(r),o;return o=a.permalink?a.permalink.startsWith(`/`)?a.permalink:`/${a.permalink}`:t(i),l===`/`?o:(l.endsWith(`/`)?l:l+`/`)+(o.startsWith(`/`)?o.substring(1):o)}));u.push(...i)}u.includes(l)||u.push(l);let f={routes:Array.from(new Set(u)).sort(),timestamp:Date.now()};return d.writeFileSync(s.resolve(a,`link-tree.json`),JSON.stringify(f,null,2)),f}function fe(e,t){if(e===t)return 1;if(!e||!t)return 0;let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean),i=n[n.length-1]||``,a=r[r.length-1]||``;if(i===a){let e=0;for(let t of n)r.includes(t)&&e++;return e>=2?.99:.9}if(i.length>3&&a.length>3&&(a.startsWith(i)||i.startsWith(a))&&Math.min(i.length,a.length)/Math.max(i.length,a.length)>.5)return .88;let o=1-h(i,a)/Math.max(i.length,a.length);return o>.8?o*.95:1-h(e,t)/Math.max(e.length,t.length)}const Q=new Map;function $(e,t){if(Q.has(e))return Q.get(e);let n=e.length,r=``,i=0;for(let a of t){if(a===e)continue;let t=a.length,o=Math.max(n,t);if(o===0)continue;let s=1-Math.abs(n-t)/o;if(s<=.8&&s<=i)continue;let c=fe(e,a);c>i&&(i=c,r=a)}let a={bestMatch:r,similarity:i};return Q.set(e,a),a}async function pe(e){let t=[];if(!e.doctorConfig.checks.metadata.enabled)return t;let{titleMin:r,titleMax:a,descriptionMin:o}=e.doctorConfig.checks.metadata,s=new Map;for(let c of e.files){let l=n(f.relative(e.docsDir,c));try{let{raw:n,data:u}=await q(c);if(n.trim().startsWith(`---`)&&n.split(`---`).length>=3&&Object.keys(u).length===0){let n=G(e,`malformedFrontmatter`,`high`);n!==`off`&&t.push({file:l,level:n,message:`Malformed frontmatter (YAML parsing failed).`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}let d=i.safeParse(u);if(!d.success){let n=G(e,`invalidFrontmatter`,`high`);if(n!==`off`)for(let e of d.error.issues)t.push({file:l,level:n,message:`Invalid frontmatter field "${e.path.join(`.`)}": ${e.message}`,suggestion:`Ensure the field follows the correct type.`})}let f=Array.from(new Set([`title`,...e.doctorConfig.checks.metadata.required]));for(let n of f)if(u[n]===void 0){let r=G(e,`missingMetadata`,`warning`);r!==`off`&&t.push({file:l,level:r,message:`Missing required frontmatter field: "${n}".`,suggestion:`Add the "${n}" field to your frontmatter.`})}if(e.doctorConfig.checks.metadata.validateDates){let n=[`date`,`lastUpdated`,...e.doctorConfig.checks.metadata.optional.filter(e=>e.toLowerCase().includes(`date`))];for(let r of n)if(u[r]&&isNaN(Date.parse(String(u[r])))){let n=G(e,`invalidFrontmatter`,`high`);n!==`off`&&t.push({file:l,level:n,message:`Invalid date format in field "${r}": "${u[r]}".`,suggestion:`Use a valid ISO date format (e.g., YYYY-MM-DD).`})}}if(u.title){let n=String(u.title);if(n.length<r){let i=G(e,`shortMetadata`,`low`);i!==`off`&&t.push({file:l,level:i,message:`Title is too short (${n.length} chars).`,suggestion:`Titles should be at least ${r} characters for better SEO.`})}else if(n.length>a){let r=G(e,`shortMetadata`,`low`);r!==`off`&&t.push({file:l,level:r,message:`Title is too long (${n.length} chars).`,suggestion:`Titles should be under ${a} characters.`})}let i=s.get(n)||[];i.push(l),s.set(n,i)}if(u.description&&String(u.description).length<o){let n=G(e,`shortMetadata`,`low`);n!==`off`&&t.push({file:l,level:n,message:`Description is very short.`,suggestion:`Descriptions should ideally be at least ${o} characters.`})}}catch(n){let r=G(e,`malformedFrontmatter`,`high`);r!==`off`&&t.push({file:l,level:r,message:`Malformed frontmatter (YAML error): ${n.message}`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}}for(let[n,r]of s.entries())if(r.length>1){let i=G(e,`duplicateTitle`,`low`);if(i!==`off`)for(let e of r)t.push({file:e,level:i,message:`Duplicate title found: "${n}"`,suggestion:`Ensure each page has a unique title. Also used in: ${r.filter(t=>t!==e).join(`, `)}`})}return t}async function me(e){let t=[],{internal:r,external:i,ignore:a,timeout:o,concurrency:s}=e.doctorConfig.checks.links;if(!r&&!i&&!e.options.checkExternal)return t;let c=/(?:\[.*?\]\((.*?)\))|(?:href=["']([^"']+)["'])/g,u=new Set,d=5e5;for(let o of e.files){let s=n(f.relative(e.docsDir,o)),{content:p}=await q(o),m=[...(p.length>d?p.slice(0,d):p).replace(/```[\s\S]*?```/g,``).replace(/`[^`\n]*`/g,``).matchAll(c)];for(let n of m){let c=n[1]||n[2],d=!!n[1];if(!c||a.some(e=>c.includes(e)))continue;if(/^https?:\/\//i.test(c)){(i||e.options.checkExternal)&&u.add({url:c,file:o});continue}if(!r||/^(mailto|tel|#)/i.test(c))continue;let p;try{p=decodeURIComponent(c.split(`#`)[0].split(`?`)[0])}catch{p=c.split(`#`)[0].split(`?`)[0]}if(!p)continue;let m=!1,h=``;if(p.startsWith(`/`))if(e.routeIndex.has(p)||e.routeIndexWithSlash.has(p)||e.routeIndexWithoutSlash.has(p))m=!0;else{let t=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);if(e.routeIndex.has(t)||e.routeIndexWithSlash.has(t))m=!1,h=t;else{let t=e.config.base!==`/`&&p.startsWith(e.config.base||`/`)?p.substring((e.config.base||`/`).length):p,n=t.startsWith(`/`)?t.substring(1):t;h=f.join(e.docsDir,n),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>Y(h+e))}}else h=f.resolve(f.dirname(o),p),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>Y(h+e));if(!m){let{bestMatch:n,similarity:r}=$(p,e.linkTree.routes),i=!1,a=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);(e.routeIndex.has(a)||e.routeIndexWithSlash.has(a))&&(n=a,r=1,i=!0);let u=r>.6||i,f=r>.75&&n!==p||i,m=G(e,`brokenLink`,`high`);m!==`off`&&t.push({file:s,level:m,message:`Broken internal link: "${c}"`,suggestion:u?`Did you mean "${n}"?`:`Ensure the target exists or check for typos.`,fix:f?async()=>{let e=c.includes(`#`)?`#`+c.split(`#`)[1]:``,t=d?`(${c})`:`href="${c}"`,r=d?`(${n}${e})`:`href="${n}${e}"`,i=l.readFileSync(o,`utf-8`).replace(t,r);l.writeFileSync(o,i),K.delete(o)}:void 0})}}}if(u.size>0){F(`${M.gray}Verifying ${u.size} external links...${M.reset}`);let r=new Map;for(let e of u)r.has(e.url)||r.set(e.url,[]),r.get(e.url).push(e.file);let i=async e=>{try{let t=new AbortController,n=setTimeout(()=>t.abort(),o),r=await fetch(e,{method:`HEAD`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}});return clearTimeout(n),!r.ok&&r.status!==404?{url:e,ok:(await fetch(e,{method:`GET`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}})).ok}:{url:e,ok:r.ok}}catch(t){return{url:e,ok:!1,error:t.message}}},a=Array.from(r.keys()),c=[];for(let e=0;e<a.length;e+=s){let t=a.slice(e,e+s),n=await Promise.allSettled(t.map(i));c.push(...n.map(e=>e.status===`fulfilled`?e.value:{url:`unknown`,ok:!1,error:e.reason}))}for(let i of c)if(!i.ok){let a=G(e,`brokenLink`,`warning`);if(a!==`off`){let o=r.get(i.url)||[];for(let r of o)t.push({file:n(f.relative(e.docsDir,r)),level:a,message:`Broken external link: "${i.url}"`,suggestion:`Verify the URL or update it if it's permanently down. Error: ${i.error||`Status >= 400`}`})}}}return t}async function he(e){let t=[];if(!e.doctorConfig.checks.i18n.enabled||!e.config.i18n)return t;let{defaultLocale:r,locales:i}=e.config.i18n,a=Object.keys(i),o=a.filter(e=>e!==r);for(let i of e.files){let s=n(f.relative(e.docsDir,i)),c=s.split(`/`),u=c[0];if(u===r){let n=c.slice(1).join(`/`);for(let r of o){let a=f.join(e.docsDir,r,n);if(!Y(a)){let o=G(e,`missingTranslation`,`warning`);o!==`off`&&t.push({file:s,level:o,message:`Missing translation for locale "${r}"`,suggestion:`Create a version at "${r}/${n}".`,fix:async()=>{let e=f.dirname(a);l.existsSync(e)||l.mkdirSync(e,{recursive:!0}),l.copyFileSync(i,a)}})}}}else if(a.includes(u)){let n=c.slice(1).join(`/`);if(!Y(f.join(e.docsDir,r,n))){let a=G(e,`missingTranslation`,`low`);a!==`off`&&t.push({file:s,level:a,message:`Orphaned translation (source missing in "${r}")`,suggestion:`Remove this file or create the source at "${r}/${n}".`,fix:async()=>{l.unlinkSync(i)}})}}}return t}async function ge(e){let t=[];if(!e.config.theme.sidebar)return t;let n=new Set,r=e.config.theme.sidebar;for(let[i,a]of Object.entries(r))for(let r of a){if(!r.text){let n=G(e,`invalidFrontmatter`,`warning`);n!==`off`&&t.push({file:`boltdocs.config.ts`,level:n,message:`Sidebar item in group "${i}" is missing a label.`,suggestion:`Add a "text" property to the sidebar item.`})}if(r.link&&(n.add(r.link),!e.routeIndex.has(r.link))){let{bestMatch:n,similarity:i}=$(r.link,e.linkTree.routes),a=i>.6,o=G(e,`brokenLink`,`high`);o!==`off`&&t.push({file:`boltdocs.config.ts`,level:o,message:`Broken sidebar link: "${r.link}"`,suggestion:a?`Did you mean "${n}"?`:`Ensure the route exists and is correctly formatted.`})}}for(let r of e.linkTree.routes)if(!(r===`/`||r===``)&&!n.has(r)){let n=G(e,`orphanedPage`,`low`);n!==`off`&&t.push({file:`Sidebar`,level:n,message:`Orphaned page found: "${r}" is not linked in the sidebar.`,suggestion:`Consider adding it to the sidebar for better discoverability.`})}return t}var _e=_({DEFAULT_DOCTOR_CONFIG:()=>W,checkI18n:()=>he,checkLinks:()=>me,checkMetadata:()=>pe,checkSidebar:()=>ge,doctorAction:()=>ye,doctorInit:()=>ve,generateLinkTree:()=>Z,loadDoctorConfig:()=>X});async function ve(e){let t=f.resolve(e,`doctor.json`);if(l.existsSync(t)){I(`"doctor.json" already exists at ${e}.`);return}try{l.writeFileSync(t,JSON.stringify(W,null,2)),R(`Created "doctor.json" with default configuration.`)}catch(e){L(`Failed to create "doctor.json": ${e}`)}}async function ye(e=process.cwd(),t={}){if(t.init){await ve(e);return}U();try{let n=await X(e),{format:r}=n.reporting,{colors:i}=ie;r===`pretty`&&B(`DOCTOR - Documentation Health Check`);let a=performance.now(),o=await j(`docs`,e),s=f.resolve(e,`docs`);l.existsSync(s)||(r===`pretty`&&L(`Docs dir not found at ${s}`),process.exit(1)),r===`pretty`&&F(`${M.dim}🔍 Discovering files and routes...${M.reset}`);let u=p(n.exclude||[]),d=await new c().withFullPaths().filter(e=>{if(!(e.endsWith(`.md`)||e.endsWith(`.mdx`)))return!1;let t=f.relative(s,e).replace(/\\/g,`/`),n=t.split(`/`).some(e=>e.startsWith(`_`)&&e!==`_index.md`&&e!==`_index.mdx`);return!u(t)&&!n}).crawl(s).withPromise();for(let e of d)J.set(e,!0);let m=await Z(s,e,o,d),h=o.base||`/`,g=h===`/`?``:h.endsWith(`/`)?h.slice(0,-1):h,_={root:e,docsDir:s,config:o,doctorConfig:n,linkTree:m,files:d,options:t,routeIndex:new Set(m.routes),routeIndexWithSlash:new Set(m.routes.map(e=>e.endsWith(`/`)?e:e+`/`)),routeIndexWithoutSlash:new Set(m.routes.map(e=>e.endsWith(`/`)?e.slice(0,-1):e)),basePrefix:g};r===`pretty`&&F(`${M.dim}🧪 Running diagnostic checks in parallel...${M.reset}`);let[v,y,b,x]=await Promise.all([pe(_),me(_),he(_),ge(_)]),S=[...v,...y,...b,...x],C=0;if(t.fix){for(let e of S)if(e.fix){if(_.doctorConfig.fix.confirmChanges&&!await N(`Fix issue in "${e.file}": ${e.message}?`))continue;if(_.doctorConfig.fix.backupFiles){let t=f.resolve(_.docsDir,e.file);l.existsSync(t)&&await de(t,f.resolve(_.root,_.doctorConfig.fix.backupPath))}await e.fix(),C++}}let w=((performance.now()-a)/1e3).toFixed(2),T=S.filter(e=>e.level===`high`).length,E=S.filter(e=>e.level===`warning`).length,D=S.filter(e=>e.level===`low`).length,O={summary:{total:S.length,high:T,warning:E,low:D,fixed:C,duration:w},issues:S.map(e=>({...e,fix:void 0}))};if(n.reporting.outputFile){let t=f.resolve(e,n.reporting.outputFile);l.existsSync(f.dirname(t))||l.mkdirSync(f.dirname(t),{recursive:!0}),l.writeFileSync(t,JSON.stringify(O,null,2))}if(r===`json`)console.log(JSON.stringify(O,null,2));else if(r===`pretty`){let e=S.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(t),e),{});if(S.length>0){z();for(let[n,r]of Object.entries(e)){console.log(`\n${i.bold}${i.cyan}📄 ${n}${i.reset}`);for(let e of r){let n=e.level===`high`?`❌`:e.level===`warning`?`⚠️`:`ℹ️`,r=e.level===`high`?i.red:e.level===`warning`?i.yellow:i.blue;console.log(` ${n} ${r}${e.level.toUpperCase()}${i.reset}: ${e.message}`),e.suggestion&&console.log(` ${i.dim}💡 Suggestion: ${e.suggestion}${i.reset}`),t.fix&&e.fix&&console.log(` ${i.green}✅ Fixed automatically${i.reset}`)}}z()}S.length===0?R(`Everything looks perfect! Your documentation is in great shape. ✨`):(console.log(`\n${i.bold}Diagnosis Results (${w}s):${i.reset}`),T>0&&console.log(` ${i.red}● ${T} Critical Errors${i.reset}`),E>0&&console.log(` ${i.yellow}● ${E} Warnings${i.reset}`),D>0&&console.log(` ${i.blue}● ${D} Improvements${i.reset}`),C>0&&R(`Successfully fixed ${C} issues automatically!`),T>0?console.log(`\n${i.red}${i.bold}[boltdocs] Please fix the critical errors before building for production.${i.reset}`):R(`[boltdocs] No critical issues found. You are ready to go!`))}n.reporting.failOnError&&T>0&&process.exit(1),n.reporting.maxWarnings!==-1&&E>n.reporting.maxWarnings&&(r===`pretty`&&L(`Failed: Too many warnings (${E} > ${n.reporting.maxWarnings})`),process.exit(1))}catch(e){L(`Doctor failed: ${e}`),process.exit(1)}}export{R as a,re as c,b as d,_ as f,L as i,ne as l,Z as n,A as o,U as r,j as s,_e as t,k as u};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
const e=require(`./chunk-Ds5LZdWN.cjs`),t=require(`./utils-Clzu7jvb.cjs`);let n=require(`vite`),r=require(`node:path`);r=e.n(r);let i=require(`fdir`),a=require(`fs`);a=e.n(a);let o=require(`zod`),s=require(`node:fs`);s=e.n(s);let c=require(`path`);c=e.n(c);let l=require(`picomatch`);l=e.n(l);let u=require(`node:readline`);u=e.n(u);let d=require(`node:module`),f=require(`fastest-levenshtein`);const p=o.z.object({icon:o.z.string().max(50),link:o.z.string().url()});o.z.object({text:o.z.string().max(2e3).optional()});const m=o.z.enum([`fs:read`,`fs:write`,`vite:config`,`mdx:remark`,`mdx:rehype`,`components`,`hooks:build`,`hooks:dev`]),h=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(m).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()}),g=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(),items: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()})).optional(),sidebar:o.z.record(o.z.string(),o.z.array(o.z.object({text:o.z.string(),link:o.z.string()}))).optional(),sidebarGroups:o.z.record(o.z.string(),o.z.object({title:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]).optional(),icon:o.z.string().optional()})).optional(),socialLinks:o.z.array(p).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(),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()}),_=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()})]),v=o.z.object({defaultLocale:o.z.string(),locales:o.z.union([o.z.record(o.z.string(),o.z.string()),o.z.array(o.z.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),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()}),y=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()}))}),b=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()}),x=o.z.object({metatags:o.z.record(o.z.string(),o.z.string()).optional(),indexing:o.z.enum([`all`,`public`]).optional(),thumbnails:o.z.object({background:o.z.string().optional()}).optional()}),S=o.z.object({measurementId:o.z.string().min(1,`Measurement ID is required for GA4`),debug:o.z.boolean().optional(),anonymizeIp:o.z.boolean().optional(),sendPageView:o.z.boolean().optional(),cookieFlags:o.z.string().optional(),autoTrack:o.z.object({pageViews:o.z.boolean().optional(),downloads:o.z.boolean().optional(),externalLinks:o.z.boolean().optional(),search:o.z.boolean().optional()}).optional()}),C=o.z.object({tagId:o.z.string().min(1,`Tag ID is required for GTM`),dataLayerName:o.z.string().optional(),preview:o.z.string().optional()}),w=o.z.object({ga4:S.optional(),gtm:C.optional()}),T=o.z.object({siteUrl:o.z.string().url().optional(),docsDir:o.z.string().optional(),base:o.z.string().optional(),theme:g.optional(),i18n:v.optional(),versions:y.optional(),plugins:o.z.array(h).optional(),robots:_.optional(),security:b.optional(),seo:x.optional(),integrations:w.optional(),vite:o.z.record(o.z.string(),o.z.unknown()).optional()});function E(e,t,n=process.cwd()){let i=r.default.resolve(n,`.boltdocs`);s.default.existsSync(i)||s.default.mkdirSync(i,{recursive:!0});let a=e.i18n?Object.keys(e.i18n.locales):[],o=e.versions?e.versions.versions.map(e=>e.path):[],c=a.length>0?a.map(e=>`'${e}'`).join(` | `):`string`,l=o.length>0?o.map(e=>`'${e}'`).join(` | `):`string`,u=[`tsx`,`ts`,`jsx`,`js`],d=``,f=``;for(let e of u){let a=r.default.resolve(n,t,`mdx-components.${e}`);if(s.default.existsSync(a)){let e=r.default.join(n,t,`mdx-components`),a=r.default.relative(i,e).replace(/\\/g,`/`);d=`import type * as MdxComponentsModule from '${a.startsWith(`.`)?a:`./${a}`}'\n`,f=` MdxComponents: typeof MdxComponentsModule`;break}}let p=`// This file is automatically generated by Boltdocs.
|
|
7
|
+
// Do not edit this file manually.
|
|
8
|
+
|
|
9
|
+
${d}declare global {
|
|
10
|
+
namespace Boltdocs {
|
|
11
|
+
interface Types {
|
|
12
|
+
Locale: ${c}
|
|
13
|
+
Version: ${l}${f?`\n${f}`:``}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {}
|
|
19
|
+
`;s.default.writeFileSync(r.default.resolve(i,`types.d.ts`),p)}function D(e){return e}const O=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function k(e,i=process.cwd()){let a=i,o={docsDir:r.default.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`}}},c={};for(let e of O){let t=r.default.resolve(a,e);if(s.default.existsSync(t))try{let e=await(0,n.loadConfigFromFile)({command:`serve`,mode:`development`},t,a);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,navbar:c.navbar,sidebar:c.sidebar,sidebarGroups:c.theme?.sidebarGroups,socialLinks:c.socialLinks,githubRepo:c.githubRepo,tabs:c.tabs,codeTheme:c.codeTheme,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||``,items:e.items}));let d={docsDir:r.default.resolve(e),theme:{...o.theme,...u},i18n:c.i18n?{...c.i18n,locales:Array.isArray(c.i18n.locales)?Object.fromEntries(c.i18n.locales.map(e=>[e,e])):c.i18n.locales}:void 0,versions:c.versions,siteUrl:c.siteUrl,base:c.base,seo:c.seo,plugins:c.plugins||[],robots:c.robots,security:c.security,integrations:c.integrations,vite:c.vite},f=T.safeParse(d);if(!f.success)throw new t._(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
|
|
20
|
+
`)}`);return f.data}async function ee(e,t=process.cwd()){let n=await k(e,t);return E(n,e,t),n}var te=e.t({box:()=>R,colors:()=>A,confirm:()=>j,divider:()=>L,error:()=>F,formatLog:()=>M,info:()=>N,success:()=>I,warn:()=>P});const A={reset:`\x1B[0m`,bold:`\x1B[1m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,cyan:`\x1B[36m`,gray:`\x1B[90m`,dim:`\x1B[2m`,magenta:`\x1B[35m`};function j(e){let t=u.default.createInterface({input:process.stdin,output:process.stdout});return new Promise(n=>{t.question(`${M(e,A.yellow)} (y/N): `,e=>{t.close(),n(e.toLowerCase()===`y`||e.toLowerCase()===`yes`)})})}function M(e,t=``){return`${t}${A.bold}[boltdocs]${A.reset} ${e}${A.reset}`}function N(e){console.log(M(e))}function P(e){console.log(M(e,A.yellow))}function F(e,t){console.error(M(e,A.red)),t&&console.error(t)}function I(e){console.log(M(e,A.green))}function L(){console.log(A.gray+`─`.repeat(50)+A.reset)}function R(e){let t=`━`.repeat(e.length+4);console.log(`\n${A.cyan}┏${t}┓`),console.log(`┃ ${A.bold}${e}${A.reset}${A.cyan} ┃`),console.log(`┗${t}┛${A.reset}\n`)}const ne=(0,d.createRequire)(require(`url`).pathToFileURL(__filename).href);let z=0;function re(e,t){let n=e.split(`-`)[0].split(`.`).map(Number),r=t.split(`-`)[0].split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]??0,i=r[e]??0;if(Number.isNaN(t)||Number.isNaN(i))return!1;if(t!==i)return t>i}return!1}async function ie(){try{let e=new AbortController,t=setTimeout(()=>e.abort(),2e3),n=await fetch(`https://registry.npmjs.org/boltdocs/latest`,{signal:e.signal,headers:{Accept:`application/vnd.npm.install-v1+json`}});return clearTimeout(t),n.ok?(await n.json()).version??null:null}catch{return null}}async function ae(){try{return ne(`boltdocs/package.json`).version}catch{return`0.0.0`}}function oe(e,t){let n=Math.max(0,t-e.length);return` `.repeat(Math.floor(n/2))+e+` `.repeat(Math.ceil(n/2))}function B(e,t){return e+` `.repeat(Math.max(0,t-e.length))}function se(e,t){let n=`═`.repeat(54),r=[];r.push(`${A.cyan}╔${n}╗${A.reset}`),r.push(`${A.cyan}║${A.reset}${oe(`🚀 Update available!`,54)}${A.cyan}║${A.reset}`),r.push(`${A.cyan}║${A.reset}${` `.repeat(54)}${A.cyan}║${A.reset}`);let i=`Current: ${e} → ${t}`,a=`${A.dim}Current:${A.reset} ${A.red}${e}${A.reset} ${A.gray}→${A.reset} ${A.green}${t}${A.reset}`;r.push(`${A.cyan}║${A.reset} ${a}${B(``,52-i.length)}${A.cyan}║${A.reset}`),r.push(`${A.cyan}║${A.reset}${` `.repeat(54)}${A.cyan}║${A.reset}`);let o=`${A.dim}Run:${A.reset} ${A.bold}npm install boltdocs@latest${A.reset}`;return r.push(`${A.cyan}║${A.reset} ${o}${B(``,19)}${A.cyan}║${A.reset}`),r.push(`${A.cyan}╚${n}╝${A.reset}`),`
|
|
21
|
+
`+r.join(`
|
|
22
|
+
`)+`
|
|
23
|
+
`}async function V(){let e=Date.now();if(e-z<864e5)return;z=e;let t=await ae();if(t===`0.0.0`)return;let n=await ie();n&&re(n,t)&&console.log(se(t,n))}const H={$schema:`https://boltdocs.vercel.app/schemas/doctor-config.schema.json`,checks:{metadata:{enabled:!0,titleMin:10,titleMax:60,descriptionMin:50,required:[`title`,`description`],optional:[],validateDates:!1},links:{internal:!0,external:!1,timeout:1e4,concurrency:10,ignore:[]},i18n:{enabled:!0}},fix:{confirmChanges:!1,backupFiles:!1,backupPath:`.boltdocs/backups`},reporting:{format:`pretty`,outputFile:`.boltdocs/doctor-report.json`,failOnError:!1,maxWarnings:-1},severity:{missingTranslation:`warning`,brokenLink:`high`,brokenAnchor:`warning`,largeFile:`warning`,orphanedPage:`low`,duplicateTitle:`low`,shortMetadata:`low`,missingMetadata:`warning`,malformedFrontmatter:`high`,invalidFrontmatter:`high`},exclude:[]};function U(e,t,n){return e.doctorConfig.severity[t]||n}async function ce(e,t){s.default.existsSync(t)||s.default.mkdirSync(t,{recursive:!0});let n=r.default.basename(e),i=new Date().toISOString().replace(/[:.]/g,`-`),a=r.default.join(t,`${n}.${i}.bak`);s.default.copyFileSync(e,a)}const W=new Map;function G(e){let n=W.get(e);if(n)return n;let r=(async()=>{let n=await t.u(e,!1);return{raw:n.raw,data:n.data,content:n.content}})();return W.set(e,r),r}const K=new Map;function q(e){if(K.has(e))return K.get(e);let t=!1;try{t=s.default.existsSync(e)&&s.default.statSync(e).isFile()}catch{t=!1}return K.set(e,t),t}async function J(e){let t=r.default.resolve(e,`doctor.json`);if(s.default.existsSync(t))try{let e=JSON.parse(s.default.readFileSync(t,`utf-8`));return{...H,...e,checks:{...H.checks,...e.checks,metadata:{...H.checks.metadata,...e.checks?.metadata},links:{...H.checks.links,...e.checks?.links},i18n:{...H.checks.i18n,...e.checks?.i18n}},fix:{...H.fix,...e.fix},reporting:{...H.reporting,...e.reporting},severity:{...H.severity,...e.severity},exclude:[...H.exclude,...e.exclude||[]]}}catch(e){P(`Failed to parse doctor.json: ${e}`)}return H}async function Y(e,n=process.cwd(),a,o){let c=r.default.resolve(n,`.boltdocs`);s.default.existsSync(c)||s.default.mkdirSync(c,{recursive:!0});let l=o;l||=await new i.fdir().withFullPaths().filter(e=>e.endsWith(`.md`)||e.endsWith(`.mdx`)).crawl(e).withPromise();let u=a?.base||`/docs`,d=[];for(let n=0;n<l.length;n+=100){let i=l.slice(n,n+100),a=await Promise.all(i.map(async n=>{let i=r.default.isAbsolute(n)?n:r.default.resolve(e,n),a=r.default.relative(e,i),{data:o}=await G(i),s;return s=o.permalink?o.permalink.startsWith(`/`)?o.permalink:`/${o.permalink}`:t.i(a),u===`/`?s:(u.endsWith(`/`)?u:u+`/`)+(s.startsWith(`/`)?s.substring(1):s)}));d.push(...a)}d.includes(u)||d.push(u);let f={routes:Array.from(new Set(d)).sort(),timestamp:Date.now()};return s.default.writeFileSync(r.default.resolve(c,`link-tree.json`),JSON.stringify(f,null,2)),f}function le(e,t){if(e===t)return 1;if(!e||!t)return 0;let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean),i=n[n.length-1]||``,a=r[r.length-1]||``;if(i===a){let e=0;for(let t of n)r.includes(t)&&e++;return e>=2?.99:.9}if(i.length>3&&a.length>3&&(a.startsWith(i)||i.startsWith(a))&&Math.min(i.length,a.length)/Math.max(i.length,a.length)>.5)return .88;let o=1-(0,f.distance)(i,a)/Math.max(i.length,a.length);return o>.8?o*.95:1-(0,f.distance)(e,t)/Math.max(e.length,t.length)}const X=new Map;function Z(e,t){if(X.has(e))return X.get(e);let n=e.length,r=``,i=0;for(let a of t){if(a===e)continue;let t=a.length,o=Math.max(n,t);if(o===0)continue;let s=1-Math.abs(n-t)/o;if(s<=.8&&s<=i)continue;let c=le(e,a);c>i&&(i=c,r=a)}let a={bestMatch:r,similarity:i};return X.set(e,a),a}async function Q(e){let n=[];if(!e.doctorConfig.checks.metadata.enabled)return n;let{titleMin:r,titleMax:i,descriptionMin:a}=e.doctorConfig.checks.metadata,o=new Map;for(let s of e.files){let l=t.l(c.default.relative(e.docsDir,s));try{let{raw:c,data:u}=await G(s);if(c.trim().startsWith(`---`)&&c.split(`---`).length>=3&&Object.keys(u).length===0){let t=U(e,`malformedFrontmatter`,`high`);t!==`off`&&n.push({file:l,level:t,message:`Malformed frontmatter (YAML parsing failed).`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}let d=t.v.safeParse(u);if(!d.success){let t=U(e,`invalidFrontmatter`,`high`);if(t!==`off`)for(let e of d.error.issues)n.push({file:l,level:t,message:`Invalid frontmatter field "${e.path.join(`.`)}": ${e.message}`,suggestion:`Ensure the field follows the correct type.`})}let f=Array.from(new Set([`title`,...e.doctorConfig.checks.metadata.required]));for(let t of f)if(u[t]===void 0){let r=U(e,`missingMetadata`,`warning`);r!==`off`&&n.push({file:l,level:r,message:`Missing required frontmatter field: "${t}".`,suggestion:`Add the "${t}" field to your frontmatter.`})}if(e.doctorConfig.checks.metadata.validateDates){let t=[`date`,`lastUpdated`,...e.doctorConfig.checks.metadata.optional.filter(e=>e.toLowerCase().includes(`date`))];for(let r of t)if(u[r]&&isNaN(Date.parse(String(u[r])))){let t=U(e,`invalidFrontmatter`,`high`);t!==`off`&&n.push({file:l,level:t,message:`Invalid date format in field "${r}": "${u[r]}".`,suggestion:`Use a valid ISO date format (e.g., YYYY-MM-DD).`})}}if(u.title){let t=String(u.title);if(t.length<r){let i=U(e,`shortMetadata`,`low`);i!==`off`&&n.push({file:l,level:i,message:`Title is too short (${t.length} chars).`,suggestion:`Titles should be at least ${r} characters for better SEO.`})}else if(t.length>i){let r=U(e,`shortMetadata`,`low`);r!==`off`&&n.push({file:l,level:r,message:`Title is too long (${t.length} chars).`,suggestion:`Titles should be under ${i} characters.`})}let a=o.get(t)||[];a.push(l),o.set(t,a)}if(u.description&&String(u.description).length<a){let t=U(e,`shortMetadata`,`low`);t!==`off`&&n.push({file:l,level:t,message:`Description is very short.`,suggestion:`Descriptions should ideally be at least ${a} characters.`})}}catch(t){let r=U(e,`malformedFrontmatter`,`high`);r!==`off`&&n.push({file:l,level:r,message:`Malformed frontmatter (YAML error): ${t.message}`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}}for(let[t,r]of o.entries())if(r.length>1){let i=U(e,`duplicateTitle`,`low`);if(i!==`off`)for(let e of r)n.push({file:e,level:i,message:`Duplicate title found: "${t}"`,suggestion:`Ensure each page has a unique title. Also used in: ${r.filter(t=>t!==e).join(`, `)}`})}return n}async function $(e){let n=[],{internal:r,external:i,ignore:o,timeout:s,concurrency:l}=e.doctorConfig.checks.links;if(!r&&!i&&!e.options.checkExternal)return n;let u=/(?:\[.*?\]\((.*?)\))|(?:href=["']([^"']+)["'])/g,d=new Set,f=5e5;for(let s of e.files){let l=t.l(c.default.relative(e.docsDir,s)),{content:p}=await G(s),m=[...(p.length>f?p.slice(0,f):p).replace(/```[\s\S]*?```/g,``).replace(/`[^`\n]*`/g,``).matchAll(u)];for(let t of m){let u=t[1]||t[2],f=!!t[1];if(!u||o.some(e=>u.includes(e)))continue;if(/^https?:\/\//i.test(u)){(i||e.options.checkExternal)&&d.add({url:u,file:s});continue}if(!r||/^(mailto|tel|#)/i.test(u))continue;let p;try{p=decodeURIComponent(u.split(`#`)[0].split(`?`)[0])}catch{p=u.split(`#`)[0].split(`?`)[0]}if(!p)continue;let m=!1,h=``;if(p.startsWith(`/`))if(e.routeIndex.has(p)||e.routeIndexWithSlash.has(p)||e.routeIndexWithoutSlash.has(p))m=!0;else{let t=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);if(e.routeIndex.has(t)||e.routeIndexWithSlash.has(t))m=!1,h=t;else{let t=e.config.base!==`/`&&p.startsWith(e.config.base||`/`)?p.substring((e.config.base||`/`).length):p,n=t.startsWith(`/`)?t.substring(1):t;h=c.default.join(e.docsDir,n),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>q(h+e))}}else h=c.default.resolve(c.default.dirname(s),p),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>q(h+e));if(!m){let{bestMatch:t,similarity:r}=Z(p,e.linkTree.routes),i=!1,o=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);(e.routeIndex.has(o)||e.routeIndexWithSlash.has(o))&&(t=o,r=1,i=!0);let c=r>.6||i,d=r>.75&&t!==p||i,m=U(e,`brokenLink`,`high`);m!==`off`&&n.push({file:l,level:m,message:`Broken internal link: "${u}"`,suggestion:c?`Did you mean "${t}"?`:`Ensure the target exists or check for typos.`,fix:d?async()=>{let e=u.includes(`#`)?`#`+u.split(`#`)[1]:``,n=f?`(${u})`:`href="${u}"`,r=f?`(${t}${e})`:`href="${t}${e}"`,i=a.default.readFileSync(s,`utf-8`).replace(n,r);a.default.writeFileSync(s,i),W.delete(s)}:void 0})}}}if(d.size>0){N(`${A.gray}Verifying ${d.size} external links...${A.reset}`);let r=new Map;for(let e of d)r.has(e.url)||r.set(e.url,[]),r.get(e.url).push(e.file);let i=async e=>{try{let t=new AbortController,n=setTimeout(()=>t.abort(),s),r=await fetch(e,{method:`HEAD`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}});return clearTimeout(n),!r.ok&&r.status!==404?{url:e,ok:(await fetch(e,{method:`GET`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}})).ok}:{url:e,ok:r.ok}}catch(t){return{url:e,ok:!1,error:t.message}}},a=Array.from(r.keys()),o=[];for(let e=0;e<a.length;e+=l){let t=a.slice(e,e+l),n=await Promise.allSettled(t.map(i));o.push(...n.map(e=>e.status===`fulfilled`?e.value:{url:`unknown`,ok:!1,error:e.reason}))}for(let i of o)if(!i.ok){let a=U(e,`brokenLink`,`warning`);if(a!==`off`){let o=r.get(i.url)||[];for(let r of o)n.push({file:t.l(c.default.relative(e.docsDir,r)),level:a,message:`Broken external link: "${i.url}"`,suggestion:`Verify the URL or update it if it's permanently down. Error: ${i.error||`Status >= 400`}`})}}}return n}async function ue(e){let n=[];if(!e.doctorConfig.checks.i18n.enabled||!e.config.i18n)return n;let{defaultLocale:r,locales:i}=e.config.i18n,o=Object.keys(i),s=o.filter(e=>e!==r);for(let i of e.files){let l=t.l(c.default.relative(e.docsDir,i)),u=l.split(`/`),d=u[0];if(d===r){let t=u.slice(1).join(`/`);for(let r of s){let o=c.default.join(e.docsDir,r,t);if(!q(o)){let s=U(e,`missingTranslation`,`warning`);s!==`off`&&n.push({file:l,level:s,message:`Missing translation for locale "${r}"`,suggestion:`Create a version at "${r}/${t}".`,fix:async()=>{let e=c.default.dirname(o);a.default.existsSync(e)||a.default.mkdirSync(e,{recursive:!0}),a.default.copyFileSync(i,o)}})}}}else if(o.includes(d)){let t=u.slice(1).join(`/`);if(!q(c.default.join(e.docsDir,r,t))){let o=U(e,`missingTranslation`,`low`);o!==`off`&&n.push({file:l,level:o,message:`Orphaned translation (source missing in "${r}")`,suggestion:`Remove this file or create the source at "${r}/${t}".`,fix:async()=>{a.default.unlinkSync(i)}})}}}return n}async function de(e){let t=[];if(!e.config.theme.sidebar)return t;let n=new Set,r=e.config.theme.sidebar;for(let[i,a]of Object.entries(r))for(let r of a){if(!r.text){let n=U(e,`invalidFrontmatter`,`warning`);n!==`off`&&t.push({file:`boltdocs.config.ts`,level:n,message:`Sidebar item in group "${i}" is missing a label.`,suggestion:`Add a "text" property to the sidebar item.`})}if(r.link&&(n.add(r.link),!e.routeIndex.has(r.link))){let{bestMatch:n,similarity:i}=Z(r.link,e.linkTree.routes),a=i>.6,o=U(e,`brokenLink`,`high`);o!==`off`&&t.push({file:`boltdocs.config.ts`,level:o,message:`Broken sidebar link: "${r.link}"`,suggestion:a?`Did you mean "${n}"?`:`Ensure the route exists and is correctly formatted.`})}}for(let r of e.linkTree.routes)if(!(r===`/`||r===``)&&!n.has(r)){let n=U(e,`orphanedPage`,`low`);n!==`off`&&t.push({file:`Sidebar`,level:n,message:`Orphaned page found: "${r}" is not linked in the sidebar.`,suggestion:`Consider adding it to the sidebar for better discoverability.`})}return t}async function fe(e){let t=c.default.resolve(e,`doctor.json`);if(a.default.existsSync(t)){P(`"doctor.json" already exists at ${e}.`);return}try{a.default.writeFileSync(t,JSON.stringify(H,null,2)),I(`Created "doctor.json" with default configuration.`)}catch(e){F(`Failed to create "doctor.json": ${e}`)}}async function pe(e=process.cwd(),t={}){if(t.init){await fe(e);return}V();try{let n=await J(e),{format:r}=n.reporting,{colors:o}=te;r===`pretty`&&R(`DOCTOR - Documentation Health Check`);let s=performance.now(),u=await k(`docs`,e),d=c.default.resolve(e,`docs`);a.default.existsSync(d)||(r===`pretty`&&F(`Docs dir not found at ${d}`),process.exit(1)),r===`pretty`&&N(`${A.dim}🔍 Discovering files and routes...${A.reset}`);let f=(0,l.default)(n.exclude||[]),p=await new i.fdir().withFullPaths().filter(e=>{if(!(e.endsWith(`.md`)||e.endsWith(`.mdx`)))return!1;let t=c.default.relative(d,e).replace(/\\/g,`/`),n=t.split(`/`).some(e=>e.startsWith(`_`)&&e!==`_index.md`&&e!==`_index.mdx`);return!f(t)&&!n}).crawl(d).withPromise();for(let e of p)K.set(e,!0);let m=await Y(d,e,u,p),h=u.base||`/`,g=h===`/`?``:h.endsWith(`/`)?h.slice(0,-1):h,_={root:e,docsDir:d,config:u,doctorConfig:n,linkTree:m,files:p,options:t,routeIndex:new Set(m.routes),routeIndexWithSlash:new Set(m.routes.map(e=>e.endsWith(`/`)?e:e+`/`)),routeIndexWithoutSlash:new Set(m.routes.map(e=>e.endsWith(`/`)?e.slice(0,-1):e)),basePrefix:g};r===`pretty`&&N(`${A.dim}🧪 Running diagnostic checks in parallel...${A.reset}`);let[v,y,b,x]=await Promise.all([Q(_),$(_),ue(_),de(_)]),S=[...v,...y,...b,...x],C=0;if(t.fix){for(let e of S)if(e.fix){if(_.doctorConfig.fix.confirmChanges&&!await j(`Fix issue in "${e.file}": ${e.message}?`))continue;if(_.doctorConfig.fix.backupFiles){let t=c.default.resolve(_.docsDir,e.file);a.default.existsSync(t)&&await ce(t,c.default.resolve(_.root,_.doctorConfig.fix.backupPath))}await e.fix(),C++}}let w=((performance.now()-s)/1e3).toFixed(2),T=S.filter(e=>e.level===`high`).length,E=S.filter(e=>e.level===`warning`).length,D=S.filter(e=>e.level===`low`).length,O={summary:{total:S.length,high:T,warning:E,low:D,fixed:C,duration:w},issues:S.map(e=>({...e,fix:void 0}))};if(n.reporting.outputFile){let t=c.default.resolve(e,n.reporting.outputFile);a.default.existsSync(c.default.dirname(t))||a.default.mkdirSync(c.default.dirname(t),{recursive:!0}),a.default.writeFileSync(t,JSON.stringify(O,null,2))}if(r===`json`)console.log(JSON.stringify(O,null,2));else if(r===`pretty`){let e=S.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(t),e),{});if(S.length>0){L();for(let[n,r]of Object.entries(e)){console.log(`\n${o.bold}${o.cyan}📄 ${n}${o.reset}`);for(let e of r){let n=e.level===`high`?`❌`:e.level===`warning`?`⚠️`:`ℹ️`,r=e.level===`high`?o.red:e.level===`warning`?o.yellow:o.blue;console.log(` ${n} ${r}${e.level.toUpperCase()}${o.reset}: ${e.message}`),e.suggestion&&console.log(` ${o.dim}💡 Suggestion: ${e.suggestion}${o.reset}`),t.fix&&e.fix&&console.log(` ${o.green}✅ Fixed automatically${o.reset}`)}}L()}S.length===0?I(`Everything looks perfect! Your documentation is in great shape. ✨`):(console.log(`\n${o.bold}Diagnosis Results (${w}s):${o.reset}`),T>0&&console.log(` ${o.red}● ${T} Critical Errors${o.reset}`),E>0&&console.log(` ${o.yellow}● ${E} Warnings${o.reset}`),D>0&&console.log(` ${o.blue}● ${D} Improvements${o.reset}`),C>0&&I(`Successfully fixed ${C} issues automatically!`),T>0?console.log(`\n${o.red}${o.bold}[boltdocs] Please fix the critical errors before building for production.${o.reset}`):I(`[boltdocs] No critical issues found. You are ready to go!`))}n.reporting.failOnError&&T>0&&process.exit(1),n.reporting.maxWarnings!==-1&&E>n.reporting.maxWarnings&&(r===`pretty`&&F(`Failed: Too many warnings (${E} > ${n.reporting.maxWarnings})`),process.exit(1))}catch(e){F(`Doctor failed: ${e}`),process.exit(1)}}Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return h}});
|
package/dist/node/cli-entry.cjs
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* Copyright (c) 2026 Jesus Alcala
|
|
5
5
|
* Licensed under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
const e=require(`../chunk-Ds5LZdWN.cjs`),t=require(`../routes-Co1mRM58.cjs`),n=require(`../node-
|
|
7
|
+
const e=require(`../chunk-Ds5LZdWN.cjs`),t=require(`../routes-Co1mRM58.cjs`),n=require(`../node-t5C3Q85p.cjs`),r=require(`../doctor-BHc9ua6r.cjs`);let i=require(`vite`),a=require(`node:path`);a=e.n(a);let o=require(`cac`);o=e.n(o);let s=require(`@bdocs/ssg/node`);async function c(e=process.cwd()){r.u();try{let t=await(0,s.createServer)(await n.n(e,`development`));await t.listen(),t.printUrls(),t.bindCLIShortcuts({print:!0})}catch(e){r.d(`Failed to start dev server:`,e),process.exit(1)}}async function l(e=process.cwd()){r.u();try{let i=await n.n(e,`production`),o=await r.m(`docs`,e),c=await t.t(a.default.resolve(e,`docs`),o,i.base),l={};for(let e of c)if(e.path&&e.componentPath){l[e.path]=e.componentPath;let t=e.path.replace(/\/$/,``);l[t]=e.componentPath}await(0,s.build)({entry:`boltdocs/entry`,routeToSourceFileMap:l,cacheDir:a.default.resolve(e,`.boltdocs`)},i),r.f(`SSG build completed successfully!`),process.exit(0)}catch(e){r.d(`Build failed:`,e),process.exit(1)}}async function u(e=process.cwd()){try{(await(0,i.preview)(await n.n(e,`production`))).printUrls()}catch(e){r.d(`Failed to start preview server:`,e),process.exit(1)}}const d=(0,o.default)(`boltdocs`);d.command(`[root]`,`Start development server`).alias(`dev`).action(c),d.command(`build [root]`,`Build for production`).action(l),d.command(`preview [root]`,`Preview production build`).action(u),d.command(`doctor [root]`,`Check the health of your documentation`).option(`--fix`,`Automatically fix broken internal links and sync translations`).option(`--check-external`,`Verify external links (slower)`).option(`--init`,`Initialize doctor.json with default configuration`).action(async(e,t)=>{let{doctorAction:n}=await Promise.resolve().then(()=>require(`../doctor-D4_Y7M4p.cjs`));await n(e,t)}),d.command(`generate-changelog <file>`,`Generate changelog documentation from CHANGELOG.md`).option(`-o, --output <path>`,`Output folder (default: docs/changelog)`,{default:`docs/changelog`}).option(`-t, --title <text>`,`Title for changelog pages`,{default:`Changelog`}).option(`--infer-tab`,`Infer tab from folder name (default: true)`,{default:!0}).option(`-l, --limit <number>`,`Limit number of versions to generate`).action(async(e,t)=>{let{generateChangelog:n}=await Promise.resolve().then(()=>require(`../generator-DGW6pkCC.cjs`));await n(e,{output:t.output,title:t.title,inferTab:t.inferTab,limit:t.limit?parseInt(String(t.limit),10):void 0})}),d.help(),d.version(`2.0.0`),d.parse();
|
package/dist/node/cli-entry.mjs
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* Copyright (c) 2026 Jesus Alcala
|
|
5
5
|
* Licensed under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
import{
|
|
7
|
+
import{a as e,i as t,r as n,s as r}from"../doctor-BD1BSB03.mjs";import{t as i}from"../routes-DwrMa5-z.mjs";import{n as a}from"../node-DBaH7kat.mjs";import{preview as o}from"vite";import s from"node:path";import c from"cac";import{build as l,createServer as u}from"@bdocs/ssg/node";async function d(e=process.cwd()){n();try{let t=await u(await a(e,`development`));await t.listen(),t.printUrls(),t.bindCLIShortcuts({print:!0})}catch(e){t(`Failed to start dev server:`,e),process.exit(1)}}async function f(o=process.cwd()){n();try{let t=await a(o,`production`),n=await r(`docs`,o),c=await i(s.resolve(o,`docs`),n,t.base),u={};for(let e of c)if(e.path&&e.componentPath){u[e.path]=e.componentPath;let t=e.path.replace(/\/$/,``);u[t]=e.componentPath}await l({entry:`boltdocs/entry`,routeToSourceFileMap:u,cacheDir:s.resolve(o,`.boltdocs`)},t),e(`SSG build completed successfully!`),process.exit(0)}catch(e){t(`Build failed:`,e),process.exit(1)}}async function p(e=process.cwd()){try{(await o(await a(e,`production`))).printUrls()}catch(e){t(`Failed to start preview server:`,e),process.exit(1)}}const m=c(`boltdocs`);m.command(`[root]`,`Start development server`).alias(`dev`).action(d),m.command(`build [root]`,`Build for production`).action(f),m.command(`preview [root]`,`Preview production build`).action(p),m.command(`doctor [root]`,`Check the health of your documentation`).option(`--fix`,`Automatically fix broken internal links and sync translations`).option(`--check-external`,`Verify external links (slower)`).option(`--init`,`Initialize doctor.json with default configuration`).action(async(e,t)=>{let{doctorAction:n}=await import(`../doctor-BD1BSB03.mjs`).then(e=>e.t);await n(e,t)}),m.command(`generate-changelog <file>`,`Generate changelog documentation from CHANGELOG.md`).option(`-o, --output <path>`,`Output folder (default: docs/changelog)`,{default:`docs/changelog`}).option(`-t, --title <text>`,`Title for changelog pages`,{default:`Changelog`}).option(`--infer-tab`,`Infer tab from folder name (default: true)`,{default:!0}).option(`-l, --limit <number>`,`Limit number of versions to generate`).action(async(e,t)=>{let{generateChangelog:n}=await import(`../generator-Dv3wEmhZ.mjs`);await n(e,{output:t.output,title:t.title,inferTab:t.inferTab,limit:t.limit?parseInt(String(t.limit),10):void 0})}),m.help(),m.version(`2.0.0`),m.parse();export{};
|
package/dist/node/index.cjs
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`../utils-Clzu7jvb.cjs`),t=require(`../node-
|
|
6
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`../utils-Clzu7jvb.cjs`),t=require(`../node-t5C3Q85p.cjs`),n=require(`../doctor-BHc9ua6r.cjs`);exports.BoltdocsPluginStore=t.u,exports.PluginCompatibilityError=t.d,exports.PluginError=t.f,exports.PluginHookError=t.p,exports.PluginLifecycleManager=t.a,exports.PluginPermissionError=t.m,exports.PluginSandbox=t.o,exports.PluginValidationError=t.h,exports.SecurePluginSchema=t.s,exports.createPlugin=t.i,exports.createViteConfig=t.n,exports.default=t.t,exports.defineConfig=n.g,exports.generateEntryCode=t.r,exports.hasPermission=t.c,exports.normalizePath=e.l,exports.resolveConfig=n.m,exports.sanitizeFilename=e.d,exports.validatePlugins=t.l;
|
package/dist/node/index.mjs
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import{
|
|
6
|
+
import{l as e,s as t}from"../doctor-BD1BSB03.mjs";import{d as n,l as r}from"../utils-BxNAXhZZ.mjs";import{a as i,c as a,d as o,f as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v}from"../node-DBaH7kat.mjs";export{v as BoltdocsPluginStore,o as PluginCompatibilityError,s as PluginError,m as PluginHookError,i as PluginLifecycleManager,d as PluginPermissionError,p as PluginSandbox,c as PluginValidationError,g as SecurePluginSchema,l as createPlugin,f as createViteConfig,_ as default,e as defineConfig,h as generateEntryCode,a as hasPermission,r as normalizePath,t as resolveConfig,n as sanitizeFilename,u as validatePlugins};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import{n as e}from"../../parser-
|
|
6
|
+
import{n as e}from"../../parser-9cVdK7w9.mjs";import{parentPort as t}from"node:worker_threads";if(!t)throw Error(`This file must be run as a worker thread.`);t.on(`message`,async n=>{if(n.type===`PARSE_FILE`)try{let r=await e(n.file,n.docsDir,n.basePath,n.config);t?.postMessage({type:`SUCCESS`,file:n.file,result:r})}catch(e){t?.postMessage({type:`ERROR`,file:n.file,error:e.message||`Unknown parsing error`})}});export{};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import{
|
|
6
|
+
import{c as e,d as t,n,o as r,u as i}from"./doctor-BD1BSB03.mjs";import{l as a,n as o,s,u as c}from"./utils-BxNAXhZZ.mjs";import{r as l}from"./cache-CQKlT4fI.mjs";import{i as u,n as d,t as f}from"./routes-DwrMa5-z.mjs";import*as p from"node:module";import{createRequire as m}from"node:module";import h from"@vitejs/plugin-react";import g from"@tailwindcss/vite";import{loadEnv as ee,normalizePath as _}from"vite";import v from"node:path";import y from"fs";import{z as b}from"zod";import x from"node:fs";import S from"node:crypto";import{ViteImageOptimizer as te}from"vite-plugin-image-optimizer";import ne from"semver";import C from"path";import{fileURLToPath as re}from"node:url";import ie from"@mdx-js/rollup";import ae from"remark-gfm";import oe from"remark-frontmatter";import se from"rehype-slug";import{visit as ce}from"unist-util-visit";import{createJavaScriptRegexEngine as le}from"shiki/engine/javascript";import{createHighlighterCore as ue}from"shiki/core";import de from"@shikijs/themes/github-light";import fe from"@shikijs/themes/github-dark";import pe from"@shikijs/themes/tokyo-night";import me from"@shikijs/themes/dracula";import he from"@shikijs/themes/nord";import ge from"@shikijs/themes/one-dark-pro";import _e from"@shikijs/themes/one-light";import ve from"@shikijs/langs/html";import ye from"@shikijs/langs/js";import be from"@shikijs/langs/ts";import xe from"@shikijs/langs/tsx";import Se from"@shikijs/langs/css";import Ce from"@shikijs/langs/json";import we from"@shikijs/langs/bash";import Te from"@shikijs/langs/markdown";import Ee from"@shikijs/langs/mdx";import De from"@shikijs/langs/yaml";import Oe from"@shikijs/langs/rust";import ke from"@shikijs/langs/toml";import Ae from"@shikijs/langs/csv";function w(e){return e.map(e=>({path:e.path,filePath:e.filePath,title:e.title,description:e.description||``,sidebarPosition:e.sidebarPosition,badge:e.badge,icon:e.icon,headings:e.headings||[],_content:e._content||``,_rawContent:e._rawContent||``,locale:e.locale,version:e.version,tab:e.tab,group:e.group,groupTitle:e.groupTitle,groupPosition:e.groupPosition,groupIcon:e.groupIcon,subRouteGroup:e.subRouteGroup,seo:e.seo,date:e.date,lastUpdated:e.lastUpdated,category:e.category,order:e.order,sidebarLabel:e.sidebarLabel,sidebarHidden:e.sidebarHidden,frontmatter:e.frontmatter,slugParts:e.slugParts}))}function je(e,t){let n=(t.siteUrl||``).replace(/\/$/,``);if(!n)return``;let r=t.seo?.indexing!==`all`&&t.seo?.indexing!==`public`;return`<?xml version="1.0" encoding="UTF-8"?>
|
|
7
7
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
8
8
|
${e.filter(e=>e.seo?.noindex||typeof e.seo?.robots==`string`&&e.seo.robots.includes(`noindex`)?!1:(r&&e.seo?.index,!0)).map(e=>` <url>
|
|
9
9
|
<loc>${o(`${n}${e.path.startsWith(`/`)?e.path:`/${e.path}`}`)}</loc>
|
|
@@ -68,7 +68,7 @@ ${e.filter(e=>e.seo?.noindex||typeof e.seo?.robots==`string`&&e.seo.robots.inclu
|
|
|
68
68
|
})();
|
|
69
69
|
<\/script>
|
|
70
70
|
\n${s}${c} </head>`),l&&(e=e.replace(/<body([^>]*)>/,`<body$1>\n${l}`)),!e.includes(`src/main`)&&!e.includes(`virtual:boltdocs-entry`)&&(e=e.replace(`</body>`,` <script type="module">import "virtual:boltdocs-entry";<\/script>
|
|
71
|
-
</body>`)),e}var D=class e extends Error{pluginName;constructor(t,n){super(`[plugin:${t}] ${n}`),this.name=`PluginError`,this.pluginName=t,Object.setPrototypeOf(this,e.prototype)}},O=class e extends D{constructor(t,n){super(t,`Validation failed: ${n}`),this.name=`PluginValidationError`,Object.setPrototypeOf(this,e.prototype)}},k=class e extends D{constructor(t,n){super(t,`Compatibility error: ${n}`),this.name=`PluginCompatibilityError`,Object.setPrototypeOf(this,e.prototype)}},A=class e extends D{constructor(t,n){super(t,`Missing required permission: '${n}'`),this.name=`PluginPermissionError`,Object.setPrototypeOf(this,e.prototype)}},j=class e extends D{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)}},M=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 N=
|
|
71
|
+
</body>`)),e}var D=class e extends Error{pluginName;constructor(t,n){super(`[plugin:${t}] ${n}`),this.name=`PluginError`,this.pluginName=t,Object.setPrototypeOf(this,e.prototype)}},O=class e extends D{constructor(t,n){super(t,`Validation failed: ${n}`),this.name=`PluginValidationError`,Object.setPrototypeOf(this,e.prototype)}},k=class e extends D{constructor(t,n){super(t,`Compatibility error: ${n}`),this.name=`PluginCompatibilityError`,Object.setPrototypeOf(this,e.prototype)}},A=class e extends D{constructor(t,n){super(t,`Missing required permission: '${n}'`),this.name=`PluginPermissionError`,Object.setPrototypeOf(this,e.prototype)}},j=class e extends D{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)}},M=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 N=t.extend({version:b.string().optional(),boltdocsVersion:b.string().optional(),permissions:b.array(b.string()).optional(),hooks:b.object({beforeBuild:b.function().optional(),afterBuild:b.function().optional(),beforeDev:b.function().optional(),afterDev:b.function().optional(),configResolved:b.function().optional(),buildEnd:b.function().optional()}).optional()});function P(e,t){let n=[],r=new Set;for(let i of e){let e=N.safeParse(i);if(!e.success)throw new O(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 O(a.name,`Duplicate plugin name detected`);if(r.add(a.name),a.boltdocsVersion&&!ne.satisfies(t,a.boltdocsVersion))throw new k(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(`..`)||C.isAbsolute(t))&&t.includes(`..`))throw new O(a.name,`Component '${e}' has an invalid path: traversal sequences are not allowed.`)}n.push(a)}return n}function F(e,t){return e.permissions?e.permissions.includes(t):!1}var I=class e{static checkPermission(e,t){if(!F(e,t))throw new A(e.name,t)}static getSanitizedCapabilities(e){return{remarkPlugins:F(e,`mdx:remark`)?e.remarkPlugins:[],rehypePlugins:F(e,`mdx:rehype`)?e.rehypePlugins:[],vitePlugins:F(e,`vite:config`)?e.vitePlugins:[],components:F(e,`components`)?e.components:{}}}static async executeWithIsolation(t,n,r,i){try{return e.checkPermission(t,n),await i()}catch(e){if(e instanceof A){console.warn(`[boltdocs] Skipping hook '${r}' for plugin '${t.name}': ${e.message}`);return}throw e}}},Ne=class{plugins;config;store;constructor(e,t){this.plugins=e,this.config=t,this.store=new M}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 I.executeWithIsolation(r,o,e,()=>r.hooks[e](n,...t)):await r.hooks[e](n,...t)}catch(t){let i=new j(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 Pe(e){return e}const L=v.dirname(re(import.meta.url));function R(e){return typeof e==`string`?[e]:Array.isArray(e)?e.flatMap(R):e&&typeof e==`object`?Object.values(e).flatMap(R):[]}const Fe=new Set([`title`,`description`,`permalink`,`sidebarPosition`,`sidebarLabel`,`sidebarHidden`,`hidden`,`category`,`order`,`badge`,`icon`,`date`,`lastUpdated`,`groupTitle`,`groupPosition`,`seo`]);function Ie(e){let t=[];for(let n of e){let e=``;n.frontmatter&&(e=R(Object.entries(n.frontmatter).filter(([e])=>!Fe.has(e)).map(([e,t])=>t)).join(` `));let r=e?`${n._content||``} ${e}`:n._content||``;if(t.push({id:n.path,title:n.title,content:r,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}function z(e,t,n=!1){let r=C.resolve(process.cwd(),`index.css`),i=y.existsSync(r)?`import './index.css';`:``,o=t?.plugins?.flatMap(e=>Object.entries(e.components||{}))||[],s=o.map(([e,t])=>`import * as _comp_${e} from '${a(t)}';
|
|
72
72
|
const ${e} = _comp_${e}.default || _comp_${e}['${e}'] || _comp_${e};`).join(`
|
|
73
73
|
`),c=o.map(([e])=>e).join(`, `),l=C.basename(e.docsDir||`docs`),u=C.resolve(process.cwd(),e.docsDir||`docs`),d=[`tsx`,`ts`,`jsx`,`js`].map(e=>C.resolve(u,`pages-external/index.${e}`)).find(e=>y.existsSync(e));return`
|
|
74
74
|
import { ViteReactSSG, createRoutes } from 'boltdocs/client';
|
|
@@ -104,8 +104,8 @@ export const createRoot = ViteReactSSG(
|
|
|
104
104
|
const mdxComponents = components.default || components;
|
|
105
105
|
export default mdxComponents;
|
|
106
106
|
export * from '${e}';`}return`export default {};`}if(c===`layout`){let e=[`tsx`,`jsx`],t=null;for(let n of e){let e=v.resolve(r,`layout.${n}`);if(x.existsSync(e)){t=e;break}}if(t)return`import UserLayout from '${a(t)}';
|
|
107
|
-
export default UserLayout;`;throw Error(`[Boltdocs] Layout file not found. A 'layout.tsx' or 'layout.jsx' file is mandatory in your docs directory. Please create one to define your site structure.`)}if(c===`icons`){let e=[`tsx`,`jsx`,`ts`,`js`],t=null;for(let n of e){let e=v.resolve(r,`icons.${n}`);if(x.existsSync(e)){t=e;break}}return t?`import * as icons from '${a(t)}';\nexport default icons;`:`export default {};`}if(c===`search`){if(!V){let e=Ie(await f(r,s));V=`export default ${JSON.stringify(e,null,2)};`}return V}if(c===`client`){let e=L,t=``;for(;e&&e!==v.parse(e).root;){let n=v.join(e,`src/client/index.ts`),r=v.join(e,`dist/client/index.mjs`),i=v.join(e,`client/index.ts`);if(x.existsSync(n)){t=a(n);break}if(x.existsSync(r)){t=a(r);break}if(x.existsSync(i)){t=a(i);break}e=v.dirname(e)}if(!t)throw Error(`[boltdocs] Could not resolve boltdocs/client entry point starting from ${L}`);return`export * from '${t}';`}}}}const ze={"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 Be(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(`; `)}const H=new Map;async function Ve(e){try{let{data:t}=await c(e),n=JSON.stringify(t);return S.createHash(`md5`).update(n).digest(`hex`)}catch{return``}}function He(e){return H.get(e)}function Ue(e,t){H.set(e,t)}function We(e){H.delete(e)}function U(e,t){let n=e.moduleGraph.getModuleById(`\0virtual:boltdocs-${t}.ts`);n&&e.moduleGraph.invalidateModule(n)}function Ge(r,i,o,c,l){let f=new Map;return{name:`vite-plugin-boltdocs-dev-server`,apply:`serve`,async configureServer(c){let p=l();await p?.runHook(`beforeDev`),n(r,process.cwd(),o()).catch(e=>{console.error(`[boltdocs] Failed to generate initial link tree:`,e)}),setTimeout(async()=>{try{let{generateRoutes:e}=await import(`./routes-D0KpEheM.mjs`).then(e=>e.r),t=await e(r,o());for(let e of t)if(e.filePath){let t=v.relative(process.cwd(),e.filePath).replace(/\\/g,`/`),n=t.startsWith(`/`)?t:`/${t}`;await c.transformRequest(n).catch(()=>{}),await new Promise(e=>setTimeout(e,50))}}catch{}},1e3),c.middlewares.use((e,t,n)=>{process.env.NODE_ENV===`production`&&Object.entries(ze).forEach(([e,n])=>{t.setHeader(e,n)});let r=o();r.security?.enableCSP&&t.setHeader(`Content-Security-Policy`,Be(r)),n()}),c.middlewares.use((e,t,n)=>{if(e.url===`/robots.txt`){n();return}n()}),c.middlewares.use(async(e,t,n)=>{let r=e.url?.split(`?`)[0]||`/`,i=e.headers.accept||``,a=o(),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(r);if(i.includes(`text/html`)&&!s){let n=T(a);n=E(n,a),n=await c.transformIndexHtml(e.url||`/`,n),t.statusCode=200,t.setHeader(`Content-Type`,`text/html`),t.end(n);return}n()});let m=e.map(e=>v.resolve(process.cwd(),e)),h=[`tsx`,`jsx`].map(e=>v.resolve(r,`layout.${e}`)),g=[`tsx`,`ts`,`jsx`,`js`],ee=g.map(e=>v.resolve(r,`mdx-components.${e}`)),_=g.map(e=>v.resolve(r,`pages-external/index.${e}`)),y=g.map(e=>v.resolve(r,`icons.${e}`));c.watcher.add([...m,...ee,...h,..._,...y]);let b=async(l,p)=>{try{let m=a(l);if(e.some(e=>m.endsWith(e))){c.restart();return}if(g.some(e=>m.endsWith(`mdx-components.${e}`))){t(o(),r),U(c,`mdx-components.tsx`),c.ws.send({type:`full-reload`});return}if(g.some(e=>m.endsWith(`icons.${e}`))){U(c,`icons.tsx`),c.ws.send({type:`full-reload`});return}if(m.endsWith(`layout.tsx`)||m.endsWith(`layout.jsx`)){U(c,`layout.tsx`),c.ws.send({type:`full-reload`});return}if(m.includes(`/pages-external/`)||m.includes(`\\pages-external\\`)){U(c,`entry`),c.ws.send({type:`full-reload`});return}if(!m.toLowerCase().startsWith(i.toLowerCase())||!s(m))return;if(p===`add`||p===`unlink`){p===`unlink`&&We(l),d(),Le();let e=o();t(e,r),U(c,`config`),U(c,`routes`),U(c,`search`),n(r,process.cwd(),e).catch(e=>{console.error(`[boltdocs] Failed to update link tree:`,e)}),c.ws.send({type:`custom`,event:`boltdocs:config-update`,data:{theme:e?.theme,i18n:e?.i18n,versions:e?.versions,siteUrl:e?.siteUrl}}),c.ws.send({type:`full-reload`});return}f.has(m)&&clearTimeout(f.get(m)),f.set(m,setTimeout(async()=>{f.delete(m);try{let e=He(l),t=await Ve(l);Ue(l,t),u(l),e!==void 0&&e!==t&&(U(c,`routes`),U(c,`search`));let n=a(v.relative(r,l)),i=c.moduleGraph.getModulesByFile(m);if(i)for(let e of i)c.moduleGraph.invalidateModule(e);c.ws.send({type:`custom`,event:`boltdocs:mdx-update`,data:{file:m,relPath:n}})}catch(e){console.error(`[boltdocs] HMR error processing content change:`,e)}},150))}catch(e){console.error(`[boltdocs] HMR error during ${p} event:`,e)}};c.watcher.on(`add`,e=>b(e,`add`)),c.watcher.on(`unlink`,e=>b(e,`unlink`)),c.watcher.on(`change`,e=>b(e,`change`)),await p?.runHook(`afterDev`)},handleHotUpdate({file:e,server:t}){let n=a(e);if(n.toLowerCase().startsWith(i.toLowerCase())&&s(n))return[]}}}const W=p.createRequire(import.meta.url);function Ke(e){let t=v.dirname(e);for(;t&&t!==v.dirname(t);){let e=v.join(t,`package.json`);if(x.existsSync(e))return e;t=v.dirname(t)}return null}function qe(e){let t=e.split(`/`);return e.startsWith(`@`)?{packageName:t.slice(0,2).join(`/`),subpath:t.slice(2).join(`/`)}:{packageName:t[0],subpath:t.slice(1).join(`/`)}}function G(e,t=W){try{let{packageName:n,subpath:r}=qe(e),i;try{i=t.resolve(n+`/package.json`)}catch{i=Ke(t.resolve(n))||``}if(!i)throw Error(`Could not find package.json for ${n}`);let a=v.dirname(i),o=JSON.parse(x.readFileSync(i,`utf-8`)),s=``,c=r?`./`+r:`.`;if(o.exports){let e=o.exports[c]||o.exports[r];e&&(s=typeof e==`string`?e:e.import||e.default||e.require||e)}if(!s&&!r&&(s=o.module||o.main||`index.js`),typeof s==`object`&&(s=s.import||s.default||s.require||``),s){let e=v.resolve(a,s);if(x.existsSync(e))return e}}catch{}return t.resolve(e)}function Je(){let e=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`],t=[],n=W;try{let e=v.join(process.cwd(),`node_modules/boltdocs/package.json`);if(x.existsSync(e)){let t=x.realpathSync(e);n=p.createRequire(t)}else n=p.createRequire(v.join(process.cwd(),`package.json`))}catch{}for(let r of e)try{let e=``;e=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(r,n):n.resolve(r),e&&t.push(x.realpathSync(e))}catch{}if(n!==W)for(let n of e)try{let e=``;e=n===`@bdocs/ssg`||n===`react-router-dom`||n===`react-helmet-async`?G(n,W):W.resolve(n),e&&t.push(x.realpathSync(e))}catch{}for(let e of[`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`]){try{t.push(x.realpathSync(n.resolve(e)))}catch{}if(n!==W)try{t.push(x.realpathSync(W.resolve(e)))}catch{}}return Array.from(new Set(t)).map(e=>a(e))}function Ye(e={},t){let n=v.resolve(process.cwd(),e.docsDir||`docs`),i=a(n),o=t,s,c=!1,l,u=[],d=()=>o;return[{name:`vite-plugin-boltdocs`,enforce:`pre`,async config(e,t){c=t.command===`build`;let i=!!(t.ssrBuild||t.ssr||e.build?.ssr),a=e.envDir||process.cwd(),s=ee(t.mode,a,``);Object.assign(process.env,s),o||=await r(n);let d=(await import(`./package-D-7aOtPv.mjs`)).version,p=P(o.plugins||[],d);return o.plugins=p,l=new Ne(p,o),u=p.flatMap(e=>I.getSanitizedCapabilities(e).vitePlugins||[]),c&&await l.runHook(`beforeBuild`),{ssgOptions:{entry:`boltdocs/entry`,htmlEntry:`index.html`,dirStyle:`nested`,includeAllRoutes:!0,mock:!0,script:`async`,beastiesOptions:{preload:`media`},onFinished:async e=>{let t=je(w(await f(n,o)),o);t&&x.writeFileSync(v.join(e,`sitemap.xml`),t);let r=Me(o);x.writeFileSync(v.join(e,`robots.txt`),r)}},build:{ssrManifest:c},optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-router-dom`,`react-helmet-async`,`react-fast-compare`,`invariant`],exclude:[`boltdocs`,`boltdocs/client`]},resolve:{alias:[{find:`react-router-dom`,replacement:G(`react-router-dom`)},{find:`react-helmet-async`,replacement:G(`react-helmet-async`)},{find:`@bdocs/ssg`,replacement:G(`@bdocs/ssg`)}],dedupe:[`react`,`react-dom`,...i?[]:[`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`]]},ssr:{external:[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`,...Je()],optimizeDeps:{include:[`react-fast-compare`,`invariant`]},noExternal:[]}}},configResolved(e){s=e,l?.runHook(`configResolved`,o)},resolveId(e,t,n){let r=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`].find(t=>e===t||e.startsWith(t+`/`)||e.includes(`/node_modules/${t}/`)||t.startsWith(`@`)&&e.includes(`/node_modules/${t.replace(`/`,v.sep)}/`));if(r&&n?.ssr){let t=e;if(!v.isAbsolute(e)){let n=W;try{let e=v.join(process.cwd(),`node_modules/boltdocs/package.json`);if(x.existsSync(e)){let t=x.realpathSync(e);n=p.createRequire(t)}else n=p.createRequire(v.join(process.cwd(),`package.json`))}catch{}try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(e,n):n.resolve(e)}catch{try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(e,W):W.resolve(e)}catch{}}}try{t=x.realpathSync(t)}catch{}return{id:t,external:!0}}return null},transformIndexHtml:{order:`pre`,handler(e){return E(e,o)}},async buildEnd(){let{pool:e}=await import(`./worker-pool-Bd8Y9KDv.mjs`);await e.terminate()},async closeBundle(){!c||s?.build?.ssr||(await l?.runHook(`afterBuild`),await l?.runHook(`buildEnd`))}},Re(e,d,()=>s,n),Ge(n,i,d,e=>{o=e},()=>l),{...te({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:`preset-default`}]}}),apply:`build`},...u]}const K=new l(`mdx`),Xe=[de.default||de,fe.default||fe,pe.default||pe,me.default||me,he.default||he,ge.default||ge,_e.default||_e],Ze=[ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae];let Qe=null,q=null;const $e=()=>(Qe??=le(),Qe),et=async e=>q||(q=ue({themes:Xe,langs:Ze,engine:$e()}),q),J={JSX_FLOW_ELEMENT:`mdxJsxFlowElement`,JSX_TEXT_ELEMENT:`mdxJsxTextElement`,JSX_ATTRIBUTE:`mdxJsxAttribute`,ELEMENT:`element`,TEXT:`text`,CODE:`code`},tt={PRE:`pre`,CODE:`code`},Y={TITLE:`data-title`,LANG:`data-lang`,HIGHLIGHTED:`data-highlighted`,HIGHLIGHTED_HTML:`data-highlighted-html`},X={LINE_NUMBERS:`shiki-line-numbers`,WORD_WRAP:`shiki-word-wrap`,FALLBACK:`shiki-fallback`},nt={LIGHT:`github-light`,DARK:`github-dark`},Z={LANG:`plaintext`,MDX_DEFAULT_LANG:`text`},rt=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:line-numbers`,pre(e){let n=this.options.meta?.lineNumbers===!0;(t||n)&&this.addClassToHast(e,X.LINE_NUMBERS)}}},it=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:word-wrap`,pre(e){let n=this.options.meta?.wordWrap===!0;(t||n)&&this.addClassToHast(e,X.WORD_WRAP)}}},at=()=>({name:`AddTitleProperty`,pre(e){let t=this.options.meta?.title;t&&(e.properties[Y.TITLE]=t)}}),ot=()=>({name:`AddLanguageProperty`,pre(e){e.properties[Y.LANG]=this.options.lang||Z.LANG}});function st(e){let t={};if(!e)return t;/lineNumbers|showLineNumbers/.test(e)&&(t.lineNumbers=!0),/wordWrap|word-wrap/.test(e)&&(t.wordWrap=!0);let n=e.match(/title=(["'])(.*?)\1/);return n&&(t.title=n[2]),t}var ct=class{config;constructor(e){this.config=e}getTheme(){return this.config?.theme?.codeTheme||{light:nt.LIGHT,dark:nt.DARK}}async getHighlighter(){return await et(this.getTheme())}getOptions(e,t){let n=this.getTheme(),r={},i=``;typeof t==`string`?(i=t,r=st(t)):t&&(r=t,i=t.__raw||``);let a={lang:e||Z.LANG,meta:{__raw:i,...r},transformers:[rt(),it(),at(),ot()]};return typeof n==`object`?a.themes={light:n.light,dark:n.dark}:a.theme=n,a}async render(e,t,n){try{let r=await this.getHighlighter(),i=this.getOptions(t,n);return r.codeToHtml(e,i)}catch(t){return console.error(`[ShikiAdapter] Failed to render code:`,t),`<pre class="${X.FALLBACK}"><code>${lt(e)}</code></pre>`}}};function lt(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}let Q=null,ut;function dt(e){let t=JSON.stringify(e?.theme?.codeTheme||null);return(Q===null||ut!==t)&&(Q=new ct(e),ut=t),Q}function ft(e){let t=dt(e);return async e=>{let n=await t.getHighlighter();ce(e,J.ELEMENT,e=>{if(e.tagName===tt.PRE&&e.children?.[0]?.type===J.ELEMENT&&e.children[0].tagName===tt.CODE){let r=e.children[0],i=(r.properties?.className||[]).find(e=>e.startsWith(`language-`)),a=i?i.slice(9):Z.MDX_DEFAULT_LANG;if(a===`mermaid`)return;let o=r.children?.[0]?.value||``,s=st(r.properties?.metastring||r.data?.meta||``),c=t.getOptions(a,s),l=``;try{l=n.codeToHtml(o,c)}catch(e){console.error(`[rehypeShiki] Failed to highlight code block:`,e),l=`<pre class="${X.FALLBACK}"><code>${lt(o)}</code></pre>`}e.properties=e.properties||{},s.title&&(e.properties[Y.TITLE]=s.title),e.properties[Y.HIGHLIGHTED]=`true`,e.properties[Y.HIGHLIGHTED_HTML]=l,e.properties[Y.LANG]=a,e.children=[]}})}}function pt(){return e=>{ce(e,J.CODE,e=>{e.meta&&(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.data.hProperties.metastring=e.meta)})}}let mt=!1;function $(e,t=ie){let n=e?.plugins?.flatMap(e=>I.getSanitizedCapabilities(e).remarkPlugins||[])||[],r=e?.plugins?.flatMap(e=>I.getSanitizedCapabilities(e).rehypePlugins||[])||[],i=t({remarkPlugins:[ae,oe,pt,...n],rehypePlugins:[se,[ft,e],...r],jsxRuntime:`automatic`});return{...i,name:`vite-plugin-boltdocs-mdx`,async buildStart(){mt||=(await K.load(),!0),i.buildStart&&await i.buildStart.call(this)},async transform(e,t,n){let[r]=t.split(`?`);if(!r.endsWith(`.md`)&&!r.endsWith(`.mdx`))return i.transform?.call(this,e,t,n);let a=`${r}:${S.createHash(`md5`).update(e).digest(`hex`)}:${process.env.NODE_ENV===`production`?`prod`:`dev`}:v3`,o=await K.getAsync(a);if(o)return{code:o,map:null};let s=await i.transform.call(this,e,r,n);return s&&typeof s==`object`&&s.code&&(process.env.NODE_ENV!==`production`&&(s.code+=`
|
|
107
|
+
export default UserLayout;`;throw Error(`[Boltdocs] Layout file not found. A 'layout.tsx' or 'layout.jsx' file is mandatory in your docs directory. Please create one to define your site structure.`)}if(c===`icons`){let e=[`tsx`,`jsx`,`ts`,`js`],t=null;for(let n of e){let e=v.resolve(r,`icons.${n}`);if(x.existsSync(e)){t=e;break}}return t?`import * as icons from '${a(t)}';\nexport default icons;`:`export default {};`}if(c===`search`){if(!V){let e=Ie(await f(r,s));V=`export default ${JSON.stringify(e,null,2)};`}return V}if(c===`client`){let e=L,t=``;for(;e&&e!==v.parse(e).root;){let n=v.join(e,`src/client/index.ts`),r=v.join(e,`dist/client/index.mjs`),i=v.join(e,`client/index.ts`);if(x.existsSync(n)){t=a(n);break}if(x.existsSync(r)){t=a(r);break}if(x.existsSync(i)){t=a(i);break}e=v.dirname(e)}if(!t)throw Error(`[boltdocs] Could not resolve boltdocs/client entry point starting from ${L}`);return`export * from '${t}';`}}}}const ze={"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 Be(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(`; `)}const H=new Map;async function Ve(e){try{let{data:t}=await c(e),n=JSON.stringify(t);return S.createHash(`md5`).update(n).digest(`hex`)}catch{return``}}function He(e){return H.get(e)}function Ue(e,t){H.set(e,t)}function We(e){H.delete(e)}function U(e,t){let n=e.moduleGraph.getModuleById(`\0virtual:boltdocs-${t}.ts`);n&&e.moduleGraph.invalidateModule(n)}function Ge(e,t,o,c,l){let f=new Map;return{name:`vite-plugin-boltdocs-dev-server`,apply:`serve`,async configureServer(c){let p=l();await p?.runHook(`beforeDev`),n(e,process.cwd(),o()).catch(e=>{console.error(`[boltdocs] Failed to generate initial link tree:`,e)}),setTimeout(async()=>{try{let{generateRoutes:t}=await import(`./routes-DwrMa5-z.mjs`).then(e=>e.r),n=await t(e,o());for(let e of n)if(e.filePath){let t=v.relative(process.cwd(),e.filePath).replace(/\\/g,`/`),n=t.startsWith(`/`)?t:`/${t}`;await c.transformRequest(n).catch(()=>{}),await new Promise(e=>setTimeout(e,50))}}catch{}},1e3),c.middlewares.use((e,t,n)=>{process.env.NODE_ENV===`production`&&Object.entries(ze).forEach(([e,n])=>{t.setHeader(e,n)});let r=o();r.security?.enableCSP&&t.setHeader(`Content-Security-Policy`,Be(r)),n()}),c.middlewares.use((e,t,n)=>{if(e.url===`/robots.txt`){n();return}n()}),c.middlewares.use(async(e,t,n)=>{let r=e.url?.split(`?`)[0]||`/`,i=e.headers.accept||``,a=o(),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(r);if(i.includes(`text/html`)&&!s){let n=T(a);n=E(n,a),n=await c.transformIndexHtml(e.url||`/`,n),t.statusCode=200,t.setHeader(`Content-Type`,`text/html`),t.end(n);return}n()});let m=r.map(e=>v.resolve(process.cwd(),e)),h=[`tsx`,`jsx`].map(t=>v.resolve(e,`layout.${t}`)),g=[`tsx`,`ts`,`jsx`,`js`],ee=g.map(t=>v.resolve(e,`mdx-components.${t}`)),_=g.map(t=>v.resolve(e,`pages-external/index.${t}`)),y=g.map(t=>v.resolve(e,`icons.${t}`));c.watcher.add([...m,...ee,...h,..._,...y]);let b=async(l,p)=>{try{let m=a(l);if(r.some(e=>m.endsWith(e))){c.restart();return}if(g.some(e=>m.endsWith(`mdx-components.${e}`))){i(o(),e),U(c,`mdx-components.tsx`),c.ws.send({type:`full-reload`});return}if(g.some(e=>m.endsWith(`icons.${e}`))){U(c,`icons.tsx`),c.ws.send({type:`full-reload`});return}if(m.endsWith(`layout.tsx`)||m.endsWith(`layout.jsx`)){U(c,`layout.tsx`),c.ws.send({type:`full-reload`});return}if(m.includes(`/pages-external/`)||m.includes(`\\pages-external\\`)){U(c,`entry`),c.ws.send({type:`full-reload`});return}if(!m.toLowerCase().startsWith(t.toLowerCase())||!s(m))return;if(p===`add`||p===`unlink`){p===`unlink`&&We(l),d(),Le();let t=o();i(t,e),U(c,`config`),U(c,`routes`),U(c,`search`),n(e,process.cwd(),t).catch(e=>{console.error(`[boltdocs] Failed to update link tree:`,e)}),c.ws.send({type:`custom`,event:`boltdocs:config-update`,data:{theme:t?.theme,i18n:t?.i18n,versions:t?.versions,siteUrl:t?.siteUrl}}),c.ws.send({type:`full-reload`});return}f.has(m)&&clearTimeout(f.get(m)),f.set(m,setTimeout(async()=>{f.delete(m);try{let t=He(l),n=await Ve(l);Ue(l,n),u(l),t!==void 0&&t!==n&&(U(c,`routes`),U(c,`search`));let r=a(v.relative(e,l)),i=c.moduleGraph.getModulesByFile(m);if(i)for(let e of i)c.moduleGraph.invalidateModule(e);c.ws.send({type:`custom`,event:`boltdocs:mdx-update`,data:{file:m,relPath:r}})}catch(e){console.error(`[boltdocs] HMR error processing content change:`,e)}},150))}catch(e){console.error(`[boltdocs] HMR error during ${p} event:`,e)}};c.watcher.on(`add`,e=>b(e,`add`)),c.watcher.on(`unlink`,e=>b(e,`unlink`)),c.watcher.on(`change`,e=>b(e,`change`)),await p?.runHook(`afterDev`)},handleHotUpdate({file:e,server:n}){let r=a(e);if(r.toLowerCase().startsWith(t.toLowerCase())&&s(r))return[]}}}const W=p.createRequire(import.meta.url);function Ke(e){let t=v.dirname(e);for(;t&&t!==v.dirname(t);){let e=v.join(t,`package.json`);if(x.existsSync(e))return e;t=v.dirname(t)}return null}function qe(e){let t=e.split(`/`);return e.startsWith(`@`)?{packageName:t.slice(0,2).join(`/`),subpath:t.slice(2).join(`/`)}:{packageName:t[0],subpath:t.slice(1).join(`/`)}}function G(e,t=W){try{let{packageName:n,subpath:r}=qe(e),i;try{i=t.resolve(n+`/package.json`)}catch{i=Ke(t.resolve(n))||``}if(!i)throw Error(`Could not find package.json for ${n}`);let a=v.dirname(i),o=JSON.parse(x.readFileSync(i,`utf-8`)),s=``,c=r?`./`+r:`.`;if(o.exports){let e=o.exports[c]||o.exports[r];e&&(s=typeof e==`string`?e:e.import||e.default||e.require||e)}if(!s&&!r&&(s=o.module||o.main||`index.js`),typeof s==`object`&&(s=s.import||s.default||s.require||``),s){let e=v.resolve(a,s);if(x.existsSync(e))return e}}catch{}return t.resolve(e)}function Je(){let e=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`],t=[],n=W;try{let e=v.join(process.cwd(),`node_modules/boltdocs/package.json`);if(x.existsSync(e)){let t=x.realpathSync(e);n=p.createRequire(t)}else n=p.createRequire(v.join(process.cwd(),`package.json`))}catch{}for(let r of e)try{let e=``;e=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(r,n):n.resolve(r),e&&t.push(x.realpathSync(e))}catch{}if(n!==W)for(let n of e)try{let e=``;e=n===`@bdocs/ssg`||n===`react-router-dom`||n===`react-helmet-async`?G(n,W):W.resolve(n),e&&t.push(x.realpathSync(e))}catch{}for(let e of[`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`]){try{t.push(x.realpathSync(n.resolve(e)))}catch{}if(n!==W)try{t.push(x.realpathSync(W.resolve(e)))}catch{}}return Array.from(new Set(t)).map(e=>a(e))}function Ye(t={},n){let r=v.resolve(process.cwd(),t.docsDir||`docs`),i=a(r),o=n,s,c=!1,l,u=[],d=()=>o;return[{name:`vite-plugin-boltdocs`,enforce:`pre`,async config(t,n){c=n.command===`build`;let i=!!(n.ssrBuild||n.ssr||t.build?.ssr),a=t.envDir||process.cwd(),s=ee(n.mode,a,``);Object.assign(process.env,s),o||=await e(r);let d=(await import(`./package-B4MD00N3.mjs`)).version,p=P(o.plugins||[],d);return o.plugins=p,l=new Ne(p,o),u=p.flatMap(e=>I.getSanitizedCapabilities(e).vitePlugins||[]),c&&await l.runHook(`beforeBuild`),{ssgOptions:{entry:`boltdocs/entry`,htmlEntry:`index.html`,dirStyle:`flat`,includeAllRoutes:!0,mock:!0,script:`async`,beastiesOptions:{preload:`media`},onFinished:async e=>{let t=je(w(await f(r,o)),o);t&&x.writeFileSync(v.join(e,`sitemap.xml`),t);let n=Me(o);x.writeFileSync(v.join(e,`robots.txt`),n)}},build:{ssrManifest:c},optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-router-dom`,`react-helmet-async`,`react-fast-compare`,`invariant`],exclude:[`boltdocs`,`boltdocs/client`]},resolve:{alias:[{find:`react-router-dom`,replacement:G(`react-router-dom`)},{find:`react-helmet-async`,replacement:G(`react-helmet-async`)},{find:`@bdocs/ssg`,replacement:G(`@bdocs/ssg`)}],dedupe:[`react`,`react-dom`,...i?[]:[`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`]]},ssr:{external:[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`,...Je()],optimizeDeps:{include:[`react-fast-compare`,`invariant`]},noExternal:[]}}},configResolved(e){s=e,l?.runHook(`configResolved`,o)},resolveId(e,t,n){let r=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`].find(t=>e===t||e.startsWith(t+`/`)||e.includes(`/node_modules/${t}/`)||t.startsWith(`@`)&&e.includes(`/node_modules/${t.replace(`/`,v.sep)}/`));if(r&&n?.ssr){let t=e;if(!v.isAbsolute(e)){let n=W;try{let e=v.join(process.cwd(),`node_modules/boltdocs/package.json`);if(x.existsSync(e)){let t=x.realpathSync(e);n=p.createRequire(t)}else n=p.createRequire(v.join(process.cwd(),`package.json`))}catch{}try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(e,n):n.resolve(e)}catch{try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(e,W):W.resolve(e)}catch{}}}try{t=x.realpathSync(t)}catch{}return{id:t,external:!0}}return null},transformIndexHtml:{order:`pre`,handler(e){return E(e,o)}},async buildEnd(){let{pool:e}=await import(`./worker-pool-Bd8Y9KDv.mjs`);await e.terminate()},async closeBundle(){!c||s?.build?.ssr||(await l?.runHook(`afterBuild`),await l?.runHook(`buildEnd`))},configurePreviewServer(e){let t=s?.build?.outDir?v.resolve(s.root||process.cwd(),s.build.outDir):v.resolve(process.cwd(),`dist`);e.middlewares.use((e,n,r)=>{let i=e.url||`/`,a=i.split(`?`)[0].split(`#`)[0];if(v.extname(a))return r();let o=a.replace(/\/$/,``)||`/`,s=v.join(t,o,`index.html`);o!==`/`&&x.existsSync(s)&&(e.url=`${o}/index.html${i.includes(`?`)?`?${i.split(`?`)[1]}`:``}`),r()})}},Re(t,d,()=>s,r),Ge(r,i,d,e=>{o=e},()=>l),{...te({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:`preset-default`}]}}),apply:`build`},...u]}const K=new l(`mdx`),Xe=[de.default||de,fe.default||fe,pe.default||pe,me.default||me,he.default||he,ge.default||ge,_e.default||_e],Ze=[ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae];let Qe=null,q=null;const $e=()=>(Qe??=le(),Qe),et=async e=>q||(q=ue({themes:Xe,langs:Ze,engine:$e()}),q),J={JSX_FLOW_ELEMENT:`mdxJsxFlowElement`,JSX_TEXT_ELEMENT:`mdxJsxTextElement`,JSX_ATTRIBUTE:`mdxJsxAttribute`,ELEMENT:`element`,TEXT:`text`,CODE:`code`},tt={PRE:`pre`,CODE:`code`},Y={TITLE:`data-title`,LANG:`data-lang`,HIGHLIGHTED:`data-highlighted`,HIGHLIGHTED_HTML:`data-highlighted-html`},X={LINE_NUMBERS:`shiki-line-numbers`,WORD_WRAP:`shiki-word-wrap`,FALLBACK:`shiki-fallback`},nt={LIGHT:`github-light`,DARK:`github-dark`},Z={LANG:`plaintext`,MDX_DEFAULT_LANG:`text`},rt=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:line-numbers`,pre(e){let n=this.options.meta?.lineNumbers===!0;(t||n)&&this.addClassToHast(e,X.LINE_NUMBERS)}}},it=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:word-wrap`,pre(e){let n=this.options.meta?.wordWrap===!0;(t||n)&&this.addClassToHast(e,X.WORD_WRAP)}}},at=()=>({name:`AddTitleProperty`,pre(e){let t=this.options.meta?.title;t&&(e.properties[Y.TITLE]=t)}}),ot=()=>({name:`AddLanguageProperty`,pre(e){e.properties[Y.LANG]=this.options.lang||Z.LANG}});function st(e){let t={};if(!e)return t;/lineNumbers|showLineNumbers/.test(e)&&(t.lineNumbers=!0),/wordWrap|word-wrap/.test(e)&&(t.wordWrap=!0);let n=e.match(/title=(["'])(.*?)\1/);return n&&(t.title=n[2]),t}var ct=class{config;constructor(e){this.config=e}getTheme(){return this.config?.theme?.codeTheme||{light:nt.LIGHT,dark:nt.DARK}}async getHighlighter(){return await et(this.getTheme())}getOptions(e,t){let n=this.getTheme(),r={},i=``;typeof t==`string`?(i=t,r=st(t)):t&&(r=t,i=t.__raw||``);let a={lang:e||Z.LANG,meta:{__raw:i,...r},transformers:[rt(),it(),at(),ot()]};return typeof n==`object`?a.themes={light:n.light,dark:n.dark}:a.theme=n,a}async render(e,t,n){try{let r=await this.getHighlighter(),i=this.getOptions(t,n);return r.codeToHtml(e,i)}catch(t){return console.error(`[ShikiAdapter] Failed to render code:`,t),`<pre class="${X.FALLBACK}"><code>${lt(e)}</code></pre>`}}};function lt(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}let Q=null,ut;function dt(e){let t=JSON.stringify(e?.theme?.codeTheme||null);return(Q===null||ut!==t)&&(Q=new ct(e),ut=t),Q}function ft(e){let t=dt(e);return async e=>{let n=await t.getHighlighter();ce(e,J.ELEMENT,e=>{if(e.tagName===tt.PRE&&e.children?.[0]?.type===J.ELEMENT&&e.children[0].tagName===tt.CODE){let r=e.children[0],i=(r.properties?.className||[]).find(e=>e.startsWith(`language-`)),a=i?i.slice(9):Z.MDX_DEFAULT_LANG;if(a===`mermaid`)return;let o=r.children?.[0]?.value||``,s=st(r.properties?.metastring||r.data?.meta||``),c=t.getOptions(a,s),l=``;try{l=n.codeToHtml(o,c)}catch(e){console.error(`[rehypeShiki] Failed to highlight code block:`,e),l=`<pre class="${X.FALLBACK}"><code>${lt(o)}</code></pre>`}e.properties=e.properties||{},s.title&&(e.properties[Y.TITLE]=s.title),e.properties[Y.HIGHLIGHTED]=`true`,e.properties[Y.HIGHLIGHTED_HTML]=l,e.properties[Y.LANG]=a,e.children=[]}})}}function pt(){return e=>{ce(e,J.CODE,e=>{e.meta&&(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.data.hProperties.metastring=e.meta)})}}let mt=!1;function $(e,t=ie){let n=e?.plugins?.flatMap(e=>I.getSanitizedCapabilities(e).remarkPlugins||[])||[],r=e?.plugins?.flatMap(e=>I.getSanitizedCapabilities(e).rehypePlugins||[])||[],i=t({remarkPlugins:[ae,oe,pt,...n],rehypePlugins:[se,[ft,e],...r],jsxRuntime:`automatic`});return{...i,name:`vite-plugin-boltdocs-mdx`,async buildStart(){mt||=(await K.load(),!0),i.buildStart&&await i.buildStart.call(this)},async transform(e,t,n){let[r]=t.split(`?`);if(!r.endsWith(`.md`)&&!r.endsWith(`.mdx`))return i.transform?.call(this,e,t,n);let a=`${r}:${S.createHash(`md5`).update(e).digest(`hex`)}:${process.env.NODE_ENV===`production`?`prod`:`dev`}:v3`,o=await K.getAsync(a);if(o)return{code:o,map:null};let s=await i.transform.call(this,e,r,n);return s&&typeof s==`object`&&s.code&&(process.env.NODE_ENV!==`production`&&(s.code+=`
|
|
108
108
|
if (import.meta.hot) {
|
|
109
109
|
import.meta.hot.accept();
|
|
110
110
|
}
|
|
111
|
-
`),K.set(a,s.code)),s},async buildEnd(){K.save(),await K.flush(),i.buildEnd&&await i.buildEnd.call(this)}}}m(import.meta.url);async function ht(
|
|
111
|
+
`),K.set(a,s.code)),s},async buildEnd(){K.save(),await K.flush(),i.buildEnd&&await i.buildEnd.call(this)}}}m(import.meta.url);async function ht(t){let n=await e(t?.docsDir||`docs`);return[...Ye({...t},n),$(n)]}async function gt(t,n=`development`){let r=await e(`docs`,t),i=n===`production`,a=i?{...ze}:{};return r.security?.enableCSP&&(a[`Content-Security-Policy`]=Be(r)),{root:t,mode:n,oxc:{jsx:{development:!i,runtime:`automatic`,importSource:`react`}},optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-helmet-async`,`react-router-dom`,`react-fast-compare`,`invariant`,`use-sync-external-store/shim`]},build:{},plugins:[h(),g(),...Ye({docsDir:`docs`,root:t},r),$(r)],resolve:{alias:[{find:`boltdocs/entry`,replacement:_(v.resolve(t,`boltdocs-entry.tsx`))},{find:`boltdocs/client`,replacement:_(v.resolve(t,`boltdocs-client.mjs`))},{find:`use-sync-external-store/shim/index.js`,replacement:`react`},{find:`use-sync-external-store/shim`,replacement:`react`},{find:`use-sync-external-store`,replacement:`react`}],dedupe:[`react`,`react-dom`]},ssr:{external:[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`,...Je()],optimizeDeps:{include:[`react-fast-compare`,`invariant`,...r.vite?.ssr?.optimizeDeps?.include||[]]},noExternal:[`boltdocs`,/@bdocs\/(?!ssg).*/,`react-aria-components`,`@react-aria/collections`,`@react-aria/utils`]},server:{headers:{...a,...r.vite?.server?.headers},...r.vite?.server},preview:{headers:{...a,...r.vite?.preview?.headers},...r.vite?.preview},...r.vite}}export{Ne as a,F as c,k as d,D as f,O as h,Pe as i,P as l,A as m,gt as n,I as o,j as p,z as r,N as s,ht as t,M as u};
|