@stacksjs/dtsx 0.9.17 → 0.9.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/bin/cli.js +5 -5
  2. package/dist/chunk-1z1w3s0k.js +25 -0
  3. package/dist/chunk-2n9mmg2c.js +2 -0
  4. package/dist/{chunk-bsxtpwx6.js → chunk-2qyt67jt.js} +1 -1
  5. package/dist/chunk-4jw8qvts.js +16 -0
  6. package/dist/chunk-69rnp3hs.js +19 -0
  7. package/dist/chunk-7g7axw9t.js +2 -0
  8. package/dist/{chunk-vpjw38x7.js → chunk-7pwy4m0c.js} +1 -1
  9. package/dist/{chunk-x3q42h61.js → chunk-7zsd1qqw.js} +1 -1
  10. package/dist/{chunk-3rpqh1bm.js → chunk-9qe2wx58.js} +1 -1
  11. package/dist/{chunk-xhs0tsnn.js → chunk-9ycwkhxh.js} +1 -1
  12. package/dist/{chunk-mzq58nw0.js → chunk-dv8haj2p.js} +1 -1
  13. package/dist/{chunk-a6tznyxq.js → chunk-ezrgnecm.js} +1 -1
  14. package/dist/{chunk-3zjt21t1.js → chunk-fbradttj.js} +1 -1
  15. package/dist/{chunk-83e9a4fq.js → chunk-fg4cjy7w.js} +1 -1
  16. package/dist/{chunk-xmje6xfw.js → chunk-fmhrt2ca.js} +1 -1
  17. package/dist/{chunk-6sx8ppfg.js → chunk-gg6xh82k.js} +1 -1
  18. package/dist/{chunk-8z31rkfp.js → chunk-jjwwkrfk.js} +1 -1
  19. package/dist/{chunk-4s9jv983.js → chunk-kwmhsx3n.js} +1 -1
  20. package/dist/{chunk-scrtz9j4.js → chunk-m68323h2.js} +1 -1
  21. package/dist/{chunk-8hxrwrsf.js → chunk-mr4jjsps.js} +1 -1
  22. package/dist/{chunk-jvfvxm5w.js → chunk-nwvqfthk.js} +1 -1
  23. package/dist/chunk-q0k7xs9f.js +2 -0
  24. package/dist/{chunk-f4c389mj.js → chunk-s30jnjb4.js} +1 -1
  25. package/dist/{chunk-yth8251f.js → chunk-sbmecr6t.js} +1 -1
  26. package/dist/chunk-w1k33gyv.js +2 -0
  27. package/dist/{chunk-pep9jyxn.js → chunk-x4jgc4bx.js} +1 -1
  28. package/dist/extractor/builders.d.ts +1 -1
  29. package/dist/extractor/helpers.d.ts +9 -0
  30. package/dist/src/index.js +1 -1
  31. package/dist/src/plugins/bun.js +1 -1
  32. package/dist/src/plugins/esbuild.js +1 -1
  33. package/dist/src/plugins/index.js +1 -1
  34. package/dist/src/plugins/tsup.js +1 -1
  35. package/dist/src/plugins/vite.js +1 -1
  36. package/dist/src/plugins/webpack.js +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-285mqzvx.js +0 -16
  39. package/dist/chunk-2r21f44d.js +0 -25
  40. package/dist/chunk-8cv1t8qg.js +0 -2
  41. package/dist/chunk-bh9ey0vw.js +0 -2
  42. package/dist/chunk-sdjfh4mj.js +0 -2
  43. package/dist/chunk-w8d9jjsa.js +0 -2
  44. package/dist/chunk-y581wnfe.js +0 -19
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ac as u,Bc as v,Cc as w,pc as j,qc as k,rc as l,sc as m,tc as n,uc as o,vc as p,wc as q,xc as r,yc as s,zc as t}from"./chunk-vpjw38x7.js";import{Fc as a,Gc as b,Hc as c,Ic as d,Jc as e,Kc as f,Lc as g,Mc as h,Nc as i}from"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{l as processVariableDeclaration,n as processTypeDeclaration,s as processModuleDeclaration,m as processInterfaceDeclaration,q as processImportDeclaration,k as processFunctionDeclaration,r as processExportDeclaration,p as processEnumDeclaration,w as processDeclarations,o as processClassDeclaration,u as parseImportStatement,d as parseArrayElements,h as isGenericType,e as inferObjectType,b as inferNarrowTypeInUnion,a as inferNarrowType,g as inferFunctionType,c as inferArrayType,j as formatComments,f as findMatchingBracket,i as extractSatisfiesType,v as extractAllImportedItems,t as clearProcessorCaches};
2
+ import{Ac as u,Bc as v,Cc as w,pc as j,qc as k,rc as l,sc as m,tc as n,uc as o,vc as p,wc as q,xc as r,yc as s,zc as t}from"./chunk-7pwy4m0c.js";import{Fc as a,Gc as b,Hc as c,Ic as d,Jc as e,Kc as f,Lc as g,Mc as h,Nc as i}from"./chunk-4jw8qvts.js";import"./chunk-mcdb3q06.js";export{l as processVariableDeclaration,n as processTypeDeclaration,s as processModuleDeclaration,m as processInterfaceDeclaration,q as processImportDeclaration,k as processFunctionDeclaration,r as processExportDeclaration,p as processEnumDeclaration,w as processDeclarations,o as processClassDeclaration,u as parseImportStatement,d as parseArrayElements,h as isGenericType,e as inferObjectType,b as inferNarrowTypeInUnion,a as inferNarrowType,g as inferFunctionType,c as inferArrayType,j as formatComments,f as findMatchingBracket,i as extractSatisfiesType,v as extractAllImportedItems,t as clearProcessorCaches};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as z}from"./chunk-x3q42h61.js";function C(F={}){let{preBuild:H=!1,postBuild:I=!0,onGenerated:J,onError:w,...q}=F,y=async()=>{try{let j=await z(q);J?.(j)}catch(j){let k=j instanceof Error?j:Error(String(j));if(w?.(k),!w)console.error("[dtsx] Generation failed:",k.message)}};return{name:"dtsx",async setup(j){let k=j.config;if(!q.entrypoints&&k.entrypoints)q.entrypoints=k.entrypoints;if(!q.outdir&&k.outdir)q.outdir=k.outdir;if(!q.root&&k.root)q.root=k.root;if(H)j.onStart(async()=>{await y()});if(I){let v=!1;j.onLoad({filter:/.*/},async(K)=>{if(!v)queueMicrotask(async()=>{if(!v)v=!0,await y()});return})}}}}var M=C,P=C;
2
+ import{tb as z}from"./chunk-7zsd1qqw.js";function C(F={}){let{preBuild:H=!1,postBuild:I=!0,onGenerated:J,onError:w,...q}=F,y=async()=>{try{let j=await z(q);J?.(j)}catch(j){let k=j instanceof Error?j:Error(String(j));if(w?.(k),!w)console.error("[dtsx] Generation failed:",k.message)}};return{name:"dtsx",async setup(j){let k=j.config;if(!q.entrypoints&&k.entrypoints)q.entrypoints=k.entrypoints;if(!q.outdir&&k.outdir)q.outdir=k.outdir;if(!q.root&&k.root)q.root=k.root;if(H)j.onStart(async()=>{await y()});if(I){let v=!1;j.onLoad({filter:/.*/},async(K)=>{if(!v)queueMicrotask(async()=>{if(!v)v=!0,await y()});return})}}}}var M=C,P=C;
3
3
  export{C as fa,M as ga,P as ha};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{oc as J}from"./chunk-2r21f44d.js";var S=typeof globalThis.Bun?.hash==="function";function z(B){if(S)return Bun.hash(B);let g=0;for(let T=0;T<B.length;T++){let p=B.charCodeAt(T);g=(g<<5)-g+p,g=g&g}return g}var U=100,G=0,f=new Map;function $(B,g,T=!0,p=!1){let b=z(B),j=`${g}:${T?1:0}:${p?1:0}`,w=f.get(j);if(w&&w.contentHash===b)return w.lastAccess=++G,w.declarations;let q=J(B,g,T,p);if(f.set(j,{declarations:q,contentHash:b,lastAccess:++G}),f.size>U){let Q=Math.max(1,Math.ceil(f.size*0.1)),x=[];for(let[u,F]of f)x.push([u,F.lastAccess]);x.sort((u,F)=>u[1]-F[1]);for(let u=0;u<Q&&u<x.length;u++)f.delete(x[u][0])}return q}function v(){f.clear()}
2
+ import{oc as J}from"./chunk-1z1w3s0k.js";var S=typeof globalThis.Bun?.hash==="function";function z(B){if(S)return Bun.hash(B);let g=0;for(let T=0;T<B.length;T++){let p=B.charCodeAt(T);g=(g<<5)-g+p,g=g&g}return g}var U=100,G=0,f=new Map;function $(B,g,T=!0,p=!1){let b=z(B),j=`${g}:${T?1:0}:${p?1:0}`,w=f.get(j);if(w&&w.contentHash===b)return w.lastAccess=++G,w.declarations;let q=J(B,g,T,p);if(f.set(j,{declarations:q,contentHash:b,lastAccess:++G}),f.size>U){let Q=Math.max(1,Math.ceil(f.size*0.1)),x=[];for(let[u,F]of f)x.push([u,F.lastAccess]);x.sort((u,F)=>u[1]-F[1]);for(let u=0;u<Q&&u<x.length;u++)f.delete(x[u][0])}return q}function v(){f.clear()}
3
3
  export{z as lc,$ as mc,v as nc};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{lc as F,mc as L}from"./chunk-8z31rkfp.js";import{oc as I}from"./chunk-2r21f44d.js";import{Cc as g}from"./chunk-vpjw38x7.js";var R=100,w=0,z=new Map;function U(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=F(B),Y=`${G}:${J?1:0}:${P?1:0}`,Q=z.get(Y);if(Q&&Q.contentHash===N)return Q.lastAccess=++w,Q.result;let j=L(B,G,J,P),v=g(j,{filePath:G,sourceCode:B,declarations:j},J,W);if(z.set(Y,{result:v,contentHash:N,lastAccess:++w}),z.size>R){let M=Math.max(1,Math.ceil(z.size*0.1)),V=[];for(let[q,$]of z)V.push([q,$.lastAccess]);V.sort((q,$)=>q[1]-$[1]);for(let q=0;q<M&&q<V.length;q++)z.delete(V[q][0])}return v}function b(){z.clear()}function H(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=I(B,G,J,P);return g(N,{filePath:G,sourceCode:B,declarations:N},J,W)}
2
+ import{lc as F,mc as L}from"./chunk-jjwwkrfk.js";import{oc as I}from"./chunk-1z1w3s0k.js";import{Cc as g}from"./chunk-7pwy4m0c.js";var R=100,w=0,z=new Map;function U(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=F(B),Y=`${G}:${J?1:0}:${P?1:0}`,Q=z.get(Y);if(Q&&Q.contentHash===N)return Q.lastAccess=++w,Q.result;let j=L(B,G,J,P),v=g(j,{filePath:G,sourceCode:B,declarations:j},J,W);if(z.set(Y,{result:v,contentHash:N,lastAccess:++w}),z.size>R){let M=Math.max(1,Math.ceil(z.size*0.1)),V=[];for(let[q,$]of z)V.push([q,$.lastAccess]);V.sort((q,$)=>q[1]-$[1]);for(let q=0;q<M&&q<V.length;q++)z.delete(V[q][0])}return v}function b(){z.clear()}function H(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=I(B,G,J,P);return g(N,{filePath:G,sourceCode:B,declarations:N},J,W)}
3
3
  export{U as ic,b as jc,H as kc};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as K}from"./chunk-x3q42h61.js";function L(N={}){let{buildStart:P=!0,buildEnd:Q=!1,writeBundle:T=!1,modes:y,onGenerated:U,onError:H,...W}=N,I="production",z=async()=>{try{let q=await K(W);U?.(q)}catch(q){let J=q instanceof Error?q:Error(String(q));if(H?.(J),!H)console.error("[dtsx] Generation failed:",J.message)}},F=()=>{if(!y||y.length===0)return!0;return y.includes(I)};return{name:"dtsx",apply(q){return I=q.mode,!0},async buildStart(){if(P&&F())await z()},async buildEnd(){if(Q&&F())await z()},async writeBundle(){if(T&&F())await z()}}}var Y=L,_=L;
2
+ import{tb as K}from"./chunk-7zsd1qqw.js";function L(N={}){let{buildStart:P=!0,buildEnd:Q=!1,writeBundle:T=!1,modes:y,onGenerated:U,onError:H,...W}=N,I="production",z=async()=>{try{let q=await K(W);U?.(q)}catch(q){let J=q instanceof Error?q:Error(String(q));if(H?.(J),!H)console.error("[dtsx] Generation failed:",J.message)}},F=()=>{if(!y||y.length===0)return!0;return y.includes(I)};return{name:"dtsx",apply(q){return I=q.mode,!0},async buildStart(){if(P&&F())await z()},async buildEnd(){if(Q&&F())await z()},async writeBundle(){if(T&&F())await z()}}}var Y=L,_=L;
3
3
  export{L as ca,Y as da,_ as ea};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as I}from"./chunk-x3q42h61.js";class H{options;generateOptions;constructor(j={}){let{onCompile:F=!1,afterEmit:w=!0,onWatchRun:q=!1,onGenerated:z,onError:B,...J}=j;this.options={onCompile:F,afterEmit:w,onWatchRun:q,onGenerated:z,onError:B},this.generateOptions=J}apply(j){if(!this.generateOptions.outdir&&j.options.output?.path)this.generateOptions.outdir=j.options.output.path;if(!this.generateOptions.cwd&&j.options.context)this.generateOptions.cwd=j.options.context;if(!this.generateOptions.entrypoints&&j.options.entry){let w=j.options.entry;if(typeof w==="string")this.generateOptions.entrypoints=[w];else if(Array.isArray(w))this.generateOptions.entrypoints=w;else if(typeof w==="object"&&w!==null){let q=[];for(let z of Object.values(w))if(typeof z==="string")q.push(z);else if(Array.isArray(z))q.push(...z.filter((B)=>typeof B==="string"));else if(typeof z==="object"&&z!==null&&"import"in z){let B=z.import;if(typeof B==="string")q.push(B);else if(Array.isArray(B))q.push(...B)}if(q.length>0)this.generateOptions.entrypoints=q}}if(this.options.onCompile)j.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)j.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()});if(this.options.onWatchRun)j.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()})}async runGenerate(){try{let j=await I(this.generateOptions);this.options.onGenerated?.(j)}catch(j){let F=j instanceof Error?j:Error(String(j));if(this.options.onError?.(F),!this.options.onError)console.error("[dtsx] Generation failed:",F.message)}}}function K(j={}){return new H(j)}var M=K,Q=H;
2
+ import{tb as I}from"./chunk-7zsd1qqw.js";class H{options;generateOptions;constructor(j={}){let{onCompile:F=!1,afterEmit:w=!0,onWatchRun:q=!1,onGenerated:z,onError:B,...J}=j;this.options={onCompile:F,afterEmit:w,onWatchRun:q,onGenerated:z,onError:B},this.generateOptions=J}apply(j){if(!this.generateOptions.outdir&&j.options.output?.path)this.generateOptions.outdir=j.options.output.path;if(!this.generateOptions.cwd&&j.options.context)this.generateOptions.cwd=j.options.context;if(!this.generateOptions.entrypoints&&j.options.entry){let w=j.options.entry;if(typeof w==="string")this.generateOptions.entrypoints=[w];else if(Array.isArray(w))this.generateOptions.entrypoints=w;else if(typeof w==="object"&&w!==null){let q=[];for(let z of Object.values(w))if(typeof z==="string")q.push(z);else if(Array.isArray(z))q.push(...z.filter((B)=>typeof B==="string"));else if(typeof z==="object"&&z!==null&&"import"in z){let B=z.import;if(typeof B==="string")q.push(B);else if(Array.isArray(B))q.push(...B)}if(q.length>0)this.generateOptions.entrypoints=q}}if(this.options.onCompile)j.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)j.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()});if(this.options.onWatchRun)j.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()})}async runGenerate(){try{let j=await I(this.generateOptions);this.options.onGenerated?.(j)}catch(j){let F=j instanceof Error?j:Error(String(j));if(this.options.onError?.(F),!this.options.onError)console.error("[dtsx] Generation failed:",F.message)}}}function K(j={}){return new H(j)}var M=K,Q=H;
3
3
  export{H as qa,K as ra,M as sa,Q as ta};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as I}from"./chunk-x3q42h61.js";function z(J={}){let{onBuildStart:K=!1,onBuildEnd:L=!0,onGenerated:M,onError:C,...N}=J,w,q,F=async()=>{let j={...N};if(!j.outdir&&w)j.outdir=w;if(!j.entrypoints&&q)j.entrypoints=q;try{let k=await I(j);M?.(k)}catch(k){let H=k instanceof Error?k:Error(String(k));if(C?.(H),!C)console.error("[dtsx] Generation failed:",H.message)}};return{name:"dtsx",esbuildOptions(j){if(j.outdir&&typeof j.outdir==="string")w=j.outdir;if(j.entryPoints){if(Array.isArray(j.entryPoints))q=j.entryPoints;else if(typeof j.entryPoints==="object")q=Object.values(j.entryPoints)}},async buildStart(){if(K)await F()},async buildEnd(j){if(L)await F()}}}var R=z,T=z,V=z;
2
+ import{tb as I}from"./chunk-7zsd1qqw.js";function z(J={}){let{onBuildStart:K=!1,onBuildEnd:L=!0,onGenerated:M,onError:C,...N}=J,w,q,F=async()=>{let j={...N};if(!j.outdir&&w)j.outdir=w;if(!j.entrypoints&&q)j.entrypoints=q;try{let k=await I(j);M?.(k)}catch(k){let H=k instanceof Error?k:Error(String(k));if(C?.(H),!C)console.error("[dtsx] Generation failed:",H.message)}};return{name:"dtsx",esbuildOptions(j){if(j.outdir&&typeof j.outdir==="string")w=j.outdir;if(j.entryPoints){if(Array.isArray(j.entryPoints))q=j.entryPoints;else if(typeof j.entryPoints==="object")q=Object.values(j.entryPoints)}},async buildStart(){if(K)await F()},async buildEnd(j){if(L)await F()}}}var R=z,T=z,V=z;
3
3
  export{z as ma,R as na,T as oa,V as pa};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{a,b,c}from"./chunk-fg4cjy7w.js";import"./chunk-69rnp3hs.js";import"./chunk-2n1bbm2c.js";import"./chunk-jjwwkrfk.js";import"./chunk-1z1w3s0k.js";import"./chunk-4jw8qvts.js";import"./chunk-mcdb3q06.js";export{b as optimizeFile,a as optimizeDeclarations,c as minifyDts};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ec as K}from"./chunk-y581wnfe.js";import{Wc as _}from"./chunk-gssantc8.js";import{existsSync as j,mkdirSync as w,readFileSync as b,writeFileSync as V}from"fs";import{basename as H,join as R}from"path";function N(q){let z={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!q||q.length===0)return z;for(let A of q){let G=A.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
2
+ import{ec as K}from"./chunk-69rnp3hs.js";import{Wc as _}from"./chunk-gssantc8.js";import{existsSync as j,mkdirSync as w,readFileSync as b,writeFileSync as V}from"fs";import{basename as H,join as R}from"path";function N(q){let z={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!q||q.length===0)return z;for(let A of q){let G=A.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
3
3
  `).map((X)=>X.replace(/^\s*\*\s?/,"")).join(`
4
4
  `).trim(),Q=G.search(/@\w+/);if(Q===-1){z.description=G;continue}else if(Q>0)z.description=G.slice(0,Q).trim(),G=G.slice(Q);let U=/@(\w+)(?:\s+\{([^}]+)\})?\s*([^\n@]*(?:\n(?!@)[^\n@]*)*)/g,W;while((W=U.exec(G))!==null){let[,X,Y,Z]=W,$=Z.trim();switch(X){case"param":{let v=$.match(/^(\[)?(\w+)\]?\s*(?:-\s*)?(.*)/);if(v)z.params.push({name:v[2],type:Y,description:v[3].trim(),optional:!!v[1]});break}case"returns":case"return":z.returns={type:Y,description:$};break;case"example":z.examples.push($);break;case"deprecated":z.deprecated=$||"Deprecated";break;case"since":z.since=$;break;case"see":z.see.push($);break;case"throws":case"throw":z.throws.push({type:Y,description:$});break;case"category":z.category=$;break;default:if(!z.tags[X])z.tags[X]=[];z.tags[X].push($)}}}return z}function M(q,z){let A=N(q.leadingComments),G="";switch(q.kind){case"function":G=h(q);break;case"variable":G=T(q);break;case"interface":G=F(q);break;case"type":G=S(q);break;case"class":G=k(q);break;case"enum":G=x(q);break;default:G=q.text||q.name}let Q={name:q.name,kind:q.kind,signature:G,jsdoc:A,isExported:q.isExported,isDefault:q.isDefault,sourceFile:z};if(q.members&&q.members.length>0)Q.members=q.members.map((U)=>M(U,z));return Q}function h(q){let z=[];if(q.isExported)z.push("export");if(q.isDefault)z.push("default");if(z.push("function"),z.push(q.name),q.generics)z.push(q.generics);if(q.parameters){let A=q.parameters.map((G)=>{let Q="";if(G.rest)Q+="...";if(Q+=G.name,G.optional)Q+="?";if(G.type)Q+=`: ${G.type}`;return Q}).join(", ");z.push(`(${A})`)}else z.push("()");if(q.returnType)z.push(`: ${q.returnType}`);return z.join(" ").replace(/\s+/g," ")}function T(q){let z=[];if(q.isExported)z.push("export");if(z.push("const"),z.push(q.name),q.typeAnnotation)z.push(`: ${q.typeAnnotation}`);return z.join(" ")}function F(q){let z=[];if(q.isExported)z.push("export");if(z.push("interface"),z.push(q.name),q.generics)z.push(q.generics);if(q.extends)z.push(`extends ${q.extends}`);return z.join(" ")}function S(q){let z=[];if(q.isExported)z.push("export");if(z.push("type"),z.push(q.name),q.generics)z.push(q.generics);if(z.push("="),q.typeAnnotation)z.push(q.typeAnnotation);return z.join(" ")}function k(q){let z=[];if(q.isExported)z.push("export");if(q.isDefault)z.push("default");if(z.push("class"),z.push(q.name),q.generics)z.push(q.generics);if(q.extends)z.push(`extends ${q.extends}`);if(q.implements&&q.implements.length>0)z.push(`implements ${q.implements.join(", ")}`);return z.join(" ")}function x(q){let z=[];if(q.isExported)z.push("export");return z.push("enum"),z.push(q.name),z.join(" ")}async function P(q,z={}){let A=[],G=new Map;for(let Q of q){if(!j(Q)){_.warn(`File not found: ${Q}`);continue}let U=b(Q,"utf-8"),W=K(U,Q,!0);for(let X of W){if(X.kind==="import")continue;if(!z.includePrivate&&X.name.startsWith("_"))continue;if(!z.includeInternal&&X.leadingComments?.some((Z)=>Z.includes("@internal")))continue;let Y=M(X,Q);if(A.push(Y),z.groupByCategory&&Y.jsdoc.category){let Z=Y.jsdoc.category;if(!G.has(Z))G.set(Z,[]);G.get(Z).push(Y)}}}return{title:z.title||"API Documentation",description:z.description,entries:A,categories:G,generatedAt:new Date}}function B(q,z={}){let A=[];if(A.push(`# ${q.title}`),A.push(""),q.description)A.push(q.description),A.push("");if(A.push(`> Generated on ${q.generatedAt.toISOString()}`),A.push(""),A.push("## Table of Contents"),A.push(""),z.groupByCategory&&q.categories.size>0)for(let G of q.categories.keys())A.push(`- [${G}](#${E(G)})`);else{let G=I(q.entries);for(let[Q,U]of G)if(U.length>0)A.push(`- [${O(Q)}](#${E(O(Q))})`)}if(A.push(""),z.groupByCategory&&q.categories.size>0)for(let[G,Q]of q.categories){A.push(`## ${G}`),A.push("");for(let U of Q)A.push(...L(U,z))}else{let G=I(q.entries);for(let[Q,U]of G)if(U.length>0){A.push(`## ${O(Q)}`),A.push("");for(let W of U)A.push(...L(W,z))}}return A.join(`
5
5
  `)}function L(q,z){let A=[];if(A.push(`### ${q.name}`),A.push(""),q.jsdoc.deprecated)A.push(`> **Deprecated:** ${q.jsdoc.deprecated}`),A.push("");if(A.push("```typescript"),A.push(q.signature),A.push("```"),A.push(""),q.jsdoc.description)A.push(q.jsdoc.description),A.push("");if(q.jsdoc.params.length>0){A.push("**Parameters:**"),A.push(""),A.push("| Name | Type | Description |"),A.push("|------|------|-------------|");for(let G of q.jsdoc.params){let Q=G.optional?" (optional)":"",U=G.type||"any";A.push(`| \`${G.name}\`${Q} | \`${U}\` | ${G.description} |`)}A.push("")}if(q.jsdoc.returns){A.push("**Returns:**"),A.push("");let G=q.jsdoc.returns.type?`\`${q.jsdoc.returns.type}\``:"";A.push(`${G} ${q.jsdoc.returns.description}`),A.push("")}if(q.jsdoc.throws.length>0){A.push("**Throws:**"),A.push("");for(let G of q.jsdoc.throws){let Q=G.type?`\`${G.type}\``:"";A.push(`- ${Q} ${G.description}`)}A.push("")}if(q.jsdoc.examples.length>0){A.push("**Examples:**"),A.push("");for(let G of q.jsdoc.examples)A.push("```typescript"),A.push(G),A.push("```"),A.push("")}if(q.jsdoc.see.length>0){A.push("**See also:**"),A.push("");for(let G of q.jsdoc.see)A.push(`- ${G}`);A.push("")}if(q.jsdoc.since)A.push(`*Since: ${q.jsdoc.since}*`),A.push("");if(z.includeSourceLinks&&q.sourceFile){let G=q.sourceFile;if(z.sourceBaseUrl)A.push(`[Source](${z.sourceBaseUrl}/${G})`);else A.push(`*Source: ${G}*`);A.push("")}if(q.members&&q.members.length>0){A.push("**Members:**"),A.push("");for(let G of q.members)if(A.push(`#### ${G.name}`),A.push(""),A.push("```typescript"),A.push(G.signature),A.push("```"),A.push(""),G.jsdoc.description)A.push(G.jsdoc.description),A.push("")}return A.push("---"),A.push(""),A}function C(q,z={}){let A=B(q,z);return`<!DOCTYPE html>
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"./chunk-mcdb3q06.js";var e="@stacksjs/dtsx",i="module",n="0.9.17",r=!0,o="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",c="MIT",p="https://github.com/stacksjs/dtsx#readme",d={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},a={url:"https://github.com/stacksjs/dtsx/issues"},b=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},l="./dist/index.js",g="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},k=["dist"],h={benchmark:"bun benchmark/index.ts",build:"bun --filter './packages/dtsx' build",test:"bun test",lint:"bunx --bun pickier .","lint:fix":"bunx --bun pickier . --fix",format:"bunx --bun pickier . --format","format:fix":"bunx --bun pickier . --format --write",changelog:"bunx logsmith --verbose","changelog:generate":"bunx logsmith --output CHANGELOG.md",release:"bun --bun run changelog:generate && bunx --bun bumpx prompt --recursive",typecheck:"bunx tsc --noEmit","dev:docs":"bun --bun vitepress dev docs","build:docs":"bun --bun vitepress build docs","preview:docs":"bun --bun vitepress preview docs"},v={"@stacksjs/bumpx":"^0.2.4","@stacksjs/bunpress":"^0.1.4","@stacksjs/clapp":"^0.2.0",pickier:"^0.1.20","@stacksjs/gitlint":"^0.1.5","@stacksjs/logsmith":"^0.2.1","@types/bun":"^1.3.11","@typescript/native-preview":"^7.0.0-dev.20260311.1","buddy-bot":"^0.9.18","bun-git-hooks":"^0.3.1","bun-plugin-dtsx":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.121.0",typescript:"^5.9.3"},j=["packages/*"],y={name:e,type:i,version:n,private:r,description:o,author:u,license:c,homepage:p,repository:d,bugs:a,keywords:b,exports:m,module:l,types:g,bin:x,files:k,scripts:h,devDependencies:v,workspaces:j,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bunx --bun pickier lint --fix"}},"commit-msg":"bunx gitlint --edit .git/COMMIT_EDITMSG"}};export{j as workspaces,n as version,g as types,i as type,h as scripts,d as repository,r as private,e as name,l as module,c as license,b as keywords,p as homepage,k as files,m as exports,v as devDependencies,o as description,y as default,a as bugs,x as bin,u as author};
2
+ import"./chunk-mcdb3q06.js";var e="@stacksjs/dtsx",i="module",n="0.9.19",r=!0,o="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",c="MIT",p="https://github.com/stacksjs/dtsx#readme",d={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},a={url:"https://github.com/stacksjs/dtsx/issues"},b=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},l="./dist/index.js",g="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},k=["dist"],h={benchmark:"bun benchmark/index.ts",build:"bun --filter './packages/dtsx' build",test:"bun test",lint:"bunx --bun pickier .","lint:fix":"bunx --bun pickier . --fix",format:"bunx --bun pickier . --format","format:fix":"bunx --bun pickier . --format --write",changelog:"bunx logsmith --verbose","changelog:generate":"bunx logsmith --output CHANGELOG.md",release:"bun --bun run changelog:generate && bunx --bun bumpx prompt --recursive",typecheck:"bunx tsc --noEmit","dev:docs":"bun --bun vitepress dev docs","build:docs":"bun --bun vitepress build docs","preview:docs":"bun --bun vitepress preview docs"},v={"@stacksjs/bumpx":"^0.2.4","@stacksjs/bunpress":"^0.1.4","@stacksjs/clapp":"^0.2.0",pickier:"^0.1.20","@stacksjs/gitlint":"^0.1.5","@stacksjs/logsmith":"^0.2.1","@types/bun":"^1.3.11","@typescript/native-preview":"^7.0.0-dev.20260311.1","buddy-bot":"^0.9.18","bun-git-hooks":"^0.3.1","bun-plugin-dtsx":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.121.0",typescript:"^5.9.3"},j=["packages/*"],y={name:e,type:i,version:n,private:r,description:o,author:u,license:c,homepage:p,repository:d,bugs:a,keywords:b,exports:m,module:l,types:g,bin:x,files:k,scripts:h,devDependencies:v,workspaces:j,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bunx --bun pickier lint --fix"}},"commit-msg":"bunx gitlint --edit .git/COMMIT_EDITMSG"}};export{j as workspaces,n as version,g as types,i as type,h as scripts,d as repository,r as private,e as name,l as module,c as license,b as keywords,p as homepage,k as files,m as exports,v as devDependencies,o as description,y as default,a as bugs,x as bin,u as author};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ic as a,jc as b,kc as c}from"./chunk-kwmhsx3n.js";import"./chunk-jjwwkrfk.js";import"./chunk-1z1w3s0k.js";import"./chunk-7pwy4m0c.js";import"./chunk-4jw8qvts.js";import"./chunk-mcdb3q06.js";export{c as processSourceDirect,a as processSource,b as clearResultCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{s as a,t as b,u as c,v as d,w as e,x as f,y as g}from"./chunk-xhs0tsnn.js";import"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{f as startLSPServer,g as createFileWatcher,b as SymbolKind,a as LspDiagnosticSeverity,e as DtsxLanguageServer,d as DocumentHighlightKind,c as CompletionItemKind};
2
+ import{s as a,t as b,u as c,v as d,w as e,x as f,y as g}from"./chunk-9ycwkhxh.js";import"./chunk-69rnp3hs.js";import"./chunk-2n1bbm2c.js";import"./chunk-jjwwkrfk.js";import"./chunk-1z1w3s0k.js";import"./chunk-7pwy4m0c.js";import"./chunk-4jw8qvts.js";import"./chunk-mcdb3q06.js";export{f as startLSPServer,g as createFileWatcher,b as SymbolKind,a as LspDiagnosticSeverity,e as DtsxLanguageServer,d as DocumentHighlightKind,c as CompletionItemKind};
@@ -22,7 +22,7 @@ export declare function buildTypeDeclaration(node: TypeAliasDeclaration, isExpor
22
22
  /**
23
23
  * Build clean class declaration for DTS
24
24
  */
25
- export declare function buildClassDeclaration(node: ClassDeclaration, isExported: boolean, sf: SourceFile): string;
25
+ export declare function buildClassDeclaration(node: ClassDeclaration, isExported: boolean, sf: SourceFile, isDefault?: boolean): string;
26
26
  /**
27
27
  * Build clean class body for DTS (signatures only, no implementations)
28
28
  * Excludes: private fields (#field), private methods (#method), static blocks
@@ -15,6 +15,15 @@ export declare function getParameterName(param: ParameterDeclaration, sf?: Sourc
15
15
  * Check if a node has export modifier
16
16
  */
17
17
  export declare function hasExportModifier(node: Node): boolean;
18
+ /**
19
+ * Check if a node has the `default` modifier — i.e. it's an
20
+ * `export default` declaration. Without this check, `buildFunctionSignature`
21
+ * (and friends) only emit `export declare function ...` when the source
22
+ * was `export default function ...`, which silently drops the default
23
+ * qualifier and breaks `import { default as X } from './mod'`
24
+ * re-exports downstream.
25
+ */
26
+ export declare function hasDefaultModifier(node: Node): boolean;
18
27
  /**
19
28
  * Check if a function has async modifier
20
29
  */
package/dist/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{a as i$,b as n$,c as r$}from"../chunk-83e9a4fq.js";import{d as S9,e as T9,f as k9,g as v9,h as C9,i as b9,j as P9,k as x9}from"../chunk-f4c389mj.js";import{l as Q2,m as X2,n as q2,o as V2,p as Y2,q as W2,r as K2}from"../chunk-mzq58nw0.js";import{s as p$,t as d$,u as c$,v as l$,w as o$,x as s$,y as a$}from"../chunk-xhs0tsnn.js";import{A as p8,B as d8,C as c8,D as l8,E as o8,F as s8,G as a8,H as i8,z as m8}from"../chunk-mxam9312.js";import{I as Z$,J as $$,K as J$,L as Q$,M as X$,N as q$,O as V$,P as Y$}from"../chunk-d0p3jzwb.js";import{Q as n8,R as r8,S as t8,T as e8,U as Z9,V as $9,W as J9,X as Q9,Y as X9}from"../chunk-nf54b52t.js";import{$ as Z2,Z as t$,_ as e$,aa as $2,ba as J2}from"../chunk-zf17s33e.js";import{$a as t9,Aa as u8,Ba as q9,Ca as V9,Da as Y9,Ea as QZ,Fa as W9,Ga as K9,Ha as H9,Ia as U9,Ja as O9,Ka as G9,La as y9,Ma as h9,Na as g9,Oa as f9,Pa as u9,Qa as m9,Ra as p9,Sa as d9,Ta as c9,Ua as l9,Va as o9,Wa as s9,Xa as a9,Ya as i9,Za as n9,_a as r9,ab as e9,bb as W$,cb as K$,db as H$,eb as U$,fb as O$,gb as G$,hb as uZ,ib as _$,jb as z$,kb as A$,lb as T$,mb as k$,nb as v$,ob as C$,pb as b$,qb as P$,rb as x$,sb as y$,tb as f$,ua as P8,ub as u$,va as x8,vb as m$,wa as y8,xa as h8,ya as g8,za as f8}from"../chunk-x3q42h61.js";import{$b as I8,Ab as s6,Bb as s0,Cb as a0,Db as Q8,Eb as X8,Fb as q8,Gb as V8,Hb as Y8,Ib as W8,Jb as K8,Kb as H8,Lb as U8,Mb as O8,Nb as G8,Ob as _8,Pb as z8,Qb as A8,Rb as B8,Sb as j8,Tb as N8,Ub as R8,Vb as F8,Wb as D8,Xb as E8,Yb as L8,Zb as w8,_b as M8,ac as S8,bc as T8,cc as k8,dc as v8,ec as FZ,fc as C8,gc as b8,wb as d6,xb as c6,yb as l6,zb as o6}from"../chunk-y581wnfe.js";import{hc as g0}from"../chunk-2n1bbm2c.js";import{ic as h$,jc as g$}from"../chunk-4s9jv983.js";import{lc as KZ}from"../chunk-8z31rkfp.js";import"../chunk-2r21f44d.js";import{Ac as I$,Bc as S$,Cc as DZ,pc as i0,qc as B$,rc as j$,sc as N$,tc as R$,uc as F$,vc as D$,wc as E$,xc as L$,yc as w$,zc as M$}from"../chunk-vpjw38x7.js";import{Fc as a6,Gc as i6,Hc as n6,Ic as r6,Jc as t6,Kc as o0,Lc as e6,Mc as Z8,Nc as $8,Oc as J8}from"../chunk-285mqzvx.js";import{Pc as D9,Qc as E9,Rc as L9,Sc as w9,Tc as M9,Uc as I9}from"../chunk-a3txc27m.js";import{$c as R9,Vc as _9,Wc as z9,Xc as A9,Yc as B9,Zc as j9,_c as N9,ad as F9}from"../chunk-gssantc8.js";import{bd as h0,dd as n0}from"../chunk-mcdb3q06.js";import{basename as rZ,dirname as tZ,isAbsolute as eZ,join as Z0,relative as $0,resolve as J0}from"path";function l1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid file path: must be a non-empty string");return Z}function o1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid directory path: must be a non-empty string");return Z}function s1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return Z}function a1(Z){if(typeof Z!=="string")throw TypeError("Invalid source code: must be a string");return Z}function i1(Z){if(typeof Z!=="string")throw TypeError("Invalid DTS content: must be a string");return Z}function n1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid module specifier: must be a non-empty string");return Z}function r1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(Z)&&!/^[A-Z_$]/.test(Z));return Z}function t1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid declaration name: must be a non-empty string");return Z}function e1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!Z.startsWith("/")&&!/^[A-Z]:/i.test(Z))throw Error("Invalid absolute path: must start with / or drive letter");return Z}function Z3(Z){if(!Z||typeof Z!=="string")throw Error("Invalid relative path: must be a non-empty string");if(Z.startsWith("/")||/^[A-Z]:/i.test(Z))throw Error("Invalid relative path: must not be absolute");return Z}function $3(Z){if(typeof Z!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(Z)}catch{throw Error("Invalid JSON string: must be valid JSON")}return Z}function J3(Z,$){return typeof Z==="string"||typeof Z==="number"}function Q3(Z){return Z}var X3={join(Z,...$){return Z0(Z,...$)},dirname(Z){return tZ(Z)},basename(Z){return rZ(Z)},resolve(...Z){return J0(...Z)},isAbsolute(Z){return eZ(Z)},relative(Z,$){return $0(Z,$)}};function Q0(Z,$){let J=Z.length,Q=$.length,X=Array.from({length:J+1},()=>Array(Q+1).fill(0));for(let q=1;q<=J;q++)for(let V=1;V<=Q;V++)if(Z[q-1]===$[V-1])X[q][V]=X[q-1][V-1]+1;else X[q][V]=Math.max(X[q-1][V],X[q][V-1]);return X}function X0(Z,$,J,Q,X){let q=[];while(Q>0||X>0)if(Q>0&&X>0&&$[Q-1]===J[X-1])q.unshift({op:"equal",oldIdx:Q-1,newIdx:X-1,line:$[Q-1]}),Q--,X--;else if(X>0&&(Q===0||Z[Q][X-1]>=Z[Q-1][X]))q.unshift({op:"add",newIdx:X-1,line:J[X-1]}),X--;else if(Q>0)q.unshift({op:"remove",oldIdx:Q-1,line:$[Q-1]}),Q--;return q}function JZ(Z,$){let J=Z;if($.ignoreWhitespace)J=J.replace(/\s+/g," ").trim();return J}function p(Z,$,J,Q={}){let{context:X=3,ignoreWhitespace:q=!1,ignoreBlankLines:V=!1}=Q,Y=Z.split(`
2
+ import{a as i$,b as n$,c as r$}from"../chunk-fg4cjy7w.js";import{d as S9,e as T9,f as k9,g as v9,h as C9,i as b9,j as P9,k as x9}from"../chunk-s30jnjb4.js";import{l as Q2,m as X2,n as q2,o as V2,p as Y2,q as W2,r as K2}from"../chunk-dv8haj2p.js";import{s as p$,t as d$,u as c$,v as l$,w as o$,x as s$,y as a$}from"../chunk-9ycwkhxh.js";import{A as p8,B as d8,C as c8,D as l8,E as o8,F as s8,G as a8,H as i8,z as m8}from"../chunk-mxam9312.js";import{I as Z$,J as $$,K as J$,L as Q$,M as X$,N as q$,O as V$,P as Y$}from"../chunk-d0p3jzwb.js";import{Q as n8,R as r8,S as t8,T as e8,U as Z9,V as $9,W as J9,X as Q9,Y as X9}from"../chunk-nf54b52t.js";import{$ as Z2,Z as t$,_ as e$,aa as $2,ba as J2}from"../chunk-zf17s33e.js";import{$a as t9,Aa as u8,Ba as q9,Ca as V9,Da as Y9,Ea as QZ,Fa as W9,Ga as K9,Ha as H9,Ia as U9,Ja as O9,Ka as G9,La as y9,Ma as h9,Na as g9,Oa as f9,Pa as u9,Qa as m9,Ra as p9,Sa as d9,Ta as c9,Ua as l9,Va as o9,Wa as s9,Xa as a9,Ya as i9,Za as n9,_a as r9,ab as e9,bb as W$,cb as K$,db as H$,eb as U$,fb as O$,gb as G$,hb as uZ,ib as _$,jb as z$,kb as A$,lb as T$,mb as k$,nb as v$,ob as C$,pb as b$,qb as P$,rb as x$,sb as y$,tb as f$,ua as P8,ub as u$,va as x8,vb as m$,wa as y8,xa as h8,ya as g8,za as f8}from"../chunk-7zsd1qqw.js";import{$b as I8,Ab as s6,Bb as s0,Cb as a0,Db as Q8,Eb as X8,Fb as q8,Gb as V8,Hb as Y8,Ib as W8,Jb as K8,Kb as H8,Lb as U8,Mb as O8,Nb as G8,Ob as _8,Pb as z8,Qb as A8,Rb as B8,Sb as j8,Tb as N8,Ub as R8,Vb as F8,Wb as D8,Xb as E8,Yb as L8,Zb as w8,_b as M8,ac as S8,bc as T8,cc as k8,dc as v8,ec as FZ,fc as C8,gc as b8,wb as d6,xb as c6,yb as l6,zb as o6}from"../chunk-69rnp3hs.js";import{hc as g0}from"../chunk-2n1bbm2c.js";import{ic as h$,jc as g$}from"../chunk-kwmhsx3n.js";import{lc as KZ}from"../chunk-jjwwkrfk.js";import"../chunk-1z1w3s0k.js";import{Ac as I$,Bc as S$,Cc as DZ,pc as i0,qc as B$,rc as j$,sc as N$,tc as R$,uc as F$,vc as D$,wc as E$,xc as L$,yc as w$,zc as M$}from"../chunk-7pwy4m0c.js";import{Fc as a6,Gc as i6,Hc as n6,Ic as r6,Jc as t6,Kc as o0,Lc as e6,Mc as Z8,Nc as $8,Oc as J8}from"../chunk-4jw8qvts.js";import{Pc as D9,Qc as E9,Rc as L9,Sc as w9,Tc as M9,Uc as I9}from"../chunk-a3txc27m.js";import{$c as R9,Vc as _9,Wc as z9,Xc as A9,Yc as B9,Zc as j9,_c as N9,ad as F9}from"../chunk-gssantc8.js";import{bd as h0,dd as n0}from"../chunk-mcdb3q06.js";import{basename as rZ,dirname as tZ,isAbsolute as eZ,join as Z0,relative as $0,resolve as J0}from"path";function l1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid file path: must be a non-empty string");return Z}function o1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid directory path: must be a non-empty string");return Z}function s1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return Z}function a1(Z){if(typeof Z!=="string")throw TypeError("Invalid source code: must be a string");return Z}function i1(Z){if(typeof Z!=="string")throw TypeError("Invalid DTS content: must be a string");return Z}function n1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid module specifier: must be a non-empty string");return Z}function r1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(Z)&&!/^[A-Z_$]/.test(Z));return Z}function t1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid declaration name: must be a non-empty string");return Z}function e1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!Z.startsWith("/")&&!/^[A-Z]:/i.test(Z))throw Error("Invalid absolute path: must start with / or drive letter");return Z}function Z3(Z){if(!Z||typeof Z!=="string")throw Error("Invalid relative path: must be a non-empty string");if(Z.startsWith("/")||/^[A-Z]:/i.test(Z))throw Error("Invalid relative path: must not be absolute");return Z}function $3(Z){if(typeof Z!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(Z)}catch{throw Error("Invalid JSON string: must be valid JSON")}return Z}function J3(Z,$){return typeof Z==="string"||typeof Z==="number"}function Q3(Z){return Z}var X3={join(Z,...$){return Z0(Z,...$)},dirname(Z){return tZ(Z)},basename(Z){return rZ(Z)},resolve(...Z){return J0(...Z)},isAbsolute(Z){return eZ(Z)},relative(Z,$){return $0(Z,$)}};function Q0(Z,$){let J=Z.length,Q=$.length,X=Array.from({length:J+1},()=>Array(Q+1).fill(0));for(let q=1;q<=J;q++)for(let V=1;V<=Q;V++)if(Z[q-1]===$[V-1])X[q][V]=X[q-1][V-1]+1;else X[q][V]=Math.max(X[q-1][V],X[q][V-1]);return X}function X0(Z,$,J,Q,X){let q=[];while(Q>0||X>0)if(Q>0&&X>0&&$[Q-1]===J[X-1])q.unshift({op:"equal",oldIdx:Q-1,newIdx:X-1,line:$[Q-1]}),Q--,X--;else if(X>0&&(Q===0||Z[Q][X-1]>=Z[Q-1][X]))q.unshift({op:"add",newIdx:X-1,line:J[X-1]}),X--;else if(Q>0)q.unshift({op:"remove",oldIdx:Q-1,line:$[Q-1]}),Q--;return q}function JZ(Z,$){let J=Z;if($.ignoreWhitespace)J=J.replace(/\s+/g," ").trim();return J}function p(Z,$,J,Q={}){let{context:X=3,ignoreWhitespace:q=!1,ignoreBlankLines:V=!1}=Q,Y=Z.split(`
3
3
  `),W=$.split(`
4
4
  `);if(Y[Y.length-1]==="")Y.pop();if(W[W.length-1]==="")W.pop();let K=Y.map((F)=>JZ(F,{ignoreWhitespace:q})),H=W.map((F)=>JZ(F,{ignoreWhitespace:q})),A=K,_=H,O=Y.map((F,M)=>M),G=W.map((F,M)=>M);if(V)A=[],_=[],O=[],G=[],K.forEach((F,M)=>{if(F.trim())A.push(F),O.push(M)}),H.forEach((F,M)=>{if(F.trim())_.push(F),G.push(M)});let U=Q0(A,_),z=X0(U,A,_,A.length,_.length),B=z.every((F)=>F.op==="equal"),j=0,N=0,R=0;for(let F of z)if(F.op==="add")j++;else if(F.op==="remove")N++;else R++;let k=q0(z,Y,W,O,G,X);return{filePath:J,identical:B,hunks:k,stats:{additions:j,deletions:N,unchanged:R},oldContent:Z,newContent:$}}function q0(Z,$,J,Q,X,q){let V=[],Y=[];if(Z.forEach((H,A)=>{if(H.op!=="equal")Y.push(A)}),Y.length===0)return V;let W=[],K=[Y[0]];for(let H=1;H<Y.length;H++)if(Y[H]-Y[H-1]<=q*2+1)K.push(Y[H]);else W.push(K),K=[Y[H]];W.push(K);for(let H of W){let A=Math.max(0,H[0]-q),_=Math.min(Z.length-1,H[H.length-1]+q),O=Z.slice(A,_+1),G=[],U=1,z=1,B=0,j=0;for(let N=0;N<A;N++){let R=Z[N];if(R.op==="equal"||R.op==="remove")U++;if(R.op==="equal"||R.op==="add")z++}for(let N of O)if(N.op==="equal")G.push(` ${N.line}`),B++,j++;else if(N.op==="remove")G.push(`-${N.line}`),B++;else if(N.op==="add")G.push(`+${N.line}`),j++;V.push({operation:"equal",lines:G,oldStart:U,oldCount:B,newStart:z,newCount:j})}return V}function Y3(Z){if(Z.identical)return"";let $=[];$.push(`--- a/${Z.filePath}`),$.push(`+++ b/${Z.filePath}`);for(let J of Z.hunks)$.push(`@@ -${J.oldStart},${J.oldCount} +${J.newStart},${J.newCount} @@`),$.push(...J.lines);return $.join(`
5
5
  `)}function V0(Z){if(Z.identical)return`\x1B[32m\u2713 ${Z.filePath} (unchanged)\x1B[0m`;let $=[],J=`+${Z.stats.additions} -${Z.stats.deletions}`;$.push(`\x1B[1m${Z.filePath}\x1B[0m \x1B[90m(${J})\x1B[0m`),$.push("");for(let Q of Z.hunks){$.push(`\x1B[36m@@ -${Q.oldStart},${Q.oldCount} +${Q.newStart},${Q.newCount} @@\x1B[0m`);for(let X of Q.lines)if(X.startsWith("+"))$.push(`\x1B[32m${X}\x1B[0m`);else if(X.startsWith("-"))$.push(`\x1B[31m${X}\x1B[0m`);else $.push(`\x1B[90m${X}\x1B[0m`);$.push("")}return $.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{fa as a,ga as b,ha as c}from"../../chunk-6sx8ppfg.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{a as dts,c as default,b as bunDts};
2
+ import{fa as a,ga as b,ha as c}from"../../chunk-gg6xh82k.js";import"../../chunk-7zsd1qqw.js";import"../../chunk-69rnp3hs.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-kwmhsx3n.js";import"../../chunk-jjwwkrfk.js";import"../../chunk-1z1w3s0k.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{a as dts,c as default,b as bunDts};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ia as a,ja as b,ka as c,la as d}from"../../chunk-a6tznyxq.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as esbuildDts,a as dtsx,c as dts,d as default};
2
+ import{ia as a,ja as b,ka as c,la as d}from"../../chunk-ezrgnecm.js";import"../../chunk-7zsd1qqw.js";import"../../chunk-69rnp3hs.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-kwmhsx3n.js";import"../../chunk-jjwwkrfk.js";import"../../chunk-1z1w3s0k.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as esbuildDts,a as dtsx,c as dts,d as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ca as s}from"../../chunk-scrtz9j4.js";import{fa as t}from"../../chunk-6sx8ppfg.js";import{ia as i,ka as p}from"../../chunk-a6tznyxq.js";import{ma as e,oa as u}from"../../chunk-jvfvxm5w.js";import{qa as l,ra as a,sa as n}from"../../chunk-8hxrwrsf.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{n as webpackPlugin,a as webpackDts,s as viteDts,s as vite,u as tsupPlugin,e as tsupDts,e as tsup,p as esbuildPlugin,i as esbuildDts,i as esbuild,t as bunDts,t as bun,l as DtsxWebpackPlugin};
2
+ import{ca as s}from"../../chunk-m68323h2.js";import{fa as t}from"../../chunk-gg6xh82k.js";import{ia as i,ka as p}from"../../chunk-ezrgnecm.js";import{ma as e,oa as u}from"../../chunk-nwvqfthk.js";import{qa as l,ra as a,sa as n}from"../../chunk-mr4jjsps.js";import"../../chunk-7zsd1qqw.js";import"../../chunk-69rnp3hs.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-kwmhsx3n.js";import"../../chunk-jjwwkrfk.js";import"../../chunk-1z1w3s0k.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{n as webpackPlugin,a as webpackDts,s as viteDts,s as vite,u as tsupPlugin,e as tsupDts,e as tsup,p as esbuildPlugin,i as esbuildDts,i as esbuild,t as bunDts,t as bun,l as DtsxWebpackPlugin};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ma as a,na as b,oa as c,pa as d}from"../../chunk-jvfvxm5w.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as tsupDts,a as dtsxPlugin,c as dts,d as default};
2
+ import{ma as a,na as b,oa as c,pa as d}from"../../chunk-nwvqfthk.js";import"../../chunk-7zsd1qqw.js";import"../../chunk-69rnp3hs.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-kwmhsx3n.js";import"../../chunk-jjwwkrfk.js";import"../../chunk-1z1w3s0k.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as tsupDts,a as dtsxPlugin,c as dts,d as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ca as a,da as b,ea as c}from"../../chunk-scrtz9j4.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as viteDts,a as dts,c as default};
2
+ import{ca as a,da as b,ea as c}from"../../chunk-m68323h2.js";import"../../chunk-7zsd1qqw.js";import"../../chunk-69rnp3hs.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-kwmhsx3n.js";import"../../chunk-jjwwkrfk.js";import"../../chunk-1z1w3s0k.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as viteDts,a as dts,c as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{qa as a,ra as b,sa as c,ta as d}from"../../chunk-8hxrwrsf.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as dtsxWebpack,c as dts,d as default,a as DtsxWebpackPlugin};
2
+ import{qa as a,ra as b,sa as c,ta as d}from"../../chunk-mr4jjsps.js";import"../../chunk-7zsd1qqw.js";import"../../chunk-69rnp3hs.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-kwmhsx3n.js";import"../../chunk-jjwwkrfk.js";import"../../chunk-1z1w3s0k.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as dtsxWebpack,c as dts,d as default,a as DtsxWebpackPlugin};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/dtsx",
3
3
  "type": "module",
4
- "version": "0.9.17",
4
+ "version": "0.9.19",
5
5
  "description": "A modern, fast .d.ts generation tool, powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -1,16 +0,0 @@
1
- // @bun
2
- var E=!1,M=null;function h(J){if(J.indexOf("/*")===-1)return J.trim();let X=[],$=0,z=0,B=J.length;while(z<B)if(J.charCodeAt(z)===47&&z+1<B&&J.charCodeAt(z+1)===42){if(z>$)X.push(J.substring($,z));z+=2;while(z<B-1){if(J.charCodeAt(z)===42&&J.charCodeAt(z+1)===47){z+=2;break}z++}$=z}else z++;if($<B)X.push(J.substring($));return X.join("").trim()}function $z(){E=!0,M=null}function Qz(){E=!1;let J=M;return M=null,J}function S(J){let Y=J.length;if(Y===0)return!1;let X=0;if(J.charCodeAt(X)===45)X++;if(X>=Y)return!1;let $=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===$)return!1;if(X<Y&&J.charCodeAt(X)===46){X++;let z=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===z)return!1}return X===Y}function o(J){for(let Y=0,X=J.length-1;Y<X;Y++){let $=J.charCodeAt(Y);if($<48||$>57)return!1}return!0}function D(J,Y){let X=0,$=0;while(($=J.indexOf(Y,$))!==-1)X++,$+=Y.length;return X}function _(J){let Y=J.length,X=!1;for(let Z=1;Z<Y;Z++)if(J.charCodeAt(Z)<=32&&J.charCodeAt(Z-1)<=32){X=!0;break}if(!X)for(let Z=0;Z<Y;Z++){let H=J.charCodeAt(Z);if(H===10||H===13||H===9){X=!0;break}}if(!X)return J;let $=[],z=-1,B=!1;for(let Z=0;Z<Y;Z++)if(J.charCodeAt(Z)<=32){if(!B){if(z>=0)$.push(J.substring(z,Z));$.push(" "),B=!0,z=-1}}else{if(B||z<0)z=Z;B=!1}if(z>=0)$.push(J.substring(z));return $.join("")}function V(J,Y=!1,X=!1,$=0){if(!J||typeof J!=="string")return"unknown";if($>=20)return"unknown";let z=J.trim();if(z.startsWith("BigInt("))return"bigint";if(z.startsWith("Symbol.for("))return"symbol";if(z.includes(".raw`")||z.includes("String.raw`"))return"string";if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'")||z.startsWith("`")&&z.endsWith("`")){if(!z.includes("${")){if(!Y)return"string";return z}if(Y)return z;return"string"}if(S(z)){if(!Y)return"number";return z}if(z==="true"||z==="false"){if(!Y)return"boolean";return z}if(z==="null")return"null";if(z==="undefined")return"undefined";if(z.startsWith("[")&&z.endsWith("]"))return I(z,Y,$+1);if(z.startsWith("{")&&z.endsWith("}"))return s(z,Y,$+1);if(z.startsWith("class ")||z.startsWith("class{"))return c(z);if(z.startsWith("new "))return d(z);if(z.includes("=>")||z.startsWith("function")||z.startsWith("async"))return y(z,X,$,Y);if(z.endsWith("as const")){let B=z.slice(0,-8).trim();if(B.startsWith("[")&&B.endsWith("]")){let Z=B.slice(1,-1).trim();if(!Z)return"readonly []";let H=w(Z),Q=[];for(let L=0;L<H.length;L++)Q.push(V(H[L].trim(),!0,!1,$+1));return`readonly [${Q.join(", ")}]`}return V(B,!0,X,$+1)}if(z.startsWith("`")&&z.endsWith("`"))return p(z,Y);if(z.startsWith("Promise."))return f(z,Y,$);if(z.startsWith("await "))return"unknown";if(z.charCodeAt(z.length-1)===110&&z.length>1&&o(z)){if(Y)return z;return"bigint"}if(z.startsWith("Symbol(")||z==="Symbol.for")return"symbol";return"unknown"}function l(J,Y=!1,X=0){return V(J,Y,!0,X)}function p(J,Y){if(J.includes(".raw`")||J.includes("String.raw`"))return"string";if(!Y)return"string";if(!J.includes("${"))return J;return"string"}function d(J){let Y=4;while(Y<J.length&&J.charCodeAt(Y)<=32)Y++;let X=Y,$=J.charCodeAt(Y);if($<65||$>90)return"unknown";while(Y<J.length&&(P(J.charCodeAt(Y))||J.charCodeAt(Y)===46))Y++;if(Y===X)return"unknown";let z=J.slice(X,Y);{let B=J.slice(Y),Z=B;if(B.startsWith("<")){let Q=0,L=-1;for(let O=0;O<B.length;O++)if(B[O]==="<")Q++;else if(B[O]===">"){if(Q--,Q===0){L=O;break}}if(L!==-1){let O=B.slice(0,L+1);Z=B.slice(L+1);let G=Z.indexOf("(");if(G!==-1){let W=0,K=-1;for(let F=G;F<Z.length;F++)if(Z[F]==="(")W++;else if(Z[F]===")"){if(W--,W===0){K=F;break}}if(K!==-1){if(Z.slice(K+1).trimStart().startsWith("."))return"unknown"}}return`${z}${O}`}}let H=Z.indexOf("(");if(H!==-1){let Q=0,L=-1;for(let O=H;O<Z.length;O++)if(Z[O]==="(")Q++;else if(Z[O]===")"){if(Q--,Q===0){L=O;break}}if(L!==-1){if(Z.slice(L+1).trimStart().startsWith("."))return"unknown"}}switch(z){case"Date":return"Date";case"Map":return"Map<any, any>";case"Set":return"Set<any>";case"WeakMap":return"WeakMap<any, any>";case"WeakSet":return"WeakSet<any>";case"RegExp":return"RegExp";case"Error":return"Error";case"Array":return"any[]";case"Object":return"object";case"Function":return"Function";case"Promise":return"Promise<any>";default:return z}}return"unknown"}function c(J){let Y=J.trimStart(),X=5;while(X<Y.length&&Y.charCodeAt(X)<=32)X++;let $=X;if(X<Y.length&&P(Y.charCodeAt(X))){while(X<Y.length&&P(Y.charCodeAt(X)))X++;return`typeof ${Y.slice($,X)}`}return"{ new (...args: any[]): any }"}function f(J,Y,X=0){if(J.startsWith("Promise.resolve(")){let z=J.indexOf(")",16);if(z!==-1){let B=J.slice(16,z).trim();if(B)return`Promise<${V(B,Y,!1,X+1)}>`}return"Promise<unknown>"}if(J.startsWith("Promise.reject("))return"Promise<never>";if(J.startsWith("Promise.all(")){let $=J.indexOf("[",12),z=J.lastIndexOf("]");if($!==-1&&z>$){let B=J.slice($+1,z).trim(),Z=w(B),H=[];for(let Q=0;Q<Z.length;Q++){let L=Z[Q].trim();if(L.startsWith("Promise.resolve(")){let O=f(L,Y,X+1),G=O.indexOf("<"),W=O.lastIndexOf(">");H.push(G!==-1&&W>G?O.slice(G+1,W):"unknown")}else H.push(V(L,Y,!1,X+1))}return`Promise<[${H.join(", ")}]>`}return"Promise<unknown[]>"}return"Promise<unknown>"}function I(J,Y,X=0){let $=J.slice(1,-1).trim();if(!$)return"never[]";if(X>=20)return"unknown[]";let z=w($),B=!1;for(let W=0;W<z.length;W++){let K=z[W],F=K.length;while(F>0&&K.charCodeAt(F-1)<=32)F--;if(F>=8&&K.slice(F-8,F)==="as const"){B=!0;break}}if(B){let W=[];for(let K=0;K<z.length;K++){let F=z[K].trim();if(F.endsWith("as const")){let q=F.slice(0,-8).trim();if(q.startsWith("[")&&q.endsWith("]")){let N=q.slice(1,-1).trim(),U=w(N),R=[];for(let b=0;b<U.length;b++)R.push(V(U[b].trim(),!0,!1,X+1));W.push(`readonly [${R.join(", ")}]`)}else W.push(V(q,!0,!1,X+1))}else if(F.startsWith("[")&&F.endsWith("]"))W.push(I(F,!0,X+1));else W.push(V(F,!0,!1,X+1))}return`readonly [
3
- ${W.join(` |
4
- `)}
5
- ]`}let Z=E&&!Y,H=[],Q=[];for(let W of z){let K=W.trim(),F=M;if(M=null,K.startsWith("[")&&K.endsWith("]"))H.push(I(K,Y,X+1));else H.push(l(K,Y,X+1));if(Z)Q.push(M);M=F}if(Z)if(g(J))M=_(J);else{let W=[];for(let K=0;K<z.length;K++){let F=z[K].trim();if(F.endsWith("as const"))continue;if(x(F)||F==="null"||F==="undefined")W.push(F);else if(F.startsWith("[")&&g(F))W.push(_(F));else if(F.startsWith("{")){if(Q[K])W.push(Q[K])}else{let q=V(F,!1,!1,0);if(q!=="unknown")W.push(q)}}if(W.length>0)M=`[${W.join(", ")}]`}if(Y)return`readonly [${H.join(", ")}]`;let L=new Set,O=[],G=!0;for(let W of H){if(!L.has(W))L.add(W),O.push(W);if(G){if(!(S(W)||W==="true"||W==="false"||W.charCodeAt(0)===34&&W.charCodeAt(W.length-1)===34||W.charCodeAt(0)===39&&W.charCodeAt(W.length-1)===39))G=!1}}if(G&&H.length<=10)return`readonly [${H.join(", ")}]`;if(O.length===1)return`${O[0]}[]`;return`(${O.join(" | ")})[]`}function w(J){let Y=[],X=0,$=0,z=!1,B=0;for(let H=0;H<J.length;H++){let Q=J.charCodeAt(H);if(!z&&(Q===34||Q===39||Q===96))z=!0,B=Q;else if(z&&Q===B&&(H===0||J.charCodeAt(H-1)!==92))z=!1;if(!z){if(Q===91||Q===123||Q===40)$++;else if(Q===93||Q===125||Q===41)$--;else if(Q===44&&$===0){let L=J.substring(X,H).trim();if(L)Y.push(L);X=H+1;continue}}}let Z=J.substring(X).trim();if(Z)Y.push(Z);return Y}function x(J){if(S(J))return!0;if(J==="true"||J==="false")return!0;if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return!0;return!1}function m(J){return J==="number"||J==="string"||J==="boolean"}function g(J){let Y=!1,X=0,$=J.length;for(let z=0;z<$;z++){let B=J.charCodeAt(z);if(Y){if(B===92){z++;continue}if(B===X)Y=!1;continue}if(B===34||B===39||B===96){Y=!0,X=B;continue}if(B===61&&z+1<$&&J.charCodeAt(z+1)===62)return!1;if(B>=97&&B<=122){let Z=z;while(z<$&&(J.charCodeAt(z)>=97&&J.charCodeAt(z)<=122||J.charCodeAt(z)>=65&&J.charCodeAt(z)<=90||J.charCodeAt(z)>=48&&J.charCodeAt(z)<=57||J.charCodeAt(z)===95||J.charCodeAt(z)===36))z++;let H=J.slice(Z,z);if(H==="new"||H==="async"||H==="await"||H==="function"||H==="yield"||H==="console"||H==="process")return!1;let Q=z;while(Q<$&&J.charCodeAt(Q)<=32)Q++;if(Q<$&&J.charCodeAt(Q)===40)return!1;z--}}return!0}function s(J,Y,X=0){let $=J.slice(1,-1).trim();if(!$)return"{}";if(X>=20)return"Record<string, unknown>";let z=a($),B=[],Z=E&&!Y,H=[];for(let[Q,L]of z){let O=M;M=null;let G,W=L.trim();if(e(W))G=zz(Q,W);else if(G=V(L,Y,!1,X+1),G.includes("=>")||G.includes("function")||G.includes("async"))G=i(G);let K=M;M=O;let F=L.trim(),q=r(Q);if(q){let N=t(q.kind,q.name,G);if(N){B.push(N);continue}}if(!Y&&m(G)&&x(F))B.push(`/** @defaultValue ${F} */
6
- ${Q}: ${G}`);else B.push(`${Q}: ${G}`);if(Z){let N=h(Q);if(F.endsWith("as const"));else if(x(F))H.push(`${N}: ${F}`);else if(F.startsWith("[")&&g(F))H.push(`${N}: ${_(F)}`);else if(F.startsWith("{")){if(K)H.push(`${N}: ${K}`)}else if(!F.startsWith("[")&&(F.includes("=>")||F.startsWith("function")||F.startsWith("async"))){let U=y(F,!1,0,!0);H.push(`${N}: ${U}`)}}}if(Z&&H.length>0){let Q=X>0?(X-1)/2:0,L=`{ ${H.join(", ")} }`;if(L.length<=80)M=L;else{let O=" ".repeat((Q+1)*2),G=" ".repeat(Q*2);M=`{
7
- ${O}${H.join(`,
8
- ${O}`)}
9
- ${G}}`}}return`{
10
- ${B.join(`;
11
- `)}
12
- }`}function i(J){let X=J.split(`
13
- `).map((O)=>C(O)).join(`
14
- `),$=X.indexOf("async");if($!==-1){let O=$>0?X.charCodeAt($-1):32,G=$+5<X.length?X.charCodeAt($+5):32;if(!P(O)&&!P(G))X=(X.slice(0,$)+X.slice($+5)).trim()}let z=X.indexOf("(");if(z!==-1){let O=j(X,z,"(",")");if(O!==-1){let G=X.slice(z,O+1),W=k(G);X=X.slice(0,z)+W+X.slice(O+1)}}let B=X.length,Z="",H=[],Q=!1,L=!1;for(let O=0;O<B;O++){let G=X.charCodeAt(O);if(G===123||G===40)H.push(G);else if(G===125||G===41)H.pop();if(G<=32){if(Q=!0,G===10||G===13)L=!0;continue}if(Q&&Z.length>0){let K=(H.length>0?H[H.length-1]:0)===123;if(L&&K){let F=Z.charCodeAt(Z.length-1),q=F===59||F===44||F===123||G===125,N=Z.length>=2&&Z.charCodeAt(Z.length-1)===47&&Z.charCodeAt(Z.length-2)===42;if(!q&&!N)Z+="; ";else Z+=" "}else Z+=" "}Q=!1,L=!1,Z+=X[O]}return Z.trim()}function P(J){return J>=97&&J<=122||J>=65&&J<=90||J>=48&&J<=57||J===95||J===36}function k(J){let Y=J.trim(),X,$=!1;if(Y.startsWith("(")&&Y.endsWith(")"))X=Y.slice(1,-1),$=!0;else X=Y;let z=X.trim();if(!z)return $?"()":"";let B=!1;{let F=0;for(let q=0;q<z.length;q++){let N=z.charCodeAt(q);if(N===40||N===60||N===91||N===123)F++;else if(N===41||N===62||N===93||N===125)F--;else if(F===0&&N===61){let U=q>0?z.charCodeAt(q-1):0,R=q+1<z.length?z.charCodeAt(q+1):0;if(U!==61&&U!==33&&U!==60&&U!==62&&R!==61&&R!==62){B=!0;break}}}}if(!B)return Y;let Z=[],H=[],Q=0,L=0,O=!1,G=0;for(let F=0;F<=z.length;F++){if(F===z.length){Z.push(z.slice(Q));break}let q=z.charCodeAt(F);if(O){if(q===92){F++;continue}if(q===G)O=!1;continue}if(q===39||q===34||q===96){O=!0,G=q;continue}if(q===40||q===60||q===91||q===123)L++;else if(q===41||q===62||q===93||q===125)L--;else if(q===44&&L===0){Z.push(z.slice(Q,F));let N=",",U=F+1;while(U<z.length&&z.charCodeAt(U)<=32)N+=z[U],U++;H.push(N),Q=U}}let W=[];for(let F of Z){let q=F.trim();if(!q){W.push(F);continue}if(q.startsWith("//"))continue;let N=C(q),U=F.slice(0,F.length-F.trimStart().length);W.push(U+n(N))}let K=W[0]||"";for(let F=1;F<W.length;F++)K+=(H[F-1]||", ")+W[F];return $?`(${K})`:K}function C(J){let Y=!1,X=0;for(let $=0;$<J.length-1;$++){let z=J.charCodeAt($);if(Y){if(z===92){$++;continue}if(z===X)Y=!1;continue}if(z===39||z===34||z===96){Y=!0,X=z;continue}if(z===47&&J.charCodeAt($+1)===47)return J.slice(0,$).trimEnd()}return J}function n(J){if(J.startsWith("..."))return J;let Y=-1,X=-1,$=0,z=!1,B=0;for(let H=0;H<J.length;H++){let Q=J.charCodeAt(H);if(z){if(Q===92){H++;continue}if(Q===B)z=!1;continue}if(Q===39||Q===34||Q===96){z=!0,B=Q;continue}if(Q===40||Q===60||Q===91||Q===123)$++;else if(Q===41||Q===62||Q===93||Q===125)$--;else if($===0){if(Q===58&&Y===-1)Y=H;else if(Q===61&&X===-1&&(H===0||J.charCodeAt(H-1)!==61)&&(H+1>=J.length||J.charCodeAt(H+1)!==61&&J.charCodeAt(H+1)!==62))X=H}}let Z=X!==-1;if(Y!==-1&&(X===-1||Y<X)){let H=J.slice(0,Y).trim(),Q=X!==-1?J.slice(Y+1,X).trim():J.slice(Y+1).trim(),L=Z&&!H.endsWith("?")?"?":"";return`${H}${L}: ${Q}`}else if(X!==-1){let H=J.slice(0,X).trim(),Q=!H.endsWith("?")?"?":"",L=J.slice(X+1).trim(),O="unknown";if(L==="true"||L==="false")O="boolean";else if(/^-?\d+(\.\d+)?$/.test(L))O="number";else if(L.startsWith("'")&&L.endsWith("'")||L.startsWith('"')&&L.endsWith('"'))O="string";else if(L.startsWith("["))O="unknown[]";else if(L.startsWith("{"))O="Record<string, unknown>";return`${H}${Q}: ${O}`}return J}function a(J){let Y=[],X="",$="",z=0,B=!1,Z="",H=!0,Q=!1,L=0;for(let O=0;O<J.length;O++){let G=J.charCodeAt(O),W=O>0?J.charCodeAt(O-1):0,K=O<J.length-1?J.charCodeAt(O+1):0;if(!B&&!Q&&G===47&&K===47){O+=2;while(O<J.length&&J.charCodeAt(O)!==10)O++;continue}if(!B&&!Q&&G===47&&K===42){Q=!0,L=1,X+="/*",O++;continue}else if(Q&&G===42&&K===47){if(L--,X+="*/",O++,L===0)Q=!1;continue}else if(Q&&G===47&&K===42){L++,X+="/*",O++;continue}let F=J[O];if(!B&&(G===34||G===39||G===96))B=!0,Z=F,X+=F;else if(B&&F===Z&&W!==92)B=!1,X+=F;else if(!B&&!Q)if(G===40&&z===0&&H){$=X.trim();let q="";if($.startsWith("async "))$=$.slice(6).trim(),q="async ";if($.startsWith("*"))$=$.slice(1).trim(),q+="*";X=q+F,H=!1,z=1}else if(G===123||G===91||G===40)z++,X+=F;else if(G===125||G===93||G===41)z--,X+=F;else if(G===58&&z===0&&H)$=X.trim(),X="",H=!1;else if(G===44&&z===0){if($&&X.trim()){let q=X.trim();Y.push([$,q])}X="",$="",H=!0}else X+=F;else X+=F}if($&&X.trim()){let O=X.trim();Y.push([$,O])}return Y}function r(J){let Y=J.trim();if(Y.startsWith("get ")&&Y.length>4){let X=Y.slice(4).trim();if(X)return{kind:"get",name:X}}if(Y.startsWith("set ")&&Y.length>4){let X=Y.slice(4).trim();if(X)return{kind:"set",name:X}}return null}function t(J,Y,X){let $=X.trim();if($.charCodeAt(0)!==40)return null;let z=j($,0,"(",")");if(z===-1)return null;let B=$.slice(1,z).trim(),Z=$.slice(z+1).trimStart();if(!Z.startsWith("=>"))return null;let H=Z.slice(2).trim();if(J==="get")return`get ${Y}(): ${H||"unknown"}`;return`set ${Y}(${B})`}function e(J){let Y=J;if(Y.startsWith("async ")||Y.startsWith("async\t"))Y=Y.slice(5).trimStart();if(Y.startsWith("*"))Y=Y.slice(1).trimStart();if(!Y.startsWith("("))return!1;let X=0;for(let $=0;$<Y.length;$++){let z=Y.charCodeAt($);if(z===40)X++;else if(z===41){if(X--,X===0){let B=Y.slice($+1).trimStart();if(B.startsWith("{"))return!0;if(B.startsWith(":")){let Z=0;for(let H=0;H<B.length;H++){let Q=B.charCodeAt(H);if(Q===40||Q===91)Z++;else if(Q===41||Q===93)Z--;else if(Q===60)Z++;else if(Q===62){if(Z>0)Z--}else if(Z===0&&Q===61&&H+1<B.length&&B.charCodeAt(H+1)===62)return!1;else if(Z===0&&Q===123)return!0}}return!1}}}return!1}function zz(J,Y){let X=Y.trimStart(),$=!1,z=!1;if(X.startsWith("async ")||X.startsWith("async\t"))$=!0,X=X.slice(5).trimStart();if(X.startsWith("*"))z=!0,X=X.slice(1).trimStart();let B="";if(X.charCodeAt(0)===60){let W=0,K=-1;for(let F=0;F<X.length;F++)if(X.charCodeAt(F)===60)W++;else if(X.charCodeAt(F)===62){if(W--,W===0){K=F;break}}if(K!==-1)B=X.slice(0,K+1),X=X.slice(K+1).trimStart()}let Z=X.indexOf("("),H=j(X,Z,"(",")");if(Z===-1||H===-1)return"() => unknown";let Q=X.slice(Z,H+1),L="unknown",O=X.slice(H+1).trimStart();if(O.charCodeAt(0)===58){let W=O.slice(1),K=0,F=-1,q=!1;for(let N=0;N<W.length;N++){let U=W.charCodeAt(N);if(U===40||U===91)K++;else if(U===41||U===93)K--;else if(U===123&&K===0){F=N;break}else if(U===61&&N+1<W.length&&W.charCodeAt(N+1)===62&&K===0){F=N,q=!0;break}}if(F!==-1)L=W.slice(0,F).trim();else L=W.trim()}if(L==="unknown"){if($&&z)L="AsyncGenerator<unknown, void, unknown>";else if(z)L="Generator<unknown, void, unknown>";else if($)L="Promise<void>"}else if($&&!L.startsWith("Promise<")&&!L.startsWith("AsyncGenerator<"))L=`Promise<${L}>`;let G=k(Q);return`${B}${G} => ${L}`}function j(J,Y,X,$){let z=0;for(let B=Y;B<J.length;B++)if(J[B]===X)z++;else if(J[B]===$){if(z--,z===0)return B}return-1}function Jz(J){let Y=0,X=0,$=!1,z="";for(let B=0;B<J.length-1;B++){let Z=J[B],H=J[B+1],Q=B>0?J[B-1]:"";if(!$&&(Z==='"'||Z==="'"||Z==="`"))$=!0,z=Z;else if($&&Z===z&&Q!=="\\")$=!1;if(!$){if(Z==="(")Y++;else if(Z===")")Y--;else if(Z==="[")X++;else if(Z==="]")X--;if(Z==="="&&H===">"&&Y===0&&X===0)return B}}return-1}function y(J,Y=!1,X=0,$=!0){let z=J.trim();if(z.length>200&&D(z,"=>")>2&&D(z,"<")>5&&!z.startsWith("function"))return Y?"((...args: any[]) => any)":"(...args: any[]) => any";if(z.startsWith("async ")&&z.includes("=>")){let Z=z.slice(5).trim(),H=Z.indexOf("=>"),Q=Z.substring(0,H).trim(),L=Z.substring(H+2).trim();if(Q=k(Q),Q==="()"||Q==="")Q="()";else if(!Q.startsWith("("))Q=`(${Q})`;let O="unknown";if(L.startsWith("{"))O="unknown";else O=V(L,$,!1,X+1);let G=`${Q} => Promise<${O}>`;return Y?`(${G})`:G}if(z.includes("=>")){let Z="",H=z;if(z.startsWith("<")){let q=j(z,0,"<",">");if(q!==-1)Z=z.substring(0,q+1),H=z.substring(q+1).trim()}let Q=Jz(H);if(Q===-1)return Y?"(() => unknown)":"() => unknown";let L=H.substring(0,Q).trim(),O=H.substring(Q+2).trim(),G="",W=L.lastIndexOf("):");if(W!==-1){let q=L.substring(W+2).trim();if(q&&!q.includes("=>")&&!q.includes("="))G=q,L=L.substring(0,W+1)}if(L=k(L),L==="()"||L==="")L="()";else if(!L.startsWith("("))L=`(${L})`;let K="unknown";if(G)K=G;else if(O.startsWith("{"))K="unknown";else if(O.includes("=>")){let q=O.trimStart(),N=q.indexOf("("),U=N!==-1?j(q,N,"(",")"):-1,R=U!==-1?q.indexOf("=>",U):-1;if(N===0&&U!==-1&&R!==-1){let b=q.substring(N+1,U).trim(),A=k(b);if(Z.includes("T")&&A.includes("T"))K=`(${A}) => T`;else K=`(${A}) => any`}else K="any"}else if(Y)K="unknown";else K=V(O,$,!1,X+1);let F=`${Z}${L} => ${K}`;return Y?`(${F})`:F}if(z.startsWith("function")){let Z=8,H=z.length;while(Z<H&&z.charCodeAt(Z)<=32)Z++;let Q=!1;if(Z<H&&z.charCodeAt(Z)===42){Q=!0,Z++;while(Z<H&&z.charCodeAt(Z)<=32)Z++}let L="";if(Z<H&&z.charCodeAt(Z)===60){let W=Z,K=1;Z++;while(Z<H&&K>0){let F=z.charCodeAt(Z);if(F===60)K++;else if(F===62)K--;Z++}L=z.substring(W,Z);while(Z<H&&z.charCodeAt(Z)<=32)Z++}let O=z.indexOf("(",Z);if(O!==-1){let W=1,K=O+1;while(K<H&&W>0){let U=z.charCodeAt(K);if(U===40)W++;else if(U===41)W--;K++}let F=z.substring(O+1,K-1).trim(),q=F?`(${F})`:"()";if(Q){let U=z.substring(K).trim(),R=U.indexOf("Generator<");if(R!==-1){let A=R+10,T=U.indexOf(">",A);if(T!==-1){let u=U.substring(A,T),v=`${L}${q} => Generator<${u}>`;return Y?`(${v})`:v}}let b=`${L}${q} => Generator<any, any, any>`;return Y?`(${b})`:b}let N=`${L}${q} => unknown`;return Y?`(${N})`:N}let G="(...args: any[]) => unknown";return Y?`(${G})`:G}if(z.includes("=>")&&z.includes("(")&&z.includes(")")){if(z.length>100||D(z,"=>")>2){let Z="";if(z.charCodeAt(0)===60){let G=j(z,0,"<",">");if(G!==-1)Z=z.substring(0,G+1)}let H=z.indexOf("("),Q=H!==-1?j(z,H,"(",")"):-1,L=H!==-1&&Q!==-1?z.substring(H,Q+1):"(...args: any[])";L=k(L);let O=`${Z}${L} => any`;return Y?`(${O})`:O}return Y?`(${z})`:z}let B="() => unknown";return Y?`(${B})`:B}function Hz(J){let Y=J.trim();if(Y==="any"||Y==="object"||Y==="unknown")return!0;if(Y.startsWith("Record<")&&Y.endsWith(">"))return!0;if(Y.startsWith("Array<")&&Y.endsWith(">"))return!0;if(/^\{\s*\[[^\]]*\]:\s*(any|string|number|unknown)\s*\}$/.test(Y))return!0;return!1}function Fz(J){let Y=J.lastIndexOf(" satisfies ");if(Y===-1)return null;let X=J.slice(Y+11).trim();if(X.endsWith(";"))X=X.slice(0,-1).trim();return X||null}var Xz=/^\/\/\/\s*<reference\s+(?:path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/,Yz=/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/,Zz=/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/;function Lz(J){let Y=[],X=0;for(let $=0;$<=J.length;$++)if($===J.length||J[$]===`
15
- `){let z=X,B=$;while(z<B&&(J[z]===" "||J[z]==="\t"||J[z]==="\r"))z++;while(B>z&&(J[B-1]===" "||J[B-1]==="\t"||J[B-1]==="\r"))B--;let Z=J.slice(z,B);if(X=$+1,Z.startsWith("///")){if(Z.indexOf("<")===-1)continue;if(Xz.test(Z)||Yz.test(Z)||Zz.test(Z))Y.push(Z)}else if(Z===""||Z.startsWith("//"))continue;else break}return Y}
16
- export{$z as Dc,Qz as Ec,V as Fc,l as Gc,I as Hc,w as Ic,s as Jc,j as Kc,y as Lc,Hz as Mc,Fz as Nc,Lz as Oc};
@@ -1,25 +0,0 @@
1
- // @bun
2
- function y(D){return D===32||D===9||D===10||D===13}function Bj(D){return D>=65&&D<=90||D>=97&&D<=122||D===95||D===36||D>127}function W(D){return Bj(D)||D>=48&&D<=57}function lj(D){if(D.charCodeAt(0)===82&&D.startsWith("Record<"))return!0;if(D.charCodeAt(0)===65&&D.startsWith("Array<"))return!0;if(D.charCodeAt(0)===123&&D.includes("[")&&D.includes("]:"))return!0;if(D==="any"||D==="object"||D==="unknown")return!0;return!1}var qj=["public","protected","private","readonly","override"];function dj(D,Hj,T=!0,l=!1){let Z=D,n=T,b=l,K=Z.length,L=[],P=new Map,x=new Set,j=0;if(j<K&&Z.charCodeAt(j)===65279)j++;function v(J,H){if(J<H){let U=Z.charCodeAt(J),X=Z.charCodeAt(H-1);if(U!==32&&U!==9&&U!==10&&U!==13&&X!==32&&X!==9&&X!==10&&X!==13)return Z.slice(J,H)}while(J<H&&y(Z.charCodeAt(J)))J++;while(H>J&&y(Z.charCodeAt(H-1)))H--;return Z.slice(J,H)}function O(){if(j>=K)return;let J=Z.charCodeAt(j);if(J!==32&&J!==9&&J!==10&&J!==13&&J!==47)return;while(j<K){let H=Z.charCodeAt(j);if(H===32||H===9||H===10||H===13){j++;continue}if(H===47&&j+1<K){let U=Z.charCodeAt(j+1);if(U===47){let X=Z.indexOf(`
3
- `,j+2);j=X===-1?K:X+1;continue}if(U===42){let X=Z.indexOf("*/",j+2);j=X===-1?K:X+2;continue}}break}}function Ij(J){let H=J.length,U=0,X=H;for(let Y=0;Y<H;Y++){let $=J.charCodeAt(Y);if(U){if($===92){Y++;continue}if($===U)U=0;continue}if($===39||$===34||$===96){U=$;continue}if($===47&&Y+1<H){let F=J.charCodeAt(Y+1);if(F===47){X=Y;while(X>0&&(J.charCodeAt(X-1)===32||J.charCodeAt(X-1)===9))X--;return J.slice(0,X)}if(F===42){let N=J.indexOf("*/",Y+2);if(N!==-1){J=`${J.slice(0,Y)} ${J.slice(N+2)}`,Y--;continue}}}}X=H;while(X>0&&(J.charCodeAt(X-1)===32||J.charCodeAt(X-1)===9||J.charCodeAt(X-1)===13))X--;return X<H?J.slice(0,X):J}function h(J){j++;let H=J===39?"'":'"';while(j<K){let U=Z.indexOf(H,j);if(U===-1){j=K;return}let X=0,Y=U-1;while(Y>=0&&Z.charCodeAt(Y)===92)X++,Y--;if(X%2===0){j=U+1;return}j=U+1}}function t(){j++;let J=[];while(j<K){let H=Z.charCodeAt(j);if(J.length===0){if(H===92){j+=2;continue}if(H===96){j++;return}if(H===36&&j+1<K&&Z.charCodeAt(j+1)===123){j+=2,J.push(0);continue}j++;continue}if(H===39||H===34){h(H);continue}if(H===96){t();continue}if(H===47&&j+1<K){let U=Z.charCodeAt(j+1);if(U===47){let X=Z.indexOf(`
4
- `,j+2);j=X===-1?K:X+1;continue}if(U===42){let X=Z.indexOf("*/",j+2);j=X===-1?K:X+2;continue}j++;continue}if(H===123){J[J.length-1]++,j++;continue}if(H===125){let U=J[J.length-1];if(U===0){J.pop(),j++;continue}J[J.length-1]=U-1,j++;continue}j++}}function E(){let J=Z.charCodeAt(j);if(J===39||J===34)return h(J),!0;if(J===96)return t(),!0;if(J===47&&j+1<K){let H=Z.charCodeAt(j+1);if(H===47){let U=Z.indexOf(`
5
- `,j+2);return j=U===-1?K:U+1,!0}if(H===42){let U=Z.indexOf("*/",j+2);return j=U===-1?K:U+2,!0}if(fj())return Ej(),!0}return!1}function fj(){let J=j-1;while(J>=0&&(Z.charCodeAt(J)===32||Z.charCodeAt(J)===9||Z.charCodeAt(J)===10||Z.charCodeAt(J)===13))J--;if(J<0)return!0;let H=Z.charCodeAt(J);if(H===61||H===40||H===91||H===33||H===38||H===124||H===63||H===58||H===44||H===59||H===123||H===125||H===94||H===126||H===43||H===45||H===42||H===37||H===60||H===62)return!0;if(W(H)){let U=J;while(U>=0&&W(Z.charCodeAt(U)))U--;let X=Z.slice(U+1,J+1);if(X==="return"||X==="typeof"||X==="void"||X==="delete"||X==="throw"||X==="new"||X==="in"||X==="of"||X==="case"||X==="instanceof"||X==="yield"||X==="await")return!0}return!1}function Ej(){j++;let J=!1;while(j<K){let H=Z.charCodeAt(j);if(H===92){j+=2;continue}if(J){if(H===93)J=!1;j++;continue}if(H===91){J=!0,j++;continue}if(H===47){j++;break}if(H===10||H===13)break;j++}while(j<K&&W(Z.charCodeAt(j)))j++}function f(){let J=j;while(j<K&&W(Z.charCodeAt(j)))j++;return Z.slice(J,j)}function z(J){if(j+J.length>K)return!1;for(let H=0;H<J.length;H++)if(Z.charCodeAt(j+H)!==J.charCodeAt(H))return!1;if(j+J.length<K&&W(Z.charCodeAt(j+J.length)))return!1;return!0}function Jj(J){let H=j+J;while(H<K){let U=Z.charCodeAt(H);if(U===32||U===9||U===10||U===13){H++;continue}return U!==46&&U!==61}return!1}function yj(){if(j>=K)return!1;switch(Z.charCodeAt(j)){case 101:return z("export")||z("enum");case 105:return z("import")||z("interface");case 102:return z("function");case 99:return z("class")||z("const");case 116:return z("type");case 108:return z("let");case 118:return z("var");case 100:return z("declare")||z("default");case 109:return z("module");case 110:return z("namespace");case 97:return z("abstract")||z("async");default:return!1}}function p(){let J=Z.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<K&&Z.charCodeAt(j)===10)j++;while(j<K){let X=Z.charCodeAt(j);if(X===32||X===9||X===13||X===10){j++;continue}if(X===47&&j+1<K){let Y=Z.charCodeAt(j+1);if(Y===47){let $=Z.indexOf(`
6
- `,j+2);j=$===-1?K:$+1;continue}if(Y===42){let $=Z.indexOf("*/",j+2);j=$===-1?K:$+2;continue}}break}let U=j>=K||yj()||Z.charCodeAt(j)===125;return j=H,U}function e(){let J=Z.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<K&&Z.charCodeAt(j)===10)j++;while(j<K){let X=Z.charCodeAt(j);if(X===32||X===9||X===13||X===10){j++;continue}if(X===47&&j+1<K&&Z.charCodeAt(j+1)===47){let Y=Z.indexOf(`
7
- `,j+2);j=Y===-1?K:Y+1;continue}break}if(j>=K)return j=H,!0;let U=Z.charCodeAt(j);if(U===124||U===38||U===46||U===63||U===58)return j=H,!1;if(z("extends")||z("keyof")||z("typeof")||z("infer")||z("is")||z("as")||z("in"))return j=H,!1;return j=H,!0}let Aj=/[{}'"`\/]/g,Tj=/[()'"`\/]/g,kj=/[[\]'"`\/]/g,Cj=/[<>'"`\/]/g;function A(J,H){let U=1;j++;let X=J===123?Aj:J===40?Tj:J===91?kj:Cj;X.lastIndex=j;let Y;while((Y=X.exec(Z))!==null){let $=Y.index,F=Z.charCodeAt($);if(F===39||F===34){j=$,h(F),X.lastIndex=j;continue}if(F===96){j=$,t(),X.lastIndex=j;continue}if(F===47){if(j=$,E()){X.lastIndex=j;continue}X.lastIndex=$+1;continue}if(F===J)U++;else if(F===H){if(H===62&&$>0&&Z.charCodeAt($-1)===61){X.lastIndex=$+1;continue}if(U--,U===0)return j=$+1,j}X.lastIndex=$+1}return j=K,j}function S(){return j>0&&Z.charCodeAt(j-1)===61}function Xj(){return j+1<K&&Z.charCodeAt(j+1)===62}let k=/[{};'"`\/\n\r()[\]]/g;function I(){let J=0,H=0,U=0;k.lastIndex=j;let X;while((X=k.exec(Z))!==null){let Y=X.index,$=Z.charCodeAt(Y);if($===39||$===34){j=Y,h($),k.lastIndex=j;continue}if($===96){j=Y,t(),k.lastIndex=j;continue}if($===47){if(j=Y,E()){k.lastIndex=j;continue}k.lastIndex=Y+1;continue}if($===40){H++,k.lastIndex=Y+1;continue}if($===41){H--,k.lastIndex=Y+1;continue}if($===91){U++,k.lastIndex=Y+1;continue}if($===93){U--,k.lastIndex=Y+1;continue}if($===123){J++,k.lastIndex=Y+1;continue}if($===125){if(J--,J<=0&&H<=0&&U<=0){j=Y+1;return}k.lastIndex=Y+1;continue}if($===59&&J===0&&H===0&&U===0){j=Y+1;return}if(($===10||$===13)&&J===0&&H===0&&U===0){if(j=Y,p())return}k.lastIndex=Y+1}j=K}function Nj(){A(123,125);while(j<K&&y(Z.charCodeAt(j)))j++;if(z("from")){j+=4;while(j<K&&y(Z.charCodeAt(j)))j++;if(j<K){let J=Z.charCodeAt(j);if(J===39||J===34)h(J)}}while(j<K&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<K&&Z.charCodeAt(j)===59)j++}function Rj(){j++;while(j<K&&y(Z.charCodeAt(j)))j++;if(z("as")){j+=2;while(j<K&&y(Z.charCodeAt(j)))j++;f();while(j<K&&y(Z.charCodeAt(j)))j++}if(z("from")){j+=4;while(j<K&&y(Z.charCodeAt(j)))j++;if(j<K){let J=Z.charCodeAt(j);if(J===39||J===34)h(J)}}while(j<K&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<K&&Z.charCodeAt(j)===59)j++}function Uj(J){let H=J.indexOf("from ");if(H===-1)return;let U=H+5;while(U<J.length&&(J.charCodeAt(U)===32||J.charCodeAt(U)===9))U++;if(U>=J.length)return;let X=J.charCodeAt(U);if(X!==39&&X!==34)return;let Y=J.indexOf(J[U],U+1);if(Y===-1)return;return J.slice(U+1,Y)}function C(J){if(!n)return;let H=J-1;while(H>=0&&y(Z.charCodeAt(H)))H--;if(H<0)return;let U=[],X=!1;while(H>=0){if(H>=1&&Z.charCodeAt(H)===47&&Z.charCodeAt(H-1)===42){let F=Z.lastIndexOf("/*",H-2);if(F>=0){U.push(Z.slice(F,H+1)),X=!0,H=F-1;while(H>=0&&y(Z.charCodeAt(H)))H--;continue}break}let Y=H;while(Y>0&&Z.charCodeAt(Y-1)!==10)Y--;let $=v(Y,H+1);if($.startsWith("//")){if(X)break;let F=[$];H=Y-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--;while(H>=0){let N=H;while(N>0&&Z.charCodeAt(N-1)!==10)N--;let V=v(N,H+1);if(V.startsWith("//")){F.push(V),H=N-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--}else if(V===""){H=N-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--}else break}F.reverse(),U.push(F.join(`
8
- `));continue}break}if(U.length===0)return;return U.reverse(),U}function Sj(J){let H=J,U=!1;while(j<K){let V=Z.charCodeAt(j);if(V===59){j++;break}if(V===39||V===34){h(V),U=!0;while(j<K&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<K&&Z.charCodeAt(j)===59)j++;break}if(V===10&&U)break;j++}let X=v(H,j),Y=X.charCodeAt(7)===116&&(X.startsWith("import type ")||X.startsWith("import type{")),$=!1;{let V=6;while(V<X.length&&(X.charCodeAt(V)===32||X.charCodeAt(V)===9))V++;if(V<X.length&&X.charCodeAt(V)===116&&X.startsWith("type",V)){V+=4;while(V<X.length&&(X.charCodeAt(V)===32||X.charCodeAt(V)===9))V++}if(V<X.length){let Q=X.charCodeAt(V);$=Q===39||Q===34}}let F="";{let V=X.indexOf("from ");if(V!==-1){let Q=V+5;while(Q<X.length&&(X.charCodeAt(Q)===32||X.charCodeAt(Q)===9))Q++;if(Q<X.length){let G=X.charCodeAt(Q);if(G===39||G===34){let B=X.indexOf(String.fromCharCode(G),Q+1);if(B!==-1)F=X.slice(Q+1,B)}}}else if($){let Q=6;while(Q<X.length&&X.charCodeAt(Q)!==39&&X.charCodeAt(Q)!==34)Q++;if(Q<X.length){let G=X.charCodeAt(Q),B=X.indexOf(String.fromCharCode(G),Q+1);if(B!==-1)F=X.slice(Q+1,B)}}}let N=C(H);return{kind:"import",name:"",text:X,isExported:!1,isTypeOnly:Y,isSideEffect:$,source:F,leadingComments:N,start:H,end:j}}function Yj(){let J=j;return A(123,125),Z.slice(J,j)}function _j(J){let H=J.indexOf("(");if(H===-1)return J;let U=J.slice(H);if(U.indexOf("=")===-1)return J;let X=!1;for(let V=0;V<U.length;V++)if(U.charCodeAt(V)===61){let G=V>0?U.charCodeAt(V-1):0,B=V+1<U.length?U.charCodeAt(V+1):0;if(G!==61&&G!==33&&G!==60&&G!==62&&B!==61&&B!==62){X=!0;break}}if(!X)return J;let Y=0,$=-1;for(let V=H;V<J.length;V++){let Q=J.charCodeAt(V);if(Q===40)Y++;else if(Q===41){if(Y--,Y===0){$=V;break}}}if($===-1)return J;let F=J.slice(H,$+1),N=c(F);return J.slice(0,H)+N+J.slice($+1)}function gj(J){let H=J.indexOf("//")!==-1||J.indexOf("/*")!==-1,U=J.split(`
9
- `),X=[],Y=[],$=[],F=!1,N=1/0;for(let G=0;G<U.length;G++){let B=U[G];if(H){if(F){if(B.includes("*/"))F=!1;continue}let _=B.trim();if(_.length===0)continue;let g=_.charCodeAt(0);if(g===47){let w=_.charCodeAt(1);if(w===47)continue;if(w===42){if(!_.includes("*/"))F=!0;continue}}if(g===42)continue;let q=Ij(B);if(q.charCodeAt(q.length-1)===59)q=q.slice(0,-1);q=_j(q);let R=q.trim();if(!R)continue;X.push(q),Y.push(R);let M=0;while(M<q.length&&y(q.charCodeAt(M)))M++;if(R!=="{"&&R!=="}"){if(M<N)N=M}$.push(M)}else{let _=B.length;while(_>0&&(B.charCodeAt(_-1)===32||B.charCodeAt(_-1)===9||B.charCodeAt(_-1)===13))_--;if(_===0)continue;let g=_<B.length?B.slice(0,_):B;if(g.charCodeAt(g.length-1)===59)g=g.slice(0,-1);g=_j(g);let q=g.trim();if(!q)continue;X.push(g),Y.push(q);let R=0;while(R<g.length&&y(g.charCodeAt(R)))R++;if(q!=="{"&&q!=="}"){if(R<N)N=R}$.push(R)}}if(X.length===0)return"{}";if(N===1/0||N<=2)return X.join(`
10
- `);let V=N-2,Q=Array(X.length);for(let G=0;G<X.length;G++){let B=Y[G];if(B==="{"){Q[G]=B;continue}let _=$[G];if(_>N)Q[G]=X[G];else if(_===N&&(B.charCodeAt(0)===125||B.charCodeAt(0)===93||B.charCodeAt(0)===41))Q[G]=X[G];else{let g=Math.max(0,_-V);Q[G]=" ".repeat(g)+B}}return Q.join(`
11
- `)}function u(){if(j>=K||Z.charCodeAt(j)!==60)return"";let J=j;A(60,62);let H=Z.slice(J,j);if(H.includes(`
12
- `)){let U="",X=!1;for(let Y=0;Y<H.length;Y++){let $=H.charCodeAt(Y);if($===32||$===9||$===10||$===13){if(!X&&U.length>0)U+=" ",X=!0}else U+=H[Y],X=!1}if(U.charCodeAt(1)===32)U=`<${U.slice(2)}`;if(U.charCodeAt(U.length-2)===32)U=`${U.slice(0,-2)}>`;return U}return H}function m(){if(j>=K||Z.charCodeAt(j)!==40)return"()";let J=j;return A(40,41),Z.slice(J,j)}function c(J){let H=J.slice(1,-1).trim();if(!H)return"()";if(J.indexOf(`
13
- `)===-1&&H.indexOf(":")!==-1&&H.indexOf("{")===-1&&H.indexOf("[")===-1&&H.indexOf("=")===-1&&H.indexOf("@")===-1&&H.indexOf("...")===-1){let V=0,Q=0,G=0;for(let B=0;B<H.length;B++){let _=H.charCodeAt(B);if(_===40||_===60||_===123)G++;else if(_===41||_===62||_===125)G--;else if(G===0){if(_===58)V++;else if(_===44)Q++}}if(V>=Q+1){let B=!1;for(let _=0;_<qj.length;_++){let g=qj[_],q=H.indexOf(g);if(q!==-1){let R=q+g.length;if((q===0||!W(H.charCodeAt(q-1)))&&(R>=H.length||!W(H.charCodeAt(R)))){B=!0;break}}}if(!B)return J}}let U=[],X=0,Y=0,$=!1,F=0;for(let V=0;V<=H.length;V++){if(V===H.length){U.push(H.slice(X).trim());break}let Q=H.charCodeAt(V);if($){if(Q===92){V++;continue}if(Q===F)$=!1;continue}if(Q===39||Q===34||Q===96){$=!0,F=Q;continue}if(Q===40||Q===123||Q===91||Q===60)Y++;else if(Q===41||Q===125||Q===93||Q===62&&!(V>0&&H.charCodeAt(V-1)===61))Y--;else if(Q===44&&Y===0)U.push(H.slice(X,V).trim()),X=V+1}let N=[];for(let V of U){if(!V)continue;let Q=V.trim();if(Q.startsWith("//")||Q.startsWith("/*"))continue;let G=V;{let B=!1,_=0,g=0,q=0;for(let R=0;R<G.length-1;R++){let M=G.charCodeAt(R);if(M===10){q=R+1;continue}if(B){if(M===92){R++;continue}if(M===_)B=!1;continue}if(M===39||M===34||M===96){B=!0,_=M;continue}if(M===123||M===91||M===40||M===60){g++;continue}if(M===125||M===93||M===41||M===62){if(g>0)g--;continue}if(M===47&&G.charCodeAt(R+1)===47){if(g===0){G=G.slice(0,R).trimEnd();break}let w=G.indexOf(`
14
- `,R);if(w===-1){G=G.slice(0,q).trimEnd();break}let s=G.slice(0,q),hj=G.slice(w+1);G=`${s}${hj}`,R=q-1}}}if(!G.trim())continue;N.push(Lj(G))}return`(${N.join(", ")})`}function Wj(J){if(!J.startsWith("{")&&!J.startsWith("["))return J;let H="",U=0,X=0,Y=!1,$=0;while(U<J.length){let F=J.charCodeAt(U);if(Y){if(F===92&&U+1<J.length){H+=J[U]+J[U+1],U+=2;continue}if(F===$)Y=!1;H+=J[U],U++;continue}if(F===39||F===34||F===96){Y=!0,$=F,H+=J[U],U++;continue}if(F===123||F===91||F===40)X++;else if(F===125||F===93||F===41)X--;if(X>=1&&F===61&&(U+1>=J.length||J.charCodeAt(U+1)!==61&&J.charCodeAt(U+1)!==62)){while(H.length>0&&(H[H.length-1]===" "||H[H.length-1]==="\t"||H[H.length-1]===`
15
- `))H=H.slice(0,-1);U++;let N=0;while(U<J.length){let V=J.charCodeAt(U);if(V===39||V===34||V===96){let Q=V;U++;while(U<J.length){if(J.charCodeAt(U)===92){U+=2;continue}if(J.charCodeAt(U)===Q){U++;break}U++}continue}if(V===123||V===91||V===40)N++;else if(V===125||V===93||V===41){if(N===0)break;N--}else if(V===44&&N===0)break;U++}continue}if(X===1&&F===46&&U+2<J.length&&J.charCodeAt(U+1)===46&&J.charCodeAt(U+2)===46){U+=3;continue}H+=J[U],U++}return H}function Lj(J){let H=J.trim(),U=H.startsWith("...");if(U)H=H.slice(3).trim();while(H.startsWith("@")){let q=1;while(q<H.length&&W(H.charCodeAt(q)))q++;if(q<H.length&&H.charCodeAt(q)===40){let R=1;q++;while(q<H.length&&R>0){if(H.charCodeAt(q)===40)R++;else if(H.charCodeAt(q)===41)R--;q++}}H=H.slice(q).trim()}let X=!0;while(X){X=!1;for(let q of qj)if(H.startsWith(q)&&H.length>q.length&&!W(H.charCodeAt(q.length))){let R=H.slice(q.length).trim();if(R.charCodeAt(0)===58||R.charCodeAt(0)===63&&R.length>1&&R.charCodeAt(1)===58)break;H=R,X=!0;break}}let Y=-1,$=-1,F=0,N=!1,V=0;for(let q=0;q<H.length;q++){let R=H.charCodeAt(q);if(N){if(R===92){q++;continue}if(R===V)N=!1;continue}if(R===39||R===34||R===96){N=!0,V=R;continue}if(R===40||R===123||R===91||R===60)F++;else if(R===41||R===125||R===93||R===62&&!(q>0&&H.charCodeAt(q-1)===61))F--;else if(F===0){if(R===58&&Y===-1)Y=q;else if(R===61&&$===-1&&(q===0||H.charCodeAt(q-1)!==61)&&(q+1>=H.length||H.charCodeAt(q+1)!==61&&H.charCodeAt(q+1)!==62))$=q}}let Q,G,B=$!==-1;if(Y!==-1&&($===-1||Y<$))if(Q=H.slice(0,Y).trim(),$!==-1)G=H.slice(Y+1,$).trim();else G=H.slice(Y+1).trim();else if($!==-1)Q=H.slice(0,$).trim(),G=Zj(H.slice($+1).trim());else Q=H,G="unknown";if(Q=Wj(Q),(Q.startsWith("{")||Q.startsWith("["))&&Q.includes(`
16
- `)){let q=Q.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(q.length<=40)Q=q;else Q=Q.split(`
17
- `).map((M)=>{let w=M.trim();if(!w)return"";if(w==="{"||w==="}"||w==="["||w==="]"||w.startsWith("}")||w.startsWith("]"))return w;return` ${w}`}).join(`
18
- `)}let _=Q.endsWith("?")||B;if(Q.endsWith("?"))Q=Q.slice(0,-1).trim();let g=_&&!U?"?":"";if(U)return`...${Q}: ${G}`;return`${Q}${g}: ${G}`}function Mj(J){let H=0;if(H<J.length&&J.charCodeAt(H)===45)H++;if(H>=J.length)return!1;let U=J.charCodeAt(H);if(U<48||U>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++;if(H<J.length&&J.charCodeAt(H)===46){if(H++,H>=J.length||J.charCodeAt(H)<48||J.charCodeAt(H)>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++}return H===J.length}function Zj(J){let H=J.trim();if(H==="true"||H==="false")return"boolean";if(Mj(H))return"number";if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return"string";if(H.startsWith("["))return"unknown[]";if(H.startsWith("{"))return"Record<string, unknown>";return"unknown"}function $j(J){let H=J.trim();if(H==="true"||H==="false")return H;if(Mj(H))return H;if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return H;return"unknown"}function Qj(J){if(J.endsWith("as const"))return null;let H=0,U=-1;for(let Y=0;Y<J.length;Y++){let $=J.charCodeAt(Y);if($===123||$===91||$===40)H++;else if($===125||$===93||$===41)H--;else if(H===0&&$===32&&Y+4<=J.length&&J.substring(Y,Y+4)===" as ")U=Y}if(U===-1)return null;return J.slice(U+4).trim()||null}function jj(){if(O(),j<K&&Z.charCodeAt(j)===58){j++,O();let J=j,H=0;while(j<K){if(E())continue;let U=Z.charCodeAt(j);if(U===40||U===91||U===60)H++;else if(U===41||U===93||U===62&&!S())H--;else if(U===123)if(H>0)H++;else{let X=v(J,j),Y=($)=>{let F=X.length-$.length;return F>=0&&X.endsWith($)&&(F===0||!W(X.charCodeAt(F-1)))};if(X.length===0||X.endsWith("|")||X.endsWith("&")||Y("is")||Y("extends"))H++;else break}else if(U===125){if(H===0)break;H--}else if(H===0&&U===59)break;if(H===0&&e())break;j++}return v(J,j)}return""}function d(J,H,U,X){j+=8,O();let Y=j<K&&Z.charCodeAt(j)===42;if(Y)j++,O();let $=f();if(!$&&!X)return null;O();let F=u();O();let N=m();O();let V=jj();if(!V)if(U&&Y)V="AsyncGenerator<unknown, void, unknown>";else if(Y)V="Generator<unknown, void, unknown>";else if(U)V="Promise<void>";else V="void";O();let Q=!1;if(j<K&&Z.charCodeAt(j)===123)Q=!0,A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let G=c(N),B=`${H?"export ":""}declare function ${$||"default"}${F}${G}: ${V};`,_=C(J);if(Q)x.add(L.length);return{kind:"function",name:$||"default",text:B,isExported:H,isDefault:X,isAsync:U,isGenerator:Y,returnType:V,generics:F||void 0,leadingComments:_,start:J,end:j}}function r(J,H,U){j+=H.length,O();let X=[];do{if(O(),j>=K)break;let Y=Z.charCodeAt(j);if(Y===123||Y===91)return I(),X;let $=f();if(!$)return I(),X;O();let F,N,V=!1;if(j<K&&Z.charCodeAt(j)===58){j++,O();let B=j,_=0;while(j<K){if(E())continue;let g=Z.charCodeAt(j);if(g===40||g===123||g===91||g===60)_++;else if(g===41||g===125||g===93||g===62&&!S())_--;else if(_===0&&(g===59||g===44))break;else if(_===0&&g===61&&!Xj())break;if(_===0&&p())break;j++}F=v(B,j)}if(j<K&&Z.charCodeAt(j)===61)if(b&&F&&!lj(F))I();else{j++,O();let B=j,_=0,g=0;while(j<K){if(E())continue;let q=Z.charCodeAt(j);if(q===40||q===123||q===91)_++;else if(q===41||q===125||q===93)_--;else if(q===60&&_===0){if(j+1>=K||Z.charCodeAt(j+1)!==61)g++}else if(q===62&&_===0&&!S()){if(g>0&&(j+1>=K||Z.charCodeAt(j+1)!==61))g--}else if(_===0&&g===0&&(q===59||q===44))break;if(_===0&&g===0&&p())break;j++}if(N=v(B,j),N.endsWith(" as const")||N==="const"){if(V=!0,!F){let q=N.endsWith(" as const")?N.slice(0,-9).trim():N,R=$j(q);F=R!=="unknown"?R:void 0}}else if(!F){let q=Qj(N);if(q)F=q}}if(j<K){let B=Z.charCodeAt(j);if(B===44){j++;continue}if(B===59)j++}let Q=C(J),G=`${U?"export ":""}declare ${H} ${$}: ${F||"unknown"};`;X.push({kind:"variable",name:$,text:G,isExported:U,typeAnnotation:F,value:N,modifiers:V?[H,"const assertion"]:[H],leadingComments:Q,start:J,end:j});break}while(j<K);return X}function Kj(J,H){j+=9,O();let U=f();O();let X=u();O();let Y="";if(z("extends")){j+=7,O();let Q=j,G=0;while(j<K){if(E())continue;let B=Z.charCodeAt(j);if(B===60)G++;else if(B===62&&!S())G--;else if(B===123&&G===0)break;j++}Y=v(Q,j)}O();let $=j<K&&Z.charCodeAt(j)===123?Yj():"{}",F=gj($),N=`${H?"export ":""}declare interface ${U}${X}${Y?` extends ${Y}`:""} ${F}`,V=C(J);return{kind:"interface",name:U,text:N,isExported:H,extends:Y||void 0,generics:X||void 0,leadingComments:V,start:J,end:j}}function Vj(J,H){j+=4,O();let U=f();O();let X=u();if(O(),j<K&&Z.charCodeAt(j)===61)j++;O();let Y=j,$=0;while(j<K){if(E())continue;let Q=Z.charCodeAt(j);if(Q===40||Q===123||Q===91||Q===60)$++;else if(Q===41||Q===125||Q===93||Q===62&&!S())$--;else if($===0&&Q===59)break;if($===0&&p())break;j++}let F=v(Y,j);if(j<K&&Z.charCodeAt(j)===59)j++;let N=`${H?"export ":""}type ${U}${X} = ${F}`,V=C(J);return{kind:"type",name:U,text:N,isExported:H,generics:X||void 0,leadingComments:V,start:J,end:j}}function i(J,H,U){j+=4,O();let X=f();O();let Y=j;if(j<K&&Z.charCodeAt(j)===123)A(123,125);let $=v(J,j),F=C(J);return{kind:"enum",name:X,text:$,isExported:H,modifiers:U?["const"]:void 0,leadingComments:F,start:J,end:j}}function a(J,H,U){j+=5,O();let X=f()||"AnonymousClass";O();let Y=u();O();let $="";if(z("extends")){j+=7,O();let G=j,B=0;while(j<K){if(E())continue;let _=Z.charCodeAt(j);if(_===60)B++;else if(_===62&&!S())B--;else if(B===0&&(_===123||z("implements")))break;j++}$=v(G,j)}let F;if(z("implements")){j+=10,O();let G=j,B=0;while(j<K){if(E())continue;let g=Z.charCodeAt(j);if(g===60)B++;else if(g===62&&!S())B--;else if(B===0&&g===123)break;j++}let _=v(G,j);if(_)F=_.split(",").map((g)=>g.trim())}O();let N=zj(),V=`${H?"export ":""}declare ${U?"abstract ":""}class ${X}${Y}${$?` extends ${$}`:""}${F&&F.length>0?` implements ${F.join(", ")}`:""} ${N}`,Q=C(J);return{kind:"class",name:X,text:V,isExported:H,extends:$||void 0,implements:F,generics:Y||void 0,modifiers:U?["abstract"]:void 0,leadingComments:Q,start:J,end:j}}function zj(){if(j>=K||Z.charCodeAt(j)!==123)return"{}";j++;let J=[];while(j<K){if(O(),j>=K)break;if(Z.charCodeAt(j)===125){j++;break}if(Z.charCodeAt(j)===59){j++;continue}if(z("static")&&Dj("static")===123){j+=6,O(),A(123,125);continue}let H=!1,U=!1,X=!1,Y=!1,$=!1,F=!1,N=!1,V=!1,Q=!0;while(Q){if(O(),z("private")){H=!0,j+=7;continue}if(z("protected")){U=!0,j+=9;continue}if(z("public")){j+=6;continue}if(z("static")){X=!0,j+=6;continue}if(z("abstract")){Y=!0,j+=8;continue}if(z("readonly")){$=!0,j+=8;continue}if(z("override")){F=!0,j+=8;continue}if(z("accessor")){N=!0,j+=8;continue}if(z("async")){V=!0,j+=5;continue}if(z("declare")){j+=7;continue}break}if(O(),j>=K||Z.charCodeAt(j)===125)break;if(Z.charCodeAt(j)===35)H=!0;if(H){Fj();continue}let G=" ";if(U)G+="protected ";if(X)G+="static ";if(Y)G+="abstract ";if($)G+="readonly ";if(z("constructor")){j+=11,O();let B=m();if(O(),uj(B,J),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let _=c(B);J.push(` constructor${_};`)}else if(z("get"))if(j+=3,O(),j<K&&(Bj(Z.charCodeAt(j))||Z.charCodeAt(j)===91||Z.charCodeAt(j)===35)){let B=Oj();if(B.startsWith("#")){if(O(),j<K&&Z.charCodeAt(j)===40)m();if(O(),jj(),O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;continue}O(),m(),O();let _=jj()||"unknown";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;J.push(`${G}get ${B}(): ${_};`)}else Pj("get",G,X,$,V,J);else if(z("set"))if(j+=3,O(),j<K&&(Bj(Z.charCodeAt(j))||Z.charCodeAt(j)===91||Z.charCodeAt(j)===35)){let B=Oj();if(B.startsWith("#")){if(O(),j<K&&Z.charCodeAt(j)===40)m();if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;continue}O();let _=m();if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let g=c(_);J.push(`${G}set ${B}${g};`)}else Pj("set",G,X,$,V,J);else{let B=Z.charCodeAt(j)===42;if(B)j++,O();let _=Oj();if(!_){Fj();continue}bj(_,G,X,$,B,Y,V,J)}}return`{
19
- ${J.join(`
20
- `)}
21
- }`}function Oj(){if(j>=K)return"";let J=Z.charCodeAt(j);if(J===91){let H=j;return A(91,93),Z.slice(H,j)}if(J===35)return j++,`#${f()}`;return f()}function Dj(J){let H=j+J.length;while(H<K&&y(Z.charCodeAt(H)))H++;return H<K?Z.charCodeAt(H):0}function Fj(){let J=0;while(j<K){if(E())continue;let H=Z.charCodeAt(j);if(H===123||H===40)J++;else if(H===125||H===41){if(J===0)return;J--}else if(H===59&&J===0){j++;return}if(J===0&&e())return;j++}}function Pj(J,H,U,X,Y,$){bj(J,H,U,X,!1,!1,Y,$)}function bj(J,H,U,X,Y,$,F,N){if(O(),j>=K)return;let V=Z.charCodeAt(j),Q=!1;if(V===63)Q=!0,j++,O();if(j<K&&Z.charCodeAt(j)===33)j++,O();let G=j<K?Z.charCodeAt(j):0;if(G===40||G===60){let B=G===60?u():"";O();let _=m();O();let g=jj();if(!g)if(F&&Y)g="AsyncGenerator<unknown, void, unknown>";else if(Y)g="Generator<unknown, void, unknown>";else if(F)g="Promise<void>";else g="void";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let q=c(_),R=Q?"?":"",M=Y?"*":"";N.push(`${H}${M}${J}${R}${B}${q}: ${g};`)}else if(G===58||G===61||G===59||G===125||G===10||G===13){let B="";if(G===58){j++,O();let q=j,R=0;while(j<K){if(E())continue;let M=Z.charCodeAt(j);if(M===40||M===123||M===91||M===60)R++;else if(M===41||M===125||M===93||M===62&&!S()){if(R===0)break;R--}else if(R===0&&(M===59||M===44))break;else if(R===0&&M===61&&!Xj())break;if(R===0&&e())break;j++}B=v(q,j)}let _="";if(j<K&&Z.charCodeAt(j)===61)if(b&&B){j++;let q=0;while(j<K){if(E())continue;let R=Z.charCodeAt(j);if(R===40||R===123||R===91)q++;else if(R===41||R===125||R===93){if(q===0&&R===125)break;q--}else if(q===0&&R===59)break;if(q===0&&e())break;j++}}else{j++,O();let q=j,R=0;while(j<K){if(E())continue;let M=Z.charCodeAt(j);if(M===40||M===123||M===91)R++;else if(M===41||M===125||M===93){if(R===0&&M===125)break;R--}else if(R===0&&M===59)break;if(R===0&&e())break;j++}_=v(q,j)}if(j<K&&Z.charCodeAt(j)===59)j++;if(!B)if(_){let q=Qj(_);if(q)B=q;else B=U&&X?$j(_):Zj(_)}else B="unknown";let g=Q?"?":"";N.push(`${H}${J}${g}: ${B};`)}else Fj()}function uj(J,H){let U=J.slice(1,-1).trim();if(!U)return;let X=[],Y=0,$=0,F=!1,N=0;for(let V=0;V<=U.length;V++){if(V===U.length){X.push(U.slice(Y).trim());break}let Q=U.charCodeAt(V);if(F){if(Q===92){V++;continue}if(Q===N)F=!1;continue}if(Q===39||Q===34||Q===96){F=!0,N=Q;continue}if(Q===40||Q===123||Q===91||Q===60)$++;else if(Q===41||Q===125||Q===93||Q===62&&!(V>0&&U.charCodeAt(V-1)===61))$--;else if(Q===44&&$===0)X.push(U.slice(Y,V).trim()),Y=V+1}for(let V of X){let Q=V.startsWith("public ")||V.startsWith("public\t"),G=V.startsWith("protected ")||V.startsWith("protected\t"),B=V.startsWith("private ")||V.startsWith("private\t"),_=V.includes("readonly ");if(!Q&&!G&&!B&&!_)continue;if(B)continue;let g=V,q=[];if(Q){let w=6;while(w<g.length&&y(g.charCodeAt(w)))w++;g=g.slice(w),q.push("public")}if(G){let w=9;while(w<g.length&&y(g.charCodeAt(w)))w++;g=g.slice(w),q.push("protected")}if(_){let w=g.indexOf("readonly ");if(w!==-1){let s=w+8;while(s<g.length&&y(g.charCodeAt(s)))s++;g=g.slice(0,w)+g.slice(s)}q.push("readonly")}let R=q.length>0?`${q.join(" ")} `:"",M=Lj(g);H.push(` ${R}${M};`)}}function Gj(J=" "){if(j>=K||Z.charCodeAt(j)!==123)return"{}";j++;let H=[];while(j<K){if(O(),j>=K)break;if(Z.charCodeAt(j)===125){j++;break}if(Z.charCodeAt(j)===59){j++;continue}let U=!1;if(z("export"))U=!0,j+=6,O();if(z("declare"))j+=7,O();let X=U?"export ":"";if(z("function")||z("async")&&xj("async","function")){let Y=!1;if(z("async"))Y=!0,j+=5,O();if(j+=8,O(),j<K&&Z.charCodeAt(j)===42)j++,O();let F=f();O();let N=u();O();let V=m();O();let Q=jj();if(!Q)Q=Y?"Promise<void>":"void";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let G=c(V);H.push(`${J}${X}function ${F}${N}${G}: ${Q};`)}else if(z("const")||z("let")||z("var")){let Y=z("const")?"const":z("let")?"let":"var";j+=Y.length,O();let $=f();if(!$){I();continue}O();let F="";if(j<K&&Z.charCodeAt(j)===58){j++,O();let V=j,Q=0;while(j<K){if(E())continue;let G=Z.charCodeAt(j);if(G===40||G===123||G===91||G===60)Q++;else if(G===41||G===125||G===93||G===62&&!S())Q--;else if(Q===0&&(G===59||G===44))break;else if(Q===0&&G===61&&!Xj())break;if(Q===0&&p())break;j++}F=v(V,j)}let N="";if(j<K&&Z.charCodeAt(j)===61){j++,O();let V=j,Q=0;while(j<K){if(E())continue;let G=Z.charCodeAt(j);if(G===40||G===123||G===91||G===60)Q++;else if(G===41||G===125||G===93||G===62&&!S())Q--;else if(Q===0&&(G===59||G===44))break;if(Q===0&&p())break;j++}N=v(V,j)}if(j<K&&Z.charCodeAt(j)===59)j++;if(!F&&N){let V=Qj(N);if(V)F=V;else if(Y==="const")F=$j(N);else F=Zj(N)}if(!F)F="unknown";H.push(`${J}${X}${Y} ${$}: ${F};`)}else if(z("interface")){j+=9,O();let Y=f();O();let $=u();O();let F="";if(z("extends")){let V=j;while(j<K&&Z.charCodeAt(j)!==123){if(E())continue;j++}F=Z.slice(V,j)}let N=gj(Yj());H.push(`${J}${X}interface ${Y}${$}${F} ${N}`)}else if(z("type")){j+=4,O();let Y=f();O();let $=u();if(O(),j<K&&Z.charCodeAt(j)===61){j++,O();let F=j,N=0;while(j<K){if(E())continue;let Q=Z.charCodeAt(j);if(Q===40||Q===123||Q===91||Q===60)N++;else if(Q===41||Q===125||Q===93||Q===62&&!S())N--;else if(N===0&&Q===59)break;if(N===0&&p())break;j++}let V=v(F,j);if(j<K&&Z.charCodeAt(j)===59)j++;H.push(`${J}${X}type ${Y}${$} = ${V}`)}}else if(z("class")){j+=5,O();let Y=f();O();let $=u();O();let F=j;while(j<K&&Z.charCodeAt(j)!==123){if(E())continue;j++}let N=v(F,j),V=N?` ${N}`:"",Q=zj();H.push(`${J}${X}class ${Y}${$}${V} ${Q}`)}else if(z("enum")){j+=4,O();let Y=f();O();let $=Yj();H.push(`${J}${X}enum ${Y} ${$}`)}else if(z("namespace")||z("module")){let Y=z("namespace")?"namespace":"module";j+=Y.length,O();let $=f();O();let F=Gj(J);H.push(`${J}${X}${Y} ${$} ${F}`)}else if(z("abstract"))if(j+=8,O(),z("class")){j+=5,O();let Y=f();O();let $=u();O();let F=j;while(j<K&&Z.charCodeAt(j)!==123){if(E())continue;j++}let N=v(F,j),V=N?` ${N}`:"",Q=zj();H.push(`${J}${X}abstract class ${Y}${$}${V} ${Q}`)}else I();else if(U&&z("default")){j+=7,O();let Y=j;I();let $=v(Y,j);if($.charCodeAt($.length-1)===59)$=$.slice(0,-1);if($)H.push(`${J}export default ${$};`)}else if(!U&&(Z.charCodeAt(j)===39||Z.charCodeAt(j)===34||Z.charCodeAt(j)===96))I();else I()}if(H.length===0)return"{}";return`{
22
- ${H.join(`
23
- `)}
24
- }`}function xj(J,H){let U=j+J.length;while(U<K&&y(Z.charCodeAt(U)))U++;for(let X=0;X<H.length;X++)if(U+X>=K||Z.charCodeAt(U+X)!==H.charCodeAt(X))return!1;return U+H.length>=K||!W(Z.charCodeAt(U+H.length))}function o(J,H,U){j+=U.length,O();let X="",Y=Z.charCodeAt(j);if(Y===39||Y===34){let Q=j;h(Y),X=Z.slice(Q,j)}else{X=f();while(j<K&&Z.charCodeAt(j)===46)j++,X+=`.${f()}`}O();let $=j<K&&Z.charCodeAt(j)===123?Gj():"{}",F=`${H?"export ":""}declare ${U} ${X} ${$}`,N=C(J),V=X.startsWith("'")||X.startsWith('"');return{kind:"module",name:X,text:F,isExported:H,source:V?X.slice(1,-1):void 0,leadingComments:N,start:J,end:j}}while(j<K){if(O(),j>=K)break;let J=j,H=Z.charCodeAt(j);if(H===105&&z("import"))L.push(Sj(J));else if(H===101&&z("export")){j+=6,O();let U=Z.charCodeAt(j);if(U===100&&z("default")){j+=7,O();let X=Z.charCodeAt(j);if(X===102&&z("function")){let Y=d(J,!0,!1,!0);if(Y)L.push(Y)}else if(X===97&&z("async")&&Dj("async")!==59)if(j+=5,O(),z("function")){let Y=d(J,!0,!0,!0);if(Y)L.push(Y)}else{I();let Y=v(J,j);L.push({kind:"export",name:"default",text:Y,isExported:!0,isTypeOnly:!1,start:J,end:j})}else if(X===99&&z("class")){let Y=a(J,!0,!1);L.push(Y)}else if(X===97&&z("abstract")){if(j+=8,O(),z("class")){let Y=a(J,!0,!0);L.push(Y)}}else{I();let Y=v(J,j),$=C(J);L.push({kind:"export",name:"default",text:Y,isExported:!0,isTypeOnly:!1,leadingComments:$,start:J,end:j})}}else if(U===116&&z("type")){let X=j;if(j+=4,O(),j<K&&Z.charCodeAt(j)===123){Nj();let Y=v(J,j),$=C(J);L.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,source:Uj(Y),leadingComments:$,start:J,end:j})}else if(j<K&&Z.charCodeAt(j)===42){Rj();let Y=v(J,j);L.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,source:Uj(Y),start:J,end:j})}else{j=X;let Y=Vj(J,!0);L.push(Y)}}else if(U===105&&z("interface")){let X=Kj(J,!0);L.push(X)}else if(U===102&&z("function")){let X=d(J,!0,!1,!1);if(X)L.push(X)}else if(U===97&&z("async"))if(j+=5,O(),z("function")){let X=d(J,!0,!0,!1);if(X)L.push(X)}else I();else if(U===99)if(z("class")){let X=a(J,!0,!1);L.push(X)}else if(z("const")){let X=j;if(j+=5,O(),z("enum")){j=X+5,O();let Y=i(J,!0,!0);L.push(Y)}else{j=X;let Y=r(J,"const",!0);for(let $=0;$<Y.length;$++)L.push(Y[$])}}else I();else if(U===97&&z("abstract")){if(j+=8,O(),z("class")){let X=a(J,!0,!0);L.push(X)}}else if(U===108&&z("let")){let X=r(J,"let",!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else if(U===118&&z("var")){let X=r(J,"var",!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else if(U===101&&z("enum")){let X=i(J,!0,!1);L.push(X)}else if(U===100&&z("declare"))j+=7,O(),wj(J,!0);else if(U===110&&z("namespace")&&Jj(9)){let X=o(J,!0,"namespace");L.push(X)}else if(U===109&&z("module")&&Jj(6)){let X=o(J,!0,"module");L.push(X)}else if(U===123){Nj();let X=v(J,j),Y=X.includes("export type"),$=C(J);L.push({kind:"export",name:"",text:X,isExported:!0,isTypeOnly:Y,source:Uj(X),leadingComments:$,start:J,end:j})}else if(U===42){Rj();let X=v(J,j),Y=C(J);L.push({kind:"export",name:"",text:X,isExported:!0,isTypeOnly:!1,source:Uj(X),leadingComments:Y,start:J,end:j})}else{I();let X=v(J,j);if(X)L.push({kind:"export",name:"",text:X,isExported:!0,start:J,end:j})}}else if(H===100&&z("declare"))j+=7,O(),wj(J,!1);else if(H===105&&z("interface")){let U=Kj(J,!1);P.set(U.name,U)}else if(H===116&&z("type")){let U=Vj(J,!1);P.set(U.name,U),L.push(U)}else if(H===102&&z("function")){let U=d(J,!1,!1,!1);if(U)P.set(U.name,U);else I()}else if(H===97)if(z("async")){let U=j;if(j+=5,O(),z("function")){let X=d(J,!1,!0,!1);if(X)P.set(X.name,X);else j=U,I()}else j=U,I()}else if(z("abstract"))if(j+=8,O(),z("class")){let U=a(J,!1,!1);P.set(U.name,U),L.push(U)}else I();else j++,I();else if(H===99)if(z("class")){let U=a(J,!1,!1);P.set(U.name,U),L.push(U)}else if(z("const")){let U=j;if(j+=5,O(),z("enum")){j=U+5,O();let X=i(J,!1,!0);P.set(X.name,X),L.push(X)}else{j=U;let X=r(J,"const",!1);for(let Y=0;Y<X.length;Y++)P.set(X[Y].name,X[Y])}}else j++,I();else if(H===101&&z("enum")){let U=i(J,!1,!1);P.set(U.name,U),L.push(U)}else if(H===108&&z("let"))I();else if(H===118&&z("var"))I();else if(H===109&&z("module")&&Jj(6)){let U=o(J,!1,"module");L.push(U)}else if(H===110&&z("namespace")&&Jj(9)){let U=o(J,!1,"namespace");L.push(U)}else{let U=Z.charCodeAt(j);if(U===39||U===34){if(h(U),j<K&&Z.charCodeAt(j)===59)j++}else if(U===96){if(t(),j<K&&Z.charCodeAt(j)===59)j++}else if(U===64){if(j++,f(),O(),j<K&&Z.charCodeAt(j)===46)j++,f(),O();if(j<K&&Z.charCodeAt(j)===40)A(40,41)}else j++,I()}}if(P.size>0)mj(L,P);if(x.size>0){let J=new Map;for(let U of L)if(U.kind==="function")J.set(U.name,(J.get(U.name)||0)+1);let H=new Set;for(let[U,X]of J)if(X>1)H.add(U);if(H.size>0){let U=new Set;for(let X of H)for(let Y=L.length-1;Y>=0;Y--)if(L[Y].kind==="function"&&L[Y].name===X&&x.has(Y)){U.add(Y);break}if(U.size>0){let X=[...U].sort((Y,$)=>$-Y);for(let Y of X)L.splice(Y,1)}}}return L;function wj(J,H){if(z("function")){let U=d(J,H,!1,!1);if(U)L.push(U)}else if(z("async")){if(j+=5,O(),z("function")){let U=d(J,H,!0,!1);if(U)L.push(U)}}else if(z("class")){let U=a(J,H,!1);L.push(U)}else if(z("abstract")){if(j+=8,O(),z("class")){let U=a(J,H,!0);L.push(U)}}else if(z("interface")){let U=Kj(J,H);L.push(U)}else if(z("type")){let U=Vj(J,H);L.push(U)}else if(z("enum")){let U=i(J,H,!1);L.push(U)}else if(z("const")){let U=j;if(j+=5,O(),z("enum")){j=U+5,O();let X=i(J,H,!0);L.push(X)}else if(H){j=U;let X=r(J,"const",!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else I()}else if(z("let")||z("var"))if(H){let U=z("let")?"let":"var",X=r(J,U,!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else I();else if(z("module")){let U=o(J,H,"module");L.push(U)}else if(z("namespace")){let U=o(J,H,"namespace");L.push(U)}else if(z("global")){j+=6,O();let X=`declare global ${j<K&&Z.charCodeAt(j)===123?Gj():"{}"}`,Y=C(J);L.push({kind:"module",name:"global",text:X,isExported:!1,leadingComments:Y,start:J,end:j})}else I()}}function vj(D,Hj){let T=0,l=D.length;while(T<l){let Z=D.charCodeAt(T);if(Z>=65&&Z<=90||Z>=97&&Z<=122||Z===95||Z===36||Z>127){let n=T;T++;while(T<l){let b=D.charCodeAt(T);if(b>=65&&b<=90||b>=97&&b<=122||b>=48&&b<=57||b===95||b===36||b>127)T++;else break}Hj.add(D.substring(n,T))}else T++}}function mj(D,Hj){let T=new Set,l=new Set;for(let b of D)l.add(b.name);let Z=new Set,n=[];for(let b=0;b<D.length;b++)if(D[b].kind!=="import")n.push(D[b].text),vj(D[b].text,Z);for(;;){let b=[];for(let[P,x]of Hj){if(T.has(P))continue;if(Z.has(P)){if(!l.has(P))b.push(x),l.add(P);T.add(P)}}if(b.length===0)break;b.sort((P,x)=>(P.start??1/0)-(x.start??1/0));let K=[],L=0;for(let P=0;P<D.length;P++){let x=D[P].start??1/0;while(L<b.length&&(b[L].start??1/0)<=x)K.push(b[L++]);K.push(D[P])}while(L<b.length)K.push(b[L++]);D.length=0;for(let P=0;P<K.length;P++)D.push(K[P]);for(let P of b)if(P.kind!=="import")n.push(P.text),vj(P.text,Z)}}
25
- export{dj as oc};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ic as a,jc as b,kc as c}from"./chunk-4s9jv983.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{c as processSourceDirect,a as processSource,b as clearResultCache};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{oc as a}from"./chunk-2r21f44d.js";import"./chunk-mcdb3q06.js";export{a as scanDeclarations};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{tb as c,ub as d,vb as e}from"./chunk-x3q42h61.js";import"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import{ic as a,jc as b}from"./chunk-4s9jv983.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-a3txc27m.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{e as watch,a as processSource,d as processFile,c as generate,b as clearResultCache};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{a,b,c}from"./chunk-83e9a4fq.js";import"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{b as optimizeFile,a as optimizeDeclarations,c as minifyDts};
@@ -1,19 +0,0 @@
1
- // @bun
2
- import{hc as E}from"./chunk-2n1bbm2c.js";import{lc as p,mc as Rq,nc as zq}from"./chunk-8z31rkfp.js";import{Fc as Jq}from"./chunk-285mqzvx.js";import{bd as D}from"./chunk-mcdb3q06.js";var L=D(E(),1);var v=D(E(),1);var I=new Map,S=new Map,Oq=100;function Lq(){while(I.size>Oq){let q=I.keys().next().value;if(q===void 0)break;I.delete(q)}}function Vq(){I.clear()}function _q(){return I.size}var Uq={asyncThreshold:1e5,chunkSize:50000,yieldInterval:0};function u(q){return new Promise(($)=>{if(q===0)if(typeof setImmediate<"u")setImmediate($);else setTimeout($,0);else setTimeout($,q)})}async function Iq(q,$,Q){if($.length<Q.asyncThreshold)return v.createSourceFile(q,$,v.ScriptTarget.Latest,!0,v.ScriptKind.TS);await u(Q.yieldInterval);let W=v.createSourceFile(q,$,v.ScriptTarget.Latest,!1,v.ScriptKind.TS);return await u(Q.yieldInterval),W}async function g(q,$,Q={}){let W={...Uq,...Q},V=p($),Z=q,U=Date.now(),j=I.get(Z);if(j&&j.contentHash===V)return j.lastAccess=U,I.delete(Z),I.set(Z,j),j.sourceFile;let X=S.get(Z);if(X)return X;let w=(async()=>{try{let H=await Iq(q,$,W);return I.set(Z,{sourceFile:H,contentHash:V,lastAccess:U}),Lq(),H}finally{S.delete(Z)}})();return S.set(Z,w),w}async function vq(q,$={}){let Q=$.concurrency??4,W=new Map,V=[];for(let Z=0;Z<q.length;Z+=Q){let U=q.slice(Z,Z+Q),j=await Promise.allSettled(U.map(async({filePath:X,sourceCode:w})=>{let H=await g(X,w,$);return{filePath:X,sourceFile:H}}));for(let X=0;X<j.length;X++){let w=j[X];if(w.status==="fulfilled")W.set(w.value.filePath,w.value.sourceFile);else V.push({filePath:U[X].filePath,error:w.reason})}if(Z+Q<q.length)await u(0)}if(V.length>0)console.warn(`[dtsx] ${V.length} file(s) failed to parse:`,V.map((Z)=>Z.filePath));return W}function Aq(q,$={}){let Q=$.asyncThreshold??Uq.asyncThreshold;return q.length>=Q}function kq(){return S.size}var R=D(E(),1);var Y=D(E(),1);var O=D(E(),1);function P(q,$,Q){return $.slice(Q?q.getStart(Q):q.getStart(),q.getEnd())}var wq=/\/\*[\s\S]*?\*\//g;function _(q,$){let Q=[],W=q.getFullStart(),V=q.getStart($);if(W===V)return Q;let Z=$.text.substring(W,V);if(Z.indexOf("/*")!==-1){wq.lastIndex=0;let U;while((U=wq.exec(Z))!==null)Q.push(U[0])}if(Z.indexOf("//")!==-1){let U=Z.split(`
3
- `),j=[];for(let X=U.length-1;X>=0;X--){let w=U[X].trim();if(w.startsWith("//"))j.unshift(w);else if(w==="")continue;else break}if(j.length>0)Q.push(j.join(`
4
- `))}return Q}function k(q,$){if(O.isObjectBindingPattern(q.name)){let Q=q.name.elements.map((W)=>{if(O.isBindingElement(W)&&O.isIdentifier(W.name))return W.name.getText($);return""}).filter(Boolean);if(Q.length>3)return`{
5
- ${Q.join(`,
6
- `)},
7
- }`;return`{ ${Q.join(", ")} }`}else if(O.isArrayBindingPattern(q.name))return`[${q.name.elements.map((W)=>{if(W&&O.isBindingElement(W)&&O.isIdentifier(W.name))return W.name.getText($);return""}).filter(Boolean).join(", ")}]`;else return q.name.getText($)}function B(q){if(!("modifiers"in q)||!q.modifiers)return!1;return q.modifiers.some((Q)=>Q.kind===O.SyntaxKind.ExportKeyword)}function l(q){return q.modifiers?.some(($)=>$.kind===O.SyntaxKind.AsyncKeyword)||!1}function c(q,$){return!1}var N=new Map;function d(q,$){let Q=N.get(q);if(!Q){let W=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(Q={funcPattern:new RegExp(`export\\s+[^\\n]*:\\s*[^\\n]*\\b${W}\\b`,"gm"),typePattern:new RegExp(`export\\s+[^\\n]*\\b${W}\\b`,"gm")},N.set(q,Q),N.size>200){let V=Array.from(N.keys()).slice(0,50);for(let Z of V)N.delete(Z)}}return Q.funcPattern.lastIndex=0,Q.typePattern.lastIndex=0,Q.funcPattern.test($)||Q.typePattern.test($)}var Mq=new Set(["string","number","boolean","object","any","unknown","never","void","undefined","null","Array","Promise","Record","Partial","Required","Pick","Omit","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisType","Function","Date","RegExp","Error","Map","Set","WeakMap","WeakSet","T","K","V","U","R","P","E","A","B","C","D","F","G","H","I","J","L","M","N","O","Q","S","W","X","Y","Z"]);function m(q){return Mq.has(q)}var Yq=/(?:export\s+)?(?:declare\s+)?(?:const\s+)?(?:interface|type|class|enum)\s+([A-Z][a-zA-Z0-9]*)/g;function i(q){let $=[];Yq.lastIndex=0;let Q;while((Q=Yq.exec(q))!==null)$.push(Q[1]);return $}var Pq=/\s+as\s+(\S+)\s*$/;function K(q,$){let Q=q.trim();if(!Q.endsWith("as const")){let V=Q.match(Pq);if(V)return V[1]}let W=Jq(Q,$);if(W==="unknown")return"unknown";if(!$){if(W==="true"||W==="false")return"boolean";if(/^-?\d+(\.\d+)?$/.test(W))return"number";if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))return"string"}return W}function t(q,$){let Q=[],W=q.modifiers?.some((j)=>j.kind===Y.SyntaxKind.AsyncKeyword),V=!!q.asteriskToken;if(B(q))Q.push("export ");if(Q.push("declare function "),q.name)Q.push(q.name.getText($));if(q.typeParameters){let j=q.typeParameters.map((X)=>X.getText($)).join(", ");Q.push("<",j,">")}let Z=q.parameters.map((j)=>{let X=k(j,$),w=j.type?.getText($)||(j.initializer?K(j.initializer.getText($),!1):"unknown"),H=j.questionToken||j.initializer?"?":"";if(!!j.dotDotDotToken)return`...${X}: ${w}`;return`${X}${H}: ${w}`}).join(", ");Q.push("(",Z,")");let U=q.type?.getText($);if(!U)if(W&&V)U="AsyncGenerator<unknown, void, unknown>";else if(V)U="Generator<unknown, void, unknown>";else if(W)U="Promise<void>";else U="void";return Q.push(": ",U,";"),Q.join("")}function a(q,$,Q,W){let V=[];if(W)V.push("export ");if(V.push("declare ",Q," ",q),$)V.push(": ",$);return V.push(";"),V.join("")}function n(q,$,Q){let W=[];if($)W.push("export ");if(W.push("declare interface ",q.name.getText(Q)),q.typeParameters){let Z=q.typeParameters.map((U)=>U.getText(Q)).join(", ");W.push("<",Z,">")}if(q.heritageClauses){let Z=q.heritageClauses.find((U)=>U.token===Y.SyntaxKind.ExtendsKeyword);if(Z){let U=Z.types.map((j)=>j.getText(Q)).join(", ");W.push(" extends ",U)}}let V=s(q,Q);return W.push(" ",V),W.join("")}function Hq(q,$){if(!q.name)return"";return q.name.getText($)}function s(q,$){let Q=[];for(let W of q.members)if(Y.isPropertySignature(W)){let V=Hq(W,$),Z=W.type?.getText($)||"unknown",U=W.questionToken?"?":"",j=W.modifiers?.some((X)=>X.kind===Y.SyntaxKind.ReadonlyKeyword)?"readonly ":"";Q.push(` ${j}${V}${U}: ${Z}`)}else if(Y.isMethodSignature(W)){let V=Hq(W,$),Z="";if(W.typeParameters&&W.typeParameters.length>0)Z=`<${W.typeParameters.map((w)=>w.getText($)).join(", ")}>`;let U=W.parameters.map((w)=>{let H=w.name.getText($),G=w.type?.getText($)||"unknown",J=w.questionToken?"?":"";if(!!w.dotDotDotToken)return`...${H}: ${G}`;return`${H}${J}: ${G}`}).join(", "),j=W.type?.getText($)||"void",X=W.questionToken?"?":"";Q.push(` ${V}${X}${Z}(${U}): ${j}`)}else if(Y.isCallSignatureDeclaration(W)){let V=W.parameters.map((U)=>{let j=U.name.getText($),X=U.type?.getText($)||"unknown",w=U.questionToken?"?":"";if(!!U.dotDotDotToken)return`...${j}: ${X}`;return`${j}${w}: ${X}`}).join(", "),Z=W.type?.getText($)||"void";Q.push(` (${V}): ${Z}`)}else if(Y.isConstructSignatureDeclaration(W)){let V=W.parameters.map((U)=>{let j=U.name.getText($),X=U.type?.getText($)||"unknown",w=U.questionToken?"?":"";if(!!U.dotDotDotToken)return`...${j}: ${X}`;return`${j}${w}: ${X}`}).join(", "),Z=W.type?.getText($)||"unknown";Q.push(` new (${V}): ${Z}`)}else if(Y.isIndexSignatureDeclaration(W)){let V=W.parameters.map((U)=>{let j=U.name.getText($),X=U.type?.getText($)||"any";return`${j}: ${X}`}).join(", "),Z=W.type?.getText($)||"unknown";Q.push(` [${V}]: ${Z}`)}return`{
8
- ${Q.join(`
9
- `)}
10
- }`}function o(q,$,Q){let W=[];if($)W.push("export ");if(W.push("type ",q.name.getText(Q)),q.typeParameters){let V=q.typeParameters.map((Z)=>Z.getText(Q)).join(", ");W.push("<",V,">")}return W.push(" = ",q.type.getText(Q)),W.join("")}function r(q,$,Q){let W=[];if($)W.push("export ");if(W.push("declare "),q.modifiers?.some((j)=>j.kind===Y.SyntaxKind.AbstractKeyword))W.push("abstract ");if(W.push("class ",q.name?.getText(Q)||"AnonymousClass"),q.typeParameters){let j=q.typeParameters.map((X)=>X.getText(Q)).join(", ");W.push("<",j,">")}let Z=q.heritageClauses?.find((j)=>j.token===Y.SyntaxKind.ExtendsKeyword)?.types[0]?.getText(Q);if(Z)W.push(" extends ",Z);let U=q.heritageClauses?.find((j)=>j.token===Y.SyntaxKind.ImplementsKeyword)?.types.map((j)=>j.getText(Q));if(U&&U.length>0)W.push(" implements ",U.join(", "));return W.push(" ",Gq(q,Q)),W.join("")}function T(q,$,Q,W,V){let Z=[" "];if(W)Z.push("private ");else if(V)Z.push("protected ");if(q)Z.push("static ");if($)Z.push("abstract ");if(Q)Z.push("readonly ");return Z.join("")}function h(q){return q.name?Y.isPrivateIdentifier(q.name):!1}function b(q,$){if(!q.name)return"";return q.name.getText($)}function Gq(q,$){let Q=[];for(let W of q.members){if(W.kind===Y.SyntaxKind.ClassStaticBlockDeclaration)continue;if(Y.isConstructorDeclaration(W)){for(let Z of W.parameters)if(Z.modifiers&&Z.modifiers.length>0){if(Z.modifiers.some((J)=>J.kind===Y.SyntaxKind.PrivateKeyword))continue;let j=k(Z,$),X=Z.type?.getText($)||(Z.initializer?K(Z.initializer.getText($),!1):"unknown"),w=Z.questionToken||Z.initializer?"?":"",H=Z.modifiers.map((J)=>J.getText($)).join(" "),G=H?`${H} `:"";Q.push(` ${G}${j}${w}: ${X};`)}let V=W.parameters.map((Z)=>{let U=k(Z,$),j=Z.type?.getText($)||(Z.initializer?K(Z.initializer.getText($),!1):"unknown"),X=Z.questionToken||Z.initializer?"?":"";return`${U}${X}: ${j}`}).join(", ");Q.push(` constructor(${V});`)}else if(Y.isMethodDeclaration(W)){if(h(W))continue;if(W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.PrivateKeyword))continue;let Z=b(W,$),U=!!W.asteriskToken,X=[T(!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.StaticKeyword),!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.AbstractKeyword),!1,!1,!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.ProtectedKeyword))];if(U)X.push("*");if(X.push(Z),W.typeParameters){let J=W.typeParameters.map((z)=>z.getText($)).join(", ");X.push("<",J,">")}let w=W.parameters.map((J)=>{let z=k(J,$),M=J.type?.getText($)||(J.initializer?K(J.initializer.getText($),!1):"unknown"),A=J.questionToken||J.initializer?"?":"";return`${z}${A}: ${M}`}).join(", ");X.push("(",w,")");let H=!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.AsyncKeyword),G=W.type?.getText($);if(!G)if(H&&U)G="AsyncGenerator<unknown, void, unknown>";else if(U)G="Generator<unknown, void, unknown>";else if(H)G="Promise<void>";else G="void";X.push(": ",G,";"),Q.push(X.join(""))}else if(Y.isPropertyDeclaration(W)){if(h(W))continue;if(W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.PrivateKeyword))continue;let Z=b(W,$),U=T(!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.StaticKeyword),!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.AbstractKeyword),!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.ReadonlyKeyword),!1,!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.ProtectedKeyword)),j=W.questionToken?"?":"",X=!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.StaticKeyword),w=!!W.modifiers?.some((J)=>J.kind===Y.SyntaxKind.ReadonlyKeyword),H=X&&w,G=W.type?.getText($)||(W.initializer?K(W.initializer.getText($),H):"unknown");Q.push(`${U}${Z}${j}: ${G};`)}else if(Y.isGetAccessorDeclaration(W)){if(h(W))continue;if(W.modifiers?.some((X)=>X.kind===Y.SyntaxKind.PrivateKeyword))continue;let Z=b(W,$),U=T(!!W.modifiers?.some((X)=>X.kind===Y.SyntaxKind.StaticKeyword),!!W.modifiers?.some((X)=>X.kind===Y.SyntaxKind.AbstractKeyword),!1,!1,!!W.modifiers?.some((X)=>X.kind===Y.SyntaxKind.ProtectedKeyword)),j=W.type?.getText($)||"unknown";Q.push(`${U}get ${Z}(): ${j};`)}else if(Y.isSetAccessorDeclaration(W)){if(h(W))continue;if(W.modifiers?.some((H)=>H.kind===Y.SyntaxKind.PrivateKeyword))continue;let Z=b(W,$),U=T(!!W.modifiers?.some((H)=>H.kind===Y.SyntaxKind.StaticKeyword),!!W.modifiers?.some((H)=>H.kind===Y.SyntaxKind.AbstractKeyword),!1,!1,!!W.modifiers?.some((H)=>H.kind===Y.SyntaxKind.ProtectedKeyword)),j=W.parameters[0],X=j?.type?.getText($)||"unknown",w=j?.name?.getText($)||"value";Q.push(`${U}set ${Z}(${w}: ${X});`)}}return`{
11
- ${Q.join(`
12
- `)}
13
- }`}function e(q,$,Q){let W=[];if(q.flags&Y.NodeFlags.GlobalAugmentation)return`declare global ${x(q,Q)}`;if($)W.push("export ");W.push("declare ");let Z=q.flags&Y.NodeFlags.Namespace;return W.push(Z?"namespace ":"module "),W.push(q.name.getText(Q)),W.push(" ",x(q,Q)),W.join("")}function x(q,$){if(!q.body)return"{}";let Q=[];function W(V){if(Y.isFunctionDeclaration(V)){let Z=B(V),U=V.name?.getText($)||"",j=[" "];if(Z)j.push("export ");if(j.push("function ",U),V.typeParameters){let H=V.typeParameters.map((G)=>G.getText($)).join(", ");j.push("<",H,">")}let X=V.parameters.map((H)=>{let G=k(H,$),J=H.type?.getText($)||(H.initializer?K(H.initializer.getText($),!1):"unknown"),z=H.questionToken||H.initializer?"?":"";return`${G}${z}: ${J}`}).join(", ");j.push("(",X,")");let w=V.type?.getText($)||"void";j.push(": ",w,";"),Q.push(j.join(""))}else if(Y.isVariableStatement(V)){let Z=B(V);for(let U of V.declarationList.declarations)if(U.name&&Y.isIdentifier(U.name)){let j=U.name.getText($),X=U.type?.getText($),w=U.initializer?.getText($),H=V.declarationList.flags&Y.NodeFlags.Const?"const":V.declarationList.flags&Y.NodeFlags.Let?"let":"var",G=[" "];if(Z)G.push("export ");if(G.push(H," ",j),X)G.push(": ",X);else if(w){let J=K(w,H==="const");G.push(": ",J)}else G.push(": unknown");G.push(";"),Q.push(G.join(""))}}else if(Y.isInterfaceDeclaration(V)){let Z=B(V),U=V.name.getText($),j=[" "];if(Z)j.push("export ");if(j.push("interface ",U),V.typeParameters){let w=V.typeParameters.map((H)=>H.getText($)).join(", ");j.push("<",w,">")}if(V.heritageClauses){let w=V.heritageClauses.find((H)=>H.token===Y.SyntaxKind.ExtendsKeyword);if(w){let H=w.types.map((G)=>G.getText($)).join(", ");j.push(" extends ",H)}}let X=s(V,$);j.push(" ",X),Q.push(j.join(""))}else if(Y.isTypeAliasDeclaration(V)){let Z=B(V),U=V.name.getText($),j=[" "];if(Z)j.push("export ");if(j.push("type ",U),V.typeParameters){let X=V.typeParameters.map((w)=>w.getText($)).join(", ");j.push("<",X,">")}j.push(" = ",V.type.getText($)),Q.push(j.join(""))}else if(Y.isEnumDeclaration(V)){let Z=B(V),U=V.name.getText($),j=V.modifiers?.some((H)=>H.kind===Y.SyntaxKind.ConstKeyword),X=[" "];if(Z)X.push("export ");if(j)X.push("const ");X.push("enum ",U);let w=[];for(let H of V.members)if(Y.isEnumMember(H)){let G=H.name.getText($);if(H.initializer){let J=H.initializer.getText($);w.push(` ${G} = ${J}`)}else w.push(` ${G}`)}X.push(` {
14
- `,w.join(`,
15
- `),`
16
- }`),Q.push(X.join(""))}else if(Y.isModuleDeclaration(V)){let Z=B(V),U=V.name.getText($),j=[" "];if(Z)j.push("export ");let X=V.flags&Y.NodeFlags.Namespace;j.push(X?"namespace ":"module "),j.push(U," ",x(V,$)),Q.push(j.join(""))}else if(Y.isExportAssignment(V)){let Z=[" export default "];if(V.expression)Z.push(V.expression.getText($));Z.push(";"),Q.push(Z.join(""))}}if(Y.isModuleBlock(q.body))for(let V of q.body.statements)W(V);else if(Y.isModuleDeclaration(q.body))W(q.body);return`{
17
- ${Q.join(`
18
- `)}
19
- }`}function qq(q,$,Q){let W=P(q,$,Q),V=!!q.importClause?.isTypeOnly,Z=!q.importClause;return{kind:"import",name:"",text:W,isExported:!1,isTypeOnly:V,isSideEffect:Z,source:q.moduleSpecifier.getText(Q).slice(1,-1),start:q.getStart(Q),end:q.getEnd()}}function Qq(q,$,Q,W=!1){let V=P(q,$,Q),Z=!!q.isTypeOnly,U=W?_(q,Q):void 0;return{kind:"export",name:"",text:V,isExported:!0,isTypeOnly:Z,leadingComments:U,source:q.moduleSpecifier?.getText(Q).slice(1,-1),start:q.getStart(Q),end:q.getEnd()}}function Wq(q,$,Q,W=!1){let V=P(q,$,Q),Z=W?_(q,Q):void 0;return{kind:"export",name:"default",text:V,isExported:!0,isTypeOnly:!1,leadingComments:Z,start:q.getStart(Q),end:q.getEnd()}}function $q(q,$,Q,W){if(!q.name)return null;if(q.body){let z=q.name.getText(Q),M=!1;if(R.forEachChild(Q,(A)=>{if(R.isFunctionDeclaration(A)&&A!==q&&A.name?.getText(Q)===z&&!A.body)M=!0}),M)return null}let V=q.name.getText(Q),Z=B(q),U=l(q),j=!!q.asteriskToken,X=t(q,Q),w=q.parameters.map((z)=>({name:z.name.getText(Q),type:z.type?.getText(Q)||"any",optional:!!z.questionToken,defaultValue:z.initializer?.getText(Q)})),H=q.type?.getText(Q);if(!H)if(U&&j)H="AsyncGenerator<unknown, void, unknown>";else if(j)H="Generator<unknown, void, unknown>";else if(U)H="Promise<void>";else H="void";let G=q.typeParameters?.map((z)=>z.getText(Q)).join(", "),J=W?_(q,Q):void 0;return{kind:"function",name:V,text:X,isExported:Z,isAsync:U,isGenerator:j,parameters:w,returnType:H,generics:G?`<${G}>`:void 0,leadingComments:J,start:q.getStart(Q),end:q.getEnd()}}function Dq(q,$){let Q=q.getText($);if(q.kind===R.SyntaxKind.ObjectLiteralExpression)return`typeof ${Q} as const`;if(q.kind===R.SyntaxKind.ArrayLiteralExpression)return`readonly ${Q}`;if(q.kind===R.SyntaxKind.StringLiteral)return Q;if(q.kind===R.SyntaxKind.NumericLiteral)return Q;if(q.kind===R.SyntaxKind.TrueKeyword||q.kind===R.SyntaxKind.FalseKeyword)return Q;return`typeof ${Q}`}function jq(q,$,Q,W){let V=[];if(!B(q))return V;for(let U of q.declarationList.declarations){if(!U.name||!R.isIdentifier(U.name))continue;let j=U.name.getText(Q),X=U.type?.getText(Q),w=U.initializer,H=w?.getText(Q),G=q.declarationList.flags&R.NodeFlags.Const?"const":q.declarationList.flags&R.NodeFlags.Let?"let":"var",J=!1;if(w&&R.isAsExpression(w)){if(w.type.getText(Q)==="const"){J=!0;let Bq=w.expression;if(!X)X=Dq(Bq,Q)}}let z=a(j,X,G,!0),M=W?_(q,Q):void 0;V.push({kind:"variable",name:j,text:z,isExported:!0,typeAnnotation:X,value:H,modifiers:J?[G,"const assertion"]:[G],leadingComments:M,start:q.getStart(Q),end:q.getEnd()})}return V}function F(q,$,Q,W){let V=q.name.getText(Q),Z=B(q),U=n(q,Z,Q),j=q.heritageClauses?.find((H)=>H.token===R.SyntaxKind.ExtendsKeyword)?.types.map((H)=>H.getText(Q)).join(", "),X=q.typeParameters?.map((H)=>H.getText(Q)).join(", "),w=W?_(q,Q):void 0;return{kind:"interface",name:V,text:U,isExported:Z,extends:j,generics:X?`<${X}>`:void 0,leadingComments:w,start:q.getStart(Q),end:q.getEnd()}}function C(q,$,Q,W){let V=q.name.getText(Q),Z=B(q),U=o(q,Z,Q),j=q.typeParameters?.map((w)=>w.getText(Q)).join(", "),X=W?_(q,Q):void 0;return{kind:"type",name:V,text:U,isExported:Z,generics:j?`<${j}>`:void 0,leadingComments:X,start:q.getStart(Q),end:q.getEnd()}}function y(q,$,Q,W){let V=q.name?.getText(Q)||"AnonymousClass",Z=B(q),U=r(q,Z,Q),j=q.heritageClauses?.find((J)=>J.token===R.SyntaxKind.ExtendsKeyword)?.types[0]?.getText(Q),X=q.heritageClauses?.find((J)=>J.token===R.SyntaxKind.ImplementsKeyword)?.types.map((J)=>J.getText(Q)),w=q.typeParameters?.map((J)=>J.getText(Q)).join(", "),H=q.modifiers?.some((J)=>J.kind===R.SyntaxKind.AbstractKeyword),G=W?_(q,Q):void 0;return{kind:"class",name:V,text:U,isExported:Z,extends:j,implements:X,generics:w?`<${w}>`:void 0,modifiers:H?["abstract"]:void 0,leadingComments:G,start:q.getStart(Q),end:q.getEnd()}}function f(q,$,Q,W){let V=q.name.getText(Q),Z=B(q),U=P(q,$,Q),j=q.modifiers?.some((w)=>w.kind===R.SyntaxKind.ConstKeyword),X=W?_(q,Q):void 0;return{kind:"enum",name:V,text:U,isExported:Z,modifiers:j?["const"]:void 0,leadingComments:X,start:q.getStart(Q),end:q.getEnd()}}function Xq(q,$,Q,W){let V=q.name.getText(Q),Z=B(q),U=e(q,Z,Q),j=R.isStringLiteral(q.name),X=W?_(q,Q):void 0;return{kind:"module",name:V,text:U,isExported:Z,source:j?V.slice(1,-1):void 0,leadingComments:X,start:q.getStart(Q),end:q.getEnd()}}function Zq(q,$){let Q=new Set,W=new Set,V=new Set;for(let Z of q)if(Z.kind==="import"){let U=Z.text.match(/import\s+(?:type\s+)?\{([^}]+)\}/g);if(U)for(let j of U){let X=j.replace(/import\s+(?:type\s+)?\{([^}]+)\}/,"$1").split(",");for(let w of X){let H=w.replace(/^type\s+/,"").trim();W.add(H)}}}for(let Z of q){if(["interface","type","class","enum"].includes(Z.kind))V.add(Z.name);if(Z.kind==="module")i(Z.text).forEach((j)=>V.add(j))}for(let Z of q)if(Z.kind!=="import"&&Z.kind!=="export"){let U=Z.text.match(/:\s*([A-Z][a-zA-Z0-9]*)/g)||[];for(let j of U){let X=j.replace(/:\s*/,"");if(!W.has(X)&&!V.has(X)&&!m(X))Q.add(X)}}return Q}function Eq(q,$,Q,W=!0){let V=[];if($.size===0)return V;function Z(U){switch(U.kind){case R.SyntaxKind.InterfaceDeclaration:{let j=U,X=j.name.getText(q);if($.has(X)){let w=F(j,Q,q,W);V.push(w),$.delete(X)}break}case R.SyntaxKind.TypeAliasDeclaration:{let j=U,X=j.name.getText(q);if($.has(X)){let w=C(j,Q,q,W);V.push(w),$.delete(X)}break}case R.SyntaxKind.ClassDeclaration:{let j=U;if(j.name){let X=j.name.getText(q);if($.has(X)){let w=y(j,Q,q,W);V.push(w),$.delete(X)}}break}case R.SyntaxKind.EnumDeclaration:{let j=U,X=j.name.getText(q);if($.has(X)){let w=f(j,Q,q,W);V.push(w),$.delete(X)}break}}R.forEachChild(U,Z)}return Z(q),V}function tq(){Vq(),zq()}function aq(q,$,Q=!0,W=!1){return Rq(q,$,Q,W)}function Nq(q,$,Q){let W=[],V=new Map,Z=0;function U(j){if(Z!==1){Z++,L.forEachChild(j,U),Z--;return}switch(j.kind){case L.SyntaxKind.ImportDeclaration:W.push(qq(j,$,q));break;case L.SyntaxKind.ExportDeclaration:W.push(Qq(j,$,q,Q));break;case L.SyntaxKind.ExportAssignment:W.push(Wq(j,$,q,Q));break;case L.SyntaxKind.FunctionDeclaration:{let X=$q(j,$,q,Q);if(X&&(X.isExported||c(X.name,$)))W.push(X);break}case L.SyntaxKind.VariableStatement:{let X=jq(j,$,q,Q);W.push(...X);break}case L.SyntaxKind.InterfaceDeclaration:{let X=F(j,$,q,Q);if(X.isExported||d(X.name,$))W.push(X);else V.set(X.name,X);break}case L.SyntaxKind.TypeAliasDeclaration:{let X=C(j,$,q,Q);if(W.push(X),!X.isExported)V.set(X.name,X);break}case L.SyntaxKind.ClassDeclaration:{let X=y(j,$,q,Q);if(W.push(X),!X.isExported&&X.name)V.set(X.name,X);break}case L.SyntaxKind.EnumDeclaration:{let X=f(j,$,q,Q);if(W.push(X),!X.isExported)V.set(X.name,X);break}case L.SyntaxKind.ModuleDeclaration:W.push(Xq(j,$,q,Q));break}}if(U(q),V.size>0){let j=Zq(W,$);for(let X of j){let w=V.get(X);if(w)W.push(w)}}return W}async function Sq(q,$,Q=!0,W={}){let V=await g($,q,W);return Nq(V,q,Q)}async function nq(q,$={}){let Q=$.concurrency??4,W=new Map;for(let V=0;V<q.length;V+=Q){let Z=q.slice(V,V+Q),U=await Promise.all(Z.map(async({filePath:j,sourceCode:X,keepComments:w})=>{let H=await Sq(X,j,w,$);return{filePath:j,declarations:H}}));for(let{filePath:j,declarations:X}of U)W.set(j,X)}return W}export{_q as wb,g as xb,vq as yb,Aq as zb,kq as Ab,P as Bb,_ as Cb,k as Db,B as Eb,l as Fb,c as Gb,d as Hb,m as Ib,i as Jb,t as Kb,a as Lb,n as Mb,s as Nb,o as Ob,r as Pb,Gq as Qb,e as Rb,x as Sb,qq as Tb,Qq as Ub,Wq as Vb,$q as Wb,jq as Xb,F as Yb,C as Zb,y as _b,f as $b,Xq as ac,Zq as bc,Eq as cc,tq as dc,aq as ec,Sq as fc,nq as gc};