@veluai/velu 0.2.48 → 0.2.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- var ro=Object.defineProperty;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var Se=(e,t)=>{for(var r in t)ro(e,r,{get:t[r],enumerable:!0})};var ln={};Se(ln,{initProject:()=>ao});import de from"node:fs/promises";import ge from"node:path";import{fileURLToPath as oo}from"node:url";async function ao(e,t){try{if((await de.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 de.mkdir(e,{recursive:!0}),await de.cp(so,e,{recursive:!0});let r=ge.join(e,"velu.json"),n=JSON.parse(await de.readFile(r,"utf-8"));n.name=t,await de.writeFile(r,JSON.stringify(n,null,2)+`
3
- `,"utf-8");let o=await an(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 an(e,t=e,r=[]){let n=await de.readdir(e,{withFileTypes:!0});for(let o of n){let i=ge.join(e,o.name);o.isDirectory()?await an(i,t,r):r.push(ge.relative(t,i).split(ge.sep).join("/"))}return r.sort()}var io,so,cn=_(()=>{io=ge.dirname(oo(import.meta.url)),so=ge.resolve(io,"..","templates","starter")});import ke from"node:fs";import X from"node:path";import{fileURLToPath as lo}from"node:url";import{parse as co,printParseErrorCode as uo}from"jsonc-parser";import po from"js-yaml";function le(e,t){let r=X.relative(e,t);return r===""||!r.startsWith(`..${X.sep}`)&&r!==".."&&!X.isAbsolute(r)}function ht(e,t){let r=[],n=co(e.replace(/^\uFEFF/,""),r,{allowTrailingComma:!0});if(r.length)throw new Error(`${t}: ${uo(r[0].error)} at offset ${r[0].offset}`);return n}function un(e,t){let r=ke.realpathSync(e);function n(i,a=[]){if(!le(r,ke.realpathSync(i)))throw new Error("Config reference escapes the source directory.");if(a.includes(i))throw new Error(`Circular config reference: ${gt(X.relative(e,i))}`);if(a.length>50)throw new Error("Config reference nesting exceeds 50 levels.");let s=ke.readFileSync(i,"utf8"),l=/\.ya?ml$/i.test(i)?po.load(s):ht(s,X.basename(i));function c(u){if(Array.isArray(u))return u.map(c);if(!H(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=X.resolve(X.dirname(i),u.$ref);if(!le(e,p))throw new Error("Config reference escapes the source directory.");let y=n(p,[...a,i]),f=Object.fromEntries(Object.entries(u).filter(([g])=>g!=="$ref").map(([g,b])=>[g,c(b)]));if(Object.keys(f).length&&!H(y))throw new Error("Config $ref siblings require an object reference.");return H(y)?{...y,...f}:y}return Object.fromEntries(Object.entries(u).map(([p,y])=>[p,c(y)]))}return c(l)}let o=n(X.join(e,t));if(!H(o))throw new Error(`${t} must contain an object.`);return o}function fo(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(f=>p===f||p.startsWith(f+"/")))?[c]:[]}if(!H(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 pn(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=fo(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}H(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.")),H(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,b)=>o(g,`${y}[${b}]`));if(!H(p))return p;let f={...p};if(Array.isArray(f.dropdowns)&&!f.products&&!f.tabs&&(f.tabs=f.dropdowns.map(({dropdown:g,...b})=>({tab:g,...b})),delete f.dropdowns,r("navigation-dropdowns","warning",y,"Dropdowns converted to tabs. Check navigation layout and URLs.")),f.global){for(let g of["anchors","tabs"])Array.isArray(f.global[g])&&(f[g]=[...f[g]||[],...f.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 f.global}H(f.icon)&&typeof f.icon.name=="string"&&(f.icon=f.icon.name,r("icon-library","warning",`${y}.icon`,"Icon name retained; check its equivalent in Velu\u2019s Lucide icon library.")),H(f.openapi)&&typeof f.openapi.source=="string"&&(r("openapi-options","warning",`${y}.openapi`,"OpenAPI source retained; generation options need review."),f.openapi=f.openapi.source);for(let[g,b]of Object.entries(f))g==="pages"&&Array.isArray(b)?f[g]=b.map((m,h)=>typeof m=="string"?m.replace(/\.(mdx|md)$/i,""):o(m,`${y}.pages[${h}]`)):(H(b)||Array.isArray(b))&&(f[g]=o(b,`${y}.${g}`));return f}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=X.dirname(lo(import.meta.url)),a=[X.resolve(i,"../../schema/velu.schema.json"),X.resolve(i,"../schema/velu.schema.json")].find(p=>ke.existsSync(p));if(!a)throw new Error("Velu config schema is missing from this installation.");let s=JSON.parse(ke.readFileSync(a,"utf8")),l=p=>p.$ref?p.$ref.split("/").slice(1).reduce((y,f)=>y[f],s):p,c=p=>Array.isArray(p)?"array":p===null?"null":typeof p;function u(p,y,f){let g=l(y);if(g.oneOf&&(g=g.oneOf.map(l).find(b=>b.type&&c(p)!==b.type||b.properties?.type?.const&&p?.type!==b.properties.type.const?!1:Array.isArray(b.required)&&b.required.length&&H(p)?b.required.every(m=>Object.prototype.hasOwnProperty.call(p,m)):!0),!g)){r("config-shape","error",f,"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",f,"Unsupported value or type; original retained in source config.");return}if(typeof p=="string"&&g.minLength&&p.length<g.minLength&&r("config-value","error",f,"Value must not be empty."),H(p)){let b={};for(let[m,h]of Object.entries(p)){let $=f?`${f}.${m}`:m,P=g.properties?.[m]||(H(g.additionalProperties)?g.additionalProperties:null);if(!P&&g.additionalProperties===!1){let T=/(^|\.)(auth|authentication|groups|hidden|public|permissions|personalization)(\.|$)/.test($);r("unsupported-config",T?"error":"warning",$,T?"Access or visibility rules require manual migration before publishing.":"No equivalent in the Velu schema; original setting preserved in source config.");continue}let E=P?u(h,P,$):h;E!==void 0&&Object.defineProperty(b,m,{value:E,enumerable:!0,writable:!0,configurable:!0})}for(let m of g.required||[])m in b||r("required-config","error",f?`${f}.${m}`:m,"Required Velu setting is missing.");return b}return Array.isArray(p)&&g.items?(g.maxItems&&p.length>g.maxItems&&r("config-limit","warning",f,`Velu supports up to ${g.maxItems} entries here; review rendering.`),p.map((b,m)=>u(b,g.items,`${f}[${m}]`)).filter(b=>b!==void 0)):p}return u(n,s,"")}var H,gt,Ge=_(()=>{H=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),gt=e=>e.split(X.sep).join("/")});var ne,We=_(()=>{ne=["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 G from"node:path";import{createProcessor as mo,compile as go}from"@mdx-js/mdx";import fn from"remark-frontmatter";import ho from"remark-mdx-frontmatter";import mn from"remark-gfm";import{visit as dn}from"unist-util-visit";import yo from"js-yaml";import{parse as vo}from"@babel/parser";import bo from"postcss";async function gn(e,t,r,n,{endpointConverted:o=!1}={}){let i=mo({remarkPlugins:[fn,mn]}),a;try{a=i.parse(e)}catch(m){return n("mdx-syntax","error",t,m.reason||m.message,m.line),{text:e,adapters:[]}}let s=new Set,l=[],c=[],u=new Set,p=new Set,y=new Set,f=(m,h,$)=>c.push({start:m,end:h,value:$});dn(a,"mdxjsEsm",m=>{for(let h of m.data?.estree?.body||[]){if(h.type==="ImportDeclaration"){for(let P of h.specifiers)s.add(P.local.name);l.push({node:m,stmt:h})}let $=h.declaration;$?.id?.name&&s.add($.id.name);for(let P of $?.declarations||[])P.id?.name&&s.add(P.id.name)}});let g=(m,h=!1)=>{if(typeof m!="string"||/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(m)||h&&!m.startsWith(".")&&!m.startsWith("/"))return m;let[,$,P]=/^([^?#]*)(.*)$/.exec(m),E=G.posix.normalize($.startsWith("/")?$.slice(1):G.posix.join(G.posix.dirname(t),$)),T=r.get(E);if(!T)return h&&n("missing-import","error",t,`Local import cannot be resolved in migrated files: ${m}`),m;if(h){let S=G.posix.relative(G.posix.dirname(r.get(t)||t),T);return(S.startsWith(".")?S:"./"+S)+P}return/\.(md|mdx)$/i.test(T)||p.add(T),/\.mdx$/i.test(T)&&/\.(md|mdx)$/i.test($)?$.replace(/\.(md|mdx)$/i,"")+P:m};for(let{stmt:m}of l){let h=m.source.value;/^(?:@mintlify\/|next(?:\/|$))/.test(h)&&n("runtime-import","error",t,`Replace the runtime dependency ${h} with a Velu/React equivalent.`);let $=g(h,!0);$!==h&&f(m.source.start,m.source.end,JSON.stringify($))}dn(a,m=>{if(m.type==="yaml")try{let S=yo.load(m.value)||{};for(let w of Object.keys(S))if(["auth","groups","public","hidden"].includes(w))n("page-access","error",t,`Frontmatter ${w} requires manual visibility/access migration.`,m.position.start.line);else{if(w==="openapi"&&o)continue;["api","openapi","asyncapi"].includes(w)?n("endpoint-frontmatter","error",t,`Frontmatter ${w} is preserved but does not generate an endpoint in Velu. Wire the spec into navigation.openapi and review endpoint routes.`,m.position.start.line):["title","description","icon","sidebarTitle","mode","keywords","og:title","og:description","og:image"].includes(w)||n("frontmatter-review","warning",t,`Frontmatter ${w} is preserved; verify its behavior in Velu.`,m.position.start.line)}}catch(S){n("frontmatter-syntax","error",t,S.message,m.position.start.line)}if(["link","image","definition"].includes(m.type)&&m.url){let S=g(m.url);if(S!==m.url){let w=m.position.start.offset,I=e.slice(w,m.position.end.offset).lastIndexOf(m.url);I>=0&&f(w+I,w+I+m.url.length,S)}}if(!["mdxJsxFlowElement","mdxJsxTextElement"].includes(m.type)||!m.name)return;let h=m.name,$=m.position.start.line;if(s.has(h.split(".")[0]))return;y.add(h);let P=yt[h]?"Callout":["ParamField","ResponseField"].includes(h)?"Field":h==="Expandable"?"Accordion":h;if(P!==h&&s.has(P)){n("component-name-conflict","error",t,`Cannot convert <${h}> to <${P}> because that name is already locally defined. Rename the local binding before migration.`,$);return}let E=m.attributes.filter(S=>S.type==="mdxJsxAttribute"),T=(S,w)=>{let L=E.find(I=>I.name===S);L&&!E.some(I=>I.name===w)&&f(L.position.start.offset,L.position.start.offset+S.length,w)};if(h==="ParamField")for(let S of["body","query","path","header","cookie"])T(S,"name");if(h==="CardGroup"&&T("cols","limit"),h==="Accordion"&&T("default-open","defaultOpen"),h==="Expandable"&&(T("title","title"),E.some(S=>S.name==="title")||f(m.position.start.offset+1+h.length,m.position.start.offset+1+h.length,' title="Details"')),P!==h){let S=m.position.start.offset;f(S+1,S+1+h.length,P+(yt[h]?` type="${yt[h]}"`:""));let w=m.position.end.offset,L=new RegExp(`</${h}\\s*>$`).exec(e.slice(S,w));L&&f(w-L[0].length+2,w-L[0].length+2+h.length,P)}xo.has(h)?(u.add(h),n("component-adapter","warning",t,`<${h}> uses an editable React adapter. Review visual styling and optional props.`,$)):/^[A-Z]/.test(P)&&!wo.has(P)&&n("unsupported-component","error",t,`<${h}> needs a local component implementation or import.`,$);for(let S of E)if(["href","src"].includes(S.name)&&typeof S.value=="string"){let w=g(S.value);if(w!==S.value){let L=S.position.start.offset,F=e.slice(L,S.position.end.offset).indexOf(S.value);F>=0&&f(L+F,L+F+S.value.length,w)}}}),c.sort((m,h)=>h.start-m.start||h.end-m.end);let b=e;for(let m of c)b=b.slice(0,m.start)+m.value+b.slice(m.end);if(u.size){let m=G.posix.relative(G.posix.dirname(r.get(t)||t),he);b+=`
2
+ var ho=Object.defineProperty;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var Se=(e,t)=>{for(var r in t)ho(e,r,{get:t[r],enumerable:!0})};var fn={};Se(fn,{initProject:()=>xo});import de from"node:fs/promises";import ge from"node:path";import{fileURLToPath as yo}from"node:url";async function xo(e,t){try{if((await de.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 de.mkdir(e,{recursive:!0}),await de.cp(bo,e,{recursive:!0});let r=ge.join(e,"velu.json"),n=JSON.parse(await de.readFile(r,"utf-8"));n.name=t,await de.writeFile(r,JSON.stringify(n,null,2)+`
3
+ `,"utf-8");let o=await pn(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 pn(e,t=e,r=[]){let n=await de.readdir(e,{withFileTypes:!0});for(let o of n){let i=ge.join(e,o.name);o.isDirectory()?await pn(i,t,r):r.push(ge.relative(t,i).split(ge.sep).join("/"))}return r.sort()}var vo,bo,mn=L(()=>{vo=ge.dirname(yo(import.meta.url)),bo=ge.resolve(vo,"..","templates","starter")});import ke from"node:fs";import X from"node:path";import{fileURLToPath as wo}from"node:url";import{parse as $o,printParseErrorCode as So}from"jsonc-parser";import ko from"js-yaml";function le(e,t){let r=X.relative(e,t);return r===""||!r.startsWith(`..${X.sep}`)&&r!==".."&&!X.isAbsolute(r)}function je(e,t){let r=[],n=$o(e.replace(/^\uFEFF/,""),r,{allowTrailingComma:!0});if(r.length)throw new Error(`${t}: ${So(r[0].error)} at offset ${r[0].offset}`);return n}function dn(e,t){let r=ke.realpathSync(e);function n(i,a=[]){if(!le(r,ke.realpathSync(i)))throw new Error("Config reference escapes the source directory.");if(a.includes(i))throw new Error(`Circular config reference: ${yt(X.relative(e,i))}`);if(a.length>50)throw new Error("Config reference nesting exceeds 50 levels.");let s=ke.readFileSync(i,"utf8"),l=/\.ya?ml$/i.test(i)?ko.load(s):je(s,X.basename(i));function c(p){if(Array.isArray(p))return p.map(c);if(!H(p))return p;if(typeof p.$ref=="string"){if(!/^\.\.?\//.test(p.$ref)||/[#?]/.test(p.$ref))throw new Error(`Config $ref must be a local JSON/YAML file without a fragment: ${p.$ref}`);let u=X.resolve(X.dirname(i),p.$ref);if(!le(e,u))throw new Error("Config reference escapes the source directory.");let y=n(u,[...a,i]),f=Object.fromEntries(Object.entries(p).filter(([g])=>g!=="$ref").map(([g,b])=>[g,c(b)]));if(Object.keys(f).length&&!H(y))throw new Error("Config $ref siblings require an object reference.");return H(y)?{...y,...f}:y}return Object.fromEntries(Object.entries(p).map(([u,y])=>[u,c(y)]))}return c(l)}let o=n(X.join(e,t));if(!H(o))throw new Error(`${t} must contain an object.`);return o}function jo(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 u=c.replace(/^\//,"");return(s?u===s||u.startsWith(s+"/"):!l.some(f=>u===f||u.startsWith(f+"/")))?[c]:[]}if(!H(c))return[];let p=o(c.pages||[],s,l);return p.length?[{...c,pages:p}]:[]})}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 p=(c.url||"").replace(/^\/+|\/+$/g,"");return{tab:c.name,...c.icon?{icon:c.icon}:{},groups:o(r,p,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 gn(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=jo(n,r),n.topbarLinks&&(n.navbar={...n.navbar,links:n.topbarLinks.map(({name:u,...y})=>({...y,label:u}))}),n.topbarCta){let{name:u,...y}=n.topbarCta;u&&!y.label&&(y.label=u),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 u of["tabs","anchors","topbarLinks","topbarCta","footerSocials","modeToggle"])delete n[u];n.api&&(delete n.api.baseUrl,delete n.api.request)}if(n.fonts&&!n.font){let u=n.fonts.family||n.fonts.body?.family;u&&(n.font={family:u}),r("fonts","warning","fonts","Body font family migrated where available; custom font sources, weights, and heading fonts need review."),delete n.fonts}H(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.")),H(n.logo)&&(n.logo.light??=n.logo.dark,n.logo.dark??=n.logo.light);function o(u,y="navigation"){if(Array.isArray(u))return u.map((g,b)=>o(g,`${y}[${b}]`));if(!H(u))return u;let f={...u};if(Array.isArray(f.dropdowns)&&!f.products&&!f.tabs&&(f.tabs=f.dropdowns.map(({dropdown:g,...b})=>({tab:g,...b})),delete f.dropdowns,r("navigation-dropdowns","warning",y,"Dropdowns converted to tabs. Check navigation layout and URLs.")),f.global){for(let g of["anchors","tabs"])Array.isArray(f.global[g])&&(f[g]=[...f[g]||[],...f.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 f.global}H(f.icon)&&typeof f.icon.name=="string"&&(f.icon=f.icon.name,r("icon-library","warning",`${y}.icon`,"Icon name retained; check its equivalent in Velu\u2019s Lucide icon library.")),H(f.openapi)&&typeof f.openapi.source=="string"&&(r("openapi-options","warning",`${y}.openapi`,"OpenAPI source retained; generation options need review."),f.openapi=f.openapi.source);for(let[g,b]of Object.entries(f))g==="pages"&&Array.isArray(b)?f[g]=b.map((d,h)=>typeof d=="string"?d.replace(/\.(mdx|md)$/i,""):o(d,`${y}.pages[${h}]`)):(H(b)||Array.isArray(b))&&(f[g]=o(b,`${y}.${g}`));return f}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=X.dirname(wo(import.meta.url)),a=[X.resolve(i,"../../schema/velu.schema.json"),X.resolve(i,"../schema/velu.schema.json")].find(u=>ke.existsSync(u));if(!a)throw new Error("Velu config schema is missing from this installation.");let s=JSON.parse(ke.readFileSync(a,"utf8")),l=u=>u.$ref?u.$ref.split("/").slice(1).reduce((y,f)=>y[f],s):u,c=u=>Array.isArray(u)?"array":u===null?"null":typeof u;function p(u,y,f){let g=l(y);if(g.oneOf&&(g=g.oneOf.map(l).find(b=>b.type&&c(u)!==b.type||b.properties?.type?.const&&u?.type!==b.properties.type.const?!1:Array.isArray(b.required)&&b.required.length&&H(u)?b.required.every(d=>Object.prototype.hasOwnProperty.call(u,d)):!0),!g)){r("config-shape","error",f,"Value does not match any supported Velu shape; original retained in source config.");return}if(g.type&&c(u)!==g.type||g.enum&&!g.enum.includes(u)||"const"in g&&u!==g.const){r("config-value","error",f,"Unsupported value or type; original retained in source config.");return}if(typeof u=="string"&&g.minLength&&u.length<g.minLength&&r("config-value","error",f,"Value must not be empty."),H(u)){let b={};for(let[d,h]of Object.entries(u)){let $=f?`${f}.${d}`:d,P=g.properties?.[d]||(H(g.additionalProperties)?g.additionalProperties:null);if(!P&&g.additionalProperties===!1){let T=/(^|\.)(auth|authentication|groups|hidden|public|permissions|personalization)(\.|$)/.test($);r("unsupported-config",T?"error":"warning",$,T?"Access or visibility rules require manual migration before publishing.":"No equivalent in the Velu schema; original setting preserved in source config.");continue}let E=P?p(h,P,$):h;E!==void 0&&Object.defineProperty(b,d,{value:E,enumerable:!0,writable:!0,configurable:!0})}for(let d of g.required||[])d in b||r("required-config","error",f?`${f}.${d}`:d,"Required Velu setting is missing.");return b}return Array.isArray(u)&&g.items?(g.maxItems&&u.length>g.maxItems&&r("config-limit","warning",f,`Velu supports up to ${g.maxItems} entries here; review rendering.`),u.map((b,d)=>p(b,g.items,`${f}[${d}]`)).filter(b=>b!==void 0)):u}return p(n,s,"")}var H,yt,Ae=L(()=>{H=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),yt=e=>e.split(X.sep).join("/")});var ne,He=L(()=>{ne=["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 G from"node:path";import{createProcessor as Ao,compile as Oo}from"@mdx-js/mdx";import hn from"remark-frontmatter";import Eo from"remark-mdx-frontmatter";import yn from"remark-gfm";import{visit as vn}from"unist-util-visit";import To from"js-yaml";import{parse as Co}from"@babel/parser";import Po from"postcss";async function bn(e,t,r,n,{endpointConverted:o=!1}={}){let i=Ao({remarkPlugins:[hn,yn]}),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=[],p=new Set,u=new Set,y=new Set,f=(d,h,$)=>c.push({start:d,end:h,value:$});vn(a,"mdxjsEsm",d=>{for(let h of d.data?.estree?.body||[]){if(h.type==="ImportDeclaration"){for(let P of h.specifiers)s.add(P.local.name);l.push({node:d,stmt:h})}let $=h.declaration;$?.id?.name&&s.add($.id.name);for(let P of $?.declarations||[])P.id?.name&&s.add(P.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[,$,P]=/^([^?#]*)(.*)$/.exec(d),E=G.posix.normalize($.startsWith("/")?$.slice(1):G.posix.join(G.posix.dirname(t),$)),T=r.get(E);if(!T)return h&&n("missing-import","error",t,`Local import cannot be resolved in migrated files: ${d}`),d;if(h){let S=G.posix.relative(G.posix.dirname(r.get(t)||t),T);return(S.startsWith(".")?S:"./"+S)+P}return/\.(md|mdx)$/i.test(T)||u.add(T),/\.mdx$/i.test(T)&&/\.(md|mdx)$/i.test($)?$.replace(/\.(md|mdx)$/i,"")+P: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 $=g(h,!0);$!==h&&f(d.source.start,d.source.end,JSON.stringify($))}vn(a,d=>{if(d.type==="yaml")try{let S=To.load(d.value)||{};for(let w of Object.keys(S))if(["auth","groups","public","hidden"].includes(w))n("page-access","error",t,`Frontmatter ${w} requires manual visibility/access migration.`,d.position.start.line);else{if(w==="openapi"&&o)continue;["api","openapi","asyncapi"].includes(w)?n("endpoint-frontmatter","error",t,`Frontmatter ${w} 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(w)||n("frontmatter-review","warning",t,`Frontmatter ${w} is preserved; verify its behavior in Velu.`,d.position.start.line)}}catch(S){n("frontmatter-syntax","error",t,S.message,d.position.start.line)}if(["link","image","definition"].includes(d.type)&&d.url){let S=g(d.url);if(S!==d.url){let w=d.position.start.offset,I=e.slice(w,d.position.end.offset).lastIndexOf(d.url);I>=0&&f(w+I,w+I+d.url.length,S)}}if(!["mdxJsxFlowElement","mdxJsxTextElement"].includes(d.type)||!d.name)return;let h=d.name,$=d.position.start.line;if(s.has(h.split(".")[0]))return;y.add(h);let P=vt[h]?"Callout":["ParamField","ResponseField"].includes(h)?"Field":h==="Expandable"?"Accordion":h;if(P!==h&&s.has(P)){n("component-name-conflict","error",t,`Cannot convert <${h}> to <${P}> because that name is already locally defined. Rename the local binding before migration.`,$);return}let E=d.attributes.filter(S=>S.type==="mdxJsxAttribute"),T=(S,w)=>{let _=E.find(I=>I.name===S);_&&!E.some(I=>I.name===w)&&f(_.position.start.offset,_.position.start.offset+S.length,w)};if(h==="ParamField")for(let S of["body","query","path","header","cookie"])T(S,"name");if(h==="CardGroup"&&T("cols","limit"),h==="Accordion"&&T("default-open","defaultOpen"),h==="Expandable"&&(T("title","title"),E.some(S=>S.name==="title")||f(d.position.start.offset+1+h.length,d.position.start.offset+1+h.length,' title="Details"')),P!==h){let S=d.position.start.offset;f(S+1,S+1+h.length,P+(vt[h]?` type="${vt[h]}"`:""));let w=d.position.end.offset,_=new RegExp(`</${h}\\s*>$`).exec(e.slice(S,w));_&&f(w-_[0].length+2,w-_[0].length+2+h.length,P)}Lo.has(h)?(p.add(h),n("component-adapter","warning",t,`<${h}> uses an editable React adapter. Review visual styling and optional props.`,$)):/^[A-Z]/.test(P)&&!_o.has(P)&&n("unsupported-component","error",t,`<${h}> needs a local component implementation or import.`,$);for(let S of E)if(["href","src"].includes(S.name)&&typeof S.value=="string"){let w=g(S.value);if(w!==S.value){let _=S.position.start.offset,F=e.slice(_,S.position.end.offset).indexOf(S.value);F>=0&&f(_+F,_+F+S.value.length,w)}}}),c.sort((d,h)=>h.start-d.start||h.end-d.end);let b=e;for(let d of c)b=b.slice(0,d.start)+d.value+b.slice(d.end);if(p.size){let d=G.posix.relative(G.posix.dirname(r.get(t)||t),he);b+=`
4
4
 
5
- import { ${[...u].sort().join(", ")} } from ${JSON.stringify(m.startsWith(".")?m:"./"+m)};
6
- `}try{await go(b,{remarkPlugins:[fn,ho,mn]})}catch(m){n("mdx-compile","error",t,m.reason||m.message,m.line)}return{text:b,adapters:[...u],components:[...y].sort(),assets:[...p]}}function hn(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 yn(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 vn(e,t,r,n){let o;try{o=vo(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=G.posix.normalize(u.startsWith("/")?u.slice(1):G.posix.join(G.posix.dirname(t),u)),y=r.get(p);if(y){let f=G.posix.relative(G.posix.dirname(r.get(t)||t),y),g=f.startsWith(".")?f:"./"+f;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 bn(e,t,r,n){let o;try{o=bo.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 f=/^([^?#]*)(.*)$/.exec(y),g=G.posix.normalize(G.posix.join(G.posix.dirname(t),f[1]));return r.has(g)?`url("${"/"+r.get(g).split("/").map(encodeURIComponent).join("/")+f[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 he,yt,xo,wo,vt,xn=_(()=>{We();Ge();he="snippets/velu-mintlify-compat.jsx",yt={Note:"note",Tip:"tip",Warning:"warning",Info:"info",Check:"check",Danger:"danger"},xo=new Set(["Tabs","Tab","Frame","Tooltip","Badge","Button","Panel"]),wo=new Set(ne),vt=`import React from 'react';
5
+ import { ${[...p].sort().join(", ")} } from ${JSON.stringify(d.startsWith(".")?d:"./"+d)};
6
+ `}try{await Oo(b,{remarkPlugins:[hn,Eo,yn]})}catch(d){n("mdx-compile","error",t,d.reason||d.message,d.line)}return{text:b,adapters:[...p],components:[...y].sort(),assets:[...u]}}function xn(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 wn(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 p=`velu ${c[1]==="v"?"version":c[1]}`;n.scripts[s]=p,o=!0,a.push({name:s,action:"converted",from:l,to:p})}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 $n(e,t,r,n){let o;try{o=Co(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 p=c.value;if(p.startsWith(".")||p.startsWith("/")){let u=G.posix.normalize(p.startsWith("/")?p.slice(1):G.posix.join(G.posix.dirname(t),p)),y=r.get(u);if(y){let f=G.posix.relative(G.posix.dirname(r.get(t)||t),y),g=f.startsWith(".")?f:"./"+f;p!==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: ${p}`,c.loc?.start.line)}}for(let[p,u]of Object.entries(l))["loc","comments","tokens","extra"].includes(p)||(Array.isArray(u)?u.forEach(s):u&&typeof u=="object"&&s(u))};s(o.program);for(let l of i.sort((c,p)=>p.start-c.start))e=e.slice(0,l.start)+l.value+e.slice(l.end);return e}function Sn(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,p,u)=>{let y=c??p??u;if(!y||/^(?:[a-z][a-z0-9+.-]*:|\/|#)/i.test(y))return l;let f=/^([^?#]*)(.*)$/.exec(y),g=G.posix.normalize(G.posix.join(G.posix.dirname(t),f[1]));return r.has(g)?`url("${"/"+r.get(g).split("/").map(encodeURIComponent).join("/")+f[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 he,vt,Lo,_o,bt,kn=L(()=>{He();Ae();he="snippets/velu-mintlify-compat.jsx",vt={Note:"note",Tip:"tip",Warning:"warning",Info:"info",Check:"check",Danger:"danger"},Lo=new Set(["Tabs","Tab","Frame","Tooltip","Badge","Button","Panel"]),_o=new Set(ne),bt=`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,28 @@ 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 $o from"github-slugger";import So from"iso-639-1";function jo(e){let t=String(e).toLowerCase();return So.getNativeName(t)||e}function He(e){return new $o().slug(String(e??""))}function wn(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 Y(e){let t={kind:"root",children:je(e??{})};return e?.preservePagePaths===!0&&(t.preservePagePaths=!0),kn(t.children),t}function je(e){let t=Array.isArray(e.anchors)?e.anchors.map(Co):[];if(Array.isArray(e.products))return[...t,...e.products.map(Ao)];if(Array.isArray(e.versions))return[...t,...e.versions.map(Oo)];if(Array.isArray(e.languages))return[...t,...e.languages.map(Eo)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(To)];let r=[...t];return Array.isArray(e.groups)&&r.push(...e.groups.map($n)),Array.isArray(e.pages)&&r.push(...e.pages.map(Sn)),r}function Ao(e){return{kind:"product",label:e.name??e.product,slug:He(e.product),icon:e.icon,color:e.color,default:!!e.default,children:je(e)}}function Oo(e){return{kind:"version",label:e.version,slug:He(e.version),default:!!e.default,children:je(e)}}function Eo(e){let t=String(e.language);return{kind:"language",code:t,label:jo(t),slug:He(t),default:!!e.default,children:je(e)}}function To(e){return{kind:"tab",label:e.tab,slug:He(e.tab),icon:e.icon,href:e.href,children:je(e)}}function Co(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function $n(e){let t=(e.pages??[]).map(Sn);return e.root&&t.unshift({kind:"page",pagePath:e.root}),{kind:"group",...e.public!==void 0?{public:e.public}:{},label:e.group,icon:e.icon,expanded:!!e.expanded,root:e.root,children:t}}function Sn(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 $n(e)}function kn(e){for(let t of ko){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&&kn(t.children)}function ee(e){let t=[],r=(n,o,i)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:Po(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 Po(e,t){if(t.preservePagePaths)return wn(e);let r=[t.product,t.version,t.language].filter(Boolean),n=wn(e).split("/").filter(Boolean);return"/"+[...r,...n].join("/")}var ko,re=_(()=>{ko=["product","version","language"]});function Lo(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 jn(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=Lo(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 An=_(()=>{});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 Ae(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`${Ae(t.items||{})}[]`;let r=t.type||(t.properties?"object":"any");return t.format?`${r}<${t.format}>`:r}function ye(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]=ye(i,t+1);return n}case"array":return[ye(r.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Ro(r)}}function Ro(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:Ae(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:Ae(i),required:r.has(n),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,deprecated:i.deprecated||void 0}})}function No(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:Ae(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:ye(t),deprecated:e.deprecated||void 0}}function En(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 Uo(e){if(!e)return null;let t=En(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??ye(r)}}function Fo(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,r])=>{let n=En(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??ye(o):null}})}function Io(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(Mo(i,a)))}return r.filter(Boolean)}function Mo(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 On(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function zo(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(No(u));let c=n.security??e.globalSecurity;return{id:n.operationId?On(n.operationId):`${t}-${On(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:Io(c,a),parameters:l,body:Uo(n.requestBody),responses:Fo(n.responses),servers:(i||[]).map(u=>u.url).filter(Boolean)}}function Vo(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 f of Object.keys(y||{}))a[f]&&(p[f]=a[f]);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 _o){let p=s[u];!p||typeof p!="object"||(t.push(zo({method:u,path:a,op:p,sharedParams:l,servers:p.servers||c,globalSecurity:o,schemes:n})),r.push(Vo(e,a,u,p,l,p.servers||c,n)))}}return{operations:t,segments:r}}function Oe(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 _o,Ke=_(()=>{_o=["get","post","put","patch","delete","options","head","trace"]});function Jo(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 Bo(e){let t=`curl --request ${e.method} \\
33
+ `});import Ro from"github-slugger";import No from"iso-639-1";function Fo(e){let t=String(e).toLowerCase();return No.getNativeName(t)||e}function Ke(e){return new Ro().slug(String(e??""))}function jn(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function xt(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 Y(e){let t={kind:"root",children:Oe(e??{})};return e?.preservePagePaths===!0&&(t.preservePagePaths=!0),En(t.children),t}function Oe(e){let t=Array.isArray(e.anchors)?e.anchors.map(Bo):[];if(Array.isArray(e.products))return[...t,...e.products.map(Io)];if(Array.isArray(e.versions))return[...t,...e.versions.map(Mo)];if(Array.isArray(e.languages))return[...t,...e.languages.map(zo)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(Vo)];let r=[...t];return Array.isArray(e.groups)&&r.push(...e.groups.map(An)),Array.isArray(e.pages)&&r.push(...e.pages.map(On)),r}function Io(e){return{kind:"product",label:e.name??e.product,slug:Ke(e.product),icon:e.icon,color:e.color,default:!!e.default,children:Oe(e)}}function Mo(e){return{kind:"version",label:e.version,slug:Ke(e.version),default:!!e.default,children:Oe(e)}}function zo(e){let t=String(e.language);return{kind:"language",code:t,label:Fo(t),slug:Ke(t),default:!!e.default,children:Oe(e)}}function Vo(e){return{kind:"tab",label:e.tab,slug:Ke(e.tab),icon:e.icon,href:e.href,children:Oe(e)}}function Bo(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function An(e){let t=(e.pages??[]).map(On);return e.root&&t.unshift({kind:"page",pagePath:e.root}),{kind:"group",...e.public!==void 0?{public:e.public}:{},label:e.group,icon:e.icon,expanded:!!e.expanded,root:e.root,children:t}}function On(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 An(e)}function En(e){for(let t of Uo){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&&En(t.children)}function ee(e){let t=[],r=(n,o,i)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:Jo(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 Jo(e,t){if(t.preservePagePaths)return jn(e);let r=[t.product,t.version,t.language].filter(Boolean),n=jn(e).split("/").filter(Boolean);return"/"+[...r,...n].join("/")}var Uo,re=L(()=>{Uo=["product","version","language"]});function Do(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 Tn(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=Do(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 Cn=L(()=>{});function _n(e){let t=e?.["x-velu"]?.groups??e?.["x-mint"]?.groups;if(!Array.isArray(t))return;let r=[...new Set(t.filter(n=>typeof n=="string"&&n.trim()).map(n=>n.trim()))];return r.length?r:void 0}function $t(...e){for(let t of e){let r=_n(t);if(r)return r}}function wt(e){let t=e?.["x-velu-enum"]??e?.["x-mint-enum"];if(!t||typeof t!="object"||Array.isArray(t))return;let r={};for(let[n,o]of Object.entries(t)){if(!Array.isArray(o))continue;let i=o.filter(a=>typeof a=="string"&&a.trim()).map(a=>a.trim());i.length&&(r[n]=i)}return Object.keys(r).length?r:void 0}function Go(e,t){if(!(!e||!t))return[...new Set([...e,...t])]}function Pn(e){let t=new Map;for(let r of e){if(!r||typeof r!="object")continue;let n=_n(r);for(let o of Xe(r)){let i=o.groups||n,a=i?{...o,groups:i}:{...o},s=t.get(o.name);if(!s){t.set(o.name,a);continue}s.groups=Go(s.groups,a.groups),!s.veluEnum&&a.veluEnum&&(s.veluEnum=a.veluEnum)}}return[...t.values()]}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 Ee(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`${Ee(t.items||{})}[]`;let r=t.type||(t.properties?"object":"any");return t.format?`${r}<${t.format}>`:r}function ye(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]=ye(i,t+1);return n}case"array":return[ye(r.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Wo(r)}}function Wo(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 Xe(e){if(e&&typeof e=="object"){if(Array.isArray(e.oneOf)&&e.oneOf.length)return Pn(e.oneOf);if(Array.isArray(e.anyOf)&&e.anyOf.length)return Pn(e.anyOf)}let t=ce(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:Ee(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:Ee(i),required:r.has(n),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,veluEnum:wt(o)||wt(i),groups:$t(o,i),deprecated:i.deprecated||void 0}})}function Ho(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:Ee(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:ye(t),groups:$t(e,t),veluEnum:wt(t),deprecated:e.deprecated||void 0}}function Rn(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 Ko(e){if(!e)return null;let t=Rn(e.content);if(!t)return null;let r=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:Xe(r),example:t.media.example??ye(r)}}function Xo(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,r])=>{let n=Rn(r?.content),o=n?.media?.schema||{};return{status:t,description:r?.description||"",contentType:n?.contentType||null,fields:n?Xe(o):[],example:n?n.media.example??ye(o):null}})}function Yo(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(Zo(i,a)))}return r.filter(Boolean)}function Zo(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 Ln(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Qo(e){let{method:t,path:r,op:n,sharedParams:o,servers:i,schemes:a,pathItem:s}=e,l=[...o||[],...n.parameters||[]],c={path:[],query:[],header:[],cookie:[]};for(let u of l)u&&c[u.in]&&c[u.in].push(Ho(u));let p=n.security??e.globalSecurity;return{id:n.operationId?Ln(n.operationId):`${t}-${Ln(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,groups:$t(n,s,e.pathCollection),auth:Yo(p,a),parameters:c,body:Ko(n.requestBody),responses:Xo(n.responses),servers:(i||[]).map(u=>u.url).filter(Boolean)}}function ei(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 p=n.security??e.security;if(a&&Array.isArray(p)&&p.length){let u={};for(let y of p)for(let f of Object.keys(y||{}))a[f]&&(u[f]=a[f]);Object.keys(u).length&&(e.swagger?s.securityDefinitions=u:s.components={securitySchemes:u})}return s}function Nn(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"||a.startsWith("x-"))continue;let l=s.parameters||[],c=s.servers||i;for(let p of qo){let u=s[p];!u||typeof u!="object"||(t.push(Qo({method:p,path:a,op:u,sharedParams:l,servers:u.servers||c,globalSecurity:o,schemes:n,pathItem:s,pathCollection:e.paths})),r.push(ei(e,a,p,u,l,u.servers||c,n)))}}return{operations:t,segments:r}}function Te(e){let t=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]),{operations:r,segments:n}=Nn(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 qo,Ye=L(()=>{qo=["get","post","put","patch","delete","options","head","trace"]});function ti(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 ni(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 Do(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 ri(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(${wt(e.body," ")})`),[`const res = await fetch('${e.url}', {`,t.join(`,
39
+ }`)}return e.body!=null&&t.push(` body: JSON.stringify(${St(e.body," ")})`),[`const res = await fetch('${e.url}', {`,t.join(`,
40
40
  `),"});","const data = await res.json();"].join(`
41
- `)}function qo(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 oi(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 = ${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 Go(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=Jo(e,{server:t});return r.filter(o=>Cn[o]).map(o=>({key:o,label:Wo[o],language:Ho[o],code:Cn[o](n)}))}var wt,Cn,Wo,Ho,$t,St=_(()=>{wt=(e,t)=>JSON.stringify(e,null,2).split(`
44
+ }`)}let r=["url"];return e.body!=null&&(t.push(`payload = ${St(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 ii(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 = ${St(e.body,"")}.to_json`),r.push("","response = http.request(request)","puts response.body"),r.join(`
46
+ `)}function Ze(e,{server:t,languages:r=kt}={}){let n=ti(e,{server:t});return r.filter(o=>Un[o]).map(o=>({key:o,label:si[o],language:ai[o],code:Un[o](n)}))}var St,Un,si,ai,kt,jt=L(()=>{St=(e,t)=>JSON.stringify(e,null,2).split(`
47
47
  `).map((r,n)=>n===0?r:t+r).join(`
48
- `);Cn={curl:Bo,javascript:Do,python:qo,ruby:Go},Wo={curl:"cURL",javascript:"JavaScript",python:"Python",ruby:"Ruby"},Ho={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":Xo}function Ee(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)?Yo(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 Yo(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:Ko[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 Ce(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:[...Pn],display:"header"};if(typeof e!="object")return{options:[],display:"header"};let t=e.display==="toc"?"toc":"header",r=Array.isArray(e.options)?e.options:Pn,n=[];for(let o of r)typeof o=="string"?Zo.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 Z(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 Pe(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 Ko,Xo,Zo,Pn,Le=_(()=>{Ko={twitter:"x","x-twitter":"x"},Xo="Google Sans Flex";Zo=new Set(["copy","assistant","view","download-pdf","download-spec","chatgpt","claude","perplexity","grok","aistudio","devin","windsurf","mcp","add-mcp","cursor","vscode","devin-mcp"]),Pn=["copy","view","chatgpt","claude"]});import Qo from"node:path";import _n from"js-yaml";function Rn(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=_n.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 m of l){if(/^[a-z][a-z0-9+.-]*:/i.test(m))throw new Error("Remote specs must be downloaded locally first.");let h=Qo.posix.normalize(m.replace(/^\//,"")),$=r.get(h);if(!$)throw new Error(`Spec is missing or ignored: ${h}`);let P=/\.ya?ml$/i.test(h)?_n.load($.toString("utf8")):ht($.toString("utf8"),h),E=Oe(jn(P));for(let T of E.operations)T.method===s[2].toUpperCase()&&T.path===s[3]&&c.push({operation:T,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=Z(n.api),f=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 b=`
51
- export const veluApi = ${JSON.stringify({operation:u,samples:f,api:{proxy:y.proxy,server:y.server}})};
48
+ `);Un={curl:ni,javascript:ri,python:oi,ruby:ii},si={curl:"cURL",javascript:"JavaScript",python:"Python",ruby:"Ruby"},ai={curl:"bash",javascript:"javascript",python:"python",ruby:"ruby"},kt=["curl","javascript","python","ruby"]});function In(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":ci}function Ce(e){return e==="vepa"||["thulir","aalam","nila","kadhir"].includes(e)?e:"velu"}function Ot({light:e,dark:t,family:r,theme:n,primary:o=e,cta:i=o}){let a=n==="vepa"||["thulir","aalam","nila","kadhir"].includes(n)?ui(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 ui(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(p=>p+p).join("")),[0,2,4].map(p=>parseInt(c.slice(p,p+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 Pe(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:li[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 At(e){return/^(https?:)?\/\//.test(e)||/^(mailto|tel):/.test(e)}function Le(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:At(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:At(o)}:{kind:"button",label:n.label??"",href:o,external:At(o)}}return!t.length&&!r?null:{links:t,primary:r}}function Et(e){if(e==null)return{options:[...Fn],display:"header"};if(typeof e!="object")return{options:[],display:"header"};let t=e.display==="toc"?"toc":"header",r=Array.isArray(e.options)?e.options:Fn,n=[];for(let o of r)typeof o=="string"?pi.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 Z(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 _e(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 li,ci,pi,Fn,Re=L(()=>{li={twitter:"x","x-twitter":"x"},ci="Google Sans Flex";pi=new Set(["copy","assistant","view","download-pdf","download-spec","chatgpt","claude","perplexity","grok","aistudio","devin","windsurf","mcp","add-mcp","cursor","vscode","devin-mcp"]),Fn=["copy","view","chatgpt","claude"]});import fi from"node:path";import Mn from"js-yaml";function zn(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=Mn.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(p=>typeof p=="string"?p:p?.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=fi.posix.normalize(d.replace(/^\//,"")),$=r.get(h);if(!$)throw new Error(`Spec is missing or ignored: ${h}`);let P=/\.ya?ml$/i.test(h)?Mn.load($.toString("utf8")):je($.toString("utf8"),h),E=Te(Tn(P));for(let T of E.operations)T.method===s[2].toUpperCase()&&T.path===s[3]&&c.push({operation:T,rel:h})}if(c.length!==1)throw new Error(`Expected exactly one matching operation; found ${c.length}.`);let{operation:p,rel:u}=c[0],y=Z(n.api),f=Ze(p,{server:y.server||p.servers?.[0],...y.languages?{languages:y.languages}:{}});if(/\bveluApi\b/.test(e))throw new Error("Reserved generated export name already used: veluApi");let b=`
51
+ export const veluApi = ${JSON.stringify({operation:p,samples:f,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)+b,converted:!0}}catch(u){return o("endpoint-conversion","error",t,`Could not migrate OpenAPI endpoint: ${u.message}`),{text:e,converted:!1}}}var Nn=_(()=>{An();Ke();St();Le();Ge()});var Vn={};Se(Vn,{MIGRATE_HELP:()=>Fn,migrateMintlify:()=>zn,parseMigrateArgs:()=>In,planMigration:()=>Mn,runMigrate:()=>ai});import M from"node:fs";import J from"node:path";import{randomUUID as ei,createHash as ti}from"node:crypto";import ni from"ignore";function In(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 ii(e,t){let r=J.resolve(t||`${e}-velu`),n=r,o=[];for(;!M.existsSync(n);){o.unshift(J.basename(n));let a=J.dirname(n);if(a===n)throw new Error("Cannot resolve destination parent.");n=a}let i=J.join(M.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(M.existsSync(r))throw new Error("Destination already exists. Choose a new directory; migration never overwrites existing files.");return i}function si(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 ${u}, preserving the page URL and body. This is an editable snapshot: regenerate after spec changes; review x-velu extensions and page-specific overrides.`),{text:e.slice(0,i[0].length)+b,converted:!0}}catch(p){return o("endpoint-conversion","error",t,`Could not migrate OpenAPI endpoint: ${p.message}`),{text:e,converted:!1}}}var Vn=L(()=>{Cn();Ye();jt();Re();Ae()});import mi from"node:path";import Bn from"js-yaml";function Jn(e,t){return e==null?t:t==null||typeof e!="object"||typeof t!="object"||Array.isArray(e)||Array.isArray(t)?e:{...t,...e,groups:e.groups??t.groups}}function Tt(e){if(Array.isArray(e)){let n=0;return{value:e.map(i=>{let a=Tt(i);return n+=a.count,a.value}),count:n}}if(!e||typeof e!="object")return{value:e,count:0};let t=0,r={};for(let[n,o]of Object.entries(e)){let i=Tt(o);if(t+=i.count,n==="x-mint"||n==="x-velu"){n==="x-mint"&&(t+=1),r["x-velu"]=n==="x-velu"?Jn(i.value,r["x-velu"]):Jn(r["x-velu"],i.value);continue}if(n==="x-mint-enum"||n==="x-velu-enum"){n==="x-mint-enum"&&(t+=1),r["x-velu-enum"]=n==="x-velu-enum"?i.value:r["x-velu-enum"]??i.value;continue}r[n]=i.value}return{value:r,count:t}}function Dn(e,t){if(!/\.(?:json|ya?ml)$/i.test(t))return null;let r=mi.posix.basename(t.replace(/\\/g,"/"));if(di.has(r)||t.split(/[\\/]/).some(l=>l.startsWith(".")))return null;let n=Buffer.isBuffer(e)?e.toString("utf8"):String(e),o;try{o=/\.ya?ml$/i.test(t)?Bn.load(n):je(n,t)}catch{return null}if(!o||typeof o!="object")return null;let{value:i,count:a}=Tt(o);if(!a)return null;let s=/\.ya?ml$/i.test(t)?Bn.dump(i,{lineWidth:120,noRefs:!0,quotingType:'"',sortKeys:!1}):`${JSON.stringify(i,null,2)}
54
+ `;return{buffer:Buffer.from(s),count:a}}var di,qn=L(()=>{Ae();di=new Set(["docs.json","mint.json","package.json","package-lock.json","tsconfig.json","jsconfig.json","velu.json","velu-migration-report.json","components.json"])});var Yn={};Se(Yn,{MIGRATE_HELP:()=>Wn,migrateMintlify:()=>Xn,parseMigrateArgs:()=>Hn,planMigration:()=>Kn,runMigrate:()=>$i});import M from"node:fs";import J from"node:path";import{randomUUID as gi,createHash as hi}from"node:crypto";import yi from"ignore";function Hn(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 xi(e,t){let r=J.resolve(t||`${e}-velu`),n=r,o=[];for(;!M.existsSync(n);){o.unshift(J.basename(n));let a=J.dirname(n);if(a===n)throw new Error("Cannot resolve destination parent.");n=a}let i=J.join(M.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(M.existsSync(r))throw new Error("Destination already exists. Choose a new directory; migration never overwrites existing files.");return i}function wi(e){let t=r=>String(r).replace(/\|/g,"\\|").replace(/[\r\n]+/g," ");return`# Mintlify \u2192 Velu migration
54
55
 
55
56
  Status: **${e.status}**. ${e.summary.files} files; ${e.summary.pages} pages/snippets; ${e.summary.scripts} browser scripts; ${e.summary.styles} stylesheets.
56
57
 
@@ -61,7 +62,7 @@ Status: **${e.status}**. ${e.summary.files} files; ${e.summary.pages} pages/snip
61
62
  3. Run \`velu dev .\` and verify navigation, custom scripts, CSS, adapters, and API pages.
62
63
  4. Configure hosting, domains, redirects, authentication, and integrations in Velu as needed.
63
64
 
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
+ 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 \`${Ct}\` for all file hashes, transformations, skipped files, and npm scripts.
65
66
 
66
67
  ## Findings
67
68
 
@@ -69,8 +70,8 @@ The original Mintlify configuration is preserved. Unsupported settings have not
69
70
  | --- | --- | --- | --- |
70
71
  `+e.issues.map(r=>`| ${r.severity} | ${t(r.code)} | ${t(r.file)}${r.line?":"+r.line:""} | ${t(r.message)} |`).join(`
71
72
  `)+`
72
- `}async function Mn({source:e=".",out:t,config:r,version:n="0.2.40"}={}){let o=M.realpathSync(J.resolve(e));if(!M.statSync(o).isDirectory())throw new Error("Source must be a directory.");let i=ii(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(d=>M.existsSync(J.join(o,d)));if(!a)throw new Error("No docs.json or mint.json found in the source directory.");let s=[],l=new Set,c=(d,v,j,C,V)=>{let ie=JSON.stringify([d,v,j,C,V]);l.has(ie)||(s.push({code:d,severity:v,file:j,message:C,...V?{line:V}:{}}),l.add(ie))},u=un(o,a),p=pn(u,a,c);!r&&M.existsSync(J.join(o,"docs.json"))&&M.existsSync(J.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=ni(),f=J.join(o,".mintignore");if(M.existsSync(f)){if(!le(o,M.realpathSync(f)))throw new Error(".mintignore resolves outside the source.");y.add(M.readFileSync(f,"utf8"))}let g=new Map,b=[];function m(d){for(let v of M.readdirSync(d,{withFileTypes:!0}).sort((j,C)=>j.name<C.name?-1:j.name>C.name?1:0)){let j=J.join(d,v.name),C=gt(J.relative(o,j));v.isSymbolicLink()?(b.push({path:C,reason:"symbolic-link"}),c("symlink","warning",C,"Symbolic link/junction skipped. Copy its required content into the source explicitly.")):v.isDirectory()&&ri.has(v.name)||/^\.env(?:\.|$)/i.test(v.name)||[".npmrc",".yarnrc.yml",".pnp.cjs",".pnp.loader.mjs"].includes(v.name)?b.push({path:C,reason:"dependency-cache-tooling-or-environment"}):y.ignores(C+(v.isDirectory()?"/":""))&&C!==a&&C!==".mintignore"?b.push({path:C,reason:"mintignore"}):v.isFile()&&C.startsWith(".mintlify/")&&!/\.(json|ya?ml)$/i.test(C)&&!C.startsWith(".mintlify/skills/")?b.push({path:C,reason:"mintlify-runtime-file"}):v.isDirectory()?m(j):v.isFile()?g.set(C,M.readFileSync(j)):b.push({path:C,reason:"not-regular-file"})}}if(m(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,$=new Set,P=new Set;try{for(let d of ee(Y(p.navigation)))P.add(d.pagePath.replace(/^\//,""))}catch{}for(let d of g.keys()){let v=d;/\.md$/i.test(d)&&(P.has(d.slice(0,-3))||!/^(readme|license|changelog|contributing|contribute|skill|agents|claude)\.md$/i.test(J.posix.basename(d)))&&(v=d.replace(/\.md$/i,".mdx")),/\.mdx$/i.test(d)&&(v=d.replace(/\.mdx$/i,".mdx")),/^(?:_snippets|snippets)\/.*\.js$/i.test(d)&&(v=d.replace(/\.js$/i,".jsx"));let j=v.toLowerCase();if($.has(j)||[Ot.toLowerCase(),Et.toLowerCase()].includes(j))throw new Error(`Migration output collision: ${v}`);$.add(j),h.set(d,v)}let E=new Map(h);for(let[d,v]of h)if(/\.(mdx?|jsx?|tsx?)$/.test(d)){let j=d.replace(/\.[^.]+$/,"");E.has(j)||E.set(j,v),/\/index$/.test(j)&&!E.has(j.slice(0,-6))&&E.set(j.slice(0,-6),v)}let T=new Map,S=[],w=new Set,L=!1,I=[];for(let[d,v]of g){let j=h.get(d),C=v,V="asset",ie;if(/\.mdx$/i.test(j)){V="content";let q=Rn(v.toString("utf8"),d,g,u,c),se=await gn(q.text,d,E,c,{endpointConverted:q.converted});C=Buffer.from(se.text),ie=se.components,L||=se.adapters.length>0;for(let dt of se.assets||[])w.add(dt)}else if(d==="package.json"){V="package";let q=yn(v.toString("utf8"),n,c);C=Buffer.from(q.text),I=q.scripts}else if(/\.js$/i.test(j))V="script",hn(v.toString("utf8"),d,c),(d.startsWith("public/")||d.split("/").some(q=>q.startsWith(".")))&&c("asset-not-autoloaded","warning",d,"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)){V="style";let q=v.toString("utf8");d.startsWith("public/")||(C=Buffer.from(bn(q,d,h,c))),/@import|data-component-(?:name|part)|\.dark\b|__next|#banner|#header\b/.test(q)&&c("css-hooks","warning",d,"Review CSS imports, theme classes, and Mintlify-specific selectors against Velu\u2019s DOM hooks."),(d.startsWith("public/")||d.split("/").some(se=>se.startsWith(".")))&&c("asset-not-autoloaded","warning",d,"Velu does not auto-load CSS from public or dot directories.")}else/\.[cm]?[jt]sx?$/.test(j)&&(V="module",C=Buffer.from(vn(v.toString("utf8"),d,E,c)),/(?:@mintlify\/|next\/|window\.mintlify)/.test(v.toString("utf8"))&&c("module-runtime","error",d,"Custom module depends on a Mintlify/Next.js runtime. Adapt its imports and APIs."));d.startsWith(".github/workflows/")&&/mintlify|\bmint\s/.test(v.toString("utf8"))&&c("ci-workflow","warning",d,"Workflow preserved. Replace Mintlify install/validation/deployment commands manually."),T.set(j,C),S.push({source:d,destination:j,kind:V,action:d!==j?"renamed":C.equals(v)?"copied":"transformed",sha256:_e(C),...ie?{components:ie}:{}})}for(let[d,v]of[...T]){if(!oi.test(d)&&!w.has(d)&&!/\.(css|js)$/i.test(d)||d.startsWith("public/")||d.split("/").some(V=>V.startsWith("."))||["docs.json","mint.json","package.json","velu.json",...Un].includes(d))continue;let j=`public/${d}`,C=[...T.keys()].find(V=>V.toLowerCase()===j.toLowerCase());if(C){T.get(C).equals(v)||c("public-asset-conflict","error",d,`Different asset already exists at ${C}; public file retained. Review which URL should be served.`);continue}T.set(j,v),S.push({source:d,destination:j,kind:"public-asset",action:"mirrored",sha256:_e(v)})}if(L){if($.has(he.toLowerCase()))throw new Error(`Generated adapter conflicts with source file: ${he}`);T.set(he,Buffer.from(vt)),S.push({destination:he,kind:"module",action:"generated",sha256:_e(vt)})}let F=Buffer.from(Ye(p));T.set("velu.json",F),S.push({destination:"velu.json",kind:"config",action:"generated",sha256:_e(F)});let O=Buffer.from(Ye(u));T.set(".velu-migration/source-config.json",O),S.push({destination:".velu-migration/source-config.json",kind:"config",action:"archived",sha256:_e(O)});let x=new Set,A=new Set;try{for(let d of ee(Y(p.navigation))){A.has(d.url)&&c("duplicate-route","error","velu.json",`Duplicate route: ${d.url}`),A.add(d.url);let v=d.pagePath.replace(/^\/+|\/+$/g,"")+".mdx";/\.\.(?:\/|$)|\\/.test(v)&&c("unsafe-page-path","error","velu.json",`Page path is outside the supported project-relative format: ${d.pagePath}`),x.add(v),T.has(v)||c("missing-page","error","velu.json",`Navigation page is missing or ignored: ${v}`)}}catch(d){c("navigation-invalid","error","velu.json",d.message)}for(let d of S.filter(v=>v.kind==="content"))!x.has(d.destination)&&!/^(?:_snippets|snippets)\//.test(d.destination)&&c("unlisted-page","warning",d.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=(d,v)=>{if(typeof d!="string")return;if(/^https?:\/\//.test(d)){c("remote-asset","error",v,"Download this branding asset into the project and use a local path; migration does not fetch external assets.");return}let j=d.replace(/^\//,"").split(/[?#]/)[0];T.has(j)||c("missing-asset","error",v,`Asset is missing or ignored: ${j}`)};if(k(p.favicon,"favicon"),typeof p.logo=="string")k(p.logo,"logo");else for(let d of["light","dark"])k(p.logo?.[d],`logo.${d}`);function U(d){if(!(!d||typeof d!="object")){if(d.openapi)for(let v of[].concat(d.openapi))/^https?:\/\//.test(v)?c("remote-openapi","warning","velu.json","Remote OpenAPI URL preserved; availability and generation need validation with network access."):T.has(v.replace(/^\//,""))?c("openapi-routes","warning","velu.json",`OpenAPI source ${v} preserved; compare generated endpoint URLs and x-mint extensions in preview.`):c("missing-openapi","error","velu.json",`OpenAPI source missing or ignored: ${v}`);for(let v of Object.values(d))typeof v=="object"&&U(v)}}U(p.navigation),I.some(d=>d.action==="converted")&&[...Un].some(d=>T.has(d))&&c("lockfile-stale","warning","package.json","Lockfiles are preserved and require regeneration after the dependency changes."),s.sort((d,v)=>d.file.localeCompare(v.file)||(d.line||0)-(v.line||0)||d.code.localeCompare(v.code));let R=s.filter(d=>d.severity==="error").length,N=s.filter(d=>d.severity==="warning").length,D={reportVersion:1,source:o,destination:i,sourceConfig:a,status:R||N?"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:S.length,pages:S.filter(d=>d.kind==="content").length,scripts:S.filter(d=>d.kind==="script").length,styles:S.filter(d=>d.kind==="style").length,errors:R,warnings:N,skipped:b.length},issues:s,files:S,skipped:b,npmScripts:I};return T.set(Ot,Buffer.from(Ye(D))),T.set(Et,Buffer.from(si(D))),{report:D,files:T}}async function zn(e={}){let t=await Mn(e),r=e.strict&&(t.report.summary.errors||t.report.summary.warnings),n=!1;if(!e.dryRun&&!r){let o=t.report.destination,i=J.dirname(o);M.mkdirSync(i,{recursive:!0});let a=J.join(i,`.velu-migration-${ei()}`);M.mkdirSync(a);try{for(let[s,l]of t.files){let c=J.resolve(a,s);if(!le(a,c))throw new Error("Output path escapes the staging directory.");M.mkdirSync(J.dirname(c),{recursive:!0}),M.writeFileSync(c,l,{flag:"wx"})}if(M.existsSync(o))throw new Error("Destination appeared during migration; no existing files were changed.");M.renameSync(a,o),n=!0}finally{J.dirname(a)===i&&J.basename(a).startsWith(".velu-migration-")&&M.rmSync(a,{recursive:!0,force:!0})}}return{report:t.report,written:n,exitCode:r?3:t.report.summary.errors?2:0}}async function ai(e,t){let r=In([...e]);if(r.help)return console.log(Fn),0;let n=await zn({...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 ${Et}, 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 ri,Un,Ot,Et,oi,_e,Ye,Fn,Jn=_(()=>{Ge();xn();re();re();Nn();ri=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",Et="VELU-MIGRATION.md",oi=/\.(?: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,_e=e=>ti("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]
73
+ `}async function Kn({source:e=".",out:t,config:r,version:n="0.2.40"}={}){let o=M.realpathSync(J.resolve(e));if(!M.statSync(o).isDirectory())throw new Error("Source must be a directory.");let i=xi(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(m=>M.existsSync(J.join(o,m)));if(!a)throw new Error("No docs.json or mint.json found in the source directory.");let s=[],l=new Set,c=(m,v,j,C,B)=>{let ie=JSON.stringify([m,v,j,C,B]);l.has(ie)||(s.push({code:m,severity:v,file:j,message:C,...B?{line:B}:{}}),l.add(ie))},p=dn(o,a),u=gn(p,a,c);!r&&M.existsSync(J.join(o,"docs.json"))&&M.existsSync(J.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=yi(),f=J.join(o,".mintignore");if(M.existsSync(f)){if(!le(o,M.realpathSync(f)))throw new Error(".mintignore resolves outside the source.");y.add(M.readFileSync(f,"utf8"))}let g=new Map,b=[];function d(m){for(let v of M.readdirSync(m,{withFileTypes:!0}).sort((j,C)=>j.name<C.name?-1:j.name>C.name?1:0)){let j=J.join(m,v.name),C=yt(J.relative(o,j));v.isSymbolicLink()?(b.push({path:C,reason:"symbolic-link"}),c("symlink","warning",C,"Symbolic link/junction skipped. Copy its required content into the source explicitly.")):v.isDirectory()&&vi.has(v.name)||/^\.env(?:\.|$)/i.test(v.name)||[".npmrc",".yarnrc.yml",".pnp.cjs",".pnp.loader.mjs"].includes(v.name)?b.push({path:C,reason:"dependency-cache-tooling-or-environment"}):y.ignores(C+(v.isDirectory()?"/":""))&&C!==a&&C!==".mintignore"?b.push({path:C,reason:"mintignore"}):v.isFile()&&C.startsWith(".mintlify/")&&!/\.(json|ya?ml)$/i.test(C)&&!C.startsWith(".mintlify/skills/")?b.push({path:C,reason:"mintlify-runtime-file"}):v.isDirectory()?d(j):v.isFile()?g.set(C,M.readFileSync(j)):b.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,$=new Set,P=new Set;try{for(let m of ee(Y(u.navigation)))P.add(m.pagePath.replace(/^\//,""))}catch{}for(let m of g.keys()){let v=m;/\.md$/i.test(m)&&(P.has(m.slice(0,-3))||!/^(readme|license|changelog|contributing|contribute|skill|agents|claude)\.md$/i.test(J.posix.basename(m)))&&(v=m.replace(/\.md$/i,".mdx")),/\.mdx$/i.test(m)&&(v=m.replace(/\.mdx$/i,".mdx")),/^(?:_snippets|snippets)\/.*\.js$/i.test(m)&&(v=m.replace(/\.js$/i,".jsx"));let j=v.toLowerCase();if($.has(j)||[Ct.toLowerCase(),Pt.toLowerCase()].includes(j))throw new Error(`Migration output collision: ${v}`);$.add(j),h.set(m,v)}let E=new Map(h);for(let[m,v]of h)if(/\.(mdx?|jsx?|tsx?)$/.test(m)){let j=m.replace(/\.[^.]+$/,"");E.has(j)||E.set(j,v),/\/index$/.test(j)&&!E.has(j.slice(0,-6))&&E.set(j.slice(0,-6),v)}let T=new Map,S=[],w=new Set,_=!1,I=[];for(let[m,v]of g){let j=h.get(m),C=v,B="asset",ie;if(/\.mdx$/i.test(j)){B="content";let V=zn(v.toString("utf8"),m,g,p,c),se=await bn(V.text,m,E,c,{endpointConverted:V.converted});C=Buffer.from(se.text),ie=se.components,_||=se.adapters.length>0;for(let ht of se.assets||[])w.add(ht)}else if(m==="package.json"){B="package";let V=wn(v.toString("utf8"),n,c);C=Buffer.from(V.text),I=V.scripts}else if(/\.js$/i.test(j))B="script",xn(v.toString("utf8"),m,c),(m.startsWith("public/")||m.split("/").some(V=>V.startsWith(".")))&&c("asset-not-autoloaded","warning",m,"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)){B="style";let V=v.toString("utf8");m.startsWith("public/")||(C=Buffer.from(Sn(V,m,h,c))),/@import|data-component-(?:name|part)|\.dark\b|__next|#banner|#header\b/.test(V)&&c("css-hooks","warning",m,"Review CSS imports, theme classes, and Mintlify-specific selectors against Velu\u2019s DOM hooks."),(m.startsWith("public/")||m.split("/").some(se=>se.startsWith(".")))&&c("asset-not-autoloaded","warning",m,"Velu does not auto-load CSS from public or dot directories.")}else if(/\.[cm]?[jt]sx?$/.test(j))B="module",C=Buffer.from($n(v.toString("utf8"),m,E,c)),/(?:@mintlify\/|next\/|window\.mintlify)/.test(v.toString("utf8"))&&c("module-runtime","error",m,"Custom module depends on a Mintlify/Next.js runtime. Adapt its imports and APIs.");else if(/\.(?:json|ya?ml)$/i.test(m)){let V=Dn(v,m);V&&(C=V.buffer,c("openapi-extensions","warning",m,`Rewrote ${V.count} Mintlify x-mint OpenAPI extension(s) to x-velu. Confirm group filtering in preview.`))}m.startsWith(".github/workflows/")&&/mintlify|\bmint\s/.test(v.toString("utf8"))&&c("ci-workflow","warning",m,"Workflow preserved. Replace Mintlify install/validation/deployment commands manually."),T.set(j,C),S.push({source:m,destination:j,kind:B,action:m!==j?"renamed":C.equals(v)?"copied":"transformed",sha256:Ne(C),...ie?{components:ie}:{}})}for(let[m,v]of[...T]){if(!bi.test(m)&&!w.has(m)&&!/\.(css|js)$/i.test(m)||m.startsWith("public/")||m.split("/").some(B=>B.startsWith("."))||["docs.json","mint.json","package.json","velu.json",...Gn].includes(m))continue;let j=`public/${m}`,C=[...T.keys()].find(B=>B.toLowerCase()===j.toLowerCase());if(C){T.get(C).equals(v)||c("public-asset-conflict","error",m,`Different asset already exists at ${C}; public file retained. Review which URL should be served.`);continue}T.set(j,v),S.push({source:m,destination:j,kind:"public-asset",action:"mirrored",sha256:Ne(v)})}if(_){if($.has(he.toLowerCase()))throw new Error(`Generated adapter conflicts with source file: ${he}`);T.set(he,Buffer.from(bt)),S.push({destination:he,kind:"module",action:"generated",sha256:Ne(bt)})}let F=Buffer.from(Qe(u));T.set("velu.json",F),S.push({destination:"velu.json",kind:"config",action:"generated",sha256:Ne(F)});let O=Buffer.from(Qe(p));T.set(".velu-migration/source-config.json",O),S.push({destination:".velu-migration/source-config.json",kind:"config",action:"archived",sha256:Ne(O)});let x=new Set,A=new Set;try{for(let m of ee(Y(u.navigation))){A.has(m.url)&&c("duplicate-route","error","velu.json",`Duplicate route: ${m.url}`),A.add(m.url);let v=m.pagePath.replace(/^\/+|\/+$/g,"")+".mdx";/\.\.(?:\/|$)|\\/.test(v)&&c("unsafe-page-path","error","velu.json",`Page path is outside the supported project-relative format: ${m.pagePath}`),x.add(v),T.has(v)||c("missing-page","error","velu.json",`Navigation page is missing or ignored: ${v}`)}}catch(m){c("navigation-invalid","error","velu.json",m.message)}for(let m of S.filter(v=>v.kind==="content"))!x.has(m.destination)&&!/^(?:_snippets|snippets)\//.test(m.destination)&&c("unlisted-page","warning",m.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=(m,v)=>{if(typeof m!="string")return;if(/^https?:\/\//.test(m)){c("remote-asset","error",v,"Download this branding asset into the project and use a local path; migration does not fetch external assets.");return}let j=m.replace(/^\//,"").split(/[?#]/)[0];T.has(j)||c("missing-asset","error",v,`Asset is missing or ignored: ${j}`)};if(k(u.favicon,"favicon"),typeof u.logo=="string")k(u.logo,"logo");else for(let m of["light","dark"])k(u.logo?.[m],`logo.${m}`);function U(m){if(!(!m||typeof m!="object")){if(m.openapi)for(let v of[].concat(m.openapi))/^https?:\/\//.test(v)?c("remote-openapi","warning","velu.json","Remote OpenAPI URL preserved; availability and generation need validation with network access."):T.has(v.replace(/^\//,""))?c("openapi-routes","warning","velu.json",`OpenAPI source ${v} preserved; compare generated endpoint URLs and x-velu group extensions in preview.`):c("missing-openapi","error","velu.json",`OpenAPI source missing or ignored: ${v}`);for(let v of Object.values(m))typeof v=="object"&&U(v)}}U(u.navigation),I.some(m=>m.action==="converted")&&[...Gn].some(m=>T.has(m))&&c("lockfile-stale","warning","package.json","Lockfiles are preserved and require regeneration after the dependency changes."),s.sort((m,v)=>m.file.localeCompare(v.file)||(m.line||0)-(v.line||0)||m.code.localeCompare(v.code));let R=s.filter(m=>m.severity==="error").length,N=s.filter(m=>m.severity==="warning").length,q={reportVersion:1,source:o,destination:i,sourceConfig:a,status:R||N?"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:S.length,pages:S.filter(m=>m.kind==="content").length,scripts:S.filter(m=>m.kind==="script").length,styles:S.filter(m=>m.kind==="style").length,errors:R,warnings:N,skipped:b.length},issues:s,files:S,skipped:b,npmScripts:I};return T.set(Ct,Buffer.from(Qe(q))),T.set(Pt,Buffer.from(wi(q))),{report:q,files:T}}async function Xn(e={}){let t=await Kn(e),r=e.strict&&(t.report.summary.errors||t.report.summary.warnings),n=!1;if(!e.dryRun&&!r){let o=t.report.destination,i=J.dirname(o);M.mkdirSync(i,{recursive:!0});let a=J.join(i,`.velu-migration-${gi()}`);M.mkdirSync(a);try{for(let[s,l]of t.files){let c=J.resolve(a,s);if(!le(a,c))throw new Error("Output path escapes the staging directory.");M.mkdirSync(J.dirname(c),{recursive:!0}),M.writeFileSync(c,l,{flag:"wx"})}if(M.existsSync(o))throw new Error("Destination appeared during migration; no existing files were changed.");M.renameSync(a,o),n=!0}finally{J.dirname(a)===i&&J.basename(a).startsWith(".velu-migration-")&&M.rmSync(a,{recursive:!0,force:!0})}}return{report:t.report,written:n,exitCode:r?3:t.report.summary.errors?2:0}}async function $i(e,t){let r=Hn([...e]);if(r.help)return console.log(Wn),0;let n=await Xn({...r,version:t});if(r.json)console.log(Qe({...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 ${Pt}, 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 vi,Gn,Ct,Pt,bi,Ne,Qe,Wn,Zn=L(()=>{Ae();kn();re();re();Vn();qn();vi=new Set(["node_modules",".git",".velu",".velu-migration",".next",".turbo",".cache",".idea",".vscode",".claude",".agents","dist","dist-preview","coverage"]),Gn=new Set(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lock","bun.lockb"]),Ct="velu-migration-report.json",Pt="VELU-MIGRATION.md",bi=/\.(?: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,Ne=e=>hi("sha256").update(e).digest("hex"),Qe=e=>JSON.stringify(e,null,2)+`
74
+ `,Wn=`Usage: velu migrate mintlify [source] [--out <directory>] [--config docs.json|mint.json] [--dry-run] [--json] [--strict]
74
75
 
75
76
  Migrate a local Mintlify project into a NEW Velu directory.
76
77
  Defaults: source=current directory, output=<source>-velu, docs.json before mint.json.
@@ -83,9 +84,9 @@ Defaults: source=current directory, output=<source>-velu, docs.json before mint.
83
84
  Source files are never modified; no project scripts or package installs are executed.
84
85
  Exit codes: 0=completed/clean plan, 1=invalid invocation or I/O failure,
85
86
  2=compatibility errors (output is still written unless --strict), 3=strict review required.
86
- `});var _t={};Se(_t,{currentVersion:()=>Ct,getLatestVersion:()=>Lt,isNewer:()=>Pt,maybeAutoUpdate:()=>wi,updateCommand:()=>xi});import{spawnSync as Dn}from"node:child_process";import{readFileSync as qn,writeFileSync as li,mkdirSync as ci}from"node:fs";import{fileURLToPath as ui}from"node:url";import{homedir as pi,tmpdir as fi}from"node:os";import Tt from"node:path";import te from"node:process";function Ct(){try{return JSON.parse(qn(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function hi(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 Pt(e,t){return!e||!t||t==="unknown"?!1:hi(e,t)>0}function Gn(){let e=Tt.join(pi()||fi(),".velu");return Tt.join(e,"update-check.json")}function Bn(){try{return JSON.parse(qn(Gn(),"utf8"))}catch{return null}}function yi(e){try{let t=Gn();ci(Tt.dirname(t),{recursive:!0}),li(t,JSON.stringify(e))}catch{}}async function vi(){let e=`${mi}/-/package/${Ze}/dist-tags`,t=new AbortController,r=setTimeout(()=>t.abort(),gi);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 Lt({force:e=!1}={}){if(!e){let r=Bn();if(r?.latest&&Date.now()-(r.checkedAt||0)<di)return r.latest}let t=await vi();return t?(yi({latest:t,checkedAt:Date.now()}),t):Bn()?.latest??null}function Wn(){let e=te.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=ui(import.meta.url).replace(/\\/g,"/")}catch{}return t.includes("/pnpm/")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")?"yarn":t.includes("/.bun/")?"bun":"npm"}function bi(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 Hn(e){let[t,r]=bi(e);return Dn(t,r,{stdio:"inherit",shell:te.platform==="win32"}).status===0}async function xi(){let e=Ct(),t=await Lt({force:!0});if(t&&!Pt(t,e)){console.log(`velu is already up to date (v${e}).`);return}let r=Wn();console.log(t?`Updating velu ${e} \u2192 ${t} (via ${r})\u2026`:`Could not reach the npm registry; installing ${Ze}@latest (via ${r}) anyway\u2026`),Hn(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`),te.exitCode=1)}async function wi(){if(te.env.VELU_NO_UPDATE==="1"||te.env.VELU_UPDATED==="1"||!te.stdout.isTTY)return;let e=Ct();if(e==="unknown")return;let t=null;try{t=await Lt()}catch{return}if(!Pt(t,e))return;let r=Wn();if(console.log(`
87
- New velu version available: ${e} \u2192 ${t}. Updating\u2026`),!Hn(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(te.execPath,te.argv.slice(1),{stdio:"inherit",env:{...te.env,VELU_UPDATED:"1"}});te.exit(n.status??0)}var Ze,mi,di,gi,Rt=_(()=>{Ze="@veluai/velu",mi="https://registry.npmjs.org",di=720*60*1e3,gi=3e3});import $i from"node:fs/promises";import Qe from"node:path";function Xn(e){if(!e.favicon)return null;let t=Qe.extname(e.favicon).toLowerCase();return{url:Nt+t,type:Kn[t]||""}}function Ut(e,t){let r=e.logo?.[t];if(!r)return null;let n=Qe.extname(r).toLowerCase();return{url:(t==="dark"?Ne:Re)+n,type:Kn[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 ki(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??Si;return{name:e.name??t??"docs",theme:Ee(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:ki(e.seo),assistant:Pe(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:Z(e.api),logo:Ue(e.logo),footer:Te(e.footer),navbar:Ce(e.navbar),font:{family:Ln(e)},navigation:e.navigation??null}}async function Yn(e){let t=Qe.join(e,"velu.json"),r;try{r=await $i.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,Qe.basename(e))}function Zn(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 Si,Re,Ne,Nt,Kn,Fe=_(()=>{Le();Le();Si="#dc143c",Re="/@velu-logo-light",Ne="/@velu-logo-dark",Nt="/@velu-favicon",Kn={".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 Qn}from"unist-util-visit";import{toString as ji}from"mdast-util-to-string";import Ai from"github-slugger";import{valueToEstree as Oi}from"estree-util-value-to-estree";function Ei(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 Ti(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 Ie(){return e=>{let t=new Ai,r=[];Qn(e,"heading",l=>{let c=ji(l);r.push({depth:l.depth,id:t.slug(c),label:c})});let n=[],o=[],i=new Set;if(Qn(e,"mdxJsxFlowElement",l=>{if(l.name!=="Update")return;let c=It(l,"label")??It(l,"date"),u=It(l,"description");c&&n.push({id:Ei(c,u),label:u||c});for(let p of Ti(l)){let y=p.trim().toLowerCase();p.trim()&&!i.has(y)&&(i.add(y),o.push(p.trim()))}}),n.length){er(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})}er(e,a.children),Mt(e,"changelog",null)}}function er(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:Oi(r)}]}}]}}})}var zt=_(()=>{});import{visit as Ci}from"unist-util-visit";function Vt(){return e=>{Ci(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 tr=_(()=>{});import Pi from"node:crypto";import Li from"node:fs";import _i from"node:path";function nr({pageEntries:e,tree:t,site:r,ops:n,walkPages:o,apiModules:i,targetDir:a}){let s=[],l=c=>Pi.createHash("sha256").update(c).digest("hex");for(let c of e)c.exists&&s.push(`${JSON.stringify(l(c.url))}:()=>import(${JSON.stringify(c.fileAbsPath.replaceAll("\\","/"))})`);for(let c of o(t)){if(!c.node?.api||!n[c.pagePath])continue;let u=n[c.pagePath],p="virtual:velu-auth-api:"+c.url,y=a?_i.join(a,`${c.pagePath}.mdx`):"",f=y&&Li.existsSync(y)?y.replaceAll("\\","/"):null,g=f?`import * as Overlay from ${JSON.stringify(f)};`:"",b=f?"Overlay.toc||[]":"[]",m=f?",React.createElement(Overlay.default)":"";i.set("\0"+p,`${g}import React from 'react';import {ApiReferencePage} from 'velu-ui';export const frontmatter=${JSON.stringify({title:u.title,description:u.description})};export const toc=${b};export const operation=${JSON.stringify(u.operation)};export const samples=${JSON.stringify(u.samples)};export const api=true;export default function Page(){return React.createElement(ApiReferencePage,{preset:${JSON.stringify(r.theme)},operation,samples,apiOperations:[{...operation,operation,samples,url:${JSON.stringify(c.url)}}],api:${JSON.stringify(u.api||{proxy:!0,server:null})}}${m})}`),s.push(`${JSON.stringify(l(c.url))}:()=>import(${JSON.stringify(p)})`)}return`const loaders={${s.join(",")}};
87
+ `});var Ut={};Se(Ut,{currentVersion:()=>_t,getLatestVersion:()=>Nt,isNewer:()=>Rt,maybeAutoUpdate:()=>Ui,updateCommand:()=>Ni});import{spawnSync as er}from"node:child_process";import{readFileSync as tr,writeFileSync as Si,mkdirSync as ki}from"node:fs";import{fileURLToPath as ji}from"node:url";import{homedir as Ai,tmpdir as Oi}from"node:os";import Lt from"node:path";import te from"node:process";function _t(){try{return JSON.parse(tr(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 Rt(e,t){return!e||!t||t==="unknown"?!1:Pi(e,t)>0}function nr(){let e=Lt.join(Ai()||Oi(),".velu");return Lt.join(e,"update-check.json")}function Qn(){try{return JSON.parse(tr(nr(),"utf8"))}catch{return null}}function Li(e){try{let t=nr();ki(Lt.dirname(t),{recursive:!0}),Si(t,JSON.stringify(e))}catch{}}async function _i(){let e=`${Ei}/-/package/${et}/dist-tags`,t=new AbortController,r=setTimeout(()=>t.abort(),Ci);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 Nt({force:e=!1}={}){if(!e){let r=Qn();if(r?.latest&&Date.now()-(r.checkedAt||0)<Ti)return r.latest}let t=await _i();return t?(Li({latest:t,checkedAt:Date.now()}),t):Qn()?.latest??null}function rr(){let e=te.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=ji(import.meta.url).replace(/\\/g,"/")}catch{}return t.includes("/pnpm/")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")?"yarn":t.includes("/.bun/")?"bun":"npm"}function Ri(e){let t=`${et}@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 or(e){let[t,r]=Ri(e);return er(t,r,{stdio:"inherit",shell:te.platform==="win32"}).status===0}async function Ni(){let e=_t(),t=await Nt({force:!0});if(t&&!Rt(t,e)){console.log(`velu is already up to date (v${e}).`);return}let r=rr();console.log(t?`Updating velu ${e} \u2192 ${t} (via ${r})\u2026`:`Could not reach the npm registry; installing ${et}@latest (via ${r}) anyway\u2026`),or(r)?console.log('\u2713 Updated. Run "velu version" to confirm.'):(console.error("Update failed. You can update manually with:"),console.error(` npm install -g ${et}@latest`),te.exitCode=1)}async function Ui(){if(te.env.VELU_NO_UPDATE==="1"||te.env.VELU_UPDATED==="1"||!te.stdout.isTTY)return;let e=_t();if(e==="unknown")return;let t=null;try{t=await Nt()}catch{return}if(!Rt(t,e))return;let r=rr();if(console.log(`
88
+ New velu version available: ${e} \u2192 ${t}. Updating\u2026`),!or(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
89
+ `);let n=er(te.execPath,te.argv.slice(1),{stdio:"inherit",env:{...te.env,VELU_UPDATED:"1"}});te.exit(n.status??0)}var et,Ei,Ti,Ci,Ft=L(()=>{et="@veluai/velu",Ei="https://registry.npmjs.org",Ti=720*60*1e3,Ci=3e3});import Fi from"node:fs/promises";import tt from"node:path";function sr(e){if(!e.favicon)return null;let t=tt.extname(e.favicon).toLowerCase();return{url:It+t,type:ir[t]||""}}function Mt(e,t){let r=e.logo?.[t];if(!r)return null;let n=tt.extname(r).toLowerCase();return{url:(t==="dark"?Fe:Ue)+n,type:ir[n]||""}}function Ie(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 Mi(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 zt(e={},t){let r=e.colors?.primary??Ii;return{name:e.name??t??"docs",theme:Ce(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:Mi(e.seo),assistant:_e(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:Z(e.api),logo:Ie(e.logo),footer:Pe(e.footer),navbar:Le(e.navbar),font:{family:In(e)},navigation:e.navigation??null}}async function ar(e){let t=tt.join(e,"velu.json"),r;try{r=await Fi.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 zt(n,tt.basename(e))}function lr(e){let{colors:t,font:r}=e;return Ot({light:t.light,dark:t.dark,family:r.family,theme:e.theme,primary:t.primary,cta:t.cta})}var Ii,Ue,Fe,It,ir,Me=L(()=>{Re();Re();Ii="#dc143c",Ue="/@velu-logo-light",Fe="/@velu-logo-dark",It="/@velu-favicon",ir={".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 cr}from"unist-util-visit";import{toString as zi}from"mdast-util-to-string";import Vi from"github-slugger";import{valueToEstree as Bi}from"estree-util-value-to-estree";function Ji(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 Vt(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 Di(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 ze(){return e=>{let t=new Vi,r=[];cr(e,"heading",l=>{let c=zi(l);r.push({depth:l.depth,id:t.slug(c),label:c})});let n=[],o=[],i=new Set;if(cr(e,"mdxJsxFlowElement",l=>{if(l.name!=="Update")return;let c=Vt(l,"label")??Vt(l,"date"),p=Vt(l,"description");c&&n.push({id:Ji(c,p),label:p||c});for(let u of Di(l)){let y=u.trim().toLowerCase();u.trim()&&!i.has(y)&&(i.add(y),o.push(u.trim()))}}),n.length){ur(e,n),Bt(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},p=s[s.length-1].node;p.children||(p.children=[]),p.children.push(c),s.push({node:c,depth:l.depth})}ur(e,a.children),Bt(e,"changelog",null)}}function ur(e,t){Bt(e,"toc",t)}function Bt(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:Bi(r)}]}}]}}})}var Jt=L(()=>{});import{visit as qi}from"unist-util-visit";function Dt(){return e=>{qi(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 pr=L(()=>{});import Gi from"node:crypto";import Wi from"node:fs";import Hi from"node:path";function fr({pageEntries:e,tree:t,site:r,ops:n,walkPages:o,apiModules:i,targetDir:a}){let s=[],l=c=>Gi.createHash("sha256").update(c).digest("hex");for(let c of e)c.exists&&s.push(`${JSON.stringify(l(c.url))}:()=>import(${JSON.stringify(c.fileAbsPath.replaceAll("\\","/"))})`);for(let c of o(t)){if(!c.node?.api||!n[c.pagePath])continue;let p=n[c.pagePath],u="virtual:velu-auth-api:"+c.url,y=a?Hi.join(a,`${c.pagePath}.mdx`):"",f=y&&Wi.existsSync(y)?y.replaceAll("\\","/"):null,g=f?`import * as Overlay from ${JSON.stringify(f)};`:"",b=f?"Overlay.toc||[]":"[]",d=f?",React.createElement(Overlay.default,{user:(globalThis.velu&&globalThis.velu.user)||{}})":"";i.set("\0"+u,`${g}import React from 'react';import {ApiReferencePage} from 'velu-ui';export const frontmatter=${JSON.stringify({title:p.title,description:p.description})};export const toc=${b};export const operation=${JSON.stringify(p.operation)};export const samples=${JSON.stringify(p.samples)};export const api=true;export default function Page(){return React.createElement(ApiReferencePage,{preset:${JSON.stringify(r.theme)},operation,samples,apiOperations:[{...operation,operation,samples,url:${JSON.stringify(c.url)}}],api:${JSON.stringify(p.api||{proxy:!0,server:null})}}${d})}`),s.push(`${JSON.stringify(l(c.url))}:()=>import(${JSON.stringify(u)})`)}return`const loaders={${s.join(",")}};
89
90
  export const site=${JSON.stringify({...r,assistant:r.assistant?{apiBase:r.assistant.apiBase,host:r.assistant.host}:null,guarded:!0})};
90
91
  export let navigation={kind:'root',children:[]};
91
92
  export const pages={};
@@ -94,10 +95,14 @@ export async function initializeReader(){
94
95
  const response=await fetch(base+'/@velu-reader/catalog',{credentials:'same-origin',cache:'no-store'});
95
96
  if(!response.ok)throw Error('Unable to load documentation access.');
96
97
  const catalog=await response.json();navigation=catalog.navigation;site.readerPrivate=catalog.private;site.readerRestricted=catalog.restricted;
98
+ const identity={user:catalog.user&&typeof catalog.user==='object'?catalog.user:{},groups:Array.isArray(catalog.groups)?catalog.groups:[],apiPlaygroundInputs:catalog.apiPlaygroundInputs&&typeof catalog.apiPlaygroundInputs==='object'?catalog.apiPlaygroundInputs:{}};
99
+ globalThis.velu={...(globalThis.velu||{}),...identity};
100
+ globalThis.mintlify={...(globalThis.mintlify||{}),user:identity.user};
101
+ if(typeof Event==='function'){globalThis.dispatchEvent(new Event('velu:user'));globalThis.dispatchEvent(new Event('mintlify:user'));}
97
102
  await Promise.all(Object.keys(catalog.pages).map(async url=>{const id=catalog.pages[url].moduleId;if(!loaders[id])return;const mod=await loaders[id]();pages[url]={...mod,Component:mod.default,...(mod.veluApi?{mdxApi:mod.veluApi,api:true,operation:mod.veluApi.operation,samples:mod.veluApi.samples}:{})};}));
98
103
  if(site.logo)site.logo={...site.logo,light:base+site.logo.light,dark:base+site.logo.dark};
99
- }`}var rr=_(()=>{});import Ri from"node:fs";import or from"node:path";function ae(e,t){let r=[],n=[],o=new Set;for(let i of ee(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=or.join(t,...a.split("/"))+".mdx",l=Ri.existsSync(s);l||r.push(`page "${i.pagePath}" \u2192 ${or.relative(t,s)} not found`),n.push({pagePath:i.pagePath,url:i.url,fileAbsPath:s,exists:l})}return{pageEntries:n,warnings:r}}var Me=_(()=>{re()});import Ni from"@apidevtools/swagger-parser";async function Ui(e){return Ni.dereference(e)}async function ir(e){return Oe(await Ui(e))}var sr=_(()=>{Ke();Ke()});function ar(e,t){if(!t||typeof t!="object")return e;let r=Z(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 Fi(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:f})=>{let g=`${t}/${Jt(c)}/${y.id}`;return n[g]={operation:y,samples:Xe(y,{server:o||y.servers?.[0],languages:i}),segment:f,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 lr(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 Fi(a,{base:r,api:n,ops:o})}async function cr(e,t){if(!e||typeof e!="object")return e;if(typeof e.tab=="string"&&e.openapi){let n=Jt(e.tab),o=ar(t.api,e.api),i=await lr(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=Jt(e.group),o=ar(t.api,e.api),i=await lr(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=>cr(o,t))));return r}async function ur(e,{api:t,loadOps:r}){let n={};return!e||typeof e!="object"?{nav:e,ops:n}:{nav:await cr(e,{api:t,loadOps:r,ops:n}),ops:n}}var Jt,pr=_(()=>{Le();St();Jt=e=>String(e??"").replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()||"x"});import Ii from"node:path";function Mi(e,t){return/^https?:\/\//.test(e)?e:Ii.resolve(t,e.replace(/^\/+/,""))}async function et(e,{targetDir:t,api:r}={}){return ur(e,{api:r,loadOps:n=>ir(Mi(n,t))})}var Bt=_(()=>{sr();pr()});import mr from"node:fs";import ve from"node:path";import{createHash as zi}from"node:crypto";function ze(e,{outDir:t}={}){let r=ve.resolve(e),n=t?ve.resolve(t):null,o=[],i=[],a=l=>{let c;try{c=mr.readdirSync(l,{withFileTypes:!0})}catch{return}for(let u of c){let p=ve.join(l,u.name);if(u.isDirectory()){if(u.name.startsWith(".")||Ji.has(u.name)||n&&p===n)continue;a(p);continue}if(!u.isFile())continue;let y=ve.extname(u.name).toLowerCase();if(y!==fr&&y!==Vi)continue;let f=ve.relative(r,p).split(ve.sep).join("/"),g={rel:f,abs:p,url:`${tt}/${f.split("/").map(encodeURIComponent).join("/")}?v=${Bi(p)}`,kind:y===fr?"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 Bi(e){try{return zi("sha1").update(mr.readFileSync(e)).digest("hex").slice(0,8)}catch{return"0"}}function dr(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 gr(e,t=""){return(e?.styles??[]).map(r=>`<link rel="stylesheet" href="${Di(t+r.url)}" data-velu-custom />`).join(`
100
- `)}var tt,fr,Vi,Ji,Di,Dt=_(()=>{tt="/@velu-custom",fr=".css",Vi=".js",Ji=new Set(["node_modules","public","dist"]);Di=e=>String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")});import hr from"node:fs";import ue from"node:path";function br(e,{buildOutDir:t}={}){let r=!1,n=new Map;return{configResolved(o){r=o.command==="build"&&!o.build.ssr&&process.env.VELU_DOCS_ACCESS_CONTROL==="1"},name:"velu-site",resolveId(o){return o.startsWith("virtual:velu-auth-api:")?"\0"+o:o===vr?yr:null},async load(o){return n.has(o)?n.get(o):o!==yr?null:qi(e,{buildOutDir:t,guarded:r,apiModules:n})}}}async function qi(e,{buildOutDir:t,guarded:r,apiModules:n}={}){let o={};try{o=JSON.parse(hr.readFileSync(ue.join(e,"velu.json"),"utf-8"))}catch{}let i=Z(o.api),a=o.navigation??{},s={};try{let w=await et(o.navigation??{},{targetDir:e,api:i});a=w.nav,s=w.ops}catch(w){console.warn(`[velu] openapi: ${w.message}`)}let l=Y(a),{pageEntries:c,warnings:u}=ae(l,e);for(let w of u)console.warn(`[velu] nav: ${w}`);let p=Ue(o.logo),y={name:o.name??ue.basename(e),theme:Ee(o.theme),logo:p?{light:Ut({logo:p},"light")?.url??Re,dark:Ut({logo:p},"dark")?.url??Ne,href:p.href,mono:p.light===p.dark}:null,footer:Te(o.footer),navbar:Ce(o.navbar),contextual:At(o.contextual??(["thulir","aalam","nila","kadhir"].includes(o.theme)?{options:[]}:void 0)),assistant:Pe(o.assistant),customScripts:ze(e,{outDir:t}).scripts.map(w=>w.url)};if(r)return nr({pageEntries:c,tree:l,site:y,ops:s,walkPages:ee,apiModules:n,targetDir:e});let f=[],g=[],b=0;for(let w of c){if(!w.exists)continue;let L=JSON.stringify(w.fileAbsPath.split(ue.sep).join("/")),I=JSON.stringify(ue.relative(e,w.fileAbsPath).split(ue.sep).join("/")),F=`__p${b++}`;f.push(`import * as ${F} from ${L};`),g.push(` ${JSON.stringify(w.url)}: { Component: ${F}.default, frontmatter: ${F}.frontmatter, toc: ${F}.toc, changelog: ${F}.changelog, relPath: ${I}, ...__mdxApi(${F}) },`)}let m=new Set(c.filter(w=>w.exists).map(w=>w.url));for(let w of c)!w.exists&&!m.has(w.url)&&g.push(` ${JSON.stringify(w.url)}: { missing: true },`);let h=[],$=[],P=[],E=!1,T=0;for(let w of ee(l)){if(!w.node?.api)continue;let L=s[w.pagePath];if(!L)continue;E=!0;let I=`__op${T}`,F=`__samples${T}`,O=`__api${T}`,x=ue.join(e,`${w.pagePath}.mdx`),A=hr.existsSync(x)?`__overlay${T}`:null;T+=1,A&&f.push(`import * as ${A} from ${JSON.stringify(x.split(ue.sep).join("/"))};`),h.push(`const ${I} = ${JSON.stringify(L.operation)};`),h.push(`const ${F} = ${JSON.stringify(L.samples)};`),P.push(`{ id: ${JSON.stringify(L.operation.id)}, method: ${JSON.stringify(L.operation.method)}, title: ${JSON.stringify(L.operation.title)}, url: ${JSON.stringify(w.url)}, operation: ${I}, samples: ${F}, api: ${JSON.stringify(L.api||{proxy:!0,server:null})} }`);let k=`{ preset: ${JSON.stringify(y.theme)}, operation: ${I}, samples: ${F}, apiOperations: __apiOperations, api: ${JSON.stringify(L.api||{proxy:!0,server:null})} }`;$.push(A?`function ${O}(){ return React.createElement(ApiReferencePage, ${k}, React.createElement(${A}.default)); }`:`function ${O}(){ return React.createElement(ApiReferencePage, ${k}); }`),g.push(` ${JSON.stringify(w.url)}: { Component: ${O}, frontmatter: { title: ${JSON.stringify(L.title)}, description: ${JSON.stringify(L.description)} }, toc: ${A?`${A}.toc || []`:"[]"}, operation: ${I}, samples: ${F}, api: true },`)}E&&(h.push(`const __apiOperations = [
104
+ }`}var mr=L(()=>{});import Ki from"node:fs";import dr from"node:path";function ae(e,t){let r=[],n=[],o=new Set;for(let i of ee(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=dr.join(t,...a.split("/"))+".mdx",l=Ki.existsSync(s);l||r.push(`page "${i.pagePath}" \u2192 ${dr.relative(t,s)} not found`),n.push({pagePath:i.pagePath,url:i.url,fileAbsPath:s,exists:l})}return{pageEntries:n,warnings:r}}var Ve=L(()=>{re()});import Xi from"@apidevtools/swagger-parser";async function Yi(e){return Xi.dereference(e)}async function gr(e){return Te(await Yi(e))}var hr=L(()=>{Ye();Ye()});function yr(e,t){if(!t||typeof t!="object")return e;let r=Z(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 Zi(e,{base:t,api:r,ops:n}){let o=r?.server,i=r?.languages||kt,a={proxy:r?.proxy!==!1,server:o??null},s=new Map;for(let c of e){let p=c.op.tags?.[0]||"API";s.has(p)||s.set(p,[]),s.get(p).push(c)}let l=[];for(let[c,p]of s){let u=p.map(({op:y,segment:f})=>{let g=`${t}/${qt(c)}/${y.id}`;return n[g]={operation:y,samples:Ze(y,{server:o||y.servers?.[0],languages:i}),segment:f,title:y.title,description:y.description,method:y.method,api:a},{apiPage:g,label:y.title,method:y.method}});l.push({group:c,pages:u})}return l}async function vr(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:p}=await t(s);l.forEach((u,y)=>{!u.servers?.length&&p?.length&&(u.servers=p),a.push({op:u,segment:c[y]})})}return Zi(a,{base:r,api:n,ops:o})}async function br(e,t){if(!e||typeof e!="object")return e;if(typeof e.tab=="string"&&e.openapi){let n=qt(e.tab),o=yr(t.api,e.api),i=await vr(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=qt(e.group),o=yr(t.api,e.api),i=await vr(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e,c=i.flatMap(p=>p.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=>br(o,t))));return r}async function xr(e,{api:t,loadOps:r}){let n={};return!e||typeof e!="object"?{nav:e,ops:n}:{nav:await br(e,{api:t,loadOps:r,ops:n}),ops:n}}var qt,wr=L(()=>{Re();jt();qt=e=>String(e??"").replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()||"x"});import Qi from"node:path";function es(e,t){return/^https?:\/\//.test(e)?e:Qi.resolve(t,e.replace(/^\/+/,""))}async function nt(e,{targetDir:t,api:r}={}){return xr(e,{api:r,loadOps:n=>gr(es(n,t))})}var Gt=L(()=>{hr();wr()});import Sr from"node:fs";import ve from"node:path";import{createHash as ts}from"node:crypto";function Be(e,{outDir:t}={}){let r=ve.resolve(e),n=t?ve.resolve(t):null,o=[],i=[],a=l=>{let c;try{c=Sr.readdirSync(l,{withFileTypes:!0})}catch{return}for(let p of c){let u=ve.join(l,p.name);if(p.isDirectory()){if(p.name.startsWith(".")||rs.has(p.name)||n&&u===n)continue;a(u);continue}if(!p.isFile())continue;let y=ve.extname(p.name).toLowerCase();if(y!==$r&&y!==ns)continue;let f=ve.relative(r,u).split(ve.sep).join("/"),g={rel:f,abs:u,url:`${rt}/${f.split("/").map(encodeURIComponent).join("/")}?v=${os(u)}`,kind:y===$r?"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 os(e){try{return ts("sha1").update(Sr.readFileSync(e)).digest("hex").slice(0,8)}catch{return"0"}}function kr(e,t){let r=`${rt}/`;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 jr(e,t=""){return(e?.styles??[]).map(r=>`<link rel="stylesheet" href="${is(t+r.url)}" data-velu-custom />`).join(`
105
+ `)}var rt,$r,ns,rs,is,Wt=L(()=>{rt="/@velu-custom",$r=".css",ns=".js",rs=new Set(["node_modules","public","dist"]);is=e=>String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")});import Ar from"node:fs";import ue from"node:path";function Tr(e,{buildOutDir:t}={}){let r=!1,n=new Map;return{configResolved(o){r=o.command==="build"&&!o.build.ssr&&process.env.VELU_DOCS_ACCESS_CONTROL==="1"},name:"velu-site",resolveId(o){return o.startsWith("virtual:velu-auth-api:")?"\0"+o:o===Er?Or:null},async load(o){return n.has(o)?n.get(o):o!==Or?null:ss(e,{buildOutDir:t,guarded:r,apiModules:n})}}}async function ss(e,{buildOutDir:t,guarded:r,apiModules:n}={}){let o={};try{o=JSON.parse(Ar.readFileSync(ue.join(e,"velu.json"),"utf-8"))}catch{}let i=Z(o.api),a=o.navigation??{},s={};try{let w=await nt(o.navigation??{},{targetDir:e,api:i});a=w.nav,s=w.ops}catch(w){console.warn(`[velu] openapi: ${w.message}`)}let l=Y(a),{pageEntries:c,warnings:p}=ae(l,e);for(let w of p)console.warn(`[velu] nav: ${w}`);let u=Ie(o.logo),y={name:o.name??ue.basename(e),theme:Ce(o.theme),logo:u?{light:Mt({logo:u},"light")?.url??Ue,dark:Mt({logo:u},"dark")?.url??Fe,href:u.href,mono:u.light===u.dark}:null,footer:Pe(o.footer),navbar:Le(o.navbar),contextual:Et(o.contextual??(["thulir","aalam","nila","kadhir"].includes(o.theme)?{options:[]}:void 0)),assistant:_e(o.assistant),customScripts:Be(e,{outDir:t}).scripts.map(w=>w.url)};if(r)return fr({pageEntries:c,tree:l,site:y,ops:s,walkPages:ee,apiModules:n,targetDir:e});let f=[],g=[],b=0;for(let w of c){if(!w.exists)continue;let _=JSON.stringify(w.fileAbsPath.split(ue.sep).join("/")),I=JSON.stringify(ue.relative(e,w.fileAbsPath).split(ue.sep).join("/")),F=`__p${b++}`;f.push(`import * as ${F} from ${_};`),g.push(` ${JSON.stringify(w.url)}: { Component: ${F}.default, frontmatter: ${F}.frontmatter, toc: ${F}.toc, changelog: ${F}.changelog, relPath: ${I}, ...__mdxApi(${F}) },`)}let d=new Set(c.filter(w=>w.exists).map(w=>w.url));for(let w of c)!w.exists&&!d.has(w.url)&&g.push(` ${JSON.stringify(w.url)}: { missing: true },`);let h=[],$=[],P=[],E=!1,T=0;for(let w of ee(l)){if(!w.node?.api)continue;let _=s[w.pagePath];if(!_)continue;E=!0;let I=`__op${T}`,F=`__samples${T}`,O=`__api${T}`,x=ue.join(e,`${w.pagePath}.mdx`),A=Ar.existsSync(x)?`__overlay${T}`:null;T+=1,A&&f.push(`import * as ${A} from ${JSON.stringify(x.split(ue.sep).join("/"))};`),h.push(`const ${I} = ${JSON.stringify(_.operation)};`),h.push(`const ${F} = ${JSON.stringify(_.samples)};`),P.push(`{ id: ${JSON.stringify(_.operation.id)}, method: ${JSON.stringify(_.operation.method)}, title: ${JSON.stringify(_.operation.title)}, url: ${JSON.stringify(w.url)}, operation: ${I}, samples: ${F}, api: ${JSON.stringify(_.api||{proxy:!0,server:null})} }`);let k=`{ preset: ${JSON.stringify(y.theme)}, operation: ${I}, samples: ${F}, apiOperations: __apiOperations, api: ${JSON.stringify(_.api||{proxy:!0,server:null})} }`;$.push(A?`function ${O}(){ return React.createElement(ApiReferencePage, ${k}, React.createElement(${A}.default)); }`:`function ${O}(){ return React.createElement(ApiReferencePage, ${k}); }`),g.push(` ${JSON.stringify(w.url)}: { Component: ${O}, frontmatter: { title: ${JSON.stringify(_.title)}, description: ${JSON.stringify(_.description)} }, toc: ${A?`${A}.toc || []`:"[]"}, operation: ${I}, samples: ${F}, api: true },`)}E&&(h.push(`const __apiOperations = [
101
106
  ${P.join(`,
102
107
  `)}
103
108
  ];`),h.push($.join(`
@@ -106,17 +111,17 @@ ${P.join(`,
106
111
  `),"function __mdxApi(mod) { const data = Reflect.get(mod, 'veluApi'); return data?.operation ? { mdxApi: data, api: true, operation: data.operation, samples: data.samples } : {}; }",h.join(`
107
112
  `),"","export async function initializeReader() {}","export const pages = {",g.join(`
108
113
  `),"};",`export const navigation = ${JSON.stringify(l)};`,`export const site = ${JSON.stringify(y)};`,"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(`
109
- `)}var vr,yr,xr=_(()=>{rr();re();Me();Fe();Bt();Dt();vr="virtual:velu-site",yr="\0"+vr});import nt from"node:path";function wr(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=`
114
+ `)}var Er,Or,Cr=L(()=>{mr();re();Ve();Me();Gt();Wt();Er="virtual:velu-site",Or="\0"+Er});import ot from"node:path";function Pr(e){let t=ot.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=ot.dirname(n.split("?",1)[0]),a=ot.relative(i,t).split(ot.sep).join("/");!a||a===""?a=".":a.startsWith(".")||(a=`./${a}`);let s=`
110
115
  /* data-velu-project-source */
111
116
  @source "${a}/**/*.{mdx,md,jsx,tsx,js,ts,html}";
112
117
  @source not "${a}/node_modules";
113
118
  @source not "${a}/.velu";
114
119
  @source not "${a}/dist";
115
120
  @source not "${a}/.git";
116
- `;return{code:r+s,map:null}}}}var $r=_(()=>{});import{visit as Gi}from"unist-util-visit";function Wi(e,t){let r=Sr(e).replace(/[?#].*$/,""),n=Sr(t).replace(/\/+$/,"");return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):null}function kr(e,t){return()=>(r,n)=>{typeof e=="function"&&Gi(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:Wi(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 Sr,jr=_(()=>{Sr=e=>String(e||"").replace(/\\/g,"/")});import rt from"node:path";import Hi from"node:fs";import{createRequire as Ki}from"node:module";import Xi from"@tailwindcss/vite";import Yi from"@vitejs/plugin-react";import Zi from"@mdx-js/rollup";import Qi from"remark-frontmatter";import es from"remark-mdx-frontmatter";import ts from"remark-gfm";import ns from"rehype-slug";function rs(e){let r=Ki(import.meta.url).resolve("@mdx-js/react"),n=rt.resolve(e,"runtime","velu-ui"),o=Hi.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 Ar({targetDir:e,VITE_ROOT:t,validateProps:r,basePath:n,buildOutDir:o}){return{root:t,base:n?`${n}/`:"/",plugins:[br(e,{buildOutDir:o}),Zi({remarkPlugins:[Qi,es,ts,Vt,Ie,kr(r,e)],rehypePlugins:[ns],providerImportSource:"@mdx-js/react"}),Yi(),wr(e),Xi({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:rs(t),dedupe:["react","react-dom","@mdx-js/react"]}}}var Or=_(()=>{zt();tr();xr();$r();jr()});function z(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 os(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=os(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 is(e,t){return e==="warning"?Q(t,K.yellow,"\u26A0"):e==="info"?Q(t,K.cyan,"\u2139"):Q(t,K.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(`${is(e.severity,t)} ${Q(t,K.bold,r)}`+(o?` ${Q(t,K.dim,o)}`:"")),e.title&&i.push(` ${e.title}`),e.detail&&e.detail!==e.title&&i.push(` ${Q(t,K.dim,e.detail)}`),e.frame)for(let a of String(e.frame).split(`
121
+ `;return{code:r+s,map:null}}}}var Lr=L(()=>{});import{visit as as}from"unist-util-visit";function ls(e,t){let r=_r(e).replace(/[?#].*$/,""),n=_r(t).replace(/\/+$/,"");return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):null}function Rr(e,t){return()=>(r,n)=>{typeof e=="function"&&as(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:ls(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 _r,Nr=L(()=>{_r=e=>String(e||"").replace(/\\/g,"/")});function Ur(){return e=>{Ht(e,t=>{!cs(t)||!t.body?.body||t.body.body.some(r=>r.type==="VariableDeclaration"&&r.declarations?.some(n=>n.id?.name==="user"))||t.body.body.unshift({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"user"},init:{type:"LogicalExpression",operator:"||",left:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"user"},computed:!1,optional:!0},right:{type:"ObjectExpression",properties:[]}}}]})})}}function cs(e){return e?.type==="FunctionDeclaration"&&e.id?.name==="_createMdxContent"||e?.type==="FunctionExpression"&&e.id?.name==="_createMdxContent"?!0:(e?.type==="VariableDeclarator"&&e.id?.name==="_createMdxContent"&&e.init&&(e.init.type==="FunctionExpression"||e.init.type==="ArrowFunctionExpression"),!1)}function Ht(e,t){if(!(!e||typeof e!="object")){t(e);for(let r of Object.values(e))Array.isArray(r)?r.forEach(n=>Ht(n,t)):r&&typeof r=="object"&&typeof r.type=="string"&&Ht(r,t)}}var Fr=L(()=>{});import it from"node:path";import us from"node:fs";import{createRequire as ps}from"node:module";import fs from"@tailwindcss/vite";import ms from"@vitejs/plugin-react";import ds from"@mdx-js/rollup";import gs from"remark-frontmatter";import hs from"remark-mdx-frontmatter";import ys from"remark-gfm";import vs from"rehype-slug";function bs(e){let r=ps(import.meta.url).resolve("@mdx-js/react"),n=it.resolve(e,"runtime","velu-ui"),o=us.existsSync(n)?n:it.resolve(e,"..","velu-ui","src");return[{find:"@mdx-js/react",replacement:r},{find:/^velu-ui$/,replacement:it.join(o,"index.js")},{find:/^velu-ui\//,replacement:o+"/"}]}function Ir({targetDir:e,VITE_ROOT:t,validateProps:r,basePath:n,buildOutDir:o}){return{root:t,base:n?`${n}/`:"/",plugins:[Tr(e,{buildOutDir:o}),ds({remarkPlugins:[gs,hs,ys,Dt,ze,Rr(r,e)],rehypePlugins:[vs],recmaPlugins:[Ur],providerImportSource:"@mdx-js/react"}),ms(),Pr(e),fs({optimize:!1})],cacheDir:it.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:bs(t),dedupe:["react","react-dom","@mdx-js/react"]}}}var Mr=L(()=>{Jt();pr();Cr();Lr();Nr();Fr()});function z(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 xs(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 st(e,t=[]){if(!e)return null;let r=String(e).toLowerCase(),n=null,o=1/0;for(let a of t){let s=xs(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 ws(e,t){return e==="warning"?Q(t,K.yellow,"\u26A0"):e==="info"?Q(t,K.cyan,"\u2139"):Q(t,K.red,"\u2716")}function Xt(e,{color:t=!1}={}){let r=Kt[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(`${ws(e.severity,t)} ${Q(t,K.bold,r)}`+(o?` ${Q(t,K.dim,o)}`:"")),e.title&&i.push(` ${e.title}`),e.detail&&e.detail!==e.title&&i.push(` ${Q(t,K.dim,e.detail)}`),e.frame)for(let a of String(e.frame).split(`
117
122
  `))i.push(` ${a}`);return e.suggestion&&i.push(` ${Q(t,K.cyan,`Did you mean <${e.suggestion}>?`)}`),e.hint&&i.push(` ${Q(t,K.dim,`\u2192 ${e.hint}`)}`),i.join(`
118
- `)}function it(e,{color:t=!1}={}){if(!e.length)return Q(t,K.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(Q(t,K.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(Q(t,o?K.red:K.yellow,a)),n.join(`
119
- `)}var qt,K,Q,pe=_(()=>{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"};K={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},Q=(e,t,r)=>e?`${t}${r}${K.reset}`:r});function ss(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=Er(e).replace(/[?#].*$/,""),n=t?Er(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 as(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 ls(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function cs(e){return String(e||"").replace(/\s*\(\d+:\d+(?:-\d+:\d+)?\)\s*$/,"").trim()}function ps(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,$=0;h&&$<6;h=h.cause,$+=1)if(h.veluIssue){i=h.veluIssue;break}if(i)return z({...i,file:i.file||o});let a=ss(e)||{},s=a.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(s);if(l){let h=l[1],$=/referenced in your code at `(\d+):(\d+)/.exec(s),P=/\bin `([^`]+)`/.exec(s),E=P?Wt(P[1],r):null;return z({category:"unknown-component",file:E||o,line:$?Number($[1]):null,column:$?Number($[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)||ls(a.reason||s),u=a.id||c&&c.file||a.file||null,p=Wt(u,r)||o,y=!!p&&Wt(u,r)!=null,f=ps(a.frame,y||!!o),g=as(cs(a.reason||s)),b=us.test(s),m=a.source==="remark-frontmatter"||/\byaml\b|frontmatter/i.test(s)||c&&c.line===1&&/unexpected|expected/i.test(s)&&/---/.test(s);return c||b||f&&y?z({category:m?"frontmatter":"mdx-syntax",file:p,line:c?c.line:null,column:c?c.column:null,frame:f,title:g||(m?"Invalid frontmatter":"MDX syntax error"),detail:"",hint:m?"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)?z({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."}):z({category:"render-crash",file:p,title:"This page failed to render",detail:g,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var Er,us,Ht=_(()=>{pe();Er=e=>String(e).replace(/\\/g,"/");us=/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 fs(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(fs).join(`
123
+ `)}function at(e,{color:t=!1}={}){if(!e.length)return Q(t,K.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(Q(t,K.bold,s));for(let c of l)n.push(Xt({...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(Q(t,o?K.red:K.yellow,a)),n.join(`
124
+ `)}var Kt,K,Q,pe=L(()=>{Kt={"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"};K={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},Q=(e,t,r)=>e?`${t}${r}${K.reset}`:r});function $s(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 Yt(e,t){if(!e)return null;let r=zr(e).replace(/[?#].*$/,""),n=t?zr(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 Ss(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 ks(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function js(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 Je(e,t={}){let{projectDir:r="",knownComponents:n=[],file:o=null}=t,i=null;for(let h=e,$=0;h&&$<6;h=h.cause,$+=1)if(h.veluIssue){i=h.veluIssue;break}if(i)return z({...i,file:i.file||o});let a=$s(e)||{},s=a.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(s);if(l){let h=l[1],$=/referenced in your code at `(\d+):(\d+)/.exec(s),P=/\bin `([^`]+)`/.exec(s),E=P?Yt(P[1],r):null;return z({category:"unknown-component",file:E||o,line:$?Number($[1]):null,column:$?Number($[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:st(h,n)})}let c=a.loc||(a.line!=null?{line:a.line,column:a.column,file:a.file}:null)||ks(a.reason||s),p=a.id||c&&c.file||a.file||null,u=Yt(p,r)||o,y=!!u&&Yt(p,r)!=null,f=Os(a.frame,y||!!o),g=Ss(js(a.reason||s)),b=As.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||b||f&&y?z({category:d?"frontmatter":"mdx-syntax",file:u,line:c?c.line:null,column:c?c.column:null,frame:f,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)?z({category:"invalid-props",file:u,title:"A component received an invalid value",detail:g,hint:"Check the props/options you passed to a component on this page."}):z({category:"render-crash",file:u,title:"This page failed to render",detail:g,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var zr,As,Zt=L(()=>{pe();zr=e=>String(e).replace(/\\/g,"/");As=/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 Es(e){let t=Kt[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 Qt(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(Es).join(`
120
125
  `);return`<!doctype html>
121
126
  <html lang="en">
122
127
  <head>
@@ -188,16 +193,16 @@ ${P.join(`,
188
193
  <div class="velu-err-foot">Fix the file and save \u2014 this page reloads automatically.</div>
189
194
  </div>
190
195
  </body>
191
- </html>`}var oe,Tr=_(()=>{pe();oe=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")});import st from"node:fs";import Be from"node:path";import{fileURLToPath as ms}from"node:url";import ds from"iso-639-1";function Je(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
192
- `).length}function ys(e,t){return t==null||t<0?null:e.slice(0,t).split(`
193
- `).length}function Xt(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
194
- `).length}function vs(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 f=o(c);if(f){if(f.oneOf){f.oneOf.some(b=>a(l,b))||n.push({path:u,key:p,message:"value does not match any allowed shape"});return}if(f.type&&i(l)!==f.type){n.push({path:u,key:p,message:`expected ${f.type}, got ${i(l)}`});return}if(f.type==="string"&&f.minLength!=null&&l.length<f.minLength&&n.push({path:u,key:p,message:"must not be empty"}),f.type==="object"&&i(l)==="object"){for(let b of f.required||[])b in l||n.push({path:u?`${u}.${b}`:b,key:b,message:`missing required "${b}"`});let g=f.properties||{};if(f.additionalProperties===!1)for(let b of Object.keys(l))b in g||n.push({path:u?`${u}.${b}`:b,key:b,message:`unknown field "${b}"`});for(let[b,m]of Object.entries(g))b in l&&s(l[b],m,u?`${u}.${b}`:b,b,y)}f.type==="array"&&Array.isArray(l)&&f.items&&l.forEach((g,b)=>s(g,f.items,`${u}[${b}]`,p,y))}}}function bs(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=Be.join(e,"velu.json"),n;try{n=st.readFileSync(r,"utf-8")}catch(s){return s.code==="ENOENT"?t.push(z({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(z({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?ys(n,Number(l[1])):null;return t.push(z({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(hs,"utf-8"))}catch{}if(i)for(let s of vs(o,i,i)){let l=/^unknown field/.test(s.message);t.push(z({category:"config-schema",severity:l?"warning":"error",file:"velu.json",line:Je(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&&!bs(l)&&t.push(z({category:"config-schema",severity:"warning",file:"velu.json",line:Je(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=Be.resolve(e,o.favicon.replace(/^\/+/,""));st.existsSync(s)||t.push(z({category:"config-asset",file:"velu.json",line:Je(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(Be.resolve(e,l.replace(/^\/+/,"")))){let u=c.length===2?"logo":`logo (${c[0]})`;t.push(z({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=Y(o.navigation)}catch(l){t.push(z({category:"config-nav",file:"velu.json",line:Je(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),f=y?Xt(n,y[1]):null;t.push(z({category:"config-nav",severity:p?"error":"warning",file:"velu.json",line:f,title:u,hint:p?"Create the .mdx file, or remove the page from navigation.":""}))}xs(s,n,t)}}return t}function xs(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();ds.validate(a)||r.push(z({category:"config-nav",severity:"warning",file:"velu.json",line:Xt(t,i.language)||Je(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 gs,hs,Yt=_(()=>{pe();re();Me();Fe();gs=Be.dirname(ms(import.meta.url)),hs=Be.resolve(gs,"..","..","schema","velu.schema.json")});import ws from"node:fs/promises";import $s from"node:fs";import fe from"node:path";import{fileURLToPath as Ss,pathToFileURL as ks}from"node:url";import{compile as js}from"@mdx-js/mdx";import As from"remark-frontmatter";import Os from"remark-mdx-frontmatter";import Es from"remark-gfm";import Ts from"rehype-slug";import{visit as Cs}from"unist-util-visit";function Zt(){if(lt)return lt;let e=fe.dirname(Ss(import.meta.url)),t=[fe.resolve(e,"..","runtime","velu-ui"),fe.resolve(e,"..","..","runtime","velu-ui"),fe.resolve(e,"..","..","..","velu-ui","src")],r=null;for(let n of t){let o=fe.join(n,"lib","component-schemas.js");if($s.existsSync(o)){r=o;break}}return lt=r?import(ks(r).href).then(n=>n.validateProps).catch(()=>null):Promise.resolve(null),lt}function Ps(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 Ls(e,t){return()=>r=>{Cs(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:Ps(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 _s(e,t){let r=[],n;try{n=await ws.readFile(t.fileAbsPath,"utf-8")}catch{return r}let o=fe.relative(e,t.fileAbsPath).split(fe.sep).join("/"),i=[],a=new Set;try{await js({value:n,path:t.fileAbsPath},{remarkPlugins:[As,Os,Es,Ie,Ls(i,a)],rehypePlugins:[Ts],providerImportSource:"@mdx-js/react"})}catch(u){return r.push(Ve(u,{projectDir:e,knownComponents:ne,file:o})),r}let s=new Set(ne),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(z({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,ne)}));continue}if(l){let p=l(u.name,u.props,{checkRequired:!1});p&&r.push(z({...p,file:o,line:u.line,column:u.column}))}}return r}async function Cr(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 _s(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();pe();Ht();We()});function en(e={},t=[]){if("public"in e&&typeof e.public!="boolean")throw new Error("Frontmatter public must be a boolean.");if(t.some(n=>n.public!==void 0&&typeof n.public!="boolean"))throw new Error("Navigation public must be a boolean.");let r=e.groups;if(r!==void 0&&(!Array.isArray(r)||r.length===0||r.some(n=>typeof n!="string"||!n.trim())))throw new Error("Frontmatter groups must be a non-empty array of group names.");return r?{public:!1,groups:[...new Set(r.map(n=>n.trim()))]}:{public:e.public??t.some(n=>n.public===!0),groups:[]}}var Pr=_(()=>{});import qe from"node:fs";import tn from"node:path";import Rr from"js-yaml";function nn(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=>nn(o,t,r+1));else{n={};for(let[o,i]of Object.entries(e))n[o]=nn(i,t,r+1)}return t.delete(e),n}function Nr(e){return Rr.dump(nn(e,new Set,0),{noRefs:!0,lineWidth:100,skipInvalid:!0})}function Ur(e){let t=String(e).replace(/\.md$/i,"");return t===""||t==="/"||t==="/index"?"/":t.replace(/\/+$/,"")||"/"}function Rs(e){return e==="/"?"/index.md":`${e}.md`}function rn(e,t){if(t==="api")return`# ${Lr}
195
- ${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${Lr}
196
+ </html>`}var oe,Vr=L(()=>{pe();oe=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")});import lt from"node:fs";import qe from"node:path";import{fileURLToPath as Ts}from"node:url";import Cs from"iso-639-1";function De(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
197
+ `).length}function _s(e,t){return t==null||t<0?null:e.slice(0,t).split(`
198
+ `).length}function en(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
199
+ `).length}function Rs(e,t,r){let n=[];return s(e,t,"",null),n;function o(l){if(l&&l.$ref){let c=l.$ref.replace(/^#\//,"").split("/"),p=r;for(let u of c)p=p?.[u];return p||{}}return l}function i(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function a(l,c){let p=n.length;s(l,c,"",null,!0);let u=n.length===p;return u||(n.length=p),u}function s(l,c,p,u,y){let f=o(c);if(f){if(f.oneOf){f.oneOf.some(b=>a(l,b))||n.push({path:p,key:u,message:"value does not match any allowed shape"});return}if(f.type&&i(l)!==f.type){n.push({path:p,key:u,message:`expected ${f.type}, got ${i(l)}`});return}if(f.type==="string"&&f.minLength!=null&&l.length<f.minLength&&n.push({path:p,key:u,message:"must not be empty"}),f.type==="object"&&i(l)==="object"){for(let b of f.required||[])b in l||n.push({path:p?`${p}.${b}`:b,key:b,message:`missing required "${b}"`});let g=f.properties||{};if(f.additionalProperties===!1)for(let b of Object.keys(l))b in g||n.push({path:p?`${p}.${b}`:b,key:b,message:`unknown field "${b}"`});for(let[b,d]of Object.entries(g))b in l&&s(l[b],d,p?`${p}.${b}`:b,b,y)}f.type==="array"&&Array.isArray(l)&&f.items&&l.forEach((g,b)=>s(g,f.items,`${p}[${b}]`,u,y))}}}function Ns(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 ct(e){let t=[],r=qe.join(e,"velu.json"),n;try{n=lt.readFileSync(r,"utf-8")}catch(s){return s.code==="ENOENT"?t.push(z({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(z({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?_s(n,Number(l[1])):null;return t.push(z({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(lt.readFileSync(Ls,"utf-8"))}catch{}if(i)for(let s of Rs(o,i,i)){let l=/^unknown field/.test(s.message);t.push(z({category:"config-schema",severity:l?"warning":"error",file:"velu.json",line:De(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&&!Ns(l)&&t.push(z({category:"config-schema",severity:"warning",file:"velu.json",line:De(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=qe.resolve(e,o.favicon.replace(/^\/+/,""));lt.existsSync(s)||t.push(z({category:"config-asset",file:"velu.json",line:De(n,"favicon"),title:`favicon not found: ${o.favicon}`,hint:"The path is relative to the project root."}))}let a=Ie(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(!lt.existsSync(qe.resolve(e,l.replace(/^\/+/,"")))){let p=c.length===2?"logo":`logo (${c[0]})`;t.push(z({category:"config-asset",file:"velu.json",line:en(n,l),title:`${p} not found: ${l}`,hint:"The path is relative to the project root."}))}}if(o.navigation&&typeof o.navigation=="object"){let s;try{s=Y(o.navigation)}catch(l){t.push(z({category:"config-nav",file:"velu.json",line:De(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 p of c){let u=/not found$/.test(p),y=/page "([^"]+)"/.exec(p),f=y?en(n,y[1]):null;t.push(z({category:"config-nav",severity:u?"error":"warning",file:"velu.json",line:f,title:p,hint:u?"Create the .mdx file, or remove the page from navigation.":""}))}Us(s,n,t)}}return t}function Us(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();Cs.validate(a)||r.push(z({category:"config-nav",severity:"warning",file:"velu.json",line:en(t,i.language)||De(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 Ps,Ls,tn=L(()=>{pe();re();Ve();Me();Ps=qe.dirname(Ts(import.meta.url)),Ls=qe.resolve(Ps,"..","..","schema","velu.schema.json")});import Fs from"node:fs/promises";import Is from"node:fs";import fe from"node:path";import{fileURLToPath as Ms,pathToFileURL as zs}from"node:url";import{compile as Vs}from"@mdx-js/mdx";import Bs from"remark-frontmatter";import Js from"remark-mdx-frontmatter";import Ds from"remark-gfm";import qs from"rehype-slug";import{visit as Gs}from"unist-util-visit";function nn(){if(ut)return ut;let e=fe.dirname(Ms(import.meta.url)),t=[fe.resolve(e,"..","runtime","velu-ui"),fe.resolve(e,"..","..","runtime","velu-ui"),fe.resolve(e,"..","..","..","velu-ui","src")],r=null;for(let n of t){let o=fe.join(n,"lib","component-schemas.js");if(Is.existsSync(o)){r=o;break}}return ut=r?import(zs(r).href).then(n=>n.validateProps).catch(()=>null):Promise.resolve(null),ut}function Ws(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 Hs(e,t){return()=>r=>{Gs(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:Ws(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 Ks(e,t){let r=[],n;try{n=await Fs.readFile(t.fileAbsPath,"utf-8")}catch{return r}let o=fe.relative(e,t.fileAbsPath).split(fe.sep).join("/"),i=[],a=new Set;try{await Vs({value:n,path:t.fileAbsPath},{remarkPlugins:[Bs,Js,Ds,ze,Hs(i,a)],rehypePlugins:[qs],providerImportSource:"@mdx-js/react"})}catch(p){return r.push(Je(p,{projectDir:e,knownComponents:ne,file:o})),r}let s=new Set(ne),l=await nn(),c=new Set;for(let p of i)if(!a.has(p.name)){if(!s.has(p.name)){if(c.has(p.name))continue;c.add(p.name),r.push(z({category:"unknown-component",file:o,line:p.line,column:p.column,title:`<${p.name}> is not a built-in component`,hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:st(p.name,ne)}));continue}if(l){let u=l(p.name,p.props,{checkRequired:!1});u&&r.push(z({...u,file:o,line:p.line,column:p.column}))}}return r}async function Br(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 Ks(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 ut,rn=L(()=>{Jt();pe();Zt();He()});function on(e={},t=[]){if("public"in e&&typeof e.public!="boolean")throw new Error("Frontmatter public must be a boolean.");if(t.some(n=>n.public!==void 0&&typeof n.public!="boolean"))throw new Error("Navigation public must be a boolean.");let r=e.groups;if(r!==void 0&&(!Array.isArray(r)||r.length===0||r.some(n=>typeof n!="string"||!n.trim())))throw new Error("Frontmatter groups must be a non-empty array of group names.");return r?{public:!1,groups:[...new Set(r.map(n=>n.trim()))]}:{public:e.public??t.some(n=>n.public===!0),groups:[]}}var Jr=L(()=>{});import We from"node:fs";import sn from"node:path";import Gr from"js-yaml";function an(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=>an(o,t,r+1));else{n={};for(let[o,i]of Object.entries(e))n[o]=an(i,t,r+1)}return t.delete(e),n}function Wr(e){return Gr.dump(an(e,new Set,0),{noRefs:!0,lineWidth:100,skipInvalid:!0})}function Hr(e){let t=String(e).replace(/\.md$/i,"");return t===""||t==="/"||t==="/index"?"/":t.replace(/\/+$/,"")||"/"}function Xs(e){return e==="/"?"/index.md":`${e}.md`}function ln(e,t){if(t==="api")return`# ${Dr}
200
+ ${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${Dr}
196
201
 
197
- `;return r?e.slice(0,r[0].length)+n+e.slice(r[0].length):n+e}function Us(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function Fs(e){try{let t=qe.readFileSync(e,"utf-8").match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return{};let r=Rr.load(t[1]);return r&&typeof r=="object"?r:{}}catch{return{}}}async function we(e){let t={};try{t=JSON.parse(qe.readFileSync(tn.join(e,"velu.json"),"utf-8"))}catch{return{name:tn.basename(e),baseUrl:"",pages:[]}}let r=t.name??tn.basename(e),n=typeof process.env.VELU_SITE_URL=="string"?process.env.VELU_SITE_URL.replace(/\/+$/,""):"",o=Z(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=Y(i),{pageEntries:l}=ae(s,e),c=new Map(l.map(p=>[p.url,p])),u=[];for(let p of ee(s)){if(!p.url)continue;let y=p.ancestors.filter(h=>h.kind==="group").pop(),f=p.ancestors.filter(h=>h.kind==="tab").pop(),g=y?.label||f?.label||"Pages",b=p.ancestors.filter(h=>h.kind==="tab"||h.kind==="group").map(h=>h.label),m=p.ancestors.filter(h=>h.kind==="language").pop()?.code||null;if(p.node?.api){let h=a[p.pagePath];if(!h)continue;let $=h.title||_r(p.url);u.push({url:p.url,title:$,description:h.description||"",group:g,breadcrumb:[...b,$],lang:m,access:en({},p.ancestors),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 $=Fs(h.fileAbsPath),P=$.title||_r(p.url);u.push({url:p.url,title:P,description:$.description||"",group:g,breadcrumb:[...b,P],lang:m,access:en($,p.ancestors),frontmatter:$,source:{kind:"mdx",fileAbsPath:h.fileAbsPath}})}}return{name:r,baseUrl:n,pages:u,navigation:s}}function ut(e){return new Map(e.pages.map(t=>[t.url,{...t.source,title:t.title}]))}async function Is(e){return ut(await we(e))}async function on(e,t,r){let o=(r||await Is(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:Nr(o.segment),contentType:"text/yaml; charset=utf-8",kind:"api"}:null}async function Fr(e,t){let r=t||await we(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(Rs(l.url))})${l.description?`: ${l.description}`:""}`);o.push("")}return o.join(`
198
- `)}async function Ir(e,t){let r=t||await we(e),n=[`# ${r.name}`,"",`> Full documentation \u2014 every page concatenated. Index: ${be}`];for(let o of r.pages)if(n.push("","---","",`# ${o.title}`,`Source: ${o.url}`,""),o.source.kind==="mdx")try{n.push(Us(qe.readFileSync(o.source.fileAbsPath,"utf-8")).trim())}catch{}else o.source.segment&&n.push("```yaml",Nr(o.source.segment).trim(),"```");return n.join(`
202
+ `;return r?e.slice(0,r[0].length)+n+e.slice(r[0].length):n+e}function Zs(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function Qs(e){try{let t=We.readFileSync(e,"utf-8").match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return{};let r=Gr.load(t[1]);return r&&typeof r=="object"?r:{}}catch{return{}}}async function we(e){let t={};try{t=JSON.parse(We.readFileSync(sn.join(e,"velu.json"),"utf-8"))}catch{return{name:sn.basename(e),baseUrl:"",pages:[]}}let r=t.name??sn.basename(e),n=typeof process.env.VELU_SITE_URL=="string"?process.env.VELU_SITE_URL.replace(/\/+$/,""):"",o=Z(t.api),i=t.navigation??{},a={};try{let u=await nt(t.navigation??{},{targetDir:e,api:o});i=u.nav,a=u.ops}catch(u){console.warn(`[velu] openapi: ${u.message}`)}let s=Y(i),{pageEntries:l}=ae(s,e),c=new Map(l.map(u=>[u.url,u])),p=[];for(let u of ee(s)){if(!u.url)continue;let y=u.ancestors.filter(h=>h.kind==="group").pop(),f=u.ancestors.filter(h=>h.kind==="tab").pop(),g=y?.label||f?.label||"Pages",b=u.ancestors.filter(h=>h.kind==="tab"||h.kind==="group").map(h=>h.label),d=u.ancestors.filter(h=>h.kind==="language").pop()?.code||null;if(u.node?.api){let h=a[u.pagePath];if(!h)continue;let $=h.title||qr(u.url);p.push({url:u.url,title:$,description:h.description||"",group:g,breadcrumb:[...b,$],lang:d,access:on(h.operation?.groups?.length?{groups:h.operation.groups}:{},u.ancestors),frontmatter:{title:h.title,description:h.description},source:{kind:"api",segment:h.segment}})}else{let h=c.get(u.url);if(!h||!h.exists)continue;let $=Qs(h.fileAbsPath),P=$.title||qr(u.url);p.push({url:u.url,title:P,description:$.description||"",group:g,breadcrumb:[...b,P],lang:d,access:on($,u.ancestors),frontmatter:$,source:{kind:"mdx",fileAbsPath:h.fileAbsPath}})}}return{name:r,baseUrl:n,pages:p,navigation:s}}function ft(e){return new Map(e.pages.map(t=>[t.url,{...t.source,title:t.title}]))}async function ea(e){return ft(await we(e))}async function cn(e,t,r){let o=(r||await ea(e)).get(t);if(!o)return null;if(o.kind==="mdx")try{return{body:We.readFileSync(o.fileAbsPath,"utf-8"),contentType:"text/markdown; charset=utf-8",kind:"mdx"}}catch{return null}return o.segment?{body:Wr(o.segment),contentType:"text/yaml; charset=utf-8",kind:"api"}:null}async function Kr(e,t){let r=t||await we(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 ${pt} 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(Xs(l.url))})${l.description?`: ${l.description}`:""}`);o.push("")}return o.join(`
203
+ `)}async function Xr(e,t){let r=t||await we(e),n=[`# ${r.name}`,"",`> Full documentation \u2014 every page concatenated. Index: ${be}`];for(let o of r.pages)if(n.push("","---","",`# ${o.title}`,`Source: ${o.url}`,""),o.source.kind==="mdx")try{n.push(Zs(We.readFileSync(o.source.fileAbsPath,"utf-8")).trim())}catch{}else o.source.segment&&n.push("```yaml",Wr(o.source.segment).trim(),"```");return n.join(`
199
204
  `)+`
200
- `}async function Mr(e,t){let r=t||await we(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]||"",f=De(p,"label")||De(p,"date")||"Update",g=De(p,"description")||zs(y)||f,b=De(p,"description"),m=`${n}${s.url}#${Ms(f,b)}`,h=De(p,"date")||f,$=new Date(h),P=Number.isNaN($.getTime())?null:$.toUTCString();o.push({title:f,link:m,description:g,pubDate:P})}}if(!o.length)return null;let i=n||"/",a=o.map(s=>` <item>
205
+ `}async function Yr(e,t){let r=t||await we(e),n=r.baseUrl||"",o=[];for(let s of r.pages){if(s.source.kind!=="mdx")continue;let l="";try{l=We.readFileSync(s.source.fileAbsPath,"utf-8")}catch{continue}let c=/<Update\b([^>]*)>([\s\S]*?)<\/Update>/gi,p;for(;p=c.exec(l);){let u=p[1]||"",y=p[2]||"",f=Ge(u,"label")||Ge(u,"date")||"Update",g=Ge(u,"description")||na(y)||f,b=Ge(u,"description"),d=`${n}${s.url}#${ta(f,b)}`,h=Ge(u,"date")||f,$=new Date(h),P=Number.isNaN($.getTime())?null:$.toUTCString();o.push({title:f,link:d,description:g,pubDate:P})}}if(!o.length)return null;let i=n||"/",a=o.map(s=>` <item>
201
206
  <title>${me(s.title)}</title>
202
207
  <link>${me(s.link)}</link>
203
208
  <guid isPermaLink="true">${me(s.link)}</guid>
@@ -214,12 +219,12 @@ ${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${Lr}
214
219
  `+a+`
215
220
  </channel>
216
221
  </rss>
217
- `}var be,ct,Ns,xe,Lr,_r,me,Ms,De,zs,zr=_(()=>{Pr();re();Me();Fe();Bt();be="/llms.txt",ct="/llms-full.txt",Ns=`<${be}>; rel="llms-txt", <${ct}>; rel="llms-full-txt"`,xe={Link:Ns,"X-Llms-Txt":be},Lr=`Full documentation index: ${be}`;_r=e=>(e.split("/").filter(Boolean).pop()||"Home").replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase());me=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Ms=(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"}`},De=(e,t)=>{let r=e.match(new RegExp(`${t}\\s*=\\s*["']([^"']*)["']`,"i"));return r?r[1]:void 0},zs=e=>String(e||"").replace(/```[\s\S]*?```/g,"").replace(/<[^>]+>/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[#*`_>]/g,"").replace(/\s+/g," ").trim().slice(0,500)});var Hr={};Se(Hr,{startDevServer:()=>na});import Vr from"node:fs/promises";import $e from"node:fs";import Vs from"node:http";import{spawn as Js}from"node:child_process";import W from"node:path";import{fileURLToPath as Bs}from"node:url";import Ds from"chokidar";import sn from"express";import{createServer as qs,createLogger as Gs,searchForWorkspaceRoot as Ws}from"vite";function Ys(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 Br(e,t){let r=Gt(e,{color:!!process.stderr.isTTY});console.error(`
222
+ `}var be,pt,Ys,xe,Dr,qr,me,ta,Ge,na,Zr=L(()=>{Jr();re();Ve();Me();Gt();be="/llms.txt",pt="/llms-full.txt",Ys=`<${be}>; rel="llms-txt", <${pt}>; rel="llms-full-txt"`,xe={Link:Ys,"X-Llms-Txt":be},Dr=`Full documentation index: ${be}`;qr=e=>(e.split("/").filter(Boolean).pop()||"Home").replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase());me=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),ta=(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"}`},Ge=(e,t)=>{let r=e.match(new RegExp(`${t}\\s*=\\s*["']([^"']*)["']`,"i"));return r?r[1]:void 0},na=e=>String(e||"").replace(/```[\s\S]*?```/g,"").replace(/<[^>]+>/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[#*`_>]/g,"").replace(/\s+/g," ").trim().slice(0,500)});var so={};Se(so,{startDevServer:()=>va});import Qr from"node:fs/promises";import $e from"node:fs";import ra from"node:http";import{spawn as oa}from"node:child_process";import W from"node:path";import{fileURLToPath as ia}from"node:url";import sa from"chokidar";import un from"express";import{createServer as aa,createLogger as la,searchForWorkspaceRoot as ca}from"vite";function ma(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 to(e,t){let r=Xt(e,{color:!!process.stderr.isTTY});console.error(`
218
223
  `+r+`
219
- `),process.env.VELU_DEBUG&&t&&console.error(t)}function Dr(){try{return JSON.parse($e.readFileSync(W.join(pt,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function Zs(e,t){let r=W.resolve(e,".velu"),n=W.resolve(r,".velu-version"),o=null;try{o=$e.readFileSync(n,"utf8").trim()}catch{}if(o!==t){if(o!==null)try{$e.rmSync(W.join(r,"vite-cache"),{recursive:!0,force:!0}),console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026")}catch{}try{$e.mkdirSync(r,{recursive:!0}),$e.writeFileSync(n,t)}catch{}}}async function qr(e){try{return await Yn(e)}catch{return Ft({},W.basename(e))}}async function Gr(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&&Ks.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(`
220
- `)}function ta(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=Js(process.execPath,["-e",ea],{stdio:["ignore","inherit","ignore"]}),y.on("error",()=>{})}catch{}let f=()=>{if(y){try{y.kill()}catch{}y=null}};return process.once("exit",f),{ready:g=>{f(),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 na(e){let t=!!process.env.VELU_PROFILE,r=performance.now(),n=(O,x)=>t&&console.log(`[velu-profile] ${O}: ${(performance.now()-x).toFixed(0)}ms`),o=ta(!!process.stdout.isTTY&&!t,W.basename(e),Dr()),i=await qr(e),a=l(),s=ze(e);function l(){let x=at(e).filter(A=>A.severity==="error"&&(A.category==="config-json"||A.category==="config-schema"));return x.length&&console.error(`
221
- `+it(x,{color:!!process.stderr.isTTY})+`
222
- `),x}let c=e;try{c=$e.realpathSync(e)}catch{}let u=0,p=O=>{let x=performance.now();if(x-u<500)return;u=x;let A=Ve(O,{projectDir:c,knownComponents:ne});Br(A,O)};process.on("unhandledRejection",p),process.on("uncaughtException",p);let y=Number(process.env.PORT)||8358,f=await Zt();Zs(e,Dr());let g=sn(),b=Vs.createServer(g),m=Gs(t?"info":"warn"),h=O=>typeof O=="string"&&O.includes("Failed to load source map"),$=m.warn.bind(m),P=m.warnOnce.bind(m);m.warn=(O,x)=>{h(O)||$(O,x)},m.warnOnce=(O,x)=>{h(O)||P(O,x)};let E=await qs({...Ar({targetDir:e,VITE_ROOT:pt,validateProps:f}),appType:"custom",logLevel:t?"info":"warn",customLogger:m,server:{middlewareMode:!0,fs:{allow:[Ws(pt),e,c]},hmr:{server:b}}});n("vite server created",r),g.get(new RegExp(`^${tt}/`),(O,x,A)=>{let k=dr(s,O.path);if(!k)return A();x.sendFile(k.abs,U=>{U&&x.status(404).end()})}),g.use(E.middlewares);let T=W.join(e,"public");g.use(sn.static(T)),g.get(new RegExp(`^${Nt}(\\.[a-z0-9]+)?$`,"i"),async(O,x)=>{if(!i.favicon)return x.status(404).end();let A=W.resolve(e,i.favicon.replace(/^\//,""));x.sendFile(A,k=>{k&&x.status(404).end()})});let S=O=>(x,A)=>{let k=i.logo?.[O];if(!k)return A.status(404).end();A.sendFile(W.resolve(e,k.replace(/^\//,"")),U=>{U&&A.status(404).end()})};g.get(new RegExp(`^${Re}(\\.[a-z0-9]+)?$`,"i"),S("light")),g.get(new RegExp(`^${Ne}(\\.[a-z0-9]+)?$`,"i"),S("dark")),g.post("/@velu-api-proxy",sn.json({limit:"8mb"}),async(O,x)=>{let{method:A="GET",url:k,headers:U={},body:R}=O.body||{};if(typeof k!="string"||!/^https?:\/\//i.test(k))return x.status(400).json({error:"A valid http(s) target URL is required."});try{let N=await fetch(k,{method:A,headers:U,body:R!=null&&R!==""?R:void 0}),D=await N.text(),d=N.headers.get("content-type")||"",v={};N.headers.forEach((C,V)=>{v[V]=C});let j=D;if(/json/i.test(d))try{j=JSON.parse(D)}catch{}x.json({status:N.status,statusText:N.statusText,headers:v,body:j})}catch(N){x.json({error:`Request failed: ${N.message}`})}});let w=null,L=async()=>w||=await we(e);g.get(/\.md$/i,async(O,x,A)=>{try{let k=await L(),U=await on(e,Ur(decodeURIComponent(O.path)),ut(k));if(!U)return A();x.status(200).set({"Content-Type":U.contentType,...xe}).end(rn(U.body,U.kind))}catch{A()}}),g.get(be,async(O,x,A)=>{try{let k=await Fr(e,await L());x.status(200).set({"Content-Type":"text/plain; charset=utf-8",...xe}).end(k)}catch{A()}}),g.get(ct,async(O,x,A)=>{try{let k=await Ir(e,await L());x.status(200).set({"Content-Type":"text/plain; charset=utf-8",...xe}).end(k)}catch{A()}}),g.get("/rss.xml",async(O,x,A)=>{try{let k=await Mr(e,await L());if(!k)return A();x.status(200).set({"Content-Type":"application/rss+xml; charset=utf-8"}).end(k)}catch{A()}}),g.use("*",async(O,x,A)=>{let k=O.originalUrl,U=performance.now();if(/text\/markdown/i.test(O.headers.accept||""))try{let R=await L(),N=await on(e,bt(k),ut(R));if(N)return x.status(200).set({"Content-Type":N.contentType,...xe}).end(rn(N.body,N.kind))}catch{}if(a.length)return x.status(200).set({"Content-Type":"text/html"}).end(Kt(a,{title:"Fix velu.json to continue"}));try{let R=performance.now(),N=await Vr.readFile(Wr,"utf-8");N=await E.transformIndexHtml(k,N),n(`transformIndexHtml ${k}`,R);let D="/src/runtime/server-entry.jsx";R=performance.now();let{render:d}=await E.ssrLoadModule(D);n(`ssrLoadModule ${k} (1st req includes dep pre-bundle)`,R),R=performance.now();let v=await d(k);n(`render ${k}`,R),R=performance.now();let j=await Gr(E,D);n(`collectSsrCss ${k}`,R);let C=j?`<style data-velu-ssr>${j}</style>`:"",V=`<style data-velu-config>
223
- ${Zn(i)}
224
- </style>`,ie=Xs.has(i.font.family)?"":Ys(i.font.family),q=Xn(i),se=q?`<link rel="icon"${q.type?` type="${q.type}"`:""} href="${q.url}" />`:"",dt=gr(s),to=[C,V,ie,se,dt].filter(Boolean).join(`
225
- `),no=N.replace('<html lang="en">',`<html lang="en" data-current-path="${Jr(bt(k))}">`).replace("<!--app-title-->",Jr(i.name)).replace("<!--app-head-->",to).replace("<!--app-html-->",v);x.status(200).set({"Content-Type":"text/html",...xe}).end(no),n(`TOTAL ${k}`,U)}catch(R){E.ssrFixStacktrace(R);let N=Ve(R,{projectDir:c,knownComponents:ne});if(/failed to load url|does the file exist|cannot find module|ERR_MODULE_NOT_FOUND/i.test(String(R&&R.message))){try{E.moduleGraph.invalidateAll()}catch{}N.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."}Br(N,R),x.status(200).set({"Content-Type":"text/html"}).end(Kt([N]))}}),Ds.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(O,x)=>{console.log(`[velu-cli] content ${O}: ${W.relative(e,x)}`);let A=W.basename(x)==="velu.json",k=x.endsWith(".mdx"),U=/\.(css|js)$/i.test(x),R=!1;if(U){let d=j=>j.scripts.some(C=>C.abs===x),v=d(s);s=ze(e),R=v||d(s)}let N=/\.(ya?ml|json)$/i.test(x),D=A||N||k&&(O==="add"||O==="unlink")||R;if((D||k||/\.(ya?ml|json)$/i.test(x))&&(w=null),A&&(i=await qr(e),a=l()),D)E.moduleGraph.invalidateAll();else if(k){let d=x.split(W.sep).join("/"),v=E.moduleGraph.getModulesByFile(d);if(v)for(let j of v)E.moduleGraph.invalidateModule(j)}E.ws.send({type:"full-reload"})});async function F(O){let x=new Set,A=12,k=0,U=[],R=()=>k<A?(k+=1,Promise.resolve()):new Promise(v=>U.push(v)).then(()=>{k+=1}),N=()=>{k-=1,U.shift()?.()},D=v=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(v)||/[\\/]node_modules[\\/]/.test(v)&&!/velu-ui/.test(v);async function d(v){if(!(!v||x.has(v)||D(v))){x.add(v);try{await R();try{await E.transformRequest(v,{ssr:!1})}finally{N()}let j=await E.moduleGraph.getModuleByUrl(v,!1);j?.importedModules?.size&&await Promise.all([...j.importedModules].map(C=>d(C.url)))}catch{}}}return await d(O),x.size}b.listen(y,async()=>{let O=performance.now(),x=0;try{let{render:A}=await E.ssrLoadModule("/src/runtime/server-entry.jsx");await F("/src/runtime/client-entry.jsx"),typeof E.waitForRequestsIdle=="function"&&await E.waitForRequestsIdle();let[k]=await Promise.allSettled([F("/src/runtime/client-entry.jsx"),A("/"),E.transformIndexHtml("/",await Vr.readFile(Wr,"utf-8")),Gr(E,"/src/runtime/server-entry.jsx")]).then(U=>U.map(R=>R.status==="fulfilled"?R.value:0));x=k}catch(A){t&&console.log("[velu-profile] warmup error:",A?.message)}n(`cold-start warm-up (${x} client modules)`,O),o.ready(`http://localhost:${y}`)})}var Hs,Ks,Xs,Jr,pt,Wr,Qs,ea,Kr=_(()=>{Fe();Or();Ht();Tr();pe();We();Yt();Qt();zr();re();Dt();Hs=W.dirname(Bs(import.meta.url)),Ks=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,Xs=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),Jr=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");pt=W.resolve(Hs,".."),Wr=W.resolve(pt,"src","template.html"),Qs=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],ea="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 Yr={};Se(Yr,{default:()=>sa,runValidate:()=>Xr});import ra from"node:fs";import oa from"node:path";function ia(e){try{let t=JSON.parse(ra.readFileSync(oa.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let r=Y(t.navigation);return ae(r,e).pageEntries}catch{return[]}}async function Xr(e){let t=at(e),r=ia(e),n=await Cr(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 sa,Zr=_(()=>{re();Me();Yt();Qt();pe();sa=Xr});import ft from"node:path";import B from"node:process";import{readFileSync as aa}from"node:fs";var[,,Qr,mt]=B.argv;function eo(){try{return JSON.parse(aa(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function la(){let e=B.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 ca(){switch(Qr){case"--version":case"-v":case"version":{console.log(eo());break}case"init":{mt||(console.error("Usage: velu init <project-name>"),B.exit(1));let e=mt,t=ft.resolve(B.cwd(),e),{initProject:r}=await Promise.resolve().then(()=>(cn(),ln));await r(t,e);break}case"migrate":{let{runMigrate:e}=await Promise.resolve().then(()=>(Jn(),Vn));B.exitCode=await e(B.argv.slice(3),eo());break}case"dev":{let{maybeAutoUpdate:e}=await Promise.resolve().then(()=>(Rt(),_t));await e();let t=ft.resolve(B.cwd(),mt??"."),{startDevServer:r}=await Promise.resolve().then(()=>(Kr(),Hr));await r(t);break}case"update":{let{updateCommand:e}=await Promise.resolve().then(()=>(Rt(),_t));await e();break}case"validate":{let e=ft.resolve(B.cwd(),mt??"."),{runValidate:t}=await Promise.resolve().then(()=>(Zr(),Yr)),r=await t(e);B.exit(r);break}case"build":{let e=ft.resolve(B.cwd(),la()??"."),t=B.argv.indexOf("--out"),r=t>-1?B.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."),B.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"),B.exit(Qr?1:0)}}ca().catch(e=>{console.error(B.env.VELU_DEBUG?e:`Error: ${e.message}`),B.exit(1)});
224
+ `),process.env.VELU_DEBUG&&t&&console.error(t)}function no(){try{return JSON.parse($e.readFileSync(W.join(mt,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function da(e,t){let r=W.resolve(e,".velu"),n=W.resolve(r,".velu-version"),o=null;try{o=$e.readFileSync(n,"utf8").trim()}catch{}if(o!==t){if(o!==null)try{$e.rmSync(W.join(r,"vite-cache"),{recursive:!0,force:!0}),console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026")}catch{}try{$e.mkdirSync(r,{recursive:!0}),$e.writeFileSync(n,t)}catch{}}}async function ro(e){try{return await ar(e)}catch{return zt({},W.basename(e))}}async function oo(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&&pa.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(`
225
+ `)}function ya(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",p="\x1B[0m",u="\x1B[2m";console.log("");for(let g of ga)console.log(`${c}${g}${p}`);l&&console.log(` ${u}${l}${p}`),console.log("");let y=null;try{y=oa(process.execPath,["-e",ha],{stdio:["ignore","inherit","ignore"]}),y.on("error",()=>{})}catch{}let f=()=>{if(y){try{y.kill()}catch{}y=null}};return process.once("exit",f),{ready:g=>{f(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${p} Velu${l?" "+l:""} ready \u2192 \x1B[36m${g}${p}`),s(),n()}}}async function va(e){let t=!!process.env.VELU_PROFILE,r=performance.now(),n=(O,x)=>t&&console.log(`[velu-profile] ${O}: ${(performance.now()-x).toFixed(0)}ms`),o=ya(!!process.stdout.isTTY&&!t,W.basename(e),no()),i=await ro(e),a=l(),s=Be(e);function l(){let x=ct(e).filter(A=>A.severity==="error"&&(A.category==="config-json"||A.category==="config-schema"));return x.length&&console.error(`
226
+ `+at(x,{color:!!process.stderr.isTTY})+`
227
+ `),x}let c=e;try{c=$e.realpathSync(e)}catch{}let p=0,u=O=>{let x=performance.now();if(x-p<500)return;p=x;let A=Je(O,{projectDir:c,knownComponents:ne});to(A,O)};process.on("unhandledRejection",u),process.on("uncaughtException",u);let y=Number(process.env.PORT)||8358,f=await nn();da(e,no());let g=un(),b=ra.createServer(g),d=la(t?"info":"warn"),h=O=>typeof O=="string"&&O.includes("Failed to load source map"),$=d.warn.bind(d),P=d.warnOnce.bind(d);d.warn=(O,x)=>{h(O)||$(O,x)},d.warnOnce=(O,x)=>{h(O)||P(O,x)};let E=await aa({...Ir({targetDir:e,VITE_ROOT:mt,validateProps:f}),appType:"custom",logLevel:t?"info":"warn",customLogger:d,server:{middlewareMode:!0,fs:{allow:[ca(mt),e,c]},hmr:{server:b}}});n("vite server created",r),g.get(new RegExp(`^${rt}/`),(O,x,A)=>{let k=kr(s,O.path);if(!k)return A();x.sendFile(k.abs,U=>{U&&x.status(404).end()})}),g.use(E.middlewares);let T=W.join(e,"public");g.use(un.static(T)),g.get(new RegExp(`^${It}(\\.[a-z0-9]+)?$`,"i"),async(O,x)=>{if(!i.favicon)return x.status(404).end();let A=W.resolve(e,i.favicon.replace(/^\//,""));x.sendFile(A,k=>{k&&x.status(404).end()})});let S=O=>(x,A)=>{let k=i.logo?.[O];if(!k)return A.status(404).end();A.sendFile(W.resolve(e,k.replace(/^\//,"")),U=>{U&&A.status(404).end()})};g.get(new RegExp(`^${Ue}(\\.[a-z0-9]+)?$`,"i"),S("light")),g.get(new RegExp(`^${Fe}(\\.[a-z0-9]+)?$`,"i"),S("dark")),g.post("/@velu-api-proxy",un.json({limit:"8mb"}),async(O,x)=>{let{method:A="GET",url:k,headers:U={},body:R}=O.body||{};if(typeof k!="string"||!/^https?:\/\//i.test(k))return x.status(400).json({error:"A valid http(s) target URL is required."});try{let N=await fetch(k,{method:A,headers:U,body:R!=null&&R!==""?R:void 0}),q=await N.text(),m=N.headers.get("content-type")||"",v={};N.headers.forEach((C,B)=>{v[B]=C});let j=q;if(/json/i.test(m))try{j=JSON.parse(q)}catch{}x.json({status:N.status,statusText:N.statusText,headers:v,body:j})}catch(N){x.json({error:`Request failed: ${N.message}`})}});let w=null,_=async()=>w||=await we(e);g.get(/\.md$/i,async(O,x,A)=>{try{let k=await _(),U=await cn(e,Hr(decodeURIComponent(O.path)),ft(k));if(!U)return A();x.status(200).set({"Content-Type":U.contentType,...xe}).end(ln(U.body,U.kind))}catch{A()}}),g.get(be,async(O,x,A)=>{try{let k=await Kr(e,await _());x.status(200).set({"Content-Type":"text/plain; charset=utf-8",...xe}).end(k)}catch{A()}}),g.get(pt,async(O,x,A)=>{try{let k=await Xr(e,await _());x.status(200).set({"Content-Type":"text/plain; charset=utf-8",...xe}).end(k)}catch{A()}}),g.get("/rss.xml",async(O,x,A)=>{try{let k=await Yr(e,await _());if(!k)return A();x.status(200).set({"Content-Type":"application/rss+xml; charset=utf-8"}).end(k)}catch{A()}}),g.use("*",async(O,x,A)=>{let k=O.originalUrl,U=performance.now();if(/text\/markdown/i.test(O.headers.accept||""))try{let R=await _(),N=await cn(e,xt(k),ft(R));if(N)return x.status(200).set({"Content-Type":N.contentType,...xe}).end(ln(N.body,N.kind))}catch{}if(a.length)return x.status(200).set({"Content-Type":"text/html"}).end(Qt(a,{title:"Fix velu.json to continue"}));try{let R=performance.now(),N=await Qr.readFile(io,"utf-8");N=await E.transformIndexHtml(k,N),n(`transformIndexHtml ${k}`,R);let q="/src/runtime/server-entry.jsx";R=performance.now();let{render:m}=await E.ssrLoadModule(q);n(`ssrLoadModule ${k} (1st req includes dep pre-bundle)`,R),R=performance.now();let v=await m(k);n(`render ${k}`,R),R=performance.now();let j=await oo(E,q);n(`collectSsrCss ${k}`,R);let C=j?`<style data-velu-ssr>${j}</style>`:"",B=`<style data-velu-config>
228
+ ${lr(i)}
229
+ </style>`,ie=fa.has(i.font.family)?"":ma(i.font.family),V=sr(i),se=V?`<link rel="icon"${V.type?` type="${V.type}"`:""} href="${V.url}" />`:"",ht=jr(s),mo=[C,B,ie,se,ht].filter(Boolean).join(`
230
+ `),go=N.replace('<html lang="en">',`<html lang="en" data-current-path="${eo(xt(k))}">`).replace("<!--app-title-->",eo(i.name)).replace("<!--app-head-->",mo).replace("<!--app-html-->",v);x.status(200).set({"Content-Type":"text/html",...xe}).end(go),n(`TOTAL ${k}`,U)}catch(R){E.ssrFixStacktrace(R);let N=Je(R,{projectDir:c,knownComponents:ne});if(/failed to load url|does the file exist|cannot find module|ERR_MODULE_NOT_FOUND/i.test(String(R&&R.message))){try{E.moduleGraph.invalidateAll()}catch{}N.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."}to(N,R),x.status(200).set({"Content-Type":"text/html"}).end(Qt([N]))}}),sa.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(O,x)=>{console.log(`[velu-cli] content ${O}: ${W.relative(e,x)}`);let A=W.basename(x)==="velu.json",k=x.endsWith(".mdx"),U=/\.(css|js)$/i.test(x),R=!1;if(U){let m=j=>j.scripts.some(C=>C.abs===x),v=m(s);s=Be(e),R=v||m(s)}let N=/\.(ya?ml|json)$/i.test(x),q=A||N||k&&(O==="add"||O==="unlink")||R;if((q||k||/\.(ya?ml|json)$/i.test(x))&&(w=null),A&&(i=await ro(e),a=l()),q)E.moduleGraph.invalidateAll();else if(k){let m=x.split(W.sep).join("/"),v=E.moduleGraph.getModulesByFile(m);if(v)for(let j of v)E.moduleGraph.invalidateModule(j)}E.ws.send({type:"full-reload"})});async function F(O){let x=new Set,A=12,k=0,U=[],R=()=>k<A?(k+=1,Promise.resolve()):new Promise(v=>U.push(v)).then(()=>{k+=1}),N=()=>{k-=1,U.shift()?.()},q=v=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(v)||/[\\/]node_modules[\\/]/.test(v)&&!/velu-ui/.test(v);async function m(v){if(!(!v||x.has(v)||q(v))){x.add(v);try{await R();try{await E.transformRequest(v,{ssr:!1})}finally{N()}let j=await E.moduleGraph.getModuleByUrl(v,!1);j?.importedModules?.size&&await Promise.all([...j.importedModules].map(C=>m(C.url)))}catch{}}}return await m(O),x.size}b.listen(y,async()=>{let O=performance.now(),x=0;try{let{render:A}=await E.ssrLoadModule("/src/runtime/server-entry.jsx");await F("/src/runtime/client-entry.jsx"),typeof E.waitForRequestsIdle=="function"&&await E.waitForRequestsIdle();let[k]=await Promise.allSettled([F("/src/runtime/client-entry.jsx"),A("/"),E.transformIndexHtml("/",await Qr.readFile(io,"utf-8")),oo(E,"/src/runtime/server-entry.jsx")]).then(U=>U.map(R=>R.status==="fulfilled"?R.value:0));x=k}catch(A){t&&console.log("[velu-profile] warmup error:",A?.message)}n(`cold-start warm-up (${x} client modules)`,O),o.ready(`http://localhost:${y}`)})}var ua,pa,fa,eo,mt,io,ga,ha,ao=L(()=>{Me();Mr();Zt();Vr();pe();He();tn();rn();Zr();re();Wt();ua=W.dirname(ia(import.meta.url)),pa=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,fa=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),eo=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");mt=W.resolve(ua,".."),io=W.resolve(mt,"src","template.html"),ga=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],ha="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 co={};Se(co,{default:()=>$a,runValidate:()=>lo});import ba from"node:fs";import xa from"node:path";function wa(e){try{let t=JSON.parse(ba.readFileSync(xa.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let r=Y(t.navigation);return ae(r,e).pageEntries}catch{return[]}}async function lo(e){let t=ct(e),r=wa(e),n=await Br(e,r),o=[...t,...n],i=!!process.stdout.isTTY;return console.log(at(o,{color:i})),o.some(s=>s.severity!=="warning"&&s.severity!=="info")?1:0}var $a,uo=L(()=>{re();Ve();tn();rn();pe();$a=lo});import dt from"node:path";import D from"node:process";import{readFileSync as Sa}from"node:fs";var[,,po,gt]=D.argv;function fo(){try{return JSON.parse(Sa(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function ka(){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 ja(){switch(po){case"--version":case"-v":case"version":{console.log(fo());break}case"init":{gt||(console.error("Usage: velu init <project-name>"),D.exit(1));let e=gt,t=dt.resolve(D.cwd(),e),{initProject:r}=await Promise.resolve().then(()=>(mn(),fn));await r(t,e);break}case"migrate":{let{runMigrate:e}=await Promise.resolve().then(()=>(Zn(),Yn));D.exitCode=await e(D.argv.slice(3),fo());break}case"dev":{let{maybeAutoUpdate:e}=await Promise.resolve().then(()=>(Ft(),Ut));await e();let t=dt.resolve(D.cwd(),gt??"."),{startDevServer:r}=await Promise.resolve().then(()=>(ao(),so));await r(t);break}case"update":{let{updateCommand:e}=await Promise.resolve().then(()=>(Ft(),Ut));await e();break}case"validate":{let e=dt.resolve(D.cwd(),gt??"."),{runValidate:t}=await Promise.resolve().then(()=>(uo(),co)),r=await t(e);D.exit(r);break}case"build":{let e=dt.resolve(D.cwd(),ka()??"."),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(po?1:0)}}ja().catch(e=>{console.error(D.env.VELU_DEBUG?e:`Error: ${e.message}`),D.exit(1)});