@dtsx/dtsx 0.11.47 → 0.11.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/bin/cli.js +1 -1
  2. package/dist/{chunk-2h5p8n7w.js → chunk-02yqpwv0.js} +2 -2
  3. package/dist/{chunk-z0aa0gd8.js → chunk-0rk4cvt6.js} +1 -1
  4. package/dist/{chunk-8qpzh9yc.js → chunk-0v6vmemf.js} +3 -3
  5. package/dist/{chunk-c7dw612y.js → chunk-1mg4cxd3.js} +1 -1
  6. package/dist/{chunk-1xgcs6aq.js → chunk-258337ef.js} +1 -1
  7. package/dist/{chunk-dpd2b7dd.js → chunk-25vpx6mq.js} +1 -1
  8. package/dist/{chunk-zaka2jk1.js → chunk-2t2xwzj5.js} +1 -1
  9. package/dist/{chunk-xg8yhpe6.js → chunk-31rb15pe.js} +2 -2
  10. package/dist/{chunk-qmg1535a.js → chunk-3mp0jaa7.js} +2 -2
  11. package/dist/{chunk-ga769zw5.js → chunk-4kv50gfv.js} +1 -1
  12. package/dist/{chunk-j32xn94r.js → chunk-4p9dw996.js} +1 -1
  13. package/dist/{chunk-thzkm86y.js → chunk-5rrxzd1e.js} +2 -2
  14. package/dist/{chunk-swmftav9.js → chunk-5zzvxzey.js} +2 -2
  15. package/dist/chunk-6exq13f9.js +7 -0
  16. package/dist/{chunk-pp9aevcb.js → chunk-90jwk3zy.js} +2 -2
  17. package/dist/{chunk-rnvqc8st.js → chunk-937czex4.js} +2 -2
  18. package/dist/{chunk-pjqd38w1.js → chunk-9xep96k0.js} +2 -2
  19. package/dist/{chunk-kp6qv2fb.js → chunk-a5tvswq1.js} +1 -1
  20. package/dist/{chunk-k472ve44.js → chunk-aj2n4x1b.js} +1 -1
  21. package/dist/{chunk-4mrq1jdn.js → chunk-av03sjse.js} +1 -1
  22. package/dist/{chunk-6bmr0e81.js → chunk-b6xcyrnx.js} +5 -5
  23. package/dist/{chunk-trvp818c.js → chunk-beg5vxdm.js} +1 -1
  24. package/dist/{chunk-nxqap7nx.js → chunk-bkwzva5v.js} +1 -1
  25. package/dist/{chunk-ac95p5v4.js → chunk-bsj770f8.js} +3 -3
  26. package/dist/{chunk-rkpwmkrm.js → chunk-bvtzfznj.js} +1 -1
  27. package/dist/{chunk-v4z6808c.js → chunk-c6bfdmfy.js} +1 -1
  28. package/dist/{chunk-gqk2s9wt.js → chunk-e29deb0h.js} +2 -2
  29. package/dist/{chunk-6m8f0y7w.js → chunk-ef428m5g.js} +2 -2
  30. package/dist/{chunk-y1xq2hm4.js → chunk-fp40v5jx.js} +1 -1
  31. package/dist/{chunk-2wxgt73q.js → chunk-fvr0rwgt.js} +1 -1
  32. package/dist/{chunk-em9pz9s0.js → chunk-gcgtyjyj.js} +1 -1
  33. package/dist/{chunk-0af0hsfc.js → chunk-gyfbehkf.js} +4 -4
  34. package/dist/chunk-h12vphnz.js +10 -0
  35. package/dist/{chunk-k75z3nef.js → chunk-h3r142dy.js} +2 -2
  36. package/dist/{chunk-t7jvkq9j.js → chunk-j4t8d6p0.js} +1 -1
  37. package/dist/{chunk-0nw1w523.js → chunk-ka9qyjzn.js} +4 -4
  38. package/dist/{chunk-yapmefw7.js → chunk-m7jndt3v.js} +19 -19
  39. package/dist/{chunk-kdqckf54.js → chunk-n833rcmj.js} +1 -1
  40. package/dist/{chunk-nmjxxcvg.js → chunk-nh71w1ta.js} +8 -8
  41. package/dist/{chunk-wwmeat5n.js → chunk-ntps0jm2.js} +1 -1
  42. package/dist/chunk-p4dpq81g.js +27 -0
  43. package/dist/chunk-qx0pxmvs.js +38 -0
  44. package/dist/{chunk-hbe5sg17.js → chunk-r4dq05mh.js} +1 -1
  45. package/dist/{chunk-rdb7j1d6.js → chunk-s6bjmr93.js} +2 -2
  46. package/dist/{chunk-2xp48sa2.js → chunk-s6tmjqsc.js} +1 -1
  47. package/dist/{chunk-dw84pjmf.js → chunk-skydb7vs.js} +3 -3
  48. package/dist/{chunk-4kn7y9ns.js → chunk-taa77k3y.js} +1 -1
  49. package/dist/{chunk-ry1c863d.js → chunk-tgfj7kre.js} +1 -1
  50. package/dist/{chunk-h7tsf2qg.js → chunk-txf9rw55.js} +24 -24
  51. package/dist/{chunk-986k5306.js → chunk-vk5r6pgx.js} +2 -2
  52. package/dist/{chunk-wrjrwren.js → chunk-vrvzmysf.js} +1 -1
  53. package/dist/{chunk-jtq24yb8.js → chunk-vvy85nm6.js} +1 -1
  54. package/dist/{chunk-0kvy1dh8.js → chunk-w60gzzxc.js} +2 -2
  55. package/dist/{chunk-gsvb5wey.js → chunk-w9jg9761.js} +1 -1
  56. package/dist/{chunk-0gwj2fct.js → chunk-xawz3n8s.js} +1 -1
  57. package/dist/{chunk-hcf0hd85.js → chunk-xcfbw2r7.js} +1 -1
  58. package/dist/{chunk-a8djrg2n.js → chunk-xsaw8abt.js} +2 -2
  59. package/dist/chunk-yapz0de1.js +3 -0
  60. package/dist/chunk-zrfwvjq8.js +4 -0
  61. package/dist/{chunk-ehpz5rg3.js → chunk-zrmg0q1q.js} +15 -15
  62. package/dist/src/augmentation-graph.js +1 -1
  63. package/dist/src/binding-patterns.js +1 -1
  64. package/dist/src/branded-types.js +1 -1
  65. package/dist/src/bundle-linker.js +1 -1
  66. package/dist/src/bundler.js +1 -1
  67. package/dist/src/cache.js +1 -1
  68. package/dist/src/call-signatures.js +1 -1
  69. package/dist/src/circular.js +1 -1
  70. package/dist/src/compat.js +1 -1
  71. package/dist/src/computed-keys.js +1 -1
  72. package/dist/src/config.js +1 -1
  73. package/dist/src/declaration-project.js +1 -1
  74. package/dist/src/declaration-publication.js +1 -1
  75. package/dist/src/declaration-references.d.ts +1 -1
  76. package/dist/src/declaration-references.js +1 -1
  77. package/dist/src/diff.js +1 -1
  78. package/dist/src/docs.js +1 -1
  79. package/dist/src/enum-declarations.js +1 -1
  80. package/dist/src/errors.js +1 -1
  81. package/dist/src/extractor/extract.js +1 -1
  82. package/dist/src/extractor/scanner.js +1 -1
  83. package/dist/src/extractor.js +1 -1
  84. package/dist/src/function-properties.js +1 -1
  85. package/dist/src/generator.js +1 -1
  86. package/dist/src/incremental.js +1 -1
  87. package/dist/src/index.js +1 -1
  88. package/dist/src/inferred-imports.js +1 -1
  89. package/dist/src/initializer-type-spans.js +1 -1
  90. package/dist/src/lexical.js +1 -1
  91. package/dist/src/logger.js +1 -1
  92. package/dist/src/lsp.js +1 -1
  93. package/dist/src/memory.js +1 -1
  94. package/dist/src/module-graph.js +1 -1
  95. package/dist/src/module-references.js +1 -1
  96. package/dist/src/native-checker.js +1 -1
  97. package/dist/src/native-extractor.js +1 -1
  98. package/dist/src/native-generation.js +1 -1
  99. package/dist/src/native-project.js +1 -1
  100. package/dist/src/numeric-literals.js +1 -1
  101. package/dist/src/optimizer.js +1 -1
  102. package/dist/src/parallel-processor.js +1 -1
  103. package/dist/src/parameters.js +1 -1
  104. package/dist/src/parser.js +1 -1
  105. package/dist/src/plugins/bun.js +1 -1
  106. package/dist/src/plugins/esbuild.js +1 -1
  107. package/dist/src/plugins/index.js +1 -1
  108. package/dist/src/plugins/tsdown.js +1 -1
  109. package/dist/src/plugins/tsup.js +1 -1
  110. package/dist/src/plugins/vite.js +1 -1
  111. package/dist/src/plugins/webpack.js +1 -1
  112. package/dist/src/process-source.js +1 -1
  113. package/dist/src/processor/declarations.js +1 -1
  114. package/dist/src/processor/import-usage.js +1 -1
  115. package/dist/src/processor/imports.js +1 -1
  116. package/dist/src/processor/index.js +1 -1
  117. package/dist/src/processor/type-inference.js +1 -1
  118. package/dist/src/processor.js +1 -1
  119. package/dist/src/return-type-scope.js +1 -1
  120. package/dist/src/security.js +1 -1
  121. package/dist/src/source-cache.js +1 -1
  122. package/dist/src/sourcemap.js +1 -1
  123. package/dist/src/transformers.js +1 -1
  124. package/dist/src/utils.js +1 -1
  125. package/dist/src/value-inference.js +1 -1
  126. package/dist/src/worker-thread.js +1 -1
  127. package/dist/src/worker.js +1 -1
  128. package/dist/src/workspace.js +1 -1
  129. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  130. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  131. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  132. package/native/linux-arm64/libzig-dtsx.so +0 -0
  133. package/native/linux-x64/libzig-dtsx.so +0 -0
  134. package/native/windows-x64/zig-dtsx.dll +0 -0
  135. package/package.json +1 -1
  136. package/dist/chunk-8ab8793q.js +0 -27
  137. package/dist/chunk-kcbbz8t7.js +0 -37
  138. package/dist/chunk-t03y036d.js +0 -3
  139. package/dist/chunk-t89jepjk.js +0 -3
  140. package/dist/chunk-tsbthwf0.js +0 -7
  141. package/dist/chunk-vdhzc40m.js +0 -10
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{e,M}from"./chunk-qmg1535a.js";import{Ie}from"./chunk-g9emajpc.js";import{s}from"./chunk-ehpz5rg3.js";import{existsSync as u,readFileSync as w}from"fs";import{dirname as W,join as d,resolve as v}from"path";async function ei(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(Ie(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 ti(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 yn(i){let c=Date.now(),n=ti(i.projects);e.info(`Generating declarations for ${n.length} projects...`);let t=[],a=!0;for(let r of n){e.info(`
2
+ import{e,M}from"./chunk-3mp0jaa7.js";import{Ie}from"./chunk-g9emajpc.js";import{s}from"./chunk-zrmg0q1q.js";import{existsSync as u,readFileSync as w}from"fs";import{dirname as W,join as d,resolve as v}from"path";async function ei(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(Ie(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 ti(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 yn(i){let c=Date.now(),n=ti(i.projects);e.info(`Generating declarations for ${n.length} projects...`);let t=[],a=!0;for(let r of n){e.info(`
3
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
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
5
  `),{success:a,projects:t,durationMs:f}}async function lo(i,c){if(c?.logLevel)M(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 ei(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`),yn({root:i,projects:t,sharedConfig:c})}async function ni(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 ri(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 uo(i,c){if(c?.logLevel)M(c.logLevel);let n=await ni(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 ri(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 yn({root:i,projects:a,sharedConfig:c})}
@@ -1,22 +1,22 @@
1
1
  // @bun
2
- import{f,be}from"./chunk-587w6ktw.js";import{Vt,Ut,n,We,z}from"./chunk-h7tsf2qg.js";function g(t){if(t.includes(`
2
+ import{f,be}from"./chunk-587w6ktw.js";import{Vt,zt,n,We,U}from"./chunk-txf9rw55.js";function h(t){if(t.includes(`
3
3
  `))return`/**
4
4
  * ${t}
5
5
  */
6
6
  `;return`/** ${t} */
7
- `}function h(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 fe(t,o=!0){return f(t.leadingComments,o)+t.text}function b(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?z(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)Vt();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=Ut();if(m)if(m.includes(`
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 fe(t,o=!0){return f(t.leadingComments,o)+t.text}function x(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?U(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)Vt();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=zt();if(m)if(m.includes(`
8
8
  `))u=`@defaultValue
9
9
  * \`\`\`ts
10
10
  ${m.split(`
11
11
  `).map((p)=>` * ${p}`).join(`
12
12
  `)}
13
- * \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&We(t.typeAnnotation)){Vt();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let x=Ut();if(x)if(x.includes(`
13
+ * \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&We(t.typeAnnotation)){Vt();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let d=zt();if(d)if(d.includes(`
14
14
  `))u=`@defaultValue
15
15
  * \`\`\`ts
16
- ${x.split(`
17
- `).map((d)=>` * ${d}`).join(`
16
+ ${d.split(`
17
+ `).map((g)=>` * ${g}`).join(`
18
18
  `)}
19
- * \`\`\``;else u=`@defaultValue \`${x}\``}if(u=be(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(`
19
+ * \`\`\``;else u=`@defaultValue \`${d}\``}if(u=be(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
20
  `))p=`/**
21
21
  * ${p.slice(4)}`;return`${p}
22
22
  * ${u}
@@ -25,5 +25,5 @@ ${x.split(`
25
25
  * ${c.replace(/^\/\/\s*/,"")}
26
26
  * ${u}
27
27
  */
28
- ${e}`}if(u)return`${g(u)}${e}`;return s+e}function de(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=h(t.text);if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}function pe(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 me(t,o=!0){return f(t.leadingComments,o)+t.text}function ge(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 Kn(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 qn(t,o=!0){return f(t.leadingComments,o)+t.text.trim()}function he(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{fe,b,de,pe,me,ge,Kn,qn,he};
28
+ ${e}`}if(u)return`${h(u)}${e}`;return s+e}function de(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 pe(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 me(t,o=!0){return f(t.leadingComments,o)+t.text}function ge(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 Kn(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 qn(t,o=!0){return f(t.leadingComments,o)+t.text.trim()}function he(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{fe,x,de,pe,me,ge,Kn,qn,he};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var e="@dtsx/dtsx",i="module",n="0.11.47",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",a="MIT",b="https://github.com/stacksjs/dtsx#readme",o={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},p={url:"https://github.com/stacksjs/dtsx/issues"},d=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},k="./dist/index.js",l="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},g=["dist"],h={benchmark:"bun benchmark/index.ts","benchmark:prepare":"cd packages/zig-dtsx && zig build -Doptimize=ReleaseFast && cd ../.. && bun build benchmark/oxc-emit.ts --compile --splitting --bytecode --minify --format=esm --outfile benchmark/oxc-emit","benchmark:publish":"bun benchmark/index.ts --json benchmark/results.json --runs 3 && bun benchmark/render.ts","benchmark:tsdown":"bun benchmark/tsdown.ts",build:"bun --filter './packages/dtsx' build",test:"find packages -name '*.test.ts' -print | xargs bun test","test:public-sdk":"bun scripts/verify-public-sdk.ts","test:standalone":"bun scripts/verify-standalone.ts","typecheck:public-sdk":"bun x tsc --project tsconfig.public-sdk.json",lint:"bun x --bun pickier .","lint:fix":"bun x --bun pickier . --fix",format:"bun x --bun pickier . --format","format:fix":"bun x --bun pickier . --format --write",changelog:"bun x @stacksjs/logsmith --verbose","changelog:generate":"bun x @stacksjs/logsmith --output CHANGELOG.md",release:"bun x --bun @stacksjs/bumpx prompt --recursive","release:patch":"bun x --bun @stacksjs/bumpx patch --recursive --commit --tag --push --yes","release:minor":"bun x --bun @stacksjs/bumpx minor --recursive --commit --tag --push --yes",typecheck:"bun x tsc --noEmit","dev:docs":"bun --bun bunpress dev docs","build:docs":"bun --bun bunpress build docs","preview:docs":"bun --bun bunpress preview docs"},j={"@stacksjs/bumpx":"^0.2.32","@stacksjs/bunpress":"^0.2.31","@stacksjs/clapp":"^0.2.16",pickier:"^0.1.88","@stacksjs/gitlint":"^0.1.8","@stacksjs/logsmith":"^0.2.14","@types/bun":"^1.4.4","buddy-bot":"^0.10.5","bun-git-hooks":"^0.3.3","@dtsx/bun":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.157.0","oxc-parser":"^0.157.0",tsdown:"^0.23.7",typescript:"^7.0.2"},y=["packages/*"],f={typescript:"^7.0.2"},v={name:e,type:i,version:n,private:r,description:c,author:u,license:a,homepage:b,repository:o,bugs:p,keywords:d,exports:m,module:k,types:l,bin:x,files:g,scripts:h,devDependencies:j,workspaces:y,overrides:f,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bun x --bun pickier lint --fix"}},"commit-msg":"bun x gitlint --edit .git/COMMIT_EDITMSG"}};export{u as author,x as bin,p as bugs,v as default,c as description,j as devDependencies,m as exports,g as files,b as homepage,d as keywords,a as license,k as module,e as name,f as overrides,r as private,o as repository,h as scripts,i as type,l as types,n as version,y as workspaces};
2
+ var e="@dtsx/dtsx",i="module",n="0.11.50",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",a="MIT",b="https://github.com/stacksjs/dtsx#readme",o={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},p={url:"https://github.com/stacksjs/dtsx/issues"},d=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},k="./dist/index.js",l="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},g=["dist"],h={benchmark:"bun benchmark/index.ts","benchmark:prepare":"cd packages/zig-dtsx && zig build -Doptimize=ReleaseFast && cd ../.. && bun build benchmark/oxc-emit.ts --compile --splitting --bytecode --minify --format=esm --outfile benchmark/oxc-emit","benchmark:publish":"bun benchmark/index.ts --json benchmark/results.json --runs 3 && bun benchmark/render.ts","benchmark:tsdown":"bun benchmark/tsdown.ts",build:"bun --filter './packages/dtsx' build",test:"find packages -name '*.test.ts' -print | xargs bun test","test:public-sdk":"bun scripts/verify-public-sdk.ts","test:standalone":"bun scripts/verify-standalone.ts","typecheck:public-sdk":"bun x tsc --project tsconfig.public-sdk.json",lint:"bun x --bun pickier .","lint:fix":"bun x --bun pickier . --fix",format:"bun x --bun pickier . --format","format:fix":"bun x --bun pickier . --format --write",changelog:"bun x @stacksjs/logsmith --verbose","changelog:generate":"bun x @stacksjs/logsmith --output CHANGELOG.md",release:"bun x --bun @stacksjs/bumpx prompt --recursive","release:patch":"bun x --bun @stacksjs/bumpx patch --recursive --commit --tag --push --yes","release:minor":"bun x --bun @stacksjs/bumpx minor --recursive --commit --tag --push --yes",typecheck:"bun x tsc --noEmit","dev:docs":"bun --bun bunpress dev docs","build:docs":"bun --bun bunpress build docs","preview:docs":"bun --bun bunpress preview docs"},j={"@stacksjs/bumpx":"^0.2.32","@stacksjs/bunpress":"^0.2.31","@stacksjs/clapp":"^0.2.16",pickier:"^0.1.88","@stacksjs/gitlint":"^0.1.8","@stacksjs/logsmith":"^0.2.14","@types/bun":"^1.4.4","buddy-bot":"^0.10.5","bun-git-hooks":"^0.3.3","@dtsx/bun":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.157.0","oxc-parser":"^0.157.0",tsdown:"^0.23.7",typescript:"^7.0.2"},y=["packages/*"],f={typescript:"^7.0.2"},v={name:e,type:i,version:n,private:r,description:c,author:u,license:a,homepage:b,repository:o,bugs:p,keywords:d,exports:m,module:k,types:l,bin:x,files:g,scripts:h,devDependencies:j,workspaces:y,overrides:f,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bun x --bun pickier lint --fix"}},"commit-msg":"bun x gitlint --edit .git/COMMIT_EDITMSG"}};export{u as author,x as bin,p as bugs,v as default,c as description,j as devDependencies,m as exports,g as files,b as homepage,d as keywords,a as license,k as module,e as name,f as overrides,r as private,o as repository,h as scripts,i as type,l as types,n as version,y as workspaces};
@@ -0,0 +1,27 @@
1
+ // @bun
2
+ import{t,d}from"./chunk-6exq13f9.js";import{V}from"./chunk-zrfwvjq8.js";import{jt}from"./chunk-qx0pxmvs.js";import{v}from"./chunk-h3r142dy.js";import{ae}from"./chunk-vvy85nm6.js";import{relative as O}from"path";function P(n){let k=t(n),c=(l)=>k[l]?n.slice(k[l].start,k[l].end):"",i=c(0)==="export"?1:0;if(c(i++)!=="declare")return;let f;if(c(i)==="module"&&k[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=k[i].end,M=1;for(i++;i<k.length;i++)if(c(i)==="{")M++;else if(c(i)==="}"&&--M===0)return{specifier:f,body:n.slice(h,k[i].start),start:h,end:k[i].start};return}var te=/^[A-Z_$][\w$]*$/i;function Oo(n){let k=[],c=[],i=0,f=0,h=[],M=!1,l=0,y=n.length,R=(a)=>{let b=n.slice(i,a).trim();if(i=a,!b)return;if(ne(b)){c.push(b);return}k.push({text:b,comments:c}),c=[]};while(l<y){let a=n[l];if(M){if(a==="\\"){l+=2;continue}if(a==="`"){M=!1,l++;continue}if(a==="$"&&n[l+1]==="{"){h.push(f),f++,M=!1,l+=2;continue}l++;continue}if(a==="/"&&n[l+1]==="*"){let b=n.indexOf("*/",l+2);l=b===-1?y:b+2;continue}if(a==="/"&&n[l+1]==="/"){let b=n.indexOf(`
3
+ `,l);l=b===-1?y:b;continue}if(a==="'"||a==='"'){l++;while(l<y&&n[l]!==a&&n[l]!==`
4
+ `){if(n[l]==="\\")l++;l++}l++;continue}if(a==="`"){M=!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(),M=!0;l++;continue}if(f===0&&a===";"){R(l+1),l++;continue}if(f===0&&a===`
5
+ `){let b=n[l+1];if(b!==void 0&&/[\w$@/]/.test(b))R(l+1);l++;continue}l++}return R(y),k}function ne(n){let k=0;while(k<n.length){while(k<n.length&&/\s/.test(n[k]))k++;if(k>=n.length)return!0;if(n.startsWith("//",k)){let c=n.indexOf(`
6
+ `,k);k=c===-1?n.length:c;continue}if(n.startsWith("/*",k)){let c=n.indexOf("*/",k+2);if(c===-1)return!0;k=c+2;continue}return!1}return!0}function X(n){let k=[];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;k.push({local:f[1],exported:f[2]??f[1]})}return k}var se=/^(?: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 ie(n,k){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()} ${k}`);if(/^(?:interface|type)\b/.test(c)||/^declare\b/.test(c))return c;return`declare ${c}`}function q(n,k,c=!1){let i={file:n,declarations:[],declared:new Set,imports:new Map,localExports:new Map,namedReExports:[],starReExports:[],namespaceReExports:[],verbatim:[],augmentations:[],directives:[]},f=c?jt(k,n).map((h)=>({text:h.text,comments:[...h.leadingComments??[]]})):Oo(k);for(let h of f){h.comments=h.comments.filter((b)=>{if(/^\/\/\/\s*</.test(b))return i.directives.push(...b.split(`
7
+ `).map((S)=>S.trim()).filter((S)=>S.startsWith("///"))),!1;return!0});let M=h.text.replace(/;\s*$/,"").trim(),l=M.startsWith("import")?v(M):null;if(l&&!l.isImportEquals){let b=l.source;if(l.defaultName)i.imports.set(l.defaultName,{specifier:b,imported:"default"});if(l.namespaceName)i.imports.set(l.namespaceName,{specifier:b,imported:"*"});for(let S of l.namedItems)i.imports.set(S.name,{specifier:b,imported:/^['"]/.test(S.originalName)?d(S.originalName):S.originalName});continue}if(/^import\s+['"]/.test(M)){i.verbatim.push(h);continue}let y=M.match(/^export\s+(?:type\s+)?\*\s+as\s+([\w$]+)\s+from\s+(['"])([^'"]+)\2/);if(y){i.namespaceReExports.push({specifier:y[3],exported:y[1]});continue}if(y=M.match(/^export\s+(?:type\s+)?\*\s+from\s+(['"])([^'"]+)\1/),y){i.starReExports.push(y[2]);continue}if(y=M.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}\s+from\s+(['"])([^'"]+)\2/),y){for(let b of X(y[1]))i.namedReExports.push({specifier:y[3],imported:b.local,exported:b.exported});continue}if(y=M.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}$/),y){for(let b of X(y[1]))i.localExports.set(b.exported,b.local);continue}if(y=M.match(/^export\s+default\s+([\w$]+)$/),y&&te.test(y[1])){i.localExports.set("default",y[1]);continue}let R=P(M);if(R?.specifier!==void 0&&V(k)){i.augmentations.push({statement:h,specifier:R.specifier,body:R.body});continue}if(/^export\s+as\s+namespace\b/.test(M)||R){i.verbatim.push(h);continue}let a=M.match(se);if(a){let b=!!a[1],S=a[4]??(b?"_default":null);if(S){if(i.declared.add(S),/^export\s/.test(M))i.localExports.set(b?"default":S,S);i.declarations.push({statement:h,name:S,emit:ie(h.text,S)});continue}}i.declarations.push({statement:h,name:null,emit:h.text})}return i}function nt(n,k){if(k.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,M=[];for(let m=0;m<c.length;m++){let x=f(m);if(["(","[","{","<"].includes(x))M.push(m);else if([")","]","}",">"].includes(x)&&!(x===">"&&f(m-1)==="=")){let w=M.at(-1);if(w!==void 0&&["()","[]","{}","<>"].includes(f(w)+x))M.pop(),h.set(w,m)}}let l=(m)=>{for(let x=m;x<c.length;x++){if([";",",",")","]","}"].includes(f(x))||f(x)===">"&&f(x-1)!=="=")return x;let w=h.get(x);if(w!==void 0)x=w}return c.length},y=new Set;for(let m=0;m<c.length;m++){let x=h.get(m);if(f(m)!=="<"||x===void 0)continue;let w=["class","interface","type"].includes(f(m-2));if(!w&&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(w&&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)y.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 w=jt(n.slice(c[m+2].end,c[x].start),"bundle-namespace.ts"),N=new Set(w.filter((u)=>["class","interface","type","enum","module","namespace"].includes(u.kind)).map((u)=>u.name)),I=new Set(w.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)))y.add(c[u].start)}let R="",a=0,b=n.length,S=`
8
+ `;while(a<b){let m=i.get(a);if(m!==void 0){R+=n.slice(a,m),a=m,S="`";continue}let x=n[a];if(x==="/"&&n[a+1]==="*"){let w=n.indexOf("*/",a+2),N=w===-1?b:w+2;R+=n.slice(a,N),a=N;continue}if(x==="/"&&n[a+1]==="/"){let w=n.indexOf(`
9
+ `,a),N=w===-1?b:w;R+=n.slice(a,N),a=N;continue}if(x==="'"||x==='"'){let w=a+1;while(w<b&&n[w]!==x&&n[w]!==`
10
+ `){if(n[w]==="\\")w++;w++}R+=n.slice(a,w+1),a=w+1,S=x;continue}if(/[A-Z_$]/i.test(x)){let w=a+1;while(w<b&&/[\w$]/.test(n[w]))w++;let N=n.slice(a,w),I=k.get(N);if(I!==void 0&&S!=="."&&!y.has(a)){let u=w;while(u<b&&(n[u]===" "||n[u]==="\t"))u++;let D=(n[u]===":"||n[u]==="?"&&n[u+1]===":")&&/[{;,(\n]/.test(S);R+=D?N:I}else R+=N;S="a",a=w;continue}if(R+=x,x===`
11
+ `||!/\s/.test(x))S=x;a++}return R}function Pn(n,k,c,i){let f=[],h=new Map,M=[n,...k.filter((e)=>e!==n)];for(let e of M){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,q(e,s))}let l=(e,s)=>{if(!e.startsWith(".")&&!e.startsWith("/"))return null;let o=ae(e,s).resolved;return o&&h.has(o)?o:null},y=(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},b=new Map;for(let[e,s]of h){let o=new Map;for(let g of s.declared)o.set(g,a(g));b.set(e,o)}let S=new Map,m=(e,s,o)=>{let g=`${e}\x00${s}`,r=S.get(g);if(!r)r=a(o),S.set(g,r);return r},x=new Map,w=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(y(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}},Y=(e,s)=>{if(e.declared.has(s))return{kind:"local",name:b.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,E]of g.localExports){let B=Y(g,E);if(B)o.set(p,B)}for(let p of g.namedReExports){let E=D(g,p.specifier,p.imported);if(E)o.set(p.exported,E)}for(let p of g.namespaceReExports){let E=D(g,p.specifier,"*");if(E)o.set(p.exported,E)}for(let p of g.starReExports){let E=l(p,e);if(E){for(let[B,C]of L(E))if(B!=="default"&&!o.has(B))o.set(B,C);for(let B of w.get(E)??[])r.add(B)}else if(y(p))f.push(`${O(i.cwd,e)}: '${p}' is not part of the bundle`);else r.add(p)}for(let[p,E]of I.get(e)??[])o.set(p,E);return N.delete(e),x.set(e,o),w.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 q(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(),w.clear();let J=new Map,F=[],z=(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 ee(e.file,s)}};function ee(e,s){let o=J.get(e);if(o)return o;let g=a(s);J.set(e,g);let r=[];for(let[p,E]of L(e)){if(p==="default")continue;let B=z(E,p);r.push(B===p?p:`${B} as ${p}`)}if(w.get(e)?.size)f.push(`${O(i.cwd,e)}: 'export * from' an external module cannot be expressed inside namespace '${g}'`);return F.push(`declare namespace ${g} {
12
+ export { ${r.join(", ")} };
13
+ }`),g}let Q=[],A=[],H=new Set;for(let[e,s]of h){for(let r of s.directives)H.add(r);let o=new Map;for(let[r,p]of b.get(e))if(r!==p)o.set(r,p);for(let[r,p]of s.imports){if(s.declared.has(r))continue;let E=D(s,p.specifier,p.imported);if(!E)continue;let B=z(E,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=nt(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=P(r.text);if(p){let E=new Map(o);for(let B of q(e,p.body,!0).declared)E.delete(B);A.push(r.text.slice(0,p.start)+nt(p.body,E)+r.text.slice(p.end))}else{let E=t(r.text),B=E[1]?.kind==="quoted"?d(r.text.slice(E[1].start,E[1].end)):void 0;if(B===void 0||!l(B,e))A.push(nt(r.text,o))}}for(let r of s.augmentations){let p=l(r.specifier,e),E=q(e,r.body,!0),B=new Map(o);if(!p){for(let K of E.declared)B.delete(K);let C=P(r.statement.text);if(i.keepComments)A.push(...r.statement.comments);A.push(r.statement.text.slice(0,C.start)+nt(C.body,B)+r.statement.text.slice(C.end));continue}for(let[C,K]of L(p))B.set(C,z(K,C));if(i.keepComments)g.push(...r.statement.comments);for(let C of E.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(nt(C.emit,B))}}if(g.length>0)Q.push(`// From: ${O(i.cwd,e)}
14
+ ${g.join(`
15
+ `)}`)}let U=L(n),Z=[],T=[];for(let[e,s]of U){if(s.kind==="external"){T.push(`export { ${s.imported===e?e:`${s.imported} as ${e}`} } from '${s.source}';`);continue}if(s.kind==="external-namespace"){T.push(`export * as ${e} from '${s.source}';`);continue}let o=z(s,e==="default"?"_default":e);Z.push(o===e?e:`${o} as ${e}`)}for(let e of w.get(n)??[])T.push(`export * from '${e}';`);let G=new Map;for(let[e,s]of S){let[o,g]=e.split("\x00"),r=G.get(o)??{named:[],defaults:[],namespaces:[]};if(G.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 W=[];for(let[e,s]of[...G].sort(([o],[g])=>o.localeCompare(g))){for(let o of s.defaults)W.push(`import ${o} from '${e}';`);for(let o of s.namespaces)W.push(`import * as ${o} from '${e}';`);if(s.named.length>0)W.push(`import { ${s.named.join(", ")} } from '${e}';`)}let j=[];if(H.size>0)j.push([...H].join(`
16
+ `));if(j.push(`/**
17
+ * Bundled TypeScript declarations
18
+ * Generated from ${h.size} source files
19
+ */`),W.length>0)j.push(W.join(`
20
+ `));if(j.push(...Q),F.length>0)j.push(F.join(`
21
+ `));if(A.length>0)j.push(A.join(`
22
+ `));let _=[];if(Z.length>0)_.push(`export { ${Z.join(", ")} };`);if(_.push(...T),_.length===0)_.push("export {};");return j.push(_.join(`
23
+ `)),{content:`${j.join(`
24
+
25
+ `)}
26
+ `,files:[...h.keys()],exportCount:U.size,warnings:f}}
27
+ export{Oo,nt,Pn};
@@ -0,0 +1,38 @@
1
+ // @bun
2
+ import{a,i,h,g,xe,Ue}from"./chunk-gyfbehkf.js";import{t,m,d,ze,b}from"./chunk-6exq13f9.js";import{cr}from"./chunk-w9jg9761.js";import{Ve}from"./chunk-vrvzmysf.js";import{ir}from"./chunk-31rb15pe.js";import{V,nr}from"./chunk-zrfwvjq8.js";import{Hn}from"./chunk-4p9dw996.js";import{y,K}from"./chunk-vk5r6pgx.js";import{H}from"./chunk-0rk4cvt6.js";import{_e,we,je}from"./chunk-1mg4cxd3.js";import{n,B,W,Ht,rr,Kt,z,U}from"./chunk-txf9rw55.js";import{Un}from"./chunk-9xep96k0.js";import{x}from"./chunk-nh71w1ta.js";import{Jn}from"./chunk-r4dq05mh.js";function Oi(E,ie,Q,Y,ue=""){let le=new Map,f={start:0,end:E.length,header:0,name:"",children:[],results:new Map},ee=t(E),ge=[],S=[],Ze=[],Ye=new Map;for(let J=0;J<ee.length;J++){let he=ee[J];if(he.kind!=="punctuation")continue;let Ce=E.slice(he.start,he.end);if(Ce==="(")Ze.push(J);else if(Ce===")"){let e=Ze.pop();if(e!==void 0)Ye.set(J,e)}else if(Ce==="{")S.push(J);else if(Ce==="}"){let e=S.pop();if(e===void 0)continue;let Z=ee[e].start,se=e-1,P=se>=0?E.slice(ee[se].start,ee[se].end):"";if(P===")"){let ce=Ye.get(se);if(ce!==void 0&&ce>0&&["if","for","while","switch","catch","with"].includes(E.slice(ee[ce-1].start,ee[ce-1].end)))Z=ee[ce-1].start}else if(["else","try","finally","do"].includes(P))Z=ee[se].start;ge.push({open:ee[e].start,close:he.start,header:Z})}}let q=0,me=(J,he=new Set)=>{let Ce=new Set(he),e=t(E.slice(J.start,J.end)),Z=0;for(let de=0;de+1<e.length;de++){let Qe=E.slice(J.start+e[de].start,J.start+e[de].end);if(Qe==="{")Z++;else if(Qe==="}")Z--;else if(!Z&&["type","interface"].includes(Qe))Ce.add(E.slice(J.start+e[de+1].start,J.start+e[de+1].end))}let se="",P=J.start,ce=[...J.results].map(([de,Qe])=>({type:de,name:Qe}));for(let de of J.children.sort((Qe,ot)=>Qe.header-ot.header)){let Qe=me(de,Ce);se+=E.slice(P,de.header)+`
3
+ declare namespace ${de.name} {
4
+ ${Qe.text}
5
+ }
6
+ `,P=de.end+1;for(let ot of Qe.exports)ce.push({type:`${de.name}.${ot.name}`,name:ot.name})}se+=`${E.slice(P,J.end)}
7
+ ;
8
+ ${ce.map((de)=>`export type ${de.name} = ${de.type};`).join(`
9
+ `)}`;let Ee=F(se,ie,!1);for(let de of ce)Ce.add(de.name);let pe=ue?Vt(ue).map((de,Qe)=>[de,`${Le}_capture_${Qe}`]):[],Ke=Ee.map((de)=>ue&&["type","interface"].includes(de.kind)?Nn(de,ue,pe,Ce):(de.kind==="variable"?x(de,!1):de.text).replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
10
+ `);return{declarations:Ee,text:Ke,exports:ce}},Le;return{resolve(J,he){Le??=Q();let Ce=f;for(let Z of ge.filter((se)=>se.open<he&&he<se.close).sort((se,P)=>se.open-P.open)){let se=Ce.children.find((P)=>P.start===Z.open+1);if(!se)se={start:Z.open+1,end:Z.close,header:Z.header,name:`${Le}_scope_${q++}`,children:[],results:new Map},Ce.children.push(se);Ce=se}let e=Ce.results.get(J);if(!e)e=`${Le}_result_${le.size}`,Ce.results.set(J,e),le.set(e,J);return`${Le}.${e}`},finish(J){if(!Le)return J;let he=me(f),Ce=he.declarations,e=new Set(le.keys());if(Ce.every((se)=>e.has(se.name))){let se=new Map(le),P=t(J),ce="",Ee=0;for(let pe=0;pe+2<P.length;pe++){if(J.slice(P[pe].start,P[pe].end)!==Le||J.slice(P[pe+1].start,P[pe+1].end)!==".")continue;let Ke=se.get(J.slice(P[pe+2].start,P[pe+2].end));if(!Ke)continue;ce+=J.slice(Ee,P[pe].start)+`(${Ke})`,Ee=P[pe+2].end,pe+=2}return ce+J.slice(Ee)}if(ue){let se=Vt(ue).join(", "),P=t(J),ce="",Ee=0;for(let pe=0;pe+2<P.length;pe++){if(J.slice(P[pe].start,P[pe].end)!==Le||J.slice(P[pe+1].start,P[pe+1].end)!=="."||!e.has(J.slice(P[pe+2].start,P[pe+2].end)))continue;ce+=`${J.slice(Ee,P[pe+2].end)}<${se}>`,Ee=P[pe+2].end,pe+=2}J=ce+J.slice(Ee)}let Z=he.text;return Y({kind:"module",name:Le,text:`declare namespace ${Le} {
11
+ ${Z}
12
+ }`,moduleForm:"namespace",isExported:!1}),J}}}function Vt(E){let ie=t(E),Q=[],Y=0,ue=0,le=!1;for(let f of ie){let ee=E.slice(f.start,f.end);if(ee==="<"){if(Y++,Y===1)le=!0}else if(ee===">"&&E[f.start-1]!=="=")Y--;else if(["(","[","{"].includes(ee))ue++;else if([")","]","}"].includes(ee))ue--;else if(ee===","&&Y===1&&!ue)le=!0;else if(le&&f.kind==="word"&&!["const","in","out"].includes(ee))Q.push(ee),le=!1}return Q}function Nn(E,ie,Q,Y){let ue=new Set(Vt(E.generics||"")),le=(me,Le,J)=>{let he=t(me),Ce="",e=0;for(let Z=0;Z<he.length;Z++){let se=he[Z],P=me.slice(se.start,se.end),ce=he[Z+1]&&me.slice(he[Z+1].start,he[Z+1].end),Ee=he[Z+2]&&me.slice(he[Z+2].start,he[Z+2].end),pe=he[Z-1]&&me.slice(he[Z-1].start,he[Z-1].end);if(se.kind!=="word"||ce===":"||ce==="?"&&Ee===":")continue;let Ke=!J.has(P)&&pe!=="."&&Q.find(([de])=>de===P)?.[1];if(Ke)Ce+=me.slice(e,se.start)+Ke,e=se.end;else if(Le&&Y.has(P)&&!J.has(P)){let de=Q.map(([,Qe])=>Qe).join(", ");Ce+=`${me.slice(e,se.end)}<${de}${ce==="<"?", ":">"}`,e=ce==="<"?he[++Z].end:se.end}}return Ce+me.slice(e)},f=t(E.text),ee=f.findIndex((me)=>["type","interface"].includes(E.text.slice(me.start,me.end))),ge=f[ee+1],S=E.generics||"",Ze=S?E.text.indexOf(S,ge.end)+S.length:ge.end,Ye=le(zn(ie),!1,new Set),q=S?`, ${le(S.slice(1,-1),!0,ue)}`:"";return`${E.text.slice(0,ge.end)}<${Ye}${q}>${le(E.text.slice(Ze),!0,ue)}`.replace(/^export\s+/,"").replace(/^declare\s+/,"")}function zn(E){let ie=E.slice(1,-1),Q=t(ie),Y=0,ue=0,le=!1,f="";for(let ee=0;ee<Q.length;ee++){let ge=Q[ee],S=ie.slice(ge.start,ge.end);if(["(","[","{","<"].includes(S))Y++;else if([")","]","}"].includes(S)||S===">"&&ie[ge.start-1]!=="=")Y--;else if(!Y&&S==="const")f+=ie.slice(ue,ge.start),ue=ge.end;else if(!Y&&S==="="&&ie.slice(Q[ee+1]?.start,Q[ee+1]?.end)!==">")f+=ie.slice(ue,ge.start),le=!0;else if(!Y&&S===","&&le)ue=ge.start,le=!1}return f+(le?"":ie.slice(ue))}var Fe=32,Ge=9,ye=10,Oe=13,te=47,ke=42,be=39,$e=34,We=96,tt=92,N=123,ne=125,ae=40,Ae=41,De=91,Me=93,Se=60,Te=62,oe=59,nt=58,Ie=61,it=44,Ct=46,Ot=63,mn=35,qn=64,jn=36;function He(E){return E===Fe||E===Ge||E===ye||E===Oe}function Cn(E){let ie=!0;for(let Q=0;Q<E.length;Q++){let Y=E.charCodeAt(Q);if(Y===Ct){if(ie)return!1;ie=!0}else if(ie){if(!a(Y))return!1;ie=!1}else if(!i(Y))return!1}return E.length>0&&!ie}function $t(E,ie,Q){let Y=ie+1;while(Y<E.length){let ue=E.charCodeAt(Y);if(ue===tt){Y+=2;continue}if(Y++,ue===Q)break}return Y}function Fn(E){if(E==="any"||E==="object"||E==="unknown")return!0;if(E.startsWith("Record<")||E.startsWith("Array<"))return!0;return E.charCodeAt(0)===N&&E.includes("[")&&E.includes("]:")}var Ut=["public","protected","private","readonly","override"];function Ba(E,ie,Q=!0,Y=!1){return Y?R(E,ie,Q):F(E,ie,Q)}function R(E,ie,Q=!0){return Qt(E,ie,Q,!0)}function F(E,ie,Q=!0,Y){return Qt(E,ie,Q,!1,!1,Y)}function jt(E,ie,Q=!0){return Qt(E,ie,Q,!0,!0)}function Qt(E,ie,Q,Y,ue=!1,le){let f=E,ee=Q,ge=Y,S=f.length,Ze=Ue(f),Ye=V(f),q=[],me=new Map,Le=new Map;function J(s,o){let r=o.kind==="interface"||o.kind==="type";if(r){let l=Le.get(s);if(l)l.push(o);else Le.set(s,[o])}let c=me.get(s);if(!r||!c||c.kind!=="variable"&&c.kind!=="function")me.set(s,o)}let he=new Map,Ce=new Set,e=0,Z,se=0,P=[],ce=[],Ee=[],pe=[],Ke;function de(s,o=!1){let r=`__dtsx_constructor_field_${pe.length}__`;Ke??=new Set(m(f).filter((c)=>c.kind==="word").map((c)=>f.slice(c.start,c.end)).filter((c)=>c.startsWith("__dtsx_constructor_field_")));while(Ke.has(r))r+="_";return pe.push({marker:r,initializer:s,classes:P.map((c)=>c.name),namespaces:[...Ee],binding:o}),r}function Qe(s){let o=/^this\.([\w$]+)$/.exec(s);if(o){let w=P.at(-1);return w?.fields.get(`${w.isStatic?"static:":""}${o[1]}`)}let r=/^([\w$]+)\s*\(/.exec(s);if(!r||!s.endsWith(")"))return;let c=t(s),l=0;for(let w=1;w<c.length;w++){let C=s.slice(c[w].start,c[w].end);if(C==="(")l++;else if(C===")"&&--l===0&&w!==c.length-1)return}let u=[...q,...me.values()].filter((w)=>w.kind==="function"&&w.name===r[1]);if(u.length!==1||u[0].generics||Ve(f,r[1])!==1)return;return u[0].returnType}function ot(s){let o=s.trim(),r=Qe(o);if(r)return r;if(!o.startsWith("class"))return;let c=t(o);if(c[0]?.kind!=="word"||o.slice(c[0].start,c[0].end)!=="class")return;let l;do l=`__dtsx_class_${se++}`;while(f.includes(l));let u=c[1],w=u?o.slice(u.start,u.end):"",C=u?.kind==="word"&&!["extends","implements"].includes(w),A=C?w:`${l}_value`,p=C?`export ${o}`:`export class ${A} ${o.slice(5)}`,k=F(p,ie,ee),O=k.find((v)=>v.kind==="class");if(!O)throw Error("Cannot extract the class expression declaration");if(t(p.slice(O.end??p.length)).some((v)=>p.slice((O.end??0)+v.start,(O.end??0)+v.end)!==";"))return;let M=k.map((v)=>v.text.replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
13
+ `);return J(l,{kind:"module",name:l,text:`declare namespace ${l} {
14
+ ${M}
15
+ }`,moduleForm:"namespace",isExported:!1,start:e,end:e}),`typeof ${l}.${A}`}function xt(s,o){let r=/^this\.([\w$]+)$/.exec(s);if(r)return P.at(-1)?.fields.get(`${o?"static:":""}${r[1]}`);return ot(s)}function Jt(s){let o=he.get(s.name);if(o)o.push(s);else he.set(s.name,[s]);J(s.name,s)}if(e<S&&f.charCodeAt(e)===65279)e++;function ve(s,o){if(s<o){let r=f.charCodeAt(s),c=f.charCodeAt(o-1);if(r!==Fe&&r!==Ge&&r!==ye&&r!==Oe&&c!==Fe&&c!==Ge&&c!==ye&&c!==Oe)return f.slice(s,o)}while(s<o&&He(f.charCodeAt(s)))s++;while(o>s&&He(f.charCodeAt(o-1)))o--;return f.slice(s,o)}let Zt=/[\r\n]/g;function ft(s){return Zt.lastIndex=s,Zt.exec(f)?.index??S}function T(){if(e>=S)return;let s=f.charCodeAt(e);if(s!==Fe&&s!==Ge&&s!==ye&&s!==Oe&&s!==te)return;while(e<S){let o=f.charCodeAt(e);if(o===Fe||o===Ge||o===ye||o===Oe){e++;continue}if(o===te&&e+1<S){let r=f.charCodeAt(e+1);if(r===te){e=ft(e+2);continue}if(r===ke){let c=f.indexOf("*/",e+2);e=c===-1?S:c+2;continue}}break}}function kn(s){if(s.indexOf("//")===-1&&s.indexOf("/*")===-1)return s;let o=0,r=0;while(r<s.length){let c=s.charCodeAt(r);if(c===be||c===$e||c===We){r=$t(s,r,c),o=r;continue}if(c===tt){r+=2,o=Math.min(r,s.length);continue}if(c===te&&s.charCodeAt(r+1)===te){while(r<s.length&&s.charCodeAt(r)!==ye&&s.charCodeAt(r)!==Oe)r++;continue}if(c===te&&s.charCodeAt(r+1)===ke){let l=s.indexOf("*/",r+2);r=l===-1?s.length:l+2;continue}if(r++,c>32)o=r}return o<s.length?s.slice(0,o).trimEnd():s}function wn(s){let o=s.length,r=0,c=o;for(let l=0;l<o;l++){let u=s.charCodeAt(l);if(r){if(u===tt){l++;continue}if(u===r)r=0;continue}if(u===be||u===$e||u===We){r=u;continue}if(u===te&&l+1<o){let w=s.charCodeAt(l+1);if(w===te){c=l;while(c>0&&(s.charCodeAt(c-1)===Fe||s.charCodeAt(c-1)===Ge))c--;return s.slice(0,c)}if(w===ke){let C=s.indexOf("*/",l+2);if(C!==-1){s=`${s.slice(0,l)} ${s.slice(C+2)}`,l--;continue}}}}c=o;while(c>0&&(s.charCodeAt(c-1)===Fe||s.charCodeAt(c-1)===Ge||s.charCodeAt(c-1)===Oe))c--;return c<o?s.slice(0,c):s}function st(s){e++;let o=s===be?"'":'"';while(e<S){let r=f.indexOf(o,e);if(r===-1){e=S;return}let c=0,l=r-1;while(l>=0&&f.charCodeAt(l)===tt)c++,l--;if(c%2===0){e=r+1;return}e=r+1}}function At(){e++;let s=[];while(e<S){let o=f.charCodeAt(e);if(s.length===0){if(o===tt){e+=2;continue}if(o===We){e++;return}if(o===jn&&e+1<S&&f.charCodeAt(e+1)===N){e+=2,s.push(0);continue}e++;continue}if(o===be||o===$e){st(o);continue}if(o===We){At();continue}if(o===te&&e+1<S){let r=f.charCodeAt(e+1);if(r===te){e=ft(e+2);continue}if(r===ke){let c=f.indexOf("*/",e+2);e=c===-1?S:c+2;continue}if(Xt()){Yt();continue}e++;continue}if(o===N){s[s.length-1]++,e++;continue}if(o===ne){let r=s[s.length-1];if(r===0){s.pop(),e++;continue}s[s.length-1]=r-1,e++;continue}e++}}let Et=!1;function qe(){Et=!1;let s=f.charCodeAt(e);if(s===be||s===$e)return st(s),!0;if(s===We)return At(),!0;if(s===te&&e+1<S){let o=f.charCodeAt(e+1);if(o===te)return e=ft(e+2),!0;if(o===ke){let r=f.indexOf("*/",e+2);return Et=ft(e+2)<(r===-1?S:r),e=r===-1?S:r+2,!0}if(Xt())return Yt(),!0}return!1}function Xt(){return h(f,e)}function Yt(){e=g(f,e)}function Re(){let s=e;while(e<S&&i(f.charCodeAt(e)))e++;return f.slice(s,e)}function _(s){if(e+s.length>S)return!1;for(let o=0;o<s.length;o++)if(f.charCodeAt(e+o)!==s.charCodeAt(o))return!1;if(e+s.length<S&&i(f.charCodeAt(e+s.length)))return!1;return!0}function yt(s){let o=e+s;while(o<S){let r=f.charCodeAt(o);if(r===Fe||r===Ge||r===ye||r===Oe){o++;continue}return r!==Ct&&r!==Ie}return!1}function en(){if(!Et)return!1;let s=e;T();let o=e>=S||Rt()||f.charCodeAt(e)===ne;return e=s,o}function Rt(){if(e>=S)return!1;switch(f.charCodeAt(e)){case 101:return _("export")||_("enum");case 105:return _("import")||_("interface");case 102:return _("function");case 99:return _("class")||_("const");case 116:return _("type");case 108:return _("let");case 118:return _("var");case 100:return _("declare")||_("default");case 109:return _("module");case 110:return _("namespace");case 97:return _("abstract")||_("async");default:return!1}}function ht(){let s=f.charCodeAt(e);if(s!==ye&&s!==Oe)return!1;let o=e;if(e++,s===Oe&&e<S&&f.charCodeAt(e)===ye)e++;while(e<S){let c=f.charCodeAt(e);if(c===Fe||c===Ge||c===Oe||c===ye){e++;continue}if(c===te&&e+1<S){let l=f.charCodeAt(e+1);if(l===te){e=ft(e+2);continue}if(l===ke){let u=f.indexOf("*/",e+2);e=u===-1?S:u+2;continue}}break}let r=e>=S||Rt()||f.charCodeAt(e)===ne;return e=o,r}function $n(s){let o=s-1;while(o>=0){let A=f.charCodeAt(o);if(A===Fe||A===Ge||A===Oe||A===ye){o--;continue}break}if(o<0)return!0;let r=f[o];if("+-*/%=<>&|^!~?:,.([{".includes(r))return!0;let c=o;while(c>0&&f.charCodeAt(c-1)!==ye)c--;let l=f.slice(c,o+1),u=l.lastIndexOf("<");if(u!==-1&&/^<[A-Za-z]/.test(l.slice(u))&&!l.slice(u).includes(">"))return!0;let w=o;while(w>=0&&/[a-z]/i.test(f[w]))w--;let C=f.slice(w+1,o+1);return["as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","return","yield","void"].includes(C)}function xn(s,o){let r=f.charCodeAt(e);if(r!==ye&&r!==Oe&&!(r===te&&(f[e+1]==="/"||f[e+1]==="*")))return!1;let c=m(f),l=0,u=c.length;while(l<u){let k=l+u>>>1;if(c[k].start<e)l=k+1;else u=k}let w=c[l-1],C=c[l];if(!w||w.start<s||!/[\r\n]/.test(f.slice(e,C?.start??S)))return!1;let A=f.slice(w.start,w.end);if(w.end!==o&&w.kind==="punctuation"&&"+-*/%=<>&|^!~?:,.([{".includes(A))return!1;if(w.kind==="word"&&["as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","return","yield","void"].includes(A))return!1;if(!C)return!0;let p=f.slice(C.start,C.end);return!(".?:)]},+-*/%<>=&|^`([".includes(p)||C.kind==="literal"&&f.charCodeAt(C.start)===We||["as","satisfies","instanceof","in"].includes(p))}function tn(){let s=f.charCodeAt(e);if(s!==ye&&s!==Oe)return!1;if($n(e))return!1;let o=e;e++;while(e<S){let l=f.charCodeAt(e);if(l===Fe||l===Ge||l===Oe||l===ye){e++;continue}if(l===te&&e+1<S){let u=f.charCodeAt(e+1);if(u===te){e=ft(e+2);continue}if(u===ke){let w=f.indexOf("*/",e+2);e=w===-1?S:w+2;continue}}break}let r=e<S?f[e]:"",c=r==="|"||r==="&"||r==="["||r==="."||r==="?"||r===":"||r===">"||r===")"||r===","||_("extends");return e=o,!c}function bt(){let s=f.charCodeAt(e);if(s!==ye&&s!==Oe)return!1;let o=e;if(e++,s===Oe&&e<S&&f.charCodeAt(e)===ye)e++;while(e<S){let c=f.charCodeAt(e);if(c===Fe||c===Ge||c===Oe||c===ye){e++;continue}if(c===te&&e+1<S&&f.charCodeAt(e+1)===te){e=ft(e+2);continue}break}if(e>=S)return e=o,!0;let r=f.charCodeAt(e);if(r===124||r===38||r===Ct||r===Ot||r===nt)return e=o,!1;if(_("extends")||_("keyof")||_("typeof")||_("infer")||_("is")||_("as")||_("in"))return e=o,!1;return e=o,!0}let yn=/[{}'"`\/]/g,vn=/[()'"`\/]/g,Sn=/[[\]'"`\/]/g,_n=/[<>'"`\/]/g;function Be(s,o){let r=1;e++;let c=s===N?yn:s===ae?vn:s===De?Sn:_n;c.lastIndex=e;let l;while((l=c.exec(f))!==null){let u=l.index,w=f.charCodeAt(u);if(w===be||w===$e){e=u,st(w),c.lastIndex=e;continue}if(w===We){e=u,At(),c.lastIndex=e;continue}if(w===te){if(e=u,qe()){c.lastIndex=e;continue}c.lastIndex=u+1;continue}if(w===s)r++;else if(w===o){if(o===Te&&u>0&&f.charCodeAt(u-1)===Ie){c.lastIndex=u+1;continue}if(r--,r===0)return e=u+1,e}c.lastIndex=u+1}return e=S,e}function et(){return e>0&&f.charCodeAt(e-1)===Ie}function Mt(){return e+1<S&&f.charCodeAt(e+1)===Te}let Je=/[<{};'"`\/\n\r()[\]]/g;function Ne(s=!1){let o=0,r=0,c=0,l=0,u=f.charCodeAt(e)===N;Je.lastIndex=e;let w;while((w=Je.exec(f))!==null){let C=w.index,A=f.charCodeAt(C);if(A===be||A===$e){e=C,st(A),Je.lastIndex=e;continue}if(A===We){e=C,At(),Je.lastIndex=e;continue}if(A===te){if(C>0&&f.charCodeAt(C-1)===Se){Je.lastIndex=C+1;continue}if(e=C,qe()){if(o===0&&r===0&&c===0&&l===0&&en())return;Je.lastIndex=e;continue}Je.lastIndex=C+1;continue}if(A===Se){let p=Ze(C)?.delta??null;if(p!==null)l=Math.max(0,l+p);Je.lastIndex=C+1;continue}if(A===ae){r++,Je.lastIndex=C+1;continue}if(A===Ae){r--,Je.lastIndex=C+1;continue}if(A===De){c++,Je.lastIndex=C+1;continue}if(A===Me){c--,Je.lastIndex=C+1;continue}if(A===N){o++,Je.lastIndex=C+1;continue}if(A===ne){let p=o>0;if(!p&&s&&r===0&&c===0&&l===0){e=C;return}if(p)o--;if((!p||u)&&o===0&&r===0&&c===0&&l===0){e=C+1;return}if(p&&o===0&&r===0&&c===0&&l===0){e=C+1;let k=e;T();let O=Rt();if(e=k,O)return}Je.lastIndex=C+1;continue}if(A===oe&&o===0&&r===0&&c===0&&l===0){e=C+1;return}if((A===ye||A===Oe)&&o===0&&r===0&&c===0&&l===0){if(e=C,ht())return}Je.lastIndex=C+1}e=S}function Dn(){e++;while(e<S&&(f.charCodeAt(e)===Fe||f.charCodeAt(e)===Ge))e++;let s=f.indexOf(`
16
+ `,e),o=s===-1?S:s,r=f.indexOf(";",e);if(r!==-1&&r<o){let c=r-1;while(c>=e&&(f.charCodeAt(c)===Fe||f.charCodeAt(c)===Ge))c--;let l=f.charCodeAt(e),u=f.charCodeAt(c);if(l===N&&u===ne||l===De&&u===Me||l===be&&u===be||l===$e&&u===$e||l===We&&u===We){e=r+1;return}}Ne()}function nn(){Be(N,ne);while(e<S&&He(f.charCodeAt(e)))e++;if(_("from")){e+=4;while(e<S&&He(f.charCodeAt(e)))e++;if(e<S){let s=f.charCodeAt(e);if(s===be||s===$e)st(s)}}while(e<S&&(f.charCodeAt(e)===Fe||f.charCodeAt(e)===Ge))e++;if(e<S&&f.charCodeAt(e)===oe)e++}function sn(){e++;while(e<S&&He(f.charCodeAt(e)))e++;if(_("as")){e+=2;while(e<S&&He(f.charCodeAt(e)))e++;Re();while(e<S&&He(f.charCodeAt(e)))e++}if(_("from")){e+=4;while(e<S&&He(f.charCodeAt(e)))e++;if(e<S){let s=f.charCodeAt(e);if(s===be||s===$e)st(s)}}while(e<S&&(f.charCodeAt(e)===Fe||f.charCodeAt(e)===Ge))e++;if(e<S&&f.charCodeAt(e)===oe)e++}function vt(s){let o=s.indexOf("from ");if(o===-1)return;let r=o+5;while(r<s.length&&(s.charCodeAt(r)===32||s.charCodeAt(r)===9))r++;if(r>=s.length)return;let c=s.charCodeAt(r);if(c!==39&&c!==34)return;let l=s.indexOf(s[r],r+1);if(l===-1)return;return s.slice(r+1,l)}function Xe(s){if(!ee)return;let o=s-1;while(o>=0&&He(f.charCodeAt(o)))o--;if(o<0)return;let r=[],c=!1;while(o>=0){if(o>=1&&f.charCodeAt(o)===te&&f.charCodeAt(o-1)===ke){let w=f.lastIndexOf("/*",o-2);if(w>=0){r.push(f.slice(w,o+1)),c=!0,o=w-1;while(o>=0&&He(f.charCodeAt(o)))o--;continue}break}let l=o;while(l>0&&f.charCodeAt(l-1)!==ye)l--;let u=ve(l,o+1);if(u.startsWith("//")){if(c)break;let w=[u];o=l-1;while(o>=0&&(f.charCodeAt(o)===ye||f.charCodeAt(o)===Oe))o--;while(o>=0){let C=o;while(C>0&&f.charCodeAt(C-1)!==ye)C--;let A=ve(C,o+1);if(A.startsWith("//")){w.push(A),o=C-1;while(o>=0&&(f.charCodeAt(o)===ye||f.charCodeAt(o)===Oe))o--}else if(A===""){o=C-1;while(o>=0&&(f.charCodeAt(o)===ye||f.charCodeAt(o)===Oe))o--}else break}w.reverse(),r.push(w.join(`
17
+ `));continue}break}if(r.length===0)return;return r.reverse(),r}function Tn(s){let o=s,r=!1,c=0,l;while(e<S){let I=f.charCodeAt(e);if(I===te&&(f.charCodeAt(e+1)===te||f.charCodeAt(e+1)===ke)){T();continue}if(I===oe){e++;break}if(I===N)c++;else if(I===ne&&c>0)c--;if(I===be||I===$e){if(st(I),c>0)continue;r=!0;let M=e;if(T(),f.charCodeAt(e)===Ae){let v=e+1;l=ze(f.slice(o,v)),e=l?v:M}else e=M;while(e<S&&(f.charCodeAt(e)===Fe||f.charCodeAt(e)===Ge))e++;if(e<S&&f.charCodeAt(e)===oe)e++;break}if(I===ye&&r)break;e++}let u=ve(o,e),w=b(u).find((I)=>I.category==="static-import"),C=t(u),A=l?.isTypeOnly??w?.isTypeOnly??!1,p=C[1]?.kind==="quoted",k=l?.source??w?.specifier??"",O=Xe(o);return{kind:"import",name:"",text:u,isExported:!1,isTypeOnly:A,isSideEffect:p,source:k,leadingComments:O,start:o,end:e}}function Pt(){let s=e;return Be(N,ne),f.slice(s,e)}function rn(s){let o=s.indexOf("(");if(o===-1)return s;let r=s.slice(o);if(r.indexOf("=")===-1)return s;let c=!1;for(let A=0;A<r.length;A++)if(r.charCodeAt(A)===61){let k=A>0?r.charCodeAt(A-1):0,O=A+1<r.length?r.charCodeAt(A+1):0;if(k!==61&&k!==33&&k!==60&&k!==62&&O!==61&&O!==62){c=!0;break}}if(!c)return s;let l=0,u=-1;for(let A=o;A<s.length;A++){let p=s.charCodeAt(A);if(p===40)l++;else if(p===41){if(l--,l===0){u=A;break}}}if(u===-1)return s;let w=s.slice(o,u+1),C=pt(w);return s.slice(0,o)+C+s.slice(u+1)}function on(s){let o=s.indexOf("//")!==-1||s.indexOf("/*")!==-1,r=s.split(`
18
+ `),c=[],l=[],u=[],w=!1,C=1/0;for(let k=0;k<r.length;k++){let O=r[k];if(o){if(w){if(O.includes("*/"))w=!1;continue}let I=O.trim();if(I.length===0)continue;let M=I.charCodeAt(0);if(M===te){let X=I.charCodeAt(1);if(X===te)continue;if(X===ke){if(!I.includes("*/"))w=!0;continue}}if(M===ke)continue;let v=wn(O);if(v.charCodeAt(v.length-1)===oe)v=v.slice(0,-1);v=rn(v);let D=v.trim();if(!D)continue;c.push(v),l.push(D);let G=0;while(G<v.length&&He(v.charCodeAt(G)))G++;if(D!=="{"&&D!=="}"){if(G<C)C=G}u.push(G)}else{let I=O.length;while(I>0&&(O.charCodeAt(I-1)===Fe||O.charCodeAt(I-1)===Ge||O.charCodeAt(I-1)===Oe))I--;if(I===0)continue;let M=I<O.length?O.slice(0,I):O;if(M.charCodeAt(M.length-1)===oe)M=M.slice(0,-1);M=rn(M);let v=M.trim();if(!v)continue;c.push(M),l.push(v);let D=0;while(D<M.length&&He(M.charCodeAt(D)))D++;if(v!=="{"&&v!=="}"){if(D<C)C=D}u.push(D)}}if(c.length===0)return"{}";if(C===1/0||C<=2)return c.join(`
19
+ `);let A=C-2,p=Array(c.length);for(let k=0;k<c.length;k++){let O=l[k];if(O==="{"){p[k]=O;continue}let I=u[k];if(I>C)p[k]=c[k];else if(I===C&&(O.charCodeAt(0)===ne||O.charCodeAt(0)===Me||O.charCodeAt(0)===Ae))p[k]=c[k];else{let M=Math.max(0,I-A);p[k]=" ".repeat(M)+O}}return p.join(`
20
+ `)}function rt(){if(e>=S||f.charCodeAt(e)!==Se)return"";let s=e;Be(Se,Te);let o=f.slice(s,e);if(o.includes(`
21
+ `)){let r="",c=!1;for(let l=0;l<o.length;l++){let u=o.charCodeAt(l);if(u===32||u===9||u===10||u===13){if(!c&&r.length>0)r+=" ",c=!0}else r+=o[l],c=!1}if(r.charCodeAt(1)===32)r=`<${r.slice(2)}`;if(r.charCodeAt(r.length-2)===32)r=`${r.slice(0,-2)}>`;return r}return o}function ct(){if(e>=S||f.charCodeAt(e)!==ae)return"()";let s=e;return Be(ae,Ae),f.slice(s,e)}function St(s){if(s.indexOf("/")===-1)return s;let o="",r=!1,c=0;for(let l=0;l<s.length;l++){let u=s.charCodeAt(l);if(r){if(o+=s[l],u===tt&&l+1<s.length){o+=s[++l];continue}if(u===c)r=!1;continue}if(u===be||u===$e||u===We){r=!0,c=u,o+=s[l];continue}if(u===te&&l+1<s.length){let w=s.charCodeAt(l+1);if(w===ke){let C=s.indexOf("*/",l+2);l=C===-1?s.length:C+1,o+=" ";continue}if(w===te){let C=s.indexOf(`
22
+ `,l+2);l=C===-1?s.length:C-1;continue}if(h(s,l)){let C=g(s,l);o+=s.slice(l,C),l=C-1;continue}}o+=s[l]}return o.trim()}function pt(s){let o=s.slice(1,-1).trim();if(!o)return"()";if(s.indexOf(`
23
+ `)===-1&&o.indexOf(":")!==-1&&o.indexOf("{")===-1&&o.indexOf("[")===-1&&o.indexOf("=")===-1&&o.indexOf("@")===-1&&o.indexOf("...")===-1){let A=0,p=0,k=0;for(let O=0;O<o.length;O++){let I=o.charCodeAt(O);if(I===ae||I===Se||I===N)k++;else if(I===Ae||I===Te||I===ne)k--;else if(k===0){if(I===nt)A++;else if(I===it)p++}}if(A>=p+1){let O=!1;for(let I=0;I<Ut.length;I++){let M=Ut[I],v=o.indexOf(M);if(v!==-1){let D=v+M.length;if((v===0||!i(o.charCodeAt(v-1)))&&(D>=o.length||!i(o.charCodeAt(D)))){O=!0;break}}}if(!O)return s}}let r=[],c=0,l=0,u=!1,w=0;for(let A=0;A<=o.length;A++){if(A===o.length){r.push(St(o.slice(c).trim()));break}let p=o.charCodeAt(A);if(u){if(p===tt){A++;continue}if(p===w)u=!1;continue}if(p===te&&A+1<o.length){let k=o.charCodeAt(A+1);if(k===ke){A+=2;while(A+1<o.length&&!(o.charCodeAt(A)===ke&&o.charCodeAt(A+1)===te))A++;A++;continue}if(k===te){while(A<o.length&&o.charCodeAt(A)!==10)A++;continue}if(h(o,A)){A=g(o,A)-1;continue}}if(p===be||p===$e||p===We){u=!0,w=p;continue}if(p===ae||p===N||p===De||p===Se)l++;else if(p===Ae||p===ne||p===Me||p===Te&&!(A>0&&o.charCodeAt(A-1)===Ie))l--;else if(p===it&&l===0)r.push(St(o.slice(c,A).trim())),c=A+1}let C=[];for(let A of r){if(!A)continue;let p=A.trim();if(p.startsWith("//")||p.startsWith("/*"))continue;let k=A;{let O=!1,I=0,M=0,v=0;for(let D=0;D<k.length-1;D++){let G=k.charCodeAt(D);if(G===ye){v=D+1;continue}if(O){if(G===tt){D++;continue}if(G===I)O=!1;continue}if(G===be||G===$e||G===We){O=!0,I=G;continue}if(G===N||G===De||G===ae||G===Se){M++;continue}if(G===ne||G===Me||G===Ae||G===Te){if(M>0)M--;continue}if(G===te&&h(k,D)){D=g(k,D)-1;continue}if(G===te&&k.charCodeAt(D+1)===te){if(M===0){k=k.slice(0,D).trimEnd();break}let X=k.indexOf(`
24
+ `,D);if(X===-1){k=k.slice(0,v).trimEnd();break}let j=k.slice(0,v),L=k.slice(X+1);k=`${j}${L}`,D=v-1}}}if(!k.trim())continue;C.push(cn(k))}return _e(`(${C.join(", ")})`)}function In(s){if(!s.startsWith("{")&&!s.startsWith("["))return s;let o="",r=0,c=0,l=!1,u=0;while(r<s.length){let w=s.charCodeAt(r);if(l){if(w===tt&&r+1<s.length){o+=s[r]+s[r+1],r+=2;continue}if(w===u)l=!1;o+=s[r],r++;continue}if(w===te&&r+1<s.length){let C=s.charCodeAt(r+1);if(C===ke){let A=r;r+=2;while(r+1<s.length&&!(s.charCodeAt(r)===ke&&s.charCodeAt(r+1)===te))r++;r=Math.min(r+2,s.length),o+=s.slice(A,r);continue}if(C===te){let A=r;while(r<s.length&&s.charCodeAt(r)!==10)r++;o+=s.slice(A,r);continue}}if(w===be||w===$e||w===We){l=!0,u=w,o+=s[r],r++;continue}if(w===N||w===De||w===ae)c++;else if(w===ne||w===Me||w===Ae)c--;if(c>=1&&w===Ie&&(r+1>=s.length||s.charCodeAt(r+1)!==Ie&&s.charCodeAt(r+1)!==Te)){while(o.length>0&&(o[o.length-1]===" "||o[o.length-1]==="\t"||o[o.length-1]===`
25
+ `))o=o.slice(0,-1);r++;let C=0;while(r<s.length){let A=s.charCodeAt(r);if(A===te){if(s.charCodeAt(r+1)===te){let p=s.indexOf(`
26
+ `,r+2);r=p===-1?s.length:p+1;continue}if(s.charCodeAt(r+1)===ke){let p=s.indexOf("*/",r+2);r=p===-1?s.length:p+2;continue}if(h(s,r)){r=g(s,r);continue}}if(A===be||A===$e||A===We){let p=A;r++;while(r<s.length){if(s.charCodeAt(r)===tt){r+=2;continue}if(s.charCodeAt(r)===p){r++;break}r++}continue}if(A===N||A===De||A===ae)C++;else if(A===ne||A===Me||A===Ae){if(C===0)break;C--}else if(A===it&&C===0)break;r++}continue}o+=s[r],r++}return o}function cn(s){let o=s.trim(),r=o.startsWith("...");if(r)o=o.slice(3).trim();while(o.startsWith("@")){let v=1;while(v<o.length&&i(o.charCodeAt(v)))v++;if(v<o.length&&o.charCodeAt(v)===ae){let D=1;v++;while(v<o.length&&D>0){if(o.charCodeAt(v)===ae)D++;else if(o.charCodeAt(v)===Ae)D--;v++}}o=o.slice(v).trim()}let c=!0;while(c){c=!1;for(let v of Ut)if(o.startsWith(v)&&o.length>v.length&&!i(o.charCodeAt(v.length))){let D=o.slice(v.length).trim();if(D.charCodeAt(0)===nt||D.charCodeAt(0)===Ot&&D.length>1&&D.charCodeAt(1)===nt)break;o=D,c=!0;break}}let l=-1,u=-1,w=0,C=!1,A=0;for(let v=0;v<o.length;v++){let D=o.charCodeAt(v);if(C){if(D===tt){v++;continue}if(D===A)C=!1;continue}if(D===te&&v+1<o.length){let G=o.charCodeAt(v+1);if(G===ke){v+=2;while(v+1<o.length&&!(o.charCodeAt(v)===ke&&o.charCodeAt(v+1)===te))v++;v++;continue}if(G===te){while(v<o.length&&o.charCodeAt(v)!==10)v++;continue}if(h(o,v)){v=g(o,v)-1;continue}}if(D===be||D===$e||D===We){C=!0,A=D;continue}if(D===ae||D===N||D===De||D===Se)w++;else if(D===Ae||D===ne||D===Me||D===Te&&!(v>0&&o.charCodeAt(v-1)===Ie))w--;else if(w===0){if(D===nt&&l===-1)l=v;else if(D===Ie&&u===-1&&(v===0||o.charCodeAt(v-1)!==Ie)&&(v+1>=o.length||o.charCodeAt(v+1)!==Ie&&o.charCodeAt(v+1)!==Te))u=v}}let p,k,O=u!==-1;if(l!==-1&&(u===-1||l<u))if(p=o.slice(0,l).trim(),u!==-1)k=o.slice(l+1,u).trim();else k=o.slice(l+1).trim();else if(u!==-1){p=o.slice(0,u).trim();let v=r?null:we(p,o.slice(u+1));if(v)return je(v,kt);k=kt(o.slice(u+1).trim())}else p=o,k="unknown";if(p=In(p),(p.startsWith("{")||p.startsWith("["))&&p.includes(`
27
+ `)){let v=p.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(v.length<=40)p=v;else p=p.split(`
28
+ `).map((G)=>{let X=G.trim();if(!X)return"";if(X==="{"||X==="}"||X==="["||X==="]"||X.startsWith("}")||X.startsWith("]"))return X;return` ${X}`}).join(`
29
+ `)}let I=p.endsWith("?")||O;if(p.endsWith("?"))p=p.slice(0,-1).trim();let M=I&&!r?"?":"";if(r)return`...${p}: ${k}`;return`${p}${M}: ${k}`}function kt(s){let o=s.trim(),r=Qe(o);if(r)return r;if(o==="true"||o==="false")return"boolean";if(y(o))return"number";if(o.startsWith("'")&&o.endsWith("'")||o.startsWith('"')&&o.endsWith('"'))return"string";if(o.startsWith("["))return"unknown[]";if(o.startsWith("{"))return"Record<string, unknown>";return z(o)??"unknown"}function Wt(s){let o=s.trim();if(o.endsWith("as const"))o=o.slice(0,-8).trim();if(o==="true"||o==="false")return o;if(y(o))return K(o);let r=On(o);if(r!==null)return r;return z(o)??"unknown"}function On(s){if(s==="")return null;if(s.charCodeAt(0)===be||s.charCodeAt(0)===$e){if($t(s,0,s.charCodeAt(0))===s.length)return s}let o=En(s,"+");if(o.length>1){let r=!1,c=!0,l=[];for(let u of o){let w=u.trim(),C=w.charCodeAt(0);if((C===be||C===$e)&&$t(w,0,C)===w.length)r=!0,l.push(Rn(w));else c=!1}if(c)return Mn(l.join(""));if(r)return"string";return null}if(/^[\d\s()+*/%.\-]+$/.test(s)&&/\d/.test(s)&&/[+*/%\-\s]/.test(s))return"number";return null}function En(s,o){let r=[],c=0,l="",u=0;while(u<s.length){let w=s.charCodeAt(u);if(w===be||w===$e||w===We){let C=$t(s,u,w);l+=s.slice(u,C),u=C;continue}if(w===te&&(s.charCodeAt(u+1)===te||s.charCodeAt(u+1)===42)){if(s.charCodeAt(u+1)===te){let p=s.indexOf(`
30
+ `,u+2),k=p===-1?s.length:p;l+=s.slice(u,k),u=k;continue}let C=s.indexOf("*/",u+2),A=C===-1?s.length:C+2;l+=s.slice(u,A),u=A;continue}if(w===ae||w===De||w===N)c++;else if(w===Ae||w===Me||w===ne)c--;if(s[u]===o&&c===0){r.push(l),l="",u++;continue}l+=s[u],u++}return r.push(l),r}function Rn(s){return s.slice(1,-1).replace(/\\(.)/g,(r,c)=>{if(c==="n")return`
31
+ `;if(c==="t")return"\t";if(c==="r")return"\r";if(c==="0")return"\x00";return c})}function Mn(s){return`'${s.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function _t(s){if(s.endsWith("as const"))return null;let o=0,r=-1;for(let l=0;l<s.length;l++){let u=s.charCodeAt(l);if(u===be||u===$e||u===We)l=$t(s,l,u)-1;else if(u===123||u===91||u===40)o++;else if(u===125||u===93||u===41)o--;else if(o===0&&u===32&&l+4<=s.length&&s.substring(l,l+4)===" as ")r=l}if(r===-1)return null;return s.slice(r+4).trim()||null}function wt(){if(T(),e<S&&f.charCodeAt(e)===nt){let c=function(){let l=ve(s,r),u=(w)=>{let C=l.length-w.length;return C>=0&&l.endsWith(w)&&(C===0||!i(l.charCodeAt(C-1)))};return l.length===0||l.endsWith("=>")||l.endsWith("|")||l.endsWith("&")||u("is")||u("extends")};e++,T();let s=e,o=0,r=s;while(e<S){let l=e;if(qe()){if(f.charCodeAt(l)!==te)r=e;continue}let u=f.charCodeAt(e);if(u===ae||u===De||u===Se)o++;else if(u===Ae||u===Me||u===Te&&!et())o--;else if(u===N)if(o>0)o++;else if(c())o++;else break;else if(u===ne){if(o===0)break;o--}else if(o===0&&u===oe)break;if(o===0&&bt()&&!c())break;if(!He(u))r=e+1;e++}return ve(s,e)}return""}function at(s,o,r,c){e+=8,T();let l=e<S&&f.charCodeAt(e)===ke;if(l)e++,T();let u=Re();if(!u&&!c)return null;T();let w=rt();T();let C=ct();T();let A=wt(),p=A.length>0;if(!A)if(r&&l)A="AsyncGenerator<unknown, void, unknown>";else if(l)A="Generator<unknown, void, unknown>";else if(r)A="Promise<void>";else A="void";T();let k=!1;if(e<S&&f.charCodeAt(e)===N){k=!0;let X=e+1;if(Be(N,ne),!p&&!l){let j=f.slice(X,e-1),L=Oi(j,ie??"stdin.ts",()=>{let fe;do fe=`__dtsx_return_${se++}`;while(f.includes(fe));return fe},(fe)=>J(fe.name,{...fe,start:e,end:e}),w);A=L.finish(B(j,r,C,ot,L.resolve))}}else if(e<S&&f.charCodeAt(e)===oe)e++;let O=pt(C),v=`${o?c?"export default function ":"export declare function ":"declare function "}${u||(c?"":"default")}${w}${O}: ${A};`,D=Xe(s),G={kind:"function",name:u||"default",text:v,isExported:o,isDefault:c,isAsync:r,isGenerator:l,returnType:A,generics:w||void 0,leadingComments:D,start:s,end:e};if(k)Ce.add(G);return G}let Bt,Pn=0;function an(){Bt??=new Set(t(f).filter((s)=>s.kind==="word").map((s)=>f.slice(s.start,s.end)));for(;;){let s=`__dtsx_binding_${Pn++}`;if(Bt.has(s))continue;return Bt.add(s),s}}function dt(s,o,r){e+=o.length,T();let c=[];do{if(T(),e>=S)break;let l=f.charCodeAt(e),u,w=e;if(l===N||l===De)Be(l,l===N?ne:Me),u=f.slice(w,e);let C=u?an():Re();if(!C)return Ne(),c;T();let A,p,k,O=!1;if(e<S&&f.charCodeAt(e)===nt){e++,T();let X=e,j=0;while(e<S){if(qe()){if(j===0&&en())break;continue}let L=f.charCodeAt(e);if(L===ae||L===N||L===De||L===Se)j++;else if(L===Ae||L===ne||L===Me||L===Te&&!et())j--;else if(j===0&&(L===oe||L===it))break;else if(j===0&&L===Ie&&!Mt())break;if(j===0&&(ht()||tn()))break;e++}A=ve(X,e)}if(e<S&&f.charCodeAt(e)===Ie)if(ge&&A&&(!ee||!Fn(A)))Dn();else{e++,T();let X=e;k=X;let j=0,L=0,fe;while(e<S){if(j===0&&L===0&&xn(X,fe))break;if(qe())continue;let re=f.charCodeAt(e);if(re===ae||re===N||re===De)j++;else if(re===Ae||re===ne||re===Me)j--;else if(re===Se){Z??=H(f);let Pe=j===0&&L===0?Z(e,X,fe):void 0;if(Pe?.parameters||Pe?.completeOperand||Pe&&ie!==void 0&&!/\.[jt]sx$/.test(ie)){e=Pe.end,fe=Pe.completeOperand?Pe.end:void 0;continue}let ut=L>0||f[e+1]!=="/"&&xe(f,e)?Ze(e):null;if(ut){if(L=Math.max(0,L+ut.delta),e=ut.end+1,L===0)fe=e;continue}else if(L===0){if(Pe){e=Pe.end,fe=Pe.completeOperand?Pe.end:void 0;continue}}}else if(j===0&&L===0&&(re===oe||re===it))break;e++}if(p=kn(ve(X,e)),p.endsWith(" as const")||p==="const"){if(O=!0,!A){let re=p.endsWith(" as const")?p.slice(0,-9).trim():p,Pe=Wt(re);A=Pe!=="unknown"?Pe:void 0}}else if(!A){let re=U(p)??_t(p)??ot(p);if(re)A=re}}let I=c.length===0?Xe(s):void 0,M=u?"const":o,v=u?!1:r,D=`${v?"export ":""}declare ${M} ${C}: ${A||"unknown"};`,G={kind:"variable",name:C,text:D,isExported:v,typeAnnotation:A,value:p,initializerStart:k,modifiers:O?[M,"const assertion"]:[M],leadingComments:u?void 0:I,start:s,end:e};if(u)c.push(...cr({pattern:u,patternOffset:w,root:G,kind:o,exported:r,comments:I,allocateName:an}));else c.push(G);if(f.charCodeAt(e)===it){e++;continue}if(f.charCodeAt(e)===oe)e++;break}while(e<S);return c}function Lt(s,o){e+=9,T();let r=Re();T();let c=rt();T();let l="";if(_("extends")){e+=7,T();let p=e,k=0;while(e<S){if(qe())continue;let O=f.charCodeAt(e);if(O===Se)k++;else if(O===Te&&!et())k--;else if(O===N&&k===0)break;e++}l=ve(p,e)}T();let u=e<S&&f.charCodeAt(e)===N?Pt():"{}",w=on(u),C=`${o?"export ":""}declare interface ${r}${c}${l?` extends ${l}`:""} ${w}`,A=Xe(s);return{kind:"interface",name:r,text:C,isExported:o,extends:l||void 0,generics:c||void 0,leadingComments:A,start:s,end:e}}function Nt(s,o){e+=4,T();let r=Re();T();let c=rt();if(T(),e<S&&f.charCodeAt(e)===Ie)e++;T();let l=e,u=0;while(e<S){if(qe())continue;let p=f.charCodeAt(e);if(p===ae||p===N||p===De||p===Se)u++;else if(p===Ae||p===ne||p===Me||p===Te&&!et())u--;else if(u===0&&p===oe)break;if(u===0&&(ht()||tn()))break;e++}let w=ve(l,e);if(e<S&&f.charCodeAt(e)===oe)e++;let C=`${o?"export ":""}type ${r}${c} = ${w}`,A=Xe(s);return{kind:"type",name:r,text:C,isExported:o,generics:c||void 0,leadingComments:A,start:s,end:e}}function gt(s,o,r){e+=4,T();let c=Re();T();let l=e;if(e<S&&f.charCodeAt(e)===N)Be(N,ne);let u=ve(s,e),w=Xe(s);return{kind:"enum",name:c,text:u,isExported:o,modifiers:r?["const"]:void 0,leadingComments:w,start:s,end:e}}function lt(s,o,r,c=!1){e+=5,T();let l=Re()||"AnonymousClass";T();let u=rt();T();let w="";if(_("extends")){e+=7,T();let I=e,M=0;while(e<S){if(qe())continue;let v=f.charCodeAt(e);if(v===Se)M++;else if(v===Te&&!et())M--;else if(M===0&&(v===N||_("implements")))break;e++}w=ve(I,e)}let C;if(_("implements")){e+=10,T();let I=e,M=0;while(e<S){if(qe())continue;let D=f.charCodeAt(e);if(D===Se)M++;else if(D===Te&&!et())M--;else if(M===0&&D===N)break;e++}let v=ve(I,e);if(v)C=v.split(",").map((D)=>D.trim())}T();let A=qt(l),k=`${o?c?"export default ":"export declare ":"declare "}${r?"abstract ":""}class ${l}${u}${w?` extends ${w}`:""}${C&&C.length>0?` implements ${C.join(", ")}`:""} ${A}`,O=Xe(s);return{kind:"class",name:l,text:k,isExported:o,isDefault:c,extends:w||void 0,implements:C,generics:u||void 0,modifiers:r?["abstract"]:void 0,leadingComments:O,start:s,end:e}}let zt;function qt(s){if(e>=S||f.charCodeAt(e)!==N)return"{}";e++;let o={name:s,fields:new Map,pending:[],isStatic:!1};P.push(o);let r=[],c=new Set;while(e<S){if(T(),e>=S)break;if(f.charCodeAt(e)===ne){e++;break}if(f.charCodeAt(e)===oe){e++;continue}if(zt=Xe(e),_("static")&&Tt("static")===N){e+=6,T(),Be(N,ne);continue}let l=!1,u=!1,w=!1,C=!1,A=!1,p=!1,k=!1,O=!1,I=!0;while(I){T();let j=e,L=Re();if(e=j,L){let fe=Tt(L);if(fe===ae||fe===Se||fe===Ot||fe===33||fe===nt||fe===Ie||fe===oe||fe===ne)break}if(_("private")){l=!0,e+=7;continue}if(_("protected")){u=!0,e+=9;continue}if(_("public")){e+=6;continue}if(_("static")){w=!0,e+=6;continue}if(_("abstract")){C=!0,e+=8;continue}if(_("readonly")){A=!0,e+=8;continue}if(_("override")){p=!0,e+=8;continue}if(_("accessor")){k=!0,e+=8;continue}if(_("async")){O=!0,e+=5;continue}if(_("declare")){e+=7;continue}break}if(T(),e>=S||f.charCodeAt(e)===ne)break;let M=e;if(o.isStatic=w,(_("get")||_("set"))&&Ft(Tt(f.slice(e,e+3))))e+=3,T();if(f.charCodeAt(e)===ke)e++,T();let v=Dt();e=M;let D=v.startsWith("#");if(D)l=!0;if(l&&v&&v!=="constructor"){let j=D?w?" static #private_static;":" #private;":` private ${w?"static ":""}${v};`,fe=v[0]==="'"||v[0]==='"'?d(v)??v:v,re=D?`${w?"static":"instance"}#`:`${w?"static:":"instance:"}${fe}`;if(!c.has(re))c.add(re),r.push(j)}let G=l?[]:r,X=" ";if(u)X+="protected ";if(w)X+="static ";if(C)X+="abstract ";if(A)X+="readonly ";if(_("constructor")){e+=11,T();let j=ct();if(T(),Bn(j,r),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;let L=pt(j);r.push(l?" private constructor();":` ${u?"protected ":""}constructor${L};`)}else if(_("get"))if(e+=3,T(),e<S&&Ft(f.charCodeAt(e))){let j=Dt();if(j.startsWith("#")){if(T(),e<S&&f.charCodeAt(e)===ae)ct();if(T(),wt(),T(),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;continue}T(),ct(),T();let L=wt(),fe;if(T(),e<S&&f.charCodeAt(e)===N){let Pe=e+1;if(Be(N,ne),!L&&!ge)fe=f.slice(Pe,e-1),L=B(fe,!1,"()",(ut)=>xt(ut,w))}else if(e<S&&f.charCodeAt(e)===oe)e++;let re=G.length;if(G.push(`${X}get ${j}(): ${fe?W(L):L||"unknown"};`),fe)o.pending.push(()=>{let Pe=B(fe,!1,"()",(ut)=>xt(ut,w));G[re]=`${X}get ${j}(): ${W(Pe)};`})}else fn("get",X,w,A,O,G);else if(_("set"))if(e+=3,T(),e<S&&Ft(f.charCodeAt(e))){let j=Dt();if(j.startsWith("#")){if(T(),e<S&&f.charCodeAt(e)===ae)ct();if(T(),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;continue}T();let L=ct();if(T(),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;let fe=pt(L);G.push(`${X}set ${j}${fe};`)}else fn("set",X,w,A,O,G);else{let j=f.charCodeAt(e)===ke;if(j)e++,T();let L=Dt();if(!L){ln();continue}dn(L,X,w,A,j,C,O,G)}}for(let l of o.pending)l();return P.pop(),`{
32
+ ${r.join(`
33
+ `)}
34
+ }`}function Ft(s){return a(s)||s===De||s===mn||s===be||s===$e}function Dt(){if(e>=S)return"";let s=f.charCodeAt(e);if(s===De){let o=e;return Be(De,Me),f.slice(o,e)}if(s===mn)return e++,`#${Re()}`;if(s===be||s===$e){let o=e;return st(s),f.slice(o,e)}return Re()}function Tt(s){let o=e;e+=s.length,T();let r=e<S?f.charCodeAt(e):0;return e=o,r}function ln(){let s=0;while(e<S){if(qe())continue;let o=f.charCodeAt(e);if(o===N||o===ae)s++;else if(o===ne||o===Ae){if(s===0)return;s--}else if(o===oe&&s===0){e++;return}if(s===0&&bt())return;e++}}function fn(s,o,r,c,l,u){dn(s,o,r,c,!1,!1,l,u)}function dn(s,o,r,c,l,u,w,C){let A=zt;if(zt=void 0,T(),e>=S)return;let p=f.charCodeAt(e),k=!1;if(p===Ot)k=!0,e++,T();if(e<S&&f.charCodeAt(e)===33)e++,T();let O=e<S?f.charCodeAt(e):0;if(O===ae||O===Se){let I=O===Se?rt():"";T();let M=ct();T();let v=wt(),D,G=v.length>0;if(!v)if(w&&l)v="AsyncGenerator<unknown, void, unknown>";else if(l)v="Generator<unknown, void, unknown>";else if(w)v="Promise<void>";else v="void";if(T(),e<S&&f.charCodeAt(e)===N){let fe=e+1;if(Be(N,ne),!G&&!l)D=f.slice(fe,e-1),v=B(D,w,M,(re)=>xt(re,r))}else if(e<S&&f.charCodeAt(e)===oe)e++;let X=pt(M),j=k?"?":"",L=C.length;if(C.push(`${o}${s}${j}${I}${X}: ${D?W(v):v};`),D)P.at(-1)?.pending.push(()=>{let fe=B(D,w,M,(re)=>xt(re,r));C[L]=`${o}${s}${j}${I}${X}: ${W(fe)};`})}else if(O===nt||O===Ie||O===oe||O===ne||O===ye||O===Oe){let I="";if(O===nt){e++,T();let X=e,j=0;while(e<S){if(qe())continue;let L=f.charCodeAt(e);if(L===ae||L===N||L===De||L===Se)j++;else if(L===Ae||L===ne||L===Me||L===Te&&!et()){if(j===0)break;j--}else if(j===0&&(L===oe||L===it))break;else if(j===0&&L===Ie&&!Mt())break;if(j===0&&bt())break;e++}I=ve(X,e)}let M="";if(e<S&&f.charCodeAt(e)===Ie)if(ge&&I){e++;let X=0;while(e<S){if(qe())continue;let j=f.charCodeAt(e);if(j===ae||j===N||j===De)X++;else if(j===Ae||j===ne||j===Me){if(X===0&&j===ne)break;X--}else if(X===0&&j===oe)break;if(X===0&&bt())break;e++}}else{e++,T();let X=e,j=0;while(e<S){if(qe())continue;let L=f.charCodeAt(e);if(L===ae||L===N||L===De)j++;else if(L===Ae||L===ne||L===Me){if(j===0&&L===ne)break;j--}else if(j===0&&L===oe)break;if(j===0&&bt())break;e++}M=ve(X,e)}if(e<S&&f.charCodeAt(e)===oe)e++;let v=I.length>0;if(!I)if(M){let X=_t(M);if(X)I=X;else if(M.startsWith("new "))I=de(M);else if(I=M.endsWith("as const")||r&&c?Wt(M):kt(M),I==="unknown"&&Cn(M)&&!M.includes("."))I=de(M,!0)}else I="unknown";let D=k?"?":"";P.at(-1)?.fields.set(`${r?"static:":""}${s}`,k?`(${I}) | undefined`:I);let G=ee&&!v&&M?Kt(A,M,I):"";C.push(`${G}${o}${s}${D}: ${I};`)}else ln()}function Wn(s){let o=0;for(let r=0;r<s.length;r++){let c=s.charCodeAt(r);if(c===ae||c===N||c===De||c===Se)o++;else if(c===Ae||c===ne||c===Me||c===Te&&s.charCodeAt(r-1)!==Ie)o--;else if(c===Ie&&o===0&&s.charCodeAt(r+1)!==Te&&s.charCodeAt(r+1)!==Ie)return!0}return!1}function Bn(s,o){let r=s.slice(1,-1).trim();if(!r)return;let c=[],l=0,u=0,w=!1,C=0,A=[];for(let p=0;p<=r.length;p++){if(p===r.length){A.push(r.slice(l)),c.push(St(r.slice(l).trim()));break}let k=r.charCodeAt(p);if(w){if(k===tt){p++;continue}if(k===C)w=!1;continue}if(k===te&&p+1<r.length){let O=r.charCodeAt(p+1);if(O===ke){p+=2;while(p+1<r.length&&!(r.charCodeAt(p)===ke&&r.charCodeAt(p+1)===te))p++;p++;continue}if(O===te){while(p<r.length&&r.charCodeAt(p)!==10)p++;continue}}if(k===be||k===$e||k===We){w=!0,C=k;continue}if(k===ae||k===N||k===De||k===Se)u++;else if(k===Ae||k===ne||k===Me||k===Te&&!(p>0&&r.charCodeAt(p-1)===Ie))u--;else if(k===it&&u===0)A.push(r.slice(l,p)),c.push(St(r.slice(l,p).trim())),l=p+1}for(let[p,k]of c.entries()){let O=k.startsWith("public ")||k.startsWith("public\t"),I=k.startsWith("protected ")||k.startsWith("protected\t"),M=k.startsWith("private ")||k.startsWith("private\t"),v=k.includes("readonly ");if(!O&&!I&&!M&&!v)continue;let D=k,G=[];if(M){let re=7;while(re<D.length&&He(D.charCodeAt(re)))re++;D=D.slice(re),G.push("private")}if(O){let re=6;while(re<D.length&&He(D.charCodeAt(re)))re++;D=D.slice(re),G.push("public")}if(I){let re=9;while(re<D.length&&He(D.charCodeAt(re)))re++;D=D.slice(re),G.push("protected")}if(v){let re=D.indexOf("readonly ");if(re!==-1){let Pe=re+8;while(Pe<D.length&&He(D.charCodeAt(Pe)))Pe++;D=D.slice(0,re)+D.slice(Pe)}G.push("readonly")}let X=G.length>0?`${G.join(" ")} `:"",j=cn(D),L=D.search(/[?:=]/);if(L!==-1&&D.charCodeAt(L)!==63&&Wn(D))j=j.replace(/^([\w$]+)\?:/,"$1:");let fe="";if(ee&&!M&&L!==-1&&D.charCodeAt(L)===Ie){let re=D.slice(L+1);fe=Kt(rr(A[p]),re,kt(re))}o.push(M?` private ${j.split(/[?:]/,1)[0]};`:`${fe} ${X}${j};`)}}function Gt(s=" ",o="",r=!1){if(e>=S||f.charCodeAt(e)!==N)return"{}";e++;let c=Ee.at(-1)?.path,l={path:c?`${c}.${o}`:o,bindings:new Map,exports:new Set,annotatedValues:new Set,ambient:r||Ee.at(-1)?.ambient===!0};ce.push(l),Ee.push(l);let u=[];while(e<S){if(T(),e>=S)break;if(f.charCodeAt(e)===ne){e++;break}if(f.charCodeAt(e)===oe){e++;continue}let w=!1;if(_("export"))w=!0,e+=6,T();let C=!1;if(_("declare"))C=!0,e+=7,T();let A=w?"export ":"";if(_("function")||_("async")&&Ln("async","function")){let p=!1;if(_("async"))p=!0,e+=5,T();if(e+=8,T(),e<S&&f.charCodeAt(e)===ke)e++,T();let O=Re();T();let I=rt();T();let M=ct();T();let v=wt();if(!v)v=p?"Promise<void>":"void";if(T(),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;let D=pt(M);u.push(`${s}${A}function ${O}${I}${D}: ${v};`)}else if(_("const")||_("let")||_("var")){let p=_("const")?"const":_("let")?"let":"var";e+=p.length,T();let k=Re();if(l.bindings.set(k,"value"),w||l.ambient)l.exports.add(k);if(!k){Ne(!0);continue}T();let O="";if(e<S&&f.charCodeAt(e)===nt){e++,T();let M=e,v=0;while(e<S){if(qe())continue;let D=f.charCodeAt(e);if(D===ae||D===N||D===De||D===Se)v++;else if(D===ne&&v===0)break;else if(D===Ae||D===ne||D===Me||D===Te&&!et())v--;else if(v===0&&(D===oe||D===it))break;else if(v===0&&D===Ie&&!Mt())break;if(v===0&&ht())break;e++}O=ve(M,e)}if(O)l.annotatedValues.add(k);let I="";if(e<S&&f.charCodeAt(e)===Ie){e++,T();let M=e,v=0;while(e<S){if(qe())continue;let D=f.charCodeAt(e);if(D===ae||D===N||D===De||D===Se)v++;else if(D===ne&&v===0)break;else if(D===Ae||D===ne||D===Me||D===Te&&!et())v--;else if(v===0&&(D===oe||D===it))break;if(v===0&&ht())break;e++}I=ve(M,e)}if(e<S&&f.charCodeAt(e)===oe)e++;if(!O&&I){let M=_t(I);if(M)O=M;else if(p==="const")O=Wt(I);else O=kt(I)}if(!O)O="unknown";u.push(`${s}${A}${p} ${k}: ${O};`)}else if(_("interface")){e+=9,T();let p=Re();T();let k=rt();T();let O="";if(_("extends")){e+=7,T();let M=e,v=0;while(e<S){if(qe())continue;let D=f.charCodeAt(e);if(D===Se)v++;else if(D===Te&&!et())v--;else if(D===N&&v===0)break;e++}O=ve(M,e)}let I=on(Pt());u.push(`${s}${A}interface ${p}${k}${O?` extends ${O}`:""} ${I}`)}else if(_("type")){e+=4,T();let p=Re();T();let k=rt();if(T(),e<S&&f.charCodeAt(e)===Ie){e++,T();let O=e,I=0;while(e<S){if(qe())continue;let v=f.charCodeAt(e);if(v===ae||v===N||v===De||v===Se)I++;else if(v===ne&&I===0)break;else if(v===Ae||v===ne||v===Me||v===Te&&!et())I--;else if(I===0&&v===oe)break;if(I===0&&ht())break;e++}let M=ve(O,e);if(e<S&&f.charCodeAt(e)===oe)e++;u.push(`${s}${A}type ${p}${k} = ${M}`)}}else if(_("class")){e+=5,T();let p=Re();T();let k=rt();T();let O=e,I=0;while(e<S){if(qe())continue;let G=f.charCodeAt(e);if(G===Se)I++;else if(G===Te&&!et())I--;else if(G===N&&I===0)break;e++}let M=ve(O,e),v=M?` ${M}`:"";if(l.bindings.set(p,"class"),w||l.ambient)l.exports.add(p);let D=qt(p);u.push(`${s}${A}class ${p}${k}${v} ${D}`)}else if(_("enum")){e+=4,T();let p=Re();T();let k=Pt();u.push(`${s}${A}enum ${p} ${k}`)}else if(_("namespace")||_("module")){let p=_("namespace")?"namespace":"module";e+=p.length,T();let k=Re();if(!l.bindings.has(k))l.bindings.set(k,"namespace");if(w||l.ambient)l.exports.add(k);T();let O=Gt(s,k,C);u.push(`${s}${A}${p} ${k} ${O}`)}else if(_("abstract"))if(e+=8,T(),_("class")){e+=5,T();let p=Re();T();let k=rt();T();let O=e,I=0;while(e<S){if(qe())continue;let G=f.charCodeAt(e);if(G===Se)I++;else if(G===Te&&!et())I--;else if(G===N&&I===0)break;e++}let M=ve(O,e),v=M?` ${M}`:"";if(l.bindings.set(p,"class"),w||l.ambient)l.exports.add(p);let D=qt(p);u.push(`${s}${A}abstract class ${p}${k}${v} ${D}`)}else Ne(!0);else if(w&&_("default")){e+=7,T();let p=e;Ne(!0);let k=ve(p,e);if(k.charCodeAt(k.length-1)===oe)k=k.slice(0,-1);if(k)u.push(`${s}export default ${k};`)}else if(!w&&(f.charCodeAt(e)===be||f.charCodeAt(e)===$e||f.charCodeAt(e)===We))Ne(!0);else Ne(!0)}if(Ee.pop(),u.length===0)return"{}";return`{
35
+ ${u.join(`
36
+ `)}
37
+ }`}function Ln(s,o){let r=e+s.length;while(r<S&&He(f.charCodeAt(r)))r++;for(let c=0;c<o.length;c++)if(r+c>=S||f.charCodeAt(r+c)!==o.charCodeAt(c))return!1;return r+o.length>=S||!i(f.charCodeAt(r+o.length))}function mt(s,o,r){e+=r.length,T();let c="",l=f.charCodeAt(e);if(l===be||l===$e){let I=e;st(l),c=f.slice(I,e)}else{c=Re();while(e<S&&f.charCodeAt(e)===Ct)e++,c+=`.${Re()}`}T();let u=t(f.slice(s,e)),w=u.findIndex((I)=>I.kind==="word"&&["namespace","module"].includes(f.slice(s+I.start,s+I.end))),C=u.slice(0,w).some((I)=>I.kind==="word"&&f.slice(s+I.start,s+I.end)==="declare"),A=e<S&&f.charCodeAt(e)===N?Gt(" ",c,C):"{}",p=`${o?"export ":""}declare ${r} ${c} ${A}`,k=Xe(s),O=c.startsWith("'")||c.startsWith('"');return{kind:"module",name:c,text:p,isExported:o,moduleForm:O?"quoted":r==="namespace"?"namespace":"identifier",source:O?c.slice(1,-1):void 0,leadingComments:k,start:s,end:e}}function un(s,o){Ne();let r=ve(o,e);if(r.charCodeAt(r.length-1)===oe)r=r.slice(0,-1).trimEnd();if(!r)return;let c=a(r.charCodeAt(0));for(let k=1;c&&k<r.length;k++)c=i(r.charCodeAt(k));let l=Xe(s);if(c){q.push({kind:"export",name:"default",text:`export default ${r};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e});return}let u="__dtsx_default_export__",w=1;while(f.includes(u))u=`__dtsx_default_export_${w++}__`;let A=_t(r)||ot(r)||n(r,!1),p=A==="unknown"&&Cn(r)?`typeof ${r}`:A;q.push({kind:"variable",name:u,text:`declare const ${u}: ${p};`,isExported:!1,typeAnnotation:p,modifiers:["const"],start:s,end:e}),q.push({kind:"export",name:"default",text:`export default ${u};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e})}function hn(){if(f.charCodeAt(e)===N)return Be(N,ne),!0;let s=_("if"),o=_("do"),r=_("try"),c=_("for");if(!s&&!o&&!r&&!c&&!_("while")&&!_("switch")&&!_("with"))return!1;if(Re(),T(),c&&_("await"))e+=5,T();if(!o&&!r&&f.charCodeAt(e)===ae)Be(ae,Ae);if(It(),T(),s&&_("else"))e+=4,It();else if(o&&_("while")){if(e+=5,T(),f.charCodeAt(e)===ae)Be(ae,Ae);if(T(),f.charCodeAt(e)===oe)e++}else if(r){if(_("catch")){if(e+=5,T(),f.charCodeAt(e)===ae)Be(ae,Ae);It(),T()}if(_("finally"))e+=7,It()}return!0}function It(){if(T(),!hn())Ne()}while(e<S){if(T(),e>=S)break;if(hn())continue;let s=e,o=f.charCodeAt(e);if(o===105&&_("import"))q.push(Tn(s));else if(o===101&&_("export")){e+=6,T();let r=f.charCodeAt(e);if(r===100&&_("default")){e+=7,T();let c=e,l=f.charCodeAt(e);if(l===102&&_("function")){let u=at(s,!0,!1,!0);if(u)q.push(u)}else if(l===97&&_("async")&&Tt("async")!==oe)if(e+=5,T(),_("function")){let u=at(s,!0,!0,!0);if(u)q.push(u)}else un(s,c);else if(l===99&&_("class")){let u=lt(s,!0,!1,!0);q.push(u)}else if(l===97&&_("abstract")){if(e+=8,T(),_("class")){let u=lt(s,!0,!0,!0);q.push(u)}}else un(s,c)}else if(r===116&&_("type")){let c=e;if(e+=4,T(),e<S&&f.charCodeAt(e)===N){nn();let l=ve(s,e),u=Xe(s);q.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:vt(l),leadingComments:u,start:s,end:e})}else if(e<S&&f.charCodeAt(e)===ke){sn();let l=ve(s,e);q.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:vt(l),start:s,end:e})}else{e=c;let l=Nt(s,!0);q.push(l)}}else if(r===105&&_("interface")){let c=Lt(s,!0);q.push(c)}else if(r===102&&_("function")){let c=at(s,!0,!1,!1);if(c)q.push(c)}else if(r===97&&_("async"))if(e+=5,T(),_("function")){let c=at(s,!0,!0,!1);if(c)q.push(c)}else Ne();else if(r===99)if(_("class")){let c=lt(s,!0,!1);q.push(c)}else if(_("const")){let c=e;if(e+=5,T(),_("enum")){e=c+5,T();let l=gt(s,!0,!0);q.push(l)}else{e=c;let l=dt(s,"const",!0);for(let u=0;u<l.length;u++)q.push(l[u])}}else Ne();else if(r===97&&_("abstract")){if(e+=8,T(),_("class")){let c=lt(s,!0,!0);q.push(c)}}else if(r===108&&_("let")){let c=dt(s,"let",!0);for(let l=0;l<c.length;l++)q.push(c[l])}else if(r===118&&_("var")){let c=dt(s,"var",!0);for(let l=0;l<c.length;l++)q.push(c[l])}else if(r===101&&_("enum")){let c=gt(s,!0,!1);q.push(c)}else if(r===100&&_("declare"))e+=7,T(),gn(s,!0);else if(r===110&&_("namespace")&&yt(9)){let c=mt(s,!0,"namespace");q.push(c)}else if(r===109&&_("module")&&yt(6)){let c=mt(s,!0,"module");q.push(c)}else if(r===N){nn();let c=ve(s,e),l=c.includes("export type"),u=Xe(s);q.push({kind:"export",name:"",text:c,isExported:!0,isTypeOnly:l,source:vt(c),leadingComments:u,start:s,end:e})}else if(r===ke){sn();let c=ve(s,e),l=Xe(s);q.push({kind:"export",name:"",text:c,isExported:!0,isTypeOnly:!1,source:vt(c),leadingComments:l,start:s,end:e})}else{Ne();let c=ve(s,e);if(c)q.push({kind:"export",name:"",text:c,isExported:!0,start:s,end:e})}}else if(o===100&&_("declare"))e+=7,T(),gn(s,!1);else if(o===105&&_("interface")){let r=Lt(s,!1);J(r.name,r)}else if(o===116&&_("type")){let r=Nt(s,!1);J(r.name,r),q.push(r)}else if(o===102&&_("function")){let r=at(s,!1,!1,!1);if(r)Jt(r);else Ne()}else if(o===97)if(_("async")){let r=e;if(e+=5,T(),_("function")){let c=at(s,!1,!0,!1);if(c)Jt(c);else e=r,Ne()}else e=r,Ne()}else if(_("abstract"))if(e+=8,T(),_("class")){let r=lt(s,!1,!1);J(r.name,r),q.push(r)}else Ne();else e++,Ne();else if(o===99)if(_("class")){let r=lt(s,!1,!1);J(r.name,r),q.push(r)}else if(_("const")){let r=e;if(e+=5,T(),_("enum")){e=r+5,T();let c=gt(s,!1,!0);J(c.name,c),q.push(c)}else{e=r;let c=dt(s,"const",!1);for(let l=0;l<c.length;l++)J(c[l].name,c[l])}}else e++,Ne();else if(o===101&&_("enum")){let r=gt(s,!1,!1);J(r.name,r),q.push(r)}else if(o===108&&_("let")||o===118&&_("var")){let r=_("let")?"let":"var",c=dt(s,r,!1);for(let l=0;l<c.length;l++)J(c[l].name,c[l])}else if(o===109&&_("module")&&yt(6)){let r=mt(s,!1,"module");q.push(r)}else if(o===110&&_("namespace")&&yt(9)){let r=mt(s,!1,"namespace");q.push(r)}else{let r=f.charCodeAt(e);if(r===oe)e++;else if(r===be||r===$e){if(st(r),e<S&&f.charCodeAt(e)===oe)e++}else if(r===We){if(At(),e<S&&f.charCodeAt(e)===oe)e++}else if(r===qn){if(e++,Re(),T(),e<S&&f.charCodeAt(e)===Ct)e++,Re(),T();if(e<S&&f.charCodeAt(e)===ae)Be(ae,Ae)}else e++,Ne()}}if(pe.length){let s=new Set([...q,...me.values()]),o=new Set([...s].filter((C)=>C.kind==="class").map((C)=>C.name)),r=new Set([...s].filter((C)=>C.kind==="variable"&&!!C.typeAnnotation).map((C)=>C.name)),c=new Set,l=new Map;for(let C of ce)for(let[A,p]of C.bindings){let k=C.path?`${C.path}.${A}`:A;if(C.exports.has(A)&&(p!=="namespace"||!l.has(k)))l.set(k,p);if(C.exports.has(A)&&C.annotatedValues.has(A))c.add(k)}let u=new Map;for(let C of pe){if(C.binding){let A=r.has(C.initializer);for(let p=C.namespaces.length-1;p>=0;p--){let k=C.namespaces[p],O=k.path?`${k.path}.${C.initializer}`:C.initializer;if(k.bindings.has(C.initializer)||l.has(O)){A=k.bindings.has(C.initializer)?k.annotatedValues.has(C.initializer):c.has(O);break}}u.set(C.marker,A?`typeof ${C.initializer}`:"unknown");continue}u.set(C.marker,Ht(C.initializer,(A)=>{if(C.classes.includes(A))return!0;for(let p=C.namespaces.length-1;p>=0;p--){let k=C.namespaces[p],O=k.path?`${k.path}.${A}`:A,I=A.split(".")[0],M=k.bindings.get(I);if(M){if(A===I&&M!=="namespace")return M==="class";return l.get(O)==="class"}let v=k.path?`${k.path}.${I}`:I;if(l.has(v))return l.get(O)==="class"}return l.has(A)?l.get(A)==="class":o.has(A)}))}let w=(C)=>{if(!C.includes("__dtsx_constructor_field_"))return C;let A="",p=0;for(let k of t(C)){if(k.kind!=="word")continue;let O=u.get(C.slice(k.start,k.end));if(!O)continue;A+=C.slice(p,k.start)+O,p=k.end}return A+C.slice(p)};for(let C of s){C.text=w(C.text);for(let A of["typeAnnotation","inferredType","returnType"])if(C[A])C[A]=w(C[A])}}if(Ce.size>0){pn(q);for(let s of he.values())pn(s)}if(Un(f,q,me,he),Hn(q,me),ir(q,me),!ge)Jn(f,q,me,le);if(ue){let s=new Set(q);for(let o of[...me.values(),...[...he.values()].flat(),...[...Le.values()].flat()])if(!s.has(o))q.push(o),s.add(o);return q.sort((o,r)=>(o.start??0)-(r.start??0))}if(me.size>0)Gn(q,me,he,Le,Ye);return q;function pn(s){let o=new Map;for(let c of s)if(c.kind==="function")o.set(c.name,(o.get(c.name)||0)+1);let r=new Set;for(let[c,l]of o)if(l>1)r.add(c);if(r.size>0){let c=new Set;for(let l of r)for(let u=s.length-1;u>=0;u--)if(s[u].kind==="function"&&s[u].name===l&&Ce.has(s[u])){c.add(u);break}if(c.size>0){let l=[...c].sort((u,w)=>w-u);for(let u of l)s.splice(u,1)}}}function gn(s,o){if(_("function")){let r=at(s,o,!1,!1);if(r)q.push(r)}else if(_("async")){if(e+=5,T(),_("function")){let r=at(s,o,!0,!1);if(r)q.push(r)}}else if(_("class")){let r=lt(s,o,!1);q.push(r)}else if(_("abstract")){if(e+=8,T(),_("class")){let r=lt(s,o,!0);q.push(r)}}else if(_("interface")){let r=Lt(s,o);q.push(r)}else if(_("type")){let r=Nt(s,o);q.push(r)}else if(_("enum")){let r=gt(s,o,!1);q.push(r)}else if(_("const")){let r=e;if(e+=5,T(),_("enum")){e=r+5,T();let c=gt(s,o,!0);q.push(c)}else{e=r;let c=dt(s,"const",o);for(let l=0;l<c.length;l++)if(o||!Ye)q.push(c[l]);else J(c[l].name,c[l])}}else if(_("let")||_("var")){let r=_("let")?"let":"var",c=dt(s,r,o);for(let l=0;l<c.length;l++)if(o||!Ye)q.push(c[l]);else J(c[l].name,c[l])}else if(_("module")){let r=mt(s,o,"module");q.push(r)}else if(_("namespace")){let r=mt(s,o,"namespace");q.push(r)}else if(_("global")){e+=6,T();let c=`declare global ${e<S&&f.charCodeAt(e)===N?Gt(" ","",!0):"{}"}`,l=Xe(s);q.push({kind:"module",name:"global",text:c,isExported:!1,moduleForm:"global",leadingComments:l,start:s,end:e})}else Ne()}}class bn{names;lengths=new Uint8Array(65);firstUnits=new Uint8Array(65536);size;constructor(E){this.names=E;for(let ie of E.keys()){if(!ie)continue;this.lengths[Math.min(ie.length,64)]=1,this.firstUnits[ie.charCodeAt(0)]=1}this.size=E.size}scan(E,ie){if(this.size===0)return!1;let Q=!1,Y=0,ue=E.length;while(Y<ue){let le=E.charCodeAt(Y);if(le>=65&&le<=90||le>=97&&le<=122||le===95||le===36||le>127){let f=Y;Y++;while(Y<ue){let ee=E.charCodeAt(Y);if(ee>=65&&ee<=90||ee>=97&&ee<=122||ee>=48&&ee<=57||ee===95||ee===36||ee>127)Y++;else break}if(this.firstUnits[le]===1&&this.lengths[Math.min(Y-f,64)]===1){let ee=E.substring(f,Y),ge=this.names.get(ee);if(ge!==void 0){if(ie.add(ee),ge.kind==="function"||ge.kind==="variable")Q=!0}}}else Y++}return Q}}function An(E,ie){let Q=0;while(Q<E.length){let Y=E.charCodeAt(Q);if(Y===be||Y===$e||Y===We){let Ze=Y;Q++;while(Q<E.length)if(E.charCodeAt(Q)===tt)Q+=2;else if(E.charCodeAt(Q++)===Ze)break;continue}if(Y===te&&E.charCodeAt(Q+1)===te){Q+=2;while(Q<E.length&&E.charCodeAt(Q)!==ye&&E.charCodeAt(Q)!==Oe)Q++;continue}if(Y===te&&E.charCodeAt(Q+1)===ke){let Ze=E.indexOf("*/",Q+2);Q=Ze===-1?E.length:Ze+2;continue}if(!a(Y)){Q++;continue}let ue=Q++;while(Q<E.length&&i(E.charCodeAt(Q)))Q++;let le=ue-1,f=Q;while(le>=0&&He(E.charCodeAt(le)))le--;while(f<E.length&&He(E.charCodeAt(f)))f++;let ee=le>=0?E.charCodeAt(le):0,ge=f<E.length?E.charCodeAt(f):0,S=ue>=3&&E.slice(ue-3,ue)==="...";if(ge===nt||ee===Ct&&!S)continue;if(ge===ae&&(ee===N||ee===it))continue;ie.add(E.slice(ue,Q))}}function Gn(E,ie,Q,Y,ue){let le=new Map;if(ue){let e=0;for(let Z of E)if(Z.kind==="class"&&!Z.isExported){if(le.set(Z.name,Z),!ie.has(Z.name))ie.set(Z.name,Z)}else if(!Z.isExported&&(Z.kind==="type"||Z.kind==="interface")&&["variable","function"].includes(ie.get(Z.name)?.kind??""));else E[e++]=Z;E.length=e}let f=new Set(E),ee=new Set,ge=new Set,S=new Set;for(let e of E)if(ge.add(e.name),e.kind!=="type"&&e.kind!=="interface")S.add(e.name);let Ze=new bn(ie),Ye=new Map;for(let[e,Z]of Y){let se=ie.get(e);if(se?.kind==="variable"||se?.kind==="function")Ye.set(e,Z[0])}let q=new Set,me=new Set,Le=new Set,J=new Set,he=(e)=>{if(Ze.scan(e.text,Le))nr(e,J,Ye.size?{candidates:Ye,references:q}:void 0)},Ce=new Set;for(let e=0;e<E.length;e++){let Z=E[e];if(Z.kind!=="import"){if(he(Z),typeof Z.value==="string")An(Z.value,Ce)}}for(;;){let e=[];for(let[P,ce]of ie){if(ee.has(P))continue;if((ce.kind==="function"||ce.kind==="variable"?J:Le).has(P)||ce.kind!=="function"&&Ce.has(P)){let pe=le.get(P);if(pe){for(let Ke of[pe,ce])if(!f.has(Ke))e.push(Ke),f.add(Ke);ge.add(P)}else if(!(ce.kind==="function"||ce.kind==="variable"?S:ge).has(P)){let Ke=ce.kind==="function"?Q.get(P):void 0;if(Ke)for(let de of Ke)e.push(de);else e.push(ce);if(ge.add(P),ce.kind==="function"||ce.kind==="variable")S.add(P)}ee.add(P)}}for(let[P,ce]of Y){if(!Ye.has(P)||me.has(P)||!q.has(P))continue;for(let Ee of ce)if(!f.has(Ee))e.push(Ee),f.add(Ee);me.add(P)}if(e.length===0)break;e.sort((P,ce)=>(P.start??1/0)-(ce.start??1/0));let Z=[],se=0;for(let P=0;P<E.length;P++){let ce=E[P].start??1/0;while(se<e.length&&(e[se].start??1/0)<=ce)Z.push(e[se++]);Z.push(E[P])}while(se<e.length)Z.push(e[se++]);E.length=0;for(let P=0;P<Z.length;P++)E.push(Z[P]);for(let P of e)if(P.kind!=="import"){if(he(P),typeof P.value==="string")An(P.value,Ce)}}}
38
+ export{Oi,Ba,R,F,jt};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{a,i}from"./chunk-0af0hsfc.js";import{t,m}from"./chunk-tsbthwf0.js";import{ft,Gt}from"./chunk-t89jepjk.js";import{w}from"./chunk-k75z3nef.js";import{n,U}from"./chunk-h7tsf2qg.js";function F(g,k){let D=(B)=>t(B).map((y)=>B.slice(y.start,y.end)).join("");return D(g)===D(k)}function fe(g){if(["number","string","boolean","bigint","symbol","undefined","null"].includes(g))return g;let k=n(g,!1);return["number","string","boolean","bigint","undefined","null"].includes(k)?k:void 0}function de(g,k){if(F(g,k))return g;let D=fe(k);if(!D)return;let B=t(g),y=0,S=0,E=[];for(let T of B){let v=g.slice(T.start,T.end);if(v==="("||v==="["||v==="{"||v==="<")y++;else if(v===")"||v==="]"||v==="}"||v===">")y--;else if(v==="|"&&y===0)E.push(g.slice(S,T.start).trim()),S=T.end}E.push(g.slice(S).trim());let R=E.find((T)=>F(T,k));if(R)return R;if(E.includes(D))return D==="boolean"&&(k==="true"||k==="false")?k:D;return}function Jn(g,k,D,B=new Set){let y=new Map,S=[],E=new Set;for(let e of[...k,...D.values()]){if(E.has(e))continue;if(E.add(e),S.push(e),e.kind==="import")for(let o of w(e.text))y.set(o,{declared:`typeof ${o}`,flow:`typeof ${o}`,unresolved:!1});else if(["function","class","enum"].includes(e.kind))y.set(e.name,{declared:`typeof ${e.name}`,flow:`typeof ${e.name}`,unresolved:!1});else if(e.kind==="variable")y.set(e.name,{declared:e.typeAnnotation,unresolved:!1})}S.sort((e,o)=>(e.start??0)-(o.start??0));let R=new Set(S.filter((e)=>e.kind==="function"&&!e.generics).map((e)=>e.name));for(let e of B)R.add(e);let T=new Map,v=(e)=>{if(e=e.trimStart(),T.has(e))return T.get(e);if(T.set(e,void 0),!a(e.charCodeAt(0)))return;let o=1;while(i(e.charCodeAt(o)))o++;if(!R.has(e.slice(0,o)))return;let r=t(e);if(r[0]?.kind!=="word"||!r[1]||e.slice(r[1].start,r[1].end)!=="(")return;let d=1;for(let s=2;s<r.length;s++){let l=e.slice(r[s].start,r[s].end);if(l==="(")d++;else if(l===")"&&--d===0){let c=s===r.length-1?e.slice(r[0].start,r[0].end):void 0;return T.set(e,c),c}}return},_=new Set(S.filter((e)=>e.kind==="variable"&&!e.typeAnnotation&&typeof e.value==="string").map((e)=>v(e.value)).filter((e)=>e!==void 0)).size?m(g):void 0,H=new Map;if(_){let e=0;for(let o=0;o<_.length;o++){let r=g.slice(_[o].start,_[o].end);if(e===0&&r==="function"){let d=_[o+1],s=d&&g.slice(d.start,d.end)==="*"?_[o+2]:d;if(s?.kind==="word"){let l=g.slice(s.start,s.end);H.set(l,(H.get(l)??0)+1)}}if(["{","(","["].includes(r))e++;else if(["}",")","]"].includes(r))e--}}let W=new Map;for(let e of S)if(e.kind==="function"&&!e.generics&&H.get(e.name)===1)W.set(e.name,e);for(let e of B){let o=S.find((r)=>r.kind==="import"&&w(r.text).includes(e));if(o)W.set(e,o)}let I="__dtsx_call_result";while(g.includes(I))I+="_";let X=(e)=>`(typeof ${e}) extends (...args: never[]) => infer ${I} ? ${I} : never`,G=new Map,L=!1;for(let e of S){if(e.kind!=="variable"||e.typeAnnotation||typeof e.value!=="string")continue;let o=U(e.value);if(o&&n(e.value,!1)===o)e.inferredType=o,e.text=`${e.isExported?"export ":""}declare ${e.modifiers?.[0]??"const"} ${e.name}: ${o};`;let r=v(e.value);if(r&&W.has(r))G.set(e,X(r)),y.get(e.name).active=!0,y.get(r).active=!0,L=!0;if(e.modifiers?.[0]!=="const")continue;let d=ft(e.value);if(!d||d===e.name||!y.has(d))continue;y.get(d).active=!0,y.get(e.name).active=!0,L=!0}if(!L)return;let u=_??m(g),f=(e)=>u[e]?g.slice(u[e].start,u[e].end):"",b=new Map,z=new Map,J=new Set,N=new Set,Q=new Set,Y=new Map,j=[];for(let e=0;e<u.length;e++){let o=f(e),r=j.at(-1);if(r!==void 0)z.set(e,r);if(o==="{"&&["=","(","[",",",":","?","return","yield"].includes(f(e-1)))J.add(e);if(["(","[","{"].includes(o))j.push(e);else if([")","]","}"].includes(o)){let d=j.at(-1);if(d!==void 0&&["()","[]","{}"].includes(f(d)+o))j.pop(),b.set(d,e)}}let Z=new Map;for(let e=0;e<u.length;){if(u[e].kind!=="punctuation"){e++;continue}let r=[">>>=","**=","&&=","||=","??=","<<=",">>=","===","!==",">>>","**","&&","||","??","<<",">>","=>","==","!=","<=",">=","++","--","+=","-=","*=","/=","%=","&=","|=","^=","="].find((s)=>g.startsWith(s,u[e].start))??f(e);Z.set(e,r);let d=u[e].start+r.length;do e++;while(e<u.length&&u[e].start<d)}for(let e=0;e<u.length;e++){let o=te(e);if(o!==void 0)N.add(o)}for(let e of N)ce(e);let h=0;function ee(e){let o=ft(e);if(o){let l=y.get(o);return{type:l?.flow,unresolved:l?.unresolved??!1}}let r=v(e),d=r?W.get(r):void 0;if(d)return{type:d.returnType&&fe(d.returnType)?d.returnType:X(r),unresolved:!1};let s=n(e,!0);return{type:s==="unknown"?void 0:s,unresolved:!1}}function M(e){return Z.get(e)??""}function P(e){if(u[e]?.kind!=="word"||Q.has(e)||f(e-1)==="."||f(e-1)==="#"&&f(e-2)===".")return;let o=y.get(f(e));if(!o?.active)return;let r=M(e+1);if(["=","+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","&=","|=","^=","&&=","||=","??="].includes(r))return{binding:o,operator:r};if(["++","--"].includes(r)&&!/[\r\n]/.test(g.slice(u[e].end,u[e+1].start)))return{binding:o,operator:r};if(e>=2&&["++","--"].includes(M(e-2))){let d=u[e-3],s=d&&(d.kind==="word"||d.kind==="quoted"||[")","]"].includes(f(e-3)));if(!d||!s||/[\r\n;]/.test(g.slice(d.end,u[e-2].start)))return{binding:o,operator:M(e-2)}}return}function ne(e){let o=P(e);return o?.operator==="="?o.binding:void 0}function te(e){if(u[e]?.kind!=="word"||f(e)!=="class"||f(e-1)==="."||["(",":","="].includes(f(e+1)))return;let o=e+1,r=0;while(o<u.length){let d=f(o);if(d==="{"&&r===0)return o;if(d==="class"){let s=te(o);if(s!==void 0){o=(b.get(s)??s)+1;continue}}if(d==="function"){let s=oe(o,u.length);if(s){o=s.end;continue}}if(d==="<")r++;else if(d===">"&&M(o-1)!=="=>"&&r>0)r--;if(d===";")break;o=(b.get(o)??o)+1}return}function ie(e,o,r){let d=e,s=!1,l=r?["public","protected","private","static","abstract","override","declare","readonly","accessor","async","get","set"]:["async","get","set"];while(l.includes(f(d))&&!["(","<","?","!",":","=",";","}"].includes(f(d+1))){if(f(d)==="static")s=!0;d++}if(f(d)==="*")d++;if(r&&f(d)==="#")d++;if(f(d)==="["){let p=b.get(d);return p===void 0?void 0:{next:p+1,isStatic:s}}if(u[d]?.kind==="word"||u[d]?.kind==="quoted")return{next:d+1,isStatic:s};let c=d+1;while(c<o&&u[c-1].end===u[c].start&&!["(","<","?","!",":","=",";","}","[","{",","].includes(f(c)))c++;if(d<o&&n(g.slice(u[d].start,u[c-1].end),!1)==="number")return{next:c,isStatic:s};return}function V(e,o,r){let d=ie(e,o,r);if(!d)return;let s=d.next;if(r&&["?","!"].includes(f(s)))s++;if(f(s)==="<"){let l=1;s++;while(s<o&&l>0){if(f(s)==="<")l++;else if(f(s)===">"&&M(s-1)!=="=>")l--;s=(b.get(s)??s)+1}if(l!==0)return}return s}function re(e,o,r){return V(e,o,r)===o}function ae(e,o){let r=0,d=-1;for(let s=e;s<o;s=(b.get(s)??s)+1)if(f(s)==="<"&&(r>0||s>e&&(u[s-1].kind==="word"||[")","]"].includes(f(s-1))))){if(r===0)d=s;r++}else if(f(s)===">"&&M(s-1)!=="=>"&&r>0){if(r--,s===o-1&&r===0)return d<s-1}return!1}function le(e,o){if(f(e)==="static"&&f(e+1)==="{")return!0;let r=V(e,o,!0);return r!==void 0&&(r===o||["(",":","=",";","}"].includes(f(r)))}function q(e,o,r=!1){let d=b.get(o)??u.length,s=e;while(s<d){if(f(s)===";"||r&&M(s)==="=")return s;if(s>e&&z.get(s)===o&&/[\r\n]/.test(g.slice(u[s-1].end,u[s].start))){let l=f(s-1),p=!(l===">"&&ae(e,s)&&le(s,d))&&["+","-","*","/","%","=","<",">","&","|","^","!","~","?",":",",",".","(","[","{","as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","yield","void"].includes(l),A=[".","?",":",")","]","}",",","+","-","*","/","%","<",">","=","&","|","^","`","(","[","as","satisfies","instanceof","in"].includes(f(s));if(!p&&!A)return s}s=(b.get(s)??s)+1}return d}function K(e,o){for(let r=e;r<o;r++){if(f(r)==="["&&b.has(r)){r=b.get(r);continue}if(u[r].kind==="word")Q.add(r)}}function ce(e){let o=b.get(e)??u.length,r=e+1;while(r<o){if(f(r)===";"){r++;continue}if(f(r)==="static"&&f(r+1)==="{"){r=(b.get(r+1)??r+1)+1;continue}let d=ie(r,o,!0);if(!d){r++;continue}let s=V(r,o,!0);if(s===void 0){r++;continue}if(K(r,s),f(s)==="("){let c=b.get(s),p=c===void 0?void 0:se(c,o);if(p!==void 0){r=(b.get(p)??p)+1;continue}}let l=s;if(f(l)===":")l=q(l+1,e,!0);if(M(l)==="="){K(r,l+1);let c=l+1,p=q(c,e);if(!d.isStatic&&p>c)Y.set(c,p);r=p}else{let c=q(s,e);K(r,c),r=Math.max(r+1,c)}}}function ue(e){let o=z.get(e);if(o===void 0)return!1;let r=N.has(o);if(!r&&!J.has(o))return!1;if(re(o+1,e,r))return!0;for(let d=o+1;d<e;d++){let s=z.get(d),l=z.get(d)===o&&(f(d)===","||r&&f(d)===";"),c=r&&f(d)==="}"&&s!==void 0&&z.get(s)===o,p=r&&z.get(d+1)===o&&/[\r\n]/.test(g.slice(u[d].end,u[d+1].start));if((l||c||p)&&re(d+1,e,r))return!0}return!1}function se(e,o){let r=e+1,d=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(d===void 0||!Gt(g.slice(u[d].start,u[r].start))))return r;if(d===void 0)return;r=(b.get(r)??r)+1}return}function oe(e,o){let r=-1;if(f(e)==="("){let s=b.get(e);if(s!==void 0&&ue(e))r=se(s,o)??-1;else if(s!==void 0&&M(s+1)==="=>")r=s+3;else if(s!==void 0&&f(s+1)===":"){let l=s+2;while(l<o&&f(l)!==";"){if(M(l)==="=>"){r=l+2;break}l=(b.get(l)??l)+1}}}else if(u[e]?.kind==="word"&&M(e+1)==="=>")r=e+3;else if(f(e)==="function"){let s=e+1;while(s<o&&f(s)!=="(")s=(b.get(s)??s)+1;let l=b.get(s);if(l===void 0)return;r=l+1;let c=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(c===void 0||!Gt(g.slice(u[c].start,u[r].start))))break;r=(b.get(r)??r)+1}}if(r<0||r>=o)return;if(f(r)==="{")return{start:e,end:(b.get(r)??o-1)+1};let d=r;while(d<o&&![",",";",")","]","}"].includes(f(d)))d=(b.get(d)??d)+1;return{start:e,end:d}}function x(e,o,r=!0){for(let d=e;d<o;d++){let s=Y.get(d);if(s!==void 0){d=Math.min(s,o)-1;continue}let l=r?oe(d,o):void 0;if(l){let p=l.end;while(f(p)===")")p++;if(f(p)==="("||f(p)==="."&&["call","apply"].includes(f(p+1))&&f(p+2)==="(")x(l.start,l.end,!1);d=l.end-1;continue}let c=P(d);if(c)c.binding.flow=void 0,c.binding.unresolved=!0}}function ge(e){let o=!1;while(h<u.length&&u[h].start<e){let r=f(h);if(["if","else","for","while","do","switch","try","catch","finally","with"].includes(r))o=!0;if(r===";")o=!1;if(r==="("||r==="{"||r==="["){let c=b.get(h)??h+1;while(c<u.length&&u[c].start>=e)c--;if(x(h+1,c),h=c+1,r==="{")o=!1;continue}let d=ne(h);if(d){let l=h+2,c=l,p=[];while(c<u.length&&u[c].start<e){let C=f(c);if(p.length===0&&(C===";"||c>l&&/[\r\n]/.test(g.slice(u[c-1].end,u[c].start))&&(ne(c)||["if","for","while","switch","try","do","return","throw"].includes(C))))break;if(C==="("||C==="{"||C==="[")p.push(C==="("?")":C==="{"?"}":"]");else if(C===p.at(-1))p.pop();c++}let A=c>l?g.slice(u[l].start,u[c-1].end):"";x(l,c);let O=ee(A);d.flow=!o&&O.type?d.declared?de(d.declared,O.type):O.type:void 0,d.unresolved=o||O.unresolved||!d.flow,h=c;continue}let s=P(h);if(s)s.binding.flow=void 0,s.binding.unresolved=!0;h++}}for(let e of S){ge(e.start??0);let o=h;while(h<u.length&&u[h].start<(e.end??0))h++;if(e.kind!=="variable")continue;if(e.initializerStart!==void 0){let A=o;while(A<h&&u[A].start<e.initializerStart)A++;x(A,h)}let r=y.get(e.name);if(!r.active)continue;let d=typeof e.value==="string"?e.value:"";if(!d){r.flow=r.declared;continue}let s=ee(d),l=ft(d),c=l?y.get(l):void 0,p=G.get(e);if(p)e.inferredType=p;else if(!e.typeAnnotation&&e.modifiers?.[0]==="const"&&l&&l!==e.name&&c){if(s.unresolved)e.inferenceError="DTSX_UNSUPPORTED_VALUE_FLOW";else if(s.type)e.inferredType=c.declared&&F(c.declared,s.type)?`typeof ${l}`:s.type}if(e.inferredType)e.text=`${e.isExported?"export ":""}declare ${e.modifiers?.[0]??"const"} ${e.name}: ${e.inferredType};`;if(e.typeAnnotation)r.flow=s.type?de(e.typeAnnotation,s.type)??e.typeAnnotation:e.typeAnnotation;else if(e.inferredType)r.declared=e.inferredType,r.flow=e.inferredType;else{let A=e.modifiers?.[0]==="const",O=d.trim().startsWith("{")||d.trim().startsWith("["),C=n(d,A&&!O);r.declared=C==="unknown"?void 0:C,r.flow=r.declared}r.unresolved=s.unresolved}}
2
+ import{a,i}from"./chunk-gyfbehkf.js";import{t,m}from"./chunk-6exq13f9.js";import{ft,Gt}from"./chunk-zrfwvjq8.js";import{C}from"./chunk-h3r142dy.js";import{n,z}from"./chunk-txf9rw55.js";function F(g,w){let D=(B)=>t(B).map((y)=>B.slice(y.start,y.end)).join("");return D(g)===D(w)}function fe(g){if(["number","string","boolean","bigint","symbol","undefined","null"].includes(g))return g;let w=n(g,!1);return["number","string","boolean","bigint","undefined","null"].includes(w)?w:void 0}function de(g,w){if(F(g,w))return g;let D=fe(w);if(!D)return;let B=t(g),y=0,v=0,E=[];for(let S of B){let k=g.slice(S.start,S.end);if(k==="("||k==="["||k==="{"||k==="<")y++;else if(k===")"||k==="]"||k==="}"||k===">")y--;else if(k==="|"&&y===0)E.push(g.slice(v,S.start).trim()),v=S.end}E.push(g.slice(v).trim());let W=E.find((S)=>F(S,w));if(W)return W;if(E.includes(D))return D==="boolean"&&(w==="true"||w==="false")?w:D;return}function Jn(g,w,D,B=new Set){let y=new Map,v=[],E=new Set;for(let e of[...w,...D.values()]){if(E.has(e))continue;if(E.add(e),v.push(e),e.kind==="import")for(let o of C(e.text))y.set(o,{declared:`typeof ${o}`,flow:`typeof ${o}`,unresolved:!1});else if(["function","class","enum"].includes(e.kind))y.set(e.name,{declared:`typeof ${e.name}`,flow:`typeof ${e.name}`,unresolved:!1});else if(e.kind==="variable")y.set(e.name,{declared:e.typeAnnotation,unresolved:!1})}v.sort((e,o)=>(e.start??0)-(o.start??0));let W=new Set(v.filter((e)=>e.kind==="function"&&!e.generics).map((e)=>e.name));for(let e of B)W.add(e);let S=new Map,k=(e)=>{if(e=e.trimStart(),S.has(e))return S.get(e);if(S.set(e,void 0),!a(e.charCodeAt(0)))return;let o=1;while(i(e.charCodeAt(o)))o++;if(!W.has(e.slice(0,o)))return;let r=t(e);if(r[0]?.kind!=="word"||!r[1]||e.slice(r[1].start,r[1].end)!=="(")return;let d=1;for(let s=2;s<r.length;s++){let l=e.slice(r[s].start,r[s].end);if(l==="(")d++;else if(l===")"&&--d===0){let c=s===r.length-1?e.slice(r[0].start,r[0].end):void 0;return S.set(e,c),c}}return},_=new Set(v.filter((e)=>e.kind==="variable"&&!e.typeAnnotation&&typeof e.value==="string").map((e)=>k(e.value)).filter((e)=>e!==void 0)).size?m(g):void 0,L=new Map;if(_){let e=0;for(let o=0;o<_.length;o++){let r=g.slice(_[o].start,_[o].end);if(e===0&&r==="function"){let d=_[o+1],s=d&&g.slice(d.start,d.end)==="*"?_[o+2]:d;if(s?.kind==="word"){let l=g.slice(s.start,s.end);L.set(l,(L.get(l)??0)+1)}}if(["{","(","["].includes(r))e++;else if(["}",")","]"].includes(r))e--}}let I=new Map;for(let e of v)if(e.kind==="function"&&!e.generics&&L.get(e.name)===1)I.set(e.name,e);for(let e of B){let o=v.find((r)=>r.kind==="import"&&C(r.text).includes(e));if(o)I.set(e,o)}let j="__dtsx_call_result";while(g.includes(j))j+="_";let X=(e)=>`(typeof ${e}) extends (...args: never[]) => infer ${j} ? ${j} : never`,G=new Map,N=!1;for(let e of v){if(e.kind!=="variable"||e.typeAnnotation||typeof e.value!=="string")continue;let o=z(e.value);if(o&&n(e.value,!1)===o)e.inferredType=o,e.text=`${e.isExported?"export ":""}declare ${e.modifiers?.[0]??"const"} ${e.name}: ${o};`;let r=k(e.value);if(r&&I.has(r))G.set(e,X(r)),y.get(e.name).active=!0,y.get(r).active=!0,N=!0;if(e.modifiers?.[0]!=="const")continue;let d=ft(e.value);if(!d||d===e.name||!y.has(d))continue;y.get(d).active=!0,y.get(e.name).active=!0,N=!0}if(!N)return;let u=_??m(g),f=(e)=>u[e]?g.slice(u[e].start,u[e].end):"",b=new Map,O=new Map,J=new Set,P=new Set,Q=new Set,Y=new Map,x=[];for(let e=0;e<u.length;e++){let o=f(e),r=x.at(-1);if(r!==void 0)O.set(e,r);if(o==="{"&&["=","(","[",",",":","?","return","yield"].includes(f(e-1)))J.add(e);if(["(","[","{"].includes(o))x.push(e);else if([")","]","}"].includes(o)){let d=x.at(-1);if(d!==void 0&&["()","[]","{}"].includes(f(d)+o))x.pop(),b.set(d,e)}}let Z=new Map;for(let e=0;e<u.length;){if(u[e].kind!=="punctuation"){e++;continue}let r=[">>>=","**=","&&=","||=","??=","<<=",">>=","===","!==",">>>","**","&&","||","??","<<",">>","=>","==","!=","<=",">=","++","--","+=","-=","*=","/=","%=","&=","|=","^=","="].find((s)=>g.startsWith(s,u[e].start))??f(e);Z.set(e,r);let d=u[e].start+r.length;do e++;while(e<u.length&&u[e].start<d)}for(let e=0;e<u.length;e++){let o=te(e);if(o!==void 0)P.add(o)}for(let e of P)ce(e);let h=0;function ee(e){let o=ft(e);if(o){let l=y.get(o);return{type:l?.flow,unresolved:l?.unresolved??!1}}let r=k(e),d=r?I.get(r):void 0;if(d)return{type:d.returnType&&fe(d.returnType)?d.returnType:X(r),unresolved:!1};let s=n(e,!0);return{type:s==="unknown"?void 0:s,unresolved:!1}}function T(e){return Z.get(e)??""}function U(e){if(u[e]?.kind!=="word"||Q.has(e)||f(e-1)==="."||f(e-1)==="#"&&f(e-2)===".")return;let o=y.get(f(e));if(!o?.active)return;let r=T(e+1);if(["=","+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","&=","|=","^=","&&=","||=","??="].includes(r))return{binding:o,operator:r};if(["++","--"].includes(r)&&!/[\r\n]/.test(g.slice(u[e].end,u[e+1].start)))return{binding:o,operator:r};if(e>=2&&["++","--"].includes(T(e-2))){let d=u[e-3],s=d&&(d.kind==="word"||d.kind==="quoted"||[")","]"].includes(f(e-3)));if(!d||!s||/[\r\n;]/.test(g.slice(d.end,u[e-2].start)))return{binding:o,operator:T(e-2)}}return}function ne(e){let o=U(e);return o?.operator==="="?o.binding:void 0}function te(e){if(u[e]?.kind!=="word"||f(e)!=="class"||f(e-1)==="."||["(",":","="].includes(f(e+1)))return;let o=e+1,r=0;while(o<u.length){let d=f(o);if(d==="{"&&r===0)return o;if(d==="class"){let s=te(o);if(s!==void 0){o=(b.get(s)??s)+1;continue}}if(d==="function"){let s=oe(o,u.length);if(s){o=s.end;continue}}if(d==="<")r++;else if(d===">"&&T(o-1)!=="=>"&&r>0)r--;if(d===";")break;o=(b.get(o)??o)+1}return}function ie(e,o,r){let d=e,s=!1,l=r?["public","protected","private","static","abstract","override","declare","readonly","accessor","async","get","set"]:["async","get","set"];while(l.includes(f(d))&&!["(","<","?","!",":","=",";","}"].includes(f(d+1))){if(f(d)==="static")s=!0;d++}if(f(d)==="*")d++;if(r&&f(d)==="#")d++;if(f(d)==="["){let p=b.get(d);return p===void 0?void 0:{next:p+1,isStatic:s}}if(u[d]?.kind==="word"||u[d]?.kind==="quoted")return{next:d+1,isStatic:s};let c=d+1;while(c<o&&u[c-1].end===u[c].start&&!["(","<","?","!",":","=",";","}","[","{",","].includes(f(c)))c++;if(d<o&&n(g.slice(u[d].start,u[c-1].end),!1)==="number")return{next:c,isStatic:s};return}function V(e,o,r){let d=ie(e,o,r);if(!d)return;let s=d.next;if(r&&["?","!"].includes(f(s)))s++;if(f(s)==="<"){let l=1;s++;while(s<o&&l>0){if(f(s)==="<")l++;else if(f(s)===">"&&T(s-1)!=="=>")l--;s=(b.get(s)??s)+1}if(l!==0)return}return s}function re(e,o,r){return V(e,o,r)===o}function ae(e,o){let r=0,d=-1;for(let s=e;s<o;s=(b.get(s)??s)+1)if(f(s)==="<"&&(r>0||s>e&&(u[s-1].kind==="word"||[")","]"].includes(f(s-1))))){if(r===0)d=s;r++}else if(f(s)===">"&&T(s-1)!=="=>"&&r>0){if(r--,s===o-1&&r===0)return d<s-1}return!1}function le(e,o){if(f(e)==="static"&&f(e+1)==="{")return!0;let r=V(e,o,!0);return r!==void 0&&(r===o||["(",":","=",";","}"].includes(f(r)))}function q(e,o,r=!1){let d=b.get(o)??u.length,s=e;while(s<d){if(f(s)===";"||r&&T(s)==="=")return s;if(s>e&&O.get(s)===o&&/[\r\n]/.test(g.slice(u[s-1].end,u[s].start))){let l=f(s-1),p=!(l===">"&&ae(e,s)&&le(s,d))&&["+","-","*","/","%","=","<",">","&","|","^","!","~","?",":",",",".","(","[","{","as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","yield","void"].includes(l),M=[".","?",":",")","]","}",",","+","-","*","/","%","<",">","=","&","|","^","`","(","[","as","satisfies","instanceof","in"].includes(f(s));if(!p&&!M)return s}s=(b.get(s)??s)+1}return d}function K(e,o){for(let r=e;r<o;r++){if(f(r)==="["&&b.has(r)){r=b.get(r);continue}if(u[r].kind==="word")Q.add(r)}}function ce(e){let o=b.get(e)??u.length,r=e+1;while(r<o){if(f(r)===";"){r++;continue}if(f(r)==="static"&&f(r+1)==="{"){r=(b.get(r+1)??r+1)+1;continue}let d=ie(r,o,!0);if(!d){r++;continue}let s=V(r,o,!0);if(s===void 0){r++;continue}if(K(r,s),f(s)==="("){let c=b.get(s),p=c===void 0?void 0:se(c,o);if(p!==void 0){r=(b.get(p)??p)+1;continue}}let l=s;if(f(l)===":")l=q(l+1,e,!0);if(T(l)==="="){K(r,l+1);let c=l+1,p=q(c,e);if(!d.isStatic&&p>c)Y.set(c,p);r=p}else{let c=q(s,e);K(r,c),r=Math.max(r+1,c)}}}function ue(e){let o=O.get(e);if(o===void 0)return!1;let r=P.has(o);if(!r&&!J.has(o))return!1;if(re(o+1,e,r))return!0;for(let d=o+1;d<e;d++){let s=O.get(d),l=O.get(d)===o&&(f(d)===","||r&&f(d)===";"),c=r&&f(d)==="}"&&s!==void 0&&O.get(s)===o,p=r&&O.get(d+1)===o&&/[\r\n]/.test(g.slice(u[d].end,u[d+1].start));if((l||c||p)&&re(d+1,e,r))return!0}return!1}function se(e,o){let r=e+1,d=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(d===void 0||!Gt(g.slice(u[d].start,u[r].start))))return r;if(d===void 0)return;r=(b.get(r)??r)+1}return}function oe(e,o){let r=-1;if(f(e)==="("){let s=b.get(e);if(s!==void 0&&ue(e))r=se(s,o)??-1;else if(s!==void 0&&T(s+1)==="=>")r=s+3;else if(s!==void 0&&f(s+1)===":"){let l=s+2;while(l<o&&f(l)!==";"){if(T(l)==="=>"){r=l+2;break}l=(b.get(l)??l)+1}}}else if(u[e]?.kind==="word"&&T(e+1)==="=>")r=e+3;else if(f(e)==="function"){let s=e+1;while(s<o&&f(s)!=="(")s=(b.get(s)??s)+1;let l=b.get(s);if(l===void 0)return;r=l+1;let c=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(c===void 0||!Gt(g.slice(u[c].start,u[r].start))))break;r=(b.get(r)??r)+1}}if(r<0||r>=o)return;if(f(r)==="{")return{start:e,end:(b.get(r)??o-1)+1};let d=r;while(d<o&&![",",";",")","]","}"].includes(f(d)))d=(b.get(d)??d)+1;return{start:e,end:d}}function H(e,o,r=!0){for(let d=e;d<o;d++){let s=Y.get(d);if(s!==void 0){d=Math.min(s,o)-1;continue}let l=r?oe(d,o):void 0;if(l){let p=l.end;while(f(p)===")")p++;if(f(p)==="("||f(p)==="."&&["call","apply"].includes(f(p+1))&&f(p+2)==="(")H(l.start,l.end,!1);d=l.end-1;continue}let c=U(d);if(c)c.binding.flow=void 0,c.binding.unresolved=!0}}function ge(e){let o=!1;while(h<u.length&&u[h].start<e){let r=f(h);if(["if","else","for","while","do","switch","try","catch","finally","with"].includes(r))o=!0;if(r===";")o=!1;if(r==="("||r==="{"||r==="["){let c=b.get(h)??h+1;while(c<u.length&&u[c].start>=e)c--;if(H(h+1,c),h=c+1,r==="{")o=!1;continue}let d=ne(h);if(d){let l=h+2,c=l,p=[];while(c<u.length&&u[c].start<e){let A=f(c);if(p.length===0&&(A===";"||c>l&&/[\r\n]/.test(g.slice(u[c-1].end,u[c].start))&&(ne(c)||["if","for","while","switch","try","do","return","throw"].includes(A))))break;if(A==="("||A==="{"||A==="[")p.push(A==="("?")":A==="{"?"}":"]");else if(A===p.at(-1))p.pop();c++}let M=c>l?g.slice(u[l].start,u[c-1].end):"";H(l,c);let R=ee(M);d.flow=!o&&R.type?d.declared?de(d.declared,R.type):R.type:void 0,d.unresolved=o||R.unresolved||!d.flow,h=c;continue}let s=U(h);if(s)s.binding.flow=void 0,s.binding.unresolved=!0;h++}}for(let e of v){ge(e.start??0);let o=h;while(h<u.length&&u[h].start<(e.end??0))h++;if(e.kind!=="variable")continue;if(e.initializerStart!==void 0){let M=o;while(M<h&&u[M].start<e.initializerStart)M++;H(M,h)}let r=y.get(e.name);if(!r.active)continue;let d=typeof e.value==="string"?e.value:"";if(!d){r.flow=r.declared;continue}let s=ee(d),l=ft(d),c=l?y.get(l):void 0,p=G.get(e);if(p)e.inferredType=p;else if(!e.typeAnnotation&&e.modifiers?.[0]==="const"&&l&&l!==e.name&&c){if(s.unresolved)e.inferenceError="DTSX_UNSUPPORTED_VALUE_FLOW";else if(s.type)e.inferredType=c.declared&&F(c.declared,s.type)?`typeof ${l}`:s.type}if(e.inferredType)e.text=`${e.isExported?"export ":""}declare ${e.modifiers?.[0]??"const"} ${e.name}: ${e.inferredType};`;if(e.typeAnnotation)r.flow=s.type?de(e.typeAnnotation,s.type)??e.typeAnnotation:e.typeAnnotation;else if(e.inferredType)r.declared=e.inferredType,r.flow=e.inferredType;else{let M=e.modifiers?.[0]==="const",R=d.trim().startsWith("{")||d.trim().startsWith("["),A=n(d,M&&!R);r.declared=A==="unknown"?void 0:A,r.flow=r.declared}r.unresolved=s.unresolved}}
3
3
  export{Jn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{lstat as d,realpath as f,stat as T}from"fs/promises";import{isAbsolute as l,normalize as g,relative as p,resolve as u}from"path";var _={rootDir:process.cwd(),maxFileSize:10485760,maxTotalSize:104857600,timeout:30000,followSymlinks:!1,maxFiles:1e4,blockedPatterns:["**/.git/**","**/node_modules/**","**/.env*","**/secrets/**","**/*.key","**/*.pem"]};class E extends Error{code;path;constructor(t,r,e){super(t);this.code=r;this.path=e;this.name="SecurityError"}}function Ye(t,r={}){let{rootDir:e=process.cwd()}=r,i=g(t),n=l(i)?i:u(e,i),o=u(n),s=p(e,o);if(s.startsWith("..")||l(s))throw new E(`Path traversal detected: "${t}" resolves outside root directory`,"PATH_TRAVERSAL",t);return o}function Jr(t,r={}){return t.map((e)=>Ye(e,r))}function gn(t,r={}){let e=r.blockedPatterns||_.blockedPatterns;for(let i of e)if(h(t,i))return!0;return!1}var m=new Map;function P(t){let r=m.get(t);if(r)return r;let e=t.replace(/\*\*/g,"<<GLOBSTAR>>").replace(/\*/g,"<<STAR>>").replace(/\?/g,"<<QUESTION>>");e=e.replace(/[.+^${}()|[\]\\]/g,"\\$&"),e=e.replace(/^<<GLOBSTAR>>\//,"(.*\\/)?"),e=e.replace(/\/<<GLOBSTAR>>$/,"(\\/.*)?"),e=e.replace(/\/<<GLOBSTAR>>\//g,"(\\/.*)?\\/"),e=e.replace(/<<GLOBSTAR>>/g,".*"),e=e.replace(/<<STAR>>/g,"[^/]*"),e=e.replace(/<<QUESTION>>/g,"[^/]");let i=new RegExp(`^${e}$`);return m.set(t,i),i}function h(t,r){let e=t.indexOf("\\")===-1?t:t.replace(/\\/g,"/");return P(r).test(e)}async function Yr(t,r={}){let e=r.maxFileSize??_.maxFileSize;try{let i=await T(t);if(i.size>e)throw new E(`File too large: "${t}" is ${a(i.size)}, max is ${a(e)}`,"FILE_TOO_LARGE",t);return i.size}catch(i){if(i instanceof E)throw i;throw new E(`Failed to check file size: ${t}`,"INVALID_PATH",t)}}async function Xr(t){try{return(await d(t)).isSymbolicLink()}catch{return!1}}async function Zr(t,r={}){let e=r.followSymlinks??_.followSymlinks;if(await Xr(t)){if(!e)throw new E(`Symbolic links not allowed: "${t}"`,"SYMLINK_NOT_ALLOWED",t);let i=await f(t);return Ye(i,r)}return t}async function vt(t,r={}){let e=Ye(t,r);if(gn(e,r))throw new E(`Path matches blocked pattern: "${t}"`,"BLOCKED_PATTERN",t);let i=await Zr(e,r),n=await Yr(i,r);return{path:i,size:n}}async function hn(t,r={}){let e=r.maxFiles??_.maxFiles,i=r.maxTotalSize??_.maxTotalSize;if(t.length>e)throw new E(`Too many files: ${t.length} exceeds maximum of ${e}`,"MAX_FILES_EXCEEDED");let n=[],o=0;for(let s of t){let c=await vt(s,r);if(n.push(c.path),o+=c.size,o>i)throw new E(`Total size exceeded: ${a(o)} exceeds maximum of ${a(i)}`,"TOTAL_SIZE_EXCEEDED")}return{paths:n,totalSize:o}}function St(t,r,e="Operation"){return new Promise((i,n)=>{let o=setTimeout(()=>{n(new E(`${e} timed out after ${r}ms`,"TIMEOUT"))},r);t.then((s)=>{clearTimeout(o),i(s)}).catch((s)=>{clearTimeout(o),n(s)})})}function Qr(t,r={}){let e=r.timeout??_.timeout;return async(i)=>{let{path:n}=await vt(i,r);return St(t(n),e,`Processing ${i}`)}}function so(t,r={}){let e=r.timeout??_.timeout;return async(i)=>{let{paths:n}=await hn(i,r);return St(t(n),e,`Processing ${i.length} files`)}}function oo(t){let r=t.replace(/\\/g,"/").replace(/\0/g,"").replace(/^\/+/,"").replace(/^[A-Z]:/i,""),e="";while(e!==r)e=r,r=r.replace(/\.\.\/|\.\.$/g,"").replace(/\/+/g,"/");return r.replace(/^\/+|\/+$/g,"")}function ao(t){if(t.includes("\x00"))return!1;if(g(t).includes(".."))return!1;if(l(t)&&!t.startsWith(process.cwd()))return!1;return!0}function a(t){if(t===0)return"0 B";let r=["B","KB","MB","GB"],e=1024,i=Math.floor(Math.log(t)/Math.log(e));return`${Number.parseFloat((t/e**i).toFixed(2))} ${r[i]}`}function co(t={}){let r={..._,...t};return{validatePath:(e)=>Ye(e,r),validatePaths:(e)=>Jr(e,r),validateFile:(e)=>vt(e,r),validateBatch:(e)=>hn(e,r),withTimeout:(e,i)=>St(e,r.timeout,i),secureProcessor:(e)=>Qr(e,r),isBlocked:(e)=>gn(e,r),getConfig:()=>r}}
3
- export{_,E,Ye,Jr,gn,Yr,Xr,Zr,vt,hn,St,Qr,so,oo,ao,co};
2
+ import{lstat as d,realpath as f,stat as T}from"fs/promises";import{isAbsolute as l,normalize as g,relative as p,resolve as u}from"path";var _={rootDir:process.cwd(),maxFileSize:10485760,maxTotalSize:104857600,timeout:30000,followSymlinks:!1,maxFiles:1e4,blockedPatterns:["**/.git/**","**/node_modules/**","**/.env*","**/secrets/**","**/*.key","**/*.pem"]};class k extends Error{code;path;constructor(t,r,e){super(t);this.code=r;this.path=e;this.name="SecurityError"}}function Ye(t,r={}){let{rootDir:e=process.cwd()}=r,i=g(t),n=l(i)?i:u(e,i),o=u(n),s=p(e,o);if(s.startsWith("..")||l(s))throw new k(`Path traversal detected: "${t}" resolves outside root directory`,"PATH_TRAVERSAL",t);return o}function Jr(t,r={}){return t.map((e)=>Ye(e,r))}function gn(t,r={}){let e=r.blockedPatterns||_.blockedPatterns;for(let i of e)if(h(t,i))return!0;return!1}var m=new Map;function P(t){let r=m.get(t);if(r)return r;let e=t.replace(/\*\*/g,"<<GLOBSTAR>>").replace(/\*/g,"<<STAR>>").replace(/\?/g,"<<QUESTION>>");e=e.replace(/[.+^${}()|[\]\\]/g,"\\$&"),e=e.replace(/^<<GLOBSTAR>>\//,"(.*\\/)?"),e=e.replace(/\/<<GLOBSTAR>>$/,"(\\/.*)?"),e=e.replace(/\/<<GLOBSTAR>>\//g,"(\\/.*)?\\/"),e=e.replace(/<<GLOBSTAR>>/g,".*"),e=e.replace(/<<STAR>>/g,"[^/]*"),e=e.replace(/<<QUESTION>>/g,"[^/]");let i=new RegExp(`^${e}$`);return m.set(t,i),i}function h(t,r){let e=t.indexOf("\\")===-1?t:t.replace(/\\/g,"/");return P(r).test(e)}async function Yr(t,r={}){let e=r.maxFileSize??_.maxFileSize;try{let i=await T(t);if(i.size>e)throw new k(`File too large: "${t}" is ${a(i.size)}, max is ${a(e)}`,"FILE_TOO_LARGE",t);return i.size}catch(i){if(i instanceof k)throw i;throw new k(`Failed to check file size: ${t}`,"INVALID_PATH",t)}}async function Xr(t){try{return(await d(t)).isSymbolicLink()}catch{return!1}}async function Zr(t,r={}){let e=r.followSymlinks??_.followSymlinks;if(await Xr(t)){if(!e)throw new k(`Symbolic links not allowed: "${t}"`,"SYMLINK_NOT_ALLOWED",t);let i=await f(t);return Ye(i,r)}return t}async function vt(t,r={}){let e=Ye(t,r);if(gn(e,r))throw new k(`Path matches blocked pattern: "${t}"`,"BLOCKED_PATTERN",t);let i=await Zr(e,r),n=await Yr(i,r);return{path:i,size:n}}async function hn(t,r={}){let e=r.maxFiles??_.maxFiles,i=r.maxTotalSize??_.maxTotalSize;if(t.length>e)throw new k(`Too many files: ${t.length} exceeds maximum of ${e}`,"MAX_FILES_EXCEEDED");let n=[],o=0;for(let s of t){let c=await vt(s,r);if(n.push(c.path),o+=c.size,o>i)throw new k(`Total size exceeded: ${a(o)} exceeds maximum of ${a(i)}`,"TOTAL_SIZE_EXCEEDED")}return{paths:n,totalSize:o}}function St(t,r,e="Operation"){return new Promise((i,n)=>{let o=setTimeout(()=>{n(new k(`${e} timed out after ${r}ms`,"TIMEOUT"))},r);t.then((s)=>{clearTimeout(o),i(s)}).catch((s)=>{clearTimeout(o),n(s)})})}function Qr(t,r={}){let e=r.timeout??_.timeout;return async(i)=>{let{path:n}=await vt(i,r);return St(t(n),e,`Processing ${i}`)}}function so(t,r={}){let e=r.timeout??_.timeout;return async(i)=>{let{paths:n}=await hn(i,r);return St(t(n),e,`Processing ${i.length} files`)}}function oo(t){let r=t.replace(/\\/g,"/").replace(/\0/g,"").replace(/^\/+/,"").replace(/^[A-Z]:/i,""),e="";while(e!==r)e=r,r=r.replace(/\.\.\/|\.\.$/g,"").replace(/\/+/g,"/");return r.replace(/^\/+|\/+$/g,"")}function ao(t){if(t.includes("\x00"))return!1;if(g(t).includes(".."))return!1;if(l(t)&&!t.startsWith(process.cwd()))return!1;return!0}function a(t){if(t===0)return"0 B";let r=["B","KB","MB","GB"],e=1024,i=Math.floor(Math.log(t)/Math.log(e));return`${Number.parseFloat((t/e**i).toFixed(2))} ${r[i]}`}function co(t={}){let r={..._,...t};return{validatePath:(e)=>Ye(e,r),validatePaths:(e)=>Jr(e,r),validateFile:(e)=>vt(e,r),validateBatch:(e)=>hn(e,r),withTimeout:(e,i)=>St(e,r.timeout,i),secureProcessor:(e)=>Qr(e,r),isBlocked:(e)=>gn(e,r),getConfig:()=>r}}
3
+ export{_,k,Ye,Jr,gn,Yr,Xr,Zr,vt,hn,St,Qr,so,oo,ao,co};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{r}from"./chunk-v4z6808c.js";import{l}from"./chunk-vdhzc40m.js";import{existsSync as v}from"fs";import{readFile as D}from"fs/promises";import{dirname as N,join as k,resolve as S}from"path";async function $r(e,o=process.cwd()){let i=new Map;for(let t of e){let n=S(o,t),s=await F(n,o);i.set(n,{path:n,dependencies:s,dependents:new Set,state:"pending"})}for(let[t,n]of i)for(let s of n.dependencies){let c=i.get(s);if(c)c.dependents.add(t)}return i}async function F(e,o){let i=new Set;try{let t=await D(e,"utf-8"),n=N(e);for(let s of r(t,e,!1)){let c=s.source;if(!c||!c.startsWith(".")&&!c.startsWith("/"))continue;let a=z(c,n,o);if(a)i.add(a)}}catch{}return i}function z(e,o,i){let t=S(o,e);if(/\.(?:ts|tsx|mts|cts)$/.test(e))return t.includes("node_modules")?null:t;let n=[".ts",".tsx",".mts",".cts"];for(let c of n){let a=`${t}${c}`;if(v(a))return a}for(let c of n){let a=k(t,`index${c}`);if(v(a))return a}let s=`${t}.ts`;return s.includes("node_modules")?null:s}function G(e){let o=[];for(let[i,t]of e){if(t.state!=="pending")continue;let n=!0;for(let s of t.dependencies){let c=e.get(s);if(c&&c.state!=="completed"){n=!1;break}}if(n)o.push(i)}return o}async function I(e,o={}){let i=await D(e,"utf-8"),t=o.keepComments??!0,n=r(i,e,t,o.isolatedDeclarations??!1);return l(n,{filePath:e,sourceCode:i,declarations:n},t,o.importOrder)}async function ms(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await $r(e,n),w=new Map,P=new Map,h=[],x=0,u=0,m=0,b=g.size;while(m<b){let y=G(g);if(y.length===0){let f=[...g.values()].filter((d)=>d.state==="pending");if(f.length>0)for(let d of f)d.state="failed",d.error=Error("Circular dependency detected or dependency failed"),P.set(d.path,d.error),m++;break}let C=y.slice(0,t-u);for(let f of C){let d=g.get(f);d.state="processing",u++}x=Math.max(x,u);let E=C.map(async(f)=>{let d=g.get(f),M=performance.now();try{let p=await I(f,s);d.state="completed",d.result=p,d.duration=performance.now()-M,w.set(f,p),h.push(f)}catch(p){if(d.state="failed",d.error=p instanceof Error?p:Error(String(p)),d.duration=performance.now()-M,P.set(f,d.error),a&&!a(f,d.error))throw Error("Processing aborted by error handler")}finally{u--,m++,c?.(m,b,f)}});await Promise.all(E)}return{success:w,failed:P,totalTimeMs:performance.now()-i,maxConcurrent:x,processingOrder:h}}function gs(e){let o=[],i=new Set,t=new Set;function n(s){if(i.has(s))return;if(t.has(s))return;t.add(s);let c=e.get(s);if(c){for(let a of c.dependencies)if(e.has(a))n(a)}t.delete(s),i.add(s),o.push(s)}for(let s of e.keys())n(s);return o}function Er(e){let o=[];for(let[i,t]of e){let n=!1;for(let s of t.dependencies)if(e.has(s)){n=!0;break}if(!n)o.push(i)}return o}function kr(e){let o=[],i=new Set;while(i.size<e.size){let t=[];for(let[n,s]of e){if(i.has(n))continue;let c=!0;for(let a of s.dependencies)if(e.has(a)&&!i.has(a)){c=!1;break}if(c)t.push(n)}if(t.length===0){for(let n of e.keys())if(!i.has(n))t.push(n)}for(let n of t)i.add(n);o.push(t)}return o}function hs(e){let o=kr(e),i=Er(e),t=Math.max(...o.map((s)=>s.length)),n=e.size/o.length;return{totalFiles:e.size,independentFiles:i.length,maxParallelism:t,levels:o.length,estimatedSpeedup:n}}
2
+ import{r}from"./chunk-c6bfdmfy.js";import{l}from"./chunk-h12vphnz.js";import{existsSync as v}from"fs";import{readFile as D}from"fs/promises";import{dirname as N,join as k,resolve as S}from"path";async function $r(e,o=process.cwd()){let i=new Map;for(let t of e){let n=S(o,t),s=await F(n,o);i.set(n,{path:n,dependencies:s,dependents:new Set,state:"pending"})}for(let[t,n]of i)for(let s of n.dependencies){let c=i.get(s);if(c)c.dependents.add(t)}return i}async function F(e,o){let i=new Set;try{let t=await D(e,"utf-8"),n=N(e);for(let s of r(t,e,!1)){let c=s.source;if(!c||!c.startsWith(".")&&!c.startsWith("/"))continue;let a=z(c,n,o);if(a)i.add(a)}}catch{}return i}function z(e,o,i){let t=S(o,e);if(/\.(?:ts|tsx|mts|cts)$/.test(e))return t.includes("node_modules")?null:t;let n=[".ts",".tsx",".mts",".cts"];for(let c of n){let a=`${t}${c}`;if(v(a))return a}for(let c of n){let a=k(t,`index${c}`);if(v(a))return a}let s=`${t}.ts`;return s.includes("node_modules")?null:s}function G(e){let o=[];for(let[i,t]of e){if(t.state!=="pending")continue;let n=!0;for(let s of t.dependencies){let c=e.get(s);if(c&&c.state!=="completed"){n=!1;break}}if(n)o.push(i)}return o}async function I(e,o={}){let i=await D(e,"utf-8"),t=o.keepComments??!0,n=r(i,e,t,o.isolatedDeclarations??!1);return l(n,{filePath:e,sourceCode:i,declarations:n},t,o.importOrder)}async function ms(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await $r(e,n),w=new Map,P=new Map,h=[],x=0,u=0,m=0,b=g.size;while(m<b){let y=G(g);if(y.length===0){let f=[...g.values()].filter((d)=>d.state==="pending");if(f.length>0)for(let d of f)d.state="failed",d.error=Error("Circular dependency detected or dependency failed"),P.set(d.path,d.error),m++;break}let C=y.slice(0,t-u);for(let f of C){let d=g.get(f);d.state="processing",u++}x=Math.max(x,u);let E=C.map(async(f)=>{let d=g.get(f),M=performance.now();try{let p=await I(f,s);d.state="completed",d.result=p,d.duration=performance.now()-M,w.set(f,p),h.push(f)}catch(p){if(d.state="failed",d.error=p instanceof Error?p:Error(String(p)),d.duration=performance.now()-M,P.set(f,d.error),a&&!a(f,d.error))throw Error("Processing aborted by error handler")}finally{u--,m++,c?.(m,b,f)}});await Promise.all(E)}return{success:w,failed:P,totalTimeMs:performance.now()-i,maxConcurrent:x,processingOrder:h}}function gs(e){let o=[],i=new Set,t=new Set;function n(s){if(i.has(s))return;if(t.has(s))return;t.add(s);let c=e.get(s);if(c){for(let a of c.dependencies)if(e.has(a))n(a)}t.delete(s),i.add(s),o.push(s)}for(let s of e.keys())n(s);return o}function Er(e){let o=[];for(let[i,t]of e){let n=!1;for(let s of t.dependencies)if(e.has(s)){n=!0;break}if(!n)o.push(i)}return o}function kr(e){let o=[],i=new Set;while(i.size<e.size){let t=[];for(let[n,s]of e){if(i.has(n))continue;let c=!0;for(let a of s.dependencies)if(e.has(a)&&!i.has(a)){c=!1;break}if(c)t.push(n)}if(t.length===0){for(let n of e.keys())if(!i.has(n))t.push(n)}for(let n of t)i.add(n);o.push(t)}return o}function hs(e){let o=kr(e),i=Er(e),t=Math.max(...o.map((s)=>s.length)),n=e.size/o.length;return{totalFiles:e.size,independentFiles:i.length,maxParallelism:t,levels:o.length,estimatedSpeedup:n}}
3
3
  export{$r,ms,gs,Er,kr,hs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{r}from"./chunk-v4z6808c.js";import{l}from"./chunk-vdhzc40m.js";import{existsSync as P,readFileSync as b,unwatchFile as w}from"fs";var Ur;((o)=>{o[o.Error=1]="Error";o[o.Warning=2]="Warning";o[o.Information=3]="Information";o[o.Hint=4]="Hint"})(Ur||={});var zr;((s)=>{s[s.File=1]="File";s[s.Module=2]="Module";s[s.Namespace=3]="Namespace";s[s.Package=4]="Package";s[s.Class=5]="Class";s[s.Method=6]="Method";s[s.Property=7]="Property";s[s.Field=8]="Field";s[s.Constructor=9]="Constructor";s[s.Enum=10]="Enum";s[s.Interface=11]="Interface";s[s.Function=12]="Function";s[s.Variable=13]="Variable";s[s.Constant=14]="Constant";s[s.String=15]="String";s[s.Number=16]="Number";s[s.Boolean=17]="Boolean";s[s.Array=18]="Array";s[s.Object=19]="Object";s[s.Key=20]="Key";s[s.Null=21]="Null";s[s.EnumMember=22]="EnumMember";s[s.Struct=23]="Struct";s[s.Event=24]="Event";s[s.Operator=25]="Operator";s[s.TypeParameter=26]="TypeParameter"})(zr||={});var Hr;((c)=>{c[c.Text=1]="Text";c[c.Method=2]="Method";c[c.Function=3]="Function";c[c.Constructor=4]="Constructor";c[c.Field=5]="Field";c[c.Variable=6]="Variable";c[c.Class=7]="Class";c[c.Interface=8]="Interface";c[c.Module=9]="Module";c[c.Property=10]="Property";c[c.Unit=11]="Unit";c[c.Value=12]="Value";c[c.Enum=13]="Enum";c[c.Keyword=14]="Keyword";c[c.Snippet=15]="Snippet";c[c.Color=16]="Color";c[c.File=17]="File";c[c.Reference=18]="Reference";c[c.Folder=19]="Folder";c[c.EnumMember=20]="EnumMember";c[c.Constant=21]="Constant";c[c.Struct=22]="Struct";c[c.Event=23]="Event";c[c.Operator=24]="Operator";c[c.TypeParameter=25]="TypeParameter"})(Hr||={});var Kr;((n)=>{n[n.Text=1]="Text";n[n.Read=2]="Read";n[n.Write=3]="Write"})(Kr||={});class fn{documents=new Map;rootUri=null;config={};messageId=0;watchers=new Map;initialize(t){return this.rootUri=t.rootUri,{capabilities:{textDocumentSync:1,hoverProvider:!0,completionProvider:{triggerCharacters:[".",":","<",'"',"'","/"],resolveProvider:!0},definitionProvider:!0,referencesProvider:!0,renameProvider:{prepareProvider:!0},documentSymbolProvider:!0,workspaceSymbolProvider:!0,codeActionProvider:{codeActionKinds:["quickfix","refactor","source"]},signatureHelpProvider:{triggerCharacters:["(",","],retriggerCharacters:[","]},documentHighlightProvider:!0,documentFormattingProvider:!0,diagnosticProvider:{interFileDependencies:!0,workspaceDiagnostics:!0}}}}didOpen(t){let{uri:e,text:i,version:n}=t.textDocument;this.updateDocument(e,i,n)}didChange(t){let{uri:e,version:i}=t.textDocument,n=t.contentChanges[0]?.text||"";this.updateDocument(e,n,i)}didClose(t){let e=t.textDocument.uri;if(this.documents.delete(e),this.watchers.get(e))w(this.uriToPath(e)),this.watchers.delete(e)}updateDocument(t,e,i){let n=this.uriToPath(t),o=r(e,n,!0);this.documents.set(t,{content:e,version:i,declarations:o})}getDiagnostics(t){let e=this.documents.get(t);if(!e)return[];let i=[];for(let n of e.declarations){if(n.isExported&&n.kind==="variable"&&!n.typeAnnotation)i.push({range:this.getDeclarationRange(n,e.content),severity:2,code:"missing-type",source:"dtsx",message:`Exported variable '${n.name}' should have an explicit type annotation for better declaration generation`});if(n.typeAnnotation==="any"||n.returnType==="any")i.push({range:this.getDeclarationRange(n,e.content),severity:3,code:"any-type",source:"dtsx",message:"Consider using a more specific type instead of 'any'"});if(n.kind==="function"&&n.isExported&&!n.returnType)i.push({range:this.getDeclarationRange(n,e.content),severity:3,code:"missing-return-type",source:"dtsx",message:`Function '${n.name}' should have an explicit return type for better declaration generation`})}return i}hover(t){let e=this.documents.get(t.textDocument.uri);if(!e)return null;let{line:i,character:n}=t.position,a=e.content.split(`
2
+ import{r}from"./chunk-c6bfdmfy.js";import{l}from"./chunk-h12vphnz.js";import{existsSync as P,readFileSync as b,unwatchFile as w}from"fs";var zr;((o)=>{o[o.Error=1]="Error";o[o.Warning=2]="Warning";o[o.Information=3]="Information";o[o.Hint=4]="Hint"})(zr||={});var Ur;((s)=>{s[s.File=1]="File";s[s.Module=2]="Module";s[s.Namespace=3]="Namespace";s[s.Package=4]="Package";s[s.Class=5]="Class";s[s.Method=6]="Method";s[s.Property=7]="Property";s[s.Field=8]="Field";s[s.Constructor=9]="Constructor";s[s.Enum=10]="Enum";s[s.Interface=11]="Interface";s[s.Function=12]="Function";s[s.Variable=13]="Variable";s[s.Constant=14]="Constant";s[s.String=15]="String";s[s.Number=16]="Number";s[s.Boolean=17]="Boolean";s[s.Array=18]="Array";s[s.Object=19]="Object";s[s.Key=20]="Key";s[s.Null=21]="Null";s[s.EnumMember=22]="EnumMember";s[s.Struct=23]="Struct";s[s.Event=24]="Event";s[s.Operator=25]="Operator";s[s.TypeParameter=26]="TypeParameter"})(Ur||={});var Hr;((c)=>{c[c.Text=1]="Text";c[c.Method=2]="Method";c[c.Function=3]="Function";c[c.Constructor=4]="Constructor";c[c.Field=5]="Field";c[c.Variable=6]="Variable";c[c.Class=7]="Class";c[c.Interface=8]="Interface";c[c.Module=9]="Module";c[c.Property=10]="Property";c[c.Unit=11]="Unit";c[c.Value=12]="Value";c[c.Enum=13]="Enum";c[c.Keyword=14]="Keyword";c[c.Snippet=15]="Snippet";c[c.Color=16]="Color";c[c.File=17]="File";c[c.Reference=18]="Reference";c[c.Folder=19]="Folder";c[c.EnumMember=20]="EnumMember";c[c.Constant=21]="Constant";c[c.Struct=22]="Struct";c[c.Event=23]="Event";c[c.Operator=24]="Operator";c[c.TypeParameter=25]="TypeParameter"})(Hr||={});var Kr;((n)=>{n[n.Text=1]="Text";n[n.Read=2]="Read";n[n.Write=3]="Write"})(Kr||={});class fn{documents=new Map;rootUri=null;config={};messageId=0;watchers=new Map;initialize(t){return this.rootUri=t.rootUri,{capabilities:{textDocumentSync:1,hoverProvider:!0,completionProvider:{triggerCharacters:[".",":","<",'"',"'","/"],resolveProvider:!0},definitionProvider:!0,referencesProvider:!0,renameProvider:{prepareProvider:!0},documentSymbolProvider:!0,workspaceSymbolProvider:!0,codeActionProvider:{codeActionKinds:["quickfix","refactor","source"]},signatureHelpProvider:{triggerCharacters:["(",","],retriggerCharacters:[","]},documentHighlightProvider:!0,documentFormattingProvider:!0,diagnosticProvider:{interFileDependencies:!0,workspaceDiagnostics:!0}}}}didOpen(t){let{uri:e,text:i,version:n}=t.textDocument;this.updateDocument(e,i,n)}didChange(t){let{uri:e,version:i}=t.textDocument,n=t.contentChanges[0]?.text||"";this.updateDocument(e,n,i)}didClose(t){let e=t.textDocument.uri;if(this.documents.delete(e),this.watchers.get(e))w(this.uriToPath(e)),this.watchers.delete(e)}updateDocument(t,e,i){let n=this.uriToPath(t),o=r(e,n,!0);this.documents.set(t,{content:e,version:i,declarations:o})}getDiagnostics(t){let e=this.documents.get(t);if(!e)return[];let i=[];for(let n of e.declarations){if(n.isExported&&n.kind==="variable"&&!n.typeAnnotation)i.push({range:this.getDeclarationRange(n,e.content),severity:2,code:"missing-type",source:"dtsx",message:`Exported variable '${n.name}' should have an explicit type annotation for better declaration generation`});if(n.typeAnnotation==="any"||n.returnType==="any")i.push({range:this.getDeclarationRange(n,e.content),severity:3,code:"any-type",source:"dtsx",message:"Consider using a more specific type instead of 'any'"});if(n.kind==="function"&&n.isExported&&!n.returnType)i.push({range:this.getDeclarationRange(n,e.content),severity:3,code:"missing-return-type",source:"dtsx",message:`Function '${n.name}' should have an explicit return type for better declaration generation`})}return i}hover(t){let e=this.documents.get(t.textDocument.uri);if(!e)return null;let{line:i,character:n}=t.position,a=e.content.split(`
3
3
  `)[i]||"",u=a.slice(0,n).match(/[\w$]+$/),d=a.slice(n).match(/^[\w$]+/);if(!u&&!d)return null;let g=(u?.[0]||"")+(d?.[0]||""),f=e.declarations.find((x)=>x.name===g);if(!f)return null;let m=`\`\`\`typescript
4
4
  ${this.buildSignature(f)}
5
5
  \`\`\``;if(f.leadingComments&&f.leadingComments.length>0){let v=f.leadingComments.join(`
@@ -18,5 +18,5 @@ ${v[1].trim()}`}return{contents:{kind:"markdown",value:m}}}completion(t){let e=t
18
18
  \r
19
19
  `);if(n===-1)break;let a=e.slice(0,n).match(/Content-Length:\s*(\d+)/i);if(!a){e=e.slice(n+4);continue}let u=Number.parseInt(a[1],10),d=n+4,g=d+u;if(e.length<g)break;let f=e.slice(d,g);e=e.slice(g);try{let p=JSON.parse(f),m=t.handleMessage(p);if(m){let x=JSON.stringify(m),v=Buffer.byteLength(x,"utf8");process.stdout.write(`Content-Length: ${v}\r
20
20
  \r
21
- ${x}`)}}catch(p){console.error("Error parsing LSP message:",p)}}})}function Us(t,e){return(i)=>{if(!P(i))return;let n=b(i,"utf-8"),o=`file://${i}`;t.didOpen({textDocument:{uri:o,languageId:"typescript",version:1,text:n}});let a=t.getDiagnostics(o);e(o,a)}}
22
- export{Ur,zr,Hr,Kr,fn,Vs,Us};
21
+ ${x}`)}}catch(p){console.error("Error parsing LSP message:",p)}}})}function zs(t,e){return(i)=>{if(!P(i))return;let n=b(i,"utf-8"),o=`file://${i}`;t.didOpen({textDocument:{uri:o,languageId:"typescript",version:1,text:n}});let a=t.getDiagnostics(o);e(o,a)}}
22
+ export{zr,Ur,Hr,Kr,fn,Vs,zs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{e}from"./chunk-qmg1535a.js";import{existsSync as h}from"fs";import{cpus as u}from"os";import{resolve as l}from"path";import{fileURLToPath as k}from"url";import{Worker as c}from"worker_threads";var __dirname="/home/runner/work/dtsx/dtsx/packages/dtsx/src",a;function f(){if(a!==void 0)return a;a=null;for(let t of["./worker-thread.js","./worker-thread.ts","./src/worker-thread.js","./src/worker-thread.ts"]){let r=new URL(t,import.meta.url);try{if(h(k(r))){a=r;break}}catch{}}return a}class Jt{workers=[];taskQueue=[];config;stats={totalTasks:0,completedTasks:0,failedTasks:0,averageDuration:0,activeWorkers:0,idleWorkers:0};isShuttingDown=!1;idleCheckInterval=null;constructor(t={}){let r=t.maxWorkers??Math.max(1,u().length-1);this.config={maxWorkers:r,taskTimeout:t.taskTimeout??30000,recycleAfter:t.recycleAfter??100,idleTimeout:t.idleTimeout??1e4,initialWorkers:t.initialWorkers??Math.min(2,r)}}async init(){let t=Math.min(this.config.initialWorkers,this.config.maxWorkers);for(let r=0;r<t;r++)this.createWorker();if(this.config.idleTimeout>0){if(this.idleCheckInterval=setInterval(()=>{this.checkIdleWorkers()},5000),this.idleCheckInterval&&typeof this.idleCheckInterval==="object"&&"unref"in this.idleCheckInterval)this.idleCheckInterval.unref()}}createWorker(){let t=`
2
+ import{e}from"./chunk-3mp0jaa7.js";import{existsSync as h}from"fs";import{cpus as u}from"os";import{resolve as l}from"path";import{fileURLToPath as k}from"url";import{Worker as c}from"worker_threads";var __dirname="/home/runner/work/dtsx/dtsx/packages/dtsx/src",a;function f(){if(a!==void 0)return a;a=null;for(let t of["./worker-thread.js","./worker-thread.ts","./src/worker-thread.js","./src/worker-thread.ts"]){let r=new URL(t,import.meta.url);try{if(h(k(r))){a=r;break}}catch{}}return a}class Jt{workers=[];taskQueue=[];config;stats={totalTasks:0,completedTasks:0,failedTasks:0,averageDuration:0,activeWorkers:0,idleWorkers:0};isShuttingDown=!1;idleCheckInterval=null;constructor(t={}){let r=t.maxWorkers??Math.max(1,u().length-1);this.config={maxWorkers:r,taskTimeout:t.taskTimeout??30000,recycleAfter:t.recycleAfter??100,idleTimeout:t.idleTimeout??1e4,initialWorkers:t.initialWorkers??Math.min(2,r)}}async init(){let t=Math.min(this.config.initialWorkers,this.config.maxWorkers);for(let r=0;r<t;r++)this.createWorker();if(this.config.idleTimeout>0){if(this.idleCheckInterval=setInterval(()=>{this.checkIdleWorkers()},5000),this.idleCheckInterval&&typeof this.idleCheckInterval==="object"&&"unref"in this.idleCheckInterval)this.idleCheckInterval.unref()}}createWorker(){let t=`
3
3
  const { parentPort } = require('worker_threads');
4
4
  const bun = typeof Bun !== 'undefined' ? Bun : null;
5
5
  const fs = bun ? null : require('node:fs');
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{j}from"./chunk-yapmefw7.js";import{P}from"./chunk-jtq24yb8.js";import{Pe,De}from"./chunk-0nw1w523.js";import{createHash as x}from"crypto";import{readFile as d}from"fs/promises";import{resolve as m}from"path";async function Nn(g){let e={...j,...g},n=e.moduleSpecifierMode??"preserve";if(n!=="node"&&n!=="preserve")throw Error("moduleSpecifierMode must be preserve or node");if(e.plugins?.length)throw Error("Native project planning does not support generation plugins");let o=await Pe(e),l=[];for(let r of o.files){let s=await d(r),a=s.toString("utf8");if(!Buffer.from(a,"utf8").equals(s))throw Error(`Native declaration source must be valid UTF-8: ${r}`);let u=o.outputBySource.get(r),v=De(r,e,o.resolver),i=[],S=new Set(P(a,{includeImports:!0}).map((t)=>t.specifier));for(let t of S){let p=v(t);if(p.kind!=="local")continue;let{resolvedSource:h,declarationOutput:w,emittedSpecifier:y}=p;i.push({specifier:t,resolvedSource:h,declarationOutput:w,emittedSpecifier:y})}let c={version:1,moduleSpecifierMode:n,sourceFile:r,outputFile:u,sourceHash:x("sha256").update(s).digest("hex"),rewrites:i};if(!e.isolatedDeclarations&&i.length)c.inferenceSources=await Promise.all(i.map(async(t)=>({specifier:t.specifier,source:await d(t.resolvedSource,"utf8")})));let f=o.augmentationImports.get(r);if(f?.size)c.augmentationImports=[...f];l.push(Object.freeze({sourceFile:r,outputFile:u,source:a,context:c}))}return Object.freeze({version:1,rootPath:m(e.cwd,e.root),outdirPath:m(e.cwd,e.outdir),files:Object.freeze(l)})}
2
+ import{j}from"./chunk-m7jndt3v.js";import{P}from"./chunk-vvy85nm6.js";import{De,Pe}from"./chunk-ka9qyjzn.js";import{createHash as x}from"crypto";import{readFile as d}from"fs/promises";import{resolve as m}from"path";async function Nn(g){let e={...j,...g},n=e.moduleSpecifierMode??"preserve";if(n!=="node"&&n!=="preserve")throw Error("moduleSpecifierMode must be preserve or node");if(e.plugins?.length)throw Error("Native project planning does not support generation plugins");let o=await De(e),l=[];for(let r of o.files){let s=await d(r),a=s.toString("utf8");if(!Buffer.from(a,"utf8").equals(s))throw Error(`Native declaration source must be valid UTF-8: ${r}`);let u=o.outputBySource.get(r),v=Pe(r,e,o.resolver),i=[],S=new Set(P(a,{includeImports:!0}).map((t)=>t.specifier));for(let t of S){let p=v(t);if(p.kind!=="local")continue;let{resolvedSource:h,declarationOutput:w,emittedSpecifier:y}=p;i.push({specifier:t,resolvedSource:h,declarationOutput:w,emittedSpecifier:y})}let c={version:1,moduleSpecifierMode:n,sourceFile:r,outputFile:u,sourceHash:x("sha256").update(s).digest("hex"),rewrites:i};if(!e.isolatedDeclarations&&i.length)c.inferenceSources=await Promise.all(i.map(async(t)=>({specifier:t.specifier,source:await d(t.resolvedSource,"utf8")})));let f=o.augmentationImports.get(r);if(f?.size)c.augmentationImports=[...f];l.push(Object.freeze({sourceFile:r,outputFile:u,source:a,context:c}))}return Object.freeze({version:1,rootPath:m(e.cwd,e.root),outdirPath:m(e.cwd,e.outdir),files:Object.freeze(l)})}
3
3
  export{Nn};