@veluai/velu 0.2.42 → 0.2.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cli.js +43 -43
  2. package/docs/mintlify-migration.md +2 -0
  3. package/package.json +1 -1
  4. package/runtime/velu-ui/base.css +4 -0
  5. package/runtime/velu-ui/components/ApiReferencePage.jsx +4 -4
  6. package/runtime/velu-ui/components/ApiSamples.jsx +2 -2
  7. package/runtime/velu-ui/components/Card.jsx +6 -1
  8. package/runtime/velu-ui/components/PageFooter.jsx +1 -1
  9. package/runtime/velu-ui/components/PageHeader.jsx +8 -19
  10. package/runtime/velu-ui/components/PoweredBy.jsx +2 -0
  11. package/runtime/velu-ui/components/VepaFooter.jsx +5 -4
  12. package/runtime/velu-ui/components/api-page.css +6 -6
  13. package/runtime/velu-ui/components/api.css +2 -2
  14. package/runtime/velu-ui/components/ask-bar.css +3 -3
  15. package/runtime/velu-ui/components/changelog-filters.css +5 -5
  16. package/runtime/velu-ui/components/chatbot.css +5 -5
  17. package/runtime/velu-ui/components/code-block.css +2 -2
  18. package/runtime/velu-ui/components/context-menu.css +1 -1
  19. package/runtime/velu-ui/components/docs-layout.css +3 -3
  20. package/runtime/velu-ui/components/field.css +1 -1
  21. package/runtime/velu-ui/components/image.css +1 -1
  22. package/runtime/velu-ui/components/not-found.css +1 -1
  23. package/runtime/velu-ui/components/page-feedback.css +5 -5
  24. package/runtime/velu-ui/components/page-footer.css +1 -1
  25. package/runtime/velu-ui/components/page-header.css +11 -3
  26. package/runtime/velu-ui/components/page-nav.css +1 -1
  27. package/runtime/velu-ui/components/powered-by.css +1 -1
  28. package/runtime/velu-ui/components/prompt.css +2 -2
  29. package/runtime/velu-ui/components/search.css +1 -1
  30. package/runtime/velu-ui/components/sidebar.css +2 -2
  31. package/runtime/velu-ui/components/toc-bar.css +2 -2
  32. package/runtime/velu-ui/components/update.css +1 -1
  33. package/runtime/velu-ui/lib/velu-mark.jsx +20 -0
  34. package/runtime/velu-ui/styles.css +13 -1
  35. package/runtime/velu-ui/themes/aalam.css +19 -8
  36. package/runtime/velu-ui/themes/kadhir.css +6 -2
  37. package/runtime/velu-ui/themes/nila.css +6 -1
  38. package/runtime/velu-ui/themes/thulir.css +240 -231
  39. package/runtime/velu-ui/themes/vepa.css +21 -10
  40. package/schema/velu.schema.json +1 -1
  41. package/src/runtime/App.jsx +49 -37
package/dist/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- var Xr=Object.defineProperty;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var $e=(e,t)=>{for(var r in t)Xr(e,r,{get:t[r],enumerable:!0})};var sn={};$e(sn,{initProject:()=>eo});import me from"node:fs/promises";import de from"node:path";import{fileURLToPath as Yr}from"node:url";async function eo(e,t){try{if((await me.readdir(e)).length>0)throw new Error(`Directory "${t}" already exists and is not empty. Choose a different name or remove the folder first.`)}catch(i){if(i.code!=="ENOENT")throw i}await me.mkdir(e,{recursive:!0}),await me.cp(Qr,e,{recursive:!0});let r=de.join(e,"velu.json"),n=JSON.parse(await me.readFile(r,"utf-8"));n.name=t,await me.writeFile(r,JSON.stringify(n,null,2)+`
3
- `,"utf-8");let o=await on(e);console.log(`[velu] created ${t}/`);for(let i of o)console.log(` ${i}`);console.log(""),console.log("Next steps:"),console.log(` cd ${t}`),console.log(" velu dev")}async function on(e,t=e,r=[]){let n=await me.readdir(e,{withFileTypes:!0});for(let o of n){let i=de.join(e,o.name);o.isDirectory()?await on(i,t,r):r.push(de.relative(t,i).split(de.sep).join("/"))}return r.sort()}var Zr,Qr,an=_(()=>{Zr=de.dirname(Yr(import.meta.url)),Qr=de.resolve(Zr,"..","templates","starter")});import Se from"node:fs";import K from"node:path";import{fileURLToPath as to}from"node:url";import{parse as no,printParseErrorCode as ro}from"jsonc-parser";import oo from"js-yaml";function le(e,t){let r=K.relative(e,t);return r===""||!r.startsWith(`..${K.sep}`)&&r!==".."&&!K.isAbsolute(r)}function gt(e,t){let r=[],n=no(e.replace(/^\uFEFF/,""),r,{allowTrailingComma:!0});if(r.length)throw new Error(`${t}: ${ro(r[0].error)} at offset ${r[0].offset}`);return n}function ln(e,t){let r=Se.realpathSync(e);function n(i,a=[]){if(!le(r,Se.realpathSync(i)))throw new Error("Config reference escapes the source directory.");if(a.includes(i))throw new Error(`Circular config reference: ${dt(K.relative(e,i))}`);if(a.length>50)throw new Error("Config reference nesting exceeds 50 levels.");let s=Se.readFileSync(i,"utf8"),l=/\.ya?ml$/i.test(i)?oo.load(s):gt(s,K.basename(i));function c(u){if(Array.isArray(u))return u.map(c);if(!W(u))return u;if(typeof u.$ref=="string"){if(!/^\.\.?\//.test(u.$ref)||/[#?]/.test(u.$ref))throw new Error(`Config $ref must be a local JSON/YAML file without a fragment: ${u.$ref}`);let p=K.resolve(K.dirname(i),u.$ref);if(!le(e,p))throw new Error("Config reference escapes the source directory.");let y=n(p,[...a,i]),m=Object.fromEntries(Object.entries(u).filter(([g])=>g!=="$ref").map(([g,v])=>[g,c(v)]));if(Object.keys(m).length&&!W(y))throw new Error("Config $ref siblings require an object reference.");return W(y)?{...y,...m}:y}return Object.fromEntries(Object.entries(u).map(([p,y])=>[p,c(y)]))}return c(l)}let o=n(K.join(e,t));if(!W(o))throw new Error(`${t} must contain an object.`);return o}function io(e,t){let r=e.navigation||[],n=e.tabs||[];if(!Array.isArray(r)||!Array.isArray(n))throw new Error("Legacy navigation and tabs must be arrays.");function o(a,s,l){return a.flatMap(c=>{if(typeof c=="string"){let p=c.replace(/^\//,"");return(s?p===s||p.startsWith(s+"/"):!l.some(m=>p===m||p.startsWith(m+"/")))?[c]:[]}if(!W(c))return[];let u=o(c.pages||[],s,l);return u.length?[{...c,pages:u}]:[]})}let i={groups:r};if(n.length){let a=n.filter(c=>c.url&&!/^https?:/.test(c.url)).map(c=>c.url.replace(/^\/+|\/+$/g,"")),s=n.map(c=>{if(/^https?:/.test(c.url||""))return{tab:c.name,href:c.url,...c.icon?{icon:c.icon}:{}};let u=(c.url||"").replace(/^\/+|\/+$/g,"");return{tab:c.name,...c.icon?{icon:c.icon}:{},groups:o(r,u,a)}}),l=o(r,"",a);l.length&&!n.some(c=>!c.url||c.url==="/")&&s.unshift({tab:"Documentation",groups:l}),i={tabs:s}}return Array.isArray(e.anchors)&&(i.anchors=e.anchors.map(({name:a,url:s,...l})=>({...l,anchor:a,href:s}))),e.versions&&t("legacy-versions","warning","versions","Legacy version filtering needs review; all groups are retained. Convert version-specific groups to navigation.versions."),i}function cn(e,t,r){let n=structuredClone(e);if(n.theme==="sequoia"&&(n.theme="vepa",n.contextual==null&&(n.contextual={options:[]})),n.theme==="mint"&&(n.theme="thulir",n.contextual==null&&(n.contextual={options:[]})),n.theme==="maple"&&(n.theme="aalam",n.contextual==null&&(n.contextual={options:[]})),n.theme==="aspen"&&(n.theme="nila",n.contextual==null&&(n.contextual={options:[]})),n.theme&&!["velu","vepa","thulir","aalam","nila"].includes(n.theme)&&(r("unsupported-config","warning","theme","This theme has no Velu preset; original setting preserved in source config."),delete n.theme),t==="mint.json"||Array.isArray(n.navigation)){if(n.navigation=io(n,r),n.topbarLinks&&(n.navbar={...n.navbar,links:n.topbarLinks.map(({name:p,...y})=>({...y,label:p}))}),n.topbarCta){let{name:p,...y}=n.topbarCta;p&&!y.label&&(y.label=p),n.navbar={...n.navbar,primary:y}}n.footerSocials&&(n.footer={...n.footer,socials:n.footerSocials}),n.modeToggle&&r("appearance","warning","modeToggle","Set the initial theme and theme-switcher behavior manually in Velu."),typeof n.api?.baseUrl=="string"&&(n.api.server=n.api.baseUrl),n.api?.request?.example?.languages&&(n.api.examples={languages:n.api.request.example.languages});for(let p of["tabs","anchors","topbarLinks","topbarCta","footerSocials","modeToggle"])delete n[p];n.api&&(delete n.api.baseUrl,delete n.api.request)}if(n.fonts&&!n.font){let p=n.fonts.family||n.fonts.body?.family;p&&(n.font={family:p}),r("fonts","warning","fonts","Body font family migrated where available; custom font sources, weights, and heading fonts need review."),delete n.fonts}W(n.favicon)&&(n.favicon=n.favicon.light||n.favicon.dark,r("favicon-theme","warning","favicon","Velu uses one favicon; selected the light variant when available.")),W(n.logo)&&(n.logo.light??=n.logo.dark,n.logo.dark??=n.logo.light);function o(p,y="navigation"){if(Array.isArray(p))return p.map((g,v)=>o(g,`${y}[${v}]`));if(!W(p))return p;let m={...p};if(Array.isArray(m.dropdowns)&&!m.products&&!m.tabs&&(m.tabs=m.dropdowns.map(({dropdown:g,...v})=>({tab:g,...v})),delete m.dropdowns,r("navigation-dropdowns","warning",y,"Dropdowns converted to tabs. Check navigation layout and URLs.")),m.global){for(let g of["anchors","tabs"])Array.isArray(m.global[g])&&(m[g]=[...m[g]||[],...m.global[g]]);r("navigation-global","warning",`${y}.global`,"Global anchors/tabs merged into this container. Review switcher visibility; other global entries remain in the original config."),delete m.global}W(m.icon)&&typeof m.icon.name=="string"&&(m.icon=m.icon.name,r("icon-library","warning",`${y}.icon`,"Icon name retained; check its equivalent in Velu\u2019s Lucide icon library.")),W(m.openapi)&&typeof m.openapi.source=="string"&&(r("openapi-options","warning",`${y}.openapi`,"OpenAPI source retained; generation options need review."),m.openapi=m.openapi.source);for(let[g,v]of Object.entries(m))g==="pages"&&Array.isArray(v)?m[g]=v.map((d,h)=>typeof d=="string"?d.replace(/\.(mdx|md)$/i,""):o(d,`${y}.pages[${h}]`)):(W(v)||Array.isArray(v))&&(m[g]=o(v,`${y}.${g}`));return m}n.navigation=o(n.navigation||{}),(n.navigation.products||n.navigation.versions||n.navigation.languages)&&(n.navigation.preservePagePaths=!0),typeof n.description=="string"&&(n.seo={...n.seo,metatags:{description:n.description,...n.seo?.metatags}},delete n.description),n.$schema="https://veludocs.com/velu.schema.json";let i=K.dirname(to(import.meta.url)),a=[K.resolve(i,"../../schema/velu.schema.json"),K.resolve(i,"../schema/velu.schema.json")].find(p=>Se.existsSync(p));if(!a)throw new Error("Velu config schema is missing from this installation.");let s=JSON.parse(Se.readFileSync(a,"utf8")),l=p=>p.$ref?p.$ref.split("/").slice(1).reduce((y,m)=>y[m],s):p,c=p=>Array.isArray(p)?"array":p===null?"null":typeof p;function u(p,y,m){let g=l(y);if(g.oneOf&&(g=g.oneOf.map(l).find(v=>v.type&&c(p)!==v.type||v.properties?.type?.const&&p?.type!==v.properties.type.const?!1:Array.isArray(v.required)&&v.required.length&&W(p)?v.required.every(d=>Object.prototype.hasOwnProperty.call(p,d)):!0),!g)){r("config-shape","error",m,"Value does not match any supported Velu shape; original retained in source config.");return}if(g.type&&c(p)!==g.type||g.enum&&!g.enum.includes(p)||"const"in g&&p!==g.const){r("config-value","error",m,"Unsupported value or type; original retained in source config.");return}if(typeof p=="string"&&g.minLength&&p.length<g.minLength&&r("config-value","error",m,"Value must not be empty."),W(p)){let v={};for(let[d,h]of Object.entries(p)){let S=m?`${m}.${d}`:d,O=g.properties?.[d]||(W(g.additionalProperties)?g.additionalProperties:null);if(!O&&g.additionalProperties===!1){let x=/(^|\.)(auth|authentication|groups|hidden|public|permissions|personalization)(\.|$)/.test(S);r("unsupported-config",x?"error":"warning",S,x?"Access or visibility rules require manual migration before publishing.":"No equivalent in the Velu schema; original setting preserved in source config.");continue}let A=O?u(h,O,S):h;A!==void 0&&Object.defineProperty(v,d,{value:A,enumerable:!0,writable:!0,configurable:!0})}for(let d of g.required||[])d in v||r("required-config","error",m?`${m}.${d}`:d,"Required Velu setting is missing.");return v}return Array.isArray(p)&&g.items?(g.maxItems&&p.length>g.maxItems&&r("config-limit","warning",m,`Velu supports up to ${g.maxItems} entries here; review rendering.`),p.map((v,d)=>u(v,g.items,`${m}[${d}]`)).filter(v=>v!==void 0)):p}return u(n,s,"")}var W,dt,Je=_(()=>{W=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),dt=e=>e.split(K.sep).join("/")});var te,qe=_(()=>{te=["Callout","Card","CardGroup","Accordion","AccordionGroup","Columns","Field","Prompt","Steps","Step","Tree","Folder","File","Update","Icon","Image","CodeBlock","CodeGroup","MethodBadge","ApiPath","TryItBar","ApiField","ApiClient","ApiSidebar"]});import q from"node:path";import{createProcessor as so,compile as ao}from"@mdx-js/mdx";import un from"remark-frontmatter";import lo from"remark-mdx-frontmatter";import pn from"remark-gfm";import{visit as fn}from"unist-util-visit";import co from"js-yaml";import{parse as uo}from"@babel/parser";import po from"postcss";async function mn(e,t,r,n,{endpointConverted:o=!1}={}){let i=so({remarkPlugins:[un,pn]}),a;try{a=i.parse(e)}catch(d){return n("mdx-syntax","error",t,d.reason||d.message,d.line),{text:e,adapters:[]}}let s=new Set,l=[],c=[],u=new Set,p=new Set,y=new Set,m=(d,h,S)=>c.push({start:d,end:h,value:S});fn(a,"mdxjsEsm",d=>{for(let h of d.data?.estree?.body||[]){if(h.type==="ImportDeclaration"){for(let O of h.specifiers)s.add(O.local.name);l.push({node:d,stmt:h})}let S=h.declaration;S?.id?.name&&s.add(S.id.name);for(let O of S?.declarations||[])O.id?.name&&s.add(O.id.name)}});let g=(d,h=!1)=>{if(typeof d!="string"||/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(d)||h&&!d.startsWith(".")&&!d.startsWith("/"))return d;let[,S,O]=/^([^?#]*)(.*)$/.exec(d),A=q.posix.normalize(S.startsWith("/")?S.slice(1):q.posix.join(q.posix.dirname(t),S)),x=r.get(A);if(!x)return h&&n("missing-import","error",t,`Local import cannot be resolved in migrated files: ${d}`),d;if(h){let w=q.posix.relative(q.posix.dirname(r.get(t)||t),x);return(w.startsWith(".")?w:"./"+w)+O}return/\.(md|mdx)$/i.test(x)||p.add(x),/\.mdx$/i.test(x)&&/\.(md|mdx)$/i.test(S)?S.replace(/\.(md|mdx)$/i,"")+O:d};for(let{stmt:d}of l){let h=d.source.value;/^(?:@mintlify\/|next(?:\/|$))/.test(h)&&n("runtime-import","error",t,`Replace the runtime dependency ${h} with a Velu/React equivalent.`);let S=g(h,!0);S!==h&&m(d.source.start,d.source.end,JSON.stringify(S))}fn(a,d=>{if(d.type==="yaml")try{let w=co.load(d.value)||{};for(let P of Object.keys(w))if(["auth","groups","public","hidden"].includes(P))n("page-access","error",t,`Frontmatter ${P} requires manual visibility/access migration.`,d.position.start.line);else{if(P==="openapi"&&o)continue;["api","openapi","asyncapi"].includes(P)?n("endpoint-frontmatter","error",t,`Frontmatter ${P} is preserved but does not generate an endpoint in Velu. Wire the spec into navigation.openapi and review endpoint routes.`,d.position.start.line):["title","description","icon","sidebarTitle","mode","keywords","og:title","og:description","og:image"].includes(P)||n("frontmatter-review","warning",t,`Frontmatter ${P} is preserved; verify its behavior in Velu.`,d.position.start.line)}}catch(w){n("frontmatter-syntax","error",t,w.message,d.position.start.line)}if(["link","image","definition"].includes(d.type)&&d.url){let w=g(d.url);if(w!==d.url){let P=d.position.start.offset,B=e.slice(P,d.position.end.offset).lastIndexOf(d.url);B>=0&&m(P+B,P+B+d.url.length,w)}}if(!["mdxJsxFlowElement","mdxJsxTextElement"].includes(d.type)||!d.name)return;let h=d.name,S=d.position.start.line;if(s.has(h.split(".")[0]))return;y.add(h);let O=ht[h]?"Callout":["ParamField","ResponseField"].includes(h)?"Field":h==="Expandable"?"Accordion":h;if(O!==h&&s.has(O)){n("component-name-conflict","error",t,`Cannot convert <${h}> to <${O}> because that name is already locally defined. Rename the local binding before migration.`,S);return}let A=d.attributes.filter(w=>w.type==="mdxJsxAttribute"),x=(w,P)=>{let L=A.find(B=>B.name===w);L&&!A.some(B=>B.name===P)&&m(L.position.start.offset,L.position.start.offset+w.length,P)};if(h==="ParamField")for(let w of["body","query","path","header","cookie"])x(w,"name");if(h==="CardGroup"&&x("cols","limit"),h==="Accordion"&&x("default-open","defaultOpen"),h==="Expandable"&&(x("title","title"),A.some(w=>w.name==="title")||m(d.position.start.offset+1+h.length,d.position.start.offset+1+h.length,' title="Details"')),O!==h){let w=d.position.start.offset;m(w+1,w+1+h.length,O+(ht[h]?` type="${ht[h]}"`:""));let P=d.position.end.offset,L=new RegExp(`</${h}\\s*>$`).exec(e.slice(w,P));L&&m(P-L[0].length+2,P-L[0].length+2+h.length,O)}fo.has(h)?(u.add(h),n("component-adapter","warning",t,`<${h}> uses an editable React adapter. Review visual styling and optional props.`,S)):/^[A-Z]/.test(O)&&!mo.has(O)&&n("unsupported-component","error",t,`<${h}> needs a local component implementation or import.`,S);for(let w of A)if(["href","src"].includes(w.name)&&typeof w.value=="string"){let P=g(w.value);if(P!==w.value){let L=w.position.start.offset,ee=e.slice(L,w.position.end.offset).indexOf(w.value);ee>=0&&m(L+ee,L+ee+w.value.length,P)}}}),c.sort((d,h)=>h.start-d.start||h.end-d.end);let v=e;for(let d of c)v=v.slice(0,d.start)+d.value+v.slice(d.end);if(u.size){let d=q.posix.relative(q.posix.dirname(r.get(t)||t),ge);v+=`
2
+ var Zr=Object.defineProperty;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var $e=(e,t)=>{for(var r in t)Zr(e,r,{get:t[r],enumerable:!0})};var an={};$e(an,{initProject:()=>no});import me from"node:fs/promises";import de from"node:path";import{fileURLToPath as Qr}from"node:url";async function no(e,t){try{if((await me.readdir(e)).length>0)throw new Error(`Directory "${t}" already exists and is not empty. Choose a different name or remove the folder first.`)}catch(i){if(i.code!=="ENOENT")throw i}await me.mkdir(e,{recursive:!0}),await me.cp(to,e,{recursive:!0});let r=de.join(e,"velu.json"),n=JSON.parse(await me.readFile(r,"utf-8"));n.name=t,await me.writeFile(r,JSON.stringify(n,null,2)+`
3
+ `,"utf-8");let o=await sn(e);console.log(`[velu] created ${t}/`);for(let i of o)console.log(` ${i}`);console.log(""),console.log("Next steps:"),console.log(` cd ${t}`),console.log(" velu dev")}async function sn(e,t=e,r=[]){let n=await me.readdir(e,{withFileTypes:!0});for(let o of n){let i=de.join(e,o.name);o.isDirectory()?await sn(i,t,r):r.push(de.relative(t,i).split(de.sep).join("/"))}return r.sort()}var eo,to,ln=_(()=>{eo=de.dirname(Qr(import.meta.url)),to=de.resolve(eo,"..","templates","starter")});import Se from"node:fs";import K from"node:path";import{fileURLToPath as ro}from"node:url";import{parse as oo,printParseErrorCode as io}from"jsonc-parser";import so from"js-yaml";function le(e,t){let r=K.relative(e,t);return r===""||!r.startsWith(`..${K.sep}`)&&r!==".."&&!K.isAbsolute(r)}function ht(e,t){let r=[],n=oo(e.replace(/^\uFEFF/,""),r,{allowTrailingComma:!0});if(r.length)throw new Error(`${t}: ${io(r[0].error)} at offset ${r[0].offset}`);return n}function cn(e,t){let r=Se.realpathSync(e);function n(i,a=[]){if(!le(r,Se.realpathSync(i)))throw new Error("Config reference escapes the source directory.");if(a.includes(i))throw new Error(`Circular config reference: ${gt(K.relative(e,i))}`);if(a.length>50)throw new Error("Config reference nesting exceeds 50 levels.");let s=Se.readFileSync(i,"utf8"),l=/\.ya?ml$/i.test(i)?so.load(s):ht(s,K.basename(i));function c(u){if(Array.isArray(u))return u.map(c);if(!W(u))return u;if(typeof u.$ref=="string"){if(!/^\.\.?\//.test(u.$ref)||/[#?]/.test(u.$ref))throw new Error(`Config $ref must be a local JSON/YAML file without a fragment: ${u.$ref}`);let p=K.resolve(K.dirname(i),u.$ref);if(!le(e,p))throw new Error("Config reference escapes the source directory.");let y=n(p,[...a,i]),m=Object.fromEntries(Object.entries(u).filter(([g])=>g!=="$ref").map(([g,v])=>[g,c(v)]));if(Object.keys(m).length&&!W(y))throw new Error("Config $ref siblings require an object reference.");return W(y)?{...y,...m}:y}return Object.fromEntries(Object.entries(u).map(([p,y])=>[p,c(y)]))}return c(l)}let o=n(K.join(e,t));if(!W(o))throw new Error(`${t} must contain an object.`);return o}function ao(e,t){let r=e.navigation||[],n=e.tabs||[];if(!Array.isArray(r)||!Array.isArray(n))throw new Error("Legacy navigation and tabs must be arrays.");function o(a,s,l){return a.flatMap(c=>{if(typeof c=="string"){let p=c.replace(/^\//,"");return(s?p===s||p.startsWith(s+"/"):!l.some(m=>p===m||p.startsWith(m+"/")))?[c]:[]}if(!W(c))return[];let u=o(c.pages||[],s,l);return u.length?[{...c,pages:u}]:[]})}let i={groups:r};if(n.length){let a=n.filter(c=>c.url&&!/^https?:/.test(c.url)).map(c=>c.url.replace(/^\/+|\/+$/g,"")),s=n.map(c=>{if(/^https?:/.test(c.url||""))return{tab:c.name,href:c.url,...c.icon?{icon:c.icon}:{}};let u=(c.url||"").replace(/^\/+|\/+$/g,"");return{tab:c.name,...c.icon?{icon:c.icon}:{},groups:o(r,u,a)}}),l=o(r,"",a);l.length&&!n.some(c=>!c.url||c.url==="/")&&s.unshift({tab:"Documentation",groups:l}),i={tabs:s}}return Array.isArray(e.anchors)&&(i.anchors=e.anchors.map(({name:a,url:s,...l})=>({...l,anchor:a,href:s}))),e.versions&&t("legacy-versions","warning","versions","Legacy version filtering needs review; all groups are retained. Convert version-specific groups to navigation.versions."),i}function un(e,t,r){let n=structuredClone(e);if(n.theme==="sequoia"&&(n.theme="vepa",n.contextual==null&&(n.contextual={options:[]})),n.theme==="mint"&&(n.theme="thulir",n.contextual==null&&(n.contextual={options:[]})),n.theme==="maple"&&(n.theme="aalam",n.contextual==null&&(n.contextual={options:[]})),n.theme==="aspen"&&(n.theme="nila",n.contextual==null&&(n.contextual={options:[]})),n.theme==="luma"&&(n.theme="kadhir"),n.theme&&!["velu","vepa","thulir","aalam","nila","kadhir"].includes(n.theme)&&(r("unsupported-config","warning","theme","This theme has no Velu preset; original setting preserved in source config."),delete n.theme),t==="mint.json"||Array.isArray(n.navigation)){if(n.navigation=ao(n,r),n.topbarLinks&&(n.navbar={...n.navbar,links:n.topbarLinks.map(({name:p,...y})=>({...y,label:p}))}),n.topbarCta){let{name:p,...y}=n.topbarCta;p&&!y.label&&(y.label=p),n.navbar={...n.navbar,primary:y}}n.footerSocials&&(n.footer={...n.footer,socials:n.footerSocials}),n.modeToggle&&r("appearance","warning","modeToggle","Set the initial theme and theme-switcher behavior manually in Velu."),typeof n.api?.baseUrl=="string"&&(n.api.server=n.api.baseUrl),n.api?.request?.example?.languages&&(n.api.examples={languages:n.api.request.example.languages});for(let p of["tabs","anchors","topbarLinks","topbarCta","footerSocials","modeToggle"])delete n[p];n.api&&(delete n.api.baseUrl,delete n.api.request)}if(n.fonts&&!n.font){let p=n.fonts.family||n.fonts.body?.family;p&&(n.font={family:p}),r("fonts","warning","fonts","Body font family migrated where available; custom font sources, weights, and heading fonts need review."),delete n.fonts}W(n.favicon)&&(n.favicon=n.favicon.light||n.favicon.dark,r("favicon-theme","warning","favicon","Velu uses one favicon; selected the light variant when available.")),W(n.logo)&&(n.logo.light??=n.logo.dark,n.logo.dark??=n.logo.light);function o(p,y="navigation"){if(Array.isArray(p))return p.map((g,v)=>o(g,`${y}[${v}]`));if(!W(p))return p;let m={...p};if(Array.isArray(m.dropdowns)&&!m.products&&!m.tabs&&(m.tabs=m.dropdowns.map(({dropdown:g,...v})=>({tab:g,...v})),delete m.dropdowns,r("navigation-dropdowns","warning",y,"Dropdowns converted to tabs. Check navigation layout and URLs.")),m.global){for(let g of["anchors","tabs"])Array.isArray(m.global[g])&&(m[g]=[...m[g]||[],...m.global[g]]);r("navigation-global","warning",`${y}.global`,"Global anchors/tabs merged into this container. Review switcher visibility; other global entries remain in the original config."),delete m.global}W(m.icon)&&typeof m.icon.name=="string"&&(m.icon=m.icon.name,r("icon-library","warning",`${y}.icon`,"Icon name retained; check its equivalent in Velu\u2019s Lucide icon library.")),W(m.openapi)&&typeof m.openapi.source=="string"&&(r("openapi-options","warning",`${y}.openapi`,"OpenAPI source retained; generation options need review."),m.openapi=m.openapi.source);for(let[g,v]of Object.entries(m))g==="pages"&&Array.isArray(v)?m[g]=v.map((d,h)=>typeof d=="string"?d.replace(/\.(mdx|md)$/i,""):o(d,`${y}.pages[${h}]`)):(W(v)||Array.isArray(v))&&(m[g]=o(v,`${y}.${g}`));return m}n.navigation=o(n.navigation||{}),(n.navigation.products||n.navigation.versions||n.navigation.languages)&&(n.navigation.preservePagePaths=!0),typeof n.description=="string"&&(n.seo={...n.seo,metatags:{description:n.description,...n.seo?.metatags}},delete n.description),n.$schema="https://veludocs.com/velu.schema.json";let i=K.dirname(ro(import.meta.url)),a=[K.resolve(i,"../../schema/velu.schema.json"),K.resolve(i,"../schema/velu.schema.json")].find(p=>Se.existsSync(p));if(!a)throw new Error("Velu config schema is missing from this installation.");let s=JSON.parse(Se.readFileSync(a,"utf8")),l=p=>p.$ref?p.$ref.split("/").slice(1).reduce((y,m)=>y[m],s):p,c=p=>Array.isArray(p)?"array":p===null?"null":typeof p;function u(p,y,m){let g=l(y);if(g.oneOf&&(g=g.oneOf.map(l).find(v=>v.type&&c(p)!==v.type||v.properties?.type?.const&&p?.type!==v.properties.type.const?!1:Array.isArray(v.required)&&v.required.length&&W(p)?v.required.every(d=>Object.prototype.hasOwnProperty.call(p,d)):!0),!g)){r("config-shape","error",m,"Value does not match any supported Velu shape; original retained in source config.");return}if(g.type&&c(p)!==g.type||g.enum&&!g.enum.includes(p)||"const"in g&&p!==g.const){r("config-value","error",m,"Unsupported value or type; original retained in source config.");return}if(typeof p=="string"&&g.minLength&&p.length<g.minLength&&r("config-value","error",m,"Value must not be empty."),W(p)){let v={};for(let[d,h]of Object.entries(p)){let S=m?`${m}.${d}`:d,O=g.properties?.[d]||(W(g.additionalProperties)?g.additionalProperties:null);if(!O&&g.additionalProperties===!1){let x=/(^|\.)(auth|authentication|groups|hidden|public|permissions|personalization)(\.|$)/.test(S);r("unsupported-config",x?"error":"warning",S,x?"Access or visibility rules require manual migration before publishing.":"No equivalent in the Velu schema; original setting preserved in source config.");continue}let A=O?u(h,O,S):h;A!==void 0&&Object.defineProperty(v,d,{value:A,enumerable:!0,writable:!0,configurable:!0})}for(let d of g.required||[])d in v||r("required-config","error",m?`${m}.${d}`:d,"Required Velu setting is missing.");return v}return Array.isArray(p)&&g.items?(g.maxItems&&p.length>g.maxItems&&r("config-limit","warning",m,`Velu supports up to ${g.maxItems} entries here; review rendering.`),p.map((v,d)=>u(v,g.items,`${m}[${d}]`)).filter(v=>v!==void 0)):p}return u(n,s,"")}var W,gt,Ge=_(()=>{W=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),gt=e=>e.split(K.sep).join("/")});var te,We=_(()=>{te=["Callout","Card","CardGroup","Accordion","AccordionGroup","Columns","Field","Prompt","Steps","Step","Tree","Folder","File","Update","Icon","Image","CodeBlock","CodeGroup","MethodBadge","ApiPath","TryItBar","ApiField","ApiClient","ApiSidebar"]});import q from"node:path";import{createProcessor as lo,compile as co}from"@mdx-js/mdx";import pn from"remark-frontmatter";import uo from"remark-mdx-frontmatter";import fn from"remark-gfm";import{visit as mn}from"unist-util-visit";import po from"js-yaml";import{parse as fo}from"@babel/parser";import mo from"postcss";async function dn(e,t,r,n,{endpointConverted:o=!1}={}){let i=lo({remarkPlugins:[pn,fn]}),a;try{a=i.parse(e)}catch(d){return n("mdx-syntax","error",t,d.reason||d.message,d.line),{text:e,adapters:[]}}let s=new Set,l=[],c=[],u=new Set,p=new Set,y=new Set,m=(d,h,S)=>c.push({start:d,end:h,value:S});mn(a,"mdxjsEsm",d=>{for(let h of d.data?.estree?.body||[]){if(h.type==="ImportDeclaration"){for(let O of h.specifiers)s.add(O.local.name);l.push({node:d,stmt:h})}let S=h.declaration;S?.id?.name&&s.add(S.id.name);for(let O of S?.declarations||[])O.id?.name&&s.add(O.id.name)}});let g=(d,h=!1)=>{if(typeof d!="string"||/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(d)||h&&!d.startsWith(".")&&!d.startsWith("/"))return d;let[,S,O]=/^([^?#]*)(.*)$/.exec(d),A=q.posix.normalize(S.startsWith("/")?S.slice(1):q.posix.join(q.posix.dirname(t),S)),x=r.get(A);if(!x)return h&&n("missing-import","error",t,`Local import cannot be resolved in migrated files: ${d}`),d;if(h){let w=q.posix.relative(q.posix.dirname(r.get(t)||t),x);return(w.startsWith(".")?w:"./"+w)+O}return/\.(md|mdx)$/i.test(x)||p.add(x),/\.mdx$/i.test(x)&&/\.(md|mdx)$/i.test(S)?S.replace(/\.(md|mdx)$/i,"")+O:d};for(let{stmt:d}of l){let h=d.source.value;/^(?:@mintlify\/|next(?:\/|$))/.test(h)&&n("runtime-import","error",t,`Replace the runtime dependency ${h} with a Velu/React equivalent.`);let S=g(h,!0);S!==h&&m(d.source.start,d.source.end,JSON.stringify(S))}mn(a,d=>{if(d.type==="yaml")try{let w=po.load(d.value)||{};for(let L of Object.keys(w))if(["auth","groups","public","hidden"].includes(L))n("page-access","error",t,`Frontmatter ${L} requires manual visibility/access migration.`,d.position.start.line);else{if(L==="openapi"&&o)continue;["api","openapi","asyncapi"].includes(L)?n("endpoint-frontmatter","error",t,`Frontmatter ${L} is preserved but does not generate an endpoint in Velu. Wire the spec into navigation.openapi and review endpoint routes.`,d.position.start.line):["title","description","icon","sidebarTitle","mode","keywords","og:title","og:description","og:image"].includes(L)||n("frontmatter-review","warning",t,`Frontmatter ${L} is preserved; verify its behavior in Velu.`,d.position.start.line)}}catch(w){n("frontmatter-syntax","error",t,w.message,d.position.start.line)}if(["link","image","definition"].includes(d.type)&&d.url){let w=g(d.url);if(w!==d.url){let L=d.position.start.offset,B=e.slice(L,d.position.end.offset).lastIndexOf(d.url);B>=0&&m(L+B,L+B+d.url.length,w)}}if(!["mdxJsxFlowElement","mdxJsxTextElement"].includes(d.type)||!d.name)return;let h=d.name,S=d.position.start.line;if(s.has(h.split(".")[0]))return;y.add(h);let O=yt[h]?"Callout":["ParamField","ResponseField"].includes(h)?"Field":h==="Expandable"?"Accordion":h;if(O!==h&&s.has(O)){n("component-name-conflict","error",t,`Cannot convert <${h}> to <${O}> because that name is already locally defined. Rename the local binding before migration.`,S);return}let A=d.attributes.filter(w=>w.type==="mdxJsxAttribute"),x=(w,L)=>{let P=A.find(B=>B.name===w);P&&!A.some(B=>B.name===L)&&m(P.position.start.offset,P.position.start.offset+w.length,L)};if(h==="ParamField")for(let w of["body","query","path","header","cookie"])x(w,"name");if(h==="CardGroup"&&x("cols","limit"),h==="Accordion"&&x("default-open","defaultOpen"),h==="Expandable"&&(x("title","title"),A.some(w=>w.name==="title")||m(d.position.start.offset+1+h.length,d.position.start.offset+1+h.length,' title="Details"')),O!==h){let w=d.position.start.offset;m(w+1,w+1+h.length,O+(yt[h]?` type="${yt[h]}"`:""));let L=d.position.end.offset,P=new RegExp(`</${h}\\s*>$`).exec(e.slice(w,L));P&&m(L-P[0].length+2,L-P[0].length+2+h.length,O)}go.has(h)?(u.add(h),n("component-adapter","warning",t,`<${h}> uses an editable React adapter. Review visual styling and optional props.`,S)):/^[A-Z]/.test(O)&&!ho.has(O)&&n("unsupported-component","error",t,`<${h}> needs a local component implementation or import.`,S);for(let w of A)if(["href","src"].includes(w.name)&&typeof w.value=="string"){let L=g(w.value);if(L!==w.value){let P=w.position.start.offset,ee=e.slice(P,w.position.end.offset).indexOf(w.value);ee>=0&&m(P+ee,P+ee+w.value.length,L)}}}),c.sort((d,h)=>h.start-d.start||h.end-d.end);let v=e;for(let d of c)v=v.slice(0,d.start)+d.value+v.slice(d.end);if(u.size){let d=q.posix.relative(q.posix.dirname(r.get(t)||t),ge);v+=`
4
4
 
5
5
  import { ${[...u].sort().join(", ")} } from ${JSON.stringify(d.startsWith(".")?d:"./"+d)};
6
- `}try{await ao(v,{remarkPlugins:[un,lo,pn]})}catch(d){n("mdx-compile","error",t,d.reason||d.message,d.line)}return{text:v,adapters:[...u],components:[...y].sort(),assets:[...p]}}function dn(e,t,r){let n=[[/\b(?:window|globalThis)\s*(?:\?\.)?\s*\.?(?:mintlify|\[\s*['"]mintlify['"]\s*\])|mintlify:user/,"mintlify-browser-api","error","Mintlify browser APIs/events need a Velu implementation; script preserved without inventing an API mapping."],[/__NEXT_DATA__|next\/router|next\/navigation|routeChangeComplete|next-route-announcer/,"next-runtime","error","Script depends on Next.js internals; adapt it to Velu\u2019s React Router runtime."],[/DOMContentLoaded|\bwindow\.onload\b|addEventListener\(\s*['"]load['"]/,"script-lifecycle","warning","Script loads after hydration; use document.readyState or an immediate initializer when DOMContentLoaded/load has already fired."],[/\brequire\s*\(|\bmodule\.exports|\bprocess\.env|from\s*['"]node:/,"node-script","error","This .js file is auto-loaded in the browser but contains Node.js constructs. Move tooling outside the docs content root or use .cjs/.mjs."],[/(?:^|\n)\s*(?:import\s|export\s)/,"module-script","error","Auto-loaded JavaScript uses classic scripts. Bundle ES modules for the browser or move them to explicitly imported .jsx/.mjs modules."],[/document\.querySelector|document\.getElementById|MutationObserver/,"script-dom","warning","Verify DOM hooks and behavior after client-side navigation; scripts execute once per full page load."]];for(let[o,i,a,s]of n){let l=o.exec(e);l&&r(i,a,t,s,e.slice(0,l.index).split(`
7
- `).length)}}function gn(e,t,r){let n=JSON.parse(e),o=!1,i=!1,a=[];for(let[s,l]of Object.entries(n.scripts||{})){if(typeof l!="string"||!/\b(?:mint|mintlify)\b/.test(l))continue;i=!0;let c=/^(?:(?:npx(?: --no-install)?|yarn|pnpm(?: exec)?|bunx)\s+)?(?:mint|mintlify)\s+(dev|validate|version|v|update)\s*$/.exec(l.trim());if(c){let u=`velu ${c[1]==="v"?"version":c[1]}`;n.scripts[s]=u,o=!0,a.push({name:s,action:"converted",from:l,to:u})}else a.push({name:s,action:"preserved",from:l}),r("npm-script","warning",`package.json:scripts.${s}`,"Mintlify command/flags or compound shell script has no verified equivalent. Original retained; update manually.")}for(let s of["dependencies","devDependencies","optionalDependencies"])Object.keys(n[s]||{}).some(l=>["mint","mintlify","@mintlify/cli"].includes(l))&&(i=!0);return i&&!n.dependencies?.["@veluai/velu"]&&!n.devDependencies?.["@veluai/velu"]&&(n.devDependencies={...n.devDependencies,"@veluai/velu":`^${t}`},o=!0),i&&r("package-install","warning","package.json","Run your package manager in the migrated directory to refresh its lockfile. Mintlify dependencies remain for scripts that still need them; remove them after review."),{text:o?JSON.stringify(n,null,2)+`
8
- `:e,scripts:a}}function hn(e,t,r,n){let o;try{o=uo(e,{sourceType:"unambiguous",plugins:["jsx",.../\.[cm]?tsx?$/.test(t)?["typescript"]:[]]})}catch(l){return n("module-syntax","error",t,l.message,l.loc?.line),e}let i=[],a=new Set,s=l=>{if(!l||typeof l!="object")return;let c=["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(l.type)?l.source:l.type==="CallExpression"&&(l.callee?.type==="Import"||l.callee?.name==="require")?l.arguments?.[0]:null;if(c?.type==="StringLiteral"&&!a.has(c.start)){a.add(c.start);let u=c.value;if(u.startsWith(".")||u.startsWith("/")){let p=q.posix.normalize(u.startsWith("/")?u.slice(1):q.posix.join(q.posix.dirname(t),u)),y=r.get(p);if(y){let m=q.posix.relative(q.posix.dirname(r.get(t)||t),y),g=m.startsWith(".")?m:"./"+m;u!==g&&i.push({start:c.start,end:c.end,value:JSON.stringify(g)})}else n("missing-import","error",t,`Local module import missing or ignored: ${u}`,c.loc?.start.line)}}for(let[u,p]of Object.entries(l))["loc","comments","tokens","extra"].includes(u)||(Array.isArray(p)?p.forEach(s):p&&typeof p=="object"&&s(p))};s(o.program);for(let l of i.sort((c,u)=>u.start-c.start))e=e.slice(0,l.start)+l.value+e.slice(l.end);return e}function yn(e,t,r,n){let o;try{o=po.parse(e,{from:t})}catch(s){return n("css-syntax","error",t,s.reason||s.message,s.line),e}let i=new Set,a;return o.walkRules(s=>{for(let l of s.selector.matchAll(/#(?:content|navbar|sidebar(?:-content)?|navigation-items|page-title|header|footer|table-of-contents)(?![\w-])/g))i.add(l[0]),a??=s.source?.start?.line}),i.size&&n("css-dom","warning",t,`Styles target renderer structure (${[...i].join(", ")}). Selectors are preserved, but matching elements and their nesting can differ in Velu; compare page headers, sidebars, API pages, and mobile layouts in the browser.`,a),o.walkDecls(s=>{s.value=s.value.replace(/url\(\s*(?:"([^"\\]*)"|'([^'\\]*)'|([^)'"\\\s]*))\s*\)/gi,(l,c,u,p)=>{let y=c??u??p;if(!y||/^(?:[a-z][a-z0-9+.-]*:|\/|#)/i.test(y))return l;let m=/^([^?#]*)(.*)$/.exec(y),g=q.posix.normalize(q.posix.join(q.posix.dirname(t),m[1]));return r.has(g)?`url("${"/"+r.get(g).split("/").map(encodeURIComponent).join("/")+m[2]}")`:(n("css-missing-asset","error",t,`CSS asset missing or ignored: ${y}`,s.source?.start?.line),l)})}),o.walkAtRules("import",s=>n("css-import","warning",t,"Custom CSS files are included globally. Check @import for duplicate styles and loading order.",s.source?.start?.line)),o.toString()}var ge,ht,fo,mo,yt,vn=_(()=>{qe();Je();ge="snippets/velu-mintlify-compat.jsx",ht={Note:"note",Tip:"tip",Warning:"warning",Info:"info",Check:"check",Danger:"danger"},fo=new Set(["Tabs","Tab","Frame","Tooltip","Badge","Button","Panel"]),mo=new Set(te),yt=`import React from 'react';
6
+ `}try{await co(v,{remarkPlugins:[pn,uo,fn]})}catch(d){n("mdx-compile","error",t,d.reason||d.message,d.line)}return{text:v,adapters:[...u],components:[...y].sort(),assets:[...p]}}function gn(e,t,r){let n=[[/\b(?:window|globalThis)\s*(?:\?\.)?\s*\.?(?:mintlify|\[\s*['"]mintlify['"]\s*\])|mintlify:user/,"mintlify-browser-api","error","Mintlify browser APIs/events need a Velu implementation; script preserved without inventing an API mapping."],[/__NEXT_DATA__|next\/router|next\/navigation|routeChangeComplete|next-route-announcer/,"next-runtime","error","Script depends on Next.js internals; adapt it to Velu\u2019s React Router runtime."],[/DOMContentLoaded|\bwindow\.onload\b|addEventListener\(\s*['"]load['"]/,"script-lifecycle","warning","Script loads after hydration; use document.readyState or an immediate initializer when DOMContentLoaded/load has already fired."],[/\brequire\s*\(|\bmodule\.exports|\bprocess\.env|from\s*['"]node:/,"node-script","error","This .js file is auto-loaded in the browser but contains Node.js constructs. Move tooling outside the docs content root or use .cjs/.mjs."],[/(?:^|\n)\s*(?:import\s|export\s)/,"module-script","error","Auto-loaded JavaScript uses classic scripts. Bundle ES modules for the browser or move them to explicitly imported .jsx/.mjs modules."],[/document\.querySelector|document\.getElementById|MutationObserver/,"script-dom","warning","Verify DOM hooks and behavior after client-side navigation; scripts execute once per full page load."]];for(let[o,i,a,s]of n){let l=o.exec(e);l&&r(i,a,t,s,e.slice(0,l.index).split(`
7
+ `).length)}}function hn(e,t,r){let n=JSON.parse(e),o=!1,i=!1,a=[];for(let[s,l]of Object.entries(n.scripts||{})){if(typeof l!="string"||!/\b(?:mint|mintlify)\b/.test(l))continue;i=!0;let c=/^(?:(?:npx(?: --no-install)?|yarn|pnpm(?: exec)?|bunx)\s+)?(?:mint|mintlify)\s+(dev|validate|version|v|update)\s*$/.exec(l.trim());if(c){let u=`velu ${c[1]==="v"?"version":c[1]}`;n.scripts[s]=u,o=!0,a.push({name:s,action:"converted",from:l,to:u})}else a.push({name:s,action:"preserved",from:l}),r("npm-script","warning",`package.json:scripts.${s}`,"Mintlify command/flags or compound shell script has no verified equivalent. Original retained; update manually.")}for(let s of["dependencies","devDependencies","optionalDependencies"])Object.keys(n[s]||{}).some(l=>["mint","mintlify","@mintlify/cli"].includes(l))&&(i=!0);return i&&!n.dependencies?.["@veluai/velu"]&&!n.devDependencies?.["@veluai/velu"]&&(n.devDependencies={...n.devDependencies,"@veluai/velu":`^${t}`},o=!0),i&&r("package-install","warning","package.json","Run your package manager in the migrated directory to refresh its lockfile. Mintlify dependencies remain for scripts that still need them; remove them after review."),{text:o?JSON.stringify(n,null,2)+`
8
+ `:e,scripts:a}}function yn(e,t,r,n){let o;try{o=fo(e,{sourceType:"unambiguous",plugins:["jsx",.../\.[cm]?tsx?$/.test(t)?["typescript"]:[]]})}catch(l){return n("module-syntax","error",t,l.message,l.loc?.line),e}let i=[],a=new Set,s=l=>{if(!l||typeof l!="object")return;let c=["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(l.type)?l.source:l.type==="CallExpression"&&(l.callee?.type==="Import"||l.callee?.name==="require")?l.arguments?.[0]:null;if(c?.type==="StringLiteral"&&!a.has(c.start)){a.add(c.start);let u=c.value;if(u.startsWith(".")||u.startsWith("/")){let p=q.posix.normalize(u.startsWith("/")?u.slice(1):q.posix.join(q.posix.dirname(t),u)),y=r.get(p);if(y){let m=q.posix.relative(q.posix.dirname(r.get(t)||t),y),g=m.startsWith(".")?m:"./"+m;u!==g&&i.push({start:c.start,end:c.end,value:JSON.stringify(g)})}else n("missing-import","error",t,`Local module import missing or ignored: ${u}`,c.loc?.start.line)}}for(let[u,p]of Object.entries(l))["loc","comments","tokens","extra"].includes(u)||(Array.isArray(p)?p.forEach(s):p&&typeof p=="object"&&s(p))};s(o.program);for(let l of i.sort((c,u)=>u.start-c.start))e=e.slice(0,l.start)+l.value+e.slice(l.end);return e}function vn(e,t,r,n){let o;try{o=mo.parse(e,{from:t})}catch(s){return n("css-syntax","error",t,s.reason||s.message,s.line),e}let i=new Set,a;return o.walkRules(s=>{for(let l of s.selector.matchAll(/#(?:content|navbar|sidebar(?:-content)?|navigation-items|page-title|header|footer|table-of-contents)(?![\w-])/g))i.add(l[0]),a??=s.source?.start?.line}),i.size&&n("css-dom","warning",t,`Styles target renderer structure (${[...i].join(", ")}). Selectors are preserved, but matching elements and their nesting can differ in Velu; compare page headers, sidebars, API pages, and mobile layouts in the browser.`,a),o.walkDecls(s=>{s.value=s.value.replace(/url\(\s*(?:"([^"\\]*)"|'([^'\\]*)'|([^)'"\\\s]*))\s*\)/gi,(l,c,u,p)=>{let y=c??u??p;if(!y||/^(?:[a-z][a-z0-9+.-]*:|\/|#)/i.test(y))return l;let m=/^([^?#]*)(.*)$/.exec(y),g=q.posix.normalize(q.posix.join(q.posix.dirname(t),m[1]));return r.has(g)?`url("${"/"+r.get(g).split("/").map(encodeURIComponent).join("/")+m[2]}")`:(n("css-missing-asset","error",t,`CSS asset missing or ignored: ${y}`,s.source?.start?.line),l)})}),o.walkAtRules("import",s=>n("css-import","warning",t,"Custom CSS files are included globally. Check @import for duplicate styles and loading order.",s.source?.start?.line)),o.toString()}var ge,yt,go,ho,vt,bn=_(()=>{We();Ge();ge="snippets/velu-mintlify-compat.jsx",yt={Note:"note",Tip:"tip",Warning:"warning",Info:"info",Check:"check",Danger:"danger"},go=new Set(["Tabs","Tab","Frame","Tooltip","Badge","Button","Panel"]),ho=new Set(te),vt=`import React from 'react';
9
9
  export function Tabs({ children, defaultIndex = 0 }) {
10
10
  const tabs = React.Children.toArray(children).filter(React.isValidElement);
11
11
  const [active, setActive] = React.useState(defaultIndex);
@@ -30,27 +30,27 @@ export function Tooltip({children,tip}) { return <span title={typeof tip === 'st
30
30
  export function Badge({children,color,className=''}) { return <span data-component="badge" className={className} style={{border:'1px solid currentColor',borderRadius:'1rem',padding:'.1rem .5rem',color}}>{children}</span>; }
31
31
  export function Button({children,href,variant,size,icon,iconType,...props}) { return href ? <a href={href} {...props}>{children}</a> : <button type="button" {...props}>{children}</button>; }
32
32
  export function Panel({children}) { return <aside data-component="panel">{children}</aside>; }
33
- `});import go from"github-slugger";import ho from"iso-639-1";function vo(e){let t=String(e).toLowerCase();return ho.getNativeName(t)||e}function Ge(e){return new go().slug(String(e??""))}function bn(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function vt(e){let t=String(e).split("#")[0].split("?")[0];try{t=decodeURI(t)}catch{}return t.startsWith("/")||(t="/"+t),t.length>1&&(t=t.replace(/\/+$/,"")),t||"/"}function X(e){let t={kind:"root",children:ke(e??{})};return e?.preservePagePaths===!0&&(t.preservePagePaths=!0),$n(t.children),t}function ke(e){let t=Array.isArray(e.anchors)?e.anchors.map(So):[];if(Array.isArray(e.products))return[...t,...e.products.map(bo)];if(Array.isArray(e.versions))return[...t,...e.versions.map(xo)];if(Array.isArray(e.languages))return[...t,...e.languages.map(wo)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map($o)];let r=[...t];return Array.isArray(e.groups)&&r.push(...e.groups.map(xn)),Array.isArray(e.pages)&&r.push(...e.pages.map(wn)),r}function bo(e){return{kind:"product",label:e.name??e.product,slug:Ge(e.product),icon:e.icon,color:e.color,default:!!e.default,children:ke(e)}}function xo(e){return{kind:"version",label:e.version,slug:Ge(e.version),default:!!e.default,children:ke(e)}}function wo(e){let t=String(e.language);return{kind:"language",code:t,label:vo(t),slug:Ge(t),default:!!e.default,children:ke(e)}}function $o(e){return{kind:"tab",label:e.tab,slug:Ge(e.tab),icon:e.icon,href:e.href,children:ke(e)}}function So(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function xn(e){let t=(e.pages??[]).map(wn);return e.root&&t.unshift({kind:"page",pagePath:e.root}),{kind:"group",label:e.group,icon:e.icon,expanded:!!e.expanded,root:e.root,children:t}}function wn(e){if(typeof e=="string")return{kind:"page",pagePath:e};if(e&&e.apiPage)return{kind:"page",pagePath:e.apiPage,label:e.label,method:e.method,api:!0};if(e&&typeof e.page=="string"){let t={kind:"page",pagePath:e.page};return e.icon&&(t.icon=e.icon),(e.title||e.label)&&(t.label=e.title??e.label),t}return xn(e)}function $n(e){for(let t of yo){let r=e.filter(n=>n.kind===t);r.length&&!r.some(n=>n.default)&&(r[0].default=!0)}for(let t of e)t.children&&$n(t.children)}function ne(e){let t=[],r=(n,o,i)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:ko(n.pagePath,o),ctx:{...o},ancestors:i,node:n});return}let a=o;n.kind==="product"?a={...o,product:n.default?null:n.slug}:n.kind==="version"?a={...o,version:n.default?null:n.slug}:n.kind==="language"&&(a={...o,language:n.default?null:n.slug});let s=n.kind==="root"?i:[...i,n];for(let l of n.children??[])r(l,a,s)};return r(e,{product:null,version:null,language:null,...e.preservePagePaths?{preservePagePaths:!0}:{}},[]),t}function ko(e,t){if(t.preservePagePaths)return bn(e);let r=[t.product,t.version,t.language].filter(Boolean),n=bn(e).split("/").filter(Boolean);return"/"+[...r,...n].join("/")}var yo,re=_(()=>{yo=["product","version","language"]});function jo(e,t){let r=t.slice(2).split("/").filter(o=>o!=="").map(o=>decodeURIComponent(o).replace(/~1/g,"/").replace(/~0/g,"~")),n=e;for(let o of r){if(n==null||typeof n!="object")return;n=n[o]}return n}function Sn(e){let t=new Map;function r(n){if(n==null||typeof n!="object")return n;if(t.has(n))return t.get(n);if(typeof n.$ref=="string"){let i=n.$ref;if(!i.startsWith("#/"))throw new Error(`external $ref "${i}" is not supported in the instant preview \u2014 inline it or use a single-file spec`);let a=jo(e,i);if(a===void 0)throw new Error(`$ref "${i}" does not resolve`);let s=r(a);return t.set(n,s),s}let o=Array.isArray(n)?[]:{};t.set(n,o);for(let[i,a]of Object.entries(n))o[i]=r(a);return o}return r(e)}var kn=_(()=>{});function ce(e){return!e||typeof e!="object"?e||{}:Array.isArray(e.allOf)?e.allOf.reduce((t,r)=>{let n=ce(r);return{...t,...n,properties:{...t.properties||{},...n.properties||{}},required:[...t.required||[],...n.required||[]]}},{...e,allOf:void 0}):Array.isArray(e.oneOf)&&e.oneOf.length?ce(e.oneOf[0]):Array.isArray(e.anyOf)&&e.anyOf.length?ce(e.anyOf[0]):e}function je(e){let t=ce(e);if(!t||typeof t!="object")return"any";if(Array.isArray(t.enum)&&t.enum.length)return`enum<${typeof t.enum[0]}>`;if(t.type==="array")return`${je(t.items||{})}[]`;let r=t.type||(t.properties?"object":"any");return t.format?`${r}<${t.format}>`:r}function he(e,t=0){let r=ce(e);if(!r||typeof r!="object")return null;if(r.example!==void 0)return r.example;if(r.default!==void 0)return r.default;if(Array.isArray(r.enum)&&r.enum.length)return r.enum[0];if(t>=6)return r.type==="object"?{}:null;switch(r.type){case"object":{let n={};for(let[o,i]of Object.entries(r.properties||{}))n[o]=he(i,t+1);return n}case"array":return[he(r.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Oo(r)}}function Oo(e){switch(e.format){case"date-time":return"2024-01-01T00:00:00Z";case"date":return"2024-01-01";case"email":return"user@example.com";case"uuid":return"3fa85f64-5717-4562-b3fc-2c963f66afa6";case"uri":case"url":return"https://example.com";default:return"<string>"}}function bt(e){let t=ce(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:je(t),required:!1,description:t.description||""}]:[];let r=new Set(t.required||[]);return Object.entries(t.properties).map(([n,o])=>{let i=ce(o);return{name:n,type:je(i),required:r.has(n),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,deprecated:i.deprecated||void 0}})}function To(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:je(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:he(t),deprecated:e.deprecated||void 0}}function An(e){if(!e||typeof e!="object")return null;let t=Object.keys(e),r=t.find(n=>/json/i.test(n))||t[0];return r?{contentType:r,media:e[r]}:null}function Eo(e){if(!e)return null;let t=An(e.content);if(!t)return null;let r=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:bt(r),example:t.media.example??he(r)}}function Co(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,r])=>{let n=An(r?.content),o=n?.media?.schema||{};return{status:t,description:r?.description||"",contentType:n?.contentType||null,fields:n?bt(o):[],example:n?n.media.example??he(o):null}})}function Po(e,t){if(!Array.isArray(e)||!t)return[];let r=[],n=new Set;for(let o of e)for(let i of Object.keys(o||{})){let a=t[i];!a||n.has(i)||(n.add(i),r.push(Lo(i,a)))}return r.filter(Boolean)}function Lo(e,t){return t.type==="http"&&/bearer/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"Bearer authentication token."}:t.type==="http"&&/basic/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Basic",description:t.description||"Basic authentication credentials."}:t.type==="apiKey"?{name:t.name||e,in:t.in||"header",required:!0,type:"string",description:t.description||"API key."}:t.type==="oauth2"||t.type==="openIdConnect"?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"OAuth 2.0 access token."}:{name:e,in:"header",required:!0,type:"string",description:t.description||""}}function jn(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function _o(e){let{method:t,path:r,op:n,sharedParams:o,servers:i,schemes:a}=e,s=[...o||[],...n.parameters||[]],l={path:[],query:[],header:[],cookie:[]};for(let u of s)u&&l[u.in]&&l[u.in].push(To(u));let c=n.security??e.globalSecurity;return{id:n.operationId?jn(n.operationId):`${t}-${jn(r)}`,method:t.toUpperCase(),path:r,title:n.summary||n.operationId||`${t.toUpperCase()} ${r}`,description:n.description||n.summary||"",tags:Array.isArray(n.tags)&&n.tags.length?n.tags:["API"],deprecated:n.deprecated||!1,auth:Po(c,a),parameters:l,body:Eo(n.requestBody),responses:Co(n.responses),servers:(i||[]).map(u=>u.url).filter(Boolean)}}function Ro(e,t,r,n,o,i,a){let s={};e.openapi?s.openapi=e.openapi:e.swagger?s.swagger=e.swagger:s.openapi="3.0.0",s.info=e.info||{title:"API Reference",version:"1.0.0"};let l=(n.servers||i||[]).filter(Boolean);l.length&&(s.servers=l);let c={};Array.isArray(o)&&o.length&&(c.parameters=o),c[r]=n,s.paths={[t]:c};let u=n.security??e.security;if(a&&Array.isArray(u)&&u.length){let p={};for(let y of u)for(let m of Object.keys(y||{}))a[m]&&(p[m]=a[m]);Object.keys(p).length&&(e.swagger?s.securityDefinitions=p:s.components={securitySchemes:p})}return s}function On(e){let t=[],r=[],n=e.components?.securitySchemes||e.securityDefinitions||{},o=e.security||[],i=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]);for(let[a,s]of Object.entries(e.paths||{})){if(!s||typeof s!="object")continue;let l=s.parameters||[],c=s.servers||i;for(let u of Ao){let p=s[u];!p||typeof p!="object"||(t.push(_o({method:u,path:a,op:p,sharedParams:l,servers:p.servers||c,globalSecurity:o,schemes:n})),r.push(Ro(e,a,u,p,l,p.servers||c,n)))}}return{operations:t,segments:r}}function Ae(e){let t=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]),{operations:r,segments:n}=On(e);return{title:e.info?.title||"API Reference",version:e.info?.version||"",servers:t.map(o=>o.url).filter(Boolean),operations:r,segments:n}}var Ao,We=_(()=>{Ao=["get","post","put","patch","delete","options","head","trace"]});function Uo(e,{server:t}={}){let n=`${(t||e.servers?.[0]||"").replace(/\/+$/,"")}${e.path}`,o={};for(let a of e.auth||[])a.in==="header"&&(o[a.name]=a.prefix?`${a.prefix} <token>`:"<token>");for(let a of e.parameters?.header||[])o[a.name]||(o[a.name]=String(a.example??`<${a.type}>`));let i=!!e.body;return i&&(o["Content-Type"]=e.body.contentType||"application/json"),{method:e.method,url:n,headers:o,body:i?e.body.example??{}:null}}function Fo(e){let t=`curl --request ${e.method} \\
33
+ `});import yo from"github-slugger";import vo from"iso-639-1";function xo(e){let t=String(e).toLowerCase();return vo.getNativeName(t)||e}function He(e){return new yo().slug(String(e??""))}function xn(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function bt(e){let t=String(e).split("#")[0].split("?")[0];try{t=decodeURI(t)}catch{}return t.startsWith("/")||(t="/"+t),t.length>1&&(t=t.replace(/\/+$/,"")),t||"/"}function X(e){let t={kind:"root",children:ke(e??{})};return e?.preservePagePaths===!0&&(t.preservePagePaths=!0),Sn(t.children),t}function ke(e){let t=Array.isArray(e.anchors)?e.anchors.map(jo):[];if(Array.isArray(e.products))return[...t,...e.products.map(wo)];if(Array.isArray(e.versions))return[...t,...e.versions.map($o)];if(Array.isArray(e.languages))return[...t,...e.languages.map(So)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(ko)];let r=[...t];return Array.isArray(e.groups)&&r.push(...e.groups.map(wn)),Array.isArray(e.pages)&&r.push(...e.pages.map($n)),r}function wo(e){return{kind:"product",label:e.name??e.product,slug:He(e.product),icon:e.icon,color:e.color,default:!!e.default,children:ke(e)}}function $o(e){return{kind:"version",label:e.version,slug:He(e.version),default:!!e.default,children:ke(e)}}function So(e){let t=String(e.language);return{kind:"language",code:t,label:xo(t),slug:He(t),default:!!e.default,children:ke(e)}}function ko(e){return{kind:"tab",label:e.tab,slug:He(e.tab),icon:e.icon,href:e.href,children:ke(e)}}function jo(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function wn(e){let t=(e.pages??[]).map($n);return e.root&&t.unshift({kind:"page",pagePath:e.root}),{kind:"group",label:e.group,icon:e.icon,expanded:!!e.expanded,root:e.root,children:t}}function $n(e){if(typeof e=="string")return{kind:"page",pagePath:e};if(e&&e.apiPage)return{kind:"page",pagePath:e.apiPage,label:e.label,method:e.method,api:!0};if(e&&typeof e.page=="string"){let t={kind:"page",pagePath:e.page};return e.icon&&(t.icon=e.icon),(e.title||e.label)&&(t.label=e.title??e.label),t}return wn(e)}function Sn(e){for(let t of bo){let r=e.filter(n=>n.kind===t);r.length&&!r.some(n=>n.default)&&(r[0].default=!0)}for(let t of e)t.children&&Sn(t.children)}function ne(e){let t=[],r=(n,o,i)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:Ao(n.pagePath,o),ctx:{...o},ancestors:i,node:n});return}let a=o;n.kind==="product"?a={...o,product:n.default?null:n.slug}:n.kind==="version"?a={...o,version:n.default?null:n.slug}:n.kind==="language"&&(a={...o,language:n.default?null:n.slug});let s=n.kind==="root"?i:[...i,n];for(let l of n.children??[])r(l,a,s)};return r(e,{product:null,version:null,language:null,...e.preservePagePaths?{preservePagePaths:!0}:{}},[]),t}function Ao(e,t){if(t.preservePagePaths)return xn(e);let r=[t.product,t.version,t.language].filter(Boolean),n=xn(e).split("/").filter(Boolean);return"/"+[...r,...n].join("/")}var bo,re=_(()=>{bo=["product","version","language"]});function Oo(e,t){let r=t.slice(2).split("/").filter(o=>o!=="").map(o=>decodeURIComponent(o).replace(/~1/g,"/").replace(/~0/g,"~")),n=e;for(let o of r){if(n==null||typeof n!="object")return;n=n[o]}return n}function kn(e){let t=new Map;function r(n){if(n==null||typeof n!="object")return n;if(t.has(n))return t.get(n);if(typeof n.$ref=="string"){let i=n.$ref;if(!i.startsWith("#/"))throw new Error(`external $ref "${i}" is not supported in the instant preview \u2014 inline it or use a single-file spec`);let a=Oo(e,i);if(a===void 0)throw new Error(`$ref "${i}" does not resolve`);let s=r(a);return t.set(n,s),s}let o=Array.isArray(n)?[]:{};t.set(n,o);for(let[i,a]of Object.entries(n))o[i]=r(a);return o}return r(e)}var jn=_(()=>{});function ce(e){return!e||typeof e!="object"?e||{}:Array.isArray(e.allOf)?e.allOf.reduce((t,r)=>{let n=ce(r);return{...t,...n,properties:{...t.properties||{},...n.properties||{}},required:[...t.required||[],...n.required||[]]}},{...e,allOf:void 0}):Array.isArray(e.oneOf)&&e.oneOf.length?ce(e.oneOf[0]):Array.isArray(e.anyOf)&&e.anyOf.length?ce(e.anyOf[0]):e}function je(e){let t=ce(e);if(!t||typeof t!="object")return"any";if(Array.isArray(t.enum)&&t.enum.length)return`enum<${typeof t.enum[0]}>`;if(t.type==="array")return`${je(t.items||{})}[]`;let r=t.type||(t.properties?"object":"any");return t.format?`${r}<${t.format}>`:r}function he(e,t=0){let r=ce(e);if(!r||typeof r!="object")return null;if(r.example!==void 0)return r.example;if(r.default!==void 0)return r.default;if(Array.isArray(r.enum)&&r.enum.length)return r.enum[0];if(t>=6)return r.type==="object"?{}:null;switch(r.type){case"object":{let n={};for(let[o,i]of Object.entries(r.properties||{}))n[o]=he(i,t+1);return n}case"array":return[he(r.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Eo(r)}}function Eo(e){switch(e.format){case"date-time":return"2024-01-01T00:00:00Z";case"date":return"2024-01-01";case"email":return"user@example.com";case"uuid":return"3fa85f64-5717-4562-b3fc-2c963f66afa6";case"uri":case"url":return"https://example.com";default:return"<string>"}}function xt(e){let t=ce(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:je(t),required:!1,description:t.description||""}]:[];let r=new Set(t.required||[]);return Object.entries(t.properties).map(([n,o])=>{let i=ce(o);return{name:n,type:je(i),required:r.has(n),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,deprecated:i.deprecated||void 0}})}function Co(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:je(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:he(t),deprecated:e.deprecated||void 0}}function On(e){if(!e||typeof e!="object")return null;let t=Object.keys(e),r=t.find(n=>/json/i.test(n))||t[0];return r?{contentType:r,media:e[r]}:null}function Lo(e){if(!e)return null;let t=On(e.content);if(!t)return null;let r=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:xt(r),example:t.media.example??he(r)}}function Po(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,r])=>{let n=On(r?.content),o=n?.media?.schema||{};return{status:t,description:r?.description||"",contentType:n?.contentType||null,fields:n?xt(o):[],example:n?n.media.example??he(o):null}})}function _o(e,t){if(!Array.isArray(e)||!t)return[];let r=[],n=new Set;for(let o of e)for(let i of Object.keys(o||{})){let a=t[i];!a||n.has(i)||(n.add(i),r.push(Ro(i,a)))}return r.filter(Boolean)}function Ro(e,t){return t.type==="http"&&/bearer/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"Bearer authentication token."}:t.type==="http"&&/basic/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Basic",description:t.description||"Basic authentication credentials."}:t.type==="apiKey"?{name:t.name||e,in:t.in||"header",required:!0,type:"string",description:t.description||"API key."}:t.type==="oauth2"||t.type==="openIdConnect"?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"OAuth 2.0 access token."}:{name:e,in:"header",required:!0,type:"string",description:t.description||""}}function An(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Uo(e){let{method:t,path:r,op:n,sharedParams:o,servers:i,schemes:a}=e,s=[...o||[],...n.parameters||[]],l={path:[],query:[],header:[],cookie:[]};for(let u of s)u&&l[u.in]&&l[u.in].push(Co(u));let c=n.security??e.globalSecurity;return{id:n.operationId?An(n.operationId):`${t}-${An(r)}`,method:t.toUpperCase(),path:r,title:n.summary||n.operationId||`${t.toUpperCase()} ${r}`,description:n.description||n.summary||"",tags:Array.isArray(n.tags)&&n.tags.length?n.tags:["API"],deprecated:n.deprecated||!1,auth:_o(c,a),parameters:l,body:Lo(n.requestBody),responses:Po(n.responses),servers:(i||[]).map(u=>u.url).filter(Boolean)}}function Fo(e,t,r,n,o,i,a){let s={};e.openapi?s.openapi=e.openapi:e.swagger?s.swagger=e.swagger:s.openapi="3.0.0",s.info=e.info||{title:"API Reference",version:"1.0.0"};let l=(n.servers||i||[]).filter(Boolean);l.length&&(s.servers=l);let c={};Array.isArray(o)&&o.length&&(c.parameters=o),c[r]=n,s.paths={[t]:c};let u=n.security??e.security;if(a&&Array.isArray(u)&&u.length){let p={};for(let y of u)for(let m of Object.keys(y||{}))a[m]&&(p[m]=a[m]);Object.keys(p).length&&(e.swagger?s.securityDefinitions=p:s.components={securitySchemes:p})}return s}function Tn(e){let t=[],r=[],n=e.components?.securitySchemes||e.securityDefinitions||{},o=e.security||[],i=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]);for(let[a,s]of Object.entries(e.paths||{})){if(!s||typeof s!="object")continue;let l=s.parameters||[],c=s.servers||i;for(let u of To){let p=s[u];!p||typeof p!="object"||(t.push(Uo({method:u,path:a,op:p,sharedParams:l,servers:p.servers||c,globalSecurity:o,schemes:n})),r.push(Fo(e,a,u,p,l,p.servers||c,n)))}}return{operations:t,segments:r}}function Ae(e){let t=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]),{operations:r,segments:n}=Tn(e);return{title:e.info?.title||"API Reference",version:e.info?.version||"",servers:t.map(o=>o.url).filter(Boolean),operations:r,segments:n}}var To,Ke=_(()=>{To=["get","post","put","patch","delete","options","head","trace"]});function No(e,{server:t}={}){let n=`${(t||e.servers?.[0]||"").replace(/\/+$/,"")}${e.path}`,o={};for(let a of e.auth||[])a.in==="header"&&(o[a.name]=a.prefix?`${a.prefix} <token>`:"<token>");for(let a of e.parameters?.header||[])o[a.name]||(o[a.name]=String(a.example??`<${a.type}>`));let i=!!e.body;return i&&(o["Content-Type"]=e.body.contentType||"application/json"),{method:e.method,url:n,headers:o,body:i?e.body.example??{}:null}}function Io(e){let t=`curl --request ${e.method} \\
34
34
  --url ${e.url}`;for(let[r,n]of Object.entries(e.headers))t+=` \\
35
35
  --header '${r}: ${n}'`;return e.body!=null&&(t+=` \\
36
- --data '${JSON.stringify(e.body)}'`),t}function No(e){let t=[` method: '${e.method}'`];if(Object.keys(e.headers).length){let r=Object.entries(e.headers).map(([n,o])=>` '${n}': '${o}'`).join(`,
36
+ --data '${JSON.stringify(e.body)}'`),t}function Mo(e){let t=[` method: '${e.method}'`];if(Object.keys(e.headers).length){let r=Object.entries(e.headers).map(([n,o])=>` '${n}': '${o}'`).join(`,
37
37
  `);t.push(` headers: {
38
38
  ${r}
39
- }`)}return e.body!=null&&t.push(` body: JSON.stringify(${xt(e.body," ")})`),[`const res = await fetch('${e.url}', {`,t.join(`,
39
+ }`)}return e.body!=null&&t.push(` body: JSON.stringify(${wt(e.body," ")})`),[`const res = await fetch('${e.url}', {`,t.join(`,
40
40
  `),"});","const data = await res.json();"].join(`
41
- `)}function Io(e){let t=["import requests","",`url = "${e.url}"`];if(Object.keys(e.headers).length){let n=Object.entries(e.headers).map(([o,i])=>` "${o}": "${i}"`).join(`,
41
+ `)}function zo(e){let t=["import requests","",`url = "${e.url}"`];if(Object.keys(e.headers).length){let n=Object.entries(e.headers).map(([o,i])=>` "${o}": "${i}"`).join(`,
42
42
  `);t.push(`headers = {
43
43
  ${n}
44
- }`)}let r=["url"];return e.body!=null&&(t.push(`payload = ${xt(e.body,"")}`),r.push("json=payload")),Object.keys(e.headers).length&&r.push("headers=headers"),t.push("",`response = requests.${e.method.toLowerCase()}(${r.join(", ")})`,"print(response.json())"),t.join(`
45
- `)}function Mo(e){let t=e.method.charAt(0)+e.method.slice(1).toLowerCase(),r=["require 'net/http'","require 'json'","",`uri = URI("${e.url}")`,"http = Net::HTTP.new(uri.host, uri.port)","http.use_ssl = true",`request = Net::HTTP::${t}.new(uri)`];for(let[n,o]of Object.entries(e.headers))r.push(`request['${n}'] = '${o}'`);return e.body!=null&&r.push(`request.body = ${xt(e.body,"")}.to_json`),r.push("","response = http.request(request)","puts response.body"),r.join(`
46
- `)}function He(e,{server:t,languages:r=wt}={}){let n=Uo(e,{server:t});return r.filter(o=>Tn[o]).map(o=>({key:o,label:zo[o],language:Vo[o],code:Tn[o](n)}))}var xt,Tn,zo,Vo,wt,$t=_(()=>{xt=(e,t)=>JSON.stringify(e,null,2).split(`
44
+ }`)}let r=["url"];return e.body!=null&&(t.push(`payload = ${wt(e.body,"")}`),r.push("json=payload")),Object.keys(e.headers).length&&r.push("headers=headers"),t.push("",`response = requests.${e.method.toLowerCase()}(${r.join(", ")})`,"print(response.json())"),t.join(`
45
+ `)}function Vo(e){let t=e.method.charAt(0)+e.method.slice(1).toLowerCase(),r=["require 'net/http'","require 'json'","",`uri = URI("${e.url}")`,"http = Net::HTTP.new(uri.host, uri.port)","http.use_ssl = true",`request = Net::HTTP::${t}.new(uri)`];for(let[n,o]of Object.entries(e.headers))r.push(`request['${n}'] = '${o}'`);return e.body!=null&&r.push(`request.body = ${wt(e.body,"")}.to_json`),r.push("","response = http.request(request)","puts response.body"),r.join(`
46
+ `)}function Xe(e,{server:t,languages:r=$t}={}){let n=No(e,{server:t});return r.filter(o=>En[o]).map(o=>({key:o,label:Bo[o],language:Do[o],code:En[o](n)}))}var wt,En,Bo,Do,$t,St=_(()=>{wt=(e,t)=>JSON.stringify(e,null,2).split(`
47
47
  `).map((r,n)=>n===0?r:t+r).join(`
48
- `);Tn={curl:Fo,javascript:No,python:Io,ruby:Mo},zo={curl:"cURL",javascript:"JavaScript",python:"Python",ruby:"Ruby"},Vo={curl:"bash",javascript:"javascript",python:"python",ruby:"ruby"},wt=["curl","javascript","python","ruby"]});function Cn(e){let t=e?.font?.family;return typeof t=="string"&&t.trim()?t.trim():e?.theme==="vepa"||["thulir","aalam","nila"].includes(e?.theme)?"Inter":Do}function Oe(e){return e==="vepa"||["thulir","aalam","nila"].includes(e)?e:"velu"}function kt({light:e,dark:t,family:r,theme:n,primary:o=e,cta:i=o}){let a=n==="vepa"||["thulir","aalam","nila"].includes(n)?Jo(o,t):"";return[":root:root {",` --accent-color: ${e};`,...["thulir","aalam","nila"].includes(n)?[` --thulir-cta-color: ${i};`]:[],` --font-sans: "${r}", sans-serif;`,a,"}",':root:root[data-theme="dark"] {',` --accent-color: ${t};`,"}"].join(`
49
- `)}function Jo(e,t){let r=(s,l)=>{let c=/^#([\da-f]{3}|[\da-f]{6})$/i.exec(s||"")?.[1];return c||(c=l),c.length===3&&(c=[...c].map(u=>u+u).join("")),[0,2,4].map(u=>parseInt(c.slice(u,u+2),16))},n=r(e,"16a34a"),o=r(t,"4ade80"),i={50:250,100:245,200:229,300:212,400:163,500:115,600:82,700:64,800:38,900:23,950:10},a=.95/(.95+.6-.95*.6);return[...Object.entries(i).map(([s,l])=>` --vepa-gray-${s}: rgb(${n.map(c=>Math.round(c*(1-a)+l*a)).join(" ")});`),` --vepa-background-dark: rgb(${o.map((s,l)=>Math.round([9,9,11][l]*.98+s*.02)).join(" ")});`].join(`
50
- `)}function Te(e){if(!e||typeof e!="object")return null;let t=[];if(e.socials&&typeof e.socials=="object")for(let[n,o]of Object.entries(e.socials))typeof o!="string"||!o.trim()||t.push({kind:Bo[n]??n,href:o.trim()});let r=Array.isArray(e.links)?e.links.filter(n=>n&&typeof n=="object").map(n=>({title:(n.header??n.title??"").trim(),items:(Array.isArray(n.items)?n.items:[]).filter(o=>o&&o.label).map(o=>({label:o.label,href:o.href??"#"}))})).filter(n=>n.title||n.items.length):[];return!t.length&&!r.length?null:{socials:t,links:r}}function St(e){return/^(https?:)?\/\//.test(e)||/^(mailto|tel):/.test(e)}function Ee(e){if(!e||typeof e!="object")return null;let t=(Array.isArray(e.links)?e.links:[]).filter(o=>o&&typeof o.href=="string"&&o.href.trim()).map(o=>({label:o.label??"",href:o.href.trim(),icon:o.icon??null,external:St(o.href.trim())})),r=null,n=e.primary;if(n&&typeof n=="object"&&typeof n.href=="string"&&n.href.trim()){let o=n.href.trim();r=n.type==="github"?{kind:"github",label:n.label??"GitHub",href:o,external:St(o)}:{kind:"button",label:n.label??"",href:o,external:St(o)}}return!t.length&&!r?null:{links:t,primary:r}}function jt(e){if(e==null)return{options:[...En],display:"header"};if(typeof e!="object")return{options:[],display:"header"};let t=e.display==="toc"?"toc":"header",r=Array.isArray(e.options)?e.options:En,n=[];for(let o of r)typeof o=="string"?qo.has(o)&&n.push(o):o&&typeof o=="object"&&o.title&&o.href&&n.push({title:String(o.title),description:o.description?String(o.description):"",href:String(o.href),icon:typeof o.icon=="string"?o.icon:void 0});return{options:n,display:t}}function Y(e){if(!e||typeof e!="object")return{server:null,proxy:!0,languages:void 0};let t=e.playground||{};return{server:typeof e.server=="string"?e.server.trim():null,proxy:t.proxy!==!1&&t.display!=="none",languages:Array.isArray(e.examples?.languages)?e.examples.languages:void 0}}function Ce(e){if(!e||typeof e!="object")return null;let t=typeof e.apiBase=="string"&&e.apiBase.trim()?e.apiBase.trim().replace(/\/+$/,""):null,r=typeof e.host=="string"&&e.host.trim()?e.host.trim():null,n=Array.isArray(e.suggestions)?e.suggestions.filter(o=>typeof o=="string"&&o.trim()).map(o=>o.trim()).slice(0,6):[];return!t&&!n.length?null:{apiBase:t,host:r,suggestions:n}}var Bo,Do,qo,En,Pe=_(()=>{Bo={twitter:"x","x-twitter":"x"},Do="Google Sans Flex";qo=new Set(["copy","assistant","view","download-pdf","download-spec","chatgpt","claude","perplexity","grok","aistudio","devin","windsurf","mcp","add-mcp","cursor","vscode","devin-mcp"]),En=["copy","view","chatgpt","claude"]});import Go from"node:path";import Pn from"js-yaml";function Ln(e,t,r,n,o){let i=/^(?:\uFEFF)?---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(e);if(!i)return{text:e,converted:!1};let a;try{a=Pn.load(i[1])}catch{return{text:e,converted:!1}}if(typeof a?.openapi!="string")return{text:e,converted:!1};let s=/^(?:(.+?)\s+)?(GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|TRACE)\s+(\/\S+)$/i.exec(a.openapi.trim());if(!s)return{text:e,converted:!1};let l=s[1]?[s[1]]:[].concat(n.openapi||n.api?.openapi||[]);if(l=l.map(u=>typeof u=="string"?u:u?.source).filter(Boolean),!l.length)return{text:e,converted:!1};let c=[];try{for(let d of l){if(/^[a-z][a-z0-9+.-]*:/i.test(d))throw new Error("Remote specs must be downloaded locally first.");let h=Go.posix.normalize(d.replace(/^\//,"")),S=r.get(h);if(!S)throw new Error(`Spec is missing or ignored: ${h}`);let O=/\.ya?ml$/i.test(h)?Pn.load(S.toString("utf8")):gt(S.toString("utf8"),h),A=Ae(Sn(O));for(let x of A.operations)x.method===s[2].toUpperCase()&&x.path===s[3]&&c.push({operation:x,rel:h})}if(c.length!==1)throw new Error(`Expected exactly one matching operation; found ${c.length}.`);let{operation:u,rel:p}=c[0],y=Y(n.api),m=He(u,{server:y.server||u.servers?.[0],...y.languages?{languages:y.languages}:{}});if(/\bveluApi\b/.test(e))throw new Error("Reserved generated export name already used: veluApi");let v=`
48
+ `);En={curl:Io,javascript:Mo,python:zo,ruby:Vo},Bo={curl:"cURL",javascript:"JavaScript",python:"Python",ruby:"Ruby"},Do={curl:"bash",javascript:"javascript",python:"python",ruby:"ruby"},$t=["curl","javascript","python","ruby"]});function Ln(e){let t=e?.font?.family;return typeof t=="string"&&t.trim()?t.trim():e?.theme==="vepa"||["thulir","aalam","nila","kadhir"].includes(e?.theme)?"Inter":qo}function Oe(e){return e==="vepa"||["thulir","aalam","nila","kadhir"].includes(e)?e:"velu"}function jt({light:e,dark:t,family:r,theme:n,primary:o=e,cta:i=o}){let a=n==="vepa"||["thulir","aalam","nila","kadhir"].includes(n)?Go(o,t):"";return[":root:root {",` --accent-color: ${e};`,...["thulir","aalam","nila","kadhir"].includes(n)?[` --thulir-cta-color: ${i};`]:[],` --font-sans: "${r}", sans-serif;`,a,"}",':root:root[data-theme="dark"] {',` --accent-color: ${t};`,"}"].join(`
49
+ `)}function Go(e,t){let r=(s,l)=>{let c=/^#([\da-f]{3}|[\da-f]{6})$/i.exec(s||"")?.[1];return c||(c=l),c.length===3&&(c=[...c].map(u=>u+u).join("")),[0,2,4].map(u=>parseInt(c.slice(u,u+2),16))},n=r(e,"16a34a"),o=r(t,"4ade80"),i={50:250,100:245,200:229,300:212,400:163,500:115,600:82,700:64,800:38,900:23,950:10},a=.95/(.95+.6-.95*.6);return[...Object.entries(i).map(([s,l])=>` --vepa-gray-${s}: rgb(${n.map(c=>Math.round(c*(1-a)+l*a)).join(" ")});`),` --vepa-background-dark: rgb(${o.map((s,l)=>Math.round([9,9,11][l]*.98+s*.02)).join(" ")});`].join(`
50
+ `)}function Te(e){if(!e||typeof e!="object")return null;let t=[];if(e.socials&&typeof e.socials=="object")for(let[n,o]of Object.entries(e.socials))typeof o!="string"||!o.trim()||t.push({kind:Jo[n]??n,href:o.trim()});let r=Array.isArray(e.links)?e.links.filter(n=>n&&typeof n=="object").map(n=>({title:(n.header??n.title??"").trim(),items:(Array.isArray(n.items)?n.items:[]).filter(o=>o&&o.label).map(o=>({label:o.label,href:o.href??"#"}))})).filter(n=>n.title||n.items.length):[];return!t.length&&!r.length?null:{socials:t,links:r}}function kt(e){return/^(https?:)?\/\//.test(e)||/^(mailto|tel):/.test(e)}function Ee(e){if(!e||typeof e!="object")return null;let t=(Array.isArray(e.links)?e.links:[]).filter(o=>o&&typeof o.href=="string"&&o.href.trim()).map(o=>({label:o.label??"",href:o.href.trim(),icon:o.icon??null,external:kt(o.href.trim())})),r=null,n=e.primary;if(n&&typeof n=="object"&&typeof n.href=="string"&&n.href.trim()){let o=n.href.trim();r=n.type==="github"?{kind:"github",label:n.label??"GitHub",href:o,external:kt(o)}:{kind:"button",label:n.label??"",href:o,external:kt(o)}}return!t.length&&!r?null:{links:t,primary:r}}function At(e){if(e==null)return{options:[...Cn],display:"header"};if(typeof e!="object")return{options:[],display:"header"};let t=e.display==="toc"?"toc":"header",r=Array.isArray(e.options)?e.options:Cn,n=[];for(let o of r)typeof o=="string"?Wo.has(o)&&n.push(o):o&&typeof o=="object"&&o.title&&o.href&&n.push({title:String(o.title),description:o.description?String(o.description):"",href:String(o.href),icon:typeof o.icon=="string"?o.icon:void 0});return{options:n,display:t}}function Y(e){if(!e||typeof e!="object")return{server:null,proxy:!0,languages:void 0};let t=e.playground||{};return{server:typeof e.server=="string"?e.server.trim():null,proxy:t.proxy!==!1&&t.display!=="none",languages:Array.isArray(e.examples?.languages)?e.examples.languages:void 0}}function Ce(e){if(!e||typeof e!="object")return null;let t=typeof e.apiBase=="string"&&e.apiBase.trim()?e.apiBase.trim().replace(/\/+$/,""):null,r=typeof e.host=="string"&&e.host.trim()?e.host.trim():null,n=Array.isArray(e.suggestions)?e.suggestions.filter(o=>typeof o=="string"&&o.trim()).map(o=>o.trim()).slice(0,6):[];return!t&&!n.length?null:{apiBase:t,host:r,suggestions:n}}var Jo,qo,Wo,Cn,Le=_(()=>{Jo={twitter:"x","x-twitter":"x"},qo="Google Sans Flex";Wo=new Set(["copy","assistant","view","download-pdf","download-spec","chatgpt","claude","perplexity","grok","aistudio","devin","windsurf","mcp","add-mcp","cursor","vscode","devin-mcp"]),Cn=["copy","view","chatgpt","claude"]});import Ho from"node:path";import Pn from"js-yaml";function _n(e,t,r,n,o){let i=/^(?:\uFEFF)?---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(e);if(!i)return{text:e,converted:!1};let a;try{a=Pn.load(i[1])}catch{return{text:e,converted:!1}}if(typeof a?.openapi!="string")return{text:e,converted:!1};let s=/^(?:(.+?)\s+)?(GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|TRACE)\s+(\/\S+)$/i.exec(a.openapi.trim());if(!s)return{text:e,converted:!1};let l=s[1]?[s[1]]:[].concat(n.openapi||n.api?.openapi||[]);if(l=l.map(u=>typeof u=="string"?u:u?.source).filter(Boolean),!l.length)return{text:e,converted:!1};let c=[];try{for(let d of l){if(/^[a-z][a-z0-9+.-]*:/i.test(d))throw new Error("Remote specs must be downloaded locally first.");let h=Ho.posix.normalize(d.replace(/^\//,"")),S=r.get(h);if(!S)throw new Error(`Spec is missing or ignored: ${h}`);let O=/\.ya?ml$/i.test(h)?Pn.load(S.toString("utf8")):ht(S.toString("utf8"),h),A=Ae(kn(O));for(let x of A.operations)x.method===s[2].toUpperCase()&&x.path===s[3]&&c.push({operation:x,rel:h})}if(c.length!==1)throw new Error(`Expected exactly one matching operation; found ${c.length}.`);let{operation:u,rel:p}=c[0],y=Y(n.api),m=Xe(u,{server:y.server||u.servers?.[0],...y.languages?{languages:y.languages}:{}});if(/\bveluApi\b/.test(e))throw new Error("Reserved generated export name already used: veluApi");let v=`
51
51
  export const veluApi = ${JSON.stringify({operation:u,samples:m,api:{proxy:y.proxy,server:y.server}})};
52
52
 
53
- ${e.slice(i[0].length)}`;return o("endpoint-snapshot","warning",t,`Generated the ${s[2].toUpperCase()} ${s[3]} playground from ${p}, preserving the page URL and body. This is an editable snapshot: regenerate after spec changes; review x-mint extensions and page-specific overrides.`),{text:e.slice(0,i[0].length)+v,converted:!0}}catch(u){return o("endpoint-conversion","error",t,`Could not migrate OpenAPI endpoint: ${u.message}`),{text:e,converted:!1}}}var _n=_(()=>{kn();We();$t();Pe();Je()});var Mn={};$e(Mn,{MIGRATE_HELP:()=>Un,migrateMintlify:()=>In,parseMigrateArgs:()=>Fn,planMigration:()=>Nn,runMigrate:()=>ei});import N from"node:fs";import z from"node:path";import{randomUUID as Wo,createHash as Ho}from"node:crypto";import Ko from"ignore";function Fn(e){if(e.includes("--help")||e.includes("-h"))return{help:!0};if(e.shift()!=="mintlify")throw new Error("Specify the source platform: velu migrate mintlify [source]");let t={},r=!1;for(let n=0;n<e.length;n++){let o=e[n];if(["--dry-run","--json","--strict"].includes(o))t[{"--dry-run":"dryRun","--json":"json","--strict":"strict"}[o]]=!0;else if(["--out","--config"].includes(o)){if(!e[n+1]||e[n+1].startsWith("--"))throw new Error(`${o} requires a value.`);if(t[o.slice(2)]!==void 0)throw new Error(`${o} was specified twice.`);t[o.slice(2)]=e[++n]}else{if(o.startsWith("-"))throw new Error(`Unknown migration option: ${o}`);if(r)throw new Error("Only one source directory may be specified. Use --out for the destination.");t.source=o,r=!0}}if(t.config&&!["docs.json","mint.json"].includes(t.config))throw new Error("--config must be docs.json or mint.json.");return t}function Zo(e,t){let r=z.resolve(t||`${e}-velu`),n=r,o=[];for(;!N.existsSync(n);){o.unshift(z.basename(n));let a=z.dirname(n);if(a===n)throw new Error("Cannot resolve destination parent.");n=a}let i=z.join(N.realpathSync(n),...o);if(le(e,i)||le(i,e))throw new Error("Destination must be outside the source directory and cannot be its ancestor.");if(N.existsSync(r))throw new Error("Destination already exists. Choose a new directory; migration never overwrites existing files.");return i}function Qo(e){let t=r=>String(r).replace(/\|/g,"\\|").replace(/[\r\n]+/g," ");return`# Mintlify \u2192 Velu migration
53
+ ${e.slice(i[0].length)}`;return o("endpoint-snapshot","warning",t,`Generated the ${s[2].toUpperCase()} ${s[3]} playground from ${p}, preserving the page URL and body. This is an editable snapshot: regenerate after spec changes; review x-mint extensions and page-specific overrides.`),{text:e.slice(0,i[0].length)+v,converted:!0}}catch(u){return o("endpoint-conversion","error",t,`Could not migrate OpenAPI endpoint: ${u.message}`),{text:e,converted:!1}}}var Rn=_(()=>{jn();Ke();St();Le();Ge()});var zn={};$e(zn,{MIGRATE_HELP:()=>Fn,migrateMintlify:()=>Mn,parseMigrateArgs:()=>Nn,planMigration:()=>In,runMigrate:()=>ni});import N from"node:fs";import z from"node:path";import{randomUUID as Ko,createHash as Xo}from"node:crypto";import Yo from"ignore";function Nn(e){if(e.includes("--help")||e.includes("-h"))return{help:!0};if(e.shift()!=="mintlify")throw new Error("Specify the source platform: velu migrate mintlify [source]");let t={},r=!1;for(let n=0;n<e.length;n++){let o=e[n];if(["--dry-run","--json","--strict"].includes(o))t[{"--dry-run":"dryRun","--json":"json","--strict":"strict"}[o]]=!0;else if(["--out","--config"].includes(o)){if(!e[n+1]||e[n+1].startsWith("--"))throw new Error(`${o} requires a value.`);if(t[o.slice(2)]!==void 0)throw new Error(`${o} was specified twice.`);t[o.slice(2)]=e[++n]}else{if(o.startsWith("-"))throw new Error(`Unknown migration option: ${o}`);if(r)throw new Error("Only one source directory may be specified. Use --out for the destination.");t.source=o,r=!0}}if(t.config&&!["docs.json","mint.json"].includes(t.config))throw new Error("--config must be docs.json or mint.json.");return t}function ei(e,t){let r=z.resolve(t||`${e}-velu`),n=r,o=[];for(;!N.existsSync(n);){o.unshift(z.basename(n));let a=z.dirname(n);if(a===n)throw new Error("Cannot resolve destination parent.");n=a}let i=z.join(N.realpathSync(n),...o);if(le(e,i)||le(i,e))throw new Error("Destination must be outside the source directory and cannot be its ancestor.");if(N.existsSync(r))throw new Error("Destination already exists. Choose a new directory; migration never overwrites existing files.");return i}function ti(e){let t=r=>String(r).replace(/\|/g,"\\|").replace(/[\r\n]+/g," ");return`# Mintlify \u2192 Velu migration
54
54
 
55
55
  Status: **${e.status}**. ${e.summary.files} files; ${e.summary.pages} pages/snippets; ${e.summary.scripts} browser scripts; ${e.summary.styles} stylesheets.
56
56
 
@@ -61,7 +61,7 @@ Status: **${e.status}**. ${e.summary.files} files; ${e.summary.pages} pages/snip
61
61
  3. Run \`velu dev .\` and verify navigation, custom scripts, CSS, adapters, and API pages.
62
62
  4. Configure hosting, domains, redirects, authentication, and integrations in Velu as needed.
63
63
 
64
- The original Mintlify configuration is preserved. Unsupported settings have not been silently treated as implemented. JavaScript is copied without execution; static checks cannot prove arbitrary scripts behave identically. See \`${At}\` for all file hashes, transformations, skipped files, and npm scripts.
64
+ The original Mintlify configuration is preserved. Unsupported settings have not been silently treated as implemented. JavaScript is copied without execution; static checks cannot prove arbitrary scripts behave identically. See \`${Ot}\` for all file hashes, transformations, skipped files, and npm scripts.
65
65
 
66
66
  ## Findings
67
67
 
@@ -69,8 +69,8 @@ The original Mintlify configuration is preserved. Unsupported settings have not
69
69
  | --- | --- | --- | --- |
70
70
  `+e.issues.map(r=>`| ${r.severity} | ${t(r.code)} | ${t(r.file)}${r.line?":"+r.line:""} | ${t(r.message)} |`).join(`
71
71
  `)+`
72
- `}async function Nn({source:e=".",out:t,config:r,version:n="0.2.40"}={}){let o=N.realpathSync(z.resolve(e));if(!N.statSync(o).isDirectory())throw new Error("Source must be a directory.");let i=Zo(o,t);if(r&&!["docs.json","mint.json"].includes(r))throw new Error("Config must be docs.json or mint.json.");let a=r||["docs.json","mint.json"].find(f=>N.existsSync(z.join(o,f)));if(!a)throw new Error("No docs.json or mint.json found in the source directory.");let s=[],l=new Set,c=(f,b,j,C,M)=>{let ie=JSON.stringify([f,b,j,C,M]);l.has(ie)||(s.push({code:f,severity:b,file:j,message:C,...M?{line:M}:{}}),l.add(ie))},u=ln(o,a),p=cn(u,a,c);!r&&N.existsSync(z.join(o,"docs.json"))&&N.existsSync(z.join(o,"mint.json"))&&c("multiple-configs","warning",a,"Both config files exist; docs.json selected. Use --config mint.json to select the legacy config.");let y=Ko(),m=z.join(o,".mintignore");if(N.existsSync(m)){if(!le(o,N.realpathSync(m)))throw new Error(".mintignore resolves outside the source.");y.add(N.readFileSync(m,"utf8"))}let g=new Map,v=[];function d(f){for(let b of N.readdirSync(f,{withFileTypes:!0}).sort((j,C)=>j.name<C.name?-1:j.name>C.name?1:0)){let j=z.join(f,b.name),C=dt(z.relative(o,j));b.isSymbolicLink()?(v.push({path:C,reason:"symbolic-link"}),c("symlink","warning",C,"Symbolic link/junction skipped. Copy its required content into the source explicitly.")):b.isDirectory()&&Xo.has(b.name)||/^\.env(?:\.|$)/i.test(b.name)||[".npmrc",".yarnrc.yml",".pnp.cjs",".pnp.loader.mjs"].includes(b.name)?v.push({path:C,reason:"dependency-cache-tooling-or-environment"}):y.ignores(C+(b.isDirectory()?"/":""))&&C!==a&&C!==".mintignore"?v.push({path:C,reason:"mintignore"}):b.isFile()&&C.startsWith(".mintlify/")&&!/\.(json|ya?ml)$/i.test(C)&&!C.startsWith(".mintlify/skills/")?v.push({path:C,reason:"mintlify-runtime-file"}):b.isDirectory()?d(j):b.isFile()?g.set(C,N.readFileSync(j)):v.push({path:C,reason:"not-regular-file"})}}if(d(o),!g.has(a))throw new Error("Source config must be a regular file, not a symbolic link.");if(g.has("velu.json"))throw new Error("Source already contains velu.json. Use the original Mintlify project to avoid replacing an existing Velu config.");let h=new Map,S=new Set,O=new Set;try{for(let f of ne(X(p.navigation)))O.add(f.pagePath.replace(/^\//,""))}catch{}for(let f of g.keys()){let b=f;/\.md$/i.test(f)&&(O.has(f.slice(0,-3))||!/^(readme|license|changelog|contributing|contribute|skill|agents|claude)\.md$/i.test(z.posix.basename(f)))&&(b=f.replace(/\.md$/i,".mdx")),/\.mdx$/i.test(f)&&(b=f.replace(/\.mdx$/i,".mdx")),/^(?:_snippets|snippets)\/.*\.js$/i.test(f)&&(b=f.replace(/\.js$/i,".jsx"));let j=b.toLowerCase();if(S.has(j)||[At.toLowerCase(),Ot.toLowerCase()].includes(j))throw new Error(`Migration output collision: ${b}`);S.add(j),h.set(f,b)}let A=new Map(h);for(let[f,b]of h)if(/\.(mdx?|jsx?|tsx?)$/.test(f)){let j=f.replace(/\.[^.]+$/,"");A.has(j)||A.set(j,b),/\/index$/.test(j)&&!A.has(j.slice(0,-6))&&A.set(j.slice(0,-6),b)}let x=new Map,w=[],P=new Set,L=!1,B=[];for(let[f,b]of g){let j=h.get(f),C=b,M="asset",ie;if(/\.mdx$/i.test(j)){M="content";let J=Ln(b.toString("utf8"),f,g,u,c),se=await mn(J.text,f,A,c,{endpointConverted:J.converted});C=Buffer.from(se.text),ie=se.components,L||=se.adapters.length>0;for(let mt of se.assets||[])P.add(mt)}else if(f==="package.json"){M="package";let J=gn(b.toString("utf8"),n,c);C=Buffer.from(J.text),B=J.scripts}else if(/\.js$/i.test(j))M="script",dn(b.toString("utf8"),f,c),(f.startsWith("public/")||f.split("/").some(J=>J.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load JavaScript from public or dot directories; explicitly load it from a custom script if required.");else if(/\.css$/i.test(j)){M="style";let J=b.toString("utf8");f.startsWith("public/")||(C=Buffer.from(yn(J,f,h,c))),/@import|data-component-(?:name|part)|\.dark\b|__next|#banner|#header\b/.test(J)&&c("css-hooks","warning",f,"Review CSS imports, theme classes, and Mintlify-specific selectors against Velu\u2019s DOM hooks."),(f.startsWith("public/")||f.split("/").some(se=>se.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load CSS from public or dot directories.")}else/\.[cm]?[jt]sx?$/.test(j)&&(M="module",C=Buffer.from(hn(b.toString("utf8"),f,A,c)),/(?:@mintlify\/|next\/|window\.mintlify)/.test(b.toString("utf8"))&&c("module-runtime","error",f,"Custom module depends on a Mintlify/Next.js runtime. Adapt its imports and APIs."));f.startsWith(".github/workflows/")&&/mintlify|\bmint\s/.test(b.toString("utf8"))&&c("ci-workflow","warning",f,"Workflow preserved. Replace Mintlify install/validation/deployment commands manually."),x.set(j,C),w.push({source:f,destination:j,kind:M,action:f!==j?"renamed":C.equals(b)?"copied":"transformed",sha256:Le(C),...ie?{components:ie}:{}})}for(let[f,b]of[...x]){if(!Yo.test(f)&&!P.has(f)&&!/\.(css|js)$/i.test(f)||f.startsWith("public/")||f.split("/").some(M=>M.startsWith("."))||["docs.json","mint.json","package.json","velu.json",...Rn].includes(f))continue;let j=`public/${f}`,C=[...x.keys()].find(M=>M.toLowerCase()===j.toLowerCase());if(C){x.get(C).equals(b)||c("public-asset-conflict","error",f,`Different asset already exists at ${C}; public file retained. Review which URL should be served.`);continue}x.set(j,b),w.push({source:f,destination:j,kind:"public-asset",action:"mirrored",sha256:Le(b)})}if(L){if(S.has(ge.toLowerCase()))throw new Error(`Generated adapter conflicts with source file: ${ge}`);x.set(ge,Buffer.from(yt)),w.push({destination:ge,kind:"module",action:"generated",sha256:Le(yt)})}let ee=Buffer.from(Ke(p));x.set("velu.json",ee),w.push({destination:"velu.json",kind:"config",action:"generated",sha256:Le(ee)});let T=Buffer.from(Ke(u));x.set(".velu-migration/source-config.json",T),w.push({destination:".velu-migration/source-config.json",kind:"config",action:"archived",sha256:Le(T)});let $=new Set,E=new Set;try{for(let f of ne(X(p.navigation))){E.has(f.url)&&c("duplicate-route","error","velu.json",`Duplicate route: ${f.url}`),E.add(f.url);let b=f.pagePath.replace(/^\/+|\/+$/g,"")+".mdx";/\.\.(?:\/|$)|\\/.test(b)&&c("unsafe-page-path","error","velu.json",`Page path is outside the supported project-relative format: ${f.pagePath}`),$.add(b),x.has(b)||c("missing-page","error","velu.json",`Navigation page is missing or ignored: ${b}`)}}catch(f){c("navigation-invalid","error","velu.json",f.message)}for(let f of w.filter(b=>b.kind==="content"))!$.has(f.destination)&&!/^(?:_snippets|snippets)\//.test(f.destination)&&c("unlisted-page","warning",f.destination,"Page preserved but absent from navigation. Velu\u2019s current preview only renders navigation pages; add it to navigation if it must be accessible.");let k=(f,b)=>{if(typeof f!="string")return;if(/^https?:\/\//.test(f)){c("remote-asset","error",b,"Download this branding asset into the project and use a local path; migration does not fetch external assets.");return}let j=f.replace(/^\//,"").split(/[?#]/)[0];x.has(j)||c("missing-asset","error",b,`Asset is missing or ignored: ${j}`)};if(k(p.favicon,"favicon"),typeof p.logo=="string")k(p.logo,"logo");else for(let f of["light","dark"])k(p.logo?.[f],`logo.${f}`);function F(f){if(!(!f||typeof f!="object")){if(f.openapi)for(let b of[].concat(f.openapi))/^https?:\/\//.test(b)?c("remote-openapi","warning","velu.json","Remote OpenAPI URL preserved; availability and generation need validation with network access."):x.has(b.replace(/^\//,""))?c("openapi-routes","warning","velu.json",`OpenAPI source ${b} preserved; compare generated endpoint URLs and x-mint extensions in preview.`):c("missing-openapi","error","velu.json",`OpenAPI source missing or ignored: ${b}`);for(let b of Object.values(f))typeof b=="object"&&F(b)}}F(p.navigation),B.some(f=>f.action==="converted")&&[...Rn].some(f=>x.has(f))&&c("lockfile-stale","warning","package.json","Lockfiles are preserved and require regeneration after the dependency changes."),s.sort((f,b)=>f.file.localeCompare(b.file)||(f.line||0)-(b.line||0)||f.code.localeCompare(b.code));let R=s.filter(f=>f.severity==="error").length,U=s.filter(f=>f.severity==="warning").length,V={reportVersion:1,source:o,destination:i,sourceConfig:a,status:R||U?"needs-review":"ready",parityReference:{cli:"@mintlify/cli@4.0.1479",common:"@mintlify/common@1.0.1132",prebuild:"@mintlify/prebuild@1.0.1286",inspected:"2026-09-08"},summary:{files:w.length,pages:w.filter(f=>f.kind==="content").length,scripts:w.filter(f=>f.kind==="script").length,styles:w.filter(f=>f.kind==="style").length,errors:R,warnings:U,skipped:v.length},issues:s,files:w,skipped:v,npmScripts:B};return x.set(At,Buffer.from(Ke(V))),x.set(Ot,Buffer.from(Qo(V))),{report:V,files:x}}async function In(e={}){let t=await Nn(e),r=e.strict&&(t.report.summary.errors||t.report.summary.warnings),n=!1;if(!e.dryRun&&!r){let o=t.report.destination,i=z.dirname(o);N.mkdirSync(i,{recursive:!0});let a=z.join(i,`.velu-migration-${Wo()}`);N.mkdirSync(a);try{for(let[s,l]of t.files){let c=z.resolve(a,s);if(!le(a,c))throw new Error("Output path escapes the staging directory.");N.mkdirSync(z.dirname(c),{recursive:!0}),N.writeFileSync(c,l,{flag:"wx"})}if(N.existsSync(o))throw new Error("Destination appeared during migration; no existing files were changed.");N.renameSync(a,o),n=!0}finally{z.dirname(a)===i&&z.basename(a).startsWith(".velu-migration-")&&N.rmSync(a,{recursive:!0,force:!0})}}return{report:t.report,written:n,exitCode:r?3:t.report.summary.errors?2:0}}async function ei(e,t){let r=Fn([...e]);if(r.help)return console.log(Un),0;let n=await In({...r,version:t});if(r.json)console.log(Ke({...n.report,written:n.written}).trimEnd());else{let{summary:o}=n.report;console.log(`${n.written?"Migrated to":"Migration plan for"} ${n.report.destination}`),console.log(`${o.files} files \xB7 ${o.pages} pages/snippets \xB7 ${o.scripts} scripts \xB7 ${o.styles} stylesheets`),console.log(`${o.errors} errors \xB7 ${o.warnings} warnings \xB7 ${o.skipped} skipped paths`);for(let i of n.report.issues)console.log(` ${i.severity.toUpperCase()} [${i.code}] ${i.file}${i.line?":"+i.line:""}: ${i.message}`);n.written?console.log(`Review ${Ot}, then run: velu validate ${JSON.stringify(n.report.destination)}`):console.log(r.strict&&n.exitCode===3?"Strict mode: review required; no files written.":"Dry run: no files written.")}return n.exitCode}var Xo,Rn,At,Ot,Yo,Le,Ke,Un,zn=_(()=>{Je();vn();re();re();_n();Xo=new Set(["node_modules",".git",".velu",".velu-migration",".next",".turbo",".cache",".idea",".vscode",".claude",".agents","dist","dist-preview","coverage"]),Rn=new Set(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lock","bun.lockb"]),At="velu-migration-report.json",Ot="VELU-MIGRATION.md",Yo=/\.(?:avif|apng|bmp|gif|ico|jpe?g|png|svg|svgz|tiff?|webp|mp4|webm|mov|avi|m4v|mp3|wav|ogg|flac|aac|m4a|woff2?|ttf|otf|eot|pdf|txt|csv|tsv|xml|zip|gz|tar|docx?|xlsx?|pptx?)$/i,Le=e=>Ho("sha256").update(e).digest("hex"),Ke=e=>JSON.stringify(e,null,2)+`
73
- `,Un=`Usage: velu migrate mintlify [source] [--out <directory>] [--config docs.json|mint.json] [--dry-run] [--json] [--strict]
72
+ `}async function In({source:e=".",out:t,config:r,version:n="0.2.40"}={}){let o=N.realpathSync(z.resolve(e));if(!N.statSync(o).isDirectory())throw new Error("Source must be a directory.");let i=ei(o,t);if(r&&!["docs.json","mint.json"].includes(r))throw new Error("Config must be docs.json or mint.json.");let a=r||["docs.json","mint.json"].find(f=>N.existsSync(z.join(o,f)));if(!a)throw new Error("No docs.json or mint.json found in the source directory.");let s=[],l=new Set,c=(f,b,j,C,M)=>{let ie=JSON.stringify([f,b,j,C,M]);l.has(ie)||(s.push({code:f,severity:b,file:j,message:C,...M?{line:M}:{}}),l.add(ie))},u=cn(o,a),p=un(u,a,c);!r&&N.existsSync(z.join(o,"docs.json"))&&N.existsSync(z.join(o,"mint.json"))&&c("multiple-configs","warning",a,"Both config files exist; docs.json selected. Use --config mint.json to select the legacy config.");let y=Yo(),m=z.join(o,".mintignore");if(N.existsSync(m)){if(!le(o,N.realpathSync(m)))throw new Error(".mintignore resolves outside the source.");y.add(N.readFileSync(m,"utf8"))}let g=new Map,v=[];function d(f){for(let b of N.readdirSync(f,{withFileTypes:!0}).sort((j,C)=>j.name<C.name?-1:j.name>C.name?1:0)){let j=z.join(f,b.name),C=gt(z.relative(o,j));b.isSymbolicLink()?(v.push({path:C,reason:"symbolic-link"}),c("symlink","warning",C,"Symbolic link/junction skipped. Copy its required content into the source explicitly.")):b.isDirectory()&&Zo.has(b.name)||/^\.env(?:\.|$)/i.test(b.name)||[".npmrc",".yarnrc.yml",".pnp.cjs",".pnp.loader.mjs"].includes(b.name)?v.push({path:C,reason:"dependency-cache-tooling-or-environment"}):y.ignores(C+(b.isDirectory()?"/":""))&&C!==a&&C!==".mintignore"?v.push({path:C,reason:"mintignore"}):b.isFile()&&C.startsWith(".mintlify/")&&!/\.(json|ya?ml)$/i.test(C)&&!C.startsWith(".mintlify/skills/")?v.push({path:C,reason:"mintlify-runtime-file"}):b.isDirectory()?d(j):b.isFile()?g.set(C,N.readFileSync(j)):v.push({path:C,reason:"not-regular-file"})}}if(d(o),!g.has(a))throw new Error("Source config must be a regular file, not a symbolic link.");if(g.has("velu.json"))throw new Error("Source already contains velu.json. Use the original Mintlify project to avoid replacing an existing Velu config.");let h=new Map,S=new Set,O=new Set;try{for(let f of ne(X(p.navigation)))O.add(f.pagePath.replace(/^\//,""))}catch{}for(let f of g.keys()){let b=f;/\.md$/i.test(f)&&(O.has(f.slice(0,-3))||!/^(readme|license|changelog|contributing|contribute|skill|agents|claude)\.md$/i.test(z.posix.basename(f)))&&(b=f.replace(/\.md$/i,".mdx")),/\.mdx$/i.test(f)&&(b=f.replace(/\.mdx$/i,".mdx")),/^(?:_snippets|snippets)\/.*\.js$/i.test(f)&&(b=f.replace(/\.js$/i,".jsx"));let j=b.toLowerCase();if(S.has(j)||[Ot.toLowerCase(),Tt.toLowerCase()].includes(j))throw new Error(`Migration output collision: ${b}`);S.add(j),h.set(f,b)}let A=new Map(h);for(let[f,b]of h)if(/\.(mdx?|jsx?|tsx?)$/.test(f)){let j=f.replace(/\.[^.]+$/,"");A.has(j)||A.set(j,b),/\/index$/.test(j)&&!A.has(j.slice(0,-6))&&A.set(j.slice(0,-6),b)}let x=new Map,w=[],L=new Set,P=!1,B=[];for(let[f,b]of g){let j=h.get(f),C=b,M="asset",ie;if(/\.mdx$/i.test(j)){M="content";let J=_n(b.toString("utf8"),f,g,u,c),se=await dn(J.text,f,A,c,{endpointConverted:J.converted});C=Buffer.from(se.text),ie=se.components,P||=se.adapters.length>0;for(let dt of se.assets||[])L.add(dt)}else if(f==="package.json"){M="package";let J=hn(b.toString("utf8"),n,c);C=Buffer.from(J.text),B=J.scripts}else if(/\.js$/i.test(j))M="script",gn(b.toString("utf8"),f,c),(f.startsWith("public/")||f.split("/").some(J=>J.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load JavaScript from public or dot directories; explicitly load it from a custom script if required.");else if(/\.css$/i.test(j)){M="style";let J=b.toString("utf8");f.startsWith("public/")||(C=Buffer.from(vn(J,f,h,c))),/@import|data-component-(?:name|part)|\.dark\b|__next|#banner|#header\b/.test(J)&&c("css-hooks","warning",f,"Review CSS imports, theme classes, and Mintlify-specific selectors against Velu\u2019s DOM hooks."),(f.startsWith("public/")||f.split("/").some(se=>se.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load CSS from public or dot directories.")}else/\.[cm]?[jt]sx?$/.test(j)&&(M="module",C=Buffer.from(yn(b.toString("utf8"),f,A,c)),/(?:@mintlify\/|next\/|window\.mintlify)/.test(b.toString("utf8"))&&c("module-runtime","error",f,"Custom module depends on a Mintlify/Next.js runtime. Adapt its imports and APIs."));f.startsWith(".github/workflows/")&&/mintlify|\bmint\s/.test(b.toString("utf8"))&&c("ci-workflow","warning",f,"Workflow preserved. Replace Mintlify install/validation/deployment commands manually."),x.set(j,C),w.push({source:f,destination:j,kind:M,action:f!==j?"renamed":C.equals(b)?"copied":"transformed",sha256:Pe(C),...ie?{components:ie}:{}})}for(let[f,b]of[...x]){if(!Qo.test(f)&&!L.has(f)&&!/\.(css|js)$/i.test(f)||f.startsWith("public/")||f.split("/").some(M=>M.startsWith("."))||["docs.json","mint.json","package.json","velu.json",...Un].includes(f))continue;let j=`public/${f}`,C=[...x.keys()].find(M=>M.toLowerCase()===j.toLowerCase());if(C){x.get(C).equals(b)||c("public-asset-conflict","error",f,`Different asset already exists at ${C}; public file retained. Review which URL should be served.`);continue}x.set(j,b),w.push({source:f,destination:j,kind:"public-asset",action:"mirrored",sha256:Pe(b)})}if(P){if(S.has(ge.toLowerCase()))throw new Error(`Generated adapter conflicts with source file: ${ge}`);x.set(ge,Buffer.from(vt)),w.push({destination:ge,kind:"module",action:"generated",sha256:Pe(vt)})}let ee=Buffer.from(Ye(p));x.set("velu.json",ee),w.push({destination:"velu.json",kind:"config",action:"generated",sha256:Pe(ee)});let T=Buffer.from(Ye(u));x.set(".velu-migration/source-config.json",T),w.push({destination:".velu-migration/source-config.json",kind:"config",action:"archived",sha256:Pe(T)});let $=new Set,E=new Set;try{for(let f of ne(X(p.navigation))){E.has(f.url)&&c("duplicate-route","error","velu.json",`Duplicate route: ${f.url}`),E.add(f.url);let b=f.pagePath.replace(/^\/+|\/+$/g,"")+".mdx";/\.\.(?:\/|$)|\\/.test(b)&&c("unsafe-page-path","error","velu.json",`Page path is outside the supported project-relative format: ${f.pagePath}`),$.add(b),x.has(b)||c("missing-page","error","velu.json",`Navigation page is missing or ignored: ${b}`)}}catch(f){c("navigation-invalid","error","velu.json",f.message)}for(let f of w.filter(b=>b.kind==="content"))!$.has(f.destination)&&!/^(?:_snippets|snippets)\//.test(f.destination)&&c("unlisted-page","warning",f.destination,"Page preserved but absent from navigation. Velu\u2019s current preview only renders navigation pages; add it to navigation if it must be accessible.");let k=(f,b)=>{if(typeof f!="string")return;if(/^https?:\/\//.test(f)){c("remote-asset","error",b,"Download this branding asset into the project and use a local path; migration does not fetch external assets.");return}let j=f.replace(/^\//,"").split(/[?#]/)[0];x.has(j)||c("missing-asset","error",b,`Asset is missing or ignored: ${j}`)};if(k(p.favicon,"favicon"),typeof p.logo=="string")k(p.logo,"logo");else for(let f of["light","dark"])k(p.logo?.[f],`logo.${f}`);function F(f){if(!(!f||typeof f!="object")){if(f.openapi)for(let b of[].concat(f.openapi))/^https?:\/\//.test(b)?c("remote-openapi","warning","velu.json","Remote OpenAPI URL preserved; availability and generation need validation with network access."):x.has(b.replace(/^\//,""))?c("openapi-routes","warning","velu.json",`OpenAPI source ${b} preserved; compare generated endpoint URLs and x-mint extensions in preview.`):c("missing-openapi","error","velu.json",`OpenAPI source missing or ignored: ${b}`);for(let b of Object.values(f))typeof b=="object"&&F(b)}}F(p.navigation),B.some(f=>f.action==="converted")&&[...Un].some(f=>x.has(f))&&c("lockfile-stale","warning","package.json","Lockfiles are preserved and require regeneration after the dependency changes."),s.sort((f,b)=>f.file.localeCompare(b.file)||(f.line||0)-(b.line||0)||f.code.localeCompare(b.code));let R=s.filter(f=>f.severity==="error").length,U=s.filter(f=>f.severity==="warning").length,V={reportVersion:1,source:o,destination:i,sourceConfig:a,status:R||U?"needs-review":"ready",parityReference:{cli:"@mintlify/cli@4.0.1479",common:"@mintlify/common@1.0.1132",prebuild:"@mintlify/prebuild@1.0.1286",inspected:"2026-09-08"},summary:{files:w.length,pages:w.filter(f=>f.kind==="content").length,scripts:w.filter(f=>f.kind==="script").length,styles:w.filter(f=>f.kind==="style").length,errors:R,warnings:U,skipped:v.length},issues:s,files:w,skipped:v,npmScripts:B};return x.set(Ot,Buffer.from(Ye(V))),x.set(Tt,Buffer.from(ti(V))),{report:V,files:x}}async function Mn(e={}){let t=await In(e),r=e.strict&&(t.report.summary.errors||t.report.summary.warnings),n=!1;if(!e.dryRun&&!r){let o=t.report.destination,i=z.dirname(o);N.mkdirSync(i,{recursive:!0});let a=z.join(i,`.velu-migration-${Ko()}`);N.mkdirSync(a);try{for(let[s,l]of t.files){let c=z.resolve(a,s);if(!le(a,c))throw new Error("Output path escapes the staging directory.");N.mkdirSync(z.dirname(c),{recursive:!0}),N.writeFileSync(c,l,{flag:"wx"})}if(N.existsSync(o))throw new Error("Destination appeared during migration; no existing files were changed.");N.renameSync(a,o),n=!0}finally{z.dirname(a)===i&&z.basename(a).startsWith(".velu-migration-")&&N.rmSync(a,{recursive:!0,force:!0})}}return{report:t.report,written:n,exitCode:r?3:t.report.summary.errors?2:0}}async function ni(e,t){let r=Nn([...e]);if(r.help)return console.log(Fn),0;let n=await Mn({...r,version:t});if(r.json)console.log(Ye({...n.report,written:n.written}).trimEnd());else{let{summary:o}=n.report;console.log(`${n.written?"Migrated to":"Migration plan for"} ${n.report.destination}`),console.log(`${o.files} files \xB7 ${o.pages} pages/snippets \xB7 ${o.scripts} scripts \xB7 ${o.styles} stylesheets`),console.log(`${o.errors} errors \xB7 ${o.warnings} warnings \xB7 ${o.skipped} skipped paths`);for(let i of n.report.issues)console.log(` ${i.severity.toUpperCase()} [${i.code}] ${i.file}${i.line?":"+i.line:""}: ${i.message}`);n.written?console.log(`Review ${Tt}, then run: velu validate ${JSON.stringify(n.report.destination)}`):console.log(r.strict&&n.exitCode===3?"Strict mode: review required; no files written.":"Dry run: no files written.")}return n.exitCode}var Zo,Un,Ot,Tt,Qo,Pe,Ye,Fn,Vn=_(()=>{Ge();bn();re();re();Rn();Zo=new Set(["node_modules",".git",".velu",".velu-migration",".next",".turbo",".cache",".idea",".vscode",".claude",".agents","dist","dist-preview","coverage"]),Un=new Set(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lock","bun.lockb"]),Ot="velu-migration-report.json",Tt="VELU-MIGRATION.md",Qo=/\.(?:avif|apng|bmp|gif|ico|jpe?g|png|svg|svgz|tiff?|webp|mp4|webm|mov|avi|m4v|mp3|wav|ogg|flac|aac|m4a|woff2?|ttf|otf|eot|pdf|txt|csv|tsv|xml|zip|gz|tar|docx?|xlsx?|pptx?)$/i,Pe=e=>Xo("sha256").update(e).digest("hex"),Ye=e=>JSON.stringify(e,null,2)+`
73
+ `,Fn=`Usage: velu migrate mintlify [source] [--out <directory>] [--config docs.json|mint.json] [--dry-run] [--json] [--strict]
74
74
 
75
75
  Migrate a local Mintlify project into a NEW Velu directory.
76
76
  Defaults: source=current directory, output=<source>-velu, docs.json before mint.json.
@@ -83,10 +83,10 @@ Defaults: source=current directory, output=<source>-velu, docs.json before mint.
83
83
  Source files are never modified; no project scripts or package installs are executed.
84
84
  Exit codes: 0=completed/clean plan, 1=invalid invocation or I/O failure,
85
85
  2=compatibility errors (output is still written unless --strict), 3=strict review required.
86
- `});var Lt={};$e(Lt,{currentVersion:()=>Et,getLatestVersion:()=>Pt,isNewer:()=>Ct,maybeAutoUpdate:()=>di,updateCommand:()=>mi});import{spawnSync as Bn}from"node:child_process";import{readFileSync as Dn,writeFileSync as ti,mkdirSync as ni}from"node:fs";import{fileURLToPath as ri}from"node:url";import{homedir as oi,tmpdir as ii}from"node:os";import Tt from"node:path";import Q from"node:process";function Et(){try{return JSON.parse(Dn(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function ci(e,t){let r=i=>String(i).split("-")[0].split(".").map(a=>Number(a)||0),n=r(e),o=r(t);for(let i=0;i<3;i++){let a=(n[i]||0)-(o[i]||0);if(a!==0)return a<0?-1:1}return 0}function Ct(e,t){return!e||!t||t==="unknown"?!1:ci(e,t)>0}function Jn(){let e=Tt.join(oi()||ii(),".velu");return Tt.join(e,"update-check.json")}function Vn(){try{return JSON.parse(Dn(Jn(),"utf8"))}catch{return null}}function ui(e){try{let t=Jn();ni(Tt.dirname(t),{recursive:!0}),ti(t,JSON.stringify(e))}catch{}}async function pi(){let e=`${si}/-/package/${Xe}/dist-tags`,t=new AbortController,r=setTimeout(()=>t.abort(),li);try{let n=await fetch(e,{signal:t.signal,headers:{accept:"application/json"}});if(!n.ok)return null;let o=await n.json();return o&&typeof o.latest=="string"?o.latest:null}catch{return null}finally{clearTimeout(r)}}async function Pt({force:e=!1}={}){if(!e){let r=Vn();if(r?.latest&&Date.now()-(r.checkedAt||0)<ai)return r.latest}let t=await pi();return t?(ui({latest:t,checkedAt:Date.now()}),t):Vn()?.latest??null}function qn(){let e=Q.env.npm_config_user_agent||"";if(e.startsWith("pnpm"))return"pnpm";if(e.startsWith("yarn"))return"yarn";if(e.startsWith("bun"))return"bun";let t="";try{t=ri(import.meta.url).replace(/\\/g,"/")}catch{}return t.includes("/pnpm/")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")?"yarn":t.includes("/.bun/")?"bun":"npm"}function fi(e){let t=`${Xe}@latest`;switch(e){case"pnpm":return["pnpm",["add","-g",t]];case"yarn":return["yarn",["global","add",t]];case"bun":return["bun",["add","-g",t]];default:return["npm",["install","-g",t]]}}function Gn(e){let[t,r]=fi(e);return Bn(t,r,{stdio:"inherit",shell:Q.platform==="win32"}).status===0}async function mi(){let e=Et(),t=await Pt({force:!0});if(t&&!Ct(t,e)){console.log(`velu is already up to date (v${e}).`);return}let r=qn();console.log(t?`Updating velu ${e} \u2192 ${t} (via ${r})\u2026`:`Could not reach the npm registry; installing ${Xe}@latest (via ${r}) anyway\u2026`),Gn(r)?console.log('\u2713 Updated. Run "velu version" to confirm.'):(console.error("Update failed. You can update manually with:"),console.error(` npm install -g ${Xe}@latest`),Q.exitCode=1)}async function di(){if(Q.env.VELU_NO_UPDATE==="1"||Q.env.VELU_UPDATED==="1"||!Q.stdout.isTTY)return;let e=Et();if(e==="unknown")return;let t=null;try{t=await Pt()}catch{return}if(!Ct(t,e))return;let r=qn();if(console.log(`
87
- New velu version available: ${e} \u2192 ${t}. Updating\u2026`),!Gn(r)){console.log("Auto-update failed; continuing on the current version. Run `velu update` to retry.\n");return}console.log(`Restarting on the new version\u2026
88
- `);let n=Bn(Q.execPath,Q.argv.slice(1),{stdio:"inherit",env:{...Q.env,VELU_UPDATED:"1"}});Q.exit(n.status??0)}var Xe,si,ai,li,_t=_(()=>{Xe="@veluai/velu",si="https://registry.npmjs.org",ai=720*60*1e3,li=3e3});import gi from"node:fs/promises";import Rt from"node:path";function Wn(e){if(!e.favicon)return null;let t=Rt.extname(e.favicon).toLowerCase();return{url:Ut+t,type:yi[t]||""}}function _e(e){if(typeof e=="string"){let t=e.trim();return t?{light:t,dark:t,href:"/"}:null}if(e&&typeof e=="object"){let t=(e.light??e.dark)?.trim?.(),r=(e.dark??e.light)?.trim?.();return!t||!r?null:{light:t,dark:r,href:e.href?.trim?.()||"/"}}return null}function vi(e){return!e||typeof e!="object"?{metatags:{},indexing:"navigable"}:{metatags:e.metatags&&typeof e.metatags=="object"?e.metatags:{},indexing:e.indexing==="all"?"all":"navigable"}}function Ft(e={},t){let r=e.colors?.primary??hi;return{name:e.name??t??"docs",theme:Oe(e.theme),url:typeof process.env.VELU_SITE_URL=="string"&&process.env.VELU_SITE_URL.trim()?process.env.VELU_SITE_URL.trim().replace(/\/+$/,""):null,seo:vi(e.seo),assistant:Ce(e.assistant),thumbnails:e.thumbnails&&typeof e.thumbnails=="object"&&typeof e.thumbnails.background=="string"?{background:e.thumbnails.background}:null,colors:{primary:r,...["thulir","aalam","nila"].includes(e.theme)?{cta:e.colors?.dark??r}:{},light:e.theme==="vepa"||["thulir","aalam","nila"].includes(e.theme)?r:e.colors?.light??r,dark:e.theme==="vepa"||["thulir","aalam","nila"].includes(e.theme)?e.colors?.light??r:e.colors?.dark??r},favicon:e.favicon??null,api:Y(e.api),logo:_e(e.logo),footer:Te(e.footer),navbar:Ee(e.navbar),font:{family:Cn(e)},navigation:e.navigation??null}}async function Hn(e){let t=Rt.join(e,"velu.json"),r;try{r=await gi.readFile(t,"utf-8")}catch(o){throw o.code==="ENOENT"?new Error(`No velu.json found in ${e}. Run \`velu init <name>\` to scaffold one.`):o}let n;try{n=JSON.parse(r)}catch(o){throw new Error(`velu.json is not valid JSON: ${o.message}`)}return Ft(n,Rt.basename(e))}function Kn(e){let{colors:t,font:r}=e;return kt({light:t.light,dark:t.dark,family:r.family,theme:e.theme,primary:t.primary,cta:t.cta})}var hi,Ye,Ze,Ut,yi,Re=_(()=>{Pe();Pe();hi="#dc143c",Ye="/@velu-logo-light",Ze="/@velu-logo-dark",Ut="/@velu-favicon",yi={".svg":"image/svg+xml",".ico":"image/x-icon",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif"}});import{visit as Xn}from"unist-util-visit";import{toString as bi}from"mdast-util-to-string";import xi from"github-slugger";import{valueToEstree as wi}from"estree-util-value-to-estree";function $i(e,t){let r=a=>String(a||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),n=r(e),o=t==null||t===""?"":r(t);return`update-${o?n?`${n}-${o}`:o:n||"item"}`}function Nt(e,t){let r=(e.attributes||[]).find(n=>n&&n.type==="mdxJsxAttribute"&&n.name===t);if(r)return typeof r.value=="string"?r.value:void 0}function Si(e){let t=(e.attributes||[]).find(a=>a&&a.type==="mdxJsxAttribute"&&a.name==="tags");if(!t)return[];if(typeof t.value=="string")return[t.value];let r=t.value&&t.value.value?String(t.value.value):"",n=[],o=/["'`]([^"'`]+)["'`]/g,i;for(;i=o.exec(r);)n.push(i[1]);return n}function Ue(){return e=>{let t=new xi,r=[];Xn(e,"heading",l=>{let c=bi(l);r.push({depth:l.depth,id:t.slug(c),label:c})});let n=[],o=[],i=new Set;if(Xn(e,"mdxJsxFlowElement",l=>{if(l.name!=="Update")return;let c=Nt(l,"label")??Nt(l,"date"),u=Nt(l,"description");c&&n.push({id:$i(c,u),label:u||c});for(let p of Si(l)){let y=p.trim().toLowerCase();p.trim()&&!i.has(y)&&(i.add(y),o.push(p.trim()))}}),n.length){Yn(e,n),It(e,"changelog",{tags:o});return}let a={children:[]},s=[{node:a,depth:0}];for(let l of r){for(;s.length>1&&s[s.length-1].depth>=l.depth;)s.pop();let c={id:l.id,label:l.label},u=s[s.length-1].node;u.children||(u.children=[]),u.children.push(c),s.push({node:c,depth:l.depth})}Yn(e,a.children),It(e,"changelog",null)}}function Yn(e,t){It(e,"toc",t)}function It(e,t,r){e.children.unshift({type:"mdxjsEsm",value:"",data:{estree:{type:"Program",sourceType:"module",body:[{type:"ExportNamedDeclaration",specifiers:[],declaration:{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:t},init:wi(r)}]}}]}}})}var Mt=_(()=>{});import{visit as ki}from"unist-util-visit";function zt(){return e=>{ki(e,"code",t=>{let r=(t.meta||"").trim();if(!r)return;let n={},o=r.match(/\btitle="([^"]*)"/);o&&(n["data-title"]=o[1],r=(r.slice(0,o.index)+r.slice(o.index+o[0].length)).trim());let i=r.match(/\{([\d,\s-]+)\}/);i&&(n["data-highlight"]=i[1].replace(/\s+/g,""),r=(r.slice(0,i.index)+r.slice(i.index+i[0].length)).trim()),r=r.replace(/\blineNumbers\b/,()=>(n["data-line-numbers"]="","")).trim(),r&&(n["data-filename"]=r),Object.keys(n).length&&(t.data=t.data||{},t.data.hProperties={...t.data.hProperties||{},...n})})}}var Zn=_(()=>{});import ji from"node:fs";import Qn from"node:path";function ae(e,t){let r=[],n=[],o=new Set;for(let i of ne(e)){if(i.node?.api){o.add(i.url);continue}if(o.has(i.url)){r.push(`duplicate URL "${i.url}" (page "${i.pagePath}") \u2014 keeping the first occurrence`);continue}o.add(i.url);let a=i.pagePath.replace(/^\/+|\/+$/g,""),s=Qn.join(t,...a.split("/"))+".mdx",l=ji.existsSync(s);l||r.push(`page "${i.pagePath}" \u2192 ${Qn.relative(t,s)} not found`),n.push({pagePath:i.pagePath,url:i.url,fileAbsPath:s,exists:l})}return{pageEntries:n,warnings:r}}var Fe=_(()=>{re()});import Ai from"@apidevtools/swagger-parser";async function Oi(e){return Ai.dereference(e)}async function er(e){return Ae(await Oi(e))}var tr=_(()=>{We();We()});function nr(e,t){if(!t||typeof t!="object")return e;let r=Y(t);return{server:t.server!=null?r.server:e?.server??null,proxy:t.playground!=null?r.proxy:e?.proxy!==!1,languages:t.examples?.languages!=null?r.languages:e?.languages}}function Ti(e,{base:t,api:r,ops:n}){let o=r?.server,i=r?.languages||wt,a={proxy:r?.proxy!==!1,server:o??null},s=new Map;for(let c of e){let u=c.op.tags?.[0]||"API";s.has(u)||s.set(u,[]),s.get(u).push(c)}let l=[];for(let[c,u]of s){let p=u.map(({op:y,segment:m})=>{let g=`${t}/${Vt(c)}/${y.id}`;return n[g]={operation:y,samples:He(y,{server:o||y.servers?.[0],languages:i}),segment:m,title:y.title,description:y.description,method:y.method,api:a},{apiPage:g,label:y.title,method:y.method}});l.push({group:c,pages:p})}return l}async function rr(e,{loadOps:t,base:r,api:n,ops:o}){let i=Array.isArray(e)?e:[e],a=[];for(let s of i){let{operations:l,segments:c,servers:u}=await t(s);l.forEach((p,y)=>{!p.servers?.length&&u?.length&&(p.servers=u),a.push({op:p,segment:c[y]})})}return Ti(a,{base:r,api:n,ops:o})}async function or(e,t){if(!e||typeof e!="object")return e;if(typeof e.tab=="string"&&e.openapi){let n=Vt(e.tab),o=nr(t.api,e.api),i=await rr(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e;return{...l,groups:[...l.groups||[],...i]}}if(typeof e.group=="string"&&e.openapi){let n=Vt(e.group),o=nr(t.api,e.api),i=await rr(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e,c=i.flatMap(u=>u.pages);return{...l,pages:[...l.pages||[],...c]}}let r={...e};for(let n of["products","versions","languages","tabs","groups"])Array.isArray(e[n])&&(r[n]=await Promise.all(e[n].map(o=>or(o,t))));return r}async function ir(e,{api:t,loadOps:r}){let n={};return!e||typeof e!="object"?{nav:e,ops:n}:{nav:await or(e,{api:t,loadOps:r,ops:n}),ops:n}}var Vt,sr=_(()=>{Pe();$t();Vt=e=>String(e??"").replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()||"x"});import Ei from"node:path";function Ci(e,t){return/^https?:\/\//.test(e)?e:Ei.resolve(t,e.replace(/^\/+/,""))}async function Qe(e,{targetDir:t,api:r}={}){return ir(e,{api:r,loadOps:n=>er(Ci(n,t))})}var Bt=_(()=>{tr();sr()});import lr from"node:fs";import ye from"node:path";import{createHash as Pi}from"node:crypto";function Ne(e,{outDir:t}={}){let r=ye.resolve(e),n=t?ye.resolve(t):null,o=[],i=[],a=l=>{let c;try{c=lr.readdirSync(l,{withFileTypes:!0})}catch{return}for(let u of c){let p=ye.join(l,u.name);if(u.isDirectory()){if(u.name.startsWith(".")||_i.has(u.name)||n&&p===n)continue;a(p);continue}if(!u.isFile())continue;let y=ye.extname(u.name).toLowerCase();if(y!==ar&&y!==Li)continue;let m=ye.relative(r,p).split(ye.sep).join("/"),g={rel:m,abs:p,url:`${et}/${m.split("/").map(encodeURIComponent).join("/")}?v=${Ri(p)}`,kind:y===ar?"css":"js"};(g.kind==="css"?o:i).push(g)}};a(r);let s=(l,c)=>l.rel<c.rel?-1:l.rel>c.rel?1:0;return o.sort(s),i.sort(s),{styles:o,scripts:i}}function Ri(e){try{return Pi("sha1").update(lr.readFileSync(e)).digest("hex").slice(0,8)}catch{return"0"}}function cr(e,t){let r=`${et}/`;if(!t.startsWith(r))return null;let n;try{n=decodeURIComponent(t.slice(r.length))}catch{return null}return[...e.styles,...e.scripts].find(o=>o.rel===n)??null}function ur(e,t=""){return(e?.styles??[]).map(r=>`<link rel="stylesheet" href="${Ui(t+r.url)}" data-velu-custom />`).join(`
89
- `)}var et,ar,Li,_i,Ui,Dt=_(()=>{et="/@velu-custom",ar=".css",Li=".js",_i=new Set(["node_modules","public","dist"]);Ui=e=>String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")});import Fi from"node:fs";import Ie from"node:path";function mr(e,{buildOutDir:t}={}){return{name:"velu-site",resolveId(r){return r===fr?pr:null},async load(r){return r!==pr?null:Ni(e,{buildOutDir:t})}}}async function Ni(e,{buildOutDir:t}={}){let r={};try{r=JSON.parse(Fi.readFileSync(Ie.join(e,"velu.json"),"utf-8"))}catch{}let n=Y(r.api),o=r.navigation??{},i={};try{let x=await Qe(r.navigation??{},{targetDir:e,api:n});o=x.nav,i=x.ops}catch(x){console.warn(`[velu] openapi: ${x.message}`)}let a=X(o),{pageEntries:s,warnings:l}=ae(a,e);for(let x of l)console.warn(`[velu] nav: ${x}`);let c=_e(r.logo),u={name:r.name??Ie.basename(e),theme:Oe(r.theme),logo:c?{light:Ye,dark:Ze,href:c.href,mono:c.light===c.dark}:null,footer:Te(r.footer),navbar:Ee(r.navbar),contextual:jt(r.contextual??(["thulir","aalam","nila"].includes(r.theme)?{options:[]}:void 0)),assistant:Ce(r.assistant),customScripts:Ne(e,{outDir:t}).scripts.map(x=>x.url)},p=[],y=[],m=0;for(let x of s){if(!x.exists)continue;let w=JSON.stringify(x.fileAbsPath.split(Ie.sep).join("/")),P=JSON.stringify(Ie.relative(e,x.fileAbsPath).split(Ie.sep).join("/")),L=`__p${m++}`;p.push(`import * as ${L} from ${w};`),y.push(` ${JSON.stringify(x.url)}: { Component: ${L}.default, frontmatter: ${L}.frontmatter, toc: ${L}.toc, changelog: ${L}.changelog, relPath: ${P}, ...__mdxApi(${L}) },`)}let g=new Set(s.filter(x=>x.exists).map(x=>x.url));for(let x of s)!x.exists&&!g.has(x.url)&&y.push(` ${JSON.stringify(x.url)}: { missing: true },`);let v=[],d=[],h=[],S=!1,O=0;for(let x of ne(a)){if(!x.node?.api)continue;let w=i[x.pagePath];if(!w)continue;S=!0;let P=`__op${O}`,L=`__samples${O}`,B=`__api${O}`;O+=1,v.push(`const ${P} = ${JSON.stringify(w.operation)};`),v.push(`const ${L} = ${JSON.stringify(w.samples)};`),h.push(`{ id: ${JSON.stringify(w.operation.id)}, method: ${JSON.stringify(w.operation.method)}, title: ${JSON.stringify(w.operation.title)}, url: ${JSON.stringify(x.url)}, operation: ${P}, samples: ${L}, api: ${JSON.stringify(w.api||{proxy:!0,server:null})} }`),d.push(`function ${B}(){ return React.createElement(ApiReferencePage, { preset: ${JSON.stringify(u.theme)}, operation: ${P}, samples: ${L}, apiOperations: __apiOperations, api: ${JSON.stringify(w.api||{proxy:!0,server:null})} }); }`),y.push(` ${JSON.stringify(x.url)}: { Component: ${B}, frontmatter: { title: ${JSON.stringify(w.title)}, description: ${JSON.stringify(w.description)} }, toc: [], operation: ${P}, samples: ${L}, api: true },`)}S&&(v.push(`const __apiOperations = [
86
+ `});var _t={};$e(_t,{currentVersion:()=>Ct,getLatestVersion:()=>Pt,isNewer:()=>Lt,maybeAutoUpdate:()=>hi,updateCommand:()=>gi});import{spawnSync as Dn}from"node:child_process";import{readFileSync as Jn,writeFileSync as ri,mkdirSync as oi}from"node:fs";import{fileURLToPath as ii}from"node:url";import{homedir as si,tmpdir as ai}from"node:os";import Et from"node:path";import Q from"node:process";function Ct(){try{return JSON.parse(Jn(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function pi(e,t){let r=i=>String(i).split("-")[0].split(".").map(a=>Number(a)||0),n=r(e),o=r(t);for(let i=0;i<3;i++){let a=(n[i]||0)-(o[i]||0);if(a!==0)return a<0?-1:1}return 0}function Lt(e,t){return!e||!t||t==="unknown"?!1:pi(e,t)>0}function qn(){let e=Et.join(si()||ai(),".velu");return Et.join(e,"update-check.json")}function Bn(){try{return JSON.parse(Jn(qn(),"utf8"))}catch{return null}}function fi(e){try{let t=qn();oi(Et.dirname(t),{recursive:!0}),ri(t,JSON.stringify(e))}catch{}}async function mi(){let e=`${li}/-/package/${Ze}/dist-tags`,t=new AbortController,r=setTimeout(()=>t.abort(),ui);try{let n=await fetch(e,{signal:t.signal,headers:{accept:"application/json"}});if(!n.ok)return null;let o=await n.json();return o&&typeof o.latest=="string"?o.latest:null}catch{return null}finally{clearTimeout(r)}}async function Pt({force:e=!1}={}){if(!e){let r=Bn();if(r?.latest&&Date.now()-(r.checkedAt||0)<ci)return r.latest}let t=await mi();return t?(fi({latest:t,checkedAt:Date.now()}),t):Bn()?.latest??null}function Gn(){let e=Q.env.npm_config_user_agent||"";if(e.startsWith("pnpm"))return"pnpm";if(e.startsWith("yarn"))return"yarn";if(e.startsWith("bun"))return"bun";let t="";try{t=ii(import.meta.url).replace(/\\/g,"/")}catch{}return t.includes("/pnpm/")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")?"yarn":t.includes("/.bun/")?"bun":"npm"}function di(e){let t=`${Ze}@latest`;switch(e){case"pnpm":return["pnpm",["add","-g",t]];case"yarn":return["yarn",["global","add",t]];case"bun":return["bun",["add","-g",t]];default:return["npm",["install","-g",t]]}}function Wn(e){let[t,r]=di(e);return Dn(t,r,{stdio:"inherit",shell:Q.platform==="win32"}).status===0}async function gi(){let e=Ct(),t=await Pt({force:!0});if(t&&!Lt(t,e)){console.log(`velu is already up to date (v${e}).`);return}let r=Gn();console.log(t?`Updating velu ${e} \u2192 ${t} (via ${r})\u2026`:`Could not reach the npm registry; installing ${Ze}@latest (via ${r}) anyway\u2026`),Wn(r)?console.log('\u2713 Updated. Run "velu version" to confirm.'):(console.error("Update failed. You can update manually with:"),console.error(` npm install -g ${Ze}@latest`),Q.exitCode=1)}async function hi(){if(Q.env.VELU_NO_UPDATE==="1"||Q.env.VELU_UPDATED==="1"||!Q.stdout.isTTY)return;let e=Ct();if(e==="unknown")return;let t=null;try{t=await Pt()}catch{return}if(!Lt(t,e))return;let r=Gn();if(console.log(`
87
+ New velu version available: ${e} \u2192 ${t}. Updating\u2026`),!Wn(r)){console.log("Auto-update failed; continuing on the current version. Run `velu update` to retry.\n");return}console.log(`Restarting on the new version\u2026
88
+ `);let n=Dn(Q.execPath,Q.argv.slice(1),{stdio:"inherit",env:{...Q.env,VELU_UPDATED:"1"}});Q.exit(n.status??0)}var Ze,li,ci,ui,Rt=_(()=>{Ze="@veluai/velu",li="https://registry.npmjs.org",ci=720*60*1e3,ui=3e3});import yi from"node:fs/promises";import Qe from"node:path";function Kn(e){if(!e.favicon)return null;let t=Qe.extname(e.favicon).toLowerCase();return{url:Ut+t,type:Hn[t]||""}}function Ft(e,t){let r=e.logo?.[t];if(!r)return null;let n=Qe.extname(r).toLowerCase();return{url:(t==="dark"?Re:_e)+n,type:Hn[n]||""}}function Ue(e){if(typeof e=="string"){let t=e.trim();return t?{light:t,dark:t,href:"/"}:null}if(e&&typeof e=="object"){let t=(e.light??e.dark)?.trim?.(),r=(e.dark??e.light)?.trim?.();return!t||!r?null:{light:t,dark:r,href:e.href?.trim?.()||"/"}}return null}function bi(e){return!e||typeof e!="object"?{metatags:{},indexing:"navigable"}:{metatags:e.metatags&&typeof e.metatags=="object"?e.metatags:{},indexing:e.indexing==="all"?"all":"navigable"}}function Nt(e={},t){let r=e.colors?.primary??vi;return{name:e.name??t??"docs",theme:Oe(e.theme),url:typeof process.env.VELU_SITE_URL=="string"&&process.env.VELU_SITE_URL.trim()?process.env.VELU_SITE_URL.trim().replace(/\/+$/,""):null,seo:bi(e.seo),assistant:Ce(e.assistant),thumbnails:e.thumbnails&&typeof e.thumbnails=="object"&&typeof e.thumbnails.background=="string"?{background:e.thumbnails.background}:null,colors:{primary:r,...["thulir","aalam","nila","kadhir"].includes(e.theme)?{cta:e.colors?.dark??r}:{},light:e.theme==="vepa"||["thulir","aalam","nila","kadhir"].includes(e.theme)?r:e.colors?.light??r,dark:e.theme==="vepa"||["thulir","aalam","nila","kadhir"].includes(e.theme)?e.colors?.light??r:e.colors?.dark??r},favicon:e.favicon??null,api:Y(e.api),logo:Ue(e.logo),footer:Te(e.footer),navbar:Ee(e.navbar),font:{family:Ln(e)},navigation:e.navigation??null}}async function Xn(e){let t=Qe.join(e,"velu.json"),r;try{r=await yi.readFile(t,"utf-8")}catch(o){throw o.code==="ENOENT"?new Error(`No velu.json found in ${e}. Run \`velu init <name>\` to scaffold one.`):o}let n;try{n=JSON.parse(r)}catch(o){throw new Error(`velu.json is not valid JSON: ${o.message}`)}return Nt(n,Qe.basename(e))}function Yn(e){let{colors:t,font:r}=e;return jt({light:t.light,dark:t.dark,family:r.family,theme:e.theme,primary:t.primary,cta:t.cta})}var vi,_e,Re,Ut,Hn,Fe=_(()=>{Le();Le();vi="#dc143c",_e="/@velu-logo-light",Re="/@velu-logo-dark",Ut="/@velu-favicon",Hn={".svg":"image/svg+xml",".ico":"image/x-icon",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif"}});import{visit as Zn}from"unist-util-visit";import{toString as xi}from"mdast-util-to-string";import wi from"github-slugger";import{valueToEstree as $i}from"estree-util-value-to-estree";function Si(e,t){let r=a=>String(a||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),n=r(e),o=t==null||t===""?"":r(t);return`update-${o?n?`${n}-${o}`:o:n||"item"}`}function It(e,t){let r=(e.attributes||[]).find(n=>n&&n.type==="mdxJsxAttribute"&&n.name===t);if(r)return typeof r.value=="string"?r.value:void 0}function ki(e){let t=(e.attributes||[]).find(a=>a&&a.type==="mdxJsxAttribute"&&a.name==="tags");if(!t)return[];if(typeof t.value=="string")return[t.value];let r=t.value&&t.value.value?String(t.value.value):"",n=[],o=/["'`]([^"'`]+)["'`]/g,i;for(;i=o.exec(r);)n.push(i[1]);return n}function Ne(){return e=>{let t=new wi,r=[];Zn(e,"heading",l=>{let c=xi(l);r.push({depth:l.depth,id:t.slug(c),label:c})});let n=[],o=[],i=new Set;if(Zn(e,"mdxJsxFlowElement",l=>{if(l.name!=="Update")return;let c=It(l,"label")??It(l,"date"),u=It(l,"description");c&&n.push({id:Si(c,u),label:u||c});for(let p of ki(l)){let y=p.trim().toLowerCase();p.trim()&&!i.has(y)&&(i.add(y),o.push(p.trim()))}}),n.length){Qn(e,n),Mt(e,"changelog",{tags:o});return}let a={children:[]},s=[{node:a,depth:0}];for(let l of r){for(;s.length>1&&s[s.length-1].depth>=l.depth;)s.pop();let c={id:l.id,label:l.label},u=s[s.length-1].node;u.children||(u.children=[]),u.children.push(c),s.push({node:c,depth:l.depth})}Qn(e,a.children),Mt(e,"changelog",null)}}function Qn(e,t){Mt(e,"toc",t)}function Mt(e,t,r){e.children.unshift({type:"mdxjsEsm",value:"",data:{estree:{type:"Program",sourceType:"module",body:[{type:"ExportNamedDeclaration",specifiers:[],declaration:{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:t},init:$i(r)}]}}]}}})}var zt=_(()=>{});import{visit as ji}from"unist-util-visit";function Vt(){return e=>{ji(e,"code",t=>{let r=(t.meta||"").trim();if(!r)return;let n={},o=r.match(/\btitle="([^"]*)"/);o&&(n["data-title"]=o[1],r=(r.slice(0,o.index)+r.slice(o.index+o[0].length)).trim());let i=r.match(/\{([\d,\s-]+)\}/);i&&(n["data-highlight"]=i[1].replace(/\s+/g,""),r=(r.slice(0,i.index)+r.slice(i.index+i[0].length)).trim()),r=r.replace(/\blineNumbers\b/,()=>(n["data-line-numbers"]="","")).trim(),r&&(n["data-filename"]=r),Object.keys(n).length&&(t.data=t.data||{},t.data.hProperties={...t.data.hProperties||{},...n})})}}var er=_(()=>{});import Ai from"node:fs";import tr from"node:path";function ae(e,t){let r=[],n=[],o=new Set;for(let i of ne(e)){if(i.node?.api){o.add(i.url);continue}if(o.has(i.url)){r.push(`duplicate URL "${i.url}" (page "${i.pagePath}") \u2014 keeping the first occurrence`);continue}o.add(i.url);let a=i.pagePath.replace(/^\/+|\/+$/g,""),s=tr.join(t,...a.split("/"))+".mdx",l=Ai.existsSync(s);l||r.push(`page "${i.pagePath}" \u2192 ${tr.relative(t,s)} not found`),n.push({pagePath:i.pagePath,url:i.url,fileAbsPath:s,exists:l})}return{pageEntries:n,warnings:r}}var Ie=_(()=>{re()});import Oi from"@apidevtools/swagger-parser";async function Ti(e){return Oi.dereference(e)}async function nr(e){return Ae(await Ti(e))}var rr=_(()=>{Ke();Ke()});function or(e,t){if(!t||typeof t!="object")return e;let r=Y(t);return{server:t.server!=null?r.server:e?.server??null,proxy:t.playground!=null?r.proxy:e?.proxy!==!1,languages:t.examples?.languages!=null?r.languages:e?.languages}}function Ei(e,{base:t,api:r,ops:n}){let o=r?.server,i=r?.languages||$t,a={proxy:r?.proxy!==!1,server:o??null},s=new Map;for(let c of e){let u=c.op.tags?.[0]||"API";s.has(u)||s.set(u,[]),s.get(u).push(c)}let l=[];for(let[c,u]of s){let p=u.map(({op:y,segment:m})=>{let g=`${t}/${Bt(c)}/${y.id}`;return n[g]={operation:y,samples:Xe(y,{server:o||y.servers?.[0],languages:i}),segment:m,title:y.title,description:y.description,method:y.method,api:a},{apiPage:g,label:y.title,method:y.method}});l.push({group:c,pages:p})}return l}async function ir(e,{loadOps:t,base:r,api:n,ops:o}){let i=Array.isArray(e)?e:[e],a=[];for(let s of i){let{operations:l,segments:c,servers:u}=await t(s);l.forEach((p,y)=>{!p.servers?.length&&u?.length&&(p.servers=u),a.push({op:p,segment:c[y]})})}return Ei(a,{base:r,api:n,ops:o})}async function sr(e,t){if(!e||typeof e!="object")return e;if(typeof e.tab=="string"&&e.openapi){let n=Bt(e.tab),o=or(t.api,e.api),i=await ir(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e;return{...l,groups:[...l.groups||[],...i]}}if(typeof e.group=="string"&&e.openapi){let n=Bt(e.group),o=or(t.api,e.api),i=await ir(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e,c=i.flatMap(u=>u.pages);return{...l,pages:[...l.pages||[],...c]}}let r={...e};for(let n of["products","versions","languages","tabs","groups"])Array.isArray(e[n])&&(r[n]=await Promise.all(e[n].map(o=>sr(o,t))));return r}async function ar(e,{api:t,loadOps:r}){let n={};return!e||typeof e!="object"?{nav:e,ops:n}:{nav:await sr(e,{api:t,loadOps:r,ops:n}),ops:n}}var Bt,lr=_(()=>{Le();St();Bt=e=>String(e??"").replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()||"x"});import Ci from"node:path";function Li(e,t){return/^https?:\/\//.test(e)?e:Ci.resolve(t,e.replace(/^\/+/,""))}async function et(e,{targetDir:t,api:r}={}){return ar(e,{api:r,loadOps:n=>nr(Li(n,t))})}var Dt=_(()=>{rr();lr()});import ur from"node:fs";import ye from"node:path";import{createHash as Pi}from"node:crypto";function Me(e,{outDir:t}={}){let r=ye.resolve(e),n=t?ye.resolve(t):null,o=[],i=[],a=l=>{let c;try{c=ur.readdirSync(l,{withFileTypes:!0})}catch{return}for(let u of c){let p=ye.join(l,u.name);if(u.isDirectory()){if(u.name.startsWith(".")||Ri.has(u.name)||n&&p===n)continue;a(p);continue}if(!u.isFile())continue;let y=ye.extname(u.name).toLowerCase();if(y!==cr&&y!==_i)continue;let m=ye.relative(r,p).split(ye.sep).join("/"),g={rel:m,abs:p,url:`${tt}/${m.split("/").map(encodeURIComponent).join("/")}?v=${Ui(p)}`,kind:y===cr?"css":"js"};(g.kind==="css"?o:i).push(g)}};a(r);let s=(l,c)=>l.rel<c.rel?-1:l.rel>c.rel?1:0;return o.sort(s),i.sort(s),{styles:o,scripts:i}}function Ui(e){try{return Pi("sha1").update(ur.readFileSync(e)).digest("hex").slice(0,8)}catch{return"0"}}function pr(e,t){let r=`${tt}/`;if(!t.startsWith(r))return null;let n;try{n=decodeURIComponent(t.slice(r.length))}catch{return null}return[...e.styles,...e.scripts].find(o=>o.rel===n)??null}function fr(e,t=""){return(e?.styles??[]).map(r=>`<link rel="stylesheet" href="${Fi(t+r.url)}" data-velu-custom />`).join(`
89
+ `)}var tt,cr,_i,Ri,Fi,Jt=_(()=>{tt="/@velu-custom",cr=".css",_i=".js",Ri=new Set(["node_modules","public","dist"]);Fi=e=>String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")});import Ni from"node:fs";import ze from"node:path";function gr(e,{buildOutDir:t}={}){return{name:"velu-site",resolveId(r){return r===dr?mr:null},async load(r){return r!==mr?null:Ii(e,{buildOutDir:t})}}}async function Ii(e,{buildOutDir:t}={}){let r={};try{r=JSON.parse(Ni.readFileSync(ze.join(e,"velu.json"),"utf-8"))}catch{}let n=Y(r.api),o=r.navigation??{},i={};try{let x=await et(r.navigation??{},{targetDir:e,api:n});o=x.nav,i=x.ops}catch(x){console.warn(`[velu] openapi: ${x.message}`)}let a=X(o),{pageEntries:s,warnings:l}=ae(a,e);for(let x of l)console.warn(`[velu] nav: ${x}`);let c=Ue(r.logo),u={name:r.name??ze.basename(e),theme:Oe(r.theme),logo:c?{light:Ft({logo:c},"light")?.url??_e,dark:Ft({logo:c},"dark")?.url??Re,href:c.href,mono:c.light===c.dark}:null,footer:Te(r.footer),navbar:Ee(r.navbar),contextual:At(r.contextual??(["thulir","aalam","nila","kadhir"].includes(r.theme)?{options:[]}:void 0)),assistant:Ce(r.assistant),customScripts:Me(e,{outDir:t}).scripts.map(x=>x.url)},p=[],y=[],m=0;for(let x of s){if(!x.exists)continue;let w=JSON.stringify(x.fileAbsPath.split(ze.sep).join("/")),L=JSON.stringify(ze.relative(e,x.fileAbsPath).split(ze.sep).join("/")),P=`__p${m++}`;p.push(`import * as ${P} from ${w};`),y.push(` ${JSON.stringify(x.url)}: { Component: ${P}.default, frontmatter: ${P}.frontmatter, toc: ${P}.toc, changelog: ${P}.changelog, relPath: ${L}, ...__mdxApi(${P}) },`)}let g=new Set(s.filter(x=>x.exists).map(x=>x.url));for(let x of s)!x.exists&&!g.has(x.url)&&y.push(` ${JSON.stringify(x.url)}: { missing: true },`);let v=[],d=[],h=[],S=!1,O=0;for(let x of ne(a)){if(!x.node?.api)continue;let w=i[x.pagePath];if(!w)continue;S=!0;let L=`__op${O}`,P=`__samples${O}`,B=`__api${O}`;O+=1,v.push(`const ${L} = ${JSON.stringify(w.operation)};`),v.push(`const ${P} = ${JSON.stringify(w.samples)};`),h.push(`{ id: ${JSON.stringify(w.operation.id)}, method: ${JSON.stringify(w.operation.method)}, title: ${JSON.stringify(w.operation.title)}, url: ${JSON.stringify(x.url)}, operation: ${L}, samples: ${P}, api: ${JSON.stringify(w.api||{proxy:!0,server:null})} }`),d.push(`function ${B}(){ return React.createElement(ApiReferencePage, { preset: ${JSON.stringify(u.theme)}, operation: ${L}, samples: ${P}, apiOperations: __apiOperations, api: ${JSON.stringify(w.api||{proxy:!0,server:null})} }); }`),y.push(` ${JSON.stringify(x.url)}: { Component: ${B}, frontmatter: { title: ${JSON.stringify(w.title)}, description: ${JSON.stringify(w.description)} }, toc: [], operation: ${L}, samples: ${P}, api: true },`)}S&&(v.push(`const __apiOperations = [
90
90
  ${h.join(`,
91
91
  `)}
92
92
  ];`),v.push(d.join(`
@@ -95,17 +95,17 @@ ${h.join(`,
95
95
  `),"function __mdxApi(mod) { const data = Reflect.get(mod, 'veluApi'); return data?.operation ? { mdxApi: data, api: true, operation: data.operation, samples: data.samples } : {}; }",v.join(`
96
96
  `),"","export const pages = {",y.join(`
97
97
  `),"};",`export const navigation = ${JSON.stringify(a)};`,`export const site = ${JSON.stringify(u)};`,"if (site.logo) {"," const __veluBase = (import.meta.env.BASE_URL || '/').replace(/\\/$/, '');"," site.logo = { ...site.logo, light: __veluBase + site.logo.light, dark: __veluBase + site.logo.dark };","}",""].join(`
98
- `)}var fr,pr,dr=_(()=>{re();Fe();Re();Bt();Dt();fr="virtual:velu-site",pr="\0"+fr});import tt from"node:path";function gr(e){let t=tt.resolve(e);return{name:"velu-tailwind-project-source",enforce:"pre",transform(r,n){let o=n.split("?",1)[0].replace(/\\/g,"/");if(!o.endsWith("/styles.css")||!o.includes("/velu-ui/")||r.includes("data-velu-project-source"))return null;let i=tt.dirname(n.split("?",1)[0]),a=tt.relative(i,t).split(tt.sep).join("/");!a||a===""?a=".":a.startsWith(".")||(a=`./${a}`);let s=`
98
+ `)}var dr,mr,hr=_(()=>{re();Ie();Fe();Dt();Jt();dr="virtual:velu-site",mr="\0"+dr});import nt from"node:path";function yr(e){let t=nt.resolve(e);return{name:"velu-tailwind-project-source",enforce:"pre",transform(r,n){let o=n.split("?",1)[0].replace(/\\/g,"/");if(!o.endsWith("/styles.css")||!o.includes("/velu-ui/")||r.includes("data-velu-project-source"))return null;let i=nt.dirname(n.split("?",1)[0]),a=nt.relative(i,t).split(nt.sep).join("/");!a||a===""?a=".":a.startsWith(".")||(a=`./${a}`);let s=`
99
99
  /* data-velu-project-source */
100
100
  @source "${a}/**/*.{mdx,md,jsx,tsx,js,ts,html}";
101
101
  @source not "${a}/node_modules";
102
102
  @source not "${a}/.velu";
103
103
  @source not "${a}/dist";
104
104
  @source not "${a}/.git";
105
- `;return{code:r+s,map:null}}}}var hr=_(()=>{});import{visit as Ii}from"unist-util-visit";function Mi(e,t){let r=yr(e).replace(/[?#].*$/,""),n=yr(t).replace(/\/+$/,"");return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):null}function vr(e,t){return()=>(r,n)=>{typeof e=="function"&&Ii(r,o=>{if(o.type!=="mdxJsxFlowElement"&&o.type!=="mdxJsxTextElement"||typeof o.name!="string"||!/^[A-Z]/.test(o.name)||o.name.includes("."))return;let i={};for(let s of o.attributes||[])s.type==="mdxJsxAttribute"&&(s.value==null?i[s.name]=!0:typeof s.value=="string"&&(i[s.name]=s.value));let a=e(o.name,i,{checkRequired:!1});if(a){let s=new Error(a.title);throw s.veluIssue={...a,file:Mi(n?.path,t),line:o.position?.start?.line??null,column:o.position?.start?.column??null},s.loc={line:s.veluIssue.line,column:s.veluIssue.column},s}})}}var yr,br=_(()=>{yr=e=>String(e||"").replace(/\\/g,"/")});import nt from"node:path";import zi from"node:fs";import{createRequire as Vi}from"node:module";import Bi from"@tailwindcss/vite";import Di from"@vitejs/plugin-react";import Ji from"@mdx-js/rollup";import qi from"remark-frontmatter";import Gi from"remark-mdx-frontmatter";import Wi from"remark-gfm";import Hi from"rehype-slug";function Ki(e){let r=Vi(import.meta.url).resolve("@mdx-js/react"),n=nt.resolve(e,"runtime","velu-ui"),o=zi.existsSync(n)?n:nt.resolve(e,"..","velu-ui","src");return[{find:"@mdx-js/react",replacement:r},{find:/^velu-ui$/,replacement:nt.join(o,"index.js")},{find:/^velu-ui\//,replacement:o+"/"}]}function xr({targetDir:e,VITE_ROOT:t,validateProps:r,basePath:n,buildOutDir:o}){return{root:t,base:n?`${n}/`:"/",plugins:[mr(e,{buildOutDir:o}),Ji({remarkPlugins:[qi,Gi,Wi,zt,Ue,vr(r,e)],rehypePlugins:[Hi],providerImportSource:"@mdx-js/react"}),Di(),gr(e),Bi({optimize:!1})],cacheDir:nt.resolve(e,".velu","vite-cache"),optimizeDeps:{include:["react","react-dom","react-dom/client","react-router-dom","@mdx-js/react","lucide-react","prism-react-renderer","iso-639-1","github-slugger"],exclude:["tailwindcss","@tailwindcss/oxide","playwright","playwright-core","@apidevtools/swagger-parser","satori","@resvg/resvg-js","pagefind"],esbuildOptions:{loader:{".mdx":"jsx"}}},resolve:{alias:Ki(t),dedupe:["react","react-dom","@mdx-js/react"]}}}var wr=_(()=>{Mt();Zn();dr();hr();br()});function I(e){return{category:"render-crash",severity:"error",file:null,line:null,column:null,frame:null,title:"Something went wrong",detail:"",hint:"",suggestion:null,...e}}function Xi(e,t){if(e=String(e),t=String(t),e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let r=Array.from({length:t.length+1},(o,i)=>i),n=new Array(t.length+1);for(let o=1;o<=e.length;o++){n[0]=o;for(let i=1;i<=t.length;i++){let a=e[o-1]===t[i-1]?0:1;n[i]=Math.min(n[i-1]+1,r[i]+1,r[i-1]+a)}[r,n]=[n,r]}return r[t.length]}function rt(e,t=[]){if(!e)return null;let r=String(e).toLowerCase(),n=null,o=1/0;for(let a of t){let s=Xi(r,String(a).toLowerCase());s<o&&(o=s,n=a)}let i=Math.min(3,Math.max(2,Math.floor(r.length/4)));return o<=i?n:null}function Yi(e,t){return e==="warning"?Z(t,H.yellow,"\u26A0"):e==="info"?Z(t,H.cyan,"\u2139"):Z(t,H.red,"\u2716")}function qt(e,{color:t=!1}={}){let r=Jt[e.category]||e.category,n=e.line?`${e.line}${e.column?`:${e.column}`:""}`:"",o=e.file?`${e.file}${n?`:${n}`:""}`:n,i=[];if(i.push(`${Yi(e.severity,t)} ${Z(t,H.bold,r)}`+(o?` ${Z(t,H.dim,o)}`:"")),e.title&&i.push(` ${e.title}`),e.detail&&e.detail!==e.title&&i.push(` ${Z(t,H.dim,e.detail)}`),e.frame)for(let a of String(e.frame).split(`
105
+ `;return{code:r+s,map:null}}}}var vr=_(()=>{});import{visit as Mi}from"unist-util-visit";function zi(e,t){let r=br(e).replace(/[?#].*$/,""),n=br(t).replace(/\/+$/,"");return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):null}function xr(e,t){return()=>(r,n)=>{typeof e=="function"&&Mi(r,o=>{if(o.type!=="mdxJsxFlowElement"&&o.type!=="mdxJsxTextElement"||typeof o.name!="string"||!/^[A-Z]/.test(o.name)||o.name.includes("."))return;let i={};for(let s of o.attributes||[])s.type==="mdxJsxAttribute"&&(s.value==null?i[s.name]=!0:typeof s.value=="string"&&(i[s.name]=s.value));let a=e(o.name,i,{checkRequired:!1});if(a){let s=new Error(a.title);throw s.veluIssue={...a,file:zi(n?.path,t),line:o.position?.start?.line??null,column:o.position?.start?.column??null},s.loc={line:s.veluIssue.line,column:s.veluIssue.column},s}})}}var br,wr=_(()=>{br=e=>String(e||"").replace(/\\/g,"/")});import rt from"node:path";import Vi from"node:fs";import{createRequire as Bi}from"node:module";import Di from"@tailwindcss/vite";import Ji from"@vitejs/plugin-react";import qi from"@mdx-js/rollup";import Gi from"remark-frontmatter";import Wi from"remark-mdx-frontmatter";import Hi from"remark-gfm";import Ki from"rehype-slug";function Xi(e){let r=Bi(import.meta.url).resolve("@mdx-js/react"),n=rt.resolve(e,"runtime","velu-ui"),o=Vi.existsSync(n)?n:rt.resolve(e,"..","velu-ui","src");return[{find:"@mdx-js/react",replacement:r},{find:/^velu-ui$/,replacement:rt.join(o,"index.js")},{find:/^velu-ui\//,replacement:o+"/"}]}function $r({targetDir:e,VITE_ROOT:t,validateProps:r,basePath:n,buildOutDir:o}){return{root:t,base:n?`${n}/`:"/",plugins:[gr(e,{buildOutDir:o}),qi({remarkPlugins:[Gi,Wi,Hi,Vt,Ne,xr(r,e)],rehypePlugins:[Ki],providerImportSource:"@mdx-js/react"}),Ji(),yr(e),Di({optimize:!1})],cacheDir:rt.resolve(e,".velu","vite-cache"),optimizeDeps:{include:["react","react-dom","react-dom/client","react-router-dom","@mdx-js/react","lucide-react","prism-react-renderer","iso-639-1","github-slugger"],exclude:["tailwindcss","@tailwindcss/oxide","playwright","playwright-core","@apidevtools/swagger-parser","satori","@resvg/resvg-js","pagefind"],esbuildOptions:{loader:{".mdx":"jsx"}}},resolve:{alias:Xi(t),dedupe:["react","react-dom","@mdx-js/react"]}}}var Sr=_(()=>{zt();er();hr();vr();wr()});function I(e){return{category:"render-crash",severity:"error",file:null,line:null,column:null,frame:null,title:"Something went wrong",detail:"",hint:"",suggestion:null,...e}}function Yi(e,t){if(e=String(e),t=String(t),e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let r=Array.from({length:t.length+1},(o,i)=>i),n=new Array(t.length+1);for(let o=1;o<=e.length;o++){n[0]=o;for(let i=1;i<=t.length;i++){let a=e[o-1]===t[i-1]?0:1;n[i]=Math.min(n[i-1]+1,r[i]+1,r[i-1]+a)}[r,n]=[n,r]}return r[t.length]}function ot(e,t=[]){if(!e)return null;let r=String(e).toLowerCase(),n=null,o=1/0;for(let a of t){let s=Yi(r,String(a).toLowerCase());s<o&&(o=s,n=a)}let i=Math.min(3,Math.max(2,Math.floor(r.length/4)));return o<=i?n:null}function Zi(e,t){return e==="warning"?Z(t,H.yellow,"\u26A0"):e==="info"?Z(t,H.cyan,"\u2139"):Z(t,H.red,"\u2716")}function Gt(e,{color:t=!1}={}){let r=qt[e.category]||e.category,n=e.line?`${e.line}${e.column?`:${e.column}`:""}`:"",o=e.file?`${e.file}${n?`:${n}`:""}`:n,i=[];if(i.push(`${Zi(e.severity,t)} ${Z(t,H.bold,r)}`+(o?` ${Z(t,H.dim,o)}`:"")),e.title&&i.push(` ${e.title}`),e.detail&&e.detail!==e.title&&i.push(` ${Z(t,H.dim,e.detail)}`),e.frame)for(let a of String(e.frame).split(`
106
106
  `))i.push(` ${a}`);return e.suggestion&&i.push(` ${Z(t,H.cyan,`Did you mean <${e.suggestion}>?`)}`),e.hint&&i.push(` ${Z(t,H.dim,`\u2192 ${e.hint}`)}`),i.join(`
107
- `)}function ot(e,{color:t=!1}={}){if(!e.length)return Z(t,H.cyan,"\u2713 No issues found.");let r=new Map;for(let s of e){let l=s.file||"velu.json";r.has(l)||r.set(l,[]),r.get(l).push(s)}let n=[];for(let[s,l]of r){n.push(Z(t,H.bold,s));for(let c of l)n.push(qt({...c,file:null},{color:t}).replace(/^/gm," "));n.push("")}let o=e.filter(s=>s.severity!=="warning"&&s.severity!=="info").length,i=e.length-o,a=`${o} error${o===1?"":"s"}`+(i?`, ${i} warning${i===1?"":"s"}`:"");return n.push(Z(t,o?H.red:H.yellow,a)),n.join(`
108
- `)}var Jt,H,Z,ue=_(()=>{Jt={"mdx-syntax":"MDX syntax",frontmatter:"Frontmatter","unknown-component":"Unknown component","invalid-props":"Invalid options","render-crash":"Render error","config-json":"velu.json","config-schema":"velu.json","config-nav":"Navigation","config-asset":"Asset"};H={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},Z=(e,t,r)=>e?`${t}${r}${H.reset}`:r});function Zi(e){let t=e,r=0;for(;t&&t.cause&&r<3&&!(t.loc||t.line||/`[^`]+` to be defined/.test(t.message||""));)t=t.cause,r+=1;return t||e}function Gt(e,t){if(!e)return null;let r=$r(e).replace(/[?#].*$/,""),n=t?$r(t).replace(/\/+$/,""):"";return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):!/^([a-zA-Z]:\/|\/)/.test(r)&&!/node_modules/.test(r)?r:null}function Qi(e){return e?String(e).replace(/([a-zA-Z]:\\|\/)[^\s'"()]+/g,t=>/node_modules|[\\/]vite[\\/]|@veluai|velu-cli|velu-ui/.test(t)?"\u2026":t).trim():""}function es(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function ts(e){return String(e||"").replace(/\s*\(\d+:\d+(?:-\d+:\d+)?\)\s*$/,"").trim()}function rs(e,t){if(!e||!t)return null;let r=String(e);return/node_modules|[\\/]vite[\\/]|@veluai[\\/]/.test(r)?null:r}function Me(e,t={}){let{projectDir:r="",knownComponents:n=[],file:o=null}=t,i=null;for(let h=e,S=0;h&&S<6;h=h.cause,S+=1)if(h.veluIssue){i=h.veluIssue;break}if(i)return I({...i,file:i.file||o});let a=Zi(e)||{},s=a.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(s);if(l){let h=l[1],S=/referenced in your code at `(\d+):(\d+)/.exec(s),O=/\bin `([^`]+)`/.exec(s),A=O?Gt(O[1],r):null;return I({category:"unknown-component",file:A||o,line:S?Number(S[1]):null,column:S?Number(S[2]):null,title:`<${h}> is not a built-in component`,detail:"",hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:rt(h,n)})}let c=a.loc||(a.line!=null?{line:a.line,column:a.column,file:a.file}:null)||es(a.reason||s),u=a.id||c&&c.file||a.file||null,p=Gt(u,r)||o,y=!!p&&Gt(u,r)!=null,m=rs(a.frame,y||!!o),g=Qi(ts(a.reason||s)),v=ns.test(s),d=a.source==="remark-frontmatter"||/\byaml\b|frontmatter/i.test(s)||c&&c.line===1&&/unexpected|expected/i.test(s)&&/---/.test(s);return c||v||m&&y?I({category:d?"frontmatter":"mdx-syntax",file:p,line:c?c.line:null,column:c?c.column:null,frame:m,title:g||(d?"Invalid frontmatter":"MDX syntax error"),detail:"",hint:d?"Check the YAML between the --- markers \u2014 indentation, quotes, and colons.":"Make sure every <Component> has a matching closing tag and that { } braces are balanced."}):/\.map is not a function|is not iterable|reading '|undefined \(reading/i.test(s)?I({category:"invalid-props",file:p,title:"A component received an invalid value",detail:g,hint:"Check the props/options you passed to a component on this page."}):I({category:"render-crash",file:p,title:"This page failed to render",detail:g,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var $r,ns,Wt=_(()=>{ue();$r=e=>String(e).replace(/\\/g,"/");ns=/closing tag|unexpected closing|could not parse (?:expression|import|export)|unexpected character|unexpected end of|expected a closing|expected the closing|unexpected `|in expression|misnested|before name/i});function os(e){let t=Jt[e.category]||e.category,r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",n=[];return n.push('<div class="velu-err-card">'),n.push('<div class="velu-err-head">'),n.push(`<span class="velu-err-pill">${oe(t)}</span>`),n.push("</div>"),e.title&&n.push(`<div class="velu-err-title">${oe(e.title)}</div>`),r&&n.push(`<a class="velu-err-loc" title="${oe(r)}">${oe(r)}</a>`),e.detail&&n.push(`<div class="velu-err-detail">${oe(e.detail)}</div>`),e.frame&&n.push(`<pre class="velu-err-frame">${oe(e.frame)}</pre>`),e.suggestion&&n.push(`<div class="velu-err-suggest">Did you mean <code>&lt;${oe(e.suggestion)}&gt;</code>?</div>`),e.hint&&n.push(`<div class="velu-err-hint">${oe(e.hint)}</div>`),n.push("</div>"),n.join("")}function Ht(e,t={}){let r=Array.isArray(e)?e:[e],n=t.title||(r.length>1?`${r.length} problems to fix`:"There\u2019s a problem to fix"),o=r.map(os).join(`
107
+ `)}function it(e,{color:t=!1}={}){if(!e.length)return Z(t,H.cyan,"\u2713 No issues found.");let r=new Map;for(let s of e){let l=s.file||"velu.json";r.has(l)||r.set(l,[]),r.get(l).push(s)}let n=[];for(let[s,l]of r){n.push(Z(t,H.bold,s));for(let c of l)n.push(Gt({...c,file:null},{color:t}).replace(/^/gm," "));n.push("")}let o=e.filter(s=>s.severity!=="warning"&&s.severity!=="info").length,i=e.length-o,a=`${o} error${o===1?"":"s"}`+(i?`, ${i} warning${i===1?"":"s"}`:"");return n.push(Z(t,o?H.red:H.yellow,a)),n.join(`
108
+ `)}var qt,H,Z,ue=_(()=>{qt={"mdx-syntax":"MDX syntax",frontmatter:"Frontmatter","unknown-component":"Unknown component","invalid-props":"Invalid options","render-crash":"Render error","config-json":"velu.json","config-schema":"velu.json","config-nav":"Navigation","config-asset":"Asset"};H={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},Z=(e,t,r)=>e?`${t}${r}${H.reset}`:r});function Qi(e){let t=e,r=0;for(;t&&t.cause&&r<3&&!(t.loc||t.line||/`[^`]+` to be defined/.test(t.message||""));)t=t.cause,r+=1;return t||e}function Wt(e,t){if(!e)return null;let r=kr(e).replace(/[?#].*$/,""),n=t?kr(t).replace(/\/+$/,""):"";return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):!/^([a-zA-Z]:\/|\/)/.test(r)&&!/node_modules/.test(r)?r:null}function es(e){return e?String(e).replace(/([a-zA-Z]:\\|\/)[^\s'"()]+/g,t=>/node_modules|[\\/]vite[\\/]|@veluai|velu-cli|velu-ui/.test(t)?"\u2026":t).trim():""}function ts(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function ns(e){return String(e||"").replace(/\s*\(\d+:\d+(?:-\d+:\d+)?\)\s*$/,"").trim()}function os(e,t){if(!e||!t)return null;let r=String(e);return/node_modules|[\\/]vite[\\/]|@veluai[\\/]/.test(r)?null:r}function Ve(e,t={}){let{projectDir:r="",knownComponents:n=[],file:o=null}=t,i=null;for(let h=e,S=0;h&&S<6;h=h.cause,S+=1)if(h.veluIssue){i=h.veluIssue;break}if(i)return I({...i,file:i.file||o});let a=Qi(e)||{},s=a.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(s);if(l){let h=l[1],S=/referenced in your code at `(\d+):(\d+)/.exec(s),O=/\bin `([^`]+)`/.exec(s),A=O?Wt(O[1],r):null;return I({category:"unknown-component",file:A||o,line:S?Number(S[1]):null,column:S?Number(S[2]):null,title:`<${h}> is not a built-in component`,detail:"",hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:ot(h,n)})}let c=a.loc||(a.line!=null?{line:a.line,column:a.column,file:a.file}:null)||ts(a.reason||s),u=a.id||c&&c.file||a.file||null,p=Wt(u,r)||o,y=!!p&&Wt(u,r)!=null,m=os(a.frame,y||!!o),g=es(ns(a.reason||s)),v=rs.test(s),d=a.source==="remark-frontmatter"||/\byaml\b|frontmatter/i.test(s)||c&&c.line===1&&/unexpected|expected/i.test(s)&&/---/.test(s);return c||v||m&&y?I({category:d?"frontmatter":"mdx-syntax",file:p,line:c?c.line:null,column:c?c.column:null,frame:m,title:g||(d?"Invalid frontmatter":"MDX syntax error"),detail:"",hint:d?"Check the YAML between the --- markers \u2014 indentation, quotes, and colons.":"Make sure every <Component> has a matching closing tag and that { } braces are balanced."}):/\.map is not a function|is not iterable|reading '|undefined \(reading/i.test(s)?I({category:"invalid-props",file:p,title:"A component received an invalid value",detail:g,hint:"Check the props/options you passed to a component on this page."}):I({category:"render-crash",file:p,title:"This page failed to render",detail:g,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var kr,rs,Ht=_(()=>{ue();kr=e=>String(e).replace(/\\/g,"/");rs=/closing tag|unexpected closing|could not parse (?:expression|import|export)|unexpected character|unexpected end of|expected a closing|expected the closing|unexpected `|in expression|misnested|before name/i});function is(e){let t=qt[e.category]||e.category,r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",n=[];return n.push('<div class="velu-err-card">'),n.push('<div class="velu-err-head">'),n.push(`<span class="velu-err-pill">${oe(t)}</span>`),n.push("</div>"),e.title&&n.push(`<div class="velu-err-title">${oe(e.title)}</div>`),r&&n.push(`<a class="velu-err-loc" title="${oe(r)}">${oe(r)}</a>`),e.detail&&n.push(`<div class="velu-err-detail">${oe(e.detail)}</div>`),e.frame&&n.push(`<pre class="velu-err-frame">${oe(e.frame)}</pre>`),e.suggestion&&n.push(`<div class="velu-err-suggest">Did you mean <code>&lt;${oe(e.suggestion)}&gt;</code>?</div>`),e.hint&&n.push(`<div class="velu-err-hint">${oe(e.hint)}</div>`),n.push("</div>"),n.join("")}function Kt(e,t={}){let r=Array.isArray(e)?e:[e],n=t.title||(r.length>1?`${r.length} problems to fix`:"There\u2019s a problem to fix"),o=r.map(is).join(`
109
109
  `);return`<!doctype html>
110
110
  <html lang="en">
111
111
  <head>
@@ -177,16 +177,16 @@ ${h.join(`,
177
177
  <div class="velu-err-foot">Fix the file and save \u2014 this page reloads automatically.</div>
178
178
  </div>
179
179
  </body>
180
- </html>`}var oe,Sr=_(()=>{ue();oe=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")});import it from"node:fs";import Ve from"node:path";import{fileURLToPath as is}from"node:url";import ss from"iso-639-1";function ze(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
181
- `).length}function cs(e,t){return t==null||t<0?null:e.slice(0,t).split(`
182
- `).length}function Kt(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
183
- `).length}function us(e,t,r){let n=[];return s(e,t,"",null),n;function o(l){if(l&&l.$ref){let c=l.$ref.replace(/^#\//,"").split("/"),u=r;for(let p of c)u=u?.[p];return u||{}}return l}function i(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function a(l,c){let u=n.length;s(l,c,"",null,!0);let p=n.length===u;return p||(n.length=u),p}function s(l,c,u,p,y){let m=o(c);if(m){if(m.oneOf){m.oneOf.some(v=>a(l,v))||n.push({path:u,key:p,message:"value does not match any allowed shape"});return}if(m.type&&i(l)!==m.type){n.push({path:u,key:p,message:`expected ${m.type}, got ${i(l)}`});return}if(m.type==="string"&&m.minLength!=null&&l.length<m.minLength&&n.push({path:u,key:p,message:"must not be empty"}),m.type==="object"&&i(l)==="object"){for(let v of m.required||[])v in l||n.push({path:u?`${u}.${v}`:v,key:v,message:`missing required "${v}"`});let g=m.properties||{};if(m.additionalProperties===!1)for(let v of Object.keys(l))v in g||n.push({path:u?`${u}.${v}`:v,key:v,message:`unknown field "${v}"`});for(let[v,d]of Object.entries(g))v in l&&s(l[v],d,u?`${u}.${v}`:v,v,y)}m.type==="array"&&Array.isArray(l)&&m.items&&l.forEach((g,v)=>s(g,m.items,`${u}[${v}]`,p,y))}}}function ps(e){if(typeof e!="string")return!1;let t=e.trim();return/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^(rgb|rgba|hsl|hsla|color|oklch|lab|lch)\(/i.test(t)||/^[a-z][a-z0-9-]*$/i.test(t)}function st(e){let t=[],r=Ve.join(e,"velu.json"),n;try{n=it.readFileSync(r,"utf-8")}catch(s){return s.code==="ENOENT"?t.push(I({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(I({category:"config-json",file:"velu.json",title:"Could not read velu.json"})),t}let o;try{o=JSON.parse(n)}catch(s){let l=/position (\d+)/.exec(s.message||""),c=l?cs(n,Number(l[1])):null;return t.push(I({category:"config-json",file:"velu.json",line:c,title:"velu.json is not valid JSON",detail:String(s.message||"").replace(/\s+in JSON.*$/,""),hint:"Check for a trailing comma, a missing quote, or an unclosed brace."})),t}let i=null;try{i=JSON.parse(it.readFileSync(ls,"utf-8"))}catch{}if(i)for(let s of us(o,i,i)){let l=/^unknown field/.test(s.message);t.push(I({category:"config-schema",severity:l?"warning":"error",file:"velu.json",line:ze(n,s.key),title:s.path?`${s.path}: ${s.message}`:s.message,hint:l?"Remove it, or check the spelling against the velu.json schema.":""}))}for(let s of["primary","light","dark"]){let l=o.colors?.[s];l!=null&&!ps(l)&&t.push(I({category:"config-schema",severity:"warning",file:"velu.json",line:ze(n,s),title:`colors.${s}: "${l}" doesn\u2019t look like a CSS color`,hint:"Use a hex value like #dc143c, an rgb()/hsl() function, or a CSS color name."}))}if(typeof o.favicon=="string"&&o.favicon.trim()){let s=Ve.resolve(e,o.favicon.replace(/^\/+/,""));it.existsSync(s)||t.push(I({category:"config-asset",file:"velu.json",line:ze(n,"favicon"),title:`favicon not found: ${o.favicon}`,hint:"The path is relative to the project root."}))}let a=_e(o.logo);if(a){let s=new Map;for(let l of["light","dark"]){let c=a[l];c&&s.set(c,[...s.get(c)||[],l])}for(let[l,c]of s)if(!it.existsSync(Ve.resolve(e,l.replace(/^\/+/,"")))){let u=c.length===2?"logo":`logo (${c[0]})`;t.push(I({category:"config-asset",file:"velu.json",line:Kt(n,l),title:`${u} not found: ${l}`,hint:"The path is relative to the project root."}))}}if(o.navigation&&typeof o.navigation=="object"){let s;try{s=X(o.navigation)}catch(l){t.push(I({category:"config-nav",file:"velu.json",line:ze(n,"navigation"),title:"navigation could not be processed",detail:String(l.message||"")})),s=null}if(s){let{pageEntries:l,warnings:c}=ae(s,e);for(let u of c){let p=/not found$/.test(u),y=/page "([^"]+)"/.exec(u),m=y?Kt(n,y[1]):null;t.push(I({category:"config-nav",severity:p?"error":"warning",file:"velu.json",line:m,title:u,hint:p?"Create the .mdx file, or remove the page from navigation.":""}))}fs(s,n,t)}}return t}function fs(e,t,r){let n=new Set,o=i=>{if(!(!i||typeof i!="object")){if(i.language&&!n.has(i.language)){n.add(i.language);let a=String(i.language).toLowerCase();ss.validate(a)||r.push(I({category:"config-nav",severity:"warning",file:"velu.json",line:Kt(t,i.language)||ze(t,"language"),title:`"${i.language}" is not a valid ISO 639-1 language code`,hint:'Use a two-letter code like "en", "fr", or "ja".'}))}for(let a of Object.values(i))Array.isArray(a)?a.forEach(o):a&&typeof a=="object"&&o(a)}};o(e)}var as,ls,Xt=_(()=>{ue();re();Fe();Re();as=Ve.dirname(is(import.meta.url)),ls=Ve.resolve(as,"..","..","schema","velu.schema.json")});import ms from"node:fs/promises";import ds from"node:fs";import pe from"node:path";import{fileURLToPath as gs,pathToFileURL as hs}from"node:url";import{compile as ys}from"@mdx-js/mdx";import vs from"remark-frontmatter";import bs from"remark-mdx-frontmatter";import xs from"remark-gfm";import ws from"rehype-slug";import{visit as $s}from"unist-util-visit";function Yt(){if(at)return at;let e=pe.dirname(gs(import.meta.url)),t=[pe.resolve(e,"..","runtime","velu-ui"),pe.resolve(e,"..","..","runtime","velu-ui"),pe.resolve(e,"..","..","..","velu-ui","src")],r=null;for(let n of t){let o=pe.join(n,"lib","component-schemas.js");if(ds.existsSync(o)){r=o;break}}return at=r?import(hs(r).href).then(n=>n.validateProps).catch(()=>null):Promise.resolve(null),at}function Ss(e){let t={};for(let r of e.attributes||[])r.type==="mdxJsxAttribute"&&(r.value==null?t[r.name]=!0:typeof r.value=="string"&&(t[r.name]=r.value));return t}function ks(e,t){return()=>r=>{$s(r,n=>{if((n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")&&typeof n.name=="string"&&/^[A-Z]/.test(n.name)&&!n.name.includes(".")&&e.push({name:n.name,props:Ss(n),line:n.position?.start?.line??null,column:n.position?.start?.column??null}),n.type==="mdxjsEsm"&&typeof n.value=="string")for(let o of n.value.matchAll(/\b([A-Z][A-Za-z0-9_]*)\b/g))t.add(o[1])})}}async function js(e,t){let r=[],n;try{n=await ms.readFile(t.fileAbsPath,"utf-8")}catch{return r}let o=pe.relative(e,t.fileAbsPath).split(pe.sep).join("/"),i=[],a=new Set;try{await ys({value:n,path:t.fileAbsPath},{remarkPlugins:[vs,bs,xs,Ue,ks(i,a)],rehypePlugins:[ws],providerImportSource:"@mdx-js/react"})}catch(u){return r.push(Me(u,{projectDir:e,knownComponents:te,file:o})),r}let s=new Set(te),l=await Yt(),c=new Set;for(let u of i)if(!a.has(u.name)){if(!s.has(u.name)){if(c.has(u.name))continue;c.add(u.name),r.push(I({category:"unknown-component",file:o,line:u.line,column:u.column,title:`<${u.name}> is not a built-in component`,hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:rt(u.name,te)}));continue}if(l){let p=l(u.name,u.props,{checkRequired:!1});p&&r.push(I({...p,file:o,line:u.line,column:u.column}))}}return r}async function kr(e,t){let r=t.filter(s=>s.exists),n=[],o=8,i=0;async function a(){for(;i<r.length;){let s=r[i++],l=await js(e,s);for(let c of l)n.push(c)}}return await Promise.all(Array.from({length:Math.min(o,r.length)},a)),n}var at,Zt=_(()=>{Mt();ue();Wt();qe()});import De from"node:fs";import Qt from"node:path";import Or from"js-yaml";function en(e,t,r){if(r>24||e===null||typeof e!="object")return r>24&&e&&typeof e=="object"?null:e;if(t.has(e))return null;t.add(e);let n;if(Array.isArray(e))n=e.map(o=>en(o,t,r+1));else{n={};for(let[o,i]of Object.entries(e))n[o]=en(i,t,r+1)}return t.delete(e),n}function Tr(e){return Or.dump(en(e,new Set,0),{noRefs:!0,lineWidth:100,skipInvalid:!0})}function Er(e){let t=String(e).replace(/\.md$/i,"");return t===""||t==="/"||t==="/index"?"/":t.replace(/\/+$/,"")||"/"}function As(e){return e==="/"?"/index.md":`${e}.md`}function tn(e,t){if(t==="api")return`# ${jr}
184
- ${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${jr}
180
+ </html>`}var oe,jr=_(()=>{ue();oe=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")});import st from"node:fs";import De from"node:path";import{fileURLToPath as ss}from"node:url";import as from"iso-639-1";function Be(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
181
+ `).length}function us(e,t){return t==null||t<0?null:e.slice(0,t).split(`
182
+ `).length}function Xt(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
183
+ `).length}function ps(e,t,r){let n=[];return s(e,t,"",null),n;function o(l){if(l&&l.$ref){let c=l.$ref.replace(/^#\//,"").split("/"),u=r;for(let p of c)u=u?.[p];return u||{}}return l}function i(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function a(l,c){let u=n.length;s(l,c,"",null,!0);let p=n.length===u;return p||(n.length=u),p}function s(l,c,u,p,y){let m=o(c);if(m){if(m.oneOf){m.oneOf.some(v=>a(l,v))||n.push({path:u,key:p,message:"value does not match any allowed shape"});return}if(m.type&&i(l)!==m.type){n.push({path:u,key:p,message:`expected ${m.type}, got ${i(l)}`});return}if(m.type==="string"&&m.minLength!=null&&l.length<m.minLength&&n.push({path:u,key:p,message:"must not be empty"}),m.type==="object"&&i(l)==="object"){for(let v of m.required||[])v in l||n.push({path:u?`${u}.${v}`:v,key:v,message:`missing required "${v}"`});let g=m.properties||{};if(m.additionalProperties===!1)for(let v of Object.keys(l))v in g||n.push({path:u?`${u}.${v}`:v,key:v,message:`unknown field "${v}"`});for(let[v,d]of Object.entries(g))v in l&&s(l[v],d,u?`${u}.${v}`:v,v,y)}m.type==="array"&&Array.isArray(l)&&m.items&&l.forEach((g,v)=>s(g,m.items,`${u}[${v}]`,p,y))}}}function fs(e){if(typeof e!="string")return!1;let t=e.trim();return/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^(rgb|rgba|hsl|hsla|color|oklch|lab|lch)\(/i.test(t)||/^[a-z][a-z0-9-]*$/i.test(t)}function at(e){let t=[],r=De.join(e,"velu.json"),n;try{n=st.readFileSync(r,"utf-8")}catch(s){return s.code==="ENOENT"?t.push(I({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(I({category:"config-json",file:"velu.json",title:"Could not read velu.json"})),t}let o;try{o=JSON.parse(n)}catch(s){let l=/position (\d+)/.exec(s.message||""),c=l?us(n,Number(l[1])):null;return t.push(I({category:"config-json",file:"velu.json",line:c,title:"velu.json is not valid JSON",detail:String(s.message||"").replace(/\s+in JSON.*$/,""),hint:"Check for a trailing comma, a missing quote, or an unclosed brace."})),t}let i=null;try{i=JSON.parse(st.readFileSync(cs,"utf-8"))}catch{}if(i)for(let s of ps(o,i,i)){let l=/^unknown field/.test(s.message);t.push(I({category:"config-schema",severity:l?"warning":"error",file:"velu.json",line:Be(n,s.key),title:s.path?`${s.path}: ${s.message}`:s.message,hint:l?"Remove it, or check the spelling against the velu.json schema.":""}))}for(let s of["primary","light","dark"]){let l=o.colors?.[s];l!=null&&!fs(l)&&t.push(I({category:"config-schema",severity:"warning",file:"velu.json",line:Be(n,s),title:`colors.${s}: "${l}" doesn\u2019t look like a CSS color`,hint:"Use a hex value like #dc143c, an rgb()/hsl() function, or a CSS color name."}))}if(typeof o.favicon=="string"&&o.favicon.trim()){let s=De.resolve(e,o.favicon.replace(/^\/+/,""));st.existsSync(s)||t.push(I({category:"config-asset",file:"velu.json",line:Be(n,"favicon"),title:`favicon not found: ${o.favicon}`,hint:"The path is relative to the project root."}))}let a=Ue(o.logo);if(a){let s=new Map;for(let l of["light","dark"]){let c=a[l];c&&s.set(c,[...s.get(c)||[],l])}for(let[l,c]of s)if(!st.existsSync(De.resolve(e,l.replace(/^\/+/,"")))){let u=c.length===2?"logo":`logo (${c[0]})`;t.push(I({category:"config-asset",file:"velu.json",line:Xt(n,l),title:`${u} not found: ${l}`,hint:"The path is relative to the project root."}))}}if(o.navigation&&typeof o.navigation=="object"){let s;try{s=X(o.navigation)}catch(l){t.push(I({category:"config-nav",file:"velu.json",line:Be(n,"navigation"),title:"navigation could not be processed",detail:String(l.message||"")})),s=null}if(s){let{pageEntries:l,warnings:c}=ae(s,e);for(let u of c){let p=/not found$/.test(u),y=/page "([^"]+)"/.exec(u),m=y?Xt(n,y[1]):null;t.push(I({category:"config-nav",severity:p?"error":"warning",file:"velu.json",line:m,title:u,hint:p?"Create the .mdx file, or remove the page from navigation.":""}))}ms(s,n,t)}}return t}function ms(e,t,r){let n=new Set,o=i=>{if(!(!i||typeof i!="object")){if(i.language&&!n.has(i.language)){n.add(i.language);let a=String(i.language).toLowerCase();as.validate(a)||r.push(I({category:"config-nav",severity:"warning",file:"velu.json",line:Xt(t,i.language)||Be(t,"language"),title:`"${i.language}" is not a valid ISO 639-1 language code`,hint:'Use a two-letter code like "en", "fr", or "ja".'}))}for(let a of Object.values(i))Array.isArray(a)?a.forEach(o):a&&typeof a=="object"&&o(a)}};o(e)}var ls,cs,Yt=_(()=>{ue();re();Ie();Fe();ls=De.dirname(ss(import.meta.url)),cs=De.resolve(ls,"..","..","schema","velu.schema.json")});import ds from"node:fs/promises";import gs from"node:fs";import pe from"node:path";import{fileURLToPath as hs,pathToFileURL as ys}from"node:url";import{compile as vs}from"@mdx-js/mdx";import bs from"remark-frontmatter";import xs from"remark-mdx-frontmatter";import ws from"remark-gfm";import $s from"rehype-slug";import{visit as Ss}from"unist-util-visit";function Zt(){if(lt)return lt;let e=pe.dirname(hs(import.meta.url)),t=[pe.resolve(e,"..","runtime","velu-ui"),pe.resolve(e,"..","..","runtime","velu-ui"),pe.resolve(e,"..","..","..","velu-ui","src")],r=null;for(let n of t){let o=pe.join(n,"lib","component-schemas.js");if(gs.existsSync(o)){r=o;break}}return lt=r?import(ys(r).href).then(n=>n.validateProps).catch(()=>null):Promise.resolve(null),lt}function ks(e){let t={};for(let r of e.attributes||[])r.type==="mdxJsxAttribute"&&(r.value==null?t[r.name]=!0:typeof r.value=="string"&&(t[r.name]=r.value));return t}function js(e,t){return()=>r=>{Ss(r,n=>{if((n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")&&typeof n.name=="string"&&/^[A-Z]/.test(n.name)&&!n.name.includes(".")&&e.push({name:n.name,props:ks(n),line:n.position?.start?.line??null,column:n.position?.start?.column??null}),n.type==="mdxjsEsm"&&typeof n.value=="string")for(let o of n.value.matchAll(/\b([A-Z][A-Za-z0-9_]*)\b/g))t.add(o[1])})}}async function As(e,t){let r=[],n;try{n=await ds.readFile(t.fileAbsPath,"utf-8")}catch{return r}let o=pe.relative(e,t.fileAbsPath).split(pe.sep).join("/"),i=[],a=new Set;try{await vs({value:n,path:t.fileAbsPath},{remarkPlugins:[bs,xs,ws,Ne,js(i,a)],rehypePlugins:[$s],providerImportSource:"@mdx-js/react"})}catch(u){return r.push(Ve(u,{projectDir:e,knownComponents:te,file:o})),r}let s=new Set(te),l=await Zt(),c=new Set;for(let u of i)if(!a.has(u.name)){if(!s.has(u.name)){if(c.has(u.name))continue;c.add(u.name),r.push(I({category:"unknown-component",file:o,line:u.line,column:u.column,title:`<${u.name}> is not a built-in component`,hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:ot(u.name,te)}));continue}if(l){let p=l(u.name,u.props,{checkRequired:!1});p&&r.push(I({...p,file:o,line:u.line,column:u.column}))}}return r}async function Ar(e,t){let r=t.filter(s=>s.exists),n=[],o=8,i=0;async function a(){for(;i<r.length;){let s=r[i++],l=await As(e,s);for(let c of l)n.push(c)}}return await Promise.all(Array.from({length:Math.min(o,r.length)},a)),n}var lt,Qt=_(()=>{zt();ue();Ht();We()});import qe from"node:fs";import en from"node:path";import Er from"js-yaml";function tn(e,t,r){if(r>24||e===null||typeof e!="object")return r>24&&e&&typeof e=="object"?null:e;if(t.has(e))return null;t.add(e);let n;if(Array.isArray(e))n=e.map(o=>tn(o,t,r+1));else{n={};for(let[o,i]of Object.entries(e))n[o]=tn(i,t,r+1)}return t.delete(e),n}function Cr(e){return Er.dump(tn(e,new Set,0),{noRefs:!0,lineWidth:100,skipInvalid:!0})}function Lr(e){let t=String(e).replace(/\.md$/i,"");return t===""||t==="/"||t==="/index"?"/":t.replace(/\/+$/,"")||"/"}function Os(e){return e==="/"?"/index.md":`${e}.md`}function nn(e,t){if(t==="api")return`# ${Or}
184
+ ${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${Or}
185
185
 
186
- `;return r?e.slice(0,r[0].length)+n+e.slice(r[0].length):n+e}function Ts(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function Es(e){try{let t=De.readFileSync(e,"utf-8").match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return{};let r=Or.load(t[1]);return r&&typeof r=="object"?r:{}}catch{return{}}}async function xe(e){let t={};try{t=JSON.parse(De.readFileSync(Qt.join(e,"velu.json"),"utf-8"))}catch{return{name:Qt.basename(e),baseUrl:"",pages:[]}}let r=t.name??Qt.basename(e),n=typeof process.env.VELU_SITE_URL=="string"?process.env.VELU_SITE_URL.replace(/\/+$/,""):"",o=Y(t.api),i=t.navigation??{},a={};try{let p=await Qe(t.navigation??{},{targetDir:e,api:o});i=p.nav,a=p.ops}catch(p){console.warn(`[velu] openapi: ${p.message}`)}let s=X(i),{pageEntries:l}=ae(s,e),c=new Map(l.map(p=>[p.url,p])),u=[];for(let p of ne(s)){if(!p.url)continue;let y=p.ancestors.filter(h=>h.kind==="group").pop(),m=p.ancestors.filter(h=>h.kind==="tab").pop(),g=y?.label||m?.label||"Pages",v=p.ancestors.filter(h=>h.kind==="tab"||h.kind==="group").map(h=>h.label),d=p.ancestors.filter(h=>h.kind==="language").pop()?.code||null;if(p.node?.api){let h=a[p.pagePath];if(!h)continue;let S=h.title||Ar(p.url);u.push({url:p.url,title:S,description:h.description||"",group:g,breadcrumb:[...v,S],lang:d,frontmatter:{title:h.title,description:h.description},source:{kind:"api",segment:h.segment}})}else{let h=c.get(p.url);if(!h||!h.exists)continue;let S=Es(h.fileAbsPath),O=S.title||Ar(p.url);u.push({url:p.url,title:O,description:S.description||"",group:g,breadcrumb:[...v,O],lang:d,frontmatter:S,source:{kind:"mdx",fileAbsPath:h.fileAbsPath}})}}return{name:r,baseUrl:n,pages:u}}function ct(e){return new Map(e.pages.map(t=>[t.url,{...t.source,title:t.title}]))}async function Cs(e){return ct(await xe(e))}async function nn(e,t,r){let o=(r||await Cs(e)).get(t);if(!o)return null;if(o.kind==="mdx")try{return{body:De.readFileSync(o.fileAbsPath,"utf-8"),contentType:"text/markdown; charset=utf-8",kind:"mdx"}}catch{return null}return o.segment?{body:Tr(o.segment),contentType:"text/yaml; charset=utf-8",kind:"api"}:null}async function Cr(e,t){let r=t||await xe(e),n=s=>r.baseUrl?r.baseUrl+s:s,o=[`# ${r.name}`,"",`> Documentation index for ${r.name}. Append \`.md\` to any page URL (or send \`Accept: text/markdown\`) for its Markdown; fetch ${lt} for the whole site in one document.`,""],i=[],a=new Map;for(let s of r.pages)a.has(s.group)||(a.set(s.group,[]),i.push(s.group)),a.get(s.group).push(s);for(let s of i){o.push(`## ${s}`,"");for(let l of a.get(s))o.push(`- [${l.title}](${n(As(l.url))})${l.description?`: ${l.description}`:""}`);o.push("")}return o.join(`
187
- `)}async function Pr(e,t){let r=t||await xe(e),n=[`# ${r.name}`,"",`> Full documentation \u2014 every page concatenated. Index: ${ve}`];for(let o of r.pages)if(n.push("","---","",`# ${o.title}`,`Source: ${o.url}`,""),o.source.kind==="mdx")try{n.push(Ts(De.readFileSync(o.source.fileAbsPath,"utf-8")).trim())}catch{}else o.source.segment&&n.push("```yaml",Tr(o.source.segment).trim(),"```");return n.join(`
186
+ `;return r?e.slice(0,r[0].length)+n+e.slice(r[0].length):n+e}function Es(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function Cs(e){try{let t=qe.readFileSync(e,"utf-8").match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return{};let r=Er.load(t[1]);return r&&typeof r=="object"?r:{}}catch{return{}}}async function xe(e){let t={};try{t=JSON.parse(qe.readFileSync(en.join(e,"velu.json"),"utf-8"))}catch{return{name:en.basename(e),baseUrl:"",pages:[]}}let r=t.name??en.basename(e),n=typeof process.env.VELU_SITE_URL=="string"?process.env.VELU_SITE_URL.replace(/\/+$/,""):"",o=Y(t.api),i=t.navigation??{},a={};try{let p=await et(t.navigation??{},{targetDir:e,api:o});i=p.nav,a=p.ops}catch(p){console.warn(`[velu] openapi: ${p.message}`)}let s=X(i),{pageEntries:l}=ae(s,e),c=new Map(l.map(p=>[p.url,p])),u=[];for(let p of ne(s)){if(!p.url)continue;let y=p.ancestors.filter(h=>h.kind==="group").pop(),m=p.ancestors.filter(h=>h.kind==="tab").pop(),g=y?.label||m?.label||"Pages",v=p.ancestors.filter(h=>h.kind==="tab"||h.kind==="group").map(h=>h.label),d=p.ancestors.filter(h=>h.kind==="language").pop()?.code||null;if(p.node?.api){let h=a[p.pagePath];if(!h)continue;let S=h.title||Tr(p.url);u.push({url:p.url,title:S,description:h.description||"",group:g,breadcrumb:[...v,S],lang:d,frontmatter:{title:h.title,description:h.description},source:{kind:"api",segment:h.segment}})}else{let h=c.get(p.url);if(!h||!h.exists)continue;let S=Cs(h.fileAbsPath),O=S.title||Tr(p.url);u.push({url:p.url,title:O,description:S.description||"",group:g,breadcrumb:[...v,O],lang:d,frontmatter:S,source:{kind:"mdx",fileAbsPath:h.fileAbsPath}})}}return{name:r,baseUrl:n,pages:u}}function ut(e){return new Map(e.pages.map(t=>[t.url,{...t.source,title:t.title}]))}async function Ls(e){return ut(await xe(e))}async function rn(e,t,r){let o=(r||await Ls(e)).get(t);if(!o)return null;if(o.kind==="mdx")try{return{body:qe.readFileSync(o.fileAbsPath,"utf-8"),contentType:"text/markdown; charset=utf-8",kind:"mdx"}}catch{return null}return o.segment?{body:Cr(o.segment),contentType:"text/yaml; charset=utf-8",kind:"api"}:null}async function Pr(e,t){let r=t||await xe(e),n=s=>r.baseUrl?r.baseUrl+s:s,o=[`# ${r.name}`,"",`> Documentation index for ${r.name}. Append \`.md\` to any page URL (or send \`Accept: text/markdown\`) for its Markdown; fetch ${ct} for the whole site in one document.`,""],i=[],a=new Map;for(let s of r.pages)a.has(s.group)||(a.set(s.group,[]),i.push(s.group)),a.get(s.group).push(s);for(let s of i){o.push(`## ${s}`,"");for(let l of a.get(s))o.push(`- [${l.title}](${n(Os(l.url))})${l.description?`: ${l.description}`:""}`);o.push("")}return o.join(`
187
+ `)}async function _r(e,t){let r=t||await xe(e),n=[`# ${r.name}`,"",`> Full documentation \u2014 every page concatenated. Index: ${ve}`];for(let o of r.pages)if(n.push("","---","",`# ${o.title}`,`Source: ${o.url}`,""),o.source.kind==="mdx")try{n.push(Es(qe.readFileSync(o.source.fileAbsPath,"utf-8")).trim())}catch{}else o.source.segment&&n.push("```yaml",Cr(o.source.segment).trim(),"```");return n.join(`
188
188
  `)+`
189
- `}async function Lr(e,t){let r=t||await xe(e),n=r.baseUrl||"",o=[];for(let s of r.pages){if(s.source.kind!=="mdx")continue;let l="";try{l=De.readFileSync(s.source.fileAbsPath,"utf-8")}catch{continue}let c=/<Update\b([^>]*)>([\s\S]*?)<\/Update>/gi,u;for(;u=c.exec(l);){let p=u[1]||"",y=u[2]||"",m=Be(p,"label")||Be(p,"date")||"Update",g=Be(p,"description")||Ls(y)||m,v=Be(p,"description"),d=`${n}${s.url}#${Ps(m,v)}`,h=Be(p,"date")||m,S=new Date(h),O=Number.isNaN(S.getTime())?null:S.toUTCString();o.push({title:m,link:d,description:g,pubDate:O})}}if(!o.length)return null;let i=n||"/",a=o.map(s=>` <item>
189
+ `}async function Rr(e,t){let r=t||await xe(e),n=r.baseUrl||"",o=[];for(let s of r.pages){if(s.source.kind!=="mdx")continue;let l="";try{l=qe.readFileSync(s.source.fileAbsPath,"utf-8")}catch{continue}let c=/<Update\b([^>]*)>([\s\S]*?)<\/Update>/gi,u;for(;u=c.exec(l);){let p=u[1]||"",y=u[2]||"",m=Je(p,"label")||Je(p,"date")||"Update",g=Je(p,"description")||_s(y)||m,v=Je(p,"description"),d=`${n}${s.url}#${Ps(m,v)}`,h=Je(p,"date")||m,S=new Date(h),O=Number.isNaN(S.getTime())?null:S.toUTCString();o.push({title:m,link:d,description:g,pubDate:O})}}if(!o.length)return null;let i=n||"/",a=o.map(s=>` <item>
190
190
  <title>${fe(s.title)}</title>
191
191
  <link>${fe(s.link)}</link>
192
192
  <guid isPermaLink="true">${fe(s.link)}</guid>
@@ -203,12 +203,12 @@ ${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${jr}
203
203
  `+a+`
204
204
  </channel>
205
205
  </rss>
206
- `}var ve,lt,Os,be,jr,Ar,fe,Ps,Be,Ls,_r=_(()=>{re();Fe();Re();Bt();ve="/llms.txt",lt="/llms-full.txt",Os=`<${ve}>; rel="llms-txt", <${lt}>; rel="llms-full-txt"`,be={Link:Os,"X-Llms-Txt":ve},jr=`Full documentation index: ${ve}`;Ar=e=>(e.split("/").filter(Boolean).pop()||"Home").replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase());fe=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Ps=(e,t)=>{let r=a=>String(a||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),n=r(e),o=t==null||t===""?"":r(t);return`update-${o?n?`${n}-${o}`:o:n||"item"}`},Be=(e,t)=>{let r=e.match(new RegExp(`${t}\\s*=\\s*["']([^"']*)["']`,"i"));return r?r[1]:void 0},Ls=e=>String(e||"").replace(/```[\s\S]*?```/g,"").replace(/<[^>]+>/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[#*`_>]/g,"").replace(/\s+/g," ").trim().slice(0,500)});var Vr={};$e(Vr,{startDevServer:()=>Hs});import Rr from"node:fs/promises";import we from"node:fs";import _s from"node:http";import{spawn as Rs}from"node:child_process";import G from"node:path";import{fileURLToPath as Us}from"node:url";import Fs from"chokidar";import rn from"express";import{createServer as Ns,createLogger as Is,searchForWorkspaceRoot as Ms}from"vite";function Ds(e){return`<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e).replace(/%20/g,"+")}:wght@300;400;500;600;700&display=swap`}" />`}function Fr(e,t){let r=qt(e,{color:!!process.stderr.isTTY});console.error(`
206
+ `}var ve,ct,Ts,be,Or,Tr,fe,Ps,Je,_s,Ur=_(()=>{re();Ie();Fe();Dt();ve="/llms.txt",ct="/llms-full.txt",Ts=`<${ve}>; rel="llms-txt", <${ct}>; rel="llms-full-txt"`,be={Link:Ts,"X-Llms-Txt":ve},Or=`Full documentation index: ${ve}`;Tr=e=>(e.split("/").filter(Boolean).pop()||"Home").replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase());fe=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Ps=(e,t)=>{let r=a=>String(a||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),n=r(e),o=t==null||t===""?"":r(t);return`update-${o?n?`${n}-${o}`:o:n||"item"}`},Je=(e,t)=>{let r=e.match(new RegExp(`${t}\\s*=\\s*["']([^"']*)["']`,"i"));return r?r[1]:void 0},_s=e=>String(e||"").replace(/```[\s\S]*?```/g,"").replace(/<[^>]+>/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[#*`_>]/g,"").replace(/\s+/g," ").trim().slice(0,500)});var Dr={};$e(Dr,{startDevServer:()=>Ks});import Fr from"node:fs/promises";import we from"node:fs";import Rs from"node:http";import{spawn as Us}from"node:child_process";import G from"node:path";import{fileURLToPath as Fs}from"node:url";import Ns from"chokidar";import on from"express";import{createServer as Is,createLogger as Ms,searchForWorkspaceRoot as zs}from"vite";function Js(e){return`<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e).replace(/%20/g,"+")}:wght@300;400;500;600;700&display=swap`}" />`}function Ir(e,t){let r=Gt(e,{color:!!process.stderr.isTTY});console.error(`
207
207
  `+r+`
208
- `),process.env.VELU_DEBUG&&t&&console.error(t)}function Nr(){try{return JSON.parse(we.readFileSync(G.join(ut,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function Js(e,t){let r=G.resolve(e,".velu"),n=G.resolve(r,".velu-version"),o=null;try{o=we.readFileSync(n,"utf8").trim()}catch{}if(o!==t){if(o!==null)try{we.rmSync(G.join(r,"vite-cache"),{recursive:!0,force:!0}),console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026")}catch{}try{we.mkdirSync(r,{recursive:!0}),we.writeFileSync(n,t)}catch{}}}async function Ir(e){try{return await Hn(e)}catch{return Ft({},G.basename(e))}}async function Mr(e,t){let r=await e.moduleGraph.getModuleByUrl(t,!0),n=new Map,o=new Set;async function i(a){if(!(!a||o.has(a.url))){if(o.add(a.url),a.id&&Vs.test(a.id)){let s=a.url.includes("?")?"&":"?",l=await e.transformRequest(`${a.url}${s}direct`);l?.code&&n.set(a.url,l.code)}for(let s of a.importedModules)await i(s)}}return await i(r),[...n.values()].join(`
209
- `)}function Ws(e,t,r){let n=()=>{process.stdout.isTTY&&!process.env.VELU_NO_BELL&&process.stdout.write("\x07")},o=process.stdout.isTTY,i=g=>o&&process.stdout.write(`\x1B]${g}\x1B\\`),a=()=>{i(`0;\u23F3 ${t}`),i("9;4;3;0")},s=()=>{i(`0;${t}`),i("9;4;0;0")};o&&process.once("exit",()=>i("9;4;0;0")),a();let l=r&&r!=="unknown"?`v${r}`:"";if(!e)return console.log(`Starting Velu${l?" "+l:""}\u2026`),{ready:g=>{console.log(`Velu${l?" "+l:""} ready \u2192 ${g}`),s(),n()}};let c="\x1B[38;2;220;20;60m",u="\x1B[0m",p="\x1B[2m";console.log("");for(let g of qs)console.log(`${c}${g}${u}`);l&&console.log(` ${p}${l}${u}`),console.log("");let y=null;try{y=Rs(process.execPath,["-e",Gs],{stdio:["ignore","inherit","ignore"]}),y.on("error",()=>{})}catch{}let m=()=>{if(y){try{y.kill()}catch{}y=null}};return process.once("exit",m),{ready:g=>{m(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${u} Velu${l?" "+l:""} ready \u2192 \x1B[36m${g}${u}`),s(),n()}}}async function Hs(e){let t=!!process.env.VELU_PROFILE,r=performance.now(),n=(T,$)=>t&&console.log(`[velu-profile] ${T}: ${(performance.now()-$).toFixed(0)}ms`),o=Ws(!!process.stdout.isTTY&&!t,G.basename(e),Nr()),i=await Ir(e),a=l(),s=Ne(e);function l(){let $=st(e).filter(E=>E.severity==="error"&&(E.category==="config-json"||E.category==="config-schema"));return $.length&&console.error(`
210
- `+ot($,{color:!!process.stderr.isTTY})+`
211
- `),$}let c=e;try{c=we.realpathSync(e)}catch{}let u=0,p=T=>{let $=performance.now();if($-u<500)return;u=$;let E=Me(T,{projectDir:c,knownComponents:te});Fr(E,T)};process.on("unhandledRejection",p),process.on("uncaughtException",p);let y=Number(process.env.PORT)||8358,m=await Yt();Js(e,Nr());let g=rn(),v=_s.createServer(g),d=Is(t?"info":"warn"),h=T=>typeof T=="string"&&T.includes("Failed to load source map"),S=d.warn.bind(d),O=d.warnOnce.bind(d);d.warn=(T,$)=>{h(T)||S(T,$)},d.warnOnce=(T,$)=>{h(T)||O(T,$)};let A=await Ns({...xr({targetDir:e,VITE_ROOT:ut,validateProps:m}),appType:"custom",logLevel:t?"info":"warn",customLogger:d,server:{middlewareMode:!0,fs:{allow:[Ms(ut),e,c]},hmr:{server:v}}});n("vite server created",r),g.get(new RegExp(`^${et}/`),(T,$,E)=>{let k=cr(s,T.path);if(!k)return E();$.sendFile(k.abs,F=>{F&&$.status(404).end()})}),g.use(A.middlewares);let x=G.join(e,"public");g.use(rn.static(x)),g.get(new RegExp(`^${Ut}(\\.[a-z0-9]+)?$`,"i"),async(T,$)=>{if(!i.favicon)return $.status(404).end();let E=G.resolve(e,i.favicon.replace(/^\//,""));$.sendFile(E,k=>{k&&$.status(404).end()})});let w=T=>($,E)=>{let k=i.logo?.[T];if(!k)return E.status(404).end();E.sendFile(G.resolve(e,k.replace(/^\//,"")),F=>{F&&E.status(404).end()})};g.get(Ye,w("light")),g.get(Ze,w("dark")),g.post("/@velu-api-proxy",rn.json({limit:"8mb"}),async(T,$)=>{let{method:E="GET",url:k,headers:F={},body:R}=T.body||{};if(typeof k!="string"||!/^https?:\/\//i.test(k))return $.status(400).json({error:"A valid http(s) target URL is required."});try{let U=await fetch(k,{method:E,headers:F,body:R!=null&&R!==""?R:void 0}),V=await U.text(),f=U.headers.get("content-type")||"",b={};U.headers.forEach((C,M)=>{b[M]=C});let j=V;if(/json/i.test(f))try{j=JSON.parse(V)}catch{}$.json({status:U.status,statusText:U.statusText,headers:b,body:j})}catch(U){$.json({error:`Request failed: ${U.message}`})}});let P=null,L=async()=>P||=await xe(e);g.get(/\.md$/i,async(T,$,E)=>{try{let k=await L(),F=await nn(e,Er(decodeURIComponent(T.path)),ct(k));if(!F)return E();$.status(200).set({"Content-Type":F.contentType,...be}).end(tn(F.body,F.kind))}catch{E()}}),g.get(ve,async(T,$,E)=>{try{let k=await Cr(e,await L());$.status(200).set({"Content-Type":"text/plain; charset=utf-8",...be}).end(k)}catch{E()}}),g.get(lt,async(T,$,E)=>{try{let k=await Pr(e,await L());$.status(200).set({"Content-Type":"text/plain; charset=utf-8",...be}).end(k)}catch{E()}}),g.get("/rss.xml",async(T,$,E)=>{try{let k=await Lr(e,await L());if(!k)return E();$.status(200).set({"Content-Type":"application/rss+xml; charset=utf-8"}).end(k)}catch{E()}}),g.use("*",async(T,$,E)=>{let k=T.originalUrl,F=performance.now();if(/text\/markdown/i.test(T.headers.accept||""))try{let R=await L(),U=await nn(e,vt(k),ct(R));if(U)return $.status(200).set({"Content-Type":U.contentType,...be}).end(tn(U.body,U.kind))}catch{}if(a.length)return $.status(200).set({"Content-Type":"text/html"}).end(Ht(a,{title:"Fix velu.json to continue"}));try{let R=performance.now(),U=await Rr.readFile(zr,"utf-8");U=await A.transformIndexHtml(k,U),n(`transformIndexHtml ${k}`,R);let V="/src/runtime/server-entry.jsx";R=performance.now();let{render:f}=await A.ssrLoadModule(V);n(`ssrLoadModule ${k} (1st req includes dep pre-bundle)`,R),R=performance.now();let b=await f(k);n(`render ${k}`,R),R=performance.now();let j=await Mr(A,V);n(`collectSsrCss ${k}`,R);let C=j?`<style data-velu-ssr>${j}</style>`:"",M=`<style data-velu-config>
212
- ${Kn(i)}
213
- </style>`,ie=Bs.has(i.font.family)?"":Ds(i.font.family),J=Wn(i),se=J?`<link rel="icon"${J.type?` type="${J.type}"`:""} href="${J.url}" />`:"",mt=ur(s),Hr=[C,M,ie,se,mt].filter(Boolean).join(`
214
- `),Kr=U.replace('<html lang="en">',`<html lang="en" data-current-path="${Ur(vt(k))}">`).replace("<!--app-title-->",Ur(i.name)).replace("<!--app-head-->",Hr).replace("<!--app-html-->",b);$.status(200).set({"Content-Type":"text/html",...be}).end(Kr),n(`TOTAL ${k}`,F)}catch(R){A.ssrFixStacktrace(R);let U=Me(R,{projectDir:c,knownComponents:te});if(/failed to load url|does the file exist|cannot find module|ERR_MODULE_NOT_FOUND/i.test(String(R&&R.message))){try{A.moduleGraph.invalidateAll()}catch{}U.hint="The dev server cache is out of sync \u2014 this usually happens after files are added, removed, or moved. Reload the page; if it persists, stop velu dev, delete the .velu folder in your project, and restart."}Fr(U,R),$.status(200).set({"Content-Type":"text/html"}).end(Ht([U]))}}),Fs.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(T,$)=>{console.log(`[velu-cli] content ${T}: ${G.relative(e,$)}`);let E=G.basename($)==="velu.json",k=$.endsWith(".mdx"),F=/\.(css|js)$/i.test($),R=!1;if(F){let V=b=>b.scripts.some(j=>j.abs===$),f=V(s);s=Ne(e),R=f||V(s)}let U=E||k&&(T==="add"||T==="unlink")||R;if((U||k||/\.(ya?ml|json)$/i.test($))&&(P=null),E&&(i=await Ir(e),a=l()),U)A.moduleGraph.invalidateAll();else if(k){let V=$.split(G.sep).join("/"),f=A.moduleGraph.getModulesByFile(V);if(f)for(let b of f)A.moduleGraph.invalidateModule(b)}A.ws.send({type:"full-reload"})});async function ee(T){let $=new Set,E=12,k=0,F=[],R=()=>k<E?(k+=1,Promise.resolve()):new Promise(b=>F.push(b)).then(()=>{k+=1}),U=()=>{k-=1,F.shift()?.()},V=b=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(b)||/[\\/]node_modules[\\/]/.test(b)&&!/velu-ui/.test(b);async function f(b){if(!(!b||$.has(b)||V(b))){$.add(b);try{await R();try{await A.transformRequest(b,{ssr:!1})}finally{U()}let j=await A.moduleGraph.getModuleByUrl(b,!1);j?.importedModules?.size&&await Promise.all([...j.importedModules].map(C=>f(C.url)))}catch{}}}return await f(T),$.size}v.listen(y,async()=>{let T=performance.now(),$=0;try{let{render:E}=await A.ssrLoadModule("/src/runtime/server-entry.jsx");await ee("/src/runtime/client-entry.jsx"),typeof A.waitForRequestsIdle=="function"&&await A.waitForRequestsIdle();let[k]=await Promise.allSettled([ee("/src/runtime/client-entry.jsx"),E("/"),A.transformIndexHtml("/",await Rr.readFile(zr,"utf-8")),Mr(A,"/src/runtime/server-entry.jsx")]).then(F=>F.map(R=>R.status==="fulfilled"?R.value:0));$=k}catch(E){t&&console.log("[velu-profile] warmup error:",E?.message)}n(`cold-start warm-up (${$} client modules)`,T),o.ready(`http://localhost:${y}`)})}var zs,Vs,Bs,Ur,ut,zr,qs,Gs,Br=_(()=>{Re();wr();Wt();Sr();ue();qe();Xt();Zt();_r();re();Dt();zs=G.dirname(Us(import.meta.url)),Vs=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,Bs=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),Ur=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");ut=G.resolve(zs,".."),zr=G.resolve(ut,"src","template.html"),qs=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],Gs="const F=['\u280B','\u2819','\u2839','\u2838','\u283C','\u2834','\u2826','\u2827','\u2807','\u280F'],M=['Starting Velu','Setting up your preview','Preparing your docs','Warming things up','Almost ready'];let f=0,m=0;const t=Date.now();const C='\\x1b[38;2;220;20;60m',R='\\x1b[0m',D='\\x1b[2m';const d=()=>{const s=(Date.now()-t)/1000|0;process.stdout.write('\\x1b[2K\\r '+C+F[f]+R+' '+M[m]+'\\u2026 '+D+s+'s'+R);f=(f+1)%F.length;};d();setInterval(d,90);setInterval(()=>{if(m<M.length-1)m++;},4000);"});var Jr={};$e(Jr,{default:()=>Zs,runValidate:()=>Dr});import Ks from"node:fs";import Xs from"node:path";function Ys(e){try{let t=JSON.parse(Ks.readFileSync(Xs.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let r=X(t.navigation);return ae(r,e).pageEntries}catch{return[]}}async function Dr(e){let t=st(e),r=Ys(e),n=await kr(e,r),o=[...t,...n],i=!!process.stdout.isTTY;return console.log(ot(o,{color:i})),o.some(s=>s.severity!=="warning"&&s.severity!=="info")?1:0}var Zs,qr=_(()=>{re();Fe();Xt();Zt();ue();Zs=Dr});import pt from"node:path";import D from"node:process";import{readFileSync as Qs}from"node:fs";var[,,Gr,ft]=D.argv;function Wr(){try{return JSON.parse(Qs(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function ea(){let e=D.argv.slice(3);for(let t=0;t<e.length;t++){let r=e[t];if(r==="--out"){t++;continue}if(!r.startsWith("-"))return r}}async function ta(){switch(Gr){case"--version":case"-v":case"version":{console.log(Wr());break}case"init":{ft||(console.error("Usage: velu init <project-name>"),D.exit(1));let e=ft,t=pt.resolve(D.cwd(),e),{initProject:r}=await Promise.resolve().then(()=>(an(),sn));await r(t,e);break}case"migrate":{let{runMigrate:e}=await Promise.resolve().then(()=>(zn(),Mn));D.exitCode=await e(D.argv.slice(3),Wr());break}case"dev":{let{maybeAutoUpdate:e}=await Promise.resolve().then(()=>(_t(),Lt));await e();let t=pt.resolve(D.cwd(),ft??"."),{startDevServer:r}=await Promise.resolve().then(()=>(Br(),Vr));await r(t);break}case"update":{let{updateCommand:e}=await Promise.resolve().then(()=>(_t(),Lt));await e();break}case"validate":{let e=pt.resolve(D.cwd(),ft??"."),{runValidate:t}=await Promise.resolve().then(()=>(qr(),Jr)),r=await t(e);D.exit(r);break}case"build":{let e=pt.resolve(D.cwd(),ea()??"."),t=D.argv.indexOf("--out"),r=t>-1?D.argv[t+1]:void 0,n=new URL(["..","src","build","index.js"].join("/"),import.meta.url).href,o=a=>import(a),i;try{({runBuild:i}=await o(n))}catch{console.error("velu build is an internal command, not available in this distribution."),D.exit(1)}await i(e,{out:r});break}default:console.log("Usage:"),console.log(" velu init <project-name> scaffold a new docs project"),console.log(" velu migrate mintlify [dir] migrate a Mintlify project (see --help)"),console.log(" velu dev [dir] start the dev preview server"),console.log(" velu validate [dir] check velu.json + content for problems"),console.log(" velu update update velu to the latest version"),D.exit(Gr?1:0)}}ta().catch(e=>{console.error(D.env.VELU_DEBUG?e:`Error: ${e.message}`),D.exit(1)});
208
+ `),process.env.VELU_DEBUG&&t&&console.error(t)}function Mr(){try{return JSON.parse(we.readFileSync(G.join(pt,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function qs(e,t){let r=G.resolve(e,".velu"),n=G.resolve(r,".velu-version"),o=null;try{o=we.readFileSync(n,"utf8").trim()}catch{}if(o!==t){if(o!==null)try{we.rmSync(G.join(r,"vite-cache"),{recursive:!0,force:!0}),console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026")}catch{}try{we.mkdirSync(r,{recursive:!0}),we.writeFileSync(n,t)}catch{}}}async function zr(e){try{return await Xn(e)}catch{return Nt({},G.basename(e))}}async function Vr(e,t){let r=await e.moduleGraph.getModuleByUrl(t,!0),n=new Map,o=new Set;async function i(a){if(!(!a||o.has(a.url))){if(o.add(a.url),a.id&&Bs.test(a.id)){let s=a.url.includes("?")?"&":"?",l=await e.transformRequest(`${a.url}${s}direct`);l?.code&&n.set(a.url,l.code)}for(let s of a.importedModules)await i(s)}}return await i(r),[...n.values()].join(`
209
+ `)}function Hs(e,t,r){let n=()=>{process.stdout.isTTY&&!process.env.VELU_NO_BELL&&process.stdout.write("\x07")},o=process.stdout.isTTY,i=g=>o&&process.stdout.write(`\x1B]${g}\x1B\\`),a=()=>{i(`0;\u23F3 ${t}`),i("9;4;3;0")},s=()=>{i(`0;${t}`),i("9;4;0;0")};o&&process.once("exit",()=>i("9;4;0;0")),a();let l=r&&r!=="unknown"?`v${r}`:"";if(!e)return console.log(`Starting Velu${l?" "+l:""}\u2026`),{ready:g=>{console.log(`Velu${l?" "+l:""} ready \u2192 ${g}`),s(),n()}};let c="\x1B[38;2;220;20;60m",u="\x1B[0m",p="\x1B[2m";console.log("");for(let g of Gs)console.log(`${c}${g}${u}`);l&&console.log(` ${p}${l}${u}`),console.log("");let y=null;try{y=Us(process.execPath,["-e",Ws],{stdio:["ignore","inherit","ignore"]}),y.on("error",()=>{})}catch{}let m=()=>{if(y){try{y.kill()}catch{}y=null}};return process.once("exit",m),{ready:g=>{m(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${u} Velu${l?" "+l:""} ready \u2192 \x1B[36m${g}${u}`),s(),n()}}}async function Ks(e){let t=!!process.env.VELU_PROFILE,r=performance.now(),n=(T,$)=>t&&console.log(`[velu-profile] ${T}: ${(performance.now()-$).toFixed(0)}ms`),o=Hs(!!process.stdout.isTTY&&!t,G.basename(e),Mr()),i=await zr(e),a=l(),s=Me(e);function l(){let $=at(e).filter(E=>E.severity==="error"&&(E.category==="config-json"||E.category==="config-schema"));return $.length&&console.error(`
210
+ `+it($,{color:!!process.stderr.isTTY})+`
211
+ `),$}let c=e;try{c=we.realpathSync(e)}catch{}let u=0,p=T=>{let $=performance.now();if($-u<500)return;u=$;let E=Ve(T,{projectDir:c,knownComponents:te});Ir(E,T)};process.on("unhandledRejection",p),process.on("uncaughtException",p);let y=Number(process.env.PORT)||8358,m=await Zt();qs(e,Mr());let g=on(),v=Rs.createServer(g),d=Ms(t?"info":"warn"),h=T=>typeof T=="string"&&T.includes("Failed to load source map"),S=d.warn.bind(d),O=d.warnOnce.bind(d);d.warn=(T,$)=>{h(T)||S(T,$)},d.warnOnce=(T,$)=>{h(T)||O(T,$)};let A=await Is({...$r({targetDir:e,VITE_ROOT:pt,validateProps:m}),appType:"custom",logLevel:t?"info":"warn",customLogger:d,server:{middlewareMode:!0,fs:{allow:[zs(pt),e,c]},hmr:{server:v}}});n("vite server created",r),g.get(new RegExp(`^${tt}/`),(T,$,E)=>{let k=pr(s,T.path);if(!k)return E();$.sendFile(k.abs,F=>{F&&$.status(404).end()})}),g.use(A.middlewares);let x=G.join(e,"public");g.use(on.static(x)),g.get(new RegExp(`^${Ut}(\\.[a-z0-9]+)?$`,"i"),async(T,$)=>{if(!i.favicon)return $.status(404).end();let E=G.resolve(e,i.favicon.replace(/^\//,""));$.sendFile(E,k=>{k&&$.status(404).end()})});let w=T=>($,E)=>{let k=i.logo?.[T];if(!k)return E.status(404).end();E.sendFile(G.resolve(e,k.replace(/^\//,"")),F=>{F&&E.status(404).end()})};g.get(new RegExp(`^${_e}(\\.[a-z0-9]+)?$`,"i"),w("light")),g.get(new RegExp(`^${Re}(\\.[a-z0-9]+)?$`,"i"),w("dark")),g.post("/@velu-api-proxy",on.json({limit:"8mb"}),async(T,$)=>{let{method:E="GET",url:k,headers:F={},body:R}=T.body||{};if(typeof k!="string"||!/^https?:\/\//i.test(k))return $.status(400).json({error:"A valid http(s) target URL is required."});try{let U=await fetch(k,{method:E,headers:F,body:R!=null&&R!==""?R:void 0}),V=await U.text(),f=U.headers.get("content-type")||"",b={};U.headers.forEach((C,M)=>{b[M]=C});let j=V;if(/json/i.test(f))try{j=JSON.parse(V)}catch{}$.json({status:U.status,statusText:U.statusText,headers:b,body:j})}catch(U){$.json({error:`Request failed: ${U.message}`})}});let L=null,P=async()=>L||=await xe(e);g.get(/\.md$/i,async(T,$,E)=>{try{let k=await P(),F=await rn(e,Lr(decodeURIComponent(T.path)),ut(k));if(!F)return E();$.status(200).set({"Content-Type":F.contentType,...be}).end(nn(F.body,F.kind))}catch{E()}}),g.get(ve,async(T,$,E)=>{try{let k=await Pr(e,await P());$.status(200).set({"Content-Type":"text/plain; charset=utf-8",...be}).end(k)}catch{E()}}),g.get(ct,async(T,$,E)=>{try{let k=await _r(e,await P());$.status(200).set({"Content-Type":"text/plain; charset=utf-8",...be}).end(k)}catch{E()}}),g.get("/rss.xml",async(T,$,E)=>{try{let k=await Rr(e,await P());if(!k)return E();$.status(200).set({"Content-Type":"application/rss+xml; charset=utf-8"}).end(k)}catch{E()}}),g.use("*",async(T,$,E)=>{let k=T.originalUrl,F=performance.now();if(/text\/markdown/i.test(T.headers.accept||""))try{let R=await P(),U=await rn(e,bt(k),ut(R));if(U)return $.status(200).set({"Content-Type":U.contentType,...be}).end(nn(U.body,U.kind))}catch{}if(a.length)return $.status(200).set({"Content-Type":"text/html"}).end(Kt(a,{title:"Fix velu.json to continue"}));try{let R=performance.now(),U=await Fr.readFile(Br,"utf-8");U=await A.transformIndexHtml(k,U),n(`transformIndexHtml ${k}`,R);let V="/src/runtime/server-entry.jsx";R=performance.now();let{render:f}=await A.ssrLoadModule(V);n(`ssrLoadModule ${k} (1st req includes dep pre-bundle)`,R),R=performance.now();let b=await f(k);n(`render ${k}`,R),R=performance.now();let j=await Vr(A,V);n(`collectSsrCss ${k}`,R);let C=j?`<style data-velu-ssr>${j}</style>`:"",M=`<style data-velu-config>
212
+ ${Yn(i)}
213
+ </style>`,ie=Ds.has(i.font.family)?"":Js(i.font.family),J=Kn(i),se=J?`<link rel="icon"${J.type?` type="${J.type}"`:""} href="${J.url}" />`:"",dt=fr(s),Xr=[C,M,ie,se,dt].filter(Boolean).join(`
214
+ `),Yr=U.replace('<html lang="en">',`<html lang="en" data-current-path="${Nr(bt(k))}">`).replace("<!--app-title-->",Nr(i.name)).replace("<!--app-head-->",Xr).replace("<!--app-html-->",b);$.status(200).set({"Content-Type":"text/html",...be}).end(Yr),n(`TOTAL ${k}`,F)}catch(R){A.ssrFixStacktrace(R);let U=Ve(R,{projectDir:c,knownComponents:te});if(/failed to load url|does the file exist|cannot find module|ERR_MODULE_NOT_FOUND/i.test(String(R&&R.message))){try{A.moduleGraph.invalidateAll()}catch{}U.hint="The dev server cache is out of sync \u2014 this usually happens after files are added, removed, or moved. Reload the page; if it persists, stop velu dev, delete the .velu folder in your project, and restart."}Ir(U,R),$.status(200).set({"Content-Type":"text/html"}).end(Kt([U]))}}),Ns.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(T,$)=>{console.log(`[velu-cli] content ${T}: ${G.relative(e,$)}`);let E=G.basename($)==="velu.json",k=$.endsWith(".mdx"),F=/\.(css|js)$/i.test($),R=!1;if(F){let V=b=>b.scripts.some(j=>j.abs===$),f=V(s);s=Me(e),R=f||V(s)}let U=E||k&&(T==="add"||T==="unlink")||R;if((U||k||/\.(ya?ml|json)$/i.test($))&&(L=null),E&&(i=await zr(e),a=l()),U)A.moduleGraph.invalidateAll();else if(k){let V=$.split(G.sep).join("/"),f=A.moduleGraph.getModulesByFile(V);if(f)for(let b of f)A.moduleGraph.invalidateModule(b)}A.ws.send({type:"full-reload"})});async function ee(T){let $=new Set,E=12,k=0,F=[],R=()=>k<E?(k+=1,Promise.resolve()):new Promise(b=>F.push(b)).then(()=>{k+=1}),U=()=>{k-=1,F.shift()?.()},V=b=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(b)||/[\\/]node_modules[\\/]/.test(b)&&!/velu-ui/.test(b);async function f(b){if(!(!b||$.has(b)||V(b))){$.add(b);try{await R();try{await A.transformRequest(b,{ssr:!1})}finally{U()}let j=await A.moduleGraph.getModuleByUrl(b,!1);j?.importedModules?.size&&await Promise.all([...j.importedModules].map(C=>f(C.url)))}catch{}}}return await f(T),$.size}v.listen(y,async()=>{let T=performance.now(),$=0;try{let{render:E}=await A.ssrLoadModule("/src/runtime/server-entry.jsx");await ee("/src/runtime/client-entry.jsx"),typeof A.waitForRequestsIdle=="function"&&await A.waitForRequestsIdle();let[k]=await Promise.allSettled([ee("/src/runtime/client-entry.jsx"),E("/"),A.transformIndexHtml("/",await Fr.readFile(Br,"utf-8")),Vr(A,"/src/runtime/server-entry.jsx")]).then(F=>F.map(R=>R.status==="fulfilled"?R.value:0));$=k}catch(E){t&&console.log("[velu-profile] warmup error:",E?.message)}n(`cold-start warm-up (${$} client modules)`,T),o.ready(`http://localhost:${y}`)})}var Vs,Bs,Ds,Nr,pt,Br,Gs,Ws,Jr=_(()=>{Fe();Sr();Ht();jr();ue();We();Yt();Qt();Ur();re();Jt();Vs=G.dirname(Fs(import.meta.url)),Bs=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,Ds=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),Nr=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");pt=G.resolve(Vs,".."),Br=G.resolve(pt,"src","template.html"),Gs=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],Ws="const F=['\u280B','\u2819','\u2839','\u2838','\u283C','\u2834','\u2826','\u2827','\u2807','\u280F'],M=['Starting Velu','Setting up your preview','Preparing your docs','Warming things up','Almost ready'];let f=0,m=0;const t=Date.now();const C='\\x1b[38;2;220;20;60m',R='\\x1b[0m',D='\\x1b[2m';const d=()=>{const s=(Date.now()-t)/1000|0;process.stdout.write('\\x1b[2K\\r '+C+F[f]+R+' '+M[m]+'\\u2026 '+D+s+'s'+R);f=(f+1)%F.length;};d();setInterval(d,90);setInterval(()=>{if(m<M.length-1)m++;},4000);"});var Gr={};$e(Gr,{default:()=>Qs,runValidate:()=>qr});import Xs from"node:fs";import Ys from"node:path";function Zs(e){try{let t=JSON.parse(Xs.readFileSync(Ys.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let r=X(t.navigation);return ae(r,e).pageEntries}catch{return[]}}async function qr(e){let t=at(e),r=Zs(e),n=await Ar(e,r),o=[...t,...n],i=!!process.stdout.isTTY;return console.log(it(o,{color:i})),o.some(s=>s.severity!=="warning"&&s.severity!=="info")?1:0}var Qs,Wr=_(()=>{re();Ie();Yt();Qt();ue();Qs=qr});import ft from"node:path";import D from"node:process";import{readFileSync as ea}from"node:fs";var[,,Hr,mt]=D.argv;function Kr(){try{return JSON.parse(ea(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function ta(){let e=D.argv.slice(3);for(let t=0;t<e.length;t++){let r=e[t];if(r==="--out"){t++;continue}if(!r.startsWith("-"))return r}}async function na(){switch(Hr){case"--version":case"-v":case"version":{console.log(Kr());break}case"init":{mt||(console.error("Usage: velu init <project-name>"),D.exit(1));let e=mt,t=ft.resolve(D.cwd(),e),{initProject:r}=await Promise.resolve().then(()=>(ln(),an));await r(t,e);break}case"migrate":{let{runMigrate:e}=await Promise.resolve().then(()=>(Vn(),zn));D.exitCode=await e(D.argv.slice(3),Kr());break}case"dev":{let{maybeAutoUpdate:e}=await Promise.resolve().then(()=>(Rt(),_t));await e();let t=ft.resolve(D.cwd(),mt??"."),{startDevServer:r}=await Promise.resolve().then(()=>(Jr(),Dr));await r(t);break}case"update":{let{updateCommand:e}=await Promise.resolve().then(()=>(Rt(),_t));await e();break}case"validate":{let e=ft.resolve(D.cwd(),mt??"."),{runValidate:t}=await Promise.resolve().then(()=>(Wr(),Gr)),r=await t(e);D.exit(r);break}case"build":{let e=ft.resolve(D.cwd(),ta()??"."),t=D.argv.indexOf("--out"),r=t>-1?D.argv[t+1]:void 0,n=new URL(["..","src","build","index.js"].join("/"),import.meta.url).href,o=a=>import(a),i;try{({runBuild:i}=await o(n))}catch{console.error("velu build is an internal command, not available in this distribution."),D.exit(1)}await i(e,{out:r});break}default:console.log("Usage:"),console.log(" velu init <project-name> scaffold a new docs project"),console.log(" velu migrate mintlify [dir] migrate a Mintlify project (see --help)"),console.log(" velu dev [dir] start the dev preview server"),console.log(" velu validate [dir] check velu.json + content for problems"),console.log(" velu update update velu to the latest version"),D.exit(Hr?1:0)}}na().catch(e=>{console.error(D.env.VELU_DEBUG?e:`Error: ${e.message}`),D.exit(1)});