@stacksjs/dtsx 0.9.14 → 0.9.15

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 (38) hide show
  1. package/README.md +3 -9
  2. package/dist/bin/cli.js +5 -5
  3. package/dist/{chunk-dzgms5s6.js → chunk-14gh6ezz.js} +1 -1
  4. package/dist/{chunk-d1xj2pjv.js → chunk-2r21f44d.js} +18 -17
  5. package/dist/{chunk-p50ms07x.js → chunk-3zjt21t1.js} +1 -1
  6. package/dist/{chunk-x4v9kajr.js → chunk-4s9jv983.js} +1 -1
  7. package/dist/{chunk-dk914hsr.js → chunk-5hzvjjt0.js} +1 -1
  8. package/dist/{chunk-wzq881r8.js → chunk-83e9a4fq.js} +1 -1
  9. package/dist/{chunk-pt2txw6z.js → chunk-8cv1t8qg.js} +1 -1
  10. package/dist/{chunk-abhx1v3w.js → chunk-8g7jyxbr.js} +1 -1
  11. package/dist/{chunk-rsv17jh8.js → chunk-8z31rkfp.js} +1 -1
  12. package/dist/{chunk-3w5aqasc.js → chunk-a3txc27m.js} +1 -1
  13. package/dist/chunk-bh9ey0vw.js +2 -0
  14. package/dist/{chunk-8kz02py2.js → chunk-bsxtpwx6.js} +1 -1
  15. package/dist/{chunk-mwfja9e3.js → chunk-c09v68yx.js} +1 -1
  16. package/dist/{chunk-j8zksbkn.js → chunk-f4c389mj.js} +1 -1
  17. package/dist/{chunk-enqtx6te.js → chunk-fef6249b.js} +1 -1
  18. package/dist/{chunk-r6v1qdqb.js → chunk-j2yw0d45.js} +1 -1
  19. package/dist/{chunk-pj8142by.js → chunk-mn46jafe.js} +1 -1
  20. package/dist/{chunk-y6m8mmyg.js → chunk-npj0c002.js} +1 -1
  21. package/dist/{chunk-7tyhhk7c.js → chunk-pep9jyxn.js} +1 -1
  22. package/dist/{chunk-j1zrbs2z.js → chunk-qrht3d5g.js} +1 -1
  23. package/dist/chunk-rh2bqn7v.js +2 -0
  24. package/dist/{chunk-ayvw3402.js → chunk-w71syh0b.js} +1 -1
  25. package/dist/chunk-w8d9jjsa.js +2 -0
  26. package/dist/{chunk-vgm83r4p.js → chunk-xhs0tsnn.js} +1 -1
  27. package/dist/{chunk-thhd43x5.js → chunk-y581wnfe.js} +1 -1
  28. package/dist/src/index.js +1 -1
  29. package/dist/src/plugins/bun.js +1 -1
  30. package/dist/src/plugins/esbuild.js +1 -1
  31. package/dist/src/plugins/index.js +1 -1
  32. package/dist/src/plugins/tsup.js +1 -1
  33. package/dist/src/plugins/vite.js +1 -1
  34. package/dist/src/plugins/webpack.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/chunk-1bge31tv.js +0 -2
  37. package/dist/chunk-27nzyfdd.js +0 -2
  38. package/dist/chunk-cbz06k9p.js +0 -2
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  <p align="center"><img src="https://github.com/stacksjs/dtsx/blob/main/.github/art/cover.jpg?raw=true" alt="Social Card of this repo"></p>
2
2
 
3
- [![npm version][npm-version-src]][npm-version-href]
4
- [![GitHub Actions][github-actions-src]][github-actions-href]
5
- [![Commitizen friendly][commitizen-src]][commitizen-href]
3
+ [![npm version](https://img.shields.io/npm/v/@stacksjs/dtsx?style=flat-square)](https://npmjs.com/package/@stacksjs/dtsx)
4
+ [![GitHub Actions](https://img.shields.io/github/actions/workflow/status/stacksjs/dtsx/ci.yml?style=flat-square&branch=main)](https://github.com/stacksjs/dtsx/actions?query=workflow%3Aci)
5
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
6
6
  <!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
7
7
  <!-- [![Codecov][codecov-src]][codecov-href] -->
8
8
 
@@ -411,12 +411,6 @@ The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/dtsx/tre
411
411
  Made with 💙
412
412
 
413
413
  <!-- Badges -->
414
- [npm-version-src]: https://img.shields.io/npm/v/@stacksjs/dtsx?style=flat-square
415
- [npm-version-href]: https://npmjs.com/package/@stacksjs/dtsx
416
- [github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/dtsx/ci.yml?style=flat-square&branch=main
417
- [github-actions-href]: https://github.com/stacksjs/dtsx/actions?query=workflow%3Aci
418
- [commitizen-src]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
419
- [commitizen-href]: http://commitizen.github.io/cz-cli/
420
414
 
421
415
  <!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/dtsx/main?style=flat-square
422
416
  [codecov-href]: https://codecov.io/gh/stacksjs/dtsx -->
package/dist/bin/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- import{dd as Y}from"../chunk-mcdb3q06.js";import V from"process";var f=V.argv[2];if(f==="stdin"||f==="emit"||f==="--project"){if(f==="stdin"){let{processSource:q}=await import("../chunk-pt2txw6z.js"),Q=[];for await(let N of V.stdin)Q.push(N);let K=Buffer.concat(Q).toString("utf-8");if(K.trim())V.stdout.write(q(K,"stdin.ts")),V.stdout.write(`
3
- `)}else if(f==="--project"){let{readdirSync:q,readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv.slice(3),z="",B="",G=!1;for(let X=0;X<$.length;X++)if($[X]==="--outdir"&&$[X+1])B=$[X+1],X++;else if($[X]==="--isolated-declarations")G=!0;else if(!z)z=$[X];N(B,{recursive:!0});let j=q(z).filter((X)=>X.endsWith(".ts")&&!X.endsWith(".d.ts")),Z=j.length,E=Array(Z),M=Array(Z);for(let X=0;X<Z;X++)E[X]=`${z}/${j[X]}`,M[X]=`${B}/${j[X].slice(0,-3)}.d.ts`;let T=["bun"],R=A&&Z>=64,I=!1,_=null;if(R){let X=null;try{let{createWorkerPool:F,calculateOptimalBatchSize:D}=await import("../chunk-3xqchdwd.js"),{cpus:C}=await import("os"),w=Math.max(1,C().length-1),U=Math.min(64,Math.max(8,D(Z,w)*2)),L=Z>=256,a=!0,l=Z>=256;if(!L&&Z>=256){_=Array(Z);for(let x=0;x<Z;x++)_[x]=J.file(E[x]).text()}let O=Math.ceil(Z/U),u=Math.min(O,Math.max(2,w*2));X=F({maxWorkers:w,initialWorkers:w,recycleAfter:Math.max(100,O+1)}),await X.init();let d=X,i=0,r=Date.now(),t=async()=>{for(;;){let x=i++;if(x>=O)return;let S=x*U;if(S>=Z)return;let g=Math.min(Z,S+U)-S,m;if(l){let P=Array(g),y=Array(g),b;if(L)for(let W=0;W<g;W++){let v=S+W;P[W]=E[v],y[W]=M[v]}else{let W=Array(g);for(let v=0;v<g;v++){let c=S+v;P[v]=E[c],y[v]=M[c],W[v]=_?_[c]:J.file(E[c]).text()}b=await Promise.all(W)}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:P[0]||"",filePaths:P,sources:b,outPaths:y,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}else{let P=Array(g);if(L)for(let y=0;y<g;y++){let b=S+y;P[y]={filePath:E[b],outPath:M[b]}}else{let y=Array(g);for(let W=0;W<g;W++){let v=S+W;y[W]=_?_[v]:J.file(E[v]).text()}let b=await Promise.all(y);for(let W=0;W<g;W++){let v=S+W;P[W]={filePath:E[v],sourceCode:b[W],outPath:M[v]}}}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:E[S]||"",files:P,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}if(!m.success)throw Error(m.error||`Worker batch failed for ${E[S]}`);if(m.batchResults?.length){let P=m.batchResults[0];throw Error(P?.error||m.error||`Worker failed for ${E[S]}`)}}},n=[];for(let x=0;x<u;x++)n.push(t());await Promise.all(n),I=!0}catch{I=!1}finally{if(X)await X.shutdown()}}if(!I){let{scanDeclarations:X}=await import("../chunk-1bge31tv.js"),{processDeclarations:F}=await import("../chunk-xmje6xfw.js"),D=Array(Z);if(A){let U=_?await Promise.all(_):await Promise.all(E.map((L)=>J.file(L).text()));for(let L=0;L<Z;L++)D[L]=U[L]}else for(let U=0;U<Z;U++)D[U]=Q(E[U],"utf-8");let C=Array(Z),w={filePath:"",sourceCode:"",declarations:[]};for(let U=0;U<Z;U++){let L=X(D[U],j[U],!0,G);w.filePath=j[U],w.sourceCode=D[U],w.declarations=L,C[U]=F(L,w,!0,T)}if(A){let U=Array(Z);for(let L=0;L<Z;L++)U[L]=J.write(M[L],C[L]);await Promise.all(U)}else for(let U=0;U<Z;U++)K(M[U],C[U])}}else{let{processSource:q}=await import("../chunk-pt2txw6z.js"),{readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv[3],z=A?await J.file($).text():Q($,"utf-8"),B=V.argv[4];if(B){let{dirname:G}=await import("path");N(G(B),{recursive:!0});let j=`${q(z,$)}
2
+ import{dd as Y}from"../chunk-mcdb3q06.js";import V from"process";var f=V.argv[2];if(f==="stdin"||f==="emit"||f==="--project"){if(f==="stdin"){let{processSource:q}=await import("../chunk-8cv1t8qg.js"),Q=[];for await(let N of V.stdin)Q.push(N);let K=Buffer.concat(Q).toString("utf-8");if(K.trim())V.stdout.write(q(K,"stdin.ts")),V.stdout.write(`
3
+ `)}else if(f==="--project"){let{readdirSync:q,readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv.slice(3),z="",B="",G=!1;for(let X=0;X<$.length;X++)if($[X]==="--outdir"&&$[X+1])B=$[X+1],X++;else if($[X]==="--isolated-declarations")G=!0;else if(!z)z=$[X];N(B,{recursive:!0});let j=q(z).filter((X)=>X.endsWith(".ts")&&!X.endsWith(".d.ts")),Z=j.length,E=Array(Z),M=Array(Z);for(let X=0;X<Z;X++)E[X]=`${z}/${j[X]}`,M[X]=`${B}/${j[X].slice(0,-3)}.d.ts`;let T=["bun"],R=A&&Z>=64,I=!1,_=null;if(R){let X=null;try{let{createWorkerPool:F,calculateOptimalBatchSize:D}=await import("../chunk-3xqchdwd.js"),{cpus:C}=await import("os"),w=Math.max(1,C().length-1),U=Math.min(64,Math.max(8,D(Z,w)*2)),L=Z>=256,a=!0,l=Z>=256;if(!L&&Z>=256){_=Array(Z);for(let x=0;x<Z;x++)_[x]=J.file(E[x]).text()}let O=Math.ceil(Z/U),u=Math.min(O,Math.max(2,w*2));X=F({maxWorkers:w,initialWorkers:w,recycleAfter:Math.max(100,O+1)}),await X.init();let d=X,i=0,r=Date.now(),t=async()=>{for(;;){let x=i++;if(x>=O)return;let S=x*U;if(S>=Z)return;let g=Math.min(Z,S+U)-S,m;if(l){let P=Array(g),y=Array(g),b;if(L)for(let W=0;W<g;W++){let v=S+W;P[W]=E[v],y[W]=M[v]}else{let W=Array(g);for(let v=0;v<g;v++){let c=S+v;P[v]=E[c],y[v]=M[c],W[v]=_?_[c]:J.file(E[c]).text()}b=await Promise.all(W)}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:P[0]||"",filePaths:P,sources:b,outPaths:y,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}else{let P=Array(g);if(L)for(let y=0;y<g;y++){let b=S+y;P[y]={filePath:E[b],outPath:M[b]}}else{let y=Array(g);for(let W=0;W<g;W++){let v=S+W;y[W]=_?_[v]:J.file(E[v]).text()}let b=await Promise.all(y);for(let W=0;W<g;W++){let v=S+W;P[W]={filePath:E[v],sourceCode:b[W],outPath:M[v]}}}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:E[S]||"",files:P,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}if(!m.success)throw Error(m.error||`Worker batch failed for ${E[S]}`);if(m.batchResults?.length){let P=m.batchResults[0];throw Error(P?.error||m.error||`Worker failed for ${E[S]}`)}}},n=[];for(let x=0;x<u;x++)n.push(t());await Promise.all(n),I=!0}catch{I=!1}finally{if(X)await X.shutdown()}}if(!I){let{scanDeclarations:X}=await import("../chunk-bh9ey0vw.js"),{processDeclarations:F}=await import("../chunk-xmje6xfw.js"),D=Array(Z);if(A){let U=_?await Promise.all(_):await Promise.all(E.map((L)=>J.file(L).text()));for(let L=0;L<Z;L++)D[L]=U[L]}else for(let U=0;U<Z;U++)D[U]=Q(E[U],"utf-8");let C=Array(Z),w={filePath:"",sourceCode:"",declarations:[]};for(let U=0;U<Z;U++){let L=X(D[U],j[U],!0,G);w.filePath=j[U],w.sourceCode=D[U],w.declarations=L,C[U]=F(L,w,!0,T)}if(A){let U=Array(Z);for(let L=0;L<Z;L++)U[L]=J.write(M[L],C[L]);await Promise.all(U)}else for(let U=0;U<Z;U++)K(M[U],C[U])}}else{let{processSource:q}=await import("../chunk-8cv1t8qg.js"),{readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv[3],z=A?await J.file($).text():Q($,"utf-8"),B=V.argv[4];if(B){let{dirname:G}=await import("path");N(G(B),{recursive:!0});let j=`${q(z,$)}
4
4
  `;if(A)await J.write(B,j);else K(B,j)}else V.stdout.write(q(z,$)),V.stdout.write(`
5
- `)}V.exit(0)}var{resolve:h}=await import("path"),{CLI:s}=await import("../chunk-trm0gptj.js"),{version:e}=await import("../chunk-dk914hsr.js"),{getConfig:o}=await import("../chunk-ayvw3402.js"),{generate:qq,processSource:Hq,watch:Kq}=await import("../chunk-cbz06k9p.js"),k=new s("dtsx"),H={cwd:V.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!1,tsconfigPath:"tsconfig.json",verbose:!1,importOrder:["bun"],dryRun:!1,stats:!1,continueOnError:!1,logLevel:"info",exclude:[],outputFormat:"text",progress:!1,diff:!1,validate:!1,parallel:!1,concurrency:4};k.command("generate","Generate TypeScript declaration files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--clean","Clean output directory before generation",{default:H.clean}).option("--tsconfig <path>","Path to tsconfig.json",{default:H.tsconfigPath}).option("--verbose","Enable verbose logging",{default:H.verbose}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:H.importOrder?.join(","),type:[String]}).option("--dry-run","Show what would be generated without writing files",{default:H.dryRun}).option("--stats","Show statistics after generation",{default:H.stats}).option("--continue-on-error","Continue processing other files if one fails",{default:H.continueOnError}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--output-format <format>","Output format: text or json",{default:H.outputFormat}).option("--progress","Show progress during generation",{default:H.progress}).option("--diff","Show diff of changes compared to existing files",{default:H.diff}).option("--validate","Validate generated .d.ts files against TypeScript",{default:H.validate}).option("--parallel","Process files in parallel",{default:H.parallel}).option("--concurrency <number>","Number of concurrent workers (with --parallel)",{default:H.concurrency}).option("--declaration-map","Generate declaration map files (.d.ts.map)",{default:!1}).option("--bundle","Bundle all declarations into a single output file",{default:!1}).option("--bundle-output <file>","Output filename when bundling (relative to outdir)",{default:"index.d.ts"}).option("--config <path>","Path to config file (dtsx.config.ts)",{default:""}).option("--incremental","Enable incremental builds (only regenerate changed files)",{default:!1}).option("--clear-cache","Clear the incremental build cache before generating",{default:!1}).option("--indent-style <style>","Indentation style: spaces or tabs",{default:"spaces"}).option("--indent-size <size>","Number of spaces for indentation",{default:2}).option("--prettier","Use Prettier for output formatting if available",{default:!1}).example("dtsx generate").example("dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types").example('dtsx generate --import-order "node:,bun,@myorg/"').example("dtsx generate --dry-run --stats").example('dtsx generate --exclude "**/*.test.ts,**/__tests__/**"').example("dtsx generate --stats --output-format json").example("dtsx generate --bundle --bundle-output types.d.ts").action(async(q)=>{try{let Q=h(q.cwd||H.cwd),K=await o(Q),N={entrypoints:q.entrypoints?q.entrypoints:K.entrypoints||H.entrypoints,cwd:Q,root:h(q.root||K.root||H.root),outdir:h(q.outdir||K.outdir||H.outdir),tsconfigPath:h(q.tsconfigPath||K.tsconfigPath||H.tsconfigPath),keepComments:q.keepComments??K.keepComments??H.keepComments,clean:q.clean??K.clean??H.clean,verbose:q.verbose??K.verbose??H.verbose,importOrder:q.importOrder||K.importOrder||H.importOrder,dryRun:q.dryRun??K.dryRun??H.dryRun,stats:q.stats??K.stats??H.stats,continueOnError:q.continueOnError??K.continueOnError??H.continueOnError,logLevel:q.logLevel??K.logLevel??H.logLevel,exclude:q.exclude?q.exclude.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean)):K.exclude||H.exclude,outputFormat:q.outputFormat??K.outputFormat??H.outputFormat,progress:q.progress??K.progress??H.progress,diff:q.diff??K.diff??H.diff,validate:q.validate??K.validate??H.validate,parallel:q.parallel??K.parallel??H.parallel,concurrency:Number(q.concurrency)||K.concurrency||H.concurrency,declarationMap:q.declarationMap??K.declarationMap??!1,bundle:q.bundle??K.bundle??!1,bundleOutput:q.bundleOutput??K.bundleOutput??"index.d.ts",incremental:q.incremental??K.incremental??!1,clearCache:q.clearCache??!1,indentStyle:q.indentStyle??K.indentStyle??"spaces",indentSize:Number(q.indentSize)||K.indentSize||2,prettier:q.prettier??K.prettier??!1,plugins:K.plugins},A=await qq(N);if(A.filesFailed>0&&A.filesGenerated===0)V.exit(1);else if(A.filesFailed>0)V.exit(2)}catch(Q){console.error("Error generating .d.ts files:",Q),V.exit(1)}});k.command("watch","Watch for changes and regenerate .d.ts files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).example("dtsx watch").example("dtsx watch --root src --outdir dist/types").action(async(q)=>{try{let Q={entrypoints:q.entrypoints?q.entrypoints:H.entrypoints,cwd:h(q.cwd||H.cwd),root:h(q.root||H.root),outdir:h(q.outdir||H.outdir),keepComments:q.keepComments??H.keepComments,exclude:q.exclude?q.exclude.flatMap((K)=>K.split(",").map((N)=>N.trim()).filter(Boolean)):H.exclude,logLevel:q.logLevel??H.logLevel};await Kq(Q)}catch(Q){console.error("Error in watch mode:",Q),V.exit(1)}});k.command("stdin","Process TypeScript from stdin and output .d.ts to stdout").option("--keep-comments","Keep comments in generated .d.ts files",{default:!0}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:"bun",type:[String]}).example(`echo "export const foo: string = 'bar'" | dtsx stdin`).example("cat src/index.ts | dtsx stdin").action(async(q)=>{try{let Q=[];for await(let J of V.stdin)Q.push(J);let K=Buffer.concat(Q).toString("utf-8");if(!K.trim())console.error("Error: No input received from stdin"),V.exit(1);let N=["bun"];if(q.importOrder){if(Array.isArray(q.importOrder))N=q.importOrder.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean));else if(typeof q.importOrder==="string")N=q.importOrder.split(",").map((J)=>J.trim()).filter(Boolean)}let A=Hq(K,"stdin.ts",q.keepComments??!0,N);console.log(A)}catch(Q){console.error("Error processing stdin:",Q),V.exit(1)}});k.command("optimize","Optimize declaration files").option("--files <patterns>","Glob patterns for .d.ts files to optimize",{default:"**/*.d.ts",type:[String]}).option("--outdir <path>","Output directory (defaults to in-place)",{default:""}).option("--remove-unused-imports","Remove unused type imports",{default:!0}).option("--deduplicate","Remove duplicate declarations",{default:!0}).option("--merge-interfaces","Merge interface declarations with same name",{default:!0}).option("--inline-types","Inline simple type aliases",{default:!1}).option("--remove-empty","Remove empty interfaces",{default:!0}).option("--sort","Sort declarations alphabetically",{default:!1}).option("--sort-imports","Sort imports",{default:!0}).option("--minify","Minify output (remove whitespace)",{default:!1}).option("--remove-comments","Remove comments",{default:!1}).example('dtsx optimize --files "dist/**/*.d.ts"').example("dtsx optimize --minify --remove-comments").action(async(q)=>{try{let{optimizeFile:Q}=await import("../chunk-27nzyfdd.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N,join:A,relative:J,dirname:$,basename:z}=await import("path"),{mkdirSync:B,copyFileSync:G,existsSync:j}=await import("fs"),Z=V.cwd(),E=q.files||["**/*.d.ts"],M=[];for(let _ of E){let X=new K(_);for await(let F of X.scan({cwd:Z,absolute:!0,onlyFiles:!0}))if(F.endsWith(".d.ts")&&!F.includes("node_modules"))M.push(F)}if(M.length===0)console.error("No .d.ts files found"),V.exit(1);console.log(`Optimizing ${M.length} declaration files...`);let T=0,R=0;for(let _ of M){let X=_;if(q.outdir){let C=J(Z,_);X=A(N(q.outdir),C);let w=$(X);if(!j(w))B(w,{recursive:!0});G(_,X)}let F=await Q(X,{removeUnusedImports:q.removeUnusedImports??!0,deduplicateDeclarations:q.deduplicate??!0,mergeInterfaces:q.mergeInterfaces??!0,inlineSimpleTypes:q.inlineTypes??!1,removeEmptyInterfaces:q.removeEmpty??!0,sortDeclarations:q.sort??!1,sortImports:q.sortImports??!0,minify:q.minify??!1,removeComments:q.removeComments??!1});R+=F.originalSize,T+=F.savings;let D=J(Z,X);console.log(` ${D}: ${F.originalSize}B -> ${F.optimizedSize}B (-${F.savingsPercent}%)`)}let I=R>0?Math.round(T/R*100):0;console.log(`
6
- Total: ${R}B -> ${R-T}B (-${I}%)`)}catch(Q){console.error("Error optimizing files:",Q),V.exit(1)}});k.command("docs","Generate API documentation from source files").option("--root <path>","Root directory to scan for source files",{default:"./src"}).option("--outdir <path>","Output directory for documentation",{default:"./docs"}).option("--format <format>","Output format: markdown or html",{default:"markdown"}).option("--title <title>","Documentation title",{default:"API Documentation"}).option("--include-private","Include private members (prefixed with _)",{default:!1}).option("--include-internal","Include internal members (@internal)",{default:!1}).option("--group-by-category","Group entries by @category tag",{default:!1}).option("--source-url <url>","Base URL for source links").example("dtsx docs").example("dtsx docs --format html --outdir ./api-docs").example('dtsx docs --group-by-category --title "My API"').action(async(q)=>{try{let{generateDocs:Q}=await import("../chunk-8kz02py2.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N}=await import("path"),A=N(q.root||"./src"),J=new K("**/*.ts"),$=[];for await(let z of J.scan({cwd:A,absolute:!0,onlyFiles:!0}))if(!z.endsWith(".d.ts")&&!z.includes("node_modules"))$.push(z);if($.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Found ${$.length} source files`),await Q($,{format:q.format||"markdown",outdir:N(q.outdir||"./docs"),title:q.title||"API Documentation",includePrivate:q.includePrivate??!1,includeInternal:q.includeInternal??!1,groupByCategory:q.groupByCategory??!1,includeSourceLinks:!!q.sourceUrl,sourceBaseUrl:q.sourceUrl})}catch(Q){console.error("Error generating documentation:",Q),V.exit(1)}});k.command("workspace","Generate declarations for all projects in a monorepo/workspace").option("--cwd <path>","Workspace root directory",{default:V.cwd()}).option("--parallel","Process projects in parallel",{default:!1}).option("--continue-on-error","Continue if a project fails",{default:!0}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:"info"}).example("dtsx workspace").example("dtsx workspace --cwd /path/to/monorepo").action(async(q)=>{try{let{generateMonorepo:Q,generateFromPackageWorkspaces:K}=await import("../chunk-j1zrbs2z.js"),{existsSync:N}=await import("fs"),{join:A,resolve:J}=await import("path"),$=J(q.cwd||V.cwd()),z=A($,"tsconfig.json"),B;if(N(z))B=await Q($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});else B=await K($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});if(!B.success)V.exit(1)}catch(Q){console.error("Error generating workspace declarations:",Q),V.exit(1)}});k.command("lsp","Start the Language Server Protocol server for IDE integration").example("dtsx lsp").action(async()=>{let{startLSPServer:q}=await import("../chunk-7tyhhk7c.js");q()});k.command("check","Type check TypeScript files or validate generated declarations").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--declarations-only","Only check .d.ts files",{default:!1}).option("--tsconfig <path>","Path to tsconfig.json",{default:"tsconfig.json"}).option("--strict","Enable strict type checking",{default:!1}).option("--skip-lib-check","Skip checking library definitions",{default:!0}).option("--warnings-as-errors","Treat warnings as errors",{default:!1}).option("--max-errors <number>","Maximum errors before stopping",{default:0}).option("--isolated-declarations","Check if code follows isolated declarations best practices (recommended)",{default:!1}).option("--format <format>","Output format: text or json",{default:"text"}).example("dtsx check").example('dtsx check --files "src/**/*.ts" --strict').example('dtsx check --declarations-only --files "dist/**/*.d.ts"').example("dtsx check --isolated-declarations").action(async(q)=>{try{let{typeCheck:Q,checkIsolatedDeclarations:K,formatTypeCheckResults:N}=await import("../chunk-sw3m29sw.js"),{Glob:A}=awaitPromise.resolve(globalThis.Bun),{resolve:J,relative:$}=await import("path"),z=V.cwd(),B=q.files||["**/*.ts"],G=[];for(let Z of B){let E=new A(Z);for await(let M of E.scan({cwd:z,absolute:!0,onlyFiles:!0}))if(!M.includes("node_modules"))if(q.declarationsOnly){if(M.endsWith(".d.ts"))G.push(M)}else G.push(M)}if(G.length===0)console.error("No files found to check"),V.exit(1);if(q.isolatedDeclarations){console.log(`Checking ${G.length} files for isolated declarations best practices...`);let Z=await K(G,q.tsconfig?J(q.tsconfig):void 0),E=0,M=[];for(let[T,R]of Z){let I=$(z,T);if(!R.compatible)if(E+=R.issues.length,q.format==="json")M.push({file:I,compatible:!1,issues:R.issues});else{console.log(`
5
+ `)}V.exit(0)}var{resolve:h}=await import("path"),{CLI:s}=await import("../chunk-trm0gptj.js"),{version:e}=await import("../chunk-5hzvjjt0.js"),{getConfig:o}=await import("../chunk-w71syh0b.js"),{generate:qq,processSource:Hq,watch:Kq}=await import("../chunk-rh2bqn7v.js"),k=new s("dtsx"),H={cwd:V.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!1,tsconfigPath:"tsconfig.json",verbose:!1,importOrder:["bun"],dryRun:!1,stats:!1,continueOnError:!1,logLevel:"info",exclude:[],outputFormat:"text",progress:!1,diff:!1,validate:!1,parallel:!1,concurrency:4};k.command("generate","Generate TypeScript declaration files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--clean","Clean output directory before generation",{default:H.clean}).option("--tsconfig <path>","Path to tsconfig.json",{default:H.tsconfigPath}).option("--verbose","Enable verbose logging",{default:H.verbose}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:H.importOrder?.join(","),type:[String]}).option("--dry-run","Show what would be generated without writing files",{default:H.dryRun}).option("--stats","Show statistics after generation",{default:H.stats}).option("--continue-on-error","Continue processing other files if one fails",{default:H.continueOnError}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--output-format <format>","Output format: text or json",{default:H.outputFormat}).option("--progress","Show progress during generation",{default:H.progress}).option("--diff","Show diff of changes compared to existing files",{default:H.diff}).option("--validate","Validate generated .d.ts files against TypeScript",{default:H.validate}).option("--parallel","Process files in parallel",{default:H.parallel}).option("--concurrency <number>","Number of concurrent workers (with --parallel)",{default:H.concurrency}).option("--declaration-map","Generate declaration map files (.d.ts.map)",{default:!1}).option("--bundle","Bundle all declarations into a single output file",{default:!1}).option("--bundle-output <file>","Output filename when bundling (relative to outdir)",{default:"index.d.ts"}).option("--config <path>","Path to config file (dtsx.config.ts)",{default:""}).option("--incremental","Enable incremental builds (only regenerate changed files)",{default:!1}).option("--clear-cache","Clear the incremental build cache before generating",{default:!1}).option("--indent-style <style>","Indentation style: spaces or tabs",{default:"spaces"}).option("--indent-size <size>","Number of spaces for indentation",{default:2}).option("--prettier","Use Prettier for output formatting if available",{default:!1}).example("dtsx generate").example("dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types").example('dtsx generate --import-order "node:,bun,@myorg/"').example("dtsx generate --dry-run --stats").example('dtsx generate --exclude "**/*.test.ts,**/__tests__/**"').example("dtsx generate --stats --output-format json").example("dtsx generate --bundle --bundle-output types.d.ts").action(async(q)=>{try{let Q=h(q.cwd||H.cwd),K=await o(Q),N={entrypoints:q.entrypoints?q.entrypoints:K.entrypoints||H.entrypoints,cwd:Q,root:h(q.root||K.root||H.root),outdir:h(q.outdir||K.outdir||H.outdir),tsconfigPath:h(q.tsconfigPath||K.tsconfigPath||H.tsconfigPath),keepComments:q.keepComments??K.keepComments??H.keepComments,clean:q.clean??K.clean??H.clean,verbose:q.verbose??K.verbose??H.verbose,importOrder:q.importOrder||K.importOrder||H.importOrder,dryRun:q.dryRun??K.dryRun??H.dryRun,stats:q.stats??K.stats??H.stats,continueOnError:q.continueOnError??K.continueOnError??H.continueOnError,logLevel:q.logLevel??K.logLevel??H.logLevel,exclude:q.exclude?q.exclude.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean)):K.exclude||H.exclude,outputFormat:q.outputFormat??K.outputFormat??H.outputFormat,progress:q.progress??K.progress??H.progress,diff:q.diff??K.diff??H.diff,validate:q.validate??K.validate??H.validate,parallel:q.parallel??K.parallel??H.parallel,concurrency:Number(q.concurrency)||K.concurrency||H.concurrency,declarationMap:q.declarationMap??K.declarationMap??!1,bundle:q.bundle??K.bundle??!1,bundleOutput:q.bundleOutput??K.bundleOutput??"index.d.ts",incremental:q.incremental??K.incremental??!1,clearCache:q.clearCache??!1,indentStyle:q.indentStyle??K.indentStyle??"spaces",indentSize:Number(q.indentSize)||K.indentSize||2,prettier:q.prettier??K.prettier??!1,plugins:K.plugins},A=await qq(N);if(A.filesFailed>0&&A.filesGenerated===0)V.exit(1);else if(A.filesFailed>0)V.exit(2)}catch(Q){console.error("Error generating .d.ts files:",Q),V.exit(1)}});k.command("watch","Watch for changes and regenerate .d.ts files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).example("dtsx watch").example("dtsx watch --root src --outdir dist/types").action(async(q)=>{try{let Q={entrypoints:q.entrypoints?q.entrypoints:H.entrypoints,cwd:h(q.cwd||H.cwd),root:h(q.root||H.root),outdir:h(q.outdir||H.outdir),keepComments:q.keepComments??H.keepComments,exclude:q.exclude?q.exclude.flatMap((K)=>K.split(",").map((N)=>N.trim()).filter(Boolean)):H.exclude,logLevel:q.logLevel??H.logLevel};await Kq(Q)}catch(Q){console.error("Error in watch mode:",Q),V.exit(1)}});k.command("stdin","Process TypeScript from stdin and output .d.ts to stdout").option("--keep-comments","Keep comments in generated .d.ts files",{default:!0}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:"bun",type:[String]}).example(`echo "export const foo: string = 'bar'" | dtsx stdin`).example("cat src/index.ts | dtsx stdin").action(async(q)=>{try{let Q=[];for await(let J of V.stdin)Q.push(J);let K=Buffer.concat(Q).toString("utf-8");if(!K.trim())console.error("Error: No input received from stdin"),V.exit(1);let N=["bun"];if(q.importOrder){if(Array.isArray(q.importOrder))N=q.importOrder.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean));else if(typeof q.importOrder==="string")N=q.importOrder.split(",").map((J)=>J.trim()).filter(Boolean)}let A=Hq(K,"stdin.ts",q.keepComments??!0,N);console.log(A)}catch(Q){console.error("Error processing stdin:",Q),V.exit(1)}});k.command("optimize","Optimize declaration files").option("--files <patterns>","Glob patterns for .d.ts files to optimize",{default:"**/*.d.ts",type:[String]}).option("--outdir <path>","Output directory (defaults to in-place)",{default:""}).option("--remove-unused-imports","Remove unused type imports",{default:!0}).option("--deduplicate","Remove duplicate declarations",{default:!0}).option("--merge-interfaces","Merge interface declarations with same name",{default:!0}).option("--inline-types","Inline simple type aliases",{default:!1}).option("--remove-empty","Remove empty interfaces",{default:!0}).option("--sort","Sort declarations alphabetically",{default:!1}).option("--sort-imports","Sort imports",{default:!0}).option("--minify","Minify output (remove whitespace)",{default:!1}).option("--remove-comments","Remove comments",{default:!1}).example('dtsx optimize --files "dist/**/*.d.ts"').example("dtsx optimize --minify --remove-comments").action(async(q)=>{try{let{optimizeFile:Q}=await import("../chunk-w8d9jjsa.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N,join:A,relative:J,dirname:$,basename:z}=await import("path"),{mkdirSync:B,copyFileSync:G,existsSync:j}=await import("fs"),Z=V.cwd(),E=q.files||["**/*.d.ts"],M=[];for(let _ of E){let X=new K(_);for await(let F of X.scan({cwd:Z,absolute:!0,onlyFiles:!0}))if(F.endsWith(".d.ts")&&!F.includes("node_modules"))M.push(F)}if(M.length===0)console.error("No .d.ts files found"),V.exit(1);console.log(`Optimizing ${M.length} declaration files...`);let T=0,R=0;for(let _ of M){let X=_;if(q.outdir){let C=J(Z,_);X=A(N(q.outdir),C);let w=$(X);if(!j(w))B(w,{recursive:!0});G(_,X)}let F=await Q(X,{removeUnusedImports:q.removeUnusedImports??!0,deduplicateDeclarations:q.deduplicate??!0,mergeInterfaces:q.mergeInterfaces??!0,inlineSimpleTypes:q.inlineTypes??!1,removeEmptyInterfaces:q.removeEmpty??!0,sortDeclarations:q.sort??!1,sortImports:q.sortImports??!0,minify:q.minify??!1,removeComments:q.removeComments??!1});R+=F.originalSize,T+=F.savings;let D=J(Z,X);console.log(` ${D}: ${F.originalSize}B -> ${F.optimizedSize}B (-${F.savingsPercent}%)`)}let I=R>0?Math.round(T/R*100):0;console.log(`
6
+ Total: ${R}B -> ${R-T}B (-${I}%)`)}catch(Q){console.error("Error optimizing files:",Q),V.exit(1)}});k.command("docs","Generate API documentation from source files").option("--root <path>","Root directory to scan for source files",{default:"./src"}).option("--outdir <path>","Output directory for documentation",{default:"./docs"}).option("--format <format>","Output format: markdown or html",{default:"markdown"}).option("--title <title>","Documentation title",{default:"API Documentation"}).option("--include-private","Include private members (prefixed with _)",{default:!1}).option("--include-internal","Include internal members (@internal)",{default:!1}).option("--group-by-category","Group entries by @category tag",{default:!1}).option("--source-url <url>","Base URL for source links").example("dtsx docs").example("dtsx docs --format html --outdir ./api-docs").example('dtsx docs --group-by-category --title "My API"').action(async(q)=>{try{let{generateDocs:Q}=await import("../chunk-bsxtpwx6.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N}=await import("path"),A=N(q.root||"./src"),J=new K("**/*.ts"),$=[];for await(let z of J.scan({cwd:A,absolute:!0,onlyFiles:!0}))if(!z.endsWith(".d.ts")&&!z.includes("node_modules"))$.push(z);if($.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Found ${$.length} source files`),await Q($,{format:q.format||"markdown",outdir:N(q.outdir||"./docs"),title:q.title||"API Documentation",includePrivate:q.includePrivate??!1,includeInternal:q.includeInternal??!1,groupByCategory:q.groupByCategory??!1,includeSourceLinks:!!q.sourceUrl,sourceBaseUrl:q.sourceUrl})}catch(Q){console.error("Error generating documentation:",Q),V.exit(1)}});k.command("workspace","Generate declarations for all projects in a monorepo/workspace").option("--cwd <path>","Workspace root directory",{default:V.cwd()}).option("--parallel","Process projects in parallel",{default:!1}).option("--continue-on-error","Continue if a project fails",{default:!0}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:"info"}).example("dtsx workspace").example("dtsx workspace --cwd /path/to/monorepo").action(async(q)=>{try{let{generateMonorepo:Q,generateFromPackageWorkspaces:K}=await import("../chunk-qrht3d5g.js"),{existsSync:N}=await import("fs"),{join:A,resolve:J}=await import("path"),$=J(q.cwd||V.cwd()),z=A($,"tsconfig.json"),B;if(N(z))B=await Q($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});else B=await K($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});if(!B.success)V.exit(1)}catch(Q){console.error("Error generating workspace declarations:",Q),V.exit(1)}});k.command("lsp","Start the Language Server Protocol server for IDE integration").example("dtsx lsp").action(async()=>{let{startLSPServer:q}=await import("../chunk-pep9jyxn.js");q()});k.command("check","Type check TypeScript files or validate generated declarations").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--declarations-only","Only check .d.ts files",{default:!1}).option("--tsconfig <path>","Path to tsconfig.json",{default:"tsconfig.json"}).option("--strict","Enable strict type checking",{default:!1}).option("--skip-lib-check","Skip checking library definitions",{default:!0}).option("--warnings-as-errors","Treat warnings as errors",{default:!1}).option("--max-errors <number>","Maximum errors before stopping",{default:0}).option("--isolated-declarations","Check if code follows isolated declarations best practices (recommended)",{default:!1}).option("--format <format>","Output format: text or json",{default:"text"}).example("dtsx check").example('dtsx check --files "src/**/*.ts" --strict').example('dtsx check --declarations-only --files "dist/**/*.d.ts"').example("dtsx check --isolated-declarations").action(async(q)=>{try{let{typeCheck:Q,checkIsolatedDeclarations:K,formatTypeCheckResults:N}=await import("../chunk-sw3m29sw.js"),{Glob:A}=awaitPromise.resolve(globalThis.Bun),{resolve:J,relative:$}=await import("path"),z=V.cwd(),B=q.files||["**/*.ts"],G=[];for(let Z of B){let E=new A(Z);for await(let M of E.scan({cwd:z,absolute:!0,onlyFiles:!0}))if(!M.includes("node_modules"))if(q.declarationsOnly){if(M.endsWith(".d.ts"))G.push(M)}else G.push(M)}if(G.length===0)console.error("No files found to check"),V.exit(1);if(q.isolatedDeclarations){console.log(`Checking ${G.length} files for isolated declarations best practices...`);let Z=await K(G,q.tsconfig?J(q.tsconfig):void 0),E=0,M=[];for(let[T,R]of Z){let I=$(z,T);if(!R.compatible)if(E+=R.issues.length,q.format==="json")M.push({file:I,compatible:!1,issues:R.issues});else{console.log(`
7
7
  \u2717 ${I}`);for(let _ of R.issues)if(console.log(` ${_.line}:${_.column} - ${_.message}`),_.missingAnnotation)console.log(` Missing: ${_.missingAnnotation} type annotation`)}else if(q.format==="json")M.push({file:I,compatible:!0,issues:[]})}if(q.format==="json")console.log(JSON.stringify(M,null,2));else if(E>0)console.log(`
8
8
  ${G.length} files checked, ${E} recommendations found`),console.log("Tip: Adding explicit type annotations improves .d.ts accuracy");else console.log(`
9
- ${G.length} files checked, all follow isolated declarations best practices`);V.exit(E>0?1:0)}console.log(`Type checking ${G.length} files...`);let j=await Q(G,{tsconfigPath:q.tsconfig?J(q.tsconfig):void 0,strict:q.strict??!1,declarationsOnly:q.declarationsOnly??!1,skipLibCheck:q.skipLibCheck??!0,warningsAsErrors:q.warningsAsErrors??!1,maxErrors:q.maxErrors||void 0});if(q.format==="json")console.log(JSON.stringify(j,null,2));else console.log(N(j));V.exit(j.success?0:1)}catch(Q){console.error("Error during type checking:",Q),V.exit(1)}});k.command("convert","Convert TypeScript types to different schema formats").option("--files <patterns>","Glob patterns for TypeScript files",{default:"**/*.ts",type:[String]}).option("--format <format>","Output format: json-schema, zod, valibot, io-ts, yup, arktype",{default:"json-schema"}).option("--outdir <path>","Output directory for converted files",{default:"./schemas"}).option("--include-descriptions","Include JSDoc descriptions in output",{default:!0}).option("--all-optional","Make all properties optional",{default:!1}).option("--use-infer","Include inferred types (for Zod, Valibot, etc.)",{default:!0}).option("--json-schema-draft <version>","JSON Schema draft version: 2020-12, 2019-09, draft-07",{default:"2020-12"}).example("dtsx convert --format zod").example('dtsx convert --format json-schema --files "src/types/**/*.ts"').example("dtsx convert --format valibot --outdir ./validation").action(async(q)=>{try{let Q=await import("../chunk-xtee8g1a.js"),{extractDeclarations:K}=await import("../chunk-p50ms07x.js"),{Glob:N}=awaitPromise.resolve(globalThis.Bun),{resolve:A,relative:J,join:$,dirname:z,basename:B}=await import("path"),{mkdirSync:G,existsSync:j,readFileSync:Z,writeFileSync:E}=await import("fs"),M=V.cwd(),T=q.files||["**/*.ts"],R=q.format||"json-schema",I=A(q.outdir||"./schemas"),_=[];for(let D of T){let C=new N(D);for await(let w of C.scan({cwd:M,absolute:!0,onlyFiles:!0}))if(!w.endsWith(".d.ts")&&!w.includes("node_modules"))_.push(w)}if(_.length===0)console.error("No TypeScript files found"),V.exit(1);if(console.log(`Converting ${_.length} files to ${R} format...`),!j(I))G(I,{recursive:!0});let X=0,F=0;for(let D of _){let C=Z(D,"utf-8"),U=K(C,D).filter((d)=>d.kind==="interface"||d.kind==="type");if(U.length===0)continue;let L=Q.convertToFormat(U,{format:R,includeDescriptions:q.includeDescriptions??!0,allOptional:q.allOptional??!1,useInfer:q.useInfer??!0,jsonSchemaDraft:q.jsonSchemaDraft||"2020-12"}),a=J(M,D),l=B(D,".ts"),p=Q.getFormatExtension(R),O=$(I,z(a),`${l}${p}`),u=z(O);if(!j(u))G(u,{recursive:!0});E(O,L),X+=U.length,F++,console.log(` ${J(M,O)} (${U.length} types)`)}console.log(`
9
+ ${G.length} files checked, all follow isolated declarations best practices`);V.exit(E>0?1:0)}console.log(`Type checking ${G.length} files...`);let j=await Q(G,{tsconfigPath:q.tsconfig?J(q.tsconfig):void 0,strict:q.strict??!1,declarationsOnly:q.declarationsOnly??!1,skipLibCheck:q.skipLibCheck??!0,warningsAsErrors:q.warningsAsErrors??!1,maxErrors:q.maxErrors||void 0});if(q.format==="json")console.log(JSON.stringify(j,null,2));else console.log(N(j));V.exit(j.success?0:1)}catch(Q){console.error("Error during type checking:",Q),V.exit(1)}});k.command("convert","Convert TypeScript types to different schema formats").option("--files <patterns>","Glob patterns for TypeScript files",{default:"**/*.ts",type:[String]}).option("--format <format>","Output format: json-schema, zod, valibot, io-ts, yup, arktype",{default:"json-schema"}).option("--outdir <path>","Output directory for converted files",{default:"./schemas"}).option("--include-descriptions","Include JSDoc descriptions in output",{default:!0}).option("--all-optional","Make all properties optional",{default:!1}).option("--use-infer","Include inferred types (for Zod, Valibot, etc.)",{default:!0}).option("--json-schema-draft <version>","JSON Schema draft version: 2020-12, 2019-09, draft-07",{default:"2020-12"}).example("dtsx convert --format zod").example('dtsx convert --format json-schema --files "src/types/**/*.ts"').example("dtsx convert --format valibot --outdir ./validation").action(async(q)=>{try{let Q=await import("../chunk-xtee8g1a.js"),{extractDeclarations:K}=await import("../chunk-3zjt21t1.js"),{Glob:N}=awaitPromise.resolve(globalThis.Bun),{resolve:A,relative:J,join:$,dirname:z,basename:B}=await import("path"),{mkdirSync:G,existsSync:j,readFileSync:Z,writeFileSync:E}=await import("fs"),M=V.cwd(),T=q.files||["**/*.ts"],R=q.format||"json-schema",I=A(q.outdir||"./schemas"),_=[];for(let D of T){let C=new N(D);for await(let w of C.scan({cwd:M,absolute:!0,onlyFiles:!0}))if(!w.endsWith(".d.ts")&&!w.includes("node_modules"))_.push(w)}if(_.length===0)console.error("No TypeScript files found"),V.exit(1);if(console.log(`Converting ${_.length} files to ${R} format...`),!j(I))G(I,{recursive:!0});let X=0,F=0;for(let D of _){let C=Z(D,"utf-8"),U=K(C,D).filter((d)=>d.kind==="interface"||d.kind==="type");if(U.length===0)continue;let L=Q.convertToFormat(U,{format:R,includeDescriptions:q.includeDescriptions??!0,allOptional:q.allOptional??!1,useInfer:q.useInfer??!0,jsonSchemaDraft:q.jsonSchemaDraft||"2020-12"}),a=J(M,D),l=B(D,".ts"),p=Q.getFormatExtension(R),O=$(I,z(a),`${l}${p}`),u=z(O);if(!j(u))G(u,{recursive:!0});E(O,L),X+=U.length,F++,console.log(` ${J(M,O)} (${U.length} types)`)}console.log(`
10
10
  Converted ${X} declarations from ${F} files`)}catch(Q){console.error("Error converting files:",Q),V.exit(1)}});k.command("circular","Detect circular dependencies in TypeScript files").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--root <path>","Root directory for resolution",{default:"."}).option("--ignore <patterns>","Glob patterns to ignore (comma-separated)",{default:"",type:[String]}).option("--types-only","Only report type-level cycles",{default:!1}).option("--max-depth <number>","Maximum depth for cycle detection",{default:100}).option("--include-node-modules","Include node_modules in analysis",{default:!1}).option("--format <format>","Output format: text, json, dot",{default:"text"}).option("--summary","Show graph summary statistics",{default:!1}).example("dtsx circular").example('dtsx circular --files "src/**/*.ts"').example('dtsx circular --ignore "**/*.test.ts,**/__tests__/**"').example("dtsx circular --format dot > deps.dot").example("dtsx circular --summary").action(async(q)=>{try{let{analyzeCircularDependencies:Q,formatCircularAnalysis:K,getGraphSummary:N,exportGraphAsDot:A,exportGraphAsJson:J}=await import("../chunk-tne5n3h1.js"),{Glob:$}=awaitPromise.resolve(globalThis.Bun),{resolve:z,relative:B}=await import("path"),G=V.cwd(),j=z(q.root||"."),Z=q.files||["**/*.ts"],E=[];for(let T of Z){let R=new $(T);for await(let I of R.scan({cwd:j,absolute:!0,onlyFiles:!0}))if(!I.endsWith(".d.ts")){if(!q.includeNodeModules&&I.includes("node_modules"))continue;E.push(I)}}if(E.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Analyzing ${E.length} files for circular dependencies...`);let M=await Q(E,{rootDir:j,ignore:q.ignore?.filter(Boolean),typesOnly:q.typesOnly??!1,maxDepth:q.maxDepth??100,includeNodeModules:q.includeNodeModules??!1});if(q.format==="json")console.log(J(M.graph,j));else if(q.format==="dot")console.log(A(M.graph,j));else if(console.log(K(M,j)),q.summary){let T=N(M.graph);if(console.log(`
11
11
  --- Dependency Graph Summary ---`),console.log(`Total files: ${T.totalFiles}`),console.log(`Total dependencies: ${T.totalDependencies}`),console.log(`Average dependencies per file: ${T.avgDependencies.toFixed(2)}`),T.maxDependencies.count>0)console.log(`Most dependencies: ${B(j,T.maxDependencies.file)} (${T.maxDependencies.count})`);if(T.mostDepended.count>0)console.log(`Most depended on: ${B(j,T.mostDepended.file)} (${T.mostDepended.count} dependents)`);if(T.isolatedFiles.length>0)console.log(`Isolated files (no dependencies): ${T.isolatedFiles.length}`)}V.exit(M.hasCircular?1:0)}catch(Q){console.error("Error analyzing dependencies:",Q),V.exit(1)}});k.command("version","Show the version of dtsx").action(()=>{console.log(e)});k.version(e);k.help();k.parse();
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ec as l}from"./chunk-thhd43x5.js";import{hc as CY}from"./chunk-2n1bbm2c.js";import{lc as UJ}from"./chunk-rsv17jh8.js";import{Cc as iJ}from"./chunk-vpjw38x7.js";import{Uc as f}from"./chunk-3w5aqasc.js";import{Wc as K,Yc as r}from"./chunk-gssantc8.js";import{bd as xY,dd as AY}from"./chunk-mcdb3q06.js";var{Glob:oJ}=globalThis.Bun;import{mkdir as o}from"fs/promises";import{availableParallelism as dY}from"os";import{dirname as u,relative as v,resolve as x}from"path";import{existsSync as ZJ,mkdirSync as JY,readFileSync as YY,writeFileSync as $Y}from"fs";import{dirname as ZY,relative as QY,resolve as UY}from"path";async function TJ(J,Y,$){let Z=new Map,Q=[],U=new Set,X=0,H=0,j=0,G=[];for(let q of J){let B=Y.get(q);if(!B)continue;G.push({file:q,decls:l(B,q,$.keepComments)})}for(let{file:q,decls:B}of G){X+=B.length;for(let k of B)if(k.kind==="import"){H++;let R=k.source||"";if(R.startsWith("."))continue;if(!Z.has(R))Z.set(R,{source:R,specifiers:new Map,isTypeOnly:k.isTypeOnly||!1,isSideEffect:k.isSideEffect||!1});let L=Z.get(R);if(k.specifiers)for(let w of k.specifiers){let S=w.alias||w.name;if(!L.specifiers.has(S))L.specifiers.set(S,{name:w.name,alias:w.alias,isType:w.isType||!1})}if(!k.isTypeOnly)L.isTypeOnly=!1}else if(k.isExported||k.kind==="export"){if(j++,k.kind==="export"&&k.source&&(k.source.startsWith(".")||k.source.startsWith("/")))continue;if(k.name&&U.has(k.name))continue;if(k.name)U.add(k.name);Q.push({declaration:k,file:q})}}let z=[];z.push("/**"),z.push(" * Bundled TypeScript declarations"),z.push(` * Generated from ${J.length} source files`),z.push(" */"),z.push("");let A=$.importOrder||["bun"],N=Array.from(Z.values()),_=Array(N.length);for(let q=0;q<N.length;q++){let B=N[q].source,k=A.length;for(let R=0;R<A.length;R++)if(B.startsWith(A[R])){k=R;break}_[q]=k}let T=N.map((q,B)=>B);T.sort((q,B)=>{let k=_[q],R=_[B];if(k!==R)return k-R;return N[q].source.localeCompare(N[B].source)});let V=T.map((q)=>N[q]);for(let q of V)if(q.isSideEffect)z.push(`import '${q.source}';`);else if(q.specifiers.size>0){let k=Array.from(q.specifiers.values()).map((L)=>{let w=L.isType?"type ":"";return L.alias?`${w}${L.name} as ${L.alias}`:`${w}${L.name}`}),R=q.isTypeOnly?"type ":"";z.push(`import ${R}{ ${k.join(", ")} } from '${q.source}';`)}if(V.length>0)z.push("");let W=new Map;for(let{declaration:q,file:B}of Q){if(!W.has(B))W.set(B,[]);W.get(B).push(q)}for(let[q,B]of W){let k=QY($.cwd,q);z.push(`// From: ${k}`);for(let R of B){if($.keepComments&&R.leadingComments)for(let L of R.leadingComments)z.push(L);z.push(RJ(R))}z.push("")}let O=z.join(`
2
+ import{ec as l}from"./chunk-y581wnfe.js";import{hc as CY}from"./chunk-2n1bbm2c.js";import{lc as UJ}from"./chunk-8z31rkfp.js";import{Cc as iJ}from"./chunk-vpjw38x7.js";import{Uc as f}from"./chunk-a3txc27m.js";import{Wc as K,Yc as r}from"./chunk-gssantc8.js";import{bd as xY,dd as AY}from"./chunk-mcdb3q06.js";var{Glob:oJ}=globalThis.Bun;import{mkdir as o}from"fs/promises";import{availableParallelism as dY}from"os";import{dirname as u,relative as v,resolve as x}from"path";import{existsSync as ZJ,mkdirSync as JY,readFileSync as YY,writeFileSync as $Y}from"fs";import{dirname as ZY,relative as QY,resolve as UY}from"path";async function TJ(J,Y,$){let Z=new Map,Q=[],U=new Set,X=0,H=0,j=0,G=[];for(let q of J){let B=Y.get(q);if(!B)continue;G.push({file:q,decls:l(B,q,$.keepComments)})}for(let{file:q,decls:B}of G){X+=B.length;for(let k of B)if(k.kind==="import"){H++;let R=k.source||"";if(R.startsWith("."))continue;if(!Z.has(R))Z.set(R,{source:R,specifiers:new Map,isTypeOnly:k.isTypeOnly||!1,isSideEffect:k.isSideEffect||!1});let L=Z.get(R);if(k.specifiers)for(let w of k.specifiers){let S=w.alias||w.name;if(!L.specifiers.has(S))L.specifiers.set(S,{name:w.name,alias:w.alias,isType:w.isType||!1})}if(!k.isTypeOnly)L.isTypeOnly=!1}else if(k.isExported||k.kind==="export"){if(j++,k.kind==="export"&&k.source&&(k.source.startsWith(".")||k.source.startsWith("/")))continue;if(k.name&&U.has(k.name))continue;if(k.name)U.add(k.name);Q.push({declaration:k,file:q})}}let z=[];z.push("/**"),z.push(" * Bundled TypeScript declarations"),z.push(` * Generated from ${J.length} source files`),z.push(" */"),z.push("");let A=$.importOrder||["bun"],N=Array.from(Z.values()),_=Array(N.length);for(let q=0;q<N.length;q++){let B=N[q].source,k=A.length;for(let R=0;R<A.length;R++)if(B.startsWith(A[R])){k=R;break}_[q]=k}let T=N.map((q,B)=>B);T.sort((q,B)=>{let k=_[q],R=_[B];if(k!==R)return k-R;return N[q].source.localeCompare(N[B].source)});let V=T.map((q)=>N[q]);for(let q of V)if(q.isSideEffect)z.push(`import '${q.source}';`);else if(q.specifiers.size>0){let k=Array.from(q.specifiers.values()).map((L)=>{let w=L.isType?"type ":"";return L.alias?`${w}${L.name} as ${L.alias}`:`${w}${L.name}`}),R=q.isTypeOnly?"type ":"";z.push(`import ${R}{ ${k.join(", ")} } from '${q.source}';`)}if(V.length>0)z.push("");let W=new Map;for(let{declaration:q,file:B}of Q){if(!W.has(B))W.set(B,[]);W.get(B).push(q)}for(let[q,B]of W){let k=QY($.cwd,q);z.push(`// From: ${k}`);for(let R of B){if($.keepComments&&R.leadingComments)for(let L of R.leadingComments)z.push(L);z.push(RJ(R))}z.push("")}let O=z.join(`
3
3
  `);return{content:O,files:J,declarationCount:X,importCount:H,exportCount:j,size:Buffer.byteLength(O,"utf8"),warnings:[]}}function RJ(J){if(J.text){let $=J.text.trim();if(J.isExported&&!$.startsWith("export"))$=`export ${$}`;if(!$.endsWith(";")&&!$.endsWith("}"))$+=";";return $}let Y=[];if(J.isExported)Y.push("export");if(J.isDefault)Y.push("default");switch(J.kind){case"function":if(Y.push("declare function"),Y.push(J.name),J.generics)Y.push(J.generics);if(Y.push(`(${XY(J.parameters)})`),J.returnType)Y.push(`: ${J.returnType}`);break;case"variable":if(Y.push("declare const"),Y.push(J.name),J.typeAnnotation)Y.push(`: ${J.typeAnnotation}`);break;case"interface":if(Y.push("interface"),Y.push(J.name),J.generics)Y.push(J.generics);if(J.extends)Y.push(`extends ${J.extends}`);if(Y.push("{"),J.members)for(let $ of J.members)Y.push(` ${$.name}${$.typeAnnotation?`: ${$.typeAnnotation}`:""};`);Y.push("}");break;case"type":if(Y.push("type"),Y.push(J.name),J.generics)Y.push(J.generics);Y.push("="),Y.push(J.typeAnnotation||"unknown");break;case"class":if(Y.push("declare class"),Y.push(J.name),J.generics)Y.push(J.generics);if(J.extends)Y.push(`extends ${J.extends}`);if(J.implements&&J.implements.length>0)Y.push(`implements ${J.implements.join(", ")}`);if(Y.push("{"),J.members)for(let $ of J.members)Y.push(` ${RJ($)}`);Y.push("}");break;case"enum":if(Y.push("declare enum"),Y.push(J.name),Y.push("{"),J.members){let $=J.members.map((Z)=>Z.value!==void 0?`${Z.name} = ${Z.value}`:Z.name);Y.push(` ${$.join(`,
4
4
  `)}`)}Y.push("}");break;default:return J.text||""}return Y.join(" ")}function XY(J){if(!J||J.length===0)return"";return J.map((Y)=>{let $="";if(Y.rest)$+="...";if($+=Y.name,Y.optional)$+="?";if(Y.type)$+=`: ${Y.type}`;if(Y.defaultValue)$+=` = ${Y.defaultValue}`;return $}).join(", ")}async function LJ(J,Y={}){let $=[],Z=new Map,Q=[],U=[],X=new Set,H=0,j=0,G=0;for(let _ of J){if(!ZJ(_)){$.push(`File not found: ${_}`);continue}let T=YY(_,"utf-8");U.push(_);let V=T.split(`
5
5
  `),W=[],O=0,q=!1;for(let B of V){let k=B.trim();if(!k&&!q)continue;if(k.startsWith("import ")){j++;let L=k.match(/import\s+(type\s+)?(?:\{([^}]+)\}|(\w+)|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/);if(L){let[,w,S,M,F,D]=L;if(Y.externals?.some((C)=>D.startsWith(C))){Q.push(k);continue}if(D.startsWith("."))continue;if(!Z.has(D))Z.set(D,{source:D,specifiers:new Map,isTypeOnly:!!w,isSideEffect:!1});let p=Z.get(D);if(S){let C=S.split(",").map((e)=>e.trim());for(let e of C){let[JJ,YJ]=e.split(/\s+as\s+/).map((eJ)=>eJ.trim()),NJ=JJ.startsWith("type "),$J=NJ?JJ.replace("type ",""):JJ;p.specifiers.set(YJ||$J,{name:$J,alias:YJ!==$J?YJ:void 0,isType:NJ})}}if(!w)p.isTypeOnly=!1}continue}if(/^(export\s+)?(declare\s+)?(interface|type|class|function|const|let|var|enum|namespace|module)\s/.test(k)){if(q=!0,W=[B],O=(B.match(/\{/g)||[]).length-(B.match(/\}/g)||[]).length,O===0&&(k.endsWith(";")||!k.includes("{"))){let L=c(k);if(!X.has(L)||!Y.mergeDuplicates){if(X.add(L),Q.push(B),H++,k.startsWith("export"))G++}q=!1,W=[]}}else if(q){if(W.push(B),O+=(B.match(/\{/g)||[]).length-(B.match(/\}/g)||[]).length,O<=0){let L=W.join(`
@@ -1,24 +1,25 @@
1
1
  // @bun
2
- function y(M){return M===32||M===9||M===10||M===13}function Bj(M){return M>=65&&M<=90||M>=97&&M<=122||M===95||M===36||M>127}function W(M){return Bj(M)||M>=48&&M<=57}function hj(M){if(M.charCodeAt(0)===82&&M.startsWith("Record<"))return!0;if(M.charCodeAt(0)===65&&M.startsWith("Array<"))return!0;if(M.charCodeAt(0)===123&&M.includes("[")&&M.includes("]:"))return!0;if(M==="any"||M==="object"||M==="unknown")return!0;return!1}var qj=["public","protected","private","readonly","override"];function mj(M,jj,T=!0,l=!1){let Z=M,c=T,b=l,K=Z.length,L=[],P=new Map,x=new Set,j=0;if(j<K&&Z.charCodeAt(j)===65279)j++;function w(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 s(){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){s();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 s(),!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 Hj(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 t(){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=$,s(),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,s(),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 Jj(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(!c)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 $=w(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=w(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=w(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=n(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 R=_.charCodeAt(0);if(R===47){let v=_.charCodeAt(1);if(v===47)continue;if(v===42){if(!_.includes("*/"))F=!0;continue}}if(R===42)continue;let q=Ij(B);if(q.charCodeAt(q.length-1)===59)q=q.slice(0,-1);q=_j(q);let g=q.trim();if(!g)continue;X.push(q),Y.push(g);let D=0;while(D<q.length&&y(q.charCodeAt(D)))D++;if(g!=="{"&&g!=="}"){if(D<N)N=D}$.push(D)}else{let _=B.length;while(_>0&&(B.charCodeAt(_-1)===32||B.charCodeAt(_-1)===9||B.charCodeAt(_-1)===13))_--;if(_===0)continue;let R=_<B.length?B.slice(0,_):B;if(R.charCodeAt(R.length-1)===59)R=R.slice(0,-1);R=_j(R);let q=R.trim();if(!q)continue;X.push(R),Y.push(q);let g=0;while(g<R.length&&y(R.charCodeAt(g)))g++;if(q!=="{"&&q!=="}"){if(g<N)N=g}$.push(g)}}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 R=Math.max(0,_-V);Q[G]=" ".repeat(R)+B}}return Q.join(`
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
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 n(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 R=qj[_],q=H.indexOf(R);if(q!==-1){let g=q+R.length;if((q===0||!W(H.charCodeAt(q-1)))&&(g>=H.length||!W(H.charCodeAt(g)))){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;for(let R=0;R<G.length-1;R++){let q=G.charCodeAt(R);if(B){if(q===92){R++;continue}if(q===_)B=!1;continue}if(q===39||q===34||q===96){B=!0,_=q;continue}if(q===47&&G.charCodeAt(R+1)===47){G=G.slice(0,R).trimEnd();break}}}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]===`
14
- `))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 g=1;q++;while(q<H.length&&g>0){if(H.charCodeAt(q)===40)g++;else if(H.charCodeAt(q)===41)g--;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 g=H.slice(q.length).trim();if(g.charCodeAt(0)===58||g.charCodeAt(0)===63&&g.length>1&&g.charCodeAt(1)===58)break;H=g,X=!0;break}}let Y=-1,$=-1,F=0,N=!1,V=0;for(let q=0;q<H.length;q++){let g=H.charCodeAt(q);if(N){if(g===92){q++;continue}if(g===V)N=!1;continue}if(g===39||g===34||g===96){N=!0,V=g;continue}if(g===40||g===123||g===91||g===60)F++;else if(g===41||g===125||g===93||g===62&&!(q>0&&H.charCodeAt(q-1)===61))F--;else if(F===0){if(g===58&&Y===-1)Y=q;else if(g===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(`
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(`
15
16
  `)){let q=Q.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(q.length<=40)Q=q;else Q=Q.split(`
16
- `).map((D)=>{let v=D.trim();if(!v)return"";if(v==="{"||v==="}"||v==="["||v==="]"||v.startsWith("}")||v.startsWith("]"))return v;return` ${v}`}).join(`
17
- `)}let _=Q.endsWith("?")||B;if(Q.endsWith("?"))Q=Q.slice(0,-1).trim();let R=_&&!U?"?":"";if(U)return`...${Q}: ${G}`;return`${Q}${R}: ${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 e(){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=w(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&&t())break;j++}return w(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=e();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=n(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 R=Z.charCodeAt(j);if(R===40||R===123||R===91||R===60)_++;else if(R===41||R===125||R===93||R===62&&!S())_--;else if(_===0&&(R===59||R===44))break;else if(_===0&&R===61&&!Xj())break;if(_===0&&p())break;j++}F=w(B,j)}if(j<K&&Z.charCodeAt(j)===61)if(b&&F&&!hj(F))I();else{j++,O();let B=j,_=0,R=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)R++}else if(q===62&&_===0&&!S()){if(R>0&&(j+1>=K||Z.charCodeAt(j+1)!==61))R--}else if(_===0&&R===0&&(q===59||q===44))break;if(_===0&&R===0&&p())break;j++}if(N=w(B,j),N.endsWith(" as const")||N==="const"){if(V=!0,!F){let q=N.endsWith(" as const")?N.slice(0,-9).trim():N,g=$j(q);F=g!=="unknown"?g: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=w(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=w(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 $=w(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++}$=w(G,j)}let F;if(z("implements")){j+=10,O();let G=j,B=0;while(j<K){if(E())continue;let R=Z.charCodeAt(j);if(R===60)B++;else if(R===62&&!S())B--;else if(B===0&&R===123)break;j++}let _=w(G,j);if(_)F=_.split(",").map((R)=>R.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 _=n(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(),e(),O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;continue}O(),m(),O();let _=e()||"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 R=n(_);J.push(`${G}set ${B}${R};`)}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`{
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`{
18
19
  ${J.join(`
19
20
  `)}
20
- }`}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&&t())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 R=e();if(!R)if(F&&Y)R="AsyncGenerator<unknown, void, unknown>";else if(Y)R="Generator<unknown, void, unknown>";else if(F)R="Promise<void>";else R="void";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let q=n(_),g=Q?"?":"",D=Y?"*":"";N.push(`${H}${D}${J}${g}${B}${q}: ${R};`)}else if(G===58||G===61||G===59||G===125||G===10||G===13){let B="";if(G===58){j++,O();let q=j,g=0;while(j<K){if(E())continue;let D=Z.charCodeAt(j);if(D===40||D===123||D===91||D===60)g++;else if(D===41||D===125||D===93||D===62&&!S()){if(g===0)break;g--}else if(g===0&&(D===59||D===44))break;else if(g===0&&D===61&&!Xj())break;if(g===0&&t())break;j++}B=w(q,j)}let _="";if(j<K&&Z.charCodeAt(j)===61)if(b&&B){j++;let q=0;while(j<K){if(E())continue;let g=Z.charCodeAt(j);if(g===40||g===123||g===91)q++;else if(g===41||g===125||g===93){if(q===0&&g===125)break;q--}else if(q===0&&g===59)break;if(q===0&&t())break;j++}}else{j++,O();let q=j,g=0;while(j<K){if(E())continue;let D=Z.charCodeAt(j);if(D===40||D===123||D===91)g++;else if(D===41||D===125||D===93){if(g===0&&D===125)break;g--}else if(g===0&&D===59)break;if(g===0&&t())break;j++}_=w(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 R=Q?"?":"";N.push(`${H}${J}${R}: ${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 R=V,q=[];if(Q){let v=6;while(v<R.length&&y(R.charCodeAt(v)))v++;R=R.slice(v),q.push("public")}if(G){let v=9;while(v<R.length&&y(R.charCodeAt(v)))v++;R=R.slice(v),q.push("protected")}if(_){let v=R.indexOf("readonly ");if(v!==-1){let Uj=v+8;while(Uj<R.length&&y(R.charCodeAt(Uj)))Uj++;R=R.slice(0,v)+R.slice(Uj)}q.push("readonly")}let g=q.length>0?`${q.join(" ")} `:"",D=Lj(R);H.push(` ${g}${D};`)}}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=e();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=n(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=w(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=w(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=w(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=w(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=w(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 $=w(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`{
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`{
21
22
  ${H.join(`
22
23
  `)}
23
- }`}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=w(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=w(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=w(J,j),$=C(J);L.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,source:Jj(Y),leadingComments:$,start:J,end:j})}else if(j<K&&Z.charCodeAt(j)===42){Rj();let Y=w(J,j);L.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,source:Jj(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")&&Hj(9)){let X=o(J,!0,"namespace");L.push(X)}else if(U===109&&z("module")&&Hj(6)){let X=o(J,!0,"module");L.push(X)}else if(U===123){Nj();let X=w(J,j),Y=X.includes("export type"),$=C(J);L.push({kind:"export",name:"",text:X,isExported:!0,isTypeOnly:Y,source:Jj(X),leadingComments:$,start:J,end:j})}else if(U===42){Rj();let X=w(J,j),Y=C(J);L.push({kind:"export",name:"",text:X,isExported:!0,isTypeOnly:!1,source:Jj(X),leadingComments:Y,start:J,end:j})}else{I();let X=w(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")&&Hj(6)){let U=o(J,!1,"module");L.push(U)}else if(H===110&&z("namespace")&&Hj(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(s(),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)lj(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(M,jj){let T=0,l=M.length;while(T<l){let Z=M.charCodeAt(T);if(Z>=65&&Z<=90||Z>=97&&Z<=122||Z===95||Z===36||Z>127){let c=T;T++;while(T<l){let b=M.charCodeAt(T);if(b>=65&&b<=90||b>=97&&b<=122||b>=48&&b<=57||b===95||b===36||b>127)T++;else break}jj.add(M.substring(c,T))}else T++}}function lj(M,jj){let T=new Set,l=new Set;for(let b of M)l.add(b.name);let Z=new Set,c=[];for(let b=0;b<M.length;b++)if(M[b].kind!=="import")c.push(M[b].text),vj(M[b].text,Z);for(;;){let b=[];for(let[P,x]of jj){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<M.length;P++){let x=M[P].start??1/0;while(L<b.length&&(b[L].start??1/0)<=x)K.push(b[L++]);K.push(M[P])}while(L<b.length)K.push(b[L++]);M.length=0;for(let P=0;P<K.length;P++)M.push(K[P]);for(let P of b)if(P.kind!=="import")c.push(P.text),vj(P.text,Z)}}
24
- export{mj as oc};
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 +1,2 @@
1
1
  // @bun
2
- import{$b as G,Ab as e,Bb as g,Cb as h,Db as i,Eb as j,Fb as k,Gb as l,Hb as m,Ib as n,Jb as o,Kb as p,Lb as q,Mb as r,Nb as s,Ob as t,Pb as u,Qb as v,Rb as w,Sb as x,Tb as y,Ub as z,Vb as A,Wb as B,Xb as C,Yb as D,Zb as E,_b as F,ac as H,bc as I,cc as J,dc as K,ec as L,fc as M,gc as N,wb as a,xb as b,yb as c,zb as d}from"./chunk-thhd43x5.js";import"./chunk-2n1bbm2c.js";import"./chunk-rsv17jh8.js";import"./chunk-d1xj2pjv.js";import{Oc as f}from"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{d as shouldUseAsyncParsing,m as shouldIncludeNonExportedInterface,l as shouldIncludeNonExportedFunction,n as isBuiltInType,j as hasExportModifier,k as hasAsyncModifier,a as getSourceFileCacheSize,b as getSourceFileAsync,e as getPendingParseCount,i as getParameterName,g as getNodeText,s as getInterfaceBody,I as findReferencedTypes,C as extractVariableStatement,o as extractTypesFromModuleText,E as extractTypeAliasDeclaration,f as extractTripleSlashDirectives,J as extractReferencedTypeDeclarations,H as extractModuleDeclaration,h as extractJSDocComments,D as extractInterfaceDeclaration,y as extractImportDeclaration,B as extractFunctionDeclaration,z as extractExportDeclaration,A as extractExportAssignment,G as extractEnumDeclaration,M as extractDeclarationsAsync,L as extractDeclarations,F as extractClassDeclaration,K as clearSourceFileCache,q as buildVariableDeclaration,t as buildTypeDeclaration,w as buildModuleDeclaration,x as buildModuleBody,r as buildInterfaceDeclaration,p as buildFunctionSignature,u as buildClassDeclaration,v as buildClassBody,c as batchParseSourceFiles,N as batchExtractDeclarations};
2
+ import{$b as G,Ab as e,Bb as g,Cb as h,Db as i,Eb as j,Fb as k,Gb as l,Hb as m,Ib as n,Jb as o,Kb as p,Lb as q,Mb as r,Nb as s,Ob as t,Pb as u,Qb as v,Rb as w,Sb as x,Tb as y,Ub as z,Vb as A,Wb as B,Xb as C,Yb as D,Zb as E,_b as F,ac as H,bc as I,cc as J,dc as K,ec as L,fc as M,gc as N,wb as a,xb as b,yb as c,zb as d}from"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import{Oc as f}from"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{d as shouldUseAsyncParsing,m as shouldIncludeNonExportedInterface,l as shouldIncludeNonExportedFunction,n as isBuiltInType,j as hasExportModifier,k as hasAsyncModifier,a as getSourceFileCacheSize,b as getSourceFileAsync,e as getPendingParseCount,i as getParameterName,g as getNodeText,s as getInterfaceBody,I as findReferencedTypes,C as extractVariableStatement,o as extractTypesFromModuleText,E as extractTypeAliasDeclaration,f as extractTripleSlashDirectives,J as extractReferencedTypeDeclarations,H as extractModuleDeclaration,h as extractJSDocComments,D as extractInterfaceDeclaration,y as extractImportDeclaration,B as extractFunctionDeclaration,z as extractExportDeclaration,A as extractExportAssignment,G as extractEnumDeclaration,M as extractDeclarationsAsync,L as extractDeclarations,F as extractClassDeclaration,K as clearSourceFileCache,q as buildVariableDeclaration,t as buildTypeDeclaration,w as buildModuleDeclaration,x as buildModuleBody,r as buildInterfaceDeclaration,p as buildFunctionSignature,u as buildClassDeclaration,v as buildClassBody,c as batchParseSourceFiles,N as batchExtractDeclarations};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{lc as F,mc as L}from"./chunk-rsv17jh8.js";import{oc as I}from"./chunk-d1xj2pjv.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-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)}
3
3
  export{U as ic,b as jc,H as kc};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"./chunk-mcdb3q06.js";var e="@stacksjs/dtsx",i="module",n="0.9.14",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.15",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};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{ec as _}from"./chunk-thhd43x5.js";import{existsSync as w,readFileSync as U,writeFileSync as q}from"fs";function Z(G){let j=[],J=/\b([A-Z][a-zA-Z0-9]*)\b/g,L;while((L=J.exec(G))!==null){let K=L[1];if(!N(K))j.push(K)}return[...new Set(j)]}function N(G){return new Set(["Array","Object","String","Number","Boolean","Symbol","BigInt","Function","Promise","Map","Set","WeakMap","WeakSet","Date","RegExp","Error","TypeError","RangeError","SyntaxError","Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer","Generator","AsyncGenerator","IterableIterator","AsyncIterableIterator","PropertyKey","Iterable","AsyncIterable","ArrayLike","PromiseLike","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]).has(G)}function C(G){if(G.kind!=="type")return!1;let j=G.typeAnnotation||"";if(G.generics)return!1;if(j.includes("{")||j.includes("(")||j.includes("<"))return!1;return/^[\w\s|&]+$/.test(j)}function E(G){if(G.kind!=="interface")return!1;if(!G.members||G.members.length===0){if(!G.extends)return!0}return!1}function D(G,j){let J={...G,members:[...G.members||[],...j.members||[]],leadingComments:[...G.leadingComments||[],...j.leadingComments||[]]};if(G.extends&&j.extends){let L=G.extends.split(",").map((H)=>H.trim()),K=j.extends.split(",").map((H)=>H.trim());J.extends=[...new Set([...L,...K])].join(", ")}else J.extends=G.extends||j.extends;return J}function F(G){let j={import:0,interface:1,type:2,class:3,enum:4,function:5,variable:6,export:7};return[...G].sort((J,L)=>{let K=j[J.kind]??99,H=j[L.kind]??99;if(K!==H)return K-H;return J.name.localeCompare(L.name)})}function k(G){let j=[],J=[];for(let K=0;K<G.length;K++){let H=G[K];if(H.kind==="import")j.push(H);else J.push(H)}return[...[...j].sort((K,H)=>{let M=K.source||"",O=H.source||"",Q=M.startsWith("node:")||M==="bun",V=O.startsWith("node:")||O==="bun";if(Q&&!V)return-1;if(!Q&&V)return 1;let X=!M.startsWith("."),W=!O.startsWith(".");if(X&&!W)return-1;if(!X&&W)return 1;return M.localeCompare(O)}),...J]}function R(G){let j=new Set;for(let K of G){if(K.kind==="import")continue;let H=K.text||"",M=K.typeAnnotation||"",O=K.returnType||"",Q=K.extends||"",V=K.implements?.join(" ")||"",X=`${H} ${M} ${O} ${Q} ${V}`;for(let W of Z(X))j.add(W);if(K.members)for(let W of K.members){let Y=`${W.typeAnnotation||""} ${W.returnType||""}`;for(let $ of Z(Y))j.add($)}if(K.parameters){for(let W of K.parameters)if(W.type)for(let Y of Z(W.type))j.add(Y)}}let J=0;return{declarations:G.map((K)=>{if(K.kind!=="import"||!K.specifiers)return K;let H=K.specifiers.filter((M)=>{let O=M.alias||M.name;return j.has(O)});if(H.length===0){if(!K.isSideEffect)return J++,null}if(H.length<(K.specifiers?.length||0))return J+=(K.specifiers?.length||0)-H.length,{...K,specifiers:H};return K}).filter((K)=>K!==null),removed:J}}function A(G){let j=new Map,J=0;for(let L of G){if(L.kind==="import"){let H=`import:${L.source}`;if(j.has(H)){let M=j.get(H),O=[...M.specifiers||[],...L.specifiers||[]],Q=Array.from(new Map(O.map((V)=>[V.alias||V.name,V])).values());j.set(H,{...M,specifiers:Q}),J++}else j.set(H,L);continue}let K=`${L.kind}:${L.name}`;if(j.has(K))J++;else j.set(K,L)}return{declarations:Array.from(j.values()),removed:J}}function z(G){let j=new Map,J=[];for(let H of G)if(H.kind==="interface"){let M=H.name;if(!j.has(M))j.set(M,[]);j.get(M).push(H)}else J.push(H);let L=0,K=[];for(let[H,M]of j)if(M.length>1){let O=M[0];for(let Q=1;Q<M.length;Q++)O=D(O,M[Q]),L++;K.push(O)}else K.push(M[0]);return{declarations:[...J,...K],merged:L}}function P(G){let j=new Map,J=new Set;for(let H of G)if(C(H))j.set(H.name,H.typeAnnotation||""),J.add(H.name);if(j.size===0)return{declarations:G,inlined:0};function L(H){let M=H;for(let[O,Q]of j){let V=new RegExp(`\\b${O}\\b`,"g");M=M.replace(V,Q)}return M}return{declarations:G.filter((H)=>H.kind!=="type"||!J.has(H.name)).map((H)=>{if(H.typeAnnotation)H={...H,typeAnnotation:L(H.typeAnnotation)};if(H.returnType)H={...H,returnType:L(H.returnType)};if(H.extends)H={...H,extends:L(H.extends)};return H}),inlined:j.size}}function v(G){let j=G.length,J=G.filter((L)=>!E(L));return{declarations:J,removed:j-J.length}}function B(G,j={}){let J=[...G],L={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(j.removeUnusedImports){let{declarations:K,removed:H}=R(J);J=K,L.removedImports=H}if(j.deduplicateDeclarations){let{declarations:K,removed:H}=A(J);J=K,L.removedDeclarations+=H}if(j.mergeInterfaces){let{declarations:K,merged:H}=z(J);J=K,L.mergedInterfaces=H}if(j.removeEmptyInterfaces){let{declarations:K,removed:H}=v(J);J=K,L.removedDeclarations+=H}if(j.inlineSimpleTypes){let{declarations:K,inlined:H}=P(J);J=K,L.inlinedTypes=H}if(j.sortImports)J=k(J);if(j.sortDeclarations)J=F(J);return{declarations:J,result:L}}async function g(G,j={}){if(!w(G))throw Error(`File not found: ${G}`);let J=U(G,"utf-8"),L=Buffer.byteLength(J,"utf-8"),K=_(J,G,!j.removeComments),{declarations:H,result:M}=B(K,j),O=h(H,j);if(j.minify)O=x(O);let Q=Buffer.byteLength(O,"utf-8");return M.originalSize=L,M.optimizedSize=Q,M.savings=L-Q,M.savingsPercent=Math.round(M.savings/L*100),q(G,O),M}function h(G,j){let J=[];for(let L of G){if(!j.removeComments&&L.leadingComments)for(let K of L.leadingComments)J.push(K);if(L.text)J.push(L.text);else J.push(S(L));J.push("")}return J.join(`
2
+ import{ec as _}from"./chunk-y581wnfe.js";import{existsSync as w,readFileSync as U,writeFileSync as q}from"fs";function Z(G){let j=[],J=/\b([A-Z][a-zA-Z0-9]*)\b/g,L;while((L=J.exec(G))!==null){let K=L[1];if(!N(K))j.push(K)}return[...new Set(j)]}function N(G){return new Set(["Array","Object","String","Number","Boolean","Symbol","BigInt","Function","Promise","Map","Set","WeakMap","WeakSet","Date","RegExp","Error","TypeError","RangeError","SyntaxError","Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer","Generator","AsyncGenerator","IterableIterator","AsyncIterableIterator","PropertyKey","Iterable","AsyncIterable","ArrayLike","PromiseLike","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]).has(G)}function C(G){if(G.kind!=="type")return!1;let j=G.typeAnnotation||"";if(G.generics)return!1;if(j.includes("{")||j.includes("(")||j.includes("<"))return!1;return/^[\w\s|&]+$/.test(j)}function E(G){if(G.kind!=="interface")return!1;if(!G.members||G.members.length===0){if(!G.extends)return!0}return!1}function D(G,j){let J={...G,members:[...G.members||[],...j.members||[]],leadingComments:[...G.leadingComments||[],...j.leadingComments||[]]};if(G.extends&&j.extends){let L=G.extends.split(",").map((H)=>H.trim()),K=j.extends.split(",").map((H)=>H.trim());J.extends=[...new Set([...L,...K])].join(", ")}else J.extends=G.extends||j.extends;return J}function F(G){let j={import:0,interface:1,type:2,class:3,enum:4,function:5,variable:6,export:7};return[...G].sort((J,L)=>{let K=j[J.kind]??99,H=j[L.kind]??99;if(K!==H)return K-H;return J.name.localeCompare(L.name)})}function k(G){let j=[],J=[];for(let K=0;K<G.length;K++){let H=G[K];if(H.kind==="import")j.push(H);else J.push(H)}return[...[...j].sort((K,H)=>{let M=K.source||"",O=H.source||"",Q=M.startsWith("node:")||M==="bun",V=O.startsWith("node:")||O==="bun";if(Q&&!V)return-1;if(!Q&&V)return 1;let X=!M.startsWith("."),W=!O.startsWith(".");if(X&&!W)return-1;if(!X&&W)return 1;return M.localeCompare(O)}),...J]}function R(G){let j=new Set;for(let K of G){if(K.kind==="import")continue;let H=K.text||"",M=K.typeAnnotation||"",O=K.returnType||"",Q=K.extends||"",V=K.implements?.join(" ")||"",X=`${H} ${M} ${O} ${Q} ${V}`;for(let W of Z(X))j.add(W);if(K.members)for(let W of K.members){let Y=`${W.typeAnnotation||""} ${W.returnType||""}`;for(let $ of Z(Y))j.add($)}if(K.parameters){for(let W of K.parameters)if(W.type)for(let Y of Z(W.type))j.add(Y)}}let J=0;return{declarations:G.map((K)=>{if(K.kind!=="import"||!K.specifiers)return K;let H=K.specifiers.filter((M)=>{let O=M.alias||M.name;return j.has(O)});if(H.length===0){if(!K.isSideEffect)return J++,null}if(H.length<(K.specifiers?.length||0))return J+=(K.specifiers?.length||0)-H.length,{...K,specifiers:H};return K}).filter((K)=>K!==null),removed:J}}function A(G){let j=new Map,J=0;for(let L of G){if(L.kind==="import"){let H=`import:${L.source}`;if(j.has(H)){let M=j.get(H),O=[...M.specifiers||[],...L.specifiers||[]],Q=Array.from(new Map(O.map((V)=>[V.alias||V.name,V])).values());j.set(H,{...M,specifiers:Q}),J++}else j.set(H,L);continue}let K=`${L.kind}:${L.name}`;if(j.has(K))J++;else j.set(K,L)}return{declarations:Array.from(j.values()),removed:J}}function z(G){let j=new Map,J=[];for(let H of G)if(H.kind==="interface"){let M=H.name;if(!j.has(M))j.set(M,[]);j.get(M).push(H)}else J.push(H);let L=0,K=[];for(let[H,M]of j)if(M.length>1){let O=M[0];for(let Q=1;Q<M.length;Q++)O=D(O,M[Q]),L++;K.push(O)}else K.push(M[0]);return{declarations:[...J,...K],merged:L}}function P(G){let j=new Map,J=new Set;for(let H of G)if(C(H))j.set(H.name,H.typeAnnotation||""),J.add(H.name);if(j.size===0)return{declarations:G,inlined:0};function L(H){let M=H;for(let[O,Q]of j){let V=new RegExp(`\\b${O}\\b`,"g");M=M.replace(V,Q)}return M}return{declarations:G.filter((H)=>H.kind!=="type"||!J.has(H.name)).map((H)=>{if(H.typeAnnotation)H={...H,typeAnnotation:L(H.typeAnnotation)};if(H.returnType)H={...H,returnType:L(H.returnType)};if(H.extends)H={...H,extends:L(H.extends)};return H}),inlined:j.size}}function v(G){let j=G.length,J=G.filter((L)=>!E(L));return{declarations:J,removed:j-J.length}}function B(G,j={}){let J=[...G],L={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(j.removeUnusedImports){let{declarations:K,removed:H}=R(J);J=K,L.removedImports=H}if(j.deduplicateDeclarations){let{declarations:K,removed:H}=A(J);J=K,L.removedDeclarations+=H}if(j.mergeInterfaces){let{declarations:K,merged:H}=z(J);J=K,L.mergedInterfaces=H}if(j.removeEmptyInterfaces){let{declarations:K,removed:H}=v(J);J=K,L.removedDeclarations+=H}if(j.inlineSimpleTypes){let{declarations:K,inlined:H}=P(J);J=K,L.inlinedTypes=H}if(j.sortImports)J=k(J);if(j.sortDeclarations)J=F(J);return{declarations:J,result:L}}async function g(G,j={}){if(!w(G))throw Error(`File not found: ${G}`);let J=U(G,"utf-8"),L=Buffer.byteLength(J,"utf-8"),K=_(J,G,!j.removeComments),{declarations:H,result:M}=B(K,j),O=h(H,j);if(j.minify)O=x(O);let Q=Buffer.byteLength(O,"utf-8");return M.originalSize=L,M.optimizedSize=Q,M.savings=L-Q,M.savingsPercent=Math.round(M.savings/L*100),q(G,O),M}function h(G,j){let J=[];for(let L of G){if(!j.removeComments&&L.leadingComments)for(let K of L.leadingComments)J.push(K);if(L.text)J.push(L.text);else J.push(S(L));J.push("")}return J.join(`
3
3
  `)}function S(G){let j=[];if(G.isExported)j.push("export");if(G.isDefault)j.push("default");switch(G.kind){case"import":if(G.isTypeOnly)j.push("import type");else j.push("import");if(G.specifiers&&G.specifiers.length>0){let J=G.specifiers.map((L)=>{let K=L.isType?"type ":"";return L.alias?`${K}${L.name} as ${L.alias}`:`${K}${L.name}`}).join(", ");j.push(`{ ${J} }`)}j.push("from"),j.push(`'${G.source}'`);break;case"function":if(j.push("declare function"),j.push(G.name),G.generics)j.push(G.generics);if(j.push(`(${I(G.parameters)})`),G.returnType)j.push(`: ${G.returnType}`);break;case"variable":if(j.push("declare const"),j.push(G.name),G.typeAnnotation)j.push(`: ${G.typeAnnotation}`);break;case"interface":if(j.push("interface"),j.push(G.name),G.generics)j.push(G.generics);if(G.extends)j.push(`extends ${G.extends}`);if(j.push("{"),G.members)for(let J of G.members)j.push(` ${J.name}${J.typeAnnotation?`: ${J.typeAnnotation}`:""}`);j.push("}");break;case"type":if(j.push("type"),j.push(G.name),G.generics)j.push(G.generics);j.push("="),j.push(G.typeAnnotation||"unknown");break;case"class":if(j.push("declare class"),j.push(G.name),G.generics)j.push(G.generics);if(G.extends)j.push(`extends ${G.extends}`);if(G.implements?.length)j.push(`implements ${G.implements.join(", ")}`);j.push("{ }");break;case"enum":j.push("declare enum"),j.push(G.name),j.push("{ }");break;default:return G.text||""}return j.join(" ")}function I(G){if(!G)return"";return G.map((j)=>{let J="";if(j.rest)J+="...";if(J+=j.name,j.optional)J+="?";if(j.type)J+=`: ${j.type}`;return J}).join(", ")}function x(G){return G.replace(/(?<!\/\*\*)\/\/[^\n]*/g,"").replace(/^\s*[\r\n]/gm,"").replace(/ {2,}/g," ").replace(/\s*([{}[\]();,:])\s*/g,"$1").replace(/(\w)(\{)/g,"$1 $2").replace(/(\})([a-z])/gi,"$1 $2").replace(/(export|import|type|interface|class|function|const|let|var|extends|implements|declare)\s*/g,"$1 ").trim()}
4
4
  export{B as a,g as b,x as c};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ic as a,jc as b,kc as c}from"./chunk-x4v9kajr.js";import"./chunk-rsv17jh8.js";import"./chunk-d1xj2pjv.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{c as processSourceDirect,a as processSource,b as clearResultCache};
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,3 +1,3 @@
1
1
  // @bun
2
- import{tb as K}from"./chunk-dzgms5s6.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-14gh6ezz.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{oc as J}from"./chunk-d1xj2pjv.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-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()}
3
3
  export{z as lc,$ as mc,v as nc};
@@ -8,7 +8,7 @@ import{Wc as UX}from"./chunk-gssantc8.js";import{dd as d}from"./chunk-mcdb3q06.j
8
8
  `),U=Math.max(...W.map((z)=>z.length))+2,A=`\u250C${"\u2500".repeat(U)}\u2510`,q=`\u2514${"\u2500".repeat(U)}\u2518`,G=W.map((z)=>{return this.formatConsoleMessage({timestamp:Y,message:R.cyan(z),showTimestamp:!1})});console.error(this.formatConsoleMessage({timestamp:Y,message:R.cyan(A),showTimestamp:!1})),G.forEach((z)=>console.error(z)),console.error(this.formatConsoleMessage({timestamp:Y,message:R.cyan(q),showTimestamp:!1}))}else if(!j())console.error(`${Z} ${this.environment}.INFO: [BOX] ${J}`);let H=`${Z} ${this.environment}.INFO: [BOX] ${J}
9
9
  `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(H)}async prompt(Q){if(j())return Promise.resolve(!0);return new Promise((X)=>{console.error(`${R.cyan("?")} ${Q} (y/n) `);let Y=(Z)=>{let $=Z.toString().trim().toLowerCase();B.stdin.removeListener("data",Y);try{if(typeof B.stdin.setRawMode==="function")B.stdin.setRawMode(!1)}catch{}B.stdin.pause(),console.error(""),X($==="y"||$==="yes")};try{if(typeof B.stdin.setRawMode==="function")B.stdin.setRawMode(!0)}catch{}B.stdin.resume(),B.stdin.once("data",Y)})}setFancy(Q){this.fancy=Q}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(Q,...X){if(!this.enabled)return;let Y=Q;if(X&&X.length>0){let U=/%([sdijfo%])/g,A=0;if(Y=Q.replace(U,(q,G)=>{if(G==="%")return"%";if(A>=X.length)return q;let z=X[A++];switch(G){case"s":return String(z);case"d":case"i":return Number(z).toString();case"j":case"o":return JSON.stringify(z,null,2);default:return q}}),A<X.length)Y+=` ${X.slice(A).map((q)=>typeof q==="object"?JSON.stringify(q,null,2):String(q)).join(" ")}`}let{consoleText:Z,fileText:$}=this.buildOutputTexts(Y);if(this.shouldStyleConsole()){let U=this.options.showTags!==!1&&this.name?R.gray(this.formatTag(this.name)):"",A=this.options.showIcons===!1?"":`${R.blue("\u25D0")} `;console.error(`${A}${U} ${R.cyan(Z)}`)}let W=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${$}
10
10
  `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(W)}renderProgressBar(Q,X=!1){if(!this.enabled||!this.shouldStyleConsole()||!B.stdout.isTTY)return;let Y=Math.min(100,Math.max(0,Math.round(Q.current/Q.total*100))),Z=Math.round(Q.barLength*Y/100),$=Q.barLength-Z,J=R.green("\u2501".repeat(Z)),H=R.gray("\u2501".repeat($)),W=`[${J}${H}]`,U=`${Y}%`.padStart(4),A=Q.message?` ${Q.message}`:"",q=this.options.showIcons===!1?"":X||Y===100?R.green("\u2713"):R.blue("\u25B6"),G=this.options.showTags!==!1&&this.name?` ${R.gray(this.formatTag(this.name))}`:"",z=`\r${q}${G} ${W} ${U}${A}`,_=B.stdout.columns||80,D=" ".repeat(Math.max(0,_-z.replace(this.ANSI_PATTERN,"").length));if(Q.lastRenderedLine=`${z}${D}`,B.stdout.write(Q.lastRenderedLine),X)B.stdout.write(`
11
- `)}finishProgressBar(Q,X){if(!this.enabled||!this.fancy||j()||!B.stdout.isTTY){this.activeProgressBar=null;return}if(Q.current<Q.total)Q.current=Q.total;if(X)Q.message=X;this.renderProgressBar(Q,!0),this.activeProgressBar=null}async clear(Q={}){if(j()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let X=await n(this.config.logDirectory),Y=[];for(let Z of X){if(!(Q.name?new RegExp(Q.name.replace("*",".*")).test(Z):Z.startsWith(this.name))||!Z.endsWith(".log"))continue;let J=k(this.config.logDirectory,Z);if(Q.before)try{if((await C(J)).mtime>=Q.before)continue}catch(H){console.error(`Failed to get stats for file ${J}:`,H);continue}Y.push(J)}if(Y.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${Y.length} log file(s)...`);for(let Z of Y)try{await i(Z),console.warn(`Deleted log file: ${Z}`)}catch($){console.error(`Failed to delete log file ${Z}:`,$)}console.warn("Log clearing process finished.")}catch(X){console.error("Error during log clearing process:",X)}}}var vQ,WQ,h,CX,w,R,kX,dQ,xX,hQ,PX,bX,AQ,yX,fQ,mQ,vX,qQ,dX,hX,fX,mX,pX,t,nQ,gX,uX=O(()=>{vQ=r.env.CLARITY_LOG_DIR||jX(TX(),"logs"),WQ={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:vQ,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},h={...WQ},CX=(async()=>{try{let{loadConfig:Q}=await Promise.resolve().then(()=>(HX(),JX)),X=await Q({name:"clarity",alias:"logging",defaultConfig:WQ,cwd:r.cwd()});if(X)Object.assign(h,X)}catch{}return h})(),w={red:(Q)=>`\x1B[31m${Q}\x1B[0m`,green:(Q)=>`\x1B[32m${Q}\x1B[0m`,yellow:(Q)=>`\x1B[33m${Q}\x1B[0m`,blue:(Q)=>`\x1B[34m${Q}\x1B[0m`,magenta:(Q)=>`\x1B[35m${Q}\x1B[0m`,cyan:(Q)=>`\x1B[36m${Q}\x1B[0m`,white:(Q)=>`\x1B[37m${Q}\x1B[0m`,gray:(Q)=>`\x1B[90m${Q}\x1B[0m`,bgRed:(Q)=>`\x1B[41m${Q}\x1B[0m`,bgYellow:(Q)=>`\x1B[43m${Q}\x1B[0m`,bgGray:(Q)=>`\x1B[100m${Q}\x1B[0m`,bold:(Q)=>`\x1B[1m${Q}\x1B[0m`,dim:(Q)=>`\x1B[2m${Q}\x1B[0m`,italic:(Q)=>`\x1B[3m${Q}\x1B[0m`,underline:(Q)=>`\x1B[4m${Q}\x1B[0m`,strikethrough:(Q)=>`\x1B[9m${Q}\x1B[0m`,reset:"\x1B[0m"},R=w,kX=w.red,dQ=w.green,xX=w.yellow,hQ=w.blue,PX=w.magenta,bX=w.cyan,AQ=w.white,yX=w.gray,fQ=w.bgRed,mQ=w.bgYellow,vX=w.bgGray,qQ=w.bold,dX=w.dim,hX=w.italic,fX=w.underline,mX=w.strikethrough,pX=w.reset,t={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},nQ={debug:"\uD83D\uDD0D",info:hQ("\u2139"),success:dQ("\u2713"),warning:mQ(AQ(qQ(" WARN "))),error:fQ(AQ(qQ(" ERROR ")))},gX=new QQ("stacks")}),cX="0.15.8",lX=()=>{};async function iQ(Q,X={}){let{maxRetries:Y=3,retryDelay:Z=1000,isRetryable:$=()=>!0,fallback:J}=X,H=Error("Unknown error occurred");for(let W=0;W<=Y;W++)try{return await Q()}catch(U){if(H=U instanceof Error?U:Error(String(U)),W===Y||!$(H))break;if(Z>0)await new Promise((A)=>setTimeout(A,Z))}if(J!==void 0)return J;throw H instanceof Error?H:Error(`Unknown error: ${String(H)}`)}function sQ(Q){return Q instanceof L}function nX(Q){return Q instanceof a}function iX(Q){if(sQ(Q))return Q.code==="FILE_SYSTEM_ERROR"||Q.code==="BROWSER_CONFIG_ERROR";return["ENOENT","EACCES","EMFILE","ENFILE","EBUSY","network","timeout","connection"].some((Y)=>Q.message.toLowerCase().includes(Y.toLowerCase()))}var L,a,f,_Q,BQ,e,RQ,IQ,m,jQ,wQ,T,y=O(()=>{L=class extends Error{timestamp;context;constructor(X,Y={}){super(X);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=Y,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let X=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([Y,Z])=>`${Y}: ${Z}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${X}`}},a=class extends L{code="CONFIG_NOT_FOUND";constructor(X,Y,Z){let $=Z===void 0?[]:Array.isArray(Z)?Z.filter(Boolean):[Z],J="";if($.length===1)J=` or alias "${$[0]}"`;else if($.length>1)J=` or aliases ${$.map((H)=>`"${H}"`).join(", ")}`;super(`Configuration "${X}"${J} not found`,{configName:X,alias:Z,searchPaths:Y,searchPathCount:Y.length})}},f=class extends L{code="CONFIG_LOAD_ERROR";constructor(X,Y,Z){super(`Failed to load configuration from "${X}": ${Y.message}`,{configPath:X,configName:Z,originalError:Y.name,originalMessage:Y.message});this.cause=Y}},_Q=class extends L{code="CONFIG_VALIDATION_ERROR";constructor(X,Y,Z){super(`Configuration validation failed for "${X}"`,{configPath:X,configName:Z,validationErrors:Y,errorCount:Y.length})}},BQ=class extends L{code="CONFIG_MERGE_ERROR";constructor(X,Y,Z,$){super(`Failed to merge configuration from "${X}" with "${Y}": ${Z.message}`,{sourcePath:X,targetPath:Y,configName:$,originalError:Z.name,originalMessage:Z.message});this.cause=Z}},e=class extends L{code="ENV_VAR_ERROR";constructor(X,Y,Z,$){super(`Failed to parse environment variable "${X}" with value "${Y}" as ${Z}`,{envKey:X,envValue:Y,expectedType:Z,configName:$})}},RQ=class extends L{code="FILE_SYSTEM_ERROR";constructor(X,Y,Z){super(`File system ${X} failed for "${Y}": ${Z.message}`,{operation:X,path:Y,originalError:Z.name,originalMessage:Z.message});this.cause=Z}},IQ=class extends L{code="TYPE_GENERATION_ERROR";constructor(X,Y,Z){super(`Failed to generate types from "${X}" to "${Y}": ${Z.message}`,{configDir:X,outputPath:Y,originalError:Z.name,originalMessage:Z.message});this.cause=Z}},m=class extends L{code="SCHEMA_VALIDATION_ERROR";constructor(X,Y,Z){super(`Schema validation failed${Z?` for config "${Z}"`:""}`,{schemaPath:X,configName:Z,validationErrors:Y,errorCount:Y.length})}},jQ=class extends L{code="BROWSER_CONFIG_ERROR";constructor(X,Y,Z,$){super(`Failed to fetch configuration from "${X}": ${Y} ${Z}`,{endpoint:X,status:Y,statusText:Z,configName:$})}},wQ=class extends L{code="PLUGIN_ERROR";constructor(X,Y,Z){super(`Plugin "${X}" failed during ${Y}: ${Z.message}`,{pluginName:X,operation:Y,originalError:Z.name,originalMessage:Z.message});this.cause=Z}},T={configNotFound(Q,X,Y){return new a(Q,X,Y)},configLoad(Q,X,Y){return new f(Q,X,Y)},configValidation(Q,X,Y){return new _Q(Q,X,Y)},configMerge(Q,X,Y,Z){return new BQ(Q,X,Y,Z)},envVar(Q,X,Y,Z){return new e(Q,X,Y,Z)},fileSystem(Q,X,Y){return new RQ(Q,X,Y)},typeGeneration(Q,X,Y){return new IQ(Q,X,Y)},schemaValidation(Q,X,Y){return new m(Q,X,Y)},browserConfig(Q,X,Y,Z){return new jQ(Q,X,Y,Z)},plugin(Q,X,Y){return new wQ(Q,X,Y)}}});class XQ{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(Q,X)=>X==="boolean"||["true","false","1","0","yes","no"].includes(Q.toLowerCase()),parse:(Q)=>{let X=Q.toLowerCase();return["true","1","yes"].includes(X)}},{name:"number",canParse:(Q,X)=>X==="number"||!Number.isNaN(Number(Q))&&!Number.isNaN(Number.parseFloat(Q)),parse:(Q)=>{let X=Number(Q);if(Number.isNaN(X))throw TypeError(`Cannot parse "${Q}" as number`);return X}},{name:"array",canParse:(Q,X)=>X==="array"||Q.startsWith("[")||Q.includes(","),parse:(Q)=>{try{let X=JSON.parse(Q);if(Array.isArray(X))return X}catch{}return Q.split(",").map((X)=>X.trim())}},{name:"json",canParse:(Q,X)=>X==="object"||(Q.startsWith("{")&&Q.endsWith("}")||Q.startsWith("[")&&Q.endsWith("]")),parse:(Q)=>{try{return JSON.parse(Q)}catch(X){throw Error(`Cannot parse "${Q}" as JSON: ${X}`)}}}]}async applyEnvironmentVariables(Q,X,Y={}){let{prefix:Z,useCamelCase:$=!0,useBackwardCompatibility:J=!0,customParsers:H={},verbose:W=!1,trackPerformance:U=!0}=Y,A=async()=>{if(!Q)return{config:X,source:{type:"environment",priority:50,timestamp:new Date}};let q=Z||this.generateEnvPrefix(Q),G={...X};return this.processObject(G,[],q,{useCamelCase:$,useBackwardCompatibility:J,customParsers:H,verbose:W,configName:Q}),{config:G,source:{type:"environment",priority:50,timestamp:new Date}}};if(U)return p.track("applyEnvironmentVariables",A,{configName:Q});return A()}generateEnvPrefix(Q){return Q.toUpperCase().replace(/-/g,"_")}formatEnvKey(Q,X){if(!X)return Q.toUpperCase();return Q.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(Q,X,Y,Z){for(let[$,J]of Object.entries(Q)){let H=[...X,$],W=H.map((q)=>this.formatEnvKey(q,Z.useCamelCase)),U=`${Y}_${W.join("_")}`,A=Z.useBackwardCompatibility?`${Y}_${H.map((q)=>q.toUpperCase()).join("_")}`:null;if(Z.verbose);if(typeof J==="object"&&J!==null&&!Array.isArray(J))this.processObject(J,H,Y,Z);else{let q=s.env[U]||(A?s.env[A]:void 0);if(q!==void 0){if(Z.verbose){let G=s.env[U]?U:A}try{Q[$]=this.parseEnvironmentValue(q,typeof J,U,Z.customParsers,Z.configName)}catch(G){if(G instanceof e)throw G;throw T.envVar(U,q,typeof J,Z.configName)}}}}}parseEnvironmentValue(Q,X,Y,Z,$){for(let[J,H]of Object.entries(Z))try{return H(Q)}catch{continue}for(let J of this.defaultParsers)if(J.canParse(Q,X))try{return J.parse(Q)}catch{throw T.envVar(Y,Q,`${X} (via ${J.name} parser)`,$)}return Q}getEnvironmentVariables(Q){let X={},Y=Q.toUpperCase();for(let[Z,$]of Object.entries(s.env))if(Z.startsWith(Y)&&$!==void 0)X[Z]=$;return X}validateEnvironmentVariable(Q,X,Y){let Z=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(Q))Z.push(`Environment variable key "${Q}" should only contain uppercase letters, numbers, and underscores`);if(Y)try{this.parseEnvironmentValue(Q,X,Y,{})}catch($){Z.push(`Cannot parse value "${X}" as ${Y}: ${$}`)}return{isValid:Z.length===0,errors:Z}}generateEnvVarDocs(Q,X,Y={}){let{prefix:Z,format:$="text"}=Y,J=Z||this.generateEnvPrefix(Q),H=[];switch(this.extractEnvVarInfo(X,[],J,H),$){case"markdown":return this.formatAsMarkdown(H,Q);case"json":return JSON.stringify(H,null,2);default:return this.formatAsText(H,Q)}}extractEnvVarInfo(Q,X,Y,Z){for(let[$,J]of Object.entries(Q)){let H=[...X,$],W=`${Y}_${H.map((U)=>this.formatEnvKey(U,!0)).join("_")}`;if(typeof J==="object"&&J!==null&&!Array.isArray(J))this.extractEnvVarInfo(J,H,Y,Z);else Z.push({key:W,type:Array.isArray(J)?"array":typeof J,description:`Configuration for ${H.join(".")}`,example:this.generateExample(J)})}}generateExample(Q){if(Array.isArray(Q))return JSON.stringify(Q);if(typeof Q==="object"&&Q!==null)return JSON.stringify(Q);return String(Q)}formatAsText(Q,X){let Y=`Environment Variables for ${X}:
11
+ `)}finishProgressBar(Q,X){if(!this.enabled||!this.fancy||j()||!B.stdout.isTTY){this.activeProgressBar=null;return}if(Q.current<Q.total)Q.current=Q.total;if(X)Q.message=X;this.renderProgressBar(Q,!0),this.activeProgressBar=null}async clear(Q={}){if(j()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let X=await n(this.config.logDirectory),Y=[];for(let Z of X){if(!(Q.name?new RegExp(Q.name.replace("*",".*")).test(Z):Z.startsWith(this.name))||!Z.endsWith(".log"))continue;let J=k(this.config.logDirectory,Z);if(Q.before)try{if((await C(J)).mtime>=Q.before)continue}catch(H){console.error(`Failed to get stats for file ${J}:`,H);continue}Y.push(J)}if(Y.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${Y.length} log file(s)...`);for(let Z of Y)try{await i(Z),console.warn(`Deleted log file: ${Z}`)}catch($){console.error(`Failed to delete log file ${Z}:`,$)}console.warn("Log clearing process finished.")}catch(X){console.error("Error during log clearing process:",X)}}}var vQ,WQ,h,CX,w,R,kX,dQ,xX,hQ,PX,bX,AQ,yX,fQ,mQ,vX,qQ,dX,hX,fX,mX,pX,t,nQ,gX,uX=O(()=>{vQ=r.env.CLARITY_LOG_DIR||jX(TX(),"logs"),WQ={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:vQ,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},h={...WQ},CX=(async()=>{try{let{loadConfig:Q}=await Promise.resolve().then(()=>(HX(),JX)),X=await Q({name:"clarity",alias:"logging",defaultConfig:WQ,cwd:r.cwd()});if(X)Object.assign(h,X)}catch{}return h})(),w={red:(Q)=>`\x1B[31m${Q}\x1B[0m`,green:(Q)=>`\x1B[32m${Q}\x1B[0m`,yellow:(Q)=>`\x1B[33m${Q}\x1B[0m`,blue:(Q)=>`\x1B[34m${Q}\x1B[0m`,magenta:(Q)=>`\x1B[35m${Q}\x1B[0m`,cyan:(Q)=>`\x1B[36m${Q}\x1B[0m`,white:(Q)=>`\x1B[37m${Q}\x1B[0m`,gray:(Q)=>`\x1B[90m${Q}\x1B[0m`,bgRed:(Q)=>`\x1B[41m${Q}\x1B[0m`,bgYellow:(Q)=>`\x1B[43m${Q}\x1B[0m`,bgGray:(Q)=>`\x1B[100m${Q}\x1B[0m`,bold:(Q)=>`\x1B[1m${Q}\x1B[0m`,dim:(Q)=>`\x1B[2m${Q}\x1B[0m`,italic:(Q)=>`\x1B[3m${Q}\x1B[0m`,underline:(Q)=>`\x1B[4m${Q}\x1B[0m`,strikethrough:(Q)=>`\x1B[9m${Q}\x1B[0m`,reset:"\x1B[0m"},R=w,kX=w.red,dQ=w.green,xX=w.yellow,hQ=w.blue,PX=w.magenta,bX=w.cyan,AQ=w.white,yX=w.gray,fQ=w.bgRed,mQ=w.bgYellow,vX=w.bgGray,qQ=w.bold,dX=w.dim,hX=w.italic,fX=w.underline,mX=w.strikethrough,pX=w.reset,t={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},nQ={debug:"\uD83D\uDD0D",info:hQ("\u2139"),success:dQ("\u2713"),warning:mQ(AQ(qQ(" WARN "))),error:fQ(AQ(qQ(" ERROR ")))},gX=new QQ("stacks")}),cX="0.15.9",lX=()=>{};async function iQ(Q,X={}){let{maxRetries:Y=3,retryDelay:Z=1000,isRetryable:$=()=>!0,fallback:J}=X,H=Error("Unknown error occurred");for(let W=0;W<=Y;W++)try{return await Q()}catch(U){if(H=U instanceof Error?U:Error(String(U)),W===Y||!$(H))break;if(Z>0)await new Promise((A)=>setTimeout(A,Z))}if(J!==void 0)return J;throw H instanceof Error?H:Error(`Unknown error: ${String(H)}`)}function sQ(Q){return Q instanceof L}function nX(Q){return Q instanceof a}function iX(Q){if(sQ(Q))return Q.code==="FILE_SYSTEM_ERROR"||Q.code==="BROWSER_CONFIG_ERROR";return["ENOENT","EACCES","EMFILE","ENFILE","EBUSY","network","timeout","connection"].some((Y)=>Q.message.toLowerCase().includes(Y.toLowerCase()))}var L,a,f,_Q,BQ,e,RQ,IQ,m,jQ,wQ,T,y=O(()=>{L=class extends Error{timestamp;context;constructor(X,Y={}){super(X);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=Y,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let X=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([Y,Z])=>`${Y}: ${Z}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${X}`}},a=class extends L{code="CONFIG_NOT_FOUND";constructor(X,Y,Z){let $=Z===void 0?[]:Array.isArray(Z)?Z.filter(Boolean):[Z],J="";if($.length===1)J=` or alias "${$[0]}"`;else if($.length>1)J=` or aliases ${$.map((H)=>`"${H}"`).join(", ")}`;super(`Configuration "${X}"${J} not found`,{configName:X,alias:Z,searchPaths:Y,searchPathCount:Y.length})}},f=class extends L{code="CONFIG_LOAD_ERROR";constructor(X,Y,Z){super(`Failed to load configuration from "${X}": ${Y.message}`,{configPath:X,configName:Z,originalError:Y.name,originalMessage:Y.message});this.cause=Y}},_Q=class extends L{code="CONFIG_VALIDATION_ERROR";constructor(X,Y,Z){super(`Configuration validation failed for "${X}"`,{configPath:X,configName:Z,validationErrors:Y,errorCount:Y.length})}},BQ=class extends L{code="CONFIG_MERGE_ERROR";constructor(X,Y,Z,$){super(`Failed to merge configuration from "${X}" with "${Y}": ${Z.message}`,{sourcePath:X,targetPath:Y,configName:$,originalError:Z.name,originalMessage:Z.message});this.cause=Z}},e=class extends L{code="ENV_VAR_ERROR";constructor(X,Y,Z,$){super(`Failed to parse environment variable "${X}" with value "${Y}" as ${Z}`,{envKey:X,envValue:Y,expectedType:Z,configName:$})}},RQ=class extends L{code="FILE_SYSTEM_ERROR";constructor(X,Y,Z){super(`File system ${X} failed for "${Y}": ${Z.message}`,{operation:X,path:Y,originalError:Z.name,originalMessage:Z.message});this.cause=Z}},IQ=class extends L{code="TYPE_GENERATION_ERROR";constructor(X,Y,Z){super(`Failed to generate types from "${X}" to "${Y}": ${Z.message}`,{configDir:X,outputPath:Y,originalError:Z.name,originalMessage:Z.message});this.cause=Z}},m=class extends L{code="SCHEMA_VALIDATION_ERROR";constructor(X,Y,Z){super(`Schema validation failed${Z?` for config "${Z}"`:""}`,{schemaPath:X,configName:Z,validationErrors:Y,errorCount:Y.length})}},jQ=class extends L{code="BROWSER_CONFIG_ERROR";constructor(X,Y,Z,$){super(`Failed to fetch configuration from "${X}": ${Y} ${Z}`,{endpoint:X,status:Y,statusText:Z,configName:$})}},wQ=class extends L{code="PLUGIN_ERROR";constructor(X,Y,Z){super(`Plugin "${X}" failed during ${Y}: ${Z.message}`,{pluginName:X,operation:Y,originalError:Z.name,originalMessage:Z.message});this.cause=Z}},T={configNotFound(Q,X,Y){return new a(Q,X,Y)},configLoad(Q,X,Y){return new f(Q,X,Y)},configValidation(Q,X,Y){return new _Q(Q,X,Y)},configMerge(Q,X,Y,Z){return new BQ(Q,X,Y,Z)},envVar(Q,X,Y,Z){return new e(Q,X,Y,Z)},fileSystem(Q,X,Y){return new RQ(Q,X,Y)},typeGeneration(Q,X,Y){return new IQ(Q,X,Y)},schemaValidation(Q,X,Y){return new m(Q,X,Y)},browserConfig(Q,X,Y,Z){return new jQ(Q,X,Y,Z)},plugin(Q,X,Y){return new wQ(Q,X,Y)}}});class XQ{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(Q,X)=>X==="boolean"||["true","false","1","0","yes","no"].includes(Q.toLowerCase()),parse:(Q)=>{let X=Q.toLowerCase();return["true","1","yes"].includes(X)}},{name:"number",canParse:(Q,X)=>X==="number"||!Number.isNaN(Number(Q))&&!Number.isNaN(Number.parseFloat(Q)),parse:(Q)=>{let X=Number(Q);if(Number.isNaN(X))throw TypeError(`Cannot parse "${Q}" as number`);return X}},{name:"array",canParse:(Q,X)=>X==="array"||Q.startsWith("[")||Q.includes(","),parse:(Q)=>{try{let X=JSON.parse(Q);if(Array.isArray(X))return X}catch{}return Q.split(",").map((X)=>X.trim())}},{name:"json",canParse:(Q,X)=>X==="object"||(Q.startsWith("{")&&Q.endsWith("}")||Q.startsWith("[")&&Q.endsWith("]")),parse:(Q)=>{try{return JSON.parse(Q)}catch(X){throw Error(`Cannot parse "${Q}" as JSON: ${X}`)}}}]}async applyEnvironmentVariables(Q,X,Y={}){let{prefix:Z,useCamelCase:$=!0,useBackwardCompatibility:J=!0,customParsers:H={},verbose:W=!1,trackPerformance:U=!0}=Y,A=async()=>{if(!Q)return{config:X,source:{type:"environment",priority:50,timestamp:new Date}};let q=Z||this.generateEnvPrefix(Q),G={...X};return this.processObject(G,[],q,{useCamelCase:$,useBackwardCompatibility:J,customParsers:H,verbose:W,configName:Q}),{config:G,source:{type:"environment",priority:50,timestamp:new Date}}};if(U)return p.track("applyEnvironmentVariables",A,{configName:Q});return A()}generateEnvPrefix(Q){return Q.toUpperCase().replace(/-/g,"_")}formatEnvKey(Q,X){if(!X)return Q.toUpperCase();return Q.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(Q,X,Y,Z){for(let[$,J]of Object.entries(Q)){let H=[...X,$],W=H.map((q)=>this.formatEnvKey(q,Z.useCamelCase)),U=`${Y}_${W.join("_")}`,A=Z.useBackwardCompatibility?`${Y}_${H.map((q)=>q.toUpperCase()).join("_")}`:null;if(Z.verbose);if(typeof J==="object"&&J!==null&&!Array.isArray(J))this.processObject(J,H,Y,Z);else{let q=s.env[U]||(A?s.env[A]:void 0);if(q!==void 0){if(Z.verbose){let G=s.env[U]?U:A}try{Q[$]=this.parseEnvironmentValue(q,typeof J,U,Z.customParsers,Z.configName)}catch(G){if(G instanceof e)throw G;throw T.envVar(U,q,typeof J,Z.configName)}}}}}parseEnvironmentValue(Q,X,Y,Z,$){for(let[J,H]of Object.entries(Z))try{return H(Q)}catch{continue}for(let J of this.defaultParsers)if(J.canParse(Q,X))try{return J.parse(Q)}catch{throw T.envVar(Y,Q,`${X} (via ${J.name} parser)`,$)}return Q}getEnvironmentVariables(Q){let X={},Y=Q.toUpperCase();for(let[Z,$]of Object.entries(s.env))if(Z.startsWith(Y)&&$!==void 0)X[Z]=$;return X}validateEnvironmentVariable(Q,X,Y){let Z=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(Q))Z.push(`Environment variable key "${Q}" should only contain uppercase letters, numbers, and underscores`);if(Y)try{this.parseEnvironmentValue(Q,X,Y,{})}catch($){Z.push(`Cannot parse value "${X}" as ${Y}: ${$}`)}return{isValid:Z.length===0,errors:Z}}generateEnvVarDocs(Q,X,Y={}){let{prefix:Z,format:$="text"}=Y,J=Z||this.generateEnvPrefix(Q),H=[];switch(this.extractEnvVarInfo(X,[],J,H),$){case"markdown":return this.formatAsMarkdown(H,Q);case"json":return JSON.stringify(H,null,2);default:return this.formatAsText(H,Q)}}extractEnvVarInfo(Q,X,Y,Z){for(let[$,J]of Object.entries(Q)){let H=[...X,$],W=`${Y}_${H.map((U)=>this.formatEnvKey(U,!0)).join("_")}`;if(typeof J==="object"&&J!==null&&!Array.isArray(J))this.extractEnvVarInfo(J,H,Y,Z);else Z.push({key:W,type:Array.isArray(J)?"array":typeof J,description:`Configuration for ${H.join(".")}`,example:this.generateExample(J)})}}generateExample(Q){if(Array.isArray(Q))return JSON.stringify(Q);if(typeof Q==="object"&&Q!==null)return JSON.stringify(Q);return String(Q)}formatAsText(Q,X){let Y=`Environment Variables for ${X}:
12
12
 
13
13
  `;for(let Z of Q)Y+=`${Z.key}
14
14
  `,Y+=` Type: ${Z.type}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{oc as a}from"./chunk-2r21f44d.js";import"./chunk-mcdb3q06.js";export{a as scanDeclarations};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk-j8zksbkn.js";import"./chunk-thhd43x5.js";import"./chunk-2n1bbm2c.js";import"./chunk-rsv17jh8.js";import"./chunk-d1xj2pjv.js";import"./chunk-285mqzvx.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{a as parseJSDoc,f as generateTypeDocJSON,c as generateMarkdown,e as generateJSON,d as generateHTML,g as generateDocs,b as extractDocumentation,h as createDocsGenerator};
2
+ import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk-f4c389mj.js";import"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-285mqzvx.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{a as parseJSDoc,f as generateTypeDocJSON,c as generateMarkdown,e as generateJSON,d as generateHTML,g as generateDocs,b as extractDocumentation,h as createDocsGenerator};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as I}from"./chunk-dzgms5s6.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-14gh6ezz.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,5 +1,5 @@
1
1
  // @bun
2
- import{ec as K}from"./chunk-thhd43x5.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-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(`
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,3 +1,3 @@
1
1
  // @bun
2
- import{tb as I}from"./chunk-dzgms5s6.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-14gh6ezz.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};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{tb as y}from"./chunk-dzgms5s6.js";import{Wc as H,Yc as F}from"./chunk-gssantc8.js";import{dd as R}from"./chunk-mcdb3q06.js";import{existsSync as V,readFileSync as G}from"fs";import{dirname as M,join as X,resolve as x}from"path";async function S(E){let A=[],z=new Set;async function q(I,O){let w=x(I);if(z.has(w))return;if(z.add(w),!V(w)){H.warn(`tsconfig not found: ${w}`);return}try{let K=G(w,"utf-8"),Q=K.indexOf("//")!==-1||K.indexOf("/*")!==-1?K.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""):K,L=JSON.parse(Q),U=M(w),Y=B(U,O),W=[];if(L.references)for(let D of L.references){let $=x(U,D.path),J=V(X($,"tsconfig.json"))?X($,"tsconfig.json"):$;await q(J,Y);let b=B(M(J),Y);W.push(b)}let Z="./src";if(L.compilerOptions?.rootDir)Z=L.compilerOptions.rootDir;else if(L.include&&L.include.length>0){if(L.include[0].startsWith("src/"))Z="./src"}let _="./dist";if(L.compilerOptions?.outDir)_=L.compilerOptions.outDir;else if(L.compilerOptions?.declarationDir)_=L.compilerOptions.declarationDir;A.push({name:Y,root:U,tsconfigPath:w,references:W,config:{root:Z,outdir:_}})}catch(K){let Q=K instanceof Error?K.message:String(K);H.warn(`Failed to parse ${w}: ${Q}`)}}return await q(E),A}function B(E,A){let z=X(E,"package.json");if(V(z))try{let I=G(z,"utf-8"),O=JSON.parse(I);if(O.name)return O.name}catch{}let q=E.split("/").pop()||"unknown";return A?`${A}/${q}`:q}function N(E){let A=new Map(E.map((w)=>[w.name,w])),z=[],q=new Set,I=new Set;function O(w){if(q.has(w))return;if(I.has(w)){H.warn(`Circular dependency detected involving: ${w}`);return}I.add(w);let K=A.get(w);if(K){for(let Q of K.references)O(Q);z.push(K)}I.delete(w),q.add(w)}for(let w of E)O(w.name);return z}async function T(E){let A=Date.now(),z=N(E.projects);H.info(`Generating declarations for ${z.length} projects...`);let q=[],I=!0;for(let Q of z){H.info(`
2
+ import{tb as y}from"./chunk-14gh6ezz.js";import{Wc as H,Yc as F}from"./chunk-gssantc8.js";import{dd as R}from"./chunk-mcdb3q06.js";import{existsSync as V,readFileSync as G}from"fs";import{dirname as M,join as X,resolve as x}from"path";async function S(E){let A=[],z=new Set;async function q(I,O){let w=x(I);if(z.has(w))return;if(z.add(w),!V(w)){H.warn(`tsconfig not found: ${w}`);return}try{let K=G(w,"utf-8"),Q=K.indexOf("//")!==-1||K.indexOf("/*")!==-1?K.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""):K,L=JSON.parse(Q),U=M(w),Y=B(U,O),W=[];if(L.references)for(let D of L.references){let $=x(U,D.path),J=V(X($,"tsconfig.json"))?X($,"tsconfig.json"):$;await q(J,Y);let b=B(M(J),Y);W.push(b)}let Z="./src";if(L.compilerOptions?.rootDir)Z=L.compilerOptions.rootDir;else if(L.include&&L.include.length>0){if(L.include[0].startsWith("src/"))Z="./src"}let _="./dist";if(L.compilerOptions?.outDir)_=L.compilerOptions.outDir;else if(L.compilerOptions?.declarationDir)_=L.compilerOptions.declarationDir;A.push({name:Y,root:U,tsconfigPath:w,references:W,config:{root:Z,outdir:_}})}catch(K){let Q=K instanceof Error?K.message:String(K);H.warn(`Failed to parse ${w}: ${Q}`)}}return await q(E),A}function B(E,A){let z=X(E,"package.json");if(V(z))try{let I=G(z,"utf-8"),O=JSON.parse(I);if(O.name)return O.name}catch{}let q=E.split("/").pop()||"unknown";return A?`${A}/${q}`:q}function N(E){let A=new Map(E.map((w)=>[w.name,w])),z=[],q=new Set,I=new Set;function O(w){if(q.has(w))return;if(I.has(w)){H.warn(`Circular dependency detected involving: ${w}`);return}I.add(w);let K=A.get(w);if(K){for(let Q of K.references)O(Q);z.push(K)}I.delete(w),q.add(w)}for(let w of E)O(w.name);return z}async function T(E){let A=Date.now(),z=N(E.projects);H.info(`Generating declarations for ${z.length} projects...`);let q=[],I=!0;for(let Q of z){H.info(`
3
3
  [${Q.name}] Generating...`);try{let L={...E.sharedConfig,...Q.config,cwd:Q.root,tsconfigPath:Q.tsconfigPath},U=await y(L),Y=U.filesFailed===0;if(!Y)I=!1;q.push({name:Q.name,stats:U,success:Y}),H.info(`[${Q.name}] Generated ${U.filesGenerated} files`)}catch(L){I=!1;let U=L instanceof Error?L.message:String(L);q.push({name:Q.name,stats:{filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},success:!1,error:U}),H.error(`[${Q.name}] Failed: ${U}`)}}let O=Date.now()-A,w=q.filter((Q)=>Q.success).length,K=q.length-w;if(H.info(`
4
4
  --- Workspace Generation Summary ---`),H.info(`Projects processed: ${q.length}`),H.info(`Successful: ${w}`),K>0)H.info(`Failed: ${K}`);return H.info(`Total duration: ${O}ms`),H.info(`------------------------------------
5
5
  `),{success:I,projects:q,durationMs:O}}async function f(E,A){if(A?.logLevel)F(A.logLevel);let z=X(E,"tsconfig.json");if(!V(z))throw Error(`Root tsconfig.json not found at: ${z}`);H.info("Discovering workspace projects...");let q=await S(z);if(q.length===0)return H.warn("No projects found in workspace"),{success:!0,projects:[],durationMs:0};return H.info(`Found ${q.length} projects`),T({root:E,projects:q,sharedConfig:A})}async function v(E){let A=X(E,"package.json");if(!V(A))return[];try{let z=G(A,"utf-8"),q=JSON.parse(z),I=[];if(Array.isArray(q.workspaces))I=q.workspaces;else if(q.workspaces?.packages)I=q.workspaces.packages;return I}catch{return[]}}async function C(E,A){let{Glob:z}=awaitPromise.resolve(globalThis.Bun),q=[];for(let I of A){let O=new z(I);for await(let w of O.scan({cwd:E,absolute:!0,onlyFiles:!1})){let K=X(w,"package.json");if(V(K))q.push(w)}}return q}async function l(E,A){if(A?.logLevel)F(A.logLevel);let z=await v(E);if(z.length===0)return H.warn("No workspace patterns found in package.json"),{success:!0,projects:[],durationMs:0};H.info(`Found workspace patterns: ${z.join(", ")}`);let q=await C(E,z);if(q.length===0)return H.warn("No projects found matching workspace patterns"),{success:!0,projects:[],durationMs:0};H.info(`Found ${q.length} workspace packages`);let I=q.map((O)=>{let w=X(O,"tsconfig.json");return{name:B(O),root:O,tsconfigPath:V(w)?w:"",references:[]}});return T({root:E,projects:I,sharedConfig:A})}
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as z}from"./chunk-dzgms5s6.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-14gh6ezz.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{tb as C}from"./chunk-dzgms5s6.js";function y(F={}){let{onStart:H=!1,onEnd:I=!0,onGenerated:J,onError:z,...q}=F,B=async()=>{try{let k=await C(q);J?.(k)}catch(k){let j=k instanceof Error?k:Error(String(k));if(z?.(j),!z)console.error("[dtsx] Generation failed:",j.message)}};return{name:"dtsx",setup(k){let j=k.initialOptions;if(!q.entrypoints&&j.entryPoints)if(Array.isArray(j.entryPoints))q.entrypoints=j.entryPoints;else q.entrypoints=Object.values(j.entryPoints);if(!q.outdir){if(j.outdir)q.outdir=j.outdir;else if(j.outfile){let w=j.outfile.lastIndexOf("/");if(w!==-1)q.outdir=j.outfile.substring(0,w)}}if(H)k.onStart(async()=>{await B()});if(I)k.onEnd(async(w)=>{if(w.errors.length===0)await B()})}}}var L=y,M=y,P=y;
2
+ import{tb as C}from"./chunk-14gh6ezz.js";function y(F={}){let{onStart:H=!1,onEnd:I=!0,onGenerated:J,onError:z,...q}=F,B=async()=>{try{let k=await C(q);J?.(k)}catch(k){let j=k instanceof Error?k:Error(String(k));if(z?.(j),!z)console.error("[dtsx] Generation failed:",j.message)}};return{name:"dtsx",setup(k){let j=k.initialOptions;if(!q.entrypoints&&j.entryPoints)if(Array.isArray(j.entryPoints))q.entrypoints=j.entryPoints;else q.entrypoints=Object.values(j.entryPoints);if(!q.outdir){if(j.outdir)q.outdir=j.outdir;else if(j.outfile){let w=j.outfile.lastIndexOf("/");if(w!==-1)q.outdir=j.outfile.substring(0,w)}}if(H)k.onStart(async()=>{await B()});if(I)k.onEnd(async(w)=>{if(w.errors.length===0)await B()})}}}var L=y,M=y,P=y;
3
3
  export{y as ia,L as ja,M as ka,P as la};
@@ -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-vgm83r4p.js";import"./chunk-thhd43x5.js";import"./chunk-2n1bbm2c.js";import"./chunk-rsv17jh8.js";import"./chunk-d1xj2pjv.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-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};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{l as a,m as b,n as c,o as d,p as e,q as f,r as g}from"./chunk-r6v1qdqb.js";import"./chunk-dzgms5s6.js";import"./chunk-thhd43x5.js";import"./chunk-2n1bbm2c.js";import"./chunk-x4v9kajr.js";import"./chunk-rsv17jh8.js";import"./chunk-d1xj2pjv.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-3w5aqasc.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{b as sortProjectsByDependencies,f as resolveWorkspacePatterns,c as generateWorkspace,d as generateMonorepo,g as generateFromPackageWorkspaces,a as discoverWorkspaceProjects,e as discoverWorkspaceFromPackageJson};
2
+ import{l as a,m as b,n as c,o as d,p as e,q as f,r as g}from"./chunk-j2yw0d45.js";import"./chunk-14gh6ezz.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 sortProjectsByDependencies,f as resolveWorkspacePatterns,c as generateWorkspace,d as generateMonorepo,g as generateFromPackageWorkspaces,a as discoverWorkspaceProjects,e as discoverWorkspaceFromPackageJson};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{tb as c,ub as d,vb as e}from"./chunk-14gh6ezz.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 +1,2 @@
1
1
  // @bun
2
- import{Pc as a,Qc as b,Rc as c,Sc as d,Tc as e,Uc as f}from"./chunk-3w5aqasc.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{c as resetConfig,b as getConfig,e as defineConfigAsync,d as defineConfig,a as defaultConfig,f as config};
2
+ import{Pc as a,Qc as b,Rc as c,Sc as d,Tc as e,Uc as f}from"./chunk-a3txc27m.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{c as resetConfig,b as getConfig,e as defineConfigAsync,d as defineConfig,a as defaultConfig,f as config};
@@ -0,0 +1,2 @@
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,5 +1,5 @@
1
1
  // @bun
2
- import{ec as F}from"./chunk-thhd43x5.js";import{Cc as N}from"./chunk-vpjw38x7.js";import{existsSync as H,readFileSync as P,unwatchFile as T}from"fs";var k;((J)=>{J[J.Error=1]="Error";J[J.Warning=2]="Warning";J[J.Information=3]="Information";J[J.Hint=4]="Hint"})(k||={});var L;((O)=>{O[O.File=1]="File";O[O.Module=2]="Module";O[O.Namespace=3]="Namespace";O[O.Package=4]="Package";O[O.Class=5]="Class";O[O.Method=6]="Method";O[O.Property=7]="Property";O[O.Field=8]="Field";O[O.Constructor=9]="Constructor";O[O.Enum=10]="Enum";O[O.Interface=11]="Interface";O[O.Function=12]="Function";O[O.Variable=13]="Variable";O[O.Constant=14]="Constant";O[O.String=15]="String";O[O.Number=16]="Number";O[O.Boolean=17]="Boolean";O[O.Array=18]="Array";O[O.Object=19]="Object";O[O.Key=20]="Key";O[O.Null=21]="Null";O[O.EnumMember=22]="EnumMember";O[O.Struct=23]="Struct";O[O.Event=24]="Event";O[O.Operator=25]="Operator";O[O.TypeParameter=26]="TypeParameter"})(L||={});var M;((Q)=>{Q[Q.Text=1]="Text";Q[Q.Method=2]="Method";Q[Q.Function=3]="Function";Q[Q.Constructor=4]="Constructor";Q[Q.Field=5]="Field";Q[Q.Variable=6]="Variable";Q[Q.Class=7]="Class";Q[Q.Interface=8]="Interface";Q[Q.Module=9]="Module";Q[Q.Property=10]="Property";Q[Q.Unit=11]="Unit";Q[Q.Value=12]="Value";Q[Q.Enum=13]="Enum";Q[Q.Keyword=14]="Keyword";Q[Q.Snippet=15]="Snippet";Q[Q.Color=16]="Color";Q[Q.File=17]="File";Q[Q.Reference=18]="Reference";Q[Q.Folder=19]="Folder";Q[Q.EnumMember=20]="EnumMember";Q[Q.Constant=21]="Constant";Q[Q.Struct=22]="Struct";Q[Q.Event=23]="Event";Q[Q.Operator=24]="Operator";Q[Q.TypeParameter=25]="TypeParameter"})(M||={});var v;((A)=>{A[A.Text=1]="Text";A[A.Read=2]="Read";A[A.Write=3]="Write"})(v||={});class E{documents=new Map;rootUri=null;config={};messageId=0;watchers=new Map;initialize(j){return this.rootUri=j.rootUri,{capabilities:{textDocumentSync:1,hoverProvider:!0,completionProvider:{triggerCharacters:[".",":","<",'"',"'","/"],resolveProvider:!0},definitionProvider:!0,referencesProvider:!0,renameProvider:{prepareProvider:!0},documentSymbolProvider:!0,workspaceSymbolProvider:!0,codeActionProvider:{codeActionKinds:["quickfix","refactor","source"]},signatureHelpProvider:{triggerCharacters:["(",","],retriggerCharacters:[","]},documentHighlightProvider:!0,documentFormattingProvider:!0,diagnosticProvider:{interFileDependencies:!0,workspaceDiagnostics:!0}}}}didOpen(j){let{uri:z,text:G,version:A}=j.textDocument;this.updateDocument(z,G,A)}didChange(j){let{uri:z,version:G}=j.textDocument,A=j.contentChanges[0]?.text||"";this.updateDocument(z,A,G)}didClose(j){let z=j.textDocument.uri;if(this.documents.delete(z),this.watchers.get(z))T(this.uriToPath(z)),this.watchers.delete(z)}updateDocument(j,z,G){let A=this.uriToPath(j),J=F(z,A,!0);this.documents.set(j,{content:z,version:G,declarations:J})}getDiagnostics(j){let z=this.documents.get(j);if(!z)return[];let G=[];for(let A of z.declarations){if(A.isExported&&A.kind==="variable"&&!A.typeAnnotation)G.push({range:this.getDeclarationRange(A,z.content),severity:2,code:"missing-type",source:"dtsx",message:`Exported variable '${A.name}' should have an explicit type annotation for better declaration generation`});if(A.typeAnnotation==="any"||A.returnType==="any")G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"any-type",source:"dtsx",message:"Consider using a more specific type instead of 'any'"});if(A.kind==="function"&&A.isExported&&!A.returnType)G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"missing-return-type",source:"dtsx",message:`Function '${A.name}' should have an explicit return type for better declaration generation`})}return G}hover(j){let z=this.documents.get(j.textDocument.uri);if(!z)return null;let{line:G,character:A}=j.position,R=z.content.split(`
2
+ import{ec as F}from"./chunk-y581wnfe.js";import{Cc as N}from"./chunk-vpjw38x7.js";import{existsSync as H,readFileSync as P,unwatchFile as T}from"fs";var k;((J)=>{J[J.Error=1]="Error";J[J.Warning=2]="Warning";J[J.Information=3]="Information";J[J.Hint=4]="Hint"})(k||={});var L;((O)=>{O[O.File=1]="File";O[O.Module=2]="Module";O[O.Namespace=3]="Namespace";O[O.Package=4]="Package";O[O.Class=5]="Class";O[O.Method=6]="Method";O[O.Property=7]="Property";O[O.Field=8]="Field";O[O.Constructor=9]="Constructor";O[O.Enum=10]="Enum";O[O.Interface=11]="Interface";O[O.Function=12]="Function";O[O.Variable=13]="Variable";O[O.Constant=14]="Constant";O[O.String=15]="String";O[O.Number=16]="Number";O[O.Boolean=17]="Boolean";O[O.Array=18]="Array";O[O.Object=19]="Object";O[O.Key=20]="Key";O[O.Null=21]="Null";O[O.EnumMember=22]="EnumMember";O[O.Struct=23]="Struct";O[O.Event=24]="Event";O[O.Operator=25]="Operator";O[O.TypeParameter=26]="TypeParameter"})(L||={});var M;((Q)=>{Q[Q.Text=1]="Text";Q[Q.Method=2]="Method";Q[Q.Function=3]="Function";Q[Q.Constructor=4]="Constructor";Q[Q.Field=5]="Field";Q[Q.Variable=6]="Variable";Q[Q.Class=7]="Class";Q[Q.Interface=8]="Interface";Q[Q.Module=9]="Module";Q[Q.Property=10]="Property";Q[Q.Unit=11]="Unit";Q[Q.Value=12]="Value";Q[Q.Enum=13]="Enum";Q[Q.Keyword=14]="Keyword";Q[Q.Snippet=15]="Snippet";Q[Q.Color=16]="Color";Q[Q.File=17]="File";Q[Q.Reference=18]="Reference";Q[Q.Folder=19]="Folder";Q[Q.EnumMember=20]="EnumMember";Q[Q.Constant=21]="Constant";Q[Q.Struct=22]="Struct";Q[Q.Event=23]="Event";Q[Q.Operator=24]="Operator";Q[Q.TypeParameter=25]="TypeParameter"})(M||={});var v;((A)=>{A[A.Text=1]="Text";A[A.Read=2]="Read";A[A.Write=3]="Write"})(v||={});class E{documents=new Map;rootUri=null;config={};messageId=0;watchers=new Map;initialize(j){return this.rootUri=j.rootUri,{capabilities:{textDocumentSync:1,hoverProvider:!0,completionProvider:{triggerCharacters:[".",":","<",'"',"'","/"],resolveProvider:!0},definitionProvider:!0,referencesProvider:!0,renameProvider:{prepareProvider:!0},documentSymbolProvider:!0,workspaceSymbolProvider:!0,codeActionProvider:{codeActionKinds:["quickfix","refactor","source"]},signatureHelpProvider:{triggerCharacters:["(",","],retriggerCharacters:[","]},documentHighlightProvider:!0,documentFormattingProvider:!0,diagnosticProvider:{interFileDependencies:!0,workspaceDiagnostics:!0}}}}didOpen(j){let{uri:z,text:G,version:A}=j.textDocument;this.updateDocument(z,G,A)}didChange(j){let{uri:z,version:G}=j.textDocument,A=j.contentChanges[0]?.text||"";this.updateDocument(z,A,G)}didClose(j){let z=j.textDocument.uri;if(this.documents.delete(z),this.watchers.get(z))T(this.uriToPath(z)),this.watchers.delete(z)}updateDocument(j,z,G){let A=this.uriToPath(j),J=F(z,A,!0);this.documents.set(j,{content:z,version:G,declarations:J})}getDiagnostics(j){let z=this.documents.get(j);if(!z)return[];let G=[];for(let A of z.declarations){if(A.isExported&&A.kind==="variable"&&!A.typeAnnotation)G.push({range:this.getDeclarationRange(A,z.content),severity:2,code:"missing-type",source:"dtsx",message:`Exported variable '${A.name}' should have an explicit type annotation for better declaration generation`});if(A.typeAnnotation==="any"||A.returnType==="any")G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"any-type",source:"dtsx",message:"Consider using a more specific type instead of 'any'"});if(A.kind==="function"&&A.isExported&&!A.returnType)G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"missing-return-type",source:"dtsx",message:`Function '${A.name}' should have an explicit return type for better declaration generation`})}return G}hover(j){let z=this.documents.get(j.textDocument.uri);if(!z)return null;let{line:G,character:A}=j.position,R=z.content.split(`
3
3
  `)[G]||"",U=R.slice(0,A).match(/[\w$]+$/),V=R.slice(A).match(/^[\w$]+/);if(!U&&!V)return null;let X=(U?.[0]||"")+(V?.[0]||""),Y=z.declarations.find((W)=>W.name===X);if(!Y)return null;let B=`\`\`\`typescript
4
4
  ${this.buildSignature(Y)}
5
5
  \`\`\``;if(Y.leadingComments&&Y.leadingComments.length>0){let q=Y.leadingComments.join(`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{hc as E}from"./chunk-2n1bbm2c.js";import{lc as p,mc as Rq,nc as zq}from"./chunk-rsv17jh8.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(`
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
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
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
5
  ${Q.join(`,
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-wzq881r8.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-j8zksbkn.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-r6v1qdqb.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-vgm83r4p.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-dzgms5s6.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-thhd43x5.js";import{hc as g0}from"../chunk-2n1bbm2c.js";import{ic as h$,jc as g$}from"../chunk-x4v9kajr.js";import{lc as KZ}from"../chunk-rsv17jh8.js";import"../chunk-d1xj2pjv.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-3w5aqasc.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-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-j2yw0d45.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-14gh6ezz.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(`
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-pj8142by.js";import"../../chunk-dzgms5s6.js";import"../../chunk-thhd43x5.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-x4v9kajr.js";import"../../chunk-rsv17jh8.js";import"../../chunk-d1xj2pjv.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-3w5aqasc.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-mn46jafe.js";import"../../chunk-14gh6ezz.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};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ia as a,ja as b,ka as c,la as d}from"../../chunk-y6m8mmyg.js";import"../../chunk-dzgms5s6.js";import"../../chunk-thhd43x5.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-x4v9kajr.js";import"../../chunk-rsv17jh8.js";import"../../chunk-d1xj2pjv.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-3w5aqasc.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-npj0c002.js";import"../../chunk-14gh6ezz.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};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ca as s}from"../../chunk-abhx1v3w.js";import{fa as t}from"../../chunk-pj8142by.js";import{ia as i,ka as p}from"../../chunk-y6m8mmyg.js";import{ma as e,oa as u}from"../../chunk-enqtx6te.js";import{qa as l,ra as a,sa as n}from"../../chunk-mwfja9e3.js";import"../../chunk-dzgms5s6.js";import"../../chunk-thhd43x5.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-x4v9kajr.js";import"../../chunk-rsv17jh8.js";import"../../chunk-d1xj2pjv.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-3w5aqasc.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-8g7jyxbr.js";import{fa as t}from"../../chunk-mn46jafe.js";import{ia as i,ka as p}from"../../chunk-npj0c002.js";import{ma as e,oa as u}from"../../chunk-fef6249b.js";import{qa as l,ra as a,sa as n}from"../../chunk-c09v68yx.js";import"../../chunk-14gh6ezz.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};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ma as a,na as b,oa as c,pa as d}from"../../chunk-enqtx6te.js";import"../../chunk-dzgms5s6.js";import"../../chunk-thhd43x5.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-x4v9kajr.js";import"../../chunk-rsv17jh8.js";import"../../chunk-d1xj2pjv.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-3w5aqasc.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-fef6249b.js";import"../../chunk-14gh6ezz.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};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ca as a,da as b,ea as c}from"../../chunk-abhx1v3w.js";import"../../chunk-dzgms5s6.js";import"../../chunk-thhd43x5.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-x4v9kajr.js";import"../../chunk-rsv17jh8.js";import"../../chunk-d1xj2pjv.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-3w5aqasc.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-8g7jyxbr.js";import"../../chunk-14gh6ezz.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};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{qa as a,ra as b,sa as c,ta as d}from"../../chunk-mwfja9e3.js";import"../../chunk-dzgms5s6.js";import"../../chunk-thhd43x5.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-x4v9kajr.js";import"../../chunk-rsv17jh8.js";import"../../chunk-d1xj2pjv.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-3w5aqasc.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-c09v68yx.js";import"../../chunk-14gh6ezz.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};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/dtsx",
3
3
  "type": "module",
4
- "version": "0.9.14",
4
+ "version": "0.9.15",
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,2 +0,0 @@
1
- // @bun
2
- import{oc as a}from"./chunk-d1xj2pjv.js";import"./chunk-mcdb3q06.js";export{a as scanDeclarations};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{a,b,c}from"./chunk-wzq881r8.js";import"./chunk-thhd43x5.js";import"./chunk-2n1bbm2c.js";import"./chunk-rsv17jh8.js";import"./chunk-d1xj2pjv.js";import"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{b as optimizeFile,a as optimizeDeclarations,c as minifyDts};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{tb as c,ub as d,vb as e}from"./chunk-dzgms5s6.js";import"./chunk-thhd43x5.js";import"./chunk-2n1bbm2c.js";import{ic as a,jc as b}from"./chunk-x4v9kajr.js";import"./chunk-rsv17jh8.js";import"./chunk-d1xj2pjv.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-3w5aqasc.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};