@dtsx/dtsx 0.0.0-stage → 0.11.38

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 (276) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +442 -2
  3. package/dist/bin/cli.d.ts +1 -0
  4. package/dist/bin/cli.js +12 -0
  5. package/dist/chunk-082w7zvy.js +4 -0
  6. package/dist/chunk-0k0fhq13.js +19 -0
  7. package/dist/chunk-0rmbc5zp.js +3 -0
  8. package/dist/chunk-0yg5mcrf.js +3 -0
  9. package/dist/chunk-0zfzhn19.js +31 -0
  10. package/dist/chunk-189nn4fc.js +3 -0
  11. package/dist/chunk-1j6092xz.js +7 -0
  12. package/dist/chunk-1qtghb2x.js +3 -0
  13. package/dist/chunk-2436cnmb.js +3 -0
  14. package/dist/chunk-2qd3axyx.js +5 -0
  15. package/dist/chunk-32qexm3w.js +3 -0
  16. package/dist/chunk-3fbt79hx.js +3 -0
  17. package/dist/chunk-3t57mzvf.js +3 -0
  18. package/dist/chunk-42j9cfte.js +3 -0
  19. package/dist/chunk-4fygcxtb.js +4 -0
  20. package/dist/chunk-50h54rax.js +177 -0
  21. package/dist/chunk-5hyv43ps.js +12 -0
  22. package/dist/chunk-6yvk3q1e.js +3 -0
  23. package/dist/chunk-73dzve1s.js +3 -0
  24. package/dist/chunk-7tremqhs.js +14 -0
  25. package/dist/chunk-83qnrx0m.js +7 -0
  26. package/dist/chunk-88gwzbew.js +4 -0
  27. package/dist/chunk-8d3sdkv4.js +24 -0
  28. package/dist/chunk-8tzd98q8.js +22 -0
  29. package/dist/chunk-96atbsd3.js +3 -0
  30. package/dist/chunk-9gts9ymh.js +3 -0
  31. package/dist/chunk-9menejdz.js +3 -0
  32. package/dist/chunk-a7nvyxpg.js +6 -0
  33. package/dist/chunk-ag1b6d30.js +3 -0
  34. package/dist/chunk-asws39qs.js +31 -0
  35. package/dist/chunk-bnry23ve.js +4 -0
  36. package/dist/chunk-bxc2herz.js +9 -0
  37. package/dist/chunk-cpmqa8kd.js +4 -0
  38. package/dist/chunk-cv29b4zb.js +7 -0
  39. package/dist/chunk-cyr45de1.js +8 -0
  40. package/dist/chunk-d0bazr3p.js +3 -0
  41. package/dist/chunk-danfamyx.js +3 -0
  42. package/dist/chunk-davy89dj.js +8 -0
  43. package/dist/chunk-e29rp5xj.js +7 -0
  44. package/dist/chunk-eba562w8.js +9 -0
  45. package/dist/chunk-ebjafajx.js +62 -0
  46. package/dist/chunk-ft2zk7jx.js +3 -0
  47. package/dist/chunk-g2120ysy.js +3 -0
  48. package/dist/chunk-ghfd34r7.js +3 -0
  49. package/dist/chunk-gspsxc9d.js +34 -0
  50. package/dist/chunk-h3n6256r.js +3 -0
  51. package/dist/chunk-hnqm1zb3.js +5 -0
  52. package/dist/chunk-htgy94y3.js +2 -0
  53. package/dist/chunk-hv8bx8xx.js +102 -0
  54. package/dist/chunk-hzn9kmq7.js +3 -0
  55. package/dist/chunk-ja7bp731.js +3 -0
  56. package/dist/chunk-jcckwgb9.js +3 -0
  57. package/dist/chunk-kfk554fj.js +3 -0
  58. package/dist/chunk-kkshxyex.js +18 -0
  59. package/dist/chunk-kpbz61yy.js +4 -0
  60. package/dist/chunk-mkakbjvs.js +3 -0
  61. package/dist/chunk-mwyjxjqa.js +3 -0
  62. package/dist/chunk-p023fhce.js +8 -0
  63. package/dist/chunk-p9vfxn8g.js +3 -0
  64. package/dist/chunk-pga5m4wm.js +3 -0
  65. package/dist/chunk-pjqzkgzk.js +6 -0
  66. package/dist/chunk-qzjzw9p2.js +3 -0
  67. package/dist/chunk-rbx6q1r0.js +18 -0
  68. package/dist/chunk-rkstz4w1.js +6 -0
  69. package/dist/chunk-rz060wxt.js +6 -0
  70. package/dist/chunk-sd8bywh9.js +21 -0
  71. package/dist/chunk-sv8h007a.js +3 -0
  72. package/dist/chunk-t4va49p3.js +10 -0
  73. package/dist/chunk-tka2m4af.js +7 -0
  74. package/dist/chunk-v6fwy63g.js +3 -0
  75. package/dist/chunk-v93389xm.js +3 -0
  76. package/dist/chunk-vf3ybe5r.js +3 -0
  77. package/dist/chunk-vkahj2ab.js +10 -0
  78. package/dist/chunk-wnqg6hem.js +27 -0
  79. package/dist/chunk-xa6rsd4b.js +29 -0
  80. package/dist/chunk-xfjfhe9d.js +3 -0
  81. package/dist/chunk-xwpn40p0.js +6 -0
  82. package/dist/chunk-y1g6v96c.js +10 -0
  83. package/dist/chunk-y5k0szq6.js +3 -0
  84. package/dist/chunk-yay68832.js +3 -0
  85. package/dist/chunk-yrv6z221.js +3 -0
  86. package/dist/chunk-yx1jy7fx.js +37 -0
  87. package/dist/chunk-zgcdx773.js +4 -0
  88. package/dist/chunk-zk3w5sqv.js +4 -0
  89. package/dist/chunk-zq93f8ca.js +5 -0
  90. package/dist/src/augmentation-graph.d.ts +11 -0
  91. package/dist/src/augmentation-graph.js +2 -0
  92. package/dist/src/binding-patterns.d.ts +18 -0
  93. package/dist/src/binding-patterns.js +2 -0
  94. package/dist/src/branded-types.d.ts +159 -0
  95. package/dist/src/branded-types.js +2 -0
  96. package/dist/src/bundle-linker.d.ts +38 -0
  97. package/dist/src/bundle-linker.js +2 -0
  98. package/dist/src/bundler.d.ts +55 -0
  99. package/dist/src/bundler.js +2 -0
  100. package/dist/src/cache.d.ts +53 -0
  101. package/dist/src/cache.js +2 -0
  102. package/dist/src/call-signatures.d.ts +1 -0
  103. package/dist/src/call-signatures.js +2 -0
  104. package/dist/src/checker.d.ts +107 -0
  105. package/dist/src/circular.d.ts +82 -0
  106. package/dist/src/circular.js +2 -0
  107. package/dist/src/compat.d.ts +114 -0
  108. package/dist/src/compat.js +2 -0
  109. package/dist/src/computed-keys.d.ts +12 -0
  110. package/dist/src/computed-keys.js +2 -0
  111. package/dist/src/concurrency.d.ts +4 -0
  112. package/dist/src/concurrency.js +2 -0
  113. package/dist/src/config.d.ts +35 -0
  114. package/dist/src/config.js +2 -0
  115. package/dist/src/dangling-refs.d.ts +11 -0
  116. package/dist/src/dangling-refs.js +2 -0
  117. package/dist/src/declaration-project.d.ts +33 -0
  118. package/dist/src/declaration-project.js +2 -0
  119. package/dist/src/declaration-publication.d.ts +15 -0
  120. package/dist/src/declaration-publication.js +2 -0
  121. package/dist/src/declaration-references.d.ts +19 -0
  122. package/dist/src/declaration-references.js +2 -0
  123. package/dist/src/diff.d.ts +82 -0
  124. package/dist/src/diff.js +2 -0
  125. package/dist/src/docs.d.ts +97 -0
  126. package/dist/src/docs.js +2 -0
  127. package/dist/src/enum-declarations.d.ts +6 -0
  128. package/dist/src/enum-declarations.js +2 -0
  129. package/dist/src/errors.d.ts +113 -0
  130. package/dist/src/errors.js +2 -0
  131. package/dist/src/extractor/directives.d.ts +5 -0
  132. package/dist/src/extractor/directives.js +2 -0
  133. package/dist/src/extractor/extract.d.ts +10 -0
  134. package/dist/src/extractor/extract.js +2 -0
  135. package/dist/src/extractor/hash.d.ts +1 -0
  136. package/dist/src/extractor/hash.js +2 -0
  137. package/dist/src/extractor/scanner.d.ts +32 -0
  138. package/dist/src/extractor/scanner.js +2 -0
  139. package/dist/src/extractor.d.ts +5 -0
  140. package/dist/src/extractor.js +2 -0
  141. package/dist/src/formats.d.ts +50 -0
  142. package/dist/src/formats.js +2 -0
  143. package/dist/src/formatter.d.ts +61 -0
  144. package/dist/src/formatter.js +2 -0
  145. package/dist/src/function-properties.d.ts +3 -0
  146. package/dist/src/function-properties.js +2 -0
  147. package/dist/src/generator.d.ts +18 -0
  148. package/dist/src/generator.js +2 -0
  149. package/dist/src/global-types.d.ts +17 -0
  150. package/dist/src/global-types.js +2 -0
  151. package/dist/src/import-sorter.d.ts +99 -0
  152. package/dist/src/import-sorter.js +2 -0
  153. package/dist/src/incremental.d.ts +103 -0
  154. package/dist/src/incremental.js +2 -0
  155. package/dist/src/index.d.ts +62 -0
  156. package/dist/src/index.js +2 -0
  157. package/dist/src/inferred-imports.d.ts +4 -0
  158. package/dist/src/inferred-imports.js +2 -0
  159. package/dist/src/json-config.d.ts +2 -0
  160. package/dist/src/json-config.js +2 -0
  161. package/dist/src/lexical.d.ts +6 -0
  162. package/dist/src/lexical.js +2 -0
  163. package/dist/src/logger.d.ts +57 -0
  164. package/dist/src/logger.js +2 -0
  165. package/dist/src/lsp.d.ts +333 -0
  166. package/dist/src/lsp.js +2 -0
  167. package/dist/src/memory.d.ts +127 -0
  168. package/dist/src/memory.js +2 -0
  169. package/dist/src/merger.d.ts +38 -0
  170. package/dist/src/merger.js +2 -0
  171. package/dist/src/module-graph.d.ts +70 -0
  172. package/dist/src/module-graph.js +2 -0
  173. package/dist/src/module-references.d.ts +30 -0
  174. package/dist/src/module-references.js +2 -0
  175. package/dist/src/native-checker.d.ts +55 -0
  176. package/dist/src/native-checker.js +2 -0
  177. package/dist/src/native-engine.d.ts +16 -0
  178. package/dist/src/native-engine.js +2 -0
  179. package/dist/src/native-extractor.d.ts +9 -0
  180. package/dist/src/native-extractor.js +2 -0
  181. package/dist/src/native-generation.d.ts +20 -0
  182. package/dist/src/native-generation.js +2 -0
  183. package/dist/src/native-project.d.ts +35 -0
  184. package/dist/src/native-project.js +2 -0
  185. package/dist/src/optimizer.d.ts +56 -0
  186. package/dist/src/optimizer.js +2 -0
  187. package/dist/src/output-normalizer.d.ts +123 -0
  188. package/dist/src/output-normalizer.js +2 -0
  189. package/dist/src/parallel-processor.d.ts +63 -0
  190. package/dist/src/parallel-processor.js +2 -0
  191. package/dist/src/parameters.d.ts +5 -0
  192. package/dist/src/parameters.js +2 -0
  193. package/dist/src/parser.d.ts +68 -0
  194. package/dist/src/parser.js +2 -0
  195. package/dist/src/plugins/bun.d.ts +58 -0
  196. package/dist/src/plugins/bun.js +2 -0
  197. package/dist/src/plugins/esbuild.d.ts +63 -0
  198. package/dist/src/plugins/esbuild.js +2 -0
  199. package/dist/src/plugins/index.d.ts +16 -0
  200. package/dist/src/plugins/index.js +2 -0
  201. package/dist/src/plugins/tsdown.d.ts +30 -0
  202. package/dist/src/plugins/tsdown.js +2 -0
  203. package/dist/src/plugins/tsup.d.ts +53 -0
  204. package/dist/src/plugins/tsup.js +2 -0
  205. package/dist/src/plugins/vite.d.ts +49 -0
  206. package/dist/src/plugins/vite.js +2 -0
  207. package/dist/src/plugins/webpack.d.ts +69 -0
  208. package/dist/src/plugins/webpack.js +2 -0
  209. package/dist/src/plugins.d.ts +88 -0
  210. package/dist/src/plugins.js +2 -0
  211. package/dist/src/process-source.d.ts +28 -0
  212. package/dist/src/process-source.js +2 -0
  213. package/dist/src/processor/cache.d.ts +18 -0
  214. package/dist/src/processor/cache.js +2 -0
  215. package/dist/src/processor/comments.d.ts +9 -0
  216. package/dist/src/processor/comments.js +2 -0
  217. package/dist/src/processor/declarations.d.ts +37 -0
  218. package/dist/src/processor/declarations.js +2 -0
  219. package/dist/src/processor/import-usage.d.ts +6 -0
  220. package/dist/src/processor/import-usage.js +2 -0
  221. package/dist/src/processor/imports.d.ts +68 -0
  222. package/dist/src/processor/imports.js +2 -0
  223. package/dist/src/processor/index.d.ts +33 -0
  224. package/dist/src/processor/index.js +2 -0
  225. package/dist/src/processor/type-inference.d.ts +116 -0
  226. package/dist/src/processor/type-inference.js +2 -0
  227. package/dist/src/processor.d.ts +5 -0
  228. package/dist/src/processor.js +2 -0
  229. package/dist/src/profiling.d.ts +114 -0
  230. package/dist/src/profiling.js +2 -0
  231. package/dist/src/return-type-scope.d.ts +3 -0
  232. package/dist/src/return-type-scope.js +2 -0
  233. package/dist/src/security.d.ts +100 -0
  234. package/dist/src/security.js +2 -0
  235. package/dist/src/source-cache.d.ts +16 -0
  236. package/dist/src/source-cache.js +2 -0
  237. package/dist/src/sourcemap.d.ts +137 -0
  238. package/dist/src/sourcemap.js +2 -0
  239. package/dist/src/stx.d.ts +20 -0
  240. package/dist/src/stx.js +2 -0
  241. package/dist/src/syntax-validator.d.ts +7 -0
  242. package/dist/src/syntax-validator.js +2 -0
  243. package/dist/src/tracking.d.ts +95 -0
  244. package/dist/src/tracking.js +2 -0
  245. package/dist/src/transformers.d.ts +188 -0
  246. package/dist/src/transformers.js +2 -0
  247. package/dist/src/tree-shaker.d.ts +69 -0
  248. package/dist/src/tree-shaker.js +2 -0
  249. package/dist/src/tsconfig.d.ts +8 -0
  250. package/dist/src/tsconfig.js +2 -0
  251. package/dist/src/type-mappings.d.ts +145 -0
  252. package/dist/src/type-mappings.js +2 -0
  253. package/dist/src/types.d.ts +230 -0
  254. package/dist/src/types.js +1 -0
  255. package/dist/src/utils.d.ts +63 -0
  256. package/dist/src/utils.js +2 -0
  257. package/dist/src/value-inference.d.ts +6 -0
  258. package/dist/src/value-inference.js +2 -0
  259. package/dist/src/vue.d.ts +108 -0
  260. package/dist/src/vue.js +2 -0
  261. package/dist/src/watcher.d.ts +64 -0
  262. package/dist/src/watcher.js +2 -0
  263. package/dist/src/worker-thread.d.ts +1 -0
  264. package/dist/src/worker-thread.js +2 -0
  265. package/dist/src/worker.d.ts +98 -0
  266. package/dist/src/worker.js +2 -0
  267. package/dist/src/workspace.d.ts +62 -0
  268. package/dist/src/workspace.js +2 -0
  269. package/native/README.md +6 -0
  270. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  271. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  272. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  273. package/native/linux-arm64/libzig-dtsx.so +0 -0
  274. package/native/linux-x64/libzig-dtsx.so +0 -0
  275. package/native/windows-x64/zig-dtsx.dll +0 -0
  276. package/package.json +120 -4
@@ -0,0 +1,27 @@
1
+ // @bun
2
+ import{t,d}from"./chunk-1j6092xz.js";import{W}from"./chunk-ag1b6d30.js";import{Pt}from"./chunk-yx1jy7fx.js";import{b}from"./chunk-vf3ybe5r.js";import{Y}from"./chunk-p9vfxn8g.js";import{relative as O}from"path";function J(n){let y=t(n),c=(l)=>y[l]?n.slice(y[l].start,y[l].end):"",i=c(0)==="export"?1:0;if(c(i++)!=="declare")return;let f;if(c(i)==="module"&&y[i+1]?.kind==="quoted"){if(f=d(c(i+1)),f===void 0)return;i+=2}else if(c(i++)!=="global")return;if(c(i)!=="{")return;let h=y[i].end,S=1;for(i++;i<y.length;i++)if(c(i)==="{")S++;else if(c(i)==="}"&&--S===0)return{specifier:f,body:n.slice(h,y[i].start),start:h,end:y[i].start};return}var ne=/^[A-Z_$][\w$]*$/i;function bo(n){let y=[],c=[],i=0,f=0,h=[],S=!1,l=0,E=n.length,R=(a)=>{let w=n.slice(i,a).trim();if(i=a,!w)return;if(se(w)){c.push(w);return}y.push({text:w,comments:c}),c=[]};while(l<E){let a=n[l];if(S){if(a==="\\"){l+=2;continue}if(a==="`"){S=!1,l++;continue}if(a==="$"&&n[l+1]==="{"){h.push(f),f++,S=!1,l+=2;continue}l++;continue}if(a==="/"&&n[l+1]==="*"){let w=n.indexOf("*/",l+2);l=w===-1?E:w+2;continue}if(a==="/"&&n[l+1]==="/"){let w=n.indexOf(`
3
+ `,l);l=w===-1?E:w;continue}if(a==="'"||a==='"'){l++;while(l<E&&n[l]!==a&&n[l]!==`
4
+ `){if(n[l]==="\\")l++;l++}l++;continue}if(a==="`"){S=!0,l++;continue}if(a==="("||a==="["||a==="{"){f++,l++;continue}if(a===")"||a==="]"||a==="}"){if(f--,h.length>0&&a==="}"&&f===h[h.length-1])h.pop(),S=!0;l++;continue}if(f===0&&a===";"){R(l+1),l++;continue}if(f===0&&a===`
5
+ `){let w=n[l+1];if(w!==void 0&&/[\w$@/]/.test(w))R(l+1);l++;continue}l++}return R(E),y}function se(n){let y=0;while(y<n.length){while(y<n.length&&/\s/.test(n[y]))y++;if(y>=n.length)return!0;if(n.startsWith("//",y)){let c=n.indexOf(`
6
+ `,y);y=c===-1?n.length:c;continue}if(n.startsWith("/*",y)){let c=n.indexOf("*/",y+2);if(c===-1)return!0;y=c+2;continue}return!1}return!0}function X(n){let y=[];for(let c of n.split(",")){let i=c.replace(/\/\*[\s\S]*?\*\//g,"").trim().replace(/^type\s+/,"");if(!i)continue;let f=i.match(/^([\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!f)continue;y.push({local:f[1],exported:f[2]??f[1]})}return y}var ie=/^(?:export\s+)?(default\s+)?(?:declare\s+)?(abstract\s+)?(class|interface|type|function\s*\*?|enum|const\s+enum|namespace|module|const|let|var|async\s+function)\b\s*([\w$]+)?/;function oe(n,y){let c=n.replace(/^export\s+/,""),i=/^default\s+/.test(c);if(c=c.replace(/^default\s+/,""),i)c=c.replace(/^((?:declare\s+)?(?:abstract\s+)?(?:class|function\s*\*?|async\s+function\s*\*?))\s*(?=[(<{])/,(f,h)=>`${h.trimEnd()} ${y}`);if(/^(?:interface|type)\b/.test(c)||/^declare\b/.test(c))return c;return`declare ${c}`}function F(n,y,c=!1){let i={file:n,declarations:[],declared:new Set,imports:new Map,localExports:new Map,namedReExports:[],starReExports:[],namespaceReExports:[],verbatim:[],augmentations:[],directives:[]},f=c?Pt(y,n).map((h)=>({text:h.text,comments:[...h.leadingComments??[]]})):bo(y);for(let h of f){h.comments=h.comments.filter((w)=>{if(/^\/\/\/\s*</.test(w))return i.directives.push(...w.split(`
7
+ `).map((v)=>v.trim()).filter((v)=>v.startsWith("///"))),!1;return!0});let S=h.text.replace(/;\s*$/,"").trim(),l=S.startsWith("import")?b(S):null;if(l&&!l.isImportEquals){let w=l.source;if(l.defaultName)i.imports.set(l.defaultName,{specifier:w,imported:"default"});if(l.namespaceName)i.imports.set(l.namespaceName,{specifier:w,imported:"*"});for(let v of l.namedItems)i.imports.set(v.name,{specifier:w,imported:/^['"]/.test(v.originalName)?d(v.originalName):v.originalName});continue}if(/^import\s+['"]/.test(S)){i.verbatim.push(h);continue}let E=S.match(/^export\s+(?:type\s+)?\*\s+as\s+([\w$]+)\s+from\s+(['"])([^'"]+)\2/);if(E){i.namespaceReExports.push({specifier:E[3],exported:E[1]});continue}if(E=S.match(/^export\s+(?:type\s+)?\*\s+from\s+(['"])([^'"]+)\1/),E){i.starReExports.push(E[2]);continue}if(E=S.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}\s+from\s+(['"])([^'"]+)\2/),E){for(let w of X(E[1]))i.namedReExports.push({specifier:E[3],imported:w.local,exported:w.exported});continue}if(E=S.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}$/),E){for(let w of X(E[1]))i.localExports.set(w.exported,w.local);continue}if(E=S.match(/^export\s+default\s+([\w$]+)$/),E&&ne.test(E[1])){i.localExports.set("default",E[1]);continue}let R=J(S);if(R?.specifier!==void 0&&W(y)){i.augmentations.push({statement:h,specifier:R.specifier,body:R.body});continue}if(/^export\s+as\s+namespace\b/.test(S)||R){i.verbatim.push(h);continue}let a=S.match(ie);if(a){let w=!!a[1],v=a[4]??(w?"_default":null);if(v){if(i.declared.add(v),/^export\s/.test(S))i.localExports.set(w?"default":v,v);i.declarations.push({statement:h,name:v,emit:oe(h.text,v)});continue}}i.declarations.push({statement:h,name:null,emit:h.text})}return i}function Ue(n,y){if(y.size===0)return n;let c=t(n),i=new Map(c.filter((m)=>m.kind==="literal").map((m)=>[m.start,m.end])),f=(m)=>c[m]?n.slice(c[m].start,c[m].end):"",h=new Map,S=[];for(let m=0;m<c.length;m++){let x=f(m);if(["(","[","{","<"].includes(x))S.push(m);else if([")","]","}",">"].includes(x)&&!(x===">"&&f(m-1)==="=")){let k=S.at(-1);if(k!==void 0&&["()","[]","{}","<>"].includes(f(k)+x))S.pop(),h.set(k,m)}}let l=(m)=>{for(let x=m;x<c.length;x++){if([";",",",")","]","}"].includes(f(x))||f(x)===">"&&f(x-1)!=="=")return x;let k=h.get(x);if(k!==void 0)x=k}return c.length},E=new Set;for(let m=0;m<c.length;m++){let x=h.get(m);if(f(m)!=="<"||x===void 0)continue;let k=["class","interface","type"].includes(f(m-2));if(!k&&f(x+1)!=="(")continue;let N=new Set;for(let u=m+1;u<x;u++){if(u===m+1||f(u-1)===","){while(["const","in","out"].includes(f(u)))u++;if(c[u]?.kind==="word")N.add(f(u))}let D=h.get(u);if(D!==void 0)u=D}let I=l(x+1);if(k&&f(m-2)!=="type")for(let u=x+1;u<c.length;u++){if(f(u)==="{"){I=h.get(u)??I;break}let D=h.get(u);if(D!==void 0)u=D}for(let u=m+1;u<I;u++){let D=f(m-2)==="class"&&u>x&&f(u-1)==="extends";if(N.has(f(u))&&f(u-1)!=="typeof"&&!D)E.add(c[u].start)}}for(let m=0;m<c.length;m++){if(!["namespace","module"].includes(f(m))||c[m+1]?.kind!=="word"||f(m+2)!=="{")continue;let x=h.get(m+2);if(x===void 0)continue;let k=Pt(n.slice(c[m+2].end,c[x].start),"bundle-namespace.ts"),N=new Set(k.filter((u)=>["class","interface","type","enum","module","namespace"].includes(u.kind)).map((u)=>u.name)),I=new Set(k.filter((u)=>["class","variable","function","enum","module","namespace"].includes(u.kind)).map((u)=>u.name));for(let u=m+3;u<x;u++)if((f(u-1)==="typeof"?I:N).has(f(u)))E.add(c[u].start)}let R="",a=0,w=n.length,v=`
8
+ `;while(a<w){let m=i.get(a);if(m!==void 0){R+=n.slice(a,m),a=m,v="`";continue}let x=n[a];if(x==="/"&&n[a+1]==="*"){let k=n.indexOf("*/",a+2),N=k===-1?w:k+2;R+=n.slice(a,N),a=N;continue}if(x==="/"&&n[a+1]==="/"){let k=n.indexOf(`
9
+ `,a),N=k===-1?w:k;R+=n.slice(a,N),a=N;continue}if(x==="'"||x==='"'){let k=a+1;while(k<w&&n[k]!==x&&n[k]!==`
10
+ `){if(n[k]==="\\")k++;k++}R+=n.slice(a,k+1),a=k+1,v=x;continue}if(/[A-Z_$]/i.test(x)){let k=a+1;while(k<w&&/[\w$]/.test(n[k]))k++;let N=n.slice(a,k),I=y.get(N);if(I!==void 0&&v!=="."&&!E.has(a)){let u=k;while(u<w&&(n[u]===" "||n[u]==="\t"))u++;let D=(n[u]===":"||n[u]==="?"&&n[u+1]===":")&&/[{;,(\n]/.test(v);R+=D?N:I}else R+=N;v="a",a=k;continue}if(R+=x,x===`
11
+ `||!/\s/.test(x))v=x;a++}return R}function hn(n,y,c,i){let f=[],h=new Map,S=[n,...y.filter((e)=>e!==n)];for(let e of S){let s=c.get(e);if(s===void 0){f.push(`No declarations were generated for ${O(i.cwd,e)}; it is left out of the bundle`);continue}h.set(e,F(e,s))}let l=(e,s)=>{if(!e.startsWith(".")&&!e.startsWith("/"))return null;let o=Y(e,s).resolved;return o&&h.has(o)?o:null},E=(e)=>e.startsWith(".")||e.startsWith("/"),R=new Set,a=(e)=>{let s=e;for(let o=1;R.has(s);o++)s=`${e}_${o}`;return R.add(s),s},w=new Map;for(let[e,s]of h){let o=new Map;for(let g of s.declared)o.set(g,a(g));w.set(e,o)}let v=new Map,m=(e,s,o)=>{let g=`${e}\x00${s}`,r=v.get(g);if(!r)r=a(o),v.set(g,r);return r},x=new Map,k=new Map,N=new Set,I=new Map,u=!0,D=(e,s,o)=>{let g=l(s,e.file);if(g){if(o==="*")return{kind:"namespace",file:g};let r=L(g).get(o);if(!r&&!u)f.push(`${O(i.cwd,e.file)}: '${o}' is not exported by '${s}'`);return r??null}if(E(s))return f.push(`${O(i.cwd,e.file)}: '${s}' is not part of the bundle`),null;return o==="*"?{kind:"external-namespace",source:s}:{kind:"external",source:s,imported:o}},ee=(e,s)=>{if(e.declared.has(s))return{kind:"local",name:w.get(e.file).get(s)};let o=e.imports.get(s);if(o)return D(e,o.specifier,o.imported);return f.push(`${O(i.cwd,e.file)}: cannot resolve exported name '${s}'`),null};function L(e){let s=x.get(e);if(s)return s;let o=new Map,g=h.get(e);if(!g||N.has(e))return o;N.add(e);let r=new Set;for(let[p,M]of g.localExports){let B=ee(g,M);if(B)o.set(p,B)}for(let p of g.namedReExports){let M=D(g,p.specifier,p.imported);if(M)o.set(p.exported,M)}for(let p of g.namespaceReExports){let M=D(g,p.specifier,"*");if(M)o.set(p.exported,M)}for(let p of g.starReExports){let M=l(p,e);if(M){for(let[B,C]of L(M))if(B!=="default"&&!o.has(B))o.set(B,C);for(let B of k.get(M)??[])r.add(B)}else if(E(p))f.push(`${O(i.cwd,e)}: '${p}' is not part of the bundle`);else r.add(p)}for(let[p,M]of I.get(e)??[])o.set(p,M);return N.delete(e),x.set(e,o),k.set(e,r),o}for(let[e,s]of h)for(let o of s.augmentations){let g=l(o.specifier,e);if(!g)continue;for(let r of F(e,o.body,!0).declared){if(L(g).has(r))continue;let p=I.get(g);if(!p)p=new Map,I.set(g,p);p.set(r,{kind:"local",name:a(r)}),x.clear()}}u=!1,x.clear(),k.clear();let Q=new Map,H=[],T=(e,s)=>{switch(e.kind){case"local":return e.name;case"external":return m(e.source,e.imported,e.imported==="default"?s:e.imported);case"external-namespace":return m(e.source,"*",s);case"namespace":return te(e.file,s)}};function te(e,s){let o=Q.get(e);if(o)return o;let g=a(s);Q.set(e,g);let r=[];for(let[p,M]of L(e)){if(p==="default")continue;let B=T(M,p);r.push(B===p?p:`${B} as ${p}`)}if(k.get(e)?.size)f.push(`${O(i.cwd,e)}: 'export * from' an external module cannot be expressed inside namespace '${g}'`);return H.push(`declare namespace ${g} {
12
+ export { ${r.join(", ")} };
13
+ }`),g}let U=[],A=[],Z=new Set;for(let[e,s]of h){for(let r of s.directives)Z.add(r);let o=new Map;for(let[r,p]of w.get(e))if(r!==p)o.set(r,p);for(let[r,p]of s.imports){if(s.declared.has(r))continue;let M=D(s,p.specifier,p.imported);if(!M)continue;let B=T(M,r);if(B!==r)o.set(r,B)}let g=[];for(let r of s.declarations){if(i.keepComments)g.push(...r.statement.comments);let p=Ue(r.emit,o);if(!/[;}]$/.test(p))p+=";";g.push(p)}for(let r of s.verbatim){if(i.keepComments)A.push(...r.comments);let p=J(r.text);if(p){let M=new Map(o);for(let B of F(e,p.body,!0).declared)M.delete(B);A.push(r.text.slice(0,p.start)+Ue(p.body,M)+r.text.slice(p.end))}else{let M=t(r.text),B=M[1]?.kind==="quoted"?d(r.text.slice(M[1].start,M[1].end)):void 0;if(B===void 0||!l(B,e))A.push(Ue(r.text,o))}}for(let r of s.augmentations){let p=l(r.specifier,e),M=F(e,r.body,!0),B=new Map(o);if(!p){for(let P of M.declared)B.delete(P);let C=J(r.statement.text);if(i.keepComments)A.push(...r.statement.comments);A.push(r.statement.text.slice(0,C.start)+Ue(C.body,B)+r.statement.text.slice(C.end));continue}for(let[C,P]of L(p))B.set(C,T(P,C));if(i.keepComments)g.push(...r.statement.comments);for(let C of M.declarations){if(!C.name||!L(p).has(C.name))throw Error(`Cannot link augmentation '${r.specifier}' member '${C.name??C.emit}'`);if(i.keepComments)g.push(...C.statement.comments);g.push(Ue(C.emit,B))}}if(g.length>0)U.push(`// From: ${O(i.cwd,e)}
14
+ ${g.join(`
15
+ `)}`)}let V=L(n),G=[],q=[];for(let[e,s]of V){if(s.kind==="external"){q.push(`export { ${s.imported===e?e:`${s.imported} as ${e}`} } from '${s.source}';`);continue}if(s.kind==="external-namespace"){q.push(`export * as ${e} from '${s.source}';`);continue}let o=T(s,e==="default"?"_default":e);G.push(o===e?e:`${o} as ${e}`)}for(let e of k.get(n)??[])q.push(`export * from '${e}';`);let K=new Map;for(let[e,s]of v){let[o,g]=e.split("\x00"),r=K.get(o)??{named:[],defaults:[],namespaces:[]};if(K.set(o,r),g==="*")r.namespaces.push(s);else if(g==="default")r.defaults.push(s);else r.named.push(g===s?s:`${g} as ${s}`)}let _=[];for(let[e,s]of[...K].sort(([o],[g])=>o.localeCompare(g))){for(let o of s.defaults)_.push(`import ${o} from '${e}';`);for(let o of s.namespaces)_.push(`import * as ${o} from '${e}';`);if(s.named.length>0)_.push(`import { ${s.named.join(", ")} } from '${e}';`)}let j=[];if(Z.size>0)j.push([...Z].join(`
16
+ `));if(j.push(`/**
17
+ * Bundled TypeScript declarations
18
+ * Generated from ${h.size} source files
19
+ */`),_.length>0)j.push(_.join(`
20
+ `));if(j.push(...U),H.length>0)j.push(H.join(`
21
+ `));if(A.length>0)j.push(A.join(`
22
+ `));let z=[];if(G.length>0)z.push(`export { ${G.join(", ")} };`);if(z.push(...q),z.length===0)z.push("export {};");return j.push(z.join(`
23
+ `)),{content:`${j.join(`
24
+
25
+ `)}
26
+ `,files:[...h.keys()],exportCount:V.size,warnings:f}}
27
+ export{bo,Ue,hn};
@@ -0,0 +1,29 @@
1
+ // @bun
2
+ import{f,Pe}from"./chunk-cv29b4zb.js";import{Rt,Mt,n,Ae,j}from"./chunk-8d3sdkv4.js";function g(t){if(t.includes(`
3
+ `))return`/**
4
+ * ${t}
5
+ */
6
+ `;return`/** ${t} */
7
+ `}function D(t){let o=t.indexOf("{");if(o===-1)return-1;let s=t.indexOf("<");if(s===-1||s>o)return o;let e=0,r=!1,a="";for(let i=0;i<t.length;i++){let l=t[i],u=i>0?t[i-1]:"";if(!r&&(l==='"'||l==="'"||l==="`"))r=!0,a=l;else if(r&&l===a&&u!=="\\")r=!1;if(!r){if(l==="<")e++;else if(l===">")e--;else if(l==="{"&&e===0)return i}}return-1}function ee(t,o=!0){return f(t.leadingComments,o)+t.text}function h(t,o=!0){if(t.inferenceError)throw Object.assign(Error(`Cannot infer alias '${t.name}': unsupported source value flow`),{code:t.inferenceError});let s=f(t.leadingComments,o);if(!t.typeAnnotation&&t.inferredType)return s+t.text;if(t.typeAnnotation&&!t.value)return s+t.text;let e="";if(t.isExported)e+="export ";e+="declare ";let r=t.modifiers?.[0]||"const";e+=`${r} `,e+=t.name;let{typeAnnotation:a,value:i}=t,l=!a&&i?j(i):null;if(l)a=l;else if(!a&&i&&i.trim().endsWith("as const"))a=n(i,!0,!1,0,t.computedKeyConstants);else if(!a&&i&&r==="const"){let c=i.trim(),m=c.startsWith("{")||c.startsWith("[");if(m)Rt();a=n(i,!m,!1,0,t.computedKeyConstants)}else if(!a&&i)a=n(i,r==="const",!1,0,t.computedKeyConstants);if(!a)a="unknown";let u="";if(o&&i&&!t.typeAnnotation&&!i.trim().endsWith("as const")){let c=i.trim();if(r!=="const"){if((a==="string"||a==="number"||a==="boolean")&&c.length>0)u=`@defaultValue ${c}`}else if(c.startsWith("{")||c.startsWith("[")){let m=Mt();if(m)if(m.includes(`
8
+ `))u=`@defaultValue
9
+ * \`\`\`ts
10
+ ${m.split(`
11
+ `).map((p)=>` * ${p}`).join(`
12
+ `)}
13
+ * \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&Ae(t.typeAnnotation)){Rt();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let x=Mt();if(x)if(x.includes(`
14
+ `))u=`@defaultValue
15
+ * \`\`\`ts
16
+ ${x.split(`
17
+ `).map((d)=>` * ${d}`).join(`
18
+ `)}
19
+ * \`\`\``;else u=`@defaultValue \`${x}\``}if(u=Pe(u),e+=`: ${a};`,u&&s&&s.includes("@defaultValue"))u="";if(u&&s){let c=s.trimEnd(),m=c.lastIndexOf("*/");if(m!==-1){let p=c.slice(0,m).trimEnd();if(p.startsWith("/** ")&&!p.includes(`
20
+ `))p=`/**
21
+ * ${p.slice(4)}`;return`${p}
22
+ * ${u}
23
+ */
24
+ `+e}return`/**
25
+ * ${c.replace(/^\/\/\s*/,"")}
26
+ * ${u}
27
+ */
28
+ ${e}`}if(u)return`${g(u)}${e}`;return s+e}function te(t,o=!0){let s=f(t.leadingComments,o),e=t.text;if(e.startsWith("export declare interface")||e.startsWith("declare interface"))return s+e;let r="";if(t.isExported)r+="export ";if(r+="declare interface ",r+=t.name,t.generics)r+=t.generics;if(t.extends)r+=` extends ${t.extends}`;let a=D(t.text);if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}function ne(t,o=!0){let s=f(t.leadingComments,o);if(t.text.includes("{")&&t.text.includes("}")&&t.text.includes("from"))return s+t.text;let e="";if(t.isExported)e+="export ";if(!t.isExported&&!t.text.includes(" from "))e+="declare ";let r=t.text.indexOf("type ");if(r!==-1){let i=t.text.slice(r),l=i.length;while(l>0&&(i.charCodeAt(l-1)===59||i.charCodeAt(l-1)===32||i.charCodeAt(l-1)===10||i.charCodeAt(l-1)===13))l--;if(l<i.length)i=i.slice(0,l);e+=i}else{if(e+=`type ${t.name}`,t.generics)e+=t.generics;e+=" = any"}let a=e.trimEnd();if(!a.endsWith(";")&&!a.endsWith("}"))e+=";";return s+e}function re(t,o=!0){return f(t.leadingComments,o)+t.text}function ie(t,o=!0){let s=f(t.leadingComments,o),e="";if(t.isExported)e+="export ";if(e+="declare ",t.modifiers?.includes("const"))e+="const ";e+="enum ",e+=t.name;let r=t.text.indexOf("{");if(r!==-1)e+=` ${t.text.slice(r)}`;else e+=" {}";return s+e}function On(t){let o=t.text.trim(),s=o.length;while(s>0&&o.charCodeAt(s-1)===59)s--;if(s<o.length)o=o.slice(0,s);return o+=";",o}function In(t,o=!0){return f(t.leadingComments,o)+t.text.trim()}function se(t,o=!0){let s=f(t.leadingComments,o);if(t.text.startsWith("declare global"))return s+t.text;if(t.source||(t.name.startsWith('"')||t.name.startsWith("'")||t.name.startsWith("`"))){let i="declare module ";i+=t.name;let l=t.text.indexOf("{");if(l!==-1)i+=` ${t.text.slice(l)}`;else i+=" {}";return s+i}let r="";if(t.isExported)r+="export ";if(!t.modifiers?.includes("declare"))r+="declare ";r+="namespace ",r+=t.name;let a=t.text.indexOf("{");if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}
29
+ export{ee,h,te,ne,re,ie,On,In,se};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{t,d,x}from"./chunk-1j6092xz.js";import{w}from"./chunk-32qexm3w.js";function q(n){return typeof n==="string"?x(n,"'"):String(n)}function aa(n,k,m=new Map){let o=t(n),e=new Map(m),i=new Map,f=[],c=1,p=0,A=0;for(let r=1;r<o.length;r++){let v=o[r],h=n.slice(v.start,v.end);if(v.kind==="punctuation"&&p===0&&(h===","||h==="}")){let l=o.slice(c,r),a=l[0];if(a){let u=a.kind==="quoted"?d(n.slice(a.start,a.end)):n.slice(a.start,a.end),M=l.findIndex((g)=>g.kind==="punctuation"&&n[g.start]==="="),s=A;if(M>=0){let g=l.slice(M+1),b="",S=l[M].end;for(let y=0;y+2<g.length;y++){let[B,E,C]=g.slice(y,y+3);if(B.kind!=="word"||C.kind!=="word"||n.slice(E.start,E.end)!==".")continue;let D=e.get(`${n.slice(B.start,B.end)}.${n.slice(C.start,C.end)}`);if(D===void 0||typeof D==="object")continue;b+=n.slice(S,B.start)+q(D),S=C.end,y+=2}b+=n.slice(S,l.at(-1).end),s=w(b,e),f.push({start:l[M].start,end:l.at(-1).end,text:s===void 0?"":`= ${q(s)}`})}else if(s!==void 0)f.push({start:a.end,end:a.end,text:` = ${q(s)}`});if(A=typeof s==="number"?s+1:void 0,u!==void 0){if(e.delete(u),e.delete(`${k}.${u}`),s!==void 0)i.set(u,s),e.set(u,s),e.set(`${k}.${u}`,s)}}c=r+1}else if(v.kind==="punctuation"){if("([{".includes(h))p++;else if(")]}".includes(h))p--}}let K=n;for(let r of f.reverse())K=K.slice(0,r.start)+r.text+K.slice(r.end);return{body:K,members:i}}function Mn(n,k){let m=[...new Set([...n,...k.values()])];if(!m.some((e)=>e.kind==="enum"))return;m.sort((e,i)=>(e.start??0)-(i.start??0));let o=new Map;for(let e of m)if(e.kind==="enum"){let i=e.text.indexOf("{");if(i<0)continue;if(t(e.text.slice(0,i)).some((c)=>e.text.slice(c.start,c.end)==="declare"))continue;let f=aa(e.text.slice(i),e.name,o);e.text=e.text.slice(0,i)+f.body;for(let[c,p]of f.members)o.set(`${e.name}.${c}`,p)}else if(e.kind==="variable"&&e.modifiers?.[0]==="const"&&!e.typeAnnotation&&!e.modifiers.includes("const assertion")&&typeof e.value==="string"){let i=w(e.value,o);if(i!==void 0)o.set(e.name,i)}}
3
+ export{aa,Mn};
@@ -0,0 +1,6 @@
1
+ // @bun
2
+ import{e,A}from"./chunk-yay68832.js";import{ve}from"./chunk-cpmqa8kd.js";import{s}from"./chunk-0zfzhn19.js";import{existsSync as u,readFileSync as w}from"fs";import{dirname as W,join as d,resolve as v}from"path";async function jr(i){let c=[],n=new Set;async function t(a,f){let o=v(a);if(n.has(o))return;if(n.add(o),!u(o)){e.warn(`tsconfig not found: ${o}`);return}try{let p=w(o,"utf-8"),r=JSON.parse(ve(p)),l=W(o),g=P(l,f),m=[];if(r.references)for(let y of r.references){let h=v(l,y.path),C=u(d(h,"tsconfig.json"))?d(h,"tsconfig.json"):h;await t(C,g);let G=P(W(C),g);m.push(G)}let j="./src";if(r.compilerOptions?.rootDir)j=r.compilerOptions.rootDir;else if(r.include&&r.include.length>0){if(r.include[0].startsWith("src/"))j="./src"}let k="./dist";if(r.compilerOptions?.outDir)k=r.compilerOptions.outDir;else if(r.compilerOptions?.declarationDir)k=r.compilerOptions.declarationDir;c.push({name:g,root:l,tsconfigPath:o,references:m,config:{root:j,outdir:k}})}catch(p){let r=p instanceof Error?p.message:String(p);e.warn(`Failed to parse ${o}: ${r}`)}}return await t(i),c}function P(i,c){let n=d(i,"package.json");if(u(n))try{let a=w(n,"utf-8"),f=JSON.parse(a);if(f.name)return f.name}catch{}let t=i.split("/").pop()||"unknown";return c?`${c}/${t}`:t}function _r(i){let c=new Map(i.map((o)=>[o.name,o])),n=[],t=new Set,a=new Set;function f(o){if(t.has(o))return;if(a.has(o)){e.warn(`Circular dependency detected involving: ${o}`);return}a.add(o);let p=c.get(o);if(p){for(let r of p.references)f(r);n.push(p)}a.delete(o),t.add(o)}for(let o of i)f(o.name);return n}async function nn(i){let c=Date.now(),n=_r(i.projects);e.info(`Generating declarations for ${n.length} projects...`);let t=[],a=!0;for(let r of n){e.info(`
3
+ [${r.name}] Generating...`);try{let l={...i.sharedConfig,...r.config,cwd:r.root,tsconfigPath:r.tsconfigPath},g=await s(l),m=g.filesFailed===0;if(!m)a=!1;t.push({name:r.name,stats:g,success:m}),e.info(`[${r.name}] Generated ${g.filesGenerated} files`)}catch(l){a=!1;let g=l instanceof Error?l.message:String(l);t.push({name:r.name,stats:{generationMode:r.config?.isolatedDeclarations||i.sharedConfig?.isolatedDeclarations?"isolated":"semantic",filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},success:!1,error:g}),e.error(`[${r.name}] Failed: ${g}`)}}let f=Date.now()-c,o=t.filter((r)=>r.success).length,p=t.length-o;if(e.info(`
4
+ --- Workspace Generation Summary ---`),e.info(`Projects processed: ${t.length}`),e.info(`Successful: ${o}`),p>0)e.info(`Failed: ${p}`);return e.info(`Total duration: ${f}ms`),e.info(`------------------------------------
5
+ `),{success:a,projects:t,durationMs:f}}async function qs(i,c){if(c?.logLevel)A(c.logLevel);let n=d(i,"tsconfig.json");if(!u(n))throw Error(`Root tsconfig.json not found at: ${n}`);e.info("Discovering workspace projects...");let t=await jr(n);if(t.length===0)return e.warn("No projects found in workspace"),{success:!0,projects:[],durationMs:0};return e.info(`Found ${t.length} projects`),nn({root:i,projects:t,sharedConfig:c})}async function Gr(i){let c=d(i,"package.json");if(!u(c))return[];try{let n=w(c,"utf-8"),t=JSON.parse(n),a=[];if(Array.isArray(t.workspaces))a=t.workspaces;else if(t.workspaces?.packages)a=t.workspaces.packages;return a}catch{return[]}}async function Vr(i,c){let{Glob:n}=await Promise.resolve(globalThis.Bun),t=[];for(let a of c){let f=new n(a);for await(let o of f.scan({cwd:i,absolute:!0,onlyFiles:!1})){let p=d(o,"package.json");if(u(p))t.push(o)}}return t}async function Js(i,c){if(c?.logLevel)A(c.logLevel);let n=await Gr(i);if(n.length===0)return e.warn("No workspace patterns found in package.json"),{success:!0,projects:[],durationMs:0};e.info(`Found workspace patterns: ${n.join(", ")}`);let t=await Vr(i,n);if(t.length===0)return e.warn("No projects found matching workspace patterns"),{success:!0,projects:[],durationMs:0};e.info(`Found ${t.length} workspace packages`);let a=t.map((f)=>{let o=d(f,"tsconfig.json");return{name:P(f),root:f,tsconfigPath:u(o)?o:"",references:[]}});return nn({root:i,projects:a,sharedConfig:c})}
6
+ export{jr,_r,nn,qs,Gr,Vr,Js};
@@ -0,0 +1,10 @@
1
+ // @bun
2
+ import{W,jn,_n}from"./chunk-ag1b6d30.js";import{dn}from"./chunk-zk3w5sqv.js";import{f}from"./chunk-cv29b4zb.js";import{ee,h,te,ne,re,ie,se}from"./chunk-xa6rsd4b.js";import{Ee,b}from"./chunk-vf3ybe5r.js";import{xe}from"./chunk-4fygcxtb.js";function V(k,x){throw Error(x||`Unexpected value: ${k}`)}var j=null,q=[],z=[];function l(k,x,d=!0,y=["bun"]){let o="",m=x.sourceCode;if(m){let e=0;while(e<m.length&&(m.charCodeAt(e)===32||m.charCodeAt(e)===9||m.charCodeAt(e)===10||m.charCodeAt(e)===13))e++;if(e<m.length-2&&m.charCodeAt(e)===47&&m.charCodeAt(e+1)===47&&m.charCodeAt(e+2)===47){let i=dn(m);if(i.length>0)for(let r=0;r<i.length;r++){if(o)o+=`
3
+ `;o+=i[r]}}}let w=[],N=[],M=[],P=[],U=[],_=[],F=[],C=[],T=[];for(let e of k){let i=e.kind;switch(i){case"import":w.push(e);break;case"function":N.push(e);break;case"variable":M.push(e);break;case"interface":P.push(e);break;case"type":U.push(e);break;case"class":_.push(e);break;case"enum":F.push(e);break;case"module":C.push(e);break;case"export":T.push(e);break;case"namespace":C.push(e);break;case"unknown":break;default:V(i,`Unhandled declaration kind: ${i}`)}}let S=[],v=[],A=[],K=new Set;for(let e of T){let i=f(e.leadingComments,d);if(e.text.startsWith("export default")){let r=e.text.endsWith(";")?e.text:`${e.text};`;A.push(i+r)}else{let r=e.text.trim();if(!r.endsWith(";"))r+=";";let a=i+r;if(!K.has(a))if(K.add(a),a.includes("export type"))S.push(a);else v.push(a)}}let u=[];if(w.length>0){let{usedItems:e}=xe(k);for(let r of w){if(r.isSideEffect){let t=r.text.trim(),p=t.endsWith(";")?t:`${t};`;u.push(p);continue}let a=b(r.text);if(!a)continue;let{defaultName:s,namedItems:n,isTypeOnly:g,namespaceName:c}=a,D=s?e.has(s):!1,L=c?e.has(c):!1;if(a.isImportEquals){if(D){let t=r.text.trim();u.push(t.endsWith(";")?t:`${t};`)}else if(x.augmentationImports?.has(a.source)){let t=Ee(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}continue}let I="",E=0;for(let t=0;t<n.length;t++){let p=n[t];if(e.has(p.name)){if(E>0)I+=", ";if(!g&&p.isTypeOnly)I+="type ";I+=p.originalName===p.name?p.name:`${p.originalName} as ${p.name}`,E++}}if(D||L||E>0){let t=g?"import type ":"import ";if(L&&c){if(D&&s)t+=`${s}, `;t+=`* as ${c}`}else if(D&&s)t+=E>0?`${s}, { ${I} }`:s;else if(E>0)t+=`{ ${I} }`;let p=Ee(r.text);if(!p)throw Error("Cannot locate a grammatical module literal in the import declaration");t+=` from ${p};`,u.push(t)}else if(x.augmentationImports?.has(a.source)){let t=Ee(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}}let i=y.length;if(u.length>1){if(j!==y)j=y,q=y.map((n)=>`from '${n}`),z=y.map((n)=>`from "${n}`);let r=q,a=z,s=new Map;for(let n of u){let g=i;for(let c=0;c<y.length;c++)if(n.includes(r[c])||n.includes(a[c])){g=c;break}s.set(n,g)}u.sort((n,g)=>{let c=s.get(n),D=s.get(g);return c!==D?c-D:n.localeCompare(g)})}}for(let e=0;e<u.length;e++){if(o)o+=`
4
+ `;o+=u[e]}for(let e=0;e<S.length;e++){if(o)o+=`
5
+ `;o+=S[e]}let G=[N,M,P,U,_,F,C];for(let e=0;e<G.length;e++){let i=G[e];for(let r=0;r<i.length;r++){let a=i[r],s="",n=a.kind;switch(n){case"function":s=ee(a,d);break;case"variable":s=h(a,d);break;case"interface":s=te(a,d);break;case"type":s=ne(a,d);break;case"class":s=re(a,d);break;case"enum":s=ie(a,d);break;case"module":case"namespace":s=se(a,d);break;case"import":case"export":case"unknown":break;default:V(n,`Unhandled declaration kind in processor: ${n}`)}if(s){if(o)o+=`
6
+ `;o+=s}}}for(let e=0;e<v.length;e++){if(o)o+=`
7
+ `;o+=v[e]}for(let e=0;e<A.length;e++){if(o)o+=`
8
+ `;o+=A[e]}if(T.length===0&&W(x.sourceCode)&&(k.some(_n)||!jn(o)))o+=`${o?`
9
+ `:""}export {};`;return o}
10
+ export{l};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{E}from"./chunk-ebjafajx.js";import{H}from"./chunk-7tremqhs.js";import{z,de}from"./chunk-kfk554fj.js";import{vn}from"./chunk-96atbsd3.js";import{spawn as N}from"child_process";var x=new Set(["cwd","root","outdir","entrypoints","include","exclude","autoIncludeReExports","outputStructure","tsconfigPath","moduleSpecifierMode","keepComments","isolatedDeclarations","clean","lineEnding"]);function y(l,f,d,n,u){let s=u.signal;s?.throwIfAborted();let c=u.timeoutMs??30000;if(!Number.isSafeInteger(c)||c<=0||c>2147483647)throw RangeError("Native project timeoutMs must be an integer between 1 and 2147483647");return new Promise((g,r)=>{let o=N(l,f,{cwd:n,stdio:["pipe","pipe","pipe"],windowsHide:!0}),i=[],a=[],e,h,v=!1,p=(t)=>{e??=t,o.kill()},m=()=>p(s?.reason instanceof Error?s.reason:Error("Native declaration project aborted",{cause:s?.reason})),j=setTimeout(()=>p(Error(`Native declaration project exceeded ${c}ms`)),c),b=(t,w)=>{if(v)return;if(v=!0,clearTimeout(j),s?.removeEventListener("abort",m),t)r(t);else g(w)};if(o.once("error",(t)=>b(t)),o.stdout.on("data",(t)=>i.push(Buffer.from(t))),o.stderr.on("data",(t)=>a.push(Buffer.from(t))),o.stdout.once("error",p),o.stderr.once("error",p),o.stdin.once("error",(t)=>{h??=t}),o.once("close",(t,w)=>{if(t!==0&&!e)e=Error(`Native declaration project failed (${w??t}): ${Buffer.concat(a).toString("utf8")}`);b(e??h,Buffer.concat(i).toString("utf8"))}),s?.addEventListener("abort",m,{once:!0}),s?.aborted)m();o.stdin.end(Buffer.from(d,"utf8"))})}async function Si(l,f={},d={}){if(!l||l.includes("\x00"))throw Error("A native zig-dtsx executable is required");for(let i of Object.keys(f))if(!x.has(i))throw Error(`Native declaration project does not support option: ${i}`);d.signal?.throwIfAborted();let n={...E,...f};if(await z(n),n.isolatedDeclarations===void 0)n.isolatedDeclarations=await H(n);let u=await vn(n),s=["--batch"];if(!n.keepComments)s.push("--no-comments");if(n.isolatedDeclarations)s.push("--isolated-declarations");let c=JSON.stringify({protocol:"zig-dtsx-project",version:1,files:u.files.map((i)=>({source:i.source,context:i.context}))}),g=await y(l,s,c,n.cwd,d),r;try{r=JSON.parse(g)}catch(i){throw Error("Native executable did not return a valid zig-dtsx project protocol response",{cause:i})}if(!r||typeof r!=="object"||!("protocol"in r)||r.protocol!=="zig-dtsx-project"||!("version"in r)||r.version!==1||!("files"in r)||!Array.isArray(r.files)||r.files.length!==u.files.length)throw Error("Native executable returned an unsupported or incomplete project response");let o=new Map;for(let[i,a]of u.files.entries()){let e=r.files[i];if(!e||typeof e!=="object"||!("sourceFile"in e)||e.sourceFile!==a.sourceFile||!("outputFile"in e)||e.outputFile!==a.outputFile||!("sourceHash"in e)||e.sourceHash!==a.context.sourceHash||!("content"in e)||typeof e.content!=="string")throw Error(`Native executable returned a mismatched project result for ${a.sourceFile}`);o.set(a.outputFile,{content:e.content,lineEnding:n.lineEnding})}return d.signal?.throwIfAborted(),await de(n,o),Object.freeze({filesGenerated:o.size,outputFiles:Object.freeze([...o.keys()])})}
3
+ export{Si};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ var a={debug:0,info:1,warn:2,error:3,silent:4},i="info",u="[dtsx]",L=!1,l=null;function t(o){return a[o]>=a[i]}function d(){if(!L)return"";return`[${new Date().toISOString().slice(11,23)}] `}function v(o,s){let n=d();if(o||n)return[`${n}${o}`,...s];return s}function g(o,s,n){let r=v(s,n);if(l){l(o,...r);return}switch(o){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break}}function c(o){return{debug:(...n)=>{if(t("debug"))g("debug",o,n)},info:(...n)=>{if(t("info"))g("info",o,n)},warn:(...n)=>{if(t("warn"))g("warn",o,n)},error:(...n)=>{if(t("error"))g("error",o,n)},setLevel:(n)=>{i=n},getLevel:()=>i,child:(n)=>{let r=o?`${o}:${n}`:`[${n}]`;return c(r)},time:(n)=>{let r=performance.now();return()=>{let f=performance.now()-r;if(t("debug"))g("debug",o,[`${n}: ${f.toFixed(2)}ms`])}},progress:(n)=>{if(t("info"))if(typeof process<"u"&&process.stdout?.isTTY)process.stdout.write(`\r${o} ${n}`);else g("info",o,[n])}}}function ea(o={}){if(o.level)i=o.level;if(o.prefix!==void 0)u=o.prefix;if(o.timestamps!==void 0)L=o.timestamps;if(o.output)l=o.output;return c(u)}var e=c(u);function ta(o){return e.child(o)}function A(o){i=o}function na(){return i}function ra(o){u=o}function ia(o){L=o}var gi={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},setLevel:()=>{},getLevel:()=>"silent",child:()=>gi,time:()=>()=>{},progress:()=>{}};
3
+ export{ea,e,ta,A,na,ra,ia,gi};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{s}from"./chunk-0zfzhn19.js";import{mkdtemp as y,readFile as v,realpath as l,rm as x}from"fs/promises";import{tmpdir as b}from"os";import{join as p,resolve as i}from"path";function nt(r={}){if(Reflect.get(r,"declarationMap"))throw Error("dtsx: bundled declaration maps are not supported");let u=new Map,c=(t,n)=>`${i(t)}\x00${n}`;return{name:"dtsx",tsdownConfig:()=>({dts:!1}),tsdownConfigResolved(t){u.set(c(i(t.cwd??process.cwd(),t.outDir??"dist"),t.format),t)},async generateBundle(t,n){let d=u.get(c(t.dir??"dist",t.format??"es"));if(!d)throw Error("dtsx: expected a resolved tsdown build before generating declarations");let f=await l(i(r.cwd??d.cwd??process.cwd())),m=await l(i(f,r.root??d.root)),a=await y(p(b(),"dtsx-tsdown-"));try{for(let e of Object.values(n)){if(e.type!=="chunk"||!e.isEntry||!e.facadeModuleId)continue;let w=await l(e.facadeModuleId),g=e.fileName.endsWith(".cjs")?".d.cts":e.fileName.endsWith(".mjs")?".d.mts":".d.ts",o=e.fileName.replace(/\.(?:c|m)?js$/,g);if(o===e.fileName)throw Error(`dtsx: unsupported tsdown JavaScript output ${e.fileName}`);if((await s({...r,cwd:f,root:m,entrypoints:[w],outdir:a,bundle:!0,bundleOutput:o,clean:!1,dryRun:!1,outputStructure:"mirror",declarationMap:!1,moduleSpecifierMode:r.moduleSpecifierMode??"node"})).filesFailed)throw Error(`dtsx: declaration generation failed for ${e.facadeModuleId}`);this.emitFile({type:"asset",fileName:o,source:await v(p(a,o),"utf8")})}}finally{await x(a,{recursive:!0,force:!0})}}}}var ga=nt;
3
+ export{nt,ga};
@@ -0,0 +1,37 @@
1
+ // @bun
2
+ import{c,i,Oe,ce}from"./chunk-zq93f8ca.js";import{t,d,Me,m}from"./chunk-1j6092xz.js";import{Re}from"./chunk-1qtghb2x.js";import{qn}from"./chunk-42j9cfte.js";import{Vn}from"./chunk-32qexm3w.js";import{W,Gn}from"./chunk-ag1b6d30.js";import{Mn}from"./chunk-xfjfhe9d.js";import{De}from"./chunk-0rmbc5zp.js";import{n,I,Te,j}from"./chunk-8d3sdkv4.js";import{Rn}from"./chunk-cyr45de1.js";import{h}from"./chunk-xa6rsd4b.js";import{Fn}from"./chunk-ft2zk7jx.js";function bi(v,V,L,N,Y=""){let ee=new Map,f={start:0,end:v.length,header:0,name:"",children:[],results:new Map},F=t(v),de=[],C=[],se=[],R=new Map;for(let e=0;e<F.length;e++){let oe=F[e];if(oe.kind!=="punctuation")continue;let le=v.slice(oe.start,oe.end);if(le==="(")se.push(e);else if(le===")"){let ae=se.pop();if(ae!==void 0)R.set(e,ae)}else if(le==="{")C.push(e);else if(le==="}"){let ae=C.pop();if(ae===void 0)continue;let ne=F[ae].start,J=ae-1,X=J>=0?v.slice(F[J].start,F[J].end):"";if(X===")"){let G=R.get(J);if(G!==void 0&&G>0&&["if","for","while","switch","catch","with"].includes(v.slice(F[G-1].start,F[G-1].end)))ne=F[G-1].start}else if(["else","try","finally","do"].includes(X))ne=F[J].start;de.push({open:F[ae].start,close:oe.start,header:ne})}}let re=0,U=(e,oe=new Set)=>{let le=new Set(oe),ae=t(v.slice(e.start,e.end)),ne=0;for(let ie=0;ie+1<ae.length;ie++){let Be=v.slice(e.start+ae[ie].start,e.start+ae[ie].end);if(Be==="{")ne++;else if(Be==="}")ne--;else if(!ne&&["type","interface"].includes(Be))le.add(v.slice(e.start+ae[ie+1].start,e.start+ae[ie+1].end))}let J="",X=e.start,G=[...e.results].map(([ie,Be])=>({type:ie,name:Be}));for(let ie of e.children.sort((Be,Ne)=>Be.header-Ne.header)){let Be=U(ie,le);J+=v.slice(X,ie.header)+`
3
+ declare namespace ${ie.name} {
4
+ ${Be.text}
5
+ }
6
+ `,X=ie.end+1;for(let Ne of Be.exports)G.push({type:`${ie.name}.${Ne.name}`,name:Ne.name})}J+=`${v.slice(X,e.end)}
7
+ ;
8
+ ${G.map((ie)=>`export type ${ie.name} = ${ie.type};`).join(`
9
+ `)}`;let He=O(J,V,!1);for(let ie of G)le.add(ie.name);let te=Y?Tt(Y).map((ie,Be)=>[ie,`${Ae}_capture_${Be}`]):[],w=He.map((ie)=>Y&&["type","interface"].includes(ie.kind)?bn(ie,Y,te,le):(ie.kind==="variable"?h(ie,!1):ie.text).replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
10
+ `);return{declarations:He,text:w,exports:G}},Ae;return{resolve(e,oe){Ae??=L();let le=f;for(let ne of de.filter((J)=>J.open<oe&&oe<J.close).sort((J,X)=>J.open-X.open)){let J=le.children.find((X)=>X.start===ne.open+1);if(!J)J={start:ne.open+1,end:ne.close,header:ne.header,name:`${Ae}_scope_${re++}`,children:[],results:new Map},le.children.push(J);le=J}let ae=le.results.get(e);if(!ae)ae=`${Ae}_result_${ee.size}`,le.results.set(e,ae),ee.set(ae,e);return`${Ae}.${ae}`},finish(e){if(!Ae)return e;let oe=U(f),le=oe.declarations,ae=new Set(ee.keys());if(le.every((J)=>ae.has(J.name))){let J=new Map(ee),X=t(e),G="",He=0;for(let te=0;te+2<X.length;te++){if(e.slice(X[te].start,X[te].end)!==Ae||e.slice(X[te+1].start,X[te+1].end)!==".")continue;let w=J.get(e.slice(X[te+2].start,X[te+2].end));if(!w)continue;G+=e.slice(He,X[te].start)+`(${w})`,He=X[te+2].end,te+=2}return G+e.slice(He)}if(Y){let J=Tt(Y).join(", "),X=t(e),G="",He=0;for(let te=0;te+2<X.length;te++){if(e.slice(X[te].start,X[te].end)!==Ae||e.slice(X[te+1].start,X[te+1].end)!=="."||!ae.has(e.slice(X[te+2].start,X[te+2].end)))continue;G+=`${e.slice(He,X[te+2].end)}<${J}>`,He=X[te+2].end,te+=2}e=G+e.slice(He)}let ne=oe.text;return N({kind:"module",name:Ae,text:`declare namespace ${Ae} {
11
+ ${ne}
12
+ }`,moduleForm:"namespace",isExported:!1}),e}}}function Tt(v){let V=t(v),L=[],N=0,Y=0,ee=!1;for(let f of V){let F=v.slice(f.start,f.end);if(F==="<"){if(N++,N===1)ee=!0}else if(F===">"&&v[f.start-1]!=="=")N--;else if(["(","[","{"].includes(F))Y++;else if([")","]","}"].includes(F))Y--;else if(F===","&&N===1&&!Y)ee=!0;else if(ee&&f.kind==="word"&&!["const","in","out"].includes(F))L.push(F),ee=!1}return L}function bn(v,V,L,N){let Y=new Set(Tt(v.generics||"")),ee=(U,Ae,e)=>{let oe=t(U),le="",ae=0;for(let ne=0;ne<oe.length;ne++){let J=oe[ne],X=U.slice(J.start,J.end),G=oe[ne+1]&&U.slice(oe[ne+1].start,oe[ne+1].end),He=oe[ne+2]&&U.slice(oe[ne+2].start,oe[ne+2].end),te=oe[ne-1]&&U.slice(oe[ne-1].start,oe[ne-1].end);if(J.kind!=="word"||G===":"||G==="?"&&He===":")continue;let w=!e.has(X)&&te!=="."&&L.find(([ie])=>ie===X)?.[1];if(w)le+=U.slice(ae,J.start)+w,ae=J.end;else if(Ae&&N.has(X)&&!e.has(X)){let ie=L.map(([,Be])=>Be).join(", ");le+=`${U.slice(ae,J.end)}<${ie}${G==="<"?", ":">"}`,ae=G==="<"?oe[++ne].end:J.end}}return le+U.slice(ae)},f=t(v.text),F=f.findIndex((U)=>["type","interface"].includes(v.text.slice(U.start,U.end))),de=f[F+1],C=v.generics||"",se=C?v.text.indexOf(C,de.end)+C.length:de.end,R=ee(kn(V),!1,new Set),re=C?`, ${ee(C.slice(1,-1),!0,Y)}`:"";return`${v.text.slice(0,de.end)}<${R}${re}>${ee(v.text.slice(se),!0,Y)}`.replace(/^export\s+/,"").replace(/^declare\s+/,"")}function kn(v){let V=v.slice(1,-1),L=t(V),N=0,Y=0,ee=!1,f="";for(let F=0;F<L.length;F++){let de=L[F],C=V.slice(de.start,de.end);if(["(","[","{","<"].includes(C))N++;else if([")","]","}"].includes(C)||C===">"&&V[de.start-1]!=="=")N--;else if(!N&&C==="const")f+=V.slice(Y,de.start),Y=de.end;else if(!N&&C==="="&&V.slice(L[F+1]?.start,L[F+1]?.end)!==">")f+=V.slice(Y,de.start),ee=!0;else if(!N&&C===","&&ee)Y=de.start,ee=!1}return f+(ee?"":V.slice(Y))}var We=32,Le=9,me=10,ke=13,H=47,Ce=42,fe=39,pe=34,Se=96,ze=92,P=123,z=125,Z=40,ue=41,we=91,ye=93,ge=60,he=62,Q=59,Ge=58,be=61,Ke=44,Ve=46,gt=63,Yt=35,wn=64,$n=36;function Ie(v){return v===We||v===Le||v===me||v===ke}function xn(v){let V=!0;for(let L=0;L<v.length;L++){let N=v.charCodeAt(L);if(N===Ve){if(V)return!1;V=!0}else if(V){if(!c(N))return!1;V=!1}else if(!i(N))return!1}return v.length>0&&!V}function at(v,V,L){let N=V+1;while(N<v.length){let Y=v.charCodeAt(N);if(Y===ze){N+=2;continue}if(N++,Y===L)break}return N}function yn(v){if(v==="any"||v==="object"||v==="unknown")return!0;if(v.startsWith("Record<")||v.startsWith("Array<"))return!0;return v.charCodeAt(0)===P&&v.includes("[")&&v.includes("]:")}var Ot=["public","protected","private","readonly","override"];function va(v,V,L=!0,N=!1){return N?T(v,V,L):O(v,V,L)}function T(v,V,L=!0){return Et(v,V,L,!0)}function O(v,V,L=!0,N){return Et(v,V,L,!1,!1,N)}function Pt(v,V,L=!0){return Et(v,V,L,!0,!0)}function Et(v,V,L,N,Y=!1,ee){let f=v,F=L,de=N,C=f.length,se=W(f),R=[],re=new Map,U=new Map,Ae=new Set,e=0,oe=0,le=[];function ae(s){let r=/^this\.([\w$]+)$/.exec(s);if(r){let A=le.at(-1);return A?.fields.get(`${A.isStatic?"static:":""}${r[1]}`)}let o=/^([\w$]+)\s*\(/.exec(s);if(!o||!s.endsWith(")"))return;let a=t(s),l=0;for(let A=1;A<a.length;A++){let b=s.slice(a[A].start,a[A].end);if(b==="(")l++;else if(b===")"&&--l===0&&A!==a.length-1)return}let u=[...R,...re.values()].filter((A)=>A.kind==="function"&&A.name===o[1]);if(u.length!==1||u[0].generics||Re(f,o[1])!==1)return;return u[0].returnType}function ne(s){let r=s.trim(),o=ae(r);if(o)return o;if(!r.startsWith("class"))return;let a=t(r);if(a[0]?.kind!=="word"||r.slice(a[0].start,a[0].end)!=="class")return;let l;do l=`__dtsx_class_${oe++}`;while(f.includes(l));let u=a[1],A=u?r.slice(u.start,u.end):"",b=u?.kind==="word"&&!["extends","implements"].includes(A),p=b?A:`${l}_value`,g=b?`export ${r}`:`export class ${p} ${r.slice(5)}`,x=O(g,V,F),_=x.find((y)=>y.kind==="class");if(!_)throw Error("Cannot extract the class expression declaration");if(t(g.slice(_.end??g.length)).some((y)=>g.slice((_.end??0)+y.start,(_.end??0)+y.end)!==";"))return;let D=x.map((y)=>y.text.replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
13
+ `);return re.set(l,{kind:"module",name:l,text:`declare namespace ${l} {
14
+ ${D}
15
+ }`,moduleForm:"namespace",isExported:!1,start:e,end:e}),`typeof ${l}.${p}`}function J(s,r){let o=/^this\.([\w$]+)$/.exec(s);if(o)return le.at(-1)?.fields.get(`${r?"static:":""}${o[1]}`);return ne(s)}function X(s){let r=U.get(s.name);if(r)r.push(s);else U.set(s.name,[s]);re.set(s.name,s)}if(e<C&&f.charCodeAt(e)===65279)e++;function G(s,r){if(s<r){let o=f.charCodeAt(s),a=f.charCodeAt(r-1);if(o!==We&&o!==Le&&o!==me&&o!==ke&&a!==We&&a!==Le&&a!==me&&a!==ke)return f.slice(s,r)}while(s<r&&Ie(f.charCodeAt(s)))s++;while(r>s&&Ie(f.charCodeAt(r-1)))r--;return f.slice(s,r)}let He=/[\r\n]/g;function te(s){return He.lastIndex=s,He.exec(f)?.index??C}function w(){if(e>=C)return;let s=f.charCodeAt(e);if(s!==We&&s!==Le&&s!==me&&s!==ke&&s!==H)return;while(e<C){let r=f.charCodeAt(e);if(r===We||r===Le||r===me||r===ke){e++;continue}if(r===H&&e+1<C){let o=f.charCodeAt(e+1);if(o===H){e=te(e+2);continue}if(o===Ce){let a=f.indexOf("*/",e+2);e=a===-1?C:a+2;continue}}break}}function ie(s){if(s.indexOf("//")===-1&&s.indexOf("/*")===-1)return s;let r=0,o=0;while(o<s.length){let a=s.charCodeAt(o);if(a===fe||a===pe||a===Se){o=at(s,o,a),r=o;continue}if(a===ze){o+=2,r=Math.min(o,s.length);continue}if(a===H&&s.charCodeAt(o+1)===H){while(o<s.length&&s.charCodeAt(o)!==me&&s.charCodeAt(o)!==ke)o++;continue}if(a===H&&s.charCodeAt(o+1)===Ce){let l=s.indexOf("*/",o+2);o=l===-1?s.length:l+2;continue}if(o++,a>32)r=o}return r<s.length?s.slice(0,r).trimEnd():s}function Be(s){let r=s.length,o=0,a=r;for(let l=0;l<r;l++){let u=s.charCodeAt(l);if(o){if(u===ze){l++;continue}if(u===o)o=0;continue}if(u===fe||u===pe||u===Se){o=u;continue}if(u===H&&l+1<r){let A=s.charCodeAt(l+1);if(A===H){a=l;while(a>0&&(s.charCodeAt(a-1)===We||s.charCodeAt(a-1)===Le))a--;return s.slice(0,a)}if(A===Ce){let b=s.indexOf("*/",l+2);if(b!==-1){s=`${s.slice(0,l)} ${s.slice(b+2)}`,l--;continue}}}}a=r;while(a>0&&(s.charCodeAt(a-1)===We||s.charCodeAt(a-1)===Le||s.charCodeAt(a-1)===ke))a--;return a<r?s.slice(0,a):s}function Ne(s){e++;let r=s===fe?"'":'"';while(e<C){let o=f.indexOf(r,e);if(o===-1){e=C;return}let a=0,l=o-1;while(l>=0&&f.charCodeAt(l)===ze)a++,l--;if(a%2===0){e=o+1;return}e=o+1}}function st(){e++;let s=[];while(e<C){let r=f.charCodeAt(e);if(s.length===0){if(r===ze){e+=2;continue}if(r===Se){e++;return}if(r===$n&&e+1<C&&f.charCodeAt(e+1)===P){e+=2,s.push(0);continue}e++;continue}if(r===fe||r===pe){Ne(r);continue}if(r===Se){st();continue}if(r===H&&e+1<C){let o=f.charCodeAt(e+1);if(o===H){e=te(e+2);continue}if(o===Ce){let a=f.indexOf("*/",e+2);e=a===-1?C:a+2;continue}if(Rt()){Mt();continue}e++;continue}if(r===P){s[s.length-1]++,e++;continue}if(r===z){let o=s[s.length-1];if(o===0){s.pop(),e++;continue}s[s.length-1]=o-1,e++;continue}e++}}let Ct=!1;function Ee(){Ct=!1;let s=f.charCodeAt(e);if(s===fe||s===pe)return Ne(s),!0;if(s===Se)return st(),!0;if(s===H&&e+1<C){let r=f.charCodeAt(e+1);if(r===H)return e=te(e+2),!0;if(r===Ce){let o=f.indexOf("*/",e+2);return Ct=te(e+2)<(o===-1?C:o),e=o===-1?C:o+2,!0}if(Rt())return Mt(),!0}return!1}function Rt(){return Oe(f,e)}function Mt(){e=ce(f,e)}function $e(){let s=e;while(e<C&&i(f.charCodeAt(e)))e++;return f.slice(s,e)}function k(s){if(e+s.length>C)return!1;for(let r=0;r<s.length;r++)if(f.charCodeAt(e+r)!==s.charCodeAt(r))return!1;if(e+s.length<C&&i(f.charCodeAt(e+s.length)))return!1;return!0}function lt(s){let r=e+s;while(r<C){let o=f.charCodeAt(r);if(o===We||o===Le||o===me||o===ke){r++;continue}return o!==Ve&&o!==be}return!1}function At(){if(!Ct)return!1;let s=e;w();let r=e>=C||bt()||f.charCodeAt(e)===z;return e=s,r}function bt(){if(e>=C)return!1;switch(f.charCodeAt(e)){case 101:return k("export")||k("enum");case 105:return k("import")||k("interface");case 102:return k("function");case 99:return k("class")||k("const");case 116:return k("type");case 108:return k("let");case 118:return k("var");case 100:return k("declare")||k("default");case 109:return k("module");case 110:return k("namespace");case 97:return k("abstract")||k("async");default:return!1}}function Xe(){let s=f.charCodeAt(e);if(s!==me&&s!==ke)return!1;let r=e;if(e++,s===ke&&e<C&&f.charCodeAt(e)===me)e++;while(e<C){let a=f.charCodeAt(e);if(a===We||a===Le||a===ke||a===me){e++;continue}if(a===H&&e+1<C){let l=f.charCodeAt(e+1);if(l===H){e=te(e+2);continue}if(l===Ce){let u=f.indexOf("*/",e+2);e=u===-1?C:u+2;continue}}break}let o=e>=C||bt()||f.charCodeAt(e)===z;return e=r,o}function Wt(s){let r=s-1;while(r>=0){let p=f.charCodeAt(r);if(p===We||p===Le||p===ke||p===me){r--;continue}break}if(r<0)return!0;let o=f[r];if("+-*/%=<>&|^!~?:,.([{".includes(o))return!0;let a=r;while(a>0&&f.charCodeAt(a-1)!==me)a--;let l=f.slice(a,r+1),u=l.lastIndexOf("<");if(u!==-1&&/^<[A-Za-z]/.test(l.slice(u))&&!l.slice(u).includes(">"))return!0;let A=r;while(A>=0&&/[a-z]/i.test(f[A]))A--;let b=f.slice(A+1,r+1);return["as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","return","yield","void"].includes(b)}function nn(){let s=f.charCodeAt(e);if(s!==me&&s!==ke)return!1;if(Wt(e))return!1;let r=e;e++;while(e<C){let u=f.charCodeAt(e);if(u===We||u===Le||u===ke||u===me){e++;continue}if(u===H&&e+1<C){let A=f.charCodeAt(e+1);if(A===H){e=te(e+2);continue}if(A===Ce){let b=f.indexOf("*/",e+2);e=b===-1?C:b+2;continue}}break}let o=e<C?f[e]:"",a=f.slice(e,e+2),l=o==="."||o==="?"||o===":"||o===")"||o==="]"||o==="}"||o===","||o==="+"||o==="-"||o==="*"||o==="/"||o==="%"||o==="<"||o===">"||o==="="||o==="&"||o==="|"||o==="^"||o==="`"||a==="=>"||k("as")||k("satisfies")||k("instanceof")||k("in");return e=r,!l}function Lt(){let s=f.charCodeAt(e);if(s!==me&&s!==ke)return!1;if(Wt(e))return!1;let r=e;e++;while(e<C){let l=f.charCodeAt(e);if(l===We||l===Le||l===ke||l===me){e++;continue}if(l===H&&e+1<C){let u=f.charCodeAt(e+1);if(u===H){e=te(e+2);continue}if(u===Ce){let A=f.indexOf("*/",e+2);e=A===-1?C:A+2;continue}}break}let o=e<C?f[e]:"",a=o==="|"||o==="&"||o==="["||o==="."||o==="?"||o===":"||o===">"||o===")"||o===","||k("extends");return e=r,!a}function rt(){let s=f.charCodeAt(e);if(s!==me&&s!==ke)return!1;let r=e;if(e++,s===ke&&e<C&&f.charCodeAt(e)===me)e++;while(e<C){let a=f.charCodeAt(e);if(a===We||a===Le||a===ke||a===me){e++;continue}if(a===H&&e+1<C&&f.charCodeAt(e+1)===H){e=te(e+2);continue}break}if(e>=C)return e=r,!0;let o=f.charCodeAt(e);if(o===124||o===38||o===Ve||o===gt||o===Ge)return e=r,!1;if(k("extends")||k("keyof")||k("typeof")||k("infer")||k("is")||k("as")||k("in"))return e=r,!1;return e=r,!0}let sn=/[{}'"`\/]/g,rn=/[()'"`\/]/g,on=/[[\]'"`\/]/g,cn=/[<>'"`\/]/g;function ve(s,r){let o=1;e++;let a=s===P?sn:s===Z?rn:s===we?on:cn;a.lastIndex=e;let l;while((l=a.exec(f))!==null){let u=l.index,A=f.charCodeAt(u);if(A===fe||A===pe){e=u,Ne(A),a.lastIndex=e;continue}if(A===Se){e=u,st(),a.lastIndex=e;continue}if(A===H){if(e=u,Ee()){a.lastIndex=e;continue}a.lastIndex=u+1;continue}if(A===s)o++;else if(A===r){if(r===he&&u>0&&f.charCodeAt(u-1)===be){a.lastIndex=u+1;continue}if(o--,o===0)return e=u+1,e}a.lastIndex=u+1}return e=C,e}function qe(){return e>0&&f.charCodeAt(e-1)===be}function kt(){return e+1<C&&f.charCodeAt(e+1)===he}let je=/[<{};'"`\/\n\r()[\]]/g;function _e(s=!1){let r=0,o=0,a=0,l=0,u=f.charCodeAt(e)===P;je.lastIndex=e;let A;while((A=je.exec(f))!==null){let b=A.index,p=f.charCodeAt(b);if(p===fe||p===pe){e=b,Ne(p),je.lastIndex=e;continue}if(p===Se){e=b,st(),je.lastIndex=e;continue}if(p===H){if(b>0&&f.charCodeAt(b-1)===ge){je.lastIndex=b+1;continue}if(e=b,Ee()){if(r===0&&o===0&&a===0&&l===0&&At())return;je.lastIndex=e;continue}je.lastIndex=b+1;continue}if(p===ge){let g=Gt(b);if(g!==null)l=Math.max(0,l+g);je.lastIndex=b+1;continue}if(p===Z){o++,je.lastIndex=b+1;continue}if(p===ue){o--,je.lastIndex=b+1;continue}if(p===we){a++,je.lastIndex=b+1;continue}if(p===ye){a--,je.lastIndex=b+1;continue}if(p===P){r++,je.lastIndex=b+1;continue}if(p===z){let g=r>0;if(!g&&s&&o===0&&a===0&&l===0){e=b;return}if(g)r--;if((!g||u)&&r===0&&o===0&&a===0&&l===0){e=b+1;return}if(g&&r===0&&o===0&&a===0&&l===0){e=b+1;let x=e;w();let _=bt();if(e=x,_)return}je.lastIndex=b+1;continue}if(p===Q&&r===0&&o===0&&a===0&&l===0){e=b+1;return}if((p===me||p===ke)&&r===0&&o===0&&a===0&&l===0){if(e=b,Xe())return}je.lastIndex=b+1}e=C}function an(){e++;while(e<C&&(f.charCodeAt(e)===We||f.charCodeAt(e)===Le))e++;let s=f.indexOf(`
16
+ `,e),r=s===-1?C:s,o=f.indexOf(";",e);if(o!==-1&&o<r){let a=o-1;while(a>=e&&(f.charCodeAt(a)===We||f.charCodeAt(a)===Le))a--;let l=f.charCodeAt(e),u=f.charCodeAt(a);if(l===P&&u===z||l===we&&u===ye||l===fe&&u===fe||l===pe&&u===pe||l===Se&&u===Se){e=o+1;return}}_e()}function Bt(){ve(P,z);while(e<C&&Ie(f.charCodeAt(e)))e++;if(k("from")){e+=4;while(e<C&&Ie(f.charCodeAt(e)))e++;if(e<C){let s=f.charCodeAt(e);if(s===fe||s===pe)Ne(s)}}while(e<C&&(f.charCodeAt(e)===We||f.charCodeAt(e)===Le))e++;if(e<C&&f.charCodeAt(e)===Q)e++}function Ht(){e++;while(e<C&&Ie(f.charCodeAt(e)))e++;if(k("as")){e+=2;while(e<C&&Ie(f.charCodeAt(e)))e++;$e();while(e<C&&Ie(f.charCodeAt(e)))e++}if(k("from")){e+=4;while(e<C&&Ie(f.charCodeAt(e)))e++;if(e<C){let s=f.charCodeAt(e);if(s===fe||s===pe)Ne(s)}}while(e<C&&(f.charCodeAt(e)===We||f.charCodeAt(e)===Le))e++;if(e<C&&f.charCodeAt(e)===Q)e++}function ft(s){let r=s.indexOf("from ");if(r===-1)return;let o=r+5;while(o<s.length&&(s.charCodeAt(o)===32||s.charCodeAt(o)===9))o++;if(o>=s.length)return;let a=s.charCodeAt(o);if(a!==39&&a!==34)return;let l=s.indexOf(s[o],o+1);if(l===-1)return;return s.slice(o+1,l)}function Fe(s){if(!F)return;let r=s-1;while(r>=0&&Ie(f.charCodeAt(r)))r--;if(r<0)return;let o=[],a=!1;while(r>=0){if(r>=1&&f.charCodeAt(r)===H&&f.charCodeAt(r-1)===Ce){let A=f.lastIndexOf("/*",r-2);if(A>=0){o.push(f.slice(A,r+1)),a=!0,r=A-1;while(r>=0&&Ie(f.charCodeAt(r)))r--;continue}break}let l=r;while(l>0&&f.charCodeAt(l-1)!==me)l--;let u=G(l,r+1);if(u.startsWith("//")){if(a)break;let A=[u];r=l-1;while(r>=0&&(f.charCodeAt(r)===me||f.charCodeAt(r)===ke))r--;while(r>=0){let b=r;while(b>0&&f.charCodeAt(b-1)!==me)b--;let p=G(b,r+1);if(p.startsWith("//")){A.push(p),r=b-1;while(r>=0&&(f.charCodeAt(r)===me||f.charCodeAt(r)===ke))r--}else if(p===""){r=b-1;while(r>=0&&(f.charCodeAt(r)===me||f.charCodeAt(r)===ke))r--}else break}A.reverse(),o.push(A.join(`
17
+ `));continue}break}if(o.length===0)return;return o.reverse(),o}function ln(s){let r=s,o=!1,a=0,l;while(e<C){let M=f.charCodeAt(e);if(M===H&&(f.charCodeAt(e+1)===H||f.charCodeAt(e+1)===Ce)){w();continue}if(M===Q){e++;break}if(M===P)a++;else if(M===z&&a>0)a--;if(M===fe||M===pe){if(Ne(M),a>0)continue;o=!0;let D=e;if(w(),f.charCodeAt(e)===ue){let y=e+1;l=Me(f.slice(r,y)),e=l?y:D}else e=D;while(e<C&&(f.charCodeAt(e)===We||f.charCodeAt(e)===Le))e++;if(e<C&&f.charCodeAt(e)===Q)e++;break}if(M===me&&o)break;e++}let u=G(r,e),A=m(u).find((M)=>M.category==="static-import"),b=t(u),p=l?.isTypeOnly??A?.isTypeOnly??!1,g=b[1]?.kind==="quoted",x=l?.source??A?.specifier??"",_=Fe(r);return{kind:"import",name:"",text:u,isExported:!1,isTypeOnly:p,isSideEffect:g,source:x,leadingComments:_,start:r,end:e}}function wt(){let s=e;return ve(P,z),f.slice(s,e)}function Nt(s){let r=s.indexOf("(");if(r===-1)return s;let o=s.slice(r);if(o.indexOf("=")===-1)return s;let a=!1;for(let p=0;p<o.length;p++)if(o.charCodeAt(p)===61){let x=p>0?o.charCodeAt(p-1):0,_=p+1<o.length?o.charCodeAt(p+1):0;if(x!==61&&x!==33&&x!==60&&x!==62&&_!==61&&_!==62){a=!0;break}}if(!a)return s;let l=0,u=-1;for(let p=r;p<s.length;p++){let g=s.charCodeAt(p);if(g===40)l++;else if(g===41){if(l--,l===0){u=p;break}}}if(u===-1)return s;let A=s.slice(r,u+1),b=tt(A);return s.slice(0,r)+b+s.slice(u+1)}function jt(s){let r=s.indexOf("//")!==-1||s.indexOf("/*")!==-1,o=s.split(`
18
+ `),a=[],l=[],u=[],A=!1,b=1/0;for(let x=0;x<o.length;x++){let _=o[x];if(r){if(A){if(_.includes("*/"))A=!1;continue}let M=_.trim();if(M.length===0)continue;let D=M.charCodeAt(0);if(D===H){let K=M.charCodeAt(1);if(K===H)continue;if(K===Ce){if(!M.includes("*/"))A=!0;continue}}if(D===Ce)continue;let y=Be(_);if(y.charCodeAt(y.length-1)===Q)y=y.slice(0,-1);y=Nt(y);let S=y.trim();if(!S)continue;a.push(y),l.push(S);let E=0;while(E<y.length&&Ie(y.charCodeAt(E)))E++;if(S!=="{"&&S!=="}"){if(E<b)b=E}u.push(E)}else{let M=_.length;while(M>0&&(_.charCodeAt(M-1)===We||_.charCodeAt(M-1)===Le||_.charCodeAt(M-1)===ke))M--;if(M===0)continue;let D=M<_.length?_.slice(0,M):_;if(D.charCodeAt(D.length-1)===Q)D=D.slice(0,-1);D=Nt(D);let y=D.trim();if(!y)continue;a.push(D),l.push(y);let S=0;while(S<D.length&&Ie(D.charCodeAt(S)))S++;if(y!=="{"&&y!=="}"){if(S<b)b=S}u.push(S)}}if(a.length===0)return"{}";if(b===1/0||b<=2)return a.join(`
19
+ `);let p=b-2,g=Array(a.length);for(let x=0;x<a.length;x++){let _=l[x];if(_==="{"){g[x]=_;continue}let M=u[x];if(M>b)g[x]=a[x];else if(M===b&&(_.charCodeAt(0)===z||_.charCodeAt(0)===ye||_.charCodeAt(0)===ue))g[x]=a[x];else{let D=Math.max(0,M-p);g[x]=" ".repeat(D)+_}}return g.join(`
20
+ `)}function Ue(){if(e>=C||f.charCodeAt(e)!==ge)return"";let s=e;ve(ge,he);let r=f.slice(s,e);if(r.includes(`
21
+ `)){let o="",a=!1;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);if(u===32||u===9||u===10||u===13){if(!a&&o.length>0)o+=" ",a=!0}else o+=r[l],a=!1}if(o.charCodeAt(1)===32)o=`<${o.slice(2)}`;if(o.charCodeAt(o.length-2)===32)o=`${o.slice(0,-2)}>`;return o}return r}function Qe(){if(e>=C||f.charCodeAt(e)!==Z)return"()";let s=e;return ve(Z,ue),f.slice(s,e)}function dt(s){if(s.indexOf("/")===-1)return s;let r="",o=!1,a=0;for(let l=0;l<s.length;l++){let u=s.charCodeAt(l);if(o){if(r+=s[l],u===ze&&l+1<s.length){r+=s[++l];continue}if(u===a)o=!1;continue}if(u===fe||u===pe||u===Se){o=!0,a=u,r+=s[l];continue}if(u===H&&l+1<s.length){let A=s.charCodeAt(l+1);if(A===Ce){let b=s.indexOf("*/",l+2);l=b===-1?s.length:b+1,r+=" ";continue}if(A===H){let b=s.indexOf(`
22
+ `,l+2);l=b===-1?s.length:b-1;continue}}r+=s[l]}return r.trim()}function tt(s){let r=s.slice(1,-1).trim();if(!r)return"()";if(s.indexOf(`
23
+ `)===-1&&r.indexOf(":")!==-1&&r.indexOf("{")===-1&&r.indexOf("[")===-1&&r.indexOf("=")===-1&&r.indexOf("@")===-1&&r.indexOf("...")===-1){let p=0,g=0,x=0;for(let _=0;_<r.length;_++){let M=r.charCodeAt(_);if(M===Z||M===ge||M===P)x++;else if(M===ue||M===he||M===z)x--;else if(x===0){if(M===Ge)p++;else if(M===Ke)g++}}if(p>=g+1){let _=!1;for(let M=0;M<Ot.length;M++){let D=Ot[M],y=r.indexOf(D);if(y!==-1){let S=y+D.length;if((y===0||!i(r.charCodeAt(y-1)))&&(S>=r.length||!i(r.charCodeAt(S)))){_=!0;break}}}if(!_)return s}}let o=[],a=0,l=0,u=!1,A=0;for(let p=0;p<=r.length;p++){if(p===r.length){o.push(dt(r.slice(a).trim()));break}let g=r.charCodeAt(p);if(u){if(g===ze){p++;continue}if(g===A)u=!1;continue}if(g===H&&p+1<r.length){let x=r.charCodeAt(p+1);if(x===Ce){p+=2;while(p+1<r.length&&!(r.charCodeAt(p)===Ce&&r.charCodeAt(p+1)===H))p++;p++;continue}if(x===H){while(p<r.length&&r.charCodeAt(p)!==10)p++;continue}}if(g===fe||g===pe||g===Se){u=!0,A=g;continue}if(g===Z||g===P||g===we||g===ge)l++;else if(g===ue||g===z||g===ye||g===he&&!(p>0&&r.charCodeAt(p-1)===be))l--;else if(g===Ke&&l===0)o.push(dt(r.slice(a,p).trim())),a=p+1}let b=[];for(let p of o){if(!p)continue;let g=p.trim();if(g.startsWith("//")||g.startsWith("/*"))continue;let x=p;{let _=!1,M=0,D=0,y=0;for(let S=0;S<x.length-1;S++){let E=x.charCodeAt(S);if(E===me){y=S+1;continue}if(_){if(E===ze){S++;continue}if(E===M)_=!1;continue}if(E===fe||E===pe||E===Se){_=!0,M=E;continue}if(E===P||E===we||E===Z||E===ge){D++;continue}if(E===z||E===ye||E===ue||E===he){if(D>0)D--;continue}if(E===H&&x.charCodeAt(S+1)===H){if(D===0){x=x.slice(0,S).trimEnd();break}let K=x.indexOf(`
24
+ `,S);if(K===-1){x=x.slice(0,y).trimEnd();break}let B=x.slice(0,y),q=x.slice(K+1);x=`${B}${q}`,S=y-1}}}if(!x.trim())continue;b.push(qt(x))}return De(`(${b.join(", ")})`)}function fn(s){if(!s.startsWith("{")&&!s.startsWith("["))return s;let r="",o=0,a=0,l=!1,u=0;while(o<s.length){let A=s.charCodeAt(o);if(l){if(A===ze&&o+1<s.length){r+=s[o]+s[o+1],o+=2;continue}if(A===u)l=!1;r+=s[o],o++;continue}if(A===H&&o+1<s.length){let b=s.charCodeAt(o+1);if(b===Ce){let p=o;o+=2;while(o+1<s.length&&!(s.charCodeAt(o)===Ce&&s.charCodeAt(o+1)===H))o++;o=Math.min(o+2,s.length),r+=s.slice(p,o);continue}if(b===H){let p=o;while(o<s.length&&s.charCodeAt(o)!==10)o++;r+=s.slice(p,o);continue}}if(A===fe||A===pe||A===Se){l=!0,u=A,r+=s[o],o++;continue}if(A===P||A===we||A===Z)a++;else if(A===z||A===ye||A===ue)a--;if(a>=1&&A===be&&(o+1>=s.length||s.charCodeAt(o+1)!==be&&s.charCodeAt(o+1)!==he)){while(r.length>0&&(r[r.length-1]===" "||r[r.length-1]==="\t"||r[r.length-1]===`
25
+ `))r=r.slice(0,-1);o++;let b=0;while(o<s.length){let p=s.charCodeAt(o);if(p===fe||p===pe||p===Se){let g=p;o++;while(o<s.length){if(s.charCodeAt(o)===ze){o+=2;continue}if(s.charCodeAt(o)===g){o++;break}o++}continue}if(p===P||p===we||p===Z)b++;else if(p===z||p===ye||p===ue){if(b===0)break;b--}else if(p===Ke&&b===0)break;o++}continue}if(a===1&&A===Ve&&o+2<s.length&&s.charCodeAt(o+1)===Ve&&s.charCodeAt(o+2)===Ve){o+=3;continue}r+=s[o],o++}return r}function qt(s){let r=s.trim(),o=r.startsWith("...");if(o)r=r.slice(3).trim();while(r.startsWith("@")){let y=1;while(y<r.length&&i(r.charCodeAt(y)))y++;if(y<r.length&&r.charCodeAt(y)===Z){let S=1;y++;while(y<r.length&&S>0){if(r.charCodeAt(y)===Z)S++;else if(r.charCodeAt(y)===ue)S--;y++}}r=r.slice(y).trim()}let a=!0;while(a){a=!1;for(let y of Ot)if(r.startsWith(y)&&r.length>y.length&&!i(r.charCodeAt(y.length))){let S=r.slice(y.length).trim();if(S.charCodeAt(0)===Ge||S.charCodeAt(0)===gt&&S.length>1&&S.charCodeAt(1)===Ge)break;r=S,a=!0;break}}let l=-1,u=-1,A=0,b=!1,p=0;for(let y=0;y<r.length;y++){let S=r.charCodeAt(y);if(b){if(S===ze){y++;continue}if(S===p)b=!1;continue}if(S===H&&y+1<r.length){let E=r.charCodeAt(y+1);if(E===Ce){y+=2;while(y+1<r.length&&!(r.charCodeAt(y)===Ce&&r.charCodeAt(y+1)===H))y++;y++;continue}if(E===H){while(y<r.length&&r.charCodeAt(y)!==10)y++;continue}}if(S===fe||S===pe||S===Se){b=!0,p=S;continue}if(S===Z||S===P||S===we||S===ge)A++;else if(S===ue||S===z||S===ye||S===he&&!(y>0&&r.charCodeAt(y-1)===be))A--;else if(A===0){if(S===Ge&&l===-1)l=y;else if(S===be&&u===-1&&(y===0||r.charCodeAt(y-1)!==be)&&(y+1>=r.length||r.charCodeAt(y+1)!==be&&r.charCodeAt(y+1)!==he))u=y}}let g,x,_=u!==-1;if(l!==-1&&(u===-1||l<u))if(g=r.slice(0,l).trim(),u!==-1)x=r.slice(l+1,u).trim();else x=r.slice(l+1).trim();else if(u!==-1)g=r.slice(0,u).trim(),x=$t(r.slice(u+1).trim());else g=r,x="unknown";if(g=fn(g),(g.startsWith("{")||g.startsWith("["))&&g.includes(`
26
+ `)){let y=g.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(y.length<=40)g=y;else g=g.split(`
27
+ `).map((E)=>{let K=E.trim();if(!K)return"";if(K==="{"||K==="}"||K==="["||K==="]"||K.startsWith("}")||K.startsWith("]"))return K;return` ${K}`}).join(`
28
+ `)}let M=g.endsWith("?")||_;if(g.endsWith("?"))g=g.slice(0,-1).trim();let D=M&&!o?"?":"";if(o)return`...${g}: ${x}`;return`${g}${D}: ${x}`}function zt(s){let r=0;if(r<s.length&&s.charCodeAt(r)===45)r++;if(r>=s.length)return!1;let o=s.charCodeAt(r);if(o<48||o>57)return!1;while(r<s.length&&s.charCodeAt(r)>=48&&s.charCodeAt(r)<=57)r++;if(r<s.length&&s.charCodeAt(r)===46){if(r++,r>=s.length||s.charCodeAt(r)<48||s.charCodeAt(r)>57)return!1;while(r<s.length&&s.charCodeAt(r)>=48&&s.charCodeAt(r)<=57)r++}return r===s.length}function $t(s){let r=s.trim(),o=ae(r);if(o)return o;if(r==="true"||r==="false")return"boolean";if(zt(r))return"number";if(r.startsWith("'")&&r.endsWith("'")||r.startsWith('"')&&r.endsWith('"'))return"string";if(r.startsWith("["))return"unknown[]";if(r.startsWith("{"))return"Record<string, unknown>";return Te(r)??"unknown"}function xt(s){let r=s.trim();if(r.endsWith("as const"))r=r.slice(0,-8).trim();if(r==="true"||r==="false")return r;if(zt(r))return r;let o=dn(r);if(o!==null)return o;return Te(r)??"unknown"}function dn(s){if(s==="")return null;if(s.charCodeAt(0)===fe||s.charCodeAt(0)===pe){if(at(s,0,s.charCodeAt(0))===s.length)return s}let r=un(s,"+");if(r.length>1){let o=!1,a=!0,l=[];for(let u of r){let A=u.trim(),b=A.charCodeAt(0);if((b===fe||b===pe)&&at(A,0,b)===A.length)o=!0,l.push(hn(A));else a=!1}if(a)return pn(l.join(""));if(o)return"string";return null}if(/^[\d\s()+*/%.\-]+$/.test(s)&&/\d/.test(s)&&/[+*/%\-\s]/.test(s))return"number";return null}function un(s,r){let o=[],a=0,l="",u=0;while(u<s.length){let A=s.charCodeAt(u);if(A===fe||A===pe||A===Se){let b=at(s,u,A);l+=s.slice(u,b),u=b;continue}if(A===H&&(s.charCodeAt(u+1)===H||s.charCodeAt(u+1)===42)){if(s.charCodeAt(u+1)===H){let g=s.indexOf(`
29
+ `,u+2),x=g===-1?s.length:g;l+=s.slice(u,x),u=x;continue}let b=s.indexOf("*/",u+2),p=b===-1?s.length:b+2;l+=s.slice(u,p),u=p;continue}if(A===Z||A===we||A===P)a++;else if(A===ue||A===ye||A===z)a--;if(s[u]===r&&a===0){o.push(l),l="",u++;continue}l+=s[u],u++}return o.push(l),o}function hn(s){return s.slice(1,-1).replace(/\\(.)/g,(o,a)=>{if(a==="n")return`
30
+ `;if(a==="t")return"\t";if(a==="r")return"\r";if(a==="0")return"\x00";return a})}function pn(s){return`'${s.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function ut(s){if(s.endsWith("as const"))return null;let r=0,o=-1;for(let l=0;l<s.length;l++){let u=s.charCodeAt(l);if(u===fe||u===pe||u===Se)l=at(s,l,u)-1;else if(u===123||u===91||u===40)r++;else if(u===125||u===93||u===41)r--;else if(r===0&&u===32&&l+4<=s.length&&s.substring(l,l+4)===" as ")o=l}if(o===-1)return null;return s.slice(o+4).trim()||null}function ot(){if(w(),e<C&&f.charCodeAt(e)===Ge){let a=function(){let l=G(s,o),u=(A)=>{let b=l.length-A.length;return b>=0&&l.endsWith(A)&&(b===0||!i(l.charCodeAt(b-1)))};return l.length===0||l.endsWith("=>")||l.endsWith("|")||l.endsWith("&")||u("is")||u("extends")};e++,w();let s=e,r=0,o=s;while(e<C){let l=e;if(Ee()){if(f.charCodeAt(l)!==H)o=e;continue}let u=f.charCodeAt(e);if(u===Z||u===we||u===ge)r++;else if(u===ue||u===ye||u===he&&!qe())r--;else if(u===P)if(r>0)r++;else if(a())r++;else break;else if(u===z){if(r===0)break;r--}else if(r===0&&u===Q)break;if(r===0&&rt()&&!a())break;if(!Ie(u))o=e+1;e++}return G(s,e)}return""}function Ze(s,r,o,a){e+=8,w();let l=e<C&&f.charCodeAt(e)===Ce;if(l)e++,w();let u=$e();if(!u&&!a)return null;w();let A=Ue();w();let b=Qe();w();let p=ot(),g=p.length>0;if(!p)if(o&&l)p="AsyncGenerator<unknown, void, unknown>";else if(l)p="Generator<unknown, void, unknown>";else if(o)p="Promise<void>";else p="void";w();let x=!1;if(e<C&&f.charCodeAt(e)===P){x=!0;let K=e+1;if(ve(P,z),!g&&!l){let B=f.slice(K,e-1),q=bi(B,V,()=>{let xe;do xe=`__dtsx_return_${oe++}`;while(f.includes(xe));return xe},(xe)=>re.set(xe.name,{...xe,start:e,end:e}),A);p=q.finish(I(B,o,b,ne,q.resolve))}}else if(e<C&&f.charCodeAt(e)===Q)e++;let _=tt(b),y=`${r?a?"export default function ":"export declare function ":"declare function "}${u||(a?"":"default")}${A}${_}: ${p};`,S=Fe(s),E={kind:"function",name:u||"default",text:y,isExported:r,isDefault:a,isAsync:o,isGenerator:l,returnType:p,generics:A||void 0,leadingComments:S,start:s,end:e};if(x)Ae.add(E);return E}let yt,mn=0;function Ft(){yt??=new Set(t(f).filter((s)=>s.kind==="word").map((s)=>f.slice(s.start,s.end)));for(;;){let s=`__dtsx_binding_${mn++}`;if(yt.has(s))continue;return yt.add(s),s}}function Ye(s,r,o){e+=r.length,w();let a=[];do{if(w(),e>=C)break;let l=f.charCodeAt(e),u,A=e;if(l===P||l===we)ve(l,l===P?z:ye),u=f.slice(A,e);let b=u?Ft():$e();if(!b)return _e(),a;w();let p,g,x,_=!1;if(e<C&&f.charCodeAt(e)===Ge){e++,w();let K=e,B=0;while(e<C){if(Ee()){if(B===0&&At())break;continue}let q=f.charCodeAt(e);if(q===Z||q===P||q===we||q===ge)B++;else if(q===ue||q===z||q===ye||q===he&&!qe())B--;else if(B===0&&(q===Q||q===Ke))break;else if(B===0&&q===be&&!kt())break;if(B===0&&(Xe()||Lt()))break;e++}p=G(K,e)}if(e<C&&f.charCodeAt(e)===be)if(de&&p&&(!F||!yn(p)))an();else{e++,w();let K=e;x=K;let B=0,q=0,xe=0,et=!0;for(;;){e=K,B=0,q=0,xe=0;while(e<C){if(Ee()){if(B===0&&q===0&&xe===0&&At())break;continue}let Pe=f.charCodeAt(e);if(Pe===Z||Pe===P||Pe===we)B++;else if(Pe===ue||Pe===z||Pe===ye)B--;else if(Pe===ge&&B===0){let ct=Gt(e);if(ct!==null)xe=Math.max(0,xe+ct);else if(et&&(e+1>=C||f.charCodeAt(e+1)!==be))q++}else if(Pe===he&&B===0&&xe===0&&!qe()){if(q>0&&(e+1>=C||f.charCodeAt(e+1)!==be))q--}else if(B===0&&q===0&&xe===0&&(Pe===Q||Pe===Ke))break;if(B===0&&q===0&&xe===0&&(Xe()||nn()))break;e++}if(q>0&&et){et=!1;continue}break}if(g=ie(G(K,e)),g.endsWith(" as const")||g==="const"){if(_=!0,!p){let Pe=g.endsWith(" as const")?g.slice(0,-9).trim():g,ct=xt(Pe);p=ct!=="unknown"?ct:void 0}}else if(!p){let Pe=j(g)??ut(g)??ne(g);if(Pe)p=Pe}}let M=a.length===0?Fe(s):void 0,D=u?"const":r,y=u?!1:o,S=`${y?"export ":""}declare ${D} ${b}: ${p||"unknown"};`,E={kind:"variable",name:b,text:S,isExported:y,typeAnnotation:p,value:g,initializerStart:x,modifiers:_?[D,"const assertion"]:[D],leadingComments:u?void 0:M,start:s,end:e};if(u)a.push(...qn({pattern:u,patternOffset:A,root:E,kind:r,exported:o,comments:M,allocateName:Ft}));else a.push(E);if(f.charCodeAt(e)===Ke){e++;continue}if(f.charCodeAt(e)===Q)e++;break}while(e<C);return a}function Gt(s){if(f.charCodeAt(s)!==ge||s+1>=C)return null;let r=f.charCodeAt(s+1);if(r===he)return 1;if(r===H)return-1;if(!c(r))return null;let o=s+2;while(o<C){let g=f.charCodeAt(o);if(!i(g)&&g!==Ve&&g!==58&&g!==45)break;o++}let a=f.slice(s+1,o),l=f.charCodeAt(o);if(l>32&&l!==he&&l!==H)return null;let u=0,A=0,b=o;for(;b<C;b++){let g=f.charCodeAt(b);if(A!==0){if(g===ze)b++;else if(g===A)A=0;continue}if(g===fe||g===pe||g===Se)A=g;else if(g===P)u++;else if(g===z&&u>0)u--;else if(g===he&&u===0)break}if(b>=C)return null;let p=b-1;while(p>s&&f.charCodeAt(p)<=32)p--;if(f.charCodeAt(p)===H)return 0;return f.indexOf(`</${a}`,b+1)===-1?null:1}function St(s,r){e+=9,w();let o=$e();w();let a=Ue();w();let l="";if(k("extends")){e+=7,w();let g=e,x=0;while(e<C){if(Ee())continue;let _=f.charCodeAt(e);if(_===ge)x++;else if(_===he&&!qe())x--;else if(_===P&&x===0)break;e++}l=G(g,e)}w();let u=e<C&&f.charCodeAt(e)===P?wt():"{}",A=jt(u),b=`${r?"export ":""}declare interface ${o}${a}${l?` extends ${l}`:""} ${A}`,p=Fe(s);return{kind:"interface",name:o,text:b,isExported:r,extends:l||void 0,generics:a||void 0,leadingComments:p,start:s,end:e}}function vt(s,r){e+=4,w();let o=$e();w();let a=Ue();if(w(),e<C&&f.charCodeAt(e)===be)e++;w();let l=e,u=0;while(e<C){if(Ee())continue;let g=f.charCodeAt(e);if(g===Z||g===P||g===we||g===ge)u++;else if(g===ue||g===z||g===ye||g===he&&!qe())u--;else if(u===0&&g===Q)break;if(u===0&&(Xe()||Lt()))break;e++}let A=G(l,e);if(e<C&&f.charCodeAt(e)===Q)e++;let b=`${r?"export ":""}type ${o}${a} = ${A}`,p=Fe(s);return{kind:"type",name:o,text:b,isExported:r,generics:a||void 0,leadingComments:p,start:s,end:e}}function nt(s,r,o){e+=4,w();let a=$e();w();let l=e;if(e<C&&f.charCodeAt(e)===P)ve(P,z);let u=G(s,e),A=Fe(s);return{kind:"enum",name:a,text:u,isExported:r,modifiers:o?["const"]:void 0,leadingComments:A,start:s,end:e}}function Je(s,r,o,a=!1){e+=5,w();let l=$e()||"AnonymousClass";w();let u=Ue();w();let A="";if(k("extends")){e+=7,w();let M=e,D=0;while(e<C){if(Ee())continue;let y=f.charCodeAt(e);if(y===ge)D++;else if(y===he&&!qe())D--;else if(D===0&&(y===P||k("implements")))break;e++}A=G(M,e)}let b;if(k("implements")){e+=10,w();let M=e,D=0;while(e<C){if(Ee())continue;let S=f.charCodeAt(e);if(S===ge)D++;else if(S===he&&!qe())D--;else if(D===0&&S===P)break;e++}let y=G(M,e);if(y)b=y.split(",").map((S)=>S.trim())}w();let p=Dt(),x=`${r?a?"export default ":"export declare ":"declare "}${o?"abstract ":""}class ${l}${u}${A?` extends ${A}`:""}${b&&b.length>0?` implements ${b.join(", ")}`:""} ${p}`,_=Fe(s);return{kind:"class",name:l,text:x,isExported:r,isDefault:a,extends:A||void 0,implements:b,generics:u||void 0,modifiers:o?["abstract"]:void 0,leadingComments:_,start:s,end:e}}function Dt(){if(e>=C||f.charCodeAt(e)!==P)return"{}";e++;let s={fields:new Map,pending:[],isStatic:!1};le.push(s);let r=[],o=new Set;while(e<C){if(w(),e>=C)break;if(f.charCodeAt(e)===z){e++;break}if(f.charCodeAt(e)===Q){e++;continue}if(k("static")&&pt("static")===P){e+=6,w(),ve(P,z);continue}let a=!1,l=!1,u=!1,A=!1,b=!1,p=!1,g=!1,x=!1,_=!0;while(_){w();let K=e,B=$e();if(e=K,B){let q=pt(B);if(q===Z||q===ge||q===gt||q===33||q===Ge||q===be||q===Q||q===z)break}if(k("private")){a=!0,e+=7;continue}if(k("protected")){l=!0,e+=9;continue}if(k("public")){e+=6;continue}if(k("static")){u=!0,e+=6;continue}if(k("abstract")){A=!0,e+=8;continue}if(k("readonly")){b=!0,e+=8;continue}if(k("override")){p=!0,e+=8;continue}if(k("accessor")){g=!0,e+=8;continue}if(k("async")){x=!0,e+=5;continue}if(k("declare")){e+=7;continue}break}if(w(),e>=C||f.charCodeAt(e)===z)break;let M=e;if(s.isStatic=u,(k("get")||k("set"))&&_t(pt(f.slice(e,e+3))))e+=3,w();if(f.charCodeAt(e)===Ce)e++,w();let D=ht();e=M;let y=D.startsWith("#");if(y)a=!0;if(a&&D&&D!=="constructor"){let K=y?u?" static #private_static;":" #private;":` private ${u?"static ":""}${D};`,q=D[0]==="'"||D[0]==='"'?d(D)??D:D,xe=y?`${u?"static":"instance"}#`:`${u?"static:":"instance:"}${q}`;if(!o.has(xe))o.add(xe),r.push(K)}let S=a?[]:r,E=" ";if(l)E+="protected ";if(u)E+="static ";if(A)E+="abstract ";if(b)E+="readonly ";if(k("constructor")){e+=11,w();let K=Qe();if(w(),Cn(K,r),e<C&&f.charCodeAt(e)===P)ve(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;let B=tt(K);r.push(a?" private constructor();":` ${l?"protected ":""}constructor${B};`)}else if(k("get"))if(e+=3,w(),e<C&&_t(f.charCodeAt(e))){let K=ht();if(K.startsWith("#")){if(w(),e<C&&f.charCodeAt(e)===Z)Qe();if(w(),ot(),w(),e<C&&f.charCodeAt(e)===P)ve(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;continue}w(),Qe(),w();let B=ot(),q;if(w(),e<C&&f.charCodeAt(e)===P){let et=e+1;if(ve(P,z),!B&&!de)q=f.slice(et,e-1),B=I(q,!1,"()",(Pe)=>J(Pe,u))}else if(e<C&&f.charCodeAt(e)===Q)e++;let xe=S.length;if(S.push(`${E}get ${K}(): ${B||"unknown"};`),q)s.pending.push(()=>{let et=I(q,!1,"()",(Pe)=>J(Pe,u));S[xe]=`${E}get ${K}(): ${et};`})}else Ut("get",E,u,b,x,S);else if(k("set"))if(e+=3,w(),e<C&&_t(f.charCodeAt(e))){let K=ht();if(K.startsWith("#")){if(w(),e<C&&f.charCodeAt(e)===Z)Qe();if(w(),e<C&&f.charCodeAt(e)===P)ve(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;continue}w();let B=Qe();if(w(),e<C&&f.charCodeAt(e)===P)ve(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;let q=tt(B);S.push(`${E}set ${K}${q};`)}else Ut("set",E,u,b,x,S);else{let K=f.charCodeAt(e)===Ce;if(K)e++,w();let B=ht();if(!B){Kt();continue}Vt(B,E,u,b,K,A,x,S)}}for(let a of s.pending)a();return le.pop(),`{
31
+ ${r.join(`
32
+ `)}
33
+ }`}function _t(s){return c(s)||s===we||s===Yt||s===fe||s===pe}function ht(){if(e>=C)return"";let s=f.charCodeAt(e);if(s===we){let r=e;return ve(we,ye),f.slice(r,e)}if(s===Yt)return e++,`#${$e()}`;if(s===fe||s===pe){let r=e;return Ne(s),f.slice(r,e)}return $e()}function pt(s){let r=e;e+=s.length,w();let o=e<C?f.charCodeAt(e):0;return e=r,o}function Kt(){let s=0;while(e<C){if(Ee())continue;let r=f.charCodeAt(e);if(r===P||r===Z)s++;else if(r===z||r===ue){if(s===0)return;s--}else if(r===Q&&s===0){e++;return}if(s===0&&rt())return;e++}}function Ut(s,r,o,a,l,u){Vt(s,r,o,a,!1,!1,l,u)}function Vt(s,r,o,a,l,u,A,b){if(w(),e>=C)return;let p=f.charCodeAt(e),g=!1;if(p===gt)g=!0,e++,w();if(e<C&&f.charCodeAt(e)===33)e++,w();let x=e<C?f.charCodeAt(e):0;if(x===Z||x===ge){let _=x===ge?Ue():"";w();let M=Qe();w();let D=ot(),y,S=D.length>0;if(!D)if(A&&l)D="AsyncGenerator<unknown, void, unknown>";else if(l)D="Generator<unknown, void, unknown>";else if(A)D="Promise<void>";else D="void";if(w(),e<C&&f.charCodeAt(e)===P){let q=e+1;if(ve(P,z),!S&&!l)y=f.slice(q,e-1),D=I(y,A,M,(xe)=>J(xe,o))}else if(e<C&&f.charCodeAt(e)===Q)e++;let E=tt(M),K=g?"?":"",B=b.length;if(b.push(`${r}${s}${K}${_}${E}: ${D};`),y)le.at(-1)?.pending.push(()=>{let q=I(y,A,M,(xe)=>J(xe,o));b[B]=`${r}${s}${K}${_}${E}: ${q};`})}else if(x===Ge||x===be||x===Q||x===z||x===me||x===ke){let _="";if(x===Ge){e++,w();let y=e,S=0;while(e<C){if(Ee())continue;let E=f.charCodeAt(e);if(E===Z||E===P||E===we||E===ge)S++;else if(E===ue||E===z||E===ye||E===he&&!qe()){if(S===0)break;S--}else if(S===0&&(E===Q||E===Ke))break;else if(S===0&&E===be&&!kt())break;if(S===0&&rt())break;e++}_=G(y,e)}let M="";if(e<C&&f.charCodeAt(e)===be)if(de&&_){e++;let y=0;while(e<C){if(Ee())continue;let S=f.charCodeAt(e);if(S===Z||S===P||S===we)y++;else if(S===ue||S===z||S===ye){if(y===0&&S===z)break;y--}else if(y===0&&S===Q)break;if(y===0&&rt())break;e++}}else{e++,w();let y=e,S=0;while(e<C){if(Ee())continue;let E=f.charCodeAt(e);if(E===Z||E===P||E===we)S++;else if(E===ue||E===z||E===ye){if(S===0&&E===z)break;S--}else if(S===0&&E===Q)break;if(S===0&&rt())break;e++}M=G(y,e)}if(e<C&&f.charCodeAt(e)===Q)e++;if(!_)if(M){let y=ut(M);if(y)_=y;else _=M.endsWith("as const")||o&&a?xt(M):$t(M)}else _="unknown";let D=g?"?":"";le.at(-1)?.fields.set(`${o?"static:":""}${s}`,g?`(${_}) | undefined`:_),b.push(`${r}${s}${D}: ${_};`)}else Kt()}function gn(s){let r=0;for(let o=0;o<s.length;o++){let a=s.charCodeAt(o);if(a===Z||a===P||a===we||a===ge)r++;else if(a===ue||a===z||a===ye||a===he&&s.charCodeAt(o-1)!==be)r--;else if(a===be&&r===0&&s.charCodeAt(o+1)!==he&&s.charCodeAt(o+1)!==be)return!0}return!1}function Cn(s,r){let o=s.slice(1,-1).trim();if(!o)return;let a=[],l=0,u=0,A=!1,b=0;for(let p=0;p<=o.length;p++){if(p===o.length){a.push(dt(o.slice(l).trim()));break}let g=o.charCodeAt(p);if(A){if(g===ze){p++;continue}if(g===b)A=!1;continue}if(g===H&&p+1<o.length){let x=o.charCodeAt(p+1);if(x===Ce){p+=2;while(p+1<o.length&&!(o.charCodeAt(p)===Ce&&o.charCodeAt(p+1)===H))p++;p++;continue}if(x===H){while(p<o.length&&o.charCodeAt(p)!==10)p++;continue}}if(g===fe||g===pe||g===Se){A=!0,b=g;continue}if(g===Z||g===P||g===we||g===ge)u++;else if(g===ue||g===z||g===ye||g===he&&!(p>0&&o.charCodeAt(p-1)===be))u--;else if(g===Ke&&u===0)a.push(dt(o.slice(l,p).trim())),l=p+1}for(let p of a){let g=p.startsWith("public ")||p.startsWith("public\t"),x=p.startsWith("protected ")||p.startsWith("protected\t"),_=p.startsWith("private ")||p.startsWith("private\t"),M=p.includes("readonly ");if(!g&&!x&&!_&&!M)continue;let D=p,y=[];if(_){let B=7;while(B<D.length&&Ie(D.charCodeAt(B)))B++;D=D.slice(B),y.push("private")}if(g){let B=6;while(B<D.length&&Ie(D.charCodeAt(B)))B++;D=D.slice(B),y.push("public")}if(x){let B=9;while(B<D.length&&Ie(D.charCodeAt(B)))B++;D=D.slice(B),y.push("protected")}if(M){let B=D.indexOf("readonly ");if(B!==-1){let q=B+8;while(q<D.length&&Ie(D.charCodeAt(q)))q++;D=D.slice(0,B)+D.slice(q)}y.push("readonly")}let S=y.length>0?`${y.join(" ")} `:"",E=qt(D),K=D.search(/[?:=]/);if(K!==-1&&D.charCodeAt(K)!==63&&gn(D))E=E.replace(/^([\w$]+)\?:/,"$1:");r.push(_?` private ${E.split(/[?:]/,1)[0]};`:` ${S}${E};`)}}function It(s=" "){if(e>=C||f.charCodeAt(e)!==P)return"{}";e++;let r=[];while(e<C){if(w(),e>=C)break;if(f.charCodeAt(e)===z){e++;break}if(f.charCodeAt(e)===Q){e++;continue}let o=!1;if(k("export"))o=!0,e+=6,w();if(k("declare"))e+=7,w();let a=o?"export ":"";if(k("function")||k("async")&&An("async","function")){let l=!1;if(k("async"))l=!0,e+=5,w();if(e+=8,w(),e<C&&f.charCodeAt(e)===Ce)e++,w();let A=$e();w();let b=Ue();w();let p=Qe();w();let g=ot();if(!g)g=l?"Promise<void>":"void";if(w(),e<C&&f.charCodeAt(e)===P)ve(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;let x=tt(p);r.push(`${s}${a}function ${A}${b}${x}: ${g};`)}else if(k("const")||k("let")||k("var")){let l=k("const")?"const":k("let")?"let":"var";e+=l.length,w();let u=$e();if(!u){_e(!0);continue}w();let A="";if(e<C&&f.charCodeAt(e)===Ge){e++,w();let p=e,g=0;while(e<C){if(Ee())continue;let x=f.charCodeAt(e);if(x===Z||x===P||x===we||x===ge)g++;else if(x===z&&g===0)break;else if(x===ue||x===z||x===ye||x===he&&!qe())g--;else if(g===0&&(x===Q||x===Ke))break;else if(g===0&&x===be&&!kt())break;if(g===0&&Xe())break;e++}A=G(p,e)}let b="";if(e<C&&f.charCodeAt(e)===be){e++,w();let p=e,g=0;while(e<C){if(Ee())continue;let x=f.charCodeAt(e);if(x===Z||x===P||x===we||x===ge)g++;else if(x===z&&g===0)break;else if(x===ue||x===z||x===ye||x===he&&!qe())g--;else if(g===0&&(x===Q||x===Ke))break;if(g===0&&Xe())break;e++}b=G(p,e)}if(e<C&&f.charCodeAt(e)===Q)e++;if(!A&&b){let p=ut(b);if(p)A=p;else if(l==="const")A=xt(b);else A=$t(b)}if(!A)A="unknown";r.push(`${s}${a}${l} ${u}: ${A};`)}else if(k("interface")){e+=9,w();let l=$e();w();let u=Ue();w();let A="";if(k("extends")){e+=7,w();let p=e,g=0;while(e<C){if(Ee())continue;let x=f.charCodeAt(e);if(x===ge)g++;else if(x===he&&!qe())g--;else if(x===P&&g===0)break;e++}A=G(p,e)}let b=jt(wt());r.push(`${s}${a}interface ${l}${u}${A?` extends ${A}`:""} ${b}`)}else if(k("type")){e+=4,w();let l=$e();w();let u=Ue();if(w(),e<C&&f.charCodeAt(e)===be){e++,w();let A=e,b=0;while(e<C){if(Ee())continue;let g=f.charCodeAt(e);if(g===Z||g===P||g===we||g===ge)b++;else if(g===z&&b===0)break;else if(g===ue||g===z||g===ye||g===he&&!qe())b--;else if(b===0&&g===Q)break;if(b===0&&Xe())break;e++}let p=G(A,e);if(e<C&&f.charCodeAt(e)===Q)e++;r.push(`${s}${a}type ${l}${u} = ${p}`)}}else if(k("class")){e+=5,w();let l=$e();w();let u=Ue();w();let A=e,b=0;while(e<C){if(Ee())continue;let _=f.charCodeAt(e);if(_===ge)b++;else if(_===he&&!qe())b--;else if(_===P&&b===0)break;e++}let p=G(A,e),g=p?` ${p}`:"",x=Dt();r.push(`${s}${a}class ${l}${u}${g} ${x}`)}else if(k("enum")){e+=4,w();let l=$e();w();let u=wt();r.push(`${s}${a}enum ${l} ${u}`)}else if(k("namespace")||k("module")){let l=k("namespace")?"namespace":"module";e+=l.length,w();let u=$e();w();let A=It(s);r.push(`${s}${a}${l} ${u} ${A}`)}else if(k("abstract"))if(e+=8,w(),k("class")){e+=5,w();let l=$e();w();let u=Ue();w();let A=e,b=0;while(e<C){if(Ee())continue;let _=f.charCodeAt(e);if(_===ge)b++;else if(_===he&&!qe())b--;else if(_===P&&b===0)break;e++}let p=G(A,e),g=p?` ${p}`:"",x=Dt();r.push(`${s}${a}abstract class ${l}${u}${g} ${x}`)}else _e(!0);else if(o&&k("default")){e+=7,w();let l=e;_e(!0);let u=G(l,e);if(u.charCodeAt(u.length-1)===Q)u=u.slice(0,-1);if(u)r.push(`${s}export default ${u};`)}else if(!o&&(f.charCodeAt(e)===fe||f.charCodeAt(e)===pe||f.charCodeAt(e)===Se))_e(!0);else _e(!0)}if(r.length===0)return"{}";return`{
34
+ ${r.join(`
35
+ `)}
36
+ }`}function An(s,r){let o=e+s.length;while(o<C&&Ie(f.charCodeAt(o)))o++;for(let a=0;a<r.length;a++)if(o+a>=C||f.charCodeAt(o+a)!==r.charCodeAt(a))return!1;return o+r.length>=C||!i(f.charCodeAt(o+r.length))}function it(s,r,o){e+=o.length,w();let a="",l=f.charCodeAt(e);if(l===fe||l===pe){let g=e;Ne(l),a=f.slice(g,e)}else{a=$e();while(e<C&&f.charCodeAt(e)===Ve)e++,a+=`.${$e()}`}w();let u=e<C&&f.charCodeAt(e)===P?It():"{}",A=`${r?"export ":""}declare ${o} ${a} ${u}`,b=Fe(s),p=a.startsWith("'")||a.startsWith('"');return{kind:"module",name:a,text:A,isExported:r,moduleForm:p?"quoted":o==="namespace"?"namespace":"identifier",source:p?a.slice(1,-1):void 0,leadingComments:b,start:s,end:e}}function Qt(s,r){_e();let o=G(r,e);if(o.charCodeAt(o.length-1)===Q)o=o.slice(0,-1).trimEnd();if(!o)return;let a=c(o.charCodeAt(0));for(let x=1;a&&x<o.length;x++)a=i(o.charCodeAt(x));let l=Fe(s);if(a){R.push({kind:"export",name:"default",text:`export default ${o};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e});return}let u="__dtsx_default_export__",A=1;while(f.includes(u))u=`__dtsx_default_export_${A++}__`;let p=ut(o)||ne(o)||n(o,!1),g=p==="unknown"&&xn(o)?`typeof ${o}`:p;R.push({kind:"variable",name:u,text:`declare const ${u}: ${g};`,isExported:!1,typeAnnotation:g,modifiers:["const"],start:s,end:e}),R.push({kind:"export",name:"default",text:`export default ${u};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e})}function Zt(){if(f.charCodeAt(e)===P)return ve(P,z),!0;let s=k("if"),r=k("do"),o=k("try"),a=k("for");if(!s&&!r&&!o&&!a&&!k("while")&&!k("switch")&&!k("with"))return!1;if($e(),w(),a&&k("await"))e+=5,w();if(!r&&!o&&f.charCodeAt(e)===Z)ve(Z,ue);if(mt(),w(),s&&k("else"))e+=4,mt();else if(r&&k("while")){if(e+=5,w(),f.charCodeAt(e)===Z)ve(Z,ue);if(w(),f.charCodeAt(e)===Q)e++}else if(o){if(k("catch")){if(e+=5,w(),f.charCodeAt(e)===Z)ve(Z,ue);mt(),w()}if(k("finally"))e+=7,mt()}return!0}function mt(){if(w(),!Zt())_e()}while(e<C){if(w(),e>=C)break;if(Zt())continue;let s=e,r=f.charCodeAt(e);if(r===105&&k("import"))R.push(ln(s));else if(r===101&&k("export")){e+=6,w();let o=f.charCodeAt(e);if(o===100&&k("default")){e+=7,w();let a=e,l=f.charCodeAt(e);if(l===102&&k("function")){let u=Ze(s,!0,!1,!0);if(u)R.push(u)}else if(l===97&&k("async")&&pt("async")!==Q)if(e+=5,w(),k("function")){let u=Ze(s,!0,!0,!0);if(u)R.push(u)}else Qt(s,a);else if(l===99&&k("class")){let u=Je(s,!0,!1,!0);R.push(u)}else if(l===97&&k("abstract")){if(e+=8,w(),k("class")){let u=Je(s,!0,!0,!0);R.push(u)}}else Qt(s,a)}else if(o===116&&k("type")){let a=e;if(e+=4,w(),e<C&&f.charCodeAt(e)===P){Bt();let l=G(s,e),u=Fe(s);R.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:ft(l),leadingComments:u,start:s,end:e})}else if(e<C&&f.charCodeAt(e)===Ce){Ht();let l=G(s,e);R.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:ft(l),start:s,end:e})}else{e=a;let l=vt(s,!0);R.push(l)}}else if(o===105&&k("interface")){let a=St(s,!0);R.push(a)}else if(o===102&&k("function")){let a=Ze(s,!0,!1,!1);if(a)R.push(a)}else if(o===97&&k("async"))if(e+=5,w(),k("function")){let a=Ze(s,!0,!0,!1);if(a)R.push(a)}else _e();else if(o===99)if(k("class")){let a=Je(s,!0,!1);R.push(a)}else if(k("const")){let a=e;if(e+=5,w(),k("enum")){e=a+5,w();let l=nt(s,!0,!0);R.push(l)}else{e=a;let l=Ye(s,"const",!0);for(let u=0;u<l.length;u++)R.push(l[u])}}else _e();else if(o===97&&k("abstract")){if(e+=8,w(),k("class")){let a=Je(s,!0,!0);R.push(a)}}else if(o===108&&k("let")){let a=Ye(s,"let",!0);for(let l=0;l<a.length;l++)R.push(a[l])}else if(o===118&&k("var")){let a=Ye(s,"var",!0);for(let l=0;l<a.length;l++)R.push(a[l])}else if(o===101&&k("enum")){let a=nt(s,!0,!1);R.push(a)}else if(o===100&&k("declare"))e+=7,w(),Xt(s,!0);else if(o===110&&k("namespace")&&lt(9)){let a=it(s,!0,"namespace");R.push(a)}else if(o===109&&k("module")&&lt(6)){let a=it(s,!0,"module");R.push(a)}else if(o===P){Bt();let a=G(s,e),l=a.includes("export type"),u=Fe(s);R.push({kind:"export",name:"",text:a,isExported:!0,isTypeOnly:l,source:ft(a),leadingComments:u,start:s,end:e})}else if(o===Ce){Ht();let a=G(s,e),l=Fe(s);R.push({kind:"export",name:"",text:a,isExported:!0,isTypeOnly:!1,source:ft(a),leadingComments:l,start:s,end:e})}else{_e();let a=G(s,e);if(a)R.push({kind:"export",name:"",text:a,isExported:!0,start:s,end:e})}}else if(r===100&&k("declare"))e+=7,w(),Xt(s,!1);else if(r===105&&k("interface")){let o=St(s,!1);re.set(o.name,o)}else if(r===116&&k("type")){let o=vt(s,!1);re.set(o.name,o),R.push(o)}else if(r===102&&k("function")){let o=Ze(s,!1,!1,!1);if(o)X(o);else _e()}else if(r===97)if(k("async")){let o=e;if(e+=5,w(),k("function")){let a=Ze(s,!1,!0,!1);if(a)X(a);else e=o,_e()}else e=o,_e()}else if(k("abstract"))if(e+=8,w(),k("class")){let o=Je(s,!1,!1);re.set(o.name,o),R.push(o)}else _e();else e++,_e();else if(r===99)if(k("class")){let o=Je(s,!1,!1);re.set(o.name,o),R.push(o)}else if(k("const")){let o=e;if(e+=5,w(),k("enum")){e=o+5,w();let a=nt(s,!1,!0);re.set(a.name,a),R.push(a)}else{e=o;let a=Ye(s,"const",!1);for(let l=0;l<a.length;l++)re.set(a[l].name,a[l])}}else e++,_e();else if(r===101&&k("enum")){let o=nt(s,!1,!1);re.set(o.name,o),R.push(o)}else if(r===108&&k("let")||r===118&&k("var")){let o=k("let")?"let":"var",a=Ye(s,o,!1);for(let l=0;l<a.length;l++)re.set(a[l].name,a[l])}else if(r===109&&k("module")&&lt(6)){let o=it(s,!1,"module");R.push(o)}else if(r===110&&k("namespace")&&lt(9)){let o=it(s,!1,"namespace");R.push(o)}else{let o=f.charCodeAt(e);if(o===Q)e++;else if(o===fe||o===pe){if(Ne(o),e<C&&f.charCodeAt(e)===Q)e++}else if(o===Se){if(st(),e<C&&f.charCodeAt(e)===Q)e++}else if(o===wn){if(e++,$e(),w(),e<C&&f.charCodeAt(e)===Ve)e++,$e(),w();if(e<C&&f.charCodeAt(e)===Z)ve(Z,ue)}else e++,_e()}}if(Ae.size>0){Jt(R);for(let s of U.values())Jt(s)}if(Rn(f,R,re,U),Mn(R,re),Vn(R,re),!de)Fn(f,R,re,ee);if(Y){let s=new Set(R);for(let r of[...re.values(),...[...U.values()].flat()])if(!s.has(r))R.push(r),s.add(r);return R.sort((r,o)=>(r.start??0)-(o.start??0))}if(re.size>0)Sn(R,re,U);return R;function Jt(s){let r=new Map;for(let a of s)if(a.kind==="function")r.set(a.name,(r.get(a.name)||0)+1);let o=new Set;for(let[a,l]of r)if(l>1)o.add(a);if(o.size>0){let a=new Set;for(let l of o)for(let u=s.length-1;u>=0;u--)if(s[u].kind==="function"&&s[u].name===l&&Ae.has(s[u])){a.add(u);break}if(a.size>0){let l=[...a].sort((u,A)=>A-u);for(let u of l)s.splice(u,1)}}}function Xt(s,r){if(k("function")){let o=Ze(s,r,!1,!1);if(o)R.push(o)}else if(k("async")){if(e+=5,w(),k("function")){let o=Ze(s,r,!0,!1);if(o)R.push(o)}}else if(k("class")){let o=Je(s,r,!1);R.push(o)}else if(k("abstract")){if(e+=8,w(),k("class")){let o=Je(s,r,!0);R.push(o)}}else if(k("interface")){let o=St(s,r);R.push(o)}else if(k("type")){let o=vt(s,r);R.push(o)}else if(k("enum")){let o=nt(s,r,!1);R.push(o)}else if(k("const")){let o=e;if(e+=5,w(),k("enum")){e=o+5,w();let a=nt(s,r,!0);R.push(a)}else{e=o;let a=Ye(s,"const",r);for(let l=0;l<a.length;l++)if(r||!se)R.push(a[l]);else re.set(a[l].name,a[l])}}else if(k("let")||k("var")){let o=k("let")?"let":"var",a=Ye(s,o,r);for(let l=0;l<a.length;l++)if(r||!se)R.push(a[l]);else re.set(a[l].name,a[l])}else if(k("module")){let o=it(s,r,"module");R.push(o)}else if(k("namespace")){let o=it(s,r,"namespace");R.push(o)}else if(k("global")){e+=6,w();let a=`declare global ${e<C&&f.charCodeAt(e)===P?It():"{}"}`,l=Fe(s);R.push({kind:"module",name:"global",text:a,isExported:!1,moduleForm:"global",leadingComments:l,start:s,end:e})}else _e()}}class tn{names;lengths=new Uint8Array(65);firstUnits=new Uint8Array(65536);size;constructor(v){this.names=v;for(let V of v.keys()){if(!V)continue;this.lengths[Math.min(V.length,64)]=1,this.firstUnits[V.charCodeAt(0)]=1}this.size=v.size}scan(v,V){if(this.size===0)return!1;let L=!1,N=0,Y=v.length;while(N<Y){let ee=v.charCodeAt(N);if(ee>=65&&ee<=90||ee>=97&&ee<=122||ee===95||ee===36||ee>127){let f=N;N++;while(N<Y){let F=v.charCodeAt(N);if(F>=65&&F<=90||F>=97&&F<=122||F>=48&&F<=57||F===95||F===36||F>127)N++;else break}if(this.firstUnits[ee]===1&&this.lengths[Math.min(N-f,64)]===1){let F=v.substring(f,N),de=this.names.get(F);if(de!==void 0){if(V.add(F),de.kind==="function"||de.kind==="variable")L=!0}}}else N++}return L}}function en(v,V){let L=0;while(L<v.length){let N=v.charCodeAt(L);if(N===fe||N===pe||N===Se){let se=N;L++;while(L<v.length)if(v.charCodeAt(L)===ze)L+=2;else if(v.charCodeAt(L++)===se)break;continue}if(N===H&&v.charCodeAt(L+1)===H){L+=2;while(L<v.length&&v.charCodeAt(L)!==me&&v.charCodeAt(L)!==ke)L++;continue}if(N===H&&v.charCodeAt(L+1)===Ce){let se=v.indexOf("*/",L+2);L=se===-1?v.length:se+2;continue}if(!c(N)){L++;continue}let Y=L++;while(L<v.length&&i(v.charCodeAt(L)))L++;let ee=Y-1,f=L;while(ee>=0&&Ie(v.charCodeAt(ee)))ee--;while(f<v.length&&Ie(v.charCodeAt(f)))f++;let F=ee>=0?v.charCodeAt(ee):0,de=f<v.length?v.charCodeAt(f):0,C=Y>=3&&v.slice(Y-3,Y)==="...";if(de===Ge||F===Ve&&!C)continue;if(de===Z&&(F===P||F===Ke))continue;V.add(v.slice(Y,L))}}function Sn(v,V,L){let N=new Set,Y=new Set;for(let se of v)Y.add(se.name);let ee=new tn(V),f=new Set,F=new Set,de=(se)=>{if(ee.scan(se.text,f))Gn(se,F)},C=new Set;for(let se=0;se<v.length;se++){let R=v[se];if(R.kind!=="import"){if(de(R),typeof R.value==="string")en(R.value,C)}}for(;;){let se=[];for(let[U,Ae]of V){if(N.has(U))continue;if((Ae.kind==="function"||Ae.kind==="variable"?F:f).has(U)||Ae.kind!=="function"&&C.has(U)){if(!Y.has(U)){let oe=Ae.kind==="function"?L.get(U):void 0;if(oe)for(let le of oe)se.push(le);else se.push(Ae);Y.add(U)}N.add(U)}}if(se.length===0)break;se.sort((U,Ae)=>(U.start??1/0)-(Ae.start??1/0));let R=[],re=0;for(let U=0;U<v.length;U++){let Ae=v[U].start??1/0;while(re<se.length&&(se[re].start??1/0)<=Ae)R.push(se[re++]);R.push(v[U])}while(re<se.length)R.push(se[re++]);v.length=0;for(let U=0;U<R.length;U++)v.push(R[U]);for(let U of se)if(U.kind!=="import"){if(de(U),typeof U.value==="string")en(U.value,C)}}}
37
+ export{bi,va,T,O,Pt};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ class Bt{config;types=new Map;imports=new Map;relationships=[];usageMap=new Map;constructor(e={}){this.config={types:!1,relationships:!1,usage:!1,imports:!1,importUsage:!1,importRelationships:!1,...e}}trackType(e,s){if(!this.config.types)return;if(["interface","type","class","enum"].includes(e.kind)){if(this.types.get(e.name))return;let i={name:e.name,kind:e.kind,file:s,usedBy:new Set,references:new Set,extendsFrom:e.extends?[e.extends]:void 0,implementsFrom:e.implements};if(this.types.set(e.name,i),this.config.relationships){if(e.extends)this.relationships.push({from:e.name,to:e.extends,kind:"extends",file:s});if(e.implements)for(let n of e.implements)this.relationships.push({from:e.name,to:n,kind:"implements",file:s})}}}trackTypeUsage(e,s,t){if(!this.config.usage)return;let i=this.types.get(e);if(i)i.usedBy.add(s);let n=this.usageMap.get(e)||new Set;if(n.add(`${t}:${s}`),this.usageMap.set(e,n),this.config.relationships)this.relationships.push({from:s,to:e,kind:"uses",file:t})}trackImport(e,s,t,i){if(!this.config.imports)return;let n={source:e,specifiers:s,isTypeOnly:t,file:i,usedSpecifiers:new Set,unusedSpecifiers:new Set(s)},r=this.imports.get(i)||[];r.push(n),this.imports.set(i,r)}trackImportUsage(e,s){if(!this.config.importUsage)return;let t=this.imports.get(s);if(!t)return;for(let i of t)if(i.specifiers.includes(e))i.usedSpecifiers.add(e),i.unusedSpecifiers.delete(e)}trackTypeReference(e,s){if(!this.config.types)return;let t=this.types.get(e);if(t)t.references.add(s)}getResults(){let e=[],s=[];for(let[n,r]of this.types)if(r.usedBy.size===0&&r.references.size===0)e.push(n);for(let n of this.imports.values())for(let r of n)if(r.unusedSpecifiers.size===r.specifiers.length)s.push(r);let t=this.detectCircularReferences(),i={totalTypes:this.types.size,usedTypes:this.types.size-e.length,unusedTypes:e.length,totalImports:Array.from(this.imports.values()).flat().length,usedImports:Array.from(this.imports.values()).flat().filter((n)=>n.usedSpecifiers.size>0).length,unusedImports:s.length,totalRelationships:this.relationships.length,circularDependencies:t.length};return{types:this.types,imports:this.imports,relationships:this.relationships,unusedTypes:e,unusedImports:s,circularReferences:t,statistics:i}}detectCircularReferences(){let e=[],s=new Set,t=[],i=(n)=>{if(t.includes(n)){let o=t.indexOf(n);e.push(t.slice(o));return}if(s.has(n))return;s.add(n),t.push(n);let r=this.relationships.filter((o)=>o.from===n&&(o.kind==="extends"||o.kind==="implements"||o.kind==="references")).map((o)=>o.to);for(let o of r)i(o);t.pop()};for(let n of this.types.keys())i(n);return e}clear(){this.types.clear(),this.imports.clear(),this.relationships=[],this.usageMap.clear()}formatResults(){let e=this.getResults(),s=["=== Tracking Results ===",""];if(s.push("Statistics:"),s.push(` Total types: ${e.statistics.totalTypes}`),s.push(` Used types: ${e.statistics.usedTypes}`),s.push(` Unused types: ${e.statistics.unusedTypes}`),s.push(` Total imports: ${e.statistics.totalImports}`),s.push(` Used imports: ${e.statistics.usedImports}`),s.push(` Unused imports: ${e.statistics.unusedImports}`),s.push(` Type relationships: ${e.statistics.totalRelationships}`),s.push(` Circular dependencies: ${e.statistics.circularDependencies}`),s.push(""),e.unusedTypes.length>0){s.push("Unused types:");for(let t of e.unusedTypes){let i=e.types.get(t);s.push(` - ${t} (${i?.kind}) in ${i?.file}`)}s.push("")}if(e.unusedImports.length>0){s.push("Unused imports:");for(let t of e.unusedImports)s.push(` - ${t.source} in ${t.file}`),s.push(` Specifiers: ${Array.from(t.unusedSpecifiers).join(", ")}`);s.push("")}if(e.circularReferences.length>0){s.push("Circular references:");for(let t of e.circularReferences)s.push(` - ${t.join(" -> ")} -> ${t[0]}`);s.push("")}return s.join(`
3
+ `)}}function Wt(e){return new Bt(e)}function jt(e,s,t){for(let i of e){if(t.trackType(i,s),i.typeAnnotation){let n=p(i.typeAnnotation);for(let r of n)t.trackTypeUsage(r,i.name,s)}if(i.extends)t.trackTypeUsage(i.extends,i.name,s);if(i.implements)for(let n of i.implements)t.trackTypeUsage(n,i.name,s);if(i.kind==="import"&&i.source&&i.specifiers)t.trackImport(i.source,i.specifiers.map((n)=>n.name),i.isTypeOnly||!1,s)}}function p(e){let s=[],t=new Set(["string","number","boolean","any","unknown","void","never","null","undefined","object","symbol","bigint","true","false","readonly","keyof","typeof","infer","extends","in","out"]),i=/\b([A-Z]\w*)\b/g,n;while((n=i.exec(e))!==null){let r=n[1];if(!t.has(r.toLowerCase())&&!s.includes(r))s.push(r)}return s}function es(e,s){let t=Wt({imports:!0,importUsage:!0,importRelationships:!0,...s});for(let[i,n]of e)jt(n,i,t);return t.getResults()}function ts(e,s){let t=Wt({types:!0,relationships:!0,usage:!0,...s});for(let[i,n]of e)jt(n,i,t);return t.getResults()}
4
+ export{Bt,Wt,jt,es,ts};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ var r=/^\/\/\/\s*<reference\s+(?:path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/,E=/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/,f=/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/;function dn(t){let l=[],a=0;for(let e=0;e<=t.length;e++)if(e===t.length||t[e]===`
3
+ `){let n=a,i=e;while(n<i&&(t[n]===" "||t[n]==="\t"||t[n]==="\r"))n++;while(i>n&&(t[i-1]===" "||t[i-1]==="\t"||t[i-1]==="\r"))i--;let s=t.slice(n,i);if(a=e+1,s.startsWith("///")){if(s.indexOf("<")===-1)continue;if(r.test(s)||E.test(s)||f.test(s))l.push(s)}else if(s===""||s.startsWith("//"))continue;else break}return l}
4
+ export{dn};
@@ -0,0 +1,5 @@
1
+ // @bun
2
+ function c(t){return t>=65&&t<=90||t>=97&&t<=122||t===95||t===36||t>127}function i(t){return c(t)||t>=48&&t<=57}function L(t,_){let n=_;for(;;){while(n>=0&&(t.charCodeAt(n)===32||t.charCodeAt(n)===9||t.charCodeAt(n)===10||t.charCodeAt(n)===13))n--;if(n<0)return-1;if(t.charCodeAt(n)===47&&n>0&&t.charCodeAt(n-1)===42){let C=t.lastIndexOf("/*",n-2);if(C===-1)return-1;n=C-1;continue}let r=t.lastIndexOf(`
3
+ `,n)+1,o=E(t,r,n);if(o!==-1){n=o-1;continue}return n}}function E(t,_,n){let r=0;for(let o=_;o<=n;o++){let C=t.charCodeAt(o);if(r){if(C===92){o++;continue}if(C===r)r=0;continue}if(C===39||C===34||C===96){r=C;continue}if(C===47&&o+1<=n&&t.charCodeAt(o+1)===47)return o}return-1}function u(t){return t===61||t===40||t===91||t===33||t===38||t===124||t===63||t===58||t===44||t===59||t===123||t===125||t===94||t===126||t===43||t===45||t===42||t===37||t===60||t===62}function R(t){return t==="return"||t==="typeof"||t==="void"||t==="delete"||t==="throw"||t==="new"||t==="in"||t==="of"||t==="case"||t==="instanceof"||t==="yield"||t==="await"||t==="else"||t==="do"}function b(t,_){let n=[],r=[],o=0,C=!1,l="",s="",S=!0,e=0,f=(H,A=!1)=>{s=l,l=H,S=A};while(e<=_){let H=t.charCodeAt(e);if(C){if(H===92){e+=2;continue}if(H===96)C=!1,f("literal");else if(H===36&&t.charCodeAt(e+1)===123)r.push(o++),C=!1,f("{",!0),e++;e++;continue}if(H===32||H===9||H===10||H===13){e++;continue}if(H===47&&t.charCodeAt(e+1)===47){let A=t.indexOf(`
4
+ `,e+2);e=A===-1?t.length:A+1;continue}if(H===47&&t.charCodeAt(e+1)===42){let A=t.indexOf("*/",e+2);e=A===-1?t.length:A+2;continue}if(H===39||H===34){let A=H;e++;while(e<t.length){let a=t.charCodeAt(e++);if(a===92)e++;else if(a===A)break}f("literal");continue}if(H===96){C=!0,e++;continue}if(c(H)||H===35&&c(t.charCodeAt(e+1))){let A=e++;while(i(t.charCodeAt(e)))e++;let a=t.slice(A,e);f(a,l!=="."&&R(a));continue}if(H===40){let A=s!=="."&&(l==="if"||l==="while"||l==="for"||l==="with"||l==="switch"||l==="catch"||l==="await"&&s==="for");n.push(A),f("(",!0)}else if(H===41){let A=n.pop()??!1;if(e===_)return A;f(")",A)}else if(H===47&&S){e=ce(t,e),f("literal");continue}else{if(H===123)o++;else if(H===125){if(o--,r.at(-1)===o)r.pop(),C=!0}f(t[e],H===47||u(H))}e++}return!1}function Oe(t,_){let n=L(t,_-1);if(n<0)return!0;let r=t.charCodeAt(n);if(r===41)return b(t,n);if(u(r))return!0;if(i(r)){let o=n;while(o>=0&&i(t.charCodeAt(o)))o--;let C=t.charCodeAt(L(t,o));if(C===46||C===35)return!1;return R(t.slice(o+1,n+1))}return!1}function ce(t,_){let n=_,r=t.length;n++;let o=!1;while(n<r){let C=t.charCodeAt(n);if(C===92){n+=2;continue}if(o){if(C===93)o=!1;n++;continue}if(C===91){o=!0,n++;continue}if(C===47){n++;break}if(C===10||C===13)break;n++}while(n<r&&i(t.charCodeAt(n)))n++;return n}
5
+ export{c,i,Oe,ce};
@@ -0,0 +1,11 @@
1
+ import type { ModuleResolver } from './module-graph.js';
2
+ /** Quoted ambient modules in an external module augment an existing module. */
3
+ export declare function scanModuleAugmentations(source: string): string[];
4
+ /**
5
+ * Find original import paths that activate augmentations of declaration-reachable
6
+ * project or external modules. Retain the paths, not unused value bindings. This analysis
7
+ * never publishes outputs or invokes a native or TypeScript emitter.
8
+ * The analysis universe may include excluded sources; delivery policy still
9
+ * decides whether a required path can actually be published by the caller.
10
+ */
11
+ export declare function planAugmentationImports(files: readonly string[], resolveModule: ModuleResolver, isolatedDeclarations?: boolean, sourceSnapshots?: ReadonlyMap<string, string>): Promise<ReadonlyMap<string, ReadonlySet<string>>>;
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Uo,we}from"../chunk-g2120ysy.js";import"../chunk-4fygcxtb.js";import"../chunk-73dzve1s.js";import"../chunk-jcckwgb9.js";import"../chunk-189nn4fc.js";import"../chunk-83qnrx0m.js";import"../chunk-sd8bywh9.js";import"../chunk-3fbt79hx.js";import"../chunk-pga5m4wm.js";import"../chunk-v6fwy63g.js";import"../chunk-yx1jy7fx.js";import"../chunk-cyr45de1.js";import"../chunk-xfjfhe9d.js";import"../chunk-xa6rsd4b.js";import"../chunk-ft2zk7jx.js";import"../chunk-vf3ybe5r.js";import"../chunk-3t57mzvf.js";import"../chunk-ag1b6d30.js";import"../chunk-8d3sdkv4.js";import"../chunk-cv29b4zb.js";import"../chunk-32qexm3w.js";import"../chunk-0rmbc5zp.js";import"../chunk-42j9cfte.js";import"../chunk-1qtghb2x.js";import"../chunk-1j6092xz.js";import"../chunk-zq93f8ca.js";export{we as planAugmentationImports,Uo as scanModuleAugmentations};
@@ -0,0 +1,18 @@
1
+ import type { Declaration } from './types.js';
2
+ /** Only targets bind names; computed keys and defaults remain free references. */
3
+ export declare function bindingPatternNames(pattern: string): string[];
4
+ /**
5
+ * Ambient parameter binding patterns are legal declaration syntax. Their typed
6
+ * projections preserve TypeScript's own rest/tuple/iterable and member identity
7
+ * rules, without emitting implementation bodies or invoking a compiler emitter.
8
+ */
9
+ export declare function projectBindingPattern(options: BindingProjectionOptions): Declaration[];
10
+ export declare interface BindingProjectionOptions {
11
+ pattern: string
12
+ patternOffset: number
13
+ root: Declaration
14
+ kind: string
15
+ exported: boolean
16
+ comments?: string[]
17
+ allocateName: () => string
18
+ }
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Kn,qn}from"../chunk-42j9cfte.js";import"../chunk-1j6092xz.js";import"../chunk-zq93f8ca.js";export{Kn as bindingPatternNames,qn as projectBindingPattern};
@@ -0,0 +1,159 @@
1
+ import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
2
+ /**
3
+ * Type guard and constructor for FilePath
4
+ */
5
+ export declare function asFilePath(path: string): FilePath;
6
+ /**
7
+ * Type guard and constructor for DirectoryPath
8
+ */
9
+ export declare function asDirectoryPath(path: string): DirectoryPath;
10
+ /**
11
+ * Type guard and constructor for GlobPattern
12
+ */
13
+ export declare function asGlobPattern(pattern: string): GlobPattern;
14
+ /**
15
+ * Type guard and constructor for SourceCode
16
+ */
17
+ export declare function asSourceCode(code: string): SourceCode;
18
+ /**
19
+ * Type guard and constructor for DtsContent
20
+ */
21
+ export declare function asDtsContent(content: string): DtsContent;
22
+ /**
23
+ * Type guard and constructor for ModuleSpecifier
24
+ */
25
+ export declare function asModuleSpecifier(specifier: string): ModuleSpecifier;
26
+ /**
27
+ * Type guard and constructor for TypeName
28
+ */
29
+ export declare function asTypeName(name: string): TypeName;
30
+ /**
31
+ * Type guard and constructor for DeclarationName
32
+ */
33
+ export declare function asDeclarationName(name: string): DeclarationName;
34
+ /**
35
+ * Type guard and constructor for AbsolutePath
36
+ */
37
+ export declare function asAbsolutePath(path: string): AbsolutePath;
38
+ /**
39
+ * Type guard and constructor for RelativePath
40
+ */
41
+ export declare function asRelativePath(path: string): RelativePath;
42
+ /**
43
+ * Type guard and constructor for JsonString
44
+ */
45
+ export declare function asJsonString(json: string): JsonString;
46
+ /**
47
+ * Check if a value is a branded type of a specific brand
48
+ */
49
+ export declare function isBranded<T, B extends string>(value: unknown, _brand: B): value is Brand<T, B>;
50
+ /**
51
+ * Unwrap a branded type to its base type
52
+ * Useful when you need to pass branded types to external APIs
53
+ */
54
+ export declare function unwrap<T>(branded: Brand<T, string>): T;
55
+ /**
56
+ * Brand symbol for creating nominal types
57
+ */
58
+ declare const __brand: unique symbol;
59
+ /**
60
+ * Safe path operations that preserve branding.
61
+ * Uses ESM imports hoisted to module scope so each call avoids the per-call
62
+ * `require('node:path')` overhead that the previous CommonJS-style implementation
63
+ * incurred.
64
+ * @defaultValue
65
+ * ```ts
66
+ * {
67
+ * join: (base: DirectoryPath, ...segments: string[]) => FilePath,
68
+ * dirname: (path: FilePath) => DirectoryPath,
69
+ * basename: (path: FilePath) => string,
70
+ * resolve: (...segments: string[]) => AbsolutePath,
71
+ * isAbsolute: (path: string) => path is AbsolutePath,
72
+ * relative: (from: DirectoryPath, to: FilePath) => RelativePath
73
+ * }
74
+ * ```
75
+ */
76
+ export declare const BrandedPath: {
77
+ /**
78
+ * Join path segments, returning appropriate branded type
79
+ */
80
+ join: (base: DirectoryPath, ...segments: string[]) => FilePath;
81
+ /**
82
+ * Get directory name from a file path
83
+ */
84
+ dirname: (path: FilePath) => DirectoryPath;
85
+ /**
86
+ * Get base name from a file path
87
+ */
88
+ basename: (path: FilePath) => string;
89
+ /**
90
+ * Resolve path to absolute
91
+ */
92
+ resolve: (...segments: string[]) => AbsolutePath;
93
+ /**
94
+ * Check if path is absolute
95
+ */
96
+ isAbsolute: (path: string) => path is AbsolutePath;
97
+ /**
98
+ * Get relative path from one path to another
99
+ */
100
+ relative: (from: DirectoryPath, to: FilePath) => RelativePath
101
+ };
102
+ /**
103
+ * Generic branded type creator
104
+ */
105
+ export type Brand<T, B extends string> = T & { readonly [__brand]: B }
106
+ /**
107
+ * Branded type for file paths
108
+ * Ensures file paths are validated before use
109
+ */
110
+ export type FilePath = Brand<string, 'FilePath'>;
111
+ /**
112
+ * Branded type for directory paths
113
+ */
114
+ export type DirectoryPath = Brand<string, 'DirectoryPath'>;
115
+ /**
116
+ * Branded type for glob patterns
117
+ */
118
+ export type GlobPattern = Brand<string, 'GlobPattern'>;
119
+ /**
120
+ * Branded type for TypeScript source code
121
+ */
122
+ export type SourceCode = Brand<string, 'SourceCode'>;
123
+ /**
124
+ * Branded type for declaration file content
125
+ */
126
+ export type DtsContent = Brand<string, 'DtsContent'>;
127
+ /**
128
+ * Branded type for module specifiers (import paths)
129
+ */
130
+ export type ModuleSpecifier = Brand<string, 'ModuleSpecifier'>;
131
+ /**
132
+ * Branded type for type names
133
+ */
134
+ export type TypeName = Brand<string, 'TypeName'>;
135
+ /**
136
+ * Branded type for declaration names
137
+ */
138
+ export type DeclarationName = Brand<string, 'DeclarationName'>;
139
+ /**
140
+ * Branded type for validated JSON strings
141
+ */
142
+ export type JsonString = Brand<string, 'JsonString'>;
143
+ /**
144
+ * Branded type for absolute paths
145
+ */
146
+ export type AbsolutePath = Brand<string, 'AbsolutePath'>;
147
+ /**
148
+ * Branded type for relative paths
149
+ */
150
+ export type RelativePath = Brand<string, 'RelativePath'>;
151
+ /**
152
+ * Type utility to extract the brand from a branded type
153
+ */
154
+ export type ExtractBrand<T> = T extends Brand<unknown, infer B> ? B : never;
155
+ /**
156
+ * Type utility to extract the base type from a branded type
157
+ */
158
+ export type ExtractBase<T> = T extends Brand<infer U, string> ? U : T;
159
+ export {};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$i,Ei,ki,Ti,Ai,Pi,Di,Ri,Mi,Oi,Ii,Fi,Li,Ni}from"../chunk-9gts9ymh.js";export{Ni as BrandedPath,Mi as asAbsolutePath,Ri as asDeclarationName,Ei as asDirectoryPath,Ai as asDtsContent,$i as asFilePath,ki as asGlobPattern,Ii as asJsonString,Pi as asModuleSpecifier,Oi as asRelativePath,Ti as asSourceCode,Di as asTypeName,Fi as isBranded,Li as unwrap};