@veluai/velu 0.2.43 → 0.2.45

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 Zr=Object.defineProperty;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var $e=(e,t)=>{for(var r in t)Zr(e,r,{get:t[r],enumerable:!0})};var an={};$e(an,{initProject:()=>no});import me from"node:fs/promises";import de from"node:path";import{fileURLToPath as Qr}from"node:url";async function no(e,t){try{if((await me.readdir(e)).length>0)throw new Error(`Directory "${t}" already exists and is not empty. Choose a different name or remove the folder first.`)}catch(i){if(i.code!=="ENOENT")throw i}await me.mkdir(e,{recursive:!0}),await me.cp(to,e,{recursive:!0});let r=de.join(e,"velu.json"),n=JSON.parse(await me.readFile(r,"utf-8"));n.name=t,await me.writeFile(r,JSON.stringify(n,null,2)+`
3
- `,"utf-8");let o=await sn(e);console.log(`[velu] created ${t}/`);for(let i of o)console.log(` ${i}`);console.log(""),console.log("Next steps:"),console.log(` cd ${t}`),console.log(" velu dev")}async function sn(e,t=e,r=[]){let n=await me.readdir(e,{withFileTypes:!0});for(let o of n){let i=de.join(e,o.name);o.isDirectory()?await sn(i,t,r):r.push(de.relative(t,i).split(de.sep).join("/"))}return r.sort()}var eo,to,ln=_(()=>{eo=de.dirname(Qr(import.meta.url)),to=de.resolve(eo,"..","templates","starter")});import Se from"node:fs";import K from"node:path";import{fileURLToPath as ro}from"node:url";import{parse as oo,printParseErrorCode as io}from"jsonc-parser";import so from"js-yaml";function le(e,t){let r=K.relative(e,t);return r===""||!r.startsWith(`..${K.sep}`)&&r!==".."&&!K.isAbsolute(r)}function ht(e,t){let r=[],n=oo(e.replace(/^\uFEFF/,""),r,{allowTrailingComma:!0});if(r.length)throw new Error(`${t}: ${io(r[0].error)} at offset ${r[0].offset}`);return n}function cn(e,t){let r=Se.realpathSync(e);function n(i,a=[]){if(!le(r,Se.realpathSync(i)))throw new Error("Config reference escapes the source directory.");if(a.includes(i))throw new Error(`Circular config reference: ${gt(K.relative(e,i))}`);if(a.length>50)throw new Error("Config reference nesting exceeds 50 levels.");let s=Se.readFileSync(i,"utf8"),l=/\.ya?ml$/i.test(i)?so.load(s):ht(s,K.basename(i));function c(u){if(Array.isArray(u))return u.map(c);if(!W(u))return u;if(typeof u.$ref=="string"){if(!/^\.\.?\//.test(u.$ref)||/[#?]/.test(u.$ref))throw new Error(`Config $ref must be a local JSON/YAML file without a fragment: ${u.$ref}`);let p=K.resolve(K.dirname(i),u.$ref);if(!le(e,p))throw new Error("Config reference escapes the source directory.");let y=n(p,[...a,i]),m=Object.fromEntries(Object.entries(u).filter(([g])=>g!=="$ref").map(([g,v])=>[g,c(v)]));if(Object.keys(m).length&&!W(y))throw new Error("Config $ref siblings require an object reference.");return W(y)?{...y,...m}:y}return Object.fromEntries(Object.entries(u).map(([p,y])=>[p,c(y)]))}return c(l)}let o=n(K.join(e,t));if(!W(o))throw new Error(`${t} must contain an object.`);return o}function ao(e,t){let r=e.navigation||[],n=e.tabs||[];if(!Array.isArray(r)||!Array.isArray(n))throw new Error("Legacy navigation and tabs must be arrays.");function o(a,s,l){return a.flatMap(c=>{if(typeof c=="string"){let p=c.replace(/^\//,"");return(s?p===s||p.startsWith(s+"/"):!l.some(m=>p===m||p.startsWith(m+"/")))?[c]:[]}if(!W(c))return[];let u=o(c.pages||[],s,l);return u.length?[{...c,pages:u}]:[]})}let i={groups:r};if(n.length){let a=n.filter(c=>c.url&&!/^https?:/.test(c.url)).map(c=>c.url.replace(/^\/+|\/+$/g,"")),s=n.map(c=>{if(/^https?:/.test(c.url||""))return{tab:c.name,href:c.url,...c.icon?{icon:c.icon}:{}};let u=(c.url||"").replace(/^\/+|\/+$/g,"");return{tab:c.name,...c.icon?{icon:c.icon}:{},groups:o(r,u,a)}}),l=o(r,"",a);l.length&&!n.some(c=>!c.url||c.url==="/")&&s.unshift({tab:"Documentation",groups:l}),i={tabs:s}}return Array.isArray(e.anchors)&&(i.anchors=e.anchors.map(({name:a,url:s,...l})=>({...l,anchor:a,href:s}))),e.versions&&t("legacy-versions","warning","versions","Legacy version filtering needs review; all groups are retained. Convert version-specific groups to navigation.versions."),i}function un(e,t,r){let n=structuredClone(e);if(n.theme==="sequoia"&&(n.theme="vepa",n.contextual==null&&(n.contextual={options:[]})),n.theme==="mint"&&(n.theme="thulir",n.contextual==null&&(n.contextual={options:[]})),n.theme==="maple"&&(n.theme="aalam",n.contextual==null&&(n.contextual={options:[]})),n.theme==="aspen"&&(n.theme="nila",n.contextual==null&&(n.contextual={options:[]})),n.theme==="luma"&&(n.theme="kadhir"),n.theme&&!["velu","vepa","thulir","aalam","nila","kadhir"].includes(n.theme)&&(r("unsupported-config","warning","theme","This theme has no Velu preset; original setting preserved in source config."),delete n.theme),t==="mint.json"||Array.isArray(n.navigation)){if(n.navigation=ao(n,r),n.topbarLinks&&(n.navbar={...n.navbar,links:n.topbarLinks.map(({name:p,...y})=>({...y,label:p}))}),n.topbarCta){let{name:p,...y}=n.topbarCta;p&&!y.label&&(y.label=p),n.navbar={...n.navbar,primary:y}}n.footerSocials&&(n.footer={...n.footer,socials:n.footerSocials}),n.modeToggle&&r("appearance","warning","modeToggle","Set the initial theme and theme-switcher behavior manually in Velu."),typeof n.api?.baseUrl=="string"&&(n.api.server=n.api.baseUrl),n.api?.request?.example?.languages&&(n.api.examples={languages:n.api.request.example.languages});for(let p of["tabs","anchors","topbarLinks","topbarCta","footerSocials","modeToggle"])delete n[p];n.api&&(delete n.api.baseUrl,delete n.api.request)}if(n.fonts&&!n.font){let p=n.fonts.family||n.fonts.body?.family;p&&(n.font={family:p}),r("fonts","warning","fonts","Body font family migrated where available; custom font sources, weights, and heading fonts need review."),delete n.fonts}W(n.favicon)&&(n.favicon=n.favicon.light||n.favicon.dark,r("favicon-theme","warning","favicon","Velu uses one favicon; selected the light variant when available.")),W(n.logo)&&(n.logo.light??=n.logo.dark,n.logo.dark??=n.logo.light);function o(p,y="navigation"){if(Array.isArray(p))return p.map((g,v)=>o(g,`${y}[${v}]`));if(!W(p))return p;let m={...p};if(Array.isArray(m.dropdowns)&&!m.products&&!m.tabs&&(m.tabs=m.dropdowns.map(({dropdown:g,...v})=>({tab:g,...v})),delete m.dropdowns,r("navigation-dropdowns","warning",y,"Dropdowns converted to tabs. Check navigation layout and URLs.")),m.global){for(let g of["anchors","tabs"])Array.isArray(m.global[g])&&(m[g]=[...m[g]||[],...m.global[g]]);r("navigation-global","warning",`${y}.global`,"Global anchors/tabs merged into this container. Review switcher visibility; other global entries remain in the original config."),delete m.global}W(m.icon)&&typeof m.icon.name=="string"&&(m.icon=m.icon.name,r("icon-library","warning",`${y}.icon`,"Icon name retained; check its equivalent in Velu\u2019s Lucide icon library.")),W(m.openapi)&&typeof m.openapi.source=="string"&&(r("openapi-options","warning",`${y}.openapi`,"OpenAPI source retained; generation options need review."),m.openapi=m.openapi.source);for(let[g,v]of Object.entries(m))g==="pages"&&Array.isArray(v)?m[g]=v.map((d,h)=>typeof d=="string"?d.replace(/\.(mdx|md)$/i,""):o(d,`${y}.pages[${h}]`)):(W(v)||Array.isArray(v))&&(m[g]=o(v,`${y}.${g}`));return m}n.navigation=o(n.navigation||{}),(n.navigation.products||n.navigation.versions||n.navigation.languages)&&(n.navigation.preservePagePaths=!0),typeof n.description=="string"&&(n.seo={...n.seo,metatags:{description:n.description,...n.seo?.metatags}},delete n.description),n.$schema="https://veludocs.com/velu.schema.json";let i=K.dirname(ro(import.meta.url)),a=[K.resolve(i,"../../schema/velu.schema.json"),K.resolve(i,"../schema/velu.schema.json")].find(p=>Se.existsSync(p));if(!a)throw new Error("Velu config schema is missing from this installation.");let s=JSON.parse(Se.readFileSync(a,"utf8")),l=p=>p.$ref?p.$ref.split("/").slice(1).reduce((y,m)=>y[m],s):p,c=p=>Array.isArray(p)?"array":p===null?"null":typeof p;function u(p,y,m){let g=l(y);if(g.oneOf&&(g=g.oneOf.map(l).find(v=>v.type&&c(p)!==v.type||v.properties?.type?.const&&p?.type!==v.properties.type.const?!1:Array.isArray(v.required)&&v.required.length&&W(p)?v.required.every(d=>Object.prototype.hasOwnProperty.call(p,d)):!0),!g)){r("config-shape","error",m,"Value does not match any supported Velu shape; original retained in source config.");return}if(g.type&&c(p)!==g.type||g.enum&&!g.enum.includes(p)||"const"in g&&p!==g.const){r("config-value","error",m,"Unsupported value or type; original retained in source config.");return}if(typeof p=="string"&&g.minLength&&p.length<g.minLength&&r("config-value","error",m,"Value must not be empty."),W(p)){let v={};for(let[d,h]of Object.entries(p)){let S=m?`${m}.${d}`:d,O=g.properties?.[d]||(W(g.additionalProperties)?g.additionalProperties:null);if(!O&&g.additionalProperties===!1){let x=/(^|\.)(auth|authentication|groups|hidden|public|permissions|personalization)(\.|$)/.test(S);r("unsupported-config",x?"error":"warning",S,x?"Access or visibility rules require manual migration before publishing.":"No equivalent in the Velu schema; original setting preserved in source config.");continue}let A=O?u(h,O,S):h;A!==void 0&&Object.defineProperty(v,d,{value:A,enumerable:!0,writable:!0,configurable:!0})}for(let d of g.required||[])d in v||r("required-config","error",m?`${m}.${d}`:d,"Required Velu setting is missing.");return v}return Array.isArray(p)&&g.items?(g.maxItems&&p.length>g.maxItems&&r("config-limit","warning",m,`Velu supports up to ${g.maxItems} entries here; review rendering.`),p.map((v,d)=>u(v,g.items,`${m}[${d}]`)).filter(v=>v!==void 0)):p}return u(n,s,"")}var W,gt,Ge=_(()=>{W=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),gt=e=>e.split(K.sep).join("/")});var te,We=_(()=>{te=["Callout","Card","CardGroup","Accordion","AccordionGroup","Columns","Field","Prompt","Steps","Step","Tree","Folder","File","Update","Icon","Image","CodeBlock","CodeGroup","MethodBadge","ApiPath","TryItBar","ApiField","ApiClient","ApiSidebar"]});import q from"node:path";import{createProcessor as lo,compile as co}from"@mdx-js/mdx";import pn from"remark-frontmatter";import uo from"remark-mdx-frontmatter";import fn from"remark-gfm";import{visit as mn}from"unist-util-visit";import po from"js-yaml";import{parse as fo}from"@babel/parser";import mo from"postcss";async function dn(e,t,r,n,{endpointConverted:o=!1}={}){let i=lo({remarkPlugins:[pn,fn]}),a;try{a=i.parse(e)}catch(d){return n("mdx-syntax","error",t,d.reason||d.message,d.line),{text:e,adapters:[]}}let s=new Set,l=[],c=[],u=new Set,p=new Set,y=new Set,m=(d,h,S)=>c.push({start:d,end:h,value:S});mn(a,"mdxjsEsm",d=>{for(let h of d.data?.estree?.body||[]){if(h.type==="ImportDeclaration"){for(let O of h.specifiers)s.add(O.local.name);l.push({node:d,stmt:h})}let S=h.declaration;S?.id?.name&&s.add(S.id.name);for(let O of S?.declarations||[])O.id?.name&&s.add(O.id.name)}});let g=(d,h=!1)=>{if(typeof d!="string"||/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(d)||h&&!d.startsWith(".")&&!d.startsWith("/"))return d;let[,S,O]=/^([^?#]*)(.*)$/.exec(d),A=q.posix.normalize(S.startsWith("/")?S.slice(1):q.posix.join(q.posix.dirname(t),S)),x=r.get(A);if(!x)return h&&n("missing-import","error",t,`Local import cannot be resolved in migrated files: ${d}`),d;if(h){let w=q.posix.relative(q.posix.dirname(r.get(t)||t),x);return(w.startsWith(".")?w:"./"+w)+O}return/\.(md|mdx)$/i.test(x)||p.add(x),/\.mdx$/i.test(x)&&/\.(md|mdx)$/i.test(S)?S.replace(/\.(md|mdx)$/i,"")+O:d};for(let{stmt:d}of l){let h=d.source.value;/^(?:@mintlify\/|next(?:\/|$))/.test(h)&&n("runtime-import","error",t,`Replace the runtime dependency ${h} with a Velu/React equivalent.`);let S=g(h,!0);S!==h&&m(d.source.start,d.source.end,JSON.stringify(S))}mn(a,d=>{if(d.type==="yaml")try{let w=po.load(d.value)||{};for(let L of Object.keys(w))if(["auth","groups","public","hidden"].includes(L))n("page-access","error",t,`Frontmatter ${L} requires manual visibility/access migration.`,d.position.start.line);else{if(L==="openapi"&&o)continue;["api","openapi","asyncapi"].includes(L)?n("endpoint-frontmatter","error",t,`Frontmatter ${L} is preserved but does not generate an endpoint in Velu. Wire the spec into navigation.openapi and review endpoint routes.`,d.position.start.line):["title","description","icon","sidebarTitle","mode","keywords","og:title","og:description","og:image"].includes(L)||n("frontmatter-review","warning",t,`Frontmatter ${L} is preserved; verify its behavior in Velu.`,d.position.start.line)}}catch(w){n("frontmatter-syntax","error",t,w.message,d.position.start.line)}if(["link","image","definition"].includes(d.type)&&d.url){let w=g(d.url);if(w!==d.url){let L=d.position.start.offset,B=e.slice(L,d.position.end.offset).lastIndexOf(d.url);B>=0&&m(L+B,L+B+d.url.length,w)}}if(!["mdxJsxFlowElement","mdxJsxTextElement"].includes(d.type)||!d.name)return;let h=d.name,S=d.position.start.line;if(s.has(h.split(".")[0]))return;y.add(h);let O=yt[h]?"Callout":["ParamField","ResponseField"].includes(h)?"Field":h==="Expandable"?"Accordion":h;if(O!==h&&s.has(O)){n("component-name-conflict","error",t,`Cannot convert <${h}> to <${O}> because that name is already locally defined. Rename the local binding before migration.`,S);return}let A=d.attributes.filter(w=>w.type==="mdxJsxAttribute"),x=(w,L)=>{let P=A.find(B=>B.name===w);P&&!A.some(B=>B.name===L)&&m(P.position.start.offset,P.position.start.offset+w.length,L)};if(h==="ParamField")for(let w of["body","query","path","header","cookie"])x(w,"name");if(h==="CardGroup"&&x("cols","limit"),h==="Accordion"&&x("default-open","defaultOpen"),h==="Expandable"&&(x("title","title"),A.some(w=>w.name==="title")||m(d.position.start.offset+1+h.length,d.position.start.offset+1+h.length,' title="Details"')),O!==h){let w=d.position.start.offset;m(w+1,w+1+h.length,O+(yt[h]?` type="${yt[h]}"`:""));let L=d.position.end.offset,P=new RegExp(`</${h}\\s*>$`).exec(e.slice(w,L));P&&m(L-P[0].length+2,L-P[0].length+2+h.length,O)}go.has(h)?(u.add(h),n("component-adapter","warning",t,`<${h}> uses an editable React adapter. Review visual styling and optional props.`,S)):/^[A-Z]/.test(O)&&!ho.has(O)&&n("unsupported-component","error",t,`<${h}> needs a local component implementation or import.`,S);for(let w of A)if(["href","src"].includes(w.name)&&typeof w.value=="string"){let L=g(w.value);if(L!==w.value){let P=w.position.start.offset,ee=e.slice(P,w.position.end.offset).indexOf(w.value);ee>=0&&m(P+ee,P+ee+w.value.length,L)}}}),c.sort((d,h)=>h.start-d.start||h.end-d.end);let v=e;for(let d of c)v=v.slice(0,d.start)+d.value+v.slice(d.end);if(u.size){let d=q.posix.relative(q.posix.dirname(r.get(t)||t),ge);v+=`
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+=`
4
4
 
5
- import { ${[...u].sort().join(", ")} } from ${JSON.stringify(d.startsWith(".")?d:"./"+d)};
6
- `}try{await co(v,{remarkPlugins:[pn,uo,fn]})}catch(d){n("mdx-compile","error",t,d.reason||d.message,d.line)}return{text:v,adapters:[...u],components:[...y].sort(),assets:[...p]}}function gn(e,t,r){let n=[[/\b(?:window|globalThis)\s*(?:\?\.)?\s*\.?(?:mintlify|\[\s*['"]mintlify['"]\s*\])|mintlify:user/,"mintlify-browser-api","error","Mintlify browser APIs/events need a Velu implementation; script preserved without inventing an API mapping."],[/__NEXT_DATA__|next\/router|next\/navigation|routeChangeComplete|next-route-announcer/,"next-runtime","error","Script depends on Next.js internals; adapt it to Velu\u2019s React Router runtime."],[/DOMContentLoaded|\bwindow\.onload\b|addEventListener\(\s*['"]load['"]/,"script-lifecycle","warning","Script loads after hydration; use document.readyState or an immediate initializer when DOMContentLoaded/load has already fired."],[/\brequire\s*\(|\bmodule\.exports|\bprocess\.env|from\s*['"]node:/,"node-script","error","This .js file is auto-loaded in the browser but contains Node.js constructs. Move tooling outside the docs content root or use .cjs/.mjs."],[/(?:^|\n)\s*(?:import\s|export\s)/,"module-script","error","Auto-loaded JavaScript uses classic scripts. Bundle ES modules for the browser or move them to explicitly imported .jsx/.mjs modules."],[/document\.querySelector|document\.getElementById|MutationObserver/,"script-dom","warning","Verify DOM hooks and behavior after client-side navigation; scripts execute once per full page load."]];for(let[o,i,a,s]of n){let l=o.exec(e);l&&r(i,a,t,s,e.slice(0,l.index).split(`
7
- `).length)}}function hn(e,t,r){let n=JSON.parse(e),o=!1,i=!1,a=[];for(let[s,l]of Object.entries(n.scripts||{})){if(typeof l!="string"||!/\b(?:mint|mintlify)\b/.test(l))continue;i=!0;let c=/^(?:(?:npx(?: --no-install)?|yarn|pnpm(?: exec)?|bunx)\s+)?(?:mint|mintlify)\s+(dev|validate|version|v|update)\s*$/.exec(l.trim());if(c){let u=`velu ${c[1]==="v"?"version":c[1]}`;n.scripts[s]=u,o=!0,a.push({name:s,action:"converted",from:l,to:u})}else a.push({name:s,action:"preserved",from:l}),r("npm-script","warning",`package.json:scripts.${s}`,"Mintlify command/flags or compound shell script has no verified equivalent. Original retained; update manually.")}for(let s of["dependencies","devDependencies","optionalDependencies"])Object.keys(n[s]||{}).some(l=>["mint","mintlify","@mintlify/cli"].includes(l))&&(i=!0);return i&&!n.dependencies?.["@veluai/velu"]&&!n.devDependencies?.["@veluai/velu"]&&(n.devDependencies={...n.devDependencies,"@veluai/velu":`^${t}`},o=!0),i&&r("package-install","warning","package.json","Run your package manager in the migrated directory to refresh its lockfile. Mintlify dependencies remain for scripts that still need them; remove them after review."),{text:o?JSON.stringify(n,null,2)+`
8
- `:e,scripts:a}}function yn(e,t,r,n){let o;try{o=fo(e,{sourceType:"unambiguous",plugins:["jsx",.../\.[cm]?tsx?$/.test(t)?["typescript"]:[]]})}catch(l){return n("module-syntax","error",t,l.message,l.loc?.line),e}let i=[],a=new Set,s=l=>{if(!l||typeof l!="object")return;let c=["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(l.type)?l.source:l.type==="CallExpression"&&(l.callee?.type==="Import"||l.callee?.name==="require")?l.arguments?.[0]:null;if(c?.type==="StringLiteral"&&!a.has(c.start)){a.add(c.start);let u=c.value;if(u.startsWith(".")||u.startsWith("/")){let p=q.posix.normalize(u.startsWith("/")?u.slice(1):q.posix.join(q.posix.dirname(t),u)),y=r.get(p);if(y){let m=q.posix.relative(q.posix.dirname(r.get(t)||t),y),g=m.startsWith(".")?m:"./"+m;u!==g&&i.push({start:c.start,end:c.end,value:JSON.stringify(g)})}else n("missing-import","error",t,`Local module import missing or ignored: ${u}`,c.loc?.start.line)}}for(let[u,p]of Object.entries(l))["loc","comments","tokens","extra"].includes(u)||(Array.isArray(p)?p.forEach(s):p&&typeof p=="object"&&s(p))};s(o.program);for(let l of i.sort((c,u)=>u.start-c.start))e=e.slice(0,l.start)+l.value+e.slice(l.end);return e}function vn(e,t,r,n){let o;try{o=mo.parse(e,{from:t})}catch(s){return n("css-syntax","error",t,s.reason||s.message,s.line),e}let i=new Set,a;return o.walkRules(s=>{for(let l of s.selector.matchAll(/#(?:content|navbar|sidebar(?:-content)?|navigation-items|page-title|header|footer|table-of-contents)(?![\w-])/g))i.add(l[0]),a??=s.source?.start?.line}),i.size&&n("css-dom","warning",t,`Styles target renderer structure (${[...i].join(", ")}). Selectors are preserved, but matching elements and their nesting can differ in Velu; compare page headers, sidebars, API pages, and mobile layouts in the browser.`,a),o.walkDecls(s=>{s.value=s.value.replace(/url\(\s*(?:"([^"\\]*)"|'([^'\\]*)'|([^)'"\\\s]*))\s*\)/gi,(l,c,u,p)=>{let y=c??u??p;if(!y||/^(?:[a-z][a-z0-9+.-]*:|\/|#)/i.test(y))return l;let m=/^([^?#]*)(.*)$/.exec(y),g=q.posix.normalize(q.posix.join(q.posix.dirname(t),m[1]));return r.has(g)?`url("${"/"+r.get(g).split("/").map(encodeURIComponent).join("/")+m[2]}")`:(n("css-missing-asset","error",t,`CSS asset missing or ignored: ${y}`,s.source?.start?.line),l)})}),o.walkAtRules("import",s=>n("css-import","warning",t,"Custom CSS files are included globally. Check @import for duplicate styles and loading order.",s.source?.start?.line)),o.toString()}var ge,yt,go,ho,vt,bn=_(()=>{We();Ge();ge="snippets/velu-mintlify-compat.jsx",yt={Note:"note",Tip:"tip",Warning:"warning",Info:"info",Check:"check",Danger:"danger"},go=new Set(["Tabs","Tab","Frame","Tooltip","Badge","Button","Panel"]),ho=new Set(te),vt=`import React from 'react';
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';
9
9
  export function Tabs({ children, defaultIndex = 0 }) {
10
10
  const tabs = React.Children.toArray(children).filter(React.isValidElement);
11
11
  const [active, setActive] = React.useState(defaultIndex);
@@ -30,27 +30,27 @@ export function Tooltip({children,tip}) { return <span title={typeof tip === 'st
30
30
  export function Badge({children,color,className=''}) { return <span data-component="badge" className={className} style={{border:'1px solid currentColor',borderRadius:'1rem',padding:'.1rem .5rem',color}}>{children}</span>; }
31
31
  export function Button({children,href,variant,size,icon,iconType,...props}) { return href ? <a href={href} {...props}>{children}</a> : <button type="button" {...props}>{children}</button>; }
32
32
  export function Panel({children}) { return <aside data-component="panel">{children}</aside>; }
33
- `});import yo from"github-slugger";import vo from"iso-639-1";function xo(e){let t=String(e).toLowerCase();return vo.getNativeName(t)||e}function He(e){return new yo().slug(String(e??""))}function xn(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function bt(e){let t=String(e).split("#")[0].split("?")[0];try{t=decodeURI(t)}catch{}return t.startsWith("/")||(t="/"+t),t.length>1&&(t=t.replace(/\/+$/,"")),t||"/"}function X(e){let t={kind:"root",children:ke(e??{})};return e?.preservePagePaths===!0&&(t.preservePagePaths=!0),Sn(t.children),t}function ke(e){let t=Array.isArray(e.anchors)?e.anchors.map(jo):[];if(Array.isArray(e.products))return[...t,...e.products.map(wo)];if(Array.isArray(e.versions))return[...t,...e.versions.map($o)];if(Array.isArray(e.languages))return[...t,...e.languages.map(So)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(ko)];let r=[...t];return Array.isArray(e.groups)&&r.push(...e.groups.map(wn)),Array.isArray(e.pages)&&r.push(...e.pages.map($n)),r}function wo(e){return{kind:"product",label:e.name??e.product,slug:He(e.product),icon:e.icon,color:e.color,default:!!e.default,children:ke(e)}}function $o(e){return{kind:"version",label:e.version,slug:He(e.version),default:!!e.default,children:ke(e)}}function So(e){let t=String(e.language);return{kind:"language",code:t,label:xo(t),slug:He(t),default:!!e.default,children:ke(e)}}function ko(e){return{kind:"tab",label:e.tab,slug:He(e.tab),icon:e.icon,href:e.href,children:ke(e)}}function jo(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function wn(e){let t=(e.pages??[]).map($n);return e.root&&t.unshift({kind:"page",pagePath:e.root}),{kind:"group",label:e.group,icon:e.icon,expanded:!!e.expanded,root:e.root,children:t}}function $n(e){if(typeof e=="string")return{kind:"page",pagePath:e};if(e&&e.apiPage)return{kind:"page",pagePath:e.apiPage,label:e.label,method:e.method,api:!0};if(e&&typeof e.page=="string"){let t={kind:"page",pagePath:e.page};return e.icon&&(t.icon=e.icon),(e.title||e.label)&&(t.label=e.title??e.label),t}return wn(e)}function Sn(e){for(let t of bo){let r=e.filter(n=>n.kind===t);r.length&&!r.some(n=>n.default)&&(r[0].default=!0)}for(let t of e)t.children&&Sn(t.children)}function ne(e){let t=[],r=(n,o,i)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:Ao(n.pagePath,o),ctx:{...o},ancestors:i,node:n});return}let a=o;n.kind==="product"?a={...o,product:n.default?null:n.slug}:n.kind==="version"?a={...o,version:n.default?null:n.slug}:n.kind==="language"&&(a={...o,language:n.default?null:n.slug});let s=n.kind==="root"?i:[...i,n];for(let l of n.children??[])r(l,a,s)};return r(e,{product:null,version:null,language:null,...e.preservePagePaths?{preservePagePaths:!0}:{}},[]),t}function Ao(e,t){if(t.preservePagePaths)return xn(e);let r=[t.product,t.version,t.language].filter(Boolean),n=xn(e).split("/").filter(Boolean);return"/"+[...r,...n].join("/")}var bo,re=_(()=>{bo=["product","version","language"]});function Oo(e,t){let r=t.slice(2).split("/").filter(o=>o!=="").map(o=>decodeURIComponent(o).replace(/~1/g,"/").replace(/~0/g,"~")),n=e;for(let o of r){if(n==null||typeof n!="object")return;n=n[o]}return n}function kn(e){let t=new Map;function r(n){if(n==null||typeof n!="object")return n;if(t.has(n))return t.get(n);if(typeof n.$ref=="string"){let i=n.$ref;if(!i.startsWith("#/"))throw new Error(`external $ref "${i}" is not supported in the instant preview \u2014 inline it or use a single-file spec`);let a=Oo(e,i);if(a===void 0)throw new Error(`$ref "${i}" does not resolve`);let s=r(a);return t.set(n,s),s}let o=Array.isArray(n)?[]:{};t.set(n,o);for(let[i,a]of Object.entries(n))o[i]=r(a);return o}return r(e)}var jn=_(()=>{});function ce(e){return!e||typeof e!="object"?e||{}:Array.isArray(e.allOf)?e.allOf.reduce((t,r)=>{let n=ce(r);return{...t,...n,properties:{...t.properties||{},...n.properties||{}},required:[...t.required||[],...n.required||[]]}},{...e,allOf:void 0}):Array.isArray(e.oneOf)&&e.oneOf.length?ce(e.oneOf[0]):Array.isArray(e.anyOf)&&e.anyOf.length?ce(e.anyOf[0]):e}function je(e){let t=ce(e);if(!t||typeof t!="object")return"any";if(Array.isArray(t.enum)&&t.enum.length)return`enum<${typeof t.enum[0]}>`;if(t.type==="array")return`${je(t.items||{})}[]`;let r=t.type||(t.properties?"object":"any");return t.format?`${r}<${t.format}>`:r}function he(e,t=0){let r=ce(e);if(!r||typeof r!="object")return null;if(r.example!==void 0)return r.example;if(r.default!==void 0)return r.default;if(Array.isArray(r.enum)&&r.enum.length)return r.enum[0];if(t>=6)return r.type==="object"?{}:null;switch(r.type){case"object":{let n={};for(let[o,i]of Object.entries(r.properties||{}))n[o]=he(i,t+1);return n}case"array":return[he(r.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Eo(r)}}function Eo(e){switch(e.format){case"date-time":return"2024-01-01T00:00:00Z";case"date":return"2024-01-01";case"email":return"user@example.com";case"uuid":return"3fa85f64-5717-4562-b3fc-2c963f66afa6";case"uri":case"url":return"https://example.com";default:return"<string>"}}function xt(e){let t=ce(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:je(t),required:!1,description:t.description||""}]:[];let r=new Set(t.required||[]);return Object.entries(t.properties).map(([n,o])=>{let i=ce(o);return{name:n,type:je(i),required:r.has(n),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,deprecated:i.deprecated||void 0}})}function Co(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:je(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:he(t),deprecated:e.deprecated||void 0}}function On(e){if(!e||typeof e!="object")return null;let t=Object.keys(e),r=t.find(n=>/json/i.test(n))||t[0];return r?{contentType:r,media:e[r]}:null}function Lo(e){if(!e)return null;let t=On(e.content);if(!t)return null;let r=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:xt(r),example:t.media.example??he(r)}}function Po(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,r])=>{let n=On(r?.content),o=n?.media?.schema||{};return{status:t,description:r?.description||"",contentType:n?.contentType||null,fields:n?xt(o):[],example:n?n.media.example??he(o):null}})}function _o(e,t){if(!Array.isArray(e)||!t)return[];let r=[],n=new Set;for(let o of e)for(let i of Object.keys(o||{})){let a=t[i];!a||n.has(i)||(n.add(i),r.push(Ro(i,a)))}return r.filter(Boolean)}function Ro(e,t){return t.type==="http"&&/bearer/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"Bearer authentication token."}:t.type==="http"&&/basic/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Basic",description:t.description||"Basic authentication credentials."}:t.type==="apiKey"?{name:t.name||e,in:t.in||"header",required:!0,type:"string",description:t.description||"API key."}:t.type==="oauth2"||t.type==="openIdConnect"?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"OAuth 2.0 access token."}:{name:e,in:"header",required:!0,type:"string",description:t.description||""}}function An(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Uo(e){let{method:t,path:r,op:n,sharedParams:o,servers:i,schemes:a}=e,s=[...o||[],...n.parameters||[]],l={path:[],query:[],header:[],cookie:[]};for(let u of s)u&&l[u.in]&&l[u.in].push(Co(u));let c=n.security??e.globalSecurity;return{id:n.operationId?An(n.operationId):`${t}-${An(r)}`,method:t.toUpperCase(),path:r,title:n.summary||n.operationId||`${t.toUpperCase()} ${r}`,description:n.description||n.summary||"",tags:Array.isArray(n.tags)&&n.tags.length?n.tags:["API"],deprecated:n.deprecated||!1,auth:_o(c,a),parameters:l,body:Lo(n.requestBody),responses:Po(n.responses),servers:(i||[]).map(u=>u.url).filter(Boolean)}}function Fo(e,t,r,n,o,i,a){let s={};e.openapi?s.openapi=e.openapi:e.swagger?s.swagger=e.swagger:s.openapi="3.0.0",s.info=e.info||{title:"API Reference",version:"1.0.0"};let l=(n.servers||i||[]).filter(Boolean);l.length&&(s.servers=l);let c={};Array.isArray(o)&&o.length&&(c.parameters=o),c[r]=n,s.paths={[t]:c};let u=n.security??e.security;if(a&&Array.isArray(u)&&u.length){let p={};for(let y of u)for(let m of Object.keys(y||{}))a[m]&&(p[m]=a[m]);Object.keys(p).length&&(e.swagger?s.securityDefinitions=p:s.components={securitySchemes:p})}return s}function Tn(e){let t=[],r=[],n=e.components?.securitySchemes||e.securityDefinitions||{},o=e.security||[],i=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]);for(let[a,s]of Object.entries(e.paths||{})){if(!s||typeof s!="object")continue;let l=s.parameters||[],c=s.servers||i;for(let u of To){let p=s[u];!p||typeof p!="object"||(t.push(Uo({method:u,path:a,op:p,sharedParams:l,servers:p.servers||c,globalSecurity:o,schemes:n})),r.push(Fo(e,a,u,p,l,p.servers||c,n)))}}return{operations:t,segments:r}}function Ae(e){let t=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]),{operations:r,segments:n}=Tn(e);return{title:e.info?.title||"API Reference",version:e.info?.version||"",servers:t.map(o=>o.url).filter(Boolean),operations:r,segments:n}}var To,Ke=_(()=>{To=["get","post","put","patch","delete","options","head","trace"]});function No(e,{server:t}={}){let n=`${(t||e.servers?.[0]||"").replace(/\/+$/,"")}${e.path}`,o={};for(let a of e.auth||[])a.in==="header"&&(o[a.name]=a.prefix?`${a.prefix} <token>`:"<token>");for(let a of e.parameters?.header||[])o[a.name]||(o[a.name]=String(a.example??`<${a.type}>`));let i=!!e.body;return i&&(o["Content-Type"]=e.body.contentType||"application/json"),{method:e.method,url:n,headers:o,body:i?e.body.example??{}:null}}function Io(e){let t=`curl --request ${e.method} \\
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} \\
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 Mo(e){let t=[` method: '${e.method}'`];if(Object.keys(e.headers).length){let r=Object.entries(e.headers).map(([n,o])=>` '${n}': '${o}'`).join(`,
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(`,
37
37
  `);t.push(` headers: {
38
38
  ${r}
39
39
  }`)}return e.body!=null&&t.push(` body: JSON.stringify(${wt(e.body," ")})`),[`const res = await fetch('${e.url}', {`,t.join(`,
40
40
  `),"});","const data = await res.json();"].join(`
41
- `)}function zo(e){let t=["import requests","",`url = "${e.url}"`];if(Object.keys(e.headers).length){let n=Object.entries(e.headers).map(([o,i])=>` "${o}": "${i}"`).join(`,
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(`,
42
42
  `);t.push(`headers = {
43
43
  ${n}
44
44
  }`)}let r=["url"];return e.body!=null&&(t.push(`payload = ${wt(e.body,"")}`),r.push("json=payload")),Object.keys(e.headers).length&&r.push("headers=headers"),t.push("",`response = requests.${e.method.toLowerCase()}(${r.join(", ")})`,"print(response.json())"),t.join(`
45
- `)}function Vo(e){let t=e.method.charAt(0)+e.method.slice(1).toLowerCase(),r=["require 'net/http'","require 'json'","",`uri = URI("${e.url}")`,"http = Net::HTTP.new(uri.host, uri.port)","http.use_ssl = true",`request = Net::HTTP::${t}.new(uri)`];for(let[n,o]of Object.entries(e.headers))r.push(`request['${n}'] = '${o}'`);return e.body!=null&&r.push(`request.body = ${wt(e.body,"")}.to_json`),r.push("","response = http.request(request)","puts response.body"),r.join(`
46
- `)}function Xe(e,{server:t,languages:r=$t}={}){let n=No(e,{server:t});return r.filter(o=>En[o]).map(o=>({key:o,label:Bo[o],language:Do[o],code:En[o](n)}))}var wt,En,Bo,Do,$t,St=_(()=>{wt=(e,t)=>JSON.stringify(e,null,2).split(`
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(`
47
47
  `).map((r,n)=>n===0?r:t+r).join(`
48
- `);En={curl:Io,javascript:Mo,python:zo,ruby:Vo},Bo={curl:"cURL",javascript:"JavaScript",python:"Python",ruby:"Ruby"},Do={curl:"bash",javascript:"javascript",python:"python",ruby:"ruby"},$t=["curl","javascript","python","ruby"]});function Ln(e){let t=e?.font?.family;return typeof t=="string"&&t.trim()?t.trim():e?.theme==="vepa"||["thulir","aalam","nila","kadhir"].includes(e?.theme)?"Inter":qo}function Oe(e){return e==="vepa"||["thulir","aalam","nila","kadhir"].includes(e)?e:"velu"}function jt({light:e,dark:t,family:r,theme:n,primary:o=e,cta:i=o}){let a=n==="vepa"||["thulir","aalam","nila","kadhir"].includes(n)?Go(o,t):"";return[":root:root {",` --accent-color: ${e};`,...["thulir","aalam","nila","kadhir"].includes(n)?[` --thulir-cta-color: ${i};`]:[],` --font-sans: "${r}", sans-serif;`,a,"}",':root:root[data-theme="dark"] {',` --accent-color: ${t};`,"}"].join(`
49
- `)}function Go(e,t){let r=(s,l)=>{let c=/^#([\da-f]{3}|[\da-f]{6})$/i.exec(s||"")?.[1];return c||(c=l),c.length===3&&(c=[...c].map(u=>u+u).join("")),[0,2,4].map(u=>parseInt(c.slice(u,u+2),16))},n=r(e,"16a34a"),o=r(t,"4ade80"),i={50:250,100:245,200:229,300:212,400:163,500:115,600:82,700:64,800:38,900:23,950:10},a=.95/(.95+.6-.95*.6);return[...Object.entries(i).map(([s,l])=>` --vepa-gray-${s}: rgb(${n.map(c=>Math.round(c*(1-a)+l*a)).join(" ")});`),` --vepa-background-dark: rgb(${o.map((s,l)=>Math.round([9,9,11][l]*.98+s*.02)).join(" ")});`].join(`
50
- `)}function Te(e){if(!e||typeof e!="object")return null;let t=[];if(e.socials&&typeof e.socials=="object")for(let[n,o]of Object.entries(e.socials))typeof o!="string"||!o.trim()||t.push({kind:Jo[n]??n,href:o.trim()});let r=Array.isArray(e.links)?e.links.filter(n=>n&&typeof n=="object").map(n=>({title:(n.header??n.title??"").trim(),items:(Array.isArray(n.items)?n.items:[]).filter(o=>o&&o.label).map(o=>({label:o.label,href:o.href??"#"}))})).filter(n=>n.title||n.items.length):[];return!t.length&&!r.length?null:{socials:t,links:r}}function kt(e){return/^(https?:)?\/\//.test(e)||/^(mailto|tel):/.test(e)}function Ee(e){if(!e||typeof e!="object")return null;let t=(Array.isArray(e.links)?e.links:[]).filter(o=>o&&typeof o.href=="string"&&o.href.trim()).map(o=>({label:o.label??"",href:o.href.trim(),icon:o.icon??null,external:kt(o.href.trim())})),r=null,n=e.primary;if(n&&typeof n=="object"&&typeof n.href=="string"&&n.href.trim()){let o=n.href.trim();r=n.type==="github"?{kind:"github",label:n.label??"GitHub",href:o,external:kt(o)}:{kind:"button",label:n.label??"",href:o,external:kt(o)}}return!t.length&&!r?null:{links:t,primary:r}}function At(e){if(e==null)return{options:[...Cn],display:"header"};if(typeof e!="object")return{options:[],display:"header"};let t=e.display==="toc"?"toc":"header",r=Array.isArray(e.options)?e.options:Cn,n=[];for(let o of r)typeof o=="string"?Wo.has(o)&&n.push(o):o&&typeof o=="object"&&o.title&&o.href&&n.push({title:String(o.title),description:o.description?String(o.description):"",href:String(o.href),icon:typeof o.icon=="string"?o.icon:void 0});return{options:n,display:t}}function Y(e){if(!e||typeof e!="object")return{server:null,proxy:!0,languages:void 0};let t=e.playground||{};return{server:typeof e.server=="string"?e.server.trim():null,proxy:t.proxy!==!1&&t.display!=="none",languages:Array.isArray(e.examples?.languages)?e.examples.languages:void 0}}function Ce(e){if(!e||typeof e!="object")return null;let t=typeof e.apiBase=="string"&&e.apiBase.trim()?e.apiBase.trim().replace(/\/+$/,""):null,r=typeof e.host=="string"&&e.host.trim()?e.host.trim():null,n=Array.isArray(e.suggestions)?e.suggestions.filter(o=>typeof o=="string"&&o.trim()).map(o=>o.trim()).slice(0,6):[];return!t&&!n.length?null:{apiBase:t,host:r,suggestions:n}}var Jo,qo,Wo,Cn,Le=_(()=>{Jo={twitter:"x","x-twitter":"x"},qo="Google Sans Flex";Wo=new Set(["copy","assistant","view","download-pdf","download-spec","chatgpt","claude","perplexity","grok","aistudio","devin","windsurf","mcp","add-mcp","cursor","vscode","devin-mcp"]),Cn=["copy","view","chatgpt","claude"]});import Ho from"node:path";import Pn from"js-yaml";function _n(e,t,r,n,o){let i=/^(?:\uFEFF)?---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(e);if(!i)return{text:e,converted:!1};let a;try{a=Pn.load(i[1])}catch{return{text:e,converted:!1}}if(typeof a?.openapi!="string")return{text:e,converted:!1};let s=/^(?:(.+?)\s+)?(GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|TRACE)\s+(\/\S+)$/i.exec(a.openapi.trim());if(!s)return{text:e,converted:!1};let l=s[1]?[s[1]]:[].concat(n.openapi||n.api?.openapi||[]);if(l=l.map(u=>typeof u=="string"?u:u?.source).filter(Boolean),!l.length)return{text:e,converted:!1};let c=[];try{for(let d of l){if(/^[a-z][a-z0-9+.-]*:/i.test(d))throw new Error("Remote specs must be downloaded locally first.");let h=Ho.posix.normalize(d.replace(/^\//,"")),S=r.get(h);if(!S)throw new Error(`Spec is missing or ignored: ${h}`);let O=/\.ya?ml$/i.test(h)?Pn.load(S.toString("utf8")):ht(S.toString("utf8"),h),A=Ae(kn(O));for(let x of A.operations)x.method===s[2].toUpperCase()&&x.path===s[3]&&c.push({operation:x,rel:h})}if(c.length!==1)throw new Error(`Expected exactly one matching operation; found ${c.length}.`);let{operation:u,rel:p}=c[0],y=Y(n.api),m=Xe(u,{server:y.server||u.servers?.[0],...y.languages?{languages:y.languages}:{}});if(/\bveluApi\b/.test(e))throw new Error("Reserved generated export name already used: veluApi");let v=`
51
- export const veluApi = ${JSON.stringify({operation:u,samples:m,api:{proxy:y.proxy,server:y.server}})};
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}})};
52
52
 
53
- ${e.slice(i[0].length)}`;return o("endpoint-snapshot","warning",t,`Generated the ${s[2].toUpperCase()} ${s[3]} playground from ${p}, preserving the page URL and body. This is an editable snapshot: regenerate after spec changes; review x-mint extensions and page-specific overrides.`),{text:e.slice(0,i[0].length)+v,converted:!0}}catch(u){return o("endpoint-conversion","error",t,`Could not migrate OpenAPI endpoint: ${u.message}`),{text:e,converted:!1}}}var Rn=_(()=>{jn();Ke();St();Le();Ge()});var zn={};$e(zn,{MIGRATE_HELP:()=>Fn,migrateMintlify:()=>Mn,parseMigrateArgs:()=>Nn,planMigration:()=>In,runMigrate:()=>ni});import N from"node:fs";import z from"node:path";import{randomUUID as Ko,createHash as Xo}from"node:crypto";import Yo from"ignore";function Nn(e){if(e.includes("--help")||e.includes("-h"))return{help:!0};if(e.shift()!=="mintlify")throw new Error("Specify the source platform: velu migrate mintlify [source]");let t={},r=!1;for(let n=0;n<e.length;n++){let o=e[n];if(["--dry-run","--json","--strict"].includes(o))t[{"--dry-run":"dryRun","--json":"json","--strict":"strict"}[o]]=!0;else if(["--out","--config"].includes(o)){if(!e[n+1]||e[n+1].startsWith("--"))throw new Error(`${o} requires a value.`);if(t[o.slice(2)]!==void 0)throw new Error(`${o} was specified twice.`);t[o.slice(2)]=e[++n]}else{if(o.startsWith("-"))throw new Error(`Unknown migration option: ${o}`);if(r)throw new Error("Only one source directory may be specified. Use --out for the destination.");t.source=o,r=!0}}if(t.config&&!["docs.json","mint.json"].includes(t.config))throw new Error("--config must be docs.json or mint.json.");return t}function ei(e,t){let r=z.resolve(t||`${e}-velu`),n=r,o=[];for(;!N.existsSync(n);){o.unshift(z.basename(n));let a=z.dirname(n);if(a===n)throw new Error("Cannot resolve destination parent.");n=a}let i=z.join(N.realpathSync(n),...o);if(le(e,i)||le(i,e))throw new Error("Destination must be outside the source directory and cannot be its ancestor.");if(N.existsSync(r))throw new Error("Destination already exists. Choose a new directory; migration never overwrites existing files.");return i}function ti(e){let t=r=>String(r).replace(/\|/g,"\\|").replace(/[\r\n]+/g," ");return`# Mintlify \u2192 Velu migration
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
54
54
 
55
55
  Status: **${e.status}**. ${e.summary.files} files; ${e.summary.pages} pages/snippets; ${e.summary.scripts} browser scripts; ${e.summary.styles} stylesheets.
56
56
 
@@ -69,7 +69,7 @@ The original Mintlify configuration is preserved. Unsupported settings have not
69
69
  | --- | --- | --- | --- |
70
70
  `+e.issues.map(r=>`| ${r.severity} | ${t(r.code)} | ${t(r.file)}${r.line?":"+r.line:""} | ${t(r.message)} |`).join(`
71
71
  `)+`
72
- `}async function In({source:e=".",out:t,config:r,version:n="0.2.40"}={}){let o=N.realpathSync(z.resolve(e));if(!N.statSync(o).isDirectory())throw new Error("Source must be a directory.");let i=ei(o,t);if(r&&!["docs.json","mint.json"].includes(r))throw new Error("Config must be docs.json or mint.json.");let a=r||["docs.json","mint.json"].find(f=>N.existsSync(z.join(o,f)));if(!a)throw new Error("No docs.json or mint.json found in the source directory.");let s=[],l=new Set,c=(f,b,j,C,M)=>{let ie=JSON.stringify([f,b,j,C,M]);l.has(ie)||(s.push({code:f,severity:b,file:j,message:C,...M?{line:M}:{}}),l.add(ie))},u=cn(o,a),p=un(u,a,c);!r&&N.existsSync(z.join(o,"docs.json"))&&N.existsSync(z.join(o,"mint.json"))&&c("multiple-configs","warning",a,"Both config files exist; docs.json selected. Use --config mint.json to select the legacy config.");let y=Yo(),m=z.join(o,".mintignore");if(N.existsSync(m)){if(!le(o,N.realpathSync(m)))throw new Error(".mintignore resolves outside the source.");y.add(N.readFileSync(m,"utf8"))}let g=new Map,v=[];function d(f){for(let b of N.readdirSync(f,{withFileTypes:!0}).sort((j,C)=>j.name<C.name?-1:j.name>C.name?1:0)){let j=z.join(f,b.name),C=gt(z.relative(o,j));b.isSymbolicLink()?(v.push({path:C,reason:"symbolic-link"}),c("symlink","warning",C,"Symbolic link/junction skipped. Copy its required content into the source explicitly.")):b.isDirectory()&&Zo.has(b.name)||/^\.env(?:\.|$)/i.test(b.name)||[".npmrc",".yarnrc.yml",".pnp.cjs",".pnp.loader.mjs"].includes(b.name)?v.push({path:C,reason:"dependency-cache-tooling-or-environment"}):y.ignores(C+(b.isDirectory()?"/":""))&&C!==a&&C!==".mintignore"?v.push({path:C,reason:"mintignore"}):b.isFile()&&C.startsWith(".mintlify/")&&!/\.(json|ya?ml)$/i.test(C)&&!C.startsWith(".mintlify/skills/")?v.push({path:C,reason:"mintlify-runtime-file"}):b.isDirectory()?d(j):b.isFile()?g.set(C,N.readFileSync(j)):v.push({path:C,reason:"not-regular-file"})}}if(d(o),!g.has(a))throw new Error("Source config must be a regular file, not a symbolic link.");if(g.has("velu.json"))throw new Error("Source already contains velu.json. Use the original Mintlify project to avoid replacing an existing Velu config.");let h=new Map,S=new Set,O=new Set;try{for(let f of ne(X(p.navigation)))O.add(f.pagePath.replace(/^\//,""))}catch{}for(let f of g.keys()){let b=f;/\.md$/i.test(f)&&(O.has(f.slice(0,-3))||!/^(readme|license|changelog|contributing|contribute|skill|agents|claude)\.md$/i.test(z.posix.basename(f)))&&(b=f.replace(/\.md$/i,".mdx")),/\.mdx$/i.test(f)&&(b=f.replace(/\.mdx$/i,".mdx")),/^(?:_snippets|snippets)\/.*\.js$/i.test(f)&&(b=f.replace(/\.js$/i,".jsx"));let j=b.toLowerCase();if(S.has(j)||[Ot.toLowerCase(),Tt.toLowerCase()].includes(j))throw new Error(`Migration output collision: ${b}`);S.add(j),h.set(f,b)}let A=new Map(h);for(let[f,b]of h)if(/\.(mdx?|jsx?|tsx?)$/.test(f)){let j=f.replace(/\.[^.]+$/,"");A.has(j)||A.set(j,b),/\/index$/.test(j)&&!A.has(j.slice(0,-6))&&A.set(j.slice(0,-6),b)}let x=new Map,w=[],L=new Set,P=!1,B=[];for(let[f,b]of g){let j=h.get(f),C=b,M="asset",ie;if(/\.mdx$/i.test(j)){M="content";let J=_n(b.toString("utf8"),f,g,u,c),se=await dn(J.text,f,A,c,{endpointConverted:J.converted});C=Buffer.from(se.text),ie=se.components,P||=se.adapters.length>0;for(let dt of se.assets||[])L.add(dt)}else if(f==="package.json"){M="package";let J=hn(b.toString("utf8"),n,c);C=Buffer.from(J.text),B=J.scripts}else if(/\.js$/i.test(j))M="script",gn(b.toString("utf8"),f,c),(f.startsWith("public/")||f.split("/").some(J=>J.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load JavaScript from public or dot directories; explicitly load it from a custom script if required.");else if(/\.css$/i.test(j)){M="style";let J=b.toString("utf8");f.startsWith("public/")||(C=Buffer.from(vn(J,f,h,c))),/@import|data-component-(?:name|part)|\.dark\b|__next|#banner|#header\b/.test(J)&&c("css-hooks","warning",f,"Review CSS imports, theme classes, and Mintlify-specific selectors against Velu\u2019s DOM hooks."),(f.startsWith("public/")||f.split("/").some(se=>se.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load CSS from public or dot directories.")}else/\.[cm]?[jt]sx?$/.test(j)&&(M="module",C=Buffer.from(yn(b.toString("utf8"),f,A,c)),/(?:@mintlify\/|next\/|window\.mintlify)/.test(b.toString("utf8"))&&c("module-runtime","error",f,"Custom module depends on a Mintlify/Next.js runtime. Adapt its imports and APIs."));f.startsWith(".github/workflows/")&&/mintlify|\bmint\s/.test(b.toString("utf8"))&&c("ci-workflow","warning",f,"Workflow preserved. Replace Mintlify install/validation/deployment commands manually."),x.set(j,C),w.push({source:f,destination:j,kind:M,action:f!==j?"renamed":C.equals(b)?"copied":"transformed",sha256:Pe(C),...ie?{components:ie}:{}})}for(let[f,b]of[...x]){if(!Qo.test(f)&&!L.has(f)&&!/\.(css|js)$/i.test(f)||f.startsWith("public/")||f.split("/").some(M=>M.startsWith("."))||["docs.json","mint.json","package.json","velu.json",...Un].includes(f))continue;let j=`public/${f}`,C=[...x.keys()].find(M=>M.toLowerCase()===j.toLowerCase());if(C){x.get(C).equals(b)||c("public-asset-conflict","error",f,`Different asset already exists at ${C}; public file retained. Review which URL should be served.`);continue}x.set(j,b),w.push({source:f,destination:j,kind:"public-asset",action:"mirrored",sha256:Pe(b)})}if(P){if(S.has(ge.toLowerCase()))throw new Error(`Generated adapter conflicts with source file: ${ge}`);x.set(ge,Buffer.from(vt)),w.push({destination:ge,kind:"module",action:"generated",sha256:Pe(vt)})}let ee=Buffer.from(Ye(p));x.set("velu.json",ee),w.push({destination:"velu.json",kind:"config",action:"generated",sha256:Pe(ee)});let T=Buffer.from(Ye(u));x.set(".velu-migration/source-config.json",T),w.push({destination:".velu-migration/source-config.json",kind:"config",action:"archived",sha256:Pe(T)});let $=new Set,E=new Set;try{for(let f of ne(X(p.navigation))){E.has(f.url)&&c("duplicate-route","error","velu.json",`Duplicate route: ${f.url}`),E.add(f.url);let b=f.pagePath.replace(/^\/+|\/+$/g,"")+".mdx";/\.\.(?:\/|$)|\\/.test(b)&&c("unsafe-page-path","error","velu.json",`Page path is outside the supported project-relative format: ${f.pagePath}`),$.add(b),x.has(b)||c("missing-page","error","velu.json",`Navigation page is missing or ignored: ${b}`)}}catch(f){c("navigation-invalid","error","velu.json",f.message)}for(let f of w.filter(b=>b.kind==="content"))!$.has(f.destination)&&!/^(?:_snippets|snippets)\//.test(f.destination)&&c("unlisted-page","warning",f.destination,"Page preserved but absent from navigation. Velu\u2019s current preview only renders navigation pages; add it to navigation if it must be accessible.");let k=(f,b)=>{if(typeof f!="string")return;if(/^https?:\/\//.test(f)){c("remote-asset","error",b,"Download this branding asset into the project and use a local path; migration does not fetch external assets.");return}let j=f.replace(/^\//,"").split(/[?#]/)[0];x.has(j)||c("missing-asset","error",b,`Asset is missing or ignored: ${j}`)};if(k(p.favicon,"favicon"),typeof p.logo=="string")k(p.logo,"logo");else for(let f of["light","dark"])k(p.logo?.[f],`logo.${f}`);function F(f){if(!(!f||typeof f!="object")){if(f.openapi)for(let b of[].concat(f.openapi))/^https?:\/\//.test(b)?c("remote-openapi","warning","velu.json","Remote OpenAPI URL preserved; availability and generation need validation with network access."):x.has(b.replace(/^\//,""))?c("openapi-routes","warning","velu.json",`OpenAPI source ${b} preserved; compare generated endpoint URLs and x-mint extensions in preview.`):c("missing-openapi","error","velu.json",`OpenAPI source missing or ignored: ${b}`);for(let b of Object.values(f))typeof b=="object"&&F(b)}}F(p.navigation),B.some(f=>f.action==="converted")&&[...Un].some(f=>x.has(f))&&c("lockfile-stale","warning","package.json","Lockfiles are preserved and require regeneration after the dependency changes."),s.sort((f,b)=>f.file.localeCompare(b.file)||(f.line||0)-(b.line||0)||f.code.localeCompare(b.code));let R=s.filter(f=>f.severity==="error").length,U=s.filter(f=>f.severity==="warning").length,V={reportVersion:1,source:o,destination:i,sourceConfig:a,status:R||U?"needs-review":"ready",parityReference:{cli:"@mintlify/cli@4.0.1479",common:"@mintlify/common@1.0.1132",prebuild:"@mintlify/prebuild@1.0.1286",inspected:"2026-09-08"},summary:{files:w.length,pages:w.filter(f=>f.kind==="content").length,scripts:w.filter(f=>f.kind==="script").length,styles:w.filter(f=>f.kind==="style").length,errors:R,warnings:U,skipped:v.length},issues:s,files:w,skipped:v,npmScripts:B};return x.set(Ot,Buffer.from(Ye(V))),x.set(Tt,Buffer.from(ti(V))),{report:V,files:x}}async function Mn(e={}){let t=await In(e),r=e.strict&&(t.report.summary.errors||t.report.summary.warnings),n=!1;if(!e.dryRun&&!r){let o=t.report.destination,i=z.dirname(o);N.mkdirSync(i,{recursive:!0});let a=z.join(i,`.velu-migration-${Ko()}`);N.mkdirSync(a);try{for(let[s,l]of t.files){let c=z.resolve(a,s);if(!le(a,c))throw new Error("Output path escapes the staging directory.");N.mkdirSync(z.dirname(c),{recursive:!0}),N.writeFileSync(c,l,{flag:"wx"})}if(N.existsSync(o))throw new Error("Destination appeared during migration; no existing files were changed.");N.renameSync(a,o),n=!0}finally{z.dirname(a)===i&&z.basename(a).startsWith(".velu-migration-")&&N.rmSync(a,{recursive:!0,force:!0})}}return{report:t.report,written:n,exitCode:r?3:t.report.summary.errors?2:0}}async function ni(e,t){let r=Nn([...e]);if(r.help)return console.log(Fn),0;let n=await Mn({...r,version:t});if(r.json)console.log(Ye({...n.report,written:n.written}).trimEnd());else{let{summary:o}=n.report;console.log(`${n.written?"Migrated to":"Migration plan for"} ${n.report.destination}`),console.log(`${o.files} files \xB7 ${o.pages} pages/snippets \xB7 ${o.scripts} scripts \xB7 ${o.styles} stylesheets`),console.log(`${o.errors} errors \xB7 ${o.warnings} warnings \xB7 ${o.skipped} skipped paths`);for(let i of n.report.issues)console.log(` ${i.severity.toUpperCase()} [${i.code}] ${i.file}${i.line?":"+i.line:""}: ${i.message}`);n.written?console.log(`Review ${Tt}, then run: velu validate ${JSON.stringify(n.report.destination)}`):console.log(r.strict&&n.exitCode===3?"Strict mode: review required; no files written.":"Dry run: no files written.")}return n.exitCode}var Zo,Un,Ot,Tt,Qo,Pe,Ye,Fn,Vn=_(()=>{Ge();bn();re();re();Rn();Zo=new Set(["node_modules",".git",".velu",".velu-migration",".next",".turbo",".cache",".idea",".vscode",".claude",".agents","dist","dist-preview","coverage"]),Un=new Set(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lock","bun.lockb"]),Ot="velu-migration-report.json",Tt="VELU-MIGRATION.md",Qo=/\.(?:avif|apng|bmp|gif|ico|jpe?g|png|svg|svgz|tiff?|webp|mp4|webm|mov|avi|m4v|mp3|wav|ogg|flac|aac|m4a|woff2?|ttf|otf|eot|pdf|txt|csv|tsv|xml|zip|gz|tar|docx?|xlsx?|pptx?)$/i,Pe=e=>Xo("sha256").update(e).digest("hex"),Ye=e=>JSON.stringify(e,null,2)+`
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
73
  `,Fn=`Usage: velu migrate mintlify [source] [--out <directory>] [--config docs.json|mint.json] [--dry-run] [--json] [--strict]
74
74
 
75
75
  Migrate a local Mintlify project into a NEW Velu directory.
@@ -83,29 +83,40 @@ Defaults: source=current directory, output=<source>-velu, docs.json before mint.
83
83
  Source files are never modified; no project scripts or package installs are executed.
84
84
  Exit codes: 0=completed/clean plan, 1=invalid invocation or I/O failure,
85
85
  2=compatibility errors (output is still written unless --strict), 3=strict review required.
86
- `});var _t={};$e(_t,{currentVersion:()=>Ct,getLatestVersion:()=>Pt,isNewer:()=>Lt,maybeAutoUpdate:()=>hi,updateCommand:()=>gi});import{spawnSync as Dn}from"node:child_process";import{readFileSync as Jn,writeFileSync as ri,mkdirSync as oi}from"node:fs";import{fileURLToPath as ii}from"node:url";import{homedir as si,tmpdir as ai}from"node:os";import Et from"node:path";import Q from"node:process";function Ct(){try{return JSON.parse(Jn(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function pi(e,t){let r=i=>String(i).split("-")[0].split(".").map(a=>Number(a)||0),n=r(e),o=r(t);for(let i=0;i<3;i++){let a=(n[i]||0)-(o[i]||0);if(a!==0)return a<0?-1:1}return 0}function Lt(e,t){return!e||!t||t==="unknown"?!1:pi(e,t)>0}function qn(){let e=Et.join(si()||ai(),".velu");return Et.join(e,"update-check.json")}function Bn(){try{return JSON.parse(Jn(qn(),"utf8"))}catch{return null}}function fi(e){try{let t=qn();oi(Et.dirname(t),{recursive:!0}),ri(t,JSON.stringify(e))}catch{}}async function mi(){let e=`${li}/-/package/${Ze}/dist-tags`,t=new AbortController,r=setTimeout(()=>t.abort(),ui);try{let n=await fetch(e,{signal:t.signal,headers:{accept:"application/json"}});if(!n.ok)return null;let o=await n.json();return o&&typeof o.latest=="string"?o.latest:null}catch{return null}finally{clearTimeout(r)}}async function Pt({force:e=!1}={}){if(!e){let r=Bn();if(r?.latest&&Date.now()-(r.checkedAt||0)<ci)return r.latest}let t=await mi();return t?(fi({latest:t,checkedAt:Date.now()}),t):Bn()?.latest??null}function Gn(){let e=Q.env.npm_config_user_agent||"";if(e.startsWith("pnpm"))return"pnpm";if(e.startsWith("yarn"))return"yarn";if(e.startsWith("bun"))return"bun";let t="";try{t=ii(import.meta.url).replace(/\\/g,"/")}catch{}return t.includes("/pnpm/")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")?"yarn":t.includes("/.bun/")?"bun":"npm"}function di(e){let t=`${Ze}@latest`;switch(e){case"pnpm":return["pnpm",["add","-g",t]];case"yarn":return["yarn",["global","add",t]];case"bun":return["bun",["add","-g",t]];default:return["npm",["install","-g",t]]}}function Wn(e){let[t,r]=di(e);return Dn(t,r,{stdio:"inherit",shell:Q.platform==="win32"}).status===0}async function gi(){let e=Ct(),t=await Pt({force:!0});if(t&&!Lt(t,e)){console.log(`velu is already up to date (v${e}).`);return}let r=Gn();console.log(t?`Updating velu ${e} \u2192 ${t} (via ${r})\u2026`:`Could not reach the npm registry; installing ${Ze}@latest (via ${r}) anyway\u2026`),Wn(r)?console.log('\u2713 Updated. Run "velu version" to confirm.'):(console.error("Update failed. You can update manually with:"),console.error(` npm install -g ${Ze}@latest`),Q.exitCode=1)}async function hi(){if(Q.env.VELU_NO_UPDATE==="1"||Q.env.VELU_UPDATED==="1"||!Q.stdout.isTTY)return;let e=Ct();if(e==="unknown")return;let t=null;try{t=await Pt()}catch{return}if(!Lt(t,e))return;let r=Gn();if(console.log(`
87
- New velu version available: ${e} \u2192 ${t}. Updating\u2026`),!Wn(r)){console.log("Auto-update failed; continuing on the current version. Run `velu update` to retry.\n");return}console.log(`Restarting on the new version\u2026
88
- `);let n=Dn(Q.execPath,Q.argv.slice(1),{stdio:"inherit",env:{...Q.env,VELU_UPDATED:"1"}});Q.exit(n.status??0)}var Ze,li,ci,ui,Rt=_(()=>{Ze="@veluai/velu",li="https://registry.npmjs.org",ci=720*60*1e3,ui=3e3});import yi from"node:fs/promises";import Qe from"node:path";function Kn(e){if(!e.favicon)return null;let t=Qe.extname(e.favicon).toLowerCase();return{url:Ut+t,type:Hn[t]||""}}function Ft(e,t){let r=e.logo?.[t];if(!r)return null;let n=Qe.extname(r).toLowerCase();return{url:(t==="dark"?Re:_e)+n,type:Hn[n]||""}}function Ue(e){if(typeof e=="string"){let t=e.trim();return t?{light:t,dark:t,href:"/"}:null}if(e&&typeof e=="object"){let t=(e.light??e.dark)?.trim?.(),r=(e.dark??e.light)?.trim?.();return!t||!r?null:{light:t,dark:r,href:e.href?.trim?.()||"/"}}return null}function bi(e){return!e||typeof e!="object"?{metatags:{},indexing:"navigable"}:{metatags:e.metatags&&typeof e.metatags=="object"?e.metatags:{},indexing:e.indexing==="all"?"all":"navigable"}}function Nt(e={},t){let r=e.colors?.primary??vi;return{name:e.name??t??"docs",theme:Oe(e.theme),url:typeof process.env.VELU_SITE_URL=="string"&&process.env.VELU_SITE_URL.trim()?process.env.VELU_SITE_URL.trim().replace(/\/+$/,""):null,seo:bi(e.seo),assistant:Ce(e.assistant),thumbnails:e.thumbnails&&typeof e.thumbnails=="object"&&typeof e.thumbnails.background=="string"?{background:e.thumbnails.background}:null,colors:{primary:r,...["thulir","aalam","nila","kadhir"].includes(e.theme)?{cta:e.colors?.dark??r}:{},light:e.theme==="vepa"||["thulir","aalam","nila","kadhir"].includes(e.theme)?r:e.colors?.light??r,dark:e.theme==="vepa"||["thulir","aalam","nila","kadhir"].includes(e.theme)?e.colors?.light??r:e.colors?.dark??r},favicon:e.favicon??null,api:Y(e.api),logo:Ue(e.logo),footer:Te(e.footer),navbar:Ee(e.navbar),font:{family:Ln(e)},navigation:e.navigation??null}}async function Xn(e){let t=Qe.join(e,"velu.json"),r;try{r=await yi.readFile(t,"utf-8")}catch(o){throw o.code==="ENOENT"?new Error(`No velu.json found in ${e}. Run \`velu init <name>\` to scaffold one.`):o}let n;try{n=JSON.parse(r)}catch(o){throw new Error(`velu.json is not valid JSON: ${o.message}`)}return Nt(n,Qe.basename(e))}function Yn(e){let{colors:t,font:r}=e;return jt({light:t.light,dark:t.dark,family:r.family,theme:e.theme,primary:t.primary,cta:t.cta})}var vi,_e,Re,Ut,Hn,Fe=_(()=>{Le();Le();vi="#dc143c",_e="/@velu-logo-light",Re="/@velu-logo-dark",Ut="/@velu-favicon",Hn={".svg":"image/svg+xml",".ico":"image/x-icon",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif"}});import{visit as Zn}from"unist-util-visit";import{toString as xi}from"mdast-util-to-string";import wi from"github-slugger";import{valueToEstree as $i}from"estree-util-value-to-estree";function Si(e,t){let r=a=>String(a||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),n=r(e),o=t==null||t===""?"":r(t);return`update-${o?n?`${n}-${o}`:o:n||"item"}`}function It(e,t){let r=(e.attributes||[]).find(n=>n&&n.type==="mdxJsxAttribute"&&n.name===t);if(r)return typeof r.value=="string"?r.value:void 0}function ki(e){let t=(e.attributes||[]).find(a=>a&&a.type==="mdxJsxAttribute"&&a.name==="tags");if(!t)return[];if(typeof t.value=="string")return[t.value];let r=t.value&&t.value.value?String(t.value.value):"",n=[],o=/["'`]([^"'`]+)["'`]/g,i;for(;i=o.exec(r);)n.push(i[1]);return n}function Ne(){return e=>{let t=new wi,r=[];Zn(e,"heading",l=>{let c=xi(l);r.push({depth:l.depth,id:t.slug(c),label:c})});let n=[],o=[],i=new Set;if(Zn(e,"mdxJsxFlowElement",l=>{if(l.name!=="Update")return;let c=It(l,"label")??It(l,"date"),u=It(l,"description");c&&n.push({id:Si(c,u),label:u||c});for(let p of ki(l)){let y=p.trim().toLowerCase();p.trim()&&!i.has(y)&&(i.add(y),o.push(p.trim()))}}),n.length){Qn(e,n),Mt(e,"changelog",{tags:o});return}let a={children:[]},s=[{node:a,depth:0}];for(let l of r){for(;s.length>1&&s[s.length-1].depth>=l.depth;)s.pop();let c={id:l.id,label:l.label},u=s[s.length-1].node;u.children||(u.children=[]),u.children.push(c),s.push({node:c,depth:l.depth})}Qn(e,a.children),Mt(e,"changelog",null)}}function Qn(e,t){Mt(e,"toc",t)}function Mt(e,t,r){e.children.unshift({type:"mdxjsEsm",value:"",data:{estree:{type:"Program",sourceType:"module",body:[{type:"ExportNamedDeclaration",specifiers:[],declaration:{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:t},init:$i(r)}]}}]}}})}var zt=_(()=>{});import{visit as ji}from"unist-util-visit";function Vt(){return e=>{ji(e,"code",t=>{let r=(t.meta||"").trim();if(!r)return;let n={},o=r.match(/\btitle="([^"]*)"/);o&&(n["data-title"]=o[1],r=(r.slice(0,o.index)+r.slice(o.index+o[0].length)).trim());let i=r.match(/\{([\d,\s-]+)\}/);i&&(n["data-highlight"]=i[1].replace(/\s+/g,""),r=(r.slice(0,i.index)+r.slice(i.index+i[0].length)).trim()),r=r.replace(/\blineNumbers\b/,()=>(n["data-line-numbers"]="","")).trim(),r&&(n["data-filename"]=r),Object.keys(n).length&&(t.data=t.data||{},t.data.hProperties={...t.data.hProperties||{},...n})})}}var er=_(()=>{});import Ai from"node:fs";import tr from"node:path";function ae(e,t){let r=[],n=[],o=new Set;for(let i of ne(e)){if(i.node?.api){o.add(i.url);continue}if(o.has(i.url)){r.push(`duplicate URL "${i.url}" (page "${i.pagePath}") \u2014 keeping the first occurrence`);continue}o.add(i.url);let a=i.pagePath.replace(/^\/+|\/+$/g,""),s=tr.join(t,...a.split("/"))+".mdx",l=Ai.existsSync(s);l||r.push(`page "${i.pagePath}" \u2192 ${tr.relative(t,s)} not found`),n.push({pagePath:i.pagePath,url:i.url,fileAbsPath:s,exists:l})}return{pageEntries:n,warnings:r}}var Ie=_(()=>{re()});import Oi from"@apidevtools/swagger-parser";async function Ti(e){return Oi.dereference(e)}async function nr(e){return Ae(await Ti(e))}var rr=_(()=>{Ke();Ke()});function or(e,t){if(!t||typeof t!="object")return e;let r=Y(t);return{server:t.server!=null?r.server:e?.server??null,proxy:t.playground!=null?r.proxy:e?.proxy!==!1,languages:t.examples?.languages!=null?r.languages:e?.languages}}function Ei(e,{base:t,api:r,ops:n}){let o=r?.server,i=r?.languages||$t,a={proxy:r?.proxy!==!1,server:o??null},s=new Map;for(let c of e){let u=c.op.tags?.[0]||"API";s.has(u)||s.set(u,[]),s.get(u).push(c)}let l=[];for(let[c,u]of s){let p=u.map(({op:y,segment:m})=>{let g=`${t}/${Bt(c)}/${y.id}`;return n[g]={operation:y,samples:Xe(y,{server:o||y.servers?.[0],languages:i}),segment:m,title:y.title,description:y.description,method:y.method,api:a},{apiPage:g,label:y.title,method:y.method}});l.push({group:c,pages:p})}return l}async function ir(e,{loadOps:t,base:r,api:n,ops:o}){let i=Array.isArray(e)?e:[e],a=[];for(let s of i){let{operations:l,segments:c,servers:u}=await t(s);l.forEach((p,y)=>{!p.servers?.length&&u?.length&&(p.servers=u),a.push({op:p,segment:c[y]})})}return Ei(a,{base:r,api:n,ops:o})}async function sr(e,t){if(!e||typeof e!="object")return e;if(typeof e.tab=="string"&&e.openapi){let n=Bt(e.tab),o=or(t.api,e.api),i=await ir(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e;return{...l,groups:[...l.groups||[],...i]}}if(typeof e.group=="string"&&e.openapi){let n=Bt(e.group),o=or(t.api,e.api),i=await ir(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e,c=i.flatMap(u=>u.pages);return{...l,pages:[...l.pages||[],...c]}}let r={...e};for(let n of["products","versions","languages","tabs","groups"])Array.isArray(e[n])&&(r[n]=await Promise.all(e[n].map(o=>sr(o,t))));return r}async function ar(e,{api:t,loadOps:r}){let n={};return!e||typeof e!="object"?{nav:e,ops:n}:{nav:await sr(e,{api:t,loadOps:r,ops:n}),ops:n}}var Bt,lr=_(()=>{Le();St();Bt=e=>String(e??"").replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()||"x"});import Ci from"node:path";function Li(e,t){return/^https?:\/\//.test(e)?e:Ci.resolve(t,e.replace(/^\/+/,""))}async function et(e,{targetDir:t,api:r}={}){return ar(e,{api:r,loadOps:n=>nr(Li(n,t))})}var Dt=_(()=>{rr();lr()});import ur from"node:fs";import ye from"node:path";import{createHash as Pi}from"node:crypto";function Me(e,{outDir:t}={}){let r=ye.resolve(e),n=t?ye.resolve(t):null,o=[],i=[],a=l=>{let c;try{c=ur.readdirSync(l,{withFileTypes:!0})}catch{return}for(let u of c){let p=ye.join(l,u.name);if(u.isDirectory()){if(u.name.startsWith(".")||Ri.has(u.name)||n&&p===n)continue;a(p);continue}if(!u.isFile())continue;let y=ye.extname(u.name).toLowerCase();if(y!==cr&&y!==_i)continue;let m=ye.relative(r,p).split(ye.sep).join("/"),g={rel:m,abs:p,url:`${tt}/${m.split("/").map(encodeURIComponent).join("/")}?v=${Ui(p)}`,kind:y===cr?"css":"js"};(g.kind==="css"?o:i).push(g)}};a(r);let s=(l,c)=>l.rel<c.rel?-1:l.rel>c.rel?1:0;return o.sort(s),i.sort(s),{styles:o,scripts:i}}function Ui(e){try{return Pi("sha1").update(ur.readFileSync(e)).digest("hex").slice(0,8)}catch{return"0"}}function pr(e,t){let r=`${tt}/`;if(!t.startsWith(r))return null;let n;try{n=decodeURIComponent(t.slice(r.length))}catch{return null}return[...e.styles,...e.scripts].find(o=>o.rel===n)??null}function fr(e,t=""){return(e?.styles??[]).map(r=>`<link rel="stylesheet" href="${Fi(t+r.url)}" data-velu-custom />`).join(`
89
- `)}var tt,cr,_i,Ri,Fi,Jt=_(()=>{tt="/@velu-custom",cr=".css",_i=".js",Ri=new Set(["node_modules","public","dist"]);Fi=e=>String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")});import Ni from"node:fs";import ze from"node:path";function gr(e,{buildOutDir:t}={}){return{name:"velu-site",resolveId(r){return r===dr?mr:null},async load(r){return r!==mr?null:Ii(e,{buildOutDir:t})}}}async function Ii(e,{buildOutDir:t}={}){let r={};try{r=JSON.parse(Ni.readFileSync(ze.join(e,"velu.json"),"utf-8"))}catch{}let n=Y(r.api),o=r.navigation??{},i={};try{let x=await et(r.navigation??{},{targetDir:e,api:n});o=x.nav,i=x.ops}catch(x){console.warn(`[velu] openapi: ${x.message}`)}let a=X(o),{pageEntries:s,warnings:l}=ae(a,e);for(let x of l)console.warn(`[velu] nav: ${x}`);let c=Ue(r.logo),u={name:r.name??ze.basename(e),theme:Oe(r.theme),logo:c?{light:Ft({logo:c},"light")?.url??_e,dark:Ft({logo:c},"dark")?.url??Re,href:c.href,mono:c.light===c.dark}:null,footer:Te(r.footer),navbar:Ee(r.navbar),contextual:At(r.contextual??(["thulir","aalam","nila","kadhir"].includes(r.theme)?{options:[]}:void 0)),assistant:Ce(r.assistant),customScripts:Me(e,{outDir:t}).scripts.map(x=>x.url)},p=[],y=[],m=0;for(let x of s){if(!x.exists)continue;let w=JSON.stringify(x.fileAbsPath.split(ze.sep).join("/")),L=JSON.stringify(ze.relative(e,x.fileAbsPath).split(ze.sep).join("/")),P=`__p${m++}`;p.push(`import * as ${P} from ${w};`),y.push(` ${JSON.stringify(x.url)}: { Component: ${P}.default, frontmatter: ${P}.frontmatter, toc: ${P}.toc, changelog: ${P}.changelog, relPath: ${L}, ...__mdxApi(${P}) },`)}let g=new Set(s.filter(x=>x.exists).map(x=>x.url));for(let x of s)!x.exists&&!g.has(x.url)&&y.push(` ${JSON.stringify(x.url)}: { missing: true },`);let v=[],d=[],h=[],S=!1,O=0;for(let x of ne(a)){if(!x.node?.api)continue;let w=i[x.pagePath];if(!w)continue;S=!0;let L=`__op${O}`,P=`__samples${O}`,B=`__api${O}`;O+=1,v.push(`const ${L} = ${JSON.stringify(w.operation)};`),v.push(`const ${P} = ${JSON.stringify(w.samples)};`),h.push(`{ id: ${JSON.stringify(w.operation.id)}, method: ${JSON.stringify(w.operation.method)}, title: ${JSON.stringify(w.operation.title)}, url: ${JSON.stringify(x.url)}, operation: ${L}, samples: ${P}, api: ${JSON.stringify(w.api||{proxy:!0,server:null})} }`),d.push(`function ${B}(){ return React.createElement(ApiReferencePage, { preset: ${JSON.stringify(u.theme)}, operation: ${L}, samples: ${P}, apiOperations: __apiOperations, api: ${JSON.stringify(w.api||{proxy:!0,server:null})} }); }`),y.push(` ${JSON.stringify(x.url)}: { Component: ${B}, frontmatter: { title: ${JSON.stringify(w.title)}, description: ${JSON.stringify(w.description)} }, toc: [], operation: ${L}, samples: ${P}, api: true },`)}S&&(v.push(`const __apiOperations = [
90
- ${h.join(`,
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(",")}};
89
+ export const site=${JSON.stringify({...r,assistant:r.assistant?{apiBase:r.assistant.apiBase,host:r.assistant.host}:null,guarded:!0})};
90
+ export let navigation={kind:'root',children:[]};
91
+ export const pages={};
92
+ export async function initializeReader(){
93
+ const base=(import.meta.env.BASE_URL || '/').replace(/\\/$/,'');
94
+ const response=await fetch(base+'/@velu-reader/catalog',{credentials:'same-origin',cache:'no-store'});
95
+ if(!response.ok)throw Error('Unable to load documentation access.');
96
+ const catalog=await response.json();navigation=catalog.navigation;site.readerPrivate=catalog.private;site.readerRestricted=catalog.restricted;
97
+ 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
+ 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 = [
101
+ ${P.join(`,
91
102
  `)}
92
- ];`),v.push(d.join(`
93
- `)));let A=[];return S&&(A.push("import React from 'react';"),A.push("import { ApiReferencePage } from 'velu-ui';")),["// AUTO-GENERATED by vite-plugin-velu-site. Do not edit.",A.join(`
94
- `),p.join(`
95
- `),"function __mdxApi(mod) { const data = Reflect.get(mod, 'veluApi'); return data?.operation ? { mdxApi: data, api: true, operation: data.operation, samples: data.samples } : {}; }",v.join(`
96
- `),"","export const pages = {",y.join(`
97
- `),"};",`export const navigation = ${JSON.stringify(a)};`,`export const site = ${JSON.stringify(u)};`,"if (site.logo) {"," const __veluBase = (import.meta.env.BASE_URL || '/').replace(/\\/$/, '');"," site.logo = { ...site.logo, light: __veluBase + site.logo.light, dark: __veluBase + site.logo.dark };","}",""].join(`
98
- `)}var dr,mr,hr=_(()=>{re();Ie();Fe();Dt();Jt();dr="virtual:velu-site",mr="\0"+dr});import nt from"node:path";function yr(e){let t=nt.resolve(e);return{name:"velu-tailwind-project-source",enforce:"pre",transform(r,n){let o=n.split("?",1)[0].replace(/\\/g,"/");if(!o.endsWith("/styles.css")||!o.includes("/velu-ui/")||r.includes("data-velu-project-source"))return null;let i=nt.dirname(n.split("?",1)[0]),a=nt.relative(i,t).split(nt.sep).join("/");!a||a===""?a=".":a.startsWith(".")||(a=`./${a}`);let s=`
103
+ ];`),h.push($.join(`
104
+ `)));let S=[];return E&&(S.push("import React from 'react';"),S.push("import { ApiReferencePage } from 'velu-ui';")),["// AUTO-GENERATED by vite-plugin-velu-site. Do not edit.",S.join(`
105
+ `),f.join(`
106
+ `),"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
+ `),"","export async function initializeReader() {}","export const pages = {",g.join(`
108
+ `),"};",`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=`
99
110
  /* data-velu-project-source */
100
111
  @source "${a}/**/*.{mdx,md,jsx,tsx,js,ts,html}";
101
112
  @source not "${a}/node_modules";
102
113
  @source not "${a}/.velu";
103
114
  @source not "${a}/dist";
104
115
  @source not "${a}/.git";
105
- `;return{code:r+s,map:null}}}}var vr=_(()=>{});import{visit as Mi}from"unist-util-visit";function zi(e,t){let r=br(e).replace(/[?#].*$/,""),n=br(t).replace(/\/+$/,"");return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):null}function xr(e,t){return()=>(r,n)=>{typeof e=="function"&&Mi(r,o=>{if(o.type!=="mdxJsxFlowElement"&&o.type!=="mdxJsxTextElement"||typeof o.name!="string"||!/^[A-Z]/.test(o.name)||o.name.includes("."))return;let i={};for(let s of o.attributes||[])s.type==="mdxJsxAttribute"&&(s.value==null?i[s.name]=!0:typeof s.value=="string"&&(i[s.name]=s.value));let a=e(o.name,i,{checkRequired:!1});if(a){let s=new Error(a.title);throw s.veluIssue={...a,file:zi(n?.path,t),line:o.position?.start?.line??null,column:o.position?.start?.column??null},s.loc={line:s.veluIssue.line,column:s.veluIssue.column},s}})}}var br,wr=_(()=>{br=e=>String(e||"").replace(/\\/g,"/")});import rt from"node:path";import Vi from"node:fs";import{createRequire as Bi}from"node:module";import Di from"@tailwindcss/vite";import Ji from"@vitejs/plugin-react";import qi from"@mdx-js/rollup";import Gi from"remark-frontmatter";import Wi from"remark-mdx-frontmatter";import Hi from"remark-gfm";import Ki from"rehype-slug";function Xi(e){let r=Bi(import.meta.url).resolve("@mdx-js/react"),n=rt.resolve(e,"runtime","velu-ui"),o=Vi.existsSync(n)?n:rt.resolve(e,"..","velu-ui","src");return[{find:"@mdx-js/react",replacement:r},{find:/^velu-ui$/,replacement:rt.join(o,"index.js")},{find:/^velu-ui\//,replacement:o+"/"}]}function $r({targetDir:e,VITE_ROOT:t,validateProps:r,basePath:n,buildOutDir:o}){return{root:t,base:n?`${n}/`:"/",plugins:[gr(e,{buildOutDir:o}),qi({remarkPlugins:[Gi,Wi,Hi,Vt,Ne,xr(r,e)],rehypePlugins:[Ki],providerImportSource:"@mdx-js/react"}),Ji(),yr(e),Di({optimize:!1})],cacheDir:rt.resolve(e,".velu","vite-cache"),optimizeDeps:{include:["react","react-dom","react-dom/client","react-router-dom","@mdx-js/react","lucide-react","prism-react-renderer","iso-639-1","github-slugger"],exclude:["tailwindcss","@tailwindcss/oxide","playwright","playwright-core","@apidevtools/swagger-parser","satori","@resvg/resvg-js","pagefind"],esbuildOptions:{loader:{".mdx":"jsx"}}},resolve:{alias:Xi(t),dedupe:["react","react-dom","@mdx-js/react"]}}}var Sr=_(()=>{zt();er();hr();vr();wr()});function I(e){return{category:"render-crash",severity:"error",file:null,line:null,column:null,frame:null,title:"Something went wrong",detail:"",hint:"",suggestion:null,...e}}function Yi(e,t){if(e=String(e),t=String(t),e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let r=Array.from({length:t.length+1},(o,i)=>i),n=new Array(t.length+1);for(let o=1;o<=e.length;o++){n[0]=o;for(let i=1;i<=t.length;i++){let a=e[o-1]===t[i-1]?0:1;n[i]=Math.min(n[i-1]+1,r[i]+1,r[i-1]+a)}[r,n]=[n,r]}return r[t.length]}function ot(e,t=[]){if(!e)return null;let r=String(e).toLowerCase(),n=null,o=1/0;for(let a of t){let s=Yi(r,String(a).toLowerCase());s<o&&(o=s,n=a)}let i=Math.min(3,Math.max(2,Math.floor(r.length/4)));return o<=i?n:null}function Zi(e,t){return e==="warning"?Z(t,H.yellow,"\u26A0"):e==="info"?Z(t,H.cyan,"\u2139"):Z(t,H.red,"\u2716")}function Gt(e,{color:t=!1}={}){let r=qt[e.category]||e.category,n=e.line?`${e.line}${e.column?`:${e.column}`:""}`:"",o=e.file?`${e.file}${n?`:${n}`:""}`:n,i=[];if(i.push(`${Zi(e.severity,t)} ${Z(t,H.bold,r)}`+(o?` ${Z(t,H.dim,o)}`:"")),e.title&&i.push(` ${e.title}`),e.detail&&e.detail!==e.title&&i.push(` ${Z(t,H.dim,e.detail)}`),e.frame)for(let a of String(e.frame).split(`
106
- `))i.push(` ${a}`);return e.suggestion&&i.push(` ${Z(t,H.cyan,`Did you mean <${e.suggestion}>?`)}`),e.hint&&i.push(` ${Z(t,H.dim,`\u2192 ${e.hint}`)}`),i.join(`
107
- `)}function it(e,{color:t=!1}={}){if(!e.length)return Z(t,H.cyan,"\u2713 No issues found.");let r=new Map;for(let s of e){let l=s.file||"velu.json";r.has(l)||r.set(l,[]),r.get(l).push(s)}let n=[];for(let[s,l]of r){n.push(Z(t,H.bold,s));for(let c of l)n.push(Gt({...c,file:null},{color:t}).replace(/^/gm," "));n.push("")}let o=e.filter(s=>s.severity!=="warning"&&s.severity!=="info").length,i=e.length-o,a=`${o} error${o===1?"":"s"}`+(i?`, ${i} warning${i===1?"":"s"}`:"");return n.push(Z(t,o?H.red:H.yellow,a)),n.join(`
108
- `)}var qt,H,Z,ue=_(()=>{qt={"mdx-syntax":"MDX syntax",frontmatter:"Frontmatter","unknown-component":"Unknown component","invalid-props":"Invalid options","render-crash":"Render error","config-json":"velu.json","config-schema":"velu.json","config-nav":"Navigation","config-asset":"Asset"};H={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},Z=(e,t,r)=>e?`${t}${r}${H.reset}`:r});function Qi(e){let t=e,r=0;for(;t&&t.cause&&r<3&&!(t.loc||t.line||/`[^`]+` to be defined/.test(t.message||""));)t=t.cause,r+=1;return t||e}function Wt(e,t){if(!e)return null;let r=kr(e).replace(/[?#].*$/,""),n=t?kr(t).replace(/\/+$/,""):"";return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):!/^([a-zA-Z]:\/|\/)/.test(r)&&!/node_modules/.test(r)?r:null}function es(e){return e?String(e).replace(/([a-zA-Z]:\\|\/)[^\s'"()]+/g,t=>/node_modules|[\\/]vite[\\/]|@veluai|velu-cli|velu-ui/.test(t)?"\u2026":t).trim():""}function ts(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function ns(e){return String(e||"").replace(/\s*\(\d+:\d+(?:-\d+:\d+)?\)\s*$/,"").trim()}function os(e,t){if(!e||!t)return null;let r=String(e);return/node_modules|[\\/]vite[\\/]|@veluai[\\/]/.test(r)?null:r}function Ve(e,t={}){let{projectDir:r="",knownComponents:n=[],file:o=null}=t,i=null;for(let h=e,S=0;h&&S<6;h=h.cause,S+=1)if(h.veluIssue){i=h.veluIssue;break}if(i)return I({...i,file:i.file||o});let a=Qi(e)||{},s=a.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(s);if(l){let h=l[1],S=/referenced in your code at `(\d+):(\d+)/.exec(s),O=/\bin `([^`]+)`/.exec(s),A=O?Wt(O[1],r):null;return I({category:"unknown-component",file:A||o,line:S?Number(S[1]):null,column:S?Number(S[2]):null,title:`<${h}> is not a built-in component`,detail:"",hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:ot(h,n)})}let c=a.loc||(a.line!=null?{line:a.line,column:a.column,file:a.file}:null)||ts(a.reason||s),u=a.id||c&&c.file||a.file||null,p=Wt(u,r)||o,y=!!p&&Wt(u,r)!=null,m=os(a.frame,y||!!o),g=es(ns(a.reason||s)),v=rs.test(s),d=a.source==="remark-frontmatter"||/\byaml\b|frontmatter/i.test(s)||c&&c.line===1&&/unexpected|expected/i.test(s)&&/---/.test(s);return c||v||m&&y?I({category:d?"frontmatter":"mdx-syntax",file:p,line:c?c.line:null,column:c?c.column:null,frame:m,title:g||(d?"Invalid frontmatter":"MDX syntax error"),detail:"",hint:d?"Check the YAML between the --- markers \u2014 indentation, quotes, and colons.":"Make sure every <Component> has a matching closing tag and that { } braces are balanced."}):/\.map is not a function|is not iterable|reading '|undefined \(reading/i.test(s)?I({category:"invalid-props",file:p,title:"A component received an invalid value",detail:g,hint:"Check the props/options you passed to a component on this page."}):I({category:"render-crash",file:p,title:"This page failed to render",detail:g,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var kr,rs,Ht=_(()=>{ue();kr=e=>String(e).replace(/\\/g,"/");rs=/closing tag|unexpected closing|could not parse (?:expression|import|export)|unexpected character|unexpected end of|expected a closing|expected the closing|unexpected `|in expression|misnested|before name/i});function is(e){let t=qt[e.category]||e.category,r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",n=[];return n.push('<div class="velu-err-card">'),n.push('<div class="velu-err-head">'),n.push(`<span class="velu-err-pill">${oe(t)}</span>`),n.push("</div>"),e.title&&n.push(`<div class="velu-err-title">${oe(e.title)}</div>`),r&&n.push(`<a class="velu-err-loc" title="${oe(r)}">${oe(r)}</a>`),e.detail&&n.push(`<div class="velu-err-detail">${oe(e.detail)}</div>`),e.frame&&n.push(`<pre class="velu-err-frame">${oe(e.frame)}</pre>`),e.suggestion&&n.push(`<div class="velu-err-suggest">Did you mean <code>&lt;${oe(e.suggestion)}&gt;</code>?</div>`),e.hint&&n.push(`<div class="velu-err-hint">${oe(e.hint)}</div>`),n.push("</div>"),n.join("")}function Kt(e,t={}){let r=Array.isArray(e)?e:[e],n=t.title||(r.length>1?`${r.length} problems to fix`:"There\u2019s a problem to fix"),o=r.map(is).join(`
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(`
117
+ `))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(`
109
120
  `);return`<!doctype html>
110
121
  <html lang="en">
111
122
  <head>
@@ -177,38 +188,38 @@ ${h.join(`,
177
188
  <div class="velu-err-foot">Fix the file and save \u2014 this page reloads automatically.</div>
178
189
  </div>
179
190
  </body>
180
- </html>`}var oe,jr=_(()=>{ue();oe=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")});import st from"node:fs";import De from"node:path";import{fileURLToPath as ss}from"node:url";import as from"iso-639-1";function Be(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
181
- `).length}function us(e,t){return t==null||t<0?null:e.slice(0,t).split(`
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(`
182
193
  `).length}function Xt(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
183
- `).length}function ps(e,t,r){let n=[];return s(e,t,"",null),n;function o(l){if(l&&l.$ref){let c=l.$ref.replace(/^#\//,"").split("/"),u=r;for(let p of c)u=u?.[p];return u||{}}return l}function i(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function a(l,c){let u=n.length;s(l,c,"",null,!0);let p=n.length===u;return p||(n.length=u),p}function s(l,c,u,p,y){let m=o(c);if(m){if(m.oneOf){m.oneOf.some(v=>a(l,v))||n.push({path:u,key:p,message:"value does not match any allowed shape"});return}if(m.type&&i(l)!==m.type){n.push({path:u,key:p,message:`expected ${m.type}, got ${i(l)}`});return}if(m.type==="string"&&m.minLength!=null&&l.length<m.minLength&&n.push({path:u,key:p,message:"must not be empty"}),m.type==="object"&&i(l)==="object"){for(let v of m.required||[])v in l||n.push({path:u?`${u}.${v}`:v,key:v,message:`missing required "${v}"`});let g=m.properties||{};if(m.additionalProperties===!1)for(let v of Object.keys(l))v in g||n.push({path:u?`${u}.${v}`:v,key:v,message:`unknown field "${v}"`});for(let[v,d]of Object.entries(g))v in l&&s(l[v],d,u?`${u}.${v}`:v,v,y)}m.type==="array"&&Array.isArray(l)&&m.items&&l.forEach((g,v)=>s(g,m.items,`${u}[${v}]`,p,y))}}}function fs(e){if(typeof e!="string")return!1;let t=e.trim();return/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^(rgb|rgba|hsl|hsla|color|oklch|lab|lch)\(/i.test(t)||/^[a-z][a-z0-9-]*$/i.test(t)}function at(e){let t=[],r=De.join(e,"velu.json"),n;try{n=st.readFileSync(r,"utf-8")}catch(s){return s.code==="ENOENT"?t.push(I({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(I({category:"config-json",file:"velu.json",title:"Could not read velu.json"})),t}let o;try{o=JSON.parse(n)}catch(s){let l=/position (\d+)/.exec(s.message||""),c=l?us(n,Number(l[1])):null;return t.push(I({category:"config-json",file:"velu.json",line:c,title:"velu.json is not valid JSON",detail:String(s.message||"").replace(/\s+in JSON.*$/,""),hint:"Check for a trailing comma, a missing quote, or an unclosed brace."})),t}let i=null;try{i=JSON.parse(st.readFileSync(cs,"utf-8"))}catch{}if(i)for(let s of ps(o,i,i)){let l=/^unknown field/.test(s.message);t.push(I({category:"config-schema",severity:l?"warning":"error",file:"velu.json",line:Be(n,s.key),title:s.path?`${s.path}: ${s.message}`:s.message,hint:l?"Remove it, or check the spelling against the velu.json schema.":""}))}for(let s of["primary","light","dark"]){let l=o.colors?.[s];l!=null&&!fs(l)&&t.push(I({category:"config-schema",severity:"warning",file:"velu.json",line:Be(n,s),title:`colors.${s}: "${l}" doesn\u2019t look like a CSS color`,hint:"Use a hex value like #dc143c, an rgb()/hsl() function, or a CSS color name."}))}if(typeof o.favicon=="string"&&o.favicon.trim()){let s=De.resolve(e,o.favicon.replace(/^\/+/,""));st.existsSync(s)||t.push(I({category:"config-asset",file:"velu.json",line:Be(n,"favicon"),title:`favicon not found: ${o.favicon}`,hint:"The path is relative to the project root."}))}let a=Ue(o.logo);if(a){let s=new Map;for(let l of["light","dark"]){let c=a[l];c&&s.set(c,[...s.get(c)||[],l])}for(let[l,c]of s)if(!st.existsSync(De.resolve(e,l.replace(/^\/+/,"")))){let u=c.length===2?"logo":`logo (${c[0]})`;t.push(I({category:"config-asset",file:"velu.json",line:Xt(n,l),title:`${u} not found: ${l}`,hint:"The path is relative to the project root."}))}}if(o.navigation&&typeof o.navigation=="object"){let s;try{s=X(o.navigation)}catch(l){t.push(I({category:"config-nav",file:"velu.json",line:Be(n,"navigation"),title:"navigation could not be processed",detail:String(l.message||"")})),s=null}if(s){let{pageEntries:l,warnings:c}=ae(s,e);for(let u of c){let p=/not found$/.test(u),y=/page "([^"]+)"/.exec(u),m=y?Xt(n,y[1]):null;t.push(I({category:"config-nav",severity:p?"error":"warning",file:"velu.json",line:m,title:u,hint:p?"Create the .mdx file, or remove the page from navigation.":""}))}ms(s,n,t)}}return t}function ms(e,t,r){let n=new Set,o=i=>{if(!(!i||typeof i!="object")){if(i.language&&!n.has(i.language)){n.add(i.language);let a=String(i.language).toLowerCase();as.validate(a)||r.push(I({category:"config-nav",severity:"warning",file:"velu.json",line:Xt(t,i.language)||Be(t,"language"),title:`"${i.language}" is not a valid ISO 639-1 language code`,hint:'Use a two-letter code like "en", "fr", or "ja".'}))}for(let a of Object.values(i))Array.isArray(a)?a.forEach(o):a&&typeof a=="object"&&o(a)}};o(e)}var ls,cs,Yt=_(()=>{ue();re();Ie();Fe();ls=De.dirname(ss(import.meta.url)),cs=De.resolve(ls,"..","..","schema","velu.schema.json")});import ds from"node:fs/promises";import gs from"node:fs";import pe from"node:path";import{fileURLToPath as hs,pathToFileURL as ys}from"node:url";import{compile as vs}from"@mdx-js/mdx";import bs from"remark-frontmatter";import xs from"remark-mdx-frontmatter";import ws from"remark-gfm";import $s from"rehype-slug";import{visit as Ss}from"unist-util-visit";function Zt(){if(lt)return lt;let e=pe.dirname(hs(import.meta.url)),t=[pe.resolve(e,"..","runtime","velu-ui"),pe.resolve(e,"..","..","runtime","velu-ui"),pe.resolve(e,"..","..","..","velu-ui","src")],r=null;for(let n of t){let o=pe.join(n,"lib","component-schemas.js");if(gs.existsSync(o)){r=o;break}}return lt=r?import(ys(r).href).then(n=>n.validateProps).catch(()=>null):Promise.resolve(null),lt}function ks(e){let t={};for(let r of e.attributes||[])r.type==="mdxJsxAttribute"&&(r.value==null?t[r.name]=!0:typeof r.value=="string"&&(t[r.name]=r.value));return t}function js(e,t){return()=>r=>{Ss(r,n=>{if((n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")&&typeof n.name=="string"&&/^[A-Z]/.test(n.name)&&!n.name.includes(".")&&e.push({name:n.name,props:ks(n),line:n.position?.start?.line??null,column:n.position?.start?.column??null}),n.type==="mdxjsEsm"&&typeof n.value=="string")for(let o of n.value.matchAll(/\b([A-Z][A-Za-z0-9_]*)\b/g))t.add(o[1])})}}async function As(e,t){let r=[],n;try{n=await ds.readFile(t.fileAbsPath,"utf-8")}catch{return r}let o=pe.relative(e,t.fileAbsPath).split(pe.sep).join("/"),i=[],a=new Set;try{await vs({value:n,path:t.fileAbsPath},{remarkPlugins:[bs,xs,ws,Ne,js(i,a)],rehypePlugins:[$s],providerImportSource:"@mdx-js/react"})}catch(u){return r.push(Ve(u,{projectDir:e,knownComponents:te,file:o})),r}let s=new Set(te),l=await Zt(),c=new Set;for(let u of i)if(!a.has(u.name)){if(!s.has(u.name)){if(c.has(u.name))continue;c.add(u.name),r.push(I({category:"unknown-component",file:o,line:u.line,column:u.column,title:`<${u.name}> is not a built-in component`,hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:ot(u.name,te)}));continue}if(l){let p=l(u.name,u.props,{checkRequired:!1});p&&r.push(I({...p,file:o,line:u.line,column:u.column}))}}return r}async function Ar(e,t){let r=t.filter(s=>s.exists),n=[],o=8,i=0;async function a(){for(;i<r.length;){let s=r[i++],l=await As(e,s);for(let c of l)n.push(c)}}return await Promise.all(Array.from({length:Math.min(o,r.length)},a)),n}var lt,Qt=_(()=>{zt();ue();Ht();We()});import qe from"node:fs";import en from"node:path";import Er from"js-yaml";function tn(e,t,r){if(r>24||e===null||typeof e!="object")return r>24&&e&&typeof e=="object"?null:e;if(t.has(e))return null;t.add(e);let n;if(Array.isArray(e))n=e.map(o=>tn(o,t,r+1));else{n={};for(let[o,i]of Object.entries(e))n[o]=tn(i,t,r+1)}return t.delete(e),n}function Cr(e){return Er.dump(tn(e,new Set,0),{noRefs:!0,lineWidth:100,skipInvalid:!0})}function Lr(e){let t=String(e).replace(/\.md$/i,"");return t===""||t==="/"||t==="/index"?"/":t.replace(/\/+$/,"")||"/"}function Os(e){return e==="/"?"/index.md":`${e}.md`}function nn(e,t){if(t==="api")return`# ${Or}
184
- ${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${Or}
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}
185
196
 
186
- `;return r?e.slice(0,r[0].length)+n+e.slice(r[0].length):n+e}function Es(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function Cs(e){try{let t=qe.readFileSync(e,"utf-8").match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return{};let r=Er.load(t[1]);return r&&typeof r=="object"?r:{}}catch{return{}}}async function xe(e){let t={};try{t=JSON.parse(qe.readFileSync(en.join(e,"velu.json"),"utf-8"))}catch{return{name:en.basename(e),baseUrl:"",pages:[]}}let r=t.name??en.basename(e),n=typeof process.env.VELU_SITE_URL=="string"?process.env.VELU_SITE_URL.replace(/\/+$/,""):"",o=Y(t.api),i=t.navigation??{},a={};try{let p=await et(t.navigation??{},{targetDir:e,api:o});i=p.nav,a=p.ops}catch(p){console.warn(`[velu] openapi: ${p.message}`)}let s=X(i),{pageEntries:l}=ae(s,e),c=new Map(l.map(p=>[p.url,p])),u=[];for(let p of ne(s)){if(!p.url)continue;let y=p.ancestors.filter(h=>h.kind==="group").pop(),m=p.ancestors.filter(h=>h.kind==="tab").pop(),g=y?.label||m?.label||"Pages",v=p.ancestors.filter(h=>h.kind==="tab"||h.kind==="group").map(h=>h.label),d=p.ancestors.filter(h=>h.kind==="language").pop()?.code||null;if(p.node?.api){let h=a[p.pagePath];if(!h)continue;let S=h.title||Tr(p.url);u.push({url:p.url,title:S,description:h.description||"",group:g,breadcrumb:[...v,S],lang:d,frontmatter:{title:h.title,description:h.description},source:{kind:"api",segment:h.segment}})}else{let h=c.get(p.url);if(!h||!h.exists)continue;let S=Cs(h.fileAbsPath),O=S.title||Tr(p.url);u.push({url:p.url,title:O,description:S.description||"",group:g,breadcrumb:[...v,O],lang:d,frontmatter:S,source:{kind:"mdx",fileAbsPath:h.fileAbsPath}})}}return{name:r,baseUrl:n,pages:u}}function ut(e){return new Map(e.pages.map(t=>[t.url,{...t.source,title:t.title}]))}async function Ls(e){return ut(await xe(e))}async function rn(e,t,r){let o=(r||await Ls(e)).get(t);if(!o)return null;if(o.kind==="mdx")try{return{body:qe.readFileSync(o.fileAbsPath,"utf-8"),contentType:"text/markdown; charset=utf-8",kind:"mdx"}}catch{return null}return o.segment?{body:Cr(o.segment),contentType:"text/yaml; charset=utf-8",kind:"api"}:null}async function Pr(e,t){let r=t||await xe(e),n=s=>r.baseUrl?r.baseUrl+s:s,o=[`# ${r.name}`,"",`> Documentation index for ${r.name}. Append \`.md\` to any page URL (or send \`Accept: text/markdown\`) for its Markdown; fetch ${ct} for the whole site in one document.`,""],i=[],a=new Map;for(let s of r.pages)a.has(s.group)||(a.set(s.group,[]),i.push(s.group)),a.get(s.group).push(s);for(let s of i){o.push(`## ${s}`,"");for(let l of a.get(s))o.push(`- [${l.title}](${n(Os(l.url))})${l.description?`: ${l.description}`:""}`);o.push("")}return o.join(`
187
- `)}async function _r(e,t){let r=t||await xe(e),n=[`# ${r.name}`,"",`> Full documentation \u2014 every page concatenated. Index: ${ve}`];for(let o of r.pages)if(n.push("","---","",`# ${o.title}`,`Source: ${o.url}`,""),o.source.kind==="mdx")try{n.push(Es(qe.readFileSync(o.source.fileAbsPath,"utf-8")).trim())}catch{}else o.source.segment&&n.push("```yaml",Cr(o.source.segment).trim(),"```");return n.join(`
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(`
188
199
  `)+`
189
- `}async function Rr(e,t){let r=t||await xe(e),n=r.baseUrl||"",o=[];for(let s of r.pages){if(s.source.kind!=="mdx")continue;let l="";try{l=qe.readFileSync(s.source.fileAbsPath,"utf-8")}catch{continue}let c=/<Update\b([^>]*)>([\s\S]*?)<\/Update>/gi,u;for(;u=c.exec(l);){let p=u[1]||"",y=u[2]||"",m=Je(p,"label")||Je(p,"date")||"Update",g=Je(p,"description")||_s(y)||m,v=Je(p,"description"),d=`${n}${s.url}#${Ps(m,v)}`,h=Je(p,"date")||m,S=new Date(h),O=Number.isNaN(S.getTime())?null:S.toUTCString();o.push({title:m,link:d,description:g,pubDate:O})}}if(!o.length)return null;let i=n||"/",a=o.map(s=>` <item>
190
- <title>${fe(s.title)}</title>
191
- <link>${fe(s.link)}</link>
192
- <guid isPermaLink="true">${fe(s.link)}</guid>
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>
201
+ <title>${me(s.title)}</title>
202
+ <link>${me(s.link)}</link>
203
+ <guid isPermaLink="true">${me(s.link)}</guid>
193
204
  `+(s.pubDate?` <pubDate>${s.pubDate}</pubDate>
194
- `:"")+` <description>${fe(s.description)}</description>
205
+ `:"")+` <description>${me(s.description)}</description>
195
206
  </item>`).join(`
196
207
  `);return`<?xml version="1.0" encoding="UTF-8"?>
197
208
  <rss version="2.0">
198
209
  <channel>
199
- <title>${fe(r.name)} \u2014 Changelog</title>
200
- <link>${fe(i)}</link>
201
- <description>${fe(`Product updates and announcements for ${r.name}.`)}</description>
210
+ <title>${me(r.name)} \u2014 Changelog</title>
211
+ <link>${me(i)}</link>
212
+ <description>${me(`Product updates and announcements for ${r.name}.`)}</description>
202
213
  <generator>Velu</generator>
203
214
  `+a+`
204
215
  </channel>
205
216
  </rss>
206
- `}var ve,ct,Ts,be,Or,Tr,fe,Ps,Je,_s,Ur=_(()=>{re();Ie();Fe();Dt();ve="/llms.txt",ct="/llms-full.txt",Ts=`<${ve}>; rel="llms-txt", <${ct}>; rel="llms-full-txt"`,be={Link:Ts,"X-Llms-Txt":ve},Or=`Full documentation index: ${ve}`;Tr=e=>(e.split("/").filter(Boolean).pop()||"Home").replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase());fe=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Ps=(e,t)=>{let r=a=>String(a||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),n=r(e),o=t==null||t===""?"":r(t);return`update-${o?n?`${n}-${o}`:o:n||"item"}`},Je=(e,t)=>{let r=e.match(new RegExp(`${t}\\s*=\\s*["']([^"']*)["']`,"i"));return r?r[1]:void 0},_s=e=>String(e||"").replace(/```[\s\S]*?```/g,"").replace(/<[^>]+>/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[#*`_>]/g,"").replace(/\s+/g," ").trim().slice(0,500)});var Dr={};$e(Dr,{startDevServer:()=>Ks});import Fr from"node:fs/promises";import we from"node:fs";import Rs from"node:http";import{spawn as Us}from"node:child_process";import G from"node:path";import{fileURLToPath as Fs}from"node:url";import Ns from"chokidar";import on from"express";import{createServer as Is,createLogger as Ms,searchForWorkspaceRoot as zs}from"vite";function Js(e){return`<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e).replace(/%20/g,"+")}:wght@300;400;500;600;700&display=swap`}" />`}function Ir(e,t){let r=Gt(e,{color:!!process.stderr.isTTY});console.error(`
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(`
207
218
  `+r+`
208
- `),process.env.VELU_DEBUG&&t&&console.error(t)}function Mr(){try{return JSON.parse(we.readFileSync(G.join(pt,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function qs(e,t){let r=G.resolve(e,".velu"),n=G.resolve(r,".velu-version"),o=null;try{o=we.readFileSync(n,"utf8").trim()}catch{}if(o!==t){if(o!==null)try{we.rmSync(G.join(r,"vite-cache"),{recursive:!0,force:!0}),console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026")}catch{}try{we.mkdirSync(r,{recursive:!0}),we.writeFileSync(n,t)}catch{}}}async function zr(e){try{return await Xn(e)}catch{return Nt({},G.basename(e))}}async function Vr(e,t){let r=await e.moduleGraph.getModuleByUrl(t,!0),n=new Map,o=new Set;async function i(a){if(!(!a||o.has(a.url))){if(o.add(a.url),a.id&&Bs.test(a.id)){let s=a.url.includes("?")?"&":"?",l=await e.transformRequest(`${a.url}${s}direct`);l?.code&&n.set(a.url,l.code)}for(let s of a.importedModules)await i(s)}}return await i(r),[...n.values()].join(`
209
- `)}function Hs(e,t,r){let n=()=>{process.stdout.isTTY&&!process.env.VELU_NO_BELL&&process.stdout.write("\x07")},o=process.stdout.isTTY,i=g=>o&&process.stdout.write(`\x1B]${g}\x1B\\`),a=()=>{i(`0;\u23F3 ${t}`),i("9;4;3;0")},s=()=>{i(`0;${t}`),i("9;4;0;0")};o&&process.once("exit",()=>i("9;4;0;0")),a();let l=r&&r!=="unknown"?`v${r}`:"";if(!e)return console.log(`Starting Velu${l?" "+l:""}\u2026`),{ready:g=>{console.log(`Velu${l?" "+l:""} ready \u2192 ${g}`),s(),n()}};let c="\x1B[38;2;220;20;60m",u="\x1B[0m",p="\x1B[2m";console.log("");for(let g of Gs)console.log(`${c}${g}${u}`);l&&console.log(` ${p}${l}${u}`),console.log("");let y=null;try{y=Us(process.execPath,["-e",Ws],{stdio:["ignore","inherit","ignore"]}),y.on("error",()=>{})}catch{}let m=()=>{if(y){try{y.kill()}catch{}y=null}};return process.once("exit",m),{ready:g=>{m(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${u} Velu${l?" "+l:""} ready \u2192 \x1B[36m${g}${u}`),s(),n()}}}async function Ks(e){let t=!!process.env.VELU_PROFILE,r=performance.now(),n=(T,$)=>t&&console.log(`[velu-profile] ${T}: ${(performance.now()-$).toFixed(0)}ms`),o=Hs(!!process.stdout.isTTY&&!t,G.basename(e),Mr()),i=await zr(e),a=l(),s=Me(e);function l(){let $=at(e).filter(E=>E.severity==="error"&&(E.category==="config-json"||E.category==="config-schema"));return $.length&&console.error(`
210
- `+it($,{color:!!process.stderr.isTTY})+`
211
- `),$}let c=e;try{c=we.realpathSync(e)}catch{}let u=0,p=T=>{let $=performance.now();if($-u<500)return;u=$;let E=Ve(T,{projectDir:c,knownComponents:te});Ir(E,T)};process.on("unhandledRejection",p),process.on("uncaughtException",p);let y=Number(process.env.PORT)||8358,m=await Zt();qs(e,Mr());let g=on(),v=Rs.createServer(g),d=Ms(t?"info":"warn"),h=T=>typeof T=="string"&&T.includes("Failed to load source map"),S=d.warn.bind(d),O=d.warnOnce.bind(d);d.warn=(T,$)=>{h(T)||S(T,$)},d.warnOnce=(T,$)=>{h(T)||O(T,$)};let A=await Is({...$r({targetDir:e,VITE_ROOT:pt,validateProps:m}),appType:"custom",logLevel:t?"info":"warn",customLogger:d,server:{middlewareMode:!0,fs:{allow:[zs(pt),e,c]},hmr:{server:v}}});n("vite server created",r),g.get(new RegExp(`^${tt}/`),(T,$,E)=>{let k=pr(s,T.path);if(!k)return E();$.sendFile(k.abs,F=>{F&&$.status(404).end()})}),g.use(A.middlewares);let x=G.join(e,"public");g.use(on.static(x)),g.get(new RegExp(`^${Ut}(\\.[a-z0-9]+)?$`,"i"),async(T,$)=>{if(!i.favicon)return $.status(404).end();let E=G.resolve(e,i.favicon.replace(/^\//,""));$.sendFile(E,k=>{k&&$.status(404).end()})});let w=T=>($,E)=>{let k=i.logo?.[T];if(!k)return E.status(404).end();E.sendFile(G.resolve(e,k.replace(/^\//,"")),F=>{F&&E.status(404).end()})};g.get(new RegExp(`^${_e}(\\.[a-z0-9]+)?$`,"i"),w("light")),g.get(new RegExp(`^${Re}(\\.[a-z0-9]+)?$`,"i"),w("dark")),g.post("/@velu-api-proxy",on.json({limit:"8mb"}),async(T,$)=>{let{method:E="GET",url:k,headers:F={},body:R}=T.body||{};if(typeof k!="string"||!/^https?:\/\//i.test(k))return $.status(400).json({error:"A valid http(s) target URL is required."});try{let U=await fetch(k,{method:E,headers:F,body:R!=null&&R!==""?R:void 0}),V=await U.text(),f=U.headers.get("content-type")||"",b={};U.headers.forEach((C,M)=>{b[M]=C});let j=V;if(/json/i.test(f))try{j=JSON.parse(V)}catch{}$.json({status:U.status,statusText:U.statusText,headers:b,body:j})}catch(U){$.json({error:`Request failed: ${U.message}`})}});let L=null,P=async()=>L||=await xe(e);g.get(/\.md$/i,async(T,$,E)=>{try{let k=await P(),F=await rn(e,Lr(decodeURIComponent(T.path)),ut(k));if(!F)return E();$.status(200).set({"Content-Type":F.contentType,...be}).end(nn(F.body,F.kind))}catch{E()}}),g.get(ve,async(T,$,E)=>{try{let k=await Pr(e,await P());$.status(200).set({"Content-Type":"text/plain; charset=utf-8",...be}).end(k)}catch{E()}}),g.get(ct,async(T,$,E)=>{try{let k=await _r(e,await P());$.status(200).set({"Content-Type":"text/plain; charset=utf-8",...be}).end(k)}catch{E()}}),g.get("/rss.xml",async(T,$,E)=>{try{let k=await Rr(e,await P());if(!k)return E();$.status(200).set({"Content-Type":"application/rss+xml; charset=utf-8"}).end(k)}catch{E()}}),g.use("*",async(T,$,E)=>{let k=T.originalUrl,F=performance.now();if(/text\/markdown/i.test(T.headers.accept||""))try{let R=await P(),U=await rn(e,bt(k),ut(R));if(U)return $.status(200).set({"Content-Type":U.contentType,...be}).end(nn(U.body,U.kind))}catch{}if(a.length)return $.status(200).set({"Content-Type":"text/html"}).end(Kt(a,{title:"Fix velu.json to continue"}));try{let R=performance.now(),U=await Fr.readFile(Br,"utf-8");U=await A.transformIndexHtml(k,U),n(`transformIndexHtml ${k}`,R);let V="/src/runtime/server-entry.jsx";R=performance.now();let{render:f}=await A.ssrLoadModule(V);n(`ssrLoadModule ${k} (1st req includes dep pre-bundle)`,R),R=performance.now();let b=await f(k);n(`render ${k}`,R),R=performance.now();let j=await Vr(A,V);n(`collectSsrCss ${k}`,R);let C=j?`<style data-velu-ssr>${j}</style>`:"",M=`<style data-velu-config>
212
- ${Yn(i)}
213
- </style>`,ie=Ds.has(i.font.family)?"":Js(i.font.family),J=Kn(i),se=J?`<link rel="icon"${J.type?` type="${J.type}"`:""} href="${J.url}" />`:"",dt=fr(s),Xr=[C,M,ie,se,dt].filter(Boolean).join(`
214
- `),Yr=U.replace('<html lang="en">',`<html lang="en" data-current-path="${Nr(bt(k))}">`).replace("<!--app-title-->",Nr(i.name)).replace("<!--app-head-->",Xr).replace("<!--app-html-->",b);$.status(200).set({"Content-Type":"text/html",...be}).end(Yr),n(`TOTAL ${k}`,F)}catch(R){A.ssrFixStacktrace(R);let U=Ve(R,{projectDir:c,knownComponents:te});if(/failed to load url|does the file exist|cannot find module|ERR_MODULE_NOT_FOUND/i.test(String(R&&R.message))){try{A.moduleGraph.invalidateAll()}catch{}U.hint="The dev server cache is out of sync \u2014 this usually happens after files are added, removed, or moved. Reload the page; if it persists, stop velu dev, delete the .velu folder in your project, and restart."}Ir(U,R),$.status(200).set({"Content-Type":"text/html"}).end(Kt([U]))}}),Ns.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(T,$)=>{console.log(`[velu-cli] content ${T}: ${G.relative(e,$)}`);let E=G.basename($)==="velu.json",k=$.endsWith(".mdx"),F=/\.(css|js)$/i.test($),R=!1;if(F){let V=b=>b.scripts.some(j=>j.abs===$),f=V(s);s=Me(e),R=f||V(s)}let U=E||k&&(T==="add"||T==="unlink")||R;if((U||k||/\.(ya?ml|json)$/i.test($))&&(L=null),E&&(i=await zr(e),a=l()),U)A.moduleGraph.invalidateAll();else if(k){let V=$.split(G.sep).join("/"),f=A.moduleGraph.getModulesByFile(V);if(f)for(let b of f)A.moduleGraph.invalidateModule(b)}A.ws.send({type:"full-reload"})});async function ee(T){let $=new Set,E=12,k=0,F=[],R=()=>k<E?(k+=1,Promise.resolve()):new Promise(b=>F.push(b)).then(()=>{k+=1}),U=()=>{k-=1,F.shift()?.()},V=b=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(b)||/[\\/]node_modules[\\/]/.test(b)&&!/velu-ui/.test(b);async function f(b){if(!(!b||$.has(b)||V(b))){$.add(b);try{await R();try{await A.transformRequest(b,{ssr:!1})}finally{U()}let j=await A.moduleGraph.getModuleByUrl(b,!1);j?.importedModules?.size&&await Promise.all([...j.importedModules].map(C=>f(C.url)))}catch{}}}return await f(T),$.size}v.listen(y,async()=>{let T=performance.now(),$=0;try{let{render:E}=await A.ssrLoadModule("/src/runtime/server-entry.jsx");await ee("/src/runtime/client-entry.jsx"),typeof A.waitForRequestsIdle=="function"&&await A.waitForRequestsIdle();let[k]=await Promise.allSettled([ee("/src/runtime/client-entry.jsx"),E("/"),A.transformIndexHtml("/",await Fr.readFile(Br,"utf-8")),Vr(A,"/src/runtime/server-entry.jsx")]).then(F=>F.map(R=>R.status==="fulfilled"?R.value:0));$=k}catch(E){t&&console.log("[velu-profile] warmup error:",E?.message)}n(`cold-start warm-up (${$} client modules)`,T),o.ready(`http://localhost:${y}`)})}var Vs,Bs,Ds,Nr,pt,Br,Gs,Ws,Jr=_(()=>{Fe();Sr();Ht();jr();ue();We();Yt();Qt();Ur();re();Jt();Vs=G.dirname(Fs(import.meta.url)),Bs=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,Ds=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),Nr=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");pt=G.resolve(Vs,".."),Br=G.resolve(pt,"src","template.html"),Gs=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],Ws="const F=['\u280B','\u2819','\u2839','\u2838','\u283C','\u2834','\u2826','\u2827','\u2807','\u280F'],M=['Starting Velu','Setting up your preview','Preparing your docs','Warming things up','Almost ready'];let f=0,m=0;const t=Date.now();const C='\\x1b[38;2;220;20;60m',R='\\x1b[0m',D='\\x1b[2m';const d=()=>{const s=(Date.now()-t)/1000|0;process.stdout.write('\\x1b[2K\\r '+C+F[f]+R+' '+M[m]+'\\u2026 '+D+s+'s'+R);f=(f+1)%F.length;};d();setInterval(d,90);setInterval(()=>{if(m<M.length-1)m++;},4000);"});var Gr={};$e(Gr,{default:()=>Qs,runValidate:()=>qr});import Xs from"node:fs";import Ys from"node:path";function Zs(e){try{let t=JSON.parse(Xs.readFileSync(Ys.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let r=X(t.navigation);return ae(r,e).pageEntries}catch{return[]}}async function qr(e){let t=at(e),r=Zs(e),n=await Ar(e,r),o=[...t,...n],i=!!process.stdout.isTTY;return console.log(it(o,{color:i})),o.some(s=>s.severity!=="warning"&&s.severity!=="info")?1:0}var Qs,Wr=_(()=>{re();Ie();Yt();Qt();ue();Qs=qr});import ft from"node:path";import D from"node:process";import{readFileSync as ea}from"node:fs";var[,,Hr,mt]=D.argv;function Kr(){try{return JSON.parse(ea(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function ta(){let e=D.argv.slice(3);for(let t=0;t<e.length;t++){let r=e[t];if(r==="--out"){t++;continue}if(!r.startsWith("-"))return r}}async function na(){switch(Hr){case"--version":case"-v":case"version":{console.log(Kr());break}case"init":{mt||(console.error("Usage: velu init <project-name>"),D.exit(1));let e=mt,t=ft.resolve(D.cwd(),e),{initProject:r}=await Promise.resolve().then(()=>(ln(),an));await r(t,e);break}case"migrate":{let{runMigrate:e}=await Promise.resolve().then(()=>(Vn(),zn));D.exitCode=await e(D.argv.slice(3),Kr());break}case"dev":{let{maybeAutoUpdate:e}=await Promise.resolve().then(()=>(Rt(),_t));await e();let t=ft.resolve(D.cwd(),mt??"."),{startDevServer:r}=await Promise.resolve().then(()=>(Jr(),Dr));await r(t);break}case"update":{let{updateCommand:e}=await Promise.resolve().then(()=>(Rt(),_t));await e();break}case"validate":{let e=ft.resolve(D.cwd(),mt??"."),{runValidate:t}=await Promise.resolve().then(()=>(Wr(),Gr)),r=await t(e);D.exit(r);break}case"build":{let e=ft.resolve(D.cwd(),ta()??"."),t=D.argv.indexOf("--out"),r=t>-1?D.argv[t+1]:void 0,n=new URL(["..","src","build","index.js"].join("/"),import.meta.url).href,o=a=>import(a),i;try{({runBuild:i}=await o(n))}catch{console.error("velu build is an internal command, not available in this distribution."),D.exit(1)}await i(e,{out:r});break}default:console.log("Usage:"),console.log(" velu init <project-name> scaffold a new docs project"),console.log(" velu migrate mintlify [dir] migrate a Mintlify project (see --help)"),console.log(" velu dev [dir] start the dev preview server"),console.log(" velu validate [dir] check velu.json + content for problems"),console.log(" velu update update velu to the latest version"),D.exit(Hr?1:0)}}na().catch(e=>{console.error(D.env.VELU_DEBUG?e:`Error: ${e.message}`),D.exit(1)});
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)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veluai/velu",
3
- "version": "0.2.43",
3
+ "version": "0.2.45",
4
4
  "type": "module",
5
5
  "bin": "./dist/cli.js",
6
6
  "publishConfig": {
@@ -95,7 +95,7 @@ export default function ApiSidebar({
95
95
  <Ctx.Provider value={ctx}>
96
96
  <Stack
97
97
  as="nav"
98
- space="var(--s1)"
98
+ space="0px"
99
99
  className={`velu-api-sidebar ${className}`.trim()}
100
100
  aria-label="API reference"
101
101
  {...rest}
@@ -110,7 +110,7 @@ export default function ApiSidebar({
110
110
  )}
111
111
  <Stack
112
112
  as="ul"
113
- space="var(--s0)"
113
+ space="0px"
114
114
  className="velu-api-sidebar__list"
115
115
  >
116
116
  {(section.endpoints ?? []).map((ep, j) => (
@@ -16,13 +16,19 @@ import Switcher from '../primitives/Switcher.jsx';
16
16
  * Variants (combinable):
17
17
  * - basic: icon (accent, --f-h2) + title (--f-h4) + body
18
18
  * - `horizontal`: icon vertically centered on the left, title+body right
19
- * - `img`: image fills the top, clipped to the radius
19
+ * - `img`: image fills the top, clipped to the radius. Covers both themes,
20
+ * unless `imgLight`/`imgDark` override per theme.
21
+ * - `imgLight` / `imgDark`: per-theme image. When the effective light and
22
+ * dark sources differ, both render and CSS shows the right one per
23
+ * `[data-theme]` (same pattern as Logo's light/dark swap). When only one
24
+ * of the three is present, it covers both themes.
20
25
  * - `cta`: { label, href } → the single clickable "Click Here ›" link
21
26
  *
22
27
  * `icon` is a lucide id string (shared resolveIcon).
23
28
  *
24
29
  * @param {{ title?: React.ReactNode, icon?: string, horizontal?: boolean,
25
- * img?: string, imgAlt?: string, href?: string,
30
+ * img?: string, imgAlt?: string, imgLight?: string, imgDark?: string,
31
+ * href?: string,
26
32
  * cta?: {label: React.ReactNode, href: string},
27
33
  * children?: React.ReactNode, className?: string }} props
28
34
  */
@@ -33,6 +39,8 @@ export function Card({
33
39
  horizontal = false,
34
40
  img,
35
41
  imgAlt = '',
42
+ imgLight,
43
+ imgDark,
36
44
  cta,
37
45
  href,
38
46
  children,
@@ -74,11 +82,40 @@ export function Card({
74
82
  return (
75
83
  <card className={cls} {...rest}>
76
84
  {href && !cta && <a className="velu-card__link" href={href} aria-label={typeof title === 'string' ? title : 'Read more'} />}
77
- {img && (
78
- <div className="velu-card__media" data-component-part="card-image">
79
- <img src={img} alt={imgAlt} loading="lazy" />
80
- </div>
81
- )}
85
+ {(() => {
86
+ const lightSrc = imgLight ?? img;
87
+ const darkSrc = imgDark ?? img;
88
+ if (lightSrc && darkSrc && lightSrc !== darkSrc) {
89
+ return (
90
+ <div className="velu-card__media" data-component-part="card-image">
91
+ <img
92
+ className="velu-card__img velu-card__img--light"
93
+ src={lightSrc}
94
+ alt={imgAlt}
95
+ loading="lazy"
96
+ />
97
+ <img
98
+ className="velu-card__img velu-card__img--dark"
99
+ src={darkSrc}
100
+ alt=""
101
+ aria-hidden="true"
102
+ loading="lazy"
103
+ />
104
+ </div>
105
+ );
106
+ }
107
+ const singleSrc = imgLight ?? imgDark ?? img;
108
+ return singleSrc ? (
109
+ <div className="velu-card__media" data-component-part="card-image">
110
+ <img
111
+ className="velu-card__img"
112
+ src={singleSrc}
113
+ alt={imgAlt}
114
+ loading="lazy"
115
+ />
116
+ </div>
117
+ ) : null;
118
+ })()}
82
119
 
83
120
  <div className="velu-card__body" data-component-part="card-content-container">
84
121
  {horizontal ? (
@@ -4,6 +4,7 @@ import resolveIcon from '../lib/resolveIcon.jsx';
4
4
  import Stack from '../primitives/Stack.jsx';
5
5
  import Cluster from '../primitives/Cluster.jsx';
6
6
  import Logo from './Logo.jsx';
7
+ import VeluMarkArt from '../lib/velu-mark.jsx';
7
8
 
8
9
  /**
9
10
  * PageHeader — top of the docs site.
@@ -51,9 +52,13 @@ import Logo from './Logo.jsx';
51
52
  /* Velu brand mark. Color: --accent-color via the wrapping wordmark
52
53
  span; the path uses currentColor. Exported so consumers (e.g. the
53
54
  mobile nav drawer) can render the mark alongside its own chrome.
54
- Only the default theme shows it — the vepa / thulir / aalam / nila
55
- presets hide it via CSS (text-only branding). */
56
- export function VeluMark() { return null; }
55
+ Only the default theme shows it — the vepa / thulir / aalam / nila /
56
+ kadhir presets hide it via CSS (text-only branding). */
57
+ export function VeluMark({ className = '', ...rest }) {
58
+ return (
59
+ <VeluMarkArt className={`velu-header__mark ${className}`.trim()} {...rest} />
60
+ );
61
+ }
57
62
 
58
63
  function ActionButton({ action, Link, id }) {
59
64
  const { label, icon, kind = 'outlined', href, onClick, external, component } = action;
@@ -193,7 +193,7 @@
193
193
  }
194
194
  }
195
195
 
196
- /* Compact method pill in the sidebar (replaces the icon for API endpoints). */
196
+ /* Compact method pill in the (non-API) sidebar when an item is an endpoint. */
197
197
  .velu-sidebar__method {
198
198
  flex: none;
199
199
  font-family: var(--font-mono);
@@ -204,8 +204,8 @@
204
204
  border-radius: var(--radius-xs, 4px);
205
205
  text-transform: uppercase;
206
206
  }
207
- .velu-sidebar__method.velu-method-badge--get { color: var(--get-pill-color); background: rgb(from var(--get-pill-color) r g b / 14%); }
208
- .velu-sidebar__method.velu-method-badge--post { color: var(--post-pill-color); background: rgb(from var(--post-pill-color) r g b / 14%); }
209
- .velu-sidebar__method.velu-method-badge--put { color: var(--put-pill-color); background: rgb(from var(--put-pill-color) r g b / 14%); }
210
- .velu-sidebar__method.velu-method-badge--patch { color: var(--patch-pill-color); background: rgb(from var(--patch-pill-color) r g b / 14%); }
211
- .velu-sidebar__method.velu-method-badge--delete { color: var(--delete-pill-color); background: rgb(from var(--delete-pill-color) r g b / 14%); }
207
+ .velu-sidebar__method.velu-method-badge--get { color: var(--get-pill-stroke-color); background: var(--get-pill-color); }
208
+ .velu-sidebar__method.velu-method-badge--post { color: var(--post-pill-stroke-color); background: var(--post-pill-color); }
209
+ .velu-sidebar__method.velu-method-badge--put { color: var(--put-pill-stroke-color); background: var(--put-pill-color); }
210
+ .velu-sidebar__method.velu-method-badge--patch { color: var(--patch-pill-stroke-color); background: var(--patch-pill-color); }
211
+ .velu-sidebar__method.velu-method-badge--delete { color: var(--delete-pill-stroke-color); background: var(--delete-pill-color); }
@@ -580,22 +580,26 @@
580
580
  }
581
581
 
582
582
  /* ── ApiSidebar ────────────────────────────────────────────────────────── */
583
- /* Vertical rhythm is the Stack primitive (set inline by ApiSidebar.jsx);
584
- this block holds only the rail, group header, row layout, active
585
- state, and icon sizing — same split as sidebar.css. */
583
+ /* Same nav chrome as the themed presets: sentence-case group labels,
584
+ compact method pills, rounded hover/active rows. Theme sheets may
585
+ still tighten type and spacing on top. */
586
586
  .velu-api-sidebar {
587
- border-inline-start: var(--border-width) solid var(--border-color);
588
- margin-inline-start: var(--s1);
587
+ margin: 0;
588
+ border: 0;
589
+ width: 100%;
589
590
  }
590
591
 
591
592
  .velu-api-sidebar__section {
592
593
  display: flex;
593
594
  align-items: center;
594
595
  gap: var(--s-2);
595
- padding-inline: var(--s-3);
596
- inline-size: fit-content;
597
- font-weight: var(--weight-medium);
598
- text-transform: uppercase;
596
+ padding: 0 var(--s0) 11px;
597
+ background: transparent;
598
+ font-size: var(--f-h6);
599
+ font-weight: var(--weight-semibold);
600
+ line-height: var(--lh-body);
601
+ letter-spacing: 0;
602
+ text-transform: none;
599
603
  }
600
604
 
601
605
  .velu-api-sidebar__list {
@@ -603,24 +607,51 @@
603
607
  margin: 0;
604
608
  padding: 0;
605
609
  }
610
+ .velu-api-sidebar__list + .velu-api-sidebar__section {
611
+ margin-block-start: var(--s2);
612
+ }
606
613
 
607
- /* Endpoint row — method pill + name. align-items: flex-start so the
608
- pill stays on the first line when a long name wraps. */
614
+ /* Endpoint row — method pill + name. */
609
615
  .velu-api-sidebar__item {
610
616
  display: flex;
611
- align-items: flex-start;
612
- gap: var(--s-2);
613
- padding-inline: var(--s0);
617
+ align-items: center;
618
+ gap: 10px;
619
+ min-height: 36px;
620
+ padding: 6px var(--s0);
621
+ border-radius: 12px;
614
622
  color: var(--text-color);
623
+ font-size: var(--f-body);
624
+ line-height: var(--lh-body);
615
625
  text-decoration: none;
616
626
  }
627
+ .velu-api-sidebar__item:hover {
628
+ background: var(--surface-color);
629
+ }
617
630
  .velu-api-sidebar__item--active {
618
631
  color: var(--accent-color);
619
- border-inline-start: 2px solid var(--accent-color);
632
+ font-weight: var(--weight-semibold);
633
+ background: rgb(from var(--accent-color) r g b / 10%);
634
+ }
635
+ .velu-api-sidebar__item--active .velu-method-badge {
636
+ color: #fff;
637
+ background: var(--method-cta);
620
638
  }
621
639
  .velu-api-sidebar__label {
622
- font-size: var(--f-body);
623
- line-height: var(--lh-h6);
640
+ font: inherit;
641
+ }
642
+
643
+ /* Compact method pill — colored label on the method tint, not a filled
644
+ badge. --method-* vars come from MethodBadge's per-method class. */
645
+ .velu-api-sidebar__item .velu-method-badge {
646
+ flex: none;
647
+ font-size: 9px;
648
+ line-height: 14px;
649
+ font-weight: var(--weight-bold);
650
+ padding: 0 4px;
651
+ border: 0;
652
+ border-radius: 5px;
653
+ color: var(--method-cta, var(--method-stroke, var(--muted-color)));
654
+ background: var(--method-pill, var(--surface-color));
624
655
  }
625
656
 
626
657
  .velu-api-sidebar__icon {
@@ -46,6 +46,7 @@
46
46
  flex-direction: column;
47
47
  gap: var(--s-2);
48
48
  padding: var(--s0) var(--s3);
49
+ flex: 1; /* fill the card so a CTA can pin to the bottom across a row */
49
50
  }
50
51
  .velu-card--horizontal .velu-card__body {
51
52
  flex-direction: row;
@@ -81,7 +82,8 @@
81
82
  display: inline-flex;
82
83
  align-items: center;
83
84
  gap: var(--s-3);
84
- margin-block-start: var(--s-2);
85
+ margin-block-start: auto; /* pin to the card bottom so CTAs line up across a row */
86
+ padding-block-start: var(--s-2); /* keep the text gap when there is no free space */
85
87
  font-weight: 500;
86
88
  color: var(--text-color);
87
89
  text-decoration: none;
@@ -106,6 +108,19 @@
106
108
  block-size: auto;
107
109
  object-fit: cover;
108
110
  }
111
+ /* Per-theme swap (same pattern as Logo): light image by default, `img` under
112
+ [data-theme=dark]. `display` (not opacity) so the inactive one leaves the
113
+ a11y tree too. A lone `img` (no `imgLight`) has neither modifier and always
114
+ shows. */
115
+ .velu-card__media .velu-card__img--dark {
116
+ display: none;
117
+ }
118
+ [data-theme='dark'] .velu-card__media .velu-card__img--light {
119
+ display: none;
120
+ }
121
+ [data-theme='dark'] .velu-card__media .velu-card__img--dark {
122
+ display: block;
123
+ }
109
124
 
110
125
  /* CardGroup layout is the Switcher primitive (composed in Card.jsx). Its
111
126
  threshold is computed count-aware in Card.jsx so the row flips to a full
@@ -7,8 +7,9 @@ import React from 'react';
7
7
  * light/dark themes.
8
8
  *
9
9
  * Used by the "Powered by Velu" credits (PoweredBy badge + vepa/thulir
10
- * family footer bottom row). NOT used in headers — those render the
11
- * wordmark alone (PageHeader's VeluMark stub stays null).
10
+ * family footer bottom row), the header brand, and the mobile nav drawer.
11
+ * Theme presets that want text-only branding hide `.velu-header__mark`
12
+ * via CSS.
12
13
  */
13
14
  export default function VeluMark({ className = '', ...rest }) {
14
15
  return (
@@ -320,6 +320,7 @@
320
320
  "group": { "type": "string", "description": "Sidebar section heading." },
321
321
  "icon": { "type": "string", "description": "lucide icon id." },
322
322
  "expanded": { "type": "boolean", "description": "Start expanded." },
323
+ "public": { "type": "boolean", "description": "Allow unauthenticated access to this group. Per-page group restrictions still apply." },
323
324
  "root": { "type": "string", "description": "Landing page path for the group." },
324
325
  "openapi": { "$ref": "#/$defs/openapiRef" },
325
326
  "api": { "$ref": "#/$defs/api" },
package/src/navigation.js CHANGED
@@ -179,6 +179,7 @@ function normalizeGroup(g) {
179
179
  if (g.root) pages.unshift({ kind: 'page', pagePath: g.root });
180
180
  return {
181
181
  kind: 'group',
182
+ ...(g.public !== undefined ? { public: g.public } : {}),
182
183
  label: g.group,
183
184
  icon: g.icon,
184
185
  expanded: Boolean(g.expanded),
@@ -801,7 +801,7 @@ function DocsPage() {
801
801
  // URL path — e.g. essentials/markdown.mdx lives under the "Writing Content"
802
802
  // group). Page rows show the path to the page; anchor rows include the page.
803
803
  const searchDocs = React.useCallback(async (q) => {
804
- const results = await pagefindSearch(q);
804
+ const results = site.readerRestricted ? await fetch((import.meta.env.BASE_URL || '/') + '@velu-reader/search?q=' + encodeURIComponent(q), {credentials:'same-origin',cache:'no-store'}).then(r=>r.ok?r.json():[]) : await pagefindSearch(q);
805
805
  if (!Array.isArray(results)) return results;
806
806
  return results.map((r) => {
807
807
  const res = resolve(r.href.split('#')[0], navigation, pages);
@@ -817,7 +817,7 @@ function DocsPage() {
817
817
  // Otherwise `ask` stays undefined and the Chatbot uses its canned demo answer
818
818
  // (dev preview, or a site that hasn't enabled the assistant).
819
819
  const assistant = React.useMemo(() => {
820
- if (IS_DEV_PREVIEW) return null;
820
+ if (IS_DEV_PREVIEW || site.readerRestricted) return null;
821
821
  const apiBase = resolvePublicApiBase(site.assistant?.apiBase);
822
822
  if (apiBase == null) return null;
823
823
  return createDocsAssistant({ apiBase, host: site.assistant?.host });
@@ -826,7 +826,7 @@ function DocsPage() {
826
826
  // Hide the Ask-AI widget when the docs owner's plan/credits disable it (the
827
827
  // backend bootstrap returns ask_ai_enabled:false). Only applies to a real
828
828
  // configured assistant — the dev-preview/demo widget stays visible.
829
- const [askAiHidden, setAskAiHidden] = React.useState(false);
829
+ const [askAiHidden, setAskAiHidden] = React.useState(Boolean(site.readerRestricted));
830
830
  React.useEffect(() => {
831
831
  if (!assistant) return undefined;
832
832
  let alive = true;
@@ -841,7 +841,7 @@ function DocsPage() {
841
841
  // widget can POST to /api/v1/public/feedback. Null in the dev preview, where
842
842
  // the widget stays purely visual.
843
843
  const pageFeedback = React.useMemo(() => {
844
- if (IS_DEV_PREVIEW) return null;
844
+ if (IS_DEV_PREVIEW || site.readerRestricted) return null;
845
845
  const apiBase = resolvePublicApiBase(site.assistant?.apiBase);
846
846
  if (apiBase == null) return null;
847
847
  return createPageFeedback({ apiBase, host: site.assistant?.host });
@@ -1196,7 +1196,11 @@ function DocsPage() {
1196
1196
  headers: { 'content-type': 'application/json' },
1197
1197
  body: '{}',
1198
1198
  });
1199
- if (response.ok) window.location.reload();
1199
+ if (response.ok) {
1200
+ const result = response.status === 204 ? null : await response.json();
1201
+ if (result?.redirect) window.location.assign(result.redirect);
1202
+ else window.location.reload();
1203
+ }
1200
1204
  }, []);
1201
1205
 
1202
1206
  const navActions = [];
@@ -1,9 +1,9 @@
1
1
  import './dev-warnings.js';
2
2
  import React from 'react';
3
- import { hydrateRoot } from 'react-dom/client';
3
+ import { createRoot, hydrateRoot } from 'react-dom/client';
4
4
  import { BrowserRouter } from 'react-router-dom';
5
5
  import 'velu-ui/styles.css';
6
- import { site } from 'virtual:velu-site';
6
+ import { site, initializeReader } from 'virtual:velu-site';
7
7
  import App from './App.jsx';
8
8
 
9
9
  // Subpath hosting: Vite sets BASE_URL from the build's `base` (e.g. "/docs/").
@@ -31,7 +31,9 @@ function CustomScripts() {
31
31
  return null;
32
32
  }
33
33
 
34
- hydrateRoot(
34
+ function mount() {
35
+ const renderRoot = site.guarded ? (_, children) => createRoot(document.getElementById('root')).render(children) : hydrateRoot;
36
+ renderRoot(
35
37
  document.getElementById('root'),
36
38
  <BrowserRouter basename={basename}>
37
39
  <App />
@@ -39,6 +41,10 @@ hydrateRoot(
39
41
  </BrowserRouter>
40
42
  );
41
43
 
44
+ }
45
+ if (site.guarded) initializeReader().then(mount).catch(()=>{ document.getElementById("root").textContent="Unable to load documentation. Reload to sign in again."; });
46
+ else mount();
47
+
42
48
  // Dev only: the SSR-inlined critical CSS (<style data-velu-ssr>) exists just
43
49
  // to avoid FOUC on first paint. By now Vite has injected its own HMR-managed
44
50
  // stylesheet from the `velu-ui/styles.css` import above, so drop the stale