@dtsx/dtsx 0.11.55 → 0.11.57

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 (187) hide show
  1. package/dist/bin/cli.js +1 -1
  2. package/dist/{chunk-g25sbqbw.js → chunk-14zb70ca.js} +3 -3
  3. package/dist/{chunk-tgaear7n.js → chunk-1b003vaa.js} +6 -6
  4. package/dist/{chunk-2qbj76ap.js → chunk-31t6c3q1.js} +19 -19
  5. package/dist/{chunk-6b6rt0yh.js → chunk-3phg2e1n.js} +2 -2
  6. package/dist/{chunk-6c8nk9rm.js → chunk-4rchw3mn.js} +4 -4
  7. package/dist/{chunk-kg0srf55.js → chunk-4tk9w4ms.js} +1 -1
  8. package/dist/chunk-59q0p96t.js +3 -0
  9. package/dist/{chunk-hgg4aqvf.js → chunk-5af6meh8.js} +2 -2
  10. package/dist/{chunk-9bj73ygx.js → chunk-5egg62em.js} +3 -3
  11. package/dist/{chunk-h7ebvy8j.js → chunk-5ncggctz.js} +2 -2
  12. package/dist/{chunk-spdw3tc0.js → chunk-5t69y2qj.js} +2 -2
  13. package/dist/{chunk-mzxxgnp8.js → chunk-5zcampnz.js} +2 -2
  14. package/dist/{chunk-8r7rmcz7.js → chunk-6bsft59m.js} +5 -5
  15. package/dist/chunk-6m4fpfzj.js +31 -0
  16. package/dist/{chunk-msa98cgm.js → chunk-6mg1pbfj.js} +10 -10
  17. package/dist/chunk-6rxhkcx0.js +3 -0
  18. package/dist/{chunk-yxcyqezk.js → chunk-6vhzmpy0.js} +4 -4
  19. package/dist/{chunk-nnayqrp5.js → chunk-6yvk3q1e.js} +2 -2
  20. package/dist/{chunk-bt2n0b75.js → chunk-7061vwkq.js} +2 -2
  21. package/dist/chunk-72txgcxc.js +3 -0
  22. package/dist/{chunk-heqx5083.js → chunk-8j311f4n.js} +4 -4
  23. package/dist/{chunk-gwa4hmfa.js → chunk-8z4tvwyd.js} +2 -2
  24. package/dist/{chunk-hj7gs32r.js → chunk-93jzvstf.js} +2 -2
  25. package/dist/{chunk-hkcqbex1.js → chunk-9hz32qxh.js} +2 -2
  26. package/dist/{chunk-c726s7aj.js → chunk-a018gbxq.js} +4 -4
  27. package/dist/{chunk-pnfjhm01.js → chunk-aa3k6rcj.js} +2 -2
  28. package/dist/{chunk-njknd1pt.js → chunk-abe0mchv.js} +4 -4
  29. package/dist/{chunk-hbmnkmzb.js → chunk-b1wmavr8.js} +3 -3
  30. package/dist/{chunk-btcj8fgc.js → chunk-c094c8jt.js} +3 -3
  31. package/dist/{chunk-qhkxctek.js → chunk-ctpxwa1v.js} +2 -2
  32. package/dist/{chunk-x6ddycvm.js → chunk-dc6thsdb.js} +2 -2
  33. package/dist/{chunk-k8tnz2qd.js → chunk-ered54kd.js} +8 -8
  34. package/dist/{chunk-38r6thfe.js → chunk-f27fd50q.js} +2 -2
  35. package/dist/{chunk-eskywkxz.js → chunk-fcx6r0m1.js} +4 -4
  36. package/dist/{chunk-mph001z4.js → chunk-fnncnk59.js} +4 -4
  37. package/dist/{chunk-ekf33t9z.js → chunk-fpbcgcwd.js} +3 -3
  38. package/dist/chunk-fxx9zbtq.js +3 -0
  39. package/dist/{chunk-555w3kcr.js → chunk-g2s10ehd.js} +2 -2
  40. package/dist/{chunk-srm0ddsk.js → chunk-gzjccs8y.js} +9 -9
  41. package/dist/{chunk-cgqg1br8.js → chunk-h3m1vfa2.js} +3 -3
  42. package/dist/{chunk-b6994asf.js → chunk-hnjv8zsq.js} +2 -2
  43. package/dist/{chunk-6j6dvj8a.js → chunk-hqytpz18.js} +2 -2
  44. package/dist/{chunk-vk5r6pgx.js → chunk-jb43rwce.js} +2 -2
  45. package/dist/chunk-jhjj15ey.js +38 -0
  46. package/dist/{chunk-fpa2ea8k.js → chunk-k2axmtyh.js} +5 -5
  47. package/dist/{chunk-kkshxyex.js → chunk-kqyqbrcv.js} +3 -3
  48. package/dist/{chunk-81jrzxr6.js → chunk-mzpbqdd2.js} +4 -4
  49. package/dist/{chunk-ewgs91y1.js → chunk-n8044s0h.js} +2 -2
  50. package/dist/{chunk-4rsk49xj.js → chunk-naweq349.js} +2 -2
  51. package/dist/{chunk-v22xpr7j.js → chunk-p023fhce.js} +3 -3
  52. package/dist/{chunk-7dmn623d.js → chunk-ppybvpk4.js} +3 -3
  53. package/dist/{chunk-1mzxq1rg.js → chunk-q8dtn1qf.js} +2 -2
  54. package/dist/{chunk-mqv5m22t.js → chunk-qg691xj0.js} +4 -4
  55. package/dist/{chunk-j7rpp55s.js → chunk-qhbdh4gy.js} +3 -3
  56. package/dist/{chunk-1t77gtcx.js → chunk-qhsgmwcm.js} +2 -2
  57. package/dist/{chunk-dak0dhnx.js → chunk-qxkvzznc.js} +2 -2
  58. package/dist/chunk-r7qq9579.js +7 -0
  59. package/dist/{chunk-qbk49jz5.js → chunk-rb602c8k.js} +11 -11
  60. package/dist/{chunk-tw99ftp1.js → chunk-rcmdt2gs.js} +2 -2
  61. package/dist/{chunk-7pw9ayve.js → chunk-rzjj16rb.js} +3 -3
  62. package/dist/{chunk-9mdgtq38.js → chunk-s28gyv8z.js} +2 -2
  63. package/dist/{chunk-qt9gjs57.js → chunk-s3mxfatw.js} +2 -2
  64. package/dist/{chunk-djbck65n.js → chunk-s5rja20d.js} +2 -2
  65. package/dist/{chunk-62428w6e.js → chunk-s9937pks.js} +6 -6
  66. package/dist/{chunk-5bdwrsqt.js → chunk-srbye4cm.js} +4 -4
  67. package/dist/{chunk-8vvryt8p.js → chunk-ss3na6s0.js} +2 -2
  68. package/dist/chunk-szxyqpfq.js +3 -0
  69. package/dist/{chunk-9wwsqemm.js → chunk-try1hmvs.js} +2 -2
  70. package/dist/{chunk-r46rw8gr.js → chunk-vdt9x6h8.js} +5 -5
  71. package/dist/chunk-vej5fnnp.js +3 -0
  72. package/dist/{chunk-f5jc2v3k.js → chunk-vs6ay4t3.js} +2 -2
  73. package/dist/{chunk-20jq5v1p.js → chunk-w482p1x8.js} +6 -6
  74. package/dist/{chunk-h6ddkhyq.js → chunk-wmzg12wb.js} +2 -2
  75. package/dist/{chunk-g9emajpc.js → chunk-xvp60m78.js} +2 -2
  76. package/dist/chunk-y18th8yp.js +3 -0
  77. package/dist/{chunk-6r01zgys.js → chunk-yd8rwwzf.js} +2 -2
  78. package/dist/{chunk-4cr1q0yf.js → chunk-ynpxjf6d.js} +2 -2
  79. package/dist/{chunk-nmht3krt.js → chunk-ysgfcqvf.js} +4 -4
  80. package/dist/{chunk-7rdazac9.js → chunk-ywzc3ym6.js} +20 -20
  81. package/dist/{chunk-rzcnab8j.js → chunk-z03w2v8h.js} +2 -2
  82. package/dist/{chunk-0d5nemtn.js → chunk-zddtg858.js} +2 -2
  83. package/dist/{chunk-6ekemc3h.js → chunk-zf6qpv30.js} +2 -2
  84. package/dist/src/augmentation-graph.js +1 -1
  85. package/dist/src/binding-patterns.js +1 -1
  86. package/dist/src/branded-types.js +1 -1
  87. package/dist/src/bundle-linker.js +1 -1
  88. package/dist/src/bundler.js +1 -1
  89. package/dist/src/cache.js +1 -1
  90. package/dist/src/call-signatures.js +1 -1
  91. package/dist/src/circular.js +1 -1
  92. package/dist/src/compat.js +1 -1
  93. package/dist/src/computed-keys.js +1 -1
  94. package/dist/src/config.js +1 -1
  95. package/dist/src/dangling-refs.js +1 -1
  96. package/dist/src/declaration-project.js +1 -1
  97. package/dist/src/declaration-publication.js +1 -1
  98. package/dist/src/declaration-references.js +1 -1
  99. package/dist/src/diff.js +1 -1
  100. package/dist/src/docs.js +1 -1
  101. package/dist/src/enum-declarations.js +1 -1
  102. package/dist/src/errors.js +1 -1
  103. package/dist/src/extractor/directives.js +1 -1
  104. package/dist/src/extractor/extract.js +1 -1
  105. package/dist/src/extractor/scanner.js +1 -1
  106. package/dist/src/extractor.js +1 -1
  107. package/dist/src/formats.js +1 -1
  108. package/dist/src/formatter.js +1 -1
  109. package/dist/src/function-properties.js +1 -1
  110. package/dist/src/generator.js +1 -1
  111. package/dist/src/global-types.js +1 -1
  112. package/dist/src/import-sorter.js +1 -1
  113. package/dist/src/incremental.js +1 -1
  114. package/dist/src/index.js +1 -1
  115. package/dist/src/inferred-imports.js +1 -1
  116. package/dist/src/initializer-type-spans.js +1 -1
  117. package/dist/src/json-config.js +1 -1
  118. package/dist/src/lexical.js +1 -1
  119. package/dist/src/logger.js +1 -1
  120. package/dist/src/lsp.js +1 -1
  121. package/dist/src/memory.js +1 -1
  122. package/dist/src/merger.js +1 -1
  123. package/dist/src/module-graph.js +1 -1
  124. package/dist/src/module-references.js +1 -1
  125. package/dist/src/native-checker.js +1 -1
  126. package/dist/src/native-engine.js +1 -1
  127. package/dist/src/native-extractor.js +1 -1
  128. package/dist/src/native-generation.js +1 -1
  129. package/dist/src/native-project.js +1 -1
  130. package/dist/src/numeric-literals.js +1 -1
  131. package/dist/src/optimizer.js +1 -1
  132. package/dist/src/output-normalizer.js +1 -1
  133. package/dist/src/parallel-processor.js +1 -1
  134. package/dist/src/parameters.js +1 -1
  135. package/dist/src/parser.js +1 -1
  136. package/dist/src/plugins/bun.js +1 -1
  137. package/dist/src/plugins/esbuild.js +1 -1
  138. package/dist/src/plugins/index.js +1 -1
  139. package/dist/src/plugins/tsdown.js +1 -1
  140. package/dist/src/plugins/tsup.js +1 -1
  141. package/dist/src/plugins/vite.js +1 -1
  142. package/dist/src/plugins/webpack.js +1 -1
  143. package/dist/src/plugins.js +1 -1
  144. package/dist/src/process-source.js +1 -1
  145. package/dist/src/processor/cache.js +1 -1
  146. package/dist/src/processor/declarations.js +1 -1
  147. package/dist/src/processor/import-usage.js +1 -1
  148. package/dist/src/processor/imports.js +1 -1
  149. package/dist/src/processor/index.js +1 -1
  150. package/dist/src/processor/type-inference.js +1 -1
  151. package/dist/src/processor.js +1 -1
  152. package/dist/src/profiling.js +1 -1
  153. package/dist/src/return-type-scope.js +1 -1
  154. package/dist/src/security.js +1 -1
  155. package/dist/src/source-cache.js +1 -1
  156. package/dist/src/sourcemap.js +1 -1
  157. package/dist/src/stx.js +1 -1
  158. package/dist/src/syntax-validator.js +1 -1
  159. package/dist/src/tracking.js +1 -1
  160. package/dist/src/transformers.js +1 -1
  161. package/dist/src/tree-shaker.js +1 -1
  162. package/dist/src/tsconfig.js +1 -1
  163. package/dist/src/type-mappings.js +1 -1
  164. package/dist/src/utils.js +1 -1
  165. package/dist/src/value-inference.js +1 -1
  166. package/dist/src/vue.js +1 -1
  167. package/dist/src/watcher.js +1 -1
  168. package/dist/src/worker-thread.js +1 -1
  169. package/dist/src/worker.js +1 -1
  170. package/dist/src/workspace.js +1 -1
  171. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  172. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  173. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  174. package/native/linux-arm64/libzig-dtsx.so +0 -0
  175. package/native/linux-x64/libzig-dtsx.so +0 -0
  176. package/native/windows-x64/zig-dtsx.dll +0 -0
  177. package/package.json +1 -1
  178. package/dist/chunk-0a1xppye.js +0 -3
  179. package/dist/chunk-5tn8854w.js +0 -31
  180. package/dist/chunk-5yx2x4v4.js +0 -3
  181. package/dist/chunk-cfjd81h8.js +0 -3
  182. package/dist/chunk-daasy0pw.js +0 -3
  183. package/dist/chunk-h28vzayq.js +0 -3
  184. package/dist/chunk-sjbm1trn.js +0 -3
  185. package/dist/chunk-t5nmnzy6.js +0 -7
  186. package/dist/chunk-vt5hr8vs.js +0 -3
  187. package/dist/chunk-wq5r1ms9.js +0 -38
@@ -0,0 +1,38 @@
1
+ // @bun
2
+ import{a,i,y,g,xe,Ue}from"./chunk-h3m1vfa2.js";import{t,m,d,ze,b}from"./chunk-r7qq9579.js";import{ir}from"./chunk-8z4tvwyd.js";import{Fe}from"./chunk-5zcampnz.js";import{or}from"./chunk-9hz32qxh.js";import{U,nr}from"./chunk-ynpxjf6d.js";import{sr}from"./chunk-vej5fnnp.js";import{h,S,q}from"./chunk-jb43rwce.js";import{_}from"./chunk-fxx9zbtq.js";import{je,we,Ge}from"./chunk-yd8rwwzf.js";import{n,B,W,Kt,rr,qt,H,K}from"./chunk-ywzc3ym6.js";import{qn}from"./chunk-g2s10ehd.js";import{x}from"./chunk-vdt9x6h8.js";import{Gt,Jn}from"./chunk-5ncggctz.js";function Li(P,G,V,Y,fe=""){let de=new Map,f={start:0,end:P.length,header:0,name:"",children:[],results:new Map},ne=t(P),me=[],T=[],Xe=[],et=new Map;for(let ee=0;ee<ne.length;ee++){let pe=ne[ee];if(pe.kind!=="punctuation")continue;let Ae=P.slice(pe.start,pe.end);if(Ae==="(")Xe.push(ee);else if(Ae===")"){let e=Xe.pop();if(e!==void 0)et.set(ee,e)}else if(Ae==="{")T.push(ee);else if(Ae==="}"){let e=T.pop();if(e===void 0)continue;let X=ne[e].start,oe=e-1,N=oe>=0?P.slice(ne[oe].start,ne[oe].end):"";if(N===")"){let ae=et.get(oe);if(ae!==void 0&&ae>0&&["if","for","while","switch","catch","with"].includes(P.slice(ne[ae-1].start,ne[ae-1].end)))X=ne[ae-1].start}else if(["else","try","finally","do"].includes(N))X=ne[oe].start;me.push({open:ne[e].start,close:pe.start,header:X})}}let Q=0,Ce=(ee,pe=new Set)=>{let Ae=new Set(pe),e=t(P.slice(ee.start,ee.end)),X=0;for(let he=0;he+1<e.length;he++){let Je=P.slice(ee.start+e[he].start,ee.start+e[he].end);if(Je==="{")X++;else if(Je==="}")X--;else if(!X&&["type","interface"].includes(Je))Ae.add(P.slice(ee.start+e[he+1].start,ee.start+e[he+1].end))}let oe="",N=ee.start,ae=[...ee.results].map(([he,Je])=>({type:he,name:Je}));for(let he of ee.children.sort((Je,ct)=>Je.header-ct.header)){let Je=Ce(he,Ae);oe+=P.slice(N,he.header)+`
3
+ declare namespace ${he.name} {
4
+ ${Je.text}
5
+ }
6
+ `,N=he.end+1;for(let ct of Je.exports)ae.push({type:`${he.name}.${ct.name}`,name:ct.name})}oe+=`${P.slice(N,ee.end)}
7
+ ;
8
+ ${ae.map((he)=>`export type ${he.name} = ${he.type};`).join(`
9
+ `)}`;let Ee=F(oe,G,!1);for(let he of ae)Ae.add(he.name);let ge=fe?Qt(fe).map((he,Je)=>[he,`${Le}_capture_${Je}`]):[],Qe=Ee.map((he)=>fe&&["type","interface"].includes(he.kind)?jn(he,fe,ge,Ae):(he.kind==="variable"?x(he,!1):he.text).replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
10
+ `);return{declarations:Ee,text:Qe,exports:ae}},Le;return{resolve(ee,pe){Le??=V();let Ae=f;for(let X of me.filter((oe)=>oe.open<pe&&pe<oe.close).sort((oe,N)=>oe.open-N.open)){let oe=Ae.children.find((N)=>N.start===X.open+1);if(!oe)oe={start:X.open+1,end:X.close,header:X.header,name:`${Le}_scope_${Q++}`,children:[],results:new Map},Ae.children.push(oe);Ae=oe}let e=Ae.results.get(ee);if(!e)e=`${Le}_result_${de.size}`,Ae.results.set(ee,e),de.set(e,ee);return`${Le}.${e}`},finish(ee){if(!Le)return ee;let pe=Ce(f),Ae=pe.declarations,e=new Set(de.keys());if(Ae.every((oe)=>e.has(oe.name))){let oe=new Map(de),N=t(ee),ae="",Ee=0;for(let ge=0;ge+2<N.length;ge++){if(ee.slice(N[ge].start,N[ge].end)!==Le||ee.slice(N[ge+1].start,N[ge+1].end)!==".")continue;let Qe=oe.get(ee.slice(N[ge+2].start,N[ge+2].end));if(!Qe)continue;ae+=ee.slice(Ee,N[ge].start)+`(${Qe})`,Ee=N[ge+2].end,ge+=2}return ae+ee.slice(Ee)}if(fe){let oe=Qt(fe).join(", "),N=t(ee),ae="",Ee=0;for(let ge=0;ge+2<N.length;ge++){if(ee.slice(N[ge].start,N[ge].end)!==Le||ee.slice(N[ge+1].start,N[ge+1].end)!=="."||!e.has(ee.slice(N[ge+2].start,N[ge+2].end)))continue;ae+=`${ee.slice(Ee,N[ge+2].end)}<${oe}>`,Ee=N[ge+2].end,ge+=2}ee=ae+ee.slice(Ee)}let X=pe.text;return Y({kind:"module",name:Le,text:`declare namespace ${Le} {
11
+ ${X}
12
+ }`,moduleForm:"namespace",isExported:!1}),ee}}}function Qt(P){let G=t(P),V=[],Y=0,fe=0,de=!1;for(let f of G){let ne=P.slice(f.start,f.end);if(ne==="<"){if(Y++,Y===1)de=!0}else if(ne===">"&&P[f.start-1]!=="=")Y--;else if(["(","[","{"].includes(ne))fe++;else if([")","]","}"].includes(ne))fe--;else if(ne===","&&Y===1&&!fe)de=!0;else if(de&&f.kind==="word"&&!["const","in","out"].includes(ne))V.push(ne),de=!1}return V}function jn(P,G,V,Y){let fe=new Set(Qt(P.generics||"")),de=(Ce,Le,ee)=>{let pe=t(Ce),Ae="",e=0;for(let X=0;X<pe.length;X++){let oe=pe[X],N=Ce.slice(oe.start,oe.end),ae=pe[X+1]&&Ce.slice(pe[X+1].start,pe[X+1].end),Ee=pe[X+2]&&Ce.slice(pe[X+2].start,pe[X+2].end),ge=pe[X-1]&&Ce.slice(pe[X-1].start,pe[X-1].end);if(oe.kind!=="word"||ae===":"||ae==="?"&&Ee===":")continue;let Qe=!ee.has(N)&&ge!=="."&&V.find(([he])=>he===N)?.[1];if(Qe)Ae+=Ce.slice(e,oe.start)+Qe,e=oe.end;else if(Le&&Y.has(N)&&!ee.has(N)){let he=V.map(([,Je])=>Je).join(", ");Ae+=`${Ce.slice(e,oe.end)}<${he}${ae==="<"?", ":">"}`,e=ae==="<"?pe[++X].end:oe.end}}return Ae+Ce.slice(e)},f=t(P.text),ne=f.findIndex((Ce)=>["type","interface"].includes(P.text.slice(Ce.start,Ce.end))),me=f[ne+1],T=P.generics||"",Xe=T?P.text.indexOf(T,me.end)+T.length:me.end,et=de(Fn(G),!1,new Set),Q=T?`, ${de(T.slice(1,-1),!0,fe)}`:"";return`${P.text.slice(0,me.end)}<${et}${Q}>${de(P.text.slice(Xe),!0,fe)}`.replace(/^export\s+/,"").replace(/^declare\s+/,"")}function Fn(P){let G=P.slice(1,-1),V=t(G),Y=0,fe=0,de=!1,f="";for(let ne=0;ne<V.length;ne++){let me=V[ne],T=G.slice(me.start,me.end);if(["(","[","{","<"].includes(T))Y++;else if([")","]","}"].includes(T)||T===">"&&G[me.start-1]!=="=")Y--;else if(!Y&&T==="const")f+=G.slice(fe,me.start),fe=me.end;else if(!Y&&T==="="&&G.slice(V[ne+1]?.start,V[ne+1]?.end)!==">")f+=G.slice(fe,me.start),de=!0;else if(!Y&&T===","&&de)fe=me.start,de=!1}return f+(de?"":G.slice(fe))}var Ve=32,Ke=9,Se=10,Oe=13,ie=47,ye=42,ke=39,ve=34,We=96,nt=92,j=123,se=125,le=40,be=41,Te=91,Me=93,$e=60,De=62,ce=59,it=58,Ie=61,st=44,At=46,Et=63,bn=35,Gn=64,Vn=36;function He(P){return P===Ve||P===Ke||P===Se||P===Oe}function Zt(P){if(P.length<2||P[0]!=="`"||P.at(-1)!=="`")return!1;for(let G=1;G<P.length-1;G++){let V=P[G];if(V==="\\"){G++;continue}if(V==="`"||V==="$"&&P[G+1]==="{")return!1}return!0}function Kn(P){let G=P.trim();if(G==="true"||G==="false")return!0;if(h(G)||S(G)||Zt(G))return!0;let V=G[0];if(V!=="'"&&V!=='"'||G.length<2||G.at(-1)!==V)return!1;for(let Y=1;Y<G.length-1;Y++){let fe=G[Y];if(fe==="\\"){Y++;continue}if(fe===V)return!1}return!0}function kn(P){let G=!0;for(let V=0;V<P.length;V++){let Y=P.charCodeAt(V);if(Y===At){if(G)return!1;G=!0}else if(G){if(!a(Y))return!1;G=!1}else if(!i(Y))return!1}return P.length>0&&!G}function xt(P,G,V){let Y=G+1;while(Y<P.length){let fe=P.charCodeAt(Y);if(fe===nt){Y+=2;continue}if(Y++,fe===V)break}return Y}function Un(P){if(P==="any"||P==="object"||P==="unknown")return!0;if(P.startsWith("Record<")||P.startsWith("Array<"))return!0;return P.charCodeAt(0)===j&&P.includes("[")&&P.includes("]:")}var Jt=["public","protected","private","readonly","override"];function Wa(P,G,V=!0,Y=!1){return Y?M(P,G,V):F(P,G,V)}function M(P,G,V=!0){return Xt(P,G,V,!0)}function F(P,G,V=!0,Y){return Xt(P,G,V,!1,!1,Y)}function jt(P,G,V=!0){return Xt(P,G,V,!0,!0)}function Xt(P,G,V,Y,fe=!1,de){let f=P,ne=V,me=Y,T=f.length,Xe=Ue(f),et=U(f),Q=[],Ce=new Map,Le=new Map;function ee(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=Ce.get(s);if(!r||!c||c.kind!=="variable"&&c.kind!=="function")Ce.set(s,o)}let pe=new Map,Ae=new Set,e=0,X,oe=0,N=[],ae=[],Ee=[],ge=[],Qe;function he(s,o=!1){let r=`__dtsx_constructor_field_${ge.length}__`;Qe??=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(Qe.has(r))r+="_";return ge.push({marker:r,initializer:s,classes:N.map((c)=>c.name),namespaces:[...Ee],binding:o}),r}function Je(s){let o=/^this\.([\w$]+)$/.exec(s);if(o){let w=N.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,...Ce.values()].filter((w)=>w.kind==="function"&&w.name===r[1]);if(u.length!==1||u[0].generics||Fe(f,r[1])!==1)return;return u[0].returnType}function ct(s){let o=s.trim(),r=Je(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_${oe++}`;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,G,ne),R=k.find((v)=>v.kind==="class");if(!R)throw Error("Cannot extract the class expression declaration");if(t(p.slice(R.end??p.length)).some((v)=>p.slice((R.end??0)+v.start,(R.end??0)+v.end)!==";"))return;let L=k.map((v)=>v.text.replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
13
+ `);return ee(l,{kind:"module",name:l,text:`declare namespace ${l} {
14
+ ${L}
15
+ }`,moduleForm:"namespace",isExported:!1,start:e,end:e}),`typeof ${l}.${A}`}function yt(s,o){let r=/^this\.([\w$]+)$/.exec(s);if(r)return N.at(-1)?.fields.get(`${o?"static:":""}${r[1]}`);return ct(s)}function Yt(s){let o=pe.get(s.name);if(o)o.push(s);else pe.set(s.name,[s]);ee(s.name,s)}if(e<T&&f.charCodeAt(e)===65279)e++;function _e(s,o){if(s<o){let r=f.charCodeAt(s),c=f.charCodeAt(o-1);if(r!==Ve&&r!==Ke&&r!==Se&&r!==Oe&&c!==Ve&&c!==Ke&&c!==Se&&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 en=/[\r\n]/g;function dt(s){return en.lastIndex=s,en.exec(f)?.index??T}function O(){if(e>=T)return;let s=f.charCodeAt(e);if(s!==Ve&&s!==Ke&&s!==Se&&s!==Oe&&s!==ie)return;while(e<T){let o=f.charCodeAt(e);if(o===Ve||o===Ke||o===Se||o===Oe){e++;continue}if(o===ie&&e+1<T){let r=f.charCodeAt(e+1);if(r===ie){e=dt(e+2);continue}if(r===ye){let c=f.indexOf("*/",e+2);e=c===-1?T:c+2;continue}}break}}function xn(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===ke||c===ve||c===We){r=xt(s,r,c),o=r;continue}if(c===nt){r+=2,o=Math.min(r,s.length);continue}if(c===ie&&s.charCodeAt(r+1)===ie){while(r<s.length&&s.charCodeAt(r)!==Se&&s.charCodeAt(r)!==Oe)r++;continue}if(c===ie&&s.charCodeAt(r+1)===ye){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 yn(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===nt){l++;continue}if(u===r)r=0;continue}if(u===ke||u===ve||u===We){r=u;continue}if(u===ie&&l+1<o){let w=s.charCodeAt(l+1);if(w===ie){c=l;while(c>0&&(s.charCodeAt(c-1)===Ve||s.charCodeAt(c-1)===Ke))c--;return s.slice(0,c)}if(w===ye){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)===Ve||s.charCodeAt(c-1)===Ke||s.charCodeAt(c-1)===Oe))c--;return c<o?s.slice(0,c):s}function rt(s){e++;let o=s===ke?"'":'"';while(e<T){let r=f.indexOf(o,e);if(r===-1){e=T;return}let c=0,l=r-1;while(l>=0&&f.charCodeAt(l)===nt)c++,l--;if(c%2===0){e=r+1;return}e=r+1}}function bt(){e++;let s=[];while(e<T){let o=f.charCodeAt(e);if(s.length===0){if(o===nt){e+=2;continue}if(o===We){e++;return}if(o===Vn&&e+1<T&&f.charCodeAt(e+1)===j){e+=2,s.push(0);continue}e++;continue}if(o===ke||o===ve){rt(o);continue}if(o===We){bt();continue}if(o===ie&&e+1<T){let r=f.charCodeAt(e+1);if(r===ie){e=dt(e+2);continue}if(r===ye){let c=f.indexOf("*/",e+2);e=c===-1?T:c+2;continue}if(tn()){nn();continue}e++;continue}if(o===j){s[s.length-1]++,e++;continue}if(o===se){let r=s[s.length-1];if(r===0){s.pop(),e++;continue}s[s.length-1]=r-1,e++;continue}e++}}let Rt=!1;function qe(){Rt=!1;let s=f.charCodeAt(e);if(s===ke||s===ve)return rt(s),!0;if(s===We)return bt(),!0;if(s===ie&&e+1<T){let o=f.charCodeAt(e+1);if(o===ie)return e=dt(e+2),!0;if(o===ye){let r=f.indexOf("*/",e+2);return Rt=dt(e+2)<(r===-1?T:r),e=r===-1?T:r+2,!0}if(tn())return nn(),!0}return!1}function tn(){return y(f,e)}function nn(){e=g(f,e)}function Re(){let s=e;while(e<T&&i(f.charCodeAt(e)))e++;return f.slice(s,e)}function D(s){if(e+s.length>T)return!1;for(let o=0;o<s.length;o++)if(f.charCodeAt(e+o)!==s.charCodeAt(o))return!1;if(e+s.length<T&&i(f.charCodeAt(e+s.length)))return!1;return!0}function vt(s){let o=e+s;while(o<T){let r=f.charCodeAt(o);if(r===Ve||r===Ke||r===Se||r===Oe){o++;continue}return r!==At&&r!==Ie}return!1}function sn(){if(!Rt)return!1;let s=e;O();let o=e>=T||Mt()||f.charCodeAt(e)===se;return e=s,o}function Mt(){if(e>=T)return!1;switch(f.charCodeAt(e)){case 101:return D("export")||D("enum");case 105:return D("import")||D("interface");case 102:return D("function");case 99:return D("class")||D("const");case 116:return D("type");case 108:return D("let");case 118:return D("var");case 100:return D("declare")||D("default");case 109:return D("module");case 110:return D("namespace");case 97:return D("abstract")||D("async");default:return!1}}function pt(){let s=f.charCodeAt(e);if(s!==Se&&s!==Oe)return!1;let o=e;if(e++,s===Oe&&e<T&&f.charCodeAt(e)===Se)e++;while(e<T){let c=f.charCodeAt(e);if(c===Ve||c===Ke||c===Oe||c===Se){e++;continue}if(c===ie&&e+1<T){let l=f.charCodeAt(e+1);if(l===ie){e=dt(e+2);continue}if(l===ye){let u=f.indexOf("*/",e+2);e=u===-1?T:u+2;continue}}break}let r=e>=T||Mt()||f.charCodeAt(e)===se;return e=o,r}function vn(s){let o=s-1;while(o>=0){let A=f.charCodeAt(o);if(A===Ve||A===Ke||A===Oe||A===Se){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)!==Se)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 Sn(s,o){let r=f.charCodeAt(e);if(r!==Se&&r!==Oe&&!(r===ie&&(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??T)))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 rn(){let s=f.charCodeAt(e);if(s!==Se&&s!==Oe)return!1;if(vn(e))return!1;let o=e;e++;while(e<T){let l=f.charCodeAt(e);if(l===Ve||l===Ke||l===Oe||l===Se){e++;continue}if(l===ie&&e+1<T){let u=f.charCodeAt(e+1);if(u===ie){e=dt(e+2);continue}if(u===ye){let w=f.indexOf("*/",e+2);e=w===-1?T:w+2;continue}}break}let r=e<T?f[e]:"",c=r==="|"||r==="&"||r==="["||r==="."||r==="?"||r===":"||r===">"||r===")"||r===","||D("extends");return e=o,!c}function kt(){let s=f.charCodeAt(e);if(s!==Se&&s!==Oe)return!1;let o=e;if(e++,s===Oe&&e<T&&f.charCodeAt(e)===Se)e++;while(e<T){let c=f.charCodeAt(e);if(c===Ve||c===Ke||c===Oe||c===Se){e++;continue}if(c===ie&&e+1<T&&f.charCodeAt(e+1)===ie){e=dt(e+2);continue}break}if(e>=T)return e=o,!0;let r=f.charCodeAt(e);if(r===124||r===38||r===At||r===Et||r===it)return e=o,!1;if(D("extends")||D("keyof")||D("typeof")||D("infer")||D("is")||D("as")||D("in"))return e=o,!1;return e=o,!0}let _n=/[{}'"`\/]/g,Tn=/[()'"`\/]/g,Dn=/[[\]'"`\/]/g,In=/[<>'"`\/]/g;function Be(s,o){let r=1;e++;let c=s===j?_n:s===le?Tn:s===Te?Dn:In;c.lastIndex=e;let l;while((l=c.exec(f))!==null){let u=l.index,w=f.charCodeAt(u);if(w===ke||w===ve){e=u,rt(w),c.lastIndex=e;continue}if(w===We){e=u,bt(),c.lastIndex=e;continue}if(w===ie){if(e=u,qe()){c.lastIndex=e;continue}c.lastIndex=u+1;continue}if(w===s)r++;else if(w===o){if(o===De&&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=T,e}function tt(){return e>0&&f.charCodeAt(e-1)===Ie}function Pt(){return e+1<T&&f.charCodeAt(e+1)===De}let Ze=/[<{};'"`\/\n\r()[\]]/g;function Ne(s=!1){let o=0,r=0,c=0,l=0,u=f.charCodeAt(e)===j;Ze.lastIndex=e;let w;while((w=Ze.exec(f))!==null){let C=w.index,A=f.charCodeAt(C);if(A===ke||A===ve){e=C,rt(A),Ze.lastIndex=e;continue}if(A===We){e=C,bt(),Ze.lastIndex=e;continue}if(A===ie){if(C>0&&f.charCodeAt(C-1)===$e){Ze.lastIndex=C+1;continue}if(e=C,qe()){if(o===0&&r===0&&c===0&&l===0&&sn())return;Ze.lastIndex=e;continue}Ze.lastIndex=C+1;continue}if(A===$e){let p=Xe(C)?.delta??null;if(p!==null)l=Math.max(0,l+p);Ze.lastIndex=C+1;continue}if(A===le){r++,Ze.lastIndex=C+1;continue}if(A===be){r--,Ze.lastIndex=C+1;continue}if(A===Te){c++,Ze.lastIndex=C+1;continue}if(A===Me){c--,Ze.lastIndex=C+1;continue}if(A===j){o++,Ze.lastIndex=C+1;continue}if(A===se){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;O();let R=Mt();if(e=k,R)return}Ze.lastIndex=C+1;continue}if(A===ce&&o===0&&r===0&&c===0&&l===0){e=C+1;return}if((A===Se||A===Oe)&&o===0&&r===0&&c===0&&l===0){if(e=C,pt())return}Ze.lastIndex=C+1}e=T}function On(){e++;while(e<T&&(f.charCodeAt(e)===Ve||f.charCodeAt(e)===Ke))e++;let s=f.indexOf(`
16
+ `,e),o=s===-1?T:s,r=f.indexOf(";",e);if(r!==-1&&r<o){let c=r-1;while(c>=e&&(f.charCodeAt(c)===Ve||f.charCodeAt(c)===Ke))c--;let l=f.charCodeAt(e),u=f.charCodeAt(c);if(l===j&&u===se||l===Te&&u===Me||l===ke&&u===ke||l===ve&&u===ve||l===We&&u===We){e=r+1;return}}Ne()}function on(){Be(j,se);while(e<T&&He(f.charCodeAt(e)))e++;if(D("from")){e+=4;while(e<T&&He(f.charCodeAt(e)))e++;if(e<T){let s=f.charCodeAt(e);if(s===ke||s===ve)rt(s)}}while(e<T&&(f.charCodeAt(e)===Ve||f.charCodeAt(e)===Ke))e++;if(e<T&&f.charCodeAt(e)===ce)e++}function cn(){e++;while(e<T&&He(f.charCodeAt(e)))e++;if(D("as")){e+=2;while(e<T&&He(f.charCodeAt(e)))e++;Re();while(e<T&&He(f.charCodeAt(e)))e++}if(D("from")){e+=4;while(e<T&&He(f.charCodeAt(e)))e++;if(e<T){let s=f.charCodeAt(e);if(s===ke||s===ve)rt(s)}}while(e<T&&(f.charCodeAt(e)===Ve||f.charCodeAt(e)===Ke))e++;if(e<T&&f.charCodeAt(e)===ce)e++}function St(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 Ye(s){if(!ne)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)===ie&&f.charCodeAt(o-1)===ye){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)!==Se)l--;let u=_e(l,o+1);if(u.startsWith("//")){if(c)break;let w=[u];o=l-1;while(o>=0&&(f.charCodeAt(o)===Se||f.charCodeAt(o)===Oe))o--;while(o>=0){let C=o;while(C>0&&f.charCodeAt(C-1)!==Se)C--;let A=_e(C,o+1);if(A.startsWith("//")){w.push(A),o=C-1;while(o>=0&&(f.charCodeAt(o)===Se||f.charCodeAt(o)===Oe))o--}else if(A===""){o=C-1;while(o>=0&&(f.charCodeAt(o)===Se||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 En(s){let o=s,r=!1,c=0,l;while(e<T){let E=f.charCodeAt(e);if(E===ie&&(f.charCodeAt(e+1)===ie||f.charCodeAt(e+1)===ye)){O();continue}if(E===ce){e++;break}if(E===j)c++;else if(E===se&&c>0)c--;if(E===ke||E===ve){if(rt(E),c>0)continue;r=!0;let L=e;if(O(),f.charCodeAt(e)===be){let v=e+1;l=ze(f.slice(o,v)),e=l?v:L}else e=L;while(e<T&&(f.charCodeAt(e)===Ve||f.charCodeAt(e)===Ke))e++;if(e<T&&f.charCodeAt(e)===ce)e++;break}if(E===Se&&r)break;e++}let u=_e(o,e),w=b(u).find((E)=>E.category==="static-import"),C=t(u),A=l?.isTypeOnly??w?.isTypeOnly??!1,p=C[1]?.kind==="quoted",k=l?.source??w?.specifier??"",R=Ye(o);return{kind:"import",name:"",text:u,isExported:!1,isTypeOnly:A,isSideEffect:p,source:k,leadingComments:R,start:o,end:e}}function Wt(){let s=e;return Be(j,se),f.slice(s,e)}function an(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,R=A+1<r.length?r.charCodeAt(A+1):0;if(k!==61&&k!==33&&k!==60&&k!==62&&R!==61&&R!==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=gt(w);return s.slice(0,o)+C+s.slice(u+1)}function ln(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 R=r[k];if(o){if(w){if(R.includes("*/"))w=!1;continue}let E=R.trim();if(E.length===0)continue;let L=E.charCodeAt(0);if(L===ie){let te=E.charCodeAt(1);if(te===ie)continue;if(te===ye){if(!E.includes("*/"))w=!0;continue}}if(L===ye)continue;let v=yn(R);if(v.charCodeAt(v.length-1)===ce)v=v.slice(0,-1);v=an(v);let I=v.trim();if(!I)continue;c.push(v),l.push(I);let Z=0;while(Z<v.length&&He(v.charCodeAt(Z)))Z++;if(I!=="{"&&I!=="}"){if(Z<C)C=Z}u.push(Z)}else{let E=R.length;while(E>0&&(R.charCodeAt(E-1)===Ve||R.charCodeAt(E-1)===Ke||R.charCodeAt(E-1)===Oe))E--;if(E===0)continue;let L=E<R.length?R.slice(0,E):R;if(L.charCodeAt(L.length-1)===ce)L=L.slice(0,-1);L=an(L);let v=L.trim();if(!v)continue;c.push(L),l.push(v);let I=0;while(I<L.length&&He(L.charCodeAt(I)))I++;if(v!=="{"&&v!=="}"){if(I<C)C=I}u.push(I)}}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 R=l[k];if(R==="{"){p[k]=R;continue}let E=u[k];if(E>C)p[k]=c[k];else if(E===C&&(R.charCodeAt(0)===se||R.charCodeAt(0)===Me||R.charCodeAt(0)===be))p[k]=c[k];else{let L=Math.max(0,E-A);p[k]=" ".repeat(L)+R}}return p.join(`
20
+ `)}function ot(){if(e>=T||f.charCodeAt(e)!==$e)return"";let s=e;Be($e,De);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 at(){if(e>=T||f.charCodeAt(e)!==le)return"()";let s=e;return Be(le,be),f.slice(s,e)}function _t(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===nt&&l+1<s.length){o+=s[++l];continue}if(u===c)r=!1;continue}if(u===ke||u===ve||u===We){r=!0,c=u,o+=s[l];continue}if(u===ie&&l+1<s.length){let w=s.charCodeAt(l+1);if(w===ye){let C=s.indexOf("*/",l+2);l=C===-1?s.length:C+1,o+=" ";continue}if(w===ie){let C=s.indexOf(`
22
+ `,l+2);l=C===-1?s.length:C-1;continue}if(y(s,l)){let C=g(s,l);o+=s.slice(l,C),l=C-1;continue}}o+=s[l]}return o.trim()}function gt(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 R=0;R<o.length;R++){let E=o.charCodeAt(R);if(E===le||E===$e||E===j)k++;else if(E===be||E===De||E===se)k--;else if(k===0){if(E===it)A++;else if(E===st)p++}}if(A>=p+1){let R=!1;for(let E=0;E<Jt.length;E++){let L=Jt[E],v=o.indexOf(L);if(v!==-1){let I=v+L.length;if((v===0||!i(o.charCodeAt(v-1)))&&(I>=o.length||!i(o.charCodeAt(I)))){R=!0;break}}}if(!R)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(_t(o.slice(c).trim()));break}let p=o.charCodeAt(A);if(u){if(p===nt){A++;continue}if(p===w)u=!1;continue}if(p===ie&&A+1<o.length){let k=o.charCodeAt(A+1);if(k===ye){A+=2;while(A+1<o.length&&!(o.charCodeAt(A)===ye&&o.charCodeAt(A+1)===ie))A++;A++;continue}if(k===ie){while(A<o.length&&o.charCodeAt(A)!==10)A++;continue}if(y(o,A)){A=g(o,A)-1;continue}}if(p===ke||p===ve||p===We){u=!0,w=p;continue}if(p===le||p===j||p===Te||p===$e)l++;else if(p===be||p===se||p===Me||p===De&&!(A>0&&o.charCodeAt(A-1)===Ie))l--;else if(p===st&&l===0)r.push(_t(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 R=!1,E=0,L=0,v=0;for(let I=0;I<k.length-1;I++){let Z=k.charCodeAt(I);if(Z===Se){v=I+1;continue}if(R){if(Z===nt){I++;continue}if(Z===E)R=!1;continue}if(Z===ke||Z===ve||Z===We){R=!0,E=Z;continue}if(Z===j||Z===Te||Z===le||Z===$e){L++;continue}if(Z===se||Z===Me||Z===be||Z===De){if(L>0)L--;continue}if(Z===ie&&y(k,I)){I=g(k,I)-1;continue}if(Z===ie&&k.charCodeAt(I+1)===ie){if(L===0){k=k.slice(0,I).trimEnd();break}let te=k.indexOf(`
24
+ `,I);if(te===-1){k=k.slice(0,v).trimEnd();break}let J=k.slice(0,v),z=k.slice(te+1);k=`${J}${z}`,I=v-1}}}if(!k.trim())continue;C.push(fn(k))}return je(`(${C.join(", ")})`)}function Rn(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===nt&&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===ie&&r+1<s.length){let C=s.charCodeAt(r+1);if(C===ye){let A=r;r+=2;while(r+1<s.length&&!(s.charCodeAt(r)===ye&&s.charCodeAt(r+1)===ie))r++;r=Math.min(r+2,s.length),o+=s.slice(A,r);continue}if(C===ie){let A=r;while(r<s.length&&s.charCodeAt(r)!==10)r++;o+=s.slice(A,r);continue}}if(w===ke||w===ve||w===We){l=!0,u=w,o+=s[r],r++;continue}if(w===j||w===Te||w===le)c++;else if(w===se||w===Me||w===be)c--;if(c>=1&&w===Ie&&(r+1>=s.length||s.charCodeAt(r+1)!==Ie&&s.charCodeAt(r+1)!==De)){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===ie){if(s.charCodeAt(r+1)===ie){let p=s.indexOf(`
26
+ `,r+2);r=p===-1?s.length:p+1;continue}if(s.charCodeAt(r+1)===ye){let p=s.indexOf("*/",r+2);r=p===-1?s.length:p+2;continue}if(y(s,r)){r=g(s,r);continue}}if(A===ke||A===ve||A===We){let p=A;r++;while(r<s.length){if(s.charCodeAt(r)===nt){r+=2;continue}if(s.charCodeAt(r)===p){r++;break}r++}continue}if(A===j||A===Te||A===le)C++;else if(A===se||A===Me||A===be){if(C===0)break;C--}else if(A===st&&C===0)break;r++}continue}o+=s[r],r++}return o}function fn(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)===le){let I=1;v++;while(v<o.length&&I>0){if(o.charCodeAt(v)===le)I++;else if(o.charCodeAt(v)===be)I--;v++}}o=o.slice(v).trim()}let c=!0;while(c){c=!1;for(let v of Jt)if(o.startsWith(v)&&o.length>v.length&&!i(o.charCodeAt(v.length))){let I=o.slice(v.length).trim();if(I.charCodeAt(0)===it||I.charCodeAt(0)===Et&&I.length>1&&I.charCodeAt(1)===it)break;o=I,c=!0;break}}let l=-1,u=-1,w=0,C=!1,A=0;for(let v=0;v<o.length;v++){let I=o.charCodeAt(v);if(C){if(I===nt){v++;continue}if(I===A)C=!1;continue}if(I===ie&&v+1<o.length){let Z=o.charCodeAt(v+1);if(Z===ye){v+=2;while(v+1<o.length&&!(o.charCodeAt(v)===ye&&o.charCodeAt(v+1)===ie))v++;v++;continue}if(Z===ie){while(v<o.length&&o.charCodeAt(v)!==10)v++;continue}if(y(o,v)){v=g(o,v)-1;continue}}if(I===ke||I===ve||I===We){C=!0,A=I;continue}if(I===le||I===j||I===Te||I===$e)w++;else if(I===be||I===se||I===Me||I===De&&!(v>0&&o.charCodeAt(v-1)===Ie))w--;else if(w===0){if(I===it&&l===-1)l=v;else if(I===Ie&&u===-1&&(v===0||o.charCodeAt(v-1)!==Ie)&&(v+1>=o.length||o.charCodeAt(v+1)!==Ie&&o.charCodeAt(v+1)!==De))u=v}}let p,k,R=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 Ge(v,wt);k=wt(o.slice(u+1).trim())}else p=o,k="unknown";if(p=Rn(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((Z)=>{let te=Z.trim();if(!te)return"";if(te==="{"||te==="}"||te==="["||te==="]"||te.startsWith("}")||te.startsWith("]"))return te;return` ${te}`}).join(`
29
+ `)}let E=p.endsWith("?")||R;if(p.endsWith("?"))p=p.slice(0,-1).trim();let L=E&&!r?"?":"";if(r)return`...${p}: ${k}`;return`${p}${L}: ${k}`}function wt(s){let o=s.trim(),r=Je(o);if(r)return r;if(o==="true"||o==="false")return"boolean";if(h(o))return"number";if(S(o))return"bigint";if(o.startsWith("'")&&o.endsWith("'")||o.startsWith('"')&&o.endsWith('"')||Zt(o))return"string";if(o.startsWith("["))return"unknown[]";if(o.startsWith("{"))return"Record<string, unknown>";return H(o)??"unknown"}function Bt(s){let o=s.trim();if(o.endsWith("as const"))o=o.slice(0,-8).trim();if(o==="true"||o==="false")return o;if(h(o)||S(o))return q(o);if(Zt(o))return o;let r=Mn(o);if(r!==null)return r;return H(o)??"unknown"}function Mn(s){if(s==="")return null;if(s.charCodeAt(0)===ke||s.charCodeAt(0)===ve){if(xt(s,0,s.charCodeAt(0))===s.length)return s}let o=Pn(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===ke||C===ve)&&xt(w,0,C)===w.length)r=!0,l.push(Wn(w));else c=!1}if(c)return Bn(l.join(""));if(r)return"string";return null}if(/^[\d\s()+*/%.\-]+$/.test(s)&&/\d/.test(s)&&/[+*/%\-\s]/.test(s))return"number";return null}function Pn(s,o){let r=[],c=0,l="",u=0;while(u<s.length){let w=s.charCodeAt(u);if(w===ke||w===ve||w===We){let C=xt(s,u,w);l+=s.slice(u,C),u=C;continue}if(w===ie&&(s.charCodeAt(u+1)===ie||s.charCodeAt(u+1)===42)){if(s.charCodeAt(u+1)===ie){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===le||w===Te||w===j)c++;else if(w===be||w===Me||w===se)c--;if(s[u]===o&&c===0){r.push(l),l="",u++;continue}l+=s[u],u++}return r.push(l),r}function Wn(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 Bn(s){return`'${s.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function Tt(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===ke||u===ve||u===We)l=xt(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 $t(){if(O(),e<T&&f.charCodeAt(e)===it){let c=function(){let l=_e(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("&")||l.endsWith("?")||l.endsWith(":")||u("is")||u("extends")||u("keyof")||u("readonly")};e++,O();let s=e,o=0,r=s;while(e<T){let l=e;if(qe()){if(f.charCodeAt(l)!==ie)r=e;continue}let u=f.charCodeAt(e);if(u===le||u===Te||u===$e)o++;else if(u===be||u===Me||u===De&&!tt())o--;else if(u===j)if(o>0)o++;else if(c())o++;else break;else if(u===se){if(o===0)break;o--}else if(o===0&&u===ce)break;if(o===0&&kt()&&!c())break;if(!He(u))r=e+1;e++}return _e(s,e)}return""}function lt(s,o,r,c){e+=8,O();let l=e<T&&f.charCodeAt(e)===ye;if(l)e++,O();let u=Re();if(!u&&!c)return null;O();let w=ot();O();let C=at();O();let A=$t(),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";O();let k=!1;if(e<T&&f.charCodeAt(e)===j){k=!0;let te=e+1;if(Be(j,se),!p&&!l){let J=f.slice(te,e-1),z=Li(J,G??"stdin.ts",()=>{let ue;do ue=`__dtsx_return_${oe++}`;while(f.includes(ue));return ue},(ue)=>ee(ue.name,{...ue,start:e,end:e}),w);A=z.finish(B(J,r,C,ct,z.resolve))}}else if(e<T&&f.charCodeAt(e)===ce)e++;let R=gt(C),v=`${o?c?"export default function ":"export declare function ":"declare function "}${u||(c?"":"default")}${w}${R}: ${A};`,I=Ye(s),Z={kind:"function",name:u||"default",text:v,isExported:o,isDefault:c,isAsync:r,isGenerator:l,returnType:A,generics:w||void 0,leadingComments:I,start:s,end:e};if(k)Ae.add(Z);return Z}let Lt,Ln=0;function dn(){Lt??=new Set(t(f).filter((s)=>s.kind==="word").map((s)=>f.slice(s.start,s.end)));for(;;){let s=`__dtsx_binding_${Ln++}`;if(Lt.has(s))continue;return Lt.add(s),s}}function ut(s,o,r){e+=o.length,O();let c=[];do{if(O(),e>=T)break;let l=f.charCodeAt(e),u,w=e;if(l===j||l===Te)Be(l,l===j?se:Me),u=f.slice(w,e);let C=u?dn():Re();if(!C)return Ne(),c;O();let A,p,k,R=!1;if(e<T&&f.charCodeAt(e)===it){e++,O();let te=e,J=0;while(e<T){if(qe()){if(J===0&&sn())break;continue}let z=f.charCodeAt(e);if(z===le||z===j||z===Te||z===$e)J++;else if(z===be||z===se||z===Me||z===De&&!tt())J--;else if(J===0&&(z===ce||z===st))break;else if(J===0&&z===Ie&&!Pt())break;if(J===0&&(pt()||rn()))break;e++}A=_e(te,e)}if(e<T&&f.charCodeAt(e)===Ie)if(me&&A&&(!ne||!Un(A)))On();else{e++,O();let te=e;k=te;let J=0,z=0,ue;if(f.charCodeAt(e)===le||f.charCodeAt(e)===$e||D("function")||D("async")){X??=_(f);let re=X(e,te);if(re?.parameters)e=re.end}while(e<T){if(J===0&&z===0&&Sn(te,ue))break;if(qe())continue;let re=f.charCodeAt(e);if(re===le||re===j||re===Te)J++;else if(re===be||re===se||re===Me)J--;else if(re===$e){X??=_(f);let Pe=J===0&&z===0?X(e,te,ue):void 0;if(Pe?.parameters||Pe?.completeOperand||Pe&&G!==void 0&&!/\.[jt]sx$/.test(G)){e=Pe.end,ue=Pe.completeOperand?Pe.end:void 0;continue}let ht=z>0||f[e+1]!=="/"&&xe(f,e)?Xe(e):null;if(ht){if(z=Math.max(0,z+ht.delta),e=ht.end+1,z===0)ue=e;continue}else if(z===0){if(Pe){e=Pe.end,ue=Pe.completeOperand?Pe.end:void 0;continue}}}else if(J===0&&z===0&&(re===ce||re===st))break;e++}if(p=xn(_e(te,e)),p.endsWith(" as const")||p==="const"){if(R=!0,!A){let re=p.endsWith(" as const")?p.slice(0,-9).trim():p,Pe=Bt(re);A=Pe!=="unknown"?Pe:void 0}}else if(!A){let re=K(p)??Tt(p)??ct(p);if(re)A=re}}let E=c.length===0?Ye(s):void 0,L=u?"const":o,v=u?!1:r,I=`${v?"export ":""}declare ${L} ${C}: ${A||"unknown"};`,Z={kind:"variable",name:C,text:I,isExported:v,typeAnnotation:A,value:p,initializerStart:k,modifiers:R?[L,"const assertion"]:[L],leadingComments:u?void 0:E,start:s,end:e};if(u)c.push(...ir({pattern:u,patternOffset:w,root:Z,kind:o,exported:r,comments:E,allocateName:dn}));else c.push(Z);if(f.charCodeAt(e)===st){e++;continue}if(f.charCodeAt(e)===ce)e++;break}while(e<T);return c}function Nt(s,o){e+=9,O();let r=Re();O();let c=ot();O();let l="";if(D("extends")){e+=7,O();let p=e,k=0;while(e<T){if(qe())continue;let R=f.charCodeAt(e);if(R===$e)k++;else if(R===De&&!tt())k--;else if(R===j&&k===0)break;e++}l=_e(p,e)}O();let u=e<T&&f.charCodeAt(e)===j?Wt():"{}",w=ln(u),C=`${o?"export ":""}declare interface ${r}${c}${l?` extends ${l}`:""} ${w}`,A=Ye(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 zt(s,o){e+=4,O();let r=Re();O();let c=ot();if(O(),e<T&&f.charCodeAt(e)===Ie)e++;O();let l=e,u=0;while(e<T){if(qe())continue;let p=f.charCodeAt(e);if(p===le||p===j||p===Te||p===$e)u++;else if(p===be||p===se||p===Me||p===De&&!tt())u--;else if(u===0&&p===ce)break;if(u===0&&(pt()||rn()))break;e++}let w=_e(l,e);if(e<T&&f.charCodeAt(e)===ce)e++;let C=`${o?"export ":""}type ${r}${c} = ${w}`,A=Ye(s);return{kind:"type",name:r,text:C,isExported:o,generics:c||void 0,leadingComments:A,start:s,end:e}}function mt(s,o,r){e+=4,O();let c=Re();O();let l=e;if(e<T&&f.charCodeAt(e)===j)Be(j,se);let u=_e(s,e),w=Ye(s);return{kind:"enum",name:c,text:u,isExported:o,modifiers:r?["const"]:void 0,leadingComments:w,start:s,end:e}}function ft(s,o,r,c=!1){e+=5,O();let l=Re()||"AnonymousClass";O();let u=ot();O();let w="";if(D("extends")){e+=7,O();let E=e,L=0;while(e<T){if(qe())continue;let v=f.charCodeAt(e);if(v===$e)L++;else if(v===De&&!tt())L--;else if(L===0&&(v===j||D("implements")))break;e++}w=_e(E,e)}let C;if(D("implements")){e+=10,O();let E=e,L=0;while(e<T){if(qe())continue;let I=f.charCodeAt(e);if(I===$e)L++;else if(I===De&&!tt())L--;else if(L===0&&I===j)break;e++}let v=_e(E,e);if(v)C=v.split(",").map((I)=>I.trim())}O();let A=Ft(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}`,R=Ye(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:R,start:s,end:e}}let Ht;function Ft(s){if(e>=T||f.charCodeAt(e)!==j)return"{}";e++;let o={name:s,fields:new Map,pending:[],isStatic:!1};N.push(o);let r=[],c=new Set;while(e<T){if(O(),e>=T)break;if(f.charCodeAt(e)===se){e++;break}if(f.charCodeAt(e)===ce){e++;continue}if(Ht=Ye(e),D("static")&&It("static")===j){e+=6,O(),Be(j,se);continue}let l=!1,u=!1,w=!1,C=!1,A=!1,p=!1,k=!1,R=!1,E=!0;while(E){O();let J=e,z=Re();if(e=J,z){let ue=It(z);if(ue===le||ue===$e||ue===Et||ue===33||ue===it||ue===Ie||ue===ce||ue===se)break}if(D("private")){l=!0,e+=7;continue}if(D("protected")){u=!0,e+=9;continue}if(D("public")){e+=6;continue}if(D("static")){w=!0,e+=6;continue}if(D("abstract")){C=!0,e+=8;continue}if(D("readonly")){A=!0,e+=8;continue}if(D("override")){p=!0,e+=8;continue}if(D("accessor")){k=!0,e+=8;continue}if(D("async")){R=!0,e+=5;continue}if(D("declare")){e+=7;continue}break}if(O(),e>=T||f.charCodeAt(e)===se)break;let L=e;if(o.isStatic=w,(D("get")||D("set"))&&Vt(It(f.slice(e,e+3))))e+=3,O();if(f.charCodeAt(e)===ye)e++,O();let v=Dt();e=L;let I=v.startsWith("#");if(I)l=!0;if(l&&v&&v!=="constructor"){let J=I?w?" static #private_static;":" #private;":` private ${w?"static ":""}${v};`,ue=v[0]==="'"||v[0]==='"'?d(v)??v:v,re=I?`${w?"static":"instance"}#`:`${w?"static:":"instance:"}${ue}`;if(!c.has(re))c.add(re),r.push(J)}let Z=l?[]:r,te=" ";if(u)te+="protected ";if(w)te+="static ";if(C)te+="abstract ";if(A)te+="readonly ";if(D("constructor")){e+=11,O();let J=at();if(O(),zn(J,r),e<T&&f.charCodeAt(e)===j)Be(j,se);else if(e<T&&f.charCodeAt(e)===ce)e++;let z=gt(J);r.push(l?" private constructor();":` ${u?"protected ":""}constructor${z};`)}else if(D("get"))if(e+=3,O(),e<T&&Vt(f.charCodeAt(e))){let J=Dt();if(J.startsWith("#")){if(O(),e<T&&f.charCodeAt(e)===le)at();if(O(),$t(),O(),e<T&&f.charCodeAt(e)===j)Be(j,se);else if(e<T&&f.charCodeAt(e)===ce)e++;continue}O(),at(),O();let z=$t(),ue;if(O(),e<T&&f.charCodeAt(e)===j){let Pe=e+1;if(Be(j,se),!z&&!me)ue=f.slice(Pe,e-1),z=B(ue,!1,"()",(ht)=>yt(ht,w))}else if(e<T&&f.charCodeAt(e)===ce)e++;let re=Z.length;if(Z.push(`${te}get ${J}(): ${ue?W(z):z||"unknown"};`),ue)o.pending.push(()=>{let Pe=B(ue,!1,"()",(ht)=>yt(ht,w));Z[re]=`${te}get ${J}(): ${W(Pe)};`})}else hn("get",te,w,A,R,Z);else if(D("set"))if(e+=3,O(),e<T&&Vt(f.charCodeAt(e))){let J=Dt();if(J.startsWith("#")){if(O(),e<T&&f.charCodeAt(e)===le)at();if(O(),e<T&&f.charCodeAt(e)===j)Be(j,se);else if(e<T&&f.charCodeAt(e)===ce)e++;continue}O();let z=at();if(O(),e<T&&f.charCodeAt(e)===j)Be(j,se);else if(e<T&&f.charCodeAt(e)===ce)e++;let ue=gt(z);Z.push(`${te}set ${J}${ue};`)}else hn("set",te,w,A,R,Z);else{let J=f.charCodeAt(e)===ye;if(J)e++,O();let z=Dt();if(!z){un();continue}pn(z,te,w,A,J,C,R,Z)}}for(let l of o.pending)l();return N.pop(),`{
32
+ ${r.join(`
33
+ `)}
34
+ }`}function Vt(s){return a(s)||s===Te||s===bn||s===ke||s===ve}function Dt(){if(e>=T)return"";let s=f.charCodeAt(e);if(s===Te){let o=e;return Be(Te,Me),f.slice(o,e)}if(s===bn)return e++,`#${Re()}`;if(s===ke||s===ve){let o=e;return rt(s),f.slice(o,e)}return Re()}function It(s){let o=e;e+=s.length,O();let r=e<T?f.charCodeAt(e):0;return e=o,r}function un(){let s=0;while(e<T){if(qe())continue;let o=f.charCodeAt(e);if(o===j||o===le)s++;else if(o===se||o===be){if(s===0)return;s--}else if(o===ce&&s===0){e++;return}if(s===0&&kt())return;e++}}function hn(s,o,r,c,l,u){pn(s,o,r,c,!1,!1,l,u)}function pn(s,o,r,c,l,u,w,C){let A=Ht;if(Ht=void 0,O(),e>=T)return;let p=f.charCodeAt(e),k=!1;if(p===Et)k=!0,e++,O();if(e<T&&f.charCodeAt(e)===33)e++,O();let R=e<T?f.charCodeAt(e):0;if(R===le||R===$e){let E=R===$e?ot():"";O();let L=at();O();let v=$t(),I,Z=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(O(),e<T&&f.charCodeAt(e)===j){let ue=e+1;if(Be(j,se),!Z&&!l)I=f.slice(ue,e-1),v=B(I,w,L,(re)=>yt(re,r))}else if(e<T&&f.charCodeAt(e)===ce)e++;let te=gt(L),J=k?"?":"",z=C.length;if(C.push(`${o}${s}${J}${E}${te}: ${I?W(v):v};`),I)N.at(-1)?.pending.push(()=>{let ue=B(I,w,L,(re)=>yt(re,r));C[z]=`${o}${s}${J}${E}${te}: ${W(ue)};`})}else if(R===it||R===Ie||R===ce||R===se||R===Se||R===Oe){let E="";if(R===it){e++,O();let te=e,J=0;while(e<T){if(qe())continue;let z=f.charCodeAt(e);if(z===le||z===j||z===Te||z===$e)J++;else if(z===be||z===se||z===Me||z===De&&!tt()){if(J===0)break;J--}else if(J===0&&(z===ce||z===st))break;else if(J===0&&z===Ie&&!Pt())break;if(J===0&&kt())break;e++}E=_e(te,e)}let L="";if(e<T&&f.charCodeAt(e)===Ie)if(me&&E){e++;let te=0;while(e<T){if(qe())continue;let J=f.charCodeAt(e);if(J===le||J===j||J===Te)te++;else if(J===be||J===se||J===Me){if(te===0&&J===se)break;te--}else if(te===0&&J===ce)break;if(te===0&&kt())break;e++}}else{e++,O();let te=e,J=0;while(e<T){if(qe())continue;let z=f.charCodeAt(e);if(z===le||z===j||z===Te)J++;else if(z===be||z===se||z===Me){if(J===0&&z===se)break;J--}else if(J===0&&z===ce)break;if(J===0&&kt())break;e++}L=_e(te,e)}if(e<T&&f.charCodeAt(e)===ce)e++;let v=E.length>0;if(!E)if(L){let te=Tt(L);if(te)E=te;else if(L.startsWith("new "))E=he(L);else{let J=L.endsWith("as const"),z=c&&(r||Kn(L));if(E=J||z?Bt(L):wt(L),E==="unknown"&&kn(L)&&!L.includes("."))E=he(L,!0)}}else E="unknown";let I=k?"?":"";N.at(-1)?.fields.set(`${r?"static:":""}${s}`,k?`(${E}) | undefined`:E);let Z=ne&&!v&&L?qt(A,L,E):"";C.push(`${Z}${o}${s}${I}: ${E};`)}else un()}function Nn(s){let o=0;for(let r=0;r<s.length;r++){let c=s.charCodeAt(r);if(c===le||c===j||c===Te||c===$e)o++;else if(c===be||c===se||c===Me||c===De&&s.charCodeAt(r-1)!==Ie)o--;else if(c===Ie&&o===0&&s.charCodeAt(r+1)!==De&&s.charCodeAt(r+1)!==Ie)return!0}return!1}function zn(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(_t(r.slice(l).trim()));break}let k=r.charCodeAt(p);if(w){if(k===nt){p++;continue}if(k===C)w=!1;continue}if(k===ie&&p+1<r.length){let R=r.charCodeAt(p+1);if(R===ye){p+=2;while(p+1<r.length&&!(r.charCodeAt(p)===ye&&r.charCodeAt(p+1)===ie))p++;p++;continue}if(R===ie){while(p<r.length&&r.charCodeAt(p)!==10)p++;continue}}if(k===ke||k===ve||k===We){w=!0,C=k;continue}if(k===le||k===j||k===Te||k===$e)u++;else if(k===be||k===se||k===Me||k===De&&!(p>0&&r.charCodeAt(p-1)===Ie))u--;else if(k===st&&u===0)A.push(r.slice(l,p)),c.push(_t(r.slice(l,p).trim())),l=p+1}for(let[p,k]of c.entries()){let R=k.startsWith("public ")||k.startsWith("public\t"),E=k.startsWith("protected ")||k.startsWith("protected\t"),L=k.startsWith("private ")||k.startsWith("private\t"),v=k.includes("readonly ");if(!R&&!E&&!L&&!v)continue;let I=k,Z=[];if(L){let re=7;while(re<I.length&&He(I.charCodeAt(re)))re++;I=I.slice(re),Z.push("private")}if(R){let re=6;while(re<I.length&&He(I.charCodeAt(re)))re++;I=I.slice(re),Z.push("public")}if(E){let re=9;while(re<I.length&&He(I.charCodeAt(re)))re++;I=I.slice(re),Z.push("protected")}if(v){let re=I.indexOf("readonly ");if(re!==-1){let Pe=re+8;while(Pe<I.length&&He(I.charCodeAt(Pe)))Pe++;I=I.slice(0,re)+I.slice(Pe)}Z.push("readonly")}let te=Z.length>0?`${Z.join(" ")} `:"",J=fn(I),z=I.search(/[?:=]/);if(z!==-1&&I.charCodeAt(z)!==63&&Nn(I))J=J.replace(/^([\w$]+)\?:/,"$1:");let ue="";if(ne&&!L&&z!==-1&&I.charCodeAt(z)===Ie){let re=I.slice(z+1);ue=qt(rr(A[p]),re,wt(re))}o.push(L?` private ${J.split(/[?:]/,1)[0]};`:`${ue} ${te}${J};`)}}function Ut(s=" ",o="",r=!1){if(e>=T||f.charCodeAt(e)!==j)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};ae.push(l),Ee.push(l);let u=[];while(e<T){if(O(),e>=T)break;if(f.charCodeAt(e)===se){e++;break}if(f.charCodeAt(e)===ce){e++;continue}let w=!1;if(D("export"))w=!0,e+=6,O();let C=!1;if(D("declare"))C=!0,e+=7,O();let A=w?"export ":"";if(D("function")||D("async")&&Hn("async","function")){let p=!1;if(D("async"))p=!0,e+=5,O();if(e+=8,O(),e<T&&f.charCodeAt(e)===ye)e++,O();let R=Re();O();let E=ot();O();let L=at();O();let v=$t();if(!v)v=p?"Promise<void>":"void";if(O(),e<T&&f.charCodeAt(e)===j)Be(j,se);else if(e<T&&f.charCodeAt(e)===ce)e++;let I=gt(L);u.push(`${s}${A}function ${R}${E}${I}: ${v};`)}else if(D("const")||D("let")||D("var")){let p=D("const")?"const":D("let")?"let":"var";e+=p.length,O();let k=Re();if(l.bindings.set(k,"value"),w||l.ambient)l.exports.add(k);if(!k){Ne(!0);continue}O();let R="";if(e<T&&f.charCodeAt(e)===it){e++,O();let L=e,v=0;while(e<T){if(qe())continue;let I=f.charCodeAt(e);if(I===le||I===j||I===Te||I===$e)v++;else if(I===se&&v===0)break;else if(I===be||I===se||I===Me||I===De&&!tt())v--;else if(v===0&&(I===ce||I===st))break;else if(v===0&&I===Ie&&!Pt())break;if(v===0&&pt())break;e++}R=_e(L,e)}if(R)l.annotatedValues.add(k);let E="";if(e<T&&f.charCodeAt(e)===Ie){e++,O();let L=e,v=0;while(e<T){if(qe())continue;let I=f.charCodeAt(e);if(I===le||I===j||I===Te||I===$e)v++;else if(I===se&&v===0)break;else if(I===be||I===se||I===Me||I===De&&!tt())v--;else if(v===0&&(I===ce||I===st))break;if(v===0&&pt())break;e++}E=_e(L,e)}if(e<T&&f.charCodeAt(e)===ce)e++;if(!R&&E){let L=Tt(E);if(L)R=L;else if(p==="const")R=Bt(E);else R=wt(E)}if(!R)R="unknown";u.push(`${s}${A}${p} ${k}: ${R};`)}else if(D("interface")){e+=9,O();let p=Re();O();let k=ot();O();let R="";if(D("extends")){e+=7,O();let L=e,v=0;while(e<T){if(qe())continue;let I=f.charCodeAt(e);if(I===$e)v++;else if(I===De&&!tt())v--;else if(I===j&&v===0)break;e++}R=_e(L,e)}let E=ln(Wt());u.push(`${s}${A}interface ${p}${k}${R?` extends ${R}`:""} ${E}`)}else if(D("type")){e+=4,O();let p=Re();O();let k=ot();if(O(),e<T&&f.charCodeAt(e)===Ie){e++,O();let R=e,E=0;while(e<T){if(qe())continue;let v=f.charCodeAt(e);if(v===le||v===j||v===Te||v===$e)E++;else if(v===se&&E===0)break;else if(v===be||v===se||v===Me||v===De&&!tt())E--;else if(E===0&&v===ce)break;if(E===0&&pt())break;e++}let L=_e(R,e);if(e<T&&f.charCodeAt(e)===ce)e++;u.push(`${s}${A}type ${p}${k} = ${L}`)}}else if(D("class")){e+=5,O();let p=Re();O();let k=ot();O();let R=e,E=0;while(e<T){if(qe())continue;let Z=f.charCodeAt(e);if(Z===$e)E++;else if(Z===De&&!tt())E--;else if(Z===j&&E===0)break;e++}let L=_e(R,e),v=L?` ${L}`:"";if(l.bindings.set(p,"class"),w||l.ambient)l.exports.add(p);let I=Ft(p);u.push(`${s}${A}class ${p}${k}${v} ${I}`)}else if(D("enum")){e+=4,O();let p=Re();O();let k=Wt();u.push(`${s}${A}enum ${p} ${k}`)}else if(D("namespace")||D("module")){let p=D("namespace")?"namespace":"module";e+=p.length,O();let k=Re();if(!l.bindings.has(k))l.bindings.set(k,"namespace");if(w||l.ambient)l.exports.add(k);O();let R=Ut(s,k,C);u.push(`${s}${A}${p} ${k} ${R}`)}else if(D("abstract"))if(e+=8,O(),D("class")){e+=5,O();let p=Re();O();let k=ot();O();let R=e,E=0;while(e<T){if(qe())continue;let Z=f.charCodeAt(e);if(Z===$e)E++;else if(Z===De&&!tt())E--;else if(Z===j&&E===0)break;e++}let L=_e(R,e),v=L?` ${L}`:"";if(l.bindings.set(p,"class"),w||l.ambient)l.exports.add(p);let I=Ft(p);u.push(`${s}${A}abstract class ${p}${k}${v} ${I}`)}else Ne(!0);else if(w&&D("default")){e+=7,O();let p=e;Ne(!0);let k=_e(p,e);if(k.charCodeAt(k.length-1)===ce)k=k.slice(0,-1);if(k)u.push(`${s}export default ${k};`)}else if(!w&&(f.charCodeAt(e)===ke||f.charCodeAt(e)===ve||f.charCodeAt(e)===We))Ne(!0);else Ne(!0)}if(Ee.pop(),u.length===0)return"{}";return`{
35
+ ${u.join(`
36
+ `)}
37
+ }`}function Hn(s,o){let r=e+s.length;while(r<T&&He(f.charCodeAt(r)))r++;for(let c=0;c<o.length;c++)if(r+c>=T||f.charCodeAt(r+c)!==o.charCodeAt(c))return!1;return r+o.length>=T||!i(f.charCodeAt(r+o.length))}function Ct(s,o,r){e+=r.length,O();let c="",l=f.charCodeAt(e);if(l===ke||l===ve){let E=e;rt(l),c=f.slice(E,e)}else{c=Re();while(e<T&&f.charCodeAt(e)===At)e++,c+=`.${Re()}`}O();let u=t(f.slice(s,e)),w=u.findIndex((E)=>E.kind==="word"&&["namespace","module"].includes(f.slice(s+E.start,s+E.end))),C=u.slice(0,w).some((E)=>E.kind==="word"&&f.slice(s+E.start,s+E.end)==="declare"),A=e<T&&f.charCodeAt(e)===j?Ut(" ",c,C):"{}",p=`${o?"export ":""}declare ${r} ${c} ${A}`,k=Ye(s),R=c.startsWith("'")||c.startsWith('"');return{kind:"module",name:c,text:p,isExported:o,moduleForm:R?"quoted":r==="namespace"?"namespace":"identifier",source:R?c.slice(1,-1):void 0,leadingComments:k,start:s,end:e}}function gn(s,o){Ne();let r=_e(o,e);if(r.charCodeAt(r.length-1)===ce)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=Ye(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=Tt(r)||ct(r)||n(r,!1),p=A==="unknown"&&kn(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 mn(){if(f.charCodeAt(e)===j)return Be(j,se),!0;let s=D("if"),o=D("do"),r=D("try"),c=D("for");if(!s&&!o&&!r&&!c&&!D("while")&&!D("switch")&&!D("with"))return!1;if(Re(),O(),c&&D("await"))e+=5,O();if(!o&&!r&&f.charCodeAt(e)===le)Be(le,be);if(Ot(),O(),s&&D("else"))e+=4,Ot();else if(o&&D("while")){if(e+=5,O(),f.charCodeAt(e)===le)Be(le,be);if(O(),f.charCodeAt(e)===ce)e++}else if(r){if(D("catch")){if(e+=5,O(),f.charCodeAt(e)===le)Be(le,be);Ot(),O()}if(D("finally"))e+=7,Ot()}return!0}function Ot(){if(O(),!mn())Ne()}while(e<T){if(O(),e>=T)break;if(mn())continue;let s=e,o=f.charCodeAt(e);if(o===105&&D("import"))Q.push(En(s));else if(o===101&&D("export")){e+=6,O();let r=f.charCodeAt(e);if(r===100&&D("default")){e+=7,O();let c=e,l=f.charCodeAt(e);if(l===102&&D("function")){let u=lt(s,!0,!1,!0);if(u)Q.push(u)}else if(l===97&&D("async")&&It("async")!==ce)if(e+=5,O(),D("function")){let u=lt(s,!0,!0,!0);if(u)Q.push(u)}else gn(s,c);else if(l===99&&D("class")){let u=ft(s,!0,!1,!0);Q.push(u)}else if(l===97&&D("abstract")){if(e+=8,O(),D("class")){let u=ft(s,!0,!0,!0);Q.push(u)}}else gn(s,c)}else if(r===116&&D("type")){let c=e;if(e+=4,O(),e<T&&f.charCodeAt(e)===j){on();let l=_e(s,e),u=Ye(s);Q.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:St(l),leadingComments:u,start:s,end:e})}else if(e<T&&f.charCodeAt(e)===ye){cn();let l=_e(s,e);Q.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:St(l),start:s,end:e})}else{e=c;let l=zt(s,!0);Q.push(l)}}else if(r===105&&D("interface")){let c=Nt(s,!0);Q.push(c)}else if(r===102&&D("function")){let c=lt(s,!0,!1,!1);if(c)Q.push(c)}else if(r===97&&D("async"))if(e+=5,O(),D("function")){let c=lt(s,!0,!0,!1);if(c)Q.push(c)}else Ne();else if(r===99)if(D("class")){let c=ft(s,!0,!1);Q.push(c)}else if(D("const")){let c=e;if(e+=5,O(),D("enum")){e=c+5,O();let l=mt(s,!0,!0);Q.push(l)}else{e=c;let l=ut(s,"const",!0);for(let u=0;u<l.length;u++)Q.push(l[u])}}else Ne();else if(r===97&&D("abstract")){if(e+=8,O(),D("class")){let c=ft(s,!0,!0);Q.push(c)}}else if(r===108&&D("let")){let c=ut(s,"let",!0);for(let l=0;l<c.length;l++)Q.push(c[l])}else if(r===118&&D("var")){let c=ut(s,"var",!0);for(let l=0;l<c.length;l++)Q.push(c[l])}else if(r===101&&D("enum")){let c=mt(s,!0,!1);Q.push(c)}else if(r===100&&D("declare"))e+=7,O(),An(s,!0);else if(r===110&&D("namespace")&&vt(9)){let c=Ct(s,!0,"namespace");Q.push(c)}else if(r===109&&D("module")&&vt(6)){let c=Ct(s,!0,"module");Q.push(c)}else if(r===j){on();let c=_e(s,e),l=c.includes("export type"),u=Ye(s);Q.push({kind:"export",name:"",text:c,isExported:!0,isTypeOnly:l,source:St(c),leadingComments:u,start:s,end:e})}else if(r===ye){cn();let c=_e(s,e),l=Ye(s);Q.push({kind:"export",name:"",text:c,isExported:!0,isTypeOnly:!1,source:St(c),leadingComments:l,start:s,end:e})}else{Ne();let c=_e(s,e);if(c)Q.push({kind:"export",name:"",text:c,isExported:!0,start:s,end:e})}}else if(o===100&&D("declare"))e+=7,O(),An(s,!1);else if(o===105&&D("interface")){let r=Nt(s,!1);ee(r.name,r)}else if(o===116&&D("type")){let r=zt(s,!1);ee(r.name,r),Q.push(r)}else if(o===102&&D("function")){let r=lt(s,!1,!1,!1);if(r)Yt(r);else Ne()}else if(o===97)if(D("async")){let r=e;if(e+=5,O(),D("function")){let c=lt(s,!1,!0,!1);if(c)Yt(c);else e=r,Ne()}else e=r,Ne()}else if(D("abstract"))if(e+=8,O(),D("class")){let r=ft(s,!1,!0);ee(r.name,r),Q.push(r)}else Ne();else e++,Ne();else if(o===99)if(D("class")){let r=ft(s,!1,!1);ee(r.name,r),Q.push(r)}else if(D("const")){let r=e;if(e+=5,O(),D("enum")){e=r+5,O();let c=mt(s,!1,!0);ee(c.name,c),Q.push(c)}else{e=r;let c=ut(s,"const",!1);for(let l=0;l<c.length;l++)ee(c[l].name,c[l])}}else e++,Ne();else if(o===101&&D("enum")){let r=mt(s,!1,!1);ee(r.name,r),Q.push(r)}else if(o===108&&D("let")||o===118&&D("var")){let r=D("let")?"let":"var",c=ut(s,r,!1);for(let l=0;l<c.length;l++)ee(c[l].name,c[l])}else if(o===109&&D("module")&&vt(6)){let r=Ct(s,!1,"module");Q.push(r)}else if(o===110&&D("namespace")&&vt(9)){let r=Ct(s,!1,"namespace");Q.push(r)}else{let r=f.charCodeAt(e);if(r===ce)e++;else if(r===ke||r===ve){if(rt(r),e<T&&f.charCodeAt(e)===ce)e++}else if(r===We){if(bt(),e<T&&f.charCodeAt(e)===ce)e++}else if(r===Gn){if(e++,Re(),O(),e<T&&f.charCodeAt(e)===At)e++,Re(),O();if(e<T&&f.charCodeAt(e)===le)Be(le,be)}else e++,Ne()}}if(ge.length){let s=new Set([...Q,...Ce.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 ae)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 ge){if(C.binding){let A=r.has(C.initializer);for(let p=C.namespaces.length-1;p>=0;p--){let k=C.namespaces[p],R=k.path?`${k.path}.${C.initializer}`:C.initializer;if(k.bindings.has(C.initializer)||l.has(R)){A=k.bindings.has(C.initializer)?k.annotatedValues.has(C.initializer):c.has(R);break}}u.set(C.marker,A?`typeof ${C.initializer}`:"unknown");continue}u.set(C.marker,Kt(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],R=k.path?`${k.path}.${A}`:A,E=A.split(".")[0],L=k.bindings.get(E);if(L){if(A===E&&L!=="namespace")return L==="class";return l.get(R)==="class"}let v=k.path?`${k.path}.${E}`:E;if(l.has(v))return l.get(R)==="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 R=u.get(C.slice(k.start,k.end));if(!R)continue;A+=C.slice(p,k.start)+R,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(Ae.size>0){Cn(Q);for(let s of pe.values())Cn(s)}if(qn(f,Q,Ce,pe),sr(Q,Ce),or(Q,Ce),me)Gt([...Q,...Ce.values()]);else Jn(f,Q,Ce,de);if(fe){let s=new Set(Q);for(let o of[...Ce.values(),...[...pe.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(Ce.size>0)Qn(Q,Ce,pe,Le,et);return Q;function Cn(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&&Ae.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 An(s,o){if(D("function")){let r=lt(s,o,!1,!1);if(r)Q.push(r)}else if(D("async")){if(e+=5,O(),D("function")){let r=lt(s,o,!0,!1);if(r)Q.push(r)}}else if(D("class")){let r=ft(s,o,!1);Q.push(r)}else if(D("abstract")){if(e+=8,O(),D("class")){let r=ft(s,o,!0);Q.push(r)}}else if(D("interface")){let r=Nt(s,o);Q.push(r)}else if(D("type")){let r=zt(s,o);Q.push(r)}else if(D("enum")){let r=mt(s,o,!1);Q.push(r)}else if(D("const")){let r=e;if(e+=5,O(),D("enum")){e=r+5,O();let c=mt(s,o,!0);Q.push(c)}else{e=r;let c=ut(s,"const",o);for(let l=0;l<c.length;l++)if(o||!et)Q.push(c[l]);else ee(c[l].name,c[l])}}else if(D("let")||D("var")){let r=D("let")?"let":"var",c=ut(s,r,o);for(let l=0;l<c.length;l++)if(o||!et)Q.push(c[l]);else ee(c[l].name,c[l])}else if(D("module")){let r=Ct(s,o,"module");Q.push(r)}else if(D("namespace")){let r=Ct(s,o,"namespace");Q.push(r)}else if(D("global")){e+=6,O();let c=`declare global ${e<T&&f.charCodeAt(e)===j?Ut(" ","",!0):"{}"}`,l=Ye(s);Q.push({kind:"module",name:"global",text:c,isExported:!1,moduleForm:"global",leadingComments:l,start:s,end:e})}else Ne()}}class $n{names;lengths=new Uint8Array(65);firstUnits=new Uint8Array(65536);size;constructor(P){this.names=P;for(let G of P.keys()){if(!G)continue;this.lengths[Math.min(G.length,64)]=1,this.firstUnits[G.charCodeAt(0)]=1}this.size=P.size}scan(P,G){if(this.size===0)return!1;let V=!1,Y=0,fe=P.length;while(Y<fe){let de=P.charCodeAt(Y);if(de>=65&&de<=90||de>=97&&de<=122||de===95||de===36||de>127){let f=Y;Y++;while(Y<fe){let ne=P.charCodeAt(Y);if(ne>=65&&ne<=90||ne>=97&&ne<=122||ne>=48&&ne<=57||ne===95||ne===36||ne>127)Y++;else break}if(this.firstUnits[de]===1&&this.lengths[Math.min(Y-f,64)]===1){let ne=P.substring(f,Y),me=this.names.get(ne);if(me!==void 0){if(G.add(ne),me.kind==="function"||me.kind==="variable")V=!0}}}else Y++}return V}}function wn(P,G){let V=0;while(V<P.length){let Y=P.charCodeAt(V);if(Y===ke||Y===ve||Y===We){let Xe=Y;V++;while(V<P.length)if(P.charCodeAt(V)===nt)V+=2;else if(P.charCodeAt(V++)===Xe)break;continue}if(Y===ie&&P.charCodeAt(V+1)===ie){V+=2;while(V<P.length&&P.charCodeAt(V)!==Se&&P.charCodeAt(V)!==Oe)V++;continue}if(Y===ie&&P.charCodeAt(V+1)===ye){let Xe=P.indexOf("*/",V+2);V=Xe===-1?P.length:Xe+2;continue}if(!a(Y)){V++;continue}let fe=V++;while(V<P.length&&i(P.charCodeAt(V)))V++;let de=fe-1,f=V;while(de>=0&&He(P.charCodeAt(de)))de--;while(f<P.length&&He(P.charCodeAt(f)))f++;let ne=de>=0?P.charCodeAt(de):0,me=f<P.length?P.charCodeAt(f):0,T=fe>=3&&P.slice(fe-3,fe)==="...";if(me===it||ne===At&&!T)continue;if(me===le&&(ne===j||ne===st))continue;G.add(P.slice(fe,V))}}function Qn(P,G,V,Y,fe){let de=new Map;if(fe){let e=0;for(let X of P)if(X.kind==="class"&&!X.isExported){if(de.set(X.name,X),!G.has(X.name))G.set(X.name,X)}else if(!X.isExported&&(X.kind==="type"||X.kind==="interface")&&["variable","function"].includes(G.get(X.name)?.kind??""));else P[e++]=X;P.length=e}let f=new Set(P),ne=new Set,me=new Set,T=new Set;for(let e of P)if(me.add(e.name),e.kind!=="type"&&e.kind!=="interface")T.add(e.name);let Xe=new $n(G),et=new Map;for(let[e,X]of Y){let oe=G.get(e);if(oe?.kind==="variable"||oe?.kind==="function")et.set(e,X[0])}let Q=new Set,Ce=new Set,Le=new Set,ee=new Set,pe=(e)=>{if(Xe.scan(e.text,Le))nr(e,ee,et.size?{candidates:et,references:Q}:void 0)},Ae=new Set;for(let e=0;e<P.length;e++){let X=P[e];if(X.kind!=="import"){if(pe(X),typeof X.value==="string")wn(X.value,Ae)}}for(;;){let e=[];for(let[N,ae]of G){if(ne.has(N))continue;if((ae.kind==="function"||ae.kind==="variable"?ee:Le).has(N)||ae.kind!=="function"&&Ae.has(N)){let ge=de.get(N);if(ge){for(let Qe of[ge,ae])if(!f.has(Qe))e.push(Qe),f.add(Qe);me.add(N)}else if(!(ae.kind==="function"||ae.kind==="variable"?T:me).has(N)){let Qe=ae.kind==="function"?V.get(N):void 0;if(Qe)for(let he of Qe)e.push(he);else e.push(ae);if(me.add(N),ae.kind==="function"||ae.kind==="variable")T.add(N)}ne.add(N)}}for(let[N,ae]of Y){if(!et.has(N)||Ce.has(N)||!Q.has(N))continue;for(let Ee of ae)if(!f.has(Ee))e.push(Ee),f.add(Ee);Ce.add(N)}if(e.length===0)break;e.sort((N,ae)=>(N.start??1/0)-(ae.start??1/0));let X=[],oe=0;for(let N=0;N<P.length;N++){let ae=P[N].start??1/0;while(oe<e.length&&(e[oe].start??1/0)<=ae)X.push(e[oe++]);X.push(P[N])}while(oe<e.length)X.push(e[oe++]);P.length=0;for(let N=0;N<X.length;N++)P.push(X[N]);for(let N of e)if(N.kind!=="import"){if(pe(N),typeof N.value==="string")wn(N.value,Ae)}}}
38
+ export{Li,Wa,M,F,jt};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{Ot,It,c,Ne,ot,Lt,Nt,at,ct,lt,Ft,ut,Bt,Wt}from"./chunk-qbk49jz5.js";function O(t){return t.endsWith(".stx")}function h(t){let n=[],s=/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,o;while((o=s.exec(t))!==null){let r=o[1]??"",i=/\blang\s*=\s*["']([^"']+)["']/i.exec(r)?.[1]?.toLowerCase()??(/\b(?:type\s*=\s*["'](?:text\/)?typescript["']|typescript)\b/i.test(r)?"ts":"js"),e=/\bserver\b/i.test(r)?"server":/\bclient\b/i.test(r)?"client":"universal";n.push({content:o[2]??"",kind:"script",attrs:r,context:e,lang:i,start:o.index})}return n}function y(t){let n=[],s=/^[ \t]*@ts[ \t]*(?:\r?\n|$)/gm,o;while((o=s.exec(t))!==null){let r=s.lastIndex,i=/^[ \t]*@endts[ \t]*(?:\r?\n|$)/gm;i.lastIndex=r;let e=i.exec(t),l=e?.index??t.length;if(n.push({content:t.slice(r,l),kind:"ts",attrs:"",context:"universal",lang:"ts",start:o.index}),!e)break;s.lastIndex=i.lastIndex}return n}function Ca(t){return[...h(t),...y(t)].sort((n,s)=>n.start-s.start)}function k(t){if(t.kind==="ts"||t.context!=="universal"||t.lang==="ts")return!0;return/\b(?:defineProps|defineEmits|defineExpose|defineSlots)\b|\bexport\s|\b(?:interface|type)\s+[A-Za-z_$]/.test(t.content)}function _(t){let n=/(?:\$?props)\s+as\s+/g,s;while((s=n.exec(t))!==null){let o=n.lastIndex;while(o<t.length&&/\s/.test(t[o]))o++;if(t[o]==="{"){let e=c(t,o,"{","}");if(e!==-1)return t.slice(o,e+1).trim();continue}let r=/^[A-Za-z_$][\w$]*/.exec(t.slice(o))?.[0];if(!r)continue;let i=o+r.length;while(i<t.length&&/\s/.test(t[i]))i++;if(t[i]==="<"){let e=c(t,i,"<",">");if(e!==-1)i=e+1}return t.slice(o,i).trim()}return null}function w(t){return/\b(?:const|let|var)\s+\$?props\s*:\s*([^=;\n]+)/.exec(t)?.[1]?.trim()??null}function T(t){let n=/^\s*(?:\|\||\?\?)\s*([^;\n]+)/.exec(t)?.[1]?.trim();if(/^['"`]/.test(n??""))return"string";if(/^(?:true|false)\b/.test(n??""))return"boolean";if(/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)\b/.test(n??""))return"number";if(/^\[/.test(n??""))return"unknown[]";if(/^\{/.test(n??""))return"Record<string, unknown>";if(/^\s*(?:===?|!==?)\s*(?:true|false)\b/.test(t))return"boolean";return"unknown"}function E(t,n){if(!t||t==="unknown")return n;if(n==="unknown"||t===n)return t;return[...new Set([...t.split(" | "),...n.split(" | ")])].join(" | ")}function P(t){let n=It(t),s=new Map,o=/\$props(?:\.([A-Za-z_$][\w$]*)|\[\s*(['"])([^'"\n]+)\2\s*\])/g,r;while((r=o.exec(t))!==null){if(n.slice(r.index,r.index+6)!=="$props")continue;let e=r[1]??r[3],l=T(t.slice(o.lastIndex));s.set(e,E(s.get(e),l))}if(s.size===0)return null;return{type:`{ ${[...s].map(([e,l])=>`${/^[A-Za-z_$][\w$]*$/.test(e)?e:JSON.stringify(e)}?: ${l}`).join(", ")} }`}}function v(t){let n=ut(t,null);if(n)return n;let s=_(t)??w(t);if(!s)return P(t);if(/^[A-Za-z_$][\w$]*$/.test(s)){let o=s.replace(/[$]/g,"\\$&");if(new RegExp(`\\bexport\\s+(?:declare\\s+)?(?:interface|type)\\s+${o}\\b`).test(t))return{type:s}}return ut(`${t}
3
- defineProps<${s}>()`,null)}function A(t){return Lt(t)}function S(t){let n=It(t).trimStart();if(n==="")return!0;return/^(?:import\b|export\b|declare\b|interface\b|type\b|(?:export\s+)?namespace\b|(?:export\s+)?module\b|(?:abstract\s+)?class\b|const\b|let\b|var\b|(?:async\s+)?function\b)/.test(n)}function C(t){let n=[],s=0,o=0,r=0;while(r<t.length){let e=t[r],l=Ot(t,r);if(l>r){r=l;continue}if(e==="{"||e==="["||e==="(")o++;else if(e==="}"||e==="]"||e===")")o=Math.max(0,o-1);if((e===";"||e===`
4
- `)&&o===0){let a=r+1;if(!S(t.slice(s,a)))n.push([s,a]);s=a}r++}if(s<t.length&&!S(t.slice(s)))n.push([s,t.length]);let i=t;for(let e=n.length-1;e>=0;e--)i=i.slice(0,n[e][0])+i.slice(n[e][1]);return i}function I(t){let s=Ca(t).filter(k).map((f)=>f.content).join(`
5
- `),o=null,r=Nt(s);if(r.passthrough)return s;if(s=r.script,r.options){let f=at(r.options,"props");if(f)o=ot(f)}let i=s,e=A(s),l=v(i),a=l?.type??o??"{}",m=Bt(i,null),d=Wt(i,null),g=Ne(i,"defineSlots")?.generic??null,x=l?.inlinedLocal;if(x)e=lt(e,x.name,x.declText);let p=`DefineComponent<${a}>`,u=[];if(m)u.push(`readonly __stxEmits?: ${m}`);if(g)u.push(`readonly __stxSlots?: ${g}`);if(d)u.push(`readonly __stxExposed?: ${d}`);if(u.length>0)p+=` & { ${u.join(", ")} }`;p=Ft(p),e=C(ct(e,p));let b=["import type { DefineComponent } from '@stacksjs/stx'",`type __DtsxStxComponentType = ${p}`,"const __dtsx_component__: __DtsxStxComponentType = null as unknown as __DtsxStxComponentType","export default __dtsx_component__"];if(e.trim()!=="")b.push(e);return b.join(`
2
+ import{At,Dt,c,Oe,tt,Pt,Rt,nt,rt,it,Mt,st,Ot,It}from"./chunk-rb602c8k.js";function O(t){return t.endsWith(".stx")}function h(t){let n=[],s=/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,o;while((o=s.exec(t))!==null){let r=o[1]??"",i=/\blang\s*=\s*["']([^"']+)["']/i.exec(r)?.[1]?.toLowerCase()??(/\b(?:type\s*=\s*["'](?:text\/)?typescript["']|typescript)\b/i.test(r)?"ts":"js"),e=/\bserver\b/i.test(r)?"server":/\bclient\b/i.test(r)?"client":"universal";n.push({content:o[2]??"",kind:"script",attrs:r,context:e,lang:i,start:o.index})}return n}function y(t){let n=[],s=/^[ \t]*@ts[ \t]*(?:\r?\n|$)/gm,o;while((o=s.exec(t))!==null){let r=s.lastIndex,i=/^[ \t]*@endts[ \t]*(?:\r?\n|$)/gm;i.lastIndex=r;let e=i.exec(t),l=e?.index??t.length;if(n.push({content:t.slice(r,l),kind:"ts",attrs:"",context:"universal",lang:"ts",start:o.index}),!e)break;s.lastIndex=i.lastIndex}return n}function Do(t){return[...h(t),...y(t)].sort((n,s)=>n.start-s.start)}function k(t){if(t.kind==="ts"||t.context!=="universal"||t.lang==="ts")return!0;return/\b(?:defineProps|defineEmits|defineExpose|defineSlots)\b|\bexport\s|\b(?:interface|type)\s+[A-Za-z_$]/.test(t.content)}function _(t){let n=/(?:\$?props)\s+as\s+/g,s;while((s=n.exec(t))!==null){let o=n.lastIndex;while(o<t.length&&/\s/.test(t[o]))o++;if(t[o]==="{"){let e=c(t,o,"{","}");if(e!==-1)return t.slice(o,e+1).trim();continue}let r=/^[A-Za-z_$][\w$]*/.exec(t.slice(o))?.[0];if(!r)continue;let i=o+r.length;while(i<t.length&&/\s/.test(t[i]))i++;if(t[i]==="<"){let e=c(t,i,"<",">");if(e!==-1)i=e+1}return t.slice(o,i).trim()}return null}function w(t){return/\b(?:const|let|var)\s+\$?props\s*:\s*([^=;\n]+)/.exec(t)?.[1]?.trim()??null}function T(t){let n=/^\s*(?:\|\||\?\?)\s*([^;\n]+)/.exec(t)?.[1]?.trim();if(/^['"`]/.test(n??""))return"string";if(/^(?:true|false)\b/.test(n??""))return"boolean";if(/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)\b/.test(n??""))return"number";if(/^\[/.test(n??""))return"unknown[]";if(/^\{/.test(n??""))return"Record<string, unknown>";if(/^\s*(?:===?|!==?)\s*(?:true|false)\b/.test(t))return"boolean";return"unknown"}function E(t,n){if(!t||t==="unknown")return n;if(n==="unknown"||t===n)return t;return[...new Set([...t.split(" | "),...n.split(" | ")])].join(" | ")}function P(t){let n=Dt(t),s=new Map,o=/\$props(?:\.([A-Za-z_$][\w$]*)|\[\s*(['"])([^'"\n]+)\2\s*\])/g,r;while((r=o.exec(t))!==null){if(n.slice(r.index,r.index+6)!=="$props")continue;let e=r[1]??r[3],l=T(t.slice(o.lastIndex));s.set(e,E(s.get(e),l))}if(s.size===0)return null;return{type:`{ ${[...s].map(([e,l])=>`${/^[A-Za-z_$][\w$]*$/.test(e)?e:JSON.stringify(e)}?: ${l}`).join(", ")} }`}}function v(t){let n=st(t,null);if(n)return n;let s=_(t)??w(t);if(!s)return P(t);if(/^[A-Za-z_$][\w$]*$/.test(s)){let o=s.replace(/[$]/g,"\\$&");if(new RegExp(`\\bexport\\s+(?:declare\\s+)?(?:interface|type)\\s+${o}\\b`).test(t))return{type:s}}return st(`${t}
3
+ defineProps<${s}>()`,null)}function A(t){return Pt(t)}function S(t){let n=Dt(t).trimStart();if(n==="")return!0;return/^(?:import\b|export\b|declare\b|interface\b|type\b|(?:export\s+)?namespace\b|(?:export\s+)?module\b|(?:abstract\s+)?class\b|const\b|let\b|var\b|(?:async\s+)?function\b)/.test(n)}function C(t){let n=[],s=0,o=0,r=0;while(r<t.length){let e=t[r],l=At(t,r);if(l>r){r=l;continue}if(e==="{"||e==="["||e==="(")o++;else if(e==="}"||e==="]"||e===")")o=Math.max(0,o-1);if((e===";"||e===`
4
+ `)&&o===0){let a=r+1;if(!S(t.slice(s,a)))n.push([s,a]);s=a}r++}if(s<t.length&&!S(t.slice(s)))n.push([s,t.length]);let i=t;for(let e=n.length-1;e>=0;e--)i=i.slice(0,n[e][0])+i.slice(n[e][1]);return i}function I(t){let s=Do(t).filter(k).map((f)=>f.content).join(`
5
+ `),o=null,r=Rt(s);if(r.passthrough)return s;if(s=r.script,r.options){let f=nt(r.options,"props");if(f)o=tt(f)}let i=s,e=A(s),l=v(i),a=l?.type??o??"{}",m=Ot(i,null),d=It(i,null),g=Oe(i,"defineSlots")?.generic??null,x=l?.inlinedLocal;if(x)e=it(e,x.name,x.declText);let p=`DefineComponent<${a}>`,u=[];if(m)u.push(`readonly __stxEmits?: ${m}`);if(g)u.push(`readonly __stxSlots?: ${g}`);if(d)u.push(`readonly __stxExposed?: ${d}`);if(u.length>0)p+=` & { ${u.join(", ")} }`;p=Mt(p),e=C(rt(e,p));let b=["import type { DefineComponent } from '@stacksjs/stx'",`type __DtsxStxComponentType = ${p}`,"const __dtsx_component__: __DtsxStxComponentType = null as unknown as __DtsxStxComponentType","export default __dtsx_component__"];if(e.trim()!=="")b.push(e);return b.join(`
6
6
  `)}
7
- export{O,Ca,I};
7
+ export{O,Do,I};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function Bi(m,b={}){let{mergeInterfaces:c=!0,mergeNamespaces:e=!0,mergeTypes:n=!1,mergeEnums:l=!0,deduplicateIdentical:g=!0,conflictStrategy:d="last",preserveAllComments:h=!0}=b,u=[],r=0,f=new Map,o=[];for(let i of m){let a=`${i.kind}:${i.name}`,s=f.get(a);if(!s)s=[],f.set(a,s),o.push(a);s.push(i)}let t=[];for(let i of o){let a=f.get(i),s=a[0];if(a.length===1){t.push(s);continue}if(!(s.kind==="interface"&&c||s.kind==="module"&&e||s.kind==="type"&&n||s.kind==="enum"&&l)){t.push(...a);continue}let p=a;if(g)p=y(a);if(p.length===1){t.push(p[0]);continue}let x;switch(s.kind){case"interface":x=k(p,d,h);break;case"module":x=w(p,d,h);break;case"enum":x=M(p,d,h);break;case"type":x=A(p,d,h);break;default:x=p[0]}t.push(x),r+=p.length-1,u.push({name:s.name,kind:s.kind,sourceCount:p.length,memberCount:x.members?.length||0})}return{declarations:t,mergedCount:r,merges:u}}function y(m){let b=new Map;for(let c of m){let e=D(c.text);if(!b.has(e))b.set(e,c);else{let n=b.get(e);if((c.leadingComments?.length||0)>(n.leadingComments?.length||0))b.set(e,c)}}return Array.from(b.values())}function D(m){return m.replace(/\s+/g," ").replace(/;\s*/g,";").trim()}function k(m,b,c){let e=m[0],n=new Map,l=[],g=c?new Set:null;for(let a of m){if(c&&a.leadingComments&&g){for(let s of a.leadingComments)if(!g.has(s))g.add(s),l.push(s)}if(a.members)for(let s of a.members)if(!n.get(s.name))n.set(s.name,s);else switch(b){case"first":break;case"last":n.set(s.name,s);break;case"error":throw Error(`Conflicting member '${s.name}' in interface '${e.name}'`)}}let d=Array.from(n.values()),h=d.map((a)=>` ${a.text}`).join(`
2
+ function da(m,b={}){let{mergeInterfaces:c=!0,mergeNamespaces:e=!0,mergeTypes:n=!1,mergeEnums:l=!0,deduplicateIdentical:g=!0,conflictStrategy:d="last",preserveAllComments:h=!0}=b,u=[],r=0,f=new Map,o=[];for(let i of m){let a=`${i.kind}:${i.name}`,s=f.get(a);if(!s)s=[],f.set(a,s),o.push(a);s.push(i)}let t=[];for(let i of o){let a=f.get(i),s=a[0];if(a.length===1){t.push(s);continue}if(!(s.kind==="interface"&&c||s.kind==="module"&&e||s.kind==="type"&&n||s.kind==="enum"&&l)){t.push(...a);continue}let p=a;if(g)p=y(a);if(p.length===1){t.push(p[0]);continue}let x;switch(s.kind){case"interface":x=k(p,d,h);break;case"module":x=w(p,d,h);break;case"enum":x=M(p,d,h);break;case"type":x=A(p,d,h);break;default:x=p[0]}t.push(x),r+=p.length-1,u.push({name:s.name,kind:s.kind,sourceCount:p.length,memberCount:x.members?.length||0})}return{declarations:t,mergedCount:r,merges:u}}function y(m){let b=new Map;for(let c of m){let e=D(c.text);if(!b.has(e))b.set(e,c);else{let n=b.get(e);if((c.leadingComments?.length||0)>(n.leadingComments?.length||0))b.set(e,c)}}return Array.from(b.values())}function D(m){return m.replace(/\s+/g," ").replace(/;\s*/g,";").trim()}function k(m,b,c){let e=m[0],n=new Map,l=[],g=c?new Set:null;for(let a of m){if(c&&a.leadingComments&&g){for(let s of a.leadingComments)if(!g.has(s))g.add(s),l.push(s)}if(a.members)for(let s of a.members)if(!n.get(s.name))n.set(s.name,s);else switch(b){case"first":break;case"last":n.set(s.name,s);break;case"error":throw Error(`Conflicting member '${s.name}' in interface '${e.name}'`)}}let d=Array.from(n.values()),h=d.map((a)=>` ${a.text}`).join(`
3
3
  `),u=e.generics||"",r=e.extends||"",f=new Set;for(let a of m)if(a.extends){let s=a.extends.split(",");for(let C of s){let p=C.trim();if(p)f.add(p)}}if(f.size>0)r=`extends ${Array.from(f).join(", ")}`;let o=e.isExported?"export ":"",t=e.modifiers?.includes("declare")?"declare ":"",i=`${o}${t}interface ${e.name}${u} ${r} {
4
4
  ${h}
5
5
  }`;return{...e,members:d,leadingComments:l.length>0?l:e.leadingComments,text:i.replace(/\s+\{/," {").replace(/\{\s*\n\s*\n/,`{
@@ -9,10 +9,10 @@ ${h}
9
9
  }`;return{...e,members:d,leadingComments:l.length>0?l:e.leadingComments,text:f}}function M(m,b,c){let e=m[0],n=new Map,l=[],g=c?new Set:null;for(let t of m){if(c&&t.leadingComments&&g){for(let i of t.leadingComments)if(!g.has(i))g.add(i),l.push(i)}if(t.members)for(let i of t.members)if(!n.get(i.name))n.set(i.name,i);else switch(b){case"first":break;case"last":n.set(i.name,i);break;case"error":throw Error(`Conflicting member '${i.name}' in enum '${e.name}'`)}}let d=Array.from(n.values()),h=d.map((t)=>` ${t.name}${t.value!==void 0?` = ${t.value}`:""}`).join(`,
10
10
  `),u=e.isExported?"export ":"",r=e.modifiers?.includes("declare")?"declare ":"",f=e.modifiers?.includes("const")?"const ":"",o=`${u}${r}${f}enum ${e.name} {
11
11
  ${h}
12
- }`;return{...e,members:d,leadingComments:l.length>0?l:e.leadingComments,text:o}}function A(m,b,c){let e=m[0],n=[],l=c?new Set:null,g=[],d=new Set;for(let o of m){if(c&&o.leadingComments&&l){for(let t of o.leadingComments)if(!l.has(t))l.add(t),n.push(t)}if(o.typeAnnotation&&!d.has(o.typeAnnotation))d.add(o.typeAnnotation),g.push(o.typeAnnotation)}if(g.length<=1)return{...e,leadingComments:n.length>0?n:e.leadingComments};let h=g.join(" | "),u=e.isExported?"export ":"",r=e.generics||"",f=`${u}type ${e.name}${r} = ${h}`;return{...e,typeAnnotation:h,leadingComments:n.length>0?n:e.leadingComments,text:f}}function Wi(m,b={}){let c=m.split(`
12
+ }`;return{...e,members:d,leadingComments:l.length>0?l:e.leadingComments,text:o}}function A(m,b,c){let e=m[0],n=[],l=c?new Set:null,g=[],d=new Set;for(let o of m){if(c&&o.leadingComments&&l){for(let t of o.leadingComments)if(!l.has(t))l.add(t),n.push(t)}if(o.typeAnnotation&&!d.has(o.typeAnnotation))d.add(o.typeAnnotation),g.push(o.typeAnnotation)}if(g.length<=1)return{...e,leadingComments:n.length>0?n:e.leadingComments};let h=g.join(" | "),u=e.isExported?"export ":"",r=e.generics||"",f=`${u}type ${e.name}${r} = ${h}`;return{...e,typeAnnotation:h,leadingComments:n.length>0?n:e.leadingComments,text:f}}function pa(m,b={}){let c=m.split(`
13
13
  `),e=new Map,n=null,l=0;for(let u=0;u<c.length;u++){let r=c[u],f=r.match(/^(export\s+)?(declare\s+)?interface\s+(\w+)/);if(f&&!n){n={name:f[3],start:u,lines:[r]},l=(r.match(/\{/g)||[]).length-(r.match(/\}/g)||[]).length;continue}if(n){if(n.lines.push(r),l+=(r.match(/\{/g)||[]).length-(r.match(/\}/g)||[]).length,l<=0){let o=e.get(n.name)||[];o.push({start:n.start,end:u,content:n.lines}),e.set(n.name,o),n=null,l=0}}}let g=Array.from(e.entries()).filter(([,u])=>u.length>1);if(g.length===0)return m;let d=[...c],h=new Set;for(let[u,r]of g){if(r.length<=1)continue;let[f,...o]=r,t=[],i=new Set;for(let C of r)for(let p of C.content){let x=p.trim();if(x.startsWith("interface")||x.startsWith("export")||x==="{"||x==="}")continue;if(x&&!i.has(x))i.add(x),t.push(p)}for(let C of o)for(let p=C.start;p<=C.end;p++)h.add(p);let a=f.content[0],s=[a.endsWith("{")?a:`${a} {`,...t,"}"];for(let C=f.start;C<=f.end;C++)h.add(C);d[f.start]=s.join(`
14
14
  `)}return d.filter((u,r)=>!h.has(r)||d[r].includes("interface")).join(`
15
15
  `).replace(/\n{3,}/g,`
16
16
 
17
17
  `)}
18
- export{Bi,Wi};
18
+ export{da,pa};
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import{z,tr,nr}from"./chunk-4cr1q0yf.js";import{Tn}from"./chunk-pnfjhm01.js";import{f}from"./chunk-587w6ktw.js";import{fe,x,de,pe,me,ge,he}from"./chunk-r46rw8gr.js";import{Fe,v}from"./chunk-9mdgtq38.js";import{Me}from"./chunk-bt2n0b75.js";function L(y,D){throw Error(D||`Unexpected value: ${y}`)}var V=null,j=[],q=[];function l(y,D,d=!0,b=["bun"]){let o="",m=D.sourceCode;if(m){let e=0;while(e<m.length&&(m.charCodeAt(e)===32||m.charCodeAt(e)===9||m.charCodeAt(e)===10||m.charCodeAt(e)===13))e++;if(e<m.length-2&&m.charCodeAt(e)===47&&m.charCodeAt(e+1)===47&&m.charCodeAt(e+2)===47){let i=Tn(m);if(i.length>0)for(let r=0;r<i.length;r++){if(o)o+=`
3
- `;o+=i[r]}}}let E=[],N=[],M=[],P=[],U=[],W=[],_=[],w=[],C=[];for(let e of y){let i=e.kind;switch(i){case"import":E.push(e);break;case"function":N.push(e);break;case"variable":M.push(e);break;case"interface":P.push(e);break;case"type":U.push(e);break;case"class":W.push(e);break;case"enum":_.push(e);break;case"module":w.push(e);break;case"export":C.push(e);break;case"namespace":w.push(e);break;case"unknown":break;default:L(i,`Unhandled declaration kind: ${i}`)}}let T=[],S=[],A=[],F=new Set;for(let e of C){let i=f(e.leadingComments,d);if(e.text.startsWith("export default")){let r=e.text.endsWith(";")?e.text:`${e.text};`;A.push(i+r)}else{let r=e.text.trim();if(!r.endsWith(";"))r+=";";let a=i+r;if(!F.has(a))if(F.add(a),a.includes("export type"))T.push(a);else S.push(a)}}let u=[];if(E.length>0){let{usedItems:e}=Me(y);for(let r of E){if(r.isSideEffect){let t=r.text.trim(),p=t.endsWith(";")?t:`${t};`;u.push(p);continue}let a=v(r.text);if(!a)continue;let{defaultName:s,namedItems:n,isTypeOnly:h,namespaceName:c}=a,g=s?e.has(s):!1,G=c?e.has(c):!1;if(a.isImportEquals){if(g){let t=r.text.trim();u.push(t.endsWith(";")?t:`${t};`)}else if(D.augmentationImports?.has(a.source)){let t=Fe(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}continue}let k="",I=0;for(let t=0;t<n.length;t++){let p=n[t];if(e.has(p.name)){if(I>0)k+=", ";if(!h&&p.isTypeOnly)k+="type ";k+=p.originalName===p.name?p.name:`${p.originalName} as ${p.name}`,I++}}if(g||G||I>0){let t=h?"import type ":"import ";if(G&&c){if(g&&s)t+=`${s}, `;t+=`* as ${c}`}else if(g&&s)t+=I>0?`${s}, { ${k} }`:s;else if(I>0)t+=`{ ${k} }`;let p=Fe(r.text);if(!p)throw Error("Cannot locate a grammatical module literal in the import declaration");t+=` from ${p};`,u.push(t)}else if(D.augmentationImports?.has(a.source)){let t=Fe(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}}let i=b.length;if(u.length>1){if(V!==b)V=b,j=b.map((n)=>`from '${n}`),q=b.map((n)=>`from "${n}`);let r=j,a=q,s=new Map;for(let n of u){let h=i;for(let c=0;c<b.length;c++)if(n.includes(r[c])||n.includes(a[c])){h=c;break}s.set(n,h)}u.sort((n,h)=>{let c=s.get(n),g=s.get(h);return c!==g?c-g:n.localeCompare(h)})}}for(let e=0;e<u.length;e++){if(o)o+=`
2
+ import{U,er,tr}from"./chunk-ynpxjf6d.js";import{gn}from"./chunk-aa3k6rcj.js";import{f}from"./chunk-587w6ktw.js";import{fe,x,de,pe,me,ge,he}from"./chunk-vdt9x6h8.js";import{Be,v}from"./chunk-s28gyv8z.js";import{Re}from"./chunk-7061vwkq.js";function V(y,D){throw Error(D||`Unexpected value: ${y}`)}var j=null,q=[],z=[];function l(y,D,d=!0,b=["bun"]){let o="",m=D.sourceCode;if(m){let e=0;while(e<m.length&&(m.charCodeAt(e)===32||m.charCodeAt(e)===9||m.charCodeAt(e)===10||m.charCodeAt(e)===13))e++;if(e<m.length-2&&m.charCodeAt(e)===47&&m.charCodeAt(e+1)===47&&m.charCodeAt(e+2)===47){let i=gn(m);if(i.length>0)for(let r=0;r<i.length;r++){if(o)o+=`
3
+ `;o+=i[r]}}}let E=[],N=[],M=[],P=[],W=[],_=[],F=[],w=[],C=[];for(let e of y){let i=e.kind;switch(i){case"import":E.push(e);break;case"function":N.push(e);break;case"variable":M.push(e);break;case"interface":P.push(e);break;case"type":W.push(e);break;case"class":_.push(e);break;case"enum":F.push(e);break;case"module":w.push(e);break;case"export":C.push(e);break;case"namespace":w.push(e);break;case"unknown":break;default:V(i,`Unhandled declaration kind: ${i}`)}}let T=[],S=[],A=[],K=new Set;for(let e of C){let i=f(e.leadingComments,d);if(e.text.startsWith("export default")){let r=e.text.endsWith(";")?e.text:`${e.text};`;A.push(i+r)}else{let r=e.text.trim();if(!r.endsWith(";"))r+=";";let a=i+r;if(!K.has(a))if(K.add(a),a.includes("export type"))T.push(a);else S.push(a)}}let u=[];if(E.length>0){let{usedItems:e}=Re(y);for(let r of E){if(r.isSideEffect){let t=r.text.trim(),p=t.endsWith(";")?t:`${t};`;u.push(p);continue}let a=v(r.text);if(!a)continue;let{defaultName:s,namedItems:n,isTypeOnly:h,namespaceName:c}=a,g=s?e.has(s):!1,L=c?e.has(c):!1;if(a.isImportEquals){if(g){let t=r.text.trim();u.push(t.endsWith(";")?t:`${t};`)}else if(D.augmentationImports?.has(a.source)){let t=Be(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}continue}let k="",I=0;for(let t=0;t<n.length;t++){let p=n[t];if(e.has(p.name)){if(I>0)k+=", ";if(!h&&p.isTypeOnly)k+="type ";k+=p.originalName===p.name?p.name:`${p.originalName} as ${p.name}`,I++}}if(g||L||I>0){let t=h?"import type ":"import ";if(L&&c){if(g&&s)t+=`${s}, `;t+=`* as ${c}`}else if(g&&s)t+=I>0?`${s}, { ${k} }`:s;else if(I>0)t+=`{ ${k} }`;let p=Be(r.text);if(!p)throw Error("Cannot locate a grammatical module literal in the import declaration");t+=` from ${p};`,u.push(t)}else if(D.augmentationImports?.has(a.source)){let t=Be(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}}let i=b.length;if(u.length>1){if(j!==b)j=b,q=b.map((n)=>`from '${n}`),z=b.map((n)=>`from "${n}`);let r=q,a=z,s=new Map;for(let n of u){let h=i;for(let c=0;c<b.length;c++)if(n.includes(r[c])||n.includes(a[c])){h=c;break}s.set(n,h)}u.sort((n,h)=>{let c=s.get(n),g=s.get(h);return c!==g?c-g:n.localeCompare(h)})}}for(let e=0;e<u.length;e++){if(o)o+=`
4
4
  `;o+=u[e]}for(let e=0;e<T.length;e++){if(o)o+=`
5
- `;o+=T[e]}let K=[N,M,P,U,W,_,w];for(let e=0;e<K.length;e++){let i=K[e];for(let r=0;r<i.length;r++){let a=i[r],s="",n=a.kind;switch(n){case"function":s=fe(a,d);break;case"variable":s=x(a,d);break;case"interface":s=de(a,d);break;case"type":s=pe(a,d);break;case"class":s=me(a,d);break;case"enum":s=ge(a,d);break;case"module":case"namespace":s=he(a,d);break;case"import":case"export":case"unknown":break;default:L(n,`Unhandled declaration kind in processor: ${n}`)}if(s){if(o)o+=`
5
+ `;o+=T[e]}let G=[N,M,P,W,_,F,w];for(let e=0;e<G.length;e++){let i=G[e];for(let r=0;r<i.length;r++){let a=i[r],s="",n=a.kind;switch(n){case"function":s=fe(a,d);break;case"variable":s=x(a,d);break;case"interface":s=de(a,d);break;case"type":s=pe(a,d);break;case"class":s=me(a,d);break;case"enum":s=ge(a,d);break;case"module":case"namespace":s=he(a,d);break;case"import":case"export":case"unknown":break;default:V(n,`Unhandled declaration kind in processor: ${n}`)}if(s){if(o)o+=`
6
6
  `;o+=s}}}for(let e=0;e<S.length;e++){if(o)o+=`
7
7
  `;o+=S[e]}for(let e=0;e<A.length;e++){if(o)o+=`
8
- `;o+=A[e]}if(C.length===0&&z(D.sourceCode)&&(y.some(nr)||!tr(o)))o+=`${o?`
8
+ `;o+=A[e]}if(C.length===0&&U(D.sourceCode)&&(y.some(tr)||!er(o)))o+=`${o?`
9
9
  `:""}export {};`;return o}
10
10
  export{l};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-5tn8854w.js";function ve(d={}){let{onBuildStart:u=!1,onBuildEnd:f=!0,onGenerated:l,onError:i,...c}=d,o,r,e=async()=>{let t={...c};if(!t.outdir&&o)t.outdir=o;if(!t.entrypoints&&r)t.entrypoints=r;try{let n=await s(t);l?.(n)}catch(n){let a=n instanceof Error?n:Error(String(n));if(i?.(a),!i)console.error("[dtsx] Generation failed:",a.message)}};return{name:"dtsx",esbuildOptions(t){if(t.outdir&&typeof t.outdir==="string")o=t.outdir;if(t.entryPoints){if(Array.isArray(t.entryPoints))r=t.entryPoints;else if(typeof t.entryPoints==="object")r=Object.values(t.entryPoints)}},async buildStart(){if(u)await e()},async buildEnd(t){if(f)await e()}}}var Na=ve,pr=ve,Fa=ve;
3
- export{ve,Na,pr,Fa};
2
+ import{s}from"./chunk-6m4fpfzj.js";function Ce(d={}){let{onBuildStart:u=!1,onBuildEnd:f=!0,onGenerated:l,onError:i,...c}=d,o,r,e=async()=>{let t={...c};if(!t.outdir&&o)t.outdir=o;if(!t.entrypoints&&r)t.entrypoints=r;try{let n=await s(t);l?.(n)}catch(n){let a=n instanceof Error?n:Error(String(n));if(i?.(a),!i)console.error("[dtsx] Generation failed:",a.message)}};return{name:"dtsx",esbuildOptions(t){if(t.outdir&&typeof t.outdir==="string")o=t.outdir;if(t.entryPoints){if(Array.isArray(t.entryPoints))r=t.entryPoints;else if(typeof t.entryPoints==="object")r=Object.values(t.entryPoints)}},async buildStart(){if(u)await e()},async buildEnd(t){if(f)await e()}}}var Da=Ce,fr=Ce,Pa=Ce;
3
+ export{Ce,Da,fr,Pa};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{basename as e,dirname as n,isAbsolute as i,join as o,relative as a,resolve as s}from"path";function Ui(t){if(!t||typeof t!=="string")throw Error("Invalid file path: must be a non-empty string");return t}function Hi(t){if(!t||typeof t!=="string")throw Error("Invalid directory path: must be a non-empty string");return t}function Ki(t){if(!t||typeof t!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return t}function qi(t){if(typeof t!=="string")throw TypeError("Invalid source code: must be a string");return t}function Ji(t){if(typeof t!=="string")throw TypeError("Invalid DTS content: must be a string");return t}function Yi(t){if(!t||typeof t!=="string")throw Error("Invalid module specifier: must be a non-empty string");return t}function Xi(t){if(!t||typeof t!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(t)&&!/^[A-Z_$]/.test(t));return t}function Zi(t){if(!t||typeof t!=="string")throw Error("Invalid declaration name: must be a non-empty string");return t}function Qi(t){if(!t||typeof t!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!t.startsWith("/")&&!/^[A-Z]:/i.test(t))throw Error("Invalid absolute path: must start with / or drive letter");return t}function es(t){if(!t||typeof t!=="string")throw Error("Invalid relative path: must be a non-empty string");if(t.startsWith("/")||/^[A-Z]:/i.test(t))throw Error("Invalid relative path: must not be absolute");return t}function ts(t){if(typeof t!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(t)}catch{throw Error("Invalid JSON string: must be valid JSON")}return t}function ns(t,r){return typeof t==="string"||typeof t==="number"}function rs(t){return t}var is={join(t,...r){return o(t,...r)},dirname(t){return n(t)},basename(t){return e(t)},resolve(...t){return s(...t)},isAbsolute(t){return i(t)},relative(t,r){return a(t,r)}};
3
- export{Ui,Hi,Ki,qi,Ji,Yi,Xi,Zi,Qi,es,ts,ns,rs,is};
2
+ import{basename as e,dirname as n,isAbsolute as i,join as o,relative as a,resolve as s}from"path";function co(t){if(!t||typeof t!=="string")throw Error("Invalid file path: must be a non-empty string");return t}function lo(t){if(!t||typeof t!=="string")throw Error("Invalid directory path: must be a non-empty string");return t}function uo(t){if(!t||typeof t!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return t}function fo(t){if(typeof t!=="string")throw TypeError("Invalid source code: must be a string");return t}function po(t){if(typeof t!=="string")throw TypeError("Invalid DTS content: must be a string");return t}function mo(t){if(!t||typeof t!=="string")throw Error("Invalid module specifier: must be a non-empty string");return t}function go(t){if(!t||typeof t!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(t)&&!/^[A-Z_$]/.test(t));return t}function ho(t){if(!t||typeof t!=="string")throw Error("Invalid declaration name: must be a non-empty string");return t}function yo(t){if(!t||typeof t!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!t.startsWith("/")&&!/^[A-Z]:/i.test(t))throw Error("Invalid absolute path: must start with / or drive letter");return t}function bo(t){if(!t||typeof t!=="string")throw Error("Invalid relative path: must be a non-empty string");if(t.startsWith("/")||/^[A-Z]:/i.test(t))throw Error("Invalid relative path: must not be absolute");return t}function wo(t){if(typeof t!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(t)}catch{throw Error("Invalid JSON string: must be valid JSON")}return t}function xo(t,r){return typeof t==="string"||typeof t==="number"}function Co(t){return t}var vo={join(t,...r){return o(t,...r)},dirname(t){return n(t)},basename(t){return e(t)},resolve(...t){return s(...t)},isAbsolute(t){return i(t)},relative(t,r){return a(t,r)}};
3
+ export{co,lo,uo,fo,po,mo,go,ho,yo,bo,wo,xo,Co,vo};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{In}from"./chunk-nnayqrp5.js";var g=new Set(["This","True","False","Null","Undefined","Void","Never","Any","Unknown","Object","Infinity","NaN"]);function f(e,o={strings:!0}){let c="",n=0;while(n<e.length){let t=e.slice(n,n+2);if(t==="//"){let s=e.indexOf(`
2
+ import{wn}from"./chunk-6yvk3q1e.js";var g=new Set(["This","True","False","Null","Undefined","Void","Never","Any","Unknown","Object","Infinity","NaN"]);function f(e,o={strings:!0}){let c="",n=0;while(n<e.length){let t=e.slice(n,n+2);if(t==="//"){let s=e.indexOf(`
3
3
  `,n),a=s===-1?e.length:s;c+=" ".repeat(a-n),n=a;continue}if(t==="/*"){let s=e.indexOf("*/",n+2),a=s===-1?e.length:s+2;for(let r=n;r<a;r++)c+=e[r]===`
4
4
  `?`
5
5
  `:" ";n=a;continue}let i=e[n];if(o.strings&&(i==='"'||i==="'"||i==="`")){let s=i;c+=" ",n++;while(n<e.length){if(e[n]==="\\"){c+=" ",n+=2;continue}if(e[n]===s){c+=" ",n++;break}c+=e[n]===`
6
6
  `?`
7
- `:" ",n++}continue}c+=i,n++}return c}function m(e){let o=new Set,c=[/\b(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:type|interface|class|enum|namespace|module)\s+([A-Za-z_$][\w$]*)/g,/\b(?:export\s+)?(?:declare\s+)?(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)/g,/\b(?:export\s+)?declare\s+(?:const|let|var)\s+([A-Za-z_$][\w$]*)/g];for(let n of c)for(let t of e.matchAll(n))o.add(t[1]);return o}function d(e){let o=new Set;for(let c of e.matchAll(/\bimport\s+(?:type\s+)?([\s\S]*?)\s+from\s*['"`]/g)){let n=c[1],t=/\*\s*as\s+([A-Za-z_$][\w$]*)/.exec(n);if(t)o.add(t[1]);let i=n.split("{")[0].replace(/\*\s*as\s+[A-Za-z_$][\w$]*/,"");for(let a of i.split(",")){let r=a.trim();if(/^[A-Za-z_$][\w$]*$/.test(r))o.add(r)}let s=/\{([\s\S]*?)\}/.exec(n);if(s)for(let a of s[1].split(",")){let r=a.trim().replace(/^type\s+/,"");if(!r)continue;let l=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(r);o.add(l?l[1]:r.split(/\s+/)[0])}}for(let c of e.matchAll(/\bimport\s*\(\s*['"`][^'"`]*['"`]\s*\)\s*\.\s*([A-Za-z_$][\w$]*)/g))o.add(c[1]);return o}function p(e){let o=new Set,c=(t)=>{for(let i of t.split(",")){let s=i.trim().split(/\s+|=/)[0]?.trim();if(s&&/^[A-Za-z_$][\w$]*$/.test(s))o.add(s)}},n=/\b(?:type|interface|class|function)\s+[A-Za-z_$][\w$]*\s*<([^<>]*(?:<[^<>]*>[^<>]*)*)>/g;for(let t of e.matchAll(n))c(t[1]);for(let t of e.matchAll(/(?:\b[A-Za-z_$][\w$]*)?\s*<([^<>()]*)>\s*\(/g))c(t[1]);for(let t of e.matchAll(/\binfer\s+([A-Za-z_$][\w$]*)/g))o.add(t[1]);for(let t of e.matchAll(/\[\s*([A-Za-z_$][\w$]*)\s+in\b/g))o.add(t[1]);return o}function h(e){let o=new Map,c=(t)=>{let i=1;for(let s=0;s<t&&s<e.length;s++)if(e.charCodeAt(s)===10)i++;return i},n=(t,i,s)=>{for(let a of t.matchAll(/\b([A-Z][\w$]*)\b/g)){let r=a[1];if(o.has(r))continue;let l=t.slice(a.index+r.length);if(/^\s*\??:/.test(l))continue;o.set(r,{line:c(i),context:s.trim().slice(0,120)})}};for(let t of e.matchAll(/\btype\s+[A-Za-z_$][\w$]*\s*(?:<[^=]*?>)?\s*=([^;]*)/g))n(t[1],t.index+t[0].indexOf("="),t[0]);for(let t of e.matchAll(/\b(?:extends|implements)\s+([^{;]*)/g))n(t[1],t.index,t[0]);for(let t of e.matchAll(/:\s*([^;,){}\n=]+)/g))n(t[1],t.index,t[0]);for(let t of e.matchAll(/<([^<>()]*)>/g))n(t[1],t.index,t[0]);return o}function On(e){let o=f(e),c=f(e,{strings:!1}),n=new Set([...m(o),...d(c),...p(o),...In,...g]),t=[];for(let[i,s]of h(o)){if(n.has(i))continue;if(new RegExp(`[\\w$]\\s*\\.\\s*${i}\\b`).test(o))continue;t.push({name:i,line:s.line,context:s.context})}return t.sort((i,s)=>i.line-s.line||i.name.localeCompare(s.name))}
8
- export{On};
7
+ `:" ",n++}continue}c+=i,n++}return c}function m(e){let o=new Set,c=[/\b(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:type|interface|class|enum|namespace|module)\s+([A-Za-z_$][\w$]*)/g,/\b(?:export\s+)?(?:declare\s+)?(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)/g,/\b(?:export\s+)?declare\s+(?:const|let|var)\s+([A-Za-z_$][\w$]*)/g];for(let n of c)for(let t of e.matchAll(n))o.add(t[1]);return o}function d(e){let o=new Set;for(let c of e.matchAll(/\bimport\s+(?:type\s+)?([\s\S]*?)\s+from\s*['"`]/g)){let n=c[1],t=/\*\s*as\s+([A-Za-z_$][\w$]*)/.exec(n);if(t)o.add(t[1]);let i=n.split("{")[0].replace(/\*\s*as\s+[A-Za-z_$][\w$]*/,"");for(let a of i.split(",")){let r=a.trim();if(/^[A-Za-z_$][\w$]*$/.test(r))o.add(r)}let s=/\{([\s\S]*?)\}/.exec(n);if(s)for(let a of s[1].split(",")){let r=a.trim().replace(/^type\s+/,"");if(!r)continue;let l=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(r);o.add(l?l[1]:r.split(/\s+/)[0])}}for(let c of e.matchAll(/\bimport\s*\(\s*['"`][^'"`]*['"`]\s*\)\s*\.\s*([A-Za-z_$][\w$]*)/g))o.add(c[1]);return o}function p(e){let o=new Set,c=(t)=>{for(let i of t.split(",")){let s=i.trim().split(/\s+|=/)[0]?.trim();if(s&&/^[A-Za-z_$][\w$]*$/.test(s))o.add(s)}},n=/\b(?:type|interface|class|function)\s+[A-Za-z_$][\w$]*\s*<([^<>]*(?:<[^<>]*>[^<>]*)*)>/g;for(let t of e.matchAll(n))c(t[1]);for(let t of e.matchAll(/(?:\b[A-Za-z_$][\w$]*)?\s*<([^<>()]*)>\s*\(/g))c(t[1]);for(let t of e.matchAll(/\binfer\s+([A-Za-z_$][\w$]*)/g))o.add(t[1]);for(let t of e.matchAll(/\[\s*([A-Za-z_$][\w$]*)\s+in\b/g))o.add(t[1]);return o}function h(e){let o=new Map,c=(t)=>{let i=1;for(let s=0;s<t&&s<e.length;s++)if(e.charCodeAt(s)===10)i++;return i},n=(t,i,s)=>{for(let a of t.matchAll(/\b([A-Z][\w$]*)\b/g)){let r=a[1];if(o.has(r))continue;let l=t.slice(a.index+r.length);if(/^\s*\??:/.test(l))continue;o.set(r,{line:c(i),context:s.trim().slice(0,120)})}};for(let t of e.matchAll(/\btype\s+[A-Za-z_$][\w$]*\s*(?:<[^=]*?>)?\s*=([^;]*)/g))n(t[1],t.index+t[0].indexOf("="),t[0]);for(let t of e.matchAll(/\b(?:extends|implements)\s+([^{;]*)/g))n(t[1],t.index,t[0]);for(let t of e.matchAll(/:\s*([^;,){}\n=]+)/g))n(t[1],t.index,t[0]);for(let t of e.matchAll(/<([^<>()]*)>/g))n(t[1],t.index,t[0]);return o}function bn(e){let o=f(e),c=f(e,{strings:!1}),n=new Set([...m(o),...d(c),...p(o),...wn,...g]),t=[];for(let[i,s]of h(o)){if(n.has(i))continue;if(new RegExp(`[\\w$]\\s*\\.\\s*${i}\\b`).test(o))continue;t.push({name:i,line:s.line,context:s.context})}return t.sort((i,s)=>i.line-s.line||i.name.localeCompare(s.name))}
8
+ export{bn};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- class Xt{config;types=new Map;imports=new Map;relationships=[];usageMap=new Map;constructor(e={}){this.config={types:!1,relationships:!1,usage:!1,imports:!1,importUsage:!1,importRelationships:!1,...e}}trackType(e,s){if(!this.config.types)return;if(["interface","type","class","enum"].includes(e.kind)){if(this.types.get(e.name))return;let i={name:e.name,kind:e.kind,file:s,usedBy:new Set,references:new Set,extendsFrom:e.extends?[e.extends]:void 0,implementsFrom:e.implements};if(this.types.set(e.name,i),this.config.relationships){if(e.extends)this.relationships.push({from:e.name,to:e.extends,kind:"extends",file:s});if(e.implements)for(let n of e.implements)this.relationships.push({from:e.name,to:n,kind:"implements",file:s})}}}trackTypeUsage(e,s,t){if(!this.config.usage)return;let i=this.types.get(e);if(i)i.usedBy.add(s);let n=this.usageMap.get(e)||new Set;if(n.add(`${t}:${s}`),this.usageMap.set(e,n),this.config.relationships)this.relationships.push({from:s,to:e,kind:"uses",file:t})}trackImport(e,s,t,i){if(!this.config.imports)return;let n={source:e,specifiers:s,isTypeOnly:t,file:i,usedSpecifiers:new Set,unusedSpecifiers:new Set(s)},r=this.imports.get(i)||[];r.push(n),this.imports.set(i,r)}trackImportUsage(e,s){if(!this.config.importUsage)return;let t=this.imports.get(s);if(!t)return;for(let i of t)if(i.specifiers.includes(e))i.usedSpecifiers.add(e),i.unusedSpecifiers.delete(e)}trackTypeReference(e,s){if(!this.config.types)return;let t=this.types.get(e);if(t)t.references.add(s)}getResults(){let e=[],s=[];for(let[n,r]of this.types)if(r.usedBy.size===0&&r.references.size===0)e.push(n);for(let n of this.imports.values())for(let r of n)if(r.unusedSpecifiers.size===r.specifiers.length)s.push(r);let t=this.detectCircularReferences(),i={totalTypes:this.types.size,usedTypes:this.types.size-e.length,unusedTypes:e.length,totalImports:Array.from(this.imports.values()).flat().length,usedImports:Array.from(this.imports.values()).flat().filter((n)=>n.usedSpecifiers.size>0).length,unusedImports:s.length,totalRelationships:this.relationships.length,circularDependencies:t.length};return{types:this.types,imports:this.imports,relationships:this.relationships,unusedTypes:e,unusedImports:s,circularReferences:t,statistics:i}}detectCircularReferences(){let e=[],s=new Set,t=[],i=(n)=>{if(t.includes(n)){let o=t.indexOf(n);e.push(t.slice(o));return}if(s.has(n))return;s.add(n),t.push(n);let r=this.relationships.filter((o)=>o.from===n&&(o.kind==="extends"||o.kind==="implements"||o.kind==="references")).map((o)=>o.to);for(let o of r)i(o);t.pop()};for(let n of this.types.keys())i(n);return e}clear(){this.types.clear(),this.imports.clear(),this.relationships=[],this.usageMap.clear()}formatResults(){let e=this.getResults(),s=["=== Tracking Results ===",""];if(s.push("Statistics:"),s.push(` Total types: ${e.statistics.totalTypes}`),s.push(` Used types: ${e.statistics.usedTypes}`),s.push(` Unused types: ${e.statistics.unusedTypes}`),s.push(` Total imports: ${e.statistics.totalImports}`),s.push(` Used imports: ${e.statistics.usedImports}`),s.push(` Unused imports: ${e.statistics.unusedImports}`),s.push(` Type relationships: ${e.statistics.totalRelationships}`),s.push(` Circular dependencies: ${e.statistics.circularDependencies}`),s.push(""),e.unusedTypes.length>0){s.push("Unused types:");for(let t of e.unusedTypes){let i=e.types.get(t);s.push(` - ${t} (${i?.kind}) in ${i?.file}`)}s.push("")}if(e.unusedImports.length>0){s.push("Unused imports:");for(let t of e.unusedImports)s.push(` - ${t.source} in ${t.file}`),s.push(` Specifiers: ${Array.from(t.unusedSpecifiers).join(", ")}`);s.push("")}if(e.circularReferences.length>0){s.push("Circular references:");for(let t of e.circularReferences)s.push(` - ${t.join(" -> ")} -> ${t[0]}`);s.push("")}return s.join(`
3
- `)}}function Zt(e){return new Xt(e)}function Qt(e,s,t){for(let i of e){if(t.trackType(i,s),i.typeAnnotation){let n=p(i.typeAnnotation);for(let r of n)t.trackTypeUsage(r,i.name,s)}if(i.extends)t.trackTypeUsage(i.extends,i.name,s);if(i.implements)for(let n of i.implements)t.trackTypeUsage(n,i.name,s);if(i.kind==="import"&&i.source&&i.specifiers)t.trackImport(i.source,i.specifiers.map((n)=>n.name),i.isTypeOnly||!1,s)}}function p(e){let s=[],t=new Set(["string","number","boolean","any","unknown","void","never","null","undefined","object","symbol","bigint","true","false","readonly","keyof","typeof","infer","extends","in","out"]),i=/\b([A-Z]\w*)\b/g,n;while((n=i.exec(e))!==null){let r=n[1];if(!t.has(r.toLowerCase())&&!s.includes(r))s.push(r)}return s}function ss(e,s){let t=Zt({imports:!0,importUsage:!0,importRelationships:!0,...s});for(let[i,n]of e)Qt(n,i,t);return t.getResults()}function os(e,s){let t=Zt({types:!0,relationships:!0,usage:!0,...s});for(let[i,n]of e)Qt(n,i,t);return t.getResults()}
4
- export{Xt,Zt,Qt,ss,os};
2
+ class cn{config;types=new Map;imports=new Map;relationships=[];usageMap=new Map;constructor(e={}){this.config={types:!1,relationships:!1,usage:!1,imports:!1,importUsage:!1,importRelationships:!1,...e}}trackType(e,s){if(!this.config.types)return;if(["interface","type","class","enum"].includes(e.kind)){if(this.types.get(e.name))return;let i={name:e.name,kind:e.kind,file:s,usedBy:new Set,references:new Set,extendsFrom:e.extends?[e.extends]:void 0,implementsFrom:e.implements};if(this.types.set(e.name,i),this.config.relationships){if(e.extends)this.relationships.push({from:e.name,to:e.extends,kind:"extends",file:s});if(e.implements)for(let n of e.implements)this.relationships.push({from:e.name,to:n,kind:"implements",file:s})}}}trackTypeUsage(e,s,t){if(!this.config.usage)return;let i=this.types.get(e);if(i)i.usedBy.add(s);let n=this.usageMap.get(e)||new Set;if(n.add(`${t}:${s}`),this.usageMap.set(e,n),this.config.relationships)this.relationships.push({from:s,to:e,kind:"uses",file:t})}trackImport(e,s,t,i){if(!this.config.imports)return;let n={source:e,specifiers:s,isTypeOnly:t,file:i,usedSpecifiers:new Set,unusedSpecifiers:new Set(s)},r=this.imports.get(i)||[];r.push(n),this.imports.set(i,r)}trackImportUsage(e,s){if(!this.config.importUsage)return;let t=this.imports.get(s);if(!t)return;for(let i of t)if(i.specifiers.includes(e))i.usedSpecifiers.add(e),i.unusedSpecifiers.delete(e)}trackTypeReference(e,s){if(!this.config.types)return;let t=this.types.get(e);if(t)t.references.add(s)}getResults(){let e=[],s=[];for(let[n,r]of this.types)if(r.usedBy.size===0&&r.references.size===0)e.push(n);for(let n of this.imports.values())for(let r of n)if(r.unusedSpecifiers.size===r.specifiers.length)s.push(r);let t=this.detectCircularReferences(),i={totalTypes:this.types.size,usedTypes:this.types.size-e.length,unusedTypes:e.length,totalImports:Array.from(this.imports.values()).flat().length,usedImports:Array.from(this.imports.values()).flat().filter((n)=>n.usedSpecifiers.size>0).length,unusedImports:s.length,totalRelationships:this.relationships.length,circularDependencies:t.length};return{types:this.types,imports:this.imports,relationships:this.relationships,unusedTypes:e,unusedImports:s,circularReferences:t,statistics:i}}detectCircularReferences(){let e=[],s=new Set,t=[],i=(n)=>{if(t.includes(n)){let o=t.indexOf(n);e.push(t.slice(o));return}if(s.has(n))return;s.add(n),t.push(n);let r=this.relationships.filter((o)=>o.from===n&&(o.kind==="extends"||o.kind==="implements"||o.kind==="references")).map((o)=>o.to);for(let o of r)i(o);t.pop()};for(let n of this.types.keys())i(n);return e}clear(){this.types.clear(),this.imports.clear(),this.relationships=[],this.usageMap.clear()}formatResults(){let e=this.getResults(),s=["=== Tracking Results ===",""];if(s.push("Statistics:"),s.push(` Total types: ${e.statistics.totalTypes}`),s.push(` Used types: ${e.statistics.usedTypes}`),s.push(` Unused types: ${e.statistics.unusedTypes}`),s.push(` Total imports: ${e.statistics.totalImports}`),s.push(` Used imports: ${e.statistics.usedImports}`),s.push(` Unused imports: ${e.statistics.unusedImports}`),s.push(` Type relationships: ${e.statistics.totalRelationships}`),s.push(` Circular dependencies: ${e.statistics.circularDependencies}`),s.push(""),e.unusedTypes.length>0){s.push("Unused types:");for(let t of e.unusedTypes){let i=e.types.get(t);s.push(` - ${t} (${i?.kind}) in ${i?.file}`)}s.push("")}if(e.unusedImports.length>0){s.push("Unused imports:");for(let t of e.unusedImports)s.push(` - ${t.source} in ${t.file}`),s.push(` Specifiers: ${Array.from(t.unusedSpecifiers).join(", ")}`);s.push("")}if(e.circularReferences.length>0){s.push("Circular references:");for(let t of e.circularReferences)s.push(` - ${t.join(" -> ")} -> ${t[0]}`);s.push("")}return s.join(`
3
+ `)}}function ln(e){return new cn(e)}function un(e,s,t){for(let i of e){if(t.trackType(i,s),i.typeAnnotation){let n=p(i.typeAnnotation);for(let r of n)t.trackTypeUsage(r,i.name,s)}if(i.extends)t.trackTypeUsage(i.extends,i.name,s);if(i.implements)for(let n of i.implements)t.trackTypeUsage(n,i.name,s);if(i.kind==="import"&&i.source&&i.specifiers)t.trackImport(i.source,i.specifiers.map((n)=>n.name),i.isTypeOnly||!1,s)}}function p(e){let s=[],t=new Set(["string","number","boolean","any","unknown","void","never","null","undefined","object","symbol","bigint","true","false","readonly","keyof","typeof","infer","extends","in","out"]),i=/\b([A-Z]\w*)\b/g,n;while((n=i.exec(e))!==null){let r=n[1];if(!t.has(r.toLowerCase())&&!s.includes(r))s.push(r)}return s}function As(e,s){let t=ln({imports:!0,importUsage:!0,importRelationships:!0,...s});for(let[i,n]of e)un(n,i,t);return t.getResults()}function Ds(e,s){let t=ln({types:!0,relationships:!0,usage:!0,...s});for(let[i,n]of e)un(n,i,t);return t.getResults()}
4
+ export{cn,ln,un,As,Ds};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{createReadStream as l,createWriteStream as c,statSync as m}from"fs";import{createInterface as u}from"readline";class rn{config;profiles=[];cleanupTimer=null;constructor(e={}){this.config={maxMemoryMB:e.maxMemoryMB??512,chunkSize:e.chunkSize??65536,aggressiveGC:e.aggressiveGC??!0,maxDeclarationsInMemory:e.maxDeclarationsInMemory??1e4,profile:e.profile??!1,cleanupInterval:e.cleanupInterval??5000}}startMonitoring(){if(this.cleanupTimer=setInterval(()=>{this.checkMemoryAndCleanup()},this.config.cleanupInterval),this.cleanupTimer&&typeof this.cleanupTimer==="object"&&"unref"in this.cleanupTimer)this.cleanupTimer.unref()}stopMonitoring(){if(this.cleanupTimer)clearInterval(this.cleanupTimer),this.cleanupTimer=null}checkMemoryAndCleanup(){if(this.getMemoryStats().heapUsedMB>this.config.maxMemoryMB)this.triggerCleanup()}triggerCleanup(){if(this.config.aggressiveGC&&global.gc)global.gc()}getMemoryStats(){let e=process.memoryUsage();return{heapUsed:e.heapUsed,heapTotal:e.heapTotal,external:e.external,arrayBuffers:e.arrayBuffers,rss:e.rss,heapUsedMB:Math.ceil(e.heapUsed/1024/1024),percentUsed:Math.min(100,Math.round(e.heapUsed/e.heapTotal*100))}}async profile(e,t){if(!this.config.profile)return t();let r=this.getMemoryStats(),i=Date.now();try{return await t()}finally{let n=this.getMemoryStats(),s=Date.now()-i;this.profiles.push({timestamp:Date.now(),operation:e,memoryBefore:r,memoryAfter:n,duration:s})}}getProfiles(){return[...this.profiles]}clearProfiles(){this.profiles=[]}async*streamFile(e){let t=l(e,{encoding:"utf-8",highWaterMark:this.config.chunkSize}),r=u({input:t,crlfDelay:1/0});for await(let i of r)yield i}async processFileInChunks(e,t,r=1000){let i=[],n=[];for await(let s of this.streamFile(e))if(n.push(s),n.length>=r){let a=await t(n);i.push(...a),n=[],this.checkMemoryAndCleanup()}if(n.length>0){let s=await t(n);i.push(...s)}return i}async streamWrite(e,t){let r=c(e,{encoding:"utf-8"});return new Promise((i,n)=>{let s=async()=>{try{for await(let a of t)if(!r.write(a))await new Promise((o)=>r.once("drain",()=>o()));r.end(),r.once("finish",i)}catch(a){n(a)}};r.once("error",n),s()})}}class Rr{declarations=new Map;registry=new FinalizationRegistry((e)=>{this.declarations.delete(e)});maxSize;constructor(e=1e4){this.maxSize=e}add(e,t){if(this.declarations.size>=this.maxSize)this.evictOldest();let r=new WeakRef(t);this.declarations.set(e,r),this.registry.register(t,e)}get(e){return this.declarations.get(e)?.deref()}has(e){return this.declarations.get(e)?.deref()!==void 0}delete(e){this.declarations.delete(e)}clear(){this.declarations.clear()}get size(){return this.declarations.size}evictOldest(){let e=Math.ceil(this.maxSize*0.2),t=Array.from(this.declarations.keys());for(let r=0;r<e&&r<t.length;r++)this.declarations.delete(t[r])}}class Mr{value=null;loaded=!1;loader;constructor(e){this.loader=e}async get(){if(!this.loaded)this.value=await this.loader(),this.loaded=!0;return this.value}isLoaded(){return this.loaded}unload(){this.value=null,this.loaded=!1}}class Or{strings=new Map;maxSize;constructor(e=50000){this.maxSize=e}intern(e){if(e.length>100)return e;let t=this.strings.get(e);if(t!==void 0)return t;if(this.strings.size>=this.maxSize){let r=Array.from(this.strings.keys());for(let i=0;i<r.length/2;i++)this.strings.delete(r[i])}return this.strings.set(e,e),e}get size(){return this.strings.size}clear(){this.strings.clear()}}class Ir{pool=[];factory;reset;maxSize;constructor(e,t,r=1000){this.factory=e,this.reset=t,this.maxSize=r}acquire(){if(this.pool.length>0)return this.pool.pop();return this.factory()}release(e){if(this.pool.length<this.maxSize)this.reset(e),this.pool.push(e)}get size(){return this.pool.length}clear(){this.pool=[]}}function As(e,t={}){return{...e,memory:{maxMemoryMB:t.maxMemoryMB??512,chunkSize:t.chunkSize??65536,aggressiveGC:t.aggressiveGC??!0,maxDeclarationsInMemory:t.maxDeclarationsInMemory??1e4,profile:t.profile??!1,cleanupInterval:t.cleanupInterval??5000}}}function Ds(e){let r=m(e).size/1024/1024,i=r*4,n=65536;if(r>10)n=32768;if(r>50)n=16384;return{fileSizeMB:Math.round(r*100)/100,estimatedMemoryMB:Math.round(i*100)/100,recommendedChunkSize:n}}function Ps(e){return[`Heap: ${e.heapUsedMB}MB / ${Math.round(e.heapTotal/1024/1024)}MB (${e.percentUsed}%)`,`RSS: ${Math.round(e.rss/1024/1024)}MB`,`External: ${Math.round(e.external/1024/1024)}MB`].join(" | ")}function Rs(e={}){return new rn(e)}
3
- export{rn,Rr,Mr,Or,Ir,As,Ds,Ps,Rs};
2
+ import{createReadStream as l,createWriteStream as c,statSync as m}from"fs";import{createInterface as u}from"readline";class on{config;profiles=[];cleanupTimer=null;constructor(e={}){this.config={maxMemoryMB:e.maxMemoryMB??512,chunkSize:e.chunkSize??65536,aggressiveGC:e.aggressiveGC??!0,maxDeclarationsInMemory:e.maxDeclarationsInMemory??1e4,profile:e.profile??!1,cleanupInterval:e.cleanupInterval??5000}}startMonitoring(){if(this.cleanupTimer=setInterval(()=>{this.checkMemoryAndCleanup()},this.config.cleanupInterval),this.cleanupTimer&&typeof this.cleanupTimer==="object"&&"unref"in this.cleanupTimer)this.cleanupTimer.unref()}stopMonitoring(){if(this.cleanupTimer)clearInterval(this.cleanupTimer),this.cleanupTimer=null}checkMemoryAndCleanup(){if(this.getMemoryStats().heapUsedMB>this.config.maxMemoryMB)this.triggerCleanup()}triggerCleanup(){if(this.config.aggressiveGC&&global.gc)global.gc()}getMemoryStats(){let e=process.memoryUsage();return{heapUsed:e.heapUsed,heapTotal:e.heapTotal,external:e.external,arrayBuffers:e.arrayBuffers,rss:e.rss,heapUsedMB:Math.ceil(e.heapUsed/1024/1024),percentUsed:Math.min(100,Math.round(e.heapUsed/e.heapTotal*100))}}async profile(e,t){if(!this.config.profile)return t();let r=this.getMemoryStats(),i=Date.now();try{return await t()}finally{let n=this.getMemoryStats(),s=Date.now()-i;this.profiles.push({timestamp:Date.now(),operation:e,memoryBefore:r,memoryAfter:n,duration:s})}}getProfiles(){return[...this.profiles]}clearProfiles(){this.profiles=[]}async*streamFile(e){let t=l(e,{encoding:"utf-8",highWaterMark:this.config.chunkSize}),r=u({input:t,crlfDelay:1/0});for await(let i of r)yield i}async processFileInChunks(e,t,r=1000){let i=[],n=[];for await(let s of this.streamFile(e))if(n.push(s),n.length>=r){let a=await t(n);i.push(...a),n=[],this.checkMemoryAndCleanup()}if(n.length>0){let s=await t(n);i.push(...s)}return i}async streamWrite(e,t){let r=c(e,{encoding:"utf-8"});return new Promise((i,n)=>{let s=async()=>{try{for await(let a of t)if(!r.write(a))await new Promise((o)=>r.once("drain",()=>o()));r.end(),r.once("finish",i)}catch(a){n(a)}};r.once("error",n),s()})}}class Ar{declarations=new Map;registry=new FinalizationRegistry((e)=>{this.declarations.delete(e)});maxSize;constructor(e=1e4){this.maxSize=e}add(e,t){if(this.declarations.size>=this.maxSize)this.evictOldest();let r=new WeakRef(t);this.declarations.set(e,r),this.registry.register(t,e)}get(e){return this.declarations.get(e)?.deref()}has(e){return this.declarations.get(e)?.deref()!==void 0}delete(e){this.declarations.delete(e)}clear(){this.declarations.clear()}get size(){return this.declarations.size}evictOldest(){let e=Math.ceil(this.maxSize*0.2),t=Array.from(this.declarations.keys());for(let r=0;r<e&&r<t.length;r++)this.declarations.delete(t[r])}}class Dr{value=null;loaded=!1;loader;constructor(e){this.loader=e}async get(){if(!this.loaded)this.value=await this.loader(),this.loaded=!0;return this.value}isLoaded(){return this.loaded}unload(){this.value=null,this.loaded=!1}}class Pr{strings=new Map;maxSize;constructor(e=50000){this.maxSize=e}intern(e){if(e.length>100)return e;let t=this.strings.get(e);if(t!==void 0)return t;if(this.strings.size>=this.maxSize){let r=Array.from(this.strings.keys());for(let i=0;i<r.length/2;i++)this.strings.delete(r[i])}return this.strings.set(e,e),e}get size(){return this.strings.size}clear(){this.strings.clear()}}class Rr{pool=[];factory;reset;maxSize;constructor(e,t,r=1000){this.factory=e,this.reset=t,this.maxSize=r}acquire(){if(this.pool.length>0)return this.pool.pop();return this.factory()}release(e){if(this.pool.length<this.maxSize)this.reset(e),this.pool.push(e)}get size(){return this.pool.length}clear(){this.pool=[]}}function ms(e,t={}){return{...e,memory:{maxMemoryMB:t.maxMemoryMB??512,chunkSize:t.chunkSize??65536,aggressiveGC:t.aggressiveGC??!0,maxDeclarationsInMemory:t.maxDeclarationsInMemory??1e4,profile:t.profile??!1,cleanupInterval:t.cleanupInterval??5000}}}function gs(e){let r=m(e).size/1024/1024,i=r*4,n=65536;if(r>10)n=32768;if(r>50)n=16384;return{fileSizeMB:Math.round(r*100)/100,estimatedMemoryMB:Math.round(i*100)/100,recommendedChunkSize:n}}function hs(e){return[`Heap: ${e.heapUsedMB}MB / ${Math.round(e.heapTotal/1024/1024)}MB (${e.percentUsed}%)`,`RSS: ${Math.round(e.rss/1024/1024)}MB`,`External: ${Math.round(e.external/1024/1024)}MB`].join(" | ")}function ys(e={}){return new on(e)}
3
+ export{on,Ar,Dr,Pr,Rr,ms,gs,hs,ys};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function Zs(e,i){return e.getText?.()??i.slice(e.pos??0,e.end??i.length)}function Qs(e){return e.getFullText?.().match(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g)??[]}function mn(e){let i=e,s=!0;while(s){s=!1;let n=i.trimStart();if(n.startsWith("/*")){let r=n.indexOf("*/",2);if(r!==-1){i=n.slice(r+2),s=!0;continue}}if(n.startsWith("//")){let r=n.indexOf(`
3
- `);if(r!==-1)i=n.slice(r+1),s=!0;else i="",s=!0}}return i.trim()}function eo(e,i){let n=e.substring(0,i).split(`
4
- `),r=[],t=n.length-1,u=!1,a=[];while(t>=0){let l=n[t].trim();if(l.endsWith("*/")&&!u)u=!0,a.unshift(l);else if(l.startsWith("/*")&&u)a.unshift(l),r.unshift(...a),a=[],u=!1;else if(u)a.unshift(l);else if(l.startsWith("//"))r.unshift(l);else if(l.startsWith("*")&&(t>0&&n[t-1].trim().startsWith("/*")))r.unshift(l);else if(l===""&&r.length>0);else if(l!=="")break;t--}return r}function to(e){let i=!1,s="",n=!1;for(let r=0;r<e.length;r++){let t=e[r];if(!n&&!i&&(t==='"'||t==="'"||t==="`"))i=!0,s=t;else if(!n&&i&&t===s)i=!1;else if(t==="\\"&&!n){n=!0;continue}else if(!i&&t==="/"&&r<e.length-1){if(e[r+1]==="/")return e.substring(r)}n=!1}return null}function gn(e,i,s){let n=0,r=!1,t="",u=!1;if(!e.startsWith(i))return null;for(let a=0;a<e.length;a++){let l=e[a];if(!u&&(l==='"'||l==="'"||l==="`")){if(!r)r=!0,t=l;else if(l===t)r=!1}if(l==="\\"&&!u){u=!0;continue}if(u=!1,!r){if(e.substring(a,a+i.length)===i)n++;else if(e.substring(a,a+s.length)===s){if(n--,n===0)return{content:e.substring(0,a+s.length),rest:e.substring(a+s.length)}}}}return null}function no(e){let i=mn(e).trim(),s=i.match(/^(export\s+)?(async\s+)?function\s*(\*?)([a-zA-Z_$][\w$]*)/);if(!s)return null;let n=[];if(s[1])n.push("export");if(s[2])n.push("async");if(s[3])n.push("generator");let r=s[4],t=i.substring(s[0].length).trim(),u="";if(t.startsWith("<")){let o=gn(t,"<",">");if(o)u=o.content,t=o.rest.trim()}let a="";if(t.startsWith("(")){let o=gn(t,"(",")");if(o)a=o.content.slice(1,-1).trim(),t=o.rest.trim()}let l="void";if(t.startsWith(":")){let o=t.match(/^:\s*([^{;]+)/);if(o)l=o[1].trim()}return{name:r,generics:u,parameters:a,returnType:l,modifiers:n}}function ro(e){return/^\s*export\s+/.test(e)}function io(e){return/^\s*export\s+type\s+/.test(e)}function so(e){let i=mn(e).trim(),s=i.match(/^(export\s+)?(const|let|var)\s+([a-zA-Z_$][\w$]*)/);if(!s)return null;let n=s[2],r=s[3],t=i.substring(s[0].length).trim(),u;if(t.startsWith(":")){let l=t.indexOf("=");if(l!==-1)u=t.substring(1,l).trim(),t=t.substring(l).trim();else u=t.substring(1).replace(/;?\s*$/,"").trim(),t=""}let a;if(t.startsWith("="))a=t.substring(1).replace(/;?\s*$/,"").trim();return{kind:n,name:r,typeAnnotation:u,value:a}}
5
- export{Zs,Qs,mn,eo,to,gn,no,ro,io,so};
2
+ function Ro(e,i){return e.getText?.()??i.slice(e.pos??0,e.end??i.length)}function Mo(e){return e.getFullText?.().match(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g)??[]}function An(e){let i=e,s=!0;while(s){s=!1;let n=i.trimStart();if(n.startsWith("/*")){let r=n.indexOf("*/",2);if(r!==-1){i=n.slice(r+2),s=!0;continue}}if(n.startsWith("//")){let r=n.indexOf(`
3
+ `);if(r!==-1)i=n.slice(r+1),s=!0;else i="",s=!0}}return i.trim()}function Oo(e,i){let n=e.substring(0,i).split(`
4
+ `),r=[],t=n.length-1,u=!1,a=[];while(t>=0){let l=n[t].trim();if(l.endsWith("*/")&&!u)u=!0,a.unshift(l);else if(l.startsWith("/*")&&u)a.unshift(l),r.unshift(...a),a=[],u=!1;else if(u)a.unshift(l);else if(l.startsWith("//"))r.unshift(l);else if(l.startsWith("*")&&(t>0&&n[t-1].trim().startsWith("/*")))r.unshift(l);else if(l===""&&r.length>0);else if(l!=="")break;t--}return r}function Io(e){let i=!1,s="",n=!1;for(let r=0;r<e.length;r++){let t=e[r];if(!n&&!i&&(t==='"'||t==="'"||t==="`"))i=!0,s=t;else if(!n&&i&&t===s)i=!1;else if(t==="\\"&&!n){n=!0;continue}else if(!i&&t==="/"&&r<e.length-1){if(e[r+1]==="/")return e.substring(r)}n=!1}return null}function Dn(e,i,s){let n=0,r=!1,t="",u=!1;if(!e.startsWith(i))return null;for(let a=0;a<e.length;a++){let l=e[a];if(!u&&(l==='"'||l==="'"||l==="`")){if(!r)r=!0,t=l;else if(l===t)r=!1}if(l==="\\"&&!u){u=!0;continue}if(u=!1,!r){if(e.substring(a,a+i.length)===i)n++;else if(e.substring(a,a+s.length)===s){if(n--,n===0)return{content:e.substring(0,a+s.length),rest:e.substring(a+s.length)}}}}return null}function Lo(e){let i=An(e).trim(),s=i.match(/^(export\s+)?(async\s+)?function\s*(\*?)([a-zA-Z_$][\w$]*)/);if(!s)return null;let n=[];if(s[1])n.push("export");if(s[2])n.push("async");if(s[3])n.push("generator");let r=s[4],t=i.substring(s[0].length).trim(),u="";if(t.startsWith("<")){let o=Dn(t,"<",">");if(o)u=o.content,t=o.rest.trim()}let a="";if(t.startsWith("(")){let o=Dn(t,"(",")");if(o)a=o.content.slice(1,-1).trim(),t=o.rest.trim()}let l="void";if(t.startsWith(":")){let o=t.match(/^:\s*([^{;]+)/);if(o)l=o[1].trim()}return{name:r,generics:u,parameters:a,returnType:l,modifiers:n}}function No(e){return/^\s*export\s+/.test(e)}function Fo(e){return/^\s*export\s+type\s+/.test(e)}function Bo(e){let i=An(e).trim(),s=i.match(/^(export\s+)?(const|let|var)\s+([a-zA-Z_$][\w$]*)/);if(!s)return null;let n=s[2],r=s[3],t=i.substring(s[0].length).trim(),u;if(t.startsWith(":")){let l=t.indexOf("=");if(l!==-1)u=t.substring(1,l).trim(),t=t.substring(l).trim();else u=t.substring(1).replace(/;?\s*$/,"").trim(),t=""}let a;if(t.startsWith("="))a=t.substring(1).replace(/;?\s*$/,"").trim();return{kind:n,name:r,typeAnnotation:u,value:a}}
5
+ export{Ro,Mo,An,Oo,Io,Dn,Lo,No,Fo,Bo};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{se}from"./chunk-7pw9ayve.js";function $i(n,r,e,t={}){return{kind:n,name:r,text:e,isExported:t.isExported??!1,...t}}function Ei(n){if(typeof structuredClone==="function")return structuredClone(n);return JSON.parse(JSON.stringify(n))}function Nn(n,r,e=null){for(let t of n){r.enter?.(t,e);let o=r[t.kind];if(o)o(t,e);if(t.members&&t.members.length>0)Nn(t.members,r,t);r.leave?.(t,e)}}function Bo(n,r){let e=[];return Nn(n,{enter:(t)=>{if(r(t))e.push(t)}}),e}async function ki(n,r,e){let t=[],o=n.length;for(let a=0;a<n.length;a++){let i=n[a],s={...e,index:a,total:o,allDeclarations:n},l=await r(i,s);if(l===null)continue;else if(l===void 0)t.push(i);else if(Array.isArray(l))t.push(...l);else t.push(l)}return t}function Wo(...n){return async(r,e)=>{let t=r;for(let o of n){if(t===null)return null;if(Array.isArray(t)){let a=[];for(let i of t){let s=await o(i,e);if(s===null)continue;if(s===void 0)a.push(i);else if(Array.isArray(s))a.push(...s);else a.push(s)}t=a.length>0?a:null}else{let a=await o(t,e);if(a===null)t=null;else if(a===void 0);else t=a}}return t}}function Te(n,r){let e=new Set(Array.isArray(n)?n:[n]);return async(t,o)=>{if(e.has(t.kind))return r(t,o);return}}function _o(n,r){return async(e,t)=>{if(n(e))return r(e,t);return}}function it(n){let r={createDeclaration:$i,cloneDeclaration:Ei,modifyText:(e,t)=>({...e,text:t}),addModifier:(e,t)=>({...e,modifiers:[...e.modifiers||[],t]}),removeModifier:(e,t)=>({...e,modifiers:(e.modifiers||[]).filter((o)=>o!==t)})};return se({name:n.name,version:n.version,description:n.description,onBeforeFile:n.beforeParse?async(e)=>n.beforeParse(e.content,{filePath:e.filePath,phase:"before"}):void 0,onDeclarations:n.transform?async(e)=>ki(e.declarations,n.transform,{filePath:e.filePath,sourceCode:e.sourceCode,...r}):void 0,onAfterFile:n.afterGenerate?async(e)=>n.afterGenerate(e.content,{filePath:e.filePath,phase:"after"}):void 0})}function jo(n,r){let e=typeof n==="string"?new RegExp(n):n;return(t)=>{if(e.test(t.name)){let o=typeof r==="function"?r(t.name,t):t.name.replace(e,r),a=t.text.replace(new RegExp(`\\b${f(t.name)}\\b`),o);return{...t,name:o,text:a}}return}}function Ti(n,r){return(e)=>{if(e.kind==="import")return;if(r&&!r(e))return;let t=`${n}${e.name}`,o=e.text.replace(new RegExp(`\\b${f(e.name)}\\b`),t);return{...e,name:t,text:o}}}function Go(n,r){return(e)=>{if(e.kind==="import")return;if(r&&!r(e))return;let t=`${e.name}${n}`,o=e.text.replace(new RegExp(`\\b${f(e.name)}\\b`),t);return{...e,name:t,text:o}}}function Ai(n){let r=typeof n==="function"?n:(e)=>(typeof n==="string"?new RegExp(n):n).test(e.name);return(e)=>{if(r(e))return null;return}}function Vo(n){return(r)=>{let e=n(r);if(!e)return;let o=(Array.isArray(e)?e:[e]).map((a)=>{if(a.startsWith("/**"))return a;if(a.startsWith("/*"))return a;return`/** ${a} */`});return{...r,leadingComments:[...r.leadingComments||[],...o]}}}function zo(n){return(r)=>{if(!r.typeAnnotation)return;let e=n(r.typeAnnotation,r);if(e===null)return null;if(e===void 0)return;let t=r.text.replace(new RegExp(`:[ ]*${f(r.typeAnnotation)}`),`: ${e}`);return{...r,typeAnnotation:e,text:t}}}function Uo(n){return Te("function",(r)=>{if(!r.returnType)return;let e=n(r.returnType,r);if(e===null)return null;if(e===void 0)return;let t=r.text.replace(new RegExp(`\\):[ ]*${f(r.returnType)}`),`): ${e}`);return{...r,returnType:e,text:t}})}function Ho(n){return Te(["function","class"],(r)=>{if(!r.parameters)return;let e=n(r.parameters,r);if(e===null)return null;if(e===void 0)return;let t=e.map((a)=>{let i="";if(a.rest)i+="...";if(i+=a.name,a.optional)i+="?";if(a.type)i+=`: ${a.type}`;if(a.defaultValue)i+=` = ${a.defaultValue}`;return i}).join(", "),o=r.text.replace(/\([^)]*\)/,`(${t})`);return{...r,parameters:e,text:o}})}function Di(n,r){return(e)=>{if(r&&!r(e))return;if(e.modifiers?.includes(n))return;let t=[...e.modifiers||[],n],o=e.text;if(!o.includes(n)){let a=["function","class","interface","type","enum","const","let","var"];for(let i of a){let s=o.indexOf(i);if(s>=0){o=`${o.slice(0,s)}${n} ${o.slice(s)}`;break}}}return{...e,modifiers:t,text:o}}}var Pi=Te(["interface","type"],(n)=>{let r=n.text.replace(/(\n\s*)(\w+)(\??:\s)/g,"$1readonly $2$3");if(r===n.text)return;return{...n,text:r}}),Ko=Te(["interface","type"],(n)=>{let r=n.text.replace(/(\w+)\?:/g,"$1:");if(r===n.text)return;return{...n,text:r}}),qo=Te(["interface","type"],(n)=>{let r=n.text.replace(/(\w+)(?<!\?):/g,"$1?:");if(r===n.text)return;return{...n,text:r}});function Jo(n){let r=new RegExp(`@(${n.join("|")})\\b[^@]*`,"g");return(e)=>{if(!e.leadingComments?.length)return;let t=e.leadingComments.map((a)=>a.replace(r,"").replace(/\n\s*\*\s*\n/g,`
3
- `));if(!t.some((a,i)=>a!==e.leadingComments[i]))return;return{...e,leadingComments:t}}}function Yo(n,r){return(e)=>{if(r&&!r(e))return;if(!e.typeAnnotation)return;let t=`${n}<${e.typeAnnotation}>`,o=e.text.replace(e.typeAnnotation,t);return{...e,typeAnnotation:t,text:o}}}var Xo=it({name:"readonly",version:"1.0.0",description:"Makes all interface properties readonly",transform:Pi}),Zo=it({name:"strip-private",version:"1.0.0",description:"Strips @internal, @private, and @hidden declarations",transform:Ai((n)=>{if(!n.leadingComments)return!1;return n.leadingComments.some((r)=>/@(internal|private|hidden)\b/.test(r))})}),Qo=it({name:"declare",version:"1.0.0",description:"Adds declare keyword to all declarations",transform:Di("declare",(n)=>n.kind!=="import")});function ea(n){return it({name:`namespace-prefix-${n}`,version:"1.0.0",description:`Prefixes exported declarations with ${n}`,transform:Ti(`${n}_`,(r)=>r.isExported&&r.kind!=="import")})}function f(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}
4
- export{$i,Ei,Nn,Bo,ki,Wo,Te,_o,it,jo,Ti,Go,Ai,Vo,zo,Uo,Ho,Di,Pi,Ko,qo,Jo,Yo,Xo,Zo,Qo,ea};
2
+ import{se}from"./chunk-rzjj16rb.js";function gr(n,r,e,t={}){return{kind:n,name:r,text:e,isExported:t.isExported??!1,...t}}function hr(n){if(typeof structuredClone==="function")return structuredClone(n);return JSON.parse(JSON.stringify(n))}function en(n,r,e=null){for(let t of n){r.enter?.(t,e);let o=r[t.kind];if(o)o(t,e);if(t.members&&t.members.length>0)en(t.members,r,t);r.leave?.(t,e)}}function _i(n,r){let e=[];return en(n,{enter:(t)=>{if(r(t))e.push(t)}}),e}async function yr(n,r,e){let t=[],o=n.length;for(let a=0;a<n.length;a++){let i=n[a],s={...e,index:a,total:o,allDeclarations:n},l=await r(i,s);if(l===null)continue;else if(l===void 0)t.push(i);else if(Array.isArray(l))t.push(...l);else t.push(l)}return t}function ji(...n){return async(r,e)=>{let t=r;for(let o of n){if(t===null)return null;if(Array.isArray(t)){let a=[];for(let i of t){let s=await o(i,e);if(s===null)continue;if(s===void 0)a.push(i);else if(Array.isArray(s))a.push(...s);else a.push(s)}t=a.length>0?a:null}else{let a=await o(t,e);if(a===null)t=null;else if(a===void 0);else t=a}}return t}}function Se(n,r){let e=new Set(Array.isArray(n)?n:[n]);return async(t,o)=>{if(e.has(t.kind))return r(t,o);return}}function Gi(n,r){return async(e,t)=>{if(n(e))return r(e,t);return}}function Ye(n){let r={createDeclaration:gr,cloneDeclaration:hr,modifyText:(e,t)=>({...e,text:t}),addModifier:(e,t)=>({...e,modifiers:[...e.modifiers||[],t]}),removeModifier:(e,t)=>({...e,modifiers:(e.modifiers||[]).filter((o)=>o!==t)})};return se({name:n.name,version:n.version,description:n.description,onBeforeFile:n.beforeParse?async(e)=>n.beforeParse(e.content,{filePath:e.filePath,phase:"before"}):void 0,onDeclarations:n.transform?async(e)=>yr(e.declarations,n.transform,{filePath:e.filePath,sourceCode:e.sourceCode,...r}):void 0,onAfterFile:n.afterGenerate?async(e)=>n.afterGenerate(e.content,{filePath:e.filePath,phase:"after"}):void 0})}function Vi(n,r){let e=typeof n==="string"?new RegExp(n):n;return(t)=>{if(e.test(t.name)){let o=typeof r==="function"?r(t.name,t):t.name.replace(e,r),a=t.text.replace(new RegExp(`\\b${f(t.name)}\\b`),o);return{...t,name:o,text:a}}return}}function br(n,r){return(e)=>{if(e.kind==="import")return;if(r&&!r(e))return;let t=`${n}${e.name}`,o=e.text.replace(new RegExp(`\\b${f(e.name)}\\b`),t);return{...e,name:t,text:o}}}function zi(n,r){return(e)=>{if(e.kind==="import")return;if(r&&!r(e))return;let t=`${e.name}${n}`,o=e.text.replace(new RegExp(`\\b${f(e.name)}\\b`),t);return{...e,name:t,text:o}}}function wr(n){let r=typeof n==="function"?n:(e)=>(typeof n==="string"?new RegExp(n):n).test(e.name);return(e)=>{if(r(e))return null;return}}function Ui(n){return(r)=>{let e=n(r);if(!e)return;let o=(Array.isArray(e)?e:[e]).map((a)=>{if(a.startsWith("/**"))return a;if(a.startsWith("/*"))return a;return`/** ${a} */`});return{...r,leadingComments:[...r.leadingComments||[],...o]}}}function Hi(n){return(r)=>{if(!r.typeAnnotation)return;let e=n(r.typeAnnotation,r);if(e===null)return null;if(e===void 0)return;let t=r.text.replace(new RegExp(`:[ ]*${f(r.typeAnnotation)}`),`: ${e}`);return{...r,typeAnnotation:e,text:t}}}function Ki(n){return Se("function",(r)=>{if(!r.returnType)return;let e=n(r.returnType,r);if(e===null)return null;if(e===void 0)return;let t=r.text.replace(new RegExp(`\\):[ ]*${f(r.returnType)}`),`): ${e}`);return{...r,returnType:e,text:t}})}function qi(n){return Se(["function","class"],(r)=>{if(!r.parameters)return;let e=n(r.parameters,r);if(e===null)return null;if(e===void 0)return;let t=e.map((a)=>{let i="";if(a.rest)i+="...";if(i+=a.name,a.optional)i+="?";if(a.type)i+=`: ${a.type}`;if(a.defaultValue)i+=` = ${a.defaultValue}`;return i}).join(", "),o=r.text.replace(/\([^)]*\)/,`(${t})`);return{...r,parameters:e,text:o}})}function xr(n,r){return(e)=>{if(r&&!r(e))return;if(e.modifiers?.includes(n))return;let t=[...e.modifiers||[],n],o=e.text;if(!o.includes(n)){let a=["function","class","interface","type","enum","const","let","var"];for(let i of a){let s=o.indexOf(i);if(s>=0){o=`${o.slice(0,s)}${n} ${o.slice(s)}`;break}}}return{...e,modifiers:t,text:o}}}var Cr=Se(["interface","type"],(n)=>{let r=n.text.replace(/(\n\s*)(\w+)(\??:\s)/g,"$1readonly $2$3");if(r===n.text)return;return{...n,text:r}}),Ji=Se(["interface","type"],(n)=>{let r=n.text.replace(/(\w+)\?:/g,"$1:");if(r===n.text)return;return{...n,text:r}}),Yi=Se(["interface","type"],(n)=>{let r=n.text.replace(/(\w+)(?<!\?):/g,"$1?:");if(r===n.text)return;return{...n,text:r}});function Xi(n){let r=new RegExp(`@(${n.join("|")})\\b[^@]*`,"g");return(e)=>{if(!e.leadingComments?.length)return;let t=e.leadingComments.map((a)=>a.replace(r,"").replace(/\n\s*\*\s*\n/g,`
3
+ `));if(!t.some((a,i)=>a!==e.leadingComments[i]))return;return{...e,leadingComments:t}}}function Zi(n,r){return(e)=>{if(r&&!r(e))return;if(!e.typeAnnotation)return;let t=`${n}<${e.typeAnnotation}>`,o=e.text.replace(e.typeAnnotation,t);return{...e,typeAnnotation:t,text:o}}}var Qi=Ye({name:"readonly",version:"1.0.0",description:"Makes all interface properties readonly",transform:Cr}),es=Ye({name:"strip-private",version:"1.0.0",description:"Strips @internal, @private, and @hidden declarations",transform:wr((n)=>{if(!n.leadingComments)return!1;return n.leadingComments.some((r)=>/@(internal|private|hidden)\b/.test(r))})}),ts=Ye({name:"declare",version:"1.0.0",description:"Adds declare keyword to all declarations",transform:xr("declare",(n)=>n.kind!=="import")});function ns(n){return Ye({name:`namespace-prefix-${n}`,version:"1.0.0",description:`Prefixes exported declarations with ${n}`,transform:br(`${n}_`,(r)=>r.isExported&&r.kind!=="import")})}function f(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}
4
+ export{gr,hr,en,_i,yr,ji,Se,Gi,Ye,Vi,br,zi,wr,Ui,Hi,Ki,qi,xr,Cr,Ji,Yi,Xi,Zi,Qi,es,ts,ns};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{u}from"./chunk-6b6rt0yh.js";import{e}from"./chunk-8vvryt8p.js";import{E,b}from"./chunk-t5nmnzy6.js";import{ce}from"./chunk-x6ddycvm.js";import{existsSync as T,readFileSync as N,realpathSync as w,statSync as q}from"fs";import{builtinModules as X}from"module";import{dirname as I,extname as F,isAbsolute as A,join as J,relative as U,resolve as S}from"path";var B=[".ts",".tsx",".mts",".cts",".vue",".stx",".js",".jsx",".mjs",".cjs",".d.ts",".d.mts",".d.cts"],V={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".ts",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function k(t){try{return q(t).isFile()}catch{return!1}}function ae(t,i){let s=t.replace(/[?#].*$/,"");if(!(s.startsWith("./")||s.startsWith("../")||s==="."||s==="..")&&!A(s))return{resolved:null,isRelative:!1};let a=I(i),c=S(a,s);if(k(c))return{resolved:c,isRelative:!0};let p=F(c),d=V[p];if(d){let f=c.slice(0,-p.length);for(let r of d){let o=f+r;if(k(o))return{resolved:o,isRelative:!0}}}for(let f of B){let r=c+f;if(k(r))return{resolved:r,isRelative:!0}}if(T(c))for(let f of B){let r=J(c,`index${f}`);if(k(r))return{resolved:r,isRelative:!0}}return{resolved:null,isRelative:!0}}function C(t,i){let s=t.indexOf("*");return s===-1?i===t:i.startsWith(t.slice(0,s))&&i.endsWith(t.slice(s+1))&&i.length>=t.length-1}function K(t,i){if(Object.hasOwn(t,i))return t[i]!==null;let s=Object.keys(t).filter((l)=>l.includes("*")&&C(l,i)).sort((l,a)=>a.indexOf("*")-l.indexOf("*")||a.length-l.length)[0];return s!==void 0&&t[s]!==null}function D(t,i){if(!t.name||i!==t.name&&!i.startsWith(`${t.name}/`))return!1;if(t.exports===void 0)return!0;let s=i===t.name?".":`.${i.slice(t.name.length)}`;if(typeof t.exports==="string"||Array.isArray(t.exports))return s===".";if(!t.exports||typeof t.exports!=="object")return!1;let l=t.exports;if(!Object.keys(l).some((c)=>c.startsWith(".")))return s===".";return K(l,s)}function W(t,i){let s=U(t,i);return s!==".."&&!s.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!A(s)}async function Oe(t){let i=await ce(S(t.cwd,t.tsconfigPath||"tsconfig.json")),s=Object.entries(i?.paths??{});if(s.length===0){let r=(o,n)=>ae(o,n);return r.cacheKey=(o)=>JSON.stringify(o.map((n)=>({file:n,references:P(N(n,"utf8"),{includeImports:!0}).map((g)=>({specifier:g.specifier,resolution:r(g.specifier,n)}))}))),r}let l=i?.baseUrl??i?.pathsBasePath??t.cwd,a=S(t.cwd,t.root),c=new Map,p=new Set([...X,"bun"]),d=(r)=>{let o=I(r),n=[];while(!0){if(c.has(o)){let m=c.get(o);for(let x of n)c.set(x,m);return m}n.push(o);let g=J(o,"package.json");if(T(g)){let x={...JSON.parse(N(g,"utf8")),directory:w(o)};for(let O of n)c.set(O,x);return x}let v=I(o);if(v===o)return;o=v}},f=(r,o)=>{if(r.startsWith(".")||A(r))return ae(r,o);if(r.startsWith("node:")||r.startsWith("bun:")||p.has(r))return{resolved:null,isRelative:!1};let n=d(o),g=r.startsWith("@")?/^@[^/]+\/[^/]+/.exec(r)?.[0]:r.split("/")[0];if(n&&(D(n,r)||K(n.imports??{},r)||g&&[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies].some((h)=>Object.hasOwn(h??{},g))))return{resolved:null,isRelative:!1};let v=s.filter(([h])=>C(h,r)).sort(([h],[y])=>{if(!h.includes("*"))return-1;if(!y.includes("*"))return 1;return y.indexOf("*")-h.indexOf("*")})[0];if(!v)return{resolved:null,isRelative:!1};let[m,x]=v,O=m.indexOf("*"),L=O===-1?"":r.slice(O,r.length-(m.length-O-1));for(let h of x){let y=S(l,h.replace("*",L)),M=d(y);if(M&&D(M,r)&&!M.private&&M.directory!==n?.directory)return{resolved:null,isRelative:!1};let j=ae(y,o);if(!j.resolved)continue;let R=w(j.resolved),_=t.outputStructure==="flat"||T(a)&&W(w(a),R);if(!n||!W(n.directory,R)||!_||d(R)?.directory!==n.directory||/\.d\.(?:ts|mts|cts)$/.test(R))throw Error(`Local alias ${JSON.stringify(r)} from ${o} resolves outside its emitted package source: ${R}`);return e.debug(`Resolved local declaration alias ${r} from ${o} to ${R}`),{resolved:t.outputStructure==="flat"?j.resolved:S(a,U(w(a),R)),isRelative:!0,isAlias:!0,suffix:y.match(/[?#].*$/)?.[0]??""}}throw Error(`Cannot resolve local alias ${JSON.stringify(r)} from ${o} using ${t.tsconfigPath||"tsconfig.json"} (${JSON.stringify(m)})`)};return f.isPackageLocal=(r,o)=>{let n=d(r);return!!n&&d(o)?.directory===n.directory&&W(n.directory,w(o))},f.cacheKey=(r)=>{let o=r.map((g)=>({file:g,references:P(N(g,"utf8"),{includeImports:!0}).map((v)=>({specifier:v.specifier,resolution:f(v.specifier,g)}))})),n=[...new Set(c.values())].filter((g)=>g!==void 0).sort((g,v)=>g.directory.localeCompare(v.directory));return JSON.stringify({root:a,compilerOptions:i,packages:n,edges:o})},f}function P(t,i={}){let s=b(t);return(i.includeImports?["export","static-import","import-type","augmentation"]:["export"]).flatMap((a)=>s.filter((c)=>c.category===a).map(({specifier:c,kind:p,isTypeOnly:d})=>({specifier:c,kind:p,isTypeOnly:d})))}function Bn(t,i){let s=[];for(let a of b(t)){let c=i(a.specifier);if(c!==a.specifier)s.push({start:a.start,end:a.end,value:E(c,t[a.start])})}let l=t;for(let a of s.reverse())l=l.slice(0,a.start)+a.value+l.slice(a.end);return l}async function Z(t,i={}){let s=new Set,l=new Map,a=[],c=new Map,p=[];for(let d of t){let f=S(d);if(!s.has(f))s.add(f),p.push(f)}while(p.length>0){let d=p.shift(),f;try{f=await u(d)}catch{continue}c.set(d,f);let r=P(f,i);l.set(d,r);for(let o of r){let n=(i.resolveSpecifier??ae)(o.specifier,d);if(!n.isRelative)continue;if(n.resolved){if(!s.has(n.resolved))s.add(n.resolved),p.push(n.resolved)}else a.push({from:d,specifier:o.specifier,isTypeOnly:o.isTypeOnly})}}return{reachable:s,reExports:l,unresolved:a,sources:c}}
3
- export{ae,Oe,P,Bn,Z};
2
+ import{u}from"./chunk-3phg2e1n.js";import{e}from"./chunk-ss3na6s0.js";import{k,b}from"./chunk-r7qq9579.js";import{le}from"./chunk-dc6thsdb.js";import{existsSync as T,readFileSync as N,realpathSync as w,statSync as q}from"fs";import{builtinModules as X}from"module";import{dirname as I,extname as F,isAbsolute as A,join as J,relative as U,resolve as O}from"path";var B=[".ts",".tsx",".mts",".cts",".vue",".stx",".js",".jsx",".mjs",".cjs",".d.ts",".d.mts",".d.cts"],V={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".ts",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function j(t){try{return q(t).isFile()}catch{return!1}}function ce(t,i){let s=t.replace(/[?#].*$/,"");if(!(s.startsWith("./")||s.startsWith("../")||s==="."||s==="..")&&!A(s))return{resolved:null,isRelative:!1};let a=I(i),c=O(a,s);if(j(c))return{resolved:c,isRelative:!0};let p=F(c),d=V[p];if(d){let f=c.slice(0,-p.length);for(let r of d){let o=f+r;if(j(o))return{resolved:o,isRelative:!0}}}for(let f of B){let r=c+f;if(j(r))return{resolved:r,isRelative:!0}}if(T(c))for(let f of B){let r=J(c,`index${f}`);if(j(r))return{resolved:r,isRelative:!0}}return{resolved:null,isRelative:!0}}function C(t,i){let s=t.indexOf("*");return s===-1?i===t:i.startsWith(t.slice(0,s))&&i.endsWith(t.slice(s+1))&&i.length>=t.length-1}function K(t,i){if(Object.hasOwn(t,i))return t[i]!==null;let s=Object.keys(t).filter((l)=>l.includes("*")&&C(l,i)).sort((l,a)=>a.indexOf("*")-l.indexOf("*")||a.length-l.length)[0];return s!==void 0&&t[s]!==null}function D(t,i){if(!t.name||i!==t.name&&!i.startsWith(`${t.name}/`))return!1;if(t.exports===void 0)return!0;let s=i===t.name?".":`.${i.slice(t.name.length)}`;if(typeof t.exports==="string"||Array.isArray(t.exports))return s===".";if(!t.exports||typeof t.exports!=="object")return!1;let l=t.exports;if(!Object.keys(l).some((c)=>c.startsWith(".")))return s===".";return K(l,s)}function W(t,i){let s=U(t,i);return s!==".."&&!s.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!A(s)}async function Le(t){let i=await le(O(t.cwd,t.tsconfigPath||"tsconfig.json")),s=Object.entries(i?.paths??{});if(s.length===0){let r=(o,n)=>ce(o,n);return r.cacheKey=(o)=>JSON.stringify(o.map((n)=>({file:n,references:R(N(n,"utf8"),{includeImports:!0}).map((g)=>({specifier:g.specifier,resolution:r(g.specifier,n)}))}))),r}let l=i?.baseUrl??i?.pathsBasePath??t.cwd,a=O(t.cwd,t.root),c=new Map,p=new Set([...X,"bun"]),d=(r)=>{let o=I(r),n=[];while(!0){if(c.has(o)){let m=c.get(o);for(let y of n)c.set(y,m);return m}n.push(o);let g=J(o,"package.json");if(T(g)){let y={...JSON.parse(N(g,"utf8")),directory:w(o)};for(let E of n)c.set(E,y);return y}let v=I(o);if(v===o)return;o=v}},f=(r,o)=>{if(r.startsWith(".")||A(r))return ce(r,o);if(r.startsWith("node:")||r.startsWith("bun:")||p.has(r))return{resolved:null,isRelative:!1};let n=d(o),g=r.startsWith("@")?/^@[^/]+\/[^/]+/.exec(r)?.[0]:r.split("/")[0];if(n&&(D(n,r)||K(n.imports??{},r)||g&&[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies].some((h)=>Object.hasOwn(h??{},g))))return{resolved:null,isRelative:!1};let v=s.filter(([h])=>C(h,r)).sort(([h],[S])=>{if(!h.includes("*"))return-1;if(!S.includes("*"))return 1;return S.indexOf("*")-h.indexOf("*")})[0];if(!v)return{resolved:null,isRelative:!1};let[m,y]=v,E=m.indexOf("*"),L=E===-1?"":r.slice(E,r.length-(m.length-E-1));for(let h of y){let S=O(l,h.replace("*",L)),M=d(S);if(M&&D(M,r)&&!M.private&&M.directory!==n?.directory)return{resolved:null,isRelative:!1};let P=ce(S,o);if(!P.resolved)continue;let x=w(P.resolved),_=t.outputStructure==="flat"||T(a)&&W(w(a),x);if(!n||!W(n.directory,x)||!_||d(x)?.directory!==n.directory||/\.d\.(?:ts|mts|cts)$/.test(x))throw Error(`Local alias ${JSON.stringify(r)} from ${o} resolves outside its emitted package source: ${x}`);return e.debug(`Resolved local declaration alias ${r} from ${o} to ${x}`),{resolved:t.outputStructure==="flat"?P.resolved:O(a,U(w(a),x)),isRelative:!0,isAlias:!0,suffix:S.match(/[?#].*$/)?.[0]??""}}throw Error(`Cannot resolve local alias ${JSON.stringify(r)} from ${o} using ${t.tsconfigPath||"tsconfig.json"} (${JSON.stringify(m)})`)};return f.isPackageLocal=(r,o)=>{let n=d(r);return!!n&&d(o)?.directory===n.directory&&W(n.directory,w(o))},f.cacheKey=(r)=>{let o=r.map((g)=>({file:g,references:R(N(g,"utf8"),{includeImports:!0}).map((v)=>({specifier:v.specifier,resolution:f(v.specifier,g)}))})),n=[...new Set(c.values())].filter((g)=>g!==void 0).sort((g,v)=>g.directory.localeCompare(v.directory));return JSON.stringify({root:a,compilerOptions:i,packages:n,edges:o})},f}function R(t,i={}){let s=b(t);return(i.includeImports?["export","static-import","import-type","augmentation"]:["export"]).flatMap((a)=>s.filter((c)=>c.category===a).map(({specifier:c,kind:p,isTypeOnly:d})=>({specifier:c,kind:p,isTypeOnly:d})))}function Un(t,i){let s=[];for(let a of b(t)){let c=i(a.specifier);if(c!==a.specifier)s.push({start:a.start,end:a.end,value:k(c,t[a.start])})}let l=t;for(let a of s.reverse())l=l.slice(0,a.start)+a.value+l.slice(a.end);return l}async function Q(t,i={}){let s=new Set,l=new Map,a=[],c=new Map,p=[];for(let d of t){let f=O(d);if(!s.has(f))s.add(f),p.push(f)}while(p.length>0){let d=p.shift(),f;try{f=await u(d)}catch{continue}c.set(d,f);let r=R(f,i);l.set(d,r);for(let o of r){let n=(i.resolveSpecifier??ce)(o.specifier,d);if(!n.isRelative)continue;if(n.resolved){if(!s.has(n.resolved))s.add(n.resolved),p.push(n.resolved)}else a.push({from:d,specifier:o.specifier,isTypeOnly:o.isTypeOnly})}}return{reachable:s,reExports:l,unresolved:a,sources:c}}
3
+ export{ce,Le,R,Un,Q};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import _ from"process";import{existsSync as U}from"fs";import{arch as I,platform as E}from"os";import{fileURLToPath as L}from"url";var T=["native","typescript"];function q(n,t="engine"){if(n===void 0||n===null||n==="")return;if(typeof n==="string"&&T.includes(n))return n;throw Error(`Invalid ${t} ${JSON.stringify(n)}: expected "native" or "typescript"`)}var S;function hi(n){S=q(n)}function J(n){return q(n)??S??q(_.env.DTSX_ENGINE,"DTSX_ENGINE")??"native"}var b;function w(){return`${E()==="win32"?"windows":E()}-${I()}`}function z(n){let t=[],e=_.env.DTSX_NATIVE_LIBRARY;if(e)t.push(e);for(let r of[`../native/${w()}/${n}`,`../../native/${w()}/${n}`,`../../zig-dtsx/zig-out/lib/${n}`,`../../zig-dtsx/zig-out/bin/${n}`])try{t.push(L(new URL(r,import.meta.url)))}catch{}return t}function B(){if(typeof globalThis.Bun>"u")return null;let n;try{n=import.meta.require("bun:ffi")}catch{return null}let{dlopen:t,FFIType:e,ptr:r,suffix:c,toArrayBuffer:a}=n,g=c==="dll"?`zig-dtsx.${c}`:`libzig-dtsx.${c}`;for(let u of z(g)){if(!U(u))continue;try{let p=t(u,{process_source_checked_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.ptr],returns:e.ptr},process_source_with_context_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.u64,e.ptr,e.ptr],returns:e.ptr},free_result:{args:[e.ptr,e.u64],returns:e.void}}),{symbols:l}=p,f=new TextDecoder;return{checked:(i,o,d,m,y,h)=>l.process_source_checked_v1(r(i),o,d,m,r(y),r(h)),contextual:(i,o,d,m,y,h,A,N)=>l.process_source_with_context_v1(r(i),o,d,m,r(y),h,r(A),r(N)),read:(i,o)=>{if(!i)return"";let d=o?f.decode(a(i,0,o)):"";return l.free_result(i,o),d}}}catch{continue}}return null}function k(){if(b===void 0)b=B();return b}function yi(n){return J(n)==="native"&&k()!==null}var D=new TextEncoder,s=new Uint8Array(65536),x=new BigUint64Array(1),v=new Uint32Array(1);function Ee(n,t){if(J(t.engine)==="typescript")return null;let e=k();if(!e)return null;if(n.length*3>s.length)s=new Uint8Array(n.length*3);let{written:r}=D.encodeInto(n,s),c=t.sourceFile!==void 0||(t.inferenceSources?.size??0)>0||(t.augmentationImports?.size??0)>0,a;if(c){let u=t.sourceFile??"source.ts",p=D.encode(JSON.stringify({version:1,moduleSpecifierMode:"preserve",sourceFile:u,outputFile:u.replace(/\.(?:[cm]?[jt]sx?|vue|stx)$/,".d.ts"),sourceHash:new Bun.CryptoHasher("sha256").update(s.subarray(0,r)).digest("hex"),rewrites:[],augmentationImports:[...t.augmentationImports??[]],inferenceSources:[...t.inferenceSources??[]].map(([l,f])=>({specifier:l,source:f}))}));a=e.contextual(s,r,t.keepComments,t.isolatedDeclarations,p,p.length,x,v)}else a=e.checked(s,r,t.keepComments,t.isolatedDeclarations,x,v);let g=Number(x[0]);if(v[0]!==0)return e.read(a,g),null;return e.read(a,g)}
3
- export{q,hi,J,yi,Ee};
2
+ import _ from"process";import{existsSync as U}from"fs";import{arch as I,platform as E}from"os";import{fileURLToPath as L}from"url";var T=["native","typescript"];function J(n,t="engine"){if(n===void 0||n===null||n==="")return;if(typeof n==="string"&&T.includes(n))return n;throw Error(`Invalid ${t} ${JSON.stringify(n)}: expected "native" or "typescript"`)}var S;function ni(n){S=J(n)}function Y(n){return J(n)??S??J(_.env.DTSX_ENGINE,"DTSX_ENGINE")??"native"}var b;function w(){return`${E()==="win32"?"windows":E()}-${I()}`}function z(n){let t=[],e=_.env.DTSX_NATIVE_LIBRARY;if(e)t.push(e);for(let r of[`../native/${w()}/${n}`,`../../native/${w()}/${n}`,`../../zig-dtsx/zig-out/lib/${n}`,`../../zig-dtsx/zig-out/bin/${n}`])try{t.push(L(new URL(r,import.meta.url)))}catch{}return t}function B(){if(typeof globalThis.Bun>"u")return null;let n;try{n=import.meta.require("bun:ffi")}catch{return null}let{dlopen:t,FFIType:e,ptr:r,suffix:c,toArrayBuffer:a}=n,g=c==="dll"?`zig-dtsx.${c}`:`libzig-dtsx.${c}`;for(let u of z(g)){if(!U(u))continue;try{let p=t(u,{process_source_checked_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.ptr],returns:e.ptr},process_source_with_context_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.u64,e.ptr,e.ptr],returns:e.ptr},free_result:{args:[e.ptr,e.u64],returns:e.void}}),{symbols:l}=p,f=new TextDecoder;return{checked:(i,o,d,m,y,h)=>l.process_source_checked_v1(r(i),o,d,m,r(y),r(h)),contextual:(i,o,d,m,y,h,A,N)=>l.process_source_with_context_v1(r(i),o,d,m,r(y),h,r(A),r(N)),read:(i,o)=>{if(!i)return"";let d=o?f.decode(a(i,0,o)):"";return l.free_result(i,o),d}}}catch{continue}}return null}function k(){if(b===void 0)b=B();return b}function ri(n){return Y(n)==="native"&&k()!==null}var D=new TextEncoder,s=new Uint8Array(65536),x=new BigUint64Array(1),v=new Uint32Array(1);function $e(n,t){if(Y(t.engine)==="typescript")return null;let e=k();if(!e)return null;if(n.length*3>s.length)s=new Uint8Array(n.length*3);let{written:r}=D.encodeInto(n,s),c=t.sourceFile!==void 0||(t.inferenceSources?.size??0)>0||(t.augmentationImports?.size??0)>0,a;if(c){let u=t.sourceFile??"source.ts",p=D.encode(JSON.stringify({version:1,moduleSpecifierMode:"preserve",sourceFile:u,outputFile:u.replace(/\.(?:[cm]?[jt]sx?|vue|stx)$/,".d.ts"),sourceHash:new Bun.CryptoHasher("sha256").update(s.subarray(0,r)).digest("hex"),rewrites:[],augmentationImports:[...t.augmentationImports??[]],inferenceSources:[...t.inferenceSources??[]].map(([l,f])=>({specifier:l,source:f}))}));a=e.contextual(s,r,t.keepComments,t.isolatedDeclarations,p,p.length,x,v)}else a=e.checked(s,r,t.keepComments,t.isolatedDeclarations,x,v);let g=Number(x[0]);if(v[0]!==0)return e.read(a,g),null;return e.read(a,g)}
3
+ export{J,ni,Y,ri,$e};
@@ -0,0 +1,7 @@
1
+ // @bun
2
+ import{a,i,y,g,xe,Ue}from"./chunk-h3m1vfa2.js";function t(f){let o=[],c=f.length,l=new Set,e=Ue(f,l),r=0;function h(){let w=r++;while(r<c){let S=f.charCodeAt(r);if(S===92)r+=2;else if(S===96){o.push({start:w,end:++r,kind:"literal"});return}else if(S===36&&f.charCodeAt(r+1)===123)o.push({start:w,end:r+1,kind:"literal"}),o.push({start:r+1,end:r+2,kind:"punctuation"}),r+=2,p(!0),w=r;else r++}o.push({start:w,end:r,kind:"literal"})}function p(w=!1){let S=0,C=0;while(r<c){let T=r,n=f.charCodeAt(r);if(n===60&&(C>0||f[r+1]!=="/"&&xe(f,r,o.at(-1)?.end??0))){let u=e(r);if(u){if(C=Math.max(0,C+u.delta),u.delta<0){r=u.end+1,o.push({start:T,end:r,kind:"literal"});continue}}}if(n===32||n>=9&&n<=13||n>127&&/\s/.test(f[r])){r++;continue}if(n===47){let u=f.charCodeAt(r+1);if(u===47){let s=f.indexOf(`
3
+ `,r+2);r=s===-1?c:s+1;continue}if(u===42){let s=f.indexOf("*/",r+2);r=s===-1?c:s+2;continue}if(!l.has(r)&&y(f,r,o.at(-1)?.end??0)){r=g(f,r),o.push({start:T,end:r,kind:"literal"});continue}}else if(n===96){h();continue}else if(n===34||n===39){r++;let u=!1;while(r<c){let s=f.charCodeAt(r++);if(s===92)r++;else if(s===n){u=!0;break}}o.push({start:T,end:Math.min(r,c),kind:u?"quoted":"literal"});continue}else if(a(n)){while(i(f.charCodeAt(++r)));o.push({start:T,end:r,kind:"word"});continue}if(o.push({start:T,end:++r,kind:"punctuation"}),w){if(n===123)S++;else if(n===125){if(S===0)return;S--}}}}return p(),o}var q,O=[];function m(f){if(f!==q)O=t(f),q=f;return O}function ur(){q=void 0,O=[]}function d(f){let o="",c=f.length-1;for(let l=1;l<c;l++){if(f[l]!=="\\"){o+=f[l];continue}let e=f[++l];if(l>=c)return;switch(e){case`
4
+ `:break;case"\r":if(f[l+1]===`
5
+ `)l++;break;case"n":o+=`
6
+ `;break;case"r":o+="\r";break;case"t":o+="\t";break;case"b":o+="\b";break;case"f":o+="\f";break;case"v":o+="\v";break;case"0":if(/\d/.test(f[l+1]??""))return;o+="\x00";break;case"x":case"u":{let r=e==="u"&&f[l+1]==="{",h=l+(r?2:1),p=r?f.indexOf("}",h):h+(e==="x"?2:4),w=f.slice(h,p);if(p<h||p>c||!/^[\da-f]+$/i.test(w)||r&&w.length>6)return;let S=Number.parseInt(w,16);if(S>1114111)return;o+=String.fromCodePoint(S),l=r?p:p-1;break}default:if(/\d/.test(e))return;o+=e}}return o}function k(f,o){let c=o;for(let l of f){let e=l.charCodeAt(0);if(l===o||l==="\\")c+=`\\${l}`;else if(e<32||e===8232||e===8233||l.length===1&&e>=55296&&e<=57343)c+=`\\u${e.toString(16).padStart(4,"0")}`;else c+=l}return c+o}function ze(f){let o=t(f),c=(p)=>o[p]?f.slice(o[p].start,o[p].end):"";if(c(0)!=="import")return;let l=c(1)==="type"&&c(2)!=="=",e=l?2:1;if(o[e]?.kind!=="word"||c(e+1)!=="="||c(e+2)!=="require"||c(e+3)!=="("||o[e+4]?.kind!=="quoted"||c(e+5)!==")")return;let r=e+6;if(o.length!==r&&!(o.length===r+1&&c(r)===";"))return;let h=d(c(e+4));if(h===void 0)return;return{name:c(e),source:h,isTypeOnly:l,end:o[o.length-1].end}}function b(f){let o=t(f),c=[],l=new Set,e=(n)=>n>=0&&n<o.length?f.slice(o[n].start,o[n].end):"",r=(n)=>o[n]?.kind==="quoted",h=(n)=>o[n]?.kind==="word",p=[],w=!1,S=0;if(f.includes("declare")&&f.includes("module"))for(let n=0;n<o.length;n++){let u=e(n);if(S===0&&h(n)&&e(n-1)!=="."&&e(n-1)!=="#"){if(u==="export"||u==="import"&&e(n+1)!=="("&&e(n+1)!==".")w=!0;if(u==="declare"&&e(n+1)==="module"&&r(n+2)&&e(n+3)==="{")p.push(n+2)}if(u==="{"||u==="("||u==="[")S++;else if(u==="}"||u===")"||u==="]")S--}function C(n,u=!1){if(e(n)==="*"){if(e(n+1)==="as")return h(n+2)||u&&r(n+2)?n+3:-1;return u?n+1:-1}if(e(n)!=="{")return-1;let s=1;for(let x=n+1;x<o.length;x++)if(e(x)==="{")s++;else if(e(x)==="}"&&--s===0)return x+1;else if(o[x].kind==="literal"||e(x)===";")return-1;return-1}function T(n,u,s,x){let M=o[n];if(!M||M.kind!=="quoted"||l.has(M.start))return;let R=d(f.slice(M.start,M.end));if(R===void 0)return;l.add(M.start),c.push({specifier:R,kind:u,isTypeOnly:s,category:x,start:M.start,end:M.end})}for(let n=0;n<o.length;n++){if(!h(n)||e(n-1)==="."||e(n-1)==="#")continue;let u=e(n),s=n+1;if(u==="export"){let x=e(s)==="type";if(x)s++;let M=e(s)==="*"?e(s+1)==="as"?"export-star-as":"export-star":"export-named",R=C(s,!0);if(R>=0&&e(R)==="from")T(R+1,M,x,"export")}else if(u==="import"){if(r(s)){T(s,"import",!1,"static-import");continue}if(e(s)==="("){if(e(s+2)===")"||e(s+2)===",")T(s+1,"import",!1,"import-type");continue}let x=e(s)==="type"&&e(s+1)!=="from"&&e(s+1)!=="="&&e(s+1)!==",";if(x)s++;if(h(s)){if(s++,e(s)==="="){if(e(s+1)==="require"&&e(s+2)==="("&&e(s+4)===")")T(s+3,"import",x,"static-import");continue}if(e(s)===",")s=C(s+1)}else s=C(s);if(s>=0&&e(s)==="from")T(s+1,"import",x,"static-import")}}if(w&&p.length){for(let n of p)T(n,"import",!0,"augmentation");c.sort((n,u)=>n.start-u.start)}return c}
7
+ export{t,m,ur,d,k,ze,b};